Import Reflection for Stage 2
Currently: Stage 1
July 2022 TC39 Meeting
Guy Bedford (OpenJS Foundation)
Luca Casonato (Deno)
https://github.com/tc39/proposal-import-reflection
Import reflection
This proposal allows ES modules to import a reified representation of the compiled source of a module when the host provides such a representation:
Only the above form is supported - named exports and unbound declarations are not supported.
https://github.com/tc39/proposal-import-reflection
Dynamic import
Import reflection in dynamic import is supported through an options bag on the dynamic `import`.
https://github.com/tc39/proposal-import-reflection
Proposal Scope
Scope has been further narrowed down to the following single scenario:
Asset reference reflection is not in scope for this proposal. We will continue to consider implications for the asset references proposal during the design process though.
https://github.com/tc39/proposal-import-reflection
Keyword instead of arbitrary literal
The reflection attribute is now a keyword, not a literal.
Makes it clear that reflection attributes are not an arbitrary options bag for imports.
Makes it clear what reflection attributes may be used for.
It discourages toolchains from misusing the reflection attribute syntax space for evaluator attributes.
https://github.com/tc39/proposal-import-reflection
WebAssembly Modules
The best we have right now:
https://github.com/tc39/proposal-import-reflection
Wasm Instantiation Today
https://github.com/tc39/proposal-import-reflection
Benefits
https://github.com/tc39/proposal-import-reflection
JS Reflection
https://github.com/tc39/proposal-import-reflection
Host Hook
HostResolveModuleReflection(referencingScriptOrModule, specifier)�
https://github.com/tc39/proposal-import-reflection
Module cache key semantics
The intentions:
https://github.com/tc39/proposal-import-reflection
Open Questions
Most open questions come down to the interaction with module blocks and compartments.
https://github.com/tc39/proposal-import-reflection
Questions from the queue?
https://github.com/tc39/proposal-import-reflection
Stage 2?
Initial spec text: https://tc39.es/proposal-import-reflection/
https://github.com/tc39/proposal-import-reflection