-
-
Notifications
You must be signed in to change notification settings - Fork 936
/
index.ts
120 lines (106 loc) · 2.61 KB
/
index.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
115
116
117
118
119
120
import { type DependenciesMeta, type PatchFile } from '@pnpm/types'
export type { PatchFile }
export interface LockfileSettings {
autoInstallPeers?: boolean
excludeLinksFromLockfile?: boolean
}
export interface Lockfile {
importers: Record<string, ProjectSnapshot>
lockfileVersion: number | string
time?: Record<string, string>
packages?: PackageSnapshots
neverBuiltDependencies?: string[]
onlyBuiltDependencies?: string[]
overrides?: Record<string, string>
packageExtensionsChecksum?: string
patchedDependencies?: Record<string, PatchFile>
settings?: LockfileSettings
}
export interface ProjectSnapshot {
specifiers: ResolvedDependencies
dependencies?: ResolvedDependencies
optionalDependencies?: ResolvedDependencies
devDependencies?: ResolvedDependencies
dependenciesMeta?: DependenciesMeta
publishDirectory?: string
}
export interface PackageSnapshots {
[packagePath: string]: PackageSnapshot
}
/**
* tarball hosted remotely
*/
export interface TarballResolution {
type?: undefined
tarball: string
integrity?: string
// needed in some cases to get the auth token
// sometimes the tarball URL is under a different path
// and the auth token is specified for the registry only
registry?: string
}
/**
* directory on a file system
*/
export interface DirectoryResolution {
type: 'directory'
directory: string
}
/**
* Git repository
*/
export interface GitRepositoryResolution {
type: 'git'
repo: string
commit: string
}
export type Resolution =
TarballResolution |
GitRepositoryResolution |
DirectoryResolution
export type LockfileResolution = Resolution | {
integrity: string
}
export interface PackageSnapshot {
id?: string
dev?: true | false
optional?: true
requiresBuild?: true
patched?: true
prepare?: true
hasBin?: true
// name and version are only needed
// for packages that are hosted not in the npm registry
name?: string
version?: string
resolution: LockfileResolution
dependencies?: ResolvedDependencies
optionalDependencies?: ResolvedDependencies
peerDependencies?: {
[name: string]: string
}
peerDependenciesMeta?: {
[name: string]: {
optional: true
}
}
transitivePeerDependencies?: string[]
bundledDependencies?: string[]
engines?: Record<string, string> & {
node: string
}
os?: string[]
cpu?: string[]
libc?: string[]
deprecated?: string
}
export interface Dependencies {
[name: string]: string
}
export type PackageBin = string | { [name: string]: string }
/** @example
* {
* "foo": "registry.npmjs.org/foo/1.0.1"
* }
*/
export type ResolvedDependencies = Record<string, string>