@danielx/civet 0.7.27 → 0.7.28

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/CHANGELOG.md CHANGED
@@ -4,6 +4,10 @@ This changelog is generated automatically by [`build/changelog.civet`](build/cha
4
4
  For each version of Civet, it lists and links to all incorporated PRs,
5
5
  as well as a full diff and commit list.
6
6
 
7
+ ## 0.7.28 (2024-08-30, [diff](https://github.com/DanielXMoore/Civet/compare/v0.7.27...v0.7.28), [commits](https://github.com/DanielXMoore/Civet/commits/v0.7.28))
8
+ * Fix pattern matching with indented object patterns [[#1384](https://github.com/DanielXMoore/Civet/pull/1384)]
9
+ * `"civet jsxCode"` directive treats JSX children as Civet code [[#1386](https://github.com/DanielXMoore/Civet/pull/1386)]
10
+
7
11
  ## 0.7.27 (2024-08-29, [diff](https://github.com/DanielXMoore/Civet/compare/v0.7.26...v0.7.27), [commits](https://github.com/DanielXMoore/Civet/commits/v0.7.27))
8
12
  * Add `repository` to `package.json`, fixing Dependabot changelog detection [[#1380](https://github.com/DanielXMoore/Civet/pull/1380)]
9
13
  * Fix glob accessor `.{a,b}` shorthand for `&.{a,b}` [[#1379](https://github.com/DanielXMoore/Civet/pull/1379)]
package/dist/browser.js CHANGED
@@ -3058,12 +3058,14 @@ ${body}`;
3058
3058
  });
3059
3059
  const { blockPrefix } = pattern;
3060
3060
  if (blockPrefix) {
3061
- const postElements = blockPrefix.children[1], { length: postLength } = postElements;
3061
+ const postElements = blockPrefix.children[1];
3062
+ const { length: postLength } = postElements;
3062
3063
  postElements.forEach(({ children: [, e] }, i) => {
3063
3064
  const subRef = [ref, "[", ref, ".length - ", (postLength + i).toString(), "]"];
3064
3065
  return getPatternConditions(e, subRef, conditions);
3065
3066
  });
3066
3067
  }
3068
+ ;
3067
3069
  break;
3068
3070
  }
3069
3071
  case "ObjectBindingPattern": {
@@ -3071,34 +3073,46 @@ ${body}`;
3071
3073
  ["typeof ", ref, " === 'object'"],
3072
3074
  [ref, " != null"]
3073
3075
  );
3074
- pattern.properties.forEach((p) => {
3076
+ for (let ref1 = pattern.properties, i4 = 0, len3 = ref1.length; i4 < len3; i4++) {
3077
+ const p = ref1[i4];
3075
3078
  switch (p.type) {
3076
3079
  case "PinProperty":
3077
3080
  case "BindingProperty": {
3078
3081
  const { name, value } = p;
3079
3082
  let subRef;
3080
3083
  switch (name.type) {
3081
- case "ComputedPropertyName":
3084
+ case "ComputedPropertyName": {
3082
3085
  conditions.push([name.expression, " in ", ref]);
3083
3086
  subRef = [ref, name];
3084
3087
  break;
3088
+ }
3085
3089
  case "Literal":
3086
3090
  case "StringLiteral":
3087
- case "NumericLiteral":
3091
+ case "NumericLiteral": {
3088
3092
  conditions.push([name, " in ", ref]);
3089
3093
  subRef = [ref, "[", name, "]"];
3090
3094
  break;
3091
- default:
3092
- conditions.push(["'", name, "' in ", ref]);
3093
- subRef = [ref, ".", name];
3095
+ }
3096
+ case "Identifier": {
3097
+ conditions.push(["'", name.name, "' in ", ref]);
3098
+ subRef = [ref, ".", name.name];
3099
+ break;
3100
+ }
3101
+ case "AtBinding": {
3102
+ conditions.push(["'", name.ref.id, "' in ", ref]);
3103
+ subRef = [ref, ".", name.ref.id];
3104
+ break;
3105
+ }
3094
3106
  }
3095
3107
  if (value) {
3096
3108
  getPatternConditions(value, subRef, conditions);
3097
3109
  }
3110
+ ;
3098
3111
  break;
3099
3112
  }
3100
3113
  }
3101
- });
3114
+ }
3115
+ ;
3102
3116
  break;
3103
3117
  }
3104
3118
  case "ConditionFragment": {
@@ -3122,22 +3136,22 @@ ${body}`;
3122
3136
  );
3123
3137
  break;
3124
3138
  }
3125
- case "PinPattern":
3139
+ case "PinPattern": {
3126
3140
  conditions.push([
3127
3141
  ref,
3128
3142
  " === ",
3129
3143
  pattern.expression
3130
3144
  ]);
3131
3145
  break;
3132
- case "Literal":
3146
+ }
3147
+ case "Literal": {
3133
3148
  conditions.push([
3134
3149
  ref,
3135
3150
  " === ",
3136
3151
  pattern
3137
3152
  ]);
3138
3153
  break;
3139
- default:
3140
- break;
3154
+ }
3141
3155
  }
3142
3156
  return conditions;
3143
3157
  }
@@ -7098,11 +7112,15 @@ ${js}`
7098
7112
  InlineJSXMemberExpressionRest,
7099
7113
  InlineJSXPrimaryExpression,
7100
7114
  JSXMixedChildren,
7115
+ JSXSameLineChildren,
7101
7116
  JSXChildren,
7102
7117
  JSXNestedChildren,
7103
7118
  JSXEOS,
7104
7119
  JSXNested,
7105
7120
  JSXChild,
7121
+ JSXChildForcedCode,
7122
+ JSXChildForcedNoCode,
7123
+ JSXChildGeneral,
7106
7124
  JSXComment,
7107
7125
  JSXCommentContent,
7108
7126
  JSXText,
@@ -7110,7 +7128,8 @@ ${js}`
7110
7128
  IndentedJSXChildExpression,
7111
7129
  NestedJSXChildExpression,
7112
7130
  JSXAngleChild,
7113
- JSXAngleChildExpression,
7131
+ JSXCodeChild,
7132
+ JSXCodeChildExpression,
7114
7133
  UsingDeclaration,
7115
7134
  UsingBinding,
7116
7135
  UsingJSModeError,
@@ -7243,6 +7262,8 @@ ${js}`
7243
7262
  CoffeeNotEnabled,
7244
7263
  CoffeeOfEnabled,
7245
7264
  CoffeePrototypeEnabled,
7265
+ JSXCodeNestedEnabled,
7266
+ JSXCodeSameLineEnabled,
7246
7267
  ObjectIsEnabled,
7247
7268
  Reset,
7248
7269
  Init,
@@ -15804,7 +15825,7 @@ ${js}`
15804
15825
  function InlineJSXPrimaryExpression(ctx, state2) {
15805
15826
  return (0, import_lib3.$EVENT_C)(ctx, state2, "InlineJSXPrimaryExpression", InlineJSXPrimaryExpression$$);
15806
15827
  }
15807
- var JSXMixedChildren$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$Q)(JSXChild), JSXNestedChildren), function($skip, $loc, $0, $1, $2) {
15828
+ var JSXMixedChildren$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(JSXSameLineChildren, JSXNestedChildren), function($skip, $loc, $0, $1, $2) {
15808
15829
  var c1 = $1;
15809
15830
  var c2 = $2;
15810
15831
  return {
@@ -15815,6 +15836,18 @@ ${js}`
15815
15836
  function JSXMixedChildren(ctx, state2) {
15816
15837
  return (0, import_lib3.$EVENT)(ctx, state2, "JSXMixedChildren", JSXMixedChildren$0);
15817
15838
  }
15839
+ var JSXSameLineChildren$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(JSXCodeSameLineEnabled, (0, import_lib3.$Q)((0, import_lib3.$S)((0, import_lib3.$E)(NonNewlineWhitespace), (0, import_lib3.$N)(EOL), JSXChildForcedCode))), function($skip, $loc, $0, $1, $2) {
15840
+ var children = $2;
15841
+ return children.map(([, , c]) => c);
15842
+ });
15843
+ var JSXSameLineChildren$1 = (0, import_lib3.$T)((0, import_lib3.$S)((0, import_lib3.$N)(JSXCodeSameLineEnabled), (0, import_lib3.$Q)(JSXChildForcedNoCode)), function(value) {
15844
+ var children = value[1];
15845
+ return children;
15846
+ });
15847
+ var JSXSameLineChildren$$ = [JSXSameLineChildren$0, JSXSameLineChildren$1];
15848
+ function JSXSameLineChildren(ctx, state2) {
15849
+ return (0, import_lib3.$EVENT_C)(ctx, state2, "JSXSameLineChildren", JSXSameLineChildren$$);
15850
+ }
15818
15851
  var JSXChildren$0 = (0, import_lib3.$TV)((0, import_lib3.$Q)((0, import_lib3.$S)((0, import_lib3.$Q)((0, import_lib3.$S)((0, import_lib3.$E)(NonNewlineWhitespace), EOL, (0, import_lib3.$E)(NonNewlineWhitespace))), JSXChild)), function($skip, $loc, $0, $1) {
15819
15852
  return {
15820
15853
  children: $1,
@@ -15856,10 +15889,33 @@ ${js}`
15856
15889
  function JSXNested(ctx, state2) {
15857
15890
  return (0, import_lib3.$EVENT)(ctx, state2, "JSXNested", JSXNested$0);
15858
15891
  }
15859
- var JSXChild$0 = JSXElement;
15860
- var JSXChild$1 = JSXFragment;
15861
- var JSXChild$2 = JSXComment;
15862
- var JSXChild$3 = (0, import_lib3.$TS)((0, import_lib3.$S)(OpenBrace, IndentedJSXChildExpression, __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4) {
15892
+ var JSXChild$0 = JSXChildGeneral;
15893
+ var JSXChild$1 = (0, import_lib3.$T)((0, import_lib3.$S)(JSXCodeNestedEnabled, JSXCodeChild), function(value) {
15894
+ return value[1];
15895
+ });
15896
+ var JSXChild$2 = (0, import_lib3.$T)((0, import_lib3.$S)((0, import_lib3.$N)(JSXCodeNestedEnabled), JSXText), function(value) {
15897
+ return value[1];
15898
+ });
15899
+ var JSXChild$$ = [JSXChild$0, JSXChild$1, JSXChild$2];
15900
+ function JSXChild(ctx, state2) {
15901
+ return (0, import_lib3.$EVENT_C)(ctx, state2, "JSXChild", JSXChild$$);
15902
+ }
15903
+ var JSXChildForcedCode$0 = JSXChildGeneral;
15904
+ var JSXChildForcedCode$1 = JSXCodeChild;
15905
+ var JSXChildForcedCode$$ = [JSXChildForcedCode$0, JSXChildForcedCode$1];
15906
+ function JSXChildForcedCode(ctx, state2) {
15907
+ return (0, import_lib3.$EVENT_C)(ctx, state2, "JSXChildForcedCode", JSXChildForcedCode$$);
15908
+ }
15909
+ var JSXChildForcedNoCode$0 = JSXChildGeneral;
15910
+ var JSXChildForcedNoCode$1 = JSXText;
15911
+ var JSXChildForcedNoCode$$ = [JSXChildForcedNoCode$0, JSXChildForcedNoCode$1];
15912
+ function JSXChildForcedNoCode(ctx, state2) {
15913
+ return (0, import_lib3.$EVENT_C)(ctx, state2, "JSXChildForcedNoCode", JSXChildForcedNoCode$$);
15914
+ }
15915
+ var JSXChildGeneral$0 = JSXElement;
15916
+ var JSXChildGeneral$1 = JSXFragment;
15917
+ var JSXChildGeneral$2 = JSXComment;
15918
+ var JSXChildGeneral$3 = (0, import_lib3.$TS)((0, import_lib3.$S)(OpenBrace, IndentedJSXChildExpression, __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4) {
15863
15919
  var expression = $2;
15864
15920
  return {
15865
15921
  type: "JSXChildExpression",
@@ -15867,7 +15923,7 @@ ${js}`
15867
15923
  expression
15868
15924
  };
15869
15925
  });
15870
- var JSXChild$4 = (0, import_lib3.$TS)((0, import_lib3.$S)(OpenBrace, (0, import_lib3.$E)(JSXChildExpression), __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4) {
15926
+ var JSXChildGeneral$4 = (0, import_lib3.$TS)((0, import_lib3.$S)(OpenBrace, (0, import_lib3.$E)(JSXChildExpression), __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4) {
15871
15927
  var expression = $2;
15872
15928
  return {
15873
15929
  type: "JSXChildExpression",
@@ -15875,7 +15931,7 @@ ${js}`
15875
15931
  expression
15876
15932
  };
15877
15933
  });
15878
- var JSXChild$5 = (0, import_lib3.$TS)((0, import_lib3.$S)(InsertInlineOpenBrace, ArrowFunction, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3) {
15934
+ var JSXChildGeneral$5 = (0, import_lib3.$TS)((0, import_lib3.$S)(InsertInlineOpenBrace, ArrowFunction, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3) {
15879
15935
  var expression = $2;
15880
15936
  return {
15881
15937
  type: "JSXChildExpression",
@@ -15883,11 +15939,10 @@ ${js}`
15883
15939
  expression
15884
15940
  };
15885
15941
  });
15886
- var JSXChild$6 = JSXAngleChild;
15887
- var JSXChild$7 = JSXText;
15888
- var JSXChild$$ = [JSXChild$0, JSXChild$1, JSXChild$2, JSXChild$3, JSXChild$4, JSXChild$5, JSXChild$6, JSXChild$7];
15889
- function JSXChild(ctx, state2) {
15890
- return (0, import_lib3.$EVENT_C)(ctx, state2, "JSXChild", JSXChild$$);
15942
+ var JSXChildGeneral$6 = JSXAngleChild;
15943
+ var JSXChildGeneral$$ = [JSXChildGeneral$0, JSXChildGeneral$1, JSXChildGeneral$2, JSXChildGeneral$3, JSXChildGeneral$4, JSXChildGeneral$5, JSXChildGeneral$6];
15944
+ function JSXChildGeneral(ctx, state2) {
15945
+ return (0, import_lib3.$EVENT_C)(ctx, state2, "JSXChildGeneral", JSXChildGeneral$$);
15891
15946
  }
15892
15947
  var JSXComment$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$EXPECT)($L224, 'JSXComment "<!--"'), JSXCommentContent, (0, import_lib3.$EXPECT)($L225, 'JSXComment "-->"')), function($skip, $loc, $0, $1, $2, $3) {
15893
15948
  return ["{/*", $2, "*/}"];
@@ -15927,24 +15982,30 @@ ${js}`
15927
15982
  function NestedJSXChildExpression(ctx, state2) {
15928
15983
  return (0, import_lib3.$EVENT)(ctx, state2, "NestedJSXChildExpression", NestedJSXChildExpression$0);
15929
15984
  }
15930
- var JSXAngleChild$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(CloseAngleBracket, InsertInlineOpenBrace, JSXAngleChildExpression, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4) {
15931
- var open = $2;
15932
- var expression = $3;
15933
- var close = $4;
15985
+ var JSXAngleChild$0 = (0, import_lib3.$T)((0, import_lib3.$S)(CloseAngleBracket, JSXCodeChild), function(value) {
15986
+ return value[1];
15987
+ });
15988
+ function JSXAngleChild(ctx, state2) {
15989
+ return (0, import_lib3.$EVENT)(ctx, state2, "JSXAngleChild", JSXAngleChild$0);
15990
+ }
15991
+ var JSXCodeChild$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(InsertInlineOpenBrace, JSXCodeChildExpression, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3) {
15992
+ var open = $1;
15993
+ var expression = $2;
15994
+ var close = $3;
15934
15995
  if (!expression)
15935
15996
  return $skip;
15936
15997
  return [open, expression, close];
15937
15998
  });
15938
- function JSXAngleChild(ctx, state2) {
15939
- return (0, import_lib3.$EVENT)(ctx, state2, "JSXAngleChild", JSXAngleChild$0);
15999
+ function JSXCodeChild(ctx, state2) {
16000
+ return (0, import_lib3.$EVENT)(ctx, state2, "JSXCodeChild", JSXCodeChild$0);
15940
16001
  }
15941
- var JSXAngleChildExpression$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$N)(JSXEOS), ForbidNewlineBinaryOp, (0, import_lib3.$E)(JSXChildExpression), RestoreNewlineBinaryOp), function($skip, $loc, $0, $1, $2, $3, $4) {
16002
+ var JSXCodeChildExpression$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$N)(JSXEOS), ForbidNewlineBinaryOp, (0, import_lib3.$E)(JSXChildExpression), RestoreNewlineBinaryOp), function($skip, $loc, $0, $1, $2, $3, $4) {
15942
16003
  var expression = $3;
15943
16004
  if (!expression)
15944
16005
  return $skip;
15945
16006
  return expression;
15946
16007
  });
15947
- var JSXAngleChildExpression$1 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$Y)(JSXEOS), ImplicitNestedBlock), function($skip, $loc, $0, $1, $2) {
16008
+ var JSXCodeChildExpression$1 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$Y)(JSXEOS), ImplicitNestedBlock), function($skip, $loc, $0, $1, $2) {
15948
16009
  var block = $2;
15949
16010
  if (!block)
15950
16011
  return $skip;
@@ -15959,9 +16020,9 @@ ${js}`
15959
16020
  children: [statement]
15960
16021
  };
15961
16022
  });
15962
- var JSXAngleChildExpression$$ = [JSXAngleChildExpression$0, JSXAngleChildExpression$1];
15963
- function JSXAngleChildExpression(ctx, state2) {
15964
- return (0, import_lib3.$EVENT_C)(ctx, state2, "JSXAngleChildExpression", JSXAngleChildExpression$$);
16023
+ var JSXCodeChildExpression$$ = [JSXCodeChildExpression$0, JSXCodeChildExpression$1];
16024
+ function JSXCodeChildExpression(ctx, state2) {
16025
+ return (0, import_lib3.$EVENT_C)(ctx, state2, "JSXCodeChildExpression", JSXCodeChildExpression$$);
15965
16026
  }
15966
16027
  var UsingDeclaration$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(Using, (0, import_lib3.$E)(_), UsingBinding, (0, import_lib3.$Q)((0, import_lib3.$S)(__, Comma, __, UsingBinding)), UsingJSModeError), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
15967
16028
  var decl = $1;
@@ -17187,6 +17248,22 @@ ${js}`
17187
17248
  function CoffeePrototypeEnabled(ctx, state2) {
17188
17249
  return (0, import_lib3.$EVENT)(ctx, state2, "CoffeePrototypeEnabled", CoffeePrototypeEnabled$0);
17189
17250
  }
17251
+ var JSXCodeNestedEnabled$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0, 'JSXCodeNestedEnabled ""'), function($skip, $loc, $0, $1) {
17252
+ if (config.jsxCodeNested)
17253
+ return;
17254
+ return $skip;
17255
+ });
17256
+ function JSXCodeNestedEnabled(ctx, state2) {
17257
+ return (0, import_lib3.$EVENT)(ctx, state2, "JSXCodeNestedEnabled", JSXCodeNestedEnabled$0);
17258
+ }
17259
+ var JSXCodeSameLineEnabled$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0, 'JSXCodeSameLineEnabled ""'), function($skip, $loc, $0, $1) {
17260
+ if (config.jsxCodeSameLine)
17261
+ return;
17262
+ return $skip;
17263
+ });
17264
+ function JSXCodeSameLineEnabled(ctx, state2) {
17265
+ return (0, import_lib3.$EVENT)(ctx, state2, "JSXCodeSameLineEnabled", JSXCodeSameLineEnabled$0);
17266
+ }
17190
17267
  var ObjectIsEnabled$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0, 'ObjectIsEnabled ""'), function($skip, $loc, $0, $1) {
17191
17268
  if (config.objectIs)
17192
17269
  return;
@@ -17230,6 +17307,7 @@ ${js}`
17230
17307
  coffeePrototype: false,
17231
17308
  defaultElement: "div",
17232
17309
  implicitReturns: true,
17310
+ jsxCode: false,
17233
17311
  objectIs: false,
17234
17312
  react: false,
17235
17313
  solid: false,
@@ -17274,6 +17352,16 @@ ${js}`
17274
17352
  }
17275
17353
  }
17276
17354
  });
17355
+ Object.defineProperty(config, "jsxCode", {
17356
+ set(b) {
17357
+ for (const option of [
17358
+ "jsxCodeNested",
17359
+ "jsxCodeSameLine"
17360
+ ]) {
17361
+ config[option] = b;
17362
+ }
17363
+ }
17364
+ });
17277
17365
  Object.assign(config, initialConfig);
17278
17366
  return {
17279
17367
  type: "ParserMeta",
package/dist/main.js CHANGED
@@ -3051,12 +3051,14 @@ function getPatternConditions(pattern, ref, conditions = []) {
3051
3051
  });
3052
3052
  const { blockPrefix } = pattern;
3053
3053
  if (blockPrefix) {
3054
- const postElements = blockPrefix.children[1], { length: postLength } = postElements;
3054
+ const postElements = blockPrefix.children[1];
3055
+ const { length: postLength } = postElements;
3055
3056
  postElements.forEach(({ children: [, e] }, i) => {
3056
3057
  const subRef = [ref, "[", ref, ".length - ", (postLength + i).toString(), "]"];
3057
3058
  return getPatternConditions(e, subRef, conditions);
3058
3059
  });
3059
3060
  }
3061
+ ;
3060
3062
  break;
3061
3063
  }
3062
3064
  case "ObjectBindingPattern": {
@@ -3064,34 +3066,46 @@ function getPatternConditions(pattern, ref, conditions = []) {
3064
3066
  ["typeof ", ref, " === 'object'"],
3065
3067
  [ref, " != null"]
3066
3068
  );
3067
- pattern.properties.forEach((p) => {
3069
+ for (let ref1 = pattern.properties, i4 = 0, len3 = ref1.length; i4 < len3; i4++) {
3070
+ const p = ref1[i4];
3068
3071
  switch (p.type) {
3069
3072
  case "PinProperty":
3070
3073
  case "BindingProperty": {
3071
3074
  const { name, value } = p;
3072
3075
  let subRef;
3073
3076
  switch (name.type) {
3074
- case "ComputedPropertyName":
3077
+ case "ComputedPropertyName": {
3075
3078
  conditions.push([name.expression, " in ", ref]);
3076
3079
  subRef = [ref, name];
3077
3080
  break;
3081
+ }
3078
3082
  case "Literal":
3079
3083
  case "StringLiteral":
3080
- case "NumericLiteral":
3084
+ case "NumericLiteral": {
3081
3085
  conditions.push([name, " in ", ref]);
3082
3086
  subRef = [ref, "[", name, "]"];
3083
3087
  break;
3084
- default:
3085
- conditions.push(["'", name, "' in ", ref]);
3086
- subRef = [ref, ".", name];
3088
+ }
3089
+ case "Identifier": {
3090
+ conditions.push(["'", name.name, "' in ", ref]);
3091
+ subRef = [ref, ".", name.name];
3092
+ break;
3093
+ }
3094
+ case "AtBinding": {
3095
+ conditions.push(["'", name.ref.id, "' in ", ref]);
3096
+ subRef = [ref, ".", name.ref.id];
3097
+ break;
3098
+ }
3087
3099
  }
3088
3100
  if (value) {
3089
3101
  getPatternConditions(value, subRef, conditions);
3090
3102
  }
3103
+ ;
3091
3104
  break;
3092
3105
  }
3093
3106
  }
3094
- });
3107
+ }
3108
+ ;
3095
3109
  break;
3096
3110
  }
3097
3111
  case "ConditionFragment": {
@@ -3115,22 +3129,22 @@ function getPatternConditions(pattern, ref, conditions = []) {
3115
3129
  );
3116
3130
  break;
3117
3131
  }
3118
- case "PinPattern":
3132
+ case "PinPattern": {
3119
3133
  conditions.push([
3120
3134
  ref,
3121
3135
  " === ",
3122
3136
  pattern.expression
3123
3137
  ]);
3124
3138
  break;
3125
- case "Literal":
3139
+ }
3140
+ case "Literal": {
3126
3141
  conditions.push([
3127
3142
  ref,
3128
3143
  " === ",
3129
3144
  pattern
3130
3145
  ]);
3131
3146
  break;
3132
- default:
3133
- break;
3147
+ }
3134
3148
  }
3135
3149
  return conditions;
3136
3150
  }
@@ -7076,11 +7090,15 @@ var grammar = {
7076
7090
  InlineJSXMemberExpressionRest,
7077
7091
  InlineJSXPrimaryExpression,
7078
7092
  JSXMixedChildren,
7093
+ JSXSameLineChildren,
7079
7094
  JSXChildren,
7080
7095
  JSXNestedChildren,
7081
7096
  JSXEOS,
7082
7097
  JSXNested,
7083
7098
  JSXChild,
7099
+ JSXChildForcedCode,
7100
+ JSXChildForcedNoCode,
7101
+ JSXChildGeneral,
7084
7102
  JSXComment,
7085
7103
  JSXCommentContent,
7086
7104
  JSXText,
@@ -7088,7 +7106,8 @@ var grammar = {
7088
7106
  IndentedJSXChildExpression,
7089
7107
  NestedJSXChildExpression,
7090
7108
  JSXAngleChild,
7091
- JSXAngleChildExpression,
7109
+ JSXCodeChild,
7110
+ JSXCodeChildExpression,
7092
7111
  UsingDeclaration,
7093
7112
  UsingBinding,
7094
7113
  UsingJSModeError,
@@ -7221,6 +7240,8 @@ var grammar = {
7221
7240
  CoffeeNotEnabled,
7222
7241
  CoffeeOfEnabled,
7223
7242
  CoffeePrototypeEnabled,
7243
+ JSXCodeNestedEnabled,
7244
+ JSXCodeSameLineEnabled,
7224
7245
  ObjectIsEnabled,
7225
7246
  Reset,
7226
7247
  Init,
@@ -15782,7 +15803,7 @@ var InlineJSXPrimaryExpression$$ = [InlineJSXPrimaryExpression$0, InlineJSXPrima
15782
15803
  function InlineJSXPrimaryExpression(ctx, state2) {
15783
15804
  return (0, import_lib3.$EVENT_C)(ctx, state2, "InlineJSXPrimaryExpression", InlineJSXPrimaryExpression$$);
15784
15805
  }
15785
- var JSXMixedChildren$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$Q)(JSXChild), JSXNestedChildren), function($skip, $loc, $0, $1, $2) {
15806
+ var JSXMixedChildren$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(JSXSameLineChildren, JSXNestedChildren), function($skip, $loc, $0, $1, $2) {
15786
15807
  var c1 = $1;
15787
15808
  var c2 = $2;
15788
15809
  return {
@@ -15793,6 +15814,18 @@ var JSXMixedChildren$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib
15793
15814
  function JSXMixedChildren(ctx, state2) {
15794
15815
  return (0, import_lib3.$EVENT)(ctx, state2, "JSXMixedChildren", JSXMixedChildren$0);
15795
15816
  }
15817
+ var JSXSameLineChildren$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(JSXCodeSameLineEnabled, (0, import_lib3.$Q)((0, import_lib3.$S)((0, import_lib3.$E)(NonNewlineWhitespace), (0, import_lib3.$N)(EOL), JSXChildForcedCode))), function($skip, $loc, $0, $1, $2) {
15818
+ var children = $2;
15819
+ return children.map(([, , c]) => c);
15820
+ });
15821
+ var JSXSameLineChildren$1 = (0, import_lib3.$T)((0, import_lib3.$S)((0, import_lib3.$N)(JSXCodeSameLineEnabled), (0, import_lib3.$Q)(JSXChildForcedNoCode)), function(value) {
15822
+ var children = value[1];
15823
+ return children;
15824
+ });
15825
+ var JSXSameLineChildren$$ = [JSXSameLineChildren$0, JSXSameLineChildren$1];
15826
+ function JSXSameLineChildren(ctx, state2) {
15827
+ return (0, import_lib3.$EVENT_C)(ctx, state2, "JSXSameLineChildren", JSXSameLineChildren$$);
15828
+ }
15796
15829
  var JSXChildren$0 = (0, import_lib3.$TV)((0, import_lib3.$Q)((0, import_lib3.$S)((0, import_lib3.$Q)((0, import_lib3.$S)((0, import_lib3.$E)(NonNewlineWhitespace), EOL, (0, import_lib3.$E)(NonNewlineWhitespace))), JSXChild)), function($skip, $loc, $0, $1) {
15797
15830
  return {
15798
15831
  children: $1,
@@ -15834,10 +15867,33 @@ var JSXNested$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(JSXEOS, Indent), func
15834
15867
  function JSXNested(ctx, state2) {
15835
15868
  return (0, import_lib3.$EVENT)(ctx, state2, "JSXNested", JSXNested$0);
15836
15869
  }
15837
- var JSXChild$0 = JSXElement;
15838
- var JSXChild$1 = JSXFragment;
15839
- var JSXChild$2 = JSXComment;
15840
- var JSXChild$3 = (0, import_lib3.$TS)((0, import_lib3.$S)(OpenBrace, IndentedJSXChildExpression, __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4) {
15870
+ var JSXChild$0 = JSXChildGeneral;
15871
+ var JSXChild$1 = (0, import_lib3.$T)((0, import_lib3.$S)(JSXCodeNestedEnabled, JSXCodeChild), function(value) {
15872
+ return value[1];
15873
+ });
15874
+ var JSXChild$2 = (0, import_lib3.$T)((0, import_lib3.$S)((0, import_lib3.$N)(JSXCodeNestedEnabled), JSXText), function(value) {
15875
+ return value[1];
15876
+ });
15877
+ var JSXChild$$ = [JSXChild$0, JSXChild$1, JSXChild$2];
15878
+ function JSXChild(ctx, state2) {
15879
+ return (0, import_lib3.$EVENT_C)(ctx, state2, "JSXChild", JSXChild$$);
15880
+ }
15881
+ var JSXChildForcedCode$0 = JSXChildGeneral;
15882
+ var JSXChildForcedCode$1 = JSXCodeChild;
15883
+ var JSXChildForcedCode$$ = [JSXChildForcedCode$0, JSXChildForcedCode$1];
15884
+ function JSXChildForcedCode(ctx, state2) {
15885
+ return (0, import_lib3.$EVENT_C)(ctx, state2, "JSXChildForcedCode", JSXChildForcedCode$$);
15886
+ }
15887
+ var JSXChildForcedNoCode$0 = JSXChildGeneral;
15888
+ var JSXChildForcedNoCode$1 = JSXText;
15889
+ var JSXChildForcedNoCode$$ = [JSXChildForcedNoCode$0, JSXChildForcedNoCode$1];
15890
+ function JSXChildForcedNoCode(ctx, state2) {
15891
+ return (0, import_lib3.$EVENT_C)(ctx, state2, "JSXChildForcedNoCode", JSXChildForcedNoCode$$);
15892
+ }
15893
+ var JSXChildGeneral$0 = JSXElement;
15894
+ var JSXChildGeneral$1 = JSXFragment;
15895
+ var JSXChildGeneral$2 = JSXComment;
15896
+ var JSXChildGeneral$3 = (0, import_lib3.$TS)((0, import_lib3.$S)(OpenBrace, IndentedJSXChildExpression, __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4) {
15841
15897
  var expression = $2;
15842
15898
  return {
15843
15899
  type: "JSXChildExpression",
@@ -15845,7 +15901,7 @@ var JSXChild$3 = (0, import_lib3.$TS)((0, import_lib3.$S)(OpenBrace, IndentedJSX
15845
15901
  expression
15846
15902
  };
15847
15903
  });
15848
- var JSXChild$4 = (0, import_lib3.$TS)((0, import_lib3.$S)(OpenBrace, (0, import_lib3.$E)(JSXChildExpression), __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4) {
15904
+ var JSXChildGeneral$4 = (0, import_lib3.$TS)((0, import_lib3.$S)(OpenBrace, (0, import_lib3.$E)(JSXChildExpression), __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4) {
15849
15905
  var expression = $2;
15850
15906
  return {
15851
15907
  type: "JSXChildExpression",
@@ -15853,7 +15909,7 @@ var JSXChild$4 = (0, import_lib3.$TS)((0, import_lib3.$S)(OpenBrace, (0, import_
15853
15909
  expression
15854
15910
  };
15855
15911
  });
15856
- var JSXChild$5 = (0, import_lib3.$TS)((0, import_lib3.$S)(InsertInlineOpenBrace, ArrowFunction, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3) {
15912
+ var JSXChildGeneral$5 = (0, import_lib3.$TS)((0, import_lib3.$S)(InsertInlineOpenBrace, ArrowFunction, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3) {
15857
15913
  var expression = $2;
15858
15914
  return {
15859
15915
  type: "JSXChildExpression",
@@ -15861,11 +15917,10 @@ var JSXChild$5 = (0, import_lib3.$TS)((0, import_lib3.$S)(InsertInlineOpenBrace,
15861
15917
  expression
15862
15918
  };
15863
15919
  });
15864
- var JSXChild$6 = JSXAngleChild;
15865
- var JSXChild$7 = JSXText;
15866
- var JSXChild$$ = [JSXChild$0, JSXChild$1, JSXChild$2, JSXChild$3, JSXChild$4, JSXChild$5, JSXChild$6, JSXChild$7];
15867
- function JSXChild(ctx, state2) {
15868
- return (0, import_lib3.$EVENT_C)(ctx, state2, "JSXChild", JSXChild$$);
15920
+ var JSXChildGeneral$6 = JSXAngleChild;
15921
+ var JSXChildGeneral$$ = [JSXChildGeneral$0, JSXChildGeneral$1, JSXChildGeneral$2, JSXChildGeneral$3, JSXChildGeneral$4, JSXChildGeneral$5, JSXChildGeneral$6];
15922
+ function JSXChildGeneral(ctx, state2) {
15923
+ return (0, import_lib3.$EVENT_C)(ctx, state2, "JSXChildGeneral", JSXChildGeneral$$);
15869
15924
  }
15870
15925
  var JSXComment$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$EXPECT)($L224, 'JSXComment "<!--"'), JSXCommentContent, (0, import_lib3.$EXPECT)($L225, 'JSXComment "-->"')), function($skip, $loc, $0, $1, $2, $3) {
15871
15926
  return ["{/*", $2, "*/}"];
@@ -15905,24 +15960,30 @@ var NestedJSXChildExpression$0 = (0, import_lib3.$S)(JSXNested, JSXChildExpressi
15905
15960
  function NestedJSXChildExpression(ctx, state2) {
15906
15961
  return (0, import_lib3.$EVENT)(ctx, state2, "NestedJSXChildExpression", NestedJSXChildExpression$0);
15907
15962
  }
15908
- var JSXAngleChild$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(CloseAngleBracket, InsertInlineOpenBrace, JSXAngleChildExpression, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4) {
15909
- var open = $2;
15910
- var expression = $3;
15911
- var close = $4;
15963
+ var JSXAngleChild$0 = (0, import_lib3.$T)((0, import_lib3.$S)(CloseAngleBracket, JSXCodeChild), function(value) {
15964
+ return value[1];
15965
+ });
15966
+ function JSXAngleChild(ctx, state2) {
15967
+ return (0, import_lib3.$EVENT)(ctx, state2, "JSXAngleChild", JSXAngleChild$0);
15968
+ }
15969
+ var JSXCodeChild$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(InsertInlineOpenBrace, JSXCodeChildExpression, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3) {
15970
+ var open = $1;
15971
+ var expression = $2;
15972
+ var close = $3;
15912
15973
  if (!expression)
15913
15974
  return $skip;
15914
15975
  return [open, expression, close];
15915
15976
  });
15916
- function JSXAngleChild(ctx, state2) {
15917
- return (0, import_lib3.$EVENT)(ctx, state2, "JSXAngleChild", JSXAngleChild$0);
15977
+ function JSXCodeChild(ctx, state2) {
15978
+ return (0, import_lib3.$EVENT)(ctx, state2, "JSXCodeChild", JSXCodeChild$0);
15918
15979
  }
15919
- var JSXAngleChildExpression$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$N)(JSXEOS), ForbidNewlineBinaryOp, (0, import_lib3.$E)(JSXChildExpression), RestoreNewlineBinaryOp), function($skip, $loc, $0, $1, $2, $3, $4) {
15980
+ var JSXCodeChildExpression$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$N)(JSXEOS), ForbidNewlineBinaryOp, (0, import_lib3.$E)(JSXChildExpression), RestoreNewlineBinaryOp), function($skip, $loc, $0, $1, $2, $3, $4) {
15920
15981
  var expression = $3;
15921
15982
  if (!expression)
15922
15983
  return $skip;
15923
15984
  return expression;
15924
15985
  });
15925
- var JSXAngleChildExpression$1 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$Y)(JSXEOS), ImplicitNestedBlock), function($skip, $loc, $0, $1, $2) {
15986
+ var JSXCodeChildExpression$1 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$Y)(JSXEOS), ImplicitNestedBlock), function($skip, $loc, $0, $1, $2) {
15926
15987
  var block = $2;
15927
15988
  if (!block)
15928
15989
  return $skip;
@@ -15937,9 +15998,9 @@ var JSXAngleChildExpression$1 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, imp
15937
15998
  children: [statement]
15938
15999
  };
15939
16000
  });
15940
- var JSXAngleChildExpression$$ = [JSXAngleChildExpression$0, JSXAngleChildExpression$1];
15941
- function JSXAngleChildExpression(ctx, state2) {
15942
- return (0, import_lib3.$EVENT_C)(ctx, state2, "JSXAngleChildExpression", JSXAngleChildExpression$$);
16001
+ var JSXCodeChildExpression$$ = [JSXCodeChildExpression$0, JSXCodeChildExpression$1];
16002
+ function JSXCodeChildExpression(ctx, state2) {
16003
+ return (0, import_lib3.$EVENT_C)(ctx, state2, "JSXCodeChildExpression", JSXCodeChildExpression$$);
15943
16004
  }
15944
16005
  var UsingDeclaration$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(Using, (0, import_lib3.$E)(_), UsingBinding, (0, import_lib3.$Q)((0, import_lib3.$S)(__, Comma, __, UsingBinding)), UsingJSModeError), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
15945
16006
  var decl = $1;
@@ -17165,6 +17226,22 @@ var CoffeePrototypeEnabled$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0
17165
17226
  function CoffeePrototypeEnabled(ctx, state2) {
17166
17227
  return (0, import_lib3.$EVENT)(ctx, state2, "CoffeePrototypeEnabled", CoffeePrototypeEnabled$0);
17167
17228
  }
17229
+ var JSXCodeNestedEnabled$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0, 'JSXCodeNestedEnabled ""'), function($skip, $loc, $0, $1) {
17230
+ if (config.jsxCodeNested)
17231
+ return;
17232
+ return $skip;
17233
+ });
17234
+ function JSXCodeNestedEnabled(ctx, state2) {
17235
+ return (0, import_lib3.$EVENT)(ctx, state2, "JSXCodeNestedEnabled", JSXCodeNestedEnabled$0);
17236
+ }
17237
+ var JSXCodeSameLineEnabled$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0, 'JSXCodeSameLineEnabled ""'), function($skip, $loc, $0, $1) {
17238
+ if (config.jsxCodeSameLine)
17239
+ return;
17240
+ return $skip;
17241
+ });
17242
+ function JSXCodeSameLineEnabled(ctx, state2) {
17243
+ return (0, import_lib3.$EVENT)(ctx, state2, "JSXCodeSameLineEnabled", JSXCodeSameLineEnabled$0);
17244
+ }
17168
17245
  var ObjectIsEnabled$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0, 'ObjectIsEnabled ""'), function($skip, $loc, $0, $1) {
17169
17246
  if (config.objectIs)
17170
17247
  return;
@@ -17208,6 +17285,7 @@ var Reset$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0, 'Reset ""'), fu
17208
17285
  coffeePrototype: false,
17209
17286
  defaultElement: "div",
17210
17287
  implicitReturns: true,
17288
+ jsxCode: false,
17211
17289
  objectIs: false,
17212
17290
  react: false,
17213
17291
  solid: false,
@@ -17252,6 +17330,16 @@ var Reset$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0, 'Reset ""'), fu
17252
17330
  }
17253
17331
  }
17254
17332
  });
17333
+ Object.defineProperty(config, "jsxCode", {
17334
+ set(b) {
17335
+ for (const option of [
17336
+ "jsxCodeNested",
17337
+ "jsxCodeSameLine"
17338
+ ]) {
17339
+ config[option] = b;
17340
+ }
17341
+ }
17342
+ });
17255
17343
  Object.assign(config, initialConfig);
17256
17344
  return {
17257
17345
  type: "ParserMeta",
package/dist/main.mjs CHANGED
@@ -3031,12 +3031,14 @@ function getPatternConditions(pattern, ref, conditions = []) {
3031
3031
  });
3032
3032
  const { blockPrefix } = pattern;
3033
3033
  if (blockPrefix) {
3034
- const postElements = blockPrefix.children[1], { length: postLength } = postElements;
3034
+ const postElements = blockPrefix.children[1];
3035
+ const { length: postLength } = postElements;
3035
3036
  postElements.forEach(({ children: [, e] }, i) => {
3036
3037
  const subRef = [ref, "[", ref, ".length - ", (postLength + i).toString(), "]"];
3037
3038
  return getPatternConditions(e, subRef, conditions);
3038
3039
  });
3039
3040
  }
3041
+ ;
3040
3042
  break;
3041
3043
  }
3042
3044
  case "ObjectBindingPattern": {
@@ -3044,34 +3046,46 @@ function getPatternConditions(pattern, ref, conditions = []) {
3044
3046
  ["typeof ", ref, " === 'object'"],
3045
3047
  [ref, " != null"]
3046
3048
  );
3047
- pattern.properties.forEach((p) => {
3049
+ for (let ref1 = pattern.properties, i4 = 0, len3 = ref1.length; i4 < len3; i4++) {
3050
+ const p = ref1[i4];
3048
3051
  switch (p.type) {
3049
3052
  case "PinProperty":
3050
3053
  case "BindingProperty": {
3051
3054
  const { name, value } = p;
3052
3055
  let subRef;
3053
3056
  switch (name.type) {
3054
- case "ComputedPropertyName":
3057
+ case "ComputedPropertyName": {
3055
3058
  conditions.push([name.expression, " in ", ref]);
3056
3059
  subRef = [ref, name];
3057
3060
  break;
3061
+ }
3058
3062
  case "Literal":
3059
3063
  case "StringLiteral":
3060
- case "NumericLiteral":
3064
+ case "NumericLiteral": {
3061
3065
  conditions.push([name, " in ", ref]);
3062
3066
  subRef = [ref, "[", name, "]"];
3063
3067
  break;
3064
- default:
3065
- conditions.push(["'", name, "' in ", ref]);
3066
- subRef = [ref, ".", name];
3068
+ }
3069
+ case "Identifier": {
3070
+ conditions.push(["'", name.name, "' in ", ref]);
3071
+ subRef = [ref, ".", name.name];
3072
+ break;
3073
+ }
3074
+ case "AtBinding": {
3075
+ conditions.push(["'", name.ref.id, "' in ", ref]);
3076
+ subRef = [ref, ".", name.ref.id];
3077
+ break;
3078
+ }
3067
3079
  }
3068
3080
  if (value) {
3069
3081
  getPatternConditions(value, subRef, conditions);
3070
3082
  }
3083
+ ;
3071
3084
  break;
3072
3085
  }
3073
3086
  }
3074
- });
3087
+ }
3088
+ ;
3075
3089
  break;
3076
3090
  }
3077
3091
  case "ConditionFragment": {
@@ -3095,22 +3109,22 @@ function getPatternConditions(pattern, ref, conditions = []) {
3095
3109
  );
3096
3110
  break;
3097
3111
  }
3098
- case "PinPattern":
3112
+ case "PinPattern": {
3099
3113
  conditions.push([
3100
3114
  ref,
3101
3115
  " === ",
3102
3116
  pattern.expression
3103
3117
  ]);
3104
3118
  break;
3105
- case "Literal":
3119
+ }
3120
+ case "Literal": {
3106
3121
  conditions.push([
3107
3122
  ref,
3108
3123
  " === ",
3109
3124
  pattern
3110
3125
  ]);
3111
3126
  break;
3112
- default:
3113
- break;
3127
+ }
3114
3128
  }
3115
3129
  return conditions;
3116
3130
  }
@@ -7056,11 +7070,15 @@ var grammar = {
7056
7070
  InlineJSXMemberExpressionRest,
7057
7071
  InlineJSXPrimaryExpression,
7058
7072
  JSXMixedChildren,
7073
+ JSXSameLineChildren,
7059
7074
  JSXChildren,
7060
7075
  JSXNestedChildren,
7061
7076
  JSXEOS,
7062
7077
  JSXNested,
7063
7078
  JSXChild,
7079
+ JSXChildForcedCode,
7080
+ JSXChildForcedNoCode,
7081
+ JSXChildGeneral,
7064
7082
  JSXComment,
7065
7083
  JSXCommentContent,
7066
7084
  JSXText,
@@ -7068,7 +7086,8 @@ var grammar = {
7068
7086
  IndentedJSXChildExpression,
7069
7087
  NestedJSXChildExpression,
7070
7088
  JSXAngleChild,
7071
- JSXAngleChildExpression,
7089
+ JSXCodeChild,
7090
+ JSXCodeChildExpression,
7072
7091
  UsingDeclaration,
7073
7092
  UsingBinding,
7074
7093
  UsingJSModeError,
@@ -7201,6 +7220,8 @@ var grammar = {
7201
7220
  CoffeeNotEnabled,
7202
7221
  CoffeeOfEnabled,
7203
7222
  CoffeePrototypeEnabled,
7223
+ JSXCodeNestedEnabled,
7224
+ JSXCodeSameLineEnabled,
7204
7225
  ObjectIsEnabled,
7205
7226
  Reset,
7206
7227
  Init,
@@ -15762,7 +15783,7 @@ var InlineJSXPrimaryExpression$$ = [InlineJSXPrimaryExpression$0, InlineJSXPrima
15762
15783
  function InlineJSXPrimaryExpression(ctx, state2) {
15763
15784
  return (0, import_lib3.$EVENT_C)(ctx, state2, "InlineJSXPrimaryExpression", InlineJSXPrimaryExpression$$);
15764
15785
  }
15765
- var JSXMixedChildren$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$Q)(JSXChild), JSXNestedChildren), function($skip, $loc, $0, $1, $2) {
15786
+ var JSXMixedChildren$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(JSXSameLineChildren, JSXNestedChildren), function($skip, $loc, $0, $1, $2) {
15766
15787
  var c1 = $1;
15767
15788
  var c2 = $2;
15768
15789
  return {
@@ -15773,6 +15794,18 @@ var JSXMixedChildren$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib
15773
15794
  function JSXMixedChildren(ctx, state2) {
15774
15795
  return (0, import_lib3.$EVENT)(ctx, state2, "JSXMixedChildren", JSXMixedChildren$0);
15775
15796
  }
15797
+ var JSXSameLineChildren$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(JSXCodeSameLineEnabled, (0, import_lib3.$Q)((0, import_lib3.$S)((0, import_lib3.$E)(NonNewlineWhitespace), (0, import_lib3.$N)(EOL), JSXChildForcedCode))), function($skip, $loc, $0, $1, $2) {
15798
+ var children = $2;
15799
+ return children.map(([, , c]) => c);
15800
+ });
15801
+ var JSXSameLineChildren$1 = (0, import_lib3.$T)((0, import_lib3.$S)((0, import_lib3.$N)(JSXCodeSameLineEnabled), (0, import_lib3.$Q)(JSXChildForcedNoCode)), function(value) {
15802
+ var children = value[1];
15803
+ return children;
15804
+ });
15805
+ var JSXSameLineChildren$$ = [JSXSameLineChildren$0, JSXSameLineChildren$1];
15806
+ function JSXSameLineChildren(ctx, state2) {
15807
+ return (0, import_lib3.$EVENT_C)(ctx, state2, "JSXSameLineChildren", JSXSameLineChildren$$);
15808
+ }
15776
15809
  var JSXChildren$0 = (0, import_lib3.$TV)((0, import_lib3.$Q)((0, import_lib3.$S)((0, import_lib3.$Q)((0, import_lib3.$S)((0, import_lib3.$E)(NonNewlineWhitespace), EOL, (0, import_lib3.$E)(NonNewlineWhitespace))), JSXChild)), function($skip, $loc, $0, $1) {
15777
15810
  return {
15778
15811
  children: $1,
@@ -15814,10 +15847,33 @@ var JSXNested$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(JSXEOS, Indent), func
15814
15847
  function JSXNested(ctx, state2) {
15815
15848
  return (0, import_lib3.$EVENT)(ctx, state2, "JSXNested", JSXNested$0);
15816
15849
  }
15817
- var JSXChild$0 = JSXElement;
15818
- var JSXChild$1 = JSXFragment;
15819
- var JSXChild$2 = JSXComment;
15820
- var JSXChild$3 = (0, import_lib3.$TS)((0, import_lib3.$S)(OpenBrace, IndentedJSXChildExpression, __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4) {
15850
+ var JSXChild$0 = JSXChildGeneral;
15851
+ var JSXChild$1 = (0, import_lib3.$T)((0, import_lib3.$S)(JSXCodeNestedEnabled, JSXCodeChild), function(value) {
15852
+ return value[1];
15853
+ });
15854
+ var JSXChild$2 = (0, import_lib3.$T)((0, import_lib3.$S)((0, import_lib3.$N)(JSXCodeNestedEnabled), JSXText), function(value) {
15855
+ return value[1];
15856
+ });
15857
+ var JSXChild$$ = [JSXChild$0, JSXChild$1, JSXChild$2];
15858
+ function JSXChild(ctx, state2) {
15859
+ return (0, import_lib3.$EVENT_C)(ctx, state2, "JSXChild", JSXChild$$);
15860
+ }
15861
+ var JSXChildForcedCode$0 = JSXChildGeneral;
15862
+ var JSXChildForcedCode$1 = JSXCodeChild;
15863
+ var JSXChildForcedCode$$ = [JSXChildForcedCode$0, JSXChildForcedCode$1];
15864
+ function JSXChildForcedCode(ctx, state2) {
15865
+ return (0, import_lib3.$EVENT_C)(ctx, state2, "JSXChildForcedCode", JSXChildForcedCode$$);
15866
+ }
15867
+ var JSXChildForcedNoCode$0 = JSXChildGeneral;
15868
+ var JSXChildForcedNoCode$1 = JSXText;
15869
+ var JSXChildForcedNoCode$$ = [JSXChildForcedNoCode$0, JSXChildForcedNoCode$1];
15870
+ function JSXChildForcedNoCode(ctx, state2) {
15871
+ return (0, import_lib3.$EVENT_C)(ctx, state2, "JSXChildForcedNoCode", JSXChildForcedNoCode$$);
15872
+ }
15873
+ var JSXChildGeneral$0 = JSXElement;
15874
+ var JSXChildGeneral$1 = JSXFragment;
15875
+ var JSXChildGeneral$2 = JSXComment;
15876
+ var JSXChildGeneral$3 = (0, import_lib3.$TS)((0, import_lib3.$S)(OpenBrace, IndentedJSXChildExpression, __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4) {
15821
15877
  var expression = $2;
15822
15878
  return {
15823
15879
  type: "JSXChildExpression",
@@ -15825,7 +15881,7 @@ var JSXChild$3 = (0, import_lib3.$TS)((0, import_lib3.$S)(OpenBrace, IndentedJSX
15825
15881
  expression
15826
15882
  };
15827
15883
  });
15828
- var JSXChild$4 = (0, import_lib3.$TS)((0, import_lib3.$S)(OpenBrace, (0, import_lib3.$E)(JSXChildExpression), __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4) {
15884
+ var JSXChildGeneral$4 = (0, import_lib3.$TS)((0, import_lib3.$S)(OpenBrace, (0, import_lib3.$E)(JSXChildExpression), __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4) {
15829
15885
  var expression = $2;
15830
15886
  return {
15831
15887
  type: "JSXChildExpression",
@@ -15833,7 +15889,7 @@ var JSXChild$4 = (0, import_lib3.$TS)((0, import_lib3.$S)(OpenBrace, (0, import_
15833
15889
  expression
15834
15890
  };
15835
15891
  });
15836
- var JSXChild$5 = (0, import_lib3.$TS)((0, import_lib3.$S)(InsertInlineOpenBrace, ArrowFunction, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3) {
15892
+ var JSXChildGeneral$5 = (0, import_lib3.$TS)((0, import_lib3.$S)(InsertInlineOpenBrace, ArrowFunction, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3) {
15837
15893
  var expression = $2;
15838
15894
  return {
15839
15895
  type: "JSXChildExpression",
@@ -15841,11 +15897,10 @@ var JSXChild$5 = (0, import_lib3.$TS)((0, import_lib3.$S)(InsertInlineOpenBrace,
15841
15897
  expression
15842
15898
  };
15843
15899
  });
15844
- var JSXChild$6 = JSXAngleChild;
15845
- var JSXChild$7 = JSXText;
15846
- var JSXChild$$ = [JSXChild$0, JSXChild$1, JSXChild$2, JSXChild$3, JSXChild$4, JSXChild$5, JSXChild$6, JSXChild$7];
15847
- function JSXChild(ctx, state2) {
15848
- return (0, import_lib3.$EVENT_C)(ctx, state2, "JSXChild", JSXChild$$);
15900
+ var JSXChildGeneral$6 = JSXAngleChild;
15901
+ var JSXChildGeneral$$ = [JSXChildGeneral$0, JSXChildGeneral$1, JSXChildGeneral$2, JSXChildGeneral$3, JSXChildGeneral$4, JSXChildGeneral$5, JSXChildGeneral$6];
15902
+ function JSXChildGeneral(ctx, state2) {
15903
+ return (0, import_lib3.$EVENT_C)(ctx, state2, "JSXChildGeneral", JSXChildGeneral$$);
15849
15904
  }
15850
15905
  var JSXComment$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$EXPECT)($L224, 'JSXComment "<!--"'), JSXCommentContent, (0, import_lib3.$EXPECT)($L225, 'JSXComment "-->"')), function($skip, $loc, $0, $1, $2, $3) {
15851
15906
  return ["{/*", $2, "*/}"];
@@ -15885,24 +15940,30 @@ var NestedJSXChildExpression$0 = (0, import_lib3.$S)(JSXNested, JSXChildExpressi
15885
15940
  function NestedJSXChildExpression(ctx, state2) {
15886
15941
  return (0, import_lib3.$EVENT)(ctx, state2, "NestedJSXChildExpression", NestedJSXChildExpression$0);
15887
15942
  }
15888
- var JSXAngleChild$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(CloseAngleBracket, InsertInlineOpenBrace, JSXAngleChildExpression, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4) {
15889
- var open = $2;
15890
- var expression = $3;
15891
- var close = $4;
15943
+ var JSXAngleChild$0 = (0, import_lib3.$T)((0, import_lib3.$S)(CloseAngleBracket, JSXCodeChild), function(value) {
15944
+ return value[1];
15945
+ });
15946
+ function JSXAngleChild(ctx, state2) {
15947
+ return (0, import_lib3.$EVENT)(ctx, state2, "JSXAngleChild", JSXAngleChild$0);
15948
+ }
15949
+ var JSXCodeChild$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(InsertInlineOpenBrace, JSXCodeChildExpression, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3) {
15950
+ var open = $1;
15951
+ var expression = $2;
15952
+ var close = $3;
15892
15953
  if (!expression)
15893
15954
  return $skip;
15894
15955
  return [open, expression, close];
15895
15956
  });
15896
- function JSXAngleChild(ctx, state2) {
15897
- return (0, import_lib3.$EVENT)(ctx, state2, "JSXAngleChild", JSXAngleChild$0);
15957
+ function JSXCodeChild(ctx, state2) {
15958
+ return (0, import_lib3.$EVENT)(ctx, state2, "JSXCodeChild", JSXCodeChild$0);
15898
15959
  }
15899
- var JSXAngleChildExpression$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$N)(JSXEOS), ForbidNewlineBinaryOp, (0, import_lib3.$E)(JSXChildExpression), RestoreNewlineBinaryOp), function($skip, $loc, $0, $1, $2, $3, $4) {
15960
+ var JSXCodeChildExpression$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$N)(JSXEOS), ForbidNewlineBinaryOp, (0, import_lib3.$E)(JSXChildExpression), RestoreNewlineBinaryOp), function($skip, $loc, $0, $1, $2, $3, $4) {
15900
15961
  var expression = $3;
15901
15962
  if (!expression)
15902
15963
  return $skip;
15903
15964
  return expression;
15904
15965
  });
15905
- var JSXAngleChildExpression$1 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$Y)(JSXEOS), ImplicitNestedBlock), function($skip, $loc, $0, $1, $2) {
15966
+ var JSXCodeChildExpression$1 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$Y)(JSXEOS), ImplicitNestedBlock), function($skip, $loc, $0, $1, $2) {
15906
15967
  var block = $2;
15907
15968
  if (!block)
15908
15969
  return $skip;
@@ -15917,9 +15978,9 @@ var JSXAngleChildExpression$1 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, imp
15917
15978
  children: [statement]
15918
15979
  };
15919
15980
  });
15920
- var JSXAngleChildExpression$$ = [JSXAngleChildExpression$0, JSXAngleChildExpression$1];
15921
- function JSXAngleChildExpression(ctx, state2) {
15922
- return (0, import_lib3.$EVENT_C)(ctx, state2, "JSXAngleChildExpression", JSXAngleChildExpression$$);
15981
+ var JSXCodeChildExpression$$ = [JSXCodeChildExpression$0, JSXCodeChildExpression$1];
15982
+ function JSXCodeChildExpression(ctx, state2) {
15983
+ return (0, import_lib3.$EVENT_C)(ctx, state2, "JSXCodeChildExpression", JSXCodeChildExpression$$);
15923
15984
  }
15924
15985
  var UsingDeclaration$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(Using, (0, import_lib3.$E)(_), UsingBinding, (0, import_lib3.$Q)((0, import_lib3.$S)(__, Comma, __, UsingBinding)), UsingJSModeError), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
15925
15986
  var decl = $1;
@@ -17145,6 +17206,22 @@ var CoffeePrototypeEnabled$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0
17145
17206
  function CoffeePrototypeEnabled(ctx, state2) {
17146
17207
  return (0, import_lib3.$EVENT)(ctx, state2, "CoffeePrototypeEnabled", CoffeePrototypeEnabled$0);
17147
17208
  }
17209
+ var JSXCodeNestedEnabled$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0, 'JSXCodeNestedEnabled ""'), function($skip, $loc, $0, $1) {
17210
+ if (config.jsxCodeNested)
17211
+ return;
17212
+ return $skip;
17213
+ });
17214
+ function JSXCodeNestedEnabled(ctx, state2) {
17215
+ return (0, import_lib3.$EVENT)(ctx, state2, "JSXCodeNestedEnabled", JSXCodeNestedEnabled$0);
17216
+ }
17217
+ var JSXCodeSameLineEnabled$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0, 'JSXCodeSameLineEnabled ""'), function($skip, $loc, $0, $1) {
17218
+ if (config.jsxCodeSameLine)
17219
+ return;
17220
+ return $skip;
17221
+ });
17222
+ function JSXCodeSameLineEnabled(ctx, state2) {
17223
+ return (0, import_lib3.$EVENT)(ctx, state2, "JSXCodeSameLineEnabled", JSXCodeSameLineEnabled$0);
17224
+ }
17148
17225
  var ObjectIsEnabled$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0, 'ObjectIsEnabled ""'), function($skip, $loc, $0, $1) {
17149
17226
  if (config.objectIs)
17150
17227
  return;
@@ -17188,6 +17265,7 @@ var Reset$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0, 'Reset ""'), fu
17188
17265
  coffeePrototype: false,
17189
17266
  defaultElement: "div",
17190
17267
  implicitReturns: true,
17268
+ jsxCode: false,
17191
17269
  objectIs: false,
17192
17270
  react: false,
17193
17271
  solid: false,
@@ -17232,6 +17310,16 @@ var Reset$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0, 'Reset ""'), fu
17232
17310
  }
17233
17311
  }
17234
17312
  });
17313
+ Object.defineProperty(config, "jsxCode", {
17314
+ set(b) {
17315
+ for (const option of [
17316
+ "jsxCodeNested",
17317
+ "jsxCodeSameLine"
17318
+ ]) {
17319
+ config[option] = b;
17320
+ }
17321
+ }
17322
+ });
17235
17323
  Object.assign(config, initialConfig);
17236
17324
  return {
17237
17325
  type: "ParserMeta",
package/dist/types.d.ts CHANGED
@@ -21,6 +21,7 @@ declare module "@danielx/civet" {
21
21
  coffeePrototype: boolean
22
22
  defaultElement: string
23
23
  implicitReturns: boolean
24
+ jsxCode: boolean
24
25
  objectIs: boolean
25
26
  react: boolean
26
27
  solid: boolean
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@danielx/civet",
3
3
  "type": "commonjs",
4
- "version": "0.7.27",
4
+ "version": "0.7.28",
5
5
  "description": "CoffeeScript style syntax for TypeScript",
6
6
  "main": "dist/main.js",
7
7
  "module": "dist/main.mjs",