In this change, we carve and export -lite.js and -parsers.js out of import.js, archive.js, and import-archive.js, as well revealing mapNodeModules through @endo/compartment-mapper/node-modules.js revealing hidden flexibility already present in the Compartment Mapper. This allows the Compartment Mapper to mix and match “language behaviors” with different workflows (e.g., using import-parsers.js with archive-lite.js instead of archive-parsers.js generates archives with original sources instead of precompiled sources.) We also decouple the process of discovering the physical compartments such that node-modules.js can be substituted for alternate compartment exploration algorithms, e.g., combining a custom lockfile and package cache from a specific package management solution.
Security Considerations
Does not cross security considerations.
Scaling Considerations
Exporting more narrowly scoped modules allows consumers to be avoid entraining Babel in a greater variety of scenarios.
Documentation Considerations
Evolution of the reference documentation should suffice, though another pass at README.md to dig into these more surgical and composable APIs may be worthwhile.
Testing Considerations
The existing scenarios are extensive and fully cover the behaviors that we’ve factored out. I expect #2294 tests to cover the new scenarios.
Compatibility Considerations
This change takes great care to preserve the existing behavior of the composite import.js, archive.js, and import-archive.js interfaces, only revealing existing behaviors that were previously internal, allowing more expressible scenarios.
Upgrade Considerations
This change will not affect upgrade and paves a migration path forward for preserving backward-compatibility for bundleSource and importBundle as we draw closer to supporting XS native compartments.
Refs: #400 and #2294
Description
In this change, we carve and export
-lite.js
and-parsers.js
out ofimport.js
,archive.js
, andimport-archive.js
, as well revealingmapNodeModules
through@endo/compartment-mapper/node-modules.js
revealing hidden flexibility already present in the Compartment Mapper. This allows the Compartment Mapper to mix and match “language behaviors” with different workflows (e.g., usingimport-parsers.js
witharchive-lite.js
instead ofarchive-parsers.js
generates archives with original sources instead of precompiled sources.) We also decouple the process of discovering the physical compartments such thatnode-modules.js
can be substituted for alternate compartment exploration algorithms, e.g., combining a custom lockfile and package cache from a specific package management solution.Security Considerations
Does not cross security considerations.
Scaling Considerations
Exporting more narrowly scoped modules allows consumers to be avoid entraining Babel in a greater variety of scenarios.
Documentation Considerations
Evolution of the reference documentation should suffice, though another pass at README.md to dig into these more surgical and composable APIs may be worthwhile.
Testing Considerations
The existing scenarios are extensive and fully cover the behaviors that we’ve factored out. I expect #2294 tests to cover the new scenarios.
Compatibility Considerations
This change takes great care to preserve the existing behavior of the composite
import.js
,archive.js
, andimport-archive.js
interfaces, only revealing existing behaviors that were previously internal, allowing more expressible scenarios.Upgrade Considerations
This change will not affect upgrade and paves a migration path forward for preserving backward-compatibility for
bundleSource
andimportBundle
as we draw closer to supporting XS native compartments.