import type { Target } from "./types/Target.js"; import type { TargetGraph } from "./types/TargetGraph.js"; /** * Target graph builder * * This class purely deals with the graph structure of targets. Here are the scope of the responsibilities: * 1. add new target * 2. add new dependency * 3. detect cycles * 4. prioritize targets * 5. build sub-graph * 6. build target graph * * This class does not deal with: * 1. converting target definition into targets * 2. expanding dependency specs * 3. resolving package paths, etc. * * Example usage: * ```js * const targetFactory = new TargetFactor({...}); * * const target1 = targetFactory.createPackageTarget("foo", "build", { ... }); * const target2 = targetFactory.createPackageTarget("bar", "build", { ... }); * * const builder = new TargetGraphBuilder(); * builder.addTarget(target1); * builder.addTarget(target2); * builder.addDependency(target1, target2); * * // builds a target graph (full graph) * const targetGraph = builder.build(); * * // builds a sub-graph (partial graph starting with target1) * const subGraph = builder.subgraph([target1.id]); * ``` */ export declare class TargetGraphBuilder { /** A map of targets - used internally for looking up generated targets from the target configurations */ readonly targets: Map; /** * Initializes the builder with package infos */ constructor(); addTarget(target: Target): Target; addDependency(dependency: string, dependent: string): void; /** * Builds a target graph for given tasks and packages */ build(): TargetGraph; subgraph(entriesTargetIds: string[]): TargetGraph; }