minimatch
Advanced tools
Comparing version 2.0.8 to 2.0.9
@@ -1,2 +0,2 @@ | ||
(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){ | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.minimatch = f()}})(function(){var define,module,exports;return (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){ | ||
module.exports = minimatch | ||
@@ -276,2 +276,3 @@ minimatch.Minimatch = Minimatch | ||
var patternListStack = [] | ||
var negativeLists = [] | ||
var plType | ||
@@ -377,5 +378,9 @@ var stateChar | ||
plType = stateChar | ||
patternListStack.push({ type: plType, start: i - 1, reStart: re.length }) | ||
patternListStack.push({ | ||
type: plType, | ||
start: i - 1, | ||
reStart: re.length | ||
}) | ||
// negation is (?:(?!js)[^/]*) | ||
re += stateChar === '!' ? '(?:(?!' : '(?:' | ||
re += stateChar === '!' ? '(?:(?!(?:' : '(?:' | ||
this.debug('plType %j %j', stateChar, re) | ||
@@ -394,3 +399,4 @@ stateChar = false | ||
re += ')' | ||
plType = patternListStack.pop().type | ||
var pl = patternListStack.pop() | ||
plType = pl.type | ||
// negation is (?:(?!js)[^/]*) | ||
@@ -400,3 +406,5 @@ // The others are (?:<pattern>)<type> | ||
case '!': | ||
re += '[^/]*?)' | ||
negativeLists.push(pl) | ||
re += ')[^/]*?)' | ||
pl.reEnd = re.length | ||
break | ||
@@ -515,3 +523,3 @@ case '?': | ||
// | chars that were already escaped. | ||
for (var pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { | ||
for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { | ||
var tail = re.slice(pl.reStart + 3) | ||
@@ -559,8 +567,32 @@ // maybe some even number of \, then maybe 1 \, followed by a | | ||
// Hack to work around lack of negative lookbehind in JS | ||
// A pattern like: *.!(x).!(y|z) needs to ensure that a name | ||
// like 'a.xyz.yz' doesn't match. So, the first negative | ||
// lookahead, has to look ALL the way ahead, to the end of | ||
// the pattern. | ||
for (var n = negativeLists.length - 1; n > -1; n--) { | ||
var nl = negativeLists[n] | ||
var nlBefore = re.slice(0, nl.reStart) | ||
var nlFirst = re.slice(nl.reStart, nl.reEnd - 8) | ||
var nlLast = re.slice(nl.reEnd - 8, nl.reEnd) | ||
var nlAfter = re.slice(nl.reEnd) | ||
var dollar = '' | ||
if (nlAfter === '' && isSub !== SUBPARSE) { | ||
dollar = '$' | ||
} | ||
var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast + nlAfter | ||
re = newRe | ||
} | ||
// if the re is not "" at this point, then we need to make sure | ||
// it doesn't match against an empty path part. | ||
// Otherwise a/* will match a/, which it should not. | ||
if (re !== '' && hasMagic) re = '(?=.)' + re | ||
if (re !== '' && hasMagic) { | ||
re = '(?=.)' + re | ||
} | ||
if (addPatternStart) re = patternStart + re | ||
if (addPatternStart) { | ||
re = patternStart + re | ||
} | ||
@@ -1119,2 +1151,3 @@ // parsing just a piece of a larger pattern. | ||
},{}]},{},[1]); | ||
},{}]},{},[1])(1) | ||
}); |
@@ -275,2 +275,3 @@ module.exports = minimatch | ||
var patternListStack = [] | ||
var negativeLists = [] | ||
var plType | ||
@@ -376,5 +377,9 @@ var stateChar | ||
plType = stateChar | ||
patternListStack.push({ type: plType, start: i - 1, reStart: re.length }) | ||
patternListStack.push({ | ||
type: plType, | ||
start: i - 1, | ||
reStart: re.length | ||
}) | ||
// negation is (?:(?!js)[^/]*) | ||
re += stateChar === '!' ? '(?:(?!' : '(?:' | ||
re += stateChar === '!' ? '(?:(?!(?:' : '(?:' | ||
this.debug('plType %j %j', stateChar, re) | ||
@@ -393,3 +398,4 @@ stateChar = false | ||
re += ')' | ||
plType = patternListStack.pop().type | ||
var pl = patternListStack.pop() | ||
plType = pl.type | ||
// negation is (?:(?!js)[^/]*) | ||
@@ -399,3 +405,5 @@ // The others are (?:<pattern>)<type> | ||
case '!': | ||
re += '[^/]*?)' | ||
negativeLists.push(pl) | ||
re += ')[^/]*?)' | ||
pl.reEnd = re.length | ||
break | ||
@@ -514,3 +522,3 @@ case '?': | ||
// | chars that were already escaped. | ||
for (var pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { | ||
for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { | ||
var tail = re.slice(pl.reStart + 3) | ||
@@ -558,8 +566,32 @@ // maybe some even number of \, then maybe 1 \, followed by a | | ||
// Hack to work around lack of negative lookbehind in JS | ||
// A pattern like: *.!(x).!(y|z) needs to ensure that a name | ||
// like 'a.xyz.yz' doesn't match. So, the first negative | ||
// lookahead, has to look ALL the way ahead, to the end of | ||
// the pattern. | ||
for (var n = negativeLists.length - 1; n > -1; n--) { | ||
var nl = negativeLists[n] | ||
var nlBefore = re.slice(0, nl.reStart) | ||
var nlFirst = re.slice(nl.reStart, nl.reEnd - 8) | ||
var nlLast = re.slice(nl.reEnd - 8, nl.reEnd) | ||
var nlAfter = re.slice(nl.reEnd) | ||
var dollar = '' | ||
if (nlAfter === '' && isSub !== SUBPARSE) { | ||
dollar = '$' | ||
} | ||
var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast + nlAfter | ||
re = newRe | ||
} | ||
// if the re is not "" at this point, then we need to make sure | ||
// it doesn't match against an empty path part. | ||
// Otherwise a/* will match a/, which it should not. | ||
if (re !== '' && hasMagic) re = '(?=.)' + re | ||
if (re !== '' && hasMagic) { | ||
re = '(?=.)' + re | ||
} | ||
if (addPatternStart) re = patternStart + re | ||
if (addPatternStart) { | ||
re = patternStart + re | ||
} | ||
@@ -566,0 +598,0 @@ // parsing just a piece of a larger pattern. |
@@ -5,3 +5,3 @@ { | ||
"description": "a glob matcher in javascript", | ||
"version": "2.0.8", | ||
"version": "2.0.9", | ||
"repository": { | ||
@@ -13,5 +13,5 @@ "type": "git", | ||
"scripts": { | ||
"pretest": "standard minimatch.js test/*.js", | ||
"posttest": "standard minimatch.js test/*.js", | ||
"test": "tap test/*.js", | ||
"prepublish": "browserify -o browser.js -e minimatch.js --bare" | ||
"prepublish": "browserify -o browser.js -e minimatch.js -s minimatch --bare" | ||
}, | ||
@@ -27,3 +27,3 @@ "engines": { | ||
"standard": "^3.7.2", | ||
"tap": "" | ||
"tap": "^1.2.0" | ||
}, | ||
@@ -30,0 +30,0 @@ "license": "ISC", |
63479
1734