ironcode-ai 1.17.0 → 1.17.2
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/ironcode +24 -4
- package/package.json +6 -4
- package/postinstall.mjs +3 -0
package/bin/ironcode
CHANGED
|
@@ -47,21 +47,41 @@ if (!arch) {
|
|
|
47
47
|
const base = "ironcode-" + platform + "-" + arch
|
|
48
48
|
const binary = platform === "windows" ? "ironcode.exe" : "ironcode"
|
|
49
49
|
|
|
50
|
+
function hasAvx2() {
|
|
51
|
+
if (platform !== "linux" || arch !== "x64") return true
|
|
52
|
+
try {
|
|
53
|
+
const cpuinfo = fs.readFileSync("/proc/cpuinfo", "utf8")
|
|
54
|
+
return cpuinfo.includes(" avx2 ")
|
|
55
|
+
} catch {
|
|
56
|
+
return true
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const avx2 = hasAvx2()
|
|
61
|
+
|
|
50
62
|
function findBinary(startDir) {
|
|
51
63
|
let current = startDir
|
|
52
64
|
for (;;) {
|
|
53
65
|
const modules = path.join(current, "node_modules")
|
|
54
66
|
if (fs.existsSync(modules)) {
|
|
55
67
|
const entries = fs.readdirSync(modules)
|
|
68
|
+
// Collect all matching candidates
|
|
69
|
+
const candidates = []
|
|
56
70
|
for (const entry of entries) {
|
|
57
|
-
if (!entry.startsWith(base))
|
|
58
|
-
continue
|
|
59
|
-
}
|
|
71
|
+
if (!entry.startsWith(base)) continue
|
|
60
72
|
const candidate = path.join(modules, entry, "bin", binary)
|
|
61
73
|
if (fs.existsSync(candidate)) {
|
|
62
|
-
|
|
74
|
+
candidates.push({ entry, path: candidate })
|
|
63
75
|
}
|
|
64
76
|
}
|
|
77
|
+
if (candidates.length > 0) {
|
|
78
|
+
// Prefer modern (AVX2) or baseline based on CPU capability
|
|
79
|
+
const preferred = avx2 ? "modern" : "baseline"
|
|
80
|
+
const exact = candidates.find((c) => c.entry === base + "-" + preferred)
|
|
81
|
+
if (exact) return exact.path
|
|
82
|
+
// Fall back: if only one exists, use it; otherwise pick first
|
|
83
|
+
return candidates[0].path
|
|
84
|
+
}
|
|
65
85
|
}
|
|
66
86
|
const parent = path.dirname(current)
|
|
67
87
|
if (parent === current) {
|
package/package.json
CHANGED
|
@@ -6,11 +6,13 @@
|
|
|
6
6
|
"scripts": {
|
|
7
7
|
"postinstall": "bun ./postinstall.mjs || node ./postinstall.mjs"
|
|
8
8
|
},
|
|
9
|
-
"version": "1.17.
|
|
9
|
+
"version": "1.17.2",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"optionalDependencies": {
|
|
12
|
-
"ironcode-linux-x64": "1.17.
|
|
13
|
-
"ironcode-
|
|
14
|
-
"ironcode-
|
|
12
|
+
"ironcode-linux-x64-baseline": "1.17.2",
|
|
13
|
+
"ironcode-linux-x64-modern": "1.17.2",
|
|
14
|
+
"ironcode-linux-x64-baseline-musl": "1.17.2",
|
|
15
|
+
"ironcode-windows-x64-modern": "1.17.2",
|
|
16
|
+
"ironcode-darwin-arm64": "1.17.2"
|
|
15
17
|
}
|
|
16
18
|
}
|
package/postinstall.mjs
CHANGED
|
@@ -51,6 +51,9 @@ function findBinary() {
|
|
|
51
51
|
const { platform, arch } = detectPlatformAndArch()
|
|
52
52
|
// const packageName = `ironcode-${platform}-${arch}`
|
|
53
53
|
let packageName = `ironcode-${platform}-${arch}`
|
|
54
|
+
if (arch === "x64") {
|
|
55
|
+
packageName += "-modern"
|
|
56
|
+
}
|
|
54
57
|
const binaryName = platform === "windows" ? "ironcode.exe" : "ironcode"
|
|
55
58
|
|
|
56
59
|
try {
|