mirror of
https://github.com/pnpm/pnpm.git
synced 2026-07-21 05:02:30 -04:00
Peer-dep variant snapshots in the lockfile (e.g. `pkg@file:packages/pkg(peer@2.0.0)`) inherit their resolution from the base entry and may legally omit `resolution` themselves. The previous code in `buildGraphFromPackages` accessed `pkgSnapshot.resolution` directly with the `in` operator, which crashes with `TypeError: Cannot use 'in' operator to search for 'directory' in undefined` when `resolution` is unset. Guarding the access mirrors the pattern in `@pnpm/deps.graph-hasher`, which already handles missing resolution defensively. A snapshot without `resolution` is treated as "not a directory dep" — the base entry still drives directory-dep detection through its own snapshot.