-
Notifications
You must be signed in to change notification settings - Fork 72
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
Import Attributes #373
Comments
Note that this feature (or something like it) is necessary to move forward on HTML/CSS/JSON modules. |
Also CC @lukewagner. Does it make sense to think about how this interacts with Wasm module linking? |
The proposal has a WebAssembly section. It wouldn't be in TC39 but our plan is to allow to express the same attributes than in JavaScript. The Wasm producer will need some syntax, or can based on the file extension. |
The use of a custom section to allow wasm modules imported via ESM-integration to import non-wasm/JS modules seems like a reasonable approach. Other than that, there's not any interaction I can think of with wasm module linking until "evaluator attributes" are added (which it sounds like is explicitly postponed). So 👍 from a wasm pov. |
I discussed this with @annevk some time ago - it's worth pursuing with a few caveats. However, those have been met before stage 2 (we considered inbound syntax as important, as otherwise it might not be used). I don't think our support has changed since. 👍 |
@lukewagner Do you think "evaluator attributes" would be useful for expressing permissions/capabilities for Wasm modules? |
@xtuc note that Wasm should not use the file externsion on the web as that would be counter to how the web works. |
@littledan I think so: evaluator attributes would allow JS code to pass the import values used to instantiate a wasm module (either to limit capabilities or to allow explicit parameterization) while still getting to use the ESM module loader system. To do so without evaluator attributes, you need to resort to using the imperative JS API and manual |
So does it make sense to mark this as |
I think we can mark it as |
closes mozilla#373 Co-authored-by: Martin Thomson <mt@lowentropy.net>
closes #373 Co-authored-by: Martin Thomson <mt@lowentropy.net>
This proposal was renamed to "Import Assertions" to reflect the keyword we ended up settling on ( The old URL in activities.json will redirect to the renamed proposal so it's probably not critical to change anything, but we just wanted to keep everyone updated. |
…ertions, per comment in mozilla#373.
At the time that this position request was originally marked Because of this split, the position at da63152 is now ambiguous; it references JSON modules but the spec it links to no longer contains JSON modules. Would it be possible to update this position to include https://github.com/tc39/proposal-json-modules, or add a new position entry for JSON modules? In case it's relevant, JSON modules is now a Stage 3 proposal (as is import assertions). Thanks! |
Hi @dandclark, In this case, I don't think we need to explicitly update it, since I gave support for it at TC39 for stage 3 and that was mozilla's position both then and now. We have started implementing both. cc @tantek |
Ok, thanks @codehag ! It's great to hear that the implementation is underway. |
Any updates on this issue implementation? |
This is not the place to look updates on implementation in Gecko. Perhaps @codehag can add the bugzilla link? |
Import assertions is finished https://bugzilla.mozilla.org/show_bug.cgi?id=1736059 As it is still at stage 3, we haven't shipped it unflagged yet, but the flag for enabling it is |
Hi, I can not use |
@321paranoiawhy it's not shipped yet https://bugzilla.mozilla.org/show_bug.cgi?id=1777526 |
@321paranoiawhy Try using the following code. async function enableWithTypeSyntax() {
let enableWithTypeSyntax = false;
const option = (() => {
const option = {};
const w = {type:"json"};
Reflect.defineProperty(option, "with", {
get: () => (enableWithTypeSyntax=true,w),
});
return option;
})();
let result;
try {
const importMethod = new Function("dataUrl", "option", "return import(dataUrl, option);");
result = await importMethod("data:application/json;base64,e30=", option);
}catch(e){}
return enableWithTypeSyntax;
} |
Request for Mozilla Position on an Emerging Web Specification
Other information
Currently Stage 2.
The text was updated successfully, but these errors were encountered: