minimatch
Advanced tools
Comparing version 6.0.2 to 6.0.3
@@ -212,6 +212,15 @@ "use strict"; | ||
// and will not contain any / characters | ||
const globParts = (this.globParts = globSet.map(s => s.split(slashSplit))); | ||
this.debug(this.pattern, globParts); | ||
const rawGlobParts = globSet.map(s => s.split(slashSplit)); | ||
// consecutive globstars are an unncessary perf killer | ||
this.globParts = this.options.noglobstar | ||
? rawGlobParts | ||
: rawGlobParts.map(parts => parts.reduce((set, part) => { | ||
if (part !== '**' || set[set.length - 1] !== '**') { | ||
set.push(part); | ||
} | ||
return set; | ||
}, [])); | ||
this.debug(this.pattern, this.globParts); | ||
// glob --> regexps | ||
let set = globParts.map((s, _, __) => s.map(ss => this.parse(ss))); | ||
let set = this.globParts.map((s, _, __) => s.map(ss => this.parse(ss))); | ||
this.debug(this.pattern, set); | ||
@@ -742,24 +751,15 @@ // filter out everything that didn't compile properly. | ||
const flags = options.nocase ? 'i' : ''; | ||
// coalesce globstars and regexpify non-globstar patterns | ||
// if it's the only item, then we just do one twoStar | ||
// if it's the first, and there are more, prepend (\/|twoStar\/)? to next | ||
// if it's the last, append (\/twoStar|) to previous | ||
// if it's in the middle, append (\/|\/twoStar\/) to previous | ||
// regexpify non-globstar patterns | ||
// if ** is only item, then we just do one twoStar | ||
// if ** is first, and there are more, prepend (\/|twoStar\/)? to next | ||
// if ** is last, append (\/twoStar|) to previous | ||
// if ** is in the middle, append (\/|\/twoStar\/) to previous | ||
// then filter out GLOBSTAR symbols | ||
let re = set | ||
.map(pattern => { | ||
const pp = pattern | ||
.map(p => typeof p === 'string' | ||
const pp = pattern.map(p => typeof p === 'string' | ||
? regExpEscape(p) | ||
: p === exports.GLOBSTAR | ||
? exports.GLOBSTAR | ||
: p._src) | ||
.reduce((set, p) => { | ||
if ((set[set.length - 1] === exports.GLOBSTAR && p === exports.GLOBSTAR) || | ||
p === undefined) { | ||
return set; | ||
} | ||
set.push(p); | ||
return set; | ||
}, []); | ||
: p._src); | ||
pp.forEach((p, i) => { | ||
@@ -766,0 +766,0 @@ const next = pp[i + 1]; |
@@ -200,6 +200,15 @@ export const minimatch = (p, pattern, options = {}) => { | ||
// and will not contain any / characters | ||
const globParts = (this.globParts = globSet.map(s => s.split(slashSplit))); | ||
this.debug(this.pattern, globParts); | ||
const rawGlobParts = globSet.map(s => s.split(slashSplit)); | ||
// consecutive globstars are an unncessary perf killer | ||
this.globParts = this.options.noglobstar | ||
? rawGlobParts | ||
: rawGlobParts.map(parts => parts.reduce((set, part) => { | ||
if (part !== '**' || set[set.length - 1] !== '**') { | ||
set.push(part); | ||
} | ||
return set; | ||
}, [])); | ||
this.debug(this.pattern, this.globParts); | ||
// glob --> regexps | ||
let set = globParts.map((s, _, __) => s.map(ss => this.parse(ss))); | ||
let set = this.globParts.map((s, _, __) => s.map(ss => this.parse(ss))); | ||
this.debug(this.pattern, set); | ||
@@ -730,24 +739,15 @@ // filter out everything that didn't compile properly. | ||
const flags = options.nocase ? 'i' : ''; | ||
// coalesce globstars and regexpify non-globstar patterns | ||
// if it's the only item, then we just do one twoStar | ||
// if it's the first, and there are more, prepend (\/|twoStar\/)? to next | ||
// if it's the last, append (\/twoStar|) to previous | ||
// if it's in the middle, append (\/|\/twoStar\/) to previous | ||
// regexpify non-globstar patterns | ||
// if ** is only item, then we just do one twoStar | ||
// if ** is first, and there are more, prepend (\/|twoStar\/)? to next | ||
// if ** is last, append (\/twoStar|) to previous | ||
// if ** is in the middle, append (\/|\/twoStar\/) to previous | ||
// then filter out GLOBSTAR symbols | ||
let re = set | ||
.map(pattern => { | ||
const pp = pattern | ||
.map(p => typeof p === 'string' | ||
const pp = pattern.map(p => typeof p === 'string' | ||
? regExpEscape(p) | ||
: p === GLOBSTAR | ||
? GLOBSTAR | ||
: p._src) | ||
.reduce((set, p) => { | ||
if ((set[set.length - 1] === GLOBSTAR && p === GLOBSTAR) || | ||
p === undefined) { | ||
return set; | ||
} | ||
set.push(p); | ||
return set; | ||
}, []); | ||
: p._src); | ||
pp.forEach((p, i) => { | ||
@@ -754,0 +754,0 @@ const next = pp[i + 1]; |
@@ -5,3 +5,3 @@ { | ||
"description": "a glob matcher in javascript", | ||
"version": "6.0.2", | ||
"version": "6.0.3", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "type": "git", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
137184
6