UNPKG

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