UNPKG

1.93 kBTypeScriptView Raw
1import * as graphlib from '../graphlib';
2import * as types from './types';
3export { DepGraphImpl };
4declare type NodeId = string;
5declare type PkgId = string;
6declare class DepGraphImpl implements types.DepGraphInternal {
7 private _graph;
8 private _rootNodeId;
9 private _pkgs;
10 private _pkgNodes;
11 private _pkgManager;
12 static SCHEMA_VERSION: string;
13 static getPkgId(pkg: types.Pkg): string;
14 private _pkgList;
15 private _depPkgsList;
16 private _rootPkgId;
17 private _countNodePathsToRootCache;
18 private _hasCycles;
19 constructor(_graph: graphlib.Graph, _rootNodeId: NodeId, _pkgs: Record<PkgId, types.PkgInfo>, _pkgNodes: Record<PkgId, Set<NodeId>>, _pkgManager: types.PkgManager);
20 get pkgManager(): types.PkgManager;
21 get rootPkg(): types.PkgInfo;
22 get rootNodeId(): string;
23 /**
24 * Get all unique packages in the graph (including the root package)
25 */
26 getPkgs(): types.PkgInfo[];
27 /**
28 * Get all unique packages in the graph (excluding the root package)
29 */
30 getDepPkgs(): types.PkgInfo[];
31 getPkgNodes(pkg: types.Pkg): types.Node[];
32 getNode(nodeId: string): types.NodeInfo;
33 getNodePkg(nodeId: string): types.PkgInfo;
34 getPkgNodeIds(pkg: types.Pkg): string[];
35 getNodeDepsNodeIds(nodeId: string): string[];
36 getNodeParentsNodeIds(nodeId: string): string[];
37 hasCycles(): boolean;
38 pkgPathsToRoot(pkg: types.Pkg): types.PkgInfo[][];
39 countPathsToRoot(pkg: types.Pkg): number;
40 equals(other: types.DepGraph, { compareRoot }?: {
41 compareRoot?: boolean;
42 }): boolean;
43 directDepsLeadingTo(pkg: types.Pkg): types.PkgInfo[];
44 /**
45 * Create a JSON representation of a dep graph. This is typically used to
46 * send the dep graph over the wire
47 */
48 toJSON(): types.DepGraphData;
49 private nodeEquals;
50 private getGraphNode;
51 private pathsFromNodeToRoot;
52 private countNodePathsToRoot;
53}