@danielx/civet 0.5.61 → 0.5.62

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
@@ -561,10 +561,14 @@ ${input.slice(result.pos)}
561
561
  Block,
562
562
  ThenClause,
563
563
  BracedOrEmptyBlock,
564
+ NoPostfixBracedOrEmptyBlock,
564
565
  EmptyBlock,
565
566
  EmptyBareBlock,
566
567
  BracedBlock,
568
+ NoPostfixBracedBlock,
569
+ NonSingleBracedBlock,
567
570
  SingleLineStatements,
571
+ PostfixedSingleLineStatements,
568
572
  BracedContent,
569
573
  NestedBlockStatements,
570
574
  NestedBlockStatement,
@@ -620,6 +624,8 @@ ${input.slice(result.pos)}
620
624
  UnaryOp,
621
625
  ModuleItem,
622
626
  StatementListItem,
627
+ PostfixedStatement,
628
+ PostfixedExpression,
623
629
  PostfixStatement,
624
630
  Statement,
625
631
  EmptyStatement,
@@ -1168,7 +1174,7 @@ ${input.slice(result.pos)}
1168
1174
  var $L170 = $L("infer");
1169
1175
  var $L171 = $L("[]");
1170
1176
  var $L172 = $L("civet");
1171
- var $R0 = $R(new RegExp("(as|for|of|satisfies|then|when|implements)(?!\\p{ID_Continue}|[\\u200C\\u200D$])", "suy"));
1177
+ var $R0 = $R(new RegExp("(as|for|while|until|of|satisfies|then|when|implements)(?!\\p{ID_Continue}|[\\u200C\\u200D$])", "suy"));
1172
1178
  var $R1 = $R(new RegExp("[0-9]", "suy"));
1173
1179
  var $R2 = $R(new RegExp("[&]", "suy"));
1174
1180
  var $R3 = $R(new RegExp("[!~+-]+", "suy"));
@@ -1549,7 +1555,7 @@ ${input.slice(result.pos)}
1549
1555
  return result;
1550
1556
  }
1551
1557
  }
1552
- var ForbiddenImplicitCalls$0 = $R$0($EXPECT($R0, fail, "ForbiddenImplicitCalls /(as|for|of|satisfies|then|when|implements)(?!\\p{ID_Continue}|[\\u200C\\u200D$])/"));
1558
+ var ForbiddenImplicitCalls$0 = $R$0($EXPECT($R0, fail, "ForbiddenImplicitCalls /(as|for|while|until|of|satisfies|then|when|implements)(?!\\p{ID_Continue}|[\\u200C\\u200D$])/"));
1553
1559
  var ForbiddenImplicitCalls$1 = $EXPECT($L0, fail, 'ForbiddenImplicitCalls "/ "');
1554
1560
  var ForbiddenImplicitCalls$2 = AtAt;
1555
1561
  var ForbiddenImplicitCalls$3 = $S(Identifier, $EXPECT($L1, fail, 'ForbiddenImplicitCalls "="'), Whitespace);
@@ -2344,10 +2350,11 @@ ${input.slice(result.pos)}
2344
2350
  return result;
2345
2351
  }
2346
2352
  }
2347
- var FatArrowBody$0 = ExplicitBlock;
2348
- var FatArrowBody$1 = ImplicitNestedBlock;
2349
- var FatArrowBody$2 = AssignmentExpression;
2350
- var FatArrowBody$3 = EmptyBlock;
2353
+ var FatArrowBody$0 = $T($S($N(EOS), PostfixedExpression, $N(SemicolonDelimiter)), function(value) {
2354
+ var exp = value[1];
2355
+ return exp;
2356
+ });
2357
+ var FatArrowBody$1 = BracedOrEmptyBlock;
2351
2358
  function FatArrowBody(state) {
2352
2359
  let eventData;
2353
2360
  if (state.events) {
@@ -2359,12 +2366,12 @@ ${input.slice(result.pos)}
2359
2366
  }
2360
2367
  }
2361
2368
  if (state.tokenize) {
2362
- const result = $TOKEN("FatArrowBody", state, FatArrowBody$0(state) || FatArrowBody$1(state) || FatArrowBody$2(state) || FatArrowBody$3(state));
2369
+ const result = $TOKEN("FatArrowBody", state, FatArrowBody$0(state) || FatArrowBody$1(state));
2363
2370
  if (state.events)
2364
2371
  state.events.exit?.("FatArrowBody", state, result, eventData);
2365
2372
  return result;
2366
2373
  } else {
2367
- const result = FatArrowBody$0(state) || FatArrowBody$1(state) || FatArrowBody$2(state) || FatArrowBody$3(state);
2374
+ const result = FatArrowBody$0(state) || FatArrowBody$1(state);
2368
2375
  if (state.events)
2369
2376
  state.events.exit?.("FatArrowBody", state, result, eventData);
2370
2377
  return result;
@@ -2605,11 +2612,11 @@ ${input.slice(result.pos)}
2605
2612
  return result;
2606
2613
  }
2607
2614
  }
2608
- var ParenthesizedExpression$0 = $TS($S(OpenParen, ExtendedExpression, $E($S($Q(TrailingComment), PostfixStatement)), __, CloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
2615
+ var ParenthesizedExpression$0 = $TS($S(OpenParen, PostfixedExpression, __, CloseParen), function($skip, $loc, $0, $1, $2, $3, $4) {
2609
2616
  var exp = $2;
2610
- var post = $3;
2611
- if (post) {
2612
- return module.attachPostfixStatementAsExpression(exp, post);
2617
+ switch (exp.type) {
2618
+ case "IterationExpression":
2619
+ return $2;
2613
2620
  }
2614
2621
  return {
2615
2622
  type: "ParenthesizedExpression",
@@ -3271,7 +3278,12 @@ ${input.slice(result.pos)}
3271
3278
  }
3272
3279
  }
3273
3280
  var CallExpressionRest$0 = MemberExpressionRest;
3274
- var CallExpressionRest$1 = TemplateLiteral;
3281
+ var CallExpressionRest$1 = $TV($C(TemplateLiteral, StringLiteral), function($skip, $loc, $0, $1) {
3282
+ if ($1.type === "StringLiteral") {
3283
+ return "`" + $1.token.slice(1, -1).replace(/(`|\$\{)/g, "\\$1") + "`";
3284
+ }
3285
+ return $1;
3286
+ });
3275
3287
  var CallExpressionRest$2 = $TS($S($E($C(OptionalShorthand, NonNullAssertion)), ArgumentsWithTrailingMemberExpressions), function($skip, $loc, $0, $1, $2) {
3276
3288
  if (!$1)
3277
3289
  return $2;
@@ -3419,7 +3431,7 @@ ${input.slice(result.pos)}
3419
3431
  return result;
3420
3432
  }
3421
3433
  }
3422
- var MemberBracketContent$0 = $TS($S(OpenBracket, $C(SliceParameters, ExtendedExpression), __, CloseBracket), function($skip, $loc, $0, $1, $2, $3, $4) {
3434
+ var MemberBracketContent$0 = $TS($S(OpenBracket, $C(SliceParameters, PostfixedExpression), __, CloseBracket), function($skip, $loc, $0, $1, $2, $3, $4) {
3423
3435
  var open = $1;
3424
3436
  var exp = $2;
3425
3437
  var ws = $3;
@@ -3608,7 +3620,7 @@ ${input.slice(result.pos)}
3608
3620
  return result;
3609
3621
  }
3610
3622
  }
3611
- var SuperProperty$0 = $S($EXPECT($L16, fail, 'SuperProperty "super["'), ExtendedExpression, __, CloseBracket);
3623
+ var SuperProperty$0 = $S($EXPECT($L16, fail, 'SuperProperty "super["'), PostfixedExpression, __, CloseBracket);
3612
3624
  var SuperProperty$1 = $S($EXPECT($L12, fail, 'SuperProperty "super"'), $N($C(QuestionMark, NonNullAssertion)), PropertyAccess);
3613
3625
  function SuperProperty(state) {
3614
3626
  let eventData;
@@ -5029,7 +5041,11 @@ ${input.slice(result.pos)}
5029
5041
  return result;
5030
5042
  }
5031
5043
  }
5032
- var FunctionDeclaration$0 = FunctionExpression;
5044
+ var FunctionDeclaration$0 = $TS($S(FunctionExpression), function($skip, $loc, $0, $1) {
5045
+ if ($1.id)
5046
+ return $1;
5047
+ return module.makeLeftHandSideExpression($1);
5048
+ });
5033
5049
  function FunctionDeclaration(state) {
5034
5050
  let eventData;
5035
5051
  if (state.events) {
@@ -5543,6 +5559,30 @@ ${input.slice(result.pos)}
5543
5559
  return result;
5544
5560
  }
5545
5561
  }
5562
+ var NoPostfixBracedOrEmptyBlock$0 = NoPostfixBracedBlock;
5563
+ var NoPostfixBracedOrEmptyBlock$1 = EmptyBlock;
5564
+ function NoPostfixBracedOrEmptyBlock(state) {
5565
+ let eventData;
5566
+ if (state.events) {
5567
+ const result = state.events.enter?.("NoPostfixBracedOrEmptyBlock", state);
5568
+ if (result) {
5569
+ if (result.cache)
5570
+ return result.cache;
5571
+ eventData = result.data;
5572
+ }
5573
+ }
5574
+ if (state.tokenize) {
5575
+ const result = $TOKEN("NoPostfixBracedOrEmptyBlock", state, NoPostfixBracedOrEmptyBlock$0(state) || NoPostfixBracedOrEmptyBlock$1(state));
5576
+ if (state.events)
5577
+ state.events.exit?.("NoPostfixBracedOrEmptyBlock", state, result, eventData);
5578
+ return result;
5579
+ } else {
5580
+ const result = NoPostfixBracedOrEmptyBlock$0(state) || NoPostfixBracedOrEmptyBlock$1(state);
5581
+ if (state.events)
5582
+ state.events.exit?.("NoPostfixBracedOrEmptyBlock", state, result, eventData);
5583
+ return result;
5584
+ }
5585
+ }
5546
5586
  var EmptyBlock$0 = $TS($S(InsertOpenBrace, InsertCloseBrace), function($skip, $loc, $0, $1, $2) {
5547
5587
  const expressions = [];
5548
5588
  return {
@@ -5606,26 +5646,44 @@ ${input.slice(result.pos)}
5606
5646
  return result;
5607
5647
  }
5608
5648
  }
5609
- var BracedBlock$0 = $TS($S($Q(TrailingComment), OpenBrace, BracedContent, __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
5610
- var block = $3;
5611
- return {
5612
- type: "BlockStatement",
5613
- expressions: block.expressions,
5614
- children: [$1, $2, ...block.children, $4, $5],
5615
- bare: false
5616
- };
5617
- return block;
5618
- });
5619
- var BracedBlock$1 = ImplicitNestedBlock;
5620
- var BracedBlock$2 = $TS($S(InsertOpenBrace, $Y(EOS), ObjectLiteral, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4) {
5649
+ var BracedBlock$0 = NonSingleBracedBlock;
5650
+ var BracedBlock$1 = $TS($S(InsertOpenBrace, $N(EOS), PostfixedSingleLineStatements, InsertSpace, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
5651
+ var o = $1;
5621
5652
  var s = $3;
5653
+ var ws = $4;
5654
+ var c = $5;
5655
+ if (!s.children.length)
5656
+ return $skip;
5622
5657
  return {
5623
5658
  type: "BlockStatement",
5624
- expressions: [s],
5625
- children: [$1, s, $3]
5659
+ expressions: s.expressions,
5660
+ children: [o, s.children, ws, c]
5626
5661
  };
5627
5662
  });
5628
- var BracedBlock$3 = $TS($S(InsertOpenBrace, $N(EOS), SingleLineStatements, InsertSpace, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
5663
+ function BracedBlock(state) {
5664
+ let eventData;
5665
+ if (state.events) {
5666
+ const result = state.events.enter?.("BracedBlock", state);
5667
+ if (result) {
5668
+ if (result.cache)
5669
+ return result.cache;
5670
+ eventData = result.data;
5671
+ }
5672
+ }
5673
+ if (state.tokenize) {
5674
+ const result = $TOKEN("BracedBlock", state, BracedBlock$0(state) || BracedBlock$1(state));
5675
+ if (state.events)
5676
+ state.events.exit?.("BracedBlock", state, result, eventData);
5677
+ return result;
5678
+ } else {
5679
+ const result = BracedBlock$0(state) || BracedBlock$1(state);
5680
+ if (state.events)
5681
+ state.events.exit?.("BracedBlock", state, result, eventData);
5682
+ return result;
5683
+ }
5684
+ }
5685
+ var NoPostfixBracedBlock$0 = NonSingleBracedBlock;
5686
+ var NoPostfixBracedBlock$1 = $TS($S(InsertOpenBrace, $N(EOS), SingleLineStatements, InsertSpace, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
5629
5687
  var o = $1;
5630
5688
  var s = $3;
5631
5689
  var ws = $4;
@@ -5638,10 +5696,10 @@ ${input.slice(result.pos)}
5638
5696
  children: [o, s.children, ws, c]
5639
5697
  };
5640
5698
  });
5641
- function BracedBlock(state) {
5699
+ function NoPostfixBracedBlock(state) {
5642
5700
  let eventData;
5643
5701
  if (state.events) {
5644
- const result = state.events.enter?.("BracedBlock", state);
5702
+ const result = state.events.enter?.("NoPostfixBracedBlock", state);
5645
5703
  if (result) {
5646
5704
  if (result.cache)
5647
5705
  return result.cache;
@@ -5649,14 +5707,55 @@ ${input.slice(result.pos)}
5649
5707
  }
5650
5708
  }
5651
5709
  if (state.tokenize) {
5652
- const result = $TOKEN("BracedBlock", state, BracedBlock$0(state) || BracedBlock$1(state) || BracedBlock$2(state) || BracedBlock$3(state));
5710
+ const result = $TOKEN("NoPostfixBracedBlock", state, NoPostfixBracedBlock$0(state) || NoPostfixBracedBlock$1(state));
5653
5711
  if (state.events)
5654
- state.events.exit?.("BracedBlock", state, result, eventData);
5712
+ state.events.exit?.("NoPostfixBracedBlock", state, result, eventData);
5655
5713
  return result;
5656
5714
  } else {
5657
- const result = BracedBlock$0(state) || BracedBlock$1(state) || BracedBlock$2(state) || BracedBlock$3(state);
5715
+ const result = NoPostfixBracedBlock$0(state) || NoPostfixBracedBlock$1(state);
5658
5716
  if (state.events)
5659
- state.events.exit?.("BracedBlock", state, result, eventData);
5717
+ state.events.exit?.("NoPostfixBracedBlock", state, result, eventData);
5718
+ return result;
5719
+ }
5720
+ }
5721
+ var NonSingleBracedBlock$0 = $TS($S($Q(TrailingComment), OpenBrace, BracedContent, __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
5722
+ var block = $3;
5723
+ return {
5724
+ type: "BlockStatement",
5725
+ expressions: block.expressions,
5726
+ children: [$1, $2, ...block.children, $4, $5],
5727
+ bare: false
5728
+ };
5729
+ return block;
5730
+ });
5731
+ var NonSingleBracedBlock$1 = ImplicitNestedBlock;
5732
+ var NonSingleBracedBlock$2 = $TS($S(InsertOpenBrace, $Y(EOS), ObjectLiteral, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4) {
5733
+ var s = $3;
5734
+ return {
5735
+ type: "BlockStatement",
5736
+ expressions: [s],
5737
+ children: [$1, s, $3]
5738
+ };
5739
+ });
5740
+ function NonSingleBracedBlock(state) {
5741
+ let eventData;
5742
+ if (state.events) {
5743
+ const result = state.events.enter?.("NonSingleBracedBlock", state);
5744
+ if (result) {
5745
+ if (result.cache)
5746
+ return result.cache;
5747
+ eventData = result.data;
5748
+ }
5749
+ }
5750
+ if (state.tokenize) {
5751
+ const result = $TOKEN("NonSingleBracedBlock", state, NonSingleBracedBlock$0(state) || NonSingleBracedBlock$1(state) || NonSingleBracedBlock$2(state));
5752
+ if (state.events)
5753
+ state.events.exit?.("NonSingleBracedBlock", state, result, eventData);
5754
+ return result;
5755
+ } else {
5756
+ const result = NonSingleBracedBlock$0(state) || NonSingleBracedBlock$1(state) || NonSingleBracedBlock$2(state);
5757
+ if (state.events)
5758
+ state.events.exit?.("NonSingleBracedBlock", state, result, eventData);
5660
5759
  return result;
5661
5760
  }
5662
5761
  }
@@ -5695,6 +5794,41 @@ ${input.slice(result.pos)}
5695
5794
  return result;
5696
5795
  }
5697
5796
  }
5797
+ var PostfixedSingleLineStatements$0 = $TS($S($Q($S($S($E(_), $N(EOS)), PostfixedStatement, SemicolonDelimiter)), $E($S($S($E(_), $N(EOS)), PostfixedStatement, $E(SemicolonDelimiter)))), function($skip, $loc, $0, $1, $2) {
5798
+ var stmts = $1;
5799
+ var last = $2;
5800
+ const children = [...stmts];
5801
+ if (last)
5802
+ children.push(last);
5803
+ return {
5804
+ type: "BlockStatement",
5805
+ expressions: children,
5806
+ children,
5807
+ bare: true
5808
+ };
5809
+ });
5810
+ function PostfixedSingleLineStatements(state) {
5811
+ let eventData;
5812
+ if (state.events) {
5813
+ const result = state.events.enter?.("PostfixedSingleLineStatements", state);
5814
+ if (result) {
5815
+ if (result.cache)
5816
+ return result.cache;
5817
+ eventData = result.data;
5818
+ }
5819
+ }
5820
+ if (state.tokenize) {
5821
+ const result = $TOKEN("PostfixedSingleLineStatements", state, PostfixedSingleLineStatements$0(state));
5822
+ if (state.events)
5823
+ state.events.exit?.("PostfixedSingleLineStatements", state, result, eventData);
5824
+ return result;
5825
+ } else {
5826
+ const result = PostfixedSingleLineStatements$0(state);
5827
+ if (state.events)
5828
+ state.events.exit?.("PostfixedSingleLineStatements", state, result, eventData);
5829
+ return result;
5830
+ }
5831
+ }
5698
5832
  var BracedContent$0 = NestedBlockStatements;
5699
5833
  var BracedContent$1 = $TS($S($Q(TrailingComment), Statement), function($skip, $loc, $0, $1, $2) {
5700
5834
  const expressions = [["", $2]];
@@ -6995,7 +7129,7 @@ ${input.slice(result.pos)}
6995
7129
  return result;
6996
7130
  }
6997
7131
  }
6998
- var ComputedPropertyName$0 = $TS($S(OpenBracket, ExtendedExpression, __, CloseBracket), function($skip, $loc, $0, $1, $2, $3, $4) {
7132
+ var ComputedPropertyName$0 = $TS($S(OpenBracket, PostfixedExpression, __, CloseBracket), function($skip, $loc, $0, $1, $2, $3, $4) {
6999
7133
  var expression = $2;
7000
7134
  return {
7001
7135
  type: "ComputedPropertyName",
@@ -7539,7 +7673,12 @@ ${input.slice(result.pos)}
7539
7673
  return "??";
7540
7674
  });
7541
7675
  var BinaryOpSymbol$28 = $TS($S($EXPECT($L75, fail, 'BinaryOpSymbol "instanceof"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
7542
- return $1;
7676
+ return {
7677
+ $loc,
7678
+ token: $1,
7679
+ relational: true,
7680
+ special: true
7681
+ };
7543
7682
  });
7544
7683
  var BinaryOpSymbol$29 = $TS($S($EXPECT($L50, fail, 'BinaryOpSymbol "not"'), NonIdContinue, __, $EXPECT($L75, fail, 'BinaryOpSymbol "instanceof"'), NonIdContinue), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
7545
7684
  return {
@@ -7697,13 +7836,7 @@ ${input.slice(result.pos)}
7697
7836
  }
7698
7837
  }
7699
7838
  var StatementListItem$0 = Declaration;
7700
- var StatementListItem$1 = $TS($S(Statement, $E($S($Q(TrailingComment), PostfixStatement))), function($skip, $loc, $0, $1, $2) {
7701
- var statement = $1;
7702
- var post = $2;
7703
- if (post)
7704
- return module.addPostfixStatement(statement, ...post);
7705
- return statement;
7706
- });
7839
+ var StatementListItem$1 = PostfixedStatement;
7707
7840
  function StatementListItem(state) {
7708
7841
  let eventData;
7709
7842
  if (state.events) {
@@ -7726,6 +7859,64 @@ ${input.slice(result.pos)}
7726
7859
  return result;
7727
7860
  }
7728
7861
  }
7862
+ var PostfixedStatement$0 = $TS($S(Statement, $E($S($Q(TrailingComment), PostfixStatement))), function($skip, $loc, $0, $1, $2) {
7863
+ var statement = $1;
7864
+ var post = $2;
7865
+ if (post)
7866
+ return module.addPostfixStatement(statement, ...post);
7867
+ return statement;
7868
+ });
7869
+ function PostfixedStatement(state) {
7870
+ let eventData;
7871
+ if (state.events) {
7872
+ const result = state.events.enter?.("PostfixedStatement", state);
7873
+ if (result) {
7874
+ if (result.cache)
7875
+ return result.cache;
7876
+ eventData = result.data;
7877
+ }
7878
+ }
7879
+ if (state.tokenize) {
7880
+ const result = $TOKEN("PostfixedStatement", state, PostfixedStatement$0(state));
7881
+ if (state.events)
7882
+ state.events.exit?.("PostfixedStatement", state, result, eventData);
7883
+ return result;
7884
+ } else {
7885
+ const result = PostfixedStatement$0(state);
7886
+ if (state.events)
7887
+ state.events.exit?.("PostfixedStatement", state, result, eventData);
7888
+ return result;
7889
+ }
7890
+ }
7891
+ var PostfixedExpression$0 = $TS($S(ExtendedExpression, $E($S($Q(TrailingComment), PostfixStatement))), function($skip, $loc, $0, $1, $2) {
7892
+ var expression = $1;
7893
+ var post = $2;
7894
+ if (post)
7895
+ return module.attachPostfixStatementAsExpression(expression, post);
7896
+ return expression;
7897
+ });
7898
+ function PostfixedExpression(state) {
7899
+ let eventData;
7900
+ if (state.events) {
7901
+ const result = state.events.enter?.("PostfixedExpression", state);
7902
+ if (result) {
7903
+ if (result.cache)
7904
+ return result.cache;
7905
+ eventData = result.data;
7906
+ }
7907
+ }
7908
+ if (state.tokenize) {
7909
+ const result = $TOKEN("PostfixedExpression", state, PostfixedExpression$0(state));
7910
+ if (state.events)
7911
+ state.events.exit?.("PostfixedExpression", state, result, eventData);
7912
+ return result;
7913
+ } else {
7914
+ const result = PostfixedExpression$0(state);
7915
+ if (state.events)
7916
+ state.events.exit?.("PostfixedExpression", state, result, eventData);
7917
+ return result;
7918
+ }
7919
+ }
7729
7920
  var PostfixStatement$0 = ForClause;
7730
7921
  var PostfixStatement$1 = IfClause;
7731
7922
  var PostfixStatement$2 = LoopClause;
@@ -7761,12 +7952,8 @@ ${input.slice(result.pos)}
7761
7952
  var Statement$5 = TryStatement;
7762
7953
  var Statement$6 = EmptyStatement;
7763
7954
  var Statement$7 = $TS($S(ExpressionStatement), function($skip, $loc, $0, $1) {
7764
- if ($1.type === "ObjectExpression") {
7765
- return {
7766
- type: "ParenthesizedExpression",
7767
- children: ["(", $1, ")"],
7768
- expression: $1
7769
- };
7955
+ if ($1.type === "ObjectExpression" || $1.type === "FunctionExpression" && !$1.id) {
7956
+ return module.makeLeftHandSideExpression($1);
7770
7957
  }
7771
7958
  return $1;
7772
7959
  });
@@ -7854,6 +8041,8 @@ ${input.slice(result.pos)}
7854
8041
  children.push(e);
7855
8042
  return {
7856
8043
  type: "IfStatement",
8044
+ then: block,
8045
+ else: e,
7857
8046
  children
7858
8047
  };
7859
8048
  });
@@ -7931,7 +8120,7 @@ ${input.slice(result.pos)}
7931
8120
  var UnlessClause$0 = $TS($S(Unless, Condition), function($skip, $loc, $0, $1, $2) {
7932
8121
  var kind = $1;
7933
8122
  var condition = $2;
7934
- kind.token = "if";
8123
+ kind = { ...kind, token: "if" };
7935
8124
  return {
7936
8125
  type: "IfStatement",
7937
8126
  children: [kind, ["(!", condition, ")"]]
@@ -8160,16 +8349,7 @@ ${input.slice(result.pos)}
8160
8349
  return result;
8161
8350
  }
8162
8351
  }
8163
- var NestedBlockExpression$0 = $TS($S(Nested, ExtendedExpression, $E($S($Q(TrailingComment), PostfixStatement)), ExpressionDelimiter), function($skip, $loc, $0, $1, $2, $3, $4) {
8164
- var ws = $1;
8165
- var exp = $2;
8166
- var post = $3;
8167
- var d = $4;
8168
- if (post) {
8169
- return [ws, module.attachPostfixStatementAsExpression(exp, post), d];
8170
- }
8171
- return [ws, exp, d];
8172
- });
8352
+ var NestedBlockExpression$0 = $S(Nested, PostfixedExpression, ExpressionDelimiter);
8173
8353
  function NestedBlockExpression(state) {
8174
8354
  let eventData;
8175
8355
  if (state.events) {
@@ -8305,7 +8485,7 @@ ${input.slice(result.pos)}
8305
8485
  return result;
8306
8486
  }
8307
8487
  }
8308
- var DoWhileStatement$0 = $T($S(Do, BracedBlock, __, WhileClause), function(value) {
8488
+ var DoWhileStatement$0 = $T($S(Do, NoPostfixBracedBlock, __, WhileClause), function(value) {
8309
8489
  var block = value[1];
8310
8490
  return { "type": "IterationStatement", "children": value, "block": block };
8311
8491
  });
@@ -8473,9 +8653,11 @@ ${input.slice(result.pos)}
8473
8653
  var ForStatementControl$1 = $TS($S(CoffeeForLoopsEnabled, CoffeeForStatementParameters, $E(WhenCondition)), function($skip, $loc, $0, $1, $2, $3) {
8474
8654
  if ($3) {
8475
8655
  const indent = module.currentIndent.token + " ";
8656
+ const block = "continue\n";
8476
8657
  $2.blockPrefix.push([indent, {
8477
8658
  type: "IfStatement",
8478
- children: ["if (!(", module.insertTrimmingSpace($3, ""), ")) continue\n"]
8659
+ then: block,
8660
+ children: ["if (!(", module.insertTrimmingSpace($3, ""), ")) ", block]
8479
8661
  }]);
8480
8662
  }
8481
8663
  return $2;
@@ -9259,7 +9441,7 @@ ${input.slice(result.pos)}
9259
9441
  return result;
9260
9442
  }
9261
9443
  }
9262
- var TryStatement$0 = $TS($S(Try, BracedOrEmptyBlock, $E(CatchClause), $E(FinallyClause)), function($skip, $loc, $0, $1, $2, $3, $4) {
9444
+ var TryStatement$0 = $TS($S(Try, NoPostfixBracedOrEmptyBlock, $E(CatchClause), $E(FinallyClause)), function($skip, $loc, $0, $1, $2, $3, $4) {
9263
9445
  var t = $1;
9264
9446
  var b = $2;
9265
9447
  var c = $3;
@@ -10755,7 +10937,7 @@ ${input.slice(result.pos)}
10755
10937
  }
10756
10938
  }
10757
10939
  var NumericLiteral$0 = $TS($S(NumericLiteralKind), function($skip, $loc, $0, $1) {
10758
- return { $loc, token: $1 };
10940
+ return { type: "NumericLiteral", $loc, token: $1 };
10759
10941
  });
10760
10942
  function NumericLiteral(state) {
10761
10943
  let eventData;
@@ -11026,6 +11208,7 @@ ${input.slice(result.pos)}
11026
11208
  var StringLiteral$0 = $TS($S(DoubleQuote, DoubleStringCharacters, DoubleQuote), function($skip, $loc, $0, $1, $2, $3) {
11027
11209
  var str = $2;
11028
11210
  return {
11211
+ type: "StringLiteral",
11029
11212
  token: `"${module.modifyString(str.token)}"`,
11030
11213
  $loc
11031
11214
  };
@@ -11033,6 +11216,7 @@ ${input.slice(result.pos)}
11033
11216
  var StringLiteral$1 = $TS($S(SingleQuote, SingleStringCharacters, SingleQuote), function($skip, $loc, $0, $1, $2, $3) {
11034
11217
  var str = $2;
11035
11218
  return {
11219
+ type: "StringLiteral",
11036
11220
  token: `'${module.modifyString(str.token)}'`,
11037
11221
  $loc
11038
11222
  };
@@ -11159,7 +11343,7 @@ ${input.slice(result.pos)}
11159
11343
  return result;
11160
11344
  }
11161
11345
  }
11162
- var CoffeeStringSubstitution$0 = $S(CoffeeSubstitutionStart, ExtendedExpression, __, CloseBrace);
11346
+ var CoffeeStringSubstitution$0 = $S(CoffeeSubstitutionStart, PostfixedExpression, __, CloseBrace);
11163
11347
  function CoffeeStringSubstitution(state) {
11164
11348
  let eventData;
11165
11349
  if (state.events) {
@@ -11599,7 +11783,7 @@ ${input.slice(result.pos)}
11599
11783
  return result;
11600
11784
  }
11601
11785
  }
11602
- var TemplateSubstitution$0 = $S(SubstitutionStart, ExtendedExpression, __, CloseBrace);
11786
+ var TemplateSubstitution$0 = $S(SubstitutionStart, PostfixedExpression, __, CloseBrace);
11603
11787
  function TemplateSubstitution(state) {
11604
11788
  let eventData;
11605
11789
  if (state.events) {
@@ -12146,7 +12330,7 @@ ${input.slice(result.pos)}
12146
12330
  }
12147
12331
  }
12148
12332
  var StatementDelimiter$0 = SemicolonDelimiter;
12149
- var StatementDelimiter$1 = $S($Y($S(Samedent, $C($EXPECT($L2, fail, 'StatementDelimiter "("'), $EXPECT($L92, fail, 'StatementDelimiter "["'), $EXPECT($L93, fail, 'StatementDelimiter "`"'), $EXPECT($L56, fail, 'StatementDelimiter "+"'), $EXPECT($L15, fail, 'StatementDelimiter "-"'), $EXPECT($L52, fail, 'StatementDelimiter "*"'), $EXPECT($L53, fail, 'StatementDelimiter "/"'), ObjectLiteral))), InsertSemicolon);
12333
+ var StatementDelimiter$1 = $S($Y($S(Samedent, $C($EXPECT($L2, fail, 'StatementDelimiter "("'), $EXPECT($L92, fail, 'StatementDelimiter "["'), $EXPECT($L93, fail, 'StatementDelimiter "`"'), $EXPECT($L56, fail, 'StatementDelimiter "+"'), $EXPECT($L15, fail, 'StatementDelimiter "-"'), $EXPECT($L52, fail, 'StatementDelimiter "*"'), $EXPECT($L53, fail, 'StatementDelimiter "/"'), ObjectLiteral, Arrow, $S(Function, $E($S($E(_), Star)), $E(_), $EXPECT($L2, fail, 'StatementDelimiter "("'))))), InsertSemicolon);
12150
12334
  var StatementDelimiter$2 = $Y(EOS);
12151
12335
  function StatementDelimiter(state) {
12152
12336
  let eventData;
@@ -14914,7 +15098,7 @@ ${input.slice(result.pos)}
14914
15098
  return ["{", $1, "}"];
14915
15099
  });
14916
15100
  var JSXShorthandString$2 = StringLiteral;
14917
- var JSXShorthandString$3 = $S(OpenBrace, ExtendedExpression, $E(Whitespace), CloseBrace);
15101
+ var JSXShorthandString$3 = $S(OpenBrace, PostfixedExpression, $E(Whitespace), CloseBrace);
14918
15102
  function JSXShorthandString(state) {
14919
15103
  let eventData;
14920
15104
  if (state.events) {
@@ -14984,7 +15168,7 @@ ${input.slice(result.pos)}
14984
15168
  return result;
14985
15169
  }
14986
15170
  }
14987
- var JSXAttributeValue$0 = $S(OpenBrace, ExtendedExpression, $E(Whitespace), CloseBrace);
15171
+ var JSXAttributeValue$0 = $S(OpenBrace, PostfixedExpression, $E(Whitespace), CloseBrace);
14988
15172
  var JSXAttributeValue$1 = JSXElement;
14989
15173
  var JSXAttributeValue$2 = JSXFragment;
14990
15174
  var JSXAttributeValue$3 = $TS($S(InsertInlineOpenBrace, InlineJSXAttributeValue, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3) {
@@ -15175,7 +15359,7 @@ ${input.slice(result.pos)}
15175
15359
  }
15176
15360
  }
15177
15361
  var InlineJSXCallExpression$0 = $S($EXPECT($L12, fail, 'InlineJSXCallExpression "super"'), ExplicitArguments);
15178
- var InlineJSXCallExpression$1 = $S($EXPECT($L13, fail, 'InlineJSXCallExpression "import"'), OpenParen, ExtendedExpression, __, CloseParen);
15362
+ var InlineJSXCallExpression$1 = $S($EXPECT($L13, fail, 'InlineJSXCallExpression "import"'), OpenParen, PostfixedExpression, __, CloseParen);
15179
15363
  var InlineJSXCallExpression$2 = $TS($S(InlineJSXMemberExpression, $Q(InlineJSXCallExpressionRest)), function($skip, $loc, $0, $1, $2) {
15180
15364
  if ($2.length)
15181
15365
  return $0;
@@ -15597,7 +15781,7 @@ ${input.slice(result.pos)}
15597
15781
  return result;
15598
15782
  }
15599
15783
  }
15600
- var JSXChildExpression$0 = $S($E(Whitespace), $E($S(DotDotDot, $E(Whitespace))), ExtendedExpression);
15784
+ var JSXChildExpression$0 = $S($E(Whitespace), $E($S(DotDotDot, $E(Whitespace))), PostfixedExpression);
15601
15785
  function JSXChildExpression(state) {
15602
15786
  let eventData;
15603
15787
  if (state.events) {
@@ -18414,10 +18598,11 @@ ${input.slice(result.pos)}
18414
18598
  children.push(block);
18415
18599
  if (!module.isWhitespaceOrEmpty(ws))
18416
18600
  children.push(ws);
18417
- return Object.assign({}, post, {
18418
- children,
18419
- block
18420
- });
18601
+ post = { ...post, children, block };
18602
+ if (post.type === "IfStatement") {
18603
+ post.then = block;
18604
+ }
18605
+ return post;
18421
18606
  };
18422
18607
  function expressionizeIteration(exp) {
18423
18608
  const resultsRef = {
@@ -18490,9 +18675,9 @@ ${input.slice(result.pos)}
18490
18675
  insertPush(exp.expressions[exp.expressions.length - 1], ref);
18491
18676
  return;
18492
18677
  case "IfStatement":
18493
- insertPush(exp.children[2], ref);
18494
- if (exp.children[3])
18495
- insertPush(exp.children[3][2], ref);
18678
+ insertPush(exp.then, ref);
18679
+ if (exp.else)
18680
+ insertPush(exp.else[2], ref);
18496
18681
  else
18497
18682
  exp.children.push([" else {\n", indent, ref, ".push(undefined)\n", indent, "}"]);
18498
18683
  return;
@@ -18548,7 +18733,9 @@ ${input.slice(result.pos)}
18548
18733
  }
18549
18734
  if (!Array.isArray(node))
18550
18735
  return;
18551
- const [, exp] = node;
18736
+ const [, exp, semi] = node;
18737
+ if (semi?.type === "SemicolonDelimiter")
18738
+ return;
18552
18739
  let indent = node[0];
18553
18740
  if (Array.isArray(indent))
18554
18741
  indent = indent[indent.length - 1];
@@ -18571,9 +18758,9 @@ ${input.slice(result.pos)}
18571
18758
  insertReturn(exp.expressions[exp.expressions.length - 1]);
18572
18759
  return;
18573
18760
  case "IfStatement":
18574
- insertReturn(exp.children[2]);
18575
- if (exp.children[3])
18576
- insertReturn(exp.children[3][2]);
18761
+ insertReturn(exp.then);
18762
+ if (exp.else)
18763
+ insertReturn(exp.else[2]);
18577
18764
  else
18578
18765
  exp.children.push(["\n", indent, wrapWithReturn()]);
18579
18766
  return;
@@ -18634,6 +18821,14 @@ ${input.slice(result.pos)}
18634
18821
  const op = expandedOps[i];
18635
18822
  if (op.special) {
18636
18823
  let [a, wsOp, op2, wsB, b] = expandedOps.slice(i - 2, i + 3);
18824
+ if (op2.token === "instanceof" && b.type === "Literal" && b.children?.[0]?.type === "StringLiteral") {
18825
+ a = ["typeof ", module.makeLeftHandSideExpression(a)];
18826
+ if (op2.negated) {
18827
+ op2 = { ...op2, token: "!==", negated: false };
18828
+ } else {
18829
+ op2 = { ...op2, token: "===" };
18830
+ }
18831
+ }
18637
18832
  if (op2.asConst) {
18638
18833
  a = module.makeAsConst(a);
18639
18834
  b = module.makeAsConst(b);
@@ -18674,7 +18869,7 @@ ${input.slice(result.pos)}
18674
18869
  return expandedOps;
18675
18870
  };
18676
18871
  module.expandChainedComparisons = function([first, binops]) {
18677
- const relationalOps = ["==", "===", "!=", "!==", "<", "<=", ">", ">=", "in", "instanceof"];
18872
+ const relationalOps = ["==", "===", "!=", "!==", "<", "<=", ">", ">=", "in"];
18678
18873
  const lowerPrecedenceOps = ["??", "&&", "||", "&", "|", "^"];
18679
18874
  let results = [];
18680
18875
  let i = 0;
@@ -19235,7 +19430,7 @@ ${input.slice(result.pos)}
19235
19430
  break;
19236
19431
  case "Literal":
19237
19432
  case "StringLiteral":
19238
- case void 0:
19433
+ case "NumericLiteral":
19239
19434
  conditions.push([name, " in ", ref]);
19240
19435
  subRef = [ref, "[", name, "]"];
19241
19436
  break;
@@ -19298,7 +19493,8 @@ ${input.slice(result.pos)}
19298
19493
  switch (name.type) {
19299
19494
  case "ComputedPropertyName":
19300
19495
  case "Literal":
19301
- case void 0:
19496
+ case "StringLiteral":
19497
+ case "NumericLiteral":
19302
19498
  return {
19303
19499
  ...p,
19304
19500
  children: [ws, name, ": ", match, sep]
@@ -19421,7 +19617,9 @@ ${input.slice(result.pos)}
19421
19617
  const e = i < l - 1 ? ["\nelse "] : [];
19422
19618
  prev.push({
19423
19619
  type: "IfStatement",
19424
- children: ["if", condition, block, ...e, next]
19620
+ children: ["if", condition, block, ...e, next],
19621
+ then: block,
19622
+ else: e
19425
19623
  });
19426
19624
  prev = next;
19427
19625
  });
@@ -20328,7 +20526,7 @@ var parse;
20328
20526
  var uncacheable;
20329
20527
  ({ parse } = import_parser.default);
20330
20528
  ({ SourceMap: SourceMap2, base64Encode: base64Encode2 } = util_exports);
20331
- uncacheable = /* @__PURE__ */ new Set(["ActualAssignment", "ApplicationStart", "Arguments", "ArgumentsWithTrailingMemberExpressions", "ArrowFunction", "ArrowFunctionTail", "AssignmentExpression", "AssignmentExpressionTail", "BinaryOpExpression", "BinaryOpRHS", "BracedBlock", "BracedObjectLiteralContent", "BracedOrEmptyBlock", "CallExpression", "CallExpressionRest", "CoffeeCommentEnabled", "CommaDelimiter", "ConditionalExpression", "Declaration", "Debugger", "ElseClause", "Expression", "ExpressionStatement", "ExpressionWithIndentedApplicationSuppressed", "ExtendedExpression", "FatArrowBody", "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", "NestedElement", "NestedElementList", "NestedImplicitObjectLiteral", "NestedImplicitPropertyDefinition", "NestedImplicitPropertyDefinitions", "NestedInterfaceProperty", "NestedJSXChildExpression", "NestedObject", "NestedPropertyDefinitions", "NonSuppressedTrailingMemberExpressions", "ObjectLiteral", "PopIndent", "PrimaryExpression", "PushIndent", "PushJSXOpeningElement", "PushJSXOpeningFragment", "RHS", "Samedent", "ShortCircuitExpression", "SingleLineAssignmentExpression", "SingleLineComment", "SingleLineStatements", "SnugNamedProperty", "Statement", "StatementListItem", "SuppressIndentedApplication", "SuppressTrailingMemberProperty", "ThinArrowFunction", "TrackIndented", "TrailingMemberExpressions", "TrailingMemberPropertyAllowed", "TypedJSXElement", "TypedJSXFragment", "UnaryExpression", "UpdateExpression"]);
20529
+ uncacheable = /* @__PURE__ */ new Set(["ActualAssignment", "ApplicationStart", "Arguments", "ArgumentsWithTrailingMemberExpressions", "ArrowFunction", "ArrowFunctionTail", "AssignmentExpression", "AssignmentExpressionTail", "BinaryOpExpression", "BinaryOpRHS", "BracedBlock", "BracedObjectLiteralContent", "BracedOrEmptyBlock", "CallExpression", "CallExpressionRest", "CoffeeCommentEnabled", "CommaDelimiter", "ConditionalExpression", "Declaration", "Debugger", "ElseClause", "Expression", "ExpressionStatement", "ExpressionWithIndentedApplicationSuppressed", "ExtendedExpression", "FatArrowBody", "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", "NestedElement", "NestedElementList", "NestedImplicitObjectLiteral", "NestedImplicitPropertyDefinition", "NestedImplicitPropertyDefinitions", "NestedInterfaceProperty", "NestedJSXChildExpression", "NestedObject", "NestedPropertyDefinitions", "NonSingleBracedBlock", "NonSuppressedTrailingMemberExpressions", "ObjectLiteral", "PopIndent", "PostfixedExpression", "PostfixedStatement", "PrimaryExpression", "PushIndent", "PushJSXOpeningElement", "PushJSXOpeningFragment", "RHS", "Samedent", "ShortCircuitExpression", "SingleLineAssignmentExpression", "SingleLineComment", "SingleLineStatements", "SnugNamedProperty", "Statement", "StatementListItem", "SuffixedExpression", "SuffixedStatement", "SuppressIndentedApplication", "SuppressTrailingMemberProperty", "ThinArrowFunction", "TrackIndented", "TrailingMemberExpressions", "TrailingMemberPropertyAllowed", "TypedJSXElement", "TypedJSXFragment", "UnaryExpression", "UpdateExpression"]);
20332
20530
  var compile = function(src, options) {
20333
20531
  var ast, code, events, filename, ref, result, sm, srcMapJSON;
20334
20532
  if (!options) {