driftjs-vite-plugin 0.0.14 → 0.0.15
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/index-cjs.js +13 -16
- package/dist/index-es.js +1141 -1125
- package/package.json +3 -3
package/dist/index-es.js
CHANGED
|
@@ -14,28 +14,7 @@ var e = /* @__PURE__ */ new Set([
|
|
|
14
14
|
"source",
|
|
15
15
|
"track",
|
|
16
16
|
"wbr"
|
|
17
|
-
])
|
|
18
|
-
function t(e) {
|
|
19
|
-
let t = e.trim();
|
|
20
|
-
if (!t.startsWith("(") || !t.endsWith(")")) return !1;
|
|
21
|
-
let n = 0, r = null, i = !1;
|
|
22
|
-
for (let e = 0; e < t.length - 1; e++) {
|
|
23
|
-
let a = t[e];
|
|
24
|
-
if (r !== null) {
|
|
25
|
-
i ? i = !1 : a === "\\" ? i = !0 : a === r && (r = null);
|
|
26
|
-
continue;
|
|
27
|
-
}
|
|
28
|
-
if (a === "\"" || a === "'" || a === "`") {
|
|
29
|
-
r = a;
|
|
30
|
-
continue;
|
|
31
|
-
}
|
|
32
|
-
if (a === "(" ? n++ : a === ")" && n--, n === 0) return !1;
|
|
33
|
-
}
|
|
34
|
-
return n === 1;
|
|
35
|
-
}
|
|
36
|
-
//#endregion
|
|
37
|
-
//#region ../../node_modules/.pnpm/acorn@8.17.0/node_modules/acorn/dist/acorn.mjs
|
|
38
|
-
var n = [
|
|
17
|
+
]), t = [
|
|
39
18
|
509,
|
|
40
19
|
0,
|
|
41
20
|
227,
|
|
@@ -366,7 +345,7 @@ var n = [
|
|
|
366
345
|
9,
|
|
367
346
|
787719,
|
|
368
347
|
239
|
|
369
|
-
],
|
|
348
|
+
], n = [
|
|
370
349
|
0,
|
|
371
350
|
11,
|
|
372
351
|
2,
|
|
@@ -985,135 +964,135 @@ var n = [
|
|
|
985
964
|
4938,
|
|
986
965
|
6,
|
|
987
966
|
8489
|
|
988
|
-
],
|
|
967
|
+
], r = "·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ--ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・", i = "ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽ-ೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ--ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ", a = {
|
|
989
968
|
3: "abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",
|
|
990
969
|
5: "class enum extends super const export import",
|
|
991
970
|
6: "enum",
|
|
992
971
|
strict: "implements interface let package private protected public static yield",
|
|
993
972
|
strictBind: "eval arguments"
|
|
994
|
-
},
|
|
995
|
-
5:
|
|
996
|
-
"5module":
|
|
997
|
-
6:
|
|
998
|
-
},
|
|
999
|
-
function
|
|
973
|
+
}, o = "break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this", s = {
|
|
974
|
+
5: o,
|
|
975
|
+
"5module": o + " export import",
|
|
976
|
+
6: o + " const class extends export import super"
|
|
977
|
+
}, c = /^in(stanceof)?$/, l = RegExp("[" + i + "]"), u = RegExp("[" + i + r + "]");
|
|
978
|
+
function d(e, t) {
|
|
1000
979
|
for (var n = 65536, r = 0; r < t.length; r += 2) {
|
|
1001
980
|
if (n += t[r], n > e) return !1;
|
|
1002
981
|
if (n += t[r + 1], n >= e) return !0;
|
|
1003
982
|
}
|
|
1004
983
|
return !1;
|
|
1005
984
|
}
|
|
1006
|
-
function
|
|
1007
|
-
return e < 65 ? e === 36 : e < 91 ? !0 : e < 97 ? e === 95 : e < 123 ? !0 : e <= 65535 ? e >= 170 &&
|
|
985
|
+
function f(e, t) {
|
|
986
|
+
return e < 65 ? e === 36 : e < 91 ? !0 : e < 97 ? e === 95 : e < 123 ? !0 : e <= 65535 ? e >= 170 && l.test(String.fromCharCode(e)) : t !== !1 && d(e, n);
|
|
1008
987
|
}
|
|
1009
|
-
function
|
|
1010
|
-
return e < 48 ? e === 36 : e < 58 ? !0 : e < 65 ? !1 : e < 91 ? !0 : e < 97 ? e === 95 : e < 123 ? !0 : e <= 65535 ? e >= 170 &&
|
|
988
|
+
function p(e, r) {
|
|
989
|
+
return e < 48 ? e === 36 : e < 58 ? !0 : e < 65 ? !1 : e < 91 ? !0 : e < 97 ? e === 95 : e < 123 ? !0 : e <= 65535 ? e >= 170 && u.test(String.fromCharCode(e)) : r === !1 ? !1 : d(e, n) || d(e, t);
|
|
1011
990
|
}
|
|
1012
|
-
var
|
|
991
|
+
var m = function(e, t) {
|
|
1013
992
|
t === void 0 && (t = {}), this.label = e, this.keyword = t.keyword, this.beforeExpr = !!t.beforeExpr, this.startsExpr = !!t.startsExpr, this.isLoop = !!t.isLoop, this.isAssign = !!t.isAssign, this.prefix = !!t.prefix, this.postfix = !!t.postfix, this.binop = t.binop || null, this.updateContext = null;
|
|
1014
993
|
};
|
|
1015
|
-
function
|
|
1016
|
-
return new
|
|
994
|
+
function h(e, t) {
|
|
995
|
+
return new m(e, {
|
|
1017
996
|
beforeExpr: !0,
|
|
1018
997
|
binop: t
|
|
1019
998
|
});
|
|
1020
999
|
}
|
|
1021
|
-
var
|
|
1000
|
+
var g = { beforeExpr: !0 }, _ = { startsExpr: !0 }, v = {};
|
|
1022
1001
|
function y(e, t) {
|
|
1023
|
-
return t === void 0 && (t = {}), t.keyword = e,
|
|
1002
|
+
return t === void 0 && (t = {}), t.keyword = e, v[e] = new m(e, t);
|
|
1024
1003
|
}
|
|
1025
1004
|
var b = {
|
|
1026
|
-
num: new
|
|
1027
|
-
regexp: new
|
|
1028
|
-
string: new
|
|
1029
|
-
name: new
|
|
1030
|
-
privateId: new
|
|
1031
|
-
eof: new
|
|
1032
|
-
bracketL: new
|
|
1005
|
+
num: new m("num", _),
|
|
1006
|
+
regexp: new m("regexp", _),
|
|
1007
|
+
string: new m("string", _),
|
|
1008
|
+
name: new m("name", _),
|
|
1009
|
+
privateId: new m("privateId", _),
|
|
1010
|
+
eof: new m("eof"),
|
|
1011
|
+
bracketL: new m("[", {
|
|
1033
1012
|
beforeExpr: !0,
|
|
1034
1013
|
startsExpr: !0
|
|
1035
1014
|
}),
|
|
1036
|
-
bracketR: new
|
|
1037
|
-
braceL: new
|
|
1015
|
+
bracketR: new m("]"),
|
|
1016
|
+
braceL: new m("{", {
|
|
1038
1017
|
beforeExpr: !0,
|
|
1039
1018
|
startsExpr: !0
|
|
1040
1019
|
}),
|
|
1041
|
-
braceR: new
|
|
1042
|
-
parenL: new
|
|
1020
|
+
braceR: new m("}"),
|
|
1021
|
+
parenL: new m("(", {
|
|
1043
1022
|
beforeExpr: !0,
|
|
1044
1023
|
startsExpr: !0
|
|
1045
1024
|
}),
|
|
1046
|
-
parenR: new
|
|
1047
|
-
comma: new
|
|
1048
|
-
semi: new
|
|
1049
|
-
colon: new
|
|
1050
|
-
dot: new
|
|
1051
|
-
question: new
|
|
1052
|
-
questionDot: new
|
|
1053
|
-
arrow: new
|
|
1054
|
-
template: new
|
|
1055
|
-
invalidTemplate: new
|
|
1056
|
-
ellipsis: new
|
|
1057
|
-
backQuote: new
|
|
1058
|
-
dollarBraceL: new
|
|
1025
|
+
parenR: new m(")"),
|
|
1026
|
+
comma: new m(",", g),
|
|
1027
|
+
semi: new m(";", g),
|
|
1028
|
+
colon: new m(":", g),
|
|
1029
|
+
dot: new m("."),
|
|
1030
|
+
question: new m("?", g),
|
|
1031
|
+
questionDot: new m("?."),
|
|
1032
|
+
arrow: new m("=>", g),
|
|
1033
|
+
template: new m("template"),
|
|
1034
|
+
invalidTemplate: new m("invalidTemplate"),
|
|
1035
|
+
ellipsis: new m("...", g),
|
|
1036
|
+
backQuote: new m("`", _),
|
|
1037
|
+
dollarBraceL: new m("${", {
|
|
1059
1038
|
beforeExpr: !0,
|
|
1060
1039
|
startsExpr: !0
|
|
1061
1040
|
}),
|
|
1062
|
-
eq: new
|
|
1041
|
+
eq: new m("=", {
|
|
1063
1042
|
beforeExpr: !0,
|
|
1064
1043
|
isAssign: !0
|
|
1065
1044
|
}),
|
|
1066
|
-
assign: new
|
|
1045
|
+
assign: new m("_=", {
|
|
1067
1046
|
beforeExpr: !0,
|
|
1068
1047
|
isAssign: !0
|
|
1069
1048
|
}),
|
|
1070
|
-
incDec: new
|
|
1049
|
+
incDec: new m("++/--", {
|
|
1071
1050
|
prefix: !0,
|
|
1072
1051
|
postfix: !0,
|
|
1073
1052
|
startsExpr: !0
|
|
1074
1053
|
}),
|
|
1075
|
-
prefix: new
|
|
1054
|
+
prefix: new m("!/~", {
|
|
1076
1055
|
beforeExpr: !0,
|
|
1077
1056
|
prefix: !0,
|
|
1078
1057
|
startsExpr: !0
|
|
1079
1058
|
}),
|
|
1080
|
-
logicalOR:
|
|
1081
|
-
logicalAND:
|
|
1082
|
-
bitwiseOR:
|
|
1083
|
-
bitwiseXOR:
|
|
1084
|
-
bitwiseAND:
|
|
1085
|
-
equality:
|
|
1086
|
-
relational:
|
|
1087
|
-
bitShift:
|
|
1088
|
-
plusMin: new
|
|
1059
|
+
logicalOR: h("||", 1),
|
|
1060
|
+
logicalAND: h("&&", 2),
|
|
1061
|
+
bitwiseOR: h("|", 3),
|
|
1062
|
+
bitwiseXOR: h("^", 4),
|
|
1063
|
+
bitwiseAND: h("&", 5),
|
|
1064
|
+
equality: h("==/!=/===/!==", 6),
|
|
1065
|
+
relational: h("</>/<=/>=", 7),
|
|
1066
|
+
bitShift: h("<</>>/>>>", 8),
|
|
1067
|
+
plusMin: new m("+/-", {
|
|
1089
1068
|
beforeExpr: !0,
|
|
1090
1069
|
binop: 9,
|
|
1091
1070
|
prefix: !0,
|
|
1092
1071
|
startsExpr: !0
|
|
1093
1072
|
}),
|
|
1094
|
-
modulo:
|
|
1095
|
-
star:
|
|
1096
|
-
slash:
|
|
1097
|
-
starstar: new
|
|
1098
|
-
coalesce:
|
|
1073
|
+
modulo: h("%", 10),
|
|
1074
|
+
star: h("*", 10),
|
|
1075
|
+
slash: h("/", 10),
|
|
1076
|
+
starstar: new m("**", { beforeExpr: !0 }),
|
|
1077
|
+
coalesce: h("??", 1),
|
|
1099
1078
|
_break: y("break"),
|
|
1100
|
-
_case: y("case",
|
|
1079
|
+
_case: y("case", g),
|
|
1101
1080
|
_catch: y("catch"),
|
|
1102
1081
|
_continue: y("continue"),
|
|
1103
1082
|
_debugger: y("debugger"),
|
|
1104
|
-
_default: y("default",
|
|
1083
|
+
_default: y("default", g),
|
|
1105
1084
|
_do: y("do", {
|
|
1106
1085
|
isLoop: !0,
|
|
1107
1086
|
beforeExpr: !0
|
|
1108
1087
|
}),
|
|
1109
|
-
_else: y("else",
|
|
1088
|
+
_else: y("else", g),
|
|
1110
1089
|
_finally: y("finally"),
|
|
1111
1090
|
_for: y("for", { isLoop: !0 }),
|
|
1112
|
-
_function: y("function",
|
|
1091
|
+
_function: y("function", _),
|
|
1113
1092
|
_if: y("if"),
|
|
1114
|
-
_return: y("return",
|
|
1093
|
+
_return: y("return", g),
|
|
1115
1094
|
_switch: y("switch"),
|
|
1116
|
-
_throw: y("throw",
|
|
1095
|
+
_throw: y("throw", g),
|
|
1117
1096
|
_try: y("try"),
|
|
1118
1097
|
_var: y("var"),
|
|
1119
1098
|
_const: y("const"),
|
|
@@ -1123,15 +1102,15 @@ var b = {
|
|
|
1123
1102
|
beforeExpr: !0,
|
|
1124
1103
|
startsExpr: !0
|
|
1125
1104
|
}),
|
|
1126
|
-
_this: y("this",
|
|
1127
|
-
_super: y("super",
|
|
1128
|
-
_class: y("class",
|
|
1129
|
-
_extends: y("extends",
|
|
1105
|
+
_this: y("this", _),
|
|
1106
|
+
_super: y("super", _),
|
|
1107
|
+
_class: y("class", _),
|
|
1108
|
+
_extends: y("extends", g),
|
|
1130
1109
|
_export: y("export"),
|
|
1131
|
-
_import: y("import",
|
|
1132
|
-
_null: y("null",
|
|
1133
|
-
_true: y("true",
|
|
1134
|
-
_false: y("false",
|
|
1110
|
+
_import: y("import", _),
|
|
1111
|
+
_null: y("null", _),
|
|
1112
|
+
_true: y("true", _),
|
|
1113
|
+
_false: y("false", _),
|
|
1135
1114
|
_in: y("in", {
|
|
1136
1115
|
beforeExpr: !0,
|
|
1137
1116
|
binop: 7
|
|
@@ -1155,46 +1134,46 @@ var b = {
|
|
|
1155
1134
|
prefix: !0,
|
|
1156
1135
|
startsExpr: !0
|
|
1157
1136
|
})
|
|
1158
|
-
}, x = /\r\n?|\n|\u2028|\u2029/,
|
|
1159
|
-
function
|
|
1137
|
+
}, x = /\r\n?|\n|\u2028|\u2029/, ee = new RegExp(x.source, "g");
|
|
1138
|
+
function te(e) {
|
|
1160
1139
|
return e === 10 || e === 13 || e === 8232 || e === 8233;
|
|
1161
1140
|
}
|
|
1162
|
-
function
|
|
1141
|
+
function ne(e, t, n) {
|
|
1163
1142
|
n === void 0 && (n = e.length);
|
|
1164
1143
|
for (var r = t; r < n; r++) {
|
|
1165
1144
|
var i = e.charCodeAt(r);
|
|
1166
|
-
if (
|
|
1145
|
+
if (te(i)) return r < n - 1 && i === 13 && e.charCodeAt(r + 1) === 10 ? r + 2 : r + 1;
|
|
1167
1146
|
}
|
|
1168
1147
|
return -1;
|
|
1169
1148
|
}
|
|
1170
|
-
var
|
|
1171
|
-
return
|
|
1172
|
-
}),
|
|
1173
|
-
return
|
|
1174
|
-
}),
|
|
1149
|
+
var re = /[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/, S = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g, ie = Object.prototype, ae = ie.hasOwnProperty, oe = ie.toString, se = Object.hasOwn || (function(e, t) {
|
|
1150
|
+
return ae.call(e, t);
|
|
1151
|
+
}), ce = Array.isArray || (function(e) {
|
|
1152
|
+
return oe.call(e) === "[object Array]";
|
|
1153
|
+
}), le = Object.create(null);
|
|
1175
1154
|
function C(e) {
|
|
1176
|
-
return
|
|
1155
|
+
return le[e] || (le[e] = RegExp("^(?:" + e.replace(/ /g, "|") + ")$"));
|
|
1177
1156
|
}
|
|
1178
1157
|
function w(e) {
|
|
1179
1158
|
return e <= 65535 ? String.fromCharCode(e) : (e -= 65536, String.fromCharCode((e >> 10) + 55296, (e & 1023) + 56320));
|
|
1180
1159
|
}
|
|
1181
|
-
var
|
|
1160
|
+
var ue = /(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/, de = function(e, t) {
|
|
1182
1161
|
this.line = e, this.column = t;
|
|
1183
1162
|
};
|
|
1184
|
-
|
|
1185
|
-
return new
|
|
1163
|
+
de.prototype.offset = function(e) {
|
|
1164
|
+
return new de(this.line, this.column + e);
|
|
1186
1165
|
};
|
|
1187
|
-
var
|
|
1166
|
+
var fe = function(e, t, n) {
|
|
1188
1167
|
this.start = t, this.end = n, e.sourceFile !== null && (this.source = e.sourceFile);
|
|
1189
1168
|
};
|
|
1190
|
-
function
|
|
1169
|
+
function pe(e, t) {
|
|
1191
1170
|
for (var n = 1, r = 0;;) {
|
|
1192
|
-
var i =
|
|
1193
|
-
if (i < 0) return new
|
|
1171
|
+
var i = ne(e, r, t);
|
|
1172
|
+
if (i < 0) return new de(n, t - r);
|
|
1194
1173
|
++n, r = i;
|
|
1195
1174
|
}
|
|
1196
1175
|
}
|
|
1197
|
-
var
|
|
1176
|
+
var me = {
|
|
1198
1177
|
ecmaVersion: null,
|
|
1199
1178
|
sourceType: "script",
|
|
1200
1179
|
strict: !1,
|
|
@@ -1215,20 +1194,20 @@ var he = {
|
|
|
1215
1194
|
sourceFile: null,
|
|
1216
1195
|
directSourceFile: null,
|
|
1217
1196
|
preserveParens: !1
|
|
1218
|
-
},
|
|
1219
|
-
function
|
|
1197
|
+
}, he = !1;
|
|
1198
|
+
function ge(e) {
|
|
1220
1199
|
var t = {};
|
|
1221
|
-
for (var n in
|
|
1222
|
-
if (t.ecmaVersion === "latest" ? t.ecmaVersion = 1e8 : t.ecmaVersion == null ? (!
|
|
1200
|
+
for (var n in me) t[n] = e && se(e, n) ? e[n] : me[n];
|
|
1201
|
+
if (t.ecmaVersion === "latest" ? t.ecmaVersion = 1e8 : t.ecmaVersion == null ? (!he && typeof console == "object" && console.warn && (he = !0, console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future.")), t.ecmaVersion = 11) : t.ecmaVersion >= 2015 && (t.ecmaVersion -= 2009), t.allowReserved ??= t.ecmaVersion < 5, (!e || e.allowHashBang == null) && (t.allowHashBang = t.ecmaVersion >= 14), ce(t.onToken)) {
|
|
1223
1202
|
var r = t.onToken;
|
|
1224
1203
|
t.onToken = function(e) {
|
|
1225
1204
|
return r.push(e);
|
|
1226
1205
|
};
|
|
1227
1206
|
}
|
|
1228
|
-
if (
|
|
1207
|
+
if (ce(t.onComment) && (t.onComment = _e(t, t.onComment)), t.sourceType === "commonjs" && t.allowAwaitOutsideFunction) throw Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");
|
|
1229
1208
|
return t;
|
|
1230
1209
|
}
|
|
1231
|
-
function
|
|
1210
|
+
function _e(e, t) {
|
|
1232
1211
|
return function(n, r, i, a, o, s) {
|
|
1233
1212
|
var c = {
|
|
1234
1213
|
type: n ? "Block" : "Line",
|
|
@@ -1236,20 +1215,20 @@ function ve(e, t) {
|
|
|
1236
1215
|
start: i,
|
|
1237
1216
|
end: a
|
|
1238
1217
|
};
|
|
1239
|
-
e.locations && (c.loc = new
|
|
1218
|
+
e.locations && (c.loc = new fe(this, o, s)), e.ranges && (c.range = [i, a]), t.push(c);
|
|
1240
1219
|
};
|
|
1241
1220
|
}
|
|
1242
|
-
var
|
|
1221
|
+
var ve = 1, ye = 2, be = 4, xe = 8, Se = 16, Ce = 32, we = 64, Te = 128, Ee = 256, De = 512, Oe = 1024, ke = ve | ye | Ee;
|
|
1243
1222
|
function Ae(e, t) {
|
|
1244
|
-
return
|
|
1223
|
+
return ye | (e ? be : 0) | (t ? xe : 0);
|
|
1245
1224
|
}
|
|
1246
|
-
var je = 0, Me = 1,
|
|
1247
|
-
this.options = e =
|
|
1225
|
+
var je = 0, Me = 1, T = 2, Ne = 3, Pe = 4, Fe = 5, E = function(e, t, n) {
|
|
1226
|
+
this.options = e = ge(e), this.sourceFile = e.sourceFile, this.keywords = C(s[e.ecmaVersion >= 6 ? 6 : e.sourceType === "module" ? "5module" : 5]);
|
|
1248
1227
|
var r = "";
|
|
1249
|
-
e.allowReserved !== !0 && (r =
|
|
1250
|
-
var i = (r ? r + " " : "") +
|
|
1251
|
-
this.reservedWordsStrict = C(i), this.reservedWordsStrictBind = C(i + " " +
|
|
1252
|
-
},
|
|
1228
|
+
e.allowReserved !== !0 && (r = a[e.ecmaVersion >= 6 ? 6 : e.ecmaVersion === 5 ? 5 : 3], e.sourceType === "module" && (r += " await")), this.reservedWords = C(r);
|
|
1229
|
+
var i = (r ? r + " " : "") + a.strict;
|
|
1230
|
+
this.reservedWordsStrict = C(i), this.reservedWordsStrictBind = C(i + " " + a.strictBind), this.input = String(t), this.containsEsc = !1, n ? (this.pos = n, this.lineStart = this.input.lastIndexOf("\n", n - 1) + 1, this.curLine = this.input.slice(0, this.lineStart).split(x).length) : (this.pos = this.lineStart = 0, this.curLine = 1), this.type = b.eof, this.value = null, this.start = this.end = this.pos, this.startLoc = this.endLoc = this.curPosition(), this.lastTokEndLoc = this.lastTokStartLoc = null, this.lastTokStart = this.lastTokEnd = this.pos, this.context = this.initialContext(), this.exprAllowed = !0, this.inModule = e.sourceType === "module", this.strict = this.inModule || e.strict === !0 || this.strictDirective(this.pos), this.potentialArrowAt = -1, this.potentialArrowInForAwait = !1, this.yieldPos = this.awaitPos = this.awaitIdentPos = 0, this.labels = [], this.undefinedExports = Object.create(null), this.pos === 0 && e.allowHashBang && this.input.slice(0, 2) === "#!" && this.skipLineComment(2), this.scopeStack = [], this.enterScope(this.options.sourceType === "commonjs" ? ye : ve), this.regexpState = null, this.privateNameStack = [];
|
|
1231
|
+
}, D = {
|
|
1253
1232
|
inFunction: { configurable: !0 },
|
|
1254
1233
|
inGenerator: { configurable: !0 },
|
|
1255
1234
|
inAsync: { configurable: !0 },
|
|
@@ -1262,57 +1241,57 @@ var je = 0, Me = 1, E = 2, Ne = 3, Pe = 4, Fe = 5, D = function(e, t, n) {
|
|
|
1262
1241
|
allowUsing: { configurable: !0 },
|
|
1263
1242
|
inClassStaticBlock: { configurable: !0 }
|
|
1264
1243
|
};
|
|
1265
|
-
|
|
1244
|
+
E.prototype.parse = function() {
|
|
1266
1245
|
var e = this, t = this.options.program || this.startNode();
|
|
1267
1246
|
return this.nextToken(), this.catchStackOverflow(function() {
|
|
1268
1247
|
return e.parseTopLevel(t);
|
|
1269
1248
|
});
|
|
1270
|
-
},
|
|
1271
|
-
return (this.currentVarScope().flags &
|
|
1272
|
-
},
|
|
1249
|
+
}, D.inFunction.get = function() {
|
|
1250
|
+
return (this.currentVarScope().flags & ye) > 0;
|
|
1251
|
+
}, D.inGenerator.get = function() {
|
|
1273
1252
|
return (this.currentVarScope().flags & xe) > 0;
|
|
1274
|
-
},
|
|
1253
|
+
}, D.inAsync.get = function() {
|
|
1275
1254
|
return (this.currentVarScope().flags & be) > 0;
|
|
1276
|
-
},
|
|
1255
|
+
}, D.canAwait.get = function() {
|
|
1277
1256
|
for (var e = this.scopeStack.length - 1; e >= 0; e--) {
|
|
1278
1257
|
var t = this.scopeStack[e].flags;
|
|
1279
1258
|
if (t & (Ee | De)) return !1;
|
|
1280
|
-
if (t &
|
|
1259
|
+
if (t & ye) return (t & be) > 0;
|
|
1281
1260
|
}
|
|
1282
1261
|
return this.inModule && this.options.ecmaVersion >= 13 || this.options.allowAwaitOutsideFunction;
|
|
1283
|
-
},
|
|
1284
|
-
return !!(this.inFunction || this.options.allowReturnOutsideFunction && this.currentVarScope().flags &
|
|
1285
|
-
},
|
|
1262
|
+
}, D.allowReturn.get = function() {
|
|
1263
|
+
return !!(this.inFunction || this.options.allowReturnOutsideFunction && this.currentVarScope().flags & ve);
|
|
1264
|
+
}, D.allowSuper.get = function() {
|
|
1286
1265
|
return (this.currentThisScope().flags & we) > 0 || this.options.allowSuperOutsideMethod;
|
|
1287
|
-
},
|
|
1266
|
+
}, D.allowDirectSuper.get = function() {
|
|
1288
1267
|
return (this.currentThisScope().flags & Te) > 0;
|
|
1289
|
-
},
|
|
1268
|
+
}, D.treatFunctionsAsVar.get = function() {
|
|
1290
1269
|
return this.treatFunctionsAsVarInScope(this.currentScope());
|
|
1291
|
-
},
|
|
1270
|
+
}, D.allowNewDotTarget.get = function() {
|
|
1292
1271
|
for (var e = this.scopeStack.length - 1; e >= 0; e--) {
|
|
1293
1272
|
var t = this.scopeStack[e].flags;
|
|
1294
|
-
if (t & (Ee | De) || t &
|
|
1273
|
+
if (t & (Ee | De) || t & ye && !(t & Se)) return !0;
|
|
1295
1274
|
}
|
|
1296
1275
|
return !1;
|
|
1297
|
-
},
|
|
1276
|
+
}, D.allowUsing.get = function() {
|
|
1298
1277
|
var e = this.currentScope().flags;
|
|
1299
|
-
return !(e & Oe || !this.inModule && e &
|
|
1300
|
-
},
|
|
1278
|
+
return !(e & Oe || !this.inModule && e & ve);
|
|
1279
|
+
}, D.inClassStaticBlock.get = function() {
|
|
1301
1280
|
return (this.currentVarScope().flags & Ee) > 0;
|
|
1302
|
-
},
|
|
1281
|
+
}, E.extend = function() {
|
|
1303
1282
|
for (var e = [], t = arguments.length; t--;) e[t] = arguments[t];
|
|
1304
1283
|
for (var n = this, r = 0; r < e.length; r++) n = e[r](n);
|
|
1305
1284
|
return n;
|
|
1306
|
-
},
|
|
1285
|
+
}, E.parse = function(e, t) {
|
|
1307
1286
|
return new this(t, e).parse();
|
|
1308
|
-
},
|
|
1287
|
+
}, E.parseExpressionAt = function(e, t, n) {
|
|
1309
1288
|
var r = new this(n, e, t);
|
|
1310
1289
|
return r.nextToken(), r.parseExpression();
|
|
1311
|
-
},
|
|
1290
|
+
}, E.tokenizer = function(e, t) {
|
|
1312
1291
|
return new this(t, e);
|
|
1313
|
-
}, Object.defineProperties(
|
|
1314
|
-
var
|
|
1315
|
-
|
|
1292
|
+
}, Object.defineProperties(E.prototype, D);
|
|
1293
|
+
var O = E.prototype, Ie = /^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;
|
|
1294
|
+
O.strictDirective = function(e) {
|
|
1316
1295
|
if (this.options.ecmaVersion < 5) return !1;
|
|
1317
1296
|
for (;;) {
|
|
1318
1297
|
S.lastIndex = e, e += S.exec(this.input)[0].length;
|
|
@@ -1325,55 +1304,55 @@ k.strictDirective = function(e) {
|
|
|
1325
1304
|
}
|
|
1326
1305
|
e += t[0].length, S.lastIndex = e, e += S.exec(this.input)[0].length, this.input[e] === ";" && e++;
|
|
1327
1306
|
}
|
|
1328
|
-
},
|
|
1307
|
+
}, O.eat = function(e) {
|
|
1329
1308
|
return this.type === e ? (this.next(), !0) : !1;
|
|
1330
|
-
},
|
|
1309
|
+
}, O.isContextual = function(e) {
|
|
1331
1310
|
return this.type === b.name && this.value === e && !this.containsEsc;
|
|
1332
|
-
},
|
|
1311
|
+
}, O.eatContextual = function(e) {
|
|
1333
1312
|
return this.isContextual(e) ? (this.next(), !0) : !1;
|
|
1334
|
-
},
|
|
1313
|
+
}, O.catchStackOverflow = function(e) {
|
|
1335
1314
|
try {
|
|
1336
1315
|
return e();
|
|
1337
1316
|
} catch (e) {
|
|
1338
1317
|
if (e instanceof Error && (/\bstack\b.*\b(exceeded|overflow)\b/i.test(e.message) || /\btoo much recursion\b/i.test(e.message))) this.raise(this.start, "Not enough stack space to parse input");
|
|
1339
1318
|
else throw e;
|
|
1340
1319
|
}
|
|
1341
|
-
},
|
|
1320
|
+
}, O.expectContextual = function(e) {
|
|
1342
1321
|
this.eatContextual(e) || this.unexpected();
|
|
1343
|
-
},
|
|
1322
|
+
}, O.canInsertSemicolon = function() {
|
|
1344
1323
|
return this.type === b.eof || this.type === b.braceR || x.test(this.input.slice(this.lastTokEnd, this.start));
|
|
1345
|
-
},
|
|
1324
|
+
}, O.insertSemicolon = function() {
|
|
1346
1325
|
if (this.canInsertSemicolon()) return this.options.onInsertedSemicolon && this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc), !0;
|
|
1347
|
-
},
|
|
1326
|
+
}, O.semicolon = function() {
|
|
1348
1327
|
!this.eat(b.semi) && !this.insertSemicolon() && this.unexpected();
|
|
1349
|
-
},
|
|
1328
|
+
}, O.afterTrailingComma = function(e, t) {
|
|
1350
1329
|
if (this.type === e) return this.options.onTrailingComma && this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc), t || this.next(), !0;
|
|
1351
|
-
},
|
|
1330
|
+
}, O.expect = function(e) {
|
|
1352
1331
|
this.eat(e) || this.unexpected();
|
|
1353
|
-
},
|
|
1332
|
+
}, O.unexpected = function(e) {
|
|
1354
1333
|
this.raise(e ?? this.start, "Unexpected token");
|
|
1355
1334
|
};
|
|
1356
1335
|
var Le = function() {
|
|
1357
1336
|
this.shorthandAssign = this.trailingComma = this.parenthesizedAssign = this.parenthesizedBind = this.doubleProto = -1;
|
|
1358
1337
|
};
|
|
1359
|
-
|
|
1338
|
+
O.checkPatternErrors = function(e, t) {
|
|
1360
1339
|
if (e) {
|
|
1361
1340
|
e.trailingComma > -1 && this.raiseRecoverable(e.trailingComma, "Comma is not permitted after the rest element");
|
|
1362
1341
|
var n = t ? e.parenthesizedAssign : e.parenthesizedBind;
|
|
1363
1342
|
n > -1 && this.raiseRecoverable(n, t ? "Assigning to rvalue" : "Parenthesized pattern");
|
|
1364
1343
|
}
|
|
1365
|
-
},
|
|
1344
|
+
}, O.checkExpressionErrors = function(e, t) {
|
|
1366
1345
|
if (!e) return !1;
|
|
1367
1346
|
var n = e.shorthandAssign, r = e.doubleProto;
|
|
1368
1347
|
if (!t) return n >= 0 || r >= 0;
|
|
1369
1348
|
n >= 0 && this.raise(n, "Shorthand property assignments are valid only in destructuring patterns"), r >= 0 && this.raiseRecoverable(r, "Redefinition of __proto__ property");
|
|
1370
|
-
},
|
|
1349
|
+
}, O.checkYieldAwaitInDefaultParams = function() {
|
|
1371
1350
|
this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos) && this.raise(this.yieldPos, "Yield expression cannot be a default value"), this.awaitPos && this.raise(this.awaitPos, "Await expression cannot be a default value");
|
|
1372
|
-
},
|
|
1351
|
+
}, O.isSimpleAssignTarget = function(e) {
|
|
1373
1352
|
return e.type === "ParenthesizedExpression" ? this.isSimpleAssignTarget(e.expression) : e.type === "Identifier" || e.type === "MemberExpression";
|
|
1374
1353
|
};
|
|
1375
|
-
var
|
|
1376
|
-
|
|
1354
|
+
var k = E.prototype;
|
|
1355
|
+
k.parseTopLevel = function(e) {
|
|
1377
1356
|
var t = Object.create(null);
|
|
1378
1357
|
for (e.body ||= []; this.type !== b.eof;) {
|
|
1379
1358
|
var n = this.parseStatement(null, !0, t);
|
|
@@ -1386,60 +1365,60 @@ A.parseTopLevel = function(e) {
|
|
|
1386
1365
|
return this.adaptDirectivePrologue(e.body), this.next(), e.sourceType = this.options.sourceType === "commonjs" ? "script" : this.options.sourceType, this.finishNode(e, "Program");
|
|
1387
1366
|
};
|
|
1388
1367
|
var Re = { kind: "loop" }, ze = { kind: "switch" };
|
|
1389
|
-
|
|
1368
|
+
k.isLet = function(e) {
|
|
1390
1369
|
if (this.options.ecmaVersion < 6 || !this.isContextual("let")) return !1;
|
|
1391
1370
|
S.lastIndex = this.pos;
|
|
1392
1371
|
var t = S.exec(this.input), n = this.pos + t[0].length, r = this.fullCharCodeAt(n);
|
|
1393
1372
|
if (r === 91 || r === 92) return !0;
|
|
1394
1373
|
if (e) return !1;
|
|
1395
1374
|
if (r === 123) return !0;
|
|
1396
|
-
if (
|
|
1375
|
+
if (f(r)) {
|
|
1397
1376
|
var i = n;
|
|
1398
1377
|
do
|
|
1399
1378
|
n += r <= 65535 ? 1 : 2;
|
|
1400
|
-
while (
|
|
1379
|
+
while (p(r = this.fullCharCodeAt(n)));
|
|
1401
1380
|
if (r === 92) return !0;
|
|
1402
1381
|
var a = this.input.slice(i, n);
|
|
1403
|
-
if (!
|
|
1382
|
+
if (!c.test(a)) return !0;
|
|
1404
1383
|
}
|
|
1405
1384
|
return !1;
|
|
1406
|
-
},
|
|
1385
|
+
}, k.isAsyncFunction = function() {
|
|
1407
1386
|
if (this.options.ecmaVersion < 8 || !this.isContextual("async")) return !1;
|
|
1408
1387
|
S.lastIndex = this.pos;
|
|
1409
1388
|
var e = S.exec(this.input), t = this.pos + e[0].length, n;
|
|
1410
|
-
return !x.test(this.input.slice(this.pos, t)) && this.input.slice(t, t + 8) === "function" && (t + 8 === this.input.length || !(
|
|
1411
|
-
},
|
|
1389
|
+
return !x.test(this.input.slice(this.pos, t)) && this.input.slice(t, t + 8) === "function" && (t + 8 === this.input.length || !(p(n = this.fullCharCodeAt(t + 8)) || n === 92));
|
|
1390
|
+
}, k.isUsingKeyword = function(e, t) {
|
|
1412
1391
|
if (this.options.ecmaVersion < 17 || !this.isContextual(e ? "await" : "using")) return !1;
|
|
1413
1392
|
S.lastIndex = this.pos;
|
|
1414
1393
|
var n = S.exec(this.input), r = this.pos + n[0].length;
|
|
1415
1394
|
if (x.test(this.input.slice(this.pos, r))) return !1;
|
|
1416
1395
|
if (e) {
|
|
1417
1396
|
var i = r + 5, a;
|
|
1418
|
-
if (this.input.slice(r, i) !== "using" || i === this.input.length ||
|
|
1397
|
+
if (this.input.slice(r, i) !== "using" || i === this.input.length || p(a = this.fullCharCodeAt(i)) || a === 92) return !1;
|
|
1419
1398
|
S.lastIndex = i;
|
|
1420
1399
|
var o = S.exec(this.input);
|
|
1421
1400
|
if (r = i + o[0].length, o && x.test(this.input.slice(i, r))) return !1;
|
|
1422
1401
|
}
|
|
1423
1402
|
var s = this.fullCharCodeAt(r);
|
|
1424
|
-
if (!
|
|
1425
|
-
var
|
|
1403
|
+
if (!f(s) && s !== 92) return !1;
|
|
1404
|
+
var l = r;
|
|
1426
1405
|
do
|
|
1427
1406
|
r += s <= 65535 ? 1 : 2;
|
|
1428
|
-
while (
|
|
1407
|
+
while (p(s = this.fullCharCodeAt(r)));
|
|
1429
1408
|
if (s === 92) return !0;
|
|
1430
|
-
var u = this.input.slice(
|
|
1431
|
-
if (
|
|
1409
|
+
var u = this.input.slice(l, r);
|
|
1410
|
+
if (c.test(u)) return !1;
|
|
1432
1411
|
if (t && !e && u === "of") {
|
|
1433
1412
|
S.lastIndex = r;
|
|
1434
1413
|
var d = S.exec(this.input);
|
|
1435
1414
|
if (r += d[0].length, this.input.charCodeAt(r) !== 61 || (s = this.input.charCodeAt(r + 1)) === 61 || s === 62) return !1;
|
|
1436
1415
|
}
|
|
1437
1416
|
return !0;
|
|
1438
|
-
},
|
|
1417
|
+
}, k.isAwaitUsing = function(e) {
|
|
1439
1418
|
return this.isUsingKeyword(!0, e);
|
|
1440
|
-
},
|
|
1419
|
+
}, k.isUsing = function(e) {
|
|
1441
1420
|
return this.isUsingKeyword(!1, e);
|
|
1442
|
-
},
|
|
1421
|
+
}, k.parseStatement = function(e, t, n) {
|
|
1443
1422
|
var r = this.type, i = this.startNode(), a;
|
|
1444
1423
|
switch (this.isLet(e) && (r = b._var, a = "let"), r) {
|
|
1445
1424
|
case b._break:
|
|
@@ -1475,7 +1454,7 @@ A.isLet = function(e) {
|
|
|
1475
1454
|
var u = this.value, d = this.parseExpression();
|
|
1476
1455
|
return r === b.name && d.type === "Identifier" && this.eat(b.colon) ? this.parseLabeledStatement(i, u, d, e) : this.parseExpressionStatement(i, d);
|
|
1477
1456
|
}
|
|
1478
|
-
},
|
|
1457
|
+
}, k.parseBreakContinueStatement = function(e, t) {
|
|
1479
1458
|
var n = t === "break";
|
|
1480
1459
|
this.next(), this.eat(b.semi) || this.insertSemicolon() ? e.label = null : this.type === b.name ? (e.label = this.parseIdent(), this.semicolon()) : this.unexpected();
|
|
1481
1460
|
for (var r = 0; r < this.labels.length; ++r) {
|
|
@@ -1483,11 +1462,11 @@ A.isLet = function(e) {
|
|
|
1483
1462
|
if ((e.label == null || i.name === e.label.name) && (i.kind != null && (n || i.kind === "loop") || e.label && n)) break;
|
|
1484
1463
|
}
|
|
1485
1464
|
return r === this.labels.length && this.raise(e.start, "Unsyntactic " + t), this.finishNode(e, n ? "BreakStatement" : "ContinueStatement");
|
|
1486
|
-
},
|
|
1465
|
+
}, k.parseDebuggerStatement = function(e) {
|
|
1487
1466
|
return this.next(), this.semicolon(), this.finishNode(e, "DebuggerStatement");
|
|
1488
|
-
},
|
|
1467
|
+
}, k.parseDoStatement = function(e) {
|
|
1489
1468
|
return this.next(), this.labels.push(Re), e.body = this.parseStatement("do"), this.labels.pop(), this.expect(b._while), e.test = this.parseParenExpression(), this.options.ecmaVersion >= 6 ? this.eat(b.semi) : this.semicolon(), this.finishNode(e, "DoWhileStatement");
|
|
1490
|
-
},
|
|
1469
|
+
}, k.parseForStatement = function(e) {
|
|
1491
1470
|
this.next();
|
|
1492
1471
|
var t = this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual("await") ? this.lastTokStart : -1;
|
|
1493
1472
|
if (this.labels.push(Re), this.enterScope(0), this.expect(b.parenL), this.type === b.semi) return t > -1 && this.unexpected(t), this.parseFor(e, null);
|
|
@@ -1503,43 +1482,43 @@ A.isLet = function(e) {
|
|
|
1503
1482
|
}
|
|
1504
1483
|
var l = this.containsEsc, u = new Le(), d = this.start, f = t > -1 ? this.parseExprSubscripts(u, "await") : this.parseExpression(!0, u);
|
|
1505
1484
|
return this.type === b._in || (o = this.options.ecmaVersion >= 6 && this.isContextual("of")) ? (t > -1 ? (this.type === b._in && this.unexpected(t), e.await = !0) : o && this.options.ecmaVersion >= 8 && (f.start === d && !l && f.type === "Identifier" && f.name === "async" ? this.unexpected() : this.options.ecmaVersion >= 9 && (e.await = !1)), a && o && this.raise(f.start, "The left-hand side of a for-of loop may not start with 'let'."), this.toAssignable(f, !1, u), this.checkLValPattern(f), this.parseForIn(e, f)) : (this.checkExpressionErrors(u, !0), t > -1 && this.unexpected(t), this.parseFor(e, f));
|
|
1506
|
-
},
|
|
1485
|
+
}, k.parseForAfterInit = function(e, t, n) {
|
|
1507
1486
|
return (this.type === b._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) && t.declarations.length === 1 ? (this.type === b._in ? ((t.kind === "using" || t.kind === "await using") && !t.declarations[0].init && this.raise(this.start, "Using declaration is not allowed in for-in loops"), this.options.ecmaVersion >= 9 && n > -1 && this.unexpected(n)) : this.options.ecmaVersion >= 9 && (e.await = n > -1), this.parseForIn(e, t)) : (n > -1 && this.unexpected(n), this.parseFor(e, t));
|
|
1508
|
-
},
|
|
1487
|
+
}, k.parseFunctionStatement = function(e, t, n) {
|
|
1509
1488
|
return this.next(), this.parseFunction(e, Ve | (n ? 0 : He), !1, t);
|
|
1510
|
-
},
|
|
1489
|
+
}, k.parseIfStatement = function(e) {
|
|
1511
1490
|
return this.next(), e.test = this.parseParenExpression(), e.consequent = this.parseStatement("if"), e.alternate = this.eat(b._else) ? this.parseStatement("if") : null, this.finishNode(e, "IfStatement");
|
|
1512
|
-
},
|
|
1491
|
+
}, k.parseReturnStatement = function(e) {
|
|
1513
1492
|
return this.allowReturn || this.raise(this.start, "'return' outside of function"), this.next(), this.eat(b.semi) || this.insertSemicolon() ? e.argument = null : (e.argument = this.parseExpression(), this.semicolon()), this.finishNode(e, "ReturnStatement");
|
|
1514
|
-
},
|
|
1493
|
+
}, k.parseSwitchStatement = function(e) {
|
|
1515
1494
|
this.next(), e.discriminant = this.parseParenExpression(), e.cases = [], this.expect(b.braceL), this.labels.push(ze), this.enterScope(Oe);
|
|
1516
1495
|
for (var t, n = !1; this.type !== b.braceR;) if (this.type === b._case || this.type === b._default) {
|
|
1517
1496
|
var r = this.type === b._case;
|
|
1518
1497
|
t && this.finishNode(t, "SwitchCase"), e.cases.push(t = this.startNode()), t.consequent = [], this.next(), r ? t.test = this.parseExpression() : (n && this.raiseRecoverable(this.lastTokStart, "Multiple default clauses"), n = !0, t.test = null), this.expect(b.colon);
|
|
1519
1498
|
} else t || this.unexpected(), t.consequent.push(this.parseStatement(null));
|
|
1520
1499
|
return this.exitScope(), t && this.finishNode(t, "SwitchCase"), this.next(), this.labels.pop(), this.finishNode(e, "SwitchStatement");
|
|
1521
|
-
},
|
|
1500
|
+
}, k.parseThrowStatement = function(e) {
|
|
1522
1501
|
return this.next(), x.test(this.input.slice(this.lastTokEnd, this.start)) && this.raise(this.lastTokEnd, "Illegal newline after throw"), e.argument = this.parseExpression(), this.semicolon(), this.finishNode(e, "ThrowStatement");
|
|
1523
1502
|
};
|
|
1524
1503
|
var Be = [];
|
|
1525
|
-
|
|
1504
|
+
k.parseCatchClauseParam = function() {
|
|
1526
1505
|
var e = this.parseBindingAtom(), t = e.type === "Identifier";
|
|
1527
|
-
return this.enterScope(t ? Ce : 0), this.checkLValPattern(e, t ? Pe :
|
|
1528
|
-
},
|
|
1506
|
+
return this.enterScope(t ? Ce : 0), this.checkLValPattern(e, t ? Pe : T), this.expect(b.parenR), e;
|
|
1507
|
+
}, k.parseTryStatement = function(e) {
|
|
1529
1508
|
if (this.next(), e.block = this.parseBlock(), e.handler = null, this.type === b._catch) {
|
|
1530
1509
|
var t = this.startNode();
|
|
1531
1510
|
this.next(), this.eat(b.parenL) ? t.param = this.parseCatchClauseParam() : (this.options.ecmaVersion < 10 && this.unexpected(), t.param = null, this.enterScope(0)), t.body = this.parseBlock(!1), this.exitScope(), e.handler = this.finishNode(t, "CatchClause");
|
|
1532
1511
|
}
|
|
1533
1512
|
return e.finalizer = this.eat(b._finally) ? this.parseBlock() : null, !e.handler && !e.finalizer && this.raise(e.start, "Missing catch or finally clause"), this.finishNode(e, "TryStatement");
|
|
1534
|
-
},
|
|
1513
|
+
}, k.parseVarStatement = function(e, t, n) {
|
|
1535
1514
|
return this.next(), this.parseVar(e, !1, t, n), this.semicolon(), this.finishNode(e, "VariableDeclaration");
|
|
1536
|
-
},
|
|
1515
|
+
}, k.parseWhileStatement = function(e) {
|
|
1537
1516
|
return this.next(), e.test = this.parseParenExpression(), this.labels.push(Re), e.body = this.parseStatement("while"), this.labels.pop(), this.finishNode(e, "WhileStatement");
|
|
1538
|
-
},
|
|
1517
|
+
}, k.parseWithStatement = function(e) {
|
|
1539
1518
|
return this.strict && this.raise(this.start, "'with' in strict mode"), this.next(), e.object = this.parseParenExpression(), e.body = this.parseStatement("with"), this.finishNode(e, "WithStatement");
|
|
1540
|
-
},
|
|
1519
|
+
}, k.parseEmptyStatement = function(e) {
|
|
1541
1520
|
return this.next(), this.finishNode(e, "EmptyStatement");
|
|
1542
|
-
},
|
|
1521
|
+
}, k.parseLabeledStatement = function(e, t, n, r) {
|
|
1543
1522
|
for (var i = 0, a = this.labels; i < a.length; i += 1) a[i].name === t && this.raise(n.start, "Label '" + t + "' is already declared");
|
|
1544
1523
|
for (var o = this.type.isLoop ? "loop" : this.type === b._switch ? "switch" : null, s = this.labels.length - 1; s >= 0; s--) {
|
|
1545
1524
|
var c = this.labels[s];
|
|
@@ -1551,36 +1530,36 @@ A.parseCatchClauseParam = function() {
|
|
|
1551
1530
|
kind: o,
|
|
1552
1531
|
statementStart: this.start
|
|
1553
1532
|
}), e.body = this.parseStatement(r ? r.indexOf("label") === -1 ? r + "label" : r : "label"), this.labels.pop(), e.label = n, this.finishNode(e, "LabeledStatement");
|
|
1554
|
-
},
|
|
1533
|
+
}, k.parseExpressionStatement = function(e, t) {
|
|
1555
1534
|
return e.expression = t, this.semicolon(), this.finishNode(e, "ExpressionStatement");
|
|
1556
|
-
},
|
|
1535
|
+
}, k.parseBlock = function(e, t, n) {
|
|
1557
1536
|
for (e === void 0 && (e = !0), t === void 0 && (t = this.startNode()), t.body = [], this.expect(b.braceL), e && this.enterScope(0); this.type !== b.braceR;) {
|
|
1558
1537
|
var r = this.parseStatement(null);
|
|
1559
1538
|
t.body.push(r);
|
|
1560
1539
|
}
|
|
1561
1540
|
return n && (this.strict = !1), this.next(), e && this.exitScope(), this.finishNode(t, "BlockStatement");
|
|
1562
|
-
},
|
|
1541
|
+
}, k.parseFor = function(e, t) {
|
|
1563
1542
|
return e.init = t, this.expect(b.semi), e.test = this.type === b.semi ? null : this.parseExpression(), this.expect(b.semi), e.update = this.type === b.parenR ? null : this.parseExpression(), this.expect(b.parenR), e.body = this.parseStatement("for"), this.exitScope(), this.labels.pop(), this.finishNode(e, "ForStatement");
|
|
1564
|
-
},
|
|
1543
|
+
}, k.parseForIn = function(e, t) {
|
|
1565
1544
|
var n = this.type === b._in;
|
|
1566
1545
|
return this.next(), t.type === "VariableDeclaration" && t.declarations[0].init != null && (!n || this.options.ecmaVersion < 8 || this.strict || t.kind !== "var" || t.declarations[0].id.type !== "Identifier") && this.raise(t.start, (n ? "for-in" : "for-of") + " loop variable declaration may not have an initializer"), e.left = t, e.right = n ? this.parseExpression() : this.parseMaybeAssign(), this.expect(b.parenR), e.body = this.parseStatement("for"), this.exitScope(), this.labels.pop(), this.finishNode(e, n ? "ForInStatement" : "ForOfStatement");
|
|
1567
|
-
},
|
|
1546
|
+
}, k.parseVar = function(e, t, n, r) {
|
|
1568
1547
|
for (e.declarations = [], e.kind = n;;) {
|
|
1569
1548
|
var i = this.startNode();
|
|
1570
1549
|
if (this.parseVarId(i, n), this.eat(b.eq) ? i.init = this.parseMaybeAssign(t) : !r && n === "const" && !(this.type === b._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) ? this.unexpected() : !r && (n === "using" || n === "await using") && this.options.ecmaVersion >= 17 && this.type !== b._in && !this.isContextual("of") ? this.raise(this.lastTokEnd, "Missing initializer in " + n + " declaration") : !r && i.id.type !== "Identifier" && !(t && (this.type === b._in || this.isContextual("of"))) ? this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value") : i.init = null, e.declarations.push(this.finishNode(i, "VariableDeclarator")), !this.eat(b.comma)) break;
|
|
1571
1550
|
}
|
|
1572
1551
|
return e;
|
|
1573
|
-
},
|
|
1574
|
-
e.id = t === "using" || t === "await using" ? this.parseIdent() : this.parseBindingAtom(), this.checkLValPattern(e.id, t === "var" ? Me :
|
|
1552
|
+
}, k.parseVarId = function(e, t) {
|
|
1553
|
+
e.id = t === "using" || t === "await using" ? this.parseIdent() : this.parseBindingAtom(), this.checkLValPattern(e.id, t === "var" ? Me : T, !1);
|
|
1575
1554
|
};
|
|
1576
1555
|
var Ve = 1, He = 2, Ue = 4;
|
|
1577
|
-
|
|
1578
|
-
this.initFunction(e), (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !r) && (this.type === b.star && t & He && this.unexpected(), e.generator = this.eat(b.star)), this.options.ecmaVersion >= 8 && (e.async = !!r), t & Ve && (e.id = t & Ue && this.type !== b.name ? null : this.parseIdent(), e.id && !(t & He) && this.checkLValSimple(e.id, this.strict || e.generator || e.async ? this.treatFunctionsAsVar ? Me :
|
|
1556
|
+
k.parseFunction = function(e, t, n, r, i) {
|
|
1557
|
+
this.initFunction(e), (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !r) && (this.type === b.star && t & He && this.unexpected(), e.generator = this.eat(b.star)), this.options.ecmaVersion >= 8 && (e.async = !!r), t & Ve && (e.id = t & Ue && this.type !== b.name ? null : this.parseIdent(), e.id && !(t & He) && this.checkLValSimple(e.id, this.strict || e.generator || e.async ? this.treatFunctionsAsVar ? Me : T : Ne));
|
|
1579
1558
|
var a = this.yieldPos, o = this.awaitPos, s = this.awaitIdentPos;
|
|
1580
1559
|
return this.yieldPos = 0, this.awaitPos = 0, this.awaitIdentPos = 0, this.enterScope(Ae(e.async, e.generator)), t & Ve || (e.id = this.type === b.name ? this.parseIdent() : null), this.parseFunctionParams(e), this.parseFunctionBody(e, n, !1, i), this.yieldPos = a, this.awaitPos = o, this.awaitIdentPos = s, this.finishNode(e, t & Ve ? "FunctionDeclaration" : "FunctionExpression");
|
|
1581
|
-
},
|
|
1560
|
+
}, k.parseFunctionParams = function(e) {
|
|
1582
1561
|
this.expect(b.parenL), e.params = this.parseBindingList(b.parenR, !1, this.options.ecmaVersion >= 8), this.checkYieldAwaitInDefaultParams();
|
|
1583
|
-
},
|
|
1562
|
+
}, k.parseClass = function(e, t) {
|
|
1584
1563
|
this.next();
|
|
1585
1564
|
var n = this.strict;
|
|
1586
1565
|
this.strict = !0, this.parseClassId(e, t), this.parseClassSuper(e);
|
|
@@ -1590,7 +1569,7 @@ A.parseFunction = function(e, t, n, r, i) {
|
|
|
1590
1569
|
o && (i.body.push(o), o.type === "MethodDefinition" && o.kind === "constructor" ? (a && this.raiseRecoverable(o.start, "Duplicate constructor in the same class"), a = !0) : o.key && o.key.type === "PrivateIdentifier" && We(r, o) && this.raiseRecoverable(o.key.start, "Identifier '#" + o.key.name + "' has already been declared"));
|
|
1591
1570
|
}
|
|
1592
1571
|
return this.strict = n, this.next(), e.body = this.finishNode(i, "ClassBody"), this.exitClassBody(), this.finishNode(e, t ? "ClassDeclaration" : "ClassExpression");
|
|
1593
|
-
},
|
|
1572
|
+
}, k.parseClassElement = function(e) {
|
|
1594
1573
|
if (this.eat(b.semi)) return null;
|
|
1595
1574
|
var t = this.options.ecmaVersion, n = this.startNode(), r = "", i = !1, a = !1, o = "method", s = !1;
|
|
1596
1575
|
if (this.eatContextual("static")) {
|
|
@@ -1606,18 +1585,18 @@ A.parseFunction = function(e, t, n, r, i) {
|
|
|
1606
1585
|
l && o !== "method" && this.raise(n.key.start, "Constructor can't have get/set modifier"), n.kind = l ? "constructor" : o, this.parseClassMethod(n, i, a, u);
|
|
1607
1586
|
} else this.parseClassField(n);
|
|
1608
1587
|
return n;
|
|
1609
|
-
},
|
|
1588
|
+
}, k.isClassElementNameStart = function() {
|
|
1610
1589
|
return this.type === b.name || this.type === b.privateId || this.type === b.num || this.type === b.string || this.type === b.bracketL || this.type.keyword;
|
|
1611
|
-
},
|
|
1590
|
+
}, k.parseClassElementName = function(e) {
|
|
1612
1591
|
this.type === b.privateId ? (this.value === "constructor" && this.raise(this.start, "Classes can't have an element named '#constructor'"), e.computed = !1, e.key = this.parsePrivateIdent()) : this.parsePropertyName(e);
|
|
1613
|
-
},
|
|
1592
|
+
}, k.parseClassMethod = function(e, t, n, r) {
|
|
1614
1593
|
var i = e.key;
|
|
1615
1594
|
e.kind === "constructor" ? (t && this.raise(i.start, "Constructor can't be a generator"), n && this.raise(i.start, "Constructor can't be an async method")) : e.static && Ge(e, "prototype") && this.raise(i.start, "Classes may not have a static property named prototype");
|
|
1616
1595
|
var a = e.value = this.parseMethod(t, n, r);
|
|
1617
1596
|
return e.kind === "get" && a.params.length !== 0 && this.raiseRecoverable(a.start, "getter should have no params"), e.kind === "set" && a.params.length !== 1 && this.raiseRecoverable(a.start, "setter should have exactly one param"), e.kind === "set" && a.params[0].type === "RestElement" && this.raiseRecoverable(a.params[0].start, "Setter cannot use rest params"), this.finishNode(e, "MethodDefinition");
|
|
1618
|
-
},
|
|
1597
|
+
}, k.parseClassField = function(e) {
|
|
1619
1598
|
return Ge(e, "constructor") ? this.raise(e.key.start, "Classes can't have a field named 'constructor'") : e.static && Ge(e, "prototype") && this.raise(e.key.start, "Classes can't have a static field named 'prototype'"), this.eat(b.eq) ? (this.enterScope(De | we), e.value = this.parseMaybeAssign(), this.exitScope()) : e.value = null, this.semicolon(), this.finishNode(e, "PropertyDefinition");
|
|
1620
|
-
},
|
|
1599
|
+
}, k.parseClassStaticBlock = function(e) {
|
|
1621
1600
|
e.body = [];
|
|
1622
1601
|
var t = this.labels;
|
|
1623
1602
|
for (this.labels = [], this.enterScope(Ee | we); this.type !== b.braceR;) {
|
|
@@ -1625,21 +1604,21 @@ A.parseFunction = function(e, t, n, r, i) {
|
|
|
1625
1604
|
e.body.push(n);
|
|
1626
1605
|
}
|
|
1627
1606
|
return this.next(), this.exitScope(), this.labels = t, this.finishNode(e, "StaticBlock");
|
|
1628
|
-
},
|
|
1629
|
-
this.type === b.name ? (e.id = this.parseIdent(), t && this.checkLValSimple(e.id,
|
|
1630
|
-
},
|
|
1607
|
+
}, k.parseClassId = function(e, t) {
|
|
1608
|
+
this.type === b.name ? (e.id = this.parseIdent(), t && this.checkLValSimple(e.id, T, !1)) : (t === !0 && this.unexpected(), e.id = null);
|
|
1609
|
+
}, k.parseClassSuper = function(e) {
|
|
1631
1610
|
e.superClass = this.eat(b._extends) ? this.parseExprSubscripts(null, !1) : null;
|
|
1632
|
-
},
|
|
1611
|
+
}, k.enterClassBody = function() {
|
|
1633
1612
|
var e = {
|
|
1634
1613
|
declared: Object.create(null),
|
|
1635
1614
|
used: []
|
|
1636
1615
|
};
|
|
1637
1616
|
return this.privateNameStack.push(e), e.declared;
|
|
1638
|
-
},
|
|
1617
|
+
}, k.exitClassBody = function() {
|
|
1639
1618
|
var e = this.privateNameStack.pop(), t = e.declared, n = e.used;
|
|
1640
1619
|
if (this.options.checkPrivateFields) for (var r = this.privateNameStack.length, i = r === 0 ? null : this.privateNameStack[r - 1], a = 0; a < n.length; ++a) {
|
|
1641
1620
|
var o = n[a];
|
|
1642
|
-
|
|
1621
|
+
se(t, o.name) || (i ? i.used.push(o) : this.raiseRecoverable(o.start, "Private field '#" + o.name + "' must be declared in an enclosing class"));
|
|
1643
1622
|
}
|
|
1644
1623
|
};
|
|
1645
1624
|
function We(e, t) {
|
|
@@ -1650,9 +1629,9 @@ function Ge(e, t) {
|
|
|
1650
1629
|
var n = e.computed, r = e.key;
|
|
1651
1630
|
return !n && (r.type === "Identifier" && r.name === t || r.type === "Literal" && r.value === t);
|
|
1652
1631
|
}
|
|
1653
|
-
|
|
1632
|
+
k.parseExportAllDeclaration = function(e, t) {
|
|
1654
1633
|
return this.options.ecmaVersion >= 11 && (this.eatContextual("as") ? (e.exported = this.parseModuleExportName(), this.checkExport(t, e.exported, this.lastTokStart)) : e.exported = null), this.expectContextual("from"), this.type !== b.string && this.unexpected(), e.source = this.parseExprAtom(), this.options.ecmaVersion >= 16 && (e.attributes = this.parseWithClause()), this.semicolon(), this.finishNode(e, "ExportAllDeclaration");
|
|
1655
|
-
},
|
|
1634
|
+
}, k.parseExport = function(e, t) {
|
|
1656
1635
|
if (this.next(), this.eat(b.star)) return this.parseExportAllDeclaration(e, t);
|
|
1657
1636
|
if (this.eat(b._default)) return this.checkExport(t, "default", this.lastTokStart), e.declaration = this.parseExportDefaultDeclaration(), this.finishNode(e, "ExportDefaultDeclaration");
|
|
1658
1637
|
if (this.shouldParseExportStatement()) e.declaration = this.parseExportDeclaration(e), e.declaration.type === "VariableDeclaration" ? this.checkVariableExport(t, e.declaration.declarations) : this.checkExport(t, e.declaration.id, e.declaration.id.start), e.specifiers = [], e.source = null, this.options.ecmaVersion >= 16 && (e.attributes = []);
|
|
@@ -1668,9 +1647,9 @@ A.parseExportAllDeclaration = function(e, t) {
|
|
|
1668
1647
|
this.semicolon();
|
|
1669
1648
|
}
|
|
1670
1649
|
return this.finishNode(e, "ExportNamedDeclaration");
|
|
1671
|
-
},
|
|
1650
|
+
}, k.parseExportDeclaration = function(e) {
|
|
1672
1651
|
return this.parseStatement(null);
|
|
1673
|
-
},
|
|
1652
|
+
}, k.parseExportDefaultDeclaration = function() {
|
|
1674
1653
|
var e;
|
|
1675
1654
|
if (this.type === b._function || (e = this.isAsyncFunction())) {
|
|
1676
1655
|
var t = this.startNode();
|
|
@@ -1682,9 +1661,9 @@ A.parseExportAllDeclaration = function(e, t) {
|
|
|
1682
1661
|
var r = this.parseMaybeAssign();
|
|
1683
1662
|
return this.semicolon(), r;
|
|
1684
1663
|
}
|
|
1685
|
-
},
|
|
1686
|
-
e && (typeof t != "string" && (t = t.type === "Identifier" ? t.name : t.value),
|
|
1687
|
-
},
|
|
1664
|
+
}, k.checkExport = function(e, t, n) {
|
|
1665
|
+
e && (typeof t != "string" && (t = t.type === "Identifier" ? t.name : t.value), se(e, t) && this.raiseRecoverable(n, "Duplicate export '" + t + "'"), e[t] = !0);
|
|
1666
|
+
}, k.checkPatternExport = function(e, t) {
|
|
1688
1667
|
var n = t.type;
|
|
1689
1668
|
if (n === "Identifier") this.checkExport(e, t, t.start);
|
|
1690
1669
|
else if (n === "ObjectPattern") for (var r = 0, i = t.properties; r < i.length; r += 1) {
|
|
@@ -1696,17 +1675,17 @@ A.parseExportAllDeclaration = function(e, t) {
|
|
|
1696
1675
|
c && this.checkPatternExport(e, c);
|
|
1697
1676
|
}
|
|
1698
1677
|
else n === "Property" ? this.checkPatternExport(e, t.value) : n === "AssignmentPattern" ? this.checkPatternExport(e, t.left) : n === "RestElement" && this.checkPatternExport(e, t.argument);
|
|
1699
|
-
},
|
|
1678
|
+
}, k.checkVariableExport = function(e, t) {
|
|
1700
1679
|
if (e) for (var n = 0, r = t; n < r.length; n += 1) {
|
|
1701
1680
|
var i = r[n];
|
|
1702
1681
|
this.checkPatternExport(e, i.id);
|
|
1703
1682
|
}
|
|
1704
|
-
},
|
|
1683
|
+
}, k.shouldParseExportStatement = function() {
|
|
1705
1684
|
return this.type.keyword === "var" || this.type.keyword === "const" || this.type.keyword === "class" || this.type.keyword === "function" || this.isLet() || this.isAsyncFunction();
|
|
1706
|
-
},
|
|
1685
|
+
}, k.parseExportSpecifier = function(e) {
|
|
1707
1686
|
var t = this.startNode();
|
|
1708
1687
|
return t.local = this.parseModuleExportName(), t.exported = this.eatContextual("as") ? this.parseModuleExportName() : t.local, this.checkExport(e, t.exported, t.exported.start), this.finishNode(t, "ExportSpecifier");
|
|
1709
|
-
},
|
|
1688
|
+
}, k.parseExportSpecifiers = function(e) {
|
|
1710
1689
|
var t = [], n = !0;
|
|
1711
1690
|
for (this.expect(b.braceL); !this.eat(b.braceR);) {
|
|
1712
1691
|
if (n) n = !1;
|
|
@@ -1714,18 +1693,18 @@ A.parseExportAllDeclaration = function(e, t) {
|
|
|
1714
1693
|
t.push(this.parseExportSpecifier(e));
|
|
1715
1694
|
}
|
|
1716
1695
|
return t;
|
|
1717
|
-
},
|
|
1696
|
+
}, k.parseImport = function(e) {
|
|
1718
1697
|
return this.next(), this.type === b.string ? (e.specifiers = Be, e.source = this.parseExprAtom()) : (e.specifiers = this.parseImportSpecifiers(), this.expectContextual("from"), e.source = this.type === b.string ? this.parseExprAtom() : this.unexpected()), this.options.ecmaVersion >= 16 && (e.attributes = this.parseWithClause()), this.semicolon(), this.finishNode(e, "ImportDeclaration");
|
|
1719
|
-
},
|
|
1698
|
+
}, k.parseImportSpecifier = function() {
|
|
1720
1699
|
var e = this.startNode();
|
|
1721
|
-
return e.imported = this.parseModuleExportName(), this.eatContextual("as") ? e.local = this.parseIdent() : (this.checkUnreserved(e.imported), e.local = e.imported), this.checkLValSimple(e.local,
|
|
1722
|
-
},
|
|
1700
|
+
return e.imported = this.parseModuleExportName(), this.eatContextual("as") ? e.local = this.parseIdent() : (this.checkUnreserved(e.imported), e.local = e.imported), this.checkLValSimple(e.local, T), this.finishNode(e, "ImportSpecifier");
|
|
1701
|
+
}, k.parseImportDefaultSpecifier = function() {
|
|
1723
1702
|
var e = this.startNode();
|
|
1724
|
-
return e.local = this.parseIdent(), this.checkLValSimple(e.local,
|
|
1725
|
-
},
|
|
1703
|
+
return e.local = this.parseIdent(), this.checkLValSimple(e.local, T), this.finishNode(e, "ImportDefaultSpecifier");
|
|
1704
|
+
}, k.parseImportNamespaceSpecifier = function() {
|
|
1726
1705
|
var e = this.startNode();
|
|
1727
|
-
return this.next(), this.expectContextual("as"), e.local = this.parseIdent(), this.checkLValSimple(e.local,
|
|
1728
|
-
},
|
|
1706
|
+
return this.next(), this.expectContextual("as"), e.local = this.parseIdent(), this.checkLValSimple(e.local, T), this.finishNode(e, "ImportNamespaceSpecifier");
|
|
1707
|
+
}, k.parseImportSpecifiers = function() {
|
|
1729
1708
|
var e = [], t = !0;
|
|
1730
1709
|
if (this.type === b.name && (e.push(this.parseImportDefaultSpecifier()), !this.eat(b.comma))) return e;
|
|
1731
1710
|
if (this.type === b.star) return e.push(this.parseImportNamespaceSpecifier()), e;
|
|
@@ -1735,7 +1714,7 @@ A.parseExportAllDeclaration = function(e, t) {
|
|
|
1735
1714
|
e.push(this.parseImportSpecifier());
|
|
1736
1715
|
}
|
|
1737
1716
|
return e;
|
|
1738
|
-
},
|
|
1717
|
+
}, k.parseWithClause = function() {
|
|
1739
1718
|
var e = [];
|
|
1740
1719
|
if (!this.eat(b._with)) return e;
|
|
1741
1720
|
this.expect(b.braceL);
|
|
@@ -1743,25 +1722,25 @@ A.parseExportAllDeclaration = function(e, t) {
|
|
|
1743
1722
|
if (n) n = !1;
|
|
1744
1723
|
else if (this.expect(b.comma), this.afterTrailingComma(b.braceR)) break;
|
|
1745
1724
|
var r = this.parseImportAttribute(), i = r.key.type === "Identifier" ? r.key.name : r.key.value;
|
|
1746
|
-
|
|
1725
|
+
se(t, i) && this.raiseRecoverable(r.key.start, "Duplicate attribute key '" + i + "'"), t[i] = !0, e.push(r);
|
|
1747
1726
|
}
|
|
1748
1727
|
return e;
|
|
1749
|
-
},
|
|
1728
|
+
}, k.parseImportAttribute = function() {
|
|
1750
1729
|
var e = this.startNode();
|
|
1751
1730
|
return e.key = this.type === b.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never"), this.expect(b.colon), this.type !== b.string && this.unexpected(), e.value = this.parseExprAtom(), this.finishNode(e, "ImportAttribute");
|
|
1752
|
-
},
|
|
1731
|
+
}, k.parseModuleExportName = function() {
|
|
1753
1732
|
if (this.options.ecmaVersion >= 13 && this.type === b.string) {
|
|
1754
1733
|
var e = this.parseLiteral(this.value);
|
|
1755
|
-
return
|
|
1734
|
+
return ue.test(e.value) && this.raise(e.start, "An export name cannot include a lone surrogate."), e;
|
|
1756
1735
|
}
|
|
1757
1736
|
return this.parseIdent(!0);
|
|
1758
|
-
},
|
|
1737
|
+
}, k.adaptDirectivePrologue = function(e) {
|
|
1759
1738
|
for (var t = 0; t < e.length && this.isDirectiveCandidate(e[t]); ++t) e[t].directive = e[t].expression.raw.slice(1, -1);
|
|
1760
|
-
},
|
|
1739
|
+
}, k.isDirectiveCandidate = function(e) {
|
|
1761
1740
|
return this.options.ecmaVersion >= 5 && e.type === "ExpressionStatement" && e.expression.type === "Literal" && typeof e.expression.value == "string" && (this.input[e.start] === "\"" || this.input[e.start] === "'");
|
|
1762
1741
|
};
|
|
1763
|
-
var
|
|
1764
|
-
|
|
1742
|
+
var A = E.prototype;
|
|
1743
|
+
A.toAssignable = function(e, t, n) {
|
|
1765
1744
|
if (this.options.ecmaVersion >= 6 && e) switch (e.type) {
|
|
1766
1745
|
case "Identifier":
|
|
1767
1746
|
this.inAsync && e.name === "await" && this.raise(e.start, "Cannot use 'await' as identifier inside an async function");
|
|
@@ -1800,7 +1779,7 @@ j.toAssignable = function(e, t, n) {
|
|
|
1800
1779
|
}
|
|
1801
1780
|
else n && this.checkPatternErrors(n, !0);
|
|
1802
1781
|
return e;
|
|
1803
|
-
},
|
|
1782
|
+
}, A.toAssignableList = function(e, t) {
|
|
1804
1783
|
for (var n = e.length, r = 0; r < n; r++) {
|
|
1805
1784
|
var i = e[r];
|
|
1806
1785
|
i && this.toAssignable(i, t);
|
|
@@ -1810,13 +1789,13 @@ j.toAssignable = function(e, t, n) {
|
|
|
1810
1789
|
this.options.ecmaVersion === 6 && t && a && a.type === "RestElement" && a.argument.type !== "Identifier" && this.unexpected(a.argument.start);
|
|
1811
1790
|
}
|
|
1812
1791
|
return e;
|
|
1813
|
-
},
|
|
1792
|
+
}, A.parseSpread = function(e) {
|
|
1814
1793
|
var t = this.startNode();
|
|
1815
1794
|
return this.next(), t.argument = this.parseMaybeAssign(!1, e), this.finishNode(t, "SpreadElement");
|
|
1816
|
-
},
|
|
1795
|
+
}, A.parseRestBinding = function() {
|
|
1817
1796
|
var e = this.startNode();
|
|
1818
1797
|
return this.next(), this.options.ecmaVersion === 6 && this.type !== b.name && this.unexpected(), e.argument = this.parseBindingAtom(), this.finishNode(e, "RestElement");
|
|
1819
|
-
},
|
|
1798
|
+
}, A.parseBindingAtom = function() {
|
|
1820
1799
|
if (this.options.ecmaVersion >= 6) switch (this.type) {
|
|
1821
1800
|
case b.bracketL:
|
|
1822
1801
|
var e = this.startNode();
|
|
@@ -1824,7 +1803,7 @@ j.toAssignable = function(e, t, n) {
|
|
|
1824
1803
|
case b.braceL: return this.parseObj(!0);
|
|
1825
1804
|
}
|
|
1826
1805
|
return this.parseIdent();
|
|
1827
|
-
},
|
|
1806
|
+
}, A.parseBindingList = function(e, t, n, r) {
|
|
1828
1807
|
for (var i = [], a = !0; !this.eat(e);) if (a ? a = !1 : this.expect(b.comma), t && this.type === b.comma) i.push(null);
|
|
1829
1808
|
else if (n && this.afterTrailingComma(e)) break;
|
|
1830
1809
|
else if (this.type === b.ellipsis) {
|
|
@@ -1833,21 +1812,21 @@ j.toAssignable = function(e, t, n) {
|
|
|
1833
1812
|
break;
|
|
1834
1813
|
} else i.push(this.parseAssignableListItem(r));
|
|
1835
1814
|
return i;
|
|
1836
|
-
},
|
|
1815
|
+
}, A.parseAssignableListItem = function(e) {
|
|
1837
1816
|
var t = this.parseMaybeDefault(this.start, this.startLoc);
|
|
1838
1817
|
return this.parseBindingListItem(t), t;
|
|
1839
|
-
},
|
|
1818
|
+
}, A.parseBindingListItem = function(e) {
|
|
1840
1819
|
return e;
|
|
1841
|
-
},
|
|
1820
|
+
}, A.parseMaybeDefault = function(e, t, n) {
|
|
1842
1821
|
if (n ||= this.parseBindingAtom(), this.options.ecmaVersion < 6 || !this.eat(b.eq)) return n;
|
|
1843
1822
|
var r = this.startNodeAt(e, t);
|
|
1844
1823
|
return r.left = n, r.right = this.parseMaybeAssign(), this.finishNode(r, "AssignmentPattern");
|
|
1845
|
-
},
|
|
1824
|
+
}, A.checkLValSimple = function(e, t, n) {
|
|
1846
1825
|
t === void 0 && (t = je);
|
|
1847
1826
|
var r = t !== je;
|
|
1848
1827
|
switch (e.type) {
|
|
1849
1828
|
case "Identifier":
|
|
1850
|
-
this.strict && this.reservedWordsStrictBind.test(e.name) && this.raiseRecoverable(e.start, (r ? "Binding " : "Assigning to ") + e.name + " in strict mode"), r && (t ===
|
|
1829
|
+
this.strict && this.reservedWordsStrictBind.test(e.name) && this.raiseRecoverable(e.start, (r ? "Binding " : "Assigning to ") + e.name + " in strict mode"), r && (t === T && e.name === "let" && this.raiseRecoverable(e.start, "let is disallowed as a lexically bound name"), n && (se(n, e.name) && this.raiseRecoverable(e.start, "Argument name clash"), n[e.name] = !0), t !== Fe && this.declareName(e.name, t, e.start));
|
|
1851
1830
|
break;
|
|
1852
1831
|
case "ChainExpression":
|
|
1853
1832
|
this.raiseRecoverable(e.start, "Optional chaining cannot appear in left-hand side");
|
|
@@ -1858,7 +1837,7 @@ j.toAssignable = function(e, t, n) {
|
|
|
1858
1837
|
case "ParenthesizedExpression": return r && this.raiseRecoverable(e.start, "Binding parenthesized expression"), this.checkLValSimple(e.expression, t, n);
|
|
1859
1838
|
default: this.raise(e.start, (r ? "Binding" : "Assigning to") + " rvalue");
|
|
1860
1839
|
}
|
|
1861
|
-
},
|
|
1840
|
+
}, A.checkLValPattern = function(e, t, n) {
|
|
1862
1841
|
switch (t === void 0 && (t = je), e.type) {
|
|
1863
1842
|
case "ObjectPattern":
|
|
1864
1843
|
for (var r = 0, i = e.properties; r < i.length; r += 1) {
|
|
@@ -1874,7 +1853,7 @@ j.toAssignable = function(e, t, n) {
|
|
|
1874
1853
|
break;
|
|
1875
1854
|
default: this.checkLValSimple(e, t, n);
|
|
1876
1855
|
}
|
|
1877
|
-
},
|
|
1856
|
+
}, A.checkLValInnerPattern = function(e, t, n) {
|
|
1878
1857
|
switch (t === void 0 && (t = je), e.type) {
|
|
1879
1858
|
case "Property":
|
|
1880
1859
|
this.checkLValInnerPattern(e.value, t, n);
|
|
@@ -1888,29 +1867,29 @@ j.toAssignable = function(e, t, n) {
|
|
|
1888
1867
|
default: this.checkLValPattern(e, t, n);
|
|
1889
1868
|
}
|
|
1890
1869
|
};
|
|
1891
|
-
var
|
|
1870
|
+
var j = function(e, t, n, r, i) {
|
|
1892
1871
|
this.token = e, this.isExpr = !!t, this.preserveSpace = !!n, this.override = r, this.generator = !!i;
|
|
1893
|
-
},
|
|
1894
|
-
b_stat: new
|
|
1895
|
-
b_expr: new
|
|
1896
|
-
b_tmpl: new
|
|
1897
|
-
p_stat: new
|
|
1898
|
-
p_expr: new
|
|
1899
|
-
q_tmpl: new
|
|
1872
|
+
}, M = {
|
|
1873
|
+
b_stat: new j("{", !1),
|
|
1874
|
+
b_expr: new j("{", !0),
|
|
1875
|
+
b_tmpl: new j("${", !1),
|
|
1876
|
+
p_stat: new j("(", !1),
|
|
1877
|
+
p_expr: new j("(", !0),
|
|
1878
|
+
q_tmpl: new j("`", !0, !0, function(e) {
|
|
1900
1879
|
return e.tryReadTemplateToken();
|
|
1901
1880
|
}),
|
|
1902
|
-
f_stat: new
|
|
1903
|
-
f_expr: new
|
|
1904
|
-
f_expr_gen: new
|
|
1905
|
-
f_gen: new
|
|
1906
|
-
}, Ke =
|
|
1881
|
+
f_stat: new j("function", !1),
|
|
1882
|
+
f_expr: new j("function", !0),
|
|
1883
|
+
f_expr_gen: new j("function", !0, !1, null, !0),
|
|
1884
|
+
f_gen: new j("function", !1, !1, null, !0)
|
|
1885
|
+
}, Ke = E.prototype;
|
|
1907
1886
|
Ke.initialContext = function() {
|
|
1908
|
-
return [
|
|
1887
|
+
return [M.b_stat];
|
|
1909
1888
|
}, Ke.curContext = function() {
|
|
1910
1889
|
return this.context[this.context.length - 1];
|
|
1911
1890
|
}, Ke.braceIsBlock = function(e) {
|
|
1912
1891
|
var t = this.curContext();
|
|
1913
|
-
return t ===
|
|
1892
|
+
return t === M.f_expr || t === M.f_stat ? !0 : e === b.colon && (t === M.b_stat || t === M.b_expr) ? !t.isExpr : e === b._return || e === b.name && this.exprAllowed ? x.test(this.input.slice(this.lastTokEnd, this.start)) : e === b._else || e === b.semi || e === b.eof || e === b.parenR || e === b.arrow ? !0 : e === b.braceL ? t === M.b_stat : e === b._var || e === b._const || e === b.name ? !1 : !this.exprAllowed;
|
|
1914
1893
|
}, Ke.inGeneratorContext = function() {
|
|
1915
1894
|
for (var e = this.context.length - 1; e >= 1; e--) {
|
|
1916
1895
|
var t = this.context[e];
|
|
@@ -1928,32 +1907,32 @@ Ke.initialContext = function() {
|
|
|
1928
1907
|
return;
|
|
1929
1908
|
}
|
|
1930
1909
|
var e = this.context.pop();
|
|
1931
|
-
e ===
|
|
1910
|
+
e === M.b_stat && this.curContext().token === "function" && (e = this.context.pop()), this.exprAllowed = !e.isExpr;
|
|
1932
1911
|
}, b.braceL.updateContext = function(e) {
|
|
1933
|
-
this.context.push(this.braceIsBlock(e) ?
|
|
1912
|
+
this.context.push(this.braceIsBlock(e) ? M.b_stat : M.b_expr), this.exprAllowed = !0;
|
|
1934
1913
|
}, b.dollarBraceL.updateContext = function() {
|
|
1935
|
-
this.context.push(
|
|
1914
|
+
this.context.push(M.b_tmpl), this.exprAllowed = !0;
|
|
1936
1915
|
}, b.parenL.updateContext = function(e) {
|
|
1937
1916
|
var t = e === b._if || e === b._for || e === b._with || e === b._while;
|
|
1938
|
-
this.context.push(t ?
|
|
1917
|
+
this.context.push(t ? M.p_stat : M.p_expr), this.exprAllowed = !0;
|
|
1939
1918
|
}, b.incDec.updateContext = function() {}, b._function.updateContext = b._class.updateContext = function(e) {
|
|
1940
|
-
e.beforeExpr && e !== b._else && !(e === b.semi && this.curContext() !==
|
|
1919
|
+
e.beforeExpr && e !== b._else && !(e === b.semi && this.curContext() !== M.p_stat) && !(e === b._return && x.test(this.input.slice(this.lastTokEnd, this.start))) && !((e === b.colon || e === b.braceL) && this.curContext() === M.b_stat) ? this.context.push(M.f_expr) : this.context.push(M.f_stat), this.exprAllowed = !1;
|
|
1941
1920
|
}, b.colon.updateContext = function() {
|
|
1942
1921
|
this.curContext().token === "function" && this.context.pop(), this.exprAllowed = !0;
|
|
1943
1922
|
}, b.backQuote.updateContext = function() {
|
|
1944
|
-
this.curContext() ===
|
|
1923
|
+
this.curContext() === M.q_tmpl ? this.context.pop() : this.context.push(M.q_tmpl), this.exprAllowed = !1;
|
|
1945
1924
|
}, b.star.updateContext = function(e) {
|
|
1946
1925
|
if (e === b._function) {
|
|
1947
1926
|
var t = this.context.length - 1;
|
|
1948
|
-
this.context[t] ===
|
|
1927
|
+
this.context[t] === M.f_expr ? this.context[t] = M.f_expr_gen : this.context[t] = M.f_gen;
|
|
1949
1928
|
}
|
|
1950
1929
|
this.exprAllowed = !0;
|
|
1951
1930
|
}, b.name.updateContext = function(e) {
|
|
1952
1931
|
var t = !1;
|
|
1953
1932
|
this.options.ecmaVersion >= 6 && e !== b.dot && (this.value === "of" && !this.exprAllowed || this.value === "yield" && this.inGeneratorContext()) && (t = !0), this.exprAllowed = t;
|
|
1954
1933
|
};
|
|
1955
|
-
var
|
|
1956
|
-
|
|
1934
|
+
var N = E.prototype;
|
|
1935
|
+
N.checkPropClash = function(e, t, n) {
|
|
1957
1936
|
if (!(this.options.ecmaVersion >= 9 && e.type === "SpreadElement") && !(this.options.ecmaVersion >= 6 && (e.computed || e.method || e.shorthand))) {
|
|
1958
1937
|
var r = e.key, i;
|
|
1959
1938
|
switch (r.type) {
|
|
@@ -1978,7 +1957,7 @@ P.checkPropClash = function(e, t, n) {
|
|
|
1978
1957
|
set: !1
|
|
1979
1958
|
}, o[a] = !0;
|
|
1980
1959
|
}
|
|
1981
|
-
},
|
|
1960
|
+
}, N.parseExpression = function(e, t) {
|
|
1982
1961
|
var n = this;
|
|
1983
1962
|
return this.catchStackOverflow(function() {
|
|
1984
1963
|
var r = n.start, i = n.startLoc, a = n.parseMaybeAssign(e, t);
|
|
@@ -1989,7 +1968,7 @@ P.checkPropClash = function(e, t, n) {
|
|
|
1989
1968
|
}
|
|
1990
1969
|
return a;
|
|
1991
1970
|
});
|
|
1992
|
-
},
|
|
1971
|
+
}, N.parseMaybeAssign = function(e, t, n) {
|
|
1993
1972
|
if (this.isContextual("yield")) {
|
|
1994
1973
|
if (this.inGenerator) return this.parseYield(e);
|
|
1995
1974
|
this.exprAllowed = !1;
|
|
@@ -2004,7 +1983,7 @@ P.checkPropClash = function(e, t, n) {
|
|
|
2004
1983
|
return u.operator = this.value, this.type === b.eq && (l = this.toAssignable(l, !1, t)), r || (t.parenthesizedAssign = t.trailingComma = t.doubleProto = -1), t.shorthandAssign >= l.start && (t.shorthandAssign = -1), this.type === b.eq ? this.checkLValPattern(l) : this.checkLValSimple(l), u.left = l, this.next(), u.right = this.parseMaybeAssign(e), o > -1 && (t.doubleProto = o), this.finishNode(u, "AssignmentExpression");
|
|
2005
1984
|
} else r && this.checkExpressionErrors(t, !0);
|
|
2006
1985
|
return i > -1 && (t.parenthesizedAssign = i), a > -1 && (t.trailingComma = a), l;
|
|
2007
|
-
},
|
|
1986
|
+
}, N.parseMaybeConditional = function(e, t) {
|
|
2008
1987
|
var n = this.start, r = this.startLoc, i = this.parseExprOps(e, t);
|
|
2009
1988
|
if (this.checkExpressionErrors(t)) return i;
|
|
2010
1989
|
if (!(i.type === "ArrowFunctionExpression" && i.start === n) && this.eat(b.question)) {
|
|
@@ -2012,10 +1991,10 @@ P.checkPropClash = function(e, t, n) {
|
|
|
2012
1991
|
return a.test = i, a.consequent = this.parseMaybeAssign(), this.expect(b.colon), a.alternate = this.parseMaybeAssign(e), this.finishNode(a, "ConditionalExpression");
|
|
2013
1992
|
}
|
|
2014
1993
|
return i;
|
|
2015
|
-
},
|
|
1994
|
+
}, N.parseExprOps = function(e, t) {
|
|
2016
1995
|
var n = this.start, r = this.startLoc, i = this.parseMaybeUnary(t, !1, !1, e);
|
|
2017
1996
|
return this.checkExpressionErrors(t) || i.start === n && i.type === "ArrowFunctionExpression" ? i : this.parseExprOp(i, n, r, -1, e);
|
|
2018
|
-
},
|
|
1997
|
+
}, N.parseExprOp = function(e, t, n, r, i) {
|
|
2019
1998
|
var a = this.type.binop;
|
|
2020
1999
|
if (a != null && (!i || this.type !== b._in) && a > r) {
|
|
2021
2000
|
var o = this.type === b.logicalOR || this.type === b.logicalAND, s = this.type === b.coalesce;
|
|
@@ -2026,11 +2005,11 @@ P.checkPropClash = function(e, t, n) {
|
|
|
2026
2005
|
return (o && this.type === b.coalesce || s && (this.type === b.logicalOR || this.type === b.logicalAND)) && this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"), this.parseExprOp(f, t, n, r, i);
|
|
2027
2006
|
}
|
|
2028
2007
|
return e;
|
|
2029
|
-
},
|
|
2008
|
+
}, N.buildBinary = function(e, t, n, r, i, a) {
|
|
2030
2009
|
r.type === "PrivateIdentifier" && this.raise(r.start, "Private identifier can only be left side of binary expression");
|
|
2031
2010
|
var o = this.startNodeAt(e, t);
|
|
2032
2011
|
return o.left = n, o.operator = i, o.right = r, this.finishNode(o, a ? "LogicalExpression" : "BinaryExpression");
|
|
2033
|
-
},
|
|
2012
|
+
}, N.parseMaybeUnary = function(e, t, n, r) {
|
|
2034
2013
|
var i = this.start, a = this.startLoc, o;
|
|
2035
2014
|
if (this.isContextual("await") && this.canAwait) o = this.parseAwait(r), t = !0;
|
|
2036
2015
|
else if (this.type.prefix) {
|
|
@@ -2054,12 +2033,12 @@ function qe(e) {
|
|
|
2054
2033
|
function Je(e) {
|
|
2055
2034
|
return e.type === "MemberExpression" && e.property.type === "PrivateIdentifier" || e.type === "ChainExpression" && Je(e.expression) || e.type === "ParenthesizedExpression" && Je(e.expression);
|
|
2056
2035
|
}
|
|
2057
|
-
|
|
2036
|
+
N.parseExprSubscripts = function(e, t) {
|
|
2058
2037
|
var n = this.start, r = this.startLoc, i = this.parseExprAtom(e, t);
|
|
2059
2038
|
if (i.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")") return i;
|
|
2060
2039
|
var a = this.parseSubscripts(i, n, r, !1, t);
|
|
2061
2040
|
return e && a.type === "MemberExpression" && (e.parenthesizedAssign >= a.start && (e.parenthesizedAssign = -1), e.parenthesizedBind >= a.start && (e.parenthesizedBind = -1), e.trailingComma >= a.start && (e.trailingComma = -1)), a;
|
|
2062
|
-
},
|
|
2041
|
+
}, N.parseSubscripts = function(e, t, n, r, i) {
|
|
2063
2042
|
for (var a = this.options.ecmaVersion >= 8 && e.type === "Identifier" && e.name === "async" && this.lastTokEnd === e.end && !this.canInsertSemicolon() && e.end - e.start === 5 && this.potentialArrowAt === e.start, o = !1;;) {
|
|
2064
2043
|
var s = this.parseSubscript(e, t, n, r, a, o, i);
|
|
2065
2044
|
if (s.optional && (o = !0), s === e || s.type === "ArrowFunctionExpression") {
|
|
@@ -2071,11 +2050,11 @@ P.parseExprSubscripts = function(e, t) {
|
|
|
2071
2050
|
}
|
|
2072
2051
|
e = s;
|
|
2073
2052
|
}
|
|
2074
|
-
},
|
|
2053
|
+
}, N.shouldParseAsyncArrow = function() {
|
|
2075
2054
|
return !this.canInsertSemicolon() && this.eat(b.arrow);
|
|
2076
|
-
},
|
|
2055
|
+
}, N.parseSubscriptAsyncArrow = function(e, t, n, r) {
|
|
2077
2056
|
return this.parseArrowExpression(this.startNodeAt(e, t), n, !0, r);
|
|
2078
|
-
},
|
|
2057
|
+
}, N.parseSubscript = function(e, t, n, r, i, a, o) {
|
|
2079
2058
|
var s = this.options.ecmaVersion >= 11, c = s && this.eat(b.questionDot);
|
|
2080
2059
|
r && c && this.raise(this.lastTokStart, "Optional chaining cannot appear in the callee of new expressions");
|
|
2081
2060
|
var l = this.eat(b.bracketL);
|
|
@@ -2096,7 +2075,7 @@ P.parseExprSubscripts = function(e, t) {
|
|
|
2096
2075
|
_.tag = e, _.quasi = this.parseTemplate({ isTagged: !0 }), e = this.finishNode(_, "TaggedTemplateExpression");
|
|
2097
2076
|
}
|
|
2098
2077
|
return e;
|
|
2099
|
-
},
|
|
2078
|
+
}, N.parseExprAtom = function(e, t, n) {
|
|
2100
2079
|
this.type === b.slash && this.readRegexp();
|
|
2101
2080
|
var r, i = this.potentialArrowAt === this.start;
|
|
2102
2081
|
switch (this.type) {
|
|
@@ -2104,7 +2083,7 @@ P.parseExprSubscripts = function(e, t) {
|
|
|
2104
2083
|
case b._this: return r = this.startNode(), this.next(), this.finishNode(r, "ThisExpression");
|
|
2105
2084
|
case b.name:
|
|
2106
2085
|
var a = this.start, o = this.startLoc, s = this.containsEsc, c = this.parseIdent(!1);
|
|
2107
|
-
if (this.options.ecmaVersion >= 8 && !s && c.name === "async" && !this.canInsertSemicolon() && this.eat(b._function)) return this.overrideContext(
|
|
2086
|
+
if (this.options.ecmaVersion >= 8 && !s && c.name === "async" && !this.canInsertSemicolon() && this.eat(b._function)) return this.overrideContext(M.f_expr), this.parseFunction(this.startNodeAt(a, o), 0, !1, !0, t);
|
|
2108
2087
|
if (i && !this.canInsertSemicolon()) {
|
|
2109
2088
|
if (this.eat(b.arrow)) return this.parseArrowExpression(this.startNodeAt(a, o), [c], !1, t);
|
|
2110
2089
|
if (this.options.ecmaVersion >= 8 && c.name === "async" && this.type === b.name && !s && (!this.potentialArrowInForAwait || this.value !== "of" || this.containsEsc)) return c = this.parseIdent(!1), (this.canInsertSemicolon() || !this.eat(b.arrow)) && this.unexpected(), this.parseArrowExpression(this.startNodeAt(a, o), [c], !0, t);
|
|
@@ -2125,7 +2104,7 @@ P.parseExprSubscripts = function(e, t) {
|
|
|
2125
2104
|
var u = this.start, d = this.parseParenAndDistinguishExpression(i, t);
|
|
2126
2105
|
return e && (e.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(d) && (e.parenthesizedAssign = u), e.parenthesizedBind < 0 && (e.parenthesizedBind = u)), d;
|
|
2127
2106
|
case b.bracketL: return r = this.startNode(), this.next(), r.elements = this.parseExprList(b.bracketR, !0, !0, e), this.finishNode(r, "ArrayExpression");
|
|
2128
|
-
case b.braceL: return this.overrideContext(
|
|
2107
|
+
case b.braceL: return this.overrideContext(M.b_expr), this.parseObj(!1, e);
|
|
2129
2108
|
case b._function: return r = this.startNode(), this.next(), this.parseFunction(r, 0);
|
|
2130
2109
|
case b._class: return this.parseClass(this.startNode(), !1);
|
|
2131
2110
|
case b._new: return this.parseNew();
|
|
@@ -2133,36 +2112,36 @@ P.parseExprSubscripts = function(e, t) {
|
|
|
2133
2112
|
case b._import: return this.options.ecmaVersion >= 11 ? this.parseExprImport(n) : this.unexpected();
|
|
2134
2113
|
default: return this.parseExprAtomDefault();
|
|
2135
2114
|
}
|
|
2136
|
-
},
|
|
2115
|
+
}, N.parseExprAtomDefault = function() {
|
|
2137
2116
|
this.unexpected();
|
|
2138
|
-
},
|
|
2117
|
+
}, N.parseExprImport = function(e) {
|
|
2139
2118
|
var t = this.startNode();
|
|
2140
2119
|
if (this.containsEsc && this.raiseRecoverable(this.start, "Escape sequence in keyword import"), this.next(), this.type === b.parenL && !e) return this.parseDynamicImport(t);
|
|
2141
2120
|
if (this.type === b.dot) {
|
|
2142
2121
|
var n = this.startNodeAt(t.start, t.loc && t.loc.start);
|
|
2143
2122
|
return n.name = "import", t.meta = this.finishNode(n, "Identifier"), this.parseImportMeta(t);
|
|
2144
2123
|
} else this.unexpected();
|
|
2145
|
-
},
|
|
2124
|
+
}, N.parseDynamicImport = function(e) {
|
|
2146
2125
|
if (this.next(), e.source = this.parseMaybeAssign(), this.options.ecmaVersion >= 16) this.eat(b.parenR) ? e.options = null : (this.expect(b.comma), this.afterTrailingComma(b.parenR) ? e.options = null : (e.options = this.parseMaybeAssign(), this.eat(b.parenR) || (this.expect(b.comma), this.afterTrailingComma(b.parenR) || this.unexpected())));
|
|
2147
2126
|
else if (!this.eat(b.parenR)) {
|
|
2148
2127
|
var t = this.start;
|
|
2149
2128
|
this.eat(b.comma) && this.eat(b.parenR) ? this.raiseRecoverable(t, "Trailing comma is not allowed in import()") : this.unexpected(t);
|
|
2150
2129
|
}
|
|
2151
2130
|
return this.finishNode(e, "ImportExpression");
|
|
2152
|
-
},
|
|
2131
|
+
}, N.parseImportMeta = function(e) {
|
|
2153
2132
|
this.next();
|
|
2154
2133
|
var t = this.containsEsc;
|
|
2155
2134
|
return e.property = this.parseIdent(!0), e.property.name !== "meta" && this.raiseRecoverable(e.property.start, "The only valid meta property for import is 'import.meta'"), t && this.raiseRecoverable(e.start, "'import.meta' must not contain escaped characters"), this.options.sourceType !== "module" && !this.options.allowImportExportEverywhere && this.raiseRecoverable(e.start, "Cannot use 'import.meta' outside a module"), this.finishNode(e, "MetaProperty");
|
|
2156
|
-
},
|
|
2135
|
+
}, N.parseLiteral = function(e) {
|
|
2157
2136
|
var t = this.startNode();
|
|
2158
2137
|
return t.value = e, t.raw = this.input.slice(this.start, this.end), t.raw.charCodeAt(t.raw.length - 1) === 110 && (t.bigint = t.value == null ? t.raw.slice(0, -1).replace(/_/g, "") : t.value.toString()), this.next(), this.finishNode(t, "Literal");
|
|
2159
|
-
},
|
|
2138
|
+
}, N.parseParenExpression = function() {
|
|
2160
2139
|
this.expect(b.parenL);
|
|
2161
2140
|
var e = this.parseExpression();
|
|
2162
2141
|
return this.expect(b.parenR), e;
|
|
2163
|
-
},
|
|
2142
|
+
}, N.shouldParseArrow = function(e) {
|
|
2164
2143
|
return !this.canInsertSemicolon();
|
|
2165
|
-
},
|
|
2144
|
+
}, N.parseParenAndDistinguishExpression = function(e, t) {
|
|
2166
2145
|
var n = this.start, r = this.startLoc, i, a = this.options.ecmaVersion >= 8;
|
|
2167
2146
|
if (this.options.ecmaVersion >= 6) {
|
|
2168
2147
|
this.next();
|
|
@@ -2182,13 +2161,13 @@ P.parseExprSubscripts = function(e, t) {
|
|
|
2182
2161
|
var _ = this.startNodeAt(n, r);
|
|
2183
2162
|
return _.expression = i, this.finishNode(_, "ParenthesizedExpression");
|
|
2184
2163
|
} else return i;
|
|
2185
|
-
},
|
|
2164
|
+
}, N.parseParenItem = function(e) {
|
|
2186
2165
|
return e;
|
|
2187
|
-
},
|
|
2166
|
+
}, N.parseParenArrowList = function(e, t, n, r) {
|
|
2188
2167
|
return this.parseArrowExpression(this.startNodeAt(e, t), n, !1, r);
|
|
2189
2168
|
};
|
|
2190
2169
|
var Ye = [];
|
|
2191
|
-
|
|
2170
|
+
N.parseNew = function() {
|
|
2192
2171
|
this.containsEsc && this.raiseRecoverable(this.start, "Escape sequence in keyword new");
|
|
2193
2172
|
var e = this.startNode();
|
|
2194
2173
|
if (this.next(), this.options.ecmaVersion >= 6 && this.type === b.dot) {
|
|
@@ -2199,7 +2178,7 @@ P.parseNew = function() {
|
|
|
2199
2178
|
}
|
|
2200
2179
|
var r = this.start, i = this.startLoc;
|
|
2201
2180
|
return e.callee = this.parseSubscripts(this.parseExprAtom(null, !1, !0), r, i, !0, !1), e.callee.type === "Super" && this.raiseRecoverable(r, "Invalid use of 'super'"), this.eat(b.parenL) ? e.arguments = this.parseExprList(b.parenR, this.options.ecmaVersion >= 8, !1) : e.arguments = Ye, this.finishNode(e, "NewExpression");
|
|
2202
|
-
},
|
|
2181
|
+
}, N.parseTemplateElement = function(e) {
|
|
2203
2182
|
var t = e.isTagged, n = this.startNode();
|
|
2204
2183
|
return this.type === b.invalidTemplate ? (t || this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal"), n.value = {
|
|
2205
2184
|
raw: this.value.replace(/\r\n?/g, "\n"),
|
|
@@ -2208,7 +2187,7 @@ P.parseNew = function() {
|
|
|
2208
2187
|
raw: this.input.slice(this.start, this.end).replace(/\r\n?/g, "\n"),
|
|
2209
2188
|
cooked: this.value
|
|
2210
2189
|
}, this.next(), n.tail = this.type === b.backQuote, this.finishNode(n, "TemplateElement");
|
|
2211
|
-
},
|
|
2190
|
+
}, N.parseTemplate = function(e) {
|
|
2212
2191
|
e === void 0 && (e = {});
|
|
2213
2192
|
var t = e.isTagged;
|
|
2214
2193
|
t === void 0 && (t = !1);
|
|
@@ -2217,9 +2196,9 @@ P.parseNew = function() {
|
|
|
2217
2196
|
var r = this.parseTemplateElement({ isTagged: t });
|
|
2218
2197
|
for (n.quasis = [r]; !r.tail;) this.type === b.eof && this.raise(this.pos, "Unterminated template literal"), this.expect(b.dollarBraceL), n.expressions.push(this.parseExpression()), this.expect(b.braceR), n.quasis.push(r = this.parseTemplateElement({ isTagged: t }));
|
|
2219
2198
|
return this.next(), this.finishNode(n, "TemplateLiteral");
|
|
2220
|
-
},
|
|
2199
|
+
}, N.isAsyncProp = function(e) {
|
|
2221
2200
|
return !e.computed && e.key.type === "Identifier" && e.key.name === "async" && (this.type === b.name || this.type === b.num || this.type === b.string || this.type === b.bracketL || this.type.keyword || this.options.ecmaVersion >= 9 && this.type === b.star) && !x.test(this.input.slice(this.lastTokEnd, this.start));
|
|
2222
|
-
},
|
|
2201
|
+
}, N.parseObj = function(e, t) {
|
|
2223
2202
|
var n = this.startNode(), r = !0, i = {};
|
|
2224
2203
|
for (n.properties = [], this.next(); !this.eat(b.braceR);) {
|
|
2225
2204
|
if (r) r = !1;
|
|
@@ -2228,13 +2207,13 @@ P.parseNew = function() {
|
|
|
2228
2207
|
e || this.checkPropClash(a, i, t), n.properties.push(a);
|
|
2229
2208
|
}
|
|
2230
2209
|
return this.finishNode(n, e ? "ObjectPattern" : "ObjectExpression");
|
|
2231
|
-
},
|
|
2210
|
+
}, N.parseProperty = function(e, t) {
|
|
2232
2211
|
var n = this.startNode(), r, i, a, o;
|
|
2233
2212
|
if (this.options.ecmaVersion >= 9 && this.eat(b.ellipsis)) return e ? (n.argument = this.parseIdent(!1), this.type === b.comma && this.raiseRecoverable(this.start, "Comma is not permitted after the rest element"), this.finishNode(n, "RestElement")) : (n.argument = this.parseMaybeAssign(!1, t), this.type === b.comma && t && t.trailingComma < 0 && (t.trailingComma = this.start), this.finishNode(n, "SpreadElement"));
|
|
2234
2213
|
this.options.ecmaVersion >= 6 && (n.method = !1, n.shorthand = !1, (e || t) && (a = this.start, o = this.startLoc), e || (r = this.eat(b.star)));
|
|
2235
2214
|
var s = this.containsEsc;
|
|
2236
2215
|
return this.parsePropertyName(n), !e && !s && this.options.ecmaVersion >= 8 && !r && this.isAsyncProp(n) ? (i = !0, r = this.options.ecmaVersion >= 9 && this.eat(b.star), this.parsePropertyName(n)) : i = !1, this.parsePropertyValue(n, e, r, i, a, o, t, s), this.finishNode(n, "Property");
|
|
2237
|
-
},
|
|
2216
|
+
}, N.parseGetterSetter = function(e) {
|
|
2238
2217
|
var t = e.key.name;
|
|
2239
2218
|
this.parsePropertyName(e), e.value = this.parseMethod(!1), e.kind = t;
|
|
2240
2219
|
var n = e.kind === "get" ? 0 : 1;
|
|
@@ -2242,23 +2221,23 @@ P.parseNew = function() {
|
|
|
2242
2221
|
var r = e.value.start;
|
|
2243
2222
|
e.kind === "get" ? this.raiseRecoverable(r, "getter should have no params") : this.raiseRecoverable(r, "setter should have exactly one param");
|
|
2244
2223
|
} else e.kind === "set" && e.value.params[0].type === "RestElement" && this.raiseRecoverable(e.value.params[0].start, "Setter cannot use rest params");
|
|
2245
|
-
},
|
|
2224
|
+
}, N.parsePropertyValue = function(e, t, n, r, i, a, o, s) {
|
|
2246
2225
|
(n || r) && this.type === b.colon && this.unexpected(), this.eat(b.colon) ? (e.value = t ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(!1, o), e.kind = "init") : this.options.ecmaVersion >= 6 && this.type === b.parenL ? (t && this.unexpected(), e.method = !0, e.value = this.parseMethod(n, r), e.kind = "init") : !t && !s && this.options.ecmaVersion >= 5 && !e.computed && e.key.type === "Identifier" && (e.key.name === "get" || e.key.name === "set") && this.type !== b.comma && this.type !== b.braceR && this.type !== b.eq ? ((n || r) && this.unexpected(), this.parseGetterSetter(e)) : this.options.ecmaVersion >= 6 && !e.computed && e.key.type === "Identifier" ? ((n || r) && this.unexpected(), this.checkUnreserved(e.key), e.key.name === "await" && !this.awaitIdentPos && (this.awaitIdentPos = i), t ? e.value = this.parseMaybeDefault(i, a, this.copyNode(e.key)) : this.type === b.eq && o ? (o.shorthandAssign < 0 && (o.shorthandAssign = this.start), e.value = this.parseMaybeDefault(i, a, this.copyNode(e.key))) : e.value = this.copyNode(e.key), e.kind = "init", e.shorthand = !0) : this.unexpected();
|
|
2247
|
-
},
|
|
2226
|
+
}, N.parsePropertyName = function(e) {
|
|
2248
2227
|
if (this.options.ecmaVersion >= 6) {
|
|
2249
2228
|
if (this.eat(b.bracketL)) return e.computed = !0, e.key = this.parseMaybeAssign(), this.expect(b.bracketR), e.key;
|
|
2250
2229
|
e.computed = !1;
|
|
2251
2230
|
}
|
|
2252
2231
|
return e.key = this.type === b.num || this.type === b.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never");
|
|
2253
|
-
},
|
|
2232
|
+
}, N.initFunction = function(e) {
|
|
2254
2233
|
e.id = null, this.options.ecmaVersion >= 6 && (e.generator = e.expression = !1), this.options.ecmaVersion >= 8 && (e.async = !1);
|
|
2255
|
-
},
|
|
2234
|
+
}, N.parseMethod = function(e, t, n) {
|
|
2256
2235
|
var r = this.startNode(), i = this.yieldPos, a = this.awaitPos, o = this.awaitIdentPos;
|
|
2257
2236
|
return this.initFunction(r), this.options.ecmaVersion >= 6 && (r.generator = e), this.options.ecmaVersion >= 8 && (r.async = !!t), this.yieldPos = 0, this.awaitPos = 0, this.awaitIdentPos = 0, this.enterScope(Ae(t, r.generator) | we | (n ? Te : 0)), this.expect(b.parenL), r.params = this.parseBindingList(b.parenR, !1, this.options.ecmaVersion >= 8), this.checkYieldAwaitInDefaultParams(), this.parseFunctionBody(r, !1, !0, !1), this.yieldPos = i, this.awaitPos = a, this.awaitIdentPos = o, this.finishNode(r, "FunctionExpression");
|
|
2258
|
-
},
|
|
2237
|
+
}, N.parseArrowExpression = function(e, t, n, r) {
|
|
2259
2238
|
var i = this.yieldPos, a = this.awaitPos, o = this.awaitIdentPos;
|
|
2260
2239
|
return this.enterScope(Ae(n, !1) | Se), this.initFunction(e), this.options.ecmaVersion >= 8 && (e.async = !!n), this.yieldPos = 0, this.awaitPos = 0, this.awaitIdentPos = 0, e.params = this.toAssignableList(t, !0), this.parseFunctionBody(e, !0, !1, r), this.yieldPos = i, this.awaitPos = a, this.awaitIdentPos = o, this.finishNode(e, "ArrowFunctionExpression");
|
|
2261
|
-
},
|
|
2240
|
+
}, N.parseFunctionBody = function(e, t, n, r) {
|
|
2262
2241
|
var i = t && this.type !== b.braceL, a = this.strict, o = !1;
|
|
2263
2242
|
if (i) e.body = this.parseMaybeAssign(r), e.expression = !0, this.checkParams(e, !1);
|
|
2264
2243
|
else {
|
|
@@ -2268,15 +2247,15 @@ P.parseNew = function() {
|
|
|
2268
2247
|
this.labels = [], o && (this.strict = !0), this.checkParams(e, !a && !o && !t && !n && this.isSimpleParamList(e.params)), this.strict && e.id && this.checkLValSimple(e.id, Fe), e.body = this.parseBlock(!1, void 0, o && !a), e.expression = !1, this.adaptDirectivePrologue(e.body.body), this.labels = c;
|
|
2269
2248
|
}
|
|
2270
2249
|
this.exitScope();
|
|
2271
|
-
},
|
|
2250
|
+
}, N.isSimpleParamList = function(e) {
|
|
2272
2251
|
for (var t = 0, n = e; t < n.length; t += 1) if (n[t].type !== "Identifier") return !1;
|
|
2273
2252
|
return !0;
|
|
2274
|
-
},
|
|
2253
|
+
}, N.checkParams = function(e, t) {
|
|
2275
2254
|
for (var n = Object.create(null), r = 0, i = e.params; r < i.length; r += 1) {
|
|
2276
2255
|
var a = i[r];
|
|
2277
2256
|
this.checkLValInnerPattern(a, Me, t ? null : n);
|
|
2278
2257
|
}
|
|
2279
|
-
},
|
|
2258
|
+
}, N.parseExprList = function(e, t, n, r) {
|
|
2280
2259
|
for (var i = [], a = !0; !this.eat(e);) {
|
|
2281
2260
|
if (a) a = !1;
|
|
2282
2261
|
else if (this.expect(b.comma), t && this.afterTrailingComma(e)) break;
|
|
@@ -2284,50 +2263,50 @@ P.parseNew = function() {
|
|
|
2284
2263
|
n && this.type === b.comma ? o = null : this.type === b.ellipsis ? (o = this.parseSpread(r), r && this.type === b.comma && r.trailingComma < 0 && (r.trailingComma = this.start)) : o = this.parseMaybeAssign(!1, r), i.push(o);
|
|
2285
2264
|
}
|
|
2286
2265
|
return i;
|
|
2287
|
-
},
|
|
2266
|
+
}, N.checkUnreserved = function(e) {
|
|
2288
2267
|
var t = e.start, n = e.end, r = e.name;
|
|
2289
2268
|
this.inGenerator && r === "yield" && this.raiseRecoverable(t, "Cannot use 'yield' as identifier inside a generator"), this.inAsync && r === "await" && this.raiseRecoverable(t, "Cannot use 'await' as identifier inside an async function"), !(this.currentThisScope().flags & ke) && r === "arguments" && this.raiseRecoverable(t, "Cannot use 'arguments' in class field initializer"), this.inClassStaticBlock && (r === "arguments" || r === "await") && this.raise(t, "Cannot use " + r + " in class static initialization block"), this.keywords.test(r) && this.raise(t, "Unexpected keyword '" + r + "'"), !(this.options.ecmaVersion < 6 && this.input.slice(t, n).indexOf("\\") !== -1) && (this.strict ? this.reservedWordsStrict : this.reservedWords).test(r) && (!this.inAsync && r === "await" && this.raiseRecoverable(t, "Cannot use keyword 'await' outside an async function"), this.raiseRecoverable(t, "The keyword '" + r + "' is reserved"));
|
|
2290
|
-
},
|
|
2269
|
+
}, N.parseIdent = function(e) {
|
|
2291
2270
|
var t = this.parseIdentNode();
|
|
2292
2271
|
return this.next(!!e), this.finishNode(t, "Identifier"), e || (this.checkUnreserved(t), t.name === "await" && !this.awaitIdentPos && (this.awaitIdentPos = t.start)), t;
|
|
2293
|
-
},
|
|
2272
|
+
}, N.parseIdentNode = function() {
|
|
2294
2273
|
var e = this.startNode();
|
|
2295
2274
|
return this.type === b.name ? e.name = this.value : this.type.keyword ? (e.name = this.type.keyword, (e.name === "class" || e.name === "function") && (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46) && this.context.pop(), this.type = b.name) : this.unexpected(), e;
|
|
2296
|
-
},
|
|
2275
|
+
}, N.parsePrivateIdent = function() {
|
|
2297
2276
|
var e = this.startNode();
|
|
2298
2277
|
return this.type === b.privateId ? e.name = this.value : this.unexpected(), this.next(), this.finishNode(e, "PrivateIdentifier"), this.options.checkPrivateFields && (this.privateNameStack.length === 0 ? this.raise(e.start, "Private field '#" + e.name + "' must be declared in an enclosing class") : this.privateNameStack[this.privateNameStack.length - 1].used.push(e)), e;
|
|
2299
|
-
},
|
|
2278
|
+
}, N.parseYield = function(e) {
|
|
2300
2279
|
this.yieldPos ||= this.start;
|
|
2301
2280
|
var t = this.startNode();
|
|
2302
2281
|
return this.next(), this.type === b.semi || this.canInsertSemicolon() || this.type !== b.star && !this.type.startsExpr ? (t.delegate = !1, t.argument = null) : (t.delegate = this.eat(b.star), t.argument = this.parseMaybeAssign(e)), this.finishNode(t, "YieldExpression");
|
|
2303
|
-
},
|
|
2282
|
+
}, N.parseAwait = function(e) {
|
|
2304
2283
|
this.awaitPos ||= this.start;
|
|
2305
2284
|
var t = this.startNode();
|
|
2306
2285
|
return this.next(), t.argument = this.parseMaybeUnary(null, !0, !1, e), this.finishNode(t, "AwaitExpression");
|
|
2307
2286
|
};
|
|
2308
|
-
var Xe =
|
|
2287
|
+
var Xe = E.prototype;
|
|
2309
2288
|
Xe.raise = function(e, t) {
|
|
2310
|
-
var n =
|
|
2289
|
+
var n = pe(this.input, e);
|
|
2311
2290
|
t += " (" + n.line + ":" + n.column + ")", this.sourceFile && (t += " in " + this.sourceFile);
|
|
2312
2291
|
var r = SyntaxError(t);
|
|
2313
2292
|
throw r.pos = e, r.loc = n, r.raisedAt = this.pos, r;
|
|
2314
2293
|
}, Xe.raiseRecoverable = Xe.raise, Xe.curPosition = function() {
|
|
2315
|
-
if (this.options.locations) return new
|
|
2294
|
+
if (this.options.locations) return new de(this.curLine, this.pos - this.lineStart);
|
|
2316
2295
|
};
|
|
2317
|
-
var
|
|
2296
|
+
var P = E.prototype, Ze = function(e) {
|
|
2318
2297
|
this.flags = e, this.var = [], this.lexical = [], this.functions = [];
|
|
2319
2298
|
};
|
|
2320
|
-
|
|
2299
|
+
P.enterScope = function(e) {
|
|
2321
2300
|
this.scopeStack.push(new Ze(e));
|
|
2322
|
-
},
|
|
2301
|
+
}, P.exitScope = function() {
|
|
2323
2302
|
this.scopeStack.pop();
|
|
2324
|
-
},
|
|
2325
|
-
return e.flags &
|
|
2326
|
-
},
|
|
2303
|
+
}, P.treatFunctionsAsVarInScope = function(e) {
|
|
2304
|
+
return e.flags & ye || !this.inModule && e.flags & ve;
|
|
2305
|
+
}, P.declareName = function(e, t, n) {
|
|
2327
2306
|
var r = !1;
|
|
2328
|
-
if (t ===
|
|
2307
|
+
if (t === T) {
|
|
2329
2308
|
var i = this.currentScope();
|
|
2330
|
-
r = i.lexical.indexOf(e) > -1 || i.functions.indexOf(e) > -1 || i.var.indexOf(e) > -1, i.lexical.push(e), this.inModule && i.flags &
|
|
2309
|
+
r = i.lexical.indexOf(e) > -1 || i.functions.indexOf(e) > -1 || i.var.indexOf(e) > -1, i.lexical.push(e), this.inModule && i.flags & ve && delete this.undefinedExports[e];
|
|
2331
2310
|
} else if (t === Pe) this.currentScope().lexical.push(e);
|
|
2332
2311
|
else if (t === Ne) {
|
|
2333
2312
|
var a = this.currentScope();
|
|
@@ -2338,27 +2317,27 @@ F.enterScope = function(e) {
|
|
|
2338
2317
|
r = !0;
|
|
2339
2318
|
break;
|
|
2340
2319
|
}
|
|
2341
|
-
if (s.var.push(e), this.inModule && s.flags &
|
|
2320
|
+
if (s.var.push(e), this.inModule && s.flags & ve && delete this.undefinedExports[e], s.flags & ke) break;
|
|
2342
2321
|
}
|
|
2343
2322
|
r && this.raiseRecoverable(n, "Identifier '" + e + "' has already been declared");
|
|
2344
|
-
},
|
|
2323
|
+
}, P.checkLocalExport = function(e) {
|
|
2345
2324
|
this.scopeStack[0].lexical.indexOf(e.name) === -1 && this.scopeStack[0].var.indexOf(e.name) === -1 && (this.undefinedExports[e.name] = e);
|
|
2346
|
-
},
|
|
2325
|
+
}, P.currentScope = function() {
|
|
2347
2326
|
return this.scopeStack[this.scopeStack.length - 1];
|
|
2348
|
-
},
|
|
2327
|
+
}, P.currentVarScope = function() {
|
|
2349
2328
|
for (var e = this.scopeStack.length - 1;; e--) {
|
|
2350
2329
|
var t = this.scopeStack[e];
|
|
2351
2330
|
if (t.flags & (ke | De | Ee)) return t;
|
|
2352
2331
|
}
|
|
2353
|
-
},
|
|
2332
|
+
}, P.currentThisScope = function() {
|
|
2354
2333
|
for (var e = this.scopeStack.length - 1;; e--) {
|
|
2355
2334
|
var t = this.scopeStack[e];
|
|
2356
2335
|
if (t.flags & (ke | De | Ee) && !(t.flags & Se)) return t;
|
|
2357
2336
|
}
|
|
2358
2337
|
};
|
|
2359
2338
|
var Qe = function(e, t, n) {
|
|
2360
|
-
this.type = "", this.start = t, this.end = 0, e.options.locations && (this.loc = new
|
|
2361
|
-
}, $e =
|
|
2339
|
+
this.type = "", this.start = t, this.end = 0, e.options.locations && (this.loc = new fe(e, n)), e.options.directSourceFile && (this.sourceFile = e.options.directSourceFile), e.options.ranges && (this.range = [t, 0]);
|
|
2340
|
+
}, $e = E.prototype;
|
|
2362
2341
|
$e.startNode = function() {
|
|
2363
2342
|
return new Qe(this, this.start, this.startLoc);
|
|
2364
2343
|
}, $e.startNodeAt = function(e, t) {
|
|
@@ -2420,7 +2399,7 @@ for (var vt = 0, yt = [
|
|
|
2420
2399
|
var bt = yt[vt];
|
|
2421
2400
|
_t(bt);
|
|
2422
2401
|
}
|
|
2423
|
-
var
|
|
2402
|
+
var F = E.prototype, xt = function(e, t) {
|
|
2424
2403
|
this.parent = e, this.base = t || this;
|
|
2425
2404
|
};
|
|
2426
2405
|
xt.prototype.separatedFrom = function(e) {
|
|
@@ -2429,15 +2408,15 @@ xt.prototype.separatedFrom = function(e) {
|
|
|
2429
2408
|
}, xt.prototype.sibling = function() {
|
|
2430
2409
|
return new xt(this.parent, this.base);
|
|
2431
2410
|
};
|
|
2432
|
-
var
|
|
2411
|
+
var I = function(e) {
|
|
2433
2412
|
this.parser = e, this.validFlags = "gim" + (e.options.ecmaVersion >= 6 ? "uy" : "") + (e.options.ecmaVersion >= 9 ? "s" : "") + (e.options.ecmaVersion >= 13 ? "d" : "") + (e.options.ecmaVersion >= 15 ? "v" : ""), this.unicodeProperties = gt[e.options.ecmaVersion >= 14 ? 14 : e.options.ecmaVersion], this.source = "", this.flags = "", this.start = 0, this.switchU = !1, this.switchV = !1, this.switchN = !1, this.pos = 0, this.lastIntValue = 0, this.lastStringValue = "", this.lastAssertionIsQuantifiable = !1, this.numCapturingParens = 0, this.maxBackReference = 0, this.groupNames = Object.create(null), this.backReferenceNames = [], this.branchID = null;
|
|
2434
2413
|
};
|
|
2435
|
-
|
|
2414
|
+
I.prototype.reset = function(e, t, n) {
|
|
2436
2415
|
var r = n.indexOf("v") !== -1, i = n.indexOf("u") !== -1;
|
|
2437
2416
|
this.start = e | 0, this.source = t + "", this.flags = n, r && this.parser.options.ecmaVersion >= 15 ? (this.switchU = !0, this.switchV = !0, this.switchN = !0) : (this.switchU = i && this.parser.options.ecmaVersion >= 6, this.switchV = !1, this.switchN = i && this.parser.options.ecmaVersion >= 9);
|
|
2438
|
-
},
|
|
2417
|
+
}, I.prototype.raise = function(e) {
|
|
2439
2418
|
this.parser.raiseRecoverable(this.start, "Invalid regular expression: /" + this.source + "/: " + e);
|
|
2440
|
-
},
|
|
2419
|
+
}, I.prototype.at = function(e, t) {
|
|
2441
2420
|
t === void 0 && (t = !1);
|
|
2442
2421
|
var n = this.source, r = n.length;
|
|
2443
2422
|
if (e >= r) return -1;
|
|
@@ -2445,21 +2424,21 @@ L.prototype.reset = function(e, t, n) {
|
|
|
2445
2424
|
if (!(t || this.switchU) || i <= 55295 || i >= 57344 || e + 1 >= r) return i;
|
|
2446
2425
|
var a = n.charCodeAt(e + 1);
|
|
2447
2426
|
return a >= 56320 && a <= 57343 ? (i << 10) + a - 56613888 : i;
|
|
2448
|
-
},
|
|
2427
|
+
}, I.prototype.nextIndex = function(e, t) {
|
|
2449
2428
|
t === void 0 && (t = !1);
|
|
2450
2429
|
var n = this.source, r = n.length;
|
|
2451
2430
|
if (e >= r) return r;
|
|
2452
2431
|
var i = n.charCodeAt(e), a;
|
|
2453
2432
|
return !(t || this.switchU) || i <= 55295 || i >= 57344 || e + 1 >= r || (a = n.charCodeAt(e + 1)) < 56320 || a > 57343 ? e + 1 : e + 2;
|
|
2454
|
-
},
|
|
2433
|
+
}, I.prototype.current = function(e) {
|
|
2455
2434
|
return e === void 0 && (e = !1), this.at(this.pos, e);
|
|
2456
|
-
},
|
|
2435
|
+
}, I.prototype.lookahead = function(e) {
|
|
2457
2436
|
return e === void 0 && (e = !1), this.at(this.nextIndex(this.pos, e), e);
|
|
2458
|
-
},
|
|
2437
|
+
}, I.prototype.advance = function(e) {
|
|
2459
2438
|
e === void 0 && (e = !1), this.pos = this.nextIndex(this.pos, e);
|
|
2460
|
-
},
|
|
2439
|
+
}, I.prototype.eat = function(e, t) {
|
|
2461
2440
|
return t === void 0 && (t = !1), this.current(t) === e ? (this.advance(t), !0) : !1;
|
|
2462
|
-
},
|
|
2441
|
+
}, I.prototype.eatChars = function(e, t) {
|
|
2463
2442
|
t === void 0 && (t = !1);
|
|
2464
2443
|
for (var n = this.pos, r = 0, i = e; r < i.length; r += 1) {
|
|
2465
2444
|
var a = i[r], o = this.at(n, t);
|
|
@@ -2467,7 +2446,7 @@ L.prototype.reset = function(e, t, n) {
|
|
|
2467
2446
|
n = this.nextIndex(n, t);
|
|
2468
2447
|
}
|
|
2469
2448
|
return this.pos = n, !0;
|
|
2470
|
-
},
|
|
2449
|
+
}, F.validateRegExpFlags = function(e) {
|
|
2471
2450
|
for (var t = e.validFlags, n = e.flags, r = !1, i = !1, a = 0; a < n.length; a++) {
|
|
2472
2451
|
var o = n.charAt(a);
|
|
2473
2452
|
t.indexOf(o) === -1 && this.raise(e.start, "Invalid regular expression flag"), n.indexOf(o, a + 1) > -1 && this.raise(e.start, "Duplicate regular expression flag"), o === "u" && (r = !0), o === "v" && (i = !0);
|
|
@@ -2478,23 +2457,23 @@ function St(e) {
|
|
|
2478
2457
|
for (var t in e) return !0;
|
|
2479
2458
|
return !1;
|
|
2480
2459
|
}
|
|
2481
|
-
|
|
2460
|
+
F.validateRegExpPattern = function(e) {
|
|
2482
2461
|
this.regexp_pattern(e), !e.switchN && this.options.ecmaVersion >= 9 && St(e.groupNames) && (e.switchN = !0, this.regexp_pattern(e));
|
|
2483
|
-
},
|
|
2462
|
+
}, F.regexp_pattern = function(e) {
|
|
2484
2463
|
e.pos = 0, e.lastIntValue = 0, e.lastStringValue = "", e.lastAssertionIsQuantifiable = !1, e.numCapturingParens = 0, e.maxBackReference = 0, e.groupNames = Object.create(null), e.backReferenceNames.length = 0, e.branchID = null, this.regexp_disjunction(e), e.pos !== e.source.length && (e.eat(41) && e.raise("Unmatched ')'"), (e.eat(93) || e.eat(125)) && e.raise("Lone quantifier brackets")), e.maxBackReference > e.numCapturingParens && e.raise("Invalid escape");
|
|
2485
2464
|
for (var t = 0, n = e.backReferenceNames; t < n.length; t += 1) {
|
|
2486
2465
|
var r = n[t];
|
|
2487
2466
|
e.groupNames[r] || e.raise("Invalid named capture referenced");
|
|
2488
2467
|
}
|
|
2489
|
-
},
|
|
2468
|
+
}, F.regexp_disjunction = function(e) {
|
|
2490
2469
|
var t = this.options.ecmaVersion >= 16;
|
|
2491
2470
|
for (t && (e.branchID = new xt(e.branchID, null)), this.regexp_alternative(e); e.eat(124);) t && (e.branchID = e.branchID.sibling()), this.regexp_alternative(e);
|
|
2492
2471
|
t && (e.branchID = e.branchID.parent), this.regexp_eatQuantifier(e, !0) && e.raise("Nothing to repeat"), e.eat(123) && e.raise("Lone quantifier brackets");
|
|
2493
|
-
},
|
|
2472
|
+
}, F.regexp_alternative = function(e) {
|
|
2494
2473
|
for (; e.pos < e.source.length && this.regexp_eatTerm(e););
|
|
2495
|
-
},
|
|
2474
|
+
}, F.regexp_eatTerm = function(e) {
|
|
2496
2475
|
return this.regexp_eatAssertion(e) ? (e.lastAssertionIsQuantifiable && this.regexp_eatQuantifier(e) && e.switchU && e.raise("Invalid quantifier"), !0) : (e.switchU ? this.regexp_eatAtom(e) : this.regexp_eatExtendedAtom(e)) ? (this.regexp_eatQuantifier(e), !0) : !1;
|
|
2497
|
-
},
|
|
2476
|
+
}, F.regexp_eatAssertion = function(e) {
|
|
2498
2477
|
var t = e.pos;
|
|
2499
2478
|
if (e.lastAssertionIsQuantifiable = !1, e.eat(94) || e.eat(36)) return !0;
|
|
2500
2479
|
if (e.eat(92)) {
|
|
@@ -2506,11 +2485,11 @@ I.validateRegExpPattern = function(e) {
|
|
|
2506
2485
|
if (this.options.ecmaVersion >= 9 && (n = e.eat(60)), e.eat(61) || e.eat(33)) return this.regexp_disjunction(e), e.eat(41) || e.raise("Unterminated group"), e.lastAssertionIsQuantifiable = !n, !0;
|
|
2507
2486
|
}
|
|
2508
2487
|
return e.pos = t, !1;
|
|
2509
|
-
},
|
|
2488
|
+
}, F.regexp_eatQuantifier = function(e, t) {
|
|
2510
2489
|
return t === void 0 && (t = !1), this.regexp_eatQuantifierPrefix(e, t) ? (e.eat(63), !0) : !1;
|
|
2511
|
-
},
|
|
2490
|
+
}, F.regexp_eatQuantifierPrefix = function(e, t) {
|
|
2512
2491
|
return e.eat(42) || e.eat(43) || e.eat(63) || this.regexp_eatBracedQuantifier(e, t);
|
|
2513
|
-
},
|
|
2492
|
+
}, F.regexp_eatBracedQuantifier = function(e, t) {
|
|
2514
2493
|
var n = e.pos;
|
|
2515
2494
|
if (e.eat(123)) {
|
|
2516
2495
|
var r = 0, i = -1;
|
|
@@ -2518,16 +2497,16 @@ I.validateRegExpPattern = function(e) {
|
|
|
2518
2497
|
e.switchU && !t && e.raise("Incomplete quantifier"), e.pos = n;
|
|
2519
2498
|
}
|
|
2520
2499
|
return !1;
|
|
2521
|
-
},
|
|
2500
|
+
}, F.regexp_eatAtom = function(e) {
|
|
2522
2501
|
return this.regexp_eatPatternCharacters(e) || e.eat(46) || this.regexp_eatReverseSolidusAtomEscape(e) || this.regexp_eatCharacterClass(e) || this.regexp_eatUncapturingGroup(e) || this.regexp_eatCapturingGroup(e);
|
|
2523
|
-
},
|
|
2502
|
+
}, F.regexp_eatReverseSolidusAtomEscape = function(e) {
|
|
2524
2503
|
var t = e.pos;
|
|
2525
2504
|
if (e.eat(92)) {
|
|
2526
2505
|
if (this.regexp_eatAtomEscape(e)) return !0;
|
|
2527
2506
|
e.pos = t;
|
|
2528
2507
|
}
|
|
2529
2508
|
return !1;
|
|
2530
|
-
},
|
|
2509
|
+
}, F.regexp_eatUncapturingGroup = function(e) {
|
|
2531
2510
|
var t = e.pos;
|
|
2532
2511
|
if (e.eat(40)) {
|
|
2533
2512
|
if (e.eat(63)) {
|
|
@@ -2556,37 +2535,37 @@ I.validateRegExpPattern = function(e) {
|
|
|
2556
2535
|
e.pos = t;
|
|
2557
2536
|
}
|
|
2558
2537
|
return !1;
|
|
2559
|
-
},
|
|
2538
|
+
}, F.regexp_eatCapturingGroup = function(e) {
|
|
2560
2539
|
if (e.eat(40)) {
|
|
2561
2540
|
if (this.options.ecmaVersion >= 9 ? this.regexp_groupSpecifier(e) : e.current() === 63 && e.raise("Invalid group"), this.regexp_disjunction(e), e.eat(41)) return e.numCapturingParens += 1, !0;
|
|
2562
2541
|
e.raise("Unterminated group");
|
|
2563
2542
|
}
|
|
2564
2543
|
return !1;
|
|
2565
|
-
},
|
|
2544
|
+
}, F.regexp_eatModifiers = function(e) {
|
|
2566
2545
|
for (var t = "", n = 0; (n = e.current()) !== -1 && Ct(n);) t += w(n), e.advance();
|
|
2567
2546
|
return t;
|
|
2568
2547
|
};
|
|
2569
2548
|
function Ct(e) {
|
|
2570
2549
|
return e === 105 || e === 109 || e === 115;
|
|
2571
2550
|
}
|
|
2572
|
-
|
|
2551
|
+
F.regexp_eatExtendedAtom = function(e) {
|
|
2573
2552
|
return e.eat(46) || this.regexp_eatReverseSolidusAtomEscape(e) || this.regexp_eatCharacterClass(e) || this.regexp_eatUncapturingGroup(e) || this.regexp_eatCapturingGroup(e) || this.regexp_eatInvalidBracedQuantifier(e) || this.regexp_eatExtendedPatternCharacter(e);
|
|
2574
|
-
},
|
|
2553
|
+
}, F.regexp_eatInvalidBracedQuantifier = function(e) {
|
|
2575
2554
|
return this.regexp_eatBracedQuantifier(e, !0) && e.raise("Nothing to repeat"), !1;
|
|
2576
|
-
},
|
|
2555
|
+
}, F.regexp_eatSyntaxCharacter = function(e) {
|
|
2577
2556
|
var t = e.current();
|
|
2578
2557
|
return wt(t) ? (e.lastIntValue = t, e.advance(), !0) : !1;
|
|
2579
2558
|
};
|
|
2580
2559
|
function wt(e) {
|
|
2581
2560
|
return e === 36 || e >= 40 && e <= 43 || e === 46 || e === 63 || e >= 91 && e <= 94 || e >= 123 && e <= 125;
|
|
2582
2561
|
}
|
|
2583
|
-
|
|
2562
|
+
F.regexp_eatPatternCharacters = function(e) {
|
|
2584
2563
|
for (var t = e.pos, n = 0; (n = e.current()) !== -1 && !wt(n);) e.advance();
|
|
2585
2564
|
return e.pos !== t;
|
|
2586
|
-
},
|
|
2565
|
+
}, F.regexp_eatExtendedPatternCharacter = function(e) {
|
|
2587
2566
|
var t = e.current();
|
|
2588
2567
|
return t !== -1 && t !== 36 && !(t >= 40 && t <= 43) && t !== 46 && t !== 63 && t !== 91 && t !== 94 && t !== 124 ? (e.advance(), !0) : !1;
|
|
2589
|
-
},
|
|
2568
|
+
}, F.regexp_groupSpecifier = function(e) {
|
|
2590
2569
|
if (e.eat(63)) {
|
|
2591
2570
|
this.regexp_eatGroupName(e) || e.raise("Invalid group");
|
|
2592
2571
|
var t = this.options.ecmaVersion >= 16, n = e.groupNames[e.lastStringValue];
|
|
@@ -2594,35 +2573,35 @@ I.regexp_eatPatternCharacters = function(e) {
|
|
|
2594
2573
|
else e.raise("Duplicate capture group name");
|
|
2595
2574
|
t ? (n || (e.groupNames[e.lastStringValue] = [])).push(e.branchID) : e.groupNames[e.lastStringValue] = !0;
|
|
2596
2575
|
}
|
|
2597
|
-
},
|
|
2576
|
+
}, F.regexp_eatGroupName = function(e) {
|
|
2598
2577
|
if (e.lastStringValue = "", e.eat(60)) {
|
|
2599
2578
|
if (this.regexp_eatRegExpIdentifierName(e) && e.eat(62)) return !0;
|
|
2600
2579
|
e.raise("Invalid capture group name");
|
|
2601
2580
|
}
|
|
2602
2581
|
return !1;
|
|
2603
|
-
},
|
|
2582
|
+
}, F.regexp_eatRegExpIdentifierName = function(e) {
|
|
2604
2583
|
if (e.lastStringValue = "", this.regexp_eatRegExpIdentifierStart(e)) {
|
|
2605
2584
|
for (e.lastStringValue += w(e.lastIntValue); this.regexp_eatRegExpIdentifierPart(e);) e.lastStringValue += w(e.lastIntValue);
|
|
2606
2585
|
return !0;
|
|
2607
2586
|
}
|
|
2608
2587
|
return !1;
|
|
2609
|
-
},
|
|
2588
|
+
}, F.regexp_eatRegExpIdentifierStart = function(e) {
|
|
2610
2589
|
var t = e.pos, n = this.options.ecmaVersion >= 11, r = e.current(n);
|
|
2611
2590
|
return e.advance(n), r === 92 && this.regexp_eatRegExpUnicodeEscapeSequence(e, n) && (r = e.lastIntValue), Tt(r) ? (e.lastIntValue = r, !0) : (e.pos = t, !1);
|
|
2612
2591
|
};
|
|
2613
2592
|
function Tt(e) {
|
|
2614
|
-
return
|
|
2593
|
+
return f(e, !0) || e === 36 || e === 95;
|
|
2615
2594
|
}
|
|
2616
|
-
|
|
2595
|
+
F.regexp_eatRegExpIdentifierPart = function(e) {
|
|
2617
2596
|
var t = e.pos, n = this.options.ecmaVersion >= 11, r = e.current(n);
|
|
2618
2597
|
return e.advance(n), r === 92 && this.regexp_eatRegExpUnicodeEscapeSequence(e, n) && (r = e.lastIntValue), Et(r) ? (e.lastIntValue = r, !0) : (e.pos = t, !1);
|
|
2619
2598
|
};
|
|
2620
2599
|
function Et(e) {
|
|
2621
|
-
return
|
|
2600
|
+
return p(e, !0) || e === 36 || e === 95 || e === 8204 || e === 8205;
|
|
2622
2601
|
}
|
|
2623
|
-
|
|
2602
|
+
F.regexp_eatAtomEscape = function(e) {
|
|
2624
2603
|
return this.regexp_eatBackReference(e) || this.regexp_eatCharacterClassEscape(e) || this.regexp_eatCharacterEscape(e) || e.switchN && this.regexp_eatKGroupName(e) ? !0 : (e.switchU && (e.current() === 99 && e.raise("Invalid unicode escape"), e.raise("Invalid escape")), !1);
|
|
2625
|
-
},
|
|
2604
|
+
}, F.regexp_eatBackReference = function(e) {
|
|
2626
2605
|
var t = e.pos;
|
|
2627
2606
|
if (this.regexp_eatDecimalEscape(e)) {
|
|
2628
2607
|
var n = e.lastIntValue;
|
|
@@ -2631,34 +2610,34 @@ I.regexp_eatAtomEscape = function(e) {
|
|
|
2631
2610
|
e.pos = t;
|
|
2632
2611
|
}
|
|
2633
2612
|
return !1;
|
|
2634
|
-
},
|
|
2613
|
+
}, F.regexp_eatKGroupName = function(e) {
|
|
2635
2614
|
if (e.eat(107)) {
|
|
2636
2615
|
if (this.regexp_eatGroupName(e)) return e.backReferenceNames.push(e.lastStringValue), !0;
|
|
2637
2616
|
e.raise("Invalid named reference");
|
|
2638
2617
|
}
|
|
2639
2618
|
return !1;
|
|
2640
|
-
},
|
|
2619
|
+
}, F.regexp_eatCharacterEscape = function(e) {
|
|
2641
2620
|
return this.regexp_eatControlEscape(e) || this.regexp_eatCControlLetter(e) || this.regexp_eatZero(e) || this.regexp_eatHexEscapeSequence(e) || this.regexp_eatRegExpUnicodeEscapeSequence(e, !1) || !e.switchU && this.regexp_eatLegacyOctalEscapeSequence(e) || this.regexp_eatIdentityEscape(e);
|
|
2642
|
-
},
|
|
2621
|
+
}, F.regexp_eatCControlLetter = function(e) {
|
|
2643
2622
|
var t = e.pos;
|
|
2644
2623
|
if (e.eat(99)) {
|
|
2645
2624
|
if (this.regexp_eatControlLetter(e)) return !0;
|
|
2646
2625
|
e.pos = t;
|
|
2647
2626
|
}
|
|
2648
2627
|
return !1;
|
|
2649
|
-
},
|
|
2628
|
+
}, F.regexp_eatZero = function(e) {
|
|
2650
2629
|
return e.current() === 48 && !It(e.lookahead()) ? (e.lastIntValue = 0, e.advance(), !0) : !1;
|
|
2651
|
-
},
|
|
2630
|
+
}, F.regexp_eatControlEscape = function(e) {
|
|
2652
2631
|
var t = e.current();
|
|
2653
2632
|
return t === 116 ? (e.lastIntValue = 9, e.advance(), !0) : t === 110 ? (e.lastIntValue = 10, e.advance(), !0) : t === 118 ? (e.lastIntValue = 11, e.advance(), !0) : t === 102 ? (e.lastIntValue = 12, e.advance(), !0) : t === 114 ? (e.lastIntValue = 13, e.advance(), !0) : !1;
|
|
2654
|
-
},
|
|
2633
|
+
}, F.regexp_eatControlLetter = function(e) {
|
|
2655
2634
|
var t = e.current();
|
|
2656
2635
|
return Dt(t) ? (e.lastIntValue = t % 32, e.advance(), !0) : !1;
|
|
2657
2636
|
};
|
|
2658
2637
|
function Dt(e) {
|
|
2659
2638
|
return e >= 65 && e <= 90 || e >= 97 && e <= 122;
|
|
2660
2639
|
}
|
|
2661
|
-
|
|
2640
|
+
F.regexp_eatRegExpUnicodeEscapeSequence = function(e, t) {
|
|
2662
2641
|
t === void 0 && (t = !1);
|
|
2663
2642
|
var n = e.pos, r = t || e.switchU;
|
|
2664
2643
|
if (e.eat(117)) {
|
|
@@ -2682,11 +2661,11 @@ I.regexp_eatRegExpUnicodeEscapeSequence = function(e, t) {
|
|
|
2682
2661
|
function Ot(e) {
|
|
2683
2662
|
return e >= 0 && e <= 1114111;
|
|
2684
2663
|
}
|
|
2685
|
-
|
|
2664
|
+
F.regexp_eatIdentityEscape = function(e) {
|
|
2686
2665
|
if (e.switchU) return this.regexp_eatSyntaxCharacter(e) ? !0 : e.eat(47) ? (e.lastIntValue = 47, !0) : !1;
|
|
2687
2666
|
var t = e.current();
|
|
2688
2667
|
return t !== 99 && (!e.switchN || t !== 107) ? (e.lastIntValue = t, e.advance(), !0) : !1;
|
|
2689
|
-
},
|
|
2668
|
+
}, F.regexp_eatDecimalEscape = function(e) {
|
|
2690
2669
|
e.lastIntValue = 0;
|
|
2691
2670
|
var t = e.current();
|
|
2692
2671
|
if (t >= 49 && t <= 57) {
|
|
@@ -2697,15 +2676,15 @@ I.regexp_eatIdentityEscape = function(e) {
|
|
|
2697
2676
|
}
|
|
2698
2677
|
return !1;
|
|
2699
2678
|
};
|
|
2700
|
-
var kt = 0,
|
|
2701
|
-
|
|
2679
|
+
var kt = 0, L = 1, R = 2;
|
|
2680
|
+
F.regexp_eatCharacterClassEscape = function(e) {
|
|
2702
2681
|
var t = e.current();
|
|
2703
|
-
if (At(t)) return e.lastIntValue = -1, e.advance(),
|
|
2682
|
+
if (At(t)) return e.lastIntValue = -1, e.advance(), L;
|
|
2704
2683
|
var n = !1;
|
|
2705
2684
|
if (e.switchU && this.options.ecmaVersion >= 9 && ((n = t === 80) || t === 112)) {
|
|
2706
2685
|
e.lastIntValue = -1, e.advance();
|
|
2707
2686
|
var r;
|
|
2708
|
-
if (e.eat(123) && (r = this.regexp_eatUnicodePropertyValueExpression(e)) && e.eat(125)) return n && r ===
|
|
2687
|
+
if (e.eat(123) && (r = this.regexp_eatUnicodePropertyValueExpression(e)) && e.eat(125)) return n && r === R && e.raise("Invalid property name"), r;
|
|
2709
2688
|
e.raise("Invalid property name");
|
|
2710
2689
|
}
|
|
2711
2690
|
return kt;
|
|
@@ -2713,13 +2692,13 @@ I.regexp_eatCharacterClassEscape = function(e) {
|
|
|
2713
2692
|
function At(e) {
|
|
2714
2693
|
return e === 100 || e === 68 || e === 115 || e === 83 || e === 119 || e === 87;
|
|
2715
2694
|
}
|
|
2716
|
-
|
|
2695
|
+
F.regexp_eatUnicodePropertyValueExpression = function(e) {
|
|
2717
2696
|
var t = e.pos;
|
|
2718
2697
|
if (this.regexp_eatUnicodePropertyName(e) && e.eat(61)) {
|
|
2719
2698
|
var n = e.lastStringValue;
|
|
2720
2699
|
if (this.regexp_eatUnicodePropertyValue(e)) {
|
|
2721
2700
|
var r = e.lastStringValue;
|
|
2722
|
-
return this.regexp_validateUnicodePropertyNameAndValue(e, n, r),
|
|
2701
|
+
return this.regexp_validateUnicodePropertyNameAndValue(e, n, r), L;
|
|
2723
2702
|
}
|
|
2724
2703
|
}
|
|
2725
2704
|
if (e.pos = t, this.regexp_eatLoneUnicodePropertyNameOrValue(e)) {
|
|
@@ -2727,13 +2706,13 @@ I.regexp_eatUnicodePropertyValueExpression = function(e) {
|
|
|
2727
2706
|
return this.regexp_validateUnicodePropertyNameOrValue(e, i);
|
|
2728
2707
|
}
|
|
2729
2708
|
return kt;
|
|
2730
|
-
},
|
|
2731
|
-
|
|
2732
|
-
},
|
|
2733
|
-
if (e.unicodeProperties.binary.test(t)) return
|
|
2734
|
-
if (e.switchV && e.unicodeProperties.binaryOfStrings.test(t)) return
|
|
2709
|
+
}, F.regexp_validateUnicodePropertyNameAndValue = function(e, t, n) {
|
|
2710
|
+
se(e.unicodeProperties.nonBinary, t) || e.raise("Invalid property name"), e.unicodeProperties.nonBinary[t].test(n) || e.raise("Invalid property value");
|
|
2711
|
+
}, F.regexp_validateUnicodePropertyNameOrValue = function(e, t) {
|
|
2712
|
+
if (e.unicodeProperties.binary.test(t)) return L;
|
|
2713
|
+
if (e.switchV && e.unicodeProperties.binaryOfStrings.test(t)) return R;
|
|
2735
2714
|
e.raise("Invalid property name");
|
|
2736
|
-
},
|
|
2715
|
+
}, F.regexp_eatUnicodePropertyName = function(e) {
|
|
2737
2716
|
var t = 0;
|
|
2738
2717
|
for (e.lastStringValue = ""; jt(t = e.current());) e.lastStringValue += w(t), e.advance();
|
|
2739
2718
|
return e.lastStringValue !== "";
|
|
@@ -2741,7 +2720,7 @@ I.regexp_eatUnicodePropertyValueExpression = function(e) {
|
|
|
2741
2720
|
function jt(e) {
|
|
2742
2721
|
return Dt(e) || e === 95;
|
|
2743
2722
|
}
|
|
2744
|
-
|
|
2723
|
+
F.regexp_eatUnicodePropertyValue = function(e) {
|
|
2745
2724
|
var t = 0;
|
|
2746
2725
|
for (e.lastStringValue = ""; Mt(t = e.current());) e.lastStringValue += w(t), e.advance();
|
|
2747
2726
|
return e.lastStringValue !== "";
|
|
@@ -2749,17 +2728,17 @@ I.regexp_eatUnicodePropertyValue = function(e) {
|
|
|
2749
2728
|
function Mt(e) {
|
|
2750
2729
|
return jt(e) || It(e);
|
|
2751
2730
|
}
|
|
2752
|
-
|
|
2731
|
+
F.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
2753
2732
|
return this.regexp_eatUnicodePropertyValue(e);
|
|
2754
|
-
},
|
|
2733
|
+
}, F.regexp_eatCharacterClass = function(e) {
|
|
2755
2734
|
if (e.eat(91)) {
|
|
2756
2735
|
var t = e.eat(94), n = this.regexp_classContents(e);
|
|
2757
|
-
return e.eat(93) || e.raise("Unterminated character class"), t && n ===
|
|
2736
|
+
return e.eat(93) || e.raise("Unterminated character class"), t && n === R && e.raise("Negated character class may contain strings"), !0;
|
|
2758
2737
|
}
|
|
2759
2738
|
return !1;
|
|
2760
|
-
},
|
|
2761
|
-
return e.current() === 93 ?
|
|
2762
|
-
},
|
|
2739
|
+
}, F.regexp_classContents = function(e) {
|
|
2740
|
+
return e.current() === 93 ? L : e.switchV ? this.regexp_classSetExpression(e) : (this.regexp_nonEmptyClassRanges(e), L);
|
|
2741
|
+
}, F.regexp_nonEmptyClassRanges = function(e) {
|
|
2763
2742
|
for (; this.regexp_eatClassAtom(e);) {
|
|
2764
2743
|
var t = e.lastIntValue;
|
|
2765
2744
|
if (e.eat(45) && this.regexp_eatClassAtom(e)) {
|
|
@@ -2767,7 +2746,7 @@ I.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
|
2767
2746
|
e.switchU && (t === -1 || n === -1) && e.raise("Invalid character class"), t !== -1 && n !== -1 && t > n && e.raise("Range out of order in character class");
|
|
2768
2747
|
}
|
|
2769
2748
|
}
|
|
2770
|
-
},
|
|
2749
|
+
}, F.regexp_eatClassAtom = function(e) {
|
|
2771
2750
|
var t = e.pos;
|
|
2772
2751
|
if (e.eat(92)) {
|
|
2773
2752
|
if (this.regexp_eatClassEscape(e)) return !0;
|
|
@@ -2779,7 +2758,7 @@ I.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
|
2779
2758
|
}
|
|
2780
2759
|
var r = e.current();
|
|
2781
2760
|
return r === 93 ? !1 : (e.lastIntValue = r, e.advance(), !0);
|
|
2782
|
-
},
|
|
2761
|
+
}, F.regexp_eatClassEscape = function(e) {
|
|
2783
2762
|
var t = e.pos;
|
|
2784
2763
|
if (e.eat(98)) return e.lastIntValue = 8, !0;
|
|
2785
2764
|
if (e.switchU && e.eat(45)) return e.lastIntValue = 45, !0;
|
|
@@ -2788,13 +2767,13 @@ I.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
|
2788
2767
|
e.pos = t;
|
|
2789
2768
|
}
|
|
2790
2769
|
return this.regexp_eatCharacterClassEscape(e) || this.regexp_eatCharacterEscape(e);
|
|
2791
|
-
},
|
|
2792
|
-
var t =
|
|
2770
|
+
}, F.regexp_classSetExpression = function(e) {
|
|
2771
|
+
var t = L, n;
|
|
2793
2772
|
if (!this.regexp_eatClassSetRange(e)) if (n = this.regexp_eatClassSetOperand(e)) {
|
|
2794
|
-
n ===
|
|
2773
|
+
n === R && (t = R);
|
|
2795
2774
|
for (var r = e.pos; e.eatChars([38, 38]);) {
|
|
2796
2775
|
if (e.current() !== 38 && (n = this.regexp_eatClassSetOperand(e))) {
|
|
2797
|
-
n !==
|
|
2776
|
+
n !== R && (t = L);
|
|
2798
2777
|
continue;
|
|
2799
2778
|
}
|
|
2800
2779
|
e.raise("Invalid character in character class");
|
|
@@ -2805,9 +2784,9 @@ I.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
|
2805
2784
|
} else e.raise("Invalid character in character class");
|
|
2806
2785
|
for (;;) if (!this.regexp_eatClassSetRange(e)) {
|
|
2807
2786
|
if (n = this.regexp_eatClassSetOperand(e), !n) return t;
|
|
2808
|
-
n ===
|
|
2787
|
+
n === R && (t = R);
|
|
2809
2788
|
}
|
|
2810
|
-
},
|
|
2789
|
+
}, F.regexp_eatClassSetRange = function(e) {
|
|
2811
2790
|
var t = e.pos;
|
|
2812
2791
|
if (this.regexp_eatClassSetCharacter(e)) {
|
|
2813
2792
|
var n = e.lastIntValue;
|
|
@@ -2818,13 +2797,13 @@ I.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
|
2818
2797
|
e.pos = t;
|
|
2819
2798
|
}
|
|
2820
2799
|
return !1;
|
|
2821
|
-
},
|
|
2822
|
-
return this.regexp_eatClassSetCharacter(e) ?
|
|
2823
|
-
},
|
|
2800
|
+
}, F.regexp_eatClassSetOperand = function(e) {
|
|
2801
|
+
return this.regexp_eatClassSetCharacter(e) ? L : this.regexp_eatClassStringDisjunction(e) || this.regexp_eatNestedClass(e);
|
|
2802
|
+
}, F.regexp_eatNestedClass = function(e) {
|
|
2824
2803
|
var t = e.pos;
|
|
2825
2804
|
if (e.eat(91)) {
|
|
2826
2805
|
var n = e.eat(94), r = this.regexp_classContents(e);
|
|
2827
|
-
if (e.eat(93)) return n && r ===
|
|
2806
|
+
if (e.eat(93)) return n && r === R && e.raise("Negated character class may contain strings"), r;
|
|
2828
2807
|
e.pos = t;
|
|
2829
2808
|
}
|
|
2830
2809
|
if (e.eat(92)) {
|
|
@@ -2833,7 +2812,7 @@ I.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
|
2833
2812
|
e.pos = t;
|
|
2834
2813
|
}
|
|
2835
2814
|
return null;
|
|
2836
|
-
},
|
|
2815
|
+
}, F.regexp_eatClassStringDisjunction = function(e) {
|
|
2837
2816
|
var t = e.pos;
|
|
2838
2817
|
if (e.eatChars([92, 113])) {
|
|
2839
2818
|
if (e.eat(123)) {
|
|
@@ -2843,13 +2822,13 @@ I.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
|
2843
2822
|
e.pos = t;
|
|
2844
2823
|
}
|
|
2845
2824
|
return null;
|
|
2846
|
-
},
|
|
2847
|
-
for (var t = this.regexp_classString(e); e.eat(124);) this.regexp_classString(e) ===
|
|
2825
|
+
}, F.regexp_classStringDisjunctionContents = function(e) {
|
|
2826
|
+
for (var t = this.regexp_classString(e); e.eat(124);) this.regexp_classString(e) === R && (t = R);
|
|
2848
2827
|
return t;
|
|
2849
|
-
},
|
|
2828
|
+
}, F.regexp_classString = function(e) {
|
|
2850
2829
|
for (var t = 0; this.regexp_eatClassSetCharacter(e);) t++;
|
|
2851
|
-
return t === 1 ?
|
|
2852
|
-
},
|
|
2830
|
+
return t === 1 ? L : R;
|
|
2831
|
+
}, F.regexp_eatClassSetCharacter = function(e) {
|
|
2853
2832
|
var t = e.pos;
|
|
2854
2833
|
if (e.eat(92)) return this.regexp_eatCharacterEscape(e) || this.regexp_eatClassSetReservedPunctuator(e) ? !0 : e.eat(98) ? (e.lastIntValue = 8, !0) : (e.pos = t, !1);
|
|
2855
2834
|
var n = e.current();
|
|
@@ -2861,24 +2840,24 @@ function Nt(e) {
|
|
|
2861
2840
|
function Pt(e) {
|
|
2862
2841
|
return e === 40 || e === 41 || e === 45 || e === 47 || e >= 91 && e <= 93 || e >= 123 && e <= 125;
|
|
2863
2842
|
}
|
|
2864
|
-
|
|
2843
|
+
F.regexp_eatClassSetReservedPunctuator = function(e) {
|
|
2865
2844
|
var t = e.current();
|
|
2866
2845
|
return Ft(t) ? (e.lastIntValue = t, e.advance(), !0) : !1;
|
|
2867
2846
|
};
|
|
2868
2847
|
function Ft(e) {
|
|
2869
2848
|
return e === 33 || e === 35 || e === 37 || e === 38 || e === 44 || e === 45 || e >= 58 && e <= 62 || e === 64 || e === 96 || e === 126;
|
|
2870
2849
|
}
|
|
2871
|
-
|
|
2850
|
+
F.regexp_eatClassControlLetter = function(e) {
|
|
2872
2851
|
var t = e.current();
|
|
2873
2852
|
return It(t) || t === 95 ? (e.lastIntValue = t % 32, e.advance(), !0) : !1;
|
|
2874
|
-
},
|
|
2853
|
+
}, F.regexp_eatHexEscapeSequence = function(e) {
|
|
2875
2854
|
var t = e.pos;
|
|
2876
2855
|
if (e.eat(120)) {
|
|
2877
2856
|
if (this.regexp_eatFixedHexDigits(e, 2)) return !0;
|
|
2878
2857
|
e.switchU && e.raise("Invalid escape"), e.pos = t;
|
|
2879
2858
|
}
|
|
2880
2859
|
return !1;
|
|
2881
|
-
},
|
|
2860
|
+
}, F.regexp_eatDecimalDigits = function(e) {
|
|
2882
2861
|
var t = e.pos, n = 0;
|
|
2883
2862
|
for (e.lastIntValue = 0; It(n = e.current());) e.lastIntValue = 10 * e.lastIntValue + (n - 48), e.advance();
|
|
2884
2863
|
return e.pos !== t;
|
|
@@ -2886,7 +2865,7 @@ I.regexp_eatClassControlLetter = function(e) {
|
|
|
2886
2865
|
function It(e) {
|
|
2887
2866
|
return e >= 48 && e <= 57;
|
|
2888
2867
|
}
|
|
2889
|
-
|
|
2868
|
+
F.regexp_eatHexDigits = function(e) {
|
|
2890
2869
|
var t = e.pos, n = 0;
|
|
2891
2870
|
for (e.lastIntValue = 0; Lt(n = e.current());) e.lastIntValue = 16 * e.lastIntValue + Rt(n), e.advance();
|
|
2892
2871
|
return e.pos !== t;
|
|
@@ -2897,7 +2876,7 @@ function Lt(e) {
|
|
|
2897
2876
|
function Rt(e) {
|
|
2898
2877
|
return e >= 65 && e <= 70 ? 10 + (e - 65) : e >= 97 && e <= 102 ? 10 + (e - 97) : e - 48;
|
|
2899
2878
|
}
|
|
2900
|
-
|
|
2879
|
+
F.regexp_eatLegacyOctalEscapeSequence = function(e) {
|
|
2901
2880
|
if (this.regexp_eatOctalDigit(e)) {
|
|
2902
2881
|
var t = e.lastIntValue;
|
|
2903
2882
|
if (this.regexp_eatOctalDigit(e)) {
|
|
@@ -2907,14 +2886,14 @@ I.regexp_eatLegacyOctalEscapeSequence = function(e) {
|
|
|
2907
2886
|
return !0;
|
|
2908
2887
|
}
|
|
2909
2888
|
return !1;
|
|
2910
|
-
},
|
|
2889
|
+
}, F.regexp_eatOctalDigit = function(e) {
|
|
2911
2890
|
var t = e.current();
|
|
2912
2891
|
return zt(t) ? (e.lastIntValue = t - 48, e.advance(), !0) : (e.lastIntValue = 0, !1);
|
|
2913
2892
|
};
|
|
2914
2893
|
function zt(e) {
|
|
2915
2894
|
return e >= 48 && e <= 55;
|
|
2916
2895
|
}
|
|
2917
|
-
|
|
2896
|
+
F.regexp_eatFixedHexDigits = function(e, t) {
|
|
2918
2897
|
var n = e.pos;
|
|
2919
2898
|
e.lastIntValue = 0;
|
|
2920
2899
|
for (var r = 0; r < t; ++r) {
|
|
@@ -2925,13 +2904,13 @@ I.regexp_eatFixedHexDigits = function(e, t) {
|
|
|
2925
2904
|
return !0;
|
|
2926
2905
|
};
|
|
2927
2906
|
var Bt = function(e) {
|
|
2928
|
-
this.type = e.type, this.value = e.value, this.start = e.start, this.end = e.end, e.options.locations && (this.loc = new
|
|
2929
|
-
},
|
|
2930
|
-
|
|
2907
|
+
this.type = e.type, this.value = e.value, this.start = e.start, this.end = e.end, e.options.locations && (this.loc = new fe(e, e.startLoc, e.endLoc)), e.options.ranges && (this.range = [e.start, e.end]);
|
|
2908
|
+
}, z = E.prototype;
|
|
2909
|
+
z.next = function(e) {
|
|
2931
2910
|
!e && this.type.keyword && this.containsEsc && this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword), this.options.onToken && this.options.onToken(new Bt(this)), this.lastTokEnd = this.end, this.lastTokStart = this.start, this.lastTokEndLoc = this.endLoc, this.lastTokStartLoc = this.startLoc, this.nextToken();
|
|
2932
|
-
},
|
|
2911
|
+
}, z.getToken = function() {
|
|
2933
2912
|
return this.next(), new Bt(this);
|
|
2934
|
-
}, typeof Symbol < "u" && (
|
|
2913
|
+
}, typeof Symbol < "u" && (z[Symbol.iterator] = function() {
|
|
2935
2914
|
var e = this;
|
|
2936
2915
|
return { next: function() {
|
|
2937
2916
|
var t = e.getToken();
|
|
@@ -2940,28 +2919,28 @@ B.next = function(e) {
|
|
|
2940
2919
|
value: t
|
|
2941
2920
|
};
|
|
2942
2921
|
} };
|
|
2943
|
-
}),
|
|
2922
|
+
}), z.nextToken = function() {
|
|
2944
2923
|
var e = this.curContext();
|
|
2945
2924
|
if ((!e || !e.preserveSpace) && this.skipSpace(), this.start = this.pos, this.options.locations && (this.startLoc = this.curPosition()), this.pos >= this.input.length) return this.finishToken(b.eof);
|
|
2946
2925
|
if (e.override) return e.override(this);
|
|
2947
2926
|
this.readToken(this.fullCharCodeAtPos());
|
|
2948
|
-
},
|
|
2949
|
-
return
|
|
2950
|
-
},
|
|
2927
|
+
}, z.readToken = function(e) {
|
|
2928
|
+
return f(e, this.options.ecmaVersion >= 6) || e === 92 ? this.readWord() : this.getTokenFromCode(e);
|
|
2929
|
+
}, z.fullCharCodeAt = function(e) {
|
|
2951
2930
|
var t = this.input.charCodeAt(e);
|
|
2952
2931
|
if (t <= 55295 || t >= 56320) return t;
|
|
2953
2932
|
var n = this.input.charCodeAt(e + 1);
|
|
2954
2933
|
return n <= 56319 || n >= 57344 ? t : (t << 10) + n - 56613888;
|
|
2955
|
-
},
|
|
2934
|
+
}, z.fullCharCodeAtPos = function() {
|
|
2956
2935
|
return this.fullCharCodeAt(this.pos);
|
|
2957
|
-
},
|
|
2936
|
+
}, z.skipBlockComment = function() {
|
|
2958
2937
|
var e = this.options.onComment && this.curPosition(), t = this.pos, n = this.input.indexOf("*/", this.pos += 2);
|
|
2959
|
-
if (n === -1 && this.raise(this.pos - 2, "Unterminated comment"), this.pos = n + 2, this.options.locations) for (var r = void 0, i = t; (r =
|
|
2938
|
+
if (n === -1 && this.raise(this.pos - 2, "Unterminated comment"), this.pos = n + 2, this.options.locations) for (var r = void 0, i = t; (r = ne(this.input, i, this.pos)) > -1;) ++this.curLine, i = this.lineStart = r;
|
|
2960
2939
|
this.options.onComment && this.options.onComment(!0, this.input.slice(t + 2, n), t, this.pos, e, this.curPosition());
|
|
2961
|
-
},
|
|
2962
|
-
for (var t = this.pos, n = this.options.onComment && this.curPosition(), r = this.input.charCodeAt(this.pos += e); this.pos < this.input.length && !
|
|
2940
|
+
}, z.skipLineComment = function(e) {
|
|
2941
|
+
for (var t = this.pos, n = this.options.onComment && this.curPosition(), r = this.input.charCodeAt(this.pos += e); this.pos < this.input.length && !te(r);) r = this.input.charCodeAt(++this.pos);
|
|
2963
2942
|
this.options.onComment && this.options.onComment(!1, this.input.slice(t + e, this.pos), t, this.pos, n, this.curPosition());
|
|
2964
|
-
},
|
|
2943
|
+
}, z.skipSpace = function() {
|
|
2965
2944
|
loop: for (; this.pos < this.input.length;) {
|
|
2966
2945
|
var e = this.input.charCodeAt(this.pos);
|
|
2967
2946
|
switch (e) {
|
|
@@ -2986,40 +2965,40 @@ B.next = function(e) {
|
|
|
2986
2965
|
default: break loop;
|
|
2987
2966
|
}
|
|
2988
2967
|
break;
|
|
2989
|
-
default: if (e > 8 && e < 14 || e >= 5760 &&
|
|
2968
|
+
default: if (e > 8 && e < 14 || e >= 5760 && re.test(String.fromCharCode(e))) ++this.pos;
|
|
2990
2969
|
else break loop;
|
|
2991
2970
|
}
|
|
2992
2971
|
}
|
|
2993
|
-
},
|
|
2972
|
+
}, z.finishToken = function(e, t) {
|
|
2994
2973
|
this.end = this.pos, this.options.locations && (this.endLoc = this.curPosition());
|
|
2995
2974
|
var n = this.type;
|
|
2996
2975
|
this.type = e, this.value = t, this.updateContext(n);
|
|
2997
|
-
},
|
|
2976
|
+
}, z.readToken_dot = function() {
|
|
2998
2977
|
var e = this.input.charCodeAt(this.pos + 1);
|
|
2999
2978
|
if (e >= 48 && e <= 57) return this.readNumber(!0);
|
|
3000
2979
|
var t = this.input.charCodeAt(this.pos + 2);
|
|
3001
2980
|
return this.options.ecmaVersion >= 6 && e === 46 && t === 46 ? (this.pos += 3, this.finishToken(b.ellipsis)) : (++this.pos, this.finishToken(b.dot));
|
|
3002
|
-
},
|
|
2981
|
+
}, z.readToken_slash = function() {
|
|
3003
2982
|
var e = this.input.charCodeAt(this.pos + 1);
|
|
3004
2983
|
return this.exprAllowed ? (++this.pos, this.readRegexp()) : e === 61 ? this.finishOp(b.assign, 2) : this.finishOp(b.slash, 1);
|
|
3005
|
-
},
|
|
2984
|
+
}, z.readToken_mult_modulo_exp = function(e) {
|
|
3006
2985
|
var t = this.input.charCodeAt(this.pos + 1), n = 1, r = e === 42 ? b.star : b.modulo;
|
|
3007
2986
|
return this.options.ecmaVersion >= 7 && e === 42 && t === 42 && (++n, r = b.starstar, t = this.input.charCodeAt(this.pos + 2)), t === 61 ? this.finishOp(b.assign, n + 1) : this.finishOp(r, n);
|
|
3008
|
-
},
|
|
2987
|
+
}, z.readToken_pipe_amp = function(e) {
|
|
3009
2988
|
var t = this.input.charCodeAt(this.pos + 1);
|
|
3010
2989
|
return t === e ? this.options.ecmaVersion >= 12 && this.input.charCodeAt(this.pos + 2) === 61 ? this.finishOp(b.assign, 3) : this.finishOp(e === 124 ? b.logicalOR : b.logicalAND, 2) : t === 61 ? this.finishOp(b.assign, 2) : this.finishOp(e === 124 ? b.bitwiseOR : b.bitwiseAND, 1);
|
|
3011
|
-
},
|
|
2990
|
+
}, z.readToken_caret = function() {
|
|
3012
2991
|
return this.input.charCodeAt(this.pos + 1) === 61 ? this.finishOp(b.assign, 2) : this.finishOp(b.bitwiseXOR, 1);
|
|
3013
|
-
},
|
|
2992
|
+
}, z.readToken_plus_min = function(e) {
|
|
3014
2993
|
var t = this.input.charCodeAt(this.pos + 1);
|
|
3015
2994
|
return t === e ? t === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 && (this.lastTokEnd === 0 || x.test(this.input.slice(this.lastTokEnd, this.pos))) ? (this.skipLineComment(3), this.skipSpace(), this.nextToken()) : this.finishOp(b.incDec, 2) : t === 61 ? this.finishOp(b.assign, 2) : this.finishOp(b.plusMin, 1);
|
|
3016
|
-
},
|
|
2995
|
+
}, z.readToken_lt_gt = function(e) {
|
|
3017
2996
|
var t = this.input.charCodeAt(this.pos + 1), n = 1;
|
|
3018
2997
|
return t === e ? (n = e === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2, this.input.charCodeAt(this.pos + n) === 61 ? this.finishOp(b.assign, n + 1) : this.finishOp(b.bitShift, n)) : t === 33 && e === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 && this.input.charCodeAt(this.pos + 3) === 45 ? (this.skipLineComment(4), this.skipSpace(), this.nextToken()) : (t === 61 && (n = 2), this.finishOp(b.relational, n));
|
|
3019
|
-
},
|
|
2998
|
+
}, z.readToken_eq_excl = function(e) {
|
|
3020
2999
|
var t = this.input.charCodeAt(this.pos + 1);
|
|
3021
3000
|
return t === 61 ? this.finishOp(b.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2) : e === 61 && t === 62 && this.options.ecmaVersion >= 6 ? (this.pos += 2, this.finishToken(b.arrow)) : this.finishOp(e === 61 ? b.eq : b.prefix, 1);
|
|
3022
|
-
},
|
|
3001
|
+
}, z.readToken_question = function() {
|
|
3023
3002
|
var e = this.options.ecmaVersion;
|
|
3024
3003
|
if (e >= 11) {
|
|
3025
3004
|
var t = this.input.charCodeAt(this.pos + 1);
|
|
@@ -3030,11 +3009,11 @@ B.next = function(e) {
|
|
|
3030
3009
|
if (t === 63) return e >= 12 && this.input.charCodeAt(this.pos + 2) === 61 ? this.finishOp(b.assign, 3) : this.finishOp(b.coalesce, 2);
|
|
3031
3010
|
}
|
|
3032
3011
|
return this.finishOp(b.question, 1);
|
|
3033
|
-
},
|
|
3012
|
+
}, z.readToken_numberSign = function() {
|
|
3034
3013
|
var e = this.options.ecmaVersion, t = 35;
|
|
3035
|
-
if (e >= 13 && (++this.pos, t = this.fullCharCodeAtPos(),
|
|
3014
|
+
if (e >= 13 && (++this.pos, t = this.fullCharCodeAtPos(), f(t, !0) || t === 92)) return this.finishToken(b.privateId, this.readWord1());
|
|
3036
3015
|
this.raise(this.pos, "Unexpected character '" + w(t) + "'");
|
|
3037
|
-
},
|
|
3016
|
+
}, z.getTokenFromCode = function(e) {
|
|
3038
3017
|
switch (e) {
|
|
3039
3018
|
case 46: return this.readToken_dot();
|
|
3040
3019
|
case 40: return ++this.pos, this.finishToken(b.parenL);
|
|
@@ -3084,10 +3063,10 @@ B.next = function(e) {
|
|
|
3084
3063
|
case 35: return this.readToken_numberSign();
|
|
3085
3064
|
}
|
|
3086
3065
|
this.raise(this.pos, "Unexpected character '" + w(e) + "'");
|
|
3087
|
-
},
|
|
3066
|
+
}, z.finishOp = function(e, t) {
|
|
3088
3067
|
var n = this.input.slice(this.pos, this.pos + t);
|
|
3089
3068
|
return this.pos += t, this.finishToken(e, n);
|
|
3090
|
-
},
|
|
3069
|
+
}, z.readRegexp = function() {
|
|
3091
3070
|
for (var e, t, n = this.pos;;) {
|
|
3092
3071
|
this.pos >= this.input.length && this.raise(n, "Unterminated regular expression");
|
|
3093
3072
|
var r = this.input.charAt(this.pos);
|
|
@@ -3104,7 +3083,7 @@ B.next = function(e) {
|
|
|
3104
3083
|
++this.pos;
|
|
3105
3084
|
var a = this.pos, o = this.readWord1();
|
|
3106
3085
|
this.containsEsc && this.unexpected(a);
|
|
3107
|
-
var s = this.regexpState ||= new
|
|
3086
|
+
var s = this.regexpState ||= new I(this);
|
|
3108
3087
|
s.reset(n, i, o), this.validateRegExpFlags(s), this.validateRegExpPattern(s);
|
|
3109
3088
|
var c = null;
|
|
3110
3089
|
try {
|
|
@@ -3115,7 +3094,7 @@ B.next = function(e) {
|
|
|
3115
3094
|
flags: o,
|
|
3116
3095
|
value: c
|
|
3117
3096
|
});
|
|
3118
|
-
},
|
|
3097
|
+
}, z.readInt = function(e, t, n) {
|
|
3119
3098
|
for (var r = this.options.ecmaVersion >= 12 && t === void 0, i = n && this.input.charCodeAt(this.pos) === 48, a = this.pos, o = 0, s = 0, c = 0, l = t ?? Infinity; c < l; ++c, ++this.pos) {
|
|
3120
3099
|
var u = this.input.charCodeAt(this.pos), d = void 0;
|
|
3121
3100
|
if (r && u === 95) {
|
|
@@ -3133,12 +3112,12 @@ function Vt(e, t) {
|
|
|
3133
3112
|
function Ht(e) {
|
|
3134
3113
|
return typeof BigInt == "function" ? BigInt(e.replace(/_/g, "")) : null;
|
|
3135
3114
|
}
|
|
3136
|
-
|
|
3115
|
+
z.readRadixNumber = function(e) {
|
|
3137
3116
|
var t = this.pos;
|
|
3138
3117
|
this.pos += 2;
|
|
3139
3118
|
var n = this.readInt(e);
|
|
3140
|
-
return n ?? this.raise(this.start + 2, "Expected number in radix " + e), this.options.ecmaVersion >= 11 && this.input.charCodeAt(this.pos) === 110 ? (n = Ht(this.input.slice(t, this.pos)), ++this.pos) :
|
|
3141
|
-
},
|
|
3119
|
+
return n ?? this.raise(this.start + 2, "Expected number in radix " + e), this.options.ecmaVersion >= 11 && this.input.charCodeAt(this.pos) === 110 ? (n = Ht(this.input.slice(t, this.pos)), ++this.pos) : f(this.fullCharCodeAtPos()) && this.raise(this.pos, "Identifier directly after number"), this.finishToken(b.num, n);
|
|
3120
|
+
}, z.readNumber = function(e) {
|
|
3142
3121
|
var t = this.pos;
|
|
3143
3122
|
!e && this.readInt(10, void 0, !0) === null && this.raise(t, "Invalid number");
|
|
3144
3123
|
var n = this.pos - t >= 2 && this.input.charCodeAt(t) === 48;
|
|
@@ -3146,12 +3125,12 @@ B.readRadixNumber = function(e) {
|
|
|
3146
3125
|
var r = this.input.charCodeAt(this.pos);
|
|
3147
3126
|
if (!n && !e && this.options.ecmaVersion >= 11 && r === 110) {
|
|
3148
3127
|
var i = Ht(this.input.slice(t, this.pos));
|
|
3149
|
-
return ++this.pos,
|
|
3128
|
+
return ++this.pos, f(this.fullCharCodeAtPos()) && this.raise(this.pos, "Identifier directly after number"), this.finishToken(b.num, i);
|
|
3150
3129
|
}
|
|
3151
|
-
n && /[89]/.test(this.input.slice(t, this.pos)) && (n = !1), r === 46 && !n && (++this.pos, this.readInt(10), r = this.input.charCodeAt(this.pos)), (r === 69 || r === 101) && !n && (r = this.input.charCodeAt(++this.pos), (r === 43 || r === 45) && ++this.pos, this.readInt(10) === null && this.raise(t, "Invalid number")),
|
|
3130
|
+
n && /[89]/.test(this.input.slice(t, this.pos)) && (n = !1), r === 46 && !n && (++this.pos, this.readInt(10), r = this.input.charCodeAt(this.pos)), (r === 69 || r === 101) && !n && (r = this.input.charCodeAt(++this.pos), (r === 43 || r === 45) && ++this.pos, this.readInt(10) === null && this.raise(t, "Invalid number")), f(this.fullCharCodeAtPos()) && this.raise(this.pos, "Identifier directly after number");
|
|
3152
3131
|
var a = Vt(this.input.slice(t, this.pos), n);
|
|
3153
3132
|
return this.finishToken(b.num, a);
|
|
3154
|
-
},
|
|
3133
|
+
}, z.readCodePoint = function() {
|
|
3155
3134
|
var e = this.input.charCodeAt(this.pos), t;
|
|
3156
3135
|
if (e === 123) {
|
|
3157
3136
|
this.options.ecmaVersion < 6 && this.unexpected();
|
|
@@ -3159,17 +3138,17 @@ B.readRadixNumber = function(e) {
|
|
|
3159
3138
|
t = this.readHexChar(this.input.indexOf("}", this.pos) - this.pos), ++this.pos, t > 1114111 && this.invalidStringToken(n, "Code point out of bounds");
|
|
3160
3139
|
} else t = this.readHexChar(4);
|
|
3161
3140
|
return t;
|
|
3162
|
-
},
|
|
3141
|
+
}, z.readString = function(e) {
|
|
3163
3142
|
for (var t = "", n = ++this.pos;;) {
|
|
3164
3143
|
this.pos >= this.input.length && this.raise(this.start, "Unterminated string constant");
|
|
3165
3144
|
var r = this.input.charCodeAt(this.pos);
|
|
3166
3145
|
if (r === e) break;
|
|
3167
|
-
r === 92 ? (t += this.input.slice(n, this.pos), t += this.readEscapedChar(!1), n = this.pos) : r === 8232 || r === 8233 ? (this.options.ecmaVersion < 10 && this.raise(this.start, "Unterminated string constant"), ++this.pos, this.options.locations && (this.curLine++, this.lineStart = this.pos)) : (
|
|
3146
|
+
r === 92 ? (t += this.input.slice(n, this.pos), t += this.readEscapedChar(!1), n = this.pos) : r === 8232 || r === 8233 ? (this.options.ecmaVersion < 10 && this.raise(this.start, "Unterminated string constant"), ++this.pos, this.options.locations && (this.curLine++, this.lineStart = this.pos)) : (te(r) && this.raise(this.start, "Unterminated string constant"), ++this.pos);
|
|
3168
3147
|
}
|
|
3169
3148
|
return t += this.input.slice(n, this.pos++), this.finishToken(b.string, t);
|
|
3170
3149
|
};
|
|
3171
3150
|
var Ut = {};
|
|
3172
|
-
|
|
3151
|
+
z.tryReadTemplateToken = function() {
|
|
3173
3152
|
this.inTemplateElement = !0;
|
|
3174
3153
|
try {
|
|
3175
3154
|
this.readTmplToken();
|
|
@@ -3178,16 +3157,16 @@ B.tryReadTemplateToken = function() {
|
|
|
3178
3157
|
else throw e;
|
|
3179
3158
|
}
|
|
3180
3159
|
this.inTemplateElement = !1;
|
|
3181
|
-
},
|
|
3160
|
+
}, z.invalidStringToken = function(e, t) {
|
|
3182
3161
|
if (this.inTemplateElement && this.options.ecmaVersion >= 9) throw Ut;
|
|
3183
3162
|
this.raise(e, t);
|
|
3184
|
-
},
|
|
3163
|
+
}, z.readTmplToken = function() {
|
|
3185
3164
|
for (var e = "", t = this.pos;;) {
|
|
3186
3165
|
this.pos >= this.input.length && this.raise(this.start, "Unterminated template");
|
|
3187
3166
|
var n = this.input.charCodeAt(this.pos);
|
|
3188
3167
|
if (n === 96 || n === 36 && this.input.charCodeAt(this.pos + 1) === 123) return this.pos === this.start && (this.type === b.template || this.type === b.invalidTemplate) ? n === 36 ? (this.pos += 2, this.finishToken(b.dollarBraceL)) : (++this.pos, this.finishToken(b.backQuote)) : (e += this.input.slice(t, this.pos), this.finishToken(b.template, e));
|
|
3189
3168
|
if (n === 92) e += this.input.slice(t, this.pos), e += this.readEscapedChar(!0), t = this.pos;
|
|
3190
|
-
else if (
|
|
3169
|
+
else if (te(n)) {
|
|
3191
3170
|
switch (e += this.input.slice(t, this.pos), ++this.pos, n) {
|
|
3192
3171
|
case 13: this.input.charCodeAt(this.pos) === 10 && ++this.pos;
|
|
3193
3172
|
case 10:
|
|
@@ -3200,7 +3179,7 @@ B.tryReadTemplateToken = function() {
|
|
|
3200
3179
|
this.options.locations && (++this.curLine, this.lineStart = this.pos), t = this.pos;
|
|
3201
3180
|
} else ++this.pos;
|
|
3202
3181
|
}
|
|
3203
|
-
},
|
|
3182
|
+
}, z.readInvalidTemplateToken = function() {
|
|
3204
3183
|
for (; this.pos < this.input.length; this.pos++) switch (this.input[this.pos]) {
|
|
3205
3184
|
case "\\":
|
|
3206
3185
|
++this.pos;
|
|
@@ -3215,7 +3194,7 @@ B.tryReadTemplateToken = function() {
|
|
|
3215
3194
|
break;
|
|
3216
3195
|
}
|
|
3217
3196
|
this.raise(this.start, "Unterminated template");
|
|
3218
|
-
},
|
|
3197
|
+
}, z.readEscapedChar = function(e) {
|
|
3219
3198
|
var t = this.input.charCodeAt(++this.pos);
|
|
3220
3199
|
switch (++this.pos, t) {
|
|
3221
3200
|
case 110: return "\n";
|
|
@@ -3238,161 +3217,164 @@ B.tryReadTemplateToken = function() {
|
|
|
3238
3217
|
var r = this.input.substr(this.pos - 1, 3).match(/^[0-7]+/)[0], i = parseInt(r, 8);
|
|
3239
3218
|
return i > 255 && (r = r.slice(0, -1), i = parseInt(r, 8)), this.pos += r.length - 1, t = this.input.charCodeAt(this.pos), (r !== "0" || t === 56 || t === 57) && (this.strict || e) && this.invalidStringToken(this.pos - 1 - r.length, e ? "Octal literal in template string" : "Octal literal in strict mode"), String.fromCharCode(i);
|
|
3240
3219
|
}
|
|
3241
|
-
return
|
|
3220
|
+
return te(t) ? (this.options.locations && (this.lineStart = this.pos, ++this.curLine), "") : String.fromCharCode(t);
|
|
3242
3221
|
}
|
|
3243
|
-
},
|
|
3222
|
+
}, z.readHexChar = function(e) {
|
|
3244
3223
|
var t = this.pos, n = this.readInt(16, e);
|
|
3245
3224
|
return n === null && this.invalidStringToken(t, "Bad character escape sequence"), n;
|
|
3246
|
-
},
|
|
3225
|
+
}, z.readWord1 = function() {
|
|
3247
3226
|
this.containsEsc = !1;
|
|
3248
3227
|
for (var e = "", t = !0, n = this.pos, r = this.options.ecmaVersion >= 6; this.pos < this.input.length;) {
|
|
3249
3228
|
var i = this.fullCharCodeAtPos();
|
|
3250
|
-
if (
|
|
3229
|
+
if (p(i, r)) this.pos += i <= 65535 ? 1 : 2;
|
|
3251
3230
|
else if (i === 92) {
|
|
3252
3231
|
this.containsEsc = !0, e += this.input.slice(n, this.pos);
|
|
3253
3232
|
var a = this.pos;
|
|
3254
3233
|
this.input.charCodeAt(++this.pos) !== 117 && this.invalidStringToken(this.pos, "Expecting Unicode escape sequence \\uXXXX"), ++this.pos;
|
|
3255
3234
|
var o = this.readCodePoint();
|
|
3256
|
-
(t ?
|
|
3235
|
+
(t ? f : p)(o, r) || this.invalidStringToken(a, "Invalid Unicode escape"), e += w(o), n = this.pos;
|
|
3257
3236
|
} else break;
|
|
3258
3237
|
t = !1;
|
|
3259
3238
|
}
|
|
3260
3239
|
return e + this.input.slice(n, this.pos);
|
|
3261
|
-
},
|
|
3240
|
+
}, z.readWord = function() {
|
|
3262
3241
|
var e = this.readWord1(), t = b.name;
|
|
3263
|
-
return this.keywords.test(e) && (t =
|
|
3264
|
-
},
|
|
3265
|
-
Parser:
|
|
3242
|
+
return this.keywords.test(e) && (t = v[e]), this.finishToken(t, e);
|
|
3243
|
+
}, E.acorn = {
|
|
3244
|
+
Parser: E,
|
|
3266
3245
|
version: "8.17.0",
|
|
3267
|
-
defaultOptions:
|
|
3268
|
-
Position:
|
|
3269
|
-
SourceLocation:
|
|
3270
|
-
getLineInfo:
|
|
3246
|
+
defaultOptions: me,
|
|
3247
|
+
Position: de,
|
|
3248
|
+
SourceLocation: fe,
|
|
3249
|
+
getLineInfo: pe,
|
|
3271
3250
|
Node: Qe,
|
|
3272
|
-
TokenType:
|
|
3251
|
+
TokenType: m,
|
|
3273
3252
|
tokTypes: b,
|
|
3274
|
-
keywordTypes:
|
|
3275
|
-
TokContext:
|
|
3276
|
-
tokContexts:
|
|
3277
|
-
isIdentifierChar:
|
|
3278
|
-
isIdentifierStart:
|
|
3253
|
+
keywordTypes: v,
|
|
3254
|
+
TokContext: j,
|
|
3255
|
+
tokContexts: M,
|
|
3256
|
+
isIdentifierChar: p,
|
|
3257
|
+
isIdentifierStart: f,
|
|
3279
3258
|
Token: Bt,
|
|
3280
|
-
isNewLine:
|
|
3259
|
+
isNewLine: te,
|
|
3281
3260
|
lineBreak: x,
|
|
3282
|
-
lineBreakG:
|
|
3283
|
-
nonASCIIwhitespace:
|
|
3261
|
+
lineBreakG: ee,
|
|
3262
|
+
nonASCIIwhitespace: re
|
|
3284
3263
|
};
|
|
3285
3264
|
function Wt(e, t) {
|
|
3286
|
-
return
|
|
3265
|
+
return E.parse(e, t);
|
|
3287
3266
|
}
|
|
3288
|
-
function
|
|
3289
|
-
return
|
|
3267
|
+
function B(e, t, n) {
|
|
3268
|
+
return E.parseExpressionAt(e, t, n);
|
|
3269
|
+
}
|
|
3270
|
+
function Gt(e, t) {
|
|
3271
|
+
return E.tokenizer(e, t);
|
|
3290
3272
|
}
|
|
3291
3273
|
//#endregion
|
|
3292
3274
|
//#region ../../node_modules/.pnpm/acorn-walk@8.3.5/node_modules/acorn-walk/dist/walk.mjs
|
|
3293
|
-
function
|
|
3275
|
+
function Kt(e, t, n, r, i) {
|
|
3294
3276
|
var a = [];
|
|
3295
|
-
n ||=
|
|
3277
|
+
n ||= V, (function e(r, i, o) {
|
|
3296
3278
|
var s = o || r.type, c = r !== a[a.length - 1];
|
|
3297
|
-
c && a.push(r),
|
|
3279
|
+
c && a.push(r), Yt(n, s, r, i, e), t[s] && t[s](r, i || a, a), c && a.pop();
|
|
3298
3280
|
})(e, r, i);
|
|
3299
3281
|
}
|
|
3300
|
-
function
|
|
3282
|
+
function qt(e, t, n) {
|
|
3301
3283
|
n(e, t);
|
|
3302
3284
|
}
|
|
3303
|
-
function
|
|
3304
|
-
function
|
|
3285
|
+
function Jt(e, t, n) {}
|
|
3286
|
+
function Yt(e, t, n, r, i) {
|
|
3305
3287
|
if (e[t] == null) throw Error("No walker function defined for node type " + t);
|
|
3306
3288
|
e[t](n, r, i);
|
|
3307
3289
|
}
|
|
3308
|
-
var
|
|
3309
|
-
|
|
3290
|
+
var V = {};
|
|
3291
|
+
V.Program = V.BlockStatement = V.StaticBlock = function(e, t, n) {
|
|
3310
3292
|
for (var r = 0, i = e.body; r < i.length; r += 1) {
|
|
3311
3293
|
var a = i[r];
|
|
3312
3294
|
n(a, t, "Statement");
|
|
3313
3295
|
}
|
|
3314
|
-
},
|
|
3296
|
+
}, V.Statement = qt, V.EmptyStatement = Jt, V.ExpressionStatement = V.ParenthesizedExpression = V.ChainExpression = function(e, t, n) {
|
|
3315
3297
|
return n(e.expression, t, "Expression");
|
|
3316
|
-
},
|
|
3298
|
+
}, V.IfStatement = function(e, t, n) {
|
|
3317
3299
|
n(e.test, t, "Expression"), n(e.consequent, t, "Statement"), e.alternate && n(e.alternate, t, "Statement");
|
|
3318
|
-
},
|
|
3300
|
+
}, V.LabeledStatement = function(e, t, n) {
|
|
3319
3301
|
return n(e.body, t, "Statement");
|
|
3320
|
-
},
|
|
3302
|
+
}, V.BreakStatement = V.ContinueStatement = Jt, V.WithStatement = function(e, t, n) {
|
|
3321
3303
|
n(e.object, t, "Expression"), n(e.body, t, "Statement");
|
|
3322
|
-
},
|
|
3304
|
+
}, V.SwitchStatement = function(e, t, n) {
|
|
3323
3305
|
n(e.discriminant, t, "Expression");
|
|
3324
3306
|
for (var r = 0, i = e.cases; r < i.length; r += 1) {
|
|
3325
3307
|
var a = i[r];
|
|
3326
3308
|
n(a, t);
|
|
3327
3309
|
}
|
|
3328
|
-
},
|
|
3310
|
+
}, V.SwitchCase = function(e, t, n) {
|
|
3329
3311
|
e.test && n(e.test, t, "Expression");
|
|
3330
3312
|
for (var r = 0, i = e.consequent; r < i.length; r += 1) {
|
|
3331
3313
|
var a = i[r];
|
|
3332
3314
|
n(a, t, "Statement");
|
|
3333
3315
|
}
|
|
3334
|
-
},
|
|
3316
|
+
}, V.ReturnStatement = V.YieldExpression = V.AwaitExpression = function(e, t, n) {
|
|
3335
3317
|
e.argument && n(e.argument, t, "Expression");
|
|
3336
|
-
},
|
|
3318
|
+
}, V.ThrowStatement = V.SpreadElement = function(e, t, n) {
|
|
3337
3319
|
return n(e.argument, t, "Expression");
|
|
3338
|
-
},
|
|
3320
|
+
}, V.TryStatement = function(e, t, n) {
|
|
3339
3321
|
n(e.block, t, "Statement"), e.handler && n(e.handler, t), e.finalizer && n(e.finalizer, t, "Statement");
|
|
3340
|
-
},
|
|
3322
|
+
}, V.CatchClause = function(e, t, n) {
|
|
3341
3323
|
e.param && n(e.param, t, "Pattern"), n(e.body, t, "Statement");
|
|
3342
|
-
},
|
|
3324
|
+
}, V.WhileStatement = V.DoWhileStatement = function(e, t, n) {
|
|
3343
3325
|
n(e.test, t, "Expression"), n(e.body, t, "Statement");
|
|
3344
|
-
},
|
|
3326
|
+
}, V.ForStatement = function(e, t, n) {
|
|
3345
3327
|
e.init && n(e.init, t, "ForInit"), e.test && n(e.test, t, "Expression"), e.update && n(e.update, t, "Expression"), n(e.body, t, "Statement");
|
|
3346
|
-
},
|
|
3328
|
+
}, V.ForInStatement = V.ForOfStatement = function(e, t, n) {
|
|
3347
3329
|
n(e.left, t, "ForInit"), n(e.right, t, "Expression"), n(e.body, t, "Statement");
|
|
3348
|
-
},
|
|
3330
|
+
}, V.ForInit = function(e, t, n) {
|
|
3349
3331
|
e.type === "VariableDeclaration" ? n(e, t) : n(e, t, "Expression");
|
|
3350
|
-
},
|
|
3332
|
+
}, V.DebuggerStatement = Jt, V.FunctionDeclaration = function(e, t, n) {
|
|
3351
3333
|
return n(e, t, "Function");
|
|
3352
|
-
},
|
|
3334
|
+
}, V.VariableDeclaration = function(e, t, n) {
|
|
3353
3335
|
for (var r = 0, i = e.declarations; r < i.length; r += 1) {
|
|
3354
3336
|
var a = i[r];
|
|
3355
3337
|
n(a, t);
|
|
3356
3338
|
}
|
|
3357
|
-
},
|
|
3339
|
+
}, V.VariableDeclarator = function(e, t, n) {
|
|
3358
3340
|
n(e.id, t, "Pattern"), e.init && n(e.init, t, "Expression");
|
|
3359
|
-
},
|
|
3341
|
+
}, V.Function = function(e, t, n) {
|
|
3360
3342
|
e.id && n(e.id, t, "Pattern");
|
|
3361
3343
|
for (var r = 0, i = e.params; r < i.length; r += 1) {
|
|
3362
3344
|
var a = i[r];
|
|
3363
3345
|
n(a, t, "Pattern");
|
|
3364
3346
|
}
|
|
3365
3347
|
n(e.body, t, e.expression ? "Expression" : "Statement");
|
|
3366
|
-
},
|
|
3348
|
+
}, V.Pattern = function(e, t, n) {
|
|
3367
3349
|
e.type === "Identifier" ? n(e, t, "VariablePattern") : e.type === "MemberExpression" ? n(e, t, "MemberPattern") : n(e, t);
|
|
3368
|
-
},
|
|
3350
|
+
}, V.VariablePattern = Jt, V.MemberPattern = qt, V.RestElement = function(e, t, n) {
|
|
3369
3351
|
return n(e.argument, t, "Pattern");
|
|
3370
|
-
},
|
|
3352
|
+
}, V.ArrayPattern = function(e, t, n) {
|
|
3371
3353
|
for (var r = 0, i = e.elements; r < i.length; r += 1) {
|
|
3372
3354
|
var a = i[r];
|
|
3373
3355
|
a && n(a, t, "Pattern");
|
|
3374
3356
|
}
|
|
3375
|
-
},
|
|
3357
|
+
}, V.ObjectPattern = function(e, t, n) {
|
|
3376
3358
|
for (var r = 0, i = e.properties; r < i.length; r += 1) {
|
|
3377
3359
|
var a = i[r];
|
|
3378
3360
|
a.type === "Property" ? (a.computed && n(a.key, t, "Expression"), n(a.value, t, "Pattern")) : a.type === "RestElement" && n(a.argument, t, "Pattern");
|
|
3379
3361
|
}
|
|
3380
|
-
},
|
|
3362
|
+
}, V.Expression = qt, V.ThisExpression = V.Super = V.MetaProperty = Jt, V.ArrayExpression = function(e, t, n) {
|
|
3381
3363
|
for (var r = 0, i = e.elements; r < i.length; r += 1) {
|
|
3382
3364
|
var a = i[r];
|
|
3383
3365
|
a && n(a, t, "Expression");
|
|
3384
3366
|
}
|
|
3385
|
-
},
|
|
3367
|
+
}, V.ObjectExpression = function(e, t, n) {
|
|
3386
3368
|
for (var r = 0, i = e.properties; r < i.length; r += 1) {
|
|
3387
3369
|
var a = i[r];
|
|
3388
3370
|
n(a, t);
|
|
3389
3371
|
}
|
|
3390
|
-
},
|
|
3372
|
+
}, V.FunctionExpression = V.ArrowFunctionExpression = V.FunctionDeclaration, V.SequenceExpression = function(e, t, n) {
|
|
3391
3373
|
for (var r = 0, i = e.expressions; r < i.length; r += 1) {
|
|
3392
3374
|
var a = i[r];
|
|
3393
3375
|
n(a, t, "Expression");
|
|
3394
3376
|
}
|
|
3395
|
-
},
|
|
3377
|
+
}, V.TemplateLiteral = function(e, t, n) {
|
|
3396
3378
|
for (var r = 0, i = e.quasis; r < i.length; r += 1) {
|
|
3397
3379
|
var a = i[r];
|
|
3398
3380
|
n(a, t);
|
|
@@ -3401,34 +3383,34 @@ H.Program = H.BlockStatement = H.StaticBlock = function(e, t, n) {
|
|
|
3401
3383
|
var c = s[o];
|
|
3402
3384
|
n(c, t, "Expression");
|
|
3403
3385
|
}
|
|
3404
|
-
},
|
|
3386
|
+
}, V.TemplateElement = Jt, V.UnaryExpression = V.UpdateExpression = function(e, t, n) {
|
|
3405
3387
|
n(e.argument, t, "Expression");
|
|
3406
|
-
},
|
|
3388
|
+
}, V.BinaryExpression = V.LogicalExpression = function(e, t, n) {
|
|
3407
3389
|
n(e.left, t, "Expression"), n(e.right, t, "Expression");
|
|
3408
|
-
},
|
|
3390
|
+
}, V.AssignmentExpression = V.AssignmentPattern = function(e, t, n) {
|
|
3409
3391
|
n(e.left, t, "Pattern"), n(e.right, t, "Expression");
|
|
3410
|
-
},
|
|
3392
|
+
}, V.ConditionalExpression = function(e, t, n) {
|
|
3411
3393
|
n(e.test, t, "Expression"), n(e.consequent, t, "Expression"), n(e.alternate, t, "Expression");
|
|
3412
|
-
},
|
|
3394
|
+
}, V.NewExpression = V.CallExpression = function(e, t, n) {
|
|
3413
3395
|
if (n(e.callee, t, "Expression"), e.arguments) for (var r = 0, i = e.arguments; r < i.length; r += 1) {
|
|
3414
3396
|
var a = i[r];
|
|
3415
3397
|
n(a, t, "Expression");
|
|
3416
3398
|
}
|
|
3417
|
-
},
|
|
3399
|
+
}, V.MemberExpression = function(e, t, n) {
|
|
3418
3400
|
n(e.object, t, "Expression"), e.computed && n(e.property, t, "Expression");
|
|
3419
|
-
},
|
|
3401
|
+
}, V.ExportNamedDeclaration = V.ExportDefaultDeclaration = function(e, t, n) {
|
|
3420
3402
|
if (e.declaration && n(e.declaration, t, e.type === "ExportNamedDeclaration" || e.declaration.id ? "Statement" : "Expression"), e.source && n(e.source, t, "Expression"), e.attributes) for (var r = 0, i = e.attributes; r < i.length; r += 1) {
|
|
3421
3403
|
var a = i[r];
|
|
3422
3404
|
n(a, t);
|
|
3423
3405
|
}
|
|
3424
|
-
},
|
|
3406
|
+
}, V.ExportAllDeclaration = function(e, t, n) {
|
|
3425
3407
|
if (e.exported && n(e.exported, t), n(e.source, t, "Expression"), e.attributes) for (var r = 0, i = e.attributes; r < i.length; r += 1) {
|
|
3426
3408
|
var a = i[r];
|
|
3427
3409
|
n(a, t);
|
|
3428
3410
|
}
|
|
3429
|
-
},
|
|
3411
|
+
}, V.ImportAttribute = function(e, t, n) {
|
|
3430
3412
|
n(e.value, t, "Expression");
|
|
3431
|
-
},
|
|
3413
|
+
}, V.ImportDeclaration = function(e, t, n) {
|
|
3432
3414
|
for (var r = 0, i = e.specifiers; r < i.length; r += 1) {
|
|
3433
3415
|
var a = i[r];
|
|
3434
3416
|
n(a, t);
|
|
@@ -3437,25 +3419,25 @@ H.Program = H.BlockStatement = H.StaticBlock = function(e, t, n) {
|
|
|
3437
3419
|
var c = s[o];
|
|
3438
3420
|
n(c, t);
|
|
3439
3421
|
}
|
|
3440
|
-
},
|
|
3422
|
+
}, V.ImportExpression = function(e, t, n) {
|
|
3441
3423
|
n(e.source, t, "Expression"), e.options && n(e.options, t, "Expression");
|
|
3442
|
-
},
|
|
3424
|
+
}, V.ImportSpecifier = V.ImportDefaultSpecifier = V.ImportNamespaceSpecifier = V.Identifier = V.PrivateIdentifier = V.Literal = Jt, V.TaggedTemplateExpression = function(e, t, n) {
|
|
3443
3425
|
n(e.tag, t, "Expression"), n(e.quasi, t, "Expression");
|
|
3444
|
-
},
|
|
3426
|
+
}, V.ClassDeclaration = V.ClassExpression = function(e, t, n) {
|
|
3445
3427
|
return n(e, t, "Class");
|
|
3446
|
-
},
|
|
3428
|
+
}, V.Class = function(e, t, n) {
|
|
3447
3429
|
e.id && n(e.id, t, "Pattern"), e.superClass && n(e.superClass, t, "Expression"), n(e.body, t);
|
|
3448
|
-
},
|
|
3430
|
+
}, V.ClassBody = function(e, t, n) {
|
|
3449
3431
|
for (var r = 0, i = e.body; r < i.length; r += 1) {
|
|
3450
3432
|
var a = i[r];
|
|
3451
3433
|
n(a, t);
|
|
3452
3434
|
}
|
|
3453
|
-
},
|
|
3435
|
+
}, V.MethodDefinition = V.PropertyDefinition = V.Property = function(e, t, n) {
|
|
3454
3436
|
e.computed && n(e.key, t, "Expression"), e.value && n(e.value, t, "Expression");
|
|
3455
3437
|
};
|
|
3456
3438
|
//#endregion
|
|
3457
3439
|
//#region ../compiler/dist/index-es.js
|
|
3458
|
-
var
|
|
3440
|
+
var H = {
|
|
3459
3441
|
TagOpen: "TagOpen",
|
|
3460
3442
|
TagOpenSlash: "TagOpenSlash",
|
|
3461
3443
|
TagClose: "TagClose",
|
|
@@ -3479,7 +3461,7 @@ var U = {
|
|
|
3479
3461
|
BlockOpen: "BlockOpen",
|
|
3480
3462
|
BlockClose: "BlockClose",
|
|
3481
3463
|
EOF: "EOF"
|
|
3482
|
-
},
|
|
3464
|
+
}, U = {
|
|
3483
3465
|
Data: "Data",
|
|
3484
3466
|
TagOpen: "TagOpen",
|
|
3485
3467
|
EndTagOpen: "EndTagOpen",
|
|
@@ -3493,9 +3475,9 @@ var U = {
|
|
|
3493
3475
|
Interpolation: "Interpolation",
|
|
3494
3476
|
RawText: "RawText",
|
|
3495
3477
|
EOF: "EOF"
|
|
3496
|
-
},
|
|
3478
|
+
}, W = /* @__PURE__ */ function(e) {
|
|
3497
3479
|
return e[e.Start = 0] = "Start", e[e.Punctuator = 1] = "Punctuator", e[e.Keyword = 2] = "Keyword", e[e.IdentifierOrLiteral = 3] = "IdentifierOrLiteral", e[e.PostfixOp = 4] = "PostfixOp", e;
|
|
3498
|
-
}({}),
|
|
3480
|
+
}({}), G = {
|
|
3499
3481
|
Program: "Program",
|
|
3500
3482
|
Element: "Element",
|
|
3501
3483
|
Text: "Text",
|
|
@@ -3506,161 +3488,161 @@ var U = {
|
|
|
3506
3488
|
For: "For",
|
|
3507
3489
|
Switch: "Switch",
|
|
3508
3490
|
Async: "Async"
|
|
3509
|
-
},
|
|
3491
|
+
}, K = class extends Error {
|
|
3510
3492
|
line;
|
|
3511
3493
|
column;
|
|
3512
3494
|
offset;
|
|
3513
3495
|
constructor(e, t, n, r) {
|
|
3514
3496
|
super(`LexerError [${t}:${n}]: ${e}`), this.line = t, this.column = n, this.offset = r, this.name = "DriftLexerError";
|
|
3515
3497
|
}
|
|
3516
|
-
},
|
|
3498
|
+
}, q = class extends Error {
|
|
3517
3499
|
line;
|
|
3518
3500
|
column;
|
|
3519
3501
|
offset;
|
|
3520
3502
|
constructor(e, t, n, r) {
|
|
3521
3503
|
super(`ParserError [${t}:${n}]: ${e}`), this.line = t, this.column = n, this.offset = r, this.name = "DriftParserError";
|
|
3522
3504
|
}
|
|
3523
|
-
},
|
|
3524
|
-
return e[e.RETURN = 0] = "RETURN", e[e.CREATE_ELEMENT = 1] = "CREATE_ELEMENT", e[e.CREATE_TEXT = 2] = "CREATE_TEXT", e[e.CREATE_COMMENT = 3] = "CREATE_COMMENT", e[e.APPEND_CHILD = 4] = "APPEND_CHILD", e[e.SET_ATTR = 5] = "SET_ATTR", e[e.CREATE_FRAGMENT = 6] = "CREATE_FRAGMENT", e[e.INTERPOLATE_TEXT = 7] = "INTERPOLATE_TEXT", e[e.EXEC_SCRIPT = 12] = "EXEC_SCRIPT", e[e.REACTIVE_IF = 13] = "REACTIVE_IF", e[e.REACTIVE_FOR = 14] = "REACTIVE_FOR", e[e.MOUNT_COMPONENT = 15] = "MOUNT_COMPONENT", e[e.REACTIVE_ASYNC = 16] = "REACTIVE_ASYNC", e;
|
|
3525
|
-
}({}),
|
|
3526
|
-
[
|
|
3505
|
+
}, J = /* @__PURE__ */ function(e) {
|
|
3506
|
+
return e[e.RETURN = 0] = "RETURN", e[e.CREATE_ELEMENT = 1] = "CREATE_ELEMENT", e[e.CREATE_TEXT = 2] = "CREATE_TEXT", e[e.CREATE_COMMENT = 3] = "CREATE_COMMENT", e[e.APPEND_CHILD = 4] = "APPEND_CHILD", e[e.SET_ATTR = 5] = "SET_ATTR", e[e.CREATE_FRAGMENT = 6] = "CREATE_FRAGMENT", e[e.INTERPOLATE_TEXT = 7] = "INTERPOLATE_TEXT", e[e.EXEC_SCRIPT = 12] = "EXEC_SCRIPT", e[e.REACTIVE_IF = 13] = "REACTIVE_IF", e[e.REACTIVE_FOR = 14] = "REACTIVE_FOR", e[e.MOUNT_COMPONENT = 15] = "MOUNT_COMPONENT", e[e.REACTIVE_ASYNC = 16] = "REACTIVE_ASYNC", e[e.REACTIVE_SWITCH = 17] = "REACTIVE_SWITCH", e;
|
|
3507
|
+
}({}), Xt = {
|
|
3508
|
+
[U.Data]: [
|
|
3527
3509
|
{
|
|
3528
|
-
to:
|
|
3510
|
+
to: U.Comment,
|
|
3529
3511
|
when: "The next characters are <!--",
|
|
3530
3512
|
emits: "Comment"
|
|
3531
3513
|
},
|
|
3532
3514
|
{
|
|
3533
|
-
to:
|
|
3515
|
+
to: U.EndTagOpen,
|
|
3534
3516
|
when: "The next characters are </",
|
|
3535
3517
|
emits: "TagOpenSlash"
|
|
3536
3518
|
},
|
|
3537
3519
|
{
|
|
3538
|
-
to:
|
|
3520
|
+
to: U.TagOpen,
|
|
3539
3521
|
when: "The next character is '<' for a start tag",
|
|
3540
3522
|
emits: "TagOpen"
|
|
3541
3523
|
},
|
|
3542
3524
|
{
|
|
3543
|
-
to:
|
|
3525
|
+
to: U.Interpolation,
|
|
3544
3526
|
when: "The next character is '{' in element content",
|
|
3545
3527
|
emits: "Interpolation"
|
|
3546
3528
|
},
|
|
3547
3529
|
{
|
|
3548
|
-
to:
|
|
3530
|
+
to: U.Data,
|
|
3549
3531
|
when: "Plain content is consumed up to the next control delimiter",
|
|
3550
3532
|
emits: "Text"
|
|
3551
3533
|
},
|
|
3552
3534
|
{
|
|
3553
|
-
to:
|
|
3535
|
+
to: U.EOF,
|
|
3554
3536
|
when: "The source has been fully consumed",
|
|
3555
3537
|
emits: "EOF"
|
|
3556
3538
|
}
|
|
3557
3539
|
],
|
|
3558
|
-
[
|
|
3559
|
-
to:
|
|
3540
|
+
[U.TagOpen]: [{
|
|
3541
|
+
to: U.BeforeAttributeName,
|
|
3560
3542
|
when: "A valid opening tag name is consumed",
|
|
3561
3543
|
emits: "Identifier"
|
|
3562
3544
|
}],
|
|
3563
|
-
[
|
|
3564
|
-
to:
|
|
3545
|
+
[U.EndTagOpen]: [{
|
|
3546
|
+
to: U.BeforeAttributeName,
|
|
3565
3547
|
when: "A valid closing tag name is consumed",
|
|
3566
3548
|
emits: "Identifier"
|
|
3567
3549
|
}],
|
|
3568
|
-
[
|
|
3550
|
+
[U.BeforeAttributeName]: [
|
|
3569
3551
|
{
|
|
3570
|
-
to:
|
|
3552
|
+
to: U.AttributeName,
|
|
3571
3553
|
when: "An attribute name begins in an opening tag",
|
|
3572
3554
|
emits: "Identifier"
|
|
3573
3555
|
},
|
|
3574
3556
|
{
|
|
3575
|
-
to:
|
|
3557
|
+
to: U.Data,
|
|
3576
3558
|
when: "A tag is closed with '>' and raw-text mode does not apply",
|
|
3577
3559
|
emits: "TagClose"
|
|
3578
3560
|
},
|
|
3579
3561
|
{
|
|
3580
|
-
to:
|
|
3562
|
+
to: U.RawText,
|
|
3581
3563
|
when: "A script/style start tag is closed with '>'",
|
|
3582
3564
|
emits: "TagClose"
|
|
3583
3565
|
},
|
|
3584
3566
|
{
|
|
3585
|
-
to:
|
|
3567
|
+
to: U.Data,
|
|
3586
3568
|
when: "A tag is self-closed with '/>'",
|
|
3587
3569
|
emits: "TagSelfClose"
|
|
3588
3570
|
}
|
|
3589
3571
|
],
|
|
3590
|
-
[
|
|
3591
|
-
to:
|
|
3572
|
+
[U.AttributeName]: [{
|
|
3573
|
+
to: U.AfterAttributeName,
|
|
3592
3574
|
when: "The attribute identifier has been fully consumed",
|
|
3593
3575
|
emits: "Identifier"
|
|
3594
3576
|
}],
|
|
3595
|
-
[
|
|
3596
|
-
to:
|
|
3577
|
+
[U.AfterAttributeName]: [{
|
|
3578
|
+
to: U.BeforeAttributeValue,
|
|
3597
3579
|
when: "The next character is '='",
|
|
3598
3580
|
emits: "Equals"
|
|
3599
3581
|
}, {
|
|
3600
|
-
to:
|
|
3582
|
+
to: U.BeforeAttributeName,
|
|
3601
3583
|
when: "The attribute is boolean and the lexer moves to the next attribute or tag boundary",
|
|
3602
3584
|
emits: "No token"
|
|
3603
3585
|
}],
|
|
3604
|
-
[
|
|
3605
|
-
to:
|
|
3586
|
+
[U.BeforeAttributeValue]: [{
|
|
3587
|
+
to: U.AttributeValueQuoted,
|
|
3606
3588
|
when: "The attribute value starts with a quote",
|
|
3607
3589
|
emits: "StringLiteral"
|
|
3608
3590
|
}, {
|
|
3609
|
-
to:
|
|
3591
|
+
to: U.AttributeValueInterpolation,
|
|
3610
3592
|
when: "The attribute value starts with '{'",
|
|
3611
3593
|
emits: "Interpolation"
|
|
3612
3594
|
}],
|
|
3613
|
-
[
|
|
3614
|
-
to:
|
|
3595
|
+
[U.AttributeValueQuoted]: [{
|
|
3596
|
+
to: U.BeforeAttributeName,
|
|
3615
3597
|
when: "The closing quote is consumed",
|
|
3616
3598
|
emits: "StringLiteral"
|
|
3617
3599
|
}],
|
|
3618
|
-
[
|
|
3619
|
-
to:
|
|
3600
|
+
[U.AttributeValueInterpolation]: [{
|
|
3601
|
+
to: U.BeforeAttributeName,
|
|
3620
3602
|
when: "The interpolation closes and the attribute value is complete",
|
|
3621
3603
|
emits: "Interpolation"
|
|
3622
3604
|
}],
|
|
3623
|
-
[
|
|
3624
|
-
to:
|
|
3605
|
+
[U.Comment]: [{
|
|
3606
|
+
to: U.Data,
|
|
3625
3607
|
when: "The terminating --> delimiter is consumed",
|
|
3626
3608
|
emits: "Comment"
|
|
3627
3609
|
}],
|
|
3628
|
-
[
|
|
3629
|
-
to:
|
|
3610
|
+
[U.Interpolation]: [{
|
|
3611
|
+
to: U.Data,
|
|
3630
3612
|
when: "A content interpolation closes with a matching brace",
|
|
3631
3613
|
emits: "Interpolation"
|
|
3632
3614
|
}, {
|
|
3633
|
-
to:
|
|
3615
|
+
to: U.BeforeAttributeName,
|
|
3634
3616
|
when: "An attribute interpolation closes with a matching brace",
|
|
3635
3617
|
emits: "Interpolation"
|
|
3636
3618
|
}],
|
|
3637
|
-
[
|
|
3619
|
+
[U.RawText]: [
|
|
3638
3620
|
{
|
|
3639
|
-
to:
|
|
3621
|
+
to: U.RawText,
|
|
3640
3622
|
when: "Plain raw-text content is consumed before the matching closing tag",
|
|
3641
3623
|
emits: "Text"
|
|
3642
3624
|
},
|
|
3643
3625
|
{
|
|
3644
|
-
to:
|
|
3626
|
+
to: U.EndTagOpen,
|
|
3645
3627
|
when: "The matching raw-text closing tag begins with </",
|
|
3646
3628
|
emits: "TagOpenSlash"
|
|
3647
3629
|
},
|
|
3648
3630
|
{
|
|
3649
|
-
to:
|
|
3631
|
+
to: U.EOF,
|
|
3650
3632
|
when: "The raw-text block reaches end of input before a closing tag appears",
|
|
3651
3633
|
emits: "EOF"
|
|
3652
3634
|
}
|
|
3653
3635
|
],
|
|
3654
|
-
[
|
|
3655
|
-
to:
|
|
3636
|
+
[U.EOF]: [{
|
|
3637
|
+
to: U.EOF,
|
|
3656
3638
|
when: "Additional parser requests are made after end of input",
|
|
3657
3639
|
emits: "EOF"
|
|
3658
3640
|
}]
|
|
3659
3641
|
};
|
|
3660
|
-
function
|
|
3642
|
+
function Zt(e) {
|
|
3661
3643
|
return e === "script" || e === "style";
|
|
3662
3644
|
}
|
|
3663
|
-
var
|
|
3645
|
+
var Qt = /* @__PURE__ */ new Set([
|
|
3664
3646
|
"if",
|
|
3665
3647
|
"else",
|
|
3666
3648
|
"for",
|
|
@@ -3670,7 +3652,7 @@ var Zt = /* @__PURE__ */ new Set([
|
|
|
3670
3652
|
"async",
|
|
3671
3653
|
"fallback",
|
|
3672
3654
|
"catch"
|
|
3673
|
-
]),
|
|
3655
|
+
]), $t = /* @__PURE__ */ new Set([
|
|
3674
3656
|
"return",
|
|
3675
3657
|
"yield",
|
|
3676
3658
|
"await",
|
|
@@ -3683,14 +3665,14 @@ var Zt = /* @__PURE__ */ new Set([
|
|
|
3683
3665
|
"do",
|
|
3684
3666
|
"throw",
|
|
3685
3667
|
"new"
|
|
3686
|
-
]),
|
|
3668
|
+
]), en = class {
|
|
3687
3669
|
source;
|
|
3688
3670
|
offset = 0;
|
|
3689
3671
|
line = 1;
|
|
3690
3672
|
column = 1;
|
|
3691
3673
|
emittedTokenCount = 0;
|
|
3692
3674
|
eofToken = null;
|
|
3693
|
-
state = { kind:
|
|
3675
|
+
state = { kind: U.Data };
|
|
3694
3676
|
blockDepth = 0;
|
|
3695
3677
|
elementDepth = 0;
|
|
3696
3678
|
blockElementDepthStack = [];
|
|
@@ -3709,58 +3691,58 @@ var Zt = /* @__PURE__ */ new Set([
|
|
|
3709
3691
|
}
|
|
3710
3692
|
readNextToken() {
|
|
3711
3693
|
switch (this.state.kind) {
|
|
3712
|
-
case
|
|
3713
|
-
case
|
|
3714
|
-
case
|
|
3715
|
-
case
|
|
3716
|
-
case
|
|
3717
|
-
case
|
|
3718
|
-
case
|
|
3719
|
-
case
|
|
3720
|
-
case
|
|
3721
|
-
case
|
|
3722
|
-
case
|
|
3723
|
-
case
|
|
3724
|
-
case
|
|
3694
|
+
case U.Data: return this.readDataToken();
|
|
3695
|
+
case U.TagOpen: return this.readTagNameToken(!1);
|
|
3696
|
+
case U.EndTagOpen: return this.readTagNameToken(!0);
|
|
3697
|
+
case U.BeforeAttributeName: return this.readBeforeAttributeNameToken();
|
|
3698
|
+
case U.AttributeName: return this.readAttributeNameToken();
|
|
3699
|
+
case U.AfterAttributeName: return this.readAfterAttributeNameToken();
|
|
3700
|
+
case U.BeforeAttributeValue: return this.readBeforeAttributeValueToken();
|
|
3701
|
+
case U.Comment:
|
|
3702
|
+
case U.Interpolation:
|
|
3703
|
+
case U.AttributeValueQuoted:
|
|
3704
|
+
case U.AttributeValueInterpolation: throw Error(`Lexer entered transient state '${this.state.kind}' unexpectedly.`);
|
|
3705
|
+
case U.RawText: return this.readRawTextToken();
|
|
3706
|
+
case U.EOF: return this.getOrCreateEOFToken();
|
|
3725
3707
|
}
|
|
3726
3708
|
}
|
|
3727
3709
|
readDataToken() {
|
|
3728
3710
|
let e = this.getLocation();
|
|
3729
|
-
if (this.isAtEnd()) return this.transitionTo({ kind:
|
|
3730
|
-
if (this.startsWith("<!--")) return this.consumePattern("<!--"), this.transitionTo({ kind:
|
|
3731
|
-
if (this.startsWith("</")) return this.consumePattern("</"), this.transitionTo({ kind:
|
|
3732
|
-
if (this.peek() === "<") return this.advance(), this.transitionTo({ kind:
|
|
3711
|
+
if (this.isAtEnd()) return this.transitionTo({ kind: U.EOF }), this.getOrCreateEOFToken(e);
|
|
3712
|
+
if (this.startsWith("<!--")) return this.consumePattern("<!--"), this.transitionTo({ kind: U.Comment }), this.readCommentToken(e);
|
|
3713
|
+
if (this.startsWith("</")) return this.consumePattern("</"), this.transitionTo({ kind: U.EndTagOpen }), this.createToken(H.TagOpenSlash, "</", e);
|
|
3714
|
+
if (this.peek() === "<") return this.advance(), this.transitionTo({ kind: U.TagOpen }), this.createToken(H.TagOpen, "<", e);
|
|
3733
3715
|
if (this.peek() === "{") return this.advance(), this.transitionTo({
|
|
3734
|
-
kind:
|
|
3716
|
+
kind: U.Interpolation,
|
|
3735
3717
|
context: "content",
|
|
3736
3718
|
tagName: null
|
|
3737
3719
|
}), this.readInterpolationToken(e, "content", null);
|
|
3738
3720
|
let t = this.blockDepth > 0 && this.blockElementDepthStack.length > 0 && this.elementDepth === this.blockElementDepthStack[this.blockElementDepthStack.length - 1];
|
|
3739
|
-
return this.peek() === "}" && t ? (this.advance(), this.blockDepth--, this.blockElementDepthStack.pop(), this.createToken(
|
|
3721
|
+
return this.peek() === "}" && t ? (this.advance(), this.blockDepth--, this.blockElementDepthStack.pop(), this.createToken(H.BlockClose, "}", e)) : this.peek() === "@" ? this.readDirectiveToken(e) : this.readTextToken();
|
|
3740
3722
|
}
|
|
3741
3723
|
readDirectiveToken(e) {
|
|
3742
3724
|
this.advance();
|
|
3743
3725
|
let t = "";
|
|
3744
3726
|
for (; !this.isAtEnd() && /[a-zA-Z]/.test(this.peek());) t += this.advance();
|
|
3745
|
-
if (!
|
|
3746
|
-
if (t === "if") return this.readDirectiveHeader(e,
|
|
3727
|
+
if (!Qt.has(t)) throw new K(`Unknown directive '@${t}'`, e.line, e.column, e.offset);
|
|
3728
|
+
if (t === "if") return this.readDirectiveHeader(e, H.DirectiveIf);
|
|
3747
3729
|
if (t === "else") {
|
|
3748
|
-
if (this.skipWhitespace(), this.startsWith("if") && !/[a-zA-Z0-9_]/.test(this.peek(2))) return this.consumePattern("if"), this.readDirectiveHeader(e,
|
|
3749
|
-
if (this.skipWhitespace(), this.peek() === "{") return this.advance(), this.blockDepth++, this.blockElementDepthStack.push(this.elementDepth), this.createToken(
|
|
3750
|
-
throw new
|
|
3751
|
-
} else if (t === "for") return this.readDirectiveHeader(e,
|
|
3752
|
-
else if (t === "switch") return this.readDirectiveHeader(e,
|
|
3753
|
-
else if (t === "case") return this.readDirectiveHeader(e,
|
|
3754
|
-
else if (t === "async") return this.readDirectiveHeader(e,
|
|
3755
|
-
else if (t === "catch") return this.readDirectiveHeader(e,
|
|
3730
|
+
if (this.skipWhitespace(), this.startsWith("if") && !/[a-zA-Z0-9_]/.test(this.peek(2))) return this.consumePattern("if"), this.readDirectiveHeader(e, H.DirectiveElseIf);
|
|
3731
|
+
if (this.skipWhitespace(), this.peek() === "{") return this.advance(), this.blockDepth++, this.blockElementDepthStack.push(this.elementDepth), this.createToken(H.DirectiveElse, "", e);
|
|
3732
|
+
throw new K("Expected '{' after @else directive", e.line, e.column, e.offset);
|
|
3733
|
+
} else if (t === "for") return this.readDirectiveHeader(e, H.DirectiveFor);
|
|
3734
|
+
else if (t === "switch") return this.readDirectiveHeader(e, H.DirectiveSwitch);
|
|
3735
|
+
else if (t === "case") return this.readDirectiveHeader(e, H.DirectiveCase);
|
|
3736
|
+
else if (t === "async") return this.readDirectiveHeader(e, H.DirectiveAsync);
|
|
3737
|
+
else if (t === "catch") return this.readDirectiveHeader(e, H.DirectiveCatch);
|
|
3756
3738
|
else if (t === "fallback") {
|
|
3757
|
-
if (this.skipWhitespace(), this.peek() === "{") return this.advance(), this.blockDepth++, this.blockElementDepthStack.push(this.elementDepth), this.createToken(
|
|
3758
|
-
throw new
|
|
3759
|
-
} else return this.skipWhitespace(), this.peek() === "{" && (this.advance(), this.blockDepth++, this.blockElementDepthStack.push(this.elementDepth)), this.createToken(
|
|
3739
|
+
if (this.skipWhitespace(), this.peek() === "{") return this.advance(), this.blockDepth++, this.blockElementDepthStack.push(this.elementDepth), this.createToken(H.DirectiveFallback, "", e);
|
|
3740
|
+
throw new K("Expected '{' after @fallback directive", e.line, e.column, e.offset);
|
|
3741
|
+
} else return this.skipWhitespace(), this.peek() === "{" && (this.advance(), this.blockDepth++, this.blockElementDepthStack.push(this.elementDepth)), this.createToken(H.DirectiveDefault, "", e);
|
|
3760
3742
|
}
|
|
3761
3743
|
readDirectiveHeader(e, t) {
|
|
3762
3744
|
this.skipWhitespace();
|
|
3763
|
-
let n = "", r = 0, i = 0, a = 0, o = [], s = null, c = !1, l = !1, u = !1, d = !1, f = !1, p =
|
|
3745
|
+
let n = "", r = 0, i = 0, a = 0, o = [], s = null, c = !1, l = !1, u = !1, d = !1, f = !1, p = W.Start;
|
|
3764
3746
|
for (; !this.isAtEnd();) {
|
|
3765
3747
|
let m = this.advance();
|
|
3766
3748
|
if (l) {
|
|
@@ -3772,17 +3754,17 @@ var Zt = /* @__PURE__ */ new Set([
|
|
|
3772
3754
|
continue;
|
|
3773
3755
|
}
|
|
3774
3756
|
if (d) {
|
|
3775
|
-
n += m, c ? c = !1 : m === "\\" ? c = !0 : m === "[" ? f = !0 : m === "]" && f ? f = !1 : m === "/" && !f && (d = !1, p =
|
|
3757
|
+
n += m, c ? c = !1 : m === "\\" ? c = !0 : m === "[" ? f = !0 : m === "]" && f ? f = !1 : m === "/" && !f && (d = !1, p = W.IdentifierOrLiteral);
|
|
3776
3758
|
continue;
|
|
3777
3759
|
}
|
|
3778
3760
|
if (s !== null) {
|
|
3779
3761
|
if (n += m, c) c = !1;
|
|
3780
3762
|
else if (m === "\\") c = !0;
|
|
3781
|
-
else if (m === s) s = null, p =
|
|
3763
|
+
else if (m === s) s = null, p = W.IdentifierOrLiteral;
|
|
3782
3764
|
else if (s === "`" && m === "{" && n.endsWith("${")) {
|
|
3783
3765
|
let e = 0;
|
|
3784
3766
|
for (let t = n.length - 3; t >= 0 && n[t] === "\\"; t--) e++;
|
|
3785
|
-
e % 2 == 0 && (o.push(a), s = null, a++, p =
|
|
3767
|
+
e % 2 == 0 && (o.push(a), s = null, a++, p = W.Start);
|
|
3786
3768
|
}
|
|
3787
3769
|
continue;
|
|
3788
3770
|
}
|
|
@@ -3797,164 +3779,164 @@ var Zt = /* @__PURE__ */ new Set([
|
|
|
3797
3779
|
} else if (this.isRegexStart(p)) {
|
|
3798
3780
|
d = !0, f = !1, n += m;
|
|
3799
3781
|
continue;
|
|
3800
|
-
} else p =
|
|
3782
|
+
} else p = W.Punctuator;
|
|
3801
3783
|
}
|
|
3802
3784
|
if (m === "\"" || m === "'" || m === "`") {
|
|
3803
3785
|
s = m, n += m;
|
|
3804
3786
|
continue;
|
|
3805
3787
|
}
|
|
3806
3788
|
if (m === "(") {
|
|
3807
|
-
r++, p =
|
|
3789
|
+
r++, p = W.Start, n += m;
|
|
3808
3790
|
continue;
|
|
3809
3791
|
}
|
|
3810
3792
|
if (m === ")") {
|
|
3811
|
-
r > 0 && r--, p =
|
|
3793
|
+
r > 0 && r--, p = W.IdentifierOrLiteral, n += m;
|
|
3812
3794
|
continue;
|
|
3813
3795
|
}
|
|
3814
3796
|
if (m === "[") {
|
|
3815
|
-
i++, p =
|
|
3797
|
+
i++, p = W.Start, n += m;
|
|
3816
3798
|
continue;
|
|
3817
3799
|
}
|
|
3818
3800
|
if (m === "]") {
|
|
3819
|
-
i > 0 && i--, p =
|
|
3801
|
+
i > 0 && i--, p = W.IdentifierOrLiteral, n += m;
|
|
3820
3802
|
continue;
|
|
3821
3803
|
}
|
|
3822
3804
|
if (m === "{") {
|
|
3823
3805
|
if (!/\b(as|catch)\s*$/.test(n) && r === 0 && i === 0 && a === 0 && o.length === 0) return this.blockDepth++, this.blockElementDepthStack.push(this.elementDepth), this.createToken(t, n.trim(), e);
|
|
3824
|
-
a++, p =
|
|
3806
|
+
a++, p = W.Start, n += m;
|
|
3825
3807
|
continue;
|
|
3826
3808
|
}
|
|
3827
3809
|
if (m === "}") {
|
|
3828
|
-
a--, o.length > 0 && a === o[o.length - 1] && (o.pop(), s = "`"), p =
|
|
3810
|
+
a--, o.length > 0 && a === o[o.length - 1] && (o.pop(), s = "`"), p = W.IdentifierOrLiteral, n += m;
|
|
3829
3811
|
continue;
|
|
3830
3812
|
}
|
|
3831
3813
|
if (m === "+" || m === "-") {
|
|
3832
3814
|
if (this.peek() === m) {
|
|
3833
3815
|
let e = this.advance();
|
|
3834
|
-
n += m + e, p = p ===
|
|
3816
|
+
n += m + e, p = p === W.IdentifierOrLiteral ? W.PostfixOp : W.Start;
|
|
3835
3817
|
continue;
|
|
3836
3818
|
}
|
|
3837
|
-
p =
|
|
3819
|
+
p = W.Punctuator, n += m;
|
|
3838
3820
|
continue;
|
|
3839
3821
|
}
|
|
3840
3822
|
if ("=(,:;!&|?*%<>~^".includes(m)) {
|
|
3841
|
-
p =
|
|
3823
|
+
p = W.Punctuator, n += m;
|
|
3842
3824
|
continue;
|
|
3843
3825
|
}
|
|
3844
3826
|
if (/[a-zA-Z0-9_$]/.test(m)) {
|
|
3845
3827
|
let e = m;
|
|
3846
3828
|
for (; !this.isAtEnd() && /[a-zA-Z0-9_$]/.test(this.peek());) e += this.advance();
|
|
3847
|
-
p =
|
|
3829
|
+
p = $t.has(e) ? W.Keyword : W.IdentifierOrLiteral, n += e;
|
|
3848
3830
|
continue;
|
|
3849
3831
|
}
|
|
3850
3832
|
n += m;
|
|
3851
3833
|
}
|
|
3852
|
-
throw new
|
|
3834
|
+
throw new K("Unterminated directive header, expected '{'", e.line, e.column, e.offset);
|
|
3853
3835
|
}
|
|
3854
3836
|
readTagNameToken(e) {
|
|
3855
3837
|
if (this.isAtEnd()) throw this.createUnexpectedEOFError(e ? "after closing tag opener" : "after opening tag opener");
|
|
3856
3838
|
let t = this.getLocation(), n = this.peek();
|
|
3857
|
-
if (!this.isIdentifierStart(n)) throw new
|
|
3858
|
-
let r = this.readIdentifierValue(), i = !e &&
|
|
3839
|
+
if (!this.isIdentifierStart(n)) throw new K(`Expected tag name but found '${n || "EOF"}'`, t.line, t.column, t.offset);
|
|
3840
|
+
let r = this.readIdentifierValue(), i = !e && Zt(r);
|
|
3859
3841
|
return this.transitionTo({
|
|
3860
|
-
kind:
|
|
3842
|
+
kind: U.BeforeAttributeName,
|
|
3861
3843
|
tagName: r,
|
|
3862
3844
|
isClosingTag: e,
|
|
3863
3845
|
entersRawText: i
|
|
3864
|
-
}), this.createToken(
|
|
3846
|
+
}), this.createToken(H.Identifier, r, t);
|
|
3865
3847
|
}
|
|
3866
3848
|
readBeforeAttributeNameToken() {
|
|
3867
3849
|
let t = this.state;
|
|
3868
|
-
if (t.kind !==
|
|
3850
|
+
if (t.kind !== U.BeforeAttributeName) throw Error(`Expected BeforeAttributeName state but found '${t.kind}'.`);
|
|
3869
3851
|
if (this.skipWhitespace(), this.isAtEnd()) throw this.createUnexpectedEOFError(`inside tag <${t.tagName}>`);
|
|
3870
3852
|
let n = this.getLocation();
|
|
3871
3853
|
if (t.isClosingTag) {
|
|
3872
|
-
if (this.peek() !== ">") throw new
|
|
3873
|
-
return this.advance(), this.elementDepth > 0 && this.elementDepth--, this.transitionTo({ kind:
|
|
3854
|
+
if (this.peek() !== ">") throw new K(`Unexpected character '${this.peek()}' inside closing tag </${t.tagName}>`, n.line, n.column, n.offset);
|
|
3855
|
+
return this.advance(), this.elementDepth > 0 && this.elementDepth--, this.transitionTo({ kind: U.Data }), this.createToken(H.TagClose, ">", n);
|
|
3874
3856
|
}
|
|
3875
3857
|
if (this.peek() === "/") {
|
|
3876
3858
|
let e = 1;
|
|
3877
3859
|
for (; this.peek(e) === " " || this.peek(e) === " " || this.peek(e) === "\n" || this.peek(e) === "\r";) e++;
|
|
3878
3860
|
if (this.peek(e) === ">") {
|
|
3879
3861
|
for (let t = 0; t <= e; t++) this.advance();
|
|
3880
|
-
return this.transitionTo({ kind:
|
|
3862
|
+
return this.transitionTo({ kind: U.Data }), this.createToken(H.TagSelfClose, "/>", n);
|
|
3881
3863
|
}
|
|
3882
3864
|
}
|
|
3883
|
-
if (this.peek() === ">") return this.advance(), e.has(t.tagName.toLowerCase()) || this.elementDepth++, t.entersRawText &&
|
|
3884
|
-
kind:
|
|
3865
|
+
if (this.peek() === ">") return this.advance(), e.has(t.tagName.toLowerCase()) || this.elementDepth++, t.entersRawText && Zt(t.tagName) ? this.transitionTo({
|
|
3866
|
+
kind: U.RawText,
|
|
3885
3867
|
tagName: t.tagName
|
|
3886
|
-
}) : this.transitionTo({ kind:
|
|
3887
|
-
if (!this.isIdentifierStart(this.peek())) throw new
|
|
3868
|
+
}) : this.transitionTo({ kind: U.Data }), this.createToken(H.TagClose, ">", n);
|
|
3869
|
+
if (!this.isIdentifierStart(this.peek())) throw new K(`Unexpected character '${this.peek()}' inside tag <${t.tagName}>`, n.line, n.column, n.offset);
|
|
3888
3870
|
return this.transitionTo({
|
|
3889
|
-
kind:
|
|
3871
|
+
kind: U.AttributeName,
|
|
3890
3872
|
tagName: t.tagName,
|
|
3891
3873
|
attributeName: null
|
|
3892
3874
|
}), this.readAttributeNameToken();
|
|
3893
3875
|
}
|
|
3894
3876
|
readAttributeNameToken() {
|
|
3895
3877
|
let e = this.state;
|
|
3896
|
-
if (e.kind !==
|
|
3878
|
+
if (e.kind !== U.AttributeName) throw Error(`Expected AttributeName state but found '${e.kind}'.`);
|
|
3897
3879
|
let t = this.getLocation();
|
|
3898
|
-
if (!this.isIdentifierStart(this.peek())) throw new
|
|
3880
|
+
if (!this.isIdentifierStart(this.peek())) throw new K(`Expected attribute name but found '${this.peek() || "EOF"}'`, t.line, t.column, t.offset);
|
|
3899
3881
|
let n = this.readIdentifierValue(), r = e.tagName;
|
|
3900
3882
|
return this.transitionTo({
|
|
3901
|
-
kind:
|
|
3883
|
+
kind: U.AfterAttributeName,
|
|
3902
3884
|
tagName: r,
|
|
3903
3885
|
attributeName: n
|
|
3904
|
-
}), this.createToken(
|
|
3886
|
+
}), this.createToken(H.Identifier, n, t);
|
|
3905
3887
|
}
|
|
3906
3888
|
readAfterAttributeNameToken() {
|
|
3907
3889
|
let e = this.state;
|
|
3908
|
-
if (e.kind !==
|
|
3890
|
+
if (e.kind !== U.AfterAttributeName) throw Error(`Expected AfterAttributeName state but found '${e.kind}'.`);
|
|
3909
3891
|
let t = e.tagName, n = e.attributeName;
|
|
3910
3892
|
if (this.skipWhitespace(), this.isAtEnd()) throw this.createUnexpectedEOFError(`after attribute '${n}' in <${t}>`);
|
|
3911
3893
|
if (this.peek() === "=") {
|
|
3912
3894
|
let e = this.getLocation();
|
|
3913
3895
|
return this.advance(), this.transitionTo({
|
|
3914
|
-
kind:
|
|
3896
|
+
kind: U.BeforeAttributeValue,
|
|
3915
3897
|
tagName: t,
|
|
3916
3898
|
attributeName: n
|
|
3917
|
-
}), this.createToken(
|
|
3899
|
+
}), this.createToken(H.Equals, "=", e);
|
|
3918
3900
|
}
|
|
3919
3901
|
return this.transitionTo({
|
|
3920
|
-
kind:
|
|
3902
|
+
kind: U.BeforeAttributeName,
|
|
3921
3903
|
tagName: t,
|
|
3922
3904
|
isClosingTag: !1,
|
|
3923
|
-
entersRawText:
|
|
3905
|
+
entersRawText: Zt(t)
|
|
3924
3906
|
}), this.readBeforeAttributeNameToken();
|
|
3925
3907
|
}
|
|
3926
3908
|
readBeforeAttributeValueToken() {
|
|
3927
3909
|
let e = this.state;
|
|
3928
|
-
if (e.kind !==
|
|
3910
|
+
if (e.kind !== U.BeforeAttributeValue) throw Error(`Expected BeforeAttributeValue state but found '${e.kind}'.`);
|
|
3929
3911
|
let t = e.tagName, n = e.attributeName;
|
|
3930
3912
|
if (this.skipWhitespace(), this.isAtEnd()) throw this.createUnexpectedEOFError(`before value for attribute '${n}' in <${t}>`);
|
|
3931
3913
|
let r = this.getLocation(), i = this.peek();
|
|
3932
3914
|
if (i === "\"" || i === "'") return this.advance(), this.transitionTo({
|
|
3933
|
-
kind:
|
|
3915
|
+
kind: U.AttributeValueQuoted,
|
|
3934
3916
|
tagName: t,
|
|
3935
3917
|
attributeName: n,
|
|
3936
3918
|
quote: i
|
|
3937
3919
|
}), this.readQuotedStringToken(r, i, t);
|
|
3938
3920
|
if (i === "{") return this.advance(), this.transitionTo({
|
|
3939
|
-
kind:
|
|
3921
|
+
kind: U.AttributeValueInterpolation,
|
|
3940
3922
|
tagName: t,
|
|
3941
3923
|
attributeName: n
|
|
3942
3924
|
}), this.readInterpolationToken(r, "attribute", t);
|
|
3943
|
-
throw new
|
|
3925
|
+
throw new K(`Expected quoted string or interpolation for attribute '${n}' in <${t}>`, r.line, r.column, r.offset);
|
|
3944
3926
|
}
|
|
3945
3927
|
readCommentToken(e) {
|
|
3946
3928
|
let t = "";
|
|
3947
3929
|
for (; !this.isAtEnd();) {
|
|
3948
|
-
if (this.startsWith("-->")) return this.consumePattern("-->"), this.transitionTo({ kind:
|
|
3930
|
+
if (this.startsWith("-->")) return this.consumePattern("-->"), this.transitionTo({ kind: U.Data }), this.createToken(H.Comment, t, e);
|
|
3949
3931
|
t += this.advance();
|
|
3950
3932
|
}
|
|
3951
|
-
throw new
|
|
3933
|
+
throw new K("Unterminated XML comment", e.line, e.column, e.offset);
|
|
3952
3934
|
}
|
|
3953
3935
|
isRegexStart(e) {
|
|
3954
|
-
return e ===
|
|
3936
|
+
return e === W.Start || e === W.Punctuator || e === W.Keyword;
|
|
3955
3937
|
}
|
|
3956
3938
|
readInterpolationToken(e, t, n) {
|
|
3957
|
-
let r = 1, i = null, a = !1, o = !1, s = !1, c = !1, l = !1, u =
|
|
3939
|
+
let r = 1, i = null, a = !1, o = !1, s = !1, c = !1, l = !1, u = W.Start, d = [], f = "";
|
|
3958
3940
|
for (; !this.isAtEnd();) {
|
|
3959
3941
|
let p = this.advance();
|
|
3960
3942
|
if (o) {
|
|
@@ -3966,17 +3948,17 @@ var Zt = /* @__PURE__ */ new Set([
|
|
|
3966
3948
|
continue;
|
|
3967
3949
|
}
|
|
3968
3950
|
if (c) {
|
|
3969
|
-
f += p, a ? a = !1 : p === "\\" ? a = !0 : p === "[" ? l = !0 : p === "]" && l ? l = !1 : p === "/" && !l && (c = !1, u =
|
|
3951
|
+
f += p, a ? a = !1 : p === "\\" ? a = !0 : p === "[" ? l = !0 : p === "]" && l ? l = !1 : p === "/" && !l && (c = !1, u = W.IdentifierOrLiteral);
|
|
3970
3952
|
continue;
|
|
3971
3953
|
}
|
|
3972
3954
|
if (i !== null) {
|
|
3973
3955
|
if (f += p, a) a = !1;
|
|
3974
3956
|
else if (p === "\\") a = !0;
|
|
3975
|
-
else if (p === i) i = null, u =
|
|
3957
|
+
else if (p === i) i = null, u = W.IdentifierOrLiteral;
|
|
3976
3958
|
else if (i === "`" && p === "{" && f.endsWith("${")) {
|
|
3977
3959
|
let e = 0;
|
|
3978
3960
|
for (let t = f.length - 3; t >= 0 && f[t] === "\\"; t--) e++;
|
|
3979
|
-
e % 2 == 0 && (d.push(r), i = null, r++, u =
|
|
3961
|
+
e % 2 == 0 && (d.push(r), i = null, r++, u = W.Start);
|
|
3980
3962
|
}
|
|
3981
3963
|
continue;
|
|
3982
3964
|
}
|
|
@@ -3991,7 +3973,7 @@ var Zt = /* @__PURE__ */ new Set([
|
|
|
3991
3973
|
} else if (this.isRegexStart(u)) {
|
|
3992
3974
|
c = !0, l = !1, f += p;
|
|
3993
3975
|
continue;
|
|
3994
|
-
} else u =
|
|
3976
|
+
} else u = W.Punctuator;
|
|
3995
3977
|
}
|
|
3996
3978
|
if (p === "\"" || p === "'" || p === "`") {
|
|
3997
3979
|
inQuote: i = p;
|
|
@@ -3999,67 +3981,67 @@ var Zt = /* @__PURE__ */ new Set([
|
|
|
3999
3981
|
continue;
|
|
4000
3982
|
}
|
|
4001
3983
|
if (p === "(") {
|
|
4002
|
-
u =
|
|
3984
|
+
u = W.Start, f += p;
|
|
4003
3985
|
continue;
|
|
4004
3986
|
}
|
|
4005
3987
|
if (p === ")") {
|
|
4006
|
-
u =
|
|
3988
|
+
u = W.IdentifierOrLiteral, f += p;
|
|
4007
3989
|
continue;
|
|
4008
3990
|
}
|
|
4009
3991
|
if (p === "[") {
|
|
4010
|
-
u =
|
|
3992
|
+
u = W.Start, f += p;
|
|
4011
3993
|
continue;
|
|
4012
3994
|
}
|
|
4013
3995
|
if (p === "]") {
|
|
4014
|
-
u =
|
|
3996
|
+
u = W.IdentifierOrLiteral, f += p;
|
|
4015
3997
|
continue;
|
|
4016
3998
|
}
|
|
4017
3999
|
if (p === "{") {
|
|
4018
|
-
r++, u =
|
|
4000
|
+
r++, u = W.Start, f += p;
|
|
4019
4001
|
continue;
|
|
4020
4002
|
}
|
|
4021
4003
|
if (p === "}") {
|
|
4022
|
-
if (r--, d.length > 0 && r === d[d.length - 1] && (d.pop(), i = "`"), u =
|
|
4023
|
-
kind:
|
|
4004
|
+
if (r--, d.length > 0 && r === d[d.length - 1] && (d.pop(), i = "`"), u = W.IdentifierOrLiteral, r === 0) return t === "attribute" && n !== null ? this.transitionTo({
|
|
4005
|
+
kind: U.BeforeAttributeName,
|
|
4024
4006
|
tagName: n,
|
|
4025
4007
|
isClosingTag: !1,
|
|
4026
|
-
entersRawText:
|
|
4027
|
-
}) : this.transitionTo({ kind:
|
|
4008
|
+
entersRawText: Zt(n)
|
|
4009
|
+
}) : this.transitionTo({ kind: U.Data }), this.createToken(H.Interpolation, f, e);
|
|
4028
4010
|
f += p;
|
|
4029
4011
|
continue;
|
|
4030
4012
|
}
|
|
4031
4013
|
if (p === "+" || p === "-") {
|
|
4032
4014
|
if (this.peek() === p) {
|
|
4033
4015
|
let e = this.advance();
|
|
4034
|
-
f += p + e, u = u ===
|
|
4016
|
+
f += p + e, u = u === W.IdentifierOrLiteral ? W.PostfixOp : W.Start;
|
|
4035
4017
|
continue;
|
|
4036
4018
|
}
|
|
4037
|
-
u =
|
|
4019
|
+
u = W.Punctuator, f += p;
|
|
4038
4020
|
continue;
|
|
4039
4021
|
}
|
|
4040
4022
|
if ("=(,:;!&|?*%<>~^".includes(p)) {
|
|
4041
|
-
u =
|
|
4023
|
+
u = W.Punctuator, f += p;
|
|
4042
4024
|
continue;
|
|
4043
4025
|
}
|
|
4044
4026
|
if (/[a-zA-Z0-9_$]/.test(p)) {
|
|
4045
4027
|
let e = p;
|
|
4046
4028
|
for (; !this.isAtEnd() && /[a-zA-Z0-9_$]/.test(this.peek());) e += this.advance();
|
|
4047
|
-
u =
|
|
4029
|
+
u = $t.has(e) ? W.Keyword : W.IdentifierOrLiteral, f += e;
|
|
4048
4030
|
continue;
|
|
4049
4031
|
}
|
|
4050
4032
|
f += p;
|
|
4051
4033
|
}
|
|
4052
|
-
throw new
|
|
4034
|
+
throw new K("Unterminated interpolation expression, expected closing brace '}'", e.line, e.column, e.offset);
|
|
4053
4035
|
}
|
|
4054
4036
|
readRawTextToken() {
|
|
4055
4037
|
let e = this.state;
|
|
4056
|
-
if (e.kind !==
|
|
4038
|
+
if (e.kind !== U.RawText) throw Error(`Expected RawText state but found '${e.kind}'.`);
|
|
4057
4039
|
let t = this.getLocation(), n = `</${e.tagName}`;
|
|
4058
|
-
if (this.isAtEnd()) return this.transitionTo({ kind:
|
|
4059
|
-
if (this.isRawTextClosingTagAhead(n)) return this.consumePattern("</"), this.transitionTo({ kind:
|
|
4040
|
+
if (this.isAtEnd()) return this.transitionTo({ kind: U.EOF }), this.getOrCreateEOFToken(t);
|
|
4041
|
+
if (this.isRawTextClosingTagAhead(n)) return this.consumePattern("</"), this.transitionTo({ kind: U.EndTagOpen }), this.createToken(H.TagOpenSlash, "</", t);
|
|
4060
4042
|
let r = "";
|
|
4061
4043
|
for (; !this.isAtEnd() && !this.isRawTextClosingTagAhead(n);) r += this.advance();
|
|
4062
|
-
return r.length > 0 ? this.createToken(
|
|
4044
|
+
return r.length > 0 ? this.createToken(H.Text, r, t) : (this.transitionTo({ kind: U.EOF }), this.getOrCreateEOFToken(t));
|
|
4063
4045
|
}
|
|
4064
4046
|
readTextToken() {
|
|
4065
4047
|
let e = this.getLocation(), t = "", n = () => this.blockDepth > 0 && this.blockElementDepthStack.length > 0 && this.elementDepth === this.blockElementDepthStack[this.blockElementDepthStack.length - 1];
|
|
@@ -4068,7 +4050,7 @@ var Zt = /* @__PURE__ */ new Set([
|
|
|
4068
4050
|
if (e === "<" || e === "{" || e === "@" || e === "}" && n()) break;
|
|
4069
4051
|
t += this.advance();
|
|
4070
4052
|
}
|
|
4071
|
-
return this.createToken(
|
|
4053
|
+
return this.createToken(H.Text, t, e);
|
|
4072
4054
|
}
|
|
4073
4055
|
readQuotedStringToken(e, t, n) {
|
|
4074
4056
|
let r = "", i = !1;
|
|
@@ -4083,14 +4065,14 @@ var Zt = /* @__PURE__ */ new Set([
|
|
|
4083
4065
|
continue;
|
|
4084
4066
|
}
|
|
4085
4067
|
if (a === t) return this.advance(), this.transitionTo({
|
|
4086
|
-
kind:
|
|
4068
|
+
kind: U.BeforeAttributeName,
|
|
4087
4069
|
tagName: n,
|
|
4088
4070
|
isClosingTag: !1,
|
|
4089
|
-
entersRawText:
|
|
4090
|
-
}), this.createToken(
|
|
4071
|
+
entersRawText: Zt(n)
|
|
4072
|
+
}), this.createToken(H.StringLiteral, r, e);
|
|
4091
4073
|
r += this.advance();
|
|
4092
4074
|
}
|
|
4093
|
-
throw new
|
|
4075
|
+
throw new K(`Unterminated string literal, expected closing quote ${t}`, e.line, e.column, e.offset);
|
|
4094
4076
|
}
|
|
4095
4077
|
readIdentifierValue() {
|
|
4096
4078
|
let e = "";
|
|
@@ -4099,7 +4081,7 @@ var Zt = /* @__PURE__ */ new Set([
|
|
|
4099
4081
|
}
|
|
4100
4082
|
getOrCreateEOFToken(e = this.getLocation()) {
|
|
4101
4083
|
return this.eofToken === null && (this.eofToken = {
|
|
4102
|
-
type:
|
|
4084
|
+
type: H.EOF,
|
|
4103
4085
|
value: "",
|
|
4104
4086
|
loc: {
|
|
4105
4087
|
start: e,
|
|
@@ -4119,10 +4101,10 @@ var Zt = /* @__PURE__ */ new Set([
|
|
|
4119
4101
|
}
|
|
4120
4102
|
createUnexpectedEOFError(e) {
|
|
4121
4103
|
let t = this.getLocation();
|
|
4122
|
-
return new
|
|
4104
|
+
return new K(`Unexpected end of input ${e}`, t.line, t.column, t.offset);
|
|
4123
4105
|
}
|
|
4124
4106
|
transitionTo(e) {
|
|
4125
|
-
if (!
|
|
4107
|
+
if (!Xt[this.state.kind].some((t) => t.to === e.kind)) throw Error(`Invalid lexer transition from '${this.state.kind}' to '${e.kind}'.`);
|
|
4126
4108
|
this.state = e;
|
|
4127
4109
|
}
|
|
4128
4110
|
getLocation() {
|
|
@@ -4172,7 +4154,7 @@ var Zt = /* @__PURE__ */ new Set([
|
|
|
4172
4154
|
let n = this.peek(t);
|
|
4173
4155
|
return n === "" || n === ">" || n === " " || n === " " || n === "\r" || n === "\n";
|
|
4174
4156
|
}
|
|
4175
|
-
},
|
|
4157
|
+
}, tn = class {
|
|
4176
4158
|
tokens;
|
|
4177
4159
|
current = 0;
|
|
4178
4160
|
constructor(e) {
|
|
@@ -4183,7 +4165,7 @@ var Zt = /* @__PURE__ */ new Set([
|
|
|
4183
4165
|
let e = this.tokens[this.current];
|
|
4184
4166
|
return this.current++, e;
|
|
4185
4167
|
}
|
|
4186
|
-
},
|
|
4168
|
+
}, nn = {
|
|
4187
4169
|
amp: "&",
|
|
4188
4170
|
lt: "<",
|
|
4189
4171
|
gt: ">",
|
|
@@ -4326,7 +4308,7 @@ var Zt = /* @__PURE__ */ new Set([
|
|
|
4326
4308
|
psi: "ψ",
|
|
4327
4309
|
omega: "ω"
|
|
4328
4310
|
};
|
|
4329
|
-
function
|
|
4311
|
+
function rn(e) {
|
|
4330
4312
|
return !e || !e.includes("&") ? e : e.replace(/&(?:#(\d+)|#x([0-9a-fA-F]+)|([a-zA-Z0-9]+));/g, (e, t, n, r) => {
|
|
4331
4313
|
if (t) {
|
|
4332
4314
|
let e = parseInt(t, 10);
|
|
@@ -4344,14 +4326,32 @@ function nn(e) {
|
|
|
4344
4326
|
return "�";
|
|
4345
4327
|
}
|
|
4346
4328
|
}
|
|
4347
|
-
return r &&
|
|
4329
|
+
return r && nn[r] || e;
|
|
4348
4330
|
});
|
|
4349
4331
|
}
|
|
4350
|
-
|
|
4332
|
+
function an(e) {
|
|
4333
|
+
let t = e.trim();
|
|
4334
|
+
if (!t.startsWith("(") || !t.endsWith(")")) return !1;
|
|
4335
|
+
let n = 0, r = null, i = !1;
|
|
4336
|
+
for (let e = 0; e < t.length - 1; e++) {
|
|
4337
|
+
let a = t[e];
|
|
4338
|
+
if (r !== null) {
|
|
4339
|
+
i ? i = !1 : a === "\\" ? i = !0 : a === r && (r = null);
|
|
4340
|
+
continue;
|
|
4341
|
+
}
|
|
4342
|
+
if (a === "\"" || a === "'" || a === "`") {
|
|
4343
|
+
r = a;
|
|
4344
|
+
continue;
|
|
4345
|
+
}
|
|
4346
|
+
if (a === "(" ? n++ : a === ")" && n--, n === 0) return !1;
|
|
4347
|
+
}
|
|
4348
|
+
return n === 1;
|
|
4349
|
+
}
|
|
4350
|
+
var on = class {
|
|
4351
4351
|
tokenSource;
|
|
4352
4352
|
lookahead = [];
|
|
4353
4353
|
constructor(e) {
|
|
4354
|
-
this.tokenSource = Array.isArray(e) ? new
|
|
4354
|
+
this.tokenSource = Array.isArray(e) ? new tn(e) : e;
|
|
4355
4355
|
}
|
|
4356
4356
|
parse() {
|
|
4357
4357
|
return this.lookahead.length = 0, this.parseProgram();
|
|
@@ -4361,7 +4361,7 @@ var rn = class {
|
|
|
4361
4361
|
for (; !this.isAtEnd();) t.push(this.parseChild());
|
|
4362
4362
|
let n = this.peek().loc.end;
|
|
4363
4363
|
return {
|
|
4364
|
-
type:
|
|
4364
|
+
type: G.Program,
|
|
4365
4365
|
body: t,
|
|
4366
4366
|
loc: {
|
|
4367
4367
|
start: e,
|
|
@@ -4371,35 +4371,35 @@ var rn = class {
|
|
|
4371
4371
|
}
|
|
4372
4372
|
parseChild() {
|
|
4373
4373
|
let e = this.peek();
|
|
4374
|
-
if (e.type ===
|
|
4375
|
-
type:
|
|
4374
|
+
if (e.type === H.Comment) return this.advance(), {
|
|
4375
|
+
type: G.Comment,
|
|
4376
4376
|
content: e.value,
|
|
4377
4377
|
loc: e.loc
|
|
4378
4378
|
};
|
|
4379
|
-
if (e.type ===
|
|
4380
|
-
type:
|
|
4379
|
+
if (e.type === H.Interpolation) return this.advance(), {
|
|
4380
|
+
type: G.Interpolation,
|
|
4381
4381
|
expression: e.value,
|
|
4382
4382
|
loc: e.loc
|
|
4383
4383
|
};
|
|
4384
|
-
if (e.type ===
|
|
4385
|
-
if (e.type ===
|
|
4386
|
-
if (e.type ===
|
|
4387
|
-
if (e.type ===
|
|
4388
|
-
if (e.type ===
|
|
4389
|
-
if (e.type ===
|
|
4390
|
-
type:
|
|
4391
|
-
content:
|
|
4384
|
+
if (e.type === H.TagOpen) return this.parseElement();
|
|
4385
|
+
if (e.type === H.DirectiveIf) return this.parseIfDirective();
|
|
4386
|
+
if (e.type === H.DirectiveFor) return this.parseForDirective();
|
|
4387
|
+
if (e.type === H.DirectiveSwitch) return this.parseSwitchDirective();
|
|
4388
|
+
if (e.type === H.DirectiveAsync) return this.parseAsyncDirective();
|
|
4389
|
+
if (e.type === H.Text) return this.advance(), {
|
|
4390
|
+
type: G.Text,
|
|
4391
|
+
content: rn(e.value),
|
|
4392
4392
|
loc: e.loc
|
|
4393
4393
|
};
|
|
4394
|
-
throw e.type ===
|
|
4394
|
+
throw e.type === H.TagOpenSlash ? new q(`Unexpected closing tag '</${this.peek(1).value}>' without opening tag`, e.loc.start.line, e.loc.start.column, e.loc.start.offset) : new q(`Unexpected token '${e.value}' of type '${e.type}'`, e.loc.start.line, e.loc.start.column, e.loc.start.offset);
|
|
4395
4395
|
}
|
|
4396
4396
|
parseElement() {
|
|
4397
|
-
let t = this.consume(
|
|
4398
|
-
for (; !this.check(
|
|
4399
|
-
if (this.check(
|
|
4397
|
+
let t = this.consume(H.TagOpen, "Expected opening tag bracket").loc.start, n = this.consume(H.Identifier, "Expected tag name after opening bracket").value, r = [];
|
|
4398
|
+
for (; !this.check(H.TagClose) && !this.check(H.TagSelfClose) && !this.isAtEnd();) r.push(this.parseAttribute());
|
|
4399
|
+
if (this.check(H.TagSelfClose)) {
|
|
4400
4400
|
let e = this.advance();
|
|
4401
4401
|
return {
|
|
4402
|
-
type:
|
|
4402
|
+
type: G.Element,
|
|
4403
4403
|
tagName: n,
|
|
4404
4404
|
attributes: r,
|
|
4405
4405
|
children: [],
|
|
@@ -4410,9 +4410,9 @@ var rn = class {
|
|
|
4410
4410
|
}
|
|
4411
4411
|
};
|
|
4412
4412
|
}
|
|
4413
|
-
let i = this.consume(
|
|
4413
|
+
let i = this.consume(H.TagClose, "Expected closing bracket after attributes");
|
|
4414
4414
|
if (e.has(n.toLowerCase())) return {
|
|
4415
|
-
type:
|
|
4415
|
+
type: G.Element,
|
|
4416
4416
|
tagName: n,
|
|
4417
4417
|
attributes: r,
|
|
4418
4418
|
children: [],
|
|
@@ -4423,21 +4423,21 @@ var rn = class {
|
|
|
4423
4423
|
}
|
|
4424
4424
|
};
|
|
4425
4425
|
let a = n.toLowerCase() === "script" || n.toLowerCase() === "style", o = [];
|
|
4426
|
-
for (; !this.check(
|
|
4426
|
+
for (; !this.check(H.TagOpenSlash) && !this.isAtEnd();) if (a && this.check(H.Text)) {
|
|
4427
4427
|
let e = this.advance();
|
|
4428
4428
|
o.push({
|
|
4429
|
-
type:
|
|
4429
|
+
type: G.Text,
|
|
4430
4430
|
content: e.value,
|
|
4431
4431
|
loc: e.loc
|
|
4432
4432
|
});
|
|
4433
4433
|
} else o.push(this.parseChild());
|
|
4434
|
-
if (this.isAtEnd()) throw new
|
|
4435
|
-
this.consume(
|
|
4436
|
-
let s = this.consume(
|
|
4437
|
-
if (s.value !== n && s.value.toLowerCase() !== n.toLowerCase()) throw new
|
|
4438
|
-
let c = this.consume(
|
|
4434
|
+
if (this.isAtEnd()) throw new q(`Unclosed element '<${n}>', expected closing tag '</${n}>'`, t.line, t.column, t.offset);
|
|
4435
|
+
this.consume(H.TagOpenSlash, `Expected closing tag '</${n}>'`);
|
|
4436
|
+
let s = this.consume(H.Identifier, "Expected closing tag name");
|
|
4437
|
+
if (s.value !== n && s.value.toLowerCase() !== n.toLowerCase()) throw new q(`Mismatched closing tag. Expected '</${n}>' but got '</${s.value}>'`, s.loc.start.line, s.loc.start.column, s.loc.start.offset);
|
|
4438
|
+
let c = this.consume(H.TagClose, "Expected '>' after closing tag name");
|
|
4439
4439
|
return {
|
|
4440
|
-
type:
|
|
4440
|
+
type: G.Element,
|
|
4441
4441
|
tagName: n,
|
|
4442
4442
|
attributes: r,
|
|
4443
4443
|
children: o,
|
|
@@ -4449,27 +4449,27 @@ var rn = class {
|
|
|
4449
4449
|
};
|
|
4450
4450
|
}
|
|
4451
4451
|
parseAttribute() {
|
|
4452
|
-
let e = this.consume(
|
|
4453
|
-
if (this.matchToken(
|
|
4452
|
+
let e = this.consume(H.Identifier, "Expected attribute name"), t = e.loc.start, n = e.value;
|
|
4453
|
+
if (this.matchToken(H.Equals)) {
|
|
4454
4454
|
let e = this.peek();
|
|
4455
|
-
if (e.type ===
|
|
4456
|
-
type:
|
|
4455
|
+
if (e.type === H.StringLiteral) return this.advance(), {
|
|
4456
|
+
type: G.Attribute,
|
|
4457
4457
|
name: n,
|
|
4458
|
-
value:
|
|
4458
|
+
value: rn(e.value),
|
|
4459
4459
|
loc: {
|
|
4460
4460
|
start: t,
|
|
4461
4461
|
end: e.loc.end
|
|
4462
4462
|
}
|
|
4463
4463
|
};
|
|
4464
|
-
if (e.type ===
|
|
4464
|
+
if (e.type === H.Interpolation) {
|
|
4465
4465
|
this.advance();
|
|
4466
4466
|
let r = {
|
|
4467
|
-
type:
|
|
4467
|
+
type: G.Interpolation,
|
|
4468
4468
|
expression: e.value,
|
|
4469
4469
|
loc: e.loc
|
|
4470
4470
|
};
|
|
4471
4471
|
return {
|
|
4472
|
-
type:
|
|
4472
|
+
type: G.Attribute,
|
|
4473
4473
|
name: n,
|
|
4474
4474
|
value: r,
|
|
4475
4475
|
loc: {
|
|
@@ -4478,10 +4478,10 @@ var rn = class {
|
|
|
4478
4478
|
}
|
|
4479
4479
|
};
|
|
4480
4480
|
}
|
|
4481
|
-
throw new
|
|
4481
|
+
throw new q(`Expected string literal or interpolation after '=' for attribute '${n}'`, e.loc.start.line, e.loc.start.column, e.loc.start.offset);
|
|
4482
4482
|
}
|
|
4483
4483
|
return {
|
|
4484
|
-
type:
|
|
4484
|
+
type: G.Attribute,
|
|
4485
4485
|
name: n,
|
|
4486
4486
|
value: null,
|
|
4487
4487
|
loc: {
|
|
@@ -4491,19 +4491,19 @@ var rn = class {
|
|
|
4491
4491
|
};
|
|
4492
4492
|
}
|
|
4493
4493
|
parseIfDirective() {
|
|
4494
|
-
let e = this.consume(
|
|
4495
|
-
for (; !this.check(
|
|
4496
|
-
let i = this.consume(
|
|
4497
|
-
if (this.skipWhitespaceTokens(), this.check(
|
|
4498
|
-
else if (this.check(
|
|
4494
|
+
let e = this.consume(H.DirectiveIf, "Expected @if directive"), t = e.loc.start, n = e.value, r = [];
|
|
4495
|
+
for (; !this.check(H.BlockClose) && !this.isAtEnd();) r.push(this.parseChild());
|
|
4496
|
+
let i = this.consume(H.BlockClose, "Expected closing brace } for @if block"), a = null, o = i.loc.end;
|
|
4497
|
+
if (this.skipWhitespaceTokens(), this.check(H.DirectiveElseIf)) a = this.parseElseIfChain(), o = a.loc.end;
|
|
4498
|
+
else if (this.check(H.DirectiveElse)) {
|
|
4499
4499
|
this.advance();
|
|
4500
4500
|
let e = [];
|
|
4501
|
-
for (; !this.check(
|
|
4502
|
-
let t = this.consume(
|
|
4501
|
+
for (; !this.check(H.BlockClose) && !this.isAtEnd();) e.push(this.parseChild());
|
|
4502
|
+
let t = this.consume(H.BlockClose, "Expected closing brace } for @else block");
|
|
4503
4503
|
a = e, o = t.loc.end;
|
|
4504
4504
|
}
|
|
4505
4505
|
return {
|
|
4506
|
-
type:
|
|
4506
|
+
type: G.If,
|
|
4507
4507
|
test: n,
|
|
4508
4508
|
consequent: r,
|
|
4509
4509
|
alternate: a,
|
|
@@ -4514,19 +4514,19 @@ var rn = class {
|
|
|
4514
4514
|
};
|
|
4515
4515
|
}
|
|
4516
4516
|
parseElseIfChain() {
|
|
4517
|
-
let e = this.consume(
|
|
4518
|
-
for (; !this.check(
|
|
4519
|
-
let i = this.consume(
|
|
4520
|
-
if (this.skipWhitespaceTokens(), this.check(
|
|
4521
|
-
else if (this.check(
|
|
4517
|
+
let e = this.consume(H.DirectiveElseIf, "Expected @else if directive"), t = e.loc.start, n = e.value, r = [];
|
|
4518
|
+
for (; !this.check(H.BlockClose) && !this.isAtEnd();) r.push(this.parseChild());
|
|
4519
|
+
let i = this.consume(H.BlockClose, "Expected closing brace } for @else if block"), a = null, o = i.loc.end;
|
|
4520
|
+
if (this.skipWhitespaceTokens(), this.check(H.DirectiveElseIf)) a = this.parseElseIfChain(), o = a.loc.end;
|
|
4521
|
+
else if (this.check(H.DirectiveElse)) {
|
|
4522
4522
|
this.advance();
|
|
4523
4523
|
let e = [];
|
|
4524
|
-
for (; !this.check(
|
|
4525
|
-
let t = this.consume(
|
|
4524
|
+
for (; !this.check(H.BlockClose) && !this.isAtEnd();) e.push(this.parseChild());
|
|
4525
|
+
let t = this.consume(H.BlockClose, "Expected closing brace } for @else block");
|
|
4526
4526
|
a = e, o = t.loc.end;
|
|
4527
4527
|
}
|
|
4528
4528
|
return {
|
|
4529
|
-
type:
|
|
4529
|
+
type: G.If,
|
|
4530
4530
|
test: n,
|
|
4531
4531
|
consequent: r,
|
|
4532
4532
|
alternate: a,
|
|
@@ -4537,93 +4537,125 @@ var rn = class {
|
|
|
4537
4537
|
};
|
|
4538
4538
|
}
|
|
4539
4539
|
parseForDirective() {
|
|
4540
|
-
let e = this.consume(
|
|
4541
|
-
for (;
|
|
4542
|
-
let
|
|
4540
|
+
let e = this.consume(H.DirectiveFor, "Expected @for directive"), t = e.loc.start, n = e.value.trim();
|
|
4541
|
+
for (; an(n);) n = n.slice(1, -1).trim();
|
|
4542
|
+
let r = null, i = 0, a = 0, o = 0, s = null;
|
|
4543
4543
|
try {
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4544
|
+
let e = Gt(n, { ecmaVersion: "latest" });
|
|
4545
|
+
for (let t of e) if (t.type === b.parenL) i++;
|
|
4546
|
+
else if (t.type === b.parenR) i = Math.max(0, i - 1);
|
|
4547
|
+
else if (t.type === b.bracketL) a++;
|
|
4548
|
+
else if (t.type === b.bracketR) a = Math.max(0, a - 1);
|
|
4549
|
+
else if (t.type === b.braceL || t.type === b.dollarBraceL) o++;
|
|
4550
|
+
else if (t.type === b.braceR) o = Math.max(0, o - 1);
|
|
4551
|
+
else if (t.type === b._in && i === 0 && a === 0 && o === 0) {
|
|
4552
|
+
r = t;
|
|
4553
|
+
break;
|
|
4554
|
+
}
|
|
4555
|
+
} catch (e) {
|
|
4556
|
+
s = e;
|
|
4547
4557
|
}
|
|
4548
|
-
if (
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
} else throw new
|
|
4558
|
+
if (!r) throw s ? new q(`Syntax error in @for header: ${s.message}`, e.loc.start.line, e.loc.start.column, e.loc.start.offset) : new q(`Invalid @for header syntax '${e.value.trim()}'. Expected format: 'item in list' or '(item, index) in list'`, e.loc.start.line, e.loc.start.column, e.loc.start.offset);
|
|
4559
|
+
let c = n.slice(0, r.start).trim();
|
|
4560
|
+
if (c.length === 0) throw new q(`Invalid @for header syntax '${e.value.trim()}'. Expected format: 'item in list' or '(item, index) in list'`, e.loc.start.line, e.loc.start.column, e.loc.start.offset);
|
|
4561
|
+
let l = "", u = null;
|
|
4562
|
+
if (an(c)) {
|
|
4563
|
+
let t = c.slice(1, -1).trim(), n = [], r = 0, i = 0, a = 0;
|
|
4564
|
+
try {
|
|
4565
|
+
let e = Gt(t, { ecmaVersion: "latest" });
|
|
4566
|
+
for (let t of e) t.type === b.parenL ? r++ : t.type === b.parenR ? r = Math.max(0, r - 1) : t.type === b.bracketL ? i++ : t.type === b.bracketR ? i = Math.max(0, i - 1) : t.type === b.braceL || t.type === b.dollarBraceL ? a++ : t.type === b.braceR ? a = Math.max(0, a - 1) : t.type === b.comma && r === 0 && i === 0 && a === 0 && n.push(t.start);
|
|
4567
|
+
} catch (t) {
|
|
4568
|
+
throw new q(`Invalid @for target bindings '${c}': ${t.message}`, e.loc.start.line, e.loc.start.column, e.loc.start.offset);
|
|
4569
|
+
}
|
|
4570
|
+
if (n.length === 0) l = t;
|
|
4571
|
+
else if (n.length === 1) {
|
|
4572
|
+
let e = n[0];
|
|
4573
|
+
l = t.slice(0, e).trim(), u = t.slice(e + 1).trim();
|
|
4574
|
+
} else throw new q("Invalid @for target bindings. Expected at most 2 variables (item, index).", e.loc.start.line, e.loc.start.column, e.loc.start.offset);
|
|
4565
4575
|
} else {
|
|
4566
|
-
let n =
|
|
4567
|
-
|
|
4568
|
-
let
|
|
4569
|
-
if (
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4576
|
+
let t = 0, n = 0, r = 0, i = !1;
|
|
4577
|
+
try {
|
|
4578
|
+
let e = Gt(c, { ecmaVersion: "latest" });
|
|
4579
|
+
for (let a of e) if (a.type === b.parenL) t++;
|
|
4580
|
+
else if (a.type === b.parenR) t = Math.max(0, t - 1);
|
|
4581
|
+
else if (a.type === b.bracketL) n++;
|
|
4582
|
+
else if (a.type === b.bracketR) n = Math.max(0, n - 1);
|
|
4583
|
+
else if (a.type === b.braceL || a.type === b.dollarBraceL) r++;
|
|
4584
|
+
else if (a.type === b.braceR) r = Math.max(0, r - 1);
|
|
4585
|
+
else if (a.type === b.comma && t === 0 && n === 0 && r === 0) {
|
|
4586
|
+
i = !0;
|
|
4587
|
+
break;
|
|
4578
4588
|
}
|
|
4579
|
-
}
|
|
4580
|
-
if (
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4589
|
+
} catch {}
|
|
4590
|
+
if (i) throw new q(`Invalid @for target bindings '${c}'. Multiple loop variables must be enclosed in parentheses: '(${c})'.`, e.loc.start.line, e.loc.start.column, e.loc.start.offset);
|
|
4591
|
+
l = c;
|
|
4592
|
+
}
|
|
4593
|
+
if (l.length === 0) throw new q("Expected item identifier in @for target bindings.", e.loc.start.line, e.loc.start.column, e.loc.start.offset);
|
|
4594
|
+
let d = null;
|
|
4595
|
+
try {
|
|
4596
|
+
let e = Wt(`let ${l} = 0;`, { ecmaVersion: "latest" });
|
|
4597
|
+
if (!e || !Array.isArray(e.body) || e.body.length !== 1 || e.body[0].type !== "VariableDeclaration" || !Array.isArray(e.body[0].declarations) || e.body[0].declarations.length !== 1) throw Error();
|
|
4598
|
+
d = e.body[0].declarations[0].id;
|
|
4599
|
+
} catch {
|
|
4600
|
+
throw new q(`Invalid @for item binding '${l}'. Expected a valid variable identifier or destructuring pattern.`, e.loc.start.line, e.loc.start.column, e.loc.start.offset);
|
|
4601
|
+
}
|
|
4602
|
+
if (u !== null) {
|
|
4603
|
+
if (u.length === 0) throw new q("Unexpected trailing comma in @for target bindings. Expected index identifier.", e.loc.start.line, e.loc.start.column, e.loc.start.offset);
|
|
4592
4604
|
try {
|
|
4593
|
-
let
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
let e = n.slice(3).trim(), t = V(e, 0, { ecmaVersion: "latest" });
|
|
4598
|
-
s = e.slice(0, t.end).trim();
|
|
4599
|
-
} else throw new J(`Unexpected token '${n}' in @for header. Expected 'key <expression>' or block opening '{'.`, e.loc.start.line, e.loc.start.column, e.loc.start.offset);
|
|
4600
|
-
} catch (t) {
|
|
4601
|
-
throw t instanceof J ? t : new J(`Invalid @for iterable expression in '${e.value.trim()}'`, e.loc.start.line, e.loc.start.column, e.loc.start.offset);
|
|
4605
|
+
let e = B(u, 0, { ecmaVersion: "latest" });
|
|
4606
|
+
if (e.type !== "Identifier" || u.slice(e.end).trim().length > 0) throw Error();
|
|
4607
|
+
} catch {
|
|
4608
|
+
throw new q(`Invalid @for index binding '${u}'. Array index must be a valid identifier.`, e.loc.start.line, e.loc.start.column, e.loc.start.offset);
|
|
4602
4609
|
}
|
|
4603
4610
|
}
|
|
4604
|
-
let
|
|
4605
|
-
|
|
4606
|
-
|
|
4611
|
+
let f = r.end, p = n.slice(f), m = f + (p.length - p.trimStart().length), h = "", g = null;
|
|
4612
|
+
try {
|
|
4613
|
+
g = B(n, m, { ecmaVersion: "latest" }), h = n.slice(m, g.end).trim();
|
|
4614
|
+
} catch {
|
|
4615
|
+
throw new q(`Invalid @for iterable expression in '${e.value.trim()}'`, e.loc.start.line, e.loc.start.column, e.loc.start.offset);
|
|
4616
|
+
}
|
|
4617
|
+
let _ = null, v = n.slice(g.end).trim();
|
|
4618
|
+
if (v.length > 0) {
|
|
4619
|
+
let t = null;
|
|
4620
|
+
try {
|
|
4621
|
+
t = Gt(v, { ecmaVersion: "latest" }).getToken();
|
|
4622
|
+
} catch {}
|
|
4623
|
+
if (t && t.type === b.name && t.value === "key") {
|
|
4624
|
+
let n = t.end, r = v.slice(n).trim();
|
|
4625
|
+
try {
|
|
4626
|
+
let t = B(r, 0, { ecmaVersion: "latest" });
|
|
4627
|
+
_ = r.slice(0, t.end).trim();
|
|
4628
|
+
let n = r.slice(t.end).trim();
|
|
4629
|
+
if (n.length > 0) throw new q(`Unexpected token '${n}' after key expression in @for directive.`, e.loc.start.line, e.loc.start.column, e.loc.start.offset);
|
|
4630
|
+
} catch (t) {
|
|
4631
|
+
throw t instanceof q ? t : new q(`Invalid key expression in @for directive: '${r}'`, e.loc.start.line, e.loc.start.column, e.loc.start.offset);
|
|
4632
|
+
}
|
|
4633
|
+
} else throw new q(`Unexpected token '${v}' in @for header. Expected 'key <expression>' or block opening '{'.`, e.loc.start.line, e.loc.start.column, e.loc.start.offset);
|
|
4634
|
+
}
|
|
4635
|
+
let y = [];
|
|
4636
|
+
for (; !this.check(H.BlockClose) && !this.isAtEnd();) y.push(this.parseChild());
|
|
4637
|
+
let x = this.consume(H.BlockClose, "Expected closing brace } for @for block");
|
|
4607
4638
|
return {
|
|
4608
|
-
type:
|
|
4609
|
-
item:
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4639
|
+
type: G.For,
|
|
4640
|
+
item: l,
|
|
4641
|
+
pattern: d,
|
|
4642
|
+
index: u,
|
|
4643
|
+
iterable: h,
|
|
4644
|
+
key: _,
|
|
4645
|
+
body: y,
|
|
4614
4646
|
loc: {
|
|
4615
|
-
start:
|
|
4616
|
-
end:
|
|
4647
|
+
start: t,
|
|
4648
|
+
end: x.loc.end
|
|
4617
4649
|
}
|
|
4618
4650
|
};
|
|
4619
4651
|
}
|
|
4620
4652
|
parseSwitchDirective() {
|
|
4621
|
-
let e = this.consume(
|
|
4622
|
-
for (this.skipWhitespaceTokens(); !this.check(
|
|
4623
|
-
if (this.check(
|
|
4653
|
+
let e = this.consume(H.DirectiveSwitch, "Expected @switch directive"), t = e.loc.start, n = e.value, r = [];
|
|
4654
|
+
for (this.skipWhitespaceTokens(); !this.check(H.BlockClose) && !this.isAtEnd();) {
|
|
4655
|
+
if (this.check(H.DirectiveCase)) {
|
|
4624
4656
|
let e = this.advance(), t = [];
|
|
4625
|
-
for (; !this.check(
|
|
4626
|
-
let n = this.consume(
|
|
4657
|
+
for (; !this.check(H.BlockClose) && !this.isAtEnd();) t.push(this.parseChild());
|
|
4658
|
+
let n = this.consume(H.BlockClose, "Expected closing brace } for @case block");
|
|
4627
4659
|
r.push({
|
|
4628
4660
|
expression: e.value,
|
|
4629
4661
|
body: t,
|
|
@@ -4632,10 +4664,10 @@ var rn = class {
|
|
|
4632
4664
|
end: n.loc.end
|
|
4633
4665
|
}
|
|
4634
4666
|
});
|
|
4635
|
-
} else if (this.check(
|
|
4667
|
+
} else if (this.check(H.DirectiveDefault)) {
|
|
4636
4668
|
let e = this.advance(), t = [];
|
|
4637
|
-
for (; !this.check(
|
|
4638
|
-
let n = this.consume(
|
|
4669
|
+
for (; !this.check(H.BlockClose) && !this.isAtEnd();) t.push(this.parseChild());
|
|
4670
|
+
let n = this.consume(H.BlockClose, "Expected closing brace } for @default block");
|
|
4639
4671
|
r.push({
|
|
4640
4672
|
expression: null,
|
|
4641
4673
|
body: t,
|
|
@@ -4644,12 +4676,12 @@ var rn = class {
|
|
|
4644
4676
|
end: n.loc.end
|
|
4645
4677
|
}
|
|
4646
4678
|
});
|
|
4647
|
-
} else throw new
|
|
4679
|
+
} else throw new q(`Unexpected token '${this.peek().value}' inside @switch block. Expected @case or @default.`, this.peek().loc.start.line, this.peek().loc.start.column, this.peek().loc.start.offset);
|
|
4648
4680
|
this.skipWhitespaceTokens();
|
|
4649
4681
|
}
|
|
4650
|
-
let i = this.consume(
|
|
4682
|
+
let i = this.consume(H.BlockClose, "Expected closing brace } for @switch block");
|
|
4651
4683
|
return {
|
|
4652
|
-
type:
|
|
4684
|
+
type: G.Switch,
|
|
4653
4685
|
discriminant: n,
|
|
4654
4686
|
cases: r,
|
|
4655
4687
|
loc: {
|
|
@@ -4659,42 +4691,55 @@ var rn = class {
|
|
|
4659
4691
|
};
|
|
4660
4692
|
}
|
|
4661
4693
|
parseAsyncDirective() {
|
|
4662
|
-
let e = this.consume(
|
|
4663
|
-
for (;
|
|
4664
|
-
let
|
|
4694
|
+
let e = this.consume(H.DirectiveAsync, "Expected @async directive"), t = e.loc.start, n = e.value.trim();
|
|
4695
|
+
for (; an(n);) n = n.slice(1, -1).trim();
|
|
4696
|
+
let r = null;
|
|
4665
4697
|
try {
|
|
4666
|
-
|
|
4698
|
+
r = B(n, 0, { ecmaVersion: "latest" });
|
|
4667
4699
|
} catch {
|
|
4668
|
-
throw new
|
|
4700
|
+
throw new q(`Invalid @async header syntax '${e.value.trim()}'. Expected format: '@async <promise> as <alias>'`, e.loc.start.line, e.loc.start.column, e.loc.start.offset);
|
|
4701
|
+
}
|
|
4702
|
+
let i = n.slice(0, r.end).trim(), a = n.slice(r.end).trim(), o = "data", s = null;
|
|
4703
|
+
if (a.length > 0) {
|
|
4704
|
+
let t = null;
|
|
4705
|
+
try {
|
|
4706
|
+
t = Gt(a, { ecmaVersion: "latest" }).getToken();
|
|
4707
|
+
} catch {}
|
|
4708
|
+
if (t && t.type === b.name && t.value === "as") {
|
|
4709
|
+
let e = a.slice(t.end).trim();
|
|
4710
|
+
for (; an(e);) e = e.slice(1, -1).trim();
|
|
4711
|
+
o = e;
|
|
4712
|
+
try {
|
|
4713
|
+
let t = Wt(`let ${e} = 0;`, { ecmaVersion: "latest" });
|
|
4714
|
+
t && Array.isArray(t.body) && t.body.length === 1 && t.body[0].type === "VariableDeclaration" && Array.isArray(t.body[0].declarations) && t.body[0].declarations.length === 1 && (s = t.body[0].declarations[0].id);
|
|
4715
|
+
} catch {}
|
|
4716
|
+
} else throw new q(`Unexpected token '${a}' in @async header. Expected 'as <alias>'.`, e.loc.start.line, e.loc.start.column, e.loc.start.offset);
|
|
4669
4717
|
}
|
|
4670
|
-
|
|
4671
|
-
if (o.length > 0) if (o.startsWith("as ") || o.startsWith("as ") || o.startsWith("as\n")) for (s = o.slice(2).trim(); t(s);) s = s.slice(1, -1).trim();
|
|
4672
|
-
else throw new J(`Unexpected token '${o}' in @async header. Expected 'as <alias>'.`, e.loc.start.line, e.loc.start.column, e.loc.start.offset);
|
|
4673
|
-
if (!a || !s) throw new J(`Invalid @async header syntax '${e.value.trim()}'. Expected format: '@async <promise> as <alias>'`, e.loc.start.line, e.loc.start.column, e.loc.start.offset);
|
|
4718
|
+
if (!i || !o) throw new q(`Invalid @async header syntax '${e.value.trim()}'. Expected format: '@async <promise> as <alias>'`, e.loc.start.line, e.loc.start.column, e.loc.start.offset);
|
|
4674
4719
|
let c = [];
|
|
4675
|
-
for (; !this.check(
|
|
4676
|
-
let l = this.consume(
|
|
4677
|
-
for (; !this.isAtEnd();) if (this.skipWhitespaceTokens(), this.check(
|
|
4720
|
+
for (; !this.check(H.BlockClose) && !this.isAtEnd();) c.push(this.parseChild());
|
|
4721
|
+
let l = this.consume(H.BlockClose, "Expected closing brace } for @async block"), u = null, d = null;
|
|
4722
|
+
for (; !this.isAtEnd();) if (this.skipWhitespaceTokens(), this.check(H.DirectiveFallback)) {
|
|
4678
4723
|
if (u !== null) {
|
|
4679
4724
|
let e = this.peek();
|
|
4680
|
-
throw new
|
|
4725
|
+
throw new q("Duplicate @fallback directive for @async block", e.loc.start.line, e.loc.start.column, e.loc.start.offset);
|
|
4681
4726
|
}
|
|
4682
|
-
this.consume(
|
|
4727
|
+
this.consume(H.DirectiveFallback, "Expected @fallback directive");
|
|
4683
4728
|
let e = [];
|
|
4684
|
-
for (; !this.check(
|
|
4685
|
-
l = this.consume(
|
|
4686
|
-
} else if (this.check(
|
|
4729
|
+
for (; !this.check(H.BlockClose) && !this.isAtEnd();) e.push(this.parseChild());
|
|
4730
|
+
l = this.consume(H.BlockClose, "Expected closing brace } for @fallback block"), u = e;
|
|
4731
|
+
} else if (this.check(H.DirectiveCatch)) {
|
|
4687
4732
|
if (d !== null) {
|
|
4688
4733
|
let e = this.peek();
|
|
4689
|
-
throw new
|
|
4734
|
+
throw new q("Duplicate @catch directive for @async block", e.loc.start.line, e.loc.start.column, e.loc.start.offset);
|
|
4690
4735
|
}
|
|
4691
|
-
let e = this.consume(
|
|
4692
|
-
for (; t
|
|
4693
|
-
let
|
|
4694
|
-
for (; !this.check(
|
|
4695
|
-
l = this.consume(
|
|
4696
|
-
errorVar:
|
|
4697
|
-
body:
|
|
4736
|
+
let e = this.consume(H.DirectiveCatch, "Expected @catch directive"), t = e.value.trim() || "error";
|
|
4737
|
+
for (; an(t);) t = t.slice(1, -1).trim();
|
|
4738
|
+
let n = [];
|
|
4739
|
+
for (; !this.check(H.BlockClose) && !this.isAtEnd();) n.push(this.parseChild());
|
|
4740
|
+
l = this.consume(H.BlockClose, "Expected closing brace } for @catch block"), d = {
|
|
4741
|
+
errorVar: t,
|
|
4742
|
+
body: n,
|
|
4698
4743
|
loc: {
|
|
4699
4744
|
start: e.loc.start,
|
|
4700
4745
|
end: l.loc.end
|
|
@@ -4702,30 +4747,31 @@ var rn = class {
|
|
|
4702
4747
|
};
|
|
4703
4748
|
} else break;
|
|
4704
4749
|
return {
|
|
4705
|
-
type:
|
|
4706
|
-
promise:
|
|
4707
|
-
alias:
|
|
4750
|
+
type: G.Async,
|
|
4751
|
+
promise: i,
|
|
4752
|
+
alias: o,
|
|
4753
|
+
aliasAst: s,
|
|
4708
4754
|
body: c,
|
|
4709
4755
|
fallback: u,
|
|
4710
4756
|
catchBranch: d,
|
|
4711
4757
|
loc: {
|
|
4712
|
-
start:
|
|
4758
|
+
start: t,
|
|
4713
4759
|
end: l.loc.end
|
|
4714
4760
|
}
|
|
4715
4761
|
};
|
|
4716
4762
|
}
|
|
4717
4763
|
skipWhitespaceTokens() {
|
|
4718
|
-
for (; this.check(
|
|
4764
|
+
for (; this.check(H.Text) && this.peek().value.trim().length === 0;) this.advance();
|
|
4719
4765
|
}
|
|
4720
4766
|
isAtEnd() {
|
|
4721
|
-
return this.peek().type ===
|
|
4767
|
+
return this.peek().type === H.EOF;
|
|
4722
4768
|
}
|
|
4723
4769
|
peek(e = 0) {
|
|
4724
4770
|
return this.ensureLookahead(e), this.lookahead[Math.min(e, this.lookahead.length - 1)];
|
|
4725
4771
|
}
|
|
4726
4772
|
advance() {
|
|
4727
4773
|
let e = this.peek();
|
|
4728
|
-
return e.type !==
|
|
4774
|
+
return e.type !== H.EOF && this.lookahead.shift(), e;
|
|
4729
4775
|
}
|
|
4730
4776
|
check(e) {
|
|
4731
4777
|
return this.peek().type === e;
|
|
@@ -4736,16 +4782,16 @@ var rn = class {
|
|
|
4736
4782
|
consume(e, t) {
|
|
4737
4783
|
if (this.check(e)) return this.advance();
|
|
4738
4784
|
let n = this.peek();
|
|
4739
|
-
throw new
|
|
4785
|
+
throw new q(t, n.loc.start.line, n.loc.start.column, n.loc.start.offset);
|
|
4740
4786
|
}
|
|
4741
4787
|
ensureLookahead(e) {
|
|
4742
4788
|
for (; this.lookahead.length <= e;) {
|
|
4743
4789
|
let e = this.tokenSource.nextToken();
|
|
4744
|
-
if (this.lookahead.push(e), e.type ===
|
|
4790
|
+
if (this.lookahead.push(e), e.type === H.EOF) break;
|
|
4745
4791
|
}
|
|
4746
4792
|
}
|
|
4747
4793
|
};
|
|
4748
|
-
function
|
|
4794
|
+
function sn(e, t) {
|
|
4749
4795
|
function n(e, t) {
|
|
4750
4796
|
let n = [];
|
|
4751
4797
|
for (let i of e) {
|
|
@@ -4773,7 +4819,7 @@ function an(e, t) {
|
|
|
4773
4819
|
}
|
|
4774
4820
|
}
|
|
4775
4821
|
switch (a.type) {
|
|
4776
|
-
case
|
|
4822
|
+
case G.Program: {
|
|
4777
4823
|
let e = n(a.body, a);
|
|
4778
4824
|
a = {
|
|
4779
4825
|
...a,
|
|
@@ -4781,7 +4827,7 @@ function an(e, t) {
|
|
|
4781
4827
|
};
|
|
4782
4828
|
break;
|
|
4783
4829
|
}
|
|
4784
|
-
case
|
|
4830
|
+
case G.Element: {
|
|
4785
4831
|
let e = a.attributes;
|
|
4786
4832
|
if (t.Attribute && Array.isArray(a.attributes)) {
|
|
4787
4833
|
let n = [];
|
|
@@ -4799,7 +4845,7 @@ function an(e, t) {
|
|
|
4799
4845
|
};
|
|
4800
4846
|
break;
|
|
4801
4847
|
}
|
|
4802
|
-
case
|
|
4848
|
+
case G.If: {
|
|
4803
4849
|
let e = n(a.consequent, a), t = a.alternate;
|
|
4804
4850
|
Array.isArray(a.alternate) ? t = n(a.alternate, a) : a.alternate !== null && typeof a.alternate == "object" && (t = r(a.alternate, a)), a = {
|
|
4805
4851
|
...a,
|
|
@@ -4808,7 +4854,7 @@ function an(e, t) {
|
|
|
4808
4854
|
};
|
|
4809
4855
|
break;
|
|
4810
4856
|
}
|
|
4811
|
-
case
|
|
4857
|
+
case G.For: {
|
|
4812
4858
|
let e = n(a.body, a);
|
|
4813
4859
|
a = {
|
|
4814
4860
|
...a,
|
|
@@ -4816,7 +4862,7 @@ function an(e, t) {
|
|
|
4816
4862
|
};
|
|
4817
4863
|
break;
|
|
4818
4864
|
}
|
|
4819
|
-
case
|
|
4865
|
+
case G.Switch:
|
|
4820
4866
|
if (Array.isArray(a.cases)) {
|
|
4821
4867
|
let e = a.cases.map((e) => ({
|
|
4822
4868
|
...e,
|
|
@@ -4828,7 +4874,7 @@ function an(e, t) {
|
|
|
4828
4874
|
};
|
|
4829
4875
|
}
|
|
4830
4876
|
break;
|
|
4831
|
-
case
|
|
4877
|
+
case G.Async: {
|
|
4832
4878
|
let e = n(a.body, a), t = a.fallback ? n(a.fallback, a) : null, r = a.catchBranch;
|
|
4833
4879
|
a.catchBranch && (r = {
|
|
4834
4880
|
...a.catchBranch,
|
|
@@ -4850,22 +4896,21 @@ function an(e, t) {
|
|
|
4850
4896
|
}
|
|
4851
4897
|
return r(e, null);
|
|
4852
4898
|
}
|
|
4853
|
-
var
|
|
4899
|
+
var cn = class {
|
|
4854
4900
|
rawAst;
|
|
4855
|
-
switchCounter = 0;
|
|
4856
4901
|
constructor(e) {
|
|
4857
4902
|
this.rawAst = e;
|
|
4858
4903
|
}
|
|
4859
4904
|
transform() {
|
|
4860
|
-
return
|
|
4905
|
+
return sn(sn(this.rawAst, { Text: (e) => {
|
|
4861
4906
|
if (typeof e.content == "string" && this.isWhitespaceOnly(e.content)) return null;
|
|
4862
|
-
} }), {
|
|
4907
|
+
} }), {
|
|
4863
4908
|
Interpolation: (e) => this.transformInterpolation(e),
|
|
4864
4909
|
Element: (e) => {
|
|
4865
4910
|
if (e.tagName === "script") return this.transformScriptElement(e);
|
|
4866
4911
|
if (e.attributes.some((e) => e.value !== null && typeof e.value != "string")) return {
|
|
4867
4912
|
...e,
|
|
4868
|
-
attributes: e.attributes.map((e) => e.type ===
|
|
4913
|
+
attributes: e.attributes.map((e) => e.type === G.Attribute && e.value !== null && typeof e.value != "string" && e.value.type === G.Interpolation ? {
|
|
4869
4914
|
...e,
|
|
4870
4915
|
value: this.transformInterpolation(e.value)
|
|
4871
4916
|
} : e)
|
|
@@ -4874,108 +4919,44 @@ var on = class {
|
|
|
4874
4919
|
If: (e) => {
|
|
4875
4920
|
if (typeof e.test == "string" && e.test.trim().length > 0) return {
|
|
4876
4921
|
...e,
|
|
4877
|
-
test:
|
|
4922
|
+
test: B(e.test, 0, { ecmaVersion: "latest" })
|
|
4878
4923
|
};
|
|
4879
4924
|
},
|
|
4880
4925
|
For: (e) => ({
|
|
4881
4926
|
...e,
|
|
4882
|
-
iterable: typeof e.iterable == "string" ?
|
|
4883
|
-
key: typeof e.key == "string" && e.key.trim().length > 0 ?
|
|
4927
|
+
iterable: typeof e.iterable == "string" ? B(e.iterable, 0, { ecmaVersion: "latest" }) : e.iterable,
|
|
4928
|
+
key: typeof e.key == "string" && e.key.trim().length > 0 ? B(e.key, 0, { ecmaVersion: "latest" }) : e.key ?? null
|
|
4884
4929
|
}),
|
|
4930
|
+
Switch: (e) => {
|
|
4931
|
+
let t = typeof e.discriminant == "string" && e.discriminant.trim().length > 0 ? B(e.discriminant, 0, { ecmaVersion: "latest" }) : e.discriminant, n = e.cases.map((e) => {
|
|
4932
|
+
let t = e.expression !== null && typeof e.expression == "string" && e.expression.trim().length > 0 ? B(e.expression, 0, { ecmaVersion: "latest" }) : e.expression;
|
|
4933
|
+
return {
|
|
4934
|
+
...e,
|
|
4935
|
+
expression: t
|
|
4936
|
+
};
|
|
4937
|
+
});
|
|
4938
|
+
return {
|
|
4939
|
+
...e,
|
|
4940
|
+
discriminant: t,
|
|
4941
|
+
cases: n
|
|
4942
|
+
};
|
|
4943
|
+
},
|
|
4885
4944
|
Async: (e) => ({
|
|
4886
4945
|
...e,
|
|
4887
|
-
promise: typeof e.promise == "string" && e.promise.trim().length > 0 ?
|
|
4946
|
+
promise: typeof e.promise == "string" && e.promise.trim().length > 0 ? B(e.promise, 0, { ecmaVersion: "latest" }) : e.promise
|
|
4888
4947
|
})
|
|
4889
4948
|
});
|
|
4890
4949
|
}
|
|
4891
|
-
transformSwitchToIfChain(e) {
|
|
4892
|
-
let t = typeof e.discriminant == "string" ? V(e.discriminant, 0, { ecmaVersion: "latest" }) : e.discriminant, n = t.type === "Identifier" || t.type === "Literal" || t.type === "MemberExpression", r = `__drift_sw_${this.switchCounter++}`, i = !0, a = (o) => {
|
|
4893
|
-
let s = e.cases[o];
|
|
4894
|
-
if (!s) return null;
|
|
4895
|
-
if (s.expression === null) {
|
|
4896
|
-
let e = [...s.body], t = a(o + 1), n = null;
|
|
4897
|
-
return (Array.isArray(t) || t !== null && t.type === K.If) && (n = t), o > 0 && n === null ? e : {
|
|
4898
|
-
type: K.If,
|
|
4899
|
-
test: {
|
|
4900
|
-
type: "Literal",
|
|
4901
|
-
value: !0,
|
|
4902
|
-
raw: "true",
|
|
4903
|
-
start: 0,
|
|
4904
|
-
end: 0
|
|
4905
|
-
},
|
|
4906
|
-
consequent: e,
|
|
4907
|
-
alternate: n,
|
|
4908
|
-
loc: s.loc
|
|
4909
|
-
};
|
|
4910
|
-
}
|
|
4911
|
-
let c = typeof s.expression == "string" && s.expression.trim().length > 0 ? V(s.expression, 0, { ecmaVersion: "latest" }) : s.expression, l;
|
|
4912
|
-
n ? l = structuredClone(t) : i ? (i = !1, l = {
|
|
4913
|
-
type: "AssignmentExpression",
|
|
4914
|
-
operator: "=",
|
|
4915
|
-
left: {
|
|
4916
|
-
type: "Identifier",
|
|
4917
|
-
name: r,
|
|
4918
|
-
start: 0,
|
|
4919
|
-
end: 0
|
|
4920
|
-
},
|
|
4921
|
-
right: structuredClone(t),
|
|
4922
|
-
start: 0,
|
|
4923
|
-
end: 0
|
|
4924
|
-
}) : l = {
|
|
4925
|
-
type: "Identifier",
|
|
4926
|
-
name: r,
|
|
4927
|
-
start: 0,
|
|
4928
|
-
end: 0
|
|
4929
|
-
};
|
|
4930
|
-
let u = {
|
|
4931
|
-
type: "BinaryExpression",
|
|
4932
|
-
operator: "===",
|
|
4933
|
-
left: l,
|
|
4934
|
-
right: c,
|
|
4935
|
-
start: 0,
|
|
4936
|
-
end: 0
|
|
4937
|
-
}, d = [...s.body], f = a(o + 1), p = null;
|
|
4938
|
-
return (Array.isArray(f) || f !== null && f.type === K.If) && (p = f), {
|
|
4939
|
-
type: K.If,
|
|
4940
|
-
test: u,
|
|
4941
|
-
consequent: d,
|
|
4942
|
-
alternate: p,
|
|
4943
|
-
extraDeps: structuredClone(t),
|
|
4944
|
-
loc: s.loc
|
|
4945
|
-
};
|
|
4946
|
-
}, o = a(0);
|
|
4947
|
-
return o ? Array.isArray(o) ? o.length === 0 ? {
|
|
4948
|
-
type: K.Comment,
|
|
4949
|
-
content: "empty switch",
|
|
4950
|
-
loc: e.loc
|
|
4951
|
-
} : {
|
|
4952
|
-
type: K.If,
|
|
4953
|
-
test: {
|
|
4954
|
-
type: "Literal",
|
|
4955
|
-
value: !0,
|
|
4956
|
-
raw: "true",
|
|
4957
|
-
start: 0,
|
|
4958
|
-
end: 0
|
|
4959
|
-
},
|
|
4960
|
-
consequent: o,
|
|
4961
|
-
alternate: null,
|
|
4962
|
-
loc: e.loc
|
|
4963
|
-
} : o : {
|
|
4964
|
-
type: K.Comment,
|
|
4965
|
-
content: "empty switch",
|
|
4966
|
-
loc: e.loc
|
|
4967
|
-
};
|
|
4968
|
-
}
|
|
4969
4950
|
transformInterpolation(e) {
|
|
4970
4951
|
if (typeof e.expression != "string") return e;
|
|
4971
4952
|
let t;
|
|
4972
4953
|
try {
|
|
4973
|
-
t =
|
|
4954
|
+
t = B(e.expression, 0, {
|
|
4974
4955
|
ecmaVersion: "latest",
|
|
4975
4956
|
allowAwaitOutsideFunction: !0
|
|
4976
4957
|
});
|
|
4977
4958
|
} catch (t) {
|
|
4978
|
-
throw new
|
|
4959
|
+
throw new q(`Failed to parse JS expression in interpolation: ${t instanceof Error ? t.message : String(t)}`, e.loc.start.line, e.loc.start.column, e.loc.start.offset);
|
|
4979
4960
|
}
|
|
4980
4961
|
return {
|
|
4981
4962
|
...e,
|
|
@@ -4984,7 +4965,7 @@ var on = class {
|
|
|
4984
4965
|
}
|
|
4985
4966
|
transformScriptElement(e) {
|
|
4986
4967
|
let t = e.children.map((e) => {
|
|
4987
|
-
if (e.type ===
|
|
4968
|
+
if (e.type === G.Text && typeof e.content == "string") {
|
|
4988
4969
|
let t;
|
|
4989
4970
|
try {
|
|
4990
4971
|
let n = Wt(e.content, {
|
|
@@ -4995,7 +4976,7 @@ var on = class {
|
|
|
4995
4976
|
});
|
|
4996
4977
|
t = n.body.length === 1 && n.body[0] !== void 0 ? n.body[0] : n.body;
|
|
4997
4978
|
} catch (t) {
|
|
4998
|
-
throw new
|
|
4979
|
+
throw new q(`Failed to parse script tag JS content: ${t instanceof Error ? t.message : String(t)}`, e.loc.start.line, e.loc.start.column, e.loc.start.offset);
|
|
4999
4980
|
}
|
|
5000
4981
|
return {
|
|
5001
4982
|
...e,
|
|
@@ -5012,7 +4993,7 @@ var on = class {
|
|
|
5012
4993
|
isWhitespaceOnly(e) {
|
|
5013
4994
|
return e.length > 0 && /^\s*$/.test(e);
|
|
5014
4995
|
}
|
|
5015
|
-
},
|
|
4996
|
+
}, ln = class {
|
|
5016
4997
|
ast;
|
|
5017
4998
|
bytecode = [];
|
|
5018
4999
|
constants = [];
|
|
@@ -5030,7 +5011,7 @@ var on = class {
|
|
|
5030
5011
|
generate() {
|
|
5031
5012
|
if (this.bytecode = [], this.constants = [], this.nextRegisterId = 0, this.declaredVars = /* @__PURE__ */ new Set(), this.imports = [], this.bindingPositions = /* @__PURE__ */ new Map(), this.derivedBindings = [], this.pendingDerived = [], this.effectBindings = [], this.pendingEffects = [], this.collectDeclaredVars(this.ast.body), this.processDerivedBindings(), this.processEffectBindings(), this.ast.body.length === 0) {
|
|
5032
5013
|
let e = this.allocRegister();
|
|
5033
|
-
return this.emit(
|
|
5014
|
+
return this.emit(J.CREATE_FRAGMENT, e), {
|
|
5034
5015
|
bytecode: this.bytecode,
|
|
5035
5016
|
constants: this.constants,
|
|
5036
5017
|
reactiveBindings: this.buildReactiveBindings(),
|
|
@@ -5040,12 +5021,12 @@ var on = class {
|
|
|
5040
5021
|
imports: this.imports
|
|
5041
5022
|
};
|
|
5042
5023
|
}
|
|
5043
|
-
if (this.ast.body.length === 1 && this.ast.body[0]?.type ===
|
|
5024
|
+
if (this.ast.body.length === 1 && this.ast.body[0]?.type === G.Element) {
|
|
5044
5025
|
let e = this.allocRegister();
|
|
5045
5026
|
this.compileElement(this.ast.body[0], e);
|
|
5046
5027
|
} else {
|
|
5047
5028
|
let e = this.allocRegister();
|
|
5048
|
-
this.emit(
|
|
5029
|
+
this.emit(J.CREATE_FRAGMENT, e);
|
|
5049
5030
|
for (let t of this.ast.body) this.compileNode(t, e);
|
|
5050
5031
|
}
|
|
5051
5032
|
return {
|
|
@@ -5060,25 +5041,28 @@ var on = class {
|
|
|
5060
5041
|
}
|
|
5061
5042
|
compileNode(e, t) {
|
|
5062
5043
|
switch (e.type) {
|
|
5063
|
-
case
|
|
5044
|
+
case G.Element:
|
|
5064
5045
|
e.tagName === "script" ? this.compileScriptElement(e) : this.compileElementNode(e, t);
|
|
5065
5046
|
break;
|
|
5066
|
-
case
|
|
5047
|
+
case G.Text:
|
|
5067
5048
|
this.compileTextNode(e, t);
|
|
5068
5049
|
break;
|
|
5069
|
-
case
|
|
5050
|
+
case G.Interpolation:
|
|
5070
5051
|
this.compileInterpolationNode(e, t);
|
|
5071
5052
|
break;
|
|
5072
|
-
case
|
|
5053
|
+
case G.Comment:
|
|
5073
5054
|
this.compileCommentNode(e, t);
|
|
5074
5055
|
break;
|
|
5075
|
-
case
|
|
5056
|
+
case G.If:
|
|
5076
5057
|
this.compileIfNode(e, t);
|
|
5077
5058
|
break;
|
|
5078
|
-
case
|
|
5059
|
+
case G.Switch:
|
|
5060
|
+
this.compileSwitchNode(e, t);
|
|
5061
|
+
break;
|
|
5062
|
+
case G.For:
|
|
5079
5063
|
this.compileForNode(e, t);
|
|
5080
5064
|
break;
|
|
5081
|
-
case
|
|
5065
|
+
case G.Async:
|
|
5082
5066
|
this.compileAsyncNode(e, t);
|
|
5083
5067
|
break;
|
|
5084
5068
|
}
|
|
@@ -5103,11 +5087,11 @@ var on = class {
|
|
|
5103
5087
|
return e;
|
|
5104
5088
|
}
|
|
5105
5089
|
compileScriptElement(e) {
|
|
5106
|
-
for (let t of e.children) if (t.type ===
|
|
5090
|
+
for (let t of e.children) if (t.type === G.Text && typeof t.content == "object" && t.content !== null) {
|
|
5107
5091
|
let e = this.filterRuntimeScriptAst(t.content);
|
|
5108
5092
|
if (e !== null && (!Array.isArray(e) || e.length > 0)) {
|
|
5109
5093
|
let t = this.addScriptConstant(e);
|
|
5110
|
-
this.emit(
|
|
5094
|
+
this.emit(J.EXEC_SCRIPT, t);
|
|
5111
5095
|
}
|
|
5112
5096
|
}
|
|
5113
5097
|
}
|
|
@@ -5120,10 +5104,10 @@ var on = class {
|
|
|
5120
5104
|
let n = this.isComponentTag(e.tagName), r = this.addConstant(e.tagName);
|
|
5121
5105
|
if (n) {
|
|
5122
5106
|
let n = { __drift_props__: !0 };
|
|
5123
|
-
for (let t of e.attributes) if (t.type ===
|
|
5107
|
+
for (let t of e.attributes) if (t.type === G.Attribute) {
|
|
5124
5108
|
if (t.value === null) n[t.name] = !0;
|
|
5125
5109
|
else if (typeof t.value == "string") n[t.name] = t.value;
|
|
5126
|
-
else if (t.value.type ===
|
|
5110
|
+
else if (t.value.type === G.Interpolation) {
|
|
5127
5111
|
let e = t.value.expression;
|
|
5128
5112
|
if (e && typeof e == "object" && e.type) {
|
|
5129
5113
|
let r = $(e);
|
|
@@ -5133,53 +5117,53 @@ var on = class {
|
|
|
5133
5117
|
}
|
|
5134
5118
|
let i = null;
|
|
5135
5119
|
if (e.children && e.children.length > 0) {
|
|
5136
|
-
let t = e.children.filter((e) => !(e.type ===
|
|
5120
|
+
let t = e.children.filter((e) => !(e.type === G.Text && typeof e.content == "string" && e.content.trim() === ""));
|
|
5137
5121
|
t.length > 0 && (i = this.compileNodesToSubModule(t), n.__drift_children__ = this.addConstant(i));
|
|
5138
5122
|
}
|
|
5139
5123
|
let a = Object.keys(n).length > 1 ? this.addConstant(n) : 255, o = this.bytecode.length;
|
|
5140
|
-
this.emit(
|
|
5141
|
-
for (let t of e.attributes) t.type ===
|
|
5124
|
+
this.emit(J.MOUNT_COMPONENT, t, r, a), this.emit(J.RETURN);
|
|
5125
|
+
for (let t of e.attributes) t.type === G.Attribute && t.value !== null && typeof t.value != "string" && t.value.type === G.Interpolation && this.recordBindingPositions(t.value.expression, o);
|
|
5142
5126
|
if (i) for (let e of i.reactiveBindings) this.declaredVars.has(e.variable) && (this.bindingPositions.has(e.variable) || this.bindingPositions.set(e.variable, []), this.bindingPositions.get(e.variable).push(o));
|
|
5143
5127
|
} else {
|
|
5144
|
-
this.emit(
|
|
5128
|
+
this.emit(J.CREATE_ELEMENT, t, r);
|
|
5145
5129
|
for (let n of e.attributes) this.compileAttributeNode(n, t);
|
|
5146
5130
|
for (let n of e.children) this.compileNode(n, t);
|
|
5147
5131
|
}
|
|
5148
5132
|
}
|
|
5149
5133
|
compileElementNode(e, t) {
|
|
5150
5134
|
let n = this.allocRegister();
|
|
5151
|
-
this.compileElement(e, n), this.emit(
|
|
5135
|
+
this.compileElement(e, n), this.emit(J.APPEND_CHILD, t, n);
|
|
5152
5136
|
}
|
|
5153
5137
|
compileAttributeNode(e, t) {
|
|
5154
5138
|
let n = this.addConstant(e.name);
|
|
5155
5139
|
if (e.value === null) {
|
|
5156
5140
|
let e = this.addConstant(!0);
|
|
5157
|
-
this.emit(
|
|
5141
|
+
this.emit(J.SET_ATTR, t, n, e, 0);
|
|
5158
5142
|
} else if (typeof e.value == "string") {
|
|
5159
5143
|
let r = this.addConstant(e.value);
|
|
5160
|
-
this.emit(
|
|
5161
|
-
} else if (e.value.type ===
|
|
5144
|
+
this.emit(J.SET_ATTR, t, n, r, 0);
|
|
5145
|
+
} else if (e.value.type === G.Interpolation) {
|
|
5162
5146
|
let r = this.addExpressionConstant(e.value.expression), i = this.bytecode.length;
|
|
5163
|
-
this.emit(
|
|
5147
|
+
this.emit(J.SET_ATTR, t, n, r, 1), this.emit(J.RETURN), this.recordBindingPositions(e.value.expression, i);
|
|
5164
5148
|
}
|
|
5165
5149
|
}
|
|
5166
5150
|
compileTextNode(e, t) {
|
|
5167
5151
|
let n = this.allocRegister(), r = this.addConstant(e.content);
|
|
5168
|
-
this.emit(
|
|
5152
|
+
this.emit(J.CREATE_TEXT, n, r), this.emit(J.APPEND_CHILD, t, n);
|
|
5169
5153
|
}
|
|
5170
5154
|
compileInterpolationNode(e, t) {
|
|
5171
5155
|
let n = this.allocRegister(), r = this.addExpressionConstant(e.expression), i = this.bytecode.length;
|
|
5172
|
-
this.emit(
|
|
5156
|
+
this.emit(J.INTERPOLATE_TEXT, n, r), this.emit(J.RETURN), this.emit(J.APPEND_CHILD, t, n), this.recordBindingPositions(e.expression, i);
|
|
5173
5157
|
}
|
|
5174
5158
|
compileCommentNode(e, t) {
|
|
5175
5159
|
let n = this.allocRegister(), r = this.addConstant(e.content);
|
|
5176
|
-
this.emit(
|
|
5160
|
+
this.emit(J.CREATE_COMMENT, n, r), this.emit(J.APPEND_CHILD, t, n);
|
|
5177
5161
|
}
|
|
5178
5162
|
compileNodesToSubModule(e) {
|
|
5179
5163
|
let t = this.bytecode, n = this.constants, r = this.nextRegisterId, i = this.bindingPositions;
|
|
5180
5164
|
this.bytecode = [], this.constants = [], this.nextRegisterId = 0, this.bindingPositions = /* @__PURE__ */ new Map();
|
|
5181
5165
|
let a = this.allocRegister();
|
|
5182
|
-
this.emit(
|
|
5166
|
+
this.emit(J.CREATE_FRAGMENT, a);
|
|
5183
5167
|
for (let t of e) this.compileNode(t, a);
|
|
5184
5168
|
let o = {
|
|
5185
5169
|
bytecode: this.bytecode,
|
|
@@ -5208,16 +5192,47 @@ var on = class {
|
|
|
5208
5192
|
}
|
|
5209
5193
|
if (a) for (let e of this.collectDepsFromSubModule(a)) o.add(e);
|
|
5210
5194
|
let s = this.addConstant(Array.from(o)), c = this.addExpressionConstant(e.test);
|
|
5211
|
-
this.emit(
|
|
5195
|
+
this.emit(J.REACTIVE_IF, t, c, r, i, s);
|
|
5196
|
+
}
|
|
5197
|
+
compileSwitchNode(e, t) {
|
|
5198
|
+
let n = this.addExpressionConstant(e.discriminant), r = [], i = 255, a = [];
|
|
5199
|
+
for (let t of e.cases) if (t.expression === null) {
|
|
5200
|
+
let e = this.compileNodesToSubModule(t.body);
|
|
5201
|
+
a.push(e), i = this.addConstant(e);
|
|
5202
|
+
} else {
|
|
5203
|
+
let e = this.addExpressionConstant(t.expression), n = this.compileNodesToSubModule(t.body);
|
|
5204
|
+
a.push(n);
|
|
5205
|
+
let i = this.addConstant(n);
|
|
5206
|
+
r.push({
|
|
5207
|
+
testIdx: e,
|
|
5208
|
+
modIdx: i
|
|
5209
|
+
});
|
|
5210
|
+
}
|
|
5211
|
+
let o = this.addConstant(r), s = /* @__PURE__ */ new Set();
|
|
5212
|
+
for (let t of this.extractIdentifiers(e.discriminant)) this.declaredVars.has(t) && s.add(t);
|
|
5213
|
+
for (let t of e.cases) if (t.expression !== null) for (let e of this.extractIdentifiers(t.expression)) this.declaredVars.has(e) && s.add(e);
|
|
5214
|
+
for (let e of a) for (let t of this.collectDepsFromSubModule(e)) s.add(t);
|
|
5215
|
+
let c = this.addConstant(Array.from(s));
|
|
5216
|
+
this.emit(J.REACTIVE_SWITCH, t, n, o, i, c);
|
|
5212
5217
|
}
|
|
5213
5218
|
compileForNode(e, t) {
|
|
5214
|
-
let n =
|
|
5215
|
-
for (let t of
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
let
|
|
5220
|
-
this.
|
|
5219
|
+
let n = /* @__PURE__ */ new Set();
|
|
5220
|
+
if (e.pattern) for (let t of Y(e.pattern)) n.add(t);
|
|
5221
|
+
else e.item && n.add(e.item);
|
|
5222
|
+
e.index !== null && n.add(e.index);
|
|
5223
|
+
let r = [];
|
|
5224
|
+
for (let e of n) this.declaredVars.has(e) || (this.declaredVars.add(e), r.push(e));
|
|
5225
|
+
let i = this.compileNodesToSubModule(e.body);
|
|
5226
|
+
for (let e of r) this.declaredVars.delete(e);
|
|
5227
|
+
let a = this.addConstant(i), o = this.addExpressionConstant(e.iterable), s = this.addConstant(e.item), c = e.index === null ? 255 : this.addConstant(e.index), l = e.key ? this.addExpressionConstant(e.key) : 255, u = 255;
|
|
5228
|
+
e.pattern && (u = this.addConstant(dn(e.pattern, e.index)));
|
|
5229
|
+
let d = /* @__PURE__ */ new Set();
|
|
5230
|
+
for (let t of this.extractIdentifiers(e.iterable)) this.declaredVars.has(t) && d.add(t);
|
|
5231
|
+
if (e.key) for (let t of this.extractIdentifiers(e.key)) this.declaredVars.has(t) && d.add(t);
|
|
5232
|
+
let f = this.addConstant([...d]), p = /* @__PURE__ */ new Set();
|
|
5233
|
+
for (let e of i.reactiveBindings) !d.has(e.variable) && !n.has(e.variable) && p.add(e.variable);
|
|
5234
|
+
let m = this.addConstant([...p]), h = [...d, ...p], g = this.addConstant(h);
|
|
5235
|
+
this.emit(J.REACTIVE_FOR, t, o, s, c, l, a, g, f, m, u);
|
|
5221
5236
|
}
|
|
5222
5237
|
compileAsyncNode(e, t) {
|
|
5223
5238
|
let n = this.compileNodesToSubModule(e.body), r = this.addConstant(n), i = e.fallback ? this.compileNodesToSubModule(e.fallback) : null, a = i ? this.addConstant(i) : 255, o = 255;
|
|
@@ -5228,15 +5243,17 @@ var on = class {
|
|
|
5228
5243
|
module: t
|
|
5229
5244
|
});
|
|
5230
5245
|
}
|
|
5231
|
-
let s = this.addExpressionConstant(e.promise), c = this.addConstant(e.alias), l =
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
let
|
|
5235
|
-
|
|
5246
|
+
let s = this.addExpressionConstant(e.promise), c = this.addConstant(e.alias), l = 255;
|
|
5247
|
+
e.aliasAst && (l = this.addConstant(dn(e.aliasAst, null)));
|
|
5248
|
+
let u = /* @__PURE__ */ new Set();
|
|
5249
|
+
for (let t of this.collectDepsFromSubModule(n, e.promise)) u.add(t);
|
|
5250
|
+
if (i) for (let e of this.collectDepsFromSubModule(i)) u.add(e);
|
|
5251
|
+
let d = this.addConstant(Array.from(u));
|
|
5252
|
+
this.emit(J.REACTIVE_ASYNC, t, s, c, r, a, o, d, l);
|
|
5236
5253
|
}
|
|
5237
5254
|
collectDeclaredVars(e) {
|
|
5238
|
-
for (let t of e) if (t.type ===
|
|
5239
|
-
for (let e of t.children) if (e.type ===
|
|
5255
|
+
for (let t of e) if (t.type === G.Element && t.tagName === "script") {
|
|
5256
|
+
for (let e of t.children) if (e.type === G.Text && typeof e.content == "object" && e.content !== null) {
|
|
5240
5257
|
let t = e.content;
|
|
5241
5258
|
if (Array.isArray(t)) for (let e of t) this.extractVarNames(e);
|
|
5242
5259
|
else this.extractVarNames(t);
|
|
@@ -5246,7 +5263,7 @@ var on = class {
|
|
|
5246
5263
|
extractVarNames(e) {
|
|
5247
5264
|
if (!(!e || typeof e != "object")) {
|
|
5248
5265
|
if (e.type === "VariableDeclaration") for (let t of e.declarations) {
|
|
5249
|
-
for (let e of
|
|
5266
|
+
for (let e of Y(t.id)) this.declaredVars.add(e);
|
|
5250
5267
|
t.id?.type === "Identifier" && t.init?.type === "CallExpression" && t.init.callee?.type === "Identifier" && t.init.callee.name === "derive" && t.init.arguments && t.init.arguments.length > 0 && this.pendingDerived.push({
|
|
5251
5268
|
name: t.id.name,
|
|
5252
5269
|
arg: t.init.arguments[0]
|
|
@@ -5308,7 +5325,7 @@ var on = class {
|
|
|
5308
5325
|
let t = /* @__PURE__ */ new Set();
|
|
5309
5326
|
if (!e || typeof e != "object") return t;
|
|
5310
5327
|
try {
|
|
5311
|
-
|
|
5328
|
+
Kt(e, { Identifier(e, n) {
|
|
5312
5329
|
let r = n[n.length - 2];
|
|
5313
5330
|
r && (r.type === "MemberExpression" && r.property === e && !r.computed || (r.type === "Property" || r.type === "MethodDefinition" || r.type === "PropertyDefinition") && r.key === e && !r.computed) || t.add(e.name);
|
|
5314
5331
|
} });
|
|
@@ -5355,10 +5372,10 @@ var on = class {
|
|
|
5355
5372
|
this.bytecode.push(e, ...t);
|
|
5356
5373
|
}
|
|
5357
5374
|
};
|
|
5358
|
-
function
|
|
5359
|
-
return !e || typeof e != "object" ? null : e.type === "Identifier" ? e.name : e.type === "MemberExpression" ?
|
|
5375
|
+
function un(e) {
|
|
5376
|
+
return !e || typeof e != "object" ? null : e.type === "Identifier" ? e.name : e.type === "MemberExpression" ? un(e.object) : null;
|
|
5360
5377
|
}
|
|
5361
|
-
function
|
|
5378
|
+
function Y(e) {
|
|
5362
5379
|
let t = [];
|
|
5363
5380
|
function n(e) {
|
|
5364
5381
|
if (!(!e || typeof e != "object")) if (e.type === "Identifier") t.push(e.name);
|
|
@@ -5368,40 +5385,40 @@ function X(e) {
|
|
|
5368
5385
|
}
|
|
5369
5386
|
return n(e), t;
|
|
5370
5387
|
}
|
|
5371
|
-
function
|
|
5388
|
+
function X(e, t) {
|
|
5372
5389
|
if (!e) return "";
|
|
5373
5390
|
switch (e.type) {
|
|
5374
5391
|
case "Identifier": return e.name;
|
|
5375
|
-
case "AssignmentPattern": return `${
|
|
5376
|
-
case "RestElement": return `...${
|
|
5377
|
-
case "ArrayPattern": return `[${(e.elements || []).map((e) => e ?
|
|
5392
|
+
case "AssignmentPattern": return `${X(e.left, t)} = ${$(e.right, t)}`;
|
|
5393
|
+
case "RestElement": return `...${X(e.argument, t)}`;
|
|
5394
|
+
case "ArrayPattern": return `[${(e.elements || []).map((e) => e ? X(e, t) : "").join(", ")}]`;
|
|
5378
5395
|
case "ObjectPattern": return `{ ${(e.properties || []).map((e) => {
|
|
5379
5396
|
if (e.type === "Property") {
|
|
5380
5397
|
let n = e.key?.name || (typeof e.key?.value == "string" ? JSON.stringify(e.key.value) : e.key?.value ? String(e.key.value) : $(e.key, t));
|
|
5381
5398
|
if (e.value?.type === "AssignmentPattern") {
|
|
5382
|
-
let r = e.value.left?.name ||
|
|
5399
|
+
let r = e.value.left?.name || X(e.value.left, t), i = $(e.value.right, t);
|
|
5383
5400
|
return n === r || e.shorthand ? `${n} = ${i}` : `${n}: ${r} = ${i}`;
|
|
5384
5401
|
} else if (e.value?.type === "Identifier" && e.value.name === n) return n;
|
|
5385
|
-
else return `${n}: ${
|
|
5386
|
-
} else if (e.type === "RestElement") return `...${
|
|
5402
|
+
else return `${n}: ${X(e.value, t)}`;
|
|
5403
|
+
} else if (e.type === "RestElement") return `...${X(e.argument, t)}`;
|
|
5387
5404
|
return "";
|
|
5388
5405
|
}).filter(Boolean).join(", ")} }`;
|
|
5389
5406
|
default: return e.name || $(e, t);
|
|
5390
5407
|
}
|
|
5391
5408
|
}
|
|
5392
|
-
function
|
|
5409
|
+
function Z(e, t, n) {
|
|
5393
5410
|
return n && n.has(e) ? `(${e} = ${t})` : `(typeof setScopeValue === 'function' && scope ? setScopeValue(scope, ${JSON.stringify(e)}, ${t}) : ((scope || {})[${JSON.stringify(e)}] = ${t}))`;
|
|
5394
5411
|
}
|
|
5395
|
-
function
|
|
5412
|
+
function Q(e, t, n, r = { count: 0 }) {
|
|
5396
5413
|
let i = [];
|
|
5397
5414
|
if (!e) return i;
|
|
5398
|
-
if (e.type === "Identifier") return i.push(
|
|
5415
|
+
if (e.type === "Identifier") return i.push(Z(e.name, t, n)), i;
|
|
5399
5416
|
if (e.type === "AssignmentPattern") {
|
|
5400
5417
|
let a = `((${t} !== undefined) ? ${t} : ${$(e.right, n)})`;
|
|
5401
|
-
if (e.left?.type === "Identifier") i.push(
|
|
5418
|
+
if (e.left?.type === "Identifier") i.push(Z(e.left.name, a, n));
|
|
5402
5419
|
else {
|
|
5403
5420
|
let t = `_t${r.count++}`;
|
|
5404
|
-
i.push(`const ${t} = ${a}`), i.push(...
|
|
5421
|
+
i.push(`const ${t} = ${a}`), i.push(...Q(e.left, t, n, r));
|
|
5405
5422
|
}
|
|
5406
5423
|
return i;
|
|
5407
5424
|
}
|
|
@@ -5410,29 +5427,36 @@ function ln(e, t, n, r = { count: 0 }) {
|
|
|
5410
5427
|
let e = a.computed ? $(a.key, n) : a.key?.name === void 0 ? typeof a.key?.value == "string" || typeof a.key?.value == "number" ? JSON.stringify(a.key.value) : $(a.key, n) : JSON.stringify(a.key.name);
|
|
5411
5428
|
if (a.value?.type === "Identifier") {
|
|
5412
5429
|
let r = `(${t} ? ${t}[${e}] : undefined)`;
|
|
5413
|
-
i.push(
|
|
5430
|
+
i.push(Z(a.value.name, r, n));
|
|
5414
5431
|
} else if (a.value?.type === "AssignmentPattern") {
|
|
5415
5432
|
let o = `((${t} && ${t}[${e}] !== undefined) ? ${t}[${e}] : ${$(a.value.right, n)})`;
|
|
5416
|
-
if (a.value.left?.type === "Identifier") i.push(
|
|
5433
|
+
if (a.value.left?.type === "Identifier") i.push(Z(a.value.left.name, o, n));
|
|
5417
5434
|
else {
|
|
5418
5435
|
let e = `_t${r.count++}`;
|
|
5419
|
-
i.push(`const ${e} = ${o}`), i.push(...
|
|
5436
|
+
i.push(`const ${e} = ${o}`), i.push(...Q(a.value.left, e, n, r));
|
|
5420
5437
|
}
|
|
5421
5438
|
} else if (a.value?.type === "ObjectPattern" || a.value?.type === "ArrayPattern") {
|
|
5422
5439
|
let o = `_t${r.count++}`, s = `(${t} ? ${t}[${e}] : undefined)`;
|
|
5423
|
-
i.push(`const ${o} = ${s}`), i.push(...
|
|
5440
|
+
i.push(`const ${o} = ${s}`), i.push(...Q(a.value, o, n, r));
|
|
5424
5441
|
} else {
|
|
5425
5442
|
let r = a.value?.name || $(a.value, n);
|
|
5426
5443
|
if (r) {
|
|
5427
5444
|
let a = `(${t} ? ${t}[${e}] : undefined)`;
|
|
5428
|
-
i.push(
|
|
5445
|
+
i.push(Z(r, a, n));
|
|
5429
5446
|
}
|
|
5430
5447
|
}
|
|
5431
5448
|
} else if (a.type === "RestElement") {
|
|
5432
5449
|
let r = a.argument?.name || $(a.argument, n);
|
|
5433
5450
|
if (r) {
|
|
5434
|
-
|
|
5435
|
-
|
|
5451
|
+
(e.properties || []).filter((e) => e.type === "Property").map((e) => {
|
|
5452
|
+
let t = e.key?.name === void 0 ? typeof e.key?.value == "string" ? e.key.value : null : e.key.name;
|
|
5453
|
+
return t == null ? null : JSON.stringify(t);
|
|
5454
|
+
}).filter(Boolean);
|
|
5455
|
+
let a = (e.properties || []).filter((e) => e.type === "Property").map((e) => {
|
|
5456
|
+
let t = e.key?.name === void 0 ? typeof e.key?.value == "string" ? e.key.value : null : e.key.name;
|
|
5457
|
+
return t == null ? null : String(t);
|
|
5458
|
+
}).filter(Boolean).join(", "), o = `(((${a.length > 0 ? `{ ${a}, ...${r} }` : `{ ...${r} }`}) => ${r})(${t} ?? {}))`;
|
|
5459
|
+
i.push(Z(r, o, n));
|
|
5436
5460
|
}
|
|
5437
5461
|
}
|
|
5438
5462
|
return i;
|
|
@@ -5446,23 +5470,23 @@ function ln(e, t, n, r = { count: 0 }) {
|
|
|
5446
5470
|
if (t) {
|
|
5447
5471
|
if (t.type === "Identifier") {
|
|
5448
5472
|
let r = `(${a} ? ${a}[${e}] : undefined)`;
|
|
5449
|
-
i.push(
|
|
5473
|
+
i.push(Z(t.name, r, n));
|
|
5450
5474
|
} else if (t.type === "AssignmentPattern") {
|
|
5451
5475
|
let o = $(t.right, n), s = `((${a} && ${a}[${e}] !== undefined) ? ${a}[${e}] : ${o})`;
|
|
5452
|
-
if (t.left?.type === "Identifier") i.push(
|
|
5476
|
+
if (t.left?.type === "Identifier") i.push(Z(t.left.name, s, n));
|
|
5453
5477
|
else {
|
|
5454
5478
|
let e = `_t${r.count++}`;
|
|
5455
|
-
i.push(`const ${e} = ${s}`), i.push(...
|
|
5479
|
+
i.push(`const ${e} = ${s}`), i.push(...Q(t.left, e, n, r));
|
|
5456
5480
|
}
|
|
5457
5481
|
} else if (t.type === "RestElement") {
|
|
5458
5482
|
let r = t.argument?.name || $(t.argument, n);
|
|
5459
5483
|
if (r) {
|
|
5460
5484
|
let t = `((${a} && typeof ${a}.slice === 'function') ? ${a}.slice(${e}) : [])`;
|
|
5461
|
-
i.push(
|
|
5485
|
+
i.push(Z(r, t, n));
|
|
5462
5486
|
}
|
|
5463
5487
|
} else if (t.type === "ObjectPattern" || t.type === "ArrayPattern") {
|
|
5464
5488
|
let o = `_t${r.count++}`, s = `(${a} ? ${a}[${e}] : undefined)`;
|
|
5465
|
-
i.push(`const ${o} = ${s}`), i.push(...
|
|
5489
|
+
i.push(`const ${o} = ${s}`), i.push(...Q(t, o, n, r));
|
|
5466
5490
|
}
|
|
5467
5491
|
}
|
|
5468
5492
|
}
|
|
@@ -5470,12 +5494,16 @@ function ln(e, t, n, r = { count: 0 }) {
|
|
|
5470
5494
|
}
|
|
5471
5495
|
return i;
|
|
5472
5496
|
}
|
|
5497
|
+
function dn(e, t) {
|
|
5498
|
+
let n = [], r = Q(e, "_item", void 0, { count: 0 });
|
|
5499
|
+
return n.push(...r), t && n.push(Z(t, "_index", void 0)), { __drift_fn__: `(scope, declaredVars, setScopeValue, inScopeChain, resolveIterable, getScopeValue) => (_item, _index) => { ${n.join("; ")}; }` };
|
|
5500
|
+
}
|
|
5473
5501
|
function $(e, t) {
|
|
5474
5502
|
if (e == null) return "undefined";
|
|
5475
5503
|
if (typeof e != "object") return typeof e == "string" ? JSON.stringify(e) : String(e);
|
|
5476
5504
|
if (Array.isArray(e)) return e.map((e) => $(e, t)).join("; ");
|
|
5477
5505
|
switch (e.type) {
|
|
5478
|
-
case "Identifier": return t && t.has(e.name) ? e.name :
|
|
5506
|
+
case "Identifier": return t && t.has(e.name) ? e.name : e.name === "undefined" ? "undefined" : `getScopeValue(scope, ${JSON.stringify(e.name)})`;
|
|
5479
5507
|
case "Literal": return typeof e.raw == "string" ? e.raw : typeof e.value == "string" ? JSON.stringify(e.value) : String(e.value);
|
|
5480
5508
|
case "BinaryExpression":
|
|
5481
5509
|
case "LogicalExpression": return `(${$(e.left, t)} ${e.operator} ${$(e.right, t)})`;
|
|
@@ -5488,20 +5516,8 @@ function $(e, t) {
|
|
|
5488
5516
|
return e.computed ? e.optional ? `(${$(e.object, t)}?.[${$(e.property, t)}])` : `(${$(e.object, t)}[${$(e.property, t)}])` : `(${$(e.object, t)}${n}${e.property.name})`;
|
|
5489
5517
|
}
|
|
5490
5518
|
case "CallExpression": {
|
|
5491
|
-
let n = $(e.callee, t), r = e.arguments ? e.arguments.map((e) => $(e, t)).join(", ") : ""
|
|
5492
|
-
|
|
5493
|
-
let n = cn(e.callee.object), r = e.callee.property.name;
|
|
5494
|
-
if (n && [
|
|
5495
|
-
"push",
|
|
5496
|
-
"pop",
|
|
5497
|
-
"shift",
|
|
5498
|
-
"unshift",
|
|
5499
|
-
"splice",
|
|
5500
|
-
"sort",
|
|
5501
|
-
"reverse"
|
|
5502
|
-
].includes(r) && (!t || !t.has(n))) return `(() => { const _res = ${i}; if (typeof setScopeValue === 'function' && scope && typeof inScopeChain === 'function' && inScopeChain(scope, ${JSON.stringify(n)})) setScopeValue(scope, ${JSON.stringify(n)}, scope[${JSON.stringify(n)}]); return _res; })()`;
|
|
5503
|
-
}
|
|
5504
|
-
return i;
|
|
5519
|
+
let n = $(e.callee, t), r = e.arguments ? e.arguments.map((e) => $(e, t)).join(", ") : "";
|
|
5520
|
+
return `(${n}${e.optional ? "?.(" : "("}${r}))`;
|
|
5505
5521
|
}
|
|
5506
5522
|
case "AssignmentExpression": {
|
|
5507
5523
|
let n = $(e.right, t);
|
|
@@ -5515,10 +5531,10 @@ function $(e, t) {
|
|
|
5515
5531
|
}
|
|
5516
5532
|
}
|
|
5517
5533
|
if (e.left?.type === "MemberExpression") {
|
|
5518
|
-
let r =
|
|
5534
|
+
let r = un(e.left), i = `(${$(e.left, t)} ${e.operator} ${n})`;
|
|
5519
5535
|
if (r && (!t || !t.has(r))) return `(() => { const _res = ${i}; if (typeof setScopeValue === 'function' && scope && typeof inScopeChain === 'function' && inScopeChain(scope, ${JSON.stringify(r)})) setScopeValue(scope, ${JSON.stringify(r)}, scope[${JSON.stringify(r)}]); return _res; })()`;
|
|
5520
5536
|
}
|
|
5521
|
-
return e.left?.type === "ObjectPattern" || e.left?.type === "ArrayPattern" ? `((_val) => { ${
|
|
5537
|
+
return e.left?.type === "ObjectPattern" || e.left?.type === "ArrayPattern" ? `((_val) => { ${Q(e.left, "_val", t).join("; ")}; return _val; })(${n})` : `(${$(e.left, t)} ${e.operator} ${n})`;
|
|
5522
5538
|
}
|
|
5523
5539
|
case "UpdateExpression":
|
|
5524
5540
|
if (e.argument?.type === "Identifier") {
|
|
@@ -5528,7 +5544,7 @@ function $(e, t) {
|
|
|
5528
5544
|
return e.prefix ? `(typeof setScopeValue === 'function' ? (setScopeValue(scope, ${JSON.stringify(n)}, (Number(scope[${JSON.stringify(n)}]) || 0) ${r} 1), scope[${JSON.stringify(n)}]) : ((scope || {})[${JSON.stringify(n)}] = (Number((scope || {})[${JSON.stringify(n)}]) || 0) ${r} 1))` : `(() => { const _v = Number(scope[${JSON.stringify(n)}]) || 0; if (typeof setScopeValue === 'function') setScopeValue(scope, ${JSON.stringify(n)}, _v ${r} 1); else (scope || {})[${JSON.stringify(n)}] = _v ${r} 1; return _v; })()`;
|
|
5529
5545
|
}
|
|
5530
5546
|
if (e.argument?.type === "MemberExpression") {
|
|
5531
|
-
let n =
|
|
5547
|
+
let n = un(e.argument), r = e.prefix ? `(${e.operator}${$(e.argument, t)})` : `(${$(e.argument, t)}${e.operator})`;
|
|
5532
5548
|
if (n && (!t || !t.has(n))) return `(() => { const _res = ${r}; if (typeof setScopeValue === 'function' && scope && typeof inScopeChain === 'function' && inScopeChain(scope, ${JSON.stringify(n)})) setScopeValue(scope, ${JSON.stringify(n)}, scope[${JSON.stringify(n)}]); return _res; })()`;
|
|
5533
5549
|
}
|
|
5534
5550
|
return e.prefix ? `(${e.operator}${$(e.argument, t)})` : `(${$(e.argument, t)}${e.operator})`;
|
|
@@ -5540,8 +5556,8 @@ function $(e, t) {
|
|
|
5540
5556
|
if (e.kind === "get" || e.kind === "set") {
|
|
5541
5557
|
let r = e.value, i = new Set(t), a = [];
|
|
5542
5558
|
if (r.params) for (let e of r.params) {
|
|
5543
|
-
for (let t of
|
|
5544
|
-
a.push(
|
|
5559
|
+
for (let t of Y(e)) i.add(t);
|
|
5560
|
+
a.push(X(e, i));
|
|
5545
5561
|
}
|
|
5546
5562
|
let o = r.body?.type === "BlockStatement" ? `{ ${r.body.body.map((e) => $(e, i)).filter(Boolean).join("; ")}; }` : `{ ${$(r.body, i)}; }`;
|
|
5547
5563
|
return `${e.kind} ${n}(${a.join(", ")}) ${o}`;
|
|
@@ -5549,8 +5565,8 @@ function $(e, t) {
|
|
|
5549
5565
|
if (e.method) {
|
|
5550
5566
|
let r = e.value, i = new Set(t), a = [];
|
|
5551
5567
|
if (r.params) for (let e of r.params) {
|
|
5552
|
-
for (let t of
|
|
5553
|
-
a.push(
|
|
5568
|
+
for (let t of Y(e)) i.add(t);
|
|
5569
|
+
a.push(X(e, i));
|
|
5554
5570
|
}
|
|
5555
5571
|
let o = r.async ? "async " : "", s = r.generator ? "*" : "", c = r.body?.type === "BlockStatement" ? `{ ${r.body.body.map((e) => $(e, i)).filter(Boolean).join("; ")}; }` : `{ ${$(r.body, i)}; }`;
|
|
5556
5572
|
return `${o}${s}${n}(${a.join(", ")}) ${c}`;
|
|
@@ -5566,7 +5582,7 @@ function $(e, t) {
|
|
|
5566
5582
|
case "Super": return "super";
|
|
5567
5583
|
case "BlockStatement": {
|
|
5568
5584
|
let n = new Set(t);
|
|
5569
|
-
if (Array.isArray(e.body)) for (let t of e.body) if (t.type === "VariableDeclaration" && Array.isArray(t.declarations)) for (let e of t.declarations) for (let t of
|
|
5585
|
+
if (Array.isArray(e.body)) for (let t of e.body) if (t.type === "VariableDeclaration" && Array.isArray(t.declarations)) for (let e of t.declarations) for (let t of Y(e.id)) n.add(t);
|
|
5570
5586
|
else t.type === "FunctionDeclaration" && t.id?.name && n.add(t.id.name);
|
|
5571
5587
|
return `{ ${(e.body ? e.body.map((e) => $(e, n)).filter(Boolean) : []).join("; ")}; }`;
|
|
5572
5588
|
}
|
|
@@ -5580,8 +5596,8 @@ function $(e, t) {
|
|
|
5580
5596
|
case "CatchClause": {
|
|
5581
5597
|
let n = new Set(t), r = "";
|
|
5582
5598
|
if (e.param) {
|
|
5583
|
-
for (let t of
|
|
5584
|
-
r =
|
|
5599
|
+
for (let t of Y(e.param)) n.add(t);
|
|
5600
|
+
r = X(e.param, n);
|
|
5585
5601
|
}
|
|
5586
5602
|
let i = $(e.body, n);
|
|
5587
5603
|
return r ? `catch (${r}) ${i}` : `catch ${i}`;
|
|
@@ -5594,7 +5610,7 @@ function $(e, t) {
|
|
|
5594
5610
|
case "IfStatement": return `if (${$(e.test, t)}) ${e.consequent.type === "BlockStatement" ? $(e.consequent, t) : `{ ${$(e.consequent, t)}; }`}${e.alternate ? ` else ${e.alternate.type === "BlockStatement" || e.alternate.type === "IfStatement" ? $(e.alternate, t) : `{ ${$(e.alternate, t)}; }`}` : ""}`;
|
|
5595
5611
|
case "ForStatement": {
|
|
5596
5612
|
let n = new Set(t);
|
|
5597
|
-
if (e.init?.type === "VariableDeclaration" && e.init.declarations) for (let t of e.init.declarations) for (let e of
|
|
5613
|
+
if (e.init?.type === "VariableDeclaration" && e.init.declarations) for (let t of e.init.declarations) for (let e of Y(t.id)) n.add(e);
|
|
5598
5614
|
let r = "";
|
|
5599
5615
|
e.init?.type === "VariableDeclaration" && e.init.declarations ? r = (e.init.kind || "let") + " " + e.init.declarations.map((e) => `${e.id?.type === "Identifier" ? e.id.name : $(e.id, n)}${e.init ? ` = ${$(e.init, n)}` : ""}`).join(", ") : e.init && (r = $(e.init, n));
|
|
5600
5616
|
let i = e.test ? $(e.test, n) : "", a = e.update ? $(e.update, n) : "", o = e.body?.type === "BlockStatement" ? $(e.body, n) : `{ ${e.body ? $(e.body, n) : ""}; }`;
|
|
@@ -5605,7 +5621,7 @@ function $(e, t) {
|
|
|
5605
5621
|
if (e.left?.type === "VariableDeclaration") {
|
|
5606
5622
|
let t = e.left.kind || "let", i = e.left.declarations?.[0];
|
|
5607
5623
|
if (i) {
|
|
5608
|
-
for (let e of
|
|
5624
|
+
for (let e of Y(i.id)) n.add(e);
|
|
5609
5625
|
r = `${t} ${i.id?.type === "Identifier" ? i.id.name : $(i.id, n)}`;
|
|
5610
5626
|
}
|
|
5611
5627
|
} else e.left?.type === "Identifier" ? (n.add(e.left.name), r = e.left.name) : e.left && (r = $(e.left, n));
|
|
@@ -5617,7 +5633,7 @@ function $(e, t) {
|
|
|
5617
5633
|
if (e.left?.type === "VariableDeclaration") {
|
|
5618
5634
|
let t = e.left.kind || "let", i = e.left.declarations?.[0];
|
|
5619
5635
|
if (i) {
|
|
5620
|
-
for (let e of
|
|
5636
|
+
for (let e of Y(i.id)) n.add(e);
|
|
5621
5637
|
r = `${t} ${i.id?.type === "Identifier" ? i.id.name : $(i.id, n)}`;
|
|
5622
5638
|
}
|
|
5623
5639
|
} else e.left?.type === "Identifier" ? (n.add(e.left.name), r = e.left.name) : e.left && (r = $(e.left, n));
|
|
@@ -5648,7 +5664,7 @@ function $(e, t) {
|
|
|
5648
5664
|
}
|
|
5649
5665
|
let n = [];
|
|
5650
5666
|
if (e.declarations) for (let r of e.declarations) if (r.id?.type === "ObjectPattern" || r.id?.type === "ArrayPattern") {
|
|
5651
|
-
let e = r.init ? $(r.init, t) : "undefined", i =
|
|
5667
|
+
let e = r.init ? $(r.init, t) : "undefined", i = Q(r.id, "_init", t);
|
|
5652
5668
|
n.push(`((_init) => { ${i.join("; ")}; return _init; })(${e})`);
|
|
5653
5669
|
} else {
|
|
5654
5670
|
let e = r.id?.name || $(r.id, t), i = r.init ? $(r.init, t) : "undefined";
|
|
@@ -5661,10 +5677,10 @@ function $(e, t) {
|
|
|
5661
5677
|
n && r.add(n);
|
|
5662
5678
|
let i = [];
|
|
5663
5679
|
if (e.params) for (let t of e.params) {
|
|
5664
|
-
for (let e of
|
|
5665
|
-
i.push(
|
|
5680
|
+
for (let e of Y(t)) r.add(e);
|
|
5681
|
+
i.push(X(t, r));
|
|
5666
5682
|
}
|
|
5667
|
-
if (e.body?.type === "BlockStatement" && Array.isArray(e.body.body)) for (let t of e.body.body) if (t.type === "VariableDeclaration" && Array.isArray(t.declarations)) for (let e of t.declarations) for (let t of
|
|
5683
|
+
if (e.body?.type === "BlockStatement" && Array.isArray(e.body.body)) for (let t of e.body.body) if (t.type === "VariableDeclaration" && Array.isArray(t.declarations)) for (let e of t.declarations) for (let t of Y(e.id)) r.add(t);
|
|
5668
5684
|
else t.type === "FunctionDeclaration" && t.id?.name && r.add(t.id.name);
|
|
5669
5685
|
let a = i.join(", "), o = e.body?.type === "BlockStatement" ? `{ ${e.body.body.map((e) => $(e, r)).filter(Boolean).join("; ")}; }` : `{ ${$(e.body, r)}; }`, s = `${e.async ? "async " : ""}function${e.generator ? "*" : ""} ${n || ""}(${a}) ${o}`;
|
|
5670
5686
|
return n ? `((scope || {})[${JSON.stringify(n)}] = ${s})` : s;
|
|
@@ -5675,10 +5691,10 @@ function $(e, t) {
|
|
|
5675
5691
|
e.id?.name && n.add(e.id.name);
|
|
5676
5692
|
let r = [];
|
|
5677
5693
|
if (e.params) for (let t of e.params) {
|
|
5678
|
-
for (let e of
|
|
5679
|
-
r.push(
|
|
5694
|
+
for (let e of Y(t)) n.add(e);
|
|
5695
|
+
r.push(X(t, n));
|
|
5680
5696
|
}
|
|
5681
|
-
if (e.body?.type === "BlockStatement" && Array.isArray(e.body.body)) for (let t of e.body.body) if (t.type === "VariableDeclaration" && Array.isArray(t.declarations)) for (let e of t.declarations) for (let t of
|
|
5697
|
+
if (e.body?.type === "BlockStatement" && Array.isArray(e.body.body)) for (let t of e.body.body) if (t.type === "VariableDeclaration" && Array.isArray(t.declarations)) for (let e of t.declarations) for (let t of Y(e.id)) n.add(t);
|
|
5682
5698
|
else t.type === "FunctionDeclaration" && t.id?.name && n.add(t.id.name);
|
|
5683
5699
|
let i = r.join(", "), a = e.async ? "async " : "";
|
|
5684
5700
|
if (e.type === "ArrowFunctionExpression") return e.body?.type === "BlockStatement" ? `(${a}(${i}) => ${`{ ${e.body.body.map((e) => $(e, n)).filter(Boolean).join("; ")}; }`})` : `(${a}(${i}) => ${$(e.body, n)})`;
|
|
@@ -5698,10 +5714,10 @@ function $(e, t) {
|
|
|
5698
5714
|
case "MethodDefinition": {
|
|
5699
5715
|
let n = e.static ? "static " : "", r = e.kind === "get" || e.kind === "set" ? `${e.kind} ` : "", i = e.value?.async ? "async " : "", a = e.value?.generator ? "*" : "", o = e.computed ? `[${$(e.key, t)}]` : e.key?.name || $(e.key, t), s = new Set(t), c = [];
|
|
5700
5716
|
if (e.value?.params) for (let t of e.value.params) {
|
|
5701
|
-
for (let e of
|
|
5702
|
-
c.push(
|
|
5717
|
+
for (let e of Y(t)) s.add(e);
|
|
5718
|
+
c.push(X(t, s));
|
|
5703
5719
|
}
|
|
5704
|
-
if (e.value?.body?.type === "BlockStatement" && Array.isArray(e.value.body.body)) for (let t of e.value.body.body) if (t.type === "VariableDeclaration" && Array.isArray(t.declarations)) for (let e of t.declarations) for (let t of
|
|
5720
|
+
if (e.value?.body?.type === "BlockStatement" && Array.isArray(e.value.body.body)) for (let t of e.value.body.body) if (t.type === "VariableDeclaration" && Array.isArray(t.declarations)) for (let e of t.declarations) for (let t of Y(e.id)) s.add(t);
|
|
5705
5721
|
else t.type === "FunctionDeclaration" && t.id?.name && s.add(t.id.name);
|
|
5706
5722
|
return `${n}${i}${a}${r}${o}(${c.join(", ")}) ${e.value?.body ? $(e.value.body, s) : "{}"}`;
|
|
5707
5723
|
}
|
|
@@ -5717,13 +5733,13 @@ function $(e, t) {
|
|
|
5717
5733
|
default: return "";
|
|
5718
5734
|
}
|
|
5719
5735
|
}
|
|
5720
|
-
function
|
|
5721
|
-
let n = new
|
|
5736
|
+
function fn(e, t = !1) {
|
|
5737
|
+
let n = new cn(new on(new en(e)).parse()).transform(), r = new ln(n).generate();
|
|
5722
5738
|
return t && (console.log("--- Transformed AST ---"), console.log(JSON.stringify(n, null, 2)), console.log("--- Compiled Module ---"), console.log(JSON.stringify(r, null, 2))), r;
|
|
5723
5739
|
}
|
|
5724
5740
|
//#endregion
|
|
5725
5741
|
//#region src/index.ts
|
|
5726
|
-
function
|
|
5742
|
+
function pn(e) {
|
|
5727
5743
|
if (e == null) return String(e);
|
|
5728
5744
|
if (typeof e == "number") return Number.isNaN(e) ? "NaN" : e === Infinity ? "Infinity" : e === -Infinity ? "-Infinity" : Object.is(e, -0) ? "-0" : String(e);
|
|
5729
5745
|
if (typeof e == "bigint") return `${e.toString()}n`;
|
|
@@ -5733,15 +5749,15 @@ function dn(e) {
|
|
|
5733
5749
|
let t = e.__drift_fn__;
|
|
5734
5750
|
return `{ __drift_fn__: ${typeof t == "function" ? t.toString() : t} }`;
|
|
5735
5751
|
}
|
|
5736
|
-
return e instanceof RegExp ? e.toString() : e instanceof Date ? `new Date(${e.getTime()})` : e instanceof Set ? `new Set([${Array.from(e).map(
|
|
5752
|
+
return e instanceof RegExp ? e.toString() : e instanceof Date ? `new Date(${e.getTime()})` : e instanceof Set ? `new Set([${Array.from(e).map(pn).join(", ")}])` : e instanceof Map ? `new Map([${Array.from(e.entries()).map(([e, t]) => `[${pn(e)}, ${pn(t)}]`).join(", ")}])` : e instanceof Uint8Array ? `new Uint8Array([${Array.from(e).join(", ")}])` : e instanceof Uint32Array ? `new Uint32Array([${Array.from(e).join(", ")}])` : Array.isArray(e) ? `[${e.map(pn).join(", ")}]` : `{ ${Object.entries(e).filter(([e]) => e !== "start" && e !== "end" && e !== "loc").map(([e, t]) => `${JSON.stringify(e)}: ${pn(t)}`).join(", ")} }`;
|
|
5737
5753
|
}
|
|
5738
5754
|
return JSON.stringify(e);
|
|
5739
5755
|
}
|
|
5740
|
-
function
|
|
5741
|
-
return `[\n ${e.map(
|
|
5756
|
+
function mn(e) {
|
|
5757
|
+
return `[\n ${e.map(pn).join(",\n ")}\n ]`;
|
|
5742
5758
|
}
|
|
5743
|
-
function
|
|
5744
|
-
let n = JSON.stringify(Array.from(e.bytecode)), r =
|
|
5759
|
+
function hn(e, t) {
|
|
5760
|
+
let n = JSON.stringify(Array.from(e.bytecode)), r = mn(e.constants), i = JSON.stringify(e.reactiveBindings ?? []), a = JSON.stringify(e.declaredVars ?? []), o = JSON.stringify(e.derived ?? []), s = JSON.stringify(e.effects ?? []), c = [], l = [];
|
|
5745
5761
|
if (e.imports && e.imports.length > 0) for (let t of e.imports) t.isSideEffect || !t.localName && !t.isDefault && !t.isNamespace ? c.push(`import ${JSON.stringify(t.source)};`) : t.isNamespace ? (c.push(`import * as ${t.localName} from ${JSON.stringify(t.source)};`), l.push(t.localName)) : t.isDefault ? (c.push(`import ${t.localName} from ${JSON.stringify(t.source)};`), l.push(t.localName)) : t.importedName && (c.push(`import { ${t.importedName} as ${t.localName} } from ${JSON.stringify(t.source)};`), l.push(t.localName));
|
|
5746
5762
|
return `\
|
|
5747
5763
|
// [DriftJS] Auto-generated from: ${t}
|
|
@@ -5760,7 +5776,7 @@ const compiledModule = {
|
|
|
5760
5776
|
export default compiledModule;
|
|
5761
5777
|
`;
|
|
5762
5778
|
}
|
|
5763
|
-
function
|
|
5779
|
+
function gn(e = {}) {
|
|
5764
5780
|
let { debug: t = !1 } = e;
|
|
5765
5781
|
return {
|
|
5766
5782
|
name: "vite-plugin-drift",
|
|
@@ -5769,13 +5785,13 @@ function mn(e = {}) {
|
|
|
5769
5785
|
if (!(n.split("?")[0] ?? n).endsWith(".drift")) return null;
|
|
5770
5786
|
let r;
|
|
5771
5787
|
try {
|
|
5772
|
-
r =
|
|
5788
|
+
r = fn(e, t);
|
|
5773
5789
|
} catch (e) {
|
|
5774
5790
|
let t = e instanceof Error ? e.message : String(e);
|
|
5775
5791
|
this.error(`[DriftJS] Compilation failed in "${n}":\n${t}`);
|
|
5776
5792
|
}
|
|
5777
5793
|
return {
|
|
5778
|
-
code:
|
|
5794
|
+
code: hn(r, n),
|
|
5779
5795
|
map: null
|
|
5780
5796
|
};
|
|
5781
5797
|
},
|
|
@@ -5791,4 +5807,4 @@ function mn(e = {}) {
|
|
|
5791
5807
|
};
|
|
5792
5808
|
}
|
|
5793
5809
|
//#endregion
|
|
5794
|
-
export {
|
|
5810
|
+
export { gn as default, gn as driftPlugin, mn as serializeConstants, pn as serializeValueToJS };
|