This commit is contained in:
Jonasz Bigda
2023-03-25 21:51:42 +01:00
parent 0db1d5117e
commit b332e9ceb0
1044 changed files with 37502 additions and 63938 deletions

17
node_modules/readdirp/index.js generated vendored
View File

@@ -21,7 +21,8 @@ const realpath = promisify(fs.realpath);
*/
const BANG = '!';
const NORMAL_FLOW_ERRORS = new Set(['ENOENT', 'EPERM', 'EACCES', 'ELOOP']);
const RECURSIVE_ERROR_CODE = 'READDIRP_RECURSIVE_ERROR';
const NORMAL_FLOW_ERRORS = new Set(['ENOENT', 'EPERM', 'EACCES', 'ELOOP', RECURSIVE_ERROR_CODE]);
const FILE_TYPE = 'files';
const DIR_TYPE = 'directories';
const FILE_DIR_TYPE = 'files_directories';
@@ -29,6 +30,8 @@ const EVERYTHING_TYPE = 'all';
const ALL_TYPES = [FILE_TYPE, DIR_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE];
const isNormalFlowError = error => NORMAL_FLOW_ERRORS.has(error.code);
const [maj, min] = process.versions.node.split('.').slice(0, 2).map(n => Number.parseInt(n, 10));
const wantBigintFsStats = process.platform === 'win32' && (maj > 10 || (maj === 10 && min >= 5));
const normalizeFilter = filter => {
if (filter === undefined) return;
@@ -91,7 +94,7 @@ class ReaddirpStream extends Readable {
const statMethod = opts.lstat ? lstat : stat;
// Use bigint stats if it's windows and stat() supports options (node 10+).
if (process.platform === 'win32' && stat.length === 3) {
if (wantBigintFsStats) {
this._stat = path => statMethod(path, { bigint: true });
} else {
this._stat = statMethod;
@@ -166,7 +169,7 @@ class ReaddirpStream extends Readable {
} catch (error) {
this._onError(error);
}
return {files, depth, path};
return { files, depth, path };
}
async _formatEntry(dirent, path) {
@@ -174,7 +177,7 @@ class ReaddirpStream extends Readable {
try {
const basename = this._isDirent ? dirent.name : dirent;
const fullPath = sysPath.resolve(sysPath.join(path, basename));
entry = {path: sysPath.relative(this._root, fullPath), fullPath, basename};
entry = { path: sysPath.relative(this._root, fullPath), fullPath, basename };
entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
} catch (err) {
this._onError(err);
@@ -214,9 +217,11 @@ class ReaddirpStream extends Readable {
if (entryRealPathStats.isDirectory()) {
const len = entryRealPath.length;
if (full.startsWith(entryRealPath) && full.substr(len, 1) === sysPath.sep) {
return this._onError(new Error(
const recursiveError = new Error(
`Circular symlink detected: "${full}" points to "${entryRealPath}"`
));
);
recursiveError.code = RECURSIVE_ERROR_CODE;
return this._onError(recursiveError);
}
return 'directory';
}