@jbpark/live-editor 6.0.0 → 6.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ko.md +8 -0
- package/README.md +8 -0
- package/dist/{boundary-CySnDUs2.js → boundary-CLMNMZFa.js} +4 -4
- package/dist/boundary-CLMNMZFa.js.map +1 -0
- package/dist/{cn-CAnad2vL.js → compile-BWZ5U59y.js} +135 -2
- package/dist/compile-BWZ5U59y.js.map +1 -0
- package/dist/{context-Bjq0CvBE.js → context-DJxX9epB.js} +2 -3
- package/dist/context-DJxX9epB.js.map +1 -0
- package/dist/{core-BNVuH8-l.js → core-BfJwD8Jx.js} +3 -6
- package/dist/core-BfJwD8Jx.js.map +1 -0
- package/dist/dnd/index.js +2 -2
- package/dist/{dnd-BvjEDo-x.js → dnd-DAGjlJ0_.js} +241 -170
- package/dist/dnd-DAGjlJ0_.js.map +1 -0
- package/dist/{document-uHqw0mvr.js → document-MkQGxfry.js} +1182 -636
- package/dist/document-MkQGxfry.js.map +1 -0
- package/dist/editor/index.js +2 -2
- package/dist/{editor-CvnzrM9J.js → editor-B_VOz3Q0.js} +2 -2
- package/dist/{editor-CvnzrM9J.js.map → editor-B_VOz3Q0.js.map} +1 -1
- package/dist/editor-caches-DXYXgWeD.js +63 -0
- package/dist/editor-caches-DXYXgWeD.js.map +1 -0
- package/dist/error/index.d.ts +1 -1
- package/dist/error/index.js +2 -2
- package/dist/{error-CFzvnLCf.js → error-E3T5CS3m.js} +13 -12
- package/dist/error-E3T5CS3m.js.map +1 -0
- package/dist/{index-DfIvkht8.d.ts → index-BC9hY7dI.d.ts} +5 -5
- package/dist/{index-CqsS207F.d.ts → index-D-Dfv65w.d.ts} +3 -2
- package/dist/index.d.ts +4 -4
- package/dist/index.js +5 -5
- package/dist/preview/index.d.ts +1 -1
- package/dist/preview/index.js +1 -1
- package/dist/{preview-B05MkVIQ.js → preview-DFb1pOqJ.js} +30 -11
- package/dist/preview-DFb1pOqJ.js.map +1 -0
- package/dist/provider/index.js +1 -1
- package/dist/{sections-DhH_aVf5.js → sections-CnG7OLr8.js} +3 -3
- package/dist/{sections-DhH_aVf5.js.map → sections-CnG7OLr8.js.map} +1 -1
- package/dist/states-Ci1AvoQ9.js.map +1 -1
- package/dist/style.css +74 -74
- package/dist/ui-kit/index.js +2 -2
- package/dist/ui-kit/style.css +22 -6
- package/dist/{update-BuYQJqjq.js → update-DnX2ibYn.js} +162 -43
- package/dist/update-DnX2ibYn.js.map +1 -0
- package/dist/{use-dynamic-tailwind-B3l1qZRW.js → use-dynamic-tailwind-CjXeHjsr.js} +115 -40
- package/dist/use-dynamic-tailwind-CjXeHjsr.js.map +1 -0
- package/dist/{use-field-state-iQGW0vc6.js → use-field-state-B1VLhWfr.js} +2 -2
- package/dist/{use-field-state-iQGW0vc6.js.map → use-field-state-B1VLhWfr.js.map} +1 -1
- package/dist/utils/ast/index.js +1 -86
- package/dist/utils/index.js +3 -4
- package/package.json +3 -4
- package/dist/boundary-CySnDUs2.js.map +0 -1
- package/dist/cn-CAnad2vL.js.map +0 -1
- package/dist/compile-my0AjsCw.js +0 -136
- package/dist/compile-my0AjsCw.js.map +0 -1
- package/dist/constants-st9gnJ5g.js +0 -55
- package/dist/constants-st9gnJ5g.js.map +0 -1
- package/dist/context-Bjq0CvBE.js.map +0 -1
- package/dist/core-BNVuH8-l.js.map +0 -1
- package/dist/detect-typescript-CMF0FVKD.js +0 -10
- package/dist/detect-typescript-CMF0FVKD.js.map +0 -1
- package/dist/dnd-BvjEDo-x.js.map +0 -1
- package/dist/document-uHqw0mvr.js.map +0 -1
- package/dist/editor-caches-ClMvdcQF.js +0 -23
- package/dist/editor-caches-ClMvdcQF.js.map +0 -1
- package/dist/error-CFzvnLCf.js.map +0 -1
- package/dist/preview-B05MkVIQ.js.map +0 -1
- package/dist/update-BuYQJqjq.js.map +0 -1
- package/dist/use-dynamic-tailwind-B3l1qZRW.js.map +0 -1
- package/dist/utils/ast/index.js.map +0 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as registerEditorCache } from "./editor-caches-ClMvdcQF.js";
|
|
1
|
+
import { a as CONFIG, n as registerEditorCache, o as DATA_ATTR, s as DEFAULT_CONTAINER_ID } from "./editor-caches-DXYXgWeD.js";
|
|
3
2
|
import { t as createBoundedCache } from "./cache-B0-XcIxJ.js";
|
|
4
3
|
//#region \0rolldown/runtime.js
|
|
5
4
|
var __create = Object.create;
|
|
@@ -33,7 +32,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
32
|
enumerable: true
|
|
34
33
|
}) : target, mod));
|
|
35
34
|
//#endregion
|
|
36
|
-
//#region node_modules/.pnpm/@babel+parser@8.0
|
|
35
|
+
//#region node_modules/.pnpm/@babel+parser@8.1.0/node_modules/@babel/parser/lib/index.js
|
|
37
36
|
var Position = class {
|
|
38
37
|
constructor(line, col, index) {
|
|
39
38
|
this.line = void 0;
|
|
@@ -119,6 +118,7 @@ const StandardErrors = {
|
|
|
119
118
|
DecoratorSemicolon: "Decorators must not be followed by a semicolon.",
|
|
120
119
|
DecoratorStaticBlock: "Decorators can't be used with a static block.",
|
|
121
120
|
DeferImportRequiresNamespace: "Only `import defer * as x from \"./module\"` is valid.",
|
|
121
|
+
DeferExportInvalidAll: "`export defer * from \"./module\"` is invalid. Explicitly list the re-exported names.",
|
|
122
122
|
DeletePrivateField: "Deleting a private field is not allowed.",
|
|
123
123
|
DestructureNamedImport: "ES2015 named imports do not destructure. Use another statement for destructuring after the import.",
|
|
124
124
|
DuplicateConstructor: "Duplicate constructor in the same class.",
|
|
@@ -130,6 +130,9 @@ const StandardErrors = {
|
|
|
130
130
|
EscapedCharNotAnIdentifier: "Invalid Unicode escape.",
|
|
131
131
|
ExportBindingIsString: ({ localName, exportName }) => `A string literal cannot be used as an exported binding without \`from\`.\n- Did you mean \`export { '${localName}' as '${exportName}' } from 'some-module'\`?`,
|
|
132
132
|
ExportDefaultFromAsIdentifier: "'from' is not allowed as an identifier after 'export default'.",
|
|
133
|
+
FilteredNamespaceDuplicateName: ({ name }) => `Duplicate name '${name}' in filtered namespace.`,
|
|
134
|
+
FilteredNamespaceRename: "Names in a filtered namespace cannot be renamed using `as`.",
|
|
135
|
+
FilteredNamespaceTypeModifier: "Names in a filtered namespace cannot have a type modifier.",
|
|
133
136
|
ForInOfLoopInitializer: ({ type }) => `'${type === "ForInStatement" ? "for-in" : "for-of"}' loop variable declaration may not have an initializer.`,
|
|
134
137
|
ForInUsing: "For-in loop may not start with 'using' declaration.",
|
|
135
138
|
ForOfAsync: "The left-hand side of a for-of loop may not be 'async'.",
|
|
@@ -139,9 +142,9 @@ const StandardErrors = {
|
|
|
139
142
|
IllegalLanguageModeDirective: "Illegal 'use strict' directive in function with non-simple parameter list.",
|
|
140
143
|
IllegalReturn: "'return' outside of function.",
|
|
141
144
|
ImportBindingIsString: ({ importName }) => `A string literal cannot be used as an imported binding.\n- Did you mean \`import { "${importName}" as foo }\`?`,
|
|
142
|
-
ImportCallArity: ({ phase }) => `\`import${phase ? `.${phase}` : ""}()\` requires exactly one or two arguments.`,
|
|
143
|
-
ImportCallNotNewExpression: ({ phase }) => `Cannot use new with import${phase ? `.${phase}` : ""}().`,
|
|
144
|
-
ImportCallSpreadArgument: ({ phase }) => `\`...\` is not allowed in \`import${phase ? `.${phase}` : ""}()\`.`,
|
|
145
|
+
ImportCallArity: ({ phase, sync }) => `\`import${phase ? `.${phase}` : sync ? ".sync" : ""}()\` requires exactly one or two arguments.`,
|
|
146
|
+
ImportCallNotNewExpression: ({ phase, sync }) => `Cannot use new with import${phase ? `.${phase}` : sync ? ".sync" : ""}().`,
|
|
147
|
+
ImportCallSpreadArgument: ({ phase, sync }) => `\`...\` is not allowed in \`import${phase ? `.${phase}` : sync ? ".sync" : ""}()\`.`,
|
|
145
148
|
IncompatibleRegExpUVFlags: "The 'u' and 'v' regular expression flags cannot be enabled at the same time.",
|
|
146
149
|
InvalidBigIntLiteral: "Invalid BigIntLiteral.",
|
|
147
150
|
InvalidCodePoint: "Code point out of bounds.",
|
|
@@ -155,7 +158,6 @@ const StandardErrors = {
|
|
|
155
158
|
InvalidLhs: ({ ancestor }) => `Invalid left-hand side in ${toNodeDescription(ancestor)}.`,
|
|
156
159
|
InvalidLhsBinding: ({ ancestor }) => `Binding invalid left-hand side in ${toNodeDescription(ancestor)}.`,
|
|
157
160
|
InvalidLhsOptionalChaining: ({ ancestor }) => `Invalid optional chaining in the left-hand side of ${toNodeDescription(ancestor)}.`,
|
|
158
|
-
InvalidNumber: "Invalid number.",
|
|
159
161
|
InvalidOrMissingExponent: "Floating-point numbers require a valid exponent after the 'e'.",
|
|
160
162
|
InvalidOrUnexpectedToken: ({ unexpected }) => `Unexpected character '${unexpected}'.`,
|
|
161
163
|
InvalidParenthesizedAssignment: "Invalid parenthesized assignment pattern.",
|
|
@@ -376,9 +378,11 @@ function getOptions(opts) {
|
|
|
376
378
|
return options;
|
|
377
379
|
}
|
|
378
380
|
function toESTreeLocation(node) {
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
381
|
+
if (node.loc) {
|
|
382
|
+
const { start, end } = node.loc;
|
|
383
|
+
node.loc.start = new Position(start.line, start.column);
|
|
384
|
+
node.loc.end = new Position(end.line, end.column);
|
|
385
|
+
}
|
|
382
386
|
return node;
|
|
383
387
|
}
|
|
384
388
|
const estree = (superClass) => class ESTreeParserMixin extends superClass {
|
|
@@ -605,7 +609,7 @@ const estree = (superClass) => class ESTreeParserMixin extends superClass {
|
|
|
605
609
|
case "ExportAllDeclaration":
|
|
606
610
|
node.exported = null;
|
|
607
611
|
break;
|
|
608
|
-
case "ExportNamedDeclaration": if (node.specifiers.length === 1 && node.specifiers[0].type === "ExportNamespaceSpecifier") {
|
|
612
|
+
case "ExportNamedDeclaration": if (node.specifiers.length === 1 && node.specifiers[0].type === "ExportNamespaceSpecifier" && !node.specifiers[0].exportsFilter) {
|
|
609
613
|
this.castNodeTo(node, "ExportAllDeclaration");
|
|
610
614
|
node.exported = node.specifiers[0].exported;
|
|
611
615
|
delete node.specifiers;
|
|
@@ -922,6 +926,7 @@ const tt = {
|
|
|
922
926
|
}),
|
|
923
927
|
_for: createKeyword("for", { isLoop: isLoop$1 }),
|
|
924
928
|
_while: createKeyword("while", { isLoop: isLoop$1 }),
|
|
929
|
+
_arguments: createKeywordLike("arguments", { startsExpr }),
|
|
925
930
|
_as: createKeywordLike("as", { startsExpr }),
|
|
926
931
|
_assert: createKeywordLike("assert", { startsExpr }),
|
|
927
932
|
_async: createKeywordLike("async", { startsExpr }),
|
|
@@ -936,6 +941,8 @@ const tt = {
|
|
|
936
941
|
_set: createKeywordLike("set", { startsExpr }),
|
|
937
942
|
_source: createKeywordLike("source", { startsExpr }),
|
|
938
943
|
_static: createKeywordLike("static", { startsExpr }),
|
|
944
|
+
_struct: createKeywordLike("struct", { startsExpr }),
|
|
945
|
+
_sync: createKeywordLike("sync", { startsExpr }),
|
|
939
946
|
_using: createKeywordLike("using", { startsExpr }),
|
|
940
947
|
_yield: createKeywordLike("yield", { startsExpr }),
|
|
941
948
|
_asserts: createKeywordLike("asserts", { startsExpr }),
|
|
@@ -975,16 +982,16 @@ const tt = {
|
|
|
975
982
|
jsxTagEnd: createToken("jsxTagEnd")
|
|
976
983
|
};
|
|
977
984
|
function tokenIsIdentifier(token) {
|
|
978
|
-
return token >= 89 && token <=
|
|
985
|
+
return token >= 89 && token <= 132;
|
|
979
986
|
}
|
|
980
987
|
function tokenKeywordOrIdentifierIsKeyword(token) {
|
|
981
988
|
return token <= 88;
|
|
982
989
|
}
|
|
983
990
|
function tokenIsKeywordOrIdentifier(token) {
|
|
984
|
-
return token >= 54 && token <=
|
|
991
|
+
return token >= 54 && token <= 132;
|
|
985
992
|
}
|
|
986
993
|
function tokenIsLiteralPropertyName(token) {
|
|
987
|
-
return token >= 54 && token <=
|
|
994
|
+
return token >= 54 && token <= 135;
|
|
988
995
|
}
|
|
989
996
|
function tokenComesBeforeExpression(token) {
|
|
990
997
|
return tokenBeforeExprs[token];
|
|
@@ -996,7 +1003,7 @@ function tokenIsAssignment(token) {
|
|
|
996
1003
|
return token >= 25 && token <= 29;
|
|
997
1004
|
}
|
|
998
1005
|
function tokenIsFlowInterfaceOrTypeOrOpaque(token) {
|
|
999
|
-
return token >=
|
|
1006
|
+
return token >= 128 && token <= 130;
|
|
1000
1007
|
}
|
|
1001
1008
|
function tokenIsLoop(token) {
|
|
1002
1009
|
return token >= 86 && token <= 88;
|
|
@@ -1014,10 +1021,10 @@ function tokenIsPrefix(token) {
|
|
|
1014
1021
|
return tokenPrefixes[token];
|
|
1015
1022
|
}
|
|
1016
1023
|
function tokenIsTSTypeOperator(token) {
|
|
1017
|
-
return token >=
|
|
1024
|
+
return token >= 120 && token <= 122;
|
|
1018
1025
|
}
|
|
1019
1026
|
function tokenIsTSDeclarationStart(token) {
|
|
1020
|
-
return token >=
|
|
1027
|
+
return token >= 123 && token <= 129;
|
|
1021
1028
|
}
|
|
1022
1029
|
function tokenLabelName(token) {
|
|
1023
1030
|
return tokenLabels[token];
|
|
@@ -1554,7 +1561,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
1554
1561
|
return this.getPluginOption("flow", "all") || this.flowPragma === "flow";
|
|
1555
1562
|
}
|
|
1556
1563
|
finishToken(type, val) {
|
|
1557
|
-
if (type !==
|
|
1564
|
+
if (type !== 133 && type !== 9 && type !== 24) {
|
|
1558
1565
|
if (this.flowPragma === void 0) this.flowPragma = null;
|
|
1559
1566
|
}
|
|
1560
1567
|
super.finishToken(type, val);
|
|
@@ -1581,7 +1588,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
1581
1588
|
const node = this.startNode();
|
|
1582
1589
|
const moduloLoc = this.state.startLoc;
|
|
1583
1590
|
this.next();
|
|
1584
|
-
this.expectContextual(
|
|
1591
|
+
this.expectContextual(109);
|
|
1585
1592
|
if (this.state.lastTokStartLoc.index > moduloLoc.index + 1) this.raise(FlowErrors.UnexpectedSpaceBetweenModuloChecks, moduloLoc);
|
|
1586
1593
|
if (this.eat(6)) {
|
|
1587
1594
|
node.value = super.parseExpression();
|
|
@@ -1635,15 +1642,15 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
1635
1642
|
if (this.match(76)) return this.flowParseDeclareClass(node);
|
|
1636
1643
|
else if (this.match(64)) return this.flowParseDeclareFunction(node);
|
|
1637
1644
|
else if (this.match(70)) return this.flowParseDeclareVariable(node);
|
|
1638
|
-
else if (this.eatContextual(
|
|
1645
|
+
else if (this.eatContextual(126)) {
|
|
1639
1646
|
if (this.match(12)) return this.flowParseDeclareModuleExports(node);
|
|
1640
1647
|
else {
|
|
1641
1648
|
if (insideModule) this.raise(FlowErrors.NestedDeclareModule, this.state.lastTokStartLoc);
|
|
1642
1649
|
return this.flowParseDeclareModule(node);
|
|
1643
1650
|
}
|
|
1644
|
-
} else if (this.isContextual(
|
|
1645
|
-
else if (this.isContextual(
|
|
1646
|
-
else if (this.isContextual(
|
|
1651
|
+
} else if (this.isContextual(129)) return this.flowParseDeclareTypeAlias(node);
|
|
1652
|
+
else if (this.isContextual(130)) return this.flowParseDeclareOpaqueType(node);
|
|
1653
|
+
else if (this.isContextual(128)) return this.flowParseDeclareInterface(node);
|
|
1647
1654
|
else if (this.match(78)) return this.flowParseDeclareExportDeclaration(node, insideModule);
|
|
1648
1655
|
throw this.unexpected();
|
|
1649
1656
|
}
|
|
@@ -1656,7 +1663,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
1656
1663
|
}
|
|
1657
1664
|
flowParseDeclareModule(node) {
|
|
1658
1665
|
this.scope.enter(0);
|
|
1659
|
-
if (this.match(
|
|
1666
|
+
if (this.match(133)) node.id = super.parseExprAtom();
|
|
1660
1667
|
else node.id = this.parseIdentifier();
|
|
1661
1668
|
const bodyNode = this.startNode();
|
|
1662
1669
|
const body = bodyNode.body = [];
|
|
@@ -1665,10 +1672,10 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
1665
1672
|
const bodyNode = this.startNode();
|
|
1666
1673
|
if (this.match(79)) {
|
|
1667
1674
|
this.next();
|
|
1668
|
-
if (!this.isContextual(
|
|
1675
|
+
if (!this.isContextual(129) && !this.match(83)) this.raise(FlowErrors.InvalidNonTypeImportInDeclareModule, this.state.lastTokStartLoc);
|
|
1669
1676
|
body.push(super.parseImport(bodyNode));
|
|
1670
1677
|
} else {
|
|
1671
|
-
this.expectContextual(
|
|
1678
|
+
this.expectContextual(124, FlowErrors.UnsupportedStatementInDeclareModule);
|
|
1672
1679
|
body.push(this.flowParseDeclare(bodyNode, true));
|
|
1673
1680
|
}
|
|
1674
1681
|
}
|
|
@@ -1702,18 +1709,18 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
1702
1709
|
node.default = true;
|
|
1703
1710
|
return this.finishNode(node, "DeclareExportDeclaration");
|
|
1704
1711
|
} else {
|
|
1705
|
-
if (this.match(71) || this.isLet() || (this.isContextual(
|
|
1712
|
+
if (this.match(71) || this.isLet() || (this.isContextual(129) || this.isContextual(128)) && !insideModule) {
|
|
1706
1713
|
const label = this.state.value;
|
|
1707
1714
|
throw this.raise(FlowErrors.UnsupportedDeclareExportKind, this.state.startLoc, {
|
|
1708
1715
|
unsupportedExportKind: label,
|
|
1709
1716
|
suggestion: exportSuggestions[label]
|
|
1710
1717
|
});
|
|
1711
1718
|
}
|
|
1712
|
-
if (this.match(70) || this.match(64) || this.match(76) || this.isContextual(
|
|
1719
|
+
if (this.match(70) || this.match(64) || this.match(76) || this.isContextual(130)) {
|
|
1713
1720
|
node.declaration = this.flowParseDeclare(this.startNode());
|
|
1714
1721
|
node.default = false;
|
|
1715
1722
|
return this.finishNode(node, "DeclareExportDeclaration");
|
|
1716
|
-
} else if (this.match(51) || this.match(2) || this.isContextual(
|
|
1723
|
+
} else if (this.match(51) || this.match(2) || this.isContextual(128) || this.isContextual(129) || this.isContextual(130)) {
|
|
1717
1724
|
const result = this.parseExport(node, null);
|
|
1718
1725
|
if (result.type === "ExportNamedDeclaration") {
|
|
1719
1726
|
result.default = false;
|
|
@@ -1726,7 +1733,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
1726
1733
|
}
|
|
1727
1734
|
flowParseDeclareModuleExports(node) {
|
|
1728
1735
|
this.next();
|
|
1729
|
-
this.expectContextual(
|
|
1736
|
+
this.expectContextual(110);
|
|
1730
1737
|
node.typeAnnotation = this.flowParseTypeAnnotation();
|
|
1731
1738
|
this.semicolon();
|
|
1732
1739
|
return this.finishNode(node, "DeclareModuleExports");
|
|
@@ -1758,10 +1765,10 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
1758
1765
|
if (isClass) {
|
|
1759
1766
|
const implemented = [];
|
|
1760
1767
|
const mixins = [];
|
|
1761
|
-
if (this.eatContextual(
|
|
1768
|
+
if (this.eatContextual(116)) do
|
|
1762
1769
|
mixins.push(this.flowParseInterfaceExtends());
|
|
1763
1770
|
while (this.eat(8));
|
|
1764
|
-
if (this.eatContextual(
|
|
1771
|
+
if (this.eatContextual(112)) do
|
|
1765
1772
|
implemented.push(this.flowParseClassImplements());
|
|
1766
1773
|
while (this.eat(8));
|
|
1767
1774
|
node.implements = implemented;
|
|
@@ -1812,7 +1819,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
1812
1819
|
return this.finishNode(node, "TypeAlias");
|
|
1813
1820
|
}
|
|
1814
1821
|
flowParseOpaqueType(node, declare) {
|
|
1815
|
-
this.expectContextual(
|
|
1822
|
+
this.expectContextual(129);
|
|
1816
1823
|
node.id = this.flowParseRestrictedIdentifier(true, true);
|
|
1817
1824
|
this.scope.declareName(node.id.name, 8201, node.id.start);
|
|
1818
1825
|
if (this.match(43)) node.typeParameters = this.flowParseTypeParameterDeclaration();
|
|
@@ -1850,7 +1857,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
1850
1857
|
const node = this.startNode();
|
|
1851
1858
|
node.params = [];
|
|
1852
1859
|
this.state.inType = true;
|
|
1853
|
-
if (this.match(43) || this.match(
|
|
1860
|
+
if (this.match(43) || this.match(141)) this.next();
|
|
1854
1861
|
else this.unexpected();
|
|
1855
1862
|
let defaultRequired = false;
|
|
1856
1863
|
do {
|
|
@@ -1915,7 +1922,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
1915
1922
|
}
|
|
1916
1923
|
flowParseInterfaceType() {
|
|
1917
1924
|
const node = this.startNode();
|
|
1918
|
-
this.expectContextual(
|
|
1925
|
+
this.expectContextual(128);
|
|
1919
1926
|
node.extends = [];
|
|
1920
1927
|
if (this.eat(77)) do
|
|
1921
1928
|
node.extends.push(this.flowParseInterfaceExtends());
|
|
@@ -1930,7 +1937,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
1930
1937
|
return this.finishNode(node, "InterfaceTypeAnnotation");
|
|
1931
1938
|
}
|
|
1932
1939
|
flowParseObjectPropertyKey() {
|
|
1933
|
-
return this.match(
|
|
1940
|
+
return this.match(134) || this.match(133) ? super.parseExprAtom() : this.parseIdentifier(true);
|
|
1934
1941
|
}
|
|
1935
1942
|
flowParseObjectTypeIndexer(node, isStatic, variance) {
|
|
1936
1943
|
node.static = isStatic;
|
|
@@ -2015,7 +2022,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2015
2022
|
let protoStartLoc = null;
|
|
2016
2023
|
let inexactStartLoc = null;
|
|
2017
2024
|
const node = this.startNode();
|
|
2018
|
-
if (allowProto && this.isContextual(
|
|
2025
|
+
if (allowProto && this.isContextual(117)) {
|
|
2019
2026
|
const lookahead = this.lookahead();
|
|
2020
2027
|
if (lookahead.type !== 10 && lookahead.type !== 13) {
|
|
2021
2028
|
this.next();
|
|
@@ -2023,7 +2030,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2023
2030
|
allowStatic = false;
|
|
2024
2031
|
}
|
|
2025
2032
|
}
|
|
2026
|
-
if (allowStatic && this.isContextual(
|
|
2033
|
+
if (allowStatic && this.isContextual(103)) {
|
|
2027
2034
|
const lookahead = this.lookahead();
|
|
2028
2035
|
if (lookahead.type !== 10 && lookahead.type !== 13) {
|
|
2029
2036
|
this.next();
|
|
@@ -2043,7 +2050,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2043
2050
|
nodeStart.callProperties.push(this.flowParseObjectTypeCallProperty(node, isStatic));
|
|
2044
2051
|
} else {
|
|
2045
2052
|
let kind = "init";
|
|
2046
|
-
if (this.isContextual(
|
|
2053
|
+
if (this.isContextual(96) || this.isContextual(101)) {
|
|
2047
2054
|
if (tokenIsLiteralPropertyName(this.lookahead().type)) {
|
|
2048
2055
|
kind = this.state.value;
|
|
2049
2056
|
this.next();
|
|
@@ -2279,7 +2286,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2279
2286
|
node.typeParameters = null;
|
|
2280
2287
|
return this.finishNode(node, "FunctionTypeAnnotation");
|
|
2281
2288
|
}
|
|
2282
|
-
case
|
|
2289
|
+
case 133: return this.parseLiteral(this.state.value, "StringLiteralTypeAnnotation");
|
|
2283
2290
|
case 81:
|
|
2284
2291
|
case 82:
|
|
2285
2292
|
node.value = this.match(81);
|
|
@@ -2288,13 +2295,13 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2288
2295
|
case 49:
|
|
2289
2296
|
if (this.state.value === "-") {
|
|
2290
2297
|
this.next();
|
|
2291
|
-
if (this.match(
|
|
2292
|
-
if (this.match(
|
|
2298
|
+
if (this.match(134)) return this.parseLiteralAtNode(-this.state.value, "NumberLiteralTypeAnnotation", node);
|
|
2299
|
+
if (this.match(135)) return this.parseLiteralAtNode(-this.state.value, "BigIntLiteralTypeAnnotation", node);
|
|
2293
2300
|
throw this.raise(FlowErrors.UnexpectedSubtractionOperand, this.state.startLoc);
|
|
2294
2301
|
}
|
|
2295
2302
|
throw this.unexpected();
|
|
2296
|
-
case
|
|
2297
|
-
case
|
|
2303
|
+
case 134: return this.parseLiteral(this.state.value, "NumberLiteralTypeAnnotation");
|
|
2304
|
+
case 135: return this.parseLiteral(this.state.value, "BigIntLiteralTypeAnnotation");
|
|
2298
2305
|
case 84:
|
|
2299
2306
|
this.next();
|
|
2300
2307
|
return this.finishNode(node, "VoidTypeAnnotation");
|
|
@@ -2313,7 +2320,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2313
2320
|
this.next();
|
|
2314
2321
|
return super.createIdentifier(node, label);
|
|
2315
2322
|
} else if (tokenIsIdentifier(this.state.type)) {
|
|
2316
|
-
if (this.isContextual(
|
|
2323
|
+
if (this.isContextual(128)) return this.flowParseInterfaceType();
|
|
2317
2324
|
return this.flowIdentToTypeAnnotation(startLoc, node, this.parseIdentifier());
|
|
2318
2325
|
}
|
|
2319
2326
|
}
|
|
@@ -2388,7 +2395,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2388
2395
|
return type;
|
|
2389
2396
|
}
|
|
2390
2397
|
flowParseTypeOrImplicitInstantiation() {
|
|
2391
|
-
if (this.state.type ===
|
|
2398
|
+
if (this.state.type === 131 && this.state.value === "_") {
|
|
2392
2399
|
const startLoc = this.state.startLoc;
|
|
2393
2400
|
const node = this.parseIdentifier();
|
|
2394
2401
|
return this.flowParseGenericType(startLoc, node);
|
|
@@ -2438,13 +2445,13 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2438
2445
|
return super.parseFunctionBodyAndFinish(node, type, isMethod);
|
|
2439
2446
|
}
|
|
2440
2447
|
parseStatementLike(flags) {
|
|
2441
|
-
if (this.state.strict && this.isContextual(
|
|
2448
|
+
if (this.state.strict && this.isContextual(128)) {
|
|
2442
2449
|
if (tokenIsKeywordOrIdentifier(this.lookahead().type)) {
|
|
2443
2450
|
const node = this.startNode();
|
|
2444
2451
|
this.next();
|
|
2445
2452
|
return this.flowParseInterface(node);
|
|
2446
2453
|
}
|
|
2447
|
-
} else if (this.isContextual(
|
|
2454
|
+
} else if (this.isContextual(125)) {
|
|
2448
2455
|
const node = this.startNode();
|
|
2449
2456
|
this.next();
|
|
2450
2457
|
return this.flowParseEnumDeclaration(node);
|
|
@@ -2453,7 +2460,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2453
2460
|
if (this.flowPragma === void 0 && !this.isValidDirective(stmt)) this.flowPragma = null;
|
|
2454
2461
|
return stmt;
|
|
2455
2462
|
}
|
|
2456
|
-
parseExpressionStatement(node, expr) {
|
|
2463
|
+
parseExpressionStatement(node, expr, flags) {
|
|
2457
2464
|
if (expr.type === "Identifier") {
|
|
2458
2465
|
if (expr.name === "declare") {
|
|
2459
2466
|
if (this.match(76) || tokenIsIdentifier(this.state.type) || this.match(64) || this.match(70) || this.match(78)) return this.flowParseDeclare(node);
|
|
@@ -2463,20 +2470,20 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2463
2470
|
else if (expr.name === "opaque") return this.flowParseOpaqueType(node, false);
|
|
2464
2471
|
}
|
|
2465
2472
|
}
|
|
2466
|
-
return super.parseExpressionStatement(node, expr);
|
|
2473
|
+
return super.parseExpressionStatement(node, expr, flags);
|
|
2467
2474
|
}
|
|
2468
2475
|
shouldParseExportDeclaration() {
|
|
2469
2476
|
const { type } = this.state;
|
|
2470
|
-
if (type ===
|
|
2477
|
+
if (type === 125 || tokenIsFlowInterfaceOrTypeOrOpaque(type)) return !this.state.containsEsc;
|
|
2471
2478
|
return super.shouldParseExportDeclaration();
|
|
2472
2479
|
}
|
|
2473
2480
|
isExportDefaultSpecifier() {
|
|
2474
2481
|
const { type } = this.state;
|
|
2475
|
-
if (type ===
|
|
2482
|
+
if (type === 125 || tokenIsFlowInterfaceOrTypeOrOpaque(type)) return this.state.containsEsc;
|
|
2476
2483
|
return super.isExportDefaultSpecifier();
|
|
2477
2484
|
}
|
|
2478
2485
|
parseExportDefaultExpression() {
|
|
2479
|
-
if (this.isContextual(
|
|
2486
|
+
if (this.isContextual(125)) {
|
|
2480
2487
|
const node = this.startNode();
|
|
2481
2488
|
this.next();
|
|
2482
2489
|
return this.flowParseEnumDeclaration(node);
|
|
@@ -2589,7 +2596,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2589
2596
|
super.assertModuleNodeAllowed(node);
|
|
2590
2597
|
}
|
|
2591
2598
|
parseExportDeclaration(node) {
|
|
2592
|
-
if (this.isContextual(
|
|
2599
|
+
if (this.isContextual(129)) {
|
|
2593
2600
|
node.exportKind = "type";
|
|
2594
2601
|
const declarationNode = this.startNode();
|
|
2595
2602
|
this.next();
|
|
@@ -2598,17 +2605,17 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2598
2605
|
super.parseExportFrom(node);
|
|
2599
2606
|
return null;
|
|
2600
2607
|
} else return this.flowParseTypeAlias(declarationNode);
|
|
2601
|
-
} else if (this.isContextual(
|
|
2608
|
+
} else if (this.isContextual(130)) {
|
|
2602
2609
|
node.exportKind = "type";
|
|
2603
2610
|
const declarationNode = this.startNode();
|
|
2604
2611
|
this.next();
|
|
2605
2612
|
return this.flowParseOpaqueType(declarationNode, false);
|
|
2606
|
-
} else if (this.isContextual(
|
|
2613
|
+
} else if (this.isContextual(128)) {
|
|
2607
2614
|
node.exportKind = "type";
|
|
2608
2615
|
const declarationNode = this.startNode();
|
|
2609
2616
|
this.next();
|
|
2610
2617
|
return this.flowParseInterface(declarationNode);
|
|
2611
|
-
} else if (this.isContextual(
|
|
2618
|
+
} else if (this.isContextual(125)) {
|
|
2612
2619
|
node.exportKind = "value";
|
|
2613
2620
|
const declarationNode = this.startNode();
|
|
2614
2621
|
this.next();
|
|
@@ -2617,7 +2624,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2617
2624
|
}
|
|
2618
2625
|
eatExportStar(node) {
|
|
2619
2626
|
if (super.eatExportStar(node)) return true;
|
|
2620
|
-
if (this.isContextual(
|
|
2627
|
+
if (this.isContextual(129) && this.lookahead().type === 51) {
|
|
2621
2628
|
node.exportKind = "type";
|
|
2622
2629
|
this.next();
|
|
2623
2630
|
this.next();
|
|
@@ -2631,8 +2638,14 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2631
2638
|
if (hasNamespace && node.exportKind === "type") this.unexpected(startLoc);
|
|
2632
2639
|
return hasNamespace;
|
|
2633
2640
|
}
|
|
2641
|
+
maybeParseExportNamedSpecifiers(node) {
|
|
2642
|
+
if (!super.maybeParseExportNamedSpecifiers(node)) return false;
|
|
2643
|
+
const specifier = node.specifiers[node.specifiers.length - 1];
|
|
2644
|
+
if (node.exportKind === "type" && specifier?.type === "ExportNamespaceSpecifier") this.unexpected(specifier.start);
|
|
2645
|
+
return true;
|
|
2646
|
+
}
|
|
2634
2647
|
parseClassId(node, isStatement, optionalId) {
|
|
2635
|
-
if ((!isStatement || optionalId) && this.isContextual(
|
|
2648
|
+
if ((!isStatement || optionalId) && this.isContextual(112)) {
|
|
2636
2649
|
node.id = null;
|
|
2637
2650
|
return;
|
|
2638
2651
|
}
|
|
@@ -2641,7 +2654,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2641
2654
|
}
|
|
2642
2655
|
parseClassMember(classBody, member, state) {
|
|
2643
2656
|
const { startLoc } = this.state;
|
|
2644
|
-
if (this.isContextual(
|
|
2657
|
+
if (this.isContextual(124)) {
|
|
2645
2658
|
if (super.parseClassMemberFromModifier(classBody, member)) return;
|
|
2646
2659
|
member.declare = true;
|
|
2647
2660
|
}
|
|
@@ -2658,7 +2671,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2658
2671
|
const word = super.readWord1();
|
|
2659
2672
|
const fullWord = "@@" + word;
|
|
2660
2673
|
if (!this.isIterator(word) || !this.state.inType) this.raise(Errors.InvalidIdentifier, this.state.curPosition(), { identifierName: fullWord });
|
|
2661
|
-
this.finishToken(
|
|
2674
|
+
this.finishToken(131, fullWord);
|
|
2662
2675
|
}
|
|
2663
2676
|
getTokenFromCode(code) {
|
|
2664
2677
|
const next = this.input.charCodeAt(this.state.pos + 1);
|
|
@@ -2746,7 +2759,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2746
2759
|
parseClassSuper(node) {
|
|
2747
2760
|
super.parseClassSuper(node);
|
|
2748
2761
|
if (node.superClass && (this.match(43) || this.match(47))) node.superTypeArguments = this.flowParseTypeParameterInstantiationInExpression();
|
|
2749
|
-
if (this.eatContextual(
|
|
2762
|
+
if (this.eatContextual(112)) {
|
|
2750
2763
|
const implemented = node.implements = [];
|
|
2751
2764
|
do
|
|
2752
2765
|
implemented.push(this.flowParseClassImplements());
|
|
@@ -2800,7 +2813,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2800
2813
|
}
|
|
2801
2814
|
isPotentialImportPhase(isExport) {
|
|
2802
2815
|
if (super.isPotentialImportPhase(isExport)) return true;
|
|
2803
|
-
if (this.isContextual(
|
|
2816
|
+
if (this.isContextual(129)) {
|
|
2804
2817
|
if (!isExport) return true;
|
|
2805
2818
|
const ch = this.lookaheadCharCode();
|
|
2806
2819
|
return ch === 123 || ch === 42;
|
|
@@ -2817,15 +2830,19 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2817
2830
|
node.importKind = phase === "type" || phase === "typeof" ? phase : "value";
|
|
2818
2831
|
}
|
|
2819
2832
|
}
|
|
2820
|
-
|
|
2833
|
+
parseNamedOrFilteredImportSpecifiers(node) {
|
|
2834
|
+
super.parseNamedOrFilteredImportSpecifiers(node);
|
|
2835
|
+
const specifier = node.specifiers[node.specifiers.length - 1];
|
|
2836
|
+
if (hasTypeImportKind(node) && specifier?.type === "ImportNamespaceSpecifier") this.unexpected(specifier.start);
|
|
2837
|
+
}
|
|
2838
|
+
parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly) {
|
|
2821
2839
|
const firstIdent = specifier.imported;
|
|
2822
2840
|
let specifierTypeKind = null;
|
|
2823
2841
|
if (firstIdent.type === "Identifier") {
|
|
2824
2842
|
if (firstIdent.name === "type") specifierTypeKind = "type";
|
|
2825
2843
|
else if (firstIdent.name === "typeof") specifierTypeKind = "typeof";
|
|
2826
2844
|
}
|
|
2827
|
-
|
|
2828
|
-
if (this.isContextual(89) && !this.isLookaheadContextual("as")) {
|
|
2845
|
+
if (this.isContextual(90) && !this.isLookaheadContextual("as")) {
|
|
2829
2846
|
const as_ident = this.parseIdentifier(true);
|
|
2830
2847
|
if (specifierTypeKind !== null && !tokenIsKeywordOrIdentifier(this.state.type)) {
|
|
2831
2848
|
specifier.imported = as_ident;
|
|
@@ -2841,21 +2858,23 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2841
2858
|
specifier.imported = this.parseIdentifier(true);
|
|
2842
2859
|
specifier.importKind = specifierTypeKind;
|
|
2843
2860
|
} else {
|
|
2844
|
-
if (importedIsString) throw this.raise(Errors.ImportBindingIsString, specifier, { importName: firstIdent.value });
|
|
2845
2861
|
specifier.imported = firstIdent;
|
|
2846
2862
|
specifier.importKind = null;
|
|
2847
2863
|
}
|
|
2848
|
-
if (this.eatContextual(
|
|
2849
|
-
else
|
|
2850
|
-
isBinding = true;
|
|
2851
|
-
specifier.local = this.cloneIdentifier(specifier.imported);
|
|
2852
|
-
}
|
|
2864
|
+
if (this.eatContextual(90)) specifier.local = this.parseIdentifier();
|
|
2865
|
+
else specifier.local = this.cloneIdentifier(specifier.imported);
|
|
2853
2866
|
}
|
|
2867
|
+
return this.finishNode(specifier, "ImportSpecifier");
|
|
2868
|
+
}
|
|
2869
|
+
checkImportSpecifier(specifier, isInTypeOnlyImport) {
|
|
2854
2870
|
const specifierIsTypeImport = hasTypeImportKind(specifier);
|
|
2855
|
-
|
|
2856
|
-
if (
|
|
2857
|
-
|
|
2858
|
-
|
|
2871
|
+
const isTypeImport = isInTypeOnlyImport || specifierIsTypeImport;
|
|
2872
|
+
if (isTypeImport) {
|
|
2873
|
+
if (isInTypeOnlyImport && specifierIsTypeImport) this.raise(FlowErrors.ImportTypeShorthandOnlyInPureImport, specifier);
|
|
2874
|
+
const { local } = specifier;
|
|
2875
|
+
this.checkReservedType(local.name, local.start, true);
|
|
2876
|
+
}
|
|
2877
|
+
super.checkImportSpecifier(specifier, isInTypeOnlyImport, 8201, !isTypeImport);
|
|
2859
2878
|
}
|
|
2860
2879
|
parseBindingAtom() {
|
|
2861
2880
|
switch (this.state.type) {
|
|
@@ -2890,7 +2909,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2890
2909
|
parseMaybeAssign(refExpressionErrors, isParenItem) {
|
|
2891
2910
|
let state = null;
|
|
2892
2911
|
let jsx;
|
|
2893
|
-
if (this.hasPlugin("jsx") && (this.match(
|
|
2912
|
+
if (this.hasPlugin("jsx") && (this.match(141) || this.match(43))) {
|
|
2894
2913
|
state = this.state.clone();
|
|
2895
2914
|
jsx = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, isParenItem), state);
|
|
2896
2915
|
if (!jsx.error) return jsx.node;
|
|
@@ -3105,7 +3124,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
3105
3124
|
const startLoc = this.state.startLoc;
|
|
3106
3125
|
const endOfInit = () => this.match(8) || this.match(4);
|
|
3107
3126
|
switch (this.state.type) {
|
|
3108
|
-
case
|
|
3127
|
+
case 134: {
|
|
3109
3128
|
const literal = this.parseNumericLiteral(this.state.value);
|
|
3110
3129
|
if (endOfInit()) return {
|
|
3111
3130
|
type: "number",
|
|
@@ -3114,7 +3133,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
3114
3133
|
};
|
|
3115
3134
|
break;
|
|
3116
3135
|
}
|
|
3117
|
-
case
|
|
3136
|
+
case 133: {
|
|
3118
3137
|
const literal = this.parseStringLiteral(this.state.value);
|
|
3119
3138
|
if (endOfInit()) return {
|
|
3120
3139
|
type: "string",
|
|
@@ -3233,7 +3252,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
3233
3252
|
}
|
|
3234
3253
|
}
|
|
3235
3254
|
flowEnumParseExplicitType({ enumName }) {
|
|
3236
|
-
if (!this.eatContextual(
|
|
3255
|
+
if (!this.eatContextual(99)) return null;
|
|
3237
3256
|
if (!tokenIsIdentifier(this.state.type)) throw this.raise(FlowErrors.EnumInvalidExplicitTypeUnknownSupplied, this.state.startLoc, { enumName });
|
|
3238
3257
|
const { value } = this.state;
|
|
3239
3258
|
this.next();
|
|
@@ -3626,6 +3645,7 @@ function hasNewLine(input, start, end) {
|
|
|
3626
3645
|
return false;
|
|
3627
3646
|
}
|
|
3628
3647
|
const skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
|
|
3648
|
+
const skipWhiteSpaceAnnexB = /(?:[^\S\n\r\u2028\u2029]|\/\*.*?\*\/)*(?:(?!-->)(?:\s|\/\/.*|\/\*[^]*?\*\/|<!--.*|-->.*)*)?/g;
|
|
3629
3649
|
const skipWhiteSpaceInLine = /(?:[^\S\n\r\u2028\u2029]|\/\/.*|\/\*.*?\*\/)*/g;
|
|
3630
3650
|
function isWhitespace(code) {
|
|
3631
3651
|
switch (code) {
|
|
@@ -3685,12 +3705,12 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
3685
3705
|
if (this.state.pos === this.state.start) {
|
|
3686
3706
|
if (ch === 60 && this.state.canStartJSXElement) {
|
|
3687
3707
|
++this.state.pos;
|
|
3688
|
-
this.finishToken(
|
|
3708
|
+
this.finishToken(141);
|
|
3689
3709
|
} else super.getTokenFromCode(ch);
|
|
3690
3710
|
return;
|
|
3691
3711
|
}
|
|
3692
3712
|
out += this.input.slice(chunkStart, this.state.pos);
|
|
3693
|
-
this.finishToken(
|
|
3713
|
+
this.finishToken(140, out);
|
|
3694
3714
|
return;
|
|
3695
3715
|
case 38:
|
|
3696
3716
|
out += this.input.slice(chunkStart, this.state.pos);
|
|
@@ -3740,7 +3760,7 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
3740
3760
|
} else ++this.state.pos;
|
|
3741
3761
|
}
|
|
3742
3762
|
out += this.input.slice(chunkStart, this.state.pos++);
|
|
3743
|
-
this.finishToken(
|
|
3763
|
+
this.finishToken(133, out);
|
|
3744
3764
|
}
|
|
3745
3765
|
jsxReadEntity() {
|
|
3746
3766
|
const startPos = ++this.state.pos;
|
|
@@ -3776,11 +3796,11 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
3776
3796
|
do
|
|
3777
3797
|
ch = this.input.charCodeAt(++this.state.pos);
|
|
3778
3798
|
while (isIdentifierChar$1(ch) || ch === 45);
|
|
3779
|
-
this.finishToken(
|
|
3799
|
+
this.finishToken(139, this.input.slice(start, this.state.pos));
|
|
3780
3800
|
}
|
|
3781
3801
|
jsxParseIdentifier() {
|
|
3782
3802
|
const node = this.startNode();
|
|
3783
|
-
if (this.match(
|
|
3803
|
+
if (this.match(139)) node.name = this.state.value;
|
|
3784
3804
|
else if (tokenIsKeyword(this.state.type)) node.name = tokenLabelName(this.state.type);
|
|
3785
3805
|
else this.unexpected();
|
|
3786
3806
|
this.next();
|
|
@@ -3817,8 +3837,8 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
3817
3837
|
node = this.jsxParseExpressionContainer(node, types.j_oTag);
|
|
3818
3838
|
if (node.expression.type === "JSXEmptyExpression") this.raise(JsxErrors.AttributeIsEmpty, node);
|
|
3819
3839
|
return node;
|
|
3820
|
-
case
|
|
3821
|
-
case
|
|
3840
|
+
case 141:
|
|
3841
|
+
case 133: return this.parseExprAtom();
|
|
3822
3842
|
default: throw this.raise(JsxErrors.UnsupportedJsxValue, this.state.startLoc);
|
|
3823
3843
|
}
|
|
3824
3844
|
}
|
|
@@ -3864,7 +3884,7 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
3864
3884
|
return this.finishNode(node, "JSXAttribute");
|
|
3865
3885
|
}
|
|
3866
3886
|
jsxParseOpeningElementAt(startLoc) {
|
|
3867
|
-
if (this.eat(
|
|
3887
|
+
if (this.eat(142)) {
|
|
3868
3888
|
const node = this.startNodeAt(startLoc);
|
|
3869
3889
|
return this.finishNode(node, "JSXOpeningFragment");
|
|
3870
3890
|
}
|
|
@@ -3874,20 +3894,20 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
3874
3894
|
}
|
|
3875
3895
|
jsxParseOpeningElementAfterName(node) {
|
|
3876
3896
|
const attributes = [];
|
|
3877
|
-
while (!this.match(52) && !this.match(
|
|
3897
|
+
while (!this.match(52) && !this.match(142)) attributes.push(this.jsxParseAttribute());
|
|
3878
3898
|
node.attributes = attributes;
|
|
3879
3899
|
node.selfClosing = this.eat(52);
|
|
3880
|
-
this.expect(
|
|
3900
|
+
this.expect(142);
|
|
3881
3901
|
return this.finishNode(node, "JSXOpeningElement");
|
|
3882
3902
|
}
|
|
3883
3903
|
jsxParseClosingElementAt(startLoc) {
|
|
3884
|
-
if (this.eat(
|
|
3904
|
+
if (this.eat(142)) {
|
|
3885
3905
|
const node = this.startNodeAt(startLoc);
|
|
3886
3906
|
return this.finishNode(node, "JSXClosingFragment");
|
|
3887
3907
|
}
|
|
3888
3908
|
const node = this.startNodeAt(startLoc);
|
|
3889
3909
|
node.name = this.jsxParseElementName();
|
|
3890
|
-
this.expect(
|
|
3910
|
+
this.expect(142);
|
|
3891
3911
|
return this.finishNode(node, "JSXClosingElement");
|
|
3892
3912
|
}
|
|
3893
3913
|
jsxParseElementAt(startLoc) {
|
|
@@ -3897,17 +3917,16 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
3897
3917
|
let closingElement = null;
|
|
3898
3918
|
if (!openingElement.selfClosing) {
|
|
3899
3919
|
contents: for (;;) switch (this.state.type) {
|
|
3900
|
-
case
|
|
3920
|
+
case 141:
|
|
3901
3921
|
startLoc = this.state.startLoc;
|
|
3902
3922
|
this.next();
|
|
3903
3923
|
if (this.eat(52)) {
|
|
3904
|
-
this.setLoc(startLoc);
|
|
3905
3924
|
closingElement = this.jsxParseClosingElementAt(startLoc);
|
|
3906
3925
|
break contents;
|
|
3907
3926
|
}
|
|
3908
3927
|
children.push(this.jsxParseElementAt(startLoc));
|
|
3909
3928
|
break;
|
|
3910
|
-
case
|
|
3929
|
+
case 140:
|
|
3911
3930
|
children.push(this.parseLiteral(this.state.value, "JSXText"));
|
|
3912
3931
|
break;
|
|
3913
3932
|
case 2: {
|
|
@@ -3947,9 +3966,9 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
3947
3966
|
context[context.length - 1] = newContext;
|
|
3948
3967
|
}
|
|
3949
3968
|
parseExprAtom(refExpressionErrors) {
|
|
3950
|
-
if (this.match(
|
|
3969
|
+
if (this.match(141)) return this.jsxParseElement();
|
|
3951
3970
|
else if (this.match(43) && this.input.charCodeAt(this.state.pos) !== 33) {
|
|
3952
|
-
this.replaceToken(
|
|
3971
|
+
this.replaceToken(141);
|
|
3953
3972
|
return this.jsxParseElement();
|
|
3954
3973
|
} else return super.parseExprAtom(refExpressionErrors);
|
|
3955
3974
|
}
|
|
@@ -3969,7 +3988,7 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
3969
3988
|
}
|
|
3970
3989
|
if (code === 62) {
|
|
3971
3990
|
++this.state.pos;
|
|
3972
|
-
this.finishToken(
|
|
3991
|
+
this.finishToken(142);
|
|
3973
3992
|
return;
|
|
3974
3993
|
}
|
|
3975
3994
|
if ((code === 34 || code === 39) && context === types.j_oTag) {
|
|
@@ -3979,18 +3998,18 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
3979
3998
|
}
|
|
3980
3999
|
if (code === 60 && this.state.canStartJSXElement && this.input.charCodeAt(this.state.pos + 1) !== 33) {
|
|
3981
4000
|
++this.state.pos;
|
|
3982
|
-
this.finishToken(
|
|
4001
|
+
this.finishToken(141);
|
|
3983
4002
|
return;
|
|
3984
4003
|
}
|
|
3985
4004
|
super.getTokenFromCode(code);
|
|
3986
4005
|
}
|
|
3987
4006
|
updateContext(prevType) {
|
|
3988
4007
|
const { context, type } = this.state;
|
|
3989
|
-
if (type === 52 && prevType ===
|
|
4008
|
+
if (type === 52 && prevType === 141) {
|
|
3990
4009
|
context.splice(-2, 2, types.j_cTag);
|
|
3991
4010
|
this.state.canStartJSXElement = false;
|
|
3992
|
-
} else if (type ===
|
|
3993
|
-
else if (type ===
|
|
4011
|
+
} else if (type === 141) context.push(types.j_oTag);
|
|
4012
|
+
else if (type === 142) {
|
|
3994
4013
|
const out = context[context.length - 1];
|
|
3995
4014
|
if (out === types.j_oTag && prevType === 52 || out === types.j_cTag) {
|
|
3996
4015
|
context.pop();
|
|
@@ -4194,6 +4213,10 @@ var CommentsParser = class extends BaseParser {
|
|
|
4194
4213
|
case "ImportDeclaration":
|
|
4195
4214
|
adjustInnerComments(node, node.specifiers, commentWS);
|
|
4196
4215
|
break;
|
|
4216
|
+
case "ImportNamespaceSpecifier":
|
|
4217
|
+
case "ExportNamespaceSpecifier":
|
|
4218
|
+
adjustInnerComments(node, node.exportsFilter ?? [], commentWS);
|
|
4219
|
+
break;
|
|
4197
4220
|
case "TSEnumBody":
|
|
4198
4221
|
adjustInnerComments(node, node.members, commentWS);
|
|
4199
4222
|
break;
|
|
@@ -4217,6 +4240,12 @@ var CommentsParser = class extends BaseParser {
|
|
|
4217
4240
|
const commentWS = commentStack[length - 1];
|
|
4218
4241
|
if (commentWS.leadingNode === node) commentWS.leadingNode = null;
|
|
4219
4242
|
}
|
|
4243
|
+
replaceNodeInPendingComments(oldNode, newNode) {
|
|
4244
|
+
for (const commentWS of this.state.commentStack) {
|
|
4245
|
+
if (commentWS.leadingNode === oldNode) commentWS.leadingNode = newNode;
|
|
4246
|
+
if (commentWS.trailingNode === oldNode) commentWS.trailingNode = newNode;
|
|
4247
|
+
}
|
|
4248
|
+
}
|
|
4220
4249
|
takeSurroundingComments(node, start, end) {
|
|
4221
4250
|
const { commentStack } = this.state;
|
|
4222
4251
|
const commentStackLength = commentStack.length;
|
|
@@ -4255,6 +4284,7 @@ var State = class State {
|
|
|
4255
4284
|
errors = [];
|
|
4256
4285
|
noArrowAt = [];
|
|
4257
4286
|
noArrowParamsConversionAt = [];
|
|
4287
|
+
regExpAllowedAt = -1;
|
|
4258
4288
|
get canStartArrow() {
|
|
4259
4289
|
return (this.flags & 2) > 0;
|
|
4260
4290
|
}
|
|
@@ -4329,7 +4359,7 @@ var State = class State {
|
|
|
4329
4359
|
commentsLen = 0;
|
|
4330
4360
|
commentStack = [];
|
|
4331
4361
|
pos = 0;
|
|
4332
|
-
type =
|
|
4362
|
+
type = 138;
|
|
4333
4363
|
value = null;
|
|
4334
4364
|
start = 0;
|
|
4335
4365
|
end = 0;
|
|
@@ -4374,6 +4404,7 @@ var State = class State {
|
|
|
4374
4404
|
state.errors = this.errors.slice();
|
|
4375
4405
|
state.noArrowAt = this.noArrowAt.slice();
|
|
4376
4406
|
state.noArrowParamsConversionAt = this.noArrowParamsConversionAt.slice();
|
|
4407
|
+
state.regExpAllowedAt = this.regExpAllowedAt;
|
|
4377
4408
|
state.labels = this.labels.slice();
|
|
4378
4409
|
state.commentsLen = this.commentsLen;
|
|
4379
4410
|
state.commentStack = this.commentStack.slice();
|
|
@@ -4403,7 +4434,9 @@ const forbiddenNumericSeparatorSiblings$1 = {
|
|
|
4403
4434
|
95,
|
|
4404
4435
|
98,
|
|
4405
4436
|
101,
|
|
4406
|
-
111
|
|
4437
|
+
111,
|
|
4438
|
+
43,
|
|
4439
|
+
45
|
|
4407
4440
|
]),
|
|
4408
4441
|
hex: /* @__PURE__ */ new Set([
|
|
4409
4442
|
46,
|
|
@@ -4561,7 +4594,7 @@ function readInt$1(input, pos, lineStart, curLine, radix, len, forceLen, allowNu
|
|
|
4561
4594
|
pos
|
|
4562
4595
|
};
|
|
4563
4596
|
errors.numericSeparatorInEscapeSequence(pos, lineStart, curLine);
|
|
4564
|
-
} else if (Number.isNaN(next) || !isAllowedSibling(next) || forbiddenSiblings.has(prev)
|
|
4597
|
+
} else if (Number.isNaN(next) || !isAllowedSibling(next) || forbiddenSiblings.has(prev)) {
|
|
4565
4598
|
if (bailOnError) return {
|
|
4566
4599
|
n: null,
|
|
4567
4600
|
pos
|
|
@@ -4697,6 +4730,7 @@ var Tokenizer = class extends CommentsParser {
|
|
|
4697
4730
|
end: state.end,
|
|
4698
4731
|
context: [this.curContext()],
|
|
4699
4732
|
inType: state.inType,
|
|
4733
|
+
strict: state.strict,
|
|
4700
4734
|
startLoc: state.startLoc,
|
|
4701
4735
|
lastTokEndLoc: state.lastTokEndLoc,
|
|
4702
4736
|
curLine: state.curLine,
|
|
@@ -4718,8 +4752,9 @@ var Tokenizer = class extends CommentsParser {
|
|
|
4718
4752
|
return this.nextTokenStartSince(this.state.pos);
|
|
4719
4753
|
}
|
|
4720
4754
|
nextTokenStartSince(pos) {
|
|
4721
|
-
|
|
4722
|
-
|
|
4755
|
+
const skipWhiteSpaceRe = this.inModule || !(this.optionFlags & 16384) ? skipWhiteSpace : skipWhiteSpaceAnnexB;
|
|
4756
|
+
skipWhiteSpaceRe.lastIndex = pos;
|
|
4757
|
+
return skipWhiteSpaceRe.test(this.input) ? skipWhiteSpaceRe.lastIndex : pos;
|
|
4723
4758
|
}
|
|
4724
4759
|
lookaheadCharCode() {
|
|
4725
4760
|
return this.lookaheadCharCodeSince(this.state.pos);
|
|
@@ -4760,7 +4795,7 @@ var Tokenizer = class extends CommentsParser {
|
|
|
4760
4795
|
this.state.start = this.state.pos;
|
|
4761
4796
|
if (!this.isLookahead) this.state.startLoc = this.state.curPosition();
|
|
4762
4797
|
if (this.state.pos >= this.length) {
|
|
4763
|
-
this.finishToken(
|
|
4798
|
+
this.finishToken(138);
|
|
4764
4799
|
return;
|
|
4765
4800
|
}
|
|
4766
4801
|
this.getTokenFromCode(this.codePointAtPos(this.state.pos));
|
|
@@ -4901,10 +4936,10 @@ var Tokenizer = class extends CommentsParser {
|
|
|
4901
4936
|
if (next >= 48 && next <= 57) throw this.raise(Errors.UnexpectedDigitAfterHash, this.state.curPosition());
|
|
4902
4937
|
if (isIdentifierStart$1(next)) {
|
|
4903
4938
|
++this.state.pos;
|
|
4904
|
-
this.finishToken(
|
|
4939
|
+
this.finishToken(137, this.readWord1(next));
|
|
4905
4940
|
} else if (next === 92) {
|
|
4906
4941
|
++this.state.pos;
|
|
4907
|
-
this.finishToken(
|
|
4942
|
+
this.finishToken(137, this.readWord1());
|
|
4908
4943
|
} else this.finishOp(23, 1);
|
|
4909
4944
|
}
|
|
4910
4945
|
readToken_dot() {
|
|
@@ -5228,7 +5263,7 @@ var Tokenizer = class extends CommentsParser {
|
|
|
5228
5263
|
mods += char;
|
|
5229
5264
|
}
|
|
5230
5265
|
this.state.pos = pos;
|
|
5231
|
-
this.finishToken(
|
|
5266
|
+
this.finishToken(136, {
|
|
5232
5267
|
pattern: content,
|
|
5233
5268
|
flags: mods
|
|
5234
5269
|
});
|
|
@@ -5238,32 +5273,54 @@ var Tokenizer = class extends CommentsParser {
|
|
|
5238
5273
|
this.state.pos = pos;
|
|
5239
5274
|
return n;
|
|
5240
5275
|
}
|
|
5276
|
+
readLiteralInt(radix) {
|
|
5277
|
+
let pos = this.state.pos;
|
|
5278
|
+
let val = 0;
|
|
5279
|
+
let code;
|
|
5280
|
+
for (;;) {
|
|
5281
|
+
code = this.input.charCodeAt(pos);
|
|
5282
|
+
let digit;
|
|
5283
|
+
if (code >= 48 && code <= 57) digit = code - 48;
|
|
5284
|
+
else {
|
|
5285
|
+
digit = (code | 32) - 97;
|
|
5286
|
+
if (digit < 0 || digit > 5) break;
|
|
5287
|
+
digit += 10;
|
|
5288
|
+
}
|
|
5289
|
+
if (digit >= radix) break;
|
|
5290
|
+
val = val * radix + digit;
|
|
5291
|
+
++pos;
|
|
5292
|
+
}
|
|
5293
|
+
if (code === 95 || code >= 48 && code <= 57) return this.readInt(radix);
|
|
5294
|
+
if (pos === this.state.pos) return null;
|
|
5295
|
+
this.state.pos = pos;
|
|
5296
|
+
return val;
|
|
5297
|
+
}
|
|
5241
5298
|
readRadixNumber(radix) {
|
|
5242
5299
|
const start = this.state.pos;
|
|
5243
5300
|
const startLoc = this.state.curPosition();
|
|
5244
|
-
let isBigInt = false;
|
|
5245
5301
|
this.state.pos += 2;
|
|
5246
|
-
|
|
5302
|
+
let val = this.readLiteralInt(radix);
|
|
5303
|
+
const end = this.state.pos;
|
|
5247
5304
|
if (val == null) this.raise(Errors.InvalidDigit, createPositionWithColumnOffset(startLoc, 2), { radix });
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
isBigInt = true;
|
|
5251
|
-
}
|
|
5305
|
+
const isBigInt = this.input.charCodeAt(this.state.pos) === 110;
|
|
5306
|
+
if (isBigInt) ++this.state.pos;
|
|
5252
5307
|
if (isIdentifierStart$1(this.codePointAtPos(this.state.pos))) throw this.raise(Errors.NumberIdentifier, this.state.curPosition());
|
|
5253
|
-
if (isBigInt) {
|
|
5254
|
-
const str = this.input.slice(start,
|
|
5255
|
-
|
|
5256
|
-
|
|
5308
|
+
if (isBigInt || val !== null && val > Number.MAX_SAFE_INTEGER) {
|
|
5309
|
+
const str = this.input.slice(start, end).replaceAll("_", "");
|
|
5310
|
+
if (isBigInt) {
|
|
5311
|
+
this.finishToken(135, str);
|
|
5312
|
+
return;
|
|
5313
|
+
}
|
|
5314
|
+
val = Number(radix !== 16 && this.optionFlags & 4096 ? str.replace(radix === 2 ? /[2-9]/g : /[89]/g, "0") : str);
|
|
5257
5315
|
}
|
|
5258
|
-
this.finishToken(
|
|
5316
|
+
this.finishToken(134, val);
|
|
5259
5317
|
}
|
|
5260
5318
|
readNumber(startsWithDot) {
|
|
5261
5319
|
const start = this.state.pos;
|
|
5262
5320
|
const startLoc = this.state.curPosition();
|
|
5263
5321
|
let isFloat = false;
|
|
5264
|
-
let isBigInt = false;
|
|
5265
5322
|
let isOctal = false;
|
|
5266
|
-
|
|
5323
|
+
const integerValue = startsWithDot ? 0 : this.readLiteralInt(10);
|
|
5267
5324
|
const hasLeadingZero = this.state.pos - start >= 2 && this.input.charCodeAt(start) === 48;
|
|
5268
5325
|
if (hasLeadingZero) {
|
|
5269
5326
|
const integer = this.input.slice(start, this.state.pos);
|
|
@@ -5272,35 +5329,40 @@ var Tokenizer = class extends CommentsParser {
|
|
|
5272
5329
|
const underscorePos = integer.indexOf("_");
|
|
5273
5330
|
if (underscorePos > 0) this.raise(Errors.ZeroDigitNumericSeparator, createPositionWithColumnOffset(startLoc, underscorePos));
|
|
5274
5331
|
}
|
|
5275
|
-
isOctal =
|
|
5332
|
+
isOctal = !/[89]/.test(integer);
|
|
5276
5333
|
}
|
|
5277
5334
|
let next = this.input.charCodeAt(this.state.pos);
|
|
5278
5335
|
if (next === 46 && !isOctal) {
|
|
5279
5336
|
++this.state.pos;
|
|
5280
|
-
this.
|
|
5337
|
+
this.readLiteralInt(10);
|
|
5281
5338
|
isFloat = true;
|
|
5282
5339
|
next = this.input.charCodeAt(this.state.pos);
|
|
5283
5340
|
}
|
|
5284
5341
|
if ((next === 69 || next === 101) && !isOctal) {
|
|
5285
5342
|
next = this.input.charCodeAt(++this.state.pos);
|
|
5286
5343
|
if (next === 43 || next === 45) ++this.state.pos;
|
|
5287
|
-
if (this.
|
|
5344
|
+
if (this.readLiteralInt(10) === null) this.raise(Errors.InvalidOrMissingExponent, startLoc);
|
|
5288
5345
|
isFloat = true;
|
|
5289
5346
|
next = this.input.charCodeAt(this.state.pos);
|
|
5290
5347
|
}
|
|
5291
|
-
const
|
|
5292
|
-
|
|
5348
|
+
const end = this.state.pos;
|
|
5349
|
+
const isBigInt = next === 110;
|
|
5350
|
+
if (isBigInt) {
|
|
5293
5351
|
if (isFloat || hasLeadingZero) this.raise(Errors.InvalidBigIntLiteral, startLoc);
|
|
5294
5352
|
++this.state.pos;
|
|
5295
|
-
isBigInt = true;
|
|
5296
5353
|
}
|
|
5297
5354
|
if (isIdentifierStart$1(this.codePointAtPos(this.state.pos))) throw this.raise(Errors.NumberIdentifier, this.state.curPosition());
|
|
5355
|
+
if (!isFloat && !isBigInt && !hasLeadingZero && integerValue <= Number.MAX_SAFE_INTEGER) {
|
|
5356
|
+
this.finishToken(134, integerValue);
|
|
5357
|
+
return;
|
|
5358
|
+
}
|
|
5359
|
+
const str = this.input.slice(start, end).replaceAll("_", "");
|
|
5298
5360
|
if (isBigInt) {
|
|
5299
|
-
this.finishToken(
|
|
5361
|
+
this.finishToken(135, str);
|
|
5300
5362
|
return;
|
|
5301
5363
|
}
|
|
5302
5364
|
const val = isOctal ? parseInt(str, 8) : parseFloat(str);
|
|
5303
|
-
this.finishToken(
|
|
5365
|
+
this.finishToken(134, val);
|
|
5304
5366
|
}
|
|
5305
5367
|
readCodePoint(throwOnInvalid) {
|
|
5306
5368
|
const { code, pos } = readCodePoint$1(this.input, this.state.pos, this.state.lineStart, this.state.curLine, throwOnInvalid, this.errorHandlers_readCodePoint);
|
|
@@ -5312,7 +5374,7 @@ var Tokenizer = class extends CommentsParser {
|
|
|
5312
5374
|
this.state.pos = pos + 1;
|
|
5313
5375
|
this.state.lineStart = lineStart;
|
|
5314
5376
|
this.state.curLine = curLine;
|
|
5315
|
-
this.finishToken(
|
|
5377
|
+
this.finishToken(133, str);
|
|
5316
5378
|
}
|
|
5317
5379
|
readTemplateContinuation() {
|
|
5318
5380
|
if (!this.match(4)) this.unexpected(null, 4);
|
|
@@ -5333,6 +5395,7 @@ var Tokenizer = class extends CommentsParser {
|
|
|
5333
5395
|
}
|
|
5334
5396
|
}
|
|
5335
5397
|
recordStrictModeErrors(toParseError, at) {
|
|
5398
|
+
if (this.isLookahead) return;
|
|
5336
5399
|
const index = at.index;
|
|
5337
5400
|
if (this.state.strict && !this.state.strictErrors.has(index)) this.raise(toParseError, at);
|
|
5338
5401
|
else this.state.strictErrors.set(index, [toParseError, at]);
|
|
@@ -5371,7 +5434,7 @@ var Tokenizer = class extends CommentsParser {
|
|
|
5371
5434
|
const word = this.readWord1(firstCode);
|
|
5372
5435
|
const type = keywords$1.get(word);
|
|
5373
5436
|
if (type !== void 0) this.finishToken(type, tokenLabelName(type));
|
|
5374
|
-
else this.finishToken(
|
|
5437
|
+
else this.finishToken(131, word);
|
|
5375
5438
|
}
|
|
5376
5439
|
checkKeywordEscapes() {
|
|
5377
5440
|
const { type } = this.state;
|
|
@@ -5497,6 +5560,9 @@ var ExpressionScope = class {
|
|
|
5497
5560
|
isCertainlyParameterDeclaration() {
|
|
5498
5561
|
return this.type === 3;
|
|
5499
5562
|
}
|
|
5563
|
+
isInitializer() {
|
|
5564
|
+
return this.type === 4;
|
|
5565
|
+
}
|
|
5500
5566
|
};
|
|
5501
5567
|
var ArrowHeadParsingScope = class extends ExpressionScope {
|
|
5502
5568
|
declarationErrors = /* @__PURE__ */ new Map();
|
|
@@ -5525,13 +5591,17 @@ var ExpressionScopeHandler = class {
|
|
|
5525
5591
|
exit() {
|
|
5526
5592
|
this.stack.pop();
|
|
5527
5593
|
}
|
|
5594
|
+
canBeInParameters() {
|
|
5595
|
+
const scope = this.stack[this.stack.length - 1];
|
|
5596
|
+
return scope.canBeArrowParameterDeclaration() || scope.isCertainlyParameterDeclaration();
|
|
5597
|
+
}
|
|
5528
5598
|
recordParameterInitializerError(toParseError, loc) {
|
|
5529
5599
|
const { stack } = this;
|
|
5530
5600
|
let i = stack.length - 1;
|
|
5531
5601
|
let scope = stack[i];
|
|
5532
5602
|
while (!scope.isCertainlyParameterDeclaration()) {
|
|
5533
5603
|
if (scope.canBeArrowParameterDeclaration()) scope.recordDeclarationError(toParseError, loc);
|
|
5534
|
-
else return;
|
|
5604
|
+
else if (!scope.isInitializer()) return;
|
|
5535
5605
|
scope = stack[--i];
|
|
5536
5606
|
}
|
|
5537
5607
|
this.parser.raise(toParseError, loc);
|
|
@@ -5546,11 +5616,11 @@ var ExpressionScopeHandler = class {
|
|
|
5546
5616
|
}
|
|
5547
5617
|
recordAsyncArrowParametersError(at) {
|
|
5548
5618
|
const { stack } = this;
|
|
5549
|
-
let i = stack.length - 1
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
scope
|
|
5619
|
+
for (let i = stack.length - 1;; i--) {
|
|
5620
|
+
const scope = stack[i];
|
|
5621
|
+
if (scope.canBeArrowParameterDeclaration()) {
|
|
5622
|
+
if (scope.type === 2) scope.recordDeclarationError(Errors.AwaitBindingIdentifier, at);
|
|
5623
|
+
} else if (!scope.isInitializer()) return;
|
|
5554
5624
|
}
|
|
5555
5625
|
}
|
|
5556
5626
|
validateAsPattern() {
|
|
@@ -5559,27 +5629,23 @@ var ExpressionScopeHandler = class {
|
|
|
5559
5629
|
if (!currentScope.canBeArrowParameterDeclaration()) return;
|
|
5560
5630
|
currentScope.iterateErrors((toParseError, key) => {
|
|
5561
5631
|
this.parser.raise(toParseError, key);
|
|
5562
|
-
let i = stack.length - 2
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
scope.
|
|
5566
|
-
scope = stack[--i];
|
|
5632
|
+
for (let i = stack.length - 2;; i--) {
|
|
5633
|
+
const scope = stack[i];
|
|
5634
|
+
if (scope.canBeArrowParameterDeclaration()) scope.clearDeclarationError(key);
|
|
5635
|
+
else if (!scope.isInitializer()) break;
|
|
5567
5636
|
}
|
|
5568
5637
|
});
|
|
5569
5638
|
}
|
|
5570
5639
|
};
|
|
5571
|
-
function newParameterDeclarationScope() {
|
|
5572
|
-
return new ExpressionScope(3);
|
|
5573
|
-
}
|
|
5574
5640
|
function newArrowHeadScope() {
|
|
5575
5641
|
return new ArrowHeadParsingScope(1);
|
|
5576
5642
|
}
|
|
5577
5643
|
function newAsyncArrowScope() {
|
|
5578
5644
|
return new ArrowHeadParsingScope(2);
|
|
5579
5645
|
}
|
|
5580
|
-
|
|
5581
|
-
|
|
5582
|
-
|
|
5646
|
+
const sharedExpressionScope = new ExpressionScope();
|
|
5647
|
+
const parameterDeclarationScope = new ExpressionScope(3);
|
|
5648
|
+
const initializerScope = new ExpressionScope(4);
|
|
5583
5649
|
var ProductionParameterHandler = class {
|
|
5584
5650
|
stacks = [];
|
|
5585
5651
|
enter(flags) {
|
|
@@ -5630,7 +5696,7 @@ var UtilParser = class extends Tokenizer {
|
|
|
5630
5696
|
isUnparsedContextual(nameStart, name) {
|
|
5631
5697
|
if (this.input.startsWith(name, nameStart)) {
|
|
5632
5698
|
const nextCh = this.input.charCodeAt(nameStart + name.length);
|
|
5633
|
-
return !(isIdentifierChar$1(nextCh) || (nextCh & 64512) === 55296);
|
|
5699
|
+
return !(isIdentifierChar$1(nextCh) || nextCh === 92 || (nextCh & 64512) === 55296);
|
|
5634
5700
|
}
|
|
5635
5701
|
return false;
|
|
5636
5702
|
}
|
|
@@ -5652,7 +5718,7 @@ var UtilParser = class extends Tokenizer {
|
|
|
5652
5718
|
}
|
|
5653
5719
|
}
|
|
5654
5720
|
canInsertSemicolon() {
|
|
5655
|
-
return this.match(
|
|
5721
|
+
return this.match(138) || this.match(4) || this.hasPrecedingLineBreak();
|
|
5656
5722
|
}
|
|
5657
5723
|
hasPrecedingLineBreak() {
|
|
5658
5724
|
return hasNewLine(this.input, this.offsetToSourcePos(this.state.lastTokEndLoc.index), this.state.start);
|
|
@@ -5670,8 +5736,24 @@ var UtilParser = class extends Tokenizer {
|
|
|
5670
5736
|
expect(type, loc) {
|
|
5671
5737
|
if (!this.eat(type)) this.unexpected(loc, type);
|
|
5672
5738
|
}
|
|
5739
|
+
snapshotScopeStacks() {
|
|
5740
|
+
return {
|
|
5741
|
+
scopeDepth: this.scope.scopeStack.length,
|
|
5742
|
+
prodParamDepth: this.prodParam.stacks.length,
|
|
5743
|
+
classScopeDepth: this.classScope.stack.length,
|
|
5744
|
+
expressionScopeDepth: this.expressionScope.stack.length
|
|
5745
|
+
};
|
|
5746
|
+
}
|
|
5747
|
+
restoreScopeStacks(snapshot) {
|
|
5748
|
+
const { scope } = this;
|
|
5749
|
+
while (scope.scopeStack.length > snapshot.scopeDepth) scope.exit();
|
|
5750
|
+
this.prodParam.stacks.length = snapshot.prodParamDepth;
|
|
5751
|
+
this.classScope.stack.length = snapshot.classScopeDepth;
|
|
5752
|
+
this.expressionScope.stack.length = snapshot.expressionScopeDepth;
|
|
5753
|
+
}
|
|
5673
5754
|
tryParse(fn, oldState = this.state.clone()) {
|
|
5674
5755
|
const abortSignal = { node: null };
|
|
5756
|
+
const scopeStacksSnapshot = this.snapshotScopeStacks();
|
|
5675
5757
|
try {
|
|
5676
5758
|
const node = fn((node = null) => {
|
|
5677
5759
|
abortSignal.node = node;
|
|
@@ -5699,6 +5781,7 @@ var UtilParser = class extends Tokenizer {
|
|
|
5699
5781
|
} catch (error) {
|
|
5700
5782
|
const failState = this.state;
|
|
5701
5783
|
this.state = oldState;
|
|
5784
|
+
this.restoreScopeStacks(scopeStacksSnapshot);
|
|
5702
5785
|
if (error instanceof SyntaxError) return {
|
|
5703
5786
|
node: null,
|
|
5704
5787
|
error,
|
|
@@ -5811,11 +5894,10 @@ var NodeUtils = class extends UtilParser {
|
|
|
5811
5894
|
return loc;
|
|
5812
5895
|
}
|
|
5813
5896
|
startNode() {
|
|
5814
|
-
|
|
5815
|
-
this.setLoc(startLoc);
|
|
5816
|
-
return this.startNodeAt(startLoc);
|
|
5897
|
+
return this.startNodeAt(this.state.startLoc);
|
|
5817
5898
|
}
|
|
5818
5899
|
startNodeAt(loc) {
|
|
5900
|
+
this.setLoc(loc);
|
|
5819
5901
|
const { optionFlags, filename } = this;
|
|
5820
5902
|
if (!(optionFlags & 256)) return new Node(optionFlags, filename, loc.index);
|
|
5821
5903
|
return new Node(optionFlags, filename, loc.index, this.createPosition(loc));
|
|
@@ -5903,14 +5985,24 @@ const unwrapParenthesizedExpression = (node) => {
|
|
|
5903
5985
|
return node.type === "ParenthesizedExpression" ? unwrapParenthesizedExpression(node.expression) : node;
|
|
5904
5986
|
};
|
|
5905
5987
|
var LValParser = class extends NodeUtils {
|
|
5988
|
+
raiseOnce(toParseError, node) {
|
|
5989
|
+
const { errors } = this.state;
|
|
5990
|
+
const length = errors.length;
|
|
5991
|
+
const error = this.raise(toParseError, node);
|
|
5992
|
+
if (errors.length === length) return;
|
|
5993
|
+
for (let i = length - 1; i >= 0; i--) if (errors[i].pos === error.pos && errors[i].reasonCode === error.reasonCode) {
|
|
5994
|
+
errors.pop();
|
|
5995
|
+
return;
|
|
5996
|
+
}
|
|
5997
|
+
}
|
|
5906
5998
|
toAssignable(node, isLHS = false) {
|
|
5907
5999
|
let parenthesized = void 0;
|
|
5908
6000
|
if (node.type === "ParenthesizedExpression" || node.extra?.parenthesized) {
|
|
5909
6001
|
parenthesized = unwrapParenthesizedExpression(node);
|
|
5910
6002
|
if (isLHS) {
|
|
5911
6003
|
if (parenthesized.type === "Identifier") this.expressionScope.recordArrowParameterBindingError(Errors.InvalidParenthesizedAssignment, node);
|
|
5912
|
-
else if (parenthesized.type !== "CallExpression" && parenthesized.type !== "MemberExpression" && !this.isOptionalMemberExpression(parenthesized)) this.
|
|
5913
|
-
} else this.
|
|
6004
|
+
else if (parenthesized.type !== "CallExpression" && parenthesized.type !== "MemberExpression" && !this.isOptionalMemberExpression(parenthesized)) this.raiseOnce(Errors.InvalidParenthesizedAssignment, node);
|
|
6005
|
+
} else this.raiseOnce(Errors.InvalidParenthesizedAssignment, node);
|
|
5914
6006
|
}
|
|
5915
6007
|
switch (node.type) {
|
|
5916
6008
|
case "Identifier":
|
|
@@ -6075,7 +6167,7 @@ var LValParser = class extends NodeUtils {
|
|
|
6075
6167
|
const { type, startLoc } = this.state;
|
|
6076
6168
|
if (type === 17) return this.parseBindingRestProperty(this.startNode());
|
|
6077
6169
|
const prop = this.startNode();
|
|
6078
|
-
if (type ===
|
|
6170
|
+
if (type === 137) {
|
|
6079
6171
|
this.expectPlugin("destructuringPrivate", startLoc);
|
|
6080
6172
|
this.classScope.usePrivateName(this.state.value, startLoc);
|
|
6081
6173
|
prop.key = this.parsePrivateName();
|
|
@@ -6144,7 +6236,7 @@ var LValParser = class extends NodeUtils {
|
|
|
6144
6236
|
return;
|
|
6145
6237
|
} else if (type === "VoidPattern" && ancestor.type === "CatchClause") this.raise(Errors.VoidPatternCatchClauseParam, expression);
|
|
6146
6238
|
const unwrappedExpression = unwrapParenthesizedExpression(expression);
|
|
6147
|
-
disallowCallExpression ||= unwrappedExpression.type === "CallExpression" && (unwrappedExpression.callee.type === "Import" || unwrappedExpression.callee.type === "Super");
|
|
6239
|
+
disallowCallExpression ||= binding !== 64 || unwrappedExpression.type === "CallExpression" && (unwrappedExpression.callee.type === "Import" || unwrappedExpression.callee.type === "Super");
|
|
6148
6240
|
const validity = this.isValidLVal(type, disallowCallExpression, !(hasParenthesizedAncestor || expression.extra?.parenthesized) && ancestor.type === "AssignmentExpression", binding);
|
|
6149
6241
|
if (validity === true) return;
|
|
6150
6242
|
if (validity === false) {
|
|
@@ -6164,12 +6256,15 @@ var LValParser = class extends NodeUtils {
|
|
|
6164
6256
|
} else if (val) this.checkLVal(val, nextAncestor, binding, checkClashes, strictModeChanged, isParenthesizedExpression, disallowCallExpression);
|
|
6165
6257
|
}
|
|
6166
6258
|
checkIdentifier(at, bindingType, strictModeChanged = false) {
|
|
6259
|
+
this.checkStrictBindReservedWord(at, bindingType, strictModeChanged);
|
|
6260
|
+
if (bindingType & 8192 && at.name === "let") this.raise(Errors.LetInLexicalBinding, at);
|
|
6261
|
+
if (!(bindingType & 64)) this.declareNameFromIdentifier(at, bindingType);
|
|
6262
|
+
}
|
|
6263
|
+
checkStrictBindReservedWord(at, bindingType, strictModeChanged = false) {
|
|
6167
6264
|
if (this.state.strict && (strictModeChanged ? isStrictBindReservedWord(at.name, this.inModule) : isStrictBindOnlyReservedWord(at.name))) {
|
|
6168
6265
|
if (bindingType === 64) this.raise(Errors.StrictEvalArguments, at, { referenceName: at.name });
|
|
6169
6266
|
else this.raise(Errors.StrictEvalArgumentsBinding, at, { bindingName: at.name });
|
|
6170
6267
|
}
|
|
6171
|
-
if (bindingType & 8192 && at.name === "let") this.raise(Errors.LetInLexicalBinding, at);
|
|
6172
|
-
if (!(bindingType & 64)) this.declareNameFromIdentifier(at, bindingType);
|
|
6173
6268
|
}
|
|
6174
6269
|
declareNameFromIdentifier(identifier, binding) {
|
|
6175
6270
|
this.scope.declareName(identifier.name, binding, identifier.start);
|
|
@@ -6212,9 +6307,9 @@ var ExpressionParser = class extends LValParser {
|
|
|
6212
6307
|
getExpression() {
|
|
6213
6308
|
this.enterInitialScopes();
|
|
6214
6309
|
this.nextToken();
|
|
6215
|
-
if (this.match(
|
|
6310
|
+
if (this.match(138)) throw this.raise(Errors.ParseExpressionEmptyInput, this.state.startLoc);
|
|
6216
6311
|
const expr = this.parseExpression();
|
|
6217
|
-
if (!this.match(
|
|
6312
|
+
if (!this.match(138)) throw this.raise(Errors.ParseExpressionExpectsEOF, this.state.startLoc, { unexpected: this.input.codePointAt(this.state.start) });
|
|
6218
6313
|
this.finalizeRemainingComments();
|
|
6219
6314
|
expr.comments = this.comments;
|
|
6220
6315
|
expr.errors = this.state.errors;
|
|
@@ -6248,7 +6343,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
6248
6343
|
}
|
|
6249
6344
|
parseMaybeAssign(refExpressionErrors, isParenItem) {
|
|
6250
6345
|
const startLoc = this.state.startLoc;
|
|
6251
|
-
const isYield = this.isContextual(
|
|
6346
|
+
const isYield = this.isContextual(107);
|
|
6252
6347
|
if (isYield) {
|
|
6253
6348
|
if (this.prodParam.hasYield) {
|
|
6254
6349
|
this.next();
|
|
@@ -6258,15 +6353,20 @@ var ExpressionParser = class extends LValParser {
|
|
|
6258
6353
|
}
|
|
6259
6354
|
}
|
|
6260
6355
|
let ownExpressionErrors;
|
|
6356
|
+
let inInitializerScope = false;
|
|
6261
6357
|
if (refExpressionErrors) ownExpressionErrors = false;
|
|
6262
6358
|
else {
|
|
6263
6359
|
refExpressionErrors = new ExpressionErrors();
|
|
6264
6360
|
ownExpressionErrors = true;
|
|
6361
|
+
if (this.expressionScope.canBeInParameters()) {
|
|
6362
|
+
this.expressionScope.enter(initializerScope);
|
|
6363
|
+
inInitializerScope = true;
|
|
6364
|
+
}
|
|
6265
6365
|
}
|
|
6266
6366
|
this.state.canStartArrow = true;
|
|
6267
6367
|
let left = this.parseMaybeConditional(refExpressionErrors);
|
|
6268
6368
|
if (isParenItem) left = this.parseParenItem(left, startLoc);
|
|
6269
|
-
if (tokenIsAssignment(this.state.type)) {
|
|
6369
|
+
if (tokenIsAssignment(this.state.type) && !(this.match(27) && this.state.lastTokEndLoc.index === this.state.regExpAllowedAt)) {
|
|
6270
6370
|
const node = this.startNodeAt(startLoc);
|
|
6271
6371
|
const operator = this.state.value;
|
|
6272
6372
|
node.operator = operator;
|
|
@@ -6284,9 +6384,13 @@ var ExpressionParser = class extends LValParser {
|
|
|
6284
6384
|
} else node.left = left;
|
|
6285
6385
|
this.next();
|
|
6286
6386
|
node.right = this.parseMaybeAssign();
|
|
6387
|
+
if (inInitializerScope) this.expressionScope.exit();
|
|
6287
6388
|
this.checkLVal(left, this.finishNode(node, "AssignmentExpression"), void 0, void 0, void 0, void 0, operator === "||=" || operator === "&&=" || operator === "??=");
|
|
6288
6389
|
return node;
|
|
6289
|
-
} else if (ownExpressionErrors)
|
|
6390
|
+
} else if (ownExpressionErrors) {
|
|
6391
|
+
this.checkExpressionErrors(refExpressionErrors, true);
|
|
6392
|
+
if (inInitializerScope) this.expressionScope.exit();
|
|
6393
|
+
}
|
|
6290
6394
|
if (isYield) {
|
|
6291
6395
|
const { type } = this.state;
|
|
6292
6396
|
if ((this.hasPlugin("v8intrinsic") ? tokenCanStartExpression(type) : tokenCanStartExpression(type) && !this.match(50)) && !this.isAmbiguousPrefixOrIdentifier()) {
|
|
@@ -6314,7 +6418,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
6314
6418
|
return expr;
|
|
6315
6419
|
}
|
|
6316
6420
|
parseMaybeUnaryOrPrivate(refExpressionErrors) {
|
|
6317
|
-
return this.match(
|
|
6421
|
+
return this.match(137) ? this.parsePrivateName() : this.parseMaybeUnary(refExpressionErrors);
|
|
6318
6422
|
}
|
|
6319
6423
|
parseExprOps(refExpressionErrors) {
|
|
6320
6424
|
const startLoc = this.state.startLoc;
|
|
@@ -6323,14 +6427,21 @@ var ExpressionParser = class extends LValParser {
|
|
|
6323
6427
|
this.state.canStartArrow = false;
|
|
6324
6428
|
return this.parseExprOp(expr, startLoc, -1);
|
|
6325
6429
|
}
|
|
6430
|
+
isEscapedKeywordOperatorAfterLineBreak() {
|
|
6431
|
+
return tokenIsKeyword(this.state.type) && this.state.containsEsc && this.hasPrecedingLineBreak();
|
|
6432
|
+
}
|
|
6433
|
+
isBinaryOperator(op) {
|
|
6434
|
+
return tokenIsOperator(op) && (this.prodParam.hasIn || op !== 54) && !this.isEscapedKeywordOperatorAfterLineBreak();
|
|
6435
|
+
}
|
|
6326
6436
|
parseExprOp(left, leftStartLoc, minPrec) {
|
|
6437
|
+
const op = this.state.type;
|
|
6438
|
+
const isOperator = this.isBinaryOperator(op);
|
|
6327
6439
|
if (this.isPrivateName(left)) {
|
|
6328
6440
|
const value = this.getPrivateNameSV(left);
|
|
6329
|
-
if (minPrec >= tokenOperatorPrecedence(54) ||
|
|
6441
|
+
if (minPrec >= tokenOperatorPrecedence(54) || op !== 54 || !isOperator) this.raise(Errors.PrivateInExpectedIn, leftStartLoc, { identifierName: value });
|
|
6330
6442
|
this.classScope.usePrivateName(value, leftStartLoc);
|
|
6331
6443
|
}
|
|
6332
|
-
|
|
6333
|
-
if (tokenIsOperator(op) && (this.prodParam.hasIn || !this.match(54))) {
|
|
6444
|
+
if (isOperator) {
|
|
6334
6445
|
let prec = tokenOperatorPrecedence(op);
|
|
6335
6446
|
if (prec > minPrec) {
|
|
6336
6447
|
if (op === 35) {
|
|
@@ -6380,7 +6491,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
6380
6491
|
}
|
|
6381
6492
|
parseMaybeUnary(refExpressionErrors, sawUnary) {
|
|
6382
6493
|
const startLoc = this.state.startLoc;
|
|
6383
|
-
const isAwait = this.isContextual(
|
|
6494
|
+
const isAwait = this.isContextual(93);
|
|
6384
6495
|
if (isAwait && this.recordAwaitIfAllowed()) {
|
|
6385
6496
|
this.next();
|
|
6386
6497
|
const expr = this.parseAwait(startLoc);
|
|
@@ -6399,7 +6510,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
6399
6510
|
node.argument = this.parseMaybeUnary(null, true);
|
|
6400
6511
|
this.checkExpressionErrors(refExpressionErrors, true);
|
|
6401
6512
|
if (this.state.strict && isDelete) {
|
|
6402
|
-
const arg = node.argument;
|
|
6513
|
+
const arg = unwrapParenthesizedExpression(node.argument);
|
|
6403
6514
|
if (arg.type === "Identifier") this.raise(Errors.StrictDelete, node);
|
|
6404
6515
|
else if (this.hasPropertyAsPrivateName(arg)) this.raise(Errors.DeletePrivateField, node);
|
|
6405
6516
|
}
|
|
@@ -6439,7 +6550,20 @@ var ExpressionParser = class extends LValParser {
|
|
|
6439
6550
|
}
|
|
6440
6551
|
parseExprSubscripts(refExpressionErrors) {
|
|
6441
6552
|
const startLoc = this.state.startLoc;
|
|
6442
|
-
this.
|
|
6553
|
+
if (refExpressionErrors != null && (this.match(2) || this.match(0))) {
|
|
6554
|
+
const atomExpressionErrors = new ExpressionErrors();
|
|
6555
|
+
const expr = this.parseExprAtom(atomExpressionErrors);
|
|
6556
|
+
const result = this.parseSubscripts(expr, startLoc);
|
|
6557
|
+
if (result !== expr) this.checkExpressionErrors(atomExpressionErrors, true);
|
|
6558
|
+
else {
|
|
6559
|
+
refExpressionErrors.shorthandAssignLoc ??= atomExpressionErrors.shorthandAssignLoc;
|
|
6560
|
+
refExpressionErrors.doubleProtoLoc ??= atomExpressionErrors.doubleProtoLoc;
|
|
6561
|
+
refExpressionErrors.privateKeyLoc ??= atomExpressionErrors.privateKeyLoc;
|
|
6562
|
+
refExpressionErrors.optionalParametersLoc ??= atomExpressionErrors.optionalParametersLoc;
|
|
6563
|
+
refExpressionErrors.voidPatternLoc ??= atomExpressionErrors.voidPatternLoc;
|
|
6564
|
+
}
|
|
6565
|
+
return result;
|
|
6566
|
+
}
|
|
6443
6567
|
const expr = this.parseExprAtom(refExpressionErrors);
|
|
6444
6568
|
if (this.shouldExitDescending(expr)) return expr;
|
|
6445
6569
|
return this.parseSubscripts(expr, startLoc);
|
|
@@ -6487,7 +6611,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
6487
6611
|
if (computed) {
|
|
6488
6612
|
node.property = this.parseExpression();
|
|
6489
6613
|
this.expect(1);
|
|
6490
|
-
} else if (this.match(
|
|
6614
|
+
} else if (this.match(137)) {
|
|
6491
6615
|
if (base.type === "Super") this.raise(Errors.SuperPrivateField, startLoc);
|
|
6492
6616
|
this.classScope.usePrivateName(this.state.value, this.state.startLoc);
|
|
6493
6617
|
node.property = this.parsePrivateName();
|
|
@@ -6586,6 +6710,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
6586
6710
|
parseNoCallExpr(onUnparenthesizedImportExpression) {
|
|
6587
6711
|
const startLoc = this.state.startLoc;
|
|
6588
6712
|
const isImport = this.match(79);
|
|
6713
|
+
this.state.canStartArrow = false;
|
|
6589
6714
|
const base = this.parseExprAtom();
|
|
6590
6715
|
if (isImport && base.type === "ImportExpression") onUnparenthesizedImportExpression(base);
|
|
6591
6716
|
return this.parseSubscripts(base, startLoc, true);
|
|
@@ -6599,7 +6724,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
6599
6724
|
case 79:
|
|
6600
6725
|
node = this.startNode();
|
|
6601
6726
|
this.next();
|
|
6602
|
-
if (this.match(12)) return this.
|
|
6727
|
+
if (this.match(12)) return this.parseImportMetaPropertyOrPhaseCallOrSyncCall(node);
|
|
6603
6728
|
if (this.match(6)) {
|
|
6604
6729
|
if (this.optionFlags & 1024) return this.parseImportCall(node);
|
|
6605
6730
|
else return this.finishNode(node, "Import");
|
|
@@ -6616,9 +6741,9 @@ var ExpressionParser = class extends LValParser {
|
|
|
6616
6741
|
case 27:
|
|
6617
6742
|
this.readRegexp();
|
|
6618
6743
|
return this.parseRegExpLiteral(this.state.value);
|
|
6619
|
-
case
|
|
6620
|
-
case
|
|
6621
|
-
case
|
|
6744
|
+
case 134: return this.parseNumericLiteral(this.state.value);
|
|
6745
|
+
case 135: return this.parseBigIntLiteral(this.state.value);
|
|
6746
|
+
case 133: return this.parseStringLiteral(this.state.value);
|
|
6622
6747
|
case 80: return this.parseNullLiteral();
|
|
6623
6748
|
case 81: return this.parseBooleanLiteral(true);
|
|
6624
6749
|
case 82: return this.parseBooleanLiteral(false);
|
|
@@ -6641,7 +6766,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
6641
6766
|
if (callee.type === "MemberExpression") return this.finishNode(node, "BindExpression");
|
|
6642
6767
|
else throw this.raise(Errors.UnsupportedBind, callee);
|
|
6643
6768
|
}
|
|
6644
|
-
case
|
|
6769
|
+
case 137:
|
|
6645
6770
|
this.raise(Errors.PrivateInExpectedIn, this.state.startLoc, { identifierName: this.state.value });
|
|
6646
6771
|
return this.parsePrivateName();
|
|
6647
6772
|
case 29: return this.parseTopicReferenceThenEqualsSign(50, "%");
|
|
@@ -6657,7 +6782,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
6657
6782
|
}
|
|
6658
6783
|
case 43: {
|
|
6659
6784
|
const lookaheadCh = this.input.codePointAt(this.nextTokenStart());
|
|
6660
|
-
if (isIdentifierStart$1(lookaheadCh) || lookaheadCh === 62)
|
|
6785
|
+
if (isIdentifierStart$1(lookaheadCh) || lookaheadCh === 62) this.expectOnePlugin([
|
|
6661
6786
|
"jsx",
|
|
6662
6787
|
"flow",
|
|
6663
6788
|
"typescript"
|
|
@@ -6665,7 +6790,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
6665
6790
|
throw this.unexpected();
|
|
6666
6791
|
}
|
|
6667
6792
|
default: if (tokenIsIdentifier(type)) {
|
|
6668
|
-
if (this.isContextual(
|
|
6793
|
+
if (this.isContextual(126) && this.lookaheadInLineCharCode() === 123) return this.parseModuleExpression();
|
|
6669
6794
|
const { canStartArrow, containsEsc } = this.state;
|
|
6670
6795
|
const id = this.parseIdentifier();
|
|
6671
6796
|
if (!containsEsc && id.name === "async" && !this.canInsertSemicolon()) {
|
|
@@ -6767,7 +6892,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
6767
6892
|
if (this.prodParam.hasYield && this.match(12)) {
|
|
6768
6893
|
const meta = this.createIdentifier(this.startNodeAtNode(node), "function");
|
|
6769
6894
|
this.next();
|
|
6770
|
-
if (this.match(
|
|
6895
|
+
if (this.match(100)) this.expectPlugin("functionSent");
|
|
6771
6896
|
else if (!this.hasPlugin("functionSent")) this.unexpected();
|
|
6772
6897
|
return this.parseMetaProperty(node, meta, "sent");
|
|
6773
6898
|
}
|
|
@@ -6783,17 +6908,22 @@ var ExpressionParser = class extends LValParser {
|
|
|
6783
6908
|
});
|
|
6784
6909
|
return this.finishNode(node, "MetaProperty");
|
|
6785
6910
|
}
|
|
6786
|
-
|
|
6911
|
+
parseImportMetaPropertyOrPhaseCallOrSyncCall(node) {
|
|
6787
6912
|
this.next();
|
|
6788
|
-
if (this.isContextual(
|
|
6789
|
-
const isSource = this.isContextual(
|
|
6913
|
+
if (this.isContextual(102) || this.isContextual(94)) {
|
|
6914
|
+
const isSource = this.isContextual(102);
|
|
6790
6915
|
this.expectPlugin(isSource ? "sourcePhaseImports" : "deferredImportEvaluation");
|
|
6791
6916
|
this.next();
|
|
6792
6917
|
node.phase = isSource ? "source" : "defer";
|
|
6793
6918
|
return this.parseImportCall(node);
|
|
6919
|
+
} else if (this.isContextual(105)) {
|
|
6920
|
+
this.expectPlugin("importSync");
|
|
6921
|
+
this.next();
|
|
6922
|
+
node.sync = true;
|
|
6923
|
+
return this.parseImportCall(node);
|
|
6794
6924
|
} else {
|
|
6795
6925
|
const id = this.createIdentifierAt(this.startNodeAtNode(node), "import", this.state.lastTokStartLoc);
|
|
6796
|
-
if (this.isContextual(
|
|
6926
|
+
if (this.isContextual(98)) {
|
|
6797
6927
|
if (!this.inModule) this.raise(Errors.ImportMetaOutsideModule, id);
|
|
6798
6928
|
this.sawUnambiguousESM = true;
|
|
6799
6929
|
}
|
|
@@ -7123,16 +7253,16 @@ var ExpressionParser = class extends LValParser {
|
|
|
7123
7253
|
let key;
|
|
7124
7254
|
if (tokenIsKeywordOrIdentifier(type)) key = this.parseIdentifier(true);
|
|
7125
7255
|
else switch (type) {
|
|
7126
|
-
case
|
|
7256
|
+
case 134:
|
|
7127
7257
|
key = this.parseNumericLiteral(value);
|
|
7128
7258
|
break;
|
|
7129
|
-
case
|
|
7259
|
+
case 133:
|
|
7130
7260
|
key = this.parseStringLiteral(value);
|
|
7131
7261
|
break;
|
|
7132
|
-
case
|
|
7262
|
+
case 135:
|
|
7133
7263
|
key = this.parseBigIntLiteral(value);
|
|
7134
7264
|
break;
|
|
7135
|
-
case
|
|
7265
|
+
case 137: {
|
|
7136
7266
|
const privateKeyLoc = this.state.startLoc;
|
|
7137
7267
|
if (refExpressionErrors != null) {
|
|
7138
7268
|
if (refExpressionErrors.privateKeyLoc === null) refExpressionErrors.privateKeyLoc = privateKeyLoc;
|
|
@@ -7143,7 +7273,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
7143
7273
|
default: throw this.unexpected();
|
|
7144
7274
|
}
|
|
7145
7275
|
prop.key = key;
|
|
7146
|
-
if (type !==
|
|
7276
|
+
if (type !== 137) prop.computed = false;
|
|
7147
7277
|
}
|
|
7148
7278
|
}
|
|
7149
7279
|
initFunction(node, isAsync) {
|
|
@@ -7171,11 +7301,13 @@ var ExpressionParser = class extends LValParser {
|
|
|
7171
7301
|
parseArrowExpression(node, params, isAsync, trailingCommaLoc) {
|
|
7172
7302
|
this.scope.enter(518);
|
|
7173
7303
|
let flags = functionFlags(isAsync, false);
|
|
7174
|
-
|
|
7304
|
+
const hasBlockBody = this.match(2);
|
|
7305
|
+
if (!hasBlockBody) flags |= this.prodParam.currentFlags() & 24;
|
|
7175
7306
|
this.prodParam.enter(flags);
|
|
7176
7307
|
this.initFunction(node, isAsync);
|
|
7177
7308
|
if (params) this.setArrowFunctionParameters(node, params, trailingCommaLoc);
|
|
7178
7309
|
this.parseFunctionBody(node, true);
|
|
7310
|
+
if (hasBlockBody) this.state.regExpAllowedAt = this.state.lastTokEndLoc.index;
|
|
7179
7311
|
this.prodParam.exit();
|
|
7180
7312
|
this.scope.exit();
|
|
7181
7313
|
return this.finishNode(node, "ArrowFunctionExpression");
|
|
@@ -7190,7 +7322,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
7190
7322
|
}
|
|
7191
7323
|
parseFunctionBody(node, allowExpression, isMethod = false) {
|
|
7192
7324
|
const isExpression = allowExpression && !this.match(2);
|
|
7193
|
-
this.expressionScope.enter(
|
|
7325
|
+
this.expressionScope.enter(sharedExpressionScope);
|
|
7194
7326
|
if (isExpression) {
|
|
7195
7327
|
node.body = this.parseMaybeAssign();
|
|
7196
7328
|
this.checkParams(node, false, allowExpression, false);
|
|
@@ -7204,7 +7336,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
7204
7336
|
if (hasStrictModeDirective && nonSimple) this.raise(Errors.IllegalLanguageModeDirective, (node.kind === "method" || node.kind === "constructor") && !!node.key ? this.optionFlags & 256 ? node.key.loc.end : node.key : node);
|
|
7205
7337
|
const strictModeChanged = !oldStrict && this.state.strict;
|
|
7206
7338
|
this.checkParams(node, !this.state.strict && !allowExpression && !isMethod && !nonSimple, allowExpression, strictModeChanged);
|
|
7207
|
-
if (
|
|
7339
|
+
if (node.id) this.checkStrictBindReservedWord(node.id, 65, strictModeChanged);
|
|
7208
7340
|
});
|
|
7209
7341
|
this.prodParam.exit();
|
|
7210
7342
|
this.state.labels = oldLabels;
|
|
@@ -7279,7 +7411,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
7279
7411
|
else this.unexpected();
|
|
7280
7412
|
const tokenIsKeyword = tokenKeywordOrIdentifierIsKeyword(type);
|
|
7281
7413
|
if (liberal) {
|
|
7282
|
-
if (tokenIsKeyword) this.replaceToken(
|
|
7414
|
+
if (tokenIsKeyword) this.replaceToken(131);
|
|
7283
7415
|
} else this.checkReservedWord(name, this.sourceToOffsetPos(start), tokenIsKeyword, false);
|
|
7284
7416
|
this.next();
|
|
7285
7417
|
return name;
|
|
@@ -7323,7 +7455,6 @@ var ExpressionParser = class extends LValParser {
|
|
|
7323
7455
|
}
|
|
7324
7456
|
parseAwait(startLoc, soloAwait) {
|
|
7325
7457
|
const startIndex = startLoc.index;
|
|
7326
|
-
this.setLoc(startLoc);
|
|
7327
7458
|
const node = this.startNodeAt(startLoc);
|
|
7328
7459
|
this.expressionScope.recordParameterInitializerError(Errors.AwaitExpressionFormalParameter, startIndex);
|
|
7329
7460
|
if (this.eat(51)) this.raise(Errors.ObsoleteAwaitStar, startLoc);
|
|
@@ -7331,16 +7462,18 @@ var ExpressionParser = class extends LValParser {
|
|
|
7331
7462
|
if (this.isAmbiguousPrefixOrIdentifier()) this.ambiguousScriptDifferentAst = true;
|
|
7332
7463
|
else this.sawUnambiguousESM = true;
|
|
7333
7464
|
}
|
|
7334
|
-
if (!soloAwait)
|
|
7465
|
+
if (!soloAwait) {
|
|
7466
|
+
this.state.canStartArrow = false;
|
|
7467
|
+
node.argument = this.parseMaybeUnary(null, true);
|
|
7468
|
+
}
|
|
7335
7469
|
return this.finishNode(node, "AwaitExpression");
|
|
7336
7470
|
}
|
|
7337
7471
|
isAmbiguousPrefixOrIdentifier() {
|
|
7338
7472
|
if (this.hasPrecedingLineBreak()) return true;
|
|
7339
7473
|
const { type } = this.state;
|
|
7340
|
-
return type === 49 || type === 6 || type === 0 || tokenIsTemplate(type) || type ===
|
|
7474
|
+
return type === 49 || type === 6 || type === 0 || tokenIsTemplate(type) || type === 99 && !this.state.containsEsc || type === 136 || type === 52 || this.hasPlugin("v8intrinsic") && type === 50;
|
|
7341
7475
|
}
|
|
7342
7476
|
parseYield(startLoc) {
|
|
7343
|
-
this.setLoc(startLoc);
|
|
7344
7477
|
const node = this.startNodeAt(startLoc);
|
|
7345
7478
|
this.expressionScope.recordParameterInitializerError(Errors.YieldInParameter, startLoc.index);
|
|
7346
7479
|
let delegating = false;
|
|
@@ -7349,16 +7482,18 @@ var ExpressionParser = class extends LValParser {
|
|
|
7349
7482
|
delegating = this.eat(51);
|
|
7350
7483
|
switch (this.state.type) {
|
|
7351
7484
|
case 9:
|
|
7352
|
-
case
|
|
7485
|
+
case 138:
|
|
7353
7486
|
case 4:
|
|
7354
7487
|
case 7:
|
|
7355
7488
|
case 1:
|
|
7356
7489
|
case 5:
|
|
7357
7490
|
case 10:
|
|
7358
7491
|
case 8: if (!delegating) break;
|
|
7492
|
+
case 54: if (this.options.annexB && !delegating) break;
|
|
7359
7493
|
default: argument = this.parseMaybeAssign();
|
|
7360
7494
|
}
|
|
7361
7495
|
}
|
|
7496
|
+
if (!argument) this.state.regExpAllowedAt = this.state.lastTokEndLoc.index;
|
|
7362
7497
|
node.delegate = delegating;
|
|
7363
7498
|
node.argument = argument;
|
|
7364
7499
|
return this.finishNode(node, "YieldExpression");
|
|
@@ -7423,11 +7558,11 @@ var ExpressionParser = class extends LValParser {
|
|
|
7423
7558
|
const startLoc = this.state.startLoc;
|
|
7424
7559
|
this.prodParam.enter(this.prodParam.currentFlags() & -17);
|
|
7425
7560
|
let ret;
|
|
7426
|
-
if (this.isContextual(
|
|
7561
|
+
if (this.isContextual(93) && this.recordAwaitIfAllowed()) {
|
|
7427
7562
|
this.next();
|
|
7428
7563
|
ret = this.parseAwait(startLoc, true);
|
|
7429
7564
|
const nextOp = this.state.type;
|
|
7430
|
-
if (
|
|
7565
|
+
if (nextOp !== 35 && this.isBinaryOperator(nextOp)) this.raise(Errors.PipelineUnparenthesized, startLoc);
|
|
7431
7566
|
} else {
|
|
7432
7567
|
this.state.canStartArrow = true;
|
|
7433
7568
|
ret = this.parseExprOp(this.parseMaybeUnaryOrPrivate(), startLoc, prec);
|
|
@@ -7471,6 +7606,7 @@ const loopLabel = { kind: 1 };
|
|
|
7471
7606
|
const switchLabel = { kind: 2 };
|
|
7472
7607
|
const loneSurrogate = /[\uD800-\uDFFF]/u;
|
|
7473
7608
|
const keywordRelationalOperator = /in(?:stanceof)?/y;
|
|
7609
|
+
const keywordLikeWord = /[a-z]{2,10}/y;
|
|
7474
7610
|
function createExportedTokens(tokens) {
|
|
7475
7611
|
for (let i = 0; i < tokens.length; i++) {
|
|
7476
7612
|
const token = tokens[i];
|
|
@@ -7481,7 +7617,7 @@ function createExportedTokens(tokens) {
|
|
|
7481
7617
|
}
|
|
7482
7618
|
var StatementParser = class extends ExpressionParser {
|
|
7483
7619
|
parseTopLevel(file, program) {
|
|
7484
|
-
file.program = this.parseProgram(program,
|
|
7620
|
+
file.program = this.parseProgram(program, 138, this.options.sourceType === "module" ? "module" : "script");
|
|
7485
7621
|
file.comments = this.comments;
|
|
7486
7622
|
if (this.optionFlags & 512) file.tokens = createExportedTokens(this.tokens);
|
|
7487
7623
|
return this.finishNode(file, "File");
|
|
@@ -7495,7 +7631,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
7495
7631
|
this.addExtra(program, "topLevelAwait", this.state.hasTopLevelAwait);
|
|
7496
7632
|
}
|
|
7497
7633
|
let finishedProgram;
|
|
7498
|
-
if (end ===
|
|
7634
|
+
if (end === 138) finishedProgram = this.finishNode(program, "Program");
|
|
7499
7635
|
else finishedProgram = this.finishNodeAt(program, "Program", createPositionWithColumnOffset(this.state.startLoc, -1));
|
|
7500
7636
|
return finishedProgram;
|
|
7501
7637
|
}
|
|
@@ -7520,15 +7656,15 @@ var StatementParser = class extends ExpressionParser {
|
|
|
7520
7656
|
return this.finishNode(node, "InterpreterDirective");
|
|
7521
7657
|
}
|
|
7522
7658
|
isLet() {
|
|
7523
|
-
if (!this.isContextual(
|
|
7659
|
+
if (!this.isContextual(97)) return false;
|
|
7524
7660
|
return this.hasFollowingBindingAtom();
|
|
7525
7661
|
}
|
|
7526
7662
|
isUsing() {
|
|
7527
|
-
if (!this.isContextual(
|
|
7663
|
+
if (!this.isContextual(106)) return false;
|
|
7528
7664
|
return this.nextTokenIsIdentifierOnSameLine();
|
|
7529
7665
|
}
|
|
7530
7666
|
isForUsing() {
|
|
7531
|
-
if (!this.isContextual(
|
|
7667
|
+
if (!this.isContextual(106)) return false;
|
|
7532
7668
|
const next = this.nextTokenInLineStart();
|
|
7533
7669
|
const nextCh = this.codePointAtPos(next);
|
|
7534
7670
|
if (this.isUnparsedContextual(next, "of")) {
|
|
@@ -7544,7 +7680,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
7544
7680
|
return this.chStartsBindingIdentifier(nextCh, next);
|
|
7545
7681
|
}
|
|
7546
7682
|
isAwaitUsing() {
|
|
7547
|
-
if (!this.isContextual(
|
|
7683
|
+
if (!this.isContextual(93)) return false;
|
|
7548
7684
|
let next = this.nextTokenInLineStart();
|
|
7549
7685
|
if (this.isUnparsedContextual(next, "using")) {
|
|
7550
7686
|
next = this.nextTokenInLineStartSince(next + 5);
|
|
@@ -7564,6 +7700,16 @@ var StatementParser = class extends ExpressionParser {
|
|
|
7564
7700
|
} else if (ch === 92) return true;
|
|
7565
7701
|
else return false;
|
|
7566
7702
|
}
|
|
7703
|
+
isReservedWordOnNewLineAfterLet(pos) {
|
|
7704
|
+
if (!hasNewLine(this.input, this.state.end, pos)) return false;
|
|
7705
|
+
keywordLikeWord.lastIndex = pos;
|
|
7706
|
+
if (!keywordLikeWord.test(this.input)) return false;
|
|
7707
|
+
const end = keywordLikeWord.lastIndex;
|
|
7708
|
+
const endCh = this.codePointAtPos(end);
|
|
7709
|
+
if (isIdentifierChar$1(endCh) || endCh === 92) return false;
|
|
7710
|
+
const word = this.input.slice(pos, end);
|
|
7711
|
+
return isKeyword$1(word) || isReservedWord$1(word, false);
|
|
7712
|
+
}
|
|
7567
7713
|
chStartsBindingPattern(ch) {
|
|
7568
7714
|
return ch === 91 || ch === 123;
|
|
7569
7715
|
}
|
|
@@ -7617,16 +7763,23 @@ var StatementParser = class extends ExpressionParser {
|
|
|
7617
7763
|
case 64:
|
|
7618
7764
|
if (this.lookaheadCharCode() === 46) break;
|
|
7619
7765
|
if (!allowFunctionDeclaration) this.raise(this.state.strict ? Errors.StrictFunction : this.options.annexB ? Errors.SloppyFunctionAnnexB : Errors.SloppyFunction, this.state.startLoc);
|
|
7620
|
-
return this.parseFunctionStatement(node, false,
|
|
7766
|
+
return this.parseFunctionStatement(node, false, flags);
|
|
7621
7767
|
case 76:
|
|
7622
7768
|
if (!allowDeclaration) this.unexpected();
|
|
7623
7769
|
return this.parseClass(this.maybeTakeDecorators(decorators, node), true);
|
|
7770
|
+
case 104:
|
|
7771
|
+
if (!this.state.containsEsc && this.nextTokenIsIdentifierOnSameLine()) {
|
|
7772
|
+
this.expectPlugin("structs");
|
|
7773
|
+
if (!allowDeclaration) this.unexpected();
|
|
7774
|
+
return this.parseStructDeclaration(node, false);
|
|
7775
|
+
}
|
|
7776
|
+
break;
|
|
7624
7777
|
case 65: return this.parseIfStatement(node);
|
|
7625
7778
|
case 66: return this.parseReturnStatement(node);
|
|
7626
7779
|
case 67: return this.parseSwitchStatement(node);
|
|
7627
7780
|
case 68: return this.parseThrowStatement(node);
|
|
7628
7781
|
case 69: return this.parseTryStatement(node);
|
|
7629
|
-
case
|
|
7782
|
+
case 93:
|
|
7630
7783
|
if (this.isAwaitUsing()) {
|
|
7631
7784
|
if (!this.allowsUsing()) this.raise(Errors.UnexpectedUsingDeclaration, node);
|
|
7632
7785
|
else if (!allowDeclaration) this.raise(Errors.UnexpectedLexicalDeclaration, node);
|
|
@@ -7635,18 +7788,19 @@ var StatementParser = class extends ExpressionParser {
|
|
|
7635
7788
|
return this.parseVarStatement(node, "await using");
|
|
7636
7789
|
}
|
|
7637
7790
|
break;
|
|
7638
|
-
case
|
|
7791
|
+
case 106:
|
|
7639
7792
|
if (this.state.containsEsc || !this.hasInLineFollowingBindingIdentifierOrBrace()) break;
|
|
7640
7793
|
if (!this.allowsUsing()) this.raise(Errors.UnexpectedUsingDeclaration, this.state.startLoc);
|
|
7641
7794
|
else if (!allowDeclaration) this.raise(Errors.UnexpectedLexicalDeclaration, this.state.startLoc);
|
|
7642
7795
|
return this.parseVarStatement(node, "using");
|
|
7643
|
-
case
|
|
7796
|
+
case 97: {
|
|
7644
7797
|
if (this.state.containsEsc) break;
|
|
7645
7798
|
const next = this.nextTokenStart();
|
|
7646
7799
|
const nextCh = this.codePointAtPos(next);
|
|
7647
7800
|
if (nextCh !== 91) {
|
|
7648
7801
|
if (!allowDeclaration && this.hasFollowingLineBreak()) break;
|
|
7649
7802
|
if (!this.chStartsBindingIdentifier(nextCh, next) && nextCh !== 123) break;
|
|
7803
|
+
if (this.isReservedWordOnNewLineAfterLet(next)) break;
|
|
7650
7804
|
}
|
|
7651
7805
|
}
|
|
7652
7806
|
case 71: if (!allowDeclaration) this.raise(Errors.UnexpectedLexicalDeclaration, this.state.startLoc);
|
|
@@ -7674,13 +7828,18 @@ var StatementParser = class extends ExpressionParser {
|
|
|
7674
7828
|
default: if (this.isAsyncFunction()) {
|
|
7675
7829
|
if (!allowDeclaration) this.raise(Errors.AsyncFunctionInSingleStatementContext, this.state.startLoc);
|
|
7676
7830
|
this.next();
|
|
7677
|
-
return this.parseFunctionStatement(node, true,
|
|
7831
|
+
return this.parseFunctionStatement(node, true, flags);
|
|
7678
7832
|
}
|
|
7679
7833
|
}
|
|
7680
7834
|
const maybeName = this.state.value;
|
|
7835
|
+
if (startType === 89 && this.lookahead().type === 10) {
|
|
7836
|
+
const label = this.parseIdentifier(true);
|
|
7837
|
+
this.next();
|
|
7838
|
+
return this.parseLabeledStatement(node, maybeName, label, flags);
|
|
7839
|
+
}
|
|
7681
7840
|
const expr = this.parseExpression();
|
|
7682
7841
|
if (tokenIsIdentifier(startType) && expr.type === "Identifier" && this.eat(10)) return this.parseLabeledStatement(node, maybeName, expr, flags);
|
|
7683
|
-
else return this.parseExpressionStatement(node, expr);
|
|
7842
|
+
else return this.parseExpressionStatement(node, expr, flags);
|
|
7684
7843
|
}
|
|
7685
7844
|
assertModuleNodeAllowed(node) {
|
|
7686
7845
|
if (!(this.optionFlags & 8) && !this.inModule) this.raise(Errors.ImportOutsideModule, node);
|
|
@@ -7730,7 +7889,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
7730
7889
|
while (this.eat(12)) {
|
|
7731
7890
|
const node = this.startNodeAt(startLoc);
|
|
7732
7891
|
node.object = expr;
|
|
7733
|
-
if (this.match(
|
|
7892
|
+
if (this.match(137)) {
|
|
7734
7893
|
this.classScope.usePrivateName(this.state.value, this.state.startLoc);
|
|
7735
7894
|
node.property = this.parsePrivateName();
|
|
7736
7895
|
} else node.property = this.parseIdentifier(true);
|
|
@@ -7759,7 +7918,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
7759
7918
|
this.next();
|
|
7760
7919
|
if (this.isLineTerminator()) node.label = null;
|
|
7761
7920
|
else {
|
|
7762
|
-
node.label = this.parseIdentifier();
|
|
7921
|
+
node.label = this.parseIdentifier(this.match(89));
|
|
7763
7922
|
this.semicolon();
|
|
7764
7923
|
}
|
|
7765
7924
|
this.verifyBreakContinue(node, isBreak);
|
|
@@ -7804,7 +7963,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
7804
7963
|
this.next();
|
|
7805
7964
|
this.state.labels.push(loopLabel);
|
|
7806
7965
|
let awaitAt = null;
|
|
7807
|
-
if (this.isContextual(
|
|
7966
|
+
if (this.isContextual(93) && this.recordAwaitIfAllowed()) {
|
|
7808
7967
|
awaitAt = this.state.startLoc;
|
|
7809
7968
|
this.next();
|
|
7810
7969
|
}
|
|
@@ -7814,7 +7973,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
7814
7973
|
if (awaitAt !== null) this.unexpected(awaitAt);
|
|
7815
7974
|
return this.parseFor(node, null);
|
|
7816
7975
|
}
|
|
7817
|
-
const startsWithLet = this.isContextual(
|
|
7976
|
+
const startsWithLet = this.isContextual(97);
|
|
7818
7977
|
{
|
|
7819
7978
|
const startsWithAwaitUsing = this.isAwaitUsing();
|
|
7820
7979
|
const starsWithUsingDeclaration = startsWithAwaitUsing || this.isForUsing();
|
|
@@ -7832,15 +7991,15 @@ var StatementParser = class extends ExpressionParser {
|
|
|
7832
7991
|
const init = this.finishNode(initNode, "VariableDeclaration");
|
|
7833
7992
|
const isForIn = this.match(54);
|
|
7834
7993
|
if (isForIn && starsWithUsingDeclaration) this.raise(Errors.ForInUsing, init);
|
|
7835
|
-
if ((isForIn || this.isContextual(
|
|
7994
|
+
if ((isForIn || this.isContextual(99)) && init.declarations.length === 1) return this.parseForX(node, init, awaitAt);
|
|
7836
7995
|
if (awaitAt !== null) this.unexpected(awaitAt);
|
|
7837
7996
|
return this.parseFor(node, init);
|
|
7838
7997
|
}
|
|
7839
7998
|
}
|
|
7840
|
-
const startsWithAsync = this.isContextual(
|
|
7999
|
+
const startsWithAsync = this.isContextual(92);
|
|
7841
8000
|
const refExpressionErrors = new ExpressionErrors();
|
|
7842
8001
|
const init = this.parseExpression(true, refExpressionErrors);
|
|
7843
|
-
const isForOf = this.isContextual(
|
|
8002
|
+
const isForOf = this.isContextual(99);
|
|
7844
8003
|
if (isForOf) {
|
|
7845
8004
|
if (startsWithLet) this.raise(Errors.ForOfLet, init);
|
|
7846
8005
|
if (awaitAt === null && startsWithAsync && init.type === "Identifier") this.raise(Errors.ForOfAsync, init);
|
|
@@ -7855,9 +8014,14 @@ var StatementParser = class extends ExpressionParser {
|
|
|
7855
8014
|
if (awaitAt !== null) this.unexpected(awaitAt);
|
|
7856
8015
|
return this.parseFor(node, init);
|
|
7857
8016
|
}
|
|
7858
|
-
parseFunctionStatement(node, isAsync,
|
|
8017
|
+
parseFunctionStatement(node, isAsync, statementFlags) {
|
|
7859
8018
|
this.next();
|
|
7860
|
-
|
|
8019
|
+
let flags = 1 | (isAsync ? 8 : 0);
|
|
8020
|
+
if (!(statementFlags & 2) && statementFlags & 4) {
|
|
8021
|
+
flags |= 16;
|
|
8022
|
+
if (!(statementFlags & 8)) flags |= 2;
|
|
8023
|
+
}
|
|
8024
|
+
return this.parseFunction(node, flags);
|
|
7861
8025
|
}
|
|
7862
8026
|
parseIfStatement(node) {
|
|
7863
8027
|
this.next();
|
|
@@ -7986,7 +8150,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
7986
8150
|
node.label = expr;
|
|
7987
8151
|
return this.finishNode(node, "LabeledStatement");
|
|
7988
8152
|
}
|
|
7989
|
-
parseExpressionStatement(node, expr) {
|
|
8153
|
+
parseExpressionStatement(node, expr, _flags) {
|
|
7990
8154
|
node.expression = expr;
|
|
7991
8155
|
this.semicolon();
|
|
7992
8156
|
return this.finishNode(node, "ExpressionStatement");
|
|
@@ -8068,9 +8232,9 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8068
8232
|
const decl = this.startNode();
|
|
8069
8233
|
this.parseVarId(decl, kind);
|
|
8070
8234
|
decl.init = !this.eat(25) ? null : isFor ? this.parseMaybeAssignDisallowIn() : this.parseMaybeAssignAllowIn();
|
|
8071
|
-
if (decl.init === null && !allowMissingInitializer) {
|
|
8072
|
-
if (decl.id.type !== "Identifier"
|
|
8073
|
-
else if (
|
|
8235
|
+
if (decl.init === null && !allowMissingInitializer && !(isFor && declarations.length === 0 && (this.match(54) || this.isContextual(99)))) {
|
|
8236
|
+
if (decl.id.type !== "Identifier") this.raise(Errors.DeclarationMissingInitializer, this.state.lastTokEndLoc, { kind: "destructuring" });
|
|
8237
|
+
else if (kind === "const" || kind === "using" || kind === "await using") this.raise(Errors.DeclarationMissingInitializer, this.state.lastTokEndLoc, { kind });
|
|
8074
8238
|
}
|
|
8075
8239
|
declarations.push(this.finishNode(decl, "VariableDeclarator"));
|
|
8076
8240
|
if (!this.eat(8)) break;
|
|
@@ -8089,13 +8253,12 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8089
8253
|
return this.parseFunction(node, 8);
|
|
8090
8254
|
}
|
|
8091
8255
|
parseFunction(node, flags = 0) {
|
|
8092
|
-
const hangingDeclaration = flags & 2;
|
|
8093
8256
|
const isDeclaration = !!(flags & 1);
|
|
8094
8257
|
const requireId = isDeclaration && !(flags & 4);
|
|
8095
8258
|
const isAsync = !!(flags & 8);
|
|
8096
8259
|
this.initFunction(node, isAsync);
|
|
8097
8260
|
if (this.match(51)) {
|
|
8098
|
-
if (
|
|
8261
|
+
if (flags & 16) this.raise(Errors.GeneratorInSingleStatementContext, this.state.startLoc);
|
|
8099
8262
|
this.next();
|
|
8100
8263
|
node.generator = true;
|
|
8101
8264
|
}
|
|
@@ -8103,7 +8266,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8103
8266
|
this.scope.enter(514);
|
|
8104
8267
|
this.prodParam.enter(functionFlags(isAsync, node.generator));
|
|
8105
8268
|
if (!isDeclaration && tokenIsIdentifier(this.state.type)) {
|
|
8106
|
-
this.expressionScope.enter(
|
|
8269
|
+
this.expressionScope.enter(sharedExpressionScope);
|
|
8107
8270
|
node.id = this.parseFunctionId();
|
|
8108
8271
|
this.expressionScope.exit();
|
|
8109
8272
|
}
|
|
@@ -8111,7 +8274,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8111
8274
|
this.parseFunctionBodyAndFinish(node, isDeclaration ? "FunctionDeclaration" : "FunctionExpression");
|
|
8112
8275
|
this.prodParam.exit();
|
|
8113
8276
|
this.scope.exit();
|
|
8114
|
-
if (isDeclaration && !
|
|
8277
|
+
if (isDeclaration && !(flags & 2)) this.registerFunctionStatementId(node);
|
|
8115
8278
|
return node;
|
|
8116
8279
|
}
|
|
8117
8280
|
parseFunctionId(requireId) {
|
|
@@ -8119,7 +8282,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8119
8282
|
}
|
|
8120
8283
|
parseFunctionParams(node, isConstructor) {
|
|
8121
8284
|
this.expect(6);
|
|
8122
|
-
this.expressionScope.enter(
|
|
8285
|
+
this.expressionScope.enter(parameterDeclarationScope);
|
|
8123
8286
|
node.params = this.parseBindingList(7, 41, 2 | (isConstructor ? 4 : 0));
|
|
8124
8287
|
this.expressionScope.exit();
|
|
8125
8288
|
}
|
|
@@ -8203,7 +8366,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8203
8366
|
return false;
|
|
8204
8367
|
}
|
|
8205
8368
|
parseClassMember(classBody, member, state) {
|
|
8206
|
-
const isStatic = this.isContextual(
|
|
8369
|
+
const isStatic = this.isContextual(103);
|
|
8207
8370
|
if (isStatic) {
|
|
8208
8371
|
if (this.parseClassMemberFromModifier(classBody, member)) return;
|
|
8209
8372
|
if (this.eat(2)) {
|
|
@@ -8225,7 +8388,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8225
8388
|
this.parsePropertyNamePrefixOperator(member);
|
|
8226
8389
|
if (this.eat(51)) {
|
|
8227
8390
|
method.kind = "method";
|
|
8228
|
-
const isPrivateName = this.match(
|
|
8391
|
+
const isPrivateName = this.match(137);
|
|
8229
8392
|
this.parseClassElementName(method);
|
|
8230
8393
|
this.parsePostMemberNameModifiers(method);
|
|
8231
8394
|
if (isPrivateName) {
|
|
@@ -8267,7 +8430,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8267
8430
|
const isGenerator = this.eat(51);
|
|
8268
8431
|
if (publicMember.optional) this.unexpected(maybeQuestionTokenStartLoc);
|
|
8269
8432
|
method.kind = "method";
|
|
8270
|
-
const isPrivate = this.match(
|
|
8433
|
+
const isPrivate = this.match(137);
|
|
8271
8434
|
this.parseClassElementName(method);
|
|
8272
8435
|
this.parsePostMemberNameModifiers(publicMember);
|
|
8273
8436
|
if (isPrivate) this.pushClassPrivateMethod(classBody, privateMethod, isGenerator, true);
|
|
@@ -8278,7 +8441,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8278
8441
|
} else if ((maybeContextualKw === "get" || maybeContextualKw === "set") && !(this.match(51) && this.isLineTerminator())) {
|
|
8279
8442
|
this.resetPreviousNodeTrailingComments(key);
|
|
8280
8443
|
method.kind = maybeContextualKw;
|
|
8281
|
-
const isPrivate = this.match(
|
|
8444
|
+
const isPrivate = this.match(137);
|
|
8282
8445
|
this.parseClassElementName(publicMethod);
|
|
8283
8446
|
if (isPrivate) this.pushClassPrivateMethod(classBody, privateMethod, false, false);
|
|
8284
8447
|
else {
|
|
@@ -8289,7 +8452,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8289
8452
|
} else if (maybeContextualKw === "accessor" && !this.isLineTerminator()) {
|
|
8290
8453
|
this.expectPlugin("decoratorAutoAccessors");
|
|
8291
8454
|
this.resetPreviousNodeTrailingComments(key);
|
|
8292
|
-
const isPrivate = this.match(
|
|
8455
|
+
const isPrivate = this.match(137);
|
|
8293
8456
|
this.parseClassElementName(publicProp);
|
|
8294
8457
|
this.pushClassAccessorProperty(classBody, accessorProp, isPrivate);
|
|
8295
8458
|
} else if (this.isLineTerminator()) {
|
|
@@ -8299,8 +8462,8 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8299
8462
|
}
|
|
8300
8463
|
parseClassElementName(member) {
|
|
8301
8464
|
const { type, value } = this.state;
|
|
8302
|
-
if ((type ===
|
|
8303
|
-
if (type ===
|
|
8465
|
+
if ((type === 131 || type === 133) && member.static && value === "prototype") this.raise(Errors.StaticPrototype, this.state.startLoc);
|
|
8466
|
+
if (type === 137) {
|
|
8304
8467
|
if (value === "constructor") this.raise(Errors.ConstructorClassPrivateField, this.state.startLoc);
|
|
8305
8468
|
const key = this.parsePrivateName();
|
|
8306
8469
|
member.key = key;
|
|
@@ -8367,7 +8530,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8367
8530
|
}
|
|
8368
8531
|
parseInitializer(node) {
|
|
8369
8532
|
this.scope.enter(592);
|
|
8370
|
-
this.expressionScope.enter(
|
|
8533
|
+
this.expressionScope.enter(sharedExpressionScope);
|
|
8371
8534
|
this.prodParam.enter(0);
|
|
8372
8535
|
node.value = this.eat(25) ? this.parseMaybeAssignAllowIn() : null;
|
|
8373
8536
|
this.expressionScope.exit();
|
|
@@ -8377,6 +8540,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8377
8540
|
parseClassId(node, isStatement, optionalId, bindingType = 8331) {
|
|
8378
8541
|
if (tokenIsIdentifier(this.state.type)) {
|
|
8379
8542
|
node.id = this.parseIdentifier();
|
|
8543
|
+
this.checkStrictBindReservedWord(node.id, bindingType);
|
|
8380
8544
|
if (isStatement) this.declareNameFromIdentifier(node.id, bindingType);
|
|
8381
8545
|
} else if (optionalId || !isStatement) node.id = null;
|
|
8382
8546
|
else throw this.raise(Errors.MissingClassName, this.state.startLoc);
|
|
@@ -8387,24 +8551,52 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8387
8551
|
node.superClass = this.parseExprSubscripts();
|
|
8388
8552
|
} else node.superClass = null;
|
|
8389
8553
|
}
|
|
8554
|
+
parseStructDeclaration(node, optionalId) {
|
|
8555
|
+
this.next();
|
|
8556
|
+
const oldStrict = this.state.strict;
|
|
8557
|
+
this.state.strict = true;
|
|
8558
|
+
this.parseClassId(node, true, optionalId);
|
|
8559
|
+
this.parseClassSuper(node);
|
|
8560
|
+
node.body = this.parseStructBody(!!node.superClass, oldStrict);
|
|
8561
|
+
return this.finishNode(node, "StructDeclaration");
|
|
8562
|
+
}
|
|
8563
|
+
parseStructBody(hadSuperClass, oldStrict) {
|
|
8564
|
+
this.classScope.enter();
|
|
8565
|
+
const state = {
|
|
8566
|
+
hadConstructor: false,
|
|
8567
|
+
hadSuperClass
|
|
8568
|
+
};
|
|
8569
|
+
const structBody = this.startNode();
|
|
8570
|
+
structBody.body = [];
|
|
8571
|
+
this.expect(2);
|
|
8572
|
+
while (!this.match(4)) {
|
|
8573
|
+
if (this.eat(9)) continue;
|
|
8574
|
+
const member = this.startNode();
|
|
8575
|
+
this.parseClassMember(structBody, member, state);
|
|
8576
|
+
}
|
|
8577
|
+
this.state.strict = oldStrict;
|
|
8578
|
+
this.next();
|
|
8579
|
+
this.classScope.exit();
|
|
8580
|
+
return this.finishNode(structBody, "StructBody");
|
|
8581
|
+
}
|
|
8390
8582
|
parseExport(node, decorators) {
|
|
8391
8583
|
const maybeDefaultIdentifier = this.parseMaybeImportPhase(node, true);
|
|
8392
8584
|
const hasDefault = this.maybeParseExportDefaultSpecifier(node, maybeDefaultIdentifier);
|
|
8393
8585
|
const parseAfterDefault = !hasDefault || this.eat(8);
|
|
8394
8586
|
const hasStar = parseAfterDefault && this.eatExportStar(node);
|
|
8395
8587
|
const hasNamespace = hasStar && this.maybeParseExportNamespaceSpecifier(node);
|
|
8396
|
-
const parseAfterNamespace = parseAfterDefault &&
|
|
8397
|
-
const isFromRequired = hasDefault || hasStar;
|
|
8588
|
+
const parseAfterNamespace = parseAfterDefault && !hasNamespace;
|
|
8398
8589
|
if (hasStar && !hasNamespace) {
|
|
8399
8590
|
if (hasDefault) this.unexpected();
|
|
8400
8591
|
if (decorators) throw this.raise(Errors.UnsupportedDecoratorExport, node);
|
|
8592
|
+
if (node.phase === "defer") this.raise(Errors.DeferExportInvalidAll, node);
|
|
8401
8593
|
this.parseExportFrom(node, true);
|
|
8402
8594
|
this.sawUnambiguousESM = true;
|
|
8403
8595
|
return this.finishNode(node, "ExportAllDeclaration");
|
|
8404
8596
|
}
|
|
8405
|
-
const hasSpecifiers = this.maybeParseExportNamedSpecifiers(node);
|
|
8597
|
+
const hasSpecifiers = parseAfterNamespace && this.maybeParseExportNamedSpecifiers(node);
|
|
8598
|
+
const isFromRequired = hasDefault || hasStar || node.phase === "defer" || hasSpecifiers && node.specifiers[0]?.type === "ExportNamespaceSpecifier";
|
|
8406
8599
|
if (hasDefault && parseAfterDefault && !hasStar && !hasSpecifiers) this.unexpected(null, 2);
|
|
8407
|
-
if (hasNamespace && parseAfterNamespace) this.unexpected(null, 94);
|
|
8408
8600
|
let hasDeclaration;
|
|
8409
8601
|
if (isFromRequired || hasSpecifiers) {
|
|
8410
8602
|
hasDeclaration = false;
|
|
@@ -8416,6 +8608,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8416
8608
|
this.checkNamedExport(node2, !!node2.source);
|
|
8417
8609
|
if (node2.declaration?.type === "ClassDeclaration") this.maybeTakeDecorators(decorators, node2.declaration, node2);
|
|
8418
8610
|
else if (decorators) throw this.raise(Errors.UnsupportedDecoratorExport, node);
|
|
8611
|
+
if (this.hasPlugin("deferredReexports")) node2.phase ??= null;
|
|
8419
8612
|
this.sawUnambiguousESM = true;
|
|
8420
8613
|
return this.finishNode(node2, "ExportNamedDeclaration");
|
|
8421
8614
|
}
|
|
@@ -8449,7 +8642,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8449
8642
|
return false;
|
|
8450
8643
|
}
|
|
8451
8644
|
maybeParseExportNamespaceSpecifier(node) {
|
|
8452
|
-
if (this.isContextual(
|
|
8645
|
+
if (this.isContextual(90)) {
|
|
8453
8646
|
node.specifiers ??= [];
|
|
8454
8647
|
const specifier = this.startNodeAt(this.state.lastTokStartLoc);
|
|
8455
8648
|
this.next();
|
|
@@ -8464,7 +8657,17 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8464
8657
|
const node2 = node;
|
|
8465
8658
|
if (!node2.specifiers) node2.specifiers = [];
|
|
8466
8659
|
const isTypeExport = node2.exportKind === "type";
|
|
8467
|
-
|
|
8660
|
+
const startLoc = this.state.startLoc;
|
|
8661
|
+
this.setLoc(startLoc);
|
|
8662
|
+
const specifiers = this.parseExportSpecifiers(isTypeExport);
|
|
8663
|
+
if (this.isContextual(90) && !this.hasPrecedingLineBreak()) {
|
|
8664
|
+
this.expectPlugin("namespaceImportFilter");
|
|
8665
|
+
const specifier = this.startNodeAt(startLoc);
|
|
8666
|
+
specifier.exportsFilter = this.toNamespaceExportsFilter(specifiers);
|
|
8667
|
+
this.next();
|
|
8668
|
+
specifier.exported = this.parseModuleExportName();
|
|
8669
|
+
node2.specifiers.push(this.finishNode(specifier, "ExportNamespaceSpecifier"));
|
|
8670
|
+
} else node2.specifiers.push(...specifiers);
|
|
8468
8671
|
node2.source = null;
|
|
8469
8672
|
node2.attributes = [];
|
|
8470
8673
|
node2.declaration = null;
|
|
@@ -8483,7 +8686,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8483
8686
|
return false;
|
|
8484
8687
|
}
|
|
8485
8688
|
isAsyncFunction() {
|
|
8486
|
-
if (!this.isContextual(
|
|
8689
|
+
if (!this.isContextual(92)) return false;
|
|
8487
8690
|
const next = this.nextTokenInLineStart();
|
|
8488
8691
|
return this.isUnparsedContextual(next, "function");
|
|
8489
8692
|
}
|
|
@@ -8498,25 +8701,38 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8498
8701
|
return this.parseFunction(expr, 13);
|
|
8499
8702
|
}
|
|
8500
8703
|
if (this.match(76)) return this.parseClass(expr, true, true);
|
|
8704
|
+
if (this.isContextual(104)) {
|
|
8705
|
+
const next = this.nextTokenInLineStart();
|
|
8706
|
+
const nextCh = this.codePointAtPos(next);
|
|
8707
|
+
if (nextCh === 123 || this.chStartsBindingIdentifier(nextCh, next)) {
|
|
8708
|
+
this.expectPlugin("structs");
|
|
8709
|
+
return this.parseStructDeclaration(expr, true);
|
|
8710
|
+
}
|
|
8711
|
+
}
|
|
8501
8712
|
if (this.match(22)) return this.parseClass(this.maybeTakeDecorators(this.parseDecorators(false), this.startNode()), true, true);
|
|
8502
|
-
if (this.match(71) || this.match(70) || this.isLet() || this.isUsing() || this.isAwaitUsing()) throw this.raise(Errors.UnsupportedDefaultExport, this.state.startLoc);
|
|
8713
|
+
if (this.match(71) || this.match(70) || this.isLet() && !this.isReservedWordOnNewLineAfterLet(this.nextTokenStart()) || this.isUsing() || this.isAwaitUsing()) throw this.raise(Errors.UnsupportedDefaultExport, this.state.startLoc);
|
|
8503
8714
|
const res = this.parseMaybeAssignAllowIn();
|
|
8504
8715
|
this.semicolon();
|
|
8505
8716
|
return res;
|
|
8506
8717
|
}
|
|
8507
8718
|
parseExportDeclaration(node) {
|
|
8508
8719
|
if (this.match(76)) return this.parseClass(this.startNode(), true, false);
|
|
8720
|
+
if (this.isContextual(104) && this.nextTokenIsIdentifierOnSameLine()) {
|
|
8721
|
+
this.expectPlugin("structs");
|
|
8722
|
+
return this.parseStructDeclaration(this.startNode(), false);
|
|
8723
|
+
}
|
|
8724
|
+
if (this.isContextual(97)) return this.parseVarStatement(this.startNode(), "let");
|
|
8509
8725
|
return this.parseStatementListItem();
|
|
8510
8726
|
}
|
|
8511
8727
|
isExportDefaultSpecifier() {
|
|
8512
8728
|
const { type } = this.state;
|
|
8513
8729
|
if (tokenIsIdentifier(type)) {
|
|
8514
|
-
if (type ===
|
|
8515
|
-
if ((type ===
|
|
8730
|
+
if (type === 92 && !this.state.containsEsc || type === 97) return false;
|
|
8731
|
+
if ((type === 129 || type === 128 || type === 104) && !this.state.containsEsc) {
|
|
8516
8732
|
const next = this.nextTokenStart();
|
|
8517
8733
|
const nextChar = this.input.charCodeAt(next);
|
|
8518
|
-
if (nextChar === 123 || this.chStartsBindingIdentifier(nextChar, next) && !this.
|
|
8519
|
-
this.expectOnePlugin(["flow", "typescript"]);
|
|
8734
|
+
if (nextChar === 123 || this.chStartsBindingIdentifier(nextChar, next) && !this.isUnparsedContextual(next, "from")) {
|
|
8735
|
+
if (type !== 104) this.expectOnePlugin(["flow", "typescript"]);
|
|
8520
8736
|
return false;
|
|
8521
8737
|
}
|
|
8522
8738
|
}
|
|
@@ -8525,16 +8741,16 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8525
8741
|
const hasFrom = this.isUnparsedContextual(next, "from");
|
|
8526
8742
|
if (this.input.charCodeAt(next) === 44 || tokenIsIdentifier(this.state.type) && hasFrom) return true;
|
|
8527
8743
|
if (this.match(61) && hasFrom) {
|
|
8528
|
-
const nextAfterFrom = this.input.charCodeAt(this.nextTokenStartSince(next + 4));
|
|
8744
|
+
const nextAfterFrom = this.input.charCodeAt(this.hasPlugin("exportDefaultFrom") ? this.nextTokenStartSince(next + 4) : this.nextTokenInLineStartSince(next + 4));
|
|
8529
8745
|
return nextAfterFrom === 34 || nextAfterFrom === 39;
|
|
8530
8746
|
}
|
|
8531
8747
|
return false;
|
|
8532
8748
|
}
|
|
8533
8749
|
parseExportFrom(node, expect) {
|
|
8534
|
-
if (this.eatContextual(
|
|
8750
|
+
if (this.eatContextual(95)) {
|
|
8535
8751
|
node.source = this.parseImportSource();
|
|
8536
8752
|
this.maybeParseImportAttributes(node);
|
|
8537
|
-
} else if (expect) this.unexpected();
|
|
8753
|
+
} else if (expect) this.unexpected(null, 95);
|
|
8538
8754
|
this.semicolon();
|
|
8539
8755
|
}
|
|
8540
8756
|
shouldParseExportDeclaration() {
|
|
@@ -8551,7 +8767,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8551
8767
|
this.raise(Errors.UsingDeclarationExport, this.state.startLoc);
|
|
8552
8768
|
return true;
|
|
8553
8769
|
}
|
|
8554
|
-
return type === 70 || type === 71 || type === 64 || type === 76 || this.isLet() || this.isAsyncFunction();
|
|
8770
|
+
return type === 70 || type === 71 || type === 64 || type === 76 || this.isLet() || this.isAsyncFunction() || this.isContextual(104) && this.nextTokenIsIdentifierOnSameLine();
|
|
8555
8771
|
}
|
|
8556
8772
|
checkNamedExport(node, isFrom) {
|
|
8557
8773
|
if (node.specifiers?.length) for (const specifier of node.specifiers) {
|
|
@@ -8572,7 +8788,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8572
8788
|
}
|
|
8573
8789
|
else if (node.declaration) {
|
|
8574
8790
|
const decl = node.declaration;
|
|
8575
|
-
if (decl.type === "FunctionDeclaration" || decl.type === "ClassDeclaration") {
|
|
8791
|
+
if (decl.type === "FunctionDeclaration" || decl.type === "ClassDeclaration" || decl.type === "StructDeclaration") {
|
|
8576
8792
|
const { id } = decl;
|
|
8577
8793
|
if (!id) throw new Error("Assertion failure");
|
|
8578
8794
|
this.checkDuplicateExports(node, id.name);
|
|
@@ -8605,8 +8821,8 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8605
8821
|
this.expect(8);
|
|
8606
8822
|
if (this.eat(4)) break;
|
|
8607
8823
|
}
|
|
8608
|
-
const isMaybeTypeOnly = this.isContextual(
|
|
8609
|
-
const isString = this.match(
|
|
8824
|
+
const isMaybeTypeOnly = this.isContextual(129);
|
|
8825
|
+
const isString = this.match(133);
|
|
8610
8826
|
const node = this.startNode();
|
|
8611
8827
|
node.local = this.parseModuleExportName();
|
|
8612
8828
|
nodes.push(this.parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly));
|
|
@@ -8614,13 +8830,13 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8614
8830
|
return nodes;
|
|
8615
8831
|
}
|
|
8616
8832
|
parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly) {
|
|
8617
|
-
if (this.eatContextual(
|
|
8833
|
+
if (this.eatContextual(90)) node.exported = this.parseModuleExportName();
|
|
8618
8834
|
else if (isString) node.exported = this.cloneStringLiteral(node.local);
|
|
8619
8835
|
else if (!node.exported) node.exported = this.cloneIdentifier(node.local);
|
|
8620
8836
|
return this.finishNode(node, "ExportSpecifier");
|
|
8621
8837
|
}
|
|
8622
8838
|
parseModuleExportName() {
|
|
8623
|
-
if (this.match(
|
|
8839
|
+
if (this.match(133)) {
|
|
8624
8840
|
const result = this.parseStringLiteral(this.state.value);
|
|
8625
8841
|
const surrogate = loneSurrogate.exec(result.value);
|
|
8626
8842
|
if (surrogate) this.raise(Errors.ModuleExportNameHasLoneSurrogate, result, { surrogateCharCode: surrogate[0].charCodeAt(0) });
|
|
@@ -8628,28 +8844,64 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8628
8844
|
}
|
|
8629
8845
|
return this.parseIdentifier(true);
|
|
8630
8846
|
}
|
|
8847
|
+
toNamespaceExportsFilter(specifiers) {
|
|
8848
|
+
const seen = /* @__PURE__ */ new Set();
|
|
8849
|
+
return specifiers.map((specifier) => {
|
|
8850
|
+
let name, alias, kind;
|
|
8851
|
+
if (specifier.type === "ImportSpecifier") ({imported: name, local: alias, importKind: kind} = specifier);
|
|
8852
|
+
else ({local: name, exported: alias, exportKind: kind} = specifier);
|
|
8853
|
+
const nameString = name.type === "Identifier" ? name.name : this.isStringModuleExportName(name) ? name.value : null;
|
|
8854
|
+
if (nameString !== null) {
|
|
8855
|
+
if (seen.has(nameString)) this.raise(Errors.FilteredNamespaceDuplicateName, name, { name: nameString });
|
|
8856
|
+
seen.add(nameString);
|
|
8857
|
+
}
|
|
8858
|
+
let invalid = false;
|
|
8859
|
+
if (alias.start !== name.start) {
|
|
8860
|
+
this.raise(Errors.FilteredNamespaceRename, alias);
|
|
8861
|
+
invalid = true;
|
|
8862
|
+
}
|
|
8863
|
+
if (kind === "type" || kind === "typeof") {
|
|
8864
|
+
this.raise(Errors.FilteredNamespaceTypeModifier, specifier);
|
|
8865
|
+
invalid = true;
|
|
8866
|
+
}
|
|
8867
|
+
if (invalid) return specifier;
|
|
8868
|
+
this.replaceNodeInPendingComments(specifier, name);
|
|
8869
|
+
return name;
|
|
8870
|
+
});
|
|
8871
|
+
}
|
|
8631
8872
|
checkImportPhase(node) {
|
|
8873
|
+
if (node.phase == null) return;
|
|
8632
8874
|
const { specifiers } = node;
|
|
8633
8875
|
const singleBindingType = specifiers.length === 1 ? specifiers[0].type : null;
|
|
8634
8876
|
if (node.phase === "source") {
|
|
8635
|
-
if (singleBindingType !== "ImportDefaultSpecifier") this.raise(Errors.SourcePhaseImportRequiresDefault,
|
|
8877
|
+
if (singleBindingType !== "ImportDefaultSpecifier") this.raise(Errors.SourcePhaseImportRequiresDefault, node);
|
|
8636
8878
|
} else if (node.phase === "defer") {
|
|
8637
|
-
if (singleBindingType !== "ImportNamespaceSpecifier") this.raise(Errors.DeferImportRequiresNamespace,
|
|
8879
|
+
if (singleBindingType !== "ImportNamespaceSpecifier") this.raise(Errors.DeferImportRequiresNamespace, node);
|
|
8638
8880
|
}
|
|
8639
8881
|
}
|
|
8640
8882
|
isPotentialImportPhase(isExport) {
|
|
8641
|
-
if (isExport)
|
|
8642
|
-
|
|
8883
|
+
if (isExport) {
|
|
8884
|
+
if (!this.isContextual(94)) return false;
|
|
8885
|
+
const ch = this.lookaheadCharCode();
|
|
8886
|
+
return ch === 123 || ch === 42;
|
|
8887
|
+
}
|
|
8888
|
+
return this.isContextual(102) || this.isContextual(94);
|
|
8643
8889
|
}
|
|
8644
8890
|
applyImportPhase(node, isExport, phase, loc) {
|
|
8645
|
-
if (isExport)
|
|
8891
|
+
if (isExport) {
|
|
8892
|
+
if (phase === "defer") {
|
|
8893
|
+
this.expectPlugin("deferredReexports", loc);
|
|
8894
|
+
node.phase = "defer";
|
|
8895
|
+
}
|
|
8896
|
+
return;
|
|
8897
|
+
}
|
|
8646
8898
|
if (phase === "source") {
|
|
8647
8899
|
this.expectPlugin("sourcePhaseImports", loc);
|
|
8648
8900
|
node.phase = "source";
|
|
8649
8901
|
} else if (phase === "defer") {
|
|
8650
8902
|
this.expectPlugin("deferredImportEvaluation", loc);
|
|
8651
8903
|
node.phase = "defer";
|
|
8652
|
-
} else if (this.hasPlugin("sourcePhaseImports")) node.phase = null;
|
|
8904
|
+
} else if (this.hasPlugin("sourcePhaseImports") || this.hasPlugin("deferredImportEvaluation")) node.phase = null;
|
|
8653
8905
|
}
|
|
8654
8906
|
parseMaybeImportPhase(node, isExport) {
|
|
8655
8907
|
if (!this.isPotentialImportPhase(isExport)) {
|
|
@@ -8659,7 +8911,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8659
8911
|
const phaseIdentifier = this.startNode();
|
|
8660
8912
|
const phaseIdentifierName = this.parseIdentifierName(true);
|
|
8661
8913
|
const { type } = this.state;
|
|
8662
|
-
if (tokenIsKeywordOrIdentifier(type) ? type !==
|
|
8914
|
+
if (tokenIsKeywordOrIdentifier(type) ? type !== 95 || this.lookaheadCharCode() === 102 : type !== 8) {
|
|
8663
8915
|
this.applyImportPhase(node, isExport, phaseIdentifierName, phaseIdentifier.start);
|
|
8664
8916
|
return null;
|
|
8665
8917
|
} else {
|
|
@@ -8669,18 +8921,18 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8669
8921
|
}
|
|
8670
8922
|
isPrecedingIdImportPhase(phase) {
|
|
8671
8923
|
const { type } = this.state;
|
|
8672
|
-
return tokenIsIdentifier(type) ? type !==
|
|
8924
|
+
return tokenIsIdentifier(type) ? type !== 95 || this.lookaheadCharCode() === 102 : type !== 8;
|
|
8673
8925
|
}
|
|
8674
8926
|
parseImport(node) {
|
|
8675
|
-
if (this.match(
|
|
8927
|
+
if (this.match(133)) return this.parseImportSourceAndAttributes(node);
|
|
8676
8928
|
return this.parseImportSpecifiersAndAfter(node, this.parseMaybeImportPhase(node, false));
|
|
8677
8929
|
}
|
|
8678
8930
|
parseImportSpecifiersAndAfter(node, maybeDefaultIdentifier) {
|
|
8679
8931
|
node.specifiers = [];
|
|
8680
8932
|
const parseNext = !this.maybeParseDefaultImportSpecifier(node, maybeDefaultIdentifier) || this.eat(8);
|
|
8681
8933
|
const hasStar = parseNext && this.maybeParseStarImportSpecifier(node);
|
|
8682
|
-
if (parseNext && !hasStar) this.
|
|
8683
|
-
this.expectContextual(
|
|
8934
|
+
if (parseNext && !hasStar) this.parseNamedOrFilteredImportSpecifiers(node);
|
|
8935
|
+
this.expectContextual(95);
|
|
8684
8936
|
return this.parseImportSourceAndAttributes(node);
|
|
8685
8937
|
}
|
|
8686
8938
|
parseImportSourceAndAttributes(node) {
|
|
@@ -8693,15 +8945,15 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8693
8945
|
return this.finishNode(node, "ImportDeclaration");
|
|
8694
8946
|
}
|
|
8695
8947
|
parseImportSource() {
|
|
8696
|
-
if (!this.match(
|
|
8948
|
+
if (!this.match(133)) this.unexpected();
|
|
8697
8949
|
return this.parseExprAtom();
|
|
8698
8950
|
}
|
|
8699
8951
|
parseImportSpecifierLocal(node, specifier, type) {
|
|
8700
8952
|
specifier.local = this.parseIdentifier();
|
|
8701
8953
|
node.specifiers.push(this.finishImportSpecifier(specifier, type));
|
|
8702
8954
|
}
|
|
8703
|
-
finishImportSpecifier(specifier, type
|
|
8704
|
-
this.checkLVal(specifier.local, { type },
|
|
8955
|
+
finishImportSpecifier(specifier, type) {
|
|
8956
|
+
this.checkLVal(specifier.local, { type }, 8201);
|
|
8705
8957
|
return this.finishNode(specifier, type);
|
|
8706
8958
|
}
|
|
8707
8959
|
parseImportAttributes() {
|
|
@@ -8714,10 +8966,10 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8714
8966
|
const keyName = this.state.value;
|
|
8715
8967
|
if (attrNames.has(keyName)) this.raise(Errors.ModuleAttributesWithDuplicateKeys, this.state.startLoc, { key: keyName });
|
|
8716
8968
|
attrNames.add(keyName);
|
|
8717
|
-
if (this.match(
|
|
8969
|
+
if (this.match(133)) node.key = this.parseStringLiteral(keyName);
|
|
8718
8970
|
else node.key = this.parseIdentifier(true);
|
|
8719
8971
|
this.expect(10);
|
|
8720
|
-
if (!this.match(
|
|
8972
|
+
if (!this.match(133)) throw this.raise(Errors.ModuleAttributeInvalidValue, this.state.startLoc);
|
|
8721
8973
|
node.value = this.parseStringLiteral(this.state.value);
|
|
8722
8974
|
attrs.push(this.finishNode(node, "ImportAttribute"));
|
|
8723
8975
|
} while (this.eat(8));
|
|
@@ -8749,12 +9001,28 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8749
9001
|
if (this.match(51)) {
|
|
8750
9002
|
const specifier = this.startNode();
|
|
8751
9003
|
this.next();
|
|
8752
|
-
this.expectContextual(
|
|
9004
|
+
this.expectContextual(90);
|
|
8753
9005
|
this.parseImportSpecifierLocal(node, specifier, "ImportNamespaceSpecifier");
|
|
8754
9006
|
return true;
|
|
8755
9007
|
}
|
|
8756
9008
|
return false;
|
|
8757
9009
|
}
|
|
9010
|
+
parseNamedOrFilteredImportSpecifiers(node) {
|
|
9011
|
+
const startLoc = this.state.startLoc;
|
|
9012
|
+
this.setLoc(startLoc);
|
|
9013
|
+
const specifiersStart = node.specifiers.length;
|
|
9014
|
+
this.parseNamedImportSpecifiers(node);
|
|
9015
|
+
if (this.isContextual(90)) {
|
|
9016
|
+
this.expectPlugin("namespaceImportFilter");
|
|
9017
|
+
const specifier = this.startNodeAt(startLoc);
|
|
9018
|
+
specifier.exportsFilter = this.toNamespaceExportsFilter(node.specifiers.splice(specifiersStart));
|
|
9019
|
+
this.next();
|
|
9020
|
+
this.parseImportSpecifierLocal(node, specifier, "ImportNamespaceSpecifier");
|
|
9021
|
+
return;
|
|
9022
|
+
}
|
|
9023
|
+
const isInTypeOnlyImport = node.importKind === "type" || node.importKind === "typeof";
|
|
9024
|
+
for (let i = specifiersStart; i < node.specifiers.length; i++) this.checkImportSpecifier(node.specifiers[i], isInTypeOnlyImport);
|
|
9025
|
+
}
|
|
8758
9026
|
parseNamedImportSpecifiers(node) {
|
|
8759
9027
|
let first = true;
|
|
8760
9028
|
this.expect(2);
|
|
@@ -8766,22 +9034,26 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8766
9034
|
if (this.eat(4)) break;
|
|
8767
9035
|
}
|
|
8768
9036
|
const specifier = this.startNode();
|
|
8769
|
-
const importedIsString = this.match(
|
|
8770
|
-
const isMaybeTypeOnly = this.isContextual(
|
|
9037
|
+
const importedIsString = this.match(133);
|
|
9038
|
+
const isMaybeTypeOnly = this.isContextual(129);
|
|
8771
9039
|
specifier.imported = this.parseModuleExportName();
|
|
8772
|
-
const importSpecifier = this.parseImportSpecifier(specifier, importedIsString, node.importKind === "type" || node.importKind === "typeof", isMaybeTypeOnly
|
|
9040
|
+
const importSpecifier = this.parseImportSpecifier(specifier, importedIsString, node.importKind === "type" || node.importKind === "typeof", isMaybeTypeOnly);
|
|
8773
9041
|
node.specifiers.push(importSpecifier);
|
|
8774
9042
|
}
|
|
8775
9043
|
}
|
|
8776
|
-
parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly
|
|
8777
|
-
if (this.eatContextual(
|
|
8778
|
-
else
|
|
8779
|
-
|
|
8780
|
-
|
|
8781
|
-
|
|
8782
|
-
|
|
8783
|
-
}
|
|
8784
|
-
|
|
9044
|
+
parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly) {
|
|
9045
|
+
if (this.eatContextual(90)) specifier.local = this.parseIdentifier();
|
|
9046
|
+
else specifier.local ??= this.cloneIdentifier(specifier.imported);
|
|
9047
|
+
return this.finishNode(specifier, "ImportSpecifier");
|
|
9048
|
+
}
|
|
9049
|
+
checkImportSpecifier(specifier, isInTypeOnlyImport, bindingType = 8201, checkReservedWord = true) {
|
|
9050
|
+
const { imported, local } = specifier;
|
|
9051
|
+
if (this.isStringModuleExportName(local)) throw this.raise(Errors.ImportBindingIsString, specifier, { importName: imported.value });
|
|
9052
|
+
if (checkReservedWord && local.start === imported.start) this.checkReservedWord(local.name, local.start, true, true);
|
|
9053
|
+
this.checkLVal(local, { type: "ImportSpecifier" }, bindingType);
|
|
9054
|
+
}
|
|
9055
|
+
isStringModuleExportName(node) {
|
|
9056
|
+
return node.type === "StringLiteral" || node.type === "Literal";
|
|
8785
9057
|
}
|
|
8786
9058
|
isThisParam(param) {
|
|
8787
9059
|
return param.type === "Identifier" && param.name === "this";
|
|
@@ -8903,6 +9175,15 @@ function tsIsEntityName(node) {
|
|
|
8903
9175
|
default: return false;
|
|
8904
9176
|
}
|
|
8905
9177
|
}
|
|
9178
|
+
function tsIsTypeCast(node) {
|
|
9179
|
+
switch (node.type) {
|
|
9180
|
+
case "TSAsExpression":
|
|
9181
|
+
case "TSSatisfiesExpression":
|
|
9182
|
+
case "TSNonNullExpression":
|
|
9183
|
+
case "TSTypeAssertion": return true;
|
|
9184
|
+
default: return false;
|
|
9185
|
+
}
|
|
9186
|
+
}
|
|
8906
9187
|
const ClassMemberModifiers = buildModifiersMap([
|
|
8907
9188
|
"declare",
|
|
8908
9189
|
"private",
|
|
@@ -8942,7 +9223,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
8942
9223
|
return tokenIsIdentifier(this.state.type);
|
|
8943
9224
|
}
|
|
8944
9225
|
tsTokenCanFollowModifier() {
|
|
8945
|
-
return this.match(0) || this.match(2) || this.match(51) || this.match(17) || this.match(
|
|
9226
|
+
return this.match(0) || this.match(2) || this.match(51) || this.match(17) || this.match(137) || this.isLiteralPropertyName();
|
|
8946
9227
|
}
|
|
8947
9228
|
tsNextTokenOnSameLineAndCanFollowModifier() {
|
|
8948
9229
|
this.next();
|
|
@@ -8950,7 +9231,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
8950
9231
|
return this.tsTokenCanFollowModifier();
|
|
8951
9232
|
}
|
|
8952
9233
|
tsNextTokenCanFollowModifier() {
|
|
8953
|
-
if (this.match(
|
|
9234
|
+
if (this.match(103)) {
|
|
8954
9235
|
this.next();
|
|
8955
9236
|
return this.tsTokenCanFollowModifier();
|
|
8956
9237
|
}
|
|
@@ -8960,9 +9241,15 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
8960
9241
|
if (!tokenIsIdentifier(this.state.type) && this.state.type !== 54 && this.state.type !== 71) return;
|
|
8961
9242
|
const modifier = this.state.value;
|
|
8962
9243
|
if (modifiers.has(modifier)) {
|
|
8963
|
-
if (hasSeenStaticModifier && this.match(
|
|
9244
|
+
if (hasSeenStaticModifier && this.match(103)) return;
|
|
8964
9245
|
if (stopOnStartOfClassStaticBlock && this.tsIsStartOfStaticBlocks()) return;
|
|
8965
|
-
|
|
9246
|
+
const escapedKeywordLoc = this.state.containsEsc && !tokenIsIdentifier(this.state.type) ? this.state.startLoc : null;
|
|
9247
|
+
if (escapedKeywordLoc) this.state.containsEsc = false;
|
|
9248
|
+
if (this.tsTryParse(this.tsNextTokenCanFollowModifier.bind(this))) {
|
|
9249
|
+
if (escapedKeywordLoc) this.raise(Errors.InvalidEscapedReservedWord, escapedKeywordLoc, { reservedWord: modifier });
|
|
9250
|
+
return modifier;
|
|
9251
|
+
}
|
|
9252
|
+
if (escapedKeywordLoc) this.state.containsEsc = true;
|
|
8966
9253
|
}
|
|
8967
9254
|
}
|
|
8968
9255
|
tsParseModifiers(modifiers, errorTemplate = TSErrors.InvalidModifierOnTypeMember, modified, stopOnStartOfClassStaticBlock = false) {
|
|
@@ -9054,7 +9341,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9054
9341
|
const node = this.startNode();
|
|
9055
9342
|
this.expect(79);
|
|
9056
9343
|
this.expect(6);
|
|
9057
|
-
if (!this.match(
|
|
9344
|
+
if (!this.match(133)) {
|
|
9058
9345
|
this.raise(TSErrors.UnsupportedImportTypeArgument, this.state.startLoc);
|
|
9059
9346
|
node.source = this.tsParseNonConditionalType();
|
|
9060
9347
|
} else node.source = this.parseStringLiteral(this.state.value);
|
|
@@ -9088,7 +9375,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9088
9375
|
this.expect(2);
|
|
9089
9376
|
while (!this.match(4)) {
|
|
9090
9377
|
const type = this.state.type;
|
|
9091
|
-
if (tokenIsIdentifier(type) || type ===
|
|
9378
|
+
if (tokenIsIdentifier(type) || type === 133) properties.push(super.parsePropertyDefinition(null));
|
|
9092
9379
|
else this.unexpected();
|
|
9093
9380
|
this.eat(8);
|
|
9094
9381
|
}
|
|
@@ -9178,7 +9465,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9178
9465
|
}
|
|
9179
9466
|
tsParseTypeParameters(parseModifiers) {
|
|
9180
9467
|
const node = this.startNode();
|
|
9181
|
-
if (this.match(43) || this.match(
|
|
9468
|
+
if (this.match(43) || this.match(141)) this.next();
|
|
9182
9469
|
else this.unexpected();
|
|
9183
9470
|
const refTrailingCommaPos = { value: -1 };
|
|
9184
9471
|
node.params = this.tsParseBracketedList("TypeParametersOrArguments", this.tsParseTypeParameter.bind(this, parseModifiers), false, true, refTrailingCommaPos);
|
|
@@ -9302,8 +9589,8 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9302
9589
|
}
|
|
9303
9590
|
tsIsStartOfMappedType() {
|
|
9304
9591
|
this.next();
|
|
9305
|
-
if (this.eat(49)) return this.isContextual(
|
|
9306
|
-
if (this.isContextual(
|
|
9592
|
+
if (this.eat(49)) return this.isContextual(121);
|
|
9593
|
+
if (this.isContextual(121)) this.next();
|
|
9307
9594
|
if (!this.match(0)) return false;
|
|
9308
9595
|
this.next();
|
|
9309
9596
|
if (!this.tsIsIdentifier()) return false;
|
|
@@ -9316,12 +9603,12 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9316
9603
|
if (this.match(49)) {
|
|
9317
9604
|
node.readonly = this.state.value;
|
|
9318
9605
|
this.next();
|
|
9319
|
-
this.expectContextual(
|
|
9320
|
-
} else if (this.eatContextual(
|
|
9606
|
+
this.expectContextual(121);
|
|
9607
|
+
} else if (this.eatContextual(121)) node.readonly = true;
|
|
9321
9608
|
this.expect(0);
|
|
9322
9609
|
node.key = this.tsParseTypeParameterName();
|
|
9323
9610
|
node.constraint = this.tsExpectThenParseType(54);
|
|
9324
|
-
node.nameType = this.eatContextual(
|
|
9611
|
+
node.nameType = this.eatContextual(90) ? this.tsParseType() : null;
|
|
9325
9612
|
this.expect(1);
|
|
9326
9613
|
if (this.match(49)) {
|
|
9327
9614
|
node.optional = this.state.value;
|
|
@@ -9430,9 +9717,9 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9430
9717
|
tsParseLiteralTypeNode() {
|
|
9431
9718
|
const node = this.startNode();
|
|
9432
9719
|
switch (this.state.type) {
|
|
9433
|
-
case
|
|
9434
|
-
case
|
|
9435
|
-
case
|
|
9720
|
+
case 134:
|
|
9721
|
+
case 135:
|
|
9722
|
+
case 133:
|
|
9436
9723
|
case 81:
|
|
9437
9724
|
case 82:
|
|
9438
9725
|
node.literal = super.parseExprAtom();
|
|
@@ -9471,21 +9758,21 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9471
9758
|
}
|
|
9472
9759
|
tsParseThisTypeOrThisTypePredicate() {
|
|
9473
9760
|
const thisKeyword = this.tsParseThisTypeNode();
|
|
9474
|
-
if (this.isContextual(
|
|
9761
|
+
if (this.isContextual(115) && !this.hasPrecedingLineBreak()) return this.tsParseThisTypePredicate(thisKeyword);
|
|
9475
9762
|
else return thisKeyword;
|
|
9476
9763
|
}
|
|
9477
9764
|
tsParseNonArrayType() {
|
|
9478
9765
|
switch (this.state.type) {
|
|
9479
|
-
case
|
|
9480
|
-
case
|
|
9481
|
-
case
|
|
9766
|
+
case 133:
|
|
9767
|
+
case 134:
|
|
9768
|
+
case 135:
|
|
9482
9769
|
case 81:
|
|
9483
9770
|
case 82: return this.tsParseLiteralTypeNode();
|
|
9484
9771
|
case 49:
|
|
9485
9772
|
if (this.state.value === "-") {
|
|
9486
9773
|
const node = this.startNode();
|
|
9487
9774
|
const nextToken = this.lookahead();
|
|
9488
|
-
if (nextToken.type !==
|
|
9775
|
+
if (nextToken.type !== 134 && nextToken.type !== 135) this.unexpected();
|
|
9489
9776
|
node.literal = this.parseMaybeUnary();
|
|
9490
9777
|
return this.finishNode(node, "TSLiteralType");
|
|
9491
9778
|
}
|
|
@@ -9558,7 +9845,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9558
9845
|
}
|
|
9559
9846
|
tsParseInferType() {
|
|
9560
9847
|
const node = this.startNode();
|
|
9561
|
-
this.expectContextual(
|
|
9848
|
+
this.expectContextual(114);
|
|
9562
9849
|
const typeParameter = this.startNode();
|
|
9563
9850
|
typeParameter.name = this.tsParseTypeParameterName();
|
|
9564
9851
|
typeParameter.constraint = this.tsTryParse(() => this.tsParseConstraintForInferType());
|
|
@@ -9572,7 +9859,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9572
9859
|
}
|
|
9573
9860
|
}
|
|
9574
9861
|
tsParseTypeOperatorOrHigher() {
|
|
9575
|
-
return tokenIsTSTypeOperator(this.state.type) && !this.state.containsEsc ? this.tsParseTypeOperator() : this.isContextual(
|
|
9862
|
+
return tokenIsTSTypeOperator(this.state.type) && !this.state.containsEsc ? this.tsParseTypeOperator() : this.isContextual(114) ? this.tsParseInferType() : this.tsInAllowConditionalTypesContext(() => this.tsParseArrayTypeOrHigher());
|
|
9576
9863
|
}
|
|
9577
9864
|
tsParseUnionOrIntersectionType(kind, parseConstituentType, operator) {
|
|
9578
9865
|
const node = this.startNode();
|
|
@@ -9600,24 +9887,18 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9600
9887
|
this.next();
|
|
9601
9888
|
return true;
|
|
9602
9889
|
}
|
|
9603
|
-
|
|
9890
|
+
const isObjectPattern = this.match(2);
|
|
9891
|
+
if (isObjectPattern || this.match(0)) {
|
|
9892
|
+
if (!isObjectPattern) this.next();
|
|
9604
9893
|
const { errors } = this.state;
|
|
9605
9894
|
const previousErrorCount = errors.length;
|
|
9895
|
+
const scopeStacksSnapshot = this.snapshotScopeStacks();
|
|
9606
9896
|
try {
|
|
9607
|
-
this.parseObjectLike(4, true);
|
|
9608
|
-
|
|
9609
|
-
} catch {
|
|
9610
|
-
return false;
|
|
9611
|
-
}
|
|
9612
|
-
}
|
|
9613
|
-
if (this.match(0)) {
|
|
9614
|
-
this.next();
|
|
9615
|
-
const { errors } = this.state;
|
|
9616
|
-
const previousErrorCount = errors.length;
|
|
9617
|
-
try {
|
|
9618
|
-
super.parseBindingList(1, 93, 1);
|
|
9897
|
+
if (isObjectPattern) this.parseObjectLike(4, true);
|
|
9898
|
+
else super.parseBindingList(1, 93, 1);
|
|
9619
9899
|
return errors.length === previousErrorCount;
|
|
9620
9900
|
} catch {
|
|
9901
|
+
this.restoreScopeStacks(scopeStacksSnapshot);
|
|
9621
9902
|
return false;
|
|
9622
9903
|
}
|
|
9623
9904
|
}
|
|
@@ -9683,13 +9964,13 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9683
9964
|
}
|
|
9684
9965
|
tsParseTypePredicatePrefix() {
|
|
9685
9966
|
const id = this.parseIdentifier();
|
|
9686
|
-
if (this.isContextual(
|
|
9967
|
+
if (this.isContextual(115) && !this.hasPrecedingLineBreak()) {
|
|
9687
9968
|
this.next();
|
|
9688
9969
|
return id;
|
|
9689
9970
|
}
|
|
9690
9971
|
}
|
|
9691
9972
|
tsParseTypePredicateAsserts() {
|
|
9692
|
-
if (this.state.type !==
|
|
9973
|
+
if (this.state.type !== 108) return false;
|
|
9693
9974
|
const containsEsc = this.state.containsEsc;
|
|
9694
9975
|
this.next();
|
|
9695
9976
|
if (!tokenIsIdentifier(this.state.type) && !this.match(74)) return false;
|
|
@@ -9717,7 +9998,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9717
9998
|
return this.finishNode(node, "TSConditionalType");
|
|
9718
9999
|
}
|
|
9719
10000
|
isAbstractConstructorSignature() {
|
|
9720
|
-
return this.isContextual(
|
|
10001
|
+
return this.isContextual(123) && this.isLookaheadContextual("new");
|
|
9721
10002
|
}
|
|
9722
10003
|
tsParseNonConditionalType() {
|
|
9723
10004
|
if (this.tsIsStartOfFunctionType()) return this.tsParseFunctionOrConstructorType("TSFunctionType");
|
|
@@ -9733,6 +10014,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9733
10014
|
return this.match(71) ? this.tsParseTypeReference() : this.tsParseType();
|
|
9734
10015
|
});
|
|
9735
10016
|
this.expect(44);
|
|
10017
|
+
this.state.canStartArrow = false;
|
|
9736
10018
|
node.expression = this.parseMaybeUnary();
|
|
9737
10019
|
return this.finishNode(node, "TSTypeAssertion");
|
|
9738
10020
|
}
|
|
@@ -9756,7 +10038,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9756
10038
|
}
|
|
9757
10039
|
tsParseInterfaceDeclaration(node, properties = {}) {
|
|
9758
10040
|
if (this.hasFollowingLineBreak()) return null;
|
|
9759
|
-
this.expectContextual(
|
|
10041
|
+
this.expectContextual(128);
|
|
9760
10042
|
if (properties.declare) node.declare = true;
|
|
9761
10043
|
if (tokenIsIdentifier(this.state.type)) {
|
|
9762
10044
|
node.id = this.parseIdentifier();
|
|
@@ -9778,7 +10060,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9778
10060
|
node.typeAnnotation = this.tsInType(() => {
|
|
9779
10061
|
node.typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutModifiers);
|
|
9780
10062
|
this.expect(25);
|
|
9781
|
-
if (this.isContextual(
|
|
10063
|
+
if (this.isContextual(113) && this.lookaheadCharCode() !== 46) {
|
|
9782
10064
|
const node = this.startNode();
|
|
9783
10065
|
this.next();
|
|
9784
10066
|
return this.finishNode(node, "TSIntrinsicKeyword");
|
|
@@ -9843,14 +10125,14 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9843
10125
|
}
|
|
9844
10126
|
tsParseEnumMember() {
|
|
9845
10127
|
const node = this.startNode();
|
|
9846
|
-
node.id = this.match(
|
|
10128
|
+
node.id = this.match(133) ? super.parseStringLiteral(this.state.value) : this.parseIdentifier(true);
|
|
9847
10129
|
if (this.eat(25)) node.initializer = super.parseMaybeAssignAllowIn();
|
|
9848
10130
|
return this.finishNode(node, "TSEnumMember");
|
|
9849
10131
|
}
|
|
9850
10132
|
tsParseEnumDeclaration(node, properties = {}) {
|
|
9851
10133
|
if (properties.const) node.const = true;
|
|
9852
10134
|
if (properties.declare) node.declare = true;
|
|
9853
|
-
this.expectContextual(
|
|
10135
|
+
this.expectContextual(125);
|
|
9854
10136
|
node.id = this.parseIdentifier();
|
|
9855
10137
|
this.checkIdentifier(node.id, node.const ? 8971 : 8459);
|
|
9856
10138
|
node.body = this.tsParseEnumBody();
|
|
@@ -9882,14 +10164,14 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9882
10164
|
return this.finishNode(node, "TSModuleDeclaration");
|
|
9883
10165
|
}
|
|
9884
10166
|
tsParseAmbientExternalModuleDeclaration(node) {
|
|
9885
|
-
const isGlobal = this.isContextual(
|
|
10167
|
+
const isGlobal = this.isContextual(111);
|
|
9886
10168
|
if (isGlobal) {
|
|
9887
10169
|
node.kind = "global";
|
|
9888
10170
|
node.id = this.parseIdentifier();
|
|
9889
10171
|
} else {
|
|
9890
10172
|
node.kind = "module";
|
|
9891
10173
|
const { type, value } = this.state;
|
|
9892
|
-
if (type ===
|
|
10174
|
+
if (type === 133) node.id = super.parseStringLiteral(value);
|
|
9893
10175
|
else if (tokenIsIdentifier(type)) {
|
|
9894
10176
|
this.raise(TSErrors.InlineModuleDeclarationMustUseString, this.state.startLoc);
|
|
9895
10177
|
node.id = this.tsParseEntityName(0);
|
|
@@ -9919,16 +10201,16 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9919
10201
|
return this.finishNode(node, "TSImportEqualsDeclaration");
|
|
9920
10202
|
}
|
|
9921
10203
|
tsIsExternalModuleReference() {
|
|
9922
|
-
return this.isContextual(
|
|
10204
|
+
return this.isContextual(118) && this.lookaheadCharCode() === 40;
|
|
9923
10205
|
}
|
|
9924
10206
|
tsParseModuleReference() {
|
|
9925
10207
|
return this.tsIsExternalModuleReference() ? this.tsParseExternalModuleReference() : this.tsParseEntityName(0);
|
|
9926
10208
|
}
|
|
9927
10209
|
tsParseExternalModuleReference() {
|
|
9928
10210
|
const node = this.startNode();
|
|
9929
|
-
this.expectContextual(
|
|
10211
|
+
this.expectContextual(118);
|
|
9930
10212
|
this.expect(6);
|
|
9931
|
-
if (!this.match(
|
|
10213
|
+
if (!this.match(133)) this.unexpected();
|
|
9932
10214
|
node.expression = super.parseExprAtom();
|
|
9933
10215
|
this.expect(7);
|
|
9934
10216
|
this.sawUnambiguousESM = true;
|
|
@@ -9959,13 +10241,13 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9959
10241
|
switch (startType) {
|
|
9960
10242
|
case 64:
|
|
9961
10243
|
node.declare = true;
|
|
9962
|
-
return super.parseFunctionStatement(node, false,
|
|
10244
|
+
return super.parseFunctionStatement(node, false, 2);
|
|
9963
10245
|
case 76:
|
|
9964
10246
|
node.declare = true;
|
|
9965
10247
|
return this.parseClass(node, true, false);
|
|
9966
|
-
case
|
|
9967
|
-
case
|
|
9968
|
-
case
|
|
10248
|
+
case 125: return this.tsParseEnumDeclaration(node, { declare: true });
|
|
10249
|
+
case 111: return this.tsParseAmbientExternalModuleDeclaration(node);
|
|
10250
|
+
case 97: if (this.state.containsEsc) return;
|
|
9969
10251
|
case 71:
|
|
9970
10252
|
case 70:
|
|
9971
10253
|
if (!this.match(71) || !this.isLookaheadContextual("enum")) {
|
|
@@ -9977,14 +10259,14 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9977
10259
|
const: true,
|
|
9978
10260
|
declare: true
|
|
9979
10261
|
});
|
|
9980
|
-
case
|
|
10262
|
+
case 106:
|
|
9981
10263
|
if (this.isUsing()) {
|
|
9982
10264
|
this.raise(TSErrors.InvalidModifierOnUsingDeclaration, this.state.startLoc, "declare");
|
|
9983
10265
|
node.declare = true;
|
|
9984
10266
|
return this.parseVarStatement(node, "using", true);
|
|
9985
10267
|
}
|
|
9986
10268
|
break;
|
|
9987
|
-
case
|
|
10269
|
+
case 93:
|
|
9988
10270
|
if (this.isAwaitUsing()) {
|
|
9989
10271
|
this.raise(TSErrors.InvalidModifierOnAwaitUsingDeclaration, this.state.startLoc, "declare");
|
|
9990
10272
|
node.declare = true;
|
|
@@ -9992,7 +10274,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9992
10274
|
return this.parseVarStatement(node, "await using", true);
|
|
9993
10275
|
}
|
|
9994
10276
|
break;
|
|
9995
|
-
case
|
|
10277
|
+
case 128: {
|
|
9996
10278
|
const result = this.tsParseInterfaceDeclaration(node, { declare: true });
|
|
9997
10279
|
if (result) return result;
|
|
9998
10280
|
}
|
|
@@ -10005,19 +10287,19 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10005
10287
|
}
|
|
10006
10288
|
tsParseDeclaration(node, type, next, decorators) {
|
|
10007
10289
|
switch (type) {
|
|
10008
|
-
case
|
|
10290
|
+
case 123:
|
|
10009
10291
|
if (this.tsCheckLineTerminator(next) && (this.match(76) || tokenIsIdentifier(this.state.type))) return this.tsParseAbstractDeclaration(node, decorators);
|
|
10010
10292
|
break;
|
|
10011
|
-
case
|
|
10293
|
+
case 126:
|
|
10012
10294
|
if (this.tsCheckLineTerminator(next)) return this.tsParseAmbientExternalModuleDeclaration(node);
|
|
10013
10295
|
break;
|
|
10014
|
-
case
|
|
10296
|
+
case 127:
|
|
10015
10297
|
if (this.tsCheckLineTerminator(next) && tokenIsIdentifier(this.state.type)) {
|
|
10016
10298
|
node.kind = "namespace";
|
|
10017
10299
|
return this.tsParseNamespaceDeclaration(node);
|
|
10018
10300
|
}
|
|
10019
10301
|
break;
|
|
10020
|
-
case
|
|
10302
|
+
case 129: if (this.tsCheckLineTerminator(next) && tokenIsIdentifier(this.state.type)) return this.tsParseTypeAliasDeclaration(node);
|
|
10021
10303
|
}
|
|
10022
10304
|
}
|
|
10023
10305
|
tsCheckLineTerminator(next) {
|
|
@@ -10078,7 +10360,6 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10078
10360
|
if (accessibility || readonly || override) {
|
|
10079
10361
|
const pp = startLoc ? this.startNodeAt(startLoc) : this.startNodeAtNode(decorators[0]);
|
|
10080
10362
|
if (decorators.length) pp.decorators = decorators;
|
|
10081
|
-
else this.setLoc(startLoc);
|
|
10082
10363
|
if (accessibility) pp.accessibility = accessibility;
|
|
10083
10364
|
if (readonly) pp.readonly = readonly;
|
|
10084
10365
|
if (override) pp.override = override;
|
|
@@ -10182,7 +10463,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10182
10463
|
return this.finishCallExpression(node, state.optionalChainMember);
|
|
10183
10464
|
}
|
|
10184
10465
|
const tokenType = this.state.type;
|
|
10185
|
-
if (tokenType === 44 || tokenType === 48 || tokenType !== 6 && tokenType !==
|
|
10466
|
+
if (tokenType === 44 || tokenType === 48 || tokenType !== 6 && tokenType !== 90 && tokenType !== 119 && tokenCanStartExpression(tokenType) && !this.hasPrecedingLineBreak()) return;
|
|
10186
10467
|
const node = this.startNodeAt(startLoc);
|
|
10187
10468
|
node.expression = base;
|
|
10188
10469
|
node.typeArguments = typeArguments;
|
|
@@ -10209,7 +10490,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10209
10490
|
}
|
|
10210
10491
|
parseExprOp(left, leftStartLoc, minPrec) {
|
|
10211
10492
|
let isSatisfies;
|
|
10212
|
-
if (tokenOperatorPrecedence(54) > minPrec && !this.hasPrecedingLineBreak() && (this.isContextual(
|
|
10493
|
+
if (tokenOperatorPrecedence(54) > minPrec && !this.hasPrecedingLineBreak() && (this.isContextual(90) || (isSatisfies = this.isContextual(119)))) {
|
|
10213
10494
|
const node = this.startNodeAt(leftStartLoc);
|
|
10214
10495
|
node.expression = left;
|
|
10215
10496
|
node.typeAnnotation = this.tsInType(() => {
|
|
@@ -10232,7 +10513,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10232
10513
|
checkDuplicateExports() {}
|
|
10233
10514
|
isPotentialImportPhase(isExport) {
|
|
10234
10515
|
if (super.isPotentialImportPhase(isExport)) return true;
|
|
10235
|
-
if (this.isContextual(
|
|
10516
|
+
if (this.isContextual(129)) {
|
|
10236
10517
|
const ch = this.lookaheadCharCode();
|
|
10237
10518
|
return isExport ? ch === 123 || ch === 42 : ch !== 61;
|
|
10238
10519
|
}
|
|
@@ -10244,7 +10525,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10244
10525
|
else node.importKind = phase === "type" || phase === "typeof" ? phase : "value";
|
|
10245
10526
|
}
|
|
10246
10527
|
parseImport(node) {
|
|
10247
|
-
if (this.match(
|
|
10528
|
+
if (this.match(133)) {
|
|
10248
10529
|
node.importKind = "value";
|
|
10249
10530
|
if (this.scope.inTSNamespace) this.raise(TSErrors.ImportInTSNamespace, node);
|
|
10250
10531
|
return super.parseImport(node);
|
|
@@ -10255,7 +10536,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10255
10536
|
const result = this.tsParseImportEqualsDeclaration(node);
|
|
10256
10537
|
if (this.scope.inTSNamespace && result.moduleReference.type === "TSExternalModuleReference") this.raise(TSErrors.ImportInTSNamespace, node);
|
|
10257
10538
|
return result;
|
|
10258
|
-
} else if (this.isContextual(
|
|
10539
|
+
} else if (this.isContextual(129)) {
|
|
10259
10540
|
const maybeDefaultIdentifier = this.parseMaybeImportPhase(node, false);
|
|
10260
10541
|
if (this.lookaheadCharCode() === 61) {
|
|
10261
10542
|
if (this.scope.inTSNamespace) this.raise(TSErrors.ImportInTSNamespace, node);
|
|
@@ -10271,7 +10552,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10271
10552
|
const nodeImportEquals = this.startNode();
|
|
10272
10553
|
this.next();
|
|
10273
10554
|
let maybeDefaultIdentifier = null;
|
|
10274
|
-
if (this.isContextual(
|
|
10555
|
+
if (this.isContextual(129) && this.isPotentialImportPhase(false)) maybeDefaultIdentifier = this.parseMaybeImportPhase(nodeImportEquals, false);
|
|
10275
10556
|
else nodeImportEquals.importKind = "value";
|
|
10276
10557
|
const declaration = this.tsParseImportEqualsDeclaration(nodeImportEquals, maybeDefaultIdentifier);
|
|
10277
10558
|
node.attributes = [];
|
|
@@ -10287,9 +10568,9 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10287
10568
|
this.sawUnambiguousESM = true;
|
|
10288
10569
|
if (this.scope.inTSNamespace) this.raise(TSErrors.ExportAssignmentInTSNamespace, assign);
|
|
10289
10570
|
return this.finishNode(assign, "TSExportAssignment");
|
|
10290
|
-
} else if (this.eatContextual(
|
|
10571
|
+
} else if (this.eatContextual(90)) {
|
|
10291
10572
|
const decl = node;
|
|
10292
|
-
this.expectContextual(
|
|
10573
|
+
this.expectContextual(127);
|
|
10293
10574
|
decl.id = this.parseIdentifier();
|
|
10294
10575
|
this.checkIdentifier(decl.id, 8201);
|
|
10295
10576
|
this.semicolon();
|
|
@@ -10302,7 +10583,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10302
10583
|
}
|
|
10303
10584
|
}
|
|
10304
10585
|
isAbstractClass() {
|
|
10305
|
-
return this.isContextual(
|
|
10586
|
+
return this.isContextual(123) && this.isLookaheadContextual("class");
|
|
10306
10587
|
}
|
|
10307
10588
|
parseExportDefaultExpression() {
|
|
10308
10589
|
if (this.isAbstractClass()) {
|
|
@@ -10311,7 +10592,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10311
10592
|
cls.abstract = true;
|
|
10312
10593
|
return this.parseClass(cls, true, true);
|
|
10313
10594
|
}
|
|
10314
|
-
if (this.match(
|
|
10595
|
+
if (this.match(128)) {
|
|
10315
10596
|
const result = this.tsParseInterfaceDeclaration(this.startNode());
|
|
10316
10597
|
if (result) return result;
|
|
10317
10598
|
}
|
|
@@ -10347,31 +10628,31 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10347
10628
|
return this.tsParseEnumDeclaration(node, { const: true });
|
|
10348
10629
|
}
|
|
10349
10630
|
break;
|
|
10350
|
-
case
|
|
10351
|
-
case
|
|
10631
|
+
case 123:
|
|
10632
|
+
case 124:
|
|
10352
10633
|
if (this.nextTokenIsIdentifierAndNotTSRelationalOperatorOnSameLine()) {
|
|
10353
10634
|
const token = this.state.type;
|
|
10354
10635
|
const node = this.startNode();
|
|
10355
10636
|
this.next();
|
|
10356
|
-
const declaration = token ===
|
|
10637
|
+
const declaration = token === 124 ? this.tsTryParseDeclare(node) : this.tsParseAbstractDeclaration(node, decorators);
|
|
10357
10638
|
if (declaration) {
|
|
10358
|
-
if (token ===
|
|
10639
|
+
if (token === 124) declaration.declare = true;
|
|
10359
10640
|
return declaration;
|
|
10360
10641
|
} else {
|
|
10361
|
-
node.expression = this.createIdentifier(this.startNodeAtNode(node), token ===
|
|
10642
|
+
node.expression = this.createIdentifier(this.startNodeAtNode(node), token === 124 ? "declare" : "abstract");
|
|
10362
10643
|
this.semicolon(false);
|
|
10363
10644
|
return this.finishNode(node, "ExpressionStatement");
|
|
10364
10645
|
}
|
|
10365
10646
|
}
|
|
10366
10647
|
break;
|
|
10367
|
-
case
|
|
10368
|
-
case
|
|
10648
|
+
case 125: return this.tsParseEnumDeclaration(this.startNode());
|
|
10649
|
+
case 111:
|
|
10369
10650
|
if (this.lookaheadCharCode() === 123) {
|
|
10370
10651
|
const node = this.startNode();
|
|
10371
10652
|
return this.tsParseAmbientExternalModuleDeclaration(node);
|
|
10372
10653
|
}
|
|
10373
10654
|
break;
|
|
10374
|
-
case
|
|
10655
|
+
case 128: {
|
|
10375
10656
|
const result = this.tsParseInterfaceDeclaration(this.startNode());
|
|
10376
10657
|
if (result) {
|
|
10377
10658
|
if (!allowDeclaration) this.raise(TSErrors.UnexpectedTypeDeclaration, result, "interface");
|
|
@@ -10379,26 +10660,26 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10379
10660
|
}
|
|
10380
10661
|
break;
|
|
10381
10662
|
}
|
|
10382
|
-
case
|
|
10663
|
+
case 126:
|
|
10383
10664
|
if (this.nextTokenIsStringLiteralOnSameLine()) {
|
|
10384
10665
|
const node = this.startNode();
|
|
10385
10666
|
this.next();
|
|
10386
|
-
return this.tsParseDeclaration(node,
|
|
10667
|
+
return this.tsParseDeclaration(node, 126, false, decorators);
|
|
10387
10668
|
} else if (this.nextTokenIsIdentifierOnSameLine()) {
|
|
10388
10669
|
this.raise(TSErrors.InlineModuleDeclarationMustUseString, this.state.startLoc);
|
|
10389
10670
|
const node = this.startNode();
|
|
10390
10671
|
this.next();
|
|
10391
|
-
return this.tsParseDeclaration(node,
|
|
10672
|
+
return this.tsParseDeclaration(node, 127, false, decorators);
|
|
10392
10673
|
}
|
|
10393
10674
|
break;
|
|
10394
|
-
case
|
|
10675
|
+
case 127:
|
|
10395
10676
|
if (this.nextTokenIsIdentifierOnSameLine()) {
|
|
10396
10677
|
const node = this.startNode();
|
|
10397
10678
|
this.next();
|
|
10398
|
-
return this.tsParseDeclaration(node,
|
|
10679
|
+
return this.tsParseDeclaration(node, 127, false, decorators);
|
|
10399
10680
|
}
|
|
10400
10681
|
break;
|
|
10401
|
-
case
|
|
10682
|
+
case 129: if (this.nextTokenIsIdentifierOnSameLine()) {
|
|
10402
10683
|
const node = this.startNode();
|
|
10403
10684
|
if (!allowDeclaration) this.raise(TSErrors.UnexpectedTypeDeclaration, node, "type");
|
|
10404
10685
|
this.next();
|
|
@@ -10417,7 +10698,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10417
10698
|
});
|
|
10418
10699
|
}
|
|
10419
10700
|
tsIsStartOfStaticBlocks() {
|
|
10420
|
-
return this.isContextual(
|
|
10701
|
+
return this.isContextual(103) && this.lookaheadCharCode() === 123;
|
|
10421
10702
|
}
|
|
10422
10703
|
parseClassMember(classBody, member, state) {
|
|
10423
10704
|
this.tsParseModifiers(ClassMemberModifiers, TSErrors.InvalidModifierOnTypeParameterPositions, member, true);
|
|
@@ -10505,10 +10786,10 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10505
10786
|
return node;
|
|
10506
10787
|
}
|
|
10507
10788
|
parseExportDeclaration(node) {
|
|
10508
|
-
if (!this.state.isAmbientContext && this.isContextual(
|
|
10789
|
+
if (!this.state.isAmbientContext && this.isContextual(124)) return this.tsInAmbientContext(() => this.parseExportDeclaration(node));
|
|
10509
10790
|
const startLoc = this.state.startLoc;
|
|
10510
|
-
const isDeclare = this.eatContextual(
|
|
10511
|
-
if (isDeclare && (this.isContextual(
|
|
10791
|
+
const isDeclare = this.eatContextual(124);
|
|
10792
|
+
if (isDeclare && (this.isContextual(124) || !this.shouldParseExportDeclaration())) throw this.raise(TSErrors.ExpectedAmbientAfterExportDeclare, this.state.startLoc);
|
|
10512
10793
|
const declaration = tokenIsIdentifier(this.state.type) && this.tsTryParseExportDeclaration() || super.parseExportDeclaration(node);
|
|
10513
10794
|
if (!declaration) return null;
|
|
10514
10795
|
if (declaration.type === "TSInterfaceDeclaration" || declaration.type === "TSTypeAliasDeclaration" || isDeclare) node.exportKind = "type";
|
|
@@ -10519,7 +10800,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10519
10800
|
return declaration;
|
|
10520
10801
|
}
|
|
10521
10802
|
parseClassId(node, isStatement, optionalId, bindingType) {
|
|
10522
|
-
if ((!isStatement || optionalId) && this.isContextual(
|
|
10803
|
+
if ((!isStatement || optionalId) && this.isContextual(112)) {
|
|
10523
10804
|
node.id = null;
|
|
10524
10805
|
return;
|
|
10525
10806
|
}
|
|
@@ -10590,7 +10871,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10590
10871
|
node.superTypeArguments = superTypeArguments;
|
|
10591
10872
|
} else if (this.match(43) || this.match(47)) node.superTypeArguments = this.tsParseTypeArgumentsInExpression();
|
|
10592
10873
|
}
|
|
10593
|
-
if (this.eatContextual(
|
|
10874
|
+
if (this.eatContextual(112)) node.implements = this.tsParseHeritageClause("implements");
|
|
10594
10875
|
}
|
|
10595
10876
|
parseObjPropValue(prop, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors) {
|
|
10596
10877
|
const typeParameters = this.tsTryParseTypeParameters(this.tsParseConstModifier);
|
|
@@ -10619,7 +10900,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10619
10900
|
let state;
|
|
10620
10901
|
let jsx;
|
|
10621
10902
|
let typeCast;
|
|
10622
|
-
if (this.hasPlugin("jsx") && (this.match(
|
|
10903
|
+
if (this.hasPlugin("jsx") && (this.match(141) || this.match(43))) {
|
|
10623
10904
|
state = this.state.clone();
|
|
10624
10905
|
jsx = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, isParenItem), state);
|
|
10625
10906
|
if (!jsx.error) return jsx.node;
|
|
@@ -10703,44 +10984,27 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10703
10984
|
}
|
|
10704
10985
|
}
|
|
10705
10986
|
toAssignable(node, isLHS = false) {
|
|
10987
|
+
if (tsIsTypeCast(node)) {
|
|
10988
|
+
if (isLHS) this.expressionScope.recordArrowParameterBindingError(TSErrors.UnexpectedTypeCastInParameter, node);
|
|
10989
|
+
else this.raiseOnce(TSErrors.UnexpectedTypeCastInParameter, node);
|
|
10990
|
+
this.toAssignable(node.expression, isLHS);
|
|
10991
|
+
return;
|
|
10992
|
+
}
|
|
10706
10993
|
switch (node.type) {
|
|
10707
10994
|
case "ParenthesizedExpression":
|
|
10708
10995
|
this.toAssignableParenthesizedExpression(node, isLHS);
|
|
10709
10996
|
break;
|
|
10710
|
-
case "TSAsExpression":
|
|
10711
|
-
case "TSSatisfiesExpression":
|
|
10712
|
-
case "TSNonNullExpression":
|
|
10713
|
-
case "TSTypeAssertion":
|
|
10714
|
-
if (isLHS) this.expressionScope.recordArrowParameterBindingError(TSErrors.UnexpectedTypeCastInParameter, node);
|
|
10715
|
-
else this.raise(TSErrors.UnexpectedTypeCastInParameter, node);
|
|
10716
|
-
this.toAssignable(node.expression, isLHS);
|
|
10717
|
-
break;
|
|
10718
10997
|
case "AssignmentExpression": if (!isLHS && node.left.type === "TSTypeCastExpression") node.left = this.typeCastToParameter(node.left);
|
|
10719
10998
|
default: super.toAssignable(node, isLHS);
|
|
10720
10999
|
}
|
|
10721
11000
|
}
|
|
10722
11001
|
toAssignableParenthesizedExpression(node, isLHS) {
|
|
10723
|
-
|
|
10724
|
-
|
|
10725
|
-
case "TSSatisfiesExpression":
|
|
10726
|
-
case "TSNonNullExpression":
|
|
10727
|
-
case "TSTypeAssertion":
|
|
10728
|
-
case "ParenthesizedExpression":
|
|
10729
|
-
this.toAssignable(node.expression, isLHS);
|
|
10730
|
-
break;
|
|
10731
|
-
default: super.toAssignable(node, isLHS);
|
|
10732
|
-
}
|
|
11002
|
+
if (tsIsTypeCast(node.expression) || node.expression.type === "ParenthesizedExpression") this.toAssignable(node.expression, isLHS);
|
|
11003
|
+
else super.toAssignable(node, isLHS);
|
|
10733
11004
|
}
|
|
10734
11005
|
checkToRestConversion(node, allowPattern) {
|
|
10735
|
-
|
|
10736
|
-
|
|
10737
|
-
case "TSSatisfiesExpression":
|
|
10738
|
-
case "TSTypeAssertion":
|
|
10739
|
-
case "TSNonNullExpression":
|
|
10740
|
-
this.checkToRestConversion(node.expression, false);
|
|
10741
|
-
break;
|
|
10742
|
-
default: super.checkToRestConversion(node, allowPattern);
|
|
10743
|
-
}
|
|
11006
|
+
if (tsIsTypeCast(node)) this.checkToRestConversion(node.expression, false);
|
|
11007
|
+
else super.checkToRestConversion(node, allowPattern);
|
|
10744
11008
|
}
|
|
10745
11009
|
isValidLVal(type, disallowCallExpression, isUnparenthesizedInAssign, binding) {
|
|
10746
11010
|
switch (type) {
|
|
@@ -10895,7 +11159,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10895
11159
|
if (this.match(76)) {
|
|
10896
11160
|
node.abstract = true;
|
|
10897
11161
|
return this.maybeTakeDecorators(decorators, this.parseClass(node, true, false));
|
|
10898
|
-
} else if (this.isContextual(
|
|
11162
|
+
} else if (this.isContextual(128)) {
|
|
10899
11163
|
if (!this.hasFollowingLineBreak()) {
|
|
10900
11164
|
node.abstract = true;
|
|
10901
11165
|
this.raise(TSErrors.NonClassMethodPropertyHasAbstractModifier, node);
|
|
@@ -10936,20 +11200,25 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10936
11200
|
node.exportKind = "value";
|
|
10937
11201
|
return super.parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly);
|
|
10938
11202
|
}
|
|
10939
|
-
parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly
|
|
11203
|
+
parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly) {
|
|
10940
11204
|
if (!importedIsString && isMaybeTypeOnly) {
|
|
10941
|
-
this.parseTypeOnlyImportSpecifier(specifier
|
|
11205
|
+
this.parseTypeOnlyImportSpecifier(specifier);
|
|
10942
11206
|
return this.finishNode(specifier, "ImportSpecifier");
|
|
10943
11207
|
}
|
|
10944
11208
|
specifier.importKind = "value";
|
|
10945
|
-
return super.parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly
|
|
11209
|
+
return super.parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly);
|
|
10946
11210
|
}
|
|
10947
|
-
|
|
11211
|
+
checkImportSpecifier(specifier, isInTypeOnlyImport) {
|
|
11212
|
+
const hasTypeSpecifier = specifier.importKind === "type";
|
|
11213
|
+
if (hasTypeSpecifier && isInTypeOnlyImport) this.raise(TSErrors.TypeModifierIsUsedInTypeImports, specifier);
|
|
11214
|
+
super.checkImportSpecifier(specifier, isInTypeOnlyImport, hasTypeSpecifier || isInTypeOnlyImport ? 4098 : 4096);
|
|
11215
|
+
}
|
|
11216
|
+
parseTypeOnlyImportSpecifier(node) {
|
|
10948
11217
|
let leftOfAs = node.imported;
|
|
10949
11218
|
let hasTypeSpecifier = false;
|
|
10950
|
-
if (this.isContextual(
|
|
11219
|
+
if (this.isContextual(90)) {
|
|
10951
11220
|
const firstAs = this.parseIdentifier();
|
|
10952
|
-
if (this.isContextual(
|
|
11221
|
+
if (this.isContextual(90)) {
|
|
10953
11222
|
const secondAs = this.parseIdentifier();
|
|
10954
11223
|
if (tokenIsKeywordOrIdentifier(this.state.type)) {
|
|
10955
11224
|
hasTypeSpecifier = true;
|
|
@@ -10964,19 +11233,17 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10964
11233
|
} else if (tokenIsKeywordOrIdentifier(this.state.type)) {
|
|
10965
11234
|
hasTypeSpecifier = true;
|
|
10966
11235
|
leftOfAs = this.parseIdentifier(true);
|
|
10967
|
-
if (!this.isContextual(89)) this.checkReservedWord(leftOfAs.name, leftOfAs.start, true, true);
|
|
10968
11236
|
}
|
|
10969
|
-
if (hasTypeSpecifier && isInTypeOnly) this.raise(TSErrors.TypeModifierIsUsedInTypeImports, node.imported);
|
|
10970
11237
|
node.imported = leftOfAs;
|
|
10971
11238
|
node.importKind = hasTypeSpecifier ? "type" : "value";
|
|
10972
|
-
|
|
11239
|
+
node.local ??= this.eatContextual(90) ? this.parseIdentifier() : this.cloneIdentifier(node.imported);
|
|
10973
11240
|
}
|
|
10974
11241
|
parseTypeOnlyExportSpecifier(node, isInTypeOnly) {
|
|
10975
11242
|
const local = node.local;
|
|
10976
11243
|
let hasTypeSpecifier = false;
|
|
10977
|
-
if (this.isContextual(
|
|
11244
|
+
if (this.isContextual(90)) {
|
|
10978
11245
|
const firstAs = this.parseIdentifier();
|
|
10979
|
-
if (this.isContextual(
|
|
11246
|
+
if (this.isContextual(90)) {
|
|
10980
11247
|
const secondAs = this.parseIdentifier();
|
|
10981
11248
|
if (tokenIsKeywordOrIdentifier(this.state.type)) {
|
|
10982
11249
|
hasTypeSpecifier = true;
|
|
@@ -10994,7 +11261,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10994
11261
|
}
|
|
10995
11262
|
if (hasTypeSpecifier && isInTypeOnly) this.raise(TSErrors.TypeModifierIsUsedInTypeExports, local);
|
|
10996
11263
|
node.exportKind = hasTypeSpecifier ? "type" : "value";
|
|
10997
|
-
node.exported ??= this.eatContextual(
|
|
11264
|
+
node.exported ??= this.eatContextual(90) ? this.parseModuleExportName() : this.cloneIdentifier(node.local);
|
|
10998
11265
|
}
|
|
10999
11266
|
fillOptionalPropertiesForTSESLint(node) {
|
|
11000
11267
|
switch (node.type) {
|
|
@@ -11172,13 +11439,13 @@ const PlaceholderErrors = ParseErrorEnum`placeholders`({
|
|
|
11172
11439
|
});
|
|
11173
11440
|
const placeholders = (superClass) => class PlaceholdersParserMixin extends superClass {
|
|
11174
11441
|
parsePlaceholder(expectedNode) {
|
|
11175
|
-
if (this.match(
|
|
11442
|
+
if (this.match(132)) {
|
|
11176
11443
|
const node = this.startNode();
|
|
11177
11444
|
this.next();
|
|
11178
11445
|
this.assertNoSpace();
|
|
11179
11446
|
node.name = super.parseIdentifier(true);
|
|
11180
11447
|
this.assertNoSpace();
|
|
11181
|
-
this.expect(
|
|
11448
|
+
this.expect(132);
|
|
11182
11449
|
return this.finishPlaceholder(node, expectedNode);
|
|
11183
11450
|
}
|
|
11184
11451
|
}
|
|
@@ -11189,7 +11456,7 @@ const placeholders = (superClass) => class PlaceholdersParserMixin extends super
|
|
|
11189
11456
|
return placeholder;
|
|
11190
11457
|
}
|
|
11191
11458
|
getTokenFromCode(code) {
|
|
11192
|
-
if (code === 37 && this.input.charCodeAt(this.state.pos + 1) === 37) this.finishOp(
|
|
11459
|
+
if (code === 37 && this.input.charCodeAt(this.state.pos + 1) === 37) this.finishOp(132, 2);
|
|
11193
11460
|
else super.getTokenFromCode(code);
|
|
11194
11461
|
}
|
|
11195
11462
|
parseExprAtom(refExpressionErrors) {
|
|
@@ -11230,13 +11497,13 @@ const placeholders = (superClass) => class PlaceholdersParserMixin extends super
|
|
|
11230
11497
|
if (node.label?.type === "Placeholder") return;
|
|
11231
11498
|
super.verifyBreakContinue(node, isBreak);
|
|
11232
11499
|
}
|
|
11233
|
-
parseExpressionStatement(node, expr) {
|
|
11234
|
-
if (expr.type !== "Placeholder" || expr.extra?.parenthesized) return super.parseExpressionStatement(node, expr);
|
|
11500
|
+
parseExpressionStatement(node, expr, flags) {
|
|
11501
|
+
if (expr.type !== "Placeholder" || expr.extra?.parenthesized) return super.parseExpressionStatement(node, expr, flags);
|
|
11235
11502
|
if (this.match(10)) {
|
|
11236
11503
|
const stmt = node;
|
|
11237
11504
|
stmt.label = this.finishPlaceholder(expr, "Identifier");
|
|
11238
11505
|
this.next();
|
|
11239
|
-
stmt.body = super.parseStatementOrSloppyAnnexBFunctionDeclaration();
|
|
11506
|
+
stmt.body = flags & 8 ? super.parseStatementOrSloppyAnnexBFunctionDeclaration(true) : super.parseStatement();
|
|
11240
11507
|
return this.finishNode(stmt, "LabeledStatement");
|
|
11241
11508
|
}
|
|
11242
11509
|
this.semicolon();
|
|
@@ -11256,7 +11523,7 @@ const placeholders = (superClass) => class PlaceholdersParserMixin extends super
|
|
|
11256
11523
|
const oldStrict = this.state.strict;
|
|
11257
11524
|
const placeholder = this.parsePlaceholder("Identifier");
|
|
11258
11525
|
if (placeholder) {
|
|
11259
|
-
if (this.match(77) || this.match(
|
|
11526
|
+
if (this.match(77) || this.match(132) || this.match(2)) node.id = placeholder;
|
|
11260
11527
|
else if (optionalId || !isStatement) {
|
|
11261
11528
|
node.id = null;
|
|
11262
11529
|
node.body = this.finishPlaceholder(placeholder, "ClassBody");
|
|
@@ -11271,7 +11538,7 @@ const placeholders = (superClass) => class PlaceholdersParserMixin extends super
|
|
|
11271
11538
|
const placeholder = this.parsePlaceholder("Identifier");
|
|
11272
11539
|
if (!placeholder) return super.parseExport(node, decorators);
|
|
11273
11540
|
const node2 = node;
|
|
11274
|
-
if (!this.isContextual(
|
|
11541
|
+
if (!this.isContextual(95) && !this.match(8)) {
|
|
11275
11542
|
node2.specifiers = [];
|
|
11276
11543
|
node2.source = null;
|
|
11277
11544
|
node2.declaration = this.finishPlaceholder(placeholder, "Declaration");
|
|
@@ -11287,7 +11554,7 @@ const placeholders = (superClass) => class PlaceholdersParserMixin extends super
|
|
|
11287
11554
|
if (this.match(61)) {
|
|
11288
11555
|
const next = this.nextTokenStart();
|
|
11289
11556
|
if (this.isUnparsedContextual(next, "from")) {
|
|
11290
|
-
if (this.input.startsWith(tokenLabelName(
|
|
11557
|
+
if (this.input.startsWith(tokenLabelName(132), this.hasPlugin("exportDefaultFrom") ? this.nextTokenStartSince(next + 4) : this.nextTokenInLineStartSince(next + 4))) return true;
|
|
11291
11558
|
}
|
|
11292
11559
|
}
|
|
11293
11560
|
return super.isExportDefaultSpecifier();
|
|
@@ -11301,7 +11568,7 @@ const placeholders = (superClass) => class PlaceholdersParserMixin extends super
|
|
|
11301
11568
|
const placeholder = this.parsePlaceholder("Identifier");
|
|
11302
11569
|
if (!placeholder) return super.parseImport(node);
|
|
11303
11570
|
node.specifiers = [];
|
|
11304
|
-
if (!this.isContextual(
|
|
11571
|
+
if (!this.isContextual(95) && !this.match(8)) {
|
|
11305
11572
|
node.source = this.finishPlaceholder(placeholder, "StringLiteral");
|
|
11306
11573
|
this.semicolon();
|
|
11307
11574
|
return this.finishNode(node, "ImportDeclaration");
|
|
@@ -11310,9 +11577,9 @@ const placeholders = (superClass) => class PlaceholdersParserMixin extends super
|
|
|
11310
11577
|
specifier.local = placeholder;
|
|
11311
11578
|
node.specifiers.push(this.finishNode(specifier, "ImportDefaultSpecifier"));
|
|
11312
11579
|
if (this.eat(8)) {
|
|
11313
|
-
if (!this.maybeParseStarImportSpecifier(node)) this.
|
|
11580
|
+
if (!this.maybeParseStarImportSpecifier(node)) this.parseNamedOrFilteredImportSpecifiers(node);
|
|
11314
11581
|
}
|
|
11315
|
-
this.expectContextual(
|
|
11582
|
+
this.expectContextual(95);
|
|
11316
11583
|
node.source = this.parseImportSource();
|
|
11317
11584
|
this.semicolon();
|
|
11318
11585
|
return this.finishNode(node, "ImportDeclaration");
|
|
@@ -11331,6 +11598,7 @@ const v8intrinsic = (superClass) => class V8IntrinsicMixin extends superClass {
|
|
|
11331
11598
|
const node = this.startNode();
|
|
11332
11599
|
this.next();
|
|
11333
11600
|
if (tokenIsIdentifier(this.state.type)) {
|
|
11601
|
+
this.setLoc(this.state.startLoc);
|
|
11334
11602
|
const name = this.parseIdentifierName();
|
|
11335
11603
|
const identifier = this.createIdentifier(node, name);
|
|
11336
11604
|
this.castNodeTo(identifier, "V8IntrinsicIdentifier");
|
|
@@ -11387,6 +11655,7 @@ function validatePlugins(pluginsMap) {
|
|
|
11387
11655
|
if (pluginsMap.has("discardBinding") && pluginsMap.get("discardBinding").syntaxType !== "void") throw new Error("The 'discardBinding' plugin requires a 'syntaxType' option. Currently the only supported value is 'void'.");
|
|
11388
11656
|
if (pluginsMap.has("decimal")) throw new Error("The 'decimal' plugin has been removed in Babel 8. Please remove it from your configuration.");
|
|
11389
11657
|
if (pluginsMap.has("importReflection")) throw new Error("The 'importReflection' plugin has been removed in Babel 8. Use 'sourcePhaseImports' instead, and replace 'import module' with 'import source' in your code.");
|
|
11658
|
+
if (pluginsMap.has("deferredReexports") && !pluginsMap.has("deferredImportEvaluation")) throw new Error("The 'deferredReexports' plugin requires 'deferredImportEvaluation'.");
|
|
11390
11659
|
}
|
|
11391
11660
|
const mixinPlugins = {
|
|
11392
11661
|
estree,
|
|
@@ -12867,7 +13136,7 @@ function isKeyword(word) {
|
|
|
12867
13136
|
return keywords.has(word);
|
|
12868
13137
|
}
|
|
12869
13138
|
//#endregion
|
|
12870
|
-
//#region node_modules/.pnpm/@babel+helper-string-parser@8.0.
|
|
13139
|
+
//#region node_modules/.pnpm/@babel+helper-string-parser@8.0.8/node_modules/@babel/helper-string-parser/lib/index.js
|
|
12871
13140
|
var _isDigit = function isDigit(code) {
|
|
12872
13141
|
return code >= 48 && code <= 57;
|
|
12873
13142
|
};
|
|
@@ -12880,7 +13149,9 @@ const forbiddenNumericSeparatorSiblings = {
|
|
|
12880
13149
|
95,
|
|
12881
13150
|
98,
|
|
12882
13151
|
101,
|
|
12883
|
-
111
|
|
13152
|
+
111,
|
|
13153
|
+
43,
|
|
13154
|
+
45
|
|
12884
13155
|
]),
|
|
12885
13156
|
hex: /* @__PURE__ */ new Set([
|
|
12886
13157
|
46,
|
|
@@ -13038,7 +13309,7 @@ function readInt(input, pos, lineStart, curLine, radix, len, forceLen, allowNumS
|
|
|
13038
13309
|
pos
|
|
13039
13310
|
};
|
|
13040
13311
|
errors.numericSeparatorInEscapeSequence(pos, lineStart, curLine);
|
|
13041
|
-
} else if (Number.isNaN(next) || !isAllowedSibling(next) || forbiddenSiblings.has(prev)
|
|
13312
|
+
} else if (Number.isNaN(next) || !isAllowedSibling(next) || forbiddenSiblings.has(prev)) {
|
|
13042
13313
|
if (bailOnError) return {
|
|
13043
13314
|
n: null,
|
|
13044
13315
|
pos
|
|
@@ -13098,7 +13369,7 @@ function readCodePoint(input, pos, lineStart, curLine, throwOnInvalid, errors) {
|
|
|
13098
13369
|
};
|
|
13099
13370
|
}
|
|
13100
13371
|
//#endregion
|
|
13101
|
-
//#region node_modules/.pnpm/@babel+types@8.0
|
|
13372
|
+
//#region node_modules/.pnpm/@babel+types@8.1.0/node_modules/@babel/types/lib/index.js
|
|
13102
13373
|
var lib_exports = /* @__PURE__ */ __exportAll({
|
|
13103
13374
|
ACCESSOR_TYPES: () => ACCESSOR_TYPES,
|
|
13104
13375
|
ALIAS_KEYS: () => ALIAS_KEYS,
|
|
@@ -13317,6 +13588,8 @@ var lib_exports = /* @__PURE__ */ __exportAll({
|
|
|
13317
13588
|
StringLiteral: () => StringLiteral$2,
|
|
13318
13589
|
StringLiteralTypeAnnotation: () => StringLiteralTypeAnnotation,
|
|
13319
13590
|
StringTypeAnnotation: () => StringTypeAnnotation$1,
|
|
13591
|
+
StructBody: () => StructBody,
|
|
13592
|
+
StructDeclaration: () => StructDeclaration$1,
|
|
13320
13593
|
Super: () => Super$1,
|
|
13321
13594
|
SwitchCase: () => SwitchCase$1,
|
|
13322
13595
|
SwitchStatement: () => SwitchStatement$1,
|
|
@@ -13381,7 +13654,7 @@ var lib_exports = /* @__PURE__ */ __exportAll({
|
|
|
13381
13654
|
TSTupleType: () => TSTupleType$1,
|
|
13382
13655
|
TSTypeAliasDeclaration: () => TSTypeAliasDeclaration$1,
|
|
13383
13656
|
TSTypeAnnotation: () => TSTypeAnnotation$1,
|
|
13384
|
-
TSTypeAssertion: () => TSTypeAssertion$
|
|
13657
|
+
TSTypeAssertion: () => TSTypeAssertion$2,
|
|
13385
13658
|
TSTypeLiteral: () => TSTypeLiteral$1,
|
|
13386
13659
|
TSTypeOperator: () => TSTypeOperator$2,
|
|
13387
13660
|
TSTypeParameter: () => TSTypeParameter$1,
|
|
@@ -13635,6 +13908,8 @@ var lib_exports = /* @__PURE__ */ __exportAll({
|
|
|
13635
13908
|
assertStringLiteral: () => assertStringLiteral,
|
|
13636
13909
|
assertStringLiteralTypeAnnotation: () => assertStringLiteralTypeAnnotation,
|
|
13637
13910
|
assertStringTypeAnnotation: () => assertStringTypeAnnotation,
|
|
13911
|
+
assertStructBody: () => assertStructBody,
|
|
13912
|
+
assertStructDeclaration: () => assertStructDeclaration,
|
|
13638
13913
|
assertSuper: () => assertSuper,
|
|
13639
13914
|
assertSwitchCase: () => assertSwitchCase,
|
|
13640
13915
|
assertSwitchStatement: () => assertSwitchStatement,
|
|
@@ -13876,7 +14151,7 @@ var lib_exports = /* @__PURE__ */ __exportAll({
|
|
|
13876
14151
|
isBooleanLiteralTypeAnnotation: () => isBooleanLiteralTypeAnnotation,
|
|
13877
14152
|
isBooleanTypeAnnotation: () => isBooleanTypeAnnotation$1,
|
|
13878
14153
|
isBreakStatement: () => isBreakStatement,
|
|
13879
|
-
isCallExpression: () => isCallExpression$
|
|
14154
|
+
isCallExpression: () => isCallExpression$3,
|
|
13880
14155
|
isCatchClause: () => isCatchClause,
|
|
13881
14156
|
isClass: () => isClass$1,
|
|
13882
14157
|
isClassAccessorProperty: () => isClassAccessorProperty,
|
|
@@ -13929,7 +14204,7 @@ var lib_exports = /* @__PURE__ */ __exportAll({
|
|
|
13929
14204
|
isExportDefaultDeclaration: () => isExportDefaultDeclaration$2,
|
|
13930
14205
|
isExportDefaultSpecifier: () => isExportDefaultSpecifier$1,
|
|
13931
14206
|
isExportNamedDeclaration: () => isExportNamedDeclaration$3,
|
|
13932
|
-
isExportNamespaceSpecifier: () => isExportNamespaceSpecifier$
|
|
14207
|
+
isExportNamespaceSpecifier: () => isExportNamespaceSpecifier$2,
|
|
13933
14208
|
isExportSpecifier: () => isExportSpecifier,
|
|
13934
14209
|
isExpression: () => isExpression$5,
|
|
13935
14210
|
isExpressionStatement: () => isExpressionStatement$2,
|
|
@@ -14001,7 +14276,7 @@ var lib_exports = /* @__PURE__ */ __exportAll({
|
|
|
14001
14276
|
isModuleDeclaration: () => isModuleDeclaration,
|
|
14002
14277
|
isModuleExpression: () => isModuleExpression,
|
|
14003
14278
|
isModuleSpecifier: () => isModuleSpecifier$1,
|
|
14004
|
-
isNewExpression: () => isNewExpression$
|
|
14279
|
+
isNewExpression: () => isNewExpression$1,
|
|
14005
14280
|
isNode: () => isNode,
|
|
14006
14281
|
isNodesEquivalent: () => isNodesEquivalent,
|
|
14007
14282
|
isNullLiteral: () => isNullLiteral$1,
|
|
@@ -14040,7 +14315,7 @@ var lib_exports = /* @__PURE__ */ __exportAll({
|
|
|
14040
14315
|
isReferenced: () => isReferenced$1,
|
|
14041
14316
|
isRegExpLiteral: () => isRegExpLiteral$1,
|
|
14042
14317
|
isRegexLiteral: () => isRegexLiteral,
|
|
14043
|
-
isRestElement: () => isRestElement$
|
|
14318
|
+
isRestElement: () => isRestElement$2,
|
|
14044
14319
|
isRestProperty: () => isRestProperty$1,
|
|
14045
14320
|
isReturnStatement: () => isReturnStatement,
|
|
14046
14321
|
isScopable: () => isScopable,
|
|
@@ -14055,6 +14330,8 @@ var lib_exports = /* @__PURE__ */ __exportAll({
|
|
|
14055
14330
|
isStringLiteral: () => isStringLiteral$3,
|
|
14056
14331
|
isStringLiteralTypeAnnotation: () => isStringLiteralTypeAnnotation,
|
|
14057
14332
|
isStringTypeAnnotation: () => isStringTypeAnnotation$1,
|
|
14333
|
+
isStructBody: () => isStructBody,
|
|
14334
|
+
isStructDeclaration: () => isStructDeclaration,
|
|
14058
14335
|
isSuper: () => isSuper$2,
|
|
14059
14336
|
isSwitchCase: () => isSwitchCase,
|
|
14060
14337
|
isSwitchStatement: () => isSwitchStatement,
|
|
@@ -14236,6 +14513,8 @@ var lib_exports = /* @__PURE__ */ __exportAll({
|
|
|
14236
14513
|
stringLiteral: () => stringLiteral$2,
|
|
14237
14514
|
stringLiteralTypeAnnotation: () => stringLiteralTypeAnnotation,
|
|
14238
14515
|
stringTypeAnnotation: () => stringTypeAnnotation$2,
|
|
14516
|
+
structBody: () => structBody,
|
|
14517
|
+
structDeclaration: () => structDeclaration,
|
|
14239
14518
|
super: () => _super$1,
|
|
14240
14519
|
switchCase: () => switchCase,
|
|
14241
14520
|
switchStatement: () => switchStatement,
|
|
@@ -14408,7 +14687,7 @@ function isBlockStatement$2(node, opts) {
|
|
|
14408
14687
|
function isBreakStatement(node, opts) {
|
|
14409
14688
|
return isType$1("BreakStatement", node, opts);
|
|
14410
14689
|
}
|
|
14411
|
-
function isCallExpression$
|
|
14690
|
+
function isCallExpression$3(node, opts) {
|
|
14412
14691
|
return isType$1("CallExpression", node, opts);
|
|
14413
14692
|
}
|
|
14414
14693
|
function isCatchClause(node, opts) {
|
|
@@ -14477,7 +14756,7 @@ function isLogicalExpression(node, opts) {
|
|
|
14477
14756
|
function isMemberExpression$3(node, opts) {
|
|
14478
14757
|
return isType$1("MemberExpression", node, opts);
|
|
14479
14758
|
}
|
|
14480
|
-
function isNewExpression$
|
|
14759
|
+
function isNewExpression$1(node, opts) {
|
|
14481
14760
|
return isType$1("NewExpression", node, opts);
|
|
14482
14761
|
}
|
|
14483
14762
|
function isProgram$1(node, opts) {
|
|
@@ -14492,7 +14771,7 @@ function isObjectMethod(node, opts) {
|
|
|
14492
14771
|
function isObjectProperty$1(node, opts) {
|
|
14493
14772
|
return isType$1("ObjectProperty", node, opts);
|
|
14494
14773
|
}
|
|
14495
|
-
function isRestElement$
|
|
14774
|
+
function isRestElement$2(node, opts) {
|
|
14496
14775
|
return isType$1("RestElement", node, opts);
|
|
14497
14776
|
}
|
|
14498
14777
|
function isReturnStatement(node, opts) {
|
|
@@ -14621,7 +14900,7 @@ function isImport(node, opts) {
|
|
|
14621
14900
|
function isBigIntLiteral(node, opts) {
|
|
14622
14901
|
return isType$1("BigIntLiteral", node, opts);
|
|
14623
14902
|
}
|
|
14624
|
-
function isExportNamespaceSpecifier$
|
|
14903
|
+
function isExportNamespaceSpecifier$2(node, opts) {
|
|
14625
14904
|
return isType$1("ExportNamespaceSpecifier", node, opts);
|
|
14626
14905
|
}
|
|
14627
14906
|
function isOptionalMemberExpression$1(node, opts) {
|
|
@@ -14924,6 +15203,12 @@ function isTopicReference$1(node, opts) {
|
|
|
14924
15203
|
function isVoidPattern$1(node, opts) {
|
|
14925
15204
|
return isType$1("VoidPattern", node, opts);
|
|
14926
15205
|
}
|
|
15206
|
+
function isStructDeclaration(node, opts) {
|
|
15207
|
+
return isType$1("StructDeclaration", node, opts);
|
|
15208
|
+
}
|
|
15209
|
+
function isStructBody(node, opts) {
|
|
15210
|
+
return isType$1("StructBody", node, opts);
|
|
15211
|
+
}
|
|
14927
15212
|
function isTSParameterProperty(node, opts) {
|
|
14928
15213
|
return isType$1("TSParameterProperty", node, opts);
|
|
14929
15214
|
}
|
|
@@ -15321,6 +15606,7 @@ function isScopable(node, opts) {
|
|
|
15321
15606
|
case "ClassMethod":
|
|
15322
15607
|
case "ClassPrivateMethod":
|
|
15323
15608
|
case "StaticBlock":
|
|
15609
|
+
case "StructDeclaration":
|
|
15324
15610
|
case "TSModuleBlock": break;
|
|
15325
15611
|
case "Placeholder": if (node.expectedNode === "BlockStatement") break;
|
|
15326
15612
|
default: return false;
|
|
@@ -15405,6 +15691,7 @@ function isStatement$6(node, opts) {
|
|
|
15405
15691
|
case "OpaqueType":
|
|
15406
15692
|
case "TypeAlias":
|
|
15407
15693
|
case "EnumDeclaration":
|
|
15694
|
+
case "StructDeclaration":
|
|
15408
15695
|
case "TSDeclareFunction":
|
|
15409
15696
|
case "TSInterfaceDeclaration":
|
|
15410
15697
|
case "TSTypeAliasDeclaration":
|
|
@@ -15577,6 +15864,7 @@ function isDeclaration(node, opts) {
|
|
|
15577
15864
|
case "OpaqueType":
|
|
15578
15865
|
case "TypeAlias":
|
|
15579
15866
|
case "EnumDeclaration":
|
|
15867
|
+
case "StructDeclaration":
|
|
15580
15868
|
case "TSDeclareFunction":
|
|
15581
15869
|
case "TSInterfaceDeclaration":
|
|
15582
15870
|
case "TSTypeAliasDeclaration":
|
|
@@ -17293,7 +17581,7 @@ defineType$4("ObjectProperty", {
|
|
|
17293
17581
|
"ObjectMember"
|
|
17294
17582
|
],
|
|
17295
17583
|
validate: function() {
|
|
17296
|
-
const pattern = assertNodeType("Identifier", "Pattern", "TSAsExpression", "TSSatisfiesExpression", "TSNonNullExpression", "TSTypeAssertion");
|
|
17584
|
+
const pattern = assertNodeType("Identifier", "Pattern", "MemberExpression", "TSAsExpression", "TSSatisfiesExpression", "TSNonNullExpression", "TSTypeAssertion");
|
|
17297
17585
|
const expression = assertNodeType("Expression");
|
|
17298
17586
|
return function(parent, key, node) {
|
|
17299
17587
|
(is("ObjectPattern", parent) ? pattern : expression)(node, "value", node.value);
|
|
@@ -17697,7 +17985,7 @@ defineType$4("ExportDefaultDeclaration", {
|
|
|
17697
17985
|
"ExportDeclaration"
|
|
17698
17986
|
],
|
|
17699
17987
|
fields: {
|
|
17700
|
-
declaration: validateType("FunctionDeclaration", "ClassDeclaration", "Expression", "TSDeclareFunction", "TSInterfaceDeclaration", "EnumDeclaration"),
|
|
17988
|
+
declaration: validateType("FunctionDeclaration", "ClassDeclaration", "Expression", "StructDeclaration", "TSDeclareFunction", "TSInterfaceDeclaration", "EnumDeclaration"),
|
|
17701
17989
|
exportKind: validateOptional(assertOneOf("value"))
|
|
17702
17990
|
}
|
|
17703
17991
|
});
|
|
@@ -17730,6 +18018,7 @@ defineType$4("ExportNamedDeclaration", {
|
|
|
17730
18018
|
"VariableDeclaration",
|
|
17731
18019
|
"FunctionDeclaration",
|
|
17732
18020
|
"ClassDeclaration",
|
|
18021
|
+
"StructDeclaration",
|
|
17733
18022
|
"TSDeclareFunction",
|
|
17734
18023
|
"TSEnumDeclaration",
|
|
17735
18024
|
"TSImportEqualsDeclaration",
|
|
@@ -17743,6 +18032,10 @@ defineType$4("ExportNamedDeclaration", {
|
|
|
17743
18032
|
] }))
|
|
17744
18033
|
},
|
|
17745
18034
|
...importAttributes,
|
|
18035
|
+
phase: {
|
|
18036
|
+
default: null,
|
|
18037
|
+
validate: assertOneOf("defer")
|
|
18038
|
+
},
|
|
17746
18039
|
specifiers: {
|
|
17747
18040
|
default: [],
|
|
17748
18041
|
validate: arrayOf(function() {
|
|
@@ -17860,9 +18153,16 @@ defineType$4("ImportDefaultSpecifier", {
|
|
|
17860
18153
|
fields: { local: { validate: assertNodeType("Identifier") } }
|
|
17861
18154
|
});
|
|
17862
18155
|
defineType$4("ImportNamespaceSpecifier", {
|
|
17863
|
-
visitor: ["local"],
|
|
18156
|
+
visitor: ["exportsFilter", "local"],
|
|
18157
|
+
builder: ["local"],
|
|
17864
18158
|
aliases: ["ModuleSpecifier"],
|
|
17865
|
-
fields: {
|
|
18159
|
+
fields: {
|
|
18160
|
+
local: { validate: assertNodeType("Identifier") },
|
|
18161
|
+
exportsFilter: {
|
|
18162
|
+
optional: true,
|
|
18163
|
+
validate: arrayOfType("Identifier", "StringLiteral")
|
|
18164
|
+
}
|
|
18165
|
+
}
|
|
17866
18166
|
});
|
|
17867
18167
|
defineType$4("ImportSpecifier", {
|
|
17868
18168
|
visitor: ["imported", "local"],
|
|
@@ -18091,6 +18391,10 @@ defineType$4("ImportExpression", {
|
|
|
18091
18391
|
default: null,
|
|
18092
18392
|
validate: assertOneOf("source", "defer")
|
|
18093
18393
|
},
|
|
18394
|
+
sync: {
|
|
18395
|
+
optional: true,
|
|
18396
|
+
validate: assertValueType("boolean")
|
|
18397
|
+
},
|
|
18094
18398
|
source: { validate: assertNodeType("Expression") },
|
|
18095
18399
|
options: {
|
|
18096
18400
|
validate: assertNodeType("Expression"),
|
|
@@ -18110,9 +18414,16 @@ defineType$4("BigIntLiteral", {
|
|
|
18110
18414
|
]
|
|
18111
18415
|
});
|
|
18112
18416
|
defineType$4("ExportNamespaceSpecifier", {
|
|
18113
|
-
visitor: ["exported"],
|
|
18417
|
+
visitor: ["exportsFilter", "exported"],
|
|
18418
|
+
builder: ["exported"],
|
|
18114
18419
|
aliases: ["ModuleSpecifier"],
|
|
18115
|
-
fields: {
|
|
18420
|
+
fields: {
|
|
18421
|
+
exported: { validate: assertNodeType("Identifier", "StringLiteral") },
|
|
18422
|
+
exportsFilter: {
|
|
18423
|
+
optional: true,
|
|
18424
|
+
validate: arrayOfType("Identifier", "StringLiteral")
|
|
18425
|
+
}
|
|
18426
|
+
}
|
|
18116
18427
|
});
|
|
18117
18428
|
defineType$4("OptionalMemberExpression", {
|
|
18118
18429
|
builder: [
|
|
@@ -19143,6 +19454,33 @@ defineType$5("VoidPattern", { aliases: [
|
|
|
19143
19454
|
"PatternLike",
|
|
19144
19455
|
"FunctionParameter"
|
|
19145
19456
|
] });
|
|
19457
|
+
defineType$5("StructDeclaration", {
|
|
19458
|
+
visitor: [
|
|
19459
|
+
"id",
|
|
19460
|
+
"superClass",
|
|
19461
|
+
"body"
|
|
19462
|
+
],
|
|
19463
|
+
aliases: [
|
|
19464
|
+
"Scopable",
|
|
19465
|
+
"Statement",
|
|
19466
|
+
"Declaration"
|
|
19467
|
+
],
|
|
19468
|
+
fields: {
|
|
19469
|
+
id: {
|
|
19470
|
+
validate: assertNodeType("Identifier"),
|
|
19471
|
+
optional: true
|
|
19472
|
+
},
|
|
19473
|
+
body: { validate: assertNodeType("StructBody") },
|
|
19474
|
+
superClass: {
|
|
19475
|
+
optional: true,
|
|
19476
|
+
validate: assertNodeType("Expression")
|
|
19477
|
+
}
|
|
19478
|
+
}
|
|
19479
|
+
});
|
|
19480
|
+
defineType$5("StructBody", {
|
|
19481
|
+
visitor: ["body"],
|
|
19482
|
+
fields: { body: validateArrayOfType("ClassMethod", "ClassPrivateMethod", "ClassProperty", "ClassPrivateProperty", "StaticBlock", "ClassAccessorProperty") }
|
|
19483
|
+
});
|
|
19146
19484
|
const defineType = defineAliasedType("TypeScript");
|
|
19147
19485
|
const bool = assertValueType("boolean");
|
|
19148
19486
|
const tSFunctionTypeAnnotationCommon = () => ({
|
|
@@ -19157,7 +19495,8 @@ const tSFunctionTypeAnnotationCommon = () => ({
|
|
|
19157
19495
|
});
|
|
19158
19496
|
defineType("TSParameterProperty", {
|
|
19159
19497
|
aliases: [],
|
|
19160
|
-
|
|
19498
|
+
builder: ["parameter"],
|
|
19499
|
+
visitor: ["decorators", "parameter"],
|
|
19161
19500
|
fields: {
|
|
19162
19501
|
accessibility: {
|
|
19163
19502
|
validate: assertOneOf("public", "private", "protected"),
|
|
@@ -21634,6 +21973,28 @@ function topicReference() {
|
|
|
21634
21973
|
function voidPattern() {
|
|
21635
21974
|
return { type: "VoidPattern" };
|
|
21636
21975
|
}
|
|
21976
|
+
function structDeclaration(id = null, superClass = null, body) {
|
|
21977
|
+
const node = {
|
|
21978
|
+
type: "StructDeclaration",
|
|
21979
|
+
id,
|
|
21980
|
+
superClass,
|
|
21981
|
+
body
|
|
21982
|
+
};
|
|
21983
|
+
const defs = NODE_FIELDS.StructDeclaration;
|
|
21984
|
+
validate$3(defs.id, node, "id", id, 1);
|
|
21985
|
+
validate$3(defs.superClass, node, "superClass", superClass, 1);
|
|
21986
|
+
validate$3(defs.body, node, "body", body, 1);
|
|
21987
|
+
return node;
|
|
21988
|
+
}
|
|
21989
|
+
function structBody(body) {
|
|
21990
|
+
const node = {
|
|
21991
|
+
type: "StructBody",
|
|
21992
|
+
body
|
|
21993
|
+
};
|
|
21994
|
+
const defs = NODE_FIELDS.StructBody;
|
|
21995
|
+
validate$3(defs.body, node, "body", body, 1);
|
|
21996
|
+
return node;
|
|
21997
|
+
}
|
|
21637
21998
|
function tsParameterProperty(parameter) {
|
|
21638
21999
|
const node = {
|
|
21639
22000
|
type: "TSParameterProperty",
|
|
@@ -22451,6 +22812,8 @@ const b = /*#__PURE__*/ Object.defineProperty({
|
|
|
22451
22812
|
stringLiteral: stringLiteral$2,
|
|
22452
22813
|
stringLiteralTypeAnnotation,
|
|
22453
22814
|
stringTypeAnnotation: stringTypeAnnotation$2,
|
|
22815
|
+
structBody,
|
|
22816
|
+
structDeclaration,
|
|
22454
22817
|
super: _super$1,
|
|
22455
22818
|
switchCase,
|
|
22456
22819
|
switchStatement,
|
|
@@ -22738,6 +23101,8 @@ const ExportDefaultSpecifier$1 = alias("exportDefaultSpecifier");
|
|
|
22738
23101
|
const ModuleExpression$1 = alias("moduleExpression");
|
|
22739
23102
|
const TopicReference$1 = alias("topicReference");
|
|
22740
23103
|
const VoidPattern$1 = alias("voidPattern");
|
|
23104
|
+
const StructDeclaration$1 = alias("structDeclaration");
|
|
23105
|
+
const StructBody = alias("structBody");
|
|
22741
23106
|
const TSParameterProperty$1 = alias("tsParameterProperty");
|
|
22742
23107
|
const TSDeclareFunction$1 = alias("tsDeclareFunction");
|
|
22743
23108
|
const TSDeclareMethod$1 = alias("tsDeclareMethod");
|
|
@@ -22790,7 +23155,7 @@ const TSTypeAliasDeclaration$1 = alias("tsTypeAliasDeclaration");
|
|
|
22790
23155
|
const TSInstantiationExpression$2 = alias("tsInstantiationExpression");
|
|
22791
23156
|
const TSAsExpression$3 = alias("tsAsExpression");
|
|
22792
23157
|
const TSSatisfiesExpression$1 = alias("tsSatisfiesExpression");
|
|
22793
|
-
const TSTypeAssertion$
|
|
23158
|
+
const TSTypeAssertion$2 = alias("tsTypeAssertion");
|
|
22794
23159
|
const TSEnumBody$1 = alias("tsEnumBody");
|
|
22795
23160
|
const TSEnumDeclaration$1 = alias("tsEnumDeclaration");
|
|
22796
23161
|
const TSEnumMember$1 = alias("tsEnumMember");
|
|
@@ -23392,6 +23757,12 @@ function assertTopicReference(node, opts) {
|
|
|
23392
23757
|
function assertVoidPattern(node, opts) {
|
|
23393
23758
|
assert("VoidPattern", node, opts);
|
|
23394
23759
|
}
|
|
23760
|
+
function assertStructDeclaration(node, opts) {
|
|
23761
|
+
assert("StructDeclaration", node, opts);
|
|
23762
|
+
}
|
|
23763
|
+
function assertStructBody(node, opts) {
|
|
23764
|
+
assert("StructBody", node, opts);
|
|
23765
|
+
}
|
|
23395
23766
|
function assertTSParameterProperty(node, opts) {
|
|
23396
23767
|
assert("TSParameterProperty", node, opts);
|
|
23397
23768
|
}
|
|
@@ -24646,27 +25017,45 @@ var builtin_upper_default = [
|
|
|
24646
25017
|
];
|
|
24647
25018
|
//#endregion
|
|
24648
25019
|
//#region node_modules/.pnpm/@jridgewell+sourcemap-codec@1.6.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
|
|
24649
|
-
var comma
|
|
24650
|
-
var semicolon
|
|
24651
|
-
var chars
|
|
24652
|
-
var intToChar
|
|
24653
|
-
var charToInt
|
|
24654
|
-
for (let i = 0; i < chars
|
|
24655
|
-
const c = chars
|
|
24656
|
-
intToChar
|
|
24657
|
-
charToInt
|
|
25020
|
+
var comma = ",".charCodeAt(0);
|
|
25021
|
+
var semicolon = ";".charCodeAt(0);
|
|
25022
|
+
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
25023
|
+
var intToChar = /* @__PURE__ */ new Uint8Array(64);
|
|
25024
|
+
var charToInt = /* @__PURE__ */ new Uint8Array(128);
|
|
25025
|
+
for (let i = 0; i < chars.length; i++) {
|
|
25026
|
+
const c = chars.charCodeAt(i);
|
|
25027
|
+
intToChar[i] = c;
|
|
25028
|
+
charToInt[c] = i;
|
|
25029
|
+
}
|
|
25030
|
+
function decodeInteger(reader) {
|
|
25031
|
+
let value = 0;
|
|
25032
|
+
let shift = 0;
|
|
25033
|
+
let integer = 0;
|
|
25034
|
+
do {
|
|
25035
|
+
integer = charToInt[reader.next()];
|
|
25036
|
+
value |= (integer & 31) << shift;
|
|
25037
|
+
shift += 5;
|
|
25038
|
+
} while (integer & 32);
|
|
25039
|
+
return value;
|
|
25040
|
+
}
|
|
25041
|
+
function decodeSign(num) {
|
|
25042
|
+
return num & 1 ? -2147483648 | -(num >>> 1) : num >>> 1;
|
|
24658
25043
|
}
|
|
24659
25044
|
function encodeInteger(builder, num) {
|
|
24660
25045
|
do {
|
|
24661
25046
|
let clamped = num & 31;
|
|
24662
25047
|
num >>>= 5;
|
|
24663
25048
|
if (num > 0) clamped |= 32;
|
|
24664
|
-
builder.write(intToChar
|
|
25049
|
+
builder.write(intToChar[clamped]);
|
|
24665
25050
|
} while (num > 0);
|
|
24666
25051
|
}
|
|
24667
25052
|
function encodeSign(num) {
|
|
24668
25053
|
return num < 0 ? -num << 1 | 1 : num << 1;
|
|
24669
25054
|
}
|
|
25055
|
+
function hasMoreVlq(reader, max) {
|
|
25056
|
+
if (reader.pos >= max) return false;
|
|
25057
|
+
return reader.peek() !== comma;
|
|
25058
|
+
}
|
|
24670
25059
|
var bufLength = 16384;
|
|
24671
25060
|
var td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== "undefined" ? { decode(buf) {
|
|
24672
25061
|
return Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength).toString();
|
|
@@ -24694,81 +25083,6 @@ var StringWriter = class {
|
|
|
24694
25083
|
return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
|
|
24695
25084
|
}
|
|
24696
25085
|
};
|
|
24697
|
-
function encodeRangeMappings(decoded) {
|
|
24698
|
-
if (decoded.length === 0) return "";
|
|
24699
|
-
const writer = new StringWriter();
|
|
24700
|
-
for (let i = 0; i < decoded.length; i++) {
|
|
24701
|
-
const indices = decoded[i];
|
|
24702
|
-
if (i > 0) writer.write(semicolon$1);
|
|
24703
|
-
let index = 0;
|
|
24704
|
-
for (let j = 0; j < indices.length; j++) {
|
|
24705
|
-
const offset = indices[j];
|
|
24706
|
-
encodeInteger(writer, offset - index);
|
|
24707
|
-
index = offset;
|
|
24708
|
-
}
|
|
24709
|
-
}
|
|
24710
|
-
return writer.flush();
|
|
24711
|
-
}
|
|
24712
|
-
function encode(decoded) {
|
|
24713
|
-
const writer = new StringWriter();
|
|
24714
|
-
let sourcesIndex = 0;
|
|
24715
|
-
let sourceLine = 0;
|
|
24716
|
-
let sourceColumn = 0;
|
|
24717
|
-
let namesIndex = 0;
|
|
24718
|
-
for (let i = 0; i < decoded.length; i++) {
|
|
24719
|
-
const line = decoded[i];
|
|
24720
|
-
if (i > 0) writer.write(semicolon$1);
|
|
24721
|
-
if (line.length === 0) continue;
|
|
24722
|
-
let genColumn = 0;
|
|
24723
|
-
for (let j = 0; j < line.length; j++) {
|
|
24724
|
-
const segment = line[j];
|
|
24725
|
-
if (j > 0) writer.write(comma$1);
|
|
24726
|
-
encodeInteger(writer, encodeSign(segment[0] - genColumn));
|
|
24727
|
-
genColumn = segment[0];
|
|
24728
|
-
if (segment.length === 1) continue;
|
|
24729
|
-
encodeInteger(writer, encodeSign(segment[1] - sourcesIndex));
|
|
24730
|
-
encodeInteger(writer, encodeSign(segment[2] - sourceLine));
|
|
24731
|
-
encodeInteger(writer, encodeSign(segment[3] - sourceColumn));
|
|
24732
|
-
sourcesIndex = segment[1];
|
|
24733
|
-
sourceLine = segment[2];
|
|
24734
|
-
sourceColumn = segment[3];
|
|
24735
|
-
if (segment.length === 4) continue;
|
|
24736
|
-
encodeInteger(writer, encodeSign(segment[4] - namesIndex));
|
|
24737
|
-
namesIndex = segment[4];
|
|
24738
|
-
}
|
|
24739
|
-
}
|
|
24740
|
-
return writer.flush();
|
|
24741
|
-
}
|
|
24742
|
-
//#endregion
|
|
24743
|
-
//#region node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
|
|
24744
|
-
var comma = ",".charCodeAt(0);
|
|
24745
|
-
";".charCodeAt(0);
|
|
24746
|
-
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
24747
|
-
var intToChar = /* @__PURE__ */ new Uint8Array(64);
|
|
24748
|
-
var charToInt = /* @__PURE__ */ new Uint8Array(128);
|
|
24749
|
-
for (let i = 0; i < chars.length; i++) {
|
|
24750
|
-
const c = chars.charCodeAt(i);
|
|
24751
|
-
intToChar[i] = c;
|
|
24752
|
-
charToInt[c] = i;
|
|
24753
|
-
}
|
|
24754
|
-
function decodeInteger(reader, relative) {
|
|
24755
|
-
let value = 0;
|
|
24756
|
-
let shift = 0;
|
|
24757
|
-
let integer = 0;
|
|
24758
|
-
do {
|
|
24759
|
-
integer = charToInt[reader.next()];
|
|
24760
|
-
value |= (integer & 31) << shift;
|
|
24761
|
-
shift += 5;
|
|
24762
|
-
} while (integer & 32);
|
|
24763
|
-
const shouldNegate = value & 1;
|
|
24764
|
-
value >>>= 1;
|
|
24765
|
-
if (shouldNegate) value = -2147483648 | -value;
|
|
24766
|
-
return relative + value;
|
|
24767
|
-
}
|
|
24768
|
-
function hasMoreVlq(reader, max) {
|
|
24769
|
-
if (reader.pos >= max) return false;
|
|
24770
|
-
return reader.peek() !== comma;
|
|
24771
|
-
}
|
|
24772
25086
|
var StringReader = class {
|
|
24773
25087
|
constructor(buffer) {
|
|
24774
25088
|
this.pos = 0;
|
|
@@ -24786,6 +25100,21 @@ var StringReader = class {
|
|
|
24786
25100
|
return idx === -1 ? buffer.length : idx;
|
|
24787
25101
|
}
|
|
24788
25102
|
};
|
|
25103
|
+
function encodeRangeMappings(decoded) {
|
|
25104
|
+
if (decoded.length === 0) return "";
|
|
25105
|
+
const writer = new StringWriter();
|
|
25106
|
+
for (let i = 0; i < decoded.length; i++) {
|
|
25107
|
+
const indices = decoded[i];
|
|
25108
|
+
if (i > 0) writer.write(semicolon);
|
|
25109
|
+
let index = 0;
|
|
25110
|
+
for (let j = 0; j < indices.length; j++) {
|
|
25111
|
+
const offset = indices[j];
|
|
25112
|
+
encodeInteger(writer, offset - index);
|
|
25113
|
+
index = offset;
|
|
25114
|
+
}
|
|
25115
|
+
}
|
|
25116
|
+
return writer.flush();
|
|
25117
|
+
}
|
|
24789
25118
|
function decode(mappings) {
|
|
24790
25119
|
const { length } = mappings;
|
|
24791
25120
|
const reader = new StringReader(mappings);
|
|
@@ -24803,15 +25132,15 @@ function decode(mappings) {
|
|
|
24803
25132
|
genColumn = 0;
|
|
24804
25133
|
while (reader.pos < semi) {
|
|
24805
25134
|
let seg;
|
|
24806
|
-
genColumn
|
|
25135
|
+
genColumn += decodeSign(decodeInteger(reader));
|
|
24807
25136
|
if (genColumn < lastCol) sorted = false;
|
|
24808
25137
|
lastCol = genColumn;
|
|
24809
25138
|
if (hasMoreVlq(reader, semi)) {
|
|
24810
|
-
sourcesIndex
|
|
24811
|
-
sourceLine
|
|
24812
|
-
sourceColumn
|
|
25139
|
+
sourcesIndex += decodeSign(decodeInteger(reader));
|
|
25140
|
+
sourceLine += decodeSign(decodeInteger(reader));
|
|
25141
|
+
sourceColumn += decodeSign(decodeInteger(reader));
|
|
24813
25142
|
if (hasMoreVlq(reader, semi)) {
|
|
24814
|
-
namesIndex
|
|
25143
|
+
namesIndex += decodeSign(decodeInteger(reader));
|
|
24815
25144
|
seg = [
|
|
24816
25145
|
genColumn,
|
|
24817
25146
|
sourcesIndex,
|
|
@@ -24841,6 +25170,36 @@ function sort(line) {
|
|
|
24841
25170
|
function sortComparator$1(a, b) {
|
|
24842
25171
|
return a[0] - b[0];
|
|
24843
25172
|
}
|
|
25173
|
+
function encode(decoded) {
|
|
25174
|
+
const writer = new StringWriter();
|
|
25175
|
+
let sourcesIndex = 0;
|
|
25176
|
+
let sourceLine = 0;
|
|
25177
|
+
let sourceColumn = 0;
|
|
25178
|
+
let namesIndex = 0;
|
|
25179
|
+
for (let i = 0; i < decoded.length; i++) {
|
|
25180
|
+
const line = decoded[i];
|
|
25181
|
+
if (i > 0) writer.write(semicolon);
|
|
25182
|
+
if (line.length === 0) continue;
|
|
25183
|
+
let genColumn = 0;
|
|
25184
|
+
for (let j = 0; j < line.length; j++) {
|
|
25185
|
+
const segment = line[j];
|
|
25186
|
+
if (j > 0) writer.write(comma);
|
|
25187
|
+
encodeInteger(writer, encodeSign(segment[0] - genColumn));
|
|
25188
|
+
genColumn = segment[0];
|
|
25189
|
+
if (segment.length === 1) continue;
|
|
25190
|
+
encodeInteger(writer, encodeSign(segment[1] - sourcesIndex));
|
|
25191
|
+
encodeInteger(writer, encodeSign(segment[2] - sourceLine));
|
|
25192
|
+
encodeInteger(writer, encodeSign(segment[3] - sourceColumn));
|
|
25193
|
+
sourcesIndex = segment[1];
|
|
25194
|
+
sourceLine = segment[2];
|
|
25195
|
+
sourceColumn = segment[3];
|
|
25196
|
+
if (segment.length === 4) continue;
|
|
25197
|
+
encodeInteger(writer, encodeSign(segment[4] - namesIndex));
|
|
25198
|
+
namesIndex = segment[4];
|
|
25199
|
+
}
|
|
25200
|
+
}
|
|
25201
|
+
return writer.flush();
|
|
25202
|
+
}
|
|
24844
25203
|
//#endregion
|
|
24845
25204
|
//#region node_modules/.pnpm/@jridgewell+trace-mapping@0.3.31/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs
|
|
24846
25205
|
var import_resolve_uri_umd = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -25377,7 +25736,7 @@ function addMappingInternal(skipable, map, mapping) {
|
|
|
25377
25736
|
if (isRange) setRangeSegment(map, generated.line - 1, generated.column);
|
|
25378
25737
|
}
|
|
25379
25738
|
//#endregion
|
|
25380
|
-
//#region node_modules/.pnpm/@babel+generator@8.0
|
|
25739
|
+
//#region node_modules/.pnpm/@babel+generator@8.1.0/node_modules/@babel/generator/lib/index.js
|
|
25381
25740
|
var import_jsesc = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
25382
25741
|
const object = {};
|
|
25383
25742
|
const hasOwnProperty = object.hasOwnProperty;
|
|
@@ -25586,15 +25945,22 @@ var SourceMap = class {
|
|
|
25586
25945
|
_map;
|
|
25587
25946
|
_rawMappings;
|
|
25588
25947
|
_sourceFileName;
|
|
25589
|
-
_lastGenLine = 0;
|
|
25590
|
-
_lastSourceLine = 0;
|
|
25591
|
-
_lastSourceColumn = 0;
|
|
25592
25948
|
_inputMap = null;
|
|
25949
|
+
#mappingsBuffer0 = null;
|
|
25950
|
+
#mappingsBuffer1 = null;
|
|
25951
|
+
#mappingsBuffer2 = null;
|
|
25952
|
+
#droppedMappingForRange = false;
|
|
25953
|
+
#allowRangeMappings;
|
|
25593
25954
|
constructor(opts, code) {
|
|
25594
25955
|
const map = this._map = new GenMapping({ sourceRoot: opts.sourceRoot });
|
|
25595
25956
|
this._sourceFileName = opts.sourceFileName?.replace(/\\/g, "/");
|
|
25596
25957
|
this._rawMappings = void 0;
|
|
25958
|
+
this.#allowRangeMappings = opts.sourceMapRanges ?? false;
|
|
25597
25959
|
if (opts.inputSourceMap) {
|
|
25960
|
+
if (this.#allowRangeMappings) {
|
|
25961
|
+
this.#allowRangeMappings = false;
|
|
25962
|
+
console.warn(`[BABEL] Note: The code generator has disabled source map ranges for ${opts.filename ?? "the generated code"}, because they cannot be used together with \`inputSourceMap\` yet.`);
|
|
25963
|
+
}
|
|
25598
25964
|
this._inputMap = new TraceMap(opts.inputSourceMap);
|
|
25599
25965
|
const resolvedSources = this._inputMap.resolvedSources;
|
|
25600
25966
|
if (resolvedSources.length) for (let i = 0; i < resolvedSources.length; i++) setSourceContent(map, resolvedSources[i], this._inputMap.sourcesContent?.[i]);
|
|
@@ -25603,16 +25969,19 @@ var SourceMap = class {
|
|
|
25603
25969
|
else if (typeof code === "object") for (const sourceFileName of Object.keys(code)) setSourceContent(map, sourceFileName.replace(/\\/g, "/"), code[sourceFileName]);
|
|
25604
25970
|
}
|
|
25605
25971
|
get() {
|
|
25972
|
+
this.#flushBuffer();
|
|
25606
25973
|
const encoded = toEncodedMap(this._map);
|
|
25607
25974
|
encoded.ignoreList ??= [];
|
|
25608
25975
|
return encoded;
|
|
25609
25976
|
}
|
|
25610
25977
|
getDecoded() {
|
|
25978
|
+
this.#flushBuffer();
|
|
25611
25979
|
const decoded = toDecodedMap(this._map);
|
|
25612
25980
|
decoded.ignoreList ??= [];
|
|
25613
25981
|
return decoded;
|
|
25614
25982
|
}
|
|
25615
25983
|
getRawMappings() {
|
|
25984
|
+
this.#flushBuffer();
|
|
25616
25985
|
return this._rawMappings ||= allMappings(this._map);
|
|
25617
25986
|
}
|
|
25618
25987
|
mark(generated, generatedIdentifierName, line, column, identifierName, identifierNamePos, filename) {
|
|
@@ -25637,12 +26006,92 @@ var SourceMap = class {
|
|
|
25637
26006
|
};
|
|
25638
26007
|
}
|
|
25639
26008
|
if (identifierName != null && identifierName === generatedIdentifierName) identifierName = null;
|
|
25640
|
-
|
|
25641
|
-
name: identifierName,
|
|
25642
|
-
generated
|
|
26009
|
+
const newMapping = {
|
|
26010
|
+
name: identifierName ?? null,
|
|
26011
|
+
generated: {
|
|
26012
|
+
line: generated.line,
|
|
26013
|
+
column: generated.column
|
|
26014
|
+
},
|
|
25643
26015
|
source: originalMapping?.source,
|
|
25644
|
-
original: originalMapping
|
|
25645
|
-
|
|
26016
|
+
original: originalMapping,
|
|
26017
|
+
isRange: false
|
|
26018
|
+
};
|
|
26019
|
+
if (newMapping.name !== null) {
|
|
26020
|
+
this.#flushBuffer();
|
|
26021
|
+
maybeAddMapping(this._map, newMapping);
|
|
26022
|
+
return;
|
|
26023
|
+
}
|
|
26024
|
+
if (this.#allowRangeMappings) {
|
|
26025
|
+
if (this.#mappingsBuffer2 !== null) {
|
|
26026
|
+
const buf2 = this.#mappingsBuffer2;
|
|
26027
|
+
this.#mappingsBuffer2 = null;
|
|
26028
|
+
const prev = this.#mappingsBuffer1 ?? this.#mappingsBuffer0;
|
|
26029
|
+
if (this.#isRangeCandidate(prev, newMapping)) this.#droppedMappingForRange = true;
|
|
26030
|
+
else this.#bufferMapping(buf2);
|
|
26031
|
+
}
|
|
26032
|
+
const prev = this.#mappingsBuffer1 ?? this.#mappingsBuffer0;
|
|
26033
|
+
const prevOriginal = prev?.original;
|
|
26034
|
+
if (prevOriginal && prev.source === newMapping.source && prevOriginal.line === newMapping.original?.line && prevOriginal.column === newMapping.original.column) {
|
|
26035
|
+
if (prev.generated.line === newMapping.generated.line) return;
|
|
26036
|
+
this.#mappingsBuffer2 = newMapping;
|
|
26037
|
+
return;
|
|
26038
|
+
}
|
|
26039
|
+
}
|
|
26040
|
+
this.#bufferMapping(newMapping);
|
|
26041
|
+
}
|
|
26042
|
+
#bufferMapping(newMapping) {
|
|
26043
|
+
if (this.#mappingsBuffer0 === null) {
|
|
26044
|
+
this.#mappingsBuffer0 = newMapping;
|
|
26045
|
+
return;
|
|
26046
|
+
}
|
|
26047
|
+
if (this.#mappingsBuffer1 === null) {
|
|
26048
|
+
if (this.#isRangeCandidate(this.#mappingsBuffer0, newMapping)) this.#mappingsBuffer1 = newMapping;
|
|
26049
|
+
else {
|
|
26050
|
+
maybeAddMapping(this._map, this.#mappingsBuffer0);
|
|
26051
|
+
this.#mappingsBuffer0 = newMapping;
|
|
26052
|
+
}
|
|
26053
|
+
return;
|
|
26054
|
+
}
|
|
26055
|
+
if (this.#isRangeCandidate(this.#mappingsBuffer1, newMapping)) {
|
|
26056
|
+
this.#mappingsBuffer1 = newMapping;
|
|
26057
|
+
this.#droppedMappingForRange = true;
|
|
26058
|
+
} else {
|
|
26059
|
+
if (this.#droppedMappingForRange) this.#mappingsBuffer0.isRange = true;
|
|
26060
|
+
maybeAddMapping(this._map, this.#mappingsBuffer0);
|
|
26061
|
+
maybeAddMapping(this._map, this.#mappingsBuffer1);
|
|
26062
|
+
this.#mappingsBuffer0 = newMapping;
|
|
26063
|
+
this.#mappingsBuffer1 = null;
|
|
26064
|
+
this.#droppedMappingForRange = false;
|
|
26065
|
+
}
|
|
26066
|
+
}
|
|
26067
|
+
#flushBuffer() {
|
|
26068
|
+
if (this.#mappingsBuffer2 !== null) {
|
|
26069
|
+
this.#bufferMapping(this.#mappingsBuffer2);
|
|
26070
|
+
this.#mappingsBuffer2 = null;
|
|
26071
|
+
}
|
|
26072
|
+
const buf0 = this.#mappingsBuffer0;
|
|
26073
|
+
const buf1 = this.#mappingsBuffer1;
|
|
26074
|
+
if (buf0 !== null) {
|
|
26075
|
+
if (buf1 !== null && this.#droppedMappingForRange) buf0.isRange = true;
|
|
26076
|
+
maybeAddMapping(this._map, buf0);
|
|
26077
|
+
this.#mappingsBuffer0 = null;
|
|
26078
|
+
}
|
|
26079
|
+
if (buf1 !== null) {
|
|
26080
|
+
maybeAddMapping(this._map, buf1);
|
|
26081
|
+
this.#mappingsBuffer1 = null;
|
|
26082
|
+
}
|
|
26083
|
+
}
|
|
26084
|
+
#isRangeCandidate(prev, next) {
|
|
26085
|
+
if (!this.#allowRangeMappings) return false;
|
|
26086
|
+
const prevOriginal = prev.original;
|
|
26087
|
+
const nextOriginal = next.original;
|
|
26088
|
+
if (!prevOriginal || !nextOriginal) return false;
|
|
26089
|
+
if (prev.source !== next.source) return false;
|
|
26090
|
+
const generatedLineDelta = next.generated.line - prev.generated.line;
|
|
26091
|
+
const generatedColumnDelta = generatedLineDelta === 0 ? next.generated.column - prev.generated.column : next.generated.column;
|
|
26092
|
+
const originalLineDelta = nextOriginal.line - prevOriginal.line;
|
|
26093
|
+
const originalColumnDelta = originalLineDelta === 0 ? nextOriginal.column - prevOriginal.column : nextOriginal.column;
|
|
26094
|
+
return generatedLineDelta >= 0 && originalColumnDelta >= 0 && generatedLineDelta === originalLineDelta && generatedColumnDelta === originalColumnDelta;
|
|
25646
26095
|
}
|
|
25647
26096
|
};
|
|
25648
26097
|
const spaceIndents = [];
|
|
@@ -25881,20 +26330,21 @@ const PRECEDENCE = /* @__PURE__ */ new Map([
|
|
|
25881
26330
|
["**", 11]
|
|
25882
26331
|
]);
|
|
25883
26332
|
function isTSTypeExpression(nodeId) {
|
|
25884
|
-
return nodeId ===
|
|
26333
|
+
return nodeId === 156 || nodeId === 201 || nodeId === 209;
|
|
25885
26334
|
}
|
|
25886
26335
|
const isClassExtendsClause = (node, parent, parentId) => {
|
|
25887
|
-
return (parentId === 22 || parentId === 23) && parent.superClass === node;
|
|
26336
|
+
return (parentId === 22 || parentId === 23 || parentId === 149) && parent.superClass === node;
|
|
25888
26337
|
};
|
|
25889
|
-
const hasPostfixPart = (node, parent, parentId) => {
|
|
26338
|
+
const hasPostfixPart$1 = (node, parent, parentId) => {
|
|
25890
26339
|
switch (parentId) {
|
|
25891
26340
|
case 109:
|
|
25892
26341
|
case 133: return parent.object === node;
|
|
25893
26342
|
case 18:
|
|
25894
26343
|
case 131:
|
|
25895
26344
|
case 113: return parent.callee === node;
|
|
25896
|
-
case
|
|
25897
|
-
case
|
|
26345
|
+
case 222: return parent.tag === node;
|
|
26346
|
+
case 191: return true;
|
|
26347
|
+
case 177: return parent.expression === node;
|
|
25898
26348
|
}
|
|
25899
26349
|
return false;
|
|
25900
26350
|
};
|
|
@@ -25902,10 +26352,10 @@ function NullableTypeAnnotation$1(node, parent, parentId) {
|
|
|
25902
26352
|
return parentId === 4;
|
|
25903
26353
|
}
|
|
25904
26354
|
function FunctionTypeAnnotation$1(node, parent, parentId, tokenContext) {
|
|
25905
|
-
return parentId ===
|
|
26355
|
+
return parentId === 239 || parentId === 91 || parentId === 4 || (tokenContext & 8) > 0;
|
|
25906
26356
|
}
|
|
25907
26357
|
function UpdateExpression$1(node, parent, parentId) {
|
|
25908
|
-
return hasPostfixPart(node, parent, parentId) || isClassExtendsClause(node, parent, parentId);
|
|
26358
|
+
return hasPostfixPart$1(node, parent, parentId) || isClassExtendsClause(node, parent, parentId);
|
|
25909
26359
|
}
|
|
25910
26360
|
function needsParenBeforeExpressionBrace(tokenContext) {
|
|
25911
26361
|
return (tokenContext & 3) > 0;
|
|
@@ -25918,15 +26368,15 @@ function DoExpression$1(node, parent, parentId, tokenContext) {
|
|
|
25918
26368
|
}
|
|
25919
26369
|
function BinaryLike(node, parent, parentId, nodeType) {
|
|
25920
26370
|
if (isClassExtendsClause(node, parent, parentId)) return true;
|
|
25921
|
-
if (hasPostfixPart(node, parent, parentId) || parentId ===
|
|
26371
|
+
if (hasPostfixPart$1(node, parent, parentId) || parentId === 238 || parentId === 143 || parentId === 8) return true;
|
|
25922
26372
|
let parentPos;
|
|
25923
26373
|
switch (parentId) {
|
|
25924
26374
|
case 11:
|
|
25925
26375
|
case 108:
|
|
25926
26376
|
parentPos = PRECEDENCE.get(parent.operator);
|
|
25927
26377
|
break;
|
|
25928
|
-
case
|
|
25929
|
-
case
|
|
26378
|
+
case 156:
|
|
26379
|
+
case 201: parentPos = 7;
|
|
25930
26380
|
}
|
|
25931
26381
|
if (parentPos !== void 0) {
|
|
25932
26382
|
const nodePos = nodeType === 2 ? 7 : PRECEDENCE.get(node.operator);
|
|
@@ -25941,7 +26391,7 @@ function UnionTypeAnnotation$1(node, parent, parentId) {
|
|
|
25941
26391
|
case 4:
|
|
25942
26392
|
case 116:
|
|
25943
26393
|
case 91:
|
|
25944
|
-
case
|
|
26394
|
+
case 239: return true;
|
|
25945
26395
|
}
|
|
25946
26396
|
return false;
|
|
25947
26397
|
}
|
|
@@ -25949,46 +26399,49 @@ function OptionalIndexedAccessType$1(node, parent, parentId) {
|
|
|
25949
26399
|
return parentId === 85 && parent.objectType === node;
|
|
25950
26400
|
}
|
|
25951
26401
|
function TSAsExpression$1(node, parent, parentId) {
|
|
25952
|
-
if ((parentId === 6 || parentId === 7) && parent.left === node) return true;
|
|
26402
|
+
if (parentId === 240 || (parentId === 6 || parentId === 7) && parent.left === node) return true;
|
|
25953
26403
|
if (parentId === 11 && (parent.operator === "|" || parent.operator === "&") && node === parent.left) return true;
|
|
25954
26404
|
return BinaryLike(node, parent, parentId, 2);
|
|
25955
26405
|
}
|
|
26406
|
+
function TSTypeAssertion$1(node, parent, parentId) {
|
|
26407
|
+
return parentId === 240 || (parentId === 6 || parentId === 7) && parent.left === node || UnaryLike(node, parent, parentId);
|
|
26408
|
+
}
|
|
25956
26409
|
function TSConditionalType$1(node, parent, parentId) {
|
|
25957
26410
|
switch (parentId) {
|
|
25958
|
-
case
|
|
25959
|
-
case
|
|
25960
|
-
case
|
|
25961
|
-
case
|
|
25962
|
-
case
|
|
25963
|
-
case
|
|
25964
|
-
case
|
|
25965
|
-
case
|
|
26411
|
+
case 155:
|
|
26412
|
+
case 195:
|
|
26413
|
+
case 211:
|
|
26414
|
+
case 212:
|
|
26415
|
+
case 181:
|
|
26416
|
+
case 219: return true;
|
|
26417
|
+
case 175: return parent.objectType === node;
|
|
26418
|
+
case 161: return parent.checkType === node || parent.extendsType === node;
|
|
25966
26419
|
}
|
|
25967
26420
|
return false;
|
|
25968
26421
|
}
|
|
25969
26422
|
function TSUnionType$1(node, parent, parentId) {
|
|
25970
26423
|
switch (parentId) {
|
|
25971
|
-
case
|
|
25972
|
-
case
|
|
25973
|
-
case
|
|
25974
|
-
case
|
|
25975
|
-
case
|
|
26424
|
+
case 181:
|
|
26425
|
+
case 211:
|
|
26426
|
+
case 155:
|
|
26427
|
+
case 195: return true;
|
|
26428
|
+
case 175: return parent.objectType === node;
|
|
25976
26429
|
}
|
|
25977
26430
|
return false;
|
|
25978
26431
|
}
|
|
25979
26432
|
function TSIntersectionType$1(node, parent, parentId) {
|
|
25980
|
-
return parentId ===
|
|
26433
|
+
return parentId === 211 || TSTypeOperator$1(node, parent, parentId);
|
|
25981
26434
|
}
|
|
25982
26435
|
function TSInferType$1(node, parent, parentId) {
|
|
25983
26436
|
if (TSTypeOperator$1(node, parent, parentId)) return true;
|
|
25984
|
-
if ((parentId ===
|
|
26437
|
+
if ((parentId === 181 || parentId === 219) && node.typeParameter.constraint != null) return true;
|
|
25985
26438
|
return false;
|
|
25986
26439
|
}
|
|
25987
26440
|
function TSTypeOperator$1(node, parent, parentId) {
|
|
25988
26441
|
switch (parentId) {
|
|
25989
|
-
case
|
|
25990
|
-
case
|
|
25991
|
-
case
|
|
26442
|
+
case 155:
|
|
26443
|
+
case 195: return true;
|
|
26444
|
+
case 175: if (parent.objectType === node) return true;
|
|
25992
26445
|
}
|
|
25993
26446
|
return false;
|
|
25994
26447
|
}
|
|
@@ -25997,13 +26450,16 @@ function TSInstantiationExpression$1(node, parent, parentId) {
|
|
|
25997
26450
|
case 18:
|
|
25998
26451
|
case 131:
|
|
25999
26452
|
case 113:
|
|
26000
|
-
case
|
|
26453
|
+
case 177: return parent.typeArguments != null;
|
|
26454
|
+
case 109:
|
|
26455
|
+
case 133: return parent.object === node;
|
|
26456
|
+
case 191: return true;
|
|
26001
26457
|
}
|
|
26002
26458
|
return false;
|
|
26003
26459
|
}
|
|
26004
26460
|
function TSFunctionType$1(node, parent, parentId) {
|
|
26005
26461
|
if (TSUnionType$1(node, parent, parentId)) return true;
|
|
26006
|
-
return parentId ===
|
|
26462
|
+
return parentId === 219 || parentId === 161 && (parent.checkType === node || parent.extendsType === node);
|
|
26007
26463
|
}
|
|
26008
26464
|
function BinaryExpression$1(node, parent, parentId, tokenContext) {
|
|
26009
26465
|
if (BinaryLike(node, parent, parentId, 0)) return true;
|
|
@@ -26013,27 +26469,27 @@ function LogicalExpression$1(node, parent, parentId) {
|
|
|
26013
26469
|
return BinaryLike(node, parent, parentId, 1);
|
|
26014
26470
|
}
|
|
26015
26471
|
function SequenceExpression$1(node, parent, parentId) {
|
|
26016
|
-
if (parentId === 142 || parentId === 134 || parentId === 109 && parent.property === node || parentId === 133 && parent.property === node || parentId ===
|
|
26017
|
-
if (parentId === 22) return true;
|
|
26472
|
+
if (parentId === 142 || parentId === 134 || parentId === 109 && parent.property === node || parentId === 133 && parent.property === node || parentId === 224) return false;
|
|
26473
|
+
if (parentId === 22 || parentId === 149) return true;
|
|
26018
26474
|
if (parentId === 69) return parent.right === node;
|
|
26019
26475
|
if (parentId === 61) return true;
|
|
26020
26476
|
return !isStatement$4(parent);
|
|
26021
26477
|
}
|
|
26022
26478
|
function YieldExpression$1(node, parent, parentId) {
|
|
26023
|
-
return parentId === 11 || parentId === 108 || parentId ===
|
|
26479
|
+
return parentId === 11 || parentId === 108 || parentId === 238 || parentId === 143 || hasPostfixPart$1(node, parent, parentId) || parentId === 8 && isYieldExpression(node) || parentId === 29 && node === parent.test || isClassExtendsClause(node, parent, parentId) || isTSTypeExpression(parentId);
|
|
26024
26480
|
}
|
|
26025
26481
|
function ClassExpression(node, parent, parentId, tokenContext) {
|
|
26026
26482
|
return (tokenContext & 5) > 0;
|
|
26027
26483
|
}
|
|
26028
26484
|
function UnaryLike(node, parent, parentId) {
|
|
26029
|
-
return hasPostfixPart(node, parent, parentId) || parentId === 11 && parent.operator === "**" && parent.left === node || isClassExtendsClause(node, parent, parentId);
|
|
26485
|
+
return hasPostfixPart$1(node, parent, parentId) || parentId === 11 && parent.operator === "**" && parent.left === node || isClassExtendsClause(node, parent, parentId);
|
|
26030
26486
|
}
|
|
26031
26487
|
function FunctionExpression$1(node, parent, parentId, tokenContext) {
|
|
26032
26488
|
return (tokenContext & 5) > 0;
|
|
26033
26489
|
}
|
|
26034
26490
|
function ConditionalExpression$1(node, parent, parentId) {
|
|
26035
26491
|
switch (parentId) {
|
|
26036
|
-
case
|
|
26492
|
+
case 238:
|
|
26037
26493
|
case 143:
|
|
26038
26494
|
case 11:
|
|
26039
26495
|
case 108:
|
|
@@ -26104,13 +26560,14 @@ const parens = /*#__PURE__*/ Object.defineProperty({
|
|
|
26104
26560
|
TSInstantiationExpression: TSInstantiationExpression$1,
|
|
26105
26561
|
TSIntersectionType: TSIntersectionType$1,
|
|
26106
26562
|
TSSatisfiesExpression: TSAsExpression$1,
|
|
26107
|
-
TSTypeAssertion:
|
|
26563
|
+
TSTypeAssertion: TSTypeAssertion$1,
|
|
26108
26564
|
TSTypeOperator: TSTypeOperator$1,
|
|
26109
26565
|
TSUnionType: TSUnionType$1,
|
|
26110
26566
|
UnaryExpression: UnaryLike,
|
|
26111
26567
|
UnionTypeAnnotation: UnionTypeAnnotation$1,
|
|
26112
26568
|
UpdateExpression: UpdateExpression$1,
|
|
26113
|
-
YieldExpression: YieldExpression$1
|
|
26569
|
+
YieldExpression: YieldExpression$1,
|
|
26570
|
+
hasPostfixPart: hasPostfixPart$1
|
|
26114
26571
|
}, Symbol.toStringTag, { value: "Module" });
|
|
26115
26572
|
function TaggedTemplateExpression$1(node) {
|
|
26116
26573
|
this.print(node.tag);
|
|
@@ -26135,7 +26592,7 @@ function _printTemplate(node, substitutions) {
|
|
|
26135
26592
|
function TemplateLiteral$1(node) {
|
|
26136
26593
|
_printTemplate.call(this, node, node.expressions);
|
|
26137
26594
|
}
|
|
26138
|
-
const {
|
|
26595
|
+
const { isLiteral: isLiteral$2, isMemberExpression: isMemberExpression$2, isPattern } = lib_exports;
|
|
26139
26596
|
function UnaryExpression$1(node) {
|
|
26140
26597
|
const { operator } = node;
|
|
26141
26598
|
const firstChar = operator.charCodeAt(0);
|
|
@@ -26189,12 +26646,18 @@ function _printExpressionArguments(node) {
|
|
|
26189
26646
|
this.rightParens(node);
|
|
26190
26647
|
}
|
|
26191
26648
|
function NewExpression$1(node, parent) {
|
|
26649
|
+
const omitArguments = this.format.minified && node.arguments.length === 0 && !node.typeArguments;
|
|
26650
|
+
const wrapInParens = omitArguments && hasPostfixPart(node, parent);
|
|
26651
|
+
if (wrapInParens) this.tokenChar(40);
|
|
26192
26652
|
this.word("new");
|
|
26193
26653
|
this.space();
|
|
26194
26654
|
this.print(node.callee);
|
|
26195
|
-
if (
|
|
26655
|
+
if (omitArguments) {
|
|
26656
|
+
if (wrapInParens) this.tokenChar(41);
|
|
26657
|
+
return;
|
|
26658
|
+
}
|
|
26196
26659
|
this.print(node.typeArguments);
|
|
26197
|
-
if (node.arguments.length === 0 && this.tokenMap && !this.tokenMap.endMatches(node, ")")) return;
|
|
26660
|
+
if (node.arguments.length === 0 && this.tokenMap && !this.tokenMap.endMatches(node, ")") && (!hasPostfixPart(node, parent) || node.extra?.parenthesized)) return;
|
|
26198
26661
|
_printExpressionArguments.call(this, node);
|
|
26199
26662
|
}
|
|
26200
26663
|
function SequenceExpression$2(node) {
|
|
@@ -27223,9 +27686,13 @@ function TSImportType(node) {
|
|
|
27223
27686
|
if (typeArguments) this.print(typeArguments);
|
|
27224
27687
|
}
|
|
27225
27688
|
function TSImportEqualsDeclaration(node) {
|
|
27226
|
-
const { id, moduleReference } = node;
|
|
27689
|
+
const { id, moduleReference, importKind } = node;
|
|
27227
27690
|
this.word("import");
|
|
27228
27691
|
this.space();
|
|
27692
|
+
if (importKind === "type") {
|
|
27693
|
+
this.word("type");
|
|
27694
|
+
this.space();
|
|
27695
|
+
}
|
|
27229
27696
|
this.print(id);
|
|
27230
27697
|
this.space();
|
|
27231
27698
|
this.tokenChar(61);
|
|
@@ -27307,14 +27774,23 @@ function printModifiersList(printer, node, modifiers) {
|
|
|
27307
27774
|
printer.space();
|
|
27308
27775
|
}
|
|
27309
27776
|
}
|
|
27310
|
-
const { isClassDeclaration: isClassDeclaration$1, isExportDefaultSpecifier, isExportNamespaceSpecifier, isImportDefaultSpecifier, isImportNamespaceSpecifier, isStatement: isStatement$2$1 } = lib_exports;
|
|
27777
|
+
const { isClassDeclaration: isClassDeclaration$1, isExportDefaultSpecifier, isExportNamespaceSpecifier: isExportNamespaceSpecifier$1, isImportDefaultSpecifier, isImportNamespaceSpecifier, isStatement: isStatement$2$1 } = lib_exports;
|
|
27778
|
+
function isSameModuleExportName(a, b) {
|
|
27779
|
+
if (a.type === "Identifier") return b.type === "Identifier" && a.name === b.name;
|
|
27780
|
+
return b.type === "StringLiteral" && a.value === b.value;
|
|
27781
|
+
}
|
|
27782
|
+
function shouldPrintModuleSpecifierAlias(printer, node, a, b) {
|
|
27783
|
+
if (!isSameModuleExportName(a, b)) return true;
|
|
27784
|
+
if (printer.tokenMap) return printer.tokenMap.findMatching(node, "as") !== null;
|
|
27785
|
+
return false;
|
|
27786
|
+
}
|
|
27311
27787
|
function ImportSpecifier(node) {
|
|
27312
27788
|
if (node.importKind === "type" || node.importKind === "typeof") {
|
|
27313
27789
|
this.word(node.importKind);
|
|
27314
27790
|
this.space();
|
|
27315
27791
|
}
|
|
27316
27792
|
this.print(node.imported);
|
|
27317
|
-
if (node.local && node
|
|
27793
|
+
if (node.local && shouldPrintModuleSpecifierAlias(this, node, node.imported, node.local)) {
|
|
27318
27794
|
this.space();
|
|
27319
27795
|
this.word("as");
|
|
27320
27796
|
this.space();
|
|
@@ -27333,15 +27809,26 @@ function ExportSpecifier(node) {
|
|
|
27333
27809
|
this.space();
|
|
27334
27810
|
}
|
|
27335
27811
|
this.print(node.local);
|
|
27336
|
-
if (node.exported && node.local
|
|
27812
|
+
if (node.exported && shouldPrintModuleSpecifierAlias(this, node, node.local, node.exported)) {
|
|
27337
27813
|
this.space();
|
|
27338
27814
|
this.word("as");
|
|
27339
27815
|
this.space();
|
|
27340
27816
|
this.print(node.exported);
|
|
27341
27817
|
}
|
|
27342
27818
|
}
|
|
27819
|
+
function _printNamespaceFilter(exportsFilter) {
|
|
27820
|
+
if (exportsFilter) {
|
|
27821
|
+
this.tokenChar(123);
|
|
27822
|
+
if (exportsFilter.length) {
|
|
27823
|
+
this.space();
|
|
27824
|
+
this.printList(exportsFilter, this.shouldPrintTrailingComma("}"));
|
|
27825
|
+
this.space();
|
|
27826
|
+
}
|
|
27827
|
+
this.tokenChar(125);
|
|
27828
|
+
} else this.tokenChar(42);
|
|
27829
|
+
}
|
|
27343
27830
|
function ExportNamespaceSpecifier(node) {
|
|
27344
|
-
this.
|
|
27831
|
+
_printNamespaceFilter.call(this, node.exportsFilter);
|
|
27345
27832
|
this.space();
|
|
27346
27833
|
this.word("as");
|
|
27347
27834
|
this.space();
|
|
@@ -27365,15 +27852,19 @@ function ExportAllDeclaration(node) {
|
|
|
27365
27852
|
this.word("type");
|
|
27366
27853
|
this.space();
|
|
27367
27854
|
}
|
|
27855
|
+
if (node.phase === "defer") {
|
|
27856
|
+
this.word("defer");
|
|
27857
|
+
this.space();
|
|
27858
|
+
}
|
|
27368
27859
|
this.tokenChar(42);
|
|
27369
27860
|
this.space();
|
|
27370
27861
|
this.word("from");
|
|
27371
27862
|
this.space();
|
|
27863
|
+
this.print(node.source);
|
|
27372
27864
|
if (node.attributes?.length) {
|
|
27373
|
-
this.print(node.source, true);
|
|
27374
27865
|
this.space();
|
|
27375
27866
|
_printAttributes.call(this, node, false);
|
|
27376
|
-
}
|
|
27867
|
+
}
|
|
27377
27868
|
this.semicolon();
|
|
27378
27869
|
}
|
|
27379
27870
|
function maybePrintDecoratorsBeforeExport(printer, node) {
|
|
@@ -27392,11 +27883,15 @@ function ExportNamedDeclaration(node) {
|
|
|
27392
27883
|
this.word("type");
|
|
27393
27884
|
this.space();
|
|
27394
27885
|
}
|
|
27886
|
+
if (node.phase === "defer") {
|
|
27887
|
+
this.word("defer");
|
|
27888
|
+
this.space();
|
|
27889
|
+
}
|
|
27395
27890
|
const specifiers = node.specifiers.slice(0);
|
|
27396
27891
|
let hasSpecial = false;
|
|
27397
27892
|
for (;;) {
|
|
27398
27893
|
const first = specifiers[0];
|
|
27399
|
-
if (isExportDefaultSpecifier(first) || isExportNamespaceSpecifier(first)) {
|
|
27894
|
+
if (isExportDefaultSpecifier(first) || isExportNamespaceSpecifier$1(first)) {
|
|
27400
27895
|
hasSpecial = true;
|
|
27401
27896
|
this.print(specifiers.shift());
|
|
27402
27897
|
if (specifiers.length) {
|
|
@@ -27420,11 +27915,11 @@ function ExportNamedDeclaration(node) {
|
|
|
27420
27915
|
this.space();
|
|
27421
27916
|
this.word("from");
|
|
27422
27917
|
this.space();
|
|
27918
|
+
this.print(node.source);
|
|
27423
27919
|
if (node.attributes?.length) {
|
|
27424
|
-
this.print(node.source, true);
|
|
27425
27920
|
this.space();
|
|
27426
27921
|
_printAttributes.call(this, node, hasBrace);
|
|
27427
|
-
}
|
|
27922
|
+
}
|
|
27428
27923
|
}
|
|
27429
27924
|
this.semicolon();
|
|
27430
27925
|
}
|
|
@@ -27488,11 +27983,11 @@ function ImportDeclaration(node) {
|
|
|
27488
27983
|
this.word("from");
|
|
27489
27984
|
this.space();
|
|
27490
27985
|
}
|
|
27986
|
+
this.print(node.source);
|
|
27491
27987
|
if (node.attributes?.length) {
|
|
27492
|
-
this.print(node.source, true);
|
|
27493
27988
|
this.space();
|
|
27494
27989
|
_printAttributes.call(this, node, hasBrace);
|
|
27495
|
-
}
|
|
27990
|
+
}
|
|
27496
27991
|
this.semicolon();
|
|
27497
27992
|
}
|
|
27498
27993
|
function ImportAttribute(node) {
|
|
@@ -27502,7 +27997,7 @@ function ImportAttribute(node) {
|
|
|
27502
27997
|
this.print(node.value);
|
|
27503
27998
|
}
|
|
27504
27999
|
function ImportNamespaceSpecifier(node) {
|
|
27505
|
-
this.
|
|
28000
|
+
_printNamespaceFilter.call(this, node.exportsFilter);
|
|
27506
28001
|
this.space();
|
|
27507
28002
|
this.word("as");
|
|
27508
28003
|
this.space();
|
|
@@ -27513,6 +28008,9 @@ function ImportExpression(node) {
|
|
|
27513
28008
|
if (node.phase) {
|
|
27514
28009
|
this.tokenChar(46);
|
|
27515
28010
|
this.word(node.phase);
|
|
28011
|
+
} else if (node.sync) {
|
|
28012
|
+
this.tokenChar(46);
|
|
28013
|
+
this.word("sync");
|
|
27516
28014
|
}
|
|
27517
28015
|
this.tokenChar(40);
|
|
27518
28016
|
const shouldPrintTrailingComma = this.shouldPrintTrailingComma(")");
|
|
@@ -27654,7 +28152,7 @@ function TopicReference() {
|
|
|
27654
28152
|
function VoidPattern() {
|
|
27655
28153
|
this.word("void");
|
|
27656
28154
|
}
|
|
27657
|
-
const { isDeclareExportDeclaration, isStatement: isStatement$1$3 } = lib_exports;
|
|
28155
|
+
const { isDeclareExportDeclaration, isExportNamespaceSpecifier, isStatement: isStatement$1$3 } = lib_exports;
|
|
27658
28156
|
function AnyTypeAnnotation() {
|
|
27659
28157
|
this.word("any");
|
|
27660
28158
|
}
|
|
@@ -27847,13 +28345,17 @@ function FlowExportDeclaration(node) {
|
|
|
27847
28345
|
this.print(declar);
|
|
27848
28346
|
if (!isStatement$1$3(declar)) this.semicolon();
|
|
27849
28347
|
} else {
|
|
27850
|
-
|
|
27851
|
-
if (
|
|
27852
|
-
|
|
27853
|
-
this.
|
|
27854
|
-
|
|
28348
|
+
const specifiers = node.specifiers;
|
|
28349
|
+
if (specifiers.length === 1 && isExportNamespaceSpecifier(specifiers[0])) this.print(specifiers[0]);
|
|
28350
|
+
else {
|
|
28351
|
+
this.tokenChar(123);
|
|
28352
|
+
if (specifiers.length) {
|
|
28353
|
+
this.space();
|
|
28354
|
+
this.printList(specifiers);
|
|
28355
|
+
this.space();
|
|
28356
|
+
}
|
|
28357
|
+
this.tokenChar(125);
|
|
27855
28358
|
}
|
|
27856
|
-
this.tokenChar(125);
|
|
27857
28359
|
if (node.source) {
|
|
27858
28360
|
this.space();
|
|
27859
28361
|
this.word("from");
|
|
@@ -28357,6 +28859,21 @@ function StaticBlock(node) {
|
|
|
28357
28859
|
this.rightBrace(node);
|
|
28358
28860
|
}
|
|
28359
28861
|
}
|
|
28862
|
+
function StructDeclaration(node) {
|
|
28863
|
+
this.word("struct", true);
|
|
28864
|
+
if (node.id) {
|
|
28865
|
+
this.space();
|
|
28866
|
+
this.print(node.id);
|
|
28867
|
+
}
|
|
28868
|
+
if (node.superClass) {
|
|
28869
|
+
this.space();
|
|
28870
|
+
this.word("extends");
|
|
28871
|
+
this.space();
|
|
28872
|
+
this.print(node.superClass);
|
|
28873
|
+
}
|
|
28874
|
+
this.space();
|
|
28875
|
+
this.print(node.body);
|
|
28876
|
+
}
|
|
28360
28877
|
function File(node) {
|
|
28361
28878
|
if (node.program) this.print(node.program.interpreter);
|
|
28362
28879
|
this.print(node.program);
|
|
@@ -28653,6 +29170,8 @@ const generatorFunctions = /*#__PURE__*/ Object.defineProperty({
|
|
|
28653
29170
|
StringLiteral: StringLiteral$1,
|
|
28654
29171
|
StringLiteralTypeAnnotation: StringLiteral$1,
|
|
28655
29172
|
StringTypeAnnotation,
|
|
29173
|
+
StructBody: ClassBody,
|
|
29174
|
+
StructDeclaration,
|
|
28656
29175
|
Super,
|
|
28657
29176
|
SwitchCase,
|
|
28658
29177
|
SwitchStatement,
|
|
@@ -28784,6 +29303,9 @@ for (const type of Object.keys(parens)) {
|
|
|
28784
29303
|
const func = parens[type];
|
|
28785
29304
|
if (generatorInfosMap.has(type)) generatorInfosMap.get(type)[2] = func;
|
|
28786
29305
|
}
|
|
29306
|
+
function hasPostfixPart(node, parent) {
|
|
29307
|
+
return parent != null && hasPostfixPart$1(node, parent, generatorInfosMap.get(parent.type)[1]);
|
|
29308
|
+
}
|
|
28787
29309
|
function newCalleeNeedsParens(node) {
|
|
28788
29310
|
let current = node;
|
|
28789
29311
|
while (true) switch (current.type) {
|
|
@@ -28821,7 +29343,7 @@ function parentNeedsParens(node, parent, parentId) {
|
|
|
28821
29343
|
case 113:
|
|
28822
29344
|
if (parent.callee === node) return newCalleeNeedsParens(node);
|
|
28823
29345
|
break;
|
|
28824
|
-
case
|
|
29346
|
+
case 222:
|
|
28825
29347
|
if (parent.tag === node) return templateTagNeedsParens(node);
|
|
28826
29348
|
break;
|
|
28827
29349
|
case 43: return !isDecoratorMemberExpression(node) && !(node.type === "CallExpression" && isDecoratorMemberExpression(node.callee)) && node.type !== "ParenthesizedExpression";
|
|
@@ -29292,7 +29814,7 @@ var Printer = class {
|
|
|
29292
29814
|
let shouldPrintParens = parenthesized && flags & 1 || parenthesized && flags & 16 && nodeId === 72 || parent && (parentNeedsParens(node, parent, parentId) || needsParens != null && needsParens(node, parent, parentId, this.tokenContext, flags & 1 ? this._boundGetRawIdentifier : void 0));
|
|
29293
29815
|
if (!shouldPrintParens && parenthesized && node.leadingComments?.length && node.leadingComments[0].type === "CommentBlock") switch (parentId) {
|
|
29294
29816
|
case 66:
|
|
29295
|
-
case
|
|
29817
|
+
case 243:
|
|
29296
29818
|
case 6:
|
|
29297
29819
|
case 141: break;
|
|
29298
29820
|
case 18:
|
|
@@ -30092,7 +30614,7 @@ const index = Object.assign(smart.bind(void 0), {
|
|
|
30092
30614
|
ast: smart.ast
|
|
30093
30615
|
});
|
|
30094
30616
|
//#endregion
|
|
30095
|
-
//#region node_modules/.pnpm/@babel+traverse@8.0
|
|
30617
|
+
//#region node_modules/.pnpm/@babel+traverse@8.1.0/node_modules/@babel/traverse/lib/index.js
|
|
30096
30618
|
const virtualTypes = /*#__PURE__*/ Object.defineProperty({
|
|
30097
30619
|
__proto__: null,
|
|
30098
30620
|
BindingIdentifier: ["Identifier"],
|
|
@@ -30388,7 +30910,7 @@ function verify$1(visitor) {
|
|
|
30388
30910
|
for (const nodeType of Object.keys(visitor)) {
|
|
30389
30911
|
if (nodeType === "enter" || nodeType === "exit") validateVisitorMethods(nodeType, visitor[nodeType]);
|
|
30390
30912
|
if (shouldIgnoreKey(nodeType)) continue;
|
|
30391
|
-
if (!TYPES.includes(nodeType)) throw new Error(`You gave us a visitor for the node type ${nodeType} but it's not a valid type in @babel/traverse 8.0
|
|
30913
|
+
if (!TYPES.includes(nodeType)) throw new Error(`You gave us a visitor for the node type ${nodeType} but it's not a valid type in @babel/traverse 8.1.0`);
|
|
30392
30914
|
const visitors = visitor[nodeType];
|
|
30393
30915
|
if (typeof visitors === "object") for (const visitorKey of Object.keys(visitors)) if (visitorKey === "enter" || visitorKey === "exit") validateVisitorMethods(`${nodeType}.${visitorKey}`, visitors[visitorKey]);
|
|
30394
30916
|
else throw new Error(`You passed \`traverse()\` a visitor object with the property ${nodeType} that has the invalid property ${visitorKey}`);
|
|
@@ -30686,7 +31208,7 @@ const cache = /*#__PURE__*/ Object.defineProperty({
|
|
|
30686
31208
|
return scope;
|
|
30687
31209
|
}
|
|
30688
31210
|
}, Symbol.toStringTag, { value: "Module" });
|
|
30689
|
-
const { assignmentExpression: assignmentExpression$3, cloneNode: cloneNode$3, getBindingIdentifiers: getBindingIdentifiers$2, identifier: identifier$3, isArrayExpression, isBinary, isCallExpression: isCallExpression$1, isClass, isClassBody, isClassDeclaration, isExportAllDeclaration, isExportDefaultDeclaration, isExportNamedDeclaration: isExportNamedDeclaration$1, isFunctionDeclaration, isIdentifier: isIdentifier$4, isImportDeclaration, isLiteral: isLiteral$1, isMemberExpression, isMethod, isModuleSpecifier, isNullLiteral, isObjectExpression, isProperty, isPureish, isRegExpLiteral, isSuper: isSuper$1, isTaggedTemplateExpression, isTemplateLiteral, isThisExpression, isUnaryExpression, isVariableDeclaration: isVariableDeclaration$1, expressionStatement: expressionStatement$3, matchesPattern: matchesPattern$1, toIdentifier, variableDeclaration: variableDeclaration$1, variableDeclarator: variableDeclarator$1, isObjectProperty, isTopicReference, isMetaProperty, isPrivateName, isExportDeclaration, sequenceExpression: sequenceExpression$2 } = lib_exports;
|
|
31211
|
+
const { assignmentExpression: assignmentExpression$3, cloneNode: cloneNode$3, getBindingIdentifiers: getBindingIdentifiers$2, identifier: identifier$3, isArrayExpression, isBinary, isCallExpression: isCallExpression$1, isClass, isClassBody, isClassDeclaration, isExportAllDeclaration, isExportDefaultDeclaration, isExportNamedDeclaration: isExportNamedDeclaration$1, isFunctionDeclaration, isIdentifier: isIdentifier$4, isImportDeclaration, isLiteral: isLiteral$1, isMemberExpression, isMethod, isModuleSpecifier, isNullLiteral, isObjectExpression, isProperty, isPureish, isRegExpLiteral, isRestElement: isRestElement$1, isSuper: isSuper$1, isTaggedTemplateExpression, isTemplateLiteral, isThisExpression, isUnaryExpression, isVariableDeclaration: isVariableDeclaration$1, expressionStatement: expressionStatement$3, matchesPattern: matchesPattern$1, toIdentifier, variableDeclaration: variableDeclaration$1, variableDeclarator: variableDeclarator$1, isObjectProperty, isTopicReference, isMetaProperty, isPrivateName, isExportDeclaration, sequenceExpression: sequenceExpression$2 } = lib_exports;
|
|
30690
31212
|
function gatherNodeParts(node, parts) {
|
|
30691
31213
|
switch (node?.type) {
|
|
30692
31214
|
default:
|
|
@@ -30792,6 +31314,13 @@ function gatherNodeParts(node, parts) {
|
|
|
30792
31314
|
gatherNodeParts(node.name, parts);
|
|
30793
31315
|
}
|
|
30794
31316
|
}
|
|
31317
|
+
const uidCandidateStart = /* @__PURE__ */ new WeakMap();
|
|
31318
|
+
function uidCandidate(name, i) {
|
|
31319
|
+
if (i >= 11) return `_${name}${i - 1}`;
|
|
31320
|
+
if (i >= 9) return `_${name}${i - 9}`;
|
|
31321
|
+
if (i >= 1) return `_${name}${i + 1}`;
|
|
31322
|
+
return `_${name}`;
|
|
31323
|
+
}
|
|
30795
31324
|
function resetScope(scope) {
|
|
30796
31325
|
if (scope.path.type === "Program") {
|
|
30797
31326
|
scope.referencesSet = /* @__PURE__ */ new Set();
|
|
@@ -30940,17 +31469,18 @@ var Scope = class Scope {
|
|
|
30940
31469
|
}
|
|
30941
31470
|
generateUid(name = "temp") {
|
|
30942
31471
|
name = toIdentifier(name).replace(/^_+/, "").replace(/\d+$/g, "");
|
|
30943
|
-
let uid;
|
|
30944
|
-
let i = 0;
|
|
30945
|
-
do {
|
|
30946
|
-
uid = `_${name}`;
|
|
30947
|
-
if (i >= 11) uid += i - 1;
|
|
30948
|
-
else if (i >= 9) uid += i - 9;
|
|
30949
|
-
else if (i >= 1) uid += i + 1;
|
|
30950
|
-
i++;
|
|
30951
|
-
} while (this.hasLabel(uid) || this.hasBinding(uid) || this.hasGlobal(uid) || this.hasReference(uid));
|
|
30952
31472
|
const program = this.getProgramParent();
|
|
30953
|
-
program
|
|
31473
|
+
const { referencesSet } = program;
|
|
31474
|
+
let starts = uidCandidateStart.get(referencesSet);
|
|
31475
|
+
if (!starts) uidCandidateStart.set(referencesSet, starts = /* @__PURE__ */ new Map());
|
|
31476
|
+
let i = starts.get(name) ?? 0;
|
|
31477
|
+
while (referencesSet.has(uidCandidate(name, i))) i++;
|
|
31478
|
+
starts.set(name, i);
|
|
31479
|
+
let uid;
|
|
31480
|
+
do
|
|
31481
|
+
uid = uidCandidate(name, i++);
|
|
31482
|
+
while (referencesSet.has(uid) || this.hasLabel(uid) || this.hasBinding(uid) || this.hasGlobal(uid));
|
|
31483
|
+
referencesSet.add(uid);
|
|
30954
31484
|
program.uidsSet.add(uid);
|
|
30955
31485
|
return uid;
|
|
30956
31486
|
}
|
|
@@ -31201,7 +31731,7 @@ var Scope = class Scope {
|
|
|
31201
31731
|
else if (!path.isBlockStatement() && !path.isProgram()) path = this.getBlockParent().path;
|
|
31202
31732
|
if (path.isSwitchStatement()) path = (this.getFunctionParent() || this.getProgramParent()).path;
|
|
31203
31733
|
const { init, unique, kind = "var", id } = opts;
|
|
31204
|
-
if (!init && !unique && (kind === "var" || kind === "let") && isAnonymousFunctionExpression(path) && isCallExpression$1(path.parent, { callee: path.node }) && path.parent.arguments.length <= path.node.params.length && isIdentifier$4(id)) {
|
|
31734
|
+
if (!init && !unique && (kind === "var" || kind === "let") && isAnonymousFunctionExpression(path) && isCallExpression$1(path.parent, { callee: path.node }) && path.parent.arguments.length <= path.node.params.length && (path.node.params.length === 0 || !isRestElement$1(path.node.params[path.node.params.length - 1])) && isIdentifier$4(id)) {
|
|
31205
31735
|
path.pushContainer("params", id);
|
|
31206
31736
|
path.scope.registerBinding("param", path.get("params")[path.node.params.length - 1]);
|
|
31207
31737
|
return;
|
|
@@ -31220,8 +31750,15 @@ var Scope = class Scope {
|
|
|
31220
31750
|
if (!unique) path.setData(dataKey, declarPath);
|
|
31221
31751
|
}
|
|
31222
31752
|
const declarator = variableDeclarator$1(id, init);
|
|
31223
|
-
const
|
|
31224
|
-
|
|
31753
|
+
const { declarations } = declarPath.node;
|
|
31754
|
+
const len = declarations.push(declarator);
|
|
31755
|
+
path.scope.registerBinding(kind, NodePath_Final.get({
|
|
31756
|
+
listKey: "declarations",
|
|
31757
|
+
parentPath: declarPath,
|
|
31758
|
+
parent: declarPath.node,
|
|
31759
|
+
container: declarations,
|
|
31760
|
+
key: len - 1
|
|
31761
|
+
}).setContext(declarPath.context));
|
|
31225
31762
|
}
|
|
31226
31763
|
getProgramParent() {
|
|
31227
31764
|
let scope = this;
|
|
@@ -32868,7 +33405,13 @@ function referencesImport(moduleSource, importName) {
|
|
|
32868
33405
|
if (!this.isReferencedIdentifier()) {
|
|
32869
33406
|
if (this.isJSXMemberExpression() && this.node.property.name === importName || (this.isMemberExpression() || this.isOptionalMemberExpression()) && (this.node.computed ? isStringLiteral(this.node.property, { value: importName }) : this.node.property.name === importName)) {
|
|
32870
33407
|
const object = this.get("object");
|
|
32871
|
-
|
|
33408
|
+
if (!object.isReferencedIdentifier()) return false;
|
|
33409
|
+
const binding = object.scope.getBinding(object.node.name);
|
|
33410
|
+
if (binding?.kind !== "module") return false;
|
|
33411
|
+
const { path } = binding;
|
|
33412
|
+
if (!path.isImportNamespaceSpecifier() || path.parent.source.value !== moduleSource) return false;
|
|
33413
|
+
const { exportsFilter } = path.node;
|
|
33414
|
+
return !exportsFilter || isInExportsFilter(exportsFilter, importName);
|
|
32872
33415
|
}
|
|
32873
33416
|
return false;
|
|
32874
33417
|
}
|
|
@@ -32881,10 +33424,13 @@ function referencesImport(moduleSource, importName) {
|
|
|
32881
33424
|
if (!importName) return true;
|
|
32882
33425
|
} else return false;
|
|
32883
33426
|
if (path.isImportDefaultSpecifier() && importName === "default") return true;
|
|
32884
|
-
if (path.isImportNamespaceSpecifier() && importName === "*"
|
|
33427
|
+
if (path.isImportNamespaceSpecifier()) return !path.node.exportsFilter && importName === "*";
|
|
32885
33428
|
if (path.isImportSpecifier() && isIdentifier(path.node.imported, { name: importName })) return true;
|
|
32886
33429
|
return false;
|
|
32887
33430
|
}
|
|
33431
|
+
function isInExportsFilter(exportsFilter, importName) {
|
|
33432
|
+
return exportsFilter.some((name) => isIdentifier(name, { name: importName }) || isStringLiteral(name, { value: importName }));
|
|
33433
|
+
}
|
|
32888
33434
|
function getSource() {
|
|
32889
33435
|
const node = this.node;
|
|
32890
33436
|
if (node.end) {
|
|
@@ -34074,4 +34620,4 @@ const createSectionPreviewCache = () => {
|
|
|
34074
34620
|
//#endregion
|
|
34075
34621
|
export { jsxOpeningFragment as $, isJSXText as A, isTSSatisfiesExpression as B, isJSXElement as C, isJSXIdentifier$2 as D, isJSXFragment as E, isParenthesizedExpression as F, jsxClosingElement as G, isTemplateLiteral$1 as H, isSpreadElement as I, jsxExpressionContainer as J, jsxClosingFragment as K, isStringLiteral$3 as L, isNumericLiteral as M, isObjectExpression$1 as N, isJSXOpeningElement as O, isObjectProperty$1 as P, jsxOpeningElement as Q, isTSAsExpression as R, isJSXAttribute as S, isJSXExpressionContainer as T, isUnaryExpression$1 as U, isTSTypeAssertion as V, jsxAttribute as W, jsxIdentifier$1 as X, jsxFragment as Y, jsxMemberExpression as Z, identifier$5 as _, inspectDocument as a, stringLiteral$2 as at, isExpression$5 as b, traverse as c, traverseFast$2 as ct, applyEdits as d, parseExpression as dt, jsxText as et, getJSXTagName as f, booleanLiteral as g, arrayExpression as h, getSections as i, objectProperty as it, isNullLiteral$1 as j, isJSXSpreadAttribute as k, fillIdsFrom as l, unaryExpression$1 as lt, generate as m, fillSectionIds as n, numericLiteral$1 as nt, parseDocument as o, templateElement as ot, nanoid as p, jsxElement as q, generateSectionPreview as r, objectExpression$1 as rt, replaceDocumentSections as s, templateLiteral as st, createSectionPreviewCache as t, nullLiteral as tt, replaceIds as u, parse$1 as ut, isArrayExpression$1 as v, isJSXEmptyExpression as w, isIdentifier$7 as x, isBooleanLiteral as y, isTSNonNullExpression as z };
|
|
34076
34622
|
|
|
34077
|
-
//# sourceMappingURL=document-
|
|
34623
|
+
//# sourceMappingURL=document-MkQGxfry.js.map
|