UNPKG

1.99 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
4 * This code may only be used under the BSD style license found at
5 * http://polymer.github.io/LICENSE.txt
6 * The complete set of authors may be found at
7 * http://polymer.github.io/AUTHORS.txt
8 * The complete set of contributors may be found at
9 * http://polymer.github.io/CONTRIBUTORS.txt
10 * Code distributed by Google as part of the polymer project is also
11 * subject to an additional IP rights grant found at
12 * http://polymer.github.io/PATENTS.txt
13 */
14import { ResolvedUrl } from '../model/url';
15/**
16 * Maintains bidirectional indexes of the dependency graph, for quick querying.
17 */
18export declare class DependencyGraph {
19 private _documents;
20 constructor(from?: DependencyGraph);
21 private _getRecordFor;
22 /**
23 * Add dependencies of the given path.
24 *
25 * @param url The url of a document.
26 * @param newDependencies The paths of that document's direct dependencies.
27 */
28 addDocument(url: ResolvedUrl, dependencies: Iterable<ResolvedUrl>): void;
29 rejectDocument(url: ResolvedUrl, error: Error): void;
30 /**
31 * Returns a Promise that resolves when the given document and all
32 * of its transitive dependencies have been resolved or rejected. This
33 * Promise never rejects, if the document or any dependencies are rejected,
34 * the Promise still resolves.
35 */
36 whenReady(url: ResolvedUrl): Promise<void>;
37 private _whenReady;
38 /**
39 * Returns a fork of this graph without the documents at the given paths.
40 */
41 invalidatePaths(paths: ResolvedUrl[]): DependencyGraph;
42 /**
43 * Returns the set of transitive dependencies on the given path.
44 *
45 * So if A depends on B which depends on C, then getAllDependentsOf(C) will
46 * be Set([A,B]), and getAllDependantsOf(B) will be Set([A]).
47 */
48 getAllDependantsOf(path: ResolvedUrl): Set<ResolvedUrl>;
49 private _getAllDependantsOf;
50 toString(): string;
51}