slopcode 0.2.104 → 0.2.106
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 +33 -5
- package/package.json +12 -12
- package/postinstall.mjs +30 -3
package/bin/slopcode
CHANGED
|
@@ -45,13 +45,15 @@ const supported = {
|
|
|
45
45
|
windows: ["x64"],
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
const rawPlatform = process.env.SLOPCODE_TEST_PLATFORM || os.platform()
|
|
49
|
+
const rawArch = process.env.SLOPCODE_TEST_ARCH || os.arch()
|
|
50
|
+
let platform = platformMap[rawPlatform]
|
|
49
51
|
if (!platform) {
|
|
50
|
-
platform =
|
|
52
|
+
platform = rawPlatform
|
|
51
53
|
}
|
|
52
|
-
let arch = archMap[
|
|
54
|
+
let arch = archMap[rawArch]
|
|
53
55
|
if (!arch) {
|
|
54
|
-
arch =
|
|
56
|
+
arch = rawArch
|
|
55
57
|
}
|
|
56
58
|
const binary = platform === "windows" ? "slopcode.exe" : "slopcode"
|
|
57
59
|
|
|
@@ -66,7 +68,12 @@ function clearCache() {
|
|
|
66
68
|
remove(sidecar)
|
|
67
69
|
}
|
|
68
70
|
|
|
71
|
+
function termuxEnv() {
|
|
72
|
+
return Boolean(process.env.TERMUX_VERSION || (process.env.PREFIX || "").includes("/com.termux/"))
|
|
73
|
+
}
|
|
74
|
+
|
|
69
75
|
function libc() {
|
|
76
|
+
if (platform === "android") return "bionic"
|
|
70
77
|
if (platform !== "linux") return
|
|
71
78
|
const report = process.report?.getReport?.()
|
|
72
79
|
if (typeof report?.header?.glibcVersionRuntime === "string" && report.header.glibcVersionRuntime) {
|
|
@@ -86,6 +93,7 @@ function libc() {
|
|
|
86
93
|
const text = ((result.stdout || "") + (result.stderr || "")).toLowerCase()
|
|
87
94
|
if (text.includes("musl")) return "musl"
|
|
88
95
|
if (text.includes("glibc") || text.includes("gnu libc")) return "glibc"
|
|
96
|
+
if (text.includes("bionic") || termuxEnv()) return "bionic"
|
|
89
97
|
const loader = arch === "arm64" ? "/lib/ld-musl-aarch64.so.1" : arch === "x64" ? "/lib/ld-musl-x86_64.so.1" : ""
|
|
90
98
|
if (loader && fs.existsSync(loader)) return "musl"
|
|
91
99
|
}
|
|
@@ -127,10 +135,12 @@ function supportsAvx2() {
|
|
|
127
135
|
}
|
|
128
136
|
|
|
129
137
|
function names(prefix) {
|
|
138
|
+
const kind = libc()
|
|
139
|
+
if (kind === "bionic") return []
|
|
140
|
+
|
|
130
141
|
const base = `${prefix}-${platform}-${arch}`
|
|
131
142
|
const avx2 = supportsAvx2()
|
|
132
143
|
const baseline = arch === "x64" && !avx2
|
|
133
|
-
const kind = libc()
|
|
134
144
|
|
|
135
145
|
if (platform === "linux") {
|
|
136
146
|
if (kind === "musl") {
|
|
@@ -194,6 +204,24 @@ function supportedMessage() {
|
|
|
194
204
|
.join(" ")
|
|
195
205
|
}
|
|
196
206
|
|
|
207
|
+
function termuxMessage() {
|
|
208
|
+
return [
|
|
209
|
+
"SlopCode does not ship a native Android/Termux (bionic) binary yet.",
|
|
210
|
+
"Run SlopCode inside a Termux proot Linux distro:",
|
|
211
|
+
" pkg install proot-distro",
|
|
212
|
+
" proot-distro install debian",
|
|
213
|
+
" proot-distro login debian",
|
|
214
|
+
" apt update && apt install -y curl ca-certificates git",
|
|
215
|
+
" curl -fsSL https://slopcode.dev/install | bash",
|
|
216
|
+
].join("\n")
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
if (libc() === "bionic") {
|
|
220
|
+
clearCache()
|
|
221
|
+
console.error(termuxMessage())
|
|
222
|
+
process.exit(1)
|
|
223
|
+
}
|
|
224
|
+
|
|
197
225
|
const packageNames = names("slopcode-bin")
|
|
198
226
|
const resolvedNames = Array.from(new Set([...packageNames, ...names("slopcode")]))
|
|
199
227
|
const hit = cacheReady(resolvedNames)
|
package/package.json
CHANGED
|
@@ -34,19 +34,19 @@
|
|
|
34
34
|
"scripts": {
|
|
35
35
|
"postinstall": "bun ./postinstall.mjs || node ./postinstall.mjs"
|
|
36
36
|
},
|
|
37
|
-
"version": "0.2.
|
|
37
|
+
"version": "0.2.106",
|
|
38
38
|
"license": "MIT",
|
|
39
39
|
"optionalDependencies": {
|
|
40
|
-
"slopcode-bin-darwin-arm64": "0.2.
|
|
41
|
-
"slopcode-bin-linux-x64-baseline": "0.2.
|
|
42
|
-
"slopcode-bin-windows-x64": "0.2.
|
|
43
|
-
"slopcode-bin-linux-x64": "0.2.
|
|
44
|
-
"slopcode-bin-linux-x64-baseline-musl": "0.2.
|
|
45
|
-
"slopcode-bin-linux-x64-musl": "0.2.
|
|
46
|
-
"slopcode-bin-linux-arm64": "0.2.
|
|
47
|
-
"slopcode-bin-windows-x64-baseline": "0.2.
|
|
48
|
-
"slopcode-bin-linux-arm64-musl": "0.2.
|
|
49
|
-
"slopcode-bin-darwin-x64-baseline": "0.2.
|
|
50
|
-
"slopcode-bin-darwin-x64": "0.2.
|
|
40
|
+
"slopcode-bin-darwin-arm64": "0.2.106",
|
|
41
|
+
"slopcode-bin-linux-x64-baseline": "0.2.106",
|
|
42
|
+
"slopcode-bin-windows-x64": "0.2.106",
|
|
43
|
+
"slopcode-bin-linux-x64": "0.2.106",
|
|
44
|
+
"slopcode-bin-linux-x64-baseline-musl": "0.2.106",
|
|
45
|
+
"slopcode-bin-linux-x64-musl": "0.2.106",
|
|
46
|
+
"slopcode-bin-linux-arm64": "0.2.106",
|
|
47
|
+
"slopcode-bin-windows-x64-baseline": "0.2.106",
|
|
48
|
+
"slopcode-bin-linux-arm64-musl": "0.2.106",
|
|
49
|
+
"slopcode-bin-darwin-x64-baseline": "0.2.106",
|
|
50
|
+
"slopcode-bin-darwin-x64": "0.2.106"
|
|
51
51
|
}
|
|
52
52
|
}
|
package/postinstall.mjs
CHANGED
|
@@ -16,22 +16,29 @@ const supported = {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
function detectPlatformAndArch() {
|
|
19
|
+
const rawPlatform = process.env.SLOPCODE_TEST_PLATFORM || os.platform()
|
|
20
|
+
const rawArch = process.env.SLOPCODE_TEST_ARCH || os.arch()
|
|
19
21
|
const platform =
|
|
20
22
|
{
|
|
21
23
|
darwin: "darwin",
|
|
22
24
|
linux: "linux",
|
|
23
25
|
win32: "windows",
|
|
24
|
-
}[
|
|
26
|
+
}[rawPlatform] ?? rawPlatform
|
|
25
27
|
const arch =
|
|
26
28
|
{
|
|
27
29
|
x64: "x64",
|
|
28
30
|
arm64: "arm64",
|
|
29
31
|
arm: "arm",
|
|
30
|
-
}[
|
|
32
|
+
}[rawArch] ?? rawArch
|
|
31
33
|
return { platform, arch }
|
|
32
34
|
}
|
|
33
35
|
|
|
36
|
+
function termuxEnv() {
|
|
37
|
+
return Boolean(process.env.TERMUX_VERSION || (process.env.PREFIX || "").includes("/com.termux/"))
|
|
38
|
+
}
|
|
39
|
+
|
|
34
40
|
function detectLibc(platform, arch) {
|
|
41
|
+
if (platform === "android") return "bionic"
|
|
35
42
|
if (platform !== "linux") return
|
|
36
43
|
const report = process.report?.getReport?.()
|
|
37
44
|
if (typeof report?.header?.glibcVersionRuntime === "string" && report.header.glibcVersionRuntime) {
|
|
@@ -51,6 +58,7 @@ function detectLibc(platform, arch) {
|
|
|
51
58
|
const text = ((result.stdout || "") + (result.stderr || "")).toLowerCase()
|
|
52
59
|
if (text.includes("musl")) return "musl"
|
|
53
60
|
if (text.includes("glibc") || text.includes("gnu libc")) return "glibc"
|
|
61
|
+
if (text.includes("bionic") || termuxEnv()) return "bionic"
|
|
54
62
|
const loader = arch === "arm64" ? "/lib/ld-musl-aarch64.so.1" : arch === "x64" ? "/lib/ld-musl-x86_64.so.1" : ""
|
|
55
63
|
if (loader && fs.existsSync(loader)) return "musl"
|
|
56
64
|
}
|
|
@@ -84,9 +92,10 @@ function supportsAvx2(platform, arch) {
|
|
|
84
92
|
|
|
85
93
|
function names(platform, arch) {
|
|
86
94
|
const base = `slopcode-bin-${platform}-${arch}`
|
|
95
|
+
const libc = detectLibc(platform, arch)
|
|
96
|
+
if (libc === "bionic") return []
|
|
87
97
|
const avx2 = supportsAvx2(platform, arch)
|
|
88
98
|
const baseline = arch === "x64" && !avx2
|
|
89
|
-
const libc = detectLibc(platform, arch)
|
|
90
99
|
|
|
91
100
|
if (platform === "linux") {
|
|
92
101
|
if (libc === "musl") {
|
|
@@ -130,6 +139,18 @@ function supportedMessage() {
|
|
|
130
139
|
.join(" ")
|
|
131
140
|
}
|
|
132
141
|
|
|
142
|
+
function termuxMessage() {
|
|
143
|
+
return [
|
|
144
|
+
"SlopCode does not ship a native Android/Termux (bionic) binary yet.",
|
|
145
|
+
"Run SlopCode inside a Termux proot Linux distro:",
|
|
146
|
+
" pkg install proot-distro",
|
|
147
|
+
" proot-distro install debian",
|
|
148
|
+
" proot-distro login debian",
|
|
149
|
+
" apt update && apt install -y curl ca-certificates git",
|
|
150
|
+
" curl -fsSL https://slopcode.dev/install | bash",
|
|
151
|
+
].join("\n")
|
|
152
|
+
}
|
|
153
|
+
|
|
133
154
|
function findBinary() {
|
|
134
155
|
const { platform, arch } = detectPlatformAndArch()
|
|
135
156
|
const binaryName = platform === "windows" ? "slopcode.exe" : "slopcode"
|
|
@@ -193,6 +214,12 @@ function writeMeta(input) {
|
|
|
193
214
|
async function main() {
|
|
194
215
|
try {
|
|
195
216
|
const { platform, arch } = detectPlatformAndArch()
|
|
217
|
+
if (detectLibc(platform, arch) === "bionic") {
|
|
218
|
+
clearCache()
|
|
219
|
+
console.log(termuxMessage())
|
|
220
|
+
return
|
|
221
|
+
}
|
|
222
|
+
|
|
196
223
|
if (!(supported[platform] ?? []).includes(arch)) {
|
|
197
224
|
clearCache()
|
|
198
225
|
console.log(
|