setupin 2.4.2 → 2.5.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/development/main.js +32567 -0
- package/dist/{main.js → production/main.js} +250 -263
- package/dist/production/svgs/logo.svg +18 -0
- package/dist/production/svgs/setup.vue.svg +1 -0
- package/dist/production/svgs/setupin.html.svg +1 -0
- package/package.json +14 -10
- /package/dist/{svgs → development/svgs}/logo.svg +0 -0
- /package/dist/{svgs → development/svgs}/setup.vue.svg +0 -0
- /package/dist/{svgs → development/svgs}/setupin.html.svg +0 -0
|
@@ -1,6 +1,53 @@
|
|
|
1
1
|
(function () {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
+
function discover(onPrior, onAfter) {
|
|
5
|
+
return new Promise((resolve) => {
|
|
6
|
+
const discovery = /* @__PURE__ */ Object.create(null);
|
|
7
|
+
const observer = new MutationObserver((mutations) => {
|
|
8
|
+
for (const mutation of mutations) {
|
|
9
|
+
mutation.addedNodes.forEach((node) => {
|
|
10
|
+
node instanceof Element && onPrior({ node, discovery, announce });
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
observer.observe(document, {
|
|
15
|
+
childList: true,
|
|
16
|
+
subtree: true
|
|
17
|
+
});
|
|
18
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
19
|
+
onAfter?.({ discovery, announce });
|
|
20
|
+
announce();
|
|
21
|
+
});
|
|
22
|
+
function announce() {
|
|
23
|
+
resolve(discovery);
|
|
24
|
+
observer.disconnect();
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function isElMatch(el, targetHtml) {
|
|
30
|
+
try {
|
|
31
|
+
const parse = new DOMParser();
|
|
32
|
+
const aimEl = parse.parseFromString(`<body>${targetHtml}</body>`, "text/html").body.firstElementChild;
|
|
33
|
+
const isTag = aimEl?.tagName === el.tagName;
|
|
34
|
+
const nodeAttrs = el.getAttributeNames();
|
|
35
|
+
const aimAttrs = aimEl?.getAttributeNames() ?? [];
|
|
36
|
+
const hasAttr = new Set(aimAttrs).isSubsetOf(new Set(nodeAttrs));
|
|
37
|
+
return isTag && hasAttr;
|
|
38
|
+
} catch {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function when(gist, verifyer = gist) {
|
|
44
|
+
return function(classify) {
|
|
45
|
+
const sym = Object.getOwnPropertySymbols(classify).find((sym2) => sym2.description === "default");
|
|
46
|
+
const handler = classify[verifyer] ?? (sym && classify[sym]);
|
|
47
|
+
return handler?.(gist);
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
4
51
|
var lib = {};
|
|
5
52
|
|
|
6
53
|
Object.defineProperty(lib, '__esModule', {
|
|
@@ -1219,6 +1266,9 @@
|
|
|
1219
1266
|
name: createToken("name", {
|
|
1220
1267
|
startsExpr
|
|
1221
1268
|
}),
|
|
1269
|
+
placeholder: createToken("%%", {
|
|
1270
|
+
startsExpr: true
|
|
1271
|
+
}),
|
|
1222
1272
|
string: createToken("string", {
|
|
1223
1273
|
startsExpr
|
|
1224
1274
|
}),
|
|
@@ -1245,22 +1295,19 @@
|
|
|
1245
1295
|
jsxTagStart: createToken("jsxTagStart", {
|
|
1246
1296
|
startsExpr: true
|
|
1247
1297
|
}),
|
|
1248
|
-
jsxTagEnd: createToken("jsxTagEnd")
|
|
1249
|
-
placeholder: createToken("%%", {
|
|
1250
|
-
startsExpr: true
|
|
1251
|
-
})
|
|
1298
|
+
jsxTagEnd: createToken("jsxTagEnd")
|
|
1252
1299
|
};
|
|
1253
1300
|
function tokenIsIdentifier(token) {
|
|
1254
|
-
return token >= 93 && token <=
|
|
1301
|
+
return token >= 93 && token <= 133;
|
|
1255
1302
|
}
|
|
1256
1303
|
function tokenKeywordOrIdentifierIsKeyword(token) {
|
|
1257
1304
|
return token <= 92;
|
|
1258
1305
|
}
|
|
1259
1306
|
function tokenIsKeywordOrIdentifier(token) {
|
|
1260
|
-
return token >= 58 && token <=
|
|
1307
|
+
return token >= 58 && token <= 133;
|
|
1261
1308
|
}
|
|
1262
1309
|
function tokenIsLiteralPropertyName(token) {
|
|
1263
|
-
return token >= 58 && token <=
|
|
1310
|
+
return token >= 58 && token <= 137;
|
|
1264
1311
|
}
|
|
1265
1312
|
function tokenComesBeforeExpression(token) {
|
|
1266
1313
|
return tokenBeforeExprs[token];
|
|
@@ -1324,7 +1371,7 @@
|
|
|
1324
1371
|
context.push(types.template);
|
|
1325
1372
|
}
|
|
1326
1373
|
};
|
|
1327
|
-
tokenTypes[
|
|
1374
|
+
tokenTypes[143].updateContext = context => {
|
|
1328
1375
|
context.push(types.j_expr, types.j_oTag);
|
|
1329
1376
|
};
|
|
1330
1377
|
}
|
|
@@ -1875,7 +1922,7 @@
|
|
|
1875
1922
|
this.commentsLen = 0;
|
|
1876
1923
|
this.commentStack = [];
|
|
1877
1924
|
this.pos = 0;
|
|
1878
|
-
this.type =
|
|
1925
|
+
this.type = 140;
|
|
1879
1926
|
this.value = null;
|
|
1880
1927
|
this.start = 0;
|
|
1881
1928
|
this.end = 0;
|
|
@@ -1978,8 +2025,7 @@
|
|
|
1978
2025
|
if (v) this.flags |= 4096;else this.flags &= -4097;
|
|
1979
2026
|
}
|
|
1980
2027
|
curPosition() {
|
|
1981
|
-
|
|
1982
|
-
return new Position(this.curLine, index - this.lineStart, index);
|
|
2028
|
+
return new Position(this.curLine, this.pos - this.lineStart, this.pos + this.startIndex);
|
|
1983
2029
|
}
|
|
1984
2030
|
clone() {
|
|
1985
2031
|
const state = new State();
|
|
@@ -2302,10 +2348,11 @@
|
|
|
2302
2348
|
const VALID_REGEX_FLAGS = new Set([103, 109, 115, 105, 121, 117, 100, 118]);
|
|
2303
2349
|
class Token {
|
|
2304
2350
|
constructor(state) {
|
|
2351
|
+
const startIndex = state.startIndex || 0;
|
|
2305
2352
|
this.type = state.type;
|
|
2306
2353
|
this.value = state.value;
|
|
2307
|
-
this.start = state.start;
|
|
2308
|
-
this.end = state.end;
|
|
2354
|
+
this.start = startIndex + state.start;
|
|
2355
|
+
this.end = startIndex + state.end;
|
|
2309
2356
|
this.loc = new SourceLocation(state.startLoc, state.endLoc);
|
|
2310
2357
|
}
|
|
2311
2358
|
}
|
|
@@ -2446,7 +2493,7 @@
|
|
|
2446
2493
|
this.state.start = this.state.pos;
|
|
2447
2494
|
if (!this.isLookahead) this.state.startLoc = this.state.curPosition();
|
|
2448
2495
|
if (this.state.pos >= this.length) {
|
|
2449
|
-
this.finishToken(
|
|
2496
|
+
this.finishToken(140);
|
|
2450
2497
|
return;
|
|
2451
2498
|
}
|
|
2452
2499
|
this.getTokenFromCode(this.codePointAtPos(this.state.pos));
|
|
@@ -2469,8 +2516,8 @@
|
|
|
2469
2516
|
const comment = {
|
|
2470
2517
|
type: "CommentBlock",
|
|
2471
2518
|
value: this.input.slice(start + 2, end),
|
|
2472
|
-
start,
|
|
2473
|
-
end: end + commentEnd.length,
|
|
2519
|
+
start: this.sourceToOffsetPos(start),
|
|
2520
|
+
end: this.sourceToOffsetPos(end + commentEnd.length),
|
|
2474
2521
|
loc: new SourceLocation(startLoc, this.state.curPosition())
|
|
2475
2522
|
};
|
|
2476
2523
|
if (this.options.tokens) this.pushToken(comment);
|
|
@@ -2492,8 +2539,8 @@
|
|
|
2492
2539
|
const comment = {
|
|
2493
2540
|
type: "CommentLine",
|
|
2494
2541
|
value,
|
|
2495
|
-
start,
|
|
2496
|
-
end,
|
|
2542
|
+
start: this.sourceToOffsetPos(start),
|
|
2543
|
+
end: this.sourceToOffsetPos(end),
|
|
2497
2544
|
loc: new SourceLocation(startLoc, this.state.curPosition())
|
|
2498
2545
|
};
|
|
2499
2546
|
if (this.options.tokens) this.pushToken(comment);
|
|
@@ -2624,10 +2671,10 @@
|
|
|
2624
2671
|
}
|
|
2625
2672
|
} else if (isIdentifierStart(next)) {
|
|
2626
2673
|
++this.state.pos;
|
|
2627
|
-
this.finishToken(
|
|
2674
|
+
this.finishToken(139, this.readWord1(next));
|
|
2628
2675
|
} else if (next === 92) {
|
|
2629
2676
|
++this.state.pos;
|
|
2630
|
-
this.finishToken(
|
|
2677
|
+
this.finishToken(139, this.readWord1());
|
|
2631
2678
|
} else {
|
|
2632
2679
|
this.finishOp(27, 1);
|
|
2633
2680
|
}
|
|
@@ -3039,7 +3086,7 @@
|
|
|
3039
3086
|
mods += char;
|
|
3040
3087
|
}
|
|
3041
3088
|
this.state.pos = pos;
|
|
3042
|
-
this.finishToken(
|
|
3089
|
+
this.finishToken(138, {
|
|
3043
3090
|
pattern: content,
|
|
3044
3091
|
flags: mods
|
|
3045
3092
|
});
|
|
@@ -3075,10 +3122,10 @@
|
|
|
3075
3122
|
}
|
|
3076
3123
|
if (isBigInt) {
|
|
3077
3124
|
const str = this.input.slice(start, this.state.pos).replace(/[_n]/g, "");
|
|
3078
|
-
this.finishToken(
|
|
3125
|
+
this.finishToken(136, str);
|
|
3079
3126
|
return;
|
|
3080
3127
|
}
|
|
3081
|
-
this.finishToken(
|
|
3128
|
+
this.finishToken(135, val);
|
|
3082
3129
|
}
|
|
3083
3130
|
readNumber(startsWithDot) {
|
|
3084
3131
|
const start = this.state.pos;
|
|
@@ -3141,15 +3188,15 @@
|
|
|
3141
3188
|
}
|
|
3142
3189
|
const str = this.input.slice(start, this.state.pos).replace(/[_mn]/g, "");
|
|
3143
3190
|
if (isBigInt) {
|
|
3144
|
-
this.finishToken(
|
|
3191
|
+
this.finishToken(136, str);
|
|
3145
3192
|
return;
|
|
3146
3193
|
}
|
|
3147
3194
|
if (isDecimal) {
|
|
3148
|
-
this.finishToken(
|
|
3195
|
+
this.finishToken(137, str);
|
|
3149
3196
|
return;
|
|
3150
3197
|
}
|
|
3151
3198
|
const val = isOctal ? parseInt(str, 8) : parseFloat(str);
|
|
3152
|
-
this.finishToken(
|
|
3199
|
+
this.finishToken(135, val);
|
|
3153
3200
|
}
|
|
3154
3201
|
readCodePoint(throwOnInvalid) {
|
|
3155
3202
|
const {
|
|
@@ -3169,7 +3216,7 @@
|
|
|
3169
3216
|
this.state.pos = pos + 1;
|
|
3170
3217
|
this.state.lineStart = lineStart;
|
|
3171
3218
|
this.state.curLine = curLine;
|
|
3172
|
-
this.finishToken(
|
|
3219
|
+
this.finishToken(134, str);
|
|
3173
3220
|
}
|
|
3174
3221
|
readTemplateContinuation() {
|
|
3175
3222
|
if (!this.match(8)) {
|
|
@@ -3191,7 +3238,7 @@
|
|
|
3191
3238
|
this.state.lineStart = lineStart;
|
|
3192
3239
|
this.state.curLine = curLine;
|
|
3193
3240
|
if (firstInvalidLoc) {
|
|
3194
|
-
this.state.firstInvalidTemplateEscapePos = new Position(firstInvalidLoc.curLine, firstInvalidLoc.pos - firstInvalidLoc.lineStart, firstInvalidLoc.pos);
|
|
3241
|
+
this.state.firstInvalidTemplateEscapePos = new Position(firstInvalidLoc.curLine, firstInvalidLoc.pos - firstInvalidLoc.lineStart, this.sourceToOffsetPos(firstInvalidLoc.pos));
|
|
3195
3242
|
}
|
|
3196
3243
|
if (this.input.codePointAt(pos) === 96) {
|
|
3197
3244
|
this.finishToken(24, firstInvalidLoc ? null : opening + str + "`");
|
|
@@ -3579,7 +3626,7 @@
|
|
|
3579
3626
|
}
|
|
3580
3627
|
}
|
|
3581
3628
|
canInsertSemicolon() {
|
|
3582
|
-
return this.match(
|
|
3629
|
+
return this.match(140) || this.match(8) || this.hasPrecedingLineBreak();
|
|
3583
3630
|
}
|
|
3584
3631
|
hasPrecedingLineBreak() {
|
|
3585
3632
|
return hasNewLine(this.input, this.offsetToSourcePos(this.state.lastTokEndLoc.index), this.state.start);
|
|
@@ -3984,7 +4031,7 @@
|
|
|
3984
4031
|
return this.getPluginOption("flow", "all") || this.flowPragma === "flow";
|
|
3985
4032
|
}
|
|
3986
4033
|
finishToken(type, val) {
|
|
3987
|
-
if (type !==
|
|
4034
|
+
if (type !== 134 && type !== 13 && type !== 28) {
|
|
3988
4035
|
if (this.flowPragma === undefined) {
|
|
3989
4036
|
this.flowPragma = null;
|
|
3990
4037
|
}
|
|
@@ -4112,7 +4159,7 @@
|
|
|
4112
4159
|
}
|
|
4113
4160
|
flowParseDeclareModule(node) {
|
|
4114
4161
|
this.scope.enter(0);
|
|
4115
|
-
if (this.match(
|
|
4162
|
+
if (this.match(134)) {
|
|
4116
4163
|
node.id = super.parseExprAtom();
|
|
4117
4164
|
} else {
|
|
4118
4165
|
node.id = this.parseIdentifier();
|
|
@@ -4339,7 +4386,7 @@
|
|
|
4339
4386
|
const node = this.startNode();
|
|
4340
4387
|
node.params = [];
|
|
4341
4388
|
this.state.inType = true;
|
|
4342
|
-
if (this.match(47) || this.match(
|
|
4389
|
+
if (this.match(47) || this.match(143)) {
|
|
4343
4390
|
this.next();
|
|
4344
4391
|
} else {
|
|
4345
4392
|
this.unexpected();
|
|
@@ -4413,7 +4460,7 @@
|
|
|
4413
4460
|
return this.finishNode(node, "InterfaceTypeAnnotation");
|
|
4414
4461
|
}
|
|
4415
4462
|
flowParseObjectPropertyKey() {
|
|
4416
|
-
return this.match(
|
|
4463
|
+
return this.match(135) || this.match(134) ? super.parseExprAtom() : this.parseIdentifier(true);
|
|
4417
4464
|
}
|
|
4418
4465
|
flowParseObjectTypeIndexer(node, isStatic, variance) {
|
|
4419
4466
|
node.static = isStatic;
|
|
@@ -4857,7 +4904,7 @@
|
|
|
4857
4904
|
node.typeParameters = null;
|
|
4858
4905
|
return this.finishNode(node, "FunctionTypeAnnotation");
|
|
4859
4906
|
}
|
|
4860
|
-
case
|
|
4907
|
+
case 134:
|
|
4861
4908
|
return this.parseLiteral(this.state.value, "StringLiteralTypeAnnotation");
|
|
4862
4909
|
case 85:
|
|
4863
4910
|
case 86:
|
|
@@ -4867,19 +4914,19 @@
|
|
|
4867
4914
|
case 53:
|
|
4868
4915
|
if (this.state.value === "-") {
|
|
4869
4916
|
this.next();
|
|
4870
|
-
if (this.match(
|
|
4917
|
+
if (this.match(135)) {
|
|
4871
4918
|
return this.parseLiteralAtNode(-this.state.value, "NumberLiteralTypeAnnotation", node);
|
|
4872
4919
|
}
|
|
4873
|
-
if (this.match(
|
|
4920
|
+
if (this.match(136)) {
|
|
4874
4921
|
return this.parseLiteralAtNode(-this.state.value, "BigIntLiteralTypeAnnotation", node);
|
|
4875
4922
|
}
|
|
4876
4923
|
throw this.raise(FlowErrors.UnexpectedSubtractionOperand, this.state.startLoc);
|
|
4877
4924
|
}
|
|
4878
4925
|
this.unexpected();
|
|
4879
4926
|
return;
|
|
4880
|
-
case 134:
|
|
4881
|
-
return this.parseLiteral(this.state.value, "NumberLiteralTypeAnnotation");
|
|
4882
4927
|
case 135:
|
|
4928
|
+
return this.parseLiteral(this.state.value, "NumberLiteralTypeAnnotation");
|
|
4929
|
+
case 136:
|
|
4883
4930
|
return this.parseLiteral(this.state.value, "BigIntLiteralTypeAnnotation");
|
|
4884
4931
|
case 88:
|
|
4885
4932
|
this.next();
|
|
@@ -5632,7 +5679,7 @@
|
|
|
5632
5679
|
var _jsx;
|
|
5633
5680
|
let state = null;
|
|
5634
5681
|
let jsx;
|
|
5635
|
-
if (this.hasPlugin("jsx") && (this.match(
|
|
5682
|
+
if (this.hasPlugin("jsx") && (this.match(143) || this.match(47))) {
|
|
5636
5683
|
state = this.state.clone();
|
|
5637
5684
|
jsx = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, afterLeftParse), state);
|
|
5638
5685
|
if (!jsx.error) return jsx.node;
|
|
@@ -5891,7 +5938,7 @@
|
|
|
5891
5938
|
const startLoc = this.state.startLoc;
|
|
5892
5939
|
const endOfInit = () => this.match(12) || this.match(8);
|
|
5893
5940
|
switch (this.state.type) {
|
|
5894
|
-
case
|
|
5941
|
+
case 135:
|
|
5895
5942
|
{
|
|
5896
5943
|
const literal = this.parseNumericLiteral(this.state.value);
|
|
5897
5944
|
if (endOfInit()) {
|
|
@@ -5906,7 +5953,7 @@
|
|
|
5906
5953
|
loc: startLoc
|
|
5907
5954
|
};
|
|
5908
5955
|
}
|
|
5909
|
-
case
|
|
5956
|
+
case 134:
|
|
5910
5957
|
{
|
|
5911
5958
|
const literal = this.parseStringLiteral(this.state.value);
|
|
5912
5959
|
if (endOfInit()) {
|
|
@@ -6511,14 +6558,14 @@
|
|
|
6511
6558
|
if (this.state.pos === this.state.start) {
|
|
6512
6559
|
if (ch === 60 && this.state.canStartJSXElement) {
|
|
6513
6560
|
++this.state.pos;
|
|
6514
|
-
this.finishToken(
|
|
6561
|
+
this.finishToken(143);
|
|
6515
6562
|
} else {
|
|
6516
6563
|
super.getTokenFromCode(ch);
|
|
6517
6564
|
}
|
|
6518
6565
|
return;
|
|
6519
6566
|
}
|
|
6520
6567
|
out += this.input.slice(chunkStart, this.state.pos);
|
|
6521
|
-
this.finishToken(
|
|
6568
|
+
this.finishToken(142, out);
|
|
6522
6569
|
return;
|
|
6523
6570
|
case 38:
|
|
6524
6571
|
out += this.input.slice(chunkStart, this.state.pos);
|
|
@@ -6574,7 +6621,7 @@
|
|
|
6574
6621
|
}
|
|
6575
6622
|
}
|
|
6576
6623
|
out += this.input.slice(chunkStart, this.state.pos++);
|
|
6577
|
-
this.finishToken(
|
|
6624
|
+
this.finishToken(134, out);
|
|
6578
6625
|
}
|
|
6579
6626
|
jsxReadEntity() {
|
|
6580
6627
|
const startPos = ++this.state.pos;
|
|
@@ -6614,11 +6661,11 @@
|
|
|
6614
6661
|
do {
|
|
6615
6662
|
ch = this.input.charCodeAt(++this.state.pos);
|
|
6616
6663
|
} while (isIdentifierChar(ch) || ch === 45);
|
|
6617
|
-
this.finishToken(
|
|
6664
|
+
this.finishToken(141, this.input.slice(start, this.state.pos));
|
|
6618
6665
|
}
|
|
6619
6666
|
jsxParseIdentifier() {
|
|
6620
6667
|
const node = this.startNode();
|
|
6621
|
-
if (this.match(
|
|
6668
|
+
if (this.match(141)) {
|
|
6622
6669
|
node.name = this.state.value;
|
|
6623
6670
|
} else if (tokenIsKeyword(this.state.type)) {
|
|
6624
6671
|
node.name = tokenLabelName(this.state.type);
|
|
@@ -6663,8 +6710,8 @@
|
|
|
6663
6710
|
this.raise(JsxErrors.AttributeIsEmpty, node);
|
|
6664
6711
|
}
|
|
6665
6712
|
return node;
|
|
6666
|
-
case
|
|
6667
|
-
case
|
|
6713
|
+
case 143:
|
|
6714
|
+
case 134:
|
|
6668
6715
|
return this.parseExprAtom();
|
|
6669
6716
|
default:
|
|
6670
6717
|
throw this.raise(JsxErrors.UnsupportedJsxValue, this.state.startLoc);
|
|
@@ -6712,7 +6759,7 @@
|
|
|
6712
6759
|
}
|
|
6713
6760
|
jsxParseOpeningElementAt(startLoc) {
|
|
6714
6761
|
const node = this.startNodeAt(startLoc);
|
|
6715
|
-
if (this.eat(
|
|
6762
|
+
if (this.eat(144)) {
|
|
6716
6763
|
return this.finishNode(node, "JSXOpeningFragment");
|
|
6717
6764
|
}
|
|
6718
6765
|
node.name = this.jsxParseElementName();
|
|
@@ -6720,21 +6767,21 @@
|
|
|
6720
6767
|
}
|
|
6721
6768
|
jsxParseOpeningElementAfterName(node) {
|
|
6722
6769
|
const attributes = [];
|
|
6723
|
-
while (!this.match(56) && !this.match(
|
|
6770
|
+
while (!this.match(56) && !this.match(144)) {
|
|
6724
6771
|
attributes.push(this.jsxParseAttribute());
|
|
6725
6772
|
}
|
|
6726
6773
|
node.attributes = attributes;
|
|
6727
6774
|
node.selfClosing = this.eat(56);
|
|
6728
|
-
this.expect(
|
|
6775
|
+
this.expect(144);
|
|
6729
6776
|
return this.finishNode(node, "JSXOpeningElement");
|
|
6730
6777
|
}
|
|
6731
6778
|
jsxParseClosingElementAt(startLoc) {
|
|
6732
6779
|
const node = this.startNodeAt(startLoc);
|
|
6733
|
-
if (this.eat(
|
|
6780
|
+
if (this.eat(144)) {
|
|
6734
6781
|
return this.finishNode(node, "JSXClosingFragment");
|
|
6735
6782
|
}
|
|
6736
6783
|
node.name = this.jsxParseElementName();
|
|
6737
|
-
this.expect(
|
|
6784
|
+
this.expect(144);
|
|
6738
6785
|
return this.finishNode(node, "JSXClosingElement");
|
|
6739
6786
|
}
|
|
6740
6787
|
jsxParseElementAt(startLoc) {
|
|
@@ -6745,7 +6792,7 @@
|
|
|
6745
6792
|
if (!openingElement.selfClosing) {
|
|
6746
6793
|
contents: for (;;) {
|
|
6747
6794
|
switch (this.state.type) {
|
|
6748
|
-
case
|
|
6795
|
+
case 143:
|
|
6749
6796
|
startLoc = this.state.startLoc;
|
|
6750
6797
|
this.next();
|
|
6751
6798
|
if (this.eat(56)) {
|
|
@@ -6754,7 +6801,7 @@
|
|
|
6754
6801
|
}
|
|
6755
6802
|
children.push(this.jsxParseElementAt(startLoc));
|
|
6756
6803
|
break;
|
|
6757
|
-
case
|
|
6804
|
+
case 142:
|
|
6758
6805
|
children.push(this.parseLiteral(this.state.value, "JSXText"));
|
|
6759
6806
|
break;
|
|
6760
6807
|
case 5:
|
|
@@ -6812,10 +6859,10 @@
|
|
|
6812
6859
|
context[context.length - 1] = newContext;
|
|
6813
6860
|
}
|
|
6814
6861
|
parseExprAtom(refExpressionErrors) {
|
|
6815
|
-
if (this.match(
|
|
6862
|
+
if (this.match(143)) {
|
|
6816
6863
|
return this.jsxParseElement();
|
|
6817
6864
|
} else if (this.match(47) && this.input.charCodeAt(this.state.pos) !== 33) {
|
|
6818
|
-
this.replaceToken(
|
|
6865
|
+
this.replaceToken(143);
|
|
6819
6866
|
return this.jsxParseElement();
|
|
6820
6867
|
} else {
|
|
6821
6868
|
return super.parseExprAtom(refExpressionErrors);
|
|
@@ -6838,7 +6885,7 @@
|
|
|
6838
6885
|
}
|
|
6839
6886
|
if (code === 62) {
|
|
6840
6887
|
++this.state.pos;
|
|
6841
|
-
this.finishToken(
|
|
6888
|
+
this.finishToken(144);
|
|
6842
6889
|
return;
|
|
6843
6890
|
}
|
|
6844
6891
|
if ((code === 34 || code === 39) && context === types.j_oTag) {
|
|
@@ -6848,7 +6895,7 @@
|
|
|
6848
6895
|
}
|
|
6849
6896
|
if (code === 60 && this.state.canStartJSXElement && this.input.charCodeAt(this.state.pos + 1) !== 33) {
|
|
6850
6897
|
++this.state.pos;
|
|
6851
|
-
this.finishToken(
|
|
6898
|
+
this.finishToken(143);
|
|
6852
6899
|
return;
|
|
6853
6900
|
}
|
|
6854
6901
|
super.getTokenFromCode(code);
|
|
@@ -6858,12 +6905,12 @@
|
|
|
6858
6905
|
context,
|
|
6859
6906
|
type
|
|
6860
6907
|
} = this.state;
|
|
6861
|
-
if (type === 56 && prevType ===
|
|
6908
|
+
if (type === 56 && prevType === 143) {
|
|
6862
6909
|
context.splice(-2, 2, types.j_cTag);
|
|
6863
6910
|
this.state.canStartJSXElement = false;
|
|
6864
|
-
} else if (type === 142) {
|
|
6865
|
-
context.push(types.j_oTag);
|
|
6866
6911
|
} else if (type === 143) {
|
|
6912
|
+
context.push(types.j_oTag);
|
|
6913
|
+
} else if (type === 144) {
|
|
6867
6914
|
const out = context[context.length - 1];
|
|
6868
6915
|
if (out === types.j_oTag && prevType === 56 || out === types.j_cTag) {
|
|
6869
6916
|
context.pop();
|
|
@@ -7220,7 +7267,7 @@
|
|
|
7220
7267
|
return this.parseBindingRestProperty(this.startNode());
|
|
7221
7268
|
}
|
|
7222
7269
|
const prop = this.startNode();
|
|
7223
|
-
if (type ===
|
|
7270
|
+
if (type === 139) {
|
|
7224
7271
|
this.expectPlugin("destructuringPrivate", startLoc);
|
|
7225
7272
|
this.classScope.usePrivateName(this.state.value, startLoc);
|
|
7226
7273
|
prop.key = this.parsePrivateName();
|
|
@@ -7544,7 +7591,7 @@
|
|
|
7544
7591
|
return tokenIsIdentifier(this.state.type);
|
|
7545
7592
|
}
|
|
7546
7593
|
tsTokenCanFollowModifier() {
|
|
7547
|
-
return this.match(0) || this.match(5) || this.match(55) || this.match(21) || this.match(
|
|
7594
|
+
return this.match(0) || this.match(5) || this.match(55) || this.match(21) || this.match(139) || this.isLiteralPropertyName();
|
|
7548
7595
|
}
|
|
7549
7596
|
tsNextTokenOnSameLineAndCanFollowModifier() {
|
|
7550
7597
|
this.next();
|
|
@@ -7715,7 +7762,7 @@
|
|
|
7715
7762
|
const node = this.startNode();
|
|
7716
7763
|
this.expect(83);
|
|
7717
7764
|
this.expect(10);
|
|
7718
|
-
if (!this.match(
|
|
7765
|
+
if (!this.match(134)) {
|
|
7719
7766
|
this.raise(TSErrors.UnsupportedImportTypeArgument, this.state.startLoc);
|
|
7720
7767
|
}
|
|
7721
7768
|
node.argument = super.parseExprAtom();
|
|
@@ -7793,7 +7840,7 @@
|
|
|
7793
7840
|
}
|
|
7794
7841
|
tsParseTypeParameters(parseModifiers) {
|
|
7795
7842
|
const node = this.startNode();
|
|
7796
|
-
if (this.match(47) || this.match(
|
|
7843
|
+
if (this.match(47) || this.match(143)) {
|
|
7797
7844
|
this.next();
|
|
7798
7845
|
} else {
|
|
7799
7846
|
this.unexpected();
|
|
@@ -8117,9 +8164,9 @@
|
|
|
8117
8164
|
tsParseLiteralTypeNode() {
|
|
8118
8165
|
const node = this.startNode();
|
|
8119
8166
|
switch (this.state.type) {
|
|
8120
|
-
case 134:
|
|
8121
8167
|
case 135:
|
|
8122
|
-
case
|
|
8168
|
+
case 136:
|
|
8169
|
+
case 134:
|
|
8123
8170
|
case 85:
|
|
8124
8171
|
case 86:
|
|
8125
8172
|
node.literal = super.parseExprAtom();
|
|
@@ -8148,9 +8195,9 @@
|
|
|
8148
8195
|
}
|
|
8149
8196
|
tsParseNonArrayType() {
|
|
8150
8197
|
switch (this.state.type) {
|
|
8151
|
-
case 133:
|
|
8152
8198
|
case 134:
|
|
8153
8199
|
case 135:
|
|
8200
|
+
case 136:
|
|
8154
8201
|
case 85:
|
|
8155
8202
|
case 86:
|
|
8156
8203
|
return this.tsParseLiteralTypeNode();
|
|
@@ -8158,7 +8205,7 @@
|
|
|
8158
8205
|
if (this.state.value === "-") {
|
|
8159
8206
|
const node = this.startNode();
|
|
8160
8207
|
const nextToken = this.lookahead();
|
|
8161
|
-
if (nextToken.type !==
|
|
8208
|
+
if (nextToken.type !== 135 && nextToken.type !== 136) {
|
|
8162
8209
|
this.unexpected();
|
|
8163
8210
|
}
|
|
8164
8211
|
node.literal = this.parseMaybeUnary();
|
|
@@ -8564,7 +8611,7 @@
|
|
|
8564
8611
|
}
|
|
8565
8612
|
tsParseEnumMember() {
|
|
8566
8613
|
const node = this.startNode();
|
|
8567
|
-
node.id = this.match(
|
|
8614
|
+
node.id = this.match(134) ? super.parseStringLiteral(this.state.value) : this.parseIdentifier(true);
|
|
8568
8615
|
if (this.eat(29)) {
|
|
8569
8616
|
node.initializer = super.parseMaybeAssignAllowIn();
|
|
8570
8617
|
}
|
|
@@ -8612,7 +8659,7 @@
|
|
|
8612
8659
|
node.kind = "global";
|
|
8613
8660
|
node.global = true;
|
|
8614
8661
|
node.id = this.parseIdentifier();
|
|
8615
|
-
} else if (this.match(
|
|
8662
|
+
} else if (this.match(134)) {
|
|
8616
8663
|
node.kind = "module";
|
|
8617
8664
|
node.id = super.parseStringLiteral(this.state.value);
|
|
8618
8665
|
} else {
|
|
@@ -8652,7 +8699,7 @@
|
|
|
8652
8699
|
const node = this.startNode();
|
|
8653
8700
|
this.expectContextual(119);
|
|
8654
8701
|
this.expect(10);
|
|
8655
|
-
if (!this.match(
|
|
8702
|
+
if (!this.match(134)) {
|
|
8656
8703
|
this.unexpected();
|
|
8657
8704
|
}
|
|
8658
8705
|
node.expression = super.parseExprAtom();
|
|
@@ -8769,7 +8816,7 @@
|
|
|
8769
8816
|
break;
|
|
8770
8817
|
case "module":
|
|
8771
8818
|
if (this.tsCheckLineTerminator(next)) {
|
|
8772
|
-
if (this.match(
|
|
8819
|
+
if (this.match(134)) {
|
|
8773
8820
|
return this.tsParseAmbientExternalModuleDeclaration(node);
|
|
8774
8821
|
} else if (tokenIsIdentifier(this.state.type)) {
|
|
8775
8822
|
node.kind = "module";
|
|
@@ -9063,7 +9110,7 @@
|
|
|
9063
9110
|
}
|
|
9064
9111
|
}
|
|
9065
9112
|
parseImport(node) {
|
|
9066
|
-
if (this.match(
|
|
9113
|
+
if (this.match(134)) {
|
|
9067
9114
|
node.importKind = "value";
|
|
9068
9115
|
return super.parseImport(node);
|
|
9069
9116
|
}
|
|
@@ -9425,7 +9472,7 @@
|
|
|
9425
9472
|
let state;
|
|
9426
9473
|
let jsx;
|
|
9427
9474
|
let typeCast;
|
|
9428
|
-
if (this.hasPlugin("jsx") && (this.match(
|
|
9475
|
+
if (this.hasPlugin("jsx") && (this.match(143) || this.match(47))) {
|
|
9429
9476
|
state = this.state.clone();
|
|
9430
9477
|
jsx = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, afterLeftParse), state);
|
|
9431
9478
|
if (!jsx.error) return jsx.node;
|
|
@@ -9933,13 +9980,13 @@
|
|
|
9933
9980
|
});
|
|
9934
9981
|
var placeholders = superClass => class PlaceholdersParserMixin extends superClass {
|
|
9935
9982
|
parsePlaceholder(expectedNode) {
|
|
9936
|
-
if (this.match(
|
|
9983
|
+
if (this.match(133)) {
|
|
9937
9984
|
const node = this.startNode();
|
|
9938
9985
|
this.next();
|
|
9939
9986
|
this.assertNoSpace();
|
|
9940
9987
|
node.name = super.parseIdentifier(true);
|
|
9941
9988
|
this.assertNoSpace();
|
|
9942
|
-
this.expect(
|
|
9989
|
+
this.expect(133);
|
|
9943
9990
|
return this.finishPlaceholder(node, expectedNode);
|
|
9944
9991
|
}
|
|
9945
9992
|
}
|
|
@@ -9953,7 +10000,7 @@
|
|
|
9953
10000
|
}
|
|
9954
10001
|
getTokenFromCode(code) {
|
|
9955
10002
|
if (code === 37 && this.input.charCodeAt(this.state.pos + 1) === 37) {
|
|
9956
|
-
this.finishOp(
|
|
10003
|
+
this.finishOp(133, 2);
|
|
9957
10004
|
} else {
|
|
9958
10005
|
super.getTokenFromCode(code);
|
|
9959
10006
|
}
|
|
@@ -9987,7 +10034,7 @@
|
|
|
9987
10034
|
return true;
|
|
9988
10035
|
}
|
|
9989
10036
|
const nextToken = this.lookahead();
|
|
9990
|
-
if (nextToken.type ===
|
|
10037
|
+
if (nextToken.type === 133) {
|
|
9991
10038
|
return true;
|
|
9992
10039
|
}
|
|
9993
10040
|
return false;
|
|
@@ -10025,7 +10072,7 @@
|
|
|
10025
10072
|
const oldStrict = this.state.strict;
|
|
10026
10073
|
const placeholder = this.parsePlaceholder("Identifier");
|
|
10027
10074
|
if (placeholder) {
|
|
10028
|
-
if (this.match(81) || this.match(
|
|
10075
|
+
if (this.match(81) || this.match(133) || this.match(5)) {
|
|
10029
10076
|
node.id = placeholder;
|
|
10030
10077
|
} else if (optionalId || !isStatement) {
|
|
10031
10078
|
node.id = null;
|
|
@@ -10061,7 +10108,7 @@
|
|
|
10061
10108
|
if (this.match(65)) {
|
|
10062
10109
|
const next = this.nextTokenStart();
|
|
10063
10110
|
if (this.isUnparsedContextual(next, "from")) {
|
|
10064
|
-
if (this.input.startsWith(tokenLabelName(
|
|
10111
|
+
if (this.input.startsWith(tokenLabelName(133), this.nextTokenStartSince(next + 4))) {
|
|
10065
10112
|
return true;
|
|
10066
10113
|
}
|
|
10067
10114
|
}
|
|
@@ -10314,7 +10361,7 @@
|
|
|
10314
10361
|
this.enterInitialScopes();
|
|
10315
10362
|
this.nextToken();
|
|
10316
10363
|
const expr = this.parseExpression();
|
|
10317
|
-
if (!this.match(
|
|
10364
|
+
if (!this.match(140)) {
|
|
10318
10365
|
this.unexpected();
|
|
10319
10366
|
}
|
|
10320
10367
|
this.finalizeRemainingComments();
|
|
@@ -10434,7 +10481,7 @@
|
|
|
10434
10481
|
return expr;
|
|
10435
10482
|
}
|
|
10436
10483
|
parseMaybeUnaryOrPrivate(refExpressionErrors) {
|
|
10437
|
-
return this.match(
|
|
10484
|
+
return this.match(139) ? this.parsePrivateName() : this.parseMaybeUnary(refExpressionErrors);
|
|
10438
10485
|
}
|
|
10439
10486
|
parseExprOps(refExpressionErrors) {
|
|
10440
10487
|
const startLoc = this.state.startLoc;
|
|
@@ -10673,7 +10720,7 @@
|
|
|
10673
10720
|
if (computed) {
|
|
10674
10721
|
node.property = this.parseExpression();
|
|
10675
10722
|
this.expect(3);
|
|
10676
|
-
} else if (this.match(
|
|
10723
|
+
} else if (this.match(139)) {
|
|
10677
10724
|
if (base.type === "Super") {
|
|
10678
10725
|
this.raise(Errors.SuperPrivateField, startLoc);
|
|
10679
10726
|
}
|
|
@@ -10848,11 +10895,11 @@
|
|
|
10848
10895
|
this.readRegexp();
|
|
10849
10896
|
return this.parseRegExpLiteral(this.state.value);
|
|
10850
10897
|
}
|
|
10851
|
-
case 134:
|
|
10852
|
-
return this.parseNumericLiteral(this.state.value);
|
|
10853
10898
|
case 135:
|
|
10899
|
+
return this.parseNumericLiteral(this.state.value);
|
|
10900
|
+
case 136:
|
|
10854
10901
|
return this.parseBigIntLiteral(this.state.value);
|
|
10855
|
-
case
|
|
10902
|
+
case 134:
|
|
10856
10903
|
return this.parseStringLiteral(this.state.value);
|
|
10857
10904
|
case 84:
|
|
10858
10905
|
return this.parseNullLiteral();
|
|
@@ -10906,7 +10953,7 @@
|
|
|
10906
10953
|
throw this.raise(Errors.UnsupportedBind, callee);
|
|
10907
10954
|
}
|
|
10908
10955
|
}
|
|
10909
|
-
case
|
|
10956
|
+
case 139:
|
|
10910
10957
|
{
|
|
10911
10958
|
this.raise(Errors.PrivateInExpectedIn, this.state.startLoc, {
|
|
10912
10959
|
identifierName: this.state.value
|
|
@@ -10948,7 +10995,7 @@
|
|
|
10948
10995
|
break;
|
|
10949
10996
|
}
|
|
10950
10997
|
default:
|
|
10951
|
-
if (type ===
|
|
10998
|
+
if (type === 137) {
|
|
10952
10999
|
return this.parseDecimalLiteral(this.state.value);
|
|
10953
11000
|
}
|
|
10954
11001
|
if (tokenIsIdentifier(type)) {
|
|
@@ -11531,16 +11578,16 @@
|
|
|
11531
11578
|
key = this.parseIdentifier(true);
|
|
11532
11579
|
} else {
|
|
11533
11580
|
switch (type) {
|
|
11534
|
-
case
|
|
11581
|
+
case 135:
|
|
11535
11582
|
key = this.parseNumericLiteral(value);
|
|
11536
11583
|
break;
|
|
11537
|
-
case
|
|
11584
|
+
case 134:
|
|
11538
11585
|
key = this.parseStringLiteral(value);
|
|
11539
11586
|
break;
|
|
11540
|
-
case
|
|
11587
|
+
case 136:
|
|
11541
11588
|
key = this.parseBigIntLiteral(value);
|
|
11542
11589
|
break;
|
|
11543
|
-
case
|
|
11590
|
+
case 139:
|
|
11544
11591
|
{
|
|
11545
11592
|
const privateKeyLoc = this.state.startLoc;
|
|
11546
11593
|
if (refExpressionErrors != null) {
|
|
@@ -11554,7 +11601,7 @@
|
|
|
11554
11601
|
break;
|
|
11555
11602
|
}
|
|
11556
11603
|
default:
|
|
11557
|
-
if (type ===
|
|
11604
|
+
if (type === 137) {
|
|
11558
11605
|
key = this.parseDecimalLiteral(value);
|
|
11559
11606
|
break;
|
|
11560
11607
|
}
|
|
@@ -11562,7 +11609,7 @@
|
|
|
11562
11609
|
}
|
|
11563
11610
|
}
|
|
11564
11611
|
prop.key = key;
|
|
11565
|
-
if (type !==
|
|
11612
|
+
if (type !== 139) {
|
|
11566
11613
|
prop.computed = false;
|
|
11567
11614
|
}
|
|
11568
11615
|
}
|
|
@@ -11816,7 +11863,7 @@
|
|
|
11816
11863
|
const {
|
|
11817
11864
|
type
|
|
11818
11865
|
} = this.state;
|
|
11819
|
-
return type === 53 || type === 10 || type === 0 || tokenIsTemplate(type) || type === 102 && !this.state.containsEsc || type ===
|
|
11866
|
+
return type === 53 || type === 10 || type === 0 || tokenIsTemplate(type) || type === 102 && !this.state.containsEsc || type === 138 || type === 56 || this.hasPlugin("v8intrinsic") && type === 54;
|
|
11820
11867
|
}
|
|
11821
11868
|
parseYield() {
|
|
11822
11869
|
const node = this.startNode();
|
|
@@ -11828,7 +11875,7 @@
|
|
|
11828
11875
|
delegating = this.eat(55);
|
|
11829
11876
|
switch (this.state.type) {
|
|
11830
11877
|
case 13:
|
|
11831
|
-
case
|
|
11878
|
+
case 140:
|
|
11832
11879
|
case 8:
|
|
11833
11880
|
case 11:
|
|
11834
11881
|
case 3:
|
|
@@ -12012,7 +12059,7 @@
|
|
|
12012
12059
|
};
|
|
12013
12060
|
const loneSurrogate = /[\uD800-\uDFFF]/u;
|
|
12014
12061
|
const keywordRelationalOperator = /in(?:stanceof)?/y;
|
|
12015
|
-
function babel7CompatTokens(tokens, input) {
|
|
12062
|
+
function babel7CompatTokens(tokens, input, startIndex) {
|
|
12016
12063
|
for (let i = 0; i < tokens.length; i++) {
|
|
12017
12064
|
const token = tokens[i];
|
|
12018
12065
|
const {
|
|
@@ -12020,7 +12067,7 @@
|
|
|
12020
12067
|
} = token;
|
|
12021
12068
|
if (typeof type === "number") {
|
|
12022
12069
|
{
|
|
12023
|
-
if (type ===
|
|
12070
|
+
if (type === 139) {
|
|
12024
12071
|
const {
|
|
12025
12072
|
loc,
|
|
12026
12073
|
start,
|
|
@@ -12057,7 +12104,7 @@
|
|
|
12057
12104
|
const backquoteEnd = start + 1;
|
|
12058
12105
|
const backquoteEndLoc = createPositionWithColumnOffset(loc.start, 1);
|
|
12059
12106
|
let startToken;
|
|
12060
|
-
if (input.charCodeAt(start) === 96) {
|
|
12107
|
+
if (input.charCodeAt(start - startIndex) === 96) {
|
|
12061
12108
|
startToken = new Token({
|
|
12062
12109
|
type: getExportedToken(22),
|
|
12063
12110
|
value: "`",
|
|
@@ -12124,11 +12171,11 @@
|
|
|
12124
12171
|
file.program = this.parseProgram(program);
|
|
12125
12172
|
file.comments = this.comments;
|
|
12126
12173
|
if (this.options.tokens) {
|
|
12127
|
-
file.tokens = babel7CompatTokens(this.tokens, this.input);
|
|
12174
|
+
file.tokens = babel7CompatTokens(this.tokens, this.input, this.startIndex);
|
|
12128
12175
|
}
|
|
12129
12176
|
return this.finishNode(file, "File");
|
|
12130
12177
|
}
|
|
12131
|
-
parseProgram(program, end =
|
|
12178
|
+
parseProgram(program, end = 140, sourceType = this.options.sourceType) {
|
|
12132
12179
|
program.sourceType = sourceType;
|
|
12133
12180
|
program.interpreter = this.parseInterpreterDirective();
|
|
12134
12181
|
this.parseBlockBody(program, true, true, end);
|
|
@@ -12143,7 +12190,7 @@
|
|
|
12143
12190
|
this.addExtra(program, "topLevelAwait", this.state.hasTopLevelAwait);
|
|
12144
12191
|
}
|
|
12145
12192
|
let finishedProgram;
|
|
12146
|
-
if (end ===
|
|
12193
|
+
if (end === 140) {
|
|
12147
12194
|
finishedProgram = this.finishNode(program, "Program");
|
|
12148
12195
|
} else {
|
|
12149
12196
|
finishedProgram = this.finishNodeAt(program, "Program", createPositionWithColumnOffset(this.state.startLoc, -1));
|
|
@@ -12464,7 +12511,7 @@
|
|
|
12464
12511
|
while (this.eat(16)) {
|
|
12465
12512
|
const node = this.startNodeAt(startLoc);
|
|
12466
12513
|
node.object = expr;
|
|
12467
|
-
if (this.match(
|
|
12514
|
+
if (this.match(139)) {
|
|
12468
12515
|
this.classScope.usePrivateName(this.state.value, this.state.startLoc);
|
|
12469
12516
|
node.property = this.parsePrivateName();
|
|
12470
12517
|
} else {
|
|
@@ -13067,7 +13114,7 @@
|
|
|
13067
13114
|
this.parsePropertyNamePrefixOperator(member);
|
|
13068
13115
|
if (this.eat(55)) {
|
|
13069
13116
|
method.kind = "method";
|
|
13070
|
-
const isPrivateName = this.match(
|
|
13117
|
+
const isPrivateName = this.match(139);
|
|
13071
13118
|
this.parseClassElementName(method);
|
|
13072
13119
|
if (isPrivateName) {
|
|
13073
13120
|
this.pushClassPrivateMethod(classBody, privateMethod, true, false);
|
|
@@ -13118,7 +13165,7 @@
|
|
|
13118
13165
|
this.unexpected(maybeQuestionTokenStartLoc);
|
|
13119
13166
|
}
|
|
13120
13167
|
method.kind = "method";
|
|
13121
|
-
const isPrivate = this.match(
|
|
13168
|
+
const isPrivate = this.match(139);
|
|
13122
13169
|
this.parseClassElementName(method);
|
|
13123
13170
|
this.parsePostMemberNameModifiers(publicMember);
|
|
13124
13171
|
if (isPrivate) {
|
|
@@ -13132,7 +13179,7 @@
|
|
|
13132
13179
|
} else if ((maybeContextualKw === "get" || maybeContextualKw === "set") && !(this.match(55) && this.isLineTerminator())) {
|
|
13133
13180
|
this.resetPreviousNodeTrailingComments(key);
|
|
13134
13181
|
method.kind = maybeContextualKw;
|
|
13135
|
-
const isPrivate = this.match(
|
|
13182
|
+
const isPrivate = this.match(139);
|
|
13136
13183
|
this.parseClassElementName(publicMethod);
|
|
13137
13184
|
if (isPrivate) {
|
|
13138
13185
|
this.pushClassPrivateMethod(classBody, privateMethod, false, false);
|
|
@@ -13146,7 +13193,7 @@
|
|
|
13146
13193
|
} else if (maybeContextualKw === "accessor" && !this.isLineTerminator()) {
|
|
13147
13194
|
this.expectPlugin("decoratorAutoAccessors");
|
|
13148
13195
|
this.resetPreviousNodeTrailingComments(key);
|
|
13149
|
-
const isPrivate = this.match(
|
|
13196
|
+
const isPrivate = this.match(139);
|
|
13150
13197
|
this.parseClassElementName(publicProp);
|
|
13151
13198
|
this.pushClassAccessorProperty(classBody, accessorProp, isPrivate);
|
|
13152
13199
|
} else if (this.isLineTerminator()) {
|
|
@@ -13164,10 +13211,10 @@
|
|
|
13164
13211
|
type,
|
|
13165
13212
|
value
|
|
13166
13213
|
} = this.state;
|
|
13167
|
-
if ((type === 132 || type ===
|
|
13214
|
+
if ((type === 132 || type === 134) && member.static && value === "prototype") {
|
|
13168
13215
|
this.raise(Errors.StaticPrototype, this.state.startLoc);
|
|
13169
13216
|
}
|
|
13170
|
-
if (type ===
|
|
13217
|
+
if (type === 139) {
|
|
13171
13218
|
if (value === "constructor") {
|
|
13172
13219
|
this.raise(Errors.ConstructorClassPrivateField, this.state.startLoc);
|
|
13173
13220
|
}
|
|
@@ -13578,7 +13625,7 @@
|
|
|
13578
13625
|
if (this.eat(8)) break;
|
|
13579
13626
|
}
|
|
13580
13627
|
const isMaybeTypeOnly = this.isContextual(130);
|
|
13581
|
-
const isString = this.match(
|
|
13628
|
+
const isString = this.match(134);
|
|
13582
13629
|
const node = this.startNode();
|
|
13583
13630
|
node.local = this.parseModuleExportName();
|
|
13584
13631
|
nodes.push(this.parseExportSpecifier(node, isString, isInTypeExport, isMaybeTypeOnly));
|
|
@@ -13596,7 +13643,7 @@
|
|
|
13596
13643
|
return this.finishNode(node, "ExportSpecifier");
|
|
13597
13644
|
}
|
|
13598
13645
|
parseModuleExportName() {
|
|
13599
|
-
if (this.match(
|
|
13646
|
+
if (this.match(134)) {
|
|
13600
13647
|
const result = this.parseStringLiteral(this.state.value);
|
|
13601
13648
|
const surrogate = loneSurrogate.exec(result.value);
|
|
13602
13649
|
if (surrogate) {
|
|
@@ -13715,7 +13762,7 @@
|
|
|
13715
13762
|
return tokenIsIdentifier(type) ? type !== 98 || this.lookaheadCharCode() === 102 : type !== 12;
|
|
13716
13763
|
}
|
|
13717
13764
|
parseImport(node) {
|
|
13718
|
-
if (this.match(
|
|
13765
|
+
if (this.match(134)) {
|
|
13719
13766
|
return this.parseImportSourceAndAttributes(node);
|
|
13720
13767
|
}
|
|
13721
13768
|
return this.parseImportSpecifiersAndAfter(node, this.parseMaybeImportPhase(node, false));
|
|
@@ -13740,7 +13787,7 @@
|
|
|
13740
13787
|
return this.finishNode(node, "ImportDeclaration");
|
|
13741
13788
|
}
|
|
13742
13789
|
parseImportSource() {
|
|
13743
|
-
if (!this.match(
|
|
13790
|
+
if (!this.match(134)) this.unexpected();
|
|
13744
13791
|
return this.parseExprAtom();
|
|
13745
13792
|
}
|
|
13746
13793
|
parseImportSpecifierLocal(node, specifier, type) {
|
|
@@ -13769,13 +13816,13 @@
|
|
|
13769
13816
|
});
|
|
13770
13817
|
}
|
|
13771
13818
|
attrNames.add(keyName);
|
|
13772
|
-
if (this.match(
|
|
13819
|
+
if (this.match(134)) {
|
|
13773
13820
|
node.key = this.parseStringLiteral(keyName);
|
|
13774
13821
|
} else {
|
|
13775
13822
|
node.key = this.parseIdentifier(true);
|
|
13776
13823
|
}
|
|
13777
13824
|
this.expect(14);
|
|
13778
|
-
if (!this.match(
|
|
13825
|
+
if (!this.match(134)) {
|
|
13779
13826
|
throw this.raise(Errors.ModuleAttributeInvalidValue, this.state.startLoc);
|
|
13780
13827
|
}
|
|
13781
13828
|
node.value = this.parseStringLiteral(this.state.value);
|
|
@@ -13800,7 +13847,7 @@
|
|
|
13800
13847
|
}
|
|
13801
13848
|
attributes.add(node.key.name);
|
|
13802
13849
|
this.expect(14);
|
|
13803
|
-
if (!this.match(
|
|
13850
|
+
if (!this.match(134)) {
|
|
13804
13851
|
throw this.raise(Errors.ModuleAttributeInvalidValue, this.state.startLoc);
|
|
13805
13852
|
}
|
|
13806
13853
|
node.value = this.parseStringLiteral(this.state.value);
|
|
@@ -13880,7 +13927,7 @@
|
|
|
13880
13927
|
if (this.eat(8)) break;
|
|
13881
13928
|
}
|
|
13882
13929
|
const specifier = this.startNode();
|
|
13883
|
-
const importedIsString = this.match(
|
|
13930
|
+
const importedIsString = this.match(134);
|
|
13884
13931
|
const isMaybeTypeOnly = this.isContextual(130);
|
|
13885
13932
|
specifier.imported = this.parseModuleExportName();
|
|
13886
13933
|
const importSpecifier = this.parseImportSpecifier(specifier, importedIsString, node.importKind === "type" || node.importKind === "typeof", isMaybeTypeOnly, undefined);
|
|
@@ -14027,46 +14074,13 @@
|
|
|
14027
14074
|
function extractImport(astBody, code) {
|
|
14028
14075
|
const imports = astBody.filter(({ type }) => type === "ImportDeclaration").map((node) => code.slice(node.start, node.end));
|
|
14029
14076
|
return {
|
|
14030
|
-
importsCode: imports.
|
|
14031
|
-
|
|
14077
|
+
importsCode: `${imports.join("\n")}
|
|
14078
|
+
`,
|
|
14032
14079
|
setupCode: `${code.replace(new RegExp(imports.join("|"), "g"), "").trim()}
|
|
14033
14080
|
`
|
|
14034
14081
|
};
|
|
14035
14082
|
}
|
|
14036
14083
|
|
|
14037
|
-
function discover(onPrior, onAfter) {
|
|
14038
|
-
return new Promise((resolve) => {
|
|
14039
|
-
const discovery = /* @__PURE__ */ Object.create(null);
|
|
14040
|
-
const observer = new MutationObserver((mutations) => {
|
|
14041
|
-
for (const mutation of mutations) {
|
|
14042
|
-
mutation.addedNodes.forEach((node) => {
|
|
14043
|
-
node instanceof Element && onPrior({ node, discovery, announce });
|
|
14044
|
-
});
|
|
14045
|
-
}
|
|
14046
|
-
});
|
|
14047
|
-
observer.observe(document, {
|
|
14048
|
-
childList: true,
|
|
14049
|
-
subtree: true
|
|
14050
|
-
});
|
|
14051
|
-
document.addEventListener("DOMContentLoaded", () => {
|
|
14052
|
-
onAfter?.({ discovery, announce });
|
|
14053
|
-
announce();
|
|
14054
|
-
});
|
|
14055
|
-
function announce() {
|
|
14056
|
-
resolve(discovery);
|
|
14057
|
-
observer.disconnect();
|
|
14058
|
-
}
|
|
14059
|
-
});
|
|
14060
|
-
}
|
|
14061
|
-
|
|
14062
|
-
function when(gist, verifyer = gist) {
|
|
14063
|
-
return function(classify) {
|
|
14064
|
-
const sym = Object.getOwnPropertySymbols(classify).find((sym2) => sym2.description === "default");
|
|
14065
|
-
const handler = classify[verifyer] ?? (sym && classify[sym]);
|
|
14066
|
-
return handler?.(gist);
|
|
14067
|
-
};
|
|
14068
|
-
}
|
|
14069
|
-
|
|
14070
14084
|
function getGlobalVars(astBody) {
|
|
14071
14085
|
return astBody.flatMap((node) => when(node, node.type)({
|
|
14072
14086
|
FunctionDeclaration: ({ id }) => id ? [id.name] : [],
|
|
@@ -14108,121 +14122,98 @@
|
|
|
14108
14122
|
};
|
|
14109
14123
|
}
|
|
14110
14124
|
|
|
14111
|
-
function
|
|
14125
|
+
function parseScript(scriptEl) {
|
|
14112
14126
|
const scriptContent = scriptEl?.textContent ?? "";
|
|
14113
|
-
|
|
14114
|
-
|
|
14115
|
-
|
|
14116
|
-
|
|
14117
|
-
|
|
14118
|
-
|
|
14127
|
+
when(scriptEl?.tagName ?? 0)({
|
|
14128
|
+
0: () => {
|
|
14129
|
+
scriptEl = document.createElement("script");
|
|
14130
|
+
document.head.appendChild(scriptEl);
|
|
14131
|
+
},
|
|
14132
|
+
SCRIPT: () => scriptEl.textContent = ""
|
|
14133
|
+
});
|
|
14119
14134
|
scriptEl.type = "module";
|
|
14120
14135
|
const { extractImport, getGlobalVars, isAsyncModule } = ast(scriptContent);
|
|
14121
14136
|
return {
|
|
14122
14137
|
scriptEl,
|
|
14123
|
-
|
|
14124
|
-
|
|
14125
|
-
|
|
14126
|
-
...extractImport()
|
|
14127
|
-
}
|
|
14138
|
+
retNames: getGlobalVars(),
|
|
14139
|
+
isAsync: isAsyncModule(),
|
|
14140
|
+
...extractImport()
|
|
14128
14141
|
};
|
|
14129
14142
|
}
|
|
14130
14143
|
|
|
14131
|
-
function
|
|
14132
|
-
const templateContent = templateEl?.innerHTML ??
|
|
14144
|
+
function parseTemplate(templateEl) {
|
|
14145
|
+
const templateContent = templateEl?.innerHTML ?? "not found <template>";
|
|
14133
14146
|
templateEl?.remove();
|
|
14134
|
-
return templateContent
|
|
14147
|
+
return templateContent;
|
|
14135
14148
|
}
|
|
14136
14149
|
|
|
14137
|
-
|
|
14138
|
-
|
|
14139
|
-
|
|
14140
|
-
|
|
14141
|
-
|
|
14142
|
-
|
|
14143
|
-
return TAG_TYPE2;
|
|
14144
|
-
})(TAG_TYPE || {});
|
|
14145
|
-
const root = {
|
|
14146
|
-
[SCRIPT_TAG]: {
|
|
14147
|
-
lose: () => console.warn(`not found ${SCRIPT_TAG} in top level for document`),
|
|
14148
|
-
excess: () => console.warn(`only one ${SCRIPT_TAG} is allowed in top level for document`),
|
|
14149
|
-
doBy: doByScript
|
|
14150
|
-
},
|
|
14151
|
-
[TEMPLATE_TAG]: {
|
|
14152
|
-
lose: () => console.error(`not found ${TEMPLATE_TAG} in top level for document`),
|
|
14153
|
-
excess: () => console.warn(`only one ${TEMPLATE_TAG} is allowed in top level for document`),
|
|
14154
|
-
doBy: doByTemplate
|
|
14155
|
-
}
|
|
14156
|
-
};
|
|
14150
|
+
function newTag(str, parse, logType, annotation) {
|
|
14151
|
+
return { str, parse, logType, beNoHere: annotation.replace(/%s/g, `${str} is not supposed to be here`) };
|
|
14152
|
+
}
|
|
14153
|
+
const tagScript = newTag("<script setup>", parseScript, { lose: console.warn, excess: console.warn }, "/* %s */");
|
|
14154
|
+
const tagTemplate = newTag("<template>", parseTemplate, { lose: console.error, excess: console.warn }, "<!-- %s -->");
|
|
14155
|
+
const tags = [tagScript, tagTemplate];
|
|
14157
14156
|
|
|
14158
|
-
|
|
14159
|
-
|
|
14160
|
-
|
|
14161
|
-
|
|
14162
|
-
|
|
14163
|
-
|
|
14164
|
-
|
|
14165
|
-
|
|
14166
|
-
|
|
14167
|
-
|
|
14168
|
-
|
|
14169
|
-
|
|
14170
|
-
if (discovery[TEMPLATE_TAG].count > 1) {
|
|
14171
|
-
root[TEMPLATE_TAG].excess();
|
|
14172
|
-
}
|
|
14157
|
+
function createBehavior(tag) {
|
|
14158
|
+
const { str, parse, logType: { lose, excess }, beNoHere } = tag;
|
|
14159
|
+
return {
|
|
14160
|
+
lose: () => false,
|
|
14161
|
+
excess: () => false,
|
|
14162
|
+
beNoHere: (node) => node.innerHTML = beNoHere,
|
|
14163
|
+
parse
|
|
14164
|
+
};
|
|
14165
|
+
}
|
|
14166
|
+
const behavior = {
|
|
14167
|
+
[tagScript.str]: createBehavior(tagScript),
|
|
14168
|
+
[tagTemplate.str]: createBehavior(tagTemplate)
|
|
14173
14169
|
};
|
|
14174
14170
|
|
|
14175
|
-
const
|
|
14176
|
-
|
|
14177
|
-
|
|
14178
|
-
|
|
14179
|
-
|
|
14180
|
-
|
|
14181
|
-
|
|
14182
|
-
|
|
14171
|
+
const onAfter = ({ discovery }) => {
|
|
14172
|
+
for (const { str } of tags) {
|
|
14173
|
+
const { count } = discovery[str];
|
|
14174
|
+
const { lose, excess, parse } = behavior[str];
|
|
14175
|
+
if (count === 0) {
|
|
14176
|
+
lose();
|
|
14177
|
+
discovery[str].parsed = parse();
|
|
14178
|
+
}
|
|
14179
|
+
count > 1 && excess();
|
|
14183
14180
|
}
|
|
14184
14181
|
};
|
|
14185
14182
|
|
|
14186
|
-
function
|
|
14187
|
-
|
|
14188
|
-
const parse = new DOMParser();
|
|
14189
|
-
const aimEl = parse.parseFromString(`<body>${targetHtml}</body>`, "text/html").body.firstElementChild;
|
|
14190
|
-
const isTag = aimEl?.tagName === el.tagName;
|
|
14191
|
-
const nodeAttrs = el.getAttributeNames();
|
|
14192
|
-
const aimAttrs = aimEl?.getAttributeNames() ?? [];
|
|
14193
|
-
const hasAttr = aimAttrs?.every((attr) => nodeAttrs.includes(attr));
|
|
14194
|
-
return isTag && hasAttr;
|
|
14195
|
-
} catch {
|
|
14196
|
-
return false;
|
|
14197
|
-
}
|
|
14183
|
+
function newCarrier(count, parsed) {
|
|
14184
|
+
return { count, parsed };
|
|
14198
14185
|
}
|
|
14186
|
+
const carrier = {
|
|
14187
|
+
[tagScript.str]: newCarrier(0, null),
|
|
14188
|
+
[tagTemplate.str]: newCarrier(0, null)
|
|
14189
|
+
};
|
|
14199
14190
|
|
|
14191
|
+
var state = /* @__PURE__ */ ((state2) => {
|
|
14192
|
+
state2[state2["WITHOUT"] = 0] = "WITHOUT";
|
|
14193
|
+
state2[state2["RELATE"] = 1] = "RELATE";
|
|
14194
|
+
state2[state2["CORRECT"] = 2] = "CORRECT";
|
|
14195
|
+
return state2;
|
|
14196
|
+
})(state || {});
|
|
14197
|
+
const { WITHOUT, RELATE, CORRECT } = state;
|
|
14200
14198
|
const onPrior = ({ node, discovery }) => {
|
|
14201
|
-
Object.assign(discovery,
|
|
14202
|
-
function
|
|
14203
|
-
if (!isElMatch(node, tag))
|
|
14204
|
-
|
|
14205
|
-
|
|
14206
|
-
|
|
14207
|
-
|
|
14208
|
-
|
|
14209
|
-
|
|
14210
|
-
|
|
14211
|
-
if (
|
|
14212
|
-
|
|
14213
|
-
|
|
14214
|
-
}
|
|
14215
|
-
discovery[
|
|
14216
|
-
}
|
|
14217
|
-
if (
|
|
14218
|
-
|
|
14219
|
-
discovery[SCRIPT_TAG].parsed = root[SCRIPT_TAG].doBy(node);
|
|
14220
|
-
discovery[SCRIPT_TAG].count = 0;
|
|
14221
|
-
}
|
|
14222
|
-
discovery[SCRIPT_TAG].count++;
|
|
14223
|
-
}
|
|
14224
|
-
if (_isRoot(SCRIPT_TAG) === TAG_TYPE.RELATE)
|
|
14225
|
-
node.innerHTML = "/* Resolved to the wrong location */";
|
|
14199
|
+
Object.assign(discovery, carrier);
|
|
14200
|
+
function _getState(tag) {
|
|
14201
|
+
if (!isElMatch(node, tag)) return WITHOUT;
|
|
14202
|
+
if (node.parentElement === document.head) return CORRECT;
|
|
14203
|
+
else return RELATE;
|
|
14204
|
+
}
|
|
14205
|
+
for (const { str } of tags) {
|
|
14206
|
+
if (_getState(str) !== CORRECT) continue;
|
|
14207
|
+
const { parse, beNoHere } = behavior[str];
|
|
14208
|
+
discovery[str].count++;
|
|
14209
|
+
if (discovery[str].count !== 1) {
|
|
14210
|
+
beNoHere(node);
|
|
14211
|
+
continue;
|
|
14212
|
+
}
|
|
14213
|
+
discovery[str].parsed = parse(node);
|
|
14214
|
+
}
|
|
14215
|
+
if (_getState(tagScript.str) === RELATE)
|
|
14216
|
+
behavior[tagScript.str].beNoHere(node);
|
|
14226
14217
|
};
|
|
14227
14218
|
|
|
14228
14219
|
/**
|
|
@@ -14408,25 +14399,21 @@
|
|
|
14408
14399
|
withScopeId: nm
|
|
14409
14400
|
}, Symbol.toStringTag, { value: 'Module' }));
|
|
14410
14401
|
|
|
14411
|
-
function generate(
|
|
14412
|
-
|
|
14413
|
-
const
|
|
14414
|
-
|
|
14415
|
-
|
|
14416
|
-
|
|
14402
|
+
function generate(templateCode, context) {
|
|
14403
|
+
document.body.innerHTML = templateCode;
|
|
14404
|
+
const demandRex = new RegExp(`\\b${Object.keys(window.Vue = Vue).join("\\b|\\b")}\\b`, "g");
|
|
14405
|
+
const { scriptEl, importsCode, setupCode, retNames, isAsync } = context;
|
|
14406
|
+
const async = isAsync ? "async" : "";
|
|
14407
|
+
const appComp = `{template:document.body.innerHTML,${async} setup(){${setupCode}return{${retNames}}}}`;
|
|
14417
14408
|
const suspenseComp = `{components:{c:${appComp}},template:'<Suspense><c/></Suspense>'}`;
|
|
14418
14409
|
const createApp = `createApp(${isAsync ? suspenseComp : appComp}).mount(document.body);`;
|
|
14419
|
-
const autoImport = `const {
|
|
14420
|
-
|
|
14421
|
-
return importsCode + autoImport + siteClear + createApp;
|
|
14410
|
+
const autoImport = `const {createApp,${[...new Set(setupCode.match(demandRex))]}}=Vue;`;
|
|
14411
|
+
scriptEl.innerHTML = importsCode + autoImport + createApp;
|
|
14422
14412
|
}
|
|
14423
14413
|
|
|
14424
|
-
const origin = discover(onPrior, onAfter);
|
|
14425
14414
|
(async () => {
|
|
14426
|
-
const
|
|
14427
|
-
|
|
14428
|
-
const templateContent = terminal[TEMPLATE_TAG].parsed;
|
|
14429
|
-
scriptEl.textContent = generate(templateContent, context);
|
|
14415
|
+
const discovery = await discover(onPrior, onAfter);
|
|
14416
|
+
generate(discovery[tagTemplate.str].parsed, discovery[tagScript.str].parsed);
|
|
14430
14417
|
})();
|
|
14431
14418
|
|
|
14432
14419
|
})();
|