?um/p1-90`superを含むsource textがsuperである場合、それはSyntax Errorです。superに対する追加のThe
Script Recordは、評価されているscriptに関する情報をencapsulateします。各script recordは
| Field Name | Value Type | Meaning |
|---|---|---|
| [[Realm]] |
a |
このscriptが作成された |
| [[ECMAScriptCode]] |
a |
このscriptのsource textをparseした結果。 |
| [[LoadedModules]] |
a |
このscriptによってimportされたspecifier stringsからresolved |
| [[HostDefined]] |
anything (default value is |
scriptに追加情報を関連付ける必要がある |
The abstract operation ParseScript takes arguments sourceText (a String or a sequence of Unicode code points), realm (a
implementationは、そのscript source textに対するParseScriptのevaluationより前に、script source textをparseし、それをEarly Error conditionsについてanalyseしてもよいです。ただし、errorsのreportingは、この仕様が実際にそのsource textに対してParseScriptを実行する時点までdeferされなければなりません。
The abstract operation ScriptEvaluation takes argument scriptRecord (a
The abstract operation GlobalDeclarationInstantiation takes arguments script (a
scriptsを評価するために
これは呼び出されたとき、次のstepsを実行します:
varおよびfunction束縛(非strict explicit varまたはfunction declarationsとは異なり、
superである場合、それはSyntax Errorです。
重複export default
The abstract operation ImportedLocalNames takes argument importEntries (a
ModuleRequest Recordは、与えられたimport attributesでmoduleをimportするrequestを表します。これは次のfieldsから構成されます:
| Field Name | Value Type | Meaning |
|---|---|---|
| [[Specifier]] | a String | module specifier |
| [[Attributes]] |
a |
import attributes |
LoadedModuleRequest Recordは、moduleをimportするrequestを、その結果として得られる
| Field Name | Value Type | Meaning |
|---|---|---|
| [[Specifier]] | a String | module specifier |
| [[Attributes]] |
a |
import attributes |
| [[Module]] |
a |
このmodule requestに対応するloaded module |
ImportAttribute Recordは次のfieldsから構成されます:
| Field Name | Value Type | Meaning |
|---|---|---|
| [[Key]] | a String | attribute key |
| [[Value]] | a String | attribute value |
The abstract operation ModuleRequestsEqual takes arguments x (a
The
Module Recordは、単一moduleのimportsおよびexportsに関するstructural informationをencapsulateします。この情報は、connected modulesのsetsのimportsおよびexportsをlinkするために使用されます。Module Recordには、moduleを評価するときにのみ使用される4つのfieldsが含まれます。
specification purposesのため、Module Record値は
Module Recordは
| Field Name | Value Type | Meaning |
|---|---|---|
| [[Realm]] |
a |
このmoduleが作成された |
| [[Environment]] |
a |
このmoduleに対するtop level bindingsを含む |
| [[Namespace]] |
an Object or |
このmoduleに対して作成されている場合のModule Namespace Object( |
| [[HostDefined]] |
anything (default value is |
moduleに追加情報を関連付ける必要がある |
| Method | Purpose | Definitions |
|---|---|---|
| LoadRequestedModules ( [ hostDefined ] ) | The abstract method LoadRequestedModules takes optional argument hostDefined (anything) and returns a Promise. そのすべてのdependenciesを再帰的にloadすることで、linkingのためにmoduleを準備します。 |
この仕様内では、これは次のtypes内にdefinitionsを持ちます; |
| GetExportedNames ( [ exportStarSet ] ) | The abstract method GetExportedNames takes optional argument exportStarSet (a このmoduleから直接または間接的にexportされるすべてのnamesのlistを返します。 このmethodをinvokeする前に、 |
この仕様内では、これは次のtypes内にdefinitionsを持ちます; |
| ResolveExport ( exportName [ , resolveSet ] ) | The abstract method ResolveExport takes argument exportName (a String) and optional argument resolveSet (a このmoduleによってexportされるnameのbindingを返します。Bindingsは、{ [[Module]]: このoperationが特定のexportName、resolveSet pairをargumentsとして呼び出されるたびに、同じresultを返さなければなりません。 このmethodをinvokeする前に、 |
この仕様内では、これは次のtypes内にdefinitionsを持ちます; |
| Link ( ) | The abstract method Link takes no arguments and returns either a すべてのmodule dependenciesをtransitivelyにresolveし、 このmethodをinvokeする前に、 |
この仕様内では、これは次のtypes内にdefinitionsを持ちます; |
| Evaluate ( ) | The abstract method Evaluate takes no arguments and returns a Promise. このmoduleおよびそのdependenciesのevaluationに対するpromiseを返します。このpromiseは、successful evaluation時またはすでにsuccessfullyに評価済みである場合にresolveされ、evaluation error時またはすでにunsuccessfullyに評価済みである場合にrejectされます。promiseがrejectedされる場合、 このmethodをinvokeする前に、 |
この仕様内では、これは次のtypes内にdefinitionsを持ちます; |
The abstract operation EvaluateModuleSync takes argument module (a
Cyclic Module Recordは、
| Field Name | Value Type | Meaning |
|---|---|---|
| [[Status]] |
|
Initially |
| [[EvaluationError]] |
a |
evaluation中に発生したexceptionを表す |
| [[DFSAncestorIndex]] |
an |
|
| [[RequestedModules]] |
a |
このmodule内のimportsに関連付けられた |
| [[LoadedModules]] |
a |
このrecordによって表されるmoduleが、relative import attributesとともにmoduleのimportationをrequestするために使用したspecifier stringsから、resolved |
| [[CycleRoot]] |
a |
cycleの最初にvisitedされたmodule、strongly connected componentのroot DFS ancestor。cycle内にないmoduleについては、これはmodule自身になります。 |
| [[HasTLA]] | a Boolean |
このmoduleが個別にasynchronousであるかどうか(例えば、top-level awaitを含む |
| [[AsyncEvaluationOrder]] |
|
このfieldはinitiallyに |
| [[TopLevelCapability]] |
a |
このmoduleが何らかのcycleの[[CycleRoot]]であり、そのcycle内の何らかのmoduleに対して |
| [[AsyncParentModules]] |
a |
このmoduleまたはdependencyが[[HasTLA]] |
| [[PendingAsyncDependencies]] |
an |
このmoduleがasynchronous dependenciesを持つ場合、これはこのmoduleのためにexecuteがremainingしているasynchronous dependency modulesの数をtrackします。asynchronous dependenciesを持つmoduleは、このfieldが0に到達し、execution errorsがない場合にexecutedされます。 |
| Method | Purpose | Definitions |
|---|---|---|
| InitializeEnvironment ( ) | The abstract method InitializeEnvironment takes no arguments and returns either a |
この仕様内では、これは次のtypes内にdefinitionsを持ちます; |
| ExecuteModule ( [ capability ] ) | The abstract method ExecuteModule takes optional argument capability (a |
この仕様内では、これは次のtypes内にdefinitionsを持ちます; |
GraphLoadingState Recordは、module graphのloading processに関する情報を含む
| Field Name | Value Type | Meaning |
|---|---|---|
| [[PromiseCapability]] |
a |
loading processがfinishしたときにresolveするpromise。 |
| [[IsLoading]] | a Boolean | loading processがまだfinishしておらず、successfullyでもerrorでもない場合はtrueです。 |
| [[PendingModulesCount]] |
a non-negative |
pending |
| [[Visited]] |
a |
circular dependenciesによるinfinite loopsを避けるため、current loading processによってすでにloadedされた |
| [[HostDefined]] |
anything (default value is |
|
以下は、
The
<link rel="preload" as="..."> tagsに対して正しいfetch destinationを設定するために使用されます。
import() expressionsは決してhostDefined parameterを設定しません。
The abstract operation InnerModuleLoading takes arguments state (a
The abstract operation ContinueModuleLoading takes arguments state (a
The
The abstract operation InnerModuleLinking takes arguments module (a
The
The abstract operation InnerModuleEvaluation takes arguments module (a
moduleは、InnerModuleEvaluationによってtraversedされている間は
asynchronous cycleのmoduleに依存する任意のmodulesは、そのcycleが
The abstract operation ExecuteAsyncModule takes argument module (a
The abstract operation GatherAvailableAncestors takes arguments module (a
root moduleに対するasynchronous executionがfulfilledされると、このfunctionは、このcompletion時に一緒にsynchronouslyにexecuteできるmodulesのlistを決定し、それらをexecListにpopulateします。
The abstract operation AsyncModuleExecutionFulfilled takes argument module (a
The abstract operation AsyncModuleExecutionRejected takes arguments module (a
このnon-normative sectionは、errorsがどのように発生し得るかに特にfocusして、いくつかのcommon module graphsのlinkingおよびevaluationの一連のexamplesを示します。
まず、次のsimple module graphを考えます:
まず、error conditionsがないと仮定します。hostが最初にA.
次に、A.
最後に、
次に、異なるtypeのerror conditionを考えます:
このscenarioでは、module Aが何らかの他のmoduleへのdependencyをdeclareしていますが、そのmoduleに対する
ここでのloading、linking、evaluation errorsの違いは、次のcharacteristicに起因します:
次に、cycleを持つmodule graphを考えます:
ここではentry pointがmodule Aであると仮定します。そのため、hostはA.
その後、hostはA.
cyclic module graphのevaluation phaseについても、success caseではanalogous storyが発生します。
次に、Aにlinking errorがあるcaseを考えます;例えば、AがCから存在しないbindingをimportしようとする場合です。その場合、上記のstepsはやはり発生し、Aに対する2回目の
あるいは、Aにevaluation errorがあるcaseを考えます;例えば、そのsource codeがexceptionをthrowする場合です。その場合、上記stepsのevaluation-time analogueはやはり発生し、Aに対する2回目のawaitを含む、またはそれに依存するmodulesのchainをdependency graph全体に形成する[[AsyncParentModules]]を介して、
最後に、すべてのmodulesがasynchronouslyにcompleteするcycleを持つmodule graphを考えます:
Loadingおよびlinkingは以前と同様に発生し、すべてのmodulesは[[Status]]が
A.
|
Field
|
A | B | C | D | E |
|---|---|---|---|---|---|
| [[DFSAncestorIndex]] | 0 | 0 | 0 | 0 | 4 |
| [[Status]] | |||||
| [[AsyncEvaluationOrder]] | 4 | 1 | 3 | 0 | 2 |
| [[AsyncParentModules]] | « » | « A » | « A » | « B, C » | « C » |
| [[PendingAsyncDependencies]] | 2 (B and C) | 1 (D) | 2 (D and E) | 0 | 0 |
Eが最初にexecutingをfinishすると仮定します。その場合、
|
Field
|
C | E |
|---|---|---|
| [[DFSAncestorIndex]] | 0 | 4 |
| [[Status]] | ||
| [[AsyncEvaluationOrder]] | 3 | |
| [[AsyncParentModules]] | « A » | « C » |
| [[PendingAsyncDependencies]] | 1 (D) | 0 |
次にfinishするのはDです(まだexecutingしていた唯一のmoduleだったため)。その場合、awaitを含む場合、potentiallyにBとparallelに)。updated modulesのfieldsは
|
Field
|
B | C | D |
|---|---|---|---|
| [[DFSAncestorIndex]] | 0 | 0 | 0 |
| [[Status]] | |||
| [[AsyncEvaluationOrder]] | 1 | 3 | |
| [[AsyncParentModules]] | « A » | « A » | « B, C » |
| [[PendingAsyncDependencies]] | 0 | 0 | 0 |
Cが次にexecutingをfinishすると仮定します。その場合、
|
Field
|
A | C |
|---|---|---|
| [[DFSAncestorIndex]] | 0 | 0 |
| [[Status]] | ||
| [[AsyncEvaluationOrder]] | 4 | |
| [[AsyncParentModules]] | « » | « A » |
| [[PendingAsyncDependencies]] | 1 (B) | 0 |
次に、Bがexecutingをfinishします。その場合、
|
Field
|
A | B |
|---|---|---|
| [[DFSAncestorIndex]] | 0 | 0 |
| [[Status]] | ||
| [[AsyncEvaluationOrder]] | 4 | |
| [[AsyncParentModules]] | « » | « A » |
| [[PendingAsyncDependencies]] | 0 | 0 |
最後に、Aがexecutingをfinishします。その場合、
|
Field
|
A |
|---|---|
| [[DFSAncestorIndex]] | 0 |
| [[Status]] | |
| [[AsyncEvaluationOrder]] | |
| [[AsyncParentModules]] | « » |
| [[PendingAsyncDependencies]] | 0 |
あるいは、Bがexecutingをfinishする前にCがexecutionにfailし、errorを返すfailure caseを考えます。その場合、
|
Field
|
A | C |
|---|---|---|
| [[DFSAncestorIndex]] | 0 | 0 |
| [[Status]] | ||
| [[AsyncEvaluationOrder]] | ||
| [[AsyncParentModules]] | « » | « A » |
| [[PendingAsyncDependencies]] | 1 (B) | 0 |
| [[EvaluationError]] | C's evaluation error |
CがCのerrorを伴ってAに対して
|
Field
|
A |
|---|---|
| [[DFSAncestorIndex]] | 0 |
| [[Status]] | |
| [[AsyncEvaluationOrder]] | |
| [[AsyncParentModules]] | « » |
| [[PendingAsyncDependencies]] | 0 |
| [[EvaluationError]] | C's |
その後、Bがerrorなしでexecutingをfinishします。その場合、
|
Field
|
A | B |
|---|---|---|
| [[DFSAncestorIndex]] | 0 | 0 |
| [[Status]] | ||
| [[AsyncEvaluationOrder]] | 4 | 1 |
| [[AsyncParentModules]] | « » | « A » |
| [[PendingAsyncDependencies]] | 0 | 0 |
| [[EvaluationError]] | C's |
Source Text Module Recordは、
| Field Name | Value Type | Meaning |
|---|---|---|
| [[ECMAScriptCode]] |
a |
|
| [[Context]] |
an |
このmoduleに関連付けられた |
| [[ImportMeta]] |
an Object or |
import.meta meta propertyを通じてexposedされるobject。ECMAScript codeによってaccessされるまでは |
| [[ImportEntries]] |
a |
このmoduleのcodeからderivedされたImportEntry recordsの |
| [[LocalExportEntries]] |
a |
module内でoccurするdeclarationsに対応する、このmoduleのcodeからderivedされたExportEntry recordsの |
| [[IndirectExportEntries]] |
a |
module内でoccurするreexported imports、またはexport * as namespace declarationsからのexportsに対応する、このmoduleのcodeからderivedされたExportEntry recordsの |
| [[StarExportEntries]] |
a |
module内でoccurするexport * declarationsに対応する、このmoduleのcodeからderivedされたExportEntry recordsのexport * as namespace declarationsは含まれません。
|
ImportEntry Recordは、単一のdeclarative importに関する情報をdigestする
| Field Name | Value Type | Meaning |
|---|---|---|
| [[ModuleRequest]] |
a |
|
| [[ImportName]] |
a String or |
[[ModuleRequest]]によってidentifiedされるmoduleによってdesired bindingがexportされているname。値 |
| [[LocalName]] | a String | importing module内からimported valueにlocallyにaccessするために使用されるname。 |
| Import Statement Form | [[ModuleRequest]] | [[ImportName]] | [[LocalName]] |
|---|---|---|---|
import v from "mod";
|
|
|
|
import * as ns from "mod";
|
|
|
|
import {x} from "mod";
|
|
|
|
import {x as v} from "mod";
|
|
|
|
import "mod";
|
|
||
ExportEntry Recordは、単一のdeclarative exportに関する情報をdigestする
| Field Name | Value Type | Meaning |
|---|---|---|
| [[ExportName]] |
a String or |
このmoduleによってこのbindingをexportするために使用されるname。 |
| [[ModuleRequest]] |
a |
|
| [[ImportName]] |
a String, |
[[ModuleRequest]]によってidentifiedされるmoduleによってdesired bindingがexportされているname。export * as ns from "mod" declarationsに使用されます。export * from "mod" declarationsに使用されます。
|
| [[LocalName]] |
a String or |
importing module内からexported valueにlocallyにaccessするために使用されるname。exported valueがmodule内からlocallyにaccessできない場合は |
| Export Statement Form | [[ExportName]] | [[ModuleRequest]] | [[ImportName]] | [[LocalName]] |
|---|---|---|---|---|
export var v;
|
|
|
|
|
export default function f() {}
|
|
|
|
|
export default function () {}
|
|
|
|
|
export default 42;
|
|
|
|
|
export {x};
|
|
|
|
|
export {v as x};
|
|
|
|
|
export {x} from "mod";
|
|
|
|
|
export {v as x} from "mod";
|
|
|
|
|
export * from "mod";
|
|
|
|
|
export * as ns from "mod";
|
|
|
|
|
次のdefinitionsは、
The abstract operation ParseModule takes arguments sourceText (a String or a sequence of Unicode code points), realm (a
export * fromを通じて同じbindingまたはnamespaceを同じnameで2回exportすることから生じるconflictsは、awaitとする。implementationは、そのmodule source textに対するParseModuleのevaluationより前に、module source textをparseし、それをEarly Error conditionsについてanalyseしてもよいです。ただし、errorsのreportingは、この仕様が実際にそのsource textに対してParseModuleを実行する時点までdeferされなければなりません。
以下は、
The
The
defining moduleが見つかった場合、
It performs the following steps when called:
*エクスポートが複数存在する。以下は、
The
The
Synthetic Module Recordは、specificationsによって定義されるmoduleに関する情報を表すために使用されます。そのexported namesはcreation時にstaticallyに定義され、一方でそれらに対応するvaluesは
| Field Name | Value Type | Meaning |
|---|---|---|
| [[ExportNames]] | a |
moduleのexportsのnames。このlistはduplicatesを含みません。 |
| [[EvaluationSteps]] | an |
moduleのevaluation時に実行するinitialization logicであり、 |
The abstract operation CreateDefaultExportSyntheticModule takes argument defaultExport (an ECMAScript language value) and returns a
The abstract operation ParseJSONModule takes argument source (a String) and returns either a
The abstract operation SetSyntheticModuleExport takes arguments module (a
以下は、
The
The
The
The
The
The abstract operation GetImportedModule takes arguments referrer (a
The
referrerが
<button type="button" onclick="import('./foo.mjs')">Click me</button>
import()
HostLoadImportedModuleのimplementationは次のrequirementsにconformしなければなりません:
このoperationが、次を満たす2つの(referrer, moduleRequest) pairsで複数回callされた場合:
かつ、resultが
moduleRequest.[[Attributes]]が、entry.[[Key]]が
actual processは
The abstract operation FinishLoadingImportedModule takes arguments referrer (a
The abstract operation AllImportAttributesSupported takes argument attrs (a
The
HostGetSupportedImportAttributesのimplementationは次のrequirementsにconformしなければなりません:
HostGetSupportedImportAttributesのdefault implementationは、新しい空の
The abstract operation GetModuleNamespace takes argument module (an instance of a concrete subclass of
GetModuleNamespaceは決してthrowしません。代わりに、unresolvable namesはこの時点で単にnamespaceから除外されます。それらは、どこでもexplicitly requestedされていないambiguous star exportsだけでない限り、後でreal linking errorにつながります。
The
The
The
上記のruleは、
The
ExportedBindingsは、
It is defined piecewise over the following productions:
The
ExportedNamesは、
It is defined piecewise over the following productions:
The
The
The