UNPKG

980 BTypeScriptView Raw
1/// <reference types="node" />
2
3declare namespace PkgInfo {
4 interface Options {
5 dir?: string;
6 include: string[];
7 }
8
9 interface FindResults {
10 dir?: string;
11 package: Record<string, any>;
12 }
13
14 interface PkgInfo {
15 (pmodule: NodeModule, options?: Options | string[] | string, ...properties: string[]): PkgInfo;
16
17 //
18 // ### function find (dir)
19 // #### @pmodule {Module} Parent module to read from.
20 // #### @dir {string} **Optional** Directory to start search from.
21 // Searches up the directory tree from `dir` until it finds a directory
22 // which contains a `package.json` file.
23 //
24 read(
25 pmodule: NodeModule,
26 dir?: string,
27 ): FindResults;
28
29 find(
30 pmodule: NodeModule,
31 dir?: string,
32 ): Record<string, any>;
33 }
34}
35
36declare const pkgInfo: PkgInfo.PkgInfo & { version: string };
37
38export = pkgInfo;