Stage 2 Draft / November 21, 2024

ECMAScript Module Phase Imports

1 ECMAScript Data Types and Values

1.1 ECMAScript Language Types

1.1.1 Object Type

1.1.1.1 Well-Known Intrinsic Objects

Well-known intrinsics are built-in objects that are explicitly referenced by the algorithms of this specification and which usually have realm-specific identities. Unless otherwise specified each intrinsic object actually corresponds to a set of similar objects, one per realm.

Within this specification a reference such as %name% means the intrinsic object, associated with the current realm, corresponding to the name. A reference such as %name.a.b% means, as if the "b" property of the value of the "a" property of the intrinsic object %name% was accessed prior to any ECMAScript code being evaluated. Determination of the current realm and its intrinsics is described in 9.4. The well-known intrinsics are listed in Table 1.

Table 1: Well-Known Intrinsic Objects
Intrinsic Name Global Name ECMAScript Language Association
%AbstractModuleSource% AbstractModuleSource The AbstractModuleSource constructor ()
%AggregateError% AggregateError The AggregateError constructor (20.5.7.1)
%Array% Array The Array constructor (23.1.1)
%ArrayBuffer% ArrayBuffer The ArrayBuffer constructor (25.1.3)
%ArrayIteratorPrototype% The prototype of Array iterator objects (23.1.5)
%AsyncFromSyncIteratorPrototype% The prototype of async-from-sync iterator objects (27.1.4)
%AsyncFunction% The constructor of async function objects (27.7.1)
%AsyncGeneratorFunction% The constructor of async generator function objects (27.4.1)
%AsyncGeneratorPrototype% The prototype of async generator objects (27.6)
%AsyncIteratorPrototype% An object that all standard built-in async iterator objects indirectly inherit from
%Atomics% Atomics The Atomics object (25.4)
%BigInt% BigInt The BigInt constructor (21.2.1)
%BigInt64Array% BigInt64Array The BigInt64Array constructor (23.2)
%BigUint64Array% BigUint64Array The BigUint64Array constructor (23.2)
%Boolean% Boolean The Boolean constructor (20.3.1)
%DataView% DataView The DataView constructor (25.3.2)
%Date% Date The Date constructor (21.4.2)
%decodeURI% decodeURI The decodeURI function (19.2.6.1)
%decodeURIComponent% decodeURIComponent The decodeURIComponent function (19.2.6.2)
%encodeURI% encodeURI The encodeURI function (19.2.6.3)
%encodeURIComponent% encodeURIComponent The encodeURIComponent function (19.2.6.4)
%Error% Error The Error constructor (20.5.1)
%eval% eval The eval function (19.2.1)
%EvalError% EvalError The EvalError constructor (20.5.5.1)
%FinalizationRegistry% FinalizationRegistry The FinalizationRegistry constructor (26.2.1)
%Float32Array% Float32Array The Float32Array constructor (23.2)
%Float64Array% Float64Array The Float64Array constructor (23.2)
%ForInIteratorPrototype% The prototype of For-In iterator objects (14.7.5.10)
%Function% Function The Function constructor (20.2.1)
%GeneratorFunction% The constructor of generator function objects (27.3.1)
%GeneratorPrototype% The prototype of generator objects (27.5)
%Int8Array% Int8Array The Int8Array constructor (23.2)
%Int16Array% Int16Array The Int16Array constructor (23.2)
%Int32Array% Int32Array The Int32Array constructor (23.2)
%isFinite% isFinite The isFinite function (19.2.2)
%isNaN% isNaN The isNaN function (19.2.3)
%IteratorPrototype% An object that all standard built-in iterator objects indirectly inherit from
%JSON% JSON The JSON object (25.5)
%Map% Map The Map constructor (24.1.1)
%MapIteratorPrototype% The prototype of Map iterator objects (24.1.5)
%Math% Math The Math object (21.3)
%ModuleSource% ModuleSource A ModuleSource object (28.1.2)
%Number% Number The Number constructor (21.1.1)
%Object% Object The Object constructor (20.1.1)
%parseFloat% parseFloat The parseFloat function (19.2.4)
%parseInt% parseInt The parseInt function (19.2.5)
%Promise% Promise The Promise constructor (27.2.3)
%Proxy% Proxy The Proxy constructor (28.2.1)
%RangeError% RangeError The RangeError constructor (20.5.5.2)
%ReferenceError% ReferenceError The ReferenceError constructor (20.5.5.3)
%Reflect% Reflect The Reflect object (28.1)
%RegExp% RegExp The RegExp constructor (22.2.4)
%RegExpStringIteratorPrototype% The prototype of RegExp String Iterator objects (22.2.9)
%Set% Set The Set constructor (24.2.1)
%SetIteratorPrototype% The prototype of Set iterator objects (24.2.5)
%SharedArrayBuffer% SharedArrayBuffer The SharedArrayBuffer constructor (25.2.2)
%String% String The String constructor (22.1.1)
%StringIteratorPrototype% The prototype of String iterator objects (22.1.5)
%Symbol% Symbol The Symbol constructor (20.4.1)
%SyntaxError% SyntaxError The SyntaxError constructor (20.5.5.4)
%ThrowTypeError% A function object that unconditionally throws a new instance of %TypeError%
%TypedArray% The super class of all typed Array constructors (23.2.1)
%TypeError% TypeError The TypeError constructor (20.5.5.5)
%Uint8Array% Uint8Array The Uint8Array constructor (23.2)
%Uint8ClampedArray% Uint8ClampedArray The Uint8ClampedArray constructor (23.2)
%Uint16Array% Uint16Array The Uint16Array constructor (23.2)
%Uint32Array% Uint32Array The Uint32Array constructor (23.2)
%URIError% URIError The URIError constructor (20.5.5.6)
%WeakMap% WeakMap The WeakMap constructor (24.3.1)
%WeakRef% WeakRef The WeakRef constructor (26.1.1)
%WeakSet% WeakSet The WeakSet constructor (24.4.1)
Note

Additional entries in Table 95.

13 ECMAScript Language: Expressions

13.3 Left-Hand-Side Expressions

Syntax

13.3.10 Import Calls

13.3.10.1 EvaluateImportCall ( specifierExpression, phase [ , optionsExpression ] )

The abstract operation EvaluateImportCall takes arguments specifierExpression (a Parse Node) and phase (source or evaluation) and optional argument optionsExpression (a Parse Node) and returns either a normal completion containing a Promise or a throw completion. It performs the following steps when called:

  1. Let referrer be GetActiveScriptOrModule().
  2. If referrer is null, set referrer to the current Realm Record.
  3. Let specifierRef be ? Evaluation of specifierExpression.
  4. Let specifier be ? GetValue(specifierRef).
  5. If optionsExpression is present, then
    1. Let optionsRef be ? Evaluation of optionsExpression.
    2. Let options be ? GetValue(optionsRef).
  6. Else,
    1. Let options be undefined.
  7. Let promiseCapability be ! NewPromiseCapability(%Promise%).
  8. Let moduleRequest be undefined.
  9. If specifier is an Object, then
    1. Let moduleSource be GetModuleSourceModuleRecord(specifier).
    2. If moduleSource is not not-a-source, then
      1. If moduleSource.[[Realm]] is not equal to the current Realm Record, then
        1. Perform ! Call(promiseCapability.[[Reject]], undefined, « a newly created TypeError object »).
        2. Return promiseCapability.[[Promise]].
      2. Let attributesObj be Completion(Get(options, "with")).
      3. IfAbruptRejectPromise(attributesObj, promiseCapability).
      4. If attributesObj is not undefined, then
        1. Perform ! Call(promiseCapability.[[Reject]], undefined, « a newly created TypeError object »).
        2. Return promiseCapability.[[Promise]].
      5. Set moduleRequest to moduleSource.
  10. If moduleRequest is undefined, then
    1. Let specifierString be Completion(ToString(specifier)).
    2. IfAbruptRejectPromise(specifierString, promiseCapability).
    3. Let attributes be a new empty List.
    4. If options is not undefined, then
      1. If options is not an Object, then
        1. Perform ! Call(promiseCapability.[[Reject]], undefined, « a newly created TypeError object »).
        2. Return promiseCapability.[[Promise]].
      2. Let attributesObj be Completion(Get(options, "with")).
      3. IfAbruptRejectPromise(attributesObj, promiseCapability).
      4. If attributesObj is not undefined, then
        1. If attributesObj is not an Object, then
          1. Perform ! Call(promiseCapability.[[Reject]], undefined, « a newly created TypeError object »).
          2. Return promiseCapability.[[Promise]].
        2. Let entries be Completion(EnumerableOwnProperties(attributesObj, key+value)).
        3. IfAbruptRejectPromise(entries, promiseCapability).
        4. For each element entry of entries, do
          1. Let key be ! Get(entry, "0").
          2. Let value be ! Get(entry, "1").
          3. If key is a String, then
            1. If value is not a String, then
              1. Perform ! Call(promiseCapability.[[Reject]], undefined, « a newly created TypeError object »).
              2. Return promiseCapability.[[Promise]].
            2. Append the ImportAttribute Record { [[Key]]: key, [[Value]]: value } to attributes.
      5. If AllImportAttributesSupported(attributes) is false, then
        1. Perform ! Call(promiseCapability.[[Reject]], undefined, « a newly created TypeError object »).
        2. Return promiseCapability.[[Promise]].
      6. Sort attributes according to the lexicographic order of their [[Key]] fields, treating the value of each such field as a sequence of UTF-16 code unit values. NOTE: This sorting is observable only in that hosts are prohibited from changing behaviour based on the order in which attributes are enumerated.
    5. Let moduleRequest beSet moduleRequest to a new ModuleRequest Record { [[Specifier]]: specifierString, [[Phase]]: phase, [[Attributes]]: attributes }.
  11. Perform HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability).
  12. Return promiseCapability.[[Promise]].

16 ECMAScript Language: Scripts and Modules

16.1 Modules

16.1.1 Module Semantics

16.1.1.1 Abstract Module Records

Table 2: Abstract Methods of Module Records
Method Purpose
LoadRequestedModules( [ hostDefined ] )

Prepares the module for linking by recursively loading all its dependencies, and returns a promise.

GetExportedNames([exportStarSet])

Return a list of all names that are either directly or indirectly exported from this module.

LoadRequestedModules must have completed successfully prior to invoking this method.

ResolveExport(exportName [, resolveSet])

Return the binding of a name exported by this module. Bindings are represented by a ResolvedBinding Record, of the form { [[Module]]: Module Record, [[BindingName]]: String | namespace }. If the export is a Module Namespace Object without a direct binding in any module, [[BindingName]] will be set to namespace. Return null if the name cannot be resolved, or ambiguous if multiple bindings were found.

Each time this operation is called with a specific exportName, resolveSet pair as arguments it must return the same result.

LoadRequestedModules must have completed successfully prior to invoking this method.

Link()

Prepare the module for evaluation by transitively resolving all module dependencies and creating a Module Environment Record.

LoadRequestedModules must have completed successfully prior to invoking this method.

Evaluate()

Returns a promise for the evaluation of this module and its dependencies, resolving on successful evaluation or if it has already been evaluated successfully, and rejecting for an evaluation error or if it has already been evaluated unsuccessfully. If the promise is rejected, hosts are expected to handle the promise rejection and rethrow the evaluation error.

Link must have completed successfully prior to invoking this method.

GetModuleSource()

It returns either a normal completion containing the Module Source Object corresponding to this source Module Record's source phase (28.1), or a throw completion.

When called multiple times on the same Module Record, if GetModuleSource() returns a normal completion it must always return a normal completion containing the same object.

The returned object should have a [[Prototype]] internal slot whose value is %AbstractModuleSource.prototype%.

For Module Records that do not have a source representation, GetModuleSource() must always return a throw completion whose [[Value]] is a SyntaxError.

ModuleSourcesEqual(otherModuleRecord)

For Module Records that implement a normal completion for GetModuleSource(), allows defining a source equality operation for host registry checks.

For Module Records that do not have a source representation, ModuleSourcesEqual() is never called.

GetModuleSourceName()

For Module Records that implement a normal completion for GetModuleSource(), returns a constant String for each concrete module record that exposes a source representation through GetModuleSource(), to be provided in the strongly branded return value of the @@toStringTag getter on %AbstractModuleSource%.

For Module Records that do not have a source representation, GetModuleSourceName() is never called.

16.1.1.2 Source Text Module Records

Table 3: Additional Fields of Source Text Module Records
Field Name Value Type Meaning
[[SourceText]] a sequence of Unicode code points The original source text for this module, allowing for equality checks and serialization of module sources. Hosts may implement this field with any optimized representation that supports equality and serialization.
[[ECMAScriptCode]] a Parse Node The result of parsing the source text of this module using Module as the goal symbol.
[[Context]] an ECMAScript code execution context or empty The execution context associated with this module. It is empty until the module's environment has been initialized.
[[ImportMeta]] an Object or empty An object exposed through the import.meta meta property. It is empty until it is accessed by ECMAScript code.
[[ModuleSource]] an Object or empty The Module Source Object generated by GetModuleSource().
[[ImportEntries]] a List of ImportEntry Records A List of ImportEntry records derived from the code of this module.
[[LocalExportEntries]] a List of ExportEntry Records A List of ExportEntry records derived from the code of this module that correspond to declarations that occur within the module.
[[IndirectExportEntries]] a List of ExportEntry Records A List of ExportEntry records derived from the code of this module that correspond to reexported imports that occur within the module or exports from export * as namespace declarations.
[[StarExportEntries]] a List of ExportEntry Records A List of ExportEntry records derived from the code of this module that correspond to export * declarations that occur within the module, not including export * as namespace declarations.

16.1.1.2.1 ParseModule ( sourceText, realm, hostDefined )

The abstract operation ParseModule takes arguments sourceText (ECMAScript source text), realm (a Realm Record), and hostDefined (anything) and returns a Source Text Module Record or a non-empty List of SyntaxError objects. It creates a Source Text Module Record based upon the result of parsing sourceText as a Module. It performs the following steps when called:

  1. Let body be ParseText(sourceText, Module).
  2. If body is a List of errors, return body.
  3. Let requestedModules be the ModuleRequests of body.
  4. Let importEntries be the ImportEntries of body.
  5. Let importedBoundNames be ImportedLocalNames(importEntries).
  6. Let indirectExportEntries be a new empty List.
  7. Let localExportEntries be a new empty List.
  8. Let starExportEntries be a new empty List.
  9. Let exportEntries be the ExportEntries of body.
  10. For each ExportEntry Record ee of exportEntries, do
    1. If ee.[[ModuleRequest]] is null, then
      1. If importedBoundNames does not contain ee.[[LocalName]], then
        1. Append ee to localExportEntries.
      2. Else,
        1. Let ie be the element of importEntries whose [[LocalName]] is ee.[[LocalName]].
        2. If ie.[[ImportName]] is namespace-object, then
          1. NOTE: This is a re-export of an imported module namespace object.
          2. Append ee to localExportEntries.
        3. Else,
          1. NOTE: This is a re-export of a single name.
          2. Append the ExportEntry Record { [[ModuleRequest]]: ie.[[ModuleRequest]], [[ImportName]]: ie.[[ImportName]], [[LocalName]]: null, [[ExportName]]: ee.[[ExportName]] } to indirectExportEntries.
    2. Else if ee.[[ImportName]] is all-but-default, then
      1. Assert: ee.[[ExportName]] is null.
      2. Append ee to starExportEntries.
    3. Else,
      1. Append ee to indirectExportEntries.
  11. Let async be body Contains await.
  12. Return Source Text Module Record { [[Realm]]: realm, [[Environment]]: empty, [[Namespace]]: empty, [[CycleRoot]]: empty, [[HasTLA]]: async, [[AsyncEvaluation]]: false, [[TopLevelCapability]]: empty, [[AsyncParentModules]]: « », [[PendingAsyncDependencies]]: empty, [[Status]]: new, [[EvaluationError]]: empty, [[HostDefined]]: hostDefined, [[SourceText]]: sourceText, [[ECMAScriptCode]]: body, [[Context]]: empty, [[ImportMeta]]: empty, [[ModuleSource]]: empty, [[RequestedModules]]: requestedModules, [[LoadedModules]]: « », [[ImportEntries]]: importEntries, [[LocalExportEntries]]: localExportEntries, [[IndirectExportEntries]]: indirectExportEntries, [[StarExportEntries]]: starExportEntries, [[DFSIndex]]: empty, [[DFSAncestorIndex]]: empty }.
Note

An implementation may parse module source text and analyse it for Early Error conditions prior to the evaluation of ParseModule for that module source text. However, the reporting of any errors must be deferred until the point where this specification actually performs ParseModule upon that source text.

16.1.1.2.2 GetModuleSource ( )

The GetModuleSource concrete method of a Source Text Module Record module takes no arguments and returns either a normal completion containing an Object or a throw completion. It performs the following steps when called:

  1. Throw a SyntaxError exception.
  2. If module.[[ModuleSource]] is not empty, then
    1. Return module.[[ModuleSource]].
  3. Let moduleSource be OrdinaryObjectCreate(%ModuleSource.prototype%).
  4. Set moduleSource.[[SourceTextModuleRecord]] to module.
  5. Set module.[[ModuleSource]] to moduleSource.
  6. Return moduleSource.

16.1.1.2.3 ModuleSourcesEqual ( otherModule )

The ModuleSourcesEqual concrete method of a Source Text Module Record module takes argument otherModule (a Module Record) and returns a Boolean. Checks module source equality (not module instance equality) of this module record against another module record It performs the following steps when called:

  1. If otherModule is not a Source Text Module Record, return false.
  2. If otherModule.[[SourceText]] is equal to module.[[SourceText]], return true.
  3. Return false.

16.1.1.2.4 GetModuleSourceName ( )

The GetModuleSourceName concrete method of a Source Text Module Record module takes no arguments and returns a String. It performs the following steps when called:

  1. Return "ModuleSource".

16.1.1.2.5 HostLoadImportedModule ( referrer, moduleRequest, hostDefined, payload )

The host-defined abstract operation HostLoadImportedModule takes arguments referrer (a Script Record, a Cyclic Module Record, or a Realm Record), moduleRequest (a ModuleRequest Record or Module Record), hostDefined (anything), and payload (a GraphLoadingState Record or a PromiseCapability Record) and returns unused.

Note 1

An example of when referrer can be a Realm Record is in a web browser host. There, if a user clicks on a control given by

<button type="button" onclick="import('./foo.mjs')">Click me</button>

there will be no active script or module at the time the import() expression runs. More generally, this can happen in any situation where the host pushes execution contexts with null ScriptOrModule components onto the execution context stack.

An implementation of HostLoadImportedModule must conform to the following requirements:

  • The host environment must perform FinishLoadingImportedModule(referrer, moduleRequest, payload, result), where result is either a normal completion containing the loaded Module Record or a throw completion, either synchronously or asynchronously.
  • If this operation is called multiple times with two (referrer, moduleRequest) pairs such that:

    • the first referrer is the same as the second referrer;
    • ModuleRequestsEqual(the first moduleRequest, the second moduleRequest) is true;

    and it performs FinishLoadingImportedModule(referrer, moduleRequest, payload, result) where result is a normal completion, then it must perform FinishLoadingImportedModule(referrer, moduleRequest, payload, result) with the same result each time.

  • The completion record returned by this operation must not be affected by moduleRequest.[[Phase]].
  • A moduleRequest is a Module Record when importing a Module Source Object directly. In this case it is only necessary to add the module to the module registry, while possibly coalescing with any existing record on exact key and source equality to maintain the invariants above.
  • The operation must treat payload as an opaque value to be passed through to FinishLoadingImportedModule.

The actual process performed is host-defined, but typically consists of performing whatever I/O operations are necessary to load the appropriate Module Record. Multiple different (referrer, moduleRequest.[[Specifier]], moduleRequest.[[Attributes]]) triples may map to the same Module Record instance. The actual mapping semantics is host-defined but typically a normalization process is applied to specifier as part of the mapping process. A typical normalization process would include actions such as expansion of relative and abbreviated path specifiers.

Note 2

Implementations may provide unobservable module loading optimizations, such as speculative preloading of modules that are likely to be requested next. When doing so, they should consider whether the module is being imported for its source phase, which won't cause calls to the HostLoadImportedModule hook for its transitive dependencies, or for its evaluation phase, which will.

16.1.1.2.6 FinishLoadingImportedModule ( referrer, moduleRequest, payload, result )

The abstract operation FinishLoadingImportedModule takes arguments referrer (a Script Record, a Cyclic Module Record, or a Realm Record), moduleRequest (a ModuleRequest Record or Module Record), payload (a GraphLoadingState Record or a PromiseCapability Record), and result (either a normal completion containing a Module Record or a throw completion) and returns unused. It performs the following steps when called:

  1. If result is a normal completion and moduleRequest is a ModuleRequest Record, then
    1. If referrer.[[LoadedModules]] contains a LoadedModuleRequest Record record such that ModuleRequestsEqual(record, moduleRequest) is true, then
      1. Assert: record.[[Module]] and result.[[Value]] are the same Module Record.
    2. Else,
      1. Append the LoadedModuleRequest Record { [[Specifier]]: moduleRequest.[[Specifier]], [[Attributes]]: moduleRequest.[[Attributes]], [[Module]]: result.[[Value]] } to referrer.[[LoadedModules]].
  2. If payload is a GraphLoadingState Record, then
    1. Assert: moduleRequest is a ModuleRequest Record.
    2. Perform ContinueModuleLoading(payload, moduleRequest.[[Phase]], result).
  3. Else,
    1. Perform ContinueDynamicImport(payload, moduleRequest.[[Phase]], result).
  4. Return unused.

16.1.1.3 GetModuleSourceModuleRecord ( moduleSource )

The abstract operation GetModuleSourceModuleRecord takes argument moduleSource (an Object) and returns either a Module Record or not-a-source. Provides the concrete Module Record for all Module Source objects. It performs the following steps when called:

  1. Let module be undefined.
  2. If moduleSource has a [[SourceTextModuleRecord]] internal slot, then
    1. Set module to moduleSource.[[SourceTextModuleRecord]].
  3. Else,
    1. Set module to HostGetModuleSourceModuleRecord(moduleSource).
    2. If module is not-a-source, return not-a-source.
  4. Assert: module is a concrete Module Record.
  5. Assert: If module is a Source Text Module Record, then module.[[ModuleSource]] is equal to moduleSource.
  6. Return module.

16.1.1.4 HostGetModuleSourceName ( moduleSource )

The host-defined abstract operation HostGetModuleSourceName takes argument moduleSource (an Object) and returns either a normal completion containing a String or a throw completion.

An implementation of HostGetModuleSourceName must conform to the following requirements:

16.1.1.5 HostGetModuleSourceModuleRecord ( moduleSource )

The host-defined abstract operation HostGetModuleSourceModuleRecord takes argument moduleSource (an Object) and returns either a Module Record or not-a-source. Allows hosts to provide the concrete Module Record for a non-ECMA-262 module source object.

An implementation of HostGetModuleSourceModuleRecord must conform to the following requirements:

  • Defines any host-specific module sources, by returning their concrete Module Record.
  • For all other objects, returns not-a-source.

The default implementation of HostGetModuleSourceModuleRecord is to return not-a-source.

Note

This host hook is only for module types implemented outside of ECMA-262. See GetModuleSourceModuleRecord, where %ModuleSource% is handled before calling this hook.

28 Reflection

28.1 Module Source Objects

Module Source Objects represent modules in their source import phase, which are not linked, instantiated or executed.

A Module Source Object is an object for which HostGetModuleSourceNameGetModuleSourceModuleRecord returns a normal completion.

All Module Source Objects should have a prototype of %AbstractModuleSource%.prototype.

Hosts may define their own %AbstractModuleSource% subclasses for custom module types.

28.1.1 Properties of the %AbstractModuleSource% Prototype Object

28.1.1.1 get %AbstractModuleSource%.prototype [ @@toStringTag ]

%AbstractModuleSource%.prototype [@@toStringTag] is an accessor property whose set accessor function is undefined. Its get accessor function performs the following steps when called:

  1. Let O be the this value.
  2. If O is not an Object, return undefined.
  3. Let sourceNameResult be Completion(HostGetModuleSourceName(O)).
  4. If sourceNameResult is an abrupt completion, return undefined.
  5. Let name be ! sourceNameResult.
  6. Let module be GetModuleSourceModuleRecord(O).
  7. If module is not-a-source, return undefined.
  8. Let name be module.GetModuleSourceName().
  9. Assert: name is a String.
  10. Return name.

This property has the attributes { [[Enumerable]]: false, [[Configurable]]: true }.

The initial value of the "name" property of this function is "get [Symbol.toStringTag]".

28.1.2 The ModuleSource Constructor

The ModuleSource constructor:

  • is %ModuleSource%.
  • does not have a global name or appear as a property of the global object.
  • will throw an error when invoked, where support for dynamic construction may be added in future.

28.1.2.1 ModuleSource ( )

This function performs the following steps when called:

  1. Throw a TypeError exception.

28.1.3 Properties of the %ModuleSource% Prototype Object

The %ModuleSource% prototype object:

  • has a [[Prototype]] internal slot whose value is %AbstractModuleSource.prototype%.
  • is %ModuleSource.prototype%.
  • is an ordinary object.
  • has the following properties:

28.1.3.1 %ModuleSource%.prototype.constructor

The initial value of %ModuleSource%.prototype.constructor is %ModuleSource%.

28.1.4 Properties of ModuleSource Instances

ModuleSource instances are ordinary objects that inherit properties from the %ModuleSource% prototype object.

ModuleSource instances have a [[SourceTextModuleRecord]] internal slot.

A Host Layering Points

A.1 Host Hooks

HostCallJobCallback(...)

HostEnqueueFinalizationRegistryCleanupJob(...)

HostEnqueueGenericJob(...)

HostEnqueuePromiseJob(...)

HostEnqueueTimeoutJob(...)

HostEnsureCanCompileStrings(...)

HostFinalizeImportMeta(...)

HostGetImportMetaProperties(...)

HostGetModuleSourceNameHostGetModuleSourceModuleRecord(...)

HostGrowSharedArrayBuffer(...)

HostHasSourceTextAvailable(...)

HostLoadImportedModule(...)

HostGetSupportedImportAttributes(...)

HostMakeJobCallback(...)

HostPromiseRejectionTracker(...)

HostResizeArrayBuffer(...)

InitializeHostDefinedRealm(...)

B Copyright & Software License

Copyright Notice

© 2024 Luca Casonato, Guy Bedford

Software License

All Software contained in this document ("Software") is protected by copyright and is being made available under the "BSD License", included below. This Software may be subject to third party rights (rights from parties other than Ecma International), including patent rights, and no licenses under such third party rights are granted under this license even if the third party concerned is a member of Ecma International. SEE THE ECMA CODE OF CONDUCT IN PATENT MATTERS AVAILABLE AT https://ecma-international.org/memento/codeofconduct.htm FOR INFORMATION REGARDING THE LICENSING OF PATENT CLAIMS THAT ARE REQUIRED TO IMPLEMENT ECMA INTERNATIONAL STANDARDS.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of the authors nor Ecma International may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE ECMA INTERNATIONAL "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ECMA INTERNATIONAL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.