Repository navigation
[pull] main from pnpm:main - #490
Merged
Merged
Conversation
…tching (#13731) Bins linked into the global bin dir (pnpm add -g, pnpm runtime set -g) are written as context-aware shims that dispatch through a protocol-versioned executable (.pnpm-shim-v1) installed next to them. The dispatcher walks up from the invocation cwd; under the new globalShims record's defaults ({ node: true, deno: true, bun: true }, merged key-wise across config layers with scalar false/true shorthands), a stable Node.js pin in devEngines.runtime / engines.runtime is resolved, authenticated with the Node.js release-team signatures, materialized into the trusted global virtual store (scripts and project dependency rewrites disabled, package and executable required to canonicalize inside the store), and executed — bare `node` follows the project's pin with no shell hooks (closes #13735). Project node_modules/.bin is never consulted for runtimes. Entries for unsigned candidates — Deno, Bun, Node.js prereleases, and any ordinary package the user enables (e.g. typescript: true) — are gated by provider-name validation and a candidate-bound trust prompt whose machine-local approvals are tied to the provider manifest, canonical target, shim contents, and file identity. The record values name the policy per package: "auto" (shorthand true) defers to artifact authentication, "always" switches without ever asking, "prompt" always asks even for authenticated candidates. globalShims: false dispatches nothing; PNPM_SHIM_BYPASS=1 is a one-invocation bypass and the dispatcher's recursion guard. The mode is read only from the env override, the pnpm home's own pnpm-workspace.yaml, and the global config.yaml — never a discovered ancestor — and takes effect without relinking. The runtime materialization anchors its configuration in pnpm's state dir (machine-local sources only, host-native artifacts only) so a repository cannot redirect the store or mirrors feeding the dispatched executable; musl hosts stay behind the trust prompt because their assets are not publisher-signed. Manifest-controlled bin names are escaped in every dispatch line, batch targets spawn through the standard library's escaping, project-local lookup rejects .exe candidates, and the test-only trust escape is debug-builds-only. On Windows the global node.exe is the native dispatcher itself, with the managed executable recorded as its direct fallback so shell-less spawns of node.exe keep working. Fallback paths re-enter the generated shim with the bypass set so the shell's own shebang handling performs the direct execution, degrading to the embedded target when the shim itself cannot be started. Rust-only by design: this ships in pnpm v12's breaking-change surface; the TypeScript CLI does not mirror it.
The managed runtime dispatcher read the entire pnpm executable to detect libc on every invocation. Since the bundled executable is tens of megabytes, this dominated otherwise warm runtime dispatch. Detect libc by opening /proc/self/exe and seeking only to the bounded ELF header, program-header table, and PT_INTERP value. Preserve the existing filesystem and command fallbacks for malformed or unsupported ELF layouts. Do not add persistent launcher state: every managed runtime invocation continues through the existing materialization path and reloads current trusted configuration. This brings warm runtime dispatch close to direct process startup without introducing cache invalidation or a new executable-path trust surface. Related to #13731.
…ndalone executable (#13732) `pnpm setup` writes a package.json next to a standalone executable whose directory has none — the tarball that https://get.pnpm.io/install.sh downloads — so the global install has a package to install. That manifest omitted `"type": "module"`, so Node.js reparsed the ESM files shipped beside the executable (`dist/worker.js`) as CommonJS first and printed a MODULE_TYPELESS_PACKAGE_JSON warning on every spawn. The published `@pnpm/exe` manifest already declares the module type, so this only affected installs made through the standalone script. Fixed in both stacks. The manifest construction moves into `standaloneManifest` / `standalone_manifest`, so it can be asserted without running the global install the surrounding function performs.
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )