@muxcodecli/cli 1.15.13 → 1.15.15
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/bin/muxcode +19 -25
- package/dist/index.js +5965 -0
- package/package.json +5 -2
- package/dist/muxcode-linux-x64 +0 -0
package/bin/muxcode
CHANGED
|
@@ -1,35 +1,29 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const {
|
|
2
|
+
const { spawnSync } = require("child_process")
|
|
3
3
|
const path = require("path")
|
|
4
|
-
const os = require("os")
|
|
5
4
|
const fs = require("fs")
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (!bin) {
|
|
22
|
-
console.error(`Unsupported platform: ${key}`)
|
|
23
|
-
process.exit(1)
|
|
6
|
+
function findBun() {
|
|
7
|
+
// 1. bun npm package
|
|
8
|
+
try {
|
|
9
|
+
const p = path.join(path.dirname(require.resolve("bun/package.json")), "bin", "bun")
|
|
10
|
+
if (fs.existsSync(p)) return p
|
|
11
|
+
} catch {}
|
|
12
|
+
// 2. bun no PATH
|
|
13
|
+
const cmd = process.platform === "win32" ? "where bun" : "which bun"
|
|
14
|
+
try {
|
|
15
|
+
const { execSync } = require("child_process")
|
|
16
|
+
return execSync(cmd, { encoding: "utf8" }).trim().split("\n")[0].trim()
|
|
17
|
+
} catch {}
|
|
18
|
+
return null
|
|
24
19
|
}
|
|
25
20
|
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
console.error(`Binary not found: ${binPath}`)
|
|
30
|
-
console.error(`Run: npm install -g @muxcodecli/cli`)
|
|
21
|
+
const bun = findBun()
|
|
22
|
+
if (!bun) {
|
|
23
|
+
console.error("muxcode requires bun. Install: npm install -g bun")
|
|
31
24
|
process.exit(1)
|
|
32
25
|
}
|
|
33
26
|
|
|
34
|
-
const
|
|
27
|
+
const bundle = path.join(__dirname, "..", "dist", "index.js")
|
|
28
|
+
const result = spawnSync(bun, [bundle, ...process.argv.slice(2)], { stdio: "inherit" })
|
|
35
29
|
process.exit(result.status ?? 0)
|