sloppycode 0.2.148 → 0.2.150
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/android-runtime/arm64/bin/slopcode +0 -0
- package/android-runtime/arm64/bin/slopcode-android-host +0 -0
- package/android-runtime/x64/bin/slopcode +0 -0
- package/android-runtime/x64/bin/slopcode-android-host +0 -0
- package/bin/slopcode +41 -4
- package/bundle/index.js +163 -5
- package/bundle/worker.js +83 -65
- package/package.json +12 -12
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/bin/slopcode
CHANGED
|
@@ -28,8 +28,31 @@ function run(target, options = {}) {
|
|
|
28
28
|
console.error(result.error.message)
|
|
29
29
|
process.exit(1)
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
if (result.signal === "SIGABRT" && options.fallback) {
|
|
32
|
+
console.error("slopcode crashed (SIGABRT), falling back to JS bundle...")
|
|
33
|
+
const bun = childProcess.spawnSync("bun", ["--version"], { encoding: "utf8", timeout: 3000 })
|
|
34
|
+
if (bun.status === 0 && bun.stdout.trim()) {
|
|
35
|
+
const fbEnv = { ...process.env, SLOPCODE_IN_PROCESS: "1", ...(options.fallbackEnv || {}) }
|
|
36
|
+
const fb = childProcess.spawnSync("bun", ["run", options.fallback, ...(options.args || process.argv.slice(2))], {
|
|
37
|
+
stdio: "inherit",
|
|
38
|
+
env: fbEnv,
|
|
39
|
+
})
|
|
40
|
+
if (fb.error) {
|
|
41
|
+
console.error(fb.error.message)
|
|
42
|
+
process.exit(1)
|
|
43
|
+
}
|
|
44
|
+
if (fb.signal) {
|
|
45
|
+
try { process.kill(process.pid, fb.signal) } catch {}
|
|
46
|
+
}
|
|
47
|
+
process.exit(typeof fb.status === "number" ? fb.status : 1)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (result.signal) {
|
|
51
|
+
try {
|
|
52
|
+
process.kill(process.pid, result.signal)
|
|
53
|
+
} catch {}
|
|
54
|
+
}
|
|
55
|
+
process.exit(typeof result.status === "number" ? result.status : 1)
|
|
33
56
|
}
|
|
34
57
|
|
|
35
58
|
const envPath = process.env.SLOPCODE_BIN_PATH
|
|
@@ -309,9 +332,19 @@ const useCache = libc() !== "bionic"
|
|
|
309
332
|
|
|
310
333
|
const packageNames = names("slopcode-bin")
|
|
311
334
|
const resolvedNames = Array.from(new Set([...packageNames, ...names("slopcode")]))
|
|
335
|
+
|
|
336
|
+
function findFallback(binaryPath) {
|
|
337
|
+
const pkgDir = path.dirname(path.dirname(binaryPath))
|
|
338
|
+
const fallback = path.join(pkgDir, "fallback", "index.js")
|
|
339
|
+
if (!fs.existsSync(fallback)) return
|
|
340
|
+
const modules = path.join(pkgDir, "fallback", "modules")
|
|
341
|
+
return { path: fallback, env: { NODE_PATH: [modules, process.env.NODE_PATH].filter(Boolean).join(path.delimiter) } }
|
|
342
|
+
}
|
|
343
|
+
|
|
312
344
|
const hit = useCache ? cacheReady(resolvedNames) : undefined
|
|
313
345
|
if (hit) {
|
|
314
|
-
|
|
346
|
+
const resolvedPkg = resolveBinary() || findBinary(scriptDir)
|
|
347
|
+
run(hit, { fallback: resolvedPkg ? findFallback(resolvedPkg.path)?.path : undefined, fallbackEnv: resolvedPkg ? findFallback(resolvedPkg.path)?.env : undefined })
|
|
315
348
|
}
|
|
316
349
|
clearCache()
|
|
317
350
|
|
|
@@ -416,4 +449,8 @@ if (libc() === "bionic" && androidInteractive(args)) {
|
|
|
416
449
|
}
|
|
417
450
|
}
|
|
418
451
|
|
|
419
|
-
|
|
452
|
+
const fallback = findFallback(resolved.path)
|
|
453
|
+
run(resolved.path, {
|
|
454
|
+
fallback: fallback?.path,
|
|
455
|
+
fallbackEnv: fallback?.env,
|
|
456
|
+
})
|