Skip to content

fix(arborist): exclude store nodes from :root > * in linked strategy#9096

Merged
wraithgar merged 1 commit intonpm:latestfrom
manzoorwanijk:fix/linked-strategy/query-root-children
Mar 10, 2026
Merged

fix(arborist): exclude store nodes from :root > * in linked strategy#9096
wraithgar merged 1 commit intonpm:latestfrom
manzoorwanijk:fix/linked-strategy/query-root-children

Conversation

@manzoorwanijk
Copy link
Contributor

@manzoorwanijk manzoorwanijk commented Mar 10, 2026

In continuation of our exploration of using install-strategy=linked in the Gutenberg monorepo, which powers the WordPress Block Editor.

In linked strategy, npm query ':root > *' returns transitive deps and bare store directory nodes as direct children of root.

The hasParent function treats any isTop node whose resolveParent is root as a direct child. In linked mode, all store nodes are isTop and resolve to root via fsParent, so they all match incorrectly.

The fix tightens this check to only match if the node has a link in linksIn whose parent is the compare node — i.e., there's an actual symlink in the parent's node_modules/.

References

Fixes #9093

@wraithgar wraithgar merged commit 5b7c0cc into npm:latest Mar 10, 2026
17 checks passed
@manzoorwanijk manzoorwanijk deleted the fix/linked-strategy/query-root-children branch March 10, 2026 17:26
manzoorwanijk added a commit to manzoorwanijk/npm-cli that referenced this pull request Mar 10, 2026
@github-actions github-actions bot mentioned this pull request Mar 10, 2026
manzoorwanijk added a commit to manzoorwanijk/npm-cli that referenced this pull request Mar 10, 2026
wraithgar pushed a commit that referenced this pull request Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] linked strategy: npm query ':root > *' returns incorrect results

2 participants