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
  • Parameters
  • How it works
  • Examples
  • Find packages at their latest version
  • Find packages at a pre-release dist-tag
  • Exclude nightly-tagged packages
  • Find a specific package at a dist-tag
  • Notes
  • See also
  1. Client
  2. /
  3. Selectors
  4. /
  5. Pseudo-classes
  6. /
  7. :dist()

:dist()

The :dist() pseudo-class matches packages whose installed version corresponds to a specific dist-tag in the registry.

Syntax

Text
:dist(<tag>)

Parameters

ParameterDescriptionDefault
tagThe dist-tag name to match against(required)

How it works

When a package is published to a registry, it can be associated with one or more dist-tags (e.g. latest, nightly, beta). The :dist() selector fetches the packument for each installed package and checks whether the node's installed version matches the version pointed to by the given dist-tag.

For example, given a package foo with:

JSON
{
  "dist-tags": {
    "latest": "1.3.0",
    "nightly": "1.2.1"
  }
}
  • If foo@1.3.0 is installed, :dist(latest) will match it.
  • If foo@1.0.0 is installed, :dist(latest) will not match it.

Examples

Find packages at their latest version

Terminal
vlt query ':dist(latest)'

Find packages at a pre-release dist-tag

Terminal
vlt query ':dist(nightly)'

Exclude nightly-tagged packages

Terminal
vlt query ':not(:dist(nightly))'

Find a specific package at a dist-tag

Terminal
vlt query '#foo:dist(latest)'

Notes

  • Only registry packages are matched. File, git, workspace, and remote dependencies are filtered out since they do not have dist-tags.
  • The selector makes network requests to the registry to fetch dist-tag information. Results depend on the current state of the registry.
  • If a dist-tag does not exist for a package, that package will not match.

See also

  • :semver() — match by semver comparison
  • :outdated() — match packages with newer versions available

Previous:has()Next:host()

On this page

  • Syntax
  • Parameters
  • How it works
  • Examples
  • Find packages at their latest version
  • Find packages at a pre-release dist-tag
  • Exclude nightly-tagged packages
  • Find a specific package at a dist-tag
  • Notes
  • 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