{{ message }}
fix(query): report logical dep location under linked strategy#9656
Merged
owlstronaut merged 1 commit intoJun 25, 2026
Merged
Conversation
Under install-strategy=linked, npm query reported a direct dependency at its node_modules/.store/<key>/node_modules/<pkg> backing path instead of the logical node_modules/<pkg> location. A store-backing node matched as a direct child of root in hasParent (its top-level symlink is parented at root), and the query command read node.target.location. Skip store-backing nodes in the linksIn parent check so only the logical Link matches, and report the logical link location for store-backed deps while keeping transitive deps at their canonical store key.
7aad686 to
6abcb1f
Compare
owlstronaut
approved these changes
Jun 25, 2026
Contributor
This was referenced Jun 25, 2026
owlstronaut
pushed a commit
that referenced
this pull request
Jun 25, 2026
Backport of #9656 to `release/v11`. Co-authored-by: Manzoor Wani <manzoorwani.jk@gmail.com>
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.

In continuation of our exploration of using
install-strategy=linkedin the Gutenberg monorepo, which powers the WordPress Block Editor.Under
install-strategy=linked,npm query ':root > *'reported a direct dependency at itsnode_modules/.store/<key>/node_modules/<pkg>backing path instead of the logicalnode_modules/<pkg>location, diverging from the hoisted strategy.There are two root causes.
In
hasParent(query-selector-all.js), a store-backing node isisTop, hasresolveParent === root, and has a top-level symlink whose parent is root, so it matched as a direct child of root through thelinksInlogical-parent block that exists for workspaces.This returned the store node alongside its logical
Link.In the
querycommand,QuerySelectorItemreadnode.target.location, which for a linked dep resolves to the store node.The fix skips store-backing nodes in the
linksInparent check, so a store node is reached only through its logicalLink(matched via theedgesInbranch) rather than as a direct child of root.The
querycommand now reports the node's own logicallocation/pathwhen the target is in the store, while workspaces and regular nodes keep the target location (for examplepackages/<ws>).Deduplication now keys on the target's physical location and ranks competing representations of the same package, so a top-level placement wins over the canonical store node, which wins over an internal store symlink.
This keeps direct deps logical and transitive deps at their canonical store key for selectors such as
:root *, and leaves the hoisted strategy unchanged.References
Fixes #9617