/
package.ts
141 lines (128 loc) · 3.17 KB
/
package.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
export interface Dependencies {
[name: string]: string
}
export type PackageBin = string | {[commandName: string]: string}
export type PackageScripts = {
[name: string]: string
} & {
prepublish?: string
prepare?: string
prepublishOnly?: string
prepack?: string
postpack?: string
publish?: string
postpublish?: string
preinstall?: string
install?: string
postinstall?: string
preuninstall?: string
uninstall?: string
postuninstall?: string
preversion?: string
version?: string
postversion?: string
pretest?: string
test?: string
posttest?: string
prestop?: string
stop?: string
poststop?: string
prestart?: string
start?: string
poststart?: string
prerestart?: string
restart?: string
postrestart?: string
preshrinkwrap?: string
shrinkwrap?: string
postshrinkwrap?: string
}
export interface PeerDependenciesMeta {
[dependencyName: string]: {
optional?: boolean
}
}
export interface DependenciesMeta {
[dependencyName: string]: {
injected?: boolean
node?: string
patch?: string
}
}
export interface PublishConfig extends Record<string, unknown> {
directory?: string
linkDirectory?: boolean
executableFiles?: string[]
}
type Version = string
type Pattern = string
export interface TypesVersions {
[version: Version]: {
[pattern: Pattern]: string[]
}
}
export interface BaseManifest {
name?: string
version?: string
bin?: PackageBin
description?: string
directories?: {
bin?: string
}
files?: string[]
dependencies?: Dependencies
devDependencies?: Dependencies
optionalDependencies?: Dependencies
peerDependencies?: Dependencies
peerDependenciesMeta?: PeerDependenciesMeta
dependenciesMeta?: DependenciesMeta
bundleDependencies?: string[]
bundledDependencies?: string[]
homepage?: string
repository?: string | { url: string }
scripts?: PackageScripts
config?: object
engines?: {
node?: string
npm?: string
pnpm?: string
}
cpu?: string[]
os?: string[]
libc?: string[]
main?: string
module?: string
typings?: string
types?: string
publishConfig?: PublishConfig
typesVersions?: TypesVersions
readme?: string
keywords?: string[]
author?: string
license?: string
}
export type DependencyManifest = BaseManifest & Required<Pick<BaseManifest, 'name' | 'version'>>
export type PackageExtension = Pick<BaseManifest, 'dependencies' | 'optionalDependencies' | 'peerDependencies' | 'peerDependenciesMeta'>
export interface PeerDependencyRules {
ignoreMissing?: string[]
allowAny?: string[]
allowedVersions?: Record<string, string>
}
export type AllowedDeprecatedVersions = Record<string, string>
export type ProjectManifest = BaseManifest & {
pnpm?: {
neverBuiltDependencies?: string[]
onlyBuiltDependencies?: string[]
overrides?: Record<string, string>
packageExtensions?: Record<string, PackageExtension>
peerDependencyRules?: PeerDependencyRules
allowedDeprecatedVersions?: AllowedDeprecatedVersions
allowNonAppliedPatches?: boolean
patchedDependencies?: Record<string, string>
}
private?: boolean
resolutions?: Record<string, string>
}
export type PackageManifest = DependencyManifest & {
deprecated?: string
}