You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looks like missing nodes weren't fully fleshed out in arborist, and the query command wasn't nuanced enough to include them (they don't have a location so they all group as one).
diff --git a/lib/commands/query.js b/lib/commands/query.js
index 17a55a446..dfa1356eb 100644
--- a/lib/commands/query.js+++ b/lib/commands/query.js@@ -113,10 +113,12 @@ class Query extends BaseCommand {
// builds a normalized inventory
buildResponse (items) {
for (const node of items) {
- if (!this.#seen.has(node.target.location)) {+ if (!node.target.location || !this.#seen.has(node.target.location)) {
const item = new QuerySelectorItem(node)
this.#response.push(item)
- this.#seen.add(item.location)+ if (node.target.location) {+ this.#seen.add(item.location)+ }
}
}
}
diff --git a/workspaces/arborist/lib/query-selector-all.js b/workspaces/arborist/lib/query-selector-all.js
index ce49201ce..c8ec866f0 100644
--- a/workspaces/arborist/lib/query-selector-all.js+++ b/workspaces/arborist/lib/query-selector-all.js@@ -257,7 +257,12 @@ class Results {
for (const edge of node.edgesOut.values()) {
if (edge.missing) {
const pkg = { name: edge.name, version: edge.spec }
- res.push(new this.#targetNode.constructor({ pkg }))+ const item = new this.#targetNode.constructor({ pkg })+ item.queryContext = {+ missing: true,+ }+ item.edgesIn = new Set([edge])+ res.push(item)
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
npm query *:missing
only return one item when no dependency are installed (for package.json with 2 dependencies and 2 devDependencies).No luck with any combination of selector (.dev,.prod) or pseudo-selector (:root, :scope).
Expected Behavior
I expect all "dependencies not found on disk" to be returned.
Steps To Reproduce
Only the first missing package removed from node_modules is returned.
Environment
The text was updated successfully, but these errors were encountered: