Skip to content

Commit

Permalink
Mirror the resolution algorithms
Browse files Browse the repository at this point in the history
  • Loading branch information
yoavweiss committed Sep 30, 2024
1 parent 3fe0c21 commit f9fd1f2
Showing 1 changed file with 45 additions and 20 deletions.
65 changes: 45 additions & 20 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -105710,6 +105710,10 @@ new PaymentRequest(…); // Allowed to use

<dt>A <dfn data-x="specifier-resolution-record-specifier">specifier</dfn></dt>
<dd>A <span>string</span> representing the specifier.</dd>

<dt>An <dfn data-x="specifier-resolution-record-as-url">asURL</dfn></dt>
<dd>A <span>URL</span>-or-null that represents the URL in case of a URL-like module
specifier.</dd>
</dl>

<p>A <span>global object</span> has a <dfn>resolved module set</dfn>, a <span>set</span>
Expand Down Expand Up @@ -108455,7 +108459,7 @@ dictionary <dfn dictionary>PromiseRejectionEventInit</dfn> : <span>EventInit</sp
non-null; otherwise, <var>specifier</var>.</p></li>

<li><p><span>Add module to resolved module set</span> given <var>settingsObject</var>,
<var>baseURLString</var>, and <var>normalizedSpecifier</var>.</p></li>
<var>baseURLString</var>, <var>normalizedSpecifier</var>, and <var>asURL</var>.</p></li>

<li>
<p><span data-x="list iterate">For each</span> <var>scopePrefix</var> → <var>scopeImports</var>
Expand Down Expand Up @@ -108920,8 +108924,8 @@ dictionary <dfn dictionary>PromiseRejectionEventInit</dfn> : <span>EventInit</sp
<hr>

<p>To <dfn>add module to resolved module set</dfn> given an <span>environment settings
object</span> <var>settingsObject</var>, a <span>string</span> <var>baseURLString</var>, and
a <span>string</span> <var>specifier</var>:</p>
object</span> <var>settingsObject</var>, a <span>string</span> <var>baseURLString</var>, a
<span>string</span> <var>specifier</var>, and a <span>URL</span>-or-null <var>asURL</var>:</p>

<ol>
<li><p>Let <var>global</var> be <var>settingsObject</var>'s <span
Expand All @@ -108931,9 +108935,9 @@ dictionary <dfn dictionary>PromiseRejectionEventInit</dfn> : <span>EventInit</sp

<li><p>Let <var>record</var> be a new <span>specifier resolution record</span>, with <span
data-x="specifier-resolution-record-base-url">base URL</span> set to
<var>baseURLString</var>, and <span
data-x="specifier-resolution-record-specifier">specifier</span> set to
<var>specifier</var>.</p></li>
<var>baseURLString</var>, <span data-x="specifier-resolution-record-specifier">specifier</span>
set to <var>specifier</var>, and <span data-x="specifier-resolution-record-as-url">asURL</span>
set to <var>asURL</var>.</p></li>

<li><p><span data-x="set append">Append</span> <var>record</var> to <var>global</var>'s
<span>resolved module set</span>.</p></li>
Expand Down Expand Up @@ -109102,33 +109106,54 @@ dictionary <dfn dictionary>PromiseRejectionEventInit</dfn> : <span>EventInit</sp
<span>resolved module set</span>:</p>

<ol>
<li><p>If <var>record</var>'s <span
data-x="specifier-resolution-record-base-url">base URL</span> does not <span
data-x="starts with">start with</span> <var>scopePrefix</var>,
<span>continue</span>.</p></li>

<li>
<p><span data-x="list iterate">For each</span> <var>specifier</var> → <var>url</var> of
<var>scopeImports</var>:</p>
<p>If <var>scopePrefix</var> is <var>record</var>'s <span
data-x="specifier-resolution-record-base-url">base URL</span>, or if <var>scopePrefix</var>
ends with U+002F (/) and <var>scopePrefix</var> is a <span>code unit prefix</span> of
<var>record</var>'s <span data-x="specifier-resolution-record-base-url">base URL</span>,
then:</p>

<ol>
<li>
<p>If <var>record</var>'s <span
data-x="specifier-resolution-record-specifier">specifier</span> <span>starts with</span>
<var>specifier</var>, then:</p>
<p><span data-x="list iterate">For each</span> <var>specifierKey</var>
<var>resolutionResult</var> of <var>scopeImports</var>:</p>

<ol>
<li><p>The user agent may report the removed rule as a warning to the developer
console.</p></li>
<li>
<p>If <var>specifierKey</var> is <var>record</var>'s <span
data-x="specifier-resolution-record-specifier">specifier</span>, or if the following
conditions are all true:</p>

<ol>
<li><p><var>specifierKey</var> ends with U+002F (/).</p></li>

<li><p>Remove <var>scopeImports</var>[<var>specifier</var>].</p></li>
<li><p><var>specifierKey</var> is a <span>code unit prefix</span> of
<var>record</var>'s <span
data-x="specifier-resolution-record-specifier">specifier</span>.</p></li>

<li><p>Either <var>record</var>'s <span
data-x="specifier-resolution-record-as-url">asURL</span> is null or <span>is
special</span></p></li>
</ol>

<p>then:</p>

<ol>
<li><p>The user agent may report the removed rule as a warning to the developer
console.</p></li>

<li><p>Remove <var>scopeImports</var>[<var>specifier</var>].</p></li>
</ol>
</li>
</ol>
</li>
</ol>
</li>
</ol>

<p class="note">Implementers are encouraged to implement a more efficient matching
algorithm when working with the <span>resolved module set</span>.</p>
algorithm when working with the <span>resolved module set</span>. As guidance, the number of
resolved/mapped modules in a large application can be in the order of thousands.</p>
</li>

<li><p>If <var>scopePrefix</var> <span data-x="map exists">exists</span> in
Expand Down

0 comments on commit f9fd1f2

Please sign in to comment.