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;
|
||||
|
Reference in New Issue
Block a user