diff --git a/node_modules/minimatch/README.md b/node_modules/minimatch/README.md index d5f9723..6fd07d2 100644 --- a/node_modules/minimatch/README.md +++ b/node_modules/minimatch/README.md @@ -60,11 +60,12 @@ thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but `a/**b` will not. **Note that this is different from the way that `**` is handled by ruby's `Dir` class.** -If an escaped pattern has no matches, and the `null` flag is not set, +If an escaped pattern has no matches, and the `nonull` flag is set, then minimatch.match returns the pattern as-provided, rather than interpreting the character escapes. For example, `minimatch.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than -`"*a?"`. +`"*a?"`. This is akin to setting the `nullglob` option in bash, except +that it does not resolve escaped pattern characters. If brace expansion is not disabled, then it is performed before any other interpretation of the glob pattern. Thus, a pattern like @@ -147,8 +148,8 @@ var javascripts = fileList.filter(minimatch.filter("*.js", {matchBase: true})) ### minimatch.match(list, pattern, options) Match against the list of -files, in the style of fnmatch or glob. If nothing is matched, then -return the pattern (unless `{ null: true }` in the options.) +files, in the style of fnmatch or glob. If nothing is matched, and +options.nonull is set, then return a list containing the pattern itself. ```javascript var javascripts = minimatch.match(fileList, "*.js", {matchBase: true})) @@ -210,3 +211,8 @@ comment. ### nonegate Suppress the behavior of treating a leading `!` character as negation. + +### flipNegate + +Returns from negate expressions the same as if they were not negated. +(Ie, true on a hit, false on a miss.) diff --git a/node_modules/minimatch/minimatch.js b/node_modules/minimatch/minimatch.js index 5ca6008..1ca0810 100644 --- a/node_modules/minimatch/minimatch.js +++ b/node_modules/minimatch/minimatch.js @@ -4,7 +4,6 @@ minimatch.Minimatch = Minimatch var LRU = require("lru-cache") , cache = minimatch.cache = new LRU(100) , GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} - , pathSplit = process.platform === "win32" ? /\\|\// : "/" var path = require("path") // any single thing other than / @@ -130,7 +129,7 @@ function make () { this.parseNegate() // step 2: expand braces - var set = this.braceExpand() + var set = this.globSet = this.braceExpand() if (options.debug) console.error(this.pattern, set) @@ -139,7 +138,7 @@ function make () { // These will be regexps, except in the case of "**", which is // set to the GLOBSTAR object for globstar behavior, // and will not contain any / characters - set = set.map(function (s) { + set = this.globParts = set.map(function (s) { return s.split(slashSplit) }) @@ -159,36 +158,6 @@ function make () { if (options.debug) console.error(this.pattern, set) - // step 4: if we have a defined root, then patterns starting with "" - // get attached to that. If we have a defined cwd, then patterns - // *not* starting with "" get attached to that. - // Exception 1: on windows, a pattern like //\?/c:/ or c:/ will - // not get anything prefixed to it. - // Exception 2: If matchBase is set, and it's just a filename, - // then don't prefix anything onto it, since it'll only match - // files with that basename anyhow. - set = set.map(function (p) { - if (process.platform === "win32" && - ( (p[0] === "" && p[1] === "" && p[2] === "\\?") // unc - || (typeof p[0] === "string" && p[0].match(/^[a-zA-Z]:$/)) )) { - return p - } - if (options.matchBase && p.length === 1) return p - // do prefixing. - if (options.root && p[0] === "") { - var r = options.root.split(pathSplit) - if (r[r.length - 1] === "") r.pop() - r = r.concat(p.slice(1)) - r.absolute = true - return r - } - if (options.cwd && p[0] !== "") { - return options.cwd.split(pathSplit).concat(p) - } - return p - }) - - this.set = set } @@ -549,7 +518,8 @@ function parse (pattern, isSub) { patternListStack.push({ type: plType , start: i - 1 , reStart: re.length }) - re += stateChar === "!" ? "(?!" : "(?:" + // negation is (?:(?!js)[^/]*) + re += stateChar === "!" ? "(?:(?!" : "(?:" stateChar = false continue @@ -562,11 +532,15 @@ function parse (pattern, isSub) { hasMagic = true re += ")" plType = patternListStack.pop().type + // negation is (?:(?!js)[^/]*) + // The others are (?:) switch (plType) { + case "!": + re += "[^/]*?)" + break case "?": case "+": case "*": re += plType - case "!": // already handled by the start case "@": break // the default anyway } continue @@ -821,12 +795,14 @@ function match (f, partial) { var pattern = set[i] var hit = this.matchOne(f, pattern, partial) if (hit) { + if (options.flipNegate) return true return !this.negate } } // didn't get any hits. this is success if it's a negative // pattern, failure otherwise. + if (options.flipNegate) return false return this.negate } diff --git a/node_modules/minimatch/node_modules/lru-cache/README.md b/node_modules/minimatch/node_modules/lru-cache/README.md index 1f5f155..0f3908d 100644 --- a/node_modules/minimatch/node_modules/lru-cache/README.md +++ b/node_modules/minimatch/node_modules/lru-cache/README.md @@ -9,4 +9,6 @@ Usage: cache.set("key", "value") cache.get("key") // "value" + cache.reset() // empty the cache + RTFS for more info. diff --git a/node_modules/minimatch/node_modules/lru-cache/lib/lru-cache.js b/node_modules/minimatch/node_modules/lru-cache/lib/lru-cache.js index ca7a2b3..c3e4feb 100644 --- a/node_modules/minimatch/node_modules/lru-cache/lib/lru-cache.js +++ b/node_modules/minimatch/node_modules/lru-cache/lib/lru-cache.js @@ -49,6 +49,12 @@ function LRUCache (maxLength) { length = 0 } + // Provided for debugging/dev purposes only. No promises whatsoever that + // this API stays stable. + this.dump = function () { + return cache + } + this.set = function (key, value) { if (hOP(cache, key)) { this.get(key) diff --git a/node_modules/minimatch/node_modules/lru-cache/package.json b/node_modules/minimatch/node_modules/lru-cache/package.json index f302c5e..de130cd 100644 --- a/node_modules/minimatch/node_modules/lru-cache/package.json +++ b/node_modules/minimatch/node_modules/lru-cache/package.json @@ -1,7 +1,7 @@ { "name": "lru-cache", "description": "A cache object that deletes the least-recently-used items.", - "version": "1.0.5", + "version": "1.0.6", "author": { "name": "Isaac Z. Schlueter", "email": "i@izs.me" @@ -15,7 +15,7 @@ "url": "git://github.com/isaacs/node-lru-cache.git" }, "devDependencies": { - "tap": "0.1" + "tap": "0" }, "license": { "type": "MIT", @@ -25,7 +25,7 @@ "name": "tootallnate", "email": "nathan@tootallnate.net" }, - "_id": "lru-cache@1.0.5", + "_id": "lru-cache@1.0.6", "dependencies": {}, "optionalDependencies": {}, "engines": { @@ -35,5 +35,8 @@ "_npmVersion": "1.1.10", "_nodeVersion": "v0.6.13", "_defaultsLoaded": true, + "dist": { + "shasum": "47185f692737aa51dfe04145776fcc27d225e22a" + }, "_from": "lru-cache@~1.0.5" } diff --git a/node_modules/minimatch/node_modules/lru-cache/test/basic.js b/node_modules/minimatch/node_modules/lru-cache/test/basic.js deleted file mode 100644 index d726cbf..0000000 --- a/node_modules/minimatch/node_modules/lru-cache/test/basic.js +++ /dev/null @@ -1,93 +0,0 @@ -var test = require('tap').test - , LRU = require('../') - -test('basic', function (t) { - var cache = new LRU(10) - cache.set("key", "value") - t.equal(cache.get("key"), "value") - t.equal(cache.get("nada"), undefined) - t.equal(cache.length, 1) - t.equal(cache.maxLength, 10) - t.end() -}) - -test('least recently set', function (t) { - var cache = new LRU(2) - cache.set("a", "A") - cache.set("b", "B") - cache.set("c", "C") - t.equal(cache.get("c"), "C") - t.equal(cache.get("b"), "B") - t.equal(cache.get("a"), undefined) - t.end() -}) - -test('lru recently gotten', function (t) { - var cache = new LRU(2) - cache.set("a", "A") - cache.set("b", "B") - cache.get("a") - cache.set("c", "C") - t.equal(cache.get("c"), "C") - t.equal(cache.get("b"), undefined) - t.equal(cache.get("a"), "A") - t.end() -}) - -test('del', function (t) { - var cache = new LRU(2) - cache.set("a", "A") - cache.del("a") - t.equal(cache.get("a"), undefined) - t.end() -}) - -test('maxLength', function (t) { - var cache = new LRU(3) - - // test changing the maxLength, verify that the LRU items get dropped. - cache.maxLength = 100 - for (var i = 0; i < 100; i ++) cache.set(i, i) - t.equal(cache.length, 100) - for (var i = 0; i < 100; i ++) { - t.equal(cache.get(i), i) - } - cache.maxLength = 3 - t.equal(cache.length, 3) - for (var i = 0; i < 97; i ++) { - t.equal(cache.get(i), undefined) - } - for (var i = 98; i < 100; i ++) { - t.equal(cache.get(i), i) - } - - // now remove the maxLength restriction, and try again. - cache.maxLength = "hello" - for (var i = 0; i < 100; i ++) cache.set(i, i) - t.equal(cache.length, 100) - for (var i = 0; i < 100; i ++) { - t.equal(cache.get(i), i) - } - // should trigger an immediate resize - cache.maxLength = 3 - t.equal(cache.length, 3) - for (var i = 0; i < 97; i ++) { - t.equal(cache.get(i), undefined) - } - for (var i = 98; i < 100; i ++) { - t.equal(cache.get(i), i) - } - t.end() -}) - -test('reset', function (t) { - var cache = new LRU(10) - cache.set("a", "A") - cache.set("b", "B") - cache.reset() - t.equal(cache.length, 0) - t.equal(cache.maxLength, 10) - t.equal(cache.get("a"), undefined) - t.equal(cache.get("b"), undefined) - t.end() -}) diff --git a/node_modules/minimatch/package.json b/node_modules/minimatch/package.json index 06a67d9..c5ad178 100644 --- a/node_modules/minimatch/package.json +++ b/node_modules/minimatch/package.json @@ -6,7 +6,7 @@ }, "name": "minimatch", "description": "a glob matcher in javascript", - "version": "0.1.5", + "version": "0.2.2", "repository": { "type": "git", "url": "git://github.com/isaacs/minimatch.git" @@ -22,7 +22,7 @@ "lru-cache": "~1.0.5" }, "devDependencies": { - "tap": "~0.1.3" + "tap": "" }, "licenses": [ { @@ -34,11 +34,14 @@ "name": "tootallnate", "email": "nathan@tootallnate.net" }, - "_id": "minimatch@0.1.5", + "_id": "minimatch@0.2.2", "optionalDependencies": {}, "_engineSupported": true, "_npmVersion": "1.1.10", "_nodeVersion": "v0.6.13", "_defaultsLoaded": true, - "_from": "minimatch@~0.1.4" + "dist": { + "shasum": "3107f561f91a8d96d58b172d442e439787b25d68" + }, + "_from": "minimatch@0.2.x" } diff --git a/node_modules/minimatch/test/basic.js b/node_modules/minimatch/test/basic.js deleted file mode 100644 index 06d9428..0000000 --- a/node_modules/minimatch/test/basic.js +++ /dev/null @@ -1,261 +0,0 @@ -// http://www.bashcookbook.com/bashinfo/source/bash-1.14.7/tests/glob-test -// -// TODO: Some of these tests do very bad things with backslashes, and will -// most likely fail badly on windows. They should probably be skipped. - -var tap = require("tap") - , globalBefore = Object.keys(global) - , mm = require("../") - , files = [ "a", "b", "c", "d", "abc" - , "abd", "abe", "bb", "bcd" - , "ca", "cb", "dd", "de" - , "bdir/", "bdir/cfile"] - , next = files.concat([ "a-b", "aXb" - , ".x", ".y" ]) - -tap.test("basic tests", function (t) { - var start = Date.now() - - // [ pattern, [matches], MM opts, files, TAP opts] - ; [ "http://www.bashcookbook.com/bashinfo" + - "/source/bash-1.14.7/tests/glob-test" - , ["a*", ["a", "abc", "abd", "abe"]] - , ["X*", ["X*"], {nonull: true}] - - // allow null glob expansion - , ["X*", []] - - // isaacs: Slightly different than bash/sh/ksh - // \\* is not un-escaped to literal "*" in a failed match, - // but it does make it get treated as a literal star - , ["\\*", ["\\*"], {nonull: true}] - , ["\\**", ["\\**"], {nonull: true}] - , ["\\*\\*", ["\\*\\*"], {nonull: true}] - - , ["b*/", ["bdir/"]] - , ["c*", ["c", "ca", "cb"]] - , ["**", files] - - , ["\\.\\./*/", ["\\.\\./*/"], {nonull: true}] - , ["s/\\..*//", ["s/\\..*//"], {nonull: true}] - - , "legendary larry crashes bashes" - , ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\\1/" - , ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\\1/"], {nonull: true}] - , ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\1/" - , ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\1/"], {nonull: true}] - - , "character classes" - , ["[a-c]b*", ["abc", "abd", "abe", "bb", "cb"]] - , ["[a-y]*[^c]", ["abd", "abe", "bb", "bcd", - "bdir/", "ca", "cb", "dd", "de"]] - , ["a*[^c]", ["abd", "abe"]] - , function () { files.push("a-b", "aXb") } - , ["a[X-]b", ["a-b", "aXb"]] - , function () { files.push(".x", ".y") } - , ["[^a-c]*", ["d", "dd", "de"]] - , function () { files.push("a*b/", "a*b/ooo") } - , ["a\\*b/*", ["a*b/ooo"]] - , ["a\\*?/*", ["a*b/ooo"]] - , ["*\\\\!*", [], {null: true}, ["echo !7"]] - , ["*\\!*", ["echo !7"], null, ["echo !7"]] - , ["*.\\*", ["r.*"], null, ["r.*"]] - , ["a[b]c", ["abc"]] - , ["a[\\b]c", ["abc"]] - , ["a?c", ["abc"]] - , ["a\\*c", [], {null: true}, ["abc"]] - , ["", [""], { null: true }, [""]] - - , "http://www.opensource.apple.com/source/bash/bash-23/" + - "bash/tests/glob-test" - , function () { files.push("man/", "man/man1/", "man/man1/bash.1") } - , ["*/man*/bash.*", ["man/man1/bash.1"]] - , ["man/man1/bash.1", ["man/man1/bash.1"]] - , ["a***c", ["abc"], null, ["abc"]] - , ["a*****?c", ["abc"], null, ["abc"]] - , ["?*****??", ["abc"], null, ["abc"]] - , ["*****??", ["abc"], null, ["abc"]] - , ["?*****?c", ["abc"], null, ["abc"]] - , ["?***?****c", ["abc"], null, ["abc"]] - , ["?***?****?", ["abc"], null, ["abc"]] - , ["?***?****", ["abc"], null, ["abc"]] - , ["*******c", ["abc"], null, ["abc"]] - , ["*******?", ["abc"], null, ["abc"]] - , ["a*cd**?**??k", ["abcdecdhjk"], null, ["abcdecdhjk"]] - , ["a**?**cd**?**??k", ["abcdecdhjk"], null, ["abcdecdhjk"]] - , ["a**?**cd**?**??k***", ["abcdecdhjk"], null, ["abcdecdhjk"]] - , ["a**?**cd**?**??***k", ["abcdecdhjk"], null, ["abcdecdhjk"]] - , ["a**?**cd**?**??***k**", ["abcdecdhjk"], null, ["abcdecdhjk"]] - , ["a****c**?**??*****", ["abcdecdhjk"], null, ["abcdecdhjk"]] - , ["[-abc]", ["-"], null, ["-"]] - , ["[abc-]", ["-"], null, ["-"]] - , ["\\", ["\\"], null, ["\\"]] - , ["[\\\\]", ["\\"], null, ["\\"]] - , ["[[]", ["["], null, ["["]] - , ["[", ["["], null, ["["]] - , ["[*", ["[abc"], null, ["[abc"]] - , "a right bracket shall lose its special meaning and\n" + - "represent itself in a bracket expression if it occurs\n" + - "first in the list. -- POSIX.2 2.8.3.2" - , ["[]]", ["]"], null, ["]"]] - , ["[]-]", ["]"], null, ["]"]] - , ["[a-\z]", ["p"], null, ["p"]] - , ["??**********?****?", [], { null: true }, ["abc"]] - , ["??**********?****c", [], { null: true }, ["abc"]] - , ["?************c****?****", [], { null: true }, ["abc"]] - , ["*c*?**", [], { null: true }, ["abc"]] - , ["a*****c*?**", [], { null: true }, ["abc"]] - , ["a********???*******", [], { null: true }, ["abc"]] - , ["[]", [], { null: true }, ["a"]] - , ["[abc", [], { null: true }, ["["]] - - , "nocase tests" - , ["XYZ", ["xYz"], { nocase: true, null: true } - , ["xYz", "ABC", "IjK"]] - , ["ab*", ["ABC"], { nocase: true, null: true } - , ["xYz", "ABC", "IjK"]] - , ["[ia]?[ck]", ["ABC", "IjK"], { nocase: true, null: true } - , ["xYz", "ABC", "IjK"]] - - // [ pattern, [matches], MM opts, files, TAP opts] - , "onestar/twostar" - , ["{/*,*}", [], {null: true}, ["/asdf/asdf/asdf"]] - , ["{/?,*}", ["/a", "bb"], {null: true} - , ["/a", "/b/b", "/a/b/c", "bb"]] - - , "dots should not match unless requested" - , ["**", ["a/b"], {}, ["a/b", "a/.d", ".a/.d"]] - - // .. and . can only match patterns starting with ., - // even when options.dot is set. - , function () { - files = ["a/./b", "a/../b", "a/c/b", "a/.d/b"] - } - , ["a/*/b", ["a/c/b", "a/.d/b"], {dot: true}] - , ["a/.*/b", ["a/./b", "a/../b", "a/.d/b"], {dot: true}] - , ["a/*/b", ["a/c/b"], {dot:false}] - , ["a/.*/b", ["a/./b", "a/../b", "a/.d/b"], {dot: false}] - - - // this also tests that changing the options needs - // to change the cache key, even if the pattern is - // the same! - , ["**", ["a/b","a/.d",".a/.d"], { dot: true } - , [ ".a/.d", "a/.d", "a/b"]] - - , "paren sets cannot contain slashes" - , ["*(a/b)", ["*(a/b)"], {nonull: true}, ["a/b"]] - - // brace sets trump all else. - // - // invalid glob pattern. fails on bash4 and bsdglob. - // however, in this implementation, it's easier just - // to do the intuitive thing, and let brace-expansion - // actually come before parsing any extglob patterns, - // like the documentation seems to say. - // - // XXX: if anyone complains about this, either fix it - // or tell them to grow up and stop complaining. - // - // bash/bsdglob says this: - // , ["*(a|{b),c)}", ["*(a|{b),c)}"], {}, ["a", "ab", "ac", "ad"]] - // but we do this instead: - , ["*(a|{b),c)}", ["a", "ab", "ac"], {}, ["a", "ab", "ac", "ad"]] - - // test partial parsing in the presence of comment/negation chars - , ["[!a*", ["[!ab"], {}, ["[!ab", "[ab"]] - , ["[#a*", ["[#ab"], {}, ["[#ab", "[ab"]] - - // like: {a,b|c\\,d\\\|e} except it's unclosed, so it has to be escaped. - , ["+(a|*\\|c\\\\|d\\\\\\|e\\\\\\\\|f\\\\\\\\\\|g" - , ["+(a|b\\|c\\\\|d\\\\|e\\\\\\\\|f\\\\\\\\|g"] - , {} - , ["+(a|b\\|c\\\\|d\\\\|e\\\\\\\\|f\\\\\\\\|g", "a", "b\\c"]] - - - // crazy nested {,,} and *(||) tests. - , function () { - files = [ "a", "b", "c", "d" - , "ab", "ac", "ad" - , "bc", "cb" - , "bc,d", "c,db", "c,d" - , "d)", "(b|c", "*(b|c" - , "b|c", "b|cc", "cb|c" - , "x(a|b|c)", "x(a|c)" - , "(a|b|c)", "(a|c)"] - } - , ["*(a|{b,c})", ["a", "b", "c", "ab", "ac"]] - , ["{a,*(b|c,d)}", ["a","(b|c", "*(b|c", "d)"]] - // a - // *(b|c) - // *(b|d) - , ["{a,*(b|{c,d})}", ["a","b", "bc", "cb", "c", "d"]] - , ["*(a|{b|c,c})", ["a", "b", "c", "ab", "ac", "bc", "cb"]] - - - // test various flag settings. - , [ "*(a|{b|c,c})", ["x(a|b|c)", "x(a|c)", "(a|b|c)", "(a|c)"] - , { noext: true } ] - , ["a?b", ["x/y/acb", "acb/"], {matchBase: true} - , ["x/y/acb", "acb/", "acb/d/e", "x/y/acb/d"] ] - , ["#*", ["#a", "#b"], {nocomment: true}, ["#a", "#b", "c#d"]] - - - // begin channelling Boole and deMorgan... - , "negation tests" - , function () { - files = ["d", "e", "!ab", "!abc", "a!b", "\\!a"] - } - - // anything that is NOT a* matches. - , ["!a*", ["\\!a", "d", "e", "!ab", "!abc"]] - - // anything that IS !a* matches. - , ["!a*", ["!ab", "!abc"], {nonegate: true}] - - // anything that IS a* matches - , ["!!a*", ["a!b"]] - - // anything that is NOT !a* matches - , ["!\\!a*", ["a!b", "d", "e", "\\!a"]] - - ].forEach(function (c) { - if (typeof c === "function") return c() - if (typeof c === "string") return t.comment(c) - - var pattern = c[0] - , expect = c[1].sort(alpha) - , options = c[2] || {} - , f = c[3] || files - , tapOpts = c[4] || {} - - // options.debug = true - var m = new mm.Minimatch(pattern, options) - var r = m.makeRe() - tapOpts.re = String(r) || JSON.stringify(r) - tapOpts.files = JSON.stringify(f) - tapOpts.pattern = pattern - tapOpts.set = m.set - tapOpts.negated = m.negate - - var actual = mm.match(f, pattern, options) - actual.sort(alpha) - - t.equivalent( actual, expect - , JSON.stringify(pattern) + " " + JSON.stringify(expect) - , tapOpts ) - }) - - t.comment("time=" + (Date.now() - start) + "ms") - t.end() -}) - -tap.test("global leak test", function (t) { - var globalAfter = Object.keys(global) - t.equivalent(globalAfter, globalBefore, "no new globals, please") - t.end() -}) - -function alpha (a, b) { - return a > b ? 1 : -1 -} diff --git a/package.json b/package.json index 71e466a..9c10dc7 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ , "glob": "3" , "graceful-fs": "1" , "fstream": "~0.1.13" - , "minimatch": "~0.1.4" + , "minimatch": "0.2.x" , "mkdirp": "0.3.0" , "nopt": "1" , "request": "2.9.x"