mirror of
https://github.com/pnpm/pnpm.git
synced 2026-06-28 01:45:30 -04:00
On the exact-version disk fast path in pickPackage(), promote the parsed packument into the in-memory metaCache so later resolutions of the same package in one install skip the disk read and parse. In large monorepos this brings adding a package down from minutes to seconds. The in-memory cache key is now registry-qualified via a shared getPkgMetaCacheKey(registry, name, fullMetadata) helper. Previously the key was only the package name (plus a `:full` suffix) while the on-disk mirror was registry-qualified, so a package of the same name served by two registries in one install could share one cache slot and resolve the wrong tarball/integrity. The registry is threaded through createNpmResolutionVerifier's shared-meta reads (readSharedMeta / readSharedMetaForTrust), which already noted that a registry-qualified read required the resolver's metaCache key shape to change first. Added a regression test that resolves the same package name from two registries and asserts each gets its own tarball. The Rust pacquet port already implements both behaviors (registry-scoped cache key and disk-fast-path cache population), so no port is required. --------- Co-authored-by: Zoltan Kochan <z@kochan.io>