@@ -45312,10 +45312,10 @@ function populateMaps (extensions, types) {
45312
45312
module.exports = minimatch
45313
45313
minimatch.Minimatch = Minimatch
45314
45314
45315
- var path = (function () { try { return __nccwpck_require__(1017) } catch (e) {}}()) || {
45316
- sep: '/'
45317
- }
45318
- minimatch.sep = path.sep
45315
+ var path = { sep: '/' }
45316
+ try {
45317
+ path = __nccwpck_require__(1017)
45318
+ } catch (er) {}
45319
45319
45320
45320
var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}
45321
45321
var expand = __nccwpck_require__(3717)
@@ -45367,64 +45367,43 @@ function filter (pattern, options) {
45367
45367
}
45368
45368
45369
45369
function ext (a, b) {
45370
+ a = a || {}
45370
45371
b = b || {}
45371
45372
var t = {}
45372
- Object.keys(a).forEach(function (k) {
45373
- t[k] = a[k]
45374
- })
45375
45373
Object.keys(b).forEach(function (k) {
45376
45374
t[k] = b[k]
45377
45375
})
45376
+ Object.keys(a).forEach(function (k) {
45377
+ t[k] = a[k]
45378
+ })
45378
45379
return t
45379
45380
}
45380
45381
45381
45382
minimatch.defaults = function (def) {
45382
- if (!def || typeof def !== 'object' || !Object.keys(def).length) {
45383
- return minimatch
45384
- }
45383
+ if (!def || !Object.keys(def).length) return minimatch
45385
45384
45386
45385
var orig = minimatch
45387
45386
45388
45387
var m = function minimatch (p, pattern, options) {
45389
- return orig(p, pattern, ext(def, options))
45388
+ return orig.minimatch (p, pattern, ext(def, options))
45390
45389
}
45391
45390
45392
45391
m.Minimatch = function Minimatch (pattern, options) {
45393
45392
return new orig.Minimatch(pattern, ext(def, options))
45394
45393
}
45395
- m.Minimatch.defaults = function defaults (options) {
45396
- return orig.defaults(ext(def, options)).Minimatch
45397
- }
45398
-
45399
- m.filter = function filter (pattern, options) {
45400
- return orig.filter(pattern, ext(def, options))
45401
- }
45402
-
45403
- m.defaults = function defaults (options) {
45404
- return orig.defaults(ext(def, options))
45405
- }
45406
-
45407
- m.makeRe = function makeRe (pattern, options) {
45408
- return orig.makeRe(pattern, ext(def, options))
45409
- }
45410
-
45411
- m.braceExpand = function braceExpand (pattern, options) {
45412
- return orig.braceExpand(pattern, ext(def, options))
45413
- }
45414
-
45415
- m.match = function (list, pattern, options) {
45416
- return orig.match(list, pattern, ext(def, options))
45417
- }
45418
45394
45419
45395
return m
45420
45396
}
45421
45397
45422
45398
Minimatch.defaults = function (def) {
45399
+ if (!def || !Object.keys(def).length) return Minimatch
45423
45400
return minimatch.defaults(def).Minimatch
45424
45401
}
45425
45402
45426
45403
function minimatch (p, pattern, options) {
45427
- assertValidPattern(pattern)
45404
+ if (typeof pattern !== 'string') {
45405
+ throw new TypeError('glob pattern string required')
45406
+ }
45428
45407
45429
45408
if (!options) options = {}
45430
45409
@@ -45433,6 +45412,9 @@ function minimatch (p, pattern, options) {
45433
45412
return false
45434
45413
}
45435
45414
45415
+ // "" only matches ""
45416
+ if (pattern.trim() === '') return p === ''
45417
+
45436
45418
return new Minimatch(pattern, options).match(p)
45437
45419
}
45438
45420
@@ -45441,14 +45423,15 @@ function Minimatch (pattern, options) {
45441
45423
return new Minimatch(pattern, options)
45442
45424
}
45443
45425
45444
- assertValidPattern(pattern)
45426
+ if (typeof pattern !== 'string') {
45427
+ throw new TypeError('glob pattern string required')
45428
+ }
45445
45429
45446
45430
if (!options) options = {}
45447
-
45448
45431
pattern = pattern.trim()
45449
45432
45450
45433
// windows support: need to use /, not \
45451
- if (!options.allowWindowsEscape && path.sep !== '/') {
45434
+ if (path.sep !== '/') {
45452
45435
pattern = pattern.split(path.sep).join('/')
45453
45436
}
45454
45437
@@ -45459,7 +45442,6 @@ function Minimatch (pattern, options) {
45459
45442
this.negate = false
45460
45443
this.comment = false
45461
45444
this.empty = false
45462
- this.partial = !!options.partial
45463
45445
45464
45446
// make the set of regexps etc.
45465
45447
this.make()
@@ -45469,6 +45451,9 @@ Minimatch.prototype.debug = function () {}
45469
45451
45470
45452
Minimatch.prototype.make = make
45471
45453
function make () {
45454
+ // don't do it more than once.
45455
+ if (this._made) return
45456
+
45472
45457
var pattern = this.pattern
45473
45458
var options = this.options
45474
45459
@@ -45488,7 +45473,7 @@ function make () {
45488
45473
// step 2: expand braces
45489
45474
var set = this.globSet = this.braceExpand()
45490
45475
45491
- if (options.debug) this.debug = function debug() { console.error.apply(console, arguments) }
45476
+ if (options.debug) this.debug = console.error
45492
45477
45493
45478
this.debug(this.pattern, set)
45494
45479
@@ -45568,29 +45553,19 @@ function braceExpand (pattern, options) {
45568
45553
pattern = typeof pattern === 'undefined'
45569
45554
? this.pattern : pattern
45570
45555
45571
- assertValidPattern(pattern)
45556
+ if (typeof pattern === 'undefined') {
45557
+ throw new TypeError('undefined pattern')
45558
+ }
45572
45559
45573
- // Thanks to Yeting Li <https://github.com/yetingli> for
45574
- // improving this regexp to avoid a ReDOS vulnerability.
45575
- if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
45560
+ if (options.nobrace ||
45561
+ !pattern.match(/\{.*\}/)) {
45576
45562
// shortcut. no need to expand.
45577
45563
return [pattern]
45578
45564
}
45579
45565
45580
45566
return expand(pattern)
45581
45567
}
45582
45568
45583
- var MAX_PATTERN_LENGTH = 1024 * 64
45584
- var assertValidPattern = function (pattern) {
45585
- if (typeof pattern !== 'string') {
45586
- throw new TypeError('invalid pattern')
45587
- }
45588
-
45589
- if (pattern.length > MAX_PATTERN_LENGTH) {
45590
- throw new TypeError('pattern is too long')
45591
- }
45592
- }
45593
-
45594
45569
// parse a component of the expanded set.
45595
45570
// At this point, no pattern may contain "/" in it
45596
45571
// so we're going to return a 2d array, where each entry is the full
@@ -45605,17 +45580,14 @@ var assertValidPattern = function (pattern) {
45605
45580
Minimatch.prototype.parse = parse
45606
45581
var SUBPARSE = {}
45607
45582
function parse (pattern, isSub) {
45608
- assertValidPattern(pattern)
45583
+ if (pattern.length > 1024 * 64) {
45584
+ throw new TypeError('pattern is too long')
45585
+ }
45609
45586
45610
45587
var options = this.options
45611
45588
45612
45589
// shortcuts
45613
- if (pattern === '**') {
45614
- if (!options.noglobstar)
45615
- return GLOBSTAR
45616
- else
45617
- pattern = '*'
45618
- }
45590
+ if (!options.noglobstar && pattern === '**') return GLOBSTAR
45619
45591
if (pattern === '') return ''
45620
45592
45621
45593
var re = ''
@@ -45671,12 +45643,10 @@ function parse (pattern, isSub) {
45671
45643
}
45672
45644
45673
45645
switch (c) {
45674
- /* istanbul ignore next */
45675
- case '/': {
45646
+ case '/':
45676
45647
// completely not allowed, even escaped.
45677
45648
// Should already be path-split by now.
45678
45649
return false
45679
- }
45680
45650
45681
45651
case '\\':
45682
45652
clearStateChar()
@@ -45795,23 +45765,25 @@ function parse (pattern, isSub) {
45795
45765
45796
45766
// handle the case where we left a class open.
45797
45767
// "[z-a]" is valid, equivalent to "\[z-a\]"
45798
- // split where the last [ was, make sure we don't have
45799
- // an invalid re. if so, re-walk the contents of the
45800
- // would-be class to re-translate any characters that
45801
- // were passed through as-is
45802
- // TODO: It would probably be faster to determine this
45803
- // without a try/catch and a new RegExp, but it's tricky
45804
- // to do safely. For now, this is safe and works.
45805
- var cs = pattern.substring(classStart + 1, i)
45806
- try {
45807
- RegExp('[' + cs + ']')
45808
- } catch (er) {
45809
- // not a valid class!
45810
- var sp = this.parse(cs, SUBPARSE)
45811
- re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]'
45812
- hasMagic = hasMagic || sp[1]
45813
- inClass = false
45814
- continue
45768
+ if (inClass) {
45769
+ // split where the last [ was, make sure we don't have
45770
+ // an invalid re. if so, re-walk the contents of the
45771
+ // would-be class to re-translate any characters that
45772
+ // were passed through as-is
45773
+ // TODO: It would probably be faster to determine this
45774
+ // without a try/catch and a new RegExp, but it's tricky
45775
+ // to do safely. For now, this is safe and works.
45776
+ var cs = pattern.substring(classStart + 1, i)
45777
+ try {
45778
+ RegExp('[' + cs + ']')
45779
+ } catch (er) {
45780
+ // not a valid class!
45781
+ var sp = this.parse(cs, SUBPARSE)
45782
+ re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]'
45783
+ hasMagic = hasMagic || sp[1]
45784
+ inClass = false
45785
+ continue
45786
+ }
45815
45787
}
45816
45788
45817
45789
// finish up the class.
@@ -45895,7 +45867,9 @@ function parse (pattern, isSub) {
45895
45867
// something that could conceivably capture a dot
45896
45868
var addPatternStart = false
45897
45869
switch (re.charAt(0)) {
45898
- case '[': case '.': case '(': addPatternStart = true
45870
+ case '.':
45871
+ case '[':
45872
+ case '(': addPatternStart = true
45899
45873
}
45900
45874
45901
45875
// Hack to work around lack of negative lookbehind in JS
@@ -45957,7 +45931,7 @@ function parse (pattern, isSub) {
45957
45931
var flags = options.nocase ? 'i' : ''
45958
45932
try {
45959
45933
var regExp = new RegExp('^' + re + '$', flags)
45960
- } catch (er) /* istanbul ignore next - should be impossible */ {
45934
+ } catch (er) {
45961
45935
// If it was an invalid regular expression, then it can't match
45962
45936
// anything. This trick looks for a character after the end of
45963
45937
// the string, which is of course impossible, except in multi-line
@@ -46015,7 +45989,7 @@ function makeRe () {
46015
45989
46016
45990
try {
46017
45991
this.regexp = new RegExp(re, flags)
46018
- } catch (ex) /* istanbul ignore next - should be impossible */ {
45992
+ } catch (ex) {
46019
45993
this.regexp = false
46020
45994
}
46021
45995
return this.regexp
@@ -46033,8 +46007,8 @@ minimatch.match = function (list, pattern, options) {
46033
46007
return list
46034
46008
}
46035
46009
46036
- Minimatch.prototype.match = function match (f, partial) {
46037
- if (typeof partial === 'undefined') partial = this.partial
46010
+ Minimatch.prototype.match = match
46011
+ function match (f, partial) {
46038
46012
this.debug('match', f, this.pattern)
46039
46013
// short-circuit in the case of busted things.
46040
46014
// comments, etc.
@@ -46116,7 +46090,6 @@ Minimatch.prototype.matchOne = function (file, pattern, partial) {
46116
46090
46117
46091
// should be impossible.
46118
46092
// some invalid regexp stuff in the set.
46119
- /* istanbul ignore if */
46120
46093
if (p === false) return false
46121
46094
46122
46095
if (p === GLOBSTAR) {
@@ -46190,7 +46163,6 @@ Minimatch.prototype.matchOne = function (file, pattern, partial) {
46190
46163
// no match was found.
46191
46164
// However, in partial mode, we can't say this is necessarily over.
46192
46165
// If there's more *pattern* left, then
46193
- /* istanbul ignore if */
46194
46166
if (partial) {
46195
46167
// ran out of file
46196
46168
this.debug('\n>>> no match, partial?', file, fr, pattern, pr)
@@ -46204,7 +46176,11 @@ Minimatch.prototype.matchOne = function (file, pattern, partial) {
46204
46176
// patterns with magic have been turned into regexps.
46205
46177
var hit
46206
46178
if (typeof p === 'string') {
46207
- hit = f === p
46179
+ if (options.nocase) {
46180
+ hit = f.toLowerCase() === p.toLowerCase()
46181
+ } else {
46182
+ hit = f === p
46183
+ }
46208
46184
this.debug('string match', p, f, hit)
46209
46185
} else {
46210
46186
hit = f.match(p)
@@ -46235,16 +46211,16 @@ Minimatch.prototype.matchOne = function (file, pattern, partial) {
46235
46211
// this is ok if we're doing the match as part of
46236
46212
// a glob fs traversal.
46237
46213
return partial
46238
- } else /* istanbul ignore else */ if (pi === pl) {
46214
+ } else if (pi === pl) {
46239
46215
// ran out of pattern, still have file left.
46240
46216
// this is only acceptable if we're on the very last
46241
46217
// empty segment of a file with a trailing slash.
46242
46218
// a/* should match a/b/
46243
- return (fi === fl - 1) && (file[fi] === '')
46219
+ var emptyFileEnd = (fi === fl - 1) && (file[fi] === '')
46220
+ return emptyFileEnd
46244
46221
}
46245
46222
46246
46223
// should be unreachable.
46247
- /* istanbul ignore next */
46248
46224
throw new Error('wtf?')
46249
46225
}
46250
46226
0 commit comments