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

Import Attributes #373

Closed
xtuc opened this issue Jun 18, 2020 · 20 comments · Fixed by #376
Closed

Import Attributes #373

xtuc opened this issue Jun 18, 2020 · 20 comments · Fixed by #376
Labels

Comments

@xtuc
Copy link
Contributor

xtuc commented Jun 18, 2020

Request for Mozilla Position on an Emerging Web Specification

Other information

Currently Stage 2.

@dbaron
Copy link
Contributor

dbaron commented Jun 18, 2020

@dbaron dbaron added the ecma label Jun 18, 2020
@hober
Copy link

hober commented Jun 18, 2020

Note that this feature (or something like it) is necessary to move forward on HTML/CSS/JSON modules.

@tschneidereit
Copy link

tschneidereit commented Jun 19, 2020

Also CC @lukewagner. Does it make sense to think about how this interacts with Wasm module linking?

@xtuc
Copy link
Contributor Author

xtuc commented Jun 19, 2020

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.

@lukewagner
Copy link

lukewagner commented Jun 19, 2020

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.

@codehag
Copy link
Collaborator

codehag commented Jun 24, 2020

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. 👍

@littledan
Copy link

littledan commented Jun 24, 2020

@lukewagner Do you think "evaluator attributes" would be useful for expressing permissions/capabilities for Wasm modules?

@annevk
Copy link
Contributor

annevk commented Jun 24, 2020

@xtuc note that Wasm should not use the file externsion on the web as that would be counter to how the web works.

@lukewagner
Copy link

lukewagner commented Jun 24, 2020

@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 fetch()ing.

@dbaron
Copy link
Contributor

dbaron commented Jun 24, 2020

So does it make sense to mark this as worth prototyping, or are there things that should happen before we're willing to do that?

@codehag
Copy link
Collaborator

codehag commented Jun 25, 2020

I think we can mark it as worth prototyping

codehag added a commit to codehag/standards-positions that referenced this issue Jun 25, 2020
codehag added a commit to codehag/standards-positions that referenced this issue Jun 25, 2020
codehag added a commit to codehag/standards-positions that referenced this issue Jun 26, 2020
closes mozilla#373

Co-authored-by: Martin Thomson <mt@lowentropy.net>
dbaron pushed a commit that referenced this issue Jun 26, 2020
closes #373

Co-authored-by: Martin Thomson <mt@lowentropy.net>
@dandclark
Copy link

dandclark commented Jul 23, 2020

This proposal was renamed to "Import Assertions" to reflect the keyword we ended up settling on (assert), and to reflect that the presence of the attributes won't affect the behavior of a module, only block it from loading (as opposed to potential "evaluator attributes").

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.

@dandclark
Copy link

dandclark commented Mar 9, 2021

At the time that this position request was originally marked worth prototyping, JSON modules was part of the import attributes proposal. Since then, JSON modules has been split off into a separate proposal: https://github.com/tc39/proposal-json-modules
(This was decided here: https://github.com/tc39/notes/blob/master/meetings/2020-07/july-21.md#conclusion--resolution-2). The actual behavior of JSON modules has not changed in any significant way.

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!

@codehag
Copy link
Collaborator

codehag commented Mar 9, 2021

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

@dandclark
Copy link

dandclark commented Mar 9, 2021

Ok, thanks @codehag ! It's great to hear that the implementation is underway.

@danielweil
Copy link

danielweil commented Jun 29, 2022

Any updates on this issue implementation?

@ekr
Copy link
Contributor

ekr commented Jun 29, 2022

This is not the place to look updates on implementation in Gecko. Perhaps @codehag can add the bugzilla link?

@codehag
Copy link
Collaborator

codehag commented Jun 30, 2022

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 experimental.import_assertions. We have an external contributor working on JSON modules, which is the first "assertion" that will be exposed. You can ask further questions on https://bugzilla.mozilla.org/show_bug.cgi?id=1670176.

@321paranoiawhy
Copy link

321paranoiawhy commented Aug 16, 2022

Hi, I can not use import assertions in FireFox version 103.0.2 (64 位).
What I get is Uncaught SyntaxError: import assertions are not currently supported in the console.
I wonder what happens exactly as the version of FireFox is up-to-date.
But this can be used successfully in my chrome whose version is 版本 104.0.5112.81(正式版本).
How can I detect current browser supports or not this feature?
Hope your help, thanks a lot.

@myakura
Copy link

myakura commented Aug 16, 2022

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

Successfully merging a pull request may close this issue.