@danielx/civet 0.4.29 → 0.4.31

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 +144 -52
  2. package/dist/main.js +144 -52
  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);
@@ -4245,7 +4252,13 @@ ${input.slice(result.pos)}
4245
4252
  }
4246
4253
  var ArrayLiteralContent$0 = RangeExpression;
4247
4254
  var ArrayLiteralContent$1 = NestedElementList;
4248
- var ArrayLiteralContent$2 = ElementList;
4255
+ var ArrayLiteralContent$2 = $TS($S(ElementList, $E(NestedElementList)), function($skip, $loc, $0, $1, $2) {
4256
+ if ($2) {
4257
+ return [...$1, ",", ...$2];
4258
+ } else {
4259
+ return $1;
4260
+ }
4261
+ });
4249
4262
  function ArrayLiteralContent(state) {
4250
4263
  if (state.events) {
4251
4264
  const result = state.events.enter?.("ArrayLiteralContent", state);
@@ -4327,7 +4340,7 @@ ${input.slice(result.pos)}
4327
4340
  }
4328
4341
  }
4329
4342
  var ArrayElementDelimiter$0 = $S(__, Comma);
4330
- var ArrayElementDelimiter$1 = $Y($S(__, $EXPECT($L26, fail, 'ArrayElementDelimiter "]"')));
4343
+ var ArrayElementDelimiter$1 = $Y($S(__, $EXPECT($L27, fail, 'ArrayElementDelimiter "]"')));
4331
4344
  var ArrayElementDelimiter$2 = $TV($Y(EOS), function($skip, $loc, $0, $1) {
4332
4345
  return { $loc, token: "," };
4333
4346
  });
@@ -4692,11 +4705,11 @@ ${input.slice(result.pos)}
4692
4705
  return result;
4693
4706
  }
4694
4707
  }
4695
- var ImplicitInlineObjectPropertyDelimiter$0 = $S($Q(TrailingComment), $EXPECT($L23, fail, 'ImplicitInlineObjectPropertyDelimiter ","'));
4708
+ var ImplicitInlineObjectPropertyDelimiter$0 = $S($Q(TrailingComment), $EXPECT($L24, fail, 'ImplicitInlineObjectPropertyDelimiter ","'));
4696
4709
  var ImplicitInlineObjectPropertyDelimiter$1 = $T($Y($S(EOS, NamedProperty)), function(value) {
4697
4710
  return ",";
4698
4711
  });
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) {
4712
+ 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
4713
  return "";
4701
4714
  });
4702
4715
  var ImplicitInlineObjectPropertyDelimiter$3 = $T($Y(EOS), function(value) {
@@ -4721,7 +4734,7 @@ ${input.slice(result.pos)}
4721
4734
  }
4722
4735
  }
4723
4736
  var ObjectPropertyDelimiter$0 = $S($Q(_), Comma);
4724
- var ObjectPropertyDelimiter$1 = $Y($S(__, $EXPECT($L28, fail, 'ObjectPropertyDelimiter "}"')));
4737
+ var ObjectPropertyDelimiter$1 = $Y($S(__, $EXPECT($L16, fail, 'ObjectPropertyDelimiter "}"')));
4725
4738
  var ObjectPropertyDelimiter$2 = $TV($Y(EOS), function($skip, $loc, $0, $1) {
4726
4739
  return { $loc, token: "," };
4727
4740
  });
@@ -4773,10 +4786,13 @@ ${input.slice(result.pos)}
4773
4786
  var ws = $1;
4774
4787
  var at = $2;
4775
4788
  var id = $3;
4789
+ const value = [{ ...at, token: "this." }, id];
4776
4790
  return {
4777
4791
  type: "Property",
4778
- children: [...ws, id, ": ", { ...at, token: "this." }, id],
4779
- names: id.names
4792
+ children: [...ws, id, ": ", ...value],
4793
+ name: id,
4794
+ names: id.names,
4795
+ value
4780
4796
  };
4781
4797
  });
4782
4798
  var PropertyDefinition$1 = NamedProperty;
@@ -4795,7 +4811,8 @@ ${input.slice(result.pos)}
4795
4811
  return {
4796
4812
  type: "SpreadProperty",
4797
4813
  children: [...ws, dots, exp],
4798
- names: exp.names
4814
+ names: exp.names,
4815
+ value: [dots, exp]
4799
4816
  };
4800
4817
  });
4801
4818
  var PropertyDefinition$4 = $TS($S(__, IdentifierReference), function($skip, $loc, $0, $1, $2) {
@@ -4822,11 +4839,14 @@ ${input.slice(result.pos)}
4822
4839
  }
4823
4840
  }
4824
4841
  var NamedProperty$0 = $TS($S(__, PropertyName, __, Colon, ExtendedExpression), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
4842
+ var name = $2;
4825
4843
  var exp = $5;
4826
4844
  return {
4827
4845
  type: "Property",
4828
4846
  children: $0,
4829
- names: exp.names || []
4847
+ name,
4848
+ names: exp.names || [],
4849
+ value: exp
4830
4850
  };
4831
4851
  });
4832
4852
  function NamedProperty(state) {
@@ -4876,7 +4896,12 @@ ${input.slice(result.pos)}
4876
4896
  var PropertyName$0 = NumericLiteral;
4877
4897
  var PropertyName$1 = StringLiteral;
4878
4898
  var PropertyName$2 = IdentifierName;
4879
- var PropertyName$3 = $S(OpenBracket, ExtendedExpression, __, CloseBracket);
4899
+ var PropertyName$3 = $TS($S(OpenBracket, ExtendedExpression, __, CloseBracket), function($skip, $loc, $0, $1, $2, $3, $4) {
4900
+ return {
4901
+ type: "ComputedPropertyName",
4902
+ children: $0
4903
+ };
4904
+ });
4880
4905
  function PropertyName(state) {
4881
4906
  if (state.events) {
4882
4907
  const result = state.events.enter?.("PropertyName", state);
@@ -4934,11 +4959,14 @@ ${input.slice(result.pos)}
4934
4959
  }
4935
4960
  }
4936
4961
  var MethodDefinition$0 = $TS($S($E(Decorators), MethodSignature, BracedBlock), function($skip, $loc, $0, $1, $2, $3) {
4962
+ var decorators = $1;
4937
4963
  var signature = $2;
4938
4964
  var block = $3;
4939
4965
  return {
4940
4966
  type: "MethodDefinition",
4941
4967
  children: $0,
4968
+ name: signature.name,
4969
+ decorators,
4942
4970
  signature,
4943
4971
  block,
4944
4972
  parameters: signature.parameters
@@ -4965,7 +4993,6 @@ ${input.slice(result.pos)}
4965
4993
  var MethodModifier$0 = $S(GetOrSet, $Q(TrailingComment));
4966
4994
  var MethodModifier$1 = $S($S(Async, __), $E($S(Star, __)));
4967
4995
  var MethodModifier$2 = $S(Star, __);
4968
- var MethodModifier$3 = $S(Async, __);
4969
4996
  function MethodModifier(state) {
4970
4997
  if (state.events) {
4971
4998
  const result = state.events.enter?.("MethodModifier", state);
@@ -4973,12 +5000,12 @@ ${input.slice(result.pos)}
4973
5000
  return result.cache;
4974
5001
  }
4975
5002
  if (state.tokenize) {
4976
- const result = $TOKEN("MethodModifier", state, MethodModifier$0(state) || MethodModifier$1(state) || MethodModifier$2(state) || MethodModifier$3(state));
5003
+ const result = $TOKEN("MethodModifier", state, MethodModifier$0(state) || MethodModifier$1(state) || MethodModifier$2(state));
4977
5004
  if (state.events)
4978
5005
  state.events.exit?.("MethodModifier", state, result);
4979
5006
  return result;
4980
5007
  } else {
4981
- const result = MethodModifier$0(state) || MethodModifier$1(state) || MethodModifier$2(state) || MethodModifier$3(state);
5008
+ const result = MethodModifier$0(state) || MethodModifier$1(state) || MethodModifier$2(state);
4982
5009
  if (state.events)
4983
5010
  state.events.exit?.("MethodModifier", state, result);
4984
5011
  return result;
@@ -5124,7 +5151,7 @@ ${input.slice(result.pos)}
5124
5151
  var AssignmentOpSymbol$15 = $T($EXPECT($L44, fail, 'AssignmentOpSymbol "?="'), function(value) {
5125
5152
  return "??=";
5126
5153
  });
5127
- var AssignmentOpSymbol$16 = $EXPECT($L24, fail, 'AssignmentOpSymbol "="');
5154
+ var AssignmentOpSymbol$16 = $EXPECT($L25, fail, 'AssignmentOpSymbol "="');
5128
5155
  var AssignmentOpSymbol$17 = $T($S(CoffeeWordAssignmentOp), function(value) {
5129
5156
  return value[0];
5130
5157
  });
@@ -5207,7 +5234,7 @@ ${input.slice(result.pos)}
5207
5234
  });
5208
5235
  var BinaryOpSymbol$10 = $EXPECT($L56, fail, 'BinaryOpSymbol ">>>"');
5209
5236
  var BinaryOpSymbol$11 = $EXPECT($L57, fail, 'BinaryOpSymbol ">>"');
5210
- var BinaryOpSymbol$12 = $EXPECT($L25, fail, 'BinaryOpSymbol ">"');
5237
+ var BinaryOpSymbol$12 = $EXPECT($L26, fail, 'BinaryOpSymbol ">"');
5211
5238
  var BinaryOpSymbol$13 = $EXPECT($L58, fail, 'BinaryOpSymbol "!=="');
5212
5239
  var BinaryOpSymbol$14 = $TV($EXPECT($L59, fail, 'BinaryOpSymbol "!="'), function($skip, $loc, $0, $1) {
5213
5240
  if (module.config.coffeeEq)
@@ -5439,7 +5466,7 @@ ${input.slice(result.pos)}
5439
5466
  return result;
5440
5467
  }
5441
5468
  }
5442
- var BlockStatement$0 = $T($S(ExplicitBlock, $N($S(__, $EXPECT($L24, fail, 'BlockStatement "="')))), function(value) {
5469
+ var BlockStatement$0 = $T($S(ExplicitBlock, $N($S(__, $EXPECT($L25, fail, 'BlockStatement "="')))), function(value) {
5443
5470
  return value[0];
5444
5471
  });
5445
5472
  function BlockStatement(state) {
@@ -8987,7 +9014,7 @@ ${input.slice(result.pos)}
8987
9014
  }
8988
9015
  }
8989
9016
  var Async$0 = $TV($EXPECT($L92, fail, 'Async "async"'), function($skip, $loc, $0, $1) {
8990
- return { $loc, token: $1 };
9017
+ return { $loc, token: $1, type: "Async" };
8991
9018
  });
8992
9019
  function Async(state) {
8993
9020
  if (state.events) {
@@ -9133,7 +9160,7 @@ ${input.slice(result.pos)}
9133
9160
  return result;
9134
9161
  }
9135
9162
  }
9136
- var CloseBrace$0 = $TV($EXPECT($L28, fail, 'CloseBrace "}"'), function($skip, $loc, $0, $1) {
9163
+ var CloseBrace$0 = $TV($EXPECT($L16, fail, 'CloseBrace "}"'), function($skip, $loc, $0, $1) {
9137
9164
  return { $loc, token: $1 };
9138
9165
  });
9139
9166
  function CloseBrace(state) {
@@ -9154,7 +9181,7 @@ ${input.slice(result.pos)}
9154
9181
  return result;
9155
9182
  }
9156
9183
  }
9157
- var CloseBracket$0 = $TV($EXPECT($L26, fail, 'CloseBracket "]"'), function($skip, $loc, $0, $1) {
9184
+ var CloseBracket$0 = $TV($EXPECT($L27, fail, 'CloseBracket "]"'), function($skip, $loc, $0, $1) {
9158
9185
  return { $loc, token: $1 };
9159
9186
  });
9160
9187
  function CloseBracket(state) {
@@ -9217,7 +9244,7 @@ ${input.slice(result.pos)}
9217
9244
  return result;
9218
9245
  }
9219
9246
  }
9220
- var Colon$0 = $TV($EXPECT($L27, fail, 'Colon ":"'), function($skip, $loc, $0, $1) {
9247
+ var Colon$0 = $TV($EXPECT($L28, fail, 'Colon ":"'), function($skip, $loc, $0, $1) {
9221
9248
  return { $loc, token: $1 };
9222
9249
  });
9223
9250
  function Colon(state) {
@@ -9448,7 +9475,7 @@ ${input.slice(result.pos)}
9448
9475
  return result;
9449
9476
  }
9450
9477
  }
9451
- var Equals$0 = $TV($EXPECT($L24, fail, 'Equals "="'), function($skip, $loc, $0, $1) {
9478
+ var Equals$0 = $TV($EXPECT($L25, fail, 'Equals "="'), function($skip, $loc, $0, $1) {
9452
9479
  return { $loc, token: $1 };
9453
9480
  });
9454
9481
  function Equals(state) {
@@ -9554,7 +9581,7 @@ ${input.slice(result.pos)}
9554
9581
  }
9555
9582
  }
9556
9583
  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 };
9584
+ return { $loc, token: $1, type: "GetOrSet" };
9558
9585
  });
9559
9586
  function GetOrSet(state) {
9560
9587
  if (state.events) {
@@ -10389,7 +10416,7 @@ ${input.slice(result.pos)}
10389
10416
  return result;
10390
10417
  }
10391
10418
  }
10392
- var JSXOpeningElement$0 = $S($EXPECT($L5, fail, 'JSXOpeningElement "<"'), $TEXT(JSXElementName), $E(JSXAttributes), __, $EXPECT($L25, fail, 'JSXOpeningElement ">"'));
10419
+ var JSXOpeningElement$0 = $S($EXPECT($L5, fail, 'JSXOpeningElement "<"'), $TEXT(JSXElementName), $E(JSXAttributes), __, $EXPECT($L26, fail, 'JSXOpeningElement ">"'));
10393
10420
  function JSXOpeningElement(state) {
10394
10421
  if (state.events) {
10395
10422
  const result = state.events.enter?.("JSXOpeningElement", state);
@@ -10408,7 +10435,7 @@ ${input.slice(result.pos)}
10408
10435
  return result;
10409
10436
  }
10410
10437
  }
10411
- var JSXClosingElement$0 = $S($EXPECT($L144, fail, 'JSXClosingElement "</"'), __, $TEXT(JSXElementName), __, $EXPECT($L25, fail, 'JSXClosingElement ">"'));
10438
+ var JSXClosingElement$0 = $S($EXPECT($L144, fail, 'JSXClosingElement "</"'), __, $TEXT(JSXElementName), __, $EXPECT($L26, fail, 'JSXClosingElement ">"'));
10412
10439
  function JSXClosingElement(state) {
10413
10440
  if (state.events) {
10414
10441
  const result = state.events.enter?.("JSXClosingElement", state);
@@ -10506,7 +10533,44 @@ ${input.slice(result.pos)}
10506
10533
  return result;
10507
10534
  }
10508
10535
  }
10509
- var JSXAttribute$0 = $S(OpenBrace, __, DotDotDot, ExtendedExpression, __, CloseBrace);
10536
+ var JSXAttribute$0 = $TS($S(BracedObjectLiteral), function($skip, $loc, $0, $1) {
10537
+ const { children } = $1;
10538
+ const parts = [];
10539
+ const rest = [];
10540
+ for (let i = 1; i < children.length - 1; i++) {
10541
+ if (i > 1)
10542
+ parts.push(" ");
10543
+ const part = children[i];
10544
+ switch (part.type) {
10545
+ case "Identifier":
10546
+ parts.push([part.name, "={", part.name, "}"]);
10547
+ break;
10548
+ case "Property":
10549
+ if (part.name.type === "ComputedPropertyName") {
10550
+ rest.push(part);
10551
+ } else {
10552
+ parts.push([part.name, "={", module.insertTrimmingSpace(part.value, ""), "}"]);
10553
+ }
10554
+ break;
10555
+ case "SpreadProperty":
10556
+ parts.push(["{", part.value, "}"]);
10557
+ break;
10558
+ case "MethodDefinition":
10559
+ try {
10560
+ parts.push([part.name, "={", module.convertMethodToFunction(part), "}"]);
10561
+ } catch {
10562
+ rest.push(part);
10563
+ }
10564
+ break;
10565
+ default:
10566
+ throw new Error(`invalid object literal type in JSX attribute: ${part.type}`);
10567
+ }
10568
+ }
10569
+ if (rest.length) {
10570
+ parts.push(["{...{", ...rest, "}}"]);
10571
+ }
10572
+ return parts;
10573
+ });
10510
10574
  var JSXAttribute$1 = $S(JSXAttributeName, $E(JSXAttributeInitializer));
10511
10575
  function JSXAttribute(state) {
10512
10576
  if (state.events) {
@@ -11416,7 +11480,7 @@ ${input.slice(result.pos)}
11416
11480
  return result;
11417
11481
  }
11418
11482
  }
11419
- var TypeArguments$0 = $S(__, $EXPECT($L5, fail, 'TypeArguments "<"'), __, Type, $Q($S(__, Comma, __, Type)), $E($S(__, Comma)), __, $EXPECT($L25, fail, 'TypeArguments ">"'));
11483
+ var TypeArguments$0 = $S(__, $EXPECT($L5, fail, 'TypeArguments "<"'), __, Type, $Q($S(__, Comma, __, Type)), $E($S(__, Comma)), __, $EXPECT($L26, fail, 'TypeArguments ">"'));
11420
11484
  function TypeArguments(state) {
11421
11485
  if (state.events) {
11422
11486
  const result = state.events.enter?.("TypeArguments", state);
@@ -11435,7 +11499,7 @@ ${input.slice(result.pos)}
11435
11499
  return result;
11436
11500
  }
11437
11501
  }
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) {
11502
+ 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
11503
  return { ts: true, children: $0 };
11440
11504
  });
11441
11505
  function TypeParameters(state) {
@@ -11495,8 +11559,8 @@ ${input.slice(result.pos)}
11495
11559
  }
11496
11560
  }
11497
11561
  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) {
11562
+ var TypeParameterDelimiter$1 = $Y($S($Q(_), $EXPECT($L26, fail, 'TypeParameterDelimiter ">"')));
11563
+ var TypeParameterDelimiter$2 = $TV($Y($S(__, $EXPECT($L26, fail, 'TypeParameterDelimiter ">"'))), function($skip, $loc, $0, $1) {
11500
11564
  return { $loc, token: "," };
11501
11565
  });
11502
11566
  var TypeParameterDelimiter$3 = $TV($Y(EOS), function($skip, $loc, $0, $1) {
@@ -12614,6 +12678,8 @@ ${input.slice(result.pos)}
12614
12678
  module.isWhitespaceOrEmpty = function(node) {
12615
12679
  if (!node)
12616
12680
  return true;
12681
+ if (node.token)
12682
+ return node.token.match(/^\s*$/);
12617
12683
  if (!node.length)
12618
12684
  return true;
12619
12685
  if (typeof node === "string")
@@ -13010,6 +13076,32 @@ ${input.slice(result.pos)}
13010
13076
  throw new Error("Unknown postfix statement");
13011
13077
  }
13012
13078
  };
13079
+ module.convertMethodToFunction = function(method) {
13080
+ const { decorators, signature, block } = method;
13081
+ let opening = signature.children[0];
13082
+ if (opening) {
13083
+ if (opening[0].type === "GetOrSet") {
13084
+ throw new Error("cannot convert get/set method to function");
13085
+ } else if (opening[0][0]?.type === "Async") {
13086
+ opening = [opening[0][0], " function ", ...opening.slice(1)];
13087
+ } else {
13088
+ opening = ["function ", ...opening];
13089
+ }
13090
+ } else {
13091
+ opening = "function ";
13092
+ }
13093
+ return {
13094
+ ...signature,
13095
+ id: signature.name,
13096
+ type: "FunctionExpression",
13097
+ children: [
13098
+ decorators,
13099
+ [opening, ...signature.children.slice(1)],
13100
+ block
13101
+ ],
13102
+ block
13103
+ };
13104
+ };
13013
13105
  module.processProgram = function(statements) {
13014
13106
  processAssignments(statements);
13015
13107
  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);
@@ -4244,7 +4251,13 @@ ${input.slice(result.pos)}
4244
4251
  }
4245
4252
  var ArrayLiteralContent$0 = RangeExpression;
4246
4253
  var ArrayLiteralContent$1 = NestedElementList;
4247
- var ArrayLiteralContent$2 = ElementList;
4254
+ var ArrayLiteralContent$2 = $TS($S(ElementList, $E(NestedElementList)), function($skip, $loc, $0, $1, $2) {
4255
+ if ($2) {
4256
+ return [...$1, ",", ...$2];
4257
+ } else {
4258
+ return $1;
4259
+ }
4260
+ });
4248
4261
  function ArrayLiteralContent(state) {
4249
4262
  if (state.events) {
4250
4263
  const result = state.events.enter?.("ArrayLiteralContent", state);
@@ -4326,7 +4339,7 @@ ${input.slice(result.pos)}
4326
4339
  }
4327
4340
  }
4328
4341
  var ArrayElementDelimiter$0 = $S(__, Comma);
4329
- var ArrayElementDelimiter$1 = $Y($S(__, $EXPECT($L26, fail, 'ArrayElementDelimiter "]"')));
4342
+ var ArrayElementDelimiter$1 = $Y($S(__, $EXPECT($L27, fail, 'ArrayElementDelimiter "]"')));
4330
4343
  var ArrayElementDelimiter$2 = $TV($Y(EOS), function($skip, $loc, $0, $1) {
4331
4344
  return { $loc, token: "," };
4332
4345
  });
@@ -4691,11 +4704,11 @@ ${input.slice(result.pos)}
4691
4704
  return result;
4692
4705
  }
4693
4706
  }
4694
- var ImplicitInlineObjectPropertyDelimiter$0 = $S($Q(TrailingComment), $EXPECT($L23, fail, 'ImplicitInlineObjectPropertyDelimiter ","'));
4707
+ var ImplicitInlineObjectPropertyDelimiter$0 = $S($Q(TrailingComment), $EXPECT($L24, fail, 'ImplicitInlineObjectPropertyDelimiter ","'));
4695
4708
  var ImplicitInlineObjectPropertyDelimiter$1 = $T($Y($S(EOS, NamedProperty)), function(value) {
4696
4709
  return ",";
4697
4710
  });
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) {
4711
+ 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
4712
  return "";
4700
4713
  });
4701
4714
  var ImplicitInlineObjectPropertyDelimiter$3 = $T($Y(EOS), function(value) {
@@ -4720,7 +4733,7 @@ ${input.slice(result.pos)}
4720
4733
  }
4721
4734
  }
4722
4735
  var ObjectPropertyDelimiter$0 = $S($Q(_), Comma);
4723
- var ObjectPropertyDelimiter$1 = $Y($S(__, $EXPECT($L28, fail, 'ObjectPropertyDelimiter "}"')));
4736
+ var ObjectPropertyDelimiter$1 = $Y($S(__, $EXPECT($L16, fail, 'ObjectPropertyDelimiter "}"')));
4724
4737
  var ObjectPropertyDelimiter$2 = $TV($Y(EOS), function($skip, $loc, $0, $1) {
4725
4738
  return { $loc, token: "," };
4726
4739
  });
@@ -4772,10 +4785,13 @@ ${input.slice(result.pos)}
4772
4785
  var ws = $1;
4773
4786
  var at = $2;
4774
4787
  var id = $3;
4788
+ const value = [{ ...at, token: "this." }, id];
4775
4789
  return {
4776
4790
  type: "Property",
4777
- children: [...ws, id, ": ", { ...at, token: "this." }, id],
4778
- names: id.names
4791
+ children: [...ws, id, ": ", ...value],
4792
+ name: id,
4793
+ names: id.names,
4794
+ value
4779
4795
  };
4780
4796
  });
4781
4797
  var PropertyDefinition$1 = NamedProperty;
@@ -4794,7 +4810,8 @@ ${input.slice(result.pos)}
4794
4810
  return {
4795
4811
  type: "SpreadProperty",
4796
4812
  children: [...ws, dots, exp],
4797
- names: exp.names
4813
+ names: exp.names,
4814
+ value: [dots, exp]
4798
4815
  };
4799
4816
  });
4800
4817
  var PropertyDefinition$4 = $TS($S(__, IdentifierReference), function($skip, $loc, $0, $1, $2) {
@@ -4821,11 +4838,14 @@ ${input.slice(result.pos)}
4821
4838
  }
4822
4839
  }
4823
4840
  var NamedProperty$0 = $TS($S(__, PropertyName, __, Colon, ExtendedExpression), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
4841
+ var name = $2;
4824
4842
  var exp = $5;
4825
4843
  return {
4826
4844
  type: "Property",
4827
4845
  children: $0,
4828
- names: exp.names || []
4846
+ name,
4847
+ names: exp.names || [],
4848
+ value: exp
4829
4849
  };
4830
4850
  });
4831
4851
  function NamedProperty(state) {
@@ -4875,7 +4895,12 @@ ${input.slice(result.pos)}
4875
4895
  var PropertyName$0 = NumericLiteral;
4876
4896
  var PropertyName$1 = StringLiteral;
4877
4897
  var PropertyName$2 = IdentifierName;
4878
- var PropertyName$3 = $S(OpenBracket, ExtendedExpression, __, CloseBracket);
4898
+ var PropertyName$3 = $TS($S(OpenBracket, ExtendedExpression, __, CloseBracket), function($skip, $loc, $0, $1, $2, $3, $4) {
4899
+ return {
4900
+ type: "ComputedPropertyName",
4901
+ children: $0
4902
+ };
4903
+ });
4879
4904
  function PropertyName(state) {
4880
4905
  if (state.events) {
4881
4906
  const result = state.events.enter?.("PropertyName", state);
@@ -4933,11 +4958,14 @@ ${input.slice(result.pos)}
4933
4958
  }
4934
4959
  }
4935
4960
  var MethodDefinition$0 = $TS($S($E(Decorators), MethodSignature, BracedBlock), function($skip, $loc, $0, $1, $2, $3) {
4961
+ var decorators = $1;
4936
4962
  var signature = $2;
4937
4963
  var block = $3;
4938
4964
  return {
4939
4965
  type: "MethodDefinition",
4940
4966
  children: $0,
4967
+ name: signature.name,
4968
+ decorators,
4941
4969
  signature,
4942
4970
  block,
4943
4971
  parameters: signature.parameters
@@ -4964,7 +4992,6 @@ ${input.slice(result.pos)}
4964
4992
  var MethodModifier$0 = $S(GetOrSet, $Q(TrailingComment));
4965
4993
  var MethodModifier$1 = $S($S(Async, __), $E($S(Star, __)));
4966
4994
  var MethodModifier$2 = $S(Star, __);
4967
- var MethodModifier$3 = $S(Async, __);
4968
4995
  function MethodModifier(state) {
4969
4996
  if (state.events) {
4970
4997
  const result = state.events.enter?.("MethodModifier", state);
@@ -4972,12 +4999,12 @@ ${input.slice(result.pos)}
4972
4999
  return result.cache;
4973
5000
  }
4974
5001
  if (state.tokenize) {
4975
- const result = $TOKEN("MethodModifier", state, MethodModifier$0(state) || MethodModifier$1(state) || MethodModifier$2(state) || MethodModifier$3(state));
5002
+ const result = $TOKEN("MethodModifier", state, MethodModifier$0(state) || MethodModifier$1(state) || MethodModifier$2(state));
4976
5003
  if (state.events)
4977
5004
  state.events.exit?.("MethodModifier", state, result);
4978
5005
  return result;
4979
5006
  } else {
4980
- const result = MethodModifier$0(state) || MethodModifier$1(state) || MethodModifier$2(state) || MethodModifier$3(state);
5007
+ const result = MethodModifier$0(state) || MethodModifier$1(state) || MethodModifier$2(state);
4981
5008
  if (state.events)
4982
5009
  state.events.exit?.("MethodModifier", state, result);
4983
5010
  return result;
@@ -5123,7 +5150,7 @@ ${input.slice(result.pos)}
5123
5150
  var AssignmentOpSymbol$15 = $T($EXPECT($L44, fail, 'AssignmentOpSymbol "?="'), function(value) {
5124
5151
  return "??=";
5125
5152
  });
5126
- var AssignmentOpSymbol$16 = $EXPECT($L24, fail, 'AssignmentOpSymbol "="');
5153
+ var AssignmentOpSymbol$16 = $EXPECT($L25, fail, 'AssignmentOpSymbol "="');
5127
5154
  var AssignmentOpSymbol$17 = $T($S(CoffeeWordAssignmentOp), function(value) {
5128
5155
  return value[0];
5129
5156
  });
@@ -5206,7 +5233,7 @@ ${input.slice(result.pos)}
5206
5233
  });
5207
5234
  var BinaryOpSymbol$10 = $EXPECT($L56, fail, 'BinaryOpSymbol ">>>"');
5208
5235
  var BinaryOpSymbol$11 = $EXPECT($L57, fail, 'BinaryOpSymbol ">>"');
5209
- var BinaryOpSymbol$12 = $EXPECT($L25, fail, 'BinaryOpSymbol ">"');
5236
+ var BinaryOpSymbol$12 = $EXPECT($L26, fail, 'BinaryOpSymbol ">"');
5210
5237
  var BinaryOpSymbol$13 = $EXPECT($L58, fail, 'BinaryOpSymbol "!=="');
5211
5238
  var BinaryOpSymbol$14 = $TV($EXPECT($L59, fail, 'BinaryOpSymbol "!="'), function($skip, $loc, $0, $1) {
5212
5239
  if (module2.config.coffeeEq)
@@ -5438,7 +5465,7 @@ ${input.slice(result.pos)}
5438
5465
  return result;
5439
5466
  }
5440
5467
  }
5441
- var BlockStatement$0 = $T($S(ExplicitBlock, $N($S(__, $EXPECT($L24, fail, 'BlockStatement "="')))), function(value) {
5468
+ var BlockStatement$0 = $T($S(ExplicitBlock, $N($S(__, $EXPECT($L25, fail, 'BlockStatement "="')))), function(value) {
5442
5469
  return value[0];
5443
5470
  });
5444
5471
  function BlockStatement(state) {
@@ -8986,7 +9013,7 @@ ${input.slice(result.pos)}
8986
9013
  }
8987
9014
  }
8988
9015
  var Async$0 = $TV($EXPECT($L92, fail, 'Async "async"'), function($skip, $loc, $0, $1) {
8989
- return { $loc, token: $1 };
9016
+ return { $loc, token: $1, type: "Async" };
8990
9017
  });
8991
9018
  function Async(state) {
8992
9019
  if (state.events) {
@@ -9132,7 +9159,7 @@ ${input.slice(result.pos)}
9132
9159
  return result;
9133
9160
  }
9134
9161
  }
9135
- var CloseBrace$0 = $TV($EXPECT($L28, fail, 'CloseBrace "}"'), function($skip, $loc, $0, $1) {
9162
+ var CloseBrace$0 = $TV($EXPECT($L16, fail, 'CloseBrace "}"'), function($skip, $loc, $0, $1) {
9136
9163
  return { $loc, token: $1 };
9137
9164
  });
9138
9165
  function CloseBrace(state) {
@@ -9153,7 +9180,7 @@ ${input.slice(result.pos)}
9153
9180
  return result;
9154
9181
  }
9155
9182
  }
9156
- var CloseBracket$0 = $TV($EXPECT($L26, fail, 'CloseBracket "]"'), function($skip, $loc, $0, $1) {
9183
+ var CloseBracket$0 = $TV($EXPECT($L27, fail, 'CloseBracket "]"'), function($skip, $loc, $0, $1) {
9157
9184
  return { $loc, token: $1 };
9158
9185
  });
9159
9186
  function CloseBracket(state) {
@@ -9216,7 +9243,7 @@ ${input.slice(result.pos)}
9216
9243
  return result;
9217
9244
  }
9218
9245
  }
9219
- var Colon$0 = $TV($EXPECT($L27, fail, 'Colon ":"'), function($skip, $loc, $0, $1) {
9246
+ var Colon$0 = $TV($EXPECT($L28, fail, 'Colon ":"'), function($skip, $loc, $0, $1) {
9220
9247
  return { $loc, token: $1 };
9221
9248
  });
9222
9249
  function Colon(state) {
@@ -9447,7 +9474,7 @@ ${input.slice(result.pos)}
9447
9474
  return result;
9448
9475
  }
9449
9476
  }
9450
- var Equals$0 = $TV($EXPECT($L24, fail, 'Equals "="'), function($skip, $loc, $0, $1) {
9477
+ var Equals$0 = $TV($EXPECT($L25, fail, 'Equals "="'), function($skip, $loc, $0, $1) {
9451
9478
  return { $loc, token: $1 };
9452
9479
  });
9453
9480
  function Equals(state) {
@@ -9553,7 +9580,7 @@ ${input.slice(result.pos)}
9553
9580
  }
9554
9581
  }
9555
9582
  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 };
9583
+ return { $loc, token: $1, type: "GetOrSet" };
9557
9584
  });
9558
9585
  function GetOrSet(state) {
9559
9586
  if (state.events) {
@@ -10388,7 +10415,7 @@ ${input.slice(result.pos)}
10388
10415
  return result;
10389
10416
  }
10390
10417
  }
10391
- var JSXOpeningElement$0 = $S($EXPECT($L5, fail, 'JSXOpeningElement "<"'), $TEXT(JSXElementName), $E(JSXAttributes), __, $EXPECT($L25, fail, 'JSXOpeningElement ">"'));
10418
+ var JSXOpeningElement$0 = $S($EXPECT($L5, fail, 'JSXOpeningElement "<"'), $TEXT(JSXElementName), $E(JSXAttributes), __, $EXPECT($L26, fail, 'JSXOpeningElement ">"'));
10392
10419
  function JSXOpeningElement(state) {
10393
10420
  if (state.events) {
10394
10421
  const result = state.events.enter?.("JSXOpeningElement", state);
@@ -10407,7 +10434,7 @@ ${input.slice(result.pos)}
10407
10434
  return result;
10408
10435
  }
10409
10436
  }
10410
- var JSXClosingElement$0 = $S($EXPECT($L144, fail, 'JSXClosingElement "</"'), __, $TEXT(JSXElementName), __, $EXPECT($L25, fail, 'JSXClosingElement ">"'));
10437
+ var JSXClosingElement$0 = $S($EXPECT($L144, fail, 'JSXClosingElement "</"'), __, $TEXT(JSXElementName), __, $EXPECT($L26, fail, 'JSXClosingElement ">"'));
10411
10438
  function JSXClosingElement(state) {
10412
10439
  if (state.events) {
10413
10440
  const result = state.events.enter?.("JSXClosingElement", state);
@@ -10505,7 +10532,44 @@ ${input.slice(result.pos)}
10505
10532
  return result;
10506
10533
  }
10507
10534
  }
10508
- var JSXAttribute$0 = $S(OpenBrace, __, DotDotDot, ExtendedExpression, __, CloseBrace);
10535
+ var JSXAttribute$0 = $TS($S(BracedObjectLiteral), function($skip, $loc, $0, $1) {
10536
+ const { children } = $1;
10537
+ const parts = [];
10538
+ const rest = [];
10539
+ for (let i = 1; i < children.length - 1; i++) {
10540
+ if (i > 1)
10541
+ parts.push(" ");
10542
+ const part = children[i];
10543
+ switch (part.type) {
10544
+ case "Identifier":
10545
+ parts.push([part.name, "={", part.name, "}"]);
10546
+ break;
10547
+ case "Property":
10548
+ if (part.name.type === "ComputedPropertyName") {
10549
+ rest.push(part);
10550
+ } else {
10551
+ parts.push([part.name, "={", module2.insertTrimmingSpace(part.value, ""), "}"]);
10552
+ }
10553
+ break;
10554
+ case "SpreadProperty":
10555
+ parts.push(["{", part.value, "}"]);
10556
+ break;
10557
+ case "MethodDefinition":
10558
+ try {
10559
+ parts.push([part.name, "={", module2.convertMethodToFunction(part), "}"]);
10560
+ } catch {
10561
+ rest.push(part);
10562
+ }
10563
+ break;
10564
+ default:
10565
+ throw new Error(`invalid object literal type in JSX attribute: ${part.type}`);
10566
+ }
10567
+ }
10568
+ if (rest.length) {
10569
+ parts.push(["{...{", ...rest, "}}"]);
10570
+ }
10571
+ return parts;
10572
+ });
10509
10573
  var JSXAttribute$1 = $S(JSXAttributeName, $E(JSXAttributeInitializer));
10510
10574
  function JSXAttribute(state) {
10511
10575
  if (state.events) {
@@ -11415,7 +11479,7 @@ ${input.slice(result.pos)}
11415
11479
  return result;
11416
11480
  }
11417
11481
  }
11418
- var TypeArguments$0 = $S(__, $EXPECT($L5, fail, 'TypeArguments "<"'), __, Type, $Q($S(__, Comma, __, Type)), $E($S(__, Comma)), __, $EXPECT($L25, fail, 'TypeArguments ">"'));
11482
+ var TypeArguments$0 = $S(__, $EXPECT($L5, fail, 'TypeArguments "<"'), __, Type, $Q($S(__, Comma, __, Type)), $E($S(__, Comma)), __, $EXPECT($L26, fail, 'TypeArguments ">"'));
11419
11483
  function TypeArguments(state) {
11420
11484
  if (state.events) {
11421
11485
  const result = state.events.enter?.("TypeArguments", state);
@@ -11434,7 +11498,7 @@ ${input.slice(result.pos)}
11434
11498
  return result;
11435
11499
  }
11436
11500
  }
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) {
11501
+ 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
11502
  return { ts: true, children: $0 };
11439
11503
  });
11440
11504
  function TypeParameters(state) {
@@ -11494,8 +11558,8 @@ ${input.slice(result.pos)}
11494
11558
  }
11495
11559
  }
11496
11560
  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) {
11561
+ var TypeParameterDelimiter$1 = $Y($S($Q(_), $EXPECT($L26, fail, 'TypeParameterDelimiter ">"')));
11562
+ var TypeParameterDelimiter$2 = $TV($Y($S(__, $EXPECT($L26, fail, 'TypeParameterDelimiter ">"'))), function($skip, $loc, $0, $1) {
11499
11563
  return { $loc, token: "," };
11500
11564
  });
11501
11565
  var TypeParameterDelimiter$3 = $TV($Y(EOS), function($skip, $loc, $0, $1) {
@@ -12613,6 +12677,8 @@ ${input.slice(result.pos)}
12613
12677
  module2.isWhitespaceOrEmpty = function(node) {
12614
12678
  if (!node)
12615
12679
  return true;
12680
+ if (node.token)
12681
+ return node.token.match(/^\s*$/);
12616
12682
  if (!node.length)
12617
12683
  return true;
12618
12684
  if (typeof node === "string")
@@ -13009,6 +13075,32 @@ ${input.slice(result.pos)}
13009
13075
  throw new Error("Unknown postfix statement");
13010
13076
  }
13011
13077
  };
13078
+ module2.convertMethodToFunction = function(method) {
13079
+ const { decorators, signature, block } = method;
13080
+ let opening = signature.children[0];
13081
+ if (opening) {
13082
+ if (opening[0].type === "GetOrSet") {
13083
+ throw new Error("cannot convert get/set method to function");
13084
+ } else if (opening[0][0]?.type === "Async") {
13085
+ opening = [opening[0][0], " function ", ...opening.slice(1)];
13086
+ } else {
13087
+ opening = ["function ", ...opening];
13088
+ }
13089
+ } else {
13090
+ opening = "function ";
13091
+ }
13092
+ return {
13093
+ ...signature,
13094
+ id: signature.name,
13095
+ type: "FunctionExpression",
13096
+ children: [
13097
+ decorators,
13098
+ [opening, ...signature.children.slice(1)],
13099
+ block
13100
+ ],
13101
+ block
13102
+ };
13103
+ };
13012
13104
  module2.processProgram = function(statements) {
13013
13105
  processAssignments(statements);
13014
13106
  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.31",
4
4
  "description": "CoffeeScript style syntax for TypeScript",
5
5
  "main": "dist/main.js",
6
6
  "exports": {