@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.
@@ -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/esbuild.civet.jsx
29
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\unplugin\esbuild.civet.jsx
30
30
  var esbuild_civet_exports = {};
31
31
  __export(esbuild_civet_exports, {
32
32
  default: () => esbuild_civet_default
@@ -1,4 +1,4 @@
1
- // unplugin-civet:/home/daniel/apps/Civet/source/unplugin/esbuild.civet.jsx
1
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\unplugin\esbuild.civet.jsx
2
2
  import civetUnplugin from "./unplugin.mjs";
3
3
  var esbuild_civet_default = civetUnplugin.esbuild;
4
4
  export {
@@ -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/farm.civet.jsx
29
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\unplugin\farm.civet.jsx
30
30
  var farm_civet_exports = {};
31
31
  __export(farm_civet_exports, {
32
32
  default: () => farm_civet_default
@@ -1,4 +1,4 @@
1
- // unplugin-civet:/home/daniel/apps/Civet/source/unplugin/farm.civet.jsx
1
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\unplugin\farm.civet.jsx
2
2
  import civetUnplugin from "./unplugin.mjs";
3
3
  var farm_civet_default = civetUnplugin.farm;
4
4
  export {
@@ -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/rolldown.civet.jsx
29
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\unplugin\rolldown.civet.jsx
30
30
  var rolldown_civet_exports = {};
31
31
  __export(rolldown_civet_exports, {
32
32
  default: () => rolldown_civet_default
@@ -1,4 +1,4 @@
1
- // unplugin-civet:/home/daniel/apps/Civet/source/unplugin/rolldown.civet.jsx
1
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\unplugin\rolldown.civet.jsx
2
2
  import civetUnplugin from "./unplugin.mjs";
3
3
  var rolldown_civet_default = civetUnplugin.rolldown;
4
4
  export {
@@ -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/rollup.civet.jsx
29
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\unplugin\rollup.civet.jsx
30
30
  var rollup_civet_exports = {};
31
31
  __export(rollup_civet_exports, {
32
32
  default: () => rollup_civet_default
@@ -1,4 +1,4 @@
1
- // unplugin-civet:/home/daniel/apps/Civet/source/unplugin/rollup.civet.jsx
1
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\unplugin\rollup.civet.jsx
2
2
  import civetUnplugin from "./unplugin.mjs";
3
3
  var rollup_civet_default = civetUnplugin.rollup;
4
4
  export {
@@ -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/rspack.civet.jsx
29
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\unplugin\rspack.civet.jsx
30
30
  var rspack_civet_exports = {};
31
31
  __export(rspack_civet_exports, {
32
32
  default: () => rspack_civet_default
@@ -1,4 +1,4 @@
1
- // unplugin-civet:/home/daniel/apps/Civet/source/unplugin/rspack.civet.jsx
1
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\unplugin\rspack.civet.jsx
2
2
  import civetUnplugin from "./unplugin.mjs";
3
3
  var rspack_civet_default = civetUnplugin.rspack;
4
4
  export {
@@ -16,8 +16,8 @@ export type PluginOptions = {
16
16
  threads?: number;
17
17
  /** Cache compilation results based on file mtime (useful for serve or watch mode) */
18
18
  cache?: boolean;
19
- /** config filename, or null to not look for default config file */
20
- config?: (string | undefined) | null;
19
+ /** config filename, or false/null to not look for default config file */
20
+ config?: string | false | null;
21
21
  parseOptions?: ParseOptions;
22
22
  };
23
23
  export declare function slash(p: string): string;
@@ -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/unplugin.civet.jsx
29
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\unplugin\unplugin.civet.jsx
30
30
  var unplugin_civet_exports = {};
31
31
  __export(unplugin_civet_exports, {
32
32
  default: () => unplugin_civet_default,
@@ -46,24 +46,26 @@ var import_os = __toESM(require("os"));
46
46
  // source/unplugin/constants.mjs
47
47
  var DEFAULT_EXTENSIONS = [".mjs", ".js", ".mts", ".ts", ".jsx", ".tsx", ".json"];
48
48
 
49
- // unplugin-civet:/home/daniel/apps/Civet/source/unplugin/unplugin.civet.jsx
49
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\unplugin\unplugin.civet.jsx
50
50
  var DiagnosticCategory = {};
51
51
  DiagnosticCategory[DiagnosticCategory["Warning"] = 0] = "Warning";
52
52
  DiagnosticCategory[DiagnosticCategory["Error"] = 1] = "Error";
53
53
  DiagnosticCategory[DiagnosticCategory["Suggestion"] = 2] = "Suggestion";
54
54
  DiagnosticCategory[DiagnosticCategory["Message"] = 3] = "Message";
55
- var civetExtension = /\.civet$/;
56
- var isCivetTranspiled = /(\.civet)(\.[jt]sx)?([?#].*)?$/;
57
55
  var postfixRE = /[?#].*$/s;
58
56
  var isWindows = import_os.default.platform() === "win32";
59
57
  var windowsSlashRE = /\\/g;
60
- function cleanCivetId(id) {
58
+ var civetSuffix = ".civet";
59
+ function extractCivetFilename(id, outputExtension) {
61
60
  let postfix = "";
62
- id = id.replace(postfixRE, (match) => {
61
+ let filename = id.replace(postfixRE, (match) => {
63
62
  postfix = match;
64
63
  return "";
65
- }).replace(/\.[jt]sx$/, "");
66
- return { id, postfix };
64
+ });
65
+ if (filename.endsWith(outputExtension)) {
66
+ filename = filename.slice(0, -outputExtension.length);
67
+ }
68
+ return { filename, postfix };
67
69
  }
68
70
  function tryStatSync(file) {
69
71
  try {
@@ -145,7 +147,10 @@ var rawPlugin = (options = {}, meta) => {
145
147
  name: "unplugin-civet",
146
148
  enforce: "pre",
147
149
  async buildStart() {
148
- const civetConfigPath = "config" in options ? options.config : await (0, import_config.findInDir)(process.cwd());
150
+ let civetConfigPath = options.config;
151
+ if (civetConfigPath === void 0) {
152
+ civetConfigPath = await (0, import_config.findInDir)(process.cwd());
153
+ }
149
154
  if (civetConfigPath) {
150
155
  compileOptions = await (0, import_config.loadConfig)(civetConfigPath);
151
156
  }
@@ -356,10 +361,8 @@ var rawPlugin = (options = {}, meta) => {
356
361
  } else {
357
362
  console.log(`WARNING: No .d.ts extension in ${filePath}`);
358
363
  }
359
- let ref1;
360
- if (ref1 = filePath.match(civetExtension)) {
361
- const match = ref1;
362
- filePath = filePath.slice(0, -match[0].length);
364
+ if (filePath.endsWith(civetSuffix)) {
365
+ filePath = filePath.slice(0, -civetSuffix.length);
363
366
  } else {
364
367
  console.log(`WARNING: No .civet extension in ${filePath}`);
365
368
  }
@@ -392,38 +395,36 @@ var rawPlugin = (options = {}, meta) => {
392
395
  id = aliasResolver(id);
393
396
  }
394
397
  if (/\0/.test(id)) return null;
395
- let postfix;
396
- ({ id, postfix } = cleanCivetId(id));
397
- let ref2;
398
- if (import_path.default.isAbsolute(id)) {
399
- ref2 = resolveAbsolutePath(rootDir, id, implicitExtension);
398
+ const { filename, postfix } = extractCivetFilename(id, outExt);
399
+ let ref1;
400
+ if (import_path.default.isAbsolute(filename)) {
401
+ ref1 = resolveAbsolutePath(rootDir, filename, implicitExtension);
400
402
  } else {
401
- ref2 = import_path.default.resolve(import_path.default.dirname(importer ?? ""), id);
403
+ ref1 = import_path.default.resolve(import_path.default.dirname(importer ?? ""), filename);
402
404
  }
403
405
  ;
404
- let resolvedId = ref2;
405
- if (!resolvedId) return null;
406
- if (!resolvedId.endsWith(".civet")) {
406
+ let resolved = ref1;
407
+ if (!resolved) return null;
408
+ if (!resolved.endsWith(civetSuffix)) {
407
409
  if (!implicitExtension) return null;
408
- const implicitId = implicitCivet(resolvedId);
410
+ const implicitId = implicitCivet(resolved);
409
411
  if (!implicitId) return null;
410
- resolvedId = implicitId;
412
+ resolved = implicitId;
411
413
  }
412
414
  if (options2.scan && meta.framework === "vite") {
413
- resolvedId = `\0${resolvedId}`;
415
+ resolved = `\0${resolved}`;
414
416
  }
415
- return resolvedId + outExt + postfix;
417
+ return resolved + outExt + postfix;
416
418
  },
417
419
  loadInclude(id) {
418
- return isCivetTranspiled.test(id);
420
+ return extractCivetFilename(id, outExt).filename.endsWith(civetSuffix);
419
421
  },
420
422
  async load(id) {
421
- const match = isCivetTranspiled.exec(id);
422
- if (!match) {
423
+ let { filename } = extractCivetFilename(id, outExt);
424
+ if (!filename.endsWith(civetSuffix)) {
423
425
  return null;
424
426
  }
425
- const basename = id.slice(0, match.index + match[1].length);
426
- const filename = import_path.default.resolve(rootDir, basename);
427
+ filename = import_path.default.resolve(rootDir, filename);
427
428
  this.addWatchFile(filename);
428
429
  let mtime, cached, resolve;
429
430
  if (cache != null) {
@@ -437,9 +438,9 @@ var rawPlugin = (options = {}, meta) => {
437
438
  if (cached.promise) {
438
439
  await cached.promise;
439
440
  }
440
- let ref3;
441
- if ((ref3 = cached.result) != null) {
442
- const result = ref3;
441
+ let ref2;
442
+ if ((ref2 = cached.result) != null) {
443
+ const result = ref2;
443
444
  return result;
444
445
  }
445
446
  }
@@ -515,8 +516,8 @@ var rawPlugin = (options = {}, meta) => {
515
516
  }
516
517
  }
517
518
  if (transformTS) {
518
- for (let ref4 = import_civet.lib.gatherRecursive(ast, ($) => $.type === "ModuleSpecifier"), i = 0, len = ref4.length; i < len; i++) {
519
- const _spec = ref4[i];
519
+ for (let ref3 = import_civet.lib.gatherRecursive(ast, ($) => $.type === "ModuleSpecifier"), i = 0, len = ref3.length; i < len; i++) {
520
+ const _spec = ref3[i];
520
521
  const spec = _spec;
521
522
  if (spec.module?.input) {
522
523
  spec.module.token = spec.module.input.replace(/\.([mc])?ts(['"])$/, ".$1js$2");
@@ -619,9 +620,9 @@ var rawPlugin = (options = {}, meta) => {
619
620
  compiler.options.resolve.extensions.unshift(".civet");
620
621
  }
621
622
  return aliasResolver = (id) => {
622
- let ref5;
623
- for (const key in ref5 = compiler.options.resolve.alias) {
624
- const value = ref5[key];
623
+ let ref4;
624
+ for (const key in ref4 = compiler.options.resolve.alias) {
625
+ const value = ref4[key];
625
626
  if (key.endsWith("$")) {
626
627
  if (id === key.slice(0, -1)) {
627
628
  return typeof value === "string" ? value : "\0";
@@ -1,4 +1,4 @@
1
- // unplugin-civet:/home/daniel/apps/Civet/source/unplugin/unplugin.civet.jsx
1
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\unplugin\unplugin.civet.jsx
2
2
  import { createUnplugin } from "unplugin";
3
3
  import civet, { lib, SourceMap } from "@danielx/civet";
4
4
  import { findInDir, loadConfig } from "@danielx/civet/config";
@@ -14,24 +14,26 @@ import os from "os";
14
14
  // source/unplugin/constants.mjs
15
15
  var DEFAULT_EXTENSIONS = [".mjs", ".js", ".mts", ".ts", ".jsx", ".tsx", ".json"];
16
16
 
17
- // unplugin-civet:/home/daniel/apps/Civet/source/unplugin/unplugin.civet.jsx
17
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\unplugin\unplugin.civet.jsx
18
18
  var DiagnosticCategory = {};
19
19
  DiagnosticCategory[DiagnosticCategory["Warning"] = 0] = "Warning";
20
20
  DiagnosticCategory[DiagnosticCategory["Error"] = 1] = "Error";
21
21
  DiagnosticCategory[DiagnosticCategory["Suggestion"] = 2] = "Suggestion";
22
22
  DiagnosticCategory[DiagnosticCategory["Message"] = 3] = "Message";
23
- var civetExtension = /\.civet$/;
24
- var isCivetTranspiled = /(\.civet)(\.[jt]sx)?([?#].*)?$/;
25
23
  var postfixRE = /[?#].*$/s;
26
24
  var isWindows = os.platform() === "win32";
27
25
  var windowsSlashRE = /\\/g;
28
- function cleanCivetId(id) {
26
+ var civetSuffix = ".civet";
27
+ function extractCivetFilename(id, outputExtension) {
29
28
  let postfix = "";
30
- id = id.replace(postfixRE, (match) => {
29
+ let filename = id.replace(postfixRE, (match) => {
31
30
  postfix = match;
32
31
  return "";
33
- }).replace(/\.[jt]sx$/, "");
34
- return { id, postfix };
32
+ });
33
+ if (filename.endsWith(outputExtension)) {
34
+ filename = filename.slice(0, -outputExtension.length);
35
+ }
36
+ return { filename, postfix };
35
37
  }
36
38
  function tryStatSync(file) {
37
39
  try {
@@ -113,7 +115,10 @@ var rawPlugin = (options = {}, meta) => {
113
115
  name: "unplugin-civet",
114
116
  enforce: "pre",
115
117
  async buildStart() {
116
- const civetConfigPath = "config" in options ? options.config : await findInDir(process.cwd());
118
+ let civetConfigPath = options.config;
119
+ if (civetConfigPath === void 0) {
120
+ civetConfigPath = await findInDir(process.cwd());
121
+ }
117
122
  if (civetConfigPath) {
118
123
  compileOptions = await loadConfig(civetConfigPath);
119
124
  }
@@ -324,10 +329,8 @@ var rawPlugin = (options = {}, meta) => {
324
329
  } else {
325
330
  console.log(`WARNING: No .d.ts extension in ${filePath}`);
326
331
  }
327
- let ref1;
328
- if (ref1 = filePath.match(civetExtension)) {
329
- const match = ref1;
330
- filePath = filePath.slice(0, -match[0].length);
332
+ if (filePath.endsWith(civetSuffix)) {
333
+ filePath = filePath.slice(0, -civetSuffix.length);
331
334
  } else {
332
335
  console.log(`WARNING: No .civet extension in ${filePath}`);
333
336
  }
@@ -360,38 +363,36 @@ var rawPlugin = (options = {}, meta) => {
360
363
  id = aliasResolver(id);
361
364
  }
362
365
  if (/\0/.test(id)) return null;
363
- let postfix;
364
- ({ id, postfix } = cleanCivetId(id));
365
- let ref2;
366
- if (path.isAbsolute(id)) {
367
- ref2 = resolveAbsolutePath(rootDir, id, implicitExtension);
366
+ const { filename, postfix } = extractCivetFilename(id, outExt);
367
+ let ref1;
368
+ if (path.isAbsolute(filename)) {
369
+ ref1 = resolveAbsolutePath(rootDir, filename, implicitExtension);
368
370
  } else {
369
- ref2 = path.resolve(path.dirname(importer ?? ""), id);
371
+ ref1 = path.resolve(path.dirname(importer ?? ""), filename);
370
372
  }
371
373
  ;
372
- let resolvedId = ref2;
373
- if (!resolvedId) return null;
374
- if (!resolvedId.endsWith(".civet")) {
374
+ let resolved = ref1;
375
+ if (!resolved) return null;
376
+ if (!resolved.endsWith(civetSuffix)) {
375
377
  if (!implicitExtension) return null;
376
- const implicitId = implicitCivet(resolvedId);
378
+ const implicitId = implicitCivet(resolved);
377
379
  if (!implicitId) return null;
378
- resolvedId = implicitId;
380
+ resolved = implicitId;
379
381
  }
380
382
  if (options2.scan && meta.framework === "vite") {
381
- resolvedId = `\0${resolvedId}`;
383
+ resolved = `\0${resolved}`;
382
384
  }
383
- return resolvedId + outExt + postfix;
385
+ return resolved + outExt + postfix;
384
386
  },
385
387
  loadInclude(id) {
386
- return isCivetTranspiled.test(id);
388
+ return extractCivetFilename(id, outExt).filename.endsWith(civetSuffix);
387
389
  },
388
390
  async load(id) {
389
- const match = isCivetTranspiled.exec(id);
390
- if (!match) {
391
+ let { filename } = extractCivetFilename(id, outExt);
392
+ if (!filename.endsWith(civetSuffix)) {
391
393
  return null;
392
394
  }
393
- const basename = id.slice(0, match.index + match[1].length);
394
- const filename = path.resolve(rootDir, basename);
395
+ filename = path.resolve(rootDir, filename);
395
396
  this.addWatchFile(filename);
396
397
  let mtime, cached, resolve;
397
398
  if (cache != null) {
@@ -405,9 +406,9 @@ var rawPlugin = (options = {}, meta) => {
405
406
  if (cached.promise) {
406
407
  await cached.promise;
407
408
  }
408
- let ref3;
409
- if ((ref3 = cached.result) != null) {
410
- const result = ref3;
409
+ let ref2;
410
+ if ((ref2 = cached.result) != null) {
411
+ const result = ref2;
411
412
  return result;
412
413
  }
413
414
  }
@@ -483,8 +484,8 @@ var rawPlugin = (options = {}, meta) => {
483
484
  }
484
485
  }
485
486
  if (transformTS) {
486
- for (let ref4 = lib.gatherRecursive(ast, ($) => $.type === "ModuleSpecifier"), i = 0, len = ref4.length; i < len; i++) {
487
- const _spec = ref4[i];
487
+ for (let ref3 = lib.gatherRecursive(ast, ($) => $.type === "ModuleSpecifier"), i = 0, len = ref3.length; i < len; i++) {
488
+ const _spec = ref3[i];
488
489
  const spec = _spec;
489
490
  if (spec.module?.input) {
490
491
  spec.module.token = spec.module.input.replace(/\.([mc])?ts(['"])$/, ".$1js$2");
@@ -587,9 +588,9 @@ var rawPlugin = (options = {}, meta) => {
587
588
  compiler.options.resolve.extensions.unshift(".civet");
588
589
  }
589
590
  return aliasResolver = (id) => {
590
- let ref5;
591
- for (const key in ref5 = compiler.options.resolve.alias) {
592
- const value = ref5[key];
591
+ let ref4;
592
+ for (const key in ref4 = compiler.options.resolve.alias) {
593
+ const value = ref4[key];
593
594
  if (key.endsWith("$")) {
594
595
  if (id === key.slice(0, -1)) {
595
596
  return typeof value === "string" ? value : "\0";
@@ -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/vite.civet.jsx
29
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\unplugin\vite.civet.jsx
30
30
  var vite_civet_exports = {};
31
31
  __export(vite_civet_exports, {
32
32
  default: () => vite_civet_default
@@ -1,4 +1,4 @@
1
- // unplugin-civet:/home/daniel/apps/Civet/source/unplugin/vite.civet.jsx
1
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\unplugin\vite.civet.jsx
2
2
  import civetUnplugin from "./unplugin.mjs";
3
3
  var vite_civet_default = civetUnplugin.vite;
4
4
  export {
@@ -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/webpack.civet.jsx
29
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\unplugin\webpack.civet.jsx
30
30
  var webpack_civet_exports = {};
31
31
  __export(webpack_civet_exports, {
32
32
  default: () => webpack_civet_default
@@ -1,4 +1,4 @@
1
- // unplugin-civet:/home/daniel/apps/Civet/source/unplugin/webpack.civet.jsx
1
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\unplugin\webpack.civet.jsx
2
2
  import civetUnplugin from "./unplugin.mjs";
3
3
  var webpack_civet_default = civetUnplugin.webpack;
4
4
  export {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@danielx/civet",
3
3
  "type": "commonjs",
4
- "version": "0.10.2",
4
+ "version": "0.10.4",
5
5
  "description": "CoffeeScript style syntax for TypeScript",
6
6
  "main": "dist/main.js",
7
7
  "module": "dist/main.mjs",
@@ -23,6 +23,7 @@
23
23
  "./esm": "./dist/esm.mjs",
24
24
  "./esbuild-plugin": "./dist/esbuild-plugin.js",
25
25
  "./register": "./register.js",
26
+ "./register-noconfig": "./register-noconfig.js",
26
27
  "./config": {
27
28
  "types": "./dist/config.d.ts",
28
29
  "require": "./dist/config.js",
@@ -107,7 +108,7 @@
107
108
  "dependencies": {
108
109
  "@cspotcode/source-map-support": "^0.8.1",
109
110
  "@typescript/vfs": "^1.6.0",
110
- "unplugin": "^2.2.1"
111
+ "unplugin": "^2.3.2"
111
112
  },
112
113
  "devDependencies": {
113
114
  "@danielx/civet": "0.9.4",
package/register.js CHANGED
@@ -9,6 +9,14 @@ for both ESM `import`s and CJS `require`s.
9
9
  node --import @danielx/civet/register source.civet
10
10
  ```
11
11
 
12
+ If you don't want the loader to search for/use accompanying civetconfig files,
13
+ you can use the `-noconfig` version (where `NOCONFIG` comments are removed):
14
+
15
+ @example
16
+ ```bash
17
+ node --import @danielx/civet/register-noconfig source.civet
18
+ ```
19
+
12
20
  On older Node, `require`ing this file will register the `.civet` extension
13
21
  for CJS `require`s.
14
22
 
@@ -16,13 +24,30 @@ for CJS `require`s.
16
24
  ```bash
17
25
  node -r @danielx/civet/register source.civet
18
26
  ```
27
+
28
+ If you want to configure the loader, you can make your own
29
+ `register.mjs` along these lines:
30
+
31
+ @example
32
+ ```javascript
33
+ import { register } from 'node:module';
34
+ register('@danielx/civet/esm', import.meta.url, {data: {
35
+ //config: 'path/config.json',
36
+ parseOptions: {
37
+ // Add your parse options here
38
+ },
39
+ }});
40
+ ```
41
+
19
42
  */
20
43
 
21
44
  try {
22
45
  const { register } = require('node:module');
23
46
  const { pathToFileURL } = require('node:url');
24
47
 
25
- register('./dist/esm.mjs', pathToFileURL(__filename));
48
+ register('./dist/esm.mjs', pathToFileURL(__filename)
49
+ //NOCONFIG//, {data: {config: null}}
50
+ );
26
51
  } catch (e) {
27
52
  // older Node lacking module register
28
53
  }
@@ -38,6 +63,7 @@ if (require.extensions) {
38
63
  js: true,
39
64
  inlineMap: true,
40
65
  sync: true,
66
+ //NOCONFIG//config: null,
41
67
  });
42
68
  module._compile(js, filename);
43
69
  };