Skip to content

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

Syntax

: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:

{
"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