@danielx/civet 0.7.17 → 0.7.18

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
@@ -16,13 +16,14 @@ The modern way to write TypeScript.
16
16
  - [Civet VSCode Extension](https://marketplace.visualstudio.com/items?itemName=DanielX.civet)
17
17
  - [Discord Server](https://discord.gg/xkrW9GebBc)
18
18
  - Plugins for
19
- [Vite, esbuild, Astro, Rollup, Webpack, Rspack](integration/unplugin)
19
+ [Vite, esbuild, Astro, Rollup, Webpack, Rspack](source/unplugin),
20
20
  <!--
21
21
  [esbuild](source/esbuild-plugin.civet),
22
22
  [Vite](https://github.com/edemaine/vite-plugin-civet),
23
23
  -->
24
24
  [ESM/CJS loader](source/esm.civet),
25
25
  [Babel](source/babel-plugin.mjs),
26
+ [Jest](https://github.com/DanielXMoore/Civet/blob/main/integration/jest),
26
27
  [Gulp](integration/gulp),
27
28
  [Bun](source/bun-civet.civet)
28
29
  - Starter templates for [Solid](https://github.com/orenelbaum/solid-civet-template) and [Solid Start](https://github.com/orenelbaum/solid-start-civet-template)
package/dist/browser.js CHANGED
@@ -5653,6 +5653,7 @@ ${js}`
5653
5653
  }
5654
5654
  }
5655
5655
  }
5656
+ const refsToDeclare = /* @__PURE__ */ new Set();
5656
5657
  i = len3 - 1;
5657
5658
  while (i >= 0) {
5658
5659
  const lastAssignment = $1[i];
@@ -5686,6 +5687,7 @@ ${js}`
5686
5687
  }
5687
5688
  } else if (m2 = lhs.type, m2 === "ObjectBindingPattern" || m2 === "ArrayBindingPattern") {
5688
5689
  processBindingPatternLHS(lhs, tail);
5690
+ gatherRecursiveAll(lhs, ($5) => $5.type === "Ref").forEach(refsToDeclare.add.bind(refsToDeclare));
5689
5691
  }
5690
5692
  }
5691
5693
  i--;
@@ -5716,6 +5718,17 @@ ${js}`
5716
5718
  }
5717
5719
  i--;
5718
5720
  }
5721
+ if (refsToDeclare.size) {
5722
+ if (exp.hoistDec) {
5723
+ exp.hoistDec.children.push([...refsToDeclare].map(($6) => [",", $6]));
5724
+ } else {
5725
+ exp.hoistDec = {
5726
+ type: "Declaration",
5727
+ children: ["let ", [...refsToDeclare].map((r, i2) => i2 ? [",", r] : r)],
5728
+ names: []
5729
+ };
5730
+ }
5731
+ }
5719
5732
  exp.names = $1.flatMap(([, l]) => l.names || []);
5720
5733
  if (tail.length) {
5721
5734
  const index = exp.children.indexOf($2);
@@ -5852,7 +5865,7 @@ ${js}`
5852
5865
  });
5853
5866
  }
5854
5867
  function processStatementExpressions(statements) {
5855
- gatherRecursiveAll(statements, ($5) => $5.type === "StatementExpression").forEach((_exp) => {
5868
+ gatherRecursiveAll(statements, ($7) => $7.type === "StatementExpression").forEach((_exp) => {
5856
5869
  const exp = _exp;
5857
5870
  const { statement } = exp;
5858
5871
  let ref11;
@@ -5982,11 +5995,11 @@ ${js}`
5982
5995
  function processPlaceholders(statements) {
5983
5996
  const placeholderMap = /* @__PURE__ */ new Map();
5984
5997
  const liftedIfs = /* @__PURE__ */ new Set();
5985
- gatherRecursiveAll(statements, ($6) => $6.type === "Placeholder").forEach((_exp) => {
5998
+ gatherRecursiveAll(statements, ($8) => $8.type === "Placeholder").forEach((_exp) => {
5986
5999
  const exp = _exp;
5987
6000
  let ancestor;
5988
6001
  if (exp.subtype === ".") {
5989
- ({ ancestor } = findAncestor(exp, ($7) => $7.type === "Call"));
6002
+ ({ ancestor } = findAncestor(exp, ($9) => $9.type === "Call"));
5990
6003
  ancestor = ancestor?.parent;
5991
6004
  while (ancestor?.parent?.type === "UnaryExpression" || ancestor?.parent?.type === "NewExpression") {
5992
6005
  ancestor = ancestor.parent;
package/dist/civet CHANGED
@@ -516,10 +516,17 @@ You can override this behavior via: --civet rewriteCivetImports=.ext
516
516
  options.config ??= await (0, import_config.findConfig)(process.cwd());
517
517
  }
518
518
  if (options.config) {
519
+ const parsed = await (0, import_config.loadConfig)(options.config);
519
520
  options = {
520
- ...await (0, import_config.loadConfig)(options.config),
521
+ ...parsed,
521
522
  ...options
522
523
  };
524
+ if (parsed.parseOptions && options.parseOptions) {
525
+ options.parseOptions = {
526
+ ...parsed.parseOptions,
527
+ ...options.parseOptions
528
+ };
529
+ }
523
530
  }
524
531
  if (options.typescript) {
525
532
  const unpluginOptions = {
package/dist/main.js CHANGED
@@ -5631,6 +5631,7 @@ function processAssignments(statements) {
5631
5631
  }
5632
5632
  }
5633
5633
  }
5634
+ const refsToDeclare = /* @__PURE__ */ new Set();
5634
5635
  i = len3 - 1;
5635
5636
  while (i >= 0) {
5636
5637
  const lastAssignment = $1[i];
@@ -5664,6 +5665,7 @@ function processAssignments(statements) {
5664
5665
  }
5665
5666
  } else if (m2 = lhs.type, m2 === "ObjectBindingPattern" || m2 === "ArrayBindingPattern") {
5666
5667
  processBindingPatternLHS(lhs, tail);
5668
+ gatherRecursiveAll(lhs, ($5) => $5.type === "Ref").forEach(refsToDeclare.add.bind(refsToDeclare));
5667
5669
  }
5668
5670
  }
5669
5671
  i--;
@@ -5694,6 +5696,17 @@ function processAssignments(statements) {
5694
5696
  }
5695
5697
  i--;
5696
5698
  }
5699
+ if (refsToDeclare.size) {
5700
+ if (exp.hoistDec) {
5701
+ exp.hoistDec.children.push([...refsToDeclare].map(($6) => [",", $6]));
5702
+ } else {
5703
+ exp.hoistDec = {
5704
+ type: "Declaration",
5705
+ children: ["let ", [...refsToDeclare].map((r, i2) => i2 ? [",", r] : r)],
5706
+ names: []
5707
+ };
5708
+ }
5709
+ }
5697
5710
  exp.names = $1.flatMap(([, l]) => l.names || []);
5698
5711
  if (tail.length) {
5699
5712
  const index = exp.children.indexOf($2);
@@ -5830,7 +5843,7 @@ function processTypes(node) {
5830
5843
  });
5831
5844
  }
5832
5845
  function processStatementExpressions(statements) {
5833
- gatherRecursiveAll(statements, ($5) => $5.type === "StatementExpression").forEach((_exp) => {
5846
+ gatherRecursiveAll(statements, ($7) => $7.type === "StatementExpression").forEach((_exp) => {
5834
5847
  const exp = _exp;
5835
5848
  const { statement } = exp;
5836
5849
  let ref11;
@@ -5960,11 +5973,11 @@ function populateRefs(statements) {
5960
5973
  function processPlaceholders(statements) {
5961
5974
  const placeholderMap = /* @__PURE__ */ new Map();
5962
5975
  const liftedIfs = /* @__PURE__ */ new Set();
5963
- gatherRecursiveAll(statements, ($6) => $6.type === "Placeholder").forEach((_exp) => {
5976
+ gatherRecursiveAll(statements, ($8) => $8.type === "Placeholder").forEach((_exp) => {
5964
5977
  const exp = _exp;
5965
5978
  let ancestor;
5966
5979
  if (exp.subtype === ".") {
5967
- ({ ancestor } = findAncestor(exp, ($7) => $7.type === "Call"));
5980
+ ({ ancestor } = findAncestor(exp, ($9) => $9.type === "Call"));
5968
5981
  ancestor = ancestor?.parent;
5969
5982
  while (ancestor?.parent?.type === "UnaryExpression" || ancestor?.parent?.type === "NewExpression") {
5970
5983
  ancestor = ancestor.parent;
package/dist/main.mjs CHANGED
@@ -5611,6 +5611,7 @@ function processAssignments(statements) {
5611
5611
  }
5612
5612
  }
5613
5613
  }
5614
+ const refsToDeclare = /* @__PURE__ */ new Set();
5614
5615
  i = len3 - 1;
5615
5616
  while (i >= 0) {
5616
5617
  const lastAssignment = $1[i];
@@ -5644,6 +5645,7 @@ function processAssignments(statements) {
5644
5645
  }
5645
5646
  } else if (m2 = lhs.type, m2 === "ObjectBindingPattern" || m2 === "ArrayBindingPattern") {
5646
5647
  processBindingPatternLHS(lhs, tail);
5648
+ gatherRecursiveAll(lhs, ($5) => $5.type === "Ref").forEach(refsToDeclare.add.bind(refsToDeclare));
5647
5649
  }
5648
5650
  }
5649
5651
  i--;
@@ -5674,6 +5676,17 @@ function processAssignments(statements) {
5674
5676
  }
5675
5677
  i--;
5676
5678
  }
5679
+ if (refsToDeclare.size) {
5680
+ if (exp.hoistDec) {
5681
+ exp.hoistDec.children.push([...refsToDeclare].map(($6) => [",", $6]));
5682
+ } else {
5683
+ exp.hoistDec = {
5684
+ type: "Declaration",
5685
+ children: ["let ", [...refsToDeclare].map((r, i2) => i2 ? [",", r] : r)],
5686
+ names: []
5687
+ };
5688
+ }
5689
+ }
5677
5690
  exp.names = $1.flatMap(([, l]) => l.names || []);
5678
5691
  if (tail.length) {
5679
5692
  const index = exp.children.indexOf($2);
@@ -5810,7 +5823,7 @@ function processTypes(node) {
5810
5823
  });
5811
5824
  }
5812
5825
  function processStatementExpressions(statements) {
5813
- gatherRecursiveAll(statements, ($5) => $5.type === "StatementExpression").forEach((_exp) => {
5826
+ gatherRecursiveAll(statements, ($7) => $7.type === "StatementExpression").forEach((_exp) => {
5814
5827
  const exp = _exp;
5815
5828
  const { statement } = exp;
5816
5829
  let ref11;
@@ -5940,11 +5953,11 @@ function populateRefs(statements) {
5940
5953
  function processPlaceholders(statements) {
5941
5954
  const placeholderMap = /* @__PURE__ */ new Map();
5942
5955
  const liftedIfs = /* @__PURE__ */ new Set();
5943
- gatherRecursiveAll(statements, ($6) => $6.type === "Placeholder").forEach((_exp) => {
5956
+ gatherRecursiveAll(statements, ($8) => $8.type === "Placeholder").forEach((_exp) => {
5944
5957
  const exp = _exp;
5945
5958
  let ancestor;
5946
5959
  if (exp.subtype === ".") {
5947
- ({ ancestor } = findAncestor(exp, ($7) => $7.type === "Call"));
5960
+ ({ ancestor } = findAncestor(exp, ($9) => $9.type === "Call"));
5948
5961
  ancestor = ancestor?.parent;
5949
5962
  while (ancestor?.parent?.type === "UnaryExpression" || ancestor?.parent?.type === "NewExpression") {
5950
5963
  ancestor = ancestor.parent;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@danielx/civet",
3
3
  "type": "commonjs",
4
- "version": "0.7.17",
4
+ "version": "0.7.18",
5
5
  "description": "CoffeeScript style syntax for TypeScript",
6
6
  "main": "dist/main.js",
7
7
  "module": "dist/main.mjs",