slopcode 0.2.137 → 0.2.140
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/slopcode +25 -7
- package/bundle/index.js +1481 -756
- package/bundle/worker.js +1237 -112
- package/package.json +12 -12
- package/postinstall.mjs +72 -5
package/bin/slopcode
CHANGED
|
@@ -77,7 +77,7 @@ function termuxEnv() {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
function libc() {
|
|
80
|
-
if (platform === "android") return "bionic"
|
|
80
|
+
if (platform === "android" || termuxEnv()) return "bionic"
|
|
81
81
|
if (platform !== "linux") return
|
|
82
82
|
const report = process.report?.getReport?.()
|
|
83
83
|
if (typeof report?.header?.glibcVersionRuntime === "string" && report.header.glibcVersionRuntime) {
|
|
@@ -97,7 +97,7 @@ function libc() {
|
|
|
97
97
|
const text = ((result.stdout || "") + (result.stderr || "")).toLowerCase()
|
|
98
98
|
if (text.includes("musl")) return "musl"
|
|
99
99
|
if (text.includes("glibc") || text.includes("gnu libc")) return "glibc"
|
|
100
|
-
if (text.includes("bionic")
|
|
100
|
+
if (text.includes("bionic")) return "bionic"
|
|
101
101
|
const loader = arch === "arm64" ? "/lib/ld-musl-aarch64.so.1" : arch === "x64" ? "/lib/ld-musl-x86_64.so.1" : ""
|
|
102
102
|
if (loader && fs.existsSync(loader)) return "musl"
|
|
103
103
|
}
|
|
@@ -223,7 +223,18 @@ function androidDoctor(args) {
|
|
|
223
223
|
}
|
|
224
224
|
|
|
225
225
|
function androidInteractive(args) {
|
|
226
|
-
return !androidDoctor(args) && !args.includes("--self-test")
|
|
226
|
+
return !androidDoctor(args) && args[0] !== "--version" && !args.includes("--self-test")
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
function findNodeModuleFile(startDir, parts) {
|
|
230
|
+
let current = startDir
|
|
231
|
+
for (;;) {
|
|
232
|
+
const candidate = path.join(current, "node_modules", ...parts)
|
|
233
|
+
if (fs.existsSync(candidate)) return candidate
|
|
234
|
+
const parent = path.dirname(current)
|
|
235
|
+
if (parent === current) return
|
|
236
|
+
current = parent
|
|
237
|
+
}
|
|
227
238
|
}
|
|
228
239
|
|
|
229
240
|
function androidBun(arch) {
|
|
@@ -231,7 +242,9 @@ function androidBun(arch) {
|
|
|
231
242
|
return [
|
|
232
243
|
process.env.SLOPCODE_BUN_PATH,
|
|
233
244
|
path.join(rootDir, "node_modules", "@oven", name, "bin", "bun"),
|
|
245
|
+
findNodeModuleFile(scriptDir, ["@oven", name, "bin", "bun"]),
|
|
234
246
|
path.join(rootDir, "node_modules", ".bin", process.platform === "win32" ? "bun.cmd" : "bun"),
|
|
247
|
+
findNodeModuleFile(scriptDir, [".bin", process.platform === "win32" ? "bun.cmd" : "bun"]),
|
|
235
248
|
].find((item) => item && fs.existsSync(item))
|
|
236
249
|
}
|
|
237
250
|
|
|
@@ -296,8 +309,14 @@ if (!resolved) {
|
|
|
296
309
|
}
|
|
297
310
|
|
|
298
311
|
const args = process.argv.slice(2)
|
|
299
|
-
if (
|
|
312
|
+
if (libc() === "bionic" && androidInteractive(args)) {
|
|
300
313
|
const bun = androidBun(arch)
|
|
314
|
+
if (!fs.existsSync(androidBundle)) {
|
|
315
|
+
console.error(
|
|
316
|
+
"SlopCode Android CLI bootstrap bundle is missing. Reinstall from Termux with: npm install -g slopcode@latest --include=optional",
|
|
317
|
+
)
|
|
318
|
+
process.exit(1)
|
|
319
|
+
}
|
|
301
320
|
if (bun && fs.existsSync(androidBundle)) {
|
|
302
321
|
const runtimeRoot = path.dirname(path.dirname(resolved.path))
|
|
303
322
|
run(bun, {
|
|
@@ -313,13 +332,12 @@ if (platform === "android" && androidInteractive(args)) {
|
|
|
313
332
|
},
|
|
314
333
|
})
|
|
315
334
|
}
|
|
316
|
-
if (
|
|
335
|
+
if (!bun) {
|
|
317
336
|
console.error(
|
|
318
|
-
"SlopCode Android CLI bootstrap is missing.
|
|
337
|
+
"SlopCode Android CLI bootstrap is missing. Run npm rebuild slopcode or reinstall from Termux with: npm install -g slopcode@latest --include=optional",
|
|
319
338
|
)
|
|
320
339
|
process.exit(1)
|
|
321
340
|
}
|
|
322
341
|
}
|
|
323
342
|
|
|
324
343
|
run(resolved.path)
|
|
325
|
-
|