Skip to content
ClientSelectorspseudo-classes:hostname()

:hostname()

The :hostname() pseudo-class matches packages based on the hostname of the registry or git remote they were fetched from.

Syntax

:hostname(<domain>)

Parameters

ParameterDescription
domainThe hostname to match against (e.g. npm.pkg.github.com)

How it works

The selector extracts the hostname from each package’s source:

  • Registry packages: hostname from the registry URL
  • Git packages: hostname from the git remote (supports named hosts like githubgithub.com)
  • Remote packages: hostname from the tarball URL
  • File/workspace packages: never match (no hostname)

Examples

Find all packages served from the public npm registry:

Terminal
$ vlt query ':hostname(registry.npmjs.org)'

Note that registry nodes are matched against the resolved registry URL. Since vlt has no default registry, a node whose spec carries no registry has no hostname to compare and will not match.

Find packages from GitHub’s package registry:

Terminal
$ vlt query ':hostname(npm.pkg.github.com)'

Find git dependencies hosted on GitHub:

Terminal
$ vlt query ':hostname(github.com)'

Find packages from a custom registry:

Terminal
$ vlt query ':hostname(registry.example.com)'

See also

  • :registry() — match by registry configuration name
  • :type() — match by package type (registry, git, file, etc.)