@shareai-lab/kode 1.0.98 → 1.0.100
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/cli.js +8 -10
- package/package.json +1 -1
- package/src/package.json +3 -0
package/cli.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const { spawn } = require('child_process');
|
|
4
4
|
const path = require('path');
|
|
5
5
|
|
|
6
|
-
// Prefer Bun if available for speed; otherwise use Node + tsx
|
|
6
|
+
// Prefer Bun if available for speed; otherwise use Node + tsx preload
|
|
7
7
|
const args = process.argv.slice(2);
|
|
8
8
|
const cliPath = path.join(__dirname, 'src', 'entrypoints', 'cli.tsx');
|
|
9
9
|
|
|
@@ -15,15 +15,13 @@ try { tsxCliPath = require.resolve('tsx/cli', { paths: [__dirname] }); } catch {
|
|
|
15
15
|
|
|
16
16
|
// Enforce minimum Node version based on package.json engines.node
|
|
17
17
|
try {
|
|
18
|
-
const req = "
|
|
18
|
+
const req = ">=20.18.1"
|
|
19
19
|
const m = req.match(/(\d+)\.(\d+)\.(\d+)/)
|
|
20
20
|
const [maj, min, pat] = process.versions.node.split('.').map(Number)
|
|
21
21
|
const [rMaj, rMin, rPat] = m ? m.slice(1).map(Number) : [20, 18, 1]
|
|
22
22
|
const tooOld = (maj < rMaj) || (maj === rMaj && (min < rMin || (min === rMin && pat < rPat)))
|
|
23
23
|
if (tooOld) {
|
|
24
|
-
console.error(
|
|
25
|
-
'Error: Node.js ' + req + ' is required. Please upgrade Node.'
|
|
26
|
-
);
|
|
24
|
+
console.error('Error: Node.js ' + req + ' is required. Please upgrade Node.')
|
|
27
25
|
process.exit(1)
|
|
28
26
|
}
|
|
29
27
|
} catch {}
|
|
@@ -42,9 +40,9 @@ function runWithBun() {
|
|
|
42
40
|
stdio: 'inherit',
|
|
43
41
|
env: { ...process.env, YOGA_WASM_PATH: path.join(__dirname, 'yoga.wasm') },
|
|
44
42
|
})
|
|
45
|
-
child.on('error', () =>
|
|
43
|
+
child.on('error', () => runWithTsxImport())
|
|
46
44
|
child.on('exit', code => {
|
|
47
|
-
if (code && code !== 0) return
|
|
45
|
+
if (code && code !== 0) return runWithTsxImport()
|
|
48
46
|
process.exit(code || 0)
|
|
49
47
|
})
|
|
50
48
|
}
|
|
@@ -60,7 +58,7 @@ function runWithTsxImport() {
|
|
|
60
58
|
const baseArgs = ['--no-warnings=ExperimentalWarning', '--enable-source-maps']
|
|
61
59
|
const child = spawn(process.execPath, [...baseArgs, '--import', importArg, cliPath, ...args], {
|
|
62
60
|
stdio: 'inherit',
|
|
63
|
-
env: { ...process.env, YOGA_WASM_PATH: path.join(__dirname, 'yoga.wasm') },
|
|
61
|
+
env: { ...process.env, YOGA_WASM_PATH: path.join(__dirname, 'yoga.wasm'), TSX_TSCONFIG_PATH: path.join(__dirname, 'tsconfig.json') },
|
|
64
62
|
})
|
|
65
63
|
child.on('error', () => runWithTsxCLI())
|
|
66
64
|
child.on('exit', code => {
|
|
@@ -71,7 +69,7 @@ function runWithTsxImport() {
|
|
|
71
69
|
|
|
72
70
|
function runWithTsxCLI() {
|
|
73
71
|
if (!tsxCliPath) return fail()
|
|
74
|
-
const child = spawn(process.execPath, [tsxCliPath,
|
|
72
|
+
const child = spawn(process.execPath, [tsxCliPath, cliPath, ...args], {
|
|
75
73
|
stdio: 'inherit',
|
|
76
74
|
env: { ...process.env, YOGA_WASM_PATH: path.join(__dirname, 'yoga.wasm') },
|
|
77
75
|
})
|
|
@@ -82,7 +80,7 @@ function runWithTsxCLI() {
|
|
|
82
80
|
function fail() {
|
|
83
81
|
console.error('')
|
|
84
82
|
console.error('Failed to start Kode.')
|
|
85
|
-
console.error('
|
|
83
|
+
console.error('If you see top-level await/CJS errors on Windows, ensure tsx is available and up-to-date.')
|
|
86
84
|
process.exit(1)
|
|
87
85
|
}
|
|
88
86
|
|
package/package.json
CHANGED
package/src/package.json
ADDED