mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-27 03:21:55 -04:00
Closes #11035 ## Summary ### Root cause fix: don't apply cached side-effects for unapproved packages When importing packages from the store, side-effects cache was applied for any package not explicitly denied (`allowBuild !== false`). This meant unapproved packages (`allowBuild === undefined`) got cached build artifacts, setting `isBuilt: true` and bypassing the `allowBuild` check in `buildModules`. **Fix:** Only apply side-effects cache when `allowBuild` returns `true` (explicitly approved). Changed in three locations: - `installing/deps-restorer/src/index.ts` (isolated linker) - `installing/deps-restorer/src/linkHoistedModules.ts` (hoisted linker) - `installing/deps-installer/src/install/link.ts` (non-headless install) ### Revocation detection When a package's build approval is revoked between installs (was `true` in `.modules.yaml`, now undefined), detect it in `mutateModules` and add to `ignoredBuilds` so `strictDepBuilds` fails. ### Status messages in `_rebuild` Users now see what happened to each package during rebuild: - `pkg@version: built successfully` - `pkg@version: skipped (no build scripts)` - `pkg@version: skipped (not allowed)` - `pkg@version: reused from store cache` And during install: - `pkg@version: reused from store (side effects cache)` ### `buildSelectedPkgs` fixes - Preserve `storeDir`, `virtualStoreDir`, `virtualStoreDirMaxLength` from existing `.modules.yaml` instead of overwriting with config-derived values (which caused "reinstall from scratch" prompt) - Write `allowBuilds` to `.modules.yaml` so GVS doesn't detect a mismatch on next install - Merge `ignoredBuilds` with existing entries for packages not being rebuilt