Skip to content

Commit

Permalink
deps: glob@10.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
wraithgar committed May 29, 2024
1 parent 5c6759d commit 18b42a4
Show file tree
Hide file tree
Showing 25 changed files with 695 additions and 412 deletions.
42 changes: 23 additions & 19 deletions node_modules/glob/dist/commonjs/glob.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
Object.defineProperty(exports, "__esModule", { value: true });
exports.Glob = void 0;
const minimatch_1 = require("minimatch");
const path_scurry_1 = require("path-scurry");
const node_url_1 = require("node:url");
const path_scurry_1 = require("path-scurry");
const pattern_js_1 = require("./pattern.js");
const walker_js_1 = require("./walker.js");
// if no process global, just call it linux.
// so we default to case-sensitive, / separators
const defaultPlatform = typeof process === 'object' &&
const defaultPlatform = (typeof process === 'object' &&
process &&
typeof process.platform === 'string'
? process.platform
typeof process.platform === 'string') ?
process.platform
: 'linux';
/**
* An object that can perform glob pattern traversals.
Expand Down Expand Up @@ -41,6 +41,7 @@ class Glob {
signal;
windowsPathsNoEscape;
withFileTypes;
includeChildMatches;
/**
* The options provided to the constructor.
*/
Expand Down Expand Up @@ -86,6 +87,7 @@ class Glob {
this.noext = !!opts.noext;
this.realpath = !!opts.realpath;
this.absolute = opts.absolute;
this.includeChildMatches = opts.includeChildMatches !== false;
this.noglobstar = !!opts.noglobstar;
this.matchBase = !!opts.matchBase;
this.maxDepth =
Expand All @@ -100,7 +102,8 @@ class Glob {
}
this.windowsPathsNoEscape =
!!opts.windowsPathsNoEscape ||
opts.allowWindowsEscape === false;
opts.allowWindowsEscape ===
false;
if (this.windowsPathsNoEscape) {
pattern = pattern.map(p => p.replace(/\\/g, '/'));
}
Expand All @@ -121,12 +124,9 @@ class Glob {
}
}
else {
const Scurry = opts.platform === 'win32'
? path_scurry_1.PathScurryWin32
: opts.platform === 'darwin'
? path_scurry_1.PathScurryDarwin
: opts.platform
? path_scurry_1.PathScurryPosix
const Scurry = opts.platform === 'win32' ? path_scurry_1.PathScurryWin32
: opts.platform === 'darwin' ? path_scurry_1.PathScurryDarwin
: opts.platform ? path_scurry_1.PathScurryPosix
: path_scurry_1.PathScurry;
this.scurry = new Scurry(this.cwd, {
nocase: opts.nocase,
Expand Down Expand Up @@ -178,44 +178,48 @@ class Glob {
return [
...(await new walker_js_1.GlobWalker(this.patterns, this.scurry.cwd, {
...this.opts,
maxDepth: this.maxDepth !== Infinity
? this.maxDepth + this.scurry.cwd.depth()
maxDepth: this.maxDepth !== Infinity ?
this.maxDepth + this.scurry.cwd.depth()
: Infinity,
platform: this.platform,
nocase: this.nocase,
includeChildMatches: this.includeChildMatches,
}).walk()),
];
}
walkSync() {
return [
...new walker_js_1.GlobWalker(this.patterns, this.scurry.cwd, {
...this.opts,
maxDepth: this.maxDepth !== Infinity
? this.maxDepth + this.scurry.cwd.depth()
maxDepth: this.maxDepth !== Infinity ?
this.maxDepth + this.scurry.cwd.depth()
: Infinity,
platform: this.platform,
nocase: this.nocase,
includeChildMatches: this.includeChildMatches,
}).walkSync(),
];
}
stream() {
return new walker_js_1.GlobStream(this.patterns, this.scurry.cwd, {
...this.opts,
maxDepth: this.maxDepth !== Infinity
? this.maxDepth + this.scurry.cwd.depth()
maxDepth: this.maxDepth !== Infinity ?
this.maxDepth + this.scurry.cwd.depth()
: Infinity,
platform: this.platform,
nocase: this.nocase,
includeChildMatches: this.includeChildMatches,
}).stream();
}
streamSync() {
return new walker_js_1.GlobStream(this.patterns, this.scurry.cwd, {
...this.opts,
maxDepth: this.maxDepth !== Infinity
? this.maxDepth + this.scurry.cwd.depth()
maxDepth: this.maxDepth !== Infinity ?
this.maxDepth + this.scurry.cwd.depth()
: Infinity,
platform: this.platform,
nocase: this.nocase,
includeChildMatches: this.includeChildMatches,
}).streamSync();
}
/**
Expand Down
69 changes: 37 additions & 32 deletions node_modules/glob/dist/commonjs/ignore.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
exports.Ignore = void 0;
const minimatch_1 = require("minimatch");
const pattern_js_1 = require("./pattern.js");
const defaultPlatform = typeof process === 'object' &&
const defaultPlatform = (typeof process === 'object' &&
process &&
typeof process.platform === 'string'
? process.platform
typeof process.platform === 'string') ?
process.platform
: 'linux';
/**
* Class used to process ignored patterns
Expand All @@ -20,12 +20,15 @@ class Ignore {
relativeChildren;
absolute;
absoluteChildren;
platform;
mmopts;
constructor(ignored, { nobrace, nocase, noext, noglobstar, platform = defaultPlatform, }) {
this.relative = [];
this.absolute = [];
this.relativeChildren = [];
this.absoluteChildren = [];
const mmopts = {
this.platform = platform;
this.mmopts = {
dot: true,
nobrace,
nocase,
Expand All @@ -36,6 +39,10 @@ class Ignore {
nocomment: 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
// minimatch matchers, without getting tripped up if one of them
// ends in /** inside a brace section, and it's only inefficient at
Expand All @@ -48,36 +55,34 @@ class Ignore {
// for absolute-ness.
// Yet another way, Minimatch could take an array of glob strings, and
// a cwd option, and do the right thing.
for (const ign of ignored) {
const mm = new minimatch_1.Minimatch(ign, mmopts);
for (let i = 0; i < mm.set.length; i++) {
const parsed = mm.set[i];
const globParts = mm.globParts[i];
/* c8 ignore start */
if (!parsed || !globParts) {
throw new Error('invalid pattern object');
}
// strip off leading ./ portions
// https://github.com/isaacs/node-glob/issues/570
while (parsed[0] === '.' && globParts[0] === '.') {
parsed.shift();
globParts.shift();
}
/* c8 ignore stop */
const p = new pattern_js_1.Pattern(parsed, globParts, 0, platform);
const m = new minimatch_1.Minimatch(p.globString(), mmopts);
const children = globParts[globParts.length - 1] === '**';
const absolute = p.isAbsolute();
const mm = new minimatch_1.Minimatch(ign, this.mmopts);
for (let i = 0; i < mm.set.length; i++) {
const parsed = mm.set[i];
const globParts = mm.globParts[i];
/* c8 ignore start */
if (!parsed || !globParts) {
throw new Error('invalid pattern object');
}
// strip off leading ./ portions
// https://github.com/isaacs/node-glob/issues/570
while (parsed[0] === '.' && globParts[0] === '.') {
parsed.shift();
globParts.shift();
}
/* c8 ignore stop */
const p = new pattern_js_1.Pattern(parsed, globParts, 0, this.platform);
const m = new minimatch_1.Minimatch(p.globString(), this.mmopts);
const children = globParts[globParts.length - 1] === '**';
const absolute = p.isAbsolute();
if (absolute)
this.absolute.push(m);
else
this.relative.push(m);
if (children) {
if (absolute)
this.absolute.push(m);
this.absoluteChildren.push(m);
else
this.relative.push(m);
if (children) {
if (absolute)
this.absoluteChildren.push(m);
else
this.relativeChildren.push(m);
}
this.relativeChildren.push(m);
}
}
}
Expand Down
20 changes: 10 additions & 10 deletions node_modules/glob/dist/commonjs/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
"use strict";
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 = require("minimatch");
const glob_js_1 = require("./glob.js");
const has_magic_js_1 = require("./has-magic.js");
var minimatch_2 = require("minimatch");
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 = require("./glob.js");
Object.defineProperty(exports, "Glob", { enumerable: true, get: function () { return glob_js_2.Glob; } });
var has_magic_js_2 = require("./has-magic.js");
Object.defineProperty(exports, "hasMagic", { enumerable: true, get: function () { return has_magic_js_2.hasMagic; } });
var ignore_js_1 = require("./ignore.js");
Object.defineProperty(exports, "Ignore", { enumerable: true, get: function () { return ignore_js_1.Ignore; } });
function globStreamSync(pattern, options = {}) {
return new glob_js_1.Glob(pattern, options).streamSync();
}
Expand Down Expand Up @@ -38,15 +47,6 @@ exports.sync = Object.assign(globSync, {
stream: globStreamSync,
iterate: globIterateSync,
});
/* c8 ignore start */
var minimatch_2 = require("minimatch");
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 = require("./glob.js");
Object.defineProperty(exports, "Glob", { enumerable: true, get: function () { return glob_js_2.Glob; } });
var has_magic_js_2 = require("./has-magic.js");
Object.defineProperty(exports, "hasMagic", { enumerable: true, get: function () { return has_magic_js_2.hasMagic; } });
/* c8 ignore stop */
exports.glob = Object.assign(glob_, {
glob: glob_,
globSync,
Expand Down
22 changes: 11 additions & 11 deletions node_modules/glob/dist/commonjs/pattern.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ class Pattern {
globString() {
return (this.#globString =
this.#globString ||
(this.#index === 0
? this.isAbsolute()
? this.#globList[0] + this.#globList.slice(1).join('/')
(this.#index === 0 ?
this.isAbsolute() ?
this.#globList[0] + this.#globList.slice(1).join('/')
: this.#globList.join('/')
: this.#globList.slice(this.#index).join('/')));
}
Expand Down Expand Up @@ -141,8 +141,8 @@ class Pattern {
*/
isUNC() {
const pl = this.#patternList;
return this.#isUNC !== undefined
? this.#isUNC
return this.#isUNC !== undefined ?
this.#isUNC
: (this.#isUNC =
this.#platform === 'win32' &&
this.#index === 0 &&
Expand All @@ -163,8 +163,8 @@ class Pattern {
*/
isDrive() {
const pl = this.#patternList;
return this.#isDrive !== undefined
? this.#isDrive
return this.#isDrive !== undefined ?
this.#isDrive
: (this.#isDrive =
this.#platform === 'win32' &&
this.#index === 0 &&
Expand All @@ -180,8 +180,8 @@ class Pattern {
*/
isAbsolute() {
const pl = this.#patternList;
return this.#isAbsolute !== undefined
? this.#isAbsolute
return this.#isAbsolute !== undefined ?
this.#isAbsolute
: (this.#isAbsolute =
(pl[0] === '' && pl.length > 1) ||
this.isDrive() ||
Expand All @@ -192,8 +192,8 @@ class Pattern {
*/
root() {
const p = this.#patternList[0];
return typeof p === 'string' && this.isAbsolute() && this.#index === 0
? p
return (typeof p === 'string' && this.isAbsolute() && this.#index === 0) ?
p
: '';
}
/**
Expand Down
9 changes: 4 additions & 5 deletions node_modules/glob/dist/commonjs/processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,8 @@ class Processor {
this.opts = opts;
this.follow = !!opts.follow;
this.dot = !!opts.dot;
this.hasWalkedCache = hasWalkedCache
? hasWalkedCache.copy()
: new HasWalkedCache();
this.hasWalkedCache =
hasWalkedCache ? hasWalkedCache.copy() : new HasWalkedCache();
}
processPatterns(target, patterns) {
this.patterns = patterns;
Expand All @@ -118,8 +117,8 @@ class Processor {
const absolute = pattern.isAbsolute() && this.opts.absolute !== false;
// start absolute patterns at root
if (root) {
t = t.resolve(root === '/' && this.opts.root !== undefined
? this.opts.root
t = t.resolve(root === '/' && this.opts.root !== undefined ?
this.opts.root
: root);
const rest = pattern.rest();
if (!rest) {
Expand Down
Loading

0 comments on commit 18b42a4

Please sign in to comment.