@danielx/civet 0.9.7 → 0.10.1

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.
@@ -0,0 +1,2 @@
1
+ declare const _default: (options: import("./unplugin.js").PluginOptions) => JsPlugin;
2
+ export default _default;
@@ -0,0 +1,36 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\unplugin\farm.civet.jsx
30
+ var farm_civet_exports = {};
31
+ __export(farm_civet_exports, {
32
+ default: () => farm_civet_default
33
+ });
34
+ module.exports = __toCommonJS(farm_civet_exports);
35
+ var import_unplugin = __toESM(require("./unplugin.js"));
36
+ var farm_civet_default = import_unplugin.default.farm;
@@ -0,0 +1,6 @@
1
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\unplugin\farm.civet.jsx
2
+ import civetUnplugin from "./unplugin.mjs";
3
+ var farm_civet_default = civetUnplugin.farm;
4
+ export {
5
+ farm_civet_default as default
6
+ };
@@ -0,0 +1,2 @@
1
+ declare const _default: (options: import("./unplugin.js").PluginOptions) => any;
2
+ export default _default;
@@ -0,0 +1,36 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\unplugin\rolldown.civet.jsx
30
+ var rolldown_civet_exports = {};
31
+ __export(rolldown_civet_exports, {
32
+ default: () => rolldown_civet_default
33
+ });
34
+ module.exports = __toCommonJS(rolldown_civet_exports);
35
+ var import_unplugin = __toESM(require("./unplugin.js"));
36
+ var rolldown_civet_default = import_unplugin.default.rolldown;
@@ -0,0 +1,6 @@
1
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\unplugin\rolldown.civet.jsx
2
+ import civetUnplugin from "./unplugin.mjs";
3
+ var rolldown_civet_default = civetUnplugin.rolldown;
4
+ export {
5
+ rolldown_civet_default as default
6
+ };
@@ -0,0 +1,2 @@
1
+ declare const _default: (options: import("./unplugin.js").PluginOptions) => RspackPluginInstance;
2
+ export default _default;
@@ -0,0 +1,36 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\unplugin\rspack.civet.jsx
30
+ var rspack_civet_exports = {};
31
+ __export(rspack_civet_exports, {
32
+ default: () => rspack_civet_default
33
+ });
34
+ module.exports = __toCommonJS(rspack_civet_exports);
35
+ var import_unplugin = __toESM(require("./unplugin.js"));
36
+ var rspack_civet_default = import_unplugin.default.rspack;
@@ -0,0 +1,6 @@
1
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\unplugin\rspack.civet.jsx
2
+ import civetUnplugin from "./unplugin.mjs";
3
+ var rspack_civet_default = civetUnplugin.rspack;
4
+ export {
5
+ rspack_civet_default as default
6
+ };
@@ -424,22 +424,30 @@ var rawPlugin = (options = {}, meta) => {
424
424
  }
425
425
  const basename = id.slice(0, match.index + match[1].length);
426
426
  const filename = import_path.default.resolve(rootDir, basename);
427
+ this.addWatchFile(filename);
427
428
  let mtime, cached, resolve;
428
429
  if (cache != null) {
429
- mtime = (await fs.promises.stat(filename)).mtimeMs;
430
- cached = cache?.get(filename);
431
- if (cached && cached.mtime === mtime) {
432
- if (cached.promise) {
433
- await cached.promise;
434
- }
435
- if (cached.result) {
436
- return cached.result;
430
+ try {
431
+ mtime = (await fs.promises.stat(filename)).mtimeMs;
432
+ } catch (e) {
433
+ }
434
+ if (mtime != null) {
435
+ cached = cache.get(filename);
436
+ if (cached && cached.mtime === mtime) {
437
+ if (cached.promise) {
438
+ await cached.promise;
439
+ }
440
+ let ref3;
441
+ if ((ref3 = cached.result) != null) {
442
+ const result = ref3;
443
+ return result;
444
+ }
437
445
  }
446
+ const promise = new Promise((r) => {
447
+ resolve = r;
448
+ });
449
+ cache.set(filename, cached = { mtime, promise });
438
450
  }
439
- const promise = new Promise((r) => {
440
- resolve = r;
441
- });
442
- cache.set(filename, cached = { mtime, promise });
443
451
  }
444
452
  try {
445
453
  let checkErrors = function() {
@@ -449,7 +457,6 @@ var rawPlugin = (options = {}, meta) => {
449
457
  ;
450
458
  return;
451
459
  };
452
- this.addWatchFile(filename);
453
460
  let compiled;
454
461
  let sourceMap;
455
462
  const civetOptions = {
@@ -502,13 +509,14 @@ var rawPlugin = (options = {}, meta) => {
502
509
  }
503
510
  case "preserve": {
504
511
  compiled = compiledTS;
512
+ sourceMap = civetSourceMap;
505
513
  break;
506
514
  }
507
515
  }
508
516
  }
509
517
  if (transformTS) {
510
- for (let ref3 = import_civet.lib.gatherRecursive(ast, ($) => $.type === "ModuleSpecifier"), i = 0, len = ref3.length; i < len; i++) {
511
- const _spec = ref3[i];
518
+ for (let ref4 = import_civet.lib.gatherRecursive(ast, ($) => $.type === "ModuleSpecifier"), i = 0, len = ref4.length; i < len; i++) {
519
+ const _spec = ref4[i];
512
520
  const spec = _spec;
513
521
  if (spec.module?.input) {
514
522
  spec.module.token = spec.module.input.replace(/\.([mc])?ts(['"])$/, ".$1js$2");
@@ -593,6 +601,16 @@ var rawPlugin = (options = {}, meta) => {
593
601
  return modules;
594
602
  }
595
603
  },
604
+ rspack(compiler) {
605
+ if (implicitExtension) {
606
+ compiler.options ??= {};
607
+ compiler.options.resolve ??= {};
608
+ compiler.options.resolve.extensions ??= ["", ".js", ".json", ".wasm"];
609
+ return compiler.options.resolve.extensions.unshift(".civet");
610
+ }
611
+ ;
612
+ return;
613
+ },
596
614
  webpack(compiler) {
597
615
  if (implicitExtension) {
598
616
  compiler.options ??= {};
@@ -601,9 +619,9 @@ var rawPlugin = (options = {}, meta) => {
601
619
  compiler.options.resolve.extensions.unshift(".civet");
602
620
  }
603
621
  return aliasResolver = (id) => {
604
- let ref4;
605
- for (const key in ref4 = compiler.options.resolve.alias) {
606
- const value = ref4[key];
622
+ let ref5;
623
+ for (const key in ref5 = compiler.options.resolve.alias) {
624
+ const value = ref5[key];
607
625
  if (key.endsWith("$")) {
608
626
  if (id === key.slice(0, -1)) {
609
627
  return typeof value === "string" ? value : "\0";
@@ -392,22 +392,30 @@ var rawPlugin = (options = {}, meta) => {
392
392
  }
393
393
  const basename = id.slice(0, match.index + match[1].length);
394
394
  const filename = path.resolve(rootDir, basename);
395
+ this.addWatchFile(filename);
395
396
  let mtime, cached, resolve;
396
397
  if (cache != null) {
397
- mtime = (await fs.promises.stat(filename)).mtimeMs;
398
- cached = cache?.get(filename);
399
- if (cached && cached.mtime === mtime) {
400
- if (cached.promise) {
401
- await cached.promise;
402
- }
403
- if (cached.result) {
404
- return cached.result;
398
+ try {
399
+ mtime = (await fs.promises.stat(filename)).mtimeMs;
400
+ } catch (e) {
401
+ }
402
+ if (mtime != null) {
403
+ cached = cache.get(filename);
404
+ if (cached && cached.mtime === mtime) {
405
+ if (cached.promise) {
406
+ await cached.promise;
407
+ }
408
+ let ref3;
409
+ if ((ref3 = cached.result) != null) {
410
+ const result = ref3;
411
+ return result;
412
+ }
405
413
  }
414
+ const promise = new Promise((r) => {
415
+ resolve = r;
416
+ });
417
+ cache.set(filename, cached = { mtime, promise });
406
418
  }
407
- const promise = new Promise((r) => {
408
- resolve = r;
409
- });
410
- cache.set(filename, cached = { mtime, promise });
411
419
  }
412
420
  try {
413
421
  let checkErrors = function() {
@@ -417,7 +425,6 @@ var rawPlugin = (options = {}, meta) => {
417
425
  ;
418
426
  return;
419
427
  };
420
- this.addWatchFile(filename);
421
428
  let compiled;
422
429
  let sourceMap;
423
430
  const civetOptions = {
@@ -470,13 +477,14 @@ var rawPlugin = (options = {}, meta) => {
470
477
  }
471
478
  case "preserve": {
472
479
  compiled = compiledTS;
480
+ sourceMap = civetSourceMap;
473
481
  break;
474
482
  }
475
483
  }
476
484
  }
477
485
  if (transformTS) {
478
- for (let ref3 = lib.gatherRecursive(ast, ($) => $.type === "ModuleSpecifier"), i = 0, len = ref3.length; i < len; i++) {
479
- const _spec = ref3[i];
486
+ for (let ref4 = lib.gatherRecursive(ast, ($) => $.type === "ModuleSpecifier"), i = 0, len = ref4.length; i < len; i++) {
487
+ const _spec = ref4[i];
480
488
  const spec = _spec;
481
489
  if (spec.module?.input) {
482
490
  spec.module.token = spec.module.input.replace(/\.([mc])?ts(['"])$/, ".$1js$2");
@@ -561,6 +569,16 @@ var rawPlugin = (options = {}, meta) => {
561
569
  return modules;
562
570
  }
563
571
  },
572
+ rspack(compiler) {
573
+ if (implicitExtension) {
574
+ compiler.options ??= {};
575
+ compiler.options.resolve ??= {};
576
+ compiler.options.resolve.extensions ??= ["", ".js", ".json", ".wasm"];
577
+ return compiler.options.resolve.extensions.unshift(".civet");
578
+ }
579
+ ;
580
+ return;
581
+ },
564
582
  webpack(compiler) {
565
583
  if (implicitExtension) {
566
584
  compiler.options ??= {};
@@ -569,9 +587,9 @@ var rawPlugin = (options = {}, meta) => {
569
587
  compiler.options.resolve.extensions.unshift(".civet");
570
588
  }
571
589
  return aliasResolver = (id) => {
572
- let ref4;
573
- for (const key in ref4 = compiler.options.resolve.alias) {
574
- const value = ref4[key];
590
+ let ref5;
591
+ for (const key in ref5 = compiler.options.resolve.alias) {
592
+ const value = ref5[key];
575
593
  if (key.endsWith("$")) {
576
594
  if (id === key.slice(0, -1)) {
577
595
  return typeof value === "string" ? value : "\0";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@danielx/civet",
3
3
  "type": "commonjs",
4
- "version": "0.9.7",
4
+ "version": "0.10.1",
5
5
  "description": "CoffeeScript style syntax for TypeScript",
6
6
  "main": "dist/main.js",
7
7
  "module": "dist/main.mjs",
@@ -33,6 +33,36 @@
33
33
  "require": "./dist/unplugin/unplugin.js",
34
34
  "import": "./dist/unplugin/unplugin.mjs"
35
35
  },
36
+ "./astro": {
37
+ "types": "./dist/unplugin/astro.d.ts",
38
+ "require": "./dist/unplugin/astro.js",
39
+ "import": "./dist/unplugin/astro.mjs"
40
+ },
41
+ "./esbuild": {
42
+ "types": "./dist/unplugin/esbuild.d.ts",
43
+ "require": "./dist/unplugin/esbuild.js",
44
+ "import": "./dist/unplugin/esbuild.mjs"
45
+ },
46
+ "./farm": {
47
+ "types": "./dist/unplugin/farm.d.ts",
48
+ "require": "./dist/unplugin/farm.js",
49
+ "import": "./dist/unplugin/farm.mjs"
50
+ },
51
+ "./rolldown": {
52
+ "types": "./dist/unplugin/rolldown.d.ts",
53
+ "require": "./dist/unplugin/rolldown.js",
54
+ "import": "./dist/unplugin/rolldown.mjs"
55
+ },
56
+ "./rollup": {
57
+ "types": "./dist/unplugin/rollup.d.ts",
58
+ "require": "./dist/unplugin/rollup.js",
59
+ "import": "./dist/unplugin/rollup.mjs"
60
+ },
61
+ "./rspack": {
62
+ "types": "./dist/unplugin/rspack.d.ts",
63
+ "require": "./dist/unplugin/rspack.js",
64
+ "import": "./dist/unplugin/rspack.mjs"
65
+ },
36
66
  "./vite": {
37
67
  "types": "./dist/unplugin/vite.d.ts",
38
68
  "require": "./dist/unplugin/vite.js",
@@ -43,21 +73,6 @@
43
73
  "require": "./dist/unplugin/webpack.js",
44
74
  "import": "./dist/unplugin/webpack.mjs"
45
75
  },
46
- "./rollup": {
47
- "types": "./dist/unplugin/rollup.d.ts",
48
- "require": "./dist/unplugin/rollup.js",
49
- "import": "./dist/unplugin/rollup.mjs"
50
- },
51
- "./esbuild": {
52
- "types": "./dist/unplugin/esbuild.d.ts",
53
- "require": "./dist/unplugin/esbuild.js",
54
- "import": "./dist/unplugin/esbuild.mjs"
55
- },
56
- "./astro": {
57
- "types": "./dist/unplugin/astro.d.ts",
58
- "require": "./dist/unplugin/astro.js",
59
- "import": "./dist/unplugin/astro.mjs"
60
- },
61
76
  "./ts-diagnostic": {
62
77
  "require": "./dist/ts-diagnostic.js",
63
78
  "import": "./dist/ts-diagnostic.mjs"
@@ -92,7 +107,7 @@
92
107
  "dependencies": {
93
108
  "@cspotcode/source-map-support": "^0.8.1",
94
109
  "@typescript/vfs": "^1.6.0",
95
- "unplugin": "^2.1.0"
110
+ "unplugin": "^2.2.1"
96
111
  },
97
112
  "devDependencies": {
98
113
  "@danielx/civet": "0.9.4",