@danielx/civet 0.7.26 → 0.7.27
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 +6 -0
- package/dist/browser.js +248 -40
- package/dist/main.js +248 -40
- package/dist/main.mjs +248 -40
- package/package.json +5 -1
package/dist/main.mjs
CHANGED
|
@@ -504,6 +504,7 @@ __export(lib_exports, {
|
|
|
504
504
|
expressionizeTypeIf: () => expressionizeTypeIf,
|
|
505
505
|
forRange: () => forRange,
|
|
506
506
|
gatherBindingCode: () => gatherBindingCode,
|
|
507
|
+
gatherBindingPatternTypeSuffix: () => gatherBindingPatternTypeSuffix,
|
|
507
508
|
gatherRecursive: () => gatherRecursive,
|
|
508
509
|
gatherRecursiveAll: () => gatherRecursiveAll,
|
|
509
510
|
gatherRecursiveWithinFunction: () => gatherRecursiveWithinFunction,
|
|
@@ -1307,7 +1308,7 @@ function maybeRefAssignment(exp, base = "ref") {
|
|
|
1307
1308
|
|
|
1308
1309
|
// source/parser/binding.civet
|
|
1309
1310
|
function adjustAtBindings(statements, asThis = false) {
|
|
1310
|
-
gatherRecursiveAll(statements, (
|
|
1311
|
+
gatherRecursiveAll(statements, ($) => $.type === "AtBindingProperty").forEach((binding) => {
|
|
1311
1312
|
const { ref } = binding;
|
|
1312
1313
|
if (asThis) {
|
|
1313
1314
|
const atBinding = binding.binding;
|
|
@@ -1326,17 +1327,19 @@ function adjustAtBindings(statements, asThis = false) {
|
|
|
1326
1327
|
});
|
|
1327
1328
|
}
|
|
1328
1329
|
function adjustBindingElements(elements) {
|
|
1329
|
-
const names = elements.flatMap((
|
|
1330
|
+
const names = elements.flatMap(($1) => $1.names || []);
|
|
1331
|
+
const { length } = elements;
|
|
1330
1332
|
let blockPrefix, restIndex = -1, restCount = 0;
|
|
1331
|
-
|
|
1333
|
+
for (let i1 = 0, len3 = elements.length; i1 < len3; i1++) {
|
|
1334
|
+
const i = i1;
|
|
1335
|
+
const { type } = elements[i1];
|
|
1332
1336
|
if (type === "BindingRestElement") {
|
|
1333
|
-
if (restIndex < 0)
|
|
1337
|
+
if (restIndex < 0) {
|
|
1334
1338
|
restIndex = i;
|
|
1335
|
-
|
|
1339
|
+
}
|
|
1340
|
+
restCount++;
|
|
1336
1341
|
}
|
|
1337
|
-
|
|
1338
|
-
return;
|
|
1339
|
-
});
|
|
1342
|
+
}
|
|
1340
1343
|
if (restCount === 0) {
|
|
1341
1344
|
return {
|
|
1342
1345
|
children: elements,
|
|
@@ -1355,7 +1358,7 @@ function adjustBindingElements(elements) {
|
|
|
1355
1358
|
l++;
|
|
1356
1359
|
blockPrefix = {
|
|
1357
1360
|
type: "PostRestBindingElements",
|
|
1358
|
-
children: ["[",
|
|
1361
|
+
children: ["[", trimFirstSpace(after), "] = ", restIdentifier, ".splice(-", l.toString(), ")"],
|
|
1359
1362
|
names: after.flatMap((p) => p.names)
|
|
1360
1363
|
};
|
|
1361
1364
|
}
|
|
@@ -1415,6 +1418,100 @@ function arrayElementHasTrailingComma(elementNode) {
|
|
|
1415
1418
|
const lastChild = (ref1 = elementNode.children)[ref1.length - 1];
|
|
1416
1419
|
return lastChild && lastChild[lastChild.length - 1]?.token === ",";
|
|
1417
1420
|
}
|
|
1421
|
+
function gatherBindingPatternTypeSuffix(pattern) {
|
|
1422
|
+
if (pattern.typeSuffix != null) {
|
|
1423
|
+
return pattern;
|
|
1424
|
+
}
|
|
1425
|
+
let count = 0;
|
|
1426
|
+
switch (pattern.type) {
|
|
1427
|
+
case "ArrayBindingPattern": {
|
|
1428
|
+
const results = [];
|
|
1429
|
+
for (let ref2 = pattern.elements, i2 = 0, len1 = ref2.length; i2 < len1; i2++) {
|
|
1430
|
+
const elem = ref2[i2];
|
|
1431
|
+
let { typeSuffix } = elem;
|
|
1432
|
+
typeSuffix ??= elem.binding?.typeSuffix;
|
|
1433
|
+
if (typeSuffix) {
|
|
1434
|
+
count++;
|
|
1435
|
+
}
|
|
1436
|
+
let typeElement = [typeSuffix?.t, elem.delim];
|
|
1437
|
+
if (typeSuffix?.optional) {
|
|
1438
|
+
typeElement[0] = parenthesizeType(typeElement[0]);
|
|
1439
|
+
typeElement.unshift("undefined |");
|
|
1440
|
+
}
|
|
1441
|
+
if (elem.type === "BindingRestElement") {
|
|
1442
|
+
typeElement[0] ??= "unknown[]";
|
|
1443
|
+
typeElement.unshift(elem.dots);
|
|
1444
|
+
} else {
|
|
1445
|
+
typeElement[0] ??= "unknown";
|
|
1446
|
+
}
|
|
1447
|
+
results.push(typeElement);
|
|
1448
|
+
}
|
|
1449
|
+
;
|
|
1450
|
+
const types = results;
|
|
1451
|
+
if (count) {
|
|
1452
|
+
const t = [": [", types, "]"];
|
|
1453
|
+
pattern.typeSuffix = {
|
|
1454
|
+
type: "TypeSuffix",
|
|
1455
|
+
ts: true,
|
|
1456
|
+
t,
|
|
1457
|
+
children: [t]
|
|
1458
|
+
};
|
|
1459
|
+
}
|
|
1460
|
+
;
|
|
1461
|
+
break;
|
|
1462
|
+
}
|
|
1463
|
+
case "ObjectBindingPattern": {
|
|
1464
|
+
let restType;
|
|
1465
|
+
const results1 = [];
|
|
1466
|
+
for (let ref3 = pattern.properties, i3 = 0, len22 = ref3.length; i3 < len22; i3++) {
|
|
1467
|
+
const prop = ref3[i3];
|
|
1468
|
+
let { typeSuffix } = prop;
|
|
1469
|
+
typeSuffix ??= prop.value?.typeSuffix;
|
|
1470
|
+
if (typeSuffix) {
|
|
1471
|
+
count++;
|
|
1472
|
+
}
|
|
1473
|
+
typeSuffix ??= {
|
|
1474
|
+
type: "TypeSuffix",
|
|
1475
|
+
ts: true,
|
|
1476
|
+
children: [": unknown"]
|
|
1477
|
+
};
|
|
1478
|
+
switch (prop.type) {
|
|
1479
|
+
case "BindingProperty": {
|
|
1480
|
+
const ws = prop.children.slice(0, prop.children.indexOf(prop.name));
|
|
1481
|
+
results1.push([...ws, prop.name, typeSuffix, prop.delim]);
|
|
1482
|
+
break;
|
|
1483
|
+
}
|
|
1484
|
+
case "AtBindingProperty": {
|
|
1485
|
+
const ws = prop.children.slice(0, prop.children.indexOf(prop.binding));
|
|
1486
|
+
results1.push([...ws, prop.ref.id, typeSuffix, prop.delim]);
|
|
1487
|
+
break;
|
|
1488
|
+
}
|
|
1489
|
+
case "BindingRestProperty": {
|
|
1490
|
+
restType = prop.typeSuffix?.t;
|
|
1491
|
+
continue;
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
}
|
|
1495
|
+
;
|
|
1496
|
+
const types = results1;
|
|
1497
|
+
if (count) {
|
|
1498
|
+
const t = ["{", types, "}"];
|
|
1499
|
+
if (restType != null) {
|
|
1500
|
+
t.push(" & ", parenthesizeType(trimFirstSpace(restType)));
|
|
1501
|
+
}
|
|
1502
|
+
pattern.typeSuffix = {
|
|
1503
|
+
type: "TypeSuffix",
|
|
1504
|
+
ts: true,
|
|
1505
|
+
t,
|
|
1506
|
+
children: [": ", t]
|
|
1507
|
+
};
|
|
1508
|
+
}
|
|
1509
|
+
;
|
|
1510
|
+
break;
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
return pattern;
|
|
1514
|
+
}
|
|
1418
1515
|
|
|
1419
1516
|
// source/parser/function.civet
|
|
1420
1517
|
function isVoidType(t) {
|
|
@@ -3244,6 +3341,9 @@ function processAssignmentDeclaration(decl, pattern, suffix, ws, assign, e) {
|
|
|
3244
3341
|
let [splices, assignments] = gatherBindingCode(pattern);
|
|
3245
3342
|
splices = splices.map((s) => [", ", s]);
|
|
3246
3343
|
const thisAssignments = assignments.map((a) => ["", a, ";"]);
|
|
3344
|
+
if ("typeSuffix" in pattern) {
|
|
3345
|
+
suffix ??= pattern.typeSuffix;
|
|
3346
|
+
}
|
|
3247
3347
|
const initializer = makeNode({
|
|
3248
3348
|
type: "Initializer",
|
|
3249
3349
|
expression: e,
|
|
@@ -6514,6 +6614,7 @@ var grammar = {
|
|
|
6514
6614
|
NestedBindingPropertyList,
|
|
6515
6615
|
BindingProperty,
|
|
6516
6616
|
BindingRestProperty,
|
|
6617
|
+
BindingTypeSuffix,
|
|
6517
6618
|
NestedBindingElements,
|
|
6518
6619
|
BindingElement,
|
|
6519
6620
|
BindingRestElement,
|
|
@@ -6851,6 +6952,7 @@ var grammar = {
|
|
|
6851
6952
|
DotDot,
|
|
6852
6953
|
DotDotDot,
|
|
6853
6954
|
DoubleColon,
|
|
6955
|
+
DoubleColonAsColon,
|
|
6854
6956
|
DoubleQuote,
|
|
6855
6957
|
Each,
|
|
6856
6958
|
Else,
|
|
@@ -6965,6 +7067,8 @@ var grammar = {
|
|
|
6965
7067
|
JSXChildExpression,
|
|
6966
7068
|
IndentedJSXChildExpression,
|
|
6967
7069
|
NestedJSXChildExpression,
|
|
7070
|
+
JSXAngleChild,
|
|
7071
|
+
JSXAngleChildExpression,
|
|
6968
7072
|
UsingDeclaration,
|
|
6969
7073
|
UsingBinding,
|
|
6970
7074
|
UsingJSModeError,
|
|
@@ -7357,7 +7461,7 @@ var $R2 = (0, import_lib3.$R)(new RegExp("(as|of|satisfies|then|when|implements|
|
|
|
7357
7461
|
var $R3 = (0, import_lib3.$R)(new RegExp("[0-9]", "suy"));
|
|
7358
7462
|
var $R4 = (0, import_lib3.$R)(new RegExp("(?!\\p{ID_Start}|[_$0-9(\\[{])", "suy"));
|
|
7359
7463
|
var $R5 = (0, import_lib3.$R)(new RegExp("[ \\t]", "suy"));
|
|
7360
|
-
var $R6 = (0, import_lib3.$R)(new RegExp("\\p{ID_Continue}|[\\u200C\\u200D$.#]", "suy"));
|
|
7464
|
+
var $R6 = (0, import_lib3.$R)(new RegExp("\\p{ID_Continue}|[\\u200C\\u200D$.#{]", "suy"));
|
|
7361
7465
|
var $R7 = (0, import_lib3.$R)(new RegExp("[&=]", "suy"));
|
|
7362
7466
|
var $R8 = (0, import_lib3.$R)(new RegExp("(?=['\"`])", "suy"));
|
|
7363
7467
|
var $R9 = (0, import_lib3.$R)(new RegExp("(?=[\\/?])", "suy"));
|
|
@@ -8343,7 +8447,7 @@ var ParenthesizedExpression$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(OpenPar
|
|
|
8343
8447
|
function ParenthesizedExpression(ctx, state2) {
|
|
8344
8448
|
return (0, import_lib3.$EVENT)(ctx, state2, "ParenthesizedExpression", ParenthesizedExpression$0);
|
|
8345
8449
|
}
|
|
8346
|
-
var Placeholder$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(Dot, (0, import_lib3.$N)((0, import_lib3.$EXPECT)($R6, "Placeholder /\\p{ID_Continue}|[\\u200C\\u200D$.#]/")), (0, import_lib3.$E)(PlaceholderTypeSuffix)), function($skip, $loc, $0, $1, $2, $3) {
|
|
8450
|
+
var Placeholder$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(Dot, (0, import_lib3.$N)((0, import_lib3.$EXPECT)($R6, "Placeholder /\\p{ID_Continue}|[\\u200C\\u200D$.#{]/")), (0, import_lib3.$E)(PlaceholderTypeSuffix)), function($skip, $loc, $0, $1, $2, $3) {
|
|
8347
8451
|
var dot = $1;
|
|
8348
8452
|
var typeSuffix = $3;
|
|
8349
8453
|
return {
|
|
@@ -8363,7 +8467,7 @@ var Placeholder$1 = (0, import_lib3.$TS)((0, import_lib3.$S)(Ampersand, (0, impo
|
|
|
8363
8467
|
children: [amp]
|
|
8364
8468
|
};
|
|
8365
8469
|
});
|
|
8366
|
-
var Placeholder$2 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$Y)(ExplicitAccessStart), (0, import_lib3.$Y)(PropertyAccess), (0, import_lib3.$N)(NumericLiteral)), function($skip, $loc, $0, $1, $2, $3) {
|
|
8470
|
+
var Placeholder$2 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$Y)(ExplicitAccessStart), (0, import_lib3.$Y)((0, import_lib3.$C)(PropertyAccess, PropertyGlob)), (0, import_lib3.$N)(NumericLiteral)), function($skip, $loc, $0, $1, $2, $3) {
|
|
8367
8471
|
return {
|
|
8368
8472
|
type: "Placeholder",
|
|
8369
8473
|
subtype: "&",
|
|
@@ -9432,9 +9536,10 @@ var ParameterElement$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib
|
|
|
9432
9536
|
var typeSuffix = $5;
|
|
9433
9537
|
var initializer = $6;
|
|
9434
9538
|
var delim = $7;
|
|
9539
|
+
typeSuffix ??= binding.typeSuffix;
|
|
9435
9540
|
return {
|
|
9436
9541
|
type: "Parameter",
|
|
9437
|
-
children: $
|
|
9542
|
+
children: [$1, accessModifier, $3, binding, typeSuffix, initializer, delim],
|
|
9438
9543
|
names: binding.names,
|
|
9439
9544
|
typeSuffix,
|
|
9440
9545
|
accessModifier,
|
|
@@ -9550,12 +9655,13 @@ var ObjectBindingPattern$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import
|
|
|
9550
9655
|
var c = $3;
|
|
9551
9656
|
var ws2 = $4;
|
|
9552
9657
|
var close = $5;
|
|
9553
|
-
|
|
9658
|
+
const properties = c.children;
|
|
9659
|
+
return gatherBindingPatternTypeSuffix({
|
|
9554
9660
|
type: "ObjectBindingPattern",
|
|
9555
|
-
children: [ws1, open,
|
|
9661
|
+
children: [ws1, open, properties, ws2, close],
|
|
9556
9662
|
names: c.names,
|
|
9557
|
-
properties
|
|
9558
|
-
};
|
|
9663
|
+
properties
|
|
9664
|
+
});
|
|
9559
9665
|
});
|
|
9560
9666
|
function ObjectBindingPattern(ctx, state2) {
|
|
9561
9667
|
return (0, import_lib3.$EVENT)(ctx, state2, "ObjectBindingPattern", ObjectBindingPattern$0);
|
|
@@ -9590,13 +9696,13 @@ var ArrayBindingPattern$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_
|
|
|
9590
9696
|
var c = $3;
|
|
9591
9697
|
var ws2 = $4;
|
|
9592
9698
|
var close = $5;
|
|
9593
|
-
return {
|
|
9699
|
+
return gatherBindingPatternTypeSuffix({
|
|
9594
9700
|
...c,
|
|
9595
9701
|
// names, blockPrefix, length
|
|
9596
9702
|
type: "ArrayBindingPattern",
|
|
9597
9703
|
elements: c.children,
|
|
9598
9704
|
children: [ws1, open, c.children, ws2, close]
|
|
9599
|
-
};
|
|
9705
|
+
});
|
|
9600
9706
|
});
|
|
9601
9707
|
function ArrayBindingPattern(ctx, state2) {
|
|
9602
9708
|
return (0, import_lib3.$EVENT)(ctx, state2, "ArrayBindingPattern", ArrayBindingPattern$0);
|
|
@@ -9617,6 +9723,7 @@ var BindingElementList$0 = (0, import_lib3.$TV)((0, import_lib3.$P)((0, import_l
|
|
|
9617
9723
|
return elements.map(([element, delim]) => {
|
|
9618
9724
|
return {
|
|
9619
9725
|
...element,
|
|
9726
|
+
delim,
|
|
9620
9727
|
// BindingElement.children is a tuple of the form [ws, element]
|
|
9621
9728
|
children: [...element.children, delim]
|
|
9622
9729
|
};
|
|
@@ -9667,38 +9774,57 @@ function NestedBindingPropertyList(ctx, state2) {
|
|
|
9667
9774
|
return (0, import_lib3.$EVENT)(ctx, state2, "NestedBindingPropertyList", NestedBindingPropertyList$0);
|
|
9668
9775
|
}
|
|
9669
9776
|
var BindingProperty$0 = BindingRestProperty;
|
|
9670
|
-
var BindingProperty$1 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)(_), PropertyName, (0, import_lib3.$E)(_), Colon, (0, import_lib3.$E)(_), (0, import_lib3.$C)(BindingIdentifier, BindingPattern), (0, import_lib3.$E)(Initializer)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
|
|
9777
|
+
var BindingProperty$1 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)(_), PropertyName, (0, import_lib3.$E)(_), Colon, (0, import_lib3.$E)(_), (0, import_lib3.$C)(BindingIdentifier, BindingPattern), (0, import_lib3.$E)(BindingTypeSuffix), (0, import_lib3.$E)(Initializer)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8) {
|
|
9671
9778
|
var name = $2;
|
|
9672
9779
|
var value = $6;
|
|
9673
|
-
var
|
|
9780
|
+
var typeSuffix = $7;
|
|
9781
|
+
var initializer = $8;
|
|
9674
9782
|
return {
|
|
9675
9783
|
type: "BindingProperty",
|
|
9676
|
-
children: $
|
|
9784
|
+
children: [$1, name, $3, $4, $5, value, initializer],
|
|
9785
|
+
// omit typeSuffix
|
|
9677
9786
|
name,
|
|
9678
9787
|
value,
|
|
9788
|
+
typeSuffix,
|
|
9679
9789
|
initializer,
|
|
9680
9790
|
names: value.names
|
|
9681
9791
|
};
|
|
9682
9792
|
});
|
|
9683
|
-
var BindingProperty$2 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)(_), (0, import_lib3.$E)(Caret), BindingIdentifier, (0, import_lib3.$E)(Initializer)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
9793
|
+
var BindingProperty$2 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)(_), (0, import_lib3.$E)(Caret), BindingIdentifier, (0, import_lib3.$E)(BindingTypeSuffix), (0, import_lib3.$E)(Initializer)), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
9684
9794
|
var ws = $1;
|
|
9685
9795
|
var pin = $2;
|
|
9686
9796
|
var binding = $3;
|
|
9687
|
-
var
|
|
9797
|
+
var typeSuffix = $4;
|
|
9798
|
+
var initializer = $5;
|
|
9799
|
+
let children = [ws, binding, initializer];
|
|
9688
9800
|
if (binding.type === "AtBinding") {
|
|
9689
9801
|
return {
|
|
9690
9802
|
type: "AtBindingProperty",
|
|
9691
|
-
children
|
|
9803
|
+
children,
|
|
9692
9804
|
binding,
|
|
9805
|
+
typeSuffix,
|
|
9693
9806
|
ref: binding.ref,
|
|
9694
9807
|
initializer,
|
|
9695
9808
|
names: []
|
|
9696
9809
|
};
|
|
9697
9810
|
}
|
|
9698
9811
|
if (pin) {
|
|
9812
|
+
children = [ws, binding];
|
|
9813
|
+
if (typeSuffix) {
|
|
9814
|
+
children.push({
|
|
9815
|
+
type: "Error",
|
|
9816
|
+
message: "Pinned properties cannot have type annotations"
|
|
9817
|
+
});
|
|
9818
|
+
}
|
|
9819
|
+
if (initializer) {
|
|
9820
|
+
children.push({
|
|
9821
|
+
type: "Error",
|
|
9822
|
+
message: "Pinned properties cannot have initializers"
|
|
9823
|
+
});
|
|
9824
|
+
}
|
|
9699
9825
|
return {
|
|
9700
9826
|
type: "PinProperty",
|
|
9701
|
-
children
|
|
9827
|
+
children,
|
|
9702
9828
|
name: binding,
|
|
9703
9829
|
value: {
|
|
9704
9830
|
type: "PinPattern",
|
|
@@ -9708,9 +9834,10 @@ var BindingProperty$2 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3
|
|
|
9708
9834
|
}
|
|
9709
9835
|
return {
|
|
9710
9836
|
type: "BindingProperty",
|
|
9711
|
-
children
|
|
9837
|
+
children,
|
|
9712
9838
|
name: binding,
|
|
9713
9839
|
value: void 0,
|
|
9840
|
+
typeSuffix,
|
|
9714
9841
|
initializer,
|
|
9715
9842
|
names: binding.names,
|
|
9716
9843
|
identifier: binding
|
|
@@ -9720,13 +9847,15 @@ var BindingProperty$$ = [BindingProperty$0, BindingProperty$1, BindingProperty$2
|
|
|
9720
9847
|
function BindingProperty(ctx, state2) {
|
|
9721
9848
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "BindingProperty", BindingProperty$$);
|
|
9722
9849
|
}
|
|
9723
|
-
var BindingRestProperty$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)(_), DotDotDot, BindingIdentifier), function($skip, $loc, $0, $1, $2, $3) {
|
|
9850
|
+
var BindingRestProperty$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)(_), DotDotDot, BindingIdentifier, (0, import_lib3.$E)(BindingTypeSuffix)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
9724
9851
|
var ws = $1;
|
|
9725
9852
|
var dots = $2;
|
|
9726
9853
|
var id = $3;
|
|
9854
|
+
var typeSuffix = $4;
|
|
9727
9855
|
return {
|
|
9728
9856
|
...id,
|
|
9729
9857
|
type: "BindingRestProperty",
|
|
9858
|
+
typeSuffix,
|
|
9730
9859
|
children: [...ws || [], dots, ...id.children]
|
|
9731
9860
|
};
|
|
9732
9861
|
});
|
|
@@ -9737,6 +9866,7 @@ var BindingRestProperty$1 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_
|
|
|
9737
9866
|
return {
|
|
9738
9867
|
...id,
|
|
9739
9868
|
type: "BindingRestProperty",
|
|
9869
|
+
typeSuffix: void 0,
|
|
9740
9870
|
children: [...ws || [], dots, ...id.children]
|
|
9741
9871
|
};
|
|
9742
9872
|
});
|
|
@@ -9744,6 +9874,21 @@ var BindingRestProperty$$ = [BindingRestProperty$0, BindingRestProperty$1];
|
|
|
9744
9874
|
function BindingRestProperty(ctx, state2) {
|
|
9745
9875
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "BindingRestProperty", BindingRestProperty$$);
|
|
9746
9876
|
}
|
|
9877
|
+
var BindingTypeSuffix$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)(_), (0, import_lib3.$E)(QuestionMark), (0, import_lib3.$E)(_), DoubleColonAsColon, MaybeNestedType), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
9878
|
+
var optional = $2;
|
|
9879
|
+
var colon = $4;
|
|
9880
|
+
var t = $5;
|
|
9881
|
+
return {
|
|
9882
|
+
type: "TypeSuffix",
|
|
9883
|
+
ts: true,
|
|
9884
|
+
optional,
|
|
9885
|
+
t,
|
|
9886
|
+
children: $0
|
|
9887
|
+
};
|
|
9888
|
+
});
|
|
9889
|
+
function BindingTypeSuffix(ctx, state2) {
|
|
9890
|
+
return (0, import_lib3.$EVENT)(ctx, state2, "BindingTypeSuffix", BindingTypeSuffix$0);
|
|
9891
|
+
}
|
|
9747
9892
|
var NestedBindingElements$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(PushIndent, (0, import_lib3.$Q)(NestedBindingElementList), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
9748
9893
|
var elements = $2;
|
|
9749
9894
|
if (!elements.length)
|
|
@@ -9754,10 +9899,11 @@ function NestedBindingElements(ctx, state2) {
|
|
|
9754
9899
|
return (0, import_lib3.$EVENT)(ctx, state2, "NestedBindingElements", NestedBindingElements$0);
|
|
9755
9900
|
}
|
|
9756
9901
|
var BindingElement$0 = BindingRestElement;
|
|
9757
|
-
var BindingElement$1 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)(_), (0, import_lib3.$C)(BindingIdentifier, BindingPattern), (0, import_lib3.$E)(Initializer)), function($skip, $loc, $0, $1, $2, $3) {
|
|
9902
|
+
var BindingElement$1 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)(_), (0, import_lib3.$C)(BindingIdentifier, BindingPattern), (0, import_lib3.$E)(BindingTypeSuffix), (0, import_lib3.$E)(Initializer)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
9758
9903
|
var ws = $1;
|
|
9759
9904
|
var binding = $2;
|
|
9760
|
-
var
|
|
9905
|
+
var typeSuffix = $3;
|
|
9906
|
+
var initializer = $4;
|
|
9761
9907
|
if (binding.children) {
|
|
9762
9908
|
binding = {
|
|
9763
9909
|
...binding,
|
|
@@ -9766,16 +9912,17 @@ var BindingElement$1 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.
|
|
|
9766
9912
|
};
|
|
9767
9913
|
}
|
|
9768
9914
|
return {
|
|
9915
|
+
type: "BindingElement",
|
|
9769
9916
|
names: binding.names,
|
|
9917
|
+
typeSuffix,
|
|
9918
|
+
binding,
|
|
9770
9919
|
children: [ws, binding]
|
|
9771
9920
|
};
|
|
9772
9921
|
});
|
|
9773
9922
|
var BindingElement$2 = (0, import_lib3.$TV)((0, import_lib3.$Y)((0, import_lib3.$S)((0, import_lib3.$E)(_), (0, import_lib3.$EXPECT)($L17, 'BindingElement ","'))), function($skip, $loc, $0, $1) {
|
|
9774
9923
|
return {
|
|
9775
|
-
|
|
9776
|
-
|
|
9777
|
-
children: [""]
|
|
9778
|
-
}],
|
|
9924
|
+
type: "ElisionElement",
|
|
9925
|
+
children: [""],
|
|
9779
9926
|
names: []
|
|
9780
9927
|
};
|
|
9781
9928
|
});
|
|
@@ -9783,14 +9930,17 @@ var BindingElement$$ = [BindingElement$0, BindingElement$1, BindingElement$2];
|
|
|
9783
9930
|
function BindingElement(ctx, state2) {
|
|
9784
9931
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "BindingElement", BindingElement$$);
|
|
9785
9932
|
}
|
|
9786
|
-
var BindingRestElement$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)(_), DotDotDot, (0, import_lib3.$C)(BindingIdentifier, BindingPattern, EmptyBindingPattern)), function($skip, $loc, $0, $1, $2, $3) {
|
|
9933
|
+
var BindingRestElement$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)(_), DotDotDot, (0, import_lib3.$C)(BindingIdentifier, BindingPattern, EmptyBindingPattern), (0, import_lib3.$E)(BindingTypeSuffix)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
9787
9934
|
var ws = $1;
|
|
9788
9935
|
var dots = $2;
|
|
9789
9936
|
var binding = $3;
|
|
9937
|
+
var typeSuffix = $4;
|
|
9790
9938
|
return {
|
|
9791
9939
|
type: "BindingRestElement",
|
|
9792
9940
|
children: [ws, [dots, binding]],
|
|
9941
|
+
dots,
|
|
9793
9942
|
binding,
|
|
9943
|
+
typeSuffix,
|
|
9794
9944
|
name: binding.name,
|
|
9795
9945
|
names: binding.names,
|
|
9796
9946
|
rest: true
|
|
@@ -9803,6 +9953,7 @@ var BindingRestElement$1 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_l
|
|
|
9803
9953
|
return {
|
|
9804
9954
|
type: "BindingRestElement",
|
|
9805
9955
|
children: [...ws || [], dots, binding],
|
|
9956
|
+
dots,
|
|
9806
9957
|
binding,
|
|
9807
9958
|
name: binding.name,
|
|
9808
9959
|
names: binding.names,
|
|
@@ -13897,9 +14048,10 @@ var LexicalBinding$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(BindingPattern,
|
|
|
13897
14048
|
var suffix = $2;
|
|
13898
14049
|
var initializer = $3;
|
|
13899
14050
|
const [splices, thisAssignments] = gatherBindingCode(pattern);
|
|
14051
|
+
suffix ??= pattern.typeSuffix;
|
|
13900
14052
|
return {
|
|
13901
14053
|
type: "Binding",
|
|
13902
|
-
children:
|
|
14054
|
+
children: [pattern, suffix, initializer],
|
|
13903
14055
|
names: pattern.names,
|
|
13904
14056
|
pattern,
|
|
13905
14057
|
suffix,
|
|
@@ -14619,6 +14771,12 @@ var DoubleColon$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L155, 'Double
|
|
|
14619
14771
|
function DoubleColon(ctx, state2) {
|
|
14620
14772
|
return (0, import_lib3.$EVENT)(ctx, state2, "DoubleColon", DoubleColon$0);
|
|
14621
14773
|
}
|
|
14774
|
+
var DoubleColonAsColon$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L155, 'DoubleColonAsColon "::"'), function($skip, $loc, $0, $1) {
|
|
14775
|
+
return { $loc, token: ":" };
|
|
14776
|
+
});
|
|
14777
|
+
function DoubleColonAsColon(ctx, state2) {
|
|
14778
|
+
return (0, import_lib3.$EVENT)(ctx, state2, "DoubleColonAsColon", DoubleColonAsColon$0);
|
|
14779
|
+
}
|
|
14622
14780
|
var DoubleQuote$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L156, 'DoubleQuote "\\\\\\""'), function($skip, $loc, $0, $1) {
|
|
14623
14781
|
return { $loc, token: $1 };
|
|
14624
14782
|
});
|
|
@@ -15419,9 +15577,22 @@ var JSXAttributeName$$ = [JSXAttributeName$0, JSXAttributeName$1];
|
|
|
15419
15577
|
function JSXAttributeName(ctx, state2) {
|
|
15420
15578
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "JSXAttributeName", JSXAttributeName$$);
|
|
15421
15579
|
}
|
|
15422
|
-
var JSXAttributeInitializer$0 = (0, import_lib3.$S)((0, import_lib3.$E)(Whitespace), Equals, (0, import_lib3.$E)(
|
|
15580
|
+
var JSXAttributeInitializer$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$N)(CoffeeJSXEnabled), (0, import_lib3.$E)(Whitespace), Equals, (0, import_lib3.$Y)((0, import_lib3.$S)((0, import_lib3.$Q)(NonNewlineWhitespace), EOL)), InsertInlineOpenBrace, PushIndent, (0, import_lib3.$E)(PostfixedExpression), PopIndent, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
15581
|
+
var ws1 = $2;
|
|
15582
|
+
var equals = $3;
|
|
15583
|
+
var ws2 = $4;
|
|
15584
|
+
var open = $5;
|
|
15585
|
+
var indent = $6;
|
|
15586
|
+
var expression = $7;
|
|
15587
|
+
var close = $9;
|
|
15588
|
+
if (!expression)
|
|
15589
|
+
return $skip;
|
|
15590
|
+
return [ws1, equals, ws2, open, indent, expression, close];
|
|
15591
|
+
});
|
|
15592
|
+
var JSXAttributeInitializer$1 = (0, import_lib3.$S)((0, import_lib3.$E)(Whitespace), Equals, (0, import_lib3.$E)(Whitespace), JSXAttributeValue);
|
|
15593
|
+
var JSXAttributeInitializer$$ = [JSXAttributeInitializer$0, JSXAttributeInitializer$1];
|
|
15423
15594
|
function JSXAttributeInitializer(ctx, state2) {
|
|
15424
|
-
return (0, import_lib3.$
|
|
15595
|
+
return (0, import_lib3.$EVENT_C)(ctx, state2, "JSXAttributeInitializer", JSXAttributeInitializer$$);
|
|
15425
15596
|
}
|
|
15426
15597
|
var JSXAttributeValue$0 = (0, import_lib3.$S)(OpenBrace, PostfixedExpression, (0, import_lib3.$E)(Whitespace), CloseBrace);
|
|
15427
15598
|
var JSXAttributeValue$1 = JSXElement;
|
|
@@ -15670,8 +15841,9 @@ var JSXChild$5 = (0, import_lib3.$TS)((0, import_lib3.$S)(InsertInlineOpenBrace,
|
|
|
15670
15841
|
expression
|
|
15671
15842
|
};
|
|
15672
15843
|
});
|
|
15673
|
-
var JSXChild$6 =
|
|
15674
|
-
var JSXChild
|
|
15844
|
+
var JSXChild$6 = JSXAngleChild;
|
|
15845
|
+
var JSXChild$7 = JSXText;
|
|
15846
|
+
var JSXChild$$ = [JSXChild$0, JSXChild$1, JSXChild$2, JSXChild$3, JSXChild$4, JSXChild$5, JSXChild$6, JSXChild$7];
|
|
15675
15847
|
function JSXChild(ctx, state2) {
|
|
15676
15848
|
return (0, import_lib3.$EVENT_C)(ctx, state2, "JSXChild", JSXChild$$);
|
|
15677
15849
|
}
|
|
@@ -15713,6 +15885,42 @@ var NestedJSXChildExpression$0 = (0, import_lib3.$S)(JSXNested, JSXChildExpressi
|
|
|
15713
15885
|
function NestedJSXChildExpression(ctx, state2) {
|
|
15714
15886
|
return (0, import_lib3.$EVENT)(ctx, state2, "NestedJSXChildExpression", NestedJSXChildExpression$0);
|
|
15715
15887
|
}
|
|
15888
|
+
var JSXAngleChild$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(CloseAngleBracket, InsertInlineOpenBrace, JSXAngleChildExpression, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
15889
|
+
var open = $2;
|
|
15890
|
+
var expression = $3;
|
|
15891
|
+
var close = $4;
|
|
15892
|
+
if (!expression)
|
|
15893
|
+
return $skip;
|
|
15894
|
+
return [open, expression, close];
|
|
15895
|
+
});
|
|
15896
|
+
function JSXAngleChild(ctx, state2) {
|
|
15897
|
+
return (0, import_lib3.$EVENT)(ctx, state2, "JSXAngleChild", JSXAngleChild$0);
|
|
15898
|
+
}
|
|
15899
|
+
var JSXAngleChildExpression$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$N)(JSXEOS), ForbidNewlineBinaryOp, (0, import_lib3.$E)(JSXChildExpression), RestoreNewlineBinaryOp), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
15900
|
+
var expression = $3;
|
|
15901
|
+
if (!expression)
|
|
15902
|
+
return $skip;
|
|
15903
|
+
return expression;
|
|
15904
|
+
});
|
|
15905
|
+
var JSXAngleChildExpression$1 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$Y)(JSXEOS), ImplicitNestedBlock), function($skip, $loc, $0, $1, $2) {
|
|
15906
|
+
var block = $2;
|
|
15907
|
+
if (!block)
|
|
15908
|
+
return $skip;
|
|
15909
|
+
const statement = {
|
|
15910
|
+
type: "DoStatement",
|
|
15911
|
+
children: [block],
|
|
15912
|
+
block
|
|
15913
|
+
};
|
|
15914
|
+
return {
|
|
15915
|
+
type: "StatementExpression",
|
|
15916
|
+
statement,
|
|
15917
|
+
children: [statement]
|
|
15918
|
+
};
|
|
15919
|
+
});
|
|
15920
|
+
var JSXAngleChildExpression$$ = [JSXAngleChildExpression$0, JSXAngleChildExpression$1];
|
|
15921
|
+
function JSXAngleChildExpression(ctx, state2) {
|
|
15922
|
+
return (0, import_lib3.$EVENT_C)(ctx, state2, "JSXAngleChildExpression", JSXAngleChildExpression$$);
|
|
15923
|
+
}
|
|
15716
15924
|
var UsingDeclaration$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(Using, (0, import_lib3.$E)(_), UsingBinding, (0, import_lib3.$Q)((0, import_lib3.$S)(__, Comma, __, UsingBinding)), UsingJSModeError), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
15717
15925
|
var decl = $1;
|
|
15718
15926
|
var binding = $3;
|
package/package.json
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@danielx/civet",
|
|
3
3
|
"type": "commonjs",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.27",
|
|
5
5
|
"description": "CoffeeScript style syntax for TypeScript",
|
|
6
6
|
"main": "dist/main.js",
|
|
7
7
|
"module": "dist/main.mjs",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/DanielXMoore/Civet.git"
|
|
11
|
+
},
|
|
8
12
|
"exports": {
|
|
9
13
|
".": {
|
|
10
14
|
"import": "./dist/main.mjs",
|