format: prettify entire project
This commit is contained in:
34
node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts
generated
vendored
34
node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts
generated
vendored
@ -1,20 +1,32 @@
|
||||
import type * as fsStat from '@nodelib/fs.stat';
|
||||
import type { Dirent, ErrnoException } from '../types';
|
||||
export interface ReaddirAsynchronousMethod {
|
||||
(filepath: string, options: {
|
||||
withFileTypes: true;
|
||||
}, callback: (error: ErrnoException | null, files: Dirent[]) => void): void;
|
||||
(filepath: string, callback: (error: ErrnoException | null, files: string[]) => void): void;
|
||||
(
|
||||
filepath: string,
|
||||
options: {
|
||||
withFileTypes: true;
|
||||
},
|
||||
callback: (error: ErrnoException | null, files: Dirent[]) => void
|
||||
): void;
|
||||
(
|
||||
filepath: string,
|
||||
callback: (error: ErrnoException | null, files: string[]) => void
|
||||
): void;
|
||||
}
|
||||
export interface ReaddirSynchronousMethod {
|
||||
(filepath: string, options: {
|
||||
withFileTypes: true;
|
||||
}): Dirent[];
|
||||
(filepath: string): string[];
|
||||
(
|
||||
filepath: string,
|
||||
options: {
|
||||
withFileTypes: true;
|
||||
}
|
||||
): Dirent[];
|
||||
(filepath: string): string[];
|
||||
}
|
||||
export declare type FileSystemAdapter = fsStat.FileSystemAdapter & {
|
||||
readdir: ReaddirAsynchronousMethod;
|
||||
readdirSync: ReaddirSynchronousMethod;
|
||||
readdir: ReaddirAsynchronousMethod;
|
||||
readdirSync: ReaddirSynchronousMethod;
|
||||
};
|
||||
export declare const FILE_SYSTEM_ADAPTER: FileSystemAdapter;
|
||||
export declare function createFileSystemAdapter(fsMethods?: Partial<FileSystemAdapter>): FileSystemAdapter;
|
||||
export declare function createFileSystemAdapter(
|
||||
fsMethods?: Partial<FileSystemAdapter>
|
||||
): FileSystemAdapter;
|
||||
|
29
node_modules/@nodelib/fs.scandir/out/adapters/fs.js
generated
vendored
29
node_modules/@nodelib/fs.scandir/out/adapters/fs.js
generated
vendored
@ -1,19 +1,22 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
|
||||
const fs = require("fs");
|
||||
const fs = require('fs');
|
||||
exports.FILE_SYSTEM_ADAPTER = {
|
||||
lstat: fs.lstat,
|
||||
stat: fs.stat,
|
||||
lstatSync: fs.lstatSync,
|
||||
statSync: fs.statSync,
|
||||
readdir: fs.readdir,
|
||||
readdirSync: fs.readdirSync
|
||||
lstat: fs.lstat,
|
||||
stat: fs.stat,
|
||||
lstatSync: fs.lstatSync,
|
||||
statSync: fs.statSync,
|
||||
readdir: fs.readdir,
|
||||
readdirSync: fs.readdirSync,
|
||||
};
|
||||
function createFileSystemAdapter(fsMethods) {
|
||||
if (fsMethods === undefined) {
|
||||
return exports.FILE_SYSTEM_ADAPTER;
|
||||
}
|
||||
return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
|
||||
if (fsMethods === undefined) {
|
||||
return exports.FILE_SYSTEM_ADAPTER;
|
||||
}
|
||||
return Object.assign(
|
||||
Object.assign({}, exports.FILE_SYSTEM_ADAPTER),
|
||||
fsMethods
|
||||
);
|
||||
}
|
||||
exports.createFileSystemAdapter = createFileSystemAdapter;
|
||||
|
20
node_modules/@nodelib/fs.scandir/out/constants.js
generated
vendored
20
node_modules/@nodelib/fs.scandir/out/constants.js
generated
vendored
@ -1,17 +1,25 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = void 0;
|
||||
const NODE_PROCESS_VERSION_PARTS = process.versions.node.split('.');
|
||||
if (NODE_PROCESS_VERSION_PARTS[0] === undefined || NODE_PROCESS_VERSION_PARTS[1] === undefined) {
|
||||
throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);
|
||||
if (
|
||||
NODE_PROCESS_VERSION_PARTS[0] === undefined ||
|
||||
NODE_PROCESS_VERSION_PARTS[1] === undefined
|
||||
) {
|
||||
throw new Error(
|
||||
`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`
|
||||
);
|
||||
}
|
||||
const MAJOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[0], 10);
|
||||
const MINOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[1], 10);
|
||||
const SUPPORTED_MAJOR_VERSION = 10;
|
||||
const SUPPORTED_MINOR_VERSION = 10;
|
||||
const IS_MATCHED_BY_MAJOR = MAJOR_VERSION > SUPPORTED_MAJOR_VERSION;
|
||||
const IS_MATCHED_BY_MAJOR_AND_MINOR = MAJOR_VERSION === SUPPORTED_MAJOR_VERSION && MINOR_VERSION >= SUPPORTED_MINOR_VERSION;
|
||||
const IS_MATCHED_BY_MAJOR_AND_MINOR =
|
||||
MAJOR_VERSION === SUPPORTED_MAJOR_VERSION &&
|
||||
MINOR_VERSION >= SUPPORTED_MINOR_VERSION;
|
||||
/**
|
||||
* IS `true` for Node.js 10.10 and greater.
|
||||
*/
|
||||
exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_BY_MAJOR_AND_MINOR;
|
||||
exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES =
|
||||
IS_MATCHED_BY_MAJOR || IS_MATCHED_BY_MAJOR_AND_MINOR;
|
||||
|
35
node_modules/@nodelib/fs.scandir/out/index.d.ts
generated
vendored
35
node_modules/@nodelib/fs.scandir/out/index.d.ts
generated
vendored
@ -1,12 +1,37 @@
|
||||
import type { FileSystemAdapter, ReaddirAsynchronousMethod, ReaddirSynchronousMethod } from './adapters/fs';
|
||||
import type {
|
||||
FileSystemAdapter,
|
||||
ReaddirAsynchronousMethod,
|
||||
ReaddirSynchronousMethod,
|
||||
} from './adapters/fs';
|
||||
import * as async from './providers/async';
|
||||
import Settings, { Options } from './settings';
|
||||
import type { Dirent, Entry } from './types';
|
||||
declare type AsyncCallback = async.AsyncCallback;
|
||||
declare function scandir(path: string, callback: AsyncCallback): void;
|
||||
declare function scandir(path: string, optionsOrSettings: Options | Settings, callback: AsyncCallback): void;
|
||||
declare function scandir(
|
||||
path: string,
|
||||
optionsOrSettings: Options | Settings,
|
||||
callback: AsyncCallback
|
||||
): void;
|
||||
declare namespace scandir {
|
||||
function __promisify__(path: string, optionsOrSettings?: Options | Settings): Promise<Entry[]>;
|
||||
function __promisify__(
|
||||
path: string,
|
||||
optionsOrSettings?: Options | Settings
|
||||
): Promise<Entry[]>;
|
||||
}
|
||||
declare function scandirSync(path: string, optionsOrSettings?: Options | Settings): Entry[];
|
||||
export { scandir, scandirSync, Settings, AsyncCallback, Dirent, Entry, FileSystemAdapter, ReaddirAsynchronousMethod, ReaddirSynchronousMethod, Options };
|
||||
declare function scandirSync(
|
||||
path: string,
|
||||
optionsOrSettings?: Options | Settings
|
||||
): Entry[];
|
||||
export {
|
||||
scandir,
|
||||
scandirSync,
|
||||
Settings,
|
||||
AsyncCallback,
|
||||
Dirent,
|
||||
Entry,
|
||||
FileSystemAdapter,
|
||||
ReaddirAsynchronousMethod,
|
||||
ReaddirSynchronousMethod,
|
||||
Options,
|
||||
};
|
||||
|
32
node_modules/@nodelib/fs.scandir/out/index.js
generated
vendored
32
node_modules/@nodelib/fs.scandir/out/index.js
generated
vendored
@ -1,26 +1,26 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
exports.Settings = exports.scandirSync = exports.scandir = void 0;
|
||||
const async = require("./providers/async");
|
||||
const sync = require("./providers/sync");
|
||||
const settings_1 = require("./settings");
|
||||
const async = require('./providers/async');
|
||||
const sync = require('./providers/sync');
|
||||
const settings_1 = require('./settings');
|
||||
exports.Settings = settings_1.default;
|
||||
function scandir(path, optionsOrSettingsOrCallback, callback) {
|
||||
if (typeof optionsOrSettingsOrCallback === 'function') {
|
||||
async.read(path, getSettings(), optionsOrSettingsOrCallback);
|
||||
return;
|
||||
}
|
||||
async.read(path, getSettings(optionsOrSettingsOrCallback), callback);
|
||||
if (typeof optionsOrSettingsOrCallback === 'function') {
|
||||
async.read(path, getSettings(), optionsOrSettingsOrCallback);
|
||||
return;
|
||||
}
|
||||
async.read(path, getSettings(optionsOrSettingsOrCallback), callback);
|
||||
}
|
||||
exports.scandir = scandir;
|
||||
function scandirSync(path, optionsOrSettings) {
|
||||
const settings = getSettings(optionsOrSettings);
|
||||
return sync.read(path, settings);
|
||||
const settings = getSettings(optionsOrSettings);
|
||||
return sync.read(path, settings);
|
||||
}
|
||||
exports.scandirSync = scandirSync;
|
||||
function getSettings(settingsOrOptions = {}) {
|
||||
if (settingsOrOptions instanceof settings_1.default) {
|
||||
return settingsOrOptions;
|
||||
}
|
||||
return new settings_1.default(settingsOrOptions);
|
||||
if (settingsOrOptions instanceof settings_1.default) {
|
||||
return settingsOrOptions;
|
||||
}
|
||||
return new settings_1.default(settingsOrOptions);
|
||||
}
|
||||
|
23
node_modules/@nodelib/fs.scandir/out/providers/async.d.ts
generated
vendored
23
node_modules/@nodelib/fs.scandir/out/providers/async.d.ts
generated
vendored
@ -1,7 +1,22 @@
|
||||
/// <reference types="node" />
|
||||
import type Settings from '../settings';
|
||||
import type { Entry } from '../types';
|
||||
export declare type AsyncCallback = (error: NodeJS.ErrnoException, entries: Entry[]) => void;
|
||||
export declare function read(directory: string, settings: Settings, callback: AsyncCallback): void;
|
||||
export declare function readdirWithFileTypes(directory: string, settings: Settings, callback: AsyncCallback): void;
|
||||
export declare function readdir(directory: string, settings: Settings, callback: AsyncCallback): void;
|
||||
export declare type AsyncCallback = (
|
||||
error: NodeJS.ErrnoException,
|
||||
entries: Entry[]
|
||||
) => void;
|
||||
export declare function read(
|
||||
directory: string,
|
||||
settings: Settings,
|
||||
callback: AsyncCallback
|
||||
): void;
|
||||
export declare function readdirWithFileTypes(
|
||||
directory: string,
|
||||
settings: Settings,
|
||||
callback: AsyncCallback
|
||||
): void;
|
||||
export declare function readdir(
|
||||
directory: string,
|
||||
settings: Settings,
|
||||
callback: AsyncCallback
|
||||
): void;
|
||||
|
178
node_modules/@nodelib/fs.scandir/out/providers/async.js
generated
vendored
178
node_modules/@nodelib/fs.scandir/out/providers/async.js
generated
vendored
@ -1,104 +1,116 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
exports.readdir = exports.readdirWithFileTypes = exports.read = void 0;
|
||||
const fsStat = require("@nodelib/fs.stat");
|
||||
const rpl = require("run-parallel");
|
||||
const constants_1 = require("../constants");
|
||||
const utils = require("../utils");
|
||||
const common = require("./common");
|
||||
const fsStat = require('@nodelib/fs.stat');
|
||||
const rpl = require('run-parallel');
|
||||
const constants_1 = require('../constants');
|
||||
const utils = require('../utils');
|
||||
const common = require('./common');
|
||||
function read(directory, settings, callback) {
|
||||
if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
||||
readdirWithFileTypes(directory, settings, callback);
|
||||
return;
|
||||
}
|
||||
readdir(directory, settings, callback);
|
||||
if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
||||
readdirWithFileTypes(directory, settings, callback);
|
||||
return;
|
||||
}
|
||||
readdir(directory, settings, callback);
|
||||
}
|
||||
exports.read = read;
|
||||
function readdirWithFileTypes(directory, settings, callback) {
|
||||
settings.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => {
|
||||
if (readdirError !== null) {
|
||||
callFailureCallback(callback, readdirError);
|
||||
return;
|
||||
settings.fs.readdir(
|
||||
directory,
|
||||
{ withFileTypes: true },
|
||||
(readdirError, dirents) => {
|
||||
if (readdirError !== null) {
|
||||
callFailureCallback(callback, readdirError);
|
||||
return;
|
||||
}
|
||||
const entries = dirents.map((dirent) => ({
|
||||
dirent,
|
||||
name: dirent.name,
|
||||
path: common.joinPathSegments(
|
||||
directory,
|
||||
dirent.name,
|
||||
settings.pathSegmentSeparator
|
||||
),
|
||||
}));
|
||||
if (!settings.followSymbolicLinks) {
|
||||
callSuccessCallback(callback, entries);
|
||||
return;
|
||||
}
|
||||
const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings));
|
||||
rpl(tasks, (rplError, rplEntries) => {
|
||||
if (rplError !== null) {
|
||||
callFailureCallback(callback, rplError);
|
||||
return;
|
||||
}
|
||||
const entries = dirents.map((dirent) => ({
|
||||
dirent,
|
||||
name: dirent.name,
|
||||
path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
|
||||
}));
|
||||
if (!settings.followSymbolicLinks) {
|
||||
callSuccessCallback(callback, entries);
|
||||
return;
|
||||
}
|
||||
const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings));
|
||||
rpl(tasks, (rplError, rplEntries) => {
|
||||
if (rplError !== null) {
|
||||
callFailureCallback(callback, rplError);
|
||||
return;
|
||||
}
|
||||
callSuccessCallback(callback, rplEntries);
|
||||
});
|
||||
});
|
||||
callSuccessCallback(callback, rplEntries);
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
exports.readdirWithFileTypes = readdirWithFileTypes;
|
||||
function makeRplTaskEntry(entry, settings) {
|
||||
return (done) => {
|
||||
if (!entry.dirent.isSymbolicLink()) {
|
||||
done(null, entry);
|
||||
return;
|
||||
return (done) => {
|
||||
if (!entry.dirent.isSymbolicLink()) {
|
||||
done(null, entry);
|
||||
return;
|
||||
}
|
||||
settings.fs.stat(entry.path, (statError, stats) => {
|
||||
if (statError !== null) {
|
||||
if (settings.throwErrorOnBrokenSymbolicLink) {
|
||||
done(statError);
|
||||
return;
|
||||
}
|
||||
settings.fs.stat(entry.path, (statError, stats) => {
|
||||
if (statError !== null) {
|
||||
if (settings.throwErrorOnBrokenSymbolicLink) {
|
||||
done(statError);
|
||||
return;
|
||||
}
|
||||
done(null, entry);
|
||||
return;
|
||||
}
|
||||
entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
|
||||
done(null, entry);
|
||||
});
|
||||
};
|
||||
done(null, entry);
|
||||
return;
|
||||
}
|
||||
entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
|
||||
done(null, entry);
|
||||
});
|
||||
};
|
||||
}
|
||||
function readdir(directory, settings, callback) {
|
||||
settings.fs.readdir(directory, (readdirError, names) => {
|
||||
if (readdirError !== null) {
|
||||
callFailureCallback(callback, readdirError);
|
||||
settings.fs.readdir(directory, (readdirError, names) => {
|
||||
if (readdirError !== null) {
|
||||
callFailureCallback(callback, readdirError);
|
||||
return;
|
||||
}
|
||||
const tasks = names.map((name) => {
|
||||
const path = common.joinPathSegments(
|
||||
directory,
|
||||
name,
|
||||
settings.pathSegmentSeparator
|
||||
);
|
||||
return (done) => {
|
||||
fsStat.stat(path, settings.fsStatSettings, (error, stats) => {
|
||||
if (error !== null) {
|
||||
done(error);
|
||||
return;
|
||||
}
|
||||
const tasks = names.map((name) => {
|
||||
const path = common.joinPathSegments(directory, name, settings.pathSegmentSeparator);
|
||||
return (done) => {
|
||||
fsStat.stat(path, settings.fsStatSettings, (error, stats) => {
|
||||
if (error !== null) {
|
||||
done(error);
|
||||
return;
|
||||
}
|
||||
const entry = {
|
||||
name,
|
||||
path,
|
||||
dirent: utils.fs.createDirentFromStats(name, stats)
|
||||
};
|
||||
if (settings.stats) {
|
||||
entry.stats = stats;
|
||||
}
|
||||
done(null, entry);
|
||||
});
|
||||
};
|
||||
});
|
||||
rpl(tasks, (rplError, entries) => {
|
||||
if (rplError !== null) {
|
||||
callFailureCallback(callback, rplError);
|
||||
return;
|
||||
}
|
||||
callSuccessCallback(callback, entries);
|
||||
}
|
||||
const entry = {
|
||||
name,
|
||||
path,
|
||||
dirent: utils.fs.createDirentFromStats(name, stats),
|
||||
};
|
||||
if (settings.stats) {
|
||||
entry.stats = stats;
|
||||
}
|
||||
done(null, entry);
|
||||
});
|
||||
};
|
||||
});
|
||||
rpl(tasks, (rplError, entries) => {
|
||||
if (rplError !== null) {
|
||||
callFailureCallback(callback, rplError);
|
||||
return;
|
||||
}
|
||||
callSuccessCallback(callback, entries);
|
||||
});
|
||||
});
|
||||
}
|
||||
exports.readdir = readdir;
|
||||
function callFailureCallback(callback, error) {
|
||||
callback(error);
|
||||
callback(error);
|
||||
}
|
||||
function callSuccessCallback(callback, result) {
|
||||
callback(null, result);
|
||||
callback(null, result);
|
||||
}
|
||||
|
6
node_modules/@nodelib/fs.scandir/out/providers/common.d.ts
generated
vendored
6
node_modules/@nodelib/fs.scandir/out/providers/common.d.ts
generated
vendored
@ -1 +1,5 @@
|
||||
export declare function joinPathSegments(a: string, b: string, separator: string): string;
|
||||
export declare function joinPathSegments(
|
||||
a: string,
|
||||
b: string,
|
||||
separator: string
|
||||
): string;
|
||||
|
18
node_modules/@nodelib/fs.scandir/out/providers/common.js
generated
vendored
18
node_modules/@nodelib/fs.scandir/out/providers/common.js
generated
vendored
@ -1,13 +1,13 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
exports.joinPathSegments = void 0;
|
||||
function joinPathSegments(a, b, separator) {
|
||||
/**
|
||||
* The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`).
|
||||
*/
|
||||
if (a.endsWith(separator)) {
|
||||
return a + b;
|
||||
}
|
||||
return a + separator + b;
|
||||
/**
|
||||
* The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`).
|
||||
*/
|
||||
if (a.endsWith(separator)) {
|
||||
return a + b;
|
||||
}
|
||||
return a + separator + b;
|
||||
}
|
||||
exports.joinPathSegments = joinPathSegments;
|
||||
|
5
node_modules/@nodelib/fs.scandir/out/providers/sync.d.ts
generated
vendored
5
node_modules/@nodelib/fs.scandir/out/providers/sync.d.ts
generated
vendored
@ -1,5 +1,8 @@
|
||||
import type Settings from '../settings';
|
||||
import type { Entry } from '../types';
|
||||
export declare function read(directory: string, settings: Settings): Entry[];
|
||||
export declare function readdirWithFileTypes(directory: string, settings: Settings): Entry[];
|
||||
export declare function readdirWithFileTypes(
|
||||
directory: string,
|
||||
settings: Settings
|
||||
): Entry[];
|
||||
export declare function readdir(directory: string, settings: Settings): Entry[];
|
||||
|
93
node_modules/@nodelib/fs.scandir/out/providers/sync.js
generated
vendored
93
node_modules/@nodelib/fs.scandir/out/providers/sync.js
generated
vendored
@ -1,54 +1,61 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
exports.readdir = exports.readdirWithFileTypes = exports.read = void 0;
|
||||
const fsStat = require("@nodelib/fs.stat");
|
||||
const constants_1 = require("../constants");
|
||||
const utils = require("../utils");
|
||||
const common = require("./common");
|
||||
const fsStat = require('@nodelib/fs.stat');
|
||||
const constants_1 = require('../constants');
|
||||
const utils = require('../utils');
|
||||
const common = require('./common');
|
||||
function read(directory, settings) {
|
||||
if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
||||
return readdirWithFileTypes(directory, settings);
|
||||
}
|
||||
return readdir(directory, settings);
|
||||
if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
||||
return readdirWithFileTypes(directory, settings);
|
||||
}
|
||||
return readdir(directory, settings);
|
||||
}
|
||||
exports.read = read;
|
||||
function readdirWithFileTypes(directory, settings) {
|
||||
const dirents = settings.fs.readdirSync(directory, { withFileTypes: true });
|
||||
return dirents.map((dirent) => {
|
||||
const entry = {
|
||||
dirent,
|
||||
name: dirent.name,
|
||||
path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
|
||||
};
|
||||
if (entry.dirent.isSymbolicLink() && settings.followSymbolicLinks) {
|
||||
try {
|
||||
const stats = settings.fs.statSync(entry.path);
|
||||
entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
|
||||
}
|
||||
catch (error) {
|
||||
if (settings.throwErrorOnBrokenSymbolicLink) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
const dirents = settings.fs.readdirSync(directory, { withFileTypes: true });
|
||||
return dirents.map((dirent) => {
|
||||
const entry = {
|
||||
dirent,
|
||||
name: dirent.name,
|
||||
path: common.joinPathSegments(
|
||||
directory,
|
||||
dirent.name,
|
||||
settings.pathSegmentSeparator
|
||||
),
|
||||
};
|
||||
if (entry.dirent.isSymbolicLink() && settings.followSymbolicLinks) {
|
||||
try {
|
||||
const stats = settings.fs.statSync(entry.path);
|
||||
entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
|
||||
} catch (error) {
|
||||
if (settings.throwErrorOnBrokenSymbolicLink) {
|
||||
throw error;
|
||||
}
|
||||
return entry;
|
||||
});
|
||||
}
|
||||
}
|
||||
return entry;
|
||||
});
|
||||
}
|
||||
exports.readdirWithFileTypes = readdirWithFileTypes;
|
||||
function readdir(directory, settings) {
|
||||
const names = settings.fs.readdirSync(directory);
|
||||
return names.map((name) => {
|
||||
const entryPath = common.joinPathSegments(directory, name, settings.pathSegmentSeparator);
|
||||
const stats = fsStat.statSync(entryPath, settings.fsStatSettings);
|
||||
const entry = {
|
||||
name,
|
||||
path: entryPath,
|
||||
dirent: utils.fs.createDirentFromStats(name, stats)
|
||||
};
|
||||
if (settings.stats) {
|
||||
entry.stats = stats;
|
||||
}
|
||||
return entry;
|
||||
});
|
||||
const names = settings.fs.readdirSync(directory);
|
||||
return names.map((name) => {
|
||||
const entryPath = common.joinPathSegments(
|
||||
directory,
|
||||
name,
|
||||
settings.pathSegmentSeparator
|
||||
);
|
||||
const stats = fsStat.statSync(entryPath, settings.fsStatSettings);
|
||||
const entry = {
|
||||
name,
|
||||
path: entryPath,
|
||||
dirent: utils.fs.createDirentFromStats(name, stats),
|
||||
};
|
||||
if (settings.stats) {
|
||||
entry.stats = stats;
|
||||
}
|
||||
return entry;
|
||||
});
|
||||
}
|
||||
exports.readdir = readdir;
|
||||
|
28
node_modules/@nodelib/fs.scandir/out/settings.d.ts
generated
vendored
28
node_modules/@nodelib/fs.scandir/out/settings.d.ts
generated
vendored
@ -1,20 +1,20 @@
|
||||
import * as fsStat from '@nodelib/fs.stat';
|
||||
import * as fs from './adapters/fs';
|
||||
export interface Options {
|
||||
followSymbolicLinks?: boolean;
|
||||
fs?: Partial<fs.FileSystemAdapter>;
|
||||
pathSegmentSeparator?: string;
|
||||
stats?: boolean;
|
||||
throwErrorOnBrokenSymbolicLink?: boolean;
|
||||
followSymbolicLinks?: boolean;
|
||||
fs?: Partial<fs.FileSystemAdapter>;
|
||||
pathSegmentSeparator?: string;
|
||||
stats?: boolean;
|
||||
throwErrorOnBrokenSymbolicLink?: boolean;
|
||||
}
|
||||
export default class Settings {
|
||||
private readonly _options;
|
||||
readonly followSymbolicLinks: boolean;
|
||||
readonly fs: fs.FileSystemAdapter;
|
||||
readonly pathSegmentSeparator: string;
|
||||
readonly stats: boolean;
|
||||
readonly throwErrorOnBrokenSymbolicLink: boolean;
|
||||
readonly fsStatSettings: fsStat.Settings;
|
||||
constructor(_options?: Options);
|
||||
private _getValue;
|
||||
private readonly _options;
|
||||
readonly followSymbolicLinks: boolean;
|
||||
readonly fs: fs.FileSystemAdapter;
|
||||
readonly pathSegmentSeparator: string;
|
||||
readonly stats: boolean;
|
||||
readonly throwErrorOnBrokenSymbolicLink: boolean;
|
||||
readonly fsStatSettings: fsStat.Settings;
|
||||
constructor(_options?: Options);
|
||||
private _getValue;
|
||||
}
|
||||
|
51
node_modules/@nodelib/fs.scandir/out/settings.js
generated
vendored
51
node_modules/@nodelib/fs.scandir/out/settings.js
generated
vendored
@ -1,24 +1,33 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path = require("path");
|
||||
const fsStat = require("@nodelib/fs.stat");
|
||||
const fs = require("./adapters/fs");
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
const path = require('path');
|
||||
const fsStat = require('@nodelib/fs.stat');
|
||||
const fs = require('./adapters/fs');
|
||||
class Settings {
|
||||
constructor(_options = {}) {
|
||||
this._options = _options;
|
||||
this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
|
||||
this.fs = fs.createFileSystemAdapter(this._options.fs);
|
||||
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep);
|
||||
this.stats = this._getValue(this._options.stats, false);
|
||||
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
||||
this.fsStatSettings = new fsStat.Settings({
|
||||
followSymbolicLink: this.followSymbolicLinks,
|
||||
fs: this.fs,
|
||||
throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink
|
||||
});
|
||||
}
|
||||
_getValue(option, value) {
|
||||
return option !== null && option !== void 0 ? option : value;
|
||||
}
|
||||
constructor(_options = {}) {
|
||||
this._options = _options;
|
||||
this.followSymbolicLinks = this._getValue(
|
||||
this._options.followSymbolicLinks,
|
||||
false
|
||||
);
|
||||
this.fs = fs.createFileSystemAdapter(this._options.fs);
|
||||
this.pathSegmentSeparator = this._getValue(
|
||||
this._options.pathSegmentSeparator,
|
||||
path.sep
|
||||
);
|
||||
this.stats = this._getValue(this._options.stats, false);
|
||||
this.throwErrorOnBrokenSymbolicLink = this._getValue(
|
||||
this._options.throwErrorOnBrokenSymbolicLink,
|
||||
true
|
||||
);
|
||||
this.fsStatSettings = new fsStat.Settings({
|
||||
followSymbolicLink: this.followSymbolicLinks,
|
||||
fs: this.fs,
|
||||
throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink,
|
||||
});
|
||||
}
|
||||
_getValue(option, value) {
|
||||
return option !== null && option !== void 0 ? option : value;
|
||||
}
|
||||
}
|
||||
exports.default = Settings;
|
||||
|
24
node_modules/@nodelib/fs.scandir/out/types/index.d.ts
generated
vendored
24
node_modules/@nodelib/fs.scandir/out/types/index.d.ts
generated
vendored
@ -1,20 +1,20 @@
|
||||
/// <reference types="node" />
|
||||
import type * as fs from 'fs';
|
||||
export interface Entry {
|
||||
dirent: Dirent;
|
||||
name: string;
|
||||
path: string;
|
||||
stats?: Stats;
|
||||
dirent: Dirent;
|
||||
name: string;
|
||||
path: string;
|
||||
stats?: Stats;
|
||||
}
|
||||
export declare type Stats = fs.Stats;
|
||||
export declare type ErrnoException = NodeJS.ErrnoException;
|
||||
export interface Dirent {
|
||||
isBlockDevice: () => boolean;
|
||||
isCharacterDevice: () => boolean;
|
||||
isDirectory: () => boolean;
|
||||
isFIFO: () => boolean;
|
||||
isFile: () => boolean;
|
||||
isSocket: () => boolean;
|
||||
isSymbolicLink: () => boolean;
|
||||
name: string;
|
||||
isBlockDevice: () => boolean;
|
||||
isCharacterDevice: () => boolean;
|
||||
isDirectory: () => boolean;
|
||||
isFIFO: () => boolean;
|
||||
isFile: () => boolean;
|
||||
isSocket: () => boolean;
|
||||
isSymbolicLink: () => boolean;
|
||||
name: string;
|
||||
}
|
||||
|
4
node_modules/@nodelib/fs.scandir/out/types/index.js
generated
vendored
4
node_modules/@nodelib/fs.scandir/out/types/index.js
generated
vendored
@ -1,2 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
5
node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts
generated
vendored
5
node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts
generated
vendored
@ -1,2 +1,5 @@
|
||||
import type { Dirent, Stats } from '../types';
|
||||
export declare function createDirentFromStats(name: string, stats: Stats): Dirent;
|
||||
export declare function createDirentFromStats(
|
||||
name: string,
|
||||
stats: Stats
|
||||
): Dirent;
|
||||
|
26
node_modules/@nodelib/fs.scandir/out/utils/fs.js
generated
vendored
26
node_modules/@nodelib/fs.scandir/out/utils/fs.js
generated
vendored
@ -1,19 +1,19 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
exports.createDirentFromStats = void 0;
|
||||
class DirentFromStats {
|
||||
constructor(name, stats) {
|
||||
this.name = name;
|
||||
this.isBlockDevice = stats.isBlockDevice.bind(stats);
|
||||
this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
|
||||
this.isDirectory = stats.isDirectory.bind(stats);
|
||||
this.isFIFO = stats.isFIFO.bind(stats);
|
||||
this.isFile = stats.isFile.bind(stats);
|
||||
this.isSocket = stats.isSocket.bind(stats);
|
||||
this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
|
||||
}
|
||||
constructor(name, stats) {
|
||||
this.name = name;
|
||||
this.isBlockDevice = stats.isBlockDevice.bind(stats);
|
||||
this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
|
||||
this.isDirectory = stats.isDirectory.bind(stats);
|
||||
this.isFIFO = stats.isFIFO.bind(stats);
|
||||
this.isFile = stats.isFile.bind(stats);
|
||||
this.isSocket = stats.isSocket.bind(stats);
|
||||
this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
|
||||
}
|
||||
}
|
||||
function createDirentFromStats(name, stats) {
|
||||
return new DirentFromStats(name, stats);
|
||||
return new DirentFromStats(name, stats);
|
||||
}
|
||||
exports.createDirentFromStats = createDirentFromStats;
|
||||
|
6
node_modules/@nodelib/fs.scandir/out/utils/index.js
generated
vendored
6
node_modules/@nodelib/fs.scandir/out/utils/index.js
generated
vendored
@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
exports.fs = void 0;
|
||||
const fs = require("./fs");
|
||||
const fs = require('./fs');
|
||||
exports.fs = fs;
|
||||
|
17
node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts
generated
vendored
17
node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts
generated
vendored
@ -1,13 +1,18 @@
|
||||
/// <reference types="node" />
|
||||
import * as fs from 'fs';
|
||||
import type { ErrnoException } from '../types';
|
||||
export declare type StatAsynchronousMethod = (path: string, callback: (error: ErrnoException | null, stats: fs.Stats) => void) => void;
|
||||
export declare type StatAsynchronousMethod = (
|
||||
path: string,
|
||||
callback: (error: ErrnoException | null, stats: fs.Stats) => void
|
||||
) => void;
|
||||
export declare type StatSynchronousMethod = (path: string) => fs.Stats;
|
||||
export interface FileSystemAdapter {
|
||||
lstat: StatAsynchronousMethod;
|
||||
stat: StatAsynchronousMethod;
|
||||
lstatSync: StatSynchronousMethod;
|
||||
statSync: StatSynchronousMethod;
|
||||
lstat: StatAsynchronousMethod;
|
||||
stat: StatAsynchronousMethod;
|
||||
lstatSync: StatSynchronousMethod;
|
||||
statSync: StatSynchronousMethod;
|
||||
}
|
||||
export declare const FILE_SYSTEM_ADAPTER: FileSystemAdapter;
|
||||
export declare function createFileSystemAdapter(fsMethods?: Partial<FileSystemAdapter>): FileSystemAdapter;
|
||||
export declare function createFileSystemAdapter(
|
||||
fsMethods?: Partial<FileSystemAdapter>
|
||||
): FileSystemAdapter;
|
||||
|
25
node_modules/@nodelib/fs.stat/out/adapters/fs.js
generated
vendored
25
node_modules/@nodelib/fs.stat/out/adapters/fs.js
generated
vendored
@ -1,17 +1,20 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
|
||||
const fs = require("fs");
|
||||
const fs = require('fs');
|
||||
exports.FILE_SYSTEM_ADAPTER = {
|
||||
lstat: fs.lstat,
|
||||
stat: fs.stat,
|
||||
lstatSync: fs.lstatSync,
|
||||
statSync: fs.statSync
|
||||
lstat: fs.lstat,
|
||||
stat: fs.stat,
|
||||
lstatSync: fs.lstatSync,
|
||||
statSync: fs.statSync,
|
||||
};
|
||||
function createFileSystemAdapter(fsMethods) {
|
||||
if (fsMethods === undefined) {
|
||||
return exports.FILE_SYSTEM_ADAPTER;
|
||||
}
|
||||
return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
|
||||
if (fsMethods === undefined) {
|
||||
return exports.FILE_SYSTEM_ADAPTER;
|
||||
}
|
||||
return Object.assign(
|
||||
Object.assign({}, exports.FILE_SYSTEM_ADAPTER),
|
||||
fsMethods
|
||||
);
|
||||
}
|
||||
exports.createFileSystemAdapter = createFileSystemAdapter;
|
||||
|
34
node_modules/@nodelib/fs.stat/out/index.d.ts
generated
vendored
34
node_modules/@nodelib/fs.stat/out/index.d.ts
generated
vendored
@ -1,12 +1,36 @@
|
||||
import type { FileSystemAdapter, StatAsynchronousMethod, StatSynchronousMethod } from './adapters/fs';
|
||||
import type {
|
||||
FileSystemAdapter,
|
||||
StatAsynchronousMethod,
|
||||
StatSynchronousMethod,
|
||||
} from './adapters/fs';
|
||||
import * as async from './providers/async';
|
||||
import Settings, { Options } from './settings';
|
||||
import type { Stats } from './types';
|
||||
declare type AsyncCallback = async.AsyncCallback;
|
||||
declare function stat(path: string, callback: AsyncCallback): void;
|
||||
declare function stat(path: string, optionsOrSettings: Options | Settings, callback: AsyncCallback): void;
|
||||
declare function stat(
|
||||
path: string,
|
||||
optionsOrSettings: Options | Settings,
|
||||
callback: AsyncCallback
|
||||
): void;
|
||||
declare namespace stat {
|
||||
function __promisify__(path: string, optionsOrSettings?: Options | Settings): Promise<Stats>;
|
||||
function __promisify__(
|
||||
path: string,
|
||||
optionsOrSettings?: Options | Settings
|
||||
): Promise<Stats>;
|
||||
}
|
||||
declare function statSync(path: string, optionsOrSettings?: Options | Settings): Stats;
|
||||
export { Settings, stat, statSync, AsyncCallback, FileSystemAdapter, StatAsynchronousMethod, StatSynchronousMethod, Options, Stats };
|
||||
declare function statSync(
|
||||
path: string,
|
||||
optionsOrSettings?: Options | Settings
|
||||
): Stats;
|
||||
export {
|
||||
Settings,
|
||||
stat,
|
||||
statSync,
|
||||
AsyncCallback,
|
||||
FileSystemAdapter,
|
||||
StatAsynchronousMethod,
|
||||
StatSynchronousMethod,
|
||||
Options,
|
||||
Stats,
|
||||
};
|
||||
|
32
node_modules/@nodelib/fs.stat/out/index.js
generated
vendored
32
node_modules/@nodelib/fs.stat/out/index.js
generated
vendored
@ -1,26 +1,26 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
exports.statSync = exports.stat = exports.Settings = void 0;
|
||||
const async = require("./providers/async");
|
||||
const sync = require("./providers/sync");
|
||||
const settings_1 = require("./settings");
|
||||
const async = require('./providers/async');
|
||||
const sync = require('./providers/sync');
|
||||
const settings_1 = require('./settings');
|
||||
exports.Settings = settings_1.default;
|
||||
function stat(path, optionsOrSettingsOrCallback, callback) {
|
||||
if (typeof optionsOrSettingsOrCallback === 'function') {
|
||||
async.read(path, getSettings(), optionsOrSettingsOrCallback);
|
||||
return;
|
||||
}
|
||||
async.read(path, getSettings(optionsOrSettingsOrCallback), callback);
|
||||
if (typeof optionsOrSettingsOrCallback === 'function') {
|
||||
async.read(path, getSettings(), optionsOrSettingsOrCallback);
|
||||
return;
|
||||
}
|
||||
async.read(path, getSettings(optionsOrSettingsOrCallback), callback);
|
||||
}
|
||||
exports.stat = stat;
|
||||
function statSync(path, optionsOrSettings) {
|
||||
const settings = getSettings(optionsOrSettings);
|
||||
return sync.read(path, settings);
|
||||
const settings = getSettings(optionsOrSettings);
|
||||
return sync.read(path, settings);
|
||||
}
|
||||
exports.statSync = statSync;
|
||||
function getSettings(settingsOrOptions = {}) {
|
||||
if (settingsOrOptions instanceof settings_1.default) {
|
||||
return settingsOrOptions;
|
||||
}
|
||||
return new settings_1.default(settingsOrOptions);
|
||||
if (settingsOrOptions instanceof settings_1.default) {
|
||||
return settingsOrOptions;
|
||||
}
|
||||
return new settings_1.default(settingsOrOptions);
|
||||
}
|
||||
|
11
node_modules/@nodelib/fs.stat/out/providers/async.d.ts
generated
vendored
11
node_modules/@nodelib/fs.stat/out/providers/async.d.ts
generated
vendored
@ -1,4 +1,11 @@
|
||||
import type Settings from '../settings';
|
||||
import type { ErrnoException, Stats } from '../types';
|
||||
export declare type AsyncCallback = (error: ErrnoException, stats: Stats) => void;
|
||||
export declare function read(path: string, settings: Settings, callback: AsyncCallback): void;
|
||||
export declare type AsyncCallback = (
|
||||
error: ErrnoException,
|
||||
stats: Stats
|
||||
) => void;
|
||||
export declare function read(
|
||||
path: string,
|
||||
settings: Settings,
|
||||
callback: AsyncCallback
|
||||
): void;
|
||||
|
52
node_modules/@nodelib/fs.stat/out/providers/async.js
generated
vendored
52
node_modules/@nodelib/fs.stat/out/providers/async.js
generated
vendored
@ -1,36 +1,36 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
exports.read = void 0;
|
||||
function read(path, settings, callback) {
|
||||
settings.fs.lstat(path, (lstatError, lstat) => {
|
||||
if (lstatError !== null) {
|
||||
callFailureCallback(callback, lstatError);
|
||||
return;
|
||||
settings.fs.lstat(path, (lstatError, lstat) => {
|
||||
if (lstatError !== null) {
|
||||
callFailureCallback(callback, lstatError);
|
||||
return;
|
||||
}
|
||||
if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
|
||||
callSuccessCallback(callback, lstat);
|
||||
return;
|
||||
}
|
||||
settings.fs.stat(path, (statError, stat) => {
|
||||
if (statError !== null) {
|
||||
if (settings.throwErrorOnBrokenSymbolicLink) {
|
||||
callFailureCallback(callback, statError);
|
||||
return;
|
||||
}
|
||||
if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
|
||||
callSuccessCallback(callback, lstat);
|
||||
return;
|
||||
}
|
||||
settings.fs.stat(path, (statError, stat) => {
|
||||
if (statError !== null) {
|
||||
if (settings.throwErrorOnBrokenSymbolicLink) {
|
||||
callFailureCallback(callback, statError);
|
||||
return;
|
||||
}
|
||||
callSuccessCallback(callback, lstat);
|
||||
return;
|
||||
}
|
||||
if (settings.markSymbolicLink) {
|
||||
stat.isSymbolicLink = () => true;
|
||||
}
|
||||
callSuccessCallback(callback, stat);
|
||||
});
|
||||
callSuccessCallback(callback, lstat);
|
||||
return;
|
||||
}
|
||||
if (settings.markSymbolicLink) {
|
||||
stat.isSymbolicLink = () => true;
|
||||
}
|
||||
callSuccessCallback(callback, stat);
|
||||
});
|
||||
});
|
||||
}
|
||||
exports.read = read;
|
||||
function callFailureCallback(callback, error) {
|
||||
callback(error);
|
||||
callback(error);
|
||||
}
|
||||
function callSuccessCallback(callback, result) {
|
||||
callback(null, result);
|
||||
callback(null, result);
|
||||
}
|
||||
|
33
node_modules/@nodelib/fs.stat/out/providers/sync.js
generated
vendored
33
node_modules/@nodelib/fs.stat/out/providers/sync.js
generated
vendored
@ -1,23 +1,22 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
exports.read = void 0;
|
||||
function read(path, settings) {
|
||||
const lstat = settings.fs.lstatSync(path);
|
||||
if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
|
||||
return lstat;
|
||||
const lstat = settings.fs.lstatSync(path);
|
||||
if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
|
||||
return lstat;
|
||||
}
|
||||
try {
|
||||
const stat = settings.fs.statSync(path);
|
||||
if (settings.markSymbolicLink) {
|
||||
stat.isSymbolicLink = () => true;
|
||||
}
|
||||
try {
|
||||
const stat = settings.fs.statSync(path);
|
||||
if (settings.markSymbolicLink) {
|
||||
stat.isSymbolicLink = () => true;
|
||||
}
|
||||
return stat;
|
||||
}
|
||||
catch (error) {
|
||||
if (!settings.throwErrorOnBrokenSymbolicLink) {
|
||||
return lstat;
|
||||
}
|
||||
throw error;
|
||||
return stat;
|
||||
} catch (error) {
|
||||
if (!settings.throwErrorOnBrokenSymbolicLink) {
|
||||
return lstat;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
exports.read = read;
|
||||
|
22
node_modules/@nodelib/fs.stat/out/settings.d.ts
generated
vendored
22
node_modules/@nodelib/fs.stat/out/settings.d.ts
generated
vendored
@ -1,16 +1,16 @@
|
||||
import * as fs from './adapters/fs';
|
||||
export interface Options {
|
||||
followSymbolicLink?: boolean;
|
||||
fs?: Partial<fs.FileSystemAdapter>;
|
||||
markSymbolicLink?: boolean;
|
||||
throwErrorOnBrokenSymbolicLink?: boolean;
|
||||
followSymbolicLink?: boolean;
|
||||
fs?: Partial<fs.FileSystemAdapter>;
|
||||
markSymbolicLink?: boolean;
|
||||
throwErrorOnBrokenSymbolicLink?: boolean;
|
||||
}
|
||||
export default class Settings {
|
||||
private readonly _options;
|
||||
readonly followSymbolicLink: boolean;
|
||||
readonly fs: fs.FileSystemAdapter;
|
||||
readonly markSymbolicLink: boolean;
|
||||
readonly throwErrorOnBrokenSymbolicLink: boolean;
|
||||
constructor(_options?: Options);
|
||||
private _getValue;
|
||||
private readonly _options;
|
||||
readonly followSymbolicLink: boolean;
|
||||
readonly fs: fs.FileSystemAdapter;
|
||||
readonly markSymbolicLink: boolean;
|
||||
readonly throwErrorOnBrokenSymbolicLink: boolean;
|
||||
constructor(_options?: Options);
|
||||
private _getValue;
|
||||
}
|
||||
|
35
node_modules/@nodelib/fs.stat/out/settings.js
generated
vendored
35
node_modules/@nodelib/fs.stat/out/settings.js
generated
vendored
@ -1,16 +1,25 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const fs = require("./adapters/fs");
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
const fs = require('./adapters/fs');
|
||||
class Settings {
|
||||
constructor(_options = {}) {
|
||||
this._options = _options;
|
||||
this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
|
||||
this.fs = fs.createFileSystemAdapter(this._options.fs);
|
||||
this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
|
||||
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
||||
}
|
||||
_getValue(option, value) {
|
||||
return option !== null && option !== void 0 ? option : value;
|
||||
}
|
||||
constructor(_options = {}) {
|
||||
this._options = _options;
|
||||
this.followSymbolicLink = this._getValue(
|
||||
this._options.followSymbolicLink,
|
||||
true
|
||||
);
|
||||
this.fs = fs.createFileSystemAdapter(this._options.fs);
|
||||
this.markSymbolicLink = this._getValue(
|
||||
this._options.markSymbolicLink,
|
||||
false
|
||||
);
|
||||
this.throwErrorOnBrokenSymbolicLink = this._getValue(
|
||||
this._options.throwErrorOnBrokenSymbolicLink,
|
||||
true
|
||||
);
|
||||
}
|
||||
_getValue(option, value) {
|
||||
return option !== null && option !== void 0 ? option : value;
|
||||
}
|
||||
}
|
||||
exports.default = Settings;
|
||||
|
4
node_modules/@nodelib/fs.stat/out/types/index.js
generated
vendored
4
node_modules/@nodelib/fs.stat/out/types/index.js
generated
vendored
@ -1,2 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
43
node_modules/@nodelib/fs.walk/out/index.d.ts
generated
vendored
43
node_modules/@nodelib/fs.walk/out/index.d.ts
generated
vendored
@ -2,13 +2,44 @@
|
||||
import type { Readable } from 'stream';
|
||||
import type { Dirent, FileSystemAdapter } from '@nodelib/fs.scandir';
|
||||
import { AsyncCallback } from './providers/async';
|
||||
import Settings, { DeepFilterFunction, EntryFilterFunction, ErrorFilterFunction, Options } from './settings';
|
||||
import Settings, {
|
||||
DeepFilterFunction,
|
||||
EntryFilterFunction,
|
||||
ErrorFilterFunction,
|
||||
Options,
|
||||
} from './settings';
|
||||
import type { Entry } from './types';
|
||||
declare function walk(directory: string, callback: AsyncCallback): void;
|
||||
declare function walk(directory: string, optionsOrSettings: Options | Settings, callback: AsyncCallback): void;
|
||||
declare function walk(
|
||||
directory: string,
|
||||
optionsOrSettings: Options | Settings,
|
||||
callback: AsyncCallback
|
||||
): void;
|
||||
declare namespace walk {
|
||||
function __promisify__(directory: string, optionsOrSettings?: Options | Settings): Promise<Entry[]>;
|
||||
function __promisify__(
|
||||
directory: string,
|
||||
optionsOrSettings?: Options | Settings
|
||||
): Promise<Entry[]>;
|
||||
}
|
||||
declare function walkSync(directory: string, optionsOrSettings?: Options | Settings): Entry[];
|
||||
declare function walkStream(directory: string, optionsOrSettings?: Options | Settings): Readable;
|
||||
export { walk, walkSync, walkStream, Settings, AsyncCallback, Dirent, Entry, FileSystemAdapter, Options, DeepFilterFunction, EntryFilterFunction, ErrorFilterFunction };
|
||||
declare function walkSync(
|
||||
directory: string,
|
||||
optionsOrSettings?: Options | Settings
|
||||
): Entry[];
|
||||
declare function walkStream(
|
||||
directory: string,
|
||||
optionsOrSettings?: Options | Settings
|
||||
): Readable;
|
||||
export {
|
||||
walk,
|
||||
walkSync,
|
||||
walkStream,
|
||||
Settings,
|
||||
AsyncCallback,
|
||||
Dirent,
|
||||
Entry,
|
||||
FileSystemAdapter,
|
||||
Options,
|
||||
DeepFilterFunction,
|
||||
EntryFilterFunction,
|
||||
ErrorFilterFunction,
|
||||
};
|
||||
|
52
node_modules/@nodelib/fs.walk/out/index.js
generated
vendored
52
node_modules/@nodelib/fs.walk/out/index.js
generated
vendored
@ -1,34 +1,42 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Settings = exports.walkStream = exports.walkSync = exports.walk = void 0;
|
||||
const async_1 = require("./providers/async");
|
||||
const stream_1 = require("./providers/stream");
|
||||
const sync_1 = require("./providers/sync");
|
||||
const settings_1 = require("./settings");
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
exports.Settings =
|
||||
exports.walkStream =
|
||||
exports.walkSync =
|
||||
exports.walk =
|
||||
void 0;
|
||||
const async_1 = require('./providers/async');
|
||||
const stream_1 = require('./providers/stream');
|
||||
const sync_1 = require('./providers/sync');
|
||||
const settings_1 = require('./settings');
|
||||
exports.Settings = settings_1.default;
|
||||
function walk(directory, optionsOrSettingsOrCallback, callback) {
|
||||
if (typeof optionsOrSettingsOrCallback === 'function') {
|
||||
new async_1.default(directory, getSettings()).read(optionsOrSettingsOrCallback);
|
||||
return;
|
||||
}
|
||||
new async_1.default(directory, getSettings(optionsOrSettingsOrCallback)).read(callback);
|
||||
if (typeof optionsOrSettingsOrCallback === 'function') {
|
||||
new async_1.default(directory, getSettings()).read(
|
||||
optionsOrSettingsOrCallback
|
||||
);
|
||||
return;
|
||||
}
|
||||
new async_1.default(directory, getSettings(optionsOrSettingsOrCallback)).read(
|
||||
callback
|
||||
);
|
||||
}
|
||||
exports.walk = walk;
|
||||
function walkSync(directory, optionsOrSettings) {
|
||||
const settings = getSettings(optionsOrSettings);
|
||||
const provider = new sync_1.default(directory, settings);
|
||||
return provider.read();
|
||||
const settings = getSettings(optionsOrSettings);
|
||||
const provider = new sync_1.default(directory, settings);
|
||||
return provider.read();
|
||||
}
|
||||
exports.walkSync = walkSync;
|
||||
function walkStream(directory, optionsOrSettings) {
|
||||
const settings = getSettings(optionsOrSettings);
|
||||
const provider = new stream_1.default(directory, settings);
|
||||
return provider.read();
|
||||
const settings = getSettings(optionsOrSettings);
|
||||
const provider = new stream_1.default(directory, settings);
|
||||
return provider.read();
|
||||
}
|
||||
exports.walkStream = walkStream;
|
||||
function getSettings(settingsOrOptions = {}) {
|
||||
if (settingsOrOptions instanceof settings_1.default) {
|
||||
return settingsOrOptions;
|
||||
}
|
||||
return new settings_1.default(settingsOrOptions);
|
||||
if (settingsOrOptions instanceof settings_1.default) {
|
||||
return settingsOrOptions;
|
||||
}
|
||||
return new settings_1.default(settingsOrOptions);
|
||||
}
|
||||
|
12
node_modules/@nodelib/fs.walk/out/providers/async.d.ts
generated
vendored
12
node_modules/@nodelib/fs.walk/out/providers/async.d.ts
generated
vendored
@ -3,10 +3,10 @@ import type Settings from '../settings';
|
||||
import type { Entry, Errno } from '../types';
|
||||
export declare type AsyncCallback = (error: Errno, entries: Entry[]) => void;
|
||||
export default class AsyncProvider {
|
||||
private readonly _root;
|
||||
private readonly _settings;
|
||||
protected readonly _reader: AsyncReader;
|
||||
private readonly _storage;
|
||||
constructor(_root: string, _settings: Settings);
|
||||
read(callback: AsyncCallback): void;
|
||||
private readonly _root;
|
||||
private readonly _settings;
|
||||
protected readonly _reader: AsyncReader;
|
||||
private readonly _storage;
|
||||
constructor(_root: string, _settings: Settings);
|
||||
read(callback: AsyncCallback): void;
|
||||
}
|
||||
|
46
node_modules/@nodelib/fs.walk/out/providers/async.js
generated
vendored
46
node_modules/@nodelib/fs.walk/out/providers/async.js
generated
vendored
@ -1,30 +1,30 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const async_1 = require("../readers/async");
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
const async_1 = require('../readers/async');
|
||||
class AsyncProvider {
|
||||
constructor(_root, _settings) {
|
||||
this._root = _root;
|
||||
this._settings = _settings;
|
||||
this._reader = new async_1.default(this._root, this._settings);
|
||||
this._storage = [];
|
||||
}
|
||||
read(callback) {
|
||||
this._reader.onError((error) => {
|
||||
callFailureCallback(callback, error);
|
||||
});
|
||||
this._reader.onEntry((entry) => {
|
||||
this._storage.push(entry);
|
||||
});
|
||||
this._reader.onEnd(() => {
|
||||
callSuccessCallback(callback, this._storage);
|
||||
});
|
||||
this._reader.read();
|
||||
}
|
||||
constructor(_root, _settings) {
|
||||
this._root = _root;
|
||||
this._settings = _settings;
|
||||
this._reader = new async_1.default(this._root, this._settings);
|
||||
this._storage = [];
|
||||
}
|
||||
read(callback) {
|
||||
this._reader.onError((error) => {
|
||||
callFailureCallback(callback, error);
|
||||
});
|
||||
this._reader.onEntry((entry) => {
|
||||
this._storage.push(entry);
|
||||
});
|
||||
this._reader.onEnd(() => {
|
||||
callSuccessCallback(callback, this._storage);
|
||||
});
|
||||
this._reader.read();
|
||||
}
|
||||
}
|
||||
exports.default = AsyncProvider;
|
||||
function callFailureCallback(callback, error) {
|
||||
callback(error);
|
||||
callback(error);
|
||||
}
|
||||
function callSuccessCallback(callback, entries) {
|
||||
callback(null, entries);
|
||||
callback(null, entries);
|
||||
}
|
||||
|
10
node_modules/@nodelib/fs.walk/out/providers/index.js
generated
vendored
10
node_modules/@nodelib/fs.walk/out/providers/index.js
generated
vendored
@ -1,9 +1,9 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
exports.SyncProvider = exports.StreamProvider = exports.AsyncProvider = void 0;
|
||||
const async_1 = require("./async");
|
||||
const async_1 = require('./async');
|
||||
exports.AsyncProvider = async_1.default;
|
||||
const stream_1 = require("./stream");
|
||||
const stream_1 = require('./stream');
|
||||
exports.StreamProvider = stream_1.default;
|
||||
const sync_1 = require("./sync");
|
||||
const sync_1 = require('./sync');
|
||||
exports.SyncProvider = sync_1.default;
|
||||
|
12
node_modules/@nodelib/fs.walk/out/providers/stream.d.ts
generated
vendored
12
node_modules/@nodelib/fs.walk/out/providers/stream.d.ts
generated
vendored
@ -3,10 +3,10 @@ import { Readable } from 'stream';
|
||||
import AsyncReader from '../readers/async';
|
||||
import type Settings from '../settings';
|
||||
export default class StreamProvider {
|
||||
private readonly _root;
|
||||
private readonly _settings;
|
||||
protected readonly _reader: AsyncReader;
|
||||
protected readonly _stream: Readable;
|
||||
constructor(_root: string, _settings: Settings);
|
||||
read(): Readable;
|
||||
private readonly _root;
|
||||
private readonly _settings;
|
||||
protected readonly _reader: AsyncReader;
|
||||
protected readonly _stream: Readable;
|
||||
constructor(_root: string, _settings: Settings);
|
||||
read(): Readable;
|
||||
}
|
||||
|
62
node_modules/@nodelib/fs.walk/out/providers/stream.js
generated
vendored
62
node_modules/@nodelib/fs.walk/out/providers/stream.js
generated
vendored
@ -1,34 +1,34 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const stream_1 = require("stream");
|
||||
const async_1 = require("../readers/async");
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
const stream_1 = require('stream');
|
||||
const async_1 = require('../readers/async');
|
||||
class StreamProvider {
|
||||
constructor(_root, _settings) {
|
||||
this._root = _root;
|
||||
this._settings = _settings;
|
||||
this._reader = new async_1.default(this._root, this._settings);
|
||||
this._stream = new stream_1.Readable({
|
||||
objectMode: true,
|
||||
read: () => { },
|
||||
destroy: () => {
|
||||
if (!this._reader.isDestroyed) {
|
||||
this._reader.destroy();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
read() {
|
||||
this._reader.onError((error) => {
|
||||
this._stream.emit('error', error);
|
||||
});
|
||||
this._reader.onEntry((entry) => {
|
||||
this._stream.push(entry);
|
||||
});
|
||||
this._reader.onEnd(() => {
|
||||
this._stream.push(null);
|
||||
});
|
||||
this._reader.read();
|
||||
return this._stream;
|
||||
}
|
||||
constructor(_root, _settings) {
|
||||
this._root = _root;
|
||||
this._settings = _settings;
|
||||
this._reader = new async_1.default(this._root, this._settings);
|
||||
this._stream = new stream_1.Readable({
|
||||
objectMode: true,
|
||||
read: () => {},
|
||||
destroy: () => {
|
||||
if (!this._reader.isDestroyed) {
|
||||
this._reader.destroy();
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
read() {
|
||||
this._reader.onError((error) => {
|
||||
this._stream.emit('error', error);
|
||||
});
|
||||
this._reader.onEntry((entry) => {
|
||||
this._stream.push(entry);
|
||||
});
|
||||
this._reader.onEnd(() => {
|
||||
this._stream.push(null);
|
||||
});
|
||||
this._reader.read();
|
||||
return this._stream;
|
||||
}
|
||||
}
|
||||
exports.default = StreamProvider;
|
||||
|
10
node_modules/@nodelib/fs.walk/out/providers/sync.d.ts
generated
vendored
10
node_modules/@nodelib/fs.walk/out/providers/sync.d.ts
generated
vendored
@ -2,9 +2,9 @@ import SyncReader from '../readers/sync';
|
||||
import type Settings from '../settings';
|
||||
import type { Entry } from '../types';
|
||||
export default class SyncProvider {
|
||||
private readonly _root;
|
||||
private readonly _settings;
|
||||
protected readonly _reader: SyncReader;
|
||||
constructor(_root: string, _settings: Settings);
|
||||
read(): Entry[];
|
||||
private readonly _root;
|
||||
private readonly _settings;
|
||||
protected readonly _reader: SyncReader;
|
||||
constructor(_root: string, _settings: Settings);
|
||||
read(): Entry[];
|
||||
}
|
||||
|
22
node_modules/@nodelib/fs.walk/out/providers/sync.js
generated
vendored
22
node_modules/@nodelib/fs.walk/out/providers/sync.js
generated
vendored
@ -1,14 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const sync_1 = require("../readers/sync");
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
const sync_1 = require('../readers/sync');
|
||||
class SyncProvider {
|
||||
constructor(_root, _settings) {
|
||||
this._root = _root;
|
||||
this._settings = _settings;
|
||||
this._reader = new sync_1.default(this._root, this._settings);
|
||||
}
|
||||
read() {
|
||||
return this._reader.read();
|
||||
}
|
||||
constructor(_root, _settings) {
|
||||
this._root = _root;
|
||||
this._settings = _settings;
|
||||
this._reader = new sync_1.default(this._root, this._settings);
|
||||
}
|
||||
read() {
|
||||
return this._reader.read();
|
||||
}
|
||||
}
|
||||
exports.default = SyncProvider;
|
||||
|
36
node_modules/@nodelib/fs.walk/out/readers/async.d.ts
generated
vendored
36
node_modules/@nodelib/fs.walk/out/readers/async.d.ts
generated
vendored
@ -8,23 +8,23 @@ declare type EntryEventCallback = (entry: Entry) => void;
|
||||
declare type ErrorEventCallback = (error: Errno) => void;
|
||||
declare type EndEventCallback = () => void;
|
||||
export default class AsyncReader extends Reader {
|
||||
protected readonly _settings: Settings;
|
||||
protected readonly _scandir: typeof fsScandir.scandir;
|
||||
protected readonly _emitter: EventEmitter;
|
||||
private readonly _queue;
|
||||
private _isFatalError;
|
||||
private _isDestroyed;
|
||||
constructor(_root: string, _settings: Settings);
|
||||
read(): EventEmitter;
|
||||
get isDestroyed(): boolean;
|
||||
destroy(): void;
|
||||
onEntry(callback: EntryEventCallback): void;
|
||||
onError(callback: ErrorEventCallback): void;
|
||||
onEnd(callback: EndEventCallback): void;
|
||||
private _pushToQueue;
|
||||
private _worker;
|
||||
private _handleError;
|
||||
private _handleEntry;
|
||||
private _emitEntry;
|
||||
protected readonly _settings: Settings;
|
||||
protected readonly _scandir: typeof fsScandir.scandir;
|
||||
protected readonly _emitter: EventEmitter;
|
||||
private readonly _queue;
|
||||
private _isFatalError;
|
||||
private _isDestroyed;
|
||||
constructor(_root: string, _settings: Settings);
|
||||
read(): EventEmitter;
|
||||
get isDestroyed(): boolean;
|
||||
destroy(): void;
|
||||
onEntry(callback: EntryEventCallback): void;
|
||||
onError(callback: ErrorEventCallback): void;
|
||||
onEnd(callback: EndEventCallback): void;
|
||||
private _pushToQueue;
|
||||
private _worker;
|
||||
private _handleError;
|
||||
private _handleEntry;
|
||||
private _emitEntry;
|
||||
}
|
||||
export {};
|
||||
|
187
node_modules/@nodelib/fs.walk/out/readers/async.js
generated
vendored
187
node_modules/@nodelib/fs.walk/out/readers/async.js
generated
vendored
@ -1,97 +1,108 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const events_1 = require("events");
|
||||
const fsScandir = require("@nodelib/fs.scandir");
|
||||
const fastq = require("fastq");
|
||||
const common = require("./common");
|
||||
const reader_1 = require("./reader");
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
const events_1 = require('events');
|
||||
const fsScandir = require('@nodelib/fs.scandir');
|
||||
const fastq = require('fastq');
|
||||
const common = require('./common');
|
||||
const reader_1 = require('./reader');
|
||||
class AsyncReader extends reader_1.default {
|
||||
constructor(_root, _settings) {
|
||||
super(_root, _settings);
|
||||
this._settings = _settings;
|
||||
this._scandir = fsScandir.scandir;
|
||||
this._emitter = new events_1.EventEmitter();
|
||||
this._queue = fastq(this._worker.bind(this), this._settings.concurrency);
|
||||
this._isFatalError = false;
|
||||
this._isDestroyed = false;
|
||||
this._queue.drain = () => {
|
||||
if (!this._isFatalError) {
|
||||
this._emitter.emit('end');
|
||||
}
|
||||
};
|
||||
constructor(_root, _settings) {
|
||||
super(_root, _settings);
|
||||
this._settings = _settings;
|
||||
this._scandir = fsScandir.scandir;
|
||||
this._emitter = new events_1.EventEmitter();
|
||||
this._queue = fastq(this._worker.bind(this), this._settings.concurrency);
|
||||
this._isFatalError = false;
|
||||
this._isDestroyed = false;
|
||||
this._queue.drain = () => {
|
||||
if (!this._isFatalError) {
|
||||
this._emitter.emit('end');
|
||||
}
|
||||
};
|
||||
}
|
||||
read() {
|
||||
this._isFatalError = false;
|
||||
this._isDestroyed = false;
|
||||
setImmediate(() => {
|
||||
this._pushToQueue(this._root, this._settings.basePath);
|
||||
});
|
||||
return this._emitter;
|
||||
}
|
||||
get isDestroyed() {
|
||||
return this._isDestroyed;
|
||||
}
|
||||
destroy() {
|
||||
if (this._isDestroyed) {
|
||||
throw new Error('The reader is already destroyed');
|
||||
}
|
||||
read() {
|
||||
this._isFatalError = false;
|
||||
this._isDestroyed = false;
|
||||
setImmediate(() => {
|
||||
this._pushToQueue(this._root, this._settings.basePath);
|
||||
});
|
||||
return this._emitter;
|
||||
}
|
||||
get isDestroyed() {
|
||||
return this._isDestroyed;
|
||||
}
|
||||
destroy() {
|
||||
if (this._isDestroyed) {
|
||||
throw new Error('The reader is already destroyed');
|
||||
this._isDestroyed = true;
|
||||
this._queue.killAndDrain();
|
||||
}
|
||||
onEntry(callback) {
|
||||
this._emitter.on('entry', callback);
|
||||
}
|
||||
onError(callback) {
|
||||
this._emitter.once('error', callback);
|
||||
}
|
||||
onEnd(callback) {
|
||||
this._emitter.once('end', callback);
|
||||
}
|
||||
_pushToQueue(directory, base) {
|
||||
const queueItem = { directory, base };
|
||||
this._queue.push(queueItem, (error) => {
|
||||
if (error !== null) {
|
||||
this._handleError(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
_worker(item, done) {
|
||||
this._scandir(
|
||||
item.directory,
|
||||
this._settings.fsScandirSettings,
|
||||
(error, entries) => {
|
||||
if (error !== null) {
|
||||
done(error, undefined);
|
||||
return;
|
||||
}
|
||||
this._isDestroyed = true;
|
||||
this._queue.killAndDrain();
|
||||
}
|
||||
onEntry(callback) {
|
||||
this._emitter.on('entry', callback);
|
||||
}
|
||||
onError(callback) {
|
||||
this._emitter.once('error', callback);
|
||||
}
|
||||
onEnd(callback) {
|
||||
this._emitter.once('end', callback);
|
||||
}
|
||||
_pushToQueue(directory, base) {
|
||||
const queueItem = { directory, base };
|
||||
this._queue.push(queueItem, (error) => {
|
||||
if (error !== null) {
|
||||
this._handleError(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
_worker(item, done) {
|
||||
this._scandir(item.directory, this._settings.fsScandirSettings, (error, entries) => {
|
||||
if (error !== null) {
|
||||
done(error, undefined);
|
||||
return;
|
||||
}
|
||||
for (const entry of entries) {
|
||||
this._handleEntry(entry, item.base);
|
||||
}
|
||||
done(null, undefined);
|
||||
});
|
||||
}
|
||||
_handleError(error) {
|
||||
if (this._isDestroyed || !common.isFatalError(this._settings, error)) {
|
||||
return;
|
||||
for (const entry of entries) {
|
||||
this._handleEntry(entry, item.base);
|
||||
}
|
||||
this._isFatalError = true;
|
||||
this._isDestroyed = true;
|
||||
this._emitter.emit('error', error);
|
||||
done(null, undefined);
|
||||
}
|
||||
);
|
||||
}
|
||||
_handleError(error) {
|
||||
if (this._isDestroyed || !common.isFatalError(this._settings, error)) {
|
||||
return;
|
||||
}
|
||||
_handleEntry(entry, base) {
|
||||
if (this._isDestroyed || this._isFatalError) {
|
||||
return;
|
||||
}
|
||||
const fullpath = entry.path;
|
||||
if (base !== undefined) {
|
||||
entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
|
||||
}
|
||||
if (common.isAppliedFilter(this._settings.entryFilter, entry)) {
|
||||
this._emitEntry(entry);
|
||||
}
|
||||
if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) {
|
||||
this._pushToQueue(fullpath, base === undefined ? undefined : entry.path);
|
||||
}
|
||||
this._isFatalError = true;
|
||||
this._isDestroyed = true;
|
||||
this._emitter.emit('error', error);
|
||||
}
|
||||
_handleEntry(entry, base) {
|
||||
if (this._isDestroyed || this._isFatalError) {
|
||||
return;
|
||||
}
|
||||
_emitEntry(entry) {
|
||||
this._emitter.emit('entry', entry);
|
||||
const fullpath = entry.path;
|
||||
if (base !== undefined) {
|
||||
entry.path = common.joinPathSegments(
|
||||
base,
|
||||
entry.name,
|
||||
this._settings.pathSegmentSeparator
|
||||
);
|
||||
}
|
||||
if (common.isAppliedFilter(this._settings.entryFilter, entry)) {
|
||||
this._emitEntry(entry);
|
||||
}
|
||||
if (
|
||||
entry.dirent.isDirectory() &&
|
||||
common.isAppliedFilter(this._settings.deepFilter, entry)
|
||||
) {
|
||||
this._pushToQueue(fullpath, base === undefined ? undefined : entry.path);
|
||||
}
|
||||
}
|
||||
_emitEntry(entry) {
|
||||
this._emitter.emit('entry', entry);
|
||||
}
|
||||
}
|
||||
exports.default = AsyncReader;
|
||||
|
16
node_modules/@nodelib/fs.walk/out/readers/common.d.ts
generated
vendored
16
node_modules/@nodelib/fs.walk/out/readers/common.d.ts
generated
vendored
@ -2,6 +2,16 @@ import type { FilterFunction } from '../settings';
|
||||
import type Settings from '../settings';
|
||||
import type { Errno } from '../types';
|
||||
export declare function isFatalError(settings: Settings, error: Errno): boolean;
|
||||
export declare function isAppliedFilter<T>(filter: FilterFunction<T> | null, value: T): boolean;
|
||||
export declare function replacePathSegmentSeparator(filepath: string, separator: string): string;
|
||||
export declare function joinPathSegments(a: string, b: string, separator: string): string;
|
||||
export declare function isAppliedFilter<T>(
|
||||
filter: FilterFunction<T> | null,
|
||||
value: T
|
||||
): boolean;
|
||||
export declare function replacePathSegmentSeparator(
|
||||
filepath: string,
|
||||
separator: string
|
||||
): string;
|
||||
export declare function joinPathSegments(
|
||||
a: string,
|
||||
b: string,
|
||||
separator: string
|
||||
): string;
|
||||
|
42
node_modules/@nodelib/fs.walk/out/readers/common.js
generated
vendored
42
node_modules/@nodelib/fs.walk/out/readers/common.js
generated
vendored
@ -1,31 +1,35 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.joinPathSegments = exports.replacePathSegmentSeparator = exports.isAppliedFilter = exports.isFatalError = void 0;
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
exports.joinPathSegments =
|
||||
exports.replacePathSegmentSeparator =
|
||||
exports.isAppliedFilter =
|
||||
exports.isFatalError =
|
||||
void 0;
|
||||
function isFatalError(settings, error) {
|
||||
if (settings.errorFilter === null) {
|
||||
return true;
|
||||
}
|
||||
return !settings.errorFilter(error);
|
||||
if (settings.errorFilter === null) {
|
||||
return true;
|
||||
}
|
||||
return !settings.errorFilter(error);
|
||||
}
|
||||
exports.isFatalError = isFatalError;
|
||||
function isAppliedFilter(filter, value) {
|
||||
return filter === null || filter(value);
|
||||
return filter === null || filter(value);
|
||||
}
|
||||
exports.isAppliedFilter = isAppliedFilter;
|
||||
function replacePathSegmentSeparator(filepath, separator) {
|
||||
return filepath.split(/[/\\]/).join(separator);
|
||||
return filepath.split(/[/\\]/).join(separator);
|
||||
}
|
||||
exports.replacePathSegmentSeparator = replacePathSegmentSeparator;
|
||||
function joinPathSegments(a, b, separator) {
|
||||
if (a === '') {
|
||||
return b;
|
||||
}
|
||||
/**
|
||||
* The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`).
|
||||
*/
|
||||
if (a.endsWith(separator)) {
|
||||
return a + b;
|
||||
}
|
||||
return a + separator + b;
|
||||
if (a === '') {
|
||||
return b;
|
||||
}
|
||||
/**
|
||||
* The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`).
|
||||
*/
|
||||
if (a.endsWith(separator)) {
|
||||
return a + b;
|
||||
}
|
||||
return a + separator + b;
|
||||
}
|
||||
exports.joinPathSegments = joinPathSegments;
|
||||
|
6
node_modules/@nodelib/fs.walk/out/readers/reader.d.ts
generated
vendored
6
node_modules/@nodelib/fs.walk/out/readers/reader.d.ts
generated
vendored
@ -1,6 +1,6 @@
|
||||
import type Settings from '../settings';
|
||||
export default class Reader {
|
||||
protected readonly _root: string;
|
||||
protected readonly _settings: Settings;
|
||||
constructor(_root: string, _settings: Settings);
|
||||
protected readonly _root: string;
|
||||
protected readonly _settings: Settings;
|
||||
constructor(_root: string, _settings: Settings);
|
||||
}
|
||||
|
19
node_modules/@nodelib/fs.walk/out/readers/reader.js
generated
vendored
19
node_modules/@nodelib/fs.walk/out/readers/reader.js
generated
vendored
@ -1,11 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const common = require("./common");
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
const common = require('./common');
|
||||
class Reader {
|
||||
constructor(_root, _settings) {
|
||||
this._root = _root;
|
||||
this._settings = _settings;
|
||||
this._root = common.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator);
|
||||
}
|
||||
constructor(_root, _settings) {
|
||||
this._root = _root;
|
||||
this._settings = _settings;
|
||||
this._root = common.replacePathSegmentSeparator(
|
||||
_root,
|
||||
_settings.pathSegmentSeparator
|
||||
);
|
||||
}
|
||||
}
|
||||
exports.default = Reader;
|
||||
|
20
node_modules/@nodelib/fs.walk/out/readers/sync.d.ts
generated
vendored
20
node_modules/@nodelib/fs.walk/out/readers/sync.d.ts
generated
vendored
@ -2,14 +2,14 @@ import * as fsScandir from '@nodelib/fs.scandir';
|
||||
import type { Entry } from '../types';
|
||||
import Reader from './reader';
|
||||
export default class SyncReader extends Reader {
|
||||
protected readonly _scandir: typeof fsScandir.scandirSync;
|
||||
private readonly _storage;
|
||||
private readonly _queue;
|
||||
read(): Entry[];
|
||||
private _pushToQueue;
|
||||
private _handleQueue;
|
||||
private _handleDirectory;
|
||||
private _handleError;
|
||||
private _handleEntry;
|
||||
private _pushToStorage;
|
||||
protected readonly _scandir: typeof fsScandir.scandirSync;
|
||||
private readonly _storage;
|
||||
private readonly _queue;
|
||||
read(): Entry[];
|
||||
private _pushToQueue;
|
||||
private _handleQueue;
|
||||
private _handleDirectory;
|
||||
private _handleError;
|
||||
private _handleEntry;
|
||||
private _pushToStorage;
|
||||
}
|
||||
|
109
node_modules/@nodelib/fs.walk/out/readers/sync.js
generated
vendored
109
node_modules/@nodelib/fs.walk/out/readers/sync.js
generated
vendored
@ -1,59 +1,68 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const fsScandir = require("@nodelib/fs.scandir");
|
||||
const common = require("./common");
|
||||
const reader_1 = require("./reader");
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
const fsScandir = require('@nodelib/fs.scandir');
|
||||
const common = require('./common');
|
||||
const reader_1 = require('./reader');
|
||||
class SyncReader extends reader_1.default {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this._scandir = fsScandir.scandirSync;
|
||||
this._storage = [];
|
||||
this._queue = new Set();
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this._scandir = fsScandir.scandirSync;
|
||||
this._storage = [];
|
||||
this._queue = new Set();
|
||||
}
|
||||
read() {
|
||||
this._pushToQueue(this._root, this._settings.basePath);
|
||||
this._handleQueue();
|
||||
return this._storage;
|
||||
}
|
||||
_pushToQueue(directory, base) {
|
||||
this._queue.add({ directory, base });
|
||||
}
|
||||
_handleQueue() {
|
||||
for (const item of this._queue.values()) {
|
||||
this._handleDirectory(item.directory, item.base);
|
||||
}
|
||||
read() {
|
||||
this._pushToQueue(this._root, this._settings.basePath);
|
||||
this._handleQueue();
|
||||
return this._storage;
|
||||
}
|
||||
_handleDirectory(directory, base) {
|
||||
try {
|
||||
const entries = this._scandir(
|
||||
directory,
|
||||
this._settings.fsScandirSettings
|
||||
);
|
||||
for (const entry of entries) {
|
||||
this._handleEntry(entry, base);
|
||||
}
|
||||
} catch (error) {
|
||||
this._handleError(error);
|
||||
}
|
||||
_pushToQueue(directory, base) {
|
||||
this._queue.add({ directory, base });
|
||||
}
|
||||
_handleError(error) {
|
||||
if (!common.isFatalError(this._settings, error)) {
|
||||
return;
|
||||
}
|
||||
_handleQueue() {
|
||||
for (const item of this._queue.values()) {
|
||||
this._handleDirectory(item.directory, item.base);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
_handleEntry(entry, base) {
|
||||
const fullpath = entry.path;
|
||||
if (base !== undefined) {
|
||||
entry.path = common.joinPathSegments(
|
||||
base,
|
||||
entry.name,
|
||||
this._settings.pathSegmentSeparator
|
||||
);
|
||||
}
|
||||
_handleDirectory(directory, base) {
|
||||
try {
|
||||
const entries = this._scandir(directory, this._settings.fsScandirSettings);
|
||||
for (const entry of entries) {
|
||||
this._handleEntry(entry, base);
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
this._handleError(error);
|
||||
}
|
||||
if (common.isAppliedFilter(this._settings.entryFilter, entry)) {
|
||||
this._pushToStorage(entry);
|
||||
}
|
||||
_handleError(error) {
|
||||
if (!common.isFatalError(this._settings, error)) {
|
||||
return;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
_handleEntry(entry, base) {
|
||||
const fullpath = entry.path;
|
||||
if (base !== undefined) {
|
||||
entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
|
||||
}
|
||||
if (common.isAppliedFilter(this._settings.entryFilter, entry)) {
|
||||
this._pushToStorage(entry);
|
||||
}
|
||||
if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) {
|
||||
this._pushToQueue(fullpath, base === undefined ? undefined : entry.path);
|
||||
}
|
||||
}
|
||||
_pushToStorage(entry) {
|
||||
this._storage.push(entry);
|
||||
if (
|
||||
entry.dirent.isDirectory() &&
|
||||
common.isAppliedFilter(this._settings.deepFilter, entry)
|
||||
) {
|
||||
this._pushToQueue(fullpath, base === undefined ? undefined : entry.path);
|
||||
}
|
||||
}
|
||||
_pushToStorage(entry) {
|
||||
this._storage.push(entry);
|
||||
}
|
||||
}
|
||||
exports.default = SyncReader;
|
||||
|
40
node_modules/@nodelib/fs.walk/out/settings.d.ts
generated
vendored
40
node_modules/@nodelib/fs.walk/out/settings.d.ts
generated
vendored
@ -5,26 +5,26 @@ export declare type DeepFilterFunction = FilterFunction<Entry>;
|
||||
export declare type EntryFilterFunction = FilterFunction<Entry>;
|
||||
export declare type ErrorFilterFunction = FilterFunction<Errno>;
|
||||
export interface Options {
|
||||
basePath?: string;
|
||||
concurrency?: number;
|
||||
deepFilter?: DeepFilterFunction;
|
||||
entryFilter?: EntryFilterFunction;
|
||||
errorFilter?: ErrorFilterFunction;
|
||||
followSymbolicLinks?: boolean;
|
||||
fs?: Partial<fsScandir.FileSystemAdapter>;
|
||||
pathSegmentSeparator?: string;
|
||||
stats?: boolean;
|
||||
throwErrorOnBrokenSymbolicLink?: boolean;
|
||||
basePath?: string;
|
||||
concurrency?: number;
|
||||
deepFilter?: DeepFilterFunction;
|
||||
entryFilter?: EntryFilterFunction;
|
||||
errorFilter?: ErrorFilterFunction;
|
||||
followSymbolicLinks?: boolean;
|
||||
fs?: Partial<fsScandir.FileSystemAdapter>;
|
||||
pathSegmentSeparator?: string;
|
||||
stats?: boolean;
|
||||
throwErrorOnBrokenSymbolicLink?: boolean;
|
||||
}
|
||||
export default class Settings {
|
||||
private readonly _options;
|
||||
readonly basePath?: string;
|
||||
readonly concurrency: number;
|
||||
readonly deepFilter: DeepFilterFunction | null;
|
||||
readonly entryFilter: EntryFilterFunction | null;
|
||||
readonly errorFilter: ErrorFilterFunction | null;
|
||||
readonly pathSegmentSeparator: string;
|
||||
readonly fsScandirSettings: fsScandir.Settings;
|
||||
constructor(_options?: Options);
|
||||
private _getValue;
|
||||
private readonly _options;
|
||||
readonly basePath?: string;
|
||||
readonly concurrency: number;
|
||||
readonly deepFilter: DeepFilterFunction | null;
|
||||
readonly entryFilter: EntryFilterFunction | null;
|
||||
readonly errorFilter: ErrorFilterFunction | null;
|
||||
readonly pathSegmentSeparator: string;
|
||||
readonly fsScandirSettings: fsScandir.Settings;
|
||||
constructor(_options?: Options);
|
||||
private _getValue;
|
||||
}
|
||||
|
53
node_modules/@nodelib/fs.walk/out/settings.js
generated
vendored
53
node_modules/@nodelib/fs.walk/out/settings.js
generated
vendored
@ -1,26 +1,33 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const path = require("path");
|
||||
const fsScandir = require("@nodelib/fs.scandir");
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
const path = require('path');
|
||||
const fsScandir = require('@nodelib/fs.scandir');
|
||||
class Settings {
|
||||
constructor(_options = {}) {
|
||||
this._options = _options;
|
||||
this.basePath = this._getValue(this._options.basePath, undefined);
|
||||
this.concurrency = this._getValue(this._options.concurrency, Number.POSITIVE_INFINITY);
|
||||
this.deepFilter = this._getValue(this._options.deepFilter, null);
|
||||
this.entryFilter = this._getValue(this._options.entryFilter, null);
|
||||
this.errorFilter = this._getValue(this._options.errorFilter, null);
|
||||
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep);
|
||||
this.fsScandirSettings = new fsScandir.Settings({
|
||||
followSymbolicLinks: this._options.followSymbolicLinks,
|
||||
fs: this._options.fs,
|
||||
pathSegmentSeparator: this._options.pathSegmentSeparator,
|
||||
stats: this._options.stats,
|
||||
throwErrorOnBrokenSymbolicLink: this._options.throwErrorOnBrokenSymbolicLink
|
||||
});
|
||||
}
|
||||
_getValue(option, value) {
|
||||
return option !== null && option !== void 0 ? option : value;
|
||||
}
|
||||
constructor(_options = {}) {
|
||||
this._options = _options;
|
||||
this.basePath = this._getValue(this._options.basePath, undefined);
|
||||
this.concurrency = this._getValue(
|
||||
this._options.concurrency,
|
||||
Number.POSITIVE_INFINITY
|
||||
);
|
||||
this.deepFilter = this._getValue(this._options.deepFilter, null);
|
||||
this.entryFilter = this._getValue(this._options.entryFilter, null);
|
||||
this.errorFilter = this._getValue(this._options.errorFilter, null);
|
||||
this.pathSegmentSeparator = this._getValue(
|
||||
this._options.pathSegmentSeparator,
|
||||
path.sep
|
||||
);
|
||||
this.fsScandirSettings = new fsScandir.Settings({
|
||||
followSymbolicLinks: this._options.followSymbolicLinks,
|
||||
fs: this._options.fs,
|
||||
pathSegmentSeparator: this._options.pathSegmentSeparator,
|
||||
stats: this._options.stats,
|
||||
throwErrorOnBrokenSymbolicLink:
|
||||
this._options.throwErrorOnBrokenSymbolicLink,
|
||||
});
|
||||
}
|
||||
_getValue(option, value) {
|
||||
return option !== null && option !== void 0 ? option : value;
|
||||
}
|
||||
}
|
||||
exports.default = Settings;
|
||||
|
4
node_modules/@nodelib/fs.walk/out/types/index.d.ts
generated
vendored
4
node_modules/@nodelib/fs.walk/out/types/index.d.ts
generated
vendored
@ -3,6 +3,6 @@ import type * as scandir from '@nodelib/fs.scandir';
|
||||
export declare type Entry = scandir.Entry;
|
||||
export declare type Errno = NodeJS.ErrnoException;
|
||||
export interface QueueItem {
|
||||
directory: string;
|
||||
base?: string;
|
||||
directory: string;
|
||||
base?: string;
|
||||
}
|
||||
|
4
node_modules/@nodelib/fs.walk/out/types/index.js
generated
vendored
4
node_modules/@nodelib/fs.walk/out/types/index.js
generated
vendored
@ -1,2 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
Reference in New Issue
Block a user