mirror of
https://github.com/github/codeql-action.git
synced 2026-05-02 03:40:10 +00:00
Rebuild
This commit is contained in:
Generated
+583
-147
@@ -49361,6 +49361,7 @@ var require_minimatch = __commonJS({
|
||||
pattern = pattern.split(path7.sep).join("/");
|
||||
}
|
||||
this.options = options;
|
||||
this.maxGlobstarRecursion = options.maxGlobstarRecursion !== void 0 ? options.maxGlobstarRecursion : 200;
|
||||
this.set = [];
|
||||
this.pattern = pattern;
|
||||
this.regexp = null;
|
||||
@@ -49757,50 +49758,147 @@ var require_minimatch = __commonJS({
|
||||
return this.negate;
|
||||
};
|
||||
Minimatch.prototype.matchOne = function(file, pattern, partial) {
|
||||
var options = this.options;
|
||||
this.debug(
|
||||
"matchOne",
|
||||
{ "this": this, file, pattern }
|
||||
if (pattern.indexOf(GLOBSTAR) !== -1) {
|
||||
return this._matchGlobstar(file, pattern, partial, 0, 0);
|
||||
}
|
||||
return this._matchOne(file, pattern, partial, 0, 0);
|
||||
};
|
||||
Minimatch.prototype._matchGlobstar = function(file, pattern, partial, fileIndex, patternIndex) {
|
||||
var i;
|
||||
var firstgs = -1;
|
||||
for (i = patternIndex; i < pattern.length; i++) {
|
||||
if (pattern[i] === GLOBSTAR) {
|
||||
firstgs = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var lastgs = -1;
|
||||
for (i = pattern.length - 1; i >= 0; i--) {
|
||||
if (pattern[i] === GLOBSTAR) {
|
||||
lastgs = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var head = pattern.slice(patternIndex, firstgs);
|
||||
var body = partial ? pattern.slice(firstgs + 1) : pattern.slice(firstgs + 1, lastgs);
|
||||
var tail = partial ? [] : pattern.slice(lastgs + 1);
|
||||
if (head.length) {
|
||||
var fileHead = file.slice(fileIndex, fileIndex + head.length);
|
||||
if (!this._matchOne(fileHead, head, partial, 0, 0)) {
|
||||
return false;
|
||||
}
|
||||
fileIndex += head.length;
|
||||
}
|
||||
var fileTailMatch = 0;
|
||||
if (tail.length) {
|
||||
if (tail.length + fileIndex > file.length) return false;
|
||||
var tailStart = file.length - tail.length;
|
||||
if (this._matchOne(file, tail, partial, tailStart, 0)) {
|
||||
fileTailMatch = tail.length;
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
}
|
||||
if (!body.length) {
|
||||
var sawSome = !!fileTailMatch;
|
||||
for (i = fileIndex; i < file.length - fileTailMatch; i++) {
|
||||
var f = String(file[i]);
|
||||
sawSome = true;
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return partial || sawSome;
|
||||
}
|
||||
var bodySegments = [[[], 0]];
|
||||
var currentBody = bodySegments[0];
|
||||
var nonGsParts = 0;
|
||||
var nonGsPartsSums = [0];
|
||||
for (var bi = 0; bi < body.length; bi++) {
|
||||
var b = body[bi];
|
||||
if (b === GLOBSTAR) {
|
||||
nonGsPartsSums.push(nonGsParts);
|
||||
currentBody = [[], 0];
|
||||
bodySegments.push(currentBody);
|
||||
} else {
|
||||
currentBody[0].push(b);
|
||||
nonGsParts++;
|
||||
}
|
||||
}
|
||||
var idx = bodySegments.length - 1;
|
||||
var fileLength = file.length - fileTailMatch;
|
||||
for (var si = 0; si < bodySegments.length; si++) {
|
||||
bodySegments[si][1] = fileLength - (nonGsPartsSums[idx--] + bodySegments[si][0].length);
|
||||
}
|
||||
return !!this._matchGlobStarBodySections(
|
||||
file,
|
||||
bodySegments,
|
||||
fileIndex,
|
||||
0,
|
||||
partial,
|
||||
0,
|
||||
!!fileTailMatch
|
||||
);
|
||||
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++) {
|
||||
};
|
||||
Minimatch.prototype._matchGlobStarBodySections = function(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
|
||||
var bs = bodySegments[bodyIndex];
|
||||
if (!bs) {
|
||||
for (var i = fileIndex; i < file.length; i++) {
|
||||
sawTail = true;
|
||||
var f = file[i];
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return sawTail;
|
||||
}
|
||||
var body = bs[0];
|
||||
var after = bs[1];
|
||||
while (fileIndex <= after) {
|
||||
var m = this._matchOne(
|
||||
file.slice(0, fileIndex + body.length),
|
||||
body,
|
||||
partial,
|
||||
fileIndex,
|
||||
0
|
||||
);
|
||||
if (m && globStarDepth < this.maxGlobstarRecursion) {
|
||||
var sub = this._matchGlobStarBodySections(
|
||||
file,
|
||||
bodySegments,
|
||||
fileIndex + body.length,
|
||||
bodyIndex + 1,
|
||||
partial,
|
||||
globStarDepth + 1,
|
||||
sawTail
|
||||
);
|
||||
if (sub !== false) {
|
||||
return sub;
|
||||
}
|
||||
}
|
||||
var f = file[fileIndex];
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
fileIndex++;
|
||||
}
|
||||
return partial || null;
|
||||
};
|
||||
Minimatch.prototype._matchOne = function(file, pattern, partial, fileIndex, patternIndex) {
|
||||
var fi, pi, fl, pl;
|
||||
for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
||||
this.debug("matchOne loop");
|
||||
var p = pattern[pi];
|
||||
var f = file[fi];
|
||||
this.debug(pattern, p, f);
|
||||
if (p === false) return false;
|
||||
if (p === GLOBSTAR) {
|
||||
this.debug("GLOBSTAR", [pattern, p, f]);
|
||||
var fr = fi;
|
||||
var pr = pi + 1;
|
||||
if (pr === pl) {
|
||||
this.debug("** at the end");
|
||||
for (; fi < fl; fi++) {
|
||||
if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".") return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
while (fr < fl) {
|
||||
var swallowee = file[fr];
|
||||
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
|
||||
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
||||
this.debug("globstar found match!", fr, fl, swallowee);
|
||||
return true;
|
||||
} else {
|
||||
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
|
||||
this.debug("dot detected!", file, fr, pattern, pr);
|
||||
break;
|
||||
}
|
||||
this.debug("globstar swallow a segment, and continue");
|
||||
fr++;
|
||||
}
|
||||
}
|
||||
if (partial) {
|
||||
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
|
||||
if (fr === fl) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (p === false || p === GLOBSTAR) return false;
|
||||
var hit;
|
||||
if (typeof p === "string") {
|
||||
hit = f === p;
|
||||
@@ -103376,6 +103474,7 @@ var require_minimatch2 = __commonJS({
|
||||
assertValidPattern(pattern);
|
||||
if (!options) options = {};
|
||||
this.options = options;
|
||||
this.maxGlobstarRecursion = options.maxGlobstarRecursion !== void 0 ? options.maxGlobstarRecursion : 200;
|
||||
this.set = [];
|
||||
this.pattern = pattern;
|
||||
this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
|
||||
@@ -103432,51 +103531,146 @@ var require_minimatch2 = __commonJS({
|
||||
// out of pattern, then that's fine, as long as all
|
||||
// the parts match.
|
||||
matchOne(file, pattern, partial) {
|
||||
var options = this.options;
|
||||
this.debug(
|
||||
"matchOne",
|
||||
{ "this": 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");
|
||||
var p = pattern[pi];
|
||||
var f = file[fi];
|
||||
this.debug(pattern, p, f);
|
||||
if (p === false) return false;
|
||||
if (p === GLOBSTAR) {
|
||||
this.debug("GLOBSTAR", [pattern, p, f]);
|
||||
var fr = fi;
|
||||
var pr = pi + 1;
|
||||
if (pr === pl) {
|
||||
this.debug("** at the end");
|
||||
for (; fi < fl; fi++) {
|
||||
if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".") return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
while (fr < fl) {
|
||||
var swallowee = file[fr];
|
||||
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
|
||||
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
||||
this.debug("globstar found match!", fr, fl, swallowee);
|
||||
return true;
|
||||
} else {
|
||||
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
|
||||
this.debug("dot detected!", file, fr, pattern, pr);
|
||||
break;
|
||||
}
|
||||
this.debug("globstar swallow a segment, and continue");
|
||||
fr++;
|
||||
}
|
||||
}
|
||||
if (partial) {
|
||||
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
|
||||
if (fr === fl) return true;
|
||||
}
|
||||
if (pattern.indexOf(GLOBSTAR) !== -1) {
|
||||
return this._matchGlobstar(file, pattern, partial, 0, 0);
|
||||
}
|
||||
return this._matchOne(file, pattern, partial, 0, 0);
|
||||
}
|
||||
_matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
|
||||
let firstgs = -1;
|
||||
for (let i = patternIndex; i < pattern.length; i++) {
|
||||
if (pattern[i] === GLOBSTAR) {
|
||||
firstgs = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
let lastgs = -1;
|
||||
for (let i = pattern.length - 1; i >= 0; i--) {
|
||||
if (pattern[i] === GLOBSTAR) {
|
||||
lastgs = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
const head = pattern.slice(patternIndex, firstgs);
|
||||
const body = partial ? pattern.slice(firstgs + 1) : pattern.slice(firstgs + 1, lastgs);
|
||||
const tail = partial ? [] : pattern.slice(lastgs + 1);
|
||||
if (head.length) {
|
||||
const fileHead = file.slice(fileIndex, fileIndex + head.length);
|
||||
if (!this._matchOne(fileHead, head, partial, 0, 0)) {
|
||||
return false;
|
||||
}
|
||||
var hit;
|
||||
fileIndex += head.length;
|
||||
}
|
||||
let fileTailMatch = 0;
|
||||
if (tail.length) {
|
||||
if (tail.length + fileIndex > file.length) return false;
|
||||
const tailStart = file.length - tail.length;
|
||||
if (this._matchOne(file, tail, partial, tailStart, 0)) {
|
||||
fileTailMatch = tail.length;
|
||||
} else {
|
||||
if (file[file.length - 1] !== "" || fileIndex + tail.length === file.length) {
|
||||
return false;
|
||||
}
|
||||
if (!this._matchOne(file, tail, partial, tailStart - 1, 0)) {
|
||||
return false;
|
||||
}
|
||||
fileTailMatch = tail.length + 1;
|
||||
}
|
||||
}
|
||||
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.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return partial || sawSome;
|
||||
}
|
||||
const bodySegments = [[[], 0]];
|
||||
let currentBody = bodySegments[0];
|
||||
let nonGsParts = 0;
|
||||
const nonGsPartsSums = [0];
|
||||
for (const b of body) {
|
||||
if (b === GLOBSTAR) {
|
||||
nonGsPartsSums.push(nonGsParts);
|
||||
currentBody = [[], 0];
|
||||
bodySegments.push(currentBody);
|
||||
} else {
|
||||
currentBody[0].push(b);
|
||||
nonGsParts++;
|
||||
}
|
||||
}
|
||||
let idx = bodySegments.length - 1;
|
||||
const fileLength = file.length - fileTailMatch;
|
||||
for (const b of bodySegments) {
|
||||
b[1] = fileLength - (nonGsPartsSums[idx--] + 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, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
|
||||
const bs = bodySegments[bodyIndex];
|
||||
if (!bs) {
|
||||
for (let i = fileIndex; i < file.length; i++) {
|
||||
sawTail = true;
|
||||
const f = file[i];
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return sawTail;
|
||||
}
|
||||
const [body, after] = bs;
|
||||
while (fileIndex <= after) {
|
||||
const m = this._matchOne(
|
||||
file.slice(0, fileIndex + body.length),
|
||||
body,
|
||||
partial,
|
||||
fileIndex,
|
||||
0
|
||||
);
|
||||
if (m && globStarDepth < this.maxGlobstarRecursion) {
|
||||
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.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
fileIndex++;
|
||||
}
|
||||
return partial || null;
|
||||
}
|
||||
_matchOne(file, pattern, partial, fileIndex, patternIndex) {
|
||||
let fi, pi, fl, pl;
|
||||
for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
||||
this.debug("matchOne loop");
|
||||
const p = pattern[pi];
|
||||
const f = file[fi];
|
||||
this.debug(pattern, p, f);
|
||||
if (p === false || p === GLOBSTAR) return false;
|
||||
let hit;
|
||||
if (typeof p === "string") {
|
||||
hit = f === p;
|
||||
this.debug("string match", p, f, hit);
|
||||
@@ -116797,12 +116991,60 @@ var require_unescape = __commonJS({
|
||||
var require_ast = __commonJS({
|
||||
"node_modules/glob/node_modules/minimatch/dist/commonjs/ast.js"(exports2) {
|
||||
"use strict";
|
||||
var _a;
|
||||
Object.defineProperty(exports2, "__esModule", { value: true });
|
||||
exports2.AST = void 0;
|
||||
var brace_expressions_js_1 = require_brace_expressions();
|
||||
var unescape_js_1 = require_unescape();
|
||||
var types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
|
||||
var isExtglobType = (c) => types.has(c);
|
||||
var isExtglobAST = (c) => isExtglobType(c.type);
|
||||
var adoptionMap = /* @__PURE__ */ new Map([
|
||||
["!", ["@"]],
|
||||
["?", ["?", "@"]],
|
||||
["@", ["@"]],
|
||||
["*", ["*", "+", "?", "@"]],
|
||||
["+", ["+", "@"]]
|
||||
]);
|
||||
var adoptionWithSpaceMap = /* @__PURE__ */ new Map([
|
||||
["!", ["?"]],
|
||||
["@", ["?"]],
|
||||
["+", ["?", "*"]]
|
||||
]);
|
||||
var adoptionAnyMap = /* @__PURE__ */ new Map([
|
||||
["!", ["?", "@"]],
|
||||
["?", ["?", "@"]],
|
||||
["@", ["?", "@"]],
|
||||
["*", ["*", "+", "?", "@"]],
|
||||
["+", ["+", "@", "?", "*"]]
|
||||
]);
|
||||
var usurpMap = /* @__PURE__ */ new Map([
|
||||
["!", /* @__PURE__ */ new Map([["!", "@"]])],
|
||||
[
|
||||
"?",
|
||||
/* @__PURE__ */ new Map([
|
||||
["*", "*"],
|
||||
["+", "*"]
|
||||
])
|
||||
],
|
||||
[
|
||||
"@",
|
||||
/* @__PURE__ */ new Map([
|
||||
["!", "!"],
|
||||
["?", "?"],
|
||||
["@", "@"],
|
||||
["*", "*"],
|
||||
["+", "+"]
|
||||
])
|
||||
],
|
||||
[
|
||||
"+",
|
||||
/* @__PURE__ */ new Map([
|
||||
["?", "*"],
|
||||
["*", "*"]
|
||||
])
|
||||
]
|
||||
]);
|
||||
var startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
|
||||
var startNoDot = "(?!\\.)";
|
||||
var addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
|
||||
@@ -116812,7 +117054,8 @@ var require_ast = __commonJS({
|
||||
var qmark = "[^/]";
|
||||
var star = qmark + "*?";
|
||||
var starNoEmpty = qmark + "+?";
|
||||
var AST = class _AST {
|
||||
var ID = 0;
|
||||
var AST = class {
|
||||
type;
|
||||
#root;
|
||||
#hasMagic;
|
||||
@@ -116827,6 +117070,22 @@ var require_ast = __commonJS({
|
||||
// set to true if it's an extglob with no children
|
||||
// (which really means one child of '')
|
||||
#emptyExt = false;
|
||||
id = ++ID;
|
||||
get depth() {
|
||||
return (this.#parent?.depth ?? -1) + 1;
|
||||
}
|
||||
[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")]() {
|
||||
return {
|
||||
"@@type": "AST",
|
||||
id: this.id,
|
||||
type: this.type,
|
||||
root: this.#root.id,
|
||||
parent: this.#parent?.id,
|
||||
depth: this.depth,
|
||||
partsLength: this.#parts.length,
|
||||
parts: this.#parts
|
||||
};
|
||||
}
|
||||
constructor(type2, parent, options = {}) {
|
||||
this.type = type2;
|
||||
if (type2)
|
||||
@@ -116892,7 +117151,7 @@ var require_ast = __commonJS({
|
||||
for (const p of parts) {
|
||||
if (p === "")
|
||||
continue;
|
||||
if (typeof p !== "string" && !(p instanceof _AST && p.#parent === this)) {
|
||||
if (typeof p !== "string" && !(p instanceof _a && p.#parent === this)) {
|
||||
throw new Error("invalid part: " + p);
|
||||
}
|
||||
this.#parts.push(p);
|
||||
@@ -116917,7 +117176,7 @@ var require_ast = __commonJS({
|
||||
const p = this.#parent;
|
||||
for (let i = 0; i < this.#parentIndex; i++) {
|
||||
const pp = p.#parts[i];
|
||||
if (!(pp instanceof _AST && pp.type === "!")) {
|
||||
if (!(pp instanceof _a && pp.type === "!")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -116942,13 +117201,14 @@ var require_ast = __commonJS({
|
||||
this.push(part.clone(this));
|
||||
}
|
||||
clone(parent) {
|
||||
const c = new _AST(this.type, parent);
|
||||
const c = new _a(this.type, parent);
|
||||
for (const p of this.#parts) {
|
||||
c.copyIn(p);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
static #parseAST(str2, ast, pos, opt) {
|
||||
static #parseAST(str2, ast, pos, opt, extDepth) {
|
||||
const maxDepth = opt.maxExtglobRecursion ?? 2;
|
||||
let escaping = false;
|
||||
let inBrace = false;
|
||||
let braceStart = -1;
|
||||
@@ -116980,11 +117240,12 @@ var require_ast = __commonJS({
|
||||
acc2 += c;
|
||||
continue;
|
||||
}
|
||||
if (!opt.noext && isExtglobType(c) && str2.charAt(i2) === "(") {
|
||||
const doRecurse = !opt.noext && isExtglobType(c) && str2.charAt(i2) === "(" && extDepth <= maxDepth;
|
||||
if (doRecurse) {
|
||||
ast.push(acc2);
|
||||
acc2 = "";
|
||||
const ext = new _AST(c, ast);
|
||||
i2 = _AST.#parseAST(str2, ext, i2, opt);
|
||||
const ext = new _a(c, ast);
|
||||
i2 = _a.#parseAST(str2, ext, i2, opt, extDepth + 1);
|
||||
ast.push(ext);
|
||||
continue;
|
||||
}
|
||||
@@ -116994,7 +117255,7 @@ var require_ast = __commonJS({
|
||||
return i2;
|
||||
}
|
||||
let i = pos + 1;
|
||||
let part = new _AST(null, ast);
|
||||
let part = new _a(null, ast);
|
||||
const parts = [];
|
||||
let acc = "";
|
||||
while (i < str2.length) {
|
||||
@@ -117021,19 +117282,22 @@ var require_ast = __commonJS({
|
||||
acc += c;
|
||||
continue;
|
||||
}
|
||||
if (isExtglobType(c) && str2.charAt(i) === "(") {
|
||||
const doRecurse = !opt.noext && isExtglobType(c) && str2.charAt(i) === "(" && /* c8 ignore start - the maxDepth is sufficient here */
|
||||
(extDepth <= maxDepth || ast && ast.#canAdoptType(c));
|
||||
if (doRecurse) {
|
||||
const depthAdd = ast && ast.#canAdoptType(c) ? 0 : 1;
|
||||
part.push(acc);
|
||||
acc = "";
|
||||
const ext = new _AST(c, part);
|
||||
const ext = new _a(c, part);
|
||||
part.push(ext);
|
||||
i = _AST.#parseAST(str2, ext, i, opt);
|
||||
i = _a.#parseAST(str2, ext, i, opt, extDepth + depthAdd);
|
||||
continue;
|
||||
}
|
||||
if (c === "|") {
|
||||
part.push(acc);
|
||||
acc = "";
|
||||
parts.push(part);
|
||||
part = new _AST(null, ast);
|
||||
part = new _a(null, ast);
|
||||
continue;
|
||||
}
|
||||
if (c === ")") {
|
||||
@@ -117052,9 +117316,71 @@ var require_ast = __commonJS({
|
||||
ast.#parts = [str2.substring(pos - 1)];
|
||||
return i;
|
||||
}
|
||||
#canAdoptWithSpace(child) {
|
||||
return this.#canAdopt(child, adoptionWithSpaceMap);
|
||||
}
|
||||
#canAdopt(child, map2 = adoptionMap) {
|
||||
if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null) {
|
||||
return false;
|
||||
}
|
||||
const gc = child.#parts[0];
|
||||
if (!gc || typeof gc !== "object" || gc.type === null) {
|
||||
return false;
|
||||
}
|
||||
return this.#canAdoptType(gc.type, map2);
|
||||
}
|
||||
#canAdoptType(c, map2 = adoptionAnyMap) {
|
||||
return !!map2.get(this.type)?.includes(c);
|
||||
}
|
||||
#adoptWithSpace(child, index) {
|
||||
const gc = child.#parts[0];
|
||||
const blank = new _a(null, gc, this.options);
|
||||
blank.#parts.push("");
|
||||
gc.push(blank);
|
||||
this.#adopt(child, index);
|
||||
}
|
||||
#adopt(child, index) {
|
||||
const gc = child.#parts[0];
|
||||
this.#parts.splice(index, 1, ...gc.#parts);
|
||||
for (const p of gc.#parts) {
|
||||
if (typeof p === "object")
|
||||
p.#parent = this;
|
||||
}
|
||||
this.#toString = void 0;
|
||||
}
|
||||
#canUsurpType(c) {
|
||||
const m = usurpMap.get(this.type);
|
||||
return !!m?.has(c);
|
||||
}
|
||||
#canUsurp(child) {
|
||||
if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null || this.#parts.length !== 1) {
|
||||
return false;
|
||||
}
|
||||
const gc = child.#parts[0];
|
||||
if (!gc || typeof gc !== "object" || gc.type === null) {
|
||||
return false;
|
||||
}
|
||||
return this.#canUsurpType(gc.type);
|
||||
}
|
||||
#usurp(child) {
|
||||
const m = usurpMap.get(this.type);
|
||||
const gc = child.#parts[0];
|
||||
const nt = m?.get(gc.type);
|
||||
if (!nt)
|
||||
return false;
|
||||
this.#parts = gc.#parts;
|
||||
for (const p of this.#parts) {
|
||||
if (typeof p === "object") {
|
||||
p.#parent = this;
|
||||
}
|
||||
}
|
||||
this.type = nt;
|
||||
this.#toString = void 0;
|
||||
this.#emptyExt = false;
|
||||
}
|
||||
static fromGlob(pattern, options = {}) {
|
||||
const ast = new _AST(null, void 0, options);
|
||||
_AST.#parseAST(pattern, ast, 0, options);
|
||||
const ast = new _a(null, void 0, options);
|
||||
_a.#parseAST(pattern, ast, 0, options, 0);
|
||||
return ast;
|
||||
}
|
||||
// returns the regular expression if there's magic, or the unescaped
|
||||
@@ -117148,12 +117474,14 @@ var require_ast = __commonJS({
|
||||
// or start or whatever) and prepend ^ or / at the Regexp construction.
|
||||
toRegExpSource(allowDot) {
|
||||
const dot = allowDot ?? !!this.#options.dot;
|
||||
if (this.#root === this)
|
||||
if (this.#root === this) {
|
||||
this.#flatten();
|
||||
this.#fillNegs();
|
||||
if (!this.type) {
|
||||
}
|
||||
if (!isExtglobAST(this)) {
|
||||
const noEmpty = this.isStart() && this.isEnd() && !this.#parts.some((s) => typeof s !== "string");
|
||||
const src = this.#parts.map((p) => {
|
||||
const [re, _2, hasMagic, uflag] = typeof p === "string" ? _AST.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
|
||||
const [re, _2, hasMagic, uflag] = typeof p === "string" ? _a.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
|
||||
this.#hasMagic = this.#hasMagic || hasMagic;
|
||||
this.#uflag = this.#uflag || uflag;
|
||||
return re;
|
||||
@@ -117192,9 +117520,10 @@ var require_ast = __commonJS({
|
||||
let body = this.#partsToRegExp(dot);
|
||||
if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
|
||||
const s = this.toString();
|
||||
this.#parts = [s];
|
||||
this.type = null;
|
||||
this.#hasMagic = void 0;
|
||||
const me = this;
|
||||
me.#parts = [s];
|
||||
me.type = null;
|
||||
me.#hasMagic = void 0;
|
||||
return [s, (0, unescape_js_1.unescape)(this.toString()), false, false];
|
||||
}
|
||||
let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ? "" : this.#partsToRegExp(true);
|
||||
@@ -117221,6 +117550,38 @@ var require_ast = __commonJS({
|
||||
this.#uflag
|
||||
];
|
||||
}
|
||||
#flatten() {
|
||||
if (!isExtglobAST(this)) {
|
||||
for (const p of this.#parts) {
|
||||
if (typeof p === "object") {
|
||||
p.#flatten();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let iterations = 0;
|
||||
let done = false;
|
||||
do {
|
||||
done = true;
|
||||
for (let i = 0; i < this.#parts.length; i++) {
|
||||
const c = this.#parts[i];
|
||||
if (typeof c === "object") {
|
||||
c.#flatten();
|
||||
if (this.#canAdopt(c)) {
|
||||
done = false;
|
||||
this.#adopt(c, i);
|
||||
} else if (this.#canAdoptWithSpace(c)) {
|
||||
done = false;
|
||||
this.#adoptWithSpace(c, i);
|
||||
} else if (this.#canUsurp(c)) {
|
||||
done = false;
|
||||
this.#usurp(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (!done && ++iterations < 10);
|
||||
}
|
||||
this.#toString = void 0;
|
||||
}
|
||||
#partsToRegExp(dot) {
|
||||
return this.#parts.map((p) => {
|
||||
if (typeof p === "string") {
|
||||
@@ -117282,6 +117643,7 @@ var require_ast = __commonJS({
|
||||
}
|
||||
};
|
||||
exports2.AST = AST;
|
||||
_a = AST;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -117466,11 +117828,13 @@ var require_commonjs20 = __commonJS({
|
||||
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";
|
||||
@@ -117807,7 +118171,8 @@ var require_commonjs20 = __commonJS({
|
||||
// out of pattern, then that's fine, as long as all
|
||||
// the parts match.
|
||||
matchOne(file, pattern, partial = false) {
|
||||
const options = this.options;
|
||||
let fileStartIndex = 0;
|
||||
let patternStartIndex = 0;
|
||||
if (this.isWindows) {
|
||||
const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
|
||||
const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
|
||||
@@ -117822,11 +118187,8 @@ var require_commonjs20 = __commonJS({
|
||||
];
|
||||
if (fd.toLowerCase() === pd.toLowerCase()) {
|
||||
pattern[pdi] = fd;
|
||||
if (pdi > fdi) {
|
||||
pattern = pattern.slice(pdi);
|
||||
} else if (fdi > pdi) {
|
||||
file = file.slice(fdi);
|
||||
}
|
||||
patternStartIndex = pdi;
|
||||
fileStartIndex = fdi;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117834,49 +118196,123 @@ var require_commonjs20 = __commonJS({
|
||||
if (optimizationLevel >= 2) {
|
||||
file = this.levelTwoFileOptimize(file);
|
||||
}
|
||||
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");
|
||||
var p = pattern[pi];
|
||||
var f = file[fi];
|
||||
this.debug(pattern, p, f);
|
||||
if (p === false) {
|
||||
if (pattern.includes(exports2.GLOBSTAR)) {
|
||||
return this.#matchGlobstar(file, pattern, partial, fileStartIndex, patternStartIndex);
|
||||
}
|
||||
return this.#matchOne(file, pattern, partial, fileStartIndex, patternStartIndex);
|
||||
}
|
||||
#matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
|
||||
const firstgs = pattern.indexOf(exports2.GLOBSTAR, patternIndex);
|
||||
const lastgs = pattern.lastIndexOf(exports2.GLOBSTAR);
|
||||
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)
|
||||
];
|
||||
if (head.length) {
|
||||
const fileHead = file.slice(fileIndex, fileIndex + head.length);
|
||||
if (!this.#matchOne(fileHead, head, partial, 0, 0)) {
|
||||
return false;
|
||||
}
|
||||
if (p === exports2.GLOBSTAR) {
|
||||
this.debug("GLOBSTAR", [pattern, p, f]);
|
||||
var fr = fi;
|
||||
var pr = pi + 1;
|
||||
if (pr === pl) {
|
||||
this.debug("** at the end");
|
||||
for (; fi < fl; fi++) {
|
||||
if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
fileIndex += head.length;
|
||||
patternIndex += head.length;
|
||||
}
|
||||
let fileTailMatch = 0;
|
||||
if (tail.length) {
|
||||
if (tail.length + fileIndex > file.length)
|
||||
return false;
|
||||
let tailStart = file.length - tail.length;
|
||||
if (this.#matchOne(file, tail, partial, tailStart, 0)) {
|
||||
fileTailMatch = tail.length;
|
||||
} else {
|
||||
if (file[file.length - 1] !== "" || fileIndex + tail.length === file.length) {
|
||||
return false;
|
||||
}
|
||||
while (fr < fl) {
|
||||
var swallowee = file[fr];
|
||||
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
|
||||
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
||||
this.debug("globstar found match!", fr, fl, swallowee);
|
||||
return true;
|
||||
} else {
|
||||
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
|
||||
this.debug("dot detected!", file, fr, pattern, pr);
|
||||
break;
|
||||
}
|
||||
this.debug("globstar swallow a segment, and continue");
|
||||
fr++;
|
||||
}
|
||||
tailStart--;
|
||||
if (!this.#matchOne(file, tail, partial, tailStart, 0)) {
|
||||
return false;
|
||||
}
|
||||
if (partial) {
|
||||
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
|
||||
if (fr === fl) {
|
||||
return true;
|
||||
}
|
||||
fileTailMatch = tail.length + 1;
|
||||
}
|
||||
}
|
||||
if (!body.length) {
|
||||
let sawSome = !!fileTailMatch;
|
||||
for (let i2 = fileIndex; i2 < file.length - fileTailMatch; i2++) {
|
||||
const f = String(file[i2]);
|
||||
sawSome = true;
|
||||
if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return partial || sawSome;
|
||||
}
|
||||
const bodySegments = [[[], 0]];
|
||||
let currentBody = bodySegments[0];
|
||||
let nonGsParts = 0;
|
||||
const nonGsPartsSums = [0];
|
||||
for (const b of body) {
|
||||
if (b === exports2.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, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
|
||||
const bs = bodySegments[bodyIndex];
|
||||
if (!bs) {
|
||||
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;
|
||||
}
|
||||
const [body, after] = bs;
|
||||
while (fileIndex <= after) {
|
||||
const m = this.#matchOne(file.slice(0, fileIndex + body.length), body, partial, fileIndex, 0);
|
||||
if (m && globStarDepth < this.maxGlobstarRecursion) {
|
||||
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++;
|
||||
}
|
||||
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 loop");
|
||||
let p = pattern[pi];
|
||||
let f = file[fi];
|
||||
this.debug(pattern, p, f);
|
||||
if (p === false || p === exports2.GLOBSTAR) {
|
||||
return false;
|
||||
}
|
||||
let hit;
|
||||
|
||||
Generated
+137
-39
@@ -49361,6 +49361,7 @@ var require_minimatch = __commonJS({
|
||||
pattern = pattern.split(path16.sep).join("/");
|
||||
}
|
||||
this.options = options;
|
||||
this.maxGlobstarRecursion = options.maxGlobstarRecursion !== void 0 ? options.maxGlobstarRecursion : 200;
|
||||
this.set = [];
|
||||
this.pattern = pattern;
|
||||
this.regexp = null;
|
||||
@@ -49757,50 +49758,147 @@ var require_minimatch = __commonJS({
|
||||
return this.negate;
|
||||
};
|
||||
Minimatch.prototype.matchOne = function(file, pattern, partial) {
|
||||
var options = this.options;
|
||||
this.debug(
|
||||
"matchOne",
|
||||
{ "this": this, file, pattern }
|
||||
if (pattern.indexOf(GLOBSTAR) !== -1) {
|
||||
return this._matchGlobstar(file, pattern, partial, 0, 0);
|
||||
}
|
||||
return this._matchOne(file, pattern, partial, 0, 0);
|
||||
};
|
||||
Minimatch.prototype._matchGlobstar = function(file, pattern, partial, fileIndex, patternIndex) {
|
||||
var i;
|
||||
var firstgs = -1;
|
||||
for (i = patternIndex; i < pattern.length; i++) {
|
||||
if (pattern[i] === GLOBSTAR) {
|
||||
firstgs = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var lastgs = -1;
|
||||
for (i = pattern.length - 1; i >= 0; i--) {
|
||||
if (pattern[i] === GLOBSTAR) {
|
||||
lastgs = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var head = pattern.slice(patternIndex, firstgs);
|
||||
var body = partial ? pattern.slice(firstgs + 1) : pattern.slice(firstgs + 1, lastgs);
|
||||
var tail = partial ? [] : pattern.slice(lastgs + 1);
|
||||
if (head.length) {
|
||||
var fileHead = file.slice(fileIndex, fileIndex + head.length);
|
||||
if (!this._matchOne(fileHead, head, partial, 0, 0)) {
|
||||
return false;
|
||||
}
|
||||
fileIndex += head.length;
|
||||
}
|
||||
var fileTailMatch = 0;
|
||||
if (tail.length) {
|
||||
if (tail.length + fileIndex > file.length) return false;
|
||||
var tailStart = file.length - tail.length;
|
||||
if (this._matchOne(file, tail, partial, tailStart, 0)) {
|
||||
fileTailMatch = tail.length;
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
}
|
||||
if (!body.length) {
|
||||
var sawSome = !!fileTailMatch;
|
||||
for (i = fileIndex; i < file.length - fileTailMatch; i++) {
|
||||
var f = String(file[i]);
|
||||
sawSome = true;
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return partial || sawSome;
|
||||
}
|
||||
var bodySegments = [[[], 0]];
|
||||
var currentBody = bodySegments[0];
|
||||
var nonGsParts = 0;
|
||||
var nonGsPartsSums = [0];
|
||||
for (var bi = 0; bi < body.length; bi++) {
|
||||
var b = body[bi];
|
||||
if (b === GLOBSTAR) {
|
||||
nonGsPartsSums.push(nonGsParts);
|
||||
currentBody = [[], 0];
|
||||
bodySegments.push(currentBody);
|
||||
} else {
|
||||
currentBody[0].push(b);
|
||||
nonGsParts++;
|
||||
}
|
||||
}
|
||||
var idx = bodySegments.length - 1;
|
||||
var fileLength = file.length - fileTailMatch;
|
||||
for (var si = 0; si < bodySegments.length; si++) {
|
||||
bodySegments[si][1] = fileLength - (nonGsPartsSums[idx--] + bodySegments[si][0].length);
|
||||
}
|
||||
return !!this._matchGlobStarBodySections(
|
||||
file,
|
||||
bodySegments,
|
||||
fileIndex,
|
||||
0,
|
||||
partial,
|
||||
0,
|
||||
!!fileTailMatch
|
||||
);
|
||||
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++) {
|
||||
};
|
||||
Minimatch.prototype._matchGlobStarBodySections = function(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
|
||||
var bs = bodySegments[bodyIndex];
|
||||
if (!bs) {
|
||||
for (var i = fileIndex; i < file.length; i++) {
|
||||
sawTail = true;
|
||||
var f = file[i];
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return sawTail;
|
||||
}
|
||||
var body = bs[0];
|
||||
var after = bs[1];
|
||||
while (fileIndex <= after) {
|
||||
var m = this._matchOne(
|
||||
file.slice(0, fileIndex + body.length),
|
||||
body,
|
||||
partial,
|
||||
fileIndex,
|
||||
0
|
||||
);
|
||||
if (m && globStarDepth < this.maxGlobstarRecursion) {
|
||||
var sub = this._matchGlobStarBodySections(
|
||||
file,
|
||||
bodySegments,
|
||||
fileIndex + body.length,
|
||||
bodyIndex + 1,
|
||||
partial,
|
||||
globStarDepth + 1,
|
||||
sawTail
|
||||
);
|
||||
if (sub !== false) {
|
||||
return sub;
|
||||
}
|
||||
}
|
||||
var f = file[fileIndex];
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
fileIndex++;
|
||||
}
|
||||
return partial || null;
|
||||
};
|
||||
Minimatch.prototype._matchOne = function(file, pattern, partial, fileIndex, patternIndex) {
|
||||
var fi, pi, fl, pl;
|
||||
for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
||||
this.debug("matchOne loop");
|
||||
var p = pattern[pi];
|
||||
var f = file[fi];
|
||||
this.debug(pattern, p, f);
|
||||
if (p === false) return false;
|
||||
if (p === GLOBSTAR) {
|
||||
this.debug("GLOBSTAR", [pattern, p, f]);
|
||||
var fr = fi;
|
||||
var pr = pi + 1;
|
||||
if (pr === pl) {
|
||||
this.debug("** at the end");
|
||||
for (; fi < fl; fi++) {
|
||||
if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".") return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
while (fr < fl) {
|
||||
var swallowee = file[fr];
|
||||
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
|
||||
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
||||
this.debug("globstar found match!", fr, fl, swallowee);
|
||||
return true;
|
||||
} else {
|
||||
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
|
||||
this.debug("dot detected!", file, fr, pattern, pr);
|
||||
break;
|
||||
}
|
||||
this.debug("globstar swallow a segment, and continue");
|
||||
fr++;
|
||||
}
|
||||
}
|
||||
if (partial) {
|
||||
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
|
||||
if (fr === fl) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (p === false || p === GLOBSTAR) return false;
|
||||
var hit;
|
||||
if (typeof p === "string") {
|
||||
hit = f === p;
|
||||
|
||||
Generated
+137
-39
@@ -49361,6 +49361,7 @@ var require_minimatch = __commonJS({
|
||||
pattern = pattern.split(path7.sep).join("/");
|
||||
}
|
||||
this.options = options;
|
||||
this.maxGlobstarRecursion = options.maxGlobstarRecursion !== void 0 ? options.maxGlobstarRecursion : 200;
|
||||
this.set = [];
|
||||
this.pattern = pattern;
|
||||
this.regexp = null;
|
||||
@@ -49757,50 +49758,147 @@ var require_minimatch = __commonJS({
|
||||
return this.negate;
|
||||
};
|
||||
Minimatch.prototype.matchOne = function(file, pattern, partial) {
|
||||
var options = this.options;
|
||||
this.debug(
|
||||
"matchOne",
|
||||
{ "this": this, file, pattern }
|
||||
if (pattern.indexOf(GLOBSTAR) !== -1) {
|
||||
return this._matchGlobstar(file, pattern, partial, 0, 0);
|
||||
}
|
||||
return this._matchOne(file, pattern, partial, 0, 0);
|
||||
};
|
||||
Minimatch.prototype._matchGlobstar = function(file, pattern, partial, fileIndex, patternIndex) {
|
||||
var i;
|
||||
var firstgs = -1;
|
||||
for (i = patternIndex; i < pattern.length; i++) {
|
||||
if (pattern[i] === GLOBSTAR) {
|
||||
firstgs = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var lastgs = -1;
|
||||
for (i = pattern.length - 1; i >= 0; i--) {
|
||||
if (pattern[i] === GLOBSTAR) {
|
||||
lastgs = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var head = pattern.slice(patternIndex, firstgs);
|
||||
var body = partial ? pattern.slice(firstgs + 1) : pattern.slice(firstgs + 1, lastgs);
|
||||
var tail = partial ? [] : pattern.slice(lastgs + 1);
|
||||
if (head.length) {
|
||||
var fileHead = file.slice(fileIndex, fileIndex + head.length);
|
||||
if (!this._matchOne(fileHead, head, partial, 0, 0)) {
|
||||
return false;
|
||||
}
|
||||
fileIndex += head.length;
|
||||
}
|
||||
var fileTailMatch = 0;
|
||||
if (tail.length) {
|
||||
if (tail.length + fileIndex > file.length) return false;
|
||||
var tailStart = file.length - tail.length;
|
||||
if (this._matchOne(file, tail, partial, tailStart, 0)) {
|
||||
fileTailMatch = tail.length;
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
}
|
||||
if (!body.length) {
|
||||
var sawSome = !!fileTailMatch;
|
||||
for (i = fileIndex; i < file.length - fileTailMatch; i++) {
|
||||
var f = String(file[i]);
|
||||
sawSome = true;
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return partial || sawSome;
|
||||
}
|
||||
var bodySegments = [[[], 0]];
|
||||
var currentBody = bodySegments[0];
|
||||
var nonGsParts = 0;
|
||||
var nonGsPartsSums = [0];
|
||||
for (var bi = 0; bi < body.length; bi++) {
|
||||
var b = body[bi];
|
||||
if (b === GLOBSTAR) {
|
||||
nonGsPartsSums.push(nonGsParts);
|
||||
currentBody = [[], 0];
|
||||
bodySegments.push(currentBody);
|
||||
} else {
|
||||
currentBody[0].push(b);
|
||||
nonGsParts++;
|
||||
}
|
||||
}
|
||||
var idx = bodySegments.length - 1;
|
||||
var fileLength = file.length - fileTailMatch;
|
||||
for (var si = 0; si < bodySegments.length; si++) {
|
||||
bodySegments[si][1] = fileLength - (nonGsPartsSums[idx--] + bodySegments[si][0].length);
|
||||
}
|
||||
return !!this._matchGlobStarBodySections(
|
||||
file,
|
||||
bodySegments,
|
||||
fileIndex,
|
||||
0,
|
||||
partial,
|
||||
0,
|
||||
!!fileTailMatch
|
||||
);
|
||||
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++) {
|
||||
};
|
||||
Minimatch.prototype._matchGlobStarBodySections = function(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
|
||||
var bs = bodySegments[bodyIndex];
|
||||
if (!bs) {
|
||||
for (var i = fileIndex; i < file.length; i++) {
|
||||
sawTail = true;
|
||||
var f = file[i];
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return sawTail;
|
||||
}
|
||||
var body = bs[0];
|
||||
var after = bs[1];
|
||||
while (fileIndex <= after) {
|
||||
var m = this._matchOne(
|
||||
file.slice(0, fileIndex + body.length),
|
||||
body,
|
||||
partial,
|
||||
fileIndex,
|
||||
0
|
||||
);
|
||||
if (m && globStarDepth < this.maxGlobstarRecursion) {
|
||||
var sub = this._matchGlobStarBodySections(
|
||||
file,
|
||||
bodySegments,
|
||||
fileIndex + body.length,
|
||||
bodyIndex + 1,
|
||||
partial,
|
||||
globStarDepth + 1,
|
||||
sawTail
|
||||
);
|
||||
if (sub !== false) {
|
||||
return sub;
|
||||
}
|
||||
}
|
||||
var f = file[fileIndex];
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
fileIndex++;
|
||||
}
|
||||
return partial || null;
|
||||
};
|
||||
Minimatch.prototype._matchOne = function(file, pattern, partial, fileIndex, patternIndex) {
|
||||
var fi, pi, fl, pl;
|
||||
for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
||||
this.debug("matchOne loop");
|
||||
var p = pattern[pi];
|
||||
var f = file[fi];
|
||||
this.debug(pattern, p, f);
|
||||
if (p === false) return false;
|
||||
if (p === GLOBSTAR) {
|
||||
this.debug("GLOBSTAR", [pattern, p, f]);
|
||||
var fr = fi;
|
||||
var pr = pi + 1;
|
||||
if (pr === pl) {
|
||||
this.debug("** at the end");
|
||||
for (; fi < fl; fi++) {
|
||||
if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".") return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
while (fr < fl) {
|
||||
var swallowee = file[fr];
|
||||
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
|
||||
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
||||
this.debug("globstar found match!", fr, fl, swallowee);
|
||||
return true;
|
||||
} else {
|
||||
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
|
||||
this.debug("dot detected!", file, fr, pattern, pr);
|
||||
break;
|
||||
}
|
||||
this.debug("globstar swallow a segment, and continue");
|
||||
fr++;
|
||||
}
|
||||
}
|
||||
if (partial) {
|
||||
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
|
||||
if (fr === fl) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (p === false || p === GLOBSTAR) return false;
|
||||
var hit;
|
||||
if (typeof p === "string") {
|
||||
hit = f === p;
|
||||
|
||||
Generated
+583
-147
@@ -49361,6 +49361,7 @@ var require_minimatch = __commonJS({
|
||||
pattern = pattern.split(path18.sep).join("/");
|
||||
}
|
||||
this.options = options;
|
||||
this.maxGlobstarRecursion = options.maxGlobstarRecursion !== void 0 ? options.maxGlobstarRecursion : 200;
|
||||
this.set = [];
|
||||
this.pattern = pattern;
|
||||
this.regexp = null;
|
||||
@@ -49757,50 +49758,147 @@ var require_minimatch = __commonJS({
|
||||
return this.negate;
|
||||
};
|
||||
Minimatch.prototype.matchOne = function(file, pattern, partial) {
|
||||
var options = this.options;
|
||||
this.debug(
|
||||
"matchOne",
|
||||
{ "this": this, file, pattern }
|
||||
if (pattern.indexOf(GLOBSTAR) !== -1) {
|
||||
return this._matchGlobstar(file, pattern, partial, 0, 0);
|
||||
}
|
||||
return this._matchOne(file, pattern, partial, 0, 0);
|
||||
};
|
||||
Minimatch.prototype._matchGlobstar = function(file, pattern, partial, fileIndex, patternIndex) {
|
||||
var i;
|
||||
var firstgs = -1;
|
||||
for (i = patternIndex; i < pattern.length; i++) {
|
||||
if (pattern[i] === GLOBSTAR) {
|
||||
firstgs = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var lastgs = -1;
|
||||
for (i = pattern.length - 1; i >= 0; i--) {
|
||||
if (pattern[i] === GLOBSTAR) {
|
||||
lastgs = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var head = pattern.slice(patternIndex, firstgs);
|
||||
var body = partial ? pattern.slice(firstgs + 1) : pattern.slice(firstgs + 1, lastgs);
|
||||
var tail = partial ? [] : pattern.slice(lastgs + 1);
|
||||
if (head.length) {
|
||||
var fileHead = file.slice(fileIndex, fileIndex + head.length);
|
||||
if (!this._matchOne(fileHead, head, partial, 0, 0)) {
|
||||
return false;
|
||||
}
|
||||
fileIndex += head.length;
|
||||
}
|
||||
var fileTailMatch = 0;
|
||||
if (tail.length) {
|
||||
if (tail.length + fileIndex > file.length) return false;
|
||||
var tailStart = file.length - tail.length;
|
||||
if (this._matchOne(file, tail, partial, tailStart, 0)) {
|
||||
fileTailMatch = tail.length;
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
}
|
||||
if (!body.length) {
|
||||
var sawSome = !!fileTailMatch;
|
||||
for (i = fileIndex; i < file.length - fileTailMatch; i++) {
|
||||
var f = String(file[i]);
|
||||
sawSome = true;
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return partial || sawSome;
|
||||
}
|
||||
var bodySegments = [[[], 0]];
|
||||
var currentBody = bodySegments[0];
|
||||
var nonGsParts = 0;
|
||||
var nonGsPartsSums = [0];
|
||||
for (var bi = 0; bi < body.length; bi++) {
|
||||
var b = body[bi];
|
||||
if (b === GLOBSTAR) {
|
||||
nonGsPartsSums.push(nonGsParts);
|
||||
currentBody = [[], 0];
|
||||
bodySegments.push(currentBody);
|
||||
} else {
|
||||
currentBody[0].push(b);
|
||||
nonGsParts++;
|
||||
}
|
||||
}
|
||||
var idx = bodySegments.length - 1;
|
||||
var fileLength = file.length - fileTailMatch;
|
||||
for (var si = 0; si < bodySegments.length; si++) {
|
||||
bodySegments[si][1] = fileLength - (nonGsPartsSums[idx--] + bodySegments[si][0].length);
|
||||
}
|
||||
return !!this._matchGlobStarBodySections(
|
||||
file,
|
||||
bodySegments,
|
||||
fileIndex,
|
||||
0,
|
||||
partial,
|
||||
0,
|
||||
!!fileTailMatch
|
||||
);
|
||||
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++) {
|
||||
};
|
||||
Minimatch.prototype._matchGlobStarBodySections = function(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
|
||||
var bs = bodySegments[bodyIndex];
|
||||
if (!bs) {
|
||||
for (var i = fileIndex; i < file.length; i++) {
|
||||
sawTail = true;
|
||||
var f = file[i];
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return sawTail;
|
||||
}
|
||||
var body = bs[0];
|
||||
var after = bs[1];
|
||||
while (fileIndex <= after) {
|
||||
var m = this._matchOne(
|
||||
file.slice(0, fileIndex + body.length),
|
||||
body,
|
||||
partial,
|
||||
fileIndex,
|
||||
0
|
||||
);
|
||||
if (m && globStarDepth < this.maxGlobstarRecursion) {
|
||||
var sub = this._matchGlobStarBodySections(
|
||||
file,
|
||||
bodySegments,
|
||||
fileIndex + body.length,
|
||||
bodyIndex + 1,
|
||||
partial,
|
||||
globStarDepth + 1,
|
||||
sawTail
|
||||
);
|
||||
if (sub !== false) {
|
||||
return sub;
|
||||
}
|
||||
}
|
||||
var f = file[fileIndex];
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
fileIndex++;
|
||||
}
|
||||
return partial || null;
|
||||
};
|
||||
Minimatch.prototype._matchOne = function(file, pattern, partial, fileIndex, patternIndex) {
|
||||
var fi, pi, fl, pl;
|
||||
for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
||||
this.debug("matchOne loop");
|
||||
var p = pattern[pi];
|
||||
var f = file[fi];
|
||||
this.debug(pattern, p, f);
|
||||
if (p === false) return false;
|
||||
if (p === GLOBSTAR) {
|
||||
this.debug("GLOBSTAR", [pattern, p, f]);
|
||||
var fr = fi;
|
||||
var pr = pi + 1;
|
||||
if (pr === pl) {
|
||||
this.debug("** at the end");
|
||||
for (; fi < fl; fi++) {
|
||||
if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".") return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
while (fr < fl) {
|
||||
var swallowee = file[fr];
|
||||
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
|
||||
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
||||
this.debug("globstar found match!", fr, fl, swallowee);
|
||||
return true;
|
||||
} else {
|
||||
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
|
||||
this.debug("dot detected!", file, fr, pattern, pr);
|
||||
break;
|
||||
}
|
||||
this.debug("globstar swallow a segment, and continue");
|
||||
fr++;
|
||||
}
|
||||
}
|
||||
if (partial) {
|
||||
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
|
||||
if (fr === fl) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (p === false || p === GLOBSTAR) return false;
|
||||
var hit;
|
||||
if (typeof p === "string") {
|
||||
hit = f === p;
|
||||
@@ -103376,6 +103474,7 @@ var require_minimatch2 = __commonJS({
|
||||
assertValidPattern(pattern);
|
||||
if (!options) options = {};
|
||||
this.options = options;
|
||||
this.maxGlobstarRecursion = options.maxGlobstarRecursion !== void 0 ? options.maxGlobstarRecursion : 200;
|
||||
this.set = [];
|
||||
this.pattern = pattern;
|
||||
this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
|
||||
@@ -103432,51 +103531,146 @@ var require_minimatch2 = __commonJS({
|
||||
// out of pattern, then that's fine, as long as all
|
||||
// the parts match.
|
||||
matchOne(file, pattern, partial) {
|
||||
var options = this.options;
|
||||
this.debug(
|
||||
"matchOne",
|
||||
{ "this": 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");
|
||||
var p = pattern[pi];
|
||||
var f = file[fi];
|
||||
this.debug(pattern, p, f);
|
||||
if (p === false) return false;
|
||||
if (p === GLOBSTAR) {
|
||||
this.debug("GLOBSTAR", [pattern, p, f]);
|
||||
var fr = fi;
|
||||
var pr = pi + 1;
|
||||
if (pr === pl) {
|
||||
this.debug("** at the end");
|
||||
for (; fi < fl; fi++) {
|
||||
if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".") return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
while (fr < fl) {
|
||||
var swallowee = file[fr];
|
||||
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
|
||||
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
||||
this.debug("globstar found match!", fr, fl, swallowee);
|
||||
return true;
|
||||
} else {
|
||||
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
|
||||
this.debug("dot detected!", file, fr, pattern, pr);
|
||||
break;
|
||||
}
|
||||
this.debug("globstar swallow a segment, and continue");
|
||||
fr++;
|
||||
}
|
||||
}
|
||||
if (partial) {
|
||||
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
|
||||
if (fr === fl) return true;
|
||||
}
|
||||
if (pattern.indexOf(GLOBSTAR) !== -1) {
|
||||
return this._matchGlobstar(file, pattern, partial, 0, 0);
|
||||
}
|
||||
return this._matchOne(file, pattern, partial, 0, 0);
|
||||
}
|
||||
_matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
|
||||
let firstgs = -1;
|
||||
for (let i = patternIndex; i < pattern.length; i++) {
|
||||
if (pattern[i] === GLOBSTAR) {
|
||||
firstgs = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
let lastgs = -1;
|
||||
for (let i = pattern.length - 1; i >= 0; i--) {
|
||||
if (pattern[i] === GLOBSTAR) {
|
||||
lastgs = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
const head = pattern.slice(patternIndex, firstgs);
|
||||
const body = partial ? pattern.slice(firstgs + 1) : pattern.slice(firstgs + 1, lastgs);
|
||||
const tail = partial ? [] : pattern.slice(lastgs + 1);
|
||||
if (head.length) {
|
||||
const fileHead = file.slice(fileIndex, fileIndex + head.length);
|
||||
if (!this._matchOne(fileHead, head, partial, 0, 0)) {
|
||||
return false;
|
||||
}
|
||||
var hit;
|
||||
fileIndex += head.length;
|
||||
}
|
||||
let fileTailMatch = 0;
|
||||
if (tail.length) {
|
||||
if (tail.length + fileIndex > file.length) return false;
|
||||
const tailStart = file.length - tail.length;
|
||||
if (this._matchOne(file, tail, partial, tailStart, 0)) {
|
||||
fileTailMatch = tail.length;
|
||||
} else {
|
||||
if (file[file.length - 1] !== "" || fileIndex + tail.length === file.length) {
|
||||
return false;
|
||||
}
|
||||
if (!this._matchOne(file, tail, partial, tailStart - 1, 0)) {
|
||||
return false;
|
||||
}
|
||||
fileTailMatch = tail.length + 1;
|
||||
}
|
||||
}
|
||||
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.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return partial || sawSome;
|
||||
}
|
||||
const bodySegments = [[[], 0]];
|
||||
let currentBody = bodySegments[0];
|
||||
let nonGsParts = 0;
|
||||
const nonGsPartsSums = [0];
|
||||
for (const b of body) {
|
||||
if (b === GLOBSTAR) {
|
||||
nonGsPartsSums.push(nonGsParts);
|
||||
currentBody = [[], 0];
|
||||
bodySegments.push(currentBody);
|
||||
} else {
|
||||
currentBody[0].push(b);
|
||||
nonGsParts++;
|
||||
}
|
||||
}
|
||||
let idx = bodySegments.length - 1;
|
||||
const fileLength = file.length - fileTailMatch;
|
||||
for (const b of bodySegments) {
|
||||
b[1] = fileLength - (nonGsPartsSums[idx--] + 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, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
|
||||
const bs = bodySegments[bodyIndex];
|
||||
if (!bs) {
|
||||
for (let i = fileIndex; i < file.length; i++) {
|
||||
sawTail = true;
|
||||
const f = file[i];
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return sawTail;
|
||||
}
|
||||
const [body, after] = bs;
|
||||
while (fileIndex <= after) {
|
||||
const m = this._matchOne(
|
||||
file.slice(0, fileIndex + body.length),
|
||||
body,
|
||||
partial,
|
||||
fileIndex,
|
||||
0
|
||||
);
|
||||
if (m && globStarDepth < this.maxGlobstarRecursion) {
|
||||
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.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
fileIndex++;
|
||||
}
|
||||
return partial || null;
|
||||
}
|
||||
_matchOne(file, pattern, partial, fileIndex, patternIndex) {
|
||||
let fi, pi, fl, pl;
|
||||
for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
||||
this.debug("matchOne loop");
|
||||
const p = pattern[pi];
|
||||
const f = file[fi];
|
||||
this.debug(pattern, p, f);
|
||||
if (p === false || p === GLOBSTAR) return false;
|
||||
let hit;
|
||||
if (typeof p === "string") {
|
||||
hit = f === p;
|
||||
this.debug("string match", p, f, hit);
|
||||
@@ -116797,12 +116991,60 @@ var require_unescape = __commonJS({
|
||||
var require_ast = __commonJS({
|
||||
"node_modules/glob/node_modules/minimatch/dist/commonjs/ast.js"(exports2) {
|
||||
"use strict";
|
||||
var _a;
|
||||
Object.defineProperty(exports2, "__esModule", { value: true });
|
||||
exports2.AST = void 0;
|
||||
var brace_expressions_js_1 = require_brace_expressions();
|
||||
var unescape_js_1 = require_unescape();
|
||||
var types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
|
||||
var isExtglobType = (c) => types.has(c);
|
||||
var isExtglobAST = (c) => isExtglobType(c.type);
|
||||
var adoptionMap = /* @__PURE__ */ new Map([
|
||||
["!", ["@"]],
|
||||
["?", ["?", "@"]],
|
||||
["@", ["@"]],
|
||||
["*", ["*", "+", "?", "@"]],
|
||||
["+", ["+", "@"]]
|
||||
]);
|
||||
var adoptionWithSpaceMap = /* @__PURE__ */ new Map([
|
||||
["!", ["?"]],
|
||||
["@", ["?"]],
|
||||
["+", ["?", "*"]]
|
||||
]);
|
||||
var adoptionAnyMap = /* @__PURE__ */ new Map([
|
||||
["!", ["?", "@"]],
|
||||
["?", ["?", "@"]],
|
||||
["@", ["?", "@"]],
|
||||
["*", ["*", "+", "?", "@"]],
|
||||
["+", ["+", "@", "?", "*"]]
|
||||
]);
|
||||
var usurpMap = /* @__PURE__ */ new Map([
|
||||
["!", /* @__PURE__ */ new Map([["!", "@"]])],
|
||||
[
|
||||
"?",
|
||||
/* @__PURE__ */ new Map([
|
||||
["*", "*"],
|
||||
["+", "*"]
|
||||
])
|
||||
],
|
||||
[
|
||||
"@",
|
||||
/* @__PURE__ */ new Map([
|
||||
["!", "!"],
|
||||
["?", "?"],
|
||||
["@", "@"],
|
||||
["*", "*"],
|
||||
["+", "+"]
|
||||
])
|
||||
],
|
||||
[
|
||||
"+",
|
||||
/* @__PURE__ */ new Map([
|
||||
["?", "*"],
|
||||
["*", "*"]
|
||||
])
|
||||
]
|
||||
]);
|
||||
var startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
|
||||
var startNoDot = "(?!\\.)";
|
||||
var addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
|
||||
@@ -116812,7 +117054,8 @@ var require_ast = __commonJS({
|
||||
var qmark = "[^/]";
|
||||
var star = qmark + "*?";
|
||||
var starNoEmpty = qmark + "+?";
|
||||
var AST = class _AST {
|
||||
var ID = 0;
|
||||
var AST = class {
|
||||
type;
|
||||
#root;
|
||||
#hasMagic;
|
||||
@@ -116827,6 +117070,22 @@ var require_ast = __commonJS({
|
||||
// set to true if it's an extglob with no children
|
||||
// (which really means one child of '')
|
||||
#emptyExt = false;
|
||||
id = ++ID;
|
||||
get depth() {
|
||||
return (this.#parent?.depth ?? -1) + 1;
|
||||
}
|
||||
[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")]() {
|
||||
return {
|
||||
"@@type": "AST",
|
||||
id: this.id,
|
||||
type: this.type,
|
||||
root: this.#root.id,
|
||||
parent: this.#parent?.id,
|
||||
depth: this.depth,
|
||||
partsLength: this.#parts.length,
|
||||
parts: this.#parts
|
||||
};
|
||||
}
|
||||
constructor(type2, parent, options = {}) {
|
||||
this.type = type2;
|
||||
if (type2)
|
||||
@@ -116892,7 +117151,7 @@ var require_ast = __commonJS({
|
||||
for (const p of parts) {
|
||||
if (p === "")
|
||||
continue;
|
||||
if (typeof p !== "string" && !(p instanceof _AST && p.#parent === this)) {
|
||||
if (typeof p !== "string" && !(p instanceof _a && p.#parent === this)) {
|
||||
throw new Error("invalid part: " + p);
|
||||
}
|
||||
this.#parts.push(p);
|
||||
@@ -116917,7 +117176,7 @@ var require_ast = __commonJS({
|
||||
const p = this.#parent;
|
||||
for (let i = 0; i < this.#parentIndex; i++) {
|
||||
const pp = p.#parts[i];
|
||||
if (!(pp instanceof _AST && pp.type === "!")) {
|
||||
if (!(pp instanceof _a && pp.type === "!")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -116942,13 +117201,14 @@ var require_ast = __commonJS({
|
||||
this.push(part.clone(this));
|
||||
}
|
||||
clone(parent) {
|
||||
const c = new _AST(this.type, parent);
|
||||
const c = new _a(this.type, parent);
|
||||
for (const p of this.#parts) {
|
||||
c.copyIn(p);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
static #parseAST(str2, ast, pos, opt) {
|
||||
static #parseAST(str2, ast, pos, opt, extDepth) {
|
||||
const maxDepth = opt.maxExtglobRecursion ?? 2;
|
||||
let escaping = false;
|
||||
let inBrace = false;
|
||||
let braceStart = -1;
|
||||
@@ -116980,11 +117240,12 @@ var require_ast = __commonJS({
|
||||
acc2 += c;
|
||||
continue;
|
||||
}
|
||||
if (!opt.noext && isExtglobType(c) && str2.charAt(i2) === "(") {
|
||||
const doRecurse = !opt.noext && isExtglobType(c) && str2.charAt(i2) === "(" && extDepth <= maxDepth;
|
||||
if (doRecurse) {
|
||||
ast.push(acc2);
|
||||
acc2 = "";
|
||||
const ext = new _AST(c, ast);
|
||||
i2 = _AST.#parseAST(str2, ext, i2, opt);
|
||||
const ext = new _a(c, ast);
|
||||
i2 = _a.#parseAST(str2, ext, i2, opt, extDepth + 1);
|
||||
ast.push(ext);
|
||||
continue;
|
||||
}
|
||||
@@ -116994,7 +117255,7 @@ var require_ast = __commonJS({
|
||||
return i2;
|
||||
}
|
||||
let i = pos + 1;
|
||||
let part = new _AST(null, ast);
|
||||
let part = new _a(null, ast);
|
||||
const parts = [];
|
||||
let acc = "";
|
||||
while (i < str2.length) {
|
||||
@@ -117021,19 +117282,22 @@ var require_ast = __commonJS({
|
||||
acc += c;
|
||||
continue;
|
||||
}
|
||||
if (isExtglobType(c) && str2.charAt(i) === "(") {
|
||||
const doRecurse = !opt.noext && isExtglobType(c) && str2.charAt(i) === "(" && /* c8 ignore start - the maxDepth is sufficient here */
|
||||
(extDepth <= maxDepth || ast && ast.#canAdoptType(c));
|
||||
if (doRecurse) {
|
||||
const depthAdd = ast && ast.#canAdoptType(c) ? 0 : 1;
|
||||
part.push(acc);
|
||||
acc = "";
|
||||
const ext = new _AST(c, part);
|
||||
const ext = new _a(c, part);
|
||||
part.push(ext);
|
||||
i = _AST.#parseAST(str2, ext, i, opt);
|
||||
i = _a.#parseAST(str2, ext, i, opt, extDepth + depthAdd);
|
||||
continue;
|
||||
}
|
||||
if (c === "|") {
|
||||
part.push(acc);
|
||||
acc = "";
|
||||
parts.push(part);
|
||||
part = new _AST(null, ast);
|
||||
part = new _a(null, ast);
|
||||
continue;
|
||||
}
|
||||
if (c === ")") {
|
||||
@@ -117052,9 +117316,71 @@ var require_ast = __commonJS({
|
||||
ast.#parts = [str2.substring(pos - 1)];
|
||||
return i;
|
||||
}
|
||||
#canAdoptWithSpace(child) {
|
||||
return this.#canAdopt(child, adoptionWithSpaceMap);
|
||||
}
|
||||
#canAdopt(child, map2 = adoptionMap) {
|
||||
if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null) {
|
||||
return false;
|
||||
}
|
||||
const gc = child.#parts[0];
|
||||
if (!gc || typeof gc !== "object" || gc.type === null) {
|
||||
return false;
|
||||
}
|
||||
return this.#canAdoptType(gc.type, map2);
|
||||
}
|
||||
#canAdoptType(c, map2 = adoptionAnyMap) {
|
||||
return !!map2.get(this.type)?.includes(c);
|
||||
}
|
||||
#adoptWithSpace(child, index) {
|
||||
const gc = child.#parts[0];
|
||||
const blank = new _a(null, gc, this.options);
|
||||
blank.#parts.push("");
|
||||
gc.push(blank);
|
||||
this.#adopt(child, index);
|
||||
}
|
||||
#adopt(child, index) {
|
||||
const gc = child.#parts[0];
|
||||
this.#parts.splice(index, 1, ...gc.#parts);
|
||||
for (const p of gc.#parts) {
|
||||
if (typeof p === "object")
|
||||
p.#parent = this;
|
||||
}
|
||||
this.#toString = void 0;
|
||||
}
|
||||
#canUsurpType(c) {
|
||||
const m = usurpMap.get(this.type);
|
||||
return !!m?.has(c);
|
||||
}
|
||||
#canUsurp(child) {
|
||||
if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null || this.#parts.length !== 1) {
|
||||
return false;
|
||||
}
|
||||
const gc = child.#parts[0];
|
||||
if (!gc || typeof gc !== "object" || gc.type === null) {
|
||||
return false;
|
||||
}
|
||||
return this.#canUsurpType(gc.type);
|
||||
}
|
||||
#usurp(child) {
|
||||
const m = usurpMap.get(this.type);
|
||||
const gc = child.#parts[0];
|
||||
const nt = m?.get(gc.type);
|
||||
if (!nt)
|
||||
return false;
|
||||
this.#parts = gc.#parts;
|
||||
for (const p of this.#parts) {
|
||||
if (typeof p === "object") {
|
||||
p.#parent = this;
|
||||
}
|
||||
}
|
||||
this.type = nt;
|
||||
this.#toString = void 0;
|
||||
this.#emptyExt = false;
|
||||
}
|
||||
static fromGlob(pattern, options = {}) {
|
||||
const ast = new _AST(null, void 0, options);
|
||||
_AST.#parseAST(pattern, ast, 0, options);
|
||||
const ast = new _a(null, void 0, options);
|
||||
_a.#parseAST(pattern, ast, 0, options, 0);
|
||||
return ast;
|
||||
}
|
||||
// returns the regular expression if there's magic, or the unescaped
|
||||
@@ -117148,12 +117474,14 @@ var require_ast = __commonJS({
|
||||
// or start or whatever) and prepend ^ or / at the Regexp construction.
|
||||
toRegExpSource(allowDot) {
|
||||
const dot = allowDot ?? !!this.#options.dot;
|
||||
if (this.#root === this)
|
||||
if (this.#root === this) {
|
||||
this.#flatten();
|
||||
this.#fillNegs();
|
||||
if (!this.type) {
|
||||
}
|
||||
if (!isExtglobAST(this)) {
|
||||
const noEmpty = this.isStart() && this.isEnd() && !this.#parts.some((s) => typeof s !== "string");
|
||||
const src = this.#parts.map((p) => {
|
||||
const [re, _2, hasMagic, uflag] = typeof p === "string" ? _AST.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
|
||||
const [re, _2, hasMagic, uflag] = typeof p === "string" ? _a.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
|
||||
this.#hasMagic = this.#hasMagic || hasMagic;
|
||||
this.#uflag = this.#uflag || uflag;
|
||||
return re;
|
||||
@@ -117192,9 +117520,10 @@ var require_ast = __commonJS({
|
||||
let body = this.#partsToRegExp(dot);
|
||||
if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
|
||||
const s = this.toString();
|
||||
this.#parts = [s];
|
||||
this.type = null;
|
||||
this.#hasMagic = void 0;
|
||||
const me = this;
|
||||
me.#parts = [s];
|
||||
me.type = null;
|
||||
me.#hasMagic = void 0;
|
||||
return [s, (0, unescape_js_1.unescape)(this.toString()), false, false];
|
||||
}
|
||||
let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ? "" : this.#partsToRegExp(true);
|
||||
@@ -117221,6 +117550,38 @@ var require_ast = __commonJS({
|
||||
this.#uflag
|
||||
];
|
||||
}
|
||||
#flatten() {
|
||||
if (!isExtglobAST(this)) {
|
||||
for (const p of this.#parts) {
|
||||
if (typeof p === "object") {
|
||||
p.#flatten();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let iterations = 0;
|
||||
let done = false;
|
||||
do {
|
||||
done = true;
|
||||
for (let i = 0; i < this.#parts.length; i++) {
|
||||
const c = this.#parts[i];
|
||||
if (typeof c === "object") {
|
||||
c.#flatten();
|
||||
if (this.#canAdopt(c)) {
|
||||
done = false;
|
||||
this.#adopt(c, i);
|
||||
} else if (this.#canAdoptWithSpace(c)) {
|
||||
done = false;
|
||||
this.#adoptWithSpace(c, i);
|
||||
} else if (this.#canUsurp(c)) {
|
||||
done = false;
|
||||
this.#usurp(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (!done && ++iterations < 10);
|
||||
}
|
||||
this.#toString = void 0;
|
||||
}
|
||||
#partsToRegExp(dot) {
|
||||
return this.#parts.map((p) => {
|
||||
if (typeof p === "string") {
|
||||
@@ -117282,6 +117643,7 @@ var require_ast = __commonJS({
|
||||
}
|
||||
};
|
||||
exports2.AST = AST;
|
||||
_a = AST;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -117466,11 +117828,13 @@ var require_commonjs20 = __commonJS({
|
||||
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";
|
||||
@@ -117807,7 +118171,8 @@ var require_commonjs20 = __commonJS({
|
||||
// out of pattern, then that's fine, as long as all
|
||||
// the parts match.
|
||||
matchOne(file, pattern, partial = false) {
|
||||
const options = this.options;
|
||||
let fileStartIndex = 0;
|
||||
let patternStartIndex = 0;
|
||||
if (this.isWindows) {
|
||||
const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
|
||||
const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
|
||||
@@ -117822,11 +118187,8 @@ var require_commonjs20 = __commonJS({
|
||||
];
|
||||
if (fd.toLowerCase() === pd.toLowerCase()) {
|
||||
pattern[pdi] = fd;
|
||||
if (pdi > fdi) {
|
||||
pattern = pattern.slice(pdi);
|
||||
} else if (fdi > pdi) {
|
||||
file = file.slice(fdi);
|
||||
}
|
||||
patternStartIndex = pdi;
|
||||
fileStartIndex = fdi;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117834,49 +118196,123 @@ var require_commonjs20 = __commonJS({
|
||||
if (optimizationLevel >= 2) {
|
||||
file = this.levelTwoFileOptimize(file);
|
||||
}
|
||||
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");
|
||||
var p = pattern[pi];
|
||||
var f = file[fi];
|
||||
this.debug(pattern, p, f);
|
||||
if (p === false) {
|
||||
if (pattern.includes(exports2.GLOBSTAR)) {
|
||||
return this.#matchGlobstar(file, pattern, partial, fileStartIndex, patternStartIndex);
|
||||
}
|
||||
return this.#matchOne(file, pattern, partial, fileStartIndex, patternStartIndex);
|
||||
}
|
||||
#matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
|
||||
const firstgs = pattern.indexOf(exports2.GLOBSTAR, patternIndex);
|
||||
const lastgs = pattern.lastIndexOf(exports2.GLOBSTAR);
|
||||
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)
|
||||
];
|
||||
if (head.length) {
|
||||
const fileHead = file.slice(fileIndex, fileIndex + head.length);
|
||||
if (!this.#matchOne(fileHead, head, partial, 0, 0)) {
|
||||
return false;
|
||||
}
|
||||
if (p === exports2.GLOBSTAR) {
|
||||
this.debug("GLOBSTAR", [pattern, p, f]);
|
||||
var fr = fi;
|
||||
var pr = pi + 1;
|
||||
if (pr === pl) {
|
||||
this.debug("** at the end");
|
||||
for (; fi < fl; fi++) {
|
||||
if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
fileIndex += head.length;
|
||||
patternIndex += head.length;
|
||||
}
|
||||
let fileTailMatch = 0;
|
||||
if (tail.length) {
|
||||
if (tail.length + fileIndex > file.length)
|
||||
return false;
|
||||
let tailStart = file.length - tail.length;
|
||||
if (this.#matchOne(file, tail, partial, tailStart, 0)) {
|
||||
fileTailMatch = tail.length;
|
||||
} else {
|
||||
if (file[file.length - 1] !== "" || fileIndex + tail.length === file.length) {
|
||||
return false;
|
||||
}
|
||||
while (fr < fl) {
|
||||
var swallowee = file[fr];
|
||||
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
|
||||
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
||||
this.debug("globstar found match!", fr, fl, swallowee);
|
||||
return true;
|
||||
} else {
|
||||
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
|
||||
this.debug("dot detected!", file, fr, pattern, pr);
|
||||
break;
|
||||
}
|
||||
this.debug("globstar swallow a segment, and continue");
|
||||
fr++;
|
||||
}
|
||||
tailStart--;
|
||||
if (!this.#matchOne(file, tail, partial, tailStart, 0)) {
|
||||
return false;
|
||||
}
|
||||
if (partial) {
|
||||
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
|
||||
if (fr === fl) {
|
||||
return true;
|
||||
}
|
||||
fileTailMatch = tail.length + 1;
|
||||
}
|
||||
}
|
||||
if (!body.length) {
|
||||
let sawSome = !!fileTailMatch;
|
||||
for (let i2 = fileIndex; i2 < file.length - fileTailMatch; i2++) {
|
||||
const f = String(file[i2]);
|
||||
sawSome = true;
|
||||
if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return partial || sawSome;
|
||||
}
|
||||
const bodySegments = [[[], 0]];
|
||||
let currentBody = bodySegments[0];
|
||||
let nonGsParts = 0;
|
||||
const nonGsPartsSums = [0];
|
||||
for (const b of body) {
|
||||
if (b === exports2.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, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
|
||||
const bs = bodySegments[bodyIndex];
|
||||
if (!bs) {
|
||||
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;
|
||||
}
|
||||
const [body, after] = bs;
|
||||
while (fileIndex <= after) {
|
||||
const m = this.#matchOne(file.slice(0, fileIndex + body.length), body, partial, fileIndex, 0);
|
||||
if (m && globStarDepth < this.maxGlobstarRecursion) {
|
||||
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++;
|
||||
}
|
||||
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 loop");
|
||||
let p = pattern[pi];
|
||||
let f = file[fi];
|
||||
this.debug(pattern, p, f);
|
||||
if (p === false || p === exports2.GLOBSTAR) {
|
||||
return false;
|
||||
}
|
||||
let hit;
|
||||
|
||||
Generated
+137
-39
@@ -49512,6 +49512,7 @@ var require_minimatch = __commonJS({
|
||||
pattern = pattern.split(path17.sep).join("/");
|
||||
}
|
||||
this.options = options;
|
||||
this.maxGlobstarRecursion = options.maxGlobstarRecursion !== void 0 ? options.maxGlobstarRecursion : 200;
|
||||
this.set = [];
|
||||
this.pattern = pattern;
|
||||
this.regexp = null;
|
||||
@@ -49908,50 +49909,147 @@ var require_minimatch = __commonJS({
|
||||
return this.negate;
|
||||
};
|
||||
Minimatch.prototype.matchOne = function(file, pattern, partial) {
|
||||
var options = this.options;
|
||||
this.debug(
|
||||
"matchOne",
|
||||
{ "this": this, file, pattern }
|
||||
if (pattern.indexOf(GLOBSTAR) !== -1) {
|
||||
return this._matchGlobstar(file, pattern, partial, 0, 0);
|
||||
}
|
||||
return this._matchOne(file, pattern, partial, 0, 0);
|
||||
};
|
||||
Minimatch.prototype._matchGlobstar = function(file, pattern, partial, fileIndex, patternIndex) {
|
||||
var i;
|
||||
var firstgs = -1;
|
||||
for (i = patternIndex; i < pattern.length; i++) {
|
||||
if (pattern[i] === GLOBSTAR) {
|
||||
firstgs = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var lastgs = -1;
|
||||
for (i = pattern.length - 1; i >= 0; i--) {
|
||||
if (pattern[i] === GLOBSTAR) {
|
||||
lastgs = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var head = pattern.slice(patternIndex, firstgs);
|
||||
var body = partial ? pattern.slice(firstgs + 1) : pattern.slice(firstgs + 1, lastgs);
|
||||
var tail = partial ? [] : pattern.slice(lastgs + 1);
|
||||
if (head.length) {
|
||||
var fileHead = file.slice(fileIndex, fileIndex + head.length);
|
||||
if (!this._matchOne(fileHead, head, partial, 0, 0)) {
|
||||
return false;
|
||||
}
|
||||
fileIndex += head.length;
|
||||
}
|
||||
var fileTailMatch = 0;
|
||||
if (tail.length) {
|
||||
if (tail.length + fileIndex > file.length) return false;
|
||||
var tailStart = file.length - tail.length;
|
||||
if (this._matchOne(file, tail, partial, tailStart, 0)) {
|
||||
fileTailMatch = tail.length;
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
}
|
||||
if (!body.length) {
|
||||
var sawSome = !!fileTailMatch;
|
||||
for (i = fileIndex; i < file.length - fileTailMatch; i++) {
|
||||
var f = String(file[i]);
|
||||
sawSome = true;
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return partial || sawSome;
|
||||
}
|
||||
var bodySegments = [[[], 0]];
|
||||
var currentBody = bodySegments[0];
|
||||
var nonGsParts = 0;
|
||||
var nonGsPartsSums = [0];
|
||||
for (var bi = 0; bi < body.length; bi++) {
|
||||
var b = body[bi];
|
||||
if (b === GLOBSTAR) {
|
||||
nonGsPartsSums.push(nonGsParts);
|
||||
currentBody = [[], 0];
|
||||
bodySegments.push(currentBody);
|
||||
} else {
|
||||
currentBody[0].push(b);
|
||||
nonGsParts++;
|
||||
}
|
||||
}
|
||||
var idx = bodySegments.length - 1;
|
||||
var fileLength = file.length - fileTailMatch;
|
||||
for (var si = 0; si < bodySegments.length; si++) {
|
||||
bodySegments[si][1] = fileLength - (nonGsPartsSums[idx--] + bodySegments[si][0].length);
|
||||
}
|
||||
return !!this._matchGlobStarBodySections(
|
||||
file,
|
||||
bodySegments,
|
||||
fileIndex,
|
||||
0,
|
||||
partial,
|
||||
0,
|
||||
!!fileTailMatch
|
||||
);
|
||||
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++) {
|
||||
};
|
||||
Minimatch.prototype._matchGlobStarBodySections = function(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
|
||||
var bs = bodySegments[bodyIndex];
|
||||
if (!bs) {
|
||||
for (var i = fileIndex; i < file.length; i++) {
|
||||
sawTail = true;
|
||||
var f = file[i];
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return sawTail;
|
||||
}
|
||||
var body = bs[0];
|
||||
var after = bs[1];
|
||||
while (fileIndex <= after) {
|
||||
var m = this._matchOne(
|
||||
file.slice(0, fileIndex + body.length),
|
||||
body,
|
||||
partial,
|
||||
fileIndex,
|
||||
0
|
||||
);
|
||||
if (m && globStarDepth < this.maxGlobstarRecursion) {
|
||||
var sub = this._matchGlobStarBodySections(
|
||||
file,
|
||||
bodySegments,
|
||||
fileIndex + body.length,
|
||||
bodyIndex + 1,
|
||||
partial,
|
||||
globStarDepth + 1,
|
||||
sawTail
|
||||
);
|
||||
if (sub !== false) {
|
||||
return sub;
|
||||
}
|
||||
}
|
||||
var f = file[fileIndex];
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
fileIndex++;
|
||||
}
|
||||
return partial || null;
|
||||
};
|
||||
Minimatch.prototype._matchOne = function(file, pattern, partial, fileIndex, patternIndex) {
|
||||
var fi, pi, fl, pl;
|
||||
for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
||||
this.debug("matchOne loop");
|
||||
var p = pattern[pi];
|
||||
var f = file[fi];
|
||||
this.debug(pattern, p, f);
|
||||
if (p === false) return false;
|
||||
if (p === GLOBSTAR) {
|
||||
this.debug("GLOBSTAR", [pattern, p, f]);
|
||||
var fr = fi;
|
||||
var pr = pi + 1;
|
||||
if (pr === pl) {
|
||||
this.debug("** at the end");
|
||||
for (; fi < fl; fi++) {
|
||||
if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".") return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
while (fr < fl) {
|
||||
var swallowee = file[fr];
|
||||
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
|
||||
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
||||
this.debug("globstar found match!", fr, fl, swallowee);
|
||||
return true;
|
||||
} else {
|
||||
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
|
||||
this.debug("dot detected!", file, fr, pattern, pr);
|
||||
break;
|
||||
}
|
||||
this.debug("globstar swallow a segment, and continue");
|
||||
fr++;
|
||||
}
|
||||
}
|
||||
if (partial) {
|
||||
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
|
||||
if (fr === fl) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (p === false || p === GLOBSTAR) return false;
|
||||
var hit;
|
||||
if (typeof p === "string") {
|
||||
hit = f === p;
|
||||
|
||||
Generated
+137
-39
@@ -49361,6 +49361,7 @@ var require_minimatch = __commonJS({
|
||||
pattern = pattern.split(path5.sep).join("/");
|
||||
}
|
||||
this.options = options;
|
||||
this.maxGlobstarRecursion = options.maxGlobstarRecursion !== void 0 ? options.maxGlobstarRecursion : 200;
|
||||
this.set = [];
|
||||
this.pattern = pattern;
|
||||
this.regexp = null;
|
||||
@@ -49757,50 +49758,147 @@ var require_minimatch = __commonJS({
|
||||
return this.negate;
|
||||
};
|
||||
Minimatch.prototype.matchOne = function(file, pattern, partial) {
|
||||
var options = this.options;
|
||||
this.debug(
|
||||
"matchOne",
|
||||
{ "this": this, file, pattern }
|
||||
if (pattern.indexOf(GLOBSTAR) !== -1) {
|
||||
return this._matchGlobstar(file, pattern, partial, 0, 0);
|
||||
}
|
||||
return this._matchOne(file, pattern, partial, 0, 0);
|
||||
};
|
||||
Minimatch.prototype._matchGlobstar = function(file, pattern, partial, fileIndex, patternIndex) {
|
||||
var i;
|
||||
var firstgs = -1;
|
||||
for (i = patternIndex; i < pattern.length; i++) {
|
||||
if (pattern[i] === GLOBSTAR) {
|
||||
firstgs = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var lastgs = -1;
|
||||
for (i = pattern.length - 1; i >= 0; i--) {
|
||||
if (pattern[i] === GLOBSTAR) {
|
||||
lastgs = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var head = pattern.slice(patternIndex, firstgs);
|
||||
var body = partial ? pattern.slice(firstgs + 1) : pattern.slice(firstgs + 1, lastgs);
|
||||
var tail = partial ? [] : pattern.slice(lastgs + 1);
|
||||
if (head.length) {
|
||||
var fileHead = file.slice(fileIndex, fileIndex + head.length);
|
||||
if (!this._matchOne(fileHead, head, partial, 0, 0)) {
|
||||
return false;
|
||||
}
|
||||
fileIndex += head.length;
|
||||
}
|
||||
var fileTailMatch = 0;
|
||||
if (tail.length) {
|
||||
if (tail.length + fileIndex > file.length) return false;
|
||||
var tailStart = file.length - tail.length;
|
||||
if (this._matchOne(file, tail, partial, tailStart, 0)) {
|
||||
fileTailMatch = tail.length;
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
}
|
||||
if (!body.length) {
|
||||
var sawSome = !!fileTailMatch;
|
||||
for (i = fileIndex; i < file.length - fileTailMatch; i++) {
|
||||
var f = String(file[i]);
|
||||
sawSome = true;
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return partial || sawSome;
|
||||
}
|
||||
var bodySegments = [[[], 0]];
|
||||
var currentBody = bodySegments[0];
|
||||
var nonGsParts = 0;
|
||||
var nonGsPartsSums = [0];
|
||||
for (var bi = 0; bi < body.length; bi++) {
|
||||
var b = body[bi];
|
||||
if (b === GLOBSTAR) {
|
||||
nonGsPartsSums.push(nonGsParts);
|
||||
currentBody = [[], 0];
|
||||
bodySegments.push(currentBody);
|
||||
} else {
|
||||
currentBody[0].push(b);
|
||||
nonGsParts++;
|
||||
}
|
||||
}
|
||||
var idx = bodySegments.length - 1;
|
||||
var fileLength = file.length - fileTailMatch;
|
||||
for (var si = 0; si < bodySegments.length; si++) {
|
||||
bodySegments[si][1] = fileLength - (nonGsPartsSums[idx--] + bodySegments[si][0].length);
|
||||
}
|
||||
return !!this._matchGlobStarBodySections(
|
||||
file,
|
||||
bodySegments,
|
||||
fileIndex,
|
||||
0,
|
||||
partial,
|
||||
0,
|
||||
!!fileTailMatch
|
||||
);
|
||||
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++) {
|
||||
};
|
||||
Minimatch.prototype._matchGlobStarBodySections = function(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
|
||||
var bs = bodySegments[bodyIndex];
|
||||
if (!bs) {
|
||||
for (var i = fileIndex; i < file.length; i++) {
|
||||
sawTail = true;
|
||||
var f = file[i];
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return sawTail;
|
||||
}
|
||||
var body = bs[0];
|
||||
var after = bs[1];
|
||||
while (fileIndex <= after) {
|
||||
var m = this._matchOne(
|
||||
file.slice(0, fileIndex + body.length),
|
||||
body,
|
||||
partial,
|
||||
fileIndex,
|
||||
0
|
||||
);
|
||||
if (m && globStarDepth < this.maxGlobstarRecursion) {
|
||||
var sub = this._matchGlobStarBodySections(
|
||||
file,
|
||||
bodySegments,
|
||||
fileIndex + body.length,
|
||||
bodyIndex + 1,
|
||||
partial,
|
||||
globStarDepth + 1,
|
||||
sawTail
|
||||
);
|
||||
if (sub !== false) {
|
||||
return sub;
|
||||
}
|
||||
}
|
||||
var f = file[fileIndex];
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
fileIndex++;
|
||||
}
|
||||
return partial || null;
|
||||
};
|
||||
Minimatch.prototype._matchOne = function(file, pattern, partial, fileIndex, patternIndex) {
|
||||
var fi, pi, fl, pl;
|
||||
for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
||||
this.debug("matchOne loop");
|
||||
var p = pattern[pi];
|
||||
var f = file[fi];
|
||||
this.debug(pattern, p, f);
|
||||
if (p === false) return false;
|
||||
if (p === GLOBSTAR) {
|
||||
this.debug("GLOBSTAR", [pattern, p, f]);
|
||||
var fr = fi;
|
||||
var pr = pi + 1;
|
||||
if (pr === pl) {
|
||||
this.debug("** at the end");
|
||||
for (; fi < fl; fi++) {
|
||||
if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".") return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
while (fr < fl) {
|
||||
var swallowee = file[fr];
|
||||
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
|
||||
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
||||
this.debug("globstar found match!", fr, fl, swallowee);
|
||||
return true;
|
||||
} else {
|
||||
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
|
||||
this.debug("dot detected!", file, fr, pattern, pr);
|
||||
break;
|
||||
}
|
||||
this.debug("globstar swallow a segment, and continue");
|
||||
fr++;
|
||||
}
|
||||
}
|
||||
if (partial) {
|
||||
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
|
||||
if (fr === fl) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (p === false || p === GLOBSTAR) return false;
|
||||
var hit;
|
||||
if (typeof p === "string") {
|
||||
hit = f === p;
|
||||
|
||||
Generated
+137
-39
@@ -48064,6 +48064,7 @@ var require_minimatch = __commonJS({
|
||||
pattern = pattern.split(path9.sep).join("/");
|
||||
}
|
||||
this.options = options;
|
||||
this.maxGlobstarRecursion = options.maxGlobstarRecursion !== void 0 ? options.maxGlobstarRecursion : 200;
|
||||
this.set = [];
|
||||
this.pattern = pattern;
|
||||
this.regexp = null;
|
||||
@@ -48460,50 +48461,147 @@ var require_minimatch = __commonJS({
|
||||
return this.negate;
|
||||
};
|
||||
Minimatch.prototype.matchOne = function(file, pattern, partial) {
|
||||
var options = this.options;
|
||||
this.debug(
|
||||
"matchOne",
|
||||
{ "this": this, file, pattern }
|
||||
if (pattern.indexOf(GLOBSTAR) !== -1) {
|
||||
return this._matchGlobstar(file, pattern, partial, 0, 0);
|
||||
}
|
||||
return this._matchOne(file, pattern, partial, 0, 0);
|
||||
};
|
||||
Minimatch.prototype._matchGlobstar = function(file, pattern, partial, fileIndex, patternIndex) {
|
||||
var i;
|
||||
var firstgs = -1;
|
||||
for (i = patternIndex; i < pattern.length; i++) {
|
||||
if (pattern[i] === GLOBSTAR) {
|
||||
firstgs = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var lastgs = -1;
|
||||
for (i = pattern.length - 1; i >= 0; i--) {
|
||||
if (pattern[i] === GLOBSTAR) {
|
||||
lastgs = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var head = pattern.slice(patternIndex, firstgs);
|
||||
var body = partial ? pattern.slice(firstgs + 1) : pattern.slice(firstgs + 1, lastgs);
|
||||
var tail = partial ? [] : pattern.slice(lastgs + 1);
|
||||
if (head.length) {
|
||||
var fileHead = file.slice(fileIndex, fileIndex + head.length);
|
||||
if (!this._matchOne(fileHead, head, partial, 0, 0)) {
|
||||
return false;
|
||||
}
|
||||
fileIndex += head.length;
|
||||
}
|
||||
var fileTailMatch = 0;
|
||||
if (tail.length) {
|
||||
if (tail.length + fileIndex > file.length) return false;
|
||||
var tailStart = file.length - tail.length;
|
||||
if (this._matchOne(file, tail, partial, tailStart, 0)) {
|
||||
fileTailMatch = tail.length;
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
}
|
||||
if (!body.length) {
|
||||
var sawSome = !!fileTailMatch;
|
||||
for (i = fileIndex; i < file.length - fileTailMatch; i++) {
|
||||
var f = String(file[i]);
|
||||
sawSome = true;
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return partial || sawSome;
|
||||
}
|
||||
var bodySegments = [[[], 0]];
|
||||
var currentBody = bodySegments[0];
|
||||
var nonGsParts = 0;
|
||||
var nonGsPartsSums = [0];
|
||||
for (var bi = 0; bi < body.length; bi++) {
|
||||
var b = body[bi];
|
||||
if (b === GLOBSTAR) {
|
||||
nonGsPartsSums.push(nonGsParts);
|
||||
currentBody = [[], 0];
|
||||
bodySegments.push(currentBody);
|
||||
} else {
|
||||
currentBody[0].push(b);
|
||||
nonGsParts++;
|
||||
}
|
||||
}
|
||||
var idx = bodySegments.length - 1;
|
||||
var fileLength = file.length - fileTailMatch;
|
||||
for (var si = 0; si < bodySegments.length; si++) {
|
||||
bodySegments[si][1] = fileLength - (nonGsPartsSums[idx--] + bodySegments[si][0].length);
|
||||
}
|
||||
return !!this._matchGlobStarBodySections(
|
||||
file,
|
||||
bodySegments,
|
||||
fileIndex,
|
||||
0,
|
||||
partial,
|
||||
0,
|
||||
!!fileTailMatch
|
||||
);
|
||||
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++) {
|
||||
};
|
||||
Minimatch.prototype._matchGlobStarBodySections = function(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
|
||||
var bs = bodySegments[bodyIndex];
|
||||
if (!bs) {
|
||||
for (var i = fileIndex; i < file.length; i++) {
|
||||
sawTail = true;
|
||||
var f = file[i];
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return sawTail;
|
||||
}
|
||||
var body = bs[0];
|
||||
var after = bs[1];
|
||||
while (fileIndex <= after) {
|
||||
var m = this._matchOne(
|
||||
file.slice(0, fileIndex + body.length),
|
||||
body,
|
||||
partial,
|
||||
fileIndex,
|
||||
0
|
||||
);
|
||||
if (m && globStarDepth < this.maxGlobstarRecursion) {
|
||||
var sub = this._matchGlobStarBodySections(
|
||||
file,
|
||||
bodySegments,
|
||||
fileIndex + body.length,
|
||||
bodyIndex + 1,
|
||||
partial,
|
||||
globStarDepth + 1,
|
||||
sawTail
|
||||
);
|
||||
if (sub !== false) {
|
||||
return sub;
|
||||
}
|
||||
}
|
||||
var f = file[fileIndex];
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
fileIndex++;
|
||||
}
|
||||
return partial || null;
|
||||
};
|
||||
Minimatch.prototype._matchOne = function(file, pattern, partial, fileIndex, patternIndex) {
|
||||
var fi, pi, fl, pl;
|
||||
for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
||||
this.debug("matchOne loop");
|
||||
var p = pattern[pi];
|
||||
var f = file[fi];
|
||||
this.debug(pattern, p, f);
|
||||
if (p === false) return false;
|
||||
if (p === GLOBSTAR) {
|
||||
this.debug("GLOBSTAR", [pattern, p, f]);
|
||||
var fr = fi;
|
||||
var pr = pi + 1;
|
||||
if (pr === pl) {
|
||||
this.debug("** at the end");
|
||||
for (; fi < fl; fi++) {
|
||||
if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".") return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
while (fr < fl) {
|
||||
var swallowee = file[fr];
|
||||
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
|
||||
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
||||
this.debug("globstar found match!", fr, fl, swallowee);
|
||||
return true;
|
||||
} else {
|
||||
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
|
||||
this.debug("dot detected!", file, fr, pattern, pr);
|
||||
break;
|
||||
}
|
||||
this.debug("globstar swallow a segment, and continue");
|
||||
fr++;
|
||||
}
|
||||
}
|
||||
if (partial) {
|
||||
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
|
||||
if (fr === fl) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (p === false || p === GLOBSTAR) return false;
|
||||
var hit;
|
||||
if (typeof p === "string") {
|
||||
hit = f === p;
|
||||
|
||||
Generated
+583
-147
@@ -49361,6 +49361,7 @@ var require_minimatch = __commonJS({
|
||||
pattern = pattern.split(path4.sep).join("/");
|
||||
}
|
||||
this.options = options;
|
||||
this.maxGlobstarRecursion = options.maxGlobstarRecursion !== void 0 ? options.maxGlobstarRecursion : 200;
|
||||
this.set = [];
|
||||
this.pattern = pattern;
|
||||
this.regexp = null;
|
||||
@@ -49757,50 +49758,147 @@ var require_minimatch = __commonJS({
|
||||
return this.negate;
|
||||
};
|
||||
Minimatch.prototype.matchOne = function(file, pattern, partial) {
|
||||
var options = this.options;
|
||||
this.debug(
|
||||
"matchOne",
|
||||
{ "this": this, file, pattern }
|
||||
if (pattern.indexOf(GLOBSTAR) !== -1) {
|
||||
return this._matchGlobstar(file, pattern, partial, 0, 0);
|
||||
}
|
||||
return this._matchOne(file, pattern, partial, 0, 0);
|
||||
};
|
||||
Minimatch.prototype._matchGlobstar = function(file, pattern, partial, fileIndex, patternIndex) {
|
||||
var i;
|
||||
var firstgs = -1;
|
||||
for (i = patternIndex; i < pattern.length; i++) {
|
||||
if (pattern[i] === GLOBSTAR) {
|
||||
firstgs = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var lastgs = -1;
|
||||
for (i = pattern.length - 1; i >= 0; i--) {
|
||||
if (pattern[i] === GLOBSTAR) {
|
||||
lastgs = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var head = pattern.slice(patternIndex, firstgs);
|
||||
var body = partial ? pattern.slice(firstgs + 1) : pattern.slice(firstgs + 1, lastgs);
|
||||
var tail = partial ? [] : pattern.slice(lastgs + 1);
|
||||
if (head.length) {
|
||||
var fileHead = file.slice(fileIndex, fileIndex + head.length);
|
||||
if (!this._matchOne(fileHead, head, partial, 0, 0)) {
|
||||
return false;
|
||||
}
|
||||
fileIndex += head.length;
|
||||
}
|
||||
var fileTailMatch = 0;
|
||||
if (tail.length) {
|
||||
if (tail.length + fileIndex > file.length) return false;
|
||||
var tailStart = file.length - tail.length;
|
||||
if (this._matchOne(file, tail, partial, tailStart, 0)) {
|
||||
fileTailMatch = tail.length;
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
}
|
||||
if (!body.length) {
|
||||
var sawSome = !!fileTailMatch;
|
||||
for (i = fileIndex; i < file.length - fileTailMatch; i++) {
|
||||
var f = String(file[i]);
|
||||
sawSome = true;
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return partial || sawSome;
|
||||
}
|
||||
var bodySegments = [[[], 0]];
|
||||
var currentBody = bodySegments[0];
|
||||
var nonGsParts = 0;
|
||||
var nonGsPartsSums = [0];
|
||||
for (var bi = 0; bi < body.length; bi++) {
|
||||
var b = body[bi];
|
||||
if (b === GLOBSTAR) {
|
||||
nonGsPartsSums.push(nonGsParts);
|
||||
currentBody = [[], 0];
|
||||
bodySegments.push(currentBody);
|
||||
} else {
|
||||
currentBody[0].push(b);
|
||||
nonGsParts++;
|
||||
}
|
||||
}
|
||||
var idx = bodySegments.length - 1;
|
||||
var fileLength = file.length - fileTailMatch;
|
||||
for (var si = 0; si < bodySegments.length; si++) {
|
||||
bodySegments[si][1] = fileLength - (nonGsPartsSums[idx--] + bodySegments[si][0].length);
|
||||
}
|
||||
return !!this._matchGlobStarBodySections(
|
||||
file,
|
||||
bodySegments,
|
||||
fileIndex,
|
||||
0,
|
||||
partial,
|
||||
0,
|
||||
!!fileTailMatch
|
||||
);
|
||||
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++) {
|
||||
};
|
||||
Minimatch.prototype._matchGlobStarBodySections = function(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
|
||||
var bs = bodySegments[bodyIndex];
|
||||
if (!bs) {
|
||||
for (var i = fileIndex; i < file.length; i++) {
|
||||
sawTail = true;
|
||||
var f = file[i];
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return sawTail;
|
||||
}
|
||||
var body = bs[0];
|
||||
var after = bs[1];
|
||||
while (fileIndex <= after) {
|
||||
var m = this._matchOne(
|
||||
file.slice(0, fileIndex + body.length),
|
||||
body,
|
||||
partial,
|
||||
fileIndex,
|
||||
0
|
||||
);
|
||||
if (m && globStarDepth < this.maxGlobstarRecursion) {
|
||||
var sub = this._matchGlobStarBodySections(
|
||||
file,
|
||||
bodySegments,
|
||||
fileIndex + body.length,
|
||||
bodyIndex + 1,
|
||||
partial,
|
||||
globStarDepth + 1,
|
||||
sawTail
|
||||
);
|
||||
if (sub !== false) {
|
||||
return sub;
|
||||
}
|
||||
}
|
||||
var f = file[fileIndex];
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
fileIndex++;
|
||||
}
|
||||
return partial || null;
|
||||
};
|
||||
Minimatch.prototype._matchOne = function(file, pattern, partial, fileIndex, patternIndex) {
|
||||
var fi, pi, fl, pl;
|
||||
for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
||||
this.debug("matchOne loop");
|
||||
var p = pattern[pi];
|
||||
var f = file[fi];
|
||||
this.debug(pattern, p, f);
|
||||
if (p === false) return false;
|
||||
if (p === GLOBSTAR) {
|
||||
this.debug("GLOBSTAR", [pattern, p, f]);
|
||||
var fr = fi;
|
||||
var pr = pi + 1;
|
||||
if (pr === pl) {
|
||||
this.debug("** at the end");
|
||||
for (; fi < fl; fi++) {
|
||||
if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".") return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
while (fr < fl) {
|
||||
var swallowee = file[fr];
|
||||
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
|
||||
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
||||
this.debug("globstar found match!", fr, fl, swallowee);
|
||||
return true;
|
||||
} else {
|
||||
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
|
||||
this.debug("dot detected!", file, fr, pattern, pr);
|
||||
break;
|
||||
}
|
||||
this.debug("globstar swallow a segment, and continue");
|
||||
fr++;
|
||||
}
|
||||
}
|
||||
if (partial) {
|
||||
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
|
||||
if (fr === fl) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (p === false || p === GLOBSTAR) return false;
|
||||
var hit;
|
||||
if (typeof p === "string") {
|
||||
hit = f === p;
|
||||
@@ -102003,6 +102101,7 @@ var require_minimatch2 = __commonJS({
|
||||
assertValidPattern(pattern);
|
||||
if (!options) options = {};
|
||||
this.options = options;
|
||||
this.maxGlobstarRecursion = options.maxGlobstarRecursion !== void 0 ? options.maxGlobstarRecursion : 200;
|
||||
this.set = [];
|
||||
this.pattern = pattern;
|
||||
this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
|
||||
@@ -102059,51 +102158,146 @@ var require_minimatch2 = __commonJS({
|
||||
// out of pattern, then that's fine, as long as all
|
||||
// the parts match.
|
||||
matchOne(file, pattern, partial) {
|
||||
var options = this.options;
|
||||
this.debug(
|
||||
"matchOne",
|
||||
{ "this": 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");
|
||||
var p = pattern[pi];
|
||||
var f = file[fi];
|
||||
this.debug(pattern, p, f);
|
||||
if (p === false) return false;
|
||||
if (p === GLOBSTAR) {
|
||||
this.debug("GLOBSTAR", [pattern, p, f]);
|
||||
var fr = fi;
|
||||
var pr = pi + 1;
|
||||
if (pr === pl) {
|
||||
this.debug("** at the end");
|
||||
for (; fi < fl; fi++) {
|
||||
if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".") return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
while (fr < fl) {
|
||||
var swallowee = file[fr];
|
||||
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
|
||||
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
||||
this.debug("globstar found match!", fr, fl, swallowee);
|
||||
return true;
|
||||
} else {
|
||||
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
|
||||
this.debug("dot detected!", file, fr, pattern, pr);
|
||||
break;
|
||||
}
|
||||
this.debug("globstar swallow a segment, and continue");
|
||||
fr++;
|
||||
}
|
||||
}
|
||||
if (partial) {
|
||||
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
|
||||
if (fr === fl) return true;
|
||||
}
|
||||
if (pattern.indexOf(GLOBSTAR) !== -1) {
|
||||
return this._matchGlobstar(file, pattern, partial, 0, 0);
|
||||
}
|
||||
return this._matchOne(file, pattern, partial, 0, 0);
|
||||
}
|
||||
_matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
|
||||
let firstgs = -1;
|
||||
for (let i = patternIndex; i < pattern.length; i++) {
|
||||
if (pattern[i] === GLOBSTAR) {
|
||||
firstgs = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
let lastgs = -1;
|
||||
for (let i = pattern.length - 1; i >= 0; i--) {
|
||||
if (pattern[i] === GLOBSTAR) {
|
||||
lastgs = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
const head = pattern.slice(patternIndex, firstgs);
|
||||
const body = partial ? pattern.slice(firstgs + 1) : pattern.slice(firstgs + 1, lastgs);
|
||||
const tail = partial ? [] : pattern.slice(lastgs + 1);
|
||||
if (head.length) {
|
||||
const fileHead = file.slice(fileIndex, fileIndex + head.length);
|
||||
if (!this._matchOne(fileHead, head, partial, 0, 0)) {
|
||||
return false;
|
||||
}
|
||||
var hit;
|
||||
fileIndex += head.length;
|
||||
}
|
||||
let fileTailMatch = 0;
|
||||
if (tail.length) {
|
||||
if (tail.length + fileIndex > file.length) return false;
|
||||
const tailStart = file.length - tail.length;
|
||||
if (this._matchOne(file, tail, partial, tailStart, 0)) {
|
||||
fileTailMatch = tail.length;
|
||||
} else {
|
||||
if (file[file.length - 1] !== "" || fileIndex + tail.length === file.length) {
|
||||
return false;
|
||||
}
|
||||
if (!this._matchOne(file, tail, partial, tailStart - 1, 0)) {
|
||||
return false;
|
||||
}
|
||||
fileTailMatch = tail.length + 1;
|
||||
}
|
||||
}
|
||||
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.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return partial || sawSome;
|
||||
}
|
||||
const bodySegments = [[[], 0]];
|
||||
let currentBody = bodySegments[0];
|
||||
let nonGsParts = 0;
|
||||
const nonGsPartsSums = [0];
|
||||
for (const b of body) {
|
||||
if (b === GLOBSTAR) {
|
||||
nonGsPartsSums.push(nonGsParts);
|
||||
currentBody = [[], 0];
|
||||
bodySegments.push(currentBody);
|
||||
} else {
|
||||
currentBody[0].push(b);
|
||||
nonGsParts++;
|
||||
}
|
||||
}
|
||||
let idx = bodySegments.length - 1;
|
||||
const fileLength = file.length - fileTailMatch;
|
||||
for (const b of bodySegments) {
|
||||
b[1] = fileLength - (nonGsPartsSums[idx--] + 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, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
|
||||
const bs = bodySegments[bodyIndex];
|
||||
if (!bs) {
|
||||
for (let i = fileIndex; i < file.length; i++) {
|
||||
sawTail = true;
|
||||
const f = file[i];
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return sawTail;
|
||||
}
|
||||
const [body, after] = bs;
|
||||
while (fileIndex <= after) {
|
||||
const m = this._matchOne(
|
||||
file.slice(0, fileIndex + body.length),
|
||||
body,
|
||||
partial,
|
||||
fileIndex,
|
||||
0
|
||||
);
|
||||
if (m && globStarDepth < this.maxGlobstarRecursion) {
|
||||
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.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
fileIndex++;
|
||||
}
|
||||
return partial || null;
|
||||
}
|
||||
_matchOne(file, pattern, partial, fileIndex, patternIndex) {
|
||||
let fi, pi, fl, pl;
|
||||
for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
||||
this.debug("matchOne loop");
|
||||
const p = pattern[pi];
|
||||
const f = file[fi];
|
||||
this.debug(pattern, p, f);
|
||||
if (p === false || p === GLOBSTAR) return false;
|
||||
let hit;
|
||||
if (typeof p === "string") {
|
||||
hit = f === p;
|
||||
this.debug("string match", p, f, hit);
|
||||
@@ -115424,12 +115618,60 @@ var require_unescape = __commonJS({
|
||||
var require_ast = __commonJS({
|
||||
"node_modules/glob/node_modules/minimatch/dist/commonjs/ast.js"(exports2) {
|
||||
"use strict";
|
||||
var _a;
|
||||
Object.defineProperty(exports2, "__esModule", { value: true });
|
||||
exports2.AST = void 0;
|
||||
var brace_expressions_js_1 = require_brace_expressions();
|
||||
var unescape_js_1 = require_unescape();
|
||||
var types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
|
||||
var isExtglobType = (c) => types.has(c);
|
||||
var isExtglobAST = (c) => isExtglobType(c.type);
|
||||
var adoptionMap = /* @__PURE__ */ new Map([
|
||||
["!", ["@"]],
|
||||
["?", ["?", "@"]],
|
||||
["@", ["@"]],
|
||||
["*", ["*", "+", "?", "@"]],
|
||||
["+", ["+", "@"]]
|
||||
]);
|
||||
var adoptionWithSpaceMap = /* @__PURE__ */ new Map([
|
||||
["!", ["?"]],
|
||||
["@", ["?"]],
|
||||
["+", ["?", "*"]]
|
||||
]);
|
||||
var adoptionAnyMap = /* @__PURE__ */ new Map([
|
||||
["!", ["?", "@"]],
|
||||
["?", ["?", "@"]],
|
||||
["@", ["?", "@"]],
|
||||
["*", ["*", "+", "?", "@"]],
|
||||
["+", ["+", "@", "?", "*"]]
|
||||
]);
|
||||
var usurpMap = /* @__PURE__ */ new Map([
|
||||
["!", /* @__PURE__ */ new Map([["!", "@"]])],
|
||||
[
|
||||
"?",
|
||||
/* @__PURE__ */ new Map([
|
||||
["*", "*"],
|
||||
["+", "*"]
|
||||
])
|
||||
],
|
||||
[
|
||||
"@",
|
||||
/* @__PURE__ */ new Map([
|
||||
["!", "!"],
|
||||
["?", "?"],
|
||||
["@", "@"],
|
||||
["*", "*"],
|
||||
["+", "+"]
|
||||
])
|
||||
],
|
||||
[
|
||||
"+",
|
||||
/* @__PURE__ */ new Map([
|
||||
["?", "*"],
|
||||
["*", "*"]
|
||||
])
|
||||
]
|
||||
]);
|
||||
var startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
|
||||
var startNoDot = "(?!\\.)";
|
||||
var addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
|
||||
@@ -115439,7 +115681,8 @@ var require_ast = __commonJS({
|
||||
var qmark = "[^/]";
|
||||
var star = qmark + "*?";
|
||||
var starNoEmpty = qmark + "+?";
|
||||
var AST = class _AST {
|
||||
var ID = 0;
|
||||
var AST = class {
|
||||
type;
|
||||
#root;
|
||||
#hasMagic;
|
||||
@@ -115454,6 +115697,22 @@ var require_ast = __commonJS({
|
||||
// set to true if it's an extglob with no children
|
||||
// (which really means one child of '')
|
||||
#emptyExt = false;
|
||||
id = ++ID;
|
||||
get depth() {
|
||||
return (this.#parent?.depth ?? -1) + 1;
|
||||
}
|
||||
[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")]() {
|
||||
return {
|
||||
"@@type": "AST",
|
||||
id: this.id,
|
||||
type: this.type,
|
||||
root: this.#root.id,
|
||||
parent: this.#parent?.id,
|
||||
depth: this.depth,
|
||||
partsLength: this.#parts.length,
|
||||
parts: this.#parts
|
||||
};
|
||||
}
|
||||
constructor(type2, parent, options = {}) {
|
||||
this.type = type2;
|
||||
if (type2)
|
||||
@@ -115519,7 +115778,7 @@ var require_ast = __commonJS({
|
||||
for (const p of parts) {
|
||||
if (p === "")
|
||||
continue;
|
||||
if (typeof p !== "string" && !(p instanceof _AST && p.#parent === this)) {
|
||||
if (typeof p !== "string" && !(p instanceof _a && p.#parent === this)) {
|
||||
throw new Error("invalid part: " + p);
|
||||
}
|
||||
this.#parts.push(p);
|
||||
@@ -115544,7 +115803,7 @@ var require_ast = __commonJS({
|
||||
const p = this.#parent;
|
||||
for (let i = 0; i < this.#parentIndex; i++) {
|
||||
const pp = p.#parts[i];
|
||||
if (!(pp instanceof _AST && pp.type === "!")) {
|
||||
if (!(pp instanceof _a && pp.type === "!")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -115569,13 +115828,14 @@ var require_ast = __commonJS({
|
||||
this.push(part.clone(this));
|
||||
}
|
||||
clone(parent) {
|
||||
const c = new _AST(this.type, parent);
|
||||
const c = new _a(this.type, parent);
|
||||
for (const p of this.#parts) {
|
||||
c.copyIn(p);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
static #parseAST(str2, ast, pos, opt) {
|
||||
static #parseAST(str2, ast, pos, opt, extDepth) {
|
||||
const maxDepth = opt.maxExtglobRecursion ?? 2;
|
||||
let escaping = false;
|
||||
let inBrace = false;
|
||||
let braceStart = -1;
|
||||
@@ -115607,11 +115867,12 @@ var require_ast = __commonJS({
|
||||
acc2 += c;
|
||||
continue;
|
||||
}
|
||||
if (!opt.noext && isExtglobType(c) && str2.charAt(i2) === "(") {
|
||||
const doRecurse = !opt.noext && isExtglobType(c) && str2.charAt(i2) === "(" && extDepth <= maxDepth;
|
||||
if (doRecurse) {
|
||||
ast.push(acc2);
|
||||
acc2 = "";
|
||||
const ext = new _AST(c, ast);
|
||||
i2 = _AST.#parseAST(str2, ext, i2, opt);
|
||||
const ext = new _a(c, ast);
|
||||
i2 = _a.#parseAST(str2, ext, i2, opt, extDepth + 1);
|
||||
ast.push(ext);
|
||||
continue;
|
||||
}
|
||||
@@ -115621,7 +115882,7 @@ var require_ast = __commonJS({
|
||||
return i2;
|
||||
}
|
||||
let i = pos + 1;
|
||||
let part = new _AST(null, ast);
|
||||
let part = new _a(null, ast);
|
||||
const parts = [];
|
||||
let acc = "";
|
||||
while (i < str2.length) {
|
||||
@@ -115648,19 +115909,22 @@ var require_ast = __commonJS({
|
||||
acc += c;
|
||||
continue;
|
||||
}
|
||||
if (isExtglobType(c) && str2.charAt(i) === "(") {
|
||||
const doRecurse = !opt.noext && isExtglobType(c) && str2.charAt(i) === "(" && /* c8 ignore start - the maxDepth is sufficient here */
|
||||
(extDepth <= maxDepth || ast && ast.#canAdoptType(c));
|
||||
if (doRecurse) {
|
||||
const depthAdd = ast && ast.#canAdoptType(c) ? 0 : 1;
|
||||
part.push(acc);
|
||||
acc = "";
|
||||
const ext = new _AST(c, part);
|
||||
const ext = new _a(c, part);
|
||||
part.push(ext);
|
||||
i = _AST.#parseAST(str2, ext, i, opt);
|
||||
i = _a.#parseAST(str2, ext, i, opt, extDepth + depthAdd);
|
||||
continue;
|
||||
}
|
||||
if (c === "|") {
|
||||
part.push(acc);
|
||||
acc = "";
|
||||
parts.push(part);
|
||||
part = new _AST(null, ast);
|
||||
part = new _a(null, ast);
|
||||
continue;
|
||||
}
|
||||
if (c === ")") {
|
||||
@@ -115679,9 +115943,71 @@ var require_ast = __commonJS({
|
||||
ast.#parts = [str2.substring(pos - 1)];
|
||||
return i;
|
||||
}
|
||||
#canAdoptWithSpace(child) {
|
||||
return this.#canAdopt(child, adoptionWithSpaceMap);
|
||||
}
|
||||
#canAdopt(child, map2 = adoptionMap) {
|
||||
if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null) {
|
||||
return false;
|
||||
}
|
||||
const gc = child.#parts[0];
|
||||
if (!gc || typeof gc !== "object" || gc.type === null) {
|
||||
return false;
|
||||
}
|
||||
return this.#canAdoptType(gc.type, map2);
|
||||
}
|
||||
#canAdoptType(c, map2 = adoptionAnyMap) {
|
||||
return !!map2.get(this.type)?.includes(c);
|
||||
}
|
||||
#adoptWithSpace(child, index) {
|
||||
const gc = child.#parts[0];
|
||||
const blank = new _a(null, gc, this.options);
|
||||
blank.#parts.push("");
|
||||
gc.push(blank);
|
||||
this.#adopt(child, index);
|
||||
}
|
||||
#adopt(child, index) {
|
||||
const gc = child.#parts[0];
|
||||
this.#parts.splice(index, 1, ...gc.#parts);
|
||||
for (const p of gc.#parts) {
|
||||
if (typeof p === "object")
|
||||
p.#parent = this;
|
||||
}
|
||||
this.#toString = void 0;
|
||||
}
|
||||
#canUsurpType(c) {
|
||||
const m = usurpMap.get(this.type);
|
||||
return !!m?.has(c);
|
||||
}
|
||||
#canUsurp(child) {
|
||||
if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null || this.#parts.length !== 1) {
|
||||
return false;
|
||||
}
|
||||
const gc = child.#parts[0];
|
||||
if (!gc || typeof gc !== "object" || gc.type === null) {
|
||||
return false;
|
||||
}
|
||||
return this.#canUsurpType(gc.type);
|
||||
}
|
||||
#usurp(child) {
|
||||
const m = usurpMap.get(this.type);
|
||||
const gc = child.#parts[0];
|
||||
const nt = m?.get(gc.type);
|
||||
if (!nt)
|
||||
return false;
|
||||
this.#parts = gc.#parts;
|
||||
for (const p of this.#parts) {
|
||||
if (typeof p === "object") {
|
||||
p.#parent = this;
|
||||
}
|
||||
}
|
||||
this.type = nt;
|
||||
this.#toString = void 0;
|
||||
this.#emptyExt = false;
|
||||
}
|
||||
static fromGlob(pattern, options = {}) {
|
||||
const ast = new _AST(null, void 0, options);
|
||||
_AST.#parseAST(pattern, ast, 0, options);
|
||||
const ast = new _a(null, void 0, options);
|
||||
_a.#parseAST(pattern, ast, 0, options, 0);
|
||||
return ast;
|
||||
}
|
||||
// returns the regular expression if there's magic, or the unescaped
|
||||
@@ -115775,12 +116101,14 @@ var require_ast = __commonJS({
|
||||
// or start or whatever) and prepend ^ or / at the Regexp construction.
|
||||
toRegExpSource(allowDot) {
|
||||
const dot = allowDot ?? !!this.#options.dot;
|
||||
if (this.#root === this)
|
||||
if (this.#root === this) {
|
||||
this.#flatten();
|
||||
this.#fillNegs();
|
||||
if (!this.type) {
|
||||
}
|
||||
if (!isExtglobAST(this)) {
|
||||
const noEmpty = this.isStart() && this.isEnd() && !this.#parts.some((s) => typeof s !== "string");
|
||||
const src = this.#parts.map((p) => {
|
||||
const [re, _2, hasMagic, uflag] = typeof p === "string" ? _AST.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
|
||||
const [re, _2, hasMagic, uflag] = typeof p === "string" ? _a.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
|
||||
this.#hasMagic = this.#hasMagic || hasMagic;
|
||||
this.#uflag = this.#uflag || uflag;
|
||||
return re;
|
||||
@@ -115819,9 +116147,10 @@ var require_ast = __commonJS({
|
||||
let body = this.#partsToRegExp(dot);
|
||||
if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
|
||||
const s = this.toString();
|
||||
this.#parts = [s];
|
||||
this.type = null;
|
||||
this.#hasMagic = void 0;
|
||||
const me = this;
|
||||
me.#parts = [s];
|
||||
me.type = null;
|
||||
me.#hasMagic = void 0;
|
||||
return [s, (0, unescape_js_1.unescape)(this.toString()), false, false];
|
||||
}
|
||||
let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ? "" : this.#partsToRegExp(true);
|
||||
@@ -115848,6 +116177,38 @@ var require_ast = __commonJS({
|
||||
this.#uflag
|
||||
];
|
||||
}
|
||||
#flatten() {
|
||||
if (!isExtglobAST(this)) {
|
||||
for (const p of this.#parts) {
|
||||
if (typeof p === "object") {
|
||||
p.#flatten();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let iterations = 0;
|
||||
let done = false;
|
||||
do {
|
||||
done = true;
|
||||
for (let i = 0; i < this.#parts.length; i++) {
|
||||
const c = this.#parts[i];
|
||||
if (typeof c === "object") {
|
||||
c.#flatten();
|
||||
if (this.#canAdopt(c)) {
|
||||
done = false;
|
||||
this.#adopt(c, i);
|
||||
} else if (this.#canAdoptWithSpace(c)) {
|
||||
done = false;
|
||||
this.#adoptWithSpace(c, i);
|
||||
} else if (this.#canUsurp(c)) {
|
||||
done = false;
|
||||
this.#usurp(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (!done && ++iterations < 10);
|
||||
}
|
||||
this.#toString = void 0;
|
||||
}
|
||||
#partsToRegExp(dot) {
|
||||
return this.#parts.map((p) => {
|
||||
if (typeof p === "string") {
|
||||
@@ -115909,6 +116270,7 @@ var require_ast = __commonJS({
|
||||
}
|
||||
};
|
||||
exports2.AST = AST;
|
||||
_a = AST;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -116093,11 +116455,13 @@ var require_commonjs20 = __commonJS({
|
||||
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";
|
||||
@@ -116434,7 +116798,8 @@ var require_commonjs20 = __commonJS({
|
||||
// out of pattern, then that's fine, as long as all
|
||||
// the parts match.
|
||||
matchOne(file, pattern, partial = false) {
|
||||
const options = this.options;
|
||||
let fileStartIndex = 0;
|
||||
let patternStartIndex = 0;
|
||||
if (this.isWindows) {
|
||||
const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
|
||||
const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
|
||||
@@ -116449,11 +116814,8 @@ var require_commonjs20 = __commonJS({
|
||||
];
|
||||
if (fd.toLowerCase() === pd.toLowerCase()) {
|
||||
pattern[pdi] = fd;
|
||||
if (pdi > fdi) {
|
||||
pattern = pattern.slice(pdi);
|
||||
} else if (fdi > pdi) {
|
||||
file = file.slice(fdi);
|
||||
}
|
||||
patternStartIndex = pdi;
|
||||
fileStartIndex = fdi;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -116461,49 +116823,123 @@ var require_commonjs20 = __commonJS({
|
||||
if (optimizationLevel >= 2) {
|
||||
file = this.levelTwoFileOptimize(file);
|
||||
}
|
||||
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");
|
||||
var p = pattern[pi];
|
||||
var f = file[fi];
|
||||
this.debug(pattern, p, f);
|
||||
if (p === false) {
|
||||
if (pattern.includes(exports2.GLOBSTAR)) {
|
||||
return this.#matchGlobstar(file, pattern, partial, fileStartIndex, patternStartIndex);
|
||||
}
|
||||
return this.#matchOne(file, pattern, partial, fileStartIndex, patternStartIndex);
|
||||
}
|
||||
#matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
|
||||
const firstgs = pattern.indexOf(exports2.GLOBSTAR, patternIndex);
|
||||
const lastgs = pattern.lastIndexOf(exports2.GLOBSTAR);
|
||||
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)
|
||||
];
|
||||
if (head.length) {
|
||||
const fileHead = file.slice(fileIndex, fileIndex + head.length);
|
||||
if (!this.#matchOne(fileHead, head, partial, 0, 0)) {
|
||||
return false;
|
||||
}
|
||||
if (p === exports2.GLOBSTAR) {
|
||||
this.debug("GLOBSTAR", [pattern, p, f]);
|
||||
var fr = fi;
|
||||
var pr = pi + 1;
|
||||
if (pr === pl) {
|
||||
this.debug("** at the end");
|
||||
for (; fi < fl; fi++) {
|
||||
if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
fileIndex += head.length;
|
||||
patternIndex += head.length;
|
||||
}
|
||||
let fileTailMatch = 0;
|
||||
if (tail.length) {
|
||||
if (tail.length + fileIndex > file.length)
|
||||
return false;
|
||||
let tailStart = file.length - tail.length;
|
||||
if (this.#matchOne(file, tail, partial, tailStart, 0)) {
|
||||
fileTailMatch = tail.length;
|
||||
} else {
|
||||
if (file[file.length - 1] !== "" || fileIndex + tail.length === file.length) {
|
||||
return false;
|
||||
}
|
||||
while (fr < fl) {
|
||||
var swallowee = file[fr];
|
||||
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
|
||||
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
||||
this.debug("globstar found match!", fr, fl, swallowee);
|
||||
return true;
|
||||
} else {
|
||||
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
|
||||
this.debug("dot detected!", file, fr, pattern, pr);
|
||||
break;
|
||||
}
|
||||
this.debug("globstar swallow a segment, and continue");
|
||||
fr++;
|
||||
}
|
||||
tailStart--;
|
||||
if (!this.#matchOne(file, tail, partial, tailStart, 0)) {
|
||||
return false;
|
||||
}
|
||||
if (partial) {
|
||||
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
|
||||
if (fr === fl) {
|
||||
return true;
|
||||
}
|
||||
fileTailMatch = tail.length + 1;
|
||||
}
|
||||
}
|
||||
if (!body.length) {
|
||||
let sawSome = !!fileTailMatch;
|
||||
for (let i2 = fileIndex; i2 < file.length - fileTailMatch; i2++) {
|
||||
const f = String(file[i2]);
|
||||
sawSome = true;
|
||||
if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return partial || sawSome;
|
||||
}
|
||||
const bodySegments = [[[], 0]];
|
||||
let currentBody = bodySegments[0];
|
||||
let nonGsParts = 0;
|
||||
const nonGsPartsSums = [0];
|
||||
for (const b of body) {
|
||||
if (b === exports2.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, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
|
||||
const bs = bodySegments[bodyIndex];
|
||||
if (!bs) {
|
||||
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;
|
||||
}
|
||||
const [body, after] = bs;
|
||||
while (fileIndex <= after) {
|
||||
const m = this.#matchOne(file.slice(0, fileIndex + body.length), body, partial, fileIndex, 0);
|
||||
if (m && globStarDepth < this.maxGlobstarRecursion) {
|
||||
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++;
|
||||
}
|
||||
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 loop");
|
||||
let p = pattern[pi];
|
||||
let f = file[fi];
|
||||
this.debug(pattern, p, f);
|
||||
if (p === false || p === exports2.GLOBSTAR) {
|
||||
return false;
|
||||
}
|
||||
let hit;
|
||||
|
||||
Generated
+137
-39
@@ -48064,6 +48064,7 @@ var require_minimatch = __commonJS({
|
||||
pattern = pattern.split(path5.sep).join("/");
|
||||
}
|
||||
this.options = options;
|
||||
this.maxGlobstarRecursion = options.maxGlobstarRecursion !== void 0 ? options.maxGlobstarRecursion : 200;
|
||||
this.set = [];
|
||||
this.pattern = pattern;
|
||||
this.regexp = null;
|
||||
@@ -48460,50 +48461,147 @@ var require_minimatch = __commonJS({
|
||||
return this.negate;
|
||||
};
|
||||
Minimatch.prototype.matchOne = function(file, pattern, partial) {
|
||||
var options = this.options;
|
||||
this.debug(
|
||||
"matchOne",
|
||||
{ "this": this, file, pattern }
|
||||
if (pattern.indexOf(GLOBSTAR) !== -1) {
|
||||
return this._matchGlobstar(file, pattern, partial, 0, 0);
|
||||
}
|
||||
return this._matchOne(file, pattern, partial, 0, 0);
|
||||
};
|
||||
Minimatch.prototype._matchGlobstar = function(file, pattern, partial, fileIndex, patternIndex) {
|
||||
var i;
|
||||
var firstgs = -1;
|
||||
for (i = patternIndex; i < pattern.length; i++) {
|
||||
if (pattern[i] === GLOBSTAR) {
|
||||
firstgs = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var lastgs = -1;
|
||||
for (i = pattern.length - 1; i >= 0; i--) {
|
||||
if (pattern[i] === GLOBSTAR) {
|
||||
lastgs = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var head = pattern.slice(patternIndex, firstgs);
|
||||
var body = partial ? pattern.slice(firstgs + 1) : pattern.slice(firstgs + 1, lastgs);
|
||||
var tail = partial ? [] : pattern.slice(lastgs + 1);
|
||||
if (head.length) {
|
||||
var fileHead = file.slice(fileIndex, fileIndex + head.length);
|
||||
if (!this._matchOne(fileHead, head, partial, 0, 0)) {
|
||||
return false;
|
||||
}
|
||||
fileIndex += head.length;
|
||||
}
|
||||
var fileTailMatch = 0;
|
||||
if (tail.length) {
|
||||
if (tail.length + fileIndex > file.length) return false;
|
||||
var tailStart = file.length - tail.length;
|
||||
if (this._matchOne(file, tail, partial, tailStart, 0)) {
|
||||
fileTailMatch = tail.length;
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
}
|
||||
if (!body.length) {
|
||||
var sawSome = !!fileTailMatch;
|
||||
for (i = fileIndex; i < file.length - fileTailMatch; i++) {
|
||||
var f = String(file[i]);
|
||||
sawSome = true;
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return partial || sawSome;
|
||||
}
|
||||
var bodySegments = [[[], 0]];
|
||||
var currentBody = bodySegments[0];
|
||||
var nonGsParts = 0;
|
||||
var nonGsPartsSums = [0];
|
||||
for (var bi = 0; bi < body.length; bi++) {
|
||||
var b = body[bi];
|
||||
if (b === GLOBSTAR) {
|
||||
nonGsPartsSums.push(nonGsParts);
|
||||
currentBody = [[], 0];
|
||||
bodySegments.push(currentBody);
|
||||
} else {
|
||||
currentBody[0].push(b);
|
||||
nonGsParts++;
|
||||
}
|
||||
}
|
||||
var idx = bodySegments.length - 1;
|
||||
var fileLength = file.length - fileTailMatch;
|
||||
for (var si = 0; si < bodySegments.length; si++) {
|
||||
bodySegments[si][1] = fileLength - (nonGsPartsSums[idx--] + bodySegments[si][0].length);
|
||||
}
|
||||
return !!this._matchGlobStarBodySections(
|
||||
file,
|
||||
bodySegments,
|
||||
fileIndex,
|
||||
0,
|
||||
partial,
|
||||
0,
|
||||
!!fileTailMatch
|
||||
);
|
||||
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++) {
|
||||
};
|
||||
Minimatch.prototype._matchGlobStarBodySections = function(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
|
||||
var bs = bodySegments[bodyIndex];
|
||||
if (!bs) {
|
||||
for (var i = fileIndex; i < file.length; i++) {
|
||||
sawTail = true;
|
||||
var f = file[i];
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return sawTail;
|
||||
}
|
||||
var body = bs[0];
|
||||
var after = bs[1];
|
||||
while (fileIndex <= after) {
|
||||
var m = this._matchOne(
|
||||
file.slice(0, fileIndex + body.length),
|
||||
body,
|
||||
partial,
|
||||
fileIndex,
|
||||
0
|
||||
);
|
||||
if (m && globStarDepth < this.maxGlobstarRecursion) {
|
||||
var sub = this._matchGlobStarBodySections(
|
||||
file,
|
||||
bodySegments,
|
||||
fileIndex + body.length,
|
||||
bodyIndex + 1,
|
||||
partial,
|
||||
globStarDepth + 1,
|
||||
sawTail
|
||||
);
|
||||
if (sub !== false) {
|
||||
return sub;
|
||||
}
|
||||
}
|
||||
var f = file[fileIndex];
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
fileIndex++;
|
||||
}
|
||||
return partial || null;
|
||||
};
|
||||
Minimatch.prototype._matchOne = function(file, pattern, partial, fileIndex, patternIndex) {
|
||||
var fi, pi, fl, pl;
|
||||
for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
||||
this.debug("matchOne loop");
|
||||
var p = pattern[pi];
|
||||
var f = file[fi];
|
||||
this.debug(pattern, p, f);
|
||||
if (p === false) return false;
|
||||
if (p === GLOBSTAR) {
|
||||
this.debug("GLOBSTAR", [pattern, p, f]);
|
||||
var fr = fi;
|
||||
var pr = pi + 1;
|
||||
if (pr === pl) {
|
||||
this.debug("** at the end");
|
||||
for (; fi < fl; fi++) {
|
||||
if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".") return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
while (fr < fl) {
|
||||
var swallowee = file[fr];
|
||||
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
|
||||
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
||||
this.debug("globstar found match!", fr, fl, swallowee);
|
||||
return true;
|
||||
} else {
|
||||
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
|
||||
this.debug("dot detected!", file, fr, pattern, pr);
|
||||
break;
|
||||
}
|
||||
this.debug("globstar swallow a segment, and continue");
|
||||
fr++;
|
||||
}
|
||||
}
|
||||
if (partial) {
|
||||
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
|
||||
if (fr === fl) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (p === false || p === GLOBSTAR) return false;
|
||||
var hit;
|
||||
if (typeof p === "string") {
|
||||
hit = f === p;
|
||||
|
||||
Generated
+137
-39
@@ -49361,6 +49361,7 @@ var require_minimatch = __commonJS({
|
||||
pattern = pattern.split(path12.sep).join("/");
|
||||
}
|
||||
this.options = options;
|
||||
this.maxGlobstarRecursion = options.maxGlobstarRecursion !== void 0 ? options.maxGlobstarRecursion : 200;
|
||||
this.set = [];
|
||||
this.pattern = pattern;
|
||||
this.regexp = null;
|
||||
@@ -49757,50 +49758,147 @@ var require_minimatch = __commonJS({
|
||||
return this.negate;
|
||||
};
|
||||
Minimatch.prototype.matchOne = function(file, pattern, partial) {
|
||||
var options = this.options;
|
||||
this.debug(
|
||||
"matchOne",
|
||||
{ "this": this, file, pattern }
|
||||
if (pattern.indexOf(GLOBSTAR) !== -1) {
|
||||
return this._matchGlobstar(file, pattern, partial, 0, 0);
|
||||
}
|
||||
return this._matchOne(file, pattern, partial, 0, 0);
|
||||
};
|
||||
Minimatch.prototype._matchGlobstar = function(file, pattern, partial, fileIndex, patternIndex) {
|
||||
var i;
|
||||
var firstgs = -1;
|
||||
for (i = patternIndex; i < pattern.length; i++) {
|
||||
if (pattern[i] === GLOBSTAR) {
|
||||
firstgs = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var lastgs = -1;
|
||||
for (i = pattern.length - 1; i >= 0; i--) {
|
||||
if (pattern[i] === GLOBSTAR) {
|
||||
lastgs = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var head = pattern.slice(patternIndex, firstgs);
|
||||
var body = partial ? pattern.slice(firstgs + 1) : pattern.slice(firstgs + 1, lastgs);
|
||||
var tail = partial ? [] : pattern.slice(lastgs + 1);
|
||||
if (head.length) {
|
||||
var fileHead = file.slice(fileIndex, fileIndex + head.length);
|
||||
if (!this._matchOne(fileHead, head, partial, 0, 0)) {
|
||||
return false;
|
||||
}
|
||||
fileIndex += head.length;
|
||||
}
|
||||
var fileTailMatch = 0;
|
||||
if (tail.length) {
|
||||
if (tail.length + fileIndex > file.length) return false;
|
||||
var tailStart = file.length - tail.length;
|
||||
if (this._matchOne(file, tail, partial, tailStart, 0)) {
|
||||
fileTailMatch = tail.length;
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
}
|
||||
if (!body.length) {
|
||||
var sawSome = !!fileTailMatch;
|
||||
for (i = fileIndex; i < file.length - fileTailMatch; i++) {
|
||||
var f = String(file[i]);
|
||||
sawSome = true;
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return partial || sawSome;
|
||||
}
|
||||
var bodySegments = [[[], 0]];
|
||||
var currentBody = bodySegments[0];
|
||||
var nonGsParts = 0;
|
||||
var nonGsPartsSums = [0];
|
||||
for (var bi = 0; bi < body.length; bi++) {
|
||||
var b = body[bi];
|
||||
if (b === GLOBSTAR) {
|
||||
nonGsPartsSums.push(nonGsParts);
|
||||
currentBody = [[], 0];
|
||||
bodySegments.push(currentBody);
|
||||
} else {
|
||||
currentBody[0].push(b);
|
||||
nonGsParts++;
|
||||
}
|
||||
}
|
||||
var idx = bodySegments.length - 1;
|
||||
var fileLength = file.length - fileTailMatch;
|
||||
for (var si = 0; si < bodySegments.length; si++) {
|
||||
bodySegments[si][1] = fileLength - (nonGsPartsSums[idx--] + bodySegments[si][0].length);
|
||||
}
|
||||
return !!this._matchGlobStarBodySections(
|
||||
file,
|
||||
bodySegments,
|
||||
fileIndex,
|
||||
0,
|
||||
partial,
|
||||
0,
|
||||
!!fileTailMatch
|
||||
);
|
||||
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++) {
|
||||
};
|
||||
Minimatch.prototype._matchGlobStarBodySections = function(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
|
||||
var bs = bodySegments[bodyIndex];
|
||||
if (!bs) {
|
||||
for (var i = fileIndex; i < file.length; i++) {
|
||||
sawTail = true;
|
||||
var f = file[i];
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return sawTail;
|
||||
}
|
||||
var body = bs[0];
|
||||
var after = bs[1];
|
||||
while (fileIndex <= after) {
|
||||
var m = this._matchOne(
|
||||
file.slice(0, fileIndex + body.length),
|
||||
body,
|
||||
partial,
|
||||
fileIndex,
|
||||
0
|
||||
);
|
||||
if (m && globStarDepth < this.maxGlobstarRecursion) {
|
||||
var sub = this._matchGlobStarBodySections(
|
||||
file,
|
||||
bodySegments,
|
||||
fileIndex + body.length,
|
||||
bodyIndex + 1,
|
||||
partial,
|
||||
globStarDepth + 1,
|
||||
sawTail
|
||||
);
|
||||
if (sub !== false) {
|
||||
return sub;
|
||||
}
|
||||
}
|
||||
var f = file[fileIndex];
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
fileIndex++;
|
||||
}
|
||||
return partial || null;
|
||||
};
|
||||
Minimatch.prototype._matchOne = function(file, pattern, partial, fileIndex, patternIndex) {
|
||||
var fi, pi, fl, pl;
|
||||
for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
||||
this.debug("matchOne loop");
|
||||
var p = pattern[pi];
|
||||
var f = file[fi];
|
||||
this.debug(pattern, p, f);
|
||||
if (p === false) return false;
|
||||
if (p === GLOBSTAR) {
|
||||
this.debug("GLOBSTAR", [pattern, p, f]);
|
||||
var fr = fi;
|
||||
var pr = pi + 1;
|
||||
if (pr === pl) {
|
||||
this.debug("** at the end");
|
||||
for (; fi < fl; fi++) {
|
||||
if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".") return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
while (fr < fl) {
|
||||
var swallowee = file[fr];
|
||||
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
|
||||
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
||||
this.debug("globstar found match!", fr, fl, swallowee);
|
||||
return true;
|
||||
} else {
|
||||
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
|
||||
this.debug("dot detected!", file, fr, pattern, pr);
|
||||
break;
|
||||
}
|
||||
this.debug("globstar swallow a segment, and continue");
|
||||
fr++;
|
||||
}
|
||||
}
|
||||
if (partial) {
|
||||
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
|
||||
if (fr === fl) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (p === false || p === GLOBSTAR) return false;
|
||||
var hit;
|
||||
if (typeof p === "string") {
|
||||
hit = f === p;
|
||||
|
||||
Generated
+583
-147
@@ -94285,6 +94285,7 @@ var require_minimatch = __commonJS({
|
||||
assertValidPattern(pattern);
|
||||
if (!options) options = {};
|
||||
this.options = options;
|
||||
this.maxGlobstarRecursion = options.maxGlobstarRecursion !== void 0 ? options.maxGlobstarRecursion : 200;
|
||||
this.set = [];
|
||||
this.pattern = pattern;
|
||||
this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
|
||||
@@ -94341,51 +94342,146 @@ var require_minimatch = __commonJS({
|
||||
// out of pattern, then that's fine, as long as all
|
||||
// the parts match.
|
||||
matchOne(file, pattern, partial) {
|
||||
var options = this.options;
|
||||
this.debug(
|
||||
"matchOne",
|
||||
{ "this": 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");
|
||||
var p = pattern[pi];
|
||||
var f = file[fi];
|
||||
this.debug(pattern, p, f);
|
||||
if (p === false) return false;
|
||||
if (p === GLOBSTAR) {
|
||||
this.debug("GLOBSTAR", [pattern, p, f]);
|
||||
var fr = fi;
|
||||
var pr = pi + 1;
|
||||
if (pr === pl) {
|
||||
this.debug("** at the end");
|
||||
for (; fi < fl; fi++) {
|
||||
if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".") return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
while (fr < fl) {
|
||||
var swallowee = file[fr];
|
||||
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
|
||||
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
||||
this.debug("globstar found match!", fr, fl, swallowee);
|
||||
return true;
|
||||
} else {
|
||||
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
|
||||
this.debug("dot detected!", file, fr, pattern, pr);
|
||||
break;
|
||||
}
|
||||
this.debug("globstar swallow a segment, and continue");
|
||||
fr++;
|
||||
}
|
||||
}
|
||||
if (partial) {
|
||||
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
|
||||
if (fr === fl) return true;
|
||||
}
|
||||
if (pattern.indexOf(GLOBSTAR) !== -1) {
|
||||
return this._matchGlobstar(file, pattern, partial, 0, 0);
|
||||
}
|
||||
return this._matchOne(file, pattern, partial, 0, 0);
|
||||
}
|
||||
_matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
|
||||
let firstgs = -1;
|
||||
for (let i = patternIndex; i < pattern.length; i++) {
|
||||
if (pattern[i] === GLOBSTAR) {
|
||||
firstgs = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
let lastgs = -1;
|
||||
for (let i = pattern.length - 1; i >= 0; i--) {
|
||||
if (pattern[i] === GLOBSTAR) {
|
||||
lastgs = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
const head = pattern.slice(patternIndex, firstgs);
|
||||
const body = partial ? pattern.slice(firstgs + 1) : pattern.slice(firstgs + 1, lastgs);
|
||||
const tail = partial ? [] : pattern.slice(lastgs + 1);
|
||||
if (head.length) {
|
||||
const fileHead = file.slice(fileIndex, fileIndex + head.length);
|
||||
if (!this._matchOne(fileHead, head, partial, 0, 0)) {
|
||||
return false;
|
||||
}
|
||||
var hit;
|
||||
fileIndex += head.length;
|
||||
}
|
||||
let fileTailMatch = 0;
|
||||
if (tail.length) {
|
||||
if (tail.length + fileIndex > file.length) return false;
|
||||
const tailStart = file.length - tail.length;
|
||||
if (this._matchOne(file, tail, partial, tailStart, 0)) {
|
||||
fileTailMatch = tail.length;
|
||||
} else {
|
||||
if (file[file.length - 1] !== "" || fileIndex + tail.length === file.length) {
|
||||
return false;
|
||||
}
|
||||
if (!this._matchOne(file, tail, partial, tailStart - 1, 0)) {
|
||||
return false;
|
||||
}
|
||||
fileTailMatch = tail.length + 1;
|
||||
}
|
||||
}
|
||||
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.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return partial || sawSome;
|
||||
}
|
||||
const bodySegments = [[[], 0]];
|
||||
let currentBody = bodySegments[0];
|
||||
let nonGsParts = 0;
|
||||
const nonGsPartsSums = [0];
|
||||
for (const b of body) {
|
||||
if (b === GLOBSTAR) {
|
||||
nonGsPartsSums.push(nonGsParts);
|
||||
currentBody = [[], 0];
|
||||
bodySegments.push(currentBody);
|
||||
} else {
|
||||
currentBody[0].push(b);
|
||||
nonGsParts++;
|
||||
}
|
||||
}
|
||||
let idx = bodySegments.length - 1;
|
||||
const fileLength = file.length - fileTailMatch;
|
||||
for (const b of bodySegments) {
|
||||
b[1] = fileLength - (nonGsPartsSums[idx--] + 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, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
|
||||
const bs = bodySegments[bodyIndex];
|
||||
if (!bs) {
|
||||
for (let i = fileIndex; i < file.length; i++) {
|
||||
sawTail = true;
|
||||
const f = file[i];
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return sawTail;
|
||||
}
|
||||
const [body, after] = bs;
|
||||
while (fileIndex <= after) {
|
||||
const m = this._matchOne(
|
||||
file.slice(0, fileIndex + body.length),
|
||||
body,
|
||||
partial,
|
||||
fileIndex,
|
||||
0
|
||||
);
|
||||
if (m && globStarDepth < this.maxGlobstarRecursion) {
|
||||
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.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
fileIndex++;
|
||||
}
|
||||
return partial || null;
|
||||
}
|
||||
_matchOne(file, pattern, partial, fileIndex, patternIndex) {
|
||||
let fi, pi, fl, pl;
|
||||
for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
||||
this.debug("matchOne loop");
|
||||
const p = pattern[pi];
|
||||
const f = file[fi];
|
||||
this.debug(pattern, p, f);
|
||||
if (p === false || p === GLOBSTAR) return false;
|
||||
let hit;
|
||||
if (typeof p === "string") {
|
||||
hit = f === p;
|
||||
this.debug("string match", p, f, hit);
|
||||
@@ -107706,12 +107802,60 @@ var require_unescape = __commonJS({
|
||||
var require_ast = __commonJS({
|
||||
"node_modules/glob/node_modules/minimatch/dist/commonjs/ast.js"(exports2) {
|
||||
"use strict";
|
||||
var _a;
|
||||
Object.defineProperty(exports2, "__esModule", { value: true });
|
||||
exports2.AST = void 0;
|
||||
var brace_expressions_js_1 = require_brace_expressions();
|
||||
var unescape_js_1 = require_unescape();
|
||||
var types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
|
||||
var isExtglobType = (c) => types.has(c);
|
||||
var isExtglobAST = (c) => isExtglobType(c.type);
|
||||
var adoptionMap = /* @__PURE__ */ new Map([
|
||||
["!", ["@"]],
|
||||
["?", ["?", "@"]],
|
||||
["@", ["@"]],
|
||||
["*", ["*", "+", "?", "@"]],
|
||||
["+", ["+", "@"]]
|
||||
]);
|
||||
var adoptionWithSpaceMap = /* @__PURE__ */ new Map([
|
||||
["!", ["?"]],
|
||||
["@", ["?"]],
|
||||
["+", ["?", "*"]]
|
||||
]);
|
||||
var adoptionAnyMap = /* @__PURE__ */ new Map([
|
||||
["!", ["?", "@"]],
|
||||
["?", ["?", "@"]],
|
||||
["@", ["?", "@"]],
|
||||
["*", ["*", "+", "?", "@"]],
|
||||
["+", ["+", "@", "?", "*"]]
|
||||
]);
|
||||
var usurpMap = /* @__PURE__ */ new Map([
|
||||
["!", /* @__PURE__ */ new Map([["!", "@"]])],
|
||||
[
|
||||
"?",
|
||||
/* @__PURE__ */ new Map([
|
||||
["*", "*"],
|
||||
["+", "*"]
|
||||
])
|
||||
],
|
||||
[
|
||||
"@",
|
||||
/* @__PURE__ */ new Map([
|
||||
["!", "!"],
|
||||
["?", "?"],
|
||||
["@", "@"],
|
||||
["*", "*"],
|
||||
["+", "+"]
|
||||
])
|
||||
],
|
||||
[
|
||||
"+",
|
||||
/* @__PURE__ */ new Map([
|
||||
["?", "*"],
|
||||
["*", "*"]
|
||||
])
|
||||
]
|
||||
]);
|
||||
var startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
|
||||
var startNoDot = "(?!\\.)";
|
||||
var addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
|
||||
@@ -107721,7 +107865,8 @@ var require_ast = __commonJS({
|
||||
var qmark = "[^/]";
|
||||
var star = qmark + "*?";
|
||||
var starNoEmpty = qmark + "+?";
|
||||
var AST = class _AST {
|
||||
var ID = 0;
|
||||
var AST = class {
|
||||
type;
|
||||
#root;
|
||||
#hasMagic;
|
||||
@@ -107736,6 +107881,22 @@ var require_ast = __commonJS({
|
||||
// set to true if it's an extglob with no children
|
||||
// (which really means one child of '')
|
||||
#emptyExt = false;
|
||||
id = ++ID;
|
||||
get depth() {
|
||||
return (this.#parent?.depth ?? -1) + 1;
|
||||
}
|
||||
[/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")]() {
|
||||
return {
|
||||
"@@type": "AST",
|
||||
id: this.id,
|
||||
type: this.type,
|
||||
root: this.#root.id,
|
||||
parent: this.#parent?.id,
|
||||
depth: this.depth,
|
||||
partsLength: this.#parts.length,
|
||||
parts: this.#parts
|
||||
};
|
||||
}
|
||||
constructor(type2, parent, options = {}) {
|
||||
this.type = type2;
|
||||
if (type2)
|
||||
@@ -107801,7 +107962,7 @@ var require_ast = __commonJS({
|
||||
for (const p of parts) {
|
||||
if (p === "")
|
||||
continue;
|
||||
if (typeof p !== "string" && !(p instanceof _AST && p.#parent === this)) {
|
||||
if (typeof p !== "string" && !(p instanceof _a && p.#parent === this)) {
|
||||
throw new Error("invalid part: " + p);
|
||||
}
|
||||
this.#parts.push(p);
|
||||
@@ -107826,7 +107987,7 @@ var require_ast = __commonJS({
|
||||
const p = this.#parent;
|
||||
for (let i = 0; i < this.#parentIndex; i++) {
|
||||
const pp = p.#parts[i];
|
||||
if (!(pp instanceof _AST && pp.type === "!")) {
|
||||
if (!(pp instanceof _a && pp.type === "!")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -107851,13 +108012,14 @@ var require_ast = __commonJS({
|
||||
this.push(part.clone(this));
|
||||
}
|
||||
clone(parent) {
|
||||
const c = new _AST(this.type, parent);
|
||||
const c = new _a(this.type, parent);
|
||||
for (const p of this.#parts) {
|
||||
c.copyIn(p);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
static #parseAST(str2, ast, pos, opt) {
|
||||
static #parseAST(str2, ast, pos, opt, extDepth) {
|
||||
const maxDepth = opt.maxExtglobRecursion ?? 2;
|
||||
let escaping = false;
|
||||
let inBrace = false;
|
||||
let braceStart = -1;
|
||||
@@ -107889,11 +108051,12 @@ var require_ast = __commonJS({
|
||||
acc2 += c;
|
||||
continue;
|
||||
}
|
||||
if (!opt.noext && isExtglobType(c) && str2.charAt(i2) === "(") {
|
||||
const doRecurse = !opt.noext && isExtglobType(c) && str2.charAt(i2) === "(" && extDepth <= maxDepth;
|
||||
if (doRecurse) {
|
||||
ast.push(acc2);
|
||||
acc2 = "";
|
||||
const ext = new _AST(c, ast);
|
||||
i2 = _AST.#parseAST(str2, ext, i2, opt);
|
||||
const ext = new _a(c, ast);
|
||||
i2 = _a.#parseAST(str2, ext, i2, opt, extDepth + 1);
|
||||
ast.push(ext);
|
||||
continue;
|
||||
}
|
||||
@@ -107903,7 +108066,7 @@ var require_ast = __commonJS({
|
||||
return i2;
|
||||
}
|
||||
let i = pos + 1;
|
||||
let part = new _AST(null, ast);
|
||||
let part = new _a(null, ast);
|
||||
const parts = [];
|
||||
let acc = "";
|
||||
while (i < str2.length) {
|
||||
@@ -107930,19 +108093,22 @@ var require_ast = __commonJS({
|
||||
acc += c;
|
||||
continue;
|
||||
}
|
||||
if (isExtglobType(c) && str2.charAt(i) === "(") {
|
||||
const doRecurse = !opt.noext && isExtglobType(c) && str2.charAt(i) === "(" && /* c8 ignore start - the maxDepth is sufficient here */
|
||||
(extDepth <= maxDepth || ast && ast.#canAdoptType(c));
|
||||
if (doRecurse) {
|
||||
const depthAdd = ast && ast.#canAdoptType(c) ? 0 : 1;
|
||||
part.push(acc);
|
||||
acc = "";
|
||||
const ext = new _AST(c, part);
|
||||
const ext = new _a(c, part);
|
||||
part.push(ext);
|
||||
i = _AST.#parseAST(str2, ext, i, opt);
|
||||
i = _a.#parseAST(str2, ext, i, opt, extDepth + depthAdd);
|
||||
continue;
|
||||
}
|
||||
if (c === "|") {
|
||||
part.push(acc);
|
||||
acc = "";
|
||||
parts.push(part);
|
||||
part = new _AST(null, ast);
|
||||
part = new _a(null, ast);
|
||||
continue;
|
||||
}
|
||||
if (c === ")") {
|
||||
@@ -107961,9 +108127,71 @@ var require_ast = __commonJS({
|
||||
ast.#parts = [str2.substring(pos - 1)];
|
||||
return i;
|
||||
}
|
||||
#canAdoptWithSpace(child) {
|
||||
return this.#canAdopt(child, adoptionWithSpaceMap);
|
||||
}
|
||||
#canAdopt(child, map2 = adoptionMap) {
|
||||
if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null) {
|
||||
return false;
|
||||
}
|
||||
const gc = child.#parts[0];
|
||||
if (!gc || typeof gc !== "object" || gc.type === null) {
|
||||
return false;
|
||||
}
|
||||
return this.#canAdoptType(gc.type, map2);
|
||||
}
|
||||
#canAdoptType(c, map2 = adoptionAnyMap) {
|
||||
return !!map2.get(this.type)?.includes(c);
|
||||
}
|
||||
#adoptWithSpace(child, index) {
|
||||
const gc = child.#parts[0];
|
||||
const blank = new _a(null, gc, this.options);
|
||||
blank.#parts.push("");
|
||||
gc.push(blank);
|
||||
this.#adopt(child, index);
|
||||
}
|
||||
#adopt(child, index) {
|
||||
const gc = child.#parts[0];
|
||||
this.#parts.splice(index, 1, ...gc.#parts);
|
||||
for (const p of gc.#parts) {
|
||||
if (typeof p === "object")
|
||||
p.#parent = this;
|
||||
}
|
||||
this.#toString = void 0;
|
||||
}
|
||||
#canUsurpType(c) {
|
||||
const m = usurpMap.get(this.type);
|
||||
return !!m?.has(c);
|
||||
}
|
||||
#canUsurp(child) {
|
||||
if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null || this.#parts.length !== 1) {
|
||||
return false;
|
||||
}
|
||||
const gc = child.#parts[0];
|
||||
if (!gc || typeof gc !== "object" || gc.type === null) {
|
||||
return false;
|
||||
}
|
||||
return this.#canUsurpType(gc.type);
|
||||
}
|
||||
#usurp(child) {
|
||||
const m = usurpMap.get(this.type);
|
||||
const gc = child.#parts[0];
|
||||
const nt = m?.get(gc.type);
|
||||
if (!nt)
|
||||
return false;
|
||||
this.#parts = gc.#parts;
|
||||
for (const p of this.#parts) {
|
||||
if (typeof p === "object") {
|
||||
p.#parent = this;
|
||||
}
|
||||
}
|
||||
this.type = nt;
|
||||
this.#toString = void 0;
|
||||
this.#emptyExt = false;
|
||||
}
|
||||
static fromGlob(pattern, options = {}) {
|
||||
const ast = new _AST(null, void 0, options);
|
||||
_AST.#parseAST(pattern, ast, 0, options);
|
||||
const ast = new _a(null, void 0, options);
|
||||
_a.#parseAST(pattern, ast, 0, options, 0);
|
||||
return ast;
|
||||
}
|
||||
// returns the regular expression if there's magic, or the unescaped
|
||||
@@ -108057,12 +108285,14 @@ var require_ast = __commonJS({
|
||||
// or start or whatever) and prepend ^ or / at the Regexp construction.
|
||||
toRegExpSource(allowDot) {
|
||||
const dot = allowDot ?? !!this.#options.dot;
|
||||
if (this.#root === this)
|
||||
if (this.#root === this) {
|
||||
this.#flatten();
|
||||
this.#fillNegs();
|
||||
if (!this.type) {
|
||||
}
|
||||
if (!isExtglobAST(this)) {
|
||||
const noEmpty = this.isStart() && this.isEnd() && !this.#parts.some((s) => typeof s !== "string");
|
||||
const src = this.#parts.map((p) => {
|
||||
const [re, _2, hasMagic, uflag] = typeof p === "string" ? _AST.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
|
||||
const [re, _2, hasMagic, uflag] = typeof p === "string" ? _a.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
|
||||
this.#hasMagic = this.#hasMagic || hasMagic;
|
||||
this.#uflag = this.#uflag || uflag;
|
||||
return re;
|
||||
@@ -108101,9 +108331,10 @@ var require_ast = __commonJS({
|
||||
let body = this.#partsToRegExp(dot);
|
||||
if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
|
||||
const s = this.toString();
|
||||
this.#parts = [s];
|
||||
this.type = null;
|
||||
this.#hasMagic = void 0;
|
||||
const me = this;
|
||||
me.#parts = [s];
|
||||
me.type = null;
|
||||
me.#hasMagic = void 0;
|
||||
return [s, (0, unescape_js_1.unescape)(this.toString()), false, false];
|
||||
}
|
||||
let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ? "" : this.#partsToRegExp(true);
|
||||
@@ -108130,6 +108361,38 @@ var require_ast = __commonJS({
|
||||
this.#uflag
|
||||
];
|
||||
}
|
||||
#flatten() {
|
||||
if (!isExtglobAST(this)) {
|
||||
for (const p of this.#parts) {
|
||||
if (typeof p === "object") {
|
||||
p.#flatten();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let iterations = 0;
|
||||
let done = false;
|
||||
do {
|
||||
done = true;
|
||||
for (let i = 0; i < this.#parts.length; i++) {
|
||||
const c = this.#parts[i];
|
||||
if (typeof c === "object") {
|
||||
c.#flatten();
|
||||
if (this.#canAdopt(c)) {
|
||||
done = false;
|
||||
this.#adopt(c, i);
|
||||
} else if (this.#canAdoptWithSpace(c)) {
|
||||
done = false;
|
||||
this.#adoptWithSpace(c, i);
|
||||
} else if (this.#canUsurp(c)) {
|
||||
done = false;
|
||||
this.#usurp(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (!done && ++iterations < 10);
|
||||
}
|
||||
this.#toString = void 0;
|
||||
}
|
||||
#partsToRegExp(dot) {
|
||||
return this.#parts.map((p) => {
|
||||
if (typeof p === "string") {
|
||||
@@ -108191,6 +108454,7 @@ var require_ast = __commonJS({
|
||||
}
|
||||
};
|
||||
exports2.AST = AST;
|
||||
_a = AST;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -108375,11 +108639,13 @@ var require_commonjs20 = __commonJS({
|
||||
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";
|
||||
@@ -108716,7 +108982,8 @@ var require_commonjs20 = __commonJS({
|
||||
// out of pattern, then that's fine, as long as all
|
||||
// the parts match.
|
||||
matchOne(file, pattern, partial = false) {
|
||||
const options = this.options;
|
||||
let fileStartIndex = 0;
|
||||
let patternStartIndex = 0;
|
||||
if (this.isWindows) {
|
||||
const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
|
||||
const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
|
||||
@@ -108731,11 +108998,8 @@ var require_commonjs20 = __commonJS({
|
||||
];
|
||||
if (fd.toLowerCase() === pd.toLowerCase()) {
|
||||
pattern[pdi] = fd;
|
||||
if (pdi > fdi) {
|
||||
pattern = pattern.slice(pdi);
|
||||
} else if (fdi > pdi) {
|
||||
file = file.slice(fdi);
|
||||
}
|
||||
patternStartIndex = pdi;
|
||||
fileStartIndex = fdi;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -108743,49 +109007,123 @@ var require_commonjs20 = __commonJS({
|
||||
if (optimizationLevel >= 2) {
|
||||
file = this.levelTwoFileOptimize(file);
|
||||
}
|
||||
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");
|
||||
var p = pattern[pi];
|
||||
var f = file[fi];
|
||||
this.debug(pattern, p, f);
|
||||
if (p === false) {
|
||||
if (pattern.includes(exports2.GLOBSTAR)) {
|
||||
return this.#matchGlobstar(file, pattern, partial, fileStartIndex, patternStartIndex);
|
||||
}
|
||||
return this.#matchOne(file, pattern, partial, fileStartIndex, patternStartIndex);
|
||||
}
|
||||
#matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
|
||||
const firstgs = pattern.indexOf(exports2.GLOBSTAR, patternIndex);
|
||||
const lastgs = pattern.lastIndexOf(exports2.GLOBSTAR);
|
||||
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)
|
||||
];
|
||||
if (head.length) {
|
||||
const fileHead = file.slice(fileIndex, fileIndex + head.length);
|
||||
if (!this.#matchOne(fileHead, head, partial, 0, 0)) {
|
||||
return false;
|
||||
}
|
||||
if (p === exports2.GLOBSTAR) {
|
||||
this.debug("GLOBSTAR", [pattern, p, f]);
|
||||
var fr = fi;
|
||||
var pr = pi + 1;
|
||||
if (pr === pl) {
|
||||
this.debug("** at the end");
|
||||
for (; fi < fl; fi++) {
|
||||
if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
fileIndex += head.length;
|
||||
patternIndex += head.length;
|
||||
}
|
||||
let fileTailMatch = 0;
|
||||
if (tail.length) {
|
||||
if (tail.length + fileIndex > file.length)
|
||||
return false;
|
||||
let tailStart = file.length - tail.length;
|
||||
if (this.#matchOne(file, tail, partial, tailStart, 0)) {
|
||||
fileTailMatch = tail.length;
|
||||
} else {
|
||||
if (file[file.length - 1] !== "" || fileIndex + tail.length === file.length) {
|
||||
return false;
|
||||
}
|
||||
while (fr < fl) {
|
||||
var swallowee = file[fr];
|
||||
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
|
||||
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
||||
this.debug("globstar found match!", fr, fl, swallowee);
|
||||
return true;
|
||||
} else {
|
||||
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
|
||||
this.debug("dot detected!", file, fr, pattern, pr);
|
||||
break;
|
||||
}
|
||||
this.debug("globstar swallow a segment, and continue");
|
||||
fr++;
|
||||
}
|
||||
tailStart--;
|
||||
if (!this.#matchOne(file, tail, partial, tailStart, 0)) {
|
||||
return false;
|
||||
}
|
||||
if (partial) {
|
||||
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
|
||||
if (fr === fl) {
|
||||
return true;
|
||||
}
|
||||
fileTailMatch = tail.length + 1;
|
||||
}
|
||||
}
|
||||
if (!body.length) {
|
||||
let sawSome = !!fileTailMatch;
|
||||
for (let i2 = fileIndex; i2 < file.length - fileTailMatch; i2++) {
|
||||
const f = String(file[i2]);
|
||||
sawSome = true;
|
||||
if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return partial || sawSome;
|
||||
}
|
||||
const bodySegments = [[[], 0]];
|
||||
let currentBody = bodySegments[0];
|
||||
let nonGsParts = 0;
|
||||
const nonGsPartsSums = [0];
|
||||
for (const b of body) {
|
||||
if (b === exports2.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, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
|
||||
const bs = bodySegments[bodyIndex];
|
||||
if (!bs) {
|
||||
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;
|
||||
}
|
||||
const [body, after] = bs;
|
||||
while (fileIndex <= after) {
|
||||
const m = this.#matchOne(file.slice(0, fileIndex + body.length), body, partial, fileIndex, 0);
|
||||
if (m && globStarDepth < this.maxGlobstarRecursion) {
|
||||
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++;
|
||||
}
|
||||
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 loop");
|
||||
let p = pattern[pi];
|
||||
let f = file[fi];
|
||||
this.debug(pattern, p, f);
|
||||
if (p === false || p === exports2.GLOBSTAR) {
|
||||
return false;
|
||||
}
|
||||
let hit;
|
||||
@@ -150788,6 +151126,7 @@ var require_minimatch2 = __commonJS({
|
||||
pattern = pattern.split(path3.sep).join("/");
|
||||
}
|
||||
this.options = options;
|
||||
this.maxGlobstarRecursion = options.maxGlobstarRecursion !== void 0 ? options.maxGlobstarRecursion : 200;
|
||||
this.set = [];
|
||||
this.pattern = pattern;
|
||||
this.regexp = null;
|
||||
@@ -151184,50 +151523,147 @@ var require_minimatch2 = __commonJS({
|
||||
return this.negate;
|
||||
};
|
||||
Minimatch.prototype.matchOne = function(file, pattern, partial) {
|
||||
var options = this.options;
|
||||
this.debug(
|
||||
"matchOne",
|
||||
{ "this": this, file, pattern }
|
||||
if (pattern.indexOf(GLOBSTAR) !== -1) {
|
||||
return this._matchGlobstar(file, pattern, partial, 0, 0);
|
||||
}
|
||||
return this._matchOne(file, pattern, partial, 0, 0);
|
||||
};
|
||||
Minimatch.prototype._matchGlobstar = function(file, pattern, partial, fileIndex, patternIndex) {
|
||||
var i;
|
||||
var firstgs = -1;
|
||||
for (i = patternIndex; i < pattern.length; i++) {
|
||||
if (pattern[i] === GLOBSTAR) {
|
||||
firstgs = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var lastgs = -1;
|
||||
for (i = pattern.length - 1; i >= 0; i--) {
|
||||
if (pattern[i] === GLOBSTAR) {
|
||||
lastgs = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var head = pattern.slice(patternIndex, firstgs);
|
||||
var body = partial ? pattern.slice(firstgs + 1) : pattern.slice(firstgs + 1, lastgs);
|
||||
var tail = partial ? [] : pattern.slice(lastgs + 1);
|
||||
if (head.length) {
|
||||
var fileHead = file.slice(fileIndex, fileIndex + head.length);
|
||||
if (!this._matchOne(fileHead, head, partial, 0, 0)) {
|
||||
return false;
|
||||
}
|
||||
fileIndex += head.length;
|
||||
}
|
||||
var fileTailMatch = 0;
|
||||
if (tail.length) {
|
||||
if (tail.length + fileIndex > file.length) return false;
|
||||
var tailStart = file.length - tail.length;
|
||||
if (this._matchOne(file, tail, partial, tailStart, 0)) {
|
||||
fileTailMatch = tail.length;
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
}
|
||||
if (!body.length) {
|
||||
var sawSome = !!fileTailMatch;
|
||||
for (i = fileIndex; i < file.length - fileTailMatch; i++) {
|
||||
var f = String(file[i]);
|
||||
sawSome = true;
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return partial || sawSome;
|
||||
}
|
||||
var bodySegments = [[[], 0]];
|
||||
var currentBody = bodySegments[0];
|
||||
var nonGsParts = 0;
|
||||
var nonGsPartsSums = [0];
|
||||
for (var bi = 0; bi < body.length; bi++) {
|
||||
var b = body[bi];
|
||||
if (b === GLOBSTAR) {
|
||||
nonGsPartsSums.push(nonGsParts);
|
||||
currentBody = [[], 0];
|
||||
bodySegments.push(currentBody);
|
||||
} else {
|
||||
currentBody[0].push(b);
|
||||
nonGsParts++;
|
||||
}
|
||||
}
|
||||
var idx = bodySegments.length - 1;
|
||||
var fileLength = file.length - fileTailMatch;
|
||||
for (var si = 0; si < bodySegments.length; si++) {
|
||||
bodySegments[si][1] = fileLength - (nonGsPartsSums[idx--] + bodySegments[si][0].length);
|
||||
}
|
||||
return !!this._matchGlobStarBodySections(
|
||||
file,
|
||||
bodySegments,
|
||||
fileIndex,
|
||||
0,
|
||||
partial,
|
||||
0,
|
||||
!!fileTailMatch
|
||||
);
|
||||
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++) {
|
||||
};
|
||||
Minimatch.prototype._matchGlobStarBodySections = function(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
|
||||
var bs = bodySegments[bodyIndex];
|
||||
if (!bs) {
|
||||
for (var i = fileIndex; i < file.length; i++) {
|
||||
sawTail = true;
|
||||
var f = file[i];
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return sawTail;
|
||||
}
|
||||
var body = bs[0];
|
||||
var after = bs[1];
|
||||
while (fileIndex <= after) {
|
||||
var m = this._matchOne(
|
||||
file.slice(0, fileIndex + body.length),
|
||||
body,
|
||||
partial,
|
||||
fileIndex,
|
||||
0
|
||||
);
|
||||
if (m && globStarDepth < this.maxGlobstarRecursion) {
|
||||
var sub = this._matchGlobStarBodySections(
|
||||
file,
|
||||
bodySegments,
|
||||
fileIndex + body.length,
|
||||
bodyIndex + 1,
|
||||
partial,
|
||||
globStarDepth + 1,
|
||||
sawTail
|
||||
);
|
||||
if (sub !== false) {
|
||||
return sub;
|
||||
}
|
||||
}
|
||||
var f = file[fileIndex];
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
fileIndex++;
|
||||
}
|
||||
return partial || null;
|
||||
};
|
||||
Minimatch.prototype._matchOne = function(file, pattern, partial, fileIndex, patternIndex) {
|
||||
var fi, pi, fl, pl;
|
||||
for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
||||
this.debug("matchOne loop");
|
||||
var p = pattern[pi];
|
||||
var f = file[fi];
|
||||
this.debug(pattern, p, f);
|
||||
if (p === false) return false;
|
||||
if (p === GLOBSTAR) {
|
||||
this.debug("GLOBSTAR", [pattern, p, f]);
|
||||
var fr = fi;
|
||||
var pr = pi + 1;
|
||||
if (pr === pl) {
|
||||
this.debug("** at the end");
|
||||
for (; fi < fl; fi++) {
|
||||
if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".") return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
while (fr < fl) {
|
||||
var swallowee = file[fr];
|
||||
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
|
||||
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
||||
this.debug("globstar found match!", fr, fl, swallowee);
|
||||
return true;
|
||||
} else {
|
||||
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
|
||||
this.debug("dot detected!", file, fr, pattern, pr);
|
||||
break;
|
||||
}
|
||||
this.debug("globstar swallow a segment, and continue");
|
||||
fr++;
|
||||
}
|
||||
}
|
||||
if (partial) {
|
||||
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
|
||||
if (fr === fl) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (p === false || p === GLOBSTAR) return false;
|
||||
var hit;
|
||||
if (typeof p === "string") {
|
||||
hit = f === p;
|
||||
|
||||
Generated
+137
-39
@@ -48064,6 +48064,7 @@ var require_minimatch = __commonJS({
|
||||
pattern = pattern.split(path13.sep).join("/");
|
||||
}
|
||||
this.options = options;
|
||||
this.maxGlobstarRecursion = options.maxGlobstarRecursion !== void 0 ? options.maxGlobstarRecursion : 200;
|
||||
this.set = [];
|
||||
this.pattern = pattern;
|
||||
this.regexp = null;
|
||||
@@ -48460,50 +48461,147 @@ var require_minimatch = __commonJS({
|
||||
return this.negate;
|
||||
};
|
||||
Minimatch.prototype.matchOne = function(file, pattern, partial) {
|
||||
var options = this.options;
|
||||
this.debug(
|
||||
"matchOne",
|
||||
{ "this": this, file, pattern }
|
||||
if (pattern.indexOf(GLOBSTAR) !== -1) {
|
||||
return this._matchGlobstar(file, pattern, partial, 0, 0);
|
||||
}
|
||||
return this._matchOne(file, pattern, partial, 0, 0);
|
||||
};
|
||||
Minimatch.prototype._matchGlobstar = function(file, pattern, partial, fileIndex, patternIndex) {
|
||||
var i;
|
||||
var firstgs = -1;
|
||||
for (i = patternIndex; i < pattern.length; i++) {
|
||||
if (pattern[i] === GLOBSTAR) {
|
||||
firstgs = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var lastgs = -1;
|
||||
for (i = pattern.length - 1; i >= 0; i--) {
|
||||
if (pattern[i] === GLOBSTAR) {
|
||||
lastgs = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var head = pattern.slice(patternIndex, firstgs);
|
||||
var body = partial ? pattern.slice(firstgs + 1) : pattern.slice(firstgs + 1, lastgs);
|
||||
var tail = partial ? [] : pattern.slice(lastgs + 1);
|
||||
if (head.length) {
|
||||
var fileHead = file.slice(fileIndex, fileIndex + head.length);
|
||||
if (!this._matchOne(fileHead, head, partial, 0, 0)) {
|
||||
return false;
|
||||
}
|
||||
fileIndex += head.length;
|
||||
}
|
||||
var fileTailMatch = 0;
|
||||
if (tail.length) {
|
||||
if (tail.length + fileIndex > file.length) return false;
|
||||
var tailStart = file.length - tail.length;
|
||||
if (this._matchOne(file, tail, partial, tailStart, 0)) {
|
||||
fileTailMatch = tail.length;
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
}
|
||||
if (!body.length) {
|
||||
var sawSome = !!fileTailMatch;
|
||||
for (i = fileIndex; i < file.length - fileTailMatch; i++) {
|
||||
var f = String(file[i]);
|
||||
sawSome = true;
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return partial || sawSome;
|
||||
}
|
||||
var bodySegments = [[[], 0]];
|
||||
var currentBody = bodySegments[0];
|
||||
var nonGsParts = 0;
|
||||
var nonGsPartsSums = [0];
|
||||
for (var bi = 0; bi < body.length; bi++) {
|
||||
var b = body[bi];
|
||||
if (b === GLOBSTAR) {
|
||||
nonGsPartsSums.push(nonGsParts);
|
||||
currentBody = [[], 0];
|
||||
bodySegments.push(currentBody);
|
||||
} else {
|
||||
currentBody[0].push(b);
|
||||
nonGsParts++;
|
||||
}
|
||||
}
|
||||
var idx = bodySegments.length - 1;
|
||||
var fileLength = file.length - fileTailMatch;
|
||||
for (var si = 0; si < bodySegments.length; si++) {
|
||||
bodySegments[si][1] = fileLength - (nonGsPartsSums[idx--] + bodySegments[si][0].length);
|
||||
}
|
||||
return !!this._matchGlobStarBodySections(
|
||||
file,
|
||||
bodySegments,
|
||||
fileIndex,
|
||||
0,
|
||||
partial,
|
||||
0,
|
||||
!!fileTailMatch
|
||||
);
|
||||
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++) {
|
||||
};
|
||||
Minimatch.prototype._matchGlobStarBodySections = function(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
|
||||
var bs = bodySegments[bodyIndex];
|
||||
if (!bs) {
|
||||
for (var i = fileIndex; i < file.length; i++) {
|
||||
sawTail = true;
|
||||
var f = file[i];
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return sawTail;
|
||||
}
|
||||
var body = bs[0];
|
||||
var after = bs[1];
|
||||
while (fileIndex <= after) {
|
||||
var m = this._matchOne(
|
||||
file.slice(0, fileIndex + body.length),
|
||||
body,
|
||||
partial,
|
||||
fileIndex,
|
||||
0
|
||||
);
|
||||
if (m && globStarDepth < this.maxGlobstarRecursion) {
|
||||
var sub = this._matchGlobStarBodySections(
|
||||
file,
|
||||
bodySegments,
|
||||
fileIndex + body.length,
|
||||
bodyIndex + 1,
|
||||
partial,
|
||||
globStarDepth + 1,
|
||||
sawTail
|
||||
);
|
||||
if (sub !== false) {
|
||||
return sub;
|
||||
}
|
||||
}
|
||||
var f = file[fileIndex];
|
||||
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") {
|
||||
return false;
|
||||
}
|
||||
fileIndex++;
|
||||
}
|
||||
return partial || null;
|
||||
};
|
||||
Minimatch.prototype._matchOne = function(file, pattern, partial, fileIndex, patternIndex) {
|
||||
var fi, pi, fl, pl;
|
||||
for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
||||
this.debug("matchOne loop");
|
||||
var p = pattern[pi];
|
||||
var f = file[fi];
|
||||
this.debug(pattern, p, f);
|
||||
if (p === false) return false;
|
||||
if (p === GLOBSTAR) {
|
||||
this.debug("GLOBSTAR", [pattern, p, f]);
|
||||
var fr = fi;
|
||||
var pr = pi + 1;
|
||||
if (pr === pl) {
|
||||
this.debug("** at the end");
|
||||
for (; fi < fl; fi++) {
|
||||
if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".") return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
while (fr < fl) {
|
||||
var swallowee = file[fr];
|
||||
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
|
||||
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
||||
this.debug("globstar found match!", fr, fl, swallowee);
|
||||
return true;
|
||||
} else {
|
||||
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
|
||||
this.debug("dot detected!", file, fr, pattern, pr);
|
||||
break;
|
||||
}
|
||||
this.debug("globstar swallow a segment, and continue");
|
||||
fr++;
|
||||
}
|
||||
}
|
||||
if (partial) {
|
||||
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
|
||||
if (fr === fl) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (p === false || p === GLOBSTAR) return false;
|
||||
var hit;
|
||||
if (typeof p === "string") {
|
||||
hit = f === p;
|
||||
|
||||
Reference in New Issue
Block a user