[rush] Add PNPM v10 support: SHA256 hashing for dependencies paths lookup and new 'virtual-store-dir-max-length' #5236
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR solves compatibility issues between Rush and PNPM v10. In PNPM v10, the hashing algorithm for dependency paths was changed to SHA256, and the default
virtual-store-dir-max-length
was reduced from 120 to 60 characters. These upstream changes caused Rush-based projects using PNPM v10 to fail during the linking stage, with errors such as:This update enables Rush to correctly support PNPM v10 by updating its dependency on @pnpm/dependency-path and by adjusting logic to account for the new default max-length value.
Fixes #5235
How was the problem solved?
Updated the rush-lib dependencies to include the latest
@pnpm/dependency-path
package that uses SHA256 hashing, which is required for PNPM v10.Modified PnpmLinkManager to detect PNPM v10 and use the updated hashing and the new default
virtual-store-dir-max-length
(60), while retaining existing logic for PNPM v9 (using 120).The code dynamically imports the correct version of @pnpm/dependency-path based on the detected PNPM major version.
Scope of the solution:
This change fully solves the issue for both PNPM v9 and v10
Backwards compatibility:
This change is backwards compatible. The logic for PNPM v9 is unchanged, and new logic is only applied for PNPM v10 and above.
Performance impact:
No performance regressions are expected; the code path remains similar, only adapting to new PNPM requirements.
Testing
Manual testing was performed on the final commit. I ran the following commands on our production monorepo with both PNPM v10 and PNPM v9 to verify correct behavior and ensure no regressions:
rush update
rush install
rush build
All works good, and no new issues were observed.