Create a plan for removing SES’s dependence on Rollup
See original GitHub issue[edit 2021-05-11 @kriskowal]
We ended up eliminating SES dependence on Rollup by using SES’s own module system to create an alternative bundler, then using that bundler to create CJS, MJS, UMD, and minified UMD distributions of SES. This was possible because of compartment mapping and simplifying SES shim to only use globals to ship its API, making it module system agnostic.
Although the transitive closure of Endo modules, including the Zip library, are all ESM, the bundler doesn’t entrain anything tricky from a module system compatibility perspective except a fork of babel/standalone.
We did not choose to pursue import maps for shipping the SES ESM sources to the web, but that remains an option for users. It is unfortunately possible to use SES through an ESM transform like RESM or Rollup against our urging, which remains a problem to solve if we found it worthy of further attention.
[edit 2020-09-15 @kriskowal]
- Remove reliance on Rollup for running on CommonJS environments (or just not do that)
- Enable use on XS by ensuring all runtime dependencies are ESM (notably Zip for full SES applications)
- Enable use on Web (importmap of SES or create a run-time included single-script with SES translated down to JS programs)
- Node.js (only support ESM, drop support for Node.js 12)
[@warner]
We’ve seen some funny-looking errors during testing that suggest rollup is rewriting symbols that it thinks are defined multiple times, when in fact we’re trying to overwrite a name like console.log
or Date
.
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (5 by maintainers)
I’m elated to report that #715 replaces Rollup with a self-hosted bundler based on SES+Endo’s own ESM transforms. Evolution of the same tool may in time replace other cases where we use Rollup, and Endo archives should overtake the remaining uses.
I’m picking this ticket up now and going to attempt to create a Rollup substitute using our own module transform and compartment mapper. The compartment mapper will drive the accumulation of static module records, which now have a public interface that exposes the underlying functor source and metadata. I should be able to write a code generator that performs a DFS of the import graph, manually wiring updater functions.