.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / type-fest / source / package-json.d.ts
1 import {LiteralUnion} from './literal-union';
2
3 declare namespace PackageJson {
4         /**
5         A person who has been involved in creating or maintaining the package.
6         */
7         export type Person =
8                 | string
9                 | {
10                         name: string;
11                         url?: string;
12                         email?: string;
13                 };
14
15         export type BugsLocation =
16                 | string
17                 | {
18                         /**
19                         The URL to the package's issue tracker.
20                         */
21                         url?: string;
22
23                         /**
24                         The email address to which issues should be reported.
25                         */
26                         email?: string;
27                 };
28
29         export interface DirectoryLocations {
30                 [directoryType: string]: unknown;
31
32                 /**
33                 Location for executable scripts. Sugar to generate entries in the `bin` property by walking the folder.
34                 */
35                 bin?: string;
36
37                 /**
38                 Location for Markdown files.
39                 */
40                 doc?: string;
41
42                 /**
43                 Location for example scripts.
44                 */
45                 example?: string;
46
47                 /**
48                 Location for the bulk of the library.
49                 */
50                 lib?: string;
51
52                 /**
53                 Location for man pages. Sugar to generate a `man` array by walking the folder.
54                 */
55                 man?: string;
56
57                 /**
58                 Location for test files.
59                 */
60                 test?: string;
61         }
62
63         export type Scripts = {
64                 /**
65                 Run **before** the package is published (Also run on local `npm install` without any arguments).
66                 */
67                 prepublish?: string;
68
69                 /**
70                 Run both **before** the package is packed and published, and on local `npm install` without any arguments. This is run **after** `prepublish`, but **before** `prepublishOnly`.
71                 */
72                 prepare?: string;
73
74                 /**
75                 Run **before** the package is prepared and packed, **only** on `npm publish`.
76                 */
77                 prepublishOnly?: string;
78
79                 /**
80                 Run **before** a tarball is packed (on `npm pack`, `npm publish`, and when installing git dependencies).
81                 */
82                 prepack?: string;
83
84                 /**
85                 Run **after** the tarball has been generated and moved to its final destination.
86                 */
87                 postpack?: string;
88
89                 /**
90                 Run **after** the package is published.
91                 */
92                 publish?: string;
93
94                 /**
95                 Run **after** the package is published.
96                 */
97                 postpublish?: string;
98
99                 /**
100                 Run **before** the package is installed.
101                 */
102                 preinstall?: string;
103
104                 /**
105                 Run **after** the package is installed.
106                 */
107                 install?: string;
108
109                 /**
110                 Run **after** the package is installed and after `install`.
111                 */
112                 postinstall?: string;
113
114                 /**
115                 Run **before** the package is uninstalled and before `uninstall`.
116                 */
117                 preuninstall?: string;
118
119                 /**
120                 Run **before** the package is uninstalled.
121                 */
122                 uninstall?: string;
123
124                 /**
125                 Run **after** the package is uninstalled.
126                 */
127                 postuninstall?: string;
128
129                 /**
130                 Run **before** bump the package version and before `version`.
131                 */
132                 preversion?: string;
133
134                 /**
135                 Run **before** bump the package version.
136                 */
137                 version?: string;
138
139                 /**
140                 Run **after** bump the package version.
141                 */
142                 postversion?: string;
143
144                 /**
145                 Run with the `npm test` command, before `test`.
146                 */
147                 pretest?: string;
148
149                 /**
150                 Run with the `npm test` command.
151                 */
152                 test?: string;
153
154                 /**
155                 Run with the `npm test` command, after `test`.
156                 */
157                 posttest?: string;
158
159                 /**
160                 Run with the `npm stop` command, before `stop`.
161                 */
162                 prestop?: string;
163
164                 /**
165                 Run with the `npm stop` command.
166                 */
167                 stop?: string;
168
169                 /**
170                 Run with the `npm stop` command, after `stop`.
171                 */
172                 poststop?: string;
173
174                 /**
175                 Run with the `npm start` command, before `start`.
176                 */
177                 prestart?: string;
178
179                 /**
180                 Run with the `npm start` command.
181                 */
182                 start?: string;
183
184                 /**
185                 Run with the `npm start` command, after `start`.
186                 */
187                 poststart?: string;
188
189                 /**
190                 Run with the `npm restart` command, before `restart`. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided.
191                 */
192                 prerestart?: string;
193
194                 /**
195                 Run with the `npm restart` command. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided.
196                 */
197                 restart?: string;
198
199                 /**
200                 Run with the `npm restart` command, after `restart`. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided.
201                 */
202                 postrestart?: string;
203         } & Record<string, string>;
204
205         /**
206         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.
207         */
208         export type Dependency = Record<string, string>;
209
210         /**
211         Conditions which provide a way to resolve a package entry point based on the environment.
212         */
213         export type ExportCondition = LiteralUnion<
214                 | 'import'
215                 | 'require'
216                 | 'node'
217                 | 'deno'
218                 | 'browser'
219                 | 'electron'
220                 | 'react-native'
221                 | 'default',
222                 string
223         >;
224
225         /**
226         Entry points of a module, optionally with conditions and subpath exports.
227         */
228         export type Exports =
229         | string
230         | {[key in ExportCondition]: Exports}
231         | {[key: string]: Exports}; // eslint-disable-line @typescript-eslint/consistent-indexed-object-style
232
233         export interface NonStandardEntryPoints {
234                 /**
235                 An ECMAScript module ID that is the primary entry point to the program.
236                 */
237                 module?: string;
238
239                 /**
240                 A module ID with untranspiled code that is the primary entry point to the program.
241                 */
242                 esnext?:
243                 | string
244                 | {
245                         [moduleName: string]: string | undefined;
246                         main?: string;
247                         browser?: string;
248                 };
249
250                 /**
251                 A hint to JavaScript bundlers or component tools when packaging modules for client side use.
252                 */
253                 browser?:
254                 | string
255                 | Record<string, string | false>;
256
257                 /**
258                 Denote which files in your project are "pure" and therefore safe for Webpack to prune if unused.
259
260                 [Read more.](https://webpack.js.org/guides/tree-shaking/)
261                 */
262                 sideEffects?: boolean | string[];
263         }
264
265         export interface TypeScriptConfiguration {
266                 /**
267                 Location of the bundled TypeScript declaration file.
268                 */
269                 types?: string;
270
271                 /**
272                 Location of the bundled TypeScript declaration file. Alias of `types`.
273                 */
274                 typings?: string;
275         }
276
277         /**
278         An alternative configuration for Yarn workspaces.
279         */
280         export interface WorkspaceConfig {
281                 /**
282                 An array of workspace pattern strings which contain the workspace packages.
283                 */
284                 packages?: WorkspacePattern[];
285
286                 /**
287                 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.
288
289                 [Read more](https://classic.yarnpkg.com/blog/2018/02/15/nohoist/)
290                 */
291                 nohoist?: WorkspacePattern[];
292         }
293
294         /**
295         A workspace pattern points to a directory or group of directories which contain packages that should be included in the workspace installation process.
296
297         The patterns are handled with [minimatch](https://github.com/isaacs/minimatch).
298
299         @example
300         `docs` â†’ Include the docs directory and install its dependencies.
301         `packages/*` â†’ Include all nested directories within the packages directory, like `packages/cli` and `packages/core`.
302         */
303         type WorkspacePattern = string;
304
305         export interface YarnConfiguration {
306                 /**
307                 Used to configure [Yarn workspaces](https://classic.yarnpkg.com/docs/workspaces/).
308
309                 Workspaces allow you to manage multiple packages within the same repository in such a way that you only need to run `yarn install` once to install all of them in a single pass.
310
311                 Please note that the top-level `private` property of `package.json` **must** be set to `true` in order to use workspaces.
312                 */
313                 workspaces?: WorkspacePattern[] | WorkspaceConfig;
314
315                 /**
316                 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`.
317
318                 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.
319                 */
320                 flat?: boolean;
321
322                 /**
323                 Selective version resolutions. Allows the definition of custom package versions inside dependencies without manual edits in the `yarn.lock` file.
324                 */
325                 resolutions?: Dependency;
326         }
327
328         export interface JSPMConfiguration {
329                 /**
330                 JSPM configuration.
331                 */
332                 jspm?: PackageJson;
333         }
334
335         /**
336         Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file). Containing standard npm properties.
337         */
338         export interface PackageJsonStandard {
339                 /**
340                 The name of the package.
341                 */
342                 name?: string;
343
344                 /**
345                 Package version, parseable by [`node-semver`](https://github.com/npm/node-semver).
346                 */
347                 version?: string;
348
349                 /**
350                 Package description, listed in `npm search`.
351                 */
352                 description?: string;
353
354                 /**
355                 Keywords associated with package, listed in `npm search`.
356                 */
357                 keywords?: string[];
358
359                 /**
360                 The URL to the package's homepage.
361                 */
362                 homepage?: LiteralUnion<'.', string>;
363
364                 /**
365                 The URL to the package's issue tracker and/or the email address to which issues should be reported.
366                 */
367                 bugs?: BugsLocation;
368
369                 /**
370                 The license for the package.
371                 */
372                 license?: string;
373
374                 /**
375                 The licenses for the package.
376                 */
377                 licenses?: Array<{
378                         type?: string;
379                         url?: string;
380                 }>;
381
382                 author?: Person;
383
384                 /**
385                 A list of people who contributed to the package.
386                 */
387                 contributors?: Person[];
388
389                 /**
390                 A list of people who maintain the package.
391                 */
392                 maintainers?: Person[];
393
394                 /**
395                 The files included in the package.
396                 */
397                 files?: string[];
398
399                 /**
400                 Resolution algorithm for importing ".js" files from the package's scope.
401
402                 [Read more.](https://nodejs.org/api/esm.html#esm_package_json_type_field)
403                 */
404                 type?: 'module' | 'commonjs';
405
406                 /**
407                 The module ID that is the primary entry point to the program.
408                 */
409                 main?: string;
410
411                 /**
412                 Standard entry points of the package, with enhanced support for ECMAScript Modules.
413
414                 [Read more.](https://nodejs.org/api/esm.html#esm_package_entry_points)
415                 */
416                 exports?: Exports;
417
418                 /**
419                 The executable files that should be installed into the `PATH`.
420                 */
421                 bin?:
422                 | string
423                 | Record<string, string>;
424
425                 /**
426                 Filenames to put in place for the `man` program to find.
427                 */
428                 man?: string | string[];
429
430                 /**
431                 Indicates the structure of the package.
432                 */
433                 directories?: DirectoryLocations;
434
435                 /**
436                 Location for the code repository.
437                 */
438                 repository?:
439                 | string
440                 | {
441                         type: string;
442                         url: string;
443
444                         /**
445                         Relative path to package.json if it is placed in non-root directory (for example if it is part of a monorepo).
446
447                         [Read more.](https://github.com/npm/rfcs/blob/latest/implemented/0010-monorepo-subdirectory-declaration.md)
448                         */
449                         directory?: string;
450                 };
451
452                 /**
453                 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.
454                 */
455                 scripts?: Scripts;
456
457                 /**
458                 Is used to set configuration parameters used in package scripts that persist across upgrades.
459                 */
460                 config?: Record<string, unknown>;
461
462                 /**
463                 The dependencies of the package.
464                 */
465                 dependencies?: Dependency;
466
467                 /**
468                 Additional tooling dependencies that are not required for the package to work. Usually test, build, or documentation tooling.
469                 */
470                 devDependencies?: Dependency;
471
472                 /**
473                 Dependencies that are skipped if they fail to install.
474                 */
475                 optionalDependencies?: Dependency;
476
477                 /**
478                 Dependencies that will usually be required by the package user directly or via another dependency.
479                 */
480                 peerDependencies?: Dependency;
481
482                 /**
483                 Indicate peer dependencies that are optional.
484                 */
485                 peerDependenciesMeta?: Record<string, {optional: true}>;
486
487                 /**
488                 Package names that are bundled when the package is published.
489                 */
490                 bundledDependencies?: string[];
491
492                 /**
493                 Alias of `bundledDependencies`.
494                 */
495                 bundleDependencies?: string[];
496
497                 /**
498                 Engines that this package runs on.
499                 */
500                 engines?: {
501                         [EngineName in 'npm' | 'node' | string]: string;
502                 };
503
504                 /**
505                 @deprecated
506                 */
507                 engineStrict?: boolean;
508
509                 /**
510                 Operating systems the module runs on.
511                 */
512                 os?: Array<LiteralUnion<
513                 | 'aix'
514                 | 'darwin'
515                 | 'freebsd'
516                 | 'linux'
517                 | 'openbsd'
518                 | 'sunos'
519                 | 'win32'
520                 | '!aix'
521                 | '!darwin'
522                 | '!freebsd'
523                 | '!linux'
524                 | '!openbsd'
525                 | '!sunos'
526                 | '!win32',
527                 string
528                 >>;
529
530                 /**
531                 CPU architectures the module runs on.
532                 */
533                 cpu?: Array<LiteralUnion<
534                 | 'arm'
535                 | 'arm64'
536                 | 'ia32'
537                 | 'mips'
538                 | 'mipsel'
539                 | 'ppc'
540                 | 'ppc64'
541                 | 's390'
542                 | 's390x'
543                 | 'x32'
544                 | 'x64'
545                 | '!arm'
546                 | '!arm64'
547                 | '!ia32'
548                 | '!mips'
549                 | '!mipsel'
550                 | '!ppc'
551                 | '!ppc64'
552                 | '!s390'
553                 | '!s390x'
554                 | '!x32'
555                 | '!x64',
556                 string
557                 >>;
558
559                 /**
560                 If set to `true`, a warning will be shown if package is installed locally. Useful if the package is primarily a command-line application that should be installed globally.
561
562                 @deprecated
563                 */
564                 preferGlobal?: boolean;
565
566                 /**
567                 If set to `true`, then npm will refuse to publish it.
568                 */
569                 private?: boolean;
570
571                 /**
572                 A set of config values that will be used at publish-time. It's especially handy to set the tag, registry or access, to ensure that a given package is not tagged with 'latest', published to the global public registry or that a scoped module is private by default.
573                 */
574                 publishConfig?: Record<string, unknown>;
575
576                 /**
577                 Describes and notifies consumers of a package's monetary support information.
578
579                 [Read more.](https://github.com/npm/rfcs/blob/latest/accepted/0017-add-funding-support.md)
580                 */
581                 funding?: string | {
582                         /**
583                         The type of funding.
584                         */
585                         type?: LiteralUnion<
586                         | 'github'
587                         | 'opencollective'
588                         | 'patreon'
589                         | 'individual'
590                         | 'foundation'
591                         | 'corporation',
592                         string
593                         >;
594
595                         /**
596                         The URL to the funding page.
597                         */
598                         url: string;
599                 };
600         }
601 }
602
603 /**
604 Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file). Also includes types for fields used by other popular projects, like TypeScript and Yarn.
605 */
606 export type PackageJson =
607 PackageJson.PackageJsonStandard &
608 PackageJson.NonStandardEntryPoints &
609 PackageJson.TypeScriptConfiguration &
610 PackageJson.YarnConfiguration &
611 PackageJson.JSPMConfiguration;