This commit is contained in:
bcomnes
2022-12-21 17:17:18 +00:00
parent e04c11b5e4
commit e3e555927c
4 changed files with 27 additions and 15 deletions

25
dist/index.js vendored
View File

@@ -6365,7 +6365,9 @@ minimatch.match = (list, pattern, options = {}) => {
// replace stuff like \* with *
const globUnescape = s => s.replace(/\\(.)/g, '$1')
const charUnescape = s => s.replace(/\\([^-\]])/g, '$1')
const regExpEscape = s => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')
const braExpEscape = s => s.replace(/[[\]\\]/g, '\\$&')
class Minimatch {
constructor (pattern, options) {
@@ -6700,6 +6702,11 @@ class Minimatch {
}
case '\\':
if (inClass && pattern.charAt(i + 1) === '-') {
re += c
continue
}
clearStateChar()
escaping = true
continue
@@ -6812,8 +6819,6 @@ class Minimatch {
continue
}
// handle the case where we left a class open.
// "[z-a]" is valid, equivalent to "\[z-a\]"
// split where the last [ was, make sure we don't have
// an invalid re. if so, re-walk the contents of the
// would-be class to re-translate any characters that
@@ -6823,20 +6828,16 @@ class Minimatch {
// to do safely. For now, this is safe and works.
cs = pattern.substring(classStart + 1, i)
try {
RegExp('[' + cs + ']')
RegExp('[' + braExpEscape(charUnescape(cs)) + ']')
// looks good, finish up the class.
re += c
} catch (er) {
// not a valid class!
sp = this.parse(cs, SUBPARSE)
re = re.substring(0, reClassStart) + '\\[' + sp[0] + '\\]'
hasMagic = hasMagic || sp[1]
inClass = false
continue
// out of order ranges in JS are errors, but in glob syntax,
// they're just a range that matches nothing.
re = re.substring(0, reClassStart) + '(?:$.)' // match nothing ever
}
// finish up the class.
hasMagic = true
inClass = false
re += c
continue
default:

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long