Merge pull request #4723 from itokentr/master

Update glob and minimatch
This commit is contained in:
Masahiro Wakame
2015-06-27 13:28:15 +09:00
3 changed files with 127 additions and 69 deletions
+82 -41
View File
@@ -1,4 +1,4 @@
// Type definitions for Glob
// Type definitions for Glob 5.0.10
// Project: https://github.com/isaacs/node-glob
// Definitions by: vvakame <https://github.com/vvakame/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -9,63 +9,104 @@
declare module "glob" {
import events = require("events");
import fs = require('fs');
import minimatch = require("minimatch");
function G(pattern:string, cb:(err:Error, matches:string[])=>void):void;
function G(pattern:string, options:G.IOptions, cb:(err:Error, matches:string[])=>void):void;
function G(pattern: string, cb: (err: Error, matches: string[]) => void): void;
function G(pattern: string, options: G.IOptions, cb: (err: Error, matches: string[]) => void): void;
module G {
function sync(pattern:string, options?:IOptions):string[];
function sync(pattern: string, options?: IOptions): string[];
var Glob:IGlobStatic;
function hasMagic(pattern: string, options?: IOptions): boolean;
var Glob: IGlobStatic;
var GlobSync: IGlobSyncStatic;
interface IOptions extends minimatch.IOptions {
cwd?: string;
sync?: boolean;
root?: string;
dot?: boolean;
nomount?: boolean;
matchBase?:any;
noglobstar?:any;
mark?: boolean;
nosort?: boolean;
stat?: boolean;
silent?: boolean;
strict?: boolean;
dot?:boolean;
mark?:boolean;
nounique?:boolean;
nonull?:boolean;
nosort?:boolean;
nocase?:boolean;
stat?:boolean;
debug?:boolean;
globDebug?:boolean;
silent?:boolean;
cache?: { [path: string]: any /* boolean | string | string[] */ };
statCache?: { [path: string]: fs.Stats };
symlinks?: any;
sync?: boolean;
nounique?: boolean;
nonull?: boolean;
debug?: boolean;
nobrace?: boolean;
noglobstar?: boolean;
noext?: boolean;
nocase?: boolean;
matchBase?: any;
nodir?: boolean;
ignore?: any; /* string | string[] */
follow?: boolean;
realpath?: boolean;
nonegate?: boolean;
nocomment?: boolean;
/** Deprecated. */
globDebug?: boolean;
}
interface IGlobStatic extends events.EventEmitter {
new (pattern:string, cb?:(err:Error, matches:string[])=>void):IGlob;
new (pattern:string, options:any, cb?:(err:Error, matches:string[])=>void):IGlob;
new (pattern: string, cb?: (err: Error, matches: string[]) => void): IGlob;
new (pattern: string, options: IOptions, cb?: (err: Error, matches: string[]) => void): IGlob;
prototype: IGlob;
}
interface IGlob {
EOF:any;
paused:boolean;
maxDepth:number;
maxLength:number;
cache:any;
statCache:any;
changedCwd:boolean;
cwd: string;
root: string;
error: any;
aborted: boolean;
minimatch: minimatch.IMinimatch;
matches:string[];
interface IGlobSyncStatic {
new (pattern: string, options?: IOptions): IGlobBase
prototype: IGlobBase;
}
log(...args:any[]):void;
abort():void;
pause():void;
resume():void;
emitMatch(m:any):void;
interface IGlobBase {
minimatch: minimatch.IMinimatch;
options: IOptions;
aborted: boolean;
cache: { [path: string]: any /* boolean | string | string[] */ };
statCache: { [path: string]: fs.Stats };
symlinks: { [path: string]: boolean };
realpathCache: { [path: string]: string };
found: string[];
}
interface IGlob extends IGlobBase, events.EventEmitter {
pause(): void;
resume(): void;
abort(): void;
/** Deprecated. */
EOF: any;
/** Deprecated. */
paused: boolean;
/** Deprecated. */
maxDepth: number;
/** Deprecated. */
maxLength: number;
/** Deprecated. */
changedCwd: boolean;
/** Deprecated. */
cwd: string;
/** Deprecated. */
root: string;
/** Deprecated. */
error: any;
/** Deprecated. */
matches: string[];
/** Deprecated. */
log(...args: any[]): void;
/** Deprecated. */
emitMatch(m: any): void;
}
}
export = G;
export = G;
}
+1 -1
View File
@@ -12,7 +12,7 @@ var r = m.makeRe();
var f = ["test.ts"];
mm.match(f, pattern, options);
mm.filter('foo')('bar');
f.filter(mm.filter(pattern, options));
var s: string = "hello";
var b: boolean = mm(s, pattern, options);
+44 -27
View File
@@ -1,47 +1,64 @@
// Type definitions for Minimatch 1.0.0
// Type definitions for Minimatch 2.0.8
// Project: https://github.com/isaacs/minimatch
// Definitions by: vvakame <https://github.com/vvakame/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "minimatch" {
function M(target:string, pattern:string, options?:M.IOptions): boolean;
function M(target: string, pattern: string, options?: M.IOptions): boolean;
module M {
function match(filenames:string[], pattern:string, options?:IOptions):string[];
function filter(pattern:string, options?:IOptions): (target: string) => boolean;
var Minimatch:IMinimatchStatic;
function match(list: string[], pattern: string, options?: IOptions): string[];
function filter(pattern: string, options?: IOptions): (element: string, indexed: number, array: string[]) => boolean;
function makeRe(pattern: string, options?: IOptions): RegExp;
var Minimatch: IMinimatchStatic;
interface IOptions {
debug?:boolean;
nobrace?:boolean;
noglobstar?:boolean;
dot?:boolean;
noext?:boolean;
nocase?:boolean;
nonull?:boolean;
matchBase?:boolean;
nocomment?:boolean;
nonegate?:boolean;
flipNegate?:boolean;
debug?: boolean;
nobrace?: boolean;
noglobstar?: boolean;
dot?: boolean;
noext?: boolean;
nocase?: boolean;
nonull?: boolean;
matchBase?: boolean;
nocomment?: boolean;
nonegate?: boolean;
flipNegate?: boolean;
}
interface IMinimatchStatic {
new (pattern:string, options?:IOptions):IMinimatch;
new (pattern: string, options?: IOptions): IMinimatch;
prototype: IMinimatch;
}
interface IMinimatch {
debug():void;
make():void;
parseNegate():void;
braceExpand(pattern:string, options:IOptions):void;
parse(pattern:string, isSub?:boolean):void;
makeRe():RegExp; // regexp or boolean
match(file:string):boolean;
matchOne(files:string[], pattern:string[], partial:any):boolean;
pattern: string;
options: IOptions;
/** 2-dimensional array of regexp or string expressions. */
set: any[][]; // (RegExp | string)[][]
regexp: RegExp;
negate: boolean;
comment: boolean;
empty: boolean;
makeRe(): RegExp; // regexp or boolean
match(fname: string): boolean;
matchOne(files: string[], pattern: string[], partial: boolean): boolean;
/** Deprecated. For internal use. */
debug(): void;
/** Deprecated. For internal use. */
make(): void;
/** Deprecated. For internal use. */
parseNegate(): void;
/** Deprecated. For internal use. */
braceExpand(pattern: string, options: IOptions): void;
/** Deprecated. For internal use. */
parse(pattern: string, isSub?: boolean): void;
}
}
export = M;
export = M;
}