Skip to content

Commit 28fb135

Browse files
committed
Merge pull request DefinitelyTyped#4723 from itokentr/master
Update glob and minimatch
2 parents 00b1c2c + a3900b8 commit 28fb135

File tree

3 files changed

+125
-67
lines changed

3 files changed

+125
-67
lines changed

glob/glob.d.ts

Lines changed: 80 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Type definitions for Glob
1+
// Type definitions for Glob 5.0.10
22
// Project: https://github.com/isaacs/node-glob
33
// Definitions by: vvakame <https://github.com/vvakame/>
44
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -9,63 +9,104 @@
99
declare module "glob" {
1010

1111
import events = require("events");
12+
import fs = require('fs');
1213
import minimatch = require("minimatch");
1314

14-
function G(pattern:string, cb:(err:Error, matches:string[])=>void):void;
15-
16-
function G(pattern:string, options:G.IOptions, cb:(err:Error, matches:string[])=>void):void;
15+
function G(pattern: string, cb: (err: Error, matches: string[]) => void): void;
16+
function G(pattern: string, options: G.IOptions, cb: (err: Error, matches: string[]) => void): void;
1717

1818
module G {
19-
function sync(pattern:string, options?:IOptions):string[];
19+
function sync(pattern: string, options?: IOptions): string[];
20+
21+
function hasMagic(pattern: string, options?: IOptions): boolean;
2022

21-
var Glob:IGlobStatic;
23+
var Glob: IGlobStatic;
24+
var GlobSync: IGlobSyncStatic;
2225

2326
interface IOptions extends minimatch.IOptions {
2427
cwd?: string;
25-
sync?: boolean;
28+
root?: string;
29+
dot?: boolean;
2630
nomount?: boolean;
27-
matchBase?:any;
28-
noglobstar?:any;
31+
mark?: boolean;
32+
nosort?: boolean;
33+
stat?: boolean;
34+
silent?: boolean;
2935
strict?: boolean;
30-
dot?:boolean;
31-
mark?:boolean;
32-
nounique?:boolean;
33-
nonull?:boolean;
34-
nosort?:boolean;
35-
nocase?:boolean;
36-
stat?:boolean;
37-
debug?:boolean;
38-
globDebug?:boolean;
39-
silent?:boolean;
36+
cache?: { [path: string]: any /* boolean | string | string[] */ };
37+
statCache?: { [path: string]: fs.Stats };
38+
symlinks?: any;
39+
sync?: boolean;
40+
nounique?: boolean;
41+
nonull?: boolean;
42+
debug?: boolean;
43+
nobrace?: boolean;
44+
noglobstar?: boolean;
45+
noext?: boolean;
46+
nocase?: boolean;
47+
matchBase?: any;
48+
nodir?: boolean;
49+
ignore?: any; /* string | string[] */
50+
follow?: boolean;
51+
realpath?: boolean;
52+
nonegate?: boolean;
53+
nocomment?: boolean;
54+
55+
/** Deprecated. */
56+
globDebug?: boolean;
4057
}
4158

4259
interface IGlobStatic extends events.EventEmitter {
43-
new (pattern:string, cb?:(err:Error, matches:string[])=>void):IGlob;
44-
new (pattern:string, options:any, cb?:(err:Error, matches:string[])=>void):IGlob;
60+
new (pattern: string, cb?: (err: Error, matches: string[]) => void): IGlob;
61+
new (pattern: string, options: IOptions, cb?: (err: Error, matches: string[]) => void): IGlob;
62+
prototype: IGlob;
63+
}
64+
65+
interface IGlobSyncStatic {
66+
new (pattern: string, options?: IOptions): IGlobBase
67+
prototype: IGlobBase;
4568
}
4669

47-
interface IGlob {
48-
EOF:any;
49-
paused:boolean;
50-
maxDepth:number;
51-
maxLength:number;
52-
cache:any;
53-
statCache:any;
54-
changedCwd:boolean;
70+
interface IGlobBase {
71+
minimatch: minimatch.IMinimatch;
72+
options: IOptions;
73+
aborted: boolean;
74+
cache: { [path: string]: any /* boolean | string | string[] */ };
75+
statCache: { [path: string]: fs.Stats };
76+
symlinks: { [path: string]: boolean };
77+
realpathCache: { [path: string]: string };
78+
found: string[];
79+
}
80+
81+
interface IGlob extends IGlobBase, events.EventEmitter {
82+
pause(): void;
83+
resume(): void;
84+
abort(): void;
85+
86+
/** Deprecated. */
87+
EOF: any;
88+
/** Deprecated. */
89+
paused: boolean;
90+
/** Deprecated. */
91+
maxDepth: number;
92+
/** Deprecated. */
93+
maxLength: number;
94+
/** Deprecated. */
95+
changedCwd: boolean;
96+
/** Deprecated. */
5597
cwd: string;
98+
/** Deprecated. */
5699
root: string;
100+
/** Deprecated. */
57101
error: any;
58-
aborted: boolean;
59-
minimatch: minimatch.IMinimatch;
60-
matches:string[];
61-
62-
log(...args:any[]):void;
63-
abort():void;
64-
pause():void;
65-
resume():void;
66-
emitMatch(m:any):void;
102+
/** Deprecated. */
103+
matches: string[];
104+
/** Deprecated. */
105+
log(...args: any[]): void;
106+
/** Deprecated. */
107+
emitMatch(m: any): void;
67108
}
68109
}
69110

70-
export = G;
111+
export = G;
71112
}

minimatch/minimatch-tests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var r = m.makeRe();
1212
var f = ["test.ts"];
1313
mm.match(f, pattern, options);
1414

15-
mm.filter('foo')('bar');
15+
f.filter(mm.filter(pattern, options));
1616

1717
var s: string = "hello";
1818
var b: boolean = mm(s, pattern, options);

minimatch/minimatch.d.ts

Lines changed: 44 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,64 @@
1-
// Type definitions for Minimatch 1.0.0
1+
// Type definitions for Minimatch 2.0.8
22
// Project: https://github.com/isaacs/minimatch
33
// Definitions by: vvakame <https://github.com/vvakame/>
44
// Definitions: https://github.com/borisyankov/DefinitelyTyped
55

66
declare module "minimatch" {
77

8-
function M(target:string, pattern:string, options?:M.IOptions): boolean;
8+
function M(target: string, pattern: string, options?: M.IOptions): boolean;
99

1010
module M {
11-
function match(filenames:string[], pattern:string, options?:IOptions):string[];
12-
function filter(pattern:string, options?:IOptions): (target: string) => boolean;
13-
14-
var Minimatch:IMinimatchStatic;
11+
function match(list: string[], pattern: string, options?: IOptions): string[];
12+
function filter(pattern: string, options?: IOptions): (element: string, indexed: number, array: string[]) => boolean;
13+
function makeRe(pattern: string, options?: IOptions): RegExp;
1514

15+
var Minimatch: IMinimatchStatic;
16+
1617
interface IOptions {
17-
debug?:boolean;
18-
nobrace?:boolean;
19-
noglobstar?:boolean;
20-
dot?:boolean;
21-
noext?:boolean;
22-
nocase?:boolean;
23-
nonull?:boolean;
24-
matchBase?:boolean;
25-
nocomment?:boolean;
26-
nonegate?:boolean;
27-
flipNegate?:boolean;
18+
debug?: boolean;
19+
nobrace?: boolean;
20+
noglobstar?: boolean;
21+
dot?: boolean;
22+
noext?: boolean;
23+
nocase?: boolean;
24+
nonull?: boolean;
25+
matchBase?: boolean;
26+
nocomment?: boolean;
27+
nonegate?: boolean;
28+
flipNegate?: boolean;
2829
}
2930

3031
interface IMinimatchStatic {
31-
new (pattern:string, options?:IOptions):IMinimatch;
32+
new (pattern: string, options?: IOptions): IMinimatch;
33+
prototype: IMinimatch;
3234
}
3335

3436
interface IMinimatch {
35-
debug():void;
36-
make():void;
37-
parseNegate():void;
38-
braceExpand(pattern:string, options:IOptions):void;
39-
parse(pattern:string, isSub?:boolean):void;
40-
makeRe():RegExp; // regexp or boolean
41-
match(file:string):boolean;
42-
matchOne(files:string[], pattern:string[], partial:any):boolean;
37+
pattern: string;
38+
options: IOptions;
39+
/** 2-dimensional array of regexp or string expressions. */
40+
set: any[][]; // (RegExp | string)[][]
41+
regexp: RegExp;
42+
negate: boolean;
43+
comment: boolean;
44+
empty: boolean;
45+
46+
makeRe(): RegExp; // regexp or boolean
47+
match(fname: string): boolean;
48+
matchOne(files: string[], pattern: string[], partial: boolean): boolean;
49+
50+
/** Deprecated. For internal use. */
51+
debug(): void;
52+
/** Deprecated. For internal use. */
53+
make(): void;
54+
/** Deprecated. For internal use. */
55+
parseNegate(): void;
56+
/** Deprecated. For internal use. */
57+
braceExpand(pattern: string, options: IOptions): void;
58+
/** Deprecated. For internal use. */
59+
parse(pattern: string, isSub?: boolean): void;
4360
}
4461
}
4562

46-
export = M;
63+
export = M;
4764
}

0 commit comments

Comments
 (0)