The :spec() pseudo-class matches edges where the package specifier
(bareSpec) equals the provided value. This filters dependencies by
their exact specification string — i.e., what’s written in
package.json.
Syntax
:spec(<specifier>)Examples
Match by semver range
$ vlt query ':spec(^1.0.0)'Match wildcard dependencies
$ vlt query ':spec("*")'Match catalog dependencies
Find dependencies using the catalog protocol:
$ vlt query ':spec("catalog:")'What gets selected
Given package.json:
{ "dependencies": { "react": "^18.2.0", "lodash": "*", "my-lib": "catalog:" }}| Query | Selected |
|---|---|
:spec(^18.2.0) | react |
:spec("*") | lodash |
:spec("catalog:") | my-lib |
See also
- Attribute Selectors — match resolved version values
:type()— match by dependency type