Files
pnpm/env/node.resolver/src/getNodeArtifactAddress.ts
Zoltan Kochan 9065f491f0 feat: add musl support to node runtime (#10664)
The lockfile now includes musl Linux builds (sourced from
unofficial-builds.nodejs.org) alongside the standard glibc variants,
so that `node@runtime:` works out of the box on Alpine Linux and other
musl-based distributions.

`env use` can download node.js artifacts for systems that use musl.
2026-02-21 21:29:05 +01:00

34 lines
870 B
TypeScript

import { getNormalizedArch } from './normalizeArch.js'
export interface NodeArtifactAddress {
basename: string
extname: string
dirname: string
}
export interface GetNodeArtifactAddressOptions {
version: string
baseUrl: string
platform: string
arch: string
libc?: string
}
export function getNodeArtifactAddress ({
version,
baseUrl,
platform,
arch,
libc,
}: GetNodeArtifactAddressOptions): NodeArtifactAddress {
const isWindowsPlatform = platform === 'win32'
const normalizedPlatform = isWindowsPlatform ? 'win' : platform
const normalizedArch = getNormalizedArch(platform, arch, version)
const archSuffix = libc === 'musl' ? '-musl' : ''
return {
dirname: `${baseUrl}v${version}`,
basename: `node-v${version}-${normalizedPlatform}-${normalizedArch}${archSuffix}`,
extname: isWindowsPlatform ? '.zip' : '.tar.gz',
}
}