@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/CHANGELOG.md CHANGED
@@ -4,6 +4,18 @@ This changelog is generated automatically by [`build/changelog.civet`](build/cha
4
4
  For each version of Civet, it lists and links to all incorporated PRs,
5
5
  as well as a full diff and commit list.
6
6
 
7
+ ## 0.10.4 (2025-05-17, [diff](https://github.com/DanielXMoore/Civet/compare/v0.10.3...v0.10.4), [commits](https://github.com/DanielXMoore/Civet/commits/v0.10.4))
8
+ * Fix implicit returns in IIFEs with "civet -implicitReturns" [[#1737](https://github.com/DanielXMoore/Civet/pull/1737)]
9
+ * Typed pinned arguments such as `(^x: T) =>`; forbid implicit object literals in pinned patterns [[#1736](https://github.com/DanielXMoore/Civet/pull/1736)]
10
+ * Fix `outputExtension` option in unplugin, enabling `.svelte.ts`/`.svelte.js` for Svelte Runes reactive compatibility [[#1733](https://github.com/DanielXMoore/Civet/pull/1733)]
11
+ * Type-only class field declarations `declare field: T` [[#1741](https://github.com/DanielXMoore/Civet/pull/1741)]
12
+
13
+ ## 0.10.3 (2025-04-28, [diff](https://github.com/DanielXMoore/Civet/compare/v0.10.2...v0.10.3), [commits](https://github.com/DanielXMoore/Civet/commits/v0.10.3))
14
+ * Explicit changelog build script shell [[#1727](https://github.com/DanielXMoore/Civet/pull/1727)]
15
+ * ESM loader supports civetconfig by default, and overriding configuration [[#1734](https://github.com/DanielXMoore/Civet/pull/1734)]
16
+ * BREAKING CHANGE: If you don't use civetconfig files and want to be robust against their existence in ancestor directories, or want to maximize performance, use `@danielx/civet/register-noconfig` instead of `@danielx/civet/register`
17
+ * BREAKING CHANGE: In unplugin settings, `config: undefined` no longer disables searching for config files. Use `config: false` or `config: null` instead.
18
+
7
19
  ## 0.10.2 (2025-04-13, [diff](https://github.com/DanielXMoore/Civet/compare/v0.10.1...v0.10.2), [commits](https://github.com/DanielXMoore/Civet/commits/v0.10.2))
8
20
  * Fix unplugin source map directories [[#1726](https://github.com/DanielXMoore/Civet/pull/1726)]
9
21
 
@@ -16,7 +16,7 @@ var __copyProps = (to, from, except, desc) => {
16
16
  };
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
18
 
19
- // unplugin-civet:/home/daniel/apps/Civet/source/babel-plugin.civet.jsx
19
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\babel-plugin.civet.jsx
20
20
  var babel_plugin_civet_exports = {};
21
21
  __export(babel_plugin_civet_exports, {
22
22
  default: () => babel_plugin_civet_default
@@ -1,4 +1,4 @@
1
- // unplugin-civet:/home/daniel/apps/Civet/source/babel-plugin.civet.jsx
1
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\babel-plugin.civet.jsx
2
2
  import { compile } from "./main.mjs";
3
3
  function babel_plugin_civet_default(api, civetOptions) {
4
4
  return {
package/dist/browser.js CHANGED
@@ -400,7 +400,7 @@ ${body}`), super(message), this.header = header, this.body = body, this.filename
400
400
  }
401
401
  });
402
402
 
403
- // unplugin-civet:/home/daniel/apps/Civet/source/browser.civet.jsx
403
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\browser.civet.jsx
404
404
  var browser_civet_exports = {};
405
405
  __export(browser_civet_exports, {
406
406
  ParseError: () => import_lib2.ParseError,
@@ -422,7 +422,7 @@ ${body}`), super(message), this.header = header, this.body = body, this.filename
422
422
  // source/parser.hera
423
423
  var import_lib2 = __toESM(require_machine());
424
424
 
425
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/lib.civet.jsx
425
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\lib.civet.jsx
426
426
  var lib_civet_exports = {};
427
427
  __export(lib_civet_exports, {
428
428
  addPostfixStatement: () => addPostfixStatement,
@@ -502,7 +502,7 @@ ${body}`), super(message), this.header = header, this.body = body, this.filename
502
502
  wrapTypeInPromise: () => wrapTypeInPromise
503
503
  });
504
504
 
505
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/util.civet.jsx
505
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\util.civet.jsx
506
506
  function len(arr, length) {
507
507
  return arr.length === length;
508
508
  }
@@ -1164,6 +1164,8 @@ ${body}`), super(message), this.header = header, this.body = body, this.filename
1164
1164
  },
1165
1165
  parameters,
1166
1166
  returnType: void 0,
1167
+ implicitReturn: !0,
1168
+ // force implicit return in IIFE
1167
1169
  children: generator.length ? [async, "function", generator, parameters] : [async, parameters]
1168
1170
  }, fn;
1169
1171
  generator.length ? fn = makeNode({
@@ -1236,7 +1238,7 @@ ${body}`), super(message), this.header = header, this.body = body, this.filename
1236
1238
  return result;
1237
1239
  }
1238
1240
 
1239
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/traversal.civet.jsx
1241
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\traversal.civet.jsx
1240
1242
  function gatherRecursiveWithinFunction(node, predicate) {
1241
1243
  return gatherRecursive(node, predicate, isFunction);
1242
1244
  }
@@ -1310,7 +1312,7 @@ ${body}`), super(message), this.header = header, this.body = body, this.filename
1310
1312
  return predicate(node) && nodes.push(node), nodes;
1311
1313
  }
1312
1314
 
1313
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/ref.civet.jsx
1315
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\ref.civet.jsx
1314
1316
  var range = (start, end) => {
1315
1317
  let length = end - start;
1316
1318
  if (length <= 0) return [];
@@ -1386,7 +1388,7 @@ ${body}`), super(message), this.header = header, this.body = body, this.filename
1386
1388
  }
1387
1389
  }
1388
1390
 
1389
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/binding.civet.jsx
1391
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\binding.civet.jsx
1390
1392
  function adjustAtBindings(statements, asThis = !1) {
1391
1393
  for (let ref1 = gatherRecursiveAll(statements, ($1) => $1.type === "AtBindingProperty"), i1 = 0, len3 = ref1.length; i1 < len3; i1++) {
1392
1394
  let binding = ref1[i1], { ref } = binding;
@@ -1584,12 +1586,12 @@ ${body}`), super(message), this.header = header, this.body = body, this.filename
1584
1586
  return pattern;
1585
1587
  }
1586
1588
 
1587
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/comptime.civet.jsx
1589
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\comptime.civet.jsx
1588
1590
  init_browser_shim();
1589
1591
  init_browser_shim();
1590
1592
  init_browser_shim();
1591
1593
 
1592
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/helper.civet.jsx
1594
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\helper.civet.jsx
1593
1595
  var preludeVar = "var ";
1594
1596
  function ts(children) {
1595
1597
  return {
@@ -1925,7 +1927,7 @@ ${body}`), super(message), this.header = header, this.body = body, this.filename
1925
1927
  }
1926
1928
  }
1927
1929
 
1928
- // unplugin-civet:/home/daniel/apps/Civet/source/generate.civet.jsx
1930
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\generate.civet.jsx
1929
1931
  function stringify(node) {
1930
1932
  try {
1931
1933
  return JSON.stringify(removeParentPointers(node));
@@ -1993,7 +1995,7 @@ ${body}`), super(message), this.header = header, this.body = body, this.filename
1993
1995
  }
1994
1996
  }
1995
1997
 
1996
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/comptime.civet.jsx
1998
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\comptime.civet.jsx
1997
1999
  function expressionizeComptime(statement) {
1998
2000
  let { expressions } = statement.block, expression = wrapIIFE(expressions, hasAwait(expressions));
1999
2001
  return makeNode({
@@ -2227,7 +2229,7 @@ ${js}`
2227
2229
  return recurse(value);
2228
2230
  }
2229
2231
 
2230
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/function.civet.jsx
2232
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\function.civet.jsx
2231
2233
  var concatAssign = (lhs, rhs) => (rhs?.[Symbol.isConcatSpreadable] ?? Array.isArray(rhs) ? lhs.push.apply(lhs, rhs) : lhs.push(rhs), lhs);
2232
2234
  function getTypeArguments(args) {
2233
2235
  for (; typeof args == "object" && args != null && "args" in args; )
@@ -2291,7 +2293,7 @@ ${js}`
2291
2293
  }
2292
2294
  function processReturn(f, implicitReturns) {
2293
2295
  let { returnType } = f.signature;
2294
- if (returnType && returnType.optional && convertOptionalType(returnType), !processReturnValue(f) && implicitReturns) {
2296
+ if (returnType && returnType.optional && convertOptionalType(returnType), !processReturnValue(f) && (implicitReturns || f.signature.implicitReturn)) {
2295
2297
  let { signature, block } = f, { modifier, name, returnType: returnType2 } = signature, { async, generator, set } = modifier, isConstructor = f.type === "MethodDefinition" && name === "constructor", isVoid = generator || isVoidType(returnType2?.t) || async && isPromiseVoidType(returnType2?.t);
2296
2298
  block?.type === "BlockStatement" && (isVoid || set || isConstructor ? block.bare && block.implicitlyReturned && braceBlock(block) : block.implicitlyReturned || insertReturn(block));
2297
2299
  }
@@ -3256,7 +3258,7 @@ ${js}`
3256
3258
  ).length > 1 && (fn.ampersandBlock = !1), fn;
3257
3259
  }
3258
3260
 
3259
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/block.civet.jsx
3261
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\block.civet.jsx
3260
3262
  function blockWithPrefix(prefixStatements, block) {
3261
3263
  if (prefixStatements && prefixStatements.length) {
3262
3264
  let expressions = [...prefixStatements, ...block.expressions];
@@ -3406,7 +3408,7 @@ ${js}`
3406
3408
  };
3407
3409
  }
3408
3410
 
3409
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/op.civet.jsx
3411
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\op.civet.jsx
3410
3412
  var precedenceOrder = [
3411
3413
  ["||", "??"],
3412
3414
  ["^^"],
@@ -3600,7 +3602,7 @@ ${js}`
3600
3602
  }
3601
3603
  }
3602
3604
 
3603
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/pattern-matching.civet.jsx
3605
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\pattern-matching.civet.jsx
3604
3606
  function processPatternTest(lhs, patterns) {
3605
3607
  let { ref, refAssignmentComma } = maybeRefAssignment(lhs, "m"), conditionExpression = flatJoin(patterns.map(($1) => getPatternConditions($1, ref)).map(($2) => flatJoin($2, " && ")), " || ");
3606
3608
  return makeLeftHandSideExpression(makeNode({
@@ -4004,7 +4006,7 @@ ${js}`
4004
4006
  }
4005
4007
  }
4006
4008
 
4007
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/declaration.civet.jsx
4009
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\declaration.civet.jsx
4008
4010
  function len2(arr, length) {
4009
4011
  return arr.length === length;
4010
4012
  }
@@ -4413,7 +4415,7 @@ ${js}`
4413
4415
  return [extendsToken, insertTrimmingSpace(ws, " "), wrapped];
4414
4416
  }
4415
4417
 
4416
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/unary.civet.jsx
4418
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\unary.civet.jsx
4417
4419
  function processUnaryExpression(pre, exp, post) {
4418
4420
  if (!(pre.length || post))
4419
4421
  return exp;
@@ -4524,7 +4526,7 @@ ${js}`
4524
4526
  return processUnaryExpression(pre, args, post);
4525
4527
  }
4526
4528
 
4527
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/pipe.civet.jsx
4529
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\pipe.civet.jsx
4528
4530
  function constructInvocation(fn, arg) {
4529
4531
  let expr = fn.expr;
4530
4532
  for (; expr.type === "ParenthesizedExpression"; )
@@ -4685,7 +4687,7 @@ ${js}`
4685
4687
  }
4686
4688
  }
4687
4689
 
4688
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/for.civet.jsx
4690
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\for.civet.jsx
4689
4691
  function processRangeExpression(start, ws1, range2, end) {
4690
4692
  ws1 = [ws1, range2.children[0]];
4691
4693
  let ws2 = range2.children[1], comma = { $loc: range2.$loc, token: "," }, ref;
@@ -5008,7 +5010,7 @@ ${js}`
5008
5010
  };
5009
5011
  }
5010
5012
 
5011
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/auto-dec.civet.jsx
5013
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\auto-dec.civet.jsx
5012
5014
  var concatAssign2 = (lhs, rhs) => (rhs?.[Symbol.isConcatSpreadable] ?? Array.isArray(rhs) ? lhs.push.apply(lhs, rhs) : lhs.push(rhs), lhs);
5013
5015
  function findDecs(statements) {
5014
5016
  let declarationNames = gatherNodes(statements, ($) => $.type === "Declaration").flatMap((d) => d.names), globals = getConfig().globals || [];
@@ -5090,7 +5092,7 @@ ${js}`
5090
5092
  scopes.pop();
5091
5093
  }
5092
5094
 
5093
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/string.civet.jsx
5095
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\string.civet.jsx
5094
5096
  function getIndentLevel(str, tab) {
5095
5097
  if (tab != null && tab != 1) {
5096
5098
  let tabs = str.match(/\t/g), numTabs = tabs ? tabs.length : 0;
@@ -5200,7 +5202,7 @@ ${js}`
5200
5202
  return JSON.stringify(str);
5201
5203
  }
5202
5204
 
5203
- // unplugin-civet:/home/daniel/apps/Civet/source/parser/lib.civet.jsx
5205
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\parser\lib.civet.jsx
5204
5206
  var xor = (a, b) => a ? !b && a : b;
5205
5207
  function addPostfixStatement(statement, ws, post) {
5206
5208
  let expressions = [
@@ -8346,17 +8348,20 @@ ${js}`
8346
8348
  function NestedClassElement(ctx, state2) {
8347
8349
  return (0, import_lib2.$EVENT)(ctx, state2, "NestedClassElement", NestedClassElement$0);
8348
8350
  }
8349
- 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) {
8350
- var decorators = $1, definition = $5;
8351
+ 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) {
8352
+ var decorators = $1, declare = $2, access = $3, static_ = $4, override = $5, definition = $6;
8353
+ let ts2 = definition.ts || !!declare;
8351
8354
  return definition.type === "MultiMethodDefinition" ? {
8352
8355
  ...definition,
8356
+ ts: ts2,
8353
8357
  children: definition.children.map((c) => ({
8354
8358
  ...c,
8355
- children: [decorators, ...c.children]
8359
+ children: [decorators, declare, access, static_, override, ...c.children]
8356
8360
  }))
8357
8361
  } : {
8358
8362
  ...definition,
8359
- children: [decorators, $2, $3, $4, ...definition.children]
8363
+ ts: ts2,
8364
+ children: [decorators, declare, access, static_, override, ...definition.children]
8360
8365
  };
8361
8366
  }), ClassElement$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(Static, BracedBlock), function($skip, $loc, $0, $1, $2) {
8362
8367
  return {
@@ -9088,35 +9093,42 @@ ${js}`
9088
9093
  function AtIdentifierRef(ctx, state2) {
9089
9094
  return (0, import_lib2.$EVENT_C)(ctx, state2, "AtIdentifierRef", AtIdentifierRef$$);
9090
9095
  }
9091
- var PinPattern$0 = (0, import_lib2.$TS)((0, import_lib2.$S)(Caret, SingleLineExpressionWithIndentedApplicationForbidden), function($skip, $loc, $0, $1, $2) {
9096
+ 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) {
9092
9097
  var expression = $2;
9093
9098
  return {
9094
9099
  type: "PinPattern",
9095
9100
  children: [expression],
9096
9101
  expression
9097
9102
  };
9098
- }), PinPattern$1 = (0, import_lib2.$TV)(ActualMemberExpression, function($skip, $loc, $0, $1) {
9103
+ }), PinPattern$1 = (0, import_lib2.$TS)((0, import_lib2.$S)(Caret, SingleLineExpressionWithIndentedApplicationForbidden), function($skip, $loc, $0, $1, $2) {
9104
+ var expression = $2;
9105
+ return {
9106
+ type: "PinPattern",
9107
+ children: [expression],
9108
+ expression
9109
+ };
9110
+ }), PinPattern$2 = (0, import_lib2.$TV)(ActualMemberExpression, function($skip, $loc, $0, $1) {
9099
9111
  var expression = $0;
9100
9112
  return {
9101
9113
  type: "PinPattern",
9102
9114
  children: [expression],
9103
9115
  expression
9104
9116
  };
9105
- }), PinPattern$2 = (0, import_lib2.$TV)((0, import_lib2.$S)((0, import_lib2.$EXPECT)($R14, "PinPattern /[+-]/"), NumericLiteral), function($skip, $loc, $0, $1) {
9117
+ }), PinPattern$3 = (0, import_lib2.$TV)((0, import_lib2.$S)((0, import_lib2.$EXPECT)($R14, "PinPattern /[+-]/"), NumericLiteral), function($skip, $loc, $0, $1) {
9106
9118
  var expression = $0;
9107
9119
  return {
9108
9120
  type: "PinPattern",
9109
9121
  children: [expression],
9110
9122
  expression
9111
9123
  };
9112
- }), PinPattern$3 = (0, import_lib2.$TV)(Undefined, function($skip, $loc, $0, $1) {
9124
+ }), PinPattern$4 = (0, import_lib2.$TV)(Undefined, function($skip, $loc, $0, $1) {
9113
9125
  var expression = $0;
9114
9126
  return {
9115
9127
  type: "PinPattern",
9116
9128
  children: [expression],
9117
9129
  expression
9118
9130
  };
9119
- }), PinPattern$$ = [PinPattern$0, PinPattern$1, PinPattern$2, PinPattern$3];
9131
+ }), PinPattern$$ = [PinPattern$0, PinPattern$1, PinPattern$2, PinPattern$3, PinPattern$4];
9120
9132
  function PinPattern(ctx, state2) {
9121
9133
  return (0, import_lib2.$EVENT_C)(ctx, state2, "PinPattern", PinPattern$$);
9122
9134
  }
@@ -16102,7 +16114,7 @@ ${js}`
16102
16114
  "unscopables"
16103
16115
  ];
16104
16116
 
16105
- // unplugin-civet:/home/daniel/apps/Civet/source/sourcemap.civet.jsx
16117
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\sourcemap.civet.jsx
16106
16118
  var sourcemap_civet_exports = {};
16107
16119
  __export(sourcemap_civet_exports, {
16108
16120
  SourceMap: () => SourceMap,
@@ -16271,7 +16283,7 @@ ${js}`
16271
16283
  return [lastMapping[2], lastMapping[3]];
16272
16284
  };
16273
16285
 
16274
- // unplugin-civet:/home/daniel/apps/Civet/source/state-cache.civet.jsx
16286
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\state-cache.civet.jsx
16275
16287
  var StateCache = class {
16276
16288
  cache = /* @__PURE__ */ new Map();
16277
16289
  get(key) {
@@ -16294,7 +16306,7 @@ ${js}`
16294
16306
  }
16295
16307
  };
16296
16308
 
16297
- // unplugin-civet:/home/daniel/apps/Civet/source/main.civet.jsx
16309
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\main.civet.jsx
16298
16310
  var { SourceMap: SourceMap2 } = sourcemap_civet_exports;
16299
16311
  var ParseErrors = class extends Error {
16300
16312
  name = "ParseErrors";
@@ -16444,7 +16456,7 @@ ${counts}`;
16444
16456
  return err instanceof import_lib2.ParseError || err instanceof ParseErrors;
16445
16457
  };
16446
16458
 
16447
- // unplugin-civet:/home/daniel/apps/Civet/source/browser.civet.jsx
16459
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\browser.civet.jsx
16448
16460
  async function runScripts(type = "text/civet") {
16449
16461
  let scripts = window.document.querySelectorAll(`script[type=${JSON.stringify(type)}]`);
16450
16462
  for (let i1 = 0, len3 = scripts.length; i1 < len3; i1++) {
package/dist/civet CHANGED
@@ -29,7 +29,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
29
29
  ));
30
30
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
31
 
32
- // unplugin-civet:/home/daniel/apps/Civet/source/cli.civet.jsx
32
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\cli.civet.jsx
33
33
  var cli_civet_exports = {};
34
34
  __export(cli_civet_exports, {
35
35
  cli: () => cli,
@@ -503,8 +503,8 @@ You can override this behavior via: --civet rewriteCivetImports=.ext
503
503
  `);
504
504
  process.exit(0);
505
505
  }
506
- if (options.config !== false) {
507
- options.config ??= await (0, import_config.findConfig)(process.cwd());
506
+ if (options.config === void 0) {
507
+ options.config = await (0, import_config.findConfig)(process.cwd());
508
508
  }
509
509
  if (options.config) {
510
510
  const parsed = await (0, import_config.loadConfig)(options.config);
package/dist/config.js CHANGED
@@ -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/config.civet.jsx
29
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\config.civet.jsx
30
30
  var config_civet_exports = {};
31
31
  __export(config_civet_exports, {
32
32
  default: () => config_civet_default,
package/dist/config.mjs CHANGED
@@ -1,4 +1,4 @@
1
- // unplugin-civet:/home/daniel/apps/Civet/source/config.civet.jsx
1
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\config.civet.jsx
2
2
  import path from "path";
3
3
  import fs from "fs/promises";
4
4
  import { compile } from "./main.mjs";
@@ -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/esbuild-plugin.civet.jsx
29
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\esbuild-plugin.civet.jsx
30
30
  var esbuild_plugin_civet_exports = {};
31
31
  __export(esbuild_plugin_civet_exports, {
32
32
  default: () => esbuild_plugin_civet_default
package/dist/esm.mjs CHANGED
@@ -1,10 +1,15 @@
1
- // unplugin-civet:/home/daniel/apps/Civet/source/esm.civet.jsx
2
- import { readFileSync } from "fs";
1
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\esm.civet.jsx
2
+ import { readFile } from "fs/promises";
3
+ import { dirname } from "path";
3
4
  import { pathToFileURL, fileURLToPath } from "url";
4
- import Civet from "./main.mjs";
5
- var { compile, SourceMap } = Civet;
5
+ import { compile, SourceMap } from "./main.mjs";
6
+ import { findConfig, loadConfig } from "./config.mjs";
6
7
  var baseURL = pathToFileURL(process.cwd() + "/").href;
7
8
  var extensionsRegex = /\.civet$/;
9
+ var globalOptions = {};
10
+ function initialize(options = {}) {
11
+ return globalOptions = options;
12
+ }
8
13
  function resolve(specifier, context, next) {
9
14
  const { parentURL = baseURL } = context;
10
15
  if (extensionsRegex.test(specifier)) {
@@ -19,14 +24,29 @@ function resolve(specifier, context, next) {
19
24
  async function load(url, context, next) {
20
25
  if (context.format === "civet") {
21
26
  const path = fileURLToPath(url);
22
- const source = readFileSync(path, "utf8");
27
+ const source = await readFile(path, "utf8");
28
+ let loadedConfig;
29
+ let { config } = globalOptions;
30
+ if (config === void 0) {
31
+ config = await findConfig(dirname(path));
32
+ }
33
+ if (config) {
34
+ loadedConfig = await loadConfig(config);
35
+ }
36
+ const options = {
37
+ filename: path,
38
+ sourceMap: true,
39
+ js: true
40
+ };
41
+ if (globalOptions.parseOptions) {
42
+ options.parseOptions = globalOptions.parseOptions;
43
+ }
44
+ if (loadedConfig?.parseOptions) {
45
+ options.parseOptions = { ...options.parseOptions, ...loadedConfig.parseOptions };
46
+ }
23
47
  let tsSource, sourceMap;
24
48
  try {
25
- ({ code: tsSource, sourceMap } = await compile(source, {
26
- filename: path,
27
- sourceMap: true,
28
- js: true
29
- }));
49
+ ({ code: tsSource, sourceMap } = await compile(source, options));
30
50
  } catch (e) {
31
51
  console.error(`Civet failed to compile ${url}:`, e);
32
52
  throw e;
@@ -46,6 +66,7 @@ async function load(url, context, next) {
46
66
  return next(url, context);
47
67
  }
48
68
  export {
69
+ initialize,
49
70
  load,
50
71
  resolve
51
72
  };