@oomol-lab/open-flow 0.1.0-alpha.6 → 0.1.0-alpha.7
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/dist/browser/{addNodeOptions-C4wix0_u.js → addNodeOptions-DRndy4EK.js} +2080 -2022
- package/dist/browser/{createLucideIcon-ggJB9CTC.js → createLucideIcon-CqjqCezK.js} +829 -832
- package/dist/browser/{createResourceDialog-CESUCxOM.js → createResourceDialog-A64dDFCG.js} +140 -140
- package/dist/browser/{esm-CoE5_2w7.js → esm-YIGXG-Js.js} +1 -11
- package/dist/browser/{field-CIrv7Rez.js → field-CKGQHCIi.js} +88 -88
- package/dist/browser/flow-authoring.js +29 -19
- package/dist/browser/flow-change.d.ts +16 -10
- package/dist/browser/flow-change.js +62 -59
- package/dist/browser/{flowWorkspace-Bo0bz1Uz.js → flowWorkspace-D7-rBA1-.js} +16961 -12403
- package/dist/browser/licenses.md +514 -0
- package/dist/browser/workbench.css +1 -1
- package/dist/browser/workbench.js +439 -388
- package/dist/common/control-api-conformance.js +106 -15
- package/dist/common/control-api.d.ts +1 -1
- package/dist/common/control-api.js +1 -1
- package/dist/common/flow-encoding.d.ts +3 -3
- package/dist/common/flow-encoding.js +11 -7
- package/dist/common/flow-semantics.js +514 -505
- package/dist/common/scheduler.js +156 -151
- package/package.json +1 -1
|
@@ -838,18 +838,18 @@ function Oe(e) {
|
|
|
838
838
|
function ke(e) {
|
|
839
839
|
return se[e];
|
|
840
840
|
}
|
|
841
|
-
var
|
|
841
|
+
var Ae = class {
|
|
842
842
|
constructor(e, t) {
|
|
843
843
|
this.token = e, this.preserveSpace = !!t;
|
|
844
844
|
}
|
|
845
845
|
token;
|
|
846
846
|
preserveSpace;
|
|
847
|
-
},
|
|
848
|
-
brace: new
|
|
849
|
-
j_oTag: new
|
|
850
|
-
j_cTag: new
|
|
851
|
-
j_expr: new
|
|
852
|
-
},
|
|
847
|
+
}, j = {
|
|
848
|
+
brace: new Ae("{"),
|
|
849
|
+
j_oTag: new Ae("<tag"),
|
|
850
|
+
j_cTag: new Ae("</tag"),
|
|
851
|
+
j_expr: new Ae("<tag>...</tag>", !0)
|
|
852
|
+
}, je = /[\p{ID_Start}\u088f\u0c5c\u0cdc\ua7ce\ua7cf\ua7d2\ua7d4\ua7f1]/u, Me = /[\p{ID_Continue}\u088f\u0c5c\u0cdc\ua7ce\ua7cf\ua7d2\ua7d4\ua7f1\u1acf-\u1add\u1ae0-\u1aeb]/u, Ne = [
|
|
853
853
|
2368,
|
|
854
854
|
25,
|
|
855
855
|
1388,
|
|
@@ -886,7 +886,7 @@ var j = class {
|
|
|
886
886
|
11,
|
|
887
887
|
21763,
|
|
888
888
|
4297
|
|
889
|
-
],
|
|
889
|
+
], Pe = [
|
|
890
890
|
3834,
|
|
891
891
|
1,
|
|
892
892
|
3173,
|
|
@@ -902,7 +902,7 @@ var j = class {
|
|
|
902
902
|
6,
|
|
903
903
|
0
|
|
904
904
|
];
|
|
905
|
-
function
|
|
905
|
+
function Fe(e, t) {
|
|
906
906
|
let n = 65536;
|
|
907
907
|
for (let r = 0, i = t.length; r < i; r += 2) {
|
|
908
908
|
if (n += t[r], n > e) return !1;
|
|
@@ -910,13 +910,13 @@ function Pe(e, t) {
|
|
|
910
910
|
}
|
|
911
911
|
return !1;
|
|
912
912
|
}
|
|
913
|
-
function
|
|
914
|
-
return e < 65 ? e === 36 : e <= 90 ? !0 : e < 97 ? e === 95 : e <= 122 ? !0 : e <= 65535 ? e >= 170 &&
|
|
913
|
+
function M(e) {
|
|
914
|
+
return e < 65 ? e === 36 : e <= 90 ? !0 : e < 97 ? e === 95 : e <= 122 ? !0 : e <= 65535 ? e >= 170 && je.test(String.fromCharCode(e)) : !isNaN(e) && e <= 1114111 && (je.test(String.fromCodePoint(e)) || Fe(e, Ne));
|
|
915
915
|
}
|
|
916
|
-
function
|
|
917
|
-
return e < 48 ? e === 36 : e < 58 ? !0 : e < 65 ? !1 : e <= 90 ? !0 : e < 97 ? e === 95 : e <= 122 ? !0 : e <= 65535 ? e >= 170 &&
|
|
916
|
+
function N(e) {
|
|
917
|
+
return e < 48 ? e === 36 : e < 58 ? !0 : e < 65 ? !1 : e <= 90 ? !0 : e < 97 ? e === 95 : e <= 122 ? !0 : e <= 65535 ? e >= 170 && Me.test(String.fromCharCode(e)) : !isNaN(e) && e <= 1114111 && (Me.test(String.fromCodePoint(e)) || Fe(e, Ne) || Fe(e, Pe));
|
|
918
918
|
}
|
|
919
|
-
var
|
|
919
|
+
var Ie = {
|
|
920
920
|
keyword: /* @__PURE__ */ "break.case.catch.continue.debugger.default.do.else.finally.for.function.if.return.switch.throw.try.var.const.while.with.new.this.super.class.extends.export.import.null.true.false.in.instanceof.typeof.void.delete".split("."),
|
|
921
921
|
strict: [
|
|
922
922
|
"implements",
|
|
@@ -930,37 +930,37 @@ var Fe = {
|
|
|
930
930
|
"yield"
|
|
931
931
|
],
|
|
932
932
|
strictBind: ["eval", "arguments"]
|
|
933
|
-
},
|
|
934
|
-
function
|
|
933
|
+
}, Le = new Set(Ie.keyword), Re = new Set(Ie.strict), ze = new Set(Ie.strictBind);
|
|
934
|
+
function Be(e, t) {
|
|
935
935
|
return t && e === "await" || e === "enum";
|
|
936
936
|
}
|
|
937
|
-
function
|
|
938
|
-
return
|
|
937
|
+
function Ve(e, t) {
|
|
938
|
+
return Be(e, t) || Re.has(e);
|
|
939
939
|
}
|
|
940
|
-
function
|
|
941
|
-
return
|
|
940
|
+
function He(e) {
|
|
941
|
+
return ze.has(e);
|
|
942
942
|
}
|
|
943
|
-
function
|
|
944
|
-
return
|
|
943
|
+
function Ue(e, t) {
|
|
944
|
+
return Ve(e, t) || He(e);
|
|
945
945
|
}
|
|
946
|
-
function
|
|
947
|
-
return
|
|
946
|
+
function We(e) {
|
|
947
|
+
return Le.has(e);
|
|
948
948
|
}
|
|
949
|
-
function
|
|
950
|
-
return e === 64 && t === 64 &&
|
|
949
|
+
function Ge(e, t, n) {
|
|
950
|
+
return e === 64 && t === 64 && M(n);
|
|
951
951
|
}
|
|
952
|
-
var
|
|
953
|
-
function
|
|
954
|
-
return
|
|
952
|
+
var Ke = /* @__PURE__ */ new Set(/* @__PURE__ */ "break.case.catch.continue.debugger.default.do.else.finally.for.function.if.return.switch.throw.try.var.const.while.with.new.this.super.class.extends.export.import.null.true.false.in.instanceof.typeof.void.delete.implements.interface.let.package.private.protected.public.static.yield.eval.arguments.enum.await".split("."));
|
|
953
|
+
function qe(e) {
|
|
954
|
+
return Ke.has(e);
|
|
955
955
|
}
|
|
956
|
-
var
|
|
956
|
+
var Je = class {
|
|
957
957
|
flags = 0;
|
|
958
958
|
names = /* @__PURE__ */ new Map();
|
|
959
959
|
firstLexicalName = "";
|
|
960
960
|
constructor(e) {
|
|
961
961
|
this.flags = e;
|
|
962
962
|
}
|
|
963
|
-
},
|
|
963
|
+
}, Ye = class {
|
|
964
964
|
parser;
|
|
965
965
|
scopeStack = [];
|
|
966
966
|
inModule;
|
|
@@ -1007,7 +1007,7 @@ var qe = class {
|
|
|
1007
1007
|
return this.treatFunctionsAsVarInScope(this.currentScope());
|
|
1008
1008
|
}
|
|
1009
1009
|
createScope(e) {
|
|
1010
|
-
return new
|
|
1010
|
+
return new Je(e);
|
|
1011
1011
|
}
|
|
1012
1012
|
enter(e) {
|
|
1013
1013
|
this.scopeStack.push(this.createScope(e));
|
|
@@ -1058,11 +1058,11 @@ var qe = class {
|
|
|
1058
1058
|
if (t & 3779 && !(t & 4)) return t;
|
|
1059
1059
|
}
|
|
1060
1060
|
}
|
|
1061
|
-
}, Ye = class extends qe {
|
|
1062
|
-
declareFunctions = /* @__PURE__ */ new Set();
|
|
1063
1061
|
}, Xe = class extends Je {
|
|
1062
|
+
declareFunctions = /* @__PURE__ */ new Set();
|
|
1063
|
+
}, Ze = class extends Ye {
|
|
1064
1064
|
createScope(e) {
|
|
1065
|
-
return new
|
|
1065
|
+
return new Xe(e);
|
|
1066
1066
|
}
|
|
1067
1067
|
declareName(e, t, n) {
|
|
1068
1068
|
let r = this.currentScope();
|
|
@@ -1083,7 +1083,7 @@ var qe = class {
|
|
|
1083
1083
|
checkLocalExport(e) {
|
|
1084
1084
|
this.scopeStack[0].declareFunctions.has(e.name) || super.checkLocalExport(e);
|
|
1085
1085
|
}
|
|
1086
|
-
},
|
|
1086
|
+
}, Qe = /* @__PURE__ */ new Set([
|
|
1087
1087
|
"_",
|
|
1088
1088
|
"any",
|
|
1089
1089
|
"bool",
|
|
@@ -1100,7 +1100,7 @@ var qe = class {
|
|
|
1100
1100
|
"true",
|
|
1101
1101
|
"typeof",
|
|
1102
1102
|
"void"
|
|
1103
|
-
]),
|
|
1103
|
+
]), P = h`flow`({
|
|
1104
1104
|
AmbiguousConditionalArrow: "Ambiguous expression: wrap the arrow functions in parentheses to disambiguate.",
|
|
1105
1105
|
AmbiguousDeclareModuleKind: "Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module.",
|
|
1106
1106
|
AssignReservedType: ({ reservedType: e }) => `Cannot overwrite reserved type ${e}.`,
|
|
@@ -1149,27 +1149,27 @@ var qe = class {
|
|
|
1149
1149
|
UnsupportedStatementInDeclareModule: "Only declares and type imports are allowed inside declare module.",
|
|
1150
1150
|
UnterminatedFlowComment: "Unterminated flow-comment."
|
|
1151
1151
|
});
|
|
1152
|
-
function
|
|
1152
|
+
function $e(e) {
|
|
1153
1153
|
return e.type === "DeclareExportAllDeclaration" || e.type === "DeclareExportDeclaration" && (!e.declaration || e.declaration.type !== "TypeAlias" && e.declaration.type !== "InterfaceDeclaration");
|
|
1154
1154
|
}
|
|
1155
|
-
function
|
|
1155
|
+
function et(e) {
|
|
1156
1156
|
return e.importKind === "type" || e.importKind === "typeof";
|
|
1157
1157
|
}
|
|
1158
|
-
var
|
|
1158
|
+
var tt = {
|
|
1159
1159
|
const: "declare export var",
|
|
1160
1160
|
let: "declare export var",
|
|
1161
1161
|
type: "export type",
|
|
1162
1162
|
interface: "export interface"
|
|
1163
1163
|
};
|
|
1164
|
-
function
|
|
1164
|
+
function nt(e, t) {
|
|
1165
1165
|
let n = [], r = [];
|
|
1166
1166
|
for (let i = 0; i < e.length; i++) (t(e[i], i, e) ? n : r).push(e[i]);
|
|
1167
1167
|
return [n, r];
|
|
1168
1168
|
}
|
|
1169
|
-
var
|
|
1169
|
+
var rt = /\*?\s*@((?:no)?flow)\b/, it = (e) => class extends e {
|
|
1170
1170
|
flowPragma = void 0;
|
|
1171
1171
|
getScopeHandler() {
|
|
1172
|
-
return
|
|
1172
|
+
return Ze;
|
|
1173
1173
|
}
|
|
1174
1174
|
shouldParseTypes() {
|
|
1175
1175
|
return this.getPluginOption("flow", "all") || this.flowPragma === "flow";
|
|
@@ -1179,7 +1179,7 @@ var nt = /\*?\s*@((?:no)?flow)\b/, rt = (e) => class extends e {
|
|
|
1179
1179
|
}
|
|
1180
1180
|
addComment(e) {
|
|
1181
1181
|
if (this.flowPragma === void 0) {
|
|
1182
|
-
let t =
|
|
1182
|
+
let t = rt.exec(e.value);
|
|
1183
1183
|
if (t) {
|
|
1184
1184
|
if (t[1] === "flow") this.flowPragma = "flow";
|
|
1185
1185
|
else if (t[1] === "noflow") this.flowPragma = "noflow";
|
|
@@ -1196,7 +1196,7 @@ var nt = /\*?\s*@((?:no)?flow)\b/, rt = (e) => class extends e {
|
|
|
1196
1196
|
}
|
|
1197
1197
|
flowParsePredicate() {
|
|
1198
1198
|
let e = this.startNode(), t = this.state.startLoc;
|
|
1199
|
-
return this.next(), this.expectContextual(106), this.state.lastTokStartLoc.index > t.index + 1 && this.raise(
|
|
1199
|
+
return this.next(), this.expectContextual(106), this.state.lastTokStartLoc.index > t.index + 1 && this.raise(P.UnexpectedSpaceBetweenModuloChecks, t), this.eat(6) ? (e.value = super.parseExpression(), this.expect(7), this.finishNode(e, "DeclaredPredicate")) : this.finishNode(e, "InferredPredicate");
|
|
1200
1200
|
}
|
|
1201
1201
|
flowParseTypeAndPredicateInitialiser(e) {
|
|
1202
1202
|
let t = this.state.inType;
|
|
@@ -1218,7 +1218,7 @@ var nt = /\*?\s*@((?:no)?flow)\b/, rt = (e) => class extends e {
|
|
|
1218
1218
|
if (this.match(76)) return this.flowParseDeclareClass(e);
|
|
1219
1219
|
if (this.match(64)) return this.flowParseDeclareFunction(e);
|
|
1220
1220
|
if (this.match(70)) return this.flowParseDeclareVariable(e);
|
|
1221
|
-
if (this.eatContextual(123)) return this.match(12) ? this.flowParseDeclareModuleExports(e) : (t && this.raise(
|
|
1221
|
+
if (this.eatContextual(123)) return this.match(12) ? this.flowParseDeclareModuleExports(e) : (t && this.raise(P.NestedDeclareModule, this.state.lastTokStartLoc), this.flowParseDeclareModule(e));
|
|
1222
1222
|
if (this.isContextual(126)) return this.flowParseDeclareTypeAlias(e);
|
|
1223
1223
|
if (this.isContextual(127)) return this.flowParseDeclareOpaqueType(e);
|
|
1224
1224
|
if (this.isContextual(125)) return this.flowParseDeclareInterface(e);
|
|
@@ -1233,21 +1233,21 @@ var nt = /\*?\s*@((?:no)?flow)\b/, rt = (e) => class extends e {
|
|
|
1233
1233
|
let t = this.startNode(), n = t.body = [];
|
|
1234
1234
|
for (this.expect(2); !this.match(4);) {
|
|
1235
1235
|
let e = this.startNode();
|
|
1236
|
-
this.match(79) ? (this.next(), !this.isContextual(126) && !this.match(83) && this.raise(
|
|
1236
|
+
this.match(79) ? (this.next(), !this.isContextual(126) && !this.match(83) && this.raise(P.InvalidNonTypeImportInDeclareModule, this.state.lastTokStartLoc), n.push(super.parseImport(e))) : (this.expectContextual(121, P.UnsupportedStatementInDeclareModule), n.push(this.flowParseDeclare(e, !0)));
|
|
1237
1237
|
}
|
|
1238
1238
|
this.scope.exit(), this.expect(4), e.body = this.finishNode(t, "BlockStatement");
|
|
1239
1239
|
let r = null, i = !1;
|
|
1240
1240
|
return n.forEach((e) => {
|
|
1241
|
-
|
|
1241
|
+
$e(e) ? (r === "CommonJS" && this.raise(P.AmbiguousDeclareModuleKind, e), r = "ES") : e.type === "DeclareModuleExports" && (i && this.raise(P.DuplicateDeclareModuleExports, e), r === "ES" && this.raise(P.AmbiguousDeclareModuleKind, e), r = "CommonJS", i = !0);
|
|
1242
1242
|
}), e.kind = r || "CommonJS", this.finishNode(e, "DeclareModule");
|
|
1243
1243
|
}
|
|
1244
1244
|
flowParseDeclareExportDeclaration(e, t) {
|
|
1245
1245
|
if (this.expect(78), this.eat(61)) return this.match(64) || this.match(76) ? e.declaration = this.flowParseDeclare(this.startNode()) : (e.declaration = this.flowParseType(), this.semicolon()), e.default = !0, this.finishNode(e, "DeclareExportDeclaration");
|
|
1246
1246
|
if (this.match(71) || this.isLet() || (this.isContextual(126) || this.isContextual(125)) && !t) {
|
|
1247
1247
|
let e = this.state.value;
|
|
1248
|
-
throw this.raise(
|
|
1248
|
+
throw this.raise(P.UnsupportedDeclareExportKind, this.state.startLoc, {
|
|
1249
1249
|
unsupportedExportKind: e,
|
|
1250
|
-
suggestion:
|
|
1250
|
+
suggestion: tt[e]
|
|
1251
1251
|
});
|
|
1252
1252
|
}
|
|
1253
1253
|
if (this.match(70) || this.match(64) || this.match(76) || this.isContextual(127)) return e.declaration = this.flowParseDeclare(this.startNode()), e.default = !1, this.finishNode(e, "DeclareExportDeclaration");
|
|
@@ -1301,10 +1301,10 @@ var nt = /\*?\s*@((?:no)?flow)\b/, rt = (e) => class extends e {
|
|
|
1301
1301
|
return this.flowParseInterfaceish(e, !1), this.finishNode(e, "InterfaceDeclaration");
|
|
1302
1302
|
}
|
|
1303
1303
|
checkNotUnderscore(e) {
|
|
1304
|
-
e === "_" && this.raise(
|
|
1304
|
+
e === "_" && this.raise(P.UnexpectedReservedUnderscore, this.state.startLoc);
|
|
1305
1305
|
}
|
|
1306
1306
|
checkReservedType(e, t, n) {
|
|
1307
|
-
|
|
1307
|
+
Qe.has(e) && this.raise(n ? P.AssignReservedType : P.UnexpectedReservedType, t, { reservedType: e });
|
|
1308
1308
|
}
|
|
1309
1309
|
flowParseRestrictedIdentifierName(e, t) {
|
|
1310
1310
|
return this.checkReservedType(this.state.value, this.state.startLoc, t), this.parseIdentifierName(e);
|
|
@@ -1327,7 +1327,7 @@ var nt = /\*?\s*@((?:no)?flow)\b/, rt = (e) => class extends e {
|
|
|
1327
1327
|
}
|
|
1328
1328
|
flowParseTypeParameter(e = !1) {
|
|
1329
1329
|
let t = this.state.startLoc, n = this.startNode(), r = this.flowParseVariance();
|
|
1330
|
-
return n.name = this.flowParseRestrictedIdentifierName(), n.variance = r, n.bound = this.flowParseTypeParameterBound(), this.match(25) ? (this.eat(25), n.default = this.flowParseType()) : e && this.raise(
|
|
1330
|
+
return n.name = this.flowParseRestrictedIdentifierName(), n.variance = r, n.bound = this.flowParseTypeParameterBound(), this.match(25) ? (this.eat(25), n.default = this.flowParseType()) : e && this.raise(P.MissingTypeParamDefault, t), this.finishNode(n, "TypeParameter");
|
|
1331
1331
|
}
|
|
1332
1332
|
flowParseTypeParameterDeclaration() {
|
|
1333
1333
|
let e = this.state.inType, t = this.startNode();
|
|
@@ -1340,7 +1340,7 @@ var nt = /\*?\s*@((?:no)?flow)\b/, rt = (e) => class extends e {
|
|
|
1340
1340
|
return this.expect(44), this.state.inType = e, this.finishNode(t, "TypeParameterDeclaration");
|
|
1341
1341
|
}
|
|
1342
1342
|
flowInTopLevelContext(e) {
|
|
1343
|
-
if (this.curContext() !==
|
|
1343
|
+
if (this.curContext() !== j.brace) {
|
|
1344
1344
|
let t = this.state.context;
|
|
1345
1345
|
this.state.context = [t[0]];
|
|
1346
1346
|
try {
|
|
@@ -1360,7 +1360,7 @@ var nt = /\*?\s*@((?:no)?flow)\b/, rt = (e) => class extends e {
|
|
|
1360
1360
|
let t = this.state.noAnonFunctionType;
|
|
1361
1361
|
for (this.state.noAnonFunctionType = !1; !this.match(44);) e.params.push(this.flowParseType()), this.match(44) || this.expect(8);
|
|
1362
1362
|
this.state.noAnonFunctionType = t;
|
|
1363
|
-
}), this.state.inType = t, !this.state.inType && this.curContext() ===
|
|
1363
|
+
}), this.state.inType = t, !this.state.inType && this.curContext() === j.brace && this.reScan_lt_gt(), this.expect(44), this.finishNode(e, "TypeParameterInstantiation");
|
|
1364
1364
|
}
|
|
1365
1365
|
flowParseTypeParameterInstantiationCallOrNew() {
|
|
1366
1366
|
if (this.reScan_lt() !== 43) return null;
|
|
@@ -1423,23 +1423,23 @@ var nt = /\*?\s*@((?:no)?flow)\b/, rt = (e) => class extends e {
|
|
|
1423
1423
|
let r = this.flowParseObjectTypeProperty(u, t, a, d, e, n, i ?? !c);
|
|
1424
1424
|
r === null ? (l = !0, s = this.state.lastTokStartLoc) : o.properties.push(r);
|
|
1425
1425
|
}
|
|
1426
|
-
this.flowObjectTypeSemicolon(), s && !this.match(4) && !this.match(5) && this.raise(
|
|
1426
|
+
this.flowObjectTypeSemicolon(), s && !this.match(4) && !this.match(5) && this.raise(P.UnexpectedExplicitInexactInObject, s);
|
|
1427
1427
|
}
|
|
1428
1428
|
this.expect(s), n && (o.inexact = l);
|
|
1429
1429
|
let u = this.finishNode(o, "ObjectTypeAnnotation");
|
|
1430
1430
|
return this.state.inType = a, u;
|
|
1431
1431
|
}
|
|
1432
1432
|
flowParseObjectTypeProperty(e, t, n, r, i, a, o) {
|
|
1433
|
-
if (this.eat(17)) return this.match(8) || this.match(9) || this.match(4) || this.match(5) ? (a ? o || this.raise(
|
|
1433
|
+
if (this.eat(17)) return this.match(8) || this.match(9) || this.match(4) || this.match(5) ? (a ? o || this.raise(P.InexactInsideExact, this.state.lastTokStartLoc) : this.raise(P.InexactInsideNonObject, this.state.lastTokStartLoc), r && this.raise(P.InexactVariance, r), null) : (a || this.raise(P.UnexpectedSpreadType, this.state.lastTokStartLoc), n != null && this.unexpected(n), r && this.raise(P.SpreadVariance, r), e.argument = this.flowParseType(), this.finishNode(e, "ObjectTypeSpreadProperty"));
|
|
1434
1434
|
{
|
|
1435
1435
|
e.key = this.flowParseObjectPropertyKey(), e.static = t, e.proto = n != null, e.kind = i;
|
|
1436
1436
|
let o = !1;
|
|
1437
|
-
return this.match(43) || this.match(6) ? (e.method = !0, n != null && this.unexpected(n), r && this.unexpected(r.start), e.value = this.flowParseObjectTypeMethodish(this.startNodeAtNode(e)), i === "get" || i === "set" ? this.flowCheckGetterSetterParams(e) : !t && !a && e.key.name === "constructor" && e.value.this && this.raise(
|
|
1437
|
+
return this.match(43) || this.match(6) ? (e.method = !0, n != null && this.unexpected(n), r && this.unexpected(r.start), e.value = this.flowParseObjectTypeMethodish(this.startNodeAtNode(e)), i === "get" || i === "set" ? this.flowCheckGetterSetterParams(e) : !t && !a && e.key.name === "constructor" && e.value.this && this.raise(P.ThisParamBannedInConstructor, e.value.this)) : (i !== "init" && this.unexpected(), e.method = !1, this.eat(13) && (o = !0), e.value = this.flowParseTypeInitialiser(), e.variance = r), e.optional = o, this.finishNode(e, "ObjectTypeProperty");
|
|
1438
1438
|
}
|
|
1439
1439
|
}
|
|
1440
1440
|
flowCheckGetterSetterParams(e) {
|
|
1441
1441
|
let t = e.kind === "get" ? 0 : 1, n = e.value, r = n.params.length + +!!n.rest;
|
|
1442
|
-
n.this && this.raise(e.kind === "get" ?
|
|
1442
|
+
n.this && this.raise(e.kind === "get" ? P.GetterMayNotHaveThisParam : P.SetterMayNotHaveThisParam, n.this), r !== t && this.raise(e.kind === "get" ? g.BadGetterArity : g.BadSetterArity, e), e.kind === "set" && n.rest && this.raise(g.BadSetterRestParameter, e);
|
|
1443
1443
|
}
|
|
1444
1444
|
flowObjectTypeSemicolon() {
|
|
1445
1445
|
!this.eat(9) && !this.eat(8) && !this.match(4) && !this.match(5) && this.unexpected();
|
|
@@ -1468,7 +1468,7 @@ var nt = /\*?\s*@((?:no)?flow)\b/, rt = (e) => class extends e {
|
|
|
1468
1468
|
}
|
|
1469
1469
|
flowParseFunctionTypeParam(e) {
|
|
1470
1470
|
let t = null, n = !1, r, i = this.startNode(), a = this.lookahead(), o = this.state.type === 74;
|
|
1471
|
-
return a.type === 10 || a.type === 13 ? (o && !e && this.raise(
|
|
1471
|
+
return a.type === 10 || a.type === 13 ? (o && !e && this.raise(P.ThisParamMustBeFirst, i), t = this.parseIdentifier(o), this.eat(13) && (n = !0, o && this.raise(P.ThisParamMayNotBeOptional, i)), r = this.flowParseTypeInitialiser()) : r = this.flowParseType(), i.name = t, i.optional = n, i.typeAnnotation = r, this.finishNode(i, "FunctionTypeParam");
|
|
1472
1472
|
}
|
|
1473
1473
|
reinterpretTypeAsFunctionTypeParam(e) {
|
|
1474
1474
|
let t = this.startNodeAtNode(e);
|
|
@@ -1539,7 +1539,7 @@ var nt = /\*?\s*@((?:no)?flow)\b/, rt = (e) => class extends e {
|
|
|
1539
1539
|
if (this.state.value === "-") {
|
|
1540
1540
|
if (this.next(), this.match(131)) return this.parseLiteralAtNode(-this.state.value, "NumberLiteralTypeAnnotation", t);
|
|
1541
1541
|
if (this.match(132)) return this.parseLiteralAtNode(-this.state.value, "BigIntLiteralTypeAnnotation", t);
|
|
1542
|
-
throw this.raise(
|
|
1542
|
+
throw this.raise(P.UnexpectedSubtractionOperand, this.state.startLoc);
|
|
1543
1543
|
}
|
|
1544
1544
|
throw this.unexpected();
|
|
1545
1545
|
case 131: return this.parseLiteral(this.state.value, "NumberLiteralTypeAnnotation");
|
|
@@ -1689,7 +1689,7 @@ var nt = /\*?\s*@((?:no)?flow)\b/, rt = (e) => class extends e {
|
|
|
1689
1689
|
for (let t = 0; t < u.length; t++) e.push(u[t].start);
|
|
1690
1690
|
({consequent: o, failed: s} = this.tryParseConditionalConsequent()), [l] = this.getArrowLikeExpressions(o);
|
|
1691
1691
|
}
|
|
1692
|
-
s && l.length > 1 && this.raise(
|
|
1692
|
+
s && l.length > 1 && this.raise(P.AmbiguousConditionalArrow, r.startLoc), s && l.length === 1 && (this.state = r, e.push(l[0].start), this.state.noArrowAt = e, {consequent: o} = this.tryParseConditionalConsequent());
|
|
1693
1693
|
}
|
|
1694
1694
|
return this.getArrowLikeExpressions(o, !0), this.state.noArrowAt = i, this.expect(10), a.test = e, a.consequent = o, a.alternate = this.forwardNoArrowParamsConversionAt(a, () => this.parseMaybeAssign(void 0, void 0)), this.finishNode(a, "ConditionalExpression");
|
|
1695
1695
|
}
|
|
@@ -1707,7 +1707,7 @@ var nt = /\*?\s*@((?:no)?flow)\b/, rt = (e) => class extends e {
|
|
|
1707
1707
|
let e = n.pop();
|
|
1708
1708
|
e.type === "ArrowFunctionExpression" && e.body.type !== "BlockStatement" ? (e.typeParameters || !e.returnType ? this.finishArrowValidation(e) : r.push(e), n.push(e.body)) : e.type === "ConditionalExpression" && (n.push(e.consequent), n.push(e.alternate));
|
|
1709
1709
|
}
|
|
1710
|
-
return t ? (r.forEach((e) => this.finishArrowValidation(e)), [r, []]) :
|
|
1710
|
+
return t ? (r.forEach((e) => this.finishArrowValidation(e)), [r, []]) : nt(r, (e) => e.params.every((e) => this.isAssignable(e, !0)));
|
|
1711
1711
|
}
|
|
1712
1712
|
finishArrowValidation(e) {
|
|
1713
1713
|
this.toAssignableList(e.params, e.extra?.trailingCommaLoc, !1), this.scope.enter(518), super.checkParams(e, !1, !0), this.scope.exit();
|
|
@@ -1770,7 +1770,7 @@ var nt = /\*?\s*@((?:no)?flow)\b/, rt = (e) => class extends e {
|
|
|
1770
1770
|
if (super.parseClassMemberFromModifier(e, t)) return;
|
|
1771
1771
|
t.declare = !0;
|
|
1772
1772
|
}
|
|
1773
|
-
super.parseClassMember(e, t, n), t.declare && (t.type !== "ClassProperty" && t.type !== "ClassPrivateProperty" && t.type !== "PropertyDefinition" ? this.raise(
|
|
1773
|
+
super.parseClassMember(e, t, n), t.declare && (t.type !== "ClassProperty" && t.type !== "ClassPrivateProperty" && t.type !== "PropertyDefinition" ? this.raise(P.DeclareClassElement, r) : t.value && this.raise(P.DeclareClassFieldInitializer, t.value));
|
|
1774
1774
|
}
|
|
1775
1775
|
isIterator(e) {
|
|
1776
1776
|
return e === "iterator" || e === "asyncIterator";
|
|
@@ -1781,7 +1781,7 @@ var nt = /\*?\s*@((?:no)?flow)\b/, rt = (e) => class extends e {
|
|
|
1781
1781
|
}
|
|
1782
1782
|
getTokenFromCode(e) {
|
|
1783
1783
|
let t = this.input.charCodeAt(this.state.pos + 1);
|
|
1784
|
-
e === 123 && t === 124 ? this.finishOp(3, 2) : this.state.inType && (e === 62 || e === 60) ? this.finishOp(e === 62 ? 44 : 43, 1) : this.state.inType && e === 63 ? t === 46 ? this.finishOp(14, 2) : this.finishOp(13, 1) :
|
|
1784
|
+
e === 123 && t === 124 ? this.finishOp(3, 2) : this.state.inType && (e === 62 || e === 60) ? this.finishOp(e === 62 ? 44 : 43, 1) : this.state.inType && e === 63 ? t === 46 ? this.finishOp(14, 2) : this.finishOp(13, 1) : Ge(e, t, this.input.charCodeAt(this.state.pos + 2)) ? (this.state.pos += 2, this.readIterator()) : super.getTokenFromCode(e);
|
|
1785
1785
|
}
|
|
1786
1786
|
isAssignable(e, t) {
|
|
1787
1787
|
return e.type === "TypeCastExpression" ? this.isAssignable(e.expression, t) : super.isAssignable(e, t);
|
|
@@ -1796,7 +1796,7 @@ var nt = /\*?\s*@((?:no)?flow)\b/, rt = (e) => class extends e {
|
|
|
1796
1796
|
toReferencedList(e, t) {
|
|
1797
1797
|
for (let n = 0; n < e.length; n++) {
|
|
1798
1798
|
let r = e[n];
|
|
1799
|
-
r?.type === "TypeCastExpression" && !r.extra?.parenthesized && (e.length > 1 || !t) && this.raise(
|
|
1799
|
+
r?.type === "TypeCastExpression" && !r.extra?.parenthesized && (e.length > 1 || !t) && this.raise(P.TypeCastInPattern, r.typeAnnotation);
|
|
1800
1800
|
}
|
|
1801
1801
|
return e;
|
|
1802
1802
|
}
|
|
@@ -1825,10 +1825,10 @@ var nt = /\*?\s*@((?:no)?flow)\b/, rt = (e) => class extends e {
|
|
|
1825
1825
|
pushClassMethod(e, t, n, r, i, a) {
|
|
1826
1826
|
if (t.variance && this.unexpected(t.variance.start), delete t.variance, this.match(43) && (t.typeParameters = this.flowParseTypeParameterDeclaration()), super.pushClassMethod(e, t, n, r, i, a), t.params && i) {
|
|
1827
1827
|
let e = t.params;
|
|
1828
|
-
e.length > 0 && this.isThisParam(e[0]) && this.raise(
|
|
1828
|
+
e.length > 0 && this.isThisParam(e[0]) && this.raise(P.ThisParamBannedInConstructor, t);
|
|
1829
1829
|
} else if (t.type === "MethodDefinition" && i && t.value.params) {
|
|
1830
1830
|
let e = t.value.params;
|
|
1831
|
-
e.length > 0 && this.isThisParam(e[0]) && this.raise(
|
|
1831
|
+
e.length > 0 && this.isThisParam(e[0]) && this.raise(P.ThisParamBannedInConstructor, t);
|
|
1832
1832
|
}
|
|
1833
1833
|
}
|
|
1834
1834
|
pushClassPrivateMethod(e, t, n, r) {
|
|
@@ -1851,7 +1851,7 @@ var nt = /\*?\s*@((?:no)?flow)\b/, rt = (e) => class extends e {
|
|
|
1851
1851
|
let t = this.getObjectOrClassMethodParams(e);
|
|
1852
1852
|
if (t.length > 0) {
|
|
1853
1853
|
let n = t[0];
|
|
1854
|
-
this.isThisParam(n) && e.kind === "get" ? this.raise(
|
|
1854
|
+
this.isThisParam(n) && e.kind === "get" ? this.raise(P.GetterMayNotHaveThisParam, n) : this.isThisParam(n) && this.raise(P.SetterMayNotHaveThisParam, n);
|
|
1855
1855
|
}
|
|
1856
1856
|
}
|
|
1857
1857
|
parsePropertyNamePrefixOperator(e) {
|
|
@@ -1865,14 +1865,14 @@ var nt = /\*?\s*@((?:no)?flow)\b/, rt = (e) => class extends e {
|
|
|
1865
1865
|
return s && ((c.value || c).typeParameters = s), c;
|
|
1866
1866
|
}
|
|
1867
1867
|
parseFunctionParamType(e) {
|
|
1868
|
-
return this.eat(13) && (e.type !== "Identifier" && this.raise(
|
|
1868
|
+
return this.eat(13) && (e.type !== "Identifier" && this.raise(P.PatternIsOptional, e), this.isThisParam(e) && this.raise(P.ThisParamMayNotBeOptional, e), e.optional = !0), this.match(10) ? e.typeAnnotation = this.flowParseTypeAnnotation() : this.isThisParam(e) && this.raise(P.ThisParamAnnotationRequired, e), this.match(25) && this.isThisParam(e) && this.raise(P.ThisParamNoDefault, e), this.resetEndLocation(e), e;
|
|
1869
1869
|
}
|
|
1870
1870
|
parseMaybeDefault(e, t) {
|
|
1871
1871
|
let n = super.parseMaybeDefault(e, t);
|
|
1872
|
-
return n.type === "AssignmentPattern" && n.typeAnnotation && n.right.start < n.typeAnnotation.start && this.raise(
|
|
1872
|
+
return n.type === "AssignmentPattern" && n.typeAnnotation && n.right.start < n.typeAnnotation.start && this.raise(P.TypeBeforeInitializer, n.typeAnnotation), n;
|
|
1873
1873
|
}
|
|
1874
1874
|
parseImportSpecifierLocal(e, t, n) {
|
|
1875
|
-
t.local =
|
|
1875
|
+
t.local = et(e) ? this.flowParseRestrictedIdentifier(!0, !0) : this.parseIdentifier(), e.specifiers.push(this.finishImportSpecifier(t, n));
|
|
1876
1876
|
}
|
|
1877
1877
|
isPotentialImportPhase(e) {
|
|
1878
1878
|
if (super.isPotentialImportPhase(e)) return !0;
|
|
@@ -1904,8 +1904,8 @@ var nt = /\*?\s*@((?:no)?flow)\b/, rt = (e) => class extends e {
|
|
|
1904
1904
|
}
|
|
1905
1905
|
this.eatContextual(89) ? e.local = this.parseIdentifier() : (s = !0, e.local = this.cloneIdentifier(e.imported));
|
|
1906
1906
|
}
|
|
1907
|
-
let c =
|
|
1908
|
-
return n && c && this.raise(
|
|
1907
|
+
let c = et(e);
|
|
1908
|
+
return n && c && this.raise(P.ImportTypeShorthandOnlyInPureImport, e), (n || c) && this.checkReservedType(e.local.name, e.local.start, !0), s && !n && !c && this.checkReservedWord(e.local.name, e.start, !0, !0), this.finishImportSpecifier(e, "ImportSpecifier");
|
|
1909
1909
|
}
|
|
1910
1910
|
parseBindingAtom() {
|
|
1911
1911
|
switch (this.state.type) {
|
|
@@ -1935,7 +1935,7 @@ var nt = /\*?\s*@((?:no)?flow)\b/, rt = (e) => class extends e {
|
|
|
1935
1935
|
if (this.hasPlugin("jsx") && (this.match(138) || this.match(43))) {
|
|
1936
1936
|
if (n = this.state.clone(), r = this.tryParse(() => super.parseMaybeAssign(e, t), n), !r.error) return r.node;
|
|
1937
1937
|
let { context: i } = this.state, a = i[i.length - 1];
|
|
1938
|
-
(a ===
|
|
1938
|
+
(a === j.j_oTag || a === j.j_expr) && i.pop();
|
|
1939
1939
|
}
|
|
1940
1940
|
if (r?.error || this.match(43)) {
|
|
1941
1941
|
n ||= this.state.clone();
|
|
@@ -1950,12 +1950,12 @@ var nt = /\*?\s*@((?:no)?flow)\b/, rt = (e) => class extends e {
|
|
|
1950
1950
|
return a.type !== "ArrowFunctionExpression" && n(), a.typeParameters = i, this.resetStartLocationFromNode(a, i), r;
|
|
1951
1951
|
}, n), o = null;
|
|
1952
1952
|
if (a.node && this.maybeUnwrapTypeCastExpression(a.node).type === "ArrowFunctionExpression") {
|
|
1953
|
-
if (!a.error && !a.aborted) return a.node.async && this.raise(
|
|
1953
|
+
if (!a.error && !a.aborted) return a.node.async && this.raise(P.UnexpectedTypeParameterBeforeAsyncArrowFunction, i), a.node;
|
|
1954
1954
|
o = a.node;
|
|
1955
1955
|
}
|
|
1956
1956
|
if (r?.node) return this.state = r.failState, r.node;
|
|
1957
1957
|
if (o) return this.state = a.failState, o;
|
|
1958
|
-
throw r?.thrown ? r.error : a.thrown ? a.error : this.raise(
|
|
1958
|
+
throw r?.thrown ? r.error : a.thrown ? a.error : this.raise(P.UnexpectedTokenAfterTypeParameter, i);
|
|
1959
1959
|
}
|
|
1960
1960
|
return super.parseMaybeAssign(e, t);
|
|
1961
1961
|
}
|
|
@@ -1980,7 +1980,7 @@ var nt = /\*?\s*@((?:no)?flow)\b/, rt = (e) => class extends e {
|
|
|
1980
1980
|
}
|
|
1981
1981
|
checkParams(e, t, n, r = !0) {
|
|
1982
1982
|
if (!(n && this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(e.start)))) {
|
|
1983
|
-
for (let t = 0; t < e.params.length; t++) this.isThisParam(e.params[t]) && t > 0 && this.raise(
|
|
1983
|
+
for (let t = 0; t < e.params.length; t++) this.isThisParam(e.params[t]) && t > 0 && this.raise(P.ThisParamMustBeFirst, e.params[t]);
|
|
1984
1984
|
super.checkParams(e, t, n, r);
|
|
1985
1985
|
}
|
|
1986
1986
|
}
|
|
@@ -2045,11 +2045,11 @@ var nt = /\*?\s*@((?:no)?flow)\b/, rt = (e) => class extends e {
|
|
|
2045
2045
|
}
|
|
2046
2046
|
parseTopLevel(e, t) {
|
|
2047
2047
|
let n = super.parseTopLevel(e, t);
|
|
2048
|
-
return this.state.hasFlowComment && this.raise(
|
|
2048
|
+
return this.state.hasFlowComment && this.raise(P.UnterminatedFlowComment, this.state.curPosition()), n;
|
|
2049
2049
|
}
|
|
2050
2050
|
skipBlockComment() {
|
|
2051
2051
|
if (this.hasPlugin("flowComments") && this.skipFlowComment()) {
|
|
2052
|
-
if (this.state.hasFlowComment) throw this.raise(
|
|
2052
|
+
if (this.state.hasFlowComment) throw this.raise(P.NestedFlowComment, this.state.startLoc);
|
|
2053
2053
|
this.hasFlowCommentCompletion();
|
|
2054
2054
|
let e = this.skipFlowComment();
|
|
2055
2055
|
e && (this.state.pos += e, this.state.hasFlowComment = !0);
|
|
@@ -2067,16 +2067,16 @@ var nt = /\*?\s*@((?:no)?flow)\b/, rt = (e) => class extends e {
|
|
|
2067
2067
|
if (this.input.indexOf("*/", this.state.pos) === -1) throw this.raise(g.UnterminatedComment, this.state.curPosition());
|
|
2068
2068
|
}
|
|
2069
2069
|
flowEnumErrorBooleanMemberNotInitialized(e, t) {
|
|
2070
|
-
this.raise(
|
|
2070
|
+
this.raise(P.EnumBooleanMemberNotInitialized, e, t);
|
|
2071
2071
|
}
|
|
2072
2072
|
flowEnumErrorInvalidMemberInitializer(e, t) {
|
|
2073
|
-
return this.raise(t.explicitType ? t.explicitType === "symbol" ?
|
|
2073
|
+
return this.raise(t.explicitType ? t.explicitType === "symbol" ? P.EnumInvalidMemberInitializerSymbolType : P.EnumInvalidMemberInitializerPrimaryType : P.EnumInvalidMemberInitializerUnknownType, e, t);
|
|
2074
2074
|
}
|
|
2075
2075
|
flowEnumErrorNumberMemberNotInitialized(e, t) {
|
|
2076
|
-
this.raise(
|
|
2076
|
+
this.raise(P.EnumNumberMemberNotInitialized, e, t);
|
|
2077
2077
|
}
|
|
2078
2078
|
flowEnumErrorStringMemberInconsistentlyInitialized(e, t) {
|
|
2079
|
-
this.raise(
|
|
2079
|
+
this.raise(P.EnumStringMemberInconsistentlyInitialized, e, t);
|
|
2080
2080
|
}
|
|
2081
2081
|
flowEnumMemberInit() {
|
|
2082
2082
|
let e = this.state.startLoc, t = () => this.match(8) || this.match(4);
|
|
@@ -2142,11 +2142,11 @@ var nt = /\*?\s*@((?:no)?flow)\b/, rt = (e) => class extends e {
|
|
|
2142
2142
|
}
|
|
2143
2143
|
let a = this.startNode(), { id: o, init: s } = this.flowEnumMemberRaw(), c = o.name;
|
|
2144
2144
|
if (c === "") continue;
|
|
2145
|
-
/^[a-z]/.test(c) && this.raise(
|
|
2145
|
+
/^[a-z]/.test(c) && this.raise(P.EnumInvalidMemberName, o, {
|
|
2146
2146
|
memberName: c,
|
|
2147
2147
|
suggestion: c[0].toUpperCase() + c.slice(1),
|
|
2148
2148
|
enumName: e
|
|
2149
|
-
}), n.has(c) && this.raise(
|
|
2149
|
+
}), n.has(c) && this.raise(P.EnumDuplicateMemberName, o, {
|
|
2150
2150
|
memberName: c,
|
|
2151
2151
|
enumName: e
|
|
2152
2152
|
}), n.add(c);
|
|
@@ -2195,9 +2195,9 @@ var nt = /\*?\s*@((?:no)?flow)\b/, rt = (e) => class extends e {
|
|
|
2195
2195
|
}
|
|
2196
2196
|
flowEnumParseExplicitType({ enumName: e }) {
|
|
2197
2197
|
if (!this.eatContextual(98)) return null;
|
|
2198
|
-
if (!D(this.state.type)) throw this.raise(
|
|
2198
|
+
if (!D(this.state.type)) throw this.raise(P.EnumInvalidExplicitTypeUnknownSupplied, this.state.startLoc, { enumName: e });
|
|
2199
2199
|
let { value: t } = this.state;
|
|
2200
|
-
return this.next(), t !== "boolean" && t !== "number" && t !== "string" && t !== "symbol" && this.raise(
|
|
2200
|
+
return this.next(), t !== "boolean" && t !== "number" && t !== "string" && t !== "symbol" && this.raise(P.EnumInvalidExplicitType, this.state.startLoc, {
|
|
2201
2201
|
enumName: e,
|
|
2202
2202
|
invalidEnumType: t
|
|
2203
2203
|
}), t;
|
|
@@ -2234,7 +2234,7 @@ var nt = /\*?\s*@((?:no)?flow)\b/, rt = (e) => class extends e {
|
|
|
2234
2234
|
});
|
|
2235
2235
|
return e.members = a.numberMembers, this.expect(4), this.finishNode(e, "EnumNumberBody");
|
|
2236
2236
|
}
|
|
2237
|
-
return this.raise(
|
|
2237
|
+
return this.raise(P.EnumInconsistentMemberValues, r, { enumName: n }), t();
|
|
2238
2238
|
}
|
|
2239
2239
|
}
|
|
2240
2240
|
}
|
|
@@ -2264,7 +2264,7 @@ var nt = /\*?\s*@((?:no)?flow)\b/, rt = (e) => class extends e {
|
|
|
2264
2264
|
maybeUnwrapTypeCastExpression(e) {
|
|
2265
2265
|
return e.type === "TypeCastExpression" ? e.expression : e;
|
|
2266
2266
|
}
|
|
2267
|
-
},
|
|
2267
|
+
}, at = {
|
|
2268
2268
|
__proto__: null,
|
|
2269
2269
|
quot: "\"",
|
|
2270
2270
|
amp: "&",
|
|
@@ -2519,8 +2519,8 @@ var nt = /\*?\s*@((?:no)?flow)\b/, rt = (e) => class extends e {
|
|
|
2519
2519
|
clubs: "♣",
|
|
2520
2520
|
hearts: "♥",
|
|
2521
2521
|
diams: "♦"
|
|
2522
|
-
},
|
|
2523
|
-
function
|
|
2522
|
+
}, ot = /* @__PURE__ */ RegExp("\\r\\n|[\\r\\n\\u2028\\u2029]", "g");
|
|
2523
|
+
function F(e) {
|
|
2524
2524
|
switch (e) {
|
|
2525
2525
|
case 10:
|
|
2526
2526
|
case 13:
|
|
@@ -2529,12 +2529,12 @@ function I(e) {
|
|
|
2529
2529
|
default: return !1;
|
|
2530
2530
|
}
|
|
2531
2531
|
}
|
|
2532
|
-
function
|
|
2533
|
-
for (let r = t; r < n; r++) if (
|
|
2532
|
+
function st(e, t, n) {
|
|
2533
|
+
for (let r = t; r < n; r++) if (F(e.charCodeAt(r))) return !0;
|
|
2534
2534
|
return !1;
|
|
2535
2535
|
}
|
|
2536
|
-
var
|
|
2537
|
-
function
|
|
2536
|
+
var ct = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g, lt = /(?:[^\S\n\r\u2028\u2029]|\/\/.*|\/\*.*?\*\/)*/g;
|
|
2537
|
+
function ut(e) {
|
|
2538
2538
|
switch (e) {
|
|
2539
2539
|
case 9:
|
|
2540
2540
|
case 11:
|
|
@@ -2560,7 +2560,7 @@ function lt(e) {
|
|
|
2560
2560
|
default: return !1;
|
|
2561
2561
|
}
|
|
2562
2562
|
}
|
|
2563
|
-
var
|
|
2563
|
+
var I = h`jsx`({
|
|
2564
2564
|
AttributeIsEmpty: "JSX attributes must only be assigned a non-empty expression.",
|
|
2565
2565
|
MissingClosingTagElement: ({ openingTagName: e }) => `Expected corresponding JSX closing tag for <${e}>.`,
|
|
2566
2566
|
MissingClosingTagFragment: "Expected corresponding JSX closing tag for <>.",
|
|
@@ -2570,20 +2570,20 @@ var L = h`jsx`({
|
|
|
2570
2570
|
UnterminatedJsxContent: "Unterminated JSX contents.",
|
|
2571
2571
|
UnwrappedAdjacentJSXElements: "Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?"
|
|
2572
2572
|
});
|
|
2573
|
-
function
|
|
2573
|
+
function L(e) {
|
|
2574
2574
|
return e ? e.type === "JSXOpeningFragment" || e.type === "JSXClosingFragment" : !1;
|
|
2575
2575
|
}
|
|
2576
|
-
function
|
|
2576
|
+
function R(e) {
|
|
2577
2577
|
if (e.type === "JSXIdentifier") return e.name;
|
|
2578
2578
|
if (e.type === "JSXNamespacedName") return e.namespace.name + ":" + e.name.name;
|
|
2579
|
-
if (e.type === "JSXMemberExpression") return
|
|
2579
|
+
if (e.type === "JSXMemberExpression") return R(e.object) + "." + R(e.property);
|
|
2580
2580
|
throw Error("Node had unexpected type: " + e.type);
|
|
2581
2581
|
}
|
|
2582
|
-
var
|
|
2582
|
+
var dt = (e) => class extends e {
|
|
2583
2583
|
jsxReadToken() {
|
|
2584
2584
|
let e = "", t = this.state.pos;
|
|
2585
2585
|
for (;;) {
|
|
2586
|
-
if (this.state.pos >= this.length) throw this.raise(
|
|
2586
|
+
if (this.state.pos >= this.length) throw this.raise(I.UnterminatedJsxContent, this.state.startLoc);
|
|
2587
2587
|
let n = this.input.charCodeAt(this.state.pos);
|
|
2588
2588
|
switch (n) {
|
|
2589
2589
|
case 60:
|
|
@@ -2598,11 +2598,11 @@ var ut = (e) => class extends e {
|
|
|
2598
2598
|
e += this.input.slice(t, this.state.pos), e += this.jsxReadEntity(), t = this.state.pos;
|
|
2599
2599
|
break;
|
|
2600
2600
|
case 62:
|
|
2601
|
-
case 125: this.raise(
|
|
2601
|
+
case 125: this.raise(I.UnexpectedToken, this.state.curPosition(), {
|
|
2602
2602
|
unexpected: this.input[this.state.pos],
|
|
2603
2603
|
HTMLEntity: n === 125 ? "}" : ">"
|
|
2604
2604
|
});
|
|
2605
|
-
default:
|
|
2605
|
+
default: F(n) ? (e += this.input.slice(t, this.state.pos), e += this.jsxReadNewLine(!0), t = this.state.pos) : ++this.state.pos;
|
|
2606
2606
|
}
|
|
2607
2607
|
}
|
|
2608
2608
|
}
|
|
@@ -2616,7 +2616,7 @@ var ut = (e) => class extends e {
|
|
|
2616
2616
|
if (this.state.pos >= this.length) throw this.raise(g.UnterminatedString, this.state.startLoc);
|
|
2617
2617
|
let r = this.input.charCodeAt(this.state.pos);
|
|
2618
2618
|
if (r === e) break;
|
|
2619
|
-
r === 38 ? (t += this.input.slice(n, this.state.pos), t += this.jsxReadEntity(), n = this.state.pos) :
|
|
2619
|
+
r === 38 ? (t += this.input.slice(n, this.state.pos), t += this.jsxReadEntity(), n = this.state.pos) : F(r) ? (t += this.input.slice(n, this.state.pos), t += this.jsxReadNewLine(!1), n = this.state.pos) : ++this.state.pos;
|
|
2620
2620
|
}
|
|
2621
2621
|
t += this.input.slice(n, this.state.pos++), this.finishToken(130, t);
|
|
2622
2622
|
}
|
|
@@ -2632,7 +2632,7 @@ var ut = (e) => class extends e {
|
|
|
2632
2632
|
let t = 0, n = !1;
|
|
2633
2633
|
for (; t++ < 10 && this.state.pos < this.length && !(n = this.codePointAtPos(this.state.pos) === 59);) ++this.state.pos;
|
|
2634
2634
|
if (n) {
|
|
2635
|
-
let t =
|
|
2635
|
+
let t = at[this.input.slice(e, this.state.pos)];
|
|
2636
2636
|
if (++this.state.pos, t) return t;
|
|
2637
2637
|
}
|
|
2638
2638
|
}
|
|
@@ -2642,7 +2642,7 @@ var ut = (e) => class extends e {
|
|
|
2642
2642
|
let e, t = this.state.pos;
|
|
2643
2643
|
do
|
|
2644
2644
|
e = this.input.charCodeAt(++this.state.pos);
|
|
2645
|
-
while (
|
|
2645
|
+
while (N(e) || e === 45);
|
|
2646
2646
|
this.finishToken(136, this.input.slice(t, this.state.pos));
|
|
2647
2647
|
}
|
|
2648
2648
|
jsxParseIdentifier() {
|
|
@@ -2667,10 +2667,10 @@ var ut = (e) => class extends e {
|
|
|
2667
2667
|
jsxParseAttributeValue() {
|
|
2668
2668
|
let e;
|
|
2669
2669
|
switch (this.state.type) {
|
|
2670
|
-
case 2: return e = this.startNode(), this.setContext(
|
|
2670
|
+
case 2: return e = this.startNode(), this.setContext(j.brace), this.next(), e = this.jsxParseExpressionContainer(e, j.j_oTag), e.expression.type === "JSXEmptyExpression" && this.raise(I.AttributeIsEmpty, e), e;
|
|
2671
2671
|
case 138:
|
|
2672
2672
|
case 130: return this.parseExprAtom();
|
|
2673
|
-
default: throw this.raise(
|
|
2673
|
+
default: throw this.raise(I.UnsupportedJsxValue, this.state.startLoc);
|
|
2674
2674
|
}
|
|
2675
2675
|
}
|
|
2676
2676
|
jsxParseEmptyExpression() {
|
|
@@ -2678,20 +2678,20 @@ var ut = (e) => class extends e {
|
|
|
2678
2678
|
return this.finishNodeAt(e, "JSXEmptyExpression", this.state.startLoc);
|
|
2679
2679
|
}
|
|
2680
2680
|
jsxParseSpreadChild(e) {
|
|
2681
|
-
return this.next(), e.expression = this.parseExpression(), this.setContext(
|
|
2681
|
+
return this.next(), e.expression = this.parseExpression(), this.setContext(j.j_expr), this.state.canStartJSXElement = !0, this.expect(4), this.finishNode(e, "JSXSpreadChild");
|
|
2682
2682
|
}
|
|
2683
2683
|
jsxParseExpressionContainer(e, t) {
|
|
2684
2684
|
if (this.match(4)) e.expression = this.jsxParseEmptyExpression();
|
|
2685
2685
|
else {
|
|
2686
2686
|
let t = this.parseExpression();
|
|
2687
|
-
t.type === "SequenceExpression" && !t.extra?.parenthesized && this.raise(
|
|
2687
|
+
t.type === "SequenceExpression" && !t.extra?.parenthesized && this.raise(I.UnexpectedSequenceExpression, t.expressions[1]), e.expression = t;
|
|
2688
2688
|
}
|
|
2689
2689
|
return this.setContext(t), this.state.canStartJSXElement = !0, this.expect(4), this.finishNode(e, "JSXExpressionContainer");
|
|
2690
2690
|
}
|
|
2691
2691
|
jsxParseAttribute() {
|
|
2692
2692
|
if (this.match(2)) {
|
|
2693
2693
|
let e = this.startNode();
|
|
2694
|
-
return this.setContext(
|
|
2694
|
+
return this.setContext(j.brace), this.next(), this.expect(17), e.argument = this.parseMaybeAssignAllowIn(), this.setContext(j.j_oTag), this.state.canStartJSXElement = !0, this.expect(4), this.finishNode(e, "JSXSpreadAttribute");
|
|
2695
2695
|
}
|
|
2696
2696
|
let e = this.startNode();
|
|
2697
2697
|
return e.name = this.jsxParseNamespacedName(), e.value = this.eat(25) ? this.jsxParseAttributeValue() : null, this.finishNode(e, "JSXAttribute");
|
|
@@ -2733,15 +2733,15 @@ var ut = (e) => class extends e {
|
|
|
2733
2733
|
break;
|
|
2734
2734
|
case 2: {
|
|
2735
2735
|
let e = this.startNode();
|
|
2736
|
-
this.setContext(
|
|
2736
|
+
this.setContext(j.brace), this.next(), this.match(17) ? n.push(this.jsxParseSpreadChild(e)) : n.push(this.jsxParseExpressionContainer(e, j.j_expr));
|
|
2737
2737
|
break;
|
|
2738
2738
|
}
|
|
2739
2739
|
default: this.unexpected();
|
|
2740
2740
|
}
|
|
2741
|
-
|
|
2741
|
+
L(r) && !L(i) && i !== null ? this.raise(I.MissingClosingTagFragment, i) : (!L(r) && L(i) || !L(r) && !L(i) && R(i.name) !== R(r.name)) && this.raise(I.MissingClosingTagElement, i, { openingTagName: R(r.name) });
|
|
2742
2742
|
}
|
|
2743
|
-
if (
|
|
2744
|
-
return
|
|
2743
|
+
if (L(r) ? (t.openingFragment = r, t.closingFragment = i) : (t.openingElement = r, t.closingElement = i), t.children = n, this.match(43)) throw this.raise(I.UnwrappedAdjacentJSXElements, this.state.startLoc);
|
|
2744
|
+
return L(r) ? this.finishNode(t, "JSXFragment") : this.finishNode(t, "JSXElement");
|
|
2745
2745
|
}
|
|
2746
2746
|
jsxParseElement() {
|
|
2747
2747
|
let e = this.state.startLoc;
|
|
@@ -2759,12 +2759,12 @@ var ut = (e) => class extends e {
|
|
|
2759
2759
|
}
|
|
2760
2760
|
getTokenFromCode(e) {
|
|
2761
2761
|
let t = this.curContext();
|
|
2762
|
-
if (t ===
|
|
2762
|
+
if (t === j.j_expr) {
|
|
2763
2763
|
this.jsxReadToken();
|
|
2764
2764
|
return;
|
|
2765
2765
|
}
|
|
2766
|
-
if (t ===
|
|
2767
|
-
if (
|
|
2766
|
+
if (t === j.j_oTag || t === j.j_cTag) {
|
|
2767
|
+
if (M(e)) {
|
|
2768
2768
|
this.jsxReadWord();
|
|
2769
2769
|
return;
|
|
2770
2770
|
}
|
|
@@ -2772,7 +2772,7 @@ var ut = (e) => class extends e {
|
|
|
2772
2772
|
++this.state.pos, this.finishToken(139);
|
|
2773
2773
|
return;
|
|
2774
2774
|
}
|
|
2775
|
-
if ((e === 34 || e === 39) && t ===
|
|
2775
|
+
if ((e === 34 || e === 39) && t === j.j_oTag) {
|
|
2776
2776
|
this.jsxReadString(e);
|
|
2777
2777
|
return;
|
|
2778
2778
|
}
|
|
@@ -2785,23 +2785,23 @@ var ut = (e) => class extends e {
|
|
|
2785
2785
|
}
|
|
2786
2786
|
updateContext(e) {
|
|
2787
2787
|
let { context: t, type: n } = this.state;
|
|
2788
|
-
if (n === 52 && e === 138) t.splice(-2, 2,
|
|
2789
|
-
else if (n === 138) t.push(
|
|
2788
|
+
if (n === 52 && e === 138) t.splice(-2, 2, j.j_cTag), this.state.canStartJSXElement = !1;
|
|
2789
|
+
else if (n === 138) t.push(j.j_oTag);
|
|
2790
2790
|
else if (n === 139) {
|
|
2791
2791
|
let n = t[t.length - 1];
|
|
2792
|
-
n ===
|
|
2792
|
+
n === j.j_oTag && e === 52 || n === j.j_cTag ? (t.pop(), this.state.canStartJSXElement = t[t.length - 1] === j.j_expr) : (this.setContext(j.j_expr), this.state.canStartJSXElement = !0);
|
|
2793
2793
|
} else this.state.canStartJSXElement = ge(n);
|
|
2794
2794
|
}
|
|
2795
|
-
}, dt = class extends qe {
|
|
2796
|
-
tsNames = /* @__PURE__ */ new Map();
|
|
2797
2795
|
}, ft = class extends Je {
|
|
2796
|
+
tsNames = /* @__PURE__ */ new Map();
|
|
2797
|
+
}, pt = class extends Ye {
|
|
2798
2798
|
get inTSNamespace() {
|
|
2799
2799
|
let e = this.scopeStack;
|
|
2800
2800
|
return e.length >= 2 && e[e.length - 1].flags === 0 && (e[e.length - 2].flags & 2048) > 0;
|
|
2801
2801
|
}
|
|
2802
2802
|
importsStack = [];
|
|
2803
2803
|
createScope(e) {
|
|
2804
|
-
return this.importsStack.push(/* @__PURE__ */ new Set()), new
|
|
2804
|
+
return this.importsStack.push(/* @__PURE__ */ new Set()), new ft(e);
|
|
2805
2805
|
}
|
|
2806
2806
|
enter(e) {
|
|
2807
2807
|
e & 3072 && this.importsStack.push(/* @__PURE__ */ new Set()), super.enter(e);
|
|
@@ -2844,7 +2844,7 @@ var ut = (e) => class extends e {
|
|
|
2844
2844
|
}
|
|
2845
2845
|
super.checkLocalExport(e);
|
|
2846
2846
|
}
|
|
2847
|
-
},
|
|
2847
|
+
}, mt = class {
|
|
2848
2848
|
sawUnambiguousESM = !1;
|
|
2849
2849
|
ambiguousScriptDifferentAst = !1;
|
|
2850
2850
|
sourceToOffsetPos(e) {
|
|
@@ -2867,21 +2867,21 @@ var ut = (e) => class extends e {
|
|
|
2867
2867
|
return this.plugins.get(e)?.[t];
|
|
2868
2868
|
}
|
|
2869
2869
|
};
|
|
2870
|
-
function
|
|
2870
|
+
function ht(e, t) {
|
|
2871
2871
|
e.trailingComments === void 0 ? e.trailingComments = t : e.trailingComments.unshift(...t);
|
|
2872
2872
|
}
|
|
2873
|
-
function
|
|
2873
|
+
function gt(e, t) {
|
|
2874
2874
|
e.leadingComments === void 0 ? e.leadingComments = t : e.leadingComments.unshift(...t);
|
|
2875
2875
|
}
|
|
2876
|
-
function
|
|
2876
|
+
function z(e, t) {
|
|
2877
2877
|
e.innerComments === void 0 ? e.innerComments = t : e.innerComments.unshift(...t);
|
|
2878
2878
|
}
|
|
2879
|
-
function
|
|
2879
|
+
function B(e, t, n) {
|
|
2880
2880
|
let r = null, i = t.length;
|
|
2881
2881
|
for (; r === null && i > 0;) r = t[--i];
|
|
2882
|
-
r === null || r.start > n.start ?
|
|
2882
|
+
r === null || r.start > n.start ? z(e, n.comments) : ht(r, n.comments);
|
|
2883
2883
|
}
|
|
2884
|
-
var
|
|
2884
|
+
var _t = class extends mt {
|
|
2885
2885
|
addComment(e) {
|
|
2886
2886
|
this.filename && (e.loc.filename = this.filename);
|
|
2887
2887
|
let { commentsLen: t } = this.state;
|
|
@@ -2904,21 +2904,21 @@ var gt = class extends pt {
|
|
|
2904
2904
|
}
|
|
2905
2905
|
finalizeComment(e) {
|
|
2906
2906
|
let { comments: t } = e;
|
|
2907
|
-
if (e.leadingNode !== null || e.trailingNode !== null) e.leadingNode !== null &&
|
|
2907
|
+
if (e.leadingNode !== null || e.trailingNode !== null) e.leadingNode !== null && ht(e.leadingNode, t), e.trailingNode !== null && gt(e.trailingNode, t);
|
|
2908
2908
|
else {
|
|
2909
2909
|
let n = e.containingNode, r = e.start;
|
|
2910
2910
|
if (this.input.charCodeAt(this.offsetToSourcePos(r) - 1) === 44) switch (n.type) {
|
|
2911
2911
|
case "ObjectExpression":
|
|
2912
2912
|
case "ObjectPattern":
|
|
2913
|
-
|
|
2913
|
+
B(n, n.properties, e);
|
|
2914
2914
|
break;
|
|
2915
2915
|
case "CallExpression":
|
|
2916
2916
|
case "NewExpression":
|
|
2917
2917
|
case "OptionalCallExpression":
|
|
2918
|
-
|
|
2918
|
+
B(n, n.arguments, e);
|
|
2919
2919
|
break;
|
|
2920
2920
|
case "ImportExpression":
|
|
2921
|
-
|
|
2921
|
+
B(n, [n.source, n.options ?? null], e);
|
|
2922
2922
|
break;
|
|
2923
2923
|
case "FunctionDeclaration":
|
|
2924
2924
|
case "FunctionExpression":
|
|
@@ -2927,25 +2927,25 @@ var gt = class extends pt {
|
|
|
2927
2927
|
case "ClassMethod":
|
|
2928
2928
|
case "ClassPrivateMethod":
|
|
2929
2929
|
case "TSTypeParameterDeclaration":
|
|
2930
|
-
|
|
2930
|
+
B(n, n.params, e);
|
|
2931
2931
|
break;
|
|
2932
2932
|
case "ArrayExpression":
|
|
2933
2933
|
case "ArrayPattern":
|
|
2934
|
-
|
|
2934
|
+
B(n, n.elements, e);
|
|
2935
2935
|
break;
|
|
2936
2936
|
case "ExportNamedDeclaration":
|
|
2937
2937
|
case "ImportDeclaration":
|
|
2938
|
-
|
|
2938
|
+
B(n, n.specifiers, e);
|
|
2939
2939
|
break;
|
|
2940
2940
|
case "TSEnumBody":
|
|
2941
|
-
|
|
2941
|
+
B(n, n.members, e);
|
|
2942
2942
|
break;
|
|
2943
2943
|
case "TSInterfaceBody":
|
|
2944
|
-
|
|
2944
|
+
B(n, n.body, e);
|
|
2945
2945
|
break;
|
|
2946
|
-
default:
|
|
2946
|
+
default: z(n, t);
|
|
2947
2947
|
}
|
|
2948
|
-
else
|
|
2948
|
+
else z(n, t);
|
|
2949
2949
|
}
|
|
2950
2950
|
}
|
|
2951
2951
|
finalizeRemainingComments() {
|
|
@@ -2970,7 +2970,7 @@ var gt = class extends pt {
|
|
|
2970
2970
|
else if (o < t) break;
|
|
2971
2971
|
}
|
|
2972
2972
|
}
|
|
2973
|
-
},
|
|
2973
|
+
}, vt = class t {
|
|
2974
2974
|
flags = 2048;
|
|
2975
2975
|
get strict() {
|
|
2976
2976
|
return (this.flags & 1) > 0;
|
|
@@ -3059,7 +3059,7 @@ var gt = class extends pt {
|
|
|
3059
3059
|
end = 0;
|
|
3060
3060
|
lastTokEndLoc = null;
|
|
3061
3061
|
lastTokStartLoc = null;
|
|
3062
|
-
context = [
|
|
3062
|
+
context = [j.brace];
|
|
3063
3063
|
get canStartJSXElement() {
|
|
3064
3064
|
return (this.flags & 2048) > 0;
|
|
3065
3065
|
}
|
|
@@ -3088,9 +3088,9 @@ var gt = class extends pt {
|
|
|
3088
3088
|
let e = new t();
|
|
3089
3089
|
return e.flags = this.flags, e.startIndex = this.startIndex, e.curLine = this.curLine, e.lineStart = this.lineStart, e.startLoc = this.startLoc, e.endLoc = this.endLoc, e.errors = this.errors.slice(), e.noArrowAt = this.noArrowAt.slice(), e.noArrowParamsConversionAt = this.noArrowParamsConversionAt.slice(), e.labels = this.labels.slice(), e.commentsLen = this.commentsLen, e.commentStack = this.commentStack.slice(), e.pos = this.pos, e.type = this.type, e.value = this.value, e.start = this.start, e.end = this.end, e.lastTokEndLoc = this.lastTokEndLoc, e.lastTokStartLoc = this.lastTokStartLoc, e.context = this.context.slice(), e.firstInvalidTemplateEscapePos = this.firstInvalidTemplateEscapePos, e.strictErrors = this.strictErrors, e.tokensLength = this.tokensLength, e;
|
|
3090
3090
|
}
|
|
3091
|
-
},
|
|
3091
|
+
}, yt = function(e) {
|
|
3092
3092
|
return e >= 48 && e <= 57;
|
|
3093
|
-
},
|
|
3093
|
+
}, bt = {
|
|
3094
3094
|
decBinOct: /* @__PURE__ */ new Set([
|
|
3095
3095
|
46,
|
|
3096
3096
|
66,
|
|
@@ -3107,13 +3107,13 @@ var gt = class extends pt {
|
|
|
3107
3107
|
95,
|
|
3108
3108
|
120
|
|
3109
3109
|
])
|
|
3110
|
-
},
|
|
3110
|
+
}, xt = {
|
|
3111
3111
|
bin: (e) => e === 48 || e === 49,
|
|
3112
3112
|
oct: (e) => e >= 48 && e <= 55,
|
|
3113
3113
|
dec: (e) => e >= 48 && e <= 57,
|
|
3114
3114
|
hex: (e) => e >= 48 && e <= 57 || e >= 65 && e <= 70 || e >= 97 && e <= 102
|
|
3115
3115
|
};
|
|
3116
|
-
function
|
|
3116
|
+
function St(e, t, n, r, i, a) {
|
|
3117
3117
|
let o = n, s = r, c = i, l = "", u = null, d = n, { length: f } = t;
|
|
3118
3118
|
for (;;) {
|
|
3119
3119
|
if (n >= f) {
|
|
@@ -3121,13 +3121,13 @@ function xt(e, t, n, r, i, a) {
|
|
|
3121
3121
|
break;
|
|
3122
3122
|
}
|
|
3123
3123
|
let p = t.charCodeAt(n);
|
|
3124
|
-
if (
|
|
3124
|
+
if (Ct(e, p, t, n)) {
|
|
3125
3125
|
l += t.slice(d, n);
|
|
3126
3126
|
break;
|
|
3127
3127
|
}
|
|
3128
3128
|
if (p === 92) {
|
|
3129
3129
|
l += t.slice(d, n);
|
|
3130
|
-
let o =
|
|
3130
|
+
let o = wt(t, n, r, i, e === "template", a);
|
|
3131
3131
|
o.ch === null && !u ? u = {
|
|
3132
3132
|
pos: n,
|
|
3133
3133
|
lineStart: r,
|
|
@@ -3143,10 +3143,10 @@ function xt(e, t, n, r, i, a) {
|
|
|
3143
3143
|
curLine: i
|
|
3144
3144
|
};
|
|
3145
3145
|
}
|
|
3146
|
-
function
|
|
3146
|
+
function Ct(e, t, n, r) {
|
|
3147
3147
|
return e === "template" ? t === 96 || t === 36 && n.charCodeAt(r + 1) === 123 : t === (e === "double" ? 34 : 39);
|
|
3148
3148
|
}
|
|
3149
|
-
function
|
|
3149
|
+
function wt(e, t, n, r, i, a) {
|
|
3150
3150
|
let o = !i;
|
|
3151
3151
|
t++;
|
|
3152
3152
|
let s = (e) => ({
|
|
@@ -3160,11 +3160,11 @@ function Ct(e, t, n, r, i, a) {
|
|
|
3160
3160
|
case 114: return s("\r");
|
|
3161
3161
|
case 120: {
|
|
3162
3162
|
let i;
|
|
3163
|
-
return {code: i, pos: t} =
|
|
3163
|
+
return {code: i, pos: t} = Tt(e, t, n, r, 2, !1, o, a), s(i === null ? null : String.fromCharCode(i));
|
|
3164
3164
|
}
|
|
3165
3165
|
case 117: {
|
|
3166
3166
|
let i;
|
|
3167
|
-
return {code: i, pos: t} =
|
|
3167
|
+
return {code: i, pos: t} = Dt(e, t, n, r, o, a), s(i === null ? null : String.fromCodePoint(i));
|
|
3168
3168
|
}
|
|
3169
3169
|
case 116: return s(" ");
|
|
3170
3170
|
case 98: return s("\b");
|
|
@@ -3192,15 +3192,15 @@ function Ct(e, t, n, r, i, a) {
|
|
|
3192
3192
|
return s(String.fromCharCode(c));
|
|
3193
3193
|
}
|
|
3194
3194
|
}
|
|
3195
|
-
function
|
|
3195
|
+
function Tt(e, t, n, r, i, a, o, s) {
|
|
3196
3196
|
let c = t, l;
|
|
3197
|
-
return {n: l, pos: t} =
|
|
3197
|
+
return {n: l, pos: t} = Et(e, t, n, r, 16, i, a, !1, s, !o), l === null && (o ? s.invalidEscapeSequence(c, n, r) : t = c - 1), {
|
|
3198
3198
|
code: l,
|
|
3199
3199
|
pos: t
|
|
3200
3200
|
};
|
|
3201
3201
|
}
|
|
3202
|
-
function
|
|
3203
|
-
let u = t, d = i === 16 ?
|
|
3202
|
+
function Et(e, t, n, r, i, a, o, s, c, l) {
|
|
3203
|
+
let u = t, d = i === 16 ? bt.hex : bt.decBinOct, f = i === 16 ? xt.hex : i === 10 ? xt.dec : i === 8 ? xt.oct : xt.bin, p = !1, m = 0;
|
|
3204
3204
|
for (let u = 0, h = a ?? Infinity; u < h; ++u) {
|
|
3205
3205
|
let a = e.charCodeAt(t), u;
|
|
3206
3206
|
if (a === 95 && s !== "bail") {
|
|
@@ -3221,7 +3221,7 @@ function Tt(e, t, n, r, i, a, o, s, c, l) {
|
|
|
3221
3221
|
++t;
|
|
3222
3222
|
continue;
|
|
3223
3223
|
}
|
|
3224
|
-
if (u = a >= 97 ? a - 97 + 10 : a >= 65 ? a - 65 + 10 :
|
|
3224
|
+
if (u = a >= 97 ? a - 97 + 10 : a >= 65 ? a - 65 + 10 : yt(a) ? a - 48 : Infinity, u >= i) {
|
|
3225
3225
|
if (u <= 9 && l) return {
|
|
3226
3226
|
n: null,
|
|
3227
3227
|
pos: t
|
|
@@ -3240,26 +3240,26 @@ function Tt(e, t, n, r, i, a, o, s, c, l) {
|
|
|
3240
3240
|
pos: t
|
|
3241
3241
|
};
|
|
3242
3242
|
}
|
|
3243
|
-
function
|
|
3243
|
+
function Dt(e, t, n, r, i, a) {
|
|
3244
3244
|
let o = e.charCodeAt(t), s;
|
|
3245
3245
|
if (o === 123) {
|
|
3246
|
-
if (++t, {code: s, pos: t} =
|
|
3246
|
+
if (++t, {code: s, pos: t} = Tt(e, t, n, r, e.indexOf("}", t) - t, !0, i, a), ++t, s !== null && s > 1114111) {
|
|
3247
3247
|
if (i) a.invalidCodePoint(t, n, r);
|
|
3248
3248
|
else return {
|
|
3249
3249
|
code: null,
|
|
3250
3250
|
pos: t
|
|
3251
3251
|
};
|
|
3252
3252
|
}
|
|
3253
|
-
} else ({code: s, pos: t} =
|
|
3253
|
+
} else ({code: s, pos: t} = Tt(e, t, n, r, 4, !1, i, a));
|
|
3254
3254
|
return {
|
|
3255
3255
|
code: s,
|
|
3256
3256
|
pos: t
|
|
3257
3257
|
};
|
|
3258
3258
|
}
|
|
3259
|
-
function
|
|
3259
|
+
function V(t, n, r) {
|
|
3260
3260
|
return new e(r, t - n, t);
|
|
3261
3261
|
}
|
|
3262
|
-
var
|
|
3262
|
+
var Ot = /* @__PURE__ */ new Set([
|
|
3263
3263
|
103,
|
|
3264
3264
|
109,
|
|
3265
3265
|
115,
|
|
@@ -3268,16 +3268,16 @@ var Dt = /* @__PURE__ */ new Set([
|
|
|
3268
3268
|
117,
|
|
3269
3269
|
100,
|
|
3270
3270
|
118
|
|
3271
|
-
]),
|
|
3271
|
+
]), kt = class {
|
|
3272
3272
|
constructor(e) {
|
|
3273
3273
|
let n = e.startIndex || 0;
|
|
3274
3274
|
this.type = e.type, this.value = e.value, this.start = n + e.start, this.end = n + e.end, this.loc = new t(e.startLoc, e.endLoc);
|
|
3275
3275
|
}
|
|
3276
|
-
},
|
|
3276
|
+
}, At, jt = class extends _t {
|
|
3277
3277
|
isLookahead;
|
|
3278
3278
|
tokens = [];
|
|
3279
3279
|
constructor(e, t) {
|
|
3280
|
-
super(), this.state = new
|
|
3280
|
+
super(), this.state = new vt(), this.state.init(e), this.input = t, this.length = t.length, this.comments = [], this.isLookahead = !1, (!At || At.length < (this.length + 1) * 2) && (At = new Uint32Array((this.length + 1) * 2)), this.locData = At;
|
|
3281
3281
|
}
|
|
3282
3282
|
setLoc(e) {
|
|
3283
3283
|
let t = this.offsetToSourcePos(e.index);
|
|
@@ -3291,7 +3291,7 @@ var Dt = /* @__PURE__ */ new Set([
|
|
|
3291
3291
|
this.tokens.length = this.state.tokensLength, this.tokens.push(e), ++this.state.tokensLength;
|
|
3292
3292
|
}
|
|
3293
3293
|
next() {
|
|
3294
|
-
this.checkKeywordEscapes(), this.optionFlags & 512 && this.pushToken(new
|
|
3294
|
+
this.checkKeywordEscapes(), this.optionFlags & 512 && this.pushToken(new kt(this.state)), this.state.lastTokEndLoc = this.state.endLoc, this.state.lastTokStartLoc = this.state.startLoc, this.nextToken();
|
|
3295
3295
|
}
|
|
3296
3296
|
eat(e) {
|
|
3297
3297
|
return this.match(e) ? (this.next(), !0) : !1;
|
|
@@ -3325,7 +3325,7 @@ var Dt = /* @__PURE__ */ new Set([
|
|
|
3325
3325
|
return this.nextTokenStartSince(this.state.pos);
|
|
3326
3326
|
}
|
|
3327
3327
|
nextTokenStartSince(e) {
|
|
3328
|
-
return
|
|
3328
|
+
return ct.lastIndex = e, ct.test(this.input) ? ct.lastIndex : e;
|
|
3329
3329
|
}
|
|
3330
3330
|
lookaheadCharCode() {
|
|
3331
3331
|
return this.lookaheadCharCodeSince(this.state.pos);
|
|
@@ -3337,7 +3337,7 @@ var Dt = /* @__PURE__ */ new Set([
|
|
|
3337
3337
|
return this.nextTokenInLineStartSince(this.state.pos);
|
|
3338
3338
|
}
|
|
3339
3339
|
nextTokenInLineStartSince(e) {
|
|
3340
|
-
return
|
|
3340
|
+
return lt.lastIndex = e, lt.test(this.input) ? lt.lastIndex : e;
|
|
3341
3341
|
}
|
|
3342
3342
|
lookaheadInLineCharCode() {
|
|
3343
3343
|
return this.input.charCodeAt(this.nextTokenInLineStart());
|
|
@@ -3368,7 +3368,7 @@ var Dt = /* @__PURE__ */ new Set([
|
|
|
3368
3368
|
this.isLookahead || (n = this.state.curPosition());
|
|
3369
3369
|
let r = this.state.pos, i = this.input.indexOf(e, r + 2);
|
|
3370
3370
|
if (i === -1) throw this.raise(g.UnterminatedComment, this.state.curPosition());
|
|
3371
|
-
for (this.state.pos = i + e.length,
|
|
3371
|
+
for (this.state.pos = i + e.length, ot.lastIndex = r + 2; ot.test(this.input) && ot.lastIndex <= i;) ++this.state.curLine, this.state.lineStart = ot.lastIndex;
|
|
3372
3372
|
if (this.isLookahead) return;
|
|
3373
3373
|
let a = {
|
|
3374
3374
|
type: "CommentBlock",
|
|
@@ -3383,7 +3383,7 @@ var Dt = /* @__PURE__ */ new Set([
|
|
|
3383
3383
|
let n = this.state.pos, r;
|
|
3384
3384
|
this.isLookahead || (r = this.state.curPosition());
|
|
3385
3385
|
let i = this.input.charCodeAt(this.state.pos += e);
|
|
3386
|
-
if (this.state.pos < this.length) for (; !
|
|
3386
|
+
if (this.state.pos < this.length) for (; !F(i) && ++this.state.pos < this.length;) i = this.input.charCodeAt(this.state.pos);
|
|
3387
3387
|
if (this.isLookahead) return;
|
|
3388
3388
|
let a = this.state.pos, o = {
|
|
3389
3389
|
type: "CommentLine",
|
|
@@ -3425,7 +3425,7 @@ var Dt = /* @__PURE__ */ new Set([
|
|
|
3425
3425
|
default: break loop;
|
|
3426
3426
|
}
|
|
3427
3427
|
break;
|
|
3428
|
-
default: if (
|
|
3428
|
+
default: if (ut(n)) ++this.state.pos;
|
|
3429
3429
|
else if (n === 45 && !this.inModule && this.optionFlags & 16384) {
|
|
3430
3430
|
let n = this.state.pos;
|
|
3431
3431
|
if (this.input.charCodeAt(n + 1) === 45 && this.input.charCodeAt(n + 2) === 62 && (e === 0 || this.state.lineStart > e)) {
|
|
@@ -3465,7 +3465,7 @@ var Dt = /* @__PURE__ */ new Set([
|
|
|
3465
3465
|
if (this.state.pos === 0 && this.readToken_interpreter()) return;
|
|
3466
3466
|
let e = this.state.pos + 1, t = this.codePointAtPos(e);
|
|
3467
3467
|
if (t >= 48 && t <= 57) throw this.raise(g.UnexpectedDigitAfterHash, this.state.curPosition());
|
|
3468
|
-
|
|
3468
|
+
M(t) ? (++this.state.pos, this.finishToken(134, this.readWord1(t))) : t === 92 ? (++this.state.pos, this.finishToken(134, this.readWord1())) : this.finishOp(23, 1);
|
|
3469
3469
|
}
|
|
3470
3470
|
readToken_dot() {
|
|
3471
3471
|
let e = this.input.charCodeAt(this.state.pos + 1);
|
|
@@ -3483,7 +3483,7 @@ var Dt = /* @__PURE__ */ new Set([
|
|
|
3483
3483
|
let e = this.input.charCodeAt(this.state.pos + 1);
|
|
3484
3484
|
if (e !== 33) return !1;
|
|
3485
3485
|
let t = this.state.pos;
|
|
3486
|
-
for (this.state.pos += 1; !
|
|
3486
|
+
for (this.state.pos += 1; !F(e) && ++this.state.pos < this.length;) e = this.input.charCodeAt(this.state.pos);
|
|
3487
3487
|
let n = this.input.slice(t + 2, this.state.pos);
|
|
3488
3488
|
return this.finishToken(24, n), !0;
|
|
3489
3489
|
}
|
|
@@ -3685,7 +3685,7 @@ var Dt = /* @__PURE__ */ new Set([
|
|
|
3685
3685
|
case 92:
|
|
3686
3686
|
this.readWord();
|
|
3687
3687
|
return;
|
|
3688
|
-
default: if (
|
|
3688
|
+
default: if (M(e)) {
|
|
3689
3689
|
this.readWord(e);
|
|
3690
3690
|
return;
|
|
3691
3691
|
}
|
|
@@ -3701,7 +3701,7 @@ var Dt = /* @__PURE__ */ new Set([
|
|
|
3701
3701
|
for (;; ++a) {
|
|
3702
3702
|
if (a >= this.length) throw this.raise(g.UnterminatedRegExp, n(e, 1));
|
|
3703
3703
|
let t = this.input.charCodeAt(a);
|
|
3704
|
-
if (
|
|
3704
|
+
if (F(t)) throw this.raise(g.UnterminatedRegExp, n(e, 1));
|
|
3705
3705
|
if (r) r = !1;
|
|
3706
3706
|
else {
|
|
3707
3707
|
if (t === 91) i = !0;
|
|
@@ -3715,8 +3715,8 @@ var Dt = /* @__PURE__ */ new Set([
|
|
|
3715
3715
|
let s = "", c = () => n(e, a + 2 - t);
|
|
3716
3716
|
for (; a < this.length;) {
|
|
3717
3717
|
let e = this.codePointAtPos(a), t = String.fromCharCode(e);
|
|
3718
|
-
if (
|
|
3719
|
-
else if (
|
|
3718
|
+
if (Ot.has(e)) e === 118 ? s.includes("u") && this.raise(g.IncompatibleRegExpUVFlags, c()) : e === 117 && s.includes("v") && this.raise(g.IncompatibleRegExpUVFlags, c()), s.includes(t) && this.raise(g.DuplicateRegExpFlags, c());
|
|
3719
|
+
else if (N(e) || e === 92) this.raise(g.MalformedRegExpFlags, c());
|
|
3720
3720
|
else break;
|
|
3721
3721
|
++a, s += t;
|
|
3722
3722
|
}
|
|
@@ -3726,14 +3726,14 @@ var Dt = /* @__PURE__ */ new Set([
|
|
|
3726
3726
|
});
|
|
3727
3727
|
}
|
|
3728
3728
|
readInt(e, t, n = !1, r = !0) {
|
|
3729
|
-
let { n: i, pos: a } =
|
|
3729
|
+
let { n: i, pos: a } = Et(this.input, this.state.pos, this.state.lineStart, this.state.curLine, e, t, n, r, this.errorHandlers_readInt, !1);
|
|
3730
3730
|
return this.state.pos = a, i;
|
|
3731
3731
|
}
|
|
3732
3732
|
readRadixNumber(e) {
|
|
3733
3733
|
let t = this.state.pos, r = this.state.curPosition(), i = !1;
|
|
3734
3734
|
this.state.pos += 2;
|
|
3735
3735
|
let a = this.readInt(e);
|
|
3736
|
-
if (a ?? this.raise(g.InvalidDigit, n(r, 2), { radix: e }), this.input.charCodeAt(this.state.pos) === 110 && (++this.state.pos, i = !0),
|
|
3736
|
+
if (a ?? this.raise(g.InvalidDigit, n(r, 2), { radix: e }), this.input.charCodeAt(this.state.pos) === 110 && (++this.state.pos, i = !0), M(this.codePointAtPos(this.state.pos))) throw this.raise(g.NumberIdentifier, this.state.curPosition());
|
|
3737
3737
|
if (i) {
|
|
3738
3738
|
let e = this.input.slice(t, this.state.pos).replace(/[_n]/g, "");
|
|
3739
3739
|
this.finishToken(132, e);
|
|
@@ -3756,7 +3756,7 @@ var Dt = /* @__PURE__ */ new Set([
|
|
|
3756
3756
|
let c = this.input.charCodeAt(this.state.pos);
|
|
3757
3757
|
c === 46 && !o && (++this.state.pos, this.readInt(10), i = !0, c = this.input.charCodeAt(this.state.pos)), (c === 69 || c === 101) && !o && (c = this.input.charCodeAt(++this.state.pos), (c === 43 || c === 45) && ++this.state.pos, this.readInt(10) === null && this.raise(g.InvalidOrMissingExponent, r), i = !0, c = this.input.charCodeAt(this.state.pos));
|
|
3758
3758
|
let l = this.input.slice(t, this.state.pos).replaceAll("_", "");
|
|
3759
|
-
if (c === 110 && ((i || s) && this.raise(g.InvalidBigIntLiteral, r), ++this.state.pos, a = !0),
|
|
3759
|
+
if (c === 110 && ((i || s) && this.raise(g.InvalidBigIntLiteral, r), ++this.state.pos, a = !0), M(this.codePointAtPos(this.state.pos))) throw this.raise(g.NumberIdentifier, this.state.curPosition());
|
|
3760
3760
|
if (a) {
|
|
3761
3761
|
this.finishToken(132, l);
|
|
3762
3762
|
return;
|
|
@@ -3765,18 +3765,18 @@ var Dt = /* @__PURE__ */ new Set([
|
|
|
3765
3765
|
this.finishToken(131, u);
|
|
3766
3766
|
}
|
|
3767
3767
|
readCodePoint(e) {
|
|
3768
|
-
let { code: t, pos: n } =
|
|
3768
|
+
let { code: t, pos: n } = Dt(this.input, this.state.pos, this.state.lineStart, this.state.curLine, e, this.errorHandlers_readCodePoint);
|
|
3769
3769
|
return this.state.pos = n, t;
|
|
3770
3770
|
}
|
|
3771
3771
|
readString(e) {
|
|
3772
|
-
let { str: t, pos: n, curLine: r, lineStart: i } =
|
|
3772
|
+
let { str: t, pos: n, curLine: r, lineStart: i } = St(e === 34 ? "double" : "single", this.input, this.state.pos + 1, this.state.lineStart, this.state.curLine, this.errorHandlers_readStringContents_string);
|
|
3773
3773
|
this.state.pos = n + 1, this.state.lineStart = i, this.state.curLine = r, this.finishToken(130, t);
|
|
3774
3774
|
}
|
|
3775
3775
|
readTemplateContinuation() {
|
|
3776
3776
|
this.match(4) || this.unexpected(null, 4), this.state.pos--, this.readTemplateToken();
|
|
3777
3777
|
}
|
|
3778
3778
|
readTemplateToken() {
|
|
3779
|
-
let t = this.input[this.state.pos], { str: n, firstInvalidLoc: r, pos: i, curLine: a, lineStart: o } =
|
|
3779
|
+
let t = this.input[this.state.pos], { str: n, firstInvalidLoc: r, pos: i, curLine: a, lineStart: o } = St("template", this.input, this.state.pos + 1, this.state.lineStart, this.state.curLine, this.errorHandlers_readStringContents_template);
|
|
3780
3780
|
this.state.pos = i + 1, this.state.lineStart = o, this.state.curLine = a, r && (this.state.firstInvalidTemplateEscapePos = new e(r.curLine, r.pos - r.lineStart, this.sourceToOffsetPos(r.pos))), this.input.codePointAt(i) === 96 ? this.finishToken(20, r ? null : t + n + "`") : (this.state.pos++, this.finishToken(21, r ? null : t + n + "${"));
|
|
3781
3781
|
}
|
|
3782
3782
|
recordStrictModeErrors(e, t) {
|
|
@@ -3788,10 +3788,10 @@ var Dt = /* @__PURE__ */ new Set([
|
|
|
3788
3788
|
let t = "", n = this.state.pos, r = this.state.pos;
|
|
3789
3789
|
for (e !== void 0 && (this.state.pos += e <= 65535 ? 1 : 2); this.state.pos < this.length;) {
|
|
3790
3790
|
let e = this.codePointAtPos(this.state.pos);
|
|
3791
|
-
if (
|
|
3791
|
+
if (N(e)) this.state.pos += e <= 65535 ? 1 : 2;
|
|
3792
3792
|
else if (e === 92) {
|
|
3793
3793
|
this.state.containsEsc = !0, t += this.input.slice(r, this.state.pos);
|
|
3794
|
-
let e = this.state.curPosition(), i = this.state.pos === n ?
|
|
3794
|
+
let e = this.state.curPosition(), i = this.state.pos === n ? M : N;
|
|
3795
3795
|
if (this.input.charCodeAt(++this.state.pos) !== 117) {
|
|
3796
3796
|
this.raise(g.MissingUnicodeEscape, this.state.curPosition()), r = this.state.pos - 1;
|
|
3797
3797
|
continue;
|
|
@@ -3838,11 +3838,11 @@ var Dt = /* @__PURE__ */ new Set([
|
|
|
3838
3838
|
}
|
|
3839
3839
|
errorBuilder(e) {
|
|
3840
3840
|
return (t, n, r) => {
|
|
3841
|
-
this.raise(e,
|
|
3841
|
+
this.raise(e, V(t, n, r));
|
|
3842
3842
|
};
|
|
3843
3843
|
}
|
|
3844
3844
|
errorHandlers_readInt = {
|
|
3845
|
-
invalidDigit: (e, t, n, r) => this.optionFlags & 4096 ? (this.raise(g.InvalidDigit,
|
|
3845
|
+
invalidDigit: (e, t, n, r) => this.optionFlags & 4096 ? (this.raise(g.InvalidDigit, V(e, t, n), { radix: r }), !0) : !1,
|
|
3846
3846
|
numericSeparatorInEscapeSequence: this.errorBuilder(g.NumericSeparatorInEscapeSequence),
|
|
3847
3847
|
unexpectedNumericSeparator: this.errorBuilder(g.UnexpectedNumericSeparator)
|
|
3848
3848
|
};
|
|
@@ -3854,24 +3854,24 @@ var Dt = /* @__PURE__ */ new Set([
|
|
|
3854
3854
|
errorHandlers_readStringContents_string = {
|
|
3855
3855
|
...this.errorHandlers_readCodePoint,
|
|
3856
3856
|
strictNumericEscape: (e, t, n) => {
|
|
3857
|
-
this.recordStrictModeErrors(g.StrictNumericEscape,
|
|
3857
|
+
this.recordStrictModeErrors(g.StrictNumericEscape, V(e, t, n));
|
|
3858
3858
|
},
|
|
3859
3859
|
unterminated: (e, t, n) => {
|
|
3860
|
-
throw this.raise(g.UnterminatedString,
|
|
3860
|
+
throw this.raise(g.UnterminatedString, V(e - 1, t, n));
|
|
3861
3861
|
}
|
|
3862
3862
|
};
|
|
3863
3863
|
errorHandlers_readStringContents_template = {
|
|
3864
3864
|
...this.errorHandlers_readCodePoint,
|
|
3865
3865
|
strictNumericEscape: this.errorBuilder(g.StrictNumericEscape),
|
|
3866
3866
|
unterminated: (e, t, n) => {
|
|
3867
|
-
throw this.raise(g.UnterminatedTemplate,
|
|
3867
|
+
throw this.raise(g.UnterminatedTemplate, V(e, t, n));
|
|
3868
3868
|
}
|
|
3869
3869
|
};
|
|
3870
|
-
},
|
|
3870
|
+
}, Mt = class {
|
|
3871
3871
|
privateNames = /* @__PURE__ */ new Set();
|
|
3872
3872
|
loneAccessors = /* @__PURE__ */ new Map();
|
|
3873
3873
|
undefinedPrivateNames = /* @__PURE__ */ new Map();
|
|
3874
|
-
},
|
|
3874
|
+
}, Nt = class {
|
|
3875
3875
|
parser;
|
|
3876
3876
|
stack = [];
|
|
3877
3877
|
constructor(e) {
|
|
@@ -3881,7 +3881,7 @@ var Dt = /* @__PURE__ */ new Set([
|
|
|
3881
3881
|
return this.stack[this.stack.length - 1];
|
|
3882
3882
|
}
|
|
3883
3883
|
enter() {
|
|
3884
|
-
this.stack.push(new
|
|
3884
|
+
this.stack.push(new Mt());
|
|
3885
3885
|
}
|
|
3886
3886
|
exit() {
|
|
3887
3887
|
let e = this.stack.pop(), t = this.current();
|
|
@@ -3903,7 +3903,7 @@ var Dt = /* @__PURE__ */ new Set([
|
|
|
3903
3903
|
for (n of this.stack) if (n.privateNames.has(e)) return;
|
|
3904
3904
|
n ? n.undefinedPrivateNames.set(e, t) : this.parser.raise(g.InvalidPrivateFieldResolution, t, { identifierName: e });
|
|
3905
3905
|
}
|
|
3906
|
-
},
|
|
3906
|
+
}, Pt = class {
|
|
3907
3907
|
constructor(e = 0) {
|
|
3908
3908
|
this.type = e;
|
|
3909
3909
|
}
|
|
@@ -3913,7 +3913,7 @@ var Dt = /* @__PURE__ */ new Set([
|
|
|
3913
3913
|
isCertainlyParameterDeclaration() {
|
|
3914
3914
|
return this.type === 3;
|
|
3915
3915
|
}
|
|
3916
|
-
},
|
|
3916
|
+
}, Ft = class extends Pt {
|
|
3917
3917
|
declarationErrors = /* @__PURE__ */ new Map();
|
|
3918
3918
|
constructor(e) {
|
|
3919
3919
|
super(e);
|
|
@@ -3927,9 +3927,9 @@ var Dt = /* @__PURE__ */ new Set([
|
|
|
3927
3927
|
iterateErrors(e) {
|
|
3928
3928
|
this.declarationErrors.forEach(e);
|
|
3929
3929
|
}
|
|
3930
|
-
},
|
|
3930
|
+
}, It = class {
|
|
3931
3931
|
parser;
|
|
3932
|
-
stack = [new
|
|
3932
|
+
stack = [new Pt()];
|
|
3933
3933
|
constructor(e) {
|
|
3934
3934
|
this.parser = e;
|
|
3935
3935
|
}
|
|
@@ -3967,19 +3967,19 @@ var Dt = /* @__PURE__ */ new Set([
|
|
|
3967
3967
|
});
|
|
3968
3968
|
}
|
|
3969
3969
|
};
|
|
3970
|
-
function It() {
|
|
3971
|
-
return new Nt(3);
|
|
3972
|
-
}
|
|
3973
3970
|
function Lt() {
|
|
3974
|
-
return new Pt(
|
|
3971
|
+
return new Pt(3);
|
|
3975
3972
|
}
|
|
3976
3973
|
function Rt() {
|
|
3977
|
-
return new
|
|
3974
|
+
return new Ft(1);
|
|
3978
3975
|
}
|
|
3979
3976
|
function zt() {
|
|
3980
|
-
return new
|
|
3977
|
+
return new Ft(2);
|
|
3981
3978
|
}
|
|
3982
|
-
|
|
3979
|
+
function Bt() {
|
|
3980
|
+
return new Pt();
|
|
3981
|
+
}
|
|
3982
|
+
var Vt = class {
|
|
3983
3983
|
stacks = [];
|
|
3984
3984
|
enter(e) {
|
|
3985
3985
|
this.stacks.push(e);
|
|
@@ -4006,10 +4006,10 @@ var Bt = class {
|
|
|
4006
4006
|
return !(this.currentFlags() & 16);
|
|
4007
4007
|
}
|
|
4008
4008
|
};
|
|
4009
|
-
function
|
|
4009
|
+
function Ht(e, t) {
|
|
4010
4010
|
return (e ? 2 : 0) | !!t;
|
|
4011
4011
|
}
|
|
4012
|
-
var
|
|
4012
|
+
var Ut = class extends jt {
|
|
4013
4013
|
addExtra(e, t, n, r = !0) {
|
|
4014
4014
|
if (!e) return;
|
|
4015
4015
|
let { extra: i } = e;
|
|
@@ -4024,7 +4024,7 @@ var Ht = class extends At {
|
|
|
4024
4024
|
isUnparsedContextual(e, t) {
|
|
4025
4025
|
if (this.input.startsWith(t, e)) {
|
|
4026
4026
|
let n = this.input.charCodeAt(e + t.length);
|
|
4027
|
-
return !(
|
|
4027
|
+
return !(N(n) || (n & 64512) == 55296);
|
|
4028
4028
|
}
|
|
4029
4029
|
return !1;
|
|
4030
4030
|
}
|
|
@@ -4045,10 +4045,10 @@ var Ht = class extends At {
|
|
|
4045
4045
|
return this.match(135) || this.match(4) || this.hasPrecedingLineBreak();
|
|
4046
4046
|
}
|
|
4047
4047
|
hasPrecedingLineBreak() {
|
|
4048
|
-
return
|
|
4048
|
+
return st(this.input, this.offsetToSourcePos(this.state.lastTokEndLoc.index), this.state.start);
|
|
4049
4049
|
}
|
|
4050
4050
|
hasFollowingLineBreak() {
|
|
4051
|
-
return
|
|
4051
|
+
return st(this.input, this.state.end, this.nextTokenStart());
|
|
4052
4052
|
}
|
|
4053
4053
|
isLineTerminator() {
|
|
4054
4054
|
return this.eat(9) || this.canInsertSemicolon();
|
|
@@ -4135,11 +4135,11 @@ var Ht = class extends At {
|
|
|
4135
4135
|
let i = this.scope, a = this.getScopeHandler();
|
|
4136
4136
|
this.scope = new a(this, e);
|
|
4137
4137
|
let o = this.prodParam;
|
|
4138
|
-
this.prodParam = new
|
|
4138
|
+
this.prodParam = new Vt();
|
|
4139
4139
|
let s = this.classScope;
|
|
4140
|
-
this.classScope = new
|
|
4140
|
+
this.classScope = new Nt(this);
|
|
4141
4141
|
let c = this.expressionScope;
|
|
4142
|
-
return this.expressionScope = new
|
|
4142
|
+
return this.expressionScope = new It(this), () => {
|
|
4143
4143
|
this.state.labels = t, this.exportedIdentifiers = n, this.inModule = r, this.scope = i, this.prodParam = o, this.classScope = s, this.expressionScope = c;
|
|
4144
4144
|
};
|
|
4145
4145
|
}
|
|
@@ -4155,18 +4155,18 @@ var Ht = class extends At {
|
|
|
4155
4155
|
let { privateKeyLoc: t } = e;
|
|
4156
4156
|
t !== null && this.expectPlugin("destructuringPrivate", t);
|
|
4157
4157
|
}
|
|
4158
|
-
},
|
|
4158
|
+
}, Wt = class {
|
|
4159
4159
|
shorthandAssignLoc = null;
|
|
4160
4160
|
doubleProtoLoc = null;
|
|
4161
4161
|
privateKeyLoc = null;
|
|
4162
4162
|
optionalParametersLoc = null;
|
|
4163
4163
|
voidPatternLoc = null;
|
|
4164
|
-
},
|
|
4164
|
+
}, H = class {
|
|
4165
4165
|
constructor(e, n, r, i) {
|
|
4166
4166
|
this.start = r, this.end = 0, i !== void 0 && (this.loc = new t(i)), e & 128 && (this.range = [r, 0]), i !== void 0 && n && (this.loc.filename = n);
|
|
4167
4167
|
}
|
|
4168
4168
|
type = "";
|
|
4169
|
-
},
|
|
4169
|
+
}, Gt = H.prototype, Kt = class extends Ut {
|
|
4170
4170
|
createPosition(e) {
|
|
4171
4171
|
return e;
|
|
4172
4172
|
}
|
|
@@ -4176,11 +4176,11 @@ var Ht = class extends At {
|
|
|
4176
4176
|
}
|
|
4177
4177
|
startNodeAt(e) {
|
|
4178
4178
|
let { optionFlags: t, filename: n } = this;
|
|
4179
|
-
return t & 256 ? new
|
|
4179
|
+
return t & 256 ? new H(t, n, e.index, this.createPosition(e)) : new H(t, n, e.index);
|
|
4180
4180
|
}
|
|
4181
4181
|
startNodeAtNode(e) {
|
|
4182
4182
|
let { optionFlags: t, filename: n } = this;
|
|
4183
|
-
return t & 256 ? new
|
|
4183
|
+
return t & 256 ? new H(t, n, e.start, e.loc.start) : new H(t, n, e.start);
|
|
4184
4184
|
}
|
|
4185
4185
|
finishNode(e, t) {
|
|
4186
4186
|
return this.finishNodeAt(e, t, this.state.lastTokEndLoc);
|
|
@@ -4219,17 +4219,17 @@ var Ht = class extends At {
|
|
|
4219
4219
|
return e.type = t, e;
|
|
4220
4220
|
}
|
|
4221
4221
|
cloneIdentifier(e) {
|
|
4222
|
-
let { type: t, start: n, end: r, loc: i, range: a, name: o } = e, s = Object.create(
|
|
4222
|
+
let { type: t, start: n, end: r, loc: i, range: a, name: o } = e, s = Object.create(Gt);
|
|
4223
4223
|
return s.type = t, s.start = n, s.end = r, s.loc = i, s.range = a, s.name = o, e.extra && (s.extra = e.extra), s;
|
|
4224
4224
|
}
|
|
4225
4225
|
cloneStringLiteral(e) {
|
|
4226
|
-
let { type: t, start: n, end: r, loc: i, range: a, extra: o } = e, s = Object.create(
|
|
4226
|
+
let { type: t, start: n, end: r, loc: i, range: a, extra: o } = e, s = Object.create(Gt);
|
|
4227
4227
|
return s.type = t, s.start = n, s.end = r, s.loc = i, s.range = a, s.extra = o, s.value = e.value, s;
|
|
4228
4228
|
}
|
|
4229
|
-
},
|
|
4229
|
+
}, qt = (e) => e.type === "ParenthesizedExpression" ? qt(e.expression) : e, Jt = class extends Kt {
|
|
4230
4230
|
toAssignable(e, t = !1) {
|
|
4231
4231
|
let n;
|
|
4232
|
-
switch ((e.type === "ParenthesizedExpression" || e.extra?.parenthesized) && (n =
|
|
4232
|
+
switch ((e.type === "ParenthesizedExpression" || e.extra?.parenthesized) && (n = qt(e), t ? n.type === "Identifier" ? this.expressionScope.recordArrowParameterBindingError(g.InvalidParenthesizedAssignment, e) : n.type !== "CallExpression" && n.type !== "MemberExpression" && !this.isOptionalMemberExpression(n) && this.raise(g.InvalidParenthesizedAssignment, e) : this.raise(g.InvalidParenthesizedAssignment, e)), e.type) {
|
|
4233
4233
|
case "Identifier":
|
|
4234
4234
|
case "ObjectPattern":
|
|
4235
4235
|
case "ArrayPattern":
|
|
@@ -4396,7 +4396,7 @@ var Ht = class extends At {
|
|
|
4396
4396
|
return;
|
|
4397
4397
|
}
|
|
4398
4398
|
s === "VoidPattern" && t.type === "CatchClause" && this.raise(g.VoidPatternCatchClauseParam, e);
|
|
4399
|
-
let l =
|
|
4399
|
+
let l = qt(e);
|
|
4400
4400
|
o ||= l.type === "CallExpression" && (l.callee.type === "Import" || l.callee.type === "Super");
|
|
4401
4401
|
let u = this.isValidLVal(s, o, !(a || e.extra?.parenthesized) && t.type === "AssignmentExpression", n);
|
|
4402
4402
|
if (u === !0) return;
|
|
@@ -4412,7 +4412,7 @@ var Ht = class extends At {
|
|
|
4412
4412
|
else m && this.checkLVal(m, p, n, r, i, f, o);
|
|
4413
4413
|
}
|
|
4414
4414
|
checkIdentifier(e, t, n = !1) {
|
|
4415
|
-
this.state.strict && (n ?
|
|
4415
|
+
this.state.strict && (n ? Ue(e.name, this.inModule) : He(e.name)) && (t === 64 ? this.raise(g.StrictEvalArguments, e, { referenceName: e.name }) : this.raise(g.StrictEvalArgumentsBinding, e, { bindingName: e.name })), t & 8192 && e.name === "let" && this.raise(g.LetInLexicalBinding, e), t & 64 || this.declareNameFromIdentifier(e, t);
|
|
4416
4416
|
}
|
|
4417
4417
|
declareNameFromIdentifier(e, t) {
|
|
4418
4418
|
this.scope.declareName(e.name, t, e.start);
|
|
@@ -4432,7 +4432,7 @@ var Ht = class extends At {
|
|
|
4432
4432
|
checkCommaAfterRest(e) {
|
|
4433
4433
|
return this.match(8) ? (this.raise(this.lookaheadCharCode() === e ? g.RestTrailingComma : g.ElementAfterRest, this.state.startLoc), !0) : !1;
|
|
4434
4434
|
}
|
|
4435
|
-
},
|
|
4435
|
+
}, Yt = class extends Jt {
|
|
4436
4436
|
checkProto(e, t, n) {
|
|
4437
4437
|
if (e.type === "SpreadElement" || this.isObjectMethod(e) || e.computed || e.shorthand) return t;
|
|
4438
4438
|
let r = e.key;
|
|
@@ -4445,7 +4445,7 @@ var Ht = class extends At {
|
|
|
4445
4445
|
if (this.enterInitialScopes(), this.nextToken(), this.match(135)) throw this.raise(g.ParseExpressionEmptyInput, this.state.startLoc);
|
|
4446
4446
|
let e = this.parseExpression();
|
|
4447
4447
|
if (!this.match(135)) throw this.raise(g.ParseExpressionExpectsEOF, this.state.startLoc, { unexpected: this.input.codePointAt(this.state.start) });
|
|
4448
|
-
return this.finalizeRemainingComments(), e.comments = this.comments, e.errors = this.state.errors, this.optionFlags & 512 && (e.tokens =
|
|
4448
|
+
return this.finalizeRemainingComments(), e.comments = this.comments, e.errors = this.state.errors, this.optionFlags & 512 && (e.tokens = en(this.tokens)), e;
|
|
4449
4449
|
}
|
|
4450
4450
|
parseExpression(e, t) {
|
|
4451
4451
|
return e ? this.disallowInAnd(() => this.parseExpressionBase(t)) : this.allowInAnd(() => this.parseExpressionBase(t));
|
|
@@ -4476,7 +4476,7 @@ var Ht = class extends At {
|
|
|
4476
4476
|
return t && (e = t.call(this, e, n)), e;
|
|
4477
4477
|
}
|
|
4478
4478
|
let i;
|
|
4479
|
-
e ? i = !1 : (e = new
|
|
4479
|
+
e ? i = !1 : (e = new Wt(), i = !0), this.state.canStartArrow = !0;
|
|
4480
4480
|
let a = this.parseMaybeConditional(e);
|
|
4481
4481
|
if (t && (a = t.call(this, a, n)), _e(this.state.type)) {
|
|
4482
4482
|
let t = this.startNodeAt(n), r = this.state.value;
|
|
@@ -4641,7 +4641,7 @@ var Ht = class extends At {
|
|
|
4641
4641
|
let a = this.startNodeAt(t);
|
|
4642
4642
|
a.callee = e;
|
|
4643
4643
|
let { maybeAsyncArrow: o, optionalChainMember: s } = n;
|
|
4644
|
-
o && (this.expressionScope.enter(
|
|
4644
|
+
o && (this.expressionScope.enter(zt()), i = new Wt()), s && (a.optional = r), a.arguments = r ? this.parseCallExpressionArguments() : this.parseCallExpressionArguments(e.type !== "Super", a, i);
|
|
4645
4645
|
let c = this.finishCallExpression(a, s);
|
|
4646
4646
|
return o && this.shouldParseAsyncArrow() && !r ? (n.stop = !0, this.checkDestructuringPrivate(i), this.expressionScope.validateAsPattern(), this.expressionScope.exit(), c = this.parseAsyncArrowFromCallExpression(this.startNodeAt(t), c)) : (o && (this.checkExpressionErrors(i, !0), this.expressionScope.exit()), this.toReferencedList(a.arguments)), c;
|
|
4647
4647
|
}
|
|
@@ -4675,7 +4675,7 @@ var Ht = class extends At {
|
|
|
4675
4675
|
return this.match(15) && !this.canInsertSemicolon();
|
|
4676
4676
|
}
|
|
4677
4677
|
parseAsyncArrowFromCallExpression(e, t) {
|
|
4678
|
-
return this.resetPreviousNodeTrailingComments(t), this.expect(15), this.parseArrowExpression(e, t.arguments, !0, t.extra?.trailingCommaLoc), t.innerComments &&
|
|
4678
|
+
return this.resetPreviousNodeTrailingComments(t), this.expect(15), this.parseArrowExpression(e, t.arguments, !0, t.extra?.trailingCommaLoc), t.innerComments && z(e, t.innerComments), t.callee.trailingComments && z(e, t.callee.trailingComments), e;
|
|
4679
4679
|
}
|
|
4680
4680
|
parseNoCallExpr() {
|
|
4681
4681
|
let e = this.state.startLoc;
|
|
@@ -4725,7 +4725,7 @@ var Ht = class extends At {
|
|
|
4725
4725
|
}
|
|
4726
4726
|
case 43: {
|
|
4727
4727
|
let e = this.input.codePointAt(this.nextTokenStart());
|
|
4728
|
-
throw
|
|
4728
|
+
throw M(e) || e === 62 ? this.expectOnePlugin([
|
|
4729
4729
|
"jsx",
|
|
4730
4730
|
"flow",
|
|
4731
4731
|
"typescript"
|
|
@@ -4766,7 +4766,7 @@ var Ht = class extends At {
|
|
|
4766
4766
|
}
|
|
4767
4767
|
}
|
|
4768
4768
|
parseAsyncArrowUnaryFunction(e) {
|
|
4769
|
-
this.prodParam.enter(
|
|
4769
|
+
this.prodParam.enter(Ht(!0, this.prodParam.hasYield));
|
|
4770
4770
|
let t = [this.parseIdentifier()];
|
|
4771
4771
|
return this.prodParam.exit(), this.hasPrecedingLineBreak() && this.raise(g.LineTerminatorBeforeArrow, this.state.curPosition()), this.expect(15), this.parseArrowExpression(e, t, !0);
|
|
4772
4772
|
}
|
|
@@ -4845,8 +4845,8 @@ var Ht = class extends At {
|
|
|
4845
4845
|
}
|
|
4846
4846
|
parseParenAndDistinguishExpression(e) {
|
|
4847
4847
|
let t = this.state.startLoc, n;
|
|
4848
|
-
this.next(), this.expressionScope.enter(
|
|
4849
|
-
let r = this.state.startLoc, i = [], a = new
|
|
4848
|
+
this.next(), this.expressionScope.enter(Rt());
|
|
4849
|
+
let r = this.state.startLoc, i = [], a = new Wt(), o = !0, s, c;
|
|
4850
4850
|
for (; !this.match(7);) {
|
|
4851
4851
|
if (o) o = !1;
|
|
4852
4852
|
else if (this.expect(8, a.optionalParametersLoc === null ? null : a.optionalParametersLoc), this.match(7)) {
|
|
@@ -5017,7 +5017,7 @@ var Ht = class extends At {
|
|
|
5017
5017
|
e.id = null, e.generator = !1, e.async = t;
|
|
5018
5018
|
}
|
|
5019
5019
|
parseMethod(e, t, n, r, i, a, o = !1) {
|
|
5020
|
-
this.initFunction(e, n), e.generator = t, this.scope.enter(530 | (o ? 576 : 0) | (i ? 32 : 0)), this.prodParam.enter(
|
|
5020
|
+
this.initFunction(e, n), e.generator = t, this.scope.enter(530 | (o ? 576 : 0) | (i ? 32 : 0)), this.prodParam.enter(Ht(n, e.generator)), this.parseFunctionParams(e, r);
|
|
5021
5021
|
let s = this.parseFunctionBodyAndFinish(e, a, !0);
|
|
5022
5022
|
return this.prodParam.exit(), this.scope.exit(), s;
|
|
5023
5023
|
}
|
|
@@ -5027,7 +5027,7 @@ var Ht = class extends At {
|
|
|
5027
5027
|
}
|
|
5028
5028
|
parseArrowExpression(e, t, n, r) {
|
|
5029
5029
|
this.scope.enter(518);
|
|
5030
|
-
let i =
|
|
5030
|
+
let i = Ht(n, !1);
|
|
5031
5031
|
return this.match(2) || (i |= this.prodParam.currentFlags() & 24), this.prodParam.enter(i), this.initFunction(e, n), t && this.setArrowFunctionParameters(e, t, r), this.parseFunctionBody(e, !0), this.prodParam.exit(), this.scope.exit(), this.finishNode(e, "ArrowFunctionExpression");
|
|
5032
5032
|
}
|
|
5033
5033
|
setArrowFunctionParameters(e, t, n) {
|
|
@@ -5038,7 +5038,7 @@ var Ht = class extends At {
|
|
|
5038
5038
|
}
|
|
5039
5039
|
parseFunctionBody(e, t, n = !1) {
|
|
5040
5040
|
let r = t && !this.match(2);
|
|
5041
|
-
if (this.expressionScope.enter(
|
|
5041
|
+
if (this.expressionScope.enter(Bt()), r) e.body = this.parseMaybeAssign(), this.checkParams(e, !1, t, !1);
|
|
5042
5042
|
else {
|
|
5043
5043
|
let r = this.state.strict, i = this.state.labels;
|
|
5044
5044
|
this.state.labels = [], this.prodParam.enter(this.prodParam.currentFlags() | 4), e.body = this.parseBlock(!0, !1, (i) => {
|
|
@@ -5103,12 +5103,12 @@ var Ht = class extends At {
|
|
|
5103
5103
|
return e ? i && this.replaceToken(128) : this.checkReservedWord(t, this.sourceToOffsetPos(n), i, !1), this.next(), t;
|
|
5104
5104
|
}
|
|
5105
5105
|
checkReservedWord(e, t, n, r) {
|
|
5106
|
-
if (!(e.length > 10) &&
|
|
5107
|
-
if (n &&
|
|
5106
|
+
if (!(e.length > 10) && qe(e)) {
|
|
5107
|
+
if (n && We(e)) {
|
|
5108
5108
|
this.raise(g.UnexpectedKeyword, t, { keyword: e });
|
|
5109
5109
|
return;
|
|
5110
5110
|
}
|
|
5111
|
-
if ((this.state.strict ? r ?
|
|
5111
|
+
if ((this.state.strict ? r ? Ue : Ve : Be)(e, this.inModule)) {
|
|
5112
5112
|
this.raise(g.UnexpectedReservedWord, t, { reservedWord: e });
|
|
5113
5113
|
return;
|
|
5114
5114
|
}
|
|
@@ -5256,17 +5256,17 @@ var Ht = class extends At {
|
|
|
5256
5256
|
return this.parseMaybeAssignAllowIn(t, n);
|
|
5257
5257
|
}
|
|
5258
5258
|
parsePropertyNamePrefixOperator(e) {}
|
|
5259
|
-
},
|
|
5260
|
-
function
|
|
5259
|
+
}, Xt = { kind: 1 }, Zt = { kind: 2 }, Qt = /[\uD800-\uDFFF]/u, $t = /in(?:stanceof)?/y;
|
|
5260
|
+
function en(e) {
|
|
5261
5261
|
for (let t = 0; t < e.length; t++) {
|
|
5262
5262
|
let n = e[t], { type: r } = n;
|
|
5263
5263
|
typeof r == "number" && (n.type = ke(r));
|
|
5264
5264
|
}
|
|
5265
5265
|
return e;
|
|
5266
5266
|
}
|
|
5267
|
-
var
|
|
5267
|
+
var tn = class extends Yt {
|
|
5268
5268
|
parseTopLevel(e, t) {
|
|
5269
|
-
return e.program = this.parseProgram(t, 135, this.options.sourceType === "module" ? "module" : "script"), e.comments = this.comments, this.optionFlags & 512 && (e.tokens =
|
|
5269
|
+
return e.program = this.parseProgram(t, 135, this.options.sourceType === "module" ? "module" : "script"), e.comments = this.comments, this.optionFlags & 512 && (e.tokens = en(this.tokens)), this.finishNode(e, "File");
|
|
5270
5270
|
}
|
|
5271
5271
|
parseProgram(e, t, r) {
|
|
5272
5272
|
if (e.sourceType = r, e.interpreter = this.parseInterpreterDirective(), this.parseBlockBody(e, !0, !0, t), this.inModule) {
|
|
@@ -5315,10 +5315,10 @@ var en = class extends Jt {
|
|
|
5315
5315
|
return !1;
|
|
5316
5316
|
}
|
|
5317
5317
|
chStartsBindingIdentifier(e, t) {
|
|
5318
|
-
if (
|
|
5319
|
-
if (
|
|
5320
|
-
let e = this.codePointAtPos(
|
|
5321
|
-
if (!
|
|
5318
|
+
if (M(e)) {
|
|
5319
|
+
if ($t.lastIndex = t, $t.test(this.input)) {
|
|
5320
|
+
let e = this.codePointAtPos($t.lastIndex);
|
|
5321
|
+
if (!N(e) && e !== 92) return !1;
|
|
5322
5322
|
}
|
|
5323
5323
|
return !0;
|
|
5324
5324
|
}
|
|
@@ -5474,10 +5474,10 @@ var en = class extends Jt {
|
|
|
5474
5474
|
return this.expect(7), e;
|
|
5475
5475
|
}
|
|
5476
5476
|
parseDoWhileStatement(e) {
|
|
5477
|
-
return this.next(), this.state.labels.push(
|
|
5477
|
+
return this.next(), this.state.labels.push(Xt), e.body = this.parseStatement(), this.state.labels.pop(), this.expect(88), e.test = this.parseHeaderExpression(), this.eat(9), this.finishNode(e, "DoWhileStatement");
|
|
5478
5478
|
}
|
|
5479
5479
|
parseForStatement(e) {
|
|
5480
|
-
this.next(), this.state.labels.push(
|
|
5480
|
+
this.next(), this.state.labels.push(Xt);
|
|
5481
5481
|
let t = null;
|
|
5482
5482
|
if (this.isContextual(92) && this.recordAwaitIfAllowed() && (t = this.state.startLoc, this.next()), this.scope.enter(0), this.expect(6), this.match(9)) return t !== null && this.unexpected(t), this.parseFor(e, null);
|
|
5483
5483
|
let n = this.isContextual(96);
|
|
@@ -5490,7 +5490,7 @@ var en = class extends Jt {
|
|
|
5490
5490
|
return s && i && this.raise(g.ForInUsing, o), (s || this.isContextual(98)) && o.declarations.length === 1 ? this.parseForIn(e, o, t) : (t !== null && this.unexpected(t), this.parseFor(e, o));
|
|
5491
5491
|
}
|
|
5492
5492
|
}
|
|
5493
|
-
let r = this.isContextual(91), i = new
|
|
5493
|
+
let r = this.isContextual(91), i = new Wt(), a = this.parseExpression(!0, i), o = this.isContextual(98);
|
|
5494
5494
|
if (o && (n && this.raise(g.ForOfLet, a), t === null && r && a.type === "Identifier" && this.raise(g.ForOfAsync, a)), o || this.match(54)) {
|
|
5495
5495
|
this.checkDestructuringPrivate(i), this.toAssignable(a, !0);
|
|
5496
5496
|
let n = o ? "ForOfStatement" : "ForInStatement";
|
|
@@ -5510,7 +5510,7 @@ var en = class extends Jt {
|
|
|
5510
5510
|
parseSwitchStatement(e) {
|
|
5511
5511
|
this.next(), e.discriminant = this.parseHeaderExpression();
|
|
5512
5512
|
let t = e.cases = [];
|
|
5513
|
-
this.expect(2), this.state.labels.push(
|
|
5513
|
+
this.expect(2), this.state.labels.push(Zt), this.scope.enter(256);
|
|
5514
5514
|
let n;
|
|
5515
5515
|
for (let e; !this.match(4);) if (this.match(57) || this.match(61)) {
|
|
5516
5516
|
let r = this.match(57);
|
|
@@ -5536,7 +5536,7 @@ var en = class extends Jt {
|
|
|
5536
5536
|
return this.next(), this.parseVar(e, !1, t, n), this.semicolon(), this.finishNode(e, "VariableDeclaration");
|
|
5537
5537
|
}
|
|
5538
5538
|
parseWhileStatement(e) {
|
|
5539
|
-
return this.next(), e.test = this.parseHeaderExpression(), this.state.labels.push(
|
|
5539
|
+
return this.next(), e.test = this.parseHeaderExpression(), this.state.labels.push(Xt), e.body = this.parseStatement(), this.state.labels.pop(), this.finishNode(e, "WhileStatement");
|
|
5540
5540
|
}
|
|
5541
5541
|
parseWithStatement(e) {
|
|
5542
5542
|
return this.state.strict && this.raise(g.StrictWith, this.state.startLoc), this.next(), e.object = this.parseHeaderExpression(), e.body = this.parseStatement(), this.finishNode(e, "WithStatement");
|
|
@@ -5612,13 +5612,13 @@ var en = class extends Jt {
|
|
|
5612
5612
|
}
|
|
5613
5613
|
parseFunction(e, t = 0) {
|
|
5614
5614
|
let n = t & 2, r = !!(t & 1), i = r && !(t & 4), a = !!(t & 8);
|
|
5615
|
-
return this.initFunction(e, a), this.match(51) && (n && this.raise(g.GeneratorInSingleStatementContext, this.state.startLoc), this.next(), e.generator = !0), r && (e.id = this.parseFunctionId(i)), this.scope.enter(514), this.prodParam.enter(
|
|
5615
|
+
return this.initFunction(e, a), this.match(51) && (n && this.raise(g.GeneratorInSingleStatementContext, this.state.startLoc), this.next(), e.generator = !0), r && (e.id = this.parseFunctionId(i)), this.scope.enter(514), this.prodParam.enter(Ht(a, e.generator)), r || (e.id = this.parseFunctionId()), this.parseFunctionParams(e, !1), this.parseFunctionBodyAndFinish(e, r ? "FunctionDeclaration" : "FunctionExpression"), this.prodParam.exit(), this.scope.exit(), r && !n && this.registerFunctionStatementId(e), e;
|
|
5616
5616
|
}
|
|
5617
5617
|
parseFunctionId(e) {
|
|
5618
5618
|
return e || D(this.state.type) ? this.parseIdentifier() : null;
|
|
5619
5619
|
}
|
|
5620
5620
|
parseFunctionParams(e, t) {
|
|
5621
|
-
this.expect(6), this.expressionScope.enter(
|
|
5621
|
+
this.expect(6), this.expressionScope.enter(Lt()), e.params = this.parseBindingList(7, 41, 2 | (t ? 4 : 0)), this.expressionScope.exit();
|
|
5622
5622
|
}
|
|
5623
5623
|
registerFunctionStatementId(e) {
|
|
5624
5624
|
e.id && this.scope.declareName(e.id.name, !this.options.annexB || this.state.strict || e.generator || e.async ? this.scope.treatFunctionsAsVar ? 5 : 8201 : 17, e.id.start);
|
|
@@ -5772,7 +5772,7 @@ var en = class extends Jt {
|
|
|
5772
5772
|
return this.parseInitializer(e), this.semicolon(), this.finishNode(e, "ClassAccessorProperty");
|
|
5773
5773
|
}
|
|
5774
5774
|
parseInitializer(e) {
|
|
5775
|
-
this.scope.enter(592), this.expressionScope.enter(
|
|
5775
|
+
this.scope.enter(592), this.expressionScope.enter(Bt()), this.prodParam.enter(0), e.value = this.eat(25) ? this.parseMaybeAssignAllowIn() : null, this.expressionScope.exit(), this.prodParam.exit(), this.scope.exit();
|
|
5776
5776
|
}
|
|
5777
5777
|
parseClassId(e, t, n, r = 8331) {
|
|
5778
5778
|
if (D(this.state.type)) e.id = this.parseIdentifier(), t && this.declareNameFromIdentifier(e.id, r);
|
|
@@ -5933,7 +5933,7 @@ var en = class extends Jt {
|
|
|
5933
5933
|
}
|
|
5934
5934
|
parseModuleExportName() {
|
|
5935
5935
|
if (this.match(130)) {
|
|
5936
|
-
let e = this.parseStringLiteral(this.state.value), t =
|
|
5936
|
+
let e = this.parseStringLiteral(this.state.value), t = Qt.exec(e.value);
|
|
5937
5937
|
return t && this.raise(g.ModuleExportNameHasLoneSurrogate, e, { surrogateCharCode: t[0].charCodeAt(0) }), e;
|
|
5938
5938
|
}
|
|
5939
5939
|
return this.parseIdentifier(!0);
|
|
@@ -6036,15 +6036,15 @@ var en = class extends Jt {
|
|
|
6036
6036
|
isThisParam(e) {
|
|
6037
6037
|
return e.type === "Identifier" && e.name === "this";
|
|
6038
6038
|
}
|
|
6039
|
-
},
|
|
6040
|
-
function
|
|
6039
|
+
}, nn = /in(?:stanceof)?|as|satisfies/y;
|
|
6040
|
+
function rn(e) {
|
|
6041
6041
|
if (e == null) throw Error(`Unexpected ${e} value.`);
|
|
6042
6042
|
return e;
|
|
6043
6043
|
}
|
|
6044
|
-
function
|
|
6044
|
+
function an(e) {
|
|
6045
6045
|
if (!e) throw Error("Assert fail");
|
|
6046
6046
|
}
|
|
6047
|
-
var
|
|
6047
|
+
var U = h`typescript`({
|
|
6048
6048
|
AbstractMethodHasImplementation: ({ methodName: e }) => `Method '${e}' cannot have an implementation because it is marked abstract.`,
|
|
6049
6049
|
AbstractPropertyHasInitializer: ({ propertyName: e }) => `Property '${e}' cannot have an initializer because it is marked abstract.`,
|
|
6050
6050
|
AccessorCannotBeOptional: "An 'accessor' property cannot be declared optional.",
|
|
@@ -6122,7 +6122,7 @@ var W = h`typescript`({
|
|
|
6122
6122
|
UnsupportedSignatureParameterKind: ({ type: e }) => `Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${e}.`,
|
|
6123
6123
|
UsingDeclarationInAmbientContext: (e) => `'${e}' declarations are not allowed in ambient contexts.`
|
|
6124
6124
|
});
|
|
6125
|
-
function
|
|
6125
|
+
function on(e) {
|
|
6126
6126
|
switch (e) {
|
|
6127
6127
|
case "any": return "TSAnyKeyword";
|
|
6128
6128
|
case "boolean": return "TSBooleanKeyword";
|
|
@@ -6137,24 +6137,24 @@ function an(e) {
|
|
|
6137
6137
|
default: return;
|
|
6138
6138
|
}
|
|
6139
6139
|
}
|
|
6140
|
-
function
|
|
6140
|
+
function sn(e) {
|
|
6141
6141
|
return e === "private" || e === "public" || e === "protected";
|
|
6142
6142
|
}
|
|
6143
|
-
function
|
|
6143
|
+
function cn(e) {
|
|
6144
6144
|
return e === "in" || e === "out";
|
|
6145
6145
|
}
|
|
6146
|
-
function
|
|
6146
|
+
function ln(e) {
|
|
6147
6147
|
if (e.extra?.parenthesized) return !1;
|
|
6148
6148
|
switch (e.type) {
|
|
6149
6149
|
case "Identifier": return !0;
|
|
6150
|
-
case "MemberExpression": return !e.computed &&
|
|
6151
|
-
case "TSInstantiationExpression": return
|
|
6150
|
+
case "MemberExpression": return !e.computed && ln(e.object);
|
|
6151
|
+
case "TSInstantiationExpression": return ln(e.expression);
|
|
6152
6152
|
default: return !1;
|
|
6153
6153
|
}
|
|
6154
6154
|
}
|
|
6155
|
-
var
|
|
6155
|
+
var un = (e) => class extends e {
|
|
6156
6156
|
getScopeHandler() {
|
|
6157
|
-
return
|
|
6157
|
+
return pt;
|
|
6158
6158
|
}
|
|
6159
6159
|
tsIsIdentifier() {
|
|
6160
6160
|
return D(this.state.type);
|
|
@@ -6176,16 +6176,16 @@ var ln = (e) => class extends e {
|
|
|
6176
6176
|
if (this.tsTryParse(this.tsNextTokenCanFollowModifier.bind(this))) return r;
|
|
6177
6177
|
}
|
|
6178
6178
|
}
|
|
6179
|
-
tsParseModifiers({ allowedModifiers: e, disallowedModifiers: t, stopOnStartOfClassStaticBlock: n, errorTemplate: r =
|
|
6179
|
+
tsParseModifiers({ allowedModifiers: e, disallowedModifiers: t, stopOnStartOfClassStaticBlock: n, errorTemplate: r = U.InvalidModifierOnTypeMember }, i) {
|
|
6180
6180
|
let a = (e, t, n, r) => {
|
|
6181
|
-
t === n && i[r] && this.raise(
|
|
6181
|
+
t === n && i[r] && this.raise(U.InvalidModifiersOrder, e, { orderedModifiers: [n, r] });
|
|
6182
6182
|
}, o = (e, t, n, r) => {
|
|
6183
|
-
(i[n] && t === r || i[r] && t === n) && this.raise(
|
|
6183
|
+
(i[n] && t === r || i[r] && t === n) && this.raise(U.IncompatibleModifiers, e, { modifiers: [n, r] });
|
|
6184
6184
|
};
|
|
6185
6185
|
for (;;) {
|
|
6186
6186
|
let { startLoc: s } = this.state, c = this.tsParseModifier(e.concat(t ?? []), n, i.static);
|
|
6187
6187
|
if (!c) break;
|
|
6188
|
-
|
|
6188
|
+
sn(c) ? i.accessibility ? this.raise(U.DuplicateAccessibilityModifier, s, { modifier: c }) : (a(s, c, c, "override"), a(s, c, c, "static"), a(s, c, c, "readonly"), i.accessibility = c) : cn(c) ? (i[c] && this.raise(U.DuplicateModifier, s, { modifier: c }), i[c] = !0, a(s, c, "in", "out")) : (Object.hasOwn(i, c) ? this.raise(U.DuplicateModifier, s, { modifier: c }) : (a(s, c, "static", "readonly"), a(s, c, "static", "override"), a(s, c, "override", "readonly"), a(s, c, "abstract", "override"), o(s, c, "declare", "override"), o(s, c, "static", "abstract")), i[c] = !0), t?.includes(c) && this.raise(r, s, { modifier: c });
|
|
6189
6189
|
}
|
|
6190
6190
|
}
|
|
6191
6191
|
tsIsListTerminator(e) {
|
|
@@ -6203,7 +6203,7 @@ var ln = (e) => class extends e {
|
|
|
6203
6203
|
return n;
|
|
6204
6204
|
}
|
|
6205
6205
|
tsParseDelimitedList(e, t, n) {
|
|
6206
|
-
return
|
|
6206
|
+
return rn(this.tsParseDelimitedListWorker(e, t, !0, n));
|
|
6207
6207
|
}
|
|
6208
6208
|
tsParseDelimitedListWorker(e, t, n, r) {
|
|
6209
6209
|
let i = [], a = -1;
|
|
@@ -6228,7 +6228,7 @@ var ln = (e) => class extends e {
|
|
|
6228
6228
|
}
|
|
6229
6229
|
tsParseImportType() {
|
|
6230
6230
|
let e = this.startNode();
|
|
6231
|
-
return this.expect(79), this.expect(6), this.match(130) ? e.source = this.parseStringLiteral(this.state.value) : (this.raise(
|
|
6231
|
+
return this.expect(79), this.expect(6), this.match(130) ? e.source = this.parseStringLiteral(this.state.value) : (this.raise(U.UnsupportedImportTypeArgument, this.state.startLoc), e.source = this.tsParseNonConditionalType()), e.options = this.eat(8) ? this.tsParseImportTypeOptions() : null, this.expect(7), this.eat(12) && (e.qualifier = this.tsParseEntityName(3)), this.match(43) && (e.typeArguments = this.tsParseTypeArguments()), this.finishNode(e, "TSImportType");
|
|
6232
6232
|
}
|
|
6233
6233
|
tsParseImportTypeOptions() {
|
|
6234
6234
|
let e = this.startNode();
|
|
@@ -6288,12 +6288,12 @@ var ln = (e) => class extends e {
|
|
|
6288
6288
|
"abstract",
|
|
6289
6289
|
"override"
|
|
6290
6290
|
],
|
|
6291
|
-
errorTemplate:
|
|
6291
|
+
errorTemplate: U.InvalidModifierOnTypeParameter
|
|
6292
6292
|
});
|
|
6293
6293
|
tsParseConstModifier = this.tsParseModifiers.bind(this, {
|
|
6294
6294
|
allowedModifiers: ["const"],
|
|
6295
6295
|
disallowedModifiers: ["in", "out"],
|
|
6296
|
-
errorTemplate:
|
|
6296
|
+
errorTemplate: U.InvalidModifierOnTypeParameterPositions
|
|
6297
6297
|
});
|
|
6298
6298
|
tsParseInOutConstModifiers = this.tsParseModifiers.bind(this, {
|
|
6299
6299
|
allowedModifiers: [
|
|
@@ -6310,7 +6310,7 @@ var ln = (e) => class extends e {
|
|
|
6310
6310
|
"abstract",
|
|
6311
6311
|
"override"
|
|
6312
6312
|
],
|
|
6313
|
-
errorTemplate:
|
|
6313
|
+
errorTemplate: U.InvalidModifierOnTypeParameter
|
|
6314
6314
|
});
|
|
6315
6315
|
tsParseTypeParameter(e) {
|
|
6316
6316
|
let t = this.startNode();
|
|
@@ -6323,7 +6323,7 @@ var ln = (e) => class extends e {
|
|
|
6323
6323
|
let t = this.startNode();
|
|
6324
6324
|
this.match(43) || this.match(138) ? this.next() : this.unexpected();
|
|
6325
6325
|
let n = { value: -1 };
|
|
6326
|
-
return t.params = this.tsParseBracketedList("TypeParametersOrArguments", this.tsParseTypeParameter.bind(this, e), !1, !0, n), t.params.length === 0 && this.raise(
|
|
6326
|
+
return t.params = this.tsParseBracketedList("TypeParametersOrArguments", this.tsParseTypeParameter.bind(this, e), !1, !0, n), t.params.length === 0 && this.raise(U.EmptyTypeParameters, t), n.value !== -1 && this.addExtra(t, "trailingComma", n.value), this.finishNode(t, "TSTypeParameterDeclaration");
|
|
6327
6327
|
}
|
|
6328
6328
|
tsFillSignature(e, t) {
|
|
6329
6329
|
let n = e === 15;
|
|
@@ -6333,7 +6333,7 @@ var ln = (e) => class extends e {
|
|
|
6333
6333
|
let e = super.parseBindingList(7, 41, 2);
|
|
6334
6334
|
for (let t of e) {
|
|
6335
6335
|
let { type: e } = t;
|
|
6336
|
-
(e === "AssignmentPattern" || e === "TSParameterProperty") && this.raise(
|
|
6336
|
+
(e === "AssignmentPattern" || e === "TSParameterProperty") && this.raise(U.UnsupportedSignatureParameterKind, t, { type: e });
|
|
6337
6337
|
}
|
|
6338
6338
|
return e;
|
|
6339
6339
|
}
|
|
@@ -6356,16 +6356,16 @@ var ln = (e) => class extends e {
|
|
|
6356
6356
|
}
|
|
6357
6357
|
tsParsePropertyOrMethodSignature(e, t) {
|
|
6358
6358
|
if (this.eat(13) && (e.optional = !0), this.match(6) || this.match(43)) {
|
|
6359
|
-
t && this.raise(
|
|
6359
|
+
t && this.raise(U.ReadonlyForMethodSignature, e);
|
|
6360
6360
|
let n = e;
|
|
6361
|
-
if (n.kind && this.match(43) && this.raise(
|
|
6361
|
+
if (n.kind && this.match(43) && this.raise(U.AccessorCannotHaveTypeParameters, this.state.curPosition()), this.tsFillSignature(10, n), this.tsParseTypeMemberSemicolon(), n.kind === "get") n.params.length > 0 && (this.raise(g.BadGetterArity, this.state.curPosition()), this.isThisParam(n.params[0]) && this.raise(U.AccessorCannotDeclareThisParameter, this.state.curPosition()));
|
|
6362
6362
|
else if (n.kind === "set") {
|
|
6363
6363
|
if (n.params.length !== 1) this.raise(g.BadSetterArity, this.state.curPosition());
|
|
6364
6364
|
else {
|
|
6365
6365
|
let e = n.params[0];
|
|
6366
|
-
this.isThisParam(e) && this.raise(
|
|
6366
|
+
this.isThisParam(e) && this.raise(U.AccessorCannotDeclareThisParameter, this.state.curPosition()), e.type === "Identifier" && e.optional && this.raise(U.SetAccessorCannotHaveOptionalParameter, this.state.curPosition()), e.type === "RestElement" && this.raise(U.SetAccessorCannotHaveRestParameter, this.state.curPosition());
|
|
6367
6367
|
}
|
|
6368
|
-
n.returnType && this.raise(
|
|
6368
|
+
n.returnType && this.raise(U.SetAccessorCannotHaveReturnType, n.returnType);
|
|
6369
6369
|
} else n.kind = "method";
|
|
6370
6370
|
return this.finishNode(n, "TSMethodSignature");
|
|
6371
6371
|
}
|
|
@@ -6418,7 +6418,7 @@ var ln = (e) => class extends e {
|
|
|
6418
6418
|
let t = !1;
|
|
6419
6419
|
return e.elementTypes.forEach((e) => {
|
|
6420
6420
|
let { type: n } = e;
|
|
6421
|
-
t && n !== "TSRestType" && n !== "TSOptionalType" && !(n === "TSNamedTupleMember" && e.optional) && this.raise(
|
|
6421
|
+
t && n !== "TSRestType" && n !== "TSOptionalType" && !(n === "TSNamedTupleMember" && e.optional) && this.raise(U.OptionalTypeBeforeRequired, e), t ||= n === "TSNamedTupleMember" && e.optional || n === "TSOptionalType";
|
|
6422
6422
|
}), this.finishNode(e, "TSTupleType");
|
|
6423
6423
|
}
|
|
6424
6424
|
tsParseTupleElementType() {
|
|
@@ -6431,7 +6431,7 @@ var ln = (e) => class extends e {
|
|
|
6431
6431
|
} else o = this.tsParseType(), a = this.eat(13), r = this.eat(10);
|
|
6432
6432
|
if (r) {
|
|
6433
6433
|
let e;
|
|
6434
|
-
i ? (e = this.startNodeAt(n), e.optional = a, e.label = i, e.elementType = o, this.eat(13) && (e.optional = !0, this.raise(
|
|
6434
|
+
i ? (e = this.startNodeAt(n), e.optional = a, e.label = i, e.elementType = o, this.eat(13) && (e.optional = !0, this.raise(U.TupleOptionalAfterType, this.state.lastTokStartLoc))) : (e = this.startNodeAt(n), e.optional = a, this.raise(U.InvalidTupleMemberLabel, o), e.label = o, e.elementType = this.tsParseType()), o = this.finishNode(e, "TSNamedTupleMember");
|
|
6435
6435
|
} else if (a) {
|
|
6436
6436
|
let e = this.startNodeAt(n);
|
|
6437
6437
|
e.typeAnnotation = o, o = this.finishNode(e, "TSOptionalType");
|
|
@@ -6515,7 +6515,7 @@ var ln = (e) => class extends e {
|
|
|
6515
6515
|
default: {
|
|
6516
6516
|
let { type: e } = this.state;
|
|
6517
6517
|
if (D(e) || e === 84 || e === 80) {
|
|
6518
|
-
let t = e === 84 ? "TSVoidKeyword" : e === 80 ? "TSNullKeyword" :
|
|
6518
|
+
let t = e === 84 ? "TSVoidKeyword" : e === 80 ? "TSNullKeyword" : on(this.state.value);
|
|
6519
6519
|
if (t !== void 0 && this.lookaheadCharCode() !== 46) {
|
|
6520
6520
|
let e = this.startNode();
|
|
6521
6521
|
return this.next(), this.finishNode(e, t);
|
|
@@ -6545,7 +6545,7 @@ var ln = (e) => class extends e {
|
|
|
6545
6545
|
switch (e.typeAnnotation.type) {
|
|
6546
6546
|
case "TSTupleType":
|
|
6547
6547
|
case "TSArrayType": return;
|
|
6548
|
-
default: this.raise(
|
|
6548
|
+
default: this.raise(U.UnexpectedReadonly, e);
|
|
6549
6549
|
}
|
|
6550
6550
|
}
|
|
6551
6551
|
tsParseInferType() {
|
|
@@ -6642,7 +6642,7 @@ var ln = (e) => class extends e {
|
|
|
6642
6642
|
}), this.finishNode(t, "TSTypeAnnotation");
|
|
6643
6643
|
}
|
|
6644
6644
|
tsParseType() {
|
|
6645
|
-
|
|
6645
|
+
an(this.state.inType);
|
|
6646
6646
|
let e = this.tsParseNonConditionalType();
|
|
6647
6647
|
if (this.state.inDisallowConditionalTypesContext || this.hasPrecedingLineBreak() || !this.eat(77)) return e;
|
|
6648
6648
|
let t = this.startNodeAtNode(e);
|
|
@@ -6655,24 +6655,24 @@ var ln = (e) => class extends e {
|
|
|
6655
6655
|
return this.tsIsStartOfFunctionType() ? this.tsParseFunctionOrConstructorType("TSFunctionType") : this.match(73) ? this.tsParseFunctionOrConstructorType("TSConstructorType") : this.isAbstractConstructorSignature() ? this.tsParseFunctionOrConstructorType("TSConstructorType", !0) : this.tsParseUnionTypeOrHigher();
|
|
6656
6656
|
}
|
|
6657
6657
|
tsParseTypeAssertion() {
|
|
6658
|
-
this.getPluginOption("typescript", "disallowAmbiguousJSXLike") && this.raise(
|
|
6658
|
+
this.getPluginOption("typescript", "disallowAmbiguousJSXLike") && this.raise(U.ReservedTypeAssertion, this.state.startLoc);
|
|
6659
6659
|
let e = this.startNode();
|
|
6660
6660
|
return e.typeAnnotation = this.tsInType(() => (this.next(), this.match(71) ? this.tsParseTypeReference() : this.tsParseType())), this.expect(44), e.expression = this.parseMaybeUnary(), this.finishNode(e, "TSTypeAssertion");
|
|
6661
6661
|
}
|
|
6662
6662
|
tsParseHeritageClause(e) {
|
|
6663
6663
|
let t = this.state.startLoc, n = this.tsParseDelimitedList("HeritageClauseElement", () => {
|
|
6664
6664
|
let t = (this.state.canStartArrow = !1, super.parseExprSubscripts());
|
|
6665
|
-
|
|
6665
|
+
ln(t) || this.raise(U.InvalidHeritageClauseType, t.start, { token: e });
|
|
6666
6666
|
let n = e === "extends" ? "TSInterfaceHeritage" : "TSClassImplements";
|
|
6667
6667
|
if (t.type === "TSInstantiationExpression") return t.type = n, t;
|
|
6668
6668
|
let r = this.startNodeAtNode(t);
|
|
6669
6669
|
return r.expression = t, (this.match(43) || this.match(47)) && (r.typeArguments = this.tsParseTypeArgumentsInExpression()), this.finishNode(r, n);
|
|
6670
6670
|
});
|
|
6671
|
-
return n.length || this.raise(
|
|
6671
|
+
return n.length || this.raise(U.EmptyHeritageClauseType, t, { token: e }), n;
|
|
6672
6672
|
}
|
|
6673
6673
|
tsParseInterfaceDeclaration(e, t = {}) {
|
|
6674
6674
|
if (this.hasFollowingLineBreak()) return null;
|
|
6675
|
-
this.expectContextual(125), t.declare && (e.declare = !0), D(this.state.type) ? (e.id = this.parseIdentifier(), this.checkIdentifier(e.id, 130)) : (e.id = null, this.raise(
|
|
6675
|
+
this.expectContextual(125), t.declare && (e.declare = !0), D(this.state.type) ? (e.id = this.parseIdentifier(), this.checkIdentifier(e.id, 130)) : (e.id = null, this.raise(U.MissingInterfaceName, this.state.startLoc)), e.typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers), this.eat(77) && (e.extends = this.tsParseHeritageClause("extends"));
|
|
6676
6676
|
let n = this.startNode();
|
|
6677
6677
|
return n.body = this.tsInType(this.tsParseObjectTypeMembers.bind(this)), e.body = this.finishNode(n, "TSInterfaceBody"), this.finishNode(e, "TSInterfaceDeclaration");
|
|
6678
6678
|
}
|
|
@@ -6686,7 +6686,7 @@ var ln = (e) => class extends e {
|
|
|
6686
6686
|
}), this.semicolon(), this.finishNode(e, "TSTypeAliasDeclaration");
|
|
6687
6687
|
}
|
|
6688
6688
|
tsInTopLevelContext(e) {
|
|
6689
|
-
if (this.curContext() !==
|
|
6689
|
+
if (this.curContext() !== j.brace) {
|
|
6690
6690
|
let t = this.state.context;
|
|
6691
6691
|
this.state.context = [t[0]];
|
|
6692
6692
|
try {
|
|
@@ -6756,14 +6756,14 @@ var ln = (e) => class extends e {
|
|
|
6756
6756
|
else {
|
|
6757
6757
|
e.kind = "module";
|
|
6758
6758
|
let { type: t, value: n } = this.state;
|
|
6759
|
-
t === 130 ? e.id = super.parseStringLiteral(n) : D(t) ? (this.raise(
|
|
6759
|
+
t === 130 ? e.id = super.parseStringLiteral(n) : D(t) ? (this.raise(U.InlineModuleDeclarationMustUseString, this.state.startLoc), e.id = this.tsParseEntityName(0)) : t === 2 ? this.raise(U.EmptyNamespaceName, this.state.startLoc) : (this.raise(U.InvalidNamespaceName, this.state.startLoc, n), e.id = super.parseExprAtom());
|
|
6760
6760
|
}
|
|
6761
6761
|
return this.match(2) ? (t || this.scope.enter(1024), this.prodParam.enter(0), e.body = this.tsParseModuleBlock(t), this.prodParam.exit(), t || this.scope.exit()) : this.semicolon(), this.finishNode(e, "TSModuleDeclaration");
|
|
6762
6762
|
}
|
|
6763
6763
|
tsParseImportEqualsDeclaration(e, t) {
|
|
6764
6764
|
e.id = t || this.parseIdentifier(), this.checkIdentifier(e.id, 4096), this.expect(25);
|
|
6765
6765
|
let n = this.tsParseModuleReference();
|
|
6766
|
-
return e.importKind === "type" && n.type !== "TSExternalModuleReference" && this.raise(
|
|
6766
|
+
return e.importKind === "type" && n.type !== "TSExternalModuleReference" && this.raise(U.ImportAliasHasImportType, n), e.moduleReference = n, this.semicolon(), this.finishNode(e, "TSImportEqualsDeclaration");
|
|
6767
6767
|
}
|
|
6768
6768
|
tsIsExternalModuleReference() {
|
|
6769
6769
|
return this.isContextual(115) && this.lookaheadCharCode() === 40;
|
|
@@ -6804,10 +6804,10 @@ var ln = (e) => class extends e {
|
|
|
6804
6804
|
declare: !0
|
|
6805
6805
|
}));
|
|
6806
6806
|
case 103:
|
|
6807
|
-
if (this.isUsing()) return this.raise(
|
|
6807
|
+
if (this.isUsing()) return this.raise(U.InvalidModifierOnUsingDeclaration, this.state.startLoc, "declare"), e.declare = !0, this.parseVarStatement(e, "using", !0);
|
|
6808
6808
|
break;
|
|
6809
6809
|
case 92:
|
|
6810
|
-
if (this.isAwaitUsing()) return this.raise(
|
|
6810
|
+
if (this.isAwaitUsing()) return this.raise(U.InvalidModifierOnAwaitUsingDeclaration, this.state.startLoc, "declare"), e.declare = !0, this.next(), this.parseVarStatement(e, "await using", !0);
|
|
6811
6811
|
break;
|
|
6812
6812
|
case 125: {
|
|
6813
6813
|
let t = this.tsParseInterfaceDeclaration(e, { declare: !0 });
|
|
@@ -6850,7 +6850,7 @@ var ln = (e) => class extends e {
|
|
|
6850
6850
|
}
|
|
6851
6851
|
tsParseTypeArguments() {
|
|
6852
6852
|
let e = this.startNode();
|
|
6853
|
-
return e.params = this.tsInType(() => this.tsInTopLevelContext(() => (this.expect(43), this.tsParseDelimitedList("TypeParametersOrArguments", this.tsParseType.bind(this))))), e.params.length === 0 ? this.raise(
|
|
6853
|
+
return e.params = this.tsInType(() => this.tsInTopLevelContext(() => (this.expect(43), this.tsParseDelimitedList("TypeParametersOrArguments", this.tsParseType.bind(this))))), e.params.length === 0 ? this.raise(U.EmptyTypeArguments, e) : !this.state.inType && this.curContext() === j.brace && this.reScan_lt_gt(), this.expect(44), this.finishNode(e, "TSTypeParameterInstantiation");
|
|
6854
6854
|
}
|
|
6855
6855
|
tsIsDeclarationStart() {
|
|
6856
6856
|
return Te(this.state.type);
|
|
@@ -6868,13 +6868,13 @@ var ln = (e) => class extends e {
|
|
|
6868
6868
|
"readonly"
|
|
6869
6869
|
] }, r);
|
|
6870
6870
|
let i = r.accessibility, a = r.override, o = r.readonly;
|
|
6871
|
-
!(e & 4) && (i || o || a) && this.raise(
|
|
6871
|
+
!(e & 4) && (i || o || a) && this.raise(U.UnexpectedParameterModifier, n || t[0]);
|
|
6872
6872
|
let s = this.state.startLoc, c = this.parseMaybeDefault(s);
|
|
6873
6873
|
e & 2 && this.parseFunctionParamType(c);
|
|
6874
6874
|
let l = this.parseMaybeDefault(s, c);
|
|
6875
6875
|
if (i || o || a) {
|
|
6876
6876
|
let e = n ? this.startNodeAt(n) : this.startNodeAtNode(t[0]);
|
|
6877
|
-
return t.length ? e.decorators = t : this.setLoc(n), i && (e.accessibility = i), o && (e.readonly = o), a && (e.override = a), l.type !== "Identifier" && l.type !== "AssignmentPattern" && this.raise(
|
|
6877
|
+
return t.length ? e.decorators = t : this.setLoc(n), i && (e.accessibility = i), o && (e.readonly = o), a && (e.override = a), l.type !== "Identifier" && l.type !== "AssignmentPattern" && this.raise(U.UnsupportedParameterPropertyKind, n || t[0]), e.parameter = l, this.finishNode(e, "TSParameterProperty");
|
|
6878
6878
|
}
|
|
6879
6879
|
return t.length && (c.decorators = t), l;
|
|
6880
6880
|
}
|
|
@@ -6882,7 +6882,7 @@ var ln = (e) => class extends e {
|
|
|
6882
6882
|
return e.type === "TSParameterProperty" && super.isSimpleParameter(e.parameter) || super.isSimpleParameter(e);
|
|
6883
6883
|
}
|
|
6884
6884
|
tsDisallowOptionalPattern(e) {
|
|
6885
|
-
for (let t of e.params) t.type !== "Identifier" && t.optional && !this.state.isAmbientContext && this.raise(
|
|
6885
|
+
for (let t of e.params) t.type !== "Identifier" && t.optional && !this.state.isAmbientContext && this.raise(U.PatternIsOptional, t);
|
|
6886
6886
|
}
|
|
6887
6887
|
setArrowFunctionParameters(e, t, n) {
|
|
6888
6888
|
super.setArrowFunctionParameters(e, t, n), this.tsDisallowOptionalPattern(e);
|
|
@@ -6891,18 +6891,18 @@ var ln = (e) => class extends e {
|
|
|
6891
6891
|
this.match(10) && (e.returnType = this.tsParseTypeOrTypePredicateAnnotation(10));
|
|
6892
6892
|
let r = t === "FunctionDeclaration" ? "TSDeclareFunction" : t === "ClassMethod" || t === "ClassPrivateMethod" ? "TSDeclareMethod" : void 0;
|
|
6893
6893
|
if (r && !this.match(2) && this.isLineTerminator()) {
|
|
6894
|
-
if (r === "TSDeclareMethod" && e.kind === "constructor") for (let t of e.params) t.type === "TSParameterProperty" ? this.raise(
|
|
6895
|
-
else for (let t of e.params) t.type === "AssignmentPattern" && this.raise(
|
|
6894
|
+
if (r === "TSDeclareMethod" && e.kind === "constructor") for (let t of e.params) t.type === "TSParameterProperty" ? this.raise(U.UnexpectedParameterModifier, t) : t.type === "AssignmentPattern" && this.raise(U.UnexpectedParameterInitializer, t);
|
|
6895
|
+
else for (let t of e.params) t.type === "AssignmentPattern" && this.raise(U.UnexpectedParameterInitializer, t);
|
|
6896
6896
|
return this.finishNode(e, r);
|
|
6897
6897
|
}
|
|
6898
|
-
return r && this.state.isAmbientContext && (this.raise(
|
|
6898
|
+
return r && this.state.isAmbientContext && (this.raise(U.DeclareFunctionHasImplementation, this.state.startLoc), r === "TSDeclareFunction" && e.declare) ? super.parseFunctionBodyAndFinish(e, r, n) : (this.tsDisallowOptionalPattern(e), super.parseFunctionBodyAndFinish(e, t, n));
|
|
6899
6899
|
}
|
|
6900
6900
|
registerFunctionStatementId(e) {
|
|
6901
6901
|
!e.body && e.id ? this.checkIdentifier(e.id, 1024) : super.registerFunctionStatementId(e);
|
|
6902
6902
|
}
|
|
6903
6903
|
tsCheckForInvalidTypeCasts(e) {
|
|
6904
6904
|
e.forEach((e) => {
|
|
6905
|
-
e?.type === "TSTypeCastExpression" && this.raise(
|
|
6905
|
+
e?.type === "TSTypeCastExpression" && this.raise(U.UnexpectedTypeAnnotation, e.typeAnnotation);
|
|
6906
6906
|
});
|
|
6907
6907
|
}
|
|
6908
6908
|
toReferencedList(e, t) {
|
|
@@ -6948,7 +6948,7 @@ var ln = (e) => class extends e {
|
|
|
6948
6948
|
let c = this.startNodeAt(t);
|
|
6949
6949
|
return c.expression = e, c.typeArguments = o, this.finishNode(c, "TSInstantiationExpression");
|
|
6950
6950
|
});
|
|
6951
|
-
if (a && this.unexpected(a, 6), o) return o.type === "TSInstantiationExpression" && ((this.match(12) || this.match(14) && this.lookaheadCharCode() !== 40) && this.raise(
|
|
6951
|
+
if (a && this.unexpected(a, 6), o) return o.type === "TSInstantiationExpression" && ((this.match(12) || this.match(14) && this.lookaheadCharCode() !== 40) && this.raise(U.InvalidPropertyAccessAfterInstantiationExpression, this.state.startLoc), !this.match(12) && !this.match(14) && (o.expression = super.stopParseSubscript(e, r))), o;
|
|
6952
6952
|
}
|
|
6953
6953
|
return super.parseSubscript(e, t, n, r);
|
|
6954
6954
|
}
|
|
@@ -6983,19 +6983,19 @@ var ln = (e) => class extends e {
|
|
|
6983
6983
|
super.applyImportPhase(e, t, n, r), t ? e.exportKind = n === "type" ? "type" : "value" : e.importKind = n === "type" || n === "typeof" ? n : "value";
|
|
6984
6984
|
}
|
|
6985
6985
|
parseImport(e) {
|
|
6986
|
-
if (this.match(130)) return e.importKind = "value", this.scope.inTSNamespace && this.raise(
|
|
6986
|
+
if (this.match(130)) return e.importKind = "value", this.scope.inTSNamespace && this.raise(U.ImportInTSNamespace, e), super.parseImport(e);
|
|
6987
6987
|
let t;
|
|
6988
6988
|
if (D(this.state.type) && this.lookaheadCharCode() === 61) {
|
|
6989
6989
|
e.importKind = "value";
|
|
6990
6990
|
let t = this.tsParseImportEqualsDeclaration(e);
|
|
6991
|
-
return this.scope.inTSNamespace && t.moduleReference.type === "TSExternalModuleReference" && this.raise(
|
|
6991
|
+
return this.scope.inTSNamespace && t.moduleReference.type === "TSExternalModuleReference" && this.raise(U.ImportInTSNamespace, e), t;
|
|
6992
6992
|
}
|
|
6993
6993
|
if (this.isContextual(126)) {
|
|
6994
6994
|
let n = this.parseMaybeImportPhase(e, !1);
|
|
6995
|
-
if (this.lookaheadCharCode() === 61) return this.scope.inTSNamespace && this.raise(
|
|
6995
|
+
if (this.lookaheadCharCode() === 61) return this.scope.inTSNamespace && this.raise(U.ImportInTSNamespace, e), this.tsParseImportEqualsDeclaration(e, n);
|
|
6996
6996
|
t = super.parseImportSpecifiersAndAfter(e, n);
|
|
6997
6997
|
} else t = super.parseImport(e);
|
|
6998
|
-
return t.importKind === "type" && t.specifiers.length > 1 && t.specifiers[0].type === "ImportDefaultSpecifier" ? this.raise(
|
|
6998
|
+
return t.importKind === "type" && t.specifiers.length > 1 && t.specifiers[0].type === "ImportDefaultSpecifier" ? this.raise(U.TypeImportCannotSpecifyDefaultAndNamed, t) : this.scope.inTSNamespace && this.raise(U.ImportInTSNamespace, t), t;
|
|
6999
6999
|
}
|
|
7000
7000
|
parseExport(e, t) {
|
|
7001
7001
|
if (this.match(79)) {
|
|
@@ -7008,15 +7008,15 @@ var ln = (e) => class extends e {
|
|
|
7008
7008
|
}
|
|
7009
7009
|
if (this.eat(25)) {
|
|
7010
7010
|
let t = e;
|
|
7011
|
-
return t.expression = super.parseExpression(), this.semicolon(), this.sawUnambiguousESM = !0, this.scope.inTSNamespace && this.raise(
|
|
7011
|
+
return t.expression = super.parseExpression(), this.semicolon(), this.sawUnambiguousESM = !0, this.scope.inTSNamespace && this.raise(U.ExportAssignmentInTSNamespace, t), this.finishNode(t, "TSExportAssignment");
|
|
7012
7012
|
}
|
|
7013
7013
|
if (this.eatContextual(89)) {
|
|
7014
7014
|
let t = e;
|
|
7015
|
-
return this.expectContextual(124), t.id = this.parseIdentifier(), this.checkIdentifier(t.id, 8201), this.semicolon(), this.scope.inTSNamespace && this.raise(
|
|
7015
|
+
return this.expectContextual(124), t.id = this.parseIdentifier(), this.checkIdentifier(t.id, 8201), this.semicolon(), this.scope.inTSNamespace && this.raise(U.NamespaceExportInTSNamespace, t), this.finishNode(t, "TSNamespaceExportDeclaration");
|
|
7016
7016
|
}
|
|
7017
7017
|
{
|
|
7018
7018
|
let n = super.parseExport(e, t);
|
|
7019
|
-
return this.scope.inTSNamespace && (n.type !== "ExportNamedDeclaration" || n.source || !n.declaration && !this.state.isAmbientContext) && this.raise(
|
|
7019
|
+
return this.scope.inTSNamespace && (n.type !== "ExportNamedDeclaration" || n.source || !n.declaration && !this.state.isAmbientContext) && this.raise(U.ExportInTSNamespace, n), n;
|
|
7020
7020
|
}
|
|
7021
7021
|
}
|
|
7022
7022
|
isAbstractClass() {
|
|
@@ -7035,10 +7035,10 @@ var ln = (e) => class extends e {
|
|
|
7035
7035
|
}
|
|
7036
7036
|
parseVarStatement(e, t, n = !1) {
|
|
7037
7037
|
let { isAmbientContext: r } = this.state, i = super.parseVarStatement(e, t, n || r);
|
|
7038
|
-
if (r && !e.declare && (t === "using" || t === "await using")) return this.raiseOverwrite(
|
|
7038
|
+
if (r && !e.declare && (t === "using" || t === "await using")) return this.raiseOverwrite(U.UsingDeclarationInAmbientContext, e, t), i;
|
|
7039
7039
|
for (let e of i.declarations) {
|
|
7040
7040
|
let { id: n, init: i, definite: a } = e;
|
|
7041
|
-
a && (i ? this.raise(
|
|
7041
|
+
a && (i ? this.raise(U.DeclaratorDefiniteAssertionWithInitializer, n) : n.typeAnnotation || this.raise(U.DeclaratorDefiniteAssertionRequiresTypeAnnotation, n)), r && i && (t === "var" || t === "let" || n.typeAnnotation ? this.raise(U.InitializerNotAllowedInAmbientContext, i) : fn(i, this.hasPlugin("estree")) || this.raise(U.ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference, i));
|
|
7042
7042
|
}
|
|
7043
7043
|
return i;
|
|
7044
7044
|
}
|
|
@@ -7069,7 +7069,7 @@ var ln = (e) => class extends e {
|
|
|
7069
7069
|
break;
|
|
7070
7070
|
case 125: {
|
|
7071
7071
|
let e = this.tsParseInterfaceDeclaration(this.startNode());
|
|
7072
|
-
if (e) return n || this.raise(
|
|
7072
|
+
if (e) return n || this.raise(U.UnexpectedTypeDeclaration, e, "interface"), e;
|
|
7073
7073
|
break;
|
|
7074
7074
|
}
|
|
7075
7075
|
case 123:
|
|
@@ -7078,7 +7078,7 @@ var ln = (e) => class extends e {
|
|
|
7078
7078
|
return this.next(), this.tsParseDeclaration(e, 123, !1, t);
|
|
7079
7079
|
}
|
|
7080
7080
|
if (this.nextTokenIsIdentifierOnSameLine()) {
|
|
7081
|
-
this.raise(
|
|
7081
|
+
this.raise(U.InlineModuleDeclarationMustUseString, this.state.startLoc);
|
|
7082
7082
|
let e = this.startNode();
|
|
7083
7083
|
return this.next(), this.tsParseDeclaration(e, 124, !1, t);
|
|
7084
7084
|
}
|
|
@@ -7091,7 +7091,7 @@ var ln = (e) => class extends e {
|
|
|
7091
7091
|
break;
|
|
7092
7092
|
case 126: if (this.nextTokenIsIdentifierOnSameLine()) {
|
|
7093
7093
|
let e = this.startNode();
|
|
7094
|
-
return n || this.raise(
|
|
7094
|
+
return n || this.raise(U.UnexpectedTypeDeclaration, e, "type"), this.next(), this.tsParseTypeAliasDeclaration(e);
|
|
7095
7095
|
}
|
|
7096
7096
|
}
|
|
7097
7097
|
return super.parseStatementContent(e, t);
|
|
@@ -7104,7 +7104,7 @@ var ln = (e) => class extends e {
|
|
|
7104
7104
|
]);
|
|
7105
7105
|
}
|
|
7106
7106
|
tsHasSomeModifiers(e, t) {
|
|
7107
|
-
return t.some((t) =>
|
|
7107
|
+
return t.some((t) => sn(t) ? e.accessibility === t : !!e[t]);
|
|
7108
7108
|
}
|
|
7109
7109
|
tsIsStartOfStaticBlocks() {
|
|
7110
7110
|
return this.isContextual(102) && this.lookaheadCharCode() === 123;
|
|
@@ -7124,23 +7124,23 @@ var ln = (e) => class extends e {
|
|
|
7124
7124
|
allowedModifiers: r,
|
|
7125
7125
|
disallowedModifiers: ["in", "out"],
|
|
7126
7126
|
stopOnStartOfClassStaticBlock: !0,
|
|
7127
|
-
errorTemplate:
|
|
7127
|
+
errorTemplate: U.InvalidModifierOnTypeParameterPositions
|
|
7128
7128
|
}, t);
|
|
7129
7129
|
let i = () => {
|
|
7130
|
-
this.tsIsStartOfStaticBlocks() ? (this.next(), this.next(), this.tsHasSomeModifiers(t, r) && this.raise(
|
|
7130
|
+
this.tsIsStartOfStaticBlocks() ? (this.next(), this.next(), this.tsHasSomeModifiers(t, r) && this.raise(U.StaticBlockCannotHaveModifier, this.state.curPosition()), super.parseClassStaticBlock(e, t)) : this.parseClassMemberWithIsStatic(e, t, n, !!t.static);
|
|
7131
7131
|
};
|
|
7132
|
-
t.declare ? this.tsInAmbientContext(i) : i(), t.decorators && t.decorators.length > 0 && !this.hasPlugin("decorators-legacy") && (t.type === "TSAbstractMethodDefinition" || t.type === "TSDeclareMethod" ? this.raise(
|
|
7132
|
+
t.declare ? this.tsInAmbientContext(i) : i(), t.decorators && t.decorators.length > 0 && !this.hasPlugin("decorators-legacy") && (t.type === "TSAbstractMethodDefinition" || t.type === "TSDeclareMethod" ? this.raise(U.DecoratorAbstractMethod, t, { kind: "abstract method" }) : (t.type === "ClassProperty" && t.abstract || t.type === "ClassProperty" && t.declare || t.type === "TSAbstractPropertyDefinition" || t.type === "PropertyDefinition" && t.declare) && this.raise(U.DecoratorAbstractMethod, t, { kind: t.declare ? "declare field" : "abstract field" }));
|
|
7133
7133
|
}
|
|
7134
7134
|
parseClassMemberWithIsStatic(e, t, n, r) {
|
|
7135
7135
|
let i = this.tsTryParseIndexSignature(t);
|
|
7136
7136
|
if (i) {
|
|
7137
|
-
e.body.push(i), t.abstract && this.raise(
|
|
7137
|
+
e.body.push(i), t.abstract && this.raise(U.IndexSignatureHasAbstract, t), t.accessibility && this.raise(U.IndexSignatureHasAccessibility, t, { modifier: t.accessibility }), t.declare && this.raise(U.IndexSignatureHasDeclare, t), t.override && this.raise(U.IndexSignatureHasOverride, t);
|
|
7138
7138
|
return;
|
|
7139
7139
|
}
|
|
7140
|
-
!this.state.inAbstractClass && t.abstract && this.raise(
|
|
7140
|
+
!this.state.inAbstractClass && t.abstract && this.raise(U.NonAbstractClassHasAbstractMethod, t), t.override && (n.hadSuperClass || this.raise(U.OverrideNotInSubClass, t)), super.parseClassMemberWithIsStatic(e, t, n, r);
|
|
7141
7141
|
}
|
|
7142
7142
|
parsePostMemberNameModifiers(e) {
|
|
7143
|
-
this.eat(13) && (e.optional = !0), e.readonly && this.match(6) && this.raise(
|
|
7143
|
+
this.eat(13) && (e.optional = !0), e.readonly && this.match(6) && this.raise(U.ClassMethodHasReadonly, e), e.declare && this.match(6) && this.raise(U.ClassMethodHasDeclare, e);
|
|
7144
7144
|
}
|
|
7145
7145
|
shouldParseExportDeclaration() {
|
|
7146
7146
|
return this.tsIsDeclarationStart() ? !0 : super.shouldParseExportDeclaration();
|
|
@@ -7168,7 +7168,7 @@ var ln = (e) => class extends e {
|
|
|
7168
7168
|
parseExportDeclaration(e) {
|
|
7169
7169
|
if (!this.state.isAmbientContext && this.isContextual(121)) return this.tsInAmbientContext(() => this.parseExportDeclaration(e));
|
|
7170
7170
|
let t = this.state.startLoc, n = this.eatContextual(121);
|
|
7171
|
-
if (n && (this.isContextual(121) || !this.shouldParseExportDeclaration())) throw this.raise(
|
|
7171
|
+
if (n && (this.isContextual(121) || !this.shouldParseExportDeclaration())) throw this.raise(U.ExpectedAmbientAfterExportDeclare, this.state.startLoc);
|
|
7172
7172
|
let r = D(this.state.type) && this.tsTryParseExportDeclaration() || super.parseExportDeclaration(e);
|
|
7173
7173
|
return r ? ((r.type === "TSInterfaceDeclaration" || r.type === "TSTypeAliasDeclaration" || n) && (e.exportKind = "type"), n && r.type !== "TSImportEqualsDeclaration" && (this.resetStartLocation(r, t), r.declare = !0), r) : null;
|
|
7174
7174
|
}
|
|
@@ -7184,26 +7184,26 @@ var ln = (e) => class extends e {
|
|
|
7184
7184
|
parseClassPropertyAnnotation(e) {
|
|
7185
7185
|
e.optional || (this.eat(31) ? e.definite = !0 : this.eat(13) && (e.optional = !0));
|
|
7186
7186
|
let t = this.tsTryParseTypeAnnotation();
|
|
7187
|
-
t && (e.typeAnnotation = t), e.definite && (this.match(25) ? this.raise(
|
|
7187
|
+
t && (e.typeAnnotation = t), e.definite && (this.match(25) ? this.raise(U.DeclaratorDefiniteAssertionWithInitializer, e) : t || this.raise(U.DeclaratorDefiniteAssertionRequiresTypeAnnotation, e));
|
|
7188
7188
|
}
|
|
7189
7189
|
parseClassProperty(e) {
|
|
7190
|
-
if (this.parseClassPropertyAnnotation(e), this.state.isAmbientContext && !(e.readonly && !e.typeAnnotation) && this.match(25) && this.raise(
|
|
7190
|
+
if (this.parseClassPropertyAnnotation(e), this.state.isAmbientContext && !(e.readonly && !e.typeAnnotation) && this.match(25) && this.raise(U.DeclareClassFieldHasInitializer, this.state.startLoc), e.abstract && this.match(25)) {
|
|
7191
7191
|
let { key: t } = e;
|
|
7192
|
-
this.raise(
|
|
7192
|
+
this.raise(U.AbstractPropertyHasInitializer, this.state.startLoc, { propertyName: t.type === "Identifier" && !e.computed ? t.name : `[${this.input.slice(this.offsetToSourcePos(t.start), this.offsetToSourcePos(t.end))}]` });
|
|
7193
7193
|
}
|
|
7194
7194
|
return super.parseClassProperty(e);
|
|
7195
7195
|
}
|
|
7196
7196
|
parseClassPrivateProperty(e) {
|
|
7197
|
-
return e.abstract && this.raise(
|
|
7197
|
+
return e.abstract && this.raise(U.PrivateElementHasAbstract, e), e.accessibility && this.raise(U.PrivateElementHasAccessibility, e, { modifier: e.accessibility }), this.parseClassPropertyAnnotation(e), super.parseClassPrivateProperty(e);
|
|
7198
7198
|
}
|
|
7199
7199
|
parseClassAccessorProperty(e) {
|
|
7200
|
-
return this.parseClassPropertyAnnotation(e), e.optional && this.raise(
|
|
7200
|
+
return this.parseClassPropertyAnnotation(e), e.optional && this.raise(U.AccessorCannotBeOptional, e), super.parseClassAccessorProperty(e);
|
|
7201
7201
|
}
|
|
7202
7202
|
pushClassMethod(e, t, n, r, i, a) {
|
|
7203
7203
|
let o = this.tsTryParseTypeParameters(this.tsParseConstModifier);
|
|
7204
|
-
o && i && this.raise(
|
|
7204
|
+
o && i && this.raise(U.ConstructorHasTypeParameters, o);
|
|
7205
7205
|
let { declare: s = !1, kind: c } = t;
|
|
7206
|
-
s && (c === "get" || c === "set") && this.raise(
|
|
7206
|
+
s && (c === "get" || c === "set") && this.raise(U.DeclareAccessor, t, { kind: c }), o && (t.typeParameters = o), super.pushClassMethod(e, t, n, r, i, a);
|
|
7207
7207
|
}
|
|
7208
7208
|
pushClassPrivateMethod(e, t, n, r) {
|
|
7209
7209
|
let i = this.tsTryParseTypeParameters(this.tsParseConstModifier);
|
|
@@ -7244,7 +7244,7 @@ var ln = (e) => class extends e {
|
|
|
7244
7244
|
if (this.hasPlugin("jsx") && (this.match(138) || this.match(43))) {
|
|
7245
7245
|
if (r = this.state.clone(), i = this.tryParse(() => super.parseMaybeAssign(e, t), r), !i.error) return i.node;
|
|
7246
7246
|
let { context: n } = this.state, a = n[n.length - 1];
|
|
7247
|
-
(a ===
|
|
7247
|
+
(a === j.j_oTag || a === j.j_expr) && n.pop();
|
|
7248
7248
|
}
|
|
7249
7249
|
if (!i?.error && !this.match(43)) return super.parseMaybeAssign(e, t);
|
|
7250
7250
|
(!r || r === this.state) && (r = this.state.clone());
|
|
@@ -7253,19 +7253,19 @@ var ln = (e) => class extends e {
|
|
|
7253
7253
|
let i = super.parseMaybeAssign(e, t);
|
|
7254
7254
|
if ((i.type !== "ArrowFunctionExpression" || i.extra?.parenthesized) && r(), o?.params.length !== 0 && this.resetStartLocationFromNode(i, o), i.typeParameters = o, this.hasPlugin("jsx") && i.typeParameters.params.length === 1 && !i.typeParameters.extra?.trailingComma) {
|
|
7255
7255
|
let e = i.typeParameters.params[0];
|
|
7256
|
-
e.constraint || this.raise(
|
|
7256
|
+
e.constraint || this.raise(U.SingleTypeParameterWithoutTrailingComma, this.optionFlags & 256 ? n(e.loc.end, 1) : e, { typeParameterName: e.name.name });
|
|
7257
7257
|
}
|
|
7258
7258
|
return i;
|
|
7259
7259
|
}, r);
|
|
7260
7260
|
if (!s.error && !s.aborted) return o && this.reportReservedArrowTypeParam(o), s.node;
|
|
7261
|
-
if (!i && (
|
|
7261
|
+
if (!i && (an(!this.hasPlugin("jsx")), a = this.tryParse(() => super.parseMaybeAssign(e, t), r), !a.error)) return a.node;
|
|
7262
7262
|
if (i?.node) return this.state = i.failState, i.node;
|
|
7263
7263
|
if (s.node) return this.state = s.failState, o && this.reportReservedArrowTypeParam(o), s.node;
|
|
7264
7264
|
if (a?.node) return this.state = a.failState, a.node;
|
|
7265
7265
|
throw i?.error || s.error || a?.error;
|
|
7266
7266
|
}
|
|
7267
7267
|
reportReservedArrowTypeParam(e) {
|
|
7268
|
-
e.params.length === 1 && !e.params[0].constraint && !e.extra?.trailingComma && this.getPluginOption("typescript", "disallowAmbiguousJSXLike") && this.raise(
|
|
7268
|
+
e.params.length === 1 && !e.params[0].constraint && !e.extra?.trailingComma && this.getPluginOption("typescript", "disallowAmbiguousJSXLike") && this.raise(U.ReservedArrowTypeParam, e);
|
|
7269
7269
|
}
|
|
7270
7270
|
parseMaybeUnary(e, t) {
|
|
7271
7271
|
return !this.hasPlugin("jsx") && this.match(43) ? this.tsParseTypeAssertion() : super.parseMaybeUnary(e, t);
|
|
@@ -7302,7 +7302,7 @@ var ln = (e) => class extends e {
|
|
|
7302
7302
|
case "TSSatisfiesExpression":
|
|
7303
7303
|
case "TSNonNullExpression":
|
|
7304
7304
|
case "TSTypeAssertion":
|
|
7305
|
-
t ? this.expressionScope.recordArrowParameterBindingError(
|
|
7305
|
+
t ? this.expressionScope.recordArrowParameterBindingError(U.UnexpectedTypeCastInParameter, e) : this.raise(U.UnexpectedTypeCastInParameter, e), this.toAssignable(e.expression, t);
|
|
7306
7306
|
break;
|
|
7307
7307
|
case "AssignmentExpression": !t && e.left.type === "TSTypeCastExpression" && (e.left = this.typeCastToParameter(e.left));
|
|
7308
7308
|
default: super.toAssignable(e, t);
|
|
@@ -7367,7 +7367,7 @@ var ln = (e) => class extends e {
|
|
|
7367
7367
|
}
|
|
7368
7368
|
parseMaybeDefault(e, t) {
|
|
7369
7369
|
let n = super.parseMaybeDefault(e, t);
|
|
7370
|
-
return n.type === "AssignmentPattern" && n.typeAnnotation && n.right.start < n.typeAnnotation.start && this.raise(
|
|
7370
|
+
return n.type === "AssignmentPattern" && n.typeAnnotation && n.right.start < n.typeAnnotation.start && this.raise(U.TypeAnnotationAfterAssign, n.typeAnnotation), n;
|
|
7371
7371
|
}
|
|
7372
7372
|
getTokenFromCode(e) {
|
|
7373
7373
|
if (this.state.inType) {
|
|
@@ -7447,14 +7447,14 @@ var ln = (e) => class extends e {
|
|
|
7447
7447
|
}
|
|
7448
7448
|
tsParseAbstractDeclaration(e, t) {
|
|
7449
7449
|
if (this.match(76)) return e.abstract = !0, this.maybeTakeDecorators(t, this.parseClass(e, !0, !1));
|
|
7450
|
-
if (this.isContextual(125)) return this.hasFollowingLineBreak() ? null : (e.abstract = !0, this.raise(
|
|
7450
|
+
if (this.isContextual(125)) return this.hasFollowingLineBreak() ? null : (e.abstract = !0, this.raise(U.NonClassMethodPropertyHasAbstractModifier, e), this.tsParseInterfaceDeclaration(e));
|
|
7451
7451
|
throw this.unexpected(null, 76);
|
|
7452
7452
|
}
|
|
7453
7453
|
parseMethod(e, t, n, r, i, a, o) {
|
|
7454
7454
|
let s = super.parseMethod(e, t, n, r, i, a, o);
|
|
7455
7455
|
if ((s.abstract || s.type === "TSAbstractMethodDefinition") && (this.hasPlugin("estree") ? s.value : s).body) {
|
|
7456
7456
|
let { key: e } = s;
|
|
7457
|
-
this.raise(
|
|
7457
|
+
this.raise(U.AbstractMethodHasImplementation, s, { methodName: e.type === "Identifier" && !s.computed ? e.name : `[${this.input.slice(this.offsetToSourcePos(e.start), this.offsetToSourcePos(e.end))}]` });
|
|
7458
7458
|
}
|
|
7459
7459
|
return s;
|
|
7460
7460
|
}
|
|
@@ -7485,7 +7485,7 @@ var ln = (e) => class extends e {
|
|
|
7485
7485
|
O(this.state.type) ? (s = !0, a = e, o = t ? this.parseIdentifier() : this.parseModuleExportName(), c = !1) : (o = n, c = !1);
|
|
7486
7486
|
} else O(this.state.type) ? (c = !1, o = t ? this.parseIdentifier() : this.parseModuleExportName()) : (s = !0, a = e);
|
|
7487
7487
|
} else O(this.state.type) && (s = !0, t ? (a = this.parseIdentifier(!0), this.isContextual(89) || this.checkReservedWord(a.name, a.start, !0, !0)) : a = this.parseModuleExportName());
|
|
7488
|
-
s && n && this.raise(t ?
|
|
7488
|
+
s && n && this.raise(t ? U.TypeModifierIsUsedInTypeImports : U.TypeModifierIsUsedInTypeExports, l), e[r] = a, e[i] = o;
|
|
7489
7489
|
let u = t ? "importKind" : "exportKind";
|
|
7490
7490
|
e[u] = s ? "type" : "value", c && this.eatContextual(89) && (e[i] = t ? this.parseIdentifier() : this.parseModuleExportName()), e[i] || (e[i] = this.cloneIdentifier(e[r])), t && this.checkIdentifier(e[i], s ? 4098 : 4096);
|
|
7491
7491
|
}
|
|
@@ -7563,10 +7563,10 @@ var ln = (e) => class extends e {
|
|
|
7563
7563
|
}
|
|
7564
7564
|
}
|
|
7565
7565
|
chStartsBindingIdentifierAndNotRelationalOperator(e, t) {
|
|
7566
|
-
if (
|
|
7567
|
-
if (
|
|
7568
|
-
let e = this.codePointAtPos(
|
|
7569
|
-
if (!
|
|
7566
|
+
if (M(e)) {
|
|
7567
|
+
if (nn.lastIndex = t, nn.test(this.input)) {
|
|
7568
|
+
let e = this.codePointAtPos(nn.lastIndex);
|
|
7569
|
+
if (!N(e) && e !== 92) return !1;
|
|
7570
7570
|
}
|
|
7571
7571
|
return !0;
|
|
7572
7572
|
}
|
|
@@ -7581,12 +7581,12 @@ var ln = (e) => class extends e {
|
|
|
7581
7581
|
return t === 34 || t === 39;
|
|
7582
7582
|
}
|
|
7583
7583
|
};
|
|
7584
|
-
function
|
|
7584
|
+
function dn(e) {
|
|
7585
7585
|
if (e.type !== "MemberExpression") return !1;
|
|
7586
7586
|
let { computed: t, property: n } = e;
|
|
7587
|
-
return t && n.type !== "StringLiteral" && (n.type !== "TemplateLiteral" || n.expressions.length > 0) ? !1 :
|
|
7587
|
+
return t && n.type !== "StringLiteral" && (n.type !== "TemplateLiteral" || n.expressions.length > 0) ? !1 : hn(e.object);
|
|
7588
7588
|
}
|
|
7589
|
-
function
|
|
7589
|
+
function fn(e, t) {
|
|
7590
7590
|
let { type: n } = e;
|
|
7591
7591
|
if (e.extra?.parenthesized) return !1;
|
|
7592
7592
|
if (t) {
|
|
@@ -7595,25 +7595,25 @@ function dn(e, t) {
|
|
|
7595
7595
|
if (typeof t == "string" || typeof t == "boolean") return !0;
|
|
7596
7596
|
}
|
|
7597
7597
|
} else if (n === "StringLiteral" || n === "BooleanLiteral") return !0;
|
|
7598
|
-
return !!(
|
|
7598
|
+
return !!(pn(e, t) || mn(e, t) || n === "TemplateLiteral" && e.expressions.length === 0 || dn(e));
|
|
7599
7599
|
}
|
|
7600
|
-
function
|
|
7600
|
+
function pn(e, t) {
|
|
7601
7601
|
return t ? e.type === "Literal" && (typeof e.value == "number" || "bigint" in e) : e.type === "NumericLiteral" || e.type === "BigIntLiteral";
|
|
7602
7602
|
}
|
|
7603
|
-
function
|
|
7603
|
+
function mn(e, t) {
|
|
7604
7604
|
if (e.type === "UnaryExpression") {
|
|
7605
7605
|
let { operator: n, argument: r } = e;
|
|
7606
|
-
if (n === "-" &&
|
|
7606
|
+
if (n === "-" && pn(r, t)) return !0;
|
|
7607
7607
|
}
|
|
7608
7608
|
return !1;
|
|
7609
7609
|
}
|
|
7610
|
-
function
|
|
7611
|
-
return e.type === "Identifier" ? !0 : e.type !== "MemberExpression" || e.computed ? !1 :
|
|
7610
|
+
function hn(e) {
|
|
7611
|
+
return e.type === "Identifier" ? !0 : e.type !== "MemberExpression" || e.computed ? !1 : hn(e.object);
|
|
7612
7612
|
}
|
|
7613
|
-
var
|
|
7613
|
+
var gn = h`placeholders`({
|
|
7614
7614
|
ClassNameIsRequired: "A class name is required.",
|
|
7615
7615
|
UnexpectedSpace: "Unexpected space in placeholder."
|
|
7616
|
-
}),
|
|
7616
|
+
}), _n = (e) => class extends e {
|
|
7617
7617
|
parsePlaceholder(e) {
|
|
7618
7618
|
if (this.match(129)) {
|
|
7619
7619
|
let t = this.startNode();
|
|
@@ -7683,7 +7683,7 @@ var hn = h`placeholders`({
|
|
|
7683
7683
|
if (a) {
|
|
7684
7684
|
if (this.match(77) || this.match(129) || this.match(2)) e.id = a;
|
|
7685
7685
|
else if (n || !t) return e.id = null, e.body = this.finishPlaceholder(a, "ClassBody"), this.finishNode(e, r);
|
|
7686
|
-
else throw this.raise(
|
|
7686
|
+
else throw this.raise(gn.ClassNameIsRequired, this.state.startLoc);
|
|
7687
7687
|
} else this.parseClassId(e, t, n);
|
|
7688
7688
|
return super.parseClassSuper(e), e.body = this.parsePlaceholder("ClassBody") || super.parseClassBody(!!e.superClass, i), this.finishNode(e, r);
|
|
7689
7689
|
}
|
|
@@ -7721,9 +7721,9 @@ var hn = h`placeholders`({
|
|
|
7721
7721
|
return this.parsePlaceholder("StringLiteral") || super.parseImportSource();
|
|
7722
7722
|
}
|
|
7723
7723
|
assertNoSpace() {
|
|
7724
|
-
this.state.start > this.offsetToSourcePos(this.state.lastTokEndLoc.index) && this.raise(
|
|
7724
|
+
this.state.start > this.offsetToSourcePos(this.state.lastTokEndLoc.index) && this.raise(gn.UnexpectedSpace, this.state.lastTokEndLoc);
|
|
7725
7725
|
}
|
|
7726
|
-
},
|
|
7726
|
+
}, vn = (e) => class extends e {
|
|
7727
7727
|
parseV8Intrinsic() {
|
|
7728
7728
|
if (this.match(50)) {
|
|
7729
7729
|
let e = this.state.startLoc, t = this.startNode();
|
|
@@ -7737,29 +7737,29 @@ var hn = h`placeholders`({
|
|
|
7737
7737
|
parseExprAtom(e) {
|
|
7738
7738
|
return this.parseV8Intrinsic() || super.parseExprAtom(e);
|
|
7739
7739
|
}
|
|
7740
|
-
},
|
|
7740
|
+
}, yn = ["fsharp", "hack"], bn = [
|
|
7741
7741
|
"^^",
|
|
7742
7742
|
"@@",
|
|
7743
7743
|
"^",
|
|
7744
7744
|
"%",
|
|
7745
7745
|
"#"
|
|
7746
7746
|
];
|
|
7747
|
-
function
|
|
7747
|
+
function xn(e) {
|
|
7748
7748
|
if (e.has("decorators") && e.has("decorators-legacy")) throw Error("Cannot use the decorators and decorators-legacy plugin together");
|
|
7749
7749
|
if (e.has("flow") && e.has("typescript")) throw Error("Cannot combine flow and typescript plugins.");
|
|
7750
7750
|
if (e.has("placeholders") && e.has("v8intrinsic")) throw Error("Cannot combine placeholders and v8intrinsic plugins.");
|
|
7751
7751
|
if (e.has("pipelineOperator")) {
|
|
7752
7752
|
let t = e.get("pipelineOperator").proposal;
|
|
7753
|
-
if (!
|
|
7754
|
-
let e =
|
|
7753
|
+
if (!yn.includes(t)) {
|
|
7754
|
+
let e = yn.map((e) => `"${e}"`).join(", ");
|
|
7755
7755
|
throw Error(`"pipelineOperator" requires "proposal" option whose value must be one of: ${e}.`);
|
|
7756
7756
|
}
|
|
7757
7757
|
if (t === "hack") {
|
|
7758
7758
|
if (e.has("placeholders")) throw Error("Cannot combine placeholders plugin and Hack-style pipes.");
|
|
7759
7759
|
if (e.has("v8intrinsic")) throw Error("Cannot combine v8intrinsic plugin and Hack-style pipes.");
|
|
7760
7760
|
let t = e.get("pipelineOperator").topicToken;
|
|
7761
|
-
if (!
|
|
7762
|
-
let e =
|
|
7761
|
+
if (!bn.includes(t)) {
|
|
7762
|
+
let e = bn.map((e) => `"${e}"`).join(", ");
|
|
7763
7763
|
throw Error(`"pipelineOperator" in "proposal": "hack" mode also requires a "topicToken" option whose value must be one of: ${e}.`);
|
|
7764
7764
|
}
|
|
7765
7765
|
}
|
|
@@ -7776,14 +7776,14 @@ function bn(e) {
|
|
|
7776
7776
|
if (e.has("decimal")) throw Error("The 'decimal' plugin has been removed in Babel 8. Please remove it from your configuration.");
|
|
7777
7777
|
if (e.has("importReflection")) throw Error("The 'importReflection' plugin has been removed in Babel 8. Use 'sourcePhaseImports' instead, and replace 'import module' with 'import source' in your code.");
|
|
7778
7778
|
}
|
|
7779
|
-
var
|
|
7779
|
+
var Sn = {
|
|
7780
7780
|
estree: ne,
|
|
7781
|
-
jsx:
|
|
7782
|
-
flow:
|
|
7783
|
-
typescript:
|
|
7784
|
-
v8intrinsic:
|
|
7785
|
-
placeholders:
|
|
7786
|
-
},
|
|
7781
|
+
jsx: dt,
|
|
7782
|
+
flow: it,
|
|
7783
|
+
typescript: un,
|
|
7784
|
+
v8intrinsic: vn,
|
|
7785
|
+
placeholders: _n
|
|
7786
|
+
}, Cn = Object.keys(Sn), wn = class extends tn {
|
|
7787
7787
|
constructor(e, t, n) {
|
|
7788
7788
|
let r = te(e);
|
|
7789
7789
|
super(r, t), this.options = r, this.initializeScopes(), this.plugins = n, this.filename = r.sourceFilename, this.startIndex = r.startIndex;
|
|
@@ -7791,7 +7791,7 @@ var xn = {
|
|
|
7791
7791
|
r.allowAwaitOutsideFunction && (i |= 1), r.allowReturnOutsideFunction && (i |= 2), r.allowImportExportEverywhere && (i |= 8), r.allowSuperOutsideMethod && (i |= 16), r.allowUndeclaredExports && (i |= 64), r.allowNewTargetOutsideFunction && (i |= 4), r.allowYieldOutsideFunction && (i |= 32), r.ranges && (i |= 128), r.locations === !0 && (i |= 256), r.tokens && (i |= 512), r.createImportExpressions && (i |= 1024), r.createParenthesizedExpressions && (i |= 2048), r.errorRecovery && (i |= 4096), r.attachComment && (i |= 8192), r.annexB && (i |= 16384), this.optionFlags = i;
|
|
7792
7792
|
}
|
|
7793
7793
|
getScopeHandler() {
|
|
7794
|
-
return
|
|
7794
|
+
return Ye;
|
|
7795
7795
|
}
|
|
7796
7796
|
parse() {
|
|
7797
7797
|
this.enterInitialScopes();
|
|
@@ -7801,97 +7801,103 @@ var xn = {
|
|
|
7801
7801
|
return n.errors = this.state.errors, n.comments.length = this.state.commentsLen, n;
|
|
7802
7802
|
}
|
|
7803
7803
|
};
|
|
7804
|
-
function
|
|
7804
|
+
function Tn(e, t) {
|
|
7805
7805
|
if (t?.sourceType === "unambiguous") {
|
|
7806
7806
|
t = { ...t };
|
|
7807
7807
|
try {
|
|
7808
7808
|
t.sourceType = "module";
|
|
7809
|
-
let n =
|
|
7809
|
+
let n = Dn(t, e), r = n.parse();
|
|
7810
7810
|
if (n.sawUnambiguousESM) return r;
|
|
7811
7811
|
if (n.ambiguousScriptDifferentAst) try {
|
|
7812
|
-
return t.sourceType = "script",
|
|
7812
|
+
return t.sourceType = "script", Dn(t, e).parse();
|
|
7813
7813
|
} catch {}
|
|
7814
7814
|
else r.program.sourceType = "script";
|
|
7815
7815
|
return r;
|
|
7816
7816
|
} catch (n) {
|
|
7817
7817
|
try {
|
|
7818
|
-
return t.sourceType = "script",
|
|
7818
|
+
return t.sourceType = "script", Dn(t, e).parse();
|
|
7819
7819
|
} catch {}
|
|
7820
7820
|
throw n;
|
|
7821
7821
|
}
|
|
7822
7822
|
}
|
|
7823
|
-
return
|
|
7823
|
+
return Dn(t, e).parse();
|
|
7824
7824
|
}
|
|
7825
|
-
function
|
|
7825
|
+
function En(e) {
|
|
7826
7826
|
let t = {};
|
|
7827
7827
|
for (let n of Object.keys(e)) t[n] = ke(e[n]);
|
|
7828
7828
|
return t;
|
|
7829
7829
|
}
|
|
7830
|
-
|
|
7831
|
-
function
|
|
7832
|
-
let n =
|
|
7830
|
+
En(pe);
|
|
7831
|
+
function Dn(e, t) {
|
|
7832
|
+
let n = wn, r = /* @__PURE__ */ new Map();
|
|
7833
7833
|
if (e?.plugins) {
|
|
7834
7834
|
for (let t of e.plugins) {
|
|
7835
7835
|
let e, n;
|
|
7836
7836
|
typeof t == "string" ? e = t : [e, n] = t, r.has(e) || r.set(e, n || {});
|
|
7837
7837
|
}
|
|
7838
|
-
|
|
7838
|
+
xn(r), n = kn(r);
|
|
7839
7839
|
}
|
|
7840
7840
|
return new n(e, t, r);
|
|
7841
7841
|
}
|
|
7842
|
-
var
|
|
7843
|
-
function
|
|
7842
|
+
var On = /* @__PURE__ */ new Map();
|
|
7843
|
+
function kn(e) {
|
|
7844
7844
|
let t = [];
|
|
7845
|
-
for (let n of
|
|
7846
|
-
let n = t.join("|"), r =
|
|
7845
|
+
for (let n of Cn) e.has(n) && t.push(n);
|
|
7846
|
+
let n = t.join("|"), r = On.get(n);
|
|
7847
7847
|
if (!r) {
|
|
7848
|
-
r =
|
|
7849
|
-
for (let e of t) r =
|
|
7850
|
-
|
|
7848
|
+
r = wn;
|
|
7849
|
+
for (let e of t) r = Sn[e](r);
|
|
7850
|
+
On.set(n, r);
|
|
7851
7851
|
}
|
|
7852
7852
|
return r;
|
|
7853
7853
|
}
|
|
7854
|
-
var
|
|
7854
|
+
var An = {
|
|
7855
7855
|
platformExports: /* @__PURE__ */ new Set(["engineContract", "identity"]),
|
|
7856
7856
|
platformModule: "open-flow:platform",
|
|
7857
7857
|
platformSource: `export const engineContract = ${JSON.stringify("open-flow-engine/v1")}
|
|
7858
7858
|
export function identity(value) { return value }
|
|
7859
7859
|
`
|
|
7860
7860
|
};
|
|
7861
|
-
function
|
|
7862
|
-
return e == "open-flow-engine/v1" ?
|
|
7861
|
+
function jn(e) {
|
|
7862
|
+
return e == "open-flow-engine/v1" ? An : void 0;
|
|
7863
|
+
}
|
|
7864
|
+
//#endregion
|
|
7865
|
+
//#region src/flow/common/change.ts
|
|
7866
|
+
function W(e) {
|
|
7867
|
+
return Object.fromEntries(e.map((e) => [e.handle, e]));
|
|
7863
7868
|
}
|
|
7864
7869
|
//#endregion
|
|
7865
7870
|
//#region src/flow/common/encoding.ts
|
|
7866
|
-
var
|
|
7867
|
-
function
|
|
7871
|
+
var Mn = new TextEncoder();
|
|
7872
|
+
function Nn(e) {
|
|
7868
7873
|
if (e == null || typeof e == "boolean" || typeof e == "string" || typeof e == "number") return JSON.stringify(e);
|
|
7869
|
-
if (Array.isArray(e)) return `[${e.map(
|
|
7874
|
+
if (Array.isArray(e)) return `[${e.map(Nn).join(",")}]`;
|
|
7870
7875
|
let t = e;
|
|
7871
|
-
return `{${Object.keys(t).toSorted().map((e) => `${JSON.stringify(e)}:${
|
|
7876
|
+
return `{${Object.keys(t).toSorted().map((e) => `${JSON.stringify(e)}:${Nn(t[e])}`).join(",")}}`;
|
|
7872
7877
|
}
|
|
7873
|
-
function
|
|
7874
|
-
return
|
|
7878
|
+
function Pn(e) {
|
|
7879
|
+
return Mn.encode(Nn(e));
|
|
7875
7880
|
}
|
|
7876
|
-
async function
|
|
7881
|
+
async function Fn(e) {
|
|
7877
7882
|
let t = new Uint8Array(e.byteLength);
|
|
7878
7883
|
return t.set(e), `sha256:${[...new Uint8Array(await crypto.subtle.digest("SHA-256", t))].map((e) => e.toString(16).padStart(2, "0")).join("")}`;
|
|
7879
7884
|
}
|
|
7880
|
-
function
|
|
7885
|
+
function In(e) {
|
|
7881
7886
|
return Object.keys(e).toSorted().map((t) => [t, e[t]]);
|
|
7882
7887
|
}
|
|
7883
|
-
function
|
|
7888
|
+
function Ln(e) {
|
|
7884
7889
|
return {
|
|
7885
7890
|
...e.description == null ? {} : { description: e.description },
|
|
7891
|
+
handle: e.handle,
|
|
7886
7892
|
jsonSchema: e.jsonSchema,
|
|
7887
7893
|
nullable: e.nullable,
|
|
7888
7894
|
...Object.hasOwn(e, "value") ? { value: e.value } : {}
|
|
7889
7895
|
};
|
|
7890
7896
|
}
|
|
7891
7897
|
function G(e) {
|
|
7892
|
-
return
|
|
7898
|
+
return e.map(Ln);
|
|
7893
7899
|
}
|
|
7894
|
-
function
|
|
7900
|
+
function Rn(e) {
|
|
7895
7901
|
switch (e.kind) {
|
|
7896
7902
|
case "sources": return {
|
|
7897
7903
|
kind: e.kind,
|
|
@@ -7903,23 +7909,25 @@ function Ln(e) {
|
|
|
7903
7909
|
};
|
|
7904
7910
|
}
|
|
7905
7911
|
}
|
|
7906
|
-
function Rn(e) {
|
|
7907
|
-
return Object.fromEntries(Fn(e).map(([e, t]) => [e, Ln(t)]));
|
|
7908
|
-
}
|
|
7909
7912
|
function zn(e) {
|
|
7910
|
-
return Object.fromEntries(
|
|
7911
|
-
...t.description == null ? {} : { description: t.description },
|
|
7912
|
-
jsonSchema: t.jsonSchema,
|
|
7913
|
-
nullable: t.nullable,
|
|
7914
|
-
sources: t.sources.map((e) => ({ ...e }))
|
|
7915
|
-
}]));
|
|
7913
|
+
return Object.fromEntries(In(e).map(([e, t]) => [e, Rn(t)]));
|
|
7916
7914
|
}
|
|
7917
7915
|
function Bn(e) {
|
|
7918
|
-
|
|
7916
|
+
return e.map((e) => ({
|
|
7917
|
+
...e.description == null ? {} : { description: e.description },
|
|
7918
|
+
handle: e.handle,
|
|
7919
|
+
jsonSchema: e.jsonSchema,
|
|
7920
|
+
nullable: e.nullable,
|
|
7921
|
+
sources: e.sources.map((e) => ({ ...e }))
|
|
7922
|
+
}));
|
|
7923
|
+
}
|
|
7924
|
+
function Vn(e) {
|
|
7925
|
+
if (!("inputs" in e)) return Jn(e);
|
|
7919
7926
|
let t = {
|
|
7920
7927
|
concurrency: e.concurrency,
|
|
7921
7928
|
...e.description == null ? {} : { description: e.description },
|
|
7922
|
-
|
|
7929
|
+
...e.icon == null ? {} : { icon: e.icon },
|
|
7930
|
+
inputs: zn(e.inputs),
|
|
7923
7931
|
...e.name == null ? {} : { name: e.name },
|
|
7924
7932
|
...e.timeoutMs == null ? {} : { timeoutMs: e.timeoutMs }
|
|
7925
7933
|
};
|
|
@@ -7938,7 +7946,7 @@ function Bn(e) {
|
|
|
7938
7946
|
...e.defaultOutput == null ? {} : { defaultOutput: e.defaultOutput },
|
|
7939
7947
|
input: {
|
|
7940
7948
|
handle: e.input.handle,
|
|
7941
|
-
...
|
|
7949
|
+
...Ln(e.input)
|
|
7942
7950
|
},
|
|
7943
7951
|
kind: e.kind
|
|
7944
7952
|
};
|
|
@@ -7954,7 +7962,7 @@ function Bn(e) {
|
|
|
7954
7962
|
} : {
|
|
7955
7963
|
...t,
|
|
7956
7964
|
kind: e.kind,
|
|
7957
|
-
task:
|
|
7965
|
+
task: Wn(e.task)
|
|
7958
7966
|
};
|
|
7959
7967
|
case "value": return {
|
|
7960
7968
|
...t,
|
|
@@ -7963,10 +7971,10 @@ function Bn(e) {
|
|
|
7963
7971
|
};
|
|
7964
7972
|
}
|
|
7965
7973
|
}
|
|
7966
|
-
function Vn(e) {
|
|
7967
|
-
return { nodes: Object.fromEntries(Fn(e.nodes).map(([e, t]) => [e, Bn(t)])) };
|
|
7968
|
-
}
|
|
7969
7974
|
function Hn(e) {
|
|
7975
|
+
return { nodes: Object.fromEntries(In(e.nodes).map(([e, t]) => [e, Vn(t)])) };
|
|
7976
|
+
}
|
|
7977
|
+
function Un(e) {
|
|
7970
7978
|
return {
|
|
7971
7979
|
executor: e.executor,
|
|
7972
7980
|
inputs: G(e.inputs),
|
|
@@ -7974,7 +7982,7 @@ function Hn(e) {
|
|
|
7974
7982
|
outputs: G(e.outputs)
|
|
7975
7983
|
};
|
|
7976
7984
|
}
|
|
7977
|
-
function
|
|
7985
|
+
function Wn(e) {
|
|
7978
7986
|
return {
|
|
7979
7987
|
...e.capabilities == null ? {} : { capabilities: e.capabilities.map(({ action: e, connectionId: t, kind: n }) => ({
|
|
7980
7988
|
action: e,
|
|
@@ -7987,7 +7995,7 @@ function Un(e) {
|
|
|
7987
7995
|
outputs: G(e.outputs)
|
|
7988
7996
|
};
|
|
7989
7997
|
}
|
|
7990
|
-
function
|
|
7998
|
+
function Gn(e) {
|
|
7991
7999
|
return {
|
|
7992
8000
|
configSchema: e.configSchema,
|
|
7993
8001
|
definitionVersion: e.definitionVersion,
|
|
@@ -8009,7 +8017,7 @@ function Wn(e) {
|
|
|
8009
8017
|
type: e.type
|
|
8010
8018
|
};
|
|
8011
8019
|
}
|
|
8012
|
-
function
|
|
8020
|
+
function Kn(e) {
|
|
8013
8021
|
return {
|
|
8014
8022
|
...e.allowedMethods == null ? {} : { allowedMethods: e.allowedMethods },
|
|
8015
8023
|
...e.allowedOrigins == null ? {} : { allowedOrigins: e.allowedOrigins },
|
|
@@ -8019,7 +8027,7 @@ function Gn(e) {
|
|
|
8019
8027
|
...e.responseStatusCode == null ? {} : { responseStatusCode: e.responseStatusCode }
|
|
8020
8028
|
};
|
|
8021
8029
|
}
|
|
8022
|
-
function
|
|
8030
|
+
function qn(e) {
|
|
8023
8031
|
switch (e.type) {
|
|
8024
8032
|
case "cron": return {
|
|
8025
8033
|
expression: e.expression,
|
|
@@ -8033,9 +8041,10 @@ function Kn(e) {
|
|
|
8033
8041
|
};
|
|
8034
8042
|
}
|
|
8035
8043
|
}
|
|
8036
|
-
function
|
|
8044
|
+
function Jn(e) {
|
|
8037
8045
|
let t = (t) => ({
|
|
8038
8046
|
...e.description == null ? {} : { description: e.description },
|
|
8047
|
+
...e.icon == null ? {} : { icon: e.icon },
|
|
8039
8048
|
kind: t,
|
|
8040
8049
|
name: e.name
|
|
8041
8050
|
});
|
|
@@ -8044,30 +8053,30 @@ function qn(e) {
|
|
|
8044
8053
|
...t(e.kind),
|
|
8045
8054
|
inputsDef: e.inputsDef.map((e) => ({
|
|
8046
8055
|
handle: e.handle,
|
|
8047
|
-
...
|
|
8056
|
+
...Ln(e)
|
|
8048
8057
|
})),
|
|
8049
|
-
...e.options == null ? {} : { options:
|
|
8058
|
+
...e.options == null ? {} : { options: Kn(e.options) }
|
|
8050
8059
|
};
|
|
8051
8060
|
case "cron": return {
|
|
8052
8061
|
...t(e.kind),
|
|
8053
|
-
cronTimes: e.cronTimes.map(
|
|
8062
|
+
cronTimes: e.cronTimes.map(qn)
|
|
8054
8063
|
};
|
|
8055
8064
|
case "poll": return {
|
|
8056
8065
|
...t(e.kind),
|
|
8057
8066
|
bindingId: e.bindingId,
|
|
8058
8067
|
config: e.config,
|
|
8059
|
-
definition:
|
|
8060
|
-
pollTimes: e.pollTimes.map(
|
|
8068
|
+
definition: Gn(e.definition),
|
|
8069
|
+
pollTimes: e.pollTimes.map(qn)
|
|
8061
8070
|
};
|
|
8062
8071
|
case "integration": return {
|
|
8063
8072
|
...t(e.kind),
|
|
8064
8073
|
bindingId: e.bindingId,
|
|
8065
8074
|
config: e.config,
|
|
8066
|
-
definition:
|
|
8075
|
+
definition: Gn(e.definition)
|
|
8067
8076
|
};
|
|
8068
8077
|
}
|
|
8069
8078
|
}
|
|
8070
|
-
function
|
|
8079
|
+
function Yn(e) {
|
|
8071
8080
|
return {
|
|
8072
8081
|
imports: e.imports.toSorted(),
|
|
8073
8082
|
name: e.name,
|
|
@@ -8076,10 +8085,10 @@ function Jn(e) {
|
|
|
8076
8085
|
}
|
|
8077
8086
|
//#endregion
|
|
8078
8087
|
//#region src/flow/common/semantics.ts
|
|
8079
|
-
function
|
|
8088
|
+
function Xn(e) {
|
|
8080
8089
|
return Object.keys(e).toSorted().map((t) => [t, e[t]]);
|
|
8081
8090
|
}
|
|
8082
|
-
async function
|
|
8091
|
+
async function Zn(e) {
|
|
8083
8092
|
let t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
|
|
8084
8093
|
function o(e) {
|
|
8085
8094
|
t.add(e);
|
|
@@ -8094,7 +8103,7 @@ async function Xn(e) {
|
|
|
8094
8103
|
for (let t of Object.values(e)) if (t.kind == "sources") for (let e of t.sources) e.kind == "binding" && (n.add(e.bindingId), o(e.bindingId));
|
|
8095
8104
|
}
|
|
8096
8105
|
function l(e) {
|
|
8097
|
-
for (let [, t] of
|
|
8106
|
+
for (let [, t] of Xn(e.nodes)) switch ("inputs" in t && c(t.inputs), t.kind) {
|
|
8098
8107
|
case "condition": break;
|
|
8099
8108
|
case "subflow":
|
|
8100
8109
|
u(t.subflowId);
|
|
@@ -8114,20 +8123,20 @@ async function Xn(e) {
|
|
|
8114
8123
|
n != null && l(n.graph);
|
|
8115
8124
|
}
|
|
8116
8125
|
l(e.document.graph);
|
|
8117
|
-
let d =
|
|
8126
|
+
let d = Pn({
|
|
8118
8127
|
bindings: Object.fromEntries([...t].toSorted().map((t) => [t, e.document.bindings[t] ?? null])),
|
|
8119
|
-
graph:
|
|
8128
|
+
graph: Hn(e.document.graph),
|
|
8120
8129
|
kind: "open-flow-semantic-closure",
|
|
8121
8130
|
modelVersion: e.modelVersion,
|
|
8122
|
-
modules: Object.fromEntries([...r].toSorted().map((t) => [t, e.modules[t] == null ? null :
|
|
8123
|
-
tasks: Object.fromEntries([...a].toSorted().map((t) => [t, e.document.tasks[t] == null ? null :
|
|
8131
|
+
modules: Object.fromEntries([...r].toSorted().map((t) => [t, e.modules[t] == null ? null : Yn(e.modules[t])])),
|
|
8132
|
+
tasks: Object.fromEntries([...a].toSorted().map((t) => [t, e.document.tasks[t] == null ? null : Un(e.document.tasks[t])])),
|
|
8124
8133
|
subflows: Object.fromEntries([...i].toSorted().map((t) => {
|
|
8125
8134
|
let n = e.document.subflows[t];
|
|
8126
8135
|
return n == null ? [t, null] : [t, {
|
|
8127
|
-
graph:
|
|
8136
|
+
graph: Hn(n.graph),
|
|
8128
8137
|
inputs: G(n.inputs),
|
|
8129
8138
|
name: n.name,
|
|
8130
|
-
outputs:
|
|
8139
|
+
outputs: Bn(n.outputs)
|
|
8131
8140
|
}];
|
|
8132
8141
|
})),
|
|
8133
8142
|
version: 1
|
|
@@ -8140,10 +8149,10 @@ async function Xn(e) {
|
|
|
8140
8149
|
subflows: i,
|
|
8141
8150
|
tasks: a
|
|
8142
8151
|
},
|
|
8143
|
-
digest: await
|
|
8152
|
+
digest: await Fn(d)
|
|
8144
8153
|
};
|
|
8145
8154
|
}
|
|
8146
|
-
function
|
|
8155
|
+
function Qn(e) {
|
|
8147
8156
|
return e.kind == "poll" || e.kind == "integration" ? e.definition.payloadSchema : e.kind == "cron" ? {
|
|
8148
8157
|
additionalProperties: !1,
|
|
8149
8158
|
type: "object"
|
|
@@ -8175,16 +8184,16 @@ function J(e, t) {
|
|
|
8175
8184
|
J(n.type == "RestElement" ? n.argument : n.value, t);
|
|
8176
8185
|
}
|
|
8177
8186
|
}
|
|
8178
|
-
function
|
|
8187
|
+
function $n(e) {
|
|
8179
8188
|
if (typeof e != "object" || !e) return;
|
|
8180
8189
|
let t = e;
|
|
8181
8190
|
if (t.type == "Identifier" && typeof t.name == "string") return t.name;
|
|
8182
8191
|
if (t.type == "StringLiteral" && typeof t.value == "string") return t.value;
|
|
8183
8192
|
}
|
|
8184
|
-
function
|
|
8193
|
+
function er(e, t, n) {
|
|
8185
8194
|
let r;
|
|
8186
8195
|
try {
|
|
8187
|
-
r =
|
|
8196
|
+
r = Tn(t, {
|
|
8188
8197
|
createImportExpressions: !0,
|
|
8189
8198
|
sourceFilename: q(e),
|
|
8190
8199
|
sourceType: "module"
|
|
@@ -8206,7 +8215,7 @@ function $n(e, t, n) {
|
|
|
8206
8215
|
let e = t.specifiers.flatMap((e) => {
|
|
8207
8216
|
if (e.type == "ImportNamespaceSpecifier") return [];
|
|
8208
8217
|
if (e.type == "ImportDefaultSpecifier") return ["default"];
|
|
8209
|
-
let t =
|
|
8218
|
+
let t = $n(e.imported);
|
|
8210
8219
|
return t == null ? [] : [t];
|
|
8211
8220
|
});
|
|
8212
8221
|
a.push({
|
|
@@ -8233,7 +8242,7 @@ function $n(e, t, n) {
|
|
|
8233
8242
|
if (t.declaration?.type == "VariableDeclaration") for (let e of t.declaration.declarations) J(e.id, i);
|
|
8234
8243
|
else (t.declaration?.type == "FunctionDeclaration" || t.declaration?.type == "ClassDeclaration") && t.declaration.id != null && i.add(t.declaration.id.name);
|
|
8235
8244
|
for (let e of t.specifiers) {
|
|
8236
|
-
let t =
|
|
8245
|
+
let t = $n(e.exported);
|
|
8237
8246
|
t != null && i.add(t);
|
|
8238
8247
|
}
|
|
8239
8248
|
}
|
|
@@ -8268,14 +8277,14 @@ function $n(e, t, n) {
|
|
|
8268
8277
|
imports: a
|
|
8269
8278
|
};
|
|
8270
8279
|
}
|
|
8271
|
-
function
|
|
8280
|
+
function tr(e) {
|
|
8272
8281
|
return /^\.\/(.+)\.mjs$/.exec(e)?.[1];
|
|
8273
8282
|
}
|
|
8274
|
-
function
|
|
8283
|
+
function nr(e, t) {
|
|
8275
8284
|
return e < t ? -1 : +(e > t);
|
|
8276
8285
|
}
|
|
8277
|
-
function
|
|
8278
|
-
return
|
|
8286
|
+
function rr(e, t) {
|
|
8287
|
+
return nr(e.path, t.path) || e.line - t.line || e.column - t.column || nr(e.code, t.code) || nr(e.message, t.message);
|
|
8279
8288
|
}
|
|
8280
8289
|
function Y(e, t, n) {
|
|
8281
8290
|
return {
|
|
@@ -8299,8 +8308,8 @@ function Z(e) {
|
|
|
8299
8308
|
function Q(e) {
|
|
8300
8309
|
return Array.isArray(e) ? e : void 0;
|
|
8301
8310
|
}
|
|
8302
|
-
function
|
|
8303
|
-
if (Array.isArray(e)) return e.some((e) =>
|
|
8311
|
+
function ir(e, t) {
|
|
8312
|
+
if (Array.isArray(e)) return e.some((e) => ir(e, t));
|
|
8304
8313
|
switch (e) {
|
|
8305
8314
|
case void 0: return !0;
|
|
8306
8315
|
case "null": return t == null;
|
|
@@ -8324,7 +8333,7 @@ function $(e, t) {
|
|
|
8324
8333
|
let a = Q(n.oneOf);
|
|
8325
8334
|
if (a != null && a.filter((t) => $(e, t)).length != 1 || n.not != null && $(e, n.not) || n.const != null && !X(e, n.const)) return !1;
|
|
8326
8335
|
let o = Q(n.enum);
|
|
8327
|
-
if (o != null && !o.some((t) => X(e, t)) || !
|
|
8336
|
+
if (o != null && !o.some((t) => X(e, t)) || !ir(n.type, e)) return !1;
|
|
8328
8337
|
if (typeof e == "string") {
|
|
8329
8338
|
if (typeof n.minLength == "number" && e.length < n.minLength || typeof n.maxLength == "number" && e.length > n.maxLength) return !1;
|
|
8330
8339
|
if (typeof n.pattern == "string") try {
|
|
@@ -8349,7 +8358,7 @@ function $(e, t) {
|
|
|
8349
8358
|
}
|
|
8350
8359
|
return !0;
|
|
8351
8360
|
}
|
|
8352
|
-
function
|
|
8361
|
+
function ar(e, t) {
|
|
8353
8362
|
if (e === !0 || t === !0 || X(e, {}) || X(t, {})) return !0;
|
|
8354
8363
|
if (e === !1 || t === !1) return !1;
|
|
8355
8364
|
if (X(e, t)) return !0;
|
|
@@ -8360,13 +8369,13 @@ function ir(e, t) {
|
|
|
8360
8369
|
for (let [e, t] of Object.entries(i)) {
|
|
8361
8370
|
let n = a[e];
|
|
8362
8371
|
if (n != null) {
|
|
8363
|
-
if (!
|
|
8372
|
+
if (!ar(t, n)) return !1;
|
|
8364
8373
|
} else if (r.additionalProperties === !1) return !1;
|
|
8365
|
-
else if (r.additionalProperties != null && r.additionalProperties !== !0 && !
|
|
8374
|
+
else if (r.additionalProperties != null && r.additionalProperties !== !0 && !ar(t, r.additionalProperties)) return !1;
|
|
8366
8375
|
}
|
|
8367
8376
|
return n.additionalProperties === !1 || r.additionalProperties !== !1;
|
|
8368
8377
|
}
|
|
8369
|
-
function
|
|
8378
|
+
function or(e, t, n, r, i) {
|
|
8370
8379
|
if (t.kind == "webhook") {
|
|
8371
8380
|
let e = /* @__PURE__ */ new Set();
|
|
8372
8381
|
for (let [n, a] of t.inputsDef.entries()) e.has(a.handle) && i.push(Y("trigger.input-duplicate", `Webhook Trigger input "${a.handle}" is declared more than once.`, `${r}/inputsDef/${n}/handle`)), e.add(a.handle);
|
|
@@ -8378,37 +8387,37 @@ function ar(e, t, n, r, i) {
|
|
|
8378
8387
|
let o = Q(Z(t.definition.configSchema)?.required)?.filter((e) => typeof e == "string" && !Object.hasOwn(t.config, e)) ?? [];
|
|
8379
8388
|
o.length > 0 ? i.push(Y("trigger.config-incomplete", `Complete the required Trigger config fields: ${o.join(", ")}.`, `${r}/config`)) : $(t.config, t.definition.configSchema) || i.push(Y("trigger.config-invalid", `Trigger "${e}" config does not match its fixed definition.`, `${r}/config`));
|
|
8380
8389
|
}
|
|
8381
|
-
function
|
|
8390
|
+
function sr(e, t) {
|
|
8382
8391
|
switch (t.kind) {
|
|
8383
8392
|
case "condition": return { [t.input.handle]: t.input };
|
|
8384
8393
|
case "value": return {};
|
|
8385
|
-
case "subflow": return e.subflows[t.subflowId]?.inputs ??
|
|
8386
|
-
case "task": return t.task == null ? e.tasks[t.taskId]?.inputs ??
|
|
8394
|
+
case "subflow": return W(e.subflows[t.subflowId]?.inputs ?? []);
|
|
8395
|
+
case "task": return W(t.task == null ? e.tasks[t.taskId]?.inputs ?? [] : t.task.inputs);
|
|
8387
8396
|
case "cron":
|
|
8388
8397
|
case "integration":
|
|
8389
8398
|
case "poll":
|
|
8390
8399
|
case "webhook": return {};
|
|
8391
8400
|
}
|
|
8392
8401
|
}
|
|
8393
|
-
function
|
|
8402
|
+
function cr(e, t) {
|
|
8394
8403
|
switch (t.kind) {
|
|
8395
8404
|
case "condition": {
|
|
8396
8405
|
let e = [...t.cases.map((e) => e.output), ...t.defaultOutput == null ? [] : [t.defaultOutput]];
|
|
8397
8406
|
return Object.fromEntries(e.map((e) => [e, t.input]));
|
|
8398
8407
|
}
|
|
8399
|
-
case "value": return t.values;
|
|
8400
|
-
case "subflow": return e.subflows[t.subflowId]?.outputs ??
|
|
8401
|
-
case "task": return t.task == null ? e.tasks[t.taskId]?.outputs ??
|
|
8408
|
+
case "value": return W(t.values);
|
|
8409
|
+
case "subflow": return W(e.subflows[t.subflowId]?.outputs ?? []);
|
|
8410
|
+
case "task": return W(t.task == null ? e.tasks[t.taskId]?.outputs ?? [] : t.task.outputs);
|
|
8402
8411
|
case "cron":
|
|
8403
8412
|
case "integration":
|
|
8404
8413
|
case "poll":
|
|
8405
8414
|
case "webhook": return { payload: {
|
|
8406
|
-
jsonSchema:
|
|
8415
|
+
jsonSchema: Qn(t),
|
|
8407
8416
|
nullable: !1
|
|
8408
8417
|
} };
|
|
8409
8418
|
}
|
|
8410
8419
|
}
|
|
8411
|
-
function
|
|
8420
|
+
function lr(e, t, n, r, i, a, o) {
|
|
8412
8421
|
switch (e.kind) {
|
|
8413
8422
|
case "binding":
|
|
8414
8423
|
n.bindings[e.bindingId] ?? o.push(Y("graph.binding-missing", `Binding "${e.bindingId}" does not exist.`, a));
|
|
@@ -8422,19 +8431,19 @@ function cr(e, t, n, r, i, a, o) {
|
|
|
8422
8431
|
o.push(Y("graph.source-missing", `Upstream node "${e.nodeId}" does not exist.`, a));
|
|
8423
8432
|
return;
|
|
8424
8433
|
}
|
|
8425
|
-
let s =
|
|
8426
|
-
s == null ? o.push(Y("graph.source-missing", `Upstream node "${e.nodeId}" does not expose output "${e.output}".`, a)) : i != null && (!X(s.jsonSchema, {}) && s.jsonSchema !== !0 && s.nullable && !i.nullable || !
|
|
8434
|
+
let s = cr(n, r)[e.output];
|
|
8435
|
+
s == null ? o.push(Y("graph.source-missing", `Upstream node "${e.nodeId}" does not expose output "${e.output}".`, a)) : i != null && (!X(s.jsonSchema, {}) && s.jsonSchema !== !0 && s.nullable && !i.nullable || !ar(s.jsonSchema, i.jsonSchema)) && o.push(Y("graph.node-output-incompatible", `Upstream node "${e.nodeId}" output "${e.output}" is not compatible with this input.`, a));
|
|
8427
8436
|
}
|
|
8428
8437
|
}
|
|
8429
8438
|
}
|
|
8430
|
-
function
|
|
8439
|
+
function ur(e, t) {
|
|
8431
8440
|
let n = /* @__PURE__ */ new Set();
|
|
8432
8441
|
if (!("inputs" in t)) return n;
|
|
8433
8442
|
for (let r of Object.values(t.inputs)) if (r.kind == "sources") for (let t of r.sources) t.kind == "node" && e.nodes[t.nodeId] != null && n.add(t.nodeId);
|
|
8434
8443
|
return n;
|
|
8435
8444
|
}
|
|
8436
|
-
function
|
|
8437
|
-
let r = new Map(Object.entries(e.nodes).map(([t, n]) => [t,
|
|
8445
|
+
function dr(e, t, n) {
|
|
8446
|
+
let r = new Map(Object.entries(e.nodes).map(([t, n]) => [t, ur(e, n)]));
|
|
8438
8447
|
for (; r.size > 0;) {
|
|
8439
8448
|
let e = [...r].filter(([, e]) => e.size == 0).map(([e]) => e);
|
|
8440
8449
|
if (e.length == 0) {
|
|
@@ -8445,18 +8454,18 @@ function ur(e, t, n) {
|
|
|
8445
8454
|
for (let t of r.values()) for (let n of e) t.delete(n);
|
|
8446
8455
|
}
|
|
8447
8456
|
}
|
|
8448
|
-
function
|
|
8457
|
+
function fr(e, t, n, r, i, a) {
|
|
8449
8458
|
for (let [o, s] of Object.entries(e.nodes)) {
|
|
8450
8459
|
let c = `${i}/nodes/${o}`;
|
|
8451
8460
|
if (!("inputs" in s)) {
|
|
8452
|
-
r ?
|
|
8461
|
+
r ? or(o, s, t, c, a) : a.push(Y("graph.trigger-not-allowed", "Trigger nodes are only allowed in Flows.", c));
|
|
8453
8462
|
continue;
|
|
8454
8463
|
}
|
|
8455
8464
|
s.kind == "task" && s.task == null && t.tasks[s.taskId] == null ? a.push(Y("graph.target-missing", `Task "${s.taskId}" does not exist.`, `${c}/taskId`)) : s.kind == "subflow" && t.subflows[s.subflowId] == null && a.push(Y("graph.target-missing", `Subflow "${s.subflowId}" does not exist.`, `${c}/subflowId`));
|
|
8456
|
-
let l =
|
|
8465
|
+
let l = sr(t, s), u = new Set(Object.keys(l));
|
|
8457
8466
|
for (let [r, i] of Object.entries(s.inputs)) {
|
|
8458
8467
|
let s = `${c}/inputs/${r}`;
|
|
8459
|
-
if (u.has(r) || a.push(Y("graph.input-missing", `Node "${o}" does not expose input "${r}".`, s)), i.kind == "sources") for (let o of i.sources)
|
|
8468
|
+
if (u.has(r) || a.push(Y("graph.input-missing", `Node "${o}" does not expose input "${r}".`, s)), i.kind == "sources") for (let o of i.sources) lr(o, e, t, n, l[r], s, a);
|
|
8460
8469
|
}
|
|
8461
8470
|
if (s.kind != "condition") continue;
|
|
8462
8471
|
let d = /* @__PURE__ */ new Set();
|
|
@@ -8465,9 +8474,9 @@ function dr(e, t, n, r, i, a) {
|
|
|
8465
8474
|
for (let [n, r] of t.expressions.entries()) r.input != s.input.handle && a.push(Y("condition.input-missing", `Condition expression references unknown input "${r.input}".`, `${c}/cases/${e}/expressions/${n}/input`));
|
|
8466
8475
|
}
|
|
8467
8476
|
}
|
|
8468
|
-
|
|
8477
|
+
dr(e, i, a);
|
|
8469
8478
|
}
|
|
8470
|
-
function
|
|
8479
|
+
function pr(e, t) {
|
|
8471
8480
|
let n = /* @__PURE__ */ new Set(), r = [];
|
|
8472
8481
|
function i(a, o) {
|
|
8473
8482
|
for (let [s, c] of Object.entries(a.nodes)) {
|
|
@@ -8482,25 +8491,25 @@ function fr(e, t) {
|
|
|
8482
8491
|
}
|
|
8483
8492
|
i(e.graph, "/document/graph");
|
|
8484
8493
|
}
|
|
8485
|
-
function
|
|
8494
|
+
function mr(e, t) {
|
|
8486
8495
|
let n = [];
|
|
8487
|
-
|
|
8496
|
+
fr(e.document.graph, e.document, void 0, !0, "/document/graph", n);
|
|
8488
8497
|
for (let r of [...t.dependencies.subflows].toSorted()) {
|
|
8489
8498
|
let t = e.document.subflows[r];
|
|
8490
8499
|
if (t == null) continue;
|
|
8491
|
-
let i = `/document/subflows/${r}`, a = new Set(
|
|
8492
|
-
|
|
8493
|
-
for (let
|
|
8500
|
+
let i = `/document/subflows/${r}`, a = new Set(t.inputs.map((e) => e.handle));
|
|
8501
|
+
fr(t.graph, e.document, a, !1, `${i}/graph`, n);
|
|
8502
|
+
for (let r of t.outputs) for (let o of r.sources) lr(o, t.graph, e.document, a, void 0, `${i}/outputs/${r.handle}/sources`, n);
|
|
8494
8503
|
}
|
|
8495
|
-
return
|
|
8504
|
+
return pr(e.document, n), n;
|
|
8496
8505
|
}
|
|
8497
|
-
function
|
|
8506
|
+
function hr(e, t) {
|
|
8498
8507
|
if (typeof t != "object" || !t || Array.isArray(t)) return "invalid";
|
|
8499
8508
|
let n = e.document.graph;
|
|
8500
8509
|
for (let [r, i] of Object.entries(t)) {
|
|
8501
8510
|
let t = n.nodes[r];
|
|
8502
8511
|
if (t == null || !("inputs" in t) || typeof i != "object" || !i || Array.isArray(i)) return "invalid";
|
|
8503
|
-
let a =
|
|
8512
|
+
let a = sr(e.document, t);
|
|
8504
8513
|
for (let e of Object.keys(i)) {
|
|
8505
8514
|
let n = a[e];
|
|
8506
8515
|
if (n == null || t.inputs[e] != null || Object.hasOwn(n, "value")) return "invalid";
|
|
@@ -8508,12 +8517,12 @@ function mr(e, t) {
|
|
|
8508
8517
|
}
|
|
8509
8518
|
return "valid";
|
|
8510
8519
|
}
|
|
8511
|
-
function
|
|
8520
|
+
function gr(e, t, n) {
|
|
8512
8521
|
let r = [], i = /* @__PURE__ */ new Map();
|
|
8513
8522
|
for (let n of t.toSorted()) {
|
|
8514
8523
|
let t = e.modules[n];
|
|
8515
8524
|
if (t == null) continue;
|
|
8516
|
-
let a =
|
|
8525
|
+
let a = er(n, t.source, r);
|
|
8517
8526
|
a != null && i.set(n, a);
|
|
8518
8527
|
}
|
|
8519
8528
|
for (let a of t.toSorted()) {
|
|
@@ -8533,7 +8542,7 @@ function hr(e, t, n) {
|
|
|
8533
8542
|
});
|
|
8534
8543
|
continue;
|
|
8535
8544
|
}
|
|
8536
|
-
let o =
|
|
8545
|
+
let o = tr(c.specifier);
|
|
8537
8546
|
if (o == null) {
|
|
8538
8547
|
r.push({
|
|
8539
8548
|
code: "module.unsupported-import",
|
|
@@ -8586,12 +8595,12 @@ function hr(e, t, n) {
|
|
|
8586
8595
|
diagnostics: r
|
|
8587
8596
|
};
|
|
8588
8597
|
}
|
|
8589
|
-
function
|
|
8590
|
-
return
|
|
8598
|
+
function _r(e, t, n) {
|
|
8599
|
+
return gr(e, t, n).diagnostics.toSorted(rr);
|
|
8591
8600
|
}
|
|
8592
|
-
async function
|
|
8593
|
-
let n = await
|
|
8594
|
-
r.diagnostics.push(...
|
|
8601
|
+
async function vr(e, t) {
|
|
8602
|
+
let n = await Zn(e), r = gr(e, [...n.dependencies.modules], t);
|
|
8603
|
+
r.diagnostics.push(...mr(e, n));
|
|
8595
8604
|
let i = [["/document/graph", e.document.graph], ...[...n.dependencies.subflows].toSorted().flatMap((t) => {
|
|
8596
8605
|
let n = e.document.subflows[t];
|
|
8597
8606
|
return n == null ? [] : [[`/document/subflows/${t}/graph`, n.graph]];
|
|
@@ -8634,17 +8643,17 @@ async function _r(e, t) {
|
|
|
8634
8643
|
path: `/document/tasks/${t}/executor/connectionId`
|
|
8635
8644
|
}));
|
|
8636
8645
|
}
|
|
8637
|
-
let o = r.diagnostics.toSorted(
|
|
8646
|
+
let o = r.diagnostics.toSorted(rr);
|
|
8638
8647
|
return {
|
|
8639
8648
|
closure: n,
|
|
8640
8649
|
diagnostics: o,
|
|
8641
8650
|
valid: o.length == 0
|
|
8642
8651
|
};
|
|
8643
8652
|
}
|
|
8644
|
-
async function
|
|
8645
|
-
let n =
|
|
8653
|
+
async function yr(e, t) {
|
|
8654
|
+
let n = jn(t);
|
|
8646
8655
|
if (n == null) return { kind: "engine-unsupported" };
|
|
8647
|
-
let r = await
|
|
8656
|
+
let r = await vr(e, n);
|
|
8648
8657
|
if (!r.valid) return {
|
|
8649
8658
|
kind: "flow-invalid",
|
|
8650
8659
|
validation: r
|
|
@@ -8663,7 +8672,7 @@ async function vr(e, t) {
|
|
|
8663
8672
|
validation: r
|
|
8664
8673
|
};
|
|
8665
8674
|
}
|
|
8666
|
-
function
|
|
8675
|
+
function br(e, t, n) {
|
|
8667
8676
|
if (Object.hasOwn(e.modules, t)) return {
|
|
8668
8677
|
engineContract: e.engineContract,
|
|
8669
8678
|
engineDigest: n,
|
|
@@ -8672,4 +8681,4 @@ function yr(e, t, n) {
|
|
|
8672
8681
|
};
|
|
8673
8682
|
}
|
|
8674
8683
|
//#endregion
|
|
8675
|
-
export {
|
|
8684
|
+
export { br as createRuntimeProgram, Zn as flowClosure, $ as matchesSchema, yr as prepareFlow, Qn as triggerPayloadSchema, vr as validateFlow, hr as validateFlowInputs, _r as validateModules };
|