A policy matches a dependency by combining selectors from three main sources: the importing file (from), the imported file (to), and the dependency itself (dependency). These selectors use properties from the runtime description of each entity.
Combining Selectors
Properties defined at the policy level and inside allow/disallow effects are combined to build a unique dependency selector. For a policy to match, all combined conditions must be met.
Merging OR conditions (arrays)
When using arrays to define OR conditions, the properties are merged together for each item in the array. For example, a policy can target files that are either a specific element type OR belong to a specific file category.
Merging properties at policy and effect levels
If the same property (e.g., from) is defined at both the policy level and inside allow/disallow, they are merged. The properties inside allow/disallow take precedence.
Merging nested properties
Nested properties like parent, captured, or relationship are merged when defined at both levels.
Warning: Extending nested properties is not supported when using arrays (OR conditions) in the selectors. In such cases, the allow/disallow selector will override the policy-level selector instead of merging with it.
// Example of combining from, to, and dependency
{
from: { element: { type: "component" } },
allow: {
to: { element: { type: "helper" } },
dependency: { kind: "value" }
}
}