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

Consider removing the relative-URL distinction in import names #353

Merged
merged 1 commit into from
May 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions design/mvp/Explainer.md
Original file line number Diff line number Diff line change
Expand Up @@ -1471,21 +1471,17 @@ verrange ::= '@*'
verlower ::= '>=' <valid semver>
verupper ::= '<' <valid semver>
urlname ::= 'url=<' <nonbrackets> '>' (',' <hashname>)?
| 'relative-url=<' <nonbrackets> '>' (',' <hashname>)?
nonbrackets ::= [^<>]*
hashname ::= 'integrity=<' <integrity-metadata> '>'
```
Components provide seven options for naming imports:
Components provide six options for naming imports:
* a **plain name** that leaves it up to the developer to "read the docs"
or otherwise figure out what to supply for the import;
* an **interface name** that is assumed to uniquely identify a higher-level
semantic contract that the component is requesting an *unspecified* wasm
or native implementation of;
* a **URL name** that the component is requesting be resolved to a *particular*
wasm implementation by [fetching] the URL.
* a **relative URL name** that the component is requesting be resolved to a
*particular* wasm implementation by [fetching] the URL using the importing
component's URL as the [base URL];
* a **hash name** containing a content-hash of the bytes of a *particular*
wasm implemenentation but not specifying location of the bytes.
* a **locked dependency name** that the component is requesting be resolved via
Expand All @@ -1495,7 +1491,7 @@ Components provide seven options for naming imports:
via some contextually-supplied registry to *one of a set of possible* of wasm
implementations using the given hierarchical name and version range.

Not all hosts are expected to support all seven import naming options and, in
Not all hosts are expected to support all six import naming options and, in
general, build tools may need to wrap a to-be-deployed component with an outer
component that only uses import names that are understood by the target host.
For example:
Expand All @@ -1518,8 +1514,12 @@ For example:
The grammar and validation of URL names allows the embedded URLs to contain any
sequence of UTF-8 characters (other than angle brackets, which are used to
[delimit the URL]), leaving the well-formedness of the URL to be checked as
part of the process of fetching the URL (which can fail for any number of
additional reasons beyond validation).
part of the process of [parsing] the URL in preparation for [fetching] the URL.
The [base URL] operand passed to the URL spec's parsing algorithm is determined
by the host and may be absent, thereby disallowing relative URLs. Thus, the
parsing and fetching of a URL import are host-defined operations that happen
after the decoding and validation of a component, but before instantiation of
that component.

When a particular implementation is indicated via URL or dependency name,
`importname` allows the component to additionally specify a cryptographic hash
Expand Down Expand Up @@ -1604,7 +1604,7 @@ As an example, the following component uses all 9 cases of imports and exports:
(export "handle" (func (param (own $request)) (result (own $response))))
))
(import "url=<https://mycdn.com/my-component.wasm>" (component ...))
(import "relative-url=<./other-component.wasm>,integrity=<sha256-X9ArH3k...>" (component ...))
(import "url=<./other-component.wasm>,integrity=<sha256-X9ArH3k...>" (component ...))
(import "locked-dep=<my-registry:[email protected]>,integrity=<sha256-H8BRh8j...>" (component ...))
(import "unlocked-dep=<my-registry:imagemagick@{>=1.0.0}>" (instance ...))
(import "integrity=<sha256-Y3BsI4l...>" (component ...))
Expand Down Expand Up @@ -1959,8 +1959,9 @@ and will be added over the coming months to complete the MVP proposal:

[`WebAssembly.instantiate()`]: https://developer.mozilla.org/en-US/docs/WebAssembly/JavaScript_interface/instantiate
[`FinalizationRegistry`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry
[Fetching]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
[base URL]: https://developer.mozilla.org/en-US/docs/Web/API/URL/URL
[Fetching]: https://fetch.spec.whatwg.org/
[Parsing]: https://url.spec.whatwg.org/#url-parsing
[Base URL]: https://url.spec.whatwg.org/#concept-base-url
[`integrity-metadata`]: https://www.w3.org/TR/SRI/#the-integrity-attribute
[Semantic Versioning 2.0]: https://semver.org/spec/v2.0.0.html
[Delimit The URL]: https://www.rfc-editor.org/rfc/rfc3986#appendix-C
Expand Down
Loading