Files
pnpm/pnpr
Zoltan Kochan 62bb228e46 fix(package-manager): keep catalog: reference and operator on update --latest (#12423)
pacquet update --latest only handled catalog: dependencies under the
strict/prefer catalogMode. Under the default manual mode the catalog
reconciliation was skipped entirely, so the resolved version was written
straight into package.json, destroying the catalog: reference (and the
catalog entry was left stale).

Handle a --latest bump of a catalog: dependency for every catalogMode:
keep the catalog: reference in the manifest and rewrite the catalog
entry in pnpm-workspace.yaml, preserving the entry's own range operator
(via which_version_is_pinned on the catalog specifier, mirroring pnpm
substituting the catalog spec into the bareSpecifier before calcRange).

The effective catalogs are read lazily (ensure_catalog_ctx), preferring a
post-updateConfig pnpmfile hook output (config.catalogs) over the on-disk
pnpm-workspace.yaml read, matching Install::run; only read when a catalog:
dependency is actually bumped or a non-manual catalogMode needs
reconciliation, so no-op paths (a compatible bump, an unmatched --latest
selector) never touch the catalogs.

Add an in-memory catalogs_override to Install so --no-save still bumps the
lockfile for a catalog: dependency: the merged catalogs drive resolution
without being persisted to disk, matching how a non-catalog --no-save
update updates the lockfile.

Verified against pnpm 11.7.0: update --latest on a catalog: dep keeps the
reference and bumps the entry with its operator preserved (~1.0.0 ->
~3.0.1), regardless of catalogMode.
2026-06-15 15:16:28 +02:00
..
2026-06-15 08:37:08 +02:00