Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: update minimatch to 9.0.2 #48542

Merged
merged 1 commit into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 31 additions & 17 deletions deps/minimatch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ var require_ast = __commonJS({
var unescape_js_12 = require_unescape();
var types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
var isExtglobType = (c) => types.has(c);
var startNoTraversal = "(?!\\.\\.?(?:$|/))";
var startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
var startNoDot = "(?!\\.)";
var addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
var justDots = /* @__PURE__ */ new Set(["..", "."]);
Expand All @@ -412,10 +412,11 @@ var require_ast = __commonJS({
var qmark2 = "[^/]";
var star2 = qmark2 + "*?";
var starNoEmpty = qmark2 + "+?";
var _root, _hasMagic, _uflag, _parts, _parent, _parentIndex, _negs, _filledNegs, _options, _toString, _emptyExt, _fillNegs, fillNegs_fn, _parseAST, parseAST_fn, _parseGlob, parseGlob_fn;
var _root, _hasMagic, _uflag, _parts, _parent, _parentIndex, _negs, _filledNegs, _options, _toString, _emptyExt, _fillNegs, fillNegs_fn, _parseAST, parseAST_fn, _partsToRegExp, partsToRegExp_fn, _parseGlob, parseGlob_fn;
var _AST = class {
constructor(type, parent, options = {}) {
__privateAdd(this, _fillNegs);
__privateAdd(this, _partsToRegExp);
__publicField(this, "type");
__privateAdd(this, _root, void 0);
__privateAdd(this, _hasMagic, void 0);
Expand Down Expand Up @@ -614,14 +615,15 @@ var require_ast = __commonJS({
// - Since the start for a join is eg /(?!\.) and the start for a part
// is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
// or start or whatever) and prepend ^ or / at the Regexp construction.
toRegExpSource() {
toRegExpSource(allowDot) {
const dot = allowDot ?? !!__privateGet(this, _options).dot;
if (__privateGet(this, _root) === this)
__privateMethod(this, _fillNegs, fillNegs_fn).call(this);
if (!this.type) {
const noEmpty = this.isStart() && this.isEnd();
const src = __privateGet(this, _parts).map((p) => {
var _a;
const [re, _, hasMagic, uflag] = typeof p === "string" ? __privateMethod(_a = _AST, _parseGlob, parseGlob_fn).call(_a, p, __privateGet(this, _hasMagic), noEmpty) : p.toRegExpSource();
const [re, _, hasMagic, uflag] = typeof p === "string" ? __privateMethod(_a = _AST, _parseGlob, parseGlob_fn).call(_a, p, __privateGet(this, _hasMagic), noEmpty) : p.toRegExpSource(allowDot);
__privateSet(this, _hasMagic, __privateGet(this, _hasMagic) || hasMagic);
__privateSet(this, _uflag, __privateGet(this, _uflag) || uflag);
return re;
Expand All @@ -634,11 +636,11 @@ var require_ast = __commonJS({
const aps = addPatternStart;
const needNoTrav = (
// dots are allowed, and the pattern starts with [ or .
__privateGet(this, _options).dot && aps.has(src.charAt(0)) || // the pattern starts with \., and then [ or .
dot && aps.has(src.charAt(0)) || // the pattern starts with \., and then [ or .
src.startsWith("\\.") && aps.has(src.charAt(2)) || // the pattern starts with \.\., and then [ or .
src.startsWith("\\.\\.") && aps.has(src.charAt(4))
);
const needNoDot = !__privateGet(this, _options).dot && aps.has(src.charAt(0));
const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
start2 = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : "";
}
}
Expand All @@ -655,30 +657,31 @@ var require_ast = __commonJS({
__privateGet(this, _uflag)
];
}
const repeated = this.type === "*" || this.type === "+";
const start = this.type === "!" ? "(?:(?!(?:" : "(?:";
const body = __privateGet(this, _parts).map((p) => {
if (typeof p === "string") {
throw new Error("string type in extglob ast??");
}
const [re, _, _hasMagic2, uflag] = p.toRegExpSource();
__privateSet(this, _uflag, __privateGet(this, _uflag) || uflag);
return re;
}).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
let body = __privateMethod(this, _partsToRegExp, partsToRegExp_fn).call(this, dot);
if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
const s = this.toString();
__privateSet(this, _parts, [s]);
this.type = null;
__privateSet(this, _hasMagic, void 0);
return [s, (0, unescape_js_12.unescape)(this.toString()), false, false];
}
let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ? "" : __privateMethod(this, _partsToRegExp, partsToRegExp_fn).call(this, true);
if (bodyDotAllowed === body) {
bodyDotAllowed = "";
}
if (bodyDotAllowed) {
body = `(?:${body})(?:${bodyDotAllowed})*?`;
}
let final = "";
if (this.type === "!" && __privateGet(this, _emptyExt)) {
final = (this.isStart() && !__privateGet(this, _options).dot ? startNoDot : "") + starNoEmpty;
final = (this.isStart() && !dot ? startNoDot : "") + starNoEmpty;
} else {
const close = this.type === "!" ? (
// !() must match something,but !(x) can match ''
"))" + (this.isStart() && !__privateGet(this, _options).dot ? startNoDot : "") + star2 + ")"
) : this.type === "@" ? ")" : `)${this.type}`;
"))" + (this.isStart() && !dot && !allowDot ? startNoDot : "") + star2 + ")"
) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`;
final = start + body + close;
}
return [
Expand Down Expand Up @@ -836,6 +839,17 @@ var require_ast = __commonJS({
__privateSet(ast, _parts, [str.substring(pos - 1)]);
return i;
};
_partsToRegExp = new WeakSet();
partsToRegExp_fn = function(dot) {
return __privateGet(this, _parts).map((p) => {
if (typeof p === "string") {
throw new Error("string type in extglob ast??");
}
const [re, _, _hasMagic2, uflag] = p.toRegExpSource(dot);
__privateSet(this, _uflag, __privateGet(this, _uflag) || uflag);
return re;
}).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
};
_parseGlob = new WeakSet();
parseGlob_fn = function(glob, hasMagic, noEmpty = false) {
let escaping = false;
Expand Down
7 changes: 1 addition & 6 deletions deps/minimatch/src/dist/cjs/ast.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ export declare class AST {
clone(parent: AST): AST;
static fromGlob(pattern: string, options?: MinimatchOptions): AST;
toMMPattern(): MMRegExp | string;
toRegExpSource(): [
re: string,
body: string,
hasMagic: boolean,
uflag: boolean
];
toRegExpSource(allowDot?: boolean): [re: string, body: string, hasMagic: boolean, uflag: boolean];
}
//# sourceMappingURL=ast.d.ts.map
2 changes: 1 addition & 1 deletion deps/minimatch/src/dist/cjs/ast.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

71 changes: 47 additions & 24 deletions deps/minimatch/src/dist/cjs/ast.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion deps/minimatch/src/dist/cjs/ast.js.map

Large diffs are not rendered by default.

7 changes: 1 addition & 6 deletions deps/minimatch/src/dist/mjs/ast.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ export declare class AST {
clone(parent: AST): AST;
static fromGlob(pattern: string, options?: MinimatchOptions): AST;
toMMPattern(): MMRegExp | string;
toRegExpSource(): [
re: string,
body: string,
hasMagic: boolean,
uflag: boolean
];
toRegExpSource(allowDot?: boolean): [re: string, body: string, hasMagic: boolean, uflag: boolean];
}
//# sourceMappingURL=ast.d.ts.map
2 changes: 1 addition & 1 deletion deps/minimatch/src/dist/mjs/ast.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading