Repository navigation
[pull] main from pnpm:main - #507
Merged
Merged
Conversation
…lives (#13642) Every camelCase key in a project's `pnpm-workspace.yaml` was copied into the resolved config wholesale, and that copy ran after the reader had already resolved the machine-level locations from the environment. A repository could therefore redirect where pnpm writes: `configDir` moved the `auth.ini` that `pnpm login` writes the granted token to, `pnpmHomeDir` the directory `pnpm setup` puts on the user's PATH, `bin` where `pnpm install` links its dependencies' bins, `userConfig` the parsed contents of the user's own `.npmrc`, and `packageManagerRegistries` where pnpm downloads its next version from. Skip those settings in the project-manifest branch, together with the rest of the locations and trusted-source values the reader derives for itself, and report the ones a manifest tried to set, naming the route that does set each. `cacheDir` and `storeDir` stay settable, being deliberate project settings. The global config file already filtered its own keys, but the command line is merged in beside them, so it is filtered there too; the global package directory's manifest keeps merging the command line unfiltered. Guard the reader's own bookkeeping too. The merge writes onto an object that carries `ConfigContext` beside the settings, so a manifest naming one of those fields overwrote what the reader had resolved, and `explicitlySetKeys` crashed every command that reads config when a manifest gave it anything other than a `Set`. `pnpm config set` refuses the same keys and names the route that does set each one. `pnpm config delete` still clears one a file already carries, in whichever spelling the file used. pacquet is untouched: it parses the same file into a declared struct, so these settings were never picked up there in the first place, whereas pnpm11 copies every key a manifest carries onto the config object and needs a denylist to be safe. `--config.config-dir` stops reaching the config through a project manifest or the global config file. The reader resolves the config directory from the environment and overwrites the CLI value, so the flag never worked outside a workspace; inside one it worked only because the merge re-applied the command line afterwards, and even then it moved only the write, never the read. Resolves #13629
pnpm resolves, verifies and installs the other package managers now — npm, Yarn Classic, Yarn Berry, Yarn 6 (yarnpkg/zpm) and Bun — not only itself. A new `engine_pm` module owns a channel table mapping a package manager and version specifier to the artifact that provides it, and the engine installer that used to be `pnpm with`'s alone is generalized over that table: the npm-published engines go through the same resolve/verify/install pipeline pnpm's own engine uses, and the ones that ship as platform archives go through the managed-runtime installer. Each foreign engine resolves into its own env lockfile under the pnpm home, so one package manager's pins never rewrite another's, and pnpm's own stays where earlier releases wrote it. Git-hosted dependency preparation stops assuming the host has the package manager the dependency needs. The version comes from the dependency's own declaration, and the `yarn.lock` names the Yarn line whenever that declaration does not — Berry stamps `__metadata:` into every lockfile it writes and neither line can install the other's, so which one wrote it is a constraint rather than a preference. pnpm provides the package manager when the dependency pinned a version, or when the host cannot satisfy what it needs; a host that can, under every name the build may invoke, keeps doing the job it has always done. The build reaches it by name, through shims that forward to `pnpm dlx --package <pm>@<spec> <command>` — so a script calling `npx` gets npm's `npx` rather than npm. Context-aware shims no longer need a global install behind them: their target slot can carry a `pkg:<name>` sentinel, and the dispatcher gained a `packageManager`-pin candidate that provisions on demand. A pin outranks an installed copy of that package manager, because it is the project's own statement of what installs it. An npm-published engine is verified against npm's signature for its exact version before it runs — the standard that already lets pnpm switch itself without asking — so it runs promptless; Bun and Yarn 6 are checksum-pinned archives and stay behind the trust gate. `pnpm shim add|rm|ls` manages those shims, for any package rather than package managers alone. Nothing creates one as a side effect of `pnpm setup` or an install. `pnpm dlx` provisions rather than installs when the command names a tool pnpm manages: `pnpm dlx yarn@4` used to fail with "no such version" because npm's `yarn` package stops at Classic, Yarn 6 is not on npm at all, and `node`/`deno` there are wrappers that download a build. `--package` naming a package manager makes it the engine to provision while the command names which of its bins to run, so `pnx --package npm@11 npx` is a spelling of its own. `pnpm with` stays pnpm-only — its corepack refusal and its child pm-check override are about pnpm's own version. The feature grew four copies of a few things, and they are down to one each: how a manifest spells a package manager (now `pacquet_package_manifest::package_manager_spec`, shared with the git fetcher, which also settles "is this reference a version or a locator?"), where a command comes from inside an engine, how `PATH` is handed to a child, and how a release is resolved. A project pinned to another package manager still fails (ERR_PNPM_OTHER_PM_EXPECTED) rather than silently running it; the error now names the two ways to work on it. Rust-only: the TypeScript CLI still needs the provisioner, preparePackage's version detection, and dlx's tool routing.
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 : )