@danielx/civet 0.7.21 → 0.7.22

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,49 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // source/babel-plugin.civet
21
+ var babel_plugin_exports = {};
22
+ __export(babel_plugin_exports, {
23
+ default: () => babel_plugin_default
24
+ });
25
+ module.exports = __toCommonJS(babel_plugin_exports);
26
+ var import_main = require("./main.js");
27
+ function babel_plugin_default(api, civetOptions) {
28
+ return {
29
+ parserOverride(code, opts, parse) {
30
+ let src;
31
+ if (opts.sourceFileName.endsWith(".civet")) {
32
+ const config = {
33
+ ...civetOptions,
34
+ filename: opts.sourceFileName,
35
+ sourceMap: false,
36
+ sync: true
37
+ // parserOverride API is synchronous
38
+ };
39
+ config.inlineMap ??= true;
40
+ config.js = true;
41
+ src = (0, import_main.compile)(code, config);
42
+ } else {
43
+ src = code;
44
+ }
45
+ const ast = parse(src, opts);
46
+ return ast;
47
+ }
48
+ };
49
+ }
@@ -1,41 +1,28 @@
1
- // Babel plugin for compiling .civet files
2
-
3
- /* Example babel.config.json:
4
-
5
- {
6
- "plugins": [
7
- [
8
- "@danielx/civet/babel-plugin"
9
- ]
10
- ],
11
- "sourceMaps": "inline"
12
- }
13
-
14
- */
15
-
16
- import { compile } from "./main.mjs"
17
-
18
- export default function (api, civetOptions) {
1
+ // source/babel-plugin.civet
2
+ import { compile } from "./main.mjs";
3
+ function babel_plugin_default(api, civetOptions) {
19
4
  return {
20
5
  parserOverride(code, opts, parse) {
21
- let src
6
+ let src;
22
7
  if (opts.sourceFileName.endsWith(".civet")) {
23
8
  const config = {
24
9
  ...civetOptions,
25
10
  filename: opts.sourceFileName,
26
11
  sourceMap: false,
27
- sync: true, // parserOverride API is synchronous
28
- }
29
-
30
- config.inlineMap ??= true
31
- config.js = true
32
- src = compile(code, config)
12
+ sync: true
13
+ // parserOverride API is synchronous
14
+ };
15
+ config.inlineMap ??= true;
16
+ config.js = true;
17
+ src = compile(code, config);
33
18
  } else {
34
- src = code
19
+ src = code;
35
20
  }
36
-
37
- const ast = parse(src, opts)
38
- return ast
21
+ const ast = parse(src, opts);
22
+ return ast;
39
23
  }
40
- }
24
+ };
41
25
  }
26
+ export {
27
+ babel_plugin_default as default
28
+ };
package/dist/civet CHANGED
File without changes
@@ -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:C:\Users\edemaine\Projects\Civet\source\unplugin\astro.civet.jsx
29
+ // unplugin-civet:/home/daniel/apps/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:C:\Users\edemaine\Projects\Civet\source\unplugin\astro.civet.jsx
1
+ // unplugin-civet:/home/daniel/apps/civet/source/unplugin/astro.civet.jsx
2
2
  import civetUnplugin, {} from "./unplugin.mjs";
3
3
  var astro_civet_default = function(opts = {}) {
4
4
  return {
@@ -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:C:\Users\edemaine\Projects\Civet\source\unplugin\esbuild.civet.jsx
29
+ // unplugin-civet:/home/daniel/apps/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:C:\Users\edemaine\Projects\Civet\source\unplugin\esbuild.civet.jsx
1
+ // unplugin-civet:/home/daniel/apps/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:C:\Users\edemaine\Projects\Civet\source\unplugin\rollup.civet.jsx
29
+ // unplugin-civet:/home/daniel/apps/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:C:\Users\edemaine\Projects\Civet\source\unplugin\rollup.civet.jsx
1
+ // unplugin-civet:/home/daniel/apps/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:C:\Users\edemaine\Projects\Civet\source\unplugin\unplugin.civet.jsx
29
+ // unplugin-civet:/home/daniel/apps/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,7 +46,7 @@ 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:C:\Users\edemaine\Projects\Civet\source\unplugin\unplugin.civet.jsx
49
+ // unplugin-civet:/home/daniel/apps/civet/source/unplugin/unplugin.civet.jsx
50
50
  var DiagnosticCategory = {};
51
51
  DiagnosticCategory[DiagnosticCategory["Warning"] = 0] = "Warning";
52
52
  DiagnosticCategory[DiagnosticCategory["Error"] = 1] = "Error";
@@ -1,4 +1,4 @@
1
- // unplugin-civet:C:\Users\edemaine\Projects\Civet\source\unplugin\unplugin.civet.jsx
1
+ // unplugin-civet:/home/daniel/apps/civet/source/unplugin/unplugin.civet.jsx
2
2
  import { createUnplugin } from "unplugin";
3
3
  import civet, { SourceMap } from "@danielx/civet";
4
4
  import { findInDir, loadConfig } from "@danielx/civet/config";
@@ -14,7 +14,7 @@ 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:C:\Users\edemaine\Projects\Civet\source\unplugin\unplugin.civet.jsx
17
+ // unplugin-civet:/home/daniel/apps/civet/source/unplugin/unplugin.civet.jsx
18
18
  var DiagnosticCategory = {};
19
19
  DiagnosticCategory[DiagnosticCategory["Warning"] = 0] = "Warning";
20
20
  DiagnosticCategory[DiagnosticCategory["Error"] = 1] = "Error";
@@ -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:C:\Users\edemaine\Projects\Civet\source\unplugin\vite.civet.jsx
29
+ // unplugin-civet:/home/daniel/apps/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:C:\Users\edemaine\Projects\Civet\source\unplugin\vite.civet.jsx
1
+ // unplugin-civet:/home/daniel/apps/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:C:\Users\edemaine\Projects\Civet\source\unplugin\webpack.civet.jsx
29
+ // unplugin-civet:/home/daniel/apps/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:C:\Users\edemaine\Projects\Civet\source\unplugin\webpack.civet.jsx
1
+ // unplugin-civet:/home/daniel/apps/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.7.21",
4
+ "version": "0.7.22",
5
5
  "description": "CoffeeScript style syntax for TypeScript",
6
6
  "main": "dist/main.js",
7
7
  "module": "dist/main.mjs",
@@ -11,7 +11,10 @@
11
11
  "require": "./dist/main.js",
12
12
  "types": "./dist/types.d.ts"
13
13
  },
14
- "./babel-plugin": "./dist/babel-plugin.mjs",
14
+ "./babel-plugin": {
15
+ "require": "./dist/babel-plugin.js",
16
+ "import": "./dist/babel-plugin.mjs"
17
+ },
15
18
  "./bun-civet": "./dist/bun-civet.mjs",
16
19
  "./esm": "./dist/esm.mjs",
17
20
  "./esbuild-plugin": "./dist/esbuild-plugin.js",