Skip to content

Commit

Permalink
Note interaction with import assertions (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford authored Dec 2, 2021
1 parent eee66a1 commit dadf3cb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions proposals/esm-integration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ The ECMAScript specification holds the module's export in a lexical scope, as po

At the end of the link phase, the variables in the module's lexical scope are generally uninitialized. From JavaScript, accessing an uninitialized import causes a ReferenceError. JavaScript function declarations are initialized during the Link phase, as part of function hoisting, but WebAssembly function exports are not initialized until the Evaluation phase.

#### Import Assertions

[Import assertions](https://github.com/tc39/proposal-import-assertions) specify linking invariants that should be verified before evaluation can proceed. Currently HTML specifies a `"type"` assertion which is a requirement for CSS or JSON module imports due to their having different security privileges over full execution.

When importing WebAssembly from JavaScript, no assertion should be required since they share the same security privilege level in the ESM integration and in order to ensure transparent interoperability of the formats.

Future Wasm extensions may include supporting these assertions for imports from WebAssembly modules.

### Evaluate

During evaluation, the code is evaluated to assign values to the exported bindings. In JS, this means running the top-level module code.
Expand Down

0 comments on commit dadf3cb

Please sign in to comment.