Intent to Ship: Import attributes 'with' syntax

468 views
Skip to first unread message

Nicolò Ribaudo

unread,
Jan 9, 2024, 1:11:47 PM1/9/24
to blink-dev

Contact emails

nrib...@igalia.com, s...@chromium.org

Explainer

None

Specification

https://github.com/tc39/proposal-import-attributes

Summary

Import attributes[^1] are a JavaScript feature to allow annotating import declarations, for example `import xxx from "mod" with { type: "json" }'. Chrome originally shipped a previous version of the proposal (in M91) using 'assert' as the keyword. This version has then been updated to use 'with' due to some changes needed while integrating it with HTML for JSON and CSS modules[^2]. [^1]: https://github.com/tc39/proposal-import-attributes/ [^2]: https://github.com/whatwg/html/issues/7233



Blink component

Blink>JavaScript>Language

TAG review

None

TAG review status

Not applicable

Risks



Interoperability and Compatibility

Other browsers either already implemented or are implementing this feature, so we can expect wide compatibility. Chrome ships an older deprecated version of the proposal, and we need to ship this new version to be compatible with other browsers.



Gecko: No signal

WebKit: Shipped/Shipping (https://developer.apple.com/documentation/safari-release-notes/safari-17_2-release-notes#JavaScript) Shipped in Safari 17.2

Web developers: No signals

Other signals:

Security

This feature addresses the security concerns raised in https://github.com/WICG/webcomponents/issues/839 Other than that, there are no security concerns related to this feature: https://github.com/tc39/proposal-import-attributes/blob/master/tag-security-and-privacy.md



WebView application risks

Does this intent deprecate or change behavior of existing APIs, such that it has potentially high risk for Android WebView-based applications?

None



Debuggability

None



Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, ChromeOS, Android, and Android WebView)?

Yes

Is this feature fully tested by web-platform-tests?

Yes

This is an ECMAScript feature, and as such it's mostly tested in Test262: - https://github.com/tc39/test262/tree/main/test/language/module-code/import-attributes - https://github.com/tc39/test262/tree/main/test/language/expressions/dynamic-import/import-attributes There are also WPT tests: - https://github.com/web-platform-tests/wpt/tree/master/html/semantics/scripting-1/the-script-element/import-attributes



Flag name on chrome://flags

--js-flags=--harmony-import-attributes

Finch feature name

kJavaScriptImportAttributes

Requires code in //chrome?

False

Estimated milestones

No milestones specified



Anticipated spec changes

Open questions about a feature may be a source of future web compat or interop issues. Please list open issues (e.g. links to known github issues in the project for the feature specification) whose resolution may introduce web compat/interop risk (e.g., changing to naming or structure of the API in a non-backward-compatible way).

None

Link to entry on the Chrome Platform Status

https://chromestatus.com/feature/5205869105250304

This intent message was generated by Chrome Platform Status.

Nicolò Ribaudo

unread,
Jan 9, 2024, 1:14:37 PM1/9/24
to blink-dev, Nicolò Ribaudo, s...@chromium.org
We would like to ship this together with https://groups.google.com/a/chromium.org/g/blink-dev/c/8BbZ_NUVZ5Q/m/HBv8RHNXAAAJ (reflecting the updates to the proposal on the HTML/Fetch side), so that the new syntax already has the final semantics.

Also, we are in parallel trying to remove the old 'assert' syntax of the proposal (https://groups.google.com/a/chromium.org/g/blink-dev/c/ZHvzLaJZRvo/m/FgNDBjrtBQAJ).

Yoav Weiss

unread,
Jan 10, 2024, 9:57:39 AM1/10/24
to Nicolò Ribaudo, blink-dev, s...@chromium.org
On Tue, Jan 9, 2024 at 7:14 PM Nicolò Ribaudo <nrib...@igalia.com> wrote:
We would like to ship this together with https://groups.google.com/a/chromium.org/g/blink-dev/c/8BbZ_NUVZ5Q/m/HBv8RHNXAAAJ (reflecting the updates to the proposal on the HTML/Fetch side), so that the new syntax already has the final semantics.

Also, we are in parallel trying to remove the old 'assert' syntax of the proposal (https://groups.google.com/a/chromium.org/g/blink-dev/c/ZHvzLaJZRvo/m/FgNDBjrtBQAJ).

On Tuesday, January 9, 2024 at 7:11:47 PM UTC+1 Nicolò Ribaudo wrote:

Contact emails

nrib...@igalia.com, s...@chromium.org

Explainer

None

Specification

https://github.com/tc39/proposal-import-attributes

Summary

Import attributes[^1] are a JavaScript feature to allow annotating import declarations, for example `import xxx from "mod" with { type: "json" }'. Chrome originally shipped a previous version of the proposal (in M91) using 'assert' as the keyword. This version has then been updated to use 'with' due to some changes needed while integrating it with HTML for JSON and CSS modules[^2]. [^1]: https://github.com/tc39/proposal-import-attributes/ [^2]: https://github.com/whatwg/html/issues/7233



Blink component

Blink>JavaScript>Language

TAG review

None

TAG review status

Not applicable

Risks



Interoperability and Compatibility

Other browsers either already implemented or are implementing this feature, so we can expect wide compatibility. Chrome ships an older deprecated version of the proposal, and we need to ship this new version to be compatible with other browsers.



Like other JS language changes, I'm guessing we expect developers to use UA sniffing to know where it's safe to ship this syntax?
 
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/3eebfc80-19d1-4fd5-a638-fb0ec394574en%40chromium.org.

Yoav Weiss

unread,
Jan 10, 2024, 11:16:08 AM1/10/24
to Nicolò Ribaudo, blink-dev, s...@chromium.org, Nicolò Ribaudo
LGTM1

On Wed, Jan 10, 2024 at 5:08 PM Nicolò Ribaudo <nicolo....@gmail.com> wrote:
> Like other JS language changes, I'm guessing we expect developers to use UA sniffing to know where it's safe to ship this syntax?

Yes -- given that this is about new syntax it's difficult to perform runtime feature detection: you would have to use a dynamic imports with data URLs, but that's async and doesn't play well with CSP.

Yeah.. We™ should do better, but that's regardless of this specific intent.

Philip Jägenstedt

unread,
Jan 10, 2024, 11:57:40 AM1/10/24
to Yoav Weiss, Nicolò Ribaudo, blink-dev, s...@chromium.org, Nicolò Ribaudo

Rick Byers

unread,
Jan 10, 2024, 11:58:23 AM1/10/24
to Philip Jägenstedt, Yoav Weiss, Nicolò Ribaudo, blink-dev, s...@chromium.org, Nicolò Ribaudo

Nicolò Ribaudo

unread,
Jan 10, 2024, 12:19:37 PM1/10/24
to blink-dev, Yoav Weiss, blink-dev, s...@chromium.org, Nicolò Ribaudo
> Like other JS language changes, I'm guessing we expect developers to use UA sniffing to know where it's safe to ship this syntax?

Yes -- given that this is about new syntax it's difficult to perform runtime feature detection: you would have to use a dynamic imports with data URLs, but that's async and doesn't play well with CSP.

On Wednesday, January 10, 2024 at 3:57:39 PM UTC+1 Yoav Weiss wrote:
Reply all
Reply to author
Forward
0 new messages