(root: Node<unknown, unknown, any>, source: AnyNode)
| 319 | } |
| 320 | |
| 321 | export function hasUnbound(root: Node<unknown, unknown, any>, source: AnyNode): boolean { |
| 322 | if (source.kind !== "unbound") throw new Error(`Cannot check non-unbound layer node: ${source.name}`) |
| 323 | return walk<boolean>(root, (node, context) => { |
| 324 | if (node === source) return true |
| 325 | return node.dependencies.some(context.visit) |
| 326 | }) |
| 327 | } |
| 328 | |
| 329 | function flatten(node: AnyNode): readonly AnyNode[] { |
| 330 | return node.kind === "group" ? node.dependencies.flatMap(flatten) : [node] |