content icon indicating copy to clipboard operation
content copied to clipboard

Document import assertions

Open Josh-Cena opened this issue 3 years ago • 8 comments

Summary

Motivation

Fix #19220

Supporting details

Related issues

Metadata

  • [x] Adds a new document
  • [ ] Rewrites (or significantly expands) a document
  • [ ] Fixes a typo, bug, or other error

Josh-Cena avatar Aug 15 '22 13:08 Josh-Cena

Pending: some more sources to the HTML specification, especially around JSON modules. I don't know the HTML spec that well.

BCD: https://github.com/mdn/browser-compat-data/pull/17366

Josh-Cena avatar Aug 15 '22 13:08 Josh-Cena

cc @jpmedley in case this needs some attention from V8 folks since they are the only ones implementing this so far.

Josh-Cena avatar Aug 15 '22 16:08 Josh-Cena

I'm not up to speed on this. I've asked my team for help.

jpmedley avatar Aug 15 '22 17:08 jpmedley

Let's still see if someone from Google (or from Mozilla!) can get to look at this.

Josh-Cena avatar Oct 31 '22 06:10 Josh-Cena

@teoli2003 @wbamberg Can we get a review on this?

If desired I can comment on whether it makes sense to me, but not on whether it is correct/complete.

hamishwillee avatar Nov 04 '22 00:11 hamishwillee

@hamishwillee I'd very appreciate it if you can comment on whether it makes sense, from the perspective of a reader 😄

Josh-Cena avatar Nov 06 '22 04:11 Josh-Cena

This is hard to get right... I spent a few months wrapping my head around this feature until it clicked.

Josh-Cena avatar Nov 08 '22 06:11 Josh-Cena

Import assertions got downgraded to stage 2 due to https://github.com/tc39/proposal-import-assertions/issues/125. I guess that gives us some more time before documentation because it won't be implemented by other engines anyway.

Josh-Cena avatar Feb 04 '23 18:02 Josh-Cena

Import assertions got downgraded to stage 2 due to https://github.com/tc39/proposal-import-assertions/issues/125. I guess that gives us some more time before documentation because it won't be implemented by other engines anyway.

Do we need to do any intermediate "fix up"? My initial thinking was no, since the BCD says "non standard" so people should be using with care anyway. But on reflection, it is perhaps worth adding a note to chrome 91 BCD (i.e. to both the import assertion lines shown here to note that this was downgraded and likely to change.

Why? Because presumably at some point this will standardize, and that that point we'll need to do something to indicate that this older version is not the same version as the standard. Having a note now might help make this clear later.

Up to you.

hamishwillee avatar Feb 05 '23 22:02 hamishwillee

If it's shipped in one browser and noted as an experimental feature, I don't think we need any immediate fixup since things are expected to change anyway. It's lucky we don't have content yet. We can watch until a good alternative has been proposed.

Josh-Cena avatar Feb 05 '23 22:02 Josh-Cena

This feature is now called "import-attributes" and the assertion invariant has been removed. The new keyword is with instead of assert. This PR would be on hold until new implementations land.

Josh-Cena avatar Mar 29 '23 19:03 Josh-Cena

Instead of letting this PR sit around forever, I'm going to close this and open a new PR when the new syntax and semantics get shipped in browsers. There will be significant changes from the currently documented behavior.

Josh-Cena avatar Jun 17 '23 11:06 Josh-Cena