@danielx/civet 0.10.2 → 0.10.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/dist/main.js CHANGED
@@ -483,7 +483,7 @@ ${body}`;
483
483
  }
484
484
  });
485
485
 
486
- // unplugin-civet:/home/daniel/apps/Civet/source/main.civet.jsx
486
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\main.civet.jsx
487
487
  var main_civet_exports = {};
488
488
  __export(main_civet_exports, {
489
489
  ParseError: () => import_lib2.ParseError,
@@ -504,7 +504,7 @@ module.exports = __toCommonJS(main_civet_exports);
504
504
  // source/parser.hera
505
505
  var import_lib2 = __toESM(require_machine());
506
506
 
507
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/lib.civet.jsx
507
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\lib.civet.jsx
508
508
  var lib_civet_exports = {};
509
509
  __export(lib_civet_exports, {
510
510
  addPostfixStatement: () => addPostfixStatement,
@@ -584,7 +584,7 @@ __export(lib_civet_exports, {
584
584
  wrapTypeInPromise: () => wrapTypeInPromise
585
585
  });
586
586
 
587
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/util.civet.jsx
587
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\util.civet.jsx
588
588
  function len(arr, length) {
589
589
  return arr.length === length;
590
590
  }
@@ -1488,6 +1488,8 @@ function wrapIIFE(expressions, asyncFlag, generatorStar) {
1488
1488
  },
1489
1489
  parameters,
1490
1490
  returnType: void 0,
1491
+ implicitReturn: true,
1492
+ // force implicit return in IIFE
1491
1493
  children: generator.length ? [async, "function", generator, parameters] : [async, parameters]
1492
1494
  };
1493
1495
  let fn;
@@ -1583,7 +1585,7 @@ function flatJoin(array, separator) {
1583
1585
  return result;
1584
1586
  }
1585
1587
 
1586
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/traversal.civet.jsx
1588
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\traversal.civet.jsx
1587
1589
  function gatherRecursiveWithinFunction(node, predicate) {
1588
1590
  return gatherRecursive(node, predicate, isFunction);
1589
1591
  }
@@ -1692,7 +1694,7 @@ function gatherRecursiveAll(node, predicate) {
1692
1694
  return nodes;
1693
1695
  }
1694
1696
 
1695
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/ref.civet.jsx
1697
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\ref.civet.jsx
1696
1698
  var range = (start, end) => {
1697
1699
  const length = end - start;
1698
1700
  if (length <= 0) return [];
@@ -1787,7 +1789,7 @@ function populateRefs(statements) {
1787
1789
  }
1788
1790
  }
1789
1791
 
1790
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/binding.civet.jsx
1792
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\binding.civet.jsx
1791
1793
  function adjustAtBindings(statements, asThis = false) {
1792
1794
  for (let ref1 = gatherRecursiveAll(statements, ($1) => $1.type === "AtBindingProperty"), i1 = 0, len3 = ref1.length; i1 < len3; i1++) {
1793
1795
  const binding = ref1[i1];
@@ -2054,12 +2056,12 @@ function gatherBindingPatternTypeSuffix(pattern) {
2054
2056
  return pattern;
2055
2057
  }
2056
2058
 
2057
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/comptime.civet.jsx
2059
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\comptime.civet.jsx
2058
2060
  var import_node_path = require("node:path");
2059
2061
  var import_node_module = require("node:module");
2060
2062
  var import_node_vm = __toESM(require("node:vm"));
2061
2063
 
2062
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/helper.civet.jsx
2064
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\helper.civet.jsx
2063
2065
  var preludeVar = "var ";
2064
2066
  function ts(children) {
2065
2067
  return {
@@ -2376,7 +2378,7 @@ function extractPreludeFor(node) {
2376
2378
  }
2377
2379
  }
2378
2380
 
2379
- // unplugin-civet:/home/daniel/apps/Civet/source/generate.civet.jsx
2381
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\generate.civet.jsx
2380
2382
  function stringify(node) {
2381
2383
  try {
2382
2384
  return JSON.stringify(removeParentPointers(node));
@@ -2486,7 +2488,7 @@ function prune(node) {
2486
2488
  return node;
2487
2489
  }
2488
2490
 
2489
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/comptime.civet.jsx
2491
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\comptime.civet.jsx
2490
2492
  function expressionizeComptime(statement) {
2491
2493
  const { expressions } = statement.block;
2492
2494
  const expression = wrapIIFE(expressions, hasAwait(expressions));
@@ -2807,7 +2809,7 @@ function serialize(value, context) {
2807
2809
  return recurse(value);
2808
2810
  }
2809
2811
 
2810
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/function.civet.jsx
2812
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\function.civet.jsx
2811
2813
  var concatAssign = (lhs, rhs) => (rhs?.[Symbol.isConcatSpreadable] ?? Array.isArray(rhs) ? lhs.push.apply(lhs, rhs) : lhs.push(rhs), lhs);
2812
2814
  function getTypeArguments(args) {
2813
2815
  while (typeof args === "object" && args != null && "args" in args) {
@@ -2895,7 +2897,7 @@ function processReturn(f, implicitReturns) {
2895
2897
  if (returnType && returnType.optional) {
2896
2898
  convertOptionalType(returnType);
2897
2899
  }
2898
- if (!processReturnValue(f) && implicitReturns) {
2900
+ if (!processReturnValue(f) && (implicitReturns || f.signature.implicitReturn)) {
2899
2901
  const { signature, block } = f;
2900
2902
  const { modifier, name, returnType: returnType2 } = signature;
2901
2903
  const { async, generator, set } = modifier;
@@ -4240,7 +4242,7 @@ function makeAmpersandFunction(rhs) {
4240
4242
  return fn;
4241
4243
  }
4242
4244
 
4243
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/block.civet.jsx
4245
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\block.civet.jsx
4244
4246
  function blockWithPrefix(prefixStatements, block) {
4245
4247
  if (prefixStatements && prefixStatements.length) {
4246
4248
  const expressions = [...prefixStatements, ...block.expressions];
@@ -4461,7 +4463,7 @@ function blockContainingStatement(exp) {
4461
4463
  };
4462
4464
  }
4463
4465
 
4464
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/op.civet.jsx
4466
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\op.civet.jsx
4465
4467
  var precedenceOrder = [
4466
4468
  ["||", "??"],
4467
4469
  ["^^"],
@@ -4797,7 +4799,7 @@ function expandChainedComparisons([first, binops]) {
4797
4799
  }
4798
4800
  }
4799
4801
 
4800
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/pattern-matching.civet.jsx
4802
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\pattern-matching.civet.jsx
4801
4803
  function processPatternTest(lhs, patterns) {
4802
4804
  const { ref, refAssignmentComma } = maybeRefAssignment(lhs, "m");
4803
4805
  const conditionExpression = flatJoin(patterns.map(($1) => getPatternConditions($1, ref)).map(($2) => flatJoin($2, " && ")), " || ");
@@ -5316,7 +5318,7 @@ function aliasBinding(p, ref) {
5316
5318
  }
5317
5319
  }
5318
5320
 
5319
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/declaration.civet.jsx
5321
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\declaration.civet.jsx
5320
5322
  function len2(arr, length) {
5321
5323
  return arr.length === length;
5322
5324
  }
@@ -5870,7 +5872,7 @@ function convertWithClause(withClause, extendsClause) {
5870
5872
  return [extendsToken, insertTrimmingSpace(ws, " "), wrapped];
5871
5873
  }
5872
5874
 
5873
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/unary.civet.jsx
5875
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\unary.civet.jsx
5874
5876
  function processUnaryExpression(pre, exp, post) {
5875
5877
  if (!(pre.length || post)) {
5876
5878
  return exp;
@@ -6032,7 +6034,7 @@ function processUnaryNestedExpression(pre, args, post) {
6032
6034
  return processUnaryExpression(pre, args, post);
6033
6035
  }
6034
6036
 
6035
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/pipe.civet.jsx
6037
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\pipe.civet.jsx
6036
6038
  function constructInvocation(fn, arg) {
6037
6039
  let expr = fn.expr;
6038
6040
  while (expr.type === "ParenthesizedExpression") {
@@ -6255,7 +6257,7 @@ function processPipelineExpressions(statements) {
6255
6257
  }
6256
6258
  }
6257
6259
 
6258
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/for.civet.jsx
6260
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\for.civet.jsx
6259
6261
  function processRangeExpression(start, ws1, range2, end) {
6260
6262
  ws1 = [ws1, range2.children[0]];
6261
6263
  const ws2 = range2.children[1];
@@ -6700,7 +6702,7 @@ function processForInOf($0) {
6700
6702
  };
6701
6703
  }
6702
6704
 
6703
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/auto-dec.civet.jsx
6705
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\auto-dec.civet.jsx
6704
6706
  var concatAssign2 = (lhs, rhs) => (rhs?.[Symbol.isConcatSpreadable] ?? Array.isArray(rhs) ? lhs.push.apply(lhs, rhs) : lhs.push(rhs), lhs);
6705
6707
  function findDecs(statements) {
6706
6708
  const declarations = gatherNodes(statements, ($) => $.type === "Declaration");
@@ -6846,7 +6848,7 @@ function createVarDecs(block, scopes, pushVar) {
6846
6848
  scopes.pop();
6847
6849
  }
6848
6850
 
6849
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/string.civet.jsx
6851
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\string.civet.jsx
6850
6852
  function getIndentLevel(str, tab) {
6851
6853
  if (tab != null && tab != 1) {
6852
6854
  const tabs = str.match(/\t/g);
@@ -7014,7 +7016,7 @@ function quoteString(str) {
7014
7016
  return JSON.stringify(str);
7015
7017
  }
7016
7018
 
7017
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/lib.civet.jsx
7019
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\lib.civet.jsx
7018
7020
  var xor = (a, b) => a ? !b && a : b;
7019
7021
  function addPostfixStatement(statement, ws, post) {
7020
7022
  const expressions = [
@@ -11374,23 +11376,30 @@ var NestedClassElement$0 = (0, import_lib2.$S)(Nested, ClassElement, StatementDe
11374
11376
  function NestedClassElement(ctx, state2) {
11375
11377
  return (0, import_lib2.$EVENT)(ctx, state2, "NestedClassElement", NestedClassElement$0);
11376
11378
  }
11377
- var ClassElement$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(Decorators), (0, import_lib2.$E)(AccessModifier), (0, import_lib2.$E)((0, import_lib2.$S)(Static, (0, import_lib2.$E)(_))), (0, import_lib2.$E)((0, import_lib2.$S)(Override, (0, import_lib2.$E)(_))), ClassElementDefinition), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
11379
+ var ClassElement$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(Decorators), (0, import_lib2.$E)((0, import_lib2.$S)(Declare, (0, import_lib2.$E)(_))), (0, import_lib2.$E)(AccessModifier), (0, import_lib2.$E)((0, import_lib2.$S)(Static, (0, import_lib2.$E)(_))), (0, import_lib2.$E)((0, import_lib2.$S)(Override, (0, import_lib2.$E)(_))), ClassElementDefinition), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
11378
11380
  var decorators = $1;
11379
- var definition = $5;
11381
+ var declare = $2;
11382
+ var access = $3;
11383
+ var static_ = $4;
11384
+ var override = $5;
11385
+ var definition = $6;
11386
+ const ts2 = definition.ts || !!declare;
11380
11387
  if (definition.type === "MultiMethodDefinition") {
11381
11388
  return {
11382
11389
  ...definition,
11390
+ ts: ts2,
11383
11391
  children: definition.children.map((c) => {
11384
11392
  return {
11385
11393
  ...c,
11386
- children: [decorators, ...c.children]
11394
+ children: [decorators, declare, access, static_, override, ...c.children]
11387
11395
  };
11388
11396
  })
11389
11397
  };
11390
11398
  }
11391
11399
  return {
11392
11400
  ...definition,
11393
- children: [decorators, $2, $3, $4, ...definition.children]
11401
+ ts: ts2,
11402
+ children: [decorators, declare, access, static_, override, ...definition.children]
11394
11403
  };
11395
11404
  });
11396
11405
  var ClassElement$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(Static, BracedBlock), function($skip, $loc, $0, $1, $2) {
@@ -12356,7 +12365,15 @@ var AtIdentifierRef$$ = [AtIdentifierRef$0, AtIdentifierRef$1];
12356
12365
  function AtIdentifierRef(ctx, state2) {
12357
12366
  return (0, import_lib2.$EVENT_C)(ctx, state2, "AtIdentifierRef", AtIdentifierRef$$);
12358
12367
  }
12359
- var PinPattern$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Caret, SingleLineExpressionWithIndentedApplicationForbidden), function($skip, $loc, $0, $1, $2) {
12368
+ var PinPattern$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Caret, IdentifierName, (0, import_lib2.$Y)(Colon)), function($skip, $loc, $0, $1, $2, $3) {
12369
+ var expression = $2;
12370
+ return {
12371
+ type: "PinPattern",
12372
+ children: [expression],
12373
+ expression
12374
+ };
12375
+ });
12376
+ var PinPattern$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(Caret, SingleLineExpressionWithIndentedApplicationForbidden), function($skip, $loc, $0, $1, $2) {
12360
12377
  var expression = $2;
12361
12378
  return {
12362
12379
  type: "PinPattern",
@@ -12364,7 +12381,7 @@ var PinPattern$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Caret, SingleLineExp
12364
12381
  expression
12365
12382
  };
12366
12383
  });
12367
- var PinPattern$1 = (0, import_lib2.$TV)(ActualMemberExpression, function($skip, $loc, $0, $1) {
12384
+ var PinPattern$2 = (0, import_lib2.$TV)(ActualMemberExpression, function($skip, $loc, $0, $1) {
12368
12385
  var expression = $0;
12369
12386
  return {
12370
12387
  type: "PinPattern",
@@ -12372,7 +12389,7 @@ var PinPattern$1 = (0, import_lib2.$TV)(ActualMemberExpression, function($skip,
12372
12389
  expression
12373
12390
  };
12374
12391
  });
12375
- var PinPattern$2 = (0, import_lib2.$TV)((0, import_lib2.$S)((0, import_lib2.$EXPECT)($R14, "PinPattern /[+-]/"), NumericLiteral), function($skip, $loc, $0, $1) {
12392
+ var PinPattern$3 = (0, import_lib2.$TV)((0, import_lib2.$S)((0, import_lib2.$EXPECT)($R14, "PinPattern /[+-]/"), NumericLiteral), function($skip, $loc, $0, $1) {
12376
12393
  var expression = $0;
12377
12394
  return {
12378
12395
  type: "PinPattern",
@@ -12380,7 +12397,7 @@ var PinPattern$2 = (0, import_lib2.$TV)((0, import_lib2.$S)((0, import_lib2.$EXP
12380
12397
  expression
12381
12398
  };
12382
12399
  });
12383
- var PinPattern$3 = (0, import_lib2.$TV)(Undefined, function($skip, $loc, $0, $1) {
12400
+ var PinPattern$4 = (0, import_lib2.$TV)(Undefined, function($skip, $loc, $0, $1) {
12384
12401
  var expression = $0;
12385
12402
  return {
12386
12403
  type: "PinPattern",
@@ -12388,7 +12405,7 @@ var PinPattern$3 = (0, import_lib2.$TV)(Undefined, function($skip, $loc, $0, $1)
12388
12405
  expression
12389
12406
  };
12390
12407
  });
12391
- var PinPattern$$ = [PinPattern$0, PinPattern$1, PinPattern$2, PinPattern$3];
12408
+ var PinPattern$$ = [PinPattern$0, PinPattern$1, PinPattern$2, PinPattern$3, PinPattern$4];
12392
12409
  function PinPattern(ctx, state2) {
12393
12410
  return (0, import_lib2.$EVENT_C)(ctx, state2, "PinPattern", PinPattern$$);
12394
12411
  }
@@ -21168,7 +21185,7 @@ var wellKnownSymbols = [
21168
21185
  "unscopables"
21169
21186
  ];
21170
21187
 
21171
- // unplugin-civet:/home/daniel/apps/Civet/source/sourcemap.civet.jsx
21188
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\sourcemap.civet.jsx
21172
21189
  var sourcemap_civet_exports = {};
21173
21190
  __export(sourcemap_civet_exports, {
21174
21191
  SourceMap: () => SourceMap,
@@ -21482,7 +21499,7 @@ var remapPosition = function(position, sourcemapLines) {
21482
21499
  }
21483
21500
  };
21484
21501
 
21485
- // unplugin-civet:/home/daniel/apps/Civet/source/state-cache.civet.jsx
21502
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\state-cache.civet.jsx
21486
21503
  var StateCache = class {
21487
21504
  cache = /* @__PURE__ */ new Map();
21488
21505
  get(key) {
@@ -21522,7 +21539,7 @@ var StateCache = class {
21522
21539
  }
21523
21540
  };
21524
21541
 
21525
- // unplugin-civet:/home/daniel/apps/Civet/source/worker-pool.civet.jsx
21542
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\worker-pool.civet.jsx
21526
21543
  var WorkerPool = class {
21527
21544
  idle;
21528
21545
  spawned;
@@ -21618,7 +21635,7 @@ var WorkerPool = class {
21618
21635
  }
21619
21636
  };
21620
21637
 
21621
- // unplugin-civet:/home/daniel/apps/Civet/source/main.civet.jsx
21638
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\main.civet.jsx
21622
21639
  var { SourceMap: SourceMap2 } = sourcemap_civet_exports;
21623
21640
  var ParseErrors = class extends Error {
21624
21641
  name = "ParseErrors";
package/dist/main.mjs CHANGED
@@ -485,7 +485,7 @@ ${body}`;
485
485
  // source/parser.hera
486
486
  var import_lib2 = __toESM(require_machine());
487
487
 
488
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/lib.civet.jsx
488
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\lib.civet.jsx
489
489
  var lib_civet_exports = {};
490
490
  __export(lib_civet_exports, {
491
491
  addPostfixStatement: () => addPostfixStatement,
@@ -565,7 +565,7 @@ __export(lib_civet_exports, {
565
565
  wrapTypeInPromise: () => wrapTypeInPromise
566
566
  });
567
567
 
568
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/util.civet.jsx
568
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\util.civet.jsx
569
569
  function len(arr, length) {
570
570
  return arr.length === length;
571
571
  }
@@ -1469,6 +1469,8 @@ function wrapIIFE(expressions, asyncFlag, generatorStar) {
1469
1469
  },
1470
1470
  parameters,
1471
1471
  returnType: void 0,
1472
+ implicitReturn: true,
1473
+ // force implicit return in IIFE
1472
1474
  children: generator.length ? [async, "function", generator, parameters] : [async, parameters]
1473
1475
  };
1474
1476
  let fn;
@@ -1564,7 +1566,7 @@ function flatJoin(array, separator) {
1564
1566
  return result;
1565
1567
  }
1566
1568
 
1567
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/traversal.civet.jsx
1569
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\traversal.civet.jsx
1568
1570
  function gatherRecursiveWithinFunction(node, predicate) {
1569
1571
  return gatherRecursive(node, predicate, isFunction);
1570
1572
  }
@@ -1673,7 +1675,7 @@ function gatherRecursiveAll(node, predicate) {
1673
1675
  return nodes;
1674
1676
  }
1675
1677
 
1676
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/ref.civet.jsx
1678
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\ref.civet.jsx
1677
1679
  var range = (start, end) => {
1678
1680
  const length = end - start;
1679
1681
  if (length <= 0) return [];
@@ -1768,7 +1770,7 @@ function populateRefs(statements) {
1768
1770
  }
1769
1771
  }
1770
1772
 
1771
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/binding.civet.jsx
1773
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\binding.civet.jsx
1772
1774
  function adjustAtBindings(statements, asThis = false) {
1773
1775
  for (let ref1 = gatherRecursiveAll(statements, ($1) => $1.type === "AtBindingProperty"), i1 = 0, len3 = ref1.length; i1 < len3; i1++) {
1774
1776
  const binding = ref1[i1];
@@ -2035,12 +2037,12 @@ function gatherBindingPatternTypeSuffix(pattern) {
2035
2037
  return pattern;
2036
2038
  }
2037
2039
 
2038
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/comptime.civet.jsx
2040
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\comptime.civet.jsx
2039
2041
  import { resolve, dirname } from "node:path";
2040
2042
  import { createRequire } from "node:module";
2041
2043
  import vm from "node:vm";
2042
2044
 
2043
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/helper.civet.jsx
2045
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\helper.civet.jsx
2044
2046
  var preludeVar = "var ";
2045
2047
  function ts(children) {
2046
2048
  return {
@@ -2357,7 +2359,7 @@ function extractPreludeFor(node) {
2357
2359
  }
2358
2360
  }
2359
2361
 
2360
- // unplugin-civet:/home/daniel/apps/Civet/source/generate.civet.jsx
2362
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\generate.civet.jsx
2361
2363
  function stringify(node) {
2362
2364
  try {
2363
2365
  return JSON.stringify(removeParentPointers(node));
@@ -2467,7 +2469,7 @@ function prune(node) {
2467
2469
  return node;
2468
2470
  }
2469
2471
 
2470
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/comptime.civet.jsx
2472
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\comptime.civet.jsx
2471
2473
  function expressionizeComptime(statement) {
2472
2474
  const { expressions } = statement.block;
2473
2475
  const expression = wrapIIFE(expressions, hasAwait(expressions));
@@ -2788,7 +2790,7 @@ function serialize(value, context) {
2788
2790
  return recurse(value);
2789
2791
  }
2790
2792
 
2791
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/function.civet.jsx
2793
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\function.civet.jsx
2792
2794
  var concatAssign = (lhs, rhs) => (rhs?.[Symbol.isConcatSpreadable] ?? Array.isArray(rhs) ? lhs.push.apply(lhs, rhs) : lhs.push(rhs), lhs);
2793
2795
  function getTypeArguments(args) {
2794
2796
  while (typeof args === "object" && args != null && "args" in args) {
@@ -2876,7 +2878,7 @@ function processReturn(f, implicitReturns) {
2876
2878
  if (returnType && returnType.optional) {
2877
2879
  convertOptionalType(returnType);
2878
2880
  }
2879
- if (!processReturnValue(f) && implicitReturns) {
2881
+ if (!processReturnValue(f) && (implicitReturns || f.signature.implicitReturn)) {
2880
2882
  const { signature, block } = f;
2881
2883
  const { modifier, name, returnType: returnType2 } = signature;
2882
2884
  const { async, generator, set } = modifier;
@@ -4221,7 +4223,7 @@ function makeAmpersandFunction(rhs) {
4221
4223
  return fn;
4222
4224
  }
4223
4225
 
4224
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/block.civet.jsx
4226
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\block.civet.jsx
4225
4227
  function blockWithPrefix(prefixStatements, block) {
4226
4228
  if (prefixStatements && prefixStatements.length) {
4227
4229
  const expressions = [...prefixStatements, ...block.expressions];
@@ -4442,7 +4444,7 @@ function blockContainingStatement(exp) {
4442
4444
  };
4443
4445
  }
4444
4446
 
4445
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/op.civet.jsx
4447
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\op.civet.jsx
4446
4448
  var precedenceOrder = [
4447
4449
  ["||", "??"],
4448
4450
  ["^^"],
@@ -4778,7 +4780,7 @@ function expandChainedComparisons([first, binops]) {
4778
4780
  }
4779
4781
  }
4780
4782
 
4781
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/pattern-matching.civet.jsx
4783
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\pattern-matching.civet.jsx
4782
4784
  function processPatternTest(lhs, patterns) {
4783
4785
  const { ref, refAssignmentComma } = maybeRefAssignment(lhs, "m");
4784
4786
  const conditionExpression = flatJoin(patterns.map(($1) => getPatternConditions($1, ref)).map(($2) => flatJoin($2, " && ")), " || ");
@@ -5297,7 +5299,7 @@ function aliasBinding(p, ref) {
5297
5299
  }
5298
5300
  }
5299
5301
 
5300
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/declaration.civet.jsx
5302
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\declaration.civet.jsx
5301
5303
  function len2(arr, length) {
5302
5304
  return arr.length === length;
5303
5305
  }
@@ -5851,7 +5853,7 @@ function convertWithClause(withClause, extendsClause) {
5851
5853
  return [extendsToken, insertTrimmingSpace(ws, " "), wrapped];
5852
5854
  }
5853
5855
 
5854
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/unary.civet.jsx
5856
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\unary.civet.jsx
5855
5857
  function processUnaryExpression(pre, exp, post) {
5856
5858
  if (!(pre.length || post)) {
5857
5859
  return exp;
@@ -6013,7 +6015,7 @@ function processUnaryNestedExpression(pre, args, post) {
6013
6015
  return processUnaryExpression(pre, args, post);
6014
6016
  }
6015
6017
 
6016
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/pipe.civet.jsx
6018
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\pipe.civet.jsx
6017
6019
  function constructInvocation(fn, arg) {
6018
6020
  let expr = fn.expr;
6019
6021
  while (expr.type === "ParenthesizedExpression") {
@@ -6236,7 +6238,7 @@ function processPipelineExpressions(statements) {
6236
6238
  }
6237
6239
  }
6238
6240
 
6239
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/for.civet.jsx
6241
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\for.civet.jsx
6240
6242
  function processRangeExpression(start, ws1, range2, end) {
6241
6243
  ws1 = [ws1, range2.children[0]];
6242
6244
  const ws2 = range2.children[1];
@@ -6681,7 +6683,7 @@ function processForInOf($0) {
6681
6683
  };
6682
6684
  }
6683
6685
 
6684
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/auto-dec.civet.jsx
6686
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\auto-dec.civet.jsx
6685
6687
  var concatAssign2 = (lhs, rhs) => (rhs?.[Symbol.isConcatSpreadable] ?? Array.isArray(rhs) ? lhs.push.apply(lhs, rhs) : lhs.push(rhs), lhs);
6686
6688
  function findDecs(statements) {
6687
6689
  const declarations = gatherNodes(statements, ($) => $.type === "Declaration");
@@ -6827,7 +6829,7 @@ function createVarDecs(block, scopes, pushVar) {
6827
6829
  scopes.pop();
6828
6830
  }
6829
6831
 
6830
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/string.civet.jsx
6832
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\string.civet.jsx
6831
6833
  function getIndentLevel(str, tab) {
6832
6834
  if (tab != null && tab != 1) {
6833
6835
  const tabs = str.match(/\t/g);
@@ -6995,7 +6997,7 @@ function quoteString(str) {
6995
6997
  return JSON.stringify(str);
6996
6998
  }
6997
6999
 
6998
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/lib.civet.jsx
7000
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\lib.civet.jsx
6999
7001
  var xor = (a, b) => a ? !b && a : b;
7000
7002
  function addPostfixStatement(statement, ws, post) {
7001
7003
  const expressions = [
@@ -11355,23 +11357,30 @@ var NestedClassElement$0 = (0, import_lib2.$S)(Nested, ClassElement, StatementDe
11355
11357
  function NestedClassElement(ctx, state2) {
11356
11358
  return (0, import_lib2.$EVENT)(ctx, state2, "NestedClassElement", NestedClassElement$0);
11357
11359
  }
11358
- var ClassElement$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(Decorators), (0, import_lib2.$E)(AccessModifier), (0, import_lib2.$E)((0, import_lib2.$S)(Static, (0, import_lib2.$E)(_))), (0, import_lib2.$E)((0, import_lib2.$S)(Override, (0, import_lib2.$E)(_))), ClassElementDefinition), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
11360
+ var ClassElement$0 = (0, import_lib2.$TS)((0, import_lib2.$S)((0, import_lib2.$E)(Decorators), (0, import_lib2.$E)((0, import_lib2.$S)(Declare, (0, import_lib2.$E)(_))), (0, import_lib2.$E)(AccessModifier), (0, import_lib2.$E)((0, import_lib2.$S)(Static, (0, import_lib2.$E)(_))), (0, import_lib2.$E)((0, import_lib2.$S)(Override, (0, import_lib2.$E)(_))), ClassElementDefinition), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
11359
11361
  var decorators = $1;
11360
- var definition = $5;
11362
+ var declare = $2;
11363
+ var access = $3;
11364
+ var static_ = $4;
11365
+ var override = $5;
11366
+ var definition = $6;
11367
+ const ts2 = definition.ts || !!declare;
11361
11368
  if (definition.type === "MultiMethodDefinition") {
11362
11369
  return {
11363
11370
  ...definition,
11371
+ ts: ts2,
11364
11372
  children: definition.children.map((c) => {
11365
11373
  return {
11366
11374
  ...c,
11367
- children: [decorators, ...c.children]
11375
+ children: [decorators, declare, access, static_, override, ...c.children]
11368
11376
  };
11369
11377
  })
11370
11378
  };
11371
11379
  }
11372
11380
  return {
11373
11381
  ...definition,
11374
- children: [decorators, $2, $3, $4, ...definition.children]
11382
+ ts: ts2,
11383
+ children: [decorators, declare, access, static_, override, ...definition.children]
11375
11384
  };
11376
11385
  });
11377
11386
  var ClassElement$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(Static, BracedBlock), function($skip, $loc, $0, $1, $2) {
@@ -12337,7 +12346,15 @@ var AtIdentifierRef$$ = [AtIdentifierRef$0, AtIdentifierRef$1];
12337
12346
  function AtIdentifierRef(ctx, state2) {
12338
12347
  return (0, import_lib2.$EVENT_C)(ctx, state2, "AtIdentifierRef", AtIdentifierRef$$);
12339
12348
  }
12340
- var PinPattern$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Caret, SingleLineExpressionWithIndentedApplicationForbidden), function($skip, $loc, $0, $1, $2) {
12349
+ var PinPattern$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Caret, IdentifierName, (0, import_lib2.$Y)(Colon)), function($skip, $loc, $0, $1, $2, $3) {
12350
+ var expression = $2;
12351
+ return {
12352
+ type: "PinPattern",
12353
+ children: [expression],
12354
+ expression
12355
+ };
12356
+ });
12357
+ var PinPattern$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(Caret, SingleLineExpressionWithIndentedApplicationForbidden), function($skip, $loc, $0, $1, $2) {
12341
12358
  var expression = $2;
12342
12359
  return {
12343
12360
  type: "PinPattern",
@@ -12345,7 +12362,7 @@ var PinPattern$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Caret, SingleLineExp
12345
12362
  expression
12346
12363
  };
12347
12364
  });
12348
- var PinPattern$1 = (0, import_lib2.$TV)(ActualMemberExpression, function($skip, $loc, $0, $1) {
12365
+ var PinPattern$2 = (0, import_lib2.$TV)(ActualMemberExpression, function($skip, $loc, $0, $1) {
12349
12366
  var expression = $0;
12350
12367
  return {
12351
12368
  type: "PinPattern",
@@ -12353,7 +12370,7 @@ var PinPattern$1 = (0, import_lib2.$TV)(ActualMemberExpression, function($skip,
12353
12370
  expression
12354
12371
  };
12355
12372
  });
12356
- var PinPattern$2 = (0, import_lib2.$TV)((0, import_lib2.$S)((0, import_lib2.$EXPECT)($R14, "PinPattern /[+-]/"), NumericLiteral), function($skip, $loc, $0, $1) {
12373
+ var PinPattern$3 = (0, import_lib2.$TV)((0, import_lib2.$S)((0, import_lib2.$EXPECT)($R14, "PinPattern /[+-]/"), NumericLiteral), function($skip, $loc, $0, $1) {
12357
12374
  var expression = $0;
12358
12375
  return {
12359
12376
  type: "PinPattern",
@@ -12361,7 +12378,7 @@ var PinPattern$2 = (0, import_lib2.$TV)((0, import_lib2.$S)((0, import_lib2.$EXP
12361
12378
  expression
12362
12379
  };
12363
12380
  });
12364
- var PinPattern$3 = (0, import_lib2.$TV)(Undefined, function($skip, $loc, $0, $1) {
12381
+ var PinPattern$4 = (0, import_lib2.$TV)(Undefined, function($skip, $loc, $0, $1) {
12365
12382
  var expression = $0;
12366
12383
  return {
12367
12384
  type: "PinPattern",
@@ -12369,7 +12386,7 @@ var PinPattern$3 = (0, import_lib2.$TV)(Undefined, function($skip, $loc, $0, $1)
12369
12386
  expression
12370
12387
  };
12371
12388
  });
12372
- var PinPattern$$ = [PinPattern$0, PinPattern$1, PinPattern$2, PinPattern$3];
12389
+ var PinPattern$$ = [PinPattern$0, PinPattern$1, PinPattern$2, PinPattern$3, PinPattern$4];
12373
12390
  function PinPattern(ctx, state2) {
12374
12391
  return (0, import_lib2.$EVENT_C)(ctx, state2, "PinPattern", PinPattern$$);
12375
12392
  }
@@ -21149,7 +21166,7 @@ var wellKnownSymbols = [
21149
21166
  "unscopables"
21150
21167
  ];
21151
21168
 
21152
- // unplugin-civet:/home/daniel/apps/Civet/source/sourcemap.civet.jsx
21169
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\sourcemap.civet.jsx
21153
21170
  var sourcemap_civet_exports = {};
21154
21171
  __export(sourcemap_civet_exports, {
21155
21172
  SourceMap: () => SourceMap,
@@ -21463,7 +21480,7 @@ var remapPosition = function(position, sourcemapLines) {
21463
21480
  }
21464
21481
  };
21465
21482
 
21466
- // unplugin-civet:/home/daniel/apps/Civet/source/state-cache.civet.jsx
21483
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\state-cache.civet.jsx
21467
21484
  var StateCache = class {
21468
21485
  cache = /* @__PURE__ */ new Map();
21469
21486
  get(key) {
@@ -21503,7 +21520,7 @@ var StateCache = class {
21503
21520
  }
21504
21521
  };
21505
21522
 
21506
- // unplugin-civet:/home/daniel/apps/Civet/source/worker-pool.civet.jsx
21523
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\worker-pool.civet.jsx
21507
21524
  var WorkerPool = class {
21508
21525
  idle;
21509
21526
  spawned;
@@ -21605,7 +21622,7 @@ var WorkerPool = class {
21605
21622
  }
21606
21623
  };
21607
21624
 
21608
- // unplugin-civet:/home/daniel/apps/Civet/source/main.civet.jsx
21625
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\main.civet.jsx
21609
21626
  var { SourceMap: SourceMap2 } = sourcemap_civet_exports;
21610
21627
  var ParseErrors = class extends Error {
21611
21628
  name = "ParseErrors";
@@ -1,4 +1,4 @@
1
- // unplugin-civet:/home/daniel/apps/Civet/source/node-worker.civet.jsx
1
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\node-worker.civet.jsx
2
2
  import { parentPort } from "node:worker_threads";
3
3
  import module from "node:module";
4
4
  try {
package/dist/types.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  declare module "@danielx/civet" {
2
2
  export type CivetAST = unknown
3
3
  export type ParseOptions = Partial<{
4
- autoVar: boolean
4
+ autoConst: boolean
5
5
  autoLet: boolean
6
+ autoVar: boolean
6
7
  coffeeBinaryExistential: boolean
7
8
  coffeeBooleans: boolean
8
9
  coffeeClasses: boolean
@@ -26,7 +26,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  ));
27
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
28
 
29
- // unplugin-civet:/home/daniel/apps/Civet/source/unplugin/astro.civet.jsx
29
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\unplugin\astro.civet.jsx
30
30
  var astro_civet_exports = {};
31
31
  __export(astro_civet_exports, {
32
32
  default: () => astro_civet_default
@@ -1,4 +1,4 @@
1
- // unplugin-civet:/home/daniel/apps/Civet/source/unplugin/astro.civet.jsx
1
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\unplugin\astro.civet.jsx
2
2
  import civetUnplugin, {} from "./unplugin.mjs";
3
3
  var astro_civet_default = function(opts = {}) {
4
4
  return {