@danielx/civet 0.6.91 → 0.6.92

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/dist/astro.js CHANGED
@@ -42,6 +42,11 @@ var fs = __toESM(require("fs"));
42
42
  var import_path = __toESM(require("path"));
43
43
  var tsvfs = __toESM(require("@typescript/vfs"));
44
44
  var import_os = __toESM(require("os"));
45
+
46
+ // src/constants.ts
47
+ var DEFAULT_EXTENSIONS = [".mjs", ".js", ".mts", ".ts", ".jsx", ".tsx", ".json"];
48
+
49
+ // src/index.ts
45
50
  var isCivetTranspiled = /(\.civet)(\.[jt]sx)([?#].*)?$/;
46
51
  var postfixRE = /[?#].*$/s;
47
52
  var isWindows = import_os.default.platform() === "win32";
@@ -396,7 +401,7 @@ var rawPlugin = (options = {}, meta) => {
396
401
  rootDir = import_path.default.resolve(process.cwd(), config.root ?? "");
397
402
  if (implicitExtension) {
398
403
  config.resolve ?? (config.resolve = {});
399
- (_a = config.resolve).extensions ?? (_a.extensions = []);
404
+ (_a = config.resolve).extensions ?? (_a.extensions = DEFAULT_EXTENSIONS);
400
405
  config.resolve.extensions.push(".civet");
401
406
  }
402
407
  },
package/dist/browser.js CHANGED
@@ -377,13 +377,18 @@ var Civet = (() => {
377
377
  const { token } = pre[0];
378
378
  if (token === "-" || token === "+") {
379
379
  const children = [pre[0], ...exp.children];
380
- if (post)
381
- exp.children.push(post);
382
- return {
380
+ const literal = {
383
381
  type: "Literal",
384
382
  children,
385
383
  raw: `${token}${exp.raw}`
386
384
  };
385
+ if (post) {
386
+ return {
387
+ type: "UnaryExpression",
388
+ children: [literal, post]
389
+ };
390
+ }
391
+ return literal;
387
392
  }
388
393
  }
389
394
  }
@@ -3334,12 +3339,7 @@ var Civet = (() => {
3334
3339
  });
3335
3340
  }
3336
3341
  function quoteString(str) {
3337
- str = str.replace(/\\/g, "\\\\");
3338
- if (str.includes('"') && !str.includes("'")) {
3339
- return "'" + str.replace(/'/g, "\\'") + "'";
3340
- } else {
3341
- return '"' + str.replace(/"/g, '\\"') + '"';
3342
- }
3342
+ return JSON.stringify(str);
3343
3343
  }
3344
3344
  var indentRe;
3345
3345
  var init_string = __esm({
package/dist/esbuild.js CHANGED
@@ -42,6 +42,11 @@ var fs = __toESM(require("fs"));
42
42
  var import_path = __toESM(require("path"));
43
43
  var tsvfs = __toESM(require("@typescript/vfs"));
44
44
  var import_os = __toESM(require("os"));
45
+
46
+ // src/constants.ts
47
+ var DEFAULT_EXTENSIONS = [".mjs", ".js", ".mts", ".ts", ".jsx", ".tsx", ".json"];
48
+
49
+ // src/index.ts
45
50
  var isCivetTranspiled = /(\.civet)(\.[jt]sx)([?#].*)?$/;
46
51
  var postfixRE = /[?#].*$/s;
47
52
  var isWindows = import_os.default.platform() === "win32";
@@ -396,7 +401,7 @@ var rawPlugin = (options = {}, meta) => {
396
401
  rootDir = import_path.default.resolve(process.cwd(), config.root ?? "");
397
402
  if (implicitExtension) {
398
403
  config.resolve ?? (config.resolve = {});
399
- (_a = config.resolve).extensions ?? (_a.extensions = []);
404
+ (_a = config.resolve).extensions ?? (_a.extensions = DEFAULT_EXTENSIONS);
400
405
  config.resolve.extensions.push(".civet");
401
406
  }
402
407
  },
package/dist/main.js CHANGED
@@ -369,13 +369,18 @@ function processUnaryExpression(pre, exp, post) {
369
369
  const { token } = pre[0];
370
370
  if (token === "-" || token === "+") {
371
371
  const children = [pre[0], ...exp.children];
372
- if (post)
373
- exp.children.push(post);
374
- return {
372
+ const literal = {
375
373
  type: "Literal",
376
374
  children,
377
375
  raw: `${token}${exp.raw}`
378
376
  };
377
+ if (post) {
378
+ return {
379
+ type: "UnaryExpression",
380
+ children: [literal, post]
381
+ };
382
+ }
383
+ return literal;
379
384
  }
380
385
  }
381
386
  }
@@ -3326,12 +3331,7 @@ function modifyString(str) {
3326
3331
  });
3327
3332
  }
3328
3333
  function quoteString(str) {
3329
- str = str.replace(/\\/g, "\\\\");
3330
- if (str.includes('"') && !str.includes("'")) {
3331
- return "'" + str.replace(/'/g, "\\'") + "'";
3332
- } else {
3333
- return '"' + str.replace(/"/g, '\\"') + '"';
3334
- }
3334
+ return JSON.stringify(str);
3335
3335
  }
3336
3336
  var indentRe;
3337
3337
  var init_string = __esm({
package/dist/main.mjs CHANGED
@@ -367,13 +367,18 @@ function processUnaryExpression(pre, exp, post) {
367
367
  const { token } = pre[0];
368
368
  if (token === "-" || token === "+") {
369
369
  const children = [pre[0], ...exp.children];
370
- if (post)
371
- exp.children.push(post);
372
- return {
370
+ const literal = {
373
371
  type: "Literal",
374
372
  children,
375
373
  raw: `${token}${exp.raw}`
376
374
  };
375
+ if (post) {
376
+ return {
377
+ type: "UnaryExpression",
378
+ children: [literal, post]
379
+ };
380
+ }
381
+ return literal;
377
382
  }
378
383
  }
379
384
  }
@@ -3324,12 +3329,7 @@ function modifyString(str) {
3324
3329
  });
3325
3330
  }
3326
3331
  function quoteString(str) {
3327
- str = str.replace(/\\/g, "\\\\");
3328
- if (str.includes('"') && !str.includes("'")) {
3329
- return "'" + str.replace(/'/g, "\\'") + "'";
3330
- } else {
3331
- return '"' + str.replace(/"/g, '\\"') + '"';
3332
- }
3332
+ return JSON.stringify(str);
3333
3333
  }
3334
3334
  var indentRe;
3335
3335
  var init_string = __esm({
package/dist/rollup.js CHANGED
@@ -42,6 +42,11 @@ var fs = __toESM(require("fs"));
42
42
  var import_path = __toESM(require("path"));
43
43
  var tsvfs = __toESM(require("@typescript/vfs"));
44
44
  var import_os = __toESM(require("os"));
45
+
46
+ // src/constants.ts
47
+ var DEFAULT_EXTENSIONS = [".mjs", ".js", ".mts", ".ts", ".jsx", ".tsx", ".json"];
48
+
49
+ // src/index.ts
45
50
  var isCivetTranspiled = /(\.civet)(\.[jt]sx)([?#].*)?$/;
46
51
  var postfixRE = /[?#].*$/s;
47
52
  var isWindows = import_os.default.platform() === "win32";
@@ -396,7 +401,7 @@ var rawPlugin = (options = {}, meta) => {
396
401
  rootDir = import_path.default.resolve(process.cwd(), config.root ?? "");
397
402
  if (implicitExtension) {
398
403
  config.resolve ?? (config.resolve = {});
399
- (_a = config.resolve).extensions ?? (_a.extensions = []);
404
+ (_a = config.resolve).extensions ?? (_a.extensions = DEFAULT_EXTENSIONS);
400
405
  config.resolve.extensions.push(".civet");
401
406
  }
402
407
  },
@@ -9,6 +9,11 @@ import * as fs from "fs";
9
9
  import path from "path";
10
10
  import * as tsvfs from "@typescript/vfs";
11
11
  import os from "os";
12
+
13
+ // src/constants.ts
14
+ var DEFAULT_EXTENSIONS = [".mjs", ".js", ".mts", ".ts", ".jsx", ".tsx", ".json"];
15
+
16
+ // src/index.ts
12
17
  var isCivetTranspiled = /(\.civet)(\.[jt]sx)([?#].*)?$/;
13
18
  var postfixRE = /[?#].*$/s;
14
19
  var isWindows = os.platform() === "win32";
@@ -363,7 +368,7 @@ var rawPlugin = (options = {}, meta) => {
363
368
  rootDir = path.resolve(process.cwd(), config.root ?? "");
364
369
  if (implicitExtension) {
365
370
  config.resolve ?? (config.resolve = {});
366
- (_a = config.resolve).extensions ?? (_a.extensions = []);
371
+ (_a = config.resolve).extensions ?? (_a.extensions = DEFAULT_EXTENSIONS);
367
372
  config.resolve.extensions.push(".civet");
368
373
  }
369
374
  },
package/dist/unplugin.js CHANGED
@@ -42,6 +42,11 @@ var fs = __toESM(require("fs"));
42
42
  var import_path = __toESM(require("path"));
43
43
  var tsvfs = __toESM(require("@typescript/vfs"));
44
44
  var import_os = __toESM(require("os"));
45
+
46
+ // src/constants.ts
47
+ var DEFAULT_EXTENSIONS = [".mjs", ".js", ".mts", ".ts", ".jsx", ".tsx", ".json"];
48
+
49
+ // src/index.ts
45
50
  var isCivetTranspiled = /(\.civet)(\.[jt]sx)([?#].*)?$/;
46
51
  var postfixRE = /[?#].*$/s;
47
52
  var isWindows = import_os.default.platform() === "win32";
@@ -396,7 +401,7 @@ var rawPlugin = (options = {}, meta) => {
396
401
  rootDir = import_path.default.resolve(process.cwd(), config.root ?? "");
397
402
  if (implicitExtension) {
398
403
  config.resolve ?? (config.resolve = {});
399
- (_a = config.resolve).extensions ?? (_a.extensions = []);
404
+ (_a = config.resolve).extensions ?? (_a.extensions = DEFAULT_EXTENSIONS);
400
405
  config.resolve.extensions.push(".civet");
401
406
  }
402
407
  },
package/dist/vite.js CHANGED
@@ -42,6 +42,11 @@ var fs = __toESM(require("fs"));
42
42
  var import_path = __toESM(require("path"));
43
43
  var tsvfs = __toESM(require("@typescript/vfs"));
44
44
  var import_os = __toESM(require("os"));
45
+
46
+ // src/constants.ts
47
+ var DEFAULT_EXTENSIONS = [".mjs", ".js", ".mts", ".ts", ".jsx", ".tsx", ".json"];
48
+
49
+ // src/index.ts
45
50
  var isCivetTranspiled = /(\.civet)(\.[jt]sx)([?#].*)?$/;
46
51
  var postfixRE = /[?#].*$/s;
47
52
  var isWindows = import_os.default.platform() === "win32";
@@ -396,7 +401,7 @@ var rawPlugin = (options = {}, meta) => {
396
401
  rootDir = import_path.default.resolve(process.cwd(), config.root ?? "");
397
402
  if (implicitExtension) {
398
403
  config.resolve ?? (config.resolve = {});
399
- (_a = config.resolve).extensions ?? (_a.extensions = []);
404
+ (_a = config.resolve).extensions ?? (_a.extensions = DEFAULT_EXTENSIONS);
400
405
  config.resolve.extensions.push(".civet");
401
406
  }
402
407
  },
package/dist/webpack.js CHANGED
@@ -42,6 +42,11 @@ var fs = __toESM(require("fs"));
42
42
  var import_path = __toESM(require("path"));
43
43
  var tsvfs = __toESM(require("@typescript/vfs"));
44
44
  var import_os = __toESM(require("os"));
45
+
46
+ // src/constants.ts
47
+ var DEFAULT_EXTENSIONS = [".mjs", ".js", ".mts", ".ts", ".jsx", ".tsx", ".json"];
48
+
49
+ // src/index.ts
45
50
  var isCivetTranspiled = /(\.civet)(\.[jt]sx)([?#].*)?$/;
46
51
  var postfixRE = /[?#].*$/s;
47
52
  var isWindows = import_os.default.platform() === "win32";
@@ -396,7 +401,7 @@ var rawPlugin = (options = {}, meta) => {
396
401
  rootDir = import_path.default.resolve(process.cwd(), config.root ?? "");
397
402
  if (implicitExtension) {
398
403
  config.resolve ?? (config.resolve = {});
399
- (_a = config.resolve).extensions ?? (_a.extensions = []);
404
+ (_a = config.resolve).extensions ?? (_a.extensions = DEFAULT_EXTENSIONS);
400
405
  config.resolve.extensions.push(".civet");
401
406
  }
402
407
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@danielx/civet",
3
3
  "type": "commonjs",
4
- "version": "0.6.91",
4
+ "version": "0.6.92",
5
5
  "description": "CoffeeScript style syntax for TypeScript",
6
6
  "main": "dist/main.js",
7
7
  "module": "dist/main.mjs",