1 |
|
2 |
|
3 | declare var npm: npm.Static;
|
4 | export = npm;
|
5 |
|
6 | declare namespace npm {
|
7 | export interface Static extends NodeJS.EventEmitter {
|
8 | config: Config;
|
9 | commands: Commands;
|
10 | rollbacks: any[];
|
11 | spinner: Spinner;
|
12 | fullList: string[];
|
13 | abbrevs: Dictionary<string>;
|
14 |
|
15 | prefix: string;
|
16 | bin: string;
|
17 | globalBin: string;
|
18 | dir: string;
|
19 | globalDir: string;
|
20 | root: string;
|
21 | cache: string;
|
22 | tmp: string;
|
23 |
|
24 | load(callback?: SimpleCallback<void>): Promise<void>;
|
25 |
|
26 | deref(command: string): string;
|
27 | }
|
28 |
|
29 |
|
30 |
|
31 | export interface Commands {
|
32 | install: CommandFunction;
|
33 | uninstall: CommandFunction;
|
34 | cache: CommandFunction;
|
35 | config: CommandFunction;
|
36 | set: CommandFunction;
|
37 | get: CommandFunction;
|
38 | update: CommandFunction;
|
39 | outdated: CommandFunction;
|
40 | prune: CommandFunction;
|
41 | submodule: CommandFunction;
|
42 | pack: CommandFunction;
|
43 | dedupe: CommandFunction;
|
44 |
|
45 |
|
46 | access: CommandFunction;
|
47 |
|
48 | audit: CommandFunction;
|
49 |
|
50 | ci: CommandFunction;
|
51 |
|
52 | diff: CommandFunction;
|
53 |
|
54 | "dist-tag": CommandFunction;
|
55 |
|
56 | doctor: CommandFunction;
|
57 |
|
58 | exec: CommandFunction;
|
59 |
|
60 | explain: CommandFunction;
|
61 |
|
62 | fund: CommandFunction;
|
63 |
|
64 | hook: CommandFunction;
|
65 |
|
66 | "install-ci-test": CommandFunction;
|
67 |
|
68 | "install-test": CommandFunction;
|
69 |
|
70 | logout: CommandFunction;
|
71 |
|
72 | org: CommandFunction;
|
73 |
|
74 | ping: CommandFunction;
|
75 |
|
76 | profile: CommandFunction;
|
77 |
|
78 | "set-script": CommandFunction;
|
79 |
|
80 | team: CommandFunction;
|
81 |
|
82 | token: CommandFunction;
|
83 |
|
84 | rebuild: CommandFunction;
|
85 | link: CommandFunction;
|
86 |
|
87 | publish: CommandFunction;
|
88 | star: CommandFunction;
|
89 | stars: CommandFunction;
|
90 | tag: CommandFunction;
|
91 | adduser: CommandFunction;
|
92 | unpublish: CommandFunction;
|
93 | owner: CommandFunction;
|
94 | deprecate: CommandFunction;
|
95 | shrinkwrap: CommandFunction;
|
96 |
|
97 | help: CommandFunction;
|
98 | "help-search": CommandFunction;
|
99 | ls: CommandFunction;
|
100 | search: CommandFunction;
|
101 | init: CommandFunction;
|
102 | version: CommandFunction;
|
103 | edit: CommandFunction;
|
104 | explore: CommandFunction;
|
105 | docs: CommandFunction;
|
106 | repo: CommandFunction;
|
107 | bugs: CommandFunction;
|
108 | faq: CommandFunction;
|
109 | root: CommandFunction;
|
110 | prefix: CommandFunction;
|
111 | bin: CommandFunction;
|
112 | whoami: CommandFunction;
|
113 |
|
114 |
|
115 | view(args: string[], callback: CommandCallback): void;
|
116 | view(args: string[], silent: boolean, callback: CommandCallback): void;
|
117 | info(args: string[], callback: CommandCallback): void;
|
118 | info(args: string[], silent: boolean, callback: CommandCallback): void;
|
119 | show(args: string[], callback: CommandCallback): void;
|
120 | show(args: string[], silent: boolean, callback: CommandCallback): void;
|
121 | v(args: string[], callback: CommandCallback): void;
|
122 | v(args: string[], silent: boolean, callback: CommandCallback): void;
|
123 |
|
124 | test: CommandFunction;
|
125 | stop: CommandFunction;
|
126 | start: CommandFunction;
|
127 | restart: CommandFunction;
|
128 | "run-script": CommandFunction;
|
129 | completion: CommandFunction;
|
130 |
|
131 |
|
132 | rm: CommandFunction;
|
133 | r: CommandFunction;
|
134 | un: CommandFunction;
|
135 | unlink: CommandFunction;
|
136 | remove: CommandFunction;
|
137 | rb: CommandFunction;
|
138 | list: CommandFunction;
|
139 | la: CommandFunction;
|
140 | ll: CommandFunction;
|
141 | i: CommandFunction;
|
142 | isntall: CommandFunction;
|
143 | up: CommandFunction;
|
144 | c: CommandFunction;
|
145 | find: CommandFunction;
|
146 | s: CommandFunction;
|
147 | se: CommandFunction;
|
148 | author: CommandFunction;
|
149 | home: CommandFunction;
|
150 | issues: CommandFunction;
|
151 | unstar: CommandFunction;
|
152 | apihelp: CommandFunction;
|
153 | long: CommandFunction;
|
154 | "add-user": CommandFunction;
|
155 | tst: CommandFunction;
|
156 | t: CommandFunction;
|
157 | "find-dupes": CommandFunction;
|
158 | ddp: CommandFunction;
|
159 | |
160 |
|
161 |
|
162 |
|
163 |
|
164 | "dist-tags": CommandFunction;
|
165 | |
166 |
|
167 |
|
168 |
|
169 |
|
170 | x: CommandFunction;
|
171 | |
172 |
|
173 |
|
174 |
|
175 |
|
176 | why: CommandFunction;
|
177 | |
178 |
|
179 |
|
180 |
|
181 |
|
182 | cit: CommandFunction;
|
183 | |
184 |
|
185 |
|
186 |
|
187 |
|
188 | it: CommandFunction;
|
189 |
|
190 |
|
191 | build: CommandFunction;
|
192 | unbuild: CommandFunction;
|
193 | xmas: CommandFunction;
|
194 | substack: CommandFunction;
|
195 | visnup: CommandFunction;
|
196 | }
|
197 | export interface CommandFunction {
|
198 | (args: string[], callback: CommandCallback): void;
|
199 | }
|
200 | export interface CommandCallback {
|
201 | (err?: Error, result?: any, result2?: any, result3?: any, result4?: any): void;
|
202 | }
|
203 |
|
204 |
|
205 |
|
206 |
|
207 |
|
208 | export interface Spinner {
|
209 | int: string;
|
210 | started: boolean;
|
211 | start(): void;
|
212 | stop(): void;
|
213 | }
|
214 |
|
215 |
|
216 |
|
217 |
|
218 |
|
219 | export interface ConfigStatic {
|
220 | new(base: Config): Config;
|
221 | (base: Config): Config;
|
222 | }
|
223 |
|
224 | export interface Config {
|
225 | loaded: boolean;
|
226 | sources: Dictionary<ConfigSource>;
|
227 | rootConf: Config;
|
228 | usingBuiltin: boolean;
|
229 | root?: Config | undefined;
|
230 | Conf: ConfigStatic;
|
231 | defs: ConfigDefs;
|
232 |
|
233 | get(setting: string): any;
|
234 | set(setting: string, value: any): void;
|
235 |
|
236 | loadPrefix(cb: ErrorCallback): void;
|
237 | loadCAFile(caFilePath: string, cb: ErrorCallback): void;
|
238 | loadUid(cb: SimpleCallback<string>): void;
|
239 | setUser(cb: ErrorCallback): void;
|
240 | findPrefix(prefix: string, cb: SimpleCallback<string>): void;
|
241 | getCredentialsByURI(uri: string): Credentials;
|
242 | setCredentialsByURI(uri: string, cred: Credentials): void;
|
243 |
|
244 | loadExtras(cb: ErrorCallback): void;
|
245 | save(where: string, cb: ErrorCallback): Config;
|
246 | addFile(file: string, name: string): Config;
|
247 | parse(content: string, file: string): any;
|
248 | add(data: Object, marker: Object): any;
|
249 | addEnv(env: Dictionary<string>): any;
|
250 | }
|
251 |
|
252 | export interface ConfigDefs {
|
253 | defaults: ConfigOptions;
|
254 | types: ConfigTypes;
|
255 | }
|
256 |
|
257 | export interface ConfigOptions {
|
258 | "always-auth"?: boolean | undefined;
|
259 | "bin-links"?: boolean | undefined;
|
260 | browser?: string | undefined;
|
261 |
|
262 | ca?: any;
|
263 | cafile?: string | undefined;
|
264 |
|
265 | cache?: string | undefined;
|
266 |
|
267 | "cache-lock-stale"?: number | undefined;
|
268 | "cache-lock-retries"?: number | undefined;
|
269 | "cache-lock-wait"?: number | undefined;
|
270 |
|
271 | "cache-max"?: number | undefined;
|
272 | "cache-min"?: number | undefined;
|
273 |
|
274 | cert?: string | undefined;
|
275 |
|
276 | color?: any;
|
277 | depth?: number | undefined;
|
278 | description?: boolean | undefined;
|
279 | dev?: boolean | undefined;
|
280 | editor?: string | undefined;
|
281 | "engine-strict"?: boolean | undefined;
|
282 | force?: boolean | undefined;
|
283 |
|
284 | "fetch-retries"?: number | undefined;
|
285 | "fetch-retry-factor"?: number | undefined;
|
286 | "fetch-retry-mintimeout"?: number | undefined;
|
287 | "fetch-retry-maxtimeout"?: number | undefined;
|
288 |
|
289 | git?: string | undefined;
|
290 | "git-tag-version"?: boolean | undefined;
|
291 |
|
292 | global?: boolean | undefined;
|
293 | globalconfig?: string | undefined;
|
294 | group?: any;
|
295 | heading?: string | undefined;
|
296 | "ignore-scripts"?: boolean | undefined;
|
297 | "init-module"?: string | undefined;
|
298 | "init.author.name"?: string | undefined;
|
299 | "init.author.email"?: string | undefined;
|
300 | "init.author.url"?: string | undefined;
|
301 | "init.version"?: string | undefined;
|
302 | "init.license"?: string | undefined;
|
303 | json?: boolean | undefined;
|
304 | key?: string | undefined;
|
305 | link?: boolean | undefined;
|
306 | "local-address"?: string | undefined;
|
307 | loglevel?: string | undefined;
|
308 | logstream?: NodeJS.ReadWriteStream | undefined;
|
309 | long?: boolean | undefined;
|
310 | message?: string | undefined;
|
311 | "node-version"?: string | undefined;
|
312 | npat?: boolean | undefined;
|
313 | "onload-script"?: boolean | undefined;
|
314 | optional?: boolean | undefined;
|
315 | parseable?: boolean | undefined;
|
316 | prefix?: string | undefined;
|
317 | production?: boolean | undefined;
|
318 | "proprietary-attribs"?: boolean | undefined;
|
319 | proxy?: any;
|
320 | "https-proxy"?: string | undefined;
|
321 | "user-agent"?: string | undefined;
|
322 | "rebuild-bundle"?: boolean | undefined;
|
323 | registry?: string | undefined;
|
324 | rollback?: boolean | undefined;
|
325 | save?: boolean | undefined;
|
326 | "save-bundle"?: boolean | undefined;
|
327 | "save-dev"?: boolean | undefined;
|
328 | "save-exact"?: boolean | undefined;
|
329 | "save-optional"?: boolean | undefined;
|
330 | "save-prefix"?: string | undefined;
|
331 | scope?: string | undefined;
|
332 | searchopts?: string | undefined;
|
333 | searchexclude?: string | undefined;
|
334 | searchsort?: string | undefined;
|
335 | shell?: string | undefined;
|
336 | shrinkwrap?: boolean | undefined;
|
337 | "sign-git-tag"?: boolean | undefined;
|
338 | spin?: any;
|
339 | "strict-ssl"?: boolean | undefined;
|
340 | tag?: string | undefined;
|
341 | tmp?: string | undefined;
|
342 | unicode?: boolean | undefined;
|
343 | "unsafe-perm"?: boolean | undefined;
|
344 | usage?: boolean | undefined;
|
345 | user?: any;
|
346 | userconfig?: string | undefined;
|
347 | umask?: number | undefined;
|
348 | version?: boolean | undefined;
|
349 | versions?: boolean | undefined;
|
350 | viewer?: string | undefined;
|
351 |
|
352 | _exit?: boolean | undefined;
|
353 | }
|
354 |
|
355 | export interface ConfigTypes {
|
356 | "always-auth": typeof Boolean;
|
357 | "bin-links": typeof Boolean;
|
358 | browser: any[];
|
359 |
|
360 | ca: any[];
|
361 | cafile: typeof String;
|
362 | cache: typeof String;
|
363 |
|
364 | "cache-lock-stale": typeof Number;
|
365 | "cache-lock-retries": typeof Number;
|
366 | "cache-lock-wait": typeof Number;
|
367 |
|
368 | "cache-max": typeof Number;
|
369 | "cache-min": typeof Number;
|
370 |
|
371 | cert: typeof String;
|
372 |
|
373 | color: any[];
|
374 | depth: typeof Number;
|
375 | description: typeof Boolean;
|
376 | dev: typeof Boolean;
|
377 | editor: typeof String;
|
378 | "engine-strict": typeof Boolean;
|
379 | force: typeof Boolean;
|
380 |
|
381 | "fetch-retries": typeof Number;
|
382 | "fetch-retry-factor": typeof Number;
|
383 | "fetch-retry-mintimeout": typeof Number;
|
384 | "fetch-retry-maxtimeout": typeof Number;
|
385 |
|
386 | git: typeof String;
|
387 | "git-tag-version": typeof Boolean;
|
388 |
|
389 | global: typeof Boolean;
|
390 | globalconfig: typeof String;
|
391 | group: any[];
|
392 | heading: typeof String;
|
393 | "ignore-scripts": typeof Boolean;
|
394 | "init-module": typeof String;
|
395 | "init.author.name": typeof String;
|
396 | "init.author.email": typeof String;
|
397 | "init.author.url": typeof String;
|
398 | "init.version": typeof String;
|
399 | "init.license": typeof String;
|
400 | json: typeof Boolean;
|
401 | key: any[];
|
402 | link: typeof Boolean;
|
403 | "local-address": typeof String;
|
404 | loglevel: any[];
|
405 | logstream: any;
|
406 | long: typeof Boolean;
|
407 | message: typeof String;
|
408 | "node-version": any[];
|
409 | npat: typeof Boolean;
|
410 | "onload-script": any[];
|
411 | optional: typeof Boolean;
|
412 | parseable: typeof Boolean;
|
413 | prefix: typeof String;
|
414 | production: typeof Boolean;
|
415 | "proprietary-attribs": typeof Boolean;
|
416 | proxy: any[];
|
417 | "https-proxy": any[];
|
418 | "user-agent": typeof String;
|
419 | "rebuild-bundle": Boolean;
|
420 | registry: any[];
|
421 | rollback: typeof Boolean;
|
422 | save: typeof Boolean;
|
423 | "save-bundle": typeof Boolean;
|
424 | "save-dev": typeof Boolean;
|
425 | "save-exact": typeof Boolean;
|
426 | "save-optional": typeof Boolean;
|
427 | "save-prefix": typeof String;
|
428 | scope: typeof String;
|
429 | searchopts: typeof String;
|
430 | searchexclude: any[];
|
431 | searchsort: any[];
|
432 | shell: typeof String;
|
433 | shrinkwrap: typeof Boolean;
|
434 | "sign-git-tag": typeof Boolean;
|
435 | spin: any[];
|
436 | "strict-ssl": typeof Boolean;
|
437 | tag: typeof String;
|
438 | tmp: typeof String;
|
439 | unicode: typeof Boolean;
|
440 | "unsafe-perm": typeof Boolean;
|
441 | usage: typeof Boolean;
|
442 | user: any;
|
443 | userconfig: typeof String;
|
444 | umask: typeof Number;
|
445 | version: typeof Boolean;
|
446 | versions: typeof Boolean;
|
447 | viewer: typeof String;
|
448 |
|
449 | _exit: typeof Boolean;
|
450 | }
|
451 |
|
452 | export interface ConfigShorthands {
|
453 | s: any[];
|
454 | d: any[];
|
455 | dd: any[];
|
456 | ddd: any[];
|
457 | noreg: any[];
|
458 | N: any[];
|
459 | reg: any[];
|
460 | "no-reg": any[];
|
461 | silent: any[];
|
462 | verbose: any[];
|
463 | quiet: any[];
|
464 | q: any[];
|
465 | h: any[];
|
466 | H: any[];
|
467 | "?": any[];
|
468 | help: any[];
|
469 | v: any[];
|
470 | f: any[];
|
471 | gangster: any[];
|
472 | gangsta: any[];
|
473 | desc: any[];
|
474 | "no-desc": any[];
|
475 | "local": any[];
|
476 | l: any[];
|
477 | m: any[];
|
478 | p: any[];
|
479 | porcelain: any[];
|
480 | g: any[];
|
481 | S: any[];
|
482 | D: any[];
|
483 | E: any[];
|
484 | O: any[];
|
485 | y: any[];
|
486 | n: any[];
|
487 | B: any[];
|
488 | C: any[];
|
489 | }
|
490 |
|
491 | export interface ConfigSource {
|
492 | path: string;
|
493 | type: string;
|
494 | }
|
495 |
|
496 | export interface Credentials {
|
497 | scope: string;
|
498 | token?: string | undefined;
|
499 | password?: string | undefined;
|
500 | username?: string | undefined;
|
501 | email?: string | undefined;
|
502 | auth?: string | undefined;
|
503 | }
|
504 |
|
505 |
|
506 |
|
507 |
|
508 |
|
509 | export interface Dictionary<T> {
|
510 | [key: string]: T;
|
511 | }
|
512 |
|
513 | export interface ErrorCallback {
|
514 | (err?: Error): void;
|
515 | }
|
516 |
|
517 | export interface SimpleCallback<T> {
|
518 | (err?: Error, result?: T): void;
|
519 | }
|
520 |
|
521 |
|
522 | }
|