@danielx/civet 0.5.88 → 0.5.90

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.mjs CHANGED
@@ -41,7 +41,7 @@ var require_lib = __commonJS({
41
41
  children: block.children === block.expressions ? expressions : block.children.map((c) => c === block.expressions ? expressions : c)
42
42
  };
43
43
  if (block.bare) {
44
- block.children = [[" {\n", indent], ...block.children, "}"];
44
+ block.children = [[" {"], ...block.children, "}"];
45
45
  block.bare = false;
46
46
  }
47
47
  }
@@ -149,8 +149,16 @@ var require_lib = __commonJS({
149
149
  }
150
150
  function getIndent(statement) {
151
151
  let indent = statement?.[0];
152
- if (Array.isArray(indent))
153
- indent = indent[indent.length - 1];
152
+ if (Array.isArray(indent)) {
153
+ indent = indent.flat(Infinity);
154
+ return indent.filter((n) => n && !(n.type === "Comment")).map((n) => {
155
+ if (typeof n === "string")
156
+ return n;
157
+ if (n.token != null)
158
+ return n.token;
159
+ return "";
160
+ });
161
+ }
154
162
  return indent;
155
163
  }
156
164
  function hasAwait(exp) {
@@ -316,7 +324,7 @@ var require_lib = __commonJS({
316
324
  varLet = [",", ...varName, " = ", counterRef];
317
325
  } else {
318
326
  blockPrefix = [
319
- ["", forDeclaration, " = ", counterRef, ";\n"]
327
+ ["", forDeclaration, " = ", counterRef, ";"]
320
328
  ];
321
329
  }
322
330
  } else if (forDeclaration) {
@@ -425,16 +433,18 @@ var require_lib = __commonJS({
425
433
  }
426
434
  let [splices, thisAssignments] = gatherBindingCode(id);
427
435
  splices = splices.map((s) => [", ", s]);
428
- thisAssignments = thisAssignments.map((a) => [";", a]);
436
+ thisAssignments = thisAssignments.map((a) => ["", a, ";"]);
429
437
  const binding = [c, id, suffix, ...ws];
430
- const initializer = [ca, e, ...splices, ...thisAssignments];
438
+ const initializer = [ca, e];
431
439
  const children = [binding, initializer];
432
440
  return {
433
441
  type: "Declaration",
434
442
  names: id.names,
435
443
  children,
436
444
  binding,
437
- initializer
445
+ initializer,
446
+ splices,
447
+ thisAssignments
438
448
  };
439
449
  }
440
450
  function processLetAssignmentDeclaration(l, id, suffix, ws, la, e) {
@@ -447,18 +457,87 @@ var require_lib = __commonJS({
447
457
  };
448
458
  let [splices, thisAssignments] = gatherBindingCode(id);
449
459
  splices = splices.map((s) => [", ", s]);
450
- thisAssignments = thisAssignments.map((a) => [";", a]);
460
+ thisAssignments = thisAssignments.map((a) => ["", a, ";"]);
451
461
  const binding = [l, id, suffix, ...ws];
452
- const initializer = [la, e, ...splices, ...thisAssignments];
462
+ const initializer = [la, e];
453
463
  const children = [binding, initializer];
454
464
  return {
455
465
  type: "Declaration",
456
466
  names: id.names,
457
467
  children,
458
468
  binding,
459
- initializer
469
+ initializer,
470
+ splices,
471
+ thisAssignments
460
472
  };
461
473
  }
474
+ function processUnaryExpression(pre, exp, post) {
475
+ if (post?.token === "?") {
476
+ post = {
477
+ $loc: post.$loc,
478
+ token: " != null"
479
+ };
480
+ switch (exp.type) {
481
+ case "Identifier":
482
+ case "Literal":
483
+ return {
484
+ ...exp,
485
+ children: [...pre, ...exp.children, post]
486
+ };
487
+ default:
488
+ const expression = {
489
+ ...exp,
490
+ children: [...pre, "(", exp.children, ")", post]
491
+ };
492
+ return {
493
+ type: "ParenthesizedExpression",
494
+ children: ["(", expression, ")"],
495
+ expression
496
+ };
497
+ }
498
+ }
499
+ if (exp.type === "Literal") {
500
+ if (pre.length === 1 && pre[0].token === "-") {
501
+ const children = [pre[0], ...exp.children];
502
+ if (post)
503
+ exp.children.push(post);
504
+ return {
505
+ type: "Literal",
506
+ children,
507
+ raw: `-${exp.raw}`
508
+ };
509
+ }
510
+ }
511
+ const l = pre.length;
512
+ if (l) {
513
+ const last = pre[l - 1];
514
+ if (last.type === "Await" && last.op) {
515
+ if (exp.type !== "ParenthesizedExpression") {
516
+ exp = ["(", exp, ")"];
517
+ }
518
+ exp = {
519
+ type: "CallExpression",
520
+ children: [" Promise", last.op, exp]
521
+ };
522
+ }
523
+ }
524
+ if (exp.children) {
525
+ const children = [...pre, ...exp.children];
526
+ if (post)
527
+ children.push(post);
528
+ return Object.assign({}, exp, { children });
529
+ } else if (Array.isArray(exp)) {
530
+ const children = [...pre, ...exp];
531
+ if (post)
532
+ children.push(post);
533
+ return { children };
534
+ } else {
535
+ const children = [...pre, exp];
536
+ if (post)
537
+ children.push(post);
538
+ return { children };
539
+ }
540
+ }
462
541
  module.exports = {
463
542
  blockWithPrefix,
464
543
  clone,
@@ -482,6 +561,7 @@ var require_lib = __commonJS({
482
561
  processCoffeeInterpolation,
483
562
  processConstAssignmentDeclaration,
484
563
  processLetAssignmentDeclaration,
564
+ processUnaryExpression,
485
565
  quoteString,
486
566
  removeParentPointers
487
567
  };
@@ -1030,6 +1110,7 @@ ${input.slice(result.pos)}
1030
1110
  OperatorDeclaration,
1031
1111
  OperatorSignature,
1032
1112
  AmpersandBlockRHS,
1113
+ AmpersandBlockRHSBody,
1033
1114
  AmpersandUnaryPrefix,
1034
1115
  ThinArrowFunction,
1035
1116
  Arrow,
@@ -1104,6 +1185,7 @@ ${input.slice(result.pos)}
1104
1185
  Xor,
1105
1186
  Xnor,
1106
1187
  UnaryOp,
1188
+ AwaitOp,
1107
1189
  ModuleItem,
1108
1190
  StatementListItem,
1109
1191
  PostfixedStatement,
@@ -1783,7 +1865,8 @@ ${input.slice(result.pos)}
1783
1865
  type: "BlockStatement",
1784
1866
  expressions: statements,
1785
1867
  children: [statements],
1786
- bare: true
1868
+ bare: true,
1869
+ root: true
1787
1870
  });
1788
1871
  return $0;
1789
1872
  });
@@ -2242,7 +2325,7 @@ ${input.slice(result.pos)}
2242
2325
  return result;
2243
2326
  }
2244
2327
  }
2245
- var ArgumentsWithTrailingMemberExpressions$0 = $TS($S(Arguments, TrailingMemberExpressions), function($skip, $loc, $0, $1, $2) {
2328
+ var ArgumentsWithTrailingMemberExpressions$0 = $TS($S(Arguments, AllowedTrailingMemberExpressions), function($skip, $loc, $0, $1, $2) {
2246
2329
  var args = $1;
2247
2330
  var trailing = $2;
2248
2331
  const call = {
@@ -2646,7 +2729,7 @@ ${input.slice(result.pos)}
2646
2729
  var pre = $1;
2647
2730
  var exp = $2;
2648
2731
  var post = $3;
2649
- return module.processUnaryExpression(pre, exp, post);
2732
+ return processUnaryExpression(pre, exp, post);
2650
2733
  });
2651
2734
  var UnaryExpression$1 = $TS($S(CoffeeDoEnabled, Do, __, $C($S(LeftHandSideExpression, $N($S(__, AssignmentOpSymbol))), ArrowFunction, ExtendedExpression)), function($skip, $loc, $0, $1, $2, $3, $4) {
2652
2735
  var ws = $3;
@@ -6260,7 +6343,34 @@ ${input.slice(result.pos)}
6260
6343
  return result;
6261
6344
  }
6262
6345
  }
6263
- var AmpersandBlockRHS$0 = $TS($S($E($S($N(_), $P(CallExpressionRest))), $E($S($N($EXPECT($R3, fail, "AmpersandBlockRHS /[&]/")), $P(BinaryOpRHS)))), function($skip, $loc, $0, $1, $2) {
6346
+ var AmpersandBlockRHS$0 = $TS($S(ForbidTrailingMemberProperty, $E(AmpersandBlockRHSBody), RestoreTrailingMemberProperty), function($skip, $loc, $0, $1, $2, $3) {
6347
+ if (!$2)
6348
+ return $skip;
6349
+ return $2;
6350
+ });
6351
+ function AmpersandBlockRHS(state) {
6352
+ let eventData;
6353
+ if (state.events) {
6354
+ const result = state.events.enter?.("AmpersandBlockRHS", state);
6355
+ if (result) {
6356
+ if (result.cache)
6357
+ return result.cache;
6358
+ eventData = result.data;
6359
+ }
6360
+ }
6361
+ if (state.tokenize) {
6362
+ const result = $TOKEN("AmpersandBlockRHS", state, AmpersandBlockRHS$0(state));
6363
+ if (state.events)
6364
+ state.events.exit?.("AmpersandBlockRHS", state, result, eventData);
6365
+ return result;
6366
+ } else {
6367
+ const result = AmpersandBlockRHS$0(state);
6368
+ if (state.events)
6369
+ state.events.exit?.("AmpersandBlockRHS", state, result, eventData);
6370
+ return result;
6371
+ }
6372
+ }
6373
+ var AmpersandBlockRHSBody$0 = $TS($S($E($S($N(_), $P(CallExpressionRest))), $E($S($N($EXPECT($R3, fail, "AmpersandBlockRHSBody /[&]/")), $P(BinaryOpRHS)))), function($skip, $loc, $0, $1, $2) {
6264
6374
  var callExpRest = $1;
6265
6375
  var binopRHS = $2;
6266
6376
  if (!callExpRest && !binopRHS)
@@ -6287,10 +6397,10 @@ ${input.slice(result.pos)}
6287
6397
  }
6288
6398
  return exp;
6289
6399
  });
6290
- function AmpersandBlockRHS(state) {
6400
+ function AmpersandBlockRHSBody(state) {
6291
6401
  let eventData;
6292
6402
  if (state.events) {
6293
- const result = state.events.enter?.("AmpersandBlockRHS", state);
6403
+ const result = state.events.enter?.("AmpersandBlockRHSBody", state);
6294
6404
  if (result) {
6295
6405
  if (result.cache)
6296
6406
  return result.cache;
@@ -6298,14 +6408,14 @@ ${input.slice(result.pos)}
6298
6408
  }
6299
6409
  }
6300
6410
  if (state.tokenize) {
6301
- const result = $TOKEN("AmpersandBlockRHS", state, AmpersandBlockRHS$0(state));
6411
+ const result = $TOKEN("AmpersandBlockRHSBody", state, AmpersandBlockRHSBody$0(state));
6302
6412
  if (state.events)
6303
- state.events.exit?.("AmpersandBlockRHS", state, result, eventData);
6413
+ state.events.exit?.("AmpersandBlockRHSBody", state, result, eventData);
6304
6414
  return result;
6305
6415
  } else {
6306
- const result = AmpersandBlockRHS$0(state);
6416
+ const result = AmpersandBlockRHSBody$0(state);
6307
6417
  if (state.events)
6308
- state.events.exit?.("AmpersandBlockRHS", state, result, eventData);
6418
+ state.events.exit?.("AmpersandBlockRHSBody", state, result, eventData);
6309
6419
  return result;
6310
6420
  }
6311
6421
  }
@@ -6887,17 +6997,10 @@ ${input.slice(result.pos)}
6887
6997
  if (!statements.length)
6888
6998
  return $skip;
6889
6999
  statements = statements.flat();
6890
- const first = statements[0];
6891
- const ws = first[0];
6892
- const indent = ws.at(-1);
6893
- statements = [
6894
- [indent, ...first.slice(1)],
6895
- ...statements.slice(1)
6896
- ];
6897
7000
  return {
6898
7001
  type: "BlockStatement",
6899
7002
  expressions: statements,
6900
- children: [ws.slice(0, -1), statements],
7003
+ children: [statements],
6901
7004
  bare: true
6902
7005
  };
6903
7006
  });
@@ -9037,8 +9140,9 @@ ${input.slice(result.pos)}
9037
9140
  var UnaryOp$0 = $TR($EXPECT($R9, fail, "UnaryOp /(?!\\+\\+|--)[!~+-](?!\\s|[!~+-]*&)/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
9038
9141
  return { $loc, token: $0 };
9039
9142
  });
9040
- var UnaryOp$1 = $S($C(Await, Delete, Void, Typeof), __);
9041
- var UnaryOp$2 = Not;
9143
+ var UnaryOp$1 = AwaitOp;
9144
+ var UnaryOp$2 = $S($C(Delete, Void, Typeof), $E(_));
9145
+ var UnaryOp$3 = Not;
9042
9146
  function UnaryOp(state) {
9043
9147
  let eventData;
9044
9148
  if (state.events) {
@@ -9050,17 +9154,52 @@ ${input.slice(result.pos)}
9050
9154
  }
9051
9155
  }
9052
9156
  if (state.tokenize) {
9053
- const result = $TOKEN("UnaryOp", state, UnaryOp$0(state) || UnaryOp$1(state) || UnaryOp$2(state));
9157
+ const result = $TOKEN("UnaryOp", state, UnaryOp$0(state) || UnaryOp$1(state) || UnaryOp$2(state) || UnaryOp$3(state));
9054
9158
  if (state.events)
9055
9159
  state.events.exit?.("UnaryOp", state, result, eventData);
9056
9160
  return result;
9057
9161
  } else {
9058
- const result = UnaryOp$0(state) || UnaryOp$1(state) || UnaryOp$2(state);
9162
+ const result = UnaryOp$0(state) || UnaryOp$1(state) || UnaryOp$2(state) || UnaryOp$3(state);
9059
9163
  if (state.events)
9060
9164
  state.events.exit?.("UnaryOp", state, result, eventData);
9061
9165
  return result;
9062
9166
  }
9063
9167
  }
9168
+ var AwaitOp$0 = $TS($S(Await, $E($S(Dot, IdentifierName)), $C(_, $Y(OpenParen))), function($skip, $loc, $0, $1, $2, $3) {
9169
+ var a = $1;
9170
+ var op = $2;
9171
+ var ws = $3;
9172
+ if (op) {
9173
+ return {
9174
+ ...a,
9175
+ op,
9176
+ children: [a, ...ws || []]
9177
+ };
9178
+ }
9179
+ return [a, ...ws || []];
9180
+ });
9181
+ function AwaitOp(state) {
9182
+ let eventData;
9183
+ if (state.events) {
9184
+ const result = state.events.enter?.("AwaitOp", state);
9185
+ if (result) {
9186
+ if (result.cache)
9187
+ return result.cache;
9188
+ eventData = result.data;
9189
+ }
9190
+ }
9191
+ if (state.tokenize) {
9192
+ const result = $TOKEN("AwaitOp", state, AwaitOp$0(state));
9193
+ if (state.events)
9194
+ state.events.exit?.("AwaitOp", state, result, eventData);
9195
+ return result;
9196
+ } else {
9197
+ const result = AwaitOp$0(state);
9198
+ if (state.events)
9199
+ state.events.exit?.("AwaitOp", state, result, eventData);
9200
+ return result;
9201
+ }
9202
+ }
9064
9203
  var ModuleItem$0 = ImportDeclaration;
9065
9204
  var ModuleItem$1 = ExportDeclaration;
9066
9205
  var ModuleItem$2 = StatementListItem;
@@ -10096,13 +10235,12 @@ ${input.slice(result.pos)}
10096
10235
  });
10097
10236
  var ForStatementControl$1 = $TS($S(CoffeeForLoopsEnabled, CoffeeForStatementParameters, $E(WhenCondition)), function($skip, $loc, $0, $1, $2, $3) {
10098
10237
  if ($3) {
10099
- const indent = module.currentIndent.token + " ";
10100
- const block = "continue\n";
10238
+ const block = "continue;";
10101
10239
  $2 = {
10102
10240
  ...$2,
10103
10241
  blockPrefix: [
10104
10242
  ...$2.blockPrefix,
10105
- [indent, {
10243
+ ["", {
10106
10244
  type: "IfStatement",
10107
10245
  then: block,
10108
10246
  children: ["if (!(", insertTrimmingSpace($3, ""), ")) ", block]
@@ -10169,7 +10307,6 @@ ${input.slice(result.pos)}
10169
10307
  var step = $8;
10170
10308
  var close = $9;
10171
10309
  let blockPrefix = [];
10172
- const indent = module.currentIndent.token + " ";
10173
10310
  exp = insertTrimmingSpace(exp, "");
10174
10311
  declaration = insertTrimmingSpace(declaration, "");
10175
10312
  if (kind.token === "from") {
@@ -10183,14 +10320,14 @@ ${input.slice(result.pos)}
10183
10320
  }
10184
10321
  if (declaration.own) {
10185
10322
  const hasPropRef = module.getRef("hasProp");
10186
- blockPrefix.push([indent, "if (!", hasPropRef, ".call(", exp, ", ", declaration, ")) continue\n"]);
10323
+ blockPrefix.push(["", "if (!", hasPropRef, ".call(", exp, ", ", declaration, ")) continue", ";"]);
10187
10324
  }
10188
10325
  if (index) {
10189
- blockPrefix.push([indent, {
10326
+ blockPrefix.push(["", {
10190
10327
  type: "AssignmentExpression",
10191
10328
  children: [index, " = ", exp, "[", declaration, "]"],
10192
10329
  names: index.names
10193
- }, ";\n"]);
10330
+ }, ";"]);
10194
10331
  }
10195
10332
  kind.token = "in";
10196
10333
  } else if (kind.token === "in") {
@@ -10226,11 +10363,11 @@ ${input.slice(result.pos)}
10226
10363
  assignmentNames.push(...index.names);
10227
10364
  }
10228
10365
  const expRefDec = expRef !== exp ? [expRef, " = ", insertTrimmingSpace(exp, ""), ", "] : [];
10229
- blockPrefix.push([indent, {
10366
+ blockPrefix.push(["", {
10230
10367
  type: "AssignmentExpression",
10231
- children: [varRef, " = ", expRef, "[", indexAssignment, counterRef, "]\n"],
10368
+ children: [varRef, " = ", expRef, "[", indexAssignment, counterRef, "]"],
10232
10369
  names: assignmentNames
10233
- }]);
10370
+ }, ";"]);
10234
10371
  declaration = {
10235
10372
  type: "Declaration",
10236
10373
  children: ["let ", ...expRefDec, counterRef, " = 0, ", lenRef, " = ", expRef, ".length"],
@@ -11149,12 +11286,15 @@ ${input.slice(result.pos)}
11149
11286
  type: "Ref",
11150
11287
  base: "ref"
11151
11288
  };
11152
- const { binding, initializer } = dec;
11289
+ const { binding, initializer, splices, thisAssignments } = dec;
11153
11290
  const initCondition = {
11154
11291
  type: "AssignmentExpression",
11155
11292
  children: [ref, " ", initializer],
11156
11293
  hoistDec: [["", ["let ", ref], ";"]],
11157
- blockPrefix: [["", [binding, "= ", ref], ";\n"]]
11294
+ blockPrefix: [
11295
+ ["", [binding, "= ", ref, ...splices], ";"],
11296
+ ...thisAssignments
11297
+ ]
11158
11298
  };
11159
11299
  return initCondition;
11160
11300
  });
@@ -12549,7 +12689,20 @@ ${input.slice(result.pos)}
12549
12689
  }
12550
12690
  var Declaration$0 = HoistableDeclaration;
12551
12691
  var Declaration$1 = ClassDeclaration;
12552
- var Declaration$2 = LexicalDeclaration;
12692
+ var Declaration$2 = $TV(LexicalDeclaration, function($skip, $loc, $0, $1) {
12693
+ var d = $0;
12694
+ if (d.thisAssignments?.length)
12695
+ return {
12696
+ ...d,
12697
+ children: [...d.children, ...d.splices, ";", ...d.thisAssignments]
12698
+ };
12699
+ if (d.splices?.length)
12700
+ return {
12701
+ ...d,
12702
+ children: [...d.children, ...d.splices]
12703
+ };
12704
+ return d;
12705
+ });
12553
12706
  var Declaration$3 = TypeDeclaration;
12554
12707
  var Declaration$4 = EnumDeclaration;
12555
12708
  var Declaration$5 = OperatorDeclaration;
@@ -12599,12 +12752,21 @@ ${input.slice(result.pos)}
12599
12752
  }
12600
12753
  }
12601
12754
  var LexicalDeclaration$0 = $TS($S(LetOrConst, LexicalBinding, $Q($S(__, Comma, LexicalBinding))), function($skip, $loc, $0, $1, $2, $3) {
12755
+ var d = $1;
12602
12756
  var binding = $2;
12603
12757
  var tail = $3;
12758
+ const { splices, thisAssignments } = binding;
12604
12759
  return {
12605
12760
  type: "Declaration",
12606
12761
  children: $0,
12607
- names: [...binding.names].concat(tail.flatMap(([, , b]) => b.names))
12762
+ names: [...binding.names].concat(tail.flatMap(([, , b]) => b.names)),
12763
+ binding: {
12764
+ ...binding.binding,
12765
+ children: [d, ...binding.binding.children]
12766
+ },
12767
+ initializer: binding.initializer,
12768
+ splices,
12769
+ thisAssignments
12608
12770
  };
12609
12771
  });
12610
12772
  var LexicalDeclaration$1 = $TS($S(InsertConst, $C(BindingPattern, BindingIdentifier), $E(TypeSuffix), __, ConstAssignment, ExtendedExpression), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
@@ -12691,25 +12853,51 @@ ${input.slice(result.pos)}
12691
12853
  return result;
12692
12854
  }
12693
12855
  }
12694
- var LexicalBinding$0 = $TS($S(BindingPattern, $E(TypeSuffix), Initializer), function($skip, $loc, $0, $1, $2, $3) {
12695
- const children = [...$1.children];
12696
- if ($2)
12697
- children.push($2);
12698
- children.push($3);
12856
+ var LexicalBinding$0 = $TS($S(BindingPattern, $E(TypeSuffix), $E(_), Initializer), function($skip, $loc, $0, $1, $2, $3, $4) {
12857
+ var binding = $1;
12858
+ var suffix = $2;
12859
+ var ws = $3;
12860
+ var initializer = $4;
12861
+ const bindingChildren = [...binding.children];
12862
+ if (suffix)
12863
+ bindingChildren.push(suffix);
12864
+ if (ws)
12865
+ bindingChildren.push(...ws);
12866
+ binding = {
12867
+ ...binding,
12868
+ children: bindingChildren
12869
+ };
12870
+ const [splices, thisAssignments] = gatherBindingCode(binding.children);
12699
12871
  return {
12700
- children,
12701
- names: $1.names
12872
+ children: [binding, initializer],
12873
+ names: binding.names,
12874
+ binding,
12875
+ initializer,
12876
+ splices: splices.map((s) => [",", s]),
12877
+ thisAssignments: thisAssignments.map((s) => ["", s, ";"])
12702
12878
  };
12703
12879
  });
12704
- var LexicalBinding$1 = $TS($S(BindingIdentifier, $E(TypeSuffix), $E(Initializer)), function($skip, $loc, $0, $1, $2, $3) {
12705
- const children = [...$1.children];
12706
- if ($2)
12707
- children.push($2);
12708
- if ($3)
12709
- children.push($3);
12880
+ var LexicalBinding$1 = $TS($S(BindingIdentifier, $E(TypeSuffix), $E(_), $E(Initializer)), function($skip, $loc, $0, $1, $2, $3, $4) {
12881
+ var binding = $1;
12882
+ var suffix = $2;
12883
+ var ws = $3;
12884
+ var initializer = $4;
12885
+ const bindingChildren = [...binding.children];
12886
+ if (suffix)
12887
+ bindingChildren.push(suffix);
12888
+ if (ws)
12889
+ bindingChildren.push(...ws);
12890
+ binding = {
12891
+ ...binding,
12892
+ children: bindingChildren
12893
+ };
12710
12894
  return {
12711
- children,
12712
- names: $1.names
12895
+ children: [binding, initializer],
12896
+ names: binding.names,
12897
+ binding,
12898
+ initializer,
12899
+ splices: [],
12900
+ thisAssignments: []
12713
12901
  };
12714
12902
  });
12715
12903
  function LexicalBinding(state) {
@@ -13866,7 +14054,7 @@ ${input.slice(result.pos)}
13866
14054
  }
13867
14055
  }
13868
14056
  var JSSingleLineComment$0 = $TR($EXPECT($R41, fail, "JSSingleLineComment /\\/\\/(?!\\/)[^\\r\\n]*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
13869
- return { $loc, token: $0 };
14057
+ return { type: "Comment", $loc, token: $0 };
13870
14058
  });
13871
14059
  function JSSingleLineComment(state) {
13872
14060
  let eventData;
@@ -13915,7 +14103,7 @@ ${input.slice(result.pos)}
13915
14103
  }
13916
14104
  }
13917
14105
  var JSMultiLineComment$0 = $TV($TEXT($S($EXPECT($L94, fail, 'JSMultiLineComment "/*"'), $Q($S($N($EXPECT($L95, fail, 'JSMultiLineComment "*/"')), $EXPECT($R42, fail, "JSMultiLineComment /./"))), $EXPECT($L95, fail, 'JSMultiLineComment "*/"'))), function($skip, $loc, $0, $1) {
13918
- return { $loc, token: $1 };
14106
+ return { type: "Comment", $loc, token: $1 };
13919
14107
  });
13920
14108
  function JSMultiLineComment(state) {
13921
14109
  let eventData;
@@ -13940,7 +14128,7 @@ ${input.slice(result.pos)}
13940
14128
  }
13941
14129
  }
13942
14130
  var CoffeeSingleLineComment$0 = $TR($EXPECT($R43, fail, "CoffeeSingleLineComment /#(?!##(?!#))([^\\r\\n]*)/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
13943
- return { $loc, token: `//${$1}` };
14131
+ return { type: "Comment", $loc, token: `//${$1}` };
13944
14132
  });
13945
14133
  function CoffeeSingleLineComment(state) {
13946
14134
  let eventData;
@@ -13966,7 +14154,7 @@ ${input.slice(result.pos)}
13966
14154
  }
13967
14155
  var CoffeeMultiLineComment$0 = $TS($S(CoffeeHereCommentStart, $TEXT($EXPECT($R44, fail, "CoffeeMultiLineComment /[^]*?###/"))), function($skip, $loc, $0, $1, $2) {
13968
14156
  $2 = $2.slice(0, $2.length - 3).replace(/\*\//g, "* /");
13969
- return { $loc, token: `/*${$2}*/` };
14157
+ return { type: "Comment", $loc, token: `/*${$2}*/` };
13970
14158
  });
13971
14159
  function CoffeeMultiLineComment(state) {
13972
14160
  let eventData;
@@ -17268,7 +17456,7 @@ ${input.slice(result.pos)}
17268
17456
  var pre = $1;
17269
17457
  var exp = $2;
17270
17458
  var post = $3;
17271
- return module.processUnaryExpression(pre, exp, post);
17459
+ return processUnaryExpression(pre, exp, post);
17272
17460
  });
17273
17461
  function InlineJSXUnaryExpression(state) {
17274
17462
  let eventData;
@@ -21158,60 +21346,6 @@ ${input.slice(result.pos)}
21158
21346
  }
21159
21347
  return node;
21160
21348
  };
21161
- module.processUnaryExpression = (pre, exp, post) => {
21162
- if (post?.token === "?") {
21163
- post = {
21164
- $loc: post.$loc,
21165
- token: " != null"
21166
- };
21167
- switch (exp.type) {
21168
- case "Identifier":
21169
- case "Literal":
21170
- return {
21171
- ...exp,
21172
- children: [...pre, ...exp.children, post]
21173
- };
21174
- default:
21175
- const expression = {
21176
- ...exp,
21177
- children: [...pre, "(", exp.children, ")", post]
21178
- };
21179
- return {
21180
- type: "ParenthesizedExpression",
21181
- children: ["(", expression, ")"],
21182
- expression
21183
- };
21184
- }
21185
- }
21186
- if (exp.type === "Literal") {
21187
- if (pre.length === 1 && pre[0].token === "-") {
21188
- const children = [pre[0], ...exp.children];
21189
- if (post)
21190
- exp.children.push(post);
21191
- return {
21192
- type: "Literal",
21193
- children,
21194
- raw: `-${exp.raw}`
21195
- };
21196
- }
21197
- }
21198
- if (exp.children) {
21199
- const children = [...pre, ...exp.children];
21200
- if (post)
21201
- children.push(post);
21202
- return Object.assign({}, exp, { children });
21203
- } else if (Array.isArray(exp)) {
21204
- const children = [...pre, ...exp];
21205
- if (post)
21206
- children.push(post);
21207
- return { children };
21208
- } else {
21209
- const children = [...pre, exp];
21210
- if (post)
21211
- children.push(post);
21212
- return { children };
21213
- }
21214
- };
21215
21349
  module.needsRef = function(expression, base = "ref") {
21216
21350
  switch (expression.type) {
21217
21351
  case "Ref":
@@ -21478,7 +21612,10 @@ ${input.slice(result.pos)}
21478
21612
  if (exp.else)
21479
21613
  insertReturn(exp.else[2]);
21480
21614
  else
21481
- exp.children.push(["\n", indent, wrapWithReturn()]);
21615
+ exp.children.push(["", {
21616
+ type: "ReturnStatement",
21617
+ children: [";return"]
21618
+ }]);
21482
21619
  return;
21483
21620
  case "PatternMatchingStatement":
21484
21621
  insertReturn(exp.children[0][0]);
@@ -21887,11 +22024,15 @@ ${input.slice(result.pos)}
21887
22024
  const [splices, thisAssignments] = gatherBindingCode(parameters, {
21888
22025
  injectParamProps: f.name === "constructor"
21889
22026
  });
22027
+ const delimiter = {
22028
+ type: "SemicolonDelimiter",
22029
+ children: [";"]
22030
+ };
21890
22031
  const prefix = splices.map((s) => ["let ", s]).concat(thisAssignments).map(
21891
22032
  (s) => s.type ? {
21892
22033
  ...s,
21893
- children: [indent, ...s.children, ";\n"]
21894
- } : [indent, s, ";\n"]
22034
+ children: [indent, ...s.children, delimiter]
22035
+ } : [indent, s, delimiter]
21895
22036
  );
21896
22037
  expressions.unshift(...prefix);
21897
22038
  }
@@ -21950,9 +22091,10 @@ ${input.slice(result.pos)}
21950
22091
  getIndent(block.expressions[0]),
21951
22092
  {
21952
22093
  type: "Declaration",
21953
- children: ["let ", ref, returnType, ";\n"],
22094
+ children: ["let ", ref, returnType],
21954
22095
  names: []
21955
- }
22096
+ },
22097
+ ";"
21956
22098
  ]);
21957
22099
  }
21958
22100
  gatherRecursiveWithinFunction(
@@ -21964,7 +22106,7 @@ ${input.slice(result.pos)}
21964
22106
  });
21965
22107
  if (block.children.at(-2)?.type !== "ReturnStatement") {
21966
22108
  block.expressions.push([
21967
- ["\n", getIndent(block.expressions.at(-1))],
22109
+ [getIndent(block.expressions.at(-1))],
21968
22110
  {
21969
22111
  type: "ReturnStatement",
21970
22112
  expression: ref,
@@ -22448,11 +22590,11 @@ ${input.slice(result.pos)}
22448
22590
  let [splices, thisAssignments] = gatherBindingCode(pattern);
22449
22591
  const patternBindings = nonMatcherBindings(pattern);
22450
22592
  splices = splices.map((s2) => [", ", nonMatcherBindings(s2)]);
22451
- thisAssignments = thisAssignments.map((a) => [indent, a, ";\n"]);
22593
+ thisAssignments = thisAssignments.map((a) => [indent, a, ";"]);
22452
22594
  const duplicateDeclarations = aggregateDuplicateBindings([patternBindings, splices]);
22453
- prefix.push([indent, "const ", patternBindings, " = ", ref, splices, ";\n"]);
22595
+ prefix.push([indent, "const ", patternBindings, " = ", ref, splices, ";"]);
22454
22596
  prefix.push(...thisAssignments);
22455
- prefix.push(...duplicateDeclarations.map((d) => [indent, d, ";\n"]));
22597
+ prefix.push(...duplicateDeclarations.map((d) => [indent, d, ";"]));
22456
22598
  break;
22457
22599
  }
22458
22600
  }
@@ -22607,6 +22749,11 @@ ${input.slice(result.pos)}
22607
22749
  });
22608
22750
  }
22609
22751
  module.processProgram = function(root) {
22752
+ assert.equal(module.forbidClassImplicitCall.length, 1, "forbidClassImplicitCall");
22753
+ assert.equal(module.forbidIndentedApplication.length, 1, "forbidIndentedApplication");
22754
+ assert.equal(module.forbidTrailingMemberProperty.length, 1, "forbidTrailingMemberProperty");
22755
+ assert.equal(module.forbidMultiLineImplicitObjectLiteral.length, 1, "forbidMultiLineImplicitObjectLiteral");
22756
+ assert.equal(module.JSXTagStack.length, 0, "JSXTagStack should be empty");
22610
22757
  addParentPointers(root);
22611
22758
  const { expressions: statements } = root;
22612
22759
  processPipelineExpressions(statements);
@@ -22700,7 +22847,11 @@ ${input.slice(result.pos)}
22700
22847
  });
22701
22848
  if (varIds.length) {
22702
22849
  const indent = getIndent(statements[0]);
22703
- statements.unshift([indent, "var ", varIds.join(", "), "\n"]);
22850
+ let delimiter = ";";
22851
+ if (statements[0][1]?.parent?.root) {
22852
+ delimiter = ";\n";
22853
+ }
22854
+ statements.unshift([indent, "var ", varIds.join(", "), delimiter]);
22704
22855
  }
22705
22856
  scopes.pop();
22706
22857
  }
@@ -23138,9 +23289,17 @@ ${input.slice(result.pos)}
23138
23289
  processCoffeeInterpolation,
23139
23290
  processConstAssignmentDeclaration,
23140
23291
  processLetAssignmentDeclaration,
23292
+ processUnaryExpression,
23141
23293
  quoteString,
23142
23294
  removeParentPointers
23143
23295
  } = require_lib();
23296
+ var assert = {
23297
+ equal(a, b, msg) {
23298
+ if (a !== b) {
23299
+ throw new Error(`Assertion failed [${msg}]: ${a} !== ${b}`);
23300
+ }
23301
+ }
23302
+ };
23144
23303
  }
23145
23304
  });
23146
23305
 
@@ -23568,7 +23727,7 @@ var parse;
23568
23727
  var uncacheable;
23569
23728
  ({ parse } = import_parser.default);
23570
23729
  ({ SourceMap: SourceMap2, base64Encode: base64Encode2 } = util_exports);
23571
- uncacheable = /* @__PURE__ */ new Set(["ActualAssignment", "AllowAll", "AllowClassImplicitCall", "AllowIndentedApplication", "AllowTrailingMemberProperty", "AllowedTrailingMemberExpressions", "ApplicationStart", "Arguments", "ArgumentsWithTrailingMemberExpressions", "ArrowFunction", "ArrowFunctionTail", "AssignmentExpression", "AssignmentExpressionTail", "BinaryOpExpression", "BinaryOpRHS", "BracedBlock", "BracedObjectLiteralContent", "BracedOrEmptyBlock", "CallExpression", "CallExpressionRest", "ClassImplicitCallForbidden", "CoffeeCommentEnabled", "CommaDelimiter", "ConditionalExpression", "Declaration", "Debugger", "ElementListWithIndentedApplicationForbidden", "ElseClause", "Expression", "ExpressionStatement", "ExpressionWithIndentedApplicationForbidden", "ExtendedExpression", "FatArrowBody", "ForbidClassImplicitCall", "ForbidIndentedApplication", "ForbidTrailingMemberProperty", "FunctionDeclaration", "FunctionExpression", "HoistableDeclaration", "ImplicitArguments", "ImplicitInlineObjectPropertyDelimiter", "ImplicitNestedBlock", "IndentedApplicationAllowed", "IndentedFurther", "IndentedJSXChildExpression", "InlineObjectLiteral", "InsertIndent", "JSXChild", "JSXChildren", "JSXElement", "JSXFragment", "JSXImplicitFragment", "JSXMixedChildren", "JSXNested", "JSXNestedChildren", "JSXOptionalClosingElement", "JSXOptionalClosingFragment", "JSXTag", "LeftHandSideExpression", "MemberExpression", "MemberExpressionRest", "Nested", "NestedBindingElement", "NestedBindingElements", "NestedBlockExpression", "NestedBlockExpression", "NestedBlockStatement", "NestedBlockStatements", "NestedClassSignatureElement", "NestedClassSignatureElements", "NestedDeclareElement", "NestedDeclareElements", "NestedElement", "NestedElementList", "NestedImplicitObjectLiteral", "NestedImplicitPropertyDefinition", "NestedImplicitPropertyDefinitions", "NestedInterfaceProperty", "NestedJSXChildExpression", "NestedModuleItem", "NestedModuleItems", "NestedObject", "NestedPropertyDefinitions", "NonSingleBracedBlock", "NotDedented", "ObjectLiteral", "PopIndent", "PopJSXStack", "PostfixedExpression", "PostfixedStatement", "PrimaryExpression", "PushIndent", "PushJSXOpeningElement", "PushJSXOpeningFragment", "RestoreAll", "RestoreClassImplicitCall", "RestoreIndentedApplication", "RestoreTrailingMemberProperty", "RHS", "Samedent", "ShortCircuitExpression", "SingleLineAssignmentExpression", "SingleLineComment", "SingleLineStatements", "SnugNamedProperty", "Statement", "StatementListItem", "SuffixedExpression", "SuffixedStatement", "ThinArrowFunction", "TrackIndented", "TrailingMemberExpressions", "TrailingMemberPropertyAllowed", "TypedJSXElement", "TypedJSXFragment", "UnaryExpression", "UpdateExpression"]);
23730
+ uncacheable = /* @__PURE__ */ new Set(["ActualAssignment", "AllowAll", "AllowClassImplicitCall", "AllowIndentedApplication", "AllowMultiLineImplicitObjectLiteral", "AllowTrailingMemberProperty", "AllowedTrailingMemberExpressions", "ApplicationStart", "Arguments", "ArgumentsWithTrailingMemberExpressions", "ArrowFunction", "ArrowFunctionTail", "AssignmentExpression", "AssignmentExpressionTail", "BinaryOpExpression", "BinaryOpRHS", "BracedBlock", "BracedObjectLiteralContent", "BracedOrEmptyBlock", "CallExpression", "CallExpressionRest", "ClassImplicitCallForbidden", "CoffeeCommentEnabled", "CommaDelimiter", "ConditionalExpression", "Declaration", "Debugger", "ElementListWithIndentedApplicationForbidden", "ElseClause", "Expression", "ExpressionStatement", "ExpressionWithIndentedApplicationForbidden", "ExtendedExpression", "FatArrowBody", "ForbidClassImplicitCall", "ForbidIndentedApplication", "ForbidMultiLineImplicitObjectLiteral", "ForbidTrailingMemberProperty", "FunctionDeclaration", "FunctionExpression", "HoistableDeclaration", "ImplicitArguments", "ImplicitInlineObjectPropertyDelimiter", "ImplicitNestedBlock", "IndentedApplicationAllowed", "IndentedFurther", "IndentedJSXChildExpression", "InlineObjectLiteral", "InsertIndent", "JSXChild", "JSXChildren", "JSXElement", "JSXFragment", "JSXImplicitFragment", "JSXMixedChildren", "JSXNested", "JSXNestedChildren", "JSXOptionalClosingElement", "JSXOptionalClosingFragment", "JSXTag", "LeftHandSideExpression", "MemberExpression", "MemberExpressionRest", "Nested", "NestedBindingElement", "NestedBindingElements", "NestedBlockExpression", "NestedBlockExpression", "NestedBlockStatement", "NestedBlockStatements", "NestedClassSignatureElement", "NestedClassSignatureElements", "NestedDeclareElement", "NestedDeclareElements", "NestedElement", "NestedElementList", "NestedImplicitObjectLiteral", "NestedImplicitPropertyDefinition", "NestedImplicitPropertyDefinitions", "NestedInterfaceProperty", "NestedJSXChildExpression", "NestedModuleItem", "NestedModuleItems", "NestedObject", "NestedPropertyDefinitions", "NonSingleBracedBlock", "NotDedented", "ObjectLiteral", "PopIndent", "PopJSXStack", "PostfixedExpression", "PostfixedStatement", "PrimaryExpression", "PushIndent", "PushJSXOpeningElement", "PushJSXOpeningFragment", "RestoreAll", "RestoreClassImplicitCall", "RestoreMultiLineImplicitObjectLiteral", "RestoreIndentedApplication", "RestoreTrailingMemberProperty", "RHS", "Samedent", "ShortCircuitExpression", "SingleLineAssignmentExpression", "SingleLineComment", "SingleLineStatements", "SnugNamedProperty", "Statement", "StatementListItem", "SuffixedExpression", "SuffixedStatement", "ThinArrowFunction", "TrackIndented", "TrailingMemberExpressions", "TrailingMemberPropertyAllowed", "TypedJSXElement", "TypedJSXFragment", "UnaryExpression", "UpdateExpression"]);
23572
23731
  var compile = function(src, options) {
23573
23732
  var ast, code, events, filename, ref, result, sm, srcMapJSON;
23574
23733
  if (!options) {