-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ses,module-source): Dynamic import (#2639)
Closes: #291 ## Description This change adds support for dynamic `import` to `ses` and `@endo/module-source`, such that `import(x)` in the scope of a module loaded from source (using `ModuleSource` in a `Compartment` module loading hook). ### Security Considerations This change builds on prior work to ensure that dynamic import is facilitated by a hidden lexical name injected by `ses`. The dynamic import mechanism is isolated to the surrounding compartment and specifiers are resolved on the surrounding module. ### Scaling Considerations This change introduces a static analysis for the presence of a dynamic `import` in the module source, which it communicates on the module source, even if marshaled through JSON, to `ses` that it should create an `import` closure bound to the calling module’s base specifier. This avoids an allocation for most modules. ### Documentation Considerations Only news included. Dynamic import is a language feature that is expected to work in general and documented where JavaScript is documented as a language. ### Testing Considerations This change includes a minimal happy path test that verifies that dynamic import produces a promise that settles on a module namespace object. Note that dynamic import does not box namespaces regardless of the `__noNamespaceBox__` compartment option. ### Compatibility Considerations Backward compatible. ### Upgrade Considerations None.
- Loading branch information
Showing
10 changed files
with
97 additions
and
7 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
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
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
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