UNPKG

2.05 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, opts?: {
39 limit?: number;
40 }): types.PkgInfo[][];
41 countPathsToRoot(pkg: types.Pkg, opts?: {
42 limit?: number;
43 }): number;
44 isTransitive(pkg: types.Pkg): boolean;
45 equals(other: types.DepGraph, { compareRoot }?: {
46 compareRoot?: boolean;
47 }): boolean;
48 directDepsLeadingTo(pkg: types.Pkg): types.PkgInfo[];
49 /**
50 * Create a JSON representation of a dep graph. This is typically used to
51 * send the dep graph over the wire
52 */
53 toJSON(): types.DepGraphData;
54 private nodeEquals;
55 private getGraphNode;
56 private pathsFromNodeToRoot;
57 private countNodePathsToRoot;
58}