@danielx/civet 0.7.33 → 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/main.js CHANGED
@@ -564,11 +564,13 @@ __export(lib_exports, {
564
564
  processProgramAsync: () => processProgramAsync,
565
565
  processTryBlock: () => processTryBlock,
566
566
  processUnaryExpression: () => processUnaryExpression,
567
+ processUnaryNestedExpression: () => processUnaryNestedExpression,
567
568
  quoteString: () => quoteString,
568
569
  reorderBindingRestProperty: () => reorderBindingRestProperty,
569
570
  replaceNode: () => replaceNode,
570
571
  replaceNodes: () => replaceNodes,
571
572
  skipImplicitArguments: () => skipImplicitArguments,
573
+ stripTrailingImplicitComma: () => stripTrailingImplicitComma,
572
574
  trimFirstSpace: () => trimFirstSpace,
573
575
  typeOfJSX: () => typeOfJSX,
574
576
  wrapIIFE: () => wrapIIFE
@@ -705,6 +707,40 @@ function isWhitespaceOrEmpty(node) {
705
707
  return node.every(isWhitespaceOrEmpty);
706
708
  return false;
707
709
  }
710
+ function firstNonSpace(node) {
711
+ if (!(node != null)) {
712
+ return;
713
+ }
714
+ if (Array.isArray(node)) {
715
+ for (let i2 = 0, len22 = node.length; i2 < len22; i2++) {
716
+ const child = node[i2];
717
+ let ref1;
718
+ if (ref1 = firstNonSpace(child)) {
719
+ const first = ref1;
720
+ return first;
721
+ }
722
+ }
723
+ return void 0;
724
+ } else if (isParent(node)) {
725
+ let ref2;
726
+ if (ref2 = firstNonSpace(node.children)) {
727
+ const first = ref2;
728
+ return first;
729
+ } else {
730
+ return node;
731
+ }
732
+ } else if (isToken(node)) {
733
+ let m;
734
+ if (m = node.token, typeof m === "string" && /^[ \t]*$/.test(m)) {
735
+ return;
736
+ }
737
+ } else if (typeof node === "string") {
738
+ if (typeof node === "string" && /^[ \t]*$/.test(node)) {
739
+ return;
740
+ }
741
+ }
742
+ return node;
743
+ }
708
744
  function isExit(node) {
709
745
  if (!(node != null)) {
710
746
  return false;
@@ -742,6 +778,14 @@ function isComma(node) {
742
778
  ;
743
779
  return;
744
780
  }
781
+ function stripTrailingImplicitComma(children) {
782
+ const last = children[children.length - 1];
783
+ if (isComma(last) && last.implicit) {
784
+ return children.slice(0, -1);
785
+ } else {
786
+ return children;
787
+ }
788
+ }
745
789
  function insertTrimmingSpace(target, c) {
746
790
  if (!(target != null)) {
747
791
  return target;
@@ -914,8 +958,8 @@ function startsWithPredicate(node, predicate, skip = isWhitespaceOrEmpty) {
914
958
  return void 0;
915
959
  }
916
960
  if (Array.isArray(node)) {
917
- for (let i2 = 0, len22 = node.length; i2 < len22; i2++) {
918
- const child = node[i2];
961
+ for (let i3 = 0, len3 = node.length; i3 < len3; i3++) {
962
+ const child = node[i3];
919
963
  if (skip(child)) {
920
964
  continue;
921
965
  }
@@ -1002,6 +1046,9 @@ function makeLeftHandSideExpression(expression) {
1002
1046
  return expression;
1003
1047
  }
1004
1048
  }
1049
+ return parenthesizeExpression(expression);
1050
+ }
1051
+ function parenthesizeExpression(expression) {
1005
1052
  return makeNode({
1006
1053
  type: "ParenthesizedExpression",
1007
1054
  children: ["(", expression, ")"],
@@ -1017,8 +1064,8 @@ function updateParentPointers(node, parent, depth = 1) {
1017
1064
  return;
1018
1065
  }
1019
1066
  if (Array.isArray(node)) {
1020
- for (let i3 = 0, len3 = node.length; i3 < len3; i3++) {
1021
- const child = node[i3];
1067
+ for (let i4 = 0, len4 = node.length; i4 < len4; i4++) {
1068
+ const child = node[i4];
1022
1069
  updateParentPointers(child, parent, depth);
1023
1070
  }
1024
1071
  return;
@@ -1028,8 +1075,8 @@ function updateParentPointers(node, parent, depth = 1) {
1028
1075
  node.parent = parent;
1029
1076
  }
1030
1077
  if (depth && isParent(node)) {
1031
- for (let ref1 = node.children, i4 = 0, len4 = ref1.length; i4 < len4; i4++) {
1032
- const child = ref1[i4];
1078
+ for (let ref3 = node.children, i5 = 0, len5 = ref3.length; i5 < len5; i5++) {
1079
+ const child = ref3[i5];
1033
1080
  updateParentPointers(child, node, depth - 1);
1034
1081
  }
1035
1082
  }
@@ -1085,12 +1132,11 @@ function convertOptionalType(suffix) {
1085
1132
  ]);
1086
1133
  }
1087
1134
  var typeNeedsNoParens = /* @__PURE__ */ new Set([
1088
- "IdentifierType",
1135
+ "TypeIdentifier",
1089
1136
  "ImportType",
1090
- "LiteralType",
1137
+ "TypeLiteral",
1091
1138
  "TupleType",
1092
- "ParenthesizedType",
1093
- "UnaryType"
1139
+ "TypeParenthesized"
1094
1140
  ]);
1095
1141
  function parenthesizeType(type) {
1096
1142
  if (typeNeedsNoParens.has(type.type)) {
@@ -1160,8 +1206,8 @@ function wrapIIFE(expressions, asyncFlag, generator) {
1160
1206
  children.splice(1, 0, ".bind(this)");
1161
1207
  }
1162
1208
  if (gatherRecursiveWithinFunction(block, (a2) => typeof a2 === "object" && a2 != null && "token" in a2 && a2.token === "arguments").length) {
1163
- let ref2;
1164
- children[children.length - 1] = (ref2 = parameters.children)[ref2.length - 1] = "(arguments)";
1209
+ let ref4;
1210
+ children[children.length - 1] = (ref4 = parameters.children)[ref4.length - 1] = "(arguments)";
1165
1211
  }
1166
1212
  }
1167
1213
  const exp = makeNode({
@@ -1184,9 +1230,9 @@ function wrapWithReturn(expression) {
1184
1230
  }
1185
1231
  function flatJoin(array, separator) {
1186
1232
  const result = [];
1187
- for (let i5 = 0, len5 = array.length; i5 < len5; i5++) {
1188
- const i = i5;
1189
- const items = array[i5];
1233
+ for (let i6 = 0, len6 = array.length; i6 < len6; i6++) {
1234
+ const i = i6;
1235
+ const items = array[i6];
1190
1236
  if (i) {
1191
1237
  result.push(separator);
1192
1238
  }
@@ -1580,16 +1626,10 @@ function gatherBindingPatternTypeSuffix(pattern) {
1580
1626
 
1581
1627
  // source/parser/function.civet
1582
1628
  function isVoidType(t) {
1583
- return t?.type === "LiteralType" && t.t.type === "VoidType";
1629
+ return t?.type === "TypeLiteral" && t.t.type === "VoidType";
1584
1630
  }
1585
1631
  function isPromiseVoidType(t) {
1586
- return t?.type === "IdentifierType" && t.raw === "Promise" && t.args?.types?.length === 1 && isVoidType(t.args.types[0]);
1587
- }
1588
- function isGeneratorVoidType(t) {
1589
- return t?.type === "IdentifierType" && (t.raw === "Iterator" || t.raw === "Generator") && t.args?.types?.length >= 2 && isVoidType(t.args.types[1]);
1590
- }
1591
- function isAsyncGeneratorVoidType(t) {
1592
- return t?.type === "IdentifierType" && (t.raw === "AsyncIterator" || t.raw === "AsyncGenerator") && t.args?.types?.length >= 2 && isVoidType(t.args.types[1]);
1632
+ return t?.type === "TypeIdentifier" && t.raw === "Promise" && t.args?.types?.length === 1 && isVoidType(t.args.types[0]);
1593
1633
  }
1594
1634
  function implicitFunctionBlock(f) {
1595
1635
  if (f.abstract || f.block || f.signature?.optional)
@@ -1628,7 +1668,7 @@ function processReturn(f, implicitReturns) {
1628
1668
  const { async, generator, set } = modifier;
1629
1669
  const isMethod = f.type === "MethodDefinition";
1630
1670
  const isConstructor = isMethod && name === "constructor";
1631
- const isVoid = isVoidType(returnType2?.t) || async && (isPromiseVoidType(returnType2?.t) || generator && isAsyncGeneratorVoidType(returnType2?.t)) || !async && generator && isGeneratorVoidType(returnType2?.t);
1671
+ const isVoid = generator || isVoidType(returnType2?.t) || async && isPromiseVoidType(returnType2?.t);
1632
1672
  if (block?.type === "BlockStatement") {
1633
1673
  if (isVoid || set || isConstructor) {
1634
1674
  if (block.bare && block.implicitlyReturned) {
@@ -1644,10 +1684,7 @@ function processReturn(f, implicitReturns) {
1644
1684
  }
1645
1685
  function processReturnValue(func) {
1646
1686
  const { block } = func;
1647
- const values = gatherRecursiveWithinFunction(
1648
- block,
1649
- ({ type }) => type === "ReturnValue"
1650
- );
1687
+ const values = gatherRecursiveWithinFunction(block, ($) => $.type === "ReturnValue");
1651
1688
  if (!values.length) {
1652
1689
  return false;
1653
1690
  }
@@ -1657,7 +1694,7 @@ function processReturnValue(func) {
1657
1694
  value.children = [ref];
1658
1695
  const { ancestor, child } = findAncestor(
1659
1696
  value,
1660
- ({ type }) => type === "Declaration",
1697
+ ($1) => $1.type === "Declaration",
1661
1698
  isFunction
1662
1699
  );
1663
1700
  if (ancestor) {
@@ -1677,8 +1714,8 @@ function processReturnValue(func) {
1677
1714
  }
1678
1715
  }
1679
1716
  if (declaration) {
1680
- if (!(declaration.suffix != null)) {
1681
- declaration.children[1] = declaration.suffix = returnType;
1717
+ if (!(declaration.typeSuffix != null)) {
1718
+ declaration.children[1] = declaration.typeSuffix = returnType;
1682
1719
  }
1683
1720
  } else {
1684
1721
  block.expressions.unshift([
@@ -1787,14 +1824,13 @@ function assignResults(node, collect) {
1787
1824
  if (isExit(exp)) {
1788
1825
  return;
1789
1826
  }
1827
+ exp = exp;
1790
1828
  const outer = exp;
1791
- let { type } = exp;
1792
- if (type === "LabelledStatement") {
1829
+ if (exp.type === "LabelledStatement") {
1793
1830
  exp = exp.statement;
1794
- ({ type } = exp);
1795
1831
  }
1796
1832
  let ref4;
1797
- switch (type) {
1833
+ switch (exp.type) {
1798
1834
  case "BreakStatement":
1799
1835
  case "ContinueStatement":
1800
1836
  case "DebuggerStatement":
@@ -2019,7 +2055,7 @@ function processBreakContinueWith(statement) {
2019
2055
  let changed = false;
2020
2056
  for (const control of gatherRecursiveWithinFunction(
2021
2057
  statement.block,
2022
- ($) => $.type === "BreakStatement" || $.type === "ContinueStatement"
2058
+ ($2) => $2.type === "BreakStatement" || $2.type === "ContinueStatement"
2023
2059
  )) {
2024
2060
  let controlName2 = function() {
2025
2061
  switch (control.type) {
@@ -2054,7 +2090,7 @@ function processBreakContinueWith(statement) {
2054
2090
  )
2055
2091
  );
2056
2092
  updateParentPointers(control.with, control);
2057
- const i = control.children.findIndex(($1) => $1?.type === "Error");
2093
+ const i = control.children.findIndex(($3) => $3?.type === "Error");
2058
2094
  if (i >= 0) {
2059
2095
  control.children.splice(i, 1);
2060
2096
  }
@@ -2178,8 +2214,8 @@ function processSignature(f) {
2178
2214
  }
2179
2215
  if (hasYield(block) && !f.generator?.length) {
2180
2216
  if (f.type === "ArrowFunction") {
2181
- gatherRecursiveWithinFunction(block, ($2) => $2.type === "YieldExpression").forEach((y) => {
2182
- const i = y.children.findIndex(($3) => $3.type === "Yield");
2217
+ gatherRecursiveWithinFunction(block, ($4) => $4.type === "YieldExpression").forEach((y) => {
2218
+ const i = y.children.findIndex(($5) => $5.type === "Yield");
2183
2219
  return y.children.splice(i + 1, 0, {
2184
2220
  type: "Error",
2185
2221
  message: "Can't use yield inside of => arrow function"
@@ -2303,12 +2339,13 @@ function processCoffeeDo(ws, expression) {
2303
2339
  expression = {
2304
2340
  ...expression,
2305
2341
  parameters: newParameters,
2306
- children: expression.children.map(($4) => $4 === parameters ? newParameters : $4)
2342
+ children: expression.children.map(($6) => $6 === parameters ? newParameters : $6)
2307
2343
  };
2308
2344
  }
2309
2345
  return {
2310
2346
  type: "CallExpression",
2311
2347
  children: [
2348
+ ws,
2312
2349
  makeLeftHandSideExpression(expression),
2313
2350
  {
2314
2351
  type: "Call",
@@ -2324,7 +2361,7 @@ function makeAmpersandFunction(rhs) {
2324
2361
  ref = makeRef("$");
2325
2362
  inplacePrepend(ref, body);
2326
2363
  }
2327
- if (startsWithPredicate(body, ($5) => $5.type === "ObjectExpression")) {
2364
+ if (startsWithPredicate(body, ($7) => $7.type === "ObjectExpression")) {
2328
2365
  body = makeLeftHandSideExpression(body);
2329
2366
  }
2330
2367
  const parameters = makeNode({
@@ -3514,7 +3551,7 @@ function aliasBinding(p, ref) {
3514
3551
  function len2(arr, length) {
3515
3552
  return arr.length === length;
3516
3553
  }
3517
- function processAssignmentDeclaration(decl, pattern, suffix, ws, assign, e) {
3554
+ function processAssignmentDeclaration(decl, pattern, typeSuffix, ws, assign, e) {
3518
3555
  decl = {
3519
3556
  ...decl,
3520
3557
  $loc: {
@@ -3526,7 +3563,7 @@ function processAssignmentDeclaration(decl, pattern, suffix, ws, assign, e) {
3526
3563
  splices = splices.map((s) => [", ", s]);
3527
3564
  const thisAssignments = assignments.map((a) => ["", a, ";"]);
3528
3565
  if ("typeSuffix" in pattern) {
3529
- suffix ??= pattern.typeSuffix;
3566
+ typeSuffix ??= pattern.typeSuffix;
3530
3567
  }
3531
3568
  const initializer = makeNode({
3532
3569
  type: "Initializer",
@@ -3538,9 +3575,9 @@ function processAssignmentDeclaration(decl, pattern, suffix, ws, assign, e) {
3538
3575
  pattern,
3539
3576
  initializer,
3540
3577
  splices,
3541
- suffix,
3578
+ typeSuffix,
3542
3579
  thisAssignments,
3543
- children: [pattern, suffix, initializer]
3580
+ children: [pattern, typeSuffix, initializer]
3544
3581
  });
3545
3582
  const children = [decl, binding];
3546
3583
  return makeNode({
@@ -3557,9 +3594,9 @@ function processDeclarations(statements) {
3557
3594
  gatherRecursiveAll(statements, ($) => $.type === "Declaration").forEach((statement) => {
3558
3595
  const { bindings } = statement;
3559
3596
  return bindings?.forEach((binding) => {
3560
- const suffix = binding.suffix;
3561
- if (suffix && suffix.optional && suffix.t) {
3562
- convertOptionalType(suffix);
3597
+ const { typeSuffix } = binding;
3598
+ if (typeSuffix && typeSuffix.optional && typeSuffix.t) {
3599
+ convertOptionalType(typeSuffix);
3563
3600
  }
3564
3601
  const { initializer } = binding;
3565
3602
  if (initializer) {
@@ -3640,8 +3677,8 @@ function processDeclarationCondition(condition, rootCondition, parent) {
3640
3677
  }
3641
3678
  const { decl, bindings } = condition.declaration;
3642
3679
  const binding = bindings[0];
3643
- let { pattern, suffix, initializer } = binding;
3644
- const nullCheck = suffix?.optional && !suffix.t && !suffix.nonnull;
3680
+ let { pattern, typeSuffix, initializer } = binding;
3681
+ const nullCheck = typeSuffix?.optional && !typeSuffix.t && !typeSuffix.nonnull;
3645
3682
  if (!(initializer != null)) {
3646
3683
  condition.children = [
3647
3684
  {
@@ -3679,14 +3716,14 @@ function processDeclarationCondition(condition, rootCondition, parent) {
3679
3716
  if (nullCheck) {
3680
3717
  children.unshift("(");
3681
3718
  children.push(") != null");
3682
- suffix = void 0;
3719
+ typeSuffix = void 0;
3683
3720
  }
3684
3721
  Object.assign(condition, {
3685
3722
  type: "AssignmentExpression",
3686
3723
  children,
3687
3724
  hoistDec: !simple ? {
3688
3725
  type: "Declaration",
3689
- children: ["let ", ref, suffix],
3726
+ children: ["let ", ref, typeSuffix],
3690
3727
  names: []
3691
3728
  } : void 0,
3692
3729
  pattern,
@@ -3694,7 +3731,7 @@ function processDeclarationCondition(condition, rootCondition, parent) {
3694
3731
  });
3695
3732
  }
3696
3733
  updateParentPointers(condition, parent);
3697
- rootCondition.blockPrefix = getPatternBlockPrefix(pattern, ref, decl, suffix);
3734
+ rootCondition.blockPrefix = getPatternBlockPrefix(pattern, ref, decl, typeSuffix);
3698
3735
  }
3699
3736
  function processDeclarationConditions(node) {
3700
3737
  gatherRecursiveAll(
@@ -3796,9 +3833,6 @@ function processDeclarationConditionStatement(s) {
3796
3833
  }
3797
3834
  } else {
3798
3835
  const block = blockWithPrefix(blockPrefix, s.then);
3799
- if (block.bare && e && !block.semicolon) {
3800
- block.children.push(block.semicolon = ";");
3801
- }
3802
3836
  s.children = s.children.map(($2) => $2 === s.then ? block : $2);
3803
3837
  s.then = block;
3804
3838
  updateParentPointers(s);
@@ -4075,6 +4109,10 @@ function processUnaryExpression(pre, exp, post) {
4075
4109
  };
4076
4110
  pre = pre.slice(0, -1);
4077
4111
  } else {
4112
+ let m;
4113
+ 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)) {
4114
+ exp = parenthesizeExpression(exp);
4115
+ }
4078
4116
  exp = {
4079
4117
  type: "AwaitExpression",
4080
4118
  children: [...last.children, exp]
@@ -4090,6 +4128,77 @@ function processUnaryExpression(pre, exp, post) {
4090
4128
  children: [...pre, exp, post]
4091
4129
  };
4092
4130
  }
4131
+ function processUnaryNestedExpression(pre, args, post) {
4132
+ const isArray = args.type === "ArrayExpression";
4133
+ if (!isArray) {
4134
+ args = stripTrailingImplicitComma(args);
4135
+ }
4136
+ if (isArray || args.length > 2) {
4137
+ const last = pre[pre.length - 1];
4138
+ if (!(typeof last === "object" && last != null && "type" in last && last.type === "Await")) {
4139
+ return;
4140
+ }
4141
+ if (last.op) {
4142
+ if (!isArray) {
4143
+ args = {
4144
+ type: "ArrayExpression",
4145
+ children: ["[", args, "]"]
4146
+ };
4147
+ }
4148
+ } else {
4149
+ pre.pop();
4150
+ if (!isArray) {
4151
+ args = args;
4152
+ args = {
4153
+ type: "ArrayExpression",
4154
+ children: [
4155
+ "[",
4156
+ ...(() => {
4157
+ const results = [];
4158
+ for (let i = 0, len3 = args.length; i < len3; i++) {
4159
+ const arg = args[i];
4160
+ if (typeof arg === "object" && arg != null && "type" in arg && arg.type === "Argument") {
4161
+ const expression = processUnaryExpression([last], arg.expression);
4162
+ results.push({
4163
+ ...arg,
4164
+ expression,
4165
+ children: arg.children.map(($) => $ === arg.expression ? expression : $)
4166
+ });
4167
+ } else {
4168
+ results.push(arg);
4169
+ }
4170
+ }
4171
+ return results;
4172
+ })(),
4173
+ "]"
4174
+ ]
4175
+ };
4176
+ } else {
4177
+ args = trimFirstSpace(args);
4178
+ args = {
4179
+ ...args,
4180
+ children: args.children.map(
4181
+ (arg) => {
4182
+ if (typeof arg === "object" && arg != null && "type" in arg && arg.type === "ArrayElement" && "expression" in arg && "children" in arg) {
4183
+ const { type, expression: exp, children } = arg;
4184
+ let expression = processUnaryExpression([last], trimFirstSpace(exp));
4185
+ expression = prepend(getTrimmingSpace(exp), expression);
4186
+ return {
4187
+ ...arg,
4188
+ expression,
4189
+ children: children.map(($1) => $1 === exp ? expression : $1)
4190
+ };
4191
+ } else {
4192
+ return arg;
4193
+ }
4194
+ }
4195
+ )
4196
+ };
4197
+ }
4198
+ }
4199
+ }
4200
+ return processUnaryExpression(pre, args, post);
4201
+ }
4093
4202
 
4094
4203
  // source/parser/pipe.civet
4095
4204
  function constructInvocation(fn, arg) {
@@ -4127,36 +4236,31 @@ function constructInvocation(fn, arg) {
4127
4236
  };
4128
4237
  }
4129
4238
  function constructPipeStep(fn, arg, returning) {
4239
+ if (!returning) {
4240
+ returning = null;
4241
+ }
4130
4242
  let children = [[fn.leadingComment, fn.expr, fn.trailingComment].map(skipIfOnlyWS), " ", arg];
4131
4243
  switch (fn.expr.token) {
4132
- case "yield":
4133
- case "await":
4134
- if (fn.expr.op) {
4135
- children = processUnaryExpression([fn.expr], arg, void 0);
4136
- }
4137
- if (returning) {
4138
- return [
4139
- children,
4140
- returning
4141
- ];
4142
- }
4244
+ case "await": {
4245
+ children = processUnaryExpression([fn.expr], arg, void 0);
4246
+ }
4247
+ case "yield": {
4143
4248
  return [
4144
4249
  children,
4145
- null
4250
+ returning
4146
4251
  ];
4147
- case "return":
4252
+ }
4253
+ case "return": {
4148
4254
  return [{
4149
4255
  type: "ReturnStatement",
4150
4256
  children
4151
4257
  }, null];
4258
+ }
4152
4259
  }
4153
- if (returning) {
4154
- return [
4155
- constructInvocation(fn, arg),
4156
- returning
4157
- ];
4158
- }
4159
- return [constructInvocation(fn, arg), null];
4260
+ return [
4261
+ constructInvocation(fn, arg),
4262
+ returning
4263
+ ];
4160
4264
  }
4161
4265
  function processPipelineExpressions(statements) {
4162
4266
  gatherRecursiveAll(statements, (n) => n.type === "PipelineExpression").forEach((s) => {
@@ -4413,7 +4517,29 @@ function processForInOf($0, getRef) {
4413
4517
  message: "'own' is only meaningful in for..in loops"
4414
4518
  };
4415
4519
  }
4416
- if (!declaration2 && !own) {
4520
+ const { binding } = declaration;
4521
+ let pattern = binding?.pattern;
4522
+ if (binding?.typeSuffix || inOf.token === "in" && declaration2 && pattern.type !== "Identifier") {
4523
+ const itemRef = makeRef(inOf.token === "in" ? "key" : "item");
4524
+ blockPrefix.push(["", {
4525
+ type: "Declaration",
4526
+ children: [declaration, " = ", itemRef],
4527
+ names: declaration.names
4528
+ }, ";"]);
4529
+ pattern = itemRef;
4530
+ declaration = {
4531
+ type: "ForDeclaration",
4532
+ binding: {
4533
+ type: "Binding",
4534
+ pattern,
4535
+ children: [pattern],
4536
+ names: []
4537
+ },
4538
+ children: ["const ", itemRef],
4539
+ names: []
4540
+ };
4541
+ }
4542
+ if (!(declaration2 || own)) {
4417
4543
  return {
4418
4544
  declaration,
4419
4545
  blockPrefix,
@@ -4452,29 +4578,6 @@ function processForInOf($0, getRef) {
4452
4578
  children: [" ", expRef2, " =", exp]
4453
4579
  };
4454
4580
  }
4455
- const { binding } = declaration;
4456
- let { pattern } = binding;
4457
- if (!(pattern.type === "Identifier")) {
4458
- const keyRef = makeRef("key");
4459
- blockPrefix.push(["", [
4460
- declaration,
4461
- " = ",
4462
- keyRef
4463
- ], ";"]);
4464
- pattern = keyRef;
4465
- declaration = {
4466
- type: "ForDeclaration",
4467
- binding: {
4468
- type: "Binding",
4469
- pattern,
4470
- children: [pattern],
4471
- names: [],
4472
- suffix: binding.suffix
4473
- },
4474
- children: ["const ", keyRef],
4475
- names: []
4476
- };
4477
- }
4478
4581
  if (own) {
4479
4582
  const hasPropRef = getRef("hasProp");
4480
4583
  blockPrefix.push(["", ["if (!", hasPropRef, "(", insertTrimmingSpace(expRef2, ""), ", ", insertTrimmingSpace(pattern, ""), ")) continue"], ";"]);
@@ -4507,7 +4610,8 @@ var concatAssign = (lhs, rhs) => (rhs?.[Symbol.isConcatSpreadable] ?? Array.isAr
4507
4610
  function findDecs(statements) {
4508
4611
  const declarations = gatherNodes(statements, ($) => $.type === "Declaration");
4509
4612
  const declarationNames = declarations.flatMap((d) => d.names);
4510
- return new Set(declarationNames);
4613
+ const globals = getConfig().globals || [];
4614
+ return new Set(globals.concat(declarationNames));
4511
4615
  }
4512
4616
  function createConstLetDecs(statements, scopes, letOrConst) {
4513
4617
  function findVarDecs(statements2, decs) {
@@ -5359,7 +5463,7 @@ function expressionizeIfStatement(statement) {
5359
5463
  function expressionizeTypeIf([ifOp, condition, t, e]) {
5360
5464
  const children = [
5361
5465
  "(",
5362
- insertTrimmingSpace(condition, ""),
5466
+ trimFirstSpace(condition),
5363
5467
  "?"
5364
5468
  ];
5365
5469
  if (!xor(ifOp.negated, condition.negated)) {
@@ -5542,7 +5646,7 @@ function processCallMemberExpression(node) {
5542
5646
  [name, value] = [value, name];
5543
5647
  }
5544
5648
  if (!suppressPrefix) {
5545
- value = prefix.concat(insertTrimmingSpace(value, ""));
5649
+ value = prefix.concat(trimFirstSpace(value));
5546
5650
  }
5547
5651
  if (wValue)
5548
5652
  value.unshift(wValue);
@@ -5768,7 +5872,7 @@ function convertObjectToJSXAttributes(obj) {
5768
5872
  if (part.name.type === "ComputedPropertyName") {
5769
5873
  rest.push(part);
5770
5874
  } else {
5771
- parts.push([part.name, "={", insertTrimmingSpace(part.value, ""), "}"]);
5875
+ parts.push([part.name, "={", trimFirstSpace(part.value), "}"]);
5772
5876
  }
5773
5877
  break;
5774
5878
  case "SpreadProperty":
@@ -5793,7 +5897,7 @@ function convertObjectToJSXAttributes(obj) {
5793
5897
  }
5794
5898
  function makeGetterMethod(name, ws, value, returnType, block, kind = { token: "get" }, autoReturn = true) {
5795
5899
  const { token } = kind;
5796
- ws = insertTrimmingSpace(ws, "");
5900
+ ws = trimFirstSpace(ws);
5797
5901
  let setVal;
5798
5902
  const parameters = token === "get" ? {
5799
5903
  type: "Parameters",
@@ -6154,37 +6258,85 @@ function attachPostfixStatementAsExpression(exp, post) {
6154
6258
  }
6155
6259
  }
6156
6260
  function processTypes(node) {
6157
- return gatherRecursiveAll(node, (n) => n.type === "UnaryType").forEach((unary) => {
6158
- let last;
6159
- let count = 0;
6160
- let ref10;
6161
- while (unary.suffix.length && (ref10 = unary.suffix)[ref10.length - 1]?.token === "?") {
6162
- last = unary.suffix.pop();
6163
- count++;
6164
- }
6165
- if (!count) {
6261
+ return gatherRecursiveAll(node, (n) => n.type === "TypeUnary").forEach((unary) => {
6262
+ if (!unary.suffix.length) {
6166
6263
  return;
6167
6264
  }
6168
- if (unary.parent?.type === "TypeTuple") {
6169
- if (count === 1) {
6170
- unary.suffix.push(last);
6171
- return;
6265
+ let ref10;
6266
+ let m3;
6267
+ if (m3 = (ref10 = unary.suffix)[ref10.length - 1], typeof m3 === "object" && m3 != null && "token" in m3 && m3.token === "?") {
6268
+ const { token } = m3;
6269
+ let last;
6270
+ let count = 0;
6271
+ let ref11;
6272
+ while (unary.suffix.length && (ref11 = unary.suffix)[ref11.length - 1]?.token === "?") {
6273
+ last = unary.suffix.pop();
6274
+ count++;
6172
6275
  }
6173
- replaceNode(unary, [
6174
- getTrimmingSpace(unary),
6175
- "(",
6176
- parenthesizeType(insertTrimmingSpace(unary, "")),
6177
- " | null)",
6178
- last
6179
- ]);
6180
- } else {
6181
- replaceNode(unary, [
6182
- getTrimmingSpace(unary),
6183
- "(",
6184
- parenthesizeType(insertTrimmingSpace(unary, "")),
6185
- count === 1 ? " | undefined" : " | undefined | null",
6186
- ")"
6187
- ]);
6276
+ let ref12;
6277
+ while (unary.suffix.length && (ref12 = unary.suffix)[ref12.length - 1]?.type === "NonNullAssertion") {
6278
+ unary.suffix.pop();
6279
+ }
6280
+ let ref13;
6281
+ if (unary.suffix.length || unary.prefix.length)
6282
+ ref13 = unary;
6283
+ else
6284
+ ref13 = unary.t;
6285
+ const t = ref13;
6286
+ if (unary.parent?.type === "TypeTuple") {
6287
+ if (count === 1) {
6288
+ unary.suffix.push(last);
6289
+ return;
6290
+ }
6291
+ replaceNode(unary, [
6292
+ getTrimmingSpace(unary),
6293
+ "(",
6294
+ parenthesizeType(trimFirstSpace(t)),
6295
+ " | null)",
6296
+ last
6297
+ ]);
6298
+ } else {
6299
+ replaceNode(unary, {
6300
+ type: "TypeParenthesized",
6301
+ ts: true,
6302
+ children: [
6303
+ getTrimmingSpace(unary),
6304
+ "(",
6305
+ parenthesizeType(trimFirstSpace(t)),
6306
+ count === 1 ? " | undefined" : " | undefined | null",
6307
+ ")"
6308
+ ]
6309
+ });
6310
+ }
6311
+ } else if (typeof m3 === "object" && m3 != null && "type" in m3 && m3.type === "NonNullAssertion") {
6312
+ const { type } = m3;
6313
+ let ref14;
6314
+ while (unary.suffix.length && (ref14 = unary.suffix)[ref14.length - 1]?.type === "NonNullAssertion") {
6315
+ unary.suffix.pop();
6316
+ }
6317
+ let ref15;
6318
+ while (unary.suffix.length && (ref15 = unary.suffix)[ref15.length - 1]?.token === "?") {
6319
+ unary.suffix.pop();
6320
+ }
6321
+ const t = trimFirstSpace(
6322
+ unary.suffix.length || unary.prefix.length ? unary : unary.t
6323
+ );
6324
+ const args = {
6325
+ type: "TypeArguments",
6326
+ ts: true,
6327
+ types: [t],
6328
+ children: ["<", t, ">"]
6329
+ };
6330
+ replaceNode(unary, {
6331
+ type: "TypeIdentifier",
6332
+ raw: "NonNullable",
6333
+ args,
6334
+ children: [
6335
+ getTrimmingSpace(unary),
6336
+ "NonNullable",
6337
+ args
6338
+ ]
6339
+ });
6188
6340
  }
6189
6341
  });
6190
6342
  }
@@ -6192,11 +6344,11 @@ function processStatementExpressions(statements) {
6192
6344
  gatherRecursiveAll(statements, ($7) => $7.type === "StatementExpression").forEach((_exp) => {
6193
6345
  const exp = _exp;
6194
6346
  const { statement } = exp;
6195
- let ref11;
6347
+ let ref16;
6196
6348
  switch (statement.type) {
6197
6349
  case "IfStatement": {
6198
- if (ref11 = expressionizeIfStatement(statement)) {
6199
- const expression = ref11;
6350
+ if (ref16 = expressionizeIfStatement(statement)) {
6351
+ const expression = ref16;
6200
6352
  return replaceNode(statement, expression, exp);
6201
6353
  } else {
6202
6354
  return replaceNode(statement, wrapIIFE([["", statement]]), exp);
@@ -6342,10 +6494,10 @@ function processPlaceholders(statements) {
6342
6494
  if (type === "IfStatement") {
6343
6495
  liftedIfs.add(ancestor2);
6344
6496
  }
6345
- let m3;
6346
6497
  let m4;
6498
+ let m5;
6347
6499
  return type === "Call" || // Block, except for if/else blocks when condition already lifted
6348
- 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
6500
+ 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
6349
6501
  type === "Initializer" || // Right-hand side of assignment
6350
6502
  type === "AssignmentExpression" && findChildIndex(ancestor2, child2) === ancestor2.children.indexOf(ancestor2.expression) || type === "ReturnStatement" || type === "YieldExpression";
6351
6503
  }));
@@ -6424,8 +6576,8 @@ function processPlaceholders(statements) {
6424
6576
  for (let i4 = 0, len3 = placeholders.length; i4 < len3; i4++) {
6425
6577
  const placeholder = placeholders[i4];
6426
6578
  typeSuffix ??= placeholder.typeSuffix;
6427
- let ref12;
6428
- replaceNode((ref12 = placeholder.children)[ref12.length - 1], ref);
6579
+ let ref17;
6580
+ replaceNode((ref17 = placeholder.children)[ref17.length - 1], ref);
6429
6581
  }
6430
6582
  const { parent } = ancestor;
6431
6583
  const body = maybeUnwrap(ancestor);
@@ -6442,16 +6594,16 @@ function processPlaceholders(statements) {
6442
6594
  }
6443
6595
  case "PipelineExpression": {
6444
6596
  const i = findChildIndex(parent, ancestor);
6445
- let ref13;
6597
+ let ref18;
6446
6598
  if (i === 1) {
6447
- ref13 = ancestor === parent.children[i];
6599
+ ref18 = ancestor === parent.children[i];
6448
6600
  } else if (i === 2) {
6449
- ref13 = ancestor === parent.children[i][findChildIndex(parent.children[i], ancestor)][3];
6601
+ ref18 = ancestor === parent.children[i][findChildIndex(parent.children[i], ancestor)][3];
6450
6602
  } else {
6451
- ref13 = void 0;
6603
+ ref18 = void 0;
6452
6604
  }
6453
6605
  ;
6454
- outer = ref13;
6606
+ outer = ref18;
6455
6607
  break;
6456
6608
  }
6457
6609
  case "AssignmentExpression":
@@ -6466,9 +6618,9 @@ function processPlaceholders(statements) {
6466
6618
  fnExp = makeLeftHandSideExpression(fnExp);
6467
6619
  }
6468
6620
  replaceNode(ancestor, fnExp, parent);
6469
- let ref14;
6470
- if (ref14 = getTrimmingSpace(body)) {
6471
- const ws = ref14;
6621
+ let ref19;
6622
+ if (ref19 = getTrimmingSpace(body)) {
6623
+ const ws = ref19;
6472
6624
  inplaceInsertTrimmingSpace(body, "");
6473
6625
  inplacePrepend(ws, fnExp);
6474
6626
  }
@@ -6513,8 +6665,8 @@ function reorderBindingRestProperty(props) {
6513
6665
  }
6514
6666
  ];
6515
6667
  }
6516
- let ref15;
6517
- if (Array.isArray(rest.delim) && (ref15 = rest.delim)[ref15.length - 1]?.token === ",") {
6668
+ let ref20;
6669
+ if (Array.isArray(rest.delim) && (ref20 = rest.delim)[ref20.length - 1]?.token === ",") {
6518
6670
  rest.delim = rest.delim.slice(0, -1);
6519
6671
  rest.children = [...rest.children.slice(0, -1), rest.delim];
6520
6672
  }
@@ -6679,6 +6831,7 @@ var grammar = {
6679
6831
  NestedArgumentList,
6680
6832
  NestedArgument,
6681
6833
  SingleLineArgumentExpressions,
6834
+ WArgumentPart,
6682
6835
  ArgumentPart,
6683
6836
  NonPipelineArgumentPart,
6684
6837
  BinaryOpExpression,
@@ -6690,6 +6843,8 @@ var grammar = {
6690
6843
  UnaryExpression,
6691
6844
  UnaryWithoutParenthesizedAssignment,
6692
6845
  UnaryBody,
6846
+ MaybeNestedCoffeeDoBody,
6847
+ CoffeeDoBody,
6693
6848
  UnaryWithoutParenthesizedAssignmentBody,
6694
6849
  ParenthesizedAssignment,
6695
6850
  UnaryPostfix,
@@ -7022,6 +7177,7 @@ var grammar = {
7022
7177
  MaybeNestedNonPipelineExtendedExpression,
7023
7178
  MaybeNestedPostfixedExpression,
7024
7179
  MaybeNestedExtendedExpression,
7180
+ NestedExtendedExpression,
7025
7181
  MaybeParenNestedExtendedExpression,
7026
7182
  ImportDeclaration,
7027
7183
  ImpliedImport,
@@ -7278,6 +7434,7 @@ var grammar = {
7278
7434
  NamespaceDeclaration,
7279
7435
  OptionalEquals,
7280
7436
  TypeLexicalDeclaration,
7437
+ TypeLetOrConstDeclaration,
7281
7438
  TypeDeclarationBinding,
7282
7439
  InterfaceExtendsClause,
7283
7440
  InterfaceExtendsTarget,
@@ -7771,7 +7928,7 @@ var $R90 = (0, import_lib3.$R)(new RegExp("(extends|not|is)(?!\\p{ID_Continue}|[
7771
7928
  var $R91 = (0, import_lib3.$R)(new RegExp("#![^\\r\\n]*", "suy"));
7772
7929
  var $R92 = (0, import_lib3.$R)(new RegExp("[\\t ]*", "suy"));
7773
7930
  var $R93 = (0, import_lib3.$R)(new RegExp("[\\s]*", "suy"));
7774
- var $R94 = (0, import_lib3.$R)(new RegExp("\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?", "suy"));
7931
+ var $R94 = (0, import_lib3.$R)(new RegExp("\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([\\p{ID_Continue}.,+-]*))?", "suy"));
7775
7932
  var $R95 = (0, import_lib3.$R)(new RegExp("\\/\\/\\/[^\\r\\n]*", "suy"));
7776
7933
  var $R96 = (0, import_lib3.$R)(new RegExp("(?=[ \\t\\r\\n\\/#]|$)", "suy"));
7777
7934
  var $R97 = (0, import_lib3.$R)(new RegExp("\\r\\n|\\n|\\r|$", "suy"));
@@ -7962,9 +8119,7 @@ var ImplicitArguments$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(ApplicationSt
7962
8119
  var close = $5;
7963
8120
  if (skipImplicitArguments(args))
7964
8121
  return $skip;
7965
- let last = args[args.length - 1];
7966
- if (last?.token === "," && last.implicit)
7967
- args = args.slice(0, -1);
8122
+ args = stripTrailingImplicitComma(args);
7968
8123
  return {
7969
8124
  type: "Call",
7970
8125
  args,
@@ -8142,24 +8297,43 @@ var NestedArgument$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(Nested, SingleLi
8142
8297
  var args = $2;
8143
8298
  var comma = $3;
8144
8299
  let [arg0, ...rest] = args;
8145
- arg0 = [indent, ...arg0];
8300
+ arg0 = prepend(indent, arg0);
8146
8301
  return [arg0, ...rest, comma];
8147
8302
  });
8148
8303
  function NestedArgument(ctx, state2) {
8149
8304
  return (0, import_lib3.$EVENT)(ctx, state2, "NestedArgument", NestedArgument$0);
8150
8305
  }
8151
- 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) {
8306
+ 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) {
8152
8307
  return [$1, ...$2.flat()];
8153
8308
  });
8154
8309
  function SingleLineArgumentExpressions(ctx, state2) {
8155
8310
  return (0, import_lib3.$EVENT)(ctx, state2, "SingleLineArgumentExpressions", SingleLineArgumentExpressions$0);
8156
8311
  }
8157
- var ArgumentPart$0 = (0, import_lib3.$S)(DotDotDot, ExtendedExpression);
8312
+ var WArgumentPart$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)(_), ArgumentPart), function($skip, $loc, $0, $1, $2) {
8313
+ return prepend($1, $2);
8314
+ });
8315
+ function WArgumentPart(ctx, state2) {
8316
+ return (0, import_lib3.$EVENT)(ctx, state2, "WArgumentPart", WArgumentPart$0);
8317
+ }
8318
+ var ArgumentPart$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(DotDotDot, ExtendedExpression), function($skip, $loc, $0, $1, $2) {
8319
+ var spread = $1;
8320
+ var expression = $2;
8321
+ return {
8322
+ type: "Argument",
8323
+ children: $0,
8324
+ expression,
8325
+ spread
8326
+ };
8327
+ });
8158
8328
  var ArgumentPart$1 = (0, import_lib3.$TS)((0, import_lib3.$S)(ExtendedExpression, (0, import_lib3.$E)(DotDotDot)), function($skip, $loc, $0, $1, $2) {
8159
- if ($2) {
8160
- return [$2, $1];
8161
- }
8162
- return $1;
8329
+ var expression = $1;
8330
+ var spread = $2;
8331
+ return {
8332
+ type: "Argument",
8333
+ children: spread ? [spread, expression] : [expression],
8334
+ expression,
8335
+ spread
8336
+ };
8163
8337
  });
8164
8338
  var ArgumentPart$$ = [ArgumentPart$0, ArgumentPart$1];
8165
8339
  function ArgumentPart(ctx, state2) {
@@ -8247,17 +8421,18 @@ var RHS$$ = [RHS$0, RHS$1];
8247
8421
  function RHS(ctx, state2) {
8248
8422
  return (0, import_lib3.$EVENT_C)(ctx, state2, "RHS", RHS$$);
8249
8423
  }
8250
- 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) {
8424
+ 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) {
8425
+ var pre = $2;
8426
+ var args = $3;
8427
+ var post = $4;
8428
+ return processUnaryNestedExpression(pre, args, post) ?? $skip;
8429
+ });
8430
+ 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) {
8251
8431
  var pre = $1;
8252
8432
  var exp = $2;
8253
8433
  var post = $3;
8254
8434
  return processUnaryExpression(pre, exp, post);
8255
8435
  });
8256
- 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) {
8257
- var ws = $3;
8258
- var exp = $4;
8259
- return processCoffeeDo(ws, exp);
8260
- });
8261
8436
  var UnaryExpression$$ = [UnaryExpression$0, UnaryExpression$1];
8262
8437
  function UnaryExpression(ctx, state2) {
8263
8438
  return (0, import_lib3.$EVENT_C)(ctx, state2, "UnaryExpression", UnaryExpression$$);
@@ -8271,14 +8446,35 @@ var UnaryWithoutParenthesizedAssignment$0 = (0, import_lib3.$TS)((0, import_lib3
8271
8446
  function UnaryWithoutParenthesizedAssignment(ctx, state2) {
8272
8447
  return (0, import_lib3.$EVENT)(ctx, state2, "UnaryWithoutParenthesizedAssignment", UnaryWithoutParenthesizedAssignment$0);
8273
8448
  }
8274
- var UnaryBody$0 = ParenthesizedAssignment;
8275
- var UnaryBody$1 = ExpressionizedStatementWithTrailingCallExpressions;
8276
- var UnaryBody$2 = UpdateExpression;
8277
- var UnaryBody$3 = NestedNonAssignmentExtendedExpression;
8278
- var UnaryBody$$ = [UnaryBody$0, UnaryBody$1, UnaryBody$2, UnaryBody$3];
8449
+ var UnaryBody$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(CoffeeDoEnabled, Do, MaybeNestedCoffeeDoBody), function($skip, $loc, $0, $1, $2, $3) {
8450
+ var body = $3;
8451
+ return processCoffeeDo(...body);
8452
+ });
8453
+ var UnaryBody$1 = ParenthesizedAssignment;
8454
+ var UnaryBody$2 = ExpressionizedStatementWithTrailingCallExpressions;
8455
+ var UnaryBody$3 = UpdateExpression;
8456
+ var UnaryBody$4 = NestedNonAssignmentExtendedExpression;
8457
+ var UnaryBody$$ = [UnaryBody$0, UnaryBody$1, UnaryBody$2, UnaryBody$3, UnaryBody$4];
8279
8458
  function UnaryBody(ctx, state2) {
8280
8459
  return (0, import_lib3.$EVENT_C)(ctx, state2, "UnaryBody", UnaryBody$$);
8281
8460
  }
8461
+ 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) {
8462
+ if (!$2)
8463
+ return $skip;
8464
+ return $2;
8465
+ });
8466
+ var MaybeNestedCoffeeDoBody$1 = (0, import_lib3.$S)((0, import_lib3.$E)(_), CoffeeDoBody);
8467
+ var MaybeNestedCoffeeDoBody$$ = [MaybeNestedCoffeeDoBody$0, MaybeNestedCoffeeDoBody$1];
8468
+ function MaybeNestedCoffeeDoBody(ctx, state2) {
8469
+ return (0, import_lib3.$EVENT_C)(ctx, state2, "MaybeNestedCoffeeDoBody", MaybeNestedCoffeeDoBody$$);
8470
+ }
8471
+ var CoffeeDoBody$0 = ArrowFunction;
8472
+ var CoffeeDoBody$1 = (0, import_lib3.$S)(LeftHandSideExpression, (0, import_lib3.$N)((0, import_lib3.$S)(__, AssignmentOpSymbol)));
8473
+ var CoffeeDoBody$2 = ExtendedExpression;
8474
+ var CoffeeDoBody$$ = [CoffeeDoBody$0, CoffeeDoBody$1, CoffeeDoBody$2];
8475
+ function CoffeeDoBody(ctx, state2) {
8476
+ return (0, import_lib3.$EVENT_C)(ctx, state2, "CoffeeDoBody", CoffeeDoBody$$);
8477
+ }
8282
8478
  var UnaryWithoutParenthesizedAssignmentBody$0 = UpdateExpression;
8283
8479
  var UnaryWithoutParenthesizedAssignmentBody$1 = ExpressionizedStatementWithTrailingCallExpressions;
8284
8480
  var UnaryWithoutParenthesizedAssignmentBody$2 = NestedNonAssignmentExtendedExpression;
@@ -8477,7 +8673,7 @@ var ArrowFunction$0 = ThinArrowFunction;
8477
8673
  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) {
8478
8674
  var async = $1;
8479
8675
  var parameters = $2;
8480
- var suffix = $3;
8676
+ var returnType = $3;
8481
8677
  var arrow = $4;
8482
8678
  var expOrBlock = $5;
8483
8679
  if (!async)
@@ -8488,13 +8684,13 @@ var ArrowFunction$1 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$
8488
8684
  modifier: {
8489
8685
  async: !!async.length
8490
8686
  },
8491
- returnType: suffix
8687
+ returnType
8492
8688
  },
8493
8689
  parameters,
8494
- returnType: suffix,
8690
+ returnType,
8495
8691
  async,
8496
8692
  block: expOrBlock,
8497
- children: [async, parameters, suffix, arrow, expOrBlock]
8693
+ children: [async, parameters, returnType, arrow, expOrBlock]
8498
8694
  };
8499
8695
  });
8500
8696
  var ArrowFunction$$ = [ArrowFunction$0, ArrowFunction$1];
@@ -10226,7 +10422,7 @@ var FunctionSignature$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_li
10226
10422
  var wid = $4;
10227
10423
  var w = $5;
10228
10424
  var parameters = $6;
10229
- var suffix = $7;
10425
+ var returnType = $7;
10230
10426
  if (!async)
10231
10427
  async = [];
10232
10428
  if (!generator)
@@ -10237,7 +10433,7 @@ var FunctionSignature$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_li
10237
10433
  id,
10238
10434
  name: id?.name,
10239
10435
  parameters,
10240
- returnType: suffix,
10436
+ returnType,
10241
10437
  async,
10242
10438
  generator,
10243
10439
  modifier: {
@@ -10245,7 +10441,7 @@ var FunctionSignature$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_li
10245
10441
  generator: !!generator.length
10246
10442
  },
10247
10443
  block: null,
10248
- children: !parameters.implicit ? [async, func, generator, wid, w, parameters, suffix] : [async, func, generator, wid, parameters, w, suffix]
10444
+ children: !parameters.implicit ? [async, func, generator, wid, w, parameters, returnType] : [async, func, generator, wid, parameters, w, returnType]
10249
10445
  // move whitespace w to after implicit () in parameters
10250
10446
  };
10251
10447
  });
@@ -10444,7 +10640,7 @@ var OperatorSignature$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_li
10444
10640
  var behavior = $7;
10445
10641
  var w2 = $8;
10446
10642
  var parameters = $9;
10447
- var suffix = $10;
10643
+ var returnType = $10;
10448
10644
  if (!async)
10449
10645
  async = [];
10450
10646
  if (!generator)
@@ -10459,7 +10655,7 @@ var OperatorSignature$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_li
10459
10655
  id,
10460
10656
  name: id.name,
10461
10657
  parameters,
10462
- returnType: suffix,
10658
+ returnType,
10463
10659
  async,
10464
10660
  generator,
10465
10661
  modifier: {
@@ -10467,7 +10663,7 @@ var OperatorSignature$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_li
10467
10663
  generator: !!generator.length
10468
10664
  },
10469
10665
  block: null,
10470
- children: [async, func, generator, w1, id, w2, parameters, suffix],
10666
+ children: [async, func, generator, w1, id, w2, parameters, returnType],
10471
10667
  behavior
10472
10668
  };
10473
10669
  });
@@ -10514,7 +10710,7 @@ function OperatorAssociativity(ctx, state2) {
10514
10710
  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) {
10515
10711
  var async = $1;
10516
10712
  var parameters = $2;
10517
- var suffix = $3;
10713
+ var returnType = $3;
10518
10714
  var arrow = $5;
10519
10715
  var block = $6;
10520
10716
  if (!async)
@@ -10524,7 +10720,7 @@ var ThinArrowFunction$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_li
10524
10720
  type: "FunctionExpression",
10525
10721
  id: void 0,
10526
10722
  parameters,
10527
- returnType: suffix,
10723
+ returnType,
10528
10724
  async,
10529
10725
  generator,
10530
10726
  block,
@@ -10536,14 +10732,14 @@ var ThinArrowFunction$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_li
10536
10732
  async: !!async.length,
10537
10733
  generator: !!generator.length
10538
10734
  },
10539
- returnType: suffix
10735
+ returnType
10540
10736
  },
10541
10737
  children: [
10542
10738
  async,
10543
10739
  { $loc: arrow.$loc, token: "function" },
10544
10740
  generator,
10545
10741
  parameters,
10546
- suffix,
10742
+ returnType,
10547
10743
  block
10548
10744
  ]
10549
10745
  };
@@ -11240,6 +11436,7 @@ var ArrayElementExpression$2 = (0, import_lib3.$TS)((0, import_lib3.$S)(Extended
11240
11436
  return {
11241
11437
  type: "SpreadElement",
11242
11438
  children: [ws, dots, exp],
11439
+ expression: exp,
11243
11440
  names: exp.names
11244
11441
  };
11245
11442
  });
@@ -11251,12 +11448,14 @@ var ArrayElementExpression$3 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, impo
11251
11448
  return {
11252
11449
  type: "ArrayElement",
11253
11450
  children: [exp],
11451
+ expression: exp,
11254
11452
  names: exp.names
11255
11453
  };
11256
11454
  } else {
11257
11455
  return {
11258
11456
  type: "SpreadElement",
11259
11457
  children: [...spread, exp],
11458
+ expression: exp,
11260
11459
  names: exp.names
11261
11460
  };
11262
11461
  }
@@ -11300,9 +11499,9 @@ var BulletedArray$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(InsertOpenBracket
11300
11499
  // replace first space with bracket
11301
11500
  ...content[1].flat()
11302
11501
  ];
11303
- const last = content[content.length - 1];
11502
+ let last = content[content.length - 1];
11304
11503
  if (last.children?.at(-1)?.implicit) {
11305
- last.children = last.children.slice(0, -1);
11504
+ content[content.length - 1] = last = { ...last, children: last.children.slice(0, -1) };
11306
11505
  }
11307
11506
  return {
11308
11507
  type: "ArrayExpression",
@@ -12708,6 +12907,14 @@ var IfStatement$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$C)
12708
12907
  kind = { ...kind, token: "if" };
12709
12908
  condition = negateCondition(condition);
12710
12909
  }
12910
+ if (block.bare && e) {
12911
+ const semicolon = ";";
12912
+ block = {
12913
+ ...block,
12914
+ semicolon,
12915
+ children: [...block.children, semicolon]
12916
+ };
12917
+ }
12711
12918
  return {
12712
12919
  type: "IfStatement",
12713
12920
  children: [kind, ws, condition, block, e],
@@ -12721,6 +12928,13 @@ var IfStatement$1 = (0, import_lib3.$TS)((0, import_lib3.$S)(IfClause, BlockOrEm
12721
12928
  var clause = $1;
12722
12929
  var block = $2;
12723
12930
  var e = $3;
12931
+ if (block.bare && e) {
12932
+ block = {
12933
+ ...block,
12934
+ semicolon: ";",
12935
+ children: [...block.children, ";"]
12936
+ };
12937
+ }
12724
12938
  return {
12725
12939
  type: "IfStatement",
12726
12940
  children: [...clause.children, block, e],
@@ -13177,14 +13391,14 @@ function ForDeclaration(ctx, state2) {
13177
13391
  }
13178
13392
  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) {
13179
13393
  var pattern = $1;
13180
- var suffix = $2;
13181
- suffix ??= pattern.typeSuffix;
13394
+ var typeSuffix = $2;
13395
+ typeSuffix ??= pattern.typeSuffix;
13182
13396
  return {
13183
13397
  type: "Binding",
13184
- children: [pattern, suffix],
13398
+ children: [pattern, typeSuffix],
13185
13399
  names: pattern.names,
13186
13400
  pattern,
13187
- suffix,
13401
+ typeSuffix,
13188
13402
  splices: [],
13189
13403
  thisAssignments: []
13190
13404
  };
@@ -13821,6 +14035,16 @@ var MaybeNestedExtendedExpression$$ = [MaybeNestedExtendedExpression$0, MaybeNes
13821
14035
  function MaybeNestedExtendedExpression(ctx, state2) {
13822
14036
  return (0, import_lib3.$EVENT_C)(ctx, state2, "MaybeNestedExtendedExpression", MaybeNestedExtendedExpression$$);
13823
14037
  }
14038
+ var NestedExtendedExpression$0 = NestedBulletedArray;
14039
+ 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) {
14040
+ if ($3)
14041
+ return $3;
14042
+ return $skip;
14043
+ });
14044
+ var NestedExtendedExpression$$ = [NestedExtendedExpression$0, NestedExtendedExpression$1];
14045
+ function NestedExtendedExpression(ctx, state2) {
14046
+ return (0, import_lib3.$EVENT_C)(ctx, state2, "NestedExtendedExpression", NestedExtendedExpression$$);
14047
+ }
13824
14048
  var MaybeParenNestedExtendedExpression$0 = (0, import_lib3.$T)((0, import_lib3.$S)((0, import_lib3.$N)(EOS), ExtendedExpression), function(value) {
13825
14049
  return value[1];
13826
14050
  });
@@ -14315,16 +14539,16 @@ function TypeAssignment(ctx, state2) {
14315
14539
  }
14316
14540
  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) {
14317
14541
  var pattern = $1;
14318
- var suffix = $2;
14542
+ var typeSuffix = $2;
14319
14543
  var initializer = $3;
14320
14544
  const [splices, thisAssignments] = gatherBindingCode(pattern);
14321
- suffix ??= pattern.typeSuffix;
14545
+ typeSuffix ??= pattern.typeSuffix;
14322
14546
  return {
14323
14547
  type: "Binding",
14324
- children: [pattern, suffix, initializer],
14548
+ children: [pattern, typeSuffix, initializer],
14325
14549
  names: pattern.names,
14326
14550
  pattern,
14327
- suffix,
14551
+ typeSuffix,
14328
14552
  initializer,
14329
14553
  splices: splices.map((s) => [",", s]),
14330
14554
  thisAssignments: thisAssignments.map((s) => ["", s, ";"])
@@ -14332,14 +14556,14 @@ var LexicalBinding$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(BindingPattern,
14332
14556
  });
14333
14557
  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) {
14334
14558
  var pattern = $1;
14335
- var suffix = $2;
14559
+ var typeSuffix = $2;
14336
14560
  var initializer = $3;
14337
14561
  return {
14338
14562
  type: "Binding",
14339
14563
  children: $0,
14340
14564
  names: pattern.names,
14341
14565
  pattern,
14342
- suffix,
14566
+ typeSuffix,
14343
14567
  initializer,
14344
14568
  splices: [],
14345
14569
  thisAssignments: []
@@ -16284,14 +16508,14 @@ function UsingDeclaration(ctx, state2) {
16284
16508
  }
16285
16509
  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) {
16286
16510
  var pattern = $1;
16287
- var suffix = $2;
16511
+ var typeSuffix = $2;
16288
16512
  var initializer = $3;
16289
16513
  return {
16290
16514
  type: "Binding",
16291
16515
  children: $0,
16292
16516
  names: pattern.names,
16293
16517
  pattern,
16294
- suffix,
16518
+ typeSuffix,
16295
16519
  initializer,
16296
16520
  splices: [],
16297
16521
  thisAssignments: []
@@ -16397,7 +16621,17 @@ var OptionalEquals$$ = [OptionalEquals$0, OptionalEquals$1];
16397
16621
  function OptionalEquals(ctx, state2) {
16398
16622
  return (0, import_lib3.$EVENT_C)(ctx, state2, "OptionalEquals", OptionalEquals$$);
16399
16623
  }
16400
- var TypeLexicalDeclaration$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(__, LetOrConstOrVar, TypeDeclarationBinding, (0, import_lib3.$Q)((0, import_lib3.$S)(CommaDelimiter, __, TypeDeclarationBinding))), function($skip, $loc, $0, $1, $2, $3, $4) {
16624
+ var TypeLexicalDeclaration$0 = TypeLetOrConstDeclaration;
16625
+ var TypeLexicalDeclaration$1 = (0, import_lib3.$S)(__, EnumDeclaration);
16626
+ var TypeLexicalDeclaration$2 = ClassSignature;
16627
+ var TypeLexicalDeclaration$3 = (0, import_lib3.$S)(Namespace, (0, import_lib3.$E)(_), IdentifierName, DeclareBlock);
16628
+ var TypeLexicalDeclaration$4 = (0, import_lib3.$S)(Module, _, StringLiteral, (0, import_lib3.$E)(DeclareBlock));
16629
+ var TypeLexicalDeclaration$5 = (0, import_lib3.$S)(Global, (0, import_lib3.$E)(DeclareBlock));
16630
+ var TypeLexicalDeclaration$$ = [TypeLexicalDeclaration$0, TypeLexicalDeclaration$1, TypeLexicalDeclaration$2, TypeLexicalDeclaration$3, TypeLexicalDeclaration$4, TypeLexicalDeclaration$5];
16631
+ function TypeLexicalDeclaration(ctx, state2) {
16632
+ return (0, import_lib3.$EVENT_C)(ctx, state2, "TypeLexicalDeclaration", TypeLexicalDeclaration$$);
16633
+ }
16634
+ var TypeLetOrConstDeclaration$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(__, LetOrConstOrVar, TypeDeclarationBinding, (0, import_lib3.$Q)((0, import_lib3.$S)(CommaDelimiter, __, TypeDeclarationBinding))), function($skip, $loc, $0, $1, $2, $3, $4) {
16401
16635
  var first = $3;
16402
16636
  var rest = $4;
16403
16637
  const names = first.names.concat(...rest.map((b) => b[2].names));
@@ -16408,14 +16642,8 @@ var TypeLexicalDeclaration$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(__, LetO
16408
16642
  names
16409
16643
  };
16410
16644
  });
16411
- var TypeLexicalDeclaration$1 = (0, import_lib3.$S)(__, EnumDeclaration);
16412
- var TypeLexicalDeclaration$2 = ClassSignature;
16413
- var TypeLexicalDeclaration$3 = (0, import_lib3.$S)(Namespace, (0, import_lib3.$E)(_), IdentifierName, DeclareBlock);
16414
- var TypeLexicalDeclaration$4 = (0, import_lib3.$S)(Module, _, StringLiteral, (0, import_lib3.$E)(DeclareBlock));
16415
- var TypeLexicalDeclaration$5 = (0, import_lib3.$S)(Global, (0, import_lib3.$E)(DeclareBlock));
16416
- var TypeLexicalDeclaration$$ = [TypeLexicalDeclaration$0, TypeLexicalDeclaration$1, TypeLexicalDeclaration$2, TypeLexicalDeclaration$3, TypeLexicalDeclaration$4, TypeLexicalDeclaration$5];
16417
- function TypeLexicalDeclaration(ctx, state2) {
16418
- return (0, import_lib3.$EVENT_C)(ctx, state2, "TypeLexicalDeclaration", TypeLexicalDeclaration$$);
16645
+ function TypeLetOrConstDeclaration(ctx, state2) {
16646
+ return (0, import_lib3.$EVENT)(ctx, state2, "TypeLetOrConstDeclaration", TypeLetOrConstDeclaration$0);
16419
16647
  }
16420
16648
  var TypeDeclarationBinding$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) {
16421
16649
  return {
@@ -16559,13 +16787,14 @@ var NestedDeclareElement$0 = (0, import_lib3.$S)(Nested, DeclareElement, Interfa
16559
16787
  function NestedDeclareElement(ctx, state2) {
16560
16788
  return (0, import_lib3.$EVENT)(ctx, state2, "NestedDeclareElement", NestedDeclareElement$0);
16561
16789
  }
16562
- var DeclareElement$0 = (0, import_lib3.$T)((0, import_lib3.$S)((0, import_lib3.$E)(Decorators), (0, import_lib3.$E)((0, import_lib3.$S)(Export, (0, import_lib3.$E)(_))), TypeLexicalDeclaration), function(value) {
16790
+ var DeclareElement$0 = (0, import_lib3.$S)((0, import_lib3.$E)(Decorators), Export, __, Default, __, (0, import_lib3.$C)(Identifier, ClassSignature, InterfaceDeclaration));
16791
+ var DeclareElement$1 = (0, import_lib3.$T)((0, import_lib3.$S)((0, import_lib3.$E)(Decorators), (0, import_lib3.$E)((0, import_lib3.$S)(Export, (0, import_lib3.$E)(_))), TypeLexicalDeclaration), function(value) {
16563
16792
  return { "ts": true, "children": value };
16564
16793
  });
16565
- var DeclareElement$1 = (0, import_lib3.$T)((0, import_lib3.$S)((0, import_lib3.$E)((0, import_lib3.$S)(Export, (0, import_lib3.$E)(_))), TypeDeclarationRest), function(value) {
16794
+ var DeclareElement$2 = (0, import_lib3.$T)((0, import_lib3.$S)((0, import_lib3.$E)((0, import_lib3.$S)(Export, (0, import_lib3.$E)(_))), TypeDeclarationRest), function(value) {
16566
16795
  return { "ts": true, "children": value };
16567
16796
  });
16568
- var DeclareElement$$ = [DeclareElement$0, DeclareElement$1];
16797
+ var DeclareElement$$ = [DeclareElement$0, DeclareElement$1, DeclareElement$2];
16569
16798
  function DeclareElement(ctx, state2) {
16570
16799
  return (0, import_lib3.$EVENT_C)(ctx, state2, "DeclareElement", DeclareElement$$);
16571
16800
  }
@@ -16835,7 +17064,7 @@ var TypeUnary$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$Q)((
16835
17064
  if (!prefix.length && !suffix.length)
16836
17065
  return t;
16837
17066
  return {
16838
- type: "UnaryType",
17067
+ type: "TypeUnary",
16839
17068
  prefix,
16840
17069
  suffix,
16841
17070
  t,
@@ -16848,7 +17077,8 @@ function TypeUnary(ctx, state2) {
16848
17077
  }
16849
17078
  var TypeUnarySuffix$0 = TypeIndexedAccess;
16850
17079
  var TypeUnarySuffix$1 = QuestionMark;
16851
- var TypeUnarySuffix$$ = [TypeUnarySuffix$0, TypeUnarySuffix$1];
17080
+ var TypeUnarySuffix$2 = NonNullAssertion;
17081
+ var TypeUnarySuffix$$ = [TypeUnarySuffix$0, TypeUnarySuffix$1, TypeUnarySuffix$2];
16852
17082
  function TypeUnarySuffix(ctx, state2) {
16853
17083
  return (0, import_lib3.$EVENT_C)(ctx, state2, "TypeUnarySuffix", TypeUnarySuffix$$);
16854
17084
  }
@@ -16913,14 +17143,14 @@ var TypePrimary$6 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)
16913
17143
  var TypePrimary$7 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)(_), TypeLiteral), function($skip, $loc, $0, $1, $2) {
16914
17144
  var t = $2;
16915
17145
  return {
16916
- type: "LiteralType",
17146
+ type: "TypeLiteral",
16917
17147
  t,
16918
17148
  children: $0
16919
17149
  };
16920
17150
  });
16921
17151
  var TypePrimary$8 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)(_), UnknownAlias), function($skip, $loc, $0, $1, $2) {
16922
17152
  return {
16923
- type: "IdentifierType",
17153
+ type: "TypeIdentifier",
16924
17154
  children: $0,
16925
17155
  raw: $2.token,
16926
17156
  args: void 0
@@ -16929,7 +17159,7 @@ var TypePrimary$8 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)
16929
17159
  var TypePrimary$9 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)(_), Identifier, (0, import_lib3.$Q)((0, import_lib3.$S)(Dot, IdentifierName)), (0, import_lib3.$E)((0, import_lib3.$C)(TypeArguments, ImplicitTypeArguments))), function($skip, $loc, $0, $1, $2, $3, $4) {
16930
17160
  var args = $4;
16931
17161
  return {
16932
- type: "IdentifierType",
17162
+ type: "TypeIdentifier",
16933
17163
  children: $0,
16934
17164
  raw: [$2.name, ...$3.map(([dot, id]) => dot.token + id.name)].join(""),
16935
17165
  args
@@ -16939,7 +17169,7 @@ var TypePrimary$10 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E
16939
17169
  if (!$4)
16940
17170
  return $skip;
16941
17171
  return {
16942
- type: "ParenthesizedType",
17172
+ type: "TypeParenthesized",
16943
17173
  children: [$1, $2, $4, $6, $7]
16944
17174
  // omit AllowAll/RestoreAll
16945
17175
  };
@@ -17305,16 +17535,20 @@ function TypeBinaryOp(ctx, state2) {
17305
17535
  }
17306
17536
  var TypeFunction$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)((0, import_lib3.$S)(Abstract, (0, import_lib3.$E)(_))), (0, import_lib3.$E)((0, import_lib3.$S)(New, (0, import_lib3.$E)(_))), Parameters, __, TypeArrowFunction, (0, import_lib3.$E)(ReturnType)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
17307
17537
  var type = $6;
17308
- const ret = [...$0];
17538
+ const children = [...$0];
17309
17539
  if ($1 && !$2) {
17310
- ret[1] = {
17540
+ children[1] = {
17311
17541
  type: "Error",
17312
17542
  message: "abstract function types must be constructors (abstract new)"
17313
17543
  };
17314
17544
  }
17315
17545
  if (!type)
17316
- ret.push("void");
17317
- return ret;
17546
+ children.push("void");
17547
+ return {
17548
+ type: "TypeFunction",
17549
+ children,
17550
+ ts: true
17551
+ };
17318
17552
  });
17319
17553
  function TypeFunction(ctx, state2) {
17320
17554
  return (0, import_lib3.$EVENT)(ctx, state2, "TypeFunction", TypeFunction$0);
@@ -17496,17 +17730,22 @@ var CivetPrologueContent$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import
17496
17730
  function CivetPrologueContent(ctx, state2) {
17497
17731
  return (0, import_lib3.$EVENT)(ctx, state2, "CivetPrologueContent", CivetPrologueContent$0);
17498
17732
  }
17499
- var CivetOption$0 = (0, import_lib3.$TR)((0, import_lib3.$EXPECT)($R94, "CivetOption /\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
17733
+ var CivetOption$0 = (0, import_lib3.$TR)((0, import_lib3.$EXPECT)($R94, "CivetOption /\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([\\p{ID_Continue}.,+-]*))?/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
17500
17734
  const optionName = $2.replace(/-+([a-z]?)/g, (_2, l) => {
17501
17735
  if (l)
17502
17736
  return l.toUpperCase();
17503
17737
  return "";
17504
17738
  });
17505
17739
  let value = $3 ? $4 : $1 === "-" ? false : true;
17506
- if (optionName === "tab") {
17507
- value = parseFloat(value);
17508
- if (isNaN(value))
17509
- value = 0;
17740
+ switch (optionName) {
17741
+ case "tab":
17742
+ value = parseFloat(value);
17743
+ if (isNaN(value))
17744
+ value = 0;
17745
+ break;
17746
+ case "globals":
17747
+ value = value.split(",").filter(Boolean);
17748
+ break;
17510
17749
  }
17511
17750
  return [optionName, value];
17512
17751
  });
@@ -17859,6 +18098,7 @@ var Reset$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0, 'Reset ""'), fu
17859
18098
  coffeeOf: false,
17860
18099
  coffeePrototype: false,
17861
18100
  defaultElement: "div",
18101
+ globals: [],
17862
18102
  implicitReturns: true,
17863
18103
  jsxCode: false,
17864
18104
  objectIs: false,