[x] Split fixtures in esbuild and webpack plugins into cjs and esm directories
Both esbuild and webpack are determining the module type based on nearest package.json file. When I switched these plugins to type: module in their respective package.json files it broke some tests, because the bundlers started treating the files as esm and not cjs like before. That's why I've split the fixtures directories and added package.json files to force the correct module type during bundling tests.
[x] Added tests for esbuild and webpack using esm configs
[x] Updated code to esm
[x] Rewrote all imports to esm style
[x] Rewrote loadPlugins to use promise based dynamic import() instead of require()
[x] Rewrote package.json import in create-help.js using createRequire to avoid using experimental import ... assert syntax
[x] Updated the ci workflow
Notes:
Some tests are generating temporary files inside 'fixtures' directory. If you do not exclude 'fixtures' directory in vitest watch path, it will result in tests infinitely triggering reruns in watch mode.
I took a liberty of rewriting a couple of tests from if (stmt) { it(...) } to it.skipIf(!stmt)( ... ) so it looks a bit cleaner and the runner reports these tests as skipped
227
type: module
to all package.json filestype: module
in their respective package.json files it broke some tests, because the bundlers started treating the files as esm and not cjs like before. That's why I've split the fixtures directories and added package.json files to force the correct module type during bundling tests.import ... assert
syntaxNotes:
if (stmt) { it(...) }
toit.skipIf(!stmt)( ... )
so it looks a bit cleaner and the runner reports these tests as skipped