fix(nm): prefer direct dependency binaries#7216
Open
ychampion wants to merge 1 commit into
Open
Conversation
Constraint: Preserve stable traversal order while preventing transitive bin overwrites. Confidence: high Scope-risk: narrow Tested: node-modules acceptance tests; yarn test:lint; yarn typecheck:all; yarn constraints; yarn version check Not-tested: Windows-specific shim execution locally
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What's the problem this PR addresses?
Closes #7215.
With the node-modules linker, packages that export the same binary currently overwrite each other in traversal order. A transitive alias can therefore replace a direct dependency binary, as in the TypeScript 6/7 setup where
.bin/tscpoints to@typescript/old.How did you fix it?
Bin collection now keeps the first target for a name, preserving the direct dependency encountered before its transitive dependency.
The regression uses aliased fixture packages and checks both the persisted root bin target and the generated
.binexecutable.Validation
corepack yarn build:clicorepack yarn workspace acceptance-tests test:integration --runTestsByPath "$PWD/packages/acceptance-tests/pkg-tests-specs/sources/node-modules.test.ts" --runInBand(63 passed, 2 platform-specific skipped)corepack yarn test:lintcorepack yarn typecheck:allcorepack yarn constraintscorepack yarn version checkChecklist