Files
pnpm/installing
Eyal Mizrachi fa1f9156af refactor(lockfile.utils): extract peer-variant resolution helper, apply to all readers
The inherit/synthesize logic for peer-variant snapshots (which legally omit
`resolution` because they inherit it from the base entry) was previously
inlined in `buildGraphFromPackages` and `createDeployFiles`. Auditing every
caller of `pkgSnapshotToResolution` surfaced four more iteration sites that
dereference `pkgSnapshot.resolution` directly on a raw `lockfile.packages`
entry and therefore had the same latent crash:

  - `lockfileToHoistedDepGraph` — `pnpm install --node-linker=hoisted`
  - `collectSbomComponents` — `pnpm sbom`
  - `getPkgInfo` — `pnpm list` / tree view
  - (graph-builder + createDeployFiles, already fixed inline)

Extract the inherit/synthesize logic into a new exported helper in
`@pnpm/lockfile.utils` and call it at every iteration site. Downstream
code paths — `pkgSnapshotToResolution`, `convertPackageSnapshot`,
`'directory' in resolution`, `'integrity' in resolution` — now all see a
fully-formed snapshot regardless of which command entered the loop.

The synthesize-from-`file:` fallback (covers pruned lockfiles, e.g.
`turbo prune --docker` keeping only the variant entry) is now documented
in the helper to discourage future readers from widening it to other
`file:` shapes (`file:./local-tarball.tgz` etc., which reach a different
code path).

Unit tests for the helper added in `lockfile/utils/test/`. The existing
fixture-based regression test in `installing/deps-restorer/test/index.ts`
continues to cover the install-path end-to-end.
2026-05-15 05:10:21 -04:00
..
2026-05-14 13:31:53 +02:00
2026-05-14 13:31:53 +02:00
2026-05-14 13:31:53 +02:00
2026-05-11 19:56:10 +02:00
2026-05-14 13:31:53 +02:00
2026-05-14 13:31:53 +02:00
2026-05-14 13:31:53 +02:00
2026-05-11 19:56:10 +02:00
2026-05-14 13:31:53 +02:00