rules/js/pnpm/toolchain.js

Developer reference: this page includes exported implementation details. BUILD authors should prefer the User API reference.

PNPM_TOOL

const PNPM_TOOL

Undocumented.

pnpmArtifactName()

pnpmArtifactName(version, plat)

Return the pnpm release archive filename for a version and platform.

ParameterTypeDescription
versionstring
plat{ os: string, arch: string }

Returns: string

pnpmDownloadUrl()

pnpmDownloadUrl(version, plat)

Return the pnpm release download URL for a version and platform.

ParameterTypeDescription
versionstring
plat{ os: string, arch: string }

Returns: string

pnpmCacheKey()

pnpmCacheKey(version, plat)

Return the named-cache key for a pnpm toolchain version and platform.

ParameterTypeDescription
versionstring
plat{ os: string, arch: string }

Returns: string

pnpmSupportedPlatforms()

pnpmSupportedPlatforms()

Undocumented.

PnpmToolchain (implementation class)

class PnpmToolchain

Implementation class. BUILD files should use pnpmToolchain().

Undocumented.

pnpmToolchain()

pnpmToolchain(version, opts = {})

Declare a pnpm toolchain version and optionally set it as the default. matching lockfile entry (warns instead of failing).

ParameterTypeDescription
versionstring
[opts]object
[opts.default=false]boolean
[opts.unverified=false]booleanAllow downloading without a

Returns: object Target handle for this pnpm toolchain.

installPnpmToolchain()

installPnpmToolchain(version, source)

Install a local pnpm toolchain directory into the named cache.

ParameterTypeDescription
versionstring
sourcestringPath to the directory containing the pnpm binary.

Returns: string|null Local path to the cached toolchain root.

acquirePnpmToolchain

const acquirePnpmToolchain

Acquire a pnpm toolchain, downloading and caching it if not already installed in the named cache.

ParameterTypeDescription
versionstring

Returns: Promise<string> Local path to the toolchain root.

resolvePnpmToolchainVersion()

resolvePnpmToolchainVersion(version)

Resolve an explicit or default pnpm toolchain version.

ParameterTypeDescription
[version]string

Returns: string|null

pnpmStoreDirTool()

pnpmStoreDirTool()

Return a named-cache-backed tool descriptor mounting pnpm's shared content-addressed store at a stable path, read-write across every sandbox. Not put on PATH (binDirs empty) — pair with pnpmStoreDirEnv() to point pnpm's store-dir config at its mount path.

Returns: object

pnpmStoreDirEnv()

pnpmStoreDirEnv()

Return the run() env entries pointing pnpm at its shared store tool mount (see pnpmStoreDirTool). Any run() using this must also include that tool, or the path won't exist in the sandbox. pnpm has no dedicated PNPM_STORE_DIR variable — like every npm-config-derived tool, its store-dir setting is overridden via the npm_config_<key> environment convention. Values are relative to the sandbox root — callers must export them as absolute paths (capturing $(pwd) before any cd) rather than passing them via run()'s own env:, exactly as uvCacheDirEnv()'s doc comment in rules/python/uv_toolchain.js explains for UV_CACHE_DIR.

Returns: string[]

defaultPnpmToolchainVersion()

defaultPnpmToolchainVersion()

Return the currently configured default pnpm toolchain version.

Returns: string|null

defaultPnpmToolchain()

defaultPnpmToolchain()

Return the currently configured default pnpm toolchain target handle.

Returns: object|null