UNPKG

3.51 kBTypeScriptView Raw
1// Type definitions for glob 8.1
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 allowWindowsEscape?: boolean | undefined;
60 fs?: typeof fs;
61 }
62
63 interface IGlobStatic extends events.EventEmitter {
64 new (pattern: string, cb?: (err: Error | null, matches: string[]) => void): IGlob;
65 new (pattern: string, options: IOptions, cb?: (err: Error | null, matches: string[]) => void): IGlob;
66 prototype: IGlob;
67 }
68
69 interface IGlobSyncStatic {
70 new (pattern: string, options?: IOptions): IGlobBase;
71 prototype: IGlobBase;
72 }
73
74 interface IGlobBase {
75 minimatch: minimatch.IMinimatch;
76 options: IOptions;
77 aborted: boolean;
78 cache: { [path: string]: boolean | 'DIR' | 'FILE' | ReadonlyArray<string> };
79 statCache: { [path: string]: false | { isDirectory(): boolean; } | undefined };
80 symlinks: { [path: string]: boolean | undefined };
81 realpathCache: { [path: string]: string };
82 found: string[];
83 }
84
85 interface IGlob extends IGlobBase, events.EventEmitter {
86 pause(): void;
87 resume(): void;
88 abort(): void;
89 }
90}
91
92export = G;