@danielx/civet 0.11.5 → 0.11.7
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/CHANGELOG.md +306 -0
- package/README.md +2 -7
- package/dist/babel-plugin.js +7 -6
- package/dist/babel-plugin.mjs +3 -3
- package/dist/browser.js +807 -540
- package/dist/civet +24 -18
- package/dist/config.js +7313 -7
- package/dist/config.mjs +7338 -4
- package/dist/esbuild-plugin.js +7 -6
- package/dist/esm.mjs +10 -16
- package/dist/main.js +1787 -895
- package/dist/main.mjs +1782 -891
- package/dist/node-worker.mjs +1 -2
- package/dist/ts-diagnostic.js +5 -4
- package/dist/ts-diagnostic.mjs +1 -1
- package/dist/types.d.ts +11 -2
- package/dist/unplugin/astro.js +8 -7
- package/dist/unplugin/astro.mjs +6 -4
- package/dist/unplugin/esbuild.d.ts +1 -1
- package/dist/unplugin/esbuild.js +7 -6
- package/dist/unplugin/esbuild.mjs +5 -3
- package/dist/unplugin/farm.d.ts +3 -1
- package/dist/unplugin/farm.js +7 -6
- package/dist/unplugin/farm.mjs +6 -4
- package/dist/unplugin/rolldown.d.ts +1 -1
- package/dist/unplugin/rolldown.js +7 -6
- package/dist/unplugin/rolldown.mjs +5 -3
- package/dist/unplugin/rollup.d.ts +1 -1
- package/dist/unplugin/rollup.js +7 -6
- package/dist/unplugin/rollup.mjs +5 -3
- package/dist/unplugin/rspack.d.ts +1 -1
- package/dist/unplugin/rspack.js +7 -6
- package/dist/unplugin/rspack.mjs +5 -3
- package/dist/unplugin/unplugin.d.ts +27 -3
- package/dist/unplugin/unplugin.js +68 -42
- package/dist/unplugin/unplugin.mjs +53 -30
- package/dist/unplugin/vite.d.ts +1 -1
- package/dist/unplugin/vite.js +7 -6
- package/dist/unplugin/vite.mjs +5 -3
- package/dist/unplugin/webpack.d.ts +1 -1
- package/dist/unplugin/webpack.js +7 -6
- package/dist/unplugin/webpack.mjs +5 -3
- package/package.json +33 -17
package/dist/civet
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict"
|
|
3
3
|
try { require('node:module').enableCompileCache() } catch {}
|
|
4
|
+
"use strict";
|
|
4
5
|
var __create = Object.create;
|
|
5
6
|
var __defProp = Object.defineProperty;
|
|
6
7
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -29,16 +30,16 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
30
|
));
|
|
30
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
31
32
|
|
|
32
|
-
//
|
|
33
|
-
var
|
|
34
|
-
__export(
|
|
33
|
+
// source/cli.civet
|
|
34
|
+
var cli_exports = {};
|
|
35
|
+
__export(cli_exports, {
|
|
35
36
|
cli: () => cli,
|
|
36
37
|
makeOutputFilename: () => makeOutputFilename,
|
|
37
38
|
parseArgs: () => parseArgs,
|
|
38
39
|
repl: () => repl,
|
|
39
40
|
version: () => version
|
|
40
41
|
});
|
|
41
|
-
module.exports = __toCommonJS(
|
|
42
|
+
module.exports = __toCommonJS(cli_exports);
|
|
42
43
|
var import_main = require("./main.js");
|
|
43
44
|
var import_config = require("./config.js");
|
|
44
45
|
var import_unplugin = require("./unplugin/unplugin.js");
|
|
@@ -55,6 +56,7 @@ async function version() {
|
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
var encoding = "utf8";
|
|
59
|
+
var epipeStdoutHandlerInstalled = false;
|
|
58
60
|
async function parseArgs(args, isTTY = process.stdin.isTTY) {
|
|
59
61
|
const options = {};
|
|
60
62
|
const isRun = () => !(options.ast || options.compile || options.typecheck || options.emitDeclaration);
|
|
@@ -302,7 +304,7 @@ function makeOutputFilename(filename, options) {
|
|
|
302
304
|
;
|
|
303
305
|
return;
|
|
304
306
|
})(ref1), ref1);
|
|
305
|
-
return import_node_path.default.format(outputPath);
|
|
307
|
+
return import_node_path.default.normalize(import_node_path.default.format(outputPath));
|
|
306
308
|
}
|
|
307
309
|
async function repl(args, options) {
|
|
308
310
|
const vm = await import("node:vm");
|
|
@@ -390,7 +392,7 @@ async function repl(args, options) {
|
|
|
390
392
|
} else if (input in ["quit\n", "exit\n", "quit()\n", "exit()\n"]) {
|
|
391
393
|
return process.exit(0);
|
|
392
394
|
} else if (input.endsWith("\n\n")) {
|
|
393
|
-
let
|
|
395
|
+
let showError2 = function(error) {
|
|
394
396
|
console.error("Error while parsing Civet code:");
|
|
395
397
|
if ((0, import_main.isCompileError)(error)) {
|
|
396
398
|
if (error.errors != null) {
|
|
@@ -402,12 +404,13 @@ ${" ".repeat(error.column - 1)}^ ${error.header}`);
|
|
|
402
404
|
return console.error(error);
|
|
403
405
|
}
|
|
404
406
|
};
|
|
407
|
+
var showError = showError2;
|
|
405
408
|
let output;
|
|
406
409
|
if (options.compile || options.ast) {
|
|
407
410
|
try {
|
|
408
411
|
output = await (0, import_main.compile)(input, { ...options, filename });
|
|
409
412
|
} catch (error) {
|
|
410
|
-
|
|
413
|
+
showError2(error);
|
|
411
414
|
return callback(null, void 0);
|
|
412
415
|
}
|
|
413
416
|
return callback(null, output);
|
|
@@ -420,7 +423,7 @@ ${" ".repeat(error.column - 1)}^ ${error.header}`);
|
|
|
420
423
|
try {
|
|
421
424
|
ast = await (0, import_main.compile)(input, { ...options, parseOptions, filename, ast: true });
|
|
422
425
|
} catch (error) {
|
|
423
|
-
|
|
426
|
+
showError2(error);
|
|
424
427
|
return callback(null, void 0);
|
|
425
428
|
}
|
|
426
429
|
let errors = [];
|
|
@@ -432,8 +435,8 @@ ${" ".repeat(error.column - 1)}^ ${error.header}`);
|
|
|
432
435
|
}
|
|
433
436
|
if (errors.length) {
|
|
434
437
|
errors = [];
|
|
435
|
-
(0, import_main.generate)(ast, { ...options, errors, sourceMap: new import_main.SourceMap(input) });
|
|
436
|
-
|
|
438
|
+
(0, import_main.generate)(ast, { ...options, errors, sourceMap: new import_main.SourceMap(input, filename) });
|
|
439
|
+
showError2(errors[0]);
|
|
437
440
|
return callback(null, void 0);
|
|
438
441
|
}
|
|
439
442
|
let result;
|
|
@@ -601,14 +604,17 @@ You can override this behavior via: --civet rewriteCivetImports=.ext
|
|
|
601
604
|
if (options.repl) {
|
|
602
605
|
return repl(args, options);
|
|
603
606
|
}
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
607
|
+
if (!epipeStdoutHandlerInstalled) {
|
|
608
|
+
epipeStdoutHandlerInstalled = true;
|
|
609
|
+
process.stdout.on("error", (e) => {
|
|
610
|
+
if (["EPIPE", "EOF"].includes(e.code)) {
|
|
611
|
+
return process.exit(0);
|
|
612
|
+
} else {
|
|
613
|
+
console.error(e);
|
|
614
|
+
return process.exit(1);
|
|
615
|
+
}
|
|
616
|
+
});
|
|
617
|
+
}
|
|
612
618
|
let errors = 0;
|
|
613
619
|
for await (let { filename, error, content, stdin } of readFiles(filenames, options.eval)) {
|
|
614
620
|
if (error) {
|