UNPKG

4.17 kBTypeScriptView Raw
1export type Dependencies = Record<string, string>;
2export type PackageBin = string | {
3 [commandName: string]: string;
4};
5export type PackageScripts = {
6 [name: string]: string;
7} & {
8 prepublish?: string;
9 prepare?: string;
10 prepublishOnly?: string;
11 prepack?: string;
12 postpack?: string;
13 publish?: string;
14 postpublish?: string;
15 preinstall?: string;
16 install?: string;
17 postinstall?: string;
18 preuninstall?: string;
19 uninstall?: string;
20 postuninstall?: string;
21 preversion?: string;
22 version?: string;
23 postversion?: string;
24 pretest?: string;
25 test?: string;
26 posttest?: string;
27 prestop?: string;
28 stop?: string;
29 poststop?: string;
30 prestart?: string;
31 start?: string;
32 poststart?: string;
33 prerestart?: string;
34 restart?: string;
35 postrestart?: string;
36 preshrinkwrap?: string;
37 shrinkwrap?: string;
38 postshrinkwrap?: string;
39};
40export interface PeerDependenciesMeta {
41 [dependencyName: string]: {
42 optional?: boolean;
43 };
44}
45export interface DependenciesMeta {
46 [dependencyName: string]: {
47 injected?: boolean;
48 node?: string;
49 patch?: string;
50 };
51}
52export interface PublishConfig extends Record<string, unknown> {
53 directory?: string;
54 linkDirectory?: boolean;
55 executableFiles?: string[];
56 registry?: string;
57}
58type Version = string;
59type Pattern = string;
60export interface TypesVersions {
61 [version: Version]: {
62 [pattern: Pattern]: string[];
63 };
64}
65export interface BaseManifest {
66 name?: string;
67 version?: string;
68 bin?: PackageBin;
69 description?: string;
70 directories?: {
71 bin?: string;
72 };
73 files?: string[];
74 dependencies?: Dependencies;
75 devDependencies?: Dependencies;
76 optionalDependencies?: Dependencies;
77 peerDependencies?: Dependencies;
78 peerDependenciesMeta?: PeerDependenciesMeta;
79 dependenciesMeta?: DependenciesMeta;
80 bundleDependencies?: string[] | boolean;
81 bundledDependencies?: string[] | boolean;
82 homepage?: string;
83 repository?: string | {
84 url: string;
85 };
86 scripts?: PackageScripts;
87 config?: object;
88 engines?: {
89 node?: string;
90 npm?: string;
91 pnpm?: string;
92 };
93 cpu?: string[];
94 os?: string[];
95 libc?: string[];
96 main?: string;
97 module?: string;
98 typings?: string;
99 types?: string;
100 publishConfig?: PublishConfig;
101 typesVersions?: TypesVersions;
102 readme?: string;
103 keywords?: string[];
104 author?: string;
105 license?: string;
106 exports?: Record<string, string>;
107}
108export type DependencyManifest = BaseManifest & Required<Pick<BaseManifest, 'name' | 'version'>>;
109export type PackageExtension = Pick<BaseManifest, 'dependencies' | 'optionalDependencies' | 'peerDependencies' | 'peerDependenciesMeta'>;
110export interface PeerDependencyRules {
111 ignoreMissing?: string[];
112 allowAny?: string[];
113 allowedVersions?: Record<string, string>;
114}
115export type AllowedDeprecatedVersions = Record<string, string>;
116export type ProjectManifest = BaseManifest & {
117 packageManager?: string;
118 workspaces?: string[];
119 pnpm?: {
120 neverBuiltDependencies?: string[];
121 onlyBuiltDependencies?: string[];
122 onlyBuiltDependenciesFile?: string;
123 overrides?: Record<string, string>;
124 packageExtensions?: Record<string, PackageExtension>;
125 ignoredOptionalDependencies?: string[];
126 peerDependencyRules?: PeerDependencyRules;
127 allowedDeprecatedVersions?: AllowedDeprecatedVersions;
128 allowNonAppliedPatches?: boolean;
129 patchedDependencies?: Record<string, string>;
130 updateConfig?: {
131 ignoreDependencies?: string[];
132 };
133 auditConfig?: {
134 ignoreCves?: string[];
135 };
136 requiredScripts?: string[];
137 supportedArchitectures?: SupportedArchitectures;
138 };
139 private?: boolean;
140 resolutions?: Record<string, string>;
141};
142export type PackageManifest = DependencyManifest & {
143 deprecated?: string;
144};
145export interface SupportedArchitectures {
146 os?: string[];
147 cpu?: string[];
148 libc?: string[];
149}
150export {};