feat(planning): grille hebdomadaire complète avec API et filtres
- Connexion API via proxy Angular (résolution CORS, base path /api) - Import CSS ng-zorro global pour les modales et composants - Filtres Camion/Show câblés sur l'affichage de la grille - Camions affichés via TrucksService (linkés au show du même créneau) - Panneau de détails : spectacles + camions du jour sélectionné - Modale de création de spectacle stylisée avec fond et centrage - Positionnement précis des events à la minute dans leur créneau - Auto-scroll vers l'heure courante au chargement - Ligne "maintenant" sur la colonne du jour actuel - Régénération des services OpenAPI (nouveaux noms de types) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+140
-250
@@ -1,7 +1,10 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.unescape = exports.escape = exports.AST = exports.Minimatch = exports.match = exports.makeRe = exports.braceExpand = exports.defaults = exports.filter = exports.GLOBSTAR = exports.sep = exports.minimatch = void 0;
|
||||
const brace_expansion_1 = require("brace-expansion");
|
||||
const brace_expansion_1 = __importDefault(require("brace-expansion"));
|
||||
const assert_valid_pattern_js_1 = require("./assert-valid-pattern.js");
|
||||
const ast_js_1 = require("./ast.js");
|
||||
const escape_js_1 = require("./escape.js");
|
||||
@@ -16,7 +19,7 @@ const minimatch = (p, pattern, options = {}) => {
|
||||
};
|
||||
exports.minimatch = minimatch;
|
||||
// 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) => {
|
||||
@@ -35,7 +38,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)
|
||||
@@ -67,8 +70,8 @@ const qmarksTestNoExtDot = ([$0]) => {
|
||||
return (f) => f.length === len && f !== '.' && f !== '..';
|
||||
};
|
||||
/* c8 ignore start */
|
||||
const defaultPlatform = (typeof process === 'object' && process ?
|
||||
(typeof process.env === 'object' &&
|
||||
const defaultPlatform = (typeof process === 'object' && process
|
||||
? (typeof process.env === 'object' &&
|
||||
process.env &&
|
||||
process.env.__MINIMATCH_TESTING_PLATFORM__) ||
|
||||
process.platform
|
||||
@@ -154,7 +157,7 @@ const braceExpand = (pattern, options = {}) => {
|
||||
// shortcut. no need to expand.
|
||||
return [pattern];
|
||||
}
|
||||
return (0, brace_expansion_1.expand)(pattern, { max: options.braceExpandMax });
|
||||
return (0, brace_expansion_1.default)(pattern);
|
||||
};
|
||||
exports.braceExpand = braceExpand;
|
||||
exports.minimatch.braceExpand = exports.braceExpand;
|
||||
@@ -202,20 +205,16 @@ class Minimatch {
|
||||
isWindows;
|
||||
platform;
|
||||
windowsNoMagicRoot;
|
||||
maxGlobstarRecursion;
|
||||
regexp;
|
||||
constructor(pattern, options = {}) {
|
||||
(0, assert_valid_pattern_js_1.assertValidPattern)(pattern);
|
||||
options = options || {};
|
||||
this.options = options;
|
||||
this.maxGlobstarRecursion = options.maxGlobstarRecursion ?? 200;
|
||||
this.pattern = pattern;
|
||||
this.platform = options.platform || defaultPlatform;
|
||||
this.isWindows = this.platform === 'win32';
|
||||
// avoid the annoying deprecation flag lol
|
||||
const awe = ('allowWindow' + 'sEscape');
|
||||
this.windowsPathsNoEscape =
|
||||
!!options.windowsPathsNoEscape || options[awe] === false;
|
||||
!!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
|
||||
if (this.windowsPathsNoEscape) {
|
||||
this.pattern = this.pattern.replace(/\\/g, '/');
|
||||
}
|
||||
@@ -228,8 +227,8 @@ class Minimatch {
|
||||
this.partial = !!options.partial;
|
||||
this.nocase = !!this.options.nocase;
|
||||
this.windowsNoMagicRoot =
|
||||
options.windowsNoMagicRoot !== undefined ?
|
||||
options.windowsNoMagicRoot
|
||||
options.windowsNoMagicRoot !== undefined
|
||||
? options.windowsNoMagicRoot
|
||||
: !!(this.isWindows && this.nocase);
|
||||
this.globSet = [];
|
||||
this.globParts = [];
|
||||
@@ -267,7 +266,6 @@ 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);
|
||||
@@ -293,10 +291,7 @@ class Minimatch {
|
||||
!globMagic.test(s[3]);
|
||||
const isDrive = /^[a-z]:/i.test(s[0]);
|
||||
if (isUNC) {
|
||||
return [
|
||||
...s.slice(0, 4),
|
||||
...s.slice(4).map(ss => this.parse(ss)),
|
||||
];
|
||||
return [...s.slice(0, 4), ...s.slice(4).map(ss => this.parse(ss))];
|
||||
}
|
||||
else if (isDrive) {
|
||||
return [s[0], ...s.slice(1).map(ss => this.parse(ss))];
|
||||
@@ -328,12 +323,12 @@ class Minimatch {
|
||||
// to the right as possible, even if it increases the number
|
||||
// of patterns that we have to process.
|
||||
preprocess(globParts) {
|
||||
// if we're not in globstar mode, then turn ** into *
|
||||
// if we're not in globstar mode, then turn all ** into *
|
||||
if (this.options.noglobstar) {
|
||||
for (const partset of globParts) {
|
||||
for (let j = 0; j < partset.length; j++) {
|
||||
if (partset[j] === '**') {
|
||||
partset[j] = '*';
|
||||
for (let i = 0; i < globParts.length; i++) {
|
||||
for (let j = 0; j < globParts[i].length; j++) {
|
||||
if (globParts[i][j] === '**') {
|
||||
globParts[i][j] = '*';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -421,11 +416,7 @@ class Minimatch {
|
||||
let dd = 0;
|
||||
while (-1 !== (dd = parts.indexOf('..', dd + 1))) {
|
||||
const p = parts[dd - 1];
|
||||
if (p &&
|
||||
p !== '.' &&
|
||||
p !== '..' &&
|
||||
p !== '**' &&
|
||||
!(this.isWindows && /^[a-z]:$/i.test(p))) {
|
||||
if (p && p !== '.' && p !== '..' && p !== '**') {
|
||||
didSomething = true;
|
||||
parts.splice(dd - 1, 2);
|
||||
dd -= 2;
|
||||
@@ -618,8 +609,7 @@ class Minimatch {
|
||||
// out of pattern, then that's fine, as long as all
|
||||
// the parts match.
|
||||
matchOne(file, pattern, partial = false) {
|
||||
let fileStartIndex = 0;
|
||||
let patternStartIndex = 0;
|
||||
const options = this.options;
|
||||
// UNC paths like //?/X:/... can match X:/... and vice versa
|
||||
// Drive letters in absolute drive or unc paths are always compared
|
||||
// case-insensitively.
|
||||
@@ -637,212 +627,120 @@ class Minimatch {
|
||||
pattern[2] === '?' &&
|
||||
typeof pattern[3] === 'string' &&
|
||||
/^[a-z]:$/i.test(pattern[3]);
|
||||
const fdi = fileUNC ? 3
|
||||
: fileDrive ? 0
|
||||
: undefined;
|
||||
const pdi = patternUNC ? 3
|
||||
: patternDrive ? 0
|
||||
: undefined;
|
||||
const fdi = fileUNC ? 3 : fileDrive ? 0 : undefined;
|
||||
const pdi = patternUNC ? 3 : patternDrive ? 0 : undefined;
|
||||
if (typeof fdi === 'number' && typeof pdi === 'number') {
|
||||
const [fd, pd] = [
|
||||
file[fdi],
|
||||
pattern[pdi],
|
||||
];
|
||||
// start matching at the drive letter index of each
|
||||
const [fd, pd] = [file[fdi], pattern[pdi]];
|
||||
if (fd.toLowerCase() === pd.toLowerCase()) {
|
||||
pattern[pdi] = fd;
|
||||
patternStartIndex = pdi;
|
||||
fileStartIndex = fdi;
|
||||
if (pdi > fdi) {
|
||||
pattern = pattern.slice(pdi);
|
||||
}
|
||||
else if (fdi > pdi) {
|
||||
file = file.slice(fdi);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// resolve and reduce . and .. portions in the file as well.
|
||||
// don't need to do the second phase, because it's only one string[]
|
||||
// dont' need to do the second phase, because it's only one string[]
|
||||
const { optimizationLevel = 1 } = this.options;
|
||||
if (optimizationLevel >= 2) {
|
||||
file = this.levelTwoFileOptimize(file);
|
||||
}
|
||||
if (pattern.includes(exports.GLOBSTAR)) {
|
||||
return this.#matchGlobstar(file, pattern, partial, fileStartIndex, patternStartIndex);
|
||||
}
|
||||
return this.#matchOne(file, pattern, partial, fileStartIndex, patternStartIndex);
|
||||
}
|
||||
#matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
|
||||
// split the pattern into head, tail, and middle of ** delimited parts
|
||||
const firstgs = pattern.indexOf(exports.GLOBSTAR, patternIndex);
|
||||
const lastgs = pattern.lastIndexOf(exports.GLOBSTAR);
|
||||
// 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),
|
||||
];
|
||||
// check the head, from the current file/pattern index.
|
||||
if (head.length) {
|
||||
const fileHead = file.slice(fileIndex, fileIndex + head.length);
|
||||
if (!this.#matchOne(fileHead, head, partial, 0, 0)) {
|
||||
return false;
|
||||
}
|
||||
fileIndex += head.length;
|
||||
patternIndex += head.length;
|
||||
}
|
||||
// now we know the head matches!
|
||||
// if the last portion is not empty, it MUST match the end
|
||||
// check the tail
|
||||
let fileTailMatch = 0;
|
||||
if (tail.length) {
|
||||
// if head + tail > file, then we cannot possibly match
|
||||
if (tail.length + fileIndex > file.length)
|
||||
return false;
|
||||
// try to match the tail
|
||||
let tailStart = file.length - tail.length;
|
||||
if (this.#matchOne(file, tail, partial, tailStart, 0)) {
|
||||
fileTailMatch = tail.length;
|
||||
}
|
||||
else {
|
||||
// affordance for stuff like a/**/* matching a/b/
|
||||
// if the last file portion is '', and there's more to the pattern
|
||||
// then try without the '' bit.
|
||||
if (file[file.length - 1] !== '' ||
|
||||
fileIndex + tail.length === file.length) {
|
||||
return false;
|
||||
}
|
||||
tailStart--;
|
||||
if (!this.#matchOne(file, tail, partial, tailStart, 0)) {
|
||||
return false;
|
||||
}
|
||||
fileTailMatch = tail.length + 1;
|
||||
}
|
||||
}
|
||||
// now we know the tail matches!
|
||||
// the middle is zero or more portions wrapped in **, possibly
|
||||
// containing more ** sections.
|
||||
// so a/**/b/**/c/**/d has become **/b/**/c/**
|
||||
// if it's empty, it means a/**/b, just verify we have no bad dots
|
||||
// if there's no tail, so it ends on /**, then we must have *something*
|
||||
// after the head, or it's not a matc
|
||||
if (!body.length) {
|
||||
let sawSome = !!fileTailMatch;
|
||||
for (let i = fileIndex; i < file.length - fileTailMatch; i++) {
|
||||
const f = String(file[i]);
|
||||
sawSome = true;
|
||||
if (f === '.' ||
|
||||
f === '..' ||
|
||||
(!this.options.dot && f.startsWith('.'))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// in partial mode, we just need to get past all file parts
|
||||
return partial || sawSome;
|
||||
}
|
||||
// now we know that there's one or more body sections, which can
|
||||
// be matched anywhere from the 0 index (because the head was pruned)
|
||||
// through to the length-fileTailMatch index.
|
||||
// split the body up into sections, and note the minimum index it can
|
||||
// be found at (start with the length of all previous segments)
|
||||
// [section, before, after]
|
||||
const bodySegments = [[[], 0]];
|
||||
let currentBody = bodySegments[0];
|
||||
let nonGsParts = 0;
|
||||
const nonGsPartsSums = [0];
|
||||
for (const b of body) {
|
||||
if (b === exports.GLOBSTAR) {
|
||||
nonGsPartsSums.push(nonGsParts);
|
||||
currentBody = [[], 0];
|
||||
bodySegments.push(currentBody);
|
||||
}
|
||||
else {
|
||||
currentBody[0].push(b);
|
||||
nonGsParts++;
|
||||
}
|
||||
}
|
||||
let i = bodySegments.length - 1;
|
||||
const fileLength = file.length - fileTailMatch;
|
||||
for (const b of bodySegments) {
|
||||
b[1] = fileLength - (nonGsPartsSums[i--] + b[0].length);
|
||||
}
|
||||
return !!this.#matchGlobStarBodySections(file, bodySegments, fileIndex, 0, partial, 0, !!fileTailMatch);
|
||||
}
|
||||
// return false for "nope, not matching"
|
||||
// return null for "not matching, cannot keep trying"
|
||||
#matchGlobStarBodySections(file,
|
||||
// pattern section, last possible position for it
|
||||
bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
|
||||
// take the first body segment, and walk from fileIndex to its "after"
|
||||
// value at the end
|
||||
// If it doesn't match at that position, we increment, until we hit
|
||||
// that final possible position, and give up.
|
||||
// If it does match, then advance and try to rest.
|
||||
// If any of them fail we keep walking forward.
|
||||
// this is still a bit recursively painful, but it's more constrained
|
||||
// than previous implementations, because we never test something that
|
||||
// can't possibly be a valid matching condition.
|
||||
const bs = bodySegments[bodyIndex];
|
||||
if (!bs) {
|
||||
// just make sure that there's no bad dots
|
||||
for (let i = fileIndex; i < file.length; i++) {
|
||||
sawTail = true;
|
||||
const f = file[i];
|
||||
if (f === '.' ||
|
||||
f === '..' ||
|
||||
(!this.options.dot && f.startsWith('.'))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return sawTail;
|
||||
}
|
||||
// have a non-globstar body section to test
|
||||
const [body, after] = bs;
|
||||
while (fileIndex <= after) {
|
||||
const m = this.#matchOne(file.slice(0, fileIndex + body.length), body, partial, fileIndex, 0);
|
||||
// if limit exceeded, no match. intentional false negative,
|
||||
// acceptable break in correctness for security.
|
||||
if (m && globStarDepth < this.maxGlobstarRecursion) {
|
||||
// match! see if the rest match. if so, we're done!
|
||||
const sub = this.#matchGlobStarBodySections(file, bodySegments, fileIndex + body.length, bodyIndex + 1, partial, globStarDepth + 1, sawTail);
|
||||
if (sub !== false) {
|
||||
return sub;
|
||||
}
|
||||
}
|
||||
const f = file[fileIndex];
|
||||
if (f === '.' ||
|
||||
f === '..' ||
|
||||
(!this.options.dot && f.startsWith('.'))) {
|
||||
return false;
|
||||
}
|
||||
fileIndex++;
|
||||
}
|
||||
// walked off. no point continuing
|
||||
return partial || null;
|
||||
}
|
||||
#matchOne(file, pattern, partial, fileIndex, patternIndex) {
|
||||
let fi;
|
||||
let pi;
|
||||
let pl;
|
||||
let fl;
|
||||
for (fi = fileIndex,
|
||||
pi = patternIndex,
|
||||
fl = file.length,
|
||||
pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
||||
this.debug('matchOne', this, { file, pattern });
|
||||
this.debug('matchOne', file.length, pattern.length);
|
||||
for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
||||
this.debug('matchOne loop');
|
||||
let p = pattern[pi];
|
||||
let f = file[fi];
|
||||
var p = pattern[pi];
|
||||
var f = file[fi];
|
||||
this.debug(pattern, p, f);
|
||||
// should be impossible.
|
||||
// some invalid regexp stuff in the set.
|
||||
/* c8 ignore start */
|
||||
if (p === false || p === exports.GLOBSTAR) {
|
||||
if (p === false) {
|
||||
return false;
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
if (p === exports.GLOBSTAR) {
|
||||
this.debug('GLOBSTAR', [pattern, p, f]);
|
||||
// "**"
|
||||
// a/**/b/**/c would match the following:
|
||||
// a/b/x/y/z/c
|
||||
// a/x/y/z/b/c
|
||||
// a/b/x/b/x/c
|
||||
// a/b/c
|
||||
// To do this, take the rest of the pattern after
|
||||
// the **, and see if it would match the file remainder.
|
||||
// If so, return success.
|
||||
// If not, the ** "swallows" a segment, and try again.
|
||||
// This is recursively awful.
|
||||
//
|
||||
// a/**/b/**/c matching a/b/x/y/z/c
|
||||
// - a matches a
|
||||
// - doublestar
|
||||
// - matchOne(b/x/y/z/c, b/**/c)
|
||||
// - b matches b
|
||||
// - doublestar
|
||||
// - matchOne(x/y/z/c, c) -> no
|
||||
// - matchOne(y/z/c, c) -> no
|
||||
// - matchOne(z/c, c) -> no
|
||||
// - matchOne(c, c) yes, hit
|
||||
var fr = fi;
|
||||
var pr = pi + 1;
|
||||
if (pr === pl) {
|
||||
this.debug('** at the end');
|
||||
// a ** at the end will just swallow the rest.
|
||||
// We have found a match.
|
||||
// however, it will not swallow /.x, unless
|
||||
// options.dot is set.
|
||||
// . and .. are *never* matched by **, for explosively
|
||||
// exponential reasons.
|
||||
for (; fi < fl; fi++) {
|
||||
if (file[fi] === '.' ||
|
||||
file[fi] === '..' ||
|
||||
(!options.dot && file[fi].charAt(0) === '.'))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// ok, let's see if we can swallow whatever we can.
|
||||
while (fr < fl) {
|
||||
var swallowee = file[fr];
|
||||
this.debug('\nglobstar while', file, fr, pattern, pr, swallowee);
|
||||
// XXX remove this slice. Just pass the start index.
|
||||
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
||||
this.debug('globstar found match!', fr, fl, swallowee);
|
||||
// found a match.
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
// can't swallow "." or ".." ever.
|
||||
// can only swallow ".foo" when explicitly asked.
|
||||
if (swallowee === '.' ||
|
||||
swallowee === '..' ||
|
||||
(!options.dot && swallowee.charAt(0) === '.')) {
|
||||
this.debug('dot detected!', file, fr, pattern, pr);
|
||||
break;
|
||||
}
|
||||
// ** swallows a segment, and continue.
|
||||
this.debug('globstar swallow a segment, and continue');
|
||||
fr++;
|
||||
}
|
||||
}
|
||||
// no match was found.
|
||||
// However, in partial mode, we can't say this is necessarily over.
|
||||
/* c8 ignore start */
|
||||
if (partial) {
|
||||
// ran out of file
|
||||
this.debug('\n>>> no match, partial?', file, fr, pattern, pr);
|
||||
if (fr === fl) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
return false;
|
||||
}
|
||||
// something other than **
|
||||
// non-magic patterns just have to match exactly
|
||||
// patterns with magic have been turned into regexps.
|
||||
@@ -913,19 +811,21 @@ class Minimatch {
|
||||
fastTest = options.dot ? starTestDot : starTest;
|
||||
}
|
||||
else if ((m = pattern.match(starDotExtRE))) {
|
||||
fastTest = (options.nocase ?
|
||||
options.dot ?
|
||||
starDotExtTestNocaseDot
|
||||
fastTest = (options.nocase
|
||||
? options.dot
|
||||
? starDotExtTestNocaseDot
|
||||
: starDotExtTestNocase
|
||||
: options.dot ? starDotExtTestDot
|
||||
: options.dot
|
||||
? starDotExtTestDot
|
||||
: starDotExtTest)(m[1]);
|
||||
}
|
||||
else if ((m = pattern.match(qmarksRE))) {
|
||||
fastTest = (options.nocase ?
|
||||
options.dot ?
|
||||
qmarksTestNocaseDot
|
||||
fastTest = (options.nocase
|
||||
? options.dot
|
||||
? qmarksTestNocaseDot
|
||||
: qmarksTestNocase
|
||||
: options.dot ? qmarksTestDot
|
||||
: options.dot
|
||||
? qmarksTestDot
|
||||
: qmarksTest)(m);
|
||||
}
|
||||
else if ((m = pattern.match(starDotStarRE))) {
|
||||
@@ -956,8 +856,10 @@ class Minimatch {
|
||||
return this.regexp;
|
||||
}
|
||||
const options = this.options;
|
||||
const twoStar = options.noglobstar ? star
|
||||
: options.dot ? twoStarDot
|
||||
const twoStar = options.noglobstar
|
||||
? star
|
||||
: options.dot
|
||||
? twoStarDot
|
||||
: twoStarNoDot;
|
||||
const flags = new Set(options.nocase ? ['i'] : []);
|
||||
// regexpify non-globstar patterns
|
||||
@@ -973,9 +875,11 @@ class Minimatch {
|
||||
for (const f of p.flags.split(''))
|
||||
flags.add(f);
|
||||
}
|
||||
return (typeof p === 'string' ? regExpEscape(p)
|
||||
: p === exports.GLOBSTAR ? exports.GLOBSTAR
|
||||
: p._src);
|
||||
return typeof p === 'string'
|
||||
? regExpEscape(p)
|
||||
: p === exports.GLOBSTAR
|
||||
? exports.GLOBSTAR
|
||||
: p._src;
|
||||
});
|
||||
pp.forEach((p, i) => {
|
||||
const next = pp[i + 1];
|
||||
@@ -992,25 +896,14 @@ class Minimatch {
|
||||
}
|
||||
}
|
||||
else if (next === undefined) {
|
||||
pp[i - 1] = prev + '(?:\\/|\\/' + twoStar + ')?';
|
||||
pp[i - 1] = prev + '(?:\\/|' + twoStar + ')?';
|
||||
}
|
||||
else if (next !== exports.GLOBSTAR) {
|
||||
pp[i - 1] = prev + '(?:\\/|\\/' + twoStar + '\\/)' + next;
|
||||
pp[i + 1] = exports.GLOBSTAR;
|
||||
}
|
||||
});
|
||||
const filtered = pp.filter(p => p !== exports.GLOBSTAR);
|
||||
// For partial matches, we need to make the pattern match
|
||||
// any prefix of the full path. We do this by generating
|
||||
// alternative patterns that match progressively longer prefixes.
|
||||
if (this.partial && filtered.length >= 1) {
|
||||
const prefixes = [];
|
||||
for (let i = 1; i <= filtered.length; i++) {
|
||||
prefixes.push(filtered.slice(0, i).join('/'));
|
||||
}
|
||||
return '(?:' + prefixes.join('|') + ')';
|
||||
}
|
||||
return filtered.join('/');
|
||||
return pp.filter(p => p !== exports.GLOBSTAR).join('/');
|
||||
})
|
||||
.join('|');
|
||||
// need to wrap in parens if we had more than one thing with |,
|
||||
@@ -1019,10 +912,6 @@ class Minimatch {
|
||||
// must match entire pattern
|
||||
// ending in a * or ** will make it less strict.
|
||||
re = '^' + open + re + close + '$';
|
||||
// In partial mode, '/' should always match as it's a valid prefix for any pattern
|
||||
if (this.partial) {
|
||||
re = '^(?:\\/|' + open + re.slice(1, -1) + close + ')$';
|
||||
}
|
||||
// can match anything, as long as it's not this.
|
||||
if (this.negate)
|
||||
re = '^(?!' + re + ').+$';
|
||||
@@ -1030,7 +919,7 @@ class Minimatch {
|
||||
this.regexp = new RegExp(re, [...flags].join(''));
|
||||
/* c8 ignore start */
|
||||
}
|
||||
catch {
|
||||
catch (ex) {
|
||||
// should be impossible
|
||||
this.regexp = false;
|
||||
}
|
||||
@@ -1045,7 +934,7 @@ 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(/\/+/)];
|
||||
}
|
||||
@@ -1087,7 +976,8 @@ class Minimatch {
|
||||
filename = ff[i];
|
||||
}
|
||||
}
|
||||
for (const pattern of set) {
|
||||
for (let i = 0; i < set.length; i++) {
|
||||
const pattern = set[i];
|
||||
let file = ff;
|
||||
if (options.matchBase && pattern.length === 1) {
|
||||
file = [filename];
|
||||
|
||||
Reference in New Issue
Block a user