diff --git a/README.md b/README.md index 0e8ca78c5..4120a354e 100755 --- a/README.md +++ b/README.md @@ -100,6 +100,7 @@ List of Definitions * [Gamepad](http://www.w3.org/TR/gamepad/) (by [Kon](http://phyzkit.net/)) * [Giraffe](https://github.com/barc/backbone.giraffe) (by [Matt McCray](https://github.com/darthapo)) * [glDatePicker](http://glad.github.com/glDatePicker/) (by [Dániel Tar](https://github.com/qcz)) +* [Glob](https://github.com/isaacs/node-glob) (by [vvakame](https://github.com/vvakame)) * [GoJS](http://gojs.net/) (by [Barbara Duckworth](https://github.com/barbara42)) * [Greasemonkey](http://www.greasespot.net/) (by [Kota Saito](https://github.com/kotas)) * [GreenSock Animation Platform (GSAP)](http://www.greensock.com/get-started-js/) (by [Robert S.](https://github.com/codeBelt)) @@ -211,6 +212,7 @@ List of Definitions * [mCustomScrollbar](https://github.com/malihu/malihu-custom-scrollbar-plugin) (by [Sarah Williams](https://github.com/flurg)) * [Meteor](https://www.meteor.com) (by [Dave Allen](https://github.com/fullflavedave)) * [Microsoft Live Connect](http://msdn.microsoft.com/en-us/library/live/hh243643.aspx) (by [John Vilk](https://github.com/jvilk)) +* [Minimatch](https://github.com/isaacs/minimatch) (by [vvakame](https://github.com/vvakame)) * [minimist](https://github.com/substack/minimist) (by [Bart van der Schoor](https://github.com/Bartvds)) * [mixto](https://github.com/atom/mixto) (by [vvakame](https://github.com/vvakame)) * [Modernizr](http://modernizr.com/) (by [Boris Yankov](https://github.com/borisyankov) and [Theodore Brown](https://github.com/theodorejb/)) diff --git a/glob/glob-tests.ts b/glob/glob-tests.ts new file mode 100644 index 000000000..af5ecf6d0 --- /dev/null +++ b/glob/glob-tests.ts @@ -0,0 +1,24 @@ +/// + +import glob = require("glob"); +var Glob = glob.Glob; + +(()=> { + var pattern = "test/a/**/[cg]/../[cg]"; + console.log(pattern); + + var mg = new Glob(pattern, {mark: true, sync: true}, function (er, matches) { + console.log("matches", matches) + }); + console.log("after") +})(); + +(()=> { + var pattern = "{./*/*,/*,/usr/local/*}"; + console.log(pattern); + + var mg = new Glob(pattern, {mark: true}, function (er, matches) { + console.log("matches", matches) + }); + console.log("after") +})(); diff --git a/glob/glob.d.ts b/glob/glob.d.ts new file mode 100644 index 000000000..46ab16e0a --- /dev/null +++ b/glob/glob.d.ts @@ -0,0 +1,70 @@ +// Type definitions for Glob +// Project: https://github.com/isaacs/node-glob +// Definitions by: vvakame +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module "glob" { + + import events = require("events"); + 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; + + module G { + function sync(pattern:string, options?:IOptions):string[]; + + var Glob:IGlobStatic; + + interface IOptions extends minimatch.IOptions { + sync?: boolean; + nomount?: boolean; + matchBase?:any; + noglobstar?:any; + strict?: boolean; + dot?:boolean; + mark?:boolean; + nounique?:boolean; + nonull?:boolean; + nosort?:boolean; + nocase?:boolean; + stat?:boolean; + debug?:boolean; + globDebug?:boolean; + silent?: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; + } + + 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[]; + + log(...args:any[]):void; + abort():void; + pause():void; + resume():void; + emitMatch(m:any):void; + } + } + +export = G; +} diff --git a/minimatch/minimatch-tests.ts b/minimatch/minimatch-tests.ts new file mode 100644 index 000000000..b50471826 --- /dev/null +++ b/minimatch/minimatch-tests.ts @@ -0,0 +1,13 @@ +/// + +import mm = require("minimatch"); + +var pattern = "**/*.ts"; +var options = { + debug: true +}; +var m = new mm.Minimatch(pattern, options); +var r = m.makeRe(); + +var f = "test.ts"; +mm.match(f, pattern, options); diff --git a/minimatch/minimatch.d.ts b/minimatch/minimatch.d.ts new file mode 100644 index 000000000..588e93535 --- /dev/null +++ b/minimatch/minimatch.d.ts @@ -0,0 +1,46 @@ +// Type definitions for Minimatch +// Project: https://github.com/isaacs/minimatch +// Definitions by: vvakame +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "minimatch" { + + function M(target:string, pattern:string, options?:M.IOptions):void; + + module M { + function match(filename:string, pattern:string, options:IOptions):boolean; + + 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; + } + + interface IMinimatchStatic { + new (pattern:string, options:IOptions):IMinimatch; + } + + interface IMinimatch { + debug():void; + make():void; + parseNegate():void; + braceExpand(pattern:string, options:IOptions):void; + parse(pattern:string, isSub?:boolean):void; + makeRe():any; // regexp or boolean + match(file:string, pattern:string, options:IOptions):boolean; + matchOne(file:string, pattern:string, partial:any):boolean; + } + } + + export = M; +}