vlt / docs

  • PricingBenchmarks (opens in new window)Community (opens in new window)Feedback
  • Overview
  • Attribute Selectors
  • Combinators
  • ID Selectors
  • Security Insights
    • Overview
    • :attr()
    • :has()
    • :dist()
    • :host()
    • :is()
    • :not()
    • :outdated()
    • :published()
    • :semver()
    • :spec()
    • :path()
    • :type()
    • :diff()
    • :hostname()
    • :registry()
  • Syntax
  • Examples
  • Match by semver range
  • Match wildcard dependencies
  • Match catalog dependencies
  • What gets selected
  • See also
  1. Client
  2. /
  3. Selectors
  4. /
  5. Pseudo-classes
  6. /
  7. :spec()

:spec()

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

Text
:spec(<specifier>)

Examples

Match by semver range

Terminal
$ vlt query ':spec(^1.0.0)'

Match wildcard dependencies

Terminal
$ vlt query ':spec("*")'

Match catalog dependencies

Find dependencies using the catalog protocol:

Terminal
$ vlt query ':spec("catalog:")'

What gets selected

Given package.json:

JSON
{
  "dependencies": {
    "react": "^18.2.0",
    "lodash": "*",
    "my-lib": "catalog:"
  }
}
QuerySelected
:spec(^18.2.0)react
:spec("*")lodash
:spec("catalog:")my-lib

See also

  • Attribute Selectors — match resolved version values
  • :type() — match by dependency type

Previous:semver()Next:path()

On this page

  • Syntax
  • Examples
  • Match by semver range
  • Match wildcard dependencies
  • Match catalog dependencies
  • What gets selected
  • See also
Edit this page

Deploy your package on vlt.io

Publish scoped and private packages, manage organizations and access, and give every developer and CI environment a consistent source for public and private JavaScript dependencies.

Publish now