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

refactor: Relieve dependency on babel-standalone #4758

Merged
merged 6 commits into from
Mar 9, 2022
Merged

refactor: Relieve dependency on babel-standalone #4758

merged 6 commits into from
Mar 9, 2022

Conversation

kriskowal
Copy link
Member

refs: endojs/endo#768

Description

Since time immemorial, SES depended on a fork of Babel-Standalone to facilitate its Module->to->Program transform in the StaticModuleRecord constructor. This bloated the weight of SES up to 3MB because the Standalone contains every Babel plugin and shim. We factored it out of SES to keep light, only bringing in the dependency on Babel if you needed to create a bundle. Then, we learned that Babel Standalone shims couldn’t initialize after Lockdown, so we had to tread carefully to ensure that Babel Standalone was initialized exactly once in an application, before Lockdown. So, even Dapps had to take a dependency on Babel Standalone and initialize it before Lockdown in any test that used Bundle Source.

That era comes to an end with this change. With the guidance of @nicolo-ribaudo and the labor of @michaelfig, we have replaced Babel Standalone with the three internal modules of Babel that we need, no shims and no plugins. Consequently, we don’t need to care about Babel Standalone anywhere anymore.

Security Considerations

This change greatly reduces the weight of the Agoric SDK supply chain, eliminating many shims that previously had to be initialized in vetted shim territory. It may now even be possible to create bundles from within a Compartment.

Documentation Considerations

The same relaxation on dependence on Babel Standalone is now possible in our documentation.

Testing Considerations

Existing tests adequately cover bundling.

@kriskowal kriskowal force-pushed the endo-768 branch 2 times, most recently from 35d72be to 922a416 Compare March 8, 2022 22:05
@kriskowal kriskowal marked this pull request as ready for review March 8, 2022 22:05
Copy link
Member

@michaelfig michaelfig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few places where @endo/init/pre.js should be loaded so that ses is loaded before the vetted shims (but before lockdown), which should help improve confinement a bit.

packages/agoric-cli/src/entrypoint.js Show resolved Hide resolved
packages/agoric-cli/test/test-main.js Show resolved Hide resolved
packages/swingset-runner/src/runner-debug-entrypoint.js Outdated Show resolved Hide resolved
@kriskowal kriskowal added automerge:no-update (expert!) Automatically merge without updates and removed automerge:no-update (expert!) Automatically merge without updates labels Mar 9, 2022
@kriskowal kriskowal added the automerge:no-update (expert!) Automatically merge without updates label Mar 9, 2022
@mergify mergify bot merged commit a10d1b3 into master Mar 9, 2022
@mergify mergify bot deleted the endo-768 branch March 9, 2022 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge:no-update (expert!) Automatically merge without updates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants