Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(module-source): Add XS specific variant #2470

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

kriskowal
Copy link
Member

@kriskowal kriskowal commented Sep 26, 2024

Closes: #2250
Refs: #2251

Description

Toward using native XS compartments and module sources, this change adds an XS-specific variant of @endo/module-source that patches the native ModuleSource in place instead of entraining Babel. This will allow an XS-specific @endo/import-bundle variant to load both pre-compiled sources (pre-json-mjs) and original ESM sources (mjs).

This change is opt-in, provided the xs runtime condition. These are conditions introduced by Node.js with the node -C development entry.js precedent and supported by @endo/compartment-mapper for both endoScript and endoZipBase64 bundle formats.

Security Considerations

This change increases exposure to a native ModuleSource as implemented in a memory-unsafe language.

Scaling Considerations

We expect a significant improvement in performance at both bundle time and run time upon completion of #2251 since native ModuleSource is considerably faster than a virtualization.

Documentation Considerations

Captured in NEWS.md and README.md.

Testing Considerations

This change introduces a minimal text:xs that runs with xst and is exercised by Continuous Integration. This minimal test can be expanded as we make more progress with the XS-variant of SES, which will allow the virtual Compartment to opt-in to use native ModuleSource.

Compatibility Considerations

The XS-specific shim is not a one-to-one replacement for the Babel implementation and does not support some of the optional arguments. Code that expects these hooks to be called will be dismayed. Despite these limitations, no existing program should break: the xs condition should not be present in any existing application.

Upgrade Considerations

This change will not come to bear on the Agoric chain until after a new version of XS becomes available with a new XS-specific lockdown preamble.

@kriskowal kriskowal force-pushed the kriskowal-xs-module-source-shim branch 4 times, most recently from 2524d16 to 0e134ba Compare September 26, 2024 20:50
@kriskowal kriskowal force-pushed the kriskowal-xs-module-source-shim branch 3 times, most recently from 8ddbfc3 to 70beef1 Compare September 27, 2024 05:23
@kriskowal kriskowal force-pushed the kriskowal-xs-module-source-shim branch from 70beef1 to 5342ea3 Compare October 9, 2024 06:04
@kriskowal kriskowal force-pushed the kriskowal-xs-module-source-shim branch 19 times, most recently from 6375752 to a4b58b6 Compare October 18, 2024 22:53
@kriskowal kriskowal force-pushed the kriskowal-xs-module-source-shim branch 7 times, most recently from fd90e45 to 555ea34 Compare October 19, 2024 05:35
@kriskowal kriskowal force-pushed the kriskowal-xs-module-source-shim branch from 555ea34 to 317c723 Compare October 19, 2024 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Export native XS ModuleSource in lieu of StaticModuleRecord on XS
1 participant