Update dist folder

This commit is contained in:
Riccardo Rigutini 2024-05-27 19:54:13 +00:00 committed by GitHub
parent c37839bdcb
commit 008d582ac3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 185 additions and 137 deletions

320
dist/index.js generated vendored
View File

@ -3244,17 +3244,17 @@ module.exports = require("util");
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Glob = void 0; exports.Glob = void 0;
const minimatch_1 = __nccwpck_require__(266); const minimatch_1 = __nccwpck_require__(658);
const path_scurry_1 = __nccwpck_require__(1081);
const node_url_1 = __nccwpck_require__(1041); const node_url_1 = __nccwpck_require__(1041);
const path_scurry_1 = __nccwpck_require__(1081);
const pattern_js_1 = __nccwpck_require__(6866); const pattern_js_1 = __nccwpck_require__(6866);
const walker_js_1 = __nccwpck_require__(153); const walker_js_1 = __nccwpck_require__(153);
// if no process global, just call it linux. // if no process global, just call it linux.
// so we default to case-sensitive, / separators // so we default to case-sensitive, / separators
const defaultPlatform = typeof process === 'object' && const defaultPlatform = (typeof process === 'object' &&
process && process &&
typeof process.platform === 'string' typeof process.platform === 'string') ?
? process.platform process.platform
: 'linux'; : 'linux';
/** /**
* An object that can perform glob pattern traversals. * An object that can perform glob pattern traversals.
@ -3284,6 +3284,7 @@ class Glob {
signal; signal;
windowsPathsNoEscape; windowsPathsNoEscape;
withFileTypes; withFileTypes;
includeChildMatches;
/** /**
* The options provided to the constructor. * The options provided to the constructor.
*/ */
@ -3329,6 +3330,7 @@ class Glob {
this.noext = !!opts.noext; this.noext = !!opts.noext;
this.realpath = !!opts.realpath; this.realpath = !!opts.realpath;
this.absolute = opts.absolute; this.absolute = opts.absolute;
this.includeChildMatches = opts.includeChildMatches !== false;
this.noglobstar = !!opts.noglobstar; this.noglobstar = !!opts.noglobstar;
this.matchBase = !!opts.matchBase; this.matchBase = !!opts.matchBase;
this.maxDepth = this.maxDepth =
@ -3343,7 +3345,8 @@ class Glob {
} }
this.windowsPathsNoEscape = this.windowsPathsNoEscape =
!!opts.windowsPathsNoEscape || !!opts.windowsPathsNoEscape ||
opts.allowWindowsEscape === false; opts.allowWindowsEscape ===
false;
if (this.windowsPathsNoEscape) { if (this.windowsPathsNoEscape) {
pattern = pattern.map(p => p.replace(/\\/g, '/')); pattern = pattern.map(p => p.replace(/\\/g, '/'));
} }
@ -3364,12 +3367,9 @@ class Glob {
} }
} }
else { else {
const Scurry = opts.platform === 'win32' const Scurry = opts.platform === 'win32' ? path_scurry_1.PathScurryWin32
? path_scurry_1.PathScurryWin32 : opts.platform === 'darwin' ? path_scurry_1.PathScurryDarwin
: opts.platform === 'darwin' : opts.platform ? path_scurry_1.PathScurryPosix
? path_scurry_1.PathScurryDarwin
: opts.platform
? path_scurry_1.PathScurryPosix
: path_scurry_1.PathScurry; : path_scurry_1.PathScurry;
this.scurry = new Scurry(this.cwd, { this.scurry = new Scurry(this.cwd, {
nocase: opts.nocase, nocase: opts.nocase,
@ -3421,11 +3421,12 @@ class Glob {
return [ return [
...(await new walker_js_1.GlobWalker(this.patterns, this.scurry.cwd, { ...(await new walker_js_1.GlobWalker(this.patterns, this.scurry.cwd, {
...this.opts, ...this.opts,
maxDepth: this.maxDepth !== Infinity maxDepth: this.maxDepth !== Infinity ?
? this.maxDepth + this.scurry.cwd.depth() this.maxDepth + this.scurry.cwd.depth()
: Infinity, : Infinity,
platform: this.platform, platform: this.platform,
nocase: this.nocase, nocase: this.nocase,
includeChildMatches: this.includeChildMatches,
}).walk()), }).walk()),
]; ];
} }
@ -3433,32 +3434,35 @@ class Glob {
return [ return [
...new walker_js_1.GlobWalker(this.patterns, this.scurry.cwd, { ...new walker_js_1.GlobWalker(this.patterns, this.scurry.cwd, {
...this.opts, ...this.opts,
maxDepth: this.maxDepth !== Infinity maxDepth: this.maxDepth !== Infinity ?
? this.maxDepth + this.scurry.cwd.depth() this.maxDepth + this.scurry.cwd.depth()
: Infinity, : Infinity,
platform: this.platform, platform: this.platform,
nocase: this.nocase, nocase: this.nocase,
includeChildMatches: this.includeChildMatches,
}).walkSync(), }).walkSync(),
]; ];
} }
stream() { stream() {
return new walker_js_1.GlobStream(this.patterns, this.scurry.cwd, { return new walker_js_1.GlobStream(this.patterns, this.scurry.cwd, {
...this.opts, ...this.opts,
maxDepth: this.maxDepth !== Infinity maxDepth: this.maxDepth !== Infinity ?
? this.maxDepth + this.scurry.cwd.depth() this.maxDepth + this.scurry.cwd.depth()
: Infinity, : Infinity,
platform: this.platform, platform: this.platform,
nocase: this.nocase, nocase: this.nocase,
includeChildMatches: this.includeChildMatches,
}).stream(); }).stream();
} }
streamSync() { streamSync() {
return new walker_js_1.GlobStream(this.patterns, this.scurry.cwd, { return new walker_js_1.GlobStream(this.patterns, this.scurry.cwd, {
...this.opts, ...this.opts,
maxDepth: this.maxDepth !== Infinity maxDepth: this.maxDepth !== Infinity ?
? this.maxDepth + this.scurry.cwd.depth() this.maxDepth + this.scurry.cwd.depth()
: Infinity, : Infinity,
platform: this.platform, platform: this.platform,
nocase: this.nocase, nocase: this.nocase,
includeChildMatches: this.includeChildMatches,
}).streamSync(); }).streamSync();
} }
/** /**
@ -3494,7 +3498,7 @@ exports.Glob = Glob;
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.hasMagic = void 0; exports.hasMagic = void 0;
const minimatch_1 = __nccwpck_require__(266); const minimatch_1 = __nccwpck_require__(658);
/** /**
* Return true if the patterns provided contain any magic glob characters, * Return true if the patterns provided contain any magic glob characters,
* given the options provided. * given the options provided.
@ -3532,12 +3536,12 @@ exports.hasMagic = hasMagic;
// Ignores are always parsed in dot:true mode // Ignores are always parsed in dot:true mode
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Ignore = void 0; exports.Ignore = void 0;
const minimatch_1 = __nccwpck_require__(266); const minimatch_1 = __nccwpck_require__(658);
const pattern_js_1 = __nccwpck_require__(6866); const pattern_js_1 = __nccwpck_require__(6866);
const defaultPlatform = typeof process === 'object' && const defaultPlatform = (typeof process === 'object' &&
process && process &&
typeof process.platform === 'string' typeof process.platform === 'string') ?
? process.platform process.platform
: 'linux'; : 'linux';
/** /**
* Class used to process ignored patterns * Class used to process ignored patterns
@ -3547,12 +3551,15 @@ class Ignore {
relativeChildren; relativeChildren;
absolute; absolute;
absoluteChildren; absoluteChildren;
platform;
mmopts;
constructor(ignored, { nobrace, nocase, noext, noglobstar, platform = defaultPlatform, }) { constructor(ignored, { nobrace, nocase, noext, noglobstar, platform = defaultPlatform, }) {
this.relative = []; this.relative = [];
this.absolute = []; this.absolute = [];
this.relativeChildren = []; this.relativeChildren = [];
this.absoluteChildren = []; this.absoluteChildren = [];
const mmopts = { this.platform = platform;
this.mmopts = {
dot: true, dot: true,
nobrace, nobrace,
nocase, nocase,
@ -3563,6 +3570,10 @@ class Ignore {
nocomment: true, nocomment: true,
nonegate: true, nonegate: true,
}; };
for (const ign of ignored)
this.add(ign);
}
add(ign) {
// this is a little weird, but it gives us a clean set of optimized // this is a little weird, but it gives us a clean set of optimized
// minimatch matchers, without getting tripped up if one of them // minimatch matchers, without getting tripped up if one of them
// ends in /** inside a brace section, and it's only inefficient at // ends in /** inside a brace section, and it's only inefficient at
@ -3575,36 +3586,34 @@ class Ignore {
// for absolute-ness. // for absolute-ness.
// Yet another way, Minimatch could take an array of glob strings, and // Yet another way, Minimatch could take an array of glob strings, and
// a cwd option, and do the right thing. // a cwd option, and do the right thing.
for (const ign of ignored) { const mm = new minimatch_1.Minimatch(ign, this.mmopts);
const mm = new minimatch_1.Minimatch(ign, mmopts); for (let i = 0; i < mm.set.length; i++) {
for (let i = 0; i < mm.set.length; i++) { const parsed = mm.set[i];
const parsed = mm.set[i]; const globParts = mm.globParts[i];
const globParts = mm.globParts[i]; /* c8 ignore start */
/* c8 ignore start */ if (!parsed || !globParts) {
if (!parsed || !globParts) { throw new Error('invalid pattern object');
throw new Error('invalid pattern object'); }
} // strip off leading ./ portions
// strip off leading ./ portions // https://github.com/isaacs/node-glob/issues/570
// https://github.com/isaacs/node-glob/issues/570 while (parsed[0] === '.' && globParts[0] === '.') {
while (parsed[0] === '.' && globParts[0] === '.') { parsed.shift();
parsed.shift(); globParts.shift();
globParts.shift(); }
} /* c8 ignore stop */
/* c8 ignore stop */ const p = new pattern_js_1.Pattern(parsed, globParts, 0, this.platform);
const p = new pattern_js_1.Pattern(parsed, globParts, 0, platform); const m = new minimatch_1.Minimatch(p.globString(), this.mmopts);
const m = new minimatch_1.Minimatch(p.globString(), mmopts); const children = globParts[globParts.length - 1] === '**';
const children = globParts[globParts.length - 1] === '**'; const absolute = p.isAbsolute();
const absolute = p.isAbsolute(); if (absolute)
this.absolute.push(m);
else
this.relative.push(m);
if (children) {
if (absolute) if (absolute)
this.absolute.push(m); this.absoluteChildren.push(m);
else else
this.relative.push(m); this.relativeChildren.push(m);
if (children) {
if (absolute)
this.absoluteChildren.push(m);
else
this.relativeChildren.push(m);
}
} }
} }
} }
@ -3648,10 +3657,19 @@ exports.Ignore = Ignore;
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.glob = exports.hasMagic = exports.Glob = exports.unescape = exports.escape = exports.sync = exports.iterate = exports.iterateSync = exports.stream = exports.streamSync = exports.globIterate = exports.globIterateSync = exports.globSync = exports.globStream = exports.globStreamSync = void 0; exports.glob = exports.sync = exports.iterate = exports.iterateSync = exports.stream = exports.streamSync = exports.globIterate = exports.globIterateSync = exports.globSync = exports.globStream = exports.globStreamSync = exports.Ignore = exports.hasMagic = exports.Glob = exports.unescape = exports.escape = void 0;
const minimatch_1 = __nccwpck_require__(266); const minimatch_1 = __nccwpck_require__(658);
const glob_js_1 = __nccwpck_require__(2487); const glob_js_1 = __nccwpck_require__(2487);
const has_magic_js_1 = __nccwpck_require__(3133); const has_magic_js_1 = __nccwpck_require__(3133);
var minimatch_2 = __nccwpck_require__(658);
Object.defineProperty(exports, "escape", ({ enumerable: true, get: function () { return minimatch_2.escape; } }));
Object.defineProperty(exports, "unescape", ({ enumerable: true, get: function () { return minimatch_2.unescape; } }));
var glob_js_2 = __nccwpck_require__(2487);
Object.defineProperty(exports, "Glob", ({ enumerable: true, get: function () { return glob_js_2.Glob; } }));
var has_magic_js_2 = __nccwpck_require__(3133);
Object.defineProperty(exports, "hasMagic", ({ enumerable: true, get: function () { return has_magic_js_2.hasMagic; } }));
var ignore_js_1 = __nccwpck_require__(9703);
Object.defineProperty(exports, "Ignore", ({ enumerable: true, get: function () { return ignore_js_1.Ignore; } }));
function globStreamSync(pattern, options = {}) { function globStreamSync(pattern, options = {}) {
return new glob_js_1.Glob(pattern, options).streamSync(); return new glob_js_1.Glob(pattern, options).streamSync();
} }
@ -3686,15 +3704,6 @@ exports.sync = Object.assign(globSync, {
stream: globStreamSync, stream: globStreamSync,
iterate: globIterateSync, iterate: globIterateSync,
}); });
/* c8 ignore start */
var minimatch_2 = __nccwpck_require__(266);
Object.defineProperty(exports, "escape", ({ enumerable: true, get: function () { return minimatch_2.escape; } }));
Object.defineProperty(exports, "unescape", ({ enumerable: true, get: function () { return minimatch_2.unescape; } }));
var glob_js_2 = __nccwpck_require__(2487);
Object.defineProperty(exports, "Glob", ({ enumerable: true, get: function () { return glob_js_2.Glob; } }));
var has_magic_js_2 = __nccwpck_require__(3133);
Object.defineProperty(exports, "hasMagic", ({ enumerable: true, get: function () { return has_magic_js_2.hasMagic; } }));
/* c8 ignore stop */
exports.glob = Object.assign(glob_, { exports.glob = Object.assign(glob_, {
glob: glob_, glob: glob_,
globSync, globSync,
@ -3725,7 +3734,7 @@ exports.glob.glob = exports.glob;
// this is just a very light wrapper around 2 arrays with an offset index // this is just a very light wrapper around 2 arrays with an offset index
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Pattern = void 0; exports.Pattern = void 0;
const minimatch_1 = __nccwpck_require__(266); const minimatch_1 = __nccwpck_require__(658);
const isPatternList = (pl) => pl.length >= 1; const isPatternList = (pl) => pl.length >= 1;
const isGlobList = (gl) => gl.length >= 1; const isGlobList = (gl) => gl.length >= 1;
/** /**
@ -3833,9 +3842,9 @@ class Pattern {
globString() { globString() {
return (this.#globString = return (this.#globString =
this.#globString || this.#globString ||
(this.#index === 0 (this.#index === 0 ?
? this.isAbsolute() this.isAbsolute() ?
? this.#globList[0] + this.#globList.slice(1).join('/') this.#globList[0] + this.#globList.slice(1).join('/')
: this.#globList.join('/') : this.#globList.join('/')
: this.#globList.slice(this.#index).join('/'))); : this.#globList.slice(this.#index).join('/')));
} }
@ -3864,8 +3873,8 @@ class Pattern {
*/ */
isUNC() { isUNC() {
const pl = this.#patternList; const pl = this.#patternList;
return this.#isUNC !== undefined return this.#isUNC !== undefined ?
? this.#isUNC this.#isUNC
: (this.#isUNC = : (this.#isUNC =
this.#platform === 'win32' && this.#platform === 'win32' &&
this.#index === 0 && this.#index === 0 &&
@ -3886,8 +3895,8 @@ class Pattern {
*/ */
isDrive() { isDrive() {
const pl = this.#patternList; const pl = this.#patternList;
return this.#isDrive !== undefined return this.#isDrive !== undefined ?
? this.#isDrive this.#isDrive
: (this.#isDrive = : (this.#isDrive =
this.#platform === 'win32' && this.#platform === 'win32' &&
this.#index === 0 && this.#index === 0 &&
@ -3903,8 +3912,8 @@ class Pattern {
*/ */
isAbsolute() { isAbsolute() {
const pl = this.#patternList; const pl = this.#patternList;
return this.#isAbsolute !== undefined return this.#isAbsolute !== undefined ?
? this.#isAbsolute this.#isAbsolute
: (this.#isAbsolute = : (this.#isAbsolute =
(pl[0] === '' && pl.length > 1) || (pl[0] === '' && pl.length > 1) ||
this.isDrive() || this.isDrive() ||
@ -3915,8 +3924,8 @@ class Pattern {
*/ */
root() { root() {
const p = this.#patternList[0]; const p = this.#patternList[0];
return typeof p === 'string' && this.isAbsolute() && this.#index === 0 return (typeof p === 'string' && this.isAbsolute() && this.#index === 0) ?
? p p
: ''; : '';
} }
/** /**
@ -3951,7 +3960,7 @@ exports.Pattern = Pattern;
// synchronous utility for filtering entries and calculating subwalks // synchronous utility for filtering entries and calculating subwalks
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Processor = exports.SubWalks = exports.MatchRecord = exports.HasWalkedCache = void 0; exports.Processor = exports.SubWalks = exports.MatchRecord = exports.HasWalkedCache = void 0;
const minimatch_1 = __nccwpck_require__(266); const minimatch_1 = __nccwpck_require__(658);
/** /**
* A cache of which patterns have been processed for a given Path * A cache of which patterns have been processed for a given Path
*/ */
@ -4052,9 +4061,8 @@ class Processor {
this.opts = opts; this.opts = opts;
this.follow = !!opts.follow; this.follow = !!opts.follow;
this.dot = !!opts.dot; this.dot = !!opts.dot;
this.hasWalkedCache = hasWalkedCache this.hasWalkedCache =
? hasWalkedCache.copy() hasWalkedCache ? hasWalkedCache.copy() : new HasWalkedCache();
: new HasWalkedCache();
} }
processPatterns(target, patterns) { processPatterns(target, patterns) {
this.patterns = patterns; this.patterns = patterns;
@ -4067,8 +4075,8 @@ class Processor {
const absolute = pattern.isAbsolute() && this.opts.absolute !== false; const absolute = pattern.isAbsolute() && this.opts.absolute !== false;
// start absolute patterns at root // start absolute patterns at root
if (root) { if (root) {
t = t.resolve(root === '/' && this.opts.root !== undefined t = t.resolve(root === '/' && this.opts.root !== undefined ?
? this.opts.root this.opts.root
: root); : root);
const rest = pattern.rest(); const rest = pattern.rest();
if (!rest) { if (!rest) {
@ -4268,10 +4276,8 @@ exports.GlobStream = exports.GlobWalker = exports.GlobUtil = void 0;
const minipass_1 = __nccwpck_require__(4968); const minipass_1 = __nccwpck_require__(4968);
const ignore_js_1 = __nccwpck_require__(9703); const ignore_js_1 = __nccwpck_require__(9703);
const processor_js_1 = __nccwpck_require__(4628); const processor_js_1 = __nccwpck_require__(4628);
const makeIgnore = (ignore, opts) => typeof ignore === 'string' const makeIgnore = (ignore, opts) => typeof ignore === 'string' ? new ignore_js_1.Ignore([ignore], opts)
? new ignore_js_1.Ignore([ignore], opts) : Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts)
: Array.isArray(ignore)
? new ignore_js_1.Ignore(ignore, opts)
: ignore; : ignore;
/** /**
* basic walking utilities that all the glob walker types use * basic walking utilities that all the glob walker types use
@ -4288,13 +4294,20 @@ class GlobUtil {
#sep; #sep;
signal; signal;
maxDepth; maxDepth;
includeChildMatches;
constructor(patterns, path, opts) { constructor(patterns, path, opts) {
this.patterns = patterns; this.patterns = patterns;
this.path = path; this.path = path;
this.opts = opts; this.opts = opts;
this.#sep = !opts.posix && opts.platform === 'win32' ? '\\' : '/'; this.#sep = !opts.posix && opts.platform === 'win32' ? '\\' : '/';
if (opts.ignore) { this.includeChildMatches = opts.includeChildMatches !== false;
this.#ignore = makeIgnore(opts.ignore, opts); if (opts.ignore || !this.includeChildMatches) {
this.#ignore = makeIgnore(opts.ignore ?? [], opts);
if (!this.includeChildMatches &&
typeof this.#ignore.add !== 'function') {
const m = 'cannot ignore child matches, ignore lacks add() method.';
throw new Error(m);
}
} }
// ignore, always set with maxDepth, but it's optional on the // ignore, always set with maxDepth, but it's optional on the
// GlobOptions type // GlobOptions type
@ -4366,7 +4379,7 @@ class GlobUtil {
return this.matchCheckTest(s, ifDir); return this.matchCheckTest(s, ifDir);
} }
matchCheckTest(e, ifDir) { matchCheckTest(e, ifDir) {
return e && return (e &&
(this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) &&
(!ifDir || e.canReaddir()) && (!ifDir || e.canReaddir()) &&
(!this.opts.nodir || !e.isDirectory()) && (!this.opts.nodir || !e.isDirectory()) &&
@ -4374,8 +4387,8 @@ class GlobUtil {
!this.opts.follow || !this.opts.follow ||
!e.isSymbolicLink() || !e.isSymbolicLink() ||
!e.realpathCached()?.isDirectory()) && !e.realpathCached()?.isDirectory()) &&
!this.#ignored(e) !this.#ignored(e)) ?
? e e
: undefined; : undefined;
} }
matchCheckSync(e, ifDir) { matchCheckSync(e, ifDir) {
@ -4401,6 +4414,11 @@ class GlobUtil {
matchFinish(e, absolute) { matchFinish(e, absolute) {
if (this.#ignored(e)) if (this.#ignored(e))
return; return;
// we know we have an ignore if this is false, but TS doesn't
if (!this.includeChildMatches && this.#ignore?.add) {
const ign = `${e.relativePosix()}/**`;
this.#ignore.add(ign);
}
const abs = this.opts.absolute === undefined ? absolute : this.opts.absolute; const abs = this.opts.absolute === undefined ? absolute : this.opts.absolute;
this.seen.add(e); this.seen.add(e);
const mark = this.opts.mark && e.isDirectory() ? this.#sep : ''; const mark = this.opts.mark && e.isDirectory() ? this.#sep : '';
@ -4414,8 +4432,8 @@ class GlobUtil {
} }
else { else {
const rel = this.opts.posix ? e.relativePosix() : e.relative(); const rel = this.opts.posix ? e.relativePosix() : e.relative();
const pre = this.opts.dotRelative && !rel.startsWith('..' + this.#sep) const pre = this.opts.dotRelative && !rel.startsWith('..' + this.#sep) ?
? '.' + this.#sep '.' + this.#sep
: ''; : '';
this.matchEmit(!rel ? '.' + mark : pre + rel + mark); this.matchEmit(!rel ? '.' + mark : pre + rel + mark);
} }
@ -4555,10 +4573,9 @@ class GlobUtil {
} }
exports.GlobUtil = GlobUtil; exports.GlobUtil = GlobUtil;
class GlobWalker extends GlobUtil { class GlobWalker extends GlobUtil {
matches; matches = new Set();
constructor(patterns, path, opts) { constructor(patterns, path, opts) {
super(patterns, path, opts); super(patterns, path, opts);
this.matches = new Set();
} }
matchEmit(e) { matchEmit(e) {
this.matches.add(e); this.matches.add(e);
@ -4637,7 +4654,7 @@ exports.GlobStream = GlobStream;
/***/ }), /***/ }),
/***/ 5934: /***/ 2401:
/***/ ((__unused_webpack_module, exports) => { /***/ ((__unused_webpack_module, exports) => {
"use strict"; "use strict";
@ -4658,7 +4675,7 @@ exports.assertValidPattern = assertValidPattern;
/***/ }), /***/ }),
/***/ 7642: /***/ 6034:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
"use strict"; "use strict";
@ -4666,15 +4683,15 @@ exports.assertValidPattern = assertValidPattern;
// parse a single path portion // parse a single path portion
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.AST = void 0; exports.AST = void 0;
const brace_expressions_js_1 = __nccwpck_require__(314); const brace_expressions_js_1 = __nccwpck_require__(3096);
const unescape_js_1 = __nccwpck_require__(9820); const unescape_js_1 = __nccwpck_require__(7226);
const types = new Set(['!', '?', '+', '*', '@']); const types = new Set(['!', '?', '+', '*', '@']);
const isExtglobType = (c) => types.has(c); const isExtglobType = (c) => types.has(c);
// Patterns that get prepended to bind to the start of either the // Patterns that get prepended to bind to the start of either the
// entire string, or just a single path portion, to prevent dots // entire string, or just a single path portion, to prevent dots
// and/or traversal patterns, when needed. // and/or traversal patterns, when needed.
// Exts don't need the ^ or / bit, because the root binds that already. // Exts don't need the ^ or / bit, because the root binds that already.
const startNoTraversal = '(?!\\.\\.?(?:$|/))'; const startNoTraversal = '(?!(?:^|/)\\.\\.?(?:$|/))';
const startNoDot = '(?!\\.)'; const startNoDot = '(?!\\.)';
// characters that indicate a start of pattern needs the "no dots" bit, // characters that indicate a start of pattern needs the "no dots" bit,
// because a dot *might* be matched. ( is not in the list, because in // because a dot *might* be matched. ( is not in the list, because in
@ -5002,6 +5019,9 @@ class AST {
_glob: glob, _glob: glob,
}); });
} }
get options() {
return this.#options;
}
// returns the string match, the regexp source, whether there's magic // returns the string match, the regexp source, whether there's magic
// in the regexp (so a regular expression is required) and whether or // in the regexp (so a regular expression is required) and whether or
// not the uflag is needed for the regular expression (for posix classes) // not the uflag is needed for the regular expression (for posix classes)
@ -5071,7 +5091,8 @@ class AST {
// - Since the start for a join is eg /(?!\.) and the start for a part // - Since the start for a join is eg /(?!\.) and the start for a part
// is ^(?!\.), we can just prepend (?!\.) to the pattern (either root // is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
// or start or whatever) and prepend ^ or / at the Regexp construction. // or start or whatever) and prepend ^ or / at the Regexp construction.
toRegExpSource() { toRegExpSource(allowDot) {
const dot = allowDot ?? !!this.#options.dot;
if (this.#root === this) if (this.#root === this)
this.#fillNegs(); this.#fillNegs();
if (!this.type) { if (!this.type) {
@ -5080,7 +5101,7 @@ class AST {
.map(p => { .map(p => {
const [re, _, hasMagic, uflag] = typeof p === 'string' const [re, _, hasMagic, uflag] = typeof p === 'string'
? AST.#parseGlob(p, this.#hasMagic, noEmpty) ? AST.#parseGlob(p, this.#hasMagic, noEmpty)
: p.toRegExpSource(); : p.toRegExpSource(allowDot);
this.#hasMagic = this.#hasMagic || hasMagic; this.#hasMagic = this.#hasMagic || hasMagic;
this.#uflag = this.#uflag || uflag; this.#uflag = this.#uflag || uflag;
return re; return re;
@ -5100,14 +5121,14 @@ class AST {
// and prevent that. // and prevent that.
const needNoTrav = const needNoTrav =
// dots are allowed, and the pattern starts with [ or . // dots are allowed, and the pattern starts with [ or .
(this.#options.dot && aps.has(src.charAt(0))) || (dot && aps.has(src.charAt(0))) ||
// the pattern starts with \., and then [ or . // the pattern starts with \., and then [ or .
(src.startsWith('\\.') && aps.has(src.charAt(2))) || (src.startsWith('\\.') && aps.has(src.charAt(2))) ||
// the pattern starts with \.\., and then [ or . // the pattern starts with \.\., and then [ or .
(src.startsWith('\\.\\.') && aps.has(src.charAt(4))); (src.startsWith('\\.\\.') && aps.has(src.charAt(4)));
// no need to prevent dots if it can't match a dot, or if a // no need to prevent dots if it can't match a dot, or if a
// sub-pattern will be preventing it anyway. // sub-pattern will be preventing it anyway.
const needNoDot = !this.#options.dot && aps.has(src.charAt(0)); const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
start = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : ''; start = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : '';
} }
} }
@ -5127,23 +5148,13 @@ class AST {
this.#uflag, this.#uflag,
]; ];
} }
// We need to calculate the body *twice* if it's a repeat pattern
// at the start, once in nodot mode, then again in dot mode, so a
// pattern like *(?) can match 'x.y'
const repeated = this.type === '*' || this.type === '+';
// some kind of extglob // some kind of extglob
const start = this.type === '!' ? '(?:(?!(?:' : '(?:'; const start = this.type === '!' ? '(?:(?!(?:' : '(?:';
const body = this.#parts let body = this.#partsToRegExp(dot);
.map(p => {
// extglob ASTs should only contain parent ASTs
/* c8 ignore start */
if (typeof p === 'string') {
throw new Error('string type in extglob ast??');
}
/* c8 ignore stop */
// can ignore hasMagic, because extglobs are already always magic
const [re, _, _hasMagic, uflag] = p.toRegExpSource();
this.#uflag = this.#uflag || uflag;
return re;
})
.filter(p => !(this.isStart() && this.isEnd()) || !!p)
.join('|');
if (this.isStart() && this.isEnd() && !body && this.type !== '!') { if (this.isStart() && this.isEnd() && !body && this.type !== '!') {
// invalid extglob, has to at least be *something* present, if it's // invalid extglob, has to at least be *something* present, if it's
// the entire path portion. // the entire path portion.
@ -5153,22 +5164,37 @@ class AST {
this.#hasMagic = undefined; this.#hasMagic = undefined;
return [s, (0, unescape_js_1.unescape)(this.toString()), false, false]; return [s, (0, unescape_js_1.unescape)(this.toString()), false, false];
} }
// XXX abstract out this map method
let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot
? ''
: this.#partsToRegExp(true);
if (bodyDotAllowed === body) {
bodyDotAllowed = '';
}
if (bodyDotAllowed) {
body = `(?:${body})(?:${bodyDotAllowed})*?`;
}
// an empty !() is exactly equivalent to a starNoEmpty // an empty !() is exactly equivalent to a starNoEmpty
let final = ''; let final = '';
if (this.type === '!' && this.#emptyExt) { if (this.type === '!' && this.#emptyExt) {
final = final = (this.isStart() && !dot ? startNoDot : '') + starNoEmpty;
(this.isStart() && !this.#options.dot ? startNoDot : '') + starNoEmpty;
} }
else { else {
const close = this.type === '!' const close = this.type === '!'
? // !() must match something,but !(x) can match '' ? // !() must match something,but !(x) can match ''
'))' + '))' +
(this.isStart() && !this.#options.dot ? startNoDot : '') + (this.isStart() && !dot && !allowDot ? startNoDot : '') +
star + star +
')' ')'
: this.type === '@' : this.type === '@'
? ')' ? ')'
: `)${this.type}`; : this.type === '?'
? ')?'
: this.type === '+' && bodyDotAllowed
? ')'
: this.type === '*' && bodyDotAllowed
? `)?`
: `)${this.type}`;
final = start + body + close; final = start + body + close;
} }
return [ return [
@ -5178,6 +5204,23 @@ class AST {
this.#uflag, this.#uflag,
]; ];
} }
#partsToRegExp(dot) {
return this.#parts
.map(p => {
// extglob ASTs should only contain parent ASTs
/* c8 ignore start */
if (typeof p === 'string') {
throw new Error('string type in extglob ast??');
}
/* c8 ignore stop */
// can ignore hasMagic, because extglobs are already always magic
const [re, _, _hasMagic, uflag] = p.toRegExpSource(dot);
this.#uflag = this.#uflag || uflag;
return re;
})
.filter(p => !(this.isStart() && this.isEnd()) || !!p)
.join('|');
}
static #parseGlob(glob, hasMagic, noEmpty = false) { static #parseGlob(glob, hasMagic, noEmpty = false) {
let escaping = false; let escaping = false;
let re = ''; let re = '';
@ -5231,7 +5274,7 @@ exports.AST = AST;
/***/ }), /***/ }),
/***/ 314: /***/ 3096:
/***/ ((__unused_webpack_module, exports) => { /***/ ((__unused_webpack_module, exports) => {
"use strict"; "use strict";
@ -5390,7 +5433,7 @@ exports.parseClass = parseClass;
/***/ }), /***/ }),
/***/ 1477: /***/ 1496:
/***/ ((__unused_webpack_module, exports) => { /***/ ((__unused_webpack_module, exports) => {
"use strict"; "use strict";
@ -5419,7 +5462,7 @@ exports.escape = escape;
/***/ }), /***/ }),
/***/ 266: /***/ 658:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
"use strict"; "use strict";
@ -5430,10 +5473,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.unescape = exports.escape = exports.AST = exports.Minimatch = exports.match = exports.makeRe = exports.braceExpand = exports.defaults = exports.filter = exports.GLOBSTAR = exports.sep = exports.minimatch = void 0; exports.unescape = exports.escape = exports.AST = exports.Minimatch = exports.match = exports.makeRe = exports.braceExpand = exports.defaults = exports.filter = exports.GLOBSTAR = exports.sep = exports.minimatch = void 0;
const brace_expansion_1 = __importDefault(__nccwpck_require__(1046)); const brace_expansion_1 = __importDefault(__nccwpck_require__(1046));
const assert_valid_pattern_js_1 = __nccwpck_require__(5934); const assert_valid_pattern_js_1 = __nccwpck_require__(2401);
const ast_js_1 = __nccwpck_require__(7642); const ast_js_1 = __nccwpck_require__(6034);
const escape_js_1 = __nccwpck_require__(1477); const escape_js_1 = __nccwpck_require__(1496);
const unescape_js_1 = __nccwpck_require__(9820); const unescape_js_1 = __nccwpck_require__(7226);
const minimatch = (p, pattern, options = {}) => { const minimatch = (p, pattern, options = {}) => {
(0, assert_valid_pattern_js_1.assertValidPattern)(pattern); (0, assert_valid_pattern_js_1.assertValidPattern)(pattern);
// shortcut: comments match nothing. // shortcut: comments match nothing.
@ -5769,6 +5812,7 @@ class Minimatch {
globParts = this.levelOneOptimize(globParts); globParts = this.levelOneOptimize(globParts);
} }
else { else {
// just collapse multiple ** portions into one
globParts = this.adjascentGlobstarOptimize(globParts); globParts = this.adjascentGlobstarOptimize(globParts);
} }
return globParts; return globParts;
@ -6258,7 +6302,11 @@ class Minimatch {
fastTest = dotStarTest; fastTest = dotStarTest;
} }
const re = ast_js_1.AST.fromGlob(pattern, this.options).toMMPattern(); const re = ast_js_1.AST.fromGlob(pattern, this.options).toMMPattern();
return fastTest ? Object.assign(re, { test: fastTest }) : re; if (fastTest && typeof re === 'object') {
// Avoids overriding in frozen environments
Reflect.defineProperty(re, 'test', { value: fastTest });
}
return re;
} }
makeRe() { makeRe() {
if (this.regexp || this.regexp === false) if (this.regexp || this.regexp === false)
@ -6422,11 +6470,11 @@ class Minimatch {
} }
exports.Minimatch = Minimatch; exports.Minimatch = Minimatch;
/* c8 ignore start */ /* c8 ignore start */
var ast_js_2 = __nccwpck_require__(7642); var ast_js_2 = __nccwpck_require__(6034);
Object.defineProperty(exports, "AST", ({ enumerable: true, get: function () { return ast_js_2.AST; } })); Object.defineProperty(exports, "AST", ({ enumerable: true, get: function () { return ast_js_2.AST; } }));
var escape_js_2 = __nccwpck_require__(1477); var escape_js_2 = __nccwpck_require__(1496);
Object.defineProperty(exports, "escape", ({ enumerable: true, get: function () { return escape_js_2.escape; } })); Object.defineProperty(exports, "escape", ({ enumerable: true, get: function () { return escape_js_2.escape; } }));
var unescape_js_2 = __nccwpck_require__(9820); var unescape_js_2 = __nccwpck_require__(7226);
Object.defineProperty(exports, "unescape", ({ enumerable: true, get: function () { return unescape_js_2.unescape; } })); Object.defineProperty(exports, "unescape", ({ enumerable: true, get: function () { return unescape_js_2.unescape; } }));
/* c8 ignore stop */ /* c8 ignore stop */
exports.minimatch.AST = ast_js_1.AST; exports.minimatch.AST = ast_js_1.AST;
@ -6437,7 +6485,7 @@ exports.minimatch.unescape = unescape_js_1.unescape;
/***/ }), /***/ }),
/***/ 9820: /***/ 7226:
/***/ ((__unused_webpack_module, exports) => { /***/ ((__unused_webpack_module, exports) => {
"use strict"; "use strict";

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long