refactor: Relieve dependency on babel-standalone #4758
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.