diff options
author | isaacs <i@izs.me> | 2012-06-15 10:00:30 -0700 |
---|---|---|
committer | isaacs <i@izs.me> | 2012-06-15 10:00:30 -0700 |
commit | 911b0fddd3483ac58c3a5cec17f4f1b0e533521a (patch) | |
tree | 23fdfe46b166bdcb6ebc3e040a14f9c3faf9c441 /deps/npm/node_modules/minimatch | |
parent | 1e0ce5d1bdf364bf6eca821635e3ae8e65807667 (diff) | |
download | node-new-911b0fddd3483ac58c3a5cec17f4f1b0e533521a.tar.gz |
Upgrade npm to 1.1.26
Diffstat (limited to 'deps/npm/node_modules/minimatch')
-rw-r--r-- | deps/npm/node_modules/minimatch/minimatch.js | 76 | ||||
-rw-r--r-- | deps/npm/node_modules/minimatch/package.json | 12 |
2 files changed, 77 insertions, 11 deletions
diff --git a/deps/npm/node_modules/minimatch/minimatch.js b/deps/npm/node_modules/minimatch/minimatch.js index 1ca08104ee..00873594b5 100644 --- a/deps/npm/node_modules/minimatch/minimatch.js +++ b/deps/npm/node_modules/minimatch/minimatch.js @@ -1,4 +1,32 @@ -module.exports = minimatch +;(function (require, exports, module, platform) { + +if (module) module.exports = minimatch +else exports.minimatch = minimatch + +if (!require) { + require = function (id) { + switch (id) { + case "path": return { basename: function (f) { + f = f.split(/[\/\\]/) + var e = f.pop() + if (!e) e = f.pop() + return e + }} + case "lru-cache": return function LRUCache () { + // not quite an LRU, but still space-limited. + var cache = {} + var cnt = 0 + this.set = function (k, v) { + cnt ++ + if (cnt >= 100) cache = {} + cache[k] = v + } + this.get = function (k) { return cache[k] } + } + } + } +} + minimatch.Minimatch = Minimatch var LRU = require("lru-cache") @@ -55,6 +83,41 @@ function filter (pattern, options) { } } +function ext (a, b) { + a = a || {} + b = b || {} + var t = {} + Object.keys(b).forEach(function (k) { + t[k] = b[k] + }) + Object.keys(a).forEach(function (k) { + t[k] = a[k] + }) + return t +} + +minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return minimatch + + var orig = minimatch + + var m = function minimatch (p, pattern, options) { + return orig.minimatch(p, pattern, ext(def, options)) + } + + m.Minimatch = function Minimatch (pattern, options) { + return new orig.Minimatch(pattern, ext(def, options)) + } + + return m +} + +Minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return Minimatch + return minimatch.defaults(def).Minimatch +} + + function minimatch (p, pattern, options) { if (typeof pattern !== "string") { throw new TypeError("glob pattern string required") @@ -768,12 +831,9 @@ function match (f, partial) { var options = this.options - // first, normalize any slash-separated path parts. - // f = path.normalize(f) - // windows: need to use /, not \ // On other platforms, \ is a valid (albeit bad) filename char. - if (process.platform === "win32") { + if (platform === "win32") { f = f.split("\\").join("/") } @@ -984,3 +1044,9 @@ function globUnescape (s) { function regExpEscape (s) { return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&") } + +})( typeof require === "function" ? require : null, + this, + typeof module === "object" ? module : null, + typeof process === "object" ? process.platform : "win32" + ) diff --git a/deps/npm/node_modules/minimatch/package.json b/deps/npm/node_modules/minimatch/package.json index 1bcb3d43e6..2f24186031 100644 --- a/deps/npm/node_modules/minimatch/package.json +++ b/deps/npm/node_modules/minimatch/package.json @@ -6,7 +6,7 @@ }, "name": "minimatch", "description": "a glob matcher in javascript", - "version": "0.2.2", + "version": "0.2.5", "repository": { "type": "git", "url": "git://github.com/isaacs/minimatch.git" @@ -19,7 +19,7 @@ "node": "*" }, "dependencies": { - "lru-cache": "~1.0.5" + "lru-cache": "~1" }, "devDependencies": { "tap": "" @@ -34,11 +34,11 @@ "name": "isaacs", "email": "i@izs.me" }, - "_id": "minimatch@0.2.2", + "_id": "minimatch@0.2.5", "optionalDependencies": {}, "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.7.7-pre", + "_npmVersion": "1.1.25", + "_nodeVersion": "v0.7.10-pre", "_defaultsLoaded": true, - "_from": "minimatch@0" + "_from": "minimatch@~0.2" } |