Skip to content

Commit f91ff0e

Browse files
committed
Add import.meta.resolve()
Closes #3871.
1 parent 6bf3679 commit f91ff0e

File tree

1 file changed

+45
-6
lines changed

1 file changed

+45
-6
lines changed

source

+45-6
Original file line numberDiff line numberDiff line change
@@ -2799,6 +2799,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
27992799
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-cleanup-finalization-registry">CleanupFinalizationRegistry</dfn> abstract operation</li>
28002800
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-construct">Construct</dfn> abstract operation</li>
28012801
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-copydatablockbytes">CopyDataBlockBytes</dfn> abstract operation</li>
2802+
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-createbuiltinfunction">CreateBuiltinFunction</dfn> abstract operation</li>
28022803
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-createbytedatablock">CreateByteDataBlock</dfn> abstract operation</li>
28032804
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-createdataproperty">CreateDataProperty</dfn> abstract operation</li>
28042805
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-detacharraybuffer">DetachArrayBuffer</dfn> abstract operation</li>
@@ -2848,6 +2849,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
28482849
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-samevalue">SameValue</dfn> abstract operation</li>
28492850
<li>The <dfn data-x="js-ScriptEvaluation" data-x-href="https://tc39.es/ecma262/#sec-runtime-semantics-scriptevaluation">ScriptEvaluation</dfn> abstract operation</li>
28502851
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-set-immutable-prototype">SetImmutablePrototype</dfn> abstract operation</li>
2852+
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-setfunctionname">SetFunctionName</dfn> abstract operation</li>
2853+
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-setfunctionlength">SetFunctionLength</dfn> abstract operation</li>
28512854
<li>The <dfn data-x="js-ToBoolean" data-x-href="https://tc39.es/ecma262/#sec-toboolean">ToBoolean</dfn> abstract operation</li>
28522855
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-tostring">ToString</dfn> abstract operation</li>
28532856
<li>The <dfn data-x-href="https://tc39.es/ecma262/#sec-touint32">ToUint32</dfn> abstract operation</li>
@@ -93995,14 +93998,27 @@ dictionary <dfn dictionary>PromiseRejectionEventInit</dfn> : <span>EventInit</sp
9399593998
world, from the classic-script world.</p>
9399693999
</dd>
9399794000

93998-
<dt><code data-x=""><var>url</var> = <span data-x="import.meta">import.meta </span><span data-x="">.url</span></code></dt>
94001+
<dt><code data-x=""><var>url</var> = <span data-x="import.meta">import.meta</span>.<span data-x="import-meta-url">url</span></code></dt>
9399994002

9400094003
<dd>
9400194004
<p>Returns the <span data-x="active script">active module script</span>'s <span
9400294005
data-x="concept-script-base-url">base URL</span>.</p>
9400394006

9400494007
<p>This syntax can only be used inside <span data-x="module script">module scripts</span>.</p>
9400594008
</dd>
94009+
94010+
<dt><code data-x=""><var>url</var> = <span data-x="import.meta">import.meta</span>.<span data-x="import-meta-resolve">resolve</span>(<var>specifier</var>)</code></dt>
94011+
94012+
<dd>
94013+
<p>Returns <var>specifier</var>, <span data-x="resolve a module specifier">resolved</span>
94014+
relative to the <span>active script</span>'s <span data-x="concept-script-base-url">base
94015+
URL</span>. That is, this returns the URL that would be imported by using <code
94016+
data-x="import()">import(<var>specifier</var>)</code>.</p>
94017+
94018+
<p>Throws a <code>TypeError</code> exception if an invalid specifier is given.</p>
94019+
94020+
<p>This syntax can only be used inside <span data-x="module script">module scripts</span>.</p>
94021+
</dd>
9400694022
</dl>
9400794023

9400894024
<p><span w-nodev>A <dfn>module map</dfn> is a <span data-x="ordered map">map</span> keyed by <span
@@ -94186,17 +94202,40 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
9418694202
User agents must use the following implementation: <ref spec=JAVASCRIPT></p>
9418794203

9418894204
<ol>
94189-
<li><p>Let <var>module script</var> be <var>moduleRecord</var>.[[HostDefined]].</p></li>
94205+
<li><p>Let <var>moduleScript</var> be <var>moduleRecord</var>.[[HostDefined]].</p></li>
9419094206

94191-
<li><p>Assert: <var>module script</var>'s <span data-x="concept-script-base-url">base
94192-
URL</span> is not null, as <var>module script</var> is a <span>JavaScript module
94207+
<li><p>Assert: <var>moduleScript</var>'s <span data-x="concept-script-base-url">base
94208+
URL</span> is not null, as <var>moduleScript</var> is a <span>JavaScript module
9419394209
script</span>.</p></li>
9419494210

94195-
<li><p>Let <var>urlString</var> be <var>module script</var>'s <span
94211+
<li><p>Let <var>urlString</var> be <var>moduleScript</var>'s <span
9419694212
data-x="concept-script-base-url">base URL</span>, <span
9419794213
data-x="concept-url-serializer">serialized</span>.</p></li>
9419894214

94199-
<li><p>Return « Record { [[Key]]: "url", [[Value]]: <var>urlString</var> } ».</p></li>
94215+
<li>
94216+
<p>Let <var>steps</var> be the following steps, given the argument <var>specifier</var>:</p>
94217+
94218+
<ol>
94219+
<li><p>Set <var>specifier</var> to ? <span>ToString</span>(<var>specifier</var>).</p></li>
94220+
94221+
<li><p>Let <var>url</var> be the result of <span data-x="resolve a module specifier">resolving
94222+
a module specifier</span> given <var>moduleScript</var>'s <span
94223+
data-x="concept-script-base-url">base URL</span> and <var>specifier</var>.</p></li>
94224+
94225+
<li><p>If <var>url</var> is failure, then throw a <code>TypeError</code> exception.</p></li>
94226+
94227+
<li><p>Return the <span data-x="concept-url-serializer">serialization</span> of
94228+
<var>url</var>.</p></li>
94229+
</ol>
94230+
</li>
94231+
94232+
<li><p>Let <var>resolveFunction</var> be ! <span>CreateBuiltinFunction</span>(<var>steps</var>, 1,
94233+
"<code data-x="">resolve</code>", « »).</p></li>
94234+
94235+
<li><p>Return « Record { [[Key]]: "<dfn><code data-x="import-meta-url">url</code></dfn>",
94236+
[[Value]]: <var>urlString</var> }, Record { [[Key]]: "<dfn><code
94237+
data-x="import-meta-resolve">resolve</code></dfn>", [[Value]]: <var>resolveFunction</var> }
94238+
».</p></li>
9420094239
</ol>
9420194240

9420294241
<h6><dfn>HostImportModuleDynamically</dfn>(<var>referencingScriptOrModule</var>,

0 commit comments

Comments
 (0)