@danielx/civet 0.5.2 → 0.5.3

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/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  Civet
2
2
  =====
3
3
 
4
- [![Build Status](https://img.shields.io/github/workflow/status/DanielXMoore/Civet/Build?logo=github&style=for-the-badge)](https://github.com/DanielXMoore/Civet/actions/workflows/build.yml)
4
+ [![Build Status](https://img.shields.io/github/actions/workflow/status/DanielXMoore/Civet/build.yml?branch=master&logo=github&style=for-the-badge)](https://github.com/DanielXMoore/Civet/actions/workflows/build.yml)
5
5
  [![NPM Version](https://img.shields.io/npm/v/@danielx/civet.svg?style=for-the-badge)](https://www.npmjs.com/package/@danielx/civet)
6
6
  [![NPM Downloads](https://img.shields.io/npm/dm/@danielx/civet.svg?style=for-the-badge)](https://www.npmjs.com/package/@danielx/civet)
7
7
  [![Discord](https://img.shields.io/discord/933472021310996512?style=for-the-badge)](https://discord.com/invite/xkrW9GebBc)
package/dist/browser.js CHANGED
@@ -897,6 +897,7 @@ ${input.slice(result.pos)}
897
897
  TypeBinaryOp,
898
898
  FunctionType,
899
899
  TypeArguments,
900
+ CompactTypeArguments,
900
901
  TypeParameters,
901
902
  TypeParameter,
902
903
  TypeConstraint,
@@ -2801,7 +2802,7 @@ ${input.slice(result.pos)}
2801
2802
  }
2802
2803
  let blockPrefix;
2803
2804
  if (after.length) {
2804
- const spliceRef = module.getSpliceRef();
2805
+ const spliceRef = module.getRef("splice");
2805
2806
  blockPrefix = {
2806
2807
  children: ["[", module.insertTrimmingSpace(after, ""), "] = ", spliceRef, ".call(", restIdentifier, ", -", after.length.toString(), ")"],
2807
2808
  names: after.flatMap((p) => p.names)
@@ -2816,6 +2817,7 @@ ${input.slice(result.pos)}
2816
2817
  { ...rest, children: rest.children.slice(0, -1) },
2817
2818
  close
2818
2819
  ],
2820
+ tp,
2819
2821
  names,
2820
2822
  blockPrefix
2821
2823
  };
@@ -2823,7 +2825,8 @@ ${input.slice(result.pos)}
2823
2825
  return {
2824
2826
  type: "Parameters",
2825
2827
  children: [tp, open, ...pes, close],
2826
- names: pes.flatMap((p) => p.names)
2828
+ names: pes.flatMap((p) => p.names),
2829
+ tp
2827
2830
  };
2828
2831
  });
2829
2832
  function NonEmptyParameters(state) {
@@ -3126,7 +3129,7 @@ ${input.slice(result.pos)}
3126
3129
  names.push(...restBinding.names);
3127
3130
  }
3128
3131
  if (after.length) {
3129
- const spliceRef = module.getSpliceRef();
3132
+ const spliceRef = module.getRef("splice");
3130
3133
  blockPrefix = {
3131
3134
  children: ["[", module.insertTrimmingSpace(after, ""), "] = ", spliceRef, ".call(", restIdentifier, ", -", after.length.toString(), ")"],
3132
3135
  names: after.flatMap((p) => p.names)
@@ -3359,7 +3362,7 @@ ${input.slice(result.pos)}
3359
3362
  restIdentifier = restBinding.names[0];
3360
3363
  }
3361
3364
  if (after.length) {
3362
- const spliceRef = module.getSpliceRef();
3365
+ const spliceRef = module.getRef("splice");
3363
3366
  blockPrefix = {
3364
3367
  children: ["[", module.insertTrimmingSpace(after, ""), "] = ", spliceRef, ".call(", restIdentifier, ", -", after.length.toString(), ")"],
3365
3368
  names: after.flatMap((p) => p.names)
@@ -5427,14 +5430,14 @@ ${input.slice(result.pos)}
5427
5430
  });
5428
5431
  var BinaryOpSymbol$29 = $TS($S(CoffeeOfEnabled, $EXPECT($L74, fail, 'BinaryOpSymbol "in"'), NonIdContinue), function($skip, $loc, $0, $1, $2, $3) {
5429
5432
  return {
5430
- ref: module.getIndexOfRef(),
5433
+ ref: module.getRef("indexOf"),
5431
5434
  suffix: " >= 0",
5432
5435
  special: true
5433
5436
  };
5434
5437
  });
5435
5438
  var BinaryOpSymbol$30 = $TS($S(CoffeeOfEnabled, $EXPECT($L73, fail, 'BinaryOpSymbol "not"'), NonIdContinue, __, $EXPECT($L74, fail, 'BinaryOpSymbol "in"'), NonIdContinue), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
5436
5439
  return {
5437
- ref: module.getIndexOfRef(),
5440
+ ref: module.getRef("indexOf"),
5438
5441
  suffix: " < 0",
5439
5442
  special: true
5440
5443
  };
@@ -6245,7 +6248,7 @@ ${input.slice(result.pos)}
6245
6248
  }
6246
6249
  if (declaration.own) {
6247
6250
  const indent2 = module.currentIndent.token + " ";
6248
- const hasPropRef = module.getHasPropRef();
6251
+ const hasPropRef = module.getRef("hasProp");
6249
6252
  blockPrefix.push([indent2, "if (!", hasPropRef, ".call(", exp, ", ", declaration, ")) continue\n"]);
6250
6253
  }
6251
6254
  kind.token = "in";
@@ -10601,7 +10604,7 @@ ${input.slice(result.pos)}
10601
10604
  return result;
10602
10605
  }
10603
10606
  }
10604
- var JSXSelfClosingElement$0 = $S($EXPECT($L5, fail, 'JSXSelfClosingElement "<"'), $TEXT(JSXElementName), $E(JSXAttributes), __, $EXPECT($L147, fail, 'JSXSelfClosingElement "/>"'));
10607
+ var JSXSelfClosingElement$0 = $S($EXPECT($L5, fail, 'JSXSelfClosingElement "<"'), $TEXT(JSXElementName), $E(CompactTypeArguments), $E(JSXAttributes), __, $EXPECT($L147, fail, 'JSXSelfClosingElement "/>"'));
10605
10608
  function JSXSelfClosingElement(state) {
10606
10609
  if (state.events) {
10607
10610
  const result = state.events.enter?.("JSXSelfClosingElement", state);
@@ -10620,7 +10623,7 @@ ${input.slice(result.pos)}
10620
10623
  return result;
10621
10624
  }
10622
10625
  }
10623
- var JSXOpeningElement$0 = $S($EXPECT($L5, fail, 'JSXOpeningElement "<"'), $TEXT(JSXElementName), $E(JSXAttributes), __, $EXPECT($L27, fail, 'JSXOpeningElement ">"'));
10626
+ var JSXOpeningElement$0 = $S($EXPECT($L5, fail, 'JSXOpeningElement "<"'), $TEXT(JSXElementName), $E(CompactTypeArguments), $E(JSXAttributes), __, $EXPECT($L27, fail, 'JSXOpeningElement ">"'));
10624
10627
  function JSXOpeningElement(state) {
10625
10628
  if (state.events) {
10626
10629
  const result = state.events.enter?.("JSXOpeningElement", state);
@@ -12011,9 +12014,36 @@ ${input.slice(result.pos)}
12011
12014
  return result;
12012
12015
  }
12013
12016
  }
12014
- var TypeParameters$0 = $TS($S(__, $EXPECT($L5, fail, 'TypeParameters "<"'), $P(TypeParameter), __, $EXPECT($L27, fail, 'TypeParameters ">"')), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
12017
+ var CompactTypeArguments$0 = $TS($S($EXPECT($L5, fail, 'CompactTypeArguments "<"'), __, Type, $Q($S(__, Comma, __, Type)), $E($S(__, Comma)), __, $EXPECT($L27, fail, 'CompactTypeArguments ">"')), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
12015
12018
  return { ts: true, children: $0 };
12016
12019
  });
12020
+ function CompactTypeArguments(state) {
12021
+ if (state.events) {
12022
+ const result = state.events.enter?.("CompactTypeArguments", state);
12023
+ if (result)
12024
+ return result.cache;
12025
+ }
12026
+ if (state.tokenize) {
12027
+ const result = $TOKEN("CompactTypeArguments", state, CompactTypeArguments$0(state));
12028
+ if (state.events)
12029
+ state.events.exit?.("CompactTypeArguments", state, result);
12030
+ return result;
12031
+ } else {
12032
+ const result = CompactTypeArguments$0(state);
12033
+ if (state.events)
12034
+ state.events.exit?.("CompactTypeArguments", state, result);
12035
+ return result;
12036
+ }
12037
+ }
12038
+ var TypeParameters$0 = $TS($S(__, $EXPECT($L5, fail, 'TypeParameters "<"'), $P(TypeParameter), __, $EXPECT($L27, fail, 'TypeParameters ">"')), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
12039
+ var parameters = $3;
12040
+ return {
12041
+ type: "TypeParameters",
12042
+ parameters,
12043
+ ts: true,
12044
+ children: $0
12045
+ };
12046
+ });
12017
12047
  function TypeParameters(state) {
12018
12048
  if (state.events) {
12019
12049
  const result = state.events.enter?.("TypeParameters", state);
@@ -12898,51 +12928,48 @@ ${input.slice(result.pos)}
12898
12928
  tab: void 0,
12899
12929
  verbose: false
12900
12930
  };
12901
- let indexOfRef, hasPropRef, spliceRef;
12902
- const asAny = {
12931
+ module.asAny = {
12903
12932
  ts: true,
12904
12933
  children: [" as any"]
12905
12934
  };
12906
12935
  module.prelude = [];
12907
- module.getSpliceRef = function() {
12908
- if (spliceRef)
12909
- return spliceRef;
12910
- spliceRef = {
12911
- type: "Ref",
12912
- base: "splice",
12913
- id: "splice"
12914
- };
12915
- return spliceRef;
12916
- };
12917
- module.getIndexOfRef = function() {
12918
- if (indexOfRef)
12919
- return indexOfRef;
12920
- indexOfRef = {
12921
- type: "Ref",
12922
- base: "indexOf",
12923
- id: "indexOf"
12924
- };
12925
- const typeSuffix = {
12926
- ts: true,
12927
- children: [": <T>(this: T[], searchElement: T) => boolean"]
12928
- };
12929
- module.prelude.push(["", ["const ", indexOfRef, typeSuffix, " = [].indexOf", asAny, "\n"]]);
12930
- return indexOfRef;
12936
+ const declareRef = {
12937
+ indexOf(indexOfRef) {
12938
+ const typeSuffix = {
12939
+ ts: true,
12940
+ children: [": <T>(this: T[], searchElement: T) => boolean"]
12941
+ };
12942
+ module.prelude.push(["", ["const ", indexOfRef, typeSuffix, " = [].indexOf", module.asAny, "\n"]]);
12943
+ },
12944
+ hasProp(hasPropRef) {
12945
+ const typeSuffix = {
12946
+ ts: true,
12947
+ children: [": <T>(this: T, prop: keyof T) => boolean"]
12948
+ };
12949
+ module.prelude.push(["", ["const ", hasPropRef, typeSuffix, " = {}.hasOwnProperty", module.asAny, "\n"]]);
12950
+ }
12931
12951
  };
12932
- module.getHasPropRef = function() {
12933
- if (hasPropRef)
12934
- return hasPropRef;
12935
- hasPropRef = {
12952
+ const refs = {};
12953
+ module.getRef = function(base) {
12954
+ if (refs.hasOwnProperty(base))
12955
+ return refs[base];
12956
+ const ref = {
12936
12957
  type: "Ref",
12937
- base: "hasProp",
12938
- id: "hasProp"
12939
- };
12940
- const typeSuffix = {
12941
- ts: true,
12942
- children: [": <T>(this: T, prop: keyof T) => boolean"]
12958
+ base,
12959
+ id: base
12943
12960
  };
12944
- module.prelude.push(["", ["const ", hasPropRef, typeSuffix, " = {}.hasOwnProperty", asAny, "\n"]]);
12945
- return hasPropRef;
12961
+ if (declareRef.hasOwnProperty(base))
12962
+ declareRef[base](ref);
12963
+ return refs[base] = ref;
12964
+ };
12965
+ module.typeOfJSXElement = function($12) {
12966
+ if (module.config.solid) {
12967
+ let open = $12;
12968
+ while (Array.isArray(open[0]))
12969
+ open = open[0];
12970
+ open = open[1];
12971
+ return typeof open === "string" && open[0] === open[0].toLowerCase() ? [module.getRef("IntrinsicElements"), '<"', open, '">'] : ["ReturnType<typeof ", open, ">"];
12972
+ }
12946
12973
  };
12947
12974
  Object.defineProperty(module.config, "coffeeCompat", {
12948
12975
  set(b) {
@@ -13519,7 +13546,10 @@ ${input.slice(result.pos)}
13519
13546
  return nodes;
13520
13547
  }
13521
13548
  function processParams(f) {
13522
- const { parameters, block } = f;
13549
+ const { type, parameters, block } = f;
13550
+ if (type === "ArrowFunction" && parameters && parameters.tp && parameters.tp.parameters.length === 1) {
13551
+ parameters.tp.parameters.push(",");
13552
+ }
13523
13553
  if (!block)
13524
13554
  return;
13525
13555
  const { expressions } = block;
@@ -13652,17 +13682,13 @@ ${input.slice(result.pos)}
13652
13682
  });
13653
13683
  }
13654
13684
  function checkSpliceRef(statements) {
13655
- const spliceRef = module.getSpliceRef();
13685
+ const spliceRef = module.getRef("splice");
13656
13686
  if (gatherRecursiveAll(statements, (n) => n === spliceRef).length) {
13657
13687
  const typeSuffix = {
13658
13688
  ts: true,
13659
13689
  children: [": <T>(this: T[], start: number, deleteCount?: number) => T[]"]
13660
13690
  };
13661
- const asAny = {
13662
- ts: true,
13663
- children: [" as any"]
13664
- };
13665
- module.prelude.push(["", ["const ", spliceRef, typeSuffix, " = [].splice", asAny, "\n"]]);
13691
+ module.prelude.push(["", ["const ", spliceRef, typeSuffix, " = [].splice", module.asAny, "\n"]]);
13666
13692
  }
13667
13693
  }
13668
13694
  module.attachPostfixStatementAsExpression = function(exp, post) {
package/dist/main.js CHANGED
@@ -896,6 +896,7 @@ ${input.slice(result.pos)}
896
896
  TypeBinaryOp,
897
897
  FunctionType,
898
898
  TypeArguments,
899
+ CompactTypeArguments,
899
900
  TypeParameters,
900
901
  TypeParameter,
901
902
  TypeConstraint,
@@ -2800,7 +2801,7 @@ ${input.slice(result.pos)}
2800
2801
  }
2801
2802
  let blockPrefix;
2802
2803
  if (after.length) {
2803
- const spliceRef = module2.getSpliceRef();
2804
+ const spliceRef = module2.getRef("splice");
2804
2805
  blockPrefix = {
2805
2806
  children: ["[", module2.insertTrimmingSpace(after, ""), "] = ", spliceRef, ".call(", restIdentifier, ", -", after.length.toString(), ")"],
2806
2807
  names: after.flatMap((p) => p.names)
@@ -2815,6 +2816,7 @@ ${input.slice(result.pos)}
2815
2816
  { ...rest, children: rest.children.slice(0, -1) },
2816
2817
  close
2817
2818
  ],
2819
+ tp,
2818
2820
  names,
2819
2821
  blockPrefix
2820
2822
  };
@@ -2822,7 +2824,8 @@ ${input.slice(result.pos)}
2822
2824
  return {
2823
2825
  type: "Parameters",
2824
2826
  children: [tp, open, ...pes, close],
2825
- names: pes.flatMap((p) => p.names)
2827
+ names: pes.flatMap((p) => p.names),
2828
+ tp
2826
2829
  };
2827
2830
  });
2828
2831
  function NonEmptyParameters(state) {
@@ -3125,7 +3128,7 @@ ${input.slice(result.pos)}
3125
3128
  names.push(...restBinding.names);
3126
3129
  }
3127
3130
  if (after.length) {
3128
- const spliceRef = module2.getSpliceRef();
3131
+ const spliceRef = module2.getRef("splice");
3129
3132
  blockPrefix = {
3130
3133
  children: ["[", module2.insertTrimmingSpace(after, ""), "] = ", spliceRef, ".call(", restIdentifier, ", -", after.length.toString(), ")"],
3131
3134
  names: after.flatMap((p) => p.names)
@@ -3358,7 +3361,7 @@ ${input.slice(result.pos)}
3358
3361
  restIdentifier = restBinding.names[0];
3359
3362
  }
3360
3363
  if (after.length) {
3361
- const spliceRef = module2.getSpliceRef();
3364
+ const spliceRef = module2.getRef("splice");
3362
3365
  blockPrefix = {
3363
3366
  children: ["[", module2.insertTrimmingSpace(after, ""), "] = ", spliceRef, ".call(", restIdentifier, ", -", after.length.toString(), ")"],
3364
3367
  names: after.flatMap((p) => p.names)
@@ -5426,14 +5429,14 @@ ${input.slice(result.pos)}
5426
5429
  });
5427
5430
  var BinaryOpSymbol$29 = $TS($S(CoffeeOfEnabled, $EXPECT($L74, fail, 'BinaryOpSymbol "in"'), NonIdContinue), function($skip, $loc, $0, $1, $2, $3) {
5428
5431
  return {
5429
- ref: module2.getIndexOfRef(),
5432
+ ref: module2.getRef("indexOf"),
5430
5433
  suffix: " >= 0",
5431
5434
  special: true
5432
5435
  };
5433
5436
  });
5434
5437
  var BinaryOpSymbol$30 = $TS($S(CoffeeOfEnabled, $EXPECT($L73, fail, 'BinaryOpSymbol "not"'), NonIdContinue, __, $EXPECT($L74, fail, 'BinaryOpSymbol "in"'), NonIdContinue), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
5435
5438
  return {
5436
- ref: module2.getIndexOfRef(),
5439
+ ref: module2.getRef("indexOf"),
5437
5440
  suffix: " < 0",
5438
5441
  special: true
5439
5442
  };
@@ -6244,7 +6247,7 @@ ${input.slice(result.pos)}
6244
6247
  }
6245
6248
  if (declaration.own) {
6246
6249
  const indent2 = module2.currentIndent.token + " ";
6247
- const hasPropRef = module2.getHasPropRef();
6250
+ const hasPropRef = module2.getRef("hasProp");
6248
6251
  blockPrefix.push([indent2, "if (!", hasPropRef, ".call(", exp, ", ", declaration, ")) continue\n"]);
6249
6252
  }
6250
6253
  kind.token = "in";
@@ -10600,7 +10603,7 @@ ${input.slice(result.pos)}
10600
10603
  return result;
10601
10604
  }
10602
10605
  }
10603
- var JSXSelfClosingElement$0 = $S($EXPECT($L5, fail, 'JSXSelfClosingElement "<"'), $TEXT(JSXElementName), $E(JSXAttributes), __, $EXPECT($L147, fail, 'JSXSelfClosingElement "/>"'));
10606
+ var JSXSelfClosingElement$0 = $S($EXPECT($L5, fail, 'JSXSelfClosingElement "<"'), $TEXT(JSXElementName), $E(CompactTypeArguments), $E(JSXAttributes), __, $EXPECT($L147, fail, 'JSXSelfClosingElement "/>"'));
10604
10607
  function JSXSelfClosingElement(state) {
10605
10608
  if (state.events) {
10606
10609
  const result = state.events.enter?.("JSXSelfClosingElement", state);
@@ -10619,7 +10622,7 @@ ${input.slice(result.pos)}
10619
10622
  return result;
10620
10623
  }
10621
10624
  }
10622
- var JSXOpeningElement$0 = $S($EXPECT($L5, fail, 'JSXOpeningElement "<"'), $TEXT(JSXElementName), $E(JSXAttributes), __, $EXPECT($L27, fail, 'JSXOpeningElement ">"'));
10625
+ var JSXOpeningElement$0 = $S($EXPECT($L5, fail, 'JSXOpeningElement "<"'), $TEXT(JSXElementName), $E(CompactTypeArguments), $E(JSXAttributes), __, $EXPECT($L27, fail, 'JSXOpeningElement ">"'));
10623
10626
  function JSXOpeningElement(state) {
10624
10627
  if (state.events) {
10625
10628
  const result = state.events.enter?.("JSXOpeningElement", state);
@@ -12010,9 +12013,36 @@ ${input.slice(result.pos)}
12010
12013
  return result;
12011
12014
  }
12012
12015
  }
12013
- var TypeParameters$0 = $TS($S(__, $EXPECT($L5, fail, 'TypeParameters "<"'), $P(TypeParameter), __, $EXPECT($L27, fail, 'TypeParameters ">"')), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
12016
+ var CompactTypeArguments$0 = $TS($S($EXPECT($L5, fail, 'CompactTypeArguments "<"'), __, Type, $Q($S(__, Comma, __, Type)), $E($S(__, Comma)), __, $EXPECT($L27, fail, 'CompactTypeArguments ">"')), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
12014
12017
  return { ts: true, children: $0 };
12015
12018
  });
12019
+ function CompactTypeArguments(state) {
12020
+ if (state.events) {
12021
+ const result = state.events.enter?.("CompactTypeArguments", state);
12022
+ if (result)
12023
+ return result.cache;
12024
+ }
12025
+ if (state.tokenize) {
12026
+ const result = $TOKEN("CompactTypeArguments", state, CompactTypeArguments$0(state));
12027
+ if (state.events)
12028
+ state.events.exit?.("CompactTypeArguments", state, result);
12029
+ return result;
12030
+ } else {
12031
+ const result = CompactTypeArguments$0(state);
12032
+ if (state.events)
12033
+ state.events.exit?.("CompactTypeArguments", state, result);
12034
+ return result;
12035
+ }
12036
+ }
12037
+ var TypeParameters$0 = $TS($S(__, $EXPECT($L5, fail, 'TypeParameters "<"'), $P(TypeParameter), __, $EXPECT($L27, fail, 'TypeParameters ">"')), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
12038
+ var parameters = $3;
12039
+ return {
12040
+ type: "TypeParameters",
12041
+ parameters,
12042
+ ts: true,
12043
+ children: $0
12044
+ };
12045
+ });
12016
12046
  function TypeParameters(state) {
12017
12047
  if (state.events) {
12018
12048
  const result = state.events.enter?.("TypeParameters", state);
@@ -12897,51 +12927,48 @@ ${input.slice(result.pos)}
12897
12927
  tab: void 0,
12898
12928
  verbose: false
12899
12929
  };
12900
- let indexOfRef, hasPropRef, spliceRef;
12901
- const asAny = {
12930
+ module2.asAny = {
12902
12931
  ts: true,
12903
12932
  children: [" as any"]
12904
12933
  };
12905
12934
  module2.prelude = [];
12906
- module2.getSpliceRef = function() {
12907
- if (spliceRef)
12908
- return spliceRef;
12909
- spliceRef = {
12910
- type: "Ref",
12911
- base: "splice",
12912
- id: "splice"
12913
- };
12914
- return spliceRef;
12915
- };
12916
- module2.getIndexOfRef = function() {
12917
- if (indexOfRef)
12918
- return indexOfRef;
12919
- indexOfRef = {
12920
- type: "Ref",
12921
- base: "indexOf",
12922
- id: "indexOf"
12923
- };
12924
- const typeSuffix = {
12925
- ts: true,
12926
- children: [": <T>(this: T[], searchElement: T) => boolean"]
12927
- };
12928
- module2.prelude.push(["", ["const ", indexOfRef, typeSuffix, " = [].indexOf", asAny, "\n"]]);
12929
- return indexOfRef;
12935
+ const declareRef = {
12936
+ indexOf(indexOfRef) {
12937
+ const typeSuffix = {
12938
+ ts: true,
12939
+ children: [": <T>(this: T[], searchElement: T) => boolean"]
12940
+ };
12941
+ module2.prelude.push(["", ["const ", indexOfRef, typeSuffix, " = [].indexOf", module2.asAny, "\n"]]);
12942
+ },
12943
+ hasProp(hasPropRef) {
12944
+ const typeSuffix = {
12945
+ ts: true,
12946
+ children: [": <T>(this: T, prop: keyof T) => boolean"]
12947
+ };
12948
+ module2.prelude.push(["", ["const ", hasPropRef, typeSuffix, " = {}.hasOwnProperty", module2.asAny, "\n"]]);
12949
+ }
12930
12950
  };
12931
- module2.getHasPropRef = function() {
12932
- if (hasPropRef)
12933
- return hasPropRef;
12934
- hasPropRef = {
12951
+ const refs = {};
12952
+ module2.getRef = function(base) {
12953
+ if (refs.hasOwnProperty(base))
12954
+ return refs[base];
12955
+ const ref = {
12935
12956
  type: "Ref",
12936
- base: "hasProp",
12937
- id: "hasProp"
12938
- };
12939
- const typeSuffix = {
12940
- ts: true,
12941
- children: [": <T>(this: T, prop: keyof T) => boolean"]
12957
+ base,
12958
+ id: base
12942
12959
  };
12943
- module2.prelude.push(["", ["const ", hasPropRef, typeSuffix, " = {}.hasOwnProperty", asAny, "\n"]]);
12944
- return hasPropRef;
12960
+ if (declareRef.hasOwnProperty(base))
12961
+ declareRef[base](ref);
12962
+ return refs[base] = ref;
12963
+ };
12964
+ module2.typeOfJSXElement = function($12) {
12965
+ if (module2.config.solid) {
12966
+ let open = $12;
12967
+ while (Array.isArray(open[0]))
12968
+ open = open[0];
12969
+ open = open[1];
12970
+ return typeof open === "string" && open[0] === open[0].toLowerCase() ? [module2.getRef("IntrinsicElements"), '<"', open, '">'] : ["ReturnType<typeof ", open, ">"];
12971
+ }
12945
12972
  };
12946
12973
  Object.defineProperty(module2.config, "coffeeCompat", {
12947
12974
  set(b) {
@@ -13518,7 +13545,10 @@ ${input.slice(result.pos)}
13518
13545
  return nodes;
13519
13546
  }
13520
13547
  function processParams(f) {
13521
- const { parameters, block } = f;
13548
+ const { type, parameters, block } = f;
13549
+ if (type === "ArrowFunction" && parameters && parameters.tp && parameters.tp.parameters.length === 1) {
13550
+ parameters.tp.parameters.push(",");
13551
+ }
13522
13552
  if (!block)
13523
13553
  return;
13524
13554
  const { expressions } = block;
@@ -13651,17 +13681,13 @@ ${input.slice(result.pos)}
13651
13681
  });
13652
13682
  }
13653
13683
  function checkSpliceRef(statements) {
13654
- const spliceRef = module2.getSpliceRef();
13684
+ const spliceRef = module2.getRef("splice");
13655
13685
  if (gatherRecursiveAll(statements, (n) => n === spliceRef).length) {
13656
13686
  const typeSuffix = {
13657
13687
  ts: true,
13658
13688
  children: [": <T>(this: T[], start: number, deleteCount?: number) => T[]"]
13659
13689
  };
13660
- const asAny = {
13661
- ts: true,
13662
- children: [" as any"]
13663
- };
13664
- module2.prelude.push(["", ["const ", spliceRef, typeSuffix, " = [].splice", asAny, "\n"]]);
13690
+ module2.prelude.push(["", ["const ", spliceRef, typeSuffix, " = [].splice", module2.asAny, "\n"]]);
13665
13691
  }
13666
13692
  }
13667
13693
  module2.attachPostfixStatementAsExpression = function(exp, post) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danielx/civet",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "CoffeeScript style syntax for TypeScript",
5
5
  "main": "dist/main.js",
6
6
  "exports": {