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
Copy file name to clipboardexpand all lines: docs/content/using-npm/dependency-selectors.md
+23
Original file line number
Diff line number
Diff line change
@@ -61,6 +61,7 @@ The [`npm query`](/commands/npm-query) commmand exposes a new dependency selecto
61
61
-`:semver(<spec>, [selector], [function])` match a valid [`node-semver`](https://github.com/npm/node-semver) version or range to a selector
62
62
-`:path(<path>)`[glob](https://www.npmjs.com/package/glob) matching based on dependencies path relative to the project
63
63
-`:type(<type>)`[based on currently recognized types](https://github.com/npm/npm-package-arg#result-object)
64
+
-`:outdated(<type>)` when a dependency is outdated
64
65
65
66
##### `:semver(<spec>, [selector], [function])`
66
67
@@ -78,6 +79,28 @@ Some examples:
78
79
-`:semver(16.0.0, :attr(engines, [node]))` returns every node which has an `engines.node` property satisfying the version `16.0.0`
79
80
-`:semver(1.0.0, [version], lt)` every node with a `version` less than `1.0.0`
80
81
82
+
##### `:outdated(<type>)`
83
+
84
+
The `:outdated` pseudo selector retrieves data from the registry and returns information about which of your dependencies are outdated. The type parameter may be one of the following:
85
+
86
+
-`any` (default) a version exists that is greater than the current one
87
+
-`in-range` a version exists that is greater than the current one, and satisfies at least one if its dependents
88
+
-`out-of-range` a version exists that is greater than the current one, does not satisfy at least one of its dependents
89
+
-`major` a version exists that is a semver major greater than the current one
90
+
-`minor` a version exists that is a semver minor greater than the current one
91
+
-`patch` a version exists that is a semver patch greater than the current one
92
+
93
+
In addition to the filtering performed by the pseudo selector, some extra data is added to the resulting objects. The following data can be found under the `queryContext` property of each node.
94
+
95
+
-`versions` an array of every available version of the given node
96
+
-`outdated.inRange` an array of objects, each with a `from` and `versions`, where `from` is the on-disk location of the node that depends on the current node and `versions` is an array of all available versions that satisfies that dependency. This is only populated if `:outdated(in-range)` is used.
97
+
-`outdated.outOfRange` an array of objects, identical in shape to `inRange`, but where the `versions` array is every available version that does not satisfy the dependency. This is only populated if `:outdated(out-of-range)` is used.
98
+
99
+
Some examples:
100
+
101
+
-`:root > :outdated(major)` returns every direct dependency that has a new semver major release
102
+
-`.prod:outdated(in-range)` returns production dependencies that have a new release that satisfies at least one of its edges in
0 commit comments