@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.mjs CHANGED
@@ -943,6 +943,9 @@ var require_lib = __commonJS({
943
943
  function isVoidType(t) {
944
944
  return t?.type === "LiteralType" && t.t.type === "VoidType";
945
945
  }
946
+ function isPromiseVoidType(t) {
947
+ return t?.type === "IdentifierType" && t.raw === "Promise" && t.args?.types?.length === 1 && isVoidType(t.args.types[0]);
948
+ }
946
949
  function isWhitespaceOrEmpty(node) {
947
950
  if (!node)
948
951
  return true;
@@ -1388,8 +1391,8 @@ var require_lib = __commonJS({
1388
1391
  implicitFunctionBlock(f);
1389
1392
  processParams(f);
1390
1393
  if (!processReturnValue(f) && config.implicitReturns) {
1391
- const { block, returnType } = f;
1392
- const isVoid = isVoidType(returnType?.t);
1394
+ const { async, block, returnType } = f;
1395
+ const isVoid = isVoidType(returnType?.t) || async && isPromiseVoidType(returnType?.t);
1393
1396
  const isBlock = block?.type === "BlockStatement";
1394
1397
  if (!isVoid && isBlock) {
1395
1398
  insertReturn(block);
@@ -2111,7 +2114,7 @@ var require_lib = __commonJS({
2111
2114
  if (!hasDec(x))
2112
2115
  return a.indexOf(x) === i;
2113
2116
  }).forEach(pushVar);
2114
- const fnNodes = gatherNodes(statements, (s) => s.type === "FunctionExpression");
2117
+ const fnNodes = gatherNodes(statements, isFunction);
2115
2118
  const forNodes = gatherNodes(statements, (s) => s.type === "ForStatement");
2116
2119
  const blockNodes = new Set(gatherNodes(statements, (s) => s.type === "BlockStatement"));
2117
2120
  fnNodes.forEach(({ block }) => blockNodes.delete(block));
@@ -2163,7 +2166,7 @@ var require_lib = __commonJS({
2163
2166
  }
2164
2167
  let currentScope = /* @__PURE__ */ new Set();
2165
2168
  scopes.push(currentScope);
2166
- const fnNodes = gatherNodes(statements, (s) => s.type === "FunctionExpression");
2169
+ const fnNodes = gatherNodes(statements, isFunction);
2167
2170
  const forNodes = gatherNodes(statements, (s) => s.type === "ForStatement");
2168
2171
  let targetStatements = [];
2169
2172
  for (const statement of statements) {
@@ -2996,6 +2999,7 @@ ${input.slice(result.pos)}
2996
2999
  NonPipelineArgumentPart,
2997
3000
  BinaryOpExpression,
2998
3001
  BinaryOpRHS,
3002
+ WRHS,
2999
3003
  SingleLineBinaryOpRHS,
3000
3004
  RHS,
3001
3005
  ParenthesizedAssignment,
@@ -3105,6 +3109,8 @@ ${input.slice(result.pos)}
3105
3109
  ExplicitBlock,
3106
3110
  ImplicitNestedBlock,
3107
3111
  Block,
3112
+ BareNestedBlock,
3113
+ BareBlock,
3108
3114
  ThenClause,
3109
3115
  BracedOrEmptyBlock,
3110
3116
  NoPostfixBracedOrEmptyBlock,
@@ -3229,7 +3235,9 @@ ${input.slice(result.pos)}
3229
3235
  PatternExpressionList,
3230
3236
  ConditionFragment,
3231
3237
  CaseExpressionList,
3238
+ CaseExpression,
3232
3239
  ImpliedColon,
3240
+ IgnoreColon,
3233
3241
  TryStatement,
3234
3242
  TryExpression,
3235
3243
  CatchClause,
@@ -3572,6 +3580,7 @@ ${input.slice(result.pos)}
3572
3580
  EOS,
3573
3581
  EOL,
3574
3582
  DebugHere,
3583
+ InsertColon,
3575
3584
  InsertSemicolon,
3576
3585
  InsertOpenParen,
3577
3586
  InsertCloseParen,
@@ -3872,23 +3881,24 @@ ${input.slice(result.pos)}
3872
3881
  var $R46 = $R(new RegExp("[^\\r\\n]", "suy"));
3873
3882
  var $R47 = $R(new RegExp("[ \\t]+", "suy"));
3874
3883
  var $R48 = $R(new RegExp("(?!\\p{ID_Continue})", "suy"));
3875
- var $R49 = $R(new RegExp("\\s", "suy"));
3876
- var $R50 = $R(new RegExp("(?:\\p{ID_Start}|[_$])(?:\\p{ID_Continue}|[\\u200C\\u200D$-])*", "suy"));
3877
- var $R51 = $R(new RegExp("[\\s>]|\\/>", "suy"));
3878
- var $R52 = $R(new RegExp("(?:[\\w\\-:]+|\\([^()]*\\)|\\[[^\\[\\]]*\\])+", "suy"));
3879
- var $R53 = $R(new RegExp(`"[^"]*"|'[^']*'`, "suy"));
3880
- var $R54 = $R(new RegExp("[<>]", "suy"));
3881
- var $R55 = $R(new RegExp("[!~+-](?!\\s|[!~+-]*&)", "suy"));
3882
- var $R56 = $R(new RegExp("(?:-[^-]|[^-]*)*", "suy"));
3883
- var $R57 = $R(new RegExp("[^{}<>\\r\\n]+", "suy"));
3884
- var $R58 = $R(new RegExp("[+-]?", "suy"));
3885
- var $R59 = $R(new RegExp("[+-]", "suy"));
3886
- var $R60 = $R(new RegExp("#![^\\r\\n]*", "suy"));
3887
- var $R61 = $R(new RegExp("[\\t ]*", "suy"));
3888
- var $R62 = $R(new RegExp("[\\s]*", "suy"));
3889
- var $R63 = $R(new RegExp("\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?", "suy"));
3890
- var $R64 = $R(new RegExp("\\r\\n|\\n|\\r|$", "suy"));
3891
- var $R65 = $R(new RegExp("[ \\t]*", "suy"));
3884
+ var $R49 = $R(new RegExp("['\u2019]s", "suy"));
3885
+ var $R50 = $R(new RegExp("\\s", "suy"));
3886
+ var $R51 = $R(new RegExp("(?:\\p{ID_Start}|[_$])(?:\\p{ID_Continue}|[\\u200C\\u200D$-])*", "suy"));
3887
+ var $R52 = $R(new RegExp("[\\s>]|\\/>", "suy"));
3888
+ var $R53 = $R(new RegExp("(?:[\\w\\-:]+|\\([^()]*\\)|\\[[^\\[\\]]*\\])+", "suy"));
3889
+ var $R54 = $R(new RegExp(`"[^"]*"|'[^']*'`, "suy"));
3890
+ var $R55 = $R(new RegExp("[<>]", "suy"));
3891
+ var $R56 = $R(new RegExp("[!~+-](?!\\s|[!~+-]*&)", "suy"));
3892
+ var $R57 = $R(new RegExp("(?:-[^-]|[^-]*)*", "suy"));
3893
+ var $R58 = $R(new RegExp("[^{}<>\\r\\n]+", "suy"));
3894
+ var $R59 = $R(new RegExp("[+-]?", "suy"));
3895
+ var $R60 = $R(new RegExp("[+-]", "suy"));
3896
+ var $R61 = $R(new RegExp("#![^\\r\\n]*", "suy"));
3897
+ var $R62 = $R(new RegExp("[\\t ]*", "suy"));
3898
+ var $R63 = $R(new RegExp("[\\s]*", "suy"));
3899
+ var $R64 = $R(new RegExp("\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?", "suy"));
3900
+ var $R65 = $R(new RegExp("\\r\\n|\\n|\\r|$", "suy"));
3901
+ var $R66 = $R(new RegExp("[ \\t]*", "suy"));
3892
3902
  var Program$0 = $TS($S(Reset, Init, $E(EOS), TopLevelStatements, __), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
3893
3903
  var statements = $4;
3894
3904
  processProgram({
@@ -4803,9 +4813,10 @@ ${input.slice(result.pos)}
4803
4813
  var rhs = $2;
4804
4814
  return [[], op, [], rhs];
4805
4815
  });
4806
- var BinaryOpRHS$1 = $TS($S(NewlineBinaryOpAllowed, $S(NotDedentedBinaryOp, $C(_, $S(EOS, __)), RHS)), function($skip, $loc, $0, $1, $2) {
4807
- var rhs = $2;
4808
- return [...rhs[0], ...rhs.slice(1)];
4816
+ var BinaryOpRHS$1 = $TS($S(NewlineBinaryOpAllowed, NotDedentedBinaryOp, WRHS), function($skip, $loc, $0, $1, $2, $3) {
4817
+ var op = $2;
4818
+ var rhs = $3;
4819
+ return [...op, ...rhs];
4809
4820
  });
4810
4821
  var BinaryOpRHS$2 = $T($S($N(NewlineBinaryOpAllowed), SingleLineBinaryOpRHS), function(value) {
4811
4822
  return value[1];
@@ -4832,6 +4843,35 @@ ${input.slice(result.pos)}
4832
4843
  return result;
4833
4844
  }
4834
4845
  }
4846
+ var WRHS$0 = $TS($S(PushIndent, $E($S(Nested, RHS)), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
4847
+ var wrhs = $2;
4848
+ if (!wrhs)
4849
+ return $skip;
4850
+ return wrhs;
4851
+ });
4852
+ var WRHS$1 = $S($C(_, $S(EOS, __)), RHS);
4853
+ function WRHS(state) {
4854
+ let eventData;
4855
+ if (state.events) {
4856
+ const result = state.events.enter?.("WRHS", state);
4857
+ if (result) {
4858
+ if (result.cache)
4859
+ return result.cache;
4860
+ eventData = result.data;
4861
+ }
4862
+ }
4863
+ if (state.tokenize) {
4864
+ const result = $TOKEN("WRHS", state, WRHS$0(state) || WRHS$1(state));
4865
+ if (state.events)
4866
+ state.events.exit?.("WRHS", state, result, eventData);
4867
+ return result;
4868
+ } else {
4869
+ const result = WRHS$0(state) || WRHS$1(state);
4870
+ if (state.events)
4871
+ state.events.exit?.("WRHS", state, result, eventData);
4872
+ return result;
4873
+ }
4874
+ }
4835
4875
  var SingleLineBinaryOpRHS$0 = $TS($S($E(_), BinaryOp, $C(_, $S(EOS, __)), RHS), function($skip, $loc, $0, $1, $2, $3, $4) {
4836
4876
  var ws1 = $1;
4837
4877
  var op = $2;
@@ -5538,8 +5578,8 @@ ${input.slice(result.pos)}
5538
5578
  var PrimaryExpression$2 = TemplateLiteral;
5539
5579
  var PrimaryExpression$3 = Literal;
5540
5580
  var PrimaryExpression$4 = ArrayLiteral;
5541
- var PrimaryExpression$5 = IdentifierReference;
5542
- var PrimaryExpression$6 = FunctionExpression;
5581
+ var PrimaryExpression$5 = FunctionExpression;
5582
+ var PrimaryExpression$6 = IdentifierReference;
5543
5583
  var PrimaryExpression$7 = ClassExpression;
5544
5584
  var PrimaryExpression$8 = RegularExpressionLiteral;
5545
5585
  var PrimaryExpression$9 = ParenthesizedExpression;
@@ -6606,6 +6646,8 @@ ${input.slice(result.pos)}
6606
6646
  var MemberBracketContent$1 = $TS($S(Dot, $C(TemplateLiteral, StringLiteral)), function($skip, $loc, $0, $1, $2) {
6607
6647
  var dot = $1;
6608
6648
  var str = $2;
6649
+ if (Array.isArray(dot))
6650
+ dot = dot[0];
6609
6651
  return {
6610
6652
  type: "Index",
6611
6653
  children: [
@@ -6618,6 +6660,8 @@ ${input.slice(result.pos)}
6618
6660
  var MemberBracketContent$2 = $TS($S(Dot, IntegerLiteral), function($skip, $loc, $0, $1, $2) {
6619
6661
  var dot = $1;
6620
6662
  var num = $2;
6663
+ if (Array.isArray(dot))
6664
+ dot = dot[0];
6621
6665
  return {
6622
6666
  type: "Index",
6623
6667
  children: [
@@ -8465,6 +8509,70 @@ ${input.slice(result.pos)}
8465
8509
  return result;
8466
8510
  }
8467
8511
  }
8512
+ var BareNestedBlock$0 = $TS($S($Y(EOS), AllowAll, $E(NestedBlockStatements), RestoreAll), function($skip, $loc, $0, $1, $2, $3, $4) {
8513
+ if (!$3)
8514
+ return $skip;
8515
+ return $3;
8516
+ });
8517
+ function BareNestedBlock(state) {
8518
+ let eventData;
8519
+ if (state.events) {
8520
+ const result = state.events.enter?.("BareNestedBlock", state);
8521
+ if (result) {
8522
+ if (result.cache)
8523
+ return result.cache;
8524
+ eventData = result.data;
8525
+ }
8526
+ }
8527
+ if (state.tokenize) {
8528
+ const result = $TOKEN("BareNestedBlock", state, BareNestedBlock$0(state));
8529
+ if (state.events)
8530
+ state.events.exit?.("BareNestedBlock", state, result, eventData);
8531
+ return result;
8532
+ } else {
8533
+ const result = BareNestedBlock$0(state);
8534
+ if (state.events)
8535
+ state.events.exit?.("BareNestedBlock", state, result, eventData);
8536
+ return result;
8537
+ }
8538
+ }
8539
+ var BareBlock$0 = BareNestedBlock;
8540
+ var BareBlock$1 = ExplicitBlock;
8541
+ var BareBlock$2 = ThenClause;
8542
+ var BareBlock$3 = $TS($S($E(_), $N(EOS), Statement), function($skip, $loc, $0, $1, $2, $3) {
8543
+ var ws = $1;
8544
+ var s = $3;
8545
+ const expressions = [[ws, s]];
8546
+ return {
8547
+ type: "BlockStatement",
8548
+ expressions,
8549
+ children: [expressions],
8550
+ bare: true
8551
+ };
8552
+ });
8553
+ var BareBlock$4 = EmptyBareBlock;
8554
+ function BareBlock(state) {
8555
+ let eventData;
8556
+ if (state.events) {
8557
+ const result = state.events.enter?.("BareBlock", state);
8558
+ if (result) {
8559
+ if (result.cache)
8560
+ return result.cache;
8561
+ eventData = result.data;
8562
+ }
8563
+ }
8564
+ if (state.tokenize) {
8565
+ const result = $TOKEN("BareBlock", state, BareBlock$0(state) || BareBlock$1(state) || BareBlock$2(state) || BareBlock$3(state) || BareBlock$4(state));
8566
+ if (state.events)
8567
+ state.events.exit?.("BareBlock", state, result, eventData);
8568
+ return result;
8569
+ } else {
8570
+ const result = BareBlock$0(state) || BareBlock$1(state) || BareBlock$2(state) || BareBlock$3(state) || BareBlock$4(state);
8571
+ if (state.events)
8572
+ state.events.exit?.("BareBlock", state, result, eventData);
8573
+ return result;
8574
+ }
8575
+ }
8468
8576
  var ThenClause$0 = $T($S(Then, SingleLineStatements), function(value) {
8469
8577
  return value[1];
8470
8578
  });
@@ -9799,10 +9907,24 @@ ${input.slice(result.pos)}
9799
9907
  var NestedPropertyDefinition$0 = $TS($S(Nested, $P($S(PropertyDefinition, ObjectPropertyDelimiter))), function($skip, $loc, $0, $1, $2) {
9800
9908
  var ws = $1;
9801
9909
  var inlineProps = $2;
9802
- return inlineProps.map(([prop, delimiter], i) => ({
9803
- ...prop,
9804
- children: [...i === 0 ? ws : [], ...prop.children, delimiter]
9805
- }));
9910
+ return inlineProps.flatMap(([prop, delim], i) => {
9911
+ if (!Array.isArray(prop))
9912
+ prop = [prop];
9913
+ if (i === 0) {
9914
+ const [first, ...rest] = prop;
9915
+ prop = [{ ...first, children: [...ws, ...first.children] }, ...rest];
9916
+ }
9917
+ const last = prop[prop.length - 1];
9918
+ prop = [
9919
+ ...prop.slice(0, prop.length - 1),
9920
+ {
9921
+ ...last,
9922
+ delim,
9923
+ children: [...last.children, delim]
9924
+ }
9925
+ ];
9926
+ return prop;
9927
+ });
9806
9928
  });
9807
9929
  function NestedPropertyDefinition(state) {
9808
9930
  let eventData;
@@ -9913,12 +10035,15 @@ ${input.slice(result.pos)}
9913
10035
  }
9914
10036
  }
9915
10037
  var PropertyDefinitionList$0 = $TV($P($S(PropertyDefinition, ObjectPropertyDelimiter)), function($skip, $loc, $0, $1) {
9916
- return $0.map(([prop, delim]) => {
9917
- return {
9918
- ...prop,
10038
+ return $0.flatMap(([prop, delim]) => {
10039
+ prop = Array.isArray(prop) ? prop : [prop];
10040
+ let last = prop[prop.length - 1];
10041
+ last = {
10042
+ ...last,
9919
10043
  delim,
9920
- children: [...prop.children, delim]
10044
+ children: [...last.children, delim]
9921
10045
  };
10046
+ return [...prop.slice(0, prop.length - 1), last];
9922
10047
  });
9923
10048
  });
9924
10049
  function PropertyDefinitionList(state) {
@@ -10002,8 +10127,19 @@ ${input.slice(result.pos)}
10002
10127
  var PropertyDefinition$5 = $TS($S(__, CallExpression), function($skip, $loc, $0, $1, $2) {
10003
10128
  var ws = $1;
10004
10129
  var value = $2;
10005
- if (value.type === "Identifier") {
10006
- return { ...value, children: [ws, ...value.children] };
10130
+ switch (value.type) {
10131
+ case "Identifier":
10132
+ return { ...value, children: [ws, ...value.children] };
10133
+ case "ObjectExpression":
10134
+ let first = value.properties[0];
10135
+ if (first) {
10136
+ first = {
10137
+ ...first,
10138
+ children: [ws, ...first.children],
10139
+ hoistDec: value.hoistDec
10140
+ };
10141
+ }
10142
+ return [first, ...value.properties.slice(1)];
10007
10143
  }
10008
10144
  const last = lastAccessInCallExpression(value);
10009
10145
  if (!last)
@@ -10215,13 +10351,17 @@ ${input.slice(result.pos)}
10215
10351
  return {
10216
10352
  type: "ComputedPropertyName",
10217
10353
  children: $0,
10218
- expression
10354
+ expression,
10355
+ implicit: true
10219
10356
  };
10220
10357
  });
10221
10358
  var ComputedPropertyName$2 = $TS($S(InsertOpenBracket, $EXPECT($L20, fail, 'ComputedPropertyName "-"'), NumericLiteral, InsertCloseBracket), function($skip, $loc, $0, $1, $2, $3, $4) {
10359
+ const expression = [$2, $3];
10222
10360
  return {
10223
10361
  type: "ComputedPropertyName",
10224
- children: $0
10362
+ expression,
10363
+ children: [$1, expression, $4],
10364
+ implicit: true
10225
10365
  };
10226
10366
  });
10227
10367
  function ComputedPropertyName(state) {
@@ -12849,7 +12989,7 @@ ${input.slice(result.pos)}
12849
12989
  return result;
12850
12990
  }
12851
12991
  }
12852
- var CaseClause$0 = $TS($S(PatternExpressionList, $C(ThenClause, NestedBlockStatements, EmptyBareBlock)), function($skip, $loc, $0, $1, $2) {
12992
+ var CaseClause$0 = $TS($S(PatternExpressionList, $C(ThenClause, BareBlock)), function($skip, $loc, $0, $1, $2) {
12853
12993
  var patterns = $1;
12854
12994
  var block = $2;
12855
12995
  return {
@@ -12859,13 +12999,13 @@ ${input.slice(result.pos)}
12859
12999
  patterns
12860
13000
  };
12861
13001
  });
12862
- var CaseClause$1 = $T($S(Case, CaseExpressionList, $C(NestedBlockStatements, EmptyBareBlock)), function(value) {
13002
+ var CaseClause$1 = $T($S(Case, CaseExpressionList, IgnoreColon, $C(ThenClause, BareBlock)), function(value) {
12863
13003
  return { "type": "CaseClause", "children": value };
12864
13004
  });
12865
- 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) {
13005
+ 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) {
12866
13006
  var cases = $2;
12867
- var block = $4;
12868
- var b = $5;
13007
+ var block = $5;
13008
+ var b = $6;
12869
13009
  return {
12870
13010
  type: "WhenClause",
12871
13011
  cases,
@@ -12874,7 +13014,7 @@ ${input.slice(result.pos)}
12874
13014
  children: $0
12875
13015
  };
12876
13016
  });
12877
- var CaseClause$3 = $TS($S(Default, ImpliedColon, $C(NestedBlockStatements, EmptyBareBlock)), function($skip, $loc, $0, $1, $2, $3) {
13017
+ var CaseClause$3 = $TS($S(Default, ImpliedColon, $C(ThenClause, BareBlock)), function($skip, $loc, $0, $1, $2, $3) {
12878
13018
  var block = $3;
12879
13019
  return {
12880
13020
  type: "DefaultClause",
@@ -12970,7 +13110,7 @@ ${input.slice(result.pos)}
12970
13110
  return result;
12971
13111
  }
12972
13112
  }
12973
- 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) {
13113
+ 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) {
12974
13114
  var first = $2;
12975
13115
  var rest = $3;
12976
13116
  if (!first)
@@ -13006,10 +13146,40 @@ ${input.slice(result.pos)}
13006
13146
  return result;
13007
13147
  }
13008
13148
  }
13009
- var ImpliedColon$0 = $S($E(_), Colon);
13010
- var ImpliedColon$1 = $TV($EXPECT($L0, fail, 'ImpliedColon ""'), function($skip, $loc, $0, $1) {
13011
- return { $loc, token: ":" };
13149
+ var CaseExpression$0 = $TS($S(PropertyName, $Y($S($E(_), Colon))), function($skip, $loc, $0, $1, $2) {
13150
+ var value = $1;
13151
+ if (value.type === "ComputedPropertyName") {
13152
+ if (value.implicit)
13153
+ return value.expression;
13154
+ return { ...value, type: "ArrayExpression" };
13155
+ }
13156
+ return value;
13012
13157
  });
13158
+ var CaseExpression$1 = ExpressionWithObjectApplicationForbidden;
13159
+ function CaseExpression(state) {
13160
+ let eventData;
13161
+ if (state.events) {
13162
+ const result = state.events.enter?.("CaseExpression", state);
13163
+ if (result) {
13164
+ if (result.cache)
13165
+ return result.cache;
13166
+ eventData = result.data;
13167
+ }
13168
+ }
13169
+ if (state.tokenize) {
13170
+ const result = $TOKEN("CaseExpression", state, CaseExpression$0(state) || CaseExpression$1(state));
13171
+ if (state.events)
13172
+ state.events.exit?.("CaseExpression", state, result, eventData);
13173
+ return result;
13174
+ } else {
13175
+ const result = CaseExpression$0(state) || CaseExpression$1(state);
13176
+ if (state.events)
13177
+ state.events.exit?.("CaseExpression", state, result, eventData);
13178
+ return result;
13179
+ }
13180
+ }
13181
+ var ImpliedColon$0 = $S($E(_), Colon);
13182
+ var ImpliedColon$1 = InsertColon;
13013
13183
  function ImpliedColon(state) {
13014
13184
  let eventData;
13015
13185
  if (state.events) {
@@ -13032,6 +13202,32 @@ ${input.slice(result.pos)}
13032
13202
  return result;
13033
13203
  }
13034
13204
  }
13205
+ var IgnoreColon$0 = $TV($E($S($E(_), Colon)), function($skip, $loc, $0, $1) {
13206
+ if ($1)
13207
+ return $1[0];
13208
+ });
13209
+ function IgnoreColon(state) {
13210
+ let eventData;
13211
+ if (state.events) {
13212
+ const result = state.events.enter?.("IgnoreColon", state);
13213
+ if (result) {
13214
+ if (result.cache)
13215
+ return result.cache;
13216
+ eventData = result.data;
13217
+ }
13218
+ }
13219
+ if (state.tokenize) {
13220
+ const result = $TOKEN("IgnoreColon", state, IgnoreColon$0(state));
13221
+ if (state.events)
13222
+ state.events.exit?.("IgnoreColon", state, result, eventData);
13223
+ return result;
13224
+ } else {
13225
+ const result = IgnoreColon$0(state);
13226
+ if (state.events)
13227
+ state.events.exit?.("IgnoreColon", state, result, eventData);
13228
+ return result;
13229
+ }
13230
+ }
13035
13231
  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) {
13036
13232
  var t = $1;
13037
13233
  var b = $3;
@@ -17363,6 +17559,13 @@ ${input.slice(result.pos)}
17363
17559
  var Dot$0 = $TV($EXPECT($L6, fail, 'Dot "."'), function($skip, $loc, $0, $1) {
17364
17560
  return { $loc, token: $1 };
17365
17561
  });
17562
+ var Dot$1 = $TS($S($EXPECT($R49, fail, "Dot /['\u2019]s/"), _), function($skip, $loc, $0, $1, $2) {
17563
+ var ws = $2;
17564
+ return [
17565
+ { $loc, token: "." },
17566
+ insertTrimmingSpace(ws, "")
17567
+ ];
17568
+ });
17366
17569
  function Dot(state) {
17367
17570
  let eventData;
17368
17571
  if (state.events) {
@@ -17374,12 +17577,12 @@ ${input.slice(result.pos)}
17374
17577
  }
17375
17578
  }
17376
17579
  if (state.tokenize) {
17377
- const result = $TOKEN("Dot", state, Dot$0(state));
17580
+ const result = $TOKEN("Dot", state, Dot$0(state) || Dot$1(state));
17378
17581
  if (state.events)
17379
17582
  state.events.exit?.("Dot", state, result, eventData);
17380
17583
  return result;
17381
17584
  } else {
17382
- const result = Dot$0(state);
17585
+ const result = Dot$0(state) || Dot$1(state);
17383
17586
  if (state.events)
17384
17587
  state.events.exit?.("Dot", state, result, eventData);
17385
17588
  return result;
@@ -17741,7 +17944,7 @@ ${input.slice(result.pos)}
17741
17944
  return result;
17742
17945
  }
17743
17946
  }
17744
- var Import$0 = $TS($S($EXPECT($L17, fail, 'Import "import"'), $Y($EXPECT($R49, fail, "Import /\\s/"))), function($skip, $loc, $0, $1, $2) {
17947
+ var Import$0 = $TS($S($EXPECT($L17, fail, 'Import "import"'), $Y($EXPECT($R50, fail, "Import /\\s/"))), function($skip, $loc, $0, $1, $2) {
17745
17948
  return { $loc, token: $1 };
17746
17949
  });
17747
17950
  function Import(state) {
@@ -19319,7 +19522,7 @@ ${input.slice(result.pos)}
19319
19522
  return result;
19320
19523
  }
19321
19524
  }
19322
- var JSXIdentifierName$0 = $R$0($EXPECT($R50, fail, "JSXIdentifierName /(?:\\p{ID_Start}|[_$])(?:\\p{ID_Continue}|[\\u200C\\u200D$-])*/"));
19525
+ var JSXIdentifierName$0 = $R$0($EXPECT($R51, fail, "JSXIdentifierName /(?:\\p{ID_Start}|[_$])(?:\\p{ID_Continue}|[\\u200C\\u200D$-])*/"));
19323
19526
  function JSXIdentifierName(state) {
19324
19527
  let eventData;
19325
19528
  if (state.events) {
@@ -19557,7 +19760,7 @@ ${input.slice(result.pos)}
19557
19760
  return result;
19558
19761
  }
19559
19762
  }
19560
- var JSXAttributeSpace$0 = $R$0($EXPECT($R51, fail, "JSXAttributeSpace /[\\s>]|\\/>/"));
19763
+ var JSXAttributeSpace$0 = $R$0($EXPECT($R52, fail, "JSXAttributeSpace /[\\s>]|\\/>/"));
19561
19764
  function JSXAttributeSpace(state) {
19562
19765
  let eventData;
19563
19766
  if (state.events) {
@@ -19580,7 +19783,7 @@ ${input.slice(result.pos)}
19580
19783
  return result;
19581
19784
  }
19582
19785
  }
19583
- var JSXShorthandString$0 = $TR($EXPECT($R52, fail, "JSXShorthandString /(?:[\\w\\-:]+|\\([^()]*\\)|\\[[^\\[\\]]*\\])+/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
19786
+ var JSXShorthandString$0 = $TR($EXPECT($R53, fail, "JSXShorthandString /(?:[\\w\\-:]+|\\([^()]*\\)|\\[[^\\[\\]]*\\])+/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
19584
19787
  return quoteString($0);
19585
19788
  });
19586
19789
  var JSXShorthandString$1 = $TS($S(TemplateLiteral), function($skip, $loc, $0, $1) {
@@ -19669,7 +19872,7 @@ ${input.slice(result.pos)}
19669
19872
  }
19670
19873
  return [open, value, close];
19671
19874
  });
19672
- var JSXAttributeValue$4 = $R$0($EXPECT($R53, fail, `JSXAttributeValue /"[^"]*"|'[^']*'/`));
19875
+ var JSXAttributeValue$4 = $R$0($EXPECT($R54, fail, `JSXAttributeValue /"[^"]*"|'[^']*'/`));
19673
19876
  function JSXAttributeValue(state) {
19674
19877
  let eventData;
19675
19878
  if (state.events) {
@@ -19719,7 +19922,7 @@ ${input.slice(result.pos)}
19719
19922
  return result;
19720
19923
  }
19721
19924
  }
19722
- var InlineJSXBinaryOpRHS$0 = $TS($S($N($EXPECT($R54, fail, "InlineJSXBinaryOpRHS /[<>]/")), BinaryOp, InlineJSXUnaryExpression), function($skip, $loc, $0, $1, $2, $3) {
19925
+ var InlineJSXBinaryOpRHS$0 = $TS($S($N($EXPECT($R55, fail, "InlineJSXBinaryOpRHS /[<>]/")), BinaryOp, InlineJSXUnaryExpression), function($skip, $loc, $0, $1, $2, $3) {
19723
19926
  var op = $2;
19724
19927
  var rhs = $3;
19725
19928
  return [[], op, [], rhs];
@@ -19774,7 +19977,7 @@ ${input.slice(result.pos)}
19774
19977
  return result;
19775
19978
  }
19776
19979
  }
19777
- var InlineJSXUnaryOp$0 = $TR($EXPECT($R55, fail, "InlineJSXUnaryOp /[!~+-](?!\\s|[!~+-]*&)/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
19980
+ var InlineJSXUnaryOp$0 = $TR($EXPECT($R56, fail, "InlineJSXUnaryOp /[!~+-](?!\\s|[!~+-]*&)/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
19778
19981
  return { $loc, token: $0 };
19779
19982
  });
19780
19983
  function InlineJSXUnaryOp(state) {
@@ -20264,7 +20467,7 @@ ${input.slice(result.pos)}
20264
20467
  return result;
20265
20468
  }
20266
20469
  }
20267
- var JSXCommentContent$0 = $TR($EXPECT($R56, fail, "JSXCommentContent /(?:-[^-]|[^-]*)*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
20470
+ var JSXCommentContent$0 = $TR($EXPECT($R57, fail, "JSXCommentContent /(?:-[^-]|[^-]*)*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
20268
20471
  return { $loc, token: $0.replace(/\*\//g, "* /") };
20269
20472
  });
20270
20473
  function JSXCommentContent(state) {
@@ -20289,7 +20492,7 @@ ${input.slice(result.pos)}
20289
20492
  return result;
20290
20493
  }
20291
20494
  }
20292
- var JSXText$0 = $TR($EXPECT($R57, fail, "JSXText /[^{}<>\\r\\n]+/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
20495
+ var JSXText$0 = $TR($EXPECT($R58, fail, "JSXText /[^{}<>\\r\\n]+/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
20293
20496
  return {
20294
20497
  type: "JSXText",
20295
20498
  token: $0,
@@ -21257,7 +21460,7 @@ ${input.slice(result.pos)}
21257
21460
  return result;
21258
21461
  }
21259
21462
  }
21260
- 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)))));
21463
+ 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)))));
21261
21464
  function TypeIndexSignature(state) {
21262
21465
  let eventData;
21263
21466
  if (state.events) {
@@ -21708,17 +21911,25 @@ ${input.slice(result.pos)}
21708
21911
  return result;
21709
21912
  }
21710
21913
  }
21711
- var TypeElement$0 = $S($S(__, DotDotDot, __), Type);
21712
- var TypeElement$1 = $TS($S(Type, $E($S($E(_), DotDotDot))), function($skip, $loc, $0, $1, $2) {
21914
+ 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) {
21915
+ var ws = $1;
21916
+ var name = $2;
21917
+ var space = $3;
21918
+ var dots = $4;
21919
+ var colon = $5;
21920
+ var type = $6;
21921
+ return [ws, dots, space, name, colon, type];
21922
+ });
21923
+ var TypeElement$1 = $TS($S(Type, $E(_), DotDotDot), function($skip, $loc, $0, $1, $2, $3) {
21713
21924
  var type = $1;
21714
- var dots = $2;
21715
- if (!dots)
21716
- return type;
21925
+ var space = $2;
21926
+ var dots = $3;
21717
21927
  const ws = getTrimmingSpace(type);
21718
21928
  if (!ws)
21719
- return [dots[1], dots[0], type];
21720
- return [ws, dots[1], dots[0], insertTrimmingSpace(type, "")];
21929
+ return [dots, space, type];
21930
+ return [ws, dots, space, insertTrimmingSpace(type, "")];
21721
21931
  });
21932
+ var TypeElement$2 = $S($E($S(__, DotDotDot)), $E($S(__, IdentifierName, __, $E($S(QuestionMark, $E(_))), Colon, __)), Type);
21722
21933
  function TypeElement(state) {
21723
21934
  let eventData;
21724
21935
  if (state.events) {
@@ -21730,12 +21941,12 @@ ${input.slice(result.pos)}
21730
21941
  }
21731
21942
  }
21732
21943
  if (state.tokenize) {
21733
- const result = $TOKEN("TypeElement", state, TypeElement$0(state) || TypeElement$1(state));
21944
+ const result = $TOKEN("TypeElement", state, TypeElement$0(state) || TypeElement$1(state) || TypeElement$2(state));
21734
21945
  if (state.events)
21735
21946
  state.events.exit?.("TypeElement", state, result, eventData);
21736
21947
  return result;
21737
21948
  } else {
21738
- const result = TypeElement$0(state) || TypeElement$1(state);
21949
+ const result = TypeElement$0(state) || TypeElement$1(state) || TypeElement$2(state);
21739
21950
  if (state.events)
21740
21951
  state.events.exit?.("TypeElement", state, result, eventData);
21741
21952
  return result;
@@ -21769,7 +21980,7 @@ ${input.slice(result.pos)}
21769
21980
  return result;
21770
21981
  }
21771
21982
  }
21772
- var NestedType$0 = $S(Nested, Type, ArrayElementDelimiter);
21983
+ var NestedType$0 = $S(Nested, TypeElement, ArrayElementDelimiter);
21773
21984
  function NestedType(state) {
21774
21985
  let eventData;
21775
21986
  if (state.events) {
@@ -22109,7 +22320,8 @@ ${input.slice(result.pos)}
22109
22320
  }
22110
22321
  }
22111
22322
  var TypeArguments$0 = $TS($S($EXPECT($L155, fail, 'TypeArguments "<"'), $P(TypeArgument), __, $EXPECT($L34, fail, 'TypeArguments ">"')), function($skip, $loc, $0, $1, $2, $3, $4) {
22112
- return { ts: true, children: $0 };
22323
+ var args = $2;
22324
+ return { ts: true, types: args.map(([, t]) => t), children: $0 };
22113
22325
  });
22114
22326
  function TypeArguments(state) {
22115
22327
  let eventData;
@@ -22331,7 +22543,7 @@ ${input.slice(result.pos)}
22331
22543
  return result;
22332
22544
  }
22333
22545
  }
22334
- var Shebang$0 = $S($R$0($EXPECT($R60, fail, "Shebang /#![^\\r\\n]*/")), EOL);
22546
+ var Shebang$0 = $S($R$0($EXPECT($R61, fail, "Shebang /#![^\\r\\n]*/")), EOL);
22335
22547
  function Shebang(state) {
22336
22548
  let eventData;
22337
22549
  if (state.events) {
@@ -22354,11 +22566,11 @@ ${input.slice(result.pos)}
22354
22566
  return result;
22355
22567
  }
22356
22568
  }
22357
- var CivetPrologue$0 = $T($S($EXPECT($R61, fail, "CivetPrologue /[\\t ]*/"), DoubleQuote, CivetPrologueContent, DoubleQuote, $TEXT(SimpleStatementDelimiter), $E(EOS)), function(value) {
22569
+ var CivetPrologue$0 = $T($S($EXPECT($R62, fail, "CivetPrologue /[\\t ]*/"), DoubleQuote, CivetPrologueContent, DoubleQuote, $TEXT(SimpleStatementDelimiter), $E(EOS)), function(value) {
22358
22570
  var content = value[2];
22359
22571
  return content;
22360
22572
  });
22361
- var CivetPrologue$1 = $T($S($EXPECT($R61, fail, "CivetPrologue /[\\t ]*/"), SingleQuote, CivetPrologueContent, SingleQuote, $TEXT(SimpleStatementDelimiter), $E(EOS)), function(value) {
22573
+ var CivetPrologue$1 = $T($S($EXPECT($R62, fail, "CivetPrologue /[\\t ]*/"), SingleQuote, CivetPrologueContent, SingleQuote, $TEXT(SimpleStatementDelimiter), $E(EOS)), function(value) {
22362
22574
  var content = value[2];
22363
22575
  return content;
22364
22576
  });
@@ -22384,7 +22596,7 @@ ${input.slice(result.pos)}
22384
22596
  return result;
22385
22597
  }
22386
22598
  }
22387
- 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) {
22599
+ 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) {
22388
22600
  var options = $3;
22389
22601
  return {
22390
22602
  type: "CivetPrologue",
@@ -22414,7 +22626,7 @@ ${input.slice(result.pos)}
22414
22626
  return result;
22415
22627
  }
22416
22628
  }
22417
- 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) {
22629
+ 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) {
22418
22630
  const optionName = $2.replace(/-+([a-z]?)/g, (_2, l) => {
22419
22631
  if (l)
22420
22632
  return l.toUpperCase();
@@ -22450,7 +22662,7 @@ ${input.slice(result.pos)}
22450
22662
  return result;
22451
22663
  }
22452
22664
  }
22453
- var UnknownPrologue$0 = $S($R$0($EXPECT($R61, fail, "UnknownPrologue /[\\t ]*/")), StringLiteral, $TEXT(SimpleStatementDelimiter), EOS);
22665
+ var UnknownPrologue$0 = $S($R$0($EXPECT($R62, fail, "UnknownPrologue /[\\t ]*/")), StringLiteral, $TEXT(SimpleStatementDelimiter), EOS);
22454
22666
  function UnknownPrologue(state) {
22455
22667
  let eventData;
22456
22668
  if (state.events) {
@@ -22520,7 +22732,7 @@ ${input.slice(result.pos)}
22520
22732
  return result;
22521
22733
  }
22522
22734
  }
22523
- 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) {
22735
+ 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) {
22524
22736
  return { $loc, token: $0 };
22525
22737
  });
22526
22738
  function EOL(state) {
@@ -22570,6 +22782,31 @@ ${input.slice(result.pos)}
22570
22782
  return result;
22571
22783
  }
22572
22784
  }
22785
+ var InsertColon$0 = $TV($EXPECT($L0, fail, 'InsertColon ""'), function($skip, $loc, $0, $1) {
22786
+ return { $loc, token: ":" };
22787
+ });
22788
+ function InsertColon(state) {
22789
+ let eventData;
22790
+ if (state.events) {
22791
+ const result = state.events.enter?.("InsertColon", state);
22792
+ if (result) {
22793
+ if (result.cache)
22794
+ return result.cache;
22795
+ eventData = result.data;
22796
+ }
22797
+ }
22798
+ if (state.tokenize) {
22799
+ const result = $TOKEN("InsertColon", state, InsertColon$0(state));
22800
+ if (state.events)
22801
+ state.events.exit?.("InsertColon", state, result, eventData);
22802
+ return result;
22803
+ } else {
22804
+ const result = InsertColon$0(state);
22805
+ if (state.events)
22806
+ state.events.exit?.("InsertColon", state, result, eventData);
22807
+ return result;
22808
+ }
22809
+ }
22573
22810
  var InsertSemicolon$0 = $TV($EXPECT($L0, fail, 'InsertSemicolon ""'), function($skip, $loc, $0, $1) {
22574
22811
  return { $loc, token: ";" };
22575
22812
  });
@@ -23681,7 +23918,7 @@ ${input.slice(result.pos)}
23681
23918
  return result;
23682
23919
  }
23683
23920
  }
23684
- var Indent$0 = $TR($EXPECT($R65, fail, "Indent /[ \\t]*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
23921
+ var Indent$0 = $TR($EXPECT($R66, fail, "Indent /[ \\t]*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
23685
23922
  let level;
23686
23923
  if (module.config.tab) {
23687
23924
  const tabs = $0.match(/\t/g);