Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Ms2ger committed Oct 20, 2023
1 parent d9fce9a commit e7ed2df
Showing 1 changed file with 75 additions and 70 deletions.
145 changes: 75 additions & 70 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -104275,8 +104275,8 @@ document.querySelector("button").addEventListener("click", bound);
<var>moduleRequest</var>.[[Attributes]] in <a href="#validate-requested-module-specifiers">create
a JavaScript module script</a> or <span>fetch a single imported module script</span>.</p></li>

<li><p>Let <var>moduleMap</var> be <var>settingsObject</var>'s <span
data-x="concept-settings-object-module-map">module map</span>.</p></li>
<li><p>Let <var>moduleMap</var> be <var>moduleMapRealm</var>'s <span
data-x="concept-realm-module-map">module map</span>.</p></li>

<li><p>If <var>moduleMap</var>[(<var>url</var>, <var>moduleType</var>)] is
"<code data-x="">fetching</code>", wait <span>in parallel</span> until that entry's value
Expand All @@ -104287,7 +104287,25 @@ document.querySelector("button").addEventListener("click", bound);
data-x="map exists">exists</span>, run <var>onComplete</var> given
<var>moduleMap</var>[(<var>url</var>, <var>moduleType</var>)], and return.</p></li>

<li><p class="XXX>If it's in the parent's module map, clone it, add it to the current module map, and return it.</p></li>
<li>
<p>If <var>moduleMapRealm</var> is a <span>synthetic realm</span>, then:</p>

<ol>
<li><p>Let <var>script</var> be the result of
<span data-x="find and possibly clone a module">finding and possibly cloning a module</span>
given <var>url</var>, <var>moduleType</var> and <var>moduleMapRealm</var>.</p></li>

<li><p><span data-x="map set">Set</span> <var>moduleMap</var>[(<var>url</var>,
<var>moduleType</var>)] to <var>script</var>.</p></li>

<li><p>Run <var>onComplete</var> given <var>script</var>.</p></li>

<li><p>Return.</p></li>
</ol>
</li>

<li><p>If <var>moduleMap</var>[(<var>url</var>, <var>moduleType</var>)] <span
data-x="map exists">exists</span>, return.</p></li>

<li><p><span data-x="map set">Set</span> <var>moduleMap</var>[(<var>url</var>,
<var>moduleType</var>)] to "<code data-x="">fetching</code>".</p></li>
Expand Down Expand Up @@ -104395,94 +104413,81 @@ document.querySelector("button").addEventListener("click", bound);
</ol>

<p>To <dfn>find and possibly clone a module</dfn> given a <var>URL</var>, <var>moduleType</var>,
and <var>moduleMapRealm</var>, perform the following steps, returning
a <span>module script</span>:</p>
and <var>moduleMapRealm</var>, perform the following steps.</p>

<ol>
<li><p>Let <var>moduleMap</var> be <var>moduleMapRealm</var>'s <span
data-x="concept-realm-module-map">module map</span>.</p></li>
<li><p>Assert: <var>moduleMapRealm</var> is a <span>synthetic realm</span>.</p></li>

<li>
<p>If <var>moduleMap</var>[(<var>url</var>, <var>moduleType</var>)] does not
<span data-x="map exists">exist</span>, then:</p>
<li><p>Let <var>parentModuleMap</var> be <var>moduleMapRealm</var>'s
<span data-x="concept-principal-realm-of-realm">principal realm</span>'s <span
data-x="concept-realm-settings-object">settings object</span>'s <span
data-x="concept-settings-object-module-map">module map</span>.</p></li>

<ol>
<li><p><span>Assert</span>: <var>moduleMapRealm</var> is a <span>synthetic
realm</span>.</p></li>
<li><p><span>Assert</span>: <var>parentModuleMap</var>[(<var>url</var>, <var>moduleType</var>)]
<span data-x="map exists">exists</span>.</p></li>

<li><p>Let <var>parentModuleMap</var> be <var>moduleMapRealm</var>'s
<span data-x="concept-principal-realm-of-realm">principal realm</span>'s <span
data-x="concept-realm-settings-object">settings object</span>'s <span
data-x="concept-settings-object-module-map">module map</span>.</p></li>
<li><p>Let <var>parentModule</var> be <var>parentModuleMap</var>[(<var>url</var>,
<var>moduleType</var>)].</p></li>

<li><p><span>Assert</span>: <var>parentModuleMap</var>[(<var>url</var>, <var>moduleType</var>)]
<span data-x="map exists">exists</span>.</p></li>
<li><p>Let <var>childModule</var> be a new <span>module script</span> that this algorithm will
subsequently initialize.</p></li>

<li><p>Let <var>parentModule</var> be <var>parentModuleMap</var>[(<var>url</var>,
<var>moduleType</var>)].</p></li>
<li><p>Set <var>childModule</var>'s <span data-x="concept-script-realm">realm</span> to
<var>moduleMapRealm</var>.</p></li>

<li><p>Let <var>childModule</var> be a new <span>module script</span> that this algorithm will
subsequently initialize.</p></li>
<li><p>Set <var>childModule</var>'s <span data-x="concept-script-base-url">base URL</span> to
<var>parentModule</var>'s <span data-x="concept-script-base-url">base URL</span>.</p></li>

<li><p>Set <var>childModule</var>'s <span data-x="concept-script-realm">realm</span> to
<var>moduleMapRealm</var>.</p></li>
<li><p>Set <var>childModule</var>'s <span data-x="concept-script-script-fetch-options">fetch
options</span> to <var>parentModule</var>'s <span
data-x="concept-script-script-fetch-options">fetch options</span>.</p></li>

<li><p>Set <var>childModule</var>'s <span data-x="concept-script-base-url">base URL</span> to
<var>parentModule</var>'s <span data-x="concept-script-base-url">base URL</span>.</p></li>
<li><p>Set <var>childModule</var>'s <span data-x="concept-script-error-to-rethrow">error to
rethrow</span> to <var>parentModule</var>'s <span data-x="concept-script-error-to-rethrow">error
to rethrow</span>.</p> <span class="XXX">Should this be cloned? Can this be an arbitrary
value?</span></li>

<li><p>Set <var>childModule</var>'s <span data-x="concept-script-script-fetch-options">fetch
options</span> to <var>parentModule</var>'s <span
data-x="concept-script-script-fetch-options">fetch options</span>.</p></li>
<li><p>Let <var>parentRecord</var> be <var>parentModule</var>'s <span
data-x="concept-script-record">record</span>.</p></li>

<li>
<p>If <var>parentRecord</var> is null, then:</p>

<ol>
<li><p>Let <var>parentParseError</var> be <var>parentModule</var>'s <span
data-x="concept-script-parse-error">parse error</span>.</p></li>
<li><p><span>Assert</span>: <var>parentParseError</var> is a <code>SyntaxError</code>
instance.</p></li>

<li>
<p>If <var>parentParseError</var> is null, then:</p>
<ol>
<li><p>Set <var>childModule</var>'s <span data-x="concept-script-parse-error">parse
error</span> to null.</p></li>
</ol>
</li>

<li>
<p>Otherwise,</p>
<ol>
<li><p><span>Assert</span>: <var>parentParseError</var> is a <code>SyntaxError</code>
instance.</p></li>
<li><p>Set <var>childModule</var>'s <span data-x="concept-script-parse-error">parse
error</span> to a new <code>SyntaxError</code> in <var>moduleMapRealm</var> with the same
message as <var>parentParseError</var>.</p></li>
</ol>
</li>

<li><p>Set <var>childModule</var>'s <span data-x="concept-script-error-to-rethrow">error to
rethrow</span> to null.</p></li>

<li><p>Let <var>parentRecord</var> be <var>parentModule</var>'s <span
data-x="concept-script-record">record</span>.</p></li>
<li><p>Set <var>childModule</var>'s <span data-x="concept-script-parse-error">parse
error</span> to a new <code>SyntaxError</code> in <var>moduleMapRealm</var> with the same
message as <var>parentParseError</var>.</p></li>

<li><p>Set <var>childModule</var>'s <span data-x="concept-script-record">record</span> to
a new <span>Source Text Module Record</span> { [[Realm]]: <var>moduleMapRealm</var>,
[[Environment]]: undefined, [[Namespace]]: undefined, [[Status]]: unlinked, [[EvaluationError]]:
undefined, [[HostDefined]]: <var>childModule</var>, [[ECMAScriptCode]]:
<var>parentRecord</var>.[[ECMAScriptCode]], [[Context]]: empty, [[ImportMeta]]: empty,
[[RequestedModules]]: <var>parentRecord</var>.[[RequestedModules]],
[[ImportEntries]]: <var>parentRecord</var>.[[ImportEntries]],
[[LocalExportEntries]]: <var>parentRecord</var>.[[LocalImportEntries]],
[[IndirectExportEntries]]: <var>parentRecord</var>.[[IndirectImportEntries]],
[[StarExportEntries]]: <var>parentRecord</var>.[[StarImportEntries]], [[DFSIndex]]: undefined,
[[DFSAncestorIndex]]: undefined
}.</p></li>
null.</p></li>

<li><p>Set <var>moduleMap</var>[(<var>url</var>, <var>moduleType</var>)] to
<var>childModule</var>.</p></li>
<li><p>Return <var>childModule</var>.</p></li>
</ol>
</li>

<li><p>Let <var>resolvedModuleScript</var> be <var>moduleMap</var>[(<var>url</var>,
<var>moduleType</var>)]. (This entry must <span data-x="map exists">exist</span> for us to have
gotten to this point.)</p></li>
<li><p>Set <var>childModule</var>'s <span data-x="concept-script-error-to-rethrow">error to
rethrow</span> to null.</p></li>

<li><p class="XXX">Can <var>parentModule</var> be a CSS or JSON module?</p></li>

<li><p>Set <var>childModule</var>'s <span data-x="concept-script-record">record</span> to
a new <span>Source Text Module Record</span> { [[Realm]]: <var>moduleMapRealm</var>,
[[Environment]]: undefined, [[Namespace]]: undefined, [[Status]]: unlinked, [[EvaluationError]]:
undefined, [[HostDefined]]: <var>childModule</var>, [[ECMAScriptCode]]:
<var>parentRecord</var>.[[ECMAScriptCode]], [[Context]]: empty, [[ImportMeta]]: empty,
[[RequestedModules]]: <var>parentRecord</var>.[[RequestedModules]],
[[ImportEntries]]: <var>parentRecord</var>.[[ImportEntries]],
[[LocalExportEntries]]: <var>parentRecord</var>.[[LocalImportEntries]],
[[IndirectExportEntries]]: <var>parentRecord</var>.[[IndirectImportEntries]],
[[StarExportEntries]]: <var>parentRecord</var>.[[StarImportEntries]], [[DFSIndex]]: undefined,
[[DFSAncestorIndex]]: undefined }. <span class="XXX">Is 'unlinked' correct?</span></p></li>

<li><p>Return <var>childModule</var>.</p></li>
</ol>


Expand Down

0 comments on commit e7ed2df

Please sign in to comment.