Dependency Selector
The dependency metadata selector matches metadata about the dependency itself — the import kind, the relationship between importer and imported elements, the imported specifiers, and so on. It is the dependency key of a dependency selector:
{ dependency: { /* dependency metadata selector */ } }
All conditions inside the selector are combined with AND; arrays act as OR.
Properties
kind— Matches the dependency kind:"value","type", or"typeof". (<string | string[]>)relationship— Match the relationship between both elements. (<object>)from— What the importer is to the target, for example"parent"when the target is a direct child of the importer. (<string | string[]>)to— What the target is to the importer, for example"child"when the target is a direct child of the importer. (<string | string[]>)
specifiers— Matches the imported or exported specifier names. (<string | string[]>)nodeKind— Matches the dependency node name that produced the dependency. (<string | string[]>)source— Matches the literal source string written in theimport/exportstatement. (<string | string[]>)
Relationship values are: internal, child, descendant, sibling, parent, uncle, nephew, and ancestor. from is always the inverse of to: child and parent invert each other, and so do descendant and ancestor, and uncle and nephew. internal and sibling stay the same on both sides.
// Match type-only dependencies to helpers
{
to: { element: { type: "helper" } },
dependency: { kind: "type" }
}
// Match dependencies whose literal source matches "lodash/*"
{
dependency: { source: "lodash/*" }
}
// Match dependencies to a descendant element
{
dependency: { relationship: { to: "descendant" } }
}
All selector properties are optional. You can match on a single property, or combine several to target a more specific case. Remember that combined properties use AND logic — every one you specify must match.
Next Steps
- Selectors — the entity/dependency model, array queries, captured values, and templating.
- Policies — use
from/to/dependencytogether withallow/disallow. - Classification → Dependency — the runtime dependency metadata the plugin builds.
- Legacy Dependency Metadata Selector Syntax — the deprecated
moduleproperty and how to migrate it.