progress on migrating to heex templates and font-icons
This commit is contained in:
parent
d43daafdb7
commit
3eff955672
21793 changed files with 2161968 additions and 16895 deletions
assets_old/node_modules/@nodelib
fs.scandir
.eslintcacheLICENSEREADME.mdpackage.json
out
adapters
constants.d.tsconstants.d.ts.mapconstants.jsindex.d.tsindex.d.ts.mapindex.jsindex.spec.d.tsindex.spec.d.ts.mapindex.spec.jsproviders
async.d.tsasync.d.ts.mapasync.jsasync.spec.d.tsasync.spec.d.ts.mapasync.spec.jscommon.d.tscommon.d.ts.mapcommon.jscommon.spec.d.tscommon.spec.d.ts.mapcommon.spec.jssync.d.tssync.d.ts.mapsync.jssync.spec.d.tssync.spec.d.ts.mapsync.spec.js
settings.d.tssettings.d.ts.mapsettings.jssettings.spec.d.tssettings.spec.d.ts.mapsettings.spec.jstypes
utils
src
tsconfig.jsontsconfig.tsbuildinfofs.stat
1
assets_old/node_modules/@nodelib/fs.scandir/.eslintcache
generated
vendored
Normal file
1
assets_old/node_modules/@nodelib/fs.scandir/.eslintcache
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
21
assets_old/node_modules/@nodelib/fs.scandir/LICENSE
generated
vendored
Normal file
21
assets_old/node_modules/@nodelib/fs.scandir/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
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
assets_old/node_modules/@nodelib/fs.scandir/README.md
generated
vendored
Normal file
171
assets_old/node_modules/@nodelib/fs.scandir/README.md
generated
vendored
Normal file
|
@ -0,0 +1,171 @@
|
|||
# @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.
|
13
assets_old/node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts
generated
vendored
Normal file
13
assets_old/node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
/// <reference types="node" />
|
||||
import * as fs from 'fs';
|
||||
export declare type 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;
|
||||
};
|
||||
export declare const FILE_SYSTEM_ADAPTER: FileSystemAdapter;
|
||||
export declare function createFileSystemAdapter(fsMethods?: Partial<FileSystemAdapter>): FileSystemAdapter;
|
||||
//# sourceMappingURL=fs.d.ts.map
|
1
assets_old/node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts.map
generated
vendored
Normal file
1
assets_old/node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../src/adapters/fs.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAEzB,oBAAY,iBAAiB,GAAG;IAC/B,KAAK,EAAE,OAAO,EAAE,CAAC,KAAK,CAAC;IACvB,IAAI,EAAE,OAAO,EAAE,CAAC,IAAI,CAAC;IACrB,SAAS,EAAE,OAAO,EAAE,CAAC,SAAS,CAAC;IAC/B,QAAQ,EAAE,OAAO,EAAE,CAAC,QAAQ,CAAC;IAC7B,OAAO,EAAE,OAAO,EAAE,CAAC,OAAO,CAAC;IAC3B,WAAW,EAAE,OAAO,EAAE,CAAC,WAAW,CAAC;CACnC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,iBAOjC,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,iBAAiB,CASjG"}
|
19
assets_old/node_modules/@nodelib/fs.scandir/out/adapters/fs.js
generated
vendored
Normal file
19
assets_old/node_modules/@nodelib/fs.scandir/out/adapters/fs.js
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
"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;
|
2
assets_old/node_modules/@nodelib/fs.scandir/out/adapters/fs.spec.d.ts
generated
vendored
Normal file
2
assets_old/node_modules/@nodelib/fs.scandir/out/adapters/fs.spec.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
export {};
|
||||
//# sourceMappingURL=fs.spec.d.ts.map
|
1
assets_old/node_modules/@nodelib/fs.scandir/out/adapters/fs.spec.d.ts.map
generated
vendored
Normal file
1
assets_old/node_modules/@nodelib/fs.scandir/out/adapters/fs.spec.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"fs.spec.d.ts","sourceRoot":"","sources":["../../src/adapters/fs.spec.ts"],"names":[],"mappings":""}
|
20
assets_old/node_modules/@nodelib/fs.scandir/out/adapters/fs.spec.js
generated
vendored
Normal file
20
assets_old/node_modules/@nodelib/fs.scandir/out/adapters/fs.spec.js
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const assert = require("assert");
|
||||
const fs_macchiato_1 = require("../../../fs.macchiato");
|
||||
const adapter = require("./fs");
|
||||
describe('Adapters → FileSystem', () => {
|
||||
it('should return original FS methods', () => {
|
||||
const expected = adapter.FILE_SYSTEM_ADAPTER;
|
||||
const actual = adapter.createFileSystemAdapter();
|
||||
assert.deepStrictEqual(actual, expected);
|
||||
});
|
||||
it('should return custom FS methods', () => {
|
||||
const customLstatSyncMethod = () => new fs_macchiato_1.Stats();
|
||||
const expected = Object.assign(Object.assign({}, adapter.FILE_SYSTEM_ADAPTER), { lstatSync: customLstatSyncMethod });
|
||||
const actual = adapter.createFileSystemAdapter({
|
||||
lstatSync: customLstatSyncMethod
|
||||
});
|
||||
assert.deepStrictEqual(actual, expected);
|
||||
});
|
||||
});
|
5
assets_old/node_modules/@nodelib/fs.scandir/out/constants.d.ts
generated
vendored
Normal file
5
assets_old/node_modules/@nodelib/fs.scandir/out/constants.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
/**
|
||||
* IS `true` for Node.js 10.10 and greater.
|
||||
*/
|
||||
export declare const IS_SUPPORT_READDIR_WITH_FILE_TYPES: boolean;
|
||||
//# sourceMappingURL=constants.d.ts.map
|
1
assets_old/node_modules/@nodelib/fs.scandir/out/constants.d.ts.map
generated
vendored
Normal file
1
assets_old/node_modules/@nodelib/fs.scandir/out/constants.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAWA;;GAEG;AACH,eAAO,MAAM,kCAAkC,SAAuD,CAAC"}
|
14
assets_old/node_modules/@nodelib/fs.scandir/out/constants.js
generated
vendored
Normal file
14
assets_old/node_modules/@nodelib/fs.scandir/out/constants.js
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
"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('.');
|
||||
const MAJOR_VERSION = parseInt(NODE_PROCESS_VERSION_PARTS[0], 10);
|
||||
const MINOR_VERSION = 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;
|
13
assets_old/node_modules/@nodelib/fs.scandir/out/index.d.ts
generated
vendored
Normal file
13
assets_old/node_modules/@nodelib/fs.scandir/out/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
import { FileSystemAdapter } from './adapters/fs';
|
||||
import * as async from './providers/async';
|
||||
import Settings, { Options } from './settings';
|
||||
import { 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, Options };
|
||||
//# sourceMappingURL=index.d.ts.map
|
1
assets_old/node_modules/@nodelib/fs.scandir/out/index.d.ts.map
generated
vendored
Normal file
1
assets_old/node_modules/@nodelib/fs.scandir/out/index.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,OAAO,QAAQ,EAAE,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAExC,aAAK,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC;AAEzC,iBAAS,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAC;AAC9D,iBAAS,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,iBAAiB,EAAE,OAAO,GAAG,QAAQ,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAC;AAWrG,OAAO,WAAW,OAAO,CAAC;IACzB,SAAS,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;CAC/F;AAED,iBAAS,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,EAAE,CAIlF;AAUD,OAAO,EACN,OAAO,EACP,WAAW,EACX,QAAQ,EAIR,aAAa,EACb,MAAM,EACN,KAAK,EACL,iBAAiB,EACjB,OAAO,EACP,CAAC"}
|
25
assets_old/node_modules/@nodelib/fs.scandir/out/index.js
generated
vendored
Normal file
25
assets_old/node_modules/@nodelib/fs.scandir/out/index.js
generated
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
"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') {
|
||||
return async.read(path, getSettings(), optionsOrSettingsOrCallback);
|
||||
}
|
||||
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);
|
||||
}
|
2
assets_old/node_modules/@nodelib/fs.scandir/out/index.spec.d.ts
generated
vendored
Normal file
2
assets_old/node_modules/@nodelib/fs.scandir/out/index.spec.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
export {};
|
||||
//# sourceMappingURL=index.spec.d.ts.map
|
1
assets_old/node_modules/@nodelib/fs.scandir/out/index.spec.d.ts.map
generated
vendored
Normal file
1
assets_old/node_modules/@nodelib/fs.scandir/out/index.spec.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.spec.d.ts","sourceRoot":"","sources":["../src/index.spec.ts"],"names":[],"mappings":""}
|
71
assets_old/node_modules/@nodelib/fs.scandir/out/index.spec.js
generated
vendored
Normal file
71
assets_old/node_modules/@nodelib/fs.scandir/out/index.spec.js
generated
vendored
Normal file
|
@ -0,0 +1,71 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const assert = require("assert");
|
||||
const fs = require("fs");
|
||||
const rimraf = require("rimraf");
|
||||
const _1 = require(".");
|
||||
describe('Package', () => {
|
||||
before(() => {
|
||||
rimraf.sync('fixtures');
|
||||
fs.mkdirSync('fixtures');
|
||||
fs.writeFileSync('fixtures/file.txt', '');
|
||||
});
|
||||
after(() => {
|
||||
rimraf.sync('fixtures');
|
||||
});
|
||||
describe('.scandir', () => {
|
||||
it('should work without options or settings', (done) => {
|
||||
_1.scandir('fixtures', (error, entries) => {
|
||||
assert.strictEqual(error, null);
|
||||
assert.ok(entries[0].name);
|
||||
assert.ok(entries[0].path);
|
||||
assert.ok(entries[0].dirent);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('should work with options', (done) => {
|
||||
_1.scandir('fixtures', { stats: true }, (error, entries) => {
|
||||
assert.strictEqual(error, null);
|
||||
assert.ok(entries[0].name);
|
||||
assert.ok(entries[0].path);
|
||||
assert.ok(entries[0].dirent);
|
||||
assert.ok(entries[0].stats);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('should work with settings', (done) => {
|
||||
const settings = new _1.Settings({ stats: true });
|
||||
_1.scandir('fixtures', settings, (error, entries) => {
|
||||
assert.strictEqual(error, null);
|
||||
assert.ok(entries[0].name);
|
||||
assert.ok(entries[0].path);
|
||||
assert.ok(entries[0].dirent);
|
||||
assert.ok(entries[0].stats);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
describe('.scandirSync', () => {
|
||||
it('should work without options or settings', () => {
|
||||
const actual = _1.scandirSync('fixtures');
|
||||
assert.ok(actual[0].name);
|
||||
assert.ok(actual[0].path);
|
||||
assert.ok(actual[0].dirent);
|
||||
});
|
||||
it('should work with options', () => {
|
||||
const actual = _1.scandirSync('fixtures', { stats: true });
|
||||
assert.ok(actual[0].name);
|
||||
assert.ok(actual[0].path);
|
||||
assert.ok(actual[0].dirent);
|
||||
assert.ok(actual[0].stats);
|
||||
});
|
||||
it('should work with settings', () => {
|
||||
const settings = new _1.Settings({ stats: true });
|
||||
const actual = _1.scandirSync('fixtures', settings);
|
||||
assert.ok(actual[0].name);
|
||||
assert.ok(actual[0].path);
|
||||
assert.ok(actual[0].dirent);
|
||||
assert.ok(actual[0].stats);
|
||||
});
|
||||
});
|
||||
});
|
8
assets_old/node_modules/@nodelib/fs.scandir/out/providers/async.d.ts
generated
vendored
Normal file
8
assets_old/node_modules/@nodelib/fs.scandir/out/providers/async.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
/// <reference types="node" />
|
||||
import Settings from '../settings';
|
||||
import { Entry } from '../types';
|
||||
export declare type AsyncCallback = (err: 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;
|
||||
//# sourceMappingURL=async.d.ts.map
|
1
assets_old/node_modules/@nodelib/fs.scandir/out/providers/async.d.ts.map
generated
vendored
Normal file
1
assets_old/node_modules/@nodelib/fs.scandir/out/providers/async.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../../src/providers/async.ts"],"names":[],"mappings":";AAIA,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,KAAK,EAAS,MAAM,UAAU,CAAC;AASxC,oBAAY,aAAa,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,cAAc,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,IAAI,CAAC;AAEnF,wBAAgB,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI,CAMzF;AAED,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI,CA0BzG;AAwBD,wBAAgB,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI,CAsC5F"}
|
92
assets_old/node_modules/@nodelib/fs.scandir/out/providers/async.js
generated
vendored
Normal file
92
assets_old/node_modules/@nodelib/fs.scandir/out/providers/async.js
generated
vendored
Normal file
|
@ -0,0 +1,92 @@
|
|||
"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) {
|
||||
return 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) {
|
||||
return callFailureCallback(callback, readdirError);
|
||||
}
|
||||
const entries = dirents.map((dirent) => ({
|
||||
dirent,
|
||||
name: dirent.name,
|
||||
path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
|
||||
}));
|
||||
if (!settings.followSymbolicLinks) {
|
||||
return callSuccessCallback(callback, entries);
|
||||
}
|
||||
const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings));
|
||||
rpl(tasks, (rplError, rplEntries) => {
|
||||
if (rplError !== null) {
|
||||
return callFailureCallback(callback, rplError);
|
||||
}
|
||||
callSuccessCallback(callback, rplEntries);
|
||||
});
|
||||
});
|
||||
}
|
||||
exports.readdirWithFileTypes = readdirWithFileTypes;
|
||||
function makeRplTaskEntry(entry, settings) {
|
||||
return (done) => {
|
||||
if (!entry.dirent.isSymbolicLink()) {
|
||||
return done(null, entry);
|
||||
}
|
||||
settings.fs.stat(entry.path, (statError, stats) => {
|
||||
if (statError !== null) {
|
||||
if (settings.throwErrorOnBrokenSymbolicLink) {
|
||||
return done(statError);
|
||||
}
|
||||
return done(null, entry);
|
||||
}
|
||||
entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
|
||||
return done(null, entry);
|
||||
});
|
||||
};
|
||||
}
|
||||
function readdir(directory, settings, callback) {
|
||||
settings.fs.readdir(directory, (readdirError, names) => {
|
||||
if (readdirError !== null) {
|
||||
return callFailureCallback(callback, readdirError);
|
||||
}
|
||||
const filepaths = names.map((name) => common.joinPathSegments(directory, name, settings.pathSegmentSeparator));
|
||||
const tasks = filepaths.map((filepath) => {
|
||||
return (done) => fsStat.stat(filepath, settings.fsStatSettings, done);
|
||||
});
|
||||
rpl(tasks, (rplError, results) => {
|
||||
if (rplError !== null) {
|
||||
return callFailureCallback(callback, rplError);
|
||||
}
|
||||
const entries = [];
|
||||
names.forEach((name, index) => {
|
||||
const stats = results[index];
|
||||
const entry = {
|
||||
name,
|
||||
path: filepaths[index],
|
||||
dirent: utils.fs.createDirentFromStats(name, stats)
|
||||
};
|
||||
if (settings.stats) {
|
||||
entry.stats = stats;
|
||||
}
|
||||
entries.push(entry);
|
||||
});
|
||||
callSuccessCallback(callback, entries);
|
||||
});
|
||||
});
|
||||
}
|
||||
exports.readdir = readdir;
|
||||
function callFailureCallback(callback, error) {
|
||||
callback(error);
|
||||
}
|
||||
function callSuccessCallback(callback, result) {
|
||||
callback(null, result);
|
||||
}
|
2
assets_old/node_modules/@nodelib/fs.scandir/out/providers/async.spec.d.ts
generated
vendored
Normal file
2
assets_old/node_modules/@nodelib/fs.scandir/out/providers/async.spec.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
export {};
|
||||
//# sourceMappingURL=async.spec.d.ts.map
|
1
assets_old/node_modules/@nodelib/fs.scandir/out/providers/async.spec.d.ts.map
generated
vendored
Normal file
1
assets_old/node_modules/@nodelib/fs.scandir/out/providers/async.spec.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"async.spec.d.ts","sourceRoot":"","sources":["../../src/providers/async.spec.ts"],"names":[],"mappings":""}
|
180
assets_old/node_modules/@nodelib/fs.scandir/out/providers/async.spec.js
generated
vendored
Normal file
180
assets_old/node_modules/@nodelib/fs.scandir/out/providers/async.spec.js
generated
vendored
Normal file
|
@ -0,0 +1,180 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const assert = require("assert");
|
||||
const path = require("path");
|
||||
const sinon = require("sinon");
|
||||
const fs_macchiato_1 = require("../../../fs.macchiato");
|
||||
const constants_1 = require("../constants");
|
||||
const settings_1 = require("../settings");
|
||||
const provider = require("./async");
|
||||
const ROOT_PATH = 'root';
|
||||
const FIRST_FILE_PATH = 'first.txt';
|
||||
const SECOND_FILE_PATH = 'second.txt';
|
||||
const FIRST_ENTRY_PATH = path.join(ROOT_PATH, FIRST_FILE_PATH);
|
||||
const SECOND_ENTRY_PATH = path.join(ROOT_PATH, SECOND_FILE_PATH);
|
||||
describe('Providers → Async', () => {
|
||||
describe('.read', () => {
|
||||
it('should call correct method based on Node.js version', (done) => {
|
||||
const readdir = sinon.stub();
|
||||
readdir.yields(null, []);
|
||||
const settings = new settings_1.default({
|
||||
fs: { readdir: readdir }
|
||||
});
|
||||
provider.read(ROOT_PATH, settings, (error, entries) => {
|
||||
assert.strictEqual(error, null);
|
||||
assert.deepStrictEqual(entries, []);
|
||||
if (constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
||||
sinon.assert.match(readdir.args, [[ROOT_PATH, { withFileTypes: true }, sinon.match.func]]);
|
||||
}
|
||||
else {
|
||||
sinon.assert.match(readdir.args, [[ROOT_PATH, sinon.match.func]]);
|
||||
}
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('should always use `readdir` method when the `stats` option is enabled', (done) => {
|
||||
const readdir = sinon.stub();
|
||||
readdir.yields(null, []);
|
||||
const settings = new settings_1.default({
|
||||
fs: { readdir: readdir },
|
||||
stats: true
|
||||
});
|
||||
provider.read(ROOT_PATH, settings, (error, entries) => {
|
||||
assert.strictEqual(error, null);
|
||||
assert.deepStrictEqual(entries, []);
|
||||
sinon.assert.match(readdir.args, [[ROOT_PATH, sinon.match.func]]);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
describe('.readdirWithFileTypes', () => {
|
||||
it('should return entries', (done) => {
|
||||
const dirent = new fs_macchiato_1.Dirent({ name: FIRST_FILE_PATH });
|
||||
const readdir = sinon.stub();
|
||||
readdir.yields(null, [dirent]);
|
||||
const settings = new settings_1.default({
|
||||
fs: { readdir: readdir }
|
||||
});
|
||||
const expected = [
|
||||
{
|
||||
dirent,
|
||||
name: FIRST_FILE_PATH,
|
||||
path: FIRST_ENTRY_PATH
|
||||
}
|
||||
];
|
||||
provider.readdirWithFileTypes(ROOT_PATH, settings, (error, entries) => {
|
||||
assert.strictEqual(error, null);
|
||||
sinon.assert.match(readdir.args, [[ROOT_PATH, { withFileTypes: true }, sinon.match.func]]);
|
||||
assert.deepStrictEqual(entries, expected);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('should call fs.stat for symbolic link when the "followSymbolicLink" option is enabled', (done) => {
|
||||
const firstDirent = new fs_macchiato_1.Dirent({ name: FIRST_FILE_PATH });
|
||||
const secondDirent = new fs_macchiato_1.Dirent({ name: SECOND_FILE_PATH, isSymbolicLink: true });
|
||||
const stats = new fs_macchiato_1.Stats();
|
||||
const readdir = sinon.stub();
|
||||
const stat = sinon.stub();
|
||||
readdir.yields(null, [firstDirent, secondDirent]);
|
||||
stat.yields(null, stats);
|
||||
const settings = new settings_1.default({
|
||||
followSymbolicLinks: true,
|
||||
fs: {
|
||||
readdir: readdir,
|
||||
stat: stat
|
||||
}
|
||||
});
|
||||
provider.readdirWithFileTypes(ROOT_PATH, settings, (error, entries) => {
|
||||
assert.strictEqual(error, null);
|
||||
assert.strictEqual(entries.length, 2);
|
||||
assert.ok(!entries[1].dirent.isSymbolicLink());
|
||||
sinon.assert.match(stat.args, [[SECOND_ENTRY_PATH, sinon.match.func]]);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('should return lstat for broken symbolic link when the "throwErrorOnBrokenSymbolicLink" option is disabled', (done) => {
|
||||
const firstDirent = new fs_macchiato_1.Dirent({ name: FIRST_FILE_PATH, isSymbolicLink: true });
|
||||
const readdir = sinon.stub();
|
||||
const stat = sinon.stub();
|
||||
readdir.yields(null, [firstDirent]);
|
||||
stat.yields(new Error('error'));
|
||||
const settings = new settings_1.default({
|
||||
followSymbolicLinks: true,
|
||||
throwErrorOnBrokenSymbolicLink: false,
|
||||
fs: {
|
||||
readdir: readdir,
|
||||
stat: stat
|
||||
}
|
||||
});
|
||||
provider.readdirWithFileTypes(ROOT_PATH, settings, (error, entries) => {
|
||||
assert.strictEqual(error, null);
|
||||
assert.strictEqual(entries.length, 1);
|
||||
assert.ok(entries[0].dirent.isSymbolicLink());
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('should throw an error fro broken symbolic link when the "throwErrorOnBrokenSymbolicLink" option is enabled', (done) => {
|
||||
const firstDirent = new fs_macchiato_1.Dirent({ name: FIRST_FILE_PATH, isSymbolicLink: true });
|
||||
const readdir = sinon.stub();
|
||||
const stat = sinon.stub();
|
||||
readdir.yields(null, [firstDirent]);
|
||||
stat.yields(new Error('error'));
|
||||
const settings = new settings_1.default({
|
||||
followSymbolicLinks: true,
|
||||
throwErrorOnBrokenSymbolicLink: true,
|
||||
fs: {
|
||||
readdir: readdir,
|
||||
stat: stat
|
||||
}
|
||||
});
|
||||
provider.readdirWithFileTypes(ROOT_PATH, settings, (error, entries) => {
|
||||
assert.strictEqual(error.message, 'error');
|
||||
assert.strictEqual(entries, undefined);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
describe('.readdir', () => {
|
||||
it('should return entries', (done) => {
|
||||
const stats = new fs_macchiato_1.Stats();
|
||||
const readdir = sinon.stub();
|
||||
const lstat = sinon.stub();
|
||||
readdir.yields(null, [FIRST_FILE_PATH]);
|
||||
lstat.yields(null, stats);
|
||||
const settings = new settings_1.default({
|
||||
fs: {
|
||||
readdir: readdir,
|
||||
lstat: lstat
|
||||
}
|
||||
});
|
||||
provider.readdir(ROOT_PATH, settings, (error, entries) => {
|
||||
assert.strictEqual(error, null);
|
||||
sinon.assert.match(readdir.args, [[ROOT_PATH, sinon.match.func]]);
|
||||
sinon.assert.match(lstat.args, [[FIRST_ENTRY_PATH, sinon.match.func]]);
|
||||
assert.strictEqual(entries[0].name, FIRST_FILE_PATH);
|
||||
assert.strictEqual(entries[0].path, FIRST_ENTRY_PATH);
|
||||
assert.strictEqual(entries[0].dirent.name, FIRST_FILE_PATH);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('should return entries with `stats` property', (done) => {
|
||||
const stats = new fs_macchiato_1.Stats();
|
||||
const readdir = sinon.stub();
|
||||
const lstat = sinon.stub();
|
||||
readdir.yields(null, [FIRST_FILE_PATH]);
|
||||
lstat.yields(null, stats);
|
||||
const settings = new settings_1.default({
|
||||
fs: {
|
||||
readdir: readdir,
|
||||
lstat: lstat
|
||||
},
|
||||
stats: true
|
||||
});
|
||||
provider.readdir(ROOT_PATH, settings, (error, entries) => {
|
||||
assert.strictEqual(error, null);
|
||||
assert.deepStrictEqual(entries[0].stats, stats);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
2
assets_old/node_modules/@nodelib/fs.scandir/out/providers/common.d.ts
generated
vendored
Normal file
2
assets_old/node_modules/@nodelib/fs.scandir/out/providers/common.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
export declare function joinPathSegments(a: string, b: string, separator: string): string;
|
||||
//# sourceMappingURL=common.d.ts.map
|
1
assets_old/node_modules/@nodelib/fs.scandir/out/providers/common.d.ts.map
generated
vendored
Normal file
1
assets_old/node_modules/@nodelib/fs.scandir/out/providers/common.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/providers/common.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAShF"}
|
13
assets_old/node_modules/@nodelib/fs.scandir/out/providers/common.js
generated
vendored
Normal file
13
assets_old/node_modules/@nodelib/fs.scandir/out/providers/common.js
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
"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;
|
2
assets_old/node_modules/@nodelib/fs.scandir/out/providers/common.spec.d.ts
generated
vendored
Normal file
2
assets_old/node_modules/@nodelib/fs.scandir/out/providers/common.spec.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
export {};
|
||||
//# sourceMappingURL=common.spec.d.ts.map
|
1
assets_old/node_modules/@nodelib/fs.scandir/out/providers/common.spec.d.ts.map
generated
vendored
Normal file
1
assets_old/node_modules/@nodelib/fs.scandir/out/providers/common.spec.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"common.spec.d.ts","sourceRoot":"","sources":["../../src/providers/common.spec.ts"],"names":[],"mappings":""}
|
22
assets_old/node_modules/@nodelib/fs.scandir/out/providers/common.spec.js
generated
vendored
Normal file
22
assets_old/node_modules/@nodelib/fs.scandir/out/providers/common.spec.js
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const assert = require("assert");
|
||||
const common = require("./common");
|
||||
describe('Readers → Common', () => {
|
||||
describe('.joinPathSegments', () => {
|
||||
it('should return concatenated string', () => {
|
||||
assert.strictEqual(common.joinPathSegments('.', 'a', '/'), './a');
|
||||
});
|
||||
it('should return correct string when the first segment ens with the separator symbol', () => {
|
||||
// Unix
|
||||
assert.strictEqual(common.joinPathSegments('/', 'a', '/'), '/a');
|
||||
assert.strictEqual(common.joinPathSegments('//', 'a', '/'), '//a');
|
||||
assert.strictEqual(common.joinPathSegments('/a/', 'b', '/'), '/a/b');
|
||||
// Windows
|
||||
assert.strictEqual(common.joinPathSegments('C:/', 'Users', '/'), 'C:/Users');
|
||||
assert.strictEqual(common.joinPathSegments('C:\\', 'Users', '\\'), 'C:\\Users');
|
||||
assert.strictEqual(common.joinPathSegments('//?/C:/', 'Users', '/'), '//?/C:/Users');
|
||||
assert.strictEqual(common.joinPathSegments('\\\\?\\C:\\', 'Users', '\\'), '\\\\?\\C:\\Users');
|
||||
});
|
||||
});
|
||||
});
|
6
assets_old/node_modules/@nodelib/fs.scandir/out/providers/sync.d.ts
generated
vendored
Normal file
6
assets_old/node_modules/@nodelib/fs.scandir/out/providers/sync.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
import Settings from '../settings';
|
||||
import { 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[];
|
||||
//# sourceMappingURL=sync.d.ts.map
|
1
assets_old/node_modules/@nodelib/fs.scandir/out/providers/sync.d.ts.map
generated
vendored
Normal file
1
assets_old/node_modules/@nodelib/fs.scandir/out/providers/sync.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/providers/sync.ts"],"names":[],"mappings":"AAGA,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAIjC,wBAAgB,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,KAAK,EAAE,CAMnE;AAED,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,KAAK,EAAE,CAwBnF;AAED,wBAAgB,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,KAAK,EAAE,CAmBtE"}
|
54
assets_old/node_modules/@nodelib/fs.scandir/out/providers/sync.js
generated
vendored
Normal file
54
assets_old/node_modules/@nodelib/fs.scandir/out/providers/sync.js
generated
vendored
Normal file
|
@ -0,0 +1,54 @@
|
|||
"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;
|
2
assets_old/node_modules/@nodelib/fs.scandir/out/providers/sync.spec.d.ts
generated
vendored
Normal file
2
assets_old/node_modules/@nodelib/fs.scandir/out/providers/sync.spec.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
export {};
|
||||
//# sourceMappingURL=sync.spec.d.ts.map
|
1
assets_old/node_modules/@nodelib/fs.scandir/out/providers/sync.spec.d.ts.map
generated
vendored
Normal file
1
assets_old/node_modules/@nodelib/fs.scandir/out/providers/sync.spec.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"sync.spec.d.ts","sourceRoot":"","sources":["../../src/providers/sync.spec.ts"],"names":[],"mappings":""}
|
144
assets_old/node_modules/@nodelib/fs.scandir/out/providers/sync.spec.js
generated
vendored
Normal file
144
assets_old/node_modules/@nodelib/fs.scandir/out/providers/sync.spec.js
generated
vendored
Normal file
|
@ -0,0 +1,144 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const assert = require("assert");
|
||||
const path = require("path");
|
||||
const sinon = require("sinon");
|
||||
const fs_macchiato_1 = require("../../../fs.macchiato");
|
||||
const constants_1 = require("../constants");
|
||||
const settings_1 = require("../settings");
|
||||
const provider = require("./sync");
|
||||
const ROOT_PATH = 'root';
|
||||
const FIRST_FILE_PATH = 'first.txt';
|
||||
const SECOND_FILE_PATH = 'second.txt';
|
||||
const FIRST_ENTRY_PATH = path.join(ROOT_PATH, FIRST_FILE_PATH);
|
||||
const SECOND_ENTRY_PATH = path.join(ROOT_PATH, SECOND_FILE_PATH);
|
||||
describe('Providers → Sync', () => {
|
||||
describe('.read', () => {
|
||||
it('should call correct method based on Node.js version', () => {
|
||||
const readdirSync = sinon.stub().returns([]);
|
||||
const settings = new settings_1.default({
|
||||
fs: { readdirSync: readdirSync }
|
||||
});
|
||||
const actual = provider.read(ROOT_PATH, settings);
|
||||
assert.deepStrictEqual(actual, []);
|
||||
if (constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
||||
assert.deepStrictEqual(readdirSync.args, [[ROOT_PATH, { withFileTypes: true }]]);
|
||||
}
|
||||
else {
|
||||
assert.deepStrictEqual(readdirSync.args, [[ROOT_PATH]]);
|
||||
}
|
||||
});
|
||||
it('should always use `readdir` method when the `stats` option is enabled', () => {
|
||||
const readdirSync = sinon.stub().returns([]);
|
||||
const settings = new settings_1.default({
|
||||
fs: { readdirSync: readdirSync },
|
||||
stats: true
|
||||
});
|
||||
provider.read(ROOT_PATH, settings);
|
||||
assert.deepStrictEqual(readdirSync.args, [[ROOT_PATH]]);
|
||||
});
|
||||
});
|
||||
describe('.readdirWithFileTypes', () => {
|
||||
it('should return entries', () => {
|
||||
const dirent = new fs_macchiato_1.Dirent({ name: FIRST_FILE_PATH });
|
||||
const readdirSync = sinon.stub().returns([dirent]);
|
||||
const settings = new settings_1.default({
|
||||
fs: { readdirSync: readdirSync }
|
||||
});
|
||||
const expected = [
|
||||
{
|
||||
dirent,
|
||||
name: FIRST_FILE_PATH,
|
||||
path: FIRST_ENTRY_PATH
|
||||
}
|
||||
];
|
||||
const actual = provider.readdirWithFileTypes(ROOT_PATH, settings);
|
||||
assert.deepStrictEqual(readdirSync.args, [[ROOT_PATH, { withFileTypes: true }]]);
|
||||
assert.deepStrictEqual(actual, expected);
|
||||
});
|
||||
it('should call fs.stat for symbolic link when the "followSymbolicLink" option is enabled', () => {
|
||||
const firstDirent = new fs_macchiato_1.Dirent({ name: FIRST_FILE_PATH });
|
||||
const secondDirent = new fs_macchiato_1.Dirent({ name: SECOND_FILE_PATH, isSymbolicLink: true });
|
||||
const stats = new fs_macchiato_1.Stats();
|
||||
const readdirSync = sinon.stub().returns([firstDirent, secondDirent]);
|
||||
const statSync = sinon.stub().returns(stats);
|
||||
const settings = new settings_1.default({
|
||||
followSymbolicLinks: true,
|
||||
fs: {
|
||||
readdirSync: readdirSync,
|
||||
statSync: statSync
|
||||
}
|
||||
});
|
||||
const actual = provider.readdirWithFileTypes(ROOT_PATH, settings);
|
||||
assert.strictEqual(actual.length, 2);
|
||||
assert.deepStrictEqual(statSync.args, [[SECOND_ENTRY_PATH]]);
|
||||
assert.ok(!actual[1].dirent.isSymbolicLink());
|
||||
});
|
||||
it('should return lstat for broken symbolic link when the "throwErrorOnBrokenSymbolicLink" option is disabled', () => {
|
||||
const dirent = new fs_macchiato_1.Dirent({ name: FIRST_FILE_PATH, isSymbolicLink: true });
|
||||
const readdirSync = sinon.stub().returns([dirent]);
|
||||
const statSync = () => {
|
||||
throw new Error('error');
|
||||
};
|
||||
const settings = new settings_1.default({
|
||||
followSymbolicLinks: true,
|
||||
throwErrorOnBrokenSymbolicLink: false,
|
||||
fs: {
|
||||
readdirSync: readdirSync,
|
||||
statSync: statSync
|
||||
}
|
||||
});
|
||||
const actual = provider.readdirWithFileTypes(ROOT_PATH, settings);
|
||||
assert.strictEqual(actual.length, 1);
|
||||
});
|
||||
it('should throw an error fro broken symbolic link when the "throwErrorOnBrokenSymbolicLink" option is enabled', () => {
|
||||
const dirent = new fs_macchiato_1.Dirent({ name: FIRST_FILE_PATH, isSymbolicLink: true });
|
||||
const readdirSync = sinon.stub().returns([dirent]);
|
||||
const statSync = () => {
|
||||
throw new Error('error');
|
||||
};
|
||||
const settings = new settings_1.default({
|
||||
followSymbolicLinks: true,
|
||||
throwErrorOnBrokenSymbolicLink: true,
|
||||
fs: {
|
||||
readdirSync: readdirSync,
|
||||
statSync: statSync
|
||||
}
|
||||
});
|
||||
const expectedErrorMessageRe = /Error: error/;
|
||||
assert.throws(() => provider.readdirWithFileTypes(ROOT_PATH, settings), expectedErrorMessageRe);
|
||||
});
|
||||
});
|
||||
describe('.readdir', () => {
|
||||
it('should return entries', () => {
|
||||
const stats = new fs_macchiato_1.Stats();
|
||||
const readdirSync = sinon.stub().returns([FIRST_FILE_PATH]);
|
||||
const lstatSync = sinon.stub().returns(stats);
|
||||
const settings = new settings_1.default({
|
||||
fs: {
|
||||
readdirSync: readdirSync,
|
||||
lstatSync: lstatSync
|
||||
}
|
||||
});
|
||||
const actual = provider.readdir(ROOT_PATH, settings);
|
||||
assert.deepStrictEqual(readdirSync.args, [[ROOT_PATH]]);
|
||||
assert.strictEqual(actual[0].name, FIRST_FILE_PATH);
|
||||
assert.strictEqual(actual[0].path, FIRST_ENTRY_PATH);
|
||||
assert.strictEqual(actual[0].dirent.name, FIRST_FILE_PATH);
|
||||
});
|
||||
it('should return entries with `stats` property', () => {
|
||||
const stats = new fs_macchiato_1.Stats();
|
||||
const readdirSync = sinon.stub().returns([FIRST_FILE_PATH]);
|
||||
const lstatSync = sinon.stub().returns(stats);
|
||||
const settings = new settings_1.default({
|
||||
fs: {
|
||||
readdirSync: readdirSync,
|
||||
lstatSync: lstatSync
|
||||
},
|
||||
stats: true
|
||||
});
|
||||
const actual = provider.readdir(ROOT_PATH, settings);
|
||||
assert.deepStrictEqual(actual[0].stats, stats);
|
||||
});
|
||||
});
|
||||
});
|
21
assets_old/node_modules/@nodelib/fs.scandir/out/settings.d.ts
generated
vendored
Normal file
21
assets_old/node_modules/@nodelib/fs.scandir/out/settings.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
import * as fsStat from '@nodelib/fs.stat';
|
||||
import * as fs from './adapters/fs';
|
||||
export declare type 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;
|
||||
}
|
||||
//# sourceMappingURL=settings.d.ts.map
|
1
assets_old/node_modules/@nodelib/fs.scandir/out/settings.d.ts.map
generated
vendored
Normal file
1
assets_old/node_modules/@nodelib/fs.scandir/out/settings.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAE3C,OAAO,KAAK,EAAE,MAAM,eAAe,CAAC;AAEpC,oBAAY,OAAO,GAAG;IACrB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC;IACnC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,8BAA8B,CAAC,EAAE,OAAO,CAAC;CACzC,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,QAAQ;IAahB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAZrC,SAAgB,mBAAmB,EAAE,OAAO,CAA4D;IACxG,SAAgB,EAAE,EAAE,EAAE,CAAC,iBAAiB,CAAgD;IACxF,SAAgB,oBAAoB,EAAE,MAAM,CAAgE;IAC5G,SAAgB,KAAK,EAAE,OAAO,CAA8C;IAC5E,SAAgB,8BAA8B,EAAE,OAAO,CAAsE;IAE7H,SAAgB,cAAc,EAAE,MAAM,CAAC,QAAQ,CAI5C;gBAE0B,QAAQ,GAAE,OAAY;IAEnD,OAAO,CAAC,SAAS;CAGjB"}
|
24
assets_old/node_modules/@nodelib/fs.scandir/out/settings.js
generated
vendored
Normal file
24
assets_old/node_modules/@nodelib/fs.scandir/out/settings.js
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
"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;
|
2
assets_old/node_modules/@nodelib/fs.scandir/out/settings.spec.d.ts
generated
vendored
Normal file
2
assets_old/node_modules/@nodelib/fs.scandir/out/settings.spec.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
export {};
|
||||
//# sourceMappingURL=settings.spec.d.ts.map
|
1
assets_old/node_modules/@nodelib/fs.scandir/out/settings.spec.d.ts.map
generated
vendored
Normal file
1
assets_old/node_modules/@nodelib/fs.scandir/out/settings.spec.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"settings.spec.d.ts","sourceRoot":"","sources":["../src/settings.spec.ts"],"names":[],"mappings":""}
|
27
assets_old/node_modules/@nodelib/fs.scandir/out/settings.spec.js
generated
vendored
Normal file
27
assets_old/node_modules/@nodelib/fs.scandir/out/settings.spec.js
generated
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const assert = require("assert");
|
||||
const path = require("path");
|
||||
const fs_macchiato_1 = require("../../fs.macchiato");
|
||||
const fs = require("./adapters/fs");
|
||||
const settings_1 = require("./settings");
|
||||
describe('Settings', () => {
|
||||
it('should return instance with default values', () => {
|
||||
const settings = new settings_1.default();
|
||||
assert.deepStrictEqual(settings.fs, fs.createFileSystemAdapter());
|
||||
assert.ok(!settings.followSymbolicLinks);
|
||||
assert.ok(!settings.stats);
|
||||
assert.strictEqual(settings.pathSegmentSeparator, path.sep);
|
||||
assert.ok(settings.fsStatSettings);
|
||||
assert.ok(settings.throwErrorOnBrokenSymbolicLink);
|
||||
});
|
||||
it('should return instance with custom values', () => {
|
||||
const lstatSync = () => new fs_macchiato_1.Stats();
|
||||
const settings = new settings_1.default({
|
||||
fs: fs.createFileSystemAdapter({ lstatSync }),
|
||||
stats: true
|
||||
});
|
||||
assert.deepStrictEqual(settings.fs, fs.createFileSystemAdapter({ lstatSync }));
|
||||
assert.ok(settings.stats);
|
||||
});
|
||||
});
|
20
assets_old/node_modules/@nodelib/fs.scandir/out/types/index.d.ts
generated
vendored
Normal file
20
assets_old/node_modules/@nodelib/fs.scandir/out/types/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
/// <reference types="node" />
|
||||
import * as fs from 'fs';
|
||||
export declare type Entry = {
|
||||
dirent: Dirent;
|
||||
name: string;
|
||||
path: string;
|
||||
stats?: Stats;
|
||||
};
|
||||
export declare type Stats = fs.Stats;
|
||||
export declare type Dirent = {
|
||||
isBlockDevice(): boolean;
|
||||
isCharacterDevice(): boolean;
|
||||
isDirectory(): boolean;
|
||||
isFIFO(): boolean;
|
||||
isFile(): boolean;
|
||||
isSocket(): boolean;
|
||||
isSymbolicLink(): boolean;
|
||||
name: string;
|
||||
};
|
||||
//# sourceMappingURL=index.d.ts.map
|
1
assets_old/node_modules/@nodelib/fs.scandir/out/types/index.d.ts.map
generated
vendored
Normal file
1
assets_old/node_modules/@nodelib/fs.scandir/out/types/index.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAEzB,oBAAY,KAAK,GAAG;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,KAAK,CAAC;CACd,CAAC;AAEF,oBAAY,KAAK,GAAG,EAAE,CAAC,KAAK,CAAC;AAE7B,oBAAY,MAAM,GAAG;IACpB,aAAa,IAAI,OAAO,CAAC;IACzB,iBAAiB,IAAI,OAAO,CAAC;IAC7B,WAAW,IAAI,OAAO,CAAC;IACvB,MAAM,IAAI,OAAO,CAAC;IAClB,MAAM,IAAI,OAAO,CAAC;IAClB,QAAQ,IAAI,OAAO,CAAC;IACpB,cAAc,IAAI,OAAO,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;CACb,CAAC"}
|
2
assets_old/node_modules/@nodelib/fs.scandir/out/types/index.js
generated
vendored
Normal file
2
assets_old/node_modules/@nodelib/fs.scandir/out/types/index.js
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
3
assets_old/node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts
generated
vendored
Normal file
3
assets_old/node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
import { Dirent, Stats } from '../types';
|
||||
export declare function createDirentFromStats(name: string, stats: Stats): Dirent;
|
||||
//# sourceMappingURL=fs.d.ts.map
|
1
assets_old/node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts.map
generated
vendored
Normal file
1
assets_old/node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../src/utils/fs.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAsBzC,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,MAAM,CAExE"}
|
19
assets_old/node_modules/@nodelib/fs.scandir/out/utils/fs.js
generated
vendored
Normal file
19
assets_old/node_modules/@nodelib/fs.scandir/out/utils/fs.js
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
"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
assets_old/node_modules/@nodelib/fs.scandir/out/utils/fs.spec.d.ts
generated
vendored
Normal file
2
assets_old/node_modules/@nodelib/fs.scandir/out/utils/fs.spec.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
export {};
|
||||
//# sourceMappingURL=fs.spec.d.ts.map
|
1
assets_old/node_modules/@nodelib/fs.scandir/out/utils/fs.spec.d.ts.map
generated
vendored
Normal file
1
assets_old/node_modules/@nodelib/fs.scandir/out/utils/fs.spec.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"fs.spec.d.ts","sourceRoot":"","sources":["../../src/utils/fs.spec.ts"],"names":[],"mappings":""}
|
20
assets_old/node_modules/@nodelib/fs.scandir/out/utils/fs.spec.js
generated
vendored
Normal file
20
assets_old/node_modules/@nodelib/fs.scandir/out/utils/fs.spec.js
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const assert = require("assert");
|
||||
const fs_macchiato_1 = require("../../../fs.macchiato");
|
||||
const util = require("./fs");
|
||||
describe('Utils → FS', () => {
|
||||
describe('.createDirentFromStats', () => {
|
||||
it('should convert fs.Stats to fs.Dirent', () => {
|
||||
const actual = util.createDirentFromStats('name', new fs_macchiato_1.Stats());
|
||||
assert.strictEqual(actual.name, 'name');
|
||||
assert.ok(!actual.isBlockDevice());
|
||||
assert.ok(!actual.isCharacterDevice());
|
||||
assert.ok(!actual.isDirectory());
|
||||
assert.ok(!actual.isFIFO());
|
||||
assert.ok(actual.isFile());
|
||||
assert.ok(!actual.isSocket());
|
||||
assert.ok(!actual.isSymbolicLink());
|
||||
});
|
||||
});
|
||||
});
|
3
assets_old/node_modules/@nodelib/fs.scandir/out/utils/index.d.ts
generated
vendored
Normal file
3
assets_old/node_modules/@nodelib/fs.scandir/out/utils/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
import * as fs from './fs';
|
||||
export { fs };
|
||||
//# sourceMappingURL=index.d.ts.map
|
1
assets_old/node_modules/@nodelib/fs.scandir/out/utils/index.d.ts.map
generated
vendored
Normal file
1
assets_old/node_modules/@nodelib/fs.scandir/out/utils/index.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,MAAM,CAAC;AAE3B,OAAO,EACN,EAAE,EACF,CAAC"}
|
5
assets_old/node_modules/@nodelib/fs.scandir/out/utils/index.js
generated
vendored
Normal file
5
assets_old/node_modules/@nodelib/fs.scandir/out/utils/index.js
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.fs = void 0;
|
||||
const fs = require("./fs");
|
||||
exports.fs = fs;
|
35
assets_old/node_modules/@nodelib/fs.scandir/package.json
generated
vendored
Normal file
35
assets_old/node_modules/@nodelib/fs.scandir/package.json
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"name": "@nodelib/fs.scandir",
|
||||
"version": "2.1.4",
|
||||
"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"
|
||||
},
|
||||
"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.4",
|
||||
"run-parallel": "^1.1.9"
|
||||
},
|
||||
"gitHead": "cb5f7e893a986164c3b847a4f1faef6c54cadd68"
|
||||
}
|
31
assets_old/node_modules/@nodelib/fs.scandir/src/adapters/fs.spec.ts
generated
vendored
Normal file
31
assets_old/node_modules/@nodelib/fs.scandir/src/adapters/fs.spec.ts
generated
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
import * as assert from 'assert';
|
||||
import * as fs from 'fs';
|
||||
|
||||
import { Stats } from '../../../fs.macchiato';
|
||||
|
||||
import * as adapter from './fs';
|
||||
|
||||
describe('Adapters → FileSystem', () => {
|
||||
it('should return original FS methods', () => {
|
||||
const expected: adapter.FileSystemAdapter = adapter.FILE_SYSTEM_ADAPTER;
|
||||
|
||||
const actual = adapter.createFileSystemAdapter();
|
||||
|
||||
assert.deepStrictEqual(actual, expected);
|
||||
});
|
||||
|
||||
it('should return custom FS methods', () => {
|
||||
const customLstatSyncMethod: typeof fs.lstatSync = () => new Stats();
|
||||
|
||||
const expected: adapter.FileSystemAdapter = {
|
||||
...adapter.FILE_SYSTEM_ADAPTER,
|
||||
lstatSync: customLstatSyncMethod
|
||||
};
|
||||
|
||||
const actual = adapter.createFileSystemAdapter({
|
||||
lstatSync: customLstatSyncMethod
|
||||
});
|
||||
|
||||
assert.deepStrictEqual(actual, expected);
|
||||
});
|
||||
});
|
30
assets_old/node_modules/@nodelib/fs.scandir/src/adapters/fs.ts
generated
vendored
Normal file
30
assets_old/node_modules/@nodelib/fs.scandir/src/adapters/fs.ts
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
import * as fs from 'fs';
|
||||
|
||||
export type 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;
|
||||
};
|
||||
|
||||
export const FILE_SYSTEM_ADAPTER: FileSystemAdapter = {
|
||||
lstat: fs.lstat,
|
||||
stat: fs.stat,
|
||||
lstatSync: fs.lstatSync,
|
||||
statSync: fs.statSync,
|
||||
readdir: fs.readdir,
|
||||
readdirSync: fs.readdirSync
|
||||
};
|
||||
|
||||
export function createFileSystemAdapter(fsMethods?: Partial<FileSystemAdapter>): FileSystemAdapter {
|
||||
if (fsMethods === undefined) {
|
||||
return FILE_SYSTEM_ADAPTER;
|
||||
}
|
||||
|
||||
return {
|
||||
...FILE_SYSTEM_ADAPTER,
|
||||
...fsMethods
|
||||
};
|
||||
}
|
15
assets_old/node_modules/@nodelib/fs.scandir/src/constants.ts
generated
vendored
Normal file
15
assets_old/node_modules/@nodelib/fs.scandir/src/constants.ts
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
const NODE_PROCESS_VERSION_PARTS = process.versions.node.split('.');
|
||||
|
||||
const MAJOR_VERSION = parseInt(NODE_PROCESS_VERSION_PARTS[0], 10);
|
||||
const MINOR_VERSION = 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.
|
||||
*/
|
||||
export const IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_BY_MAJOR_AND_MINOR;
|
85
assets_old/node_modules/@nodelib/fs.scandir/src/index.spec.ts
generated
vendored
Normal file
85
assets_old/node_modules/@nodelib/fs.scandir/src/index.spec.ts
generated
vendored
Normal file
|
@ -0,0 +1,85 @@
|
|||
import * as assert from 'assert';
|
||||
import * as fs from 'fs';
|
||||
|
||||
import * as rimraf from 'rimraf';
|
||||
|
||||
import { scandir, scandirSync, Settings } from '.';
|
||||
|
||||
describe('Package', () => {
|
||||
before(() => {
|
||||
rimraf.sync('fixtures');
|
||||
|
||||
fs.mkdirSync('fixtures');
|
||||
fs.writeFileSync('fixtures/file.txt', '');
|
||||
});
|
||||
|
||||
after(() => {
|
||||
rimraf.sync('fixtures');
|
||||
});
|
||||
|
||||
describe('.scandir', () => {
|
||||
it('should work without options or settings', (done) => {
|
||||
scandir('fixtures', (error, entries) => {
|
||||
assert.strictEqual(error, null);
|
||||
assert.ok(entries[0].name);
|
||||
assert.ok(entries[0].path);
|
||||
assert.ok(entries[0].dirent);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should work with options', (done) => {
|
||||
scandir('fixtures', { stats: true }, (error, entries) => {
|
||||
assert.strictEqual(error, null);
|
||||
assert.ok(entries[0].name);
|
||||
assert.ok(entries[0].path);
|
||||
assert.ok(entries[0].dirent);
|
||||
assert.ok(entries[0].stats);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should work with settings', (done) => {
|
||||
const settings = new Settings({ stats: true });
|
||||
|
||||
scandir('fixtures', settings, (error, entries) => {
|
||||
assert.strictEqual(error, null);
|
||||
assert.ok(entries[0].name);
|
||||
assert.ok(entries[0].path);
|
||||
assert.ok(entries[0].dirent);
|
||||
assert.ok(entries[0].stats);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('.scandirSync', () => {
|
||||
it('should work without options or settings', () => {
|
||||
const actual = scandirSync('fixtures');
|
||||
|
||||
assert.ok(actual[0].name);
|
||||
assert.ok(actual[0].path);
|
||||
assert.ok(actual[0].dirent);
|
||||
});
|
||||
|
||||
it('should work with options', () => {
|
||||
const actual = scandirSync('fixtures', { stats: true });
|
||||
|
||||
assert.ok(actual[0].name);
|
||||
assert.ok(actual[0].path);
|
||||
assert.ok(actual[0].dirent);
|
||||
assert.ok(actual[0].stats);
|
||||
});
|
||||
|
||||
it('should work with settings', () => {
|
||||
const settings = new Settings({ stats: true });
|
||||
|
||||
const actual = scandirSync('fixtures', settings);
|
||||
|
||||
assert.ok(actual[0].name);
|
||||
assert.ok(actual[0].path);
|
||||
assert.ok(actual[0].dirent);
|
||||
assert.ok(actual[0].stats);
|
||||
});
|
||||
});
|
||||
});
|
51
assets_old/node_modules/@nodelib/fs.scandir/src/index.ts
generated
vendored
Normal file
51
assets_old/node_modules/@nodelib/fs.scandir/src/index.ts
generated
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
import { FileSystemAdapter } from './adapters/fs';
|
||||
import * as async from './providers/async';
|
||||
import * as sync from './providers/sync';
|
||||
import Settings, { Options } from './settings';
|
||||
import { Dirent, Entry } from './types';
|
||||
|
||||
type AsyncCallback = async.AsyncCallback;
|
||||
|
||||
function scandir(path: string, callback: AsyncCallback): void;
|
||||
function scandir(path: string, optionsOrSettings: Options | Settings, callback: AsyncCallback): void;
|
||||
function scandir(path: string, optionsOrSettingsOrCallback: Options | Settings | AsyncCallback, callback?: AsyncCallback): void {
|
||||
if (typeof optionsOrSettingsOrCallback === 'function') {
|
||||
return async.read(path, getSettings(), optionsOrSettingsOrCallback);
|
||||
}
|
||||
|
||||
async.read(path, getSettings(optionsOrSettingsOrCallback), callback as AsyncCallback);
|
||||
}
|
||||
|
||||
// https://github.com/typescript-eslint/typescript-eslint/issues/60
|
||||
// eslint-disable-next-line no-redeclare
|
||||
declare namespace scandir {
|
||||
function __promisify__(path: string, optionsOrSettings?: Options | Settings): Promise<Entry[]>;
|
||||
}
|
||||
|
||||
function scandirSync(path: string, optionsOrSettings?: Options | Settings): Entry[] {
|
||||
const settings = getSettings(optionsOrSettings);
|
||||
|
||||
return sync.read(path, settings);
|
||||
}
|
||||
|
||||
function getSettings(settingsOrOptions: Settings | Options = {}): Settings {
|
||||
if (settingsOrOptions instanceof Settings) {
|
||||
return settingsOrOptions;
|
||||
}
|
||||
|
||||
return new Settings(settingsOrOptions);
|
||||
}
|
||||
|
||||
export {
|
||||
scandir,
|
||||
scandirSync,
|
||||
Settings,
|
||||
|
||||
// https://github.com/typescript-eslint/typescript-eslint/issues/131
|
||||
// eslint-disable-next-line no-undef
|
||||
AsyncCallback,
|
||||
Dirent,
|
||||
Entry,
|
||||
FileSystemAdapter,
|
||||
Options
|
||||
};
|
236
assets_old/node_modules/@nodelib/fs.scandir/src/providers/async.spec.ts
generated
vendored
Normal file
236
assets_old/node_modules/@nodelib/fs.scandir/src/providers/async.spec.ts
generated
vendored
Normal file
|
@ -0,0 +1,236 @@
|
|||
import * as assert from 'assert';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
import * as sinon from 'sinon';
|
||||
|
||||
import { Dirent, Stats } from '../../../fs.macchiato';
|
||||
import { IS_SUPPORT_READDIR_WITH_FILE_TYPES } from '../constants';
|
||||
import Settings from '../settings';
|
||||
import { Entry } from '../types';
|
||||
import * as provider from './async';
|
||||
|
||||
const ROOT_PATH = 'root';
|
||||
const FIRST_FILE_PATH = 'first.txt';
|
||||
const SECOND_FILE_PATH = 'second.txt';
|
||||
const FIRST_ENTRY_PATH = path.join(ROOT_PATH, FIRST_FILE_PATH);
|
||||
const SECOND_ENTRY_PATH = path.join(ROOT_PATH, SECOND_FILE_PATH);
|
||||
|
||||
describe('Providers → Async', () => {
|
||||
describe('.read', () => {
|
||||
it('should call correct method based on Node.js version', (done) => {
|
||||
const readdir = sinon.stub();
|
||||
|
||||
readdir.yields(null, []);
|
||||
|
||||
const settings = new Settings({
|
||||
fs: { readdir: readdir as unknown as typeof fs.readdir }
|
||||
});
|
||||
|
||||
provider.read(ROOT_PATH, settings, (error, entries) => {
|
||||
assert.strictEqual(error, null);
|
||||
|
||||
assert.deepStrictEqual(entries, []);
|
||||
|
||||
if (IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
||||
sinon.assert.match(readdir.args, [[ROOT_PATH, { withFileTypes: true }, sinon.match.func]]);
|
||||
} else {
|
||||
sinon.assert.match(readdir.args, [[ROOT_PATH, sinon.match.func]]);
|
||||
}
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should always use `readdir` method when the `stats` option is enabled', (done) => {
|
||||
const readdir = sinon.stub();
|
||||
|
||||
readdir.yields(null, []);
|
||||
|
||||
const settings = new Settings({
|
||||
fs: { readdir: readdir as unknown as typeof fs.readdir },
|
||||
stats: true
|
||||
});
|
||||
|
||||
provider.read(ROOT_PATH, settings, (error, entries) => {
|
||||
assert.strictEqual(error, null);
|
||||
|
||||
assert.deepStrictEqual(entries, []);
|
||||
sinon.assert.match(readdir.args, [[ROOT_PATH, sinon.match.func]]);
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('.readdirWithFileTypes', () => {
|
||||
it('should return entries', (done) => {
|
||||
const dirent = new Dirent({ name: FIRST_FILE_PATH });
|
||||
const readdir = sinon.stub();
|
||||
|
||||
readdir.yields(null, [dirent]);
|
||||
|
||||
const settings = new Settings({
|
||||
fs: { readdir: readdir as unknown as typeof fs.readdir }
|
||||
});
|
||||
|
||||
const expected: Entry[] = [
|
||||
{
|
||||
dirent,
|
||||
name: FIRST_FILE_PATH,
|
||||
path: FIRST_ENTRY_PATH
|
||||
}
|
||||
];
|
||||
|
||||
provider.readdirWithFileTypes(ROOT_PATH, settings, (error, entries) => {
|
||||
assert.strictEqual(error, null);
|
||||
|
||||
sinon.assert.match(readdir.args, [[ROOT_PATH, { withFileTypes: true }, sinon.match.func]]);
|
||||
assert.deepStrictEqual(entries, expected);
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should call fs.stat for symbolic link when the "followSymbolicLink" option is enabled', (done) => {
|
||||
const firstDirent = new Dirent({ name: FIRST_FILE_PATH });
|
||||
const secondDirent = new Dirent({ name: SECOND_FILE_PATH, isSymbolicLink: true });
|
||||
const stats = new Stats();
|
||||
|
||||
const readdir = sinon.stub();
|
||||
const stat = sinon.stub();
|
||||
|
||||
readdir.yields(null, [firstDirent, secondDirent]);
|
||||
stat.yields(null, stats);
|
||||
|
||||
const settings = new Settings({
|
||||
followSymbolicLinks: true,
|
||||
fs: {
|
||||
readdir: readdir as unknown as typeof fs.readdir,
|
||||
stat: stat as unknown as typeof fs.stat
|
||||
}
|
||||
});
|
||||
|
||||
provider.readdirWithFileTypes(ROOT_PATH, settings, (error, entries) => {
|
||||
assert.strictEqual(error, null);
|
||||
|
||||
assert.strictEqual(entries.length, 2);
|
||||
assert.ok(!entries[1].dirent.isSymbolicLink());
|
||||
sinon.assert.match(stat.args, [[SECOND_ENTRY_PATH, sinon.match.func]]);
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should return lstat for broken symbolic link when the "throwErrorOnBrokenSymbolicLink" option is disabled', (done) => {
|
||||
const firstDirent = new Dirent({ name: FIRST_FILE_PATH, isSymbolicLink: true });
|
||||
|
||||
const readdir = sinon.stub();
|
||||
const stat = sinon.stub();
|
||||
|
||||
readdir.yields(null, [firstDirent]);
|
||||
stat.yields(new Error('error'));
|
||||
|
||||
const settings = new Settings({
|
||||
followSymbolicLinks: true,
|
||||
throwErrorOnBrokenSymbolicLink: false,
|
||||
fs: {
|
||||
readdir: readdir as unknown as typeof fs.readdir,
|
||||
stat: stat as unknown as typeof fs.stat
|
||||
}
|
||||
});
|
||||
|
||||
provider.readdirWithFileTypes(ROOT_PATH, settings, (error, entries) => {
|
||||
assert.strictEqual(error, null);
|
||||
|
||||
assert.strictEqual(entries.length, 1);
|
||||
assert.ok(entries[0].dirent.isSymbolicLink());
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should throw an error fro broken symbolic link when the "throwErrorOnBrokenSymbolicLink" option is enabled', (done) => {
|
||||
const firstDirent = new Dirent({ name: FIRST_FILE_PATH, isSymbolicLink: true });
|
||||
|
||||
const readdir = sinon.stub();
|
||||
const stat = sinon.stub();
|
||||
|
||||
readdir.yields(null, [firstDirent]);
|
||||
stat.yields(new Error('error'));
|
||||
|
||||
const settings = new Settings({
|
||||
followSymbolicLinks: true,
|
||||
throwErrorOnBrokenSymbolicLink: true,
|
||||
fs: {
|
||||
readdir: readdir as unknown as typeof fs.readdir,
|
||||
stat: stat as unknown as typeof fs.stat
|
||||
}
|
||||
});
|
||||
|
||||
provider.readdirWithFileTypes(ROOT_PATH, settings, (error, entries) => {
|
||||
assert.strictEqual(error.message, 'error');
|
||||
assert.strictEqual(entries, undefined);
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('.readdir', () => {
|
||||
it('should return entries', (done) => {
|
||||
const stats = new Stats();
|
||||
|
||||
const readdir = sinon.stub();
|
||||
const lstat = sinon.stub();
|
||||
|
||||
readdir.yields(null, [FIRST_FILE_PATH]);
|
||||
lstat.yields(null, stats);
|
||||
|
||||
const settings = new Settings({
|
||||
fs: {
|
||||
readdir: readdir as unknown as typeof fs.readdir,
|
||||
lstat: lstat as unknown as typeof fs.lstat
|
||||
}
|
||||
});
|
||||
|
||||
provider.readdir(ROOT_PATH, settings, (error, entries) => {
|
||||
assert.strictEqual(error, null);
|
||||
|
||||
sinon.assert.match(readdir.args, [[ROOT_PATH, sinon.match.func]]);
|
||||
sinon.assert.match(lstat.args, [[FIRST_ENTRY_PATH, sinon.match.func]]);
|
||||
|
||||
assert.strictEqual(entries[0].name, FIRST_FILE_PATH);
|
||||
assert.strictEqual(entries[0].path, FIRST_ENTRY_PATH);
|
||||
assert.strictEqual(entries[0].dirent.name, FIRST_FILE_PATH);
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should return entries with `stats` property', (done) => {
|
||||
const stats = new Stats();
|
||||
|
||||
const readdir = sinon.stub();
|
||||
const lstat = sinon.stub();
|
||||
|
||||
readdir.yields(null, [FIRST_FILE_PATH]);
|
||||
lstat.yields(null, stats);
|
||||
|
||||
const settings = new Settings({
|
||||
fs: {
|
||||
readdir: readdir as unknown as typeof fs.readdir,
|
||||
lstat: lstat as unknown as typeof fs.lstat
|
||||
},
|
||||
stats: true
|
||||
});
|
||||
|
||||
provider.readdir(ROOT_PATH, settings, (error, entries) => {
|
||||
assert.strictEqual(error, null);
|
||||
assert.deepStrictEqual(entries[0].stats, stats);
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
121
assets_old/node_modules/@nodelib/fs.scandir/src/providers/async.ts
generated
vendored
Normal file
121
assets_old/node_modules/@nodelib/fs.scandir/src/providers/async.ts
generated
vendored
Normal file
|
@ -0,0 +1,121 @@
|
|||
import * as fsStat from '@nodelib/fs.stat';
|
||||
import * as rpl from 'run-parallel';
|
||||
|
||||
import { IS_SUPPORT_READDIR_WITH_FILE_TYPES } from '../constants';
|
||||
import Settings from '../settings';
|
||||
import { Entry, Stats } from '../types';
|
||||
import * as utils from '../utils';
|
||||
import * as common from './common';
|
||||
|
||||
type RplTaskStats = rpl.Task<Stats>;
|
||||
type RplTaskEntry = rpl.Task<Entry>;
|
||||
type FailureCallback = (err: NodeJS.ErrnoException) => void;
|
||||
type SuccessCallback = (err: null, entries: Entry[]) => void;
|
||||
|
||||
export type AsyncCallback = (err: NodeJS.ErrnoException, entries: Entry[]) => void;
|
||||
|
||||
export function read(directory: string, settings: Settings, callback: AsyncCallback): void {
|
||||
if (!settings.stats && IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
||||
return readdirWithFileTypes(directory, settings, callback);
|
||||
}
|
||||
|
||||
return readdir(directory, settings, callback);
|
||||
}
|
||||
|
||||
export function readdirWithFileTypes(directory: string, settings: Settings, callback: AsyncCallback): void {
|
||||
settings.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => {
|
||||
if (readdirError !== null) {
|
||||
return callFailureCallback(callback, readdirError);
|
||||
}
|
||||
|
||||
const entries: Entry[] = dirents.map((dirent) => ({
|
||||
dirent,
|
||||
name: dirent.name,
|
||||
path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
|
||||
}));
|
||||
|
||||
if (!settings.followSymbolicLinks) {
|
||||
return callSuccessCallback(callback, entries);
|
||||
}
|
||||
|
||||
const tasks: RplTaskEntry[] = entries.map((entry) => makeRplTaskEntry(entry, settings));
|
||||
|
||||
rpl(tasks, (rplError: Error | null, rplEntries) => {
|
||||
if (rplError !== null) {
|
||||
return callFailureCallback(callback, rplError);
|
||||
}
|
||||
|
||||
callSuccessCallback(callback, rplEntries);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function makeRplTaskEntry(entry: Entry, settings: Settings): RplTaskEntry {
|
||||
return (done) => {
|
||||
if (!entry.dirent.isSymbolicLink()) {
|
||||
return done(null, entry);
|
||||
}
|
||||
|
||||
settings.fs.stat(entry.path, (statError, stats) => {
|
||||
if (statError !== null) {
|
||||
if (settings.throwErrorOnBrokenSymbolicLink) {
|
||||
return done(statError);
|
||||
}
|
||||
|
||||
return done(null, entry);
|
||||
}
|
||||
|
||||
entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
|
||||
|
||||
return done(null, entry);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
export function readdir(directory: string, settings: Settings, callback: AsyncCallback): void {
|
||||
settings.fs.readdir(directory, (readdirError, names) => {
|
||||
if (readdirError !== null) {
|
||||
return callFailureCallback(callback, readdirError);
|
||||
}
|
||||
|
||||
const filepaths = names.map((name) => common.joinPathSegments(directory, name, settings.pathSegmentSeparator));
|
||||
|
||||
const tasks: RplTaskStats[] = filepaths.map((filepath): RplTaskStats => {
|
||||
return (done) => fsStat.stat(filepath, settings.fsStatSettings, done);
|
||||
});
|
||||
|
||||
rpl(tasks, (rplError: Error | null, results) => {
|
||||
if (rplError !== null) {
|
||||
return callFailureCallback(callback, rplError);
|
||||
}
|
||||
|
||||
const entries: Entry[] = [];
|
||||
|
||||
names.forEach((name, index) => {
|
||||
const stats = results[index];
|
||||
|
||||
const entry: Entry = {
|
||||
name,
|
||||
path: filepaths[index],
|
||||
dirent: utils.fs.createDirentFromStats(name, stats)
|
||||
};
|
||||
|
||||
if (settings.stats) {
|
||||
entry.stats = stats;
|
||||
}
|
||||
|
||||
entries.push(entry);
|
||||
});
|
||||
|
||||
callSuccessCallback(callback, entries);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function callFailureCallback(callback: AsyncCallback, error: NodeJS.ErrnoException): void {
|
||||
(callback as FailureCallback)(error);
|
||||
}
|
||||
|
||||
function callSuccessCallback(callback: AsyncCallback, result: Entry[]): void {
|
||||
(callback as unknown as SuccessCallback)(null, result);
|
||||
}
|
24
assets_old/node_modules/@nodelib/fs.scandir/src/providers/common.spec.ts
generated
vendored
Normal file
24
assets_old/node_modules/@nodelib/fs.scandir/src/providers/common.spec.ts
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
import * as assert from 'assert';
|
||||
|
||||
import * as common from './common';
|
||||
|
||||
describe('Readers → Common', () => {
|
||||
describe('.joinPathSegments', () => {
|
||||
it('should return concatenated string', () => {
|
||||
assert.strictEqual(common.joinPathSegments('.', 'a', '/'), './a');
|
||||
});
|
||||
|
||||
it('should return correct string when the first segment ens with the separator symbol', () => {
|
||||
// Unix
|
||||
assert.strictEqual(common.joinPathSegments('/', 'a', '/'), '/a');
|
||||
assert.strictEqual(common.joinPathSegments('//', 'a', '/'), '//a');
|
||||
assert.strictEqual(common.joinPathSegments('/a/', 'b', '/'), '/a/b');
|
||||
|
||||
// Windows
|
||||
assert.strictEqual(common.joinPathSegments('C:/', 'Users', '/'), 'C:/Users');
|
||||
assert.strictEqual(common.joinPathSegments('C:\\', 'Users', '\\'), 'C:\\Users');
|
||||
assert.strictEqual(common.joinPathSegments('//?/C:/', 'Users', '/'), '//?/C:/Users');
|
||||
assert.strictEqual(common.joinPathSegments('\\\\?\\C:\\', 'Users', '\\'), '\\\\?\\C:\\Users');
|
||||
});
|
||||
});
|
||||
});
|
10
assets_old/node_modules/@nodelib/fs.scandir/src/providers/common.ts
generated
vendored
Normal file
10
assets_old/node_modules/@nodelib/fs.scandir/src/providers/common.ts
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
export function joinPathSegments(a: string, b: string, separator: string): string {
|
||||
/**
|
||||
* 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;
|
||||
}
|
186
assets_old/node_modules/@nodelib/fs.scandir/src/providers/sync.spec.ts
generated
vendored
Normal file
186
assets_old/node_modules/@nodelib/fs.scandir/src/providers/sync.spec.ts
generated
vendored
Normal file
|
@ -0,0 +1,186 @@
|
|||
import * as assert from 'assert';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
import * as sinon from 'sinon';
|
||||
|
||||
import { Dirent, Stats } from '../../../fs.macchiato';
|
||||
import { IS_SUPPORT_READDIR_WITH_FILE_TYPES } from '../constants';
|
||||
import Settings from '../settings';
|
||||
import { Entry } from '../types';
|
||||
import * as provider from './sync';
|
||||
|
||||
const ROOT_PATH = 'root';
|
||||
const FIRST_FILE_PATH = 'first.txt';
|
||||
const SECOND_FILE_PATH = 'second.txt';
|
||||
const FIRST_ENTRY_PATH = path.join(ROOT_PATH, FIRST_FILE_PATH);
|
||||
const SECOND_ENTRY_PATH = path.join(ROOT_PATH, SECOND_FILE_PATH);
|
||||
|
||||
describe('Providers → Sync', () => {
|
||||
describe('.read', () => {
|
||||
it('should call correct method based on Node.js version', () => {
|
||||
const readdirSync = sinon.stub().returns([]);
|
||||
|
||||
const settings = new Settings({
|
||||
fs: { readdirSync: readdirSync as unknown as typeof fs.readdirSync }
|
||||
});
|
||||
|
||||
const actual = provider.read(ROOT_PATH, settings);
|
||||
|
||||
assert.deepStrictEqual(actual, []);
|
||||
|
||||
if (IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
||||
assert.deepStrictEqual(readdirSync.args, [[ROOT_PATH, { withFileTypes: true }]]);
|
||||
} else {
|
||||
assert.deepStrictEqual(readdirSync.args, [[ROOT_PATH]]);
|
||||
}
|
||||
});
|
||||
|
||||
it('should always use `readdir` method when the `stats` option is enabled', () => {
|
||||
const readdirSync = sinon.stub().returns([]);
|
||||
|
||||
const settings = new Settings({
|
||||
fs: { readdirSync: readdirSync as unknown as typeof fs.readdirSync },
|
||||
stats: true
|
||||
});
|
||||
|
||||
provider.read(ROOT_PATH, settings);
|
||||
|
||||
assert.deepStrictEqual(readdirSync.args, [[ROOT_PATH]]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('.readdirWithFileTypes', () => {
|
||||
it('should return entries', () => {
|
||||
const dirent = new Dirent({ name: FIRST_FILE_PATH });
|
||||
const readdirSync = sinon.stub().returns([dirent]);
|
||||
|
||||
const settings = new Settings({
|
||||
fs: { readdirSync: readdirSync as unknown as typeof fs.readdirSync }
|
||||
});
|
||||
|
||||
const expected: Entry[] = [
|
||||
{
|
||||
dirent,
|
||||
name: FIRST_FILE_PATH,
|
||||
path: FIRST_ENTRY_PATH
|
||||
}
|
||||
];
|
||||
|
||||
const actual = provider.readdirWithFileTypes(ROOT_PATH, settings);
|
||||
|
||||
assert.deepStrictEqual(readdirSync.args, [[ROOT_PATH, { withFileTypes: true }]]);
|
||||
assert.deepStrictEqual(actual, expected);
|
||||
});
|
||||
|
||||
it('should call fs.stat for symbolic link when the "followSymbolicLink" option is enabled', () => {
|
||||
const firstDirent = new Dirent({ name: FIRST_FILE_PATH });
|
||||
const secondDirent = new Dirent({ name: SECOND_FILE_PATH, isSymbolicLink: true });
|
||||
const stats = new Stats();
|
||||
|
||||
const readdirSync = sinon.stub().returns([firstDirent, secondDirent]);
|
||||
const statSync = sinon.stub().returns(stats);
|
||||
|
||||
const settings = new Settings({
|
||||
followSymbolicLinks: true,
|
||||
fs: {
|
||||
readdirSync: readdirSync as unknown as typeof fs.readdirSync,
|
||||
statSync: statSync as unknown as typeof fs.statSync
|
||||
}
|
||||
});
|
||||
|
||||
const actual = provider.readdirWithFileTypes(ROOT_PATH, settings);
|
||||
|
||||
assert.strictEqual(actual.length, 2);
|
||||
assert.deepStrictEqual(statSync.args, [[SECOND_ENTRY_PATH]]);
|
||||
assert.ok(!actual[1].dirent.isSymbolicLink());
|
||||
});
|
||||
|
||||
it('should return lstat for broken symbolic link when the "throwErrorOnBrokenSymbolicLink" option is disabled', () => {
|
||||
const dirent = new Dirent({ name: FIRST_FILE_PATH, isSymbolicLink: true });
|
||||
|
||||
const readdirSync = sinon.stub().returns([dirent]);
|
||||
const statSync = (): never => {
|
||||
throw new Error('error');
|
||||
};
|
||||
|
||||
const settings = new Settings({
|
||||
followSymbolicLinks: true,
|
||||
throwErrorOnBrokenSymbolicLink: false,
|
||||
fs: {
|
||||
readdirSync: readdirSync as unknown as typeof fs.readdirSync,
|
||||
statSync: statSync as unknown as typeof fs.statSync
|
||||
}
|
||||
});
|
||||
|
||||
const actual = provider.readdirWithFileTypes(ROOT_PATH, settings);
|
||||
|
||||
assert.strictEqual(actual.length, 1);
|
||||
});
|
||||
|
||||
it('should throw an error fro broken symbolic link when the "throwErrorOnBrokenSymbolicLink" option is enabled', () => {
|
||||
const dirent = new Dirent({ name: FIRST_FILE_PATH, isSymbolicLink: true });
|
||||
|
||||
const readdirSync = sinon.stub().returns([dirent]);
|
||||
const statSync = (): never => {
|
||||
throw new Error('error');
|
||||
};
|
||||
|
||||
const settings = new Settings({
|
||||
followSymbolicLinks: true,
|
||||
throwErrorOnBrokenSymbolicLink: true,
|
||||
fs: {
|
||||
readdirSync: readdirSync as unknown as typeof fs.readdirSync,
|
||||
statSync: statSync as unknown as typeof fs.statSync
|
||||
}
|
||||
});
|
||||
|
||||
const expectedErrorMessageRe = /Error: error/;
|
||||
|
||||
assert.throws(() => provider.readdirWithFileTypes(ROOT_PATH, settings), expectedErrorMessageRe);
|
||||
});
|
||||
});
|
||||
|
||||
describe('.readdir', () => {
|
||||
it('should return entries', () => {
|
||||
const stats = new Stats();
|
||||
|
||||
const readdirSync = sinon.stub().returns([FIRST_FILE_PATH]);
|
||||
const lstatSync = sinon.stub().returns(stats);
|
||||
|
||||
const settings = new Settings({
|
||||
fs: {
|
||||
readdirSync: readdirSync as unknown as typeof fs.readdirSync,
|
||||
lstatSync: lstatSync as unknown as typeof fs.lstatSync
|
||||
}
|
||||
});
|
||||
|
||||
const actual = provider.readdir(ROOT_PATH, settings);
|
||||
|
||||
assert.deepStrictEqual(readdirSync.args, [[ROOT_PATH]]);
|
||||
|
||||
assert.strictEqual(actual[0].name, FIRST_FILE_PATH);
|
||||
assert.strictEqual(actual[0].path, FIRST_ENTRY_PATH);
|
||||
assert.strictEqual(actual[0].dirent.name, FIRST_FILE_PATH);
|
||||
});
|
||||
|
||||
it('should return entries with `stats` property', () => {
|
||||
const stats = new Stats();
|
||||
|
||||
const readdirSync = sinon.stub().returns([FIRST_FILE_PATH]);
|
||||
const lstatSync = sinon.stub().returns(stats);
|
||||
|
||||
const settings = new Settings({
|
||||
fs: {
|
||||
readdirSync: readdirSync as unknown as typeof fs.readdirSync,
|
||||
lstatSync: lstatSync as unknown as typeof fs.lstatSync
|
||||
},
|
||||
stats: true
|
||||
});
|
||||
|
||||
const actual = provider.readdir(ROOT_PATH, settings);
|
||||
|
||||
assert.deepStrictEqual(actual[0].stats, stats);
|
||||
});
|
||||
});
|
||||
});
|
62
assets_old/node_modules/@nodelib/fs.scandir/src/providers/sync.ts
generated
vendored
Normal file
62
assets_old/node_modules/@nodelib/fs.scandir/src/providers/sync.ts
generated
vendored
Normal file
|
@ -0,0 +1,62 @@
|
|||
import * as fsStat from '@nodelib/fs.stat';
|
||||
|
||||
import { IS_SUPPORT_READDIR_WITH_FILE_TYPES } from '../constants';
|
||||
import Settings from '../settings';
|
||||
import { Entry } from '../types';
|
||||
import * as utils from '../utils';
|
||||
import * as common from './common';
|
||||
|
||||
export function read(directory: string, settings: Settings): Entry[] {
|
||||
if (!settings.stats && IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
||||
return readdirWithFileTypes(directory, settings);
|
||||
}
|
||||
|
||||
return readdir(directory, settings);
|
||||
}
|
||||
|
||||
export function readdirWithFileTypes(directory: string, settings: Settings): Entry[] {
|
||||
const dirents = settings.fs.readdirSync(directory, { withFileTypes: true });
|
||||
|
||||
return dirents.map((dirent) => {
|
||||
const entry: 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;
|
||||
});
|
||||
}
|
||||
|
||||
export function readdir(directory: string, settings: Settings): Entry[] {
|
||||
const names = settings.fs.readdirSync(directory);
|
||||
|
||||
return names.map((name) => {
|
||||
const entryPath = common.joinPathSegments(directory, name, settings.pathSegmentSeparator);
|
||||
const stats = fsStat.statSync(entryPath, settings.fsStatSettings);
|
||||
|
||||
const entry: Entry = {
|
||||
name,
|
||||
path: entryPath,
|
||||
dirent: utils.fs.createDirentFromStats(name, stats)
|
||||
};
|
||||
|
||||
if (settings.stats) {
|
||||
entry.stats = stats;
|
||||
}
|
||||
|
||||
return entry;
|
||||
});
|
||||
}
|
32
assets_old/node_modules/@nodelib/fs.scandir/src/settings.spec.ts
generated
vendored
Normal file
32
assets_old/node_modules/@nodelib/fs.scandir/src/settings.spec.ts
generated
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
import * as assert from 'assert';
|
||||
import * as path from 'path';
|
||||
|
||||
import { Stats } from '../../fs.macchiato';
|
||||
|
||||
import * as fs from './adapters/fs';
|
||||
import Settings from './settings';
|
||||
|
||||
describe('Settings', () => {
|
||||
it('should return instance with default values', () => {
|
||||
const settings = new Settings();
|
||||
|
||||
assert.deepStrictEqual(settings.fs, fs.createFileSystemAdapter());
|
||||
assert.ok(!settings.followSymbolicLinks);
|
||||
assert.ok(!settings.stats);
|
||||
assert.strictEqual(settings.pathSegmentSeparator, path.sep);
|
||||
assert.ok(settings.fsStatSettings);
|
||||
assert.ok(settings.throwErrorOnBrokenSymbolicLink);
|
||||
});
|
||||
|
||||
it('should return instance with custom values', () => {
|
||||
const lstatSync = (): Stats => new Stats();
|
||||
|
||||
const settings = new Settings({
|
||||
fs: fs.createFileSystemAdapter({ lstatSync }),
|
||||
stats: true
|
||||
});
|
||||
|
||||
assert.deepStrictEqual(settings.fs, fs.createFileSystemAdapter({ lstatSync }));
|
||||
assert.ok(settings.stats);
|
||||
});
|
||||
});
|
33
assets_old/node_modules/@nodelib/fs.scandir/src/settings.ts
generated
vendored
Normal file
33
assets_old/node_modules/@nodelib/fs.scandir/src/settings.ts
generated
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
import * as path from 'path';
|
||||
|
||||
import * as fsStat from '@nodelib/fs.stat';
|
||||
|
||||
import * as fs from './adapters/fs';
|
||||
|
||||
export type Options = {
|
||||
followSymbolicLinks?: boolean;
|
||||
fs?: Partial<fs.FileSystemAdapter>;
|
||||
pathSegmentSeparator?: string;
|
||||
stats?: boolean;
|
||||
throwErrorOnBrokenSymbolicLink?: boolean;
|
||||
};
|
||||
|
||||
export default class Settings {
|
||||
public readonly followSymbolicLinks: boolean = this._getValue(this._options.followSymbolicLinks, false);
|
||||
public readonly fs: fs.FileSystemAdapter = fs.createFileSystemAdapter(this._options.fs);
|
||||
public readonly pathSegmentSeparator: string = this._getValue(this._options.pathSegmentSeparator, path.sep);
|
||||
public readonly stats: boolean = this._getValue(this._options.stats, false);
|
||||
public readonly throwErrorOnBrokenSymbolicLink: boolean = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
||||
|
||||
public readonly fsStatSettings: fsStat.Settings = new fsStat.Settings({
|
||||
followSymbolicLink: this.followSymbolicLinks,
|
||||
fs: this.fs,
|
||||
throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink
|
||||
});
|
||||
|
||||
constructor(private readonly _options: Options = {}) { }
|
||||
|
||||
private _getValue<T>(option: T | undefined, value: T): T {
|
||||
return option ?? value;
|
||||
}
|
||||
}
|
21
assets_old/node_modules/@nodelib/fs.scandir/src/types/index.ts
generated
vendored
Normal file
21
assets_old/node_modules/@nodelib/fs.scandir/src/types/index.ts
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
import * as fs from 'fs';
|
||||
|
||||
export type Entry = {
|
||||
dirent: Dirent;
|
||||
name: string;
|
||||
path: string;
|
||||
stats?: Stats;
|
||||
};
|
||||
|
||||
export type Stats = fs.Stats;
|
||||
|
||||
export type Dirent = {
|
||||
isBlockDevice(): boolean;
|
||||
isCharacterDevice(): boolean;
|
||||
isDirectory(): boolean;
|
||||
isFIFO(): boolean;
|
||||
isFile(): boolean;
|
||||
isSocket(): boolean;
|
||||
isSymbolicLink(): boolean;
|
||||
name: string;
|
||||
};
|
21
assets_old/node_modules/@nodelib/fs.scandir/src/utils/fs.spec.ts
generated
vendored
Normal file
21
assets_old/node_modules/@nodelib/fs.scandir/src/utils/fs.spec.ts
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
import * as assert from 'assert';
|
||||
|
||||
import { Stats } from '../../../fs.macchiato';
|
||||
import * as util from './fs';
|
||||
|
||||
describe('Utils → FS', () => {
|
||||
describe('.createDirentFromStats', () => {
|
||||
it('should convert fs.Stats to fs.Dirent', () => {
|
||||
const actual = util.createDirentFromStats('name', new Stats());
|
||||
|
||||
assert.strictEqual(actual.name, 'name');
|
||||
assert.ok(!actual.isBlockDevice());
|
||||
assert.ok(!actual.isCharacterDevice());
|
||||
assert.ok(!actual.isDirectory());
|
||||
assert.ok(!actual.isFIFO());
|
||||
assert.ok(actual.isFile());
|
||||
assert.ok(!actual.isSocket());
|
||||
assert.ok(!actual.isSymbolicLink());
|
||||
});
|
||||
});
|
||||
});
|
27
assets_old/node_modules/@nodelib/fs.scandir/src/utils/fs.ts
generated
vendored
Normal file
27
assets_old/node_modules/@nodelib/fs.scandir/src/utils/fs.ts
generated
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
import * as fs from 'fs';
|
||||
|
||||
import { Dirent, Stats } from '../types';
|
||||
|
||||
class DirentFromStats implements fs.Dirent {
|
||||
public isBlockDevice: Stats['isBlockDevice'];
|
||||
public isCharacterDevice: Stats['isCharacterDevice'];
|
||||
public isDirectory: Stats['isDirectory'];
|
||||
public isFIFO: Stats['isFIFO'];
|
||||
public isFile: Stats['isFile'];
|
||||
public isSocket: Stats['isSocket'];
|
||||
public isSymbolicLink: Stats['isSymbolicLink'];
|
||||
|
||||
constructor(public name: string, stats: Stats) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
export function createDirentFromStats(name: string, stats: Stats): Dirent {
|
||||
return new DirentFromStats(name, stats);
|
||||
}
|
5
assets_old/node_modules/@nodelib/fs.scandir/src/utils/index.ts
generated
vendored
Normal file
5
assets_old/node_modules/@nodelib/fs.scandir/src/utils/index.ts
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
import * as fs from './fs';
|
||||
|
||||
export {
|
||||
fs
|
||||
};
|
15
assets_old/node_modules/@nodelib/fs.scandir/tsconfig.json
generated
vendored
Normal file
15
assets_old/node_modules/@nodelib/fs.scandir/tsconfig.json
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"extends": "../../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": "src",
|
||||
"outDir": "out"
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"path": "../fs.macchiato"
|
||||
},
|
||||
{
|
||||
"path": "../fs.stat"
|
||||
}
|
||||
]
|
||||
}
|
1720
assets_old/node_modules/@nodelib/fs.scandir/tsconfig.tsbuildinfo
generated
vendored
Normal file
1720
assets_old/node_modules/@nodelib/fs.scandir/tsconfig.tsbuildinfo
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1
assets_old/node_modules/@nodelib/fs.stat/.eslintcache
generated
vendored
Normal file
1
assets_old/node_modules/@nodelib/fs.stat/.eslintcache
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
[{"D:\\work\\OpenSource\\nodelib\\packages\\fs\\fs.stat\\src\\adapters\\fs.spec.ts":"1","D:\\work\\OpenSource\\nodelib\\packages\\fs\\fs.stat\\src\\adapters\\fs.ts":"2","D:\\work\\OpenSource\\nodelib\\packages\\fs\\fs.stat\\src\\index.spec.ts":"3","D:\\work\\OpenSource\\nodelib\\packages\\fs\\fs.stat\\src\\index.ts":"4","D:\\work\\OpenSource\\nodelib\\packages\\fs\\fs.stat\\src\\providers\\async.spec.ts":"5","D:\\work\\OpenSource\\nodelib\\packages\\fs\\fs.stat\\src\\providers\\async.ts":"6","D:\\work\\OpenSource\\nodelib\\packages\\fs\\fs.stat\\src\\providers\\sync.spec.ts":"7","D:\\work\\OpenSource\\nodelib\\packages\\fs\\fs.stat\\src\\providers\\sync.ts":"8","D:\\work\\OpenSource\\nodelib\\packages\\fs\\fs.stat\\src\\settings.spec.ts":"9","D:\\work\\OpenSource\\nodelib\\packages\\fs\\fs.stat\\src\\settings.ts":"10","D:\\work\\OpenSource\\nodelib\\packages\\fs\\fs.stat\\src\\types\\index.ts":"11"},{"size":807,"mtime":1609075886217,"results":"12","hashOfConfig":"13"},{"size":544,"mtime":1609075886217,"results":"14","hashOfConfig":"13"},{"size":1664,"mtime":1609075886218,"results":"15","hashOfConfig":"13"},{"size":1576,"mtime":1609075886218,"results":"16","hashOfConfig":"13"},{"size":3262,"mtime":1609075886219,"results":"17","hashOfConfig":"13"},{"size":1258,"mtime":1609075886220,"results":"18","hashOfConfig":"13"},{"size":2676,"mtime":1609075886220,"results":"19","hashOfConfig":"13"},{"size":518,"mtime":1609075886220,"results":"20","hashOfConfig":"13"},{"size":943,"mtime":1609075886221,"results":"21","hashOfConfig":"13"},{"size":809,"mtime":1609075886221,"results":"22","hashOfConfig":"13"},{"size":109,"mtime":1609075886222,"results":"23","hashOfConfig":"13"},{"filePath":"24","messages":"25","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"18hbtvp",{"filePath":"26","messages":"27","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"28","messages":"29","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"30","messages":"31","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"32","messages":"33","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"34","messages":"35","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"36","messages":"37","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"38","messages":"39","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"40","messages":"41","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"42","messages":"43","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"44","messages":"45","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"D:\\work\\OpenSource\\nodelib\\packages\\fs\\fs.stat\\src\\adapters\\fs.spec.ts",[],"D:\\work\\OpenSource\\nodelib\\packages\\fs\\fs.stat\\src\\adapters\\fs.ts",[],"D:\\work\\OpenSource\\nodelib\\packages\\fs\\fs.stat\\src\\index.spec.ts",[],"D:\\work\\OpenSource\\nodelib\\packages\\fs\\fs.stat\\src\\index.ts",[],"D:\\work\\OpenSource\\nodelib\\packages\\fs\\fs.stat\\src\\providers\\async.spec.ts",[],"D:\\work\\OpenSource\\nodelib\\packages\\fs\\fs.stat\\src\\providers\\async.ts",[],"D:\\work\\OpenSource\\nodelib\\packages\\fs\\fs.stat\\src\\providers\\sync.spec.ts",[],"D:\\work\\OpenSource\\nodelib\\packages\\fs\\fs.stat\\src\\providers\\sync.ts",[],"D:\\work\\OpenSource\\nodelib\\packages\\fs\\fs.stat\\src\\settings.spec.ts",[],"D:\\work\\OpenSource\\nodelib\\packages\\fs\\fs.stat\\src\\settings.ts",[],"D:\\work\\OpenSource\\nodelib\\packages\\fs\\fs.stat\\src\\types\\index.ts",[]]
|
21
assets_old/node_modules/@nodelib/fs.stat/LICENSE
generated
vendored
Normal file
21
assets_old/node_modules/@nodelib/fs.stat/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
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
assets_old/node_modules/@nodelib/fs.stat/README.md
generated
vendored
Normal file
126
assets_old/node_modules/@nodelib/fs.stat/README.md
generated
vendored
Normal file
|
@ -0,0 +1,126 @@
|
|||
# @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.
|
11
assets_old/node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts
generated
vendored
Normal file
11
assets_old/node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
/// <reference types="node" />
|
||||
import * as fs from 'fs';
|
||||
export declare type FileSystemAdapter = {
|
||||
lstat: typeof fs.lstat;
|
||||
stat: typeof fs.stat;
|
||||
lstatSync: typeof fs.lstatSync;
|
||||
statSync: typeof fs.statSync;
|
||||
};
|
||||
export declare const FILE_SYSTEM_ADAPTER: FileSystemAdapter;
|
||||
export declare function createFileSystemAdapter(fsMethods?: Partial<FileSystemAdapter>): FileSystemAdapter;
|
||||
//# sourceMappingURL=fs.d.ts.map
|
1
assets_old/node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts.map
generated
vendored
Normal file
1
assets_old/node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../src/adapters/fs.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAEzB,oBAAY,iBAAiB,GAAG;IAC/B,KAAK,EAAE,OAAO,EAAE,CAAC,KAAK,CAAC;IACvB,IAAI,EAAE,OAAO,EAAE,CAAC,IAAI,CAAC;IACrB,SAAS,EAAE,OAAO,EAAE,CAAC,SAAS,CAAC;IAC/B,QAAQ,EAAE,OAAO,EAAE,CAAC,QAAQ,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,iBAKjC,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,iBAAiB,CASjG"}
|
17
assets_old/node_modules/@nodelib/fs.stat/out/adapters/fs.js
generated
vendored
Normal file
17
assets_old/node_modules/@nodelib/fs.stat/out/adapters/fs.js
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
"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;
|
2
assets_old/node_modules/@nodelib/fs.stat/out/adapters/fs.spec.d.ts
generated
vendored
Normal file
2
assets_old/node_modules/@nodelib/fs.stat/out/adapters/fs.spec.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
export {};
|
||||
//# sourceMappingURL=fs.spec.d.ts.map
|
1
assets_old/node_modules/@nodelib/fs.stat/out/adapters/fs.spec.d.ts.map
generated
vendored
Normal file
1
assets_old/node_modules/@nodelib/fs.stat/out/adapters/fs.spec.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"fs.spec.d.ts","sourceRoot":"","sources":["../../src/adapters/fs.spec.ts"],"names":[],"mappings":""}
|
20
assets_old/node_modules/@nodelib/fs.stat/out/adapters/fs.spec.js
generated
vendored
Normal file
20
assets_old/node_modules/@nodelib/fs.stat/out/adapters/fs.spec.js
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const assert = require("assert");
|
||||
const fs_macchiato_1 = require("../../../fs.macchiato");
|
||||
const adapter = require("./fs");
|
||||
describe('Adapters → FileSystem', () => {
|
||||
it('should return original FS methods', () => {
|
||||
const expected = adapter.FILE_SYSTEM_ADAPTER;
|
||||
const actual = adapter.createFileSystemAdapter();
|
||||
assert.deepStrictEqual(actual, expected);
|
||||
});
|
||||
it('should return custom FS methods', () => {
|
||||
const customLstatSyncMethod = () => new fs_macchiato_1.Stats();
|
||||
const expected = Object.assign(Object.assign({}, adapter.FILE_SYSTEM_ADAPTER), { lstatSync: customLstatSyncMethod });
|
||||
const actual = adapter.createFileSystemAdapter({
|
||||
lstatSync: customLstatSyncMethod
|
||||
});
|
||||
assert.deepStrictEqual(actual, expected);
|
||||
});
|
||||
});
|
13
assets_old/node_modules/@nodelib/fs.stat/out/index.d.ts
generated
vendored
Normal file
13
assets_old/node_modules/@nodelib/fs.stat/out/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
import { FileSystemAdapter } from './adapters/fs';
|
||||
import * as async from './providers/async';
|
||||
import Settings, { Options } from './settings';
|
||||
import { 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, Options, Stats };
|
||||
//# sourceMappingURL=index.d.ts.map
|
1
assets_old/node_modules/@nodelib/fs.stat/out/index.d.ts.map
generated
vendored
Normal file
1
assets_old/node_modules/@nodelib/fs.stat/out/index.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,KAAK,MAAM,mBAAmB,CAAC;AAE3C,OAAO,QAAQ,EAAE,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,aAAK,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC;AAEzC,iBAAS,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAC;AAC3D,iBAAS,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,iBAAiB,EAAE,OAAO,GAAG,QAAQ,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAC;AAWlG,OAAO,WAAW,IAAI,CAAC;IACtB,SAAS,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;CAC7F;AAED,iBAAS,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAI7E;AAUD,OAAO,EACN,QAAQ,EACR,IAAI,EACJ,QAAQ,EAIR,aAAa,EACb,iBAAiB,EACjB,OAAO,EACP,KAAK,EACL,CAAC"}
|
25
assets_old/node_modules/@nodelib/fs.stat/out/index.js
generated
vendored
Normal file
25
assets_old/node_modules/@nodelib/fs.stat/out/index.js
generated
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
"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') {
|
||||
return async.read(path, getSettings(), optionsOrSettingsOrCallback);
|
||||
}
|
||||
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);
|
||||
}
|
2
assets_old/node_modules/@nodelib/fs.stat/out/index.spec.d.ts
generated
vendored
Normal file
2
assets_old/node_modules/@nodelib/fs.stat/out/index.spec.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
export {};
|
||||
//# sourceMappingURL=index.spec.d.ts.map
|
1
assets_old/node_modules/@nodelib/fs.stat/out/index.spec.d.ts.map
generated
vendored
Normal file
1
assets_old/node_modules/@nodelib/fs.stat/out/index.spec.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.spec.d.ts","sourceRoot":"","sources":["../src/index.spec.ts"],"names":[],"mappings":""}
|
56
assets_old/node_modules/@nodelib/fs.stat/out/index.spec.js
generated
vendored
Normal file
56
assets_old/node_modules/@nodelib/fs.stat/out/index.spec.js
generated
vendored
Normal file
|
@ -0,0 +1,56 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const assert = require("assert");
|
||||
const fs = require("fs");
|
||||
const rimraf = require("rimraf");
|
||||
const _1 = require(".");
|
||||
describe('Package', () => {
|
||||
before(() => {
|
||||
rimraf.sync('fixtures');
|
||||
fs.mkdirSync('fixtures');
|
||||
fs.mkdirSync('fixtures/a');
|
||||
fs.symlinkSync('a', 'fixtures/b', 'junction');
|
||||
});
|
||||
after(() => {
|
||||
rimraf.sync('fixtures');
|
||||
});
|
||||
describe('.stat', () => {
|
||||
it('should work without options or settings', (done) => {
|
||||
_1.stat('fixtures/b', (error, stats) => {
|
||||
assert.strictEqual(error, null);
|
||||
assert.ok(stats);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('should work with options', (done) => {
|
||||
_1.stat('fixtures/b', { markSymbolicLink: true }, (error, stats) => {
|
||||
assert.strictEqual(error, null);
|
||||
assert.strictEqual(stats.isSymbolicLink(), true);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('should work with settings', (done) => {
|
||||
const settings = new _1.Settings({ markSymbolicLink: true });
|
||||
_1.stat('fixtures/b', settings, (error, stats) => {
|
||||
assert.strictEqual(error, null);
|
||||
assert.strictEqual(stats.isSymbolicLink(), true);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
describe('.statSync', () => {
|
||||
it('should work without options or settings', () => {
|
||||
const actual = _1.statSync('fixtures/b');
|
||||
assert.ok(actual);
|
||||
});
|
||||
it('should work with options', () => {
|
||||
const actual = _1.statSync('fixtures/b', { markSymbolicLink: true });
|
||||
assert.strictEqual(actual.isSymbolicLink(), true);
|
||||
});
|
||||
it('should work with settings', () => {
|
||||
const settings = new _1.Settings({ markSymbolicLink: true });
|
||||
const actual = _1.statSync('fixtures/b', settings);
|
||||
assert.strictEqual(actual.isSymbolicLink(), true);
|
||||
});
|
||||
});
|
||||
});
|
5
assets_old/node_modules/@nodelib/fs.stat/out/providers/async.d.ts
generated
vendored
Normal file
5
assets_old/node_modules/@nodelib/fs.stat/out/providers/async.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
import Settings from '../settings';
|
||||
import { ErrnoException, Stats } from '../types';
|
||||
export declare type AsyncCallback = (err: ErrnoException, stats: Stats) => void;
|
||||
export declare function read(path: string, settings: Settings, callback: AsyncCallback): void;
|
||||
//# sourceMappingURL=async.d.ts.map
|
1
assets_old/node_modules/@nodelib/fs.stat/out/providers/async.d.ts.map
generated
vendored
Normal file
1
assets_old/node_modules/@nodelib/fs.stat/out/providers/async.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../../src/providers/async.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAKjD,oBAAY,aAAa,GAAG,CAAC,GAAG,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;AAExE,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI,CA0BpF"}
|
32
assets_old/node_modules/@nodelib/fs.stat/out/providers/async.js
generated
vendored
Normal file
32
assets_old/node_modules/@nodelib/fs.stat/out/providers/async.js
generated
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
"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) {
|
||||
return callFailureCallback(callback, lstatError);
|
||||
}
|
||||
if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
|
||||
return callSuccessCallback(callback, lstat);
|
||||
}
|
||||
settings.fs.stat(path, (statError, stat) => {
|
||||
if (statError !== null) {
|
||||
if (settings.throwErrorOnBrokenSymbolicLink) {
|
||||
return callFailureCallback(callback, statError);
|
||||
}
|
||||
return callSuccessCallback(callback, lstat);
|
||||
}
|
||||
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);
|
||||
}
|
2
assets_old/node_modules/@nodelib/fs.stat/out/providers/async.spec.d.ts
generated
vendored
Normal file
2
assets_old/node_modules/@nodelib/fs.stat/out/providers/async.spec.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
export {};
|
||||
//# sourceMappingURL=async.spec.d.ts.map
|
1
assets_old/node_modules/@nodelib/fs.stat/out/providers/async.spec.d.ts.map
generated
vendored
Normal file
1
assets_old/node_modules/@nodelib/fs.stat/out/providers/async.spec.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"async.spec.d.ts","sourceRoot":"","sources":["../../src/providers/async.spec.ts"],"names":[],"mappings":""}
|
83
assets_old/node_modules/@nodelib/fs.stat/out/providers/async.spec.js
generated
vendored
Normal file
83
assets_old/node_modules/@nodelib/fs.stat/out/providers/async.spec.js
generated
vendored
Normal file
|
@ -0,0 +1,83 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const assert = require("assert");
|
||||
const sinon = require("sinon");
|
||||
const fs_macchiato_1 = require("../../../fs.macchiato");
|
||||
const settings_1 = require("../settings");
|
||||
const provider = require("./async");
|
||||
describe('Providers → Async', () => {
|
||||
describe('.read', () => {
|
||||
it('should return lstat for non-symlink entry', (done) => {
|
||||
const lstat = sinon.stub().yields(null, new fs_macchiato_1.Stats());
|
||||
const settings = new settings_1.default({
|
||||
fs: { lstat }
|
||||
});
|
||||
provider.read('filepath', settings, (error, stats) => {
|
||||
assert.strictEqual(error, null);
|
||||
assert.strictEqual(stats.ino, 0);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('should return lstat for symlink entry when the "followSymbolicLink" option is disabled', (done) => {
|
||||
const lstat = sinon.stub().yields(null, new fs_macchiato_1.Stats({ isSymbolicLink: true }));
|
||||
const settings = new settings_1.default({
|
||||
followSymbolicLink: false,
|
||||
fs: { lstat }
|
||||
});
|
||||
provider.read('filepath', settings, (error, stats) => {
|
||||
assert.strictEqual(error, null);
|
||||
assert.strictEqual(stats.ino, 0);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('should return stat for symlink entry', (done) => {
|
||||
const lstat = sinon.stub().yields(null, new fs_macchiato_1.Stats({ isSymbolicLink: true }));
|
||||
const stat = sinon.stub().yields(null, new fs_macchiato_1.Stats({ ino: 1 }));
|
||||
const settings = new settings_1.default({
|
||||
fs: { lstat, stat }
|
||||
});
|
||||
provider.read('filepath', settings, (error, stats) => {
|
||||
assert.strictEqual(error, null);
|
||||
assert.strictEqual(stats.ino, 1);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('should return marked stat for symlink entry when the "markSymbolicLink" option is enabled', (done) => {
|
||||
const lstat = sinon.stub().yields(null, new fs_macchiato_1.Stats({ isSymbolicLink: true }));
|
||||
const stat = sinon.stub().yields(null, new fs_macchiato_1.Stats({ ino: 1 }));
|
||||
const settings = new settings_1.default({
|
||||
fs: { lstat, stat },
|
||||
markSymbolicLink: true
|
||||
});
|
||||
provider.read('filepath', settings, (error, stats) => {
|
||||
assert.strictEqual(error, null);
|
||||
assert.strictEqual(stats.isSymbolicLink(), true);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('should return lstat for broken symlink entry when the "throwErrorOnBrokenSymbolicLink" option is disabled', (done) => {
|
||||
const lstat = sinon.stub().yields(null, new fs_macchiato_1.Stats({ isSymbolicLink: true }));
|
||||
const stat = sinon.stub().yields(new Error());
|
||||
const settings = new settings_1.default({
|
||||
fs: { lstat, stat },
|
||||
throwErrorOnBrokenSymbolicLink: false
|
||||
});
|
||||
provider.read('filepath', settings, (error, stats) => {
|
||||
assert.strictEqual(error, null);
|
||||
assert.strictEqual(stats.ino, 0);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('should throw an error when symlink entry is broken', (done) => {
|
||||
const lstat = sinon.stub().yields(null, new fs_macchiato_1.Stats({ isSymbolicLink: true }));
|
||||
const stat = sinon.stub().yields(new Error('broken'));
|
||||
const settings = new settings_1.default({
|
||||
fs: { lstat, stat }
|
||||
});
|
||||
provider.read('filepath', settings, (error) => {
|
||||
assert.strictEqual(error.message, 'broken');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
4
assets_old/node_modules/@nodelib/fs.stat/out/providers/sync.d.ts
generated
vendored
Normal file
4
assets_old/node_modules/@nodelib/fs.stat/out/providers/sync.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
import Settings from '../settings';
|
||||
import { Stats } from '../types';
|
||||
export declare function read(path: string, settings: Settings): Stats;
|
||||
//# sourceMappingURL=sync.d.ts.map
|
1
assets_old/node_modules/@nodelib/fs.stat/out/providers/sync.d.ts.map
generated
vendored
Normal file
1
assets_old/node_modules/@nodelib/fs.stat/out/providers/sync.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/providers/sync.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,KAAK,CAsB5D"}
|
23
assets_old/node_modules/@nodelib/fs.stat/out/providers/sync.js
generated
vendored
Normal file
23
assets_old/node_modules/@nodelib/fs.stat/out/providers/sync.js
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
"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;
|
2
assets_old/node_modules/@nodelib/fs.stat/out/providers/sync.spec.d.ts
generated
vendored
Normal file
2
assets_old/node_modules/@nodelib/fs.stat/out/providers/sync.spec.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
export {};
|
||||
//# sourceMappingURL=sync.spec.d.ts.map
|
1
assets_old/node_modules/@nodelib/fs.stat/out/providers/sync.spec.d.ts.map
generated
vendored
Normal file
1
assets_old/node_modules/@nodelib/fs.stat/out/providers/sync.spec.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"sync.spec.d.ts","sourceRoot":"","sources":["../../src/providers/sync.spec.ts"],"names":[],"mappings":""}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue