@danielx/civet 0.7.15 → 0.7.17

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.
Files changed (49) hide show
  1. package/dist/browser.js +14 -11
  2. package/dist/civet +141 -108
  3. package/dist/config.d.mts +1 -0
  4. package/dist/config.d.ts +1 -0
  5. package/dist/config.mjs +122 -0
  6. package/dist/esm.mjs +1 -1
  7. package/dist/main.js +14 -11
  8. package/dist/main.mjs +14 -11
  9. package/dist/unplugin/astro.d.ts +11 -0
  10. package/dist/unplugin/astro.js +49 -0
  11. package/dist/unplugin/astro.mjs +19 -0
  12. package/dist/unplugin/esbuild.d.ts +2 -0
  13. package/dist/unplugin/esbuild.js +36 -0
  14. package/dist/unplugin/esbuild.mjs +6 -0
  15. package/dist/unplugin/rollup.d.ts +2 -0
  16. package/dist/unplugin/rollup.js +36 -0
  17. package/dist/unplugin/rollup.mjs +6 -0
  18. package/dist/{unplugin.d.ts → unplugin/unplugin.d.ts} +7 -10
  19. package/dist/{unplugin.js → unplugin/unplugin.js} +81 -66
  20. package/dist/{unplugin-shared.mjs → unplugin/unplugin.mjs} +80 -65
  21. package/dist/unplugin/vite.d.ts +2 -0
  22. package/dist/unplugin/vite.js +36 -0
  23. package/dist/unplugin/vite.mjs +6 -0
  24. package/dist/unplugin/webpack.d.ts +2 -0
  25. package/dist/unplugin/webpack.js +36 -0
  26. package/dist/unplugin/webpack.mjs +6 -0
  27. package/package.json +27 -17
  28. package/dist/astro.d.mts +0 -16
  29. package/dist/astro.d.ts +0 -16
  30. package/dist/astro.js +0 -537
  31. package/dist/astro.mjs +0 -22
  32. package/dist/esbuild.d.mts +0 -8
  33. package/dist/esbuild.d.ts +0 -8
  34. package/dist/esbuild.js +0 -524
  35. package/dist/esbuild.mjs +0 -9
  36. package/dist/rollup.d.mts +0 -8
  37. package/dist/rollup.d.ts +0 -8
  38. package/dist/rollup.js +0 -524
  39. package/dist/rollup.mjs +0 -9
  40. package/dist/unplugin.d.mts +0 -26
  41. package/dist/unplugin.mjs +0 -10
  42. package/dist/vite.d.mts +0 -8
  43. package/dist/vite.d.ts +0 -8
  44. package/dist/vite.js +0 -524
  45. package/dist/vite.mjs +0 -9
  46. package/dist/webpack.d.mts +0 -7
  47. package/dist/webpack.d.ts +0 -7
  48. package/dist/webpack.js +0 -524
  49. package/dist/webpack.mjs +0 -9
package/dist/main.mjs CHANGED
@@ -28,9 +28,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  mod
29
29
  ));
30
30
 
31
- // node_modules/@danielx/hera/dist/machine.js
31
+ // ../Hera/dist/machine.js
32
32
  var require_machine = __commonJS({
33
- "node_modules/@danielx/hera/dist/machine.js"(exports, module) {
33
+ "../Hera/dist/machine.js"(exports, module) {
34
34
  "use strict";
35
35
  var __defProp2 = Object.defineProperty;
36
36
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
@@ -7066,8 +7066,8 @@ var $L60 = (0, import_lib3.$L)("??=");
7066
7066
  var $L61 = (0, import_lib3.$L)("?=");
7067
7067
  var $L62 = (0, import_lib3.$L)("and=");
7068
7068
  var $L63 = (0, import_lib3.$L)("or=");
7069
- var $L64 = (0, import_lib3.$L)("**");
7070
- var $L65 = (0, import_lib3.$L)("*");
7069
+ var $L64 = (0, import_lib3.$L)("*");
7070
+ var $L65 = (0, import_lib3.$L)("**");
7071
7071
  var $L66 = (0, import_lib3.$L)("/");
7072
7072
  var $L67 = (0, import_lib3.$L)("%%");
7073
7073
  var $L68 = (0, import_lib3.$L)("%");
@@ -8105,13 +8105,15 @@ var TernaryRest$$ = [TernaryRest$0, TernaryRest$1];
8105
8105
  function TernaryRest(ctx, state2) {
8106
8106
  return (0, import_lib3.$EVENT_C)(ctx, state2, "TernaryRest", TernaryRest$$);
8107
8107
  }
8108
- var NestedTernaryRest$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(PushIndent, (0, import_lib3.$E)((0, import_lib3.$S)(Nested, QuestionMark, MaybeNestedExtendedExpression, Nested, Colon, MaybeNestedExtendedExpression)), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
8108
+ var NestedTernaryRest$0 = (0, import_lib3.$S)(Nested, QuestionMark, MaybeNestedExtendedExpression, Nested, Colon, MaybeNestedExtendedExpression);
8109
+ var NestedTernaryRest$1 = (0, import_lib3.$TS)((0, import_lib3.$S)(PushIndent, (0, import_lib3.$E)((0, import_lib3.$S)(Nested, QuestionMark, MaybeNestedExtendedExpression, Nested, Colon, MaybeNestedExtendedExpression)), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
8109
8110
  if ($2)
8110
8111
  return $2;
8111
8112
  return $skip;
8112
8113
  });
8114
+ var NestedTernaryRest$$ = [NestedTernaryRest$0, NestedTernaryRest$1];
8113
8115
  function NestedTernaryRest(ctx, state2) {
8114
- return (0, import_lib3.$EVENT)(ctx, state2, "NestedTernaryRest", NestedTernaryRest$0);
8116
+ return (0, import_lib3.$EVENT_C)(ctx, state2, "NestedTernaryRest", NestedTernaryRest$$);
8115
8117
  }
8116
8118
  var ShortCircuitExpression$0 = BinaryOpExpression;
8117
8119
  function ShortCircuitExpression(ctx, state2) {
@@ -11459,11 +11461,12 @@ var NotDedentedBinaryOp$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_
11459
11461
  ws.push(...$2);
11460
11462
  return [ws, $3];
11461
11463
  });
11462
- var NotDedentedBinaryOp$1 = (0, import_lib3.$TS)((0, import_lib3.$S)(Nested, (0, import_lib3.$E)(_), (0, import_lib3.$N)(Identifier), BinaryOp), function($skip, $loc, $0, $1, $2, $3, $4) {
11464
+ var NotDedentedBinaryOp$1 = (0, import_lib3.$TS)((0, import_lib3.$S)(Nested, (0, import_lib3.$E)(_), (0, import_lib3.$N)(Identifier), (0, import_lib3.$C)((0, import_lib3.$N)((0, import_lib3.$EXPECT)($L64, 'NotDedentedBinaryOp "*"')), (0, import_lib3.$N)(ImportDeclaration)), BinaryOp), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
11465
+ var op = $5;
11463
11466
  const ws = [...$1];
11464
11467
  if ($2)
11465
11468
  ws.push(...$2);
11466
- return [ws, $4];
11469
+ return [ws, op];
11467
11470
  });
11468
11471
  var NotDedentedBinaryOp$$ = [NotDedentedBinaryOp$0, NotDedentedBinaryOp$1];
11469
11472
  function NotDedentedBinaryOp(ctx, state2) {
@@ -11517,8 +11520,8 @@ var _BinaryOp$$ = [_BinaryOp$0, _BinaryOp$1, _BinaryOp$2];
11517
11520
  function _BinaryOp(ctx, state2) {
11518
11521
  return (0, import_lib3.$EVENT_C)(ctx, state2, "_BinaryOp", _BinaryOp$$);
11519
11522
  }
11520
- var BinaryOpSymbol$0 = (0, import_lib3.$EXPECT)($L64, 'BinaryOpSymbol "**"');
11521
- var BinaryOpSymbol$1 = (0, import_lib3.$EXPECT)($L65, 'BinaryOpSymbol "*"');
11523
+ var BinaryOpSymbol$0 = (0, import_lib3.$EXPECT)($L65, 'BinaryOpSymbol "**"');
11524
+ var BinaryOpSymbol$1 = (0, import_lib3.$EXPECT)($L64, 'BinaryOpSymbol "*"');
11522
11525
  var BinaryOpSymbol$2 = (0, import_lib3.$EXPECT)($L66, 'BinaryOpSymbol "/"');
11523
11526
  var BinaryOpSymbol$3 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L67, 'BinaryOpSymbol "%%"'), function($skip, $loc, $0, $1) {
11524
11527
  return {
@@ -14453,7 +14456,7 @@ var SingleQuote$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L188, `Single
14453
14456
  function SingleQuote(ctx, state2) {
14454
14457
  return (0, import_lib3.$EVENT)(ctx, state2, "SingleQuote", SingleQuote$0);
14455
14458
  }
14456
- var Star$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L65, 'Star "*"'), function($skip, $loc, $0, $1) {
14459
+ var Star$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L64, 'Star "*"'), function($skip, $loc, $0, $1) {
14457
14460
  return { $loc, token: $1 };
14458
14461
  });
14459
14462
  function Star(ctx, state2) {
@@ -0,0 +1,11 @@
1
+ interface AstroIntegration {
2
+ name: string;
3
+ hooks: {
4
+ "astro:config:setup": (data: {
5
+ updateConfig: (config: unknown) => void;
6
+ }) => void;
7
+ };
8
+ }
9
+ import { type PluginOptions } from "./unplugin.js";
10
+ declare const _default: (opts?: PluginOptions) => AstroIntegration;
11
+ export default _default;
@@ -0,0 +1,49 @@
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\astro.civet.jsx
30
+ var astro_civet_exports = {};
31
+ __export(astro_civet_exports, {
32
+ default: () => astro_civet_default
33
+ });
34
+ module.exports = __toCommonJS(astro_civet_exports);
35
+ var import_unplugin = __toESM(require("./unplugin.js"));
36
+ var astro_civet_default = function(opts = {}) {
37
+ return {
38
+ name: "@danielx/civet",
39
+ hooks: {
40
+ "astro:config:setup": ({ updateConfig }) => {
41
+ return updateConfig({
42
+ vite: {
43
+ plugins: [import_unplugin.default.vite(opts)]
44
+ }
45
+ });
46
+ }
47
+ }
48
+ };
49
+ };
@@ -0,0 +1,19 @@
1
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\unplugin\astro.civet.jsx
2
+ import civetUnplugin, {} from "./unplugin.mjs";
3
+ var astro_civet_default = function(opts = {}) {
4
+ return {
5
+ name: "@danielx/civet",
6
+ hooks: {
7
+ "astro:config:setup": ({ updateConfig }) => {
8
+ return updateConfig({
9
+ vite: {
10
+ plugins: [civetUnplugin.vite(opts)]
11
+ }
12
+ });
13
+ }
14
+ }
15
+ };
16
+ };
17
+ export {
18
+ astro_civet_default as default
19
+ };
@@ -0,0 +1,2 @@
1
+ declare const _default: (options: import("./unplugin.js").PluginOptions) => import("esbuild").Plugin;
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\esbuild.civet.jsx
30
+ var esbuild_civet_exports = {};
31
+ __export(esbuild_civet_exports, {
32
+ default: () => esbuild_civet_default
33
+ });
34
+ module.exports = __toCommonJS(esbuild_civet_exports);
35
+ var import_unplugin = __toESM(require("./unplugin.js"));
36
+ var esbuild_civet_default = import_unplugin.default.esbuild;
@@ -0,0 +1,6 @@
1
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\unplugin\esbuild.civet.jsx
2
+ import civetUnplugin from "./unplugin.mjs";
3
+ var esbuild_civet_default = civetUnplugin.esbuild;
4
+ export {
5
+ esbuild_civet_default as default
6
+ };
@@ -0,0 +1,2 @@
1
+ declare const _default: (options: import("./unplugin.js").PluginOptions) => import("rollup").Plugin | import("rollup").Plugin[];
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\rollup.civet.jsx
30
+ var rollup_civet_exports = {};
31
+ __export(rollup_civet_exports, {
32
+ default: () => rollup_civet_default
33
+ });
34
+ module.exports = __toCommonJS(rollup_civet_exports);
35
+ var import_unplugin = __toESM(require("./unplugin.js"));
36
+ var rollup_civet_default = import_unplugin.default.rollup;
@@ -0,0 +1,6 @@
1
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\unplugin\rollup.civet.jsx
2
+ import civetUnplugin from "./unplugin.mjs";
3
+ var rollup_civet_default = civetUnplugin.rollup;
4
+ export {
5
+ rollup_civet_default as default
6
+ };
@@ -1,8 +1,6 @@
1
- import * as _unplugin from 'unplugin';
2
- import { TransformResult, createUnplugin } from 'unplugin';
3
- import { ParseOptions } from '@danielx/civet';
4
-
5
- type PluginOptions = {
1
+ import { type TransformResult, createUnplugin } from 'unplugin';
2
+ import { type ParseOptions } from '@danielx/civet';
3
+ export type PluginOptions = {
6
4
  implicitExtension?: boolean;
7
5
  outputExtension?: string;
8
6
  transformOutput?: (code: string, id: string) => TransformResult | Promise<TransformResult>;
@@ -19,8 +17,7 @@ type PluginOptions = {
19
17
  config?: string | null | undefined;
20
18
  parseOptions?: ParseOptions;
21
19
  };
22
- declare function slash(p: string): string;
23
- declare const rawPlugin: Parameters<typeof createUnplugin<PluginOptions>>[0];
24
- declare var unplugin: _unplugin.UnpluginInstance<PluginOptions, boolean>;
25
-
26
- export { PluginOptions, unplugin as default, rawPlugin, slash };
20
+ export declare function slash(p: string): string;
21
+ export declare const rawPlugin: Parameters<typeof createUnplugin<PluginOptions>>[0];
22
+ declare var unplugin: import("unplugin").UnpluginInstance<PluginOptions, boolean>;
23
+ export default unplugin;
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -27,14 +26,14 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
26
  ));
28
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
28
 
30
- // src/index.ts
31
- var src_exports = {};
32
- __export(src_exports, {
33
- default: () => src_default,
29
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\unplugin\unplugin.civet.jsx
30
+ var unplugin_civet_exports = {};
31
+ __export(unplugin_civet_exports, {
32
+ default: () => unplugin_civet_default,
34
33
  rawPlugin: () => rawPlugin,
35
34
  slash: () => slash
36
35
  });
37
- module.exports = __toCommonJS(src_exports);
36
+ module.exports = __toCommonJS(unplugin_civet_exports);
38
37
  var import_unplugin = require("unplugin");
39
38
  var import_civet = __toESM(require("@danielx/civet"));
40
39
  var import_config = require("@danielx/civet/config");
@@ -44,10 +43,15 @@ var import_path = __toESM(require("path"));
44
43
  var tsvfs = __toESM(require("@typescript/vfs"));
45
44
  var import_os = __toESM(require("os"));
46
45
 
47
- // src/constants.ts
46
+ // source/unplugin/constants.mjs
48
47
  var DEFAULT_EXTENSIONS = [".mjs", ".js", ".mts", ".ts", ".jsx", ".tsx", ".json"];
49
48
 
50
- // src/index.ts
49
+ // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\unplugin\unplugin.civet.jsx
50
+ var DiagnosticCategory = {};
51
+ DiagnosticCategory[DiagnosticCategory["Warning"] = 0] = "Warning";
52
+ DiagnosticCategory[DiagnosticCategory["Error"] = 1] = "Error";
53
+ DiagnosticCategory[DiagnosticCategory["Suggestion"] = 2] = "Suggestion";
54
+ DiagnosticCategory[DiagnosticCategory["Message"] = 3] = "Message";
51
55
  var isCivetTranspiled = /(\.civet)(\.[jt]sx)([?#].*)?$/;
52
56
  var postfixRE = /[?#].*$/s;
53
57
  var isWindows = import_os.default.platform() === "win32";
@@ -102,7 +106,7 @@ var rawPlugin = (options = {}, meta) => {
102
106
  let esbuildOptions;
103
107
  let configErrors;
104
108
  let configFileNames;
105
- const tsPromise = transformTS || options.ts === "tsc" ? import("typescript").then((m) => m.default) : null;
109
+ const tsPromise = transformTS || options.ts === "tsc" ? import("typescript").then(($) => $.default) : null;
106
110
  const getFormatHost = (sys) => {
107
111
  return {
108
112
  getCurrentDirectory: () => sys.getCurrentDirectory(),
@@ -116,16 +120,17 @@ var rawPlugin = (options = {}, meta) => {
116
120
  enforce: "pre",
117
121
  async buildStart() {
118
122
  if (transformTS || options.ts === "tsc") {
119
- let mogrify2 = function(key) {
123
+ let mogrify = function(key) {
120
124
  if (key in config && Array.isArray(config[key])) {
121
- config[key] = config[key].map((item) => {
125
+ return config[key] = config[key].map((item) => {
122
126
  if (typeof item !== "string")
123
127
  return item;
124
128
  return item.replace(/\.civet\b(?!\.)/g, ".civet.tsx");
125
129
  });
126
130
  }
131
+ ;
132
+ return;
127
133
  };
128
- var mogrify = mogrify2;
129
134
  const ts = await tsPromise;
130
135
  const civetConfigPath = "config" in options ? options.config : await (0, import_config.findInDir)(process.cwd());
131
136
  if (civetConfigPath) {
@@ -147,12 +152,12 @@ var rawPlugin = (options = {}, meta) => {
147
152
  console.error(ts.formatDiagnostic(error, getFormatHost(ts.sys)));
148
153
  throw error;
149
154
  }
150
- mogrify2("files");
155
+ mogrify("files");
151
156
  const system = { ...ts.sys };
152
157
  const { readDirectory: systemReadDirectory } = system;
153
158
  system.readDirectory = (path2, extensions, excludes, includes, depth) => {
154
159
  extensions = [...extensions ?? [], ".civet"];
155
- return systemReadDirectory(path2, extensions, excludes, includes, depth).map((name) => name.endsWith(".civet") ? name + ".tsx" : name);
160
+ return systemReadDirectory(path2, extensions, excludes, includes, depth).map(($1) => $1.endsWith(".civet") ? $1 + ".tsx" : $1);
156
161
  };
157
162
  const configContents = ts.parseJsonConfigFileContent(
158
163
  config,
@@ -166,7 +171,7 @@ var rawPlugin = (options = {}, meta) => {
166
171
  target: ts.ScriptTarget.ESNext,
167
172
  composite: false
168
173
  };
169
- compilerOptions.jsx ?? (compilerOptions.jsx = ts.JsxEmit.Preserve);
174
+ compilerOptions.jsx ??= ts.JsxEmit.Preserve;
170
175
  compilerOptionsWithSourceMap = {
171
176
  ...compilerOptions,
172
177
  sourceMap: true
@@ -190,10 +195,12 @@ var rawPlugin = (options = {}, meta) => {
190
195
  return true;
191
196
  return systemFileExists(filename.slice(0, -4));
192
197
  };
193
- system.readDirectory = (path2) => systemReadDirectory(path2).map((name) => name.endsWith(".civet") ? name + ".tsx" : name);
198
+ system.readDirectory = (path2) => {
199
+ return systemReadDirectory(path2).map(($2) => $2.endsWith(".civet") ? $2 + ".tsx" : $2);
200
+ };
194
201
  system.readFile = (filename, encoding = "utf-8") => {
195
202
  if (import_path.default.basename(filename) === "package.json") {
196
- let recurse2 = function(node) {
203
+ let recurse = function(node) {
197
204
  if (node && typeof node === "object") {
198
205
  for (const key in node) {
199
206
  const value = node[key];
@@ -203,18 +210,17 @@ var rawPlugin = (options = {}, meta) => {
203
210
  modified = true;
204
211
  }
205
212
  } else if (value) {
206
- recurse2(value);
213
+ recurse(value);
207
214
  }
208
215
  }
209
216
  }
210
217
  };
211
- var recurse = recurse2;
212
218
  const json = systemReadFile(filename, encoding);
213
219
  if (!json)
214
220
  return json;
215
221
  const parsed = JSON.parse(json);
216
222
  let modified = false;
217
- recurse2(parsed.imports);
223
+ recurse(parsed.imports);
218
224
  return modified ? JSON.stringify(parsed) : json;
219
225
  }
220
226
  if (!filename.endsWith(".civet.tsx"))
@@ -246,28 +252,30 @@ var rawPlugin = (options = {}, meta) => {
246
252
  options: compilerOptions,
247
253
  host: host.compilerHost
248
254
  });
249
- const diagnostics = ts.getPreEmitDiagnostics(program).map((diagnostic) => {
250
- const file = diagnostic.file;
251
- if (!file)
252
- return diagnostic;
253
- const sourceMap = sourceMaps.get(file.fileName);
254
- if (!sourceMap)
255
- return diagnostic;
256
- const sourcemapLines = sourceMap.data.lines;
257
- const range = (0, import_ts_diagnostic.remapRange)(
258
- {
259
- start: diagnostic.start || 0,
260
- end: (diagnostic.start || 0) + (diagnostic.length || 1)
261
- },
262
- sourcemapLines
263
- );
264
- return {
265
- ...diagnostic,
266
- messageText: (0, import_ts_diagnostic.flattenDiagnosticMessageText)(diagnostic.messageText),
267
- length: diagnostic.length,
268
- start: range.start
269
- };
270
- });
255
+ const diagnostics = ts.getPreEmitDiagnostics(program).map(
256
+ (diagnostic) => {
257
+ const file = diagnostic.file;
258
+ if (!file)
259
+ return diagnostic;
260
+ const sourceMap = sourceMaps.get(file.fileName);
261
+ if (!sourceMap)
262
+ return diagnostic;
263
+ const sourcemapLines = sourceMap.data.lines;
264
+ const range = (0, import_ts_diagnostic.remapRange)(
265
+ {
266
+ start: diagnostic.start || 0,
267
+ end: (diagnostic.start || 0) + (diagnostic.length || 1)
268
+ },
269
+ sourcemapLines
270
+ );
271
+ return {
272
+ ...diagnostic,
273
+ messageText: (0, import_ts_diagnostic.flattenDiagnosticMessageText)(diagnostic.messageText),
274
+ length: diagnostic.length,
275
+ start: range.start
276
+ };
277
+ }
278
+ );
271
279
  if (configErrors?.length) {
272
280
  diagnostics.unshift(...configErrors);
273
281
  }
@@ -282,18 +290,18 @@ var rawPlugin = (options = {}, meta) => {
282
290
  let failures = [];
283
291
  if (typeof options.typecheck === "string") {
284
292
  if (options.typecheck.includes("error"))
285
- failures.push(1 /* Error */);
293
+ failures.push(DiagnosticCategory.Error);
286
294
  if (options.typecheck.includes("warning"))
287
- failures.push(0 /* Warning */);
295
+ failures.push(DiagnosticCategory.Warning);
288
296
  if (options.typecheck.includes("suggestion"))
289
- failures.push(2 /* Suggestion */);
297
+ failures.push(DiagnosticCategory.Suggestion);
290
298
  if (options.typecheck.includes("message"))
291
- failures.push(3 /* Message */);
299
+ failures.push(DiagnosticCategory.Message);
292
300
  if (options.typecheck.includes("all")) {
293
301
  failures = { includes: () => true };
294
302
  }
295
303
  } else {
296
- failures.push(1 /* Error */);
304
+ failures.push(DiagnosticCategory.Error);
297
305
  }
298
306
  const count = diagnostics.filter((d) => failures.includes(d.category)).length;
299
307
  if (count) {
@@ -465,42 +473,49 @@ var rawPlugin = (options = {}, meta) => {
465
473
  code: compiled.code,
466
474
  map: jsonSourceMap
467
475
  };
468
- if (options.transformOutput)
476
+ if (options.transformOutput) {
469
477
  transformed = await options.transformOutput(transformed.code, id);
478
+ }
470
479
  cache?.set(filename, { mtime, result: transformed });
471
480
  return transformed;
472
481
  },
473
482
  esbuild: {
474
483
  config(options2) {
475
- esbuildOptions = options2;
484
+ return esbuildOptions = options2;
476
485
  }
477
486
  },
478
487
  vite: {
479
488
  config(config) {
480
- var _a;
481
489
  rootDir = import_path.default.resolve(process.cwd(), config.root ?? "");
482
490
  if (implicitExtension) {
483
- config.resolve ?? (config.resolve = {});
484
- (_a = config.resolve).extensions ?? (_a.extensions = DEFAULT_EXTENSIONS);
491
+ config.resolve ??= {};
492
+ config.resolve.extensions ??= DEFAULT_EXTENSIONS;
485
493
  config.resolve.extensions.push(".civet");
486
494
  }
495
+ ;
496
+ return;
487
497
  },
488
498
  async transformIndexHtml(html) {
489
499
  return html.replace(
490
500
  /<!--[^]*?-->|<[^<>]*>/g,
491
- (tag) => tag.replace(
492
- /<\s*script\b[^<>]*>/gi,
493
- (script) => (
494
- // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
495
- script.replace(
496
- /([:_\p{ID_Start}][:\p{ID_Continue}]*)(\s*=\s*("[^"]*"|'[^']*'|[^\s"'=<>`]*))?/gu,
497
- (attr, name, value) => name.toLowerCase() === "src" && value ? attr.replace(
498
- /(\.civet)(['"]?)$/,
499
- (_, extension, endQuote) => `${extension}${outExt}?transform${endQuote}`
500
- ) : attr
501
- )
502
- )
503
- )
501
+ (tag) => {
502
+ return tag.replace(
503
+ /<\s*script\b[^<>]*>/gi,
504
+ (script) => {
505
+ return script.replace(
506
+ /([:_\p{ID_Start}][:\p{ID_Continue}]*)(\s*=\s*("[^"]*"|'[^']*'|[^\s"'=<>`]*))?/gu,
507
+ (attr, name, value) => {
508
+ return name.toLowerCase() === "src" && value ? attr.replace(
509
+ /(\.civet)(['"]?)$/,
510
+ (_, extension, endQuote) => {
511
+ return `${extension}${outExt}?transform${endQuote}`;
512
+ }
513
+ ) : attr;
514
+ }
515
+ );
516
+ }
517
+ );
518
+ }
504
519
  );
505
520
  },
506
521
  handleHotUpdate({ file, server, modules }) {
@@ -518,7 +533,7 @@ var rawPlugin = (options = {}, meta) => {
518
533
  };
519
534
  };
520
535
  var unplugin = (0, import_unplugin.createUnplugin)(rawPlugin);
521
- var src_default = unplugin;
536
+ var unplugin_civet_default = unplugin;
522
537
  // Annotate the CommonJS export names for ESM import in node:
523
538
  0 && (module.exports = {
524
539
  rawPlugin,