Skip to content

esm: Add support for pjson cache and main without extensions

I've pulled out the refactorings from #18392 that aren't directly related to the package.json flag, in particular two features:

  1. Ensuring that node --experimental-modules module-without-an-extension works as a special case. This is necessary for ensuring backwards-compatibility with NodeJS bin workflows. But extensions are still not permitted in dependencies.
  2. Adding a package.json cache to the C++ resolver code. As mentioned previously the goal here is to ultimately share the cache with the CommonJS resolver, but for now at least this is a first step and better than having no cache as we do currently.

Review much appreciated especially with the C++ code.

Hopefully this shouldn't be too controversial allowing these useful features to not be blocked by progress on #18392.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

esmodules

Merge request reports

Loading