UNPKG

3.46 kBTypeScriptView Raw
1// Type definitions for glob 8.0
2// Project: https://github.com/isaacs/node-glob
3// Definitions by: vvakame <https://github.com/vvakame>
4// voy <https://github.com/voy>
5// Klaus Meinhardt <https://github.com/ajafff>
6// Piotr Błażejewicz <https://github.com/peterblazejewicz>
7// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
8
9/// <reference types="node" />
10
11import events = require("events");
12import minimatch = require("minimatch");
13import fs = require("fs");
14
15declare function G(pattern: string, cb: (err: Error | null, matches: string[]) => void): G.IGlob;
16declare function G(pattern: string, options: G.IOptions, cb: (err: Error | null, matches: string[]) => void): G.IGlob;
17
18declare namespace G {
19 function __promisify__(pattern: string, options?: IOptions): Promise<string[]>;
20
21 function sync(pattern: string, options?: IOptions): string[];
22
23 function hasMagic(pattern: string, options?: IOptions): boolean;
24
25 let glob: typeof G;
26 let Glob: IGlobStatic;
27 let GlobSync: IGlobSyncStatic;
28
29 interface IOptions extends minimatch.IOptions {
30 cwd?: string | undefined;
31 root?: string | undefined;
32 dot?: boolean | undefined;
33 nomount?: boolean | undefined;
34 mark?: boolean | undefined;
35 nosort?: boolean | undefined;
36 stat?: boolean | undefined;
37 silent?: boolean | undefined;
38 strict?: boolean | undefined;
39 cache?: { [path: string]: boolean | 'DIR' | 'FILE' | ReadonlyArray<string> } | undefined;
40 statCache?: { [path: string]: false | { isDirectory(): boolean} | undefined } | undefined;
41 symlinks?: { [path: string]: boolean | undefined } | undefined;
42 realpathCache?: { [path: string]: string } | undefined;
43 sync?: boolean | undefined;
44 nounique?: boolean | undefined;
45 nonull?: boolean | undefined;
46 debug?: boolean | undefined;
47 nobrace?: boolean | undefined;
48 noglobstar?: boolean | undefined;
49 noext?: boolean | undefined;
50 nocase?: boolean | undefined;
51 matchBase?: any;
52 nodir?: boolean | undefined;
53 ignore?: string | ReadonlyArray<string> | undefined;
54 follow?: boolean | undefined;
55 realpath?: boolean | undefined;
56 nonegate?: boolean | undefined;
57 nocomment?: boolean | undefined;
58 absolute?: boolean | undefined;
59 fs?: typeof fs;
60 }
61
62 interface IGlobStatic extends events.EventEmitter {
63 new (pattern: string, cb?: (err: Error | null, matches: string[]) => void): IGlob;
64 new (pattern: string, options: IOptions, cb?: (err: Error | null, matches: string[]) => void): IGlob;
65 prototype: IGlob;
66 }
67
68 interface IGlobSyncStatic {
69 new (pattern: string, options?: IOptions): IGlobBase;
70 prototype: IGlobBase;
71 }
72
73 interface IGlobBase {
74 minimatch: minimatch.IMinimatch;
75 options: IOptions;
76 aborted: boolean;
77 cache: { [path: string]: boolean | 'DIR' | 'FILE' | ReadonlyArray<string> };
78 statCache: { [path: string]: false | { isDirectory(): boolean; } | undefined };
79 symlinks: { [path: string]: boolean | undefined };
80 realpathCache: { [path: string]: string };
81 found: string[];
82 }
83
84 interface IGlob extends IGlobBase, events.EventEmitter {
85 pause(): void;
86 resume(): void;
87 abort(): void;
88 }
89}
90
91export = G;