@muxcodecli/cli 1.15.13 → 1.15.14
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 +15 -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,25 @@
|
|
|
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
|
-
const key = `${platform}-${arch}`
|
|
19
|
-
const bin = binMap[key]
|
|
20
|
-
|
|
21
|
-
if (!bin) {
|
|
22
|
-
console.error(`Unsupported platform: ${key}`)
|
|
23
|
-
process.exit(1)
|
|
6
|
+
// Tenta encontrar bun: primeiro @oven-sh/bun, depois PATH
|
|
7
|
+
function findBun() {
|
|
8
|
+
try {
|
|
9
|
+
const bunPkg = require.resolve("@oven-sh/bun/bin/bun")
|
|
10
|
+
if (fs.existsSync(bunPkg)) return bunPkg
|
|
11
|
+
} catch {}
|
|
12
|
+
const { execSync } = require("child_process")
|
|
13
|
+
try { return execSync("which bun || where bun", { encoding: "utf8" }).trim().split("\n")[0] } catch {}
|
|
14
|
+
return null
|
|
24
15
|
}
|
|
25
16
|
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
console.error(`Binary not found: ${binPath}`)
|
|
30
|
-
console.error(`Run: npm install -g @muxcodecli/cli`)
|
|
17
|
+
const bun = findBun()
|
|
18
|
+
if (!bun) {
|
|
19
|
+
console.error("bun not found. Install via: npm install -g @oven-sh/bun")
|
|
31
20
|
process.exit(1)
|
|
32
21
|
}
|
|
33
22
|
|
|
34
|
-
const
|
|
23
|
+
const bundle = path.join(__dirname, "..", "dist", "index.js")
|
|
24
|
+
const result = spawnSync(bun, [bundle, ...process.argv.slice(2)], { stdio: "inherit" })
|
|
35
25
|
process.exit(result.status ?? 0)
|