@danielx/civet 0.5.2 → 0.5.4

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,9 @@ ${input.slice(result.pos)}
897
897
  TypeBinaryOp,
898
898
  FunctionType,
899
899
  TypeArguments,
900
+ CompactTypeArguments,
901
+ TypeArgument,
902
+ TypeArgumentDelimiter,
900
903
  TypeParameters,
901
904
  TypeParameter,
902
905
  TypeConstraint,
@@ -2801,7 +2804,7 @@ ${input.slice(result.pos)}
2801
2804
  }
2802
2805
  let blockPrefix;
2803
2806
  if (after.length) {
2804
- const spliceRef = module.getSpliceRef();
2807
+ const spliceRef = module.getRef("splice");
2805
2808
  blockPrefix = {
2806
2809
  children: ["[", module.insertTrimmingSpace(after, ""), "] = ", spliceRef, ".call(", restIdentifier, ", -", after.length.toString(), ")"],
2807
2810
  names: after.flatMap((p) => p.names)
@@ -2816,6 +2819,7 @@ ${input.slice(result.pos)}
2816
2819
  { ...rest, children: rest.children.slice(0, -1) },
2817
2820
  close
2818
2821
  ],
2822
+ tp,
2819
2823
  names,
2820
2824
  blockPrefix
2821
2825
  };
@@ -2823,7 +2827,8 @@ ${input.slice(result.pos)}
2823
2827
  return {
2824
2828
  type: "Parameters",
2825
2829
  children: [tp, open, ...pes, close],
2826
- names: pes.flatMap((p) => p.names)
2830
+ names: pes.flatMap((p) => p.names),
2831
+ tp
2827
2832
  };
2828
2833
  });
2829
2834
  function NonEmptyParameters(state) {
@@ -3126,7 +3131,7 @@ ${input.slice(result.pos)}
3126
3131
  names.push(...restBinding.names);
3127
3132
  }
3128
3133
  if (after.length) {
3129
- const spliceRef = module.getSpliceRef();
3134
+ const spliceRef = module.getRef("splice");
3130
3135
  blockPrefix = {
3131
3136
  children: ["[", module.insertTrimmingSpace(after, ""), "] = ", spliceRef, ".call(", restIdentifier, ", -", after.length.toString(), ")"],
3132
3137
  names: after.flatMap((p) => p.names)
@@ -3359,7 +3364,7 @@ ${input.slice(result.pos)}
3359
3364
  restIdentifier = restBinding.names[0];
3360
3365
  }
3361
3366
  if (after.length) {
3362
- const spliceRef = module.getSpliceRef();
3367
+ const spliceRef = module.getRef("splice");
3363
3368
  blockPrefix = {
3364
3369
  children: ["[", module.insertTrimmingSpace(after, ""), "] = ", spliceRef, ".call(", restIdentifier, ", -", after.length.toString(), ")"],
3365
3370
  names: after.flatMap((p) => p.names)
@@ -5427,14 +5432,14 @@ ${input.slice(result.pos)}
5427
5432
  });
5428
5433
  var BinaryOpSymbol$29 = $TS($S(CoffeeOfEnabled, $EXPECT($L74, fail, 'BinaryOpSymbol "in"'), NonIdContinue), function($skip, $loc, $0, $1, $2, $3) {
5429
5434
  return {
5430
- ref: module.getIndexOfRef(),
5435
+ ref: module.getRef("indexOf"),
5431
5436
  suffix: " >= 0",
5432
5437
  special: true
5433
5438
  };
5434
5439
  });
5435
5440
  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
5441
  return {
5437
- ref: module.getIndexOfRef(),
5442
+ ref: module.getRef("indexOf"),
5438
5443
  suffix: " < 0",
5439
5444
  special: true
5440
5445
  };
@@ -6245,7 +6250,7 @@ ${input.slice(result.pos)}
6245
6250
  }
6246
6251
  if (declaration.own) {
6247
6252
  const indent2 = module.currentIndent.token + " ";
6248
- const hasPropRef = module.getHasPropRef();
6253
+ const hasPropRef = module.getRef("hasProp");
6249
6254
  blockPrefix.push([indent2, "if (!", hasPropRef, ".call(", exp, ", ", declaration, ")) continue\n"]);
6250
6255
  }
6251
6256
  kind.token = "in";
@@ -10601,7 +10606,7 @@ ${input.slice(result.pos)}
10601
10606
  return result;
10602
10607
  }
10603
10608
  }
10604
- var JSXSelfClosingElement$0 = $S($EXPECT($L5, fail, 'JSXSelfClosingElement "<"'), $TEXT(JSXElementName), $E(JSXAttributes), __, $EXPECT($L147, fail, 'JSXSelfClosingElement "/>"'));
10609
+ var JSXSelfClosingElement$0 = $S($EXPECT($L5, fail, 'JSXSelfClosingElement "<"'), $TEXT(JSXElementName), $E(CompactTypeArguments), $E(JSXAttributes), __, $EXPECT($L147, fail, 'JSXSelfClosingElement "/>"'));
10605
10610
  function JSXSelfClosingElement(state) {
10606
10611
  if (state.events) {
10607
10612
  const result = state.events.enter?.("JSXSelfClosingElement", state);
@@ -10620,7 +10625,7 @@ ${input.slice(result.pos)}
10620
10625
  return result;
10621
10626
  }
10622
10627
  }
10623
- var JSXOpeningElement$0 = $S($EXPECT($L5, fail, 'JSXOpeningElement "<"'), $TEXT(JSXElementName), $E(JSXAttributes), __, $EXPECT($L27, fail, 'JSXOpeningElement ">"'));
10628
+ var JSXOpeningElement$0 = $S($EXPECT($L5, fail, 'JSXOpeningElement "<"'), $TEXT(JSXElementName), $E(CompactTypeArguments), $E(JSXAttributes), __, $EXPECT($L27, fail, 'JSXOpeningElement ">"'));
10624
10629
  function JSXOpeningElement(state) {
10625
10630
  if (state.events) {
10626
10631
  const result = state.events.enter?.("JSXOpeningElement", state);
@@ -10658,7 +10663,7 @@ ${input.slice(result.pos)}
10658
10663
  return result;
10659
10664
  }
10660
10665
  }
10661
- var JSXFragment$0 = $S($EXPECT($L149, fail, 'JSXFragment "<>"'), $E(JSXChildren), $EXPECT($L150, fail, 'JSXFragment "</>"'));
10666
+ var JSXFragment$0 = $S($EXPECT($L149, fail, 'JSXFragment "<>"'), $E(JSXChildren), __, $EXPECT($L150, fail, 'JSXFragment "</>"'));
10662
10667
  var JSXFragment$1 = $TS($S($EXPECT($L149, fail, 'JSXFragment "<>"'), JSXMixedChildren, InsertNewline, InsertIndent), function($skip, $loc, $0, $1, $2, $3, $4) {
10663
10668
  return [...$0, "</>"];
10664
10669
  });
@@ -11990,7 +11995,7 @@ ${input.slice(result.pos)}
11990
11995
  return result;
11991
11996
  }
11992
11997
  }
11993
- var TypeArguments$0 = $TS($S(__, $EXPECT($L5, fail, 'TypeArguments "<"'), __, Type, $Q($S(__, Comma, __, Type)), $E($S(__, Comma)), __, $EXPECT($L27, fail, 'TypeArguments ">"')), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8) {
11998
+ var TypeArguments$0 = $TS($S(__, $EXPECT($L5, fail, 'TypeArguments "<"'), $P(TypeArgument), __, $EXPECT($L27, fail, 'TypeArguments ">"')), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
11994
11999
  return { ts: true, children: $0 };
11995
12000
  });
11996
12001
  function TypeArguments(state) {
@@ -12011,9 +12016,74 @@ ${input.slice(result.pos)}
12011
12016
  return result;
12012
12017
  }
12013
12018
  }
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) {
12019
+ var CompactTypeArguments$0 = $TS($S($EXPECT($L5, fail, 'CompactTypeArguments "<"'), $P(TypeArgument), __, $EXPECT($L27, fail, 'CompactTypeArguments ">"')), function($skip, $loc, $0, $1, $2, $3, $4) {
12015
12020
  return { ts: true, children: $0 };
12016
12021
  });
12022
+ function CompactTypeArguments(state) {
12023
+ if (state.events) {
12024
+ const result = state.events.enter?.("CompactTypeArguments", state);
12025
+ if (result)
12026
+ return result.cache;
12027
+ }
12028
+ if (state.tokenize) {
12029
+ const result = $TOKEN("CompactTypeArguments", state, CompactTypeArguments$0(state));
12030
+ if (state.events)
12031
+ state.events.exit?.("CompactTypeArguments", state, result);
12032
+ return result;
12033
+ } else {
12034
+ const result = CompactTypeArguments$0(state);
12035
+ if (state.events)
12036
+ state.events.exit?.("CompactTypeArguments", state, result);
12037
+ return result;
12038
+ }
12039
+ }
12040
+ var TypeArgument$0 = $S(__, Type, TypeArgumentDelimiter);
12041
+ function TypeArgument(state) {
12042
+ if (state.events) {
12043
+ const result = state.events.enter?.("TypeArgument", state);
12044
+ if (result)
12045
+ return result.cache;
12046
+ }
12047
+ if (state.tokenize) {
12048
+ const result = $TOKEN("TypeArgument", state, TypeArgument$0(state));
12049
+ if (state.events)
12050
+ state.events.exit?.("TypeArgument", state, result);
12051
+ return result;
12052
+ } else {
12053
+ const result = TypeArgument$0(state);
12054
+ if (state.events)
12055
+ state.events.exit?.("TypeArgument", state, result);
12056
+ return result;
12057
+ }
12058
+ }
12059
+ var TypeArgumentDelimiter$0 = TypeParameterDelimiter;
12060
+ function TypeArgumentDelimiter(state) {
12061
+ if (state.events) {
12062
+ const result = state.events.enter?.("TypeArgumentDelimiter", state);
12063
+ if (result)
12064
+ return result.cache;
12065
+ }
12066
+ if (state.tokenize) {
12067
+ const result = $TOKEN("TypeArgumentDelimiter", state, TypeArgumentDelimiter$0(state));
12068
+ if (state.events)
12069
+ state.events.exit?.("TypeArgumentDelimiter", state, result);
12070
+ return result;
12071
+ } else {
12072
+ const result = TypeArgumentDelimiter$0(state);
12073
+ if (state.events)
12074
+ state.events.exit?.("TypeArgumentDelimiter", state, result);
12075
+ return result;
12076
+ }
12077
+ }
12078
+ var TypeParameters$0 = $TS($S(__, $EXPECT($L5, fail, 'TypeParameters "<"'), $P(TypeParameter), __, $EXPECT($L27, fail, 'TypeParameters ">"')), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
12079
+ var parameters = $3;
12080
+ return {
12081
+ type: "TypeParameters",
12082
+ parameters,
12083
+ ts: true,
12084
+ children: $0
12085
+ };
12086
+ });
12017
12087
  function TypeParameters(state) {
12018
12088
  if (state.events) {
12019
12089
  const result = state.events.enter?.("TypeParameters", state);
@@ -12898,51 +12968,48 @@ ${input.slice(result.pos)}
12898
12968
  tab: void 0,
12899
12969
  verbose: false
12900
12970
  };
12901
- let indexOfRef, hasPropRef, spliceRef;
12902
- const asAny = {
12971
+ module.asAny = {
12903
12972
  ts: true,
12904
12973
  children: [" as any"]
12905
12974
  };
12906
12975
  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;
12976
+ const declareRef = {
12977
+ indexOf(indexOfRef) {
12978
+ const typeSuffix = {
12979
+ ts: true,
12980
+ children: [": <T>(this: T[], searchElement: T) => boolean"]
12981
+ };
12982
+ module.prelude.push(["", ["const ", indexOfRef, typeSuffix, " = [].indexOf", module.asAny, "\n"]]);
12983
+ },
12984
+ hasProp(hasPropRef) {
12985
+ const typeSuffix = {
12986
+ ts: true,
12987
+ children: [": <T>(this: T, prop: keyof T) => boolean"]
12988
+ };
12989
+ module.prelude.push(["", ["const ", hasPropRef, typeSuffix, " = {}.hasOwnProperty", module.asAny, "\n"]]);
12990
+ }
12931
12991
  };
12932
- module.getHasPropRef = function() {
12933
- if (hasPropRef)
12934
- return hasPropRef;
12935
- hasPropRef = {
12992
+ const refs = {};
12993
+ module.getRef = function(base) {
12994
+ if (refs.hasOwnProperty(base))
12995
+ return refs[base];
12996
+ const ref = {
12936
12997
  type: "Ref",
12937
- base: "hasProp",
12938
- id: "hasProp"
12998
+ base,
12999
+ id: base
12939
13000
  };
12940
- const typeSuffix = {
12941
- ts: true,
12942
- children: [": <T>(this: T, prop: keyof T) => boolean"]
12943
- };
12944
- module.prelude.push(["", ["const ", hasPropRef, typeSuffix, " = {}.hasOwnProperty", asAny, "\n"]]);
12945
- return hasPropRef;
13001
+ if (declareRef.hasOwnProperty(base))
13002
+ declareRef[base](ref);
13003
+ return refs[base] = ref;
13004
+ };
13005
+ module.typeOfJSXElement = function($12) {
13006
+ if (module.config.solid) {
13007
+ let open = $12;
13008
+ while (Array.isArray(open[0]))
13009
+ open = open[0];
13010
+ open = open[1];
13011
+ return typeof open === "string" && open[0] === open[0].toLowerCase() ? [module.getRef("IntrinsicElements"), '<"', open, '">'] : ["ReturnType<typeof ", open, ">"];
13012
+ }
12946
13013
  };
12947
13014
  Object.defineProperty(module.config, "coffeeCompat", {
12948
13015
  set(b) {
@@ -13519,7 +13586,10 @@ ${input.slice(result.pos)}
13519
13586
  return nodes;
13520
13587
  }
13521
13588
  function processParams(f) {
13522
- const { parameters, block } = f;
13589
+ const { type, parameters, block } = f;
13590
+ if (type === "ArrowFunction" && parameters && parameters.tp && parameters.tp.parameters.length === 1) {
13591
+ parameters.tp.parameters.push(",");
13592
+ }
13523
13593
  if (!block)
13524
13594
  return;
13525
13595
  const { expressions } = block;
@@ -13652,17 +13722,13 @@ ${input.slice(result.pos)}
13652
13722
  });
13653
13723
  }
13654
13724
  function checkSpliceRef(statements) {
13655
- const spliceRef = module.getSpliceRef();
13725
+ const spliceRef = module.getRef("splice");
13656
13726
  if (gatherRecursiveAll(statements, (n) => n === spliceRef).length) {
13657
13727
  const typeSuffix = {
13658
13728
  ts: true,
13659
13729
  children: [": <T>(this: T[], start: number, deleteCount?: number) => T[]"]
13660
13730
  };
13661
- const asAny = {
13662
- ts: true,
13663
- children: [" as any"]
13664
- };
13665
- module.prelude.push(["", ["const ", spliceRef, typeSuffix, " = [].splice", asAny, "\n"]]);
13731
+ module.prelude.push(["", ["const ", spliceRef, typeSuffix, " = [].splice", module.asAny, "\n"]]);
13666
13732
  }
13667
13733
  }
13668
13734
  module.attachPostfixStatementAsExpression = function(exp, post) {
package/dist/main.js CHANGED
@@ -896,6 +896,9 @@ ${input.slice(result.pos)}
896
896
  TypeBinaryOp,
897
897
  FunctionType,
898
898
  TypeArguments,
899
+ CompactTypeArguments,
900
+ TypeArgument,
901
+ TypeArgumentDelimiter,
899
902
  TypeParameters,
900
903
  TypeParameter,
901
904
  TypeConstraint,
@@ -2800,7 +2803,7 @@ ${input.slice(result.pos)}
2800
2803
  }
2801
2804
  let blockPrefix;
2802
2805
  if (after.length) {
2803
- const spliceRef = module2.getSpliceRef();
2806
+ const spliceRef = module2.getRef("splice");
2804
2807
  blockPrefix = {
2805
2808
  children: ["[", module2.insertTrimmingSpace(after, ""), "] = ", spliceRef, ".call(", restIdentifier, ", -", after.length.toString(), ")"],
2806
2809
  names: after.flatMap((p) => p.names)
@@ -2815,6 +2818,7 @@ ${input.slice(result.pos)}
2815
2818
  { ...rest, children: rest.children.slice(0, -1) },
2816
2819
  close
2817
2820
  ],
2821
+ tp,
2818
2822
  names,
2819
2823
  blockPrefix
2820
2824
  };
@@ -2822,7 +2826,8 @@ ${input.slice(result.pos)}
2822
2826
  return {
2823
2827
  type: "Parameters",
2824
2828
  children: [tp, open, ...pes, close],
2825
- names: pes.flatMap((p) => p.names)
2829
+ names: pes.flatMap((p) => p.names),
2830
+ tp
2826
2831
  };
2827
2832
  });
2828
2833
  function NonEmptyParameters(state) {
@@ -3125,7 +3130,7 @@ ${input.slice(result.pos)}
3125
3130
  names.push(...restBinding.names);
3126
3131
  }
3127
3132
  if (after.length) {
3128
- const spliceRef = module2.getSpliceRef();
3133
+ const spliceRef = module2.getRef("splice");
3129
3134
  blockPrefix = {
3130
3135
  children: ["[", module2.insertTrimmingSpace(after, ""), "] = ", spliceRef, ".call(", restIdentifier, ", -", after.length.toString(), ")"],
3131
3136
  names: after.flatMap((p) => p.names)
@@ -3358,7 +3363,7 @@ ${input.slice(result.pos)}
3358
3363
  restIdentifier = restBinding.names[0];
3359
3364
  }
3360
3365
  if (after.length) {
3361
- const spliceRef = module2.getSpliceRef();
3366
+ const spliceRef = module2.getRef("splice");
3362
3367
  blockPrefix = {
3363
3368
  children: ["[", module2.insertTrimmingSpace(after, ""), "] = ", spliceRef, ".call(", restIdentifier, ", -", after.length.toString(), ")"],
3364
3369
  names: after.flatMap((p) => p.names)
@@ -5426,14 +5431,14 @@ ${input.slice(result.pos)}
5426
5431
  });
5427
5432
  var BinaryOpSymbol$29 = $TS($S(CoffeeOfEnabled, $EXPECT($L74, fail, 'BinaryOpSymbol "in"'), NonIdContinue), function($skip, $loc, $0, $1, $2, $3) {
5428
5433
  return {
5429
- ref: module2.getIndexOfRef(),
5434
+ ref: module2.getRef("indexOf"),
5430
5435
  suffix: " >= 0",
5431
5436
  special: true
5432
5437
  };
5433
5438
  });
5434
5439
  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
5440
  return {
5436
- ref: module2.getIndexOfRef(),
5441
+ ref: module2.getRef("indexOf"),
5437
5442
  suffix: " < 0",
5438
5443
  special: true
5439
5444
  };
@@ -6244,7 +6249,7 @@ ${input.slice(result.pos)}
6244
6249
  }
6245
6250
  if (declaration.own) {
6246
6251
  const indent2 = module2.currentIndent.token + " ";
6247
- const hasPropRef = module2.getHasPropRef();
6252
+ const hasPropRef = module2.getRef("hasProp");
6248
6253
  blockPrefix.push([indent2, "if (!", hasPropRef, ".call(", exp, ", ", declaration, ")) continue\n"]);
6249
6254
  }
6250
6255
  kind.token = "in";
@@ -10600,7 +10605,7 @@ ${input.slice(result.pos)}
10600
10605
  return result;
10601
10606
  }
10602
10607
  }
10603
- var JSXSelfClosingElement$0 = $S($EXPECT($L5, fail, 'JSXSelfClosingElement "<"'), $TEXT(JSXElementName), $E(JSXAttributes), __, $EXPECT($L147, fail, 'JSXSelfClosingElement "/>"'));
10608
+ var JSXSelfClosingElement$0 = $S($EXPECT($L5, fail, 'JSXSelfClosingElement "<"'), $TEXT(JSXElementName), $E(CompactTypeArguments), $E(JSXAttributes), __, $EXPECT($L147, fail, 'JSXSelfClosingElement "/>"'));
10604
10609
  function JSXSelfClosingElement(state) {
10605
10610
  if (state.events) {
10606
10611
  const result = state.events.enter?.("JSXSelfClosingElement", state);
@@ -10619,7 +10624,7 @@ ${input.slice(result.pos)}
10619
10624
  return result;
10620
10625
  }
10621
10626
  }
10622
- var JSXOpeningElement$0 = $S($EXPECT($L5, fail, 'JSXOpeningElement "<"'), $TEXT(JSXElementName), $E(JSXAttributes), __, $EXPECT($L27, fail, 'JSXOpeningElement ">"'));
10627
+ var JSXOpeningElement$0 = $S($EXPECT($L5, fail, 'JSXOpeningElement "<"'), $TEXT(JSXElementName), $E(CompactTypeArguments), $E(JSXAttributes), __, $EXPECT($L27, fail, 'JSXOpeningElement ">"'));
10623
10628
  function JSXOpeningElement(state) {
10624
10629
  if (state.events) {
10625
10630
  const result = state.events.enter?.("JSXOpeningElement", state);
@@ -10657,7 +10662,7 @@ ${input.slice(result.pos)}
10657
10662
  return result;
10658
10663
  }
10659
10664
  }
10660
- var JSXFragment$0 = $S($EXPECT($L149, fail, 'JSXFragment "<>"'), $E(JSXChildren), $EXPECT($L150, fail, 'JSXFragment "</>"'));
10665
+ var JSXFragment$0 = $S($EXPECT($L149, fail, 'JSXFragment "<>"'), $E(JSXChildren), __, $EXPECT($L150, fail, 'JSXFragment "</>"'));
10661
10666
  var JSXFragment$1 = $TS($S($EXPECT($L149, fail, 'JSXFragment "<>"'), JSXMixedChildren, InsertNewline, InsertIndent), function($skip, $loc, $0, $1, $2, $3, $4) {
10662
10667
  return [...$0, "</>"];
10663
10668
  });
@@ -11989,7 +11994,7 @@ ${input.slice(result.pos)}
11989
11994
  return result;
11990
11995
  }
11991
11996
  }
11992
- var TypeArguments$0 = $TS($S(__, $EXPECT($L5, fail, 'TypeArguments "<"'), __, Type, $Q($S(__, Comma, __, Type)), $E($S(__, Comma)), __, $EXPECT($L27, fail, 'TypeArguments ">"')), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8) {
11997
+ var TypeArguments$0 = $TS($S(__, $EXPECT($L5, fail, 'TypeArguments "<"'), $P(TypeArgument), __, $EXPECT($L27, fail, 'TypeArguments ">"')), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
11993
11998
  return { ts: true, children: $0 };
11994
11999
  });
11995
12000
  function TypeArguments(state) {
@@ -12010,9 +12015,74 @@ ${input.slice(result.pos)}
12010
12015
  return result;
12011
12016
  }
12012
12017
  }
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) {
12018
+ var CompactTypeArguments$0 = $TS($S($EXPECT($L5, fail, 'CompactTypeArguments "<"'), $P(TypeArgument), __, $EXPECT($L27, fail, 'CompactTypeArguments ">"')), function($skip, $loc, $0, $1, $2, $3, $4) {
12014
12019
  return { ts: true, children: $0 };
12015
12020
  });
12021
+ function CompactTypeArguments(state) {
12022
+ if (state.events) {
12023
+ const result = state.events.enter?.("CompactTypeArguments", state);
12024
+ if (result)
12025
+ return result.cache;
12026
+ }
12027
+ if (state.tokenize) {
12028
+ const result = $TOKEN("CompactTypeArguments", state, CompactTypeArguments$0(state));
12029
+ if (state.events)
12030
+ state.events.exit?.("CompactTypeArguments", state, result);
12031
+ return result;
12032
+ } else {
12033
+ const result = CompactTypeArguments$0(state);
12034
+ if (state.events)
12035
+ state.events.exit?.("CompactTypeArguments", state, result);
12036
+ return result;
12037
+ }
12038
+ }
12039
+ var TypeArgument$0 = $S(__, Type, TypeArgumentDelimiter);
12040
+ function TypeArgument(state) {
12041
+ if (state.events) {
12042
+ const result = state.events.enter?.("TypeArgument", state);
12043
+ if (result)
12044
+ return result.cache;
12045
+ }
12046
+ if (state.tokenize) {
12047
+ const result = $TOKEN("TypeArgument", state, TypeArgument$0(state));
12048
+ if (state.events)
12049
+ state.events.exit?.("TypeArgument", state, result);
12050
+ return result;
12051
+ } else {
12052
+ const result = TypeArgument$0(state);
12053
+ if (state.events)
12054
+ state.events.exit?.("TypeArgument", state, result);
12055
+ return result;
12056
+ }
12057
+ }
12058
+ var TypeArgumentDelimiter$0 = TypeParameterDelimiter;
12059
+ function TypeArgumentDelimiter(state) {
12060
+ if (state.events) {
12061
+ const result = state.events.enter?.("TypeArgumentDelimiter", state);
12062
+ if (result)
12063
+ return result.cache;
12064
+ }
12065
+ if (state.tokenize) {
12066
+ const result = $TOKEN("TypeArgumentDelimiter", state, TypeArgumentDelimiter$0(state));
12067
+ if (state.events)
12068
+ state.events.exit?.("TypeArgumentDelimiter", state, result);
12069
+ return result;
12070
+ } else {
12071
+ const result = TypeArgumentDelimiter$0(state);
12072
+ if (state.events)
12073
+ state.events.exit?.("TypeArgumentDelimiter", state, result);
12074
+ return result;
12075
+ }
12076
+ }
12077
+ var TypeParameters$0 = $TS($S(__, $EXPECT($L5, fail, 'TypeParameters "<"'), $P(TypeParameter), __, $EXPECT($L27, fail, 'TypeParameters ">"')), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
12078
+ var parameters = $3;
12079
+ return {
12080
+ type: "TypeParameters",
12081
+ parameters,
12082
+ ts: true,
12083
+ children: $0
12084
+ };
12085
+ });
12016
12086
  function TypeParameters(state) {
12017
12087
  if (state.events) {
12018
12088
  const result = state.events.enter?.("TypeParameters", state);
@@ -12897,51 +12967,48 @@ ${input.slice(result.pos)}
12897
12967
  tab: void 0,
12898
12968
  verbose: false
12899
12969
  };
12900
- let indexOfRef, hasPropRef, spliceRef;
12901
- const asAny = {
12970
+ module2.asAny = {
12902
12971
  ts: true,
12903
12972
  children: [" as any"]
12904
12973
  };
12905
12974
  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;
12975
+ const declareRef = {
12976
+ indexOf(indexOfRef) {
12977
+ const typeSuffix = {
12978
+ ts: true,
12979
+ children: [": <T>(this: T[], searchElement: T) => boolean"]
12980
+ };
12981
+ module2.prelude.push(["", ["const ", indexOfRef, typeSuffix, " = [].indexOf", module2.asAny, "\n"]]);
12982
+ },
12983
+ hasProp(hasPropRef) {
12984
+ const typeSuffix = {
12985
+ ts: true,
12986
+ children: [": <T>(this: T, prop: keyof T) => boolean"]
12987
+ };
12988
+ module2.prelude.push(["", ["const ", hasPropRef, typeSuffix, " = {}.hasOwnProperty", module2.asAny, "\n"]]);
12989
+ }
12930
12990
  };
12931
- module2.getHasPropRef = function() {
12932
- if (hasPropRef)
12933
- return hasPropRef;
12934
- hasPropRef = {
12991
+ const refs = {};
12992
+ module2.getRef = function(base) {
12993
+ if (refs.hasOwnProperty(base))
12994
+ return refs[base];
12995
+ const ref = {
12935
12996
  type: "Ref",
12936
- base: "hasProp",
12937
- id: "hasProp"
12997
+ base,
12998
+ id: base
12938
12999
  };
12939
- const typeSuffix = {
12940
- ts: true,
12941
- children: [": <T>(this: T, prop: keyof T) => boolean"]
12942
- };
12943
- module2.prelude.push(["", ["const ", hasPropRef, typeSuffix, " = {}.hasOwnProperty", asAny, "\n"]]);
12944
- return hasPropRef;
13000
+ if (declareRef.hasOwnProperty(base))
13001
+ declareRef[base](ref);
13002
+ return refs[base] = ref;
13003
+ };
13004
+ module2.typeOfJSXElement = function($12) {
13005
+ if (module2.config.solid) {
13006
+ let open = $12;
13007
+ while (Array.isArray(open[0]))
13008
+ open = open[0];
13009
+ open = open[1];
13010
+ return typeof open === "string" && open[0] === open[0].toLowerCase() ? [module2.getRef("IntrinsicElements"), '<"', open, '">'] : ["ReturnType<typeof ", open, ">"];
13011
+ }
12945
13012
  };
12946
13013
  Object.defineProperty(module2.config, "coffeeCompat", {
12947
13014
  set(b) {
@@ -13518,7 +13585,10 @@ ${input.slice(result.pos)}
13518
13585
  return nodes;
13519
13586
  }
13520
13587
  function processParams(f) {
13521
- const { parameters, block } = f;
13588
+ const { type, parameters, block } = f;
13589
+ if (type === "ArrowFunction" && parameters && parameters.tp && parameters.tp.parameters.length === 1) {
13590
+ parameters.tp.parameters.push(",");
13591
+ }
13522
13592
  if (!block)
13523
13593
  return;
13524
13594
  const { expressions } = block;
@@ -13651,17 +13721,13 @@ ${input.slice(result.pos)}
13651
13721
  });
13652
13722
  }
13653
13723
  function checkSpliceRef(statements) {
13654
- const spliceRef = module2.getSpliceRef();
13724
+ const spliceRef = module2.getRef("splice");
13655
13725
  if (gatherRecursiveAll(statements, (n) => n === spliceRef).length) {
13656
13726
  const typeSuffix = {
13657
13727
  ts: true,
13658
13728
  children: [": <T>(this: T[], start: number, deleteCount?: number) => T[]"]
13659
13729
  };
13660
- const asAny = {
13661
- ts: true,
13662
- children: [" as any"]
13663
- };
13664
- module2.prelude.push(["", ["const ", spliceRef, typeSuffix, " = [].splice", asAny, "\n"]]);
13730
+ module2.prelude.push(["", ["const ", spliceRef, typeSuffix, " = [].splice", module2.asAny, "\n"]]);
13665
13731
  }
13666
13732
  }
13667
13733
  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.4",
4
4
  "description": "CoffeeScript style syntax for TypeScript",
5
5
  "main": "dist/main.js",
6
6
  "exports": {
@@ -75,4 +75,4 @@
75
75
  "test"
76
76
  ]
77
77
  }
78
- }
78
+ }