driftjs-vite-plugin 0.0.13 → 0.0.14
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 +16 -14
- package/dist/index-es.js +1162 -1157
- package/package.json +3 -3
package/dist/index-es.js
CHANGED
|
@@ -15,119 +15,7 @@ var e = /* @__PURE__ */ new Set([
|
|
|
15
15
|
"track",
|
|
16
16
|
"wbr"
|
|
17
17
|
]);
|
|
18
|
-
function t(e
|
|
19
|
-
let n = t - 1;
|
|
20
|
-
for (; n >= 0 && /\s/.test(e[n]);) n--;
|
|
21
|
-
if (n < 0) return !0;
|
|
22
|
-
let r = e[n];
|
|
23
|
-
return /[(,=:[!&|?+\-*/%^~<>]/.test(r);
|
|
24
|
-
}
|
|
25
|
-
function n(e, n) {
|
|
26
|
-
let r = 0, i = 0, a = 0, o = null, s = !1, c = !1, l = !1, u = !1, d = !1, f = [];
|
|
27
|
-
for (let p = 0; p < e.length; p++) {
|
|
28
|
-
let m = e[p];
|
|
29
|
-
if (o !== null) {
|
|
30
|
-
if (s) {
|
|
31
|
-
s = !1;
|
|
32
|
-
continue;
|
|
33
|
-
}
|
|
34
|
-
if (m === "\\") {
|
|
35
|
-
s = !0;
|
|
36
|
-
continue;
|
|
37
|
-
}
|
|
38
|
-
if (o === "`" && m === "$" && e[p + 1] === "{") {
|
|
39
|
-
f.push(a), o = null, p++, a++;
|
|
40
|
-
continue;
|
|
41
|
-
}
|
|
42
|
-
if (m === o) {
|
|
43
|
-
o = null;
|
|
44
|
-
continue;
|
|
45
|
-
}
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
if (c) {
|
|
49
|
-
m === "\n" && (c = !1);
|
|
50
|
-
continue;
|
|
51
|
-
}
|
|
52
|
-
if (l) {
|
|
53
|
-
m === "*" && e[p + 1] === "/" && (l = !1, p++);
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
if (u) {
|
|
57
|
-
if (s) {
|
|
58
|
-
s = !1;
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
if (m === "\\") {
|
|
62
|
-
s = !0;
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
if (d) {
|
|
66
|
-
m === "]" && (d = !1);
|
|
67
|
-
continue;
|
|
68
|
-
}
|
|
69
|
-
if (m === "[") {
|
|
70
|
-
d = !0;
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
if (m === "/") {
|
|
74
|
-
u = !1;
|
|
75
|
-
continue;
|
|
76
|
-
}
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
79
|
-
if (m === "/" && e[p + 1] === "/") {
|
|
80
|
-
c = !0, p++;
|
|
81
|
-
continue;
|
|
82
|
-
}
|
|
83
|
-
if (m === "/" && e[p + 1] === "*") {
|
|
84
|
-
l = !0, p++;
|
|
85
|
-
continue;
|
|
86
|
-
}
|
|
87
|
-
if (m === "/" && t(e, p)) {
|
|
88
|
-
u = !0, d = !1;
|
|
89
|
-
continue;
|
|
90
|
-
}
|
|
91
|
-
if (m === "'" || m === "\"" || m === "`") {
|
|
92
|
-
o = m;
|
|
93
|
-
continue;
|
|
94
|
-
}
|
|
95
|
-
if (m === "(") {
|
|
96
|
-
r++;
|
|
97
|
-
continue;
|
|
98
|
-
}
|
|
99
|
-
if (m === ")") {
|
|
100
|
-
r = Math.max(0, r - 1);
|
|
101
|
-
continue;
|
|
102
|
-
}
|
|
103
|
-
if (m === "[") {
|
|
104
|
-
i++;
|
|
105
|
-
continue;
|
|
106
|
-
}
|
|
107
|
-
if (m === "]") {
|
|
108
|
-
i = Math.max(0, i - 1);
|
|
109
|
-
continue;
|
|
110
|
-
}
|
|
111
|
-
if (m === "{") {
|
|
112
|
-
a++;
|
|
113
|
-
continue;
|
|
114
|
-
}
|
|
115
|
-
if (m === "}") {
|
|
116
|
-
a = Math.max(0, a - 1), f.length > 0 && a === f[f.length - 1] && (f.pop(), o = "`");
|
|
117
|
-
continue;
|
|
118
|
-
}
|
|
119
|
-
if (r === 0 && i === 0 && a === 0 && o === null && !c && !l && !u) {
|
|
120
|
-
let e = n(p, m);
|
|
121
|
-
if (typeof e == "number") return e;
|
|
122
|
-
if (e === !0) return p;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
return -1;
|
|
126
|
-
}
|
|
127
|
-
function r(e, t) {
|
|
128
|
-
return n(e, (e, n) => n === t);
|
|
129
|
-
}
|
|
130
|
-
function i(e) {
|
|
18
|
+
function t(e) {
|
|
131
19
|
let t = e.trim();
|
|
132
20
|
if (!t.startsWith("(") || !t.endsWith(")")) return !1;
|
|
133
21
|
let n = 0, r = null, i = !1;
|
|
@@ -145,28 +33,9 @@ function i(e) {
|
|
|
145
33
|
}
|
|
146
34
|
return n === 1;
|
|
147
35
|
}
|
|
148
|
-
function a(e, t) {
|
|
149
|
-
if (!(t === "__proto__" || t === "constructor" || t === "prototype" || t === "__drift_mark_dirty__")) {
|
|
150
|
-
if (e && typeof e == "object") {
|
|
151
|
-
let n = e;
|
|
152
|
-
for (; n && n !== Object.prototype;) {
|
|
153
|
-
if (Object.prototype.hasOwnProperty.call(n, t)) return n[t];
|
|
154
|
-
n = Object.getPrototypeOf(n);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
if (typeof globalThis < "u" && globalThis) {
|
|
158
|
-
let e = globalThis;
|
|
159
|
-
for (; e && e !== Object.prototype;) {
|
|
160
|
-
if (Object.prototype.hasOwnProperty.call(e, t)) return globalThis[t];
|
|
161
|
-
e = Object.getPrototypeOf(e);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
typeof globalThis < "u" && !globalThis._get && (globalThis._get = a);
|
|
167
36
|
//#endregion
|
|
168
37
|
//#region ../../node_modules/.pnpm/acorn@8.17.0/node_modules/acorn/dist/acorn.mjs
|
|
169
|
-
var
|
|
38
|
+
var n = [
|
|
170
39
|
509,
|
|
171
40
|
0,
|
|
172
41
|
227,
|
|
@@ -497,7 +366,7 @@ var o = [
|
|
|
497
366
|
9,
|
|
498
367
|
787719,
|
|
499
368
|
239
|
|
500
|
-
],
|
|
369
|
+
], r = [
|
|
501
370
|
0,
|
|
502
371
|
11,
|
|
503
372
|
2,
|
|
@@ -1116,177 +985,177 @@ var o = [
|
|
|
1116
985
|
4938,
|
|
1117
986
|
6,
|
|
1118
987
|
8489
|
|
1119
|
-
],
|
|
988
|
+
], i = "·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ--ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・", a = "ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽ-ೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ--ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ", o = {
|
|
1120
989
|
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",
|
|
1121
990
|
5: "class enum extends super const export import",
|
|
1122
991
|
6: "enum",
|
|
1123
992
|
strict: "implements interface let package private protected public static yield",
|
|
1124
993
|
strictBind: "eval arguments"
|
|
1125
|
-
},
|
|
1126
|
-
5:
|
|
1127
|
-
"5module":
|
|
1128
|
-
6:
|
|
1129
|
-
},
|
|
1130
|
-
function
|
|
994
|
+
}, s = "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", c = {
|
|
995
|
+
5: s,
|
|
996
|
+
"5module": s + " export import",
|
|
997
|
+
6: s + " const class extends export import super"
|
|
998
|
+
}, l = /^in(stanceof)?$/, u = RegExp("[" + a + "]"), d = RegExp("[" + a + i + "]");
|
|
999
|
+
function f(e, t) {
|
|
1131
1000
|
for (var n = 65536, r = 0; r < t.length; r += 2) {
|
|
1132
1001
|
if (n += t[r], n > e) return !1;
|
|
1133
1002
|
if (n += t[r + 1], n >= e) return !0;
|
|
1134
1003
|
}
|
|
1135
1004
|
return !1;
|
|
1136
1005
|
}
|
|
1137
|
-
function
|
|
1138
|
-
return e < 65 ? e === 36 : e < 91 ? !0 : e < 97 ? e === 95 : e < 123 ? !0 : e <= 65535 ? e >= 170 &&
|
|
1006
|
+
function p(e, t) {
|
|
1007
|
+
return e < 65 ? e === 36 : e < 91 ? !0 : e < 97 ? e === 95 : e < 123 ? !0 : e <= 65535 ? e >= 170 && u.test(String.fromCharCode(e)) : t !== !1 && f(e, r);
|
|
1139
1008
|
}
|
|
1140
|
-
function
|
|
1141
|
-
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 &&
|
|
1009
|
+
function m(e, t) {
|
|
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 && d.test(String.fromCharCode(e)) : t === !1 ? !1 : f(e, r) || f(e, n);
|
|
1142
1011
|
}
|
|
1143
|
-
var
|
|
1012
|
+
var h = function(e, t) {
|
|
1144
1013
|
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;
|
|
1145
1014
|
};
|
|
1146
|
-
function
|
|
1147
|
-
return new
|
|
1015
|
+
function g(e, t) {
|
|
1016
|
+
return new h(e, {
|
|
1148
1017
|
beforeExpr: !0,
|
|
1149
1018
|
binop: t
|
|
1150
1019
|
});
|
|
1151
1020
|
}
|
|
1152
|
-
var
|
|
1153
|
-
function
|
|
1154
|
-
return t === void 0 && (t = {}), t.keyword = e, ee[e] = new
|
|
1021
|
+
var _ = { beforeExpr: !0 }, v = { startsExpr: !0 }, ee = {};
|
|
1022
|
+
function y(e, t) {
|
|
1023
|
+
return t === void 0 && (t = {}), t.keyword = e, ee[e] = new h(e, t);
|
|
1155
1024
|
}
|
|
1156
|
-
var
|
|
1157
|
-
num: new
|
|
1158
|
-
regexp: new
|
|
1159
|
-
string: new
|
|
1160
|
-
name: new
|
|
1161
|
-
privateId: new
|
|
1162
|
-
eof: new
|
|
1163
|
-
bracketL: new
|
|
1025
|
+
var b = {
|
|
1026
|
+
num: new h("num", v),
|
|
1027
|
+
regexp: new h("regexp", v),
|
|
1028
|
+
string: new h("string", v),
|
|
1029
|
+
name: new h("name", v),
|
|
1030
|
+
privateId: new h("privateId", v),
|
|
1031
|
+
eof: new h("eof"),
|
|
1032
|
+
bracketL: new h("[", {
|
|
1164
1033
|
beforeExpr: !0,
|
|
1165
1034
|
startsExpr: !0
|
|
1166
1035
|
}),
|
|
1167
|
-
bracketR: new
|
|
1168
|
-
braceL: new
|
|
1036
|
+
bracketR: new h("]"),
|
|
1037
|
+
braceL: new h("{", {
|
|
1169
1038
|
beforeExpr: !0,
|
|
1170
1039
|
startsExpr: !0
|
|
1171
1040
|
}),
|
|
1172
|
-
braceR: new
|
|
1173
|
-
parenL: new
|
|
1041
|
+
braceR: new h("}"),
|
|
1042
|
+
parenL: new h("(", {
|
|
1174
1043
|
beforeExpr: !0,
|
|
1175
1044
|
startsExpr: !0
|
|
1176
1045
|
}),
|
|
1177
|
-
parenR: new
|
|
1178
|
-
comma: new
|
|
1179
|
-
semi: new
|
|
1180
|
-
colon: new
|
|
1181
|
-
dot: new
|
|
1182
|
-
question: new
|
|
1183
|
-
questionDot: new
|
|
1184
|
-
arrow: new
|
|
1185
|
-
template: new
|
|
1186
|
-
invalidTemplate: new
|
|
1187
|
-
ellipsis: new
|
|
1188
|
-
backQuote: new
|
|
1189
|
-
dollarBraceL: new
|
|
1046
|
+
parenR: new h(")"),
|
|
1047
|
+
comma: new h(",", _),
|
|
1048
|
+
semi: new h(";", _),
|
|
1049
|
+
colon: new h(":", _),
|
|
1050
|
+
dot: new h("."),
|
|
1051
|
+
question: new h("?", _),
|
|
1052
|
+
questionDot: new h("?."),
|
|
1053
|
+
arrow: new h("=>", _),
|
|
1054
|
+
template: new h("template"),
|
|
1055
|
+
invalidTemplate: new h("invalidTemplate"),
|
|
1056
|
+
ellipsis: new h("...", _),
|
|
1057
|
+
backQuote: new h("`", v),
|
|
1058
|
+
dollarBraceL: new h("${", {
|
|
1190
1059
|
beforeExpr: !0,
|
|
1191
1060
|
startsExpr: !0
|
|
1192
1061
|
}),
|
|
1193
|
-
eq: new
|
|
1062
|
+
eq: new h("=", {
|
|
1194
1063
|
beforeExpr: !0,
|
|
1195
1064
|
isAssign: !0
|
|
1196
1065
|
}),
|
|
1197
|
-
assign: new
|
|
1066
|
+
assign: new h("_=", {
|
|
1198
1067
|
beforeExpr: !0,
|
|
1199
1068
|
isAssign: !0
|
|
1200
1069
|
}),
|
|
1201
|
-
incDec: new
|
|
1070
|
+
incDec: new h("++/--", {
|
|
1202
1071
|
prefix: !0,
|
|
1203
1072
|
postfix: !0,
|
|
1204
1073
|
startsExpr: !0
|
|
1205
1074
|
}),
|
|
1206
|
-
prefix: new
|
|
1075
|
+
prefix: new h("!/~", {
|
|
1207
1076
|
beforeExpr: !0,
|
|
1208
1077
|
prefix: !0,
|
|
1209
1078
|
startsExpr: !0
|
|
1210
1079
|
}),
|
|
1211
|
-
logicalOR:
|
|
1212
|
-
logicalAND:
|
|
1213
|
-
bitwiseOR:
|
|
1214
|
-
bitwiseXOR:
|
|
1215
|
-
bitwiseAND:
|
|
1216
|
-
equality:
|
|
1217
|
-
relational:
|
|
1218
|
-
bitShift:
|
|
1219
|
-
plusMin: new
|
|
1080
|
+
logicalOR: g("||", 1),
|
|
1081
|
+
logicalAND: g("&&", 2),
|
|
1082
|
+
bitwiseOR: g("|", 3),
|
|
1083
|
+
bitwiseXOR: g("^", 4),
|
|
1084
|
+
bitwiseAND: g("&", 5),
|
|
1085
|
+
equality: g("==/!=/===/!==", 6),
|
|
1086
|
+
relational: g("</>/<=/>=", 7),
|
|
1087
|
+
bitShift: g("<</>>/>>>", 8),
|
|
1088
|
+
plusMin: new h("+/-", {
|
|
1220
1089
|
beforeExpr: !0,
|
|
1221
1090
|
binop: 9,
|
|
1222
1091
|
prefix: !0,
|
|
1223
1092
|
startsExpr: !0
|
|
1224
1093
|
}),
|
|
1225
|
-
modulo:
|
|
1226
|
-
star:
|
|
1227
|
-
slash:
|
|
1228
|
-
starstar: new
|
|
1229
|
-
coalesce:
|
|
1230
|
-
_break:
|
|
1231
|
-
_case:
|
|
1232
|
-
_catch:
|
|
1233
|
-
_continue:
|
|
1234
|
-
_debugger:
|
|
1235
|
-
_default:
|
|
1236
|
-
_do:
|
|
1094
|
+
modulo: g("%", 10),
|
|
1095
|
+
star: g("*", 10),
|
|
1096
|
+
slash: g("/", 10),
|
|
1097
|
+
starstar: new h("**", { beforeExpr: !0 }),
|
|
1098
|
+
coalesce: g("??", 1),
|
|
1099
|
+
_break: y("break"),
|
|
1100
|
+
_case: y("case", _),
|
|
1101
|
+
_catch: y("catch"),
|
|
1102
|
+
_continue: y("continue"),
|
|
1103
|
+
_debugger: y("debugger"),
|
|
1104
|
+
_default: y("default", _),
|
|
1105
|
+
_do: y("do", {
|
|
1237
1106
|
isLoop: !0,
|
|
1238
1107
|
beforeExpr: !0
|
|
1239
1108
|
}),
|
|
1240
|
-
_else:
|
|
1241
|
-
_finally:
|
|
1242
|
-
_for:
|
|
1243
|
-
_function:
|
|
1244
|
-
_if:
|
|
1245
|
-
_return:
|
|
1246
|
-
_switch:
|
|
1247
|
-
_throw:
|
|
1248
|
-
_try:
|
|
1249
|
-
_var:
|
|
1250
|
-
_const:
|
|
1251
|
-
_while:
|
|
1252
|
-
_with:
|
|
1253
|
-
_new:
|
|
1109
|
+
_else: y("else", _),
|
|
1110
|
+
_finally: y("finally"),
|
|
1111
|
+
_for: y("for", { isLoop: !0 }),
|
|
1112
|
+
_function: y("function", v),
|
|
1113
|
+
_if: y("if"),
|
|
1114
|
+
_return: y("return", _),
|
|
1115
|
+
_switch: y("switch"),
|
|
1116
|
+
_throw: y("throw", _),
|
|
1117
|
+
_try: y("try"),
|
|
1118
|
+
_var: y("var"),
|
|
1119
|
+
_const: y("const"),
|
|
1120
|
+
_while: y("while", { isLoop: !0 }),
|
|
1121
|
+
_with: y("with"),
|
|
1122
|
+
_new: y("new", {
|
|
1254
1123
|
beforeExpr: !0,
|
|
1255
1124
|
startsExpr: !0
|
|
1256
1125
|
}),
|
|
1257
|
-
_this:
|
|
1258
|
-
_super:
|
|
1259
|
-
_class:
|
|
1260
|
-
_extends:
|
|
1261
|
-
_export:
|
|
1262
|
-
_import:
|
|
1263
|
-
_null:
|
|
1264
|
-
_true:
|
|
1265
|
-
_false:
|
|
1266
|
-
_in:
|
|
1126
|
+
_this: y("this", v),
|
|
1127
|
+
_super: y("super", v),
|
|
1128
|
+
_class: y("class", v),
|
|
1129
|
+
_extends: y("extends", _),
|
|
1130
|
+
_export: y("export"),
|
|
1131
|
+
_import: y("import", v),
|
|
1132
|
+
_null: y("null", v),
|
|
1133
|
+
_true: y("true", v),
|
|
1134
|
+
_false: y("false", v),
|
|
1135
|
+
_in: y("in", {
|
|
1267
1136
|
beforeExpr: !0,
|
|
1268
1137
|
binop: 7
|
|
1269
1138
|
}),
|
|
1270
|
-
_instanceof:
|
|
1139
|
+
_instanceof: y("instanceof", {
|
|
1271
1140
|
beforeExpr: !0,
|
|
1272
1141
|
binop: 7
|
|
1273
1142
|
}),
|
|
1274
|
-
_typeof:
|
|
1143
|
+
_typeof: y("typeof", {
|
|
1275
1144
|
beforeExpr: !0,
|
|
1276
1145
|
prefix: !0,
|
|
1277
1146
|
startsExpr: !0
|
|
1278
1147
|
}),
|
|
1279
|
-
_void:
|
|
1148
|
+
_void: y("void", {
|
|
1280
1149
|
beforeExpr: !0,
|
|
1281
1150
|
prefix: !0,
|
|
1282
1151
|
startsExpr: !0
|
|
1283
1152
|
}),
|
|
1284
|
-
_delete:
|
|
1153
|
+
_delete: y("delete", {
|
|
1285
1154
|
beforeExpr: !0,
|
|
1286
1155
|
prefix: !0,
|
|
1287
1156
|
startsExpr: !0
|
|
1288
1157
|
})
|
|
1289
|
-
},
|
|
1158
|
+
}, x = /\r\n?|\n|\u2028|\u2029/, te = new RegExp(x.source, "g");
|
|
1290
1159
|
function ne(e) {
|
|
1291
1160
|
return e === 10 || e === 13 || e === 8232 || e === 8233;
|
|
1292
1161
|
}
|
|
@@ -1298,34 +1167,34 @@ function re(e, t, n) {
|
|
|
1298
1167
|
}
|
|
1299
1168
|
return -1;
|
|
1300
1169
|
}
|
|
1301
|
-
var ie = /[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,
|
|
1170
|
+
var ie = /[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/, S = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g, ae = Object.prototype, oe = ae.hasOwnProperty, se = ae.toString, ce = Object.hasOwn || (function(e, t) {
|
|
1302
1171
|
return oe.call(e, t);
|
|
1303
1172
|
}), le = Array.isArray || (function(e) {
|
|
1304
1173
|
return se.call(e) === "[object Array]";
|
|
1305
1174
|
}), ue = Object.create(null);
|
|
1306
|
-
function
|
|
1175
|
+
function C(e) {
|
|
1307
1176
|
return ue[e] || (ue[e] = RegExp("^(?:" + e.replace(/ /g, "|") + ")$"));
|
|
1308
1177
|
}
|
|
1309
|
-
function
|
|
1178
|
+
function w(e) {
|
|
1310
1179
|
return e <= 65535 ? String.fromCharCode(e) : (e -= 65536, String.fromCharCode((e >> 10) + 55296, (e & 1023) + 56320));
|
|
1311
1180
|
}
|
|
1312
|
-
var
|
|
1181
|
+
var de = /(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/, fe = function(e, t) {
|
|
1313
1182
|
this.line = e, this.column = t;
|
|
1314
1183
|
};
|
|
1315
|
-
|
|
1316
|
-
return new
|
|
1184
|
+
fe.prototype.offset = function(e) {
|
|
1185
|
+
return new fe(this.line, this.column + e);
|
|
1317
1186
|
};
|
|
1318
|
-
var
|
|
1187
|
+
var pe = function(e, t, n) {
|
|
1319
1188
|
this.start = t, this.end = n, e.sourceFile !== null && (this.source = e.sourceFile);
|
|
1320
1189
|
};
|
|
1321
|
-
function
|
|
1190
|
+
function me(e, t) {
|
|
1322
1191
|
for (var n = 1, r = 0;;) {
|
|
1323
1192
|
var i = re(e, r, t);
|
|
1324
|
-
if (i < 0) return new
|
|
1193
|
+
if (i < 0) return new fe(n, t - r);
|
|
1325
1194
|
++n, r = i;
|
|
1326
1195
|
}
|
|
1327
1196
|
}
|
|
1328
|
-
var
|
|
1197
|
+
var he = {
|
|
1329
1198
|
ecmaVersion: null,
|
|
1330
1199
|
sourceType: "script",
|
|
1331
1200
|
strict: !1,
|
|
@@ -1346,20 +1215,20 @@ var ge = {
|
|
|
1346
1215
|
sourceFile: null,
|
|
1347
1216
|
directSourceFile: null,
|
|
1348
1217
|
preserveParens: !1
|
|
1349
|
-
},
|
|
1350
|
-
function
|
|
1218
|
+
}, ge = !1;
|
|
1219
|
+
function _e(e) {
|
|
1351
1220
|
var t = {};
|
|
1352
|
-
for (var n in
|
|
1353
|
-
if (t.ecmaVersion === "latest" ? t.ecmaVersion = 1e8 : t.ecmaVersion == null ? (!
|
|
1221
|
+
for (var n in he) t[n] = e && ce(e, n) ? e[n] : he[n];
|
|
1222
|
+
if (t.ecmaVersion === "latest" ? t.ecmaVersion = 1e8 : t.ecmaVersion == null ? (!ge && typeof console == "object" && console.warn && (ge = !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), le(t.onToken)) {
|
|
1354
1223
|
var r = t.onToken;
|
|
1355
1224
|
t.onToken = function(e) {
|
|
1356
1225
|
return r.push(e);
|
|
1357
1226
|
};
|
|
1358
1227
|
}
|
|
1359
|
-
if (le(t.onComment) && (t.onComment =
|
|
1228
|
+
if (le(t.onComment) && (t.onComment = ve(t, t.onComment)), t.sourceType === "commonjs" && t.allowAwaitOutsideFunction) throw Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");
|
|
1360
1229
|
return t;
|
|
1361
1230
|
}
|
|
1362
|
-
function
|
|
1231
|
+
function ve(e, t) {
|
|
1363
1232
|
return function(n, r, i, a, o, s) {
|
|
1364
1233
|
var c = {
|
|
1365
1234
|
type: n ? "Block" : "Line",
|
|
@@ -1367,20 +1236,20 @@ function ye(e, t) {
|
|
|
1367
1236
|
start: i,
|
|
1368
1237
|
end: a
|
|
1369
1238
|
};
|
|
1370
|
-
e.locations && (c.loc = new
|
|
1239
|
+
e.locations && (c.loc = new pe(this, o, s)), e.ranges && (c.range = [i, a]), t.push(c);
|
|
1371
1240
|
};
|
|
1372
1241
|
}
|
|
1373
|
-
var
|
|
1374
|
-
function
|
|
1375
|
-
return
|
|
1242
|
+
var ye = 1, T = 2, be = 4, xe = 8, Se = 16, Ce = 32, we = 64, Te = 128, Ee = 256, De = 512, Oe = 1024, ke = ye | T | Ee;
|
|
1243
|
+
function Ae(e, t) {
|
|
1244
|
+
return T | (e ? be : 0) | (t ? xe : 0);
|
|
1376
1245
|
}
|
|
1377
|
-
var
|
|
1378
|
-
this.options = e =
|
|
1246
|
+
var je = 0, Me = 1, E = 2, Ne = 3, Pe = 4, Fe = 5, D = function(e, t, n) {
|
|
1247
|
+
this.options = e = _e(e), this.sourceFile = e.sourceFile, this.keywords = C(c[e.ecmaVersion >= 6 ? 6 : e.sourceType === "module" ? "5module" : 5]);
|
|
1379
1248
|
var r = "";
|
|
1380
|
-
e.allowReserved !== !0 && (r =
|
|
1381
|
-
var i = (r ? r + " " : "") +
|
|
1382
|
-
this.reservedWordsStrict =
|
|
1383
|
-
},
|
|
1249
|
+
e.allowReserved !== !0 && (r = o[e.ecmaVersion >= 6 ? 6 : e.ecmaVersion === 5 ? 5 : 3], e.sourceType === "module" && (r += " await")), this.reservedWords = C(r);
|
|
1250
|
+
var i = (r ? r + " " : "") + o.strict;
|
|
1251
|
+
this.reservedWordsStrict = C(i), this.reservedWordsStrictBind = C(i + " " + o.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" ? T : ye), this.regexpState = null, this.privateNameStack = [];
|
|
1252
|
+
}, O = {
|
|
1384
1253
|
inFunction: { configurable: !0 },
|
|
1385
1254
|
inGenerator: { configurable: !0 },
|
|
1386
1255
|
inAsync: { configurable: !0 },
|
|
@@ -1393,120 +1262,120 @@ var Ne = 0, Pe = 1, O = 2, Fe = 3, Ie = 4, Le = 5, k = function(e, t, n) {
|
|
|
1393
1262
|
allowUsing: { configurable: !0 },
|
|
1394
1263
|
inClassStaticBlock: { configurable: !0 }
|
|
1395
1264
|
};
|
|
1396
|
-
|
|
1265
|
+
D.prototype.parse = function() {
|
|
1397
1266
|
var e = this, t = this.options.program || this.startNode();
|
|
1398
1267
|
return this.nextToken(), this.catchStackOverflow(function() {
|
|
1399
1268
|
return e.parseTopLevel(t);
|
|
1400
1269
|
});
|
|
1401
|
-
},
|
|
1270
|
+
}, O.inFunction.get = function() {
|
|
1271
|
+
return (this.currentVarScope().flags & T) > 0;
|
|
1272
|
+
}, O.inGenerator.get = function() {
|
|
1402
1273
|
return (this.currentVarScope().flags & xe) > 0;
|
|
1403
|
-
},
|
|
1404
|
-
return (this.currentVarScope().flags &
|
|
1405
|
-
},
|
|
1406
|
-
return (this.currentVarScope().flags & Se) > 0;
|
|
1407
|
-
}, A.canAwait.get = function() {
|
|
1274
|
+
}, O.inAsync.get = function() {
|
|
1275
|
+
return (this.currentVarScope().flags & be) > 0;
|
|
1276
|
+
}, O.canAwait.get = function() {
|
|
1408
1277
|
for (var e = this.scopeStack.length - 1; e >= 0; e--) {
|
|
1409
1278
|
var t = this.scopeStack[e].flags;
|
|
1410
|
-
if (t & (
|
|
1411
|
-
if (t &
|
|
1279
|
+
if (t & (Ee | De)) return !1;
|
|
1280
|
+
if (t & T) return (t & be) > 0;
|
|
1412
1281
|
}
|
|
1413
1282
|
return this.inModule && this.options.ecmaVersion >= 13 || this.options.allowAwaitOutsideFunction;
|
|
1414
|
-
},
|
|
1415
|
-
return !!(this.inFunction || this.options.allowReturnOutsideFunction && this.currentVarScope().flags &
|
|
1416
|
-
},
|
|
1417
|
-
return (this.currentThisScope().flags &
|
|
1418
|
-
},
|
|
1419
|
-
return (this.currentThisScope().flags &
|
|
1420
|
-
},
|
|
1283
|
+
}, O.allowReturn.get = function() {
|
|
1284
|
+
return !!(this.inFunction || this.options.allowReturnOutsideFunction && this.currentVarScope().flags & ye);
|
|
1285
|
+
}, O.allowSuper.get = function() {
|
|
1286
|
+
return (this.currentThisScope().flags & we) > 0 || this.options.allowSuperOutsideMethod;
|
|
1287
|
+
}, O.allowDirectSuper.get = function() {
|
|
1288
|
+
return (this.currentThisScope().flags & Te) > 0;
|
|
1289
|
+
}, O.treatFunctionsAsVar.get = function() {
|
|
1421
1290
|
return this.treatFunctionsAsVarInScope(this.currentScope());
|
|
1422
|
-
},
|
|
1291
|
+
}, O.allowNewDotTarget.get = function() {
|
|
1423
1292
|
for (var e = this.scopeStack.length - 1; e >= 0; e--) {
|
|
1424
1293
|
var t = this.scopeStack[e].flags;
|
|
1425
|
-
if (t & (
|
|
1294
|
+
if (t & (Ee | De) || t & T && !(t & Se)) return !0;
|
|
1426
1295
|
}
|
|
1427
1296
|
return !1;
|
|
1428
|
-
},
|
|
1297
|
+
}, O.allowUsing.get = function() {
|
|
1429
1298
|
var e = this.currentScope().flags;
|
|
1430
|
-
return !(e &
|
|
1431
|
-
},
|
|
1432
|
-
return (this.currentVarScope().flags &
|
|
1433
|
-
},
|
|
1299
|
+
return !(e & Oe || !this.inModule && e & ye);
|
|
1300
|
+
}, O.inClassStaticBlock.get = function() {
|
|
1301
|
+
return (this.currentVarScope().flags & Ee) > 0;
|
|
1302
|
+
}, D.extend = function() {
|
|
1434
1303
|
for (var e = [], t = arguments.length; t--;) e[t] = arguments[t];
|
|
1435
1304
|
for (var n = this, r = 0; r < e.length; r++) n = e[r](n);
|
|
1436
1305
|
return n;
|
|
1437
|
-
},
|
|
1306
|
+
}, D.parse = function(e, t) {
|
|
1438
1307
|
return new this(t, e).parse();
|
|
1439
|
-
},
|
|
1308
|
+
}, D.parseExpressionAt = function(e, t, n) {
|
|
1440
1309
|
var r = new this(n, e, t);
|
|
1441
1310
|
return r.nextToken(), r.parseExpression();
|
|
1442
|
-
},
|
|
1311
|
+
}, D.tokenizer = function(e, t) {
|
|
1443
1312
|
return new this(t, e);
|
|
1444
|
-
}, Object.defineProperties(
|
|
1445
|
-
var
|
|
1446
|
-
|
|
1313
|
+
}, Object.defineProperties(D.prototype, O);
|
|
1314
|
+
var k = D.prototype, Ie = /^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;
|
|
1315
|
+
k.strictDirective = function(e) {
|
|
1447
1316
|
if (this.options.ecmaVersion < 5) return !1;
|
|
1448
1317
|
for (;;) {
|
|
1449
|
-
|
|
1450
|
-
var t =
|
|
1318
|
+
S.lastIndex = e, e += S.exec(this.input)[0].length;
|
|
1319
|
+
var t = Ie.exec(this.input.slice(e));
|
|
1451
1320
|
if (!t) return !1;
|
|
1452
1321
|
if ((t[1] || t[2]) === "use strict") {
|
|
1453
|
-
|
|
1454
|
-
var n =
|
|
1455
|
-
return i === ";" || i === "}" ||
|
|
1322
|
+
S.lastIndex = e + t[0].length;
|
|
1323
|
+
var n = S.exec(this.input), r = n.index + n[0].length, i = this.input.charAt(r);
|
|
1324
|
+
return i === ";" || i === "}" || x.test(n[0]) && !(/[(`.[+\-/*%<>=,?^&]/.test(i) || i === "!" && this.input.charAt(r + 1) === "=");
|
|
1456
1325
|
}
|
|
1457
|
-
e += t[0].length,
|
|
1326
|
+
e += t[0].length, S.lastIndex = e, e += S.exec(this.input)[0].length, this.input[e] === ";" && e++;
|
|
1458
1327
|
}
|
|
1459
|
-
},
|
|
1328
|
+
}, k.eat = function(e) {
|
|
1460
1329
|
return this.type === e ? (this.next(), !0) : !1;
|
|
1461
|
-
},
|
|
1462
|
-
return this.type ===
|
|
1463
|
-
},
|
|
1330
|
+
}, k.isContextual = function(e) {
|
|
1331
|
+
return this.type === b.name && this.value === e && !this.containsEsc;
|
|
1332
|
+
}, k.eatContextual = function(e) {
|
|
1464
1333
|
return this.isContextual(e) ? (this.next(), !0) : !1;
|
|
1465
|
-
},
|
|
1334
|
+
}, k.catchStackOverflow = function(e) {
|
|
1466
1335
|
try {
|
|
1467
1336
|
return e();
|
|
1468
1337
|
} catch (e) {
|
|
1469
1338
|
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");
|
|
1470
1339
|
else throw e;
|
|
1471
1340
|
}
|
|
1472
|
-
},
|
|
1341
|
+
}, k.expectContextual = function(e) {
|
|
1473
1342
|
this.eatContextual(e) || this.unexpected();
|
|
1474
|
-
},
|
|
1475
|
-
return this.type ===
|
|
1476
|
-
},
|
|
1343
|
+
}, k.canInsertSemicolon = function() {
|
|
1344
|
+
return this.type === b.eof || this.type === b.braceR || x.test(this.input.slice(this.lastTokEnd, this.start));
|
|
1345
|
+
}, k.insertSemicolon = function() {
|
|
1477
1346
|
if (this.canInsertSemicolon()) return this.options.onInsertedSemicolon && this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc), !0;
|
|
1478
|
-
},
|
|
1479
|
-
!this.eat(
|
|
1480
|
-
},
|
|
1347
|
+
}, k.semicolon = function() {
|
|
1348
|
+
!this.eat(b.semi) && !this.insertSemicolon() && this.unexpected();
|
|
1349
|
+
}, k.afterTrailingComma = function(e, t) {
|
|
1481
1350
|
if (this.type === e) return this.options.onTrailingComma && this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc), t || this.next(), !0;
|
|
1482
|
-
},
|
|
1351
|
+
}, k.expect = function(e) {
|
|
1483
1352
|
this.eat(e) || this.unexpected();
|
|
1484
|
-
},
|
|
1353
|
+
}, k.unexpected = function(e) {
|
|
1485
1354
|
this.raise(e ?? this.start, "Unexpected token");
|
|
1486
1355
|
};
|
|
1487
|
-
var
|
|
1356
|
+
var Le = function() {
|
|
1488
1357
|
this.shorthandAssign = this.trailingComma = this.parenthesizedAssign = this.parenthesizedBind = this.doubleProto = -1;
|
|
1489
1358
|
};
|
|
1490
|
-
|
|
1359
|
+
k.checkPatternErrors = function(e, t) {
|
|
1491
1360
|
if (e) {
|
|
1492
1361
|
e.trailingComma > -1 && this.raiseRecoverable(e.trailingComma, "Comma is not permitted after the rest element");
|
|
1493
1362
|
var n = t ? e.parenthesizedAssign : e.parenthesizedBind;
|
|
1494
1363
|
n > -1 && this.raiseRecoverable(n, t ? "Assigning to rvalue" : "Parenthesized pattern");
|
|
1495
1364
|
}
|
|
1496
|
-
},
|
|
1365
|
+
}, k.checkExpressionErrors = function(e, t) {
|
|
1497
1366
|
if (!e) return !1;
|
|
1498
1367
|
var n = e.shorthandAssign, r = e.doubleProto;
|
|
1499
1368
|
if (!t) return n >= 0 || r >= 0;
|
|
1500
1369
|
n >= 0 && this.raise(n, "Shorthand property assignments are valid only in destructuring patterns"), r >= 0 && this.raiseRecoverable(r, "Redefinition of __proto__ property");
|
|
1501
|
-
},
|
|
1370
|
+
}, k.checkYieldAwaitInDefaultParams = function() {
|
|
1502
1371
|
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");
|
|
1503
|
-
},
|
|
1372
|
+
}, k.isSimpleAssignTarget = function(e) {
|
|
1504
1373
|
return e.type === "ParenthesizedExpression" ? this.isSimpleAssignTarget(e.expression) : e.type === "Identifier" || e.type === "MemberExpression";
|
|
1505
1374
|
};
|
|
1506
|
-
var
|
|
1507
|
-
|
|
1375
|
+
var A = D.prototype;
|
|
1376
|
+
A.parseTopLevel = function(e) {
|
|
1508
1377
|
var t = Object.create(null);
|
|
1509
|
-
for (e.body ||= []; this.type !==
|
|
1378
|
+
for (e.body ||= []; this.type !== b.eof;) {
|
|
1510
1379
|
var n = this.parseStatement(null, !0, t);
|
|
1511
1380
|
e.body.push(n);
|
|
1512
1381
|
}
|
|
@@ -1516,114 +1385,114 @@ M.parseTopLevel = function(e) {
|
|
|
1516
1385
|
}
|
|
1517
1386
|
return this.adaptDirectivePrologue(e.body), this.next(), e.sourceType = this.options.sourceType === "commonjs" ? "script" : this.options.sourceType, this.finishNode(e, "Program");
|
|
1518
1387
|
};
|
|
1519
|
-
var
|
|
1520
|
-
|
|
1388
|
+
var Re = { kind: "loop" }, ze = { kind: "switch" };
|
|
1389
|
+
A.isLet = function(e) {
|
|
1521
1390
|
if (this.options.ecmaVersion < 6 || !this.isContextual("let")) return !1;
|
|
1522
|
-
|
|
1523
|
-
var t =
|
|
1391
|
+
S.lastIndex = this.pos;
|
|
1392
|
+
var t = S.exec(this.input), n = this.pos + t[0].length, r = this.fullCharCodeAt(n);
|
|
1524
1393
|
if (r === 91 || r === 92) return !0;
|
|
1525
1394
|
if (e) return !1;
|
|
1526
1395
|
if (r === 123) return !0;
|
|
1527
|
-
if (
|
|
1396
|
+
if (p(r)) {
|
|
1528
1397
|
var i = n;
|
|
1529
1398
|
do
|
|
1530
1399
|
n += r <= 65535 ? 1 : 2;
|
|
1531
|
-
while (
|
|
1400
|
+
while (m(r = this.fullCharCodeAt(n)));
|
|
1532
1401
|
if (r === 92) return !0;
|
|
1533
1402
|
var a = this.input.slice(i, n);
|
|
1534
|
-
if (!
|
|
1403
|
+
if (!l.test(a)) return !0;
|
|
1535
1404
|
}
|
|
1536
1405
|
return !1;
|
|
1537
|
-
},
|
|
1406
|
+
}, A.isAsyncFunction = function() {
|
|
1538
1407
|
if (this.options.ecmaVersion < 8 || !this.isContextual("async")) return !1;
|
|
1539
|
-
|
|
1540
|
-
var e =
|
|
1541
|
-
return !
|
|
1542
|
-
},
|
|
1408
|
+
S.lastIndex = this.pos;
|
|
1409
|
+
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 || !(m(n = this.fullCharCodeAt(t + 8)) || n === 92));
|
|
1411
|
+
}, A.isUsingKeyword = function(e, t) {
|
|
1543
1412
|
if (this.options.ecmaVersion < 17 || !this.isContextual(e ? "await" : "using")) return !1;
|
|
1544
|
-
|
|
1545
|
-
var n =
|
|
1546
|
-
if (
|
|
1413
|
+
S.lastIndex = this.pos;
|
|
1414
|
+
var n = S.exec(this.input), r = this.pos + n[0].length;
|
|
1415
|
+
if (x.test(this.input.slice(this.pos, r))) return !1;
|
|
1547
1416
|
if (e) {
|
|
1548
1417
|
var i = r + 5, a;
|
|
1549
|
-
if (this.input.slice(r, i) !== "using" || i === this.input.length ||
|
|
1550
|
-
|
|
1551
|
-
var o =
|
|
1552
|
-
if (r = i + o[0].length, o &&
|
|
1418
|
+
if (this.input.slice(r, i) !== "using" || i === this.input.length || m(a = this.fullCharCodeAt(i)) || a === 92) return !1;
|
|
1419
|
+
S.lastIndex = i;
|
|
1420
|
+
var o = S.exec(this.input);
|
|
1421
|
+
if (r = i + o[0].length, o && x.test(this.input.slice(i, r))) return !1;
|
|
1553
1422
|
}
|
|
1554
1423
|
var s = this.fullCharCodeAt(r);
|
|
1555
|
-
if (!
|
|
1424
|
+
if (!p(s) && s !== 92) return !1;
|
|
1556
1425
|
var c = r;
|
|
1557
1426
|
do
|
|
1558
1427
|
r += s <= 65535 ? 1 : 2;
|
|
1559
|
-
while (
|
|
1428
|
+
while (m(s = this.fullCharCodeAt(r)));
|
|
1560
1429
|
if (s === 92) return !0;
|
|
1561
|
-
var
|
|
1562
|
-
if (
|
|
1563
|
-
if (t && !e &&
|
|
1564
|
-
|
|
1565
|
-
var
|
|
1566
|
-
if (r +=
|
|
1430
|
+
var u = this.input.slice(c, r);
|
|
1431
|
+
if (l.test(u)) return !1;
|
|
1432
|
+
if (t && !e && u === "of") {
|
|
1433
|
+
S.lastIndex = r;
|
|
1434
|
+
var d = S.exec(this.input);
|
|
1435
|
+
if (r += d[0].length, this.input.charCodeAt(r) !== 61 || (s = this.input.charCodeAt(r + 1)) === 61 || s === 62) return !1;
|
|
1567
1436
|
}
|
|
1568
1437
|
return !0;
|
|
1569
|
-
},
|
|
1438
|
+
}, A.isAwaitUsing = function(e) {
|
|
1570
1439
|
return this.isUsingKeyword(!0, e);
|
|
1571
|
-
},
|
|
1440
|
+
}, A.isUsing = function(e) {
|
|
1572
1441
|
return this.isUsingKeyword(!1, e);
|
|
1573
|
-
},
|
|
1442
|
+
}, A.parseStatement = function(e, t, n) {
|
|
1574
1443
|
var r = this.type, i = this.startNode(), a;
|
|
1575
|
-
switch (this.isLet(e) && (r =
|
|
1576
|
-
case
|
|
1577
|
-
case
|
|
1578
|
-
case
|
|
1579
|
-
case
|
|
1580
|
-
case
|
|
1581
|
-
case
|
|
1582
|
-
case
|
|
1583
|
-
case
|
|
1584
|
-
case
|
|
1585
|
-
case
|
|
1586
|
-
case
|
|
1587
|
-
case
|
|
1588
|
-
case
|
|
1589
|
-
case
|
|
1590
|
-
case
|
|
1591
|
-
case
|
|
1592
|
-
case
|
|
1593
|
-
case
|
|
1594
|
-
case
|
|
1595
|
-
case
|
|
1596
|
-
if (this.options.ecmaVersion > 10 && r ===
|
|
1597
|
-
|
|
1598
|
-
var o =
|
|
1444
|
+
switch (this.isLet(e) && (r = b._var, a = "let"), r) {
|
|
1445
|
+
case b._break:
|
|
1446
|
+
case b._continue: return this.parseBreakContinueStatement(i, r.keyword);
|
|
1447
|
+
case b._debugger: return this.parseDebuggerStatement(i);
|
|
1448
|
+
case b._do: return this.parseDoStatement(i);
|
|
1449
|
+
case b._for: return this.parseForStatement(i);
|
|
1450
|
+
case b._function: return e && (this.strict || e !== "if" && e !== "label") && this.options.ecmaVersion >= 6 && this.unexpected(), this.parseFunctionStatement(i, !1, !e);
|
|
1451
|
+
case b._class: return e && this.unexpected(), this.parseClass(i, !0);
|
|
1452
|
+
case b._if: return this.parseIfStatement(i);
|
|
1453
|
+
case b._return: return this.parseReturnStatement(i);
|
|
1454
|
+
case b._switch: return this.parseSwitchStatement(i);
|
|
1455
|
+
case b._throw: return this.parseThrowStatement(i);
|
|
1456
|
+
case b._try: return this.parseTryStatement(i);
|
|
1457
|
+
case b._const:
|
|
1458
|
+
case b._var: return a ||= this.value, e && a !== "var" && this.unexpected(), this.parseVarStatement(i, a);
|
|
1459
|
+
case b._while: return this.parseWhileStatement(i);
|
|
1460
|
+
case b._with: return this.parseWithStatement(i);
|
|
1461
|
+
case b.braceL: return this.parseBlock(!0, i);
|
|
1462
|
+
case b.semi: return this.parseEmptyStatement(i);
|
|
1463
|
+
case b._export:
|
|
1464
|
+
case b._import:
|
|
1465
|
+
if (this.options.ecmaVersion > 10 && r === b._import) {
|
|
1466
|
+
S.lastIndex = this.pos;
|
|
1467
|
+
var o = S.exec(this.input), s = this.pos + o[0].length, c = this.input.charCodeAt(s);
|
|
1599
1468
|
if (c === 40 || c === 46) return this.parseExpressionStatement(i, this.parseExpression());
|
|
1600
1469
|
}
|
|
1601
|
-
return this.options.allowImportExportEverywhere || (t || this.raise(this.start, "'import' and 'export' may only appear at the top level"), this.inModule || this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'")), r ===
|
|
1470
|
+
return this.options.allowImportExportEverywhere || (t || this.raise(this.start, "'import' and 'export' may only appear at the top level"), this.inModule || this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'")), r === b._import ? this.parseImport(i) : this.parseExport(i, n);
|
|
1602
1471
|
default:
|
|
1603
1472
|
if (this.isAsyncFunction()) return e && this.unexpected(), this.next(), this.parseFunctionStatement(i, !0, !e);
|
|
1604
1473
|
var l = this.isAwaitUsing(!1) ? "await using" : this.isUsing(!1) ? "using" : null;
|
|
1605
1474
|
if (l) return this.allowUsing || this.raise(this.start, "Using declaration cannot appear in the top level when source type is `script` or in the bare case statement"), e && this.raise(this.start, "Using declaration is not allowed in single-statement positions"), l === "await using" && (this.canAwait || this.raise(this.start, "Await using cannot appear outside of async function"), this.next()), this.next(), this.parseVar(i, !1, l), this.semicolon(), this.finishNode(i, "VariableDeclaration");
|
|
1606
1475
|
var u = this.value, d = this.parseExpression();
|
|
1607
|
-
return r ===
|
|
1476
|
+
return r === b.name && d.type === "Identifier" && this.eat(b.colon) ? this.parseLabeledStatement(i, u, d, e) : this.parseExpressionStatement(i, d);
|
|
1608
1477
|
}
|
|
1609
|
-
},
|
|
1478
|
+
}, A.parseBreakContinueStatement = function(e, t) {
|
|
1610
1479
|
var n = t === "break";
|
|
1611
|
-
this.next(), this.eat(
|
|
1480
|
+
this.next(), this.eat(b.semi) || this.insertSemicolon() ? e.label = null : this.type === b.name ? (e.label = this.parseIdent(), this.semicolon()) : this.unexpected();
|
|
1612
1481
|
for (var r = 0; r < this.labels.length; ++r) {
|
|
1613
1482
|
var i = this.labels[r];
|
|
1614
1483
|
if ((e.label == null || i.name === e.label.name) && (i.kind != null && (n || i.kind === "loop") || e.label && n)) break;
|
|
1615
1484
|
}
|
|
1616
1485
|
return r === this.labels.length && this.raise(e.start, "Unsyntactic " + t), this.finishNode(e, n ? "BreakStatement" : "ContinueStatement");
|
|
1617
|
-
},
|
|
1486
|
+
}, A.parseDebuggerStatement = function(e) {
|
|
1618
1487
|
return this.next(), this.semicolon(), this.finishNode(e, "DebuggerStatement");
|
|
1619
|
-
},
|
|
1620
|
-
return this.next(), this.labels.push(
|
|
1621
|
-
},
|
|
1488
|
+
}, A.parseDoStatement = function(e) {
|
|
1489
|
+
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
|
+
}, A.parseForStatement = function(e) {
|
|
1622
1491
|
this.next();
|
|
1623
1492
|
var t = this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual("await") ? this.lastTokStart : -1;
|
|
1624
|
-
if (this.labels.push(
|
|
1493
|
+
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);
|
|
1625
1494
|
var n = this.isLet();
|
|
1626
|
-
if (this.type ===
|
|
1495
|
+
if (this.type === b._var || this.type === b._const || n) {
|
|
1627
1496
|
var r = this.startNode(), i = n ? "let" : this.value;
|
|
1628
1497
|
return this.next(), this.parseVar(r, !0, i), this.finishNode(r, "VariableDeclaration"), this.parseForAfterInit(e, r, t);
|
|
1629
1498
|
}
|
|
@@ -1632,47 +1501,47 @@ M.isLet = function(e) {
|
|
|
1632
1501
|
var c = this.startNode();
|
|
1633
1502
|
return this.next(), s === "await using" && (this.canAwait || this.raise(this.start, "Await using cannot appear outside of async function"), this.next()), this.parseVar(c, !0, s), this.finishNode(c, "VariableDeclaration"), this.parseForAfterInit(e, c, t);
|
|
1634
1503
|
}
|
|
1635
|
-
var l = this.containsEsc, u = new
|
|
1636
|
-
return this.type ===
|
|
1637
|
-
},
|
|
1638
|
-
return (this.type ===
|
|
1639
|
-
},
|
|
1640
|
-
return this.next(), this.parseFunction(e,
|
|
1641
|
-
},
|
|
1642
|
-
return this.next(), e.test = this.parseParenExpression(), e.consequent = this.parseStatement("if"), e.alternate = this.eat(
|
|
1643
|
-
},
|
|
1644
|
-
return this.allowReturn || this.raise(this.start, "'return' outside of function"), this.next(), this.eat(
|
|
1645
|
-
},
|
|
1646
|
-
this.next(), e.discriminant = this.parseParenExpression(), e.cases = [], this.expect(
|
|
1647
|
-
for (var t, n = !1; this.type !==
|
|
1648
|
-
var r = this.type ===
|
|
1649
|
-
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(
|
|
1504
|
+
var l = this.containsEsc, u = new Le(), d = this.start, f = t > -1 ? this.parseExprSubscripts(u, "await") : this.parseExpression(!0, u);
|
|
1505
|
+
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
|
+
}, A.parseForAfterInit = function(e, t, n) {
|
|
1507
|
+
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
|
+
}, A.parseFunctionStatement = function(e, t, n) {
|
|
1509
|
+
return this.next(), this.parseFunction(e, Ve | (n ? 0 : He), !1, t);
|
|
1510
|
+
}, A.parseIfStatement = function(e) {
|
|
1511
|
+
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
|
+
}, A.parseReturnStatement = function(e) {
|
|
1513
|
+
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
|
+
}, A.parseSwitchStatement = function(e) {
|
|
1515
|
+
this.next(), e.discriminant = this.parseParenExpression(), e.cases = [], this.expect(b.braceL), this.labels.push(ze), this.enterScope(Oe);
|
|
1516
|
+
for (var t, n = !1; this.type !== b.braceR;) if (this.type === b._case || this.type === b._default) {
|
|
1517
|
+
var r = this.type === b._case;
|
|
1518
|
+
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);
|
|
1650
1519
|
} else t || this.unexpected(), t.consequent.push(this.parseStatement(null));
|
|
1651
1520
|
return this.exitScope(), t && this.finishNode(t, "SwitchCase"), this.next(), this.labels.pop(), this.finishNode(e, "SwitchStatement");
|
|
1652
|
-
},
|
|
1653
|
-
return this.next(),
|
|
1521
|
+
}, A.parseThrowStatement = function(e) {
|
|
1522
|
+
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");
|
|
1654
1523
|
};
|
|
1655
|
-
var
|
|
1656
|
-
|
|
1524
|
+
var Be = [];
|
|
1525
|
+
A.parseCatchClauseParam = function() {
|
|
1657
1526
|
var e = this.parseBindingAtom(), t = e.type === "Identifier";
|
|
1658
|
-
return this.enterScope(t ?
|
|
1659
|
-
},
|
|
1660
|
-
if (this.next(), e.block = this.parseBlock(), e.handler = null, this.type ===
|
|
1527
|
+
return this.enterScope(t ? Ce : 0), this.checkLValPattern(e, t ? Pe : E), this.expect(b.parenR), e;
|
|
1528
|
+
}, A.parseTryStatement = function(e) {
|
|
1529
|
+
if (this.next(), e.block = this.parseBlock(), e.handler = null, this.type === b._catch) {
|
|
1661
1530
|
var t = this.startNode();
|
|
1662
|
-
this.next(), this.eat(
|
|
1531
|
+
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");
|
|
1663
1532
|
}
|
|
1664
|
-
return e.finalizer = this.eat(
|
|
1665
|
-
},
|
|
1533
|
+
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
|
+
}, A.parseVarStatement = function(e, t, n) {
|
|
1666
1535
|
return this.next(), this.parseVar(e, !1, t, n), this.semicolon(), this.finishNode(e, "VariableDeclaration");
|
|
1667
|
-
},
|
|
1668
|
-
return this.next(), e.test = this.parseParenExpression(), this.labels.push(
|
|
1669
|
-
},
|
|
1536
|
+
}, A.parseWhileStatement = function(e) {
|
|
1537
|
+
return this.next(), e.test = this.parseParenExpression(), this.labels.push(Re), e.body = this.parseStatement("while"), this.labels.pop(), this.finishNode(e, "WhileStatement");
|
|
1538
|
+
}, A.parseWithStatement = function(e) {
|
|
1670
1539
|
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");
|
|
1671
|
-
},
|
|
1540
|
+
}, A.parseEmptyStatement = function(e) {
|
|
1672
1541
|
return this.next(), this.finishNode(e, "EmptyStatement");
|
|
1673
|
-
},
|
|
1542
|
+
}, A.parseLabeledStatement = function(e, t, n, r) {
|
|
1674
1543
|
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");
|
|
1675
|
-
for (var o = this.type.isLoop ? "loop" : this.type ===
|
|
1544
|
+
for (var o = this.type.isLoop ? "loop" : this.type === b._switch ? "switch" : null, s = this.labels.length - 1; s >= 0; s--) {
|
|
1676
1545
|
var c = this.labels[s];
|
|
1677
1546
|
if (c.statementStart === e.start) c.statementStart = this.start, c.kind = o;
|
|
1678
1547
|
else break;
|
|
@@ -1682,113 +1551,113 @@ M.parseCatchClauseParam = function() {
|
|
|
1682
1551
|
kind: o,
|
|
1683
1552
|
statementStart: this.start
|
|
1684
1553
|
}), e.body = this.parseStatement(r ? r.indexOf("label") === -1 ? r + "label" : r : "label"), this.labels.pop(), e.label = n, this.finishNode(e, "LabeledStatement");
|
|
1685
|
-
},
|
|
1554
|
+
}, A.parseExpressionStatement = function(e, t) {
|
|
1686
1555
|
return e.expression = t, this.semicolon(), this.finishNode(e, "ExpressionStatement");
|
|
1687
|
-
},
|
|
1688
|
-
for (e === void 0 && (e = !0), t === void 0 && (t = this.startNode()), t.body = [], this.expect(
|
|
1556
|
+
}, A.parseBlock = function(e, t, n) {
|
|
1557
|
+
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;) {
|
|
1689
1558
|
var r = this.parseStatement(null);
|
|
1690
1559
|
t.body.push(r);
|
|
1691
1560
|
}
|
|
1692
1561
|
return n && (this.strict = !1), this.next(), e && this.exitScope(), this.finishNode(t, "BlockStatement");
|
|
1693
|
-
},
|
|
1694
|
-
return e.init = t, this.expect(
|
|
1695
|
-
},
|
|
1696
|
-
var n = this.type ===
|
|
1697
|
-
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(
|
|
1698
|
-
},
|
|
1562
|
+
}, A.parseFor = function(e, t) {
|
|
1563
|
+
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
|
+
}, A.parseForIn = function(e, t) {
|
|
1565
|
+
var n = this.type === b._in;
|
|
1566
|
+
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
|
+
}, A.parseVar = function(e, t, n, r) {
|
|
1699
1568
|
for (e.declarations = [], e.kind = n;;) {
|
|
1700
1569
|
var i = this.startNode();
|
|
1701
|
-
if (this.parseVarId(i, n), this.eat(
|
|
1570
|
+
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;
|
|
1702
1571
|
}
|
|
1703
1572
|
return e;
|
|
1704
|
-
},
|
|
1705
|
-
e.id = t === "using" || t === "await using" ? this.parseIdent() : this.parseBindingAtom(), this.checkLValPattern(e.id, t === "var" ?
|
|
1573
|
+
}, A.parseVarId = function(e, t) {
|
|
1574
|
+
e.id = t === "using" || t === "await using" ? this.parseIdent() : this.parseBindingAtom(), this.checkLValPattern(e.id, t === "var" ? Me : E, !1);
|
|
1706
1575
|
};
|
|
1707
|
-
var
|
|
1708
|
-
|
|
1709
|
-
this.initFunction(e), (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !r) && (this.type ===
|
|
1576
|
+
var Ve = 1, He = 2, Ue = 4;
|
|
1577
|
+
A.parseFunction = function(e, t, n, r, i) {
|
|
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 : E : Ne));
|
|
1710
1579
|
var a = this.yieldPos, o = this.awaitPos, s = this.awaitIdentPos;
|
|
1711
|
-
return this.yieldPos = 0, this.awaitPos = 0, this.awaitIdentPos = 0, this.enterScope(
|
|
1712
|
-
},
|
|
1713
|
-
this.expect(
|
|
1714
|
-
},
|
|
1580
|
+
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
|
+
}, A.parseFunctionParams = function(e) {
|
|
1582
|
+
this.expect(b.parenL), e.params = this.parseBindingList(b.parenR, !1, this.options.ecmaVersion >= 8), this.checkYieldAwaitInDefaultParams();
|
|
1583
|
+
}, A.parseClass = function(e, t) {
|
|
1715
1584
|
this.next();
|
|
1716
1585
|
var n = this.strict;
|
|
1717
1586
|
this.strict = !0, this.parseClassId(e, t), this.parseClassSuper(e);
|
|
1718
1587
|
var r = this.enterClassBody(), i = this.startNode(), a = !1;
|
|
1719
|
-
for (i.body = [], this.expect(
|
|
1588
|
+
for (i.body = [], this.expect(b.braceL); this.type !== b.braceR;) {
|
|
1720
1589
|
var o = this.parseClassElement(e.superClass !== null);
|
|
1721
|
-
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" &&
|
|
1590
|
+
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"));
|
|
1722
1591
|
}
|
|
1723
1592
|
return this.strict = n, this.next(), e.body = this.finishNode(i, "ClassBody"), this.exitClassBody(), this.finishNode(e, t ? "ClassDeclaration" : "ClassExpression");
|
|
1724
|
-
},
|
|
1725
|
-
if (this.eat(
|
|
1593
|
+
}, A.parseClassElement = function(e) {
|
|
1594
|
+
if (this.eat(b.semi)) return null;
|
|
1726
1595
|
var t = this.options.ecmaVersion, n = this.startNode(), r = "", i = !1, a = !1, o = "method", s = !1;
|
|
1727
1596
|
if (this.eatContextual("static")) {
|
|
1728
|
-
if (t >= 13 && this.eat(
|
|
1729
|
-
this.isClassElementNameStart() || this.type ===
|
|
1597
|
+
if (t >= 13 && this.eat(b.braceL)) return this.parseClassStaticBlock(n), n;
|
|
1598
|
+
this.isClassElementNameStart() || this.type === b.star ? s = !0 : r = "static";
|
|
1730
1599
|
}
|
|
1731
|
-
if (n.static = s, !r && t >= 8 && this.eatContextual("async") && ((this.isClassElementNameStart() || this.type ===
|
|
1600
|
+
if (n.static = s, !r && t >= 8 && this.eatContextual("async") && ((this.isClassElementNameStart() || this.type === b.star) && !this.canInsertSemicolon() ? a = !0 : r = "async"), !r && (t >= 9 || !a) && this.eat(b.star) && (i = !0), !r && !a && !i) {
|
|
1732
1601
|
var c = this.value;
|
|
1733
1602
|
(this.eatContextual("get") || this.eatContextual("set")) && (this.isClassElementNameStart() ? o = c : r = c);
|
|
1734
1603
|
}
|
|
1735
|
-
if (r ? (n.computed = !1, n.key = this.startNodeAt(this.lastTokStart, this.lastTokStartLoc), n.key.name = r, this.finishNode(n.key, "Identifier")) : this.parseClassElementName(n), t < 13 || this.type ===
|
|
1736
|
-
var l = !n.static &&
|
|
1604
|
+
if (r ? (n.computed = !1, n.key = this.startNodeAt(this.lastTokStart, this.lastTokStartLoc), n.key.name = r, this.finishNode(n.key, "Identifier")) : this.parseClassElementName(n), t < 13 || this.type === b.parenL || o !== "method" || i || a) {
|
|
1605
|
+
var l = !n.static && Ge(n, "constructor"), u = l && e;
|
|
1737
1606
|
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);
|
|
1738
1607
|
} else this.parseClassField(n);
|
|
1739
1608
|
return n;
|
|
1740
|
-
},
|
|
1741
|
-
return this.type ===
|
|
1742
|
-
},
|
|
1743
|
-
this.type ===
|
|
1744
|
-
},
|
|
1609
|
+
}, A.isClassElementNameStart = function() {
|
|
1610
|
+
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
|
+
}, A.parseClassElementName = function(e) {
|
|
1612
|
+
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
|
+
}, A.parseClassMethod = function(e, t, n, r) {
|
|
1745
1614
|
var i = e.key;
|
|
1746
|
-
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 &&
|
|
1615
|
+
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");
|
|
1747
1616
|
var a = e.value = this.parseMethod(t, n, r);
|
|
1748
1617
|
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");
|
|
1749
|
-
},
|
|
1750
|
-
return
|
|
1751
|
-
},
|
|
1618
|
+
}, A.parseClassField = function(e) {
|
|
1619
|
+
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
|
+
}, A.parseClassStaticBlock = function(e) {
|
|
1752
1621
|
e.body = [];
|
|
1753
1622
|
var t = this.labels;
|
|
1754
|
-
for (this.labels = [], this.enterScope(
|
|
1623
|
+
for (this.labels = [], this.enterScope(Ee | we); this.type !== b.braceR;) {
|
|
1755
1624
|
var n = this.parseStatement(null);
|
|
1756
1625
|
e.body.push(n);
|
|
1757
1626
|
}
|
|
1758
1627
|
return this.next(), this.exitScope(), this.labels = t, this.finishNode(e, "StaticBlock");
|
|
1759
|
-
},
|
|
1760
|
-
this.type ===
|
|
1761
|
-
},
|
|
1762
|
-
e.superClass = this.eat(
|
|
1763
|
-
},
|
|
1628
|
+
}, A.parseClassId = function(e, t) {
|
|
1629
|
+
this.type === b.name ? (e.id = this.parseIdent(), t && this.checkLValSimple(e.id, E, !1)) : (t === !0 && this.unexpected(), e.id = null);
|
|
1630
|
+
}, A.parseClassSuper = function(e) {
|
|
1631
|
+
e.superClass = this.eat(b._extends) ? this.parseExprSubscripts(null, !1) : null;
|
|
1632
|
+
}, A.enterClassBody = function() {
|
|
1764
1633
|
var e = {
|
|
1765
1634
|
declared: Object.create(null),
|
|
1766
1635
|
used: []
|
|
1767
1636
|
};
|
|
1768
1637
|
return this.privateNameStack.push(e), e.declared;
|
|
1769
|
-
},
|
|
1638
|
+
}, A.exitClassBody = function() {
|
|
1770
1639
|
var e = this.privateNameStack.pop(), t = e.declared, n = e.used;
|
|
1771
1640
|
if (this.options.checkPrivateFields) for (var r = this.privateNameStack.length, i = r === 0 ? null : this.privateNameStack[r - 1], a = 0; a < n.length; ++a) {
|
|
1772
1641
|
var o = n[a];
|
|
1773
1642
|
ce(t, o.name) || (i ? i.used.push(o) : this.raiseRecoverable(o.start, "Private field '#" + o.name + "' must be declared in an enclosing class"));
|
|
1774
1643
|
}
|
|
1775
1644
|
};
|
|
1776
|
-
function
|
|
1645
|
+
function We(e, t) {
|
|
1777
1646
|
var n = t.key.name, r = e[n], i = "true";
|
|
1778
1647
|
return t.type === "MethodDefinition" && (t.kind === "get" || t.kind === "set") && (i = (t.static ? "s" : "i") + t.kind), r === "iget" && i === "iset" || r === "iset" && i === "iget" || r === "sget" && i === "sset" || r === "sset" && i === "sget" ? (e[n] = "true", !1) : r ? !0 : (e[n] = i, !1);
|
|
1779
1648
|
}
|
|
1780
|
-
function
|
|
1649
|
+
function Ge(e, t) {
|
|
1781
1650
|
var n = e.computed, r = e.key;
|
|
1782
1651
|
return !n && (r.type === "Identifier" && r.name === t || r.type === "Literal" && r.value === t);
|
|
1783
1652
|
}
|
|
1784
|
-
|
|
1785
|
-
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 !==
|
|
1786
|
-
},
|
|
1787
|
-
if (this.next(), this.eat(
|
|
1788
|
-
if (this.eat(
|
|
1653
|
+
A.parseExportAllDeclaration = function(e, t) {
|
|
1654
|
+
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
|
+
}, A.parseExport = function(e, t) {
|
|
1656
|
+
if (this.next(), this.eat(b.star)) return this.parseExportAllDeclaration(e, t);
|
|
1657
|
+
if (this.eat(b._default)) return this.checkExport(t, "default", this.lastTokStart), e.declaration = this.parseExportDefaultDeclaration(), this.finishNode(e, "ExportDefaultDeclaration");
|
|
1789
1658
|
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 = []);
|
|
1790
1659
|
else {
|
|
1791
|
-
if (e.declaration = null, e.specifiers = this.parseExportSpecifiers(t), this.eatContextual("from")) this.type !==
|
|
1660
|
+
if (e.declaration = null, e.specifiers = this.parseExportSpecifiers(t), this.eatContextual("from")) this.type !== b.string && this.unexpected(), e.source = this.parseExprAtom(), this.options.ecmaVersion >= 16 && (e.attributes = this.parseWithClause());
|
|
1792
1661
|
else {
|
|
1793
1662
|
for (var n = 0, r = e.specifiers; n < r.length; n += 1) {
|
|
1794
1663
|
var i = r[n];
|
|
@@ -1799,23 +1668,23 @@ M.parseExportAllDeclaration = function(e, t) {
|
|
|
1799
1668
|
this.semicolon();
|
|
1800
1669
|
}
|
|
1801
1670
|
return this.finishNode(e, "ExportNamedDeclaration");
|
|
1802
|
-
},
|
|
1671
|
+
}, A.parseExportDeclaration = function(e) {
|
|
1803
1672
|
return this.parseStatement(null);
|
|
1804
|
-
},
|
|
1673
|
+
}, A.parseExportDefaultDeclaration = function() {
|
|
1805
1674
|
var e;
|
|
1806
|
-
if (this.type ===
|
|
1675
|
+
if (this.type === b._function || (e = this.isAsyncFunction())) {
|
|
1807
1676
|
var t = this.startNode();
|
|
1808
|
-
return this.next(), e && this.next(), this.parseFunction(t,
|
|
1809
|
-
} else if (this.type ===
|
|
1677
|
+
return this.next(), e && this.next(), this.parseFunction(t, Ve | Ue, !1, e);
|
|
1678
|
+
} else if (this.type === b._class) {
|
|
1810
1679
|
var n = this.startNode();
|
|
1811
1680
|
return this.parseClass(n, "nullableID");
|
|
1812
1681
|
} else {
|
|
1813
1682
|
var r = this.parseMaybeAssign();
|
|
1814
1683
|
return this.semicolon(), r;
|
|
1815
1684
|
}
|
|
1816
|
-
},
|
|
1685
|
+
}, A.checkExport = function(e, t, n) {
|
|
1817
1686
|
e && (typeof t != "string" && (t = t.type === "Identifier" ? t.name : t.value), ce(e, t) && this.raiseRecoverable(n, "Duplicate export '" + t + "'"), e[t] = !0);
|
|
1818
|
-
},
|
|
1687
|
+
}, A.checkPatternExport = function(e, t) {
|
|
1819
1688
|
var n = t.type;
|
|
1820
1689
|
if (n === "Identifier") this.checkExport(e, t, t.start);
|
|
1821
1690
|
else if (n === "ObjectPattern") for (var r = 0, i = t.properties; r < i.length; r += 1) {
|
|
@@ -1827,72 +1696,72 @@ M.parseExportAllDeclaration = function(e, t) {
|
|
|
1827
1696
|
c && this.checkPatternExport(e, c);
|
|
1828
1697
|
}
|
|
1829
1698
|
else n === "Property" ? this.checkPatternExport(e, t.value) : n === "AssignmentPattern" ? this.checkPatternExport(e, t.left) : n === "RestElement" && this.checkPatternExport(e, t.argument);
|
|
1830
|
-
},
|
|
1699
|
+
}, A.checkVariableExport = function(e, t) {
|
|
1831
1700
|
if (e) for (var n = 0, r = t; n < r.length; n += 1) {
|
|
1832
1701
|
var i = r[n];
|
|
1833
1702
|
this.checkPatternExport(e, i.id);
|
|
1834
1703
|
}
|
|
1835
|
-
},
|
|
1704
|
+
}, A.shouldParseExportStatement = function() {
|
|
1836
1705
|
return this.type.keyword === "var" || this.type.keyword === "const" || this.type.keyword === "class" || this.type.keyword === "function" || this.isLet() || this.isAsyncFunction();
|
|
1837
|
-
},
|
|
1706
|
+
}, A.parseExportSpecifier = function(e) {
|
|
1838
1707
|
var t = this.startNode();
|
|
1839
1708
|
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");
|
|
1840
|
-
},
|
|
1709
|
+
}, A.parseExportSpecifiers = function(e) {
|
|
1841
1710
|
var t = [], n = !0;
|
|
1842
|
-
for (this.expect(
|
|
1711
|
+
for (this.expect(b.braceL); !this.eat(b.braceR);) {
|
|
1843
1712
|
if (n) n = !1;
|
|
1844
|
-
else if (this.expect(
|
|
1713
|
+
else if (this.expect(b.comma), this.afterTrailingComma(b.braceR)) break;
|
|
1845
1714
|
t.push(this.parseExportSpecifier(e));
|
|
1846
1715
|
}
|
|
1847
1716
|
return t;
|
|
1848
|
-
},
|
|
1849
|
-
return this.next(), this.type ===
|
|
1850
|
-
},
|
|
1717
|
+
}, A.parseImport = function(e) {
|
|
1718
|
+
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
|
+
}, A.parseImportSpecifier = function() {
|
|
1851
1720
|
var e = this.startNode();
|
|
1852
|
-
return e.imported = this.parseModuleExportName(), this.eatContextual("as") ? e.local = this.parseIdent() : (this.checkUnreserved(e.imported), e.local = e.imported), this.checkLValSimple(e.local,
|
|
1853
|
-
},
|
|
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, E), this.finishNode(e, "ImportSpecifier");
|
|
1722
|
+
}, A.parseImportDefaultSpecifier = function() {
|
|
1854
1723
|
var e = this.startNode();
|
|
1855
|
-
return e.local = this.parseIdent(), this.checkLValSimple(e.local,
|
|
1856
|
-
},
|
|
1724
|
+
return e.local = this.parseIdent(), this.checkLValSimple(e.local, E), this.finishNode(e, "ImportDefaultSpecifier");
|
|
1725
|
+
}, A.parseImportNamespaceSpecifier = function() {
|
|
1857
1726
|
var e = this.startNode();
|
|
1858
|
-
return this.next(), this.expectContextual("as"), e.local = this.parseIdent(), this.checkLValSimple(e.local,
|
|
1859
|
-
},
|
|
1727
|
+
return this.next(), this.expectContextual("as"), e.local = this.parseIdent(), this.checkLValSimple(e.local, E), this.finishNode(e, "ImportNamespaceSpecifier");
|
|
1728
|
+
}, A.parseImportSpecifiers = function() {
|
|
1860
1729
|
var e = [], t = !0;
|
|
1861
|
-
if (this.type ===
|
|
1862
|
-
if (this.type ===
|
|
1863
|
-
for (this.expect(
|
|
1730
|
+
if (this.type === b.name && (e.push(this.parseImportDefaultSpecifier()), !this.eat(b.comma))) return e;
|
|
1731
|
+
if (this.type === b.star) return e.push(this.parseImportNamespaceSpecifier()), e;
|
|
1732
|
+
for (this.expect(b.braceL); !this.eat(b.braceR);) {
|
|
1864
1733
|
if (t) t = !1;
|
|
1865
|
-
else if (this.expect(
|
|
1734
|
+
else if (this.expect(b.comma), this.afterTrailingComma(b.braceR)) break;
|
|
1866
1735
|
e.push(this.parseImportSpecifier());
|
|
1867
1736
|
}
|
|
1868
1737
|
return e;
|
|
1869
|
-
},
|
|
1738
|
+
}, A.parseWithClause = function() {
|
|
1870
1739
|
var e = [];
|
|
1871
|
-
if (!this.eat(
|
|
1872
|
-
this.expect(
|
|
1873
|
-
for (var t = {}, n = !0; !this.eat(
|
|
1740
|
+
if (!this.eat(b._with)) return e;
|
|
1741
|
+
this.expect(b.braceL);
|
|
1742
|
+
for (var t = {}, n = !0; !this.eat(b.braceR);) {
|
|
1874
1743
|
if (n) n = !1;
|
|
1875
|
-
else if (this.expect(
|
|
1744
|
+
else if (this.expect(b.comma), this.afterTrailingComma(b.braceR)) break;
|
|
1876
1745
|
var r = this.parseImportAttribute(), i = r.key.type === "Identifier" ? r.key.name : r.key.value;
|
|
1877
1746
|
ce(t, i) && this.raiseRecoverable(r.key.start, "Duplicate attribute key '" + i + "'"), t[i] = !0, e.push(r);
|
|
1878
1747
|
}
|
|
1879
1748
|
return e;
|
|
1880
|
-
},
|
|
1749
|
+
}, A.parseImportAttribute = function() {
|
|
1881
1750
|
var e = this.startNode();
|
|
1882
|
-
return e.key = this.type ===
|
|
1883
|
-
},
|
|
1884
|
-
if (this.options.ecmaVersion >= 13 && this.type ===
|
|
1751
|
+
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
|
+
}, A.parseModuleExportName = function() {
|
|
1753
|
+
if (this.options.ecmaVersion >= 13 && this.type === b.string) {
|
|
1885
1754
|
var e = this.parseLiteral(this.value);
|
|
1886
|
-
return
|
|
1755
|
+
return de.test(e.value) && this.raise(e.start, "An export name cannot include a lone surrogate."), e;
|
|
1887
1756
|
}
|
|
1888
1757
|
return this.parseIdent(!0);
|
|
1889
|
-
},
|
|
1758
|
+
}, A.adaptDirectivePrologue = function(e) {
|
|
1890
1759
|
for (var t = 0; t < e.length && this.isDirectiveCandidate(e[t]); ++t) e[t].directive = e[t].expression.raw.slice(1, -1);
|
|
1891
|
-
},
|
|
1760
|
+
}, A.isDirectiveCandidate = function(e) {
|
|
1892
1761
|
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] === "'");
|
|
1893
1762
|
};
|
|
1894
|
-
var
|
|
1895
|
-
|
|
1763
|
+
var j = D.prototype;
|
|
1764
|
+
j.toAssignable = function(e, t, n) {
|
|
1896
1765
|
if (this.options.ecmaVersion >= 6 && e) switch (e.type) {
|
|
1897
1766
|
case "Identifier":
|
|
1898
1767
|
this.inAsync && e.name === "await" && this.raise(e.start, "Cannot use 'await' as identifier inside an async function");
|
|
@@ -1931,7 +1800,7 @@ N.toAssignable = function(e, t, n) {
|
|
|
1931
1800
|
}
|
|
1932
1801
|
else n && this.checkPatternErrors(n, !0);
|
|
1933
1802
|
return e;
|
|
1934
|
-
},
|
|
1803
|
+
}, j.toAssignableList = function(e, t) {
|
|
1935
1804
|
for (var n = e.length, r = 0; r < n; r++) {
|
|
1936
1805
|
var i = e[r];
|
|
1937
1806
|
i && this.toAssignable(i, t);
|
|
@@ -1941,44 +1810,44 @@ N.toAssignable = function(e, t, n) {
|
|
|
1941
1810
|
this.options.ecmaVersion === 6 && t && a && a.type === "RestElement" && a.argument.type !== "Identifier" && this.unexpected(a.argument.start);
|
|
1942
1811
|
}
|
|
1943
1812
|
return e;
|
|
1944
|
-
},
|
|
1813
|
+
}, j.parseSpread = function(e) {
|
|
1945
1814
|
var t = this.startNode();
|
|
1946
1815
|
return this.next(), t.argument = this.parseMaybeAssign(!1, e), this.finishNode(t, "SpreadElement");
|
|
1947
|
-
},
|
|
1816
|
+
}, j.parseRestBinding = function() {
|
|
1948
1817
|
var e = this.startNode();
|
|
1949
|
-
return this.next(), this.options.ecmaVersion === 6 && this.type !==
|
|
1950
|
-
},
|
|
1818
|
+
return this.next(), this.options.ecmaVersion === 6 && this.type !== b.name && this.unexpected(), e.argument = this.parseBindingAtom(), this.finishNode(e, "RestElement");
|
|
1819
|
+
}, j.parseBindingAtom = function() {
|
|
1951
1820
|
if (this.options.ecmaVersion >= 6) switch (this.type) {
|
|
1952
|
-
case
|
|
1821
|
+
case b.bracketL:
|
|
1953
1822
|
var e = this.startNode();
|
|
1954
|
-
return this.next(), e.elements = this.parseBindingList(
|
|
1955
|
-
case
|
|
1823
|
+
return this.next(), e.elements = this.parseBindingList(b.bracketR, !0, !0), this.finishNode(e, "ArrayPattern");
|
|
1824
|
+
case b.braceL: return this.parseObj(!0);
|
|
1956
1825
|
}
|
|
1957
1826
|
return this.parseIdent();
|
|
1958
|
-
},
|
|
1959
|
-
for (var i = [], a = !0; !this.eat(e);) if (a ? a = !1 : this.expect(
|
|
1827
|
+
}, j.parseBindingList = function(e, t, n, r) {
|
|
1828
|
+
for (var i = [], a = !0; !this.eat(e);) if (a ? a = !1 : this.expect(b.comma), t && this.type === b.comma) i.push(null);
|
|
1960
1829
|
else if (n && this.afterTrailingComma(e)) break;
|
|
1961
|
-
else if (this.type ===
|
|
1830
|
+
else if (this.type === b.ellipsis) {
|
|
1962
1831
|
var o = this.parseRestBinding();
|
|
1963
|
-
this.parseBindingListItem(o), i.push(o), this.type ===
|
|
1832
|
+
this.parseBindingListItem(o), i.push(o), this.type === b.comma && this.raiseRecoverable(this.start, "Comma is not permitted after the rest element"), this.expect(e);
|
|
1964
1833
|
break;
|
|
1965
1834
|
} else i.push(this.parseAssignableListItem(r));
|
|
1966
1835
|
return i;
|
|
1967
|
-
},
|
|
1836
|
+
}, j.parseAssignableListItem = function(e) {
|
|
1968
1837
|
var t = this.parseMaybeDefault(this.start, this.startLoc);
|
|
1969
1838
|
return this.parseBindingListItem(t), t;
|
|
1970
|
-
},
|
|
1839
|
+
}, j.parseBindingListItem = function(e) {
|
|
1971
1840
|
return e;
|
|
1972
|
-
},
|
|
1973
|
-
if (n ||= this.parseBindingAtom(), this.options.ecmaVersion < 6 || !this.eat(
|
|
1841
|
+
}, j.parseMaybeDefault = function(e, t, n) {
|
|
1842
|
+
if (n ||= this.parseBindingAtom(), this.options.ecmaVersion < 6 || !this.eat(b.eq)) return n;
|
|
1974
1843
|
var r = this.startNodeAt(e, t);
|
|
1975
1844
|
return r.left = n, r.right = this.parseMaybeAssign(), this.finishNode(r, "AssignmentPattern");
|
|
1976
|
-
},
|
|
1977
|
-
t === void 0 && (t =
|
|
1978
|
-
var r = t !==
|
|
1845
|
+
}, j.checkLValSimple = function(e, t, n) {
|
|
1846
|
+
t === void 0 && (t = je);
|
|
1847
|
+
var r = t !== je;
|
|
1979
1848
|
switch (e.type) {
|
|
1980
1849
|
case "Identifier":
|
|
1981
|
-
this.strict && this.reservedWordsStrictBind.test(e.name) && this.raiseRecoverable(e.start, (r ? "Binding " : "Assigning to ") + e.name + " in strict mode"), r && (t ===
|
|
1850
|
+
this.strict && this.reservedWordsStrictBind.test(e.name) && this.raiseRecoverable(e.start, (r ? "Binding " : "Assigning to ") + e.name + " in strict mode"), r && (t === E && e.name === "let" && this.raiseRecoverable(e.start, "let is disallowed as a lexically bound name"), n && (ce(n, e.name) && this.raiseRecoverable(e.start, "Argument name clash"), n[e.name] = !0), t !== Fe && this.declareName(e.name, t, e.start));
|
|
1982
1851
|
break;
|
|
1983
1852
|
case "ChainExpression":
|
|
1984
1853
|
this.raiseRecoverable(e.start, "Optional chaining cannot appear in left-hand side");
|
|
@@ -1989,8 +1858,8 @@ N.toAssignable = function(e, t, n) {
|
|
|
1989
1858
|
case "ParenthesizedExpression": return r && this.raiseRecoverable(e.start, "Binding parenthesized expression"), this.checkLValSimple(e.expression, t, n);
|
|
1990
1859
|
default: this.raise(e.start, (r ? "Binding" : "Assigning to") + " rvalue");
|
|
1991
1860
|
}
|
|
1992
|
-
},
|
|
1993
|
-
switch (t === void 0 && (t =
|
|
1861
|
+
}, j.checkLValPattern = function(e, t, n) {
|
|
1862
|
+
switch (t === void 0 && (t = je), e.type) {
|
|
1994
1863
|
case "ObjectPattern":
|
|
1995
1864
|
for (var r = 0, i = e.properties; r < i.length; r += 1) {
|
|
1996
1865
|
var a = i[r];
|
|
@@ -2005,8 +1874,8 @@ N.toAssignable = function(e, t, n) {
|
|
|
2005
1874
|
break;
|
|
2006
1875
|
default: this.checkLValSimple(e, t, n);
|
|
2007
1876
|
}
|
|
2008
|
-
},
|
|
2009
|
-
switch (t === void 0 && (t =
|
|
1877
|
+
}, j.checkLValInnerPattern = function(e, t, n) {
|
|
1878
|
+
switch (t === void 0 && (t = je), e.type) {
|
|
2010
1879
|
case "Property":
|
|
2011
1880
|
this.checkLValInnerPattern(e.value, t, n);
|
|
2012
1881
|
break;
|
|
@@ -2019,72 +1888,72 @@ N.toAssignable = function(e, t, n) {
|
|
|
2019
1888
|
default: this.checkLValPattern(e, t, n);
|
|
2020
1889
|
}
|
|
2021
1890
|
};
|
|
2022
|
-
var
|
|
1891
|
+
var M = function(e, t, n, r, i) {
|
|
2023
1892
|
this.token = e, this.isExpr = !!t, this.preserveSpace = !!n, this.override = r, this.generator = !!i;
|
|
2024
|
-
},
|
|
2025
|
-
b_stat: new
|
|
2026
|
-
b_expr: new
|
|
2027
|
-
b_tmpl: new
|
|
2028
|
-
p_stat: new
|
|
2029
|
-
p_expr: new
|
|
2030
|
-
q_tmpl: new
|
|
1893
|
+
}, N = {
|
|
1894
|
+
b_stat: new M("{", !1),
|
|
1895
|
+
b_expr: new M("{", !0),
|
|
1896
|
+
b_tmpl: new M("${", !1),
|
|
1897
|
+
p_stat: new M("(", !1),
|
|
1898
|
+
p_expr: new M("(", !0),
|
|
1899
|
+
q_tmpl: new M("`", !0, !0, function(e) {
|
|
2031
1900
|
return e.tryReadTemplateToken();
|
|
2032
1901
|
}),
|
|
2033
|
-
f_stat: new
|
|
2034
|
-
f_expr: new
|
|
2035
|
-
f_expr_gen: new
|
|
2036
|
-
f_gen: new
|
|
2037
|
-
},
|
|
2038
|
-
|
|
2039
|
-
return [
|
|
2040
|
-
},
|
|
1902
|
+
f_stat: new M("function", !1),
|
|
1903
|
+
f_expr: new M("function", !0),
|
|
1904
|
+
f_expr_gen: new M("function", !0, !1, null, !0),
|
|
1905
|
+
f_gen: new M("function", !1, !1, null, !0)
|
|
1906
|
+
}, Ke = D.prototype;
|
|
1907
|
+
Ke.initialContext = function() {
|
|
1908
|
+
return [N.b_stat];
|
|
1909
|
+
}, Ke.curContext = function() {
|
|
2041
1910
|
return this.context[this.context.length - 1];
|
|
2042
|
-
},
|
|
1911
|
+
}, Ke.braceIsBlock = function(e) {
|
|
2043
1912
|
var t = this.curContext();
|
|
2044
|
-
return t ===
|
|
2045
|
-
},
|
|
1913
|
+
return t === N.f_expr || t === N.f_stat ? !0 : e === b.colon && (t === N.b_stat || t === N.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 === N.b_stat : e === b._var || e === b._const || e === b.name ? !1 : !this.exprAllowed;
|
|
1914
|
+
}, Ke.inGeneratorContext = function() {
|
|
2046
1915
|
for (var e = this.context.length - 1; e >= 1; e--) {
|
|
2047
1916
|
var t = this.context[e];
|
|
2048
1917
|
if (t.token === "function") return t.generator;
|
|
2049
1918
|
}
|
|
2050
1919
|
return !1;
|
|
2051
|
-
},
|
|
1920
|
+
}, Ke.updateContext = function(e) {
|
|
2052
1921
|
var t, n = this.type;
|
|
2053
|
-
n.keyword && e ===
|
|
2054
|
-
},
|
|
1922
|
+
n.keyword && e === b.dot ? this.exprAllowed = !1 : (t = n.updateContext) ? t.call(this, e) : this.exprAllowed = n.beforeExpr;
|
|
1923
|
+
}, Ke.overrideContext = function(e) {
|
|
2055
1924
|
this.curContext() !== e && (this.context[this.context.length - 1] = e);
|
|
2056
|
-
},
|
|
1925
|
+
}, b.parenR.updateContext = b.braceR.updateContext = function() {
|
|
2057
1926
|
if (this.context.length === 1) {
|
|
2058
1927
|
this.exprAllowed = !0;
|
|
2059
1928
|
return;
|
|
2060
1929
|
}
|
|
2061
1930
|
var e = this.context.pop();
|
|
2062
|
-
e ===
|
|
2063
|
-
},
|
|
2064
|
-
this.context.push(this.braceIsBlock(e) ?
|
|
2065
|
-
},
|
|
2066
|
-
this.context.push(
|
|
2067
|
-
},
|
|
2068
|
-
var t = e ===
|
|
2069
|
-
this.context.push(t ?
|
|
2070
|
-
},
|
|
2071
|
-
e.beforeExpr && e !==
|
|
2072
|
-
},
|
|
1931
|
+
e === N.b_stat && this.curContext().token === "function" && (e = this.context.pop()), this.exprAllowed = !e.isExpr;
|
|
1932
|
+
}, b.braceL.updateContext = function(e) {
|
|
1933
|
+
this.context.push(this.braceIsBlock(e) ? N.b_stat : N.b_expr), this.exprAllowed = !0;
|
|
1934
|
+
}, b.dollarBraceL.updateContext = function() {
|
|
1935
|
+
this.context.push(N.b_tmpl), this.exprAllowed = !0;
|
|
1936
|
+
}, b.parenL.updateContext = function(e) {
|
|
1937
|
+
var t = e === b._if || e === b._for || e === b._with || e === b._while;
|
|
1938
|
+
this.context.push(t ? N.p_stat : N.p_expr), this.exprAllowed = !0;
|
|
1939
|
+
}, b.incDec.updateContext = function() {}, b._function.updateContext = b._class.updateContext = function(e) {
|
|
1940
|
+
e.beforeExpr && e !== b._else && !(e === b.semi && this.curContext() !== N.p_stat) && !(e === b._return && x.test(this.input.slice(this.lastTokEnd, this.start))) && !((e === b.colon || e === b.braceL) && this.curContext() === N.b_stat) ? this.context.push(N.f_expr) : this.context.push(N.f_stat), this.exprAllowed = !1;
|
|
1941
|
+
}, b.colon.updateContext = function() {
|
|
2073
1942
|
this.curContext().token === "function" && this.context.pop(), this.exprAllowed = !0;
|
|
2074
|
-
},
|
|
2075
|
-
this.curContext() ===
|
|
2076
|
-
},
|
|
2077
|
-
if (e ===
|
|
1943
|
+
}, b.backQuote.updateContext = function() {
|
|
1944
|
+
this.curContext() === N.q_tmpl ? this.context.pop() : this.context.push(N.q_tmpl), this.exprAllowed = !1;
|
|
1945
|
+
}, b.star.updateContext = function(e) {
|
|
1946
|
+
if (e === b._function) {
|
|
2078
1947
|
var t = this.context.length - 1;
|
|
2079
|
-
this.context[t] ===
|
|
1948
|
+
this.context[t] === N.f_expr ? this.context[t] = N.f_expr_gen : this.context[t] = N.f_gen;
|
|
2080
1949
|
}
|
|
2081
1950
|
this.exprAllowed = !0;
|
|
2082
|
-
},
|
|
1951
|
+
}, b.name.updateContext = function(e) {
|
|
2083
1952
|
var t = !1;
|
|
2084
|
-
this.options.ecmaVersion >= 6 && e !==
|
|
1953
|
+
this.options.ecmaVersion >= 6 && e !== b.dot && (this.value === "of" && !this.exprAllowed || this.value === "yield" && this.inGeneratorContext()) && (t = !0), this.exprAllowed = t;
|
|
2085
1954
|
};
|
|
2086
|
-
var
|
|
2087
|
-
|
|
1955
|
+
var P = D.prototype;
|
|
1956
|
+
P.checkPropClash = function(e, t, n) {
|
|
2088
1957
|
if (!(this.options.ecmaVersion >= 9 && e.type === "SpreadElement") && !(this.options.ecmaVersion >= 6 && (e.computed || e.method || e.shorthand))) {
|
|
2089
1958
|
var r = e.key, i;
|
|
2090
1959
|
switch (r.type) {
|
|
@@ -2109,65 +1978,65 @@ I.checkPropClash = function(e, t, n) {
|
|
|
2109
1978
|
set: !1
|
|
2110
1979
|
}, o[a] = !0;
|
|
2111
1980
|
}
|
|
2112
|
-
},
|
|
1981
|
+
}, P.parseExpression = function(e, t) {
|
|
2113
1982
|
var n = this;
|
|
2114
1983
|
return this.catchStackOverflow(function() {
|
|
2115
1984
|
var r = n.start, i = n.startLoc, a = n.parseMaybeAssign(e, t);
|
|
2116
|
-
if (n.type ===
|
|
1985
|
+
if (n.type === b.comma) {
|
|
2117
1986
|
var o = n.startNodeAt(r, i);
|
|
2118
|
-
for (o.expressions = [a]; n.eat(
|
|
1987
|
+
for (o.expressions = [a]; n.eat(b.comma);) o.expressions.push(n.parseMaybeAssign(e, t));
|
|
2119
1988
|
return n.finishNode(o, "SequenceExpression");
|
|
2120
1989
|
}
|
|
2121
1990
|
return a;
|
|
2122
1991
|
});
|
|
2123
|
-
},
|
|
1992
|
+
}, P.parseMaybeAssign = function(e, t, n) {
|
|
2124
1993
|
if (this.isContextual("yield")) {
|
|
2125
1994
|
if (this.inGenerator) return this.parseYield(e);
|
|
2126
1995
|
this.exprAllowed = !1;
|
|
2127
1996
|
}
|
|
2128
1997
|
var r = !1, i = -1, a = -1, o = -1;
|
|
2129
|
-
t ? (i = t.parenthesizedAssign, a = t.trailingComma, o = t.doubleProto, t.parenthesizedAssign = t.trailingComma = -1) : (t = new
|
|
1998
|
+
t ? (i = t.parenthesizedAssign, a = t.trailingComma, o = t.doubleProto, t.parenthesizedAssign = t.trailingComma = -1) : (t = new Le(), r = !0);
|
|
2130
1999
|
var s = this.start, c = this.startLoc;
|
|
2131
|
-
(this.type ===
|
|
2000
|
+
(this.type === b.parenL || this.type === b.name) && (this.potentialArrowAt = this.start, this.potentialArrowInForAwait = e === "await");
|
|
2132
2001
|
var l = this.parseMaybeConditional(e, t);
|
|
2133
2002
|
if (n && (l = n.call(this, l, s, c)), this.type.isAssign) {
|
|
2134
2003
|
var u = this.startNodeAt(s, c);
|
|
2135
|
-
return u.operator = this.value, this.type ===
|
|
2004
|
+
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");
|
|
2136
2005
|
} else r && this.checkExpressionErrors(t, !0);
|
|
2137
2006
|
return i > -1 && (t.parenthesizedAssign = i), a > -1 && (t.trailingComma = a), l;
|
|
2138
|
-
},
|
|
2007
|
+
}, P.parseMaybeConditional = function(e, t) {
|
|
2139
2008
|
var n = this.start, r = this.startLoc, i = this.parseExprOps(e, t);
|
|
2140
2009
|
if (this.checkExpressionErrors(t)) return i;
|
|
2141
|
-
if (!(i.type === "ArrowFunctionExpression" && i.start === n) && this.eat(
|
|
2010
|
+
if (!(i.type === "ArrowFunctionExpression" && i.start === n) && this.eat(b.question)) {
|
|
2142
2011
|
var a = this.startNodeAt(n, r);
|
|
2143
|
-
return a.test = i, a.consequent = this.parseMaybeAssign(), this.expect(
|
|
2012
|
+
return a.test = i, a.consequent = this.parseMaybeAssign(), this.expect(b.colon), a.alternate = this.parseMaybeAssign(e), this.finishNode(a, "ConditionalExpression");
|
|
2144
2013
|
}
|
|
2145
2014
|
return i;
|
|
2146
|
-
},
|
|
2015
|
+
}, P.parseExprOps = function(e, t) {
|
|
2147
2016
|
var n = this.start, r = this.startLoc, i = this.parseMaybeUnary(t, !1, !1, e);
|
|
2148
2017
|
return this.checkExpressionErrors(t) || i.start === n && i.type === "ArrowFunctionExpression" ? i : this.parseExprOp(i, n, r, -1, e);
|
|
2149
|
-
},
|
|
2018
|
+
}, P.parseExprOp = function(e, t, n, r, i) {
|
|
2150
2019
|
var a = this.type.binop;
|
|
2151
|
-
if (a != null && (!i || this.type !==
|
|
2152
|
-
var o = this.type ===
|
|
2153
|
-
s && (a =
|
|
2020
|
+
if (a != null && (!i || this.type !== b._in) && a > r) {
|
|
2021
|
+
var o = this.type === b.logicalOR || this.type === b.logicalAND, s = this.type === b.coalesce;
|
|
2022
|
+
s && (a = b.logicalAND.binop);
|
|
2154
2023
|
var c = this.value;
|
|
2155
2024
|
this.next();
|
|
2156
2025
|
var l = this.start, u = this.startLoc, d = this.parseExprOp(this.parseMaybeUnary(null, !1, !1, i), l, u, a, i), f = this.buildBinary(t, n, e, d, c, o || s);
|
|
2157
|
-
return (o && this.type ===
|
|
2026
|
+
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);
|
|
2158
2027
|
}
|
|
2159
2028
|
return e;
|
|
2160
|
-
},
|
|
2029
|
+
}, P.buildBinary = function(e, t, n, r, i, a) {
|
|
2161
2030
|
r.type === "PrivateIdentifier" && this.raise(r.start, "Private identifier can only be left side of binary expression");
|
|
2162
2031
|
var o = this.startNodeAt(e, t);
|
|
2163
2032
|
return o.left = n, o.operator = i, o.right = r, this.finishNode(o, a ? "LogicalExpression" : "BinaryExpression");
|
|
2164
|
-
},
|
|
2033
|
+
}, P.parseMaybeUnary = function(e, t, n, r) {
|
|
2165
2034
|
var i = this.start, a = this.startLoc, o;
|
|
2166
2035
|
if (this.isContextual("await") && this.canAwait) o = this.parseAwait(r), t = !0;
|
|
2167
2036
|
else if (this.type.prefix) {
|
|
2168
|
-
var s = this.startNode(), c = this.type ===
|
|
2169
|
-
s.operator = this.value, s.prefix = !0, this.next(), s.argument = this.parseMaybeUnary(null, !0, c, r), this.checkExpressionErrors(e, !0), c ? this.checkLValSimple(s.argument) : this.strict && s.operator === "delete" &&
|
|
2170
|
-
} else if (!t && this.type ===
|
|
2037
|
+
var s = this.startNode(), c = this.type === b.incDec;
|
|
2038
|
+
s.operator = this.value, s.prefix = !0, this.next(), s.argument = this.parseMaybeUnary(null, !0, c, r), this.checkExpressionErrors(e, !0), c ? this.checkLValSimple(s.argument) : this.strict && s.operator === "delete" && qe(s.argument) ? this.raiseRecoverable(s.start, "Deleting local variable in strict mode") : s.operator === "delete" && Je(s.argument) ? this.raiseRecoverable(s.start, "Private fields can not be deleted") : t = !0, o = this.finishNode(s, c ? "UpdateExpression" : "UnaryExpression");
|
|
2039
|
+
} else if (!t && this.type === b.privateId) (r || this.privateNameStack.length === 0) && this.options.checkPrivateFields && this.unexpected(), o = this.parsePrivateIdent(), this.type !== b._in && this.unexpected();
|
|
2171
2040
|
else {
|
|
2172
2041
|
if (o = this.parseExprSubscripts(e, r), this.checkExpressionErrors(e)) return o;
|
|
2173
2042
|
for (; this.type.postfix && !this.canInsertSemicolon();) {
|
|
@@ -2175,22 +2044,22 @@ I.checkPropClash = function(e, t, n) {
|
|
|
2175
2044
|
l.operator = this.value, l.prefix = !1, l.argument = o, this.checkLValSimple(o), this.next(), o = this.finishNode(l, "UpdateExpression");
|
|
2176
2045
|
}
|
|
2177
2046
|
}
|
|
2178
|
-
if (!n && this.eat(
|
|
2047
|
+
if (!n && this.eat(b.starstar)) if (t) this.unexpected(this.lastTokStart);
|
|
2179
2048
|
else return this.buildBinary(i, a, o, this.parseMaybeUnary(null, !1, !1, r), "**", !1);
|
|
2180
2049
|
else return o;
|
|
2181
2050
|
};
|
|
2182
|
-
function
|
|
2183
|
-
return e.type === "Identifier" || e.type === "ParenthesizedExpression" &&
|
|
2051
|
+
function qe(e) {
|
|
2052
|
+
return e.type === "Identifier" || e.type === "ParenthesizedExpression" && qe(e.expression);
|
|
2184
2053
|
}
|
|
2185
|
-
function
|
|
2186
|
-
return e.type === "MemberExpression" && e.property.type === "PrivateIdentifier" || e.type === "ChainExpression" &&
|
|
2054
|
+
function Je(e) {
|
|
2055
|
+
return e.type === "MemberExpression" && e.property.type === "PrivateIdentifier" || e.type === "ChainExpression" && Je(e.expression) || e.type === "ParenthesizedExpression" && Je(e.expression);
|
|
2187
2056
|
}
|
|
2188
|
-
|
|
2057
|
+
P.parseExprSubscripts = function(e, t) {
|
|
2189
2058
|
var n = this.start, r = this.startLoc, i = this.parseExprAtom(e, t);
|
|
2190
2059
|
if (i.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")") return i;
|
|
2191
2060
|
var a = this.parseSubscripts(i, n, r, !1, t);
|
|
2192
2061
|
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;
|
|
2193
|
-
},
|
|
2062
|
+
}, P.parseSubscripts = function(e, t, n, r, i) {
|
|
2194
2063
|
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;;) {
|
|
2195
2064
|
var s = this.parseSubscript(e, t, n, r, a, o, i);
|
|
2196
2065
|
if (s.optional && (o = !0), s === e || s.type === "ArrowFunctionExpression") {
|
|
@@ -2202,170 +2071,170 @@ I.parseExprSubscripts = function(e, t) {
|
|
|
2202
2071
|
}
|
|
2203
2072
|
e = s;
|
|
2204
2073
|
}
|
|
2205
|
-
},
|
|
2206
|
-
return !this.canInsertSemicolon() && this.eat(
|
|
2207
|
-
},
|
|
2074
|
+
}, P.shouldParseAsyncArrow = function() {
|
|
2075
|
+
return !this.canInsertSemicolon() && this.eat(b.arrow);
|
|
2076
|
+
}, P.parseSubscriptAsyncArrow = function(e, t, n, r) {
|
|
2208
2077
|
return this.parseArrowExpression(this.startNodeAt(e, t), n, !0, r);
|
|
2209
|
-
},
|
|
2210
|
-
var s = this.options.ecmaVersion >= 11, c = s && this.eat(
|
|
2078
|
+
}, P.parseSubscript = function(e, t, n, r, i, a, o) {
|
|
2079
|
+
var s = this.options.ecmaVersion >= 11, c = s && this.eat(b.questionDot);
|
|
2211
2080
|
r && c && this.raise(this.lastTokStart, "Optional chaining cannot appear in the callee of new expressions");
|
|
2212
|
-
var l = this.eat(
|
|
2213
|
-
if (l || c && this.type !==
|
|
2081
|
+
var l = this.eat(b.bracketL);
|
|
2082
|
+
if (l || c && this.type !== b.parenL && this.type !== b.backQuote || this.eat(b.dot)) {
|
|
2214
2083
|
var u = this.startNodeAt(t, n);
|
|
2215
|
-
u.object = e, l ? (u.property = this.parseExpression(), this.expect(
|
|
2216
|
-
} else if (!r && this.eat(
|
|
2217
|
-
var d = new
|
|
2084
|
+
u.object = e, l ? (u.property = this.parseExpression(), this.expect(b.bracketR)) : this.type === b.privateId && e.type !== "Super" ? u.property = this.parsePrivateIdent() : u.property = this.parseIdent(this.options.allowReserved !== "never"), u.computed = !!l, s && (u.optional = c), e = this.finishNode(u, "MemberExpression");
|
|
2085
|
+
} else if (!r && this.eat(b.parenL)) {
|
|
2086
|
+
var d = new Le(), f = this.yieldPos, p = this.awaitPos, m = this.awaitIdentPos;
|
|
2218
2087
|
this.yieldPos = 0, this.awaitPos = 0, this.awaitIdentPos = 0;
|
|
2219
|
-
var h = this.parseExprList(
|
|
2088
|
+
var h = this.parseExprList(b.parenR, this.options.ecmaVersion >= 8, !1, d);
|
|
2220
2089
|
if (i && !c && this.shouldParseAsyncArrow()) return this.checkPatternErrors(d, !1), this.checkYieldAwaitInDefaultParams(), this.awaitIdentPos > 0 && this.raise(this.awaitIdentPos, "Cannot use 'await' as identifier inside an async function"), this.yieldPos = f, this.awaitPos = p, this.awaitIdentPos = m, this.parseSubscriptAsyncArrow(t, n, h, o);
|
|
2221
2090
|
this.checkExpressionErrors(d, !0), this.yieldPos = f || this.yieldPos, this.awaitPos = p || this.awaitPos, this.awaitIdentPos = m || this.awaitIdentPos;
|
|
2222
2091
|
var g = this.startNodeAt(t, n);
|
|
2223
2092
|
g.callee = e, g.arguments = h, s && (g.optional = c), e = this.finishNode(g, "CallExpression");
|
|
2224
|
-
} else if (this.type ===
|
|
2093
|
+
} else if (this.type === b.backQuote) {
|
|
2225
2094
|
(c || a) && this.raise(this.start, "Optional chaining cannot appear in the tag of tagged template expressions");
|
|
2226
2095
|
var _ = this.startNodeAt(t, n);
|
|
2227
2096
|
_.tag = e, _.quasi = this.parseTemplate({ isTagged: !0 }), e = this.finishNode(_, "TaggedTemplateExpression");
|
|
2228
2097
|
}
|
|
2229
2098
|
return e;
|
|
2230
|
-
},
|
|
2231
|
-
this.type ===
|
|
2099
|
+
}, P.parseExprAtom = function(e, t, n) {
|
|
2100
|
+
this.type === b.slash && this.readRegexp();
|
|
2232
2101
|
var r, i = this.potentialArrowAt === this.start;
|
|
2233
2102
|
switch (this.type) {
|
|
2234
|
-
case
|
|
2235
|
-
case
|
|
2236
|
-
case
|
|
2103
|
+
case b._super: return this.allowSuper || this.raise(this.start, "'super' keyword outside a method"), r = this.startNode(), this.next(), this.type === b.parenL && !this.allowDirectSuper && this.raise(r.start, "super() call outside constructor of a subclass"), this.type !== b.dot && this.type !== b.bracketL && this.type !== b.parenL && this.unexpected(), this.finishNode(r, "Super");
|
|
2104
|
+
case b._this: return r = this.startNode(), this.next(), this.finishNode(r, "ThisExpression");
|
|
2105
|
+
case b.name:
|
|
2237
2106
|
var a = this.start, o = this.startLoc, s = this.containsEsc, c = this.parseIdent(!1);
|
|
2238
|
-
if (this.options.ecmaVersion >= 8 && !s && c.name === "async" && !this.canInsertSemicolon() && this.eat(
|
|
2107
|
+
if (this.options.ecmaVersion >= 8 && !s && c.name === "async" && !this.canInsertSemicolon() && this.eat(b._function)) return this.overrideContext(N.f_expr), this.parseFunction(this.startNodeAt(a, o), 0, !1, !0, t);
|
|
2239
2108
|
if (i && !this.canInsertSemicolon()) {
|
|
2240
|
-
if (this.eat(
|
|
2241
|
-
if (this.options.ecmaVersion >= 8 && c.name === "async" && this.type ===
|
|
2109
|
+
if (this.eat(b.arrow)) return this.parseArrowExpression(this.startNodeAt(a, o), [c], !1, t);
|
|
2110
|
+
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);
|
|
2242
2111
|
}
|
|
2243
2112
|
return c;
|
|
2244
|
-
case
|
|
2113
|
+
case b.regexp:
|
|
2245
2114
|
var l = this.value;
|
|
2246
2115
|
return r = this.parseLiteral(l.value), r.regex = {
|
|
2247
2116
|
pattern: l.pattern,
|
|
2248
2117
|
flags: l.flags
|
|
2249
2118
|
}, r;
|
|
2250
|
-
case
|
|
2251
|
-
case
|
|
2252
|
-
case
|
|
2253
|
-
case
|
|
2254
|
-
case
|
|
2255
|
-
case
|
|
2119
|
+
case b.num:
|
|
2120
|
+
case b.string: return this.parseLiteral(this.value);
|
|
2121
|
+
case b._null:
|
|
2122
|
+
case b._true:
|
|
2123
|
+
case b._false: return r = this.startNode(), r.value = this.type === b._null ? null : this.type === b._true, r.raw = this.type.keyword, this.next(), this.finishNode(r, "Literal");
|
|
2124
|
+
case b.parenL:
|
|
2256
2125
|
var u = this.start, d = this.parseParenAndDistinguishExpression(i, t);
|
|
2257
2126
|
return e && (e.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(d) && (e.parenthesizedAssign = u), e.parenthesizedBind < 0 && (e.parenthesizedBind = u)), d;
|
|
2258
|
-
case
|
|
2259
|
-
case
|
|
2260
|
-
case
|
|
2261
|
-
case
|
|
2262
|
-
case
|
|
2263
|
-
case
|
|
2264
|
-
case
|
|
2127
|
+
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(N.b_expr), this.parseObj(!1, e);
|
|
2129
|
+
case b._function: return r = this.startNode(), this.next(), this.parseFunction(r, 0);
|
|
2130
|
+
case b._class: return this.parseClass(this.startNode(), !1);
|
|
2131
|
+
case b._new: return this.parseNew();
|
|
2132
|
+
case b.backQuote: return this.parseTemplate();
|
|
2133
|
+
case b._import: return this.options.ecmaVersion >= 11 ? this.parseExprImport(n) : this.unexpected();
|
|
2265
2134
|
default: return this.parseExprAtomDefault();
|
|
2266
2135
|
}
|
|
2267
|
-
},
|
|
2136
|
+
}, P.parseExprAtomDefault = function() {
|
|
2268
2137
|
this.unexpected();
|
|
2269
|
-
},
|
|
2138
|
+
}, P.parseExprImport = function(e) {
|
|
2270
2139
|
var t = this.startNode();
|
|
2271
|
-
if (this.containsEsc && this.raiseRecoverable(this.start, "Escape sequence in keyword import"), this.next(), this.type ===
|
|
2272
|
-
if (this.type ===
|
|
2140
|
+
if (this.containsEsc && this.raiseRecoverable(this.start, "Escape sequence in keyword import"), this.next(), this.type === b.parenL && !e) return this.parseDynamicImport(t);
|
|
2141
|
+
if (this.type === b.dot) {
|
|
2273
2142
|
var n = this.startNodeAt(t.start, t.loc && t.loc.start);
|
|
2274
2143
|
return n.name = "import", t.meta = this.finishNode(n, "Identifier"), this.parseImportMeta(t);
|
|
2275
2144
|
} else this.unexpected();
|
|
2276
|
-
},
|
|
2277
|
-
if (this.next(), e.source = this.parseMaybeAssign(), this.options.ecmaVersion >= 16) this.eat(
|
|
2278
|
-
else if (!this.eat(
|
|
2145
|
+
}, P.parseDynamicImport = function(e) {
|
|
2146
|
+
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
|
+
else if (!this.eat(b.parenR)) {
|
|
2279
2148
|
var t = this.start;
|
|
2280
|
-
this.eat(
|
|
2149
|
+
this.eat(b.comma) && this.eat(b.parenR) ? this.raiseRecoverable(t, "Trailing comma is not allowed in import()") : this.unexpected(t);
|
|
2281
2150
|
}
|
|
2282
2151
|
return this.finishNode(e, "ImportExpression");
|
|
2283
|
-
},
|
|
2152
|
+
}, P.parseImportMeta = function(e) {
|
|
2284
2153
|
this.next();
|
|
2285
2154
|
var t = this.containsEsc;
|
|
2286
2155
|
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");
|
|
2287
|
-
},
|
|
2156
|
+
}, P.parseLiteral = function(e) {
|
|
2288
2157
|
var t = this.startNode();
|
|
2289
2158
|
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");
|
|
2290
|
-
},
|
|
2291
|
-
this.expect(
|
|
2159
|
+
}, P.parseParenExpression = function() {
|
|
2160
|
+
this.expect(b.parenL);
|
|
2292
2161
|
var e = this.parseExpression();
|
|
2293
|
-
return this.expect(
|
|
2294
|
-
},
|
|
2162
|
+
return this.expect(b.parenR), e;
|
|
2163
|
+
}, P.shouldParseArrow = function(e) {
|
|
2295
2164
|
return !this.canInsertSemicolon();
|
|
2296
|
-
},
|
|
2165
|
+
}, P.parseParenAndDistinguishExpression = function(e, t) {
|
|
2297
2166
|
var n = this.start, r = this.startLoc, i, a = this.options.ecmaVersion >= 8;
|
|
2298
2167
|
if (this.options.ecmaVersion >= 6) {
|
|
2299
2168
|
this.next();
|
|
2300
|
-
var o = this.start, s = this.startLoc, c = [], l = !0, u = !1, d = new
|
|
2301
|
-
for (this.yieldPos = 0, this.awaitPos = 0; this.type !==
|
|
2169
|
+
var o = this.start, s = this.startLoc, c = [], l = !0, u = !1, d = new Le(), f = this.yieldPos, p = this.awaitPos, m;
|
|
2170
|
+
for (this.yieldPos = 0, this.awaitPos = 0; this.type !== b.parenR;) if (l ? l = !1 : this.expect(b.comma), a && this.afterTrailingComma(b.parenR, !0)) {
|
|
2302
2171
|
u = !0;
|
|
2303
2172
|
break;
|
|
2304
|
-
} else if (this.type ===
|
|
2305
|
-
m = this.start, c.push(this.parseParenItem(this.parseRestBinding())), this.type ===
|
|
2173
|
+
} else if (this.type === b.ellipsis) {
|
|
2174
|
+
m = this.start, c.push(this.parseParenItem(this.parseRestBinding())), this.type === b.comma && this.raiseRecoverable(this.start, "Comma is not permitted after the rest element");
|
|
2306
2175
|
break;
|
|
2307
2176
|
} else c.push(this.parseMaybeAssign(!1, d, this.parseParenItem));
|
|
2308
2177
|
var h = this.lastTokEnd, g = this.lastTokEndLoc;
|
|
2309
|
-
if (this.expect(
|
|
2178
|
+
if (this.expect(b.parenR), e && this.shouldParseArrow(c) && this.eat(b.arrow)) return this.checkPatternErrors(d, !1), this.checkYieldAwaitInDefaultParams(), this.yieldPos = f, this.awaitPos = p, this.parseParenArrowList(n, r, c, t);
|
|
2310
2179
|
(!c.length || u) && this.unexpected(this.lastTokStart), m && this.unexpected(m), this.checkExpressionErrors(d, !0), this.yieldPos = f || this.yieldPos, this.awaitPos = p || this.awaitPos, c.length > 1 ? (i = this.startNodeAt(o, s), i.expressions = c, this.finishNodeAt(i, "SequenceExpression", h, g)) : i = c[0];
|
|
2311
2180
|
} else i = this.parseParenExpression();
|
|
2312
2181
|
if (this.options.preserveParens) {
|
|
2313
2182
|
var _ = this.startNodeAt(n, r);
|
|
2314
2183
|
return _.expression = i, this.finishNode(_, "ParenthesizedExpression");
|
|
2315
2184
|
} else return i;
|
|
2316
|
-
},
|
|
2185
|
+
}, P.parseParenItem = function(e) {
|
|
2317
2186
|
return e;
|
|
2318
|
-
},
|
|
2187
|
+
}, P.parseParenArrowList = function(e, t, n, r) {
|
|
2319
2188
|
return this.parseArrowExpression(this.startNodeAt(e, t), n, !1, r);
|
|
2320
2189
|
};
|
|
2321
|
-
var
|
|
2322
|
-
|
|
2190
|
+
var Ye = [];
|
|
2191
|
+
P.parseNew = function() {
|
|
2323
2192
|
this.containsEsc && this.raiseRecoverable(this.start, "Escape sequence in keyword new");
|
|
2324
2193
|
var e = this.startNode();
|
|
2325
|
-
if (this.next(), this.options.ecmaVersion >= 6 && this.type ===
|
|
2194
|
+
if (this.next(), this.options.ecmaVersion >= 6 && this.type === b.dot) {
|
|
2326
2195
|
var t = this.startNodeAt(e.start, e.loc && e.loc.start);
|
|
2327
2196
|
t.name = "new", e.meta = this.finishNode(t, "Identifier"), this.next();
|
|
2328
2197
|
var n = this.containsEsc;
|
|
2329
2198
|
return e.property = this.parseIdent(!0), e.property.name !== "target" && this.raiseRecoverable(e.property.start, "The only valid meta property for new is 'new.target'"), n && this.raiseRecoverable(e.start, "'new.target' must not contain escaped characters"), this.allowNewDotTarget || this.raiseRecoverable(e.start, "'new.target' can only be used in functions and class static block"), this.finishNode(e, "MetaProperty");
|
|
2330
2199
|
}
|
|
2331
2200
|
var r = this.start, i = this.startLoc;
|
|
2332
|
-
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(
|
|
2333
|
-
},
|
|
2201
|
+
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
|
+
}, P.parseTemplateElement = function(e) {
|
|
2334
2203
|
var t = e.isTagged, n = this.startNode();
|
|
2335
|
-
return this.type ===
|
|
2204
|
+
return this.type === b.invalidTemplate ? (t || this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal"), n.value = {
|
|
2336
2205
|
raw: this.value.replace(/\r\n?/g, "\n"),
|
|
2337
2206
|
cooked: null
|
|
2338
2207
|
}) : n.value = {
|
|
2339
2208
|
raw: this.input.slice(this.start, this.end).replace(/\r\n?/g, "\n"),
|
|
2340
2209
|
cooked: this.value
|
|
2341
|
-
}, this.next(), n.tail = this.type ===
|
|
2342
|
-
},
|
|
2210
|
+
}, this.next(), n.tail = this.type === b.backQuote, this.finishNode(n, "TemplateElement");
|
|
2211
|
+
}, P.parseTemplate = function(e) {
|
|
2343
2212
|
e === void 0 && (e = {});
|
|
2344
2213
|
var t = e.isTagged;
|
|
2345
2214
|
t === void 0 && (t = !1);
|
|
2346
2215
|
var n = this.startNode();
|
|
2347
2216
|
this.next(), n.expressions = [];
|
|
2348
2217
|
var r = this.parseTemplateElement({ isTagged: t });
|
|
2349
|
-
for (n.quasis = [r]; !r.tail;) this.type ===
|
|
2218
|
+
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 }));
|
|
2350
2219
|
return this.next(), this.finishNode(n, "TemplateLiteral");
|
|
2351
|
-
},
|
|
2352
|
-
return !e.computed && e.key.type === "Identifier" && e.key.name === "async" && (this.type ===
|
|
2353
|
-
},
|
|
2220
|
+
}, P.isAsyncProp = function(e) {
|
|
2221
|
+
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
|
+
}, P.parseObj = function(e, t) {
|
|
2354
2223
|
var n = this.startNode(), r = !0, i = {};
|
|
2355
|
-
for (n.properties = [], this.next(); !this.eat(
|
|
2224
|
+
for (n.properties = [], this.next(); !this.eat(b.braceR);) {
|
|
2356
2225
|
if (r) r = !1;
|
|
2357
|
-
else if (this.expect(
|
|
2226
|
+
else if (this.expect(b.comma), this.options.ecmaVersion >= 5 && this.afterTrailingComma(b.braceR)) break;
|
|
2358
2227
|
var a = this.parseProperty(e, t);
|
|
2359
2228
|
e || this.checkPropClash(a, i, t), n.properties.push(a);
|
|
2360
2229
|
}
|
|
2361
2230
|
return this.finishNode(n, e ? "ObjectPattern" : "ObjectExpression");
|
|
2362
|
-
},
|
|
2231
|
+
}, P.parseProperty = function(e, t) {
|
|
2363
2232
|
var n = this.startNode(), r, i, a, o;
|
|
2364
|
-
if (this.options.ecmaVersion >= 9 && this.eat(
|
|
2365
|
-
this.options.ecmaVersion >= 6 && (n.method = !1, n.shorthand = !1, (e || t) && (a = this.start, o = this.startLoc), e || (r = this.eat(
|
|
2233
|
+
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
|
+
this.options.ecmaVersion >= 6 && (n.method = !1, n.shorthand = !1, (e || t) && (a = this.start, o = this.startLoc), e || (r = this.eat(b.star)));
|
|
2366
2235
|
var s = this.containsEsc;
|
|
2367
|
-
return this.parsePropertyName(n), !e && !s && this.options.ecmaVersion >= 8 && !r && this.isAsyncProp(n) ? (i = !0, r = this.options.ecmaVersion >= 9 && this.eat(
|
|
2368
|
-
},
|
|
2236
|
+
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
|
+
}, P.parseGetterSetter = function(e) {
|
|
2369
2238
|
var t = e.key.name;
|
|
2370
2239
|
this.parsePropertyName(e), e.value = this.parseMethod(!1), e.kind = t;
|
|
2371
2240
|
var n = e.kind === "get" ? 0 : 1;
|
|
@@ -2373,202 +2242,202 @@ I.parseNew = function() {
|
|
|
2373
2242
|
var r = e.value.start;
|
|
2374
2243
|
e.kind === "get" ? this.raiseRecoverable(r, "getter should have no params") : this.raiseRecoverable(r, "setter should have exactly one param");
|
|
2375
2244
|
} else e.kind === "set" && e.value.params[0].type === "RestElement" && this.raiseRecoverable(e.value.params[0].start, "Setter cannot use rest params");
|
|
2376
|
-
},
|
|
2377
|
-
(n || r) && this.type ===
|
|
2378
|
-
},
|
|
2245
|
+
}, P.parsePropertyValue = function(e, t, n, r, i, a, o, s) {
|
|
2246
|
+
(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
|
+
}, P.parsePropertyName = function(e) {
|
|
2379
2248
|
if (this.options.ecmaVersion >= 6) {
|
|
2380
|
-
if (this.eat(
|
|
2249
|
+
if (this.eat(b.bracketL)) return e.computed = !0, e.key = this.parseMaybeAssign(), this.expect(b.bracketR), e.key;
|
|
2381
2250
|
e.computed = !1;
|
|
2382
2251
|
}
|
|
2383
|
-
return e.key = this.type ===
|
|
2384
|
-
},
|
|
2252
|
+
return e.key = this.type === b.num || this.type === b.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never");
|
|
2253
|
+
}, P.initFunction = function(e) {
|
|
2385
2254
|
e.id = null, this.options.ecmaVersion >= 6 && (e.generator = e.expression = !1), this.options.ecmaVersion >= 8 && (e.async = !1);
|
|
2386
|
-
},
|
|
2255
|
+
}, P.parseMethod = function(e, t, n) {
|
|
2387
2256
|
var r = this.startNode(), i = this.yieldPos, a = this.awaitPos, o = this.awaitIdentPos;
|
|
2388
|
-
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(
|
|
2389
|
-
},
|
|
2257
|
+
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
|
+
}, P.parseArrowExpression = function(e, t, n, r) {
|
|
2390
2259
|
var i = this.yieldPos, a = this.awaitPos, o = this.awaitIdentPos;
|
|
2391
|
-
return this.enterScope(
|
|
2392
|
-
},
|
|
2393
|
-
var i = t && this.type !==
|
|
2260
|
+
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
|
+
}, P.parseFunctionBody = function(e, t, n, r) {
|
|
2262
|
+
var i = t && this.type !== b.braceL, a = this.strict, o = !1;
|
|
2394
2263
|
if (i) e.body = this.parseMaybeAssign(r), e.expression = !0, this.checkParams(e, !1);
|
|
2395
2264
|
else {
|
|
2396
2265
|
var s = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(e.params);
|
|
2397
2266
|
(!a || s) && (o = this.strictDirective(this.end), o && s && this.raiseRecoverable(e.start, "Illegal 'use strict' directive in function with non-simple parameter list"));
|
|
2398
2267
|
var c = this.labels;
|
|
2399
|
-
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,
|
|
2268
|
+
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;
|
|
2400
2269
|
}
|
|
2401
2270
|
this.exitScope();
|
|
2402
|
-
},
|
|
2271
|
+
}, P.isSimpleParamList = function(e) {
|
|
2403
2272
|
for (var t = 0, n = e; t < n.length; t += 1) if (n[t].type !== "Identifier") return !1;
|
|
2404
2273
|
return !0;
|
|
2405
|
-
},
|
|
2274
|
+
}, P.checkParams = function(e, t) {
|
|
2406
2275
|
for (var n = Object.create(null), r = 0, i = e.params; r < i.length; r += 1) {
|
|
2407
2276
|
var a = i[r];
|
|
2408
|
-
this.checkLValInnerPattern(a,
|
|
2277
|
+
this.checkLValInnerPattern(a, Me, t ? null : n);
|
|
2409
2278
|
}
|
|
2410
|
-
},
|
|
2279
|
+
}, P.parseExprList = function(e, t, n, r) {
|
|
2411
2280
|
for (var i = [], a = !0; !this.eat(e);) {
|
|
2412
2281
|
if (a) a = !1;
|
|
2413
|
-
else if (this.expect(
|
|
2282
|
+
else if (this.expect(b.comma), t && this.afterTrailingComma(e)) break;
|
|
2414
2283
|
var o = void 0;
|
|
2415
|
-
n && this.type ===
|
|
2284
|
+
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);
|
|
2416
2285
|
}
|
|
2417
2286
|
return i;
|
|
2418
|
-
},
|
|
2287
|
+
}, P.checkUnreserved = function(e) {
|
|
2419
2288
|
var t = e.start, n = e.end, r = e.name;
|
|
2420
|
-
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 &
|
|
2421
|
-
},
|
|
2289
|
+
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
|
+
}, P.parseIdent = function(e) {
|
|
2422
2291
|
var t = this.parseIdentNode();
|
|
2423
2292
|
return this.next(!!e), this.finishNode(t, "Identifier"), e || (this.checkUnreserved(t), t.name === "await" && !this.awaitIdentPos && (this.awaitIdentPos = t.start)), t;
|
|
2424
|
-
},
|
|
2293
|
+
}, P.parseIdentNode = function() {
|
|
2425
2294
|
var e = this.startNode();
|
|
2426
|
-
return this.type ===
|
|
2427
|
-
},
|
|
2295
|
+
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
|
+
}, P.parsePrivateIdent = function() {
|
|
2428
2297
|
var e = this.startNode();
|
|
2429
|
-
return this.type ===
|
|
2430
|
-
},
|
|
2298
|
+
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
|
+
}, P.parseYield = function(e) {
|
|
2431
2300
|
this.yieldPos ||= this.start;
|
|
2432
2301
|
var t = this.startNode();
|
|
2433
|
-
return this.next(), this.type ===
|
|
2434
|
-
},
|
|
2302
|
+
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
|
+
}, P.parseAwait = function(e) {
|
|
2435
2304
|
this.awaitPos ||= this.start;
|
|
2436
2305
|
var t = this.startNode();
|
|
2437
2306
|
return this.next(), t.argument = this.parseMaybeUnary(null, !0, !1, e), this.finishNode(t, "AwaitExpression");
|
|
2438
2307
|
};
|
|
2439
|
-
var
|
|
2440
|
-
|
|
2441
|
-
var n =
|
|
2308
|
+
var Xe = D.prototype;
|
|
2309
|
+
Xe.raise = function(e, t) {
|
|
2310
|
+
var n = me(this.input, e);
|
|
2442
2311
|
t += " (" + n.line + ":" + n.column + ")", this.sourceFile && (t += " in " + this.sourceFile);
|
|
2443
2312
|
var r = SyntaxError(t);
|
|
2444
2313
|
throw r.pos = e, r.loc = n, r.raisedAt = this.pos, r;
|
|
2445
|
-
},
|
|
2446
|
-
if (this.options.locations) return new
|
|
2314
|
+
}, Xe.raiseRecoverable = Xe.raise, Xe.curPosition = function() {
|
|
2315
|
+
if (this.options.locations) return new fe(this.curLine, this.pos - this.lineStart);
|
|
2447
2316
|
};
|
|
2448
|
-
var
|
|
2317
|
+
var F = D.prototype, Ze = function(e) {
|
|
2449
2318
|
this.flags = e, this.var = [], this.lexical = [], this.functions = [];
|
|
2450
2319
|
};
|
|
2451
|
-
|
|
2452
|
-
this.scopeStack.push(new
|
|
2453
|
-
},
|
|
2320
|
+
F.enterScope = function(e) {
|
|
2321
|
+
this.scopeStack.push(new Ze(e));
|
|
2322
|
+
}, F.exitScope = function() {
|
|
2454
2323
|
this.scopeStack.pop();
|
|
2455
|
-
},
|
|
2456
|
-
return e.flags &
|
|
2457
|
-
},
|
|
2324
|
+
}, F.treatFunctionsAsVarInScope = function(e) {
|
|
2325
|
+
return e.flags & T || !this.inModule && e.flags & ye;
|
|
2326
|
+
}, F.declareName = function(e, t, n) {
|
|
2458
2327
|
var r = !1;
|
|
2459
|
-
if (t ===
|
|
2328
|
+
if (t === E) {
|
|
2460
2329
|
var i = this.currentScope();
|
|
2461
|
-
r = i.lexical.indexOf(e) > -1 || i.functions.indexOf(e) > -1 || i.var.indexOf(e) > -1, i.lexical.push(e), this.inModule && i.flags &
|
|
2462
|
-
} else if (t ===
|
|
2463
|
-
else if (t ===
|
|
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 & ye && delete this.undefinedExports[e];
|
|
2331
|
+
} else if (t === Pe) this.currentScope().lexical.push(e);
|
|
2332
|
+
else if (t === Ne) {
|
|
2464
2333
|
var a = this.currentScope();
|
|
2465
2334
|
r = this.treatFunctionsAsVar ? a.lexical.indexOf(e) > -1 : a.lexical.indexOf(e) > -1 || a.var.indexOf(e) > -1, a.functions.push(e);
|
|
2466
2335
|
} else for (var o = this.scopeStack.length - 1; o >= 0; --o) {
|
|
2467
2336
|
var s = this.scopeStack[o];
|
|
2468
|
-
if (s.lexical.indexOf(e) > -1 && !(s.flags &
|
|
2337
|
+
if (s.lexical.indexOf(e) > -1 && !(s.flags & Ce && s.lexical[0] === e) || !this.treatFunctionsAsVarInScope(s) && s.functions.indexOf(e) > -1) {
|
|
2469
2338
|
r = !0;
|
|
2470
2339
|
break;
|
|
2471
2340
|
}
|
|
2472
|
-
if (s.var.push(e), this.inModule && s.flags &
|
|
2341
|
+
if (s.var.push(e), this.inModule && s.flags & ye && delete this.undefinedExports[e], s.flags & ke) break;
|
|
2473
2342
|
}
|
|
2474
2343
|
r && this.raiseRecoverable(n, "Identifier '" + e + "' has already been declared");
|
|
2475
|
-
},
|
|
2344
|
+
}, F.checkLocalExport = function(e) {
|
|
2476
2345
|
this.scopeStack[0].lexical.indexOf(e.name) === -1 && this.scopeStack[0].var.indexOf(e.name) === -1 && (this.undefinedExports[e.name] = e);
|
|
2477
|
-
},
|
|
2346
|
+
}, F.currentScope = function() {
|
|
2478
2347
|
return this.scopeStack[this.scopeStack.length - 1];
|
|
2479
|
-
},
|
|
2348
|
+
}, F.currentVarScope = function() {
|
|
2480
2349
|
for (var e = this.scopeStack.length - 1;; e--) {
|
|
2481
2350
|
var t = this.scopeStack[e];
|
|
2482
|
-
if (t.flags & (
|
|
2351
|
+
if (t.flags & (ke | De | Ee)) return t;
|
|
2483
2352
|
}
|
|
2484
|
-
},
|
|
2353
|
+
}, F.currentThisScope = function() {
|
|
2485
2354
|
for (var e = this.scopeStack.length - 1;; e--) {
|
|
2486
2355
|
var t = this.scopeStack[e];
|
|
2487
|
-
if (t.flags & (
|
|
2356
|
+
if (t.flags & (ke | De | Ee) && !(t.flags & Se)) return t;
|
|
2488
2357
|
}
|
|
2489
2358
|
};
|
|
2490
|
-
var
|
|
2491
|
-
this.type = "", this.start = t, this.end = 0, e.options.locations && (this.loc = new
|
|
2492
|
-
},
|
|
2493
|
-
|
|
2494
|
-
return new
|
|
2495
|
-
},
|
|
2496
|
-
return new
|
|
2359
|
+
var Qe = function(e, t, n) {
|
|
2360
|
+
this.type = "", this.start = t, this.end = 0, e.options.locations && (this.loc = new pe(e, n)), e.options.directSourceFile && (this.sourceFile = e.options.directSourceFile), e.options.ranges && (this.range = [t, 0]);
|
|
2361
|
+
}, $e = D.prototype;
|
|
2362
|
+
$e.startNode = function() {
|
|
2363
|
+
return new Qe(this, this.start, this.startLoc);
|
|
2364
|
+
}, $e.startNodeAt = function(e, t) {
|
|
2365
|
+
return new Qe(this, e, t);
|
|
2497
2366
|
};
|
|
2498
|
-
function
|
|
2367
|
+
function et(e, t, n, r) {
|
|
2499
2368
|
return e.type = t, e.end = n, this.options.locations && (e.loc.end = r), this.options.ranges && (e.range[1] = n), e;
|
|
2500
2369
|
}
|
|
2501
|
-
|
|
2502
|
-
return
|
|
2503
|
-
},
|
|
2504
|
-
return
|
|
2505
|
-
},
|
|
2506
|
-
var t = new
|
|
2370
|
+
$e.finishNode = function(e, t) {
|
|
2371
|
+
return et.call(this, e, t, this.lastTokEnd, this.lastTokEndLoc);
|
|
2372
|
+
}, $e.finishNodeAt = function(e, t, n, r) {
|
|
2373
|
+
return et.call(this, e, t, n, r);
|
|
2374
|
+
}, $e.copyNode = function(e) {
|
|
2375
|
+
var t = new Qe(this, e.start, this.startLoc);
|
|
2507
2376
|
for (var n in e) t[n] = e[n];
|
|
2508
2377
|
return t;
|
|
2509
2378
|
};
|
|
2510
|
-
var
|
|
2511
|
-
9:
|
|
2512
|
-
10:
|
|
2513
|
-
11:
|
|
2514
|
-
12:
|
|
2515
|
-
13:
|
|
2516
|
-
14:
|
|
2517
|
-
},
|
|
2379
|
+
var tt = "Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz", nt = "ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS", rt = nt + " Extended_Pictographic", it = rt, at = it + " EBase EComp EMod EPres ExtPict", ot = at, st = {
|
|
2380
|
+
9: nt,
|
|
2381
|
+
10: rt,
|
|
2382
|
+
11: it,
|
|
2383
|
+
12: at,
|
|
2384
|
+
13: ot,
|
|
2385
|
+
14: ot
|
|
2386
|
+
}, ct = {
|
|
2518
2387
|
9: "",
|
|
2519
2388
|
10: "",
|
|
2520
2389
|
11: "",
|
|
2521
2390
|
12: "",
|
|
2522
2391
|
13: "",
|
|
2523
2392
|
14: "Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji"
|
|
2524
|
-
},
|
|
2525
|
-
9:
|
|
2526
|
-
10:
|
|
2527
|
-
11:
|
|
2528
|
-
12:
|
|
2529
|
-
13:
|
|
2530
|
-
14:
|
|
2531
|
-
},
|
|
2532
|
-
function
|
|
2533
|
-
var t =
|
|
2534
|
-
binary:
|
|
2535
|
-
binaryOfStrings:
|
|
2393
|
+
}, lt = "Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu", ut = "Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb", dt = ut + " Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd", ft = dt + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho", pt = ft + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi", mt = pt + " Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith", ht = {
|
|
2394
|
+
9: ut,
|
|
2395
|
+
10: dt,
|
|
2396
|
+
11: ft,
|
|
2397
|
+
12: pt,
|
|
2398
|
+
13: mt,
|
|
2399
|
+
14: mt + " " + tt
|
|
2400
|
+
}, gt = {};
|
|
2401
|
+
function _t(e) {
|
|
2402
|
+
var t = gt[e] = {
|
|
2403
|
+
binary: C(st[e] + " " + lt),
|
|
2404
|
+
binaryOfStrings: C(ct[e]),
|
|
2536
2405
|
nonBinary: {
|
|
2537
|
-
General_Category:
|
|
2538
|
-
Script:
|
|
2406
|
+
General_Category: C(lt),
|
|
2407
|
+
Script: C(ht[e])
|
|
2539
2408
|
}
|
|
2540
2409
|
};
|
|
2541
2410
|
t.nonBinary.Script_Extensions = t.nonBinary.Script, t.nonBinary.gc = t.nonBinary.General_Category, t.nonBinary.sc = t.nonBinary.Script, t.nonBinary.scx = t.nonBinary.Script_Extensions;
|
|
2542
2411
|
}
|
|
2543
|
-
for (var
|
|
2412
|
+
for (var vt = 0, yt = [
|
|
2544
2413
|
9,
|
|
2545
2414
|
10,
|
|
2546
2415
|
11,
|
|
2547
2416
|
12,
|
|
2548
2417
|
13,
|
|
2549
2418
|
14
|
|
2550
|
-
];
|
|
2551
|
-
var
|
|
2552
|
-
bt
|
|
2419
|
+
]; vt < yt.length; vt += 1) {
|
|
2420
|
+
var bt = yt[vt];
|
|
2421
|
+
_t(bt);
|
|
2553
2422
|
}
|
|
2554
|
-
var
|
|
2423
|
+
var I = D.prototype, xt = function(e, t) {
|
|
2555
2424
|
this.parent = e, this.base = t || this;
|
|
2556
2425
|
};
|
|
2557
|
-
|
|
2426
|
+
xt.prototype.separatedFrom = function(e) {
|
|
2558
2427
|
for (var t = this; t; t = t.parent) for (var n = e; n; n = n.parent) if (t.base === n.base && t !== n) return !0;
|
|
2559
2428
|
return !1;
|
|
2560
|
-
},
|
|
2561
|
-
return new
|
|
2429
|
+
}, xt.prototype.sibling = function() {
|
|
2430
|
+
return new xt(this.parent, this.base);
|
|
2562
2431
|
};
|
|
2563
|
-
var
|
|
2564
|
-
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 =
|
|
2432
|
+
var L = function(e) {
|
|
2433
|
+
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;
|
|
2565
2434
|
};
|
|
2566
|
-
|
|
2435
|
+
L.prototype.reset = function(e, t, n) {
|
|
2567
2436
|
var r = n.indexOf("v") !== -1, i = n.indexOf("u") !== -1;
|
|
2568
2437
|
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);
|
|
2569
|
-
},
|
|
2438
|
+
}, L.prototype.raise = function(e) {
|
|
2570
2439
|
this.parser.raiseRecoverable(this.start, "Invalid regular expression: /" + this.source + "/: " + e);
|
|
2571
|
-
},
|
|
2440
|
+
}, L.prototype.at = function(e, t) {
|
|
2572
2441
|
t === void 0 && (t = !1);
|
|
2573
2442
|
var n = this.source, r = n.length;
|
|
2574
2443
|
if (e >= r) return -1;
|
|
@@ -2576,21 +2445,21 @@ R.prototype.reset = function(e, t, n) {
|
|
|
2576
2445
|
if (!(t || this.switchU) || i <= 55295 || i >= 57344 || e + 1 >= r) return i;
|
|
2577
2446
|
var a = n.charCodeAt(e + 1);
|
|
2578
2447
|
return a >= 56320 && a <= 57343 ? (i << 10) + a - 56613888 : i;
|
|
2579
|
-
},
|
|
2448
|
+
}, L.prototype.nextIndex = function(e, t) {
|
|
2580
2449
|
t === void 0 && (t = !1);
|
|
2581
2450
|
var n = this.source, r = n.length;
|
|
2582
2451
|
if (e >= r) return r;
|
|
2583
2452
|
var i = n.charCodeAt(e), a;
|
|
2584
2453
|
return !(t || this.switchU) || i <= 55295 || i >= 57344 || e + 1 >= r || (a = n.charCodeAt(e + 1)) < 56320 || a > 57343 ? e + 1 : e + 2;
|
|
2585
|
-
},
|
|
2454
|
+
}, L.prototype.current = function(e) {
|
|
2586
2455
|
return e === void 0 && (e = !1), this.at(this.pos, e);
|
|
2587
|
-
},
|
|
2456
|
+
}, L.prototype.lookahead = function(e) {
|
|
2588
2457
|
return e === void 0 && (e = !1), this.at(this.nextIndex(this.pos, e), e);
|
|
2589
|
-
},
|
|
2458
|
+
}, L.prototype.advance = function(e) {
|
|
2590
2459
|
e === void 0 && (e = !1), this.pos = this.nextIndex(this.pos, e);
|
|
2591
|
-
},
|
|
2460
|
+
}, L.prototype.eat = function(e, t) {
|
|
2592
2461
|
return t === void 0 && (t = !1), this.current(t) === e ? (this.advance(t), !0) : !1;
|
|
2593
|
-
},
|
|
2462
|
+
}, L.prototype.eatChars = function(e, t) {
|
|
2594
2463
|
t === void 0 && (t = !1);
|
|
2595
2464
|
for (var n = this.pos, r = 0, i = e; r < i.length; r += 1) {
|
|
2596
2465
|
var a = i[r], o = this.at(n, t);
|
|
@@ -2598,34 +2467,34 @@ R.prototype.reset = function(e, t, n) {
|
|
|
2598
2467
|
n = this.nextIndex(n, t);
|
|
2599
2468
|
}
|
|
2600
2469
|
return this.pos = n, !0;
|
|
2601
|
-
},
|
|
2470
|
+
}, I.validateRegExpFlags = function(e) {
|
|
2602
2471
|
for (var t = e.validFlags, n = e.flags, r = !1, i = !1, a = 0; a < n.length; a++) {
|
|
2603
2472
|
var o = n.charAt(a);
|
|
2604
2473
|
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);
|
|
2605
2474
|
}
|
|
2606
2475
|
this.options.ecmaVersion >= 15 && r && i && this.raise(e.start, "Invalid regular expression flag");
|
|
2607
2476
|
};
|
|
2608
|
-
function
|
|
2477
|
+
function St(e) {
|
|
2609
2478
|
for (var t in e) return !0;
|
|
2610
2479
|
return !1;
|
|
2611
2480
|
}
|
|
2612
|
-
|
|
2613
|
-
this.regexp_pattern(e), !e.switchN && this.options.ecmaVersion >= 9 &&
|
|
2614
|
-
},
|
|
2481
|
+
I.validateRegExpPattern = function(e) {
|
|
2482
|
+
this.regexp_pattern(e), !e.switchN && this.options.ecmaVersion >= 9 && St(e.groupNames) && (e.switchN = !0, this.regexp_pattern(e));
|
|
2483
|
+
}, I.regexp_pattern = function(e) {
|
|
2615
2484
|
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");
|
|
2616
2485
|
for (var t = 0, n = e.backReferenceNames; t < n.length; t += 1) {
|
|
2617
2486
|
var r = n[t];
|
|
2618
2487
|
e.groupNames[r] || e.raise("Invalid named capture referenced");
|
|
2619
2488
|
}
|
|
2620
|
-
},
|
|
2489
|
+
}, I.regexp_disjunction = function(e) {
|
|
2621
2490
|
var t = this.options.ecmaVersion >= 16;
|
|
2622
|
-
for (t && (e.branchID = new
|
|
2491
|
+
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);
|
|
2623
2492
|
t && (e.branchID = e.branchID.parent), this.regexp_eatQuantifier(e, !0) && e.raise("Nothing to repeat"), e.eat(123) && e.raise("Lone quantifier brackets");
|
|
2624
|
-
},
|
|
2493
|
+
}, I.regexp_alternative = function(e) {
|
|
2625
2494
|
for (; e.pos < e.source.length && this.regexp_eatTerm(e););
|
|
2626
|
-
},
|
|
2495
|
+
}, I.regexp_eatTerm = function(e) {
|
|
2627
2496
|
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;
|
|
2628
|
-
},
|
|
2497
|
+
}, I.regexp_eatAssertion = function(e) {
|
|
2629
2498
|
var t = e.pos;
|
|
2630
2499
|
if (e.lastAssertionIsQuantifiable = !1, e.eat(94) || e.eat(36)) return !0;
|
|
2631
2500
|
if (e.eat(92)) {
|
|
@@ -2637,11 +2506,11 @@ L.validateRegExpPattern = function(e) {
|
|
|
2637
2506
|
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;
|
|
2638
2507
|
}
|
|
2639
2508
|
return e.pos = t, !1;
|
|
2640
|
-
},
|
|
2509
|
+
}, I.regexp_eatQuantifier = function(e, t) {
|
|
2641
2510
|
return t === void 0 && (t = !1), this.regexp_eatQuantifierPrefix(e, t) ? (e.eat(63), !0) : !1;
|
|
2642
|
-
},
|
|
2511
|
+
}, I.regexp_eatQuantifierPrefix = function(e, t) {
|
|
2643
2512
|
return e.eat(42) || e.eat(43) || e.eat(63) || this.regexp_eatBracedQuantifier(e, t);
|
|
2644
|
-
},
|
|
2513
|
+
}, I.regexp_eatBracedQuantifier = function(e, t) {
|
|
2645
2514
|
var n = e.pos;
|
|
2646
2515
|
if (e.eat(123)) {
|
|
2647
2516
|
var r = 0, i = -1;
|
|
@@ -2649,16 +2518,16 @@ L.validateRegExpPattern = function(e) {
|
|
|
2649
2518
|
e.switchU && !t && e.raise("Incomplete quantifier"), e.pos = n;
|
|
2650
2519
|
}
|
|
2651
2520
|
return !1;
|
|
2652
|
-
},
|
|
2521
|
+
}, I.regexp_eatAtom = function(e) {
|
|
2653
2522
|
return this.regexp_eatPatternCharacters(e) || e.eat(46) || this.regexp_eatReverseSolidusAtomEscape(e) || this.regexp_eatCharacterClass(e) || this.regexp_eatUncapturingGroup(e) || this.regexp_eatCapturingGroup(e);
|
|
2654
|
-
},
|
|
2523
|
+
}, I.regexp_eatReverseSolidusAtomEscape = function(e) {
|
|
2655
2524
|
var t = e.pos;
|
|
2656
2525
|
if (e.eat(92)) {
|
|
2657
2526
|
if (this.regexp_eatAtomEscape(e)) return !0;
|
|
2658
2527
|
e.pos = t;
|
|
2659
2528
|
}
|
|
2660
2529
|
return !1;
|
|
2661
|
-
},
|
|
2530
|
+
}, I.regexp_eatUncapturingGroup = function(e) {
|
|
2662
2531
|
var t = e.pos;
|
|
2663
2532
|
if (e.eat(40)) {
|
|
2664
2533
|
if (e.eat(63)) {
|
|
@@ -2687,37 +2556,37 @@ L.validateRegExpPattern = function(e) {
|
|
|
2687
2556
|
e.pos = t;
|
|
2688
2557
|
}
|
|
2689
2558
|
return !1;
|
|
2690
|
-
},
|
|
2559
|
+
}, I.regexp_eatCapturingGroup = function(e) {
|
|
2691
2560
|
if (e.eat(40)) {
|
|
2692
2561
|
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;
|
|
2693
2562
|
e.raise("Unterminated group");
|
|
2694
2563
|
}
|
|
2695
2564
|
return !1;
|
|
2696
|
-
},
|
|
2697
|
-
for (var t = "", n = 0; (n = e.current()) !== -1 &&
|
|
2565
|
+
}, I.regexp_eatModifiers = function(e) {
|
|
2566
|
+
for (var t = "", n = 0; (n = e.current()) !== -1 && Ct(n);) t += w(n), e.advance();
|
|
2698
2567
|
return t;
|
|
2699
2568
|
};
|
|
2700
|
-
function
|
|
2569
|
+
function Ct(e) {
|
|
2701
2570
|
return e === 105 || e === 109 || e === 115;
|
|
2702
2571
|
}
|
|
2703
|
-
|
|
2572
|
+
I.regexp_eatExtendedAtom = function(e) {
|
|
2704
2573
|
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);
|
|
2705
|
-
},
|
|
2574
|
+
}, I.regexp_eatInvalidBracedQuantifier = function(e) {
|
|
2706
2575
|
return this.regexp_eatBracedQuantifier(e, !0) && e.raise("Nothing to repeat"), !1;
|
|
2707
|
-
},
|
|
2576
|
+
}, I.regexp_eatSyntaxCharacter = function(e) {
|
|
2708
2577
|
var t = e.current();
|
|
2709
|
-
return
|
|
2578
|
+
return wt(t) ? (e.lastIntValue = t, e.advance(), !0) : !1;
|
|
2710
2579
|
};
|
|
2711
|
-
function
|
|
2580
|
+
function wt(e) {
|
|
2712
2581
|
return e === 36 || e >= 40 && e <= 43 || e === 46 || e === 63 || e >= 91 && e <= 94 || e >= 123 && e <= 125;
|
|
2713
2582
|
}
|
|
2714
|
-
|
|
2715
|
-
for (var t = e.pos, n = 0; (n = e.current()) !== -1 && !
|
|
2583
|
+
I.regexp_eatPatternCharacters = function(e) {
|
|
2584
|
+
for (var t = e.pos, n = 0; (n = e.current()) !== -1 && !wt(n);) e.advance();
|
|
2716
2585
|
return e.pos !== t;
|
|
2717
|
-
},
|
|
2586
|
+
}, I.regexp_eatExtendedPatternCharacter = function(e) {
|
|
2718
2587
|
var t = e.current();
|
|
2719
2588
|
return t !== -1 && t !== 36 && !(t >= 40 && t <= 43) && t !== 46 && t !== 63 && t !== 91 && t !== 94 && t !== 124 ? (e.advance(), !0) : !1;
|
|
2720
|
-
},
|
|
2589
|
+
}, I.regexp_groupSpecifier = function(e) {
|
|
2721
2590
|
if (e.eat(63)) {
|
|
2722
2591
|
this.regexp_eatGroupName(e) || e.raise("Invalid group");
|
|
2723
2592
|
var t = this.options.ecmaVersion >= 16, n = e.groupNames[e.lastStringValue];
|
|
@@ -2725,35 +2594,35 @@ L.regexp_eatPatternCharacters = function(e) {
|
|
|
2725
2594
|
else e.raise("Duplicate capture group name");
|
|
2726
2595
|
t ? (n || (e.groupNames[e.lastStringValue] = [])).push(e.branchID) : e.groupNames[e.lastStringValue] = !0;
|
|
2727
2596
|
}
|
|
2728
|
-
},
|
|
2597
|
+
}, I.regexp_eatGroupName = function(e) {
|
|
2729
2598
|
if (e.lastStringValue = "", e.eat(60)) {
|
|
2730
2599
|
if (this.regexp_eatRegExpIdentifierName(e) && e.eat(62)) return !0;
|
|
2731
2600
|
e.raise("Invalid capture group name");
|
|
2732
2601
|
}
|
|
2733
2602
|
return !1;
|
|
2734
|
-
},
|
|
2603
|
+
}, I.regexp_eatRegExpIdentifierName = function(e) {
|
|
2735
2604
|
if (e.lastStringValue = "", this.regexp_eatRegExpIdentifierStart(e)) {
|
|
2736
|
-
for (e.lastStringValue +=
|
|
2605
|
+
for (e.lastStringValue += w(e.lastIntValue); this.regexp_eatRegExpIdentifierPart(e);) e.lastStringValue += w(e.lastIntValue);
|
|
2737
2606
|
return !0;
|
|
2738
2607
|
}
|
|
2739
2608
|
return !1;
|
|
2740
|
-
},
|
|
2609
|
+
}, I.regexp_eatRegExpIdentifierStart = function(e) {
|
|
2741
2610
|
var t = e.pos, n = this.options.ecmaVersion >= 11, r = e.current(n);
|
|
2742
|
-
return e.advance(n), r === 92 && this.regexp_eatRegExpUnicodeEscapeSequence(e, n) && (r = e.lastIntValue),
|
|
2611
|
+
return e.advance(n), r === 92 && this.regexp_eatRegExpUnicodeEscapeSequence(e, n) && (r = e.lastIntValue), Tt(r) ? (e.lastIntValue = r, !0) : (e.pos = t, !1);
|
|
2743
2612
|
};
|
|
2744
|
-
function
|
|
2745
|
-
return
|
|
2613
|
+
function Tt(e) {
|
|
2614
|
+
return p(e, !0) || e === 36 || e === 95;
|
|
2746
2615
|
}
|
|
2747
|
-
|
|
2616
|
+
I.regexp_eatRegExpIdentifierPart = function(e) {
|
|
2748
2617
|
var t = e.pos, n = this.options.ecmaVersion >= 11, r = e.current(n);
|
|
2749
|
-
return e.advance(n), r === 92 && this.regexp_eatRegExpUnicodeEscapeSequence(e, n) && (r = e.lastIntValue),
|
|
2618
|
+
return e.advance(n), r === 92 && this.regexp_eatRegExpUnicodeEscapeSequence(e, n) && (r = e.lastIntValue), Et(r) ? (e.lastIntValue = r, !0) : (e.pos = t, !1);
|
|
2750
2619
|
};
|
|
2751
|
-
function
|
|
2752
|
-
return
|
|
2620
|
+
function Et(e) {
|
|
2621
|
+
return m(e, !0) || e === 36 || e === 95 || e === 8204 || e === 8205;
|
|
2753
2622
|
}
|
|
2754
|
-
|
|
2623
|
+
I.regexp_eatAtomEscape = function(e) {
|
|
2755
2624
|
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);
|
|
2756
|
-
},
|
|
2625
|
+
}, I.regexp_eatBackReference = function(e) {
|
|
2757
2626
|
var t = e.pos;
|
|
2758
2627
|
if (this.regexp_eatDecimalEscape(e)) {
|
|
2759
2628
|
var n = e.lastIntValue;
|
|
@@ -2762,34 +2631,34 @@ L.regexp_eatAtomEscape = function(e) {
|
|
|
2762
2631
|
e.pos = t;
|
|
2763
2632
|
}
|
|
2764
2633
|
return !1;
|
|
2765
|
-
},
|
|
2634
|
+
}, I.regexp_eatKGroupName = function(e) {
|
|
2766
2635
|
if (e.eat(107)) {
|
|
2767
2636
|
if (this.regexp_eatGroupName(e)) return e.backReferenceNames.push(e.lastStringValue), !0;
|
|
2768
2637
|
e.raise("Invalid named reference");
|
|
2769
2638
|
}
|
|
2770
2639
|
return !1;
|
|
2771
|
-
},
|
|
2640
|
+
}, I.regexp_eatCharacterEscape = function(e) {
|
|
2772
2641
|
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);
|
|
2773
|
-
},
|
|
2642
|
+
}, I.regexp_eatCControlLetter = function(e) {
|
|
2774
2643
|
var t = e.pos;
|
|
2775
2644
|
if (e.eat(99)) {
|
|
2776
2645
|
if (this.regexp_eatControlLetter(e)) return !0;
|
|
2777
2646
|
e.pos = t;
|
|
2778
2647
|
}
|
|
2779
2648
|
return !1;
|
|
2780
|
-
},
|
|
2781
|
-
return e.current() === 48 && !
|
|
2782
|
-
},
|
|
2649
|
+
}, I.regexp_eatZero = function(e) {
|
|
2650
|
+
return e.current() === 48 && !It(e.lookahead()) ? (e.lastIntValue = 0, e.advance(), !0) : !1;
|
|
2651
|
+
}, I.regexp_eatControlEscape = function(e) {
|
|
2783
2652
|
var t = e.current();
|
|
2784
2653
|
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;
|
|
2785
|
-
},
|
|
2654
|
+
}, I.regexp_eatControlLetter = function(e) {
|
|
2786
2655
|
var t = e.current();
|
|
2787
|
-
return
|
|
2656
|
+
return Dt(t) ? (e.lastIntValue = t % 32, e.advance(), !0) : !1;
|
|
2788
2657
|
};
|
|
2789
|
-
function
|
|
2658
|
+
function Dt(e) {
|
|
2790
2659
|
return e >= 65 && e <= 90 || e >= 97 && e <= 122;
|
|
2791
2660
|
}
|
|
2792
|
-
|
|
2661
|
+
I.regexp_eatRegExpUnicodeEscapeSequence = function(e, t) {
|
|
2793
2662
|
t === void 0 && (t = !1);
|
|
2794
2663
|
var n = e.pos, r = t || e.switchU;
|
|
2795
2664
|
if (e.eat(117)) {
|
|
@@ -2805,19 +2674,19 @@ L.regexp_eatRegExpUnicodeEscapeSequence = function(e, t) {
|
|
|
2805
2674
|
}
|
|
2806
2675
|
return !0;
|
|
2807
2676
|
}
|
|
2808
|
-
if (r && e.eat(123) && this.regexp_eatHexDigits(e) && e.eat(125) &&
|
|
2677
|
+
if (r && e.eat(123) && this.regexp_eatHexDigits(e) && e.eat(125) && Ot(e.lastIntValue)) return !0;
|
|
2809
2678
|
r && e.raise("Invalid unicode escape"), e.pos = n;
|
|
2810
2679
|
}
|
|
2811
2680
|
return !1;
|
|
2812
2681
|
};
|
|
2813
|
-
function
|
|
2682
|
+
function Ot(e) {
|
|
2814
2683
|
return e >= 0 && e <= 1114111;
|
|
2815
2684
|
}
|
|
2816
|
-
|
|
2685
|
+
I.regexp_eatIdentityEscape = function(e) {
|
|
2817
2686
|
if (e.switchU) return this.regexp_eatSyntaxCharacter(e) ? !0 : e.eat(47) ? (e.lastIntValue = 47, !0) : !1;
|
|
2818
2687
|
var t = e.current();
|
|
2819
2688
|
return t !== 99 && (!e.switchN || t !== 107) ? (e.lastIntValue = t, e.advance(), !0) : !1;
|
|
2820
|
-
},
|
|
2689
|
+
}, I.regexp_eatDecimalEscape = function(e) {
|
|
2821
2690
|
e.lastIntValue = 0;
|
|
2822
2691
|
var t = e.current();
|
|
2823
2692
|
if (t >= 49 && t <= 57) {
|
|
@@ -2828,69 +2697,69 @@ L.regexp_eatIdentityEscape = function(e) {
|
|
|
2828
2697
|
}
|
|
2829
2698
|
return !1;
|
|
2830
2699
|
};
|
|
2831
|
-
var
|
|
2832
|
-
|
|
2700
|
+
var kt = 0, R = 1, z = 2;
|
|
2701
|
+
I.regexp_eatCharacterClassEscape = function(e) {
|
|
2833
2702
|
var t = e.current();
|
|
2834
|
-
if (
|
|
2703
|
+
if (At(t)) return e.lastIntValue = -1, e.advance(), R;
|
|
2835
2704
|
var n = !1;
|
|
2836
2705
|
if (e.switchU && this.options.ecmaVersion >= 9 && ((n = t === 80) || t === 112)) {
|
|
2837
2706
|
e.lastIntValue = -1, e.advance();
|
|
2838
2707
|
var r;
|
|
2839
|
-
if (e.eat(123) && (r = this.regexp_eatUnicodePropertyValueExpression(e)) && e.eat(125)) return n && r ===
|
|
2708
|
+
if (e.eat(123) && (r = this.regexp_eatUnicodePropertyValueExpression(e)) && e.eat(125)) return n && r === z && e.raise("Invalid property name"), r;
|
|
2840
2709
|
e.raise("Invalid property name");
|
|
2841
2710
|
}
|
|
2842
|
-
return
|
|
2711
|
+
return kt;
|
|
2843
2712
|
};
|
|
2844
|
-
function
|
|
2713
|
+
function At(e) {
|
|
2845
2714
|
return e === 100 || e === 68 || e === 115 || e === 83 || e === 119 || e === 87;
|
|
2846
2715
|
}
|
|
2847
|
-
|
|
2716
|
+
I.regexp_eatUnicodePropertyValueExpression = function(e) {
|
|
2848
2717
|
var t = e.pos;
|
|
2849
2718
|
if (this.regexp_eatUnicodePropertyName(e) && e.eat(61)) {
|
|
2850
2719
|
var n = e.lastStringValue;
|
|
2851
2720
|
if (this.regexp_eatUnicodePropertyValue(e)) {
|
|
2852
2721
|
var r = e.lastStringValue;
|
|
2853
|
-
return this.regexp_validateUnicodePropertyNameAndValue(e, n, r),
|
|
2722
|
+
return this.regexp_validateUnicodePropertyNameAndValue(e, n, r), R;
|
|
2854
2723
|
}
|
|
2855
2724
|
}
|
|
2856
2725
|
if (e.pos = t, this.regexp_eatLoneUnicodePropertyNameOrValue(e)) {
|
|
2857
2726
|
var i = e.lastStringValue;
|
|
2858
2727
|
return this.regexp_validateUnicodePropertyNameOrValue(e, i);
|
|
2859
2728
|
}
|
|
2860
|
-
return
|
|
2861
|
-
},
|
|
2729
|
+
return kt;
|
|
2730
|
+
}, I.regexp_validateUnicodePropertyNameAndValue = function(e, t, n) {
|
|
2862
2731
|
ce(e.unicodeProperties.nonBinary, t) || e.raise("Invalid property name"), e.unicodeProperties.nonBinary[t].test(n) || e.raise("Invalid property value");
|
|
2863
|
-
},
|
|
2864
|
-
if (e.unicodeProperties.binary.test(t)) return
|
|
2865
|
-
if (e.switchV && e.unicodeProperties.binaryOfStrings.test(t)) return
|
|
2732
|
+
}, I.regexp_validateUnicodePropertyNameOrValue = function(e, t) {
|
|
2733
|
+
if (e.unicodeProperties.binary.test(t)) return R;
|
|
2734
|
+
if (e.switchV && e.unicodeProperties.binaryOfStrings.test(t)) return z;
|
|
2866
2735
|
e.raise("Invalid property name");
|
|
2867
|
-
},
|
|
2736
|
+
}, I.regexp_eatUnicodePropertyName = function(e) {
|
|
2868
2737
|
var t = 0;
|
|
2869
|
-
for (e.lastStringValue = "";
|
|
2738
|
+
for (e.lastStringValue = ""; jt(t = e.current());) e.lastStringValue += w(t), e.advance();
|
|
2870
2739
|
return e.lastStringValue !== "";
|
|
2871
2740
|
};
|
|
2872
|
-
function
|
|
2873
|
-
return
|
|
2741
|
+
function jt(e) {
|
|
2742
|
+
return Dt(e) || e === 95;
|
|
2874
2743
|
}
|
|
2875
|
-
|
|
2744
|
+
I.regexp_eatUnicodePropertyValue = function(e) {
|
|
2876
2745
|
var t = 0;
|
|
2877
|
-
for (e.lastStringValue = "";
|
|
2746
|
+
for (e.lastStringValue = ""; Mt(t = e.current());) e.lastStringValue += w(t), e.advance();
|
|
2878
2747
|
return e.lastStringValue !== "";
|
|
2879
2748
|
};
|
|
2880
|
-
function
|
|
2881
|
-
return
|
|
2749
|
+
function Mt(e) {
|
|
2750
|
+
return jt(e) || It(e);
|
|
2882
2751
|
}
|
|
2883
|
-
|
|
2752
|
+
I.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
2884
2753
|
return this.regexp_eatUnicodePropertyValue(e);
|
|
2885
|
-
},
|
|
2754
|
+
}, I.regexp_eatCharacterClass = function(e) {
|
|
2886
2755
|
if (e.eat(91)) {
|
|
2887
2756
|
var t = e.eat(94), n = this.regexp_classContents(e);
|
|
2888
|
-
return e.eat(93) || e.raise("Unterminated character class"), t && n ===
|
|
2757
|
+
return e.eat(93) || e.raise("Unterminated character class"), t && n === z && e.raise("Negated character class may contain strings"), !0;
|
|
2889
2758
|
}
|
|
2890
2759
|
return !1;
|
|
2891
|
-
},
|
|
2892
|
-
return e.current() === 93 ?
|
|
2893
|
-
},
|
|
2760
|
+
}, I.regexp_classContents = function(e) {
|
|
2761
|
+
return e.current() === 93 ? R : e.switchV ? this.regexp_classSetExpression(e) : (this.regexp_nonEmptyClassRanges(e), R);
|
|
2762
|
+
}, I.regexp_nonEmptyClassRanges = function(e) {
|
|
2894
2763
|
for (; this.regexp_eatClassAtom(e);) {
|
|
2895
2764
|
var t = e.lastIntValue;
|
|
2896
2765
|
if (e.eat(45) && this.regexp_eatClassAtom(e)) {
|
|
@@ -2898,19 +2767,19 @@ L.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
|
2898
2767
|
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");
|
|
2899
2768
|
}
|
|
2900
2769
|
}
|
|
2901
|
-
},
|
|
2770
|
+
}, I.regexp_eatClassAtom = function(e) {
|
|
2902
2771
|
var t = e.pos;
|
|
2903
2772
|
if (e.eat(92)) {
|
|
2904
2773
|
if (this.regexp_eatClassEscape(e)) return !0;
|
|
2905
2774
|
if (e.switchU) {
|
|
2906
2775
|
var n = e.current();
|
|
2907
|
-
(n === 99 ||
|
|
2776
|
+
(n === 99 || zt(n)) && e.raise("Invalid class escape"), e.raise("Invalid escape");
|
|
2908
2777
|
}
|
|
2909
2778
|
e.pos = t;
|
|
2910
2779
|
}
|
|
2911
2780
|
var r = e.current();
|
|
2912
2781
|
return r === 93 ? !1 : (e.lastIntValue = r, e.advance(), !0);
|
|
2913
|
-
},
|
|
2782
|
+
}, I.regexp_eatClassEscape = function(e) {
|
|
2914
2783
|
var t = e.pos;
|
|
2915
2784
|
if (e.eat(98)) return e.lastIntValue = 8, !0;
|
|
2916
2785
|
if (e.switchU && e.eat(45)) return e.lastIntValue = 45, !0;
|
|
@@ -2919,13 +2788,13 @@ L.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
|
2919
2788
|
e.pos = t;
|
|
2920
2789
|
}
|
|
2921
2790
|
return this.regexp_eatCharacterClassEscape(e) || this.regexp_eatCharacterEscape(e);
|
|
2922
|
-
},
|
|
2923
|
-
var t =
|
|
2791
|
+
}, I.regexp_classSetExpression = function(e) {
|
|
2792
|
+
var t = R, n;
|
|
2924
2793
|
if (!this.regexp_eatClassSetRange(e)) if (n = this.regexp_eatClassSetOperand(e)) {
|
|
2925
|
-
n ===
|
|
2794
|
+
n === z && (t = z);
|
|
2926
2795
|
for (var r = e.pos; e.eatChars([38, 38]);) {
|
|
2927
2796
|
if (e.current() !== 38 && (n = this.regexp_eatClassSetOperand(e))) {
|
|
2928
|
-
n !==
|
|
2797
|
+
n !== z && (t = R);
|
|
2929
2798
|
continue;
|
|
2930
2799
|
}
|
|
2931
2800
|
e.raise("Invalid character in character class");
|
|
@@ -2936,9 +2805,9 @@ L.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
|
2936
2805
|
} else e.raise("Invalid character in character class");
|
|
2937
2806
|
for (;;) if (!this.regexp_eatClassSetRange(e)) {
|
|
2938
2807
|
if (n = this.regexp_eatClassSetOperand(e), !n) return t;
|
|
2939
|
-
n ===
|
|
2808
|
+
n === z && (t = z);
|
|
2940
2809
|
}
|
|
2941
|
-
},
|
|
2810
|
+
}, I.regexp_eatClassSetRange = function(e) {
|
|
2942
2811
|
var t = e.pos;
|
|
2943
2812
|
if (this.regexp_eatClassSetCharacter(e)) {
|
|
2944
2813
|
var n = e.lastIntValue;
|
|
@@ -2949,13 +2818,13 @@ L.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
|
2949
2818
|
e.pos = t;
|
|
2950
2819
|
}
|
|
2951
2820
|
return !1;
|
|
2952
|
-
},
|
|
2953
|
-
return this.regexp_eatClassSetCharacter(e) ?
|
|
2954
|
-
},
|
|
2821
|
+
}, I.regexp_eatClassSetOperand = function(e) {
|
|
2822
|
+
return this.regexp_eatClassSetCharacter(e) ? R : this.regexp_eatClassStringDisjunction(e) || this.regexp_eatNestedClass(e);
|
|
2823
|
+
}, I.regexp_eatNestedClass = function(e) {
|
|
2955
2824
|
var t = e.pos;
|
|
2956
2825
|
if (e.eat(91)) {
|
|
2957
2826
|
var n = e.eat(94), r = this.regexp_classContents(e);
|
|
2958
|
-
if (e.eat(93)) return n && r ===
|
|
2827
|
+
if (e.eat(93)) return n && r === z && e.raise("Negated character class may contain strings"), r;
|
|
2959
2828
|
e.pos = t;
|
|
2960
2829
|
}
|
|
2961
2830
|
if (e.eat(92)) {
|
|
@@ -2964,7 +2833,7 @@ L.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
|
2964
2833
|
e.pos = t;
|
|
2965
2834
|
}
|
|
2966
2835
|
return null;
|
|
2967
|
-
},
|
|
2836
|
+
}, I.regexp_eatClassStringDisjunction = function(e) {
|
|
2968
2837
|
var t = e.pos;
|
|
2969
2838
|
if (e.eatChars([92, 113])) {
|
|
2970
2839
|
if (e.eat(123)) {
|
|
@@ -2974,61 +2843,61 @@ L.regexp_eatLoneUnicodePropertyNameOrValue = function(e) {
|
|
|
2974
2843
|
e.pos = t;
|
|
2975
2844
|
}
|
|
2976
2845
|
return null;
|
|
2977
|
-
},
|
|
2978
|
-
for (var t = this.regexp_classString(e); e.eat(124);) this.regexp_classString(e) ===
|
|
2846
|
+
}, I.regexp_classStringDisjunctionContents = function(e) {
|
|
2847
|
+
for (var t = this.regexp_classString(e); e.eat(124);) this.regexp_classString(e) === z && (t = z);
|
|
2979
2848
|
return t;
|
|
2980
|
-
},
|
|
2849
|
+
}, I.regexp_classString = function(e) {
|
|
2981
2850
|
for (var t = 0; this.regexp_eatClassSetCharacter(e);) t++;
|
|
2982
|
-
return t === 1 ?
|
|
2983
|
-
},
|
|
2851
|
+
return t === 1 ? R : z;
|
|
2852
|
+
}, I.regexp_eatClassSetCharacter = function(e) {
|
|
2984
2853
|
var t = e.pos;
|
|
2985
2854
|
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);
|
|
2986
2855
|
var n = e.current();
|
|
2987
|
-
return n < 0 || n === e.lookahead() &&
|
|
2856
|
+
return n < 0 || n === e.lookahead() && Nt(n) || Pt(n) ? !1 : (e.advance(), e.lastIntValue = n, !0);
|
|
2988
2857
|
};
|
|
2989
|
-
function
|
|
2858
|
+
function Nt(e) {
|
|
2990
2859
|
return e === 33 || e >= 35 && e <= 38 || e >= 42 && e <= 44 || e === 46 || e >= 58 && e <= 64 || e === 94 || e === 96 || e === 126;
|
|
2991
2860
|
}
|
|
2992
|
-
function
|
|
2861
|
+
function Pt(e) {
|
|
2993
2862
|
return e === 40 || e === 41 || e === 45 || e === 47 || e >= 91 && e <= 93 || e >= 123 && e <= 125;
|
|
2994
2863
|
}
|
|
2995
|
-
|
|
2864
|
+
I.regexp_eatClassSetReservedPunctuator = function(e) {
|
|
2996
2865
|
var t = e.current();
|
|
2997
|
-
return
|
|
2866
|
+
return Ft(t) ? (e.lastIntValue = t, e.advance(), !0) : !1;
|
|
2998
2867
|
};
|
|
2999
|
-
function
|
|
2868
|
+
function Ft(e) {
|
|
3000
2869
|
return e === 33 || e === 35 || e === 37 || e === 38 || e === 44 || e === 45 || e >= 58 && e <= 62 || e === 64 || e === 96 || e === 126;
|
|
3001
2870
|
}
|
|
3002
|
-
|
|
2871
|
+
I.regexp_eatClassControlLetter = function(e) {
|
|
3003
2872
|
var t = e.current();
|
|
3004
|
-
return
|
|
3005
|
-
},
|
|
2873
|
+
return It(t) || t === 95 ? (e.lastIntValue = t % 32, e.advance(), !0) : !1;
|
|
2874
|
+
}, I.regexp_eatHexEscapeSequence = function(e) {
|
|
3006
2875
|
var t = e.pos;
|
|
3007
2876
|
if (e.eat(120)) {
|
|
3008
2877
|
if (this.regexp_eatFixedHexDigits(e, 2)) return !0;
|
|
3009
2878
|
e.switchU && e.raise("Invalid escape"), e.pos = t;
|
|
3010
2879
|
}
|
|
3011
2880
|
return !1;
|
|
3012
|
-
},
|
|
2881
|
+
}, I.regexp_eatDecimalDigits = function(e) {
|
|
3013
2882
|
var t = e.pos, n = 0;
|
|
3014
|
-
for (e.lastIntValue = 0;
|
|
2883
|
+
for (e.lastIntValue = 0; It(n = e.current());) e.lastIntValue = 10 * e.lastIntValue + (n - 48), e.advance();
|
|
3015
2884
|
return e.pos !== t;
|
|
3016
2885
|
};
|
|
3017
|
-
function
|
|
2886
|
+
function It(e) {
|
|
3018
2887
|
return e >= 48 && e <= 57;
|
|
3019
2888
|
}
|
|
3020
|
-
|
|
2889
|
+
I.regexp_eatHexDigits = function(e) {
|
|
3021
2890
|
var t = e.pos, n = 0;
|
|
3022
|
-
for (e.lastIntValue = 0;
|
|
2891
|
+
for (e.lastIntValue = 0; Lt(n = e.current());) e.lastIntValue = 16 * e.lastIntValue + Rt(n), e.advance();
|
|
3023
2892
|
return e.pos !== t;
|
|
3024
2893
|
};
|
|
3025
|
-
function
|
|
2894
|
+
function Lt(e) {
|
|
3026
2895
|
return e >= 48 && e <= 57 || e >= 65 && e <= 70 || e >= 97 && e <= 102;
|
|
3027
2896
|
}
|
|
3028
|
-
function
|
|
2897
|
+
function Rt(e) {
|
|
3029
2898
|
return e >= 65 && e <= 70 ? 10 + (e - 65) : e >= 97 && e <= 102 ? 10 + (e - 97) : e - 48;
|
|
3030
2899
|
}
|
|
3031
|
-
|
|
2900
|
+
I.regexp_eatLegacyOctalEscapeSequence = function(e) {
|
|
3032
2901
|
if (this.regexp_eatOctalDigit(e)) {
|
|
3033
2902
|
var t = e.lastIntValue;
|
|
3034
2903
|
if (this.regexp_eatOctalDigit(e)) {
|
|
@@ -3038,61 +2907,61 @@ L.regexp_eatLegacyOctalEscapeSequence = function(e) {
|
|
|
3038
2907
|
return !0;
|
|
3039
2908
|
}
|
|
3040
2909
|
return !1;
|
|
3041
|
-
},
|
|
2910
|
+
}, I.regexp_eatOctalDigit = function(e) {
|
|
3042
2911
|
var t = e.current();
|
|
3043
|
-
return
|
|
2912
|
+
return zt(t) ? (e.lastIntValue = t - 48, e.advance(), !0) : (e.lastIntValue = 0, !1);
|
|
3044
2913
|
};
|
|
3045
|
-
function
|
|
2914
|
+
function zt(e) {
|
|
3046
2915
|
return e >= 48 && e <= 55;
|
|
3047
2916
|
}
|
|
3048
|
-
|
|
2917
|
+
I.regexp_eatFixedHexDigits = function(e, t) {
|
|
3049
2918
|
var n = e.pos;
|
|
3050
2919
|
e.lastIntValue = 0;
|
|
3051
2920
|
for (var r = 0; r < t; ++r) {
|
|
3052
2921
|
var i = e.current();
|
|
3053
|
-
if (!
|
|
3054
|
-
e.lastIntValue = 16 * e.lastIntValue +
|
|
2922
|
+
if (!Lt(i)) return e.pos = n, !1;
|
|
2923
|
+
e.lastIntValue = 16 * e.lastIntValue + Rt(i), e.advance();
|
|
3055
2924
|
}
|
|
3056
2925
|
return !0;
|
|
3057
2926
|
};
|
|
3058
|
-
var
|
|
3059
|
-
this.type = e.type, this.value = e.value, this.start = e.start, this.end = e.end, e.options.locations && (this.loc = new
|
|
3060
|
-
},
|
|
3061
|
-
|
|
3062
|
-
!e && this.type.keyword && this.containsEsc && this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword), this.options.onToken && this.options.onToken(new
|
|
3063
|
-
},
|
|
3064
|
-
return this.next(), new
|
|
3065
|
-
}, typeof Symbol < "u" && (
|
|
2927
|
+
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 pe(e, e.startLoc, e.endLoc)), e.options.ranges && (this.range = [e.start, e.end]);
|
|
2929
|
+
}, B = D.prototype;
|
|
2930
|
+
B.next = function(e) {
|
|
2931
|
+
!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
|
+
}, B.getToken = function() {
|
|
2933
|
+
return this.next(), new Bt(this);
|
|
2934
|
+
}, typeof Symbol < "u" && (B[Symbol.iterator] = function() {
|
|
3066
2935
|
var e = this;
|
|
3067
2936
|
return { next: function() {
|
|
3068
2937
|
var t = e.getToken();
|
|
3069
2938
|
return {
|
|
3070
|
-
done: t.type ===
|
|
2939
|
+
done: t.type === b.eof,
|
|
3071
2940
|
value: t
|
|
3072
2941
|
};
|
|
3073
2942
|
} };
|
|
3074
|
-
}),
|
|
2943
|
+
}), B.nextToken = function() {
|
|
3075
2944
|
var e = this.curContext();
|
|
3076
|
-
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(
|
|
2945
|
+
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);
|
|
3077
2946
|
if (e.override) return e.override(this);
|
|
3078
2947
|
this.readToken(this.fullCharCodeAtPos());
|
|
3079
|
-
},
|
|
3080
|
-
return
|
|
3081
|
-
},
|
|
2948
|
+
}, B.readToken = function(e) {
|
|
2949
|
+
return p(e, this.options.ecmaVersion >= 6) || e === 92 ? this.readWord() : this.getTokenFromCode(e);
|
|
2950
|
+
}, B.fullCharCodeAt = function(e) {
|
|
3082
2951
|
var t = this.input.charCodeAt(e);
|
|
3083
2952
|
if (t <= 55295 || t >= 56320) return t;
|
|
3084
2953
|
var n = this.input.charCodeAt(e + 1);
|
|
3085
2954
|
return n <= 56319 || n >= 57344 ? t : (t << 10) + n - 56613888;
|
|
3086
|
-
},
|
|
2955
|
+
}, B.fullCharCodeAtPos = function() {
|
|
3087
2956
|
return this.fullCharCodeAt(this.pos);
|
|
3088
|
-
},
|
|
2957
|
+
}, B.skipBlockComment = function() {
|
|
3089
2958
|
var e = this.options.onComment && this.curPosition(), t = this.pos, n = this.input.indexOf("*/", this.pos += 2);
|
|
3090
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 = re(this.input, i, this.pos)) > -1;) ++this.curLine, i = this.lineStart = r;
|
|
3091
2960
|
this.options.onComment && this.options.onComment(!0, this.input.slice(t + 2, n), t, this.pos, e, this.curPosition());
|
|
3092
|
-
},
|
|
2961
|
+
}, B.skipLineComment = function(e) {
|
|
3093
2962
|
for (var t = this.pos, n = this.options.onComment && this.curPosition(), r = this.input.charCodeAt(this.pos += e); this.pos < this.input.length && !ne(r);) r = this.input.charCodeAt(++this.pos);
|
|
3094
2963
|
this.options.onComment && this.options.onComment(!1, this.input.slice(t + e, this.pos), t, this.pos, n, this.curPosition());
|
|
3095
|
-
},
|
|
2964
|
+
}, B.skipSpace = function() {
|
|
3096
2965
|
loop: for (; this.pos < this.input.length;) {
|
|
3097
2966
|
var e = this.input.charCodeAt(this.pos);
|
|
3098
2967
|
switch (e) {
|
|
@@ -3121,65 +2990,65 @@ V.next = function(e) {
|
|
|
3121
2990
|
else break loop;
|
|
3122
2991
|
}
|
|
3123
2992
|
}
|
|
3124
|
-
},
|
|
2993
|
+
}, B.finishToken = function(e, t) {
|
|
3125
2994
|
this.end = this.pos, this.options.locations && (this.endLoc = this.curPosition());
|
|
3126
2995
|
var n = this.type;
|
|
3127
2996
|
this.type = e, this.value = t, this.updateContext(n);
|
|
3128
|
-
},
|
|
2997
|
+
}, B.readToken_dot = function() {
|
|
3129
2998
|
var e = this.input.charCodeAt(this.pos + 1);
|
|
3130
2999
|
if (e >= 48 && e <= 57) return this.readNumber(!0);
|
|
3131
3000
|
var t = this.input.charCodeAt(this.pos + 2);
|
|
3132
|
-
return this.options.ecmaVersion >= 6 && e === 46 && t === 46 ? (this.pos += 3, this.finishToken(
|
|
3133
|
-
},
|
|
3001
|
+
return this.options.ecmaVersion >= 6 && e === 46 && t === 46 ? (this.pos += 3, this.finishToken(b.ellipsis)) : (++this.pos, this.finishToken(b.dot));
|
|
3002
|
+
}, B.readToken_slash = function() {
|
|
3134
3003
|
var e = this.input.charCodeAt(this.pos + 1);
|
|
3135
|
-
return this.exprAllowed ? (++this.pos, this.readRegexp()) : e === 61 ? this.finishOp(
|
|
3136
|
-
},
|
|
3137
|
-
var t = this.input.charCodeAt(this.pos + 1), n = 1, r = e === 42 ?
|
|
3138
|
-
return this.options.ecmaVersion >= 7 && e === 42 && t === 42 && (++n, r =
|
|
3139
|
-
},
|
|
3004
|
+
return this.exprAllowed ? (++this.pos, this.readRegexp()) : e === 61 ? this.finishOp(b.assign, 2) : this.finishOp(b.slash, 1);
|
|
3005
|
+
}, B.readToken_mult_modulo_exp = function(e) {
|
|
3006
|
+
var t = this.input.charCodeAt(this.pos + 1), n = 1, r = e === 42 ? b.star : b.modulo;
|
|
3007
|
+
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
|
+
}, B.readToken_pipe_amp = function(e) {
|
|
3140
3009
|
var t = this.input.charCodeAt(this.pos + 1);
|
|
3141
|
-
return t === e ? this.options.ecmaVersion >= 12 && this.input.charCodeAt(this.pos + 2) === 61 ? this.finishOp(
|
|
3142
|
-
},
|
|
3143
|
-
return this.input.charCodeAt(this.pos + 1) === 61 ? this.finishOp(
|
|
3144
|
-
},
|
|
3010
|
+
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
|
+
}, B.readToken_caret = function() {
|
|
3012
|
+
return this.input.charCodeAt(this.pos + 1) === 61 ? this.finishOp(b.assign, 2) : this.finishOp(b.bitwiseXOR, 1);
|
|
3013
|
+
}, B.readToken_plus_min = function(e) {
|
|
3145
3014
|
var t = this.input.charCodeAt(this.pos + 1);
|
|
3146
|
-
return t === e ? t === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 && (this.lastTokEnd === 0 ||
|
|
3147
|
-
},
|
|
3015
|
+
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
|
+
}, B.readToken_lt_gt = function(e) {
|
|
3148
3017
|
var t = this.input.charCodeAt(this.pos + 1), n = 1;
|
|
3149
|
-
return t === e ? (n = e === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2, this.input.charCodeAt(this.pos + n) === 61 ? this.finishOp(
|
|
3150
|
-
},
|
|
3018
|
+
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
|
+
}, B.readToken_eq_excl = function(e) {
|
|
3151
3020
|
var t = this.input.charCodeAt(this.pos + 1);
|
|
3152
|
-
return t === 61 ? this.finishOp(
|
|
3153
|
-
},
|
|
3021
|
+
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
|
+
}, B.readToken_question = function() {
|
|
3154
3023
|
var e = this.options.ecmaVersion;
|
|
3155
3024
|
if (e >= 11) {
|
|
3156
3025
|
var t = this.input.charCodeAt(this.pos + 1);
|
|
3157
3026
|
if (t === 46) {
|
|
3158
3027
|
var n = this.input.charCodeAt(this.pos + 2);
|
|
3159
|
-
if (n < 48 || n > 57) return this.finishOp(
|
|
3028
|
+
if (n < 48 || n > 57) return this.finishOp(b.questionDot, 2);
|
|
3160
3029
|
}
|
|
3161
|
-
if (t === 63) return e >= 12 && this.input.charCodeAt(this.pos + 2) === 61 ? this.finishOp(
|
|
3030
|
+
if (t === 63) return e >= 12 && this.input.charCodeAt(this.pos + 2) === 61 ? this.finishOp(b.assign, 3) : this.finishOp(b.coalesce, 2);
|
|
3162
3031
|
}
|
|
3163
|
-
return this.finishOp(
|
|
3164
|
-
},
|
|
3032
|
+
return this.finishOp(b.question, 1);
|
|
3033
|
+
}, B.readToken_numberSign = function() {
|
|
3165
3034
|
var e = this.options.ecmaVersion, t = 35;
|
|
3166
|
-
if (e >= 13 && (++this.pos, t = this.fullCharCodeAtPos(),
|
|
3167
|
-
this.raise(this.pos, "Unexpected character '" +
|
|
3168
|
-
},
|
|
3035
|
+
if (e >= 13 && (++this.pos, t = this.fullCharCodeAtPos(), p(t, !0) || t === 92)) return this.finishToken(b.privateId, this.readWord1());
|
|
3036
|
+
this.raise(this.pos, "Unexpected character '" + w(t) + "'");
|
|
3037
|
+
}, B.getTokenFromCode = function(e) {
|
|
3169
3038
|
switch (e) {
|
|
3170
3039
|
case 46: return this.readToken_dot();
|
|
3171
|
-
case 40: return ++this.pos, this.finishToken(
|
|
3172
|
-
case 41: return ++this.pos, this.finishToken(
|
|
3173
|
-
case 59: return ++this.pos, this.finishToken(
|
|
3174
|
-
case 44: return ++this.pos, this.finishToken(
|
|
3175
|
-
case 91: return ++this.pos, this.finishToken(
|
|
3176
|
-
case 93: return ++this.pos, this.finishToken(
|
|
3177
|
-
case 123: return ++this.pos, this.finishToken(
|
|
3178
|
-
case 125: return ++this.pos, this.finishToken(
|
|
3179
|
-
case 58: return ++this.pos, this.finishToken(
|
|
3040
|
+
case 40: return ++this.pos, this.finishToken(b.parenL);
|
|
3041
|
+
case 41: return ++this.pos, this.finishToken(b.parenR);
|
|
3042
|
+
case 59: return ++this.pos, this.finishToken(b.semi);
|
|
3043
|
+
case 44: return ++this.pos, this.finishToken(b.comma);
|
|
3044
|
+
case 91: return ++this.pos, this.finishToken(b.bracketL);
|
|
3045
|
+
case 93: return ++this.pos, this.finishToken(b.bracketR);
|
|
3046
|
+
case 123: return ++this.pos, this.finishToken(b.braceL);
|
|
3047
|
+
case 125: return ++this.pos, this.finishToken(b.braceR);
|
|
3048
|
+
case 58: return ++this.pos, this.finishToken(b.colon);
|
|
3180
3049
|
case 96:
|
|
3181
3050
|
if (this.options.ecmaVersion < 6) break;
|
|
3182
|
-
return ++this.pos, this.finishToken(
|
|
3051
|
+
return ++this.pos, this.finishToken(b.backQuote);
|
|
3183
3052
|
case 48:
|
|
3184
3053
|
var t = this.input.charCodeAt(this.pos + 1);
|
|
3185
3054
|
if (t === 120 || t === 88) return this.readRadixNumber(16);
|
|
@@ -3211,18 +3080,18 @@ V.next = function(e) {
|
|
|
3211
3080
|
case 61:
|
|
3212
3081
|
case 33: return this.readToken_eq_excl(e);
|
|
3213
3082
|
case 63: return this.readToken_question();
|
|
3214
|
-
case 126: return this.finishOp(
|
|
3083
|
+
case 126: return this.finishOp(b.prefix, 1);
|
|
3215
3084
|
case 35: return this.readToken_numberSign();
|
|
3216
3085
|
}
|
|
3217
|
-
this.raise(this.pos, "Unexpected character '" +
|
|
3218
|
-
},
|
|
3086
|
+
this.raise(this.pos, "Unexpected character '" + w(e) + "'");
|
|
3087
|
+
}, B.finishOp = function(e, t) {
|
|
3219
3088
|
var n = this.input.slice(this.pos, this.pos + t);
|
|
3220
3089
|
return this.pos += t, this.finishToken(e, n);
|
|
3221
|
-
},
|
|
3090
|
+
}, B.readRegexp = function() {
|
|
3222
3091
|
for (var e, t, n = this.pos;;) {
|
|
3223
3092
|
this.pos >= this.input.length && this.raise(n, "Unterminated regular expression");
|
|
3224
3093
|
var r = this.input.charAt(this.pos);
|
|
3225
|
-
if (
|
|
3094
|
+
if (x.test(r) && this.raise(n, "Unterminated regular expression"), e) e = !1;
|
|
3226
3095
|
else {
|
|
3227
3096
|
if (r === "[") t = !0;
|
|
3228
3097
|
else if (r === "]" && t) t = !1;
|
|
@@ -3235,18 +3104,18 @@ V.next = function(e) {
|
|
|
3235
3104
|
++this.pos;
|
|
3236
3105
|
var a = this.pos, o = this.readWord1();
|
|
3237
3106
|
this.containsEsc && this.unexpected(a);
|
|
3238
|
-
var s = this.regexpState ||= new
|
|
3107
|
+
var s = this.regexpState ||= new L(this);
|
|
3239
3108
|
s.reset(n, i, o), this.validateRegExpFlags(s), this.validateRegExpPattern(s);
|
|
3240
3109
|
var c = null;
|
|
3241
3110
|
try {
|
|
3242
3111
|
c = new RegExp(i, o);
|
|
3243
3112
|
} catch {}
|
|
3244
|
-
return this.finishToken(
|
|
3113
|
+
return this.finishToken(b.regexp, {
|
|
3245
3114
|
pattern: i,
|
|
3246
3115
|
flags: o,
|
|
3247
3116
|
value: c
|
|
3248
3117
|
});
|
|
3249
|
-
},
|
|
3118
|
+
}, B.readInt = function(e, t, n) {
|
|
3250
3119
|
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) {
|
|
3251
3120
|
var u = this.input.charCodeAt(this.pos), d = void 0;
|
|
3252
3121
|
if (r && u === 95) {
|
|
@@ -3258,31 +3127,31 @@ V.next = function(e) {
|
|
|
3258
3127
|
}
|
|
3259
3128
|
return r && s === 95 && this.raiseRecoverable(this.pos - 1, "Numeric separator is not allowed at the last of digits"), this.pos === a || t != null && this.pos - a !== t ? null : o;
|
|
3260
3129
|
};
|
|
3261
|
-
function
|
|
3130
|
+
function Vt(e, t) {
|
|
3262
3131
|
return t ? parseInt(e, 8) : parseFloat(e.replace(/_/g, ""));
|
|
3263
3132
|
}
|
|
3264
|
-
function
|
|
3133
|
+
function Ht(e) {
|
|
3265
3134
|
return typeof BigInt == "function" ? BigInt(e.replace(/_/g, "")) : null;
|
|
3266
3135
|
}
|
|
3267
|
-
|
|
3136
|
+
B.readRadixNumber = function(e) {
|
|
3268
3137
|
var t = this.pos;
|
|
3269
3138
|
this.pos += 2;
|
|
3270
3139
|
var n = this.readInt(e);
|
|
3271
|
-
return n ?? this.raise(this.start + 2, "Expected number in radix " + e), this.options.ecmaVersion >= 11 && this.input.charCodeAt(this.pos) === 110 ? (n =
|
|
3272
|
-
},
|
|
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) : p(this.fullCharCodeAtPos()) && this.raise(this.pos, "Identifier directly after number"), this.finishToken(b.num, n);
|
|
3141
|
+
}, B.readNumber = function(e) {
|
|
3273
3142
|
var t = this.pos;
|
|
3274
3143
|
!e && this.readInt(10, void 0, !0) === null && this.raise(t, "Invalid number");
|
|
3275
3144
|
var n = this.pos - t >= 2 && this.input.charCodeAt(t) === 48;
|
|
3276
3145
|
n && this.strict && this.raise(t, "Invalid number");
|
|
3277
3146
|
var r = this.input.charCodeAt(this.pos);
|
|
3278
3147
|
if (!n && !e && this.options.ecmaVersion >= 11 && r === 110) {
|
|
3279
|
-
var i =
|
|
3280
|
-
return ++this.pos,
|
|
3148
|
+
var i = Ht(this.input.slice(t, this.pos));
|
|
3149
|
+
return ++this.pos, p(this.fullCharCodeAtPos()) && this.raise(this.pos, "Identifier directly after number"), this.finishToken(b.num, i);
|
|
3281
3150
|
}
|
|
3282
|
-
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")),
|
|
3283
|
-
var a =
|
|
3284
|
-
return this.finishToken(
|
|
3285
|
-
},
|
|
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")), p(this.fullCharCodeAtPos()) && this.raise(this.pos, "Identifier directly after number");
|
|
3152
|
+
var a = Vt(this.input.slice(t, this.pos), n);
|
|
3153
|
+
return this.finishToken(b.num, a);
|
|
3154
|
+
}, B.readCodePoint = function() {
|
|
3286
3155
|
var e = this.input.charCodeAt(this.pos), t;
|
|
3287
3156
|
if (e === 123) {
|
|
3288
3157
|
this.options.ecmaVersion < 6 && this.unexpected();
|
|
@@ -3290,33 +3159,33 @@ V.readRadixNumber = function(e) {
|
|
|
3290
3159
|
t = this.readHexChar(this.input.indexOf("}", this.pos) - this.pos), ++this.pos, t > 1114111 && this.invalidStringToken(n, "Code point out of bounds");
|
|
3291
3160
|
} else t = this.readHexChar(4);
|
|
3292
3161
|
return t;
|
|
3293
|
-
},
|
|
3162
|
+
}, B.readString = function(e) {
|
|
3294
3163
|
for (var t = "", n = ++this.pos;;) {
|
|
3295
3164
|
this.pos >= this.input.length && this.raise(this.start, "Unterminated string constant");
|
|
3296
3165
|
var r = this.input.charCodeAt(this.pos);
|
|
3297
3166
|
if (r === e) break;
|
|
3298
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)) : (ne(r) && this.raise(this.start, "Unterminated string constant"), ++this.pos);
|
|
3299
3168
|
}
|
|
3300
|
-
return t += this.input.slice(n, this.pos++), this.finishToken(
|
|
3169
|
+
return t += this.input.slice(n, this.pos++), this.finishToken(b.string, t);
|
|
3301
3170
|
};
|
|
3302
|
-
var
|
|
3303
|
-
|
|
3171
|
+
var Ut = {};
|
|
3172
|
+
B.tryReadTemplateToken = function() {
|
|
3304
3173
|
this.inTemplateElement = !0;
|
|
3305
3174
|
try {
|
|
3306
3175
|
this.readTmplToken();
|
|
3307
3176
|
} catch (e) {
|
|
3308
|
-
if (e ===
|
|
3177
|
+
if (e === Ut) this.readInvalidTemplateToken();
|
|
3309
3178
|
else throw e;
|
|
3310
3179
|
}
|
|
3311
3180
|
this.inTemplateElement = !1;
|
|
3312
|
-
},
|
|
3313
|
-
if (this.inTemplateElement && this.options.ecmaVersion >= 9) throw
|
|
3181
|
+
}, B.invalidStringToken = function(e, t) {
|
|
3182
|
+
if (this.inTemplateElement && this.options.ecmaVersion >= 9) throw Ut;
|
|
3314
3183
|
this.raise(e, t);
|
|
3315
|
-
},
|
|
3184
|
+
}, B.readTmplToken = function() {
|
|
3316
3185
|
for (var e = "", t = this.pos;;) {
|
|
3317
3186
|
this.pos >= this.input.length && this.raise(this.start, "Unterminated template");
|
|
3318
3187
|
var n = this.input.charCodeAt(this.pos);
|
|
3319
|
-
if (n === 96 || n === 36 && this.input.charCodeAt(this.pos + 1) === 123) return this.pos === this.start && (this.type ===
|
|
3188
|
+
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));
|
|
3320
3189
|
if (n === 92) e += this.input.slice(t, this.pos), e += this.readEscapedChar(!0), t = this.pos;
|
|
3321
3190
|
else if (ne(n)) {
|
|
3322
3191
|
switch (e += this.input.slice(t, this.pos), ++this.pos, n) {
|
|
@@ -3331,13 +3200,13 @@ V.tryReadTemplateToken = function() {
|
|
|
3331
3200
|
this.options.locations && (++this.curLine, this.lineStart = this.pos), t = this.pos;
|
|
3332
3201
|
} else ++this.pos;
|
|
3333
3202
|
}
|
|
3334
|
-
},
|
|
3203
|
+
}, B.readInvalidTemplateToken = function() {
|
|
3335
3204
|
for (; this.pos < this.input.length; this.pos++) switch (this.input[this.pos]) {
|
|
3336
3205
|
case "\\":
|
|
3337
3206
|
++this.pos;
|
|
3338
3207
|
break;
|
|
3339
3208
|
case "$": if (this.input[this.pos + 1] !== "{") break;
|
|
3340
|
-
case "`": return this.finishToken(
|
|
3209
|
+
case "`": return this.finishToken(b.invalidTemplate, this.input.slice(this.start, this.pos));
|
|
3341
3210
|
case "\r": this.input[this.pos + 1] === "\n" && ++this.pos;
|
|
3342
3211
|
case "\n":
|
|
3343
3212
|
case "\u2028":
|
|
@@ -3346,13 +3215,13 @@ V.tryReadTemplateToken = function() {
|
|
|
3346
3215
|
break;
|
|
3347
3216
|
}
|
|
3348
3217
|
this.raise(this.start, "Unterminated template");
|
|
3349
|
-
},
|
|
3218
|
+
}, B.readEscapedChar = function(e) {
|
|
3350
3219
|
var t = this.input.charCodeAt(++this.pos);
|
|
3351
3220
|
switch (++this.pos, t) {
|
|
3352
3221
|
case 110: return "\n";
|
|
3353
3222
|
case 114: return "\r";
|
|
3354
3223
|
case 120: return String.fromCharCode(this.readHexChar(2));
|
|
3355
|
-
case 117: return
|
|
3224
|
+
case 117: return w(this.readCodePoint());
|
|
3356
3225
|
case 116: return " ";
|
|
3357
3226
|
case 98: return "\b";
|
|
3358
3227
|
case 118: return "\v";
|
|
@@ -3371,68 +3240,68 @@ V.tryReadTemplateToken = function() {
|
|
|
3371
3240
|
}
|
|
3372
3241
|
return ne(t) ? (this.options.locations && (this.lineStart = this.pos, ++this.curLine), "") : String.fromCharCode(t);
|
|
3373
3242
|
}
|
|
3374
|
-
},
|
|
3243
|
+
}, B.readHexChar = function(e) {
|
|
3375
3244
|
var t = this.pos, n = this.readInt(16, e);
|
|
3376
3245
|
return n === null && this.invalidStringToken(t, "Bad character escape sequence"), n;
|
|
3377
|
-
},
|
|
3246
|
+
}, B.readWord1 = function() {
|
|
3378
3247
|
this.containsEsc = !1;
|
|
3379
3248
|
for (var e = "", t = !0, n = this.pos, r = this.options.ecmaVersion >= 6; this.pos < this.input.length;) {
|
|
3380
3249
|
var i = this.fullCharCodeAtPos();
|
|
3381
|
-
if (
|
|
3250
|
+
if (m(i, r)) this.pos += i <= 65535 ? 1 : 2;
|
|
3382
3251
|
else if (i === 92) {
|
|
3383
3252
|
this.containsEsc = !0, e += this.input.slice(n, this.pos);
|
|
3384
3253
|
var a = this.pos;
|
|
3385
3254
|
this.input.charCodeAt(++this.pos) !== 117 && this.invalidStringToken(this.pos, "Expecting Unicode escape sequence \\uXXXX"), ++this.pos;
|
|
3386
3255
|
var o = this.readCodePoint();
|
|
3387
|
-
(t ?
|
|
3256
|
+
(t ? p : m)(o, r) || this.invalidStringToken(a, "Invalid Unicode escape"), e += w(o), n = this.pos;
|
|
3388
3257
|
} else break;
|
|
3389
3258
|
t = !1;
|
|
3390
3259
|
}
|
|
3391
3260
|
return e + this.input.slice(n, this.pos);
|
|
3392
|
-
},
|
|
3393
|
-
var e = this.readWord1(), t =
|
|
3261
|
+
}, B.readWord = function() {
|
|
3262
|
+
var e = this.readWord1(), t = b.name;
|
|
3394
3263
|
return this.keywords.test(e) && (t = ee[e]), this.finishToken(t, e);
|
|
3395
|
-
},
|
|
3396
|
-
Parser:
|
|
3264
|
+
}, D.acorn = {
|
|
3265
|
+
Parser: D,
|
|
3397
3266
|
version: "8.17.0",
|
|
3398
|
-
defaultOptions:
|
|
3399
|
-
Position:
|
|
3400
|
-
SourceLocation:
|
|
3401
|
-
getLineInfo:
|
|
3402
|
-
Node:
|
|
3403
|
-
TokenType:
|
|
3404
|
-
tokTypes:
|
|
3267
|
+
defaultOptions: he,
|
|
3268
|
+
Position: fe,
|
|
3269
|
+
SourceLocation: pe,
|
|
3270
|
+
getLineInfo: me,
|
|
3271
|
+
Node: Qe,
|
|
3272
|
+
TokenType: h,
|
|
3273
|
+
tokTypes: b,
|
|
3405
3274
|
keywordTypes: ee,
|
|
3406
|
-
TokContext:
|
|
3407
|
-
tokContexts:
|
|
3408
|
-
isIdentifierChar:
|
|
3409
|
-
isIdentifierStart:
|
|
3410
|
-
Token:
|
|
3275
|
+
TokContext: M,
|
|
3276
|
+
tokContexts: N,
|
|
3277
|
+
isIdentifierChar: m,
|
|
3278
|
+
isIdentifierStart: p,
|
|
3279
|
+
Token: Bt,
|
|
3411
3280
|
isNewLine: ne,
|
|
3412
|
-
lineBreak:
|
|
3281
|
+
lineBreak: x,
|
|
3413
3282
|
lineBreakG: te,
|
|
3414
3283
|
nonASCIIwhitespace: ie
|
|
3415
3284
|
};
|
|
3416
|
-
function
|
|
3417
|
-
return
|
|
3285
|
+
function Wt(e, t) {
|
|
3286
|
+
return D.parse(e, t);
|
|
3418
3287
|
}
|
|
3419
|
-
function
|
|
3420
|
-
return
|
|
3288
|
+
function V(e, t, n) {
|
|
3289
|
+
return D.parseExpressionAt(e, t, n);
|
|
3421
3290
|
}
|
|
3422
3291
|
//#endregion
|
|
3423
3292
|
//#region ../../node_modules/.pnpm/acorn-walk@8.3.5/node_modules/acorn-walk/dist/walk.mjs
|
|
3424
|
-
function
|
|
3293
|
+
function Gt(e, t, n, r, i) {
|
|
3425
3294
|
var a = [];
|
|
3426
3295
|
n ||= H, (function e(r, i, o) {
|
|
3427
3296
|
var s = o || r.type, c = r !== a[a.length - 1];
|
|
3428
|
-
c && a.push(r),
|
|
3297
|
+
c && a.push(r), Jt(n, s, r, i, e), t[s] && t[s](r, i || a, a), c && a.pop();
|
|
3429
3298
|
})(e, r, i);
|
|
3430
3299
|
}
|
|
3431
|
-
function
|
|
3300
|
+
function Kt(e, t, n) {
|
|
3432
3301
|
n(e, t);
|
|
3433
3302
|
}
|
|
3434
|
-
function
|
|
3435
|
-
function
|
|
3303
|
+
function qt(e, t, n) {}
|
|
3304
|
+
function Jt(e, t, n, r, i) {
|
|
3436
3305
|
if (e[t] == null) throw Error("No walker function defined for node type " + t);
|
|
3437
3306
|
e[t](n, r, i);
|
|
3438
3307
|
}
|
|
@@ -3442,13 +3311,13 @@ H.Program = H.BlockStatement = H.StaticBlock = function(e, t, n) {
|
|
|
3442
3311
|
var a = i[r];
|
|
3443
3312
|
n(a, t, "Statement");
|
|
3444
3313
|
}
|
|
3445
|
-
}, H.Statement =
|
|
3314
|
+
}, H.Statement = Kt, H.EmptyStatement = qt, H.ExpressionStatement = H.ParenthesizedExpression = H.ChainExpression = function(e, t, n) {
|
|
3446
3315
|
return n(e.expression, t, "Expression");
|
|
3447
3316
|
}, H.IfStatement = function(e, t, n) {
|
|
3448
3317
|
n(e.test, t, "Expression"), n(e.consequent, t, "Statement"), e.alternate && n(e.alternate, t, "Statement");
|
|
3449
3318
|
}, H.LabeledStatement = function(e, t, n) {
|
|
3450
3319
|
return n(e.body, t, "Statement");
|
|
3451
|
-
}, H.BreakStatement = H.ContinueStatement =
|
|
3320
|
+
}, H.BreakStatement = H.ContinueStatement = qt, H.WithStatement = function(e, t, n) {
|
|
3452
3321
|
n(e.object, t, "Expression"), n(e.body, t, "Statement");
|
|
3453
3322
|
}, H.SwitchStatement = function(e, t, n) {
|
|
3454
3323
|
n(e.discriminant, t, "Expression");
|
|
@@ -3478,7 +3347,7 @@ H.Program = H.BlockStatement = H.StaticBlock = function(e, t, n) {
|
|
|
3478
3347
|
n(e.left, t, "ForInit"), n(e.right, t, "Expression"), n(e.body, t, "Statement");
|
|
3479
3348
|
}, H.ForInit = function(e, t, n) {
|
|
3480
3349
|
e.type === "VariableDeclaration" ? n(e, t) : n(e, t, "Expression");
|
|
3481
|
-
}, H.DebuggerStatement =
|
|
3350
|
+
}, H.DebuggerStatement = qt, H.FunctionDeclaration = function(e, t, n) {
|
|
3482
3351
|
return n(e, t, "Function");
|
|
3483
3352
|
}, H.VariableDeclaration = function(e, t, n) {
|
|
3484
3353
|
for (var r = 0, i = e.declarations; r < i.length; r += 1) {
|
|
@@ -3496,7 +3365,7 @@ H.Program = H.BlockStatement = H.StaticBlock = function(e, t, n) {
|
|
|
3496
3365
|
n(e.body, t, e.expression ? "Expression" : "Statement");
|
|
3497
3366
|
}, H.Pattern = function(e, t, n) {
|
|
3498
3367
|
e.type === "Identifier" ? n(e, t, "VariablePattern") : e.type === "MemberExpression" ? n(e, t, "MemberPattern") : n(e, t);
|
|
3499
|
-
}, H.VariablePattern =
|
|
3368
|
+
}, H.VariablePattern = qt, H.MemberPattern = Kt, H.RestElement = function(e, t, n) {
|
|
3500
3369
|
return n(e.argument, t, "Pattern");
|
|
3501
3370
|
}, H.ArrayPattern = function(e, t, n) {
|
|
3502
3371
|
for (var r = 0, i = e.elements; r < i.length; r += 1) {
|
|
@@ -3508,7 +3377,7 @@ H.Program = H.BlockStatement = H.StaticBlock = function(e, t, n) {
|
|
|
3508
3377
|
var a = i[r];
|
|
3509
3378
|
a.type === "Property" ? (a.computed && n(a.key, t, "Expression"), n(a.value, t, "Pattern")) : a.type === "RestElement" && n(a.argument, t, "Pattern");
|
|
3510
3379
|
}
|
|
3511
|
-
}, H.Expression =
|
|
3380
|
+
}, H.Expression = Kt, H.ThisExpression = H.Super = H.MetaProperty = qt, H.ArrayExpression = function(e, t, n) {
|
|
3512
3381
|
for (var r = 0, i = e.elements; r < i.length; r += 1) {
|
|
3513
3382
|
var a = i[r];
|
|
3514
3383
|
a && n(a, t, "Expression");
|
|
@@ -3532,7 +3401,7 @@ H.Program = H.BlockStatement = H.StaticBlock = function(e, t, n) {
|
|
|
3532
3401
|
var c = s[o];
|
|
3533
3402
|
n(c, t, "Expression");
|
|
3534
3403
|
}
|
|
3535
|
-
}, H.TemplateElement =
|
|
3404
|
+
}, H.TemplateElement = qt, H.UnaryExpression = H.UpdateExpression = function(e, t, n) {
|
|
3536
3405
|
n(e.argument, t, "Expression");
|
|
3537
3406
|
}, H.BinaryExpression = H.LogicalExpression = function(e, t, n) {
|
|
3538
3407
|
n(e.left, t, "Expression"), n(e.right, t, "Expression");
|
|
@@ -3570,7 +3439,7 @@ H.Program = H.BlockStatement = H.StaticBlock = function(e, t, n) {
|
|
|
3570
3439
|
}
|
|
3571
3440
|
}, H.ImportExpression = function(e, t, n) {
|
|
3572
3441
|
n(e.source, t, "Expression"), e.options && n(e.options, t, "Expression");
|
|
3573
|
-
}, H.ImportSpecifier = H.ImportDefaultSpecifier = H.ImportNamespaceSpecifier = H.Identifier = H.PrivateIdentifier = H.Literal =
|
|
3442
|
+
}, H.ImportSpecifier = H.ImportDefaultSpecifier = H.ImportNamespaceSpecifier = H.Identifier = H.PrivateIdentifier = H.Literal = qt, H.TaggedTemplateExpression = function(e, t, n) {
|
|
3574
3443
|
n(e.tag, t, "Expression"), n(e.quasi, t, "Expression");
|
|
3575
3444
|
}, H.ClassDeclaration = H.ClassExpression = function(e, t, n) {
|
|
3576
3445
|
return n(e, t, "Class");
|
|
@@ -3604,6 +3473,9 @@ var U = {
|
|
|
3604
3473
|
DirectiveSwitch: "DirectiveSwitch",
|
|
3605
3474
|
DirectiveCase: "DirectiveCase",
|
|
3606
3475
|
DirectiveDefault: "DirectiveDefault",
|
|
3476
|
+
DirectiveAsync: "DirectiveAsync",
|
|
3477
|
+
DirectiveFallback: "DirectiveFallback",
|
|
3478
|
+
DirectiveCatch: "DirectiveCatch",
|
|
3607
3479
|
BlockOpen: "BlockOpen",
|
|
3608
3480
|
BlockClose: "BlockClose",
|
|
3609
3481
|
EOF: "EOF"
|
|
@@ -3632,7 +3504,8 @@ var U = {
|
|
|
3632
3504
|
Comment: "Comment",
|
|
3633
3505
|
If: "If",
|
|
3634
3506
|
For: "For",
|
|
3635
|
-
Switch: "Switch"
|
|
3507
|
+
Switch: "Switch",
|
|
3508
|
+
Async: "Async"
|
|
3636
3509
|
}, q = class extends Error {
|
|
3637
3510
|
line;
|
|
3638
3511
|
column;
|
|
@@ -3648,8 +3521,8 @@ var U = {
|
|
|
3648
3521
|
super(`ParserError [${t}:${n}]: ${e}`), this.line = t, this.column = n, this.offset = r, this.name = "DriftParserError";
|
|
3649
3522
|
}
|
|
3650
3523
|
}, Y = /* @__PURE__ */ function(e) {
|
|
3651
|
-
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;
|
|
3652
|
-
}({}),
|
|
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
|
+
}({}), Yt = {
|
|
3653
3526
|
[W.Data]: [
|
|
3654
3527
|
{
|
|
3655
3528
|
to: W.Comment,
|
|
@@ -3784,17 +3657,20 @@ var U = {
|
|
|
3784
3657
|
emits: "EOF"
|
|
3785
3658
|
}]
|
|
3786
3659
|
};
|
|
3787
|
-
function
|
|
3660
|
+
function Xt(e) {
|
|
3788
3661
|
return e === "script" || e === "style";
|
|
3789
3662
|
}
|
|
3790
|
-
var
|
|
3663
|
+
var Zt = /* @__PURE__ */ new Set([
|
|
3791
3664
|
"if",
|
|
3792
3665
|
"else",
|
|
3793
3666
|
"for",
|
|
3794
3667
|
"switch",
|
|
3795
3668
|
"case",
|
|
3796
|
-
"default"
|
|
3797
|
-
|
|
3669
|
+
"default",
|
|
3670
|
+
"async",
|
|
3671
|
+
"fallback",
|
|
3672
|
+
"catch"
|
|
3673
|
+
]), Qt = /* @__PURE__ */ new Set([
|
|
3798
3674
|
"return",
|
|
3799
3675
|
"yield",
|
|
3800
3676
|
"await",
|
|
@@ -3807,7 +3683,7 @@ var tn = /* @__PURE__ */ new Set([
|
|
|
3807
3683
|
"do",
|
|
3808
3684
|
"throw",
|
|
3809
3685
|
"new"
|
|
3810
|
-
]),
|
|
3686
|
+
]), $t = class {
|
|
3811
3687
|
source;
|
|
3812
3688
|
offset = 0;
|
|
3813
3689
|
line = 1;
|
|
@@ -3866,7 +3742,7 @@ var tn = /* @__PURE__ */ new Set([
|
|
|
3866
3742
|
this.advance();
|
|
3867
3743
|
let t = "";
|
|
3868
3744
|
for (; !this.isAtEnd() && /[a-zA-Z]/.test(this.peek());) t += this.advance();
|
|
3869
|
-
if (!
|
|
3745
|
+
if (!Zt.has(t)) throw new q(`Unknown directive '@${t}'`, e.line, e.column, e.offset);
|
|
3870
3746
|
if (t === "if") return this.readDirectiveHeader(e, U.DirectiveIf);
|
|
3871
3747
|
if (t === "else") {
|
|
3872
3748
|
if (this.skipWhitespace(), this.startsWith("if") && !/[a-zA-Z0-9_]/.test(this.peek(2))) return this.consumePattern("if"), this.readDirectiveHeader(e, U.DirectiveElseIf);
|
|
@@ -3875,7 +3751,12 @@ var tn = /* @__PURE__ */ new Set([
|
|
|
3875
3751
|
} else if (t === "for") return this.readDirectiveHeader(e, U.DirectiveFor);
|
|
3876
3752
|
else if (t === "switch") return this.readDirectiveHeader(e, U.DirectiveSwitch);
|
|
3877
3753
|
else if (t === "case") return this.readDirectiveHeader(e, U.DirectiveCase);
|
|
3878
|
-
else
|
|
3754
|
+
else if (t === "async") return this.readDirectiveHeader(e, U.DirectiveAsync);
|
|
3755
|
+
else if (t === "catch") return this.readDirectiveHeader(e, U.DirectiveCatch);
|
|
3756
|
+
else if (t === "fallback") {
|
|
3757
|
+
if (this.skipWhitespace(), this.peek() === "{") return this.advance(), this.blockDepth++, this.blockElementDepthStack.push(this.elementDepth), this.createToken(U.DirectiveFallback, "", e);
|
|
3758
|
+
throw new q("Expected '{' after @fallback directive", e.line, e.column, e.offset);
|
|
3759
|
+
} else return this.skipWhitespace(), this.peek() === "{" && (this.advance(), this.blockDepth++, this.blockElementDepthStack.push(this.elementDepth)), this.createToken(U.DirectiveDefault, "", e);
|
|
3879
3760
|
}
|
|
3880
3761
|
readDirectiveHeader(e, t) {
|
|
3881
3762
|
this.skipWhitespace();
|
|
@@ -3939,7 +3820,7 @@ var tn = /* @__PURE__ */ new Set([
|
|
|
3939
3820
|
continue;
|
|
3940
3821
|
}
|
|
3941
3822
|
if (m === "{") {
|
|
3942
|
-
if (r === 0 && i === 0 && a === 0 && o.length === 0) return this.blockDepth++, this.blockElementDepthStack.push(this.elementDepth), this.createToken(t, n.trim(), e);
|
|
3823
|
+
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);
|
|
3943
3824
|
a++, p = G.Start, n += m;
|
|
3944
3825
|
continue;
|
|
3945
3826
|
}
|
|
@@ -3963,7 +3844,7 @@ var tn = /* @__PURE__ */ new Set([
|
|
|
3963
3844
|
if (/[a-zA-Z0-9_$]/.test(m)) {
|
|
3964
3845
|
let e = m;
|
|
3965
3846
|
for (; !this.isAtEnd() && /[a-zA-Z0-9_$]/.test(this.peek());) e += this.advance();
|
|
3966
|
-
p =
|
|
3847
|
+
p = Qt.has(e) ? G.Keyword : G.IdentifierOrLiteral, n += e;
|
|
3967
3848
|
continue;
|
|
3968
3849
|
}
|
|
3969
3850
|
n += m;
|
|
@@ -3974,7 +3855,7 @@ var tn = /* @__PURE__ */ new Set([
|
|
|
3974
3855
|
if (this.isAtEnd()) throw this.createUnexpectedEOFError(e ? "after closing tag opener" : "after opening tag opener");
|
|
3975
3856
|
let t = this.getLocation(), n = this.peek();
|
|
3976
3857
|
if (!this.isIdentifierStart(n)) throw new q(`Expected tag name but found '${n || "EOF"}'`, t.line, t.column, t.offset);
|
|
3977
|
-
let r = this.readIdentifierValue(), i = !e &&
|
|
3858
|
+
let r = this.readIdentifierValue(), i = !e && Xt(r);
|
|
3978
3859
|
return this.transitionTo({
|
|
3979
3860
|
kind: W.BeforeAttributeName,
|
|
3980
3861
|
tagName: r,
|
|
@@ -3999,7 +3880,7 @@ var tn = /* @__PURE__ */ new Set([
|
|
|
3999
3880
|
return this.transitionTo({ kind: W.Data }), this.createToken(U.TagSelfClose, "/>", n);
|
|
4000
3881
|
}
|
|
4001
3882
|
}
|
|
4002
|
-
if (this.peek() === ">") return this.advance(), e.has(t.tagName.toLowerCase()) || this.elementDepth++, t.entersRawText &&
|
|
3883
|
+
if (this.peek() === ">") return this.advance(), e.has(t.tagName.toLowerCase()) || this.elementDepth++, t.entersRawText && Xt(t.tagName) ? this.transitionTo({
|
|
4003
3884
|
kind: W.RawText,
|
|
4004
3885
|
tagName: t.tagName
|
|
4005
3886
|
}) : this.transitionTo({ kind: W.Data }), this.createToken(U.TagClose, ">", n);
|
|
@@ -4039,7 +3920,7 @@ var tn = /* @__PURE__ */ new Set([
|
|
|
4039
3920
|
kind: W.BeforeAttributeName,
|
|
4040
3921
|
tagName: t,
|
|
4041
3922
|
isClosingTag: !1,
|
|
4042
|
-
entersRawText:
|
|
3923
|
+
entersRawText: Xt(t)
|
|
4043
3924
|
}), this.readBeforeAttributeNameToken();
|
|
4044
3925
|
}
|
|
4045
3926
|
readBeforeAttributeValueToken() {
|
|
@@ -4142,7 +4023,7 @@ var tn = /* @__PURE__ */ new Set([
|
|
|
4142
4023
|
kind: W.BeforeAttributeName,
|
|
4143
4024
|
tagName: n,
|
|
4144
4025
|
isClosingTag: !1,
|
|
4145
|
-
entersRawText:
|
|
4026
|
+
entersRawText: Xt(n)
|
|
4146
4027
|
}) : this.transitionTo({ kind: W.Data }), this.createToken(U.Interpolation, f, e);
|
|
4147
4028
|
f += p;
|
|
4148
4029
|
continue;
|
|
@@ -4163,7 +4044,7 @@ var tn = /* @__PURE__ */ new Set([
|
|
|
4163
4044
|
if (/[a-zA-Z0-9_$]/.test(p)) {
|
|
4164
4045
|
let e = p;
|
|
4165
4046
|
for (; !this.isAtEnd() && /[a-zA-Z0-9_$]/.test(this.peek());) e += this.advance();
|
|
4166
|
-
u =
|
|
4047
|
+
u = Qt.has(e) ? G.Keyword : G.IdentifierOrLiteral, f += e;
|
|
4167
4048
|
continue;
|
|
4168
4049
|
}
|
|
4169
4050
|
f += p;
|
|
@@ -4205,7 +4086,7 @@ var tn = /* @__PURE__ */ new Set([
|
|
|
4205
4086
|
kind: W.BeforeAttributeName,
|
|
4206
4087
|
tagName: n,
|
|
4207
4088
|
isClosingTag: !1,
|
|
4208
|
-
entersRawText:
|
|
4089
|
+
entersRawText: Xt(n)
|
|
4209
4090
|
}), this.createToken(U.StringLiteral, r, e);
|
|
4210
4091
|
r += this.advance();
|
|
4211
4092
|
}
|
|
@@ -4241,7 +4122,7 @@ var tn = /* @__PURE__ */ new Set([
|
|
|
4241
4122
|
return new q(`Unexpected end of input ${e}`, t.line, t.column, t.offset);
|
|
4242
4123
|
}
|
|
4243
4124
|
transitionTo(e) {
|
|
4244
|
-
if (
|
|
4125
|
+
if (!Yt[this.state.kind].some((t) => t.to === e.kind)) throw Error(`Invalid lexer transition from '${this.state.kind}' to '${e.kind}'.`);
|
|
4245
4126
|
this.state = e;
|
|
4246
4127
|
}
|
|
4247
4128
|
getLocation() {
|
|
@@ -4291,7 +4172,7 @@ var tn = /* @__PURE__ */ new Set([
|
|
|
4291
4172
|
let n = this.peek(t);
|
|
4292
4173
|
return n === "" || n === ">" || n === " " || n === " " || n === "\r" || n === "\n";
|
|
4293
4174
|
}
|
|
4294
|
-
},
|
|
4175
|
+
}, en = class {
|
|
4295
4176
|
tokens;
|
|
4296
4177
|
current = 0;
|
|
4297
4178
|
constructor(e) {
|
|
@@ -4302,7 +4183,7 @@ var tn = /* @__PURE__ */ new Set([
|
|
|
4302
4183
|
let e = this.tokens[this.current];
|
|
4303
4184
|
return this.current++, e;
|
|
4304
4185
|
}
|
|
4305
|
-
},
|
|
4186
|
+
}, tn = {
|
|
4306
4187
|
amp: "&",
|
|
4307
4188
|
lt: "<",
|
|
4308
4189
|
gt: ">",
|
|
@@ -4445,7 +4326,7 @@ var tn = /* @__PURE__ */ new Set([
|
|
|
4445
4326
|
psi: "ψ",
|
|
4446
4327
|
omega: "ω"
|
|
4447
4328
|
};
|
|
4448
|
-
function
|
|
4329
|
+
function nn(e) {
|
|
4449
4330
|
return !e || !e.includes("&") ? e : e.replace(/&(?:#(\d+)|#x([0-9a-fA-F]+)|([a-zA-Z0-9]+));/g, (e, t, n, r) => {
|
|
4450
4331
|
if (t) {
|
|
4451
4332
|
let e = parseInt(t, 10);
|
|
@@ -4463,14 +4344,14 @@ function sn(e) {
|
|
|
4463
4344
|
return "�";
|
|
4464
4345
|
}
|
|
4465
4346
|
}
|
|
4466
|
-
return r &&
|
|
4347
|
+
return r && tn[r] || e;
|
|
4467
4348
|
});
|
|
4468
4349
|
}
|
|
4469
|
-
var
|
|
4350
|
+
var rn = class {
|
|
4470
4351
|
tokenSource;
|
|
4471
4352
|
lookahead = [];
|
|
4472
4353
|
constructor(e) {
|
|
4473
|
-
this.tokenSource = Array.isArray(e) ? new
|
|
4354
|
+
this.tokenSource = Array.isArray(e) ? new en(e) : e;
|
|
4474
4355
|
}
|
|
4475
4356
|
parse() {
|
|
4476
4357
|
return this.lookahead.length = 0, this.parseProgram();
|
|
@@ -4504,9 +4385,10 @@ var cn = class {
|
|
|
4504
4385
|
if (e.type === U.DirectiveIf) return this.parseIfDirective();
|
|
4505
4386
|
if (e.type === U.DirectiveFor) return this.parseForDirective();
|
|
4506
4387
|
if (e.type === U.DirectiveSwitch) return this.parseSwitchDirective();
|
|
4388
|
+
if (e.type === U.DirectiveAsync) return this.parseAsyncDirective();
|
|
4507
4389
|
if (e.type === U.Text) return this.advance(), {
|
|
4508
4390
|
type: K.Text,
|
|
4509
|
-
content:
|
|
4391
|
+
content: nn(e.value),
|
|
4510
4392
|
loc: e.loc
|
|
4511
4393
|
};
|
|
4512
4394
|
throw e.type === U.TagOpenSlash ? new J(`Unexpected closing tag '</${this.peek(1).value}>' without opening tag`, e.loc.start.line, e.loc.start.column, e.loc.start.offset) : new J(`Unexpected token '${e.value}' of type '${e.type}'`, e.loc.start.line, e.loc.start.column, e.loc.start.offset);
|
|
@@ -4573,7 +4455,7 @@ var cn = class {
|
|
|
4573
4455
|
if (e.type === U.StringLiteral) return this.advance(), {
|
|
4574
4456
|
type: K.Attribute,
|
|
4575
4457
|
name: n,
|
|
4576
|
-
value:
|
|
4458
|
+
value: nn(e.value),
|
|
4577
4459
|
loc: {
|
|
4578
4460
|
start: t,
|
|
4579
4461
|
end: e.loc.end
|
|
@@ -4655,68 +4537,83 @@ var cn = class {
|
|
|
4655
4537
|
};
|
|
4656
4538
|
}
|
|
4657
4539
|
parseForDirective() {
|
|
4658
|
-
let e = this.consume(U.DirectiveFor, "Expected @for directive"),
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
for (; n >= 0 && /\s/.test(e[n]);) n--;
|
|
4666
|
-
if (n < 0 || e[n] !== ".") return !0;
|
|
4667
|
-
}
|
|
4668
|
-
}
|
|
4669
|
-
});
|
|
4670
|
-
}
|
|
4671
|
-
function s(e) {
|
|
4672
|
-
return r(e, ",");
|
|
4540
|
+
let e = this.consume(U.DirectiveFor, "Expected @for directive"), n = e.loc.start, r = e.value.trim();
|
|
4541
|
+
for (; t(r);) r = r.slice(1, -1).trim();
|
|
4542
|
+
let i = "", a = null, o = "", s = null, c = null;
|
|
4543
|
+
try {
|
|
4544
|
+
c = V(r, 0, { ecmaVersion: "latest" });
|
|
4545
|
+
} catch {
|
|
4546
|
+
c = null;
|
|
4673
4547
|
}
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
if (
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4548
|
+
if (c && c.type === "BinaryExpression" && c.operator === "in") {
|
|
4549
|
+
if (c.left.type === "SequenceExpression") {
|
|
4550
|
+
let t = c.left.expressions;
|
|
4551
|
+
if (t.length < 1 || t.length > 2) throw new J("Invalid @for target bindings. Expected at most 2 variables (item, index).", e.loc.start.line, e.loc.start.column, e.loc.start.offset);
|
|
4552
|
+
i = r.slice(t[0].start, t[0].end).trim(), a = t.length === 2 ? r.slice(t[1].start, t[1].end).trim() : null;
|
|
4553
|
+
} else i = r.slice(c.left.start, c.left.end).trim();
|
|
4554
|
+
o = r.slice(c.right.start, c.right.end).trim();
|
|
4555
|
+
let t = r.slice(c.end).trim();
|
|
4556
|
+
if (t.length > 0) if (t.startsWith("key ") || t.startsWith("key ") || t.startsWith("key\n")) {
|
|
4557
|
+
let n = t.slice(3).trim();
|
|
4558
|
+
try {
|
|
4559
|
+
let e = V(n, 0, { ecmaVersion: "latest" });
|
|
4560
|
+
s = n.slice(0, e.end).trim();
|
|
4561
|
+
} catch {
|
|
4562
|
+
throw new J(`Invalid key expression in @for directive: '${n}'`, e.loc.start.line, e.loc.start.column, e.loc.start.offset);
|
|
4684
4563
|
}
|
|
4685
|
-
}
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4564
|
+
} else throw new J(`Unexpected token '${t}' in @for header. Expected 'key <expression>' or block opening '{'.`, e.loc.start.line, e.loc.start.column, e.loc.start.offset);
|
|
4565
|
+
} else {
|
|
4566
|
+
let n = -1, c = null;
|
|
4567
|
+
for (let e = 0; e < r.length - 1; e++) if (r[e] === "i" && r[e + 1] === "n") {
|
|
4568
|
+
let t = e === 0 || !/[a-zA-Z0-9_$]/.test(r[e - 1]), i = e + 2 >= r.length || !/[a-zA-Z0-9_$]/.test(r[e + 2]);
|
|
4569
|
+
if (t && i) {
|
|
4570
|
+
let t = r.slice(0, e).trim(), i = t.startsWith("(") && t.endsWith(")") ? t : `(${t})`;
|
|
4571
|
+
try {
|
|
4572
|
+
let t = V(`${i} => {}`, 0, { ecmaVersion: "latest" });
|
|
4573
|
+
if (t && t.type === "ArrowFunctionExpression") {
|
|
4574
|
+
n = e, c = t.params;
|
|
4575
|
+
break;
|
|
4576
|
+
}
|
|
4577
|
+
} catch {}
|
|
4578
|
+
}
|
|
4579
|
+
}
|
|
4580
|
+
if (n === -1 || !c) throw new J(`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);
|
|
4581
|
+
let l = r.slice(0, n).trim(), u = r.slice(n + 2).trim();
|
|
4582
|
+
if (c.length === 1) {
|
|
4583
|
+
let e = l;
|
|
4584
|
+
for (; t(e);) e = e.slice(1, -1).trim();
|
|
4585
|
+
i = e;
|
|
4586
|
+
} else if (c.length === 2) {
|
|
4587
|
+
let e = l;
|
|
4588
|
+
for (; t(e);) e = e.slice(1, -1).trim();
|
|
4589
|
+
let n = e.lastIndexOf(",");
|
|
4590
|
+
i = e.slice(0, n).trim(), a = e.slice(n + 1).trim();
|
|
4591
|
+
} else throw new J("Invalid @for target bindings. Expected at most 2 variables (item, index).", e.loc.start.line, e.loc.start.column, e.loc.start.offset);
|
|
4592
|
+
try {
|
|
4593
|
+
let t = V(u, 0, { ecmaVersion: "latest" });
|
|
4594
|
+
o = u.slice(0, t.end).trim();
|
|
4595
|
+
let n = u.slice(t.end).trim();
|
|
4596
|
+
if (n.length > 0) if (n.startsWith("key ") || n.startsWith("key ") || n.startsWith("key\n")) {
|
|
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);
|
|
4602
|
+
}
|
|
4705
4603
|
}
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
let y = this.consume(U.BlockClose, "Expected closing brace } for @for block");
|
|
4604
|
+
let l = [];
|
|
4605
|
+
for (; !this.check(U.BlockClose) && !this.isAtEnd();) l.push(this.parseChild());
|
|
4606
|
+
let u = this.consume(U.BlockClose, "Expected closing brace } for @for block");
|
|
4710
4607
|
return {
|
|
4711
4608
|
type: K.For,
|
|
4712
|
-
item:
|
|
4713
|
-
index:
|
|
4714
|
-
iterable:
|
|
4715
|
-
key:
|
|
4716
|
-
body:
|
|
4609
|
+
item: i,
|
|
4610
|
+
index: a,
|
|
4611
|
+
iterable: o,
|
|
4612
|
+
key: s,
|
|
4613
|
+
body: l,
|
|
4717
4614
|
loc: {
|
|
4718
|
-
start:
|
|
4719
|
-
end:
|
|
4615
|
+
start: n,
|
|
4616
|
+
end: u.loc.end
|
|
4720
4617
|
}
|
|
4721
4618
|
};
|
|
4722
4619
|
}
|
|
@@ -4761,6 +4658,62 @@ var cn = class {
|
|
|
4761
4658
|
}
|
|
4762
4659
|
};
|
|
4763
4660
|
}
|
|
4661
|
+
parseAsyncDirective() {
|
|
4662
|
+
let e = this.consume(U.DirectiveAsync, "Expected @async directive"), n = e.loc.start, r = e.value.trim();
|
|
4663
|
+
for (; t(r);) r = r.slice(1, -1).trim();
|
|
4664
|
+
let i = null;
|
|
4665
|
+
try {
|
|
4666
|
+
i = V(r, 0, { ecmaVersion: "latest" });
|
|
4667
|
+
} catch {
|
|
4668
|
+
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);
|
|
4669
|
+
}
|
|
4670
|
+
let a = r.slice(0, i.end).trim(), o = r.slice(i.end).trim(), s = "data";
|
|
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);
|
|
4674
|
+
let c = [];
|
|
4675
|
+
for (; !this.check(U.BlockClose) && !this.isAtEnd();) c.push(this.parseChild());
|
|
4676
|
+
let l = this.consume(U.BlockClose, "Expected closing brace } for @async block"), u = null, d = null;
|
|
4677
|
+
for (; !this.isAtEnd();) if (this.skipWhitespaceTokens(), this.check(U.DirectiveFallback)) {
|
|
4678
|
+
if (u !== null) {
|
|
4679
|
+
let e = this.peek();
|
|
4680
|
+
throw new J("Duplicate @fallback directive for @async block", e.loc.start.line, e.loc.start.column, e.loc.start.offset);
|
|
4681
|
+
}
|
|
4682
|
+
this.consume(U.DirectiveFallback, "Expected @fallback directive");
|
|
4683
|
+
let e = [];
|
|
4684
|
+
for (; !this.check(U.BlockClose) && !this.isAtEnd();) e.push(this.parseChild());
|
|
4685
|
+
l = this.consume(U.BlockClose, "Expected closing brace } for @fallback block"), u = e;
|
|
4686
|
+
} else if (this.check(U.DirectiveCatch)) {
|
|
4687
|
+
if (d !== null) {
|
|
4688
|
+
let e = this.peek();
|
|
4689
|
+
throw new J("Duplicate @catch directive for @async block", e.loc.start.line, e.loc.start.column, e.loc.start.offset);
|
|
4690
|
+
}
|
|
4691
|
+
let e = this.consume(U.DirectiveCatch, "Expected @catch directive"), n = e.value.trim() || "error";
|
|
4692
|
+
for (; t(n);) n = n.slice(1, -1).trim();
|
|
4693
|
+
let r = [];
|
|
4694
|
+
for (; !this.check(U.BlockClose) && !this.isAtEnd();) r.push(this.parseChild());
|
|
4695
|
+
l = this.consume(U.BlockClose, "Expected closing brace } for @catch block"), d = {
|
|
4696
|
+
errorVar: n,
|
|
4697
|
+
body: r,
|
|
4698
|
+
loc: {
|
|
4699
|
+
start: e.loc.start,
|
|
4700
|
+
end: l.loc.end
|
|
4701
|
+
}
|
|
4702
|
+
};
|
|
4703
|
+
} else break;
|
|
4704
|
+
return {
|
|
4705
|
+
type: K.Async,
|
|
4706
|
+
promise: a,
|
|
4707
|
+
alias: s,
|
|
4708
|
+
body: c,
|
|
4709
|
+
fallback: u,
|
|
4710
|
+
catchBranch: d,
|
|
4711
|
+
loc: {
|
|
4712
|
+
start: n,
|
|
4713
|
+
end: l.loc.end
|
|
4714
|
+
}
|
|
4715
|
+
};
|
|
4716
|
+
}
|
|
4764
4717
|
skipWhitespaceTokens() {
|
|
4765
4718
|
for (; this.check(U.Text) && this.peek().value.trim().length === 0;) this.advance();
|
|
4766
4719
|
}
|
|
@@ -4792,7 +4745,7 @@ var cn = class {
|
|
|
4792
4745
|
}
|
|
4793
4746
|
}
|
|
4794
4747
|
};
|
|
4795
|
-
function
|
|
4748
|
+
function an(e, t) {
|
|
4796
4749
|
function n(e, t) {
|
|
4797
4750
|
let n = [];
|
|
4798
4751
|
for (let i of e) {
|
|
@@ -4875,6 +4828,19 @@ function ln(e, t) {
|
|
|
4875
4828
|
};
|
|
4876
4829
|
}
|
|
4877
4830
|
break;
|
|
4831
|
+
case K.Async: {
|
|
4832
|
+
let e = n(a.body, a), t = a.fallback ? n(a.fallback, a) : null, r = a.catchBranch;
|
|
4833
|
+
a.catchBranch && (r = {
|
|
4834
|
+
...a.catchBranch,
|
|
4835
|
+
body: n(a.catchBranch.body, a)
|
|
4836
|
+
}), a = {
|
|
4837
|
+
...a,
|
|
4838
|
+
body: e,
|
|
4839
|
+
fallback: t,
|
|
4840
|
+
catchBranch: r
|
|
4841
|
+
};
|
|
4842
|
+
break;
|
|
4843
|
+
}
|
|
4878
4844
|
}
|
|
4879
4845
|
if (t.leave) {
|
|
4880
4846
|
let e = t.leave(a, i);
|
|
@@ -4884,14 +4850,14 @@ function ln(e, t) {
|
|
|
4884
4850
|
}
|
|
4885
4851
|
return r(e, null);
|
|
4886
4852
|
}
|
|
4887
|
-
var
|
|
4853
|
+
var on = class {
|
|
4888
4854
|
rawAst;
|
|
4889
4855
|
switchCounter = 0;
|
|
4890
4856
|
constructor(e) {
|
|
4891
4857
|
this.rawAst = e;
|
|
4892
4858
|
}
|
|
4893
4859
|
transform() {
|
|
4894
|
-
return
|
|
4860
|
+
return an(an(an(this.rawAst, { Text: (e) => {
|
|
4895
4861
|
if (typeof e.content == "string" && this.isWhitespaceOnly(e.content)) return null;
|
|
4896
4862
|
} }), { Switch: (e) => this.transformSwitchToIfChain(e) }), {
|
|
4897
4863
|
Interpolation: (e) => this.transformInterpolation(e),
|
|
@@ -4908,18 +4874,22 @@ var un = class {
|
|
|
4908
4874
|
If: (e) => {
|
|
4909
4875
|
if (typeof e.test == "string" && e.test.trim().length > 0) return {
|
|
4910
4876
|
...e,
|
|
4911
|
-
test:
|
|
4877
|
+
test: V(e.test, 0, { ecmaVersion: "latest" })
|
|
4912
4878
|
};
|
|
4913
4879
|
},
|
|
4914
4880
|
For: (e) => ({
|
|
4915
4881
|
...e,
|
|
4916
|
-
iterable: typeof e.iterable == "string" ?
|
|
4917
|
-
key: typeof e.key == "string" && e.key.trim().length > 0 ?
|
|
4882
|
+
iterable: typeof e.iterable == "string" ? V(e.iterable, 0, { ecmaVersion: "latest" }) : e.iterable,
|
|
4883
|
+
key: typeof e.key == "string" && e.key.trim().length > 0 ? V(e.key, 0, { ecmaVersion: "latest" }) : e.key ?? null
|
|
4884
|
+
}),
|
|
4885
|
+
Async: (e) => ({
|
|
4886
|
+
...e,
|
|
4887
|
+
promise: typeof e.promise == "string" && e.promise.trim().length > 0 ? V(e.promise, 0, { ecmaVersion: "latest" }) : e.promise
|
|
4918
4888
|
})
|
|
4919
4889
|
});
|
|
4920
4890
|
}
|
|
4921
4891
|
transformSwitchToIfChain(e) {
|
|
4922
|
-
let t = typeof e.discriminant == "string" ?
|
|
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) => {
|
|
4923
4893
|
let s = e.cases[o];
|
|
4924
4894
|
if (!s) return null;
|
|
4925
4895
|
if (s.expression === null) {
|
|
@@ -4938,7 +4908,7 @@ var un = class {
|
|
|
4938
4908
|
loc: s.loc
|
|
4939
4909
|
};
|
|
4940
4910
|
}
|
|
4941
|
-
let c = typeof s.expression == "string" && s.expression.trim().length > 0 ?
|
|
4911
|
+
let c = typeof s.expression == "string" && s.expression.trim().length > 0 ? V(s.expression, 0, { ecmaVersion: "latest" }) : s.expression, l;
|
|
4942
4912
|
n ? l = structuredClone(t) : i ? (i = !1, l = {
|
|
4943
4913
|
type: "AssignmentExpression",
|
|
4944
4914
|
operator: "=",
|
|
@@ -5000,7 +4970,7 @@ var un = class {
|
|
|
5000
4970
|
if (typeof e.expression != "string") return e;
|
|
5001
4971
|
let t;
|
|
5002
4972
|
try {
|
|
5003
|
-
t =
|
|
4973
|
+
t = V(e.expression, 0, {
|
|
5004
4974
|
ecmaVersion: "latest",
|
|
5005
4975
|
allowAwaitOutsideFunction: !0
|
|
5006
4976
|
});
|
|
@@ -5017,7 +4987,7 @@ var un = class {
|
|
|
5017
4987
|
if (e.type === K.Text && typeof e.content == "string") {
|
|
5018
4988
|
let t;
|
|
5019
4989
|
try {
|
|
5020
|
-
let n =
|
|
4990
|
+
let n = Wt(e.content, {
|
|
5021
4991
|
ecmaVersion: "latest",
|
|
5022
4992
|
sourceType: "module",
|
|
5023
4993
|
allowAwaitOutsideFunction: !0,
|
|
@@ -5042,7 +5012,7 @@ var un = class {
|
|
|
5042
5012
|
isWhitespaceOnly(e) {
|
|
5043
5013
|
return e.length > 0 && /^\s*$/.test(e);
|
|
5044
5014
|
}
|
|
5045
|
-
},
|
|
5015
|
+
}, sn = class {
|
|
5046
5016
|
ast;
|
|
5047
5017
|
bytecode = [];
|
|
5048
5018
|
constants = [];
|
|
@@ -5108,6 +5078,9 @@ var un = class {
|
|
|
5108
5078
|
case K.For:
|
|
5109
5079
|
this.compileForNode(e, t);
|
|
5110
5080
|
break;
|
|
5081
|
+
case K.Async:
|
|
5082
|
+
this.compileAsyncNode(e, t);
|
|
5083
|
+
break;
|
|
5111
5084
|
}
|
|
5112
5085
|
}
|
|
5113
5086
|
filterRuntimeScriptAst(e) {
|
|
@@ -5133,7 +5106,7 @@ var un = class {
|
|
|
5133
5106
|
for (let t of e.children) if (t.type === K.Text && typeof t.content == "object" && t.content !== null) {
|
|
5134
5107
|
let e = this.filterRuntimeScriptAst(t.content);
|
|
5135
5108
|
if (e !== null && (!Array.isArray(e) || e.length > 0)) {
|
|
5136
|
-
let t = this.
|
|
5109
|
+
let t = this.addScriptConstant(e);
|
|
5137
5110
|
this.emit(Y.EXEC_SCRIPT, t);
|
|
5138
5111
|
}
|
|
5139
5112
|
}
|
|
@@ -5154,7 +5127,7 @@ var un = class {
|
|
|
5154
5127
|
let e = t.value.expression;
|
|
5155
5128
|
if (e && typeof e == "object" && e.type) {
|
|
5156
5129
|
let r = $(e);
|
|
5157
|
-
n[t.name] = { __drift_fn__: `(scope, declaredVars, setScopeValue, inScopeChain, resolveIterable,
|
|
5130
|
+
n[t.name] = { __drift_fn__: `(scope, declaredVars, setScopeValue, inScopeChain, resolveIterable, getScopeValue) => (${r})` };
|
|
5158
5131
|
} else n[t.name] = e;
|
|
5159
5132
|
}
|
|
5160
5133
|
}
|
|
@@ -5186,7 +5159,7 @@ var un = class {
|
|
|
5186
5159
|
let r = this.addConstant(e.value);
|
|
5187
5160
|
this.emit(Y.SET_ATTR, t, n, r, 0);
|
|
5188
5161
|
} else if (e.value.type === K.Interpolation) {
|
|
5189
|
-
let r = this.
|
|
5162
|
+
let r = this.addExpressionConstant(e.value.expression), i = this.bytecode.length;
|
|
5190
5163
|
this.emit(Y.SET_ATTR, t, n, r, 1), this.emit(Y.RETURN), this.recordBindingPositions(e.value.expression, i);
|
|
5191
5164
|
}
|
|
5192
5165
|
}
|
|
@@ -5195,7 +5168,7 @@ var un = class {
|
|
|
5195
5168
|
this.emit(Y.CREATE_TEXT, n, r), this.emit(Y.APPEND_CHILD, t, n);
|
|
5196
5169
|
}
|
|
5197
5170
|
compileInterpolationNode(e, t) {
|
|
5198
|
-
let n = this.allocRegister(), r = this.
|
|
5171
|
+
let n = this.allocRegister(), r = this.addExpressionConstant(e.expression), i = this.bytecode.length;
|
|
5199
5172
|
this.emit(Y.INTERPOLATE_TEXT, n, r), this.emit(Y.RETURN), this.emit(Y.APPEND_CHILD, t, n), this.recordBindingPositions(e.expression, i);
|
|
5200
5173
|
}
|
|
5201
5174
|
compileCommentNode(e, t) {
|
|
@@ -5234,12 +5207,32 @@ var un = class {
|
|
|
5234
5207
|
n.constants && !n.constants.some((e) => Array.isArray(e)) && n.constants.push(t);
|
|
5235
5208
|
}
|
|
5236
5209
|
if (a) for (let e of this.collectDepsFromSubModule(a)) o.add(e);
|
|
5237
|
-
let s = this.addConstant(Array.from(o)), c = this.
|
|
5210
|
+
let s = this.addConstant(Array.from(o)), c = this.addExpressionConstant(e.test);
|
|
5238
5211
|
this.emit(Y.REACTIVE_IF, t, c, r, i, s);
|
|
5239
5212
|
}
|
|
5240
5213
|
compileForNode(e, t) {
|
|
5241
|
-
let n = this.compileNodesToSubModule(e.body), r = this.addConstant(n), i = this.
|
|
5242
|
-
this.
|
|
5214
|
+
let n = this.compileNodesToSubModule(e.body), r = this.addConstant(n), i = this.addExpressionConstant(e.iterable), a = this.addConstant(e.item), o = e.index === null ? 255 : this.addConstant(e.index), s = e.key ? this.addExpressionConstant(e.key) : 255, c = /* @__PURE__ */ new Set();
|
|
5215
|
+
for (let t of this.extractIdentifiers(e.iterable)) this.declaredVars.has(t) && c.add(t);
|
|
5216
|
+
if (e.key) for (let t of this.extractIdentifiers(e.key)) this.declaredVars.has(t) && c.add(t);
|
|
5217
|
+
let l = this.addConstant([...c]), u = /* @__PURE__ */ new Set();
|
|
5218
|
+
for (let e of n.reactiveBindings) c.has(e.variable) || u.add(e.variable);
|
|
5219
|
+
let d = this.addConstant([...u]), f = [...c, ...u], p = this.addConstant(f);
|
|
5220
|
+
this.emit(Y.REACTIVE_FOR, t, i, a, o, s, r, p, l, d);
|
|
5221
|
+
}
|
|
5222
|
+
compileAsyncNode(e, t) {
|
|
5223
|
+
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;
|
|
5224
|
+
if (e.catchBranch) {
|
|
5225
|
+
let t = this.compileNodesToSubModule(e.catchBranch.body);
|
|
5226
|
+
o = this.addConstant({
|
|
5227
|
+
errorVar: e.catchBranch.errorVar,
|
|
5228
|
+
module: t
|
|
5229
|
+
});
|
|
5230
|
+
}
|
|
5231
|
+
let s = this.addExpressionConstant(e.promise), c = this.addConstant(e.alias), l = /* @__PURE__ */ new Set();
|
|
5232
|
+
for (let t of this.collectDepsFromSubModule(n, e.promise)) l.add(t);
|
|
5233
|
+
if (i) for (let e of this.collectDepsFromSubModule(i)) l.add(e);
|
|
5234
|
+
let u = this.addConstant(Array.from(l));
|
|
5235
|
+
this.emit(Y.REACTIVE_ASYNC, t, s, c, r, a, o, u);
|
|
5243
5236
|
}
|
|
5244
5237
|
collectDeclaredVars(e) {
|
|
5245
5238
|
for (let t of e) if (t.type === K.Element && t.tagName === "script") {
|
|
@@ -5289,7 +5282,7 @@ var un = class {
|
|
|
5289
5282
|
let { name: t, arg: n } = e, r = n, i = !1;
|
|
5290
5283
|
(n.type === "ArrowFunctionExpression" || n.type === "FunctionExpression") && (n.body?.type === "BlockStatement" && (i = !0), r = n.body);
|
|
5291
5284
|
let a = [...this.extractIdentifiers(r)].filter((e) => e !== t && this.declaredVars.has(e)), o = $(r), s;
|
|
5292
|
-
s = i ? { __drift_fn__: `(scope, declaredVars, setScopeValue, inScopeChain, resolveIterable,
|
|
5285
|
+
s = i ? { __drift_fn__: `(scope, declaredVars, setScopeValue, inScopeChain, resolveIterable, getScopeValue) => ${o}` } : { __drift_fn__: `(scope, declaredVars, setScopeValue, inScopeChain, resolveIterable, getScopeValue) => (${o})` };
|
|
5293
5286
|
let c = this.addConstant(s);
|
|
5294
5287
|
this.derivedBindings.push({
|
|
5295
5288
|
name: t,
|
|
@@ -5303,7 +5296,7 @@ var un = class {
|
|
|
5303
5296
|
let { arg: t } = e, n = t, r = !1, i = !!t?.async;
|
|
5304
5297
|
(t.type === "ArrowFunctionExpression" || t.type === "FunctionExpression") && (t.body?.type === "BlockStatement" && (r = !0), n = t.body);
|
|
5305
5298
|
let a = [...this.extractIdentifiers(n)].filter((e) => this.declaredVars.has(e)), o = $(n), s = i ? "async " : "", c;
|
|
5306
|
-
c = r ? { __drift_fn__: `${s}(scope, declaredVars, setScopeValue, inScopeChain, resolveIterable,
|
|
5299
|
+
c = r ? { __drift_fn__: `${s}(scope, declaredVars, setScopeValue, inScopeChain, resolveIterable, getScopeValue) => ${o}` } : { __drift_fn__: `${s}(scope, declaredVars, setScopeValue, inScopeChain, resolveIterable, getScopeValue) => (${o})` };
|
|
5307
5300
|
let l = this.addConstant(c);
|
|
5308
5301
|
this.effectBindings.push({
|
|
5309
5302
|
deps: a,
|
|
@@ -5315,7 +5308,7 @@ var un = class {
|
|
|
5315
5308
|
let t = /* @__PURE__ */ new Set();
|
|
5316
5309
|
if (!e || typeof e != "object") return t;
|
|
5317
5310
|
try {
|
|
5318
|
-
|
|
5311
|
+
Gt(e, { Identifier(e, n) {
|
|
5319
5312
|
let r = n[n.length - 2];
|
|
5320
5313
|
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);
|
|
5321
5314
|
} });
|
|
@@ -5338,8 +5331,20 @@ var un = class {
|
|
|
5338
5331
|
allocRegister() {
|
|
5339
5332
|
return this.nextRegisterId++;
|
|
5340
5333
|
}
|
|
5334
|
+
addExpressionConstant(e) {
|
|
5335
|
+
let t = $(e), n = [];
|
|
5336
|
+
for (let t of this.extractIdentifiers(e)) this.declaredVars.has(t) && n.push(t);
|
|
5337
|
+
let r = {
|
|
5338
|
+
__drift_fn__: `(scope, declaredVars, setScopeValue, inScopeChain, resolveIterable, getScopeValue) => (${t})`,
|
|
5339
|
+
deps: n
|
|
5340
|
+
};
|
|
5341
|
+
return this.addConstant(r);
|
|
5342
|
+
}
|
|
5343
|
+
addScriptConstant(e) {
|
|
5344
|
+
let t = { __drift_fn__: `(scope, declaredVars, setScopeValue, inScopeChain, resolveIterable, getScopeValue) => { ${$(e)}; }` };
|
|
5345
|
+
return this.addConstant(t);
|
|
5346
|
+
}
|
|
5341
5347
|
addConstant(e) {
|
|
5342
|
-
e && typeof e == "object" && e.type && typeof e.type == "string" ? e = { __drift_fn__: `(scope, declaredVars, setScopeValue, inScopeChain, resolveIterable, _get) => (${$(e)})` } : Array.isArray(e) && e.length > 0 && typeof e[0] == "object" && e[0]?.type && (e = { __drift_fn__: `(scope, declaredVars, setScopeValue, inScopeChain, resolveIterable, _get) => { ${$(e)}; }` });
|
|
5343
5348
|
let t = this.constants.findIndex((t) => this.isConstantEqual(t, e));
|
|
5344
5349
|
return t === -1 ? (this.constants.push(e), this.constants.length - 1) : t;
|
|
5345
5350
|
}
|
|
@@ -5350,8 +5355,8 @@ var un = class {
|
|
|
5350
5355
|
this.bytecode.push(e, ...t);
|
|
5351
5356
|
}
|
|
5352
5357
|
};
|
|
5353
|
-
function
|
|
5354
|
-
return !e || typeof e != "object" ? null : e.type === "Identifier" ? e.name : e.type === "MemberExpression" ?
|
|
5358
|
+
function cn(e) {
|
|
5359
|
+
return !e || typeof e != "object" ? null : e.type === "Identifier" ? e.name : e.type === "MemberExpression" ? cn(e.object) : null;
|
|
5355
5360
|
}
|
|
5356
5361
|
function X(e) {
|
|
5357
5362
|
let t = [];
|
|
@@ -5387,7 +5392,7 @@ function Z(e, t) {
|
|
|
5387
5392
|
function Q(e, t, n) {
|
|
5388
5393
|
return n && n.has(e) ? `(${e} = ${t})` : `(typeof setScopeValue === 'function' && scope ? setScopeValue(scope, ${JSON.stringify(e)}, ${t}) : ((scope || {})[${JSON.stringify(e)}] = ${t}))`;
|
|
5389
5394
|
}
|
|
5390
|
-
function
|
|
5395
|
+
function ln(e, t, n, r = { count: 0 }) {
|
|
5391
5396
|
let i = [];
|
|
5392
5397
|
if (!e) return i;
|
|
5393
5398
|
if (e.type === "Identifier") return i.push(Q(e.name, t, n)), i;
|
|
@@ -5396,7 +5401,7 @@ function pn(e, t, n, r = { count: 0 }) {
|
|
|
5396
5401
|
if (e.left?.type === "Identifier") i.push(Q(e.left.name, a, n));
|
|
5397
5402
|
else {
|
|
5398
5403
|
let t = `_t${r.count++}`;
|
|
5399
|
-
i.push(`const ${t} = ${a}`), i.push(...
|
|
5404
|
+
i.push(`const ${t} = ${a}`), i.push(...ln(e.left, t, n, r));
|
|
5400
5405
|
}
|
|
5401
5406
|
return i;
|
|
5402
5407
|
}
|
|
@@ -5411,11 +5416,11 @@ function pn(e, t, n, r = { count: 0 }) {
|
|
|
5411
5416
|
if (a.value.left?.type === "Identifier") i.push(Q(a.value.left.name, o, n));
|
|
5412
5417
|
else {
|
|
5413
5418
|
let e = `_t${r.count++}`;
|
|
5414
|
-
i.push(`const ${e} = ${o}`), i.push(...
|
|
5419
|
+
i.push(`const ${e} = ${o}`), i.push(...ln(a.value.left, e, n, r));
|
|
5415
5420
|
}
|
|
5416
5421
|
} else if (a.value?.type === "ObjectPattern" || a.value?.type === "ArrayPattern") {
|
|
5417
5422
|
let o = `_t${r.count++}`, s = `(${t} ? ${t}[${e}] : undefined)`;
|
|
5418
|
-
i.push(`const ${o} = ${s}`), i.push(...
|
|
5423
|
+
i.push(`const ${o} = ${s}`), i.push(...ln(a.value, o, n, r));
|
|
5419
5424
|
} else {
|
|
5420
5425
|
let r = a.value?.name || $(a.value, n);
|
|
5421
5426
|
if (r) {
|
|
@@ -5447,7 +5452,7 @@ function pn(e, t, n, r = { count: 0 }) {
|
|
|
5447
5452
|
if (t.left?.type === "Identifier") i.push(Q(t.left.name, s, n));
|
|
5448
5453
|
else {
|
|
5449
5454
|
let e = `_t${r.count++}`;
|
|
5450
|
-
i.push(`const ${e} = ${s}`), i.push(...
|
|
5455
|
+
i.push(`const ${e} = ${s}`), i.push(...ln(t.left, e, n, r));
|
|
5451
5456
|
}
|
|
5452
5457
|
} else if (t.type === "RestElement") {
|
|
5453
5458
|
let r = t.argument?.name || $(t.argument, n);
|
|
@@ -5457,7 +5462,7 @@ function pn(e, t, n, r = { count: 0 }) {
|
|
|
5457
5462
|
}
|
|
5458
5463
|
} else if (t.type === "ObjectPattern" || t.type === "ArrayPattern") {
|
|
5459
5464
|
let o = `_t${r.count++}`, s = `(${a} ? ${a}[${e}] : undefined)`;
|
|
5460
|
-
i.push(`const ${o} = ${s}`), i.push(...
|
|
5465
|
+
i.push(`const ${o} = ${s}`), i.push(...ln(t, o, n, r));
|
|
5461
5466
|
}
|
|
5462
5467
|
}
|
|
5463
5468
|
}
|
|
@@ -5470,7 +5475,7 @@ function $(e, t) {
|
|
|
5470
5475
|
if (typeof e != "object") return typeof e == "string" ? JSON.stringify(e) : String(e);
|
|
5471
5476
|
if (Array.isArray(e)) return e.map((e) => $(e, t)).join("; ");
|
|
5472
5477
|
switch (e.type) {
|
|
5473
|
-
case "Identifier": return t && t.has(e.name) ? e.name : `(typeof
|
|
5478
|
+
case "Identifier": return t && t.has(e.name) ? e.name : `(typeof getScopeValue === 'function' ? getScopeValue(scope, ${JSON.stringify(e.name)}) : (typeof inScopeChain === 'function' && inScopeChain(scope, ${JSON.stringify(e.name)}) ? scope[${JSON.stringify(e.name)}] : (typeof globalThis !== 'undefined' && globalThis && (${JSON.stringify(e.name)} in globalThis) ? globalThis[${JSON.stringify(e.name)}] : (scope || {})[${JSON.stringify(e.name)}])))`;
|
|
5474
5479
|
case "Literal": return typeof e.raw == "string" ? e.raw : typeof e.value == "string" ? JSON.stringify(e.value) : String(e.value);
|
|
5475
5480
|
case "BinaryExpression":
|
|
5476
5481
|
case "LogicalExpression": return `(${$(e.left, t)} ${e.operator} ${$(e.right, t)})`;
|
|
@@ -5485,7 +5490,7 @@ function $(e, t) {
|
|
|
5485
5490
|
case "CallExpression": {
|
|
5486
5491
|
let n = $(e.callee, t), r = e.arguments ? e.arguments.map((e) => $(e, t)).join(", ") : "", i = `(${n}${e.optional ? "?.(" : "("}${r}))`;
|
|
5487
5492
|
if (e.callee?.type === "MemberExpression" && e.callee.property?.type === "Identifier") {
|
|
5488
|
-
let n =
|
|
5493
|
+
let n = cn(e.callee.object), r = e.callee.property.name;
|
|
5489
5494
|
if (n && [
|
|
5490
5495
|
"push",
|
|
5491
5496
|
"pop",
|
|
@@ -5510,10 +5515,10 @@ function $(e, t) {
|
|
|
5510
5515
|
}
|
|
5511
5516
|
}
|
|
5512
5517
|
if (e.left?.type === "MemberExpression") {
|
|
5513
|
-
let r =
|
|
5518
|
+
let r = cn(e.left), i = `(${$(e.left, t)} ${e.operator} ${n})`;
|
|
5514
5519
|
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; })()`;
|
|
5515
5520
|
}
|
|
5516
|
-
return e.left?.type === "ObjectPattern" || e.left?.type === "ArrayPattern" ? `((_val) => { ${
|
|
5521
|
+
return e.left?.type === "ObjectPattern" || e.left?.type === "ArrayPattern" ? `((_val) => { ${ln(e.left, "_val", t).join("; ")}; return _val; })(${n})` : `(${$(e.left, t)} ${e.operator} ${n})`;
|
|
5517
5522
|
}
|
|
5518
5523
|
case "UpdateExpression":
|
|
5519
5524
|
if (e.argument?.type === "Identifier") {
|
|
@@ -5523,7 +5528,7 @@ function $(e, t) {
|
|
|
5523
5528
|
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; })()`;
|
|
5524
5529
|
}
|
|
5525
5530
|
if (e.argument?.type === "MemberExpression") {
|
|
5526
|
-
let n =
|
|
5531
|
+
let n = cn(e.argument), r = e.prefix ? `(${e.operator}${$(e.argument, t)})` : `(${$(e.argument, t)}${e.operator})`;
|
|
5527
5532
|
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; })()`;
|
|
5528
5533
|
}
|
|
5529
5534
|
return e.prefix ? `(${e.operator}${$(e.argument, t)})` : `(${$(e.argument, t)}${e.operator})`;
|
|
@@ -5643,7 +5648,7 @@ function $(e, t) {
|
|
|
5643
5648
|
}
|
|
5644
5649
|
let n = [];
|
|
5645
5650
|
if (e.declarations) for (let r of e.declarations) if (r.id?.type === "ObjectPattern" || r.id?.type === "ArrayPattern") {
|
|
5646
|
-
let e = r.init ? $(r.init, t) : "undefined", i =
|
|
5651
|
+
let e = r.init ? $(r.init, t) : "undefined", i = ln(r.id, "_init", t);
|
|
5647
5652
|
n.push(`((_init) => { ${i.join("; ")}; return _init; })(${e})`);
|
|
5648
5653
|
} else {
|
|
5649
5654
|
let e = r.id?.name || $(r.id, t), i = r.init ? $(r.init, t) : "undefined";
|
|
@@ -5712,13 +5717,13 @@ function $(e, t) {
|
|
|
5712
5717
|
default: return "";
|
|
5713
5718
|
}
|
|
5714
5719
|
}
|
|
5715
|
-
function
|
|
5716
|
-
let n = new
|
|
5720
|
+
function un(e, t = !1) {
|
|
5721
|
+
let n = new on(new rn(new $t(e)).parse()).transform(), r = new sn(n).generate();
|
|
5717
5722
|
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;
|
|
5718
5723
|
}
|
|
5719
5724
|
//#endregion
|
|
5720
5725
|
//#region src/index.ts
|
|
5721
|
-
function
|
|
5726
|
+
function dn(e) {
|
|
5722
5727
|
if (e == null) return String(e);
|
|
5723
5728
|
if (typeof e == "number") return Number.isNaN(e) ? "NaN" : e === Infinity ? "Infinity" : e === -Infinity ? "-Infinity" : Object.is(e, -0) ? "-0" : String(e);
|
|
5724
5729
|
if (typeof e == "bigint") return `${e.toString()}n`;
|
|
@@ -5728,15 +5733,15 @@ function hn(e) {
|
|
|
5728
5733
|
let t = e.__drift_fn__;
|
|
5729
5734
|
return `{ __drift_fn__: ${typeof t == "function" ? t.toString() : t} }`;
|
|
5730
5735
|
}
|
|
5731
|
-
return e instanceof RegExp ? e.toString() : e instanceof Date ? `new Date(${e.getTime()})` : e instanceof Set ? `new Set([${Array.from(e).map(
|
|
5736
|
+
return e instanceof RegExp ? e.toString() : e instanceof Date ? `new Date(${e.getTime()})` : e instanceof Set ? `new Set([${Array.from(e).map(dn).join(", ")}])` : e instanceof Map ? `new Map([${Array.from(e.entries()).map(([e, t]) => `[${dn(e)}, ${dn(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(dn).join(", ")}]` : `{ ${Object.entries(e).filter(([e]) => e !== "start" && e !== "end" && e !== "loc").map(([e, t]) => `${JSON.stringify(e)}: ${dn(t)}`).join(", ")} }`;
|
|
5732
5737
|
}
|
|
5733
5738
|
return JSON.stringify(e);
|
|
5734
5739
|
}
|
|
5735
|
-
function
|
|
5736
|
-
return `[\n ${e.map(
|
|
5740
|
+
function fn(e) {
|
|
5741
|
+
return `[\n ${e.map(dn).join(",\n ")}\n ]`;
|
|
5737
5742
|
}
|
|
5738
|
-
function
|
|
5739
|
-
let n = JSON.stringify(Array.from(e.bytecode)), r =
|
|
5743
|
+
function pn(e, t) {
|
|
5744
|
+
let n = JSON.stringify(Array.from(e.bytecode)), r = fn(e.constants), i = JSON.stringify(e.reactiveBindings ?? []), a = JSON.stringify(e.declaredVars ?? []), o = JSON.stringify(e.derived ?? []), s = JSON.stringify(e.effects ?? []), c = [], l = [];
|
|
5740
5745
|
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));
|
|
5741
5746
|
return `\
|
|
5742
5747
|
// [DriftJS] Auto-generated from: ${t}
|
|
@@ -5755,7 +5760,7 @@ const compiledModule = {
|
|
|
5755
5760
|
export default compiledModule;
|
|
5756
5761
|
`;
|
|
5757
5762
|
}
|
|
5758
|
-
function
|
|
5763
|
+
function mn(e = {}) {
|
|
5759
5764
|
let { debug: t = !1 } = e;
|
|
5760
5765
|
return {
|
|
5761
5766
|
name: "vite-plugin-drift",
|
|
@@ -5764,13 +5769,13 @@ function vn(e = {}) {
|
|
|
5764
5769
|
if (!(n.split("?")[0] ?? n).endsWith(".drift")) return null;
|
|
5765
5770
|
let r;
|
|
5766
5771
|
try {
|
|
5767
|
-
r =
|
|
5772
|
+
r = un(e, t);
|
|
5768
5773
|
} catch (e) {
|
|
5769
5774
|
let t = e instanceof Error ? e.message : String(e);
|
|
5770
5775
|
this.error(`[DriftJS] Compilation failed in "${n}":\n${t}`);
|
|
5771
5776
|
}
|
|
5772
5777
|
return {
|
|
5773
|
-
code:
|
|
5778
|
+
code: pn(r, n),
|
|
5774
5779
|
map: null
|
|
5775
5780
|
};
|
|
5776
5781
|
},
|
|
@@ -5786,4 +5791,4 @@ function vn(e = {}) {
|
|
|
5786
5791
|
};
|
|
5787
5792
|
}
|
|
5788
5793
|
//#endregion
|
|
5789
|
-
export {
|
|
5794
|
+
export { mn as default, mn as driftPlugin, fn as serializeConstants, dn as serializeValueToJS };
|