@danielx/civet 0.6.44 → 0.6.46

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/README.md CHANGED
@@ -20,7 +20,7 @@ The modern way to write TypeScript.
20
20
  (including metaframeworks such as Astro),
21
21
  <!--
22
22
  [esbuild](source/esbuild-plugin.civet),
23
- [Vite](https://github.com/lorefnon/vite-plugin-civet),
23
+ [Vite](https://github.com/edemaine/vite-plugin-civet),
24
24
  -->
25
25
  [Babel](source/babel-plugin.mjs),
26
26
  [Gulp](integration/gulp),
package/dist/browser.js CHANGED
@@ -820,7 +820,6 @@ ${input.slice(result.pos)}
820
820
  const part = strWithSubstitutions[i2];
821
821
  results1.push(part.token ?? "s");
822
822
  }
823
- ;
824
823
  return results1;
825
824
  })().join("");
826
825
  const dedent = /^[ \t]*\r?\n/.test(stringPart) ? getIndentOfBlockString(stringPart, tab) : false;
@@ -2307,7 +2306,6 @@ ${input.slice(result.pos)}
2307
2306
  if (!condition?.expression) {
2308
2307
  return;
2309
2308
  }
2310
- ;
2311
2309
  let { expression } = condition;
2312
2310
  if (typeof expression === "object" && expression != null && "type" in expression && expression.type === "UnaryExpression" && "children" in expression && Array.isArray(expression.children) && expression.children.length === 2 && expression.children[0] === "!" && typeof expression.children[1] === "object" && expression.children[1] != null && "type" in expression.children[1] && expression.children[1].type === "ParenthesizedExpression" && "expression" in expression.children[1]) {
2313
2311
  const { type: type1, children: [, { type: type2, expression: expression2 }] } = expression;
@@ -2591,6 +2589,7 @@ ${input.slice(result.pos)}
2591
2589
  }
2592
2590
  switch (following.type) {
2593
2591
  case "ParenthesizedExpression":
2592
+ case "ArrayExpression":
2594
2593
  case "ArrowFunction":
2595
2594
  case "TemplateLiteral":
2596
2595
  case "RegularExpressionLiteral": {
@@ -14355,7 +14354,6 @@ ${input.slice(result.pos)}
14355
14354
  if (filename.endsWith(".coffee") && !/^(#![^\r\n]*(\r\n|\n|\r))?\s*['"]civet/.test(src)) {
14356
14355
  options.parseOptions.coffeeCompat = true;
14357
14356
  }
14358
- ;
14359
14357
  const { hits, trace, noCache } = options;
14360
14358
  let events;
14361
14359
  if (!noCache) {
@@ -14450,7 +14448,6 @@ ${counts}`;
14450
14448
  if (uncacheable.has(ruleName)) {
14451
14449
  return;
14452
14450
  }
14453
- ;
14454
14451
  const [stateKey, tagKey] = getStateKey();
14455
14452
  const key = [tagKey, stateKey, state.pos, ruleName];
14456
14453
  if (stateCache.has(key)) {
package/dist/civet CHANGED
@@ -113,7 +113,6 @@ parseArgs = function(args) {
113
113
  char = ref[i1];
114
114
  results.push(`-${char}`);
115
115
  }
116
- ;
117
116
  return results;
118
117
  })());
119
118
  continue;
@@ -178,7 +177,6 @@ parseArgs = function(args) {
178
177
  }
179
178
  i++;
180
179
  }
181
- ;
182
180
  return { filenames, scriptArgs, options };
183
181
  };
184
182
  readFiles = async function* (filenames, options) {
@@ -216,7 +214,6 @@ readFiles = async function* (filenames, options) {
216
214
  for await (chunk of process.stdin) {
217
215
  results2.push(chunk);
218
216
  }
219
- ;
220
217
  return results2;
221
218
  })()).join("");
222
219
  }
@@ -404,7 +401,6 @@ cli = async function() {
404
401
  process.exit(1);
405
402
  }
406
403
  }
407
- ;
408
404
  const { fork } = await import("child_process");
409
405
  execArgv = ["--loader", "@danielx/civet/esm"];
410
406
  debugRe = /--debug|--inspect/;
package/dist/esbuild.js CHANGED
@@ -49,6 +49,7 @@ var formatHost = {
49
49
  };
50
50
  var isCivet = (id) => /\.civet$/.test(id);
51
51
  var isCivetTranspiled = (id) => /\.civet\.(m?)(j|t)s(x?)$/.test(id);
52
+ var isCivetTranspiledTS = (id) => /\.civet\.(m?)ts(x?)$/.test(id);
52
53
  var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
53
54
  if (options.dts && options.js) {
54
55
  throw new Error("Can't have both `dts` and `js` be set to `true`.");
@@ -56,7 +57,7 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
56
57
  if (options.typecheck && options.js) {
57
58
  throw new Error("Can't have both `typecheck` and `js` be set to `true`.");
58
59
  }
59
- const transpileToJS = options.js ?? !(options.dts || options.typecheck);
60
+ const transpileToJS = options.js ?? false;
60
61
  const outExt = options.outputExtension ?? (transpileToJS ? ".jsx" : ".tsx");
61
62
  let fsMap = /* @__PURE__ */ new Map();
62
63
  const sourceMaps = /* @__PURE__ */ new Map();
@@ -194,8 +195,11 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
194
195
  transformed = await options.transformOutput(transformed.code, id);
195
196
  return transformed;
196
197
  },
198
+ transformInclude(id) {
199
+ return isCivetTranspiledTS(id);
200
+ },
197
201
  transform(code, id) {
198
- if (!/\.civet\.tsx?$/.test(id))
202
+ if (!isCivetTranspiledTS(id))
199
203
  return null;
200
204
  if (options.dts || options.typecheck) {
201
205
  const resolved = import_path.default.resolve(process.cwd(), id);
package/dist/main.js CHANGED
@@ -812,7 +812,6 @@ var require_lib = __commonJS({
812
812
  const part = strWithSubstitutions[i2];
813
813
  results1.push(part.token ?? "s");
814
814
  }
815
- ;
816
815
  return results1;
817
816
  })().join("");
818
817
  const dedent = /^[ \t]*\r?\n/.test(stringPart) ? getIndentOfBlockString(stringPart, tab) : false;
@@ -2299,7 +2298,6 @@ var require_lib = __commonJS({
2299
2298
  if (!condition?.expression) {
2300
2299
  return;
2301
2300
  }
2302
- ;
2303
2301
  let { expression } = condition;
2304
2302
  if (typeof expression === "object" && expression != null && "type" in expression && expression.type === "UnaryExpression" && "children" in expression && Array.isArray(expression.children) && expression.children.length === 2 && expression.children[0] === "!" && typeof expression.children[1] === "object" && expression.children[1] != null && "type" in expression.children[1] && expression.children[1].type === "ParenthesizedExpression" && "expression" in expression.children[1]) {
2305
2303
  const { type: type1, children: [, { type: type2, expression: expression2 }] } = expression;
@@ -2583,6 +2581,7 @@ var require_lib = __commonJS({
2583
2581
  }
2584
2582
  switch (following.type) {
2585
2583
  case "ParenthesizedExpression":
2584
+ case "ArrayExpression":
2586
2585
  case "ArrowFunction":
2587
2586
  case "TemplateLiteral":
2588
2587
  case "RegularExpressionLiteral": {
@@ -14348,7 +14347,6 @@ function compile(src, options) {
14348
14347
  if (filename.endsWith(".coffee") && !/^(#![^\r\n]*(\r\n|\n|\r))?\s*['"]civet/.test(src)) {
14349
14348
  options.parseOptions.coffeeCompat = true;
14350
14349
  }
14351
- ;
14352
14350
  const { hits, trace, noCache } = options;
14353
14351
  let events;
14354
14352
  if (!noCache) {
@@ -14443,7 +14441,6 @@ function makeCache({ hits, trace } = {}) {
14443
14441
  if (uncacheable.has(ruleName)) {
14444
14442
  return;
14445
14443
  }
14446
- ;
14447
14444
  const [stateKey, tagKey] = getStateKey();
14448
14445
  const key = [tagKey, stateKey, state.pos, ruleName];
14449
14446
  if (stateCache.has(key)) {
package/dist/main.mjs CHANGED
@@ -810,7 +810,6 @@ var require_lib = __commonJS({
810
810
  const part = strWithSubstitutions[i2];
811
811
  results1.push(part.token ?? "s");
812
812
  }
813
- ;
814
813
  return results1;
815
814
  })().join("");
816
815
  const dedent = /^[ \t]*\r?\n/.test(stringPart) ? getIndentOfBlockString(stringPart, tab) : false;
@@ -2297,7 +2296,6 @@ var require_lib = __commonJS({
2297
2296
  if (!condition?.expression) {
2298
2297
  return;
2299
2298
  }
2300
- ;
2301
2299
  let { expression } = condition;
2302
2300
  if (typeof expression === "object" && expression != null && "type" in expression && expression.type === "UnaryExpression" && "children" in expression && Array.isArray(expression.children) && expression.children.length === 2 && expression.children[0] === "!" && typeof expression.children[1] === "object" && expression.children[1] != null && "type" in expression.children[1] && expression.children[1].type === "ParenthesizedExpression" && "expression" in expression.children[1]) {
2303
2301
  const { type: type1, children: [, { type: type2, expression: expression2 }] } = expression;
@@ -2581,6 +2579,7 @@ var require_lib = __commonJS({
2581
2579
  }
2582
2580
  switch (following.type) {
2583
2581
  case "ParenthesizedExpression":
2582
+ case "ArrayExpression":
2584
2583
  case "ArrowFunction":
2585
2584
  case "TemplateLiteral":
2586
2585
  case "RegularExpressionLiteral": {
@@ -14335,7 +14334,6 @@ function compile(src, options) {
14335
14334
  if (filename.endsWith(".coffee") && !/^(#![^\r\n]*(\r\n|\n|\r))?\s*['"]civet/.test(src)) {
14336
14335
  options.parseOptions.coffeeCompat = true;
14337
14336
  }
14338
- ;
14339
14337
  const { hits, trace, noCache } = options;
14340
14338
  let events;
14341
14339
  if (!noCache) {
@@ -14430,7 +14428,6 @@ function makeCache({ hits, trace } = {}) {
14430
14428
  if (uncacheable.has(ruleName)) {
14431
14429
  return;
14432
14430
  }
14433
- ;
14434
14431
  const [stateKey, tagKey] = getStateKey();
14435
14432
  const key = [tagKey, stateKey, state.pos, ruleName];
14436
14433
  if (stateCache.has(key)) {
package/dist/rollup.js CHANGED
@@ -49,6 +49,7 @@ var formatHost = {
49
49
  };
50
50
  var isCivet = (id) => /\.civet$/.test(id);
51
51
  var isCivetTranspiled = (id) => /\.civet\.(m?)(j|t)s(x?)$/.test(id);
52
+ var isCivetTranspiledTS = (id) => /\.civet\.(m?)ts(x?)$/.test(id);
52
53
  var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
53
54
  if (options.dts && options.js) {
54
55
  throw new Error("Can't have both `dts` and `js` be set to `true`.");
@@ -56,7 +57,7 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
56
57
  if (options.typecheck && options.js) {
57
58
  throw new Error("Can't have both `typecheck` and `js` be set to `true`.");
58
59
  }
59
- const transpileToJS = options.js ?? !(options.dts || options.typecheck);
60
+ const transpileToJS = options.js ?? false;
60
61
  const outExt = options.outputExtension ?? (transpileToJS ? ".jsx" : ".tsx");
61
62
  let fsMap = /* @__PURE__ */ new Map();
62
63
  const sourceMaps = /* @__PURE__ */ new Map();
@@ -194,8 +195,11 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
194
195
  transformed = await options.transformOutput(transformed.code, id);
195
196
  return transformed;
196
197
  },
198
+ transformInclude(id) {
199
+ return isCivetTranspiledTS(id);
200
+ },
197
201
  transform(code, id) {
198
- if (!/\.civet\.tsx?$/.test(id))
202
+ if (!isCivetTranspiledTS(id))
199
203
  return null;
200
204
  if (options.dts || options.typecheck) {
201
205
  const resolved = import_path.default.resolve(process.cwd(), id);
@@ -18,6 +18,7 @@ var formatHost = {
18
18
  };
19
19
  var isCivet = (id) => /\.civet$/.test(id);
20
20
  var isCivetTranspiled = (id) => /\.civet\.(m?)(j|t)s(x?)$/.test(id);
21
+ var isCivetTranspiledTS = (id) => /\.civet\.(m?)ts(x?)$/.test(id);
21
22
  var civetUnplugin = createUnplugin((options = {}) => {
22
23
  if (options.dts && options.js) {
23
24
  throw new Error("Can't have both `dts` and `js` be set to `true`.");
@@ -25,7 +26,7 @@ var civetUnplugin = createUnplugin((options = {}) => {
25
26
  if (options.typecheck && options.js) {
26
27
  throw new Error("Can't have both `typecheck` and `js` be set to `true`.");
27
28
  }
28
- const transpileToJS = options.js ?? !(options.dts || options.typecheck);
29
+ const transpileToJS = options.js ?? false;
29
30
  const outExt = options.outputExtension ?? (transpileToJS ? ".jsx" : ".tsx");
30
31
  let fsMap = /* @__PURE__ */ new Map();
31
32
  const sourceMaps = /* @__PURE__ */ new Map();
@@ -163,8 +164,11 @@ var civetUnplugin = createUnplugin((options = {}) => {
163
164
  transformed = await options.transformOutput(transformed.code, id);
164
165
  return transformed;
165
166
  },
167
+ transformInclude(id) {
168
+ return isCivetTranspiledTS(id);
169
+ },
166
170
  transform(code, id) {
167
- if (!/\.civet\.tsx?$/.test(id))
171
+ if (!isCivetTranspiledTS(id))
168
172
  return null;
169
173
  if (options.dts || options.typecheck) {
170
174
  const resolved = path.resolve(process.cwd(), id);
package/dist/unplugin.js CHANGED
@@ -47,6 +47,7 @@ var formatHost = {
47
47
  };
48
48
  var isCivet = (id) => /\.civet$/.test(id);
49
49
  var isCivetTranspiled = (id) => /\.civet\.(m?)(j|t)s(x?)$/.test(id);
50
+ var isCivetTranspiledTS = (id) => /\.civet\.(m?)ts(x?)$/.test(id);
50
51
  var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
51
52
  if (options.dts && options.js) {
52
53
  throw new Error("Can't have both `dts` and `js` be set to `true`.");
@@ -54,7 +55,7 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
54
55
  if (options.typecheck && options.js) {
55
56
  throw new Error("Can't have both `typecheck` and `js` be set to `true`.");
56
57
  }
57
- const transpileToJS = options.js ?? !(options.dts || options.typecheck);
58
+ const transpileToJS = options.js ?? false;
58
59
  const outExt = options.outputExtension ?? (transpileToJS ? ".jsx" : ".tsx");
59
60
  let fsMap = /* @__PURE__ */ new Map();
60
61
  const sourceMaps = /* @__PURE__ */ new Map();
@@ -192,8 +193,11 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
192
193
  transformed = await options.transformOutput(transformed.code, id);
193
194
  return transformed;
194
195
  },
196
+ transformInclude(id) {
197
+ return isCivetTranspiledTS(id);
198
+ },
195
199
  transform(code, id) {
196
- if (!/\.civet\.tsx?$/.test(id))
200
+ if (!isCivetTranspiledTS(id))
197
201
  return null;
198
202
  if (options.dts || options.typecheck) {
199
203
  const resolved = import_path.default.resolve(process.cwd(), id);
package/dist/vite.js CHANGED
@@ -49,6 +49,7 @@ var formatHost = {
49
49
  };
50
50
  var isCivet = (id) => /\.civet$/.test(id);
51
51
  var isCivetTranspiled = (id) => /\.civet\.(m?)(j|t)s(x?)$/.test(id);
52
+ var isCivetTranspiledTS = (id) => /\.civet\.(m?)ts(x?)$/.test(id);
52
53
  var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
53
54
  if (options.dts && options.js) {
54
55
  throw new Error("Can't have both `dts` and `js` be set to `true`.");
@@ -56,7 +57,7 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
56
57
  if (options.typecheck && options.js) {
57
58
  throw new Error("Can't have both `typecheck` and `js` be set to `true`.");
58
59
  }
59
- const transpileToJS = options.js ?? !(options.dts || options.typecheck);
60
+ const transpileToJS = options.js ?? false;
60
61
  const outExt = options.outputExtension ?? (transpileToJS ? ".jsx" : ".tsx");
61
62
  let fsMap = /* @__PURE__ */ new Map();
62
63
  const sourceMaps = /* @__PURE__ */ new Map();
@@ -194,8 +195,11 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
194
195
  transformed = await options.transformOutput(transformed.code, id);
195
196
  return transformed;
196
197
  },
198
+ transformInclude(id) {
199
+ return isCivetTranspiledTS(id);
200
+ },
197
201
  transform(code, id) {
198
- if (!/\.civet\.tsx?$/.test(id))
202
+ if (!isCivetTranspiledTS(id))
199
203
  return null;
200
204
  if (options.dts || options.typecheck) {
201
205
  const resolved = import_path.default.resolve(process.cwd(), id);
package/dist/webpack.js CHANGED
@@ -49,6 +49,7 @@ var formatHost = {
49
49
  };
50
50
  var isCivet = (id) => /\.civet$/.test(id);
51
51
  var isCivetTranspiled = (id) => /\.civet\.(m?)(j|t)s(x?)$/.test(id);
52
+ var isCivetTranspiledTS = (id) => /\.civet\.(m?)ts(x?)$/.test(id);
52
53
  var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
53
54
  if (options.dts && options.js) {
54
55
  throw new Error("Can't have both `dts` and `js` be set to `true`.");
@@ -56,7 +57,7 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
56
57
  if (options.typecheck && options.js) {
57
58
  throw new Error("Can't have both `typecheck` and `js` be set to `true`.");
58
59
  }
59
- const transpileToJS = options.js ?? !(options.dts || options.typecheck);
60
+ const transpileToJS = options.js ?? false;
60
61
  const outExt = options.outputExtension ?? (transpileToJS ? ".jsx" : ".tsx");
61
62
  let fsMap = /* @__PURE__ */ new Map();
62
63
  const sourceMaps = /* @__PURE__ */ new Map();
@@ -194,8 +195,11 @@ var civetUnplugin = (0, import_unplugin.createUnplugin)((options = {}) => {
194
195
  transformed = await options.transformOutput(transformed.code, id);
195
196
  return transformed;
196
197
  },
198
+ transformInclude(id) {
199
+ return isCivetTranspiledTS(id);
200
+ },
197
201
  transform(code, id) {
198
- if (!/\.civet\.tsx?$/.test(id))
202
+ if (!isCivetTranspiledTS(id))
199
203
  return null;
200
204
  if (options.dts || options.typecheck) {
201
205
  const resolved = import_path.default.resolve(process.cwd(), id);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@danielx/civet",
3
3
  "type": "commonjs",
4
- "version": "0.6.44",
4
+ "version": "0.6.46",
5
5
  "description": "CoffeeScript style syntax for TypeScript",
6
6
  "main": "dist/main.js",
7
7
  "module": "dist/main.mjs",
@@ -70,7 +70,7 @@
70
70
  "unplugin": "^1.4.0"
71
71
  },
72
72
  "devDependencies": {
73
- "@danielx/civet": "0.6.43",
73
+ "@danielx/civet": "0.6.45",
74
74
  "@danielx/hera": "^0.8.10",
75
75
  "@types/assert": "^1.5.6",
76
76
  "@types/mocha": "^9.1.1",