@korajs/cli 0.1.5 → 0.1.6
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/bin.cjs +8 -17
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +8 -17
- package/dist/bin.js.map +1 -1
- package/package.json +1 -1
package/dist/bin.cjs
CHANGED
|
@@ -519,13 +519,7 @@ async function loadTypeScriptConfig(configPath, projectRoot) {
|
|
|
519
519
|
`Found TypeScript config at ${configPath}, but "tsx" is not installed in this project. Install tsx or use kora.config.js.`
|
|
520
520
|
);
|
|
521
521
|
}
|
|
522
|
-
const script = [
|
|
523
|
-
"import { pathToFileURL } from 'node:url'",
|
|
524
|
-
"const configPath = process.argv[process.argv.length - 1]",
|
|
525
|
-
"const mod = await import(pathToFileURL(configPath).href)",
|
|
526
|
-
"const value = mod.default ?? mod",
|
|
527
|
-
"process.stdout.write(JSON.stringify(value))"
|
|
528
|
-
].join(";");
|
|
522
|
+
const script = "const configPath = process.argv[process.argv.length - 1];import('node:url').then(u => import(u.pathToFileURL(configPath).href)).then(mod => { const v = mod.default ?? mod; process.stdout.write(JSON.stringify(v)) }).catch(e => { process.stderr.write(String(e)); process.exit(1) })";
|
|
529
523
|
const output = await runCommand(tsxBinary, ["--eval", script, configPath], projectRoot);
|
|
530
524
|
try {
|
|
531
525
|
return JSON.parse(output);
|
|
@@ -538,7 +532,8 @@ async function runCommand(command, args, cwd) {
|
|
|
538
532
|
const child = (0, import_node_child_process3.spawn)(command, args, {
|
|
539
533
|
cwd,
|
|
540
534
|
stdio: ["ignore", "pipe", "pipe"],
|
|
541
|
-
env: process.env
|
|
535
|
+
env: process.env,
|
|
536
|
+
shell: process.platform === "win32"
|
|
542
537
|
});
|
|
543
538
|
let stdout = "";
|
|
544
539
|
let stderr = "";
|
|
@@ -720,7 +715,8 @@ async function spawnCommand(command, args, cwd) {
|
|
|
720
715
|
const child = (0, import_node_child_process5.spawn)(command, args, {
|
|
721
716
|
cwd,
|
|
722
717
|
stdio: ["ignore", "pipe", "pipe"],
|
|
723
|
-
env: process.env
|
|
718
|
+
env: process.env,
|
|
719
|
+
shell: process.platform === "win32"
|
|
724
720
|
});
|
|
725
721
|
child.stdout?.on("data", (chunk) => {
|
|
726
722
|
writePrefixedLines(chunk, false);
|
|
@@ -1814,13 +1810,7 @@ async function loadTypeScriptModule(schemaPath, projectRoot) {
|
|
|
1814
1810
|
`Schema file is TypeScript (${schemaPath}) but local "tsx" was not found. Install tsx in the project.`
|
|
1815
1811
|
);
|
|
1816
1812
|
}
|
|
1817
|
-
const script = [
|
|
1818
|
-
"import { pathToFileURL } from 'node:url'",
|
|
1819
|
-
"const modulePath = process.argv[process.argv.length - 1]",
|
|
1820
|
-
"const mod = await import(pathToFileURL(modulePath).href)",
|
|
1821
|
-
"const value = mod.default ?? mod",
|
|
1822
|
-
"process.stdout.write(JSON.stringify(value))"
|
|
1823
|
-
].join(";");
|
|
1813
|
+
const script = "const modulePath = process.argv[process.argv.length - 1];import('node:url').then(u => import(u.pathToFileURL(modulePath).href)).then(mod => { const v = mod.default ?? mod; process.stdout.write(JSON.stringify(v)) }).catch(e => { process.stderr.write(String(e)); process.exit(1) })";
|
|
1824
1814
|
const output = await runCommand2(tsxBinary, ["--eval", script, schemaPath], projectRoot);
|
|
1825
1815
|
try {
|
|
1826
1816
|
return JSON.parse(output);
|
|
@@ -1833,7 +1823,8 @@ async function runCommand2(command, args, cwd) {
|
|
|
1833
1823
|
const child = (0, import_node_child_process6.spawn)(command, args, {
|
|
1834
1824
|
cwd,
|
|
1835
1825
|
stdio: ["ignore", "pipe", "pipe"],
|
|
1836
|
-
env: process.env
|
|
1826
|
+
env: process.env,
|
|
1827
|
+
shell: process.platform === "win32"
|
|
1837
1828
|
});
|
|
1838
1829
|
let stdout = "";
|
|
1839
1830
|
let stderr = "";
|