1 | /// <amd-module name="@angular/compiler-cli/ngcc/src/execution/tasks/utils" />
|
---|
2 | /**
|
---|
3 | * @license
|
---|
4 | * Copyright Google LLC All Rights Reserved.
|
---|
5 | *
|
---|
6 | * Use of this source code is governed by an MIT-style license that can be
|
---|
7 | * found in the LICENSE file at https://angular.io/license
|
---|
8 | */
|
---|
9 | import { DepGraph } from 'dependency-graph';
|
---|
10 | import { EntryPoint } from '../../packages/entry_point';
|
---|
11 | import { PartiallyOrderedTasks, Task, TaskDependencies } from './api';
|
---|
12 | /** Stringify a task for debugging purposes. */
|
---|
13 | export declare const stringifyTask: (task: Task) => string;
|
---|
14 | /**
|
---|
15 | * Compute a mapping of tasks to the tasks that are dependent on them (if any).
|
---|
16 | *
|
---|
17 | * Task A can depend upon task B, if either:
|
---|
18 | *
|
---|
19 | * * A and B have the same entry-point _and_ B is generating the typings for that entry-point
|
---|
20 | * (i.e. has `processDts: true`).
|
---|
21 | * * A's entry-point depends on B's entry-point _and_ B is also generating typings.
|
---|
22 | *
|
---|
23 | * NOTE: If a task is not generating typings, then it cannot affect anything which depends on its
|
---|
24 | * entry-point, regardless of the dependency graph. To put this another way, only the task
|
---|
25 | * which produces the typings for a dependency needs to have been completed.
|
---|
26 | *
|
---|
27 | * As a performance optimization, we take into account the fact that `tasks` are sorted in such a
|
---|
28 | * way that a task can only depend on earlier tasks (i.e. dependencies always come before
|
---|
29 | * dependents in the list of tasks).
|
---|
30 | *
|
---|
31 | * @param tasks A (partially ordered) list of tasks.
|
---|
32 | * @param graph The dependency graph between entry-points.
|
---|
33 | * @return A map from each task to those tasks directly dependent upon it.
|
---|
34 | */
|
---|
35 | export declare function computeTaskDependencies(tasks: PartiallyOrderedTasks, graph: DepGraph<EntryPoint>): TaskDependencies;
|
---|
36 | export declare function getDependentsSet(map: TaskDependencies, task: Task): Set<Task>;
|
---|
37 | /**
|
---|
38 | * Invert the given mapping of Task dependencies.
|
---|
39 | *
|
---|
40 | * @param dependencies The mapping of tasks to the tasks that depend upon them.
|
---|
41 | * @returns A mapping of tasks to the tasks that they depend upon.
|
---|
42 | */
|
---|
43 | export declare function getBlockedTasks(dependencies: TaskDependencies): Map<Task, Set<Task>>;
|
---|
44 | /**
|
---|
45 | * Sort a list of tasks by priority.
|
---|
46 | *
|
---|
47 | * Priority is determined by the number of other tasks that a task is (transitively) blocking:
|
---|
48 | * The more tasks a task is blocking the higher its priority is, because processing it will
|
---|
49 | * potentially unblock more tasks.
|
---|
50 | *
|
---|
51 | * To keep the behavior predictable, if two tasks block the same number of other tasks, their
|
---|
52 | * relative order in the original `tasks` lists is preserved.
|
---|
53 | *
|
---|
54 | * @param tasks A (partially ordered) list of tasks.
|
---|
55 | * @param dependencies The mapping of tasks to the tasks that depend upon them.
|
---|
56 | * @return The list of tasks sorted by priority.
|
---|
57 | */
|
---|
58 | export declare function sortTasksByPriority(tasks: PartiallyOrderedTasks, dependencies: TaskDependencies): PartiallyOrderedTasks;
|
---|