@jbpark/live-editor 5.0.0 → 6.1.0
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 +34 -32
- package/README.md +34 -32
- package/dist/{boundary-6_nTsWxP.js → boundary-CySnDUs2.js} +5 -4
- package/dist/boundary-CySnDUs2.js.map +1 -0
- package/dist/{compile-DwOyWrmI.js → compile-my0AjsCw.js} +3 -3
- package/dist/{compile-DwOyWrmI.js.map → compile-my0AjsCw.js.map} +1 -1
- package/dist/{constants-D-XKuEY2.js → constants-st9gnJ5g.js} +1 -4
- package/dist/{constants-D-XKuEY2.js.map → constants-st9gnJ5g.js.map} +1 -1
- package/dist/{context-DDR1xVKo.js → context-Bjq0CvBE.js} +3 -3
- package/dist/{context-DDR1xVKo.js.map → context-Bjq0CvBE.js.map} +1 -1
- package/dist/{core-CKazr4tT.js → core-BNVuH8-l.js} +51 -14
- package/dist/core-BNVuH8-l.js.map +1 -0
- package/dist/{detect-typescript-CoAO-QUJ.js → detect-typescript-CMF0FVKD.js} +2 -2
- package/dist/{detect-typescript-CoAO-QUJ.js.map → detect-typescript-CMF0FVKD.js.map} +1 -1
- package/dist/dnd/index.d.ts +2 -1
- package/dist/dnd/index.js +2 -1
- package/dist/{dnd-BlC1gqUy.js → dnd-COjjjuD7.js} +1242 -1459
- package/dist/dnd-COjjjuD7.js.map +1 -0
- package/dist/{document-DcwIEHRV.js → document-BkGWDZGc.js} +685 -531
- package/dist/document-BkGWDZGc.js.map +1 -0
- package/dist/edit-options-C_r9aCz4.d.ts +100 -0
- package/dist/editor/index.d.ts +1 -1
- package/dist/editor/index.js +2 -2
- package/dist/{editor-Bty5XzpV.js → editor-CvnzrM9J.js} +2 -2
- package/dist/{editor-Bty5XzpV.js.map → editor-CvnzrM9J.js.map} +1 -1
- package/dist/error/index.d.ts +1 -1
- package/dist/error/index.js +2 -2
- package/dist/{error-DyYx2NQ2.js → error-CFzvnLCf.js} +4 -4
- package/dist/error-CFzvnLCf.js.map +1 -0
- package/dist/{index-tAiuHZsC.d.ts → index-BZpZwrxT.d.ts} +2 -2
- package/dist/{index-13BDSrQc.d.ts → index-C93npmTU.d.ts} +4 -6
- package/dist/{index-Cl79M7ZJ.d.ts → index-CqsS207F.d.ts} +2 -10
- package/dist/{index-0VB5C3Jk.d.ts → index-DQcdHg_V.d.ts} +4 -100
- package/dist/{index-kKUjo9lr.d.ts → index-DfIvkht8.d.ts} +3 -3
- package/dist/index.d.ts +8 -7
- package/dist/index.js +6 -6
- package/dist/{messages-Yb3b7YJt.d.ts → messages-BpN3QIhj.d.ts} +4 -1
- package/dist/{messages-Bt5WXKTE.js → messages-DrINcRdG.js} +4 -1
- package/dist/messages-DrINcRdG.js.map +1 -0
- package/dist/preview/index.d.ts +2 -2
- package/dist/preview/index.js +2 -3
- package/dist/{preview-DC0pyOdu.js → preview-8ejC5VP2.js} +16 -13
- package/dist/preview-8ejC5VP2.js.map +1 -0
- package/dist/provider/index.d.ts +2 -2
- package/dist/provider/index.js +2 -2
- package/dist/{sections-4uirsXRU.js → sections-rD8NuRI8.js} +3 -3
- package/dist/{sections-4uirsXRU.js.map → sections-rD8NuRI8.js.map} +1 -1
- package/dist/style.css +801 -5372
- package/dist/ui-kit/index.d.ts +22 -0
- package/dist/ui-kit/index.js +1552 -0
- package/dist/ui-kit/index.js.map +1 -0
- package/dist/ui-kit/style.css +5039 -0
- package/dist/{update-DNInQSM7.js → update-DyFnX8yE.js} +3 -3
- package/dist/{update-DNInQSM7.js.map → update-DyFnX8yE.js.map} +1 -1
- package/dist/{use-dynamic-tailwind-CSYKXDmX.js → use-dynamic-tailwind-0nuRN57N.js} +30 -34
- package/dist/use-dynamic-tailwind-0nuRN57N.js.map +1 -0
- package/dist/use-field-state-iQGW0vc6.js +131 -0
- package/dist/use-field-state-iQGW0vc6.js.map +1 -0
- package/dist/utils/ast/index.js +2 -2
- package/dist/utils/index.js +2 -2
- package/package.json +14 -4
- package/dist/boundary-6_nTsWxP.js.map +0 -1
- package/dist/core-CKazr4tT.js.map +0 -1
- package/dist/dnd-BlC1gqUy.js.map +0 -1
- package/dist/document-DcwIEHRV.js.map +0 -1
- package/dist/error-DyYx2NQ2.js.map +0 -1
- package/dist/messages-Bt5WXKTE.js.map +0 -1
- package/dist/preview-DC0pyOdu.js.map +0 -1
- package/dist/use-dynamic-tailwind-CSYKXDmX.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as DEFAULT_CONTAINER_ID, n as CONFIG, r as DATA_ATTR } from "./constants-
|
|
1
|
+
import { i as DEFAULT_CONTAINER_ID, n as CONFIG, r as DATA_ATTR } from "./constants-st9gnJ5g.js";
|
|
2
2
|
import { n as registerEditorCache } from "./editor-caches-ClMvdcQF.js";
|
|
3
3
|
import { t as createBoundedCache } from "./cache-B0-XcIxJ.js";
|
|
4
4
|
//#region \0rolldown/runtime.js
|
|
@@ -33,7 +33,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
33
|
enumerable: true
|
|
34
34
|
}) : target, mod));
|
|
35
35
|
//#endregion
|
|
36
|
-
//#region node_modules/.pnpm/@babel+parser@8.0.
|
|
36
|
+
//#region node_modules/.pnpm/@babel+parser@8.0.10/node_modules/@babel/parser/lib/index.js
|
|
37
37
|
var Position = class {
|
|
38
38
|
constructor(line, col, index) {
|
|
39
39
|
this.line = void 0;
|
|
@@ -155,7 +155,6 @@ const StandardErrors = {
|
|
|
155
155
|
InvalidLhs: ({ ancestor }) => `Invalid left-hand side in ${toNodeDescription(ancestor)}.`,
|
|
156
156
|
InvalidLhsBinding: ({ ancestor }) => `Binding invalid left-hand side in ${toNodeDescription(ancestor)}.`,
|
|
157
157
|
InvalidLhsOptionalChaining: ({ ancestor }) => `Invalid optional chaining in the left-hand side of ${toNodeDescription(ancestor)}.`,
|
|
158
|
-
InvalidNumber: "Invalid number.",
|
|
159
158
|
InvalidOrMissingExponent: "Floating-point numbers require a valid exponent after the 'e'.",
|
|
160
159
|
InvalidOrUnexpectedToken: ({ unexpected }) => `Unexpected character '${unexpected}'.`,
|
|
161
160
|
InvalidParenthesizedAssignment: "Invalid parenthesized assignment pattern.",
|
|
@@ -376,9 +375,11 @@ function getOptions(opts) {
|
|
|
376
375
|
return options;
|
|
377
376
|
}
|
|
378
377
|
function toESTreeLocation(node) {
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
378
|
+
if (node.loc) {
|
|
379
|
+
const { start, end } = node.loc;
|
|
380
|
+
node.loc.start = new Position(start.line, start.column);
|
|
381
|
+
node.loc.end = new Position(end.line, end.column);
|
|
382
|
+
}
|
|
382
383
|
return node;
|
|
383
384
|
}
|
|
384
385
|
const estree = (superClass) => class ESTreeParserMixin extends superClass {
|
|
@@ -922,6 +923,7 @@ const tt = {
|
|
|
922
923
|
}),
|
|
923
924
|
_for: createKeyword("for", { isLoop: isLoop$1 }),
|
|
924
925
|
_while: createKeyword("while", { isLoop: isLoop$1 }),
|
|
926
|
+
_arguments: createKeywordLike("arguments", { startsExpr }),
|
|
925
927
|
_as: createKeywordLike("as", { startsExpr }),
|
|
926
928
|
_assert: createKeywordLike("assert", { startsExpr }),
|
|
927
929
|
_async: createKeywordLike("async", { startsExpr }),
|
|
@@ -975,16 +977,16 @@ const tt = {
|
|
|
975
977
|
jsxTagEnd: createToken("jsxTagEnd")
|
|
976
978
|
};
|
|
977
979
|
function tokenIsIdentifier(token) {
|
|
978
|
-
return token >= 89 && token <=
|
|
980
|
+
return token >= 89 && token <= 130;
|
|
979
981
|
}
|
|
980
982
|
function tokenKeywordOrIdentifierIsKeyword(token) {
|
|
981
983
|
return token <= 88;
|
|
982
984
|
}
|
|
983
985
|
function tokenIsKeywordOrIdentifier(token) {
|
|
984
|
-
return token >= 54 && token <=
|
|
986
|
+
return token >= 54 && token <= 130;
|
|
985
987
|
}
|
|
986
988
|
function tokenIsLiteralPropertyName(token) {
|
|
987
|
-
return token >= 54 && token <=
|
|
989
|
+
return token >= 54 && token <= 133;
|
|
988
990
|
}
|
|
989
991
|
function tokenComesBeforeExpression(token) {
|
|
990
992
|
return tokenBeforeExprs[token];
|
|
@@ -996,7 +998,7 @@ function tokenIsAssignment(token) {
|
|
|
996
998
|
return token >= 25 && token <= 29;
|
|
997
999
|
}
|
|
998
1000
|
function tokenIsFlowInterfaceOrTypeOrOpaque(token) {
|
|
999
|
-
return token >=
|
|
1001
|
+
return token >= 126 && token <= 128;
|
|
1000
1002
|
}
|
|
1001
1003
|
function tokenIsLoop(token) {
|
|
1002
1004
|
return token >= 86 && token <= 88;
|
|
@@ -1014,10 +1016,10 @@ function tokenIsPrefix(token) {
|
|
|
1014
1016
|
return tokenPrefixes[token];
|
|
1015
1017
|
}
|
|
1016
1018
|
function tokenIsTSTypeOperator(token) {
|
|
1017
|
-
return token >=
|
|
1019
|
+
return token >= 118 && token <= 120;
|
|
1018
1020
|
}
|
|
1019
1021
|
function tokenIsTSDeclarationStart(token) {
|
|
1020
|
-
return token >=
|
|
1022
|
+
return token >= 121 && token <= 127;
|
|
1021
1023
|
}
|
|
1022
1024
|
function tokenLabelName(token) {
|
|
1023
1025
|
return tokenLabels[token];
|
|
@@ -1554,7 +1556,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
1554
1556
|
return this.getPluginOption("flow", "all") || this.flowPragma === "flow";
|
|
1555
1557
|
}
|
|
1556
1558
|
finishToken(type, val) {
|
|
1557
|
-
if (type !==
|
|
1559
|
+
if (type !== 131 && type !== 9 && type !== 24) {
|
|
1558
1560
|
if (this.flowPragma === void 0) this.flowPragma = null;
|
|
1559
1561
|
}
|
|
1560
1562
|
super.finishToken(type, val);
|
|
@@ -1581,7 +1583,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
1581
1583
|
const node = this.startNode();
|
|
1582
1584
|
const moduloLoc = this.state.startLoc;
|
|
1583
1585
|
this.next();
|
|
1584
|
-
this.expectContextual(
|
|
1586
|
+
this.expectContextual(107);
|
|
1585
1587
|
if (this.state.lastTokStartLoc.index > moduloLoc.index + 1) this.raise(FlowErrors.UnexpectedSpaceBetweenModuloChecks, moduloLoc);
|
|
1586
1588
|
if (this.eat(6)) {
|
|
1587
1589
|
node.value = super.parseExpression();
|
|
@@ -1635,15 +1637,15 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
1635
1637
|
if (this.match(76)) return this.flowParseDeclareClass(node);
|
|
1636
1638
|
else if (this.match(64)) return this.flowParseDeclareFunction(node);
|
|
1637
1639
|
else if (this.match(70)) return this.flowParseDeclareVariable(node);
|
|
1638
|
-
else if (this.eatContextual(
|
|
1640
|
+
else if (this.eatContextual(124)) {
|
|
1639
1641
|
if (this.match(12)) return this.flowParseDeclareModuleExports(node);
|
|
1640
1642
|
else {
|
|
1641
1643
|
if (insideModule) this.raise(FlowErrors.NestedDeclareModule, this.state.lastTokStartLoc);
|
|
1642
1644
|
return this.flowParseDeclareModule(node);
|
|
1643
1645
|
}
|
|
1644
|
-
} else if (this.isContextual(
|
|
1645
|
-
else if (this.isContextual(
|
|
1646
|
-
else if (this.isContextual(
|
|
1646
|
+
} else if (this.isContextual(127)) return this.flowParseDeclareTypeAlias(node);
|
|
1647
|
+
else if (this.isContextual(128)) return this.flowParseDeclareOpaqueType(node);
|
|
1648
|
+
else if (this.isContextual(126)) return this.flowParseDeclareInterface(node);
|
|
1647
1649
|
else if (this.match(78)) return this.flowParseDeclareExportDeclaration(node, insideModule);
|
|
1648
1650
|
throw this.unexpected();
|
|
1649
1651
|
}
|
|
@@ -1656,7 +1658,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
1656
1658
|
}
|
|
1657
1659
|
flowParseDeclareModule(node) {
|
|
1658
1660
|
this.scope.enter(0);
|
|
1659
|
-
if (this.match(
|
|
1661
|
+
if (this.match(131)) node.id = super.parseExprAtom();
|
|
1660
1662
|
else node.id = this.parseIdentifier();
|
|
1661
1663
|
const bodyNode = this.startNode();
|
|
1662
1664
|
const body = bodyNode.body = [];
|
|
@@ -1665,10 +1667,10 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
1665
1667
|
const bodyNode = this.startNode();
|
|
1666
1668
|
if (this.match(79)) {
|
|
1667
1669
|
this.next();
|
|
1668
|
-
if (!this.isContextual(
|
|
1670
|
+
if (!this.isContextual(127) && !this.match(83)) this.raise(FlowErrors.InvalidNonTypeImportInDeclareModule, this.state.lastTokStartLoc);
|
|
1669
1671
|
body.push(super.parseImport(bodyNode));
|
|
1670
1672
|
} else {
|
|
1671
|
-
this.expectContextual(
|
|
1673
|
+
this.expectContextual(122, FlowErrors.UnsupportedStatementInDeclareModule);
|
|
1672
1674
|
body.push(this.flowParseDeclare(bodyNode, true));
|
|
1673
1675
|
}
|
|
1674
1676
|
}
|
|
@@ -1702,18 +1704,18 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
1702
1704
|
node.default = true;
|
|
1703
1705
|
return this.finishNode(node, "DeclareExportDeclaration");
|
|
1704
1706
|
} else {
|
|
1705
|
-
if (this.match(71) || this.isLet() || (this.isContextual(
|
|
1707
|
+
if (this.match(71) || this.isLet() || (this.isContextual(127) || this.isContextual(126)) && !insideModule) {
|
|
1706
1708
|
const label = this.state.value;
|
|
1707
1709
|
throw this.raise(FlowErrors.UnsupportedDeclareExportKind, this.state.startLoc, {
|
|
1708
1710
|
unsupportedExportKind: label,
|
|
1709
1711
|
suggestion: exportSuggestions[label]
|
|
1710
1712
|
});
|
|
1711
1713
|
}
|
|
1712
|
-
if (this.match(70) || this.match(64) || this.match(76) || this.isContextual(
|
|
1714
|
+
if (this.match(70) || this.match(64) || this.match(76) || this.isContextual(128)) {
|
|
1713
1715
|
node.declaration = this.flowParseDeclare(this.startNode());
|
|
1714
1716
|
node.default = false;
|
|
1715
1717
|
return this.finishNode(node, "DeclareExportDeclaration");
|
|
1716
|
-
} else if (this.match(51) || this.match(2) || this.isContextual(
|
|
1718
|
+
} else if (this.match(51) || this.match(2) || this.isContextual(126) || this.isContextual(127) || this.isContextual(128)) {
|
|
1717
1719
|
const result = this.parseExport(node, null);
|
|
1718
1720
|
if (result.type === "ExportNamedDeclaration") {
|
|
1719
1721
|
result.default = false;
|
|
@@ -1726,7 +1728,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
1726
1728
|
}
|
|
1727
1729
|
flowParseDeclareModuleExports(node) {
|
|
1728
1730
|
this.next();
|
|
1729
|
-
this.expectContextual(
|
|
1731
|
+
this.expectContextual(108);
|
|
1730
1732
|
node.typeAnnotation = this.flowParseTypeAnnotation();
|
|
1731
1733
|
this.semicolon();
|
|
1732
1734
|
return this.finishNode(node, "DeclareModuleExports");
|
|
@@ -1758,10 +1760,10 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
1758
1760
|
if (isClass) {
|
|
1759
1761
|
const implemented = [];
|
|
1760
1762
|
const mixins = [];
|
|
1761
|
-
if (this.eatContextual(
|
|
1763
|
+
if (this.eatContextual(114)) do
|
|
1762
1764
|
mixins.push(this.flowParseInterfaceExtends());
|
|
1763
1765
|
while (this.eat(8));
|
|
1764
|
-
if (this.eatContextual(
|
|
1766
|
+
if (this.eatContextual(110)) do
|
|
1765
1767
|
implemented.push(this.flowParseClassImplements());
|
|
1766
1768
|
while (this.eat(8));
|
|
1767
1769
|
node.implements = implemented;
|
|
@@ -1812,7 +1814,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
1812
1814
|
return this.finishNode(node, "TypeAlias");
|
|
1813
1815
|
}
|
|
1814
1816
|
flowParseOpaqueType(node, declare) {
|
|
1815
|
-
this.expectContextual(
|
|
1817
|
+
this.expectContextual(127);
|
|
1816
1818
|
node.id = this.flowParseRestrictedIdentifier(true, true);
|
|
1817
1819
|
this.scope.declareName(node.id.name, 8201, node.id.start);
|
|
1818
1820
|
if (this.match(43)) node.typeParameters = this.flowParseTypeParameterDeclaration();
|
|
@@ -1850,7 +1852,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
1850
1852
|
const node = this.startNode();
|
|
1851
1853
|
node.params = [];
|
|
1852
1854
|
this.state.inType = true;
|
|
1853
|
-
if (this.match(43) || this.match(
|
|
1855
|
+
if (this.match(43) || this.match(139)) this.next();
|
|
1854
1856
|
else this.unexpected();
|
|
1855
1857
|
let defaultRequired = false;
|
|
1856
1858
|
do {
|
|
@@ -1915,7 +1917,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
1915
1917
|
}
|
|
1916
1918
|
flowParseInterfaceType() {
|
|
1917
1919
|
const node = this.startNode();
|
|
1918
|
-
this.expectContextual(
|
|
1920
|
+
this.expectContextual(126);
|
|
1919
1921
|
node.extends = [];
|
|
1920
1922
|
if (this.eat(77)) do
|
|
1921
1923
|
node.extends.push(this.flowParseInterfaceExtends());
|
|
@@ -1930,7 +1932,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
1930
1932
|
return this.finishNode(node, "InterfaceTypeAnnotation");
|
|
1931
1933
|
}
|
|
1932
1934
|
flowParseObjectPropertyKey() {
|
|
1933
|
-
return this.match(
|
|
1935
|
+
return this.match(132) || this.match(131) ? super.parseExprAtom() : this.parseIdentifier(true);
|
|
1934
1936
|
}
|
|
1935
1937
|
flowParseObjectTypeIndexer(node, isStatic, variance) {
|
|
1936
1938
|
node.static = isStatic;
|
|
@@ -2015,7 +2017,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2015
2017
|
let protoStartLoc = null;
|
|
2016
2018
|
let inexactStartLoc = null;
|
|
2017
2019
|
const node = this.startNode();
|
|
2018
|
-
if (allowProto && this.isContextual(
|
|
2020
|
+
if (allowProto && this.isContextual(115)) {
|
|
2019
2021
|
const lookahead = this.lookahead();
|
|
2020
2022
|
if (lookahead.type !== 10 && lookahead.type !== 13) {
|
|
2021
2023
|
this.next();
|
|
@@ -2023,7 +2025,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2023
2025
|
allowStatic = false;
|
|
2024
2026
|
}
|
|
2025
2027
|
}
|
|
2026
|
-
if (allowStatic && this.isContextual(
|
|
2028
|
+
if (allowStatic && this.isContextual(103)) {
|
|
2027
2029
|
const lookahead = this.lookahead();
|
|
2028
2030
|
if (lookahead.type !== 10 && lookahead.type !== 13) {
|
|
2029
2031
|
this.next();
|
|
@@ -2043,7 +2045,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2043
2045
|
nodeStart.callProperties.push(this.flowParseObjectTypeCallProperty(node, isStatic));
|
|
2044
2046
|
} else {
|
|
2045
2047
|
let kind = "init";
|
|
2046
|
-
if (this.isContextual(
|
|
2048
|
+
if (this.isContextual(96) || this.isContextual(101)) {
|
|
2047
2049
|
if (tokenIsLiteralPropertyName(this.lookahead().type)) {
|
|
2048
2050
|
kind = this.state.value;
|
|
2049
2051
|
this.next();
|
|
@@ -2279,7 +2281,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2279
2281
|
node.typeParameters = null;
|
|
2280
2282
|
return this.finishNode(node, "FunctionTypeAnnotation");
|
|
2281
2283
|
}
|
|
2282
|
-
case
|
|
2284
|
+
case 131: return this.parseLiteral(this.state.value, "StringLiteralTypeAnnotation");
|
|
2283
2285
|
case 81:
|
|
2284
2286
|
case 82:
|
|
2285
2287
|
node.value = this.match(81);
|
|
@@ -2288,13 +2290,13 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2288
2290
|
case 49:
|
|
2289
2291
|
if (this.state.value === "-") {
|
|
2290
2292
|
this.next();
|
|
2291
|
-
if (this.match(
|
|
2292
|
-
if (this.match(
|
|
2293
|
+
if (this.match(132)) return this.parseLiteralAtNode(-this.state.value, "NumberLiteralTypeAnnotation", node);
|
|
2294
|
+
if (this.match(133)) return this.parseLiteralAtNode(-this.state.value, "BigIntLiteralTypeAnnotation", node);
|
|
2293
2295
|
throw this.raise(FlowErrors.UnexpectedSubtractionOperand, this.state.startLoc);
|
|
2294
2296
|
}
|
|
2295
2297
|
throw this.unexpected();
|
|
2296
|
-
case
|
|
2297
|
-
case
|
|
2298
|
+
case 132: return this.parseLiteral(this.state.value, "NumberLiteralTypeAnnotation");
|
|
2299
|
+
case 133: return this.parseLiteral(this.state.value, "BigIntLiteralTypeAnnotation");
|
|
2298
2300
|
case 84:
|
|
2299
2301
|
this.next();
|
|
2300
2302
|
return this.finishNode(node, "VoidTypeAnnotation");
|
|
@@ -2313,7 +2315,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2313
2315
|
this.next();
|
|
2314
2316
|
return super.createIdentifier(node, label);
|
|
2315
2317
|
} else if (tokenIsIdentifier(this.state.type)) {
|
|
2316
|
-
if (this.isContextual(
|
|
2318
|
+
if (this.isContextual(126)) return this.flowParseInterfaceType();
|
|
2317
2319
|
return this.flowIdentToTypeAnnotation(startLoc, node, this.parseIdentifier());
|
|
2318
2320
|
}
|
|
2319
2321
|
}
|
|
@@ -2388,7 +2390,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2388
2390
|
return type;
|
|
2389
2391
|
}
|
|
2390
2392
|
flowParseTypeOrImplicitInstantiation() {
|
|
2391
|
-
if (this.state.type ===
|
|
2393
|
+
if (this.state.type === 129 && this.state.value === "_") {
|
|
2392
2394
|
const startLoc = this.state.startLoc;
|
|
2393
2395
|
const node = this.parseIdentifier();
|
|
2394
2396
|
return this.flowParseGenericType(startLoc, node);
|
|
@@ -2438,13 +2440,13 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2438
2440
|
return super.parseFunctionBodyAndFinish(node, type, isMethod);
|
|
2439
2441
|
}
|
|
2440
2442
|
parseStatementLike(flags) {
|
|
2441
|
-
if (this.state.strict && this.isContextual(
|
|
2443
|
+
if (this.state.strict && this.isContextual(126)) {
|
|
2442
2444
|
if (tokenIsKeywordOrIdentifier(this.lookahead().type)) {
|
|
2443
2445
|
const node = this.startNode();
|
|
2444
2446
|
this.next();
|
|
2445
2447
|
return this.flowParseInterface(node);
|
|
2446
2448
|
}
|
|
2447
|
-
} else if (this.isContextual(
|
|
2449
|
+
} else if (this.isContextual(123)) {
|
|
2448
2450
|
const node = this.startNode();
|
|
2449
2451
|
this.next();
|
|
2450
2452
|
return this.flowParseEnumDeclaration(node);
|
|
@@ -2453,7 +2455,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2453
2455
|
if (this.flowPragma === void 0 && !this.isValidDirective(stmt)) this.flowPragma = null;
|
|
2454
2456
|
return stmt;
|
|
2455
2457
|
}
|
|
2456
|
-
parseExpressionStatement(node, expr) {
|
|
2458
|
+
parseExpressionStatement(node, expr, flags) {
|
|
2457
2459
|
if (expr.type === "Identifier") {
|
|
2458
2460
|
if (expr.name === "declare") {
|
|
2459
2461
|
if (this.match(76) || tokenIsIdentifier(this.state.type) || this.match(64) || this.match(70) || this.match(78)) return this.flowParseDeclare(node);
|
|
@@ -2463,20 +2465,20 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2463
2465
|
else if (expr.name === "opaque") return this.flowParseOpaqueType(node, false);
|
|
2464
2466
|
}
|
|
2465
2467
|
}
|
|
2466
|
-
return super.parseExpressionStatement(node, expr);
|
|
2468
|
+
return super.parseExpressionStatement(node, expr, flags);
|
|
2467
2469
|
}
|
|
2468
2470
|
shouldParseExportDeclaration() {
|
|
2469
2471
|
const { type } = this.state;
|
|
2470
|
-
if (type ===
|
|
2472
|
+
if (type === 123 || tokenIsFlowInterfaceOrTypeOrOpaque(type)) return !this.state.containsEsc;
|
|
2471
2473
|
return super.shouldParseExportDeclaration();
|
|
2472
2474
|
}
|
|
2473
2475
|
isExportDefaultSpecifier() {
|
|
2474
2476
|
const { type } = this.state;
|
|
2475
|
-
if (type ===
|
|
2477
|
+
if (type === 123 || tokenIsFlowInterfaceOrTypeOrOpaque(type)) return this.state.containsEsc;
|
|
2476
2478
|
return super.isExportDefaultSpecifier();
|
|
2477
2479
|
}
|
|
2478
2480
|
parseExportDefaultExpression() {
|
|
2479
|
-
if (this.isContextual(
|
|
2481
|
+
if (this.isContextual(123)) {
|
|
2480
2482
|
const node = this.startNode();
|
|
2481
2483
|
this.next();
|
|
2482
2484
|
return this.flowParseEnumDeclaration(node);
|
|
@@ -2589,7 +2591,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2589
2591
|
super.assertModuleNodeAllowed(node);
|
|
2590
2592
|
}
|
|
2591
2593
|
parseExportDeclaration(node) {
|
|
2592
|
-
if (this.isContextual(
|
|
2594
|
+
if (this.isContextual(127)) {
|
|
2593
2595
|
node.exportKind = "type";
|
|
2594
2596
|
const declarationNode = this.startNode();
|
|
2595
2597
|
this.next();
|
|
@@ -2598,17 +2600,17 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2598
2600
|
super.parseExportFrom(node);
|
|
2599
2601
|
return null;
|
|
2600
2602
|
} else return this.flowParseTypeAlias(declarationNode);
|
|
2601
|
-
} else if (this.isContextual(
|
|
2603
|
+
} else if (this.isContextual(128)) {
|
|
2602
2604
|
node.exportKind = "type";
|
|
2603
2605
|
const declarationNode = this.startNode();
|
|
2604
2606
|
this.next();
|
|
2605
2607
|
return this.flowParseOpaqueType(declarationNode, false);
|
|
2606
|
-
} else if (this.isContextual(
|
|
2608
|
+
} else if (this.isContextual(126)) {
|
|
2607
2609
|
node.exportKind = "type";
|
|
2608
2610
|
const declarationNode = this.startNode();
|
|
2609
2611
|
this.next();
|
|
2610
2612
|
return this.flowParseInterface(declarationNode);
|
|
2611
|
-
} else if (this.isContextual(
|
|
2613
|
+
} else if (this.isContextual(123)) {
|
|
2612
2614
|
node.exportKind = "value";
|
|
2613
2615
|
const declarationNode = this.startNode();
|
|
2614
2616
|
this.next();
|
|
@@ -2617,7 +2619,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2617
2619
|
}
|
|
2618
2620
|
eatExportStar(node) {
|
|
2619
2621
|
if (super.eatExportStar(node)) return true;
|
|
2620
|
-
if (this.isContextual(
|
|
2622
|
+
if (this.isContextual(127) && this.lookahead().type === 51) {
|
|
2621
2623
|
node.exportKind = "type";
|
|
2622
2624
|
this.next();
|
|
2623
2625
|
this.next();
|
|
@@ -2632,7 +2634,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2632
2634
|
return hasNamespace;
|
|
2633
2635
|
}
|
|
2634
2636
|
parseClassId(node, isStatement, optionalId) {
|
|
2635
|
-
if ((!isStatement || optionalId) && this.isContextual(
|
|
2637
|
+
if ((!isStatement || optionalId) && this.isContextual(110)) {
|
|
2636
2638
|
node.id = null;
|
|
2637
2639
|
return;
|
|
2638
2640
|
}
|
|
@@ -2641,7 +2643,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2641
2643
|
}
|
|
2642
2644
|
parseClassMember(classBody, member, state) {
|
|
2643
2645
|
const { startLoc } = this.state;
|
|
2644
|
-
if (this.isContextual(
|
|
2646
|
+
if (this.isContextual(122)) {
|
|
2645
2647
|
if (super.parseClassMemberFromModifier(classBody, member)) return;
|
|
2646
2648
|
member.declare = true;
|
|
2647
2649
|
}
|
|
@@ -2658,7 +2660,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2658
2660
|
const word = super.readWord1();
|
|
2659
2661
|
const fullWord = "@@" + word;
|
|
2660
2662
|
if (!this.isIterator(word) || !this.state.inType) this.raise(Errors.InvalidIdentifier, this.state.curPosition(), { identifierName: fullWord });
|
|
2661
|
-
this.finishToken(
|
|
2663
|
+
this.finishToken(129, fullWord);
|
|
2662
2664
|
}
|
|
2663
2665
|
getTokenFromCode(code) {
|
|
2664
2666
|
const next = this.input.charCodeAt(this.state.pos + 1);
|
|
@@ -2746,7 +2748,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2746
2748
|
parseClassSuper(node) {
|
|
2747
2749
|
super.parseClassSuper(node);
|
|
2748
2750
|
if (node.superClass && (this.match(43) || this.match(47))) node.superTypeArguments = this.flowParseTypeParameterInstantiationInExpression();
|
|
2749
|
-
if (this.eatContextual(
|
|
2751
|
+
if (this.eatContextual(110)) {
|
|
2750
2752
|
const implemented = node.implements = [];
|
|
2751
2753
|
do
|
|
2752
2754
|
implemented.push(this.flowParseClassImplements());
|
|
@@ -2800,7 +2802,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2800
2802
|
}
|
|
2801
2803
|
isPotentialImportPhase(isExport) {
|
|
2802
2804
|
if (super.isPotentialImportPhase(isExport)) return true;
|
|
2803
|
-
if (this.isContextual(
|
|
2805
|
+
if (this.isContextual(127)) {
|
|
2804
2806
|
if (!isExport) return true;
|
|
2805
2807
|
const ch = this.lookaheadCharCode();
|
|
2806
2808
|
return ch === 123 || ch === 42;
|
|
@@ -2825,7 +2827,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2825
2827
|
else if (firstIdent.name === "typeof") specifierTypeKind = "typeof";
|
|
2826
2828
|
}
|
|
2827
2829
|
let isBinding = false;
|
|
2828
|
-
if (this.isContextual(
|
|
2830
|
+
if (this.isContextual(90) && !this.isLookaheadContextual("as")) {
|
|
2829
2831
|
const as_ident = this.parseIdentifier(true);
|
|
2830
2832
|
if (specifierTypeKind !== null && !tokenIsKeywordOrIdentifier(this.state.type)) {
|
|
2831
2833
|
specifier.imported = as_ident;
|
|
@@ -2845,7 +2847,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2845
2847
|
specifier.imported = firstIdent;
|
|
2846
2848
|
specifier.importKind = null;
|
|
2847
2849
|
}
|
|
2848
|
-
if (this.eatContextual(
|
|
2850
|
+
if (this.eatContextual(90)) specifier.local = this.parseIdentifier();
|
|
2849
2851
|
else {
|
|
2850
2852
|
isBinding = true;
|
|
2851
2853
|
specifier.local = this.cloneIdentifier(specifier.imported);
|
|
@@ -2890,7 +2892,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
2890
2892
|
parseMaybeAssign(refExpressionErrors, isParenItem) {
|
|
2891
2893
|
let state = null;
|
|
2892
2894
|
let jsx;
|
|
2893
|
-
if (this.hasPlugin("jsx") && (this.match(
|
|
2895
|
+
if (this.hasPlugin("jsx") && (this.match(139) || this.match(43))) {
|
|
2894
2896
|
state = this.state.clone();
|
|
2895
2897
|
jsx = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, isParenItem), state);
|
|
2896
2898
|
if (!jsx.error) return jsx.node;
|
|
@@ -3105,7 +3107,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
3105
3107
|
const startLoc = this.state.startLoc;
|
|
3106
3108
|
const endOfInit = () => this.match(8) || this.match(4);
|
|
3107
3109
|
switch (this.state.type) {
|
|
3108
|
-
case
|
|
3110
|
+
case 132: {
|
|
3109
3111
|
const literal = this.parseNumericLiteral(this.state.value);
|
|
3110
3112
|
if (endOfInit()) return {
|
|
3111
3113
|
type: "number",
|
|
@@ -3114,7 +3116,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
3114
3116
|
};
|
|
3115
3117
|
break;
|
|
3116
3118
|
}
|
|
3117
|
-
case
|
|
3119
|
+
case 131: {
|
|
3118
3120
|
const literal = this.parseStringLiteral(this.state.value);
|
|
3119
3121
|
if (endOfInit()) return {
|
|
3120
3122
|
type: "string",
|
|
@@ -3233,7 +3235,7 @@ const flow = (superClass) => class FlowParserMixin extends superClass {
|
|
|
3233
3235
|
}
|
|
3234
3236
|
}
|
|
3235
3237
|
flowEnumParseExplicitType({ enumName }) {
|
|
3236
|
-
if (!this.eatContextual(
|
|
3238
|
+
if (!this.eatContextual(99)) return null;
|
|
3237
3239
|
if (!tokenIsIdentifier(this.state.type)) throw this.raise(FlowErrors.EnumInvalidExplicitTypeUnknownSupplied, this.state.startLoc, { enumName });
|
|
3238
3240
|
const { value } = this.state;
|
|
3239
3241
|
this.next();
|
|
@@ -3626,6 +3628,7 @@ function hasNewLine(input, start, end) {
|
|
|
3626
3628
|
return false;
|
|
3627
3629
|
}
|
|
3628
3630
|
const skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
|
|
3631
|
+
const skipWhiteSpaceAnnexB = /(?:[^\S\n\r\u2028\u2029]|\/\*.*?\*\/)*(?:(?!-->)(?:\s|\/\/.*|\/\*[^]*?\*\/|<!--.*|-->.*)*)?/g;
|
|
3629
3632
|
const skipWhiteSpaceInLine = /(?:[^\S\n\r\u2028\u2029]|\/\/.*|\/\*.*?\*\/)*/g;
|
|
3630
3633
|
function isWhitespace(code) {
|
|
3631
3634
|
switch (code) {
|
|
@@ -3685,12 +3688,12 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
3685
3688
|
if (this.state.pos === this.state.start) {
|
|
3686
3689
|
if (ch === 60 && this.state.canStartJSXElement) {
|
|
3687
3690
|
++this.state.pos;
|
|
3688
|
-
this.finishToken(
|
|
3691
|
+
this.finishToken(139);
|
|
3689
3692
|
} else super.getTokenFromCode(ch);
|
|
3690
3693
|
return;
|
|
3691
3694
|
}
|
|
3692
3695
|
out += this.input.slice(chunkStart, this.state.pos);
|
|
3693
|
-
this.finishToken(
|
|
3696
|
+
this.finishToken(138, out);
|
|
3694
3697
|
return;
|
|
3695
3698
|
case 38:
|
|
3696
3699
|
out += this.input.slice(chunkStart, this.state.pos);
|
|
@@ -3740,7 +3743,7 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
3740
3743
|
} else ++this.state.pos;
|
|
3741
3744
|
}
|
|
3742
3745
|
out += this.input.slice(chunkStart, this.state.pos++);
|
|
3743
|
-
this.finishToken(
|
|
3746
|
+
this.finishToken(131, out);
|
|
3744
3747
|
}
|
|
3745
3748
|
jsxReadEntity() {
|
|
3746
3749
|
const startPos = ++this.state.pos;
|
|
@@ -3776,11 +3779,11 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
3776
3779
|
do
|
|
3777
3780
|
ch = this.input.charCodeAt(++this.state.pos);
|
|
3778
3781
|
while (isIdentifierChar$1(ch) || ch === 45);
|
|
3779
|
-
this.finishToken(
|
|
3782
|
+
this.finishToken(137, this.input.slice(start, this.state.pos));
|
|
3780
3783
|
}
|
|
3781
3784
|
jsxParseIdentifier() {
|
|
3782
3785
|
const node = this.startNode();
|
|
3783
|
-
if (this.match(
|
|
3786
|
+
if (this.match(137)) node.name = this.state.value;
|
|
3784
3787
|
else if (tokenIsKeyword(this.state.type)) node.name = tokenLabelName(this.state.type);
|
|
3785
3788
|
else this.unexpected();
|
|
3786
3789
|
this.next();
|
|
@@ -3817,8 +3820,8 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
3817
3820
|
node = this.jsxParseExpressionContainer(node, types.j_oTag);
|
|
3818
3821
|
if (node.expression.type === "JSXEmptyExpression") this.raise(JsxErrors.AttributeIsEmpty, node);
|
|
3819
3822
|
return node;
|
|
3820
|
-
case
|
|
3821
|
-
case
|
|
3823
|
+
case 139:
|
|
3824
|
+
case 131: return this.parseExprAtom();
|
|
3822
3825
|
default: throw this.raise(JsxErrors.UnsupportedJsxValue, this.state.startLoc);
|
|
3823
3826
|
}
|
|
3824
3827
|
}
|
|
@@ -3864,7 +3867,7 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
3864
3867
|
return this.finishNode(node, "JSXAttribute");
|
|
3865
3868
|
}
|
|
3866
3869
|
jsxParseOpeningElementAt(startLoc) {
|
|
3867
|
-
if (this.eat(
|
|
3870
|
+
if (this.eat(140)) {
|
|
3868
3871
|
const node = this.startNodeAt(startLoc);
|
|
3869
3872
|
return this.finishNode(node, "JSXOpeningFragment");
|
|
3870
3873
|
}
|
|
@@ -3874,20 +3877,20 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
3874
3877
|
}
|
|
3875
3878
|
jsxParseOpeningElementAfterName(node) {
|
|
3876
3879
|
const attributes = [];
|
|
3877
|
-
while (!this.match(52) && !this.match(
|
|
3880
|
+
while (!this.match(52) && !this.match(140)) attributes.push(this.jsxParseAttribute());
|
|
3878
3881
|
node.attributes = attributes;
|
|
3879
3882
|
node.selfClosing = this.eat(52);
|
|
3880
|
-
this.expect(
|
|
3883
|
+
this.expect(140);
|
|
3881
3884
|
return this.finishNode(node, "JSXOpeningElement");
|
|
3882
3885
|
}
|
|
3883
3886
|
jsxParseClosingElementAt(startLoc) {
|
|
3884
|
-
if (this.eat(
|
|
3887
|
+
if (this.eat(140)) {
|
|
3885
3888
|
const node = this.startNodeAt(startLoc);
|
|
3886
3889
|
return this.finishNode(node, "JSXClosingFragment");
|
|
3887
3890
|
}
|
|
3888
3891
|
const node = this.startNodeAt(startLoc);
|
|
3889
3892
|
node.name = this.jsxParseElementName();
|
|
3890
|
-
this.expect(
|
|
3893
|
+
this.expect(140);
|
|
3891
3894
|
return this.finishNode(node, "JSXClosingElement");
|
|
3892
3895
|
}
|
|
3893
3896
|
jsxParseElementAt(startLoc) {
|
|
@@ -3897,17 +3900,16 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
3897
3900
|
let closingElement = null;
|
|
3898
3901
|
if (!openingElement.selfClosing) {
|
|
3899
3902
|
contents: for (;;) switch (this.state.type) {
|
|
3900
|
-
case
|
|
3903
|
+
case 139:
|
|
3901
3904
|
startLoc = this.state.startLoc;
|
|
3902
3905
|
this.next();
|
|
3903
3906
|
if (this.eat(52)) {
|
|
3904
|
-
this.setLoc(startLoc);
|
|
3905
3907
|
closingElement = this.jsxParseClosingElementAt(startLoc);
|
|
3906
3908
|
break contents;
|
|
3907
3909
|
}
|
|
3908
3910
|
children.push(this.jsxParseElementAt(startLoc));
|
|
3909
3911
|
break;
|
|
3910
|
-
case
|
|
3912
|
+
case 138:
|
|
3911
3913
|
children.push(this.parseLiteral(this.state.value, "JSXText"));
|
|
3912
3914
|
break;
|
|
3913
3915
|
case 2: {
|
|
@@ -3947,9 +3949,9 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
3947
3949
|
context[context.length - 1] = newContext;
|
|
3948
3950
|
}
|
|
3949
3951
|
parseExprAtom(refExpressionErrors) {
|
|
3950
|
-
if (this.match(
|
|
3952
|
+
if (this.match(139)) return this.jsxParseElement();
|
|
3951
3953
|
else if (this.match(43) && this.input.charCodeAt(this.state.pos) !== 33) {
|
|
3952
|
-
this.replaceToken(
|
|
3954
|
+
this.replaceToken(139);
|
|
3953
3955
|
return this.jsxParseElement();
|
|
3954
3956
|
} else return super.parseExprAtom(refExpressionErrors);
|
|
3955
3957
|
}
|
|
@@ -3969,7 +3971,7 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
3969
3971
|
}
|
|
3970
3972
|
if (code === 62) {
|
|
3971
3973
|
++this.state.pos;
|
|
3972
|
-
this.finishToken(
|
|
3974
|
+
this.finishToken(140);
|
|
3973
3975
|
return;
|
|
3974
3976
|
}
|
|
3975
3977
|
if ((code === 34 || code === 39) && context === types.j_oTag) {
|
|
@@ -3979,18 +3981,18 @@ const jsx = (superClass) => class JSXParserMixin extends superClass {
|
|
|
3979
3981
|
}
|
|
3980
3982
|
if (code === 60 && this.state.canStartJSXElement && this.input.charCodeAt(this.state.pos + 1) !== 33) {
|
|
3981
3983
|
++this.state.pos;
|
|
3982
|
-
this.finishToken(
|
|
3984
|
+
this.finishToken(139);
|
|
3983
3985
|
return;
|
|
3984
3986
|
}
|
|
3985
3987
|
super.getTokenFromCode(code);
|
|
3986
3988
|
}
|
|
3987
3989
|
updateContext(prevType) {
|
|
3988
3990
|
const { context, type } = this.state;
|
|
3989
|
-
if (type === 52 && prevType ===
|
|
3991
|
+
if (type === 52 && prevType === 139) {
|
|
3990
3992
|
context.splice(-2, 2, types.j_cTag);
|
|
3991
3993
|
this.state.canStartJSXElement = false;
|
|
3992
|
-
} else if (type ===
|
|
3993
|
-
else if (type ===
|
|
3994
|
+
} else if (type === 139) context.push(types.j_oTag);
|
|
3995
|
+
else if (type === 140) {
|
|
3994
3996
|
const out = context[context.length - 1];
|
|
3995
3997
|
if (out === types.j_oTag && prevType === 52 || out === types.j_cTag) {
|
|
3996
3998
|
context.pop();
|
|
@@ -4255,6 +4257,7 @@ var State = class State {
|
|
|
4255
4257
|
errors = [];
|
|
4256
4258
|
noArrowAt = [];
|
|
4257
4259
|
noArrowParamsConversionAt = [];
|
|
4260
|
+
regExpAllowedAt = -1;
|
|
4258
4261
|
get canStartArrow() {
|
|
4259
4262
|
return (this.flags & 2) > 0;
|
|
4260
4263
|
}
|
|
@@ -4329,7 +4332,7 @@ var State = class State {
|
|
|
4329
4332
|
commentsLen = 0;
|
|
4330
4333
|
commentStack = [];
|
|
4331
4334
|
pos = 0;
|
|
4332
|
-
type =
|
|
4335
|
+
type = 136;
|
|
4333
4336
|
value = null;
|
|
4334
4337
|
start = 0;
|
|
4335
4338
|
end = 0;
|
|
@@ -4374,6 +4377,7 @@ var State = class State {
|
|
|
4374
4377
|
state.errors = this.errors.slice();
|
|
4375
4378
|
state.noArrowAt = this.noArrowAt.slice();
|
|
4376
4379
|
state.noArrowParamsConversionAt = this.noArrowParamsConversionAt.slice();
|
|
4380
|
+
state.regExpAllowedAt = this.regExpAllowedAt;
|
|
4377
4381
|
state.labels = this.labels.slice();
|
|
4378
4382
|
state.commentsLen = this.commentsLen;
|
|
4379
4383
|
state.commentStack = this.commentStack.slice();
|
|
@@ -4403,7 +4407,9 @@ const forbiddenNumericSeparatorSiblings$1 = {
|
|
|
4403
4407
|
95,
|
|
4404
4408
|
98,
|
|
4405
4409
|
101,
|
|
4406
|
-
111
|
|
4410
|
+
111,
|
|
4411
|
+
43,
|
|
4412
|
+
45
|
|
4407
4413
|
]),
|
|
4408
4414
|
hex: /* @__PURE__ */ new Set([
|
|
4409
4415
|
46,
|
|
@@ -4561,7 +4567,7 @@ function readInt$1(input, pos, lineStart, curLine, radix, len, forceLen, allowNu
|
|
|
4561
4567
|
pos
|
|
4562
4568
|
};
|
|
4563
4569
|
errors.numericSeparatorInEscapeSequence(pos, lineStart, curLine);
|
|
4564
|
-
} else if (Number.isNaN(next) || !isAllowedSibling(next) || forbiddenSiblings.has(prev)
|
|
4570
|
+
} else if (Number.isNaN(next) || !isAllowedSibling(next) || forbiddenSiblings.has(prev)) {
|
|
4565
4571
|
if (bailOnError) return {
|
|
4566
4572
|
n: null,
|
|
4567
4573
|
pos
|
|
@@ -4697,6 +4703,7 @@ var Tokenizer = class extends CommentsParser {
|
|
|
4697
4703
|
end: state.end,
|
|
4698
4704
|
context: [this.curContext()],
|
|
4699
4705
|
inType: state.inType,
|
|
4706
|
+
strict: state.strict,
|
|
4700
4707
|
startLoc: state.startLoc,
|
|
4701
4708
|
lastTokEndLoc: state.lastTokEndLoc,
|
|
4702
4709
|
curLine: state.curLine,
|
|
@@ -4718,8 +4725,9 @@ var Tokenizer = class extends CommentsParser {
|
|
|
4718
4725
|
return this.nextTokenStartSince(this.state.pos);
|
|
4719
4726
|
}
|
|
4720
4727
|
nextTokenStartSince(pos) {
|
|
4721
|
-
|
|
4722
|
-
|
|
4728
|
+
const skipWhiteSpaceRe = this.inModule || !(this.optionFlags & 16384) ? skipWhiteSpace : skipWhiteSpaceAnnexB;
|
|
4729
|
+
skipWhiteSpaceRe.lastIndex = pos;
|
|
4730
|
+
return skipWhiteSpaceRe.test(this.input) ? skipWhiteSpaceRe.lastIndex : pos;
|
|
4723
4731
|
}
|
|
4724
4732
|
lookaheadCharCode() {
|
|
4725
4733
|
return this.lookaheadCharCodeSince(this.state.pos);
|
|
@@ -4760,7 +4768,7 @@ var Tokenizer = class extends CommentsParser {
|
|
|
4760
4768
|
this.state.start = this.state.pos;
|
|
4761
4769
|
if (!this.isLookahead) this.state.startLoc = this.state.curPosition();
|
|
4762
4770
|
if (this.state.pos >= this.length) {
|
|
4763
|
-
this.finishToken(
|
|
4771
|
+
this.finishToken(136);
|
|
4764
4772
|
return;
|
|
4765
4773
|
}
|
|
4766
4774
|
this.getTokenFromCode(this.codePointAtPos(this.state.pos));
|
|
@@ -4901,10 +4909,10 @@ var Tokenizer = class extends CommentsParser {
|
|
|
4901
4909
|
if (next >= 48 && next <= 57) throw this.raise(Errors.UnexpectedDigitAfterHash, this.state.curPosition());
|
|
4902
4910
|
if (isIdentifierStart$1(next)) {
|
|
4903
4911
|
++this.state.pos;
|
|
4904
|
-
this.finishToken(
|
|
4912
|
+
this.finishToken(135, this.readWord1(next));
|
|
4905
4913
|
} else if (next === 92) {
|
|
4906
4914
|
++this.state.pos;
|
|
4907
|
-
this.finishToken(
|
|
4915
|
+
this.finishToken(135, this.readWord1());
|
|
4908
4916
|
} else this.finishOp(23, 1);
|
|
4909
4917
|
}
|
|
4910
4918
|
readToken_dot() {
|
|
@@ -5228,7 +5236,7 @@ var Tokenizer = class extends CommentsParser {
|
|
|
5228
5236
|
mods += char;
|
|
5229
5237
|
}
|
|
5230
5238
|
this.state.pos = pos;
|
|
5231
|
-
this.finishToken(
|
|
5239
|
+
this.finishToken(134, {
|
|
5232
5240
|
pattern: content,
|
|
5233
5241
|
flags: mods
|
|
5234
5242
|
});
|
|
@@ -5238,32 +5246,54 @@ var Tokenizer = class extends CommentsParser {
|
|
|
5238
5246
|
this.state.pos = pos;
|
|
5239
5247
|
return n;
|
|
5240
5248
|
}
|
|
5249
|
+
readLiteralInt(radix) {
|
|
5250
|
+
let pos = this.state.pos;
|
|
5251
|
+
let val = 0;
|
|
5252
|
+
let code;
|
|
5253
|
+
for (;;) {
|
|
5254
|
+
code = this.input.charCodeAt(pos);
|
|
5255
|
+
let digit;
|
|
5256
|
+
if (code >= 48 && code <= 57) digit = code - 48;
|
|
5257
|
+
else {
|
|
5258
|
+
digit = (code | 32) - 97;
|
|
5259
|
+
if (digit < 0 || digit > 5) break;
|
|
5260
|
+
digit += 10;
|
|
5261
|
+
}
|
|
5262
|
+
if (digit >= radix) break;
|
|
5263
|
+
val = val * radix + digit;
|
|
5264
|
+
++pos;
|
|
5265
|
+
}
|
|
5266
|
+
if (code === 95 || code >= 48 && code <= 57) return this.readInt(radix);
|
|
5267
|
+
if (pos === this.state.pos) return null;
|
|
5268
|
+
this.state.pos = pos;
|
|
5269
|
+
return val;
|
|
5270
|
+
}
|
|
5241
5271
|
readRadixNumber(radix) {
|
|
5242
5272
|
const start = this.state.pos;
|
|
5243
5273
|
const startLoc = this.state.curPosition();
|
|
5244
|
-
let isBigInt = false;
|
|
5245
5274
|
this.state.pos += 2;
|
|
5246
|
-
|
|
5275
|
+
let val = this.readLiteralInt(radix);
|
|
5276
|
+
const end = this.state.pos;
|
|
5247
5277
|
if (val == null) this.raise(Errors.InvalidDigit, createPositionWithColumnOffset(startLoc, 2), { radix });
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
isBigInt = true;
|
|
5251
|
-
}
|
|
5278
|
+
const isBigInt = this.input.charCodeAt(this.state.pos) === 110;
|
|
5279
|
+
if (isBigInt) ++this.state.pos;
|
|
5252
5280
|
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
|
-
|
|
5281
|
+
if (isBigInt || val !== null && val > Number.MAX_SAFE_INTEGER) {
|
|
5282
|
+
const str = this.input.slice(start, end).replaceAll("_", "");
|
|
5283
|
+
if (isBigInt) {
|
|
5284
|
+
this.finishToken(133, str);
|
|
5285
|
+
return;
|
|
5286
|
+
}
|
|
5287
|
+
val = Number(radix !== 16 && this.optionFlags & 4096 ? str.replace(radix === 2 ? /[2-9]/g : /[89]/g, "0") : str);
|
|
5257
5288
|
}
|
|
5258
|
-
this.finishToken(
|
|
5289
|
+
this.finishToken(132, val);
|
|
5259
5290
|
}
|
|
5260
5291
|
readNumber(startsWithDot) {
|
|
5261
5292
|
const start = this.state.pos;
|
|
5262
5293
|
const startLoc = this.state.curPosition();
|
|
5263
5294
|
let isFloat = false;
|
|
5264
|
-
let isBigInt = false;
|
|
5265
5295
|
let isOctal = false;
|
|
5266
|
-
|
|
5296
|
+
const integerValue = startsWithDot ? 0 : this.readLiteralInt(10);
|
|
5267
5297
|
const hasLeadingZero = this.state.pos - start >= 2 && this.input.charCodeAt(start) === 48;
|
|
5268
5298
|
if (hasLeadingZero) {
|
|
5269
5299
|
const integer = this.input.slice(start, this.state.pos);
|
|
@@ -5272,35 +5302,40 @@ var Tokenizer = class extends CommentsParser {
|
|
|
5272
5302
|
const underscorePos = integer.indexOf("_");
|
|
5273
5303
|
if (underscorePos > 0) this.raise(Errors.ZeroDigitNumericSeparator, createPositionWithColumnOffset(startLoc, underscorePos));
|
|
5274
5304
|
}
|
|
5275
|
-
isOctal =
|
|
5305
|
+
isOctal = !/[89]/.test(integer);
|
|
5276
5306
|
}
|
|
5277
5307
|
let next = this.input.charCodeAt(this.state.pos);
|
|
5278
5308
|
if (next === 46 && !isOctal) {
|
|
5279
5309
|
++this.state.pos;
|
|
5280
|
-
this.
|
|
5310
|
+
this.readLiteralInt(10);
|
|
5281
5311
|
isFloat = true;
|
|
5282
5312
|
next = this.input.charCodeAt(this.state.pos);
|
|
5283
5313
|
}
|
|
5284
5314
|
if ((next === 69 || next === 101) && !isOctal) {
|
|
5285
5315
|
next = this.input.charCodeAt(++this.state.pos);
|
|
5286
5316
|
if (next === 43 || next === 45) ++this.state.pos;
|
|
5287
|
-
if (this.
|
|
5317
|
+
if (this.readLiteralInt(10) === null) this.raise(Errors.InvalidOrMissingExponent, startLoc);
|
|
5288
5318
|
isFloat = true;
|
|
5289
5319
|
next = this.input.charCodeAt(this.state.pos);
|
|
5290
5320
|
}
|
|
5291
|
-
const
|
|
5292
|
-
|
|
5321
|
+
const end = this.state.pos;
|
|
5322
|
+
const isBigInt = next === 110;
|
|
5323
|
+
if (isBigInt) {
|
|
5293
5324
|
if (isFloat || hasLeadingZero) this.raise(Errors.InvalidBigIntLiteral, startLoc);
|
|
5294
5325
|
++this.state.pos;
|
|
5295
|
-
isBigInt = true;
|
|
5296
5326
|
}
|
|
5297
5327
|
if (isIdentifierStart$1(this.codePointAtPos(this.state.pos))) throw this.raise(Errors.NumberIdentifier, this.state.curPosition());
|
|
5328
|
+
if (!isFloat && !isBigInt && !hasLeadingZero && integerValue <= Number.MAX_SAFE_INTEGER) {
|
|
5329
|
+
this.finishToken(132, integerValue);
|
|
5330
|
+
return;
|
|
5331
|
+
}
|
|
5332
|
+
const str = this.input.slice(start, end).replaceAll("_", "");
|
|
5298
5333
|
if (isBigInt) {
|
|
5299
|
-
this.finishToken(
|
|
5334
|
+
this.finishToken(133, str);
|
|
5300
5335
|
return;
|
|
5301
5336
|
}
|
|
5302
5337
|
const val = isOctal ? parseInt(str, 8) : parseFloat(str);
|
|
5303
|
-
this.finishToken(
|
|
5338
|
+
this.finishToken(132, val);
|
|
5304
5339
|
}
|
|
5305
5340
|
readCodePoint(throwOnInvalid) {
|
|
5306
5341
|
const { code, pos } = readCodePoint$1(this.input, this.state.pos, this.state.lineStart, this.state.curLine, throwOnInvalid, this.errorHandlers_readCodePoint);
|
|
@@ -5312,7 +5347,7 @@ var Tokenizer = class extends CommentsParser {
|
|
|
5312
5347
|
this.state.pos = pos + 1;
|
|
5313
5348
|
this.state.lineStart = lineStart;
|
|
5314
5349
|
this.state.curLine = curLine;
|
|
5315
|
-
this.finishToken(
|
|
5350
|
+
this.finishToken(131, str);
|
|
5316
5351
|
}
|
|
5317
5352
|
readTemplateContinuation() {
|
|
5318
5353
|
if (!this.match(4)) this.unexpected(null, 4);
|
|
@@ -5333,6 +5368,7 @@ var Tokenizer = class extends CommentsParser {
|
|
|
5333
5368
|
}
|
|
5334
5369
|
}
|
|
5335
5370
|
recordStrictModeErrors(toParseError, at) {
|
|
5371
|
+
if (this.isLookahead) return;
|
|
5336
5372
|
const index = at.index;
|
|
5337
5373
|
if (this.state.strict && !this.state.strictErrors.has(index)) this.raise(toParseError, at);
|
|
5338
5374
|
else this.state.strictErrors.set(index, [toParseError, at]);
|
|
@@ -5371,7 +5407,7 @@ var Tokenizer = class extends CommentsParser {
|
|
|
5371
5407
|
const word = this.readWord1(firstCode);
|
|
5372
5408
|
const type = keywords$1.get(word);
|
|
5373
5409
|
if (type !== void 0) this.finishToken(type, tokenLabelName(type));
|
|
5374
|
-
else this.finishToken(
|
|
5410
|
+
else this.finishToken(129, word);
|
|
5375
5411
|
}
|
|
5376
5412
|
checkKeywordEscapes() {
|
|
5377
5413
|
const { type } = this.state;
|
|
@@ -5497,6 +5533,9 @@ var ExpressionScope = class {
|
|
|
5497
5533
|
isCertainlyParameterDeclaration() {
|
|
5498
5534
|
return this.type === 3;
|
|
5499
5535
|
}
|
|
5536
|
+
isInitializer() {
|
|
5537
|
+
return this.type === 4;
|
|
5538
|
+
}
|
|
5500
5539
|
};
|
|
5501
5540
|
var ArrowHeadParsingScope = class extends ExpressionScope {
|
|
5502
5541
|
declarationErrors = /* @__PURE__ */ new Map();
|
|
@@ -5525,13 +5564,17 @@ var ExpressionScopeHandler = class {
|
|
|
5525
5564
|
exit() {
|
|
5526
5565
|
this.stack.pop();
|
|
5527
5566
|
}
|
|
5567
|
+
canBeInParameters() {
|
|
5568
|
+
const scope = this.stack[this.stack.length - 1];
|
|
5569
|
+
return scope.canBeArrowParameterDeclaration() || scope.isCertainlyParameterDeclaration();
|
|
5570
|
+
}
|
|
5528
5571
|
recordParameterInitializerError(toParseError, loc) {
|
|
5529
5572
|
const { stack } = this;
|
|
5530
5573
|
let i = stack.length - 1;
|
|
5531
5574
|
let scope = stack[i];
|
|
5532
5575
|
while (!scope.isCertainlyParameterDeclaration()) {
|
|
5533
5576
|
if (scope.canBeArrowParameterDeclaration()) scope.recordDeclarationError(toParseError, loc);
|
|
5534
|
-
else return;
|
|
5577
|
+
else if (!scope.isInitializer()) return;
|
|
5535
5578
|
scope = stack[--i];
|
|
5536
5579
|
}
|
|
5537
5580
|
this.parser.raise(toParseError, loc);
|
|
@@ -5546,11 +5589,11 @@ var ExpressionScopeHandler = class {
|
|
|
5546
5589
|
}
|
|
5547
5590
|
recordAsyncArrowParametersError(at) {
|
|
5548
5591
|
const { stack } = this;
|
|
5549
|
-
let i = stack.length - 1
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
scope
|
|
5592
|
+
for (let i = stack.length - 1;; i--) {
|
|
5593
|
+
const scope = stack[i];
|
|
5594
|
+
if (scope.canBeArrowParameterDeclaration()) {
|
|
5595
|
+
if (scope.type === 2) scope.recordDeclarationError(Errors.AwaitBindingIdentifier, at);
|
|
5596
|
+
} else if (!scope.isInitializer()) return;
|
|
5554
5597
|
}
|
|
5555
5598
|
}
|
|
5556
5599
|
validateAsPattern() {
|
|
@@ -5559,27 +5602,23 @@ var ExpressionScopeHandler = class {
|
|
|
5559
5602
|
if (!currentScope.canBeArrowParameterDeclaration()) return;
|
|
5560
5603
|
currentScope.iterateErrors((toParseError, key) => {
|
|
5561
5604
|
this.parser.raise(toParseError, key);
|
|
5562
|
-
let i = stack.length - 2
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
scope.
|
|
5566
|
-
scope = stack[--i];
|
|
5605
|
+
for (let i = stack.length - 2;; i--) {
|
|
5606
|
+
const scope = stack[i];
|
|
5607
|
+
if (scope.canBeArrowParameterDeclaration()) scope.clearDeclarationError(key);
|
|
5608
|
+
else if (!scope.isInitializer()) break;
|
|
5567
5609
|
}
|
|
5568
5610
|
});
|
|
5569
5611
|
}
|
|
5570
5612
|
};
|
|
5571
|
-
function newParameterDeclarationScope() {
|
|
5572
|
-
return new ExpressionScope(3);
|
|
5573
|
-
}
|
|
5574
5613
|
function newArrowHeadScope() {
|
|
5575
5614
|
return new ArrowHeadParsingScope(1);
|
|
5576
5615
|
}
|
|
5577
5616
|
function newAsyncArrowScope() {
|
|
5578
5617
|
return new ArrowHeadParsingScope(2);
|
|
5579
5618
|
}
|
|
5580
|
-
|
|
5581
|
-
|
|
5582
|
-
|
|
5619
|
+
const sharedExpressionScope = new ExpressionScope();
|
|
5620
|
+
const parameterDeclarationScope = new ExpressionScope(3);
|
|
5621
|
+
const initializerScope = new ExpressionScope(4);
|
|
5583
5622
|
var ProductionParameterHandler = class {
|
|
5584
5623
|
stacks = [];
|
|
5585
5624
|
enter(flags) {
|
|
@@ -5652,7 +5691,7 @@ var UtilParser = class extends Tokenizer {
|
|
|
5652
5691
|
}
|
|
5653
5692
|
}
|
|
5654
5693
|
canInsertSemicolon() {
|
|
5655
|
-
return this.match(
|
|
5694
|
+
return this.match(136) || this.match(4) || this.hasPrecedingLineBreak();
|
|
5656
5695
|
}
|
|
5657
5696
|
hasPrecedingLineBreak() {
|
|
5658
5697
|
return hasNewLine(this.input, this.offsetToSourcePos(this.state.lastTokEndLoc.index), this.state.start);
|
|
@@ -5670,8 +5709,24 @@ var UtilParser = class extends Tokenizer {
|
|
|
5670
5709
|
expect(type, loc) {
|
|
5671
5710
|
if (!this.eat(type)) this.unexpected(loc, type);
|
|
5672
5711
|
}
|
|
5712
|
+
snapshotScopeStacks() {
|
|
5713
|
+
return {
|
|
5714
|
+
scopeDepth: this.scope.scopeStack.length,
|
|
5715
|
+
prodParamDepth: this.prodParam.stacks.length,
|
|
5716
|
+
classScopeDepth: this.classScope.stack.length,
|
|
5717
|
+
expressionScopeDepth: this.expressionScope.stack.length
|
|
5718
|
+
};
|
|
5719
|
+
}
|
|
5720
|
+
restoreScopeStacks(snapshot) {
|
|
5721
|
+
const { scope } = this;
|
|
5722
|
+
while (scope.scopeStack.length > snapshot.scopeDepth) scope.exit();
|
|
5723
|
+
this.prodParam.stacks.length = snapshot.prodParamDepth;
|
|
5724
|
+
this.classScope.stack.length = snapshot.classScopeDepth;
|
|
5725
|
+
this.expressionScope.stack.length = snapshot.expressionScopeDepth;
|
|
5726
|
+
}
|
|
5673
5727
|
tryParse(fn, oldState = this.state.clone()) {
|
|
5674
5728
|
const abortSignal = { node: null };
|
|
5729
|
+
const scopeStacksSnapshot = this.snapshotScopeStacks();
|
|
5675
5730
|
try {
|
|
5676
5731
|
const node = fn((node = null) => {
|
|
5677
5732
|
abortSignal.node = node;
|
|
@@ -5699,6 +5754,7 @@ var UtilParser = class extends Tokenizer {
|
|
|
5699
5754
|
} catch (error) {
|
|
5700
5755
|
const failState = this.state;
|
|
5701
5756
|
this.state = oldState;
|
|
5757
|
+
this.restoreScopeStacks(scopeStacksSnapshot);
|
|
5702
5758
|
if (error instanceof SyntaxError) return {
|
|
5703
5759
|
node: null,
|
|
5704
5760
|
error,
|
|
@@ -5811,11 +5867,10 @@ var NodeUtils = class extends UtilParser {
|
|
|
5811
5867
|
return loc;
|
|
5812
5868
|
}
|
|
5813
5869
|
startNode() {
|
|
5814
|
-
|
|
5815
|
-
this.setLoc(startLoc);
|
|
5816
|
-
return this.startNodeAt(startLoc);
|
|
5870
|
+
return this.startNodeAt(this.state.startLoc);
|
|
5817
5871
|
}
|
|
5818
5872
|
startNodeAt(loc) {
|
|
5873
|
+
this.setLoc(loc);
|
|
5819
5874
|
const { optionFlags, filename } = this;
|
|
5820
5875
|
if (!(optionFlags & 256)) return new Node(optionFlags, filename, loc.index);
|
|
5821
5876
|
return new Node(optionFlags, filename, loc.index, this.createPosition(loc));
|
|
@@ -5903,14 +5958,24 @@ const unwrapParenthesizedExpression = (node) => {
|
|
|
5903
5958
|
return node.type === "ParenthesizedExpression" ? unwrapParenthesizedExpression(node.expression) : node;
|
|
5904
5959
|
};
|
|
5905
5960
|
var LValParser = class extends NodeUtils {
|
|
5961
|
+
raiseOnce(toParseError, node) {
|
|
5962
|
+
const { errors } = this.state;
|
|
5963
|
+
const length = errors.length;
|
|
5964
|
+
const error = this.raise(toParseError, node);
|
|
5965
|
+
if (errors.length === length) return;
|
|
5966
|
+
for (let i = length - 1; i >= 0; i--) if (errors[i].pos === error.pos && errors[i].reasonCode === error.reasonCode) {
|
|
5967
|
+
errors.pop();
|
|
5968
|
+
return;
|
|
5969
|
+
}
|
|
5970
|
+
}
|
|
5906
5971
|
toAssignable(node, isLHS = false) {
|
|
5907
5972
|
let parenthesized = void 0;
|
|
5908
5973
|
if (node.type === "ParenthesizedExpression" || node.extra?.parenthesized) {
|
|
5909
5974
|
parenthesized = unwrapParenthesizedExpression(node);
|
|
5910
5975
|
if (isLHS) {
|
|
5911
5976
|
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.
|
|
5977
|
+
else if (parenthesized.type !== "CallExpression" && parenthesized.type !== "MemberExpression" && !this.isOptionalMemberExpression(parenthesized)) this.raiseOnce(Errors.InvalidParenthesizedAssignment, node);
|
|
5978
|
+
} else this.raiseOnce(Errors.InvalidParenthesizedAssignment, node);
|
|
5914
5979
|
}
|
|
5915
5980
|
switch (node.type) {
|
|
5916
5981
|
case "Identifier":
|
|
@@ -6075,7 +6140,7 @@ var LValParser = class extends NodeUtils {
|
|
|
6075
6140
|
const { type, startLoc } = this.state;
|
|
6076
6141
|
if (type === 17) return this.parseBindingRestProperty(this.startNode());
|
|
6077
6142
|
const prop = this.startNode();
|
|
6078
|
-
if (type ===
|
|
6143
|
+
if (type === 135) {
|
|
6079
6144
|
this.expectPlugin("destructuringPrivate", startLoc);
|
|
6080
6145
|
this.classScope.usePrivateName(this.state.value, startLoc);
|
|
6081
6146
|
prop.key = this.parsePrivateName();
|
|
@@ -6144,7 +6209,7 @@ var LValParser = class extends NodeUtils {
|
|
|
6144
6209
|
return;
|
|
6145
6210
|
} else if (type === "VoidPattern" && ancestor.type === "CatchClause") this.raise(Errors.VoidPatternCatchClauseParam, expression);
|
|
6146
6211
|
const unwrappedExpression = unwrapParenthesizedExpression(expression);
|
|
6147
|
-
disallowCallExpression ||= unwrappedExpression.type === "CallExpression" && (unwrappedExpression.callee.type === "Import" || unwrappedExpression.callee.type === "Super");
|
|
6212
|
+
disallowCallExpression ||= binding !== 64 || unwrappedExpression.type === "CallExpression" && (unwrappedExpression.callee.type === "Import" || unwrappedExpression.callee.type === "Super");
|
|
6148
6213
|
const validity = this.isValidLVal(type, disallowCallExpression, !(hasParenthesizedAncestor || expression.extra?.parenthesized) && ancestor.type === "AssignmentExpression", binding);
|
|
6149
6214
|
if (validity === true) return;
|
|
6150
6215
|
if (validity === false) {
|
|
@@ -6164,12 +6229,15 @@ var LValParser = class extends NodeUtils {
|
|
|
6164
6229
|
} else if (val) this.checkLVal(val, nextAncestor, binding, checkClashes, strictModeChanged, isParenthesizedExpression, disallowCallExpression);
|
|
6165
6230
|
}
|
|
6166
6231
|
checkIdentifier(at, bindingType, strictModeChanged = false) {
|
|
6232
|
+
this.checkStrictBindReservedWord(at, bindingType, strictModeChanged);
|
|
6233
|
+
if (bindingType & 8192 && at.name === "let") this.raise(Errors.LetInLexicalBinding, at);
|
|
6234
|
+
if (!(bindingType & 64)) this.declareNameFromIdentifier(at, bindingType);
|
|
6235
|
+
}
|
|
6236
|
+
checkStrictBindReservedWord(at, bindingType, strictModeChanged = false) {
|
|
6167
6237
|
if (this.state.strict && (strictModeChanged ? isStrictBindReservedWord(at.name, this.inModule) : isStrictBindOnlyReservedWord(at.name))) {
|
|
6168
6238
|
if (bindingType === 64) this.raise(Errors.StrictEvalArguments, at, { referenceName: at.name });
|
|
6169
6239
|
else this.raise(Errors.StrictEvalArgumentsBinding, at, { bindingName: at.name });
|
|
6170
6240
|
}
|
|
6171
|
-
if (bindingType & 8192 && at.name === "let") this.raise(Errors.LetInLexicalBinding, at);
|
|
6172
|
-
if (!(bindingType & 64)) this.declareNameFromIdentifier(at, bindingType);
|
|
6173
6241
|
}
|
|
6174
6242
|
declareNameFromIdentifier(identifier, binding) {
|
|
6175
6243
|
this.scope.declareName(identifier.name, binding, identifier.start);
|
|
@@ -6212,9 +6280,9 @@ var ExpressionParser = class extends LValParser {
|
|
|
6212
6280
|
getExpression() {
|
|
6213
6281
|
this.enterInitialScopes();
|
|
6214
6282
|
this.nextToken();
|
|
6215
|
-
if (this.match(
|
|
6283
|
+
if (this.match(136)) throw this.raise(Errors.ParseExpressionEmptyInput, this.state.startLoc);
|
|
6216
6284
|
const expr = this.parseExpression();
|
|
6217
|
-
if (!this.match(
|
|
6285
|
+
if (!this.match(136)) throw this.raise(Errors.ParseExpressionExpectsEOF, this.state.startLoc, { unexpected: this.input.codePointAt(this.state.start) });
|
|
6218
6286
|
this.finalizeRemainingComments();
|
|
6219
6287
|
expr.comments = this.comments;
|
|
6220
6288
|
expr.errors = this.state.errors;
|
|
@@ -6248,7 +6316,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
6248
6316
|
}
|
|
6249
6317
|
parseMaybeAssign(refExpressionErrors, isParenItem) {
|
|
6250
6318
|
const startLoc = this.state.startLoc;
|
|
6251
|
-
const isYield = this.isContextual(
|
|
6319
|
+
const isYield = this.isContextual(105);
|
|
6252
6320
|
if (isYield) {
|
|
6253
6321
|
if (this.prodParam.hasYield) {
|
|
6254
6322
|
this.next();
|
|
@@ -6258,15 +6326,20 @@ var ExpressionParser = class extends LValParser {
|
|
|
6258
6326
|
}
|
|
6259
6327
|
}
|
|
6260
6328
|
let ownExpressionErrors;
|
|
6329
|
+
let inInitializerScope = false;
|
|
6261
6330
|
if (refExpressionErrors) ownExpressionErrors = false;
|
|
6262
6331
|
else {
|
|
6263
6332
|
refExpressionErrors = new ExpressionErrors();
|
|
6264
6333
|
ownExpressionErrors = true;
|
|
6334
|
+
if (this.expressionScope.canBeInParameters()) {
|
|
6335
|
+
this.expressionScope.enter(initializerScope);
|
|
6336
|
+
inInitializerScope = true;
|
|
6337
|
+
}
|
|
6265
6338
|
}
|
|
6266
6339
|
this.state.canStartArrow = true;
|
|
6267
6340
|
let left = this.parseMaybeConditional(refExpressionErrors);
|
|
6268
6341
|
if (isParenItem) left = this.parseParenItem(left, startLoc);
|
|
6269
|
-
if (tokenIsAssignment(this.state.type)) {
|
|
6342
|
+
if (tokenIsAssignment(this.state.type) && !(this.match(27) && this.state.lastTokEndLoc.index === this.state.regExpAllowedAt)) {
|
|
6270
6343
|
const node = this.startNodeAt(startLoc);
|
|
6271
6344
|
const operator = this.state.value;
|
|
6272
6345
|
node.operator = operator;
|
|
@@ -6284,9 +6357,13 @@ var ExpressionParser = class extends LValParser {
|
|
|
6284
6357
|
} else node.left = left;
|
|
6285
6358
|
this.next();
|
|
6286
6359
|
node.right = this.parseMaybeAssign();
|
|
6360
|
+
if (inInitializerScope) this.expressionScope.exit();
|
|
6287
6361
|
this.checkLVal(left, this.finishNode(node, "AssignmentExpression"), void 0, void 0, void 0, void 0, operator === "||=" || operator === "&&=" || operator === "??=");
|
|
6288
6362
|
return node;
|
|
6289
|
-
} else if (ownExpressionErrors)
|
|
6363
|
+
} else if (ownExpressionErrors) {
|
|
6364
|
+
this.checkExpressionErrors(refExpressionErrors, true);
|
|
6365
|
+
if (inInitializerScope) this.expressionScope.exit();
|
|
6366
|
+
}
|
|
6290
6367
|
if (isYield) {
|
|
6291
6368
|
const { type } = this.state;
|
|
6292
6369
|
if ((this.hasPlugin("v8intrinsic") ? tokenCanStartExpression(type) : tokenCanStartExpression(type) && !this.match(50)) && !this.isAmbiguousPrefixOrIdentifier()) {
|
|
@@ -6314,7 +6391,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
6314
6391
|
return expr;
|
|
6315
6392
|
}
|
|
6316
6393
|
parseMaybeUnaryOrPrivate(refExpressionErrors) {
|
|
6317
|
-
return this.match(
|
|
6394
|
+
return this.match(135) ? this.parsePrivateName() : this.parseMaybeUnary(refExpressionErrors);
|
|
6318
6395
|
}
|
|
6319
6396
|
parseExprOps(refExpressionErrors) {
|
|
6320
6397
|
const startLoc = this.state.startLoc;
|
|
@@ -6323,14 +6400,21 @@ var ExpressionParser = class extends LValParser {
|
|
|
6323
6400
|
this.state.canStartArrow = false;
|
|
6324
6401
|
return this.parseExprOp(expr, startLoc, -1);
|
|
6325
6402
|
}
|
|
6403
|
+
isEscapedKeywordOperatorAfterLineBreak() {
|
|
6404
|
+
return tokenIsKeyword(this.state.type) && this.state.containsEsc && this.hasPrecedingLineBreak();
|
|
6405
|
+
}
|
|
6406
|
+
isBinaryOperator(op) {
|
|
6407
|
+
return tokenIsOperator(op) && (this.prodParam.hasIn || op !== 54) && !this.isEscapedKeywordOperatorAfterLineBreak();
|
|
6408
|
+
}
|
|
6326
6409
|
parseExprOp(left, leftStartLoc, minPrec) {
|
|
6410
|
+
const op = this.state.type;
|
|
6411
|
+
const isOperator = this.isBinaryOperator(op);
|
|
6327
6412
|
if (this.isPrivateName(left)) {
|
|
6328
6413
|
const value = this.getPrivateNameSV(left);
|
|
6329
|
-
if (minPrec >= tokenOperatorPrecedence(54) ||
|
|
6414
|
+
if (minPrec >= tokenOperatorPrecedence(54) || op !== 54 || !isOperator) this.raise(Errors.PrivateInExpectedIn, leftStartLoc, { identifierName: value });
|
|
6330
6415
|
this.classScope.usePrivateName(value, leftStartLoc);
|
|
6331
6416
|
}
|
|
6332
|
-
|
|
6333
|
-
if (tokenIsOperator(op) && (this.prodParam.hasIn || !this.match(54))) {
|
|
6417
|
+
if (isOperator) {
|
|
6334
6418
|
let prec = tokenOperatorPrecedence(op);
|
|
6335
6419
|
if (prec > minPrec) {
|
|
6336
6420
|
if (op === 35) {
|
|
@@ -6380,7 +6464,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
6380
6464
|
}
|
|
6381
6465
|
parseMaybeUnary(refExpressionErrors, sawUnary) {
|
|
6382
6466
|
const startLoc = this.state.startLoc;
|
|
6383
|
-
const isAwait = this.isContextual(
|
|
6467
|
+
const isAwait = this.isContextual(93);
|
|
6384
6468
|
if (isAwait && this.recordAwaitIfAllowed()) {
|
|
6385
6469
|
this.next();
|
|
6386
6470
|
const expr = this.parseAwait(startLoc);
|
|
@@ -6399,7 +6483,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
6399
6483
|
node.argument = this.parseMaybeUnary(null, true);
|
|
6400
6484
|
this.checkExpressionErrors(refExpressionErrors, true);
|
|
6401
6485
|
if (this.state.strict && isDelete) {
|
|
6402
|
-
const arg = node.argument;
|
|
6486
|
+
const arg = unwrapParenthesizedExpression(node.argument);
|
|
6403
6487
|
if (arg.type === "Identifier") this.raise(Errors.StrictDelete, node);
|
|
6404
6488
|
else if (this.hasPropertyAsPrivateName(arg)) this.raise(Errors.DeletePrivateField, node);
|
|
6405
6489
|
}
|
|
@@ -6439,7 +6523,20 @@ var ExpressionParser = class extends LValParser {
|
|
|
6439
6523
|
}
|
|
6440
6524
|
parseExprSubscripts(refExpressionErrors) {
|
|
6441
6525
|
const startLoc = this.state.startLoc;
|
|
6442
|
-
this.
|
|
6526
|
+
if (refExpressionErrors != null && (this.match(2) || this.match(0))) {
|
|
6527
|
+
const atomExpressionErrors = new ExpressionErrors();
|
|
6528
|
+
const expr = this.parseExprAtom(atomExpressionErrors);
|
|
6529
|
+
const result = this.parseSubscripts(expr, startLoc);
|
|
6530
|
+
if (result !== expr) this.checkExpressionErrors(atomExpressionErrors, true);
|
|
6531
|
+
else {
|
|
6532
|
+
refExpressionErrors.shorthandAssignLoc ??= atomExpressionErrors.shorthandAssignLoc;
|
|
6533
|
+
refExpressionErrors.doubleProtoLoc ??= atomExpressionErrors.doubleProtoLoc;
|
|
6534
|
+
refExpressionErrors.privateKeyLoc ??= atomExpressionErrors.privateKeyLoc;
|
|
6535
|
+
refExpressionErrors.optionalParametersLoc ??= atomExpressionErrors.optionalParametersLoc;
|
|
6536
|
+
refExpressionErrors.voidPatternLoc ??= atomExpressionErrors.voidPatternLoc;
|
|
6537
|
+
}
|
|
6538
|
+
return result;
|
|
6539
|
+
}
|
|
6443
6540
|
const expr = this.parseExprAtom(refExpressionErrors);
|
|
6444
6541
|
if (this.shouldExitDescending(expr)) return expr;
|
|
6445
6542
|
return this.parseSubscripts(expr, startLoc);
|
|
@@ -6487,7 +6584,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
6487
6584
|
if (computed) {
|
|
6488
6585
|
node.property = this.parseExpression();
|
|
6489
6586
|
this.expect(1);
|
|
6490
|
-
} else if (this.match(
|
|
6587
|
+
} else if (this.match(135)) {
|
|
6491
6588
|
if (base.type === "Super") this.raise(Errors.SuperPrivateField, startLoc);
|
|
6492
6589
|
this.classScope.usePrivateName(this.state.value, this.state.startLoc);
|
|
6493
6590
|
node.property = this.parsePrivateName();
|
|
@@ -6586,6 +6683,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
6586
6683
|
parseNoCallExpr(onUnparenthesizedImportExpression) {
|
|
6587
6684
|
const startLoc = this.state.startLoc;
|
|
6588
6685
|
const isImport = this.match(79);
|
|
6686
|
+
this.state.canStartArrow = false;
|
|
6589
6687
|
const base = this.parseExprAtom();
|
|
6590
6688
|
if (isImport && base.type === "ImportExpression") onUnparenthesizedImportExpression(base);
|
|
6591
6689
|
return this.parseSubscripts(base, startLoc, true);
|
|
@@ -6616,9 +6714,9 @@ var ExpressionParser = class extends LValParser {
|
|
|
6616
6714
|
case 27:
|
|
6617
6715
|
this.readRegexp();
|
|
6618
6716
|
return this.parseRegExpLiteral(this.state.value);
|
|
6619
|
-
case
|
|
6620
|
-
case
|
|
6621
|
-
case
|
|
6717
|
+
case 132: return this.parseNumericLiteral(this.state.value);
|
|
6718
|
+
case 133: return this.parseBigIntLiteral(this.state.value);
|
|
6719
|
+
case 131: return this.parseStringLiteral(this.state.value);
|
|
6622
6720
|
case 80: return this.parseNullLiteral();
|
|
6623
6721
|
case 81: return this.parseBooleanLiteral(true);
|
|
6624
6722
|
case 82: return this.parseBooleanLiteral(false);
|
|
@@ -6641,7 +6739,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
6641
6739
|
if (callee.type === "MemberExpression") return this.finishNode(node, "BindExpression");
|
|
6642
6740
|
else throw this.raise(Errors.UnsupportedBind, callee);
|
|
6643
6741
|
}
|
|
6644
|
-
case
|
|
6742
|
+
case 135:
|
|
6645
6743
|
this.raise(Errors.PrivateInExpectedIn, this.state.startLoc, { identifierName: this.state.value });
|
|
6646
6744
|
return this.parsePrivateName();
|
|
6647
6745
|
case 29: return this.parseTopicReferenceThenEqualsSign(50, "%");
|
|
@@ -6657,7 +6755,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
6657
6755
|
}
|
|
6658
6756
|
case 43: {
|
|
6659
6757
|
const lookaheadCh = this.input.codePointAt(this.nextTokenStart());
|
|
6660
|
-
if (isIdentifierStart$1(lookaheadCh) || lookaheadCh === 62)
|
|
6758
|
+
if (isIdentifierStart$1(lookaheadCh) || lookaheadCh === 62) this.expectOnePlugin([
|
|
6661
6759
|
"jsx",
|
|
6662
6760
|
"flow",
|
|
6663
6761
|
"typescript"
|
|
@@ -6665,7 +6763,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
6665
6763
|
throw this.unexpected();
|
|
6666
6764
|
}
|
|
6667
6765
|
default: if (tokenIsIdentifier(type)) {
|
|
6668
|
-
if (this.isContextual(
|
|
6766
|
+
if (this.isContextual(124) && this.lookaheadInLineCharCode() === 123) return this.parseModuleExpression();
|
|
6669
6767
|
const { canStartArrow, containsEsc } = this.state;
|
|
6670
6768
|
const id = this.parseIdentifier();
|
|
6671
6769
|
if (!containsEsc && id.name === "async" && !this.canInsertSemicolon()) {
|
|
@@ -6767,7 +6865,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
6767
6865
|
if (this.prodParam.hasYield && this.match(12)) {
|
|
6768
6866
|
const meta = this.createIdentifier(this.startNodeAtNode(node), "function");
|
|
6769
6867
|
this.next();
|
|
6770
|
-
if (this.match(
|
|
6868
|
+
if (this.match(100)) this.expectPlugin("functionSent");
|
|
6771
6869
|
else if (!this.hasPlugin("functionSent")) this.unexpected();
|
|
6772
6870
|
return this.parseMetaProperty(node, meta, "sent");
|
|
6773
6871
|
}
|
|
@@ -6785,15 +6883,15 @@ var ExpressionParser = class extends LValParser {
|
|
|
6785
6883
|
}
|
|
6786
6884
|
parseImportMetaPropertyOrPhaseCall(node) {
|
|
6787
6885
|
this.next();
|
|
6788
|
-
if (this.isContextual(
|
|
6789
|
-
const isSource = this.isContextual(
|
|
6886
|
+
if (this.isContextual(102) || this.isContextual(94)) {
|
|
6887
|
+
const isSource = this.isContextual(102);
|
|
6790
6888
|
this.expectPlugin(isSource ? "sourcePhaseImports" : "deferredImportEvaluation");
|
|
6791
6889
|
this.next();
|
|
6792
6890
|
node.phase = isSource ? "source" : "defer";
|
|
6793
6891
|
return this.parseImportCall(node);
|
|
6794
6892
|
} else {
|
|
6795
6893
|
const id = this.createIdentifierAt(this.startNodeAtNode(node), "import", this.state.lastTokStartLoc);
|
|
6796
|
-
if (this.isContextual(
|
|
6894
|
+
if (this.isContextual(98)) {
|
|
6797
6895
|
if (!this.inModule) this.raise(Errors.ImportMetaOutsideModule, id);
|
|
6798
6896
|
this.sawUnambiguousESM = true;
|
|
6799
6897
|
}
|
|
@@ -7123,16 +7221,16 @@ var ExpressionParser = class extends LValParser {
|
|
|
7123
7221
|
let key;
|
|
7124
7222
|
if (tokenIsKeywordOrIdentifier(type)) key = this.parseIdentifier(true);
|
|
7125
7223
|
else switch (type) {
|
|
7126
|
-
case
|
|
7224
|
+
case 132:
|
|
7127
7225
|
key = this.parseNumericLiteral(value);
|
|
7128
7226
|
break;
|
|
7129
|
-
case
|
|
7227
|
+
case 131:
|
|
7130
7228
|
key = this.parseStringLiteral(value);
|
|
7131
7229
|
break;
|
|
7132
|
-
case
|
|
7230
|
+
case 133:
|
|
7133
7231
|
key = this.parseBigIntLiteral(value);
|
|
7134
7232
|
break;
|
|
7135
|
-
case
|
|
7233
|
+
case 135: {
|
|
7136
7234
|
const privateKeyLoc = this.state.startLoc;
|
|
7137
7235
|
if (refExpressionErrors != null) {
|
|
7138
7236
|
if (refExpressionErrors.privateKeyLoc === null) refExpressionErrors.privateKeyLoc = privateKeyLoc;
|
|
@@ -7143,7 +7241,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
7143
7241
|
default: throw this.unexpected();
|
|
7144
7242
|
}
|
|
7145
7243
|
prop.key = key;
|
|
7146
|
-
if (type !==
|
|
7244
|
+
if (type !== 135) prop.computed = false;
|
|
7147
7245
|
}
|
|
7148
7246
|
}
|
|
7149
7247
|
initFunction(node, isAsync) {
|
|
@@ -7171,11 +7269,13 @@ var ExpressionParser = class extends LValParser {
|
|
|
7171
7269
|
parseArrowExpression(node, params, isAsync, trailingCommaLoc) {
|
|
7172
7270
|
this.scope.enter(518);
|
|
7173
7271
|
let flags = functionFlags(isAsync, false);
|
|
7174
|
-
|
|
7272
|
+
const hasBlockBody = this.match(2);
|
|
7273
|
+
if (!hasBlockBody) flags |= this.prodParam.currentFlags() & 24;
|
|
7175
7274
|
this.prodParam.enter(flags);
|
|
7176
7275
|
this.initFunction(node, isAsync);
|
|
7177
7276
|
if (params) this.setArrowFunctionParameters(node, params, trailingCommaLoc);
|
|
7178
7277
|
this.parseFunctionBody(node, true);
|
|
7278
|
+
if (hasBlockBody) this.state.regExpAllowedAt = this.state.lastTokEndLoc.index;
|
|
7179
7279
|
this.prodParam.exit();
|
|
7180
7280
|
this.scope.exit();
|
|
7181
7281
|
return this.finishNode(node, "ArrowFunctionExpression");
|
|
@@ -7190,7 +7290,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
7190
7290
|
}
|
|
7191
7291
|
parseFunctionBody(node, allowExpression, isMethod = false) {
|
|
7192
7292
|
const isExpression = allowExpression && !this.match(2);
|
|
7193
|
-
this.expressionScope.enter(
|
|
7293
|
+
this.expressionScope.enter(sharedExpressionScope);
|
|
7194
7294
|
if (isExpression) {
|
|
7195
7295
|
node.body = this.parseMaybeAssign();
|
|
7196
7296
|
this.checkParams(node, false, allowExpression, false);
|
|
@@ -7204,7 +7304,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
7204
7304
|
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
7305
|
const strictModeChanged = !oldStrict && this.state.strict;
|
|
7206
7306
|
this.checkParams(node, !this.state.strict && !allowExpression && !isMethod && !nonSimple, allowExpression, strictModeChanged);
|
|
7207
|
-
if (
|
|
7307
|
+
if (node.id) this.checkStrictBindReservedWord(node.id, 65, strictModeChanged);
|
|
7208
7308
|
});
|
|
7209
7309
|
this.prodParam.exit();
|
|
7210
7310
|
this.state.labels = oldLabels;
|
|
@@ -7279,7 +7379,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
7279
7379
|
else this.unexpected();
|
|
7280
7380
|
const tokenIsKeyword = tokenKeywordOrIdentifierIsKeyword(type);
|
|
7281
7381
|
if (liberal) {
|
|
7282
|
-
if (tokenIsKeyword) this.replaceToken(
|
|
7382
|
+
if (tokenIsKeyword) this.replaceToken(129);
|
|
7283
7383
|
} else this.checkReservedWord(name, this.sourceToOffsetPos(start), tokenIsKeyword, false);
|
|
7284
7384
|
this.next();
|
|
7285
7385
|
return name;
|
|
@@ -7323,7 +7423,6 @@ var ExpressionParser = class extends LValParser {
|
|
|
7323
7423
|
}
|
|
7324
7424
|
parseAwait(startLoc, soloAwait) {
|
|
7325
7425
|
const startIndex = startLoc.index;
|
|
7326
|
-
this.setLoc(startLoc);
|
|
7327
7426
|
const node = this.startNodeAt(startLoc);
|
|
7328
7427
|
this.expressionScope.recordParameterInitializerError(Errors.AwaitExpressionFormalParameter, startIndex);
|
|
7329
7428
|
if (this.eat(51)) this.raise(Errors.ObsoleteAwaitStar, startLoc);
|
|
@@ -7331,16 +7430,18 @@ var ExpressionParser = class extends LValParser {
|
|
|
7331
7430
|
if (this.isAmbiguousPrefixOrIdentifier()) this.ambiguousScriptDifferentAst = true;
|
|
7332
7431
|
else this.sawUnambiguousESM = true;
|
|
7333
7432
|
}
|
|
7334
|
-
if (!soloAwait)
|
|
7433
|
+
if (!soloAwait) {
|
|
7434
|
+
this.state.canStartArrow = false;
|
|
7435
|
+
node.argument = this.parseMaybeUnary(null, true);
|
|
7436
|
+
}
|
|
7335
7437
|
return this.finishNode(node, "AwaitExpression");
|
|
7336
7438
|
}
|
|
7337
7439
|
isAmbiguousPrefixOrIdentifier() {
|
|
7338
7440
|
if (this.hasPrecedingLineBreak()) return true;
|
|
7339
7441
|
const { type } = this.state;
|
|
7340
|
-
return type === 49 || type === 6 || type === 0 || tokenIsTemplate(type) || type ===
|
|
7442
|
+
return type === 49 || type === 6 || type === 0 || tokenIsTemplate(type) || type === 99 && !this.state.containsEsc || type === 134 || type === 52 || this.hasPlugin("v8intrinsic") && type === 50;
|
|
7341
7443
|
}
|
|
7342
7444
|
parseYield(startLoc) {
|
|
7343
|
-
this.setLoc(startLoc);
|
|
7344
7445
|
const node = this.startNodeAt(startLoc);
|
|
7345
7446
|
this.expressionScope.recordParameterInitializerError(Errors.YieldInParameter, startLoc.index);
|
|
7346
7447
|
let delegating = false;
|
|
@@ -7349,7 +7450,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
7349
7450
|
delegating = this.eat(51);
|
|
7350
7451
|
switch (this.state.type) {
|
|
7351
7452
|
case 9:
|
|
7352
|
-
case
|
|
7453
|
+
case 136:
|
|
7353
7454
|
case 4:
|
|
7354
7455
|
case 7:
|
|
7355
7456
|
case 1:
|
|
@@ -7359,6 +7460,7 @@ var ExpressionParser = class extends LValParser {
|
|
|
7359
7460
|
default: argument = this.parseMaybeAssign();
|
|
7360
7461
|
}
|
|
7361
7462
|
}
|
|
7463
|
+
if (!argument) this.state.regExpAllowedAt = this.state.lastTokEndLoc.index;
|
|
7362
7464
|
node.delegate = delegating;
|
|
7363
7465
|
node.argument = argument;
|
|
7364
7466
|
return this.finishNode(node, "YieldExpression");
|
|
@@ -7423,11 +7525,11 @@ var ExpressionParser = class extends LValParser {
|
|
|
7423
7525
|
const startLoc = this.state.startLoc;
|
|
7424
7526
|
this.prodParam.enter(this.prodParam.currentFlags() & -17);
|
|
7425
7527
|
let ret;
|
|
7426
|
-
if (this.isContextual(
|
|
7528
|
+
if (this.isContextual(93) && this.recordAwaitIfAllowed()) {
|
|
7427
7529
|
this.next();
|
|
7428
7530
|
ret = this.parseAwait(startLoc, true);
|
|
7429
7531
|
const nextOp = this.state.type;
|
|
7430
|
-
if (
|
|
7532
|
+
if (nextOp !== 35 && this.isBinaryOperator(nextOp)) this.raise(Errors.PipelineUnparenthesized, startLoc);
|
|
7431
7533
|
} else {
|
|
7432
7534
|
this.state.canStartArrow = true;
|
|
7433
7535
|
ret = this.parseExprOp(this.parseMaybeUnaryOrPrivate(), startLoc, prec);
|
|
@@ -7471,6 +7573,7 @@ const loopLabel = { kind: 1 };
|
|
|
7471
7573
|
const switchLabel = { kind: 2 };
|
|
7472
7574
|
const loneSurrogate = /[\uD800-\uDFFF]/u;
|
|
7473
7575
|
const keywordRelationalOperator = /in(?:stanceof)?/y;
|
|
7576
|
+
const keywordLikeWord = /[a-z]{2,10}/y;
|
|
7474
7577
|
function createExportedTokens(tokens) {
|
|
7475
7578
|
for (let i = 0; i < tokens.length; i++) {
|
|
7476
7579
|
const token = tokens[i];
|
|
@@ -7481,7 +7584,7 @@ function createExportedTokens(tokens) {
|
|
|
7481
7584
|
}
|
|
7482
7585
|
var StatementParser = class extends ExpressionParser {
|
|
7483
7586
|
parseTopLevel(file, program) {
|
|
7484
|
-
file.program = this.parseProgram(program,
|
|
7587
|
+
file.program = this.parseProgram(program, 136, this.options.sourceType === "module" ? "module" : "script");
|
|
7485
7588
|
file.comments = this.comments;
|
|
7486
7589
|
if (this.optionFlags & 512) file.tokens = createExportedTokens(this.tokens);
|
|
7487
7590
|
return this.finishNode(file, "File");
|
|
@@ -7495,7 +7598,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
7495
7598
|
this.addExtra(program, "topLevelAwait", this.state.hasTopLevelAwait);
|
|
7496
7599
|
}
|
|
7497
7600
|
let finishedProgram;
|
|
7498
|
-
if (end ===
|
|
7601
|
+
if (end === 136) finishedProgram = this.finishNode(program, "Program");
|
|
7499
7602
|
else finishedProgram = this.finishNodeAt(program, "Program", createPositionWithColumnOffset(this.state.startLoc, -1));
|
|
7500
7603
|
return finishedProgram;
|
|
7501
7604
|
}
|
|
@@ -7520,15 +7623,15 @@ var StatementParser = class extends ExpressionParser {
|
|
|
7520
7623
|
return this.finishNode(node, "InterpreterDirective");
|
|
7521
7624
|
}
|
|
7522
7625
|
isLet() {
|
|
7523
|
-
if (!this.isContextual(
|
|
7626
|
+
if (!this.isContextual(97)) return false;
|
|
7524
7627
|
return this.hasFollowingBindingAtom();
|
|
7525
7628
|
}
|
|
7526
7629
|
isUsing() {
|
|
7527
|
-
if (!this.isContextual(
|
|
7630
|
+
if (!this.isContextual(104)) return false;
|
|
7528
7631
|
return this.nextTokenIsIdentifierOnSameLine();
|
|
7529
7632
|
}
|
|
7530
7633
|
isForUsing() {
|
|
7531
|
-
if (!this.isContextual(
|
|
7634
|
+
if (!this.isContextual(104)) return false;
|
|
7532
7635
|
const next = this.nextTokenInLineStart();
|
|
7533
7636
|
const nextCh = this.codePointAtPos(next);
|
|
7534
7637
|
if (this.isUnparsedContextual(next, "of")) {
|
|
@@ -7544,7 +7647,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
7544
7647
|
return this.chStartsBindingIdentifier(nextCh, next);
|
|
7545
7648
|
}
|
|
7546
7649
|
isAwaitUsing() {
|
|
7547
|
-
if (!this.isContextual(
|
|
7650
|
+
if (!this.isContextual(93)) return false;
|
|
7548
7651
|
let next = this.nextTokenInLineStart();
|
|
7549
7652
|
if (this.isUnparsedContextual(next, "using")) {
|
|
7550
7653
|
next = this.nextTokenInLineStartSince(next + 5);
|
|
@@ -7564,6 +7667,16 @@ var StatementParser = class extends ExpressionParser {
|
|
|
7564
7667
|
} else if (ch === 92) return true;
|
|
7565
7668
|
else return false;
|
|
7566
7669
|
}
|
|
7670
|
+
isReservedWordOnNewLineAfterLet(pos) {
|
|
7671
|
+
if (!hasNewLine(this.input, this.state.end, pos)) return false;
|
|
7672
|
+
keywordLikeWord.lastIndex = pos;
|
|
7673
|
+
if (!keywordLikeWord.test(this.input)) return false;
|
|
7674
|
+
const end = keywordLikeWord.lastIndex;
|
|
7675
|
+
const endCh = this.codePointAtPos(end);
|
|
7676
|
+
if (isIdentifierChar$1(endCh) || endCh === 92) return false;
|
|
7677
|
+
const word = this.input.slice(pos, end);
|
|
7678
|
+
return isKeyword$1(word) || isReservedWord$1(word, false);
|
|
7679
|
+
}
|
|
7567
7680
|
chStartsBindingPattern(ch) {
|
|
7568
7681
|
return ch === 91 || ch === 123;
|
|
7569
7682
|
}
|
|
@@ -7617,7 +7730,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
7617
7730
|
case 64:
|
|
7618
7731
|
if (this.lookaheadCharCode() === 46) break;
|
|
7619
7732
|
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,
|
|
7733
|
+
return this.parseFunctionStatement(node, false, flags);
|
|
7621
7734
|
case 76:
|
|
7622
7735
|
if (!allowDeclaration) this.unexpected();
|
|
7623
7736
|
return this.parseClass(this.maybeTakeDecorators(decorators, node), true);
|
|
@@ -7626,7 +7739,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
7626
7739
|
case 67: return this.parseSwitchStatement(node);
|
|
7627
7740
|
case 68: return this.parseThrowStatement(node);
|
|
7628
7741
|
case 69: return this.parseTryStatement(node);
|
|
7629
|
-
case
|
|
7742
|
+
case 93:
|
|
7630
7743
|
if (this.isAwaitUsing()) {
|
|
7631
7744
|
if (!this.allowsUsing()) this.raise(Errors.UnexpectedUsingDeclaration, node);
|
|
7632
7745
|
else if (!allowDeclaration) this.raise(Errors.UnexpectedLexicalDeclaration, node);
|
|
@@ -7635,18 +7748,19 @@ var StatementParser = class extends ExpressionParser {
|
|
|
7635
7748
|
return this.parseVarStatement(node, "await using");
|
|
7636
7749
|
}
|
|
7637
7750
|
break;
|
|
7638
|
-
case
|
|
7751
|
+
case 104:
|
|
7639
7752
|
if (this.state.containsEsc || !this.hasInLineFollowingBindingIdentifierOrBrace()) break;
|
|
7640
7753
|
if (!this.allowsUsing()) this.raise(Errors.UnexpectedUsingDeclaration, this.state.startLoc);
|
|
7641
7754
|
else if (!allowDeclaration) this.raise(Errors.UnexpectedLexicalDeclaration, this.state.startLoc);
|
|
7642
7755
|
return this.parseVarStatement(node, "using");
|
|
7643
|
-
case
|
|
7756
|
+
case 97: {
|
|
7644
7757
|
if (this.state.containsEsc) break;
|
|
7645
7758
|
const next = this.nextTokenStart();
|
|
7646
7759
|
const nextCh = this.codePointAtPos(next);
|
|
7647
7760
|
if (nextCh !== 91) {
|
|
7648
7761
|
if (!allowDeclaration && this.hasFollowingLineBreak()) break;
|
|
7649
7762
|
if (!this.chStartsBindingIdentifier(nextCh, next) && nextCh !== 123) break;
|
|
7763
|
+
if (this.isReservedWordOnNewLineAfterLet(next)) break;
|
|
7650
7764
|
}
|
|
7651
7765
|
}
|
|
7652
7766
|
case 71: if (!allowDeclaration) this.raise(Errors.UnexpectedLexicalDeclaration, this.state.startLoc);
|
|
@@ -7674,13 +7788,18 @@ var StatementParser = class extends ExpressionParser {
|
|
|
7674
7788
|
default: if (this.isAsyncFunction()) {
|
|
7675
7789
|
if (!allowDeclaration) this.raise(Errors.AsyncFunctionInSingleStatementContext, this.state.startLoc);
|
|
7676
7790
|
this.next();
|
|
7677
|
-
return this.parseFunctionStatement(node, true,
|
|
7791
|
+
return this.parseFunctionStatement(node, true, flags);
|
|
7678
7792
|
}
|
|
7679
7793
|
}
|
|
7680
7794
|
const maybeName = this.state.value;
|
|
7795
|
+
if (startType === 89 && this.lookahead().type === 10) {
|
|
7796
|
+
const label = this.parseIdentifier(true);
|
|
7797
|
+
this.next();
|
|
7798
|
+
return this.parseLabeledStatement(node, maybeName, label, flags);
|
|
7799
|
+
}
|
|
7681
7800
|
const expr = this.parseExpression();
|
|
7682
7801
|
if (tokenIsIdentifier(startType) && expr.type === "Identifier" && this.eat(10)) return this.parseLabeledStatement(node, maybeName, expr, flags);
|
|
7683
|
-
else return this.parseExpressionStatement(node, expr);
|
|
7802
|
+
else return this.parseExpressionStatement(node, expr, flags);
|
|
7684
7803
|
}
|
|
7685
7804
|
assertModuleNodeAllowed(node) {
|
|
7686
7805
|
if (!(this.optionFlags & 8) && !this.inModule) this.raise(Errors.ImportOutsideModule, node);
|
|
@@ -7730,7 +7849,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
7730
7849
|
while (this.eat(12)) {
|
|
7731
7850
|
const node = this.startNodeAt(startLoc);
|
|
7732
7851
|
node.object = expr;
|
|
7733
|
-
if (this.match(
|
|
7852
|
+
if (this.match(135)) {
|
|
7734
7853
|
this.classScope.usePrivateName(this.state.value, this.state.startLoc);
|
|
7735
7854
|
node.property = this.parsePrivateName();
|
|
7736
7855
|
} else node.property = this.parseIdentifier(true);
|
|
@@ -7759,7 +7878,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
7759
7878
|
this.next();
|
|
7760
7879
|
if (this.isLineTerminator()) node.label = null;
|
|
7761
7880
|
else {
|
|
7762
|
-
node.label = this.parseIdentifier();
|
|
7881
|
+
node.label = this.parseIdentifier(this.match(89));
|
|
7763
7882
|
this.semicolon();
|
|
7764
7883
|
}
|
|
7765
7884
|
this.verifyBreakContinue(node, isBreak);
|
|
@@ -7804,7 +7923,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
7804
7923
|
this.next();
|
|
7805
7924
|
this.state.labels.push(loopLabel);
|
|
7806
7925
|
let awaitAt = null;
|
|
7807
|
-
if (this.isContextual(
|
|
7926
|
+
if (this.isContextual(93) && this.recordAwaitIfAllowed()) {
|
|
7808
7927
|
awaitAt = this.state.startLoc;
|
|
7809
7928
|
this.next();
|
|
7810
7929
|
}
|
|
@@ -7814,7 +7933,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
7814
7933
|
if (awaitAt !== null) this.unexpected(awaitAt);
|
|
7815
7934
|
return this.parseFor(node, null);
|
|
7816
7935
|
}
|
|
7817
|
-
const startsWithLet = this.isContextual(
|
|
7936
|
+
const startsWithLet = this.isContextual(97);
|
|
7818
7937
|
{
|
|
7819
7938
|
const startsWithAwaitUsing = this.isAwaitUsing();
|
|
7820
7939
|
const starsWithUsingDeclaration = startsWithAwaitUsing || this.isForUsing();
|
|
@@ -7832,15 +7951,15 @@ var StatementParser = class extends ExpressionParser {
|
|
|
7832
7951
|
const init = this.finishNode(initNode, "VariableDeclaration");
|
|
7833
7952
|
const isForIn = this.match(54);
|
|
7834
7953
|
if (isForIn && starsWithUsingDeclaration) this.raise(Errors.ForInUsing, init);
|
|
7835
|
-
if ((isForIn || this.isContextual(
|
|
7954
|
+
if ((isForIn || this.isContextual(99)) && init.declarations.length === 1) return this.parseForX(node, init, awaitAt);
|
|
7836
7955
|
if (awaitAt !== null) this.unexpected(awaitAt);
|
|
7837
7956
|
return this.parseFor(node, init);
|
|
7838
7957
|
}
|
|
7839
7958
|
}
|
|
7840
|
-
const startsWithAsync = this.isContextual(
|
|
7959
|
+
const startsWithAsync = this.isContextual(92);
|
|
7841
7960
|
const refExpressionErrors = new ExpressionErrors();
|
|
7842
7961
|
const init = this.parseExpression(true, refExpressionErrors);
|
|
7843
|
-
const isForOf = this.isContextual(
|
|
7962
|
+
const isForOf = this.isContextual(99);
|
|
7844
7963
|
if (isForOf) {
|
|
7845
7964
|
if (startsWithLet) this.raise(Errors.ForOfLet, init);
|
|
7846
7965
|
if (awaitAt === null && startsWithAsync && init.type === "Identifier") this.raise(Errors.ForOfAsync, init);
|
|
@@ -7855,9 +7974,14 @@ var StatementParser = class extends ExpressionParser {
|
|
|
7855
7974
|
if (awaitAt !== null) this.unexpected(awaitAt);
|
|
7856
7975
|
return this.parseFor(node, init);
|
|
7857
7976
|
}
|
|
7858
|
-
parseFunctionStatement(node, isAsync,
|
|
7977
|
+
parseFunctionStatement(node, isAsync, statementFlags) {
|
|
7859
7978
|
this.next();
|
|
7860
|
-
|
|
7979
|
+
let flags = 1 | (isAsync ? 8 : 0);
|
|
7980
|
+
if (!(statementFlags & 2) && statementFlags & 4) {
|
|
7981
|
+
flags |= 16;
|
|
7982
|
+
if (!(statementFlags & 8)) flags |= 2;
|
|
7983
|
+
}
|
|
7984
|
+
return this.parseFunction(node, flags);
|
|
7861
7985
|
}
|
|
7862
7986
|
parseIfStatement(node) {
|
|
7863
7987
|
this.next();
|
|
@@ -7986,7 +8110,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
7986
8110
|
node.label = expr;
|
|
7987
8111
|
return this.finishNode(node, "LabeledStatement");
|
|
7988
8112
|
}
|
|
7989
|
-
parseExpressionStatement(node, expr) {
|
|
8113
|
+
parseExpressionStatement(node, expr, _flags) {
|
|
7990
8114
|
node.expression = expr;
|
|
7991
8115
|
this.semicolon();
|
|
7992
8116
|
return this.finishNode(node, "ExpressionStatement");
|
|
@@ -8068,9 +8192,9 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8068
8192
|
const decl = this.startNode();
|
|
8069
8193
|
this.parseVarId(decl, kind);
|
|
8070
8194
|
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 (
|
|
8195
|
+
if (decl.init === null && !allowMissingInitializer && !(isFor && declarations.length === 0 && (this.match(54) || this.isContextual(99)))) {
|
|
8196
|
+
if (decl.id.type !== "Identifier") this.raise(Errors.DeclarationMissingInitializer, this.state.lastTokEndLoc, { kind: "destructuring" });
|
|
8197
|
+
else if (kind === "const" || kind === "using" || kind === "await using") this.raise(Errors.DeclarationMissingInitializer, this.state.lastTokEndLoc, { kind });
|
|
8074
8198
|
}
|
|
8075
8199
|
declarations.push(this.finishNode(decl, "VariableDeclarator"));
|
|
8076
8200
|
if (!this.eat(8)) break;
|
|
@@ -8089,13 +8213,12 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8089
8213
|
return this.parseFunction(node, 8);
|
|
8090
8214
|
}
|
|
8091
8215
|
parseFunction(node, flags = 0) {
|
|
8092
|
-
const hangingDeclaration = flags & 2;
|
|
8093
8216
|
const isDeclaration = !!(flags & 1);
|
|
8094
8217
|
const requireId = isDeclaration && !(flags & 4);
|
|
8095
8218
|
const isAsync = !!(flags & 8);
|
|
8096
8219
|
this.initFunction(node, isAsync);
|
|
8097
8220
|
if (this.match(51)) {
|
|
8098
|
-
if (
|
|
8221
|
+
if (flags & 16) this.raise(Errors.GeneratorInSingleStatementContext, this.state.startLoc);
|
|
8099
8222
|
this.next();
|
|
8100
8223
|
node.generator = true;
|
|
8101
8224
|
}
|
|
@@ -8103,7 +8226,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8103
8226
|
this.scope.enter(514);
|
|
8104
8227
|
this.prodParam.enter(functionFlags(isAsync, node.generator));
|
|
8105
8228
|
if (!isDeclaration && tokenIsIdentifier(this.state.type)) {
|
|
8106
|
-
this.expressionScope.enter(
|
|
8229
|
+
this.expressionScope.enter(sharedExpressionScope);
|
|
8107
8230
|
node.id = this.parseFunctionId();
|
|
8108
8231
|
this.expressionScope.exit();
|
|
8109
8232
|
}
|
|
@@ -8111,7 +8234,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8111
8234
|
this.parseFunctionBodyAndFinish(node, isDeclaration ? "FunctionDeclaration" : "FunctionExpression");
|
|
8112
8235
|
this.prodParam.exit();
|
|
8113
8236
|
this.scope.exit();
|
|
8114
|
-
if (isDeclaration && !
|
|
8237
|
+
if (isDeclaration && !(flags & 2)) this.registerFunctionStatementId(node);
|
|
8115
8238
|
return node;
|
|
8116
8239
|
}
|
|
8117
8240
|
parseFunctionId(requireId) {
|
|
@@ -8119,7 +8242,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8119
8242
|
}
|
|
8120
8243
|
parseFunctionParams(node, isConstructor) {
|
|
8121
8244
|
this.expect(6);
|
|
8122
|
-
this.expressionScope.enter(
|
|
8245
|
+
this.expressionScope.enter(parameterDeclarationScope);
|
|
8123
8246
|
node.params = this.parseBindingList(7, 41, 2 | (isConstructor ? 4 : 0));
|
|
8124
8247
|
this.expressionScope.exit();
|
|
8125
8248
|
}
|
|
@@ -8203,7 +8326,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8203
8326
|
return false;
|
|
8204
8327
|
}
|
|
8205
8328
|
parseClassMember(classBody, member, state) {
|
|
8206
|
-
const isStatic = this.isContextual(
|
|
8329
|
+
const isStatic = this.isContextual(103);
|
|
8207
8330
|
if (isStatic) {
|
|
8208
8331
|
if (this.parseClassMemberFromModifier(classBody, member)) return;
|
|
8209
8332
|
if (this.eat(2)) {
|
|
@@ -8225,7 +8348,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8225
8348
|
this.parsePropertyNamePrefixOperator(member);
|
|
8226
8349
|
if (this.eat(51)) {
|
|
8227
8350
|
method.kind = "method";
|
|
8228
|
-
const isPrivateName = this.match(
|
|
8351
|
+
const isPrivateName = this.match(135);
|
|
8229
8352
|
this.parseClassElementName(method);
|
|
8230
8353
|
this.parsePostMemberNameModifiers(method);
|
|
8231
8354
|
if (isPrivateName) {
|
|
@@ -8267,7 +8390,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8267
8390
|
const isGenerator = this.eat(51);
|
|
8268
8391
|
if (publicMember.optional) this.unexpected(maybeQuestionTokenStartLoc);
|
|
8269
8392
|
method.kind = "method";
|
|
8270
|
-
const isPrivate = this.match(
|
|
8393
|
+
const isPrivate = this.match(135);
|
|
8271
8394
|
this.parseClassElementName(method);
|
|
8272
8395
|
this.parsePostMemberNameModifiers(publicMember);
|
|
8273
8396
|
if (isPrivate) this.pushClassPrivateMethod(classBody, privateMethod, isGenerator, true);
|
|
@@ -8278,7 +8401,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8278
8401
|
} else if ((maybeContextualKw === "get" || maybeContextualKw === "set") && !(this.match(51) && this.isLineTerminator())) {
|
|
8279
8402
|
this.resetPreviousNodeTrailingComments(key);
|
|
8280
8403
|
method.kind = maybeContextualKw;
|
|
8281
|
-
const isPrivate = this.match(
|
|
8404
|
+
const isPrivate = this.match(135);
|
|
8282
8405
|
this.parseClassElementName(publicMethod);
|
|
8283
8406
|
if (isPrivate) this.pushClassPrivateMethod(classBody, privateMethod, false, false);
|
|
8284
8407
|
else {
|
|
@@ -8289,7 +8412,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8289
8412
|
} else if (maybeContextualKw === "accessor" && !this.isLineTerminator()) {
|
|
8290
8413
|
this.expectPlugin("decoratorAutoAccessors");
|
|
8291
8414
|
this.resetPreviousNodeTrailingComments(key);
|
|
8292
|
-
const isPrivate = this.match(
|
|
8415
|
+
const isPrivate = this.match(135);
|
|
8293
8416
|
this.parseClassElementName(publicProp);
|
|
8294
8417
|
this.pushClassAccessorProperty(classBody, accessorProp, isPrivate);
|
|
8295
8418
|
} else if (this.isLineTerminator()) {
|
|
@@ -8299,8 +8422,8 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8299
8422
|
}
|
|
8300
8423
|
parseClassElementName(member) {
|
|
8301
8424
|
const { type, value } = this.state;
|
|
8302
|
-
if ((type ===
|
|
8303
|
-
if (type ===
|
|
8425
|
+
if ((type === 129 || type === 131) && member.static && value === "prototype") this.raise(Errors.StaticPrototype, this.state.startLoc);
|
|
8426
|
+
if (type === 135) {
|
|
8304
8427
|
if (value === "constructor") this.raise(Errors.ConstructorClassPrivateField, this.state.startLoc);
|
|
8305
8428
|
const key = this.parsePrivateName();
|
|
8306
8429
|
member.key = key;
|
|
@@ -8367,7 +8490,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8367
8490
|
}
|
|
8368
8491
|
parseInitializer(node) {
|
|
8369
8492
|
this.scope.enter(592);
|
|
8370
|
-
this.expressionScope.enter(
|
|
8493
|
+
this.expressionScope.enter(sharedExpressionScope);
|
|
8371
8494
|
this.prodParam.enter(0);
|
|
8372
8495
|
node.value = this.eat(25) ? this.parseMaybeAssignAllowIn() : null;
|
|
8373
8496
|
this.expressionScope.exit();
|
|
@@ -8377,6 +8500,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8377
8500
|
parseClassId(node, isStatement, optionalId, bindingType = 8331) {
|
|
8378
8501
|
if (tokenIsIdentifier(this.state.type)) {
|
|
8379
8502
|
node.id = this.parseIdentifier();
|
|
8503
|
+
this.checkStrictBindReservedWord(node.id, bindingType);
|
|
8380
8504
|
if (isStatement) this.declareNameFromIdentifier(node.id, bindingType);
|
|
8381
8505
|
} else if (optionalId || !isStatement) node.id = null;
|
|
8382
8506
|
else throw this.raise(Errors.MissingClassName, this.state.startLoc);
|
|
@@ -8393,7 +8517,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8393
8517
|
const parseAfterDefault = !hasDefault || this.eat(8);
|
|
8394
8518
|
const hasStar = parseAfterDefault && this.eatExportStar(node);
|
|
8395
8519
|
const hasNamespace = hasStar && this.maybeParseExportNamespaceSpecifier(node);
|
|
8396
|
-
const parseAfterNamespace = parseAfterDefault &&
|
|
8520
|
+
const parseAfterNamespace = parseAfterDefault && !hasNamespace;
|
|
8397
8521
|
const isFromRequired = hasDefault || hasStar;
|
|
8398
8522
|
if (hasStar && !hasNamespace) {
|
|
8399
8523
|
if (hasDefault) this.unexpected();
|
|
@@ -8402,9 +8526,8 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8402
8526
|
this.sawUnambiguousESM = true;
|
|
8403
8527
|
return this.finishNode(node, "ExportAllDeclaration");
|
|
8404
8528
|
}
|
|
8405
|
-
const hasSpecifiers = this.maybeParseExportNamedSpecifiers(node);
|
|
8529
|
+
const hasSpecifiers = parseAfterNamespace && this.maybeParseExportNamedSpecifiers(node);
|
|
8406
8530
|
if (hasDefault && parseAfterDefault && !hasStar && !hasSpecifiers) this.unexpected(null, 2);
|
|
8407
|
-
if (hasNamespace && parseAfterNamespace) this.unexpected(null, 94);
|
|
8408
8531
|
let hasDeclaration;
|
|
8409
8532
|
if (isFromRequired || hasSpecifiers) {
|
|
8410
8533
|
hasDeclaration = false;
|
|
@@ -8449,7 +8572,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8449
8572
|
return false;
|
|
8450
8573
|
}
|
|
8451
8574
|
maybeParseExportNamespaceSpecifier(node) {
|
|
8452
|
-
if (this.isContextual(
|
|
8575
|
+
if (this.isContextual(90)) {
|
|
8453
8576
|
node.specifiers ??= [];
|
|
8454
8577
|
const specifier = this.startNodeAt(this.state.lastTokStartLoc);
|
|
8455
8578
|
this.next();
|
|
@@ -8483,7 +8606,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8483
8606
|
return false;
|
|
8484
8607
|
}
|
|
8485
8608
|
isAsyncFunction() {
|
|
8486
|
-
if (!this.isContextual(
|
|
8609
|
+
if (!this.isContextual(92)) return false;
|
|
8487
8610
|
const next = this.nextTokenInLineStart();
|
|
8488
8611
|
return this.isUnparsedContextual(next, "function");
|
|
8489
8612
|
}
|
|
@@ -8499,20 +8622,21 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8499
8622
|
}
|
|
8500
8623
|
if (this.match(76)) return this.parseClass(expr, true, true);
|
|
8501
8624
|
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);
|
|
8625
|
+
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
8626
|
const res = this.parseMaybeAssignAllowIn();
|
|
8504
8627
|
this.semicolon();
|
|
8505
8628
|
return res;
|
|
8506
8629
|
}
|
|
8507
8630
|
parseExportDeclaration(node) {
|
|
8508
8631
|
if (this.match(76)) return this.parseClass(this.startNode(), true, false);
|
|
8632
|
+
if (this.isContextual(97)) return this.parseVarStatement(this.startNode(), "let");
|
|
8509
8633
|
return this.parseStatementListItem();
|
|
8510
8634
|
}
|
|
8511
8635
|
isExportDefaultSpecifier() {
|
|
8512
8636
|
const { type } = this.state;
|
|
8513
8637
|
if (tokenIsIdentifier(type)) {
|
|
8514
|
-
if (type ===
|
|
8515
|
-
if ((type ===
|
|
8638
|
+
if (type === 92 && !this.state.containsEsc || type === 97) return false;
|
|
8639
|
+
if ((type === 127 || type === 126) && !this.state.containsEsc) {
|
|
8516
8640
|
const next = this.nextTokenStart();
|
|
8517
8641
|
const nextChar = this.input.charCodeAt(next);
|
|
8518
8642
|
if (nextChar === 123 || this.chStartsBindingIdentifier(nextChar, next) && !this.input.startsWith("from", next)) {
|
|
@@ -8525,16 +8649,16 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8525
8649
|
const hasFrom = this.isUnparsedContextual(next, "from");
|
|
8526
8650
|
if (this.input.charCodeAt(next) === 44 || tokenIsIdentifier(this.state.type) && hasFrom) return true;
|
|
8527
8651
|
if (this.match(61) && hasFrom) {
|
|
8528
|
-
const nextAfterFrom = this.input.charCodeAt(this.nextTokenStartSince(next + 4));
|
|
8652
|
+
const nextAfterFrom = this.input.charCodeAt(this.hasPlugin("exportDefaultFrom") ? this.nextTokenStartSince(next + 4) : this.nextTokenInLineStartSince(next + 4));
|
|
8529
8653
|
return nextAfterFrom === 34 || nextAfterFrom === 39;
|
|
8530
8654
|
}
|
|
8531
8655
|
return false;
|
|
8532
8656
|
}
|
|
8533
8657
|
parseExportFrom(node, expect) {
|
|
8534
|
-
if (this.eatContextual(
|
|
8658
|
+
if (this.eatContextual(95)) {
|
|
8535
8659
|
node.source = this.parseImportSource();
|
|
8536
8660
|
this.maybeParseImportAttributes(node);
|
|
8537
|
-
} else if (expect) this.unexpected();
|
|
8661
|
+
} else if (expect) this.unexpected(null, 95);
|
|
8538
8662
|
this.semicolon();
|
|
8539
8663
|
}
|
|
8540
8664
|
shouldParseExportDeclaration() {
|
|
@@ -8605,8 +8729,8 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8605
8729
|
this.expect(8);
|
|
8606
8730
|
if (this.eat(4)) break;
|
|
8607
8731
|
}
|
|
8608
|
-
const isMaybeTypeOnly = this.isContextual(
|
|
8609
|
-
const isString = this.match(
|
|
8732
|
+
const isMaybeTypeOnly = this.isContextual(127);
|
|
8733
|
+
const isString = this.match(131);
|
|
8610
8734
|
const node = this.startNode();
|
|
8611
8735
|
node.local = this.parseModuleExportName();
|
|
8612
8736
|
nodes.push(this.parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly));
|
|
@@ -8614,13 +8738,13 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8614
8738
|
return nodes;
|
|
8615
8739
|
}
|
|
8616
8740
|
parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly) {
|
|
8617
|
-
if (this.eatContextual(
|
|
8741
|
+
if (this.eatContextual(90)) node.exported = this.parseModuleExportName();
|
|
8618
8742
|
else if (isString) node.exported = this.cloneStringLiteral(node.local);
|
|
8619
8743
|
else if (!node.exported) node.exported = this.cloneIdentifier(node.local);
|
|
8620
8744
|
return this.finishNode(node, "ExportSpecifier");
|
|
8621
8745
|
}
|
|
8622
8746
|
parseModuleExportName() {
|
|
8623
|
-
if (this.match(
|
|
8747
|
+
if (this.match(131)) {
|
|
8624
8748
|
const result = this.parseStringLiteral(this.state.value);
|
|
8625
8749
|
const surrogate = loneSurrogate.exec(result.value);
|
|
8626
8750
|
if (surrogate) this.raise(Errors.ModuleExportNameHasLoneSurrogate, result, { surrogateCharCode: surrogate[0].charCodeAt(0) });
|
|
@@ -8629,17 +8753,18 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8629
8753
|
return this.parseIdentifier(true);
|
|
8630
8754
|
}
|
|
8631
8755
|
checkImportPhase(node) {
|
|
8756
|
+
if (node.phase == null) return;
|
|
8632
8757
|
const { specifiers } = node;
|
|
8633
8758
|
const singleBindingType = specifiers.length === 1 ? specifiers[0].type : null;
|
|
8634
8759
|
if (node.phase === "source") {
|
|
8635
|
-
if (singleBindingType !== "ImportDefaultSpecifier") this.raise(Errors.SourcePhaseImportRequiresDefault,
|
|
8760
|
+
if (singleBindingType !== "ImportDefaultSpecifier") this.raise(Errors.SourcePhaseImportRequiresDefault, node);
|
|
8636
8761
|
} else if (node.phase === "defer") {
|
|
8637
|
-
if (singleBindingType !== "ImportNamespaceSpecifier") this.raise(Errors.DeferImportRequiresNamespace,
|
|
8762
|
+
if (singleBindingType !== "ImportNamespaceSpecifier") this.raise(Errors.DeferImportRequiresNamespace, node);
|
|
8638
8763
|
}
|
|
8639
8764
|
}
|
|
8640
8765
|
isPotentialImportPhase(isExport) {
|
|
8641
8766
|
if (isExport) return false;
|
|
8642
|
-
return this.isContextual(
|
|
8767
|
+
return this.isContextual(102) || this.isContextual(94);
|
|
8643
8768
|
}
|
|
8644
8769
|
applyImportPhase(node, isExport, phase, loc) {
|
|
8645
8770
|
if (isExport) return;
|
|
@@ -8649,7 +8774,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8649
8774
|
} else if (phase === "defer") {
|
|
8650
8775
|
this.expectPlugin("deferredImportEvaluation", loc);
|
|
8651
8776
|
node.phase = "defer";
|
|
8652
|
-
} else if (this.hasPlugin("sourcePhaseImports")) node.phase = null;
|
|
8777
|
+
} else if (this.hasPlugin("sourcePhaseImports") || this.hasPlugin("deferredImportEvaluation")) node.phase = null;
|
|
8653
8778
|
}
|
|
8654
8779
|
parseMaybeImportPhase(node, isExport) {
|
|
8655
8780
|
if (!this.isPotentialImportPhase(isExport)) {
|
|
@@ -8659,7 +8784,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8659
8784
|
const phaseIdentifier = this.startNode();
|
|
8660
8785
|
const phaseIdentifierName = this.parseIdentifierName(true);
|
|
8661
8786
|
const { type } = this.state;
|
|
8662
|
-
if (tokenIsKeywordOrIdentifier(type) ? type !==
|
|
8787
|
+
if (tokenIsKeywordOrIdentifier(type) ? type !== 95 || this.lookaheadCharCode() === 102 : type !== 8) {
|
|
8663
8788
|
this.applyImportPhase(node, isExport, phaseIdentifierName, phaseIdentifier.start);
|
|
8664
8789
|
return null;
|
|
8665
8790
|
} else {
|
|
@@ -8669,10 +8794,10 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8669
8794
|
}
|
|
8670
8795
|
isPrecedingIdImportPhase(phase) {
|
|
8671
8796
|
const { type } = this.state;
|
|
8672
|
-
return tokenIsIdentifier(type) ? type !==
|
|
8797
|
+
return tokenIsIdentifier(type) ? type !== 95 || this.lookaheadCharCode() === 102 : type !== 8;
|
|
8673
8798
|
}
|
|
8674
8799
|
parseImport(node) {
|
|
8675
|
-
if (this.match(
|
|
8800
|
+
if (this.match(131)) return this.parseImportSourceAndAttributes(node);
|
|
8676
8801
|
return this.parseImportSpecifiersAndAfter(node, this.parseMaybeImportPhase(node, false));
|
|
8677
8802
|
}
|
|
8678
8803
|
parseImportSpecifiersAndAfter(node, maybeDefaultIdentifier) {
|
|
@@ -8680,7 +8805,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8680
8805
|
const parseNext = !this.maybeParseDefaultImportSpecifier(node, maybeDefaultIdentifier) || this.eat(8);
|
|
8681
8806
|
const hasStar = parseNext && this.maybeParseStarImportSpecifier(node);
|
|
8682
8807
|
if (parseNext && !hasStar) this.parseNamedImportSpecifiers(node);
|
|
8683
|
-
this.expectContextual(
|
|
8808
|
+
this.expectContextual(95);
|
|
8684
8809
|
return this.parseImportSourceAndAttributes(node);
|
|
8685
8810
|
}
|
|
8686
8811
|
parseImportSourceAndAttributes(node) {
|
|
@@ -8693,7 +8818,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8693
8818
|
return this.finishNode(node, "ImportDeclaration");
|
|
8694
8819
|
}
|
|
8695
8820
|
parseImportSource() {
|
|
8696
|
-
if (!this.match(
|
|
8821
|
+
if (!this.match(131)) this.unexpected();
|
|
8697
8822
|
return this.parseExprAtom();
|
|
8698
8823
|
}
|
|
8699
8824
|
parseImportSpecifierLocal(node, specifier, type) {
|
|
@@ -8714,10 +8839,10 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8714
8839
|
const keyName = this.state.value;
|
|
8715
8840
|
if (attrNames.has(keyName)) this.raise(Errors.ModuleAttributesWithDuplicateKeys, this.state.startLoc, { key: keyName });
|
|
8716
8841
|
attrNames.add(keyName);
|
|
8717
|
-
if (this.match(
|
|
8842
|
+
if (this.match(131)) node.key = this.parseStringLiteral(keyName);
|
|
8718
8843
|
else node.key = this.parseIdentifier(true);
|
|
8719
8844
|
this.expect(10);
|
|
8720
|
-
if (!this.match(
|
|
8845
|
+
if (!this.match(131)) throw this.raise(Errors.ModuleAttributeInvalidValue, this.state.startLoc);
|
|
8721
8846
|
node.value = this.parseStringLiteral(this.state.value);
|
|
8722
8847
|
attrs.push(this.finishNode(node, "ImportAttribute"));
|
|
8723
8848
|
} while (this.eat(8));
|
|
@@ -8749,7 +8874,7 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8749
8874
|
if (this.match(51)) {
|
|
8750
8875
|
const specifier = this.startNode();
|
|
8751
8876
|
this.next();
|
|
8752
|
-
this.expectContextual(
|
|
8877
|
+
this.expectContextual(90);
|
|
8753
8878
|
this.parseImportSpecifierLocal(node, specifier, "ImportNamespaceSpecifier");
|
|
8754
8879
|
return true;
|
|
8755
8880
|
}
|
|
@@ -8766,15 +8891,15 @@ var StatementParser = class extends ExpressionParser {
|
|
|
8766
8891
|
if (this.eat(4)) break;
|
|
8767
8892
|
}
|
|
8768
8893
|
const specifier = this.startNode();
|
|
8769
|
-
const importedIsString = this.match(
|
|
8770
|
-
const isMaybeTypeOnly = this.isContextual(
|
|
8894
|
+
const importedIsString = this.match(131);
|
|
8895
|
+
const isMaybeTypeOnly = this.isContextual(127);
|
|
8771
8896
|
specifier.imported = this.parseModuleExportName();
|
|
8772
8897
|
const importSpecifier = this.parseImportSpecifier(specifier, importedIsString, node.importKind === "type" || node.importKind === "typeof", isMaybeTypeOnly, void 0);
|
|
8773
8898
|
node.specifiers.push(importSpecifier);
|
|
8774
8899
|
}
|
|
8775
8900
|
}
|
|
8776
8901
|
parseImportSpecifier(specifier, importedIsString, isInTypeOnlyImport, isMaybeTypeOnly, bindingType) {
|
|
8777
|
-
if (this.eatContextual(
|
|
8902
|
+
if (this.eatContextual(90)) specifier.local = this.parseIdentifier();
|
|
8778
8903
|
else {
|
|
8779
8904
|
const { imported } = specifier;
|
|
8780
8905
|
if (importedIsString) throw this.raise(Errors.ImportBindingIsString, specifier, { importName: imported.value });
|
|
@@ -8903,6 +9028,15 @@ function tsIsEntityName(node) {
|
|
|
8903
9028
|
default: return false;
|
|
8904
9029
|
}
|
|
8905
9030
|
}
|
|
9031
|
+
function tsIsTypeCast(node) {
|
|
9032
|
+
switch (node.type) {
|
|
9033
|
+
case "TSAsExpression":
|
|
9034
|
+
case "TSSatisfiesExpression":
|
|
9035
|
+
case "TSNonNullExpression":
|
|
9036
|
+
case "TSTypeAssertion": return true;
|
|
9037
|
+
default: return false;
|
|
9038
|
+
}
|
|
9039
|
+
}
|
|
8906
9040
|
const ClassMemberModifiers = buildModifiersMap([
|
|
8907
9041
|
"declare",
|
|
8908
9042
|
"private",
|
|
@@ -8942,7 +9076,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
8942
9076
|
return tokenIsIdentifier(this.state.type);
|
|
8943
9077
|
}
|
|
8944
9078
|
tsTokenCanFollowModifier() {
|
|
8945
|
-
return this.match(0) || this.match(2) || this.match(51) || this.match(17) || this.match(
|
|
9079
|
+
return this.match(0) || this.match(2) || this.match(51) || this.match(17) || this.match(135) || this.isLiteralPropertyName();
|
|
8946
9080
|
}
|
|
8947
9081
|
tsNextTokenOnSameLineAndCanFollowModifier() {
|
|
8948
9082
|
this.next();
|
|
@@ -8950,7 +9084,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
8950
9084
|
return this.tsTokenCanFollowModifier();
|
|
8951
9085
|
}
|
|
8952
9086
|
tsNextTokenCanFollowModifier() {
|
|
8953
|
-
if (this.match(
|
|
9087
|
+
if (this.match(103)) {
|
|
8954
9088
|
this.next();
|
|
8955
9089
|
return this.tsTokenCanFollowModifier();
|
|
8956
9090
|
}
|
|
@@ -8960,9 +9094,15 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
8960
9094
|
if (!tokenIsIdentifier(this.state.type) && this.state.type !== 54 && this.state.type !== 71) return;
|
|
8961
9095
|
const modifier = this.state.value;
|
|
8962
9096
|
if (modifiers.has(modifier)) {
|
|
8963
|
-
if (hasSeenStaticModifier && this.match(
|
|
9097
|
+
if (hasSeenStaticModifier && this.match(103)) return;
|
|
8964
9098
|
if (stopOnStartOfClassStaticBlock && this.tsIsStartOfStaticBlocks()) return;
|
|
8965
|
-
|
|
9099
|
+
const escapedKeywordLoc = this.state.containsEsc && !tokenIsIdentifier(this.state.type) ? this.state.startLoc : null;
|
|
9100
|
+
if (escapedKeywordLoc) this.state.containsEsc = false;
|
|
9101
|
+
if (this.tsTryParse(this.tsNextTokenCanFollowModifier.bind(this))) {
|
|
9102
|
+
if (escapedKeywordLoc) this.raise(Errors.InvalidEscapedReservedWord, escapedKeywordLoc, { reservedWord: modifier });
|
|
9103
|
+
return modifier;
|
|
9104
|
+
}
|
|
9105
|
+
if (escapedKeywordLoc) this.state.containsEsc = true;
|
|
8966
9106
|
}
|
|
8967
9107
|
}
|
|
8968
9108
|
tsParseModifiers(modifiers, errorTemplate = TSErrors.InvalidModifierOnTypeMember, modified, stopOnStartOfClassStaticBlock = false) {
|
|
@@ -9054,7 +9194,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9054
9194
|
const node = this.startNode();
|
|
9055
9195
|
this.expect(79);
|
|
9056
9196
|
this.expect(6);
|
|
9057
|
-
if (!this.match(
|
|
9197
|
+
if (!this.match(131)) {
|
|
9058
9198
|
this.raise(TSErrors.UnsupportedImportTypeArgument, this.state.startLoc);
|
|
9059
9199
|
node.source = this.tsParseNonConditionalType();
|
|
9060
9200
|
} else node.source = this.parseStringLiteral(this.state.value);
|
|
@@ -9088,7 +9228,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9088
9228
|
this.expect(2);
|
|
9089
9229
|
while (!this.match(4)) {
|
|
9090
9230
|
const type = this.state.type;
|
|
9091
|
-
if (tokenIsIdentifier(type) || type ===
|
|
9231
|
+
if (tokenIsIdentifier(type) || type === 131) properties.push(super.parsePropertyDefinition(null));
|
|
9092
9232
|
else this.unexpected();
|
|
9093
9233
|
this.eat(8);
|
|
9094
9234
|
}
|
|
@@ -9178,7 +9318,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9178
9318
|
}
|
|
9179
9319
|
tsParseTypeParameters(parseModifiers) {
|
|
9180
9320
|
const node = this.startNode();
|
|
9181
|
-
if (this.match(43) || this.match(
|
|
9321
|
+
if (this.match(43) || this.match(139)) this.next();
|
|
9182
9322
|
else this.unexpected();
|
|
9183
9323
|
const refTrailingCommaPos = { value: -1 };
|
|
9184
9324
|
node.params = this.tsParseBracketedList("TypeParametersOrArguments", this.tsParseTypeParameter.bind(this, parseModifiers), false, true, refTrailingCommaPos);
|
|
@@ -9302,8 +9442,8 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9302
9442
|
}
|
|
9303
9443
|
tsIsStartOfMappedType() {
|
|
9304
9444
|
this.next();
|
|
9305
|
-
if (this.eat(49)) return this.isContextual(
|
|
9306
|
-
if (this.isContextual(
|
|
9445
|
+
if (this.eat(49)) return this.isContextual(119);
|
|
9446
|
+
if (this.isContextual(119)) this.next();
|
|
9307
9447
|
if (!this.match(0)) return false;
|
|
9308
9448
|
this.next();
|
|
9309
9449
|
if (!this.tsIsIdentifier()) return false;
|
|
@@ -9316,12 +9456,12 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9316
9456
|
if (this.match(49)) {
|
|
9317
9457
|
node.readonly = this.state.value;
|
|
9318
9458
|
this.next();
|
|
9319
|
-
this.expectContextual(
|
|
9320
|
-
} else if (this.eatContextual(
|
|
9459
|
+
this.expectContextual(119);
|
|
9460
|
+
} else if (this.eatContextual(119)) node.readonly = true;
|
|
9321
9461
|
this.expect(0);
|
|
9322
9462
|
node.key = this.tsParseTypeParameterName();
|
|
9323
9463
|
node.constraint = this.tsExpectThenParseType(54);
|
|
9324
|
-
node.nameType = this.eatContextual(
|
|
9464
|
+
node.nameType = this.eatContextual(90) ? this.tsParseType() : null;
|
|
9325
9465
|
this.expect(1);
|
|
9326
9466
|
if (this.match(49)) {
|
|
9327
9467
|
node.optional = this.state.value;
|
|
@@ -9430,9 +9570,9 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9430
9570
|
tsParseLiteralTypeNode() {
|
|
9431
9571
|
const node = this.startNode();
|
|
9432
9572
|
switch (this.state.type) {
|
|
9433
|
-
case 131:
|
|
9434
9573
|
case 132:
|
|
9435
|
-
case
|
|
9574
|
+
case 133:
|
|
9575
|
+
case 131:
|
|
9436
9576
|
case 81:
|
|
9437
9577
|
case 82:
|
|
9438
9578
|
node.literal = super.parseExprAtom();
|
|
@@ -9471,21 +9611,21 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9471
9611
|
}
|
|
9472
9612
|
tsParseThisTypeOrThisTypePredicate() {
|
|
9473
9613
|
const thisKeyword = this.tsParseThisTypeNode();
|
|
9474
|
-
if (this.isContextual(
|
|
9614
|
+
if (this.isContextual(113) && !this.hasPrecedingLineBreak()) return this.tsParseThisTypePredicate(thisKeyword);
|
|
9475
9615
|
else return thisKeyword;
|
|
9476
9616
|
}
|
|
9477
9617
|
tsParseNonArrayType() {
|
|
9478
9618
|
switch (this.state.type) {
|
|
9479
|
-
case 130:
|
|
9480
9619
|
case 131:
|
|
9481
9620
|
case 132:
|
|
9621
|
+
case 133:
|
|
9482
9622
|
case 81:
|
|
9483
9623
|
case 82: return this.tsParseLiteralTypeNode();
|
|
9484
9624
|
case 49:
|
|
9485
9625
|
if (this.state.value === "-") {
|
|
9486
9626
|
const node = this.startNode();
|
|
9487
9627
|
const nextToken = this.lookahead();
|
|
9488
|
-
if (nextToken.type !==
|
|
9628
|
+
if (nextToken.type !== 132 && nextToken.type !== 133) this.unexpected();
|
|
9489
9629
|
node.literal = this.parseMaybeUnary();
|
|
9490
9630
|
return this.finishNode(node, "TSLiteralType");
|
|
9491
9631
|
}
|
|
@@ -9558,7 +9698,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9558
9698
|
}
|
|
9559
9699
|
tsParseInferType() {
|
|
9560
9700
|
const node = this.startNode();
|
|
9561
|
-
this.expectContextual(
|
|
9701
|
+
this.expectContextual(112);
|
|
9562
9702
|
const typeParameter = this.startNode();
|
|
9563
9703
|
typeParameter.name = this.tsParseTypeParameterName();
|
|
9564
9704
|
typeParameter.constraint = this.tsTryParse(() => this.tsParseConstraintForInferType());
|
|
@@ -9572,7 +9712,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9572
9712
|
}
|
|
9573
9713
|
}
|
|
9574
9714
|
tsParseTypeOperatorOrHigher() {
|
|
9575
|
-
return tokenIsTSTypeOperator(this.state.type) && !this.state.containsEsc ? this.tsParseTypeOperator() : this.isContextual(
|
|
9715
|
+
return tokenIsTSTypeOperator(this.state.type) && !this.state.containsEsc ? this.tsParseTypeOperator() : this.isContextual(112) ? this.tsParseInferType() : this.tsInAllowConditionalTypesContext(() => this.tsParseArrayTypeOrHigher());
|
|
9576
9716
|
}
|
|
9577
9717
|
tsParseUnionOrIntersectionType(kind, parseConstituentType, operator) {
|
|
9578
9718
|
const node = this.startNode();
|
|
@@ -9600,24 +9740,18 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9600
9740
|
this.next();
|
|
9601
9741
|
return true;
|
|
9602
9742
|
}
|
|
9603
|
-
|
|
9743
|
+
const isObjectPattern = this.match(2);
|
|
9744
|
+
if (isObjectPattern || this.match(0)) {
|
|
9745
|
+
if (!isObjectPattern) this.next();
|
|
9604
9746
|
const { errors } = this.state;
|
|
9605
9747
|
const previousErrorCount = errors.length;
|
|
9748
|
+
const scopeStacksSnapshot = this.snapshotScopeStacks();
|
|
9606
9749
|
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);
|
|
9750
|
+
if (isObjectPattern) this.parseObjectLike(4, true);
|
|
9751
|
+
else super.parseBindingList(1, 93, 1);
|
|
9619
9752
|
return errors.length === previousErrorCount;
|
|
9620
9753
|
} catch {
|
|
9754
|
+
this.restoreScopeStacks(scopeStacksSnapshot);
|
|
9621
9755
|
return false;
|
|
9622
9756
|
}
|
|
9623
9757
|
}
|
|
@@ -9683,13 +9817,13 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9683
9817
|
}
|
|
9684
9818
|
tsParseTypePredicatePrefix() {
|
|
9685
9819
|
const id = this.parseIdentifier();
|
|
9686
|
-
if (this.isContextual(
|
|
9820
|
+
if (this.isContextual(113) && !this.hasPrecedingLineBreak()) {
|
|
9687
9821
|
this.next();
|
|
9688
9822
|
return id;
|
|
9689
9823
|
}
|
|
9690
9824
|
}
|
|
9691
9825
|
tsParseTypePredicateAsserts() {
|
|
9692
|
-
if (this.state.type !==
|
|
9826
|
+
if (this.state.type !== 106) return false;
|
|
9693
9827
|
const containsEsc = this.state.containsEsc;
|
|
9694
9828
|
this.next();
|
|
9695
9829
|
if (!tokenIsIdentifier(this.state.type) && !this.match(74)) return false;
|
|
@@ -9717,7 +9851,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9717
9851
|
return this.finishNode(node, "TSConditionalType");
|
|
9718
9852
|
}
|
|
9719
9853
|
isAbstractConstructorSignature() {
|
|
9720
|
-
return this.isContextual(
|
|
9854
|
+
return this.isContextual(121) && this.isLookaheadContextual("new");
|
|
9721
9855
|
}
|
|
9722
9856
|
tsParseNonConditionalType() {
|
|
9723
9857
|
if (this.tsIsStartOfFunctionType()) return this.tsParseFunctionOrConstructorType("TSFunctionType");
|
|
@@ -9733,6 +9867,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9733
9867
|
return this.match(71) ? this.tsParseTypeReference() : this.tsParseType();
|
|
9734
9868
|
});
|
|
9735
9869
|
this.expect(44);
|
|
9870
|
+
this.state.canStartArrow = false;
|
|
9736
9871
|
node.expression = this.parseMaybeUnary();
|
|
9737
9872
|
return this.finishNode(node, "TSTypeAssertion");
|
|
9738
9873
|
}
|
|
@@ -9756,7 +9891,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9756
9891
|
}
|
|
9757
9892
|
tsParseInterfaceDeclaration(node, properties = {}) {
|
|
9758
9893
|
if (this.hasFollowingLineBreak()) return null;
|
|
9759
|
-
this.expectContextual(
|
|
9894
|
+
this.expectContextual(126);
|
|
9760
9895
|
if (properties.declare) node.declare = true;
|
|
9761
9896
|
if (tokenIsIdentifier(this.state.type)) {
|
|
9762
9897
|
node.id = this.parseIdentifier();
|
|
@@ -9778,7 +9913,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9778
9913
|
node.typeAnnotation = this.tsInType(() => {
|
|
9779
9914
|
node.typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutModifiers);
|
|
9780
9915
|
this.expect(25);
|
|
9781
|
-
if (this.isContextual(
|
|
9916
|
+
if (this.isContextual(111) && this.lookaheadCharCode() !== 46) {
|
|
9782
9917
|
const node = this.startNode();
|
|
9783
9918
|
this.next();
|
|
9784
9919
|
return this.finishNode(node, "TSIntrinsicKeyword");
|
|
@@ -9843,14 +9978,14 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9843
9978
|
}
|
|
9844
9979
|
tsParseEnumMember() {
|
|
9845
9980
|
const node = this.startNode();
|
|
9846
|
-
node.id = this.match(
|
|
9981
|
+
node.id = this.match(131) ? super.parseStringLiteral(this.state.value) : this.parseIdentifier(true);
|
|
9847
9982
|
if (this.eat(25)) node.initializer = super.parseMaybeAssignAllowIn();
|
|
9848
9983
|
return this.finishNode(node, "TSEnumMember");
|
|
9849
9984
|
}
|
|
9850
9985
|
tsParseEnumDeclaration(node, properties = {}) {
|
|
9851
9986
|
if (properties.const) node.const = true;
|
|
9852
9987
|
if (properties.declare) node.declare = true;
|
|
9853
|
-
this.expectContextual(
|
|
9988
|
+
this.expectContextual(123);
|
|
9854
9989
|
node.id = this.parseIdentifier();
|
|
9855
9990
|
this.checkIdentifier(node.id, node.const ? 8971 : 8459);
|
|
9856
9991
|
node.body = this.tsParseEnumBody();
|
|
@@ -9882,14 +10017,14 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9882
10017
|
return this.finishNode(node, "TSModuleDeclaration");
|
|
9883
10018
|
}
|
|
9884
10019
|
tsParseAmbientExternalModuleDeclaration(node) {
|
|
9885
|
-
const isGlobal = this.isContextual(
|
|
10020
|
+
const isGlobal = this.isContextual(109);
|
|
9886
10021
|
if (isGlobal) {
|
|
9887
10022
|
node.kind = "global";
|
|
9888
10023
|
node.id = this.parseIdentifier();
|
|
9889
10024
|
} else {
|
|
9890
10025
|
node.kind = "module";
|
|
9891
10026
|
const { type, value } = this.state;
|
|
9892
|
-
if (type ===
|
|
10027
|
+
if (type === 131) node.id = super.parseStringLiteral(value);
|
|
9893
10028
|
else if (tokenIsIdentifier(type)) {
|
|
9894
10029
|
this.raise(TSErrors.InlineModuleDeclarationMustUseString, this.state.startLoc);
|
|
9895
10030
|
node.id = this.tsParseEntityName(0);
|
|
@@ -9919,16 +10054,16 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9919
10054
|
return this.finishNode(node, "TSImportEqualsDeclaration");
|
|
9920
10055
|
}
|
|
9921
10056
|
tsIsExternalModuleReference() {
|
|
9922
|
-
return this.isContextual(
|
|
10057
|
+
return this.isContextual(116) && this.lookaheadCharCode() === 40;
|
|
9923
10058
|
}
|
|
9924
10059
|
tsParseModuleReference() {
|
|
9925
10060
|
return this.tsIsExternalModuleReference() ? this.tsParseExternalModuleReference() : this.tsParseEntityName(0);
|
|
9926
10061
|
}
|
|
9927
10062
|
tsParseExternalModuleReference() {
|
|
9928
10063
|
const node = this.startNode();
|
|
9929
|
-
this.expectContextual(
|
|
10064
|
+
this.expectContextual(116);
|
|
9930
10065
|
this.expect(6);
|
|
9931
|
-
if (!this.match(
|
|
10066
|
+
if (!this.match(131)) this.unexpected();
|
|
9932
10067
|
node.expression = super.parseExprAtom();
|
|
9933
10068
|
this.expect(7);
|
|
9934
10069
|
this.sawUnambiguousESM = true;
|
|
@@ -9959,13 +10094,13 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9959
10094
|
switch (startType) {
|
|
9960
10095
|
case 64:
|
|
9961
10096
|
node.declare = true;
|
|
9962
|
-
return super.parseFunctionStatement(node, false,
|
|
10097
|
+
return super.parseFunctionStatement(node, false, 2);
|
|
9963
10098
|
case 76:
|
|
9964
10099
|
node.declare = true;
|
|
9965
10100
|
return this.parseClass(node, true, false);
|
|
9966
|
-
case
|
|
9967
|
-
case
|
|
9968
|
-
case
|
|
10101
|
+
case 123: return this.tsParseEnumDeclaration(node, { declare: true });
|
|
10102
|
+
case 109: return this.tsParseAmbientExternalModuleDeclaration(node);
|
|
10103
|
+
case 97: if (this.state.containsEsc) return;
|
|
9969
10104
|
case 71:
|
|
9970
10105
|
case 70:
|
|
9971
10106
|
if (!this.match(71) || !this.isLookaheadContextual("enum")) {
|
|
@@ -9977,14 +10112,14 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9977
10112
|
const: true,
|
|
9978
10113
|
declare: true
|
|
9979
10114
|
});
|
|
9980
|
-
case
|
|
10115
|
+
case 104:
|
|
9981
10116
|
if (this.isUsing()) {
|
|
9982
10117
|
this.raise(TSErrors.InvalidModifierOnUsingDeclaration, this.state.startLoc, "declare");
|
|
9983
10118
|
node.declare = true;
|
|
9984
10119
|
return this.parseVarStatement(node, "using", true);
|
|
9985
10120
|
}
|
|
9986
10121
|
break;
|
|
9987
|
-
case
|
|
10122
|
+
case 93:
|
|
9988
10123
|
if (this.isAwaitUsing()) {
|
|
9989
10124
|
this.raise(TSErrors.InvalidModifierOnAwaitUsingDeclaration, this.state.startLoc, "declare");
|
|
9990
10125
|
node.declare = true;
|
|
@@ -9992,7 +10127,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
9992
10127
|
return this.parseVarStatement(node, "await using", true);
|
|
9993
10128
|
}
|
|
9994
10129
|
break;
|
|
9995
|
-
case
|
|
10130
|
+
case 126: {
|
|
9996
10131
|
const result = this.tsParseInterfaceDeclaration(node, { declare: true });
|
|
9997
10132
|
if (result) return result;
|
|
9998
10133
|
}
|
|
@@ -10005,19 +10140,19 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10005
10140
|
}
|
|
10006
10141
|
tsParseDeclaration(node, type, next, decorators) {
|
|
10007
10142
|
switch (type) {
|
|
10008
|
-
case
|
|
10143
|
+
case 121:
|
|
10009
10144
|
if (this.tsCheckLineTerminator(next) && (this.match(76) || tokenIsIdentifier(this.state.type))) return this.tsParseAbstractDeclaration(node, decorators);
|
|
10010
10145
|
break;
|
|
10011
|
-
case
|
|
10146
|
+
case 124:
|
|
10012
10147
|
if (this.tsCheckLineTerminator(next)) return this.tsParseAmbientExternalModuleDeclaration(node);
|
|
10013
10148
|
break;
|
|
10014
|
-
case
|
|
10149
|
+
case 125:
|
|
10015
10150
|
if (this.tsCheckLineTerminator(next) && tokenIsIdentifier(this.state.type)) {
|
|
10016
10151
|
node.kind = "namespace";
|
|
10017
10152
|
return this.tsParseNamespaceDeclaration(node);
|
|
10018
10153
|
}
|
|
10019
10154
|
break;
|
|
10020
|
-
case
|
|
10155
|
+
case 127: if (this.tsCheckLineTerminator(next) && tokenIsIdentifier(this.state.type)) return this.tsParseTypeAliasDeclaration(node);
|
|
10021
10156
|
}
|
|
10022
10157
|
}
|
|
10023
10158
|
tsCheckLineTerminator(next) {
|
|
@@ -10078,7 +10213,6 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10078
10213
|
if (accessibility || readonly || override) {
|
|
10079
10214
|
const pp = startLoc ? this.startNodeAt(startLoc) : this.startNodeAtNode(decorators[0]);
|
|
10080
10215
|
if (decorators.length) pp.decorators = decorators;
|
|
10081
|
-
else this.setLoc(startLoc);
|
|
10082
10216
|
if (accessibility) pp.accessibility = accessibility;
|
|
10083
10217
|
if (readonly) pp.readonly = readonly;
|
|
10084
10218
|
if (override) pp.override = override;
|
|
@@ -10182,7 +10316,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10182
10316
|
return this.finishCallExpression(node, state.optionalChainMember);
|
|
10183
10317
|
}
|
|
10184
10318
|
const tokenType = this.state.type;
|
|
10185
|
-
if (tokenType === 44 || tokenType === 48 || tokenType !== 6 && tokenType !==
|
|
10319
|
+
if (tokenType === 44 || tokenType === 48 || tokenType !== 6 && tokenType !== 90 && tokenType !== 117 && tokenCanStartExpression(tokenType) && !this.hasPrecedingLineBreak()) return;
|
|
10186
10320
|
const node = this.startNodeAt(startLoc);
|
|
10187
10321
|
node.expression = base;
|
|
10188
10322
|
node.typeArguments = typeArguments;
|
|
@@ -10209,7 +10343,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10209
10343
|
}
|
|
10210
10344
|
parseExprOp(left, leftStartLoc, minPrec) {
|
|
10211
10345
|
let isSatisfies;
|
|
10212
|
-
if (tokenOperatorPrecedence(54) > minPrec && !this.hasPrecedingLineBreak() && (this.isContextual(
|
|
10346
|
+
if (tokenOperatorPrecedence(54) > minPrec && !this.hasPrecedingLineBreak() && (this.isContextual(90) || (isSatisfies = this.isContextual(117)))) {
|
|
10213
10347
|
const node = this.startNodeAt(leftStartLoc);
|
|
10214
10348
|
node.expression = left;
|
|
10215
10349
|
node.typeAnnotation = this.tsInType(() => {
|
|
@@ -10232,7 +10366,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10232
10366
|
checkDuplicateExports() {}
|
|
10233
10367
|
isPotentialImportPhase(isExport) {
|
|
10234
10368
|
if (super.isPotentialImportPhase(isExport)) return true;
|
|
10235
|
-
if (this.isContextual(
|
|
10369
|
+
if (this.isContextual(127)) {
|
|
10236
10370
|
const ch = this.lookaheadCharCode();
|
|
10237
10371
|
return isExport ? ch === 123 || ch === 42 : ch !== 61;
|
|
10238
10372
|
}
|
|
@@ -10244,7 +10378,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10244
10378
|
else node.importKind = phase === "type" || phase === "typeof" ? phase : "value";
|
|
10245
10379
|
}
|
|
10246
10380
|
parseImport(node) {
|
|
10247
|
-
if (this.match(
|
|
10381
|
+
if (this.match(131)) {
|
|
10248
10382
|
node.importKind = "value";
|
|
10249
10383
|
if (this.scope.inTSNamespace) this.raise(TSErrors.ImportInTSNamespace, node);
|
|
10250
10384
|
return super.parseImport(node);
|
|
@@ -10255,7 +10389,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10255
10389
|
const result = this.tsParseImportEqualsDeclaration(node);
|
|
10256
10390
|
if (this.scope.inTSNamespace && result.moduleReference.type === "TSExternalModuleReference") this.raise(TSErrors.ImportInTSNamespace, node);
|
|
10257
10391
|
return result;
|
|
10258
|
-
} else if (this.isContextual(
|
|
10392
|
+
} else if (this.isContextual(127)) {
|
|
10259
10393
|
const maybeDefaultIdentifier = this.parseMaybeImportPhase(node, false);
|
|
10260
10394
|
if (this.lookaheadCharCode() === 61) {
|
|
10261
10395
|
if (this.scope.inTSNamespace) this.raise(TSErrors.ImportInTSNamespace, node);
|
|
@@ -10271,7 +10405,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10271
10405
|
const nodeImportEquals = this.startNode();
|
|
10272
10406
|
this.next();
|
|
10273
10407
|
let maybeDefaultIdentifier = null;
|
|
10274
|
-
if (this.isContextual(
|
|
10408
|
+
if (this.isContextual(127) && this.isPotentialImportPhase(false)) maybeDefaultIdentifier = this.parseMaybeImportPhase(nodeImportEquals, false);
|
|
10275
10409
|
else nodeImportEquals.importKind = "value";
|
|
10276
10410
|
const declaration = this.tsParseImportEqualsDeclaration(nodeImportEquals, maybeDefaultIdentifier);
|
|
10277
10411
|
node.attributes = [];
|
|
@@ -10287,9 +10421,9 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10287
10421
|
this.sawUnambiguousESM = true;
|
|
10288
10422
|
if (this.scope.inTSNamespace) this.raise(TSErrors.ExportAssignmentInTSNamespace, assign);
|
|
10289
10423
|
return this.finishNode(assign, "TSExportAssignment");
|
|
10290
|
-
} else if (this.eatContextual(
|
|
10424
|
+
} else if (this.eatContextual(90)) {
|
|
10291
10425
|
const decl = node;
|
|
10292
|
-
this.expectContextual(
|
|
10426
|
+
this.expectContextual(125);
|
|
10293
10427
|
decl.id = this.parseIdentifier();
|
|
10294
10428
|
this.checkIdentifier(decl.id, 8201);
|
|
10295
10429
|
this.semicolon();
|
|
@@ -10302,7 +10436,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10302
10436
|
}
|
|
10303
10437
|
}
|
|
10304
10438
|
isAbstractClass() {
|
|
10305
|
-
return this.isContextual(
|
|
10439
|
+
return this.isContextual(121) && this.isLookaheadContextual("class");
|
|
10306
10440
|
}
|
|
10307
10441
|
parseExportDefaultExpression() {
|
|
10308
10442
|
if (this.isAbstractClass()) {
|
|
@@ -10311,7 +10445,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10311
10445
|
cls.abstract = true;
|
|
10312
10446
|
return this.parseClass(cls, true, true);
|
|
10313
10447
|
}
|
|
10314
|
-
if (this.match(
|
|
10448
|
+
if (this.match(126)) {
|
|
10315
10449
|
const result = this.tsParseInterfaceDeclaration(this.startNode());
|
|
10316
10450
|
if (result) return result;
|
|
10317
10451
|
}
|
|
@@ -10347,31 +10481,31 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10347
10481
|
return this.tsParseEnumDeclaration(node, { const: true });
|
|
10348
10482
|
}
|
|
10349
10483
|
break;
|
|
10350
|
-
case 120:
|
|
10351
10484
|
case 121:
|
|
10485
|
+
case 122:
|
|
10352
10486
|
if (this.nextTokenIsIdentifierAndNotTSRelationalOperatorOnSameLine()) {
|
|
10353
10487
|
const token = this.state.type;
|
|
10354
10488
|
const node = this.startNode();
|
|
10355
10489
|
this.next();
|
|
10356
|
-
const declaration = token ===
|
|
10490
|
+
const declaration = token === 122 ? this.tsTryParseDeclare(node) : this.tsParseAbstractDeclaration(node, decorators);
|
|
10357
10491
|
if (declaration) {
|
|
10358
|
-
if (token ===
|
|
10492
|
+
if (token === 122) declaration.declare = true;
|
|
10359
10493
|
return declaration;
|
|
10360
10494
|
} else {
|
|
10361
|
-
node.expression = this.createIdentifier(this.startNodeAtNode(node), token ===
|
|
10495
|
+
node.expression = this.createIdentifier(this.startNodeAtNode(node), token === 122 ? "declare" : "abstract");
|
|
10362
10496
|
this.semicolon(false);
|
|
10363
10497
|
return this.finishNode(node, "ExpressionStatement");
|
|
10364
10498
|
}
|
|
10365
10499
|
}
|
|
10366
10500
|
break;
|
|
10367
|
-
case
|
|
10368
|
-
case
|
|
10501
|
+
case 123: return this.tsParseEnumDeclaration(this.startNode());
|
|
10502
|
+
case 109:
|
|
10369
10503
|
if (this.lookaheadCharCode() === 123) {
|
|
10370
10504
|
const node = this.startNode();
|
|
10371
10505
|
return this.tsParseAmbientExternalModuleDeclaration(node);
|
|
10372
10506
|
}
|
|
10373
10507
|
break;
|
|
10374
|
-
case
|
|
10508
|
+
case 126: {
|
|
10375
10509
|
const result = this.tsParseInterfaceDeclaration(this.startNode());
|
|
10376
10510
|
if (result) {
|
|
10377
10511
|
if (!allowDeclaration) this.raise(TSErrors.UnexpectedTypeDeclaration, result, "interface");
|
|
@@ -10379,26 +10513,26 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10379
10513
|
}
|
|
10380
10514
|
break;
|
|
10381
10515
|
}
|
|
10382
|
-
case
|
|
10516
|
+
case 124:
|
|
10383
10517
|
if (this.nextTokenIsStringLiteralOnSameLine()) {
|
|
10384
10518
|
const node = this.startNode();
|
|
10385
10519
|
this.next();
|
|
10386
|
-
return this.tsParseDeclaration(node,
|
|
10520
|
+
return this.tsParseDeclaration(node, 124, false, decorators);
|
|
10387
10521
|
} else if (this.nextTokenIsIdentifierOnSameLine()) {
|
|
10388
10522
|
this.raise(TSErrors.InlineModuleDeclarationMustUseString, this.state.startLoc);
|
|
10389
10523
|
const node = this.startNode();
|
|
10390
10524
|
this.next();
|
|
10391
|
-
return this.tsParseDeclaration(node,
|
|
10525
|
+
return this.tsParseDeclaration(node, 125, false, decorators);
|
|
10392
10526
|
}
|
|
10393
10527
|
break;
|
|
10394
|
-
case
|
|
10528
|
+
case 125:
|
|
10395
10529
|
if (this.nextTokenIsIdentifierOnSameLine()) {
|
|
10396
10530
|
const node = this.startNode();
|
|
10397
10531
|
this.next();
|
|
10398
|
-
return this.tsParseDeclaration(node,
|
|
10532
|
+
return this.tsParseDeclaration(node, 125, false, decorators);
|
|
10399
10533
|
}
|
|
10400
10534
|
break;
|
|
10401
|
-
case
|
|
10535
|
+
case 127: if (this.nextTokenIsIdentifierOnSameLine()) {
|
|
10402
10536
|
const node = this.startNode();
|
|
10403
10537
|
if (!allowDeclaration) this.raise(TSErrors.UnexpectedTypeDeclaration, node, "type");
|
|
10404
10538
|
this.next();
|
|
@@ -10417,7 +10551,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10417
10551
|
});
|
|
10418
10552
|
}
|
|
10419
10553
|
tsIsStartOfStaticBlocks() {
|
|
10420
|
-
return this.isContextual(
|
|
10554
|
+
return this.isContextual(103) && this.lookaheadCharCode() === 123;
|
|
10421
10555
|
}
|
|
10422
10556
|
parseClassMember(classBody, member, state) {
|
|
10423
10557
|
this.tsParseModifiers(ClassMemberModifiers, TSErrors.InvalidModifierOnTypeParameterPositions, member, true);
|
|
@@ -10505,10 +10639,10 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10505
10639
|
return node;
|
|
10506
10640
|
}
|
|
10507
10641
|
parseExportDeclaration(node) {
|
|
10508
|
-
if (!this.state.isAmbientContext && this.isContextual(
|
|
10642
|
+
if (!this.state.isAmbientContext && this.isContextual(122)) return this.tsInAmbientContext(() => this.parseExportDeclaration(node));
|
|
10509
10643
|
const startLoc = this.state.startLoc;
|
|
10510
|
-
const isDeclare = this.eatContextual(
|
|
10511
|
-
if (isDeclare && (this.isContextual(
|
|
10644
|
+
const isDeclare = this.eatContextual(122);
|
|
10645
|
+
if (isDeclare && (this.isContextual(122) || !this.shouldParseExportDeclaration())) throw this.raise(TSErrors.ExpectedAmbientAfterExportDeclare, this.state.startLoc);
|
|
10512
10646
|
const declaration = tokenIsIdentifier(this.state.type) && this.tsTryParseExportDeclaration() || super.parseExportDeclaration(node);
|
|
10513
10647
|
if (!declaration) return null;
|
|
10514
10648
|
if (declaration.type === "TSInterfaceDeclaration" || declaration.type === "TSTypeAliasDeclaration" || isDeclare) node.exportKind = "type";
|
|
@@ -10519,7 +10653,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10519
10653
|
return declaration;
|
|
10520
10654
|
}
|
|
10521
10655
|
parseClassId(node, isStatement, optionalId, bindingType) {
|
|
10522
|
-
if ((!isStatement || optionalId) && this.isContextual(
|
|
10656
|
+
if ((!isStatement || optionalId) && this.isContextual(110)) {
|
|
10523
10657
|
node.id = null;
|
|
10524
10658
|
return;
|
|
10525
10659
|
}
|
|
@@ -10590,7 +10724,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10590
10724
|
node.superTypeArguments = superTypeArguments;
|
|
10591
10725
|
} else if (this.match(43) || this.match(47)) node.superTypeArguments = this.tsParseTypeArgumentsInExpression();
|
|
10592
10726
|
}
|
|
10593
|
-
if (this.eatContextual(
|
|
10727
|
+
if (this.eatContextual(110)) node.implements = this.tsParseHeritageClause("implements");
|
|
10594
10728
|
}
|
|
10595
10729
|
parseObjPropValue(prop, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors) {
|
|
10596
10730
|
const typeParameters = this.tsTryParseTypeParameters(this.tsParseConstModifier);
|
|
@@ -10619,7 +10753,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10619
10753
|
let state;
|
|
10620
10754
|
let jsx;
|
|
10621
10755
|
let typeCast;
|
|
10622
|
-
if (this.hasPlugin("jsx") && (this.match(
|
|
10756
|
+
if (this.hasPlugin("jsx") && (this.match(139) || this.match(43))) {
|
|
10623
10757
|
state = this.state.clone();
|
|
10624
10758
|
jsx = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, isParenItem), state);
|
|
10625
10759
|
if (!jsx.error) return jsx.node;
|
|
@@ -10703,44 +10837,27 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10703
10837
|
}
|
|
10704
10838
|
}
|
|
10705
10839
|
toAssignable(node, isLHS = false) {
|
|
10840
|
+
if (tsIsTypeCast(node)) {
|
|
10841
|
+
if (isLHS) this.expressionScope.recordArrowParameterBindingError(TSErrors.UnexpectedTypeCastInParameter, node);
|
|
10842
|
+
else this.raiseOnce(TSErrors.UnexpectedTypeCastInParameter, node);
|
|
10843
|
+
this.toAssignable(node.expression, isLHS);
|
|
10844
|
+
return;
|
|
10845
|
+
}
|
|
10706
10846
|
switch (node.type) {
|
|
10707
10847
|
case "ParenthesizedExpression":
|
|
10708
10848
|
this.toAssignableParenthesizedExpression(node, isLHS);
|
|
10709
10849
|
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
10850
|
case "AssignmentExpression": if (!isLHS && node.left.type === "TSTypeCastExpression") node.left = this.typeCastToParameter(node.left);
|
|
10719
10851
|
default: super.toAssignable(node, isLHS);
|
|
10720
10852
|
}
|
|
10721
10853
|
}
|
|
10722
10854
|
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
|
-
}
|
|
10855
|
+
if (tsIsTypeCast(node.expression) || node.expression.type === "ParenthesizedExpression") this.toAssignable(node.expression, isLHS);
|
|
10856
|
+
else super.toAssignable(node, isLHS);
|
|
10733
10857
|
}
|
|
10734
10858
|
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
|
-
}
|
|
10859
|
+
if (tsIsTypeCast(node)) this.checkToRestConversion(node.expression, false);
|
|
10860
|
+
else super.checkToRestConversion(node, allowPattern);
|
|
10744
10861
|
}
|
|
10745
10862
|
isValidLVal(type, disallowCallExpression, isUnparenthesizedInAssign, binding) {
|
|
10746
10863
|
switch (type) {
|
|
@@ -10895,7 +11012,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10895
11012
|
if (this.match(76)) {
|
|
10896
11013
|
node.abstract = true;
|
|
10897
11014
|
return this.maybeTakeDecorators(decorators, this.parseClass(node, true, false));
|
|
10898
|
-
} else if (this.isContextual(
|
|
11015
|
+
} else if (this.isContextual(126)) {
|
|
10899
11016
|
if (!this.hasFollowingLineBreak()) {
|
|
10900
11017
|
node.abstract = true;
|
|
10901
11018
|
this.raise(TSErrors.NonClassMethodPropertyHasAbstractModifier, node);
|
|
@@ -10947,9 +11064,9 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10947
11064
|
parseTypeOnlyImportSpecifier(node, isInTypeOnly) {
|
|
10948
11065
|
let leftOfAs = node.imported;
|
|
10949
11066
|
let hasTypeSpecifier = false;
|
|
10950
|
-
if (this.isContextual(
|
|
11067
|
+
if (this.isContextual(90)) {
|
|
10951
11068
|
const firstAs = this.parseIdentifier();
|
|
10952
|
-
if (this.isContextual(
|
|
11069
|
+
if (this.isContextual(90)) {
|
|
10953
11070
|
const secondAs = this.parseIdentifier();
|
|
10954
11071
|
if (tokenIsKeywordOrIdentifier(this.state.type)) {
|
|
10955
11072
|
hasTypeSpecifier = true;
|
|
@@ -10964,19 +11081,19 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10964
11081
|
} else if (tokenIsKeywordOrIdentifier(this.state.type)) {
|
|
10965
11082
|
hasTypeSpecifier = true;
|
|
10966
11083
|
leftOfAs = this.parseIdentifier(true);
|
|
10967
|
-
if (!this.isContextual(
|
|
11084
|
+
if (!this.isContextual(90)) this.checkReservedWord(leftOfAs.name, leftOfAs.start, true, true);
|
|
10968
11085
|
}
|
|
10969
11086
|
if (hasTypeSpecifier && isInTypeOnly) this.raise(TSErrors.TypeModifierIsUsedInTypeImports, node.imported);
|
|
10970
11087
|
node.imported = leftOfAs;
|
|
10971
11088
|
node.importKind = hasTypeSpecifier ? "type" : "value";
|
|
10972
|
-
this.checkIdentifier(node.local ??= this.eatContextual(
|
|
11089
|
+
this.checkIdentifier(node.local ??= this.eatContextual(90) ? this.parseIdentifier() : this.cloneIdentifier(node.imported), hasTypeSpecifier ? 4098 : 4096);
|
|
10973
11090
|
}
|
|
10974
11091
|
parseTypeOnlyExportSpecifier(node, isInTypeOnly) {
|
|
10975
11092
|
const local = node.local;
|
|
10976
11093
|
let hasTypeSpecifier = false;
|
|
10977
|
-
if (this.isContextual(
|
|
11094
|
+
if (this.isContextual(90)) {
|
|
10978
11095
|
const firstAs = this.parseIdentifier();
|
|
10979
|
-
if (this.isContextual(
|
|
11096
|
+
if (this.isContextual(90)) {
|
|
10980
11097
|
const secondAs = this.parseIdentifier();
|
|
10981
11098
|
if (tokenIsKeywordOrIdentifier(this.state.type)) {
|
|
10982
11099
|
hasTypeSpecifier = true;
|
|
@@ -10994,7 +11111,7 @@ const typescript = (superClass) => class TypeScriptParserMixin extends superClas
|
|
|
10994
11111
|
}
|
|
10995
11112
|
if (hasTypeSpecifier && isInTypeOnly) this.raise(TSErrors.TypeModifierIsUsedInTypeExports, local);
|
|
10996
11113
|
node.exportKind = hasTypeSpecifier ? "type" : "value";
|
|
10997
|
-
node.exported ??= this.eatContextual(
|
|
11114
|
+
node.exported ??= this.eatContextual(90) ? this.parseModuleExportName() : this.cloneIdentifier(node.local);
|
|
10998
11115
|
}
|
|
10999
11116
|
fillOptionalPropertiesForTSESLint(node) {
|
|
11000
11117
|
switch (node.type) {
|
|
@@ -11172,13 +11289,13 @@ const PlaceholderErrors = ParseErrorEnum`placeholders`({
|
|
|
11172
11289
|
});
|
|
11173
11290
|
const placeholders = (superClass) => class PlaceholdersParserMixin extends superClass {
|
|
11174
11291
|
parsePlaceholder(expectedNode) {
|
|
11175
|
-
if (this.match(
|
|
11292
|
+
if (this.match(130)) {
|
|
11176
11293
|
const node = this.startNode();
|
|
11177
11294
|
this.next();
|
|
11178
11295
|
this.assertNoSpace();
|
|
11179
11296
|
node.name = super.parseIdentifier(true);
|
|
11180
11297
|
this.assertNoSpace();
|
|
11181
|
-
this.expect(
|
|
11298
|
+
this.expect(130);
|
|
11182
11299
|
return this.finishPlaceholder(node, expectedNode);
|
|
11183
11300
|
}
|
|
11184
11301
|
}
|
|
@@ -11189,7 +11306,7 @@ const placeholders = (superClass) => class PlaceholdersParserMixin extends super
|
|
|
11189
11306
|
return placeholder;
|
|
11190
11307
|
}
|
|
11191
11308
|
getTokenFromCode(code) {
|
|
11192
|
-
if (code === 37 && this.input.charCodeAt(this.state.pos + 1) === 37) this.finishOp(
|
|
11309
|
+
if (code === 37 && this.input.charCodeAt(this.state.pos + 1) === 37) this.finishOp(130, 2);
|
|
11193
11310
|
else super.getTokenFromCode(code);
|
|
11194
11311
|
}
|
|
11195
11312
|
parseExprAtom(refExpressionErrors) {
|
|
@@ -11230,13 +11347,13 @@ const placeholders = (superClass) => class PlaceholdersParserMixin extends super
|
|
|
11230
11347
|
if (node.label?.type === "Placeholder") return;
|
|
11231
11348
|
super.verifyBreakContinue(node, isBreak);
|
|
11232
11349
|
}
|
|
11233
|
-
parseExpressionStatement(node, expr) {
|
|
11234
|
-
if (expr.type !== "Placeholder" || expr.extra?.parenthesized) return super.parseExpressionStatement(node, expr);
|
|
11350
|
+
parseExpressionStatement(node, expr, flags) {
|
|
11351
|
+
if (expr.type !== "Placeholder" || expr.extra?.parenthesized) return super.parseExpressionStatement(node, expr, flags);
|
|
11235
11352
|
if (this.match(10)) {
|
|
11236
11353
|
const stmt = node;
|
|
11237
11354
|
stmt.label = this.finishPlaceholder(expr, "Identifier");
|
|
11238
11355
|
this.next();
|
|
11239
|
-
stmt.body = super.parseStatementOrSloppyAnnexBFunctionDeclaration();
|
|
11356
|
+
stmt.body = flags & 8 ? super.parseStatementOrSloppyAnnexBFunctionDeclaration(true) : super.parseStatement();
|
|
11240
11357
|
return this.finishNode(stmt, "LabeledStatement");
|
|
11241
11358
|
}
|
|
11242
11359
|
this.semicolon();
|
|
@@ -11256,7 +11373,7 @@ const placeholders = (superClass) => class PlaceholdersParserMixin extends super
|
|
|
11256
11373
|
const oldStrict = this.state.strict;
|
|
11257
11374
|
const placeholder = this.parsePlaceholder("Identifier");
|
|
11258
11375
|
if (placeholder) {
|
|
11259
|
-
if (this.match(77) || this.match(
|
|
11376
|
+
if (this.match(77) || this.match(130) || this.match(2)) node.id = placeholder;
|
|
11260
11377
|
else if (optionalId || !isStatement) {
|
|
11261
11378
|
node.id = null;
|
|
11262
11379
|
node.body = this.finishPlaceholder(placeholder, "ClassBody");
|
|
@@ -11271,7 +11388,7 @@ const placeholders = (superClass) => class PlaceholdersParserMixin extends super
|
|
|
11271
11388
|
const placeholder = this.parsePlaceholder("Identifier");
|
|
11272
11389
|
if (!placeholder) return super.parseExport(node, decorators);
|
|
11273
11390
|
const node2 = node;
|
|
11274
|
-
if (!this.isContextual(
|
|
11391
|
+
if (!this.isContextual(95) && !this.match(8)) {
|
|
11275
11392
|
node2.specifiers = [];
|
|
11276
11393
|
node2.source = null;
|
|
11277
11394
|
node2.declaration = this.finishPlaceholder(placeholder, "Declaration");
|
|
@@ -11287,7 +11404,7 @@ const placeholders = (superClass) => class PlaceholdersParserMixin extends super
|
|
|
11287
11404
|
if (this.match(61)) {
|
|
11288
11405
|
const next = this.nextTokenStart();
|
|
11289
11406
|
if (this.isUnparsedContextual(next, "from")) {
|
|
11290
|
-
if (this.input.startsWith(tokenLabelName(
|
|
11407
|
+
if (this.input.startsWith(tokenLabelName(130), this.hasPlugin("exportDefaultFrom") ? this.nextTokenStartSince(next + 4) : this.nextTokenInLineStartSince(next + 4))) return true;
|
|
11291
11408
|
}
|
|
11292
11409
|
}
|
|
11293
11410
|
return super.isExportDefaultSpecifier();
|
|
@@ -11301,7 +11418,7 @@ const placeholders = (superClass) => class PlaceholdersParserMixin extends super
|
|
|
11301
11418
|
const placeholder = this.parsePlaceholder("Identifier");
|
|
11302
11419
|
if (!placeholder) return super.parseImport(node);
|
|
11303
11420
|
node.specifiers = [];
|
|
11304
|
-
if (!this.isContextual(
|
|
11421
|
+
if (!this.isContextual(95) && !this.match(8)) {
|
|
11305
11422
|
node.source = this.finishPlaceholder(placeholder, "StringLiteral");
|
|
11306
11423
|
this.semicolon();
|
|
11307
11424
|
return this.finishNode(node, "ImportDeclaration");
|
|
@@ -11312,7 +11429,7 @@ const placeholders = (superClass) => class PlaceholdersParserMixin extends super
|
|
|
11312
11429
|
if (this.eat(8)) {
|
|
11313
11430
|
if (!this.maybeParseStarImportSpecifier(node)) this.parseNamedImportSpecifiers(node);
|
|
11314
11431
|
}
|
|
11315
|
-
this.expectContextual(
|
|
11432
|
+
this.expectContextual(95);
|
|
11316
11433
|
node.source = this.parseImportSource();
|
|
11317
11434
|
this.semicolon();
|
|
11318
11435
|
return this.finishNode(node, "ImportDeclaration");
|
|
@@ -11331,6 +11448,7 @@ const v8intrinsic = (superClass) => class V8IntrinsicMixin extends superClass {
|
|
|
11331
11448
|
const node = this.startNode();
|
|
11332
11449
|
this.next();
|
|
11333
11450
|
if (tokenIsIdentifier(this.state.type)) {
|
|
11451
|
+
this.setLoc(this.state.startLoc);
|
|
11334
11452
|
const name = this.parseIdentifierName();
|
|
11335
11453
|
const identifier = this.createIdentifier(node, name);
|
|
11336
11454
|
this.castNodeTo(identifier, "V8IntrinsicIdentifier");
|
|
@@ -12867,7 +12985,7 @@ function isKeyword(word) {
|
|
|
12867
12985
|
return keywords.has(word);
|
|
12868
12986
|
}
|
|
12869
12987
|
//#endregion
|
|
12870
|
-
//#region node_modules/.pnpm/@babel+helper-string-parser@8.0.
|
|
12988
|
+
//#region node_modules/.pnpm/@babel+helper-string-parser@8.0.8/node_modules/@babel/helper-string-parser/lib/index.js
|
|
12871
12989
|
var _isDigit = function isDigit(code) {
|
|
12872
12990
|
return code >= 48 && code <= 57;
|
|
12873
12991
|
};
|
|
@@ -12880,7 +12998,9 @@ const forbiddenNumericSeparatorSiblings = {
|
|
|
12880
12998
|
95,
|
|
12881
12999
|
98,
|
|
12882
13000
|
101,
|
|
12883
|
-
111
|
|
13001
|
+
111,
|
|
13002
|
+
43,
|
|
13003
|
+
45
|
|
12884
13004
|
]),
|
|
12885
13005
|
hex: /* @__PURE__ */ new Set([
|
|
12886
13006
|
46,
|
|
@@ -13038,7 +13158,7 @@ function readInt(input, pos, lineStart, curLine, radix, len, forceLen, allowNumS
|
|
|
13038
13158
|
pos
|
|
13039
13159
|
};
|
|
13040
13160
|
errors.numericSeparatorInEscapeSequence(pos, lineStart, curLine);
|
|
13041
|
-
} else if (Number.isNaN(next) || !isAllowedSibling(next) || forbiddenSiblings.has(prev)
|
|
13161
|
+
} else if (Number.isNaN(next) || !isAllowedSibling(next) || forbiddenSiblings.has(prev)) {
|
|
13042
13162
|
if (bailOnError) return {
|
|
13043
13163
|
n: null,
|
|
13044
13164
|
pos
|
|
@@ -13098,7 +13218,7 @@ function readCodePoint(input, pos, lineStart, curLine, throwOnInvalid, errors) {
|
|
|
13098
13218
|
};
|
|
13099
13219
|
}
|
|
13100
13220
|
//#endregion
|
|
13101
|
-
//#region node_modules/.pnpm/@babel+types@8.0.
|
|
13221
|
+
//#region node_modules/.pnpm/@babel+types@8.0.10/node_modules/@babel/types/lib/index.js
|
|
13102
13222
|
var lib_exports = /* @__PURE__ */ __exportAll({
|
|
13103
13223
|
ACCESSOR_TYPES: () => ACCESSOR_TYPES,
|
|
13104
13224
|
ALIAS_KEYS: () => ALIAS_KEYS,
|
|
@@ -13381,7 +13501,7 @@ var lib_exports = /* @__PURE__ */ __exportAll({
|
|
|
13381
13501
|
TSTupleType: () => TSTupleType$1,
|
|
13382
13502
|
TSTypeAliasDeclaration: () => TSTypeAliasDeclaration$1,
|
|
13383
13503
|
TSTypeAnnotation: () => TSTypeAnnotation$1,
|
|
13384
|
-
TSTypeAssertion: () => TSTypeAssertion$
|
|
13504
|
+
TSTypeAssertion: () => TSTypeAssertion$2,
|
|
13385
13505
|
TSTypeLiteral: () => TSTypeLiteral$1,
|
|
13386
13506
|
TSTypeOperator: () => TSTypeOperator$2,
|
|
13387
13507
|
TSTypeParameter: () => TSTypeParameter$1,
|
|
@@ -13876,7 +13996,7 @@ var lib_exports = /* @__PURE__ */ __exportAll({
|
|
|
13876
13996
|
isBooleanLiteralTypeAnnotation: () => isBooleanLiteralTypeAnnotation,
|
|
13877
13997
|
isBooleanTypeAnnotation: () => isBooleanTypeAnnotation$1,
|
|
13878
13998
|
isBreakStatement: () => isBreakStatement,
|
|
13879
|
-
isCallExpression: () => isCallExpression$
|
|
13999
|
+
isCallExpression: () => isCallExpression$3,
|
|
13880
14000
|
isCatchClause: () => isCatchClause,
|
|
13881
14001
|
isClass: () => isClass$1,
|
|
13882
14002
|
isClassAccessorProperty: () => isClassAccessorProperty,
|
|
@@ -14001,7 +14121,7 @@ var lib_exports = /* @__PURE__ */ __exportAll({
|
|
|
14001
14121
|
isModuleDeclaration: () => isModuleDeclaration,
|
|
14002
14122
|
isModuleExpression: () => isModuleExpression,
|
|
14003
14123
|
isModuleSpecifier: () => isModuleSpecifier$1,
|
|
14004
|
-
isNewExpression: () => isNewExpression$
|
|
14124
|
+
isNewExpression: () => isNewExpression$1,
|
|
14005
14125
|
isNode: () => isNode,
|
|
14006
14126
|
isNodesEquivalent: () => isNodesEquivalent,
|
|
14007
14127
|
isNullLiteral: () => isNullLiteral$1,
|
|
@@ -14040,7 +14160,7 @@ var lib_exports = /* @__PURE__ */ __exportAll({
|
|
|
14040
14160
|
isReferenced: () => isReferenced$1,
|
|
14041
14161
|
isRegExpLiteral: () => isRegExpLiteral$1,
|
|
14042
14162
|
isRegexLiteral: () => isRegexLiteral,
|
|
14043
|
-
isRestElement: () => isRestElement$
|
|
14163
|
+
isRestElement: () => isRestElement$2,
|
|
14044
14164
|
isRestProperty: () => isRestProperty$1,
|
|
14045
14165
|
isReturnStatement: () => isReturnStatement,
|
|
14046
14166
|
isScopable: () => isScopable,
|
|
@@ -14408,7 +14528,7 @@ function isBlockStatement$2(node, opts) {
|
|
|
14408
14528
|
function isBreakStatement(node, opts) {
|
|
14409
14529
|
return isType$1("BreakStatement", node, opts);
|
|
14410
14530
|
}
|
|
14411
|
-
function isCallExpression$
|
|
14531
|
+
function isCallExpression$3(node, opts) {
|
|
14412
14532
|
return isType$1("CallExpression", node, opts);
|
|
14413
14533
|
}
|
|
14414
14534
|
function isCatchClause(node, opts) {
|
|
@@ -14477,7 +14597,7 @@ function isLogicalExpression(node, opts) {
|
|
|
14477
14597
|
function isMemberExpression$3(node, opts) {
|
|
14478
14598
|
return isType$1("MemberExpression", node, opts);
|
|
14479
14599
|
}
|
|
14480
|
-
function isNewExpression$
|
|
14600
|
+
function isNewExpression$1(node, opts) {
|
|
14481
14601
|
return isType$1("NewExpression", node, opts);
|
|
14482
14602
|
}
|
|
14483
14603
|
function isProgram$1(node, opts) {
|
|
@@ -14492,7 +14612,7 @@ function isObjectMethod(node, opts) {
|
|
|
14492
14612
|
function isObjectProperty$1(node, opts) {
|
|
14493
14613
|
return isType$1("ObjectProperty", node, opts);
|
|
14494
14614
|
}
|
|
14495
|
-
function isRestElement$
|
|
14615
|
+
function isRestElement$2(node, opts) {
|
|
14496
14616
|
return isType$1("RestElement", node, opts);
|
|
14497
14617
|
}
|
|
14498
14618
|
function isReturnStatement(node, opts) {
|
|
@@ -17293,7 +17413,7 @@ defineType$4("ObjectProperty", {
|
|
|
17293
17413
|
"ObjectMember"
|
|
17294
17414
|
],
|
|
17295
17415
|
validate: function() {
|
|
17296
|
-
const pattern = assertNodeType("Identifier", "Pattern", "TSAsExpression", "TSSatisfiesExpression", "TSNonNullExpression", "TSTypeAssertion");
|
|
17416
|
+
const pattern = assertNodeType("Identifier", "Pattern", "MemberExpression", "TSAsExpression", "TSSatisfiesExpression", "TSNonNullExpression", "TSTypeAssertion");
|
|
17297
17417
|
const expression = assertNodeType("Expression");
|
|
17298
17418
|
return function(parent, key, node) {
|
|
17299
17419
|
(is("ObjectPattern", parent) ? pattern : expression)(node, "value", node.value);
|
|
@@ -19157,7 +19277,8 @@ const tSFunctionTypeAnnotationCommon = () => ({
|
|
|
19157
19277
|
});
|
|
19158
19278
|
defineType("TSParameterProperty", {
|
|
19159
19279
|
aliases: [],
|
|
19160
|
-
|
|
19280
|
+
builder: ["parameter"],
|
|
19281
|
+
visitor: ["decorators", "parameter"],
|
|
19161
19282
|
fields: {
|
|
19162
19283
|
accessibility: {
|
|
19163
19284
|
validate: assertOneOf("public", "private", "protected"),
|
|
@@ -22790,7 +22911,7 @@ const TSTypeAliasDeclaration$1 = alias("tsTypeAliasDeclaration");
|
|
|
22790
22911
|
const TSInstantiationExpression$2 = alias("tsInstantiationExpression");
|
|
22791
22912
|
const TSAsExpression$3 = alias("tsAsExpression");
|
|
22792
22913
|
const TSSatisfiesExpression$1 = alias("tsSatisfiesExpression");
|
|
22793
|
-
const TSTypeAssertion$
|
|
22914
|
+
const TSTypeAssertion$2 = alias("tsTypeAssertion");
|
|
22794
22915
|
const TSEnumBody$1 = alias("tsEnumBody");
|
|
22795
22916
|
const TSEnumDeclaration$1 = alias("tsEnumDeclaration");
|
|
22796
22917
|
const TSEnumMember$1 = alias("tsEnumMember");
|
|
@@ -24646,27 +24767,45 @@ var builtin_upper_default = [
|
|
|
24646
24767
|
];
|
|
24647
24768
|
//#endregion
|
|
24648
24769
|
//#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
|
|
24770
|
+
var comma = ",".charCodeAt(0);
|
|
24771
|
+
var semicolon = ";".charCodeAt(0);
|
|
24772
|
+
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
24773
|
+
var intToChar = /* @__PURE__ */ new Uint8Array(64);
|
|
24774
|
+
var charToInt = /* @__PURE__ */ new Uint8Array(128);
|
|
24775
|
+
for (let i = 0; i < chars.length; i++) {
|
|
24776
|
+
const c = chars.charCodeAt(i);
|
|
24777
|
+
intToChar[i] = c;
|
|
24778
|
+
charToInt[c] = i;
|
|
24779
|
+
}
|
|
24780
|
+
function decodeInteger(reader) {
|
|
24781
|
+
let value = 0;
|
|
24782
|
+
let shift = 0;
|
|
24783
|
+
let integer = 0;
|
|
24784
|
+
do {
|
|
24785
|
+
integer = charToInt[reader.next()];
|
|
24786
|
+
value |= (integer & 31) << shift;
|
|
24787
|
+
shift += 5;
|
|
24788
|
+
} while (integer & 32);
|
|
24789
|
+
return value;
|
|
24790
|
+
}
|
|
24791
|
+
function decodeSign(num) {
|
|
24792
|
+
return num & 1 ? -2147483648 | -(num >>> 1) : num >>> 1;
|
|
24658
24793
|
}
|
|
24659
24794
|
function encodeInteger(builder, num) {
|
|
24660
24795
|
do {
|
|
24661
24796
|
let clamped = num & 31;
|
|
24662
24797
|
num >>>= 5;
|
|
24663
24798
|
if (num > 0) clamped |= 32;
|
|
24664
|
-
builder.write(intToChar
|
|
24799
|
+
builder.write(intToChar[clamped]);
|
|
24665
24800
|
} while (num > 0);
|
|
24666
24801
|
}
|
|
24667
24802
|
function encodeSign(num) {
|
|
24668
24803
|
return num < 0 ? -num << 1 | 1 : num << 1;
|
|
24669
24804
|
}
|
|
24805
|
+
function hasMoreVlq(reader, max) {
|
|
24806
|
+
if (reader.pos >= max) return false;
|
|
24807
|
+
return reader.peek() !== comma;
|
|
24808
|
+
}
|
|
24670
24809
|
var bufLength = 16384;
|
|
24671
24810
|
var td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== "undefined" ? { decode(buf) {
|
|
24672
24811
|
return Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength).toString();
|
|
@@ -24694,81 +24833,6 @@ var StringWriter = class {
|
|
|
24694
24833
|
return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
|
|
24695
24834
|
}
|
|
24696
24835
|
};
|
|
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
24836
|
var StringReader = class {
|
|
24773
24837
|
constructor(buffer) {
|
|
24774
24838
|
this.pos = 0;
|
|
@@ -24786,6 +24850,21 @@ var StringReader = class {
|
|
|
24786
24850
|
return idx === -1 ? buffer.length : idx;
|
|
24787
24851
|
}
|
|
24788
24852
|
};
|
|
24853
|
+
function encodeRangeMappings(decoded) {
|
|
24854
|
+
if (decoded.length === 0) return "";
|
|
24855
|
+
const writer = new StringWriter();
|
|
24856
|
+
for (let i = 0; i < decoded.length; i++) {
|
|
24857
|
+
const indices = decoded[i];
|
|
24858
|
+
if (i > 0) writer.write(semicolon);
|
|
24859
|
+
let index = 0;
|
|
24860
|
+
for (let j = 0; j < indices.length; j++) {
|
|
24861
|
+
const offset = indices[j];
|
|
24862
|
+
encodeInteger(writer, offset - index);
|
|
24863
|
+
index = offset;
|
|
24864
|
+
}
|
|
24865
|
+
}
|
|
24866
|
+
return writer.flush();
|
|
24867
|
+
}
|
|
24789
24868
|
function decode(mappings) {
|
|
24790
24869
|
const { length } = mappings;
|
|
24791
24870
|
const reader = new StringReader(mappings);
|
|
@@ -24803,15 +24882,15 @@ function decode(mappings) {
|
|
|
24803
24882
|
genColumn = 0;
|
|
24804
24883
|
while (reader.pos < semi) {
|
|
24805
24884
|
let seg;
|
|
24806
|
-
genColumn
|
|
24885
|
+
genColumn += decodeSign(decodeInteger(reader));
|
|
24807
24886
|
if (genColumn < lastCol) sorted = false;
|
|
24808
24887
|
lastCol = genColumn;
|
|
24809
24888
|
if (hasMoreVlq(reader, semi)) {
|
|
24810
|
-
sourcesIndex
|
|
24811
|
-
sourceLine
|
|
24812
|
-
sourceColumn
|
|
24889
|
+
sourcesIndex += decodeSign(decodeInteger(reader));
|
|
24890
|
+
sourceLine += decodeSign(decodeInteger(reader));
|
|
24891
|
+
sourceColumn += decodeSign(decodeInteger(reader));
|
|
24813
24892
|
if (hasMoreVlq(reader, semi)) {
|
|
24814
|
-
namesIndex
|
|
24893
|
+
namesIndex += decodeSign(decodeInteger(reader));
|
|
24815
24894
|
seg = [
|
|
24816
24895
|
genColumn,
|
|
24817
24896
|
sourcesIndex,
|
|
@@ -24841,6 +24920,36 @@ function sort(line) {
|
|
|
24841
24920
|
function sortComparator$1(a, b) {
|
|
24842
24921
|
return a[0] - b[0];
|
|
24843
24922
|
}
|
|
24923
|
+
function encode(decoded) {
|
|
24924
|
+
const writer = new StringWriter();
|
|
24925
|
+
let sourcesIndex = 0;
|
|
24926
|
+
let sourceLine = 0;
|
|
24927
|
+
let sourceColumn = 0;
|
|
24928
|
+
let namesIndex = 0;
|
|
24929
|
+
for (let i = 0; i < decoded.length; i++) {
|
|
24930
|
+
const line = decoded[i];
|
|
24931
|
+
if (i > 0) writer.write(semicolon);
|
|
24932
|
+
if (line.length === 0) continue;
|
|
24933
|
+
let genColumn = 0;
|
|
24934
|
+
for (let j = 0; j < line.length; j++) {
|
|
24935
|
+
const segment = line[j];
|
|
24936
|
+
if (j > 0) writer.write(comma);
|
|
24937
|
+
encodeInteger(writer, encodeSign(segment[0] - genColumn));
|
|
24938
|
+
genColumn = segment[0];
|
|
24939
|
+
if (segment.length === 1) continue;
|
|
24940
|
+
encodeInteger(writer, encodeSign(segment[1] - sourcesIndex));
|
|
24941
|
+
encodeInteger(writer, encodeSign(segment[2] - sourceLine));
|
|
24942
|
+
encodeInteger(writer, encodeSign(segment[3] - sourceColumn));
|
|
24943
|
+
sourcesIndex = segment[1];
|
|
24944
|
+
sourceLine = segment[2];
|
|
24945
|
+
sourceColumn = segment[3];
|
|
24946
|
+
if (segment.length === 4) continue;
|
|
24947
|
+
encodeInteger(writer, encodeSign(segment[4] - namesIndex));
|
|
24948
|
+
namesIndex = segment[4];
|
|
24949
|
+
}
|
|
24950
|
+
}
|
|
24951
|
+
return writer.flush();
|
|
24952
|
+
}
|
|
24844
24953
|
//#endregion
|
|
24845
24954
|
//#region node_modules/.pnpm/@jridgewell+trace-mapping@0.3.31/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs
|
|
24846
24955
|
var import_resolve_uri_umd = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -25377,7 +25486,7 @@ function addMappingInternal(skipable, map, mapping) {
|
|
|
25377
25486
|
if (isRange) setRangeSegment(map, generated.line - 1, generated.column);
|
|
25378
25487
|
}
|
|
25379
25488
|
//#endregion
|
|
25380
|
-
//#region node_modules/.pnpm/@babel+generator@8.0.
|
|
25489
|
+
//#region node_modules/.pnpm/@babel+generator@8.0.10/node_modules/@babel/generator/lib/index.js
|
|
25381
25490
|
var import_jsesc = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
25382
25491
|
const object = {};
|
|
25383
25492
|
const hasOwnProperty = object.hasOwnProperty;
|
|
@@ -25886,7 +25995,7 @@ function isTSTypeExpression(nodeId) {
|
|
|
25886
25995
|
const isClassExtendsClause = (node, parent, parentId) => {
|
|
25887
25996
|
return (parentId === 22 || parentId === 23) && parent.superClass === node;
|
|
25888
25997
|
};
|
|
25889
|
-
const hasPostfixPart = (node, parent, parentId) => {
|
|
25998
|
+
const hasPostfixPart$1 = (node, parent, parentId) => {
|
|
25890
25999
|
switch (parentId) {
|
|
25891
26000
|
case 109:
|
|
25892
26001
|
case 133: return parent.object === node;
|
|
@@ -25895,6 +26004,7 @@ const hasPostfixPart = (node, parent, parentId) => {
|
|
|
25895
26004
|
case 113: return parent.callee === node;
|
|
25896
26005
|
case 220: return parent.tag === node;
|
|
25897
26006
|
case 189: return true;
|
|
26007
|
+
case 175: return parent.expression === node;
|
|
25898
26008
|
}
|
|
25899
26009
|
return false;
|
|
25900
26010
|
};
|
|
@@ -25905,7 +26015,7 @@ function FunctionTypeAnnotation$1(node, parent, parentId, tokenContext) {
|
|
|
25905
26015
|
return parentId === 237 || parentId === 91 || parentId === 4 || (tokenContext & 8) > 0;
|
|
25906
26016
|
}
|
|
25907
26017
|
function UpdateExpression$1(node, parent, parentId) {
|
|
25908
|
-
return hasPostfixPart(node, parent, parentId) || isClassExtendsClause(node, parent, parentId);
|
|
26018
|
+
return hasPostfixPart$1(node, parent, parentId) || isClassExtendsClause(node, parent, parentId);
|
|
25909
26019
|
}
|
|
25910
26020
|
function needsParenBeforeExpressionBrace(tokenContext) {
|
|
25911
26021
|
return (tokenContext & 3) > 0;
|
|
@@ -25918,7 +26028,7 @@ function DoExpression$1(node, parent, parentId, tokenContext) {
|
|
|
25918
26028
|
}
|
|
25919
26029
|
function BinaryLike(node, parent, parentId, nodeType) {
|
|
25920
26030
|
if (isClassExtendsClause(node, parent, parentId)) return true;
|
|
25921
|
-
if (hasPostfixPart(node, parent, parentId) || parentId === 236 || parentId === 143 || parentId === 8) return true;
|
|
26031
|
+
if (hasPostfixPart$1(node, parent, parentId) || parentId === 236 || parentId === 143 || parentId === 8) return true;
|
|
25922
26032
|
let parentPos;
|
|
25923
26033
|
switch (parentId) {
|
|
25924
26034
|
case 11:
|
|
@@ -25949,10 +26059,13 @@ function OptionalIndexedAccessType$1(node, parent, parentId) {
|
|
|
25949
26059
|
return parentId === 85 && parent.objectType === node;
|
|
25950
26060
|
}
|
|
25951
26061
|
function TSAsExpression$1(node, parent, parentId) {
|
|
25952
|
-
if ((parentId === 6 || parentId === 7) && parent.left === node) return true;
|
|
26062
|
+
if (parentId === 238 || (parentId === 6 || parentId === 7) && parent.left === node) return true;
|
|
25953
26063
|
if (parentId === 11 && (parent.operator === "|" || parent.operator === "&") && node === parent.left) return true;
|
|
25954
26064
|
return BinaryLike(node, parent, parentId, 2);
|
|
25955
26065
|
}
|
|
26066
|
+
function TSTypeAssertion$1(node, parent, parentId) {
|
|
26067
|
+
return parentId === 238 || (parentId === 6 || parentId === 7) && parent.left === node || UnaryLike(node, parent, parentId);
|
|
26068
|
+
}
|
|
25956
26069
|
function TSConditionalType$1(node, parent, parentId) {
|
|
25957
26070
|
switch (parentId) {
|
|
25958
26071
|
case 153:
|
|
@@ -25998,6 +26111,9 @@ function TSInstantiationExpression$1(node, parent, parentId) {
|
|
|
25998
26111
|
case 131:
|
|
25999
26112
|
case 113:
|
|
26000
26113
|
case 175: return parent.typeArguments != null;
|
|
26114
|
+
case 109:
|
|
26115
|
+
case 133: return parent.object === node;
|
|
26116
|
+
case 189: return true;
|
|
26001
26117
|
}
|
|
26002
26118
|
return false;
|
|
26003
26119
|
}
|
|
@@ -26020,13 +26136,13 @@ function SequenceExpression$1(node, parent, parentId) {
|
|
|
26020
26136
|
return !isStatement$4(parent);
|
|
26021
26137
|
}
|
|
26022
26138
|
function YieldExpression$1(node, parent, parentId) {
|
|
26023
|
-
return parentId === 11 || parentId === 108 || parentId === 236 || parentId === 143 || hasPostfixPart(node, parent, parentId) || parentId === 8 && isYieldExpression(node) || parentId === 29 && node === parent.test || isClassExtendsClause(node, parent, parentId) || isTSTypeExpression(parentId);
|
|
26139
|
+
return parentId === 11 || parentId === 108 || parentId === 236 || parentId === 143 || hasPostfixPart$1(node, parent, parentId) || parentId === 8 && isYieldExpression(node) || parentId === 29 && node === parent.test || isClassExtendsClause(node, parent, parentId) || isTSTypeExpression(parentId);
|
|
26024
26140
|
}
|
|
26025
26141
|
function ClassExpression(node, parent, parentId, tokenContext) {
|
|
26026
26142
|
return (tokenContext & 5) > 0;
|
|
26027
26143
|
}
|
|
26028
26144
|
function UnaryLike(node, parent, parentId) {
|
|
26029
|
-
return hasPostfixPart(node, parent, parentId) || parentId === 11 && parent.operator === "**" && parent.left === node || isClassExtendsClause(node, parent, parentId);
|
|
26145
|
+
return hasPostfixPart$1(node, parent, parentId) || parentId === 11 && parent.operator === "**" && parent.left === node || isClassExtendsClause(node, parent, parentId);
|
|
26030
26146
|
}
|
|
26031
26147
|
function FunctionExpression$1(node, parent, parentId, tokenContext) {
|
|
26032
26148
|
return (tokenContext & 5) > 0;
|
|
@@ -26104,13 +26220,14 @@ const parens = /*#__PURE__*/ Object.defineProperty({
|
|
|
26104
26220
|
TSInstantiationExpression: TSInstantiationExpression$1,
|
|
26105
26221
|
TSIntersectionType: TSIntersectionType$1,
|
|
26106
26222
|
TSSatisfiesExpression: TSAsExpression$1,
|
|
26107
|
-
TSTypeAssertion:
|
|
26223
|
+
TSTypeAssertion: TSTypeAssertion$1,
|
|
26108
26224
|
TSTypeOperator: TSTypeOperator$1,
|
|
26109
26225
|
TSUnionType: TSUnionType$1,
|
|
26110
26226
|
UnaryExpression: UnaryLike,
|
|
26111
26227
|
UnionTypeAnnotation: UnionTypeAnnotation$1,
|
|
26112
26228
|
UpdateExpression: UpdateExpression$1,
|
|
26113
|
-
YieldExpression: YieldExpression$1
|
|
26229
|
+
YieldExpression: YieldExpression$1,
|
|
26230
|
+
hasPostfixPart: hasPostfixPart$1
|
|
26114
26231
|
}, Symbol.toStringTag, { value: "Module" });
|
|
26115
26232
|
function TaggedTemplateExpression$1(node) {
|
|
26116
26233
|
this.print(node.tag);
|
|
@@ -26135,7 +26252,7 @@ function _printTemplate(node, substitutions) {
|
|
|
26135
26252
|
function TemplateLiteral$1(node) {
|
|
26136
26253
|
_printTemplate.call(this, node, node.expressions);
|
|
26137
26254
|
}
|
|
26138
|
-
const {
|
|
26255
|
+
const { isLiteral: isLiteral$2, isMemberExpression: isMemberExpression$2, isPattern } = lib_exports;
|
|
26139
26256
|
function UnaryExpression$1(node) {
|
|
26140
26257
|
const { operator } = node;
|
|
26141
26258
|
const firstChar = operator.charCodeAt(0);
|
|
@@ -26189,12 +26306,18 @@ function _printExpressionArguments(node) {
|
|
|
26189
26306
|
this.rightParens(node);
|
|
26190
26307
|
}
|
|
26191
26308
|
function NewExpression$1(node, parent) {
|
|
26309
|
+
const omitArguments = this.format.minified && node.arguments.length === 0 && !node.typeArguments;
|
|
26310
|
+
const wrapInParens = omitArguments && hasPostfixPart(node, parent);
|
|
26311
|
+
if (wrapInParens) this.tokenChar(40);
|
|
26192
26312
|
this.word("new");
|
|
26193
26313
|
this.space();
|
|
26194
26314
|
this.print(node.callee);
|
|
26195
|
-
if (
|
|
26315
|
+
if (omitArguments) {
|
|
26316
|
+
if (wrapInParens) this.tokenChar(41);
|
|
26317
|
+
return;
|
|
26318
|
+
}
|
|
26196
26319
|
this.print(node.typeArguments);
|
|
26197
|
-
if (node.arguments.length === 0 && this.tokenMap && !this.tokenMap.endMatches(node, ")")) return;
|
|
26320
|
+
if (node.arguments.length === 0 && this.tokenMap && !this.tokenMap.endMatches(node, ")") && (!hasPostfixPart(node, parent) || node.extra?.parenthesized)) return;
|
|
26198
26321
|
_printExpressionArguments.call(this, node);
|
|
26199
26322
|
}
|
|
26200
26323
|
function SequenceExpression$2(node) {
|
|
@@ -27223,9 +27346,13 @@ function TSImportType(node) {
|
|
|
27223
27346
|
if (typeArguments) this.print(typeArguments);
|
|
27224
27347
|
}
|
|
27225
27348
|
function TSImportEqualsDeclaration(node) {
|
|
27226
|
-
const { id, moduleReference } = node;
|
|
27349
|
+
const { id, moduleReference, importKind } = node;
|
|
27227
27350
|
this.word("import");
|
|
27228
27351
|
this.space();
|
|
27352
|
+
if (importKind === "type") {
|
|
27353
|
+
this.word("type");
|
|
27354
|
+
this.space();
|
|
27355
|
+
}
|
|
27229
27356
|
this.print(id);
|
|
27230
27357
|
this.space();
|
|
27231
27358
|
this.tokenChar(61);
|
|
@@ -27308,13 +27435,22 @@ function printModifiersList(printer, node, modifiers) {
|
|
|
27308
27435
|
}
|
|
27309
27436
|
}
|
|
27310
27437
|
const { isClassDeclaration: isClassDeclaration$1, isExportDefaultSpecifier, isExportNamespaceSpecifier, isImportDefaultSpecifier, isImportNamespaceSpecifier, isStatement: isStatement$2$1 } = lib_exports;
|
|
27438
|
+
function isSameModuleExportName(a, b) {
|
|
27439
|
+
if (a.type === "Identifier") return b.type === "Identifier" && a.name === b.name;
|
|
27440
|
+
return b.type === "StringLiteral" && a.value === b.value;
|
|
27441
|
+
}
|
|
27442
|
+
function shouldPrintModuleSpecifierAlias(printer, node, a, b) {
|
|
27443
|
+
if (!isSameModuleExportName(a, b)) return true;
|
|
27444
|
+
if (printer.tokenMap) return printer.tokenMap.findMatching(node, "as") !== null;
|
|
27445
|
+
return false;
|
|
27446
|
+
}
|
|
27311
27447
|
function ImportSpecifier(node) {
|
|
27312
27448
|
if (node.importKind === "type" || node.importKind === "typeof") {
|
|
27313
27449
|
this.word(node.importKind);
|
|
27314
27450
|
this.space();
|
|
27315
27451
|
}
|
|
27316
27452
|
this.print(node.imported);
|
|
27317
|
-
if (node.local && node
|
|
27453
|
+
if (node.local && shouldPrintModuleSpecifierAlias(this, node, node.imported, node.local)) {
|
|
27318
27454
|
this.space();
|
|
27319
27455
|
this.word("as");
|
|
27320
27456
|
this.space();
|
|
@@ -27333,7 +27469,7 @@ function ExportSpecifier(node) {
|
|
|
27333
27469
|
this.space();
|
|
27334
27470
|
}
|
|
27335
27471
|
this.print(node.local);
|
|
27336
|
-
if (node.exported && node.local
|
|
27472
|
+
if (node.exported && shouldPrintModuleSpecifierAlias(this, node, node.local, node.exported)) {
|
|
27337
27473
|
this.space();
|
|
27338
27474
|
this.word("as");
|
|
27339
27475
|
this.space();
|
|
@@ -27369,11 +27505,11 @@ function ExportAllDeclaration(node) {
|
|
|
27369
27505
|
this.space();
|
|
27370
27506
|
this.word("from");
|
|
27371
27507
|
this.space();
|
|
27508
|
+
this.print(node.source);
|
|
27372
27509
|
if (node.attributes?.length) {
|
|
27373
|
-
this.print(node.source, true);
|
|
27374
27510
|
this.space();
|
|
27375
27511
|
_printAttributes.call(this, node, false);
|
|
27376
|
-
}
|
|
27512
|
+
}
|
|
27377
27513
|
this.semicolon();
|
|
27378
27514
|
}
|
|
27379
27515
|
function maybePrintDecoratorsBeforeExport(printer, node) {
|
|
@@ -27420,11 +27556,11 @@ function ExportNamedDeclaration(node) {
|
|
|
27420
27556
|
this.space();
|
|
27421
27557
|
this.word("from");
|
|
27422
27558
|
this.space();
|
|
27559
|
+
this.print(node.source);
|
|
27423
27560
|
if (node.attributes?.length) {
|
|
27424
|
-
this.print(node.source, true);
|
|
27425
27561
|
this.space();
|
|
27426
27562
|
_printAttributes.call(this, node, hasBrace);
|
|
27427
|
-
}
|
|
27563
|
+
}
|
|
27428
27564
|
}
|
|
27429
27565
|
this.semicolon();
|
|
27430
27566
|
}
|
|
@@ -27488,11 +27624,11 @@ function ImportDeclaration(node) {
|
|
|
27488
27624
|
this.word("from");
|
|
27489
27625
|
this.space();
|
|
27490
27626
|
}
|
|
27627
|
+
this.print(node.source);
|
|
27491
27628
|
if (node.attributes?.length) {
|
|
27492
|
-
this.print(node.source, true);
|
|
27493
27629
|
this.space();
|
|
27494
27630
|
_printAttributes.call(this, node, hasBrace);
|
|
27495
|
-
}
|
|
27631
|
+
}
|
|
27496
27632
|
this.semicolon();
|
|
27497
27633
|
}
|
|
27498
27634
|
function ImportAttribute(node) {
|
|
@@ -28784,6 +28920,9 @@ for (const type of Object.keys(parens)) {
|
|
|
28784
28920
|
const func = parens[type];
|
|
28785
28921
|
if (generatorInfosMap.has(type)) generatorInfosMap.get(type)[2] = func;
|
|
28786
28922
|
}
|
|
28923
|
+
function hasPostfixPart(node, parent) {
|
|
28924
|
+
return parent != null && hasPostfixPart$1(node, parent, generatorInfosMap.get(parent.type)[1]);
|
|
28925
|
+
}
|
|
28787
28926
|
function newCalleeNeedsParens(node) {
|
|
28788
28927
|
let current = node;
|
|
28789
28928
|
while (true) switch (current.type) {
|
|
@@ -30092,7 +30231,7 @@ const index = Object.assign(smart.bind(void 0), {
|
|
|
30092
30231
|
ast: smart.ast
|
|
30093
30232
|
});
|
|
30094
30233
|
//#endregion
|
|
30095
|
-
//#region node_modules/.pnpm/@babel+traverse@8.0.
|
|
30234
|
+
//#region node_modules/.pnpm/@babel+traverse@8.0.10/node_modules/@babel/traverse/lib/index.js
|
|
30096
30235
|
const virtualTypes = /*#__PURE__*/ Object.defineProperty({
|
|
30097
30236
|
__proto__: null,
|
|
30098
30237
|
BindingIdentifier: ["Identifier"],
|
|
@@ -30388,7 +30527,7 @@ function verify$1(visitor) {
|
|
|
30388
30527
|
for (const nodeType of Object.keys(visitor)) {
|
|
30389
30528
|
if (nodeType === "enter" || nodeType === "exit") validateVisitorMethods(nodeType, visitor[nodeType]);
|
|
30390
30529
|
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.
|
|
30530
|
+
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.10`);
|
|
30392
30531
|
const visitors = visitor[nodeType];
|
|
30393
30532
|
if (typeof visitors === "object") for (const visitorKey of Object.keys(visitors)) if (visitorKey === "enter" || visitorKey === "exit") validateVisitorMethods(`${nodeType}.${visitorKey}`, visitors[visitorKey]);
|
|
30394
30533
|
else throw new Error(`You passed \`traverse()\` a visitor object with the property ${nodeType} that has the invalid property ${visitorKey}`);
|
|
@@ -30686,7 +30825,7 @@ const cache = /*#__PURE__*/ Object.defineProperty({
|
|
|
30686
30825
|
return scope;
|
|
30687
30826
|
}
|
|
30688
30827
|
}, 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;
|
|
30828
|
+
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
30829
|
function gatherNodeParts(node, parts) {
|
|
30691
30830
|
switch (node?.type) {
|
|
30692
30831
|
default:
|
|
@@ -30792,6 +30931,13 @@ function gatherNodeParts(node, parts) {
|
|
|
30792
30931
|
gatherNodeParts(node.name, parts);
|
|
30793
30932
|
}
|
|
30794
30933
|
}
|
|
30934
|
+
const uidCandidateStart = /* @__PURE__ */ new WeakMap();
|
|
30935
|
+
function uidCandidate(name, i) {
|
|
30936
|
+
if (i >= 11) return `_${name}${i - 1}`;
|
|
30937
|
+
if (i >= 9) return `_${name}${i - 9}`;
|
|
30938
|
+
if (i >= 1) return `_${name}${i + 1}`;
|
|
30939
|
+
return `_${name}`;
|
|
30940
|
+
}
|
|
30795
30941
|
function resetScope(scope) {
|
|
30796
30942
|
if (scope.path.type === "Program") {
|
|
30797
30943
|
scope.referencesSet = /* @__PURE__ */ new Set();
|
|
@@ -30940,17 +31086,18 @@ var Scope = class Scope {
|
|
|
30940
31086
|
}
|
|
30941
31087
|
generateUid(name = "temp") {
|
|
30942
31088
|
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
31089
|
const program = this.getProgramParent();
|
|
30953
|
-
program
|
|
31090
|
+
const { referencesSet } = program;
|
|
31091
|
+
let starts = uidCandidateStart.get(referencesSet);
|
|
31092
|
+
if (!starts) uidCandidateStart.set(referencesSet, starts = /* @__PURE__ */ new Map());
|
|
31093
|
+
let i = starts.get(name) ?? 0;
|
|
31094
|
+
while (referencesSet.has(uidCandidate(name, i))) i++;
|
|
31095
|
+
starts.set(name, i);
|
|
31096
|
+
let uid;
|
|
31097
|
+
do
|
|
31098
|
+
uid = uidCandidate(name, i++);
|
|
31099
|
+
while (referencesSet.has(uid) || this.hasLabel(uid) || this.hasBinding(uid) || this.hasGlobal(uid));
|
|
31100
|
+
referencesSet.add(uid);
|
|
30954
31101
|
program.uidsSet.add(uid);
|
|
30955
31102
|
return uid;
|
|
30956
31103
|
}
|
|
@@ -31201,7 +31348,7 @@ var Scope = class Scope {
|
|
|
31201
31348
|
else if (!path.isBlockStatement() && !path.isProgram()) path = this.getBlockParent().path;
|
|
31202
31349
|
if (path.isSwitchStatement()) path = (this.getFunctionParent() || this.getProgramParent()).path;
|
|
31203
31350
|
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)) {
|
|
31351
|
+
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
31352
|
path.pushContainer("params", id);
|
|
31206
31353
|
path.scope.registerBinding("param", path.get("params")[path.node.params.length - 1]);
|
|
31207
31354
|
return;
|
|
@@ -31220,8 +31367,15 @@ var Scope = class Scope {
|
|
|
31220
31367
|
if (!unique) path.setData(dataKey, declarPath);
|
|
31221
31368
|
}
|
|
31222
31369
|
const declarator = variableDeclarator$1(id, init);
|
|
31223
|
-
const
|
|
31224
|
-
|
|
31370
|
+
const { declarations } = declarPath.node;
|
|
31371
|
+
const len = declarations.push(declarator);
|
|
31372
|
+
path.scope.registerBinding(kind, NodePath_Final.get({
|
|
31373
|
+
listKey: "declarations",
|
|
31374
|
+
parentPath: declarPath,
|
|
31375
|
+
parent: declarPath.node,
|
|
31376
|
+
container: declarations,
|
|
31377
|
+
key: len - 1
|
|
31378
|
+
}).setContext(declarPath.context));
|
|
31225
31379
|
}
|
|
31226
31380
|
getProgramParent() {
|
|
31227
31381
|
let scope = this;
|
|
@@ -33705,13 +33859,13 @@ traverse$1.hasType = function(tree, type, denylistTypes) {
|
|
|
33705
33859
|
};
|
|
33706
33860
|
traverse$1.cache = cache;
|
|
33707
33861
|
//#endregion
|
|
33708
|
-
//#region node_modules/.pnpm/nanoid@6.0.
|
|
33709
|
-
let urlAlphabet = "
|
|
33862
|
+
//#region node_modules/.pnpm/nanoid@6.0.2/node_modules/nanoid/url-alphabet/index.js
|
|
33863
|
+
let urlAlphabet = "57X6y3wQZNzYjJB2L_10pxbackgroundhimselfUTF-8DEMOGRAPHICSVqvt4KW9";
|
|
33710
33864
|
//#endregion
|
|
33711
|
-
//#region node_modules/.pnpm/nanoid@6.0.
|
|
33865
|
+
//#region node_modules/.pnpm/nanoid@6.0.2/node_modules/nanoid/index.browser.js
|
|
33712
33866
|
let nanoid = (size = 21) => {
|
|
33713
|
-
|
|
33714
|
-
|
|
33867
|
+
var id = "";
|
|
33868
|
+
var bytes = crypto.getRandomValues(new Uint8Array(size |= 0));
|
|
33715
33869
|
while (size--) id += urlAlphabet[bytes[size] & 63];
|
|
33716
33870
|
return id;
|
|
33717
33871
|
};
|
|
@@ -34074,4 +34228,4 @@ const createSectionPreviewCache = () => {
|
|
|
34074
34228
|
//#endregion
|
|
34075
34229
|
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
34230
|
|
|
34077
|
-
//# sourceMappingURL=document-
|
|
34231
|
+
//# sourceMappingURL=document-BkGWDZGc.js.map
|