1 (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
2 module.exports = minimatch
3 minimatch.Minimatch = Minimatch
6 if (typeof process !== 'undefined' && process.platform === 'win32')
9 var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}
10 , expand = require("brace-expansion")
12 // any single thing other than /
13 // don't need to escape / when using new RegExp()
16 // * => any number of characters
19 // ** when dots are allowed. Anything goes, except .. and .
20 // not (^ or / followed by one or two dots followed by $ or /),
21 // followed by anything, any number of times.
22 , twoStarDot = "(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?"
24 // not a ^ or / followed by a dot,
25 // followed by anything, any number of times.
26 , twoStarNoDot = "(?:(?!(?:\\\/|^)\\.).)*?"
28 // characters that need to be escaped in RegExp.
29 , reSpecials = charSet("().*{}+?[]^$\\!")
31 // "abc" -> { a:true, b:true, c:true }
32 function charSet (s) {
33 return s.split("").reduce(function (set, c) {
39 // normalizes slashes.
40 var slashSplit = /\/+/
42 minimatch.filter = filter
43 function filter (pattern, options) {
44 options = options || {}
45 return function (p, i, list) {
46 return minimatch(p, pattern, options)
54 Object.keys(b).forEach(function (k) {
57 Object.keys(a).forEach(function (k) {
63 minimatch.defaults = function (def) {
64 if (!def || !Object.keys(def).length) return minimatch
68 var m = function minimatch (p, pattern, options) {
69 return orig.minimatch(p, pattern, ext(def, options))
72 m.Minimatch = function Minimatch (pattern, options) {
73 return new orig.Minimatch(pattern, ext(def, options))
79 Minimatch.defaults = function (def) {
80 if (!def || !Object.keys(def).length) return Minimatch
81 return minimatch.defaults(def).Minimatch
85 function minimatch (p, pattern, options) {
86 if (typeof pattern !== "string") {
87 throw new TypeError("glob pattern string required")
90 if (!options) options = {}
92 // shortcut: comments match nothing.
93 if (!options.nocomment && pattern.charAt(0) === "#") {
98 if (pattern.trim() === "") return p === ""
100 return new Minimatch(pattern, options).match(p)
103 function Minimatch (pattern, options) {
104 if (!(this instanceof Minimatch)) {
105 return new Minimatch(pattern, options)
108 if (typeof pattern !== "string") {
109 throw new TypeError("glob pattern string required")
112 if (!options) options = {}
113 pattern = pattern.trim()
115 // windows support: need to use /, not \
117 pattern = pattern.split("\\").join("/")
119 this.options = options
121 this.pattern = pattern
127 // make the set of regexps etc.
131 Minimatch.prototype.debug = function() {}
133 Minimatch.prototype.make = make
135 // don't do it more than once.
136 if (this._made) return
138 var pattern = this.pattern
139 var options = this.options
141 // empty patterns and comments match nothing.
142 if (!options.nocomment && pattern.charAt(0) === "#") {
151 // step 1: figure out negation, etc.
154 // step 2: expand braces
155 var set = this.globSet = this.braceExpand()
157 if (options.debug) this.debug = console.error
159 this.debug(this.pattern, set)
161 // step 3: now we have a set, so turn each one into a series of path-portion
162 // matching patterns.
163 // These will be regexps, except in the case of "**", which is
164 // set to the GLOBSTAR object for globstar behavior,
165 // and will not contain any / characters
166 set = this.globParts = set.map(function (s) {
167 return s.split(slashSplit)
170 this.debug(this.pattern, set)
173 set = set.map(function (s, si, set) {
174 return s.map(this.parse, this)
177 this.debug(this.pattern, set)
179 // filter out everything that didn't compile properly.
180 set = set.filter(function (s) {
181 return -1 === s.indexOf(false)
184 this.debug(this.pattern, set)
189 Minimatch.prototype.parseNegate = parseNegate
190 function parseNegate () {
191 var pattern = this.pattern
193 , options = this.options
196 if (options.nonegate) return
198 for ( var i = 0, l = pattern.length
199 ; i < l && pattern.charAt(i) === "!"
205 if (negateOffset) this.pattern = pattern.substr(negateOffset)
210 // a{b,c}d -> abd acd
212 // a{0..3}d -> a0d a1d a2d a3d
213 // a{b,c{d,e}f}g -> abg acdfg acefg
214 // a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg
216 // Invalid sets are not expanded.
217 // a{2..}b -> a{2..}b
219 minimatch.braceExpand = function (pattern, options) {
220 return braceExpand(pattern, options)
223 Minimatch.prototype.braceExpand = braceExpand
225 function braceExpand (pattern, options) {
227 if (this instanceof Minimatch)
228 options = this.options
233 pattern = typeof pattern === "undefined"
234 ? this.pattern : pattern
236 if (typeof pattern === "undefined") {
237 throw new Error("undefined pattern")
240 if (options.nobrace ||
241 !pattern.match(/\{.*\}/)) {
242 // shortcut. no need to expand.
246 return expand(pattern)
249 // parse a component of the expanded set.
250 // At this point, no pattern may contain "/" in it
251 // so we're going to return a 2d array, where each entry is the full
252 // pattern, split on '/', and then turned into a regular expression.
253 // A regexp is made at the end which joins each array with an
254 // escaped /, and another full one which joins each regexp with |.
256 // Following the lead of Bash 4.1, note that "**" only has special meaning
257 // when it is the *only* thing in a path portion. Otherwise, any series
258 // of * is equivalent to a single *. Globstar behavior is enabled by
259 // default, and can be disabled by setting options.noglobstar.
260 Minimatch.prototype.parse = parse
262 function parse (pattern, isSub) {
263 var options = this.options
266 if (!options.noglobstar && pattern === "**") return GLOBSTAR
267 if (pattern === "") return ""
270 , hasMagic = !!options.nocase
272 // ? => one single character
273 , patternListStack = []
279 // . and .. never match anything that doesn't start with .,
280 // even when options.dot is set.
281 , patternStart = pattern.charAt(0) === "." ? "" // anything
282 // not (start or / followed by . or .. followed by / or end)
283 : options.dot ? "(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))"
287 function clearStateChar () {
289 // we had some state-tracking character
290 // that wasn't consumed by this pass.
304 self.debug('clearStateChar %j %j', stateChar, re)
309 for ( var i = 0, len = pattern.length, c
310 ; (i < len) && (c = pattern.charAt(i))
313 this.debug("%s\t%s %s %j", pattern, i, re, c)
315 // skip over any that are escaped.
316 if (escaping && reSpecials[c]) {
324 // completely not allowed, even escaped.
325 // Should already be path-split by now.
333 // the various stateChar values
334 // for the "extglob" stuff.
340 this.debug("%s\t%s %s %j <-- stateChar", pattern, i, re, c)
342 // all of those are literals inside a class, except that
343 // the glob [!a] means [^a] in regexp
345 this.debug(' in class')
346 if (c === "!" && i === classStart + 1) c = "^"
351 // if we already have a stateChar, then it means
352 // that there was something like ** or +? in there.
353 // Handle the stateChar, then proceed with this one.
354 self.debug('call clearStateChar %j', stateChar)
357 // if extglob is disabled, then +(asdf|foo) isn't a thing.
358 // just clear the statechar *now*, rather than even diving into
359 // the patternList stuff.
360 if (options.noext) clearStateChar()
375 patternListStack.push({ type: plType
377 , reStart: re.length })
378 // negation is (?:(?!js)[^/]*)
379 re += stateChar === "!" ? "(?:(?!" : "(?:"
380 this.debug('plType %j %j', stateChar, re)
385 if (inClass || !patternListStack.length) {
393 plType = patternListStack.pop().type
394 // negation is (?:(?!js)[^/]*)
395 // The others are (?:<pattern>)<type>
402 case "*": re += plType
403 case "@": break // the default anyway
408 if (inClass || !patternListStack.length || escaping) {
418 // these are mostly the same in regexp and glob
420 // swallow any state-tracking char before the [
430 reClassStart = re.length
435 // a right bracket shall lose its special
436 // meaning and represent itself in
437 // a bracket expression if it occurs
438 // first in the list. -- POSIX.2 2.8.3.2
439 if (i === classStart + 1 || !inClass) {
445 // handle the case where we left a class open.
446 // "[z-a]" is valid, equivalent to "\[z-a\]"
448 // split where the last [ was, make sure we don't have
449 // an invalid re. if so, re-walk the contents of the
450 // would-be class to re-translate any characters that
451 // were passed through as-is
452 // TODO: It would probably be faster to determine this
453 // without a try/catch and a new RegExp, but it's tricky
454 // to do safely. For now, this is safe and works.
455 var cs = pattern.substring(classStart + 1, i)
457 new RegExp('[' + cs + ']')
459 // not a valid class!
460 var sp = this.parse(cs, SUBPARSE)
461 re = re.substr(0, reClassStart) + "\\[" + sp[0] + '\\]'
462 hasMagic = hasMagic || sp[1]
468 // finish up the class.
475 // swallow any state char that wasn't consumed
481 } else if (reSpecials[c]
482 && !(c === "^" && inClass)) {
492 // handle the case where we left a class open.
493 // "[abc" is valid, equivalent to "\[abc"
495 // split where the last [ was, and escape it
496 // this is a huge pita. We now have to re-walk
497 // the contents of the would-be class to re-translate
498 // any characters that were passed through as-is
499 var cs = pattern.substr(classStart + 1)
500 , sp = this.parse(cs, SUBPARSE)
501 re = re.substr(0, reClassStart) + "\\[" + sp[0]
502 hasMagic = hasMagic || sp[1]
505 // handle the case where we had a +( thing at the *end*
507 // each pattern list stack adds 3 chars, and we need to go through
508 // and escape any | chars that were passed through as-is for the regexp.
509 // Go through and escape them, taking care not to double-escape any
510 // | chars that were already escaped.
512 while (pl = patternListStack.pop()) {
513 var tail = re.slice(pl.reStart + 3)
514 // maybe some even number of \, then maybe 1 \, followed by a |
515 tail = tail.replace(/((?:\\{2})*)(\\?)\|/g, function (_, $1, $2) {
517 // the | isn't already escaped, so escape it.
521 // need to escape all those slashes *again*, without escaping the
522 // one that we need for escaping the | character. As it works out,
523 // escaping an even number of slashes can be done by simply repeating
524 // it exactly after itself. That's why this trick works.
526 // I am sorry that you have to see this.
527 return $1 + $1 + $2 + "|"
530 this.debug("tail=%j\n %s", tail, tail)
531 var t = pl.type === "*" ? star
532 : pl.type === "?" ? qmark
536 re = re.slice(0, pl.reStart)
541 // handle trailing things that only matter at the very end.
548 // only need to apply the nodot start if the re starts with
549 // something that could conceivably capture a dot
550 var addPatternStart = false
551 switch (re.charAt(0)) {
554 case "(": addPatternStart = true
557 // if the re is not "" at this point, then we need to make sure
558 // it doesn't match against an empty path part.
559 // Otherwise a/* will match a/, which it should not.
560 if (re !== "" && hasMagic) re = "(?=.)" + re
562 if (addPatternStart) re = patternStart + re
564 // parsing just a piece of a larger pattern.
565 if (isSub === SUBPARSE) {
566 return [ re, hasMagic ]
569 // skip the regexp for non-magical patterns
570 // unescape anything in it, though, so that it'll be
571 // an exact match against a file etc.
573 return globUnescape(pattern)
576 var flags = options.nocase ? "i" : ""
577 , regExp = new RegExp("^" + re + "$", flags)
579 regExp._glob = pattern
585 minimatch.makeRe = function (pattern, options) {
586 return new Minimatch(pattern, options || {}).makeRe()
589 Minimatch.prototype.makeRe = makeRe
591 if (this.regexp || this.regexp === false) return this.regexp
593 // at this point, this.set is a 2d array of partial
594 // pattern strings, or "**".
596 // It's better to use .match(). This function shouldn't
597 // be used, really, but it's pretty convenient sometimes,
598 // when you just want to work with a regex.
601 if (!set.length) return this.regexp = false
602 var options = this.options
604 var twoStar = options.noglobstar ? star
605 : options.dot ? twoStarDot
607 , flags = options.nocase ? "i" : ""
609 var re = set.map(function (pattern) {
610 return pattern.map(function (p) {
611 return (p === GLOBSTAR) ? twoStar
612 : (typeof p === "string") ? regExpEscape(p)
617 // must match entire pattern
618 // ending in a * or ** will make it less strict.
619 re = "^(?:" + re + ")$"
621 // can match anything, as long as it's not this.
622 if (this.negate) re = "^(?!" + re + ").*$"
625 return this.regexp = new RegExp(re, flags)
627 return this.regexp = false
631 minimatch.match = function (list, pattern, options) {
632 options = options || {}
633 var mm = new Minimatch(pattern, options)
634 list = list.filter(function (f) {
637 if (mm.options.nonull && !list.length) {
643 Minimatch.prototype.match = match
644 function match (f, partial) {
645 this.debug("match", f, this.pattern)
646 // short-circuit in the case of busted things.
648 if (this.comment) return false
649 if (this.empty) return f === ""
651 if (f === "/" && partial) return true
653 var options = this.options
655 // windows: need to use /, not \
657 f = f.split("\\").join("/")
659 // treat the test path as a set of pathparts.
660 f = f.split(slashSplit)
661 this.debug(this.pattern, "split", f)
663 // just ONE of the pattern sets in this.set needs to match
664 // in order for it to be valid. If negating, then just one
665 // match means that we have failed.
666 // Either way, return on the first hit.
669 this.debug(this.pattern, "set", set)
671 // Find the basename of the path by looking for the last non-empty segment
673 for (var i = f.length - 1; i >= 0; i--) {
678 for (var i = 0, l = set.length; i < l; i ++) {
679 var pattern = set[i], file = f
680 if (options.matchBase && pattern.length === 1) {
683 var hit = this.matchOne(file, pattern, partial)
685 if (options.flipNegate) return true
690 // didn't get any hits. this is success if it's a negative
691 // pattern, failure otherwise.
692 if (options.flipNegate) return false
696 // set partial to true to test if, for example,
697 // "/a/b" matches the start of "/*/b/*/d"
698 // Partial means, if you run out of file before you run
699 // out of pattern, then that's fine, as long as all
701 Minimatch.prototype.matchOne = function (file, pattern, partial) {
702 var options = this.options
704 this.debug("matchOne",
707 , pattern: pattern })
709 this.debug("matchOne", file.length, pattern.length)
714 , pl = pattern.length
715 ; (fi < fl) && (pi < pl)
718 this.debug("matchOne loop")
722 this.debug(pattern, p, f)
724 // should be impossible.
725 // some invalid regexp stuff in the set.
726 if (p === false) return false
728 if (p === GLOBSTAR) {
729 this.debug('GLOBSTAR', [pattern, p, f])
732 // a/**/b/**/c would match the following:
737 // To do this, take the rest of the pattern after
738 // the **, and see if it would match the file remainder.
739 // If so, return success.
740 // If not, the ** "swallows" a segment, and try again.
741 // This is recursively awful.
743 // a/**/b/**/c matching a/b/x/y/z/c
746 // - matchOne(b/x/y/z/c, b/**/c)
749 // - matchOne(x/y/z/c, c) -> no
750 // - matchOne(y/z/c, c) -> no
751 // - matchOne(z/c, c) -> no
752 // - matchOne(c, c) yes, hit
756 this.debug('** at the end')
757 // a ** at the end will just swallow the rest.
758 // We have found a match.
759 // however, it will not swallow /.x, unless
760 // options.dot is set.
761 // . and .. are *never* matched by **, for explosively
762 // exponential reasons.
763 for ( ; fi < fl; fi ++) {
764 if (file[fi] === "." || file[fi] === ".." ||
765 (!options.dot && file[fi].charAt(0) === ".")) return false
770 // ok, let's see if we can swallow whatever we can.
771 WHILE: while (fr < fl) {
772 var swallowee = file[fr]
774 this.debug('\nglobstar while',
775 file, fr, pattern, pr, swallowee)
777 // XXX remove this slice. Just pass the start index.
778 if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
779 this.debug('globstar found match!', fr, fl, swallowee)
783 // can't swallow "." or ".." ever.
784 // can only swallow ".foo" when explicitly asked.
785 if (swallowee === "." || swallowee === ".." ||
786 (!options.dot && swallowee.charAt(0) === ".")) {
787 this.debug("dot detected!", file, fr, pattern, pr)
791 // ** swallows a segment, and continue.
792 this.debug('globstar swallow a segment, and continue')
796 // no match was found.
797 // However, in partial mode, we can't say this is necessarily over.
798 // If there's more *pattern* left, then
801 this.debug("\n>>> no match, partial?", file, fr, pattern, pr)
802 if (fr === fl) return true
807 // something other than **
808 // non-magic patterns just have to match exactly
809 // patterns with magic have been turned into regexps.
811 if (typeof p === "string") {
812 if (options.nocase) {
813 hit = f.toLowerCase() === p.toLowerCase()
817 this.debug("string match", p, f, hit)
820 this.debug("pattern match", p, f, hit)
823 if (!hit) return false
826 // Note: ending in / means that we'll get a final ""
827 // at the end of the pattern. This can only match a
828 // corresponding "" at the end of the file.
829 // If the file ends in /, then it can only match a
830 // a pattern that ends in /, unless the pattern just
831 // doesn't have any more for it. But, a/b/ should *not*
832 // match "a/b/*", even though "" matches against the
833 // [^/]*? pattern, except in partial mode, where it might
834 // simply not be reached yet.
835 // However, a/b/ should still satisfy a/*
837 // now either we fell off the end of the pattern, or we're done.
838 if (fi === fl && pi === pl) {
839 // ran out of pattern and filename at the same time.
842 } else if (fi === fl) {
843 // ran out of file, but still had pattern left.
844 // this is ok if we're doing the match as part of
845 // a glob fs traversal.
847 } else if (pi === pl) {
848 // ran out of pattern, still have file left.
849 // this is only acceptable if we're on the very last
850 // empty segment of a file with a trailing slash.
851 // a/* should match a/b/
852 var emptyFileEnd = (fi === fl - 1) && (file[fi] === "")
856 // should be unreachable.
857 throw new Error("wtf?")
861 // replace stuff like \* with *
862 function globUnescape (s) {
863 return s.replace(/\\(.)/g, "$1")
867 function regExpEscape (s) {
868 return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&")
871 },{"brace-expansion":2}],2:[function(require,module,exports){
872 var concatMap = require('concat-map');
873 var balanced = require('balanced-match');
875 module.exports = expandTop;
877 var escSlash = '\0SLASH'+Math.random()+'\0';
878 var escOpen = '\0OPEN'+Math.random()+'\0';
879 var escClose = '\0CLOSE'+Math.random()+'\0';
880 var escComma = '\0COMMA'+Math.random()+'\0';
881 var escPeriod = '\0PERIOD'+Math.random()+'\0';
883 function numeric(str) {
884 return parseInt(str, 10) == str
889 function escapeBraces(str) {
890 return str.split('\\\\').join(escSlash)
891 .split('\\{').join(escOpen)
892 .split('\\}').join(escClose)
893 .split('\\,').join(escComma)
894 .split('\\.').join(escPeriod);
897 function unescapeBraces(str) {
898 return str.split(escSlash).join('\\')
899 .split(escOpen).join('{')
900 .split(escClose).join('}')
901 .split(escComma).join(',')
902 .split(escPeriod).join('.');
906 // Basically just str.split(","), but handling cases
907 // where we have nested braced sections, which should be
908 // treated as individual members, like {a,{b,c},d}
909 function parseCommaParts(str) {
914 var m = balanced('{', '}', str);
917 return str.split(',');
922 var p = pre.split(',');
924 p[p.length-1] += '{' + body + '}';
925 var postParts = parseCommaParts(post);
927 p[p.length-1] += postParts.shift();
928 p.push.apply(p, postParts);
931 parts.push.apply(parts, p);
936 function expandTop(str) {
940 var expansions = expand(escapeBraces(str));
941 return expansions.filter(identity).map(unescapeBraces);
944 function identity(e) {
948 function embrace(str) {
949 return '{' + str + '}';
951 function isPadded(el) {
952 return /^-?0\d/.test(el);
962 function expand(str) {
965 var m = balanced('{', '}', str);
966 if (!m || /\$$/.test(m.pre)) return [str];
968 var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
969 var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
970 var isSequence = isNumericSequence || isAlphaSequence;
971 var isOptions = /^(.*,)+(.+)?$/.test(m.body);
972 if (!isSequence && !isOptions) {
974 if (m.post.match(/,.*}/)) {
975 str = m.pre + '{' + m.body + escClose + m.post;
983 n = m.body.split(/\.\./);
985 n = parseCommaParts(m.body);
986 if (n.length === 1) {
987 // x{{a,b}}y ==> x{a}y x{b}y
988 n = expand(n[0]).map(embrace);
989 if (n.length === 1) {
990 var post = m.post.length
993 return post.map(function(p) {
994 return m.pre + n[0] + p;
1000 // at this point, n is the parts, and we know it's not a comma set
1001 // with a single entry.
1003 // no need to expand pre, since it is guaranteed to be free of brace-sets
1005 var post = m.post.length
1012 var x = numeric(n[0]);
1013 var y = numeric(n[1]);
1014 var width = Math.max(n[0].length, n[1].length)
1015 var incr = n.length == 3
1016 ? Math.abs(numeric(n[2]))
1019 var reverse = y < x;
1024 var pad = n.some(isPadded);
1028 for (var i = x; test(i, y); i += incr) {
1030 if (isAlphaSequence) {
1031 c = String.fromCharCode(i);
1037 var need = width - c.length;
1039 var z = new Array(need + 1).join('0');
1041 c = '-' + z + c.slice(1);
1050 N = concatMap(n, function(el) { return expand(el) });
1053 for (var j = 0; j < N.length; j++) {
1054 for (var k = 0; k < post.length; k++) {
1055 expansions.push([pre, N[j], post[k]].join(''))
1063 },{"balanced-match":3,"concat-map":4}],3:[function(require,module,exports){
1064 module.exports = balanced;
1065 function balanced(a, b, str) {
1070 for (var i = 0; i < str.length; i++) {
1071 if (a == str.substr(i, a.length)) {
1072 if (!('start' in m)) m.start = i;
1075 else if (b == str.substr(i, b.length) && 'start' in m) {
1080 m.pre = str.substr(0, m.start);
1081 m.body = (m.end - m.start > 1)
1082 ? str.substring(m.start + a.length, m.end)
1084 m.post = str.slice(m.end + b.length);
1090 // if we opened more than we closed, find the one we closed
1092 var start = m.start + a.length;
1093 m = balanced(a, b, str.substr(start));
1097 m.pre = str.slice(0, start) + m.pre;
1103 },{}],4:[function(require,module,exports){
1104 module.exports = function (xs, fn) {
1106 for (var i = 0; i < xs.length; i++) {
1107 var x = fn(xs[i], i);
1108 if (Array.isArray(x)) res.push.apply(res, x);