@danielx/civet 0.5.89 → 0.5.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +192 -85
- package/dist/main.js +192 -85
- package/dist/main.mjs +192 -85
- package/package.json +1 -1
package/dist/browser.js
CHANGED
|
@@ -436,16 +436,18 @@ var Civet = (() => {
|
|
|
436
436
|
}
|
|
437
437
|
let [splices, thisAssignments] = gatherBindingCode(id);
|
|
438
438
|
splices = splices.map((s) => [", ", s]);
|
|
439
|
-
thisAssignments = thisAssignments.map((a) => ["
|
|
439
|
+
thisAssignments = thisAssignments.map((a) => ["", a, ";"]);
|
|
440
440
|
const binding = [c, id, suffix, ...ws];
|
|
441
|
-
const initializer = [ca, e
|
|
441
|
+
const initializer = [ca, e];
|
|
442
442
|
const children = [binding, initializer];
|
|
443
443
|
return {
|
|
444
444
|
type: "Declaration",
|
|
445
445
|
names: id.names,
|
|
446
446
|
children,
|
|
447
447
|
binding,
|
|
448
|
-
initializer
|
|
448
|
+
initializer,
|
|
449
|
+
splices,
|
|
450
|
+
thisAssignments
|
|
449
451
|
};
|
|
450
452
|
}
|
|
451
453
|
function processLetAssignmentDeclaration(l, id, suffix, ws, la, e) {
|
|
@@ -458,18 +460,87 @@ var Civet = (() => {
|
|
|
458
460
|
};
|
|
459
461
|
let [splices, thisAssignments] = gatherBindingCode(id);
|
|
460
462
|
splices = splices.map((s) => [", ", s]);
|
|
461
|
-
thisAssignments = thisAssignments.map((a) => ["
|
|
463
|
+
thisAssignments = thisAssignments.map((a) => ["", a, ";"]);
|
|
462
464
|
const binding = [l, id, suffix, ...ws];
|
|
463
|
-
const initializer = [la, e
|
|
465
|
+
const initializer = [la, e];
|
|
464
466
|
const children = [binding, initializer];
|
|
465
467
|
return {
|
|
466
468
|
type: "Declaration",
|
|
467
469
|
names: id.names,
|
|
468
470
|
children,
|
|
469
471
|
binding,
|
|
470
|
-
initializer
|
|
472
|
+
initializer,
|
|
473
|
+
splices,
|
|
474
|
+
thisAssignments
|
|
471
475
|
};
|
|
472
476
|
}
|
|
477
|
+
function processUnaryExpression(pre, exp, post) {
|
|
478
|
+
if (post?.token === "?") {
|
|
479
|
+
post = {
|
|
480
|
+
$loc: post.$loc,
|
|
481
|
+
token: " != null"
|
|
482
|
+
};
|
|
483
|
+
switch (exp.type) {
|
|
484
|
+
case "Identifier":
|
|
485
|
+
case "Literal":
|
|
486
|
+
return {
|
|
487
|
+
...exp,
|
|
488
|
+
children: [...pre, ...exp.children, post]
|
|
489
|
+
};
|
|
490
|
+
default:
|
|
491
|
+
const expression = {
|
|
492
|
+
...exp,
|
|
493
|
+
children: [...pre, "(", exp.children, ")", post]
|
|
494
|
+
};
|
|
495
|
+
return {
|
|
496
|
+
type: "ParenthesizedExpression",
|
|
497
|
+
children: ["(", expression, ")"],
|
|
498
|
+
expression
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
if (exp.type === "Literal") {
|
|
503
|
+
if (pre.length === 1 && pre[0].token === "-") {
|
|
504
|
+
const children = [pre[0], ...exp.children];
|
|
505
|
+
if (post)
|
|
506
|
+
exp.children.push(post);
|
|
507
|
+
return {
|
|
508
|
+
type: "Literal",
|
|
509
|
+
children,
|
|
510
|
+
raw: `-${exp.raw}`
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
const l = pre.length;
|
|
515
|
+
if (l) {
|
|
516
|
+
const last = pre[l - 1];
|
|
517
|
+
if (last.type === "Await" && last.op) {
|
|
518
|
+
if (exp.type !== "ParenthesizedExpression") {
|
|
519
|
+
exp = ["(", exp, ")"];
|
|
520
|
+
}
|
|
521
|
+
exp = {
|
|
522
|
+
type: "CallExpression",
|
|
523
|
+
children: [" Promise", last.op, exp]
|
|
524
|
+
};
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
if (exp.children) {
|
|
528
|
+
const children = [...pre, ...exp.children];
|
|
529
|
+
if (post)
|
|
530
|
+
children.push(post);
|
|
531
|
+
return Object.assign({}, exp, { children });
|
|
532
|
+
} else if (Array.isArray(exp)) {
|
|
533
|
+
const children = [...pre, ...exp];
|
|
534
|
+
if (post)
|
|
535
|
+
children.push(post);
|
|
536
|
+
return { children };
|
|
537
|
+
} else {
|
|
538
|
+
const children = [...pre, exp];
|
|
539
|
+
if (post)
|
|
540
|
+
children.push(post);
|
|
541
|
+
return { children };
|
|
542
|
+
}
|
|
543
|
+
}
|
|
473
544
|
module.exports = {
|
|
474
545
|
blockWithPrefix,
|
|
475
546
|
clone,
|
|
@@ -493,6 +564,7 @@ var Civet = (() => {
|
|
|
493
564
|
processCoffeeInterpolation,
|
|
494
565
|
processConstAssignmentDeclaration,
|
|
495
566
|
processLetAssignmentDeclaration,
|
|
567
|
+
processUnaryExpression,
|
|
496
568
|
quoteString,
|
|
497
569
|
removeParentPointers
|
|
498
570
|
};
|
|
@@ -1116,6 +1188,7 @@ ${input.slice(result.pos)}
|
|
|
1116
1188
|
Xor,
|
|
1117
1189
|
Xnor,
|
|
1118
1190
|
UnaryOp,
|
|
1191
|
+
AwaitOp,
|
|
1119
1192
|
ModuleItem,
|
|
1120
1193
|
StatementListItem,
|
|
1121
1194
|
PostfixedStatement,
|
|
@@ -2659,7 +2732,7 @@ ${input.slice(result.pos)}
|
|
|
2659
2732
|
var pre = $1;
|
|
2660
2733
|
var exp = $2;
|
|
2661
2734
|
var post = $3;
|
|
2662
|
-
return
|
|
2735
|
+
return processUnaryExpression(pre, exp, post);
|
|
2663
2736
|
});
|
|
2664
2737
|
var UnaryExpression$1 = $TS($S(CoffeeDoEnabled, Do, __, $C($S(LeftHandSideExpression, $N($S(__, AssignmentOpSymbol))), ArrowFunction, ExtendedExpression)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
2665
2738
|
var ws = $3;
|
|
@@ -9070,8 +9143,9 @@ ${input.slice(result.pos)}
|
|
|
9070
9143
|
var UnaryOp$0 = $TR($EXPECT($R9, fail, "UnaryOp /(?!\\+\\+|--)[!~+-](?!\\s|[!~+-]*&)/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
9071
9144
|
return { $loc, token: $0 };
|
|
9072
9145
|
});
|
|
9073
|
-
var UnaryOp$1 =
|
|
9074
|
-
var UnaryOp$2 =
|
|
9146
|
+
var UnaryOp$1 = AwaitOp;
|
|
9147
|
+
var UnaryOp$2 = $S($C(Delete, Void, Typeof), $E(_));
|
|
9148
|
+
var UnaryOp$3 = Not;
|
|
9075
9149
|
function UnaryOp(state) {
|
|
9076
9150
|
let eventData;
|
|
9077
9151
|
if (state.events) {
|
|
@@ -9083,17 +9157,52 @@ ${input.slice(result.pos)}
|
|
|
9083
9157
|
}
|
|
9084
9158
|
}
|
|
9085
9159
|
if (state.tokenize) {
|
|
9086
|
-
const result = $TOKEN("UnaryOp", state, UnaryOp$0(state) || UnaryOp$1(state) || UnaryOp$2(state));
|
|
9160
|
+
const result = $TOKEN("UnaryOp", state, UnaryOp$0(state) || UnaryOp$1(state) || UnaryOp$2(state) || UnaryOp$3(state));
|
|
9087
9161
|
if (state.events)
|
|
9088
9162
|
state.events.exit?.("UnaryOp", state, result, eventData);
|
|
9089
9163
|
return result;
|
|
9090
9164
|
} else {
|
|
9091
|
-
const result = UnaryOp$0(state) || UnaryOp$1(state) || UnaryOp$2(state);
|
|
9165
|
+
const result = UnaryOp$0(state) || UnaryOp$1(state) || UnaryOp$2(state) || UnaryOp$3(state);
|
|
9092
9166
|
if (state.events)
|
|
9093
9167
|
state.events.exit?.("UnaryOp", state, result, eventData);
|
|
9094
9168
|
return result;
|
|
9095
9169
|
}
|
|
9096
9170
|
}
|
|
9171
|
+
var AwaitOp$0 = $TS($S(Await, $E($S(Dot, IdentifierName)), $C(_, $Y(OpenParen))), function($skip, $loc, $0, $1, $2, $3) {
|
|
9172
|
+
var a = $1;
|
|
9173
|
+
var op = $2;
|
|
9174
|
+
var ws = $3;
|
|
9175
|
+
if (op) {
|
|
9176
|
+
return {
|
|
9177
|
+
...a,
|
|
9178
|
+
op,
|
|
9179
|
+
children: [a, ...ws || []]
|
|
9180
|
+
};
|
|
9181
|
+
}
|
|
9182
|
+
return [a, ...ws || []];
|
|
9183
|
+
});
|
|
9184
|
+
function AwaitOp(state) {
|
|
9185
|
+
let eventData;
|
|
9186
|
+
if (state.events) {
|
|
9187
|
+
const result = state.events.enter?.("AwaitOp", state);
|
|
9188
|
+
if (result) {
|
|
9189
|
+
if (result.cache)
|
|
9190
|
+
return result.cache;
|
|
9191
|
+
eventData = result.data;
|
|
9192
|
+
}
|
|
9193
|
+
}
|
|
9194
|
+
if (state.tokenize) {
|
|
9195
|
+
const result = $TOKEN("AwaitOp", state, AwaitOp$0(state));
|
|
9196
|
+
if (state.events)
|
|
9197
|
+
state.events.exit?.("AwaitOp", state, result, eventData);
|
|
9198
|
+
return result;
|
|
9199
|
+
} else {
|
|
9200
|
+
const result = AwaitOp$0(state);
|
|
9201
|
+
if (state.events)
|
|
9202
|
+
state.events.exit?.("AwaitOp", state, result, eventData);
|
|
9203
|
+
return result;
|
|
9204
|
+
}
|
|
9205
|
+
}
|
|
9097
9206
|
var ModuleItem$0 = ImportDeclaration;
|
|
9098
9207
|
var ModuleItem$1 = ExportDeclaration;
|
|
9099
9208
|
var ModuleItem$2 = StatementListItem;
|
|
@@ -11180,12 +11289,15 @@ ${input.slice(result.pos)}
|
|
|
11180
11289
|
type: "Ref",
|
|
11181
11290
|
base: "ref"
|
|
11182
11291
|
};
|
|
11183
|
-
const { binding, initializer } = dec;
|
|
11292
|
+
const { binding, initializer, splices, thisAssignments } = dec;
|
|
11184
11293
|
const initCondition = {
|
|
11185
11294
|
type: "AssignmentExpression",
|
|
11186
11295
|
children: [ref, " ", initializer],
|
|
11187
11296
|
hoistDec: [["", ["let ", ref], ";"]],
|
|
11188
|
-
blockPrefix: [
|
|
11297
|
+
blockPrefix: [
|
|
11298
|
+
["", [binding, "= ", ref, ...splices], ";"],
|
|
11299
|
+
...thisAssignments
|
|
11300
|
+
]
|
|
11189
11301
|
};
|
|
11190
11302
|
return initCondition;
|
|
11191
11303
|
});
|
|
@@ -12580,7 +12692,20 @@ ${input.slice(result.pos)}
|
|
|
12580
12692
|
}
|
|
12581
12693
|
var Declaration$0 = HoistableDeclaration;
|
|
12582
12694
|
var Declaration$1 = ClassDeclaration;
|
|
12583
|
-
var Declaration$2 = LexicalDeclaration
|
|
12695
|
+
var Declaration$2 = $TV(LexicalDeclaration, function($skip, $loc, $0, $1) {
|
|
12696
|
+
var d = $0;
|
|
12697
|
+
if (d.thisAssignments?.length)
|
|
12698
|
+
return {
|
|
12699
|
+
...d,
|
|
12700
|
+
children: [...d.children, ...d.splices, ";", ...d.thisAssignments]
|
|
12701
|
+
};
|
|
12702
|
+
if (d.splices?.length)
|
|
12703
|
+
return {
|
|
12704
|
+
...d,
|
|
12705
|
+
children: [...d.children, ...d.splices]
|
|
12706
|
+
};
|
|
12707
|
+
return d;
|
|
12708
|
+
});
|
|
12584
12709
|
var Declaration$3 = TypeDeclaration;
|
|
12585
12710
|
var Declaration$4 = EnumDeclaration;
|
|
12586
12711
|
var Declaration$5 = OperatorDeclaration;
|
|
@@ -12630,12 +12755,21 @@ ${input.slice(result.pos)}
|
|
|
12630
12755
|
}
|
|
12631
12756
|
}
|
|
12632
12757
|
var LexicalDeclaration$0 = $TS($S(LetOrConst, LexicalBinding, $Q($S(__, Comma, LexicalBinding))), function($skip, $loc, $0, $1, $2, $3) {
|
|
12758
|
+
var d = $1;
|
|
12633
12759
|
var binding = $2;
|
|
12634
12760
|
var tail = $3;
|
|
12761
|
+
const { splices, thisAssignments } = binding;
|
|
12635
12762
|
return {
|
|
12636
12763
|
type: "Declaration",
|
|
12637
12764
|
children: $0,
|
|
12638
|
-
names: [...binding.names].concat(tail.flatMap(([, , b]) => b.names))
|
|
12765
|
+
names: [...binding.names].concat(tail.flatMap(([, , b]) => b.names)),
|
|
12766
|
+
binding: {
|
|
12767
|
+
...binding.binding,
|
|
12768
|
+
children: [d, ...binding.binding.children]
|
|
12769
|
+
},
|
|
12770
|
+
initializer: binding.initializer,
|
|
12771
|
+
splices,
|
|
12772
|
+
thisAssignments
|
|
12639
12773
|
};
|
|
12640
12774
|
});
|
|
12641
12775
|
var LexicalDeclaration$1 = $TS($S(InsertConst, $C(BindingPattern, BindingIdentifier), $E(TypeSuffix), __, ConstAssignment, ExtendedExpression), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
@@ -12722,25 +12856,51 @@ ${input.slice(result.pos)}
|
|
|
12722
12856
|
return result;
|
|
12723
12857
|
}
|
|
12724
12858
|
}
|
|
12725
|
-
var LexicalBinding$0 = $TS($S(BindingPattern, $E(TypeSuffix), Initializer), function($skip, $loc, $0, $1, $2, $3) {
|
|
12726
|
-
|
|
12727
|
-
|
|
12728
|
-
|
|
12729
|
-
|
|
12859
|
+
var LexicalBinding$0 = $TS($S(BindingPattern, $E(TypeSuffix), $E(_), Initializer), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
12860
|
+
var binding = $1;
|
|
12861
|
+
var suffix = $2;
|
|
12862
|
+
var ws = $3;
|
|
12863
|
+
var initializer = $4;
|
|
12864
|
+
const bindingChildren = [...binding.children];
|
|
12865
|
+
if (suffix)
|
|
12866
|
+
bindingChildren.push(suffix);
|
|
12867
|
+
if (ws)
|
|
12868
|
+
bindingChildren.push(...ws);
|
|
12869
|
+
binding = {
|
|
12870
|
+
...binding,
|
|
12871
|
+
children: bindingChildren
|
|
12872
|
+
};
|
|
12873
|
+
const [splices, thisAssignments] = gatherBindingCode(binding.children);
|
|
12730
12874
|
return {
|
|
12731
|
-
children,
|
|
12732
|
-
names:
|
|
12875
|
+
children: [binding, initializer],
|
|
12876
|
+
names: binding.names,
|
|
12877
|
+
binding,
|
|
12878
|
+
initializer,
|
|
12879
|
+
splices: splices.map((s) => [",", s]),
|
|
12880
|
+
thisAssignments: thisAssignments.map((s) => ["", s, ";"])
|
|
12733
12881
|
};
|
|
12734
12882
|
});
|
|
12735
|
-
var LexicalBinding$1 = $TS($S(BindingIdentifier, $E(TypeSuffix), $E(Initializer)), function($skip, $loc, $0, $1, $2, $3) {
|
|
12736
|
-
|
|
12737
|
-
|
|
12738
|
-
|
|
12739
|
-
|
|
12740
|
-
|
|
12883
|
+
var LexicalBinding$1 = $TS($S(BindingIdentifier, $E(TypeSuffix), $E(_), $E(Initializer)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
12884
|
+
var binding = $1;
|
|
12885
|
+
var suffix = $2;
|
|
12886
|
+
var ws = $3;
|
|
12887
|
+
var initializer = $4;
|
|
12888
|
+
const bindingChildren = [...binding.children];
|
|
12889
|
+
if (suffix)
|
|
12890
|
+
bindingChildren.push(suffix);
|
|
12891
|
+
if (ws)
|
|
12892
|
+
bindingChildren.push(...ws);
|
|
12893
|
+
binding = {
|
|
12894
|
+
...binding,
|
|
12895
|
+
children: bindingChildren
|
|
12896
|
+
};
|
|
12741
12897
|
return {
|
|
12742
|
-
children,
|
|
12743
|
-
names:
|
|
12898
|
+
children: [binding, initializer],
|
|
12899
|
+
names: binding.names,
|
|
12900
|
+
binding,
|
|
12901
|
+
initializer,
|
|
12902
|
+
splices: [],
|
|
12903
|
+
thisAssignments: []
|
|
12744
12904
|
};
|
|
12745
12905
|
});
|
|
12746
12906
|
function LexicalBinding(state) {
|
|
@@ -17299,7 +17459,7 @@ ${input.slice(result.pos)}
|
|
|
17299
17459
|
var pre = $1;
|
|
17300
17460
|
var exp = $2;
|
|
17301
17461
|
var post = $3;
|
|
17302
|
-
return
|
|
17462
|
+
return processUnaryExpression(pre, exp, post);
|
|
17303
17463
|
});
|
|
17304
17464
|
function InlineJSXUnaryExpression(state) {
|
|
17305
17465
|
let eventData;
|
|
@@ -21189,60 +21349,6 @@ ${input.slice(result.pos)}
|
|
|
21189
21349
|
}
|
|
21190
21350
|
return node;
|
|
21191
21351
|
};
|
|
21192
|
-
module.processUnaryExpression = (pre, exp, post) => {
|
|
21193
|
-
if (post?.token === "?") {
|
|
21194
|
-
post = {
|
|
21195
|
-
$loc: post.$loc,
|
|
21196
|
-
token: " != null"
|
|
21197
|
-
};
|
|
21198
|
-
switch (exp.type) {
|
|
21199
|
-
case "Identifier":
|
|
21200
|
-
case "Literal":
|
|
21201
|
-
return {
|
|
21202
|
-
...exp,
|
|
21203
|
-
children: [...pre, ...exp.children, post]
|
|
21204
|
-
};
|
|
21205
|
-
default:
|
|
21206
|
-
const expression = {
|
|
21207
|
-
...exp,
|
|
21208
|
-
children: [...pre, "(", exp.children, ")", post]
|
|
21209
|
-
};
|
|
21210
|
-
return {
|
|
21211
|
-
type: "ParenthesizedExpression",
|
|
21212
|
-
children: ["(", expression, ")"],
|
|
21213
|
-
expression
|
|
21214
|
-
};
|
|
21215
|
-
}
|
|
21216
|
-
}
|
|
21217
|
-
if (exp.type === "Literal") {
|
|
21218
|
-
if (pre.length === 1 && pre[0].token === "-") {
|
|
21219
|
-
const children = [pre[0], ...exp.children];
|
|
21220
|
-
if (post)
|
|
21221
|
-
exp.children.push(post);
|
|
21222
|
-
return {
|
|
21223
|
-
type: "Literal",
|
|
21224
|
-
children,
|
|
21225
|
-
raw: `-${exp.raw}`
|
|
21226
|
-
};
|
|
21227
|
-
}
|
|
21228
|
-
}
|
|
21229
|
-
if (exp.children) {
|
|
21230
|
-
const children = [...pre, ...exp.children];
|
|
21231
|
-
if (post)
|
|
21232
|
-
children.push(post);
|
|
21233
|
-
return Object.assign({}, exp, { children });
|
|
21234
|
-
} else if (Array.isArray(exp)) {
|
|
21235
|
-
const children = [...pre, ...exp];
|
|
21236
|
-
if (post)
|
|
21237
|
-
children.push(post);
|
|
21238
|
-
return { children };
|
|
21239
|
-
} else {
|
|
21240
|
-
const children = [...pre, exp];
|
|
21241
|
-
if (post)
|
|
21242
|
-
children.push(post);
|
|
21243
|
-
return { children };
|
|
21244
|
-
}
|
|
21245
|
-
};
|
|
21246
21352
|
module.needsRef = function(expression, base = "ref") {
|
|
21247
21353
|
switch (expression.type) {
|
|
21248
21354
|
case "Ref":
|
|
@@ -23186,6 +23292,7 @@ ${input.slice(result.pos)}
|
|
|
23186
23292
|
processCoffeeInterpolation,
|
|
23187
23293
|
processConstAssignmentDeclaration,
|
|
23188
23294
|
processLetAssignmentDeclaration,
|
|
23295
|
+
processUnaryExpression,
|
|
23189
23296
|
quoteString,
|
|
23190
23297
|
removeParentPointers
|
|
23191
23298
|
} = require_lib();
|
package/dist/main.js
CHANGED
|
@@ -435,16 +435,18 @@ var require_lib = __commonJS({
|
|
|
435
435
|
}
|
|
436
436
|
let [splices, thisAssignments] = gatherBindingCode(id);
|
|
437
437
|
splices = splices.map((s) => [", ", s]);
|
|
438
|
-
thisAssignments = thisAssignments.map((a) => ["
|
|
438
|
+
thisAssignments = thisAssignments.map((a) => ["", a, ";"]);
|
|
439
439
|
const binding = [c, id, suffix, ...ws];
|
|
440
|
-
const initializer = [ca, e
|
|
440
|
+
const initializer = [ca, e];
|
|
441
441
|
const children = [binding, initializer];
|
|
442
442
|
return {
|
|
443
443
|
type: "Declaration",
|
|
444
444
|
names: id.names,
|
|
445
445
|
children,
|
|
446
446
|
binding,
|
|
447
|
-
initializer
|
|
447
|
+
initializer,
|
|
448
|
+
splices,
|
|
449
|
+
thisAssignments
|
|
448
450
|
};
|
|
449
451
|
}
|
|
450
452
|
function processLetAssignmentDeclaration(l, id, suffix, ws, la, e) {
|
|
@@ -457,18 +459,87 @@ var require_lib = __commonJS({
|
|
|
457
459
|
};
|
|
458
460
|
let [splices, thisAssignments] = gatherBindingCode(id);
|
|
459
461
|
splices = splices.map((s) => [", ", s]);
|
|
460
|
-
thisAssignments = thisAssignments.map((a) => ["
|
|
462
|
+
thisAssignments = thisAssignments.map((a) => ["", a, ";"]);
|
|
461
463
|
const binding = [l, id, suffix, ...ws];
|
|
462
|
-
const initializer = [la, e
|
|
464
|
+
const initializer = [la, e];
|
|
463
465
|
const children = [binding, initializer];
|
|
464
466
|
return {
|
|
465
467
|
type: "Declaration",
|
|
466
468
|
names: id.names,
|
|
467
469
|
children,
|
|
468
470
|
binding,
|
|
469
|
-
initializer
|
|
471
|
+
initializer,
|
|
472
|
+
splices,
|
|
473
|
+
thisAssignments
|
|
470
474
|
};
|
|
471
475
|
}
|
|
476
|
+
function processUnaryExpression(pre, exp, post) {
|
|
477
|
+
if (post?.token === "?") {
|
|
478
|
+
post = {
|
|
479
|
+
$loc: post.$loc,
|
|
480
|
+
token: " != null"
|
|
481
|
+
};
|
|
482
|
+
switch (exp.type) {
|
|
483
|
+
case "Identifier":
|
|
484
|
+
case "Literal":
|
|
485
|
+
return {
|
|
486
|
+
...exp,
|
|
487
|
+
children: [...pre, ...exp.children, post]
|
|
488
|
+
};
|
|
489
|
+
default:
|
|
490
|
+
const expression = {
|
|
491
|
+
...exp,
|
|
492
|
+
children: [...pre, "(", exp.children, ")", post]
|
|
493
|
+
};
|
|
494
|
+
return {
|
|
495
|
+
type: "ParenthesizedExpression",
|
|
496
|
+
children: ["(", expression, ")"],
|
|
497
|
+
expression
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
if (exp.type === "Literal") {
|
|
502
|
+
if (pre.length === 1 && pre[0].token === "-") {
|
|
503
|
+
const children = [pre[0], ...exp.children];
|
|
504
|
+
if (post)
|
|
505
|
+
exp.children.push(post);
|
|
506
|
+
return {
|
|
507
|
+
type: "Literal",
|
|
508
|
+
children,
|
|
509
|
+
raw: `-${exp.raw}`
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
const l = pre.length;
|
|
514
|
+
if (l) {
|
|
515
|
+
const last = pre[l - 1];
|
|
516
|
+
if (last.type === "Await" && last.op) {
|
|
517
|
+
if (exp.type !== "ParenthesizedExpression") {
|
|
518
|
+
exp = ["(", exp, ")"];
|
|
519
|
+
}
|
|
520
|
+
exp = {
|
|
521
|
+
type: "CallExpression",
|
|
522
|
+
children: [" Promise", last.op, exp]
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
if (exp.children) {
|
|
527
|
+
const children = [...pre, ...exp.children];
|
|
528
|
+
if (post)
|
|
529
|
+
children.push(post);
|
|
530
|
+
return Object.assign({}, exp, { children });
|
|
531
|
+
} else if (Array.isArray(exp)) {
|
|
532
|
+
const children = [...pre, ...exp];
|
|
533
|
+
if (post)
|
|
534
|
+
children.push(post);
|
|
535
|
+
return { children };
|
|
536
|
+
} else {
|
|
537
|
+
const children = [...pre, exp];
|
|
538
|
+
if (post)
|
|
539
|
+
children.push(post);
|
|
540
|
+
return { children };
|
|
541
|
+
}
|
|
542
|
+
}
|
|
472
543
|
module2.exports = {
|
|
473
544
|
blockWithPrefix,
|
|
474
545
|
clone,
|
|
@@ -492,6 +563,7 @@ var require_lib = __commonJS({
|
|
|
492
563
|
processCoffeeInterpolation,
|
|
493
564
|
processConstAssignmentDeclaration,
|
|
494
565
|
processLetAssignmentDeclaration,
|
|
566
|
+
processUnaryExpression,
|
|
495
567
|
quoteString,
|
|
496
568
|
removeParentPointers
|
|
497
569
|
};
|
|
@@ -1115,6 +1187,7 @@ ${input.slice(result.pos)}
|
|
|
1115
1187
|
Xor,
|
|
1116
1188
|
Xnor,
|
|
1117
1189
|
UnaryOp,
|
|
1190
|
+
AwaitOp,
|
|
1118
1191
|
ModuleItem,
|
|
1119
1192
|
StatementListItem,
|
|
1120
1193
|
PostfixedStatement,
|
|
@@ -2658,7 +2731,7 @@ ${input.slice(result.pos)}
|
|
|
2658
2731
|
var pre = $1;
|
|
2659
2732
|
var exp = $2;
|
|
2660
2733
|
var post = $3;
|
|
2661
|
-
return
|
|
2734
|
+
return processUnaryExpression(pre, exp, post);
|
|
2662
2735
|
});
|
|
2663
2736
|
var UnaryExpression$1 = $TS($S(CoffeeDoEnabled, Do, __, $C($S(LeftHandSideExpression, $N($S(__, AssignmentOpSymbol))), ArrowFunction, ExtendedExpression)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
2664
2737
|
var ws = $3;
|
|
@@ -9069,8 +9142,9 @@ ${input.slice(result.pos)}
|
|
|
9069
9142
|
var UnaryOp$0 = $TR($EXPECT($R9, fail, "UnaryOp /(?!\\+\\+|--)[!~+-](?!\\s|[!~+-]*&)/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
9070
9143
|
return { $loc, token: $0 };
|
|
9071
9144
|
});
|
|
9072
|
-
var UnaryOp$1 =
|
|
9073
|
-
var UnaryOp$2 =
|
|
9145
|
+
var UnaryOp$1 = AwaitOp;
|
|
9146
|
+
var UnaryOp$2 = $S($C(Delete, Void, Typeof), $E(_));
|
|
9147
|
+
var UnaryOp$3 = Not;
|
|
9074
9148
|
function UnaryOp(state) {
|
|
9075
9149
|
let eventData;
|
|
9076
9150
|
if (state.events) {
|
|
@@ -9082,17 +9156,52 @@ ${input.slice(result.pos)}
|
|
|
9082
9156
|
}
|
|
9083
9157
|
}
|
|
9084
9158
|
if (state.tokenize) {
|
|
9085
|
-
const result = $TOKEN("UnaryOp", state, UnaryOp$0(state) || UnaryOp$1(state) || UnaryOp$2(state));
|
|
9159
|
+
const result = $TOKEN("UnaryOp", state, UnaryOp$0(state) || UnaryOp$1(state) || UnaryOp$2(state) || UnaryOp$3(state));
|
|
9086
9160
|
if (state.events)
|
|
9087
9161
|
state.events.exit?.("UnaryOp", state, result, eventData);
|
|
9088
9162
|
return result;
|
|
9089
9163
|
} else {
|
|
9090
|
-
const result = UnaryOp$0(state) || UnaryOp$1(state) || UnaryOp$2(state);
|
|
9164
|
+
const result = UnaryOp$0(state) || UnaryOp$1(state) || UnaryOp$2(state) || UnaryOp$3(state);
|
|
9091
9165
|
if (state.events)
|
|
9092
9166
|
state.events.exit?.("UnaryOp", state, result, eventData);
|
|
9093
9167
|
return result;
|
|
9094
9168
|
}
|
|
9095
9169
|
}
|
|
9170
|
+
var AwaitOp$0 = $TS($S(Await, $E($S(Dot, IdentifierName)), $C(_, $Y(OpenParen))), function($skip, $loc, $0, $1, $2, $3) {
|
|
9171
|
+
var a = $1;
|
|
9172
|
+
var op = $2;
|
|
9173
|
+
var ws = $3;
|
|
9174
|
+
if (op) {
|
|
9175
|
+
return {
|
|
9176
|
+
...a,
|
|
9177
|
+
op,
|
|
9178
|
+
children: [a, ...ws || []]
|
|
9179
|
+
};
|
|
9180
|
+
}
|
|
9181
|
+
return [a, ...ws || []];
|
|
9182
|
+
});
|
|
9183
|
+
function AwaitOp(state) {
|
|
9184
|
+
let eventData;
|
|
9185
|
+
if (state.events) {
|
|
9186
|
+
const result = state.events.enter?.("AwaitOp", state);
|
|
9187
|
+
if (result) {
|
|
9188
|
+
if (result.cache)
|
|
9189
|
+
return result.cache;
|
|
9190
|
+
eventData = result.data;
|
|
9191
|
+
}
|
|
9192
|
+
}
|
|
9193
|
+
if (state.tokenize) {
|
|
9194
|
+
const result = $TOKEN("AwaitOp", state, AwaitOp$0(state));
|
|
9195
|
+
if (state.events)
|
|
9196
|
+
state.events.exit?.("AwaitOp", state, result, eventData);
|
|
9197
|
+
return result;
|
|
9198
|
+
} else {
|
|
9199
|
+
const result = AwaitOp$0(state);
|
|
9200
|
+
if (state.events)
|
|
9201
|
+
state.events.exit?.("AwaitOp", state, result, eventData);
|
|
9202
|
+
return result;
|
|
9203
|
+
}
|
|
9204
|
+
}
|
|
9096
9205
|
var ModuleItem$0 = ImportDeclaration;
|
|
9097
9206
|
var ModuleItem$1 = ExportDeclaration;
|
|
9098
9207
|
var ModuleItem$2 = StatementListItem;
|
|
@@ -11179,12 +11288,15 @@ ${input.slice(result.pos)}
|
|
|
11179
11288
|
type: "Ref",
|
|
11180
11289
|
base: "ref"
|
|
11181
11290
|
};
|
|
11182
|
-
const { binding, initializer } = dec;
|
|
11291
|
+
const { binding, initializer, splices, thisAssignments } = dec;
|
|
11183
11292
|
const initCondition = {
|
|
11184
11293
|
type: "AssignmentExpression",
|
|
11185
11294
|
children: [ref, " ", initializer],
|
|
11186
11295
|
hoistDec: [["", ["let ", ref], ";"]],
|
|
11187
|
-
blockPrefix: [
|
|
11296
|
+
blockPrefix: [
|
|
11297
|
+
["", [binding, "= ", ref, ...splices], ";"],
|
|
11298
|
+
...thisAssignments
|
|
11299
|
+
]
|
|
11188
11300
|
};
|
|
11189
11301
|
return initCondition;
|
|
11190
11302
|
});
|
|
@@ -12579,7 +12691,20 @@ ${input.slice(result.pos)}
|
|
|
12579
12691
|
}
|
|
12580
12692
|
var Declaration$0 = HoistableDeclaration;
|
|
12581
12693
|
var Declaration$1 = ClassDeclaration;
|
|
12582
|
-
var Declaration$2 = LexicalDeclaration
|
|
12694
|
+
var Declaration$2 = $TV(LexicalDeclaration, function($skip, $loc, $0, $1) {
|
|
12695
|
+
var d = $0;
|
|
12696
|
+
if (d.thisAssignments?.length)
|
|
12697
|
+
return {
|
|
12698
|
+
...d,
|
|
12699
|
+
children: [...d.children, ...d.splices, ";", ...d.thisAssignments]
|
|
12700
|
+
};
|
|
12701
|
+
if (d.splices?.length)
|
|
12702
|
+
return {
|
|
12703
|
+
...d,
|
|
12704
|
+
children: [...d.children, ...d.splices]
|
|
12705
|
+
};
|
|
12706
|
+
return d;
|
|
12707
|
+
});
|
|
12583
12708
|
var Declaration$3 = TypeDeclaration;
|
|
12584
12709
|
var Declaration$4 = EnumDeclaration;
|
|
12585
12710
|
var Declaration$5 = OperatorDeclaration;
|
|
@@ -12629,12 +12754,21 @@ ${input.slice(result.pos)}
|
|
|
12629
12754
|
}
|
|
12630
12755
|
}
|
|
12631
12756
|
var LexicalDeclaration$0 = $TS($S(LetOrConst, LexicalBinding, $Q($S(__, Comma, LexicalBinding))), function($skip, $loc, $0, $1, $2, $3) {
|
|
12757
|
+
var d = $1;
|
|
12632
12758
|
var binding = $2;
|
|
12633
12759
|
var tail = $3;
|
|
12760
|
+
const { splices, thisAssignments } = binding;
|
|
12634
12761
|
return {
|
|
12635
12762
|
type: "Declaration",
|
|
12636
12763
|
children: $0,
|
|
12637
|
-
names: [...binding.names].concat(tail.flatMap(([, , b]) => b.names))
|
|
12764
|
+
names: [...binding.names].concat(tail.flatMap(([, , b]) => b.names)),
|
|
12765
|
+
binding: {
|
|
12766
|
+
...binding.binding,
|
|
12767
|
+
children: [d, ...binding.binding.children]
|
|
12768
|
+
},
|
|
12769
|
+
initializer: binding.initializer,
|
|
12770
|
+
splices,
|
|
12771
|
+
thisAssignments
|
|
12638
12772
|
};
|
|
12639
12773
|
});
|
|
12640
12774
|
var LexicalDeclaration$1 = $TS($S(InsertConst, $C(BindingPattern, BindingIdentifier), $E(TypeSuffix), __, ConstAssignment, ExtendedExpression), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
@@ -12721,25 +12855,51 @@ ${input.slice(result.pos)}
|
|
|
12721
12855
|
return result;
|
|
12722
12856
|
}
|
|
12723
12857
|
}
|
|
12724
|
-
var LexicalBinding$0 = $TS($S(BindingPattern, $E(TypeSuffix), Initializer), function($skip, $loc, $0, $1, $2, $3) {
|
|
12725
|
-
|
|
12726
|
-
|
|
12727
|
-
|
|
12728
|
-
|
|
12858
|
+
var LexicalBinding$0 = $TS($S(BindingPattern, $E(TypeSuffix), $E(_), Initializer), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
12859
|
+
var binding = $1;
|
|
12860
|
+
var suffix = $2;
|
|
12861
|
+
var ws = $3;
|
|
12862
|
+
var initializer = $4;
|
|
12863
|
+
const bindingChildren = [...binding.children];
|
|
12864
|
+
if (suffix)
|
|
12865
|
+
bindingChildren.push(suffix);
|
|
12866
|
+
if (ws)
|
|
12867
|
+
bindingChildren.push(...ws);
|
|
12868
|
+
binding = {
|
|
12869
|
+
...binding,
|
|
12870
|
+
children: bindingChildren
|
|
12871
|
+
};
|
|
12872
|
+
const [splices, thisAssignments] = gatherBindingCode(binding.children);
|
|
12729
12873
|
return {
|
|
12730
|
-
children,
|
|
12731
|
-
names:
|
|
12874
|
+
children: [binding, initializer],
|
|
12875
|
+
names: binding.names,
|
|
12876
|
+
binding,
|
|
12877
|
+
initializer,
|
|
12878
|
+
splices: splices.map((s) => [",", s]),
|
|
12879
|
+
thisAssignments: thisAssignments.map((s) => ["", s, ";"])
|
|
12732
12880
|
};
|
|
12733
12881
|
});
|
|
12734
|
-
var LexicalBinding$1 = $TS($S(BindingIdentifier, $E(TypeSuffix), $E(Initializer)), function($skip, $loc, $0, $1, $2, $3) {
|
|
12735
|
-
|
|
12736
|
-
|
|
12737
|
-
|
|
12738
|
-
|
|
12739
|
-
|
|
12882
|
+
var LexicalBinding$1 = $TS($S(BindingIdentifier, $E(TypeSuffix), $E(_), $E(Initializer)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
12883
|
+
var binding = $1;
|
|
12884
|
+
var suffix = $2;
|
|
12885
|
+
var ws = $3;
|
|
12886
|
+
var initializer = $4;
|
|
12887
|
+
const bindingChildren = [...binding.children];
|
|
12888
|
+
if (suffix)
|
|
12889
|
+
bindingChildren.push(suffix);
|
|
12890
|
+
if (ws)
|
|
12891
|
+
bindingChildren.push(...ws);
|
|
12892
|
+
binding = {
|
|
12893
|
+
...binding,
|
|
12894
|
+
children: bindingChildren
|
|
12895
|
+
};
|
|
12740
12896
|
return {
|
|
12741
|
-
children,
|
|
12742
|
-
names:
|
|
12897
|
+
children: [binding, initializer],
|
|
12898
|
+
names: binding.names,
|
|
12899
|
+
binding,
|
|
12900
|
+
initializer,
|
|
12901
|
+
splices: [],
|
|
12902
|
+
thisAssignments: []
|
|
12743
12903
|
};
|
|
12744
12904
|
});
|
|
12745
12905
|
function LexicalBinding(state) {
|
|
@@ -17298,7 +17458,7 @@ ${input.slice(result.pos)}
|
|
|
17298
17458
|
var pre = $1;
|
|
17299
17459
|
var exp = $2;
|
|
17300
17460
|
var post = $3;
|
|
17301
|
-
return
|
|
17461
|
+
return processUnaryExpression(pre, exp, post);
|
|
17302
17462
|
});
|
|
17303
17463
|
function InlineJSXUnaryExpression(state) {
|
|
17304
17464
|
let eventData;
|
|
@@ -21188,60 +21348,6 @@ ${input.slice(result.pos)}
|
|
|
21188
21348
|
}
|
|
21189
21349
|
return node;
|
|
21190
21350
|
};
|
|
21191
|
-
module2.processUnaryExpression = (pre, exp, post) => {
|
|
21192
|
-
if (post?.token === "?") {
|
|
21193
|
-
post = {
|
|
21194
|
-
$loc: post.$loc,
|
|
21195
|
-
token: " != null"
|
|
21196
|
-
};
|
|
21197
|
-
switch (exp.type) {
|
|
21198
|
-
case "Identifier":
|
|
21199
|
-
case "Literal":
|
|
21200
|
-
return {
|
|
21201
|
-
...exp,
|
|
21202
|
-
children: [...pre, ...exp.children, post]
|
|
21203
|
-
};
|
|
21204
|
-
default:
|
|
21205
|
-
const expression = {
|
|
21206
|
-
...exp,
|
|
21207
|
-
children: [...pre, "(", exp.children, ")", post]
|
|
21208
|
-
};
|
|
21209
|
-
return {
|
|
21210
|
-
type: "ParenthesizedExpression",
|
|
21211
|
-
children: ["(", expression, ")"],
|
|
21212
|
-
expression
|
|
21213
|
-
};
|
|
21214
|
-
}
|
|
21215
|
-
}
|
|
21216
|
-
if (exp.type === "Literal") {
|
|
21217
|
-
if (pre.length === 1 && pre[0].token === "-") {
|
|
21218
|
-
const children = [pre[0], ...exp.children];
|
|
21219
|
-
if (post)
|
|
21220
|
-
exp.children.push(post);
|
|
21221
|
-
return {
|
|
21222
|
-
type: "Literal",
|
|
21223
|
-
children,
|
|
21224
|
-
raw: `-${exp.raw}`
|
|
21225
|
-
};
|
|
21226
|
-
}
|
|
21227
|
-
}
|
|
21228
|
-
if (exp.children) {
|
|
21229
|
-
const children = [...pre, ...exp.children];
|
|
21230
|
-
if (post)
|
|
21231
|
-
children.push(post);
|
|
21232
|
-
return Object.assign({}, exp, { children });
|
|
21233
|
-
} else if (Array.isArray(exp)) {
|
|
21234
|
-
const children = [...pre, ...exp];
|
|
21235
|
-
if (post)
|
|
21236
|
-
children.push(post);
|
|
21237
|
-
return { children };
|
|
21238
|
-
} else {
|
|
21239
|
-
const children = [...pre, exp];
|
|
21240
|
-
if (post)
|
|
21241
|
-
children.push(post);
|
|
21242
|
-
return { children };
|
|
21243
|
-
}
|
|
21244
|
-
};
|
|
21245
21351
|
module2.needsRef = function(expression, base = "ref") {
|
|
21246
21352
|
switch (expression.type) {
|
|
21247
21353
|
case "Ref":
|
|
@@ -23185,6 +23291,7 @@ ${input.slice(result.pos)}
|
|
|
23185
23291
|
processCoffeeInterpolation,
|
|
23186
23292
|
processConstAssignmentDeclaration,
|
|
23187
23293
|
processLetAssignmentDeclaration,
|
|
23294
|
+
processUnaryExpression,
|
|
23188
23295
|
quoteString,
|
|
23189
23296
|
removeParentPointers
|
|
23190
23297
|
} = require_lib();
|
package/dist/main.mjs
CHANGED
|
@@ -433,16 +433,18 @@ var require_lib = __commonJS({
|
|
|
433
433
|
}
|
|
434
434
|
let [splices, thisAssignments] = gatherBindingCode(id);
|
|
435
435
|
splices = splices.map((s) => [", ", s]);
|
|
436
|
-
thisAssignments = thisAssignments.map((a) => ["
|
|
436
|
+
thisAssignments = thisAssignments.map((a) => ["", a, ";"]);
|
|
437
437
|
const binding = [c, id, suffix, ...ws];
|
|
438
|
-
const initializer = [ca, e
|
|
438
|
+
const initializer = [ca, e];
|
|
439
439
|
const children = [binding, initializer];
|
|
440
440
|
return {
|
|
441
441
|
type: "Declaration",
|
|
442
442
|
names: id.names,
|
|
443
443
|
children,
|
|
444
444
|
binding,
|
|
445
|
-
initializer
|
|
445
|
+
initializer,
|
|
446
|
+
splices,
|
|
447
|
+
thisAssignments
|
|
446
448
|
};
|
|
447
449
|
}
|
|
448
450
|
function processLetAssignmentDeclaration(l, id, suffix, ws, la, e) {
|
|
@@ -455,18 +457,87 @@ var require_lib = __commonJS({
|
|
|
455
457
|
};
|
|
456
458
|
let [splices, thisAssignments] = gatherBindingCode(id);
|
|
457
459
|
splices = splices.map((s) => [", ", s]);
|
|
458
|
-
thisAssignments = thisAssignments.map((a) => ["
|
|
460
|
+
thisAssignments = thisAssignments.map((a) => ["", a, ";"]);
|
|
459
461
|
const binding = [l, id, suffix, ...ws];
|
|
460
|
-
const initializer = [la, e
|
|
462
|
+
const initializer = [la, e];
|
|
461
463
|
const children = [binding, initializer];
|
|
462
464
|
return {
|
|
463
465
|
type: "Declaration",
|
|
464
466
|
names: id.names,
|
|
465
467
|
children,
|
|
466
468
|
binding,
|
|
467
|
-
initializer
|
|
469
|
+
initializer,
|
|
470
|
+
splices,
|
|
471
|
+
thisAssignments
|
|
468
472
|
};
|
|
469
473
|
}
|
|
474
|
+
function processUnaryExpression(pre, exp, post) {
|
|
475
|
+
if (post?.token === "?") {
|
|
476
|
+
post = {
|
|
477
|
+
$loc: post.$loc,
|
|
478
|
+
token: " != null"
|
|
479
|
+
};
|
|
480
|
+
switch (exp.type) {
|
|
481
|
+
case "Identifier":
|
|
482
|
+
case "Literal":
|
|
483
|
+
return {
|
|
484
|
+
...exp,
|
|
485
|
+
children: [...pre, ...exp.children, post]
|
|
486
|
+
};
|
|
487
|
+
default:
|
|
488
|
+
const expression = {
|
|
489
|
+
...exp,
|
|
490
|
+
children: [...pre, "(", exp.children, ")", post]
|
|
491
|
+
};
|
|
492
|
+
return {
|
|
493
|
+
type: "ParenthesizedExpression",
|
|
494
|
+
children: ["(", expression, ")"],
|
|
495
|
+
expression
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
if (exp.type === "Literal") {
|
|
500
|
+
if (pre.length === 1 && pre[0].token === "-") {
|
|
501
|
+
const children = [pre[0], ...exp.children];
|
|
502
|
+
if (post)
|
|
503
|
+
exp.children.push(post);
|
|
504
|
+
return {
|
|
505
|
+
type: "Literal",
|
|
506
|
+
children,
|
|
507
|
+
raw: `-${exp.raw}`
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
const l = pre.length;
|
|
512
|
+
if (l) {
|
|
513
|
+
const last = pre[l - 1];
|
|
514
|
+
if (last.type === "Await" && last.op) {
|
|
515
|
+
if (exp.type !== "ParenthesizedExpression") {
|
|
516
|
+
exp = ["(", exp, ")"];
|
|
517
|
+
}
|
|
518
|
+
exp = {
|
|
519
|
+
type: "CallExpression",
|
|
520
|
+
children: [" Promise", last.op, exp]
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
if (exp.children) {
|
|
525
|
+
const children = [...pre, ...exp.children];
|
|
526
|
+
if (post)
|
|
527
|
+
children.push(post);
|
|
528
|
+
return Object.assign({}, exp, { children });
|
|
529
|
+
} else if (Array.isArray(exp)) {
|
|
530
|
+
const children = [...pre, ...exp];
|
|
531
|
+
if (post)
|
|
532
|
+
children.push(post);
|
|
533
|
+
return { children };
|
|
534
|
+
} else {
|
|
535
|
+
const children = [...pre, exp];
|
|
536
|
+
if (post)
|
|
537
|
+
children.push(post);
|
|
538
|
+
return { children };
|
|
539
|
+
}
|
|
540
|
+
}
|
|
470
541
|
module.exports = {
|
|
471
542
|
blockWithPrefix,
|
|
472
543
|
clone,
|
|
@@ -490,6 +561,7 @@ var require_lib = __commonJS({
|
|
|
490
561
|
processCoffeeInterpolation,
|
|
491
562
|
processConstAssignmentDeclaration,
|
|
492
563
|
processLetAssignmentDeclaration,
|
|
564
|
+
processUnaryExpression,
|
|
493
565
|
quoteString,
|
|
494
566
|
removeParentPointers
|
|
495
567
|
};
|
|
@@ -1113,6 +1185,7 @@ ${input.slice(result.pos)}
|
|
|
1113
1185
|
Xor,
|
|
1114
1186
|
Xnor,
|
|
1115
1187
|
UnaryOp,
|
|
1188
|
+
AwaitOp,
|
|
1116
1189
|
ModuleItem,
|
|
1117
1190
|
StatementListItem,
|
|
1118
1191
|
PostfixedStatement,
|
|
@@ -2656,7 +2729,7 @@ ${input.slice(result.pos)}
|
|
|
2656
2729
|
var pre = $1;
|
|
2657
2730
|
var exp = $2;
|
|
2658
2731
|
var post = $3;
|
|
2659
|
-
return
|
|
2732
|
+
return processUnaryExpression(pre, exp, post);
|
|
2660
2733
|
});
|
|
2661
2734
|
var UnaryExpression$1 = $TS($S(CoffeeDoEnabled, Do, __, $C($S(LeftHandSideExpression, $N($S(__, AssignmentOpSymbol))), ArrowFunction, ExtendedExpression)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
2662
2735
|
var ws = $3;
|
|
@@ -9067,8 +9140,9 @@ ${input.slice(result.pos)}
|
|
|
9067
9140
|
var UnaryOp$0 = $TR($EXPECT($R9, fail, "UnaryOp /(?!\\+\\+|--)[!~+-](?!\\s|[!~+-]*&)/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
9068
9141
|
return { $loc, token: $0 };
|
|
9069
9142
|
});
|
|
9070
|
-
var UnaryOp$1 =
|
|
9071
|
-
var UnaryOp$2 =
|
|
9143
|
+
var UnaryOp$1 = AwaitOp;
|
|
9144
|
+
var UnaryOp$2 = $S($C(Delete, Void, Typeof), $E(_));
|
|
9145
|
+
var UnaryOp$3 = Not;
|
|
9072
9146
|
function UnaryOp(state) {
|
|
9073
9147
|
let eventData;
|
|
9074
9148
|
if (state.events) {
|
|
@@ -9080,17 +9154,52 @@ ${input.slice(result.pos)}
|
|
|
9080
9154
|
}
|
|
9081
9155
|
}
|
|
9082
9156
|
if (state.tokenize) {
|
|
9083
|
-
const result = $TOKEN("UnaryOp", state, UnaryOp$0(state) || UnaryOp$1(state) || UnaryOp$2(state));
|
|
9157
|
+
const result = $TOKEN("UnaryOp", state, UnaryOp$0(state) || UnaryOp$1(state) || UnaryOp$2(state) || UnaryOp$3(state));
|
|
9084
9158
|
if (state.events)
|
|
9085
9159
|
state.events.exit?.("UnaryOp", state, result, eventData);
|
|
9086
9160
|
return result;
|
|
9087
9161
|
} else {
|
|
9088
|
-
const result = UnaryOp$0(state) || UnaryOp$1(state) || UnaryOp$2(state);
|
|
9162
|
+
const result = UnaryOp$0(state) || UnaryOp$1(state) || UnaryOp$2(state) || UnaryOp$3(state);
|
|
9089
9163
|
if (state.events)
|
|
9090
9164
|
state.events.exit?.("UnaryOp", state, result, eventData);
|
|
9091
9165
|
return result;
|
|
9092
9166
|
}
|
|
9093
9167
|
}
|
|
9168
|
+
var AwaitOp$0 = $TS($S(Await, $E($S(Dot, IdentifierName)), $C(_, $Y(OpenParen))), function($skip, $loc, $0, $1, $2, $3) {
|
|
9169
|
+
var a = $1;
|
|
9170
|
+
var op = $2;
|
|
9171
|
+
var ws = $3;
|
|
9172
|
+
if (op) {
|
|
9173
|
+
return {
|
|
9174
|
+
...a,
|
|
9175
|
+
op,
|
|
9176
|
+
children: [a, ...ws || []]
|
|
9177
|
+
};
|
|
9178
|
+
}
|
|
9179
|
+
return [a, ...ws || []];
|
|
9180
|
+
});
|
|
9181
|
+
function AwaitOp(state) {
|
|
9182
|
+
let eventData;
|
|
9183
|
+
if (state.events) {
|
|
9184
|
+
const result = state.events.enter?.("AwaitOp", state);
|
|
9185
|
+
if (result) {
|
|
9186
|
+
if (result.cache)
|
|
9187
|
+
return result.cache;
|
|
9188
|
+
eventData = result.data;
|
|
9189
|
+
}
|
|
9190
|
+
}
|
|
9191
|
+
if (state.tokenize) {
|
|
9192
|
+
const result = $TOKEN("AwaitOp", state, AwaitOp$0(state));
|
|
9193
|
+
if (state.events)
|
|
9194
|
+
state.events.exit?.("AwaitOp", state, result, eventData);
|
|
9195
|
+
return result;
|
|
9196
|
+
} else {
|
|
9197
|
+
const result = AwaitOp$0(state);
|
|
9198
|
+
if (state.events)
|
|
9199
|
+
state.events.exit?.("AwaitOp", state, result, eventData);
|
|
9200
|
+
return result;
|
|
9201
|
+
}
|
|
9202
|
+
}
|
|
9094
9203
|
var ModuleItem$0 = ImportDeclaration;
|
|
9095
9204
|
var ModuleItem$1 = ExportDeclaration;
|
|
9096
9205
|
var ModuleItem$2 = StatementListItem;
|
|
@@ -11177,12 +11286,15 @@ ${input.slice(result.pos)}
|
|
|
11177
11286
|
type: "Ref",
|
|
11178
11287
|
base: "ref"
|
|
11179
11288
|
};
|
|
11180
|
-
const { binding, initializer } = dec;
|
|
11289
|
+
const { binding, initializer, splices, thisAssignments } = dec;
|
|
11181
11290
|
const initCondition = {
|
|
11182
11291
|
type: "AssignmentExpression",
|
|
11183
11292
|
children: [ref, " ", initializer],
|
|
11184
11293
|
hoistDec: [["", ["let ", ref], ";"]],
|
|
11185
|
-
blockPrefix: [
|
|
11294
|
+
blockPrefix: [
|
|
11295
|
+
["", [binding, "= ", ref, ...splices], ";"],
|
|
11296
|
+
...thisAssignments
|
|
11297
|
+
]
|
|
11186
11298
|
};
|
|
11187
11299
|
return initCondition;
|
|
11188
11300
|
});
|
|
@@ -12577,7 +12689,20 @@ ${input.slice(result.pos)}
|
|
|
12577
12689
|
}
|
|
12578
12690
|
var Declaration$0 = HoistableDeclaration;
|
|
12579
12691
|
var Declaration$1 = ClassDeclaration;
|
|
12580
|
-
var Declaration$2 = LexicalDeclaration
|
|
12692
|
+
var Declaration$2 = $TV(LexicalDeclaration, function($skip, $loc, $0, $1) {
|
|
12693
|
+
var d = $0;
|
|
12694
|
+
if (d.thisAssignments?.length)
|
|
12695
|
+
return {
|
|
12696
|
+
...d,
|
|
12697
|
+
children: [...d.children, ...d.splices, ";", ...d.thisAssignments]
|
|
12698
|
+
};
|
|
12699
|
+
if (d.splices?.length)
|
|
12700
|
+
return {
|
|
12701
|
+
...d,
|
|
12702
|
+
children: [...d.children, ...d.splices]
|
|
12703
|
+
};
|
|
12704
|
+
return d;
|
|
12705
|
+
});
|
|
12581
12706
|
var Declaration$3 = TypeDeclaration;
|
|
12582
12707
|
var Declaration$4 = EnumDeclaration;
|
|
12583
12708
|
var Declaration$5 = OperatorDeclaration;
|
|
@@ -12627,12 +12752,21 @@ ${input.slice(result.pos)}
|
|
|
12627
12752
|
}
|
|
12628
12753
|
}
|
|
12629
12754
|
var LexicalDeclaration$0 = $TS($S(LetOrConst, LexicalBinding, $Q($S(__, Comma, LexicalBinding))), function($skip, $loc, $0, $1, $2, $3) {
|
|
12755
|
+
var d = $1;
|
|
12630
12756
|
var binding = $2;
|
|
12631
12757
|
var tail = $3;
|
|
12758
|
+
const { splices, thisAssignments } = binding;
|
|
12632
12759
|
return {
|
|
12633
12760
|
type: "Declaration",
|
|
12634
12761
|
children: $0,
|
|
12635
|
-
names: [...binding.names].concat(tail.flatMap(([, , b]) => b.names))
|
|
12762
|
+
names: [...binding.names].concat(tail.flatMap(([, , b]) => b.names)),
|
|
12763
|
+
binding: {
|
|
12764
|
+
...binding.binding,
|
|
12765
|
+
children: [d, ...binding.binding.children]
|
|
12766
|
+
},
|
|
12767
|
+
initializer: binding.initializer,
|
|
12768
|
+
splices,
|
|
12769
|
+
thisAssignments
|
|
12636
12770
|
};
|
|
12637
12771
|
});
|
|
12638
12772
|
var LexicalDeclaration$1 = $TS($S(InsertConst, $C(BindingPattern, BindingIdentifier), $E(TypeSuffix), __, ConstAssignment, ExtendedExpression), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
@@ -12719,25 +12853,51 @@ ${input.slice(result.pos)}
|
|
|
12719
12853
|
return result;
|
|
12720
12854
|
}
|
|
12721
12855
|
}
|
|
12722
|
-
var LexicalBinding$0 = $TS($S(BindingPattern, $E(TypeSuffix), Initializer), function($skip, $loc, $0, $1, $2, $3) {
|
|
12723
|
-
|
|
12724
|
-
|
|
12725
|
-
|
|
12726
|
-
|
|
12856
|
+
var LexicalBinding$0 = $TS($S(BindingPattern, $E(TypeSuffix), $E(_), Initializer), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
12857
|
+
var binding = $1;
|
|
12858
|
+
var suffix = $2;
|
|
12859
|
+
var ws = $3;
|
|
12860
|
+
var initializer = $4;
|
|
12861
|
+
const bindingChildren = [...binding.children];
|
|
12862
|
+
if (suffix)
|
|
12863
|
+
bindingChildren.push(suffix);
|
|
12864
|
+
if (ws)
|
|
12865
|
+
bindingChildren.push(...ws);
|
|
12866
|
+
binding = {
|
|
12867
|
+
...binding,
|
|
12868
|
+
children: bindingChildren
|
|
12869
|
+
};
|
|
12870
|
+
const [splices, thisAssignments] = gatherBindingCode(binding.children);
|
|
12727
12871
|
return {
|
|
12728
|
-
children,
|
|
12729
|
-
names:
|
|
12872
|
+
children: [binding, initializer],
|
|
12873
|
+
names: binding.names,
|
|
12874
|
+
binding,
|
|
12875
|
+
initializer,
|
|
12876
|
+
splices: splices.map((s) => [",", s]),
|
|
12877
|
+
thisAssignments: thisAssignments.map((s) => ["", s, ";"])
|
|
12730
12878
|
};
|
|
12731
12879
|
});
|
|
12732
|
-
var LexicalBinding$1 = $TS($S(BindingIdentifier, $E(TypeSuffix), $E(Initializer)), function($skip, $loc, $0, $1, $2, $3) {
|
|
12733
|
-
|
|
12734
|
-
|
|
12735
|
-
|
|
12736
|
-
|
|
12737
|
-
|
|
12880
|
+
var LexicalBinding$1 = $TS($S(BindingIdentifier, $E(TypeSuffix), $E(_), $E(Initializer)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
12881
|
+
var binding = $1;
|
|
12882
|
+
var suffix = $2;
|
|
12883
|
+
var ws = $3;
|
|
12884
|
+
var initializer = $4;
|
|
12885
|
+
const bindingChildren = [...binding.children];
|
|
12886
|
+
if (suffix)
|
|
12887
|
+
bindingChildren.push(suffix);
|
|
12888
|
+
if (ws)
|
|
12889
|
+
bindingChildren.push(...ws);
|
|
12890
|
+
binding = {
|
|
12891
|
+
...binding,
|
|
12892
|
+
children: bindingChildren
|
|
12893
|
+
};
|
|
12738
12894
|
return {
|
|
12739
|
-
children,
|
|
12740
|
-
names:
|
|
12895
|
+
children: [binding, initializer],
|
|
12896
|
+
names: binding.names,
|
|
12897
|
+
binding,
|
|
12898
|
+
initializer,
|
|
12899
|
+
splices: [],
|
|
12900
|
+
thisAssignments: []
|
|
12741
12901
|
};
|
|
12742
12902
|
});
|
|
12743
12903
|
function LexicalBinding(state) {
|
|
@@ -17296,7 +17456,7 @@ ${input.slice(result.pos)}
|
|
|
17296
17456
|
var pre = $1;
|
|
17297
17457
|
var exp = $2;
|
|
17298
17458
|
var post = $3;
|
|
17299
|
-
return
|
|
17459
|
+
return processUnaryExpression(pre, exp, post);
|
|
17300
17460
|
});
|
|
17301
17461
|
function InlineJSXUnaryExpression(state) {
|
|
17302
17462
|
let eventData;
|
|
@@ -21186,60 +21346,6 @@ ${input.slice(result.pos)}
|
|
|
21186
21346
|
}
|
|
21187
21347
|
return node;
|
|
21188
21348
|
};
|
|
21189
|
-
module.processUnaryExpression = (pre, exp, post) => {
|
|
21190
|
-
if (post?.token === "?") {
|
|
21191
|
-
post = {
|
|
21192
|
-
$loc: post.$loc,
|
|
21193
|
-
token: " != null"
|
|
21194
|
-
};
|
|
21195
|
-
switch (exp.type) {
|
|
21196
|
-
case "Identifier":
|
|
21197
|
-
case "Literal":
|
|
21198
|
-
return {
|
|
21199
|
-
...exp,
|
|
21200
|
-
children: [...pre, ...exp.children, post]
|
|
21201
|
-
};
|
|
21202
|
-
default:
|
|
21203
|
-
const expression = {
|
|
21204
|
-
...exp,
|
|
21205
|
-
children: [...pre, "(", exp.children, ")", post]
|
|
21206
|
-
};
|
|
21207
|
-
return {
|
|
21208
|
-
type: "ParenthesizedExpression",
|
|
21209
|
-
children: ["(", expression, ")"],
|
|
21210
|
-
expression
|
|
21211
|
-
};
|
|
21212
|
-
}
|
|
21213
|
-
}
|
|
21214
|
-
if (exp.type === "Literal") {
|
|
21215
|
-
if (pre.length === 1 && pre[0].token === "-") {
|
|
21216
|
-
const children = [pre[0], ...exp.children];
|
|
21217
|
-
if (post)
|
|
21218
|
-
exp.children.push(post);
|
|
21219
|
-
return {
|
|
21220
|
-
type: "Literal",
|
|
21221
|
-
children,
|
|
21222
|
-
raw: `-${exp.raw}`
|
|
21223
|
-
};
|
|
21224
|
-
}
|
|
21225
|
-
}
|
|
21226
|
-
if (exp.children) {
|
|
21227
|
-
const children = [...pre, ...exp.children];
|
|
21228
|
-
if (post)
|
|
21229
|
-
children.push(post);
|
|
21230
|
-
return Object.assign({}, exp, { children });
|
|
21231
|
-
} else if (Array.isArray(exp)) {
|
|
21232
|
-
const children = [...pre, ...exp];
|
|
21233
|
-
if (post)
|
|
21234
|
-
children.push(post);
|
|
21235
|
-
return { children };
|
|
21236
|
-
} else {
|
|
21237
|
-
const children = [...pre, exp];
|
|
21238
|
-
if (post)
|
|
21239
|
-
children.push(post);
|
|
21240
|
-
return { children };
|
|
21241
|
-
}
|
|
21242
|
-
};
|
|
21243
21349
|
module.needsRef = function(expression, base = "ref") {
|
|
21244
21350
|
switch (expression.type) {
|
|
21245
21351
|
case "Ref":
|
|
@@ -23183,6 +23289,7 @@ ${input.slice(result.pos)}
|
|
|
23183
23289
|
processCoffeeInterpolation,
|
|
23184
23290
|
processConstAssignmentDeclaration,
|
|
23185
23291
|
processLetAssignmentDeclaration,
|
|
23292
|
+
processUnaryExpression,
|
|
23186
23293
|
quoteString,
|
|
23187
23294
|
removeParentPointers
|
|
23188
23295
|
} = require_lib();
|