ID Selectors
ID selectors are a shorthand for selecting packages by name. They work like CSS ID selectors but match the name a package is installed under.
Syntax
#package-nameMatches the name a dependency is installed under, usually the same as
[name=package-name]. With an alias like "ab": "npm:abbrev@2.0.0",
#ab selects abbrev; a package installed under several names
matches each.
Examples
Select a package by name:
$ vlt query '#react'This is the same as:
$ vlt query '[name=react]'Combining with combinators
Find all dependencies of react:
$ vlt query '#react > *'Find direct deps that have react as a sibling:
$ vlt query '#react ~ *'Combining with pseudo-classes
Check if a specific package is outdated:
$ vlt query '#typescript:outdated'When to use attribute selectors instead
Use [name=value] instead of #value when:
- The package is scoped:
[name=@vltpkg/cli] - You need partial matching:
[name^=react](starts with "react") - You need case-insensitive matching:
[name=React i]
See also
- Attribute Selectors — full attribute matching syntax