-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only apply /-prefix handling to special URL-like specifiers
Closes #166.
- Loading branch information
Showing
5 changed files
with
51 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,11 +12,12 @@ Editor: Domenic Denicola, Google https://www.google.com/, [email protected], https:// | |
Abstract: Import maps allow web pages to control the behavior of JavaScript imports. | ||
!Participate: <a href="https://github.com/WICG/import-maps">GitHub WICG/import-maps</a> (<a href="https://github.com/WICG/import-maps/issues/new">new issue</a>, <a href="https://github.com/WICG/import-maps/issues?state=open">open issues</a>) | ||
!Commits: <a href="https://github.com/WICG/import-maps/commits/master/spec.bs">GitHub spec.bs commits</a> | ||
Complain About: accidental-2119 yes, missing-example-ids yes | ||
Complain About: accidental-2119 yes | ||
Indent: 2 | ||
Default Biblio Status: current | ||
Markup Shorthands: markdown yes | ||
</pre> | ||
<!-- TODO: add back `Complain About: missing-example-ids yes` when https://github.com/tabatkins/bikeshed/issues/1804 gets fixed. --> | ||
<pre class="link-defaults"> | ||
spec: infra; type: dfn | ||
text: string | ||
|
@@ -397,25 +398,31 @@ To <dfn>register an import map</dfn> given an {{HTMLScriptElement}} |element|: | |
1. Let |normalizedSpecifier| be the [=URL serializer|serialization=] of |asURL|, if |asURL| is non-null; otherwise, |specifier|. | ||
1. [=map/For each=] |scopePrefix| → |scopeImports| of |importMap|'s [=import map/scopes=], | ||
1. If |scopePrefix| is |baseURLString|, or if |scopePrefix| ends with U+002F (/) and |baseURLString| [=string/starts with=] |scopePrefix|, then: | ||
1. Let |scopeImportsMatch| be the result of [=resolving an imports match=] given |normalizedSpecifier| and |scopeImports|. | ||
1. Let |scopeImportsMatch| be the result of [=resolving an imports match=] given |normalizedSpecifier|, |asURL|, and |scopeImports|. | ||
1. If |scopeImportsMatch| is not null, then return |scopeImportsMatch|. | ||
1. Let |topLevelImportsMatch| be the result of [=resolving an imports match=] given |normalizedSpecifier| and |importMap|'s [=import map/imports=]. | ||
1. Let |topLevelImportsMatch| be the result of [=resolving an imports match=] given |normalizedSpecifier|, |asURL|, and |importMap|'s [=import map/imports=]. | ||
1. If |topLevelImportsMatch| is not null, then return |topLevelImportsMatch|. | ||
1. <p class="note">At this point, the specifier was able to be turned in to a URL, but it wasn't remapped to anything by |importMap|.</p> | ||
If |asURL| is not null, then return |asURL|. | ||
1. Throw a {{TypeError}} indicating that |specifier| was a bare specifier, but was not remapped to anything by |importMap|. | ||
</div> | ||
|
||
<div algorithm> | ||
To <dfn lt="resolve an imports match|resolving an imports match">resolve an imports match</dfn>, given a [=string=] |normalizedSpecifier| and a [=specifier map=] |specifierMap|: | ||
To <dfn lt="resolve an imports match|resolving an imports match">resolve an imports match</dfn>, given a [=string=] |normalizedSpecifier|, a [=URL=] or null |asURL|, and a [=specifier map=] |specifierMap|: | ||
|
||
1. For each |specifierKey| → |resolutionResult| of |specifierMap|, | ||
1. If |specifierKey| is |normalizedSpecifier|, then: | ||
1. If |resolutionResult| is null, then throw a {{TypeError}} indicating that resolution of |specifierKey| was blocked by a null entry. | ||
<p class="note">This will terminate the entire [=resolve a module specifier=] algorithm, without any further fallbacks.</p> | ||
1. Assert: |resolutionResult| is a [=URL=]. | ||
1. Return |resolutionResult|. | ||
1. If |specifierKey| ends with U+002F (/) and |normalizedSpecifier| [=string/starts with=] |specifierKey|, then: | ||
1. If all of the following are true: | ||
|
||
* |specifierKey| ends with U+002F (/), | ||
* |normalizedSpecifier| [=string/starts with=] |specifierKey|, and | ||
* either |asURL| is null, or |asURL| [=is special=] | ||
|
||
then: | ||
1. If |resolutionResult| is null, then throw a {{TypeError}} indicating that resolution of |specifierKey| was blocked by a null entry. | ||
<p class="note">This will terminate the entire [=resolve a module specifier=] algorithm, without any further fallbacks.</p> | ||
1. Assert: |resolutionResult| is a [=URL=]. | ||
|