@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.js CHANGED
@@ -43,7 +43,7 @@ var require_lib = __commonJS({
43
43
  children: block.children === block.expressions ? expressions : block.children.map((c) => c === block.expressions ? expressions : c)
44
44
  };
45
45
  if (block.bare) {
46
- block.children = [[" {\n", indent], ...block.children, "}"];
46
+ block.children = [[" {"], ...block.children, "}"];
47
47
  block.bare = false;
48
48
  }
49
49
  }
@@ -151,8 +151,16 @@ var require_lib = __commonJS({
151
151
  }
152
152
  function getIndent(statement) {
153
153
  let indent = statement?.[0];
154
- if (Array.isArray(indent))
155
- indent = indent[indent.length - 1];
154
+ if (Array.isArray(indent)) {
155
+ indent = indent.flat(Infinity);
156
+ return indent.filter((n) => n && !(n.type === "Comment")).map((n) => {
157
+ if (typeof n === "string")
158
+ return n;
159
+ if (n.token != null)
160
+ return n.token;
161
+ return "";
162
+ });
163
+ }
156
164
  return indent;
157
165
  }
158
166
  function hasAwait(exp) {
@@ -318,7 +326,7 @@ var require_lib = __commonJS({
318
326
  varLet = [",", ...varName, " = ", counterRef];
319
327
  } else {
320
328
  blockPrefix = [
321
- ["", forDeclaration, " = ", counterRef, ";\n"]
329
+ ["", forDeclaration, " = ", counterRef, ";"]
322
330
  ];
323
331
  }
324
332
  } else if (forDeclaration) {
@@ -427,16 +435,18 @@ var require_lib = __commonJS({
427
435
  }
428
436
  let [splices, thisAssignments] = gatherBindingCode(id);
429
437
  splices = splices.map((s) => [", ", s]);
430
- thisAssignments = thisAssignments.map((a) => [";", a]);
438
+ thisAssignments = thisAssignments.map((a) => ["", a, ";"]);
431
439
  const binding = [c, id, suffix, ...ws];
432
- const initializer = [ca, e, ...splices, ...thisAssignments];
440
+ const initializer = [ca, e];
433
441
  const children = [binding, initializer];
434
442
  return {
435
443
  type: "Declaration",
436
444
  names: id.names,
437
445
  children,
438
446
  binding,
439
- initializer
447
+ initializer,
448
+ splices,
449
+ thisAssignments
440
450
  };
441
451
  }
442
452
  function processLetAssignmentDeclaration(l, id, suffix, ws, la, e) {
@@ -449,18 +459,87 @@ var require_lib = __commonJS({
449
459
  };
450
460
  let [splices, thisAssignments] = gatherBindingCode(id);
451
461
  splices = splices.map((s) => [", ", s]);
452
- thisAssignments = thisAssignments.map((a) => [";", a]);
462
+ thisAssignments = thisAssignments.map((a) => ["", a, ";"]);
453
463
  const binding = [l, id, suffix, ...ws];
454
- const initializer = [la, e, ...splices, ...thisAssignments];
464
+ const initializer = [la, e];
455
465
  const children = [binding, initializer];
456
466
  return {
457
467
  type: "Declaration",
458
468
  names: id.names,
459
469
  children,
460
470
  binding,
461
- initializer
471
+ initializer,
472
+ splices,
473
+ thisAssignments
462
474
  };
463
475
  }
476
+ function processUnaryExpression(pre, exp, post) {
477
+ if (post?.token === "?") {
478
+ post = {
479
+ $loc: post.$loc,
480
+ token: " != null"
481
+ };
482
+ switch (exp.type) {
483
+ case "Identifier":
484
+ case "Literal":
485
+ return {
486
+ ...exp,
487
+ children: [...pre, ...exp.children, post]
488
+ };
489
+ default:
490
+ const expression = {
491
+ ...exp,
492
+ children: [...pre, "(", exp.children, ")", post]
493
+ };
494
+ return {
495
+ type: "ParenthesizedExpression",
496
+ children: ["(", expression, ")"],
497
+ expression
498
+ };
499
+ }
500
+ }
501
+ if (exp.type === "Literal") {
502
+ if (pre.length === 1 && pre[0].token === "-") {
503
+ const children = [pre[0], ...exp.children];
504
+ if (post)
505
+ exp.children.push(post);
506
+ return {
507
+ type: "Literal",
508
+ children,
509
+ raw: `-${exp.raw}`
510
+ };
511
+ }
512
+ }
513
+ const l = pre.length;
514
+ if (l) {
515
+ const last = pre[l - 1];
516
+ if (last.type === "Await" && last.op) {
517
+ if (exp.type !== "ParenthesizedExpression") {
518
+ exp = ["(", exp, ")"];
519
+ }
520
+ exp = {
521
+ type: "CallExpression",
522
+ children: [" Promise", last.op, exp]
523
+ };
524
+ }
525
+ }
526
+ if (exp.children) {
527
+ const children = [...pre, ...exp.children];
528
+ if (post)
529
+ children.push(post);
530
+ return Object.assign({}, exp, { children });
531
+ } else if (Array.isArray(exp)) {
532
+ const children = [...pre, ...exp];
533
+ if (post)
534
+ children.push(post);
535
+ return { children };
536
+ } else {
537
+ const children = [...pre, exp];
538
+ if (post)
539
+ children.push(post);
540
+ return { children };
541
+ }
542
+ }
464
543
  module2.exports = {
465
544
  blockWithPrefix,
466
545
  clone,
@@ -484,6 +563,7 @@ var require_lib = __commonJS({
484
563
  processCoffeeInterpolation,
485
564
  processConstAssignmentDeclaration,
486
565
  processLetAssignmentDeclaration,
566
+ processUnaryExpression,
487
567
  quoteString,
488
568
  removeParentPointers
489
569
  };
@@ -1032,6 +1112,7 @@ ${input.slice(result.pos)}
1032
1112
  OperatorDeclaration,
1033
1113
  OperatorSignature,
1034
1114
  AmpersandBlockRHS,
1115
+ AmpersandBlockRHSBody,
1035
1116
  AmpersandUnaryPrefix,
1036
1117
  ThinArrowFunction,
1037
1118
  Arrow,
@@ -1106,6 +1187,7 @@ ${input.slice(result.pos)}
1106
1187
  Xor,
1107
1188
  Xnor,
1108
1189
  UnaryOp,
1190
+ AwaitOp,
1109
1191
  ModuleItem,
1110
1192
  StatementListItem,
1111
1193
  PostfixedStatement,
@@ -1785,7 +1867,8 @@ ${input.slice(result.pos)}
1785
1867
  type: "BlockStatement",
1786
1868
  expressions: statements,
1787
1869
  children: [statements],
1788
- bare: true
1870
+ bare: true,
1871
+ root: true
1789
1872
  });
1790
1873
  return $0;
1791
1874
  });
@@ -2244,7 +2327,7 @@ ${input.slice(result.pos)}
2244
2327
  return result;
2245
2328
  }
2246
2329
  }
2247
- var ArgumentsWithTrailingMemberExpressions$0 = $TS($S(Arguments, TrailingMemberExpressions), function($skip, $loc, $0, $1, $2) {
2330
+ var ArgumentsWithTrailingMemberExpressions$0 = $TS($S(Arguments, AllowedTrailingMemberExpressions), function($skip, $loc, $0, $1, $2) {
2248
2331
  var args = $1;
2249
2332
  var trailing = $2;
2250
2333
  const call = {
@@ -2648,7 +2731,7 @@ ${input.slice(result.pos)}
2648
2731
  var pre = $1;
2649
2732
  var exp = $2;
2650
2733
  var post = $3;
2651
- return module2.processUnaryExpression(pre, exp, post);
2734
+ return processUnaryExpression(pre, exp, post);
2652
2735
  });
2653
2736
  var UnaryExpression$1 = $TS($S(CoffeeDoEnabled, Do, __, $C($S(LeftHandSideExpression, $N($S(__, AssignmentOpSymbol))), ArrowFunction, ExtendedExpression)), function($skip, $loc, $0, $1, $2, $3, $4) {
2654
2737
  var ws = $3;
@@ -6262,7 +6345,34 @@ ${input.slice(result.pos)}
6262
6345
  return result;
6263
6346
  }
6264
6347
  }
6265
- 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) {
6348
+ var AmpersandBlockRHS$0 = $TS($S(ForbidTrailingMemberProperty, $E(AmpersandBlockRHSBody), RestoreTrailingMemberProperty), function($skip, $loc, $0, $1, $2, $3) {
6349
+ if (!$2)
6350
+ return $skip;
6351
+ return $2;
6352
+ });
6353
+ function AmpersandBlockRHS(state) {
6354
+ let eventData;
6355
+ if (state.events) {
6356
+ const result = state.events.enter?.("AmpersandBlockRHS", state);
6357
+ if (result) {
6358
+ if (result.cache)
6359
+ return result.cache;
6360
+ eventData = result.data;
6361
+ }
6362
+ }
6363
+ if (state.tokenize) {
6364
+ const result = $TOKEN("AmpersandBlockRHS", state, AmpersandBlockRHS$0(state));
6365
+ if (state.events)
6366
+ state.events.exit?.("AmpersandBlockRHS", state, result, eventData);
6367
+ return result;
6368
+ } else {
6369
+ const result = AmpersandBlockRHS$0(state);
6370
+ if (state.events)
6371
+ state.events.exit?.("AmpersandBlockRHS", state, result, eventData);
6372
+ return result;
6373
+ }
6374
+ }
6375
+ 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) {
6266
6376
  var callExpRest = $1;
6267
6377
  var binopRHS = $2;
6268
6378
  if (!callExpRest && !binopRHS)
@@ -6289,10 +6399,10 @@ ${input.slice(result.pos)}
6289
6399
  }
6290
6400
  return exp;
6291
6401
  });
6292
- function AmpersandBlockRHS(state) {
6402
+ function AmpersandBlockRHSBody(state) {
6293
6403
  let eventData;
6294
6404
  if (state.events) {
6295
- const result = state.events.enter?.("AmpersandBlockRHS", state);
6405
+ const result = state.events.enter?.("AmpersandBlockRHSBody", state);
6296
6406
  if (result) {
6297
6407
  if (result.cache)
6298
6408
  return result.cache;
@@ -6300,14 +6410,14 @@ ${input.slice(result.pos)}
6300
6410
  }
6301
6411
  }
6302
6412
  if (state.tokenize) {
6303
- const result = $TOKEN("AmpersandBlockRHS", state, AmpersandBlockRHS$0(state));
6413
+ const result = $TOKEN("AmpersandBlockRHSBody", state, AmpersandBlockRHSBody$0(state));
6304
6414
  if (state.events)
6305
- state.events.exit?.("AmpersandBlockRHS", state, result, eventData);
6415
+ state.events.exit?.("AmpersandBlockRHSBody", state, result, eventData);
6306
6416
  return result;
6307
6417
  } else {
6308
- const result = AmpersandBlockRHS$0(state);
6418
+ const result = AmpersandBlockRHSBody$0(state);
6309
6419
  if (state.events)
6310
- state.events.exit?.("AmpersandBlockRHS", state, result, eventData);
6420
+ state.events.exit?.("AmpersandBlockRHSBody", state, result, eventData);
6311
6421
  return result;
6312
6422
  }
6313
6423
  }
@@ -6889,17 +6999,10 @@ ${input.slice(result.pos)}
6889
6999
  if (!statements.length)
6890
7000
  return $skip;
6891
7001
  statements = statements.flat();
6892
- const first = statements[0];
6893
- const ws = first[0];
6894
- const indent = ws.at(-1);
6895
- statements = [
6896
- [indent, ...first.slice(1)],
6897
- ...statements.slice(1)
6898
- ];
6899
7002
  return {
6900
7003
  type: "BlockStatement",
6901
7004
  expressions: statements,
6902
- children: [ws.slice(0, -1), statements],
7005
+ children: [statements],
6903
7006
  bare: true
6904
7007
  };
6905
7008
  });
@@ -9039,8 +9142,9 @@ ${input.slice(result.pos)}
9039
9142
  var UnaryOp$0 = $TR($EXPECT($R9, fail, "UnaryOp /(?!\\+\\+|--)[!~+-](?!\\s|[!~+-]*&)/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
9040
9143
  return { $loc, token: $0 };
9041
9144
  });
9042
- var UnaryOp$1 = $S($C(Await, Delete, Void, Typeof), __);
9043
- var UnaryOp$2 = Not;
9145
+ var UnaryOp$1 = AwaitOp;
9146
+ var UnaryOp$2 = $S($C(Delete, Void, Typeof), $E(_));
9147
+ var UnaryOp$3 = Not;
9044
9148
  function UnaryOp(state) {
9045
9149
  let eventData;
9046
9150
  if (state.events) {
@@ -9052,17 +9156,52 @@ ${input.slice(result.pos)}
9052
9156
  }
9053
9157
  }
9054
9158
  if (state.tokenize) {
9055
- const result = $TOKEN("UnaryOp", state, UnaryOp$0(state) || UnaryOp$1(state) || UnaryOp$2(state));
9159
+ const result = $TOKEN("UnaryOp", state, UnaryOp$0(state) || UnaryOp$1(state) || UnaryOp$2(state) || UnaryOp$3(state));
9056
9160
  if (state.events)
9057
9161
  state.events.exit?.("UnaryOp", state, result, eventData);
9058
9162
  return result;
9059
9163
  } else {
9060
- const result = UnaryOp$0(state) || UnaryOp$1(state) || UnaryOp$2(state);
9164
+ const result = UnaryOp$0(state) || UnaryOp$1(state) || UnaryOp$2(state) || UnaryOp$3(state);
9061
9165
  if (state.events)
9062
9166
  state.events.exit?.("UnaryOp", state, result, eventData);
9063
9167
  return result;
9064
9168
  }
9065
9169
  }
9170
+ var AwaitOp$0 = $TS($S(Await, $E($S(Dot, IdentifierName)), $C(_, $Y(OpenParen))), function($skip, $loc, $0, $1, $2, $3) {
9171
+ var a = $1;
9172
+ var op = $2;
9173
+ var ws = $3;
9174
+ if (op) {
9175
+ return {
9176
+ ...a,
9177
+ op,
9178
+ children: [a, ...ws || []]
9179
+ };
9180
+ }
9181
+ return [a, ...ws || []];
9182
+ });
9183
+ function AwaitOp(state) {
9184
+ let eventData;
9185
+ if (state.events) {
9186
+ const result = state.events.enter?.("AwaitOp", state);
9187
+ if (result) {
9188
+ if (result.cache)
9189
+ return result.cache;
9190
+ eventData = result.data;
9191
+ }
9192
+ }
9193
+ if (state.tokenize) {
9194
+ const result = $TOKEN("AwaitOp", state, AwaitOp$0(state));
9195
+ if (state.events)
9196
+ state.events.exit?.("AwaitOp", state, result, eventData);
9197
+ return result;
9198
+ } else {
9199
+ const result = AwaitOp$0(state);
9200
+ if (state.events)
9201
+ state.events.exit?.("AwaitOp", state, result, eventData);
9202
+ return result;
9203
+ }
9204
+ }
9066
9205
  var ModuleItem$0 = ImportDeclaration;
9067
9206
  var ModuleItem$1 = ExportDeclaration;
9068
9207
  var ModuleItem$2 = StatementListItem;
@@ -10098,13 +10237,12 @@ ${input.slice(result.pos)}
10098
10237
  });
10099
10238
  var ForStatementControl$1 = $TS($S(CoffeeForLoopsEnabled, CoffeeForStatementParameters, $E(WhenCondition)), function($skip, $loc, $0, $1, $2, $3) {
10100
10239
  if ($3) {
10101
- const indent = module2.currentIndent.token + " ";
10102
- const block = "continue\n";
10240
+ const block = "continue;";
10103
10241
  $2 = {
10104
10242
  ...$2,
10105
10243
  blockPrefix: [
10106
10244
  ...$2.blockPrefix,
10107
- [indent, {
10245
+ ["", {
10108
10246
  type: "IfStatement",
10109
10247
  then: block,
10110
10248
  children: ["if (!(", insertTrimmingSpace($3, ""), ")) ", block]
@@ -10171,7 +10309,6 @@ ${input.slice(result.pos)}
10171
10309
  var step = $8;
10172
10310
  var close = $9;
10173
10311
  let blockPrefix = [];
10174
- const indent = module2.currentIndent.token + " ";
10175
10312
  exp = insertTrimmingSpace(exp, "");
10176
10313
  declaration = insertTrimmingSpace(declaration, "");
10177
10314
  if (kind.token === "from") {
@@ -10185,14 +10322,14 @@ ${input.slice(result.pos)}
10185
10322
  }
10186
10323
  if (declaration.own) {
10187
10324
  const hasPropRef = module2.getRef("hasProp");
10188
- blockPrefix.push([indent, "if (!", hasPropRef, ".call(", exp, ", ", declaration, ")) continue\n"]);
10325
+ blockPrefix.push(["", "if (!", hasPropRef, ".call(", exp, ", ", declaration, ")) continue", ";"]);
10189
10326
  }
10190
10327
  if (index) {
10191
- blockPrefix.push([indent, {
10328
+ blockPrefix.push(["", {
10192
10329
  type: "AssignmentExpression",
10193
10330
  children: [index, " = ", exp, "[", declaration, "]"],
10194
10331
  names: index.names
10195
- }, ";\n"]);
10332
+ }, ";"]);
10196
10333
  }
10197
10334
  kind.token = "in";
10198
10335
  } else if (kind.token === "in") {
@@ -10228,11 +10365,11 @@ ${input.slice(result.pos)}
10228
10365
  assignmentNames.push(...index.names);
10229
10366
  }
10230
10367
  const expRefDec = expRef !== exp ? [expRef, " = ", insertTrimmingSpace(exp, ""), ", "] : [];
10231
- blockPrefix.push([indent, {
10368
+ blockPrefix.push(["", {
10232
10369
  type: "AssignmentExpression",
10233
- children: [varRef, " = ", expRef, "[", indexAssignment, counterRef, "]\n"],
10370
+ children: [varRef, " = ", expRef, "[", indexAssignment, counterRef, "]"],
10234
10371
  names: assignmentNames
10235
- }]);
10372
+ }, ";"]);
10236
10373
  declaration = {
10237
10374
  type: "Declaration",
10238
10375
  children: ["let ", ...expRefDec, counterRef, " = 0, ", lenRef, " = ", expRef, ".length"],
@@ -11151,12 +11288,15 @@ ${input.slice(result.pos)}
11151
11288
  type: "Ref",
11152
11289
  base: "ref"
11153
11290
  };
11154
- const { binding, initializer } = dec;
11291
+ const { binding, initializer, splices, thisAssignments } = dec;
11155
11292
  const initCondition = {
11156
11293
  type: "AssignmentExpression",
11157
11294
  children: [ref, " ", initializer],
11158
11295
  hoistDec: [["", ["let ", ref], ";"]],
11159
- blockPrefix: [["", [binding, "= ", ref], ";\n"]]
11296
+ blockPrefix: [
11297
+ ["", [binding, "= ", ref, ...splices], ";"],
11298
+ ...thisAssignments
11299
+ ]
11160
11300
  };
11161
11301
  return initCondition;
11162
11302
  });
@@ -12551,7 +12691,20 @@ ${input.slice(result.pos)}
12551
12691
  }
12552
12692
  var Declaration$0 = HoistableDeclaration;
12553
12693
  var Declaration$1 = ClassDeclaration;
12554
- var Declaration$2 = LexicalDeclaration;
12694
+ var Declaration$2 = $TV(LexicalDeclaration, function($skip, $loc, $0, $1) {
12695
+ var d = $0;
12696
+ if (d.thisAssignments?.length)
12697
+ return {
12698
+ ...d,
12699
+ children: [...d.children, ...d.splices, ";", ...d.thisAssignments]
12700
+ };
12701
+ if (d.splices?.length)
12702
+ return {
12703
+ ...d,
12704
+ children: [...d.children, ...d.splices]
12705
+ };
12706
+ return d;
12707
+ });
12555
12708
  var Declaration$3 = TypeDeclaration;
12556
12709
  var Declaration$4 = EnumDeclaration;
12557
12710
  var Declaration$5 = OperatorDeclaration;
@@ -12601,12 +12754,21 @@ ${input.slice(result.pos)}
12601
12754
  }
12602
12755
  }
12603
12756
  var LexicalDeclaration$0 = $TS($S(LetOrConst, LexicalBinding, $Q($S(__, Comma, LexicalBinding))), function($skip, $loc, $0, $1, $2, $3) {
12757
+ var d = $1;
12604
12758
  var binding = $2;
12605
12759
  var tail = $3;
12760
+ const { splices, thisAssignments } = binding;
12606
12761
  return {
12607
12762
  type: "Declaration",
12608
12763
  children: $0,
12609
- names: [...binding.names].concat(tail.flatMap(([, , b]) => b.names))
12764
+ names: [...binding.names].concat(tail.flatMap(([, , b]) => b.names)),
12765
+ binding: {
12766
+ ...binding.binding,
12767
+ children: [d, ...binding.binding.children]
12768
+ },
12769
+ initializer: binding.initializer,
12770
+ splices,
12771
+ thisAssignments
12610
12772
  };
12611
12773
  });
12612
12774
  var LexicalDeclaration$1 = $TS($S(InsertConst, $C(BindingPattern, BindingIdentifier), $E(TypeSuffix), __, ConstAssignment, ExtendedExpression), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
@@ -12693,25 +12855,51 @@ ${input.slice(result.pos)}
12693
12855
  return result;
12694
12856
  }
12695
12857
  }
12696
- var LexicalBinding$0 = $TS($S(BindingPattern, $E(TypeSuffix), Initializer), function($skip, $loc, $0, $1, $2, $3) {
12697
- const children = [...$1.children];
12698
- if ($2)
12699
- children.push($2);
12700
- children.push($3);
12858
+ var LexicalBinding$0 = $TS($S(BindingPattern, $E(TypeSuffix), $E(_), Initializer), function($skip, $loc, $0, $1, $2, $3, $4) {
12859
+ var binding = $1;
12860
+ var suffix = $2;
12861
+ var ws = $3;
12862
+ var initializer = $4;
12863
+ const bindingChildren = [...binding.children];
12864
+ if (suffix)
12865
+ bindingChildren.push(suffix);
12866
+ if (ws)
12867
+ bindingChildren.push(...ws);
12868
+ binding = {
12869
+ ...binding,
12870
+ children: bindingChildren
12871
+ };
12872
+ const [splices, thisAssignments] = gatherBindingCode(binding.children);
12701
12873
  return {
12702
- children,
12703
- names: $1.names
12874
+ children: [binding, initializer],
12875
+ names: binding.names,
12876
+ binding,
12877
+ initializer,
12878
+ splices: splices.map((s) => [",", s]),
12879
+ thisAssignments: thisAssignments.map((s) => ["", s, ";"])
12704
12880
  };
12705
12881
  });
12706
- var LexicalBinding$1 = $TS($S(BindingIdentifier, $E(TypeSuffix), $E(Initializer)), function($skip, $loc, $0, $1, $2, $3) {
12707
- const children = [...$1.children];
12708
- if ($2)
12709
- children.push($2);
12710
- if ($3)
12711
- children.push($3);
12882
+ var LexicalBinding$1 = $TS($S(BindingIdentifier, $E(TypeSuffix), $E(_), $E(Initializer)), function($skip, $loc, $0, $1, $2, $3, $4) {
12883
+ var binding = $1;
12884
+ var suffix = $2;
12885
+ var ws = $3;
12886
+ var initializer = $4;
12887
+ const bindingChildren = [...binding.children];
12888
+ if (suffix)
12889
+ bindingChildren.push(suffix);
12890
+ if (ws)
12891
+ bindingChildren.push(...ws);
12892
+ binding = {
12893
+ ...binding,
12894
+ children: bindingChildren
12895
+ };
12712
12896
  return {
12713
- children,
12714
- names: $1.names
12897
+ children: [binding, initializer],
12898
+ names: binding.names,
12899
+ binding,
12900
+ initializer,
12901
+ splices: [],
12902
+ thisAssignments: []
12715
12903
  };
12716
12904
  });
12717
12905
  function LexicalBinding(state) {
@@ -13868,7 +14056,7 @@ ${input.slice(result.pos)}
13868
14056
  }
13869
14057
  }
13870
14058
  var JSSingleLineComment$0 = $TR($EXPECT($R41, fail, "JSSingleLineComment /\\/\\/(?!\\/)[^\\r\\n]*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
13871
- return { $loc, token: $0 };
14059
+ return { type: "Comment", $loc, token: $0 };
13872
14060
  });
13873
14061
  function JSSingleLineComment(state) {
13874
14062
  let eventData;
@@ -13917,7 +14105,7 @@ ${input.slice(result.pos)}
13917
14105
  }
13918
14106
  }
13919
14107
  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) {
13920
- return { $loc, token: $1 };
14108
+ return { type: "Comment", $loc, token: $1 };
13921
14109
  });
13922
14110
  function JSMultiLineComment(state) {
13923
14111
  let eventData;
@@ -13942,7 +14130,7 @@ ${input.slice(result.pos)}
13942
14130
  }
13943
14131
  }
13944
14132
  var CoffeeSingleLineComment$0 = $TR($EXPECT($R43, fail, "CoffeeSingleLineComment /#(?!##(?!#))([^\\r\\n]*)/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
13945
- return { $loc, token: `//${$1}` };
14133
+ return { type: "Comment", $loc, token: `//${$1}` };
13946
14134
  });
13947
14135
  function CoffeeSingleLineComment(state) {
13948
14136
  let eventData;
@@ -13968,7 +14156,7 @@ ${input.slice(result.pos)}
13968
14156
  }
13969
14157
  var CoffeeMultiLineComment$0 = $TS($S(CoffeeHereCommentStart, $TEXT($EXPECT($R44, fail, "CoffeeMultiLineComment /[^]*?###/"))), function($skip, $loc, $0, $1, $2) {
13970
14158
  $2 = $2.slice(0, $2.length - 3).replace(/\*\//g, "* /");
13971
- return { $loc, token: `/*${$2}*/` };
14159
+ return { type: "Comment", $loc, token: `/*${$2}*/` };
13972
14160
  });
13973
14161
  function CoffeeMultiLineComment(state) {
13974
14162
  let eventData;
@@ -17270,7 +17458,7 @@ ${input.slice(result.pos)}
17270
17458
  var pre = $1;
17271
17459
  var exp = $2;
17272
17460
  var post = $3;
17273
- return module2.processUnaryExpression(pre, exp, post);
17461
+ return processUnaryExpression(pre, exp, post);
17274
17462
  });
17275
17463
  function InlineJSXUnaryExpression(state) {
17276
17464
  let eventData;
@@ -21160,60 +21348,6 @@ ${input.slice(result.pos)}
21160
21348
  }
21161
21349
  return node;
21162
21350
  };
21163
- module2.processUnaryExpression = (pre, exp, post) => {
21164
- if (post?.token === "?") {
21165
- post = {
21166
- $loc: post.$loc,
21167
- token: " != null"
21168
- };
21169
- switch (exp.type) {
21170
- case "Identifier":
21171
- case "Literal":
21172
- return {
21173
- ...exp,
21174
- children: [...pre, ...exp.children, post]
21175
- };
21176
- default:
21177
- const expression = {
21178
- ...exp,
21179
- children: [...pre, "(", exp.children, ")", post]
21180
- };
21181
- return {
21182
- type: "ParenthesizedExpression",
21183
- children: ["(", expression, ")"],
21184
- expression
21185
- };
21186
- }
21187
- }
21188
- if (exp.type === "Literal") {
21189
- if (pre.length === 1 && pre[0].token === "-") {
21190
- const children = [pre[0], ...exp.children];
21191
- if (post)
21192
- exp.children.push(post);
21193
- return {
21194
- type: "Literal",
21195
- children,
21196
- raw: `-${exp.raw}`
21197
- };
21198
- }
21199
- }
21200
- if (exp.children) {
21201
- const children = [...pre, ...exp.children];
21202
- if (post)
21203
- children.push(post);
21204
- return Object.assign({}, exp, { children });
21205
- } else if (Array.isArray(exp)) {
21206
- const children = [...pre, ...exp];
21207
- if (post)
21208
- children.push(post);
21209
- return { children };
21210
- } else {
21211
- const children = [...pre, exp];
21212
- if (post)
21213
- children.push(post);
21214
- return { children };
21215
- }
21216
- };
21217
21351
  module2.needsRef = function(expression, base = "ref") {
21218
21352
  switch (expression.type) {
21219
21353
  case "Ref":
@@ -21480,7 +21614,10 @@ ${input.slice(result.pos)}
21480
21614
  if (exp.else)
21481
21615
  insertReturn(exp.else[2]);
21482
21616
  else
21483
- exp.children.push(["\n", indent, wrapWithReturn()]);
21617
+ exp.children.push(["", {
21618
+ type: "ReturnStatement",
21619
+ children: [";return"]
21620
+ }]);
21484
21621
  return;
21485
21622
  case "PatternMatchingStatement":
21486
21623
  insertReturn(exp.children[0][0]);
@@ -21889,11 +22026,15 @@ ${input.slice(result.pos)}
21889
22026
  const [splices, thisAssignments] = gatherBindingCode(parameters, {
21890
22027
  injectParamProps: f.name === "constructor"
21891
22028
  });
22029
+ const delimiter = {
22030
+ type: "SemicolonDelimiter",
22031
+ children: [";"]
22032
+ };
21892
22033
  const prefix = splices.map((s) => ["let ", s]).concat(thisAssignments).map(
21893
22034
  (s) => s.type ? {
21894
22035
  ...s,
21895
- children: [indent, ...s.children, ";\n"]
21896
- } : [indent, s, ";\n"]
22036
+ children: [indent, ...s.children, delimiter]
22037
+ } : [indent, s, delimiter]
21897
22038
  );
21898
22039
  expressions.unshift(...prefix);
21899
22040
  }
@@ -21952,9 +22093,10 @@ ${input.slice(result.pos)}
21952
22093
  getIndent(block.expressions[0]),
21953
22094
  {
21954
22095
  type: "Declaration",
21955
- children: ["let ", ref, returnType, ";\n"],
22096
+ children: ["let ", ref, returnType],
21956
22097
  names: []
21957
- }
22098
+ },
22099
+ ";"
21958
22100
  ]);
21959
22101
  }
21960
22102
  gatherRecursiveWithinFunction(
@@ -21966,7 +22108,7 @@ ${input.slice(result.pos)}
21966
22108
  });
21967
22109
  if (block.children.at(-2)?.type !== "ReturnStatement") {
21968
22110
  block.expressions.push([
21969
- ["\n", getIndent(block.expressions.at(-1))],
22111
+ [getIndent(block.expressions.at(-1))],
21970
22112
  {
21971
22113
  type: "ReturnStatement",
21972
22114
  expression: ref,
@@ -22450,11 +22592,11 @@ ${input.slice(result.pos)}
22450
22592
  let [splices, thisAssignments] = gatherBindingCode(pattern);
22451
22593
  const patternBindings = nonMatcherBindings(pattern);
22452
22594
  splices = splices.map((s2) => [", ", nonMatcherBindings(s2)]);
22453
- thisAssignments = thisAssignments.map((a) => [indent, a, ";\n"]);
22595
+ thisAssignments = thisAssignments.map((a) => [indent, a, ";"]);
22454
22596
  const duplicateDeclarations = aggregateDuplicateBindings([patternBindings, splices]);
22455
- prefix.push([indent, "const ", patternBindings, " = ", ref, splices, ";\n"]);
22597
+ prefix.push([indent, "const ", patternBindings, " = ", ref, splices, ";"]);
22456
22598
  prefix.push(...thisAssignments);
22457
- prefix.push(...duplicateDeclarations.map((d) => [indent, d, ";\n"]));
22599
+ prefix.push(...duplicateDeclarations.map((d) => [indent, d, ";"]));
22458
22600
  break;
22459
22601
  }
22460
22602
  }
@@ -22609,6 +22751,11 @@ ${input.slice(result.pos)}
22609
22751
  });
22610
22752
  }
22611
22753
  module2.processProgram = function(root) {
22754
+ assert.equal(module2.forbidClassImplicitCall.length, 1, "forbidClassImplicitCall");
22755
+ assert.equal(module2.forbidIndentedApplication.length, 1, "forbidIndentedApplication");
22756
+ assert.equal(module2.forbidTrailingMemberProperty.length, 1, "forbidTrailingMemberProperty");
22757
+ assert.equal(module2.forbidMultiLineImplicitObjectLiteral.length, 1, "forbidMultiLineImplicitObjectLiteral");
22758
+ assert.equal(module2.JSXTagStack.length, 0, "JSXTagStack should be empty");
22612
22759
  addParentPointers(root);
22613
22760
  const { expressions: statements } = root;
22614
22761
  processPipelineExpressions(statements);
@@ -22702,7 +22849,11 @@ ${input.slice(result.pos)}
22702
22849
  });
22703
22850
  if (varIds.length) {
22704
22851
  const indent = getIndent(statements[0]);
22705
- statements.unshift([indent, "var ", varIds.join(", "), "\n"]);
22852
+ let delimiter = ";";
22853
+ if (statements[0][1]?.parent?.root) {
22854
+ delimiter = ";\n";
22855
+ }
22856
+ statements.unshift([indent, "var ", varIds.join(", "), delimiter]);
22706
22857
  }
22707
22858
  scopes.pop();
22708
22859
  }
@@ -23140,9 +23291,17 @@ ${input.slice(result.pos)}
23140
23291
  processCoffeeInterpolation,
23141
23292
  processConstAssignmentDeclaration,
23142
23293
  processLetAssignmentDeclaration,
23294
+ processUnaryExpression,
23143
23295
  quoteString,
23144
23296
  removeParentPointers
23145
23297
  } = require_lib();
23298
+ var assert = {
23299
+ equal(a, b, msg) {
23300
+ if (a !== b) {
23301
+ throw new Error(`Assertion failed [${msg}]: ${a} !== ${b}`);
23302
+ }
23303
+ }
23304
+ };
23146
23305
  }
23147
23306
  });
23148
23307
 
@@ -23580,7 +23739,7 @@ var parse;
23580
23739
  var uncacheable;
23581
23740
  ({ parse } = import_parser.default);
23582
23741
  ({ SourceMap: SourceMap2, base64Encode: base64Encode2 } = util_exports);
23583
- 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"]);
23742
+ 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"]);
23584
23743
  var compile = function(src, options) {
23585
23744
  var ast, code, events, filename, ref, result, sm, srcMapJSON;
23586
23745
  if (!options) {