@danielx/civet 0.6.16 → 0.6.18

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
@@ -945,6 +945,9 @@ var require_lib = __commonJS({
945
945
  function isVoidType(t) {
946
946
  return t?.type === "LiteralType" && t.t.type === "VoidType";
947
947
  }
948
+ function isPromiseVoidType(t) {
949
+ return t?.type === "IdentifierType" && t.raw === "Promise" && t.args?.types?.length === 1 && isVoidType(t.args.types[0]);
950
+ }
948
951
  function isWhitespaceOrEmpty(node) {
949
952
  if (!node)
950
953
  return true;
@@ -1390,8 +1393,8 @@ var require_lib = __commonJS({
1390
1393
  implicitFunctionBlock(f);
1391
1394
  processParams(f);
1392
1395
  if (!processReturnValue(f) && config.implicitReturns) {
1393
- const { block, returnType } = f;
1394
- const isVoid = isVoidType(returnType?.t);
1396
+ const { async, block, returnType } = f;
1397
+ const isVoid = isVoidType(returnType?.t) || async && isPromiseVoidType(returnType?.t);
1395
1398
  const isBlock = block?.type === "BlockStatement";
1396
1399
  if (!isVoid && isBlock) {
1397
1400
  insertReturn(block);
@@ -2113,7 +2116,7 @@ var require_lib = __commonJS({
2113
2116
  if (!hasDec(x))
2114
2117
  return a.indexOf(x) === i;
2115
2118
  }).forEach(pushVar);
2116
- const fnNodes = gatherNodes(statements, (s) => s.type === "FunctionExpression");
2119
+ const fnNodes = gatherNodes(statements, isFunction);
2117
2120
  const forNodes = gatherNodes(statements, (s) => s.type === "ForStatement");
2118
2121
  const blockNodes = new Set(gatherNodes(statements, (s) => s.type === "BlockStatement"));
2119
2122
  fnNodes.forEach(({ block }) => blockNodes.delete(block));
@@ -2165,7 +2168,7 @@ var require_lib = __commonJS({
2165
2168
  }
2166
2169
  let currentScope = /* @__PURE__ */ new Set();
2167
2170
  scopes.push(currentScope);
2168
- const fnNodes = gatherNodes(statements, (s) => s.type === "FunctionExpression");
2171
+ const fnNodes = gatherNodes(statements, isFunction);
2169
2172
  const forNodes = gatherNodes(statements, (s) => s.type === "ForStatement");
2170
2173
  let targetStatements = [];
2171
2174
  for (const statement of statements) {
@@ -2998,6 +3001,7 @@ ${input.slice(result.pos)}
2998
3001
  NonPipelineArgumentPart,
2999
3002
  BinaryOpExpression,
3000
3003
  BinaryOpRHS,
3004
+ WRHS,
3001
3005
  SingleLineBinaryOpRHS,
3002
3006
  RHS,
3003
3007
  ParenthesizedAssignment,
@@ -3107,6 +3111,8 @@ ${input.slice(result.pos)}
3107
3111
  ExplicitBlock,
3108
3112
  ImplicitNestedBlock,
3109
3113
  Block,
3114
+ BareNestedBlock,
3115
+ BareBlock,
3110
3116
  ThenClause,
3111
3117
  BracedOrEmptyBlock,
3112
3118
  NoPostfixBracedOrEmptyBlock,
@@ -3231,7 +3237,9 @@ ${input.slice(result.pos)}
3231
3237
  PatternExpressionList,
3232
3238
  ConditionFragment,
3233
3239
  CaseExpressionList,
3240
+ CaseExpression,
3234
3241
  ImpliedColon,
3242
+ IgnoreColon,
3235
3243
  TryStatement,
3236
3244
  TryExpression,
3237
3245
  CatchClause,
@@ -3574,6 +3582,7 @@ ${input.slice(result.pos)}
3574
3582
  EOS,
3575
3583
  EOL,
3576
3584
  DebugHere,
3585
+ InsertColon,
3577
3586
  InsertSemicolon,
3578
3587
  InsertOpenParen,
3579
3588
  InsertCloseParen,
@@ -3874,23 +3883,24 @@ ${input.slice(result.pos)}
3874
3883
  var $R46 = $R(new RegExp("[^\\r\\n]", "suy"));
3875
3884
  var $R47 = $R(new RegExp("[ \\t]+", "suy"));
3876
3885
  var $R48 = $R(new RegExp("(?!\\p{ID_Continue})", "suy"));
3877
- var $R49 = $R(new RegExp("\\s", "suy"));
3878
- var $R50 = $R(new RegExp("(?:\\p{ID_Start}|[_$])(?:\\p{ID_Continue}|[\\u200C\\u200D$-])*", "suy"));
3879
- var $R51 = $R(new RegExp("[\\s>]|\\/>", "suy"));
3880
- var $R52 = $R(new RegExp("(?:[\\w\\-:]+|\\([^()]*\\)|\\[[^\\[\\]]*\\])+", "suy"));
3881
- var $R53 = $R(new RegExp(`"[^"]*"|'[^']*'`, "suy"));
3882
- var $R54 = $R(new RegExp("[<>]", "suy"));
3883
- var $R55 = $R(new RegExp("[!~+-](?!\\s|[!~+-]*&)", "suy"));
3884
- var $R56 = $R(new RegExp("(?:-[^-]|[^-]*)*", "suy"));
3885
- var $R57 = $R(new RegExp("[^{}<>\\r\\n]+", "suy"));
3886
- var $R58 = $R(new RegExp("[+-]?", "suy"));
3887
- var $R59 = $R(new RegExp("[+-]", "suy"));
3888
- var $R60 = $R(new RegExp("#![^\\r\\n]*", "suy"));
3889
- var $R61 = $R(new RegExp("[\\t ]*", "suy"));
3890
- var $R62 = $R(new RegExp("[\\s]*", "suy"));
3891
- var $R63 = $R(new RegExp("\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?", "suy"));
3892
- var $R64 = $R(new RegExp("\\r\\n|\\n|\\r|$", "suy"));
3893
- var $R65 = $R(new RegExp("[ \\t]*", "suy"));
3886
+ var $R49 = $R(new RegExp("['\u2019]s", "suy"));
3887
+ var $R50 = $R(new RegExp("\\s", "suy"));
3888
+ var $R51 = $R(new RegExp("(?:\\p{ID_Start}|[_$])(?:\\p{ID_Continue}|[\\u200C\\u200D$-])*", "suy"));
3889
+ var $R52 = $R(new RegExp("[\\s>]|\\/>", "suy"));
3890
+ var $R53 = $R(new RegExp("(?:[\\w\\-:]+|\\([^()]*\\)|\\[[^\\[\\]]*\\])+", "suy"));
3891
+ var $R54 = $R(new RegExp(`"[^"]*"|'[^']*'`, "suy"));
3892
+ var $R55 = $R(new RegExp("[<>]", "suy"));
3893
+ var $R56 = $R(new RegExp("[!~+-](?!\\s|[!~+-]*&)", "suy"));
3894
+ var $R57 = $R(new RegExp("(?:-[^-]|[^-]*)*", "suy"));
3895
+ var $R58 = $R(new RegExp("[^{}<>\\r\\n]+", "suy"));
3896
+ var $R59 = $R(new RegExp("[+-]?", "suy"));
3897
+ var $R60 = $R(new RegExp("[+-]", "suy"));
3898
+ var $R61 = $R(new RegExp("#![^\\r\\n]*", "suy"));
3899
+ var $R62 = $R(new RegExp("[\\t ]*", "suy"));
3900
+ var $R63 = $R(new RegExp("[\\s]*", "suy"));
3901
+ var $R64 = $R(new RegExp("\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?", "suy"));
3902
+ var $R65 = $R(new RegExp("\\r\\n|\\n|\\r|$", "suy"));
3903
+ var $R66 = $R(new RegExp("[ \\t]*", "suy"));
3894
3904
  var Program$0 = $TS($S(Reset, Init, $E(EOS), TopLevelStatements, __), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
3895
3905
  var statements = $4;
3896
3906
  processProgram({
@@ -4805,9 +4815,10 @@ ${input.slice(result.pos)}
4805
4815
  var rhs = $2;
4806
4816
  return [[], op, [], rhs];
4807
4817
  });
4808
- var BinaryOpRHS$1 = $TS($S(NewlineBinaryOpAllowed, $S(NotDedentedBinaryOp, $C(_, $S(EOS, __)), RHS)), function($skip, $loc, $0, $1, $2) {
4809
- var rhs = $2;
4810
- return [...rhs[0], ...rhs.slice(1)];
4818
+ var BinaryOpRHS$1 = $TS($S(NewlineBinaryOpAllowed, NotDedentedBinaryOp, WRHS), function($skip, $loc, $0, $1, $2, $3) {
4819
+ var op = $2;
4820
+ var rhs = $3;
4821
+ return [...op, ...rhs];
4811
4822
  });
4812
4823
  var BinaryOpRHS$2 = $T($S($N(NewlineBinaryOpAllowed), SingleLineBinaryOpRHS), function(value) {
4813
4824
  return value[1];
@@ -4834,6 +4845,35 @@ ${input.slice(result.pos)}
4834
4845
  return result;
4835
4846
  }
4836
4847
  }
4848
+ var WRHS$0 = $TS($S(PushIndent, $E($S(Nested, RHS)), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
4849
+ var wrhs = $2;
4850
+ if (!wrhs)
4851
+ return $skip;
4852
+ return wrhs;
4853
+ });
4854
+ var WRHS$1 = $S($C(_, $S(EOS, __)), RHS);
4855
+ function WRHS(state) {
4856
+ let eventData;
4857
+ if (state.events) {
4858
+ const result = state.events.enter?.("WRHS", state);
4859
+ if (result) {
4860
+ if (result.cache)
4861
+ return result.cache;
4862
+ eventData = result.data;
4863
+ }
4864
+ }
4865
+ if (state.tokenize) {
4866
+ const result = $TOKEN("WRHS", state, WRHS$0(state) || WRHS$1(state));
4867
+ if (state.events)
4868
+ state.events.exit?.("WRHS", state, result, eventData);
4869
+ return result;
4870
+ } else {
4871
+ const result = WRHS$0(state) || WRHS$1(state);
4872
+ if (state.events)
4873
+ state.events.exit?.("WRHS", state, result, eventData);
4874
+ return result;
4875
+ }
4876
+ }
4837
4877
  var SingleLineBinaryOpRHS$0 = $TS($S($E(_), BinaryOp, $C(_, $S(EOS, __)), RHS), function($skip, $loc, $0, $1, $2, $3, $4) {
4838
4878
  var ws1 = $1;
4839
4879
  var op = $2;
@@ -5540,8 +5580,8 @@ ${input.slice(result.pos)}
5540
5580
  var PrimaryExpression$2 = TemplateLiteral;
5541
5581
  var PrimaryExpression$3 = Literal;
5542
5582
  var PrimaryExpression$4 = ArrayLiteral;
5543
- var PrimaryExpression$5 = IdentifierReference;
5544
- var PrimaryExpression$6 = FunctionExpression;
5583
+ var PrimaryExpression$5 = FunctionExpression;
5584
+ var PrimaryExpression$6 = IdentifierReference;
5545
5585
  var PrimaryExpression$7 = ClassExpression;
5546
5586
  var PrimaryExpression$8 = RegularExpressionLiteral;
5547
5587
  var PrimaryExpression$9 = ParenthesizedExpression;
@@ -6608,6 +6648,8 @@ ${input.slice(result.pos)}
6608
6648
  var MemberBracketContent$1 = $TS($S(Dot, $C(TemplateLiteral, StringLiteral)), function($skip, $loc, $0, $1, $2) {
6609
6649
  var dot = $1;
6610
6650
  var str = $2;
6651
+ if (Array.isArray(dot))
6652
+ dot = dot[0];
6611
6653
  return {
6612
6654
  type: "Index",
6613
6655
  children: [
@@ -6620,6 +6662,8 @@ ${input.slice(result.pos)}
6620
6662
  var MemberBracketContent$2 = $TS($S(Dot, IntegerLiteral), function($skip, $loc, $0, $1, $2) {
6621
6663
  var dot = $1;
6622
6664
  var num = $2;
6665
+ if (Array.isArray(dot))
6666
+ dot = dot[0];
6623
6667
  return {
6624
6668
  type: "Index",
6625
6669
  children: [
@@ -8467,6 +8511,70 @@ ${input.slice(result.pos)}
8467
8511
  return result;
8468
8512
  }
8469
8513
  }
8514
+ var BareNestedBlock$0 = $TS($S($Y(EOS), AllowAll, $E(NestedBlockStatements), RestoreAll), function($skip, $loc, $0, $1, $2, $3, $4) {
8515
+ if (!$3)
8516
+ return $skip;
8517
+ return $3;
8518
+ });
8519
+ function BareNestedBlock(state) {
8520
+ let eventData;
8521
+ if (state.events) {
8522
+ const result = state.events.enter?.("BareNestedBlock", state);
8523
+ if (result) {
8524
+ if (result.cache)
8525
+ return result.cache;
8526
+ eventData = result.data;
8527
+ }
8528
+ }
8529
+ if (state.tokenize) {
8530
+ const result = $TOKEN("BareNestedBlock", state, BareNestedBlock$0(state));
8531
+ if (state.events)
8532
+ state.events.exit?.("BareNestedBlock", state, result, eventData);
8533
+ return result;
8534
+ } else {
8535
+ const result = BareNestedBlock$0(state);
8536
+ if (state.events)
8537
+ state.events.exit?.("BareNestedBlock", state, result, eventData);
8538
+ return result;
8539
+ }
8540
+ }
8541
+ var BareBlock$0 = BareNestedBlock;
8542
+ var BareBlock$1 = ExplicitBlock;
8543
+ var BareBlock$2 = ThenClause;
8544
+ var BareBlock$3 = $TS($S($E(_), $N(EOS), Statement), function($skip, $loc, $0, $1, $2, $3) {
8545
+ var ws = $1;
8546
+ var s = $3;
8547
+ const expressions = [[ws, s]];
8548
+ return {
8549
+ type: "BlockStatement",
8550
+ expressions,
8551
+ children: [expressions],
8552
+ bare: true
8553
+ };
8554
+ });
8555
+ var BareBlock$4 = EmptyBareBlock;
8556
+ function BareBlock(state) {
8557
+ let eventData;
8558
+ if (state.events) {
8559
+ const result = state.events.enter?.("BareBlock", state);
8560
+ if (result) {
8561
+ if (result.cache)
8562
+ return result.cache;
8563
+ eventData = result.data;
8564
+ }
8565
+ }
8566
+ if (state.tokenize) {
8567
+ const result = $TOKEN("BareBlock", state, BareBlock$0(state) || BareBlock$1(state) || BareBlock$2(state) || BareBlock$3(state) || BareBlock$4(state));
8568
+ if (state.events)
8569
+ state.events.exit?.("BareBlock", state, result, eventData);
8570
+ return result;
8571
+ } else {
8572
+ const result = BareBlock$0(state) || BareBlock$1(state) || BareBlock$2(state) || BareBlock$3(state) || BareBlock$4(state);
8573
+ if (state.events)
8574
+ state.events.exit?.("BareBlock", state, result, eventData);
8575
+ return result;
8576
+ }
8577
+ }
8470
8578
  var ThenClause$0 = $T($S(Then, SingleLineStatements), function(value) {
8471
8579
  return value[1];
8472
8580
  });
@@ -9801,10 +9909,24 @@ ${input.slice(result.pos)}
9801
9909
  var NestedPropertyDefinition$0 = $TS($S(Nested, $P($S(PropertyDefinition, ObjectPropertyDelimiter))), function($skip, $loc, $0, $1, $2) {
9802
9910
  var ws = $1;
9803
9911
  var inlineProps = $2;
9804
- return inlineProps.map(([prop, delimiter], i) => ({
9805
- ...prop,
9806
- children: [...i === 0 ? ws : [], ...prop.children, delimiter]
9807
- }));
9912
+ return inlineProps.flatMap(([prop, delim], i) => {
9913
+ if (!Array.isArray(prop))
9914
+ prop = [prop];
9915
+ if (i === 0) {
9916
+ const [first, ...rest] = prop;
9917
+ prop = [{ ...first, children: [...ws, ...first.children] }, ...rest];
9918
+ }
9919
+ const last = prop[prop.length - 1];
9920
+ prop = [
9921
+ ...prop.slice(0, prop.length - 1),
9922
+ {
9923
+ ...last,
9924
+ delim,
9925
+ children: [...last.children, delim]
9926
+ }
9927
+ ];
9928
+ return prop;
9929
+ });
9808
9930
  });
9809
9931
  function NestedPropertyDefinition(state) {
9810
9932
  let eventData;
@@ -9915,12 +10037,15 @@ ${input.slice(result.pos)}
9915
10037
  }
9916
10038
  }
9917
10039
  var PropertyDefinitionList$0 = $TV($P($S(PropertyDefinition, ObjectPropertyDelimiter)), function($skip, $loc, $0, $1) {
9918
- return $0.map(([prop, delim]) => {
9919
- return {
9920
- ...prop,
10040
+ return $0.flatMap(([prop, delim]) => {
10041
+ prop = Array.isArray(prop) ? prop : [prop];
10042
+ let last = prop[prop.length - 1];
10043
+ last = {
10044
+ ...last,
9921
10045
  delim,
9922
- children: [...prop.children, delim]
10046
+ children: [...last.children, delim]
9923
10047
  };
10048
+ return [...prop.slice(0, prop.length - 1), last];
9924
10049
  });
9925
10050
  });
9926
10051
  function PropertyDefinitionList(state) {
@@ -10004,8 +10129,19 @@ ${input.slice(result.pos)}
10004
10129
  var PropertyDefinition$5 = $TS($S(__, CallExpression), function($skip, $loc, $0, $1, $2) {
10005
10130
  var ws = $1;
10006
10131
  var value = $2;
10007
- if (value.type === "Identifier") {
10008
- return { ...value, children: [ws, ...value.children] };
10132
+ switch (value.type) {
10133
+ case "Identifier":
10134
+ return { ...value, children: [ws, ...value.children] };
10135
+ case "ObjectExpression":
10136
+ let first = value.properties[0];
10137
+ if (first) {
10138
+ first = {
10139
+ ...first,
10140
+ children: [ws, ...first.children],
10141
+ hoistDec: value.hoistDec
10142
+ };
10143
+ }
10144
+ return [first, ...value.properties.slice(1)];
10009
10145
  }
10010
10146
  const last = lastAccessInCallExpression(value);
10011
10147
  if (!last)
@@ -10217,13 +10353,17 @@ ${input.slice(result.pos)}
10217
10353
  return {
10218
10354
  type: "ComputedPropertyName",
10219
10355
  children: $0,
10220
- expression
10356
+ expression,
10357
+ implicit: true
10221
10358
  };
10222
10359
  });
10223
10360
  var ComputedPropertyName$2 = $TS($S(InsertOpenBracket, $EXPECT($L20, fail, 'ComputedPropertyName "-"'), NumericLiteral, InsertCloseBracket), function($skip, $loc, $0, $1, $2, $3, $4) {
10361
+ const expression = [$2, $3];
10224
10362
  return {
10225
10363
  type: "ComputedPropertyName",
10226
- children: $0
10364
+ expression,
10365
+ children: [$1, expression, $4],
10366
+ implicit: true
10227
10367
  };
10228
10368
  });
10229
10369
  function ComputedPropertyName(state) {
@@ -12851,7 +12991,7 @@ ${input.slice(result.pos)}
12851
12991
  return result;
12852
12992
  }
12853
12993
  }
12854
- var CaseClause$0 = $TS($S(PatternExpressionList, $C(ThenClause, NestedBlockStatements, EmptyBareBlock)), function($skip, $loc, $0, $1, $2) {
12994
+ var CaseClause$0 = $TS($S(PatternExpressionList, $C(ThenClause, BareBlock)), function($skip, $loc, $0, $1, $2) {
12855
12995
  var patterns = $1;
12856
12996
  var block = $2;
12857
12997
  return {
@@ -12861,13 +13001,13 @@ ${input.slice(result.pos)}
12861
13001
  patterns
12862
13002
  };
12863
13003
  });
12864
- var CaseClause$1 = $T($S(Case, CaseExpressionList, $C(NestedBlockStatements, EmptyBareBlock)), function(value) {
13004
+ var CaseClause$1 = $T($S(Case, CaseExpressionList, IgnoreColon, $C(ThenClause, BareBlock)), function(value) {
12865
13005
  return { "type": "CaseClause", "children": value };
12866
13006
  });
12867
- var CaseClause$2 = $TS($S(When, CaseExpressionList, InsertOpenBrace, $C(ThenClause, NestedBlockStatements, EmptyBareBlock), InsertBreak, InsertNewline, InsertIndent, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8) {
13007
+ var CaseClause$2 = $TS($S(When, CaseExpressionList, IgnoreColon, InsertOpenBrace, $C(ThenClause, BareBlock), InsertBreak, InsertNewline, InsertIndent, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
12868
13008
  var cases = $2;
12869
- var block = $4;
12870
- var b = $5;
13009
+ var block = $5;
13010
+ var b = $6;
12871
13011
  return {
12872
13012
  type: "WhenClause",
12873
13013
  cases,
@@ -12876,7 +13016,7 @@ ${input.slice(result.pos)}
12876
13016
  children: $0
12877
13017
  };
12878
13018
  });
12879
- var CaseClause$3 = $TS($S(Default, ImpliedColon, $C(NestedBlockStatements, EmptyBareBlock)), function($skip, $loc, $0, $1, $2, $3) {
13019
+ var CaseClause$3 = $TS($S(Default, ImpliedColon, $C(ThenClause, BareBlock)), function($skip, $loc, $0, $1, $2, $3) {
12880
13020
  var block = $3;
12881
13021
  return {
12882
13022
  type: "DefaultClause",
@@ -12972,7 +13112,7 @@ ${input.slice(result.pos)}
12972
13112
  return result;
12973
13113
  }
12974
13114
  }
12975
- var CaseExpressionList$0 = $TS($S(ForbidMultiLineImplicitObjectLiteral, $E($S($Q(_), ExpressionWithObjectApplicationForbidden, ImpliedColon)), $Q($S(__, Comma, ExpressionWithObjectApplicationForbidden, ImpliedColon)), RestoreMultiLineImplicitObjectLiteral), function($skip, $loc, $0, $1, $2, $3, $4) {
13115
+ var CaseExpressionList$0 = $TS($S(ForbidMultiLineImplicitObjectLiteral, $E($S($E(_), CaseExpression, InsertColon)), $Q($S(__, Comma, CaseExpression, InsertColon)), RestoreMultiLineImplicitObjectLiteral), function($skip, $loc, $0, $1, $2, $3, $4) {
12976
13116
  var first = $2;
12977
13117
  var rest = $3;
12978
13118
  if (!first)
@@ -13008,10 +13148,40 @@ ${input.slice(result.pos)}
13008
13148
  return result;
13009
13149
  }
13010
13150
  }
13011
- var ImpliedColon$0 = $S($E(_), Colon);
13012
- var ImpliedColon$1 = $TV($EXPECT($L0, fail, 'ImpliedColon ""'), function($skip, $loc, $0, $1) {
13013
- return { $loc, token: ":" };
13151
+ var CaseExpression$0 = $TS($S(PropertyName, $Y($S($E(_), Colon))), function($skip, $loc, $0, $1, $2) {
13152
+ var value = $1;
13153
+ if (value.type === "ComputedPropertyName") {
13154
+ if (value.implicit)
13155
+ return value.expression;
13156
+ return { ...value, type: "ArrayExpression" };
13157
+ }
13158
+ return value;
13014
13159
  });
13160
+ var CaseExpression$1 = ExpressionWithObjectApplicationForbidden;
13161
+ function CaseExpression(state) {
13162
+ let eventData;
13163
+ if (state.events) {
13164
+ const result = state.events.enter?.("CaseExpression", state);
13165
+ if (result) {
13166
+ if (result.cache)
13167
+ return result.cache;
13168
+ eventData = result.data;
13169
+ }
13170
+ }
13171
+ if (state.tokenize) {
13172
+ const result = $TOKEN("CaseExpression", state, CaseExpression$0(state) || CaseExpression$1(state));
13173
+ if (state.events)
13174
+ state.events.exit?.("CaseExpression", state, result, eventData);
13175
+ return result;
13176
+ } else {
13177
+ const result = CaseExpression$0(state) || CaseExpression$1(state);
13178
+ if (state.events)
13179
+ state.events.exit?.("CaseExpression", state, result, eventData);
13180
+ return result;
13181
+ }
13182
+ }
13183
+ var ImpliedColon$0 = $S($E(_), Colon);
13184
+ var ImpliedColon$1 = InsertColon;
13015
13185
  function ImpliedColon(state) {
13016
13186
  let eventData;
13017
13187
  if (state.events) {
@@ -13034,6 +13204,32 @@ ${input.slice(result.pos)}
13034
13204
  return result;
13035
13205
  }
13036
13206
  }
13207
+ var IgnoreColon$0 = $TV($E($S($E(_), Colon)), function($skip, $loc, $0, $1) {
13208
+ if ($1)
13209
+ return $1[0];
13210
+ });
13211
+ function IgnoreColon(state) {
13212
+ let eventData;
13213
+ if (state.events) {
13214
+ const result = state.events.enter?.("IgnoreColon", state);
13215
+ if (result) {
13216
+ if (result.cache)
13217
+ return result.cache;
13218
+ eventData = result.data;
13219
+ }
13220
+ }
13221
+ if (state.tokenize) {
13222
+ const result = $TOKEN("IgnoreColon", state, IgnoreColon$0(state));
13223
+ if (state.events)
13224
+ state.events.exit?.("IgnoreColon", state, result, eventData);
13225
+ return result;
13226
+ } else {
13227
+ const result = IgnoreColon$0(state);
13228
+ if (state.events)
13229
+ state.events.exit?.("IgnoreColon", state, result, eventData);
13230
+ return result;
13231
+ }
13232
+ }
13037
13233
  var TryStatement$0 = $TS($S(Try, $N($EXPECT($L12, fail, 'TryStatement ":"')), NoPostfixBracedOrEmptyBlock, $E(CatchClause), $E(FinallyClause)), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
13038
13234
  var t = $1;
13039
13235
  var b = $3;
@@ -17365,6 +17561,13 @@ ${input.slice(result.pos)}
17365
17561
  var Dot$0 = $TV($EXPECT($L6, fail, 'Dot "."'), function($skip, $loc, $0, $1) {
17366
17562
  return { $loc, token: $1 };
17367
17563
  });
17564
+ var Dot$1 = $TS($S($EXPECT($R49, fail, "Dot /['\u2019]s/"), _), function($skip, $loc, $0, $1, $2) {
17565
+ var ws = $2;
17566
+ return [
17567
+ { $loc, token: "." },
17568
+ insertTrimmingSpace(ws, "")
17569
+ ];
17570
+ });
17368
17571
  function Dot(state) {
17369
17572
  let eventData;
17370
17573
  if (state.events) {
@@ -17376,12 +17579,12 @@ ${input.slice(result.pos)}
17376
17579
  }
17377
17580
  }
17378
17581
  if (state.tokenize) {
17379
- const result = $TOKEN("Dot", state, Dot$0(state));
17582
+ const result = $TOKEN("Dot", state, Dot$0(state) || Dot$1(state));
17380
17583
  if (state.events)
17381
17584
  state.events.exit?.("Dot", state, result, eventData);
17382
17585
  return result;
17383
17586
  } else {
17384
- const result = Dot$0(state);
17587
+ const result = Dot$0(state) || Dot$1(state);
17385
17588
  if (state.events)
17386
17589
  state.events.exit?.("Dot", state, result, eventData);
17387
17590
  return result;
@@ -17743,7 +17946,7 @@ ${input.slice(result.pos)}
17743
17946
  return result;
17744
17947
  }
17745
17948
  }
17746
- var Import$0 = $TS($S($EXPECT($L17, fail, 'Import "import"'), $Y($EXPECT($R49, fail, "Import /\\s/"))), function($skip, $loc, $0, $1, $2) {
17949
+ var Import$0 = $TS($S($EXPECT($L17, fail, 'Import "import"'), $Y($EXPECT($R50, fail, "Import /\\s/"))), function($skip, $loc, $0, $1, $2) {
17747
17950
  return { $loc, token: $1 };
17748
17951
  });
17749
17952
  function Import(state) {
@@ -19321,7 +19524,7 @@ ${input.slice(result.pos)}
19321
19524
  return result;
19322
19525
  }
19323
19526
  }
19324
- var JSXIdentifierName$0 = $R$0($EXPECT($R50, fail, "JSXIdentifierName /(?:\\p{ID_Start}|[_$])(?:\\p{ID_Continue}|[\\u200C\\u200D$-])*/"));
19527
+ var JSXIdentifierName$0 = $R$0($EXPECT($R51, fail, "JSXIdentifierName /(?:\\p{ID_Start}|[_$])(?:\\p{ID_Continue}|[\\u200C\\u200D$-])*/"));
19325
19528
  function JSXIdentifierName(state) {
19326
19529
  let eventData;
19327
19530
  if (state.events) {
@@ -19559,7 +19762,7 @@ ${input.slice(result.pos)}
19559
19762
  return result;
19560
19763
  }
19561
19764
  }
19562
- var JSXAttributeSpace$0 = $R$0($EXPECT($R51, fail, "JSXAttributeSpace /[\\s>]|\\/>/"));
19765
+ var JSXAttributeSpace$0 = $R$0($EXPECT($R52, fail, "JSXAttributeSpace /[\\s>]|\\/>/"));
19563
19766
  function JSXAttributeSpace(state) {
19564
19767
  let eventData;
19565
19768
  if (state.events) {
@@ -19582,7 +19785,7 @@ ${input.slice(result.pos)}
19582
19785
  return result;
19583
19786
  }
19584
19787
  }
19585
- var JSXShorthandString$0 = $TR($EXPECT($R52, fail, "JSXShorthandString /(?:[\\w\\-:]+|\\([^()]*\\)|\\[[^\\[\\]]*\\])+/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
19788
+ var JSXShorthandString$0 = $TR($EXPECT($R53, fail, "JSXShorthandString /(?:[\\w\\-:]+|\\([^()]*\\)|\\[[^\\[\\]]*\\])+/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
19586
19789
  return quoteString($0);
19587
19790
  });
19588
19791
  var JSXShorthandString$1 = $TS($S(TemplateLiteral), function($skip, $loc, $0, $1) {
@@ -19671,7 +19874,7 @@ ${input.slice(result.pos)}
19671
19874
  }
19672
19875
  return [open, value, close];
19673
19876
  });
19674
- var JSXAttributeValue$4 = $R$0($EXPECT($R53, fail, `JSXAttributeValue /"[^"]*"|'[^']*'/`));
19877
+ var JSXAttributeValue$4 = $R$0($EXPECT($R54, fail, `JSXAttributeValue /"[^"]*"|'[^']*'/`));
19675
19878
  function JSXAttributeValue(state) {
19676
19879
  let eventData;
19677
19880
  if (state.events) {
@@ -19721,7 +19924,7 @@ ${input.slice(result.pos)}
19721
19924
  return result;
19722
19925
  }
19723
19926
  }
19724
- var InlineJSXBinaryOpRHS$0 = $TS($S($N($EXPECT($R54, fail, "InlineJSXBinaryOpRHS /[<>]/")), BinaryOp, InlineJSXUnaryExpression), function($skip, $loc, $0, $1, $2, $3) {
19927
+ var InlineJSXBinaryOpRHS$0 = $TS($S($N($EXPECT($R55, fail, "InlineJSXBinaryOpRHS /[<>]/")), BinaryOp, InlineJSXUnaryExpression), function($skip, $loc, $0, $1, $2, $3) {
19725
19928
  var op = $2;
19726
19929
  var rhs = $3;
19727
19930
  return [[], op, [], rhs];
@@ -19776,7 +19979,7 @@ ${input.slice(result.pos)}
19776
19979
  return result;
19777
19980
  }
19778
19981
  }
19779
- var InlineJSXUnaryOp$0 = $TR($EXPECT($R55, fail, "InlineJSXUnaryOp /[!~+-](?!\\s|[!~+-]*&)/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
19982
+ var InlineJSXUnaryOp$0 = $TR($EXPECT($R56, fail, "InlineJSXUnaryOp /[!~+-](?!\\s|[!~+-]*&)/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
19780
19983
  return { $loc, token: $0 };
19781
19984
  });
19782
19985
  function InlineJSXUnaryOp(state) {
@@ -20266,7 +20469,7 @@ ${input.slice(result.pos)}
20266
20469
  return result;
20267
20470
  }
20268
20471
  }
20269
- var JSXCommentContent$0 = $TR($EXPECT($R56, fail, "JSXCommentContent /(?:-[^-]|[^-]*)*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
20472
+ var JSXCommentContent$0 = $TR($EXPECT($R57, fail, "JSXCommentContent /(?:-[^-]|[^-]*)*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
20270
20473
  return { $loc, token: $0.replace(/\*\//g, "* /") };
20271
20474
  });
20272
20475
  function JSXCommentContent(state) {
@@ -20291,7 +20494,7 @@ ${input.slice(result.pos)}
20291
20494
  return result;
20292
20495
  }
20293
20496
  }
20294
- var JSXText$0 = $TR($EXPECT($R57, fail, "JSXText /[^{}<>\\r\\n]+/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
20497
+ var JSXText$0 = $TR($EXPECT($R58, fail, "JSXText /[^{}<>\\r\\n]+/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
20295
20498
  return {
20296
20499
  type: "JSXText",
20297
20500
  token: $0,
@@ -21259,7 +21462,7 @@ ${input.slice(result.pos)}
21259
21462
  return result;
21260
21463
  }
21261
21464
  }
21262
- var TypeIndexSignature$0 = $S($E($S($R$0($EXPECT($R58, fail, "TypeIndexSignature /[+-]?/")), Readonly, NotDedented)), OpenBracket, TypeIndex, CloseBracket, $E($S(__, $R$0($EXPECT($R59, fail, "TypeIndexSignature /[+-]/")), $Y($S($E(_), QuestionMark)))));
21465
+ var TypeIndexSignature$0 = $S($E($S($R$0($EXPECT($R59, fail, "TypeIndexSignature /[+-]?/")), Readonly, NotDedented)), OpenBracket, TypeIndex, CloseBracket, $E($S(__, $R$0($EXPECT($R60, fail, "TypeIndexSignature /[+-]/")), $Y($S($E(_), QuestionMark)))));
21263
21466
  function TypeIndexSignature(state) {
21264
21467
  let eventData;
21265
21468
  if (state.events) {
@@ -21710,17 +21913,25 @@ ${input.slice(result.pos)}
21710
21913
  return result;
21711
21914
  }
21712
21915
  }
21713
- var TypeElement$0 = $S($S(__, DotDotDot, __), Type);
21714
- var TypeElement$1 = $TS($S(Type, $E($S($E(_), DotDotDot))), function($skip, $loc, $0, $1, $2) {
21916
+ var TypeElement$0 = $TS($S(__, IdentifierName, $E(_), DotDotDot, $S(__, $E($S(QuestionMark, $E(_))), Colon, __), Type), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
21917
+ var ws = $1;
21918
+ var name = $2;
21919
+ var space = $3;
21920
+ var dots = $4;
21921
+ var colon = $5;
21922
+ var type = $6;
21923
+ return [ws, dots, space, name, colon, type];
21924
+ });
21925
+ var TypeElement$1 = $TS($S(Type, $E(_), DotDotDot), function($skip, $loc, $0, $1, $2, $3) {
21715
21926
  var type = $1;
21716
- var dots = $2;
21717
- if (!dots)
21718
- return type;
21927
+ var space = $2;
21928
+ var dots = $3;
21719
21929
  const ws = getTrimmingSpace(type);
21720
21930
  if (!ws)
21721
- return [dots[1], dots[0], type];
21722
- return [ws, dots[1], dots[0], insertTrimmingSpace(type, "")];
21931
+ return [dots, space, type];
21932
+ return [ws, dots, space, insertTrimmingSpace(type, "")];
21723
21933
  });
21934
+ var TypeElement$2 = $S($E($S(__, DotDotDot)), $E($S(__, IdentifierName, __, $E($S(QuestionMark, $E(_))), Colon, __)), Type);
21724
21935
  function TypeElement(state) {
21725
21936
  let eventData;
21726
21937
  if (state.events) {
@@ -21732,12 +21943,12 @@ ${input.slice(result.pos)}
21732
21943
  }
21733
21944
  }
21734
21945
  if (state.tokenize) {
21735
- const result = $TOKEN("TypeElement", state, TypeElement$0(state) || TypeElement$1(state));
21946
+ const result = $TOKEN("TypeElement", state, TypeElement$0(state) || TypeElement$1(state) || TypeElement$2(state));
21736
21947
  if (state.events)
21737
21948
  state.events.exit?.("TypeElement", state, result, eventData);
21738
21949
  return result;
21739
21950
  } else {
21740
- const result = TypeElement$0(state) || TypeElement$1(state);
21951
+ const result = TypeElement$0(state) || TypeElement$1(state) || TypeElement$2(state);
21741
21952
  if (state.events)
21742
21953
  state.events.exit?.("TypeElement", state, result, eventData);
21743
21954
  return result;
@@ -21771,7 +21982,7 @@ ${input.slice(result.pos)}
21771
21982
  return result;
21772
21983
  }
21773
21984
  }
21774
- var NestedType$0 = $S(Nested, Type, ArrayElementDelimiter);
21985
+ var NestedType$0 = $S(Nested, TypeElement, ArrayElementDelimiter);
21775
21986
  function NestedType(state) {
21776
21987
  let eventData;
21777
21988
  if (state.events) {
@@ -22111,7 +22322,8 @@ ${input.slice(result.pos)}
22111
22322
  }
22112
22323
  }
22113
22324
  var TypeArguments$0 = $TS($S($EXPECT($L155, fail, 'TypeArguments "<"'), $P(TypeArgument), __, $EXPECT($L34, fail, 'TypeArguments ">"')), function($skip, $loc, $0, $1, $2, $3, $4) {
22114
- return { ts: true, children: $0 };
22325
+ var args = $2;
22326
+ return { ts: true, types: args.map(([, t]) => t), children: $0 };
22115
22327
  });
22116
22328
  function TypeArguments(state) {
22117
22329
  let eventData;
@@ -22333,7 +22545,7 @@ ${input.slice(result.pos)}
22333
22545
  return result;
22334
22546
  }
22335
22547
  }
22336
- var Shebang$0 = $S($R$0($EXPECT($R60, fail, "Shebang /#![^\\r\\n]*/")), EOL);
22548
+ var Shebang$0 = $S($R$0($EXPECT($R61, fail, "Shebang /#![^\\r\\n]*/")), EOL);
22337
22549
  function Shebang(state) {
22338
22550
  let eventData;
22339
22551
  if (state.events) {
@@ -22356,11 +22568,11 @@ ${input.slice(result.pos)}
22356
22568
  return result;
22357
22569
  }
22358
22570
  }
22359
- var CivetPrologue$0 = $T($S($EXPECT($R61, fail, "CivetPrologue /[\\t ]*/"), DoubleQuote, CivetPrologueContent, DoubleQuote, $TEXT(SimpleStatementDelimiter), $E(EOS)), function(value) {
22571
+ var CivetPrologue$0 = $T($S($EXPECT($R62, fail, "CivetPrologue /[\\t ]*/"), DoubleQuote, CivetPrologueContent, DoubleQuote, $TEXT(SimpleStatementDelimiter), $E(EOS)), function(value) {
22360
22572
  var content = value[2];
22361
22573
  return content;
22362
22574
  });
22363
- var CivetPrologue$1 = $T($S($EXPECT($R61, fail, "CivetPrologue /[\\t ]*/"), SingleQuote, CivetPrologueContent, SingleQuote, $TEXT(SimpleStatementDelimiter), $E(EOS)), function(value) {
22575
+ var CivetPrologue$1 = $T($S($EXPECT($R62, fail, "CivetPrologue /[\\t ]*/"), SingleQuote, CivetPrologueContent, SingleQuote, $TEXT(SimpleStatementDelimiter), $E(EOS)), function(value) {
22364
22576
  var content = value[2];
22365
22577
  return content;
22366
22578
  });
@@ -22386,7 +22598,7 @@ ${input.slice(result.pos)}
22386
22598
  return result;
22387
22599
  }
22388
22600
  }
22389
- var CivetPrologueContent$0 = $TS($S($EXPECT($L206, fail, 'CivetPrologueContent "civet"'), NonIdContinue, $Q(CivetOption), $EXPECT($R62, fail, "CivetPrologueContent /[\\s]*/")), function($skip, $loc, $0, $1, $2, $3, $4) {
22601
+ var CivetPrologueContent$0 = $TS($S($EXPECT($L206, fail, 'CivetPrologueContent "civet"'), NonIdContinue, $Q(CivetOption), $EXPECT($R63, fail, "CivetPrologueContent /[\\s]*/")), function($skip, $loc, $0, $1, $2, $3, $4) {
22390
22602
  var options = $3;
22391
22603
  return {
22392
22604
  type: "CivetPrologue",
@@ -22416,7 +22628,7 @@ ${input.slice(result.pos)}
22416
22628
  return result;
22417
22629
  }
22418
22630
  }
22419
- var CivetOption$0 = $TR($EXPECT($R63, fail, "CivetOption /\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
22631
+ var CivetOption$0 = $TR($EXPECT($R64, fail, "CivetOption /\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
22420
22632
  const optionName = $2.replace(/-+([a-z]?)/g, (_2, l) => {
22421
22633
  if (l)
22422
22634
  return l.toUpperCase();
@@ -22452,7 +22664,7 @@ ${input.slice(result.pos)}
22452
22664
  return result;
22453
22665
  }
22454
22666
  }
22455
- var UnknownPrologue$0 = $S($R$0($EXPECT($R61, fail, "UnknownPrologue /[\\t ]*/")), StringLiteral, $TEXT(SimpleStatementDelimiter), EOS);
22667
+ var UnknownPrologue$0 = $S($R$0($EXPECT($R62, fail, "UnknownPrologue /[\\t ]*/")), StringLiteral, $TEXT(SimpleStatementDelimiter), EOS);
22456
22668
  function UnknownPrologue(state) {
22457
22669
  let eventData;
22458
22670
  if (state.events) {
@@ -22522,7 +22734,7 @@ ${input.slice(result.pos)}
22522
22734
  return result;
22523
22735
  }
22524
22736
  }
22525
- var EOL$0 = $TR($EXPECT($R64, fail, "EOL /\\r\\n|\\n|\\r|$/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
22737
+ var EOL$0 = $TR($EXPECT($R65, fail, "EOL /\\r\\n|\\n|\\r|$/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
22526
22738
  return { $loc, token: $0 };
22527
22739
  });
22528
22740
  function EOL(state) {
@@ -22572,6 +22784,31 @@ ${input.slice(result.pos)}
22572
22784
  return result;
22573
22785
  }
22574
22786
  }
22787
+ var InsertColon$0 = $TV($EXPECT($L0, fail, 'InsertColon ""'), function($skip, $loc, $0, $1) {
22788
+ return { $loc, token: ":" };
22789
+ });
22790
+ function InsertColon(state) {
22791
+ let eventData;
22792
+ if (state.events) {
22793
+ const result = state.events.enter?.("InsertColon", state);
22794
+ if (result) {
22795
+ if (result.cache)
22796
+ return result.cache;
22797
+ eventData = result.data;
22798
+ }
22799
+ }
22800
+ if (state.tokenize) {
22801
+ const result = $TOKEN("InsertColon", state, InsertColon$0(state));
22802
+ if (state.events)
22803
+ state.events.exit?.("InsertColon", state, result, eventData);
22804
+ return result;
22805
+ } else {
22806
+ const result = InsertColon$0(state);
22807
+ if (state.events)
22808
+ state.events.exit?.("InsertColon", state, result, eventData);
22809
+ return result;
22810
+ }
22811
+ }
22575
22812
  var InsertSemicolon$0 = $TV($EXPECT($L0, fail, 'InsertSemicolon ""'), function($skip, $loc, $0, $1) {
22576
22813
  return { $loc, token: ";" };
22577
22814
  });
@@ -23683,7 +23920,7 @@ ${input.slice(result.pos)}
23683
23920
  return result;
23684
23921
  }
23685
23922
  }
23686
- var Indent$0 = $TR($EXPECT($R65, fail, "Indent /[ \\t]*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
23923
+ var Indent$0 = $TR($EXPECT($R66, fail, "Indent /[ \\t]*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
23687
23924
  let level;
23688
23925
  if (module2.config.tab) {
23689
23926
  const tabs = $0.match(/\t/g);