diff --git a/docs/content/using-npm/dependency-selectors.md b/docs/content/using-npm/dependency-selectors.md index 45febf7cc7300..c96057c798ef5 100644 --- a/docs/content/using-npm/dependency-selectors.md +++ b/docs/content/using-npm/dependency-selectors.md @@ -54,7 +54,7 @@ The [`npm query`](/commands/npm-query) commmand exposes a new dependency selecto - [`:private`](https://docs.npmjs.com/cli/v8/configuring-npm/package-json#private) when a dependency is private - `:link` when a dependency is linked (for instance, workspaces or packages manually [`linked`](https://docs.npmjs.com/cli/v8/commands/npm-link) - `:deduped` when a dependency has been deduped (note that this does *not* always mean the dependency has been hoisted to the root of node_modules) -- `:override` when a dependency is an override (not implemented yet) +- `:overridden` when a dependency has been overridden - `:extraneous` when a dependency exists but is not defined as a dependency of any node - `:invalid` when a dependency version is out of its ancestors specified range - `:missing` when a dependency is not found on disk diff --git a/lib/commands/query.js b/lib/commands/query.js index 60294acaf4a68..231329b19b5c8 100644 --- a/lib/commands/query.js +++ b/lib/commands/query.js @@ -20,6 +20,7 @@ class QuerySelectorItem { this.dev = node.target.dev this.inBundle = node.target.inBundle this.deduped = this.from.length > 1 + this.overridden = node.overridden for (const edge of node.target.edgesIn) { this.from.push(edge.from.location) } diff --git a/tap-snapshots/test/lib/commands/query.js.test.cjs b/tap-snapshots/test/lib/commands/query.js.test.cjs index 0a2aa769ee638..d827b62eef740 100644 --- a/tap-snapshots/test/lib/commands/query.js.test.cjs +++ b/tap-snapshots/test/lib/commands/query.js.test.cjs @@ -22,7 +22,8 @@ exports[`test/lib/commands/query.js TAP global > should return global package 1` "to": [], "dev": false, "inBundle": false, - "deduped": false + "deduped": false, + "overridden": false } ] ` @@ -51,7 +52,8 @@ exports[`test/lib/commands/query.js TAP include-workspace-root > should return w ], "dev": false, "inBundle": false, - "deduped": false + "deduped": false, + "overridden": false }, { "name": "c", @@ -66,7 +68,8 @@ exports[`test/lib/commands/query.js TAP include-workspace-root > should return w "to": [], "dev": false, "inBundle": false, - "deduped": false + "deduped": false, + "overridden": false } ] ` @@ -86,7 +89,8 @@ exports[`test/lib/commands/query.js TAP linked node > should return linked node "to": [], "dev": false, "inBundle": false, - "deduped": false + "deduped": false, + "overridden": false } ] ` @@ -111,7 +115,8 @@ exports[`test/lib/commands/query.js TAP recursive tree > should return everythin ], "dev": false, "inBundle": false, - "deduped": false + "deduped": false, + "overridden": false }, { "pkgid": "a@", @@ -125,7 +130,8 @@ exports[`test/lib/commands/query.js TAP recursive tree > should return everythin "to": [], "dev": false, "inBundle": false, - "deduped": false + "deduped": false, + "overridden": false }, { "pkgid": "b@", @@ -139,7 +145,8 @@ exports[`test/lib/commands/query.js TAP recursive tree > should return everythin "to": [], "dev": false, "inBundle": false, - "deduped": false + "deduped": false, + "overridden": false } ] ` @@ -167,7 +174,8 @@ exports[`test/lib/commands/query.js TAP simple query > should return root object ], "dev": false, "inBundle": false, - "deduped": false + "deduped": false, + "overridden": false }, { "pkgid": "a@", @@ -181,7 +189,8 @@ exports[`test/lib/commands/query.js TAP simple query > should return root object "to": [], "dev": false, "inBundle": false, - "deduped": false + "deduped": false, + "overridden": false }, { "pkgid": "b@", @@ -195,7 +204,8 @@ exports[`test/lib/commands/query.js TAP simple query > should return root object "to": [], "dev": false, "inBundle": false, - "deduped": false + "deduped": false, + "overridden": false } ] ` @@ -215,7 +225,8 @@ exports[`test/lib/commands/query.js TAP workspace query > should return workspac "to": [], "dev": false, "inBundle": false, - "deduped": false + "deduped": false, + "overridden": false } ] `