Skip to content

Dependency Selector Syntax

The vlt query syntax enables usage of CSS-selector-like strings to filter and select packages in your dependency graph.

Terminal
$ vlt query ':root > [name^=@vltpkg]'

Many of the common elements of the CSS language are available, notably:

  • * Universal selector — matches all selected items.
  • & Nesting selector — allows for nesting selectors.
  • {} Curly braces — when querying, can be used to nest selectors.

Quick Reference

CategoryExamplesDescription
Attribute Selectors[name=foo], [version^=2]Match by package.json metadata
Combinators>, , ~Traverse the dependency graph
ID Selectors#fooShortcut for [name=foo]
Pseudo-class Selectors:has(), :outdated(), :semver()Functional selectors with arguments
Pseudo-state Selectors:root, :workspace, :devState-based selectors
Security Insights:malware, :cve(), :license()Security data from Socket

Selector Categories

Examples

Find all outdated direct dependencies:

Terminal
$ vlt query ':root > :outdated'

Find all packages that depend on a vulnerable package:

Terminal
$ vlt query ':has(> :cve(*))'

Find all dev-only dependencies that use eval:

Terminal
$ vlt query ':dev:eval'

Combine multiple selectors:

Terminal
$ vlt query ':workspace > :type(git), :root > :outdated(major)'