tc39 / proposal-source-phase-imports

Proposal to enable importing modules at the source phase
https://tc39.es/proposal-source-phase-imports/
MIT License
132 stars 8 forks source link

Propose JS module reflection API #20

Closed guybedford closed 2 years ago

guybedford commented 2 years ago

This proposes a new JS module reflection API for this proposal, to support a JS module reflection returning a SourceTextModule class instance, and which can be instantiated into a ModuleInstance instance, linked and executed.

The provided documentation details the entire API as well as an example of how to construct a comprehensive module loader in less than 50 lines of code that obeys spec semantics and invariants while allowing resolution and linkage customization.