Skip to content

Commit f43d718

Browse files
nodejs-github-botRafaelGSS
authored andcommitted
deps: update minimatch to 9.0.2
PR-URL: #48542 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
1 parent 2f66147 commit f43d718

File tree

11 files changed

+135
-85
lines changed

11 files changed

+135
-85
lines changed

‎deps/minimatch/index.js‎

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ var require_ast = __commonJS({
403403
varunescape_js_12=require_unescape();
404404
vartypes=/* @__PURE__ */newSet(["!","?","+","*","@"]);
405405
varisExtglobType=(c)=>types.has(c);
406-
varstartNoTraversal="(?!\\.\\.?(?:$|/))";
406+
varstartNoTraversal="(?!(?:^|/)\\.\\.?(?:$|/))";
407407
varstartNoDot="(?!\\.)";
408408
varaddPatternStart=/* @__PURE__ */newSet(["[","."]);
409409
varjustDots=/* @__PURE__ */newSet(["..","."]);
@@ -412,10 +412,11 @@ var require_ast = __commonJS({
412412
varqmark2="[^/]";
413413
varstar2=qmark2+"*?";
414414
varstarNoEmpty=qmark2+"+?";
415-
var_root,_hasMagic,_uflag,_parts,_parent,_parentIndex,_negs,_filledNegs,_options,_toString,_emptyExt,_fillNegs,fillNegs_fn,_parseAST,parseAST_fn,_parseGlob,parseGlob_fn;
415+
var_root,_hasMagic,_uflag,_parts,_parent,_parentIndex,_negs,_filledNegs,_options,_toString,_emptyExt,_fillNegs,fillNegs_fn,_parseAST,parseAST_fn,_partsToRegExp,partsToRegExp_fn,_parseGlob,parseGlob_fn;
416416
var_AST=class{
417417
constructor(type,parent,options={}){
418418
__privateAdd(this,_fillNegs);
419+
__privateAdd(this,_partsToRegExp);
419420
__publicField(this,"type");
420421
__privateAdd(this,_root,void0);
421422
__privateAdd(this,_hasMagic,void0);
@@ -614,14 +615,15 @@ var require_ast = __commonJS({
614615
// - Since the start for a join is eg /(?!\.) and the start for a part
615616
// is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
616617
// or start or whatever) and prepend ^ or / at the Regexp construction.
617-
toRegExpSource(){
618+
toRegExpSource(allowDot){
619+
constdot=allowDot??!!__privateGet(this,_options).dot;
618620
if(__privateGet(this,_root)===this)
619621
__privateMethod(this,_fillNegs,fillNegs_fn).call(this);
620622
if(!this.type){
621623
constnoEmpty=this.isStart()&&this.isEnd();
622624
constsrc=__privateGet(this,_parts).map((p)=>{
623625
var_a;
624-
const[re,_,hasMagic,uflag]=typeofp==="string" ? __privateMethod(_a=_AST,_parseGlob,parseGlob_fn).call(_a,p,__privateGet(this,_hasMagic),noEmpty) : p.toRegExpSource();
626+
const[re,_,hasMagic,uflag]=typeofp==="string" ? __privateMethod(_a=_AST,_parseGlob,parseGlob_fn).call(_a,p,__privateGet(this,_hasMagic),noEmpty) : p.toRegExpSource(allowDot);
625627
__privateSet(this,_hasMagic,__privateGet(this,_hasMagic)||hasMagic);
626628
__privateSet(this,_uflag,__privateGet(this,_uflag)||uflag);
627629
returnre;
@@ -634,11 +636,11 @@ var require_ast = __commonJS({
634636
constaps=addPatternStart;
635637
constneedNoTrav=(
636638
// dots are allowed, and the pattern starts with [ or .
637-
__privateGet(this,_options).dot&&aps.has(src.charAt(0))||// the pattern starts with \., and then [ or .
639+
dot&&aps.has(src.charAt(0))||// the pattern starts with \., and then [ or .
638640
src.startsWith("\\.")&&aps.has(src.charAt(2))||// the pattern starts with \.\., and then [ or .
639641
src.startsWith("\\.\\.")&&aps.has(src.charAt(4))
640642
);
641-
constneedNoDot=!__privateGet(this,_options).dot&&aps.has(src.charAt(0));
643+
constneedNoDot=!dot&&!allowDot&&aps.has(src.charAt(0));
642644
start2=needNoTrav ? startNoTraversal : needNoDot ? startNoDot : "";
643645
}
644646
}
@@ -655,30 +657,31 @@ var require_ast = __commonJS({
655657
__privateGet(this,_uflag)
656658
];
657659
}
660+
constrepeated=this.type==="*"||this.type==="+";
658661
conststart=this.type==="!" ? "(?:(?!(?:" : "(?:";
659-
constbody=__privateGet(this,_parts).map((p)=>{
660-
if(typeofp==="string"){
661-
thrownewError("string type in extglob ast??");
662-
}
663-
const[re,_,_hasMagic2,uflag]=p.toRegExpSource();
664-
__privateSet(this,_uflag,__privateGet(this,_uflag)||uflag);
665-
returnre;
666-
}).filter((p)=>!(this.isStart()&&this.isEnd())||!!p).join("|");
662+
letbody=__privateMethod(this,_partsToRegExp,partsToRegExp_fn).call(this,dot);
667663
if(this.isStart()&&this.isEnd()&&!body&&this.type!=="!"){
668664
consts=this.toString();
669665
__privateSet(this,_parts,[s]);
670666
this.type=null;
671667
__privateSet(this,_hasMagic,void0);
672668
return[s,(0,unescape_js_12.unescape)(this.toString()),false,false];
673669
}
670+
letbodyDotAllowed=!repeated||allowDot||dot||!startNoDot ? "" : __privateMethod(this,_partsToRegExp,partsToRegExp_fn).call(this,true);
671+
if(bodyDotAllowed===body){
672+
bodyDotAllowed="";
673+
}
674+
if(bodyDotAllowed){
675+
body=`(?:${body})(?:${bodyDotAllowed})*?`;
676+
}
674677
letfinal="";
675678
if(this.type==="!"&&__privateGet(this,_emptyExt)){
676-
final=(this.isStart()&&!__privateGet(this,_options).dot ? startNoDot : "")+starNoEmpty;
679+
final=(this.isStart()&&!dot ? startNoDot : "")+starNoEmpty;
677680
}else{
678681
constclose=this.type==="!" ? (
679682
// !() must match something,but !(x) can match ''
680-
"))"+(this.isStart()&&!__privateGet(this,_options).dot ? startNoDot : "")+star2+")"
681-
) : this.type==="@" ? ")" : `)${this.type}`;
683+
"))"+(this.isStart()&&!dot&&!allowDot ? startNoDot : "")+star2+")"
684+
) : this.type==="@" ? ")" : this.type==="?" ? ")?" : this.type==="+"&&bodyDotAllowed ? ")" : this.type==="*"&&bodyDotAllowed ? `)?` : `)${this.type}`;
682685
final=start+body+close;
683686
}
684687
return[
@@ -836,6 +839,17 @@ var require_ast = __commonJS({
836839
__privateSet(ast,_parts,[str.substring(pos-1)]);
837840
returni;
838841
};
842+
_partsToRegExp=newWeakSet();
843+
partsToRegExp_fn=function(dot){
844+
return__privateGet(this,_parts).map((p)=>{
845+
if(typeofp==="string"){
846+
thrownewError("string type in extglob ast??");
847+
}
848+
const[re,_,_hasMagic2,uflag]=p.toRegExpSource(dot);
849+
__privateSet(this,_uflag,__privateGet(this,_uflag)||uflag);
850+
returnre;
851+
}).filter((p)=>!(this.isStart()&&this.isEnd())||!!p).join("|");
852+
};
839853
_parseGlob=newWeakSet();
840854
parseGlob_fn=function(glob,hasMagic,noEmpty=false){
841855
letescaping=false;

‎deps/minimatch/src/dist/cjs/ast.d.ts‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ export declare class AST{
1414
clone(parent: AST): AST;
1515
staticfromGlob(pattern: string,options?: MinimatchOptions): AST;
1616
toMMPattern(): MMRegExp|string;
17-
toRegExpSource(): [
18-
re: string,
19-
body: string,
20-
hasMagic: boolean,
21-
uflag: boolean
22-
];
17+
toRegExpSource(allowDot?: boolean): [re: string,body: string,hasMagic: boolean,uflag: boolean];
2318
}
2419
//# sourceMappingURL=ast.d.ts.map

‎deps/minimatch/src/dist/cjs/ast.d.ts.map‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎deps/minimatch/src/dist/cjs/ast.js‎

Lines changed: 47 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎deps/minimatch/src/dist/cjs/ast.js.map‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎deps/minimatch/src/dist/mjs/ast.d.ts‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ export declare class AST{
1414
clone(parent: AST): AST;
1515
staticfromGlob(pattern: string,options?: MinimatchOptions): AST;
1616
toMMPattern(): MMRegExp|string;
17-
toRegExpSource(): [
18-
re: string,
19-
body: string,
20-
hasMagic: boolean,
21-
uflag: boolean
22-
];
17+
toRegExpSource(allowDot?: boolean): [re: string,body: string,hasMagic: boolean,uflag: boolean];
2318
}
2419
//# sourceMappingURL=ast.d.ts.map

‎deps/minimatch/src/dist/mjs/ast.d.ts.map‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
(0)