Content-Length: 451406 | pFad | https://github.com/npm/cli/commit/7b0542028f9c3cc326c26a1986c34cec7eb04931

19 deps: fdir@6.4.6 · npm/cli@7b05420 · GitHub
Skip to content

Commit 7b05420

Browse files
committed
deps: fdir@6.4.6
1 parent e1a3b23 commit 7b05420

File tree

12 files changed

+1416
-100
lines changed

12 files changed

+1416
-100
lines changed

node_modules/tinyglobby/node_modules/fdir/dist/api/functions/is-recursive-symlink.js

Lines changed: 0 additions & 35 deletions
This file was deleted.

node_modules/tinyglobby/node_modules/fdir/dist/api/functions/walk-directory.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ exports.build = void 0;
77
const fs_1 = __importDefault(require("fs"));
88
const readdirOpts = { withFileTypes: true };
99
const walkAsync = (state, crawlPath, directoryPath, currentDepth, callback) => {
10+
state.queue.enqueue();
1011
if (currentDepth < 0)
1112
return state.queue.dequeue(null, state);
1213
state.visited.push(crawlPath);
1314
state.counts.directories++;
14-
state.queue.enqueue();
1515
// Perf: Node >= 10 introduced withFileTypes that helps us
1616
// skip an extra fs.stat call.
1717
fs_1.default.readdir(crawlPath || ".", readdirOpts, (error, entries = []) => {

node_modules/tinyglobby/node_modules/fdir/dist/api/queue.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,16 @@ class Queue {
1414
}
1515
enqueue() {
1616
this.count++;
17+
return this.count;
1718
}
1819
dequeue(error, output) {
19-
if (--this.count <= 0 || error)
20+
if (this.onQueueEmpty && (--this.count <= 0 || error)) {
2021
this.onQueueEmpty(error, output);
22+
if (error) {
23+
output.controller.abort();
24+
this.onQueueEmpty = undefined;
25+
}
26+
}
2127
}
2228
}
2329
exports.Queue = Queue;

node_modules/tinyglobby/node_modules/fdir/dist/api/walker.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ class Walker {
6262
queue: new queue_1.Queue((error, state) => this.callbackInvoker(state, error, callback)),
6363
symlinks: new Map(),
6464
visited: [""].slice(0, 0),
65+
controller: new AbortController(),
6566
};
6667
/*
6768
* Perf: We conditionally change functions according to options. This gives a slight
@@ -77,14 +78,16 @@ class Walker {
7778
this.walkDirectory = walkDirectory.build(this.isSynchronous);
7879
}
7980
start() {
81+
this.pushDirectory(this.root, this.state.paths, this.state.options.filters);
8082
this.walkDirectory(this.state, this.root, this.root, this.state.options.maxDepth, this.walk);
8183
return this.isSynchronous ? this.callbackInvoker(this.state, null) : null;
8284
}
8385
walk = (entries, directoryPath, depth) => {
84-
const { paths, options: { filters, resolveSymlinks, excludeSymlinks, exclude, maxFiles, signal, useRealPaths, pathSeparator, }, } = this.state;
85-
if ((signal && signal.aborted) || (maxFiles && paths.length > maxFiles))
86+
const { paths, options: { filters, resolveSymlinks, excludeSymlinks, exclude, maxFiles, signal, useRealPaths, pathSeparator, }, controller, } = this.state;
87+
if (controller.signal.aborted ||
88+
(signal && signal.aborted) ||
89+
(maxFiles && paths.length > maxFiles))
8690
return;
87-
this.pushDirectory(directoryPath, paths, filters);
8891
const files = this.getArray(this.state.paths);
8992
for (let i = 0; i < entries.length; ++i) {
9093
const entry = entries[i];
@@ -97,9 +100,10 @@ class Walker {
97100
let path = joinPath.joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
98101
if (exclude && exclude(entry.name, path))
99102
continue;
103+
this.pushDirectory(path, paths, filters);
100104
this.walkDirectory(this.state, path, path, depth - 1, this.walk);
101105
}
102-
else if (entry.isSymbolicLink() && this.resolveSymlink) {
106+
else if (this.resolveSymlink && entry.isSymbolicLink()) {
103107
let path = joinPath.joinPathWithBasePath(entry.name, directoryPath);
104108
this.resolveSymlink(path, this.state, (stat, resolvedPath) => {
105109
if (stat.isDirectory()) {

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/npm/cli/commit/7b0542028f9c3cc326c26a1986c34cec7eb04931

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy