@danielx/civet 0.11.6 → 0.11.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +289 -0
- package/dist/browser.js +246 -124
- package/dist/civet +12 -8
- package/dist/main.js +344 -166
- package/dist/main.mjs +344 -166
- package/dist/ts-diagnostic.js +1 -1
- package/dist/ts-diagnostic.mjs +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/unplugin/astro.mjs +3 -3
- package/dist/unplugin/esbuild.d.ts +1 -1
- package/dist/unplugin/esbuild.mjs +3 -3
- package/dist/unplugin/farm.mjs +3 -3
- package/dist/unplugin/rolldown.d.ts +1 -1
- package/dist/unplugin/rolldown.mjs +3 -3
- package/dist/unplugin/rollup.d.ts +1 -1
- package/dist/unplugin/rollup.mjs +3 -3
- package/dist/unplugin/rspack.d.ts +1 -1
- package/dist/unplugin/rspack.mjs +3 -3
- package/dist/unplugin/unplugin.d.ts +27 -3
- package/dist/unplugin/unplugin.js +20 -9
- package/dist/unplugin/unplugin.mjs +24 -13
- package/dist/unplugin/vite.d.ts +1 -1
- package/dist/unplugin/vite.mjs +3 -3
- package/dist/unplugin/webpack.d.ts +1 -1
- package/dist/unplugin/webpack.mjs +3 -3
- package/package.json +7 -6
package/dist/browser.js
CHANGED
|
@@ -35,9 +35,9 @@ var Civet = (() => {
|
|
|
35
35
|
mod
|
|
36
36
|
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
37
37
|
|
|
38
|
-
// node_modules/.pnpm/@danielx+hera@0.8.
|
|
38
|
+
// node_modules/.pnpm/@danielx+hera@0.8.20/node_modules/@danielx/hera/dist/machine.js
|
|
39
39
|
var require_machine = __commonJS({
|
|
40
|
-
"node_modules/.pnpm/@danielx+hera@0.8.
|
|
40
|
+
"node_modules/.pnpm/@danielx+hera@0.8.20/node_modules/@danielx/hera/dist/machine.js"(exports, module) {
|
|
41
41
|
"use strict";
|
|
42
42
|
var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
|
|
43
43
|
for (var name in all)
|
|
@@ -384,6 +384,9 @@ ${body}`), super(message), this.header = header, this.body = body, this.filename
|
|
|
384
384
|
function resolve(path) {
|
|
385
385
|
return path;
|
|
386
386
|
}
|
|
387
|
+
function relative(_from, to) {
|
|
388
|
+
return to;
|
|
389
|
+
}
|
|
387
390
|
function createRequire(path) {
|
|
388
391
|
return (id) => {
|
|
389
392
|
throw new ReferenceError(
|
|
@@ -397,6 +400,7 @@ ${body}`), super(message), this.header = header, this.body = body, this.filename
|
|
|
397
400
|
browser_shim_default = {
|
|
398
401
|
dirname,
|
|
399
402
|
resolve,
|
|
403
|
+
relative,
|
|
400
404
|
createRequire
|
|
401
405
|
};
|
|
402
406
|
}
|
|
@@ -480,6 +484,7 @@ ${body}`), super(message), this.header = header, this.body = body, this.filename
|
|
|
480
484
|
maybeRefAssignment: () => maybeRefAssignment,
|
|
481
485
|
modifyString: () => modifyString,
|
|
482
486
|
negateCondition: () => negateCondition,
|
|
487
|
+
parenthesizeExpression: () => parenthesizeExpression,
|
|
483
488
|
precedenceCustomDefault: () => precedenceCustomDefault,
|
|
484
489
|
precedenceStep: () => precedenceStep,
|
|
485
490
|
prepend: () => prepend,
|
|
@@ -505,6 +510,7 @@ ${body}`), super(message), this.header = header, this.body = body, this.filename
|
|
|
505
510
|
stripTrailingImplicitComma: () => stripTrailingImplicitComma,
|
|
506
511
|
trimFirstSpace: () => trimFirstSpace,
|
|
507
512
|
typeOfJSX: () => typeOfJSX,
|
|
513
|
+
typeSuffixForExpression: () => typeSuffixForExpression,
|
|
508
514
|
wrapIIFE: () => wrapIIFE,
|
|
509
515
|
wrapTypeInPromise: () => wrapTypeInPromise
|
|
510
516
|
});
|
|
@@ -1433,7 +1439,11 @@ ${body}`), super(message), this.header = header, this.body = body, this.filename
|
|
|
1433
1439
|
let n = 0, name = base;
|
|
1434
1440
|
for (; names.has(name); )
|
|
1435
1441
|
n++, name = `${base}${n}`;
|
|
1436
|
-
names.add(name), ref
|
|
1442
|
+
if (names.add(name), ref.$loc) {
|
|
1443
|
+
let loc = ref.$loc;
|
|
1444
|
+
delete ref.$loc, ref.children = [{ $loc: loc, token: name }], ref.names = [name];
|
|
1445
|
+
} else
|
|
1446
|
+
ref.children = ref.names = [name];
|
|
1437
1447
|
}
|
|
1438
1448
|
}
|
|
1439
1449
|
|
|
@@ -1443,7 +1453,11 @@ ${body}`), super(message), this.header = header, this.body = body, this.filename
|
|
|
1443
1453
|
let binding = ref1[i1], { ref } = binding;
|
|
1444
1454
|
if (asThis) {
|
|
1445
1455
|
let atBinding = binding.binding;
|
|
1446
|
-
atBinding.children.pop(), atBinding.type = void 0
|
|
1456
|
+
atBinding.children.pop(), atBinding.type = void 0;
|
|
1457
|
+
let atLoc = atBinding.at?.$loc, ref2;
|
|
1458
|
+
atLoc ? ref2 = { $loc: atLoc, token: "this." } : ref2 = "this.";
|
|
1459
|
+
let thisNode = ref2;
|
|
1460
|
+
binding.children.splice(1, 0, ref.id, ": ", thisNode, ref.base), binding.type = "Property", binding.ref = void 0;
|
|
1447
1461
|
} else
|
|
1448
1462
|
ref.names[0] !== ref.base && binding.children.unshift(ref.base, ": ");
|
|
1449
1463
|
}
|
|
@@ -1498,16 +1512,16 @@ ${body}`), super(message), this.header = header, this.body = body, this.filename
|
|
|
1498
1512
|
};
|
|
1499
1513
|
}
|
|
1500
1514
|
function gatherSubbindings(node, subbindings = []) {
|
|
1501
|
-
for (let
|
|
1502
|
-
let p =
|
|
1515
|
+
for (let ref3 = gatherRecursiveAll(node, ($) => $.subbinding != null), i3 = 0, len22 = ref3.length; i3 < len22; i3++) {
|
|
1516
|
+
let p = ref3[i3], { subbinding } = p;
|
|
1503
1517
|
subbindings.push(", ", subbinding), gatherSubbindings(subbinding, subbindings);
|
|
1504
1518
|
}
|
|
1505
1519
|
return subbindings;
|
|
1506
1520
|
}
|
|
1507
1521
|
function simplifyBindingProperties(node) {
|
|
1508
1522
|
let results = [];
|
|
1509
|
-
for (let
|
|
1510
|
-
let p =
|
|
1523
|
+
for (let ref4 = gatherRecursiveAll(node, ($3) => $3.type === "BindingProperty"), i4 = 0, len3 = ref4.length; i4 < len3; i4++) {
|
|
1524
|
+
let p = ref4[i4], { name, value } = p;
|
|
1511
1525
|
if (value?.type === "NamedBindingPattern" && value.binding === name) {
|
|
1512
1526
|
let [ws] = p.children;
|
|
1513
1527
|
results.push(p.children = [ws, name, p.delim]);
|
|
@@ -1520,14 +1534,19 @@ ${body}`), super(message), this.header = header, this.body = body, this.filename
|
|
|
1520
1534
|
let thisAssignments = [], splices = [];
|
|
1521
1535
|
function insertRestSplices(s, p, thisAssignments2) {
|
|
1522
1536
|
let m;
|
|
1523
|
-
for (let
|
|
1537
|
+
for (let ref5 = gatherRecursiveAll(
|
|
1524
1538
|
s,
|
|
1525
1539
|
(n) => n.blockPrefix || opts?.injectParamProps && n.accessModifier || n.type === "AtBinding" || opts?.assignPins && (m = n.type, m === "PinPattern" || m === "PinProperty")
|
|
1526
|
-
), i5 = 0, len4 =
|
|
1527
|
-
let n =
|
|
1540
|
+
), i5 = 0, len4 = ref5.length; i5 < len4; i5++) {
|
|
1541
|
+
let n = ref5[i5];
|
|
1528
1542
|
if (n.type === "AtBinding") {
|
|
1529
|
-
let { ref } = n, { id } = ref;
|
|
1530
|
-
|
|
1543
|
+
let { ref, at } = n, { id } = ref, atLoc = at?.$loc;
|
|
1544
|
+
atLoc ? (ref.$loc = { pos: atLoc.pos + 1, length: id.length }, thisAssignments2.push([
|
|
1545
|
+
{ $loc: atLoc, token: "this." },
|
|
1546
|
+
{ $loc: ref.$loc, token: id },
|
|
1547
|
+
" = ",
|
|
1548
|
+
ref
|
|
1549
|
+
])) : thisAssignments2.push([`this.${id} = `, ref]);
|
|
1531
1550
|
continue;
|
|
1532
1551
|
}
|
|
1533
1552
|
if (opts?.assignPins && (n.type === "PinProperty" && (n.children = n.children.flatMap(($4) => $4 === n.name ? [n.name, ": ", n.value] : $4), updateParentPointers(n), n = n.value), n.type === "PinPattern")) {
|
|
@@ -1544,8 +1563,8 @@ ${body}`), super(message), this.header = header, this.body = body, this.filename
|
|
|
1544
1563
|
continue;
|
|
1545
1564
|
}
|
|
1546
1565
|
if (opts?.injectParamProps && n.type === "Parameter" && n.accessModifier) {
|
|
1547
|
-
for (let
|
|
1548
|
-
let id =
|
|
1566
|
+
for (let ref6 = n.names, i6 = 0, len5 = ref6.length; i6 < len5; i6++) {
|
|
1567
|
+
let id = ref6[i6];
|
|
1549
1568
|
thisAssignments2.push({
|
|
1550
1569
|
type: "AssignmentExpression",
|
|
1551
1570
|
children: [`this.${id} = `, id],
|
|
@@ -1561,7 +1580,7 @@ ${body}`), super(message), this.header = header, this.body = body, this.filename
|
|
|
1561
1580
|
return insertRestSplices(statements, splices, thisAssignments), [splices, thisAssignments];
|
|
1562
1581
|
}
|
|
1563
1582
|
function arrayElementHasTrailingComma(elementNode) {
|
|
1564
|
-
let
|
|
1583
|
+
let ref7, lastChild = (ref7 = elementNode.children)[ref7.length - 1];
|
|
1565
1584
|
return lastChild && lastChild[lastChild.length - 1]?.token === ",";
|
|
1566
1585
|
}
|
|
1567
1586
|
function gatherBindingPatternTypeSuffix(pattern) {
|
|
@@ -1572,8 +1591,8 @@ ${body}`), super(message), this.header = header, this.body = body, this.filename
|
|
|
1572
1591
|
case "ArrayBindingPattern": {
|
|
1573
1592
|
{
|
|
1574
1593
|
let results1 = [];
|
|
1575
|
-
for (let
|
|
1576
|
-
let elem =
|
|
1594
|
+
for (let ref8 = pattern.elements, i7 = 0, len6 = ref8.length; i7 < len6; i7++) {
|
|
1595
|
+
let elem = ref8[i7], { typeSuffix, initializer } = elem;
|
|
1577
1596
|
typeSuffix ??= elem.binding?.typeSuffix, typeSuffix && count++, initializer != null && (typeSuffix ??= typeSuffixForExpression(trimFirstSpace(initializer.expression)));
|
|
1578
1597
|
let typeElement = [typeSuffix?.t, elem.delim];
|
|
1579
1598
|
typeSuffix?.optional && (typeElement[0] = parenthesizeType(typeElement[0]), typeElement.unshift("undefined |")), elem.type === "BindingRestElement" ? (typeElement[0] ??= "unknown[]", typeElement.unshift(elem.dots)) : typeElement[0] ??= "unknown", results1.push(typeElement);
|
|
@@ -1594,14 +1613,15 @@ ${body}`), super(message), this.header = header, this.body = body, this.filename
|
|
|
1594
1613
|
case "ObjectBindingPattern": {
|
|
1595
1614
|
{
|
|
1596
1615
|
let restType, results2 = [];
|
|
1597
|
-
for (let
|
|
1598
|
-
let prop =
|
|
1616
|
+
for (let ref9 = pattern.properties, i8 = 0, len7 = ref9.length; i8 < len7; i8++) {
|
|
1617
|
+
let prop = ref9[i8], { typeSuffix, initializer } = prop;
|
|
1599
1618
|
switch (typeSuffix ??= prop.value?.typeSuffix, typeSuffix && count++, initializer != null && (typeSuffix ??= typeSuffixForExpression(trimFirstSpace(initializer.expression))), typeSuffix ??= {
|
|
1600
1619
|
type: "TypeSuffix",
|
|
1601
1620
|
ts: !0,
|
|
1602
1621
|
children: [": unknown"]
|
|
1603
1622
|
}, prop.initializer && !typeSuffix.optional && typeSuffix.children.unshift(typeSuffix.optional = "?"), prop.type) {
|
|
1604
|
-
case "BindingProperty":
|
|
1623
|
+
case "BindingProperty":
|
|
1624
|
+
case "PinProperty": {
|
|
1605
1625
|
let ws = prop.children.slice(0, prop.children.indexOf(prop.name));
|
|
1606
1626
|
results2.push([...ws, prop.name, typeSuffix, prop.delim]);
|
|
1607
1627
|
break;
|
|
@@ -2330,7 +2350,9 @@ ${js}`
|
|
|
2330
2350
|
if (followingOverloads(f).length)
|
|
2331
2351
|
f.ts = !0;
|
|
2332
2352
|
else {
|
|
2333
|
-
let
|
|
2353
|
+
let ref1, lastChild = (ref1 = f.parameters?.children)?.[ref1.length - 1], ref2;
|
|
2354
|
+
Array.isArray(lastChild) ? ref2 = lastChild[lastChild.length - 1] : ref2 = lastChild;
|
|
2355
|
+
let block = makeEmptyBlock(ref2?.$loc);
|
|
2334
2356
|
block.parent = f, f.block = block, f.children.push(block), f.ts = !1;
|
|
2335
2357
|
}
|
|
2336
2358
|
}
|
|
@@ -2424,9 +2446,9 @@ ${js}`
|
|
|
2424
2446
|
block,
|
|
2425
2447
|
(r) => r.type === "ReturnStatement" && !r.expression
|
|
2426
2448
|
).forEach((r) => (r.expression = ref, r.children.splice(-1, 1, " ", ref)));
|
|
2427
|
-
let
|
|
2428
|
-
if ((
|
|
2429
|
-
let
|
|
2449
|
+
let ref3;
|
|
2450
|
+
if ((ref3 = block.children)[ref3.length - 2]?.type !== "ReturnStatement") {
|
|
2451
|
+
let ref4, indent = getIndent((ref4 = block.expressions)[ref4.length - 1]);
|
|
2430
2452
|
block.expressions.push([
|
|
2431
2453
|
indent,
|
|
2432
2454
|
wrapWithReturn(ref, block, !indent)
|
|
@@ -2488,15 +2510,15 @@ ${js}`
|
|
|
2488
2510
|
function recurse(pattern2) {
|
|
2489
2511
|
switch (pattern2.type) {
|
|
2490
2512
|
case "ArrayBindingPattern": {
|
|
2491
|
-
for (let
|
|
2492
|
-
let element =
|
|
2513
|
+
for (let ref5 = pattern2.elements, i2 = 0, len12 = ref5.length; i2 < len12; i2++) {
|
|
2514
|
+
let element = ref5[i2];
|
|
2493
2515
|
recurse(element);
|
|
2494
2516
|
}
|
|
2495
2517
|
break;
|
|
2496
2518
|
}
|
|
2497
2519
|
case "ObjectBindingPattern": {
|
|
2498
|
-
for (let
|
|
2499
|
-
let property =
|
|
2520
|
+
for (let ref6 = pattern2.properties, i3 = 0, len22 = ref6.length; i3 < len22; i3++) {
|
|
2521
|
+
let property = ref6[i3];
|
|
2500
2522
|
recurse(property);
|
|
2501
2523
|
}
|
|
2502
2524
|
break;
|
|
@@ -2526,15 +2548,15 @@ ${js}`
|
|
|
2526
2548
|
switch (node.type) {
|
|
2527
2549
|
case "BlockStatement": {
|
|
2528
2550
|
if (node.expressions.length) {
|
|
2529
|
-
let
|
|
2530
|
-
assignResults((
|
|
2551
|
+
let ref7;
|
|
2552
|
+
assignResults((ref7 = node.expressions)[ref7.length - 1], collect);
|
|
2531
2553
|
} else
|
|
2532
2554
|
node.expressions.push(["", collect("void 0"), ";"]), updateParentPointers(node);
|
|
2533
2555
|
return;
|
|
2534
2556
|
}
|
|
2535
2557
|
case "CaseBlock": {
|
|
2536
|
-
for (let
|
|
2537
|
-
let clause =
|
|
2558
|
+
for (let ref8 = node.clauses, i4 = 0, len3 = ref8.length; i4 < len3; i4++) {
|
|
2559
|
+
let clause = ref8[i4];
|
|
2538
2560
|
assignResults(clause, collect);
|
|
2539
2561
|
}
|
|
2540
2562
|
return;
|
|
@@ -2554,7 +2576,7 @@ ${js}`
|
|
|
2554
2576
|
exp = exp;
|
|
2555
2577
|
let outer = exp;
|
|
2556
2578
|
exp.type === "LabelledStatement" && (exp = exp.statement);
|
|
2557
|
-
let
|
|
2579
|
+
let ref9, m1;
|
|
2558
2580
|
switch (exp.type) {
|
|
2559
2581
|
case "BreakStatement":
|
|
2560
2582
|
case "ContinueStatement":
|
|
@@ -2564,9 +2586,13 @@ ${js}`
|
|
|
2564
2586
|
case "ThrowStatement":
|
|
2565
2587
|
return;
|
|
2566
2588
|
case "Declaration": {
|
|
2567
|
-
let
|
|
2568
|
-
|
|
2569
|
-
|
|
2589
|
+
let ref10;
|
|
2590
|
+
if (exp.bindings?.length) {
|
|
2591
|
+
let ref11;
|
|
2592
|
+
ref10 = patternAsValue((ref11 = exp.bindings)[ref11.length - 1].pattern);
|
|
2593
|
+
} else
|
|
2594
|
+
ref10 = "void 0";
|
|
2595
|
+
let value = ref10;
|
|
2570
2596
|
exp.children.push([
|
|
2571
2597
|
"",
|
|
2572
2598
|
[";", collect(value)]
|
|
@@ -2593,7 +2619,7 @@ ${js}`
|
|
|
2593
2619
|
case "BlockStatement": {
|
|
2594
2620
|
if (exp.expressions.some(isExit))
|
|
2595
2621
|
return;
|
|
2596
|
-
assignResults((
|
|
2622
|
+
assignResults((ref9 = exp.expressions)[ref9.length - 1], collect);
|
|
2597
2623
|
return;
|
|
2598
2624
|
}
|
|
2599
2625
|
case "IfStatement": {
|
|
@@ -2605,15 +2631,15 @@ ${js}`
|
|
|
2605
2631
|
return;
|
|
2606
2632
|
}
|
|
2607
2633
|
case "SwitchStatement": {
|
|
2608
|
-
for (let
|
|
2609
|
-
let clause =
|
|
2634
|
+
for (let ref12 = exp.caseBlock.clauses, i5 = 0, len4 = ref12.length; i5 < len4; i5++) {
|
|
2635
|
+
let clause = ref12[i5];
|
|
2610
2636
|
assignResults(clause, collect);
|
|
2611
2637
|
}
|
|
2612
2638
|
return;
|
|
2613
2639
|
}
|
|
2614
2640
|
case "TryStatement": {
|
|
2615
|
-
for (let
|
|
2616
|
-
let block =
|
|
2641
|
+
for (let ref13 = exp.blocks, i6 = 0, len5 = ref13.length; i6 < len5; i6++) {
|
|
2642
|
+
let block = ref13[i6];
|
|
2617
2643
|
assignResults(block, collect);
|
|
2618
2644
|
}
|
|
2619
2645
|
return;
|
|
@@ -2656,9 +2682,9 @@ ${js}`
|
|
|
2656
2682
|
assert.notEqual(breakIndex, -1, "Could not find break in when clause"), node.children.splice(breakIndex, 1), node.break = void 0;
|
|
2657
2683
|
}
|
|
2658
2684
|
if (insertReturn(node.block), !isExit(node.block)) {
|
|
2659
|
-
let comment = hasTrailingComment(node.block.expressions),
|
|
2685
|
+
let comment = hasTrailingComment(node.block.expressions), ref14;
|
|
2660
2686
|
node.block.expressions.push([
|
|
2661
|
-
comment ? (
|
|
2687
|
+
comment ? (ref14 = node.block.expressions)[ref14.length - 1][0] || `
|
|
2662
2688
|
` : "",
|
|
2663
2689
|
wrapWithReturn(void 0, node, !comment)
|
|
2664
2690
|
]);
|
|
@@ -2676,7 +2702,7 @@ ${js}`
|
|
|
2676
2702
|
return;
|
|
2677
2703
|
let outer = exp;
|
|
2678
2704
|
exp.type === "LabelledStatement" && (exp = exp.statement);
|
|
2679
|
-
let
|
|
2705
|
+
let m3;
|
|
2680
2706
|
switch (exp.type) {
|
|
2681
2707
|
case "BreakStatement":
|
|
2682
2708
|
case "ContinueStatement":
|
|
@@ -2686,9 +2712,13 @@ ${js}`
|
|
|
2686
2712
|
case "ThrowStatement":
|
|
2687
2713
|
return;
|
|
2688
2714
|
case "Declaration": {
|
|
2689
|
-
let
|
|
2690
|
-
|
|
2691
|
-
|
|
2715
|
+
let ref15;
|
|
2716
|
+
if (exp.bindings?.length) {
|
|
2717
|
+
let ref16;
|
|
2718
|
+
ref15 = [" ", patternAsValue((ref16 = exp.bindings)[ref16.length - 1].pattern)];
|
|
2719
|
+
} else
|
|
2720
|
+
ref15 = [];
|
|
2721
|
+
let value = ref15, parent = outer.parent, index = findChildIndex(parent?.expressions, outer);
|
|
2692
2722
|
assert.notEqual(index, -1, "Could not find declaration in parent"), parent.expressions.splice(index + 1, 0, [
|
|
2693
2723
|
"",
|
|
2694
2724
|
{
|
|
@@ -2739,15 +2769,15 @@ ${js}`
|
|
|
2739
2769
|
return;
|
|
2740
2770
|
}
|
|
2741
2771
|
case "SwitchStatement": {
|
|
2742
|
-
for (let
|
|
2743
|
-
let clause =
|
|
2772
|
+
for (let ref17 = exp.caseBlock.clauses, i7 = 0, len6 = ref17.length; i7 < len6; i7++) {
|
|
2773
|
+
let clause = ref17[i7];
|
|
2744
2774
|
insertReturn(clause);
|
|
2745
2775
|
}
|
|
2746
2776
|
return;
|
|
2747
2777
|
}
|
|
2748
2778
|
case "TryStatement": {
|
|
2749
|
-
for (let
|
|
2750
|
-
let block =
|
|
2779
|
+
for (let ref18 = exp.blocks, i8 = 0, len7 = ref18.length; i8 < len7; i8++) {
|
|
2780
|
+
let block = ref18[i8];
|
|
2751
2781
|
insertReturn(block);
|
|
2752
2782
|
}
|
|
2753
2783
|
return;
|
|
@@ -2925,8 +2955,8 @@ ${js}`
|
|
|
2925
2955
|
return !1;
|
|
2926
2956
|
let reduction = statement.type === "ForStatement" && statement.reduction;
|
|
2927
2957
|
function fillBlock(expression) {
|
|
2928
|
-
let
|
|
2929
|
-
return m5 = (
|
|
2958
|
+
let ref19, m5;
|
|
2959
|
+
return m5 = (ref19 = block.expressions)[ref19.length - 1], Array.isArray(m5) && m5.length >= 2 && typeof m5[1] == "object" && m5[1] != null && "type" in m5[1] && m5[1].type === "EmptyStatement" && "implicit" in m5[1] && m5[1].implicit === !0 && block.expressions.pop(), block.expressions.push(expression), block.empty = !1, braceBlock(block);
|
|
2930
2960
|
}
|
|
2931
2961
|
if (reduction)
|
|
2932
2962
|
switch (reduction.subtype) {
|
|
@@ -2972,8 +3002,8 @@ ${js}`
|
|
|
2972
3002
|
function append2(p) {
|
|
2973
3003
|
(rest ? after : before).push(p);
|
|
2974
3004
|
}
|
|
2975
|
-
for (let
|
|
2976
|
-
let param =
|
|
3005
|
+
for (let ref20 = parameters.parameters, i9 = 0, len8 = ref20.length; i9 < len8; i9++) {
|
|
3006
|
+
let param = ref20[i9];
|
|
2977
3007
|
switch (param.type) {
|
|
2978
3008
|
case "ThisType": {
|
|
2979
3009
|
if (tt)
|
|
@@ -2982,7 +3012,7 @@ ${js}`
|
|
|
2982
3012
|
message: "Only one typed this parameter is allowed"
|
|
2983
3013
|
}), append2(param);
|
|
2984
3014
|
else if (tt = trimFirstSpace(param), before.length || rest) {
|
|
2985
|
-
let
|
|
3015
|
+
let ref21, delim = (ref21 = tt.children)[ref21.length - 1];
|
|
2986
3016
|
Array.isArray(delim) && (delim = delim[delim.length - 1]), typeof delim == "object" && delim != null && "token" in delim && delim.token === "," || (tt = {
|
|
2987
3017
|
...tt,
|
|
2988
3018
|
children: [...tt.children, ", "]
|
|
@@ -3110,11 +3140,11 @@ ${js}`
|
|
|
3110
3140
|
let fields = new Set(gatherRecursiveWithinFunction(ancestor, ($11) => $11.type === "FieldDefinition").map(($12) => $12.id).filter(((a3) => typeof a3 == "object" && a3 != null && "type" in a3 && a3.type === "Identifier")).map(($13) => $13.name)), classExpressions = ancestor.body.expressions, index2 = findChildIndex(classExpressions, f);
|
|
3111
3141
|
assert.notEqual(index2, -1, "Could not find constructor in class"), index2 -= precedingOverloads(f).length;
|
|
3112
3142
|
let fStatement = classExpressions[index2];
|
|
3113
|
-
for (let
|
|
3114
|
-
let parameter =
|
|
3143
|
+
for (let ref22 = gatherRecursive(parameters, ($14) => $14.type === "Parameter"), i10 = 0, len9 = ref22.length; i10 < len9; i10++) {
|
|
3144
|
+
let parameter = ref22[i10], { accessModifier } = parameter;
|
|
3115
3145
|
if (accessModifier || parameter.typeSuffix)
|
|
3116
|
-
for (let
|
|
3117
|
-
let binding =
|
|
3146
|
+
for (let ref23 = gatherRecursive(parameter, ($15) => $15.type === "AtBinding"), i11 = 0, len10 = ref23.length; i11 < len10; i11++) {
|
|
3147
|
+
let binding = ref23[i11], typeSuffix = binding.parent?.typeSuffix;
|
|
3118
3148
|
if (!(accessModifier || typeSuffix))
|
|
3119
3149
|
continue;
|
|
3120
3150
|
parameter.accessModifier && (replaceNode(parameter.accessModifier, void 0), parameter.accessModifier = void 0);
|
|
@@ -3140,8 +3170,8 @@ ${js}`
|
|
|
3140
3170
|
bindings: [],
|
|
3141
3171
|
decl: "const"
|
|
3142
3172
|
}));
|
|
3143
|
-
for (let
|
|
3144
|
-
let binding =
|
|
3173
|
+
for (let ref24 = splices, i12 = 0, len11 = ref24.length; i12 < len11; i12++) {
|
|
3174
|
+
let binding = ref24[i12];
|
|
3145
3175
|
assert.equal(binding.type, "PostRestBindingElements", "splice should be of type Binding"), prefix.push(makeNode({
|
|
3146
3176
|
type: "Declaration",
|
|
3147
3177
|
children: ["let ", binding],
|
|
@@ -3179,8 +3209,8 @@ ${js}`
|
|
|
3179
3209
|
if (f.async != null)
|
|
3180
3210
|
addAsync = !0;
|
|
3181
3211
|
else
|
|
3182
|
-
for (let
|
|
3183
|
-
let a =
|
|
3212
|
+
for (let ref25 = gatherRecursiveWithinFunction(block, ($17) => $17.type === "Await"), i13 = 0, len12 = ref25.length; i13 < len12; i13++) {
|
|
3213
|
+
let a = ref25[i13], i = findChildIndex(a.parent, a);
|
|
3184
3214
|
a.parent.children.splice(i + 1, 0, {
|
|
3185
3215
|
type: "Error",
|
|
3186
3216
|
message: `await invalid in ${signature.modifier.get ? "getter" : signature.modifier.set ? "setter" : signature.name}`
|
|
@@ -3190,15 +3220,15 @@ ${js}`
|
|
|
3190
3220
|
if (f.generator != null)
|
|
3191
3221
|
addGenerator = !0;
|
|
3192
3222
|
else
|
|
3193
|
-
for (let
|
|
3194
|
-
let y =
|
|
3223
|
+
for (let ref26 = gatherRecursiveWithinFunction(block, ($18) => $18.type === "YieldExpression"), i14 = 0, len13 = ref26.length; i14 < len13; i14++) {
|
|
3224
|
+
let y = ref26[i14], i = y.children.findIndex(($19) => $19.type === "Yield");
|
|
3195
3225
|
y.children.splice(i + 1, 0, {
|
|
3196
3226
|
type: "Error",
|
|
3197
3227
|
message: `yield invalid in ${f.type === "ArrowFunction" ? "=> arrow function" : signature.modifier.get ? "getter" : signature.modifier.set ? "setter" : signature.name}`
|
|
3198
3228
|
});
|
|
3199
3229
|
}
|
|
3200
|
-
for (let
|
|
3201
|
-
let overload =
|
|
3230
|
+
for (let ref27 = [f, ...precedingOverloads(f)], i15 = 0, len14 = ref27.length; i15 < len14; i15++) {
|
|
3231
|
+
let overload = ref27[i15];
|
|
3202
3232
|
addAsync && overload.async != null && !overload.async.length && (overload.async.push("async "), overload.signature.modifier.async = !0), addGenerator && overload.generator != null && !overload.generator.length && (overload.generator.push("*"), overload.signature.modifier.generator = !0), overload.signature.modifier.async && !overload.signature.modifier.generator && overload.signature.returnType && !isPromiseType(overload.signature.returnType.t) && replaceNode(
|
|
3203
3233
|
overload.signature.returnType.t,
|
|
3204
3234
|
wrapTypeInPromise(overload.signature.returnType.t),
|
|
@@ -3207,8 +3237,8 @@ ${js}`
|
|
|
3207
3237
|
}
|
|
3208
3238
|
}
|
|
3209
3239
|
function processFunctions(statements, config2) {
|
|
3210
|
-
for (let
|
|
3211
|
-
let f =
|
|
3240
|
+
for (let ref28 = gatherRecursiveAll(statements, ($20) => $20.type === "FunctionExpression" || $20.type === "ArrowFunction" || $20.type === "MethodDefinition"), i16 = 0, len15 = ref28.length; i16 < len15; i16++) {
|
|
3241
|
+
let f = ref28[i16];
|
|
3212
3242
|
(f.type === "FunctionExpression" || f.type === "MethodDefinition") && implicitFunctionBlock(f), processSignature(f), processParams(f), processReturn(f, config2.implicitReturns);
|
|
3213
3243
|
}
|
|
3214
3244
|
}
|
|
@@ -3255,17 +3285,17 @@ ${js}`
|
|
|
3255
3285
|
}
|
|
3256
3286
|
let done;
|
|
3257
3287
|
if (!async) {
|
|
3258
|
-
let
|
|
3259
|
-
if ((
|
|
3260
|
-
let { block: parentBlock, index } =
|
|
3288
|
+
let ref29;
|
|
3289
|
+
if ((ref29 = blockContainingStatement(exp)) && typeof ref29 == "object" && "block" in ref29 && "index" in ref29) {
|
|
3290
|
+
let { block: parentBlock, index } = ref29;
|
|
3261
3291
|
statements[0][0] = parentBlock.expressions[index][0], parentBlock.expressions.splice(index, index + 1 - index, ...statements), updateParentPointers(parentBlock), braceBlock(parentBlock), done = !0;
|
|
3262
3292
|
}
|
|
3263
3293
|
}
|
|
3264
3294
|
done || (generator || (statements[statements.length - 1][1] = wrapWithReturn(statements[statements.length - 1][1])), children.splice(i, 1, wrapIIFE(statements, async, generator)), updateParentPointers(exp));
|
|
3265
3295
|
}
|
|
3266
3296
|
function processIterationExpressions(statements) {
|
|
3267
|
-
for (let
|
|
3268
|
-
let s =
|
|
3297
|
+
for (let ref30 = gatherRecursiveAll(statements, ($21) => $21.type === "IterationExpression"), i17 = 0, len16 = ref30.length; i17 < len16; i17++) {
|
|
3298
|
+
let s = ref30[i17];
|
|
3269
3299
|
expressionizeIteration(s);
|
|
3270
3300
|
}
|
|
3271
3301
|
}
|
|
@@ -3284,9 +3314,9 @@ ${js}`
|
|
|
3284
3314
|
for (let i18 = 0, len17 = parameterList.length; i18 < len17; i18++) {
|
|
3285
3315
|
let parameter = parameterList[i18];
|
|
3286
3316
|
if (typeof parameter == "object" && parameter != null && "type" in parameter && parameter.type === "Parameter") {
|
|
3287
|
-
let
|
|
3288
|
-
if (
|
|
3289
|
-
let initializer =
|
|
3317
|
+
let ref31;
|
|
3318
|
+
if (ref31 = parameter.initializer) {
|
|
3319
|
+
let initializer = ref31;
|
|
3290
3320
|
args.push(initializer.expression, parameter.delim), parameter = {
|
|
3291
3321
|
...parameter,
|
|
3292
3322
|
initializer: void 0,
|
|
@@ -3396,12 +3426,14 @@ ${js}`
|
|
|
3396
3426
|
function bracedBlock(block) {
|
|
3397
3427
|
return block = duplicateBlock(block), braceBlock(block), block;
|
|
3398
3428
|
}
|
|
3399
|
-
function makeEmptyBlock() {
|
|
3400
|
-
let expressions = [];
|
|
3401
|
-
|
|
3429
|
+
function makeEmptyBlock(loc) {
|
|
3430
|
+
let expressions = [], ref1;
|
|
3431
|
+
loc ? ref1 = { $loc: loc, token: "{" } : ref1 = "{";
|
|
3432
|
+
let open = ref1, ref2;
|
|
3433
|
+
return loc ? ref2 = { $loc: { pos: loc.pos + loc.length, length: 0 }, token: "}" } : ref2 = "}", {
|
|
3402
3434
|
type: "BlockStatement",
|
|
3403
3435
|
expressions,
|
|
3404
|
-
children: [
|
|
3436
|
+
children: [open, expressions, ref2],
|
|
3405
3437
|
bare: !1,
|
|
3406
3438
|
empty: !0
|
|
3407
3439
|
};
|
|
@@ -3450,8 +3482,8 @@ ${js}`
|
|
|
3450
3482
|
}
|
|
3451
3483
|
function processBlocks(statements) {
|
|
3452
3484
|
insertSemicolon(statements);
|
|
3453
|
-
for (let
|
|
3454
|
-
let block =
|
|
3485
|
+
for (let ref3 = gatherRecursive(statements, ($) => $.type === "BlockStatement"), i2 = 0, len12 = ref3.length; i2 < len12; i2++) {
|
|
3486
|
+
let block = ref3[i2], m1;
|
|
3455
3487
|
if (block.unwrapObject && block.expressions.length === 1 && (m1 = block.expressions[0][1], typeof m1 == "object" && m1 != null && "type" in m1 && m1.type === "ParenthesizedExpression" && "implicit" in m1 && m1.implicit === !0 && "expression" in m1 && typeof m1.expression == "object" && m1.expression != null && "type" in m1.expression && m1.expression.type === "ObjectExpression")) {
|
|
3456
3488
|
let object = block.expressions[0][1].expression;
|
|
3457
3489
|
if (!(() => {
|
|
@@ -3465,8 +3497,8 @@ ${js}`
|
|
|
3465
3497
|
})())
|
|
3466
3498
|
continue;
|
|
3467
3499
|
block.expressions[0][1] = block.expressions[0][1].expression, unbraceBlock(block);
|
|
3468
|
-
for (let
|
|
3469
|
-
let i = i3, prop =
|
|
3500
|
+
for (let ref4 = object.properties, i3 = 0, len22 = ref4.length; i3 < len22; i3++) {
|
|
3501
|
+
let i = i3, prop = ref4[i3], m2;
|
|
3470
3502
|
m2 = prop.name, typeof m2 == "object" && m2 != null && "type" in m2 && m2.type === "ComputedPropertyName" && "implicit" in m2 && m2.implicit === !0 && replaceNode(prop.name, prop.name.expression, prop), prop.delim?.implicit && (needsPrecedingSemicolon(object.properties[i + 1]) ? prop.delim.token = ";" : (replaceNode(prop.delim, void 0, prop), prop.delim = void 0));
|
|
3471
3503
|
let colon = prop.children.indexOf(": ");
|
|
3472
3504
|
colon < 0 || prop.children[colon - 1] === prop.name && prop.children.splice(colon - 1, 2);
|
|
@@ -3936,7 +3968,9 @@ ${js}`
|
|
|
3936
3968
|
break;
|
|
3937
3969
|
}
|
|
3938
3970
|
}
|
|
3939
|
-
let [splices, thisAssignments] = gatherBindingCode(pattern), patternBindings2 = nonMatcherBindings(pattern)
|
|
3971
|
+
let [splices, thisAssignments] = gatherBindingCode(pattern), patternBindings2 = nonMatcherBindings(pattern);
|
|
3972
|
+
"typeSuffix" in patternBindings2 && (typeSuffix = patternBindings2.typeSuffix);
|
|
3973
|
+
let subbindings = gatherSubbindings(patternBindings2);
|
|
3940
3974
|
simplifyBindingProperties(patternBindings2), simplifyBindingProperties(subbindings), splices = splices.flatMap((s) => [", ", nonMatcherBindings(s)]), thisAssignments = thisAssignments.map(($7) => ["", $7, ";"]);
|
|
3941
3975
|
let duplicateDeclarations = aggregateDuplicateBindings([patternBindings2, splices, subbindings]), blockPrefix = [];
|
|
3942
3976
|
if (ref || subbindings.length || splices.length) {
|
|
@@ -4048,25 +4082,31 @@ ${js}`
|
|
|
4048
4082
|
switch (pattern.type) {
|
|
4049
4083
|
case "ArrayBindingPattern":
|
|
4050
4084
|
case "PostRestBindingElements": {
|
|
4051
|
-
let elements = elideMatchersFromArrayBindings(pattern.elements)
|
|
4052
|
-
return makeNode({
|
|
4085
|
+
let elements = elideMatchersFromArrayBindings(pattern.elements), node = makeNode({
|
|
4053
4086
|
...pattern,
|
|
4054
4087
|
elements,
|
|
4055
4088
|
children: pattern.children.map(($9) => $9 === pattern.elements ? elements : $9)
|
|
4056
|
-
})
|
|
4089
|
+
}), typePattern = {
|
|
4090
|
+
...node,
|
|
4091
|
+
typeSuffix: void 0,
|
|
4092
|
+
elements: elements.filter((element) => element?.type != null)
|
|
4093
|
+
};
|
|
4094
|
+
return node.typeSuffix = gatherBindingPatternTypeSuffix(typePattern).typeSuffix, node;
|
|
4057
4095
|
}
|
|
4058
4096
|
case "ObjectBindingPattern": {
|
|
4059
4097
|
let properties = elideMatchersFromPropertyBindings(pattern.properties);
|
|
4060
|
-
return makeNode({
|
|
4098
|
+
return gatherBindingPatternTypeSuffix(makeNode({
|
|
4061
4099
|
...pattern,
|
|
4100
|
+
typeSuffix: void 0,
|
|
4062
4101
|
properties,
|
|
4063
4102
|
children: pattern.children.map(($10) => $10 === pattern.properties ? properties : $10)
|
|
4064
|
-
});
|
|
4103
|
+
}));
|
|
4065
4104
|
}
|
|
4066
4105
|
case "NamedBindingPattern": {
|
|
4067
4106
|
let bindings = nonMatcherBindings(pattern.pattern);
|
|
4068
4107
|
return makeNode({
|
|
4069
4108
|
...pattern,
|
|
4109
|
+
typeSuffix: bindings?.typeSuffix,
|
|
4070
4110
|
subbinding: (m2 = bindings?.type, m2 === "ArrayBindingPattern" || m2 === "ObjectBindingPattern" || m2 === "Identifier" ? [bindings, " = ", pattern.binding] : void 0)
|
|
4071
4111
|
});
|
|
4072
4112
|
}
|
|
@@ -6690,8 +6730,10 @@ ${js}`
|
|
|
6690
6730
|
break;
|
|
6691
6731
|
}
|
|
6692
6732
|
case "PipelineExpression": {
|
|
6693
|
-
|
|
6694
|
-
|
|
6733
|
+
{
|
|
6734
|
+
let i = findChildIndex(parent, ancestor), ref33;
|
|
6735
|
+
i === 1 ? ref33 = ancestor === parent.children[i] : i === 2 ? ref33 = ancestor === parent.children[i][findChildIndex(parent.children[i], ancestor)][3] : ref33 = void 0, outer = ref33;
|
|
6736
|
+
}
|
|
6695
6737
|
break;
|
|
6696
6738
|
}
|
|
6697
6739
|
case "AssignmentExpression":
|
|
@@ -6950,7 +6992,9 @@ ${js}`
|
|
|
6950
6992
|
AfterReturnShorthand,
|
|
6951
6993
|
Parameters,
|
|
6952
6994
|
ShortArrowParameters,
|
|
6995
|
+
ESArrowIdentifierParameters,
|
|
6953
6996
|
ArrowParameters,
|
|
6997
|
+
ThinArrowParameters,
|
|
6954
6998
|
NonEmptyParameters,
|
|
6955
6999
|
ParameterList,
|
|
6956
7000
|
NestedParameterList,
|
|
@@ -7634,6 +7678,7 @@ ${js}`
|
|
|
7634
7678
|
CoffeeNotEnabled,
|
|
7635
7679
|
CoffeeOfEnabled,
|
|
7636
7680
|
CoffeePrototypeEnabled,
|
|
7681
|
+
ESArrowFunctionEnabled,
|
|
7637
7682
|
JSXCodeNestedEnabled,
|
|
7638
7683
|
JSXCodeSameLineEnabled,
|
|
7639
7684
|
ObjectIsEnabled,
|
|
@@ -8365,9 +8410,12 @@ ${js}`
|
|
|
8365
8410
|
function ConditionalExpression(ctx, state2) {
|
|
8366
8411
|
return (0, import_lib2.$EVENT)(ctx, state2, "ConditionalExpression", ConditionalExpression$0);
|
|
8367
8412
|
}
|
|
8368
|
-
var TernaryRest$0 = NestedTernaryRest, TernaryRest$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(CoffeeBinaryExistentialEnabled), (0, import_lib2.$Y)((0, import_lib2.$EXPECT)($R5, "TernaryRest /[ \\t]/")), _, QuestionMark,
|
|
8413
|
+
var TernaryRest$0 = NestedTernaryRest, TernaryRest$1 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(CoffeeBinaryExistentialEnabled), (0, import_lib2.$Y)((0, import_lib2.$EXPECT)($R5, "TernaryRest /[ \\t]/")), _, QuestionMark, PushIndent, (0, import_lib2.$E)((0, import_lib2.$S)(Nested, Expression, _, Colon, Nested, Expression)), PopIndent), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
|
|
8414
|
+
var thenelse = $6;
|
|
8415
|
+
return thenelse ? [$3, $4, ...thenelse] : $skip;
|
|
8416
|
+
}), TernaryRest$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(CoffeeBinaryExistentialEnabled), (0, import_lib2.$Y)((0, import_lib2.$EXPECT)($R5, "TernaryRest /[ \\t]/")), _, QuestionMark, MaybeNestedExpression, __, Colon, MaybeNestedExpression), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8) {
|
|
8369
8417
|
return $0.slice(2);
|
|
8370
|
-
}), TernaryRest$$ = [TernaryRest$0, TernaryRest$1];
|
|
8418
|
+
}), TernaryRest$$ = [TernaryRest$0, TernaryRest$1, TernaryRest$2];
|
|
8371
8419
|
function TernaryRest(ctx, state2) {
|
|
8372
8420
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "TernaryRest", TernaryRest$$);
|
|
8373
8421
|
}
|
|
@@ -8381,24 +8429,29 @@ ${js}`
|
|
|
8381
8429
|
function ShortCircuitExpression(ctx, state2) {
|
|
8382
8430
|
return (0, import_lib2.$EVENT)(ctx, state2, "ShortCircuitExpression", ShortCircuitExpression$0);
|
|
8383
8431
|
}
|
|
8384
|
-
var PipelineExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PipelineAllowed, (0, import_lib2.$E)(_), PipelineHeadItem, PipelineExpressionBody), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
8385
|
-
var ws = $2, head = $3, body = $4;
|
|
8432
|
+
var PipelineExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PipelineAllowed, (0, import_lib2.$E)(_), PipelineHeadItem, PipelineExpressionBody, (0, import_lib2.$E)(AllowedTrailingCallExpressions)), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
8433
|
+
var ws = $2, head = $3, body = $4, trailing = $5;
|
|
8434
|
+
let node;
|
|
8386
8435
|
if (head.type === "ArrowFunction" && head.ampersandBlock) {
|
|
8387
8436
|
let expressions = [{
|
|
8388
8437
|
type: "PipelineExpression",
|
|
8389
8438
|
children: [ws, head.block.expressions[0], body]
|
|
8390
8439
|
}], block = { ...head.block, expressions, children: [expressions] };
|
|
8391
|
-
|
|
8440
|
+
node = {
|
|
8392
8441
|
...head,
|
|
8393
8442
|
block,
|
|
8394
8443
|
body: expressions,
|
|
8395
8444
|
children: [...head.children.slice(0, -1), block]
|
|
8396
8445
|
};
|
|
8397
|
-
}
|
|
8398
|
-
|
|
8399
|
-
|
|
8400
|
-
|
|
8401
|
-
|
|
8446
|
+
} else
|
|
8447
|
+
node = {
|
|
8448
|
+
type: "PipelineExpression",
|
|
8449
|
+
children: [ws, head, body]
|
|
8450
|
+
};
|
|
8451
|
+
return trailing ? processCallMemberExpression({
|
|
8452
|
+
type: "CallExpression",
|
|
8453
|
+
children: [node, ...trailing]
|
|
8454
|
+
}) : node;
|
|
8402
8455
|
});
|
|
8403
8456
|
function PipelineExpression(ctx, state2) {
|
|
8404
8457
|
return (0, import_lib2.$EVENT)(ctx, state2, "PipelineExpression", PipelineExpression$0);
|
|
@@ -9346,28 +9399,49 @@ ${js}`
|
|
|
9346
9399
|
}
|
|
9347
9400
|
var ShortArrowParameters$0 = (0, import_lib2.$TV)((0, import_lib2.$C)(ObjectBindingPattern, ArrayBindingPattern), function($skip, $loc, $0, $1) {
|
|
9348
9401
|
var binding = $0;
|
|
9349
|
-
let { typeSuffix } = binding
|
|
9350
|
-
return {
|
|
9402
|
+
let { typeSuffix } = binding, parameters = [{
|
|
9351
9403
|
type: "Parameter",
|
|
9352
9404
|
children: [binding, typeSuffix],
|
|
9353
9405
|
names: binding.names,
|
|
9354
9406
|
typeSuffix
|
|
9407
|
+
}];
|
|
9408
|
+
return {
|
|
9409
|
+
type: "Parameters",
|
|
9410
|
+
children: ["(", parameters, ")"],
|
|
9411
|
+
parameters
|
|
9355
9412
|
};
|
|
9356
9413
|
});
|
|
9357
9414
|
function ShortArrowParameters(ctx, state2) {
|
|
9358
9415
|
return (0, import_lib2.$EVENT)(ctx, state2, "ShortArrowParameters", ShortArrowParameters$0);
|
|
9359
9416
|
}
|
|
9360
|
-
var
|
|
9361
|
-
|
|
9417
|
+
var ESArrowIdentifierParameters$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(ESArrowFunctionEnabled, Identifier), function($skip, $loc, $0, $1, $2) {
|
|
9418
|
+
var id = $2;
|
|
9419
|
+
let parameters = [{
|
|
9420
|
+
type: "Parameter",
|
|
9421
|
+
children: [id],
|
|
9422
|
+
names: id.names,
|
|
9423
|
+
binding: id,
|
|
9424
|
+
typeSuffix: void 0,
|
|
9425
|
+
initializer: void 0,
|
|
9426
|
+
delim: void 0
|
|
9427
|
+
}];
|
|
9362
9428
|
return {
|
|
9363
9429
|
type: "Parameters",
|
|
9364
9430
|
children: ["(", parameters, ")"],
|
|
9365
9431
|
parameters
|
|
9366
9432
|
};
|
|
9367
|
-
})
|
|
9433
|
+
});
|
|
9434
|
+
function ESArrowIdentifierParameters(ctx, state2) {
|
|
9435
|
+
return (0, import_lib2.$EVENT)(ctx, state2, "ESArrowIdentifierParameters", ESArrowIdentifierParameters$0);
|
|
9436
|
+
}
|
|
9437
|
+
var ArrowParameters$0 = ESArrowIdentifierParameters, ArrowParameters$1 = ShortArrowParameters, ArrowParameters$2 = Parameters, ArrowParameters$$ = [ArrowParameters$0, ArrowParameters$1, ArrowParameters$2];
|
|
9368
9438
|
function ArrowParameters(ctx, state2) {
|
|
9369
9439
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "ArrowParameters", ArrowParameters$$);
|
|
9370
9440
|
}
|
|
9441
|
+
var ThinArrowParameters$0 = ShortArrowParameters, ThinArrowParameters$1 = Parameters, ThinArrowParameters$$ = [ThinArrowParameters$0, ThinArrowParameters$1];
|
|
9442
|
+
function ThinArrowParameters(ctx, state2) {
|
|
9443
|
+
return (0, import_lib2.$EVENT_C)(ctx, state2, "ThinArrowParameters", ThinArrowParameters$$);
|
|
9444
|
+
}
|
|
9371
9445
|
var NonEmptyParameters$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(TypeParameters), OpenParen, ParameterList, (0, import_lib2.$S)(__, CloseParen)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
9372
9446
|
var tp = $1, open = $2, parameters = $3, close = $4;
|
|
9373
9447
|
return {
|
|
@@ -9453,11 +9527,12 @@ ${js}`
|
|
|
9453
9527
|
return (0, import_lib2.$EVENT)(ctx, state2, "BindingIdentifier", BindingIdentifier$0);
|
|
9454
9528
|
}
|
|
9455
9529
|
var NWBindingIdentifier$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(At, AtIdentifierRef), function($skip, $loc, $0, $1, $2) {
|
|
9456
|
-
var ref = $2;
|
|
9530
|
+
var at = $1, ref = $2;
|
|
9457
9531
|
return {
|
|
9458
9532
|
type: "AtBinding",
|
|
9459
9533
|
children: [ref],
|
|
9460
9534
|
ref,
|
|
9535
|
+
at,
|
|
9461
9536
|
names: []
|
|
9462
9537
|
};
|
|
9463
9538
|
}), NWBindingIdentifier$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(Hash, AtIdentifierRef), function($skip, $loc, $0, $1, $2) {
|
|
@@ -9489,35 +9564,40 @@ ${js}`
|
|
|
9489
9564
|
return {
|
|
9490
9565
|
type: "PinPattern",
|
|
9491
9566
|
children: [expression],
|
|
9492
|
-
expression
|
|
9567
|
+
expression,
|
|
9568
|
+
typeSuffix: typeSuffixForExpression(expression)
|
|
9493
9569
|
};
|
|
9494
9570
|
}), PinPattern$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(Caret, SingleLineExpressionWithIndentedApplicationForbidden), function($skip, $loc, $0, $1, $2) {
|
|
9495
9571
|
var expression = $2;
|
|
9496
9572
|
return {
|
|
9497
9573
|
type: "PinPattern",
|
|
9498
9574
|
children: [expression],
|
|
9499
|
-
expression
|
|
9575
|
+
expression,
|
|
9576
|
+
typeSuffix: typeSuffixForExpression(expression)
|
|
9500
9577
|
};
|
|
9501
9578
|
}), PinPattern$2 = (0, import_lib2.$TV)(ActualMemberExpression, function($skip, $loc, $0, $1) {
|
|
9502
9579
|
var expression = $0;
|
|
9503
9580
|
return {
|
|
9504
9581
|
type: "PinPattern",
|
|
9505
9582
|
children: [expression],
|
|
9506
|
-
expression
|
|
9583
|
+
expression,
|
|
9584
|
+
typeSuffix: typeSuffixForExpression(expression)
|
|
9507
9585
|
};
|
|
9508
9586
|
}), PinPattern$3 = (0, import_lib2.$TV)((0, import_lib2.$S)((0, import_lib2.$EXPECT)($R15, "PinPattern /[+-]/"), NumericLiteral), function($skip, $loc, $0, $1) {
|
|
9509
9587
|
var expression = $0;
|
|
9510
9588
|
return {
|
|
9511
9589
|
type: "PinPattern",
|
|
9512
9590
|
children: [expression],
|
|
9513
|
-
expression
|
|
9591
|
+
expression,
|
|
9592
|
+
typeSuffix: typeSuffixForExpression(expression)
|
|
9514
9593
|
};
|
|
9515
9594
|
}), PinPattern$4 = (0, import_lib2.$TV)(Undefined, function($skip, $loc, $0, $1) {
|
|
9516
9595
|
var expression = $0;
|
|
9517
9596
|
return {
|
|
9518
9597
|
type: "PinPattern",
|
|
9519
9598
|
children: [expression],
|
|
9520
|
-
expression
|
|
9599
|
+
expression,
|
|
9600
|
+
typeSuffix: typeSuffixForExpression(expression)
|
|
9521
9601
|
};
|
|
9522
9602
|
}), PinPattern$$ = [PinPattern$0, PinPattern$1, PinPattern$2, PinPattern$3, PinPattern$4];
|
|
9523
9603
|
function PinPattern(ctx, state2) {
|
|
@@ -9678,7 +9758,8 @@ ${js}`
|
|
|
9678
9758
|
value: {
|
|
9679
9759
|
type: "PinPattern",
|
|
9680
9760
|
children: [binding],
|
|
9681
|
-
expression: binding
|
|
9761
|
+
expression: binding,
|
|
9762
|
+
typeSuffix: typeSuffixForExpression(binding)
|
|
9682
9763
|
}
|
|
9683
9764
|
};
|
|
9684
9765
|
}), BindingProperty$3 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(_), BindingIdentifier, (0, import_lib2.$E)(Caret), (0, import_lib2.$E)(BindingTypeSuffix), (0, import_lib2.$E)(Initializer)), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
@@ -10026,7 +10107,7 @@ ${js}`
|
|
|
10026
10107
|
function OperatorAssociativity(ctx, state2) {
|
|
10027
10108
|
return (0, import_lib2.$EVENT)(ctx, state2, "OperatorAssociativity", OperatorAssociativity$0);
|
|
10028
10109
|
}
|
|
10029
|
-
var ThinArrowFunction$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)((0, import_lib2.$S)(Async, _)),
|
|
10110
|
+
var ThinArrowFunction$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)((0, import_lib2.$S)(Async, _)), ThinArrowParameters, (0, import_lib2.$E)(ReturnTypeSuffix), (0, import_lib2.$E)(_), ThinArrow, (0, import_lib2.$C)(BracedObjectSingleLineStatements, NoCommaBracedOrEmptyBlock)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
10030
10111
|
var async = $1, parameters = $2, returnType = $3, ws = $4, arrow = $5, block = $6;
|
|
10031
10112
|
async || (async = []);
|
|
10032
10113
|
let generator = [];
|
|
@@ -11060,7 +11141,17 @@ ${js}`
|
|
|
11060
11141
|
};
|
|
11061
11142
|
else if ({ name } = last, !name)
|
|
11062
11143
|
return $skip;
|
|
11063
|
-
|
|
11144
|
+
if (name[0] === "#" && (name = name.slice(1)), !pre.length && post?.token === "?" && value.type === "Identifier") {
|
|
11145
|
+
let dots = { $loc, token: "..." }, paren = parenthesizeExpression({ children: ["(", value, " != null) && {", name, "}"] });
|
|
11146
|
+
return {
|
|
11147
|
+
type: "SpreadProperty",
|
|
11148
|
+
children: [ws, dots, paren],
|
|
11149
|
+
names: value.names,
|
|
11150
|
+
dots,
|
|
11151
|
+
value: paren
|
|
11152
|
+
};
|
|
11153
|
+
}
|
|
11154
|
+
return {
|
|
11064
11155
|
type: "Property",
|
|
11065
11156
|
children: [ws, name, ": ", processUnaryExpression(pre, value, post)],
|
|
11066
11157
|
name,
|
|
@@ -11072,7 +11163,17 @@ ${js}`
|
|
|
11072
11163
|
function PropertyDefinition(ctx, state2) {
|
|
11073
11164
|
return (0, import_lib2.$EVENT_C)(ctx, state2, "PropertyDefinition", PropertyDefinition$$);
|
|
11074
11165
|
}
|
|
11075
|
-
var NamedProperty$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PropertyName, (0, import_lib2.$E)(_), Colon, PostfixedExpression), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
11166
|
+
var NamedProperty$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PropertyName, (0, import_lib2.$EXPECT)($L6, 'NamedProperty "?"'), (0, import_lib2.$E)(_), Colon, (0, import_lib2.$E)(_), PostfixedExpression), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
11167
|
+
var name = $1, exp = $6;
|
|
11168
|
+
let { ref, refAssignment } = maybeRefAssignment(exp), checkExp = refAssignment ? parenthesizeExpression(refAssignment) : exp, dots = { $loc, token: "..." }, paren = parenthesizeExpression({ children: [checkExp, " != null ? {", name, ": ", ref, "} : {}"] });
|
|
11169
|
+
return {
|
|
11170
|
+
type: "SpreadProperty",
|
|
11171
|
+
children: [dots, paren],
|
|
11172
|
+
names: exp.names || [],
|
|
11173
|
+
dots,
|
|
11174
|
+
value: paren
|
|
11175
|
+
};
|
|
11176
|
+
}), NamedProperty$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(PropertyName, (0, import_lib2.$E)(_), Colon, PostfixedExpression), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
11076
11177
|
var name = $1, exp = $4;
|
|
11077
11178
|
return {
|
|
11078
11179
|
type: "Property",
|
|
@@ -11081,9 +11182,9 @@ ${js}`
|
|
|
11081
11182
|
names: exp.names || [],
|
|
11082
11183
|
value: exp
|
|
11083
11184
|
};
|
|
11084
|
-
});
|
|
11185
|
+
}), NamedProperty$$ = [NamedProperty$0, NamedProperty$1];
|
|
11085
11186
|
function NamedProperty(ctx, state2) {
|
|
11086
|
-
return (0, import_lib2.$
|
|
11187
|
+
return (0, import_lib2.$EVENT_C)(ctx, state2, "NamedProperty", NamedProperty$$);
|
|
11087
11188
|
}
|
|
11088
11189
|
var SnugNamedProperty$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(PropertyName, Colon, MaybeNestedExpression, (0, import_lib2.$E)((0, import_lib2.$S)((0, import_lib2.$S)((0, import_lib2.$E)(_), PostfixStatement), (0, import_lib2.$Y)((0, import_lib2.$S)(Nested, NamedProperty))))), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
11089
11190
|
var name = $1, colon = $2, expression = $3, post = $4;
|
|
@@ -16384,6 +16485,13 @@ ${js}`
|
|
|
16384
16485
|
function CoffeePrototypeEnabled(ctx, state2) {
|
|
16385
16486
|
return (0, import_lib2.$EVENT)(ctx, state2, "CoffeePrototypeEnabled", CoffeePrototypeEnabled$0);
|
|
16386
16487
|
}
|
|
16488
|
+
var ESArrowFunctionEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'ESArrowFunctionEnabled ""'), function($skip, $loc, $0, $1) {
|
|
16489
|
+
if (!config.esArrowFunction)
|
|
16490
|
+
return $skip;
|
|
16491
|
+
});
|
|
16492
|
+
function ESArrowFunctionEnabled(ctx, state2) {
|
|
16493
|
+
return (0, import_lib2.$EVENT)(ctx, state2, "ESArrowFunctionEnabled", ESArrowFunctionEnabled$0);
|
|
16494
|
+
}
|
|
16387
16495
|
var JSXCodeNestedEnabled$0 = (0, import_lib2.$TV)((0, import_lib2.$EXPECT)($L0, 'JSXCodeNestedEnabled ""'), function($skip, $loc, $0, $1) {
|
|
16388
16496
|
if (!config.jsxCodeNested)
|
|
16389
16497
|
return $skip;
|
|
@@ -16440,6 +16548,7 @@ ${js}`
|
|
|
16440
16548
|
globals: [],
|
|
16441
16549
|
iife: !1,
|
|
16442
16550
|
implicitReturns: !0,
|
|
16551
|
+
esArrowFunction: !1,
|
|
16443
16552
|
jsxCode: !1,
|
|
16444
16553
|
objectIs: !1,
|
|
16445
16554
|
react: !1,
|
|
@@ -16482,6 +16591,14 @@ ${js}`
|
|
|
16482
16591
|
config[option] = b;
|
|
16483
16592
|
b && (config.objectIs = !1);
|
|
16484
16593
|
}
|
|
16594
|
+
}), Object.defineProperty(config, "esCompat", {
|
|
16595
|
+
set(b) {
|
|
16596
|
+
for (let option of [
|
|
16597
|
+
"esArrowFunction"
|
|
16598
|
+
])
|
|
16599
|
+
config[option] = b;
|
|
16600
|
+
config.implicitReturns = !b;
|
|
16601
|
+
}
|
|
16485
16602
|
}), Object.defineProperty(config, "jsxCode", {
|
|
16486
16603
|
set(b) {
|
|
16487
16604
|
for (let option of ["jsxCodeNested", "jsxCodeSameLine"])
|
|
@@ -16936,6 +17053,9 @@ ${upstreamMap.comment(targetPath)}`;
|
|
|
16936
17053
|
return [lastMapping[2], lastMapping[3] + character - lastMappingPosition];
|
|
16937
17054
|
};
|
|
16938
17055
|
|
|
17056
|
+
// source/main.civet
|
|
17057
|
+
init_browser_shim();
|
|
17058
|
+
|
|
16939
17059
|
// source/state-cache.civet
|
|
16940
17060
|
var StateCache = class {
|
|
16941
17061
|
cache = /* @__PURE__ */ new Map();
|
|
@@ -17082,9 +17202,11 @@ ${counts}`;
|
|
|
17082
17202
|
options.sourceMap = new SourceMap(src, filename2);
|
|
17083
17203
|
let code = generate_default(ast2, options);
|
|
17084
17204
|
if (checkErrors(), options.upstreamSourceMap != null && options.sourceMap.composeUpstream(options.upstreamSourceMap), options.inlineMap) {
|
|
17085
|
-
let outputFilename = options.outputFilename ?? (options.js ? filename2 + ".jsx" : filename2 + ".tsx");
|
|
17205
|
+
let outputFilename = options.outputFilename ?? (options.js ? filename2 + ".jsx" : filename2 + ".tsx"), outDir = dirname(outputFilename);
|
|
17206
|
+
options.sourceMap.sourceFileName = relative(outDir, options.sourceMap.sourceFileName) || options.sourceMap.sourceFileName;
|
|
17207
|
+
let relativeOut = relative(outDir, outputFilename) || outputFilename;
|
|
17086
17208
|
return `${code}
|
|
17087
|
-
${options.sourceMap.comment(
|
|
17209
|
+
${options.sourceMap.comment(relativeOut)}`;
|
|
17088
17210
|
} else
|
|
17089
17211
|
return { code, sourceMap: options.sourceMap };
|
|
17090
17212
|
}
|