Skip to content

Commit fa07fc6

Browse files
committed
Add import.meta.resolve()
Closes #3871.
1 parent f57890b commit fa07fc6

File tree

1 file changed

+46
-2
lines changed

1 file changed

+46
-2
lines changed

source

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2778,6 +2778,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
27782778
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-call">Call</dfn> abstract operation</li>
27792779
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-construct">Construct</dfn> abstract operation</li>
27802780
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-copydatablockbytes">CopyDataBlockBytes</dfn> abstract operation</li>
2781+
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-createbuiltinfunction">CreateBuiltinFunction</dfn> abstract operation</li>
27812782
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-createbytedatablock">CreateByteDataBlock</dfn> abstract operation</li>
27822783
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-createdataproperty">CreateDataProperty</dfn> abstract operation</li>
27832784
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-detacharraybuffer">DetachArrayBuffer</dfn> abstract operation</li>
@@ -2824,6 +2825,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
28242825
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-samevalue">SameValue</dfn> abstract operation</li>
28252826
<li>The <dfn data-x="js-ScriptEvaluation" data-x-href="https://tc39.es/ecma262/#sec-runtime-semantics-scriptevaluation">ScriptEvaluation</dfn> abstract operation</li>
28262827
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-set-immutable-prototype">SetImmutablePrototype</dfn> abstract operation</li>
2828+
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-setfunctionname">SetFunctionName</dfn> abstract operation</li>
2829+
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-setfunctionlength">SetFunctionLength</dfn> abstract operation</li>
28272830
<li>The <dfn data-x="js-ToBoolean" data-x-href="https://tc39.es/ecma262/#sec-toboolean">ToBoolean</dfn> abstract operation</li>
28282831
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-tostring">ToString</dfn> abstract operation</li>
28292832
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-touint32">ToUint32</dfn> abstract operation</li>
@@ -88056,14 +88059,27 @@ document.querySelector("button").addEventListener("click", bound);
8805688059
world, from the classic-script world.</p>
8805788060
</dd>
8805888061

88059-
<dt><var>url</var> = <code data-x="import.meta">import . meta </code><code data-x=""> . url</code></dt>
88062+
<dt><var>url</var> = <code data-x="import.meta">import . meta</code><code data-x=""> . </code><code data-x="import-meta-url">url</code></dt>
8806088063

8806188064
<dd>
8806288065
<p>Returns the <span data-x="active script">active module script</span>'s <span
8806388066
data-x="concept-script-base-url">base URL</span>.</p>
8806488067

8806588068
<p>This syntax can only be used inside <span data-x="module script">module scripts</span>.</p>
8806688069
</dd>
88070+
88071+
<dt><var>url</var> = <code data-x="import.meta">import . meta</code><code data-x=""> . </code><code data-x="import-meta-resolve">resolve(<var>specifier</var>)</code></dt>
88072+
88073+
<dd>
88074+
<p>Returns <var>specifier</var>, <span data-x="resolve a module specifier">resolved</span>
88075+
relative to the <span>active script</span>'s <span data-x="concept-script-base-url">base
88076+
URL</span>. That is, this returns the URL that would be imported by using <code
88077+
data-x="import()">import(<var>specifier</var>)</code>.</p>
88078+
88079+
<p>This will throw an exception if an invalid specifier is given.</p>
88080+
88081+
<p>This syntax can only be used inside <span data-x="module script">module scripts</span>.</p>
88082+
</dd>
8806788083
</dl>
8806888084

8806988085
<p><span w-nodev>A <dfn>module map</dfn> is a <span data-x="ordered map">map</span> of <span
@@ -88336,7 +88352,35 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
8833688352
data-x="concept-script-base-url">base URL</span>, <span
8833788353
data-x="concept-url-serializer">serialized</span>.</p></li>
8833888354

88339-
<li><p>Return « Record { [[Key]]: "url", [[Value]]: <var>urlString</var> } ».</p></li>
88355+
<li>
88356+
<p>Let <var>steps</var> be the following steps, given the argument <var>specifier</var>:</p>
88357+
88358+
<ol>
88359+
<li><p>Set <var>specifier</var> to ? <span>ToString</span>(<var>specifier</var>).</p></li>
88360+
88361+
<li><p>Let <var>url</var> be the result of <span data-x="resolve a module specifier">resolving
88362+
a module specifier</span> given <var>module script</var>'s <span
88363+
data-x="concept-script-base-url">base URL</span> and <var>specifier</var>.</p></li>
88364+
88365+
<li><p>If <var>url</var> is failure, then throw a <code>TypeError</code> exception.</p></li>
88366+
88367+
<li><p>Return the <span data-x="concept-url-serializer">serialization</span> of
88368+
<var>url</var>.</p></li>
88369+
</ol>
88370+
</li>
88371+
88372+
<li><p>Let <var>resolveFunction</var> be ! <span>CreateBuiltinFunction</span>(<var>steps</var>,
88373+
« », the <span>current Realm Record</span>).</p></li>
88374+
88375+
<li><p>Perform ! <span>SetFunctionName</span>(<var>resolveFunction</var>, "<code
88376+
data-x="">resolve</code>").</p></li>
88377+
88378+
<li><p>Perform ! <span>SetFunctionLength</span>(<var>resolveFunction</var>, 1).</p></li>
88379+
88380+
<li><p>Return « Record { [[Key]]: "<dfn><code data-x="import-meta-url">url</code></dfn>",
88381+
[[Value]]: <var>urlString</var> }, Record { [[Key]]: "<dfn><code
88382+
data-x="import-meta-resolve">resolve</code></dfn>", [[Value]]: <var>resolveFunction</var> }
88383+
».</p></li>
8834088384
</ol>
8834188385

8834288386
</div>

0 commit comments

Comments
 (0)