-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathtypes.ts
114 lines (97 loc) · 2.66 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
import { DepGraph } from '@snyk/dep-graph';
// Common types
export type PackageJsonBase = {
name: string;
version: string;
dependencies?: Record<string, string>;
devDependencies?: Record<string, string>;
optionalDependencies?: Record<string, string>;
peerDependencies?: Record<string, string>;
resolutions?: Record<string, string>;
overrides?: Overrides;
pnpm?: {
overrides?: Overrides;
};
};
export type Overrides = string | { [key: string]: Overrides };
// Form: name@semverId. i.e. depd@~1.1.2 or [email protected]
export type PkgIdentifier = string;
export type NormalisedPkgs = Record<
PkgIdentifier,
{
version: string; // This is resolved version
dependencies: Record<string, string>;
optionalDependencies: Record<string, string>;
}
>;
export type DepGraphBuildOptions = {
includeDevDeps: boolean;
includeOptionalDeps: boolean;
strictOutOfSync: boolean;
includePeerDeps?: boolean;
pruneNpmStrictOutOfSync?: boolean;
};
export type LockFileParseOptions = {
includeOptionalDeps: boolean;
};
export type ProjectParseOptions = DepGraphBuildOptions &
LockFileParseOptions & {
pruneCycles: boolean;
};
export type YarnLockV2WorkspaceArgs = {
isWorkspacePkg: boolean;
isRoot: boolean;
rootResolutions: Record<string, string>;
};
export type YarnLockV2ProjectParseOptions = {
includeDevDeps: boolean;
includeOptionalDeps: boolean;
strictOutOfSync: boolean;
pruneWithinTopLevelDeps: boolean;
};
/*
* This chooses how much we prune:
* - `cycles`: only prunes cycles
* - `withinTopLevelDeps`: prunes everything within a top level dep
* - `none`: does not apply any pruning to the dep graph
*/
export type PruneLevel = 'cycles' | 'withinTopLevelDeps' | 'none';
export type YarnLockV1ProjectParseOptions = {
includeDevDeps: boolean;
includeOptionalDeps: boolean;
includePeerDeps: boolean;
strictOutOfSync: boolean;
pruneLevel: PruneLevel;
};
export type Yarn1DepGraphBuildOptions = {
includeDevDeps: boolean;
includeOptionalDeps: boolean;
includePeerDeps: boolean;
strictOutOfSync: boolean;
pruneWithinTopLevelDeps: boolean;
};
export type PnpmWorkspaceArgs = {
isWorkspace: boolean;
projectsVersionMap: Record<string, PnpmProject>;
};
export type PnpmProject = {
name: string;
version: string;
};
export type PnpmProjectParseOptions = {
includeDevDeps: boolean;
includePeerDeps?: boolean;
includeOptionalDeps: boolean;
strictOutOfSync: boolean;
pruneWithinTopLevelDeps: boolean;
};
type NodePkgManagers = 'npm' | 'yarn' | 'pnpm';
export type ScannedNodeProject = {
packageManager: NodePkgManagers;
targetFile: string;
depGraph: DepGraph;
plugin: {
name: string;
runtime: string;
};
};