Skip to content

Pseudo-class Selectors

Pseudo-class selectors are functional selectors that accept arguments to filter packages. They work similarly to CSS pseudo-classes but operate on dependency graph nodes.

Available pseudo-class selectors

Quick reference

SelectorDescriptionExample
:attr()Nested property match:attr(engines, [node])
:dist()By registry dist-tag:dist(latest)
:has()Has matching descendants:has(.peer[name=react])
:host()Switch graph context:host(local) :malware
:is()Match any in list:is([name=a], [name=b])
:not()Negation:not([license=MIT])
:outdated()Newer version exists:outdated(major)
:published()By publish date:published(">2024")
:semver()Semver comparison:semver(^1.0.0)
:spec()By specifier string:spec(^1.0.0)
:path()By file path:path("packages/**")
:type()By package type:type(git)
:diff()Changed files:diff(main)
:hostname()By upstream hostname:hostname(github.com)
:registry()By registry name:registry(npm)

See also