-
Notifications
You must be signed in to change notification settings - Fork 2.7k
/
Copy pathtypes.js
201 lines (160 loc) · 4.22 KB
/
types.js
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
/* @flow */
import type {RegistryNames} from './registries/index.js';
import type PackageReference from './package-reference.js';
import type PackageRequest from './package-request.js';
import type {FetcherNames} from './fetchers/index.js';
import type {Reporter} from './reporters/index.js';
import type Config from './config.js';
import type {RequestHint} from './constants';
export type CLIFunction = (config: Config, reporter: Reporter, flags: Object, args: Array<string>) => CLIFunctionReturn;
type _CLIFunctionReturn = boolean;
export type CLIFunctionReturn = ?_CLIFunctionReturn | Promise<?_CLIFunctionReturn>;
export type DependencyMeta = {};
export type DependenciesMeta = {
[name: string]: DependencyMeta,
};
export type PeerDependencyMeta = {
optional?: boolean,
};
export type PeerDependenciesMeta = {
[name: string]: PeerDependencyMeta,
};
// dependency request pattern data structure that's used to request dependencies from a
// PackageResolver
export type DependencyRequestPattern = {
pattern: string,
registry: RegistryNames,
optional: boolean,
hint?: ?RequestHint,
parentNames?: Array<string>,
parentRequest?: ?PackageRequest,
workspaceName?: string,
workspaceLoc?: string,
};
export type DependencyRequestPatterns = Array<DependencyRequestPattern>;
// person object, the exploded version of a `maintainers`/`authors` field
export type PersonObject = {
email?: string,
name?: string,
url?: string,
};
// package remote that's used to store how to fetch a package
export type PackageRemote = {
type: FetcherNames,
registry: RegistryNames,
reference: string,
resolved?: ?string,
hash: ?string,
integrity?: ?string,
cacheIntegrity?: ?string,
packageName?: string,
registryRemote?: ?PackageRemote,
};
// `dependencies` field in package info
type Dependencies = {
[key: string]: string,
};
export type WorkspacesConfig = {
packages?: Array<string>,
nohoist?: Array<string>,
};
// package.json
export type Manifest = {
_registry?: ?RegistryNames,
_loc?: ?string,
name: string,
version: string,
private?: boolean,
author?: {
name?: string,
email?: string,
url?: string,
},
homepage?: string,
flat?: boolean,
license?: string,
licenseText?: string,
noticeText?: string,
readme?: string,
readmeFilename?: string,
repository?: {
type: 'git',
url: string,
},
bugs?: {
url: string,
},
// the package reference that we pass around as a minimal way to refer to it
_reference?: ?PackageReference,
// unique identifier to refer to this package by, if it doesn't exist in a registry then
// we need to use this to ensure it's unique
_uid: string,
_remote?: ?PackageRemote,
_resolved?: string,
dist?: {
tarball: string,
shasum: string,
},
directories?: {
man: string,
bin: string,
},
man?: Array<string>,
bin?: {
[name: string]: string,
},
scripts?: {
[name: string]: string,
},
engines?: {
[engineName: string]: string,
},
os?: Array<string>,
cpu?: Array<string>,
dependencies?: Dependencies,
devDependencies?: Dependencies,
peerDependencies?: Dependencies,
optionalDependencies?: Dependencies,
dependenciesMeta?: DependenciesMeta,
peerDependenciesMeta?: PeerDependenciesMeta,
bundleDependencies?: Array<string>,
bundledDependencies?: Array<string>,
installConfig?: {
pnp?: boolean,
},
deprecated?: string,
files?: Array<string>,
main?: string,
workspaces?: Array<string> | WorkspacesConfig,
// This flag is true when we add a new package with `yarn add <mypackage>`.
// We need to preserve the flag because we print a list of new packages in
// the end of the add command
fresh?: boolean,
prebuiltVariants?: {[filename: string]: string},
};
//
export type FetchedMetadata = {
package: Manifest,
hash: string,
dest: string,
cached: boolean,
};
export type FetchedOverride = {
hash: string,
};
// Used by outdated and upgrade-interactive
export type Dependency = {
name: string,
current: string,
wanted: string,
latest: string,
url: string,
hint: ?string,
range: string,
upgradeTo: string,
workspaceName: string,
workspaceLoc: string,
};
export type WorkspacesManifestMap = {
[string]: {loc: string, manifest: Manifest},
};