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
  • See also
  1. Client
  2. /
  3. Selectors
  4. /
  5. Pseudo-classes
  6. /
  7. :hostname()

:hostname()

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

Syntax

Text
: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 github → github.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.)

Previous:diff()Next:registry()

On this page

  • Syntax
  • Parameters
  • How it works
  • Examples
  • 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