formacao
This commit is contained in:
+26
-20
@@ -12,7 +12,7 @@ export const minimatch = (p, pattern, options = {}) => {
|
||||
return new Minimatch(pattern, options).match(p);
|
||||
};
|
||||
// Optimized checking for the most common glob patterns.
|
||||
const starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/;
|
||||
const starDotExtRE = /^\*+([^+@!?*[(]*)$/;
|
||||
const starDotExtTest = (ext) => (f) => !f.startsWith('.') && f.endsWith(ext);
|
||||
const starDotExtTestDot = (ext) => (f) => f.endsWith(ext);
|
||||
const starDotExtTestNocase = (ext) => {
|
||||
@@ -31,7 +31,7 @@ const dotStarTest = (f) => f !== '.' && f !== '..' && f.startsWith('.');
|
||||
const starRE = /^\*+$/;
|
||||
const starTest = (f) => f.length !== 0 && !f.startsWith('.');
|
||||
const starTestDot = (f) => f.length !== 0 && f !== '.' && f !== '..';
|
||||
const qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
|
||||
const qmarksRE = /^\?+([^+@!?*[(]*)?$/;
|
||||
const qmarksTestNocase = ([$0, ext = '']) => {
|
||||
const noext = qmarksTestNoExt([$0]);
|
||||
if (!ext)
|
||||
@@ -258,6 +258,7 @@ export class Minimatch {
|
||||
// step 2: expand braces
|
||||
this.globSet = [...new Set(this.braceExpand())];
|
||||
if (options.debug) {
|
||||
//oxlint-disable-next-line no-console
|
||||
this.debug = (...args) => console.error(...args);
|
||||
}
|
||||
this.debug(this.pattern, this.globSet);
|
||||
@@ -320,10 +321,10 @@ export class Minimatch {
|
||||
preprocess(globParts) {
|
||||
// if we're not in globstar mode, then turn ** into *
|
||||
if (this.options.noglobstar) {
|
||||
for (let i = 0; i < globParts.length; i++) {
|
||||
for (let j = 0; j < globParts[i].length; j++) {
|
||||
if (globParts[i][j] === '**') {
|
||||
globParts[i][j] = '*';
|
||||
for (const partset of globParts) {
|
||||
for (let j = 0; j < partset.length; j++) {
|
||||
if (partset[j] === '**') {
|
||||
partset[j] = '*';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -411,7 +412,11 @@ export class Minimatch {
|
||||
let dd = 0;
|
||||
while (-1 !== (dd = parts.indexOf('..', dd + 1))) {
|
||||
const p = parts[dd - 1];
|
||||
if (p && p !== '.' && p !== '..' && p !== '**') {
|
||||
if (p &&
|
||||
p !== '.' &&
|
||||
p !== '..' &&
|
||||
p !== '**' &&
|
||||
!(this.isWindows && /^[a-z]:$/i.test(p))) {
|
||||
didSomething = true;
|
||||
parts.splice(dd - 1, 2);
|
||||
dd -= 2;
|
||||
@@ -660,15 +665,17 @@ export class Minimatch {
|
||||
// split the pattern up into globstar-delimited sections
|
||||
// the tail has to be at the end, and the others just have
|
||||
// to be found in order from the head.
|
||||
const [head, body, tail] = partial ? [
|
||||
pattern.slice(patternIndex, firstgs),
|
||||
pattern.slice(firstgs + 1),
|
||||
[],
|
||||
] : [
|
||||
pattern.slice(patternIndex, firstgs),
|
||||
pattern.slice(firstgs + 1, lastgs),
|
||||
pattern.slice(lastgs + 1),
|
||||
];
|
||||
const [head, body, tail] = partial ?
|
||||
[
|
||||
pattern.slice(patternIndex, firstgs),
|
||||
pattern.slice(firstgs + 1),
|
||||
[],
|
||||
]
|
||||
: [
|
||||
pattern.slice(patternIndex, firstgs),
|
||||
pattern.slice(firstgs + 1, lastgs),
|
||||
pattern.slice(lastgs + 1),
|
||||
];
|
||||
// check the head, from the current file/pattern index.
|
||||
if (head.length) {
|
||||
const fileHead = file.slice(fileIndex, fileIndex + head.length);
|
||||
@@ -1014,7 +1021,7 @@ export class Minimatch {
|
||||
this.regexp = new RegExp(re, [...flags].join(''));
|
||||
/* c8 ignore start */
|
||||
}
|
||||
catch (ex) {
|
||||
catch {
|
||||
// should be impossible
|
||||
this.regexp = false;
|
||||
}
|
||||
@@ -1029,7 +1036,7 @@ export class Minimatch {
|
||||
if (this.preserveMultipleSlashes) {
|
||||
return p.split('/');
|
||||
}
|
||||
else if (this.isWindows && /^\/\/[^\/]+/.test(p)) {
|
||||
else if (this.isWindows && /^\/\/[^/]+/.test(p)) {
|
||||
// add an extra '' for the one we lose
|
||||
return ['', ...p.split(/\/+/)];
|
||||
}
|
||||
@@ -1071,8 +1078,7 @@ export class Minimatch {
|
||||
filename = ff[i];
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < set.length; i++) {
|
||||
const pattern = set[i];
|
||||
for (const pattern of set) {
|
||||
let file = ff;
|
||||
if (options.matchBase && pattern.length === 1) {
|
||||
file = [filename];
|
||||
|
||||
Reference in New Issue
Block a user