fix: update unscoped package storage location in virtual global store (#10363)

This commit is contained in:
Zoltan Kochan
2025-12-25 21:13:41 +01:00
parent 8ec7939657
commit afb8a3d635
2 changed files with 11 additions and 1 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/calc-dep-state": major
"pnpm": minor
---
**Semi-breaking.** Changed the location of unscoped packages in the virtual global store. They will now be stored under a directory named `@` to maintain a uniform 4-level directory depth.

View File

@@ -107,8 +107,12 @@ export function * iterateHashedGraphNodes<T extends PkgMeta> (
deps: _calcDepGraphHash(new Set(), depPath),
}
const hexDigest = hashObjectWithoutSorting(state, { encoding: 'hex' })
// Use @/ prefix for unscoped packages to maintain uniform 4-level directory depth
// Scoped: @scope/pkg/version/hash
// Unscoped: @/pkg/version/hash
const prefix = name.startsWith('@') ? '' : '@/'
yield {
hash: `${name}/${version}/${hexDigest}`,
hash: `${prefix}${name}/${version}/${hexDigest}`,
pkgMeta,
}
}