Skip to content

Commit 8c6dda0

Browse files
committedJan 26, 2023
Regenerate dist
1 parent ee0d992 commit 8c6dda0

File tree

1 file changed

+93
-69
lines changed

1 file changed

+93
-69
lines changed
 

Diff for: ‎dist/index.js

+93-69
Original file line numberDiff line numberDiff line change
@@ -14086,10 +14086,10 @@ exports.getCmdPath = getCmdPath;
1408614086
module.exports = minimatch
1408714087
minimatch.Minimatch = Minimatch
1408814088

14089-
var path = { sep: '/' }
14090-
try {
14091-
path = __webpack_require__(622)
14092-
} catch (er) {}
14089+
var path = (function () { try { return __webpack_require__(622) } catch (e) {}}()) || {
14090+
sep: '/'
14091+
}
14092+
minimatch.sep = path.sep
1409314093

1409414094
var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}
1409514095
var expand = __webpack_require__(850)
@@ -14141,43 +14141,64 @@ function filter (pattern, options) {
1414114141
}
1414214142

1414314143
function ext (a, b) {
14144-
a = a || {}
1414514144
b = b || {}
1414614145
var t = {}
14147-
Object.keys(b).forEach(function (k) {
14148-
t[k] = b[k]
14149-
})
1415014146
Object.keys(a).forEach(function (k) {
1415114147
t[k] = a[k]
1415214148
})
14149+
Object.keys(b).forEach(function (k) {
14150+
t[k] = b[k]
14151+
})
1415314152
return t
1415414153
}
1415514154

1415614155
minimatch.defaults = function (def) {
14157-
if (!def || !Object.keys(def).length) return minimatch
14156+
if (!def || typeof def !== 'object' || !Object.keys(def).length) {
14157+
return minimatch
14158+
}
1415814159

1415914160
var orig = minimatch
1416014161

1416114162
var m = function minimatch (p, pattern, options) {
14162-
return orig.minimatch(p, pattern, ext(def, options))
14163+
return orig(p, pattern, ext(def, options))
1416314164
}
1416414165

1416514166
m.Minimatch = function Minimatch (pattern, options) {
1416614167
return new orig.Minimatch(pattern, ext(def, options))
1416714168
}
14169+
m.Minimatch.defaults = function defaults (options) {
14170+
return orig.defaults(ext(def, options)).Minimatch
14171+
}
14172+
14173+
m.filter = function filter (pattern, options) {
14174+
return orig.filter(pattern, ext(def, options))
14175+
}
14176+
14177+
m.defaults = function defaults (options) {
14178+
return orig.defaults(ext(def, options))
14179+
}
14180+
14181+
m.makeRe = function makeRe (pattern, options) {
14182+
return orig.makeRe(pattern, ext(def, options))
14183+
}
14184+
14185+
m.braceExpand = function braceExpand (pattern, options) {
14186+
return orig.braceExpand(pattern, ext(def, options))
14187+
}
14188+
14189+
m.match = function (list, pattern, options) {
14190+
return orig.match(list, pattern, ext(def, options))
14191+
}
1416814192

1416914193
return m
1417014194
}
1417114195

1417214196
Minimatch.defaults = function (def) {
14173-
if (!def || !Object.keys(def).length) return Minimatch
1417414197
return minimatch.defaults(def).Minimatch
1417514198
}
1417614199

1417714200
function minimatch (p, pattern, options) {
14178-
if (typeof pattern !== 'string') {
14179-
throw new TypeError('glob pattern string required')
14180-
}
14201+
assertValidPattern(pattern)
1418114202

1418214203
if (!options) options = {}
1418314204

@@ -14186,9 +14207,6 @@ function minimatch (p, pattern, options) {
1418614207
return false
1418714208
}
1418814209

14189-
// "" only matches ""
14190-
if (pattern.trim() === '') return p === ''
14191-
1419214210
return new Minimatch(pattern, options).match(p)
1419314211
}
1419414212

@@ -14197,15 +14215,14 @@ function Minimatch (pattern, options) {
1419714215
return new Minimatch(pattern, options)
1419814216
}
1419914217

14200-
if (typeof pattern !== 'string') {
14201-
throw new TypeError('glob pattern string required')
14202-
}
14218+
assertValidPattern(pattern)
1420314219

1420414220
if (!options) options = {}
14221+
1420514222
pattern = pattern.trim()
1420614223

1420714224
// windows support: need to use /, not \
14208-
if (path.sep !== '/') {
14225+
if (!options.allowWindowsEscape && path.sep !== '/') {
1420914226
pattern = pattern.split(path.sep).join('/')
1421014227
}
1421114228

@@ -14216,6 +14233,7 @@ function Minimatch (pattern, options) {
1421614233
this.negate = false
1421714234
this.comment = false
1421814235
this.empty = false
14236+
this.partial = !!options.partial
1421914237

1422014238
// make the set of regexps etc.
1422114239
this.make()
@@ -14225,9 +14243,6 @@ Minimatch.prototype.debug = function () {}
1422514243

1422614244
Minimatch.prototype.make = make
1422714245
function make () {
14228-
// don't do it more than once.
14229-
if (this._made) return
14230-
1423114246
var pattern = this.pattern
1423214247
var options = this.options
1423314248

@@ -14247,7 +14262,7 @@ function make () {
1424714262
// step 2: expand braces
1424814263
var set = this.globSet = this.braceExpand()
1424914264

14250-
if (options.debug) this.debug = console.error
14265+
if (options.debug) this.debug = function debug() { console.error.apply(console, arguments) }
1425114266

1425214267
this.debug(this.pattern, set)
1425314268

@@ -14327,19 +14342,29 @@ function braceExpand (pattern, options) {
1432714342
pattern = typeof pattern === 'undefined'
1432814343
? this.pattern : pattern
1432914344

14330-
if (typeof pattern === 'undefined') {
14331-
throw new TypeError('undefined pattern')
14332-
}
14345+
assertValidPattern(pattern)
1433314346

14334-
if (options.nobrace ||
14335-
!pattern.match(/\{.*\}/)) {
14347+
// Thanks to Yeting Li <https://github.com/yetingli> for
14348+
// improving this regexp to avoid a ReDOS vulnerability.
14349+
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
1433614350
// shortcut. no need to expand.
1433714351
return [pattern]
1433814352
}
1433914353

1434014354
return expand(pattern)
1434114355
}
1434214356

14357+
var MAX_PATTERN_LENGTH = 1024 * 64
14358+
var assertValidPattern = function (pattern) {
14359+
if (typeof pattern !== 'string') {
14360+
throw new TypeError('invalid pattern')
14361+
}
14362+
14363+
if (pattern.length > MAX_PATTERN_LENGTH) {
14364+
throw new TypeError('pattern is too long')
14365+
}
14366+
}
14367+
1434314368
// parse a component of the expanded set.
1434414369
// At this point, no pattern may contain "/" in it
1434514370
// so we're going to return a 2d array, where each entry is the full
@@ -14354,14 +14379,17 @@ function braceExpand (pattern, options) {
1435414379
Minimatch.prototype.parse = parse
1435514380
var SUBPARSE = {}
1435614381
function parse (pattern, isSub) {
14357-
if (pattern.length > 1024 * 64) {
14358-
throw new TypeError('pattern is too long')
14359-
}
14382+
assertValidPattern(pattern)
1436014383

1436114384
var options = this.options
1436214385

1436314386
// shortcuts
14364-
if (!options.noglobstar && pattern === '**') return GLOBSTAR
14387+
if (pattern === '**') {
14388+
if (!options.noglobstar)
14389+
return GLOBSTAR
14390+
else
14391+
pattern = '*'
14392+
}
1436514393
if (pattern === '') return ''
1436614394

1436714395
var re = ''
@@ -14417,10 +14445,12 @@ function parse (pattern, isSub) {
1441714445
}
1441814446

1441914447
switch (c) {
14420-
case '/':
14448+
/* istanbul ignore next */
14449+
case '/': {
1442114450
// completely not allowed, even escaped.
1442214451
// Should already be path-split by now.
1442314452
return false
14453+
}
1442414454

1442514455
case '\\':
1442614456
clearStateChar()
@@ -14539,25 +14569,23 @@ function parse (pattern, isSub) {
1453914569

1454014570
// handle the case where we left a class open.
1454114571
// "[z-a]" is valid, equivalent to "\[z-a\]"
14542-
if (inClass) {
14543-
// split where the last [ was, make sure we don't have
14544-
// an invalid re. if so, re-walk the contents of the
14545-
// would-be class to re-translate any characters that
14546-
// were passed through as-is
14547-
// TODO: It would probably be faster to determine this
14548-
// without a try/catch and a new RegExp, but it's tricky
14549-
// to do safely. For now, this is safe and works.
14550-
var cs = pattern.substring(classStart + 1, i)
14551-
try {
14552-
RegExp('[' + cs + ']')
14553-
} catch (er) {
14554-
// not a valid class!
14555-
var sp = this.parse(cs, SUBPARSE)
14556-
re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]'
14557-
hasMagic = hasMagic || sp[1]
14558-
inClass = false
14559-
continue
14560-
}
14572+
// split where the last [ was, make sure we don't have
14573+
// an invalid re. if so, re-walk the contents of the
14574+
// would-be class to re-translate any characters that
14575+
// were passed through as-is
14576+
// TODO: It would probably be faster to determine this
14577+
// without a try/catch and a new RegExp, but it's tricky
14578+
// to do safely. For now, this is safe and works.
14579+
var cs = pattern.substring(classStart + 1, i)
14580+
try {
14581+
RegExp('[' + cs + ']')
14582+
} catch (er) {
14583+
// not a valid class!
14584+
var sp = this.parse(cs, SUBPARSE)
14585+
re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]'
14586+
hasMagic = hasMagic || sp[1]
14587+
inClass = false
14588+
continue
1456114589
}
1456214590

1456314591
// finish up the class.
@@ -14641,9 +14669,7 @@ function parse (pattern, isSub) {
1464114669
// something that could conceivably capture a dot
1464214670
var addPatternStart = false
1464314671
switch (re.charAt(0)) {
14644-
case '.':
14645-
case '[':
14646-
case '(': addPatternStart = true
14672+
case '[': case '.': case '(': addPatternStart = true
1464714673
}
1464814674

1464914675
// Hack to work around lack of negative lookbehind in JS
@@ -14705,7 +14731,7 @@ function parse (pattern, isSub) {
1470514731
var flags = options.nocase ? 'i' : ''
1470614732
try {
1470714733
var regExp = new RegExp('^' + re + '$', flags)
14708-
} catch (er) {
14734+
} catch (er) /* istanbul ignore next - should be impossible */ {
1470914735
// If it was an invalid regular expression, then it can't match
1471014736
// anything. This trick looks for a character after the end of
1471114737
// the string, which is of course impossible, except in multi-line
@@ -14763,7 +14789,7 @@ function makeRe () {
1476314789

1476414790
try {
1476514791
this.regexp = new RegExp(re, flags)
14766-
} catch (ex) {
14792+
} catch (ex) /* istanbul ignore next - should be impossible */ {
1476714793
this.regexp = false
1476814794
}
1476914795
return this.regexp
@@ -14781,8 +14807,8 @@ minimatch.match = function (list, pattern, options) {
1478114807
return list
1478214808
}
1478314809

14784-
Minimatch.prototype.match = match
14785-
function match (f, partial) {
14810+
Minimatch.prototype.match = function match (f, partial) {
14811+
if (typeof partial === 'undefined') partial = this.partial
1478614812
this.debug('match', f, this.pattern)
1478714813
// short-circuit in the case of busted things.
1478814814
// comments, etc.
@@ -14864,6 +14890,7 @@ Minimatch.prototype.matchOne = function (file, pattern, partial) {
1486414890

1486514891
// should be impossible.
1486614892
// some invalid regexp stuff in the set.
14893+
/* istanbul ignore if */
1486714894
if (p === false) return false
1486814895

1486914896
if (p === GLOBSTAR) {
@@ -14937,6 +14964,7 @@ Minimatch.prototype.matchOne = function (file, pattern, partial) {
1493714964
// no match was found.
1493814965
// However, in partial mode, we can't say this is necessarily over.
1493914966
// If there's more *pattern* left, then
14967+
/* istanbul ignore if */
1494014968
if (partial) {
1494114969
// ran out of file
1494214970
this.debug('\n>>> no match, partial?', file, fr, pattern, pr)
@@ -14950,11 +14978,7 @@ Minimatch.prototype.matchOne = function (file, pattern, partial) {
1495014978
// patterns with magic have been turned into regexps.
1495114979
var hit
1495214980
if (typeof p === 'string') {
14953-
if (options.nocase) {
14954-
hit = f.toLowerCase() === p.toLowerCase()
14955-
} else {
14956-
hit = f === p
14957-
}
14981+
hit = f === p
1495814982
this.debug('string match', p, f, hit)
1495914983
} else {
1496014984
hit = f.match(p)
@@ -14985,16 +15009,16 @@ Minimatch.prototype.matchOne = function (file, pattern, partial) {
1498515009
// this is ok if we're doing the match as part of
1498615010
// a glob fs traversal.
1498715011
return partial
14988-
} else if (pi === pl) {
15012+
} else /* istanbul ignore else */ if (pi === pl) {
1498915013
// ran out of pattern, still have file left.
1499015014
// this is only acceptable if we're on the very last
1499115015
// empty segment of a file with a trailing slash.
1499215016
// a/* should match a/b/
14993-
var emptyFileEnd = (fi === fl - 1) && (file[fi] === '')
14994-
return emptyFileEnd
15017+
return (fi === fl - 1) && (file[fi] === '')
1499515018
}
1499615019

1499715020
// should be unreachable.
15021+
/* istanbul ignore next */
1499815022
throw new Error('wtf?')
1499915023
}
1500015024

0 commit comments

Comments
 (0)
Please sign in to comment.