INNER CODE UNIT · JavaScript
platformTarget
Barre/ZeroFS · zerofs/zerofs-ffi/bindings/typescript/packaging/index.js:28
function platformTarget() {
const { platform, arch } = process;
if (platform === "linux") {
// `process.report` exposes the runtime's glibc version; its absence means a
// musl host (Alpine). This is exactly how the generator distinguishes them.
const glibc = process.report?.getReport?.().header?.glibcVersionRuntime;
const libc = glibc == null ? "musl" : "gnu";
return `${platform}-${arch}-${libc}`;
}
return `${platform}-${arch}`;
}
// `@zerofs/ffi-<target>` exposes `libraryPath` (the absolute path to its single
// bundled cdylib). Keep the require specifier a plain string literal per target
// so bundlers can statically see every candidate.
function platformPackageFor(target) {
switch (target) {
case "linux-x64-gnu":