diff options
author | isaacs <i@izs.me> | 2013-12-16 23:54:34 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2013-12-16 23:55:36 +0400 |
commit | 2a6c98160ea79b5872b74f1fa19f45b2e943cd49 (patch) | |
tree | bb9146c9a8cdc8db5bb31368c3f5761d1e708126 /node_modules/minimatch | |
parent | 7a0c4ad1aa91786091c5e7641415a02eed9608db (diff) |
minimatch update
Diffstat (limited to 'node_modules/minimatch')
-rw-r--r-- | node_modules/minimatch/.npmignore | 1 | ||||
-rw-r--r-- | node_modules/minimatch/README.md | 76 | ||||
-rw-r--r-- | node_modules/minimatch/minimatch.js | 148 | ||||
-rw-r--r-- | node_modules/minimatch/node_modules/sigmund/package.json | 7 | ||||
-rw-r--r-- | node_modules/minimatch/package.json | 9 | ||||
-rw-r--r-- | node_modules/minimatch/test/extglob-ending-with-state-char.js | 8 |
6 files changed, 116 insertions, 133 deletions
diff --git a/node_modules/minimatch/.npmignore b/node_modules/minimatch/.npmignore new file mode 100644 index 000000000..3c3629e64 --- /dev/null +++ b/node_modules/minimatch/.npmignore @@ -0,0 +1 @@ +node_modules diff --git a/node_modules/minimatch/README.md b/node_modules/minimatch/README.md index 6fd07d2e9..978268e27 100644 --- a/node_modules/minimatch/README.md +++ b/node_modules/minimatch/README.md @@ -19,6 +19,7 @@ var minimatch = require("minimatch") minimatch("bar.foo", "*.foo") // true! minimatch("bar.foo", "*.bar") // false! +minimatch("bar.foo", "*.+(bar|foo)", { debug: true }) // true, and noisy! ``` ## Features @@ -36,44 +37,6 @@ See: * `man 3 fnmatch` * `man 5 gitignore` -### Comparisons to other fnmatch/glob implementations - -While strict compliance with the existing standards is a worthwhile -goal, some discrepancies exist between minimatch and other -implementations, and are intentional. - -If the pattern starts with a `!` character, then it is negated. Set the -`nonegate` flag to suppress this behavior, and treat leading `!` -characters normally. This is perhaps relevant if you wish to start the -pattern with a negative extglob pattern like `!(a|B)`. Multiple `!` -characters at the start of a pattern will negate the pattern multiple -times. - -If a pattern starts with `#`, then it is treated as a comment, and -will not match anything. Use `\#` to match a literal `#` at the -start of a line, or set the `nocomment` flag to suppress this behavior. - -The double-star character `**` is supported by default, unless the -`noglobstar` flag is set. This is supported in the manner of bsdglob -and bash 4.1, where `**` only has special significance if it is the only -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 `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?"`. 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 -`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded -**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are -checked for validity. Since those two are valid, matching proceeds. - - ## Minimatch Class Create a minimatch object by instanting the `minimatch.Minimatch` class. @@ -216,3 +179,40 @@ Suppress the behavior of treating a leading `!` character as negation. Returns from negate expressions the same as if they were not negated. (Ie, true on a hit, false on a miss.) + + +## Comparisons to other fnmatch/glob implementations + +While strict compliance with the existing standards is a worthwhile +goal, some discrepancies exist between minimatch and other +implementations, and are intentional. + +If the pattern starts with a `!` character, then it is negated. Set the +`nonegate` flag to suppress this behavior, and treat leading `!` +characters normally. This is perhaps relevant if you wish to start the +pattern with a negative extglob pattern like `!(a|B)`. Multiple `!` +characters at the start of a pattern will negate the pattern multiple +times. + +If a pattern starts with `#`, then it is treated as a comment, and +will not match anything. Use `\#` to match a literal `#` at the +start of a line, or set the `nocomment` flag to suppress this behavior. + +The double-star character `**` is supported by default, unless the +`noglobstar` flag is set. This is supported in the manner of bsdglob +and bash 4.1, where `**` only has special significance if it is the only +thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but +`a/**b` will not. + +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?"`. 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 +`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded +**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are +checked for validity. Since those two are valid, matching proceeds. diff --git a/node_modules/minimatch/minimatch.js b/node_modules/minimatch/minimatch.js index 405746b67..c633f89fa 100644 --- a/node_modules/minimatch/minimatch.js +++ b/node_modules/minimatch/minimatch.js @@ -68,17 +68,6 @@ function charSet (s) { // normalizes slashes. var slashSplit = /\/+/ -minimatch.monkeyPatch = monkeyPatch -function monkeyPatch () { - var desc = Object.getOwnPropertyDescriptor(String.prototype, "match") - var orig = desc.value - desc.value = function (p) { - if (p instanceof Minimatch) return p.match(this) - return orig.call(this, p) - } - Object.defineProperty(String.prototype, desc) -} - minimatch.filter = filter function filter (pattern, options) { options = options || {} @@ -178,6 +167,8 @@ function Minimatch (pattern, options) { this.make() } +Minimatch.prototype.debug = function() {} + Minimatch.prototype.make = make function make () { // don't do it more than once. @@ -202,7 +193,9 @@ function make () { // step 2: expand braces var set = this.globSet = this.braceExpand() - if (options.debug) console.error(this.pattern, set) + if (options.debug) this.debug = console.error + + this.debug(this.pattern, set) // step 3: now we have a set, so turn each one into a series of path-portion // matching patterns. @@ -213,21 +206,21 @@ function make () { return s.split(slashSplit) }) - if (options.debug) console.error(this.pattern, set) + this.debug(this.pattern, set) // glob --> regexps set = set.map(function (s, si, set) { return s.map(this.parse, this) }, this) - if (options.debug) console.error(this.pattern, set) + this.debug(this.pattern, set) // filter out everything that didn't compile properly. set = set.filter(function (s) { return -1 === s.indexOf(false) }) - if (options.debug) console.error(this.pattern, set) + this.debug(this.pattern, set) this.set = set } @@ -302,11 +295,11 @@ function braceExpand (pattern, options) { // So, we pluck that off, and work with the rest, // and then prepend it to everything we find. if (pattern.charAt(0) !== "{") { - // console.error(pattern) + this.debug(pattern) var prefix = null for (var i = 0, l = pattern.length; i < l; i ++) { var c = pattern.charAt(i) - // console.error(i, c) + this.debug(i, c) if (c === "\\") { escaping = !escaping } else if (c === "{" && !escaping) { @@ -317,11 +310,11 @@ function braceExpand (pattern, options) { // actually no sets, all { were escaped. if (prefix === null) { - // console.error("no sets") + this.debug("no sets") return [pattern] } - var tail = braceExpand(pattern.substr(i), options) + var tail = braceExpand.call(this, pattern.substr(i), options) return tail.map(function (t) { return prefix + t }) @@ -336,8 +329,8 @@ function braceExpand (pattern, options) { // first, handle numeric sets, since they're easier var numset = pattern.match(/^\{(-?[0-9]+)\.\.(-?[0-9]+)\}/) if (numset) { - // console.error("numset", numset[1], numset[2]) - var suf = braceExpand(pattern.substr(numset[0].length), options) + this.debug("numset", numset[1], numset[2]) + var suf = braceExpand.call(this, pattern.substr(numset[0].length), options) , start = +numset[1] , end = +numset[2] , inc = start > end ? -1 : 1 @@ -369,10 +362,10 @@ function braceExpand (pattern, options) { member = "" } - // console.error("Entering for") + this.debug("Entering for") FOR: for (i = 1, l = pattern.length; i < l; i ++) { var c = pattern.charAt(i) - // console.error("", i, c) + this.debug("", i, c) if (escaping) { escaping = false @@ -420,22 +413,22 @@ function braceExpand (pattern, options) { // pattern.substr(i), or we have *not* closed the set, // and need to escape the leading brace if (depth !== 0) { - // console.error("didn't close", pattern) - return braceExpand("\\" + pattern, options) + this.debug("didn't close", pattern) + return braceExpand.call(this, "\\" + pattern, options) } // x{y,z} -> ["xy", "xz"] - // console.error("set", set) - // console.error("suffix", pattern.substr(i)) - var suf = braceExpand(pattern.substr(i), options) + this.debug("set", set) + this.debug("suffix", pattern.substr(i)) + var suf = braceExpand.call(this, pattern.substr(i), options) // ["b", "c{d,e}","{f,g}h"] -> // [["b"], ["cd", "ce"], ["fh", "gh"]] var addBraces = set.length === 1 - // console.error("set pre-expanded", set) + this.debug("set pre-expanded", set) set = set.map(function (p) { - return braceExpand(p, options) - }) - // console.error("set expanded", set) + return braceExpand.call(this, p, options) + }, this) + this.debug("set expanded", set) // [["b"], ["cd", "ce"], ["fh", "gh"]] -> @@ -496,6 +489,7 @@ function parse (pattern, isSub) { // not (start or / followed by . or .. followed by / or end) : options.dot ? "(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))" : "(?!\\.)" + , self = this function clearStateChar () { if (stateChar) { @@ -514,6 +508,7 @@ function parse (pattern, isSub) { re += "\\"+stateChar break } + self.debug('clearStateChar %j %j', stateChar, re) stateChar = false } } @@ -522,9 +517,7 @@ function parse (pattern, isSub) { ; (i < len) && (c = pattern.charAt(i)) ; i ++ ) { - if (options.debug) { - console.error("%s\t%s %s %j", pattern, i, re, c) - } + this.debug("%s\t%s %s %j", pattern, i, re, c) // skip over any that are escaped. if (escaping && reSpecials[c]) { @@ -551,13 +544,12 @@ function parse (pattern, isSub) { case "+": case "@": case "!": - if (options.debug) { - console.error("%s\t%s %s %j <-- stateChar", pattern, i, re, c) - } + this.debug("%s\t%s %s %j <-- stateChar", pattern, i, re, c) // all of those are literals inside a class, except that // the glob [!a] means [^a] in regexp if (inClass) { + this.debug(' in class') if (c === "!" && i === classStart + 1) c = "^" re += c continue @@ -566,6 +558,7 @@ function parse (pattern, isSub) { // if we already have a stateChar, then it means // that there was something like ** or +? in there. // Handle the stateChar, then proceed with this one. + self.debug('call clearStateChar %j', stateChar) clearStateChar() stateChar = c // if extglob is disabled, then +(asdf|foo) isn't a thing. @@ -591,6 +584,7 @@ function parse (pattern, isSub) { , reStart: re.length }) // negation is (?:(?!js)[^/]*) re += stateChar === "!" ? "(?:(?!" : "(?:" + this.debug('plType %j %j', stateChar, re) stateChar = false continue @@ -600,6 +594,7 @@ function parse (pattern, isSub) { continue } + clearStateChar() hasMagic = true re += ")" plType = patternListStack.pop().type @@ -623,6 +618,7 @@ function parse (pattern, isSub) { continue } + clearStateChar() re += "|" continue @@ -715,7 +711,7 @@ function parse (pattern, isSub) { return $1 + $1 + $2 + "|" }) - // console.error("tail=%j\n %s", tail, tail) + this.debug("tail=%j\n %s", tail, tail) var t = pl.type === "*" ? star : pl.type === "?" ? qmark : "\\" + pl.type @@ -829,7 +825,7 @@ minimatch.match = function (list, pattern, options) { Minimatch.prototype.match = match function match (f, partial) { - // console.error("match", f, this.pattern) + this.debug("match", f, this.pattern) // short-circuit in the case of busted things. // comments, etc. if (this.comment) return false @@ -847,9 +843,7 @@ function match (f, partial) { // treat the test path as a set of pathparts. f = f.split(slashSplit) - if (options.debug) { - console.error(this.pattern, "split", f) - } + this.debug(this.pattern, "split", f) // just ONE of the pattern sets in this.set needs to match // in order for it to be valid. If negating, then just one @@ -857,11 +851,16 @@ function match (f, partial) { // Either way, return on the first hit. var set = this.set - // console.error(this.pattern, "set", set) + this.debug(this.pattern, "set", set) + + var splitFile = path.basename(f.join("/")).split("/") for (var i = 0, l = set.length; i < l; i ++) { - var pattern = set[i] - var hit = this.matchOne(f, pattern, partial) + var pattern = set[i], file = f + if (options.matchBase && pattern.length === 1) { + file = splitFile + } + var hit = this.matchOne(file, pattern, partial) if (hit) { if (options.flipNegate) return true return !this.negate @@ -882,20 +881,12 @@ function match (f, partial) { Minimatch.prototype.matchOne = function (file, pattern, partial) { var options = this.options - if (options.debug) { - console.error("matchOne", - { "this": this - , file: file - , pattern: pattern }) - } - - if (options.matchBase && pattern.length === 1) { - file = path.basename(file.join("/")).split("/") - } + this.debug("matchOne", + { "this": this + , file: file + , pattern: pattern }) - if (options.debug) { - console.error("matchOne", file.length, pattern.length) - } + this.debug("matchOne", file.length, pattern.length) for ( var fi = 0 , pi = 0 @@ -904,23 +895,18 @@ Minimatch.prototype.matchOne = function (file, pattern, partial) { ; (fi < fl) && (pi < pl) ; fi ++, pi ++ ) { - if (options.debug) { - console.error("matchOne loop") - } + this.debug("matchOne loop") var p = pattern[pi] , f = file[fi] - if (options.debug) { - console.error(pattern, p, f) - } + this.debug(pattern, p, f) // should be impossible. // some invalid regexp stuff in the set. if (p === false) return false if (p === GLOBSTAR) { - if (options.debug) - console.error('GLOBSTAR', [pattern, p, f]) + this.debug('GLOBSTAR', [pattern, p, f]) // "**" // a/**/b/**/c would match the following: @@ -947,8 +933,7 @@ Minimatch.prototype.matchOne = function (file, pattern, partial) { var fr = fi , pr = pi + 1 if (pr === pl) { - if (options.debug) - console.error('** at the end') + this.debug('** at the end') // a ** at the end will just swallow the rest. // We have found a match. // however, it will not swallow /.x, unless @@ -966,15 +951,12 @@ Minimatch.prototype.matchOne = function (file, pattern, partial) { WHILE: while (fr < fl) { var swallowee = file[fr] - if (options.debug) { - console.error('\nglobstar while', - file, fr, pattern, pr, swallowee) - } + this.debug('\nglobstar while', + file, fr, pattern, pr, swallowee) // XXX remove this slice. Just pass the start index. if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { - if (options.debug) - console.error('globstar found match!', fr, fl, swallowee) + this.debug('globstar found match!', fr, fl, swallowee) // found a match. return true } else { @@ -982,14 +964,12 @@ Minimatch.prototype.matchOne = function (file, pattern, partial) { // can only swallow ".foo" when explicitly asked. if (swallowee === "." || swallowee === ".." || (!options.dot && swallowee.charAt(0) === ".")) { - if (options.debug) - console.error("dot detected!", file, fr, pattern, pr) + this.debug("dot detected!", file, fr, pattern, pr) break WHILE } // ** swallows a segment, and continue. - if (options.debug) - console.error('globstar swallow a segment, and continue') + this.debug('globstar swallow a segment, and continue') fr ++ } } @@ -998,7 +978,7 @@ Minimatch.prototype.matchOne = function (file, pattern, partial) { // If there's more *pattern* left, then if (partial) { // ran out of file - // console.error("\n>>> no match, partial?", file, fr, pattern, pr) + this.debug("\n>>> no match, partial?", file, fr, pattern, pr) if (fr === fl) return true } return false @@ -1014,14 +994,10 @@ Minimatch.prototype.matchOne = function (file, pattern, partial) { } else { hit = f === p } - if (options.debug) { - console.error("string match", p, f, hit) - } + this.debug("string match", p, f, hit) } else { hit = f.match(p) - if (options.debug) { - console.error("pattern match", p, f, hit) - } + this.debug("pattern match", p, f, hit) } if (!hit) return false diff --git a/node_modules/minimatch/node_modules/sigmund/package.json b/node_modules/minimatch/node_modules/sigmund/package.json index 798d8b955..cb7e2bd4b 100644 --- a/node_modules/minimatch/node_modules/sigmund/package.json +++ b/node_modules/minimatch/node_modules/sigmund/package.json @@ -36,10 +36,7 @@ "bugs": { "url": "https://github.com/isaacs/sigmund/issues" }, + "homepage": "https://github.com/isaacs/sigmund", "_id": "sigmund@1.0.0", - "dist": { - "shasum": "66a2b3a749ae8b5fb89efd4fcc01dc94fbe02296" - }, - "_from": "sigmund@~1.0.0", - "_resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.0.tgz" + "_from": "sigmund@~1.0.0" } diff --git a/node_modules/minimatch/package.json b/node_modules/minimatch/package.json index 0e26ea948..9dedca512 100644 --- a/node_modules/minimatch/package.json +++ b/node_modules/minimatch/package.json @@ -6,14 +6,14 @@ }, "name": "minimatch", "description": "a glob matcher in javascript", - "version": "0.2.12", + "version": "0.2.14", "repository": { "type": "git", "url": "git://github.com/isaacs/minimatch.git" }, "main": "minimatch.js", "scripts": { - "test": "tap test" + "test": "tap test/*.js" }, "engines": { "node": "*" @@ -29,11 +29,12 @@ "type": "MIT", "url": "http://github.com/isaacs/minimatch/raw/master/LICENSE" }, - "readme": "# minimatch\n\nA minimal matching utility.\n\n[![Build Status](https://secure.travis-ci.org/isaacs/minimatch.png)](http://travis-ci.org/isaacs/minimatch)\n\n\nThis is the matching library used internally by npm.\n\nEventually, it will replace the C binding in node-glob.\n\nIt works by converting glob expressions into JavaScript `RegExp`\nobjects.\n\n## Usage\n\n```javascript\nvar minimatch = require(\"minimatch\")\n\nminimatch(\"bar.foo\", \"*.foo\") // true!\nminimatch(\"bar.foo\", \"*.bar\") // false!\n```\n\n## Features\n\nSupports these glob features:\n\n* Brace Expansion\n* Extended glob matching\n* \"Globstar\" `**` matching\n\nSee:\n\n* `man sh`\n* `man bash`\n* `man 3 fnmatch`\n* `man 5 gitignore`\n\n### Comparisons to other fnmatch/glob implementations\n\nWhile strict compliance with the existing standards is a worthwhile\ngoal, some discrepancies exist between minimatch and other\nimplementations, and are intentional.\n\nIf the pattern starts with a `!` character, then it is negated. Set the\n`nonegate` flag to suppress this behavior, and treat leading `!`\ncharacters normally. This is perhaps relevant if you wish to start the\npattern with a negative extglob pattern like `!(a|B)`. Multiple `!`\ncharacters at the start of a pattern will negate the pattern multiple\ntimes.\n\nIf a pattern starts with `#`, then it is treated as a comment, and\nwill not match anything. Use `\\#` to match a literal `#` at the\nstart of a line, or set the `nocomment` flag to suppress this behavior.\n\nThe double-star character `**` is supported by default, unless the\n`noglobstar` flag is set. This is supported in the manner of bsdglob\nand bash 4.1, where `**` only has special significance if it is the only\nthing in a path part. That is, `a/**/b` will match `a/x/y/b`, but\n`a/**b` will not. **Note that this is different from the way that `**` is\nhandled by ruby's `Dir` class.**\n\nIf an escaped pattern has no matches, and the `nonull` flag is set,\nthen minimatch.match returns the pattern as-provided, rather than\ninterpreting the character escapes. For example,\n`minimatch.match([], \"\\\\*a\\\\?\")` will return `\"\\\\*a\\\\?\"` rather than\n`\"*a?\"`. This is akin to setting the `nullglob` option in bash, except\nthat it does not resolve escaped pattern characters.\n\nIf brace expansion is not disabled, then it is performed before any\nother interpretation of the glob pattern. Thus, a pattern like\n`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded\n**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are\nchecked for validity. Since those two are valid, matching proceeds.\n\n\n## Minimatch Class\n\nCreate a minimatch object by instanting the `minimatch.Minimatch` class.\n\n```javascript\nvar Minimatch = require(\"minimatch\").Minimatch\nvar mm = new Minimatch(pattern, options)\n```\n\n### Properties\n\n* `pattern` The original pattern the minimatch object represents.\n* `options` The options supplied to the constructor.\n* `set` A 2-dimensional array of regexp or string expressions.\n Each row in the\n array corresponds to a brace-expanded pattern. Each item in the row\n corresponds to a single path-part. For example, the pattern\n `{a,b/c}/d` would expand to a set of patterns like:\n\n [ [ a, d ]\n , [ b, c, d ] ]\n\n If a portion of the pattern doesn't have any \"magic\" in it\n (that is, it's something like `\"foo\"` rather than `fo*o?`), then it\n will be left as a string rather than converted to a regular\n expression.\n\n* `regexp` Created by the `makeRe` method. A single regular expression\n expressing the entire pattern. This is useful in cases where you wish\n to use the pattern somewhat like `fnmatch(3)` with `FNM_PATH` enabled.\n* `negate` True if the pattern is negated.\n* `comment` True if the pattern is a comment.\n* `empty` True if the pattern is `\"\"`.\n\n### Methods\n\n* `makeRe` Generate the `regexp` member if necessary, and return it.\n Will return `false` if the pattern is invalid.\n* `match(fname)` Return true if the filename matches the pattern, or\n false otherwise.\n* `matchOne(fileArray, patternArray, partial)` Take a `/`-split\n filename, and match it against a single row in the `regExpSet`. This\n method is mainly for internal use, but is exposed so that it can be\n used by a glob-walker that needs to avoid excessive filesystem calls.\n\nAll other methods are internal, and will be called as necessary.\n\n## Functions\n\nThe top-level exported function has a `cache` property, which is an LRU\ncache set to store 100 items. So, calling these methods repeatedly\nwith the same pattern and options will use the same Minimatch object,\nsaving the cost of parsing it multiple times.\n\n### minimatch(path, pattern, options)\n\nMain export. Tests a path against the pattern using the options.\n\n```javascript\nvar isJS = minimatch(file, \"*.js\", { matchBase: true })\n```\n\n### minimatch.filter(pattern, options)\n\nReturns a function that tests its\nsupplied argument, suitable for use with `Array.filter`. Example:\n\n```javascript\nvar javascripts = fileList.filter(minimatch.filter(\"*.js\", {matchBase: true}))\n```\n\n### minimatch.match(list, pattern, options)\n\nMatch against the list of\nfiles, in the style of fnmatch or glob. If nothing is matched, and\noptions.nonull is set, then return a list containing the pattern itself.\n\n```javascript\nvar javascripts = minimatch.match(fileList, \"*.js\", {matchBase: true}))\n```\n\n### minimatch.makeRe(pattern, options)\n\nMake a regular expression object from the pattern.\n\n## Options\n\nAll options are `false` by default.\n\n### debug\n\nDump a ton of stuff to stderr.\n\n### nobrace\n\nDo not expand `{a,b}` and `{1..3}` brace sets.\n\n### noglobstar\n\nDisable `**` matching against multiple folder names.\n\n### dot\n\nAllow patterns to match filenames starting with a period, even if\nthe pattern does not explicitly have a period in that spot.\n\nNote that by default, `a/**/b` will **not** match `a/.d/b`, unless `dot`\nis set.\n\n### noext\n\nDisable \"extglob\" style patterns like `+(a|b)`.\n\n### nocase\n\nPerform a case-insensitive match.\n\n### nonull\n\nWhen a match is not found by `minimatch.match`, return a list containing\nthe pattern itself. When set, an empty list is returned if there are\nno matches.\n\n### matchBase\n\nIf set, then patterns without slashes will be matched\nagainst the basename of the path if it contains slashes. For example,\n`a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`.\n\n### nocomment\n\nSuppress the behavior of treating `#` at the start of a pattern as a\ncomment.\n\n### nonegate\n\nSuppress the behavior of treating a leading `!` character as negation.\n\n### flipNegate\n\nReturns from negate expressions the same as if they were not negated.\n(Ie, true on a hit, false on a miss.)\n", + "readme": "# minimatch\n\nA minimal matching utility.\n\n[![Build Status](https://secure.travis-ci.org/isaacs/minimatch.png)](http://travis-ci.org/isaacs/minimatch)\n\n\nThis is the matching library used internally by npm.\n\nEventually, it will replace the C binding in node-glob.\n\nIt works by converting glob expressions into JavaScript `RegExp`\nobjects.\n\n## Usage\n\n```javascript\nvar minimatch = require(\"minimatch\")\n\nminimatch(\"bar.foo\", \"*.foo\") // true!\nminimatch(\"bar.foo\", \"*.bar\") // false!\nminimatch(\"bar.foo\", \"*.+(bar|foo)\", { debug: true }) // true, and noisy!\n```\n\n## Features\n\nSupports these glob features:\n\n* Brace Expansion\n* Extended glob matching\n* \"Globstar\" `**` matching\n\nSee:\n\n* `man sh`\n* `man bash`\n* `man 3 fnmatch`\n* `man 5 gitignore`\n\n## Minimatch Class\n\nCreate a minimatch object by instanting the `minimatch.Minimatch` class.\n\n```javascript\nvar Minimatch = require(\"minimatch\").Minimatch\nvar mm = new Minimatch(pattern, options)\n```\n\n### Properties\n\n* `pattern` The original pattern the minimatch object represents.\n* `options` The options supplied to the constructor.\n* `set` A 2-dimensional array of regexp or string expressions.\n Each row in the\n array corresponds to a brace-expanded pattern. Each item in the row\n corresponds to a single path-part. For example, the pattern\n `{a,b/c}/d` would expand to a set of patterns like:\n\n [ [ a, d ]\n , [ b, c, d ] ]\n\n If a portion of the pattern doesn't have any \"magic\" in it\n (that is, it's something like `\"foo\"` rather than `fo*o?`), then it\n will be left as a string rather than converted to a regular\n expression.\n\n* `regexp` Created by the `makeRe` method. A single regular expression\n expressing the entire pattern. This is useful in cases where you wish\n to use the pattern somewhat like `fnmatch(3)` with `FNM_PATH` enabled.\n* `negate` True if the pattern is negated.\n* `comment` True if the pattern is a comment.\n* `empty` True if the pattern is `\"\"`.\n\n### Methods\n\n* `makeRe` Generate the `regexp` member if necessary, and return it.\n Will return `false` if the pattern is invalid.\n* `match(fname)` Return true if the filename matches the pattern, or\n false otherwise.\n* `matchOne(fileArray, patternArray, partial)` Take a `/`-split\n filename, and match it against a single row in the `regExpSet`. This\n method is mainly for internal use, but is exposed so that it can be\n used by a glob-walker that needs to avoid excessive filesystem calls.\n\nAll other methods are internal, and will be called as necessary.\n\n## Functions\n\nThe top-level exported function has a `cache` property, which is an LRU\ncache set to store 100 items. So, calling these methods repeatedly\nwith the same pattern and options will use the same Minimatch object,\nsaving the cost of parsing it multiple times.\n\n### minimatch(path, pattern, options)\n\nMain export. Tests a path against the pattern using the options.\n\n```javascript\nvar isJS = minimatch(file, \"*.js\", { matchBase: true })\n```\n\n### minimatch.filter(pattern, options)\n\nReturns a function that tests its\nsupplied argument, suitable for use with `Array.filter`. Example:\n\n```javascript\nvar javascripts = fileList.filter(minimatch.filter(\"*.js\", {matchBase: true}))\n```\n\n### minimatch.match(list, pattern, options)\n\nMatch against the list of\nfiles, in the style of fnmatch or glob. If nothing is matched, and\noptions.nonull is set, then return a list containing the pattern itself.\n\n```javascript\nvar javascripts = minimatch.match(fileList, \"*.js\", {matchBase: true}))\n```\n\n### minimatch.makeRe(pattern, options)\n\nMake a regular expression object from the pattern.\n\n## Options\n\nAll options are `false` by default.\n\n### debug\n\nDump a ton of stuff to stderr.\n\n### nobrace\n\nDo not expand `{a,b}` and `{1..3}` brace sets.\n\n### noglobstar\n\nDisable `**` matching against multiple folder names.\n\n### dot\n\nAllow patterns to match filenames starting with a period, even if\nthe pattern does not explicitly have a period in that spot.\n\nNote that by default, `a/**/b` will **not** match `a/.d/b`, unless `dot`\nis set.\n\n### noext\n\nDisable \"extglob\" style patterns like `+(a|b)`.\n\n### nocase\n\nPerform a case-insensitive match.\n\n### nonull\n\nWhen a match is not found by `minimatch.match`, return a list containing\nthe pattern itself. When set, an empty list is returned if there are\nno matches.\n\n### matchBase\n\nIf set, then patterns without slashes will be matched\nagainst the basename of the path if it contains slashes. For example,\n`a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`.\n\n### nocomment\n\nSuppress the behavior of treating `#` at the start of a pattern as a\ncomment.\n\n### nonegate\n\nSuppress the behavior of treating a leading `!` character as negation.\n\n### flipNegate\n\nReturns from negate expressions the same as if they were not negated.\n(Ie, true on a hit, false on a miss.)\n\n\n## Comparisons to other fnmatch/glob implementations\n\nWhile strict compliance with the existing standards is a worthwhile\ngoal, some discrepancies exist between minimatch and other\nimplementations, and are intentional.\n\nIf the pattern starts with a `!` character, then it is negated. Set the\n`nonegate` flag to suppress this behavior, and treat leading `!`\ncharacters normally. This is perhaps relevant if you wish to start the\npattern with a negative extglob pattern like `!(a|B)`. Multiple `!`\ncharacters at the start of a pattern will negate the pattern multiple\ntimes.\n\nIf a pattern starts with `#`, then it is treated as a comment, and\nwill not match anything. Use `\\#` to match a literal `#` at the\nstart of a line, or set the `nocomment` flag to suppress this behavior.\n\nThe double-star character `**` is supported by default, unless the\n`noglobstar` flag is set. This is supported in the manner of bsdglob\nand bash 4.1, where `**` only has special significance if it is the only\nthing in a path part. That is, `a/**/b` will match `a/x/y/b`, but\n`a/**b` will not.\n\nIf an escaped pattern has no matches, and the `nonull` flag is set,\nthen minimatch.match returns the pattern as-provided, rather than\ninterpreting the character escapes. For example,\n`minimatch.match([], \"\\\\*a\\\\?\")` will return `\"\\\\*a\\\\?\"` rather than\n`\"*a?\"`. This is akin to setting the `nullglob` option in bash, except\nthat it does not resolve escaped pattern characters.\n\nIf brace expansion is not disabled, then it is performed before any\nother interpretation of the glob pattern. Thus, a pattern like\n`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded\n**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are\nchecked for validity. Since those two are valid, matching proceeds.\n", "readmeFilename": "README.md", "bugs": { "url": "https://github.com/isaacs/minimatch/issues" }, - "_id": "minimatch@0.2.12", + "homepage": "https://github.com/isaacs/minimatch", + "_id": "minimatch@0.2.14", "_from": "minimatch@latest" } diff --git a/node_modules/minimatch/test/extglob-ending-with-state-char.js b/node_modules/minimatch/test/extglob-ending-with-state-char.js new file mode 100644 index 000000000..6676e2629 --- /dev/null +++ b/node_modules/minimatch/test/extglob-ending-with-state-char.js @@ -0,0 +1,8 @@ +var test = require('tap').test +var minimatch = require('../') + +test('extglob ending with statechar', function(t) { + t.notOk(minimatch('ax', 'a?(b*)')) + t.ok(minimatch('ax', '?(a*|b)')) + t.end() +}) |