@danielx/civet 0.11.1 → 0.11.2

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
@@ -1091,6 +1091,60 @@ function literalType(literal) {
1091
1091
  children: [t]
1092
1092
  };
1093
1093
  }
1094
+ function typeOfExpression(expression) {
1095
+ let t;
1096
+ if (!isASTNodeObject(expression)) {
1097
+ return;
1098
+ }
1099
+ switch (expression.type) {
1100
+ case "Literal": {
1101
+ switch (expression.subtype) {
1102
+ case "NullLiteral": {
1103
+ return;
1104
+ }
1105
+ default: {
1106
+ t = literalType(expression);
1107
+ }
1108
+ }
1109
+ ;
1110
+ break;
1111
+ }
1112
+ case "RegularExpressionLiteral":
1113
+ case "TemplateLiteral": {
1114
+ t = literalType(expression);
1115
+ break;
1116
+ }
1117
+ case "Identifier": {
1118
+ if (expression.name === "undefined") {
1119
+ return;
1120
+ }
1121
+ }
1122
+ case "MemberExpression": {
1123
+ t = {
1124
+ type: "TypeTypeof",
1125
+ children: ["typeof ", expression],
1126
+ expression
1127
+ };
1128
+ break;
1129
+ }
1130
+ default: {
1131
+ return;
1132
+ }
1133
+ }
1134
+ return t;
1135
+ }
1136
+ function typeSuffixForExpression(expression) {
1137
+ const t = typeOfExpression(expression);
1138
+ if (!(t != null)) {
1139
+ return;
1140
+ }
1141
+ return {
1142
+ type: "TypeSuffix",
1143
+ ts: true,
1144
+ t,
1145
+ children: [": ", t]
1146
+ };
1147
+ }
1094
1148
  function makeNumericLiteral(n) {
1095
1149
  const s = n.toString();
1096
1150
  return {
@@ -1968,11 +2022,14 @@ function gatherBindingPatternTypeSuffix(pattern) {
1968
2022
  const results1 = [];
1969
2023
  for (let ref7 = pattern.elements, i7 = 0, len6 = ref7.length; i7 < len6; i7++) {
1970
2024
  const elem = ref7[i7];
1971
- let { typeSuffix } = elem;
2025
+ let { typeSuffix, initializer } = elem;
1972
2026
  typeSuffix ??= elem.binding?.typeSuffix;
1973
2027
  if (typeSuffix) {
1974
2028
  count++;
1975
2029
  }
2030
+ if (initializer != null) {
2031
+ typeSuffix ??= typeSuffixForExpression(trimFirstSpace(initializer.expression));
2032
+ }
1976
2033
  let typeElement = [typeSuffix?.t, elem.delim];
1977
2034
  if (typeSuffix?.optional) {
1978
2035
  typeElement[0] = parenthesizeType(typeElement[0]);
@@ -2007,11 +2064,14 @@ function gatherBindingPatternTypeSuffix(pattern) {
2007
2064
  const results2 = [];
2008
2065
  for (let ref8 = pattern.properties, i8 = 0, len7 = ref8.length; i8 < len7; i8++) {
2009
2066
  const prop = ref8[i8];
2010
- let { typeSuffix } = prop;
2067
+ let { typeSuffix, initializer } = prop;
2011
2068
  typeSuffix ??= prop.value?.typeSuffix;
2012
2069
  if (typeSuffix) {
2013
2070
  count++;
2014
2071
  }
2072
+ if (initializer != null) {
2073
+ typeSuffix ??= typeSuffixForExpression(trimFirstSpace(initializer.expression));
2074
+ }
2015
2075
  typeSuffix ??= {
2016
2076
  type: "TypeSuffix",
2017
2077
  ts: true,
@@ -3112,19 +3172,23 @@ function patternBindings(pattern) {
3112
3172
  function assignResults(node, collect) {
3113
3173
  if (!node) return;
3114
3174
  switch (node.type) {
3115
- case "BlockStatement":
3175
+ case "BlockStatement": {
3116
3176
  if (node.expressions.length) {
3117
3177
  let ref5;
3118
3178
  assignResults((ref5 = node.expressions)[ref5.length - 1], collect);
3119
3179
  } else {
3120
3180
  node.expressions.push(["", collect("void 0"), ";"]);
3181
+ updateParentPointers(node);
3121
3182
  }
3122
3183
  return;
3123
- case "CaseBlock":
3124
- node.clauses.forEach((clause) => {
3125
- return assignResults(clause, collect);
3126
- });
3184
+ }
3185
+ case "CaseBlock": {
3186
+ for (let ref6 = node.clauses, i4 = 0, len3 = ref6.length; i4 < len3; i4++) {
3187
+ const clause = ref6[i4];
3188
+ assignResults(clause, collect);
3189
+ }
3127
3190
  return;
3191
+ }
3128
3192
  case "WhenClause":
3129
3193
  case "DefaultClause":
3130
3194
  case "PatternClause": {
@@ -3150,7 +3214,8 @@ function assignResults(node, collect) {
3150
3214
  if (exp.type === "LabelledStatement") {
3151
3215
  exp = exp.statement;
3152
3216
  }
3153
- let ref6;
3217
+ let ref7;
3218
+ let ref8;
3154
3219
  let m1;
3155
3220
  switch (exp.type) {
3156
3221
  case "BreakStatement":
@@ -3162,18 +3227,19 @@ function assignResults(node, collect) {
3162
3227
  return;
3163
3228
  }
3164
3229
  case "Declaration": {
3165
- let ref7;
3230
+ let ref9;
3166
3231
  if (exp.bindings?.length) {
3167
- ref7 = patternAsValue((ref6 = exp.bindings)[ref6.length - 1].pattern);
3232
+ ref9 = patternAsValue((ref7 = exp.bindings)[ref7.length - 1].pattern);
3168
3233
  } else {
3169
- ref7 = "void 0";
3234
+ ref9 = "void 0";
3170
3235
  }
3171
3236
  ;
3172
- const value = ref7;
3237
+ const value = ref9;
3173
3238
  exp.children.push([
3174
3239
  "",
3175
3240
  [";", collect(value)]
3176
3241
  ]);
3242
+ updateParentPointers(exp);
3177
3243
  return;
3178
3244
  }
3179
3245
  case "FunctionExpression": {
@@ -3182,6 +3248,7 @@ function assignResults(node, collect) {
3182
3248
  "",
3183
3249
  [";", collect(exp.id)]
3184
3250
  ]);
3251
+ updateParentPointers(exp);
3185
3252
  return;
3186
3253
  }
3187
3254
  break;
@@ -3197,7 +3264,7 @@ function assignResults(node, collect) {
3197
3264
  if (exp.expressions.some(isExit)) {
3198
3265
  return;
3199
3266
  }
3200
- assignResults(exp.expressions[exp.expressions.length - 1], collect);
3267
+ assignResults((ref8 = exp.expressions)[ref8.length - 1], collect);
3201
3268
  return;
3202
3269
  }
3203
3270
  case "IfStatement": {
@@ -3207,6 +3274,7 @@ function assignResults(node, collect) {
3207
3274
  } else {
3208
3275
  braceBlock(exp.then);
3209
3276
  exp.children.push([" else {", collect("void 0"), "}"]);
3277
+ updateParentPointers(exp);
3210
3278
  }
3211
3279
  return;
3212
3280
  }
@@ -3215,15 +3283,15 @@ function assignResults(node, collect) {
3215
3283
  return;
3216
3284
  }
3217
3285
  case "SwitchStatement": {
3218
- for (let ref8 = exp.caseBlock.clauses, i4 = 0, len3 = ref8.length; i4 < len3; i4++) {
3219
- const clause = ref8[i4];
3286
+ for (let ref10 = exp.caseBlock.clauses, i5 = 0, len4 = ref10.length; i5 < len4; i5++) {
3287
+ const clause = ref10[i5];
3220
3288
  assignResults(clause, collect);
3221
3289
  }
3222
3290
  return;
3223
3291
  }
3224
3292
  case "TryStatement": {
3225
- for (let ref9 = exp.blocks, i5 = 0, len4 = ref9.length; i5 < len4; i5++) {
3226
- const block = ref9[i5];
3293
+ for (let ref11 = exp.blocks, i6 = 0, len5 = ref11.length; i6 < len5; i6++) {
3294
+ const block = ref11[i6];
3227
3295
  assignResults(block, collect);
3228
3296
  }
3229
3297
  return;
@@ -3235,6 +3303,7 @@ function assignResults(node, collect) {
3235
3303
  const semi2 = exp.children.lastIndexOf(";");
3236
3304
  if (0 <= semi2 && semi2 < exp.children.length - 1) {
3237
3305
  exp.children.splice(semi2 + 1, 1 / 0, ...[collect(exp.children.slice(semi2 + 1))]);
3306
+ updateParentPointers(exp);
3238
3307
  return;
3239
3308
  }
3240
3309
  ;
@@ -3244,7 +3313,11 @@ function assignResults(node, collect) {
3244
3313
  if (node[node.length - 1]?.type === "SemicolonDelimiter") {
3245
3314
  return;
3246
3315
  }
3316
+ const parent = node[1].parent;
3247
3317
  node[1] = collect(node[1]);
3318
+ if (parent != null) {
3319
+ updateParentPointers(parent);
3320
+ }
3248
3321
  }
3249
3322
  function insertReturn(node) {
3250
3323
  if (!node) return;
@@ -3275,9 +3348,9 @@ function insertReturn(node) {
3275
3348
  insertReturn(node.block);
3276
3349
  if (!isExit(node.block)) {
3277
3350
  const comment = hasTrailingComment(node.block.expressions);
3278
- let ref10;
3351
+ let ref12;
3279
3352
  node.block.expressions.push([
3280
- comment ? (ref10 = node.block.expressions)[ref10.length - 1][0] || "\n" : "",
3353
+ comment ? (ref12 = node.block.expressions)[ref12.length - 1][0] || "\n" : "",
3281
3354
  wrapWithReturn(void 0, node, !comment)
3282
3355
  ]);
3283
3356
  }
@@ -3303,7 +3376,7 @@ function insertReturn(node) {
3303
3376
  if (exp.type === "LabelledStatement") {
3304
3377
  exp = exp.statement;
3305
3378
  }
3306
- let ref11;
3379
+ let ref13;
3307
3380
  let m3;
3308
3381
  switch (exp.type) {
3309
3382
  case "BreakStatement":
@@ -3315,14 +3388,14 @@ function insertReturn(node) {
3315
3388
  return;
3316
3389
  }
3317
3390
  case "Declaration": {
3318
- let ref12;
3391
+ let ref14;
3319
3392
  if (exp.bindings?.length) {
3320
- ref12 = [" ", patternAsValue((ref11 = exp.bindings)[ref11.length - 1].pattern)];
3393
+ ref14 = [" ", patternAsValue((ref13 = exp.bindings)[ref13.length - 1].pattern)];
3321
3394
  } else {
3322
- ref12 = [];
3395
+ ref14 = [];
3323
3396
  }
3324
3397
  ;
3325
- const value = ref12;
3398
+ const value = ref14;
3326
3399
  const parent = outer.parent;
3327
3400
  const index = findChildIndex(parent?.expressions, outer);
3328
3401
  assert.notEqual(index, -1, "Could not find declaration in parent");
@@ -3382,15 +3455,15 @@ function insertReturn(node) {
3382
3455
  return;
3383
3456
  }
3384
3457
  case "SwitchStatement": {
3385
- for (let ref13 = exp.caseBlock.clauses, i6 = 0, len5 = ref13.length; i6 < len5; i6++) {
3386
- const clause = ref13[i6];
3458
+ for (let ref15 = exp.caseBlock.clauses, i7 = 0, len6 = ref15.length; i7 < len6; i7++) {
3459
+ const clause = ref15[i7];
3387
3460
  insertReturn(clause);
3388
3461
  }
3389
3462
  return;
3390
3463
  }
3391
3464
  case "TryStatement": {
3392
- for (let ref14 = exp.blocks, i7 = 0, len6 = ref14.length; i7 < len6; i7++) {
3393
- const block = ref14[i7];
3465
+ for (let ref16 = exp.blocks, i8 = 0, len7 = ref16.length; i8 < len7; i8++) {
3466
+ const block = ref16[i8];
3394
3467
  insertReturn(block);
3395
3468
  }
3396
3469
  return;
@@ -3642,9 +3715,9 @@ function iterationDefaultBody(statement) {
3642
3715
  }
3643
3716
  const reduction = statement.type === "ForStatement" && statement.reduction;
3644
3717
  function fillBlock(expression) {
3645
- let ref15;
3718
+ let ref17;
3646
3719
  let m5;
3647
- if (m5 = (ref15 = block.expressions)[ref15.length - 1], Array.isArray(m5) && m5.length >= 2 && typeof m5[1] === "object" && m5[1] != null && "type" in m5[1] && m5[1].type === "EmptyStatement" && "implicit" in m5[1] && m5[1].implicit === true) {
3720
+ if (m5 = (ref17 = block.expressions)[ref17.length - 1], Array.isArray(m5) && m5.length >= 2 && typeof m5[1] === "object" && m5[1] != null && "type" in m5[1] && m5[1].type === "EmptyStatement" && "implicit" in m5[1] && m5[1].implicit === true) {
3648
3721
  block.expressions.pop();
3649
3722
  }
3650
3723
  block.expressions.push(expression);
@@ -3714,8 +3787,8 @@ function processParams(f) {
3714
3787
  function append2(p) {
3715
3788
  (rest ? after : before).push(p);
3716
3789
  }
3717
- for (let ref16 = parameters.parameters, i8 = 0, len7 = ref16.length; i8 < len7; i8++) {
3718
- const param = ref16[i8];
3790
+ for (let ref18 = parameters.parameters, i9 = 0, len8 = ref18.length; i9 < len8; i9++) {
3791
+ const param = ref18[i9];
3719
3792
  switch (param.type) {
3720
3793
  case "ThisType": {
3721
3794
  if (tt) {
@@ -3727,8 +3800,8 @@ function processParams(f) {
3727
3800
  } else {
3728
3801
  tt = trimFirstSpace(param);
3729
3802
  if (before.length || rest) {
3730
- let ref17;
3731
- let delim = (ref17 = tt.children)[ref17.length - 1];
3803
+ let ref19;
3804
+ let delim = (ref19 = tt.children)[ref19.length - 1];
3732
3805
  if (Array.isArray(delim)) {
3733
3806
  delim = delim[delim.length - 1];
3734
3807
  }
@@ -3920,14 +3993,14 @@ function processParams(f) {
3920
3993
  index2--;
3921
3994
  }
3922
3995
  const fStatement = classExpressions[index2];
3923
- for (let ref18 = gatherRecursive(parameters, ($14) => $14.type === "Parameter"), i9 = 0, len8 = ref18.length; i9 < len8; i9++) {
3924
- const parameter = ref18[i9];
3996
+ for (let ref20 = gatherRecursive(parameters, ($14) => $14.type === "Parameter"), i10 = 0, len9 = ref20.length; i10 < len9; i10++) {
3997
+ const parameter = ref20[i10];
3925
3998
  const { accessModifier } = parameter;
3926
3999
  if (!(accessModifier || parameter.typeSuffix)) {
3927
4000
  continue;
3928
4001
  }
3929
- for (let ref19 = gatherRecursive(parameter, ($15) => $15.type === "AtBinding"), i10 = 0, len9 = ref19.length; i10 < len9; i10++) {
3930
- const binding = ref19[i10];
4002
+ for (let ref21 = gatherRecursive(parameter, ($15) => $15.type === "AtBinding"), i11 = 0, len10 = ref21.length; i11 < len10; i11++) {
4003
+ const binding = ref21[i11];
3931
4004
  const typeSuffix = binding.parent?.typeSuffix;
3932
4005
  if (!(accessModifier || typeSuffix)) {
3933
4006
  continue;
@@ -3965,8 +4038,8 @@ function processParams(f) {
3965
4038
  decl: "const"
3966
4039
  }));
3967
4040
  }
3968
- for (let ref20 = splices, i11 = 0, len10 = ref20.length; i11 < len10; i11++) {
3969
- const binding = ref20[i11];
4041
+ for (let ref22 = splices, i12 = 0, len11 = ref22.length; i12 < len11; i12++) {
4042
+ const binding = ref22[i12];
3970
4043
  assert.equal(binding.type, "PostRestBindingElements", "splice should be of type Binding");
3971
4044
  prefix.push(makeNode({
3972
4045
  type: "Declaration",
@@ -4018,8 +4091,8 @@ function processSignature(f) {
4018
4091
  f.async.push("async ");
4019
4092
  signature.modifier.async = true;
4020
4093
  } else {
4021
- for (let ref21 = gatherRecursiveWithinFunction(block, ($17) => $17.type === "Await"), i12 = 0, len11 = ref21.length; i12 < len11; i12++) {
4022
- const a = ref21[i12];
4094
+ for (let ref23 = gatherRecursiveWithinFunction(block, ($17) => $17.type === "Await"), i13 = 0, len12 = ref23.length; i13 < len12; i13++) {
4095
+ const a = ref23[i13];
4023
4096
  const i = findChildIndex(a.parent, a);
4024
4097
  a.parent.children.splice(i + 1, 0, {
4025
4098
  type: "Error",
@@ -4033,8 +4106,8 @@ function processSignature(f) {
4033
4106
  f.generator.push("*");
4034
4107
  signature.modifier.generator = true;
4035
4108
  } else {
4036
- for (let ref22 = gatherRecursiveWithinFunction(block, ($18) => $18.type === "YieldExpression"), i13 = 0, len12 = ref22.length; i13 < len12; i13++) {
4037
- const y = ref22[i13];
4109
+ for (let ref24 = gatherRecursiveWithinFunction(block, ($18) => $18.type === "YieldExpression"), i14 = 0, len13 = ref24.length; i14 < len13; i14++) {
4110
+ const y = ref24[i14];
4038
4111
  const i = y.children.findIndex(($19) => $19.type === "Yield");
4039
4112
  y.children.splice(i + 1, 0, {
4040
4113
  type: "Error",
@@ -4052,8 +4125,8 @@ function processSignature(f) {
4052
4125
  }
4053
4126
  }
4054
4127
  function processFunctions(statements, config2) {
4055
- for (let ref23 = gatherRecursiveAll(statements, ($20) => $20.type === "FunctionExpression" || $20.type === "ArrowFunction" || $20.type === "MethodDefinition"), i14 = 0, len13 = ref23.length; i14 < len13; i14++) {
4056
- const f = ref23[i14];
4128
+ for (let ref25 = gatherRecursiveAll(statements, ($20) => $20.type === "FunctionExpression" || $20.type === "ArrowFunction" || $20.type === "MethodDefinition"), i15 = 0, len14 = ref25.length; i15 < len14; i15++) {
4129
+ const f = ref25[i15];
4057
4130
  if (f.type === "FunctionExpression" || f.type === "MethodDefinition") {
4058
4131
  implicitFunctionBlock(f);
4059
4132
  }
@@ -4112,9 +4185,9 @@ function expressionizeIteration(exp) {
4112
4185
  }
4113
4186
  let done;
4114
4187
  if (!async) {
4115
- let ref24;
4116
- if ((ref24 = blockContainingStatement(exp)) && typeof ref24 === "object" && "block" in ref24 && "index" in ref24) {
4117
- const { block: parentBlock, index } = ref24;
4188
+ let ref26;
4189
+ if ((ref26 = blockContainingStatement(exp)) && typeof ref26 === "object" && "block" in ref26 && "index" in ref26) {
4190
+ const { block: parentBlock, index } = ref26;
4118
4191
  statements[0][0] = parentBlock.expressions[index][0];
4119
4192
  parentBlock.expressions.splice(index, index + 1 - index, ...statements);
4120
4193
  updateParentPointers(parentBlock);
@@ -4131,8 +4204,8 @@ function expressionizeIteration(exp) {
4131
4204
  }
4132
4205
  }
4133
4206
  function processIterationExpressions(statements) {
4134
- for (let ref25 = gatherRecursiveAll(statements, ($21) => $21.type === "IterationExpression"), i15 = 0, len14 = ref25.length; i15 < len14; i15++) {
4135
- const s = ref25[i15];
4207
+ for (let ref27 = gatherRecursiveAll(statements, ($21) => $21.type === "IterationExpression"), i16 = 0, len15 = ref27.length; i16 < len15; i16++) {
4208
+ const s = ref27[i16];
4136
4209
  expressionizeIteration(s);
4137
4210
  }
4138
4211
  }
@@ -4156,12 +4229,12 @@ function processCoffeeDo(ws, expression) {
4156
4229
  let { parameters } = expression;
4157
4230
  const parameterList = parameters.parameters;
4158
4231
  const results1 = [];
4159
- for (let i16 = 0, len15 = parameterList.length; i16 < len15; i16++) {
4160
- let parameter = parameterList[i16];
4232
+ for (let i17 = 0, len16 = parameterList.length; i17 < len16; i17++) {
4233
+ let parameter = parameterList[i17];
4161
4234
  if (typeof parameter === "object" && parameter != null && "type" in parameter && parameter.type === "Parameter") {
4162
- let ref26;
4163
- if (ref26 = parameter.initializer) {
4164
- const initializer = ref26;
4235
+ let ref28;
4236
+ if (ref28 = parameter.initializer) {
4237
+ const initializer = ref28;
4165
4238
  args.push(initializer.expression, parameter.delim);
4166
4239
  parameter = {
4167
4240
  ...parameter,
@@ -4291,8 +4364,9 @@ function unbraceBlock(block) {
4291
4364
  if (block.bare) {
4292
4365
  return;
4293
4366
  }
4367
+ let m;
4294
4368
  let ref;
4295
- if (block.children[0] === " {" && (ref = block.children)[ref.length - 1] === "}") {
4369
+ if ((m = block.children[0], m === " {" || m === "{") && (ref = block.children)[ref.length - 1] === "}") {
4296
4370
  block.children.shift();
4297
4371
  block.children.pop();
4298
4372
  block.bare = true;
@@ -4328,17 +4402,6 @@ function makeEmptyBlock() {
4328
4402
  empty: true
4329
4403
  };
4330
4404
  }
4331
- function makeBlockFragment() {
4332
- const expressions = [];
4333
- return {
4334
- type: "BlockStatement",
4335
- children: expressions,
4336
- parent: void 0,
4337
- expressions,
4338
- bare: false,
4339
- root: false
4340
- };
4341
- }
4342
4405
  function replaceBlockExpression(node, child, replacement) {
4343
4406
  let found = false;
4344
4407
  const { expressions } = node;
@@ -4384,22 +4447,44 @@ function hoistRefDecs(statements) {
4384
4447
  });
4385
4448
  }
4386
4449
  function insertHoistDec(block, node, dec) {
4387
- const { expressions } = block;
4388
- const index = findChildIndex(expressions, node);
4450
+ const statement = ["", dec, ";"];
4451
+ insertBeforeInBlock(block, node, statement);
4452
+ }
4453
+ function insertBeforeInBlock(block, node, ...statements) {
4454
+ const index = findChildIndex(block.expressions, node);
4389
4455
  if (index < 0) {
4390
- throw new Error("Couldn't find expression in block for hoistable declaration.");
4456
+ throw new Error("insertBeforeInBlock couldn't find existing statement in block");
4457
+ }
4458
+ insertBlockStatements(block, index, ...statements);
4459
+ }
4460
+ function insertBlockStatements(block, index, ...statements) {
4461
+ if (!statements.length) {
4462
+ return;
4463
+ }
4464
+ const { expressions } = block;
4465
+ const before = expressions[index];
4466
+ if (statements[0][0] && before?.[0]) {
4467
+ if (!Array.isArray(statements[0][0])) {
4468
+ statements[0][0] = [statements[0][0]];
4469
+ }
4470
+ if (!Array.isArray(before[0])) {
4471
+ before[0] = [before[0]];
4472
+ }
4473
+ statements[0][0] = [...before[0], ...statements[0][0]];
4474
+ } else {
4475
+ statements[0][0] ||= before?.[0];
4391
4476
  }
4392
- const statement = [expressions[index][0], dec, ";"];
4393
- expressions[index][0] = "";
4394
- expressions.splice(index, 0, statement);
4395
- updateParentPointers(dec, block);
4477
+ before[0] = "";
4478
+ expressions.splice(index, 0, ...statements);
4479
+ updateParentPointers(block);
4480
+ braceBlock(block);
4396
4481
  }
4397
4482
  function processBlocks(statements) {
4398
4483
  insertSemicolon(statements);
4399
4484
  for (let ref1 = gatherRecursive(statements, ($) => $.type === "BlockStatement"), i2 = 0, len12 = ref1.length; i2 < len12; i2++) {
4400
4485
  const block = ref1[i2];
4401
- let m;
4402
- if (block.unwrapObject && block.expressions.length === 1 && (m = block.expressions[0][1], typeof m === "object" && m != null && "type" in m && m.type === "ParenthesizedExpression" && "implicit" in m && m.implicit === true && "expression" in m && typeof m.expression === "object" && m.expression != null && "type" in m.expression && m.expression.type === "ObjectExpression")) {
4486
+ let m1;
4487
+ if (block.unwrapObject && block.expressions.length === 1 && (m1 = block.expressions[0][1], typeof m1 === "object" && m1 != null && "type" in m1 && m1.type === "ParenthesizedExpression" && "implicit" in m1 && m1.implicit === true && "expression" in m1 && typeof m1.expression === "object" && m1.expression != null && "type" in m1.expression && m1.expression.type === "ObjectExpression")) {
4403
4488
  const object = block.expressions[0][1].expression;
4404
4489
  if (!(() => {
4405
4490
  let results = true;
@@ -4418,8 +4503,8 @@ function processBlocks(statements) {
4418
4503
  for (let ref2 = object.properties, i3 = 0, len22 = ref2.length; i3 < len22; i3++) {
4419
4504
  const i = i3;
4420
4505
  const prop = ref2[i3];
4421
- let m1;
4422
- if (m1 = prop.name, typeof m1 === "object" && m1 != null && "type" in m1 && m1.type === "ComputedPropertyName" && "implicit" in m1 && m1.implicit === true) {
4506
+ let m2;
4507
+ if (m2 = prop.name, typeof m2 === "object" && m2 != null && "type" in m2 && m2.type === "ComputedPropertyName" && "implicit" in m2 && m2.implicit === true) {
4423
4508
  replaceNode(prop.name, prop.name.expression, prop);
4424
4509
  }
4425
4510
  if (prop.delim?.implicit) {
@@ -4512,8 +4597,8 @@ function needsPrecedingSemicolon(exp) {
4512
4597
  function blockContainingStatement(exp) {
4513
4598
  let child = exp;
4514
4599
  let parent = exp.parent;
4515
- let m2;
4516
- while (parent != null && (m2 = parent.type, m2 === "StatementExpression" || m2 === "PipelineExpression" || m2 === "UnwrappedExpression")) {
4600
+ let m3;
4601
+ while (parent != null && (m3 = parent.type, m3 === "StatementExpression" || m3 === "PipelineExpression" || m3 === "UnwrappedExpression")) {
4517
4602
  child = parent;
4518
4603
  parent = parent.parent;
4519
4604
  }
@@ -5466,22 +5551,23 @@ function processDeclarations(statements) {
5466
5551
  if (typeSuffix && typeSuffix.optional) {
5467
5552
  if (initializer && !typeSuffix.t) {
5468
5553
  const expression = trimFirstSpace(initializer.expression);
5469
- let m;
5470
- if (m = expression.type, m === "Identifier" || m === "MemberExpression") {
5471
- typeSuffix.children.push(": ", typeSuffix.t = {
5472
- type: "TypeTypeof",
5473
- children: ["typeof ", expression],
5474
- expression
5475
- });
5476
- } else if (expression.type === "Literal" || expression.type === "RegularExpressionLiteral" || expression.type === "TemplateLiteral") {
5477
- typeSuffix.children.push(": ", typeSuffix.t = literalType(expression));
5478
- } else {
5554
+ typeSuffix.t = typeOfExpression(expression);
5555
+ if (!(typeSuffix.t != null)) {
5479
5556
  spliceChild(binding, typeSuffix, 1, {
5480
5557
  type: "Error",
5481
- message: `Optional type can only be inferred from literals or member expressions, not ${expression.type}`
5558
+ message: (() => {
5559
+ if (typeof expression === "object" && expression != null && "type" in expression && expression.type === "Literal" && "subtype" in expression && expression.subtype === "NullLiteral") {
5560
+ return "Optional type can't be inferred from null";
5561
+ } else if (typeof expression === "object" && expression != null && "type" in expression && expression.type === "Identifier" && "name" in expression && expression.name === "undefined") {
5562
+ return "Optional type can't be inferred from undefined";
5563
+ } else {
5564
+ return `Optional type can only be inferred from literals or member expressions, not ${expression.type}`;
5565
+ }
5566
+ })()
5482
5567
  });
5483
5568
  continue;
5484
5569
  }
5570
+ typeSuffix.children.push(": ", typeSuffix.t);
5485
5571
  }
5486
5572
  if (typeSuffix.t) {
5487
5573
  convertOptionalType(typeSuffix);
@@ -5522,16 +5608,16 @@ function processDeclarations(statements) {
5522
5608
  function prependStatementExpressionBlock(initializer, statement) {
5523
5609
  let { expression: exp } = initializer;
5524
5610
  let ws;
5525
- if (Array.isArray(exp)) {
5611
+ if (Array.isArray(exp) && exp.length === 2 && isWhitespaceOrEmpty(exp[0])) {
5526
5612
  ws = exp[0];
5527
5613
  exp = exp[1];
5528
5614
  }
5529
5615
  if (!(typeof exp === "object" && exp != null && "type" in exp && exp.type === "StatementExpression" || typeof exp === "object" && exp != null && "type" in exp && exp.type === "SpreadElement" && "expression" in exp && typeof exp.expression === "object" && exp.expression != null && "type" in exp.expression && exp.expression.type === "StatementExpression")) {
5530
5616
  return;
5531
5617
  }
5532
- const pre = [];
5533
5618
  const statementExp = exp.statement;
5534
5619
  const blockStatement = [ws || "", statementExp, ";"];
5620
+ const pre = [blockStatement];
5535
5621
  let ref;
5536
5622
  if (statementExp.type === "IterationExpression") {
5537
5623
  if (statementExp.async || statementExp.generator) {
@@ -5547,8 +5633,7 @@ function prependStatementExpressionBlock(initializer, statement) {
5547
5633
  assignResults(blockStatement, (resultNode) => {
5548
5634
  return makeNode({
5549
5635
  type: "AssignmentExpression",
5550
- children: [ref, " = ", resultNode],
5551
- parent: statement2
5636
+ children: [ref, " = ", resultNode]
5552
5637
  });
5553
5638
  });
5554
5639
  const refDec = {
@@ -5565,8 +5650,7 @@ function prependStatementExpressionBlock(initializer, statement) {
5565
5650
  assignResults(blockStatement, (resultNode) => {
5566
5651
  return makeNode({
5567
5652
  type: "AssignmentExpression",
5568
- children: [ref, " = ", resultNode],
5569
- parent: statement
5653
+ children: [ref, " = ", resultNode]
5570
5654
  });
5571
5655
  });
5572
5656
  const refDec = {
@@ -5575,8 +5659,12 @@ function prependStatementExpressionBlock(initializer, statement) {
5575
5659
  };
5576
5660
  pre.unshift(["", refDec, ";"]);
5577
5661
  }
5578
- statement.children.unshift(...pre, blockStatement);
5579
- updateParentPointers(blockStatement, statement);
5662
+ let ref3;
5663
+ if (!((ref3 = blockContainingStatement(statement)) && typeof ref3 === "object" && "block" in ref3 && "index" in ref3)) {
5664
+ throw new Error("Couldn't find block in prependStatementExpressionBlock");
5665
+ }
5666
+ const { block, index } = ref3;
5667
+ insertBlockStatements(block, index, ...pre);
5580
5668
  return ref;
5581
5669
  }
5582
5670
  function processDeclarationCondition(condition, rootCondition, parent) {
@@ -5675,8 +5763,8 @@ function processDeclarationConditionStatement(s) {
5675
5763
  if (conditions.length) {
5676
5764
  let children = condition.children;
5677
5765
  if (s.negated) {
5678
- let m1;
5679
- if (!(m1 = condition.expression, typeof m1 === "object" && m1 != null && "type" in m1 && m1.type === "UnaryExpression" && "children" in m1 && Array.isArray(m1.children) && len2(m1.children, 2) && Array.isArray(m1.children[0]) && len2(m1.children[0], 1) && m1.children[0][0] === "!" && typeof m1.children[1] === "object" && m1.children[1] != null && "type" in m1.children[1] && m1.children[1].type === "ParenthesizedExpression")) {
5766
+ let m;
5767
+ if (!(m = condition.expression, typeof m === "object" && m != null && "type" in m && m.type === "UnaryExpression" && "children" in m && Array.isArray(m.children) && len2(m.children, 2) && Array.isArray(m.children[0]) && len2(m.children[0], 1) && m.children[0][0] === "!" && typeof m.children[1] === "object" && m.children[1] != null && "type" in m.children[1] && m.children[1].type === "ParenthesizedExpression")) {
5680
5768
  throw new Error("Unsupported negated condition");
5681
5769
  }
5682
5770
  ;
@@ -5706,11 +5794,11 @@ function processDeclarationConditionStatement(s) {
5706
5794
  ancestor.expressions.splice(index + 1, 0, ...blockPrefix);
5707
5795
  updateParentPointers(ancestor);
5708
5796
  braceBlock(ancestor);
5709
- let ref3;
5797
+ let ref4;
5710
5798
  switch (s.type) {
5711
5799
  case "IfStatement": {
5712
- if (ref3 = s.else?.block) {
5713
- const elseBlock = ref3;
5800
+ if (ref4 = s.else?.block) {
5801
+ const elseBlock = ref4;
5714
5802
  if (elseBlock.bare && !elseBlock.semicolon) {
5715
5803
  elseBlock.children.push(elseBlock.semicolon = ";");
5716
5804
  }
@@ -5762,38 +5850,19 @@ function processDeclarationConditionStatement(s) {
5762
5850
  if (!blockPrefix) {
5763
5851
  return;
5764
5852
  }
5765
- const newCondition = {
5766
- type: "ParenthesizedExpression",
5767
- children: ["(", ref2, ")"],
5768
- expression: ref2,
5769
- parent: s
5770
- };
5771
- s.children = s.children.map(function(c) {
5772
- if (c === s.condition) {
5773
- return newCondition;
5774
- } else {
5775
- return c;
5776
- }
5777
- });
5778
- s.condition = newCondition;
5779
- updateParentPointers(s);
5780
- if (statementDeclaration) {
5781
- const block = makeEmptyBlock();
5782
- replaceBlockExpression(s.parent, s, block);
5783
- block.expressions.push(["", s]);
5784
- s.children.splice(s.children.findIndex(($5) => $5.token === "switch"), 0, blockPrefix);
5785
- s.parent = block;
5786
- } else {
5787
- const block = blockWithPrefix([["", [{
5853
+ replaceNode(s.condition, parenthesizeExpression(ref2), s);
5854
+ if (!statementDeclaration) {
5855
+ const declStatement = ["", [{
5788
5856
  type: "Declaration",
5789
5857
  children: ["let ", ...condition.expression.children]
5790
- }], ";"], ...blockPrefix], makeEmptyBlock());
5791
- updateParentPointers(block, s.parent);
5792
- replaceBlockExpression(s.parent, s, block);
5793
- block.expressions.push(["", s]);
5794
- s.parent = block;
5795
- }
5796
- ;
5858
+ }], ";"];
5859
+ blockPrefix.unshift(declStatement);
5860
+ }
5861
+ const block = blockWithPrefix(blockPrefix, makeEmptyBlock());
5862
+ updateParentPointers(block, s.parent);
5863
+ replaceBlockExpression(s.parent, s, block);
5864
+ block.expressions.push(["", s]);
5865
+ s.parent = block;
5797
5866
  break;
5798
5867
  }
5799
5868
  }
@@ -5801,12 +5870,12 @@ function processDeclarationConditionStatement(s) {
5801
5870
  function dynamizeFromClause(from) {
5802
5871
  from = from.slice(1);
5803
5872
  from = trimFirstSpace(from);
5804
- let ref4;
5805
- if (ref4 = from[from.length - 1]?.assertion) {
5806
- const assert2 = ref4;
5807
- let ref5;
5808
- ref5 = from[from.length - 1];
5809
- ref5.children = ref5.children.filter((a2) => a2 !== assert2);
5873
+ let ref5;
5874
+ if (ref5 = from[from.length - 1]?.assertion) {
5875
+ const assert2 = ref5;
5876
+ let ref6;
5877
+ ref6 = from[from.length - 1];
5878
+ ref6.children = ref6.children.filter((a2) => a2 !== assert2);
5810
5879
  from.push(", {", assert2.keyword, ":", assert2.object, "}");
5811
5880
  }
5812
5881
  return ["(", ...from, ")"];
@@ -5815,20 +5884,20 @@ function dynamizeImportDeclaration(decl) {
5815
5884
  const { imports } = decl;
5816
5885
  let { star, binding, specifiers } = imports;
5817
5886
  const justDefault = binding && !specifiers && !star;
5818
- let ref6;
5887
+ let ref7;
5819
5888
  {
5820
5889
  if (binding) {
5821
5890
  if (specifiers) {
5822
- ref6 = makeRef();
5891
+ ref7 = makeRef();
5823
5892
  } else {
5824
- ref6 = binding;
5893
+ ref7 = binding;
5825
5894
  }
5826
5895
  } else {
5827
- ref6 = convertNamedImportsToObject(imports, true);
5896
+ ref7 = convertNamedImportsToObject(imports, true);
5828
5897
  }
5829
5898
  }
5830
5899
  ;
5831
- const pattern = ref6;
5900
+ const pattern = ref7;
5832
5901
  const c = "const";
5833
5902
  const expression = [
5834
5903
  justDefault ? "(" : void 0,
@@ -6819,7 +6888,7 @@ function processForInOf($0) {
6819
6888
  var concatAssign2 = (lhs, rhs) => (rhs?.[Symbol.isConcatSpreadable] ?? Array.isArray(rhs) ? lhs.push.apply(lhs, rhs) : lhs.push(rhs), lhs);
6820
6889
  function findDecs(statements) {
6821
6890
  const declarations = gatherNodes(statements, ($) => $.type === "Declaration");
6822
- const declarationNames = declarations.flatMap((d) => d.names);
6891
+ const declarationNames = declarations.flatMap(($1) => $1.names);
6823
6892
  const globals = getConfig().globals || [];
6824
6893
  return new Set(globals.concat(declarationNames));
6825
6894
  }
@@ -6827,16 +6896,16 @@ function createConstLetDecs(statements, scopes, letOrConst) {
6827
6896
  function findVarDecs(statements2, decs) {
6828
6897
  const declarationNames = gatherRecursive(statements2, (node) => {
6829
6898
  return node.type === "Declaration" && node.children && node.children.length > 0 && node.children[0].token && node.children[0].token.startsWith("var") || node.type === "FunctionExpression";
6830
- }).filter((node) => node.type === "Declaration").flatMap((node) => node.names);
6899
+ }).filter(($2) => $2.type === "Declaration").flatMap(($3) => $3.names);
6831
6900
  return new Set(declarationNames);
6832
6901
  }
6833
6902
  let declaredIdentifiers = findVarDecs(statements);
6834
6903
  function hasDec(name) {
6835
- return declaredIdentifiers.has(name) || scopes.some(($1) => $1.has(name));
6904
+ return declaredIdentifiers.has(name) || scopes.some(($4) => $4.has(name));
6836
6905
  }
6837
6906
  function gatherBlockOrOther(statement) {
6838
- return gatherNodes(statement, (s) => s.type === "BlockStatement" || s.type === "AssignmentExpression" || s.type === "Declaration").flatMap((node) => {
6839
- if (node.type == "BlockStatement") {
6907
+ return gatherNodes(statement, ($5) => $5.type === "BlockStatement" || $5.type === "AssignmentExpression" || $5.type === "Declaration").flatMap((node) => {
6908
+ if (node.type === "BlockStatement") {
6840
6909
  return node.bare ? gatherBlockOrOther(node.expressions) : node;
6841
6910
  } else if (node.children && node.children.length) {
6842
6911
  return [...gatherBlockOrOther(node.children), node];
@@ -6848,16 +6917,18 @@ function createConstLetDecs(statements, scopes, letOrConst) {
6848
6917
  let currentScope = /* @__PURE__ */ new Set();
6849
6918
  scopes.push(currentScope);
6850
6919
  const fnNodes = gatherNodes(statements, isFunction);
6851
- const forNodes = gatherNodes(statements, (s) => s.type === "ForStatement");
6920
+ const forNodes = gatherNodes(statements, ($6) => $6.type === "ForStatement");
6852
6921
  let targetStatements = [];
6853
- for (const statement of statements) {
6922
+ for (let i1 = 0, len3 = statements.length; i1 < len3; i1++) {
6923
+ const statement = statements[i1];
6854
6924
  const nodes = gatherBlockOrOther(statement);
6855
6925
  let undeclaredIdentifiers = [];
6856
- for (const node of nodes) {
6857
- if (node.type == "BlockStatement") {
6926
+ for (let i2 = 0, len12 = nodes.length; i2 < len12; i2++) {
6927
+ const node = nodes[i2];
6928
+ if (node.type === "BlockStatement") {
6858
6929
  let block = node;
6859
- let fnNode = fnNodes.find((fnNode2) => fnNode2.block === block);
6860
- let forNode = forNodes.find((forNode2) => forNode2.block === block);
6930
+ let fnNode = fnNodes.find(($7) => $7.block === block);
6931
+ let forNode = forNodes.find(($8) => $8.block === block);
6861
6932
  if (fnNode != null) {
6862
6933
  scopes.push(new Set(fnNode.parameters.names));
6863
6934
  createConstLetDecs(block.expressions, scopes, letOrConst);
@@ -6871,21 +6942,26 @@ function createConstLetDecs(statements, scopes, letOrConst) {
6871
6942
  }
6872
6943
  continue;
6873
6944
  }
6874
- if (node.names == null) continue;
6875
- let names = node.names.filter((name) => !hasDec(name));
6876
- if (node.type == "AssignmentExpression") {
6945
+ if (!(node.names != null)) {
6946
+ continue;
6947
+ }
6948
+ const names = node.names.filter((name) => !hasDec(name));
6949
+ if (node.type === "AssignmentExpression") {
6877
6950
  undeclaredIdentifiers.push(...names);
6878
6951
  }
6879
- names.forEach((name) => currentScope.add(name));
6952
+ for (let i3 = 0, len22 = names.length; i3 < len22; i3++) {
6953
+ const name = names[i3];
6954
+ currentScope.add(name);
6955
+ }
6880
6956
  }
6881
- if (undeclaredIdentifiers.length > 0) {
6957
+ if (undeclaredIdentifiers.length) {
6882
6958
  let indent = statement[0];
6883
- let firstIdentifier = gatherNodes(statement[1], (node) => node.type == "Identifier")[0];
6884
- if (undeclaredIdentifiers.length == 1 && statement[1].type == "AssignmentExpression" && statement[1].names.length == 1 && statement[1].names[0] == undeclaredIdentifiers[0] && firstIdentifier && firstIdentifier.names == undeclaredIdentifiers[0] && gatherNodes(statement[1], (node) => node.type === "ObjectBindingPattern").length == 0) {
6959
+ let firstIdentifier = gatherNodes(statement[1], ($9) => $9.type === "Identifier")[0];
6960
+ if (undeclaredIdentifiers.length === 1 && statement[1].type === "AssignmentExpression" && statement[1].names.length === 1 && statement[1].names[0] === undeclaredIdentifiers[0] && firstIdentifier && firstIdentifier.names == undeclaredIdentifiers[0] && gatherNodes(statement[1], ($10) => $10.type === "ObjectBindingPattern").length === 0) {
6885
6961
  statement[1].children.unshift([`${letOrConst} `]);
6886
6962
  } else {
6887
6963
  let tail = "\n";
6888
- if (gatherNodes(indent, (node) => node.token && node.token.endsWith("\n")).length > 0) {
6964
+ if (gatherNodes(indent, ($11) => $11.token && $11.token.endsWith("\n")).length) {
6889
6965
  tail = void 0;
6890
6966
  }
6891
6967
  targetStatements.push([indent, {
@@ -6902,17 +6978,17 @@ function createConstLetDecs(statements, scopes, letOrConst) {
6902
6978
  }
6903
6979
  function createVarDecs(block, scopes, pushVar) {
6904
6980
  function hasDec(name) {
6905
- return scopes.some(($2) => $2.has(name));
6981
+ return scopes.some(($12) => $12.has(name));
6906
6982
  }
6907
6983
  function findAssignments(statements2, decs2) {
6908
- let assignmentStatements2 = gatherNodes(statements2, ($3) => $3.type === "AssignmentExpression");
6984
+ let assignmentStatements2 = gatherNodes(statements2, ($13) => $13.type === "AssignmentExpression");
6909
6985
  if (assignmentStatements2.length) {
6910
6986
  concatAssign2(
6911
6987
  assignmentStatements2,
6912
6988
  findAssignments(assignmentStatements2.map((s) => s.children), decs2)
6913
6989
  );
6914
6990
  }
6915
- return assignmentStatements2.filter(($4) => !($4.parent?.type === "CoffeeClassPublic"));
6991
+ return assignmentStatements2.filter(($14) => !($14.parent?.type === "CoffeeClassPublic"));
6916
6992
  }
6917
6993
  pushVar ??= (name) => {
6918
6994
  varIds.push(name);
@@ -6923,7 +6999,7 @@ function createVarDecs(block, scopes, pushVar) {
6923
6999
  scopes.push(decs);
6924
7000
  const varIds = [];
6925
7001
  const assignmentStatements = findAssignments(statements, scopes);
6926
- const undeclaredIdentifiers = assignmentStatements.flatMap(($5) => $5?.names || []);
7002
+ const undeclaredIdentifiers = assignmentStatements.flatMap(($15) => $15?.names || []);
6927
7003
  undeclaredIdentifiers.filter((x, i, a) => {
6928
7004
  if (!hasDec(x)) return a.indexOf(x) === i;
6929
7005
  return;
@@ -8089,24 +8165,20 @@ function processAssignments(statements) {
8089
8165
  continue;
8090
8166
  }
8091
8167
  let { lhs: $1, expression: $2 } = exp, tail = [], len3 = $1.length;
8092
- let block;
8093
8168
  let ref13;
8094
8169
  let ref14;
8095
8170
  if (blockContainingStatement(exp) && !(ref13 = $1[$1.length - 1])?.[ref13.length - 1]?.special && !isShortCircuitOp((ref14 = $1[$1.length - 1])?.[ref14.length - 1])) {
8096
- block = makeBlockFragment();
8097
8171
  let ref15;
8098
8172
  if (ref15 = prependStatementExpressionBlock(
8099
8173
  { type: "Initializer", expression: $2, children: [void 0, void 0, $2] },
8100
- block
8174
+ exp
8101
8175
  )) {
8102
8176
  const ref = ref15;
8103
- exp.children = exp.children.map(($7) => $7 === $2 ? ref : $7);
8177
+ replaceNode($2, ref, exp);
8104
8178
  $2 = ref;
8105
- } else {
8106
- block = void 0;
8107
8179
  }
8108
8180
  }
8109
- if ($1.some(($8) => $8[$8.length - 1].special)) {
8181
+ if ($1.some(($7) => $7[$7.length - 1].special)) {
8110
8182
  if ($1.length !== 1) throw new Error("Only one assignment with id= is allowed");
8111
8183
  const [, lhs, , op] = $1[0];
8112
8184
  const { call, omitLhs } = op;
@@ -8178,7 +8250,7 @@ function processAssignments(statements) {
8178
8250
  break;
8179
8251
  } else if (m3 = lhs.type, m3 === "ObjectBindingPattern" || m3 === "ArrayBindingPattern" || m3 === "NamedBindingPattern") {
8180
8252
  processBindingPatternLHS(lhs, tail);
8181
- gatherRecursiveAll(lhs, ($9) => $9.type === "Ref").forEach(refsToDeclare.add.bind(refsToDeclare));
8253
+ gatherRecursiveAll(lhs, ($8) => $8.type === "Ref").forEach(refsToDeclare.add.bind(refsToDeclare));
8182
8254
  }
8183
8255
  }
8184
8256
  i--;
@@ -8210,7 +8282,7 @@ function processAssignments(statements) {
8210
8282
  }
8211
8283
  if (refsToDeclare.size) {
8212
8284
  if (exp.hoistDec) {
8213
- exp.hoistDec.children.push([...refsToDeclare].map(($10) => [",", $10]));
8285
+ exp.hoistDec.children.push([...refsToDeclare].map(($9) => [",", $9]));
8214
8286
  } else {
8215
8287
  exp.hoistDec = {
8216
8288
  type: "Declaration",
@@ -8225,11 +8297,6 @@ function processAssignments(statements) {
8225
8297
  if (index < 0) throw new Error("Assertion error: exp not in AssignmentExpression");
8226
8298
  exp.children.splice(index + 1, 0, ...tail);
8227
8299
  }
8228
- if (block) {
8229
- replaceNode(exp, block);
8230
- block.expressions.push(["", exp]);
8231
- exp.parent = block;
8232
- }
8233
8300
  }
8234
8301
  }
8235
8302
  function unchainOptionalMemberExpression(exp, ref, innerExp) {
@@ -8318,7 +8385,7 @@ function attachPostfixStatementAsExpression(exp, post) {
8318
8385
  }
8319
8386
  function processTypes(node) {
8320
8387
  const results1 = [];
8321
- for (let ref17 = gatherRecursiveAll(node, ($11) => $11.type === "TypeUnary"), i8 = 0, len7 = ref17.length; i8 < len7; i8++) {
8388
+ for (let ref17 = gatherRecursiveAll(node, ($10) => $10.type === "TypeUnary"), i8 = 0, len7 = ref17.length; i8 < len7; i8++) {
8322
8389
  const unary = ref17[i8];
8323
8390
  let suffixIndex = unary.suffix.length - 1;
8324
8391
  const results2 = [];
@@ -8446,7 +8513,7 @@ function processTypes(node) {
8446
8513
  return results1;
8447
8514
  }
8448
8515
  function processStatementExpressions(statements) {
8449
- for (let ref19 = gatherRecursiveAll(statements, ($12) => $12.type === "StatementExpression"), i9 = 0, len8 = ref19.length; i9 < len8; i9++) {
8516
+ for (let ref19 = gatherRecursiveAll(statements, ($11) => $11.type === "StatementExpression"), i9 = 0, len8 = ref19.length; i9 < len8; i9++) {
8450
8517
  const exp = ref19[i9];
8451
8518
  const { maybe, statement } = exp;
8452
8519
  if ((maybe || statement.type === "ThrowStatement") && blockContainingStatement(exp)) {
@@ -8594,11 +8661,11 @@ function processBreaksContinues(statements) {
8594
8661
  }
8595
8662
  }
8596
8663
  function processCoffeeClasses(statements) {
8597
- for (let ref23 = gatherRecursiveAll(statements, ($13) => $13.type === "ClassExpression"), i11 = 0, len10 = ref23.length; i11 < len10; i11++) {
8664
+ for (let ref23 = gatherRecursiveAll(statements, ($12) => $12.type === "ClassExpression"), i11 = 0, len10 = ref23.length; i11 < len10; i11++) {
8598
8665
  const ce = ref23[i11];
8599
8666
  const { expressions } = ce.body;
8600
8667
  const indent = expressions[0]?.[0] ?? "\n";
8601
- const autoBinds = expressions.filter(($14) => $14[1]?.autoBind);
8668
+ const autoBinds = expressions.filter(($13) => $13[1]?.autoBind);
8602
8669
  if (autoBinds.length) {
8603
8670
  let construct;
8604
8671
  for (const [, c] of expressions) {
@@ -8647,17 +8714,17 @@ function processCoffeeClasses(statements) {
8647
8714
  })()
8648
8715
  );
8649
8716
  }
8650
- const public_static_function_assignments = expressions.filter(($15) => $15[1]?.type === "CoffeeClassPublic" && $15[1].assignment?.expression?.type === "FunctionExpression").map(($16) => $16[1].assignment);
8717
+ const public_static_function_assignments = expressions.filter(($14) => $14[1]?.type === "CoffeeClassPublic" && $14[1].assignment?.expression?.type === "FunctionExpression").map(($15) => $15[1].assignment);
8651
8718
  for (const public_static_function_assignment of public_static_function_assignments) {
8652
8719
  const id = public_static_function_assignment.lhs[0][1];
8653
8720
  replaceNode(public_static_function_assignment, convertFunctionToMethod(id, public_static_function_assignment.expression));
8654
8721
  }
8655
- const public_static_arrow_function_assignments = expressions.filter(($17) => $17[1]?.type === "CoffeeClassPublic" && $17[1].assignment?.expression?.type === "ArrowFunction").map(($18) => $18[1].assignment);
8722
+ const public_static_arrow_function_assignments = expressions.filter(($16) => $16[1]?.type === "CoffeeClassPublic" && $16[1].assignment?.expression?.type === "ArrowFunction").map(($17) => $17[1].assignment);
8656
8723
  for (const public_static_arrow_function_assignment of public_static_arrow_function_assignments) {
8657
8724
  const id = public_static_arrow_function_assignment.lhs[0][1];
8658
8725
  replaceNode(public_static_arrow_function_assignment, convertArrowFunctionToMethod(id, public_static_arrow_function_assignment.expression));
8659
8726
  }
8660
- const privates = expressions.filter(($19) => $19[1]?.type === "CoffeeClassPrivate");
8727
+ const privates = expressions.filter(($18) => $18[1]?.type === "CoffeeClassPrivate");
8661
8728
  if (!privates.length) {
8662
8729
  continue;
8663
8730
  }
@@ -8722,7 +8789,7 @@ function processProgram(root) {
8722
8789
  root.topLevelYield ? "*" : void 0
8723
8790
  );
8724
8791
  statements = [["", rootIIFE]];
8725
- root.children = root.children.map(($20) => $20 === root.expressions ? statements : $20);
8792
+ root.children = root.children.map(($19) => $19 === root.expressions ? statements : $19);
8726
8793
  root.expressions = statements;
8727
8794
  }
8728
8795
  hoistRefDecs(statements);
@@ -8753,9 +8820,9 @@ async function processProgramAsync(root) {
8753
8820
  await processComptime(statements);
8754
8821
  }
8755
8822
  function processRepl(root, rootIIFE) {
8756
- const topBlock = gatherRecursive(rootIIFE, ($21) => $21.type === "BlockStatement")[0];
8823
+ const topBlock = gatherRecursive(rootIIFE, ($20) => $20.type === "BlockStatement")[0];
8757
8824
  let i = 0;
8758
- for (let ref24 = gatherRecursiveWithinFunction(topBlock, ($22) => $22.type === "Declaration"), i14 = 0, len12 = ref24.length; i14 < len12; i14++) {
8825
+ for (let ref24 = gatherRecursiveWithinFunction(topBlock, ($21) => $21.type === "Declaration"), i14 = 0, len12 = ref24.length; i14 < len12; i14++) {
8759
8826
  const decl = ref24[i14];
8760
8827
  if (!decl.names?.length) {
8761
8828
  continue;
@@ -8769,7 +8836,7 @@ function processRepl(root, rootIIFE) {
8769
8836
  root.expressions.splice(i++, 0, ["", `var ${decl.names.join(",")}`, ";"]);
8770
8837
  }
8771
8838
  }
8772
- for (let ref25 = gatherRecursive(topBlock, ($23) => $23.type === "FunctionExpression"), i15 = 0, len13 = ref25.length; i15 < len13; i15++) {
8839
+ for (let ref25 = gatherRecursive(topBlock, ($22) => $22.type === "FunctionExpression"), i15 = 0, len13 = ref25.length; i15 < len13; i15++) {
8773
8840
  const func = ref25[i15];
8774
8841
  if (func.name && func.parent?.type === "BlockStatement") {
8775
8842
  if (func.parent === topBlock) {
@@ -8782,7 +8849,7 @@ function processRepl(root, rootIIFE) {
8782
8849
  }
8783
8850
  }
8784
8851
  }
8785
- for (let ref26 = gatherRecursiveWithinFunction(topBlock, ($24) => $24.type === "ClassExpression"), i16 = 0, len14 = ref26.length; i16 < len14; i16++) {
8852
+ for (let ref26 = gatherRecursiveWithinFunction(topBlock, ($23) => $23.type === "ClassExpression"), i16 = 0, len14 = ref26.length; i16 < len14; i16++) {
8786
8853
  const classExp = ref26[i16];
8787
8854
  let m8;
8788
8855
  if (classExp.name && classExp.parent === topBlock || (m8 = classExp.parent, typeof m8 === "object" && m8 != null && "type" in m8 && m8.type === "ReturnStatement" && "parent" in m8 && m8.parent === topBlock)) {
@@ -8794,7 +8861,7 @@ function processRepl(root, rootIIFE) {
8794
8861
  function processPlaceholders(statements) {
8795
8862
  const placeholderMap = /* @__PURE__ */ new Map();
8796
8863
  const liftedIfs = /* @__PURE__ */ new Set();
8797
- for (let ref27 = gatherRecursiveAll(statements, ($25) => $25.type === "Placeholder"), i17 = 0, len15 = ref27.length; i17 < len15; i17++) {
8864
+ for (let ref27 = gatherRecursiveAll(statements, ($24) => $24.type === "Placeholder"), i17 = 0, len15 = ref27.length; i17 < len15; i17++) {
8798
8865
  const exp = ref27[i17];
8799
8866
  let ancestor;
8800
8867
  if (exp.subtype === ".") {
@@ -9079,7 +9146,7 @@ function typeOfJSXFragment(node, config2) {
9079
9146
  if (type.length === 1) {
9080
9147
  return type[0];
9081
9148
  } else {
9082
- type = type.flatMap(($26) => [$26, ", "]);
9149
+ type = type.flatMap(($25) => [$25, ", "]);
9083
9150
  type.pop();
9084
9151
  return ["[", type, "]"];
9085
9152
  }
@@ -9144,6 +9211,7 @@ var grammar = {
9144
9211
  Tuple,
9145
9212
  NWTypePostfix,
9146
9213
  UpdateExpression,
9214
+ UpdateExpressionPattern,
9147
9215
  UpdateExpressionSymbol,
9148
9216
  AssignmentExpression,
9149
9217
  NonPipelineAssignmentExpression,
@@ -9279,7 +9347,7 @@ var grammar = {
9279
9347
  OperatorPrecedence,
9280
9348
  OperatorAssociativity,
9281
9349
  ThinArrowFunction,
9282
- Arrow,
9350
+ ThinArrow,
9283
9351
  ExplicitBlock,
9284
9352
  EmptyBracedContent,
9285
9353
  ImplicitNestedBlock,
@@ -10263,7 +10331,7 @@ var $R71 = (0, import_lib2.$R)(new RegExp("#(?!##(?!#))([^\\r\\n]*)", "suy"));
10263
10331
  var $R72 = (0, import_lib2.$R)(new RegExp("[^]*?###", "suy"));
10264
10332
  var $R73 = (0, import_lib2.$R)(new RegExp("###(?!#)", "suy"));
10265
10333
  var $R74 = (0, import_lib2.$R)(new RegExp("\\/\\*(?:(?!\\*\\/)[^\\r\\n])*\\*\\/", "suy"));
10266
- var $R75 = (0, import_lib2.$R)(new RegExp("(?=[ \\t\\/\\\\])", "suy"));
10334
+ var $R75 = (0, import_lib2.$R)(new RegExp("(?=[ \\t\\/\\\\#])", "suy"));
10267
10335
  var $R76 = (0, import_lib2.$R)(new RegExp("(?=\\s|\\/|#)", "suy"));
10268
10336
  var $R77 = (0, import_lib2.$R)(new RegExp("(?!\\p{ID_Continue})", "suy"));
10269
10337
  var $R78 = (0, import_lib2.$R)(new RegExp("[=:]", "suy"));
@@ -10950,6 +11018,12 @@ var UpdateExpression$$ = [UpdateExpression$0, UpdateExpression$1];
10950
11018
  function UpdateExpression(ctx, state2) {
10951
11019
  return (0, import_lib2.$EVENT_C)(ctx, state2, "UpdateExpression", UpdateExpression$$);
10952
11020
  }
11021
+ var UpdateExpressionPattern$0 = NamedBindingPattern;
11022
+ var UpdateExpressionPattern$1 = UpdateExpression;
11023
+ var UpdateExpressionPattern$$ = [UpdateExpressionPattern$0, UpdateExpressionPattern$1];
11024
+ function UpdateExpressionPattern(ctx, state2) {
11025
+ return (0, import_lib2.$EVENT_C)(ctx, state2, "UpdateExpressionPattern", UpdateExpressionPattern$$);
11026
+ }
10953
11027
  var UpdateExpressionSymbol$0 = (0, import_lib2.$TV)((0, import_lib2.$C)((0, import_lib2.$EXPECT)($L9, 'UpdateExpressionSymbol "++"'), (0, import_lib2.$EXPECT)($L10, 'UpdateExpressionSymbol "--"')), function($skip, $loc, $0, $1) {
10954
11028
  return { $loc, token: $1 };
10955
11029
  });
@@ -11013,7 +11087,7 @@ var NonPipelineAssignmentExpressionTail$$ = [NonPipelineAssignmentExpressionTail
11013
11087
  function NonPipelineAssignmentExpressionTail(ctx, state2) {
11014
11088
  return (0, import_lib2.$EVENT_C)(ctx, state2, "NonPipelineAssignmentExpressionTail", NonPipelineAssignmentExpressionTail$$);
11015
11089
  }
11016
- var ActualAssignment$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$P)((0, import_lib2.$S)(NotDedented, UpdateExpression, WAssignmentOp)), MaybeNestedExpression), function($skip, $loc, $0, $1, $2) {
11090
+ var ActualAssignment$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$P)((0, import_lib2.$S)(NotDedented, UpdateExpressionPattern, WAssignmentOp)), MaybeNestedExpression), function($skip, $loc, $0, $1, $2) {
11017
11091
  $1 = $1.map((x) => [x[0], x[1], ...x[2]]);
11018
11092
  $0 = [$1, $2];
11019
11093
  return {
@@ -11030,7 +11104,7 @@ var ActualAssignment$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib
11030
11104
  function ActualAssignment(ctx, state2) {
11031
11105
  return (0, import_lib2.$EVENT)(ctx, state2, "ActualAssignment", ActualAssignment$0);
11032
11106
  }
11033
- var NonPipelineActualAssignment$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$P)((0, import_lib2.$S)(NotDedented, UpdateExpression, WAssignmentOp)), MaybeNestedNonPipelineExpression), function($skip, $loc, $0, $1, $2) {
11107
+ var NonPipelineActualAssignment$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$P)((0, import_lib2.$S)(NotDedented, UpdateExpressionPattern, WAssignmentOp)), MaybeNestedNonPipelineExpression), function($skip, $loc, $0, $1, $2) {
11034
11108
  $1 = $1.map((x) => [x[0], x[1], ...x[2]]);
11035
11109
  $0 = [$1, $2];
11036
11110
  return {
@@ -11209,8 +11283,14 @@ var PipelineExpressionBody$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Pipeline
11209
11283
  ...rest.map(([nested, line]) => [nested, ...line]).flat()
11210
11284
  ];
11211
11285
  });
11212
- var PipelineExpressionBody$1 = (0, import_lib2.$P)((0, import_lib2.$S)(NotDedented, Pipe, __, PipelineTailItem));
11213
- var PipelineExpressionBody$$ = [PipelineExpressionBody$0, PipelineExpressionBody$1];
11286
+ var PipelineExpressionBody$1 = (0, import_lib2.$T)((0, import_lib2.$S)(NewlineBinaryOpAllowed, (0, import_lib2.$P)((0, import_lib2.$S)(NotDedented, Pipe, __, PipelineTailItem))), function(value) {
11287
+ return value[1];
11288
+ });
11289
+ var PipelineExpressionBody$2 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$N)(NewlineBinaryOpAllowed), PipelineExpressionBodySameLine), function($skip, $loc, $0, $1, $2) {
11290
+ if (!$2.length) return $skip;
11291
+ return $2;
11292
+ });
11293
+ var PipelineExpressionBody$$ = [PipelineExpressionBody$0, PipelineExpressionBody$1, PipelineExpressionBody$2];
11214
11294
  function PipelineExpressionBody(ctx, state2) {
11215
11295
  return (0, import_lib2.$EVENT_C)(ctx, state2, "PipelineExpressionBody", PipelineExpressionBody$$);
11216
11296
  }
@@ -11241,8 +11321,9 @@ var PipelineTailItem$3 = (0, import_lib2.$TS)((0, import_lib2.$S)(NWTypePostfix,
11241
11321
  body: [" ", $1, ...$2]
11242
11322
  });
11243
11323
  });
11244
- var PipelineTailItem$4 = (0, import_lib2.$T)((0, import_lib2.$S)(PipelineHeadItem), function(value) {
11245
- return value[0];
11324
+ var PipelineTailItem$4 = (0, import_lib2.$TS)((0, import_lib2.$S)(ForbidNewlineBinaryOp, (0, import_lib2.$E)(PipelineHeadItem), RestoreNewlineBinaryOp), function($skip, $loc, $0, $1, $2, $3) {
11325
+ if (!$2) return $skip;
11326
+ return $2;
11246
11327
  });
11247
11328
  var PipelineTailItem$$ = [PipelineTailItem$0, PipelineTailItem$1, PipelineTailItem$2, PipelineTailItem$3, PipelineTailItem$4];
11248
11329
  function PipelineTailItem(ctx, state2) {
@@ -11839,9 +11920,8 @@ var LeftHandSideExpression$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, impo
11839
11920
  expression
11840
11921
  };
11841
11922
  });
11842
- var LeftHandSideExpression$1 = NamedBindingPattern;
11843
- var LeftHandSideExpression$2 = CallExpression;
11844
- var LeftHandSideExpression$$ = [LeftHandSideExpression$0, LeftHandSideExpression$1, LeftHandSideExpression$2];
11923
+ var LeftHandSideExpression$1 = CallExpression;
11924
+ var LeftHandSideExpression$$ = [LeftHandSideExpression$0, LeftHandSideExpression$1];
11845
11925
  function LeftHandSideExpression(ctx, state2) {
11846
11926
  return (0, import_lib2.$EVENT_C)(ctx, state2, "LeftHandSideExpression", LeftHandSideExpression$$);
11847
11927
  }
@@ -13296,14 +13376,21 @@ var OperatorAssociativity$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, impor
13296
13376
  function OperatorAssociativity(ctx, state2) {
13297
13377
  return (0, import_lib2.$EVENT)(ctx, state2, "OperatorAssociativity", OperatorAssociativity$0);
13298
13378
  }
13299
- var ThinArrowFunction$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)((0, import_lib2.$S)(Async, _)), ArrowParameters, (0, import_lib2.$E)(ReturnTypeSuffix), (0, import_lib2.$E)(_), Arrow, (0, import_lib2.$C)(BracedObjectSingleLineStatements, NoCommaBracedOrEmptyBlock)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
13379
+ var ThinArrowFunction$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)((0, import_lib2.$S)(Async, _)), ArrowParameters, (0, import_lib2.$E)(ReturnTypeSuffix), (0, import_lib2.$E)(_), ThinArrow, (0, import_lib2.$C)(BracedObjectSingleLineStatements, NoCommaBracedOrEmptyBlock)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
13300
13380
  var async = $1;
13301
13381
  var parameters = $2;
13302
13382
  var returnType = $3;
13383
+ var ws = $4;
13303
13384
  var arrow = $5;
13304
13385
  var block = $6;
13305
13386
  if (!async) async = [];
13306
13387
  const generator = [];
13388
+ if ((!parameters.implicit || returnType || ws) && !block.bare) {
13389
+ const [first, ...rest] = block.children;
13390
+ if (first === " {" || first?.[0]?.token === " ") {
13391
+ block = { ...block, children: [first.slice(1), ...rest] };
13392
+ }
13393
+ }
13307
13394
  return {
13308
13395
  type: "FunctionExpression",
13309
13396
  id: void 0,
@@ -13328,6 +13415,7 @@ var ThinArrowFunction$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_li
13328
13415
  generator,
13329
13416
  parameters,
13330
13417
  returnType,
13418
+ ws,
13331
13419
  block
13332
13420
  ]
13333
13421
  };
@@ -13335,11 +13423,11 @@ var ThinArrowFunction$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_li
13335
13423
  function ThinArrowFunction(ctx, state2) {
13336
13424
  return (0, import_lib2.$EVENT)(ctx, state2, "ThinArrowFunction", ThinArrowFunction$0);
13337
13425
  }
13338
- var Arrow$0 = (0, import_lib2.$TV)((0, import_lib2.$C)((0, import_lib2.$EXPECT)($L35, 'Arrow "->"'), (0, import_lib2.$EXPECT)($L36, 'Arrow "\u2192"')), function($skip, $loc, $0, $1) {
13426
+ var ThinArrow$0 = (0, import_lib2.$TV)((0, import_lib2.$C)((0, import_lib2.$EXPECT)($L35, 'ThinArrow "->"'), (0, import_lib2.$EXPECT)($L36, 'ThinArrow "\u2192"')), function($skip, $loc, $0, $1) {
13339
13427
  return { $loc, token: "->" };
13340
13428
  });
13341
- function Arrow(ctx, state2) {
13342
- return (0, import_lib2.$EVENT)(ctx, state2, "Arrow", Arrow$0);
13429
+ function ThinArrow(ctx, state2) {
13430
+ return (0, import_lib2.$EVENT)(ctx, state2, "ThinArrow", ThinArrow$0);
13343
13431
  }
13344
13432
  var ExplicitBlock$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(_), OpenBrace, AllowAll, (0, import_lib2.$E)((0, import_lib2.$C)(NestedBlockStatements, SingleLineStatements, EmptyBracedContent)), RestoreAll, __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
13345
13433
  var ws1 = $1;
@@ -17997,8 +18085,10 @@ function CoffeeHereCommentStart(ctx, state2) {
17997
18085
  var InlineComment$0 = (0, import_lib2.$TR)((0, import_lib2.$EXPECT)($R74, "InlineComment /\\/\\*(?:(?!\\*\\/)[^\\r\\n])*\\*\\//"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
17998
18086
  return { $loc, token: $0 };
17999
18087
  });
18088
+ var InlineComment$1 = CoffeeMultiLineComment;
18089
+ var InlineComment$$ = [InlineComment$0, InlineComment$1];
18000
18090
  function InlineComment(ctx, state2) {
18001
- return (0, import_lib2.$EVENT)(ctx, state2, "InlineComment", InlineComment$0);
18091
+ return (0, import_lib2.$EVENT_C)(ctx, state2, "InlineComment", InlineComment$$);
18002
18092
  }
18003
18093
  var RestOfLine$0 = (0, import_lib2.$S)((0, import_lib2.$Q)((0, import_lib2.$C)(NonNewlineWhitespace, Comment)), EOL);
18004
18094
  function RestOfLine(ctx, state2) {
@@ -18008,7 +18098,7 @@ var TrailingComment$0 = (0, import_lib2.$S)((0, import_lib2.$E)(_), (0, import_l
18008
18098
  function TrailingComment(ctx, state2) {
18009
18099
  return (0, import_lib2.$EVENT)(ctx, state2, "TrailingComment", TrailingComment$0);
18010
18100
  }
18011
- var _$0 = (0, import_lib2.$T)((0, import_lib2.$S)((0, import_lib2.$EXPECT)($R75, "_ /(?=[ \\t\\/\\\\])/"), (0, import_lib2.$P)((0, import_lib2.$C)(NonNewlineWhitespace, InlineComment))), function(value) {
18101
+ var _$0 = (0, import_lib2.$T)((0, import_lib2.$S)((0, import_lib2.$EXPECT)($R75, "_ /(?=[ \\t\\/\\\\#])/"), (0, import_lib2.$P)((0, import_lib2.$C)(NonNewlineWhitespace, InlineComment))), function(value) {
18012
18102
  return value[1];
18013
18103
  });
18014
18104
  function _(ctx, state2) {
@@ -22177,8 +22267,9 @@ ${counts}`;
22177
22267
  const code = generate_civet_default(ast2, options);
22178
22268
  checkErrors();
22179
22269
  if (options.inlineMap) {
22270
+ const outputFilename = options.outputFilename ?? (options.js ? filename2 + ".jsx" : filename2 + ".tsx");
22180
22271
  return `${code}
22181
- ${options.sourceMap.comment(filename2, filename2 + ".tsx")}`;
22272
+ ${options.sourceMap.comment(filename2, outputFilename)}`;
22182
22273
  } else {
22183
22274
  return {
22184
22275
  code,