Contact [email protected]

Explainerhttps://gist.github.com/domenic/f2a0a9cb62d499bcc4d12aebd1c255ab

Specificationhttps://html.spec.whatwg.org/#hostgetimportmetaproperties

Summary

import.meta.resolve(specifier) returns the URL to which the given specifier
would resolve in the context of the current script. That is, it returns the
URL that would be imported if you did import(specifier).


Blink componentBlink>JavaScript
<https://bugs.chromium.org/p/chromium/issues/list?q=component:Blink%3EJavaScript>

Search tagsimport <https://chromestatus.com/features#tags:import>, modules
<https://chromestatus.com/features#tags:modules>, esm
<https://chromestatus.com/features#tags:esm>

TAG reviewhttps://github.com/w3ctag/design-reviews/issues/746

TAG review statusPending

Risks


Interoperability and Compatibility

This feature has low interoperability and compatibility risk. Both Gecko
and Safari are supportive, and it should be easy for all engines to
implement. It is also quite simple and unlikely to change in the future. If
it needs future extension, we can add an options bag as the second argument.


*Gecko*: Worth prototyping (
https://github.com/mozilla/standards-positions/issues/647#event-6817757001)

*WebKit*: Positive (
https://github.com/WebKit/standards-positions/issues/2#event-6907169928)

*Web developers*: Mixed signals (
https://github.com/whatwg/html/issues/3871,https://github.com/whatwg/html/pull/5572)
In general web developers are positive on this addition. It is fulfilling a
long-standing feature request and closing a gap with non-browser module
systems. The Node.js core team has given negative signals as the
synchronous import.meta.resolve() in the HTML Standard conflicts with their
asynchronous import.meta.resolve(). See
https://gist.github.com/domenic/f2a0a9cb62d499bcc4d12aebd1c255ab#sync-vs-async
for
a summary of that debate and links discussing Node's plans to align with
the HTML Standard going forward.

*Other signals*:

Ergonomics

This API will often be used in tandem with APIs to fetch the associated
URL. It is also especially useful on pages that use import maps. This API
will not make it hard for Chrome to maintain good performance. It exposes
an existing simple algorithm, which if web developers were to emulate would
involve lots of extra work on their part to parse the relevant import maps.


Activation

Polyfills for this feature would mostly take the form of module bundlers
rewriting import.meta.resolve() calls, or possibly injecting
`import.meta.resolve = ...` at the top of each module.


Security

None. This exposes only information and code paths that were already
available via more indirect means.


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

No special support needed.


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

Is this feature fully tested by web-platform-tests
<https://chromium.googlesource.com/chromium/src/+/main/docs/testing/web_platform_tests.md>
?Yes

Flag name

Requires code in //chrome?False

Tracking bughttps://bugs.chromium.org/p/chromium/issues/detail?id=1296665

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


Link to entry on the Chrome Platform Status
https://chromestatus.com/feature/5086507990777856

This intent message was generated by Chrome Platform Status
<https://chromestatus.com/>.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAM0wra8uZzrJMmZ8QB_khmT0Hh0LG%3Dux--tWjKaqp4cuxDom3w%40mail.gmail.com.

Reply via email to