refactor: plugin container for Vite 6
This PR refactors the plugin containers file:
PluginContextper-plugin, instead of per-hook, align with rollup: https://github.com/rollup/rollup/blob/1b62c336b8e927e846cd2c04563ae0868a5d5832/src/utils/PluginDriver.ts#L105-L110- Hoisted
ContextandTransformContextclasses to top-level instead of having them in the function that creates every time. - Make
EnvironmentPluginContainera class to have more explicit deps relationships and easier to work with
Run & review this pull request in StackBlitz Codeflow.
/ecosystem-ci run
📝 Ran ecosystem CI on be9094a: Open
| suite | result | latest scheduled |
|---|---|---|
| analogjs | :x: failure | :white_check_mark: success |
| astro | :x: failure | :white_check_mark: success |
| histoire | :x: failure | :white_check_mark: success |
| marko | :x: failure | :white_check_mark: success |
| nuxt | :x: failure | :white_check_mark: success |
| previewjs | :x: failure | :x: failure |
| quasar | :x: failure | :white_check_mark: success |
| qwik | :x: failure | :white_check_mark: success |
| rakkas | :x: failure | :white_check_mark: success |
| remix | :x: failure | :white_check_mark: success |
| sveltekit | :x: failure | :white_check_mark: success |
| vike | :x: failure | :white_check_mark: success |
| vite-plugin-svelte | :x: failure | :white_check_mark: success |
| vitepress | :x: failure | :white_check_mark: success |
| vitest | :x: failure | :x: failure |
:white_check_mark: ladle, laravel, unocss, vite-plugin-pwa, vite-plugin-react, vite-plugin-react-pages, vite-plugin-react-swc, vite-plugin-vue, vite-setup-catalogue
I've yet to thoroughly review this, but wondering, could this be refactored in main? Seems like a nice general refactor otherwise so we keep the environment API changes small. Or does it introduces breaking changes?
It's based on the new abstraction of the new env pluginConainter - it would require certain efforts to redo it in main - and then solving the conflicts in v6 as well. Do you think that would be worth the effort?
Ok, I will try to redo this on main, so we could also at least ensure it works without env api
Made the change/migration in 909782f (#16471)