Ana içeriğe geç

pnpm 11.26

· 5 dakikalık okuma
Zoltan Kochan
Lead maintainer of pnpm

pnpm 11.26 brings the JavaScript CLI level with what pnpm 12 gained over the past two weeks: workspace: ranges in catalogs, the supply-chain flags on remove and update, pnpm change check for CI, and pnpm deploy without injected dependencies.

Minor Changes

Catalogs can hold a workspace: range

A catalog entry may now be a workspace: range, so the version a workspace dependency is linked by lives in pnpm-workspace.yaml with every other version:

pnpm-workspace.yaml
catalog:
'@example/utils': workspace:^

Both protocols are replaced on publish.

Supply-chain flags on remove and update

pnpm remove and pnpm update accept --trust-lockfile, --no-trust-lockfile, --trust-policy, --trust-policy-exclude, and --trust-policy-ignore-after. pnpm remove checks the whole lockfile against the active policies unless --trust-lockfile is set, because removing a package rewrites it.

pnpm change check

pnpm change check validates the versions already committed in the workspace against the versioning.epics bands and versioning.fixed groups, without reading any change intent. That makes it the step to run on every pull request: a version that drifted out of its band is caught where it was introduced rather than at release time, and every violation is listed at once.

pnpm deploy without injected dependencies

pnpm deploy no longer requires injectWorkspacePackages. Where a workspace dependency's peer has more than one possible version in the deployed graph the binding is ambiguous, and the deploy fails with ERR_PNPM_DEPLOY_AMBIGUOUS_PEER naming the conflicting versions. Pin the peer with overrides to deploy without injection (#9386).

Build approval before the package is installed

pnpm add --allow-build=!<pkg> now denies a build rather than dropping the decision, global installs included. Previously pnpm add -g left the package undecided, so the post-install prompt offered the very build you had just rejected.

pnpm approve-builds <pkg> and pnpm approve-builds !<pkg> also save a decision when nothing is awaiting approval, warning about a package that is not awaiting one instead of erroring out (#14067).

Other changes

  • Fetch and tarball errors and retry logs hide URL credentials, query strings, and fragments that could expose secrets.
  • pnpm audit excludes ignored advisories from the vulnerability totals and severity counts, and reports them separately (#14535). --fix works without a value and when another flag follows it, and --fix=override respects saveExact and savePrefix (#13261, #11523).
  • pnpm install accepts a symlinked lockfile again when config dependencies are unchanged, the arrangement Bazel and Nix use. Writes through a symlinked lockfile stay blocked, and a lockfile with a byte order mark survives a config dependency update (#14372).
  • pnpm install relinks workspace packages when publishConfig.linkDirectory changes; a frozen install asks for the lockfile to be regenerated (#14488).
  • pnpm install --node-linker=hoisted no longer downloads skipped optional dependencies when node_modules already exists (#14139).
  • An auto-installed optional peer satisfies its declared range even when the workspace root uses a version outside it (#13867).
  • The JavaScript pnpm can again switch to a project's pinned pnpm version on a host with no matching native binary. Where a version requires an unavailable binary, the error names the unsupported host (#13622).
  • pnpm self-update, pnpm with, and automatic version switching no longer wait through registry retries when a configured registry has no signatures and registry.npmjs.org is unavailable (#14483).
  • Node.js downloads from nodeDownloadMirrors carry the URL-scoped npm credentials, bearer tokens, basic auth, and tokenHelper included (#14334).
  • Relative scriptShell paths resolve from the workspace root; a bare command name such as bash still goes through PATH (#14422).
  • Argument forwarding on Windows with shellEmulator preserves trailing backslashes, line breaks, and literal shell expressions (#14548).
  • pnpm import preserves the project-local lockfile when lockfileDir points elsewhere, and restores the destination lockfile on failure (#14563).
  • catalogMode and --save-catalog no longer move local paths, tarballs, or workspace:<path> specifiers into catalogs (#14437).
  • --side-effects-cache, --no-side-effects-cache, and PNPM_CONFIG_SIDE_EFFECTS_CACHE toggle only the local cache, leaving a remote cache configured in sideEffectsCache in place.
  • pnpm unpublish handles a registry's two-factor challenge through web authentication or a one-time password prompt (#14464).
  • pnpm outdated and pnpm update follow GitHub Actions referenced with the self-repository syntax, uses: $/.github/actions/setup.
  • pnpm remove accepts --unsafe-perm.

For the complete list of changes, see the v11.26.0 release notes.