@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/dist/main.js CHANGED
@@ -524,6 +524,7 @@ __export(lib_exports, {
524
524
  expressionizeTypeIf: () => expressionizeTypeIf,
525
525
  forRange: () => forRange,
526
526
  gatherBindingCode: () => gatherBindingCode,
527
+ gatherBindingPatternTypeSuffix: () => gatherBindingPatternTypeSuffix,
527
528
  gatherRecursive: () => gatherRecursive,
528
529
  gatherRecursiveAll: () => gatherRecursiveAll,
529
530
  gatherRecursiveWithinFunction: () => gatherRecursiveWithinFunction,
@@ -1327,7 +1328,7 @@ function maybeRefAssignment(exp, base = "ref") {
1327
1328
 
1328
1329
  // source/parser/binding.civet
1329
1330
  function adjustAtBindings(statements, asThis = false) {
1330
- gatherRecursiveAll(statements, (n) => n.type === "AtBindingProperty").forEach((binding) => {
1331
+ gatherRecursiveAll(statements, ($) => $.type === "AtBindingProperty").forEach((binding) => {
1331
1332
  const { ref } = binding;
1332
1333
  if (asThis) {
1333
1334
  const atBinding = binding.binding;
@@ -1346,17 +1347,19 @@ function adjustAtBindings(statements, asThis = false) {
1346
1347
  });
1347
1348
  }
1348
1349
  function adjustBindingElements(elements) {
1349
- const names = elements.flatMap((p) => p.names || []), { length } = elements;
1350
+ const names = elements.flatMap(($1) => $1.names || []);
1351
+ const { length } = elements;
1350
1352
  let blockPrefix, restIndex = -1, restCount = 0;
1351
- elements.forEach(({ type }, i) => {
1353
+ for (let i1 = 0, len3 = elements.length; i1 < len3; i1++) {
1354
+ const i = i1;
1355
+ const { type } = elements[i1];
1352
1356
  if (type === "BindingRestElement") {
1353
- if (restIndex < 0)
1357
+ if (restIndex < 0) {
1354
1358
  restIndex = i;
1355
- return restCount++;
1359
+ }
1360
+ restCount++;
1356
1361
  }
1357
- ;
1358
- return;
1359
- });
1362
+ }
1360
1363
  if (restCount === 0) {
1361
1364
  return {
1362
1365
  children: elements,
@@ -1375,7 +1378,7 @@ function adjustBindingElements(elements) {
1375
1378
  l++;
1376
1379
  blockPrefix = {
1377
1380
  type: "PostRestBindingElements",
1378
- children: ["[", insertTrimmingSpace(after, ""), "] = ", restIdentifier, ".splice(-", l.toString(), ")"],
1381
+ children: ["[", trimFirstSpace(after), "] = ", restIdentifier, ".splice(-", l.toString(), ")"],
1379
1382
  names: after.flatMap((p) => p.names)
1380
1383
  };
1381
1384
  }
@@ -1435,6 +1438,100 @@ function arrayElementHasTrailingComma(elementNode) {
1435
1438
  const lastChild = (ref1 = elementNode.children)[ref1.length - 1];
1436
1439
  return lastChild && lastChild[lastChild.length - 1]?.token === ",";
1437
1440
  }
1441
+ function gatherBindingPatternTypeSuffix(pattern) {
1442
+ if (pattern.typeSuffix != null) {
1443
+ return pattern;
1444
+ }
1445
+ let count = 0;
1446
+ switch (pattern.type) {
1447
+ case "ArrayBindingPattern": {
1448
+ const results = [];
1449
+ for (let ref2 = pattern.elements, i2 = 0, len1 = ref2.length; i2 < len1; i2++) {
1450
+ const elem = ref2[i2];
1451
+ let { typeSuffix } = elem;
1452
+ typeSuffix ??= elem.binding?.typeSuffix;
1453
+ if (typeSuffix) {
1454
+ count++;
1455
+ }
1456
+ let typeElement = [typeSuffix?.t, elem.delim];
1457
+ if (typeSuffix?.optional) {
1458
+ typeElement[0] = parenthesizeType(typeElement[0]);
1459
+ typeElement.unshift("undefined |");
1460
+ }
1461
+ if (elem.type === "BindingRestElement") {
1462
+ typeElement[0] ??= "unknown[]";
1463
+ typeElement.unshift(elem.dots);
1464
+ } else {
1465
+ typeElement[0] ??= "unknown";
1466
+ }
1467
+ results.push(typeElement);
1468
+ }
1469
+ ;
1470
+ const types = results;
1471
+ if (count) {
1472
+ const t = [": [", types, "]"];
1473
+ pattern.typeSuffix = {
1474
+ type: "TypeSuffix",
1475
+ ts: true,
1476
+ t,
1477
+ children: [t]
1478
+ };
1479
+ }
1480
+ ;
1481
+ break;
1482
+ }
1483
+ case "ObjectBindingPattern": {
1484
+ let restType;
1485
+ const results1 = [];
1486
+ for (let ref3 = pattern.properties, i3 = 0, len22 = ref3.length; i3 < len22; i3++) {
1487
+ const prop = ref3[i3];
1488
+ let { typeSuffix } = prop;
1489
+ typeSuffix ??= prop.value?.typeSuffix;
1490
+ if (typeSuffix) {
1491
+ count++;
1492
+ }
1493
+ typeSuffix ??= {
1494
+ type: "TypeSuffix",
1495
+ ts: true,
1496
+ children: [": unknown"]
1497
+ };
1498
+ switch (prop.type) {
1499
+ case "BindingProperty": {
1500
+ const ws = prop.children.slice(0, prop.children.indexOf(prop.name));
1501
+ results1.push([...ws, prop.name, typeSuffix, prop.delim]);
1502
+ break;
1503
+ }
1504
+ case "AtBindingProperty": {
1505
+ const ws = prop.children.slice(0, prop.children.indexOf(prop.binding));
1506
+ results1.push([...ws, prop.ref.id, typeSuffix, prop.delim]);
1507
+ break;
1508
+ }
1509
+ case "BindingRestProperty": {
1510
+ restType = prop.typeSuffix?.t;
1511
+ continue;
1512
+ }
1513
+ }
1514
+ }
1515
+ ;
1516
+ const types = results1;
1517
+ if (count) {
1518
+ const t = ["{", types, "}"];
1519
+ if (restType != null) {
1520
+ t.push(" & ", parenthesizeType(trimFirstSpace(restType)));
1521
+ }
1522
+ pattern.typeSuffix = {
1523
+ type: "TypeSuffix",
1524
+ ts: true,
1525
+ t,
1526
+ children: [": ", t]
1527
+ };
1528
+ }
1529
+ ;
1530
+ break;
1531
+ }
1532
+ }
1533
+ return pattern;
1534
+ }
1438
1535
 
1439
1536
  // source/parser/function.civet
1440
1537
  function isVoidType(t) {
@@ -3264,6 +3361,9 @@ function processAssignmentDeclaration(decl, pattern, suffix, ws, assign, e) {
3264
3361
  let [splices, assignments] = gatherBindingCode(pattern);
3265
3362
  splices = splices.map((s) => [", ", s]);
3266
3363
  const thisAssignments = assignments.map((a) => ["", a, ";"]);
3364
+ if ("typeSuffix" in pattern) {
3365
+ suffix ??= pattern.typeSuffix;
3366
+ }
3267
3367
  const initializer = makeNode({
3268
3368
  type: "Initializer",
3269
3369
  expression: e,
@@ -6534,6 +6634,7 @@ var grammar = {
6534
6634
  NestedBindingPropertyList,
6535
6635
  BindingProperty,
6536
6636
  BindingRestProperty,
6637
+ BindingTypeSuffix,
6537
6638
  NestedBindingElements,
6538
6639
  BindingElement,
6539
6640
  BindingRestElement,
@@ -6871,6 +6972,7 @@ var grammar = {
6871
6972
  DotDot,
6872
6973
  DotDotDot,
6873
6974
  DoubleColon,
6975
+ DoubleColonAsColon,
6874
6976
  DoubleQuote,
6875
6977
  Each,
6876
6978
  Else,
@@ -6985,6 +7087,8 @@ var grammar = {
6985
7087
  JSXChildExpression,
6986
7088
  IndentedJSXChildExpression,
6987
7089
  NestedJSXChildExpression,
7090
+ JSXAngleChild,
7091
+ JSXAngleChildExpression,
6988
7092
  UsingDeclaration,
6989
7093
  UsingBinding,
6990
7094
  UsingJSModeError,
@@ -7377,7 +7481,7 @@ var $R2 = (0, import_lib3.$R)(new RegExp("(as|of|satisfies|then|when|implements|
7377
7481
  var $R3 = (0, import_lib3.$R)(new RegExp("[0-9]", "suy"));
7378
7482
  var $R4 = (0, import_lib3.$R)(new RegExp("(?!\\p{ID_Start}|[_$0-9(\\[{])", "suy"));
7379
7483
  var $R5 = (0, import_lib3.$R)(new RegExp("[ \\t]", "suy"));
7380
- var $R6 = (0, import_lib3.$R)(new RegExp("\\p{ID_Continue}|[\\u200C\\u200D$.#]", "suy"));
7484
+ var $R6 = (0, import_lib3.$R)(new RegExp("\\p{ID_Continue}|[\\u200C\\u200D$.#{]", "suy"));
7381
7485
  var $R7 = (0, import_lib3.$R)(new RegExp("[&=]", "suy"));
7382
7486
  var $R8 = (0, import_lib3.$R)(new RegExp("(?=['\"`])", "suy"));
7383
7487
  var $R9 = (0, import_lib3.$R)(new RegExp("(?=[\\/?])", "suy"));
@@ -8363,7 +8467,7 @@ var ParenthesizedExpression$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(OpenPar
8363
8467
  function ParenthesizedExpression(ctx, state2) {
8364
8468
  return (0, import_lib3.$EVENT)(ctx, state2, "ParenthesizedExpression", ParenthesizedExpression$0);
8365
8469
  }
8366
- 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) {
8470
+ 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) {
8367
8471
  var dot = $1;
8368
8472
  var typeSuffix = $3;
8369
8473
  return {
@@ -8383,7 +8487,7 @@ var Placeholder$1 = (0, import_lib3.$TS)((0, import_lib3.$S)(Ampersand, (0, impo
8383
8487
  children: [amp]
8384
8488
  };
8385
8489
  });
8386
- 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) {
8490
+ 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) {
8387
8491
  return {
8388
8492
  type: "Placeholder",
8389
8493
  subtype: "&",
@@ -9452,9 +9556,10 @@ var ParameterElement$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib
9452
9556
  var typeSuffix = $5;
9453
9557
  var initializer = $6;
9454
9558
  var delim = $7;
9559
+ typeSuffix ??= binding.typeSuffix;
9455
9560
  return {
9456
9561
  type: "Parameter",
9457
- children: $0,
9562
+ children: [$1, accessModifier, $3, binding, typeSuffix, initializer, delim],
9458
9563
  names: binding.names,
9459
9564
  typeSuffix,
9460
9565
  accessModifier,
@@ -9570,12 +9675,13 @@ var ObjectBindingPattern$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import
9570
9675
  var c = $3;
9571
9676
  var ws2 = $4;
9572
9677
  var close = $5;
9573
- return {
9678
+ const properties = c.children;
9679
+ return gatherBindingPatternTypeSuffix({
9574
9680
  type: "ObjectBindingPattern",
9575
- children: [ws1, open, c.children, ws2, close],
9681
+ children: [ws1, open, properties, ws2, close],
9576
9682
  names: c.names,
9577
- properties: c.children
9578
- };
9683
+ properties
9684
+ });
9579
9685
  });
9580
9686
  function ObjectBindingPattern(ctx, state2) {
9581
9687
  return (0, import_lib3.$EVENT)(ctx, state2, "ObjectBindingPattern", ObjectBindingPattern$0);
@@ -9610,13 +9716,13 @@ var ArrayBindingPattern$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_
9610
9716
  var c = $3;
9611
9717
  var ws2 = $4;
9612
9718
  var close = $5;
9613
- return {
9719
+ return gatherBindingPatternTypeSuffix({
9614
9720
  ...c,
9615
9721
  // names, blockPrefix, length
9616
9722
  type: "ArrayBindingPattern",
9617
9723
  elements: c.children,
9618
9724
  children: [ws1, open, c.children, ws2, close]
9619
- };
9725
+ });
9620
9726
  });
9621
9727
  function ArrayBindingPattern(ctx, state2) {
9622
9728
  return (0, import_lib3.$EVENT)(ctx, state2, "ArrayBindingPattern", ArrayBindingPattern$0);
@@ -9637,6 +9743,7 @@ var BindingElementList$0 = (0, import_lib3.$TV)((0, import_lib3.$P)((0, import_l
9637
9743
  return elements.map(([element, delim]) => {
9638
9744
  return {
9639
9745
  ...element,
9746
+ delim,
9640
9747
  // BindingElement.children is a tuple of the form [ws, element]
9641
9748
  children: [...element.children, delim]
9642
9749
  };
@@ -9687,38 +9794,57 @@ function NestedBindingPropertyList(ctx, state2) {
9687
9794
  return (0, import_lib3.$EVENT)(ctx, state2, "NestedBindingPropertyList", NestedBindingPropertyList$0);
9688
9795
  }
9689
9796
  var BindingProperty$0 = BindingRestProperty;
9690
- 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) {
9797
+ 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) {
9691
9798
  var name = $2;
9692
9799
  var value = $6;
9693
- var initializer = $7;
9800
+ var typeSuffix = $7;
9801
+ var initializer = $8;
9694
9802
  return {
9695
9803
  type: "BindingProperty",
9696
- children: $0,
9804
+ children: [$1, name, $3, $4, $5, value, initializer],
9805
+ // omit typeSuffix
9697
9806
  name,
9698
9807
  value,
9808
+ typeSuffix,
9699
9809
  initializer,
9700
9810
  names: value.names
9701
9811
  };
9702
9812
  });
9703
- 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) {
9813
+ 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) {
9704
9814
  var ws = $1;
9705
9815
  var pin = $2;
9706
9816
  var binding = $3;
9707
- var initializer = $4;
9817
+ var typeSuffix = $4;
9818
+ var initializer = $5;
9819
+ let children = [ws, binding, initializer];
9708
9820
  if (binding.type === "AtBinding") {
9709
9821
  return {
9710
9822
  type: "AtBindingProperty",
9711
- children: $0,
9823
+ children,
9712
9824
  binding,
9825
+ typeSuffix,
9713
9826
  ref: binding.ref,
9714
9827
  initializer,
9715
9828
  names: []
9716
9829
  };
9717
9830
  }
9718
9831
  if (pin) {
9832
+ children = [ws, binding];
9833
+ if (typeSuffix) {
9834
+ children.push({
9835
+ type: "Error",
9836
+ message: "Pinned properties cannot have type annotations"
9837
+ });
9838
+ }
9839
+ if (initializer) {
9840
+ children.push({
9841
+ type: "Error",
9842
+ message: "Pinned properties cannot have initializers"
9843
+ });
9844
+ }
9719
9845
  return {
9720
9846
  type: "PinProperty",
9721
- children: [ws, binding],
9847
+ children,
9722
9848
  name: binding,
9723
9849
  value: {
9724
9850
  type: "PinPattern",
@@ -9728,9 +9854,10 @@ var BindingProperty$2 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3
9728
9854
  }
9729
9855
  return {
9730
9856
  type: "BindingProperty",
9731
- children: $0,
9857
+ children,
9732
9858
  name: binding,
9733
9859
  value: void 0,
9860
+ typeSuffix,
9734
9861
  initializer,
9735
9862
  names: binding.names,
9736
9863
  identifier: binding
@@ -9740,13 +9867,15 @@ var BindingProperty$$ = [BindingProperty$0, BindingProperty$1, BindingProperty$2
9740
9867
  function BindingProperty(ctx, state2) {
9741
9868
  return (0, import_lib3.$EVENT_C)(ctx, state2, "BindingProperty", BindingProperty$$);
9742
9869
  }
9743
- var BindingRestProperty$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)(_), DotDotDot, BindingIdentifier), function($skip, $loc, $0, $1, $2, $3) {
9870
+ 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) {
9744
9871
  var ws = $1;
9745
9872
  var dots = $2;
9746
9873
  var id = $3;
9874
+ var typeSuffix = $4;
9747
9875
  return {
9748
9876
  ...id,
9749
9877
  type: "BindingRestProperty",
9878
+ typeSuffix,
9750
9879
  children: [...ws || [], dots, ...id.children]
9751
9880
  };
9752
9881
  });
@@ -9757,6 +9886,7 @@ var BindingRestProperty$1 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_
9757
9886
  return {
9758
9887
  ...id,
9759
9888
  type: "BindingRestProperty",
9889
+ typeSuffix: void 0,
9760
9890
  children: [...ws || [], dots, ...id.children]
9761
9891
  };
9762
9892
  });
@@ -9764,6 +9894,21 @@ var BindingRestProperty$$ = [BindingRestProperty$0, BindingRestProperty$1];
9764
9894
  function BindingRestProperty(ctx, state2) {
9765
9895
  return (0, import_lib3.$EVENT_C)(ctx, state2, "BindingRestProperty", BindingRestProperty$$);
9766
9896
  }
9897
+ 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) {
9898
+ var optional = $2;
9899
+ var colon = $4;
9900
+ var t = $5;
9901
+ return {
9902
+ type: "TypeSuffix",
9903
+ ts: true,
9904
+ optional,
9905
+ t,
9906
+ children: $0
9907
+ };
9908
+ });
9909
+ function BindingTypeSuffix(ctx, state2) {
9910
+ return (0, import_lib3.$EVENT)(ctx, state2, "BindingTypeSuffix", BindingTypeSuffix$0);
9911
+ }
9767
9912
  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) {
9768
9913
  var elements = $2;
9769
9914
  if (!elements.length)
@@ -9774,10 +9919,11 @@ function NestedBindingElements(ctx, state2) {
9774
9919
  return (0, import_lib3.$EVENT)(ctx, state2, "NestedBindingElements", NestedBindingElements$0);
9775
9920
  }
9776
9921
  var BindingElement$0 = BindingRestElement;
9777
- 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) {
9922
+ 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) {
9778
9923
  var ws = $1;
9779
9924
  var binding = $2;
9780
- var initializer = $3;
9925
+ var typeSuffix = $3;
9926
+ var initializer = $4;
9781
9927
  if (binding.children) {
9782
9928
  binding = {
9783
9929
  ...binding,
@@ -9786,16 +9932,17 @@ var BindingElement$1 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.
9786
9932
  };
9787
9933
  }
9788
9934
  return {
9935
+ type: "BindingElement",
9789
9936
  names: binding.names,
9937
+ typeSuffix,
9938
+ binding,
9790
9939
  children: [ws, binding]
9791
9940
  };
9792
9941
  });
9793
9942
  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) {
9794
9943
  return {
9795
- children: [{
9796
- type: "ElisionElement",
9797
- children: [""]
9798
- }],
9944
+ type: "ElisionElement",
9945
+ children: [""],
9799
9946
  names: []
9800
9947
  };
9801
9948
  });
@@ -9803,14 +9950,17 @@ var BindingElement$$ = [BindingElement$0, BindingElement$1, BindingElement$2];
9803
9950
  function BindingElement(ctx, state2) {
9804
9951
  return (0, import_lib3.$EVENT_C)(ctx, state2, "BindingElement", BindingElement$$);
9805
9952
  }
9806
- 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) {
9953
+ 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) {
9807
9954
  var ws = $1;
9808
9955
  var dots = $2;
9809
9956
  var binding = $3;
9957
+ var typeSuffix = $4;
9810
9958
  return {
9811
9959
  type: "BindingRestElement",
9812
9960
  children: [ws, [dots, binding]],
9961
+ dots,
9813
9962
  binding,
9963
+ typeSuffix,
9814
9964
  name: binding.name,
9815
9965
  names: binding.names,
9816
9966
  rest: true
@@ -9823,6 +9973,7 @@ var BindingRestElement$1 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_l
9823
9973
  return {
9824
9974
  type: "BindingRestElement",
9825
9975
  children: [...ws || [], dots, binding],
9976
+ dots,
9826
9977
  binding,
9827
9978
  name: binding.name,
9828
9979
  names: binding.names,
@@ -13917,9 +14068,10 @@ var LexicalBinding$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(BindingPattern,
13917
14068
  var suffix = $2;
13918
14069
  var initializer = $3;
13919
14070
  const [splices, thisAssignments] = gatherBindingCode(pattern);
14071
+ suffix ??= pattern.typeSuffix;
13920
14072
  return {
13921
14073
  type: "Binding",
13922
- children: $0,
14074
+ children: [pattern, suffix, initializer],
13923
14075
  names: pattern.names,
13924
14076
  pattern,
13925
14077
  suffix,
@@ -14639,6 +14791,12 @@ var DoubleColon$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L155, 'Double
14639
14791
  function DoubleColon(ctx, state2) {
14640
14792
  return (0, import_lib3.$EVENT)(ctx, state2, "DoubleColon", DoubleColon$0);
14641
14793
  }
14794
+ var DoubleColonAsColon$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L155, 'DoubleColonAsColon "::"'), function($skip, $loc, $0, $1) {
14795
+ return { $loc, token: ":" };
14796
+ });
14797
+ function DoubleColonAsColon(ctx, state2) {
14798
+ return (0, import_lib3.$EVENT)(ctx, state2, "DoubleColonAsColon", DoubleColonAsColon$0);
14799
+ }
14642
14800
  var DoubleQuote$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L156, 'DoubleQuote "\\\\\\""'), function($skip, $loc, $0, $1) {
14643
14801
  return { $loc, token: $1 };
14644
14802
  });
@@ -15439,9 +15597,22 @@ var JSXAttributeName$$ = [JSXAttributeName$0, JSXAttributeName$1];
15439
15597
  function JSXAttributeName(ctx, state2) {
15440
15598
  return (0, import_lib3.$EVENT_C)(ctx, state2, "JSXAttributeName", JSXAttributeName$$);
15441
15599
  }
15442
- var JSXAttributeInitializer$0 = (0, import_lib3.$S)((0, import_lib3.$E)(Whitespace), Equals, (0, import_lib3.$E)(Whitespace), JSXAttributeValue);
15600
+ 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) {
15601
+ var ws1 = $2;
15602
+ var equals = $3;
15603
+ var ws2 = $4;
15604
+ var open = $5;
15605
+ var indent = $6;
15606
+ var expression = $7;
15607
+ var close = $9;
15608
+ if (!expression)
15609
+ return $skip;
15610
+ return [ws1, equals, ws2, open, indent, expression, close];
15611
+ });
15612
+ var JSXAttributeInitializer$1 = (0, import_lib3.$S)((0, import_lib3.$E)(Whitespace), Equals, (0, import_lib3.$E)(Whitespace), JSXAttributeValue);
15613
+ var JSXAttributeInitializer$$ = [JSXAttributeInitializer$0, JSXAttributeInitializer$1];
15443
15614
  function JSXAttributeInitializer(ctx, state2) {
15444
- return (0, import_lib3.$EVENT)(ctx, state2, "JSXAttributeInitializer", JSXAttributeInitializer$0);
15615
+ return (0, import_lib3.$EVENT_C)(ctx, state2, "JSXAttributeInitializer", JSXAttributeInitializer$$);
15445
15616
  }
15446
15617
  var JSXAttributeValue$0 = (0, import_lib3.$S)(OpenBrace, PostfixedExpression, (0, import_lib3.$E)(Whitespace), CloseBrace);
15447
15618
  var JSXAttributeValue$1 = JSXElement;
@@ -15690,8 +15861,9 @@ var JSXChild$5 = (0, import_lib3.$TS)((0, import_lib3.$S)(InsertInlineOpenBrace,
15690
15861
  expression
15691
15862
  };
15692
15863
  });
15693
- var JSXChild$6 = JSXText;
15694
- var JSXChild$$ = [JSXChild$0, JSXChild$1, JSXChild$2, JSXChild$3, JSXChild$4, JSXChild$5, JSXChild$6];
15864
+ var JSXChild$6 = JSXAngleChild;
15865
+ var JSXChild$7 = JSXText;
15866
+ var JSXChild$$ = [JSXChild$0, JSXChild$1, JSXChild$2, JSXChild$3, JSXChild$4, JSXChild$5, JSXChild$6, JSXChild$7];
15695
15867
  function JSXChild(ctx, state2) {
15696
15868
  return (0, import_lib3.$EVENT_C)(ctx, state2, "JSXChild", JSXChild$$);
15697
15869
  }
@@ -15733,6 +15905,42 @@ var NestedJSXChildExpression$0 = (0, import_lib3.$S)(JSXNested, JSXChildExpressi
15733
15905
  function NestedJSXChildExpression(ctx, state2) {
15734
15906
  return (0, import_lib3.$EVENT)(ctx, state2, "NestedJSXChildExpression", NestedJSXChildExpression$0);
15735
15907
  }
15908
+ var JSXAngleChild$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(CloseAngleBracket, InsertInlineOpenBrace, JSXAngleChildExpression, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4) {
15909
+ var open = $2;
15910
+ var expression = $3;
15911
+ var close = $4;
15912
+ if (!expression)
15913
+ return $skip;
15914
+ return [open, expression, close];
15915
+ });
15916
+ function JSXAngleChild(ctx, state2) {
15917
+ return (0, import_lib3.$EVENT)(ctx, state2, "JSXAngleChild", JSXAngleChild$0);
15918
+ }
15919
+ 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) {
15920
+ var expression = $3;
15921
+ if (!expression)
15922
+ return $skip;
15923
+ return expression;
15924
+ });
15925
+ var JSXAngleChildExpression$1 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$Y)(JSXEOS), ImplicitNestedBlock), function($skip, $loc, $0, $1, $2) {
15926
+ var block = $2;
15927
+ if (!block)
15928
+ return $skip;
15929
+ const statement = {
15930
+ type: "DoStatement",
15931
+ children: [block],
15932
+ block
15933
+ };
15934
+ return {
15935
+ type: "StatementExpression",
15936
+ statement,
15937
+ children: [statement]
15938
+ };
15939
+ });
15940
+ var JSXAngleChildExpression$$ = [JSXAngleChildExpression$0, JSXAngleChildExpression$1];
15941
+ function JSXAngleChildExpression(ctx, state2) {
15942
+ return (0, import_lib3.$EVENT_C)(ctx, state2, "JSXAngleChildExpression", JSXAngleChildExpression$$);
15943
+ }
15736
15944
  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) {
15737
15945
  var decl = $1;
15738
15946
  var binding = $3;