Signed-off-by: OpenClaw Bot <ai-agent@topdoglabs.com>
This commit is contained in:
parent
bc82bc818a
commit
369913ee61
34
.gitignore
vendored
Normal file
34
.gitignore
vendored
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# dependencies
|
||||||
|
/node_modules
|
||||||
|
/.pnp
|
||||||
|
.pnp.*
|
||||||
|
|
||||||
|
# next.js
|
||||||
|
/.next
|
||||||
|
/out
|
||||||
|
|
||||||
|
# build outputs
|
||||||
|
/build
|
||||||
|
/dist
|
||||||
|
|
||||||
|
# logs
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
|
||||||
|
# test/coverage
|
||||||
|
/coverage
|
||||||
|
|
||||||
|
# local env files
|
||||||
|
.env*.local
|
||||||
|
|
||||||
|
# vercel
|
||||||
|
/.vercel
|
||||||
|
|
||||||
|
# typescript
|
||||||
|
*.tsbuildinfo
|
||||||
|
|
||||||
|
# misc
|
||||||
|
.DS_Store
|
||||||
|
*.pem
|
||||||
1
node_modules/.bin/cssesc
generated
vendored
1
node_modules/.bin/cssesc
generated
vendored
@ -1 +0,0 @@
|
|||||||
../cssesc/bin/cssesc
|
|
||||||
2
node_modules/.bin/jiti
generated
vendored
2
node_modules/.bin/jiti
generated
vendored
@ -1 +1 @@
|
|||||||
../jiti/bin/jiti.js
|
../jiti/lib/jiti-cli.mjs
|
||||||
1
node_modules/.bin/resolve
generated
vendored
1
node_modules/.bin/resolve
generated
vendored
@ -1 +0,0 @@
|
|||||||
../resolve/bin/resolve
|
|
||||||
1
node_modules/.bin/sucrase
generated
vendored
1
node_modules/.bin/sucrase
generated
vendored
@ -1 +0,0 @@
|
|||||||
../sucrase/bin/sucrase
|
|
||||||
1
node_modules/.bin/sucrase-node
generated
vendored
1
node_modules/.bin/sucrase-node
generated
vendored
@ -1 +0,0 @@
|
|||||||
../sucrase/bin/sucrase-node
|
|
||||||
1
node_modules/.bin/tailwind
generated
vendored
1
node_modules/.bin/tailwind
generated
vendored
@ -1 +0,0 @@
|
|||||||
../tailwindcss/lib/cli.js
|
|
||||||
1
node_modules/.bin/tailwindcss
generated
vendored
1
node_modules/.bin/tailwindcss
generated
vendored
@ -1 +0,0 @@
|
|||||||
../tailwindcss/lib/cli.js
|
|
||||||
1125
node_modules/.package-lock.json
generated
vendored
1125
node_modules/.package-lock.json
generated
vendored
File diff suppressed because it is too large
Load Diff
21
node_modules/@nodelib/fs.scandir/LICENSE
generated
vendored
21
node_modules/@nodelib/fs.scandir/LICENSE
generated
vendored
@ -1,21 +0,0 @@
|
|||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) Denis Malinochkin
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
171
node_modules/@nodelib/fs.scandir/README.md
generated
vendored
171
node_modules/@nodelib/fs.scandir/README.md
generated
vendored
@ -1,171 +0,0 @@
|
|||||||
# @nodelib/fs.scandir
|
|
||||||
|
|
||||||
> List files and directories inside the specified directory.
|
|
||||||
|
|
||||||
## :bulb: Highlights
|
|
||||||
|
|
||||||
The package is aimed at obtaining information about entries in the directory.
|
|
||||||
|
|
||||||
* :moneybag: Returns useful information: `name`, `path`, `dirent` and `stats` (optional).
|
|
||||||
* :gear: On Node.js 10.10+ uses the mechanism without additional calls to determine the entry type. See [`old` and `modern` mode](#old-and-modern-mode).
|
|
||||||
* :link: Can safely work with broken symbolic links.
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
```console
|
|
||||||
npm install @nodelib/fs.scandir
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import * as fsScandir from '@nodelib/fs.scandir';
|
|
||||||
|
|
||||||
fsScandir.scandir('path', (error, stats) => { /* … */ });
|
|
||||||
```
|
|
||||||
|
|
||||||
## API
|
|
||||||
|
|
||||||
### .scandir(path, [optionsOrSettings], callback)
|
|
||||||
|
|
||||||
Returns an array of plain objects ([`Entry`](#entry)) with information about entry for provided path with standard callback-style.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
fsScandir.scandir('path', (error, entries) => { /* … */ });
|
|
||||||
fsScandir.scandir('path', {}, (error, entries) => { /* … */ });
|
|
||||||
fsScandir.scandir('path', new fsScandir.Settings(), (error, entries) => { /* … */ });
|
|
||||||
```
|
|
||||||
|
|
||||||
### .scandirSync(path, [optionsOrSettings])
|
|
||||||
|
|
||||||
Returns an array of plain objects ([`Entry`](#entry)) with information about entry for provided path.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
const entries = fsScandir.scandirSync('path');
|
|
||||||
const entries = fsScandir.scandirSync('path', {});
|
|
||||||
const entries = fsScandir.scandirSync(('path', new fsScandir.Settings());
|
|
||||||
```
|
|
||||||
|
|
||||||
#### path
|
|
||||||
|
|
||||||
* Required: `true`
|
|
||||||
* Type: `string | Buffer | URL`
|
|
||||||
|
|
||||||
A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
||||||
|
|
||||||
#### optionsOrSettings
|
|
||||||
|
|
||||||
* Required: `false`
|
|
||||||
* Type: `Options | Settings`
|
|
||||||
* Default: An instance of `Settings` class
|
|
||||||
|
|
||||||
An [`Options`](#options) object or an instance of [`Settings`](#settingsoptions) class.
|
|
||||||
|
|
||||||
> :book: When you pass a plain object, an instance of the `Settings` class will be created automatically. If you plan to call the method frequently, use a pre-created instance of the `Settings` class.
|
|
||||||
|
|
||||||
### Settings([options])
|
|
||||||
|
|
||||||
A class of full settings of the package.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
const settings = new fsScandir.Settings({ followSymbolicLinks: false });
|
|
||||||
|
|
||||||
const entries = fsScandir.scandirSync('path', settings);
|
|
||||||
```
|
|
||||||
|
|
||||||
## Entry
|
|
||||||
|
|
||||||
* `name` — The name of the entry (`unknown.txt`).
|
|
||||||
* `path` — The path of the entry relative to call directory (`root/unknown.txt`).
|
|
||||||
* `dirent` — An instance of [`fs.Dirent`](./src/types/index.ts) class. On Node.js below 10.10 will be emulated by [`DirentFromStats`](./src/utils/fs.ts) class.
|
|
||||||
* `stats` (optional) — An instance of `fs.Stats` class.
|
|
||||||
|
|
||||||
For example, the `scandir` call for `tools` directory with one directory inside:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
{
|
|
||||||
dirent: Dirent { name: 'typedoc', /* … */ },
|
|
||||||
name: 'typedoc',
|
|
||||||
path: 'tools/typedoc'
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Options
|
|
||||||
|
|
||||||
### stats
|
|
||||||
|
|
||||||
* Type: `boolean`
|
|
||||||
* Default: `false`
|
|
||||||
|
|
||||||
Adds an instance of `fs.Stats` class to the [`Entry`](#entry).
|
|
||||||
|
|
||||||
> :book: Always use `fs.readdir` without the `withFileTypes` option. ??TODO??
|
|
||||||
|
|
||||||
### followSymbolicLinks
|
|
||||||
|
|
||||||
* Type: `boolean`
|
|
||||||
* Default: `false`
|
|
||||||
|
|
||||||
Follow symbolic links or not. Call `fs.stat` on symbolic link if `true`.
|
|
||||||
|
|
||||||
### `throwErrorOnBrokenSymbolicLink`
|
|
||||||
|
|
||||||
* Type: `boolean`
|
|
||||||
* Default: `true`
|
|
||||||
|
|
||||||
Throw an error when symbolic link is broken if `true` or safely use `lstat` call if `false`.
|
|
||||||
|
|
||||||
### `pathSegmentSeparator`
|
|
||||||
|
|
||||||
* Type: `string`
|
|
||||||
* Default: `path.sep`
|
|
||||||
|
|
||||||
By default, this package uses the correct path separator for your OS (`\` on Windows, `/` on Unix-like systems). But you can set this option to any separator character(s) that you want to use instead.
|
|
||||||
|
|
||||||
### `fs`
|
|
||||||
|
|
||||||
* Type: [`FileSystemAdapter`](./src/adapters/fs.ts)
|
|
||||||
* Default: A default FS methods
|
|
||||||
|
|
||||||
By default, the built-in Node.js module (`fs`) is used to work with the file system. You can replace any method with your own.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
interface FileSystemAdapter {
|
|
||||||
lstat?: typeof fs.lstat;
|
|
||||||
stat?: typeof fs.stat;
|
|
||||||
lstatSync?: typeof fs.lstatSync;
|
|
||||||
statSync?: typeof fs.statSync;
|
|
||||||
readdir?: typeof fs.readdir;
|
|
||||||
readdirSync?: typeof fs.readdirSync;
|
|
||||||
}
|
|
||||||
|
|
||||||
const settings = new fsScandir.Settings({
|
|
||||||
fs: { lstat: fakeLstat }
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
## `old` and `modern` mode
|
|
||||||
|
|
||||||
This package has two modes that are used depending on the environment and parameters of use.
|
|
||||||
|
|
||||||
### old
|
|
||||||
|
|
||||||
* Node.js below `10.10` or when the `stats` option is enabled
|
|
||||||
|
|
||||||
When working in the old mode, the directory is read first (`fs.readdir`), then the type of entries is determined (`fs.lstat` and/or `fs.stat` for symbolic links).
|
|
||||||
|
|
||||||
### modern
|
|
||||||
|
|
||||||
* Node.js 10.10+ and the `stats` option is disabled
|
|
||||||
|
|
||||||
In the modern mode, reading the directory (`fs.readdir` with the `withFileTypes` option) is combined with obtaining information about its entries. An additional call for symbolic links (`fs.stat`) is still present.
|
|
||||||
|
|
||||||
This mode makes fewer calls to the file system. It's faster.
|
|
||||||
|
|
||||||
## Changelog
|
|
||||||
|
|
||||||
See the [Releases section of our GitHub project](https://github.com/nodelib/nodelib/releases) for changelog for each release version.
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
This software is released under the terms of the MIT license.
|
|
||||||
20
node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts
generated
vendored
20
node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts
generated
vendored
@ -1,20 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
export interface ReaddirSynchronousMethod {
|
|
||||||
(filepath: string, options: {
|
|
||||||
withFileTypes: true;
|
|
||||||
}): Dirent[];
|
|
||||||
(filepath: string): string[];
|
|
||||||
}
|
|
||||||
export declare type FileSystemAdapter = fsStat.FileSystemAdapter & {
|
|
||||||
readdir: ReaddirAsynchronousMethod;
|
|
||||||
readdirSync: ReaddirSynchronousMethod;
|
|
||||||
};
|
|
||||||
export declare const FILE_SYSTEM_ADAPTER: FileSystemAdapter;
|
|
||||||
export declare function createFileSystemAdapter(fsMethods?: Partial<FileSystemAdapter>): FileSystemAdapter;
|
|
||||||
19
node_modules/@nodelib/fs.scandir/out/adapters/fs.js
generated
vendored
19
node_modules/@nodelib/fs.scandir/out/adapters/fs.js
generated
vendored
@ -1,19 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
|
|
||||||
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
|
|
||||||
};
|
|
||||||
function createFileSystemAdapter(fsMethods) {
|
|
||||||
if (fsMethods === undefined) {
|
|
||||||
return exports.FILE_SYSTEM_ADAPTER;
|
|
||||||
}
|
|
||||||
return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
|
|
||||||
}
|
|
||||||
exports.createFileSystemAdapter = createFileSystemAdapter;
|
|
||||||
4
node_modules/@nodelib/fs.scandir/out/constants.d.ts
generated
vendored
4
node_modules/@nodelib/fs.scandir/out/constants.d.ts
generated
vendored
@ -1,4 +0,0 @@
|
|||||||
/**
|
|
||||||
* IS `true` for Node.js 10.10 and greater.
|
|
||||||
*/
|
|
||||||
export declare const IS_SUPPORT_READDIR_WITH_FILE_TYPES: boolean;
|
|
||||||
17
node_modules/@nodelib/fs.scandir/out/constants.js
generated
vendored
17
node_modules/@nodelib/fs.scandir/out/constants.js
generated
vendored
@ -1,17 +0,0 @@
|
|||||||
"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}`);
|
|
||||||
}
|
|
||||||
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;
|
|
||||||
/**
|
|
||||||
* 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;
|
|
||||||
12
node_modules/@nodelib/fs.scandir/out/index.d.ts
generated
vendored
12
node_modules/@nodelib/fs.scandir/out/index.d.ts
generated
vendored
@ -1,12 +0,0 @@
|
|||||||
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 namespace scandir {
|
|
||||||
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 };
|
|
||||||
26
node_modules/@nodelib/fs.scandir/out/index.js
generated
vendored
26
node_modules/@nodelib/fs.scandir/out/index.js
generated
vendored
@ -1,26 +0,0 @@
|
|||||||
"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");
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
exports.scandir = scandir;
|
|
||||||
function scandirSync(path, optionsOrSettings) {
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
7
node_modules/@nodelib/fs.scandir/out/providers/async.d.ts
generated
vendored
7
node_modules/@nodelib/fs.scandir/out/providers/async.d.ts
generated
vendored
@ -1,7 +0,0 @@
|
|||||||
/// <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;
|
|
||||||
104
node_modules/@nodelib/fs.scandir/out/providers/async.js
generated
vendored
104
node_modules/@nodelib/fs.scandir/out/providers/async.js
generated
vendored
@ -1,104 +0,0 @@
|
|||||||
"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");
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
exports.read = read;
|
|
||||||
function readdirWithFileTypes(directory, settings, callback) {
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
callSuccessCallback(callback, rplEntries);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.readdirWithFileTypes = readdirWithFileTypes;
|
|
||||||
function makeRplTaskEntry(entry, settings) {
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
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);
|
|
||||||
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);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.readdir = readdir;
|
|
||||||
function callFailureCallback(callback, error) {
|
|
||||||
callback(error);
|
|
||||||
}
|
|
||||||
function callSuccessCallback(callback, result) {
|
|
||||||
callback(null, result);
|
|
||||||
}
|
|
||||||
1
node_modules/@nodelib/fs.scandir/out/providers/common.d.ts
generated
vendored
1
node_modules/@nodelib/fs.scandir/out/providers/common.d.ts
generated
vendored
@ -1 +0,0 @@
|
|||||||
export declare function joinPathSegments(a: string, b: string, separator: string): string;
|
|
||||||
13
node_modules/@nodelib/fs.scandir/out/providers/common.js
generated
vendored
13
node_modules/@nodelib/fs.scandir/out/providers/common.js
generated
vendored
@ -1,13 +0,0 @@
|
|||||||
"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;
|
|
||||||
}
|
|
||||||
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 +0,0 @@
|
|||||||
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 readdir(directory: string, settings: Settings): Entry[];
|
|
||||||
54
node_modules/@nodelib/fs.scandir/out/providers/sync.js
generated
vendored
54
node_modules/@nodelib/fs.scandir/out/providers/sync.js
generated
vendored
@ -1,54 +0,0 @@
|
|||||||
"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");
|
|
||||||
function read(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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.readdir = readdir;
|
|
||||||
20
node_modules/@nodelib/fs.scandir/out/settings.d.ts
generated
vendored
20
node_modules/@nodelib/fs.scandir/out/settings.d.ts
generated
vendored
@ -1,20 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
24
node_modules/@nodelib/fs.scandir/out/settings.js
generated
vendored
24
node_modules/@nodelib/fs.scandir/out/settings.js
generated
vendored
@ -1,24 +0,0 @@
|
|||||||
"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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.default = Settings;
|
|
||||||
20
node_modules/@nodelib/fs.scandir/out/types/index.d.ts
generated
vendored
20
node_modules/@nodelib/fs.scandir/out/types/index.d.ts
generated
vendored
@ -1,20 +0,0 @@
|
|||||||
/// <reference types="node" />
|
|
||||||
import type * as fs from 'fs';
|
|
||||||
export interface Entry {
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
2
node_modules/@nodelib/fs.scandir/out/types/index.js
generated
vendored
2
node_modules/@nodelib/fs.scandir/out/types/index.js
generated
vendored
@ -1,2 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
2
node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts
generated
vendored
2
node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts
generated
vendored
@ -1,2 +0,0 @@
|
|||||||
import type { Dirent, Stats } from '../types';
|
|
||||||
export declare function createDirentFromStats(name: string, stats: Stats): Dirent;
|
|
||||||
19
node_modules/@nodelib/fs.scandir/out/utils/fs.js
generated
vendored
19
node_modules/@nodelib/fs.scandir/out/utils/fs.js
generated
vendored
@ -1,19 +0,0 @@
|
|||||||
"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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function createDirentFromStats(name, stats) {
|
|
||||||
return new DirentFromStats(name, stats);
|
|
||||||
}
|
|
||||||
exports.createDirentFromStats = createDirentFromStats;
|
|
||||||
2
node_modules/@nodelib/fs.scandir/out/utils/index.d.ts
generated
vendored
2
node_modules/@nodelib/fs.scandir/out/utils/index.d.ts
generated
vendored
@ -1,2 +0,0 @@
|
|||||||
import * as fs from './fs';
|
|
||||||
export { fs };
|
|
||||||
5
node_modules/@nodelib/fs.scandir/out/utils/index.js
generated
vendored
5
node_modules/@nodelib/fs.scandir/out/utils/index.js
generated
vendored
@ -1,5 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.fs = void 0;
|
|
||||||
const fs = require("./fs");
|
|
||||||
exports.fs = fs;
|
|
||||||
44
node_modules/@nodelib/fs.scandir/package.json
generated
vendored
44
node_modules/@nodelib/fs.scandir/package.json
generated
vendored
@ -1,44 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@nodelib/fs.scandir",
|
|
||||||
"version": "2.1.5",
|
|
||||||
"description": "List files and directories inside the specified directory",
|
|
||||||
"license": "MIT",
|
|
||||||
"repository": "https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.scandir",
|
|
||||||
"keywords": [
|
|
||||||
"NodeLib",
|
|
||||||
"fs",
|
|
||||||
"FileSystem",
|
|
||||||
"file system",
|
|
||||||
"scandir",
|
|
||||||
"readdir",
|
|
||||||
"dirent"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 8"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"out/**",
|
|
||||||
"!out/**/*.map",
|
|
||||||
"!out/**/*.spec.*"
|
|
||||||
],
|
|
||||||
"main": "out/index.js",
|
|
||||||
"typings": "out/index.d.ts",
|
|
||||||
"scripts": {
|
|
||||||
"clean": "rimraf {tsconfig.tsbuildinfo,out}",
|
|
||||||
"lint": "eslint \"src/**/*.ts\" --cache",
|
|
||||||
"compile": "tsc -b .",
|
|
||||||
"compile:watch": "tsc -p . --watch --sourceMap",
|
|
||||||
"test": "mocha \"out/**/*.spec.js\" -s 0",
|
|
||||||
"build": "npm run clean && npm run compile && npm run lint && npm test",
|
|
||||||
"watch": "npm run clean && npm run compile:watch"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@nodelib/fs.stat": "2.0.5",
|
|
||||||
"run-parallel": "^1.1.9"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@nodelib/fs.macchiato": "1.0.4",
|
|
||||||
"@types/run-parallel": "^1.1.0"
|
|
||||||
},
|
|
||||||
"gitHead": "d6a7960d5281d3dd5f8e2efba49bb552d090f562"
|
|
||||||
}
|
|
||||||
21
node_modules/@nodelib/fs.stat/LICENSE
generated
vendored
21
node_modules/@nodelib/fs.stat/LICENSE
generated
vendored
@ -1,21 +0,0 @@
|
|||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) Denis Malinochkin
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
126
node_modules/@nodelib/fs.stat/README.md
generated
vendored
126
node_modules/@nodelib/fs.stat/README.md
generated
vendored
@ -1,126 +0,0 @@
|
|||||||
# @nodelib/fs.stat
|
|
||||||
|
|
||||||
> Get the status of a file with some features.
|
|
||||||
|
|
||||||
## :bulb: Highlights
|
|
||||||
|
|
||||||
Wrapper around standard method `fs.lstat` and `fs.stat` with some features.
|
|
||||||
|
|
||||||
* :beginner: Normally follows symbolic link.
|
|
||||||
* :gear: Can safely work with broken symbolic link.
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
```console
|
|
||||||
npm install @nodelib/fs.stat
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import * as fsStat from '@nodelib/fs.stat';
|
|
||||||
|
|
||||||
fsStat.stat('path', (error, stats) => { /* … */ });
|
|
||||||
```
|
|
||||||
|
|
||||||
## API
|
|
||||||
|
|
||||||
### .stat(path, [optionsOrSettings], callback)
|
|
||||||
|
|
||||||
Returns an instance of `fs.Stats` class for provided path with standard callback-style.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
fsStat.stat('path', (error, stats) => { /* … */ });
|
|
||||||
fsStat.stat('path', {}, (error, stats) => { /* … */ });
|
|
||||||
fsStat.stat('path', new fsStat.Settings(), (error, stats) => { /* … */ });
|
|
||||||
```
|
|
||||||
|
|
||||||
### .statSync(path, [optionsOrSettings])
|
|
||||||
|
|
||||||
Returns an instance of `fs.Stats` class for provided path.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
const stats = fsStat.stat('path');
|
|
||||||
const stats = fsStat.stat('path', {});
|
|
||||||
const stats = fsStat.stat('path', new fsStat.Settings());
|
|
||||||
```
|
|
||||||
|
|
||||||
#### path
|
|
||||||
|
|
||||||
* Required: `true`
|
|
||||||
* Type: `string | Buffer | URL`
|
|
||||||
|
|
||||||
A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
||||||
|
|
||||||
#### optionsOrSettings
|
|
||||||
|
|
||||||
* Required: `false`
|
|
||||||
* Type: `Options | Settings`
|
|
||||||
* Default: An instance of `Settings` class
|
|
||||||
|
|
||||||
An [`Options`](#options) object or an instance of [`Settings`](#settings) class.
|
|
||||||
|
|
||||||
> :book: When you pass a plain object, an instance of the `Settings` class will be created automatically. If you plan to call the method frequently, use a pre-created instance of the `Settings` class.
|
|
||||||
|
|
||||||
### Settings([options])
|
|
||||||
|
|
||||||
A class of full settings of the package.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
const settings = new fsStat.Settings({ followSymbolicLink: false });
|
|
||||||
|
|
||||||
const stats = fsStat.stat('path', settings);
|
|
||||||
```
|
|
||||||
|
|
||||||
## Options
|
|
||||||
|
|
||||||
### `followSymbolicLink`
|
|
||||||
|
|
||||||
* Type: `boolean`
|
|
||||||
* Default: `true`
|
|
||||||
|
|
||||||
Follow symbolic link or not. Call `fs.stat` on symbolic link if `true`.
|
|
||||||
|
|
||||||
### `markSymbolicLink`
|
|
||||||
|
|
||||||
* Type: `boolean`
|
|
||||||
* Default: `false`
|
|
||||||
|
|
||||||
Mark symbolic link by setting the return value of `isSymbolicLink` function to always `true` (even after `fs.stat`).
|
|
||||||
|
|
||||||
> :book: Can be used if you want to know what is hidden behind a symbolic link, but still continue to know that it is a symbolic link.
|
|
||||||
|
|
||||||
### `throwErrorOnBrokenSymbolicLink`
|
|
||||||
|
|
||||||
* Type: `boolean`
|
|
||||||
* Default: `true`
|
|
||||||
|
|
||||||
Throw an error when symbolic link is broken if `true` or safely return `lstat` call if `false`.
|
|
||||||
|
|
||||||
### `fs`
|
|
||||||
|
|
||||||
* Type: [`FileSystemAdapter`](./src/adapters/fs.ts)
|
|
||||||
* Default: A default FS methods
|
|
||||||
|
|
||||||
By default, the built-in Node.js module (`fs`) is used to work with the file system. You can replace any method with your own.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
interface FileSystemAdapter {
|
|
||||||
lstat?: typeof fs.lstat;
|
|
||||||
stat?: typeof fs.stat;
|
|
||||||
lstatSync?: typeof fs.lstatSync;
|
|
||||||
statSync?: typeof fs.statSync;
|
|
||||||
}
|
|
||||||
|
|
||||||
const settings = new fsStat.Settings({
|
|
||||||
fs: { lstat: fakeLstat }
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
## Changelog
|
|
||||||
|
|
||||||
See the [Releases section of our GitHub project](https://github.com/nodelib/nodelib/releases) for changelog for each release version.
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
This software is released under the terms of the MIT license.
|
|
||||||
13
node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts
generated
vendored
13
node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts
generated
vendored
@ -1,13 +0,0 @@
|
|||||||
/// <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 StatSynchronousMethod = (path: string) => fs.Stats;
|
|
||||||
export interface FileSystemAdapter {
|
|
||||||
lstat: StatAsynchronousMethod;
|
|
||||||
stat: StatAsynchronousMethod;
|
|
||||||
lstatSync: StatSynchronousMethod;
|
|
||||||
statSync: StatSynchronousMethod;
|
|
||||||
}
|
|
||||||
export declare const FILE_SYSTEM_ADAPTER: FileSystemAdapter;
|
|
||||||
export declare function createFileSystemAdapter(fsMethods?: Partial<FileSystemAdapter>): FileSystemAdapter;
|
|
||||||
17
node_modules/@nodelib/fs.stat/out/adapters/fs.js
generated
vendored
17
node_modules/@nodelib/fs.stat/out/adapters/fs.js
generated
vendored
@ -1,17 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
|
|
||||||
const fs = require("fs");
|
|
||||||
exports.FILE_SYSTEM_ADAPTER = {
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
exports.createFileSystemAdapter = createFileSystemAdapter;
|
|
||||||
12
node_modules/@nodelib/fs.stat/out/index.d.ts
generated
vendored
12
node_modules/@nodelib/fs.stat/out/index.d.ts
generated
vendored
@ -1,12 +0,0 @@
|
|||||||
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 namespace stat {
|
|
||||||
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 };
|
|
||||||
26
node_modules/@nodelib/fs.stat/out/index.js
generated
vendored
26
node_modules/@nodelib/fs.stat/out/index.js
generated
vendored
@ -1,26 +0,0 @@
|
|||||||
"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");
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
exports.stat = stat;
|
|
||||||
function statSync(path, optionsOrSettings) {
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
4
node_modules/@nodelib/fs.stat/out/providers/async.d.ts
generated
vendored
4
node_modules/@nodelib/fs.stat/out/providers/async.d.ts
generated
vendored
@ -1,4 +0,0 @@
|
|||||||
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;
|
|
||||||
36
node_modules/@nodelib/fs.stat/out/providers/async.js
generated
vendored
36
node_modules/@nodelib/fs.stat/out/providers/async.js
generated
vendored
@ -1,36 +0,0 @@
|
|||||||
"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;
|
|
||||||
}
|
|
||||||
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);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.read = read;
|
|
||||||
function callFailureCallback(callback, error) {
|
|
||||||
callback(error);
|
|
||||||
}
|
|
||||||
function callSuccessCallback(callback, result) {
|
|
||||||
callback(null, result);
|
|
||||||
}
|
|
||||||
3
node_modules/@nodelib/fs.stat/out/providers/sync.d.ts
generated
vendored
3
node_modules/@nodelib/fs.stat/out/providers/sync.d.ts
generated
vendored
@ -1,3 +0,0 @@
|
|||||||
import type Settings from '../settings';
|
|
||||||
import type { Stats } from '../types';
|
|
||||||
export declare function read(path: string, settings: Settings): Stats;
|
|
||||||
23
node_modules/@nodelib/fs.stat/out/providers/sync.js
generated
vendored
23
node_modules/@nodelib/fs.stat/out/providers/sync.js
generated
vendored
@ -1,23 +0,0 @@
|
|||||||
"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;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
const stat = settings.fs.statSync(path);
|
|
||||||
if (settings.markSymbolicLink) {
|
|
||||||
stat.isSymbolicLink = () => true;
|
|
||||||
}
|
|
||||||
return stat;
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
if (!settings.throwErrorOnBrokenSymbolicLink) {
|
|
||||||
return lstat;
|
|
||||||
}
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.read = read;
|
|
||||||
16
node_modules/@nodelib/fs.stat/out/settings.d.ts
generated
vendored
16
node_modules/@nodelib/fs.stat/out/settings.d.ts
generated
vendored
@ -1,16 +0,0 @@
|
|||||||
import * as fs from './adapters/fs';
|
|
||||||
export interface Options {
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
16
node_modules/@nodelib/fs.stat/out/settings.js
generated
vendored
16
node_modules/@nodelib/fs.stat/out/settings.js
generated
vendored
@ -1,16 +0,0 @@
|
|||||||
"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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.default = Settings;
|
|
||||||
4
node_modules/@nodelib/fs.stat/out/types/index.d.ts
generated
vendored
4
node_modules/@nodelib/fs.stat/out/types/index.d.ts
generated
vendored
@ -1,4 +0,0 @@
|
|||||||
/// <reference types="node" />
|
|
||||||
import type * as fs from 'fs';
|
|
||||||
export declare type Stats = fs.Stats;
|
|
||||||
export declare type ErrnoException = NodeJS.ErrnoException;
|
|
||||||
2
node_modules/@nodelib/fs.stat/out/types/index.js
generated
vendored
2
node_modules/@nodelib/fs.stat/out/types/index.js
generated
vendored
@ -1,2 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
37
node_modules/@nodelib/fs.stat/package.json
generated
vendored
37
node_modules/@nodelib/fs.stat/package.json
generated
vendored
@ -1,37 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@nodelib/fs.stat",
|
|
||||||
"version": "2.0.5",
|
|
||||||
"description": "Get the status of a file with some features",
|
|
||||||
"license": "MIT",
|
|
||||||
"repository": "https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.stat",
|
|
||||||
"keywords": [
|
|
||||||
"NodeLib",
|
|
||||||
"fs",
|
|
||||||
"FileSystem",
|
|
||||||
"file system",
|
|
||||||
"stat"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 8"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"out/**",
|
|
||||||
"!out/**/*.map",
|
|
||||||
"!out/**/*.spec.*"
|
|
||||||
],
|
|
||||||
"main": "out/index.js",
|
|
||||||
"typings": "out/index.d.ts",
|
|
||||||
"scripts": {
|
|
||||||
"clean": "rimraf {tsconfig.tsbuildinfo,out}",
|
|
||||||
"lint": "eslint \"src/**/*.ts\" --cache",
|
|
||||||
"compile": "tsc -b .",
|
|
||||||
"compile:watch": "tsc -p . --watch --sourceMap",
|
|
||||||
"test": "mocha \"out/**/*.spec.js\" -s 0",
|
|
||||||
"build": "npm run clean && npm run compile && npm run lint && npm test",
|
|
||||||
"watch": "npm run clean && npm run compile:watch"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@nodelib/fs.macchiato": "1.0.4"
|
|
||||||
},
|
|
||||||
"gitHead": "d6a7960d5281d3dd5f8e2efba49bb552d090f562"
|
|
||||||
}
|
|
||||||
21
node_modules/@nodelib/fs.walk/LICENSE
generated
vendored
21
node_modules/@nodelib/fs.walk/LICENSE
generated
vendored
@ -1,21 +0,0 @@
|
|||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) Denis Malinochkin
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
215
node_modules/@nodelib/fs.walk/README.md
generated
vendored
215
node_modules/@nodelib/fs.walk/README.md
generated
vendored
@ -1,215 +0,0 @@
|
|||||||
# @nodelib/fs.walk
|
|
||||||
|
|
||||||
> A library for efficiently walking a directory recursively.
|
|
||||||
|
|
||||||
## :bulb: Highlights
|
|
||||||
|
|
||||||
* :moneybag: Returns useful information: `name`, `path`, `dirent` and `stats` (optional).
|
|
||||||
* :rocket: On Node.js 10.10+ uses the mechanism without additional calls to determine the entry type for performance reasons. See [`old` and `modern` mode](https://github.com/nodelib/nodelib/blob/master/packages/fs/fs.scandir/README.md#old-and-modern-mode).
|
|
||||||
* :gear: Built-in directories/files and error filtering system.
|
|
||||||
* :link: Can safely work with broken symbolic links.
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
```console
|
|
||||||
npm install @nodelib/fs.walk
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
```ts
|
|
||||||
import * as fsWalk from '@nodelib/fs.walk';
|
|
||||||
|
|
||||||
fsWalk.walk('path', (error, entries) => { /* … */ });
|
|
||||||
```
|
|
||||||
|
|
||||||
## API
|
|
||||||
|
|
||||||
### .walk(path, [optionsOrSettings], callback)
|
|
||||||
|
|
||||||
Reads the directory recursively and asynchronously. Requires a callback function.
|
|
||||||
|
|
||||||
> :book: If you want to use the Promise API, use `util.promisify`.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
fsWalk.walk('path', (error, entries) => { /* … */ });
|
|
||||||
fsWalk.walk('path', {}, (error, entries) => { /* … */ });
|
|
||||||
fsWalk.walk('path', new fsWalk.Settings(), (error, entries) => { /* … */ });
|
|
||||||
```
|
|
||||||
|
|
||||||
### .walkStream(path, [optionsOrSettings])
|
|
||||||
|
|
||||||
Reads the directory recursively and asynchronously. [Readable Stream](https://nodejs.org/dist/latest-v12.x/docs/api/stream.html#stream_readable_streams) is used as a provider.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
const stream = fsWalk.walkStream('path');
|
|
||||||
const stream = fsWalk.walkStream('path', {});
|
|
||||||
const stream = fsWalk.walkStream('path', new fsWalk.Settings());
|
|
||||||
```
|
|
||||||
|
|
||||||
### .walkSync(path, [optionsOrSettings])
|
|
||||||
|
|
||||||
Reads the directory recursively and synchronously. Returns an array of entries.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
const entries = fsWalk.walkSync('path');
|
|
||||||
const entries = fsWalk.walkSync('path', {});
|
|
||||||
const entries = fsWalk.walkSync('path', new fsWalk.Settings());
|
|
||||||
```
|
|
||||||
|
|
||||||
#### path
|
|
||||||
|
|
||||||
* Required: `true`
|
|
||||||
* Type: `string | Buffer | URL`
|
|
||||||
|
|
||||||
A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
||||||
|
|
||||||
#### optionsOrSettings
|
|
||||||
|
|
||||||
* Required: `false`
|
|
||||||
* Type: `Options | Settings`
|
|
||||||
* Default: An instance of `Settings` class
|
|
||||||
|
|
||||||
An [`Options`](#options) object or an instance of [`Settings`](#settings) class.
|
|
||||||
|
|
||||||
> :book: When you pass a plain object, an instance of the `Settings` class will be created automatically. If you plan to call the method frequently, use a pre-created instance of the `Settings` class.
|
|
||||||
|
|
||||||
### Settings([options])
|
|
||||||
|
|
||||||
A class of full settings of the package.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
const settings = new fsWalk.Settings({ followSymbolicLinks: true });
|
|
||||||
|
|
||||||
const entries = fsWalk.walkSync('path', settings);
|
|
||||||
```
|
|
||||||
|
|
||||||
## Entry
|
|
||||||
|
|
||||||
* `name` — The name of the entry (`unknown.txt`).
|
|
||||||
* `path` — The path of the entry relative to call directory (`root/unknown.txt`).
|
|
||||||
* `dirent` — An instance of [`fs.Dirent`](./src/types/index.ts) class.
|
|
||||||
* [`stats`] — An instance of `fs.Stats` class.
|
|
||||||
|
|
||||||
## Options
|
|
||||||
|
|
||||||
### basePath
|
|
||||||
|
|
||||||
* Type: `string`
|
|
||||||
* Default: `undefined`
|
|
||||||
|
|
||||||
By default, all paths are built relative to the root path. You can use this option to set custom root path.
|
|
||||||
|
|
||||||
In the example below we read the files from the `root` directory, but in the results the root path will be `custom`.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
fsWalk.walkSync('root'); // → ['root/file.txt']
|
|
||||||
fsWalk.walkSync('root', { basePath: 'custom' }); // → ['custom/file.txt']
|
|
||||||
```
|
|
||||||
|
|
||||||
### concurrency
|
|
||||||
|
|
||||||
* Type: `number`
|
|
||||||
* Default: `Infinity`
|
|
||||||
|
|
||||||
The maximum number of concurrent calls to `fs.readdir`.
|
|
||||||
|
|
||||||
> :book: The higher the number, the higher performance and the load on the File System. If you want to read in quiet mode, set the value to `4 * os.cpus().length` (4 is default size of [thread pool work scheduling](http://docs.libuv.org/en/v1.x/threadpool.html#thread-pool-work-scheduling)).
|
|
||||||
|
|
||||||
### deepFilter
|
|
||||||
|
|
||||||
* Type: [`DeepFilterFunction`](./src/settings.ts)
|
|
||||||
* Default: `undefined`
|
|
||||||
|
|
||||||
A function that indicates whether the directory will be read deep or not.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
// Skip all directories that starts with `node_modules`
|
|
||||||
const filter: DeepFilterFunction = (entry) => !entry.path.startsWith('node_modules');
|
|
||||||
```
|
|
||||||
|
|
||||||
### entryFilter
|
|
||||||
|
|
||||||
* Type: [`EntryFilterFunction`](./src/settings.ts)
|
|
||||||
* Default: `undefined`
|
|
||||||
|
|
||||||
A function that indicates whether the entry will be included to results or not.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
// Exclude all `.js` files from results
|
|
||||||
const filter: EntryFilterFunction = (entry) => !entry.name.endsWith('.js');
|
|
||||||
```
|
|
||||||
|
|
||||||
### errorFilter
|
|
||||||
|
|
||||||
* Type: [`ErrorFilterFunction`](./src/settings.ts)
|
|
||||||
* Default: `undefined`
|
|
||||||
|
|
||||||
A function that allows you to skip errors that occur when reading directories.
|
|
||||||
|
|
||||||
For example, you can skip `ENOENT` errors if required:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
// Skip all ENOENT errors
|
|
||||||
const filter: ErrorFilterFunction = (error) => error.code == 'ENOENT';
|
|
||||||
```
|
|
||||||
|
|
||||||
### stats
|
|
||||||
|
|
||||||
* Type: `boolean`
|
|
||||||
* Default: `false`
|
|
||||||
|
|
||||||
Adds an instance of `fs.Stats` class to the [`Entry`](#entry).
|
|
||||||
|
|
||||||
> :book: Always use `fs.readdir` with additional `fs.lstat/fs.stat` calls to determine the entry type.
|
|
||||||
|
|
||||||
### followSymbolicLinks
|
|
||||||
|
|
||||||
* Type: `boolean`
|
|
||||||
* Default: `false`
|
|
||||||
|
|
||||||
Follow symbolic links or not. Call `fs.stat` on symbolic link if `true`.
|
|
||||||
|
|
||||||
### `throwErrorOnBrokenSymbolicLink`
|
|
||||||
|
|
||||||
* Type: `boolean`
|
|
||||||
* Default: `true`
|
|
||||||
|
|
||||||
Throw an error when symbolic link is broken if `true` or safely return `lstat` call if `false`.
|
|
||||||
|
|
||||||
### `pathSegmentSeparator`
|
|
||||||
|
|
||||||
* Type: `string`
|
|
||||||
* Default: `path.sep`
|
|
||||||
|
|
||||||
By default, this package uses the correct path separator for your OS (`\` on Windows, `/` on Unix-like systems). But you can set this option to any separator character(s) that you want to use instead.
|
|
||||||
|
|
||||||
### `fs`
|
|
||||||
|
|
||||||
* Type: `FileSystemAdapter`
|
|
||||||
* Default: A default FS methods
|
|
||||||
|
|
||||||
By default, the built-in Node.js module (`fs`) is used to work with the file system. You can replace any method with your own.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
interface FileSystemAdapter {
|
|
||||||
lstat: typeof fs.lstat;
|
|
||||||
stat: typeof fs.stat;
|
|
||||||
lstatSync: typeof fs.lstatSync;
|
|
||||||
statSync: typeof fs.statSync;
|
|
||||||
readdir: typeof fs.readdir;
|
|
||||||
readdirSync: typeof fs.readdirSync;
|
|
||||||
}
|
|
||||||
|
|
||||||
const settings = new fsWalk.Settings({
|
|
||||||
fs: { lstat: fakeLstat }
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
## Changelog
|
|
||||||
|
|
||||||
See the [Releases section of our GitHub project](https://github.com/nodelib/nodelib/releases) for changelog for each release version.
|
|
||||||
|
|
||||||
## License
|
|
||||||
|
|
||||||
This software is released under the terms of the MIT license.
|
|
||||||
14
node_modules/@nodelib/fs.walk/out/index.d.ts
generated
vendored
14
node_modules/@nodelib/fs.walk/out/index.d.ts
generated
vendored
@ -1,14 +0,0 @@
|
|||||||
/// <reference types="node" />
|
|
||||||
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 type { Entry } from './types';
|
|
||||||
declare function walk(directory: string, 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[]>;
|
|
||||||
}
|
|
||||||
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 };
|
|
||||||
34
node_modules/@nodelib/fs.walk/out/index.js
generated
vendored
34
node_modules/@nodelib/fs.walk/out/index.js
generated
vendored
@ -1,34 +0,0 @@
|
|||||||
"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);
|
|
||||||
}
|
|
||||||
exports.walk = walk;
|
|
||||||
function walkSync(directory, optionsOrSettings) {
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
exports.walkStream = walkStream;
|
|
||||||
function getSettings(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
@ -1,12 +0,0 @@
|
|||||||
import AsyncReader from '../readers/async';
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
30
node_modules/@nodelib/fs.walk/out/providers/async.js
generated
vendored
30
node_modules/@nodelib/fs.walk/out/providers/async.js
generated
vendored
@ -1,30 +0,0 @@
|
|||||||
"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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.default = AsyncProvider;
|
|
||||||
function callFailureCallback(callback, error) {
|
|
||||||
callback(error);
|
|
||||||
}
|
|
||||||
function callSuccessCallback(callback, entries) {
|
|
||||||
callback(null, entries);
|
|
||||||
}
|
|
||||||
4
node_modules/@nodelib/fs.walk/out/providers/index.d.ts
generated
vendored
4
node_modules/@nodelib/fs.walk/out/providers/index.d.ts
generated
vendored
@ -1,4 +0,0 @@
|
|||||||
import AsyncProvider from './async';
|
|
||||||
import StreamProvider from './stream';
|
|
||||||
import SyncProvider from './sync';
|
|
||||||
export { AsyncProvider, StreamProvider, SyncProvider };
|
|
||||||
9
node_modules/@nodelib/fs.walk/out/providers/index.js
generated
vendored
9
node_modules/@nodelib/fs.walk/out/providers/index.js
generated
vendored
@ -1,9 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.SyncProvider = exports.StreamProvider = exports.AsyncProvider = void 0;
|
|
||||||
const async_1 = require("./async");
|
|
||||||
exports.AsyncProvider = async_1.default;
|
|
||||||
const stream_1 = require("./stream");
|
|
||||||
exports.StreamProvider = stream_1.default;
|
|
||||||
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
@ -1,12 +0,0 @@
|
|||||||
/// <reference types="node" />
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
34
node_modules/@nodelib/fs.walk/out/providers/stream.js
generated
vendored
34
node_modules/@nodelib/fs.walk/out/providers/stream.js
generated
vendored
@ -1,34 +0,0 @@
|
|||||||
"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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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
@ -1,10 +0,0 @@
|
|||||||
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[];
|
|
||||||
}
|
|
||||||
14
node_modules/@nodelib/fs.walk/out/providers/sync.js
generated
vendored
14
node_modules/@nodelib/fs.walk/out/providers/sync.js
generated
vendored
@ -1,14 +0,0 @@
|
|||||||
"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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.default = SyncProvider;
|
|
||||||
30
node_modules/@nodelib/fs.walk/out/readers/async.d.ts
generated
vendored
30
node_modules/@nodelib/fs.walk/out/readers/async.d.ts
generated
vendored
@ -1,30 +0,0 @@
|
|||||||
/// <reference types="node" />
|
|
||||||
import { EventEmitter } from 'events';
|
|
||||||
import * as fsScandir from '@nodelib/fs.scandir';
|
|
||||||
import type Settings from '../settings';
|
|
||||||
import type { Entry, Errno } from '../types';
|
|
||||||
import Reader from './reader';
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
export {};
|
|
||||||
97
node_modules/@nodelib/fs.walk/out/readers/async.js
generated
vendored
97
node_modules/@nodelib/fs.walk/out/readers/async.js
generated
vendored
@ -1,97 +0,0 @@
|
|||||||
"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');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
for (const entry of entries) {
|
|
||||||
this._handleEntry(entry, item.base);
|
|
||||||
}
|
|
||||||
done(null, undefined);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
_handleError(error) {
|
|
||||||
if (this._isDestroyed || !common.isFatalError(this._settings, error)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this._isFatalError = true;
|
|
||||||
this._isDestroyed = true;
|
|
||||||
this._emitter.emit('error', error);
|
|
||||||
}
|
|
||||||
_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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_emitEntry(entry) {
|
|
||||||
this._emitter.emit('entry', entry);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.default = AsyncReader;
|
|
||||||
7
node_modules/@nodelib/fs.walk/out/readers/common.d.ts
generated
vendored
7
node_modules/@nodelib/fs.walk/out/readers/common.d.ts
generated
vendored
@ -1,7 +0,0 @@
|
|||||||
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;
|
|
||||||
31
node_modules/@nodelib/fs.walk/out/readers/common.js
generated
vendored
31
node_modules/@nodelib/fs.walk/out/readers/common.js
generated
vendored
@ -1,31 +0,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);
|
|
||||||
}
|
|
||||||
exports.isFatalError = isFatalError;
|
|
||||||
function isAppliedFilter(filter, value) {
|
|
||||||
return filter === null || filter(value);
|
|
||||||
}
|
|
||||||
exports.isAppliedFilter = isAppliedFilter;
|
|
||||||
function replacePathSegmentSeparator(filepath, 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;
|
|
||||||
}
|
|
||||||
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 +0,0 @@
|
|||||||
import type Settings from '../settings';
|
|
||||||
export default class Reader {
|
|
||||||
protected readonly _root: string;
|
|
||||||
protected readonly _settings: Settings;
|
|
||||||
constructor(_root: string, _settings: Settings);
|
|
||||||
}
|
|
||||||
11
node_modules/@nodelib/fs.walk/out/readers/reader.js
generated
vendored
11
node_modules/@nodelib/fs.walk/out/readers/reader.js
generated
vendored
@ -1,11 +0,0 @@
|
|||||||
"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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.default = Reader;
|
|
||||||
15
node_modules/@nodelib/fs.walk/out/readers/sync.d.ts
generated
vendored
15
node_modules/@nodelib/fs.walk/out/readers/sync.d.ts
generated
vendored
@ -1,15 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
59
node_modules/@nodelib/fs.walk/out/readers/sync.js
generated
vendored
59
node_modules/@nodelib/fs.walk/out/readers/sync.js
generated
vendored
@ -1,59 +0,0 @@
|
|||||||
"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();
|
|
||||||
}
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.default = SyncReader;
|
|
||||||
30
node_modules/@nodelib/fs.walk/out/settings.d.ts
generated
vendored
30
node_modules/@nodelib/fs.walk/out/settings.d.ts
generated
vendored
@ -1,30 +0,0 @@
|
|||||||
import * as fsScandir from '@nodelib/fs.scandir';
|
|
||||||
import type { Entry, Errno } from './types';
|
|
||||||
export declare type FilterFunction<T> = (value: T) => boolean;
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
26
node_modules/@nodelib/fs.walk/out/settings.js
generated
vendored
26
node_modules/@nodelib/fs.walk/out/settings.js
generated
vendored
@ -1,26 +0,0 @@
|
|||||||
"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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.default = Settings;
|
|
||||||
8
node_modules/@nodelib/fs.walk/out/types/index.d.ts
generated
vendored
8
node_modules/@nodelib/fs.walk/out/types/index.d.ts
generated
vendored
@ -1,8 +0,0 @@
|
|||||||
/// <reference types="node" />
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
2
node_modules/@nodelib/fs.walk/out/types/index.js
generated
vendored
2
node_modules/@nodelib/fs.walk/out/types/index.js
generated
vendored
@ -1,2 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
44
node_modules/@nodelib/fs.walk/package.json
generated
vendored
44
node_modules/@nodelib/fs.walk/package.json
generated
vendored
@ -1,44 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@nodelib/fs.walk",
|
|
||||||
"version": "1.2.8",
|
|
||||||
"description": "A library for efficiently walking a directory recursively",
|
|
||||||
"license": "MIT",
|
|
||||||
"repository": "https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.walk",
|
|
||||||
"keywords": [
|
|
||||||
"NodeLib",
|
|
||||||
"fs",
|
|
||||||
"FileSystem",
|
|
||||||
"file system",
|
|
||||||
"walk",
|
|
||||||
"scanner",
|
|
||||||
"crawler"
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 8"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"out/**",
|
|
||||||
"!out/**/*.map",
|
|
||||||
"!out/**/*.spec.*",
|
|
||||||
"!out/**/tests/**"
|
|
||||||
],
|
|
||||||
"main": "out/index.js",
|
|
||||||
"typings": "out/index.d.ts",
|
|
||||||
"scripts": {
|
|
||||||
"clean": "rimraf {tsconfig.tsbuildinfo,out}",
|
|
||||||
"lint": "eslint \"src/**/*.ts\" --cache",
|
|
||||||
"compile": "tsc -b .",
|
|
||||||
"compile:watch": "tsc -p . --watch --sourceMap",
|
|
||||||
"test": "mocha \"out/**/*.spec.js\" -s 0",
|
|
||||||
"build": "npm run clean && npm run compile && npm run lint && npm test",
|
|
||||||
"watch": "npm run clean && npm run compile:watch"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@nodelib/fs.scandir": "2.1.5",
|
|
||||||
"fastq": "^1.6.0"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@nodelib/fs.macchiato": "1.0.4"
|
|
||||||
},
|
|
||||||
"gitHead": "1e5bad48565da2b06b8600e744324ea240bf49d8"
|
|
||||||
}
|
|
||||||
4
node_modules/any-promise/.jshintrc
generated
vendored
4
node_modules/any-promise/.jshintrc
generated
vendored
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"node":true,
|
|
||||||
"strict":true
|
|
||||||
}
|
|
||||||
7
node_modules/any-promise/.npmignore
generated
vendored
7
node_modules/any-promise/.npmignore
generated
vendored
@ -1,7 +0,0 @@
|
|||||||
.git*
|
|
||||||
test/
|
|
||||||
test-browser/
|
|
||||||
build/
|
|
||||||
.travis.yml
|
|
||||||
*.swp
|
|
||||||
Makefile
|
|
||||||
19
node_modules/any-promise/LICENSE
generated
vendored
19
node_modules/any-promise/LICENSE
generated
vendored
@ -1,19 +0,0 @@
|
|||||||
Copyright (C) 2014-2016 Kevin Beaty
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
161
node_modules/any-promise/README.md
generated
vendored
161
node_modules/any-promise/README.md
generated
vendored
@ -1,161 +0,0 @@
|
|||||||
## Any Promise
|
|
||||||
|
|
||||||
[](http://travis-ci.org/kevinbeaty/any-promise)
|
|
||||||
|
|
||||||
Let your library support any ES 2015 (ES6) compatible `Promise` and leave the choice to application authors. The application can *optionally* register its preferred `Promise` implementation and it will be exported when requiring `any-promise` from library code.
|
|
||||||
|
|
||||||
If no preference is registered, defaults to the global `Promise` for newer Node.js versions. The browser version defaults to the window `Promise`, so polyfill or register as necessary.
|
|
||||||
|
|
||||||
### Usage with global Promise:
|
|
||||||
|
|
||||||
Assuming the global `Promise` is the desired implementation:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Install any libraries depending on any-promise
|
|
||||||
$ npm install mz
|
|
||||||
```
|
|
||||||
|
|
||||||
The installed libraries will use global Promise by default.
|
|
||||||
|
|
||||||
```js
|
|
||||||
// in library
|
|
||||||
var Promise = require('any-promise') // the global Promise
|
|
||||||
|
|
||||||
function promiseReturningFunction(){
|
|
||||||
return new Promise(function(resolve, reject){...})
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Usage with registration:
|
|
||||||
|
|
||||||
Assuming `bluebird` is the desired Promise implementation:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Install preferred promise library
|
|
||||||
$ npm install bluebird
|
|
||||||
# Install any-promise to allow registration
|
|
||||||
$ npm install any-promise
|
|
||||||
# Install any libraries you would like to use depending on any-promise
|
|
||||||
$ npm install mz
|
|
||||||
```
|
|
||||||
|
|
||||||
Register your preference in the application entry point before any other `require` of packages that load `any-promise`:
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
// top of application index.js or other entry point
|
|
||||||
require('any-promise/register/bluebird')
|
|
||||||
|
|
||||||
// -or- Equivalent to above, but allows customization of Promise library
|
|
||||||
require('any-promise/register')('bluebird', {Promise: require('bluebird')})
|
|
||||||
```
|
|
||||||
|
|
||||||
Now that the implementation is registered, you can use any package depending on `any-promise`:
|
|
||||||
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
var fsp = require('mz/fs') // mz/fs will use registered bluebird promises
|
|
||||||
var Promise = require('any-promise') // the registered bluebird promise
|
|
||||||
```
|
|
||||||
|
|
||||||
It is safe to call `register` multiple times, but it must always be with the same implementation.
|
|
||||||
|
|
||||||
Again, registration is *optional*. It should only be called by the application user if overriding the global `Promise` implementation is desired.
|
|
||||||
|
|
||||||
### Optional Application Registration
|
|
||||||
|
|
||||||
As an application author, you can *optionally* register a preferred `Promise` implementation on application startup (before any call to `require('any-promise')`:
|
|
||||||
|
|
||||||
You must register your preference before any call to `require('any-promise')` (by you or required packages), and only one implementation can be registered. Typically, this registration would occur at the top of the application entry point.
|
|
||||||
|
|
||||||
|
|
||||||
#### Registration shortcuts
|
|
||||||
|
|
||||||
If you are using a known `Promise` implementation, you can register your preference with a shortcut:
|
|
||||||
|
|
||||||
|
|
||||||
```js
|
|
||||||
require('any-promise/register/bluebird')
|
|
||||||
// -or-
|
|
||||||
import 'any-promise/register/q';
|
|
||||||
```
|
|
||||||
|
|
||||||
Shortcut registration is the preferred registration method as it works in the browser and Node.js. It is also convenient for using with `import` and many test runners, that offer a `--require` flag:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ ava --require=any-promise/register/bluebird test.js
|
|
||||||
```
|
|
||||||
|
|
||||||
Current known implementations include `bluebird`, `q`, `when`, `rsvp`, `es6-promise`, `promise`, `native-promise-only`, `pinkie`, `vow` and `lie`. If you are not using a known implementation, you can use another registration method described below.
|
|
||||||
|
|
||||||
|
|
||||||
#### Basic Registration
|
|
||||||
|
|
||||||
As an alternative to registration shortcuts, you can call the `register` function with the preferred `Promise` implementation. The benefit of this approach is that a `Promise` library can be required by name without being a known implementation. This approach does NOT work in the browser. To use `any-promise` in the browser use either registration shortcuts or specify the `Promise` constructor using advanced registration (see below).
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
require('any-promise/register')('when')
|
|
||||||
// -or- require('any-promise/register')('any other ES6 compatible library (known or otherwise)')
|
|
||||||
```
|
|
||||||
|
|
||||||
This registration method will try to detect the `Promise` constructor from requiring the specified implementation. If you would like to specify your own constructor, see advanced registration.
|
|
||||||
|
|
||||||
|
|
||||||
#### Advanced Registration
|
|
||||||
|
|
||||||
To use the browser version, you should either install a polyfill or explicitly register the `Promise` constructor:
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
require('any-promise/register')('bluebird', {Promise: require('bluebird')})
|
|
||||||
```
|
|
||||||
|
|
||||||
This could also be used for registering a custom `Promise` implementation or subclass.
|
|
||||||
|
|
||||||
Your preference will be registered globally, allowing a single registration even if multiple versions of `any-promise` are installed in the NPM dependency tree or are using multiple bundled JavaScript files in the browser. You can bypass this global registration in options:
|
|
||||||
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
require('../register')('es6-promise', {Promise: require('es6-promise').Promise, global: false})
|
|
||||||
```
|
|
||||||
|
|
||||||
### Library Usage
|
|
||||||
|
|
||||||
To use any `Promise` constructor, simply require it:
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
var Promise = require('any-promise');
|
|
||||||
|
|
||||||
return Promise
|
|
||||||
.all([xf, f, init, coll])
|
|
||||||
.then(fn);
|
|
||||||
|
|
||||||
|
|
||||||
return new Promise(function(resolve, reject){
|
|
||||||
try {
|
|
||||||
resolve(item);
|
|
||||||
} catch(e){
|
|
||||||
reject(e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
Except noted below, libraries using `any-promise` should only use [documented](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) functions as there is no guarantee which implementation will be chosen by the application author. Libraries should never call `register`, only the application user should call if desired.
|
|
||||||
|
|
||||||
|
|
||||||
#### Advanced Library Usage
|
|
||||||
|
|
||||||
If your library needs to branch code based on the registered implementation, you can retrieve it using `var impl = require('any-promise/implementation')`, where `impl` will be the package name (`"bluebird"`, `"when"`, etc.) if registered, `"global.Promise"` if using the global version on Node.js, or `"window.Promise"` if using the browser version. You should always include a default case, as there is no guarantee what package may be registered.
|
|
||||||
|
|
||||||
|
|
||||||
### Support for old Node.js versions
|
|
||||||
|
|
||||||
Node.js versions prior to `v0.12` may have contained buggy versions of the global `Promise`. For this reason, the global `Promise` is not loaded automatically for these old versions. If using `any-promise` in Node.js versions versions `<= v0.12`, the user should register a desired implementation.
|
|
||||||
|
|
||||||
If an implementation is not registered, `any-promise` will attempt to discover an installed `Promise` implementation. If no implementation can be found, an error will be thrown on `require('any-promise')`. While the auto-discovery usually avoids errors, it is non-deterministic. It is recommended that the user always register a preferred implementation for older Node.js versions.
|
|
||||||
|
|
||||||
This auto-discovery is only available for Node.jS versions prior to `v0.12`. Any newer versions will always default to the global `Promise` implementation.
|
|
||||||
|
|
||||||
### Related
|
|
||||||
|
|
||||||
- [any-observable](https://github.com/sindresorhus/any-observable) - `any-promise` for Observables.
|
|
||||||
|
|
||||||
3
node_modules/any-promise/implementation.d.ts
generated
vendored
3
node_modules/any-promise/implementation.d.ts
generated
vendored
@ -1,3 +0,0 @@
|
|||||||
declare var implementation: string;
|
|
||||||
|
|
||||||
export = implementation;
|
|
||||||
1
node_modules/any-promise/implementation.js
generated
vendored
1
node_modules/any-promise/implementation.js
generated
vendored
@ -1 +0,0 @@
|
|||||||
module.exports = require('./register')().implementation
|
|
||||||
73
node_modules/any-promise/index.d.ts
generated
vendored
73
node_modules/any-promise/index.d.ts
generated
vendored
@ -1,73 +0,0 @@
|
|||||||
declare class Promise <R> implements Promise.Thenable <R> {
|
|
||||||
/**
|
|
||||||
* If you call resolve in the body of the callback passed to the constructor,
|
|
||||||
* your promise is fulfilled with result object passed to resolve.
|
|
||||||
* If you call reject your promise is rejected with the object passed to resolve.
|
|
||||||
* For consistency and debugging (eg stack traces), obj should be an instanceof Error.
|
|
||||||
* Any errors thrown in the constructor callback will be implicitly passed to reject().
|
|
||||||
*/
|
|
||||||
constructor (callback: (resolve : (value?: R | Promise.Thenable<R>) => void, reject: (error?: any) => void) => void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
|
|
||||||
* Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
|
|
||||||
* Both callbacks have a single parameter , the fulfillment value or rejection reason.
|
|
||||||
* "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve.
|
|
||||||
* If an error is thrown in the callback, the returned promise rejects with that error.
|
|
||||||
*
|
|
||||||
* @param onFulfilled called when/if "promise" resolves
|
|
||||||
* @param onRejected called when/if "promise" rejects
|
|
||||||
*/
|
|
||||||
then <U> (onFulfilled?: (value: R) => U | Promise.Thenable<U>, onRejected?: (error: any) => U | Promise.Thenable<U>): Promise<U>;
|
|
||||||
then <U> (onFulfilled?: (value: R) => U | Promise.Thenable<U>, onRejected?: (error: any) => void): Promise<U>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sugar for promise.then(undefined, onRejected)
|
|
||||||
*
|
|
||||||
* @param onRejected called when/if "promise" rejects
|
|
||||||
*/
|
|
||||||
catch <U> (onRejected?: (error: any) => U | Promise.Thenable<U>): Promise<U>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Make a new promise from the thenable.
|
|
||||||
* A thenable is promise-like in as far as it has a "then" method.
|
|
||||||
*/
|
|
||||||
static resolve (): Promise<void>;
|
|
||||||
static resolve <R> (value: R | Promise.Thenable<R>): Promise<R>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Make a promise that rejects to obj. For consistency and debugging (eg stack traces), obj should be an instanceof Error
|
|
||||||
*/
|
|
||||||
static reject <R> (error: any): Promise<R>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Make a promise that fulfills when every item in the array fulfills, and rejects if (and when) any item rejects.
|
|
||||||
* the array passed to all can be a mixture of promise-like objects and other objects.
|
|
||||||
* The fulfillment value is an array (in order) of fulfillment values. The rejection value is the first rejection value.
|
|
||||||
*/
|
|
||||||
static all <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> (values: [T1 | Promise.Thenable<T1>, T2 | Promise.Thenable<T2>, T3 | Promise.Thenable<T3>, T4 | Promise.Thenable <T4>, T5 | Promise.Thenable<T5>, T6 | Promise.Thenable<T6>, T7 | Promise.Thenable<T7>, T8 | Promise.Thenable<T8>, T9 | Promise.Thenable<T9>, T10 | Promise.Thenable<T10>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
|
|
||||||
static all <T1, T2, T3, T4, T5, T6, T7, T8, T9> (values: [T1 | Promise.Thenable<T1>, T2 | Promise.Thenable<T2>, T3 | Promise.Thenable<T3>, T4 | Promise.Thenable <T4>, T5 | Promise.Thenable<T5>, T6 | Promise.Thenable<T6>, T7 | Promise.Thenable<T7>, T8 | Promise.Thenable<T8>, T9 | Promise.Thenable<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
|
|
||||||
static all <T1, T2, T3, T4, T5, T6, T7, T8> (values: [T1 | Promise.Thenable<T1>, T2 | Promise.Thenable<T2>, T3 | Promise.Thenable<T3>, T4 | Promise.Thenable <T4>, T5 | Promise.Thenable<T5>, T6 | Promise.Thenable<T6>, T7 | Promise.Thenable<T7>, T8 | Promise.Thenable<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
|
|
||||||
static all <T1, T2, T3, T4, T5, T6, T7> (values: [T1 | Promise.Thenable<T1>, T2 | Promise.Thenable<T2>, T3 | Promise.Thenable<T3>, T4 | Promise.Thenable <T4>, T5 | Promise.Thenable<T5>, T6 | Promise.Thenable<T6>, T7 | Promise.Thenable<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>;
|
|
||||||
static all <T1, T2, T3, T4, T5, T6> (values: [T1 | Promise.Thenable<T1>, T2 | Promise.Thenable<T2>, T3 | Promise.Thenable<T3>, T4 | Promise.Thenable <T4>, T5 | Promise.Thenable<T5>, T6 | Promise.Thenable<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>;
|
|
||||||
static all <T1, T2, T3, T4, T5> (values: [T1 | Promise.Thenable<T1>, T2 | Promise.Thenable<T2>, T3 | Promise.Thenable<T3>, T4 | Promise.Thenable <T4>, T5 | Promise.Thenable<T5>]): Promise<[T1, T2, T3, T4, T5]>;
|
|
||||||
static all <T1, T2, T3, T4> (values: [T1 | Promise.Thenable<T1>, T2 | Promise.Thenable<T2>, T3 | Promise.Thenable<T3>, T4 | Promise.Thenable <T4>]): Promise<[T1, T2, T3, T4]>;
|
|
||||||
static all <T1, T2, T3> (values: [T1 | Promise.Thenable<T1>, T2 | Promise.Thenable<T2>, T3 | Promise.Thenable<T3>]): Promise<[T1, T2, T3]>;
|
|
||||||
static all <T1, T2> (values: [T1 | Promise.Thenable<T1>, T2 | Promise.Thenable<T2>]): Promise<[T1, T2]>;
|
|
||||||
static all <T1> (values: [T1 | Promise.Thenable<T1>]): Promise<[T1]>;
|
|
||||||
static all <TAll> (values: Array<TAll | Promise.Thenable<TAll>>): Promise<TAll[]>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Make a Promise that fulfills when any item fulfills, and rejects if any item rejects.
|
|
||||||
*/
|
|
||||||
static race <R> (promises: (R | Promise.Thenable<R>)[]): Promise<R>;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare namespace Promise {
|
|
||||||
export interface Thenable <R> {
|
|
||||||
then <U> (onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Thenable<U>;
|
|
||||||
then <U> (onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => void): Thenable<U>;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export = Promise;
|
|
||||||
1
node_modules/any-promise/index.js
generated
vendored
1
node_modules/any-promise/index.js
generated
vendored
@ -1 +0,0 @@
|
|||||||
module.exports = require('./register')().Promise
|
|
||||||
78
node_modules/any-promise/loader.js
generated
vendored
78
node_modules/any-promise/loader.js
generated
vendored
@ -1,78 +0,0 @@
|
|||||||
"use strict"
|
|
||||||
// global key for user preferred registration
|
|
||||||
var REGISTRATION_KEY = '@@any-promise/REGISTRATION',
|
|
||||||
// Prior registration (preferred or detected)
|
|
||||||
registered = null
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Registers the given implementation. An implementation must
|
|
||||||
* be registered prior to any call to `require("any-promise")`,
|
|
||||||
* typically on application load.
|
|
||||||
*
|
|
||||||
* If called with no arguments, will return registration in
|
|
||||||
* following priority:
|
|
||||||
*
|
|
||||||
* For Node.js:
|
|
||||||
*
|
|
||||||
* 1. Previous registration
|
|
||||||
* 2. global.Promise if node.js version >= 0.12
|
|
||||||
* 3. Auto detected promise based on first sucessful require of
|
|
||||||
* known promise libraries. Note this is a last resort, as the
|
|
||||||
* loaded library is non-deterministic. node.js >= 0.12 will
|
|
||||||
* always use global.Promise over this priority list.
|
|
||||||
* 4. Throws error.
|
|
||||||
*
|
|
||||||
* For Browser:
|
|
||||||
*
|
|
||||||
* 1. Previous registration
|
|
||||||
* 2. window.Promise
|
|
||||||
* 3. Throws error.
|
|
||||||
*
|
|
||||||
* Options:
|
|
||||||
*
|
|
||||||
* Promise: Desired Promise constructor
|
|
||||||
* global: Boolean - Should the registration be cached in a global variable to
|
|
||||||
* allow cross dependency/bundle registration? (default true)
|
|
||||||
*/
|
|
||||||
module.exports = function(root, loadImplementation){
|
|
||||||
return function register(implementation, opts){
|
|
||||||
implementation = implementation || null
|
|
||||||
opts = opts || {}
|
|
||||||
// global registration unless explicitly {global: false} in options (default true)
|
|
||||||
var registerGlobal = opts.global !== false;
|
|
||||||
|
|
||||||
// load any previous global registration
|
|
||||||
if(registered === null && registerGlobal){
|
|
||||||
registered = root[REGISTRATION_KEY] || null
|
|
||||||
}
|
|
||||||
|
|
||||||
if(registered !== null
|
|
||||||
&& implementation !== null
|
|
||||||
&& registered.implementation !== implementation){
|
|
||||||
// Throw error if attempting to redefine implementation
|
|
||||||
throw new Error('any-promise already defined as "'+registered.implementation+
|
|
||||||
'". You can only register an implementation before the first '+
|
|
||||||
' call to require("any-promise") and an implementation cannot be changed')
|
|
||||||
}
|
|
||||||
|
|
||||||
if(registered === null){
|
|
||||||
// use provided implementation
|
|
||||||
if(implementation !== null && typeof opts.Promise !== 'undefined'){
|
|
||||||
registered = {
|
|
||||||
Promise: opts.Promise,
|
|
||||||
implementation: implementation
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// require implementation if implementation is specified but not provided
|
|
||||||
registered = loadImplementation(implementation)
|
|
||||||
}
|
|
||||||
|
|
||||||
if(registerGlobal){
|
|
||||||
// register preference globally in case multiple installations
|
|
||||||
root[REGISTRATION_KEY] = registered
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return registered
|
|
||||||
}
|
|
||||||
}
|
|
||||||
6
node_modules/any-promise/optional.js
generated
vendored
6
node_modules/any-promise/optional.js
generated
vendored
@ -1,6 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
try {
|
|
||||||
module.exports = require('./register')().Promise || null
|
|
||||||
} catch(e) {
|
|
||||||
module.exports = null
|
|
||||||
}
|
|
||||||
45
node_modules/any-promise/package.json
generated
vendored
45
node_modules/any-promise/package.json
generated
vendored
@ -1,45 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "any-promise",
|
|
||||||
"version": "1.3.0",
|
|
||||||
"description": "Resolve any installed ES6 compatible promise",
|
|
||||||
"main": "index.js",
|
|
||||||
"typings": "index.d.ts",
|
|
||||||
"browser": {
|
|
||||||
"./register.js": "./register-shim.js"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"test": "ava"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/kevinbeaty/any-promise"
|
|
||||||
},
|
|
||||||
"keywords": [
|
|
||||||
"promise",
|
|
||||||
"es6"
|
|
||||||
],
|
|
||||||
"author": "Kevin Beaty",
|
|
||||||
"license": "MIT",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/kevinbeaty/any-promise/issues"
|
|
||||||
},
|
|
||||||
"homepage": "http://github.com/kevinbeaty/any-promise",
|
|
||||||
"dependencies": {},
|
|
||||||
"devDependencies": {
|
|
||||||
"ava": "^0.14.0",
|
|
||||||
"bluebird": "^3.0.0",
|
|
||||||
"es6-promise": "^3.0.0",
|
|
||||||
"is-promise": "^2.0.0",
|
|
||||||
"lie": "^3.0.0",
|
|
||||||
"mocha": "^2.0.0",
|
|
||||||
"native-promise-only": "^0.8.0",
|
|
||||||
"phantomjs-prebuilt": "^2.0.0",
|
|
||||||
"pinkie": "^2.0.0",
|
|
||||||
"promise": "^7.0.0",
|
|
||||||
"q": "^1.0.0",
|
|
||||||
"rsvp": "^3.0.0",
|
|
||||||
"vow": "^0.4.0",
|
|
||||||
"when": "^3.0.0",
|
|
||||||
"zuul": "^3.0.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
18
node_modules/any-promise/register-shim.js
generated
vendored
18
node_modules/any-promise/register-shim.js
generated
vendored
@ -1,18 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
module.exports = require('./loader')(window, loadImplementation)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Browser specific loadImplementation. Always uses `window.Promise`
|
|
||||||
*
|
|
||||||
* To register a custom implementation, must register with `Promise` option.
|
|
||||||
*/
|
|
||||||
function loadImplementation(){
|
|
||||||
if(typeof window.Promise === 'undefined'){
|
|
||||||
throw new Error("any-promise browser requires a polyfill or explicit registration"+
|
|
||||||
" e.g: require('any-promise/register/bluebird')")
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
Promise: window.Promise,
|
|
||||||
implementation: 'window.Promise'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
17
node_modules/any-promise/register.d.ts
generated
vendored
17
node_modules/any-promise/register.d.ts
generated
vendored
@ -1,17 +0,0 @@
|
|||||||
import Promise = require('./index');
|
|
||||||
|
|
||||||
declare function register (module?: string, options?: register.Options): register.Register;
|
|
||||||
|
|
||||||
declare namespace register {
|
|
||||||
export interface Register {
|
|
||||||
Promise: typeof Promise;
|
|
||||||
implementation: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Options {
|
|
||||||
Promise?: typeof Promise;
|
|
||||||
global?: boolean
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export = register;
|
|
||||||
94
node_modules/any-promise/register.js
generated
vendored
94
node_modules/any-promise/register.js
generated
vendored
@ -1,94 +0,0 @@
|
|||||||
"use strict"
|
|
||||||
module.exports = require('./loader')(global, loadImplementation);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Node.js version of loadImplementation.
|
|
||||||
*
|
|
||||||
* Requires the given implementation and returns the registration
|
|
||||||
* containing {Promise, implementation}
|
|
||||||
*
|
|
||||||
* If implementation is undefined or global.Promise, loads it
|
|
||||||
* Otherwise uses require
|
|
||||||
*/
|
|
||||||
function loadImplementation(implementation){
|
|
||||||
var impl = null
|
|
||||||
|
|
||||||
if(shouldPreferGlobalPromise(implementation)){
|
|
||||||
// if no implementation or env specified use global.Promise
|
|
||||||
impl = {
|
|
||||||
Promise: global.Promise,
|
|
||||||
implementation: 'global.Promise'
|
|
||||||
}
|
|
||||||
} else if(implementation){
|
|
||||||
// if implementation specified, require it
|
|
||||||
var lib = require(implementation)
|
|
||||||
impl = {
|
|
||||||
Promise: lib.Promise || lib,
|
|
||||||
implementation: implementation
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// try to auto detect implementation. This is non-deterministic
|
|
||||||
// and should prefer other branches, but this is our last chance
|
|
||||||
// to load something without throwing error
|
|
||||||
impl = tryAutoDetect()
|
|
||||||
}
|
|
||||||
|
|
||||||
if(impl === null){
|
|
||||||
throw new Error('Cannot find any-promise implementation nor'+
|
|
||||||
' global.Promise. You must install polyfill or call'+
|
|
||||||
' require("any-promise/register") with your preferred'+
|
|
||||||
' implementation, e.g. require("any-promise/register/bluebird")'+
|
|
||||||
' on application load prior to any require("any-promise").')
|
|
||||||
}
|
|
||||||
|
|
||||||
return impl
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determines if the global.Promise should be preferred if an implementation
|
|
||||||
* has not been registered.
|
|
||||||
*/
|
|
||||||
function shouldPreferGlobalPromise(implementation){
|
|
||||||
if(implementation){
|
|
||||||
return implementation === 'global.Promise'
|
|
||||||
} else if(typeof global.Promise !== 'undefined'){
|
|
||||||
// Load global promise if implementation not specified
|
|
||||||
// Versions < 0.11 did not have global Promise
|
|
||||||
// Do not use for version < 0.12 as version 0.11 contained buggy versions
|
|
||||||
var version = (/v(\d+)\.(\d+)\.(\d+)/).exec(process.version)
|
|
||||||
return !(version && +version[1] == 0 && +version[2] < 12)
|
|
||||||
}
|
|
||||||
|
|
||||||
// do not have global.Promise or another implementation was specified
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Look for common libs as last resort there is no guarantee that
|
|
||||||
* this will return a desired implementation or even be deterministic.
|
|
||||||
* The priority is also nearly arbitrary. We are only doing this
|
|
||||||
* for older versions of Node.js <0.12 that do not have a reasonable
|
|
||||||
* global.Promise implementation and we the user has not registered
|
|
||||||
* the preference. This preserves the behavior of any-promise <= 0.1
|
|
||||||
* and may be deprecated or removed in the future
|
|
||||||
*/
|
|
||||||
function tryAutoDetect(){
|
|
||||||
var libs = [
|
|
||||||
"es6-promise",
|
|
||||||
"promise",
|
|
||||||
"native-promise-only",
|
|
||||||
"bluebird",
|
|
||||||
"rsvp",
|
|
||||||
"when",
|
|
||||||
"q",
|
|
||||||
"pinkie",
|
|
||||||
"lie",
|
|
||||||
"vow"]
|
|
||||||
var i = 0, len = libs.length
|
|
||||||
for(; i < len; i++){
|
|
||||||
try {
|
|
||||||
return loadImplementation(libs[i])
|
|
||||||
} catch(e){}
|
|
||||||
}
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
1
node_modules/any-promise/register/bluebird.d.ts
generated
vendored
1
node_modules/any-promise/register/bluebird.d.ts
generated
vendored
@ -1 +0,0 @@
|
|||||||
export {}
|
|
||||||
2
node_modules/any-promise/register/bluebird.js
generated
vendored
2
node_modules/any-promise/register/bluebird.js
generated
vendored
@ -1,2 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
require('../register')('bluebird', {Promise: require('bluebird')})
|
|
||||||
1
node_modules/any-promise/register/es6-promise.d.ts
generated
vendored
1
node_modules/any-promise/register/es6-promise.d.ts
generated
vendored
@ -1 +0,0 @@
|
|||||||
export {}
|
|
||||||
2
node_modules/any-promise/register/es6-promise.js
generated
vendored
2
node_modules/any-promise/register/es6-promise.js
generated
vendored
@ -1,2 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
require('../register')('es6-promise', {Promise: require('es6-promise').Promise})
|
|
||||||
1
node_modules/any-promise/register/lie.d.ts
generated
vendored
1
node_modules/any-promise/register/lie.d.ts
generated
vendored
@ -1 +0,0 @@
|
|||||||
export {}
|
|
||||||
2
node_modules/any-promise/register/lie.js
generated
vendored
2
node_modules/any-promise/register/lie.js
generated
vendored
@ -1,2 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
require('../register')('lie', {Promise: require('lie')})
|
|
||||||
1
node_modules/any-promise/register/native-promise-only.d.ts
generated
vendored
1
node_modules/any-promise/register/native-promise-only.d.ts
generated
vendored
@ -1 +0,0 @@
|
|||||||
export {}
|
|
||||||
2
node_modules/any-promise/register/native-promise-only.js
generated
vendored
2
node_modules/any-promise/register/native-promise-only.js
generated
vendored
@ -1,2 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
require('../register')('native-promise-only', {Promise: require('native-promise-only')})
|
|
||||||
1
node_modules/any-promise/register/pinkie.d.ts
generated
vendored
1
node_modules/any-promise/register/pinkie.d.ts
generated
vendored
@ -1 +0,0 @@
|
|||||||
export {}
|
|
||||||
2
node_modules/any-promise/register/pinkie.js
generated
vendored
2
node_modules/any-promise/register/pinkie.js
generated
vendored
@ -1,2 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
require('../register')('pinkie', {Promise: require('pinkie')})
|
|
||||||
1
node_modules/any-promise/register/promise.d.ts
generated
vendored
1
node_modules/any-promise/register/promise.d.ts
generated
vendored
@ -1 +0,0 @@
|
|||||||
export {}
|
|
||||||
2
node_modules/any-promise/register/promise.js
generated
vendored
2
node_modules/any-promise/register/promise.js
generated
vendored
@ -1,2 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
require('../register')('promise', {Promise: require('promise')})
|
|
||||||
1
node_modules/any-promise/register/q.d.ts
generated
vendored
1
node_modules/any-promise/register/q.d.ts
generated
vendored
@ -1 +0,0 @@
|
|||||||
export {}
|
|
||||||
2
node_modules/any-promise/register/q.js
generated
vendored
2
node_modules/any-promise/register/q.js
generated
vendored
@ -1,2 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
require('../register')('q', {Promise: require('q').Promise})
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user