Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESM Phase Imports import() & new Worker() support for WA.Module #106

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

guybedford
Copy link
Collaborator

@guybedford guybedford commented Mar 21, 2025

This implements the ESM Phase Imports proposal, which in turn allows Wasm to define support for new Worker(module) and import(module) where module is an instance of WebAssembly.Module.

The corresponding HTML integration PR is available in whatwg/html#11152.

We carefully define the difference between rooted and unrooted modules (those checked in the registry by the source phase, and those that are dynamically compiled with user sources / "evalish"), and then we define registry identity and include the URL in the transfer process for rooted modules.

Registry identity in the ESM Phase Imports proposal is based on the ModuleSourcesEqual concrete method which is implemented for WebAssembly Module Record allowing import(module) === import(module) equality for rooted sources and through structured clone transfer. For more info, this topic has been covered extensively in the last TC39 meetings for the ESM Phase Imports proposal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant