@danielx/civet 0.7.34 → 0.7.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/browser.js CHANGED
@@ -38,9 +38,9 @@ var Civet = (() => {
38
38
  ));
39
39
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
40
40
 
41
- // node_modules/.pnpm/@danielx+hera@0.8.16/node_modules/@danielx/hera/dist/machine.js
41
+ // node_modules/@danielx/hera/dist/machine.js
42
42
  var require_machine = __commonJS({
43
- "node_modules/.pnpm/@danielx+hera@0.8.16/node_modules/@danielx/hera/dist/machine.js"(exports, module) {
43
+ "node_modules/@danielx/hera/dist/machine.js"(exports, module) {
44
44
  "use strict";
45
45
  var __defProp2 = Object.defineProperty;
46
46
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
@@ -573,11 +573,13 @@ ${body}`;
573
573
  processProgramAsync: () => processProgramAsync,
574
574
  processTryBlock: () => processTryBlock,
575
575
  processUnaryExpression: () => processUnaryExpression,
576
+ processUnaryNestedExpression: () => processUnaryNestedExpression,
576
577
  quoteString: () => quoteString,
577
578
  reorderBindingRestProperty: () => reorderBindingRestProperty,
578
579
  replaceNode: () => replaceNode,
579
580
  replaceNodes: () => replaceNodes,
580
581
  skipImplicitArguments: () => skipImplicitArguments,
582
+ stripTrailingImplicitComma: () => stripTrailingImplicitComma,
581
583
  trimFirstSpace: () => trimFirstSpace,
582
584
  typeOfJSX: () => typeOfJSX,
583
585
  wrapIIFE: () => wrapIIFE
@@ -714,6 +716,40 @@ ${body}`;
714
716
  return node.every(isWhitespaceOrEmpty);
715
717
  return false;
716
718
  }
719
+ function firstNonSpace(node) {
720
+ if (!(node != null)) {
721
+ return;
722
+ }
723
+ if (Array.isArray(node)) {
724
+ for (let i2 = 0, len22 = node.length; i2 < len22; i2++) {
725
+ const child = node[i2];
726
+ let ref1;
727
+ if (ref1 = firstNonSpace(child)) {
728
+ const first = ref1;
729
+ return first;
730
+ }
731
+ }
732
+ return void 0;
733
+ } else if (isParent(node)) {
734
+ let ref2;
735
+ if (ref2 = firstNonSpace(node.children)) {
736
+ const first = ref2;
737
+ return first;
738
+ } else {
739
+ return node;
740
+ }
741
+ } else if (isToken(node)) {
742
+ let m;
743
+ if (m = node.token, typeof m === "string" && /^[ \t]*$/.test(m)) {
744
+ return;
745
+ }
746
+ } else if (typeof node === "string") {
747
+ if (typeof node === "string" && /^[ \t]*$/.test(node)) {
748
+ return;
749
+ }
750
+ }
751
+ return node;
752
+ }
717
753
  function isExit(node) {
718
754
  if (!(node != null)) {
719
755
  return false;
@@ -751,6 +787,14 @@ ${body}`;
751
787
  ;
752
788
  return;
753
789
  }
790
+ function stripTrailingImplicitComma(children) {
791
+ const last = children[children.length - 1];
792
+ if (isComma(last) && last.implicit) {
793
+ return children.slice(0, -1);
794
+ } else {
795
+ return children;
796
+ }
797
+ }
754
798
  function insertTrimmingSpace(target, c) {
755
799
  if (!(target != null)) {
756
800
  return target;
@@ -923,8 +967,8 @@ ${body}`;
923
967
  return void 0;
924
968
  }
925
969
  if (Array.isArray(node)) {
926
- for (let i2 = 0, len22 = node.length; i2 < len22; i2++) {
927
- const child = node[i2];
970
+ for (let i3 = 0, len3 = node.length; i3 < len3; i3++) {
971
+ const child = node[i3];
928
972
  if (skip(child)) {
929
973
  continue;
930
974
  }
@@ -1011,6 +1055,9 @@ ${body}`;
1011
1055
  return expression;
1012
1056
  }
1013
1057
  }
1058
+ return parenthesizeExpression(expression);
1059
+ }
1060
+ function parenthesizeExpression(expression) {
1014
1061
  return makeNode({
1015
1062
  type: "ParenthesizedExpression",
1016
1063
  children: ["(", expression, ")"],
@@ -1026,8 +1073,8 @@ ${body}`;
1026
1073
  return;
1027
1074
  }
1028
1075
  if (Array.isArray(node)) {
1029
- for (let i3 = 0, len3 = node.length; i3 < len3; i3++) {
1030
- const child = node[i3];
1076
+ for (let i4 = 0, len4 = node.length; i4 < len4; i4++) {
1077
+ const child = node[i4];
1031
1078
  updateParentPointers(child, parent, depth);
1032
1079
  }
1033
1080
  return;
@@ -1037,8 +1084,8 @@ ${body}`;
1037
1084
  node.parent = parent;
1038
1085
  }
1039
1086
  if (depth && isParent(node)) {
1040
- for (let ref1 = node.children, i4 = 0, len4 = ref1.length; i4 < len4; i4++) {
1041
- const child = ref1[i4];
1087
+ for (let ref3 = node.children, i5 = 0, len5 = ref3.length; i5 < len5; i5++) {
1088
+ const child = ref3[i5];
1042
1089
  updateParentPointers(child, node, depth - 1);
1043
1090
  }
1044
1091
  }
@@ -1168,8 +1215,8 @@ ${body}`;
1168
1215
  children.splice(1, 0, ".bind(this)");
1169
1216
  }
1170
1217
  if (gatherRecursiveWithinFunction(block, (a2) => typeof a2 === "object" && a2 != null && "token" in a2 && a2.token === "arguments").length) {
1171
- let ref2;
1172
- children[children.length - 1] = (ref2 = parameters.children)[ref2.length - 1] = "(arguments)";
1218
+ let ref4;
1219
+ children[children.length - 1] = (ref4 = parameters.children)[ref4.length - 1] = "(arguments)";
1173
1220
  }
1174
1221
  }
1175
1222
  const exp = makeNode({
@@ -1192,9 +1239,9 @@ ${body}`;
1192
1239
  }
1193
1240
  function flatJoin(array, separator) {
1194
1241
  const result = [];
1195
- for (let i5 = 0, len5 = array.length; i5 < len5; i5++) {
1196
- const i = i5;
1197
- const items = array[i5];
1242
+ for (let i6 = 0, len6 = array.length; i6 < len6; i6++) {
1243
+ const i = i6;
1244
+ const items = array[i6];
1198
1245
  if (i) {
1199
1246
  result.push(separator);
1200
1247
  }
@@ -1593,12 +1640,6 @@ ${body}`;
1593
1640
  function isPromiseVoidType(t) {
1594
1641
  return t?.type === "TypeIdentifier" && t.raw === "Promise" && t.args?.types?.length === 1 && isVoidType(t.args.types[0]);
1595
1642
  }
1596
- function isGeneratorVoidType(t) {
1597
- return t?.type === "TypeIdentifier" && (t.raw === "Iterator" || t.raw === "Generator") && t.args?.types?.length >= 2 && isVoidType(t.args.types[1]);
1598
- }
1599
- function isAsyncGeneratorVoidType(t) {
1600
- return t?.type === "TypeIdentifier" && (t.raw === "AsyncIterator" || t.raw === "AsyncGenerator") && t.args?.types?.length >= 2 && isVoidType(t.args.types[1]);
1601
- }
1602
1643
  function implicitFunctionBlock(f) {
1603
1644
  if (f.abstract || f.block || f.signature?.optional)
1604
1645
  return;
@@ -1636,7 +1677,7 @@ ${body}`;
1636
1677
  const { async, generator, set } = modifier;
1637
1678
  const isMethod = f.type === "MethodDefinition";
1638
1679
  const isConstructor = isMethod && name === "constructor";
1639
- const isVoid = isVoidType(returnType2?.t) || async && (isPromiseVoidType(returnType2?.t) || generator && isAsyncGeneratorVoidType(returnType2?.t)) || !async && generator && isGeneratorVoidType(returnType2?.t);
1680
+ const isVoid = generator || isVoidType(returnType2?.t) || async && isPromiseVoidType(returnType2?.t);
1640
1681
  if (block?.type === "BlockStatement") {
1641
1682
  if (isVoid || set || isConstructor) {
1642
1683
  if (block.bare && block.implicitlyReturned) {
@@ -1652,10 +1693,7 @@ ${body}`;
1652
1693
  }
1653
1694
  function processReturnValue(func) {
1654
1695
  const { block } = func;
1655
- const values = gatherRecursiveWithinFunction(
1656
- block,
1657
- ({ type }) => type === "ReturnValue"
1658
- );
1696
+ const values = gatherRecursiveWithinFunction(block, ($) => $.type === "ReturnValue");
1659
1697
  if (!values.length) {
1660
1698
  return false;
1661
1699
  }
@@ -1665,7 +1703,7 @@ ${body}`;
1665
1703
  value.children = [ref];
1666
1704
  const { ancestor, child } = findAncestor(
1667
1705
  value,
1668
- ({ type }) => type === "Declaration",
1706
+ ($1) => $1.type === "Declaration",
1669
1707
  isFunction
1670
1708
  );
1671
1709
  if (ancestor) {
@@ -1685,8 +1723,8 @@ ${body}`;
1685
1723
  }
1686
1724
  }
1687
1725
  if (declaration) {
1688
- if (!(declaration.suffix != null)) {
1689
- declaration.children[1] = declaration.suffix = returnType;
1726
+ if (!(declaration.typeSuffix != null)) {
1727
+ declaration.children[1] = declaration.typeSuffix = returnType;
1690
1728
  }
1691
1729
  } else {
1692
1730
  block.expressions.unshift([
@@ -2026,7 +2064,7 @@ ${body}`;
2026
2064
  let changed = false;
2027
2065
  for (const control of gatherRecursiveWithinFunction(
2028
2066
  statement.block,
2029
- ($) => $.type === "BreakStatement" || $.type === "ContinueStatement"
2067
+ ($2) => $2.type === "BreakStatement" || $2.type === "ContinueStatement"
2030
2068
  )) {
2031
2069
  let controlName2 = function() {
2032
2070
  switch (control.type) {
@@ -2061,7 +2099,7 @@ ${body}`;
2061
2099
  )
2062
2100
  );
2063
2101
  updateParentPointers(control.with, control);
2064
- const i = control.children.findIndex(($1) => $1?.type === "Error");
2102
+ const i = control.children.findIndex(($3) => $3?.type === "Error");
2065
2103
  if (i >= 0) {
2066
2104
  control.children.splice(i, 1);
2067
2105
  }
@@ -2185,8 +2223,8 @@ ${body}`;
2185
2223
  }
2186
2224
  if (hasYield(block) && !f.generator?.length) {
2187
2225
  if (f.type === "ArrowFunction") {
2188
- gatherRecursiveWithinFunction(block, ($2) => $2.type === "YieldExpression").forEach((y) => {
2189
- const i = y.children.findIndex(($3) => $3.type === "Yield");
2226
+ gatherRecursiveWithinFunction(block, ($4) => $4.type === "YieldExpression").forEach((y) => {
2227
+ const i = y.children.findIndex(($5) => $5.type === "Yield");
2190
2228
  return y.children.splice(i + 1, 0, {
2191
2229
  type: "Error",
2192
2230
  message: "Can't use yield inside of => arrow function"
@@ -2310,12 +2348,13 @@ ${body}`;
2310
2348
  expression = {
2311
2349
  ...expression,
2312
2350
  parameters: newParameters,
2313
- children: expression.children.map(($4) => $4 === parameters ? newParameters : $4)
2351
+ children: expression.children.map(($6) => $6 === parameters ? newParameters : $6)
2314
2352
  };
2315
2353
  }
2316
2354
  return {
2317
2355
  type: "CallExpression",
2318
2356
  children: [
2357
+ ws,
2319
2358
  makeLeftHandSideExpression(expression),
2320
2359
  {
2321
2360
  type: "Call",
@@ -2331,7 +2370,7 @@ ${body}`;
2331
2370
  ref = makeRef("$");
2332
2371
  inplacePrepend(ref, body);
2333
2372
  }
2334
- if (startsWithPredicate(body, ($5) => $5.type === "ObjectExpression")) {
2373
+ if (startsWithPredicate(body, ($7) => $7.type === "ObjectExpression")) {
2335
2374
  body = makeLeftHandSideExpression(body);
2336
2375
  }
2337
2376
  const parameters = makeNode({
@@ -3521,7 +3560,7 @@ ${body}`;
3521
3560
  function len2(arr, length) {
3522
3561
  return arr.length === length;
3523
3562
  }
3524
- function processAssignmentDeclaration(decl, pattern, suffix, ws, assign, e) {
3563
+ function processAssignmentDeclaration(decl, pattern, typeSuffix, ws, assign, e) {
3525
3564
  decl = {
3526
3565
  ...decl,
3527
3566
  $loc: {
@@ -3533,7 +3572,7 @@ ${body}`;
3533
3572
  splices = splices.map((s) => [", ", s]);
3534
3573
  const thisAssignments = assignments.map((a) => ["", a, ";"]);
3535
3574
  if ("typeSuffix" in pattern) {
3536
- suffix ??= pattern.typeSuffix;
3575
+ typeSuffix ??= pattern.typeSuffix;
3537
3576
  }
3538
3577
  const initializer = makeNode({
3539
3578
  type: "Initializer",
@@ -3545,9 +3584,9 @@ ${body}`;
3545
3584
  pattern,
3546
3585
  initializer,
3547
3586
  splices,
3548
- suffix,
3587
+ typeSuffix,
3549
3588
  thisAssignments,
3550
- children: [pattern, suffix, initializer]
3589
+ children: [pattern, typeSuffix, initializer]
3551
3590
  });
3552
3591
  const children = [decl, binding];
3553
3592
  return makeNode({
@@ -3564,9 +3603,9 @@ ${body}`;
3564
3603
  gatherRecursiveAll(statements, ($) => $.type === "Declaration").forEach((statement) => {
3565
3604
  const { bindings } = statement;
3566
3605
  return bindings?.forEach((binding) => {
3567
- const suffix = binding.suffix;
3568
- if (suffix && suffix.optional && suffix.t) {
3569
- convertOptionalType(suffix);
3606
+ const { typeSuffix } = binding;
3607
+ if (typeSuffix && typeSuffix.optional && typeSuffix.t) {
3608
+ convertOptionalType(typeSuffix);
3570
3609
  }
3571
3610
  const { initializer } = binding;
3572
3611
  if (initializer) {
@@ -3647,8 +3686,8 @@ ${body}`;
3647
3686
  }
3648
3687
  const { decl, bindings } = condition.declaration;
3649
3688
  const binding = bindings[0];
3650
- let { pattern, suffix, initializer } = binding;
3651
- const nullCheck = suffix?.optional && !suffix.t && !suffix.nonnull;
3689
+ let { pattern, typeSuffix, initializer } = binding;
3690
+ const nullCheck = typeSuffix?.optional && !typeSuffix.t && !typeSuffix.nonnull;
3652
3691
  if (!(initializer != null)) {
3653
3692
  condition.children = [
3654
3693
  {
@@ -3686,14 +3725,14 @@ ${body}`;
3686
3725
  if (nullCheck) {
3687
3726
  children.unshift("(");
3688
3727
  children.push(") != null");
3689
- suffix = void 0;
3728
+ typeSuffix = void 0;
3690
3729
  }
3691
3730
  Object.assign(condition, {
3692
3731
  type: "AssignmentExpression",
3693
3732
  children,
3694
3733
  hoistDec: !simple ? {
3695
3734
  type: "Declaration",
3696
- children: ["let ", ref, suffix],
3735
+ children: ["let ", ref, typeSuffix],
3697
3736
  names: []
3698
3737
  } : void 0,
3699
3738
  pattern,
@@ -3701,7 +3740,7 @@ ${body}`;
3701
3740
  });
3702
3741
  }
3703
3742
  updateParentPointers(condition, parent);
3704
- rootCondition.blockPrefix = getPatternBlockPrefix(pattern, ref, decl, suffix);
3743
+ rootCondition.blockPrefix = getPatternBlockPrefix(pattern, ref, decl, typeSuffix);
3705
3744
  }
3706
3745
  function processDeclarationConditions(node) {
3707
3746
  gatherRecursiveAll(
@@ -4079,6 +4118,10 @@ ${body}`;
4079
4118
  };
4080
4119
  pre = pre.slice(0, -1);
4081
4120
  } else {
4121
+ let m;
4122
+ if (m = firstNonSpace(exp), typeof m === "string" && /^[ \t]*\n/.test(m) || typeof m === "object" && m != null && "token" in m && typeof m.token === "string" && /^[ \t]*\n/.test(m.token)) {
4123
+ exp = parenthesizeExpression(exp);
4124
+ }
4082
4125
  exp = {
4083
4126
  type: "AwaitExpression",
4084
4127
  children: [...last.children, exp]
@@ -4094,6 +4137,77 @@ ${body}`;
4094
4137
  children: [...pre, exp, post]
4095
4138
  };
4096
4139
  }
4140
+ function processUnaryNestedExpression(pre, args, post) {
4141
+ const isArray = args.type === "ArrayExpression";
4142
+ if (!isArray) {
4143
+ args = stripTrailingImplicitComma(args);
4144
+ }
4145
+ if (isArray || args.length > 2) {
4146
+ const last = pre[pre.length - 1];
4147
+ if (!(typeof last === "object" && last != null && "type" in last && last.type === "Await")) {
4148
+ return;
4149
+ }
4150
+ if (last.op) {
4151
+ if (!isArray) {
4152
+ args = {
4153
+ type: "ArrayExpression",
4154
+ children: ["[", args, "]"]
4155
+ };
4156
+ }
4157
+ } else {
4158
+ pre.pop();
4159
+ if (!isArray) {
4160
+ args = args;
4161
+ args = {
4162
+ type: "ArrayExpression",
4163
+ children: [
4164
+ "[",
4165
+ ...(() => {
4166
+ const results = [];
4167
+ for (let i = 0, len3 = args.length; i < len3; i++) {
4168
+ const arg = args[i];
4169
+ if (typeof arg === "object" && arg != null && "type" in arg && arg.type === "Argument") {
4170
+ const expression = processUnaryExpression([last], arg.expression);
4171
+ results.push({
4172
+ ...arg,
4173
+ expression,
4174
+ children: arg.children.map(($) => $ === arg.expression ? expression : $)
4175
+ });
4176
+ } else {
4177
+ results.push(arg);
4178
+ }
4179
+ }
4180
+ return results;
4181
+ })(),
4182
+ "]"
4183
+ ]
4184
+ };
4185
+ } else {
4186
+ args = trimFirstSpace(args);
4187
+ args = {
4188
+ ...args,
4189
+ children: args.children.map(
4190
+ (arg) => {
4191
+ if (typeof arg === "object" && arg != null && "type" in arg && arg.type === "ArrayElement" && "expression" in arg && "children" in arg) {
4192
+ const { type, expression: exp, children } = arg;
4193
+ let expression = processUnaryExpression([last], trimFirstSpace(exp));
4194
+ expression = prepend(getTrimmingSpace(exp), expression);
4195
+ return {
4196
+ ...arg,
4197
+ expression,
4198
+ children: children.map(($1) => $1 === exp ? expression : $1)
4199
+ };
4200
+ } else {
4201
+ return arg;
4202
+ }
4203
+ }
4204
+ )
4205
+ };
4206
+ }
4207
+ }
4208
+ }
4209
+ return processUnaryExpression(pre, args, post);
4210
+ }
4097
4211
 
4098
4212
  // source/parser/pipe.civet
4099
4213
  function constructInvocation(fn, arg) {
@@ -4131,36 +4245,31 @@ ${body}`;
4131
4245
  };
4132
4246
  }
4133
4247
  function constructPipeStep(fn, arg, returning) {
4248
+ if (!returning) {
4249
+ returning = null;
4250
+ }
4134
4251
  let children = [[fn.leadingComment, fn.expr, fn.trailingComment].map(skipIfOnlyWS), " ", arg];
4135
4252
  switch (fn.expr.token) {
4136
- case "yield":
4137
- case "await":
4138
- if (fn.expr.op) {
4139
- children = processUnaryExpression([fn.expr], arg, void 0);
4140
- }
4141
- if (returning) {
4142
- return [
4143
- children,
4144
- returning
4145
- ];
4146
- }
4253
+ case "await": {
4254
+ children = processUnaryExpression([fn.expr], arg, void 0);
4255
+ }
4256
+ case "yield": {
4147
4257
  return [
4148
4258
  children,
4149
- null
4259
+ returning
4150
4260
  ];
4151
- case "return":
4261
+ }
4262
+ case "return": {
4152
4263
  return [{
4153
4264
  type: "ReturnStatement",
4154
4265
  children
4155
4266
  }, null];
4267
+ }
4156
4268
  }
4157
- if (returning) {
4158
- return [
4159
- constructInvocation(fn, arg),
4160
- returning
4161
- ];
4162
- }
4163
- return [constructInvocation(fn, arg), null];
4269
+ return [
4270
+ constructInvocation(fn, arg),
4271
+ returning
4272
+ ];
4164
4273
  }
4165
4274
  function processPipelineExpressions(statements) {
4166
4275
  gatherRecursiveAll(statements, (n) => n.type === "PipelineExpression").forEach((s) => {
@@ -4417,7 +4526,29 @@ ${body}`;
4417
4526
  message: "'own' is only meaningful in for..in loops"
4418
4527
  };
4419
4528
  }
4420
- if (!declaration2 && !own) {
4529
+ const { binding } = declaration;
4530
+ let pattern = binding?.pattern;
4531
+ if (binding?.typeSuffix || inOf.token === "in" && declaration2 && pattern.type !== "Identifier") {
4532
+ const itemRef = makeRef(inOf.token === "in" ? "key" : "item");
4533
+ blockPrefix.push(["", {
4534
+ type: "Declaration",
4535
+ children: [declaration, " = ", itemRef],
4536
+ names: declaration.names
4537
+ }, ";"]);
4538
+ pattern = itemRef;
4539
+ declaration = {
4540
+ type: "ForDeclaration",
4541
+ binding: {
4542
+ type: "Binding",
4543
+ pattern,
4544
+ children: [pattern],
4545
+ names: []
4546
+ },
4547
+ children: ["const ", itemRef],
4548
+ names: []
4549
+ };
4550
+ }
4551
+ if (!(declaration2 || own)) {
4421
4552
  return {
4422
4553
  declaration,
4423
4554
  blockPrefix,
@@ -4456,29 +4587,6 @@ ${body}`;
4456
4587
  children: [" ", expRef2, " =", exp]
4457
4588
  };
4458
4589
  }
4459
- const { binding } = declaration;
4460
- let { pattern } = binding;
4461
- if (!(pattern.type === "Identifier")) {
4462
- const keyRef = makeRef("key");
4463
- blockPrefix.push(["", [
4464
- declaration,
4465
- " = ",
4466
- keyRef
4467
- ], ";"]);
4468
- pattern = keyRef;
4469
- declaration = {
4470
- type: "ForDeclaration",
4471
- binding: {
4472
- type: "Binding",
4473
- pattern,
4474
- children: [pattern],
4475
- names: [],
4476
- suffix: binding.suffix
4477
- },
4478
- children: ["const ", keyRef],
4479
- names: []
4480
- };
4481
- }
4482
4590
  if (own) {
4483
4591
  const hasPropRef = getRef("hasProp");
4484
4592
  blockPrefix.push(["", ["if (!", hasPropRef, "(", insertTrimmingSpace(expRef2, ""), ", ", insertTrimmingSpace(pattern, ""), ")) continue"], ";"]);
@@ -6175,44 +6283,82 @@ ${js}`
6175
6283
  }
6176
6284
  function processTypes(node) {
6177
6285
  return gatherRecursiveAll(node, (n) => n.type === "TypeUnary").forEach((unary) => {
6178
- let last;
6179
- let count = 0;
6180
- let ref10;
6181
- while (unary.suffix.length && (ref10 = unary.suffix)[ref10.length - 1]?.token === "?") {
6182
- last = unary.suffix.pop();
6183
- count++;
6184
- }
6185
- if (!count) {
6286
+ if (!unary.suffix.length) {
6186
6287
  return;
6187
6288
  }
6188
- let ref11;
6189
- if (unary.suffix.length || unary.prefix.length)
6190
- ref11 = unary;
6191
- else
6192
- ref11 = unary.t;
6193
- const t = ref11;
6194
- if (unary.parent?.type === "TypeTuple") {
6195
- if (count === 1) {
6196
- unary.suffix.push(last);
6197
- return;
6289
+ let ref10;
6290
+ let m3;
6291
+ if (m3 = (ref10 = unary.suffix)[ref10.length - 1], typeof m3 === "object" && m3 != null && "token" in m3 && m3.token === "?") {
6292
+ const { token } = m3;
6293
+ let last;
6294
+ let count = 0;
6295
+ let ref11;
6296
+ while (unary.suffix.length && (ref11 = unary.suffix)[ref11.length - 1]?.token === "?") {
6297
+ last = unary.suffix.pop();
6298
+ count++;
6198
6299
  }
6199
- replaceNode(unary, [
6200
- getTrimmingSpace(unary),
6201
- "(",
6202
- parenthesizeType(trimFirstSpace(t)),
6203
- " | null)",
6204
- last
6205
- ]);
6206
- } else {
6207
- replaceNode(unary, {
6208
- type: "TypeParenthesized",
6209
- ts: true,
6210
- children: [
6300
+ let ref12;
6301
+ while (unary.suffix.length && (ref12 = unary.suffix)[ref12.length - 1]?.type === "NonNullAssertion") {
6302
+ unary.suffix.pop();
6303
+ }
6304
+ let ref13;
6305
+ if (unary.suffix.length || unary.prefix.length)
6306
+ ref13 = unary;
6307
+ else
6308
+ ref13 = unary.t;
6309
+ const t = ref13;
6310
+ if (unary.parent?.type === "TypeTuple") {
6311
+ if (count === 1) {
6312
+ unary.suffix.push(last);
6313
+ return;
6314
+ }
6315
+ replaceNode(unary, [
6211
6316
  getTrimmingSpace(unary),
6212
6317
  "(",
6213
6318
  parenthesizeType(trimFirstSpace(t)),
6214
- count === 1 ? " | undefined" : " | undefined | null",
6215
- ")"
6319
+ " | null)",
6320
+ last
6321
+ ]);
6322
+ } else {
6323
+ replaceNode(unary, {
6324
+ type: "TypeParenthesized",
6325
+ ts: true,
6326
+ children: [
6327
+ getTrimmingSpace(unary),
6328
+ "(",
6329
+ parenthesizeType(trimFirstSpace(t)),
6330
+ count === 1 ? " | undefined" : " | undefined | null",
6331
+ ")"
6332
+ ]
6333
+ });
6334
+ }
6335
+ } else if (typeof m3 === "object" && m3 != null && "type" in m3 && m3.type === "NonNullAssertion") {
6336
+ const { type } = m3;
6337
+ let ref14;
6338
+ while (unary.suffix.length && (ref14 = unary.suffix)[ref14.length - 1]?.type === "NonNullAssertion") {
6339
+ unary.suffix.pop();
6340
+ }
6341
+ let ref15;
6342
+ while (unary.suffix.length && (ref15 = unary.suffix)[ref15.length - 1]?.token === "?") {
6343
+ unary.suffix.pop();
6344
+ }
6345
+ const t = trimFirstSpace(
6346
+ unary.suffix.length || unary.prefix.length ? unary : unary.t
6347
+ );
6348
+ const args = {
6349
+ type: "TypeArguments",
6350
+ ts: true,
6351
+ types: [t],
6352
+ children: ["<", t, ">"]
6353
+ };
6354
+ replaceNode(unary, {
6355
+ type: "TypeIdentifier",
6356
+ raw: "NonNullable",
6357
+ args,
6358
+ children: [
6359
+ getTrimmingSpace(unary),
6360
+ "NonNullable",
6361
+ args
6216
6362
  ]
6217
6363
  });
6218
6364
  }
@@ -6222,11 +6368,11 @@ ${js}`
6222
6368
  gatherRecursiveAll(statements, ($7) => $7.type === "StatementExpression").forEach((_exp) => {
6223
6369
  const exp = _exp;
6224
6370
  const { statement } = exp;
6225
- let ref12;
6371
+ let ref16;
6226
6372
  switch (statement.type) {
6227
6373
  case "IfStatement": {
6228
- if (ref12 = expressionizeIfStatement(statement)) {
6229
- const expression = ref12;
6374
+ if (ref16 = expressionizeIfStatement(statement)) {
6375
+ const expression = ref16;
6230
6376
  return replaceNode(statement, expression, exp);
6231
6377
  } else {
6232
6378
  return replaceNode(statement, wrapIIFE([["", statement]]), exp);
@@ -6372,10 +6518,10 @@ ${js}`
6372
6518
  if (type === "IfStatement") {
6373
6519
  liftedIfs.add(ancestor2);
6374
6520
  }
6375
- let m3;
6376
6521
  let m4;
6522
+ let m5;
6377
6523
  return type === "Call" || // Block, except for if/else blocks when condition already lifted
6378
- type === "BlockStatement" && !((m3 = ancestor2.parent, typeof m3 === "object" && m3 != null && "type" in m3 && m3.type === "IfStatement") && liftedIfs.has(ancestor2.parent)) && !((m4 = ancestor2.parent, typeof m4 === "object" && m4 != null && "type" in m4 && m4.type === "ElseClause" && "parent" in m4 && typeof m4.parent === "object" && m4.parent != null && "type" in m4.parent && m4.parent.type === "IfStatement") && liftedIfs.has(ancestor2.parent.parent)) || type === "PipelineExpression" || // Declaration
6524
+ type === "BlockStatement" && !((m4 = ancestor2.parent, typeof m4 === "object" && m4 != null && "type" in m4 && m4.type === "IfStatement") && liftedIfs.has(ancestor2.parent)) && !((m5 = ancestor2.parent, typeof m5 === "object" && m5 != null && "type" in m5 && m5.type === "ElseClause" && "parent" in m5 && typeof m5.parent === "object" && m5.parent != null && "type" in m5.parent && m5.parent.type === "IfStatement") && liftedIfs.has(ancestor2.parent.parent)) || type === "PipelineExpression" || // Declaration
6379
6525
  type === "Initializer" || // Right-hand side of assignment
6380
6526
  type === "AssignmentExpression" && findChildIndex(ancestor2, child2) === ancestor2.children.indexOf(ancestor2.expression) || type === "ReturnStatement" || type === "YieldExpression";
6381
6527
  }));
@@ -6454,8 +6600,8 @@ ${js}`
6454
6600
  for (let i4 = 0, len3 = placeholders.length; i4 < len3; i4++) {
6455
6601
  const placeholder = placeholders[i4];
6456
6602
  typeSuffix ??= placeholder.typeSuffix;
6457
- let ref13;
6458
- replaceNode((ref13 = placeholder.children)[ref13.length - 1], ref);
6603
+ let ref17;
6604
+ replaceNode((ref17 = placeholder.children)[ref17.length - 1], ref);
6459
6605
  }
6460
6606
  const { parent } = ancestor;
6461
6607
  const body = maybeUnwrap(ancestor);
@@ -6472,16 +6618,16 @@ ${js}`
6472
6618
  }
6473
6619
  case "PipelineExpression": {
6474
6620
  const i = findChildIndex(parent, ancestor);
6475
- let ref14;
6621
+ let ref18;
6476
6622
  if (i === 1) {
6477
- ref14 = ancestor === parent.children[i];
6623
+ ref18 = ancestor === parent.children[i];
6478
6624
  } else if (i === 2) {
6479
- ref14 = ancestor === parent.children[i][findChildIndex(parent.children[i], ancestor)][3];
6625
+ ref18 = ancestor === parent.children[i][findChildIndex(parent.children[i], ancestor)][3];
6480
6626
  } else {
6481
- ref14 = void 0;
6627
+ ref18 = void 0;
6482
6628
  }
6483
6629
  ;
6484
- outer = ref14;
6630
+ outer = ref18;
6485
6631
  break;
6486
6632
  }
6487
6633
  case "AssignmentExpression":
@@ -6496,9 +6642,9 @@ ${js}`
6496
6642
  fnExp = makeLeftHandSideExpression(fnExp);
6497
6643
  }
6498
6644
  replaceNode(ancestor, fnExp, parent);
6499
- let ref15;
6500
- if (ref15 = getTrimmingSpace(body)) {
6501
- const ws = ref15;
6645
+ let ref19;
6646
+ if (ref19 = getTrimmingSpace(body)) {
6647
+ const ws = ref19;
6502
6648
  inplaceInsertTrimmingSpace(body, "");
6503
6649
  inplacePrepend(ws, fnExp);
6504
6650
  }
@@ -6543,8 +6689,8 @@ ${js}`
6543
6689
  }
6544
6690
  ];
6545
6691
  }
6546
- let ref16;
6547
- if (Array.isArray(rest.delim) && (ref16 = rest.delim)[ref16.length - 1]?.token === ",") {
6692
+ let ref20;
6693
+ if (Array.isArray(rest.delim) && (ref20 = rest.delim)[ref20.length - 1]?.token === ",") {
6548
6694
  rest.delim = rest.delim.slice(0, -1);
6549
6695
  rest.children = [...rest.children.slice(0, -1), rest.delim];
6550
6696
  }
@@ -6709,6 +6855,7 @@ ${js}`
6709
6855
  NestedArgumentList,
6710
6856
  NestedArgument,
6711
6857
  SingleLineArgumentExpressions,
6858
+ WArgumentPart,
6712
6859
  ArgumentPart,
6713
6860
  NonPipelineArgumentPart,
6714
6861
  BinaryOpExpression,
@@ -6720,6 +6867,8 @@ ${js}`
6720
6867
  UnaryExpression,
6721
6868
  UnaryWithoutParenthesizedAssignment,
6722
6869
  UnaryBody,
6870
+ MaybeNestedCoffeeDoBody,
6871
+ CoffeeDoBody,
6723
6872
  UnaryWithoutParenthesizedAssignmentBody,
6724
6873
  ParenthesizedAssignment,
6725
6874
  UnaryPostfix,
@@ -7052,6 +7201,7 @@ ${js}`
7052
7201
  MaybeNestedNonPipelineExtendedExpression,
7053
7202
  MaybeNestedPostfixedExpression,
7054
7203
  MaybeNestedExtendedExpression,
7204
+ NestedExtendedExpression,
7055
7205
  MaybeParenNestedExtendedExpression,
7056
7206
  ImportDeclaration,
7057
7207
  ImpliedImport,
@@ -7993,9 +8143,7 @@ ${js}`
7993
8143
  var close = $5;
7994
8144
  if (skipImplicitArguments(args))
7995
8145
  return $skip;
7996
- let last = args[args.length - 1];
7997
- if (last?.token === "," && last.implicit)
7998
- args = args.slice(0, -1);
8146
+ args = stripTrailingImplicitComma(args);
7999
8147
  return {
8000
8148
  type: "Call",
8001
8149
  args,
@@ -8173,24 +8321,43 @@ ${js}`
8173
8321
  var args = $2;
8174
8322
  var comma = $3;
8175
8323
  let [arg0, ...rest] = args;
8176
- arg0 = [indent, ...arg0];
8324
+ arg0 = prepend(indent, arg0);
8177
8325
  return [arg0, ...rest, comma];
8178
8326
  });
8179
8327
  function NestedArgument(ctx, state2) {
8180
8328
  return (0, import_lib3.$EVENT)(ctx, state2, "NestedArgument", NestedArgument$0);
8181
8329
  }
8182
- var SingleLineArgumentExpressions$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$S)((0, import_lib3.$E)(_), ArgumentPart), (0, import_lib3.$Q)((0, import_lib3.$S)((0, import_lib3.$S)((0, import_lib3.$E)(_), Comma), (0, import_lib3.$S)((0, import_lib3.$E)(_), ArgumentPart)))), function($skip, $loc, $0, $1, $2) {
8330
+ var SingleLineArgumentExpressions$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(WArgumentPart, (0, import_lib3.$Q)((0, import_lib3.$S)((0, import_lib3.$S)((0, import_lib3.$E)(_), Comma), WArgumentPart))), function($skip, $loc, $0, $1, $2) {
8183
8331
  return [$1, ...$2.flat()];
8184
8332
  });
8185
8333
  function SingleLineArgumentExpressions(ctx, state2) {
8186
8334
  return (0, import_lib3.$EVENT)(ctx, state2, "SingleLineArgumentExpressions", SingleLineArgumentExpressions$0);
8187
8335
  }
8188
- var ArgumentPart$0 = (0, import_lib3.$S)(DotDotDot, ExtendedExpression);
8336
+ var WArgumentPart$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)(_), ArgumentPart), function($skip, $loc, $0, $1, $2) {
8337
+ return prepend($1, $2);
8338
+ });
8339
+ function WArgumentPart(ctx, state2) {
8340
+ return (0, import_lib3.$EVENT)(ctx, state2, "WArgumentPart", WArgumentPart$0);
8341
+ }
8342
+ var ArgumentPart$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(DotDotDot, ExtendedExpression), function($skip, $loc, $0, $1, $2) {
8343
+ var spread = $1;
8344
+ var expression = $2;
8345
+ return {
8346
+ type: "Argument",
8347
+ children: $0,
8348
+ expression,
8349
+ spread
8350
+ };
8351
+ });
8189
8352
  var ArgumentPart$1 = (0, import_lib3.$TS)((0, import_lib3.$S)(ExtendedExpression, (0, import_lib3.$E)(DotDotDot)), function($skip, $loc, $0, $1, $2) {
8190
- if ($2) {
8191
- return [$2, $1];
8192
- }
8193
- return $1;
8353
+ var expression = $1;
8354
+ var spread = $2;
8355
+ return {
8356
+ type: "Argument",
8357
+ children: spread ? [spread, expression] : [expression],
8358
+ expression,
8359
+ spread
8360
+ };
8194
8361
  });
8195
8362
  var ArgumentPart$$ = [ArgumentPart$0, ArgumentPart$1];
8196
8363
  function ArgumentPart(ctx, state2) {
@@ -8278,17 +8445,18 @@ ${js}`
8278
8445
  function RHS(ctx, state2) {
8279
8446
  return (0, import_lib3.$EVENT_C)(ctx, state2, "RHS", RHS$$);
8280
8447
  }
8281
- var UnaryExpression$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$Q)(UnaryOp), UnaryBody, (0, import_lib3.$E)(UnaryPostfix)), function($skip, $loc, $0, $1, $2, $3) {
8448
+ var UnaryExpression$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(IndentedApplicationAllowed, (0, import_lib3.$P)(UnaryOp), (0, import_lib3.$C)(ArrayLiteral, NestedArgumentList), (0, import_lib3.$E)(UnaryPostfix)), function($skip, $loc, $0, $1, $2, $3, $4) {
8449
+ var pre = $2;
8450
+ var args = $3;
8451
+ var post = $4;
8452
+ return processUnaryNestedExpression(pre, args, post) ?? $skip;
8453
+ });
8454
+ var UnaryExpression$1 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$Q)(UnaryOp), UnaryBody, (0, import_lib3.$E)(UnaryPostfix)), function($skip, $loc, $0, $1, $2, $3) {
8282
8455
  var pre = $1;
8283
8456
  var exp = $2;
8284
8457
  var post = $3;
8285
8458
  return processUnaryExpression(pre, exp, post);
8286
8459
  });
8287
- var UnaryExpression$1 = (0, import_lib3.$TS)((0, import_lib3.$S)(CoffeeDoEnabled, Do, __, (0, import_lib3.$C)(ArrowFunction, (0, import_lib3.$S)(LeftHandSideExpression, (0, import_lib3.$N)((0, import_lib3.$S)(__, AssignmentOpSymbol))), ExtendedExpression)), function($skip, $loc, $0, $1, $2, $3, $4) {
8288
- var ws = $3;
8289
- var exp = $4;
8290
- return processCoffeeDo(ws, exp);
8291
- });
8292
8460
  var UnaryExpression$$ = [UnaryExpression$0, UnaryExpression$1];
8293
8461
  function UnaryExpression(ctx, state2) {
8294
8462
  return (0, import_lib3.$EVENT_C)(ctx, state2, "UnaryExpression", UnaryExpression$$);
@@ -8302,14 +8470,35 @@ ${js}`
8302
8470
  function UnaryWithoutParenthesizedAssignment(ctx, state2) {
8303
8471
  return (0, import_lib3.$EVENT)(ctx, state2, "UnaryWithoutParenthesizedAssignment", UnaryWithoutParenthesizedAssignment$0);
8304
8472
  }
8305
- var UnaryBody$0 = ParenthesizedAssignment;
8306
- var UnaryBody$1 = ExpressionizedStatementWithTrailingCallExpressions;
8307
- var UnaryBody$2 = UpdateExpression;
8308
- var UnaryBody$3 = NestedNonAssignmentExtendedExpression;
8309
- var UnaryBody$$ = [UnaryBody$0, UnaryBody$1, UnaryBody$2, UnaryBody$3];
8473
+ var UnaryBody$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(CoffeeDoEnabled, Do, MaybeNestedCoffeeDoBody), function($skip, $loc, $0, $1, $2, $3) {
8474
+ var body = $3;
8475
+ return processCoffeeDo(...body);
8476
+ });
8477
+ var UnaryBody$1 = ParenthesizedAssignment;
8478
+ var UnaryBody$2 = ExpressionizedStatementWithTrailingCallExpressions;
8479
+ var UnaryBody$3 = UpdateExpression;
8480
+ var UnaryBody$4 = NestedNonAssignmentExtendedExpression;
8481
+ var UnaryBody$$ = [UnaryBody$0, UnaryBody$1, UnaryBody$2, UnaryBody$3, UnaryBody$4];
8310
8482
  function UnaryBody(ctx, state2) {
8311
8483
  return (0, import_lib3.$EVENT_C)(ctx, state2, "UnaryBody", UnaryBody$$);
8312
8484
  }
8485
+ var MaybeNestedCoffeeDoBody$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(PushIndent, (0, import_lib3.$E)((0, import_lib3.$S)(Nested, CoffeeDoBody)), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
8486
+ if (!$2)
8487
+ return $skip;
8488
+ return $2;
8489
+ });
8490
+ var MaybeNestedCoffeeDoBody$1 = (0, import_lib3.$S)((0, import_lib3.$E)(_), CoffeeDoBody);
8491
+ var MaybeNestedCoffeeDoBody$$ = [MaybeNestedCoffeeDoBody$0, MaybeNestedCoffeeDoBody$1];
8492
+ function MaybeNestedCoffeeDoBody(ctx, state2) {
8493
+ return (0, import_lib3.$EVENT_C)(ctx, state2, "MaybeNestedCoffeeDoBody", MaybeNestedCoffeeDoBody$$);
8494
+ }
8495
+ var CoffeeDoBody$0 = ArrowFunction;
8496
+ var CoffeeDoBody$1 = (0, import_lib3.$S)(LeftHandSideExpression, (0, import_lib3.$N)((0, import_lib3.$S)(__, AssignmentOpSymbol)));
8497
+ var CoffeeDoBody$2 = ExtendedExpression;
8498
+ var CoffeeDoBody$$ = [CoffeeDoBody$0, CoffeeDoBody$1, CoffeeDoBody$2];
8499
+ function CoffeeDoBody(ctx, state2) {
8500
+ return (0, import_lib3.$EVENT_C)(ctx, state2, "CoffeeDoBody", CoffeeDoBody$$);
8501
+ }
8313
8502
  var UnaryWithoutParenthesizedAssignmentBody$0 = UpdateExpression;
8314
8503
  var UnaryWithoutParenthesizedAssignmentBody$1 = ExpressionizedStatementWithTrailingCallExpressions;
8315
8504
  var UnaryWithoutParenthesizedAssignmentBody$2 = NestedNonAssignmentExtendedExpression;
@@ -8508,7 +8697,7 @@ ${js}`
8508
8697
  var ArrowFunction$1 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)((0, import_lib3.$S)(Async, _)), ArrowParameters, (0, import_lib3.$E)(ReturnTypeSuffix), FatArrow, FatArrowBody), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
8509
8698
  var async = $1;
8510
8699
  var parameters = $2;
8511
- var suffix = $3;
8700
+ var returnType = $3;
8512
8701
  var arrow = $4;
8513
8702
  var expOrBlock = $5;
8514
8703
  if (!async)
@@ -8519,13 +8708,13 @@ ${js}`
8519
8708
  modifier: {
8520
8709
  async: !!async.length
8521
8710
  },
8522
- returnType: suffix
8711
+ returnType
8523
8712
  },
8524
8713
  parameters,
8525
- returnType: suffix,
8714
+ returnType,
8526
8715
  async,
8527
8716
  block: expOrBlock,
8528
- children: [async, parameters, suffix, arrow, expOrBlock]
8717
+ children: [async, parameters, returnType, arrow, expOrBlock]
8529
8718
  };
8530
8719
  });
8531
8720
  var ArrowFunction$$ = [ArrowFunction$0, ArrowFunction$1];
@@ -10257,7 +10446,7 @@ ${js}`
10257
10446
  var wid = $4;
10258
10447
  var w = $5;
10259
10448
  var parameters = $6;
10260
- var suffix = $7;
10449
+ var returnType = $7;
10261
10450
  if (!async)
10262
10451
  async = [];
10263
10452
  if (!generator)
@@ -10268,7 +10457,7 @@ ${js}`
10268
10457
  id,
10269
10458
  name: id?.name,
10270
10459
  parameters,
10271
- returnType: suffix,
10460
+ returnType,
10272
10461
  async,
10273
10462
  generator,
10274
10463
  modifier: {
@@ -10276,7 +10465,7 @@ ${js}`
10276
10465
  generator: !!generator.length
10277
10466
  },
10278
10467
  block: null,
10279
- children: !parameters.implicit ? [async, func, generator, wid, w, parameters, suffix] : [async, func, generator, wid, parameters, w, suffix]
10468
+ children: !parameters.implicit ? [async, func, generator, wid, w, parameters, returnType] : [async, func, generator, wid, parameters, w, returnType]
10280
10469
  // move whitespace w to after implicit () in parameters
10281
10470
  };
10282
10471
  });
@@ -10475,7 +10664,7 @@ ${js}`
10475
10664
  var behavior = $7;
10476
10665
  var w2 = $8;
10477
10666
  var parameters = $9;
10478
- var suffix = $10;
10667
+ var returnType = $10;
10479
10668
  if (!async)
10480
10669
  async = [];
10481
10670
  if (!generator)
@@ -10490,7 +10679,7 @@ ${js}`
10490
10679
  id,
10491
10680
  name: id.name,
10492
10681
  parameters,
10493
- returnType: suffix,
10682
+ returnType,
10494
10683
  async,
10495
10684
  generator,
10496
10685
  modifier: {
@@ -10498,7 +10687,7 @@ ${js}`
10498
10687
  generator: !!generator.length
10499
10688
  },
10500
10689
  block: null,
10501
- children: [async, func, generator, w1, id, w2, parameters, suffix],
10690
+ children: [async, func, generator, w1, id, w2, parameters, returnType],
10502
10691
  behavior
10503
10692
  };
10504
10693
  });
@@ -10545,7 +10734,7 @@ ${js}`
10545
10734
  var ThinArrowFunction$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)((0, import_lib3.$S)(Async, _)), ArrowParameters, (0, import_lib3.$E)(ReturnTypeSuffix), (0, import_lib3.$E)(_), Arrow, NoCommaBracedOrEmptyBlock), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
10546
10735
  var async = $1;
10547
10736
  var parameters = $2;
10548
- var suffix = $3;
10737
+ var returnType = $3;
10549
10738
  var arrow = $5;
10550
10739
  var block = $6;
10551
10740
  if (!async)
@@ -10555,7 +10744,7 @@ ${js}`
10555
10744
  type: "FunctionExpression",
10556
10745
  id: void 0,
10557
10746
  parameters,
10558
- returnType: suffix,
10747
+ returnType,
10559
10748
  async,
10560
10749
  generator,
10561
10750
  block,
@@ -10567,14 +10756,14 @@ ${js}`
10567
10756
  async: !!async.length,
10568
10757
  generator: !!generator.length
10569
10758
  },
10570
- returnType: suffix
10759
+ returnType
10571
10760
  },
10572
10761
  children: [
10573
10762
  async,
10574
10763
  { $loc: arrow.$loc, token: "function" },
10575
10764
  generator,
10576
10765
  parameters,
10577
- suffix,
10766
+ returnType,
10578
10767
  block
10579
10768
  ]
10580
10769
  };
@@ -11271,6 +11460,7 @@ ${js}`
11271
11460
  return {
11272
11461
  type: "SpreadElement",
11273
11462
  children: [ws, dots, exp],
11463
+ expression: exp,
11274
11464
  names: exp.names
11275
11465
  };
11276
11466
  });
@@ -11282,12 +11472,14 @@ ${js}`
11282
11472
  return {
11283
11473
  type: "ArrayElement",
11284
11474
  children: [exp],
11475
+ expression: exp,
11285
11476
  names: exp.names
11286
11477
  };
11287
11478
  } else {
11288
11479
  return {
11289
11480
  type: "SpreadElement",
11290
11481
  children: [...spread, exp],
11482
+ expression: exp,
11291
11483
  names: exp.names
11292
11484
  };
11293
11485
  }
@@ -11331,9 +11523,9 @@ ${js}`
11331
11523
  // replace first space with bracket
11332
11524
  ...content[1].flat()
11333
11525
  ];
11334
- const last = content[content.length - 1];
11526
+ let last = content[content.length - 1];
11335
11527
  if (last.children?.at(-1)?.implicit) {
11336
- last.children = last.children.slice(0, -1);
11528
+ content[content.length - 1] = last = { ...last, children: last.children.slice(0, -1) };
11337
11529
  }
11338
11530
  return {
11339
11531
  type: "ArrayExpression",
@@ -13223,14 +13415,14 @@ ${js}`
13223
13415
  }
13224
13416
  var ForBinding$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$C)(BindingPattern, BindingIdentifier), (0, import_lib3.$E)(TypeSuffix)), function($skip, $loc, $0, $1, $2) {
13225
13417
  var pattern = $1;
13226
- var suffix = $2;
13227
- suffix ??= pattern.typeSuffix;
13418
+ var typeSuffix = $2;
13419
+ typeSuffix ??= pattern.typeSuffix;
13228
13420
  return {
13229
13421
  type: "Binding",
13230
- children: [pattern, suffix],
13422
+ children: [pattern, typeSuffix],
13231
13423
  names: pattern.names,
13232
13424
  pattern,
13233
- suffix,
13425
+ typeSuffix,
13234
13426
  splices: [],
13235
13427
  thisAssignments: []
13236
13428
  };
@@ -13867,6 +14059,16 @@ ${js}`
13867
14059
  function MaybeNestedExtendedExpression(ctx, state2) {
13868
14060
  return (0, import_lib3.$EVENT_C)(ctx, state2, "MaybeNestedExtendedExpression", MaybeNestedExtendedExpression$$);
13869
14061
  }
14062
+ var NestedExtendedExpression$0 = NestedBulletedArray;
14063
+ var NestedExtendedExpression$1 = (0, import_lib3.$TS)((0, import_lib3.$S)(PushIndent, (0, import_lib3.$E)((0, import_lib3.$S)(Nested, ExtendedExpression)), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
14064
+ if ($3)
14065
+ return $3;
14066
+ return $skip;
14067
+ });
14068
+ var NestedExtendedExpression$$ = [NestedExtendedExpression$0, NestedExtendedExpression$1];
14069
+ function NestedExtendedExpression(ctx, state2) {
14070
+ return (0, import_lib3.$EVENT_C)(ctx, state2, "NestedExtendedExpression", NestedExtendedExpression$$);
14071
+ }
13870
14072
  var MaybeParenNestedExtendedExpression$0 = (0, import_lib3.$T)((0, import_lib3.$S)((0, import_lib3.$N)(EOS), ExtendedExpression), function(value) {
13871
14073
  return value[1];
13872
14074
  });
@@ -14361,16 +14563,16 @@ ${js}`
14361
14563
  }
14362
14564
  var LexicalBinding$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(BindingPattern, (0, import_lib3.$E)(TypeSuffix), Initializer), function($skip, $loc, $0, $1, $2, $3) {
14363
14565
  var pattern = $1;
14364
- var suffix = $2;
14566
+ var typeSuffix = $2;
14365
14567
  var initializer = $3;
14366
14568
  const [splices, thisAssignments] = gatherBindingCode(pattern);
14367
- suffix ??= pattern.typeSuffix;
14569
+ typeSuffix ??= pattern.typeSuffix;
14368
14570
  return {
14369
14571
  type: "Binding",
14370
- children: [pattern, suffix, initializer],
14572
+ children: [pattern, typeSuffix, initializer],
14371
14573
  names: pattern.names,
14372
14574
  pattern,
14373
- suffix,
14575
+ typeSuffix,
14374
14576
  initializer,
14375
14577
  splices: splices.map((s) => [",", s]),
14376
14578
  thisAssignments: thisAssignments.map((s) => ["", s, ";"])
@@ -14378,14 +14580,14 @@ ${js}`
14378
14580
  });
14379
14581
  var LexicalBinding$1 = (0, import_lib3.$TS)((0, import_lib3.$S)(BindingIdentifier, (0, import_lib3.$E)(TypeSuffix), (0, import_lib3.$E)(Initializer)), function($skip, $loc, $0, $1, $2, $3) {
14380
14582
  var pattern = $1;
14381
- var suffix = $2;
14583
+ var typeSuffix = $2;
14382
14584
  var initializer = $3;
14383
14585
  return {
14384
14586
  type: "Binding",
14385
14587
  children: $0,
14386
14588
  names: pattern.names,
14387
14589
  pattern,
14388
- suffix,
14590
+ typeSuffix,
14389
14591
  initializer,
14390
14592
  splices: [],
14391
14593
  thisAssignments: []
@@ -16330,14 +16532,14 @@ ${js}`
16330
16532
  }
16331
16533
  var UsingBinding$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(BindingIdentifier, (0, import_lib3.$E)(TypeSuffix), Initializer), function($skip, $loc, $0, $1, $2, $3) {
16332
16534
  var pattern = $1;
16333
- var suffix = $2;
16535
+ var typeSuffix = $2;
16334
16536
  var initializer = $3;
16335
16537
  return {
16336
16538
  type: "Binding",
16337
16539
  children: $0,
16338
16540
  names: pattern.names,
16339
16541
  pattern,
16340
- suffix,
16542
+ typeSuffix,
16341
16543
  initializer,
16342
16544
  splices: [],
16343
16545
  thisAssignments: []
@@ -16899,7 +17101,8 @@ ${js}`
16899
17101
  }
16900
17102
  var TypeUnarySuffix$0 = TypeIndexedAccess;
16901
17103
  var TypeUnarySuffix$1 = QuestionMark;
16902
- var TypeUnarySuffix$$ = [TypeUnarySuffix$0, TypeUnarySuffix$1];
17104
+ var TypeUnarySuffix$2 = NonNullAssertion;
17105
+ var TypeUnarySuffix$$ = [TypeUnarySuffix$0, TypeUnarySuffix$1, TypeUnarySuffix$2];
16903
17106
  function TypeUnarySuffix(ctx, state2) {
16904
17107
  return (0, import_lib3.$EVENT_C)(ctx, state2, "TypeUnarySuffix", TypeUnarySuffix$$);
16905
17108
  }