@stryke/types 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -16
- package/dist/utility-types/base.d.ts +2 -2
- package/dist/utility-types/configuration.d.ts +2 -2
- package/dist/utility-types/file.cjs +1 -6
- package/dist/utility-types/file.d.ts +6 -7
- package/dist/utility-types/file.mjs +1 -1
- package/dist/utility-types/messages.cjs +1 -7
- package/dist/utility-types/messages.d.ts +7 -8
- package/dist/utility-types/messages.mjs +1 -1
- package/dist/utility-types/navigator.d.ts +4 -4
- package/dist/utility-types/object.d.ts +1 -1
- package/dist/utility-types/package-json.d.ts +194 -434
- package/dist/utility-types/package-manager.cjs +2 -12
- package/dist/utility-types/package-manager.d.ts +12 -14
- package/dist/utility-types/package-manager.mjs +1 -1
- package/dist/utility-types/user.cjs +1 -5
- package/dist/utility-types/user.d.ts +5 -6
- package/dist/utility-types/user.mjs +1 -1
- package/package.json +526 -526
|
@@ -1,502 +1,262 @@
|
|
|
1
|
-
import type { StormConfigurationGroups } from "./configuration";
|
|
2
|
-
import type { JsonObject, JsonValue } from "./json";
|
|
3
|
-
import type { LiteralUnion } from "./object";
|
|
4
1
|
/**
|
|
5
|
-
*
|
|
2
|
+
* The `package.json` file is the only required file in a package. It must be located at the root of a package, and can contain the following fields.
|
|
6
3
|
*/
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
* The URL
|
|
4
|
+
export interface PackageJson {
|
|
5
|
+
/**
|
|
6
|
+
* The name is what your thing is called.
|
|
7
|
+
* Some rules:
|
|
8
|
+
* - The name must be less than or equal to 214 characters. This includes the scope for scoped packages.
|
|
9
|
+
* - The name can’t start with a dot or an underscore.
|
|
10
|
+
* - New packages must not have uppercase letters in the name.
|
|
11
|
+
* - The name ends up being part of a URL, an argument on the command line, and a folder name. Therefore, the name can’t contain any non-URL-safe characters.
|
|
15
12
|
*/
|
|
16
|
-
|
|
13
|
+
name?: string;
|
|
17
14
|
/**
|
|
18
|
-
*
|
|
15
|
+
* Version must be parseable by `node-semver`, which is bundled with npm as a dependency. (`npm install semver` to use it yourself.)
|
|
19
16
|
*/
|
|
20
|
-
|
|
21
|
-
};
|
|
22
|
-
export type PackageJsonDirectoryLocations = {
|
|
23
|
-
[directoryType: string]: JsonValue | undefined;
|
|
17
|
+
version?: string;
|
|
24
18
|
/**
|
|
25
|
-
*
|
|
19
|
+
* Put a description in it. It’s a string. This helps people discover your package, as it’s listed in `npm search`.
|
|
26
20
|
*/
|
|
27
|
-
|
|
21
|
+
description?: string;
|
|
28
22
|
/**
|
|
29
|
-
*
|
|
23
|
+
* Put keywords in it. It’s an array of strings. This helps people discover your package as it’s listed in `npm search`.
|
|
30
24
|
*/
|
|
31
|
-
|
|
25
|
+
keywords?: string[];
|
|
32
26
|
/**
|
|
33
|
-
*
|
|
27
|
+
* The url to the project homepage.
|
|
34
28
|
*/
|
|
35
|
-
|
|
29
|
+
homepage?: string;
|
|
36
30
|
/**
|
|
37
|
-
*
|
|
31
|
+
* The url to your project’s issue tracker and / or the email address to which issues should be reported. These are helpful for people who encounter issues with your package.
|
|
38
32
|
*/
|
|
39
|
-
|
|
33
|
+
bugs?: string | {
|
|
34
|
+
url?: string;
|
|
35
|
+
email?: string;
|
|
36
|
+
};
|
|
40
37
|
/**
|
|
41
|
-
*
|
|
38
|
+
* You should specify a license for your package so that people know how they are permitted to use it, and any restrictions you’re placing on it.
|
|
42
39
|
*/
|
|
43
|
-
|
|
40
|
+
license?: string;
|
|
44
41
|
/**
|
|
45
|
-
*
|
|
42
|
+
* Specify the place where your code lives. This is helpful for people who want to contribute. If the git repo is on GitHub, then the `npm docs` command will be able to find you.
|
|
43
|
+
* For GitHub, GitHub gist, Bitbucket, or GitLab repositories you can use the same shortcut syntax you use for npm install:
|
|
46
44
|
*/
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
repository?: string | {
|
|
46
|
+
type: string;
|
|
47
|
+
url: string;
|
|
48
|
+
/**
|
|
49
|
+
* If the `package.json` for your package is not in the root directory (for example if it is part of a monorepo), you can specify the directory in which it lives:
|
|
50
|
+
*/
|
|
51
|
+
directory?: string;
|
|
52
|
+
};
|
|
50
53
|
/**
|
|
51
|
-
*
|
|
54
|
+
* The `scripts` field is a dictionary containing script commands that are run at various times in the lifecycle of your package.
|
|
52
55
|
*/
|
|
53
|
-
|
|
56
|
+
scripts?: Record<string, string>;
|
|
54
57
|
/**
|
|
55
|
-
*
|
|
58
|
+
* If you set `"private": true` in your package.json, then npm will refuse to publish it.
|
|
56
59
|
*/
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
Run **before** the package is prepared and packed, **only** on `npm publish`.
|
|
60
|
-
*/
|
|
61
|
-
prepublishOnly?: string;
|
|
62
|
-
/**
|
|
63
|
-
Run **before** a tarball is packed (on `npm pack`, `npm publish`, and when installing git dependencies).
|
|
64
|
-
*/
|
|
65
|
-
prepack?: string;
|
|
66
|
-
/**
|
|
67
|
-
Run **after** the tarball has been generated and moved to its final destination.
|
|
68
|
-
*/
|
|
69
|
-
postpack?: string;
|
|
70
|
-
/**
|
|
71
|
-
Run **after** the package is published.
|
|
72
|
-
*/
|
|
73
|
-
publish?: string;
|
|
74
|
-
/**
|
|
75
|
-
Run **after** the package is published.
|
|
76
|
-
*/
|
|
77
|
-
postpublish?: string;
|
|
78
|
-
/**
|
|
79
|
-
Run **before** the package is installed.
|
|
80
|
-
*/
|
|
81
|
-
preinstall?: string;
|
|
82
|
-
/**
|
|
83
|
-
Run **after** the package is installed.
|
|
84
|
-
*/
|
|
85
|
-
install?: string;
|
|
86
|
-
/**
|
|
87
|
-
Run **after** the package is installed and after `install`.
|
|
88
|
-
*/
|
|
89
|
-
postinstall?: string;
|
|
90
|
-
/**
|
|
91
|
-
Run **before** the package is uninstalled and before `uninstall`.
|
|
92
|
-
*/
|
|
93
|
-
preuninstall?: string;
|
|
94
|
-
/**
|
|
95
|
-
Run **before** the package is uninstalled.
|
|
96
|
-
*/
|
|
97
|
-
uninstall?: string;
|
|
98
|
-
/**
|
|
99
|
-
Run **after** the package is uninstalled.
|
|
100
|
-
*/
|
|
101
|
-
postuninstall?: string;
|
|
102
|
-
/**
|
|
103
|
-
Run **before** bump the package version and before `version`.
|
|
104
|
-
*/
|
|
105
|
-
preversion?: string;
|
|
106
|
-
/**
|
|
107
|
-
Run **before** bump the package version.
|
|
108
|
-
*/
|
|
109
|
-
version?: string;
|
|
110
|
-
/**
|
|
111
|
-
Run **after** bump the package version.
|
|
112
|
-
*/
|
|
113
|
-
postversion?: string;
|
|
114
|
-
/**
|
|
115
|
-
Run with the `npm test` command, before `test`.
|
|
116
|
-
*/
|
|
117
|
-
pretest?: string;
|
|
118
|
-
/**
|
|
119
|
-
Run with the `npm test` command.
|
|
120
|
-
*/
|
|
121
|
-
test?: string;
|
|
122
|
-
/**
|
|
123
|
-
Run with the `npm test` command, after `test`.
|
|
124
|
-
*/
|
|
125
|
-
posttest?: string;
|
|
126
|
-
/**
|
|
127
|
-
Run with the `npm stop` command, before `stop`.
|
|
128
|
-
*/
|
|
129
|
-
prestop?: string;
|
|
130
|
-
/**
|
|
131
|
-
Run with the `npm stop` command.
|
|
132
|
-
*/
|
|
133
|
-
stop?: string;
|
|
134
|
-
/**
|
|
135
|
-
Run with the `npm stop` command, after `stop`.
|
|
136
|
-
*/
|
|
137
|
-
poststop?: string;
|
|
138
|
-
/**
|
|
139
|
-
Run with the `npm start` command, before `start`.
|
|
140
|
-
*/
|
|
141
|
-
prestart?: string;
|
|
142
|
-
/**
|
|
143
|
-
Run with the `npm start` command.
|
|
144
|
-
*/
|
|
145
|
-
start?: string;
|
|
146
|
-
/**
|
|
147
|
-
Run with the `npm start` command, after `start`.
|
|
148
|
-
*/
|
|
149
|
-
poststart?: string;
|
|
150
|
-
/**
|
|
151
|
-
Run with the `npm restart` command, before `restart`. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided.
|
|
152
|
-
*/
|
|
153
|
-
prerestart?: string;
|
|
154
|
-
/**
|
|
155
|
-
Run with the `npm restart` command. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided.
|
|
156
|
-
*/
|
|
157
|
-
restart?: string;
|
|
158
|
-
/**
|
|
159
|
-
Run with the `npm restart` command, after `restart`. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided.
|
|
160
|
-
*/
|
|
161
|
-
postrestart?: string;
|
|
162
|
-
} & Partial<Record<string, string>>;
|
|
163
|
-
/**
|
|
164
|
-
Dependencies of the package. The version range is a string which has one or more space-separated descriptors. Dependencies can also be identified with a tarball or Git URL.
|
|
165
|
-
*/
|
|
166
|
-
export type PackageJsonDependency = Partial<Record<string, string>>;
|
|
167
|
-
/**
|
|
168
|
-
A mapping of conditions and the paths to which they resolve.
|
|
169
|
-
*/
|
|
170
|
-
type PackageJsonExportConditions = Record<string, null | string | (string | Record<string, any>)[] | Record<string, any>>;
|
|
171
|
-
/**
|
|
172
|
-
Entry points of a module, optionally with conditions and subpath exports.
|
|
173
|
-
*/
|
|
174
|
-
export type PackageJsonExports = null | string | (string | PackageJsonExportConditions)[] | PackageJsonExportConditions;
|
|
175
|
-
/**
|
|
176
|
-
Import map entries of a module, optionally with conditions and subpath imports.
|
|
177
|
-
*/
|
|
178
|
-
export type PackageJsonImports = Record<`#${string}`, PackageJsonExports>;
|
|
179
|
-
export interface PackageJsonNonStandardEntryPoints {
|
|
180
|
-
/**
|
|
181
|
-
An ECMAScript module ID that is the primary entry point to the program.
|
|
182
|
-
*/
|
|
183
|
-
module?: string;
|
|
184
|
-
/**
|
|
185
|
-
A module ID with untranspiled code that is the primary entry point to the program.
|
|
186
|
-
*/
|
|
187
|
-
esnext?: string | {
|
|
188
|
-
[moduleName: string]: string | undefined;
|
|
189
|
-
main?: string;
|
|
190
|
-
browser?: string;
|
|
191
|
-
};
|
|
192
|
-
/**
|
|
193
|
-
A hint to JavaScript bundlers or component tools when packaging modules for client side use.
|
|
194
|
-
*/
|
|
195
|
-
browser?: string | Partial<Record<string, string | false>>;
|
|
196
|
-
/**
|
|
197
|
-
Denote which files in your project are "pure" and therefore safe for Webpack to prune if unused.
|
|
198
|
-
|
|
199
|
-
[Read more.](https://webpack.js.org/guides/tree-shaking/)
|
|
200
|
-
*/
|
|
201
|
-
sideEffects?: boolean | string[];
|
|
202
|
-
}
|
|
203
|
-
export interface PackageJsonTypeScriptConfiguration {
|
|
204
|
-
/**
|
|
205
|
-
Location of the bundled TypeScript declaration file.
|
|
206
|
-
*/
|
|
207
|
-
types?: string;
|
|
208
|
-
/**
|
|
209
|
-
Version selection map of TypeScript.
|
|
210
|
-
*/
|
|
211
|
-
typesVersions?: Partial<Record<string, Partial<Record<string, string[]>>>>;
|
|
212
|
-
/**
|
|
213
|
-
Location of the bundled TypeScript declaration file. Alias of `types`.
|
|
214
|
-
*/
|
|
215
|
-
typings?: string;
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
An alternative configuration for workspaces.
|
|
219
|
-
*/
|
|
220
|
-
export interface PackageJsonWorkspaceConfig {
|
|
221
|
-
/**
|
|
222
|
-
An array of workspace pattern strings which contain the workspace packages.
|
|
223
|
-
*/
|
|
224
|
-
packages?: PackageJsonWorkspacePattern[];
|
|
225
|
-
/**
|
|
226
|
-
Designed to solve the problem of packages which break when their `node_modules` are moved to the root workspace directory - a process known as hoisting. For these packages, both within your workspace, and also some that have been installed via `node_modules`, it is important to have a mechanism for preventing the default Yarn workspace behavior. By adding workspace pattern strings here, Yarn will resume non-workspace behavior for any package which matches the defined patterns.
|
|
227
|
-
|
|
228
|
-
[Supported](https://classic.yarnpkg.com/blog/2018/02/15/nohoist/) by Yarn.
|
|
229
|
-
[Not supported](https://github.com/npm/rfcs/issues/287) by npm.
|
|
230
|
-
*/
|
|
231
|
-
nohoist?: PackageJsonWorkspacePattern[];
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
A workspace pattern points to a directory or group of directories which contain packages that should be included in the workspace installation process.
|
|
235
|
-
|
|
236
|
-
The patterns are handled with [minimatch](https://github.com/isaacs/minimatch).
|
|
237
|
-
|
|
238
|
-
@example
|
|
239
|
-
`docs` → Include the docs directory and install its dependencies.
|
|
240
|
-
`packages/*` → Include all nested directories within the packages directory, like `packages/cli` and `packages/core`.
|
|
241
|
-
*/
|
|
242
|
-
type PackageJsonWorkspacePattern = string;
|
|
243
|
-
export interface PackageJsonYarnConfiguration {
|
|
244
|
-
/**
|
|
245
|
-
If your package only allows one version of a given dependency, and you’d like to enforce the same behavior as `yarn install --flat` on the command-line, set this to `true`.
|
|
246
|
-
|
|
247
|
-
Note that if your `package.json` contains `"flat": true` and other packages depend on yours (e.g. you are building a library rather than an app), those other packages will also need `"flat": true` in their `package.json` or be installed with `yarn install --flat` on the command-line.
|
|
248
|
-
*/
|
|
249
|
-
flat?: boolean;
|
|
250
|
-
/**
|
|
251
|
-
Selective version resolutions. Allows the definition of custom package versions inside dependencies without manual edits in the `yarn.lock` file.
|
|
252
|
-
*/
|
|
253
|
-
resolutions?: PackageJsonDependency;
|
|
254
|
-
}
|
|
255
|
-
export interface PackageJsonJSPMConfiguration {
|
|
256
|
-
/**
|
|
257
|
-
JSPM configuration.
|
|
258
|
-
*/
|
|
259
|
-
jspm?: PackageJson;
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file). Containing standard npm properties.
|
|
263
|
-
*/
|
|
264
|
-
export interface PackageJsonStandard {
|
|
265
|
-
/**
|
|
266
|
-
The name of the package.
|
|
267
|
-
*/
|
|
268
|
-
name?: string;
|
|
269
|
-
/**
|
|
270
|
-
Package version, parseable by [`node-semver`](https://github.com/npm/node-semver).
|
|
271
|
-
*/
|
|
272
|
-
version?: string;
|
|
273
|
-
/**
|
|
274
|
-
Package description, listed in `npm search`.
|
|
275
|
-
*/
|
|
276
|
-
description?: string;
|
|
277
|
-
/**
|
|
278
|
-
Keywords associated with package, listed in `npm search`.
|
|
279
|
-
*/
|
|
280
|
-
keywords?: string[];
|
|
281
|
-
/**
|
|
282
|
-
The URL to the package's homepage.
|
|
283
|
-
*/
|
|
284
|
-
homepage?: LiteralUnion<".", string>;
|
|
285
|
-
/**
|
|
286
|
-
The URL to the package's issue tracker and/or the email address to which issues should be reported.
|
|
287
|
-
*/
|
|
288
|
-
bugs?: PackageJsonBugsLocation;
|
|
289
|
-
/**
|
|
290
|
-
The license for the package.
|
|
291
|
-
*/
|
|
292
|
-
license?: string;
|
|
60
|
+
private?: boolean;
|
|
293
61
|
/**
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
licenses?: {
|
|
297
|
-
type?: string;
|
|
298
|
-
url?: string;
|
|
299
|
-
}[];
|
|
62
|
+
* The “author” is one person.
|
|
63
|
+
*/
|
|
300
64
|
author?: PackageJsonPerson;
|
|
301
65
|
/**
|
|
302
|
-
|
|
303
|
-
|
|
66
|
+
* “contributors” is an array of people.
|
|
67
|
+
*/
|
|
304
68
|
contributors?: PackageJsonPerson[];
|
|
305
69
|
/**
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
maintainers?: PackageJsonPerson[];
|
|
309
|
-
/**
|
|
310
|
-
The files included in the package.
|
|
311
|
-
*/
|
|
70
|
+
* The optional `files` field is an array of file patterns that describes the entries to be included when your package is installed as a dependency. File patterns follow a similar syntax to `.gitignore`, but reversed: including a file, directory, or glob pattern (`*`, `**\/*`, and such) will make it so that file is included in the tarball when it’s packed. Omitting the field will make it default to `["*"]`, which means it will include all files.
|
|
71
|
+
*/
|
|
312
72
|
files?: string[];
|
|
313
73
|
/**
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
type?: "module" | "commonjs";
|
|
319
|
-
/**
|
|
320
|
-
The module ID that is the primary entry point to the program.
|
|
321
|
-
*/
|
|
74
|
+
* The main field is a module ID that is the primary entry point to your program. That is, if your package is named `foo`, and a user installs it, and then does `require("foo")`, then your main module’s exports object will be returned.
|
|
75
|
+
* This should be a module ID relative to the root of your package folder.
|
|
76
|
+
* For most modules, it makes the most sense to have a main script and often not much else.
|
|
77
|
+
*/
|
|
322
78
|
main?: string;
|
|
323
79
|
/**
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
*/
|
|
328
|
-
exports?: PackageJsonExports;
|
|
80
|
+
* If your module is meant to be used client-side the browser field should be used instead of the main field. This is helpful to hint users that it might rely on primitives that aren’t available in Node.js modules. (e.g. window)
|
|
81
|
+
*/
|
|
82
|
+
browser?: string | Record<string, string | false>;
|
|
329
83
|
/**
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
*/
|
|
334
|
-
imports?: PackageJsonImports;
|
|
84
|
+
* The `unpkg` field is used to specify the URL to a UMD module for your package. This is used by default in the unpkg.com CDN service.
|
|
85
|
+
*/
|
|
86
|
+
unpkg?: string;
|
|
335
87
|
/**
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
bin?: string |
|
|
88
|
+
* A map of command name to local file name. On install, npm will symlink that file into `prefix/bin` for global installs, or `./node_modules/.bin/` for local installs.
|
|
89
|
+
*/
|
|
90
|
+
bin?: string | Record<string, string>;
|
|
339
91
|
/**
|
|
340
|
-
|
|
341
|
-
|
|
92
|
+
* Specify either a single file or an array of filenames to put in place for the `man` program to find.
|
|
93
|
+
*/
|
|
342
94
|
man?: string | string[];
|
|
343
95
|
/**
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
/**
|
|
348
|
-
Location for the code repository.
|
|
349
|
-
*/
|
|
350
|
-
repository?: string | {
|
|
351
|
-
type: string;
|
|
352
|
-
url: string;
|
|
353
|
-
/**
|
|
354
|
-
Relative path to package.json if it is placed in non-root directory (for example if it is part of a monorepo).
|
|
355
|
-
|
|
356
|
-
[Read more.](https://github.com/npm/rfcs/blob/latest/implemented/0010-monorepo-subdirectory-declaration.md)
|
|
357
|
-
*/
|
|
358
|
-
directory?: string;
|
|
359
|
-
};
|
|
360
|
-
/**
|
|
361
|
-
Script commands that are run at various times in the lifecycle of the package. The key is the lifecycle event, and the value is the command to run at that point.
|
|
362
|
-
*/
|
|
363
|
-
scripts?: PackageJsonScripts;
|
|
364
|
-
/**
|
|
365
|
-
Is used to set configuration parameters used in package scripts that persist across upgrades.
|
|
366
|
-
*/
|
|
367
|
-
config?: JsonObject;
|
|
368
|
-
/**
|
|
369
|
-
The dependencies of the package.
|
|
370
|
-
*/
|
|
371
|
-
dependencies?: PackageJsonDependency;
|
|
372
|
-
/**
|
|
373
|
-
Additional tooling dependencies that are not required for the package to work. Usually test, build, or documentation tooling.
|
|
374
|
-
*/
|
|
375
|
-
devDependencies?: PackageJsonDependency;
|
|
376
|
-
/**
|
|
377
|
-
Dependencies that are skipped if they fail to install.
|
|
378
|
-
*/
|
|
379
|
-
optionalDependencies?: PackageJsonDependency;
|
|
380
|
-
/**
|
|
381
|
-
Dependencies that will usually be required by the package user directly or via another dependency.
|
|
382
|
-
*/
|
|
383
|
-
peerDependencies?: PackageJsonDependency;
|
|
384
|
-
/**
|
|
385
|
-
Indicate peer dependencies that are optional.
|
|
386
|
-
*/
|
|
387
|
-
peerDependenciesMeta?: Partial<Record<string, {
|
|
388
|
-
optional: true;
|
|
389
|
-
}>>;
|
|
96
|
+
* Dependencies are specified in a simple object that maps a package name to a version range. The version range is a string which has one or more space-separated descriptors. Dependencies can also be identified with a tarball or git URL.
|
|
97
|
+
*/
|
|
98
|
+
dependencies?: Record<string, string>;
|
|
390
99
|
/**
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
100
|
+
* If someone is planning on downloading and using your module in their program, then they probably don’t want or need to download and build the external test or documentation framework that you use.
|
|
101
|
+
* In this case, it’s best to map these additional items in a `devDependencies` object.
|
|
102
|
+
*/
|
|
103
|
+
devDependencies?: Record<string, string>;
|
|
394
104
|
/**
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
105
|
+
* If a dependency can be used, but you would like npm to proceed if it cannot be found or fails to install, then you may put it in the `optionalDependencies` object. This is a map of package name to version or url, just like the `dependencies` object. The difference is that build failures do not cause installation to fail.
|
|
106
|
+
*/
|
|
107
|
+
optionalDependencies?: Record<string, string>;
|
|
398
108
|
/**
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
[name in "npm" | "node" | string]?: string;
|
|
403
|
-
};
|
|
109
|
+
* In some cases, you want to express the compatibility of your package with a host tool or library, while not necessarily doing a `require` of this host. This is usually referred to as a plugin. Notably, your module may be exposing a specific interface, expected and specified by the host documentation.
|
|
110
|
+
*/
|
|
111
|
+
peerDependencies?: Record<string, string>;
|
|
404
112
|
/**
|
|
405
|
-
*
|
|
406
|
-
* This field is deprecated and will be ignored by npm. Please use {@link engines} for Node.js version requirements.
|
|
113
|
+
* TypeScript typings, typically ending by `.d.ts`.
|
|
407
114
|
*/
|
|
408
|
-
|
|
115
|
+
types?: string;
|
|
409
116
|
/**
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
117
|
+
* This field is synonymous with `types`.
|
|
118
|
+
*/
|
|
119
|
+
typings?: string;
|
|
413
120
|
/**
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
121
|
+
* Non-Standard Node.js alternate entry-point to main.
|
|
122
|
+
* An initial implementation for supporting CJS packages (from main), and use module for ESM modules.
|
|
123
|
+
*/
|
|
124
|
+
module?: string;
|
|
417
125
|
/**
|
|
418
|
-
*
|
|
126
|
+
* Make main entry-point be loaded as an ESM module, support "export" syntax instead of "require"
|
|
419
127
|
*
|
|
420
|
-
*
|
|
128
|
+
* Docs:
|
|
129
|
+
* - https://nodejs.org/docs/latest-v14.x/api/esm.html#esm_package_json_type_field
|
|
130
|
+
*
|
|
131
|
+
* @default 'commonjs'
|
|
132
|
+
* @since Node.js v14
|
|
421
133
|
*/
|
|
422
|
-
|
|
134
|
+
type?: "module" | "commonjs";
|
|
423
135
|
/**
|
|
424
|
-
*
|
|
136
|
+
* Alternate and extensible alternative to "main" entry point.
|
|
137
|
+
*
|
|
138
|
+
* When using `{type: "module"}`, any ESM module file MUST end with `.mjs` extension.
|
|
139
|
+
*
|
|
140
|
+
* Docs:
|
|
141
|
+
* - https://nodejs.org/docs/latest-v14.x/api/esm.html#esm_exports_sugar
|
|
142
|
+
*
|
|
143
|
+
* @since Node.js v12.7
|
|
425
144
|
*/
|
|
426
|
-
|
|
145
|
+
exports?: PackageJsonExports;
|
|
427
146
|
/**
|
|
428
|
-
*
|
|
147
|
+
* Docs:
|
|
148
|
+
* - https://nodejs.org/api/packages.html#imports
|
|
429
149
|
*/
|
|
430
|
-
|
|
150
|
+
imports?: Record<string, string | Record<string, string>>;
|
|
431
151
|
/**
|
|
432
|
-
*
|
|
152
|
+
* The field is used to define a set of sub-packages (or workspaces) within a monorepo.
|
|
433
153
|
*
|
|
434
|
-
*
|
|
154
|
+
* This field is an array of glob patterns or an object with specific configurations for managing
|
|
155
|
+
* multiple packages in a single repository.
|
|
435
156
|
*/
|
|
436
|
-
|
|
437
|
-
/**
|
|
438
|
-
* The type of funding.
|
|
439
|
-
*/
|
|
440
|
-
type?: LiteralUnion<"github" | "opencollective" | "patreon" | "individual" | "foundation" | "corporation", string>;
|
|
441
|
-
/**
|
|
442
|
-
* The URL to the funding page.
|
|
443
|
-
*/
|
|
444
|
-
url: string;
|
|
445
|
-
};
|
|
157
|
+
workspaces?: string[];
|
|
446
158
|
/**
|
|
447
|
-
*
|
|
448
|
-
*
|
|
449
|
-
* Workspaces allow you to manage multiple packages within the same repository in such a way that you only need to run your install command once in order to install all of them in a single pass.
|
|
450
|
-
*
|
|
451
|
-
* Please note that the top-level `private` property of `package.json` **must** be set to `true` in order to use workspaces.
|
|
159
|
+
* The field is is used to specify different TypeScript declaration files for
|
|
160
|
+
* different versions of TypeScript, allowing for version-specific type definitions.
|
|
452
161
|
*/
|
|
453
|
-
|
|
454
|
-
}
|
|
455
|
-
/**
|
|
456
|
-
* Type for [`package.json` file used by the Node.js runtime](https://nodejs.org/api/packages.html#nodejs-packagejson-field-definitions).
|
|
457
|
-
*/
|
|
458
|
-
export interface PackageJsonNodeJsStandard {
|
|
162
|
+
typesVersions?: Record<string, Record<string, string[]>>;
|
|
459
163
|
/**
|
|
460
|
-
*
|
|
461
|
-
*
|
|
462
|
-
* __This field is currently experimental and needs to be opted-in; check the [Corepack](https://nodejs.org/api/corepack.html) page for details about the procedure.__
|
|
463
|
-
*
|
|
464
|
-
* @example
|
|
164
|
+
* You can specify which operating systems your module will run on:
|
|
465
165
|
* ```json
|
|
466
|
-
*
|
|
467
|
-
*
|
|
468
|
-
*
|
|
166
|
+
* {
|
|
167
|
+
* "os": ["darwin", "linux"]
|
|
168
|
+
* }
|
|
469
169
|
* ```
|
|
170
|
+
* You can also block instead of allowing operating systems, just prepend the blocked os with a '!':
|
|
171
|
+
* ```json
|
|
172
|
+
* {
|
|
173
|
+
* "os": ["!win32"]
|
|
174
|
+
* }
|
|
175
|
+
* ```
|
|
176
|
+
* The host operating system is determined by `process.platform`
|
|
177
|
+
* It is allowed to both block and allow an item, although there isn't any good reason to do this.
|
|
470
178
|
*/
|
|
471
|
-
|
|
472
|
-
}
|
|
473
|
-
export interface PackageJsonPublishConfig {
|
|
474
|
-
/**
|
|
475
|
-
* Additional, less common properties from the [npm docs on `publishConfig`](https://docs.npmjs.com/cli/v7/configuring-npm/package-json#publishconfig).
|
|
476
|
-
*/
|
|
477
|
-
[additionalProperties: string]: JsonValue | undefined;
|
|
179
|
+
os?: string[];
|
|
478
180
|
/**
|
|
479
|
-
*
|
|
181
|
+
* If your code only runs on certain cpu architectures, you can specify which ones.
|
|
182
|
+
* ```json
|
|
183
|
+
* {
|
|
184
|
+
* "cpu": ["x64", "ia32"]
|
|
185
|
+
* }
|
|
186
|
+
* ```
|
|
187
|
+
* Like the `os` option, you can also block architectures:
|
|
188
|
+
* ```json
|
|
189
|
+
* {
|
|
190
|
+
* "cpu": ["!arm", "!mips"]
|
|
191
|
+
* }
|
|
192
|
+
* ```
|
|
193
|
+
* The host architecture is determined by `process.arch`
|
|
480
194
|
*/
|
|
481
|
-
|
|
195
|
+
cpu?: string[];
|
|
482
196
|
/**
|
|
483
|
-
*
|
|
484
|
-
*
|
|
485
|
-
* Default: `'https://registry.npmjs.org/'`
|
|
197
|
+
* This is a set of config values that will be used at publish-time.
|
|
486
198
|
*/
|
|
487
|
-
|
|
199
|
+
publishConfig?: {
|
|
200
|
+
/**
|
|
201
|
+
* The registry that will be used if the package is published.
|
|
202
|
+
*/
|
|
203
|
+
registry?: string;
|
|
204
|
+
/**
|
|
205
|
+
* The tag that will be used if the package is published.
|
|
206
|
+
*/
|
|
207
|
+
tag?: string;
|
|
208
|
+
/**
|
|
209
|
+
* The access level that will be used if the package is published.
|
|
210
|
+
*/
|
|
211
|
+
access?: "public" | "restricted";
|
|
212
|
+
/**
|
|
213
|
+
* **pnpm-only**
|
|
214
|
+
*
|
|
215
|
+
* By default, for portability reasons, no files except those listed in
|
|
216
|
+
* the bin field will be marked as executable in the resulting package
|
|
217
|
+
* archive. The executableFiles field lets you declare additional fields
|
|
218
|
+
* that must have the executable flag (+x) set even if
|
|
219
|
+
* they aren't directly accessible through the bin field.
|
|
220
|
+
*/
|
|
221
|
+
executableFiles?: string[];
|
|
222
|
+
/**
|
|
223
|
+
* **pnpm-only**
|
|
224
|
+
*
|
|
225
|
+
* You also can use the field `publishConfig.directory` to customize
|
|
226
|
+
* the published subdirectory relative to the current `package.json`.
|
|
227
|
+
*
|
|
228
|
+
* It is expected to have a modified version of the current package in
|
|
229
|
+
* the specified directory (usually using third party build tools).
|
|
230
|
+
*/
|
|
231
|
+
directory?: string;
|
|
232
|
+
/**
|
|
233
|
+
* **pnpm-only**
|
|
234
|
+
*
|
|
235
|
+
* When set to `true`, the project will be symlinked from the
|
|
236
|
+
* `publishConfig.directory` location during local development.
|
|
237
|
+
* @default true
|
|
238
|
+
*/
|
|
239
|
+
linkDirectory?: boolean;
|
|
240
|
+
} & Pick<PackageJson, "bin" | "main" | "exports" | "types" | "typings" | "module" | "browser" | "unpkg" | "typesVersions" | "os" | "cpu">;
|
|
488
241
|
/**
|
|
489
|
-
*
|
|
490
|
-
*
|
|
491
|
-
*
|
|
242
|
+
* See: https://nodejs.org/api/packages.html#packagemanager
|
|
243
|
+
* This field defines which package manager is expected to be used when working on the current project.
|
|
244
|
+
* Should be of the format: `<name>@<version>[#hash]`
|
|
492
245
|
*/
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
export interface PackageJsonStormConfiguration {
|
|
496
|
-
storm?: StormConfigurationGroups;
|
|
246
|
+
packageManager?: string;
|
|
247
|
+
[key: string]: any;
|
|
497
248
|
}
|
|
498
249
|
/**
|
|
499
|
-
*
|
|
250
|
+
* A “person” is an object with a “name” field and optionally “url” and “email”. Or you can shorten that all into a single string, and npm will parse it for you.
|
|
500
251
|
*/
|
|
501
|
-
|
|
252
|
+
type PackageJsonPerson = string | {
|
|
253
|
+
name: string;
|
|
254
|
+
email?: string;
|
|
255
|
+
url?: string;
|
|
256
|
+
};
|
|
257
|
+
type PackageJsonExportKey = "." | "import" | "require" | "types" | "node" | "browser" | "default" | (string & {});
|
|
258
|
+
type PackageJsonExportsObject = {
|
|
259
|
+
[P in PackageJsonExportKey]?: string | PackageJsonExportsObject | Array<string | PackageJsonExportsObject>;
|
|
260
|
+
};
|
|
261
|
+
type PackageJsonExports = string | PackageJsonExportsObject | Array<string | PackageJsonExportsObject>;
|
|
502
262
|
export {};
|