UNPKG

1.47 kBTypeScriptView Raw
1import * as types from '../core/types';
2export { depTreeToGraph, graphToDepTree, DepTree };
3interface DepTreeDep {
4 name?: string;
5 version?: string;
6 versionProvenance?: types.VersionProvenance;
7 dependencies?: {
8 [depName: string]: DepTreeDep;
9 };
10 labels?: {
11 [key: string]: string | undefined;
12 scope?: 'dev' | 'prod';
13 pruned?: 'cyclic' | 'true';
14 };
15 purl?: string;
16}
17/**
18 * @deprecated Use {@link DepGraph} instead of DepTree. You can construct a
19 * graph with {@link DepGraphBuilder}
20 */
21interface DepTree extends DepTreeDep {
22 type?: string;
23 packageFormatVersion?: string;
24 targetOS?: {
25 name: string;
26 version: string;
27 };
28}
29/**
30 * @deprecated Don't use dep trees as an intermediate step, because they are
31 * large structures, resulting in high memory usage and high CPU costs from
32 * serializing / deserializing. Instead, create a graph directly with
33 * {@link DepGraphBuilder}
34 */
35declare function depTreeToGraph(depTree: DepTree, pkgManagerName: string): Promise<types.DepGraph>;
36export interface GraphToTreeOptions {
37 deduplicateWithinTopLevelDeps: boolean;
38}
39/**
40 * @deprecated Don't use dep trees. You should adapt your code to use graphs,
41 * and enhance the dep-graph library if there is missing functionality from
42 * the graph structure
43 */
44declare function graphToDepTree(depGraphInterface: types.DepGraph, pkgType: string, opts?: GraphToTreeOptions): Promise<DepTree>;