-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
package-json.ts
394 lines (347 loc) · 8.48 KB
/
package-json.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
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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
/**
* @file PackageJson
* @module pkg-types/PackageJson
*/
import type {
Bin,
Browser,
Bugs,
Config,
CPU,
Dependencies,
DevDependencies,
Directories,
Engines,
Exports,
Imports,
JsonObject,
JsonValue,
LicenseInfo,
OptionalDependencies,
OS,
PackageManager,
PackageType,
PeerDependencies,
PeerDependenciesMeta,
People,
Person,
PublishConfig,
RepositoryInfo,
Scripts,
SemanticVersion,
TypesVersions,
WorkspacesConfig
} from '@flex-development/pkg-types'
/**
* Package manifest.
*
* > As it concerns optional fields, `null` is used instead of `undefined`, even
* > in fields where `null` may not be allowed by a manifest specification.\
* > This is to better support optional fields, as well as packages that may use
* > this definition. Such packages are expected to handle `null` values.
*
* This interface can be augmented to register custom fields. Field values are
* expected to be compatible with {@linkcode JsonValue}.
*
* @example
* declare module '@flex-development/pkg-types' {
* interface GreaseConfig extends JsonObject {}
*
* interface PackageJson {
* grease?: GreaseConfig | null
* }
* }
*
* @see {@linkcode JsonObject}
* @see https://docs.npmjs.com/cli/configuring-npm/package-json
* @see https://yarnpkg.com/configuration/manifest
*
* @extends {JsonObject}
*/
interface PackageJson extends JsonObject {
/**
* Package id.
*
* Typically of the format `<name>@<version>`.
*
* @see {@linkcode name}
* @see {@linkcode version}
*/
_id?: string | null
/**
* Person who created the package.
*
* @see {@linkcode Person}
*/
author?: Person | string | null
/**
* Executable files to install into `PATH`.
*
* @see {@linkcode Bin}
*/
bin?: Bin | null
/**
* Hint to JavaScript bundlers or component tools when packaging modules for
* client side use.
*
* @see {@linkcode Browser}
*/
browser?: Browser | null
/**
* Issue tracker info.
*
* @see {@linkcode Bugs}
*/
bugs?: Bugs | string | null
/**
* Names of packages that will be bundled when package is published.
*/
bundleDependencies?: string[] | null
/**
* Alias for {@linkcode bundleDependencies}.
*/
bundledDependencies?: string[] | null
/**
* Configuration parameters used in package scripts.
*
* @see {@linkcode Config}
*/
config?: Config | null
/**
* People who contributed to the package.
*
* @see {@linkcode People}
*/
contributors?: People | null
/**
* CPU architectures the package runs on.
*
* @see {@linkcode CPU}
*/
cpu?: CPU[] | null
/**
* Packages required for the package to function properly.
*
* @see {@linkcode Dependencies}
*/
dependencies?: Dependencies | null
/**
* Dependencies used during package development only.
*
* These dependencies are not required for the package to function properly.
*
* @see {@linkcode DevDependencies}
*/
devDependencies?: DevDependencies | null
/**
* Package description.
*/
description?: string | null
/**
* Package structure.
*
* @see {@linkcode Directories}
*/
directories?: Directories | null
/**
* Enforce {@linkcode engines}.
*/
engineStrict?: boolean | null
/**
* Engines the package runs on.
*
* @see {@linkcode Engines}
*/
engines?: Engines | null
/**
* Package entry points.
*
* @see {@linkcode Exports}
*/
exports?: Exports
/**
* Files included in published package, or glob patterns matching included
* files.
*
* @see https://docs.npmjs.com/cli/v9/configuring-npm/package-json#files
* @see https://yarnpkg.com/configuration/manifest#files
*/
files?: string[] | null
/**
* URL to package homepage.
*/
homepage?: string | null
/**
* Private mappings that only apply to import specifiers from within the
* package itself.
*
* @see {@linkcode Imports}
*/
imports?: Imports | null
/**
* Keywords associated with the package.
*/
keywords?: string[] | null
/**
* Package license.
*
* Must be one of the following:
*
* - A valid [SPDX license identifier][1] if using a standard license
* - A valid [SPDX license expression][2] if using multiple standard licenses
* - A `SEE LICENSE IN <filename>` string that points to a `<filename>` in the
* top level of the package if using a non-standard license
* - An `UNLICENSED` string to **not** grant others the right to use a private
* or unpublished package under any terms
*
* > 👉 **Note**: Using an Open Source ([OSI-approved][3]) license is
* > encouraged unless there is a specific reason not to.
*
* [1]: https://spdx.org/licenses/
* [2]: https://spdx.github.io/spdx-spec/v2-draft/SPDX-license-expressions/
* [3]: https://opensource.org/licenses/alphabetical
*/
license?: string | null
/**
* Package licenses.
*
* @see {@linkcode LicenseInfo}
*/
licenses?: LicenseInfo[] | null
/**
* Module id of primary entry point to package.
*/
main?: string | null
/**
* People who maintain the package.
*
* @see {@linkcode People}
*/
maintainers?: People | null
/**
* Filenames to put in place for the `man` program to find.
*/
man?: string[] | string | null
/**
* ECMAScript module id of primary entry point to package.
*/
module?: string | null
/**
* Package name.
*
* Rules:
*
* - Must be `<= 214 characters` (includes scope for scoped packages)
* - Scoped package names can begin with a dot or an underscore; this is
* not permitted for names without a scope
* - Cannot contain uppercase letters
* - Cannot contain any non-URL-safe characters
*/
name?: string | null
/**
* Dependencies that are skipped if they fail to install.
*
* @see {@linkcode OptionalDependencies}
*/
optionalDependencies?: OptionalDependencies | null
/**
* Operating systems the package runs on.
*
* @see {@linkcode OS}
*/
os?: OS[] | null
/**
* Package manager that is expected to be used when developing the package.
*
* @see {@linkcode PackageManager}
*/
packageManager?: PackageManager | null
/**
* Dependencies that should be installed via package user or another
* dependency.
*
* @see {@linkcode PeerDependencies}
*/
peerDependencies?: PeerDependencies | null
/**
* Map, where each key is a peer dependency, and each value is metadata for
* the dependency.
*
* @see {@linkcode PeerDependenciesMeta}
*/
peerDependenciesMeta?: PeerDependenciesMeta | null
/**
* Prevent package from being published.
*/
private?: boolean | null
/**
* Set of configuration values to use when package is published.
*
* @see {@linkcode PublishConfig}
*/
publishConfig?: PublishConfig | null
/**
* Relative path to `README`.
*/
readme?: string | null
/**
* Source code location.
*
* @see {@linkcode RepositoryInfo}
*/
repository?: RepositoryInfo | string | null
/**
* Package lifecycle scripts.
*
* @see {@linkcode Scripts}
*/
scripts?: Scripts | null
/**
* Boolean indicating if package has side-effects, or an array of relative
* paths to files that have side-effects. These files should not be removed
* if tree shaking (dead code removal) is performed on the package.
*
* A "side effect" is defined as code that performs a special behavior when
* imported, other than exposing one or more exports (i.e. polyfills, which
* affect the global scope and usually do not provide an export).
*/
sideEffects?: string[] | boolean | null
/**
* Module format used by Node.js when `.js` files are imported from the
* package.
*
* @see {@linkcode PackageType}
*/
type?: PackageType | null
/**
* Relative path to TypeScript declaration file for package.
*/
types?: string | null
/**
* TypeScript version selection map.
*
* @see {@linkcode TypesVersions}
*/
typesVersions?: TypesVersions | null
/**
* Alias for {@linkcode types}.
*/
typings?: string | null
/**
* Package version.
*
* Must be parseable by [`node-semver`][semver], which is bundled with npm.
*
* To use standalone, run `npm i -D semver` or `yarn add -D semver`.
*
* [semver]: https://npmjs.com/package/semver
*/
version?: SemanticVersion | null
/**
* Workspaces configuration.
*
* @see {@linkcode WorkspacesConfig}
*/
workspaces?: WorkspacesConfig | string[] | null
}
export type { PackageJson as default }