-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(endo): Search for index.js and implied package exports
When asked for a module named "x", Node.js will search for "x.js" then "x/index.js". For packages that do not supply an "exports" property in their "package.json", any module contained by that package is a valid exported module. To achieve parity with these two features, Endo uses different techniques when loading from the file system and loading from an archive. When reading from the file system, Endo will search for a satsifactory candidate in each compartment's asynchronous importHook. Endo also uses the compartment's new moduleMapHook to search for dependency compartments in the "scope" of a module identifier prefix. These allow Endo to operate from an incomplete compartment map for the initial load. The Endo archiver instead creates a more complete compartment map, with every discovered module. This introduces a new kind of module to the compartment map module descriptor type union: modules with known locations and corresponding parsers. The archiver erases the "scopes", "types", and "parsers" on each compartment description since they are no longer necessary. When reading from an archive, Endo uses an importHook that consults the compartment map directly for the locations of all contained modules, and creates a complete moduleMap up front.
- Loading branch information
Showing
13 changed files
with
345 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.