-
-
Notifications
You must be signed in to change notification settings - Fork 197
/
Copy pathpacote-service.d.ts
50 lines (45 loc) · 1.38 KB
/
pacote-service.d.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
import * as tar from "tar";
import { IProxySettingsBase } from "../common/declarations";
import { Arborist } from "@npmcli/arborist";
declare global {
interface IPacoteService {
/**
* Returns the package's json file content
* @param packageName The name of the package
* @param options The provided options can control which properties from package.json file will be returned. In case when fullMetadata option is provided, all data from package.json file will be returned.
*/
manifest(
packageName: string,
options?: IPacoteManifestOptions
): Promise<any>;
/**
* Downloads the specified package and extracts it in specified destination directory
* @param packageName The name of the package
* @param destinationDirectory The path to directory where the downloaded tarball will be extracted.
*/
extractPackage(
packageName: string,
destinationDirectory: string,
options?: IPacoteExtractOptions
): Promise<void>;
}
interface IPacoteBaseOptions extends IProxySettingsBase {
/**
* The path to npm cache
*/
cache?: string;
/**
* Arborist instance to use
*/
Arborist?: Arborist;
}
interface IPacoteManifestOptions extends IPacoteBaseOptions {
/**
* If true, the whole package.json data will be returned
*/
fullMetadata?: boolean;
}
interface IPacoteExtractOptions {
filter?: (path: string, stat: tar.FileStat) => boolean;
}
}