You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[import-attributes] Implement import attributes, with assert fallback
In the past six months, the old import assertions proposal has been
renamed to "import attributes" with the follwing major changes:
1. the keyword is now `with` instead of `assert`
2. unknown assertions cause an error rather than being ignored
To preserve backward compatibility with existing applications that use
`assert`, implementations _can_ keep it around as a fallback for both
the static and dynamic forms.
Additionally, the proposal has some minor changes that came up during
the stage 3 reviews:
3. dynamic import first reads all the attributes, and then verifies
that they are all strings
4. there is no need for a `[no LineTerminator here]` restriction before
the `with` keyword
5. static import syntax allows any `LiteralPropertyName` as attribute
keys, to align with every other syntax using key-value pairs
The new syntax is enabled by a new `--harmony-import-attributes` flag,
disabled by default. However, the new behavioral changes also apply to
the old syntax that is under the `--harmony-import-assertions` flag.
This patch does implements (1), (3), (4) and (5). Handling of unknown
import assertions was not implemented directly in V8, but delegated
to embedders. As such, it will be implemented separately in d8 and
Chromium.
To simplify the review, this patch doesn't migrate usage of the term
"assertions" to "attributes". There are many variables and internal
functions that could be easily renamed as soon as this patch landes.
There is one usage in the public API
(`ModuleRequest::GetImportAssertions`) that will probably need to be
aliased and then removed following the same process as for other API
breaking changes.
Bug: v8:13856
Change-Id: I78b167348d898887332c5ca7468bc5d58cd9b1ca
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4632799
Commit-Queue: Shu-yu Guo <syg@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#89110}
0 commit comments