@danielx/civet 0.4.29 → 0.4.30

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.
Files changed (3) hide show
  1. package/dist/browser.js +137 -51
  2. package/dist/main.js +137 -51
  3. package/package.json +1 -1
package/dist/browser.js CHANGED
@@ -939,19 +939,19 @@ ${input.slice(result.pos)}
939
939
  var $L13 = $L("import.meta");
940
940
  var $L14 = $L(")");
941
941
  var $L15 = $L("->");
942
- var $L16 = $L("null");
943
- var $L17 = $L("true");
944
- var $L18 = $L("false");
945
- var $L19 = $L("yes");
946
- var $L20 = $L("on");
947
- var $L21 = $L("no");
948
- var $L22 = $L("off");
949
- var $L23 = $L(",");
950
- var $L24 = $L("=");
951
- var $L25 = $L(">");
952
- var $L26 = $L("]");
953
- var $L27 = $L(":");
954
- var $L28 = $L("}");
942
+ var $L16 = $L("}");
943
+ var $L17 = $L("null");
944
+ var $L18 = $L("true");
945
+ var $L19 = $L("false");
946
+ var $L20 = $L("yes");
947
+ var $L21 = $L("on");
948
+ var $L22 = $L("no");
949
+ var $L23 = $L("off");
950
+ var $L24 = $L(",");
951
+ var $L25 = $L("=");
952
+ var $L26 = $L(">");
953
+ var $L27 = $L("]");
954
+ var $L28 = $L(":");
955
955
  var $L29 = $L("**=");
956
956
  var $L30 = $L("*=");
957
957
  var $L31 = $L("/=");
@@ -3808,8 +3808,15 @@ ${input.slice(result.pos)}
3808
3808
  return {
3809
3809
  type: "BlockStatement",
3810
3810
  expressions,
3811
- children: [$1, expressions],
3812
- bare: true
3811
+ children: [$1, expressions]
3812
+ };
3813
+ });
3814
+ var BracedContent$2 = $TV($Y($S(__, $EXPECT($L16, fail, 'BracedContent "}"'))), function($skip, $loc, $0, $1) {
3815
+ const expressions = [];
3816
+ return {
3817
+ type: "BlockStatement",
3818
+ expressions,
3819
+ children: [expressions]
3813
3820
  };
3814
3821
  });
3815
3822
  function BracedContent(state) {
@@ -3819,12 +3826,12 @@ ${input.slice(result.pos)}
3819
3826
  return result.cache;
3820
3827
  }
3821
3828
  if (state.tokenize) {
3822
- const result = $TOKEN("BracedContent", state, BracedContent$0(state) || BracedContent$1(state));
3829
+ const result = $TOKEN("BracedContent", state, BracedContent$0(state) || BracedContent$1(state) || BracedContent$2(state));
3823
3830
  if (state.events)
3824
3831
  state.events.exit?.("BracedContent", state, result);
3825
3832
  return result;
3826
3833
  } else {
3827
- const result = BracedContent$0(state) || BracedContent$1(state);
3834
+ const result = BracedContent$0(state) || BracedContent$1(state) || BracedContent$2(state);
3828
3835
  if (state.events)
3829
3836
  state.events.exit?.("BracedContent", state, result);
3830
3837
  return result;
@@ -3929,7 +3936,7 @@ ${input.slice(result.pos)}
3929
3936
  return result;
3930
3937
  }
3931
3938
  }
3932
- var NullLiteral$0 = $TV($EXPECT($L16, fail, 'NullLiteral "null"'), function($skip, $loc, $0, $1) {
3939
+ var NullLiteral$0 = $TV($EXPECT($L17, fail, 'NullLiteral "null"'), function($skip, $loc, $0, $1) {
3933
3940
  return { $loc, token: $1 };
3934
3941
  });
3935
3942
  function NullLiteral(state) {
@@ -3953,7 +3960,7 @@ ${input.slice(result.pos)}
3953
3960
  var BooleanLiteral$0 = $T($S(CoffeeBooleansEnabled, CoffeeScriptBooleanLiteral), function(value) {
3954
3961
  return value[1];
3955
3962
  });
3956
- var BooleanLiteral$1 = $TS($S($C($EXPECT($L17, fail, 'BooleanLiteral "true"'), $EXPECT($L18, fail, 'BooleanLiteral "false"')), NonIdContinue), function($skip, $loc, $0, $1, $2) {
3963
+ var BooleanLiteral$1 = $TS($S($C($EXPECT($L18, fail, 'BooleanLiteral "true"'), $EXPECT($L19, fail, 'BooleanLiteral "false"')), NonIdContinue), function($skip, $loc, $0, $1, $2) {
3957
3964
  return { $loc, token: $1 };
3958
3965
  });
3959
3966
  function BooleanLiteral(state) {
@@ -3974,10 +3981,10 @@ ${input.slice(result.pos)}
3974
3981
  return result;
3975
3982
  }
3976
3983
  }
3977
- var CoffeeScriptBooleanLiteral$0 = $TS($S($C($EXPECT($L19, fail, 'CoffeeScriptBooleanLiteral "yes"'), $EXPECT($L20, fail, 'CoffeeScriptBooleanLiteral "on"')), NonIdContinue), function($skip, $loc, $0, $1, $2) {
3984
+ var CoffeeScriptBooleanLiteral$0 = $TS($S($C($EXPECT($L20, fail, 'CoffeeScriptBooleanLiteral "yes"'), $EXPECT($L21, fail, 'CoffeeScriptBooleanLiteral "on"')), NonIdContinue), function($skip, $loc, $0, $1, $2) {
3978
3985
  return { $loc, token: "true" };
3979
3986
  });
3980
- var CoffeeScriptBooleanLiteral$1 = $TS($S($C($EXPECT($L21, fail, 'CoffeeScriptBooleanLiteral "no"'), $EXPECT($L22, fail, 'CoffeeScriptBooleanLiteral "off"')), NonIdContinue), function($skip, $loc, $0, $1, $2) {
3987
+ var CoffeeScriptBooleanLiteral$1 = $TS($S($C($EXPECT($L22, fail, 'CoffeeScriptBooleanLiteral "no"'), $EXPECT($L23, fail, 'CoffeeScriptBooleanLiteral "off"')), NonIdContinue), function($skip, $loc, $0, $1, $2) {
3981
3988
  return { $loc, token: "false" };
3982
3989
  });
3983
3990
  function CoffeeScriptBooleanLiteral(state) {
@@ -3998,7 +4005,7 @@ ${input.slice(result.pos)}
3998
4005
  return result;
3999
4006
  }
4000
4007
  }
4001
- var Comma$0 = $TV($EXPECT($L23, fail, 'Comma ","'), function($skip, $loc, $0, $1) {
4008
+ var Comma$0 = $TV($EXPECT($L24, fail, 'Comma ","'), function($skip, $loc, $0, $1) {
4002
4009
  return { $loc, token: $1 };
4003
4010
  });
4004
4011
  function Comma(state) {
@@ -4088,7 +4095,7 @@ ${input.slice(result.pos)}
4088
4095
  return result;
4089
4096
  }
4090
4097
  }
4091
- var UpcomingAssignment$0 = $Y($S(__, $EXPECT($L24, fail, 'UpcomingAssignment "="'), $N($C($EXPECT($L24, fail, 'UpcomingAssignment "="'), $EXPECT($L25, fail, 'UpcomingAssignment ">"')))));
4098
+ var UpcomingAssignment$0 = $Y($S(__, $EXPECT($L25, fail, 'UpcomingAssignment "="'), $N($C($EXPECT($L25, fail, 'UpcomingAssignment "="'), $EXPECT($L26, fail, 'UpcomingAssignment ">"')))));
4092
4099
  function UpcomingAssignment(state) {
4093
4100
  if (state.events) {
4094
4101
  const result = state.events.enter?.("UpcomingAssignment", state);
@@ -4327,7 +4334,7 @@ ${input.slice(result.pos)}
4327
4334
  }
4328
4335
  }
4329
4336
  var ArrayElementDelimiter$0 = $S(__, Comma);
4330
- var ArrayElementDelimiter$1 = $Y($S(__, $EXPECT($L26, fail, 'ArrayElementDelimiter "]"')));
4337
+ var ArrayElementDelimiter$1 = $Y($S(__, $EXPECT($L27, fail, 'ArrayElementDelimiter "]"')));
4331
4338
  var ArrayElementDelimiter$2 = $TV($Y(EOS), function($skip, $loc, $0, $1) {
4332
4339
  return { $loc, token: "," };
4333
4340
  });
@@ -4692,11 +4699,11 @@ ${input.slice(result.pos)}
4692
4699
  return result;
4693
4700
  }
4694
4701
  }
4695
- var ImplicitInlineObjectPropertyDelimiter$0 = $S($Q(TrailingComment), $EXPECT($L23, fail, 'ImplicitInlineObjectPropertyDelimiter ","'));
4702
+ var ImplicitInlineObjectPropertyDelimiter$0 = $S($Q(TrailingComment), $EXPECT($L24, fail, 'ImplicitInlineObjectPropertyDelimiter ","'));
4696
4703
  var ImplicitInlineObjectPropertyDelimiter$1 = $T($Y($S(EOS, NamedProperty)), function(value) {
4697
4704
  return ",";
4698
4705
  });
4699
- var ImplicitInlineObjectPropertyDelimiter$2 = $T($Y($S(__, $C($EXPECT($L27, fail, 'ImplicitInlineObjectPropertyDelimiter ":"'), $EXPECT($L14, fail, 'ImplicitInlineObjectPropertyDelimiter ")"'), $EXPECT($L26, fail, 'ImplicitInlineObjectPropertyDelimiter "]"'), $EXPECT($L28, fail, 'ImplicitInlineObjectPropertyDelimiter "}"'), ReservedWord))), function(value) {
4706
+ var ImplicitInlineObjectPropertyDelimiter$2 = $T($Y($S(__, $C($EXPECT($L28, fail, 'ImplicitInlineObjectPropertyDelimiter ":"'), $EXPECT($L14, fail, 'ImplicitInlineObjectPropertyDelimiter ")"'), $EXPECT($L27, fail, 'ImplicitInlineObjectPropertyDelimiter "]"'), $EXPECT($L16, fail, 'ImplicitInlineObjectPropertyDelimiter "}"'), ReservedWord))), function(value) {
4700
4707
  return "";
4701
4708
  });
4702
4709
  var ImplicitInlineObjectPropertyDelimiter$3 = $T($Y(EOS), function(value) {
@@ -4721,7 +4728,7 @@ ${input.slice(result.pos)}
4721
4728
  }
4722
4729
  }
4723
4730
  var ObjectPropertyDelimiter$0 = $S($Q(_), Comma);
4724
- var ObjectPropertyDelimiter$1 = $Y($S(__, $EXPECT($L28, fail, 'ObjectPropertyDelimiter "}"')));
4731
+ var ObjectPropertyDelimiter$1 = $Y($S(__, $EXPECT($L16, fail, 'ObjectPropertyDelimiter "}"')));
4725
4732
  var ObjectPropertyDelimiter$2 = $TV($Y(EOS), function($skip, $loc, $0, $1) {
4726
4733
  return { $loc, token: "," };
4727
4734
  });
@@ -4773,10 +4780,13 @@ ${input.slice(result.pos)}
4773
4780
  var ws = $1;
4774
4781
  var at = $2;
4775
4782
  var id = $3;
4783
+ const value = [{ ...at, token: "this." }, id];
4776
4784
  return {
4777
4785
  type: "Property",
4778
- children: [...ws, id, ": ", { ...at, token: "this." }, id],
4779
- names: id.names
4786
+ children: [...ws, id, ": ", ...value],
4787
+ name: id,
4788
+ names: id.names,
4789
+ value
4780
4790
  };
4781
4791
  });
4782
4792
  var PropertyDefinition$1 = NamedProperty;
@@ -4795,7 +4805,8 @@ ${input.slice(result.pos)}
4795
4805
  return {
4796
4806
  type: "SpreadProperty",
4797
4807
  children: [...ws, dots, exp],
4798
- names: exp.names
4808
+ names: exp.names,
4809
+ value: [dots, exp]
4799
4810
  };
4800
4811
  });
4801
4812
  var PropertyDefinition$4 = $TS($S(__, IdentifierReference), function($skip, $loc, $0, $1, $2) {
@@ -4822,11 +4833,14 @@ ${input.slice(result.pos)}
4822
4833
  }
4823
4834
  }
4824
4835
  var NamedProperty$0 = $TS($S(__, PropertyName, __, Colon, ExtendedExpression), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
4836
+ var name = $2;
4825
4837
  var exp = $5;
4826
4838
  return {
4827
4839
  type: "Property",
4828
4840
  children: $0,
4829
- names: exp.names || []
4841
+ name,
4842
+ names: exp.names || [],
4843
+ value: exp
4830
4844
  };
4831
4845
  });
4832
4846
  function NamedProperty(state) {
@@ -4876,7 +4890,12 @@ ${input.slice(result.pos)}
4876
4890
  var PropertyName$0 = NumericLiteral;
4877
4891
  var PropertyName$1 = StringLiteral;
4878
4892
  var PropertyName$2 = IdentifierName;
4879
- var PropertyName$3 = $S(OpenBracket, ExtendedExpression, __, CloseBracket);
4893
+ var PropertyName$3 = $TS($S(OpenBracket, ExtendedExpression, __, CloseBracket), function($skip, $loc, $0, $1, $2, $3, $4) {
4894
+ return {
4895
+ type: "ComputedPropertyName",
4896
+ children: $0
4897
+ };
4898
+ });
4880
4899
  function PropertyName(state) {
4881
4900
  if (state.events) {
4882
4901
  const result = state.events.enter?.("PropertyName", state);
@@ -4934,11 +4953,14 @@ ${input.slice(result.pos)}
4934
4953
  }
4935
4954
  }
4936
4955
  var MethodDefinition$0 = $TS($S($E(Decorators), MethodSignature, BracedBlock), function($skip, $loc, $0, $1, $2, $3) {
4956
+ var decorators = $1;
4937
4957
  var signature = $2;
4938
4958
  var block = $3;
4939
4959
  return {
4940
4960
  type: "MethodDefinition",
4941
4961
  children: $0,
4962
+ name: signature.name,
4963
+ decorators,
4942
4964
  signature,
4943
4965
  block,
4944
4966
  parameters: signature.parameters
@@ -4965,7 +4987,6 @@ ${input.slice(result.pos)}
4965
4987
  var MethodModifier$0 = $S(GetOrSet, $Q(TrailingComment));
4966
4988
  var MethodModifier$1 = $S($S(Async, __), $E($S(Star, __)));
4967
4989
  var MethodModifier$2 = $S(Star, __);
4968
- var MethodModifier$3 = $S(Async, __);
4969
4990
  function MethodModifier(state) {
4970
4991
  if (state.events) {
4971
4992
  const result = state.events.enter?.("MethodModifier", state);
@@ -4973,12 +4994,12 @@ ${input.slice(result.pos)}
4973
4994
  return result.cache;
4974
4995
  }
4975
4996
  if (state.tokenize) {
4976
- const result = $TOKEN("MethodModifier", state, MethodModifier$0(state) || MethodModifier$1(state) || MethodModifier$2(state) || MethodModifier$3(state));
4997
+ const result = $TOKEN("MethodModifier", state, MethodModifier$0(state) || MethodModifier$1(state) || MethodModifier$2(state));
4977
4998
  if (state.events)
4978
4999
  state.events.exit?.("MethodModifier", state, result);
4979
5000
  return result;
4980
5001
  } else {
4981
- const result = MethodModifier$0(state) || MethodModifier$1(state) || MethodModifier$2(state) || MethodModifier$3(state);
5002
+ const result = MethodModifier$0(state) || MethodModifier$1(state) || MethodModifier$2(state);
4982
5003
  if (state.events)
4983
5004
  state.events.exit?.("MethodModifier", state, result);
4984
5005
  return result;
@@ -5124,7 +5145,7 @@ ${input.slice(result.pos)}
5124
5145
  var AssignmentOpSymbol$15 = $T($EXPECT($L44, fail, 'AssignmentOpSymbol "?="'), function(value) {
5125
5146
  return "??=";
5126
5147
  });
5127
- var AssignmentOpSymbol$16 = $EXPECT($L24, fail, 'AssignmentOpSymbol "="');
5148
+ var AssignmentOpSymbol$16 = $EXPECT($L25, fail, 'AssignmentOpSymbol "="');
5128
5149
  var AssignmentOpSymbol$17 = $T($S(CoffeeWordAssignmentOp), function(value) {
5129
5150
  return value[0];
5130
5151
  });
@@ -5207,7 +5228,7 @@ ${input.slice(result.pos)}
5207
5228
  });
5208
5229
  var BinaryOpSymbol$10 = $EXPECT($L56, fail, 'BinaryOpSymbol ">>>"');
5209
5230
  var BinaryOpSymbol$11 = $EXPECT($L57, fail, 'BinaryOpSymbol ">>"');
5210
- var BinaryOpSymbol$12 = $EXPECT($L25, fail, 'BinaryOpSymbol ">"');
5231
+ var BinaryOpSymbol$12 = $EXPECT($L26, fail, 'BinaryOpSymbol ">"');
5211
5232
  var BinaryOpSymbol$13 = $EXPECT($L58, fail, 'BinaryOpSymbol "!=="');
5212
5233
  var BinaryOpSymbol$14 = $TV($EXPECT($L59, fail, 'BinaryOpSymbol "!="'), function($skip, $loc, $0, $1) {
5213
5234
  if (module.config.coffeeEq)
@@ -5439,7 +5460,7 @@ ${input.slice(result.pos)}
5439
5460
  return result;
5440
5461
  }
5441
5462
  }
5442
- var BlockStatement$0 = $T($S(ExplicitBlock, $N($S(__, $EXPECT($L24, fail, 'BlockStatement "="')))), function(value) {
5463
+ var BlockStatement$0 = $T($S(ExplicitBlock, $N($S(__, $EXPECT($L25, fail, 'BlockStatement "="')))), function(value) {
5443
5464
  return value[0];
5444
5465
  });
5445
5466
  function BlockStatement(state) {
@@ -8987,7 +9008,7 @@ ${input.slice(result.pos)}
8987
9008
  }
8988
9009
  }
8989
9010
  var Async$0 = $TV($EXPECT($L92, fail, 'Async "async"'), function($skip, $loc, $0, $1) {
8990
- return { $loc, token: $1 };
9011
+ return { $loc, token: $1, type: "Async" };
8991
9012
  });
8992
9013
  function Async(state) {
8993
9014
  if (state.events) {
@@ -9133,7 +9154,7 @@ ${input.slice(result.pos)}
9133
9154
  return result;
9134
9155
  }
9135
9156
  }
9136
- var CloseBrace$0 = $TV($EXPECT($L28, fail, 'CloseBrace "}"'), function($skip, $loc, $0, $1) {
9157
+ var CloseBrace$0 = $TV($EXPECT($L16, fail, 'CloseBrace "}"'), function($skip, $loc, $0, $1) {
9137
9158
  return { $loc, token: $1 };
9138
9159
  });
9139
9160
  function CloseBrace(state) {
@@ -9154,7 +9175,7 @@ ${input.slice(result.pos)}
9154
9175
  return result;
9155
9176
  }
9156
9177
  }
9157
- var CloseBracket$0 = $TV($EXPECT($L26, fail, 'CloseBracket "]"'), function($skip, $loc, $0, $1) {
9178
+ var CloseBracket$0 = $TV($EXPECT($L27, fail, 'CloseBracket "]"'), function($skip, $loc, $0, $1) {
9158
9179
  return { $loc, token: $1 };
9159
9180
  });
9160
9181
  function CloseBracket(state) {
@@ -9217,7 +9238,7 @@ ${input.slice(result.pos)}
9217
9238
  return result;
9218
9239
  }
9219
9240
  }
9220
- var Colon$0 = $TV($EXPECT($L27, fail, 'Colon ":"'), function($skip, $loc, $0, $1) {
9241
+ var Colon$0 = $TV($EXPECT($L28, fail, 'Colon ":"'), function($skip, $loc, $0, $1) {
9221
9242
  return { $loc, token: $1 };
9222
9243
  });
9223
9244
  function Colon(state) {
@@ -9448,7 +9469,7 @@ ${input.slice(result.pos)}
9448
9469
  return result;
9449
9470
  }
9450
9471
  }
9451
- var Equals$0 = $TV($EXPECT($L24, fail, 'Equals "="'), function($skip, $loc, $0, $1) {
9472
+ var Equals$0 = $TV($EXPECT($L25, fail, 'Equals "="'), function($skip, $loc, $0, $1) {
9452
9473
  return { $loc, token: $1 };
9453
9474
  });
9454
9475
  function Equals(state) {
@@ -9554,7 +9575,7 @@ ${input.slice(result.pos)}
9554
9575
  }
9555
9576
  }
9556
9577
  var GetOrSet$0 = $TS($S($C($EXPECT($L111, fail, 'GetOrSet "get"'), $EXPECT($L112, fail, 'GetOrSet "set"')), NonIdContinue), function($skip, $loc, $0, $1, $2) {
9557
- return { $loc, token: $1 };
9578
+ return { $loc, token: $1, type: "GetOrSet" };
9558
9579
  });
9559
9580
  function GetOrSet(state) {
9560
9581
  if (state.events) {
@@ -10389,7 +10410,7 @@ ${input.slice(result.pos)}
10389
10410
  return result;
10390
10411
  }
10391
10412
  }
10392
- var JSXOpeningElement$0 = $S($EXPECT($L5, fail, 'JSXOpeningElement "<"'), $TEXT(JSXElementName), $E(JSXAttributes), __, $EXPECT($L25, fail, 'JSXOpeningElement ">"'));
10413
+ var JSXOpeningElement$0 = $S($EXPECT($L5, fail, 'JSXOpeningElement "<"'), $TEXT(JSXElementName), $E(JSXAttributes), __, $EXPECT($L26, fail, 'JSXOpeningElement ">"'));
10393
10414
  function JSXOpeningElement(state) {
10394
10415
  if (state.events) {
10395
10416
  const result = state.events.enter?.("JSXOpeningElement", state);
@@ -10408,7 +10429,7 @@ ${input.slice(result.pos)}
10408
10429
  return result;
10409
10430
  }
10410
10431
  }
10411
- var JSXClosingElement$0 = $S($EXPECT($L144, fail, 'JSXClosingElement "</"'), __, $TEXT(JSXElementName), __, $EXPECT($L25, fail, 'JSXClosingElement ">"'));
10432
+ var JSXClosingElement$0 = $S($EXPECT($L144, fail, 'JSXClosingElement "</"'), __, $TEXT(JSXElementName), __, $EXPECT($L26, fail, 'JSXClosingElement ">"'));
10412
10433
  function JSXClosingElement(state) {
10413
10434
  if (state.events) {
10414
10435
  const result = state.events.enter?.("JSXClosingElement", state);
@@ -10506,7 +10527,44 @@ ${input.slice(result.pos)}
10506
10527
  return result;
10507
10528
  }
10508
10529
  }
10509
- var JSXAttribute$0 = $S(OpenBrace, __, DotDotDot, ExtendedExpression, __, CloseBrace);
10530
+ var JSXAttribute$0 = $TS($S(BracedObjectLiteral), function($skip, $loc, $0, $1) {
10531
+ const { children } = $1;
10532
+ const parts = [];
10533
+ const rest = [];
10534
+ for (let i = 1; i < children.length - 1; i++) {
10535
+ if (i > 1)
10536
+ parts.push(" ");
10537
+ const part = children[i];
10538
+ switch (part.type) {
10539
+ case "Identifier":
10540
+ parts.push([part.name, "={", part.name, "}"]);
10541
+ break;
10542
+ case "Property":
10543
+ if (part.name.type === "ComputedPropertyName") {
10544
+ rest.push(part);
10545
+ } else {
10546
+ parts.push([part.name, "={", module.insertTrimmingSpace(part.value, ""), "}"]);
10547
+ }
10548
+ break;
10549
+ case "SpreadProperty":
10550
+ parts.push(["{", part.value, "}"]);
10551
+ break;
10552
+ case "MethodDefinition":
10553
+ try {
10554
+ parts.push([part.name, "={", module.convertMethodToFunction(part), "}"]);
10555
+ } catch {
10556
+ rest.push(part);
10557
+ }
10558
+ break;
10559
+ default:
10560
+ throw new Error(`invalid object literal type in JSX attribute: ${part.type}`);
10561
+ }
10562
+ }
10563
+ if (rest.length) {
10564
+ parts.push(["{...{", ...rest, "}}"]);
10565
+ }
10566
+ return parts;
10567
+ });
10510
10568
  var JSXAttribute$1 = $S(JSXAttributeName, $E(JSXAttributeInitializer));
10511
10569
  function JSXAttribute(state) {
10512
10570
  if (state.events) {
@@ -11416,7 +11474,7 @@ ${input.slice(result.pos)}
11416
11474
  return result;
11417
11475
  }
11418
11476
  }
11419
- var TypeArguments$0 = $S(__, $EXPECT($L5, fail, 'TypeArguments "<"'), __, Type, $Q($S(__, Comma, __, Type)), $E($S(__, Comma)), __, $EXPECT($L25, fail, 'TypeArguments ">"'));
11477
+ var TypeArguments$0 = $S(__, $EXPECT($L5, fail, 'TypeArguments "<"'), __, Type, $Q($S(__, Comma, __, Type)), $E($S(__, Comma)), __, $EXPECT($L26, fail, 'TypeArguments ">"'));
11420
11478
  function TypeArguments(state) {
11421
11479
  if (state.events) {
11422
11480
  const result = state.events.enter?.("TypeArguments", state);
@@ -11435,7 +11493,7 @@ ${input.slice(result.pos)}
11435
11493
  return result;
11436
11494
  }
11437
11495
  }
11438
- var TypeParameters$0 = $TS($S(__, $EXPECT($L5, fail, 'TypeParameters "<"'), __, Type, $Q($S(__, Comma, __, Type)), $E($S(__, Comma)), __, $EXPECT($L25, fail, 'TypeParameters ">"')), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8) {
11496
+ var TypeParameters$0 = $TS($S(__, $EXPECT($L5, fail, 'TypeParameters "<"'), __, Type, $Q($S(__, Comma, __, Type)), $E($S(__, Comma)), __, $EXPECT($L26, fail, 'TypeParameters ">"')), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8) {
11439
11497
  return { ts: true, children: $0 };
11440
11498
  });
11441
11499
  function TypeParameters(state) {
@@ -11495,8 +11553,8 @@ ${input.slice(result.pos)}
11495
11553
  }
11496
11554
  }
11497
11555
  var TypeParameterDelimiter$0 = $S($Q(_), Comma);
11498
- var TypeParameterDelimiter$1 = $Y($S($Q(_), $EXPECT($L25, fail, 'TypeParameterDelimiter ">"')));
11499
- var TypeParameterDelimiter$2 = $TV($Y($S(__, $EXPECT($L25, fail, 'TypeParameterDelimiter ">"'))), function($skip, $loc, $0, $1) {
11556
+ var TypeParameterDelimiter$1 = $Y($S($Q(_), $EXPECT($L26, fail, 'TypeParameterDelimiter ">"')));
11557
+ var TypeParameterDelimiter$2 = $TV($Y($S(__, $EXPECT($L26, fail, 'TypeParameterDelimiter ">"'))), function($skip, $loc, $0, $1) {
11500
11558
  return { $loc, token: "," };
11501
11559
  });
11502
11560
  var TypeParameterDelimiter$3 = $TV($Y(EOS), function($skip, $loc, $0, $1) {
@@ -12614,6 +12672,8 @@ ${input.slice(result.pos)}
12614
12672
  module.isWhitespaceOrEmpty = function(node) {
12615
12673
  if (!node)
12616
12674
  return true;
12675
+ if (node.token)
12676
+ return node.token.match(/^\s*$/);
12617
12677
  if (!node.length)
12618
12678
  return true;
12619
12679
  if (typeof node === "string")
@@ -13010,6 +13070,32 @@ ${input.slice(result.pos)}
13010
13070
  throw new Error("Unknown postfix statement");
13011
13071
  }
13012
13072
  };
13073
+ module.convertMethodToFunction = function(method) {
13074
+ const { decorators, signature, block } = method;
13075
+ let opening = signature.children[0];
13076
+ if (opening) {
13077
+ if (opening[0].type === "GetOrSet") {
13078
+ throw new Error("cannot convert get/set method to function");
13079
+ } else if (opening[0][0]?.type === "Async") {
13080
+ opening = [opening[0][0], " function ", ...opening.slice(1)];
13081
+ } else {
13082
+ opening = ["function ", ...opening];
13083
+ }
13084
+ } else {
13085
+ opening = "function ";
13086
+ }
13087
+ return {
13088
+ ...signature,
13089
+ id: signature.name,
13090
+ type: "FunctionExpression",
13091
+ children: [
13092
+ decorators,
13093
+ [opening, ...signature.children.slice(1)],
13094
+ block
13095
+ ],
13096
+ block
13097
+ };
13098
+ };
13013
13099
  module.processProgram = function(statements) {
13014
13100
  processAssignments(statements);
13015
13101
  processFunctions(statements);
package/dist/main.js CHANGED
@@ -938,19 +938,19 @@ ${input.slice(result.pos)}
938
938
  var $L13 = $L("import.meta");
939
939
  var $L14 = $L(")");
940
940
  var $L15 = $L("->");
941
- var $L16 = $L("null");
942
- var $L17 = $L("true");
943
- var $L18 = $L("false");
944
- var $L19 = $L("yes");
945
- var $L20 = $L("on");
946
- var $L21 = $L("no");
947
- var $L22 = $L("off");
948
- var $L23 = $L(",");
949
- var $L24 = $L("=");
950
- var $L25 = $L(">");
951
- var $L26 = $L("]");
952
- var $L27 = $L(":");
953
- var $L28 = $L("}");
941
+ var $L16 = $L("}");
942
+ var $L17 = $L("null");
943
+ var $L18 = $L("true");
944
+ var $L19 = $L("false");
945
+ var $L20 = $L("yes");
946
+ var $L21 = $L("on");
947
+ var $L22 = $L("no");
948
+ var $L23 = $L("off");
949
+ var $L24 = $L(",");
950
+ var $L25 = $L("=");
951
+ var $L26 = $L(">");
952
+ var $L27 = $L("]");
953
+ var $L28 = $L(":");
954
954
  var $L29 = $L("**=");
955
955
  var $L30 = $L("*=");
956
956
  var $L31 = $L("/=");
@@ -3807,8 +3807,15 @@ ${input.slice(result.pos)}
3807
3807
  return {
3808
3808
  type: "BlockStatement",
3809
3809
  expressions,
3810
- children: [$1, expressions],
3811
- bare: true
3810
+ children: [$1, expressions]
3811
+ };
3812
+ });
3813
+ var BracedContent$2 = $TV($Y($S(__, $EXPECT($L16, fail, 'BracedContent "}"'))), function($skip, $loc, $0, $1) {
3814
+ const expressions = [];
3815
+ return {
3816
+ type: "BlockStatement",
3817
+ expressions,
3818
+ children: [expressions]
3812
3819
  };
3813
3820
  });
3814
3821
  function BracedContent(state) {
@@ -3818,12 +3825,12 @@ ${input.slice(result.pos)}
3818
3825
  return result.cache;
3819
3826
  }
3820
3827
  if (state.tokenize) {
3821
- const result = $TOKEN("BracedContent", state, BracedContent$0(state) || BracedContent$1(state));
3828
+ const result = $TOKEN("BracedContent", state, BracedContent$0(state) || BracedContent$1(state) || BracedContent$2(state));
3822
3829
  if (state.events)
3823
3830
  state.events.exit?.("BracedContent", state, result);
3824
3831
  return result;
3825
3832
  } else {
3826
- const result = BracedContent$0(state) || BracedContent$1(state);
3833
+ const result = BracedContent$0(state) || BracedContent$1(state) || BracedContent$2(state);
3827
3834
  if (state.events)
3828
3835
  state.events.exit?.("BracedContent", state, result);
3829
3836
  return result;
@@ -3928,7 +3935,7 @@ ${input.slice(result.pos)}
3928
3935
  return result;
3929
3936
  }
3930
3937
  }
3931
- var NullLiteral$0 = $TV($EXPECT($L16, fail, 'NullLiteral "null"'), function($skip, $loc, $0, $1) {
3938
+ var NullLiteral$0 = $TV($EXPECT($L17, fail, 'NullLiteral "null"'), function($skip, $loc, $0, $1) {
3932
3939
  return { $loc, token: $1 };
3933
3940
  });
3934
3941
  function NullLiteral(state) {
@@ -3952,7 +3959,7 @@ ${input.slice(result.pos)}
3952
3959
  var BooleanLiteral$0 = $T($S(CoffeeBooleansEnabled, CoffeeScriptBooleanLiteral), function(value) {
3953
3960
  return value[1];
3954
3961
  });
3955
- var BooleanLiteral$1 = $TS($S($C($EXPECT($L17, fail, 'BooleanLiteral "true"'), $EXPECT($L18, fail, 'BooleanLiteral "false"')), NonIdContinue), function($skip, $loc, $0, $1, $2) {
3962
+ var BooleanLiteral$1 = $TS($S($C($EXPECT($L18, fail, 'BooleanLiteral "true"'), $EXPECT($L19, fail, 'BooleanLiteral "false"')), NonIdContinue), function($skip, $loc, $0, $1, $2) {
3956
3963
  return { $loc, token: $1 };
3957
3964
  });
3958
3965
  function BooleanLiteral(state) {
@@ -3973,10 +3980,10 @@ ${input.slice(result.pos)}
3973
3980
  return result;
3974
3981
  }
3975
3982
  }
3976
- var CoffeeScriptBooleanLiteral$0 = $TS($S($C($EXPECT($L19, fail, 'CoffeeScriptBooleanLiteral "yes"'), $EXPECT($L20, fail, 'CoffeeScriptBooleanLiteral "on"')), NonIdContinue), function($skip, $loc, $0, $1, $2) {
3983
+ var CoffeeScriptBooleanLiteral$0 = $TS($S($C($EXPECT($L20, fail, 'CoffeeScriptBooleanLiteral "yes"'), $EXPECT($L21, fail, 'CoffeeScriptBooleanLiteral "on"')), NonIdContinue), function($skip, $loc, $0, $1, $2) {
3977
3984
  return { $loc, token: "true" };
3978
3985
  });
3979
- var CoffeeScriptBooleanLiteral$1 = $TS($S($C($EXPECT($L21, fail, 'CoffeeScriptBooleanLiteral "no"'), $EXPECT($L22, fail, 'CoffeeScriptBooleanLiteral "off"')), NonIdContinue), function($skip, $loc, $0, $1, $2) {
3986
+ var CoffeeScriptBooleanLiteral$1 = $TS($S($C($EXPECT($L22, fail, 'CoffeeScriptBooleanLiteral "no"'), $EXPECT($L23, fail, 'CoffeeScriptBooleanLiteral "off"')), NonIdContinue), function($skip, $loc, $0, $1, $2) {
3980
3987
  return { $loc, token: "false" };
3981
3988
  });
3982
3989
  function CoffeeScriptBooleanLiteral(state) {
@@ -3997,7 +4004,7 @@ ${input.slice(result.pos)}
3997
4004
  return result;
3998
4005
  }
3999
4006
  }
4000
- var Comma$0 = $TV($EXPECT($L23, fail, 'Comma ","'), function($skip, $loc, $0, $1) {
4007
+ var Comma$0 = $TV($EXPECT($L24, fail, 'Comma ","'), function($skip, $loc, $0, $1) {
4001
4008
  return { $loc, token: $1 };
4002
4009
  });
4003
4010
  function Comma(state) {
@@ -4087,7 +4094,7 @@ ${input.slice(result.pos)}
4087
4094
  return result;
4088
4095
  }
4089
4096
  }
4090
- var UpcomingAssignment$0 = $Y($S(__, $EXPECT($L24, fail, 'UpcomingAssignment "="'), $N($C($EXPECT($L24, fail, 'UpcomingAssignment "="'), $EXPECT($L25, fail, 'UpcomingAssignment ">"')))));
4097
+ var UpcomingAssignment$0 = $Y($S(__, $EXPECT($L25, fail, 'UpcomingAssignment "="'), $N($C($EXPECT($L25, fail, 'UpcomingAssignment "="'), $EXPECT($L26, fail, 'UpcomingAssignment ">"')))));
4091
4098
  function UpcomingAssignment(state) {
4092
4099
  if (state.events) {
4093
4100
  const result = state.events.enter?.("UpcomingAssignment", state);
@@ -4326,7 +4333,7 @@ ${input.slice(result.pos)}
4326
4333
  }
4327
4334
  }
4328
4335
  var ArrayElementDelimiter$0 = $S(__, Comma);
4329
- var ArrayElementDelimiter$1 = $Y($S(__, $EXPECT($L26, fail, 'ArrayElementDelimiter "]"')));
4336
+ var ArrayElementDelimiter$1 = $Y($S(__, $EXPECT($L27, fail, 'ArrayElementDelimiter "]"')));
4330
4337
  var ArrayElementDelimiter$2 = $TV($Y(EOS), function($skip, $loc, $0, $1) {
4331
4338
  return { $loc, token: "," };
4332
4339
  });
@@ -4691,11 +4698,11 @@ ${input.slice(result.pos)}
4691
4698
  return result;
4692
4699
  }
4693
4700
  }
4694
- var ImplicitInlineObjectPropertyDelimiter$0 = $S($Q(TrailingComment), $EXPECT($L23, fail, 'ImplicitInlineObjectPropertyDelimiter ","'));
4701
+ var ImplicitInlineObjectPropertyDelimiter$0 = $S($Q(TrailingComment), $EXPECT($L24, fail, 'ImplicitInlineObjectPropertyDelimiter ","'));
4695
4702
  var ImplicitInlineObjectPropertyDelimiter$1 = $T($Y($S(EOS, NamedProperty)), function(value) {
4696
4703
  return ",";
4697
4704
  });
4698
- var ImplicitInlineObjectPropertyDelimiter$2 = $T($Y($S(__, $C($EXPECT($L27, fail, 'ImplicitInlineObjectPropertyDelimiter ":"'), $EXPECT($L14, fail, 'ImplicitInlineObjectPropertyDelimiter ")"'), $EXPECT($L26, fail, 'ImplicitInlineObjectPropertyDelimiter "]"'), $EXPECT($L28, fail, 'ImplicitInlineObjectPropertyDelimiter "}"'), ReservedWord))), function(value) {
4705
+ var ImplicitInlineObjectPropertyDelimiter$2 = $T($Y($S(__, $C($EXPECT($L28, fail, 'ImplicitInlineObjectPropertyDelimiter ":"'), $EXPECT($L14, fail, 'ImplicitInlineObjectPropertyDelimiter ")"'), $EXPECT($L27, fail, 'ImplicitInlineObjectPropertyDelimiter "]"'), $EXPECT($L16, fail, 'ImplicitInlineObjectPropertyDelimiter "}"'), ReservedWord))), function(value) {
4699
4706
  return "";
4700
4707
  });
4701
4708
  var ImplicitInlineObjectPropertyDelimiter$3 = $T($Y(EOS), function(value) {
@@ -4720,7 +4727,7 @@ ${input.slice(result.pos)}
4720
4727
  }
4721
4728
  }
4722
4729
  var ObjectPropertyDelimiter$0 = $S($Q(_), Comma);
4723
- var ObjectPropertyDelimiter$1 = $Y($S(__, $EXPECT($L28, fail, 'ObjectPropertyDelimiter "}"')));
4730
+ var ObjectPropertyDelimiter$1 = $Y($S(__, $EXPECT($L16, fail, 'ObjectPropertyDelimiter "}"')));
4724
4731
  var ObjectPropertyDelimiter$2 = $TV($Y(EOS), function($skip, $loc, $0, $1) {
4725
4732
  return { $loc, token: "," };
4726
4733
  });
@@ -4772,10 +4779,13 @@ ${input.slice(result.pos)}
4772
4779
  var ws = $1;
4773
4780
  var at = $2;
4774
4781
  var id = $3;
4782
+ const value = [{ ...at, token: "this." }, id];
4775
4783
  return {
4776
4784
  type: "Property",
4777
- children: [...ws, id, ": ", { ...at, token: "this." }, id],
4778
- names: id.names
4785
+ children: [...ws, id, ": ", ...value],
4786
+ name: id,
4787
+ names: id.names,
4788
+ value
4779
4789
  };
4780
4790
  });
4781
4791
  var PropertyDefinition$1 = NamedProperty;
@@ -4794,7 +4804,8 @@ ${input.slice(result.pos)}
4794
4804
  return {
4795
4805
  type: "SpreadProperty",
4796
4806
  children: [...ws, dots, exp],
4797
- names: exp.names
4807
+ names: exp.names,
4808
+ value: [dots, exp]
4798
4809
  };
4799
4810
  });
4800
4811
  var PropertyDefinition$4 = $TS($S(__, IdentifierReference), function($skip, $loc, $0, $1, $2) {
@@ -4821,11 +4832,14 @@ ${input.slice(result.pos)}
4821
4832
  }
4822
4833
  }
4823
4834
  var NamedProperty$0 = $TS($S(__, PropertyName, __, Colon, ExtendedExpression), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
4835
+ var name = $2;
4824
4836
  var exp = $5;
4825
4837
  return {
4826
4838
  type: "Property",
4827
4839
  children: $0,
4828
- names: exp.names || []
4840
+ name,
4841
+ names: exp.names || [],
4842
+ value: exp
4829
4843
  };
4830
4844
  });
4831
4845
  function NamedProperty(state) {
@@ -4875,7 +4889,12 @@ ${input.slice(result.pos)}
4875
4889
  var PropertyName$0 = NumericLiteral;
4876
4890
  var PropertyName$1 = StringLiteral;
4877
4891
  var PropertyName$2 = IdentifierName;
4878
- var PropertyName$3 = $S(OpenBracket, ExtendedExpression, __, CloseBracket);
4892
+ var PropertyName$3 = $TS($S(OpenBracket, ExtendedExpression, __, CloseBracket), function($skip, $loc, $0, $1, $2, $3, $4) {
4893
+ return {
4894
+ type: "ComputedPropertyName",
4895
+ children: $0
4896
+ };
4897
+ });
4879
4898
  function PropertyName(state) {
4880
4899
  if (state.events) {
4881
4900
  const result = state.events.enter?.("PropertyName", state);
@@ -4933,11 +4952,14 @@ ${input.slice(result.pos)}
4933
4952
  }
4934
4953
  }
4935
4954
  var MethodDefinition$0 = $TS($S($E(Decorators), MethodSignature, BracedBlock), function($skip, $loc, $0, $1, $2, $3) {
4955
+ var decorators = $1;
4936
4956
  var signature = $2;
4937
4957
  var block = $3;
4938
4958
  return {
4939
4959
  type: "MethodDefinition",
4940
4960
  children: $0,
4961
+ name: signature.name,
4962
+ decorators,
4941
4963
  signature,
4942
4964
  block,
4943
4965
  parameters: signature.parameters
@@ -4964,7 +4986,6 @@ ${input.slice(result.pos)}
4964
4986
  var MethodModifier$0 = $S(GetOrSet, $Q(TrailingComment));
4965
4987
  var MethodModifier$1 = $S($S(Async, __), $E($S(Star, __)));
4966
4988
  var MethodModifier$2 = $S(Star, __);
4967
- var MethodModifier$3 = $S(Async, __);
4968
4989
  function MethodModifier(state) {
4969
4990
  if (state.events) {
4970
4991
  const result = state.events.enter?.("MethodModifier", state);
@@ -4972,12 +4993,12 @@ ${input.slice(result.pos)}
4972
4993
  return result.cache;
4973
4994
  }
4974
4995
  if (state.tokenize) {
4975
- const result = $TOKEN("MethodModifier", state, MethodModifier$0(state) || MethodModifier$1(state) || MethodModifier$2(state) || MethodModifier$3(state));
4996
+ const result = $TOKEN("MethodModifier", state, MethodModifier$0(state) || MethodModifier$1(state) || MethodModifier$2(state));
4976
4997
  if (state.events)
4977
4998
  state.events.exit?.("MethodModifier", state, result);
4978
4999
  return result;
4979
5000
  } else {
4980
- const result = MethodModifier$0(state) || MethodModifier$1(state) || MethodModifier$2(state) || MethodModifier$3(state);
5001
+ const result = MethodModifier$0(state) || MethodModifier$1(state) || MethodModifier$2(state);
4981
5002
  if (state.events)
4982
5003
  state.events.exit?.("MethodModifier", state, result);
4983
5004
  return result;
@@ -5123,7 +5144,7 @@ ${input.slice(result.pos)}
5123
5144
  var AssignmentOpSymbol$15 = $T($EXPECT($L44, fail, 'AssignmentOpSymbol "?="'), function(value) {
5124
5145
  return "??=";
5125
5146
  });
5126
- var AssignmentOpSymbol$16 = $EXPECT($L24, fail, 'AssignmentOpSymbol "="');
5147
+ var AssignmentOpSymbol$16 = $EXPECT($L25, fail, 'AssignmentOpSymbol "="');
5127
5148
  var AssignmentOpSymbol$17 = $T($S(CoffeeWordAssignmentOp), function(value) {
5128
5149
  return value[0];
5129
5150
  });
@@ -5206,7 +5227,7 @@ ${input.slice(result.pos)}
5206
5227
  });
5207
5228
  var BinaryOpSymbol$10 = $EXPECT($L56, fail, 'BinaryOpSymbol ">>>"');
5208
5229
  var BinaryOpSymbol$11 = $EXPECT($L57, fail, 'BinaryOpSymbol ">>"');
5209
- var BinaryOpSymbol$12 = $EXPECT($L25, fail, 'BinaryOpSymbol ">"');
5230
+ var BinaryOpSymbol$12 = $EXPECT($L26, fail, 'BinaryOpSymbol ">"');
5210
5231
  var BinaryOpSymbol$13 = $EXPECT($L58, fail, 'BinaryOpSymbol "!=="');
5211
5232
  var BinaryOpSymbol$14 = $TV($EXPECT($L59, fail, 'BinaryOpSymbol "!="'), function($skip, $loc, $0, $1) {
5212
5233
  if (module2.config.coffeeEq)
@@ -5438,7 +5459,7 @@ ${input.slice(result.pos)}
5438
5459
  return result;
5439
5460
  }
5440
5461
  }
5441
- var BlockStatement$0 = $T($S(ExplicitBlock, $N($S(__, $EXPECT($L24, fail, 'BlockStatement "="')))), function(value) {
5462
+ var BlockStatement$0 = $T($S(ExplicitBlock, $N($S(__, $EXPECT($L25, fail, 'BlockStatement "="')))), function(value) {
5442
5463
  return value[0];
5443
5464
  });
5444
5465
  function BlockStatement(state) {
@@ -8986,7 +9007,7 @@ ${input.slice(result.pos)}
8986
9007
  }
8987
9008
  }
8988
9009
  var Async$0 = $TV($EXPECT($L92, fail, 'Async "async"'), function($skip, $loc, $0, $1) {
8989
- return { $loc, token: $1 };
9010
+ return { $loc, token: $1, type: "Async" };
8990
9011
  });
8991
9012
  function Async(state) {
8992
9013
  if (state.events) {
@@ -9132,7 +9153,7 @@ ${input.slice(result.pos)}
9132
9153
  return result;
9133
9154
  }
9134
9155
  }
9135
- var CloseBrace$0 = $TV($EXPECT($L28, fail, 'CloseBrace "}"'), function($skip, $loc, $0, $1) {
9156
+ var CloseBrace$0 = $TV($EXPECT($L16, fail, 'CloseBrace "}"'), function($skip, $loc, $0, $1) {
9136
9157
  return { $loc, token: $1 };
9137
9158
  });
9138
9159
  function CloseBrace(state) {
@@ -9153,7 +9174,7 @@ ${input.slice(result.pos)}
9153
9174
  return result;
9154
9175
  }
9155
9176
  }
9156
- var CloseBracket$0 = $TV($EXPECT($L26, fail, 'CloseBracket "]"'), function($skip, $loc, $0, $1) {
9177
+ var CloseBracket$0 = $TV($EXPECT($L27, fail, 'CloseBracket "]"'), function($skip, $loc, $0, $1) {
9157
9178
  return { $loc, token: $1 };
9158
9179
  });
9159
9180
  function CloseBracket(state) {
@@ -9216,7 +9237,7 @@ ${input.slice(result.pos)}
9216
9237
  return result;
9217
9238
  }
9218
9239
  }
9219
- var Colon$0 = $TV($EXPECT($L27, fail, 'Colon ":"'), function($skip, $loc, $0, $1) {
9240
+ var Colon$0 = $TV($EXPECT($L28, fail, 'Colon ":"'), function($skip, $loc, $0, $1) {
9220
9241
  return { $loc, token: $1 };
9221
9242
  });
9222
9243
  function Colon(state) {
@@ -9447,7 +9468,7 @@ ${input.slice(result.pos)}
9447
9468
  return result;
9448
9469
  }
9449
9470
  }
9450
- var Equals$0 = $TV($EXPECT($L24, fail, 'Equals "="'), function($skip, $loc, $0, $1) {
9471
+ var Equals$0 = $TV($EXPECT($L25, fail, 'Equals "="'), function($skip, $loc, $0, $1) {
9451
9472
  return { $loc, token: $1 };
9452
9473
  });
9453
9474
  function Equals(state) {
@@ -9553,7 +9574,7 @@ ${input.slice(result.pos)}
9553
9574
  }
9554
9575
  }
9555
9576
  var GetOrSet$0 = $TS($S($C($EXPECT($L111, fail, 'GetOrSet "get"'), $EXPECT($L112, fail, 'GetOrSet "set"')), NonIdContinue), function($skip, $loc, $0, $1, $2) {
9556
- return { $loc, token: $1 };
9577
+ return { $loc, token: $1, type: "GetOrSet" };
9557
9578
  });
9558
9579
  function GetOrSet(state) {
9559
9580
  if (state.events) {
@@ -10388,7 +10409,7 @@ ${input.slice(result.pos)}
10388
10409
  return result;
10389
10410
  }
10390
10411
  }
10391
- var JSXOpeningElement$0 = $S($EXPECT($L5, fail, 'JSXOpeningElement "<"'), $TEXT(JSXElementName), $E(JSXAttributes), __, $EXPECT($L25, fail, 'JSXOpeningElement ">"'));
10412
+ var JSXOpeningElement$0 = $S($EXPECT($L5, fail, 'JSXOpeningElement "<"'), $TEXT(JSXElementName), $E(JSXAttributes), __, $EXPECT($L26, fail, 'JSXOpeningElement ">"'));
10392
10413
  function JSXOpeningElement(state) {
10393
10414
  if (state.events) {
10394
10415
  const result = state.events.enter?.("JSXOpeningElement", state);
@@ -10407,7 +10428,7 @@ ${input.slice(result.pos)}
10407
10428
  return result;
10408
10429
  }
10409
10430
  }
10410
- var JSXClosingElement$0 = $S($EXPECT($L144, fail, 'JSXClosingElement "</"'), __, $TEXT(JSXElementName), __, $EXPECT($L25, fail, 'JSXClosingElement ">"'));
10431
+ var JSXClosingElement$0 = $S($EXPECT($L144, fail, 'JSXClosingElement "</"'), __, $TEXT(JSXElementName), __, $EXPECT($L26, fail, 'JSXClosingElement ">"'));
10411
10432
  function JSXClosingElement(state) {
10412
10433
  if (state.events) {
10413
10434
  const result = state.events.enter?.("JSXClosingElement", state);
@@ -10505,7 +10526,44 @@ ${input.slice(result.pos)}
10505
10526
  return result;
10506
10527
  }
10507
10528
  }
10508
- var JSXAttribute$0 = $S(OpenBrace, __, DotDotDot, ExtendedExpression, __, CloseBrace);
10529
+ var JSXAttribute$0 = $TS($S(BracedObjectLiteral), function($skip, $loc, $0, $1) {
10530
+ const { children } = $1;
10531
+ const parts = [];
10532
+ const rest = [];
10533
+ for (let i = 1; i < children.length - 1; i++) {
10534
+ if (i > 1)
10535
+ parts.push(" ");
10536
+ const part = children[i];
10537
+ switch (part.type) {
10538
+ case "Identifier":
10539
+ parts.push([part.name, "={", part.name, "}"]);
10540
+ break;
10541
+ case "Property":
10542
+ if (part.name.type === "ComputedPropertyName") {
10543
+ rest.push(part);
10544
+ } else {
10545
+ parts.push([part.name, "={", module2.insertTrimmingSpace(part.value, ""), "}"]);
10546
+ }
10547
+ break;
10548
+ case "SpreadProperty":
10549
+ parts.push(["{", part.value, "}"]);
10550
+ break;
10551
+ case "MethodDefinition":
10552
+ try {
10553
+ parts.push([part.name, "={", module2.convertMethodToFunction(part), "}"]);
10554
+ } catch {
10555
+ rest.push(part);
10556
+ }
10557
+ break;
10558
+ default:
10559
+ throw new Error(`invalid object literal type in JSX attribute: ${part.type}`);
10560
+ }
10561
+ }
10562
+ if (rest.length) {
10563
+ parts.push(["{...{", ...rest, "}}"]);
10564
+ }
10565
+ return parts;
10566
+ });
10509
10567
  var JSXAttribute$1 = $S(JSXAttributeName, $E(JSXAttributeInitializer));
10510
10568
  function JSXAttribute(state) {
10511
10569
  if (state.events) {
@@ -11415,7 +11473,7 @@ ${input.slice(result.pos)}
11415
11473
  return result;
11416
11474
  }
11417
11475
  }
11418
- var TypeArguments$0 = $S(__, $EXPECT($L5, fail, 'TypeArguments "<"'), __, Type, $Q($S(__, Comma, __, Type)), $E($S(__, Comma)), __, $EXPECT($L25, fail, 'TypeArguments ">"'));
11476
+ var TypeArguments$0 = $S(__, $EXPECT($L5, fail, 'TypeArguments "<"'), __, Type, $Q($S(__, Comma, __, Type)), $E($S(__, Comma)), __, $EXPECT($L26, fail, 'TypeArguments ">"'));
11419
11477
  function TypeArguments(state) {
11420
11478
  if (state.events) {
11421
11479
  const result = state.events.enter?.("TypeArguments", state);
@@ -11434,7 +11492,7 @@ ${input.slice(result.pos)}
11434
11492
  return result;
11435
11493
  }
11436
11494
  }
11437
- var TypeParameters$0 = $TS($S(__, $EXPECT($L5, fail, 'TypeParameters "<"'), __, Type, $Q($S(__, Comma, __, Type)), $E($S(__, Comma)), __, $EXPECT($L25, fail, 'TypeParameters ">"')), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8) {
11495
+ var TypeParameters$0 = $TS($S(__, $EXPECT($L5, fail, 'TypeParameters "<"'), __, Type, $Q($S(__, Comma, __, Type)), $E($S(__, Comma)), __, $EXPECT($L26, fail, 'TypeParameters ">"')), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8) {
11438
11496
  return { ts: true, children: $0 };
11439
11497
  });
11440
11498
  function TypeParameters(state) {
@@ -11494,8 +11552,8 @@ ${input.slice(result.pos)}
11494
11552
  }
11495
11553
  }
11496
11554
  var TypeParameterDelimiter$0 = $S($Q(_), Comma);
11497
- var TypeParameterDelimiter$1 = $Y($S($Q(_), $EXPECT($L25, fail, 'TypeParameterDelimiter ">"')));
11498
- var TypeParameterDelimiter$2 = $TV($Y($S(__, $EXPECT($L25, fail, 'TypeParameterDelimiter ">"'))), function($skip, $loc, $0, $1) {
11555
+ var TypeParameterDelimiter$1 = $Y($S($Q(_), $EXPECT($L26, fail, 'TypeParameterDelimiter ">"')));
11556
+ var TypeParameterDelimiter$2 = $TV($Y($S(__, $EXPECT($L26, fail, 'TypeParameterDelimiter ">"'))), function($skip, $loc, $0, $1) {
11499
11557
  return { $loc, token: "," };
11500
11558
  });
11501
11559
  var TypeParameterDelimiter$3 = $TV($Y(EOS), function($skip, $loc, $0, $1) {
@@ -12613,6 +12671,8 @@ ${input.slice(result.pos)}
12613
12671
  module2.isWhitespaceOrEmpty = function(node) {
12614
12672
  if (!node)
12615
12673
  return true;
12674
+ if (node.token)
12675
+ return node.token.match(/^\s*$/);
12616
12676
  if (!node.length)
12617
12677
  return true;
12618
12678
  if (typeof node === "string")
@@ -13009,6 +13069,32 @@ ${input.slice(result.pos)}
13009
13069
  throw new Error("Unknown postfix statement");
13010
13070
  }
13011
13071
  };
13072
+ module2.convertMethodToFunction = function(method) {
13073
+ const { decorators, signature, block } = method;
13074
+ let opening = signature.children[0];
13075
+ if (opening) {
13076
+ if (opening[0].type === "GetOrSet") {
13077
+ throw new Error("cannot convert get/set method to function");
13078
+ } else if (opening[0][0]?.type === "Async") {
13079
+ opening = [opening[0][0], " function ", ...opening.slice(1)];
13080
+ } else {
13081
+ opening = ["function ", ...opening];
13082
+ }
13083
+ } else {
13084
+ opening = "function ";
13085
+ }
13086
+ return {
13087
+ ...signature,
13088
+ id: signature.name,
13089
+ type: "FunctionExpression",
13090
+ children: [
13091
+ decorators,
13092
+ [opening, ...signature.children.slice(1)],
13093
+ block
13094
+ ],
13095
+ block
13096
+ };
13097
+ };
13012
13098
  module2.processProgram = function(statements) {
13013
13099
  processAssignments(statements);
13014
13100
  processFunctions(statements);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danielx/civet",
3
- "version": "0.4.29",
3
+ "version": "0.4.30",
4
4
  "description": "CoffeeScript style syntax for TypeScript",
5
5
  "main": "dist/main.js",
6
6
  "exports": {