@dineroregnskab/eslint-plugin-custom-rules 2.0.4 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node_modules/@aashutoshrathi/word-wrap/LICENSE +21 -0
- package/node_modules/@aashutoshrathi/word-wrap/README.md +182 -0
- package/node_modules/@aashutoshrathi/word-wrap/index.d.ts +50 -0
- package/node_modules/@aashutoshrathi/word-wrap/index.js +52 -0
- package/node_modules/@aashutoshrathi/word-wrap/package.json +81 -0
- package/node_modules/@angular-eslint/bundled-angular-compiler/README.md +1 -0
- package/node_modules/@angular-eslint/bundled-angular-compiler/dist/index.d.ts +5 -0
- package/node_modules/@angular-eslint/bundled-angular-compiler/dist/index.js +32004 -0
- package/node_modules/@angular-eslint/bundled-angular-compiler/package.json +19 -0
- package/node_modules/@angular-eslint/template-parser/LICENSE +21 -0
- package/node_modules/@angular-eslint/template-parser/README.md +1 -0
- package/node_modules/@angular-eslint/template-parser/dist/convert-source-span-to-loc.d.ts +6 -0
- package/node_modules/@angular-eslint/template-parser/dist/convert-source-span-to-loc.js +69 -0
- package/node_modules/@angular-eslint/template-parser/dist/index.d.ts +44 -0
- package/node_modules/@angular-eslint/template-parser/dist/index.js +219 -0
- package/node_modules/@angular-eslint/template-parser/package.json +28 -0
- package/node_modules/@eslint/eslintrc/LICENSE +19 -0
- package/node_modules/@eslint/eslintrc/README.md +115 -0
- package/node_modules/@eslint/eslintrc/conf/config-schema.js +79 -0
- package/node_modules/@eslint/eslintrc/conf/environments.js +215 -0
- package/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs +1104 -0
- package/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs.map +1 -0
- package/node_modules/@eslint/eslintrc/dist/eslintrc.cjs +4333 -0
- package/node_modules/@eslint/eslintrc/dist/eslintrc.cjs.map +1 -0
- package/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js +532 -0
- package/node_modules/@eslint/eslintrc/lib/config-array/config-array.js +523 -0
- package/node_modules/@eslint/eslintrc/lib/config-array/config-dependency.js +115 -0
- package/node_modules/@eslint/eslintrc/lib/config-array/extracted-config.js +145 -0
- package/node_modules/@eslint/eslintrc/lib/config-array/ignore-pattern.js +238 -0
- package/node_modules/@eslint/eslintrc/lib/config-array/index.js +19 -0
- package/node_modules/@eslint/eslintrc/lib/config-array/override-tester.js +225 -0
- package/node_modules/@eslint/eslintrc/lib/config-array-factory.js +1149 -0
- package/node_modules/@eslint/eslintrc/lib/flat-compat.js +318 -0
- package/node_modules/@eslint/eslintrc/lib/index-universal.js +29 -0
- package/node_modules/@eslint/eslintrc/lib/index.js +56 -0
- package/node_modules/@eslint/eslintrc/lib/shared/ajv.js +191 -0
- package/node_modules/@eslint/eslintrc/lib/shared/config-ops.js +135 -0
- package/node_modules/@eslint/eslintrc/lib/shared/config-validator.js +325 -0
- package/node_modules/@eslint/eslintrc/lib/shared/deprecation-warnings.js +63 -0
- package/node_modules/@eslint/eslintrc/lib/shared/naming.js +96 -0
- package/node_modules/@eslint/eslintrc/lib/shared/relative-module-resolver.js +42 -0
- package/node_modules/@eslint/eslintrc/lib/shared/types.js +149 -0
- package/node_modules/@eslint/eslintrc/package.json +82 -0
- package/node_modules/@eslint/eslintrc/universal.js +9 -0
- package/node_modules/@eslint/js/LICENSE +19 -0
- package/node_modules/@eslint/js/README.md +57 -0
- package/node_modules/@eslint/js/package.json +31 -0
- package/node_modules/@eslint/js/src/configs/eslint-all.js +211 -0
- package/node_modules/@eslint/js/src/configs/eslint-recommended.js +76 -0
- package/node_modules/@eslint/js/src/index.js +17 -0
- package/node_modules/@eslint-community/eslint-utils/LICENSE +21 -0
- package/node_modules/@eslint-community/eslint-utils/README.md +37 -0
- package/node_modules/@eslint-community/eslint-utils/index.js +2068 -0
- package/node_modules/@eslint-community/eslint-utils/index.js.map +1 -0
- package/node_modules/@eslint-community/eslint-utils/index.mjs +2027 -0
- package/node_modules/@eslint-community/eslint-utils/index.mjs.map +1 -0
- package/node_modules/@eslint-community/eslint-utils/package.json +73 -0
- package/node_modules/@eslint-community/regexpp/LICENSE +21 -0
- package/node_modules/@eslint-community/regexpp/README.md +177 -0
- package/node_modules/@eslint-community/regexpp/index.d.ts +1065 -0
- package/node_modules/@eslint-community/regexpp/index.js +2747 -0
- package/node_modules/@eslint-community/regexpp/index.js.map +1 -0
- package/node_modules/@eslint-community/regexpp/index.mjs +2737 -0
- package/node_modules/@eslint-community/regexpp/index.mjs.map +1 -0
- package/node_modules/@eslint-community/regexpp/package.json +93 -0
- package/node_modules/@humanwhocodes/config-array/LICENSE +201 -0
- package/node_modules/@humanwhocodes/config-array/README.md +342 -0
- package/node_modules/@humanwhocodes/config-array/api.js +1061 -0
- package/node_modules/@humanwhocodes/config-array/package.json +61 -0
- package/node_modules/@humanwhocodes/module-importer/CHANGELOG.md +15 -0
- package/node_modules/@humanwhocodes/module-importer/LICENSE +201 -0
- package/node_modules/@humanwhocodes/module-importer/README.md +80 -0
- package/node_modules/@humanwhocodes/module-importer/dist/module-importer.cjs +22 -0
- package/node_modules/@humanwhocodes/module-importer/dist/module-importer.d.cts +27 -0
- package/node_modules/@humanwhocodes/module-importer/dist/module-importer.d.ts +2 -0
- package/node_modules/@humanwhocodes/module-importer/dist/module-importer.js +18 -0
- package/node_modules/@humanwhocodes/module-importer/package.json +65 -0
- package/node_modules/@humanwhocodes/module-importer/src/module-importer.cjs +81 -0
- package/node_modules/@humanwhocodes/module-importer/src/module-importer.js +22 -0
- package/node_modules/@humanwhocodes/object-schema/.eslintrc.js +29 -0
- package/node_modules/@humanwhocodes/object-schema/.github/workflows/nodejs-test.yml +27 -0
- package/node_modules/@humanwhocodes/object-schema/.github/workflows/release-please.yml +39 -0
- package/node_modules/@humanwhocodes/object-schema/CHANGELOG.md +26 -0
- package/node_modules/@humanwhocodes/object-schema/LICENSE +29 -0
- package/node_modules/@humanwhocodes/object-schema/README.md +234 -0
- package/node_modules/@humanwhocodes/object-schema/package.json +33 -0
- package/node_modules/@humanwhocodes/object-schema/src/index.js +7 -0
- package/node_modules/@humanwhocodes/object-schema/src/merge-strategy.js +53 -0
- package/node_modules/@humanwhocodes/object-schema/src/object-schema.js +301 -0
- package/node_modules/@humanwhocodes/object-schema/src/validation-strategy.js +102 -0
- package/node_modules/@humanwhocodes/object-schema/tests/merge-strategy.js +66 -0
- package/node_modules/@humanwhocodes/object-schema/tests/object-schema.js +659 -0
- package/node_modules/@humanwhocodes/object-schema/tests/validation-strategy.js +186 -0
- package/node_modules/@nodelib/fs.scandir/LICENSE +21 -0
- package/node_modules/@nodelib/fs.scandir/README.md +171 -0
- package/node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts +20 -0
- package/node_modules/@nodelib/fs.scandir/out/adapters/fs.js +19 -0
- package/node_modules/@nodelib/fs.scandir/out/constants.d.ts +4 -0
- package/node_modules/@nodelib/fs.scandir/out/constants.js +17 -0
- package/node_modules/@nodelib/fs.scandir/out/index.d.ts +12 -0
- package/node_modules/@nodelib/fs.scandir/out/index.js +26 -0
- package/node_modules/@nodelib/fs.scandir/out/providers/async.d.ts +7 -0
- package/node_modules/@nodelib/fs.scandir/out/providers/async.js +104 -0
- package/node_modules/@nodelib/fs.scandir/out/providers/common.d.ts +1 -0
- package/node_modules/@nodelib/fs.scandir/out/providers/common.js +13 -0
- package/node_modules/@nodelib/fs.scandir/out/providers/sync.d.ts +5 -0
- package/node_modules/@nodelib/fs.scandir/out/providers/sync.js +54 -0
- package/node_modules/@nodelib/fs.scandir/out/settings.d.ts +20 -0
- package/node_modules/@nodelib/fs.scandir/out/settings.js +24 -0
- package/node_modules/@nodelib/fs.scandir/out/types/index.d.ts +20 -0
- package/node_modules/@nodelib/fs.scandir/out/types/index.js +2 -0
- package/node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts +2 -0
- package/node_modules/@nodelib/fs.scandir/out/utils/fs.js +19 -0
- package/node_modules/@nodelib/fs.scandir/out/utils/index.d.ts +2 -0
- package/node_modules/@nodelib/fs.scandir/out/utils/index.js +5 -0
- package/node_modules/@nodelib/fs.scandir/package.json +44 -0
- package/node_modules/@nodelib/fs.stat/LICENSE +21 -0
- package/node_modules/@nodelib/fs.stat/README.md +126 -0
- package/node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts +13 -0
- package/node_modules/@nodelib/fs.stat/out/adapters/fs.js +17 -0
- package/node_modules/@nodelib/fs.stat/out/index.d.ts +12 -0
- package/node_modules/@nodelib/fs.stat/out/index.js +26 -0
- package/node_modules/@nodelib/fs.stat/out/providers/async.d.ts +4 -0
- package/node_modules/@nodelib/fs.stat/out/providers/async.js +36 -0
- package/node_modules/@nodelib/fs.stat/out/providers/sync.d.ts +3 -0
- package/node_modules/@nodelib/fs.stat/out/providers/sync.js +23 -0
- package/node_modules/@nodelib/fs.stat/out/settings.d.ts +16 -0
- package/node_modules/@nodelib/fs.stat/out/settings.js +16 -0
- package/node_modules/@nodelib/fs.stat/out/types/index.d.ts +4 -0
- package/node_modules/@nodelib/fs.stat/out/types/index.js +2 -0
- package/node_modules/@nodelib/fs.stat/package.json +37 -0
- package/node_modules/@nodelib/fs.walk/LICENSE +21 -0
- package/node_modules/@nodelib/fs.walk/README.md +215 -0
- package/node_modules/@nodelib/fs.walk/out/index.d.ts +14 -0
- package/node_modules/@nodelib/fs.walk/out/index.js +34 -0
- package/node_modules/@nodelib/fs.walk/out/providers/async.d.ts +12 -0
- package/node_modules/@nodelib/fs.walk/out/providers/async.js +30 -0
- package/node_modules/@nodelib/fs.walk/out/providers/index.d.ts +4 -0
- package/node_modules/@nodelib/fs.walk/out/providers/index.js +9 -0
- package/node_modules/@nodelib/fs.walk/out/providers/stream.d.ts +12 -0
- package/node_modules/@nodelib/fs.walk/out/providers/stream.js +34 -0
- package/node_modules/@nodelib/fs.walk/out/providers/sync.d.ts +10 -0
- package/node_modules/@nodelib/fs.walk/out/providers/sync.js +14 -0
- package/node_modules/@nodelib/fs.walk/out/readers/async.d.ts +30 -0
- package/node_modules/@nodelib/fs.walk/out/readers/async.js +97 -0
- package/node_modules/@nodelib/fs.walk/out/readers/common.d.ts +7 -0
- package/node_modules/@nodelib/fs.walk/out/readers/common.js +31 -0
- package/node_modules/@nodelib/fs.walk/out/readers/reader.d.ts +6 -0
- package/node_modules/@nodelib/fs.walk/out/readers/reader.js +11 -0
- package/node_modules/@nodelib/fs.walk/out/readers/sync.d.ts +15 -0
- package/node_modules/@nodelib/fs.walk/out/readers/sync.js +59 -0
- package/node_modules/@nodelib/fs.walk/out/settings.d.ts +30 -0
- package/node_modules/@nodelib/fs.walk/out/settings.js +26 -0
- package/node_modules/@nodelib/fs.walk/out/types/index.d.ts +8 -0
- package/node_modules/@nodelib/fs.walk/out/types/index.js +2 -0
- package/node_modules/@nodelib/fs.walk/package.json +44 -0
- package/node_modules/@ungap/structured-clone/.github/workflows/node.js.yml +31 -0
- package/node_modules/@ungap/structured-clone/LICENSE +15 -0
- package/node_modules/@ungap/structured-clone/README.md +95 -0
- package/node_modules/@ungap/structured-clone/cjs/deserialize.js +78 -0
- package/node_modules/@ungap/structured-clone/cjs/index.js +27 -0
- package/node_modules/@ungap/structured-clone/cjs/json.js +24 -0
- package/node_modules/@ungap/structured-clone/cjs/package.json +1 -0
- package/node_modules/@ungap/structured-clone/cjs/serialize.js +160 -0
- package/node_modules/@ungap/structured-clone/cjs/types.js +22 -0
- package/node_modules/@ungap/structured-clone/esm/deserialize.js +79 -0
- package/node_modules/@ungap/structured-clone/esm/index.js +25 -0
- package/node_modules/@ungap/structured-clone/esm/json.js +21 -0
- package/node_modules/@ungap/structured-clone/esm/serialize.js +161 -0
- package/node_modules/@ungap/structured-clone/esm/types.js +11 -0
- package/node_modules/@ungap/structured-clone/package.json +53 -0
- package/node_modules/@ungap/structured-clone/structured-json.js +1 -0
- package/package.json +1 -1
- package/rules/dayjs-with-timezone.js +29 -0
- package/rules/reducers-should-always-return.js +20 -4
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as fsStat from '@nodelib/fs.stat';
|
|
2
|
+
import * as fs from './adapters/fs';
|
|
3
|
+
export interface Options {
|
|
4
|
+
followSymbolicLinks?: boolean;
|
|
5
|
+
fs?: Partial<fs.FileSystemAdapter>;
|
|
6
|
+
pathSegmentSeparator?: string;
|
|
7
|
+
stats?: boolean;
|
|
8
|
+
throwErrorOnBrokenSymbolicLink?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export default class Settings {
|
|
11
|
+
private readonly _options;
|
|
12
|
+
readonly followSymbolicLinks: boolean;
|
|
13
|
+
readonly fs: fs.FileSystemAdapter;
|
|
14
|
+
readonly pathSegmentSeparator: string;
|
|
15
|
+
readonly stats: boolean;
|
|
16
|
+
readonly throwErrorOnBrokenSymbolicLink: boolean;
|
|
17
|
+
readonly fsStatSettings: fsStat.Settings;
|
|
18
|
+
constructor(_options?: Options);
|
|
19
|
+
private _getValue;
|
|
20
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const path = require("path");
|
|
4
|
+
const fsStat = require("@nodelib/fs.stat");
|
|
5
|
+
const fs = require("./adapters/fs");
|
|
6
|
+
class Settings {
|
|
7
|
+
constructor(_options = {}) {
|
|
8
|
+
this._options = _options;
|
|
9
|
+
this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
|
|
10
|
+
this.fs = fs.createFileSystemAdapter(this._options.fs);
|
|
11
|
+
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep);
|
|
12
|
+
this.stats = this._getValue(this._options.stats, false);
|
|
13
|
+
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
|
14
|
+
this.fsStatSettings = new fsStat.Settings({
|
|
15
|
+
followSymbolicLink: this.followSymbolicLinks,
|
|
16
|
+
fs: this.fs,
|
|
17
|
+
throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
_getValue(option, value) {
|
|
21
|
+
return option !== null && option !== void 0 ? option : value;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.default = Settings;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type * as fs from 'fs';
|
|
3
|
+
export interface Entry {
|
|
4
|
+
dirent: Dirent;
|
|
5
|
+
name: string;
|
|
6
|
+
path: string;
|
|
7
|
+
stats?: Stats;
|
|
8
|
+
}
|
|
9
|
+
export declare type Stats = fs.Stats;
|
|
10
|
+
export declare type ErrnoException = NodeJS.ErrnoException;
|
|
11
|
+
export interface Dirent {
|
|
12
|
+
isBlockDevice: () => boolean;
|
|
13
|
+
isCharacterDevice: () => boolean;
|
|
14
|
+
isDirectory: () => boolean;
|
|
15
|
+
isFIFO: () => boolean;
|
|
16
|
+
isFile: () => boolean;
|
|
17
|
+
isSocket: () => boolean;
|
|
18
|
+
isSymbolicLink: () => boolean;
|
|
19
|
+
name: string;
|
|
20
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createDirentFromStats = void 0;
|
|
4
|
+
class DirentFromStats {
|
|
5
|
+
constructor(name, stats) {
|
|
6
|
+
this.name = name;
|
|
7
|
+
this.isBlockDevice = stats.isBlockDevice.bind(stats);
|
|
8
|
+
this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
|
|
9
|
+
this.isDirectory = stats.isDirectory.bind(stats);
|
|
10
|
+
this.isFIFO = stats.isFIFO.bind(stats);
|
|
11
|
+
this.isFile = stats.isFile.bind(stats);
|
|
12
|
+
this.isSocket = stats.isSocket.bind(stats);
|
|
13
|
+
this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function createDirentFromStats(name, stats) {
|
|
17
|
+
return new DirentFromStats(name, stats);
|
|
18
|
+
}
|
|
19
|
+
exports.createDirentFromStats = createDirentFromStats;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nodelib/fs.scandir",
|
|
3
|
+
"version": "2.1.5",
|
|
4
|
+
"description": "List files and directories inside the specified directory",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": "https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.scandir",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"NodeLib",
|
|
9
|
+
"fs",
|
|
10
|
+
"FileSystem",
|
|
11
|
+
"file system",
|
|
12
|
+
"scandir",
|
|
13
|
+
"readdir",
|
|
14
|
+
"dirent"
|
|
15
|
+
],
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">= 8"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"out/**",
|
|
21
|
+
"!out/**/*.map",
|
|
22
|
+
"!out/**/*.spec.*"
|
|
23
|
+
],
|
|
24
|
+
"main": "out/index.js",
|
|
25
|
+
"typings": "out/index.d.ts",
|
|
26
|
+
"scripts": {
|
|
27
|
+
"clean": "rimraf {tsconfig.tsbuildinfo,out}",
|
|
28
|
+
"lint": "eslint \"src/**/*.ts\" --cache",
|
|
29
|
+
"compile": "tsc -b .",
|
|
30
|
+
"compile:watch": "tsc -p . --watch --sourceMap",
|
|
31
|
+
"test": "mocha \"out/**/*.spec.js\" -s 0",
|
|
32
|
+
"build": "npm run clean && npm run compile && npm run lint && npm test",
|
|
33
|
+
"watch": "npm run clean && npm run compile:watch"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@nodelib/fs.stat": "2.0.5",
|
|
37
|
+
"run-parallel": "^1.1.9"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@nodelib/fs.macchiato": "1.0.4",
|
|
41
|
+
"@types/run-parallel": "^1.1.0"
|
|
42
|
+
},
|
|
43
|
+
"gitHead": "d6a7960d5281d3dd5f8e2efba49bb552d090f562"
|
|
44
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) Denis Malinochkin
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# @nodelib/fs.stat
|
|
2
|
+
|
|
3
|
+
> Get the status of a file with some features.
|
|
4
|
+
|
|
5
|
+
## :bulb: Highlights
|
|
6
|
+
|
|
7
|
+
Wrapper around standard method `fs.lstat` and `fs.stat` with some features.
|
|
8
|
+
|
|
9
|
+
* :beginner: Normally follows symbolic link.
|
|
10
|
+
* :gear: Can safely work with broken symbolic link.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```console
|
|
15
|
+
npm install @nodelib/fs.stat
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import * as fsStat from '@nodelib/fs.stat';
|
|
22
|
+
|
|
23
|
+
fsStat.stat('path', (error, stats) => { /* … */ });
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## API
|
|
27
|
+
|
|
28
|
+
### .stat(path, [optionsOrSettings], callback)
|
|
29
|
+
|
|
30
|
+
Returns an instance of `fs.Stats` class for provided path with standard callback-style.
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
fsStat.stat('path', (error, stats) => { /* … */ });
|
|
34
|
+
fsStat.stat('path', {}, (error, stats) => { /* … */ });
|
|
35
|
+
fsStat.stat('path', new fsStat.Settings(), (error, stats) => { /* … */ });
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### .statSync(path, [optionsOrSettings])
|
|
39
|
+
|
|
40
|
+
Returns an instance of `fs.Stats` class for provided path.
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
const stats = fsStat.stat('path');
|
|
44
|
+
const stats = fsStat.stat('path', {});
|
|
45
|
+
const stats = fsStat.stat('path', new fsStat.Settings());
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
#### path
|
|
49
|
+
|
|
50
|
+
* Required: `true`
|
|
51
|
+
* Type: `string | Buffer | URL`
|
|
52
|
+
|
|
53
|
+
A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
54
|
+
|
|
55
|
+
#### optionsOrSettings
|
|
56
|
+
|
|
57
|
+
* Required: `false`
|
|
58
|
+
* Type: `Options | Settings`
|
|
59
|
+
* Default: An instance of `Settings` class
|
|
60
|
+
|
|
61
|
+
An [`Options`](#options) object or an instance of [`Settings`](#settings) class.
|
|
62
|
+
|
|
63
|
+
> :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.
|
|
64
|
+
|
|
65
|
+
### Settings([options])
|
|
66
|
+
|
|
67
|
+
A class of full settings of the package.
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
const settings = new fsStat.Settings({ followSymbolicLink: false });
|
|
71
|
+
|
|
72
|
+
const stats = fsStat.stat('path', settings);
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Options
|
|
76
|
+
|
|
77
|
+
### `followSymbolicLink`
|
|
78
|
+
|
|
79
|
+
* Type: `boolean`
|
|
80
|
+
* Default: `true`
|
|
81
|
+
|
|
82
|
+
Follow symbolic link or not. Call `fs.stat` on symbolic link if `true`.
|
|
83
|
+
|
|
84
|
+
### `markSymbolicLink`
|
|
85
|
+
|
|
86
|
+
* Type: `boolean`
|
|
87
|
+
* Default: `false`
|
|
88
|
+
|
|
89
|
+
Mark symbolic link by setting the return value of `isSymbolicLink` function to always `true` (even after `fs.stat`).
|
|
90
|
+
|
|
91
|
+
> :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.
|
|
92
|
+
|
|
93
|
+
### `throwErrorOnBrokenSymbolicLink`
|
|
94
|
+
|
|
95
|
+
* Type: `boolean`
|
|
96
|
+
* Default: `true`
|
|
97
|
+
|
|
98
|
+
Throw an error when symbolic link is broken if `true` or safely return `lstat` call if `false`.
|
|
99
|
+
|
|
100
|
+
### `fs`
|
|
101
|
+
|
|
102
|
+
* Type: [`FileSystemAdapter`](./src/adapters/fs.ts)
|
|
103
|
+
* Default: A default FS methods
|
|
104
|
+
|
|
105
|
+
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.
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
interface FileSystemAdapter {
|
|
109
|
+
lstat?: typeof fs.lstat;
|
|
110
|
+
stat?: typeof fs.stat;
|
|
111
|
+
lstatSync?: typeof fs.lstatSync;
|
|
112
|
+
statSync?: typeof fs.statSync;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const settings = new fsStat.Settings({
|
|
116
|
+
fs: { lstat: fakeLstat }
|
|
117
|
+
});
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Changelog
|
|
121
|
+
|
|
122
|
+
See the [Releases section of our GitHub project](https://github.com/nodelib/nodelib/releases) for changelog for each release version.
|
|
123
|
+
|
|
124
|
+
## License
|
|
125
|
+
|
|
126
|
+
This software is released under the terms of the MIT license.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import * as fs from 'fs';
|
|
3
|
+
import type { ErrnoException } from '../types';
|
|
4
|
+
export declare type StatAsynchronousMethod = (path: string, callback: (error: ErrnoException | null, stats: fs.Stats) => void) => void;
|
|
5
|
+
export declare type StatSynchronousMethod = (path: string) => fs.Stats;
|
|
6
|
+
export interface FileSystemAdapter {
|
|
7
|
+
lstat: StatAsynchronousMethod;
|
|
8
|
+
stat: StatAsynchronousMethod;
|
|
9
|
+
lstatSync: StatSynchronousMethod;
|
|
10
|
+
statSync: StatSynchronousMethod;
|
|
11
|
+
}
|
|
12
|
+
export declare const FILE_SYSTEM_ADAPTER: FileSystemAdapter;
|
|
13
|
+
export declare function createFileSystemAdapter(fsMethods?: Partial<FileSystemAdapter>): FileSystemAdapter;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
exports.FILE_SYSTEM_ADAPTER = {
|
|
6
|
+
lstat: fs.lstat,
|
|
7
|
+
stat: fs.stat,
|
|
8
|
+
lstatSync: fs.lstatSync,
|
|
9
|
+
statSync: fs.statSync
|
|
10
|
+
};
|
|
11
|
+
function createFileSystemAdapter(fsMethods) {
|
|
12
|
+
if (fsMethods === undefined) {
|
|
13
|
+
return exports.FILE_SYSTEM_ADAPTER;
|
|
14
|
+
}
|
|
15
|
+
return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
|
|
16
|
+
}
|
|
17
|
+
exports.createFileSystemAdapter = createFileSystemAdapter;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FileSystemAdapter, StatAsynchronousMethod, StatSynchronousMethod } from './adapters/fs';
|
|
2
|
+
import * as async from './providers/async';
|
|
3
|
+
import Settings, { Options } from './settings';
|
|
4
|
+
import type { Stats } from './types';
|
|
5
|
+
declare type AsyncCallback = async.AsyncCallback;
|
|
6
|
+
declare function stat(path: string, callback: AsyncCallback): void;
|
|
7
|
+
declare function stat(path: string, optionsOrSettings: Options | Settings, callback: AsyncCallback): void;
|
|
8
|
+
declare namespace stat {
|
|
9
|
+
function __promisify__(path: string, optionsOrSettings?: Options | Settings): Promise<Stats>;
|
|
10
|
+
}
|
|
11
|
+
declare function statSync(path: string, optionsOrSettings?: Options | Settings): Stats;
|
|
12
|
+
export { Settings, stat, statSync, AsyncCallback, FileSystemAdapter, StatAsynchronousMethod, StatSynchronousMethod, Options, Stats };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.statSync = exports.stat = exports.Settings = void 0;
|
|
4
|
+
const async = require("./providers/async");
|
|
5
|
+
const sync = require("./providers/sync");
|
|
6
|
+
const settings_1 = require("./settings");
|
|
7
|
+
exports.Settings = settings_1.default;
|
|
8
|
+
function stat(path, optionsOrSettingsOrCallback, callback) {
|
|
9
|
+
if (typeof optionsOrSettingsOrCallback === 'function') {
|
|
10
|
+
async.read(path, getSettings(), optionsOrSettingsOrCallback);
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
async.read(path, getSettings(optionsOrSettingsOrCallback), callback);
|
|
14
|
+
}
|
|
15
|
+
exports.stat = stat;
|
|
16
|
+
function statSync(path, optionsOrSettings) {
|
|
17
|
+
const settings = getSettings(optionsOrSettings);
|
|
18
|
+
return sync.read(path, settings);
|
|
19
|
+
}
|
|
20
|
+
exports.statSync = statSync;
|
|
21
|
+
function getSettings(settingsOrOptions = {}) {
|
|
22
|
+
if (settingsOrOptions instanceof settings_1.default) {
|
|
23
|
+
return settingsOrOptions;
|
|
24
|
+
}
|
|
25
|
+
return new settings_1.default(settingsOrOptions);
|
|
26
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type Settings from '../settings';
|
|
2
|
+
import type { ErrnoException, Stats } from '../types';
|
|
3
|
+
export declare type AsyncCallback = (error: ErrnoException, stats: Stats) => void;
|
|
4
|
+
export declare function read(path: string, settings: Settings, callback: AsyncCallback): void;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.read = void 0;
|
|
4
|
+
function read(path, settings, callback) {
|
|
5
|
+
settings.fs.lstat(path, (lstatError, lstat) => {
|
|
6
|
+
if (lstatError !== null) {
|
|
7
|
+
callFailureCallback(callback, lstatError);
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
|
|
11
|
+
callSuccessCallback(callback, lstat);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
settings.fs.stat(path, (statError, stat) => {
|
|
15
|
+
if (statError !== null) {
|
|
16
|
+
if (settings.throwErrorOnBrokenSymbolicLink) {
|
|
17
|
+
callFailureCallback(callback, statError);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
callSuccessCallback(callback, lstat);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (settings.markSymbolicLink) {
|
|
24
|
+
stat.isSymbolicLink = () => true;
|
|
25
|
+
}
|
|
26
|
+
callSuccessCallback(callback, stat);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
exports.read = read;
|
|
31
|
+
function callFailureCallback(callback, error) {
|
|
32
|
+
callback(error);
|
|
33
|
+
}
|
|
34
|
+
function callSuccessCallback(callback, result) {
|
|
35
|
+
callback(null, result);
|
|
36
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.read = void 0;
|
|
4
|
+
function read(path, settings) {
|
|
5
|
+
const lstat = settings.fs.lstatSync(path);
|
|
6
|
+
if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
|
|
7
|
+
return lstat;
|
|
8
|
+
}
|
|
9
|
+
try {
|
|
10
|
+
const stat = settings.fs.statSync(path);
|
|
11
|
+
if (settings.markSymbolicLink) {
|
|
12
|
+
stat.isSymbolicLink = () => true;
|
|
13
|
+
}
|
|
14
|
+
return stat;
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
if (!settings.throwErrorOnBrokenSymbolicLink) {
|
|
18
|
+
return lstat;
|
|
19
|
+
}
|
|
20
|
+
throw error;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.read = read;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as fs from './adapters/fs';
|
|
2
|
+
export interface Options {
|
|
3
|
+
followSymbolicLink?: boolean;
|
|
4
|
+
fs?: Partial<fs.FileSystemAdapter>;
|
|
5
|
+
markSymbolicLink?: boolean;
|
|
6
|
+
throwErrorOnBrokenSymbolicLink?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export default class Settings {
|
|
9
|
+
private readonly _options;
|
|
10
|
+
readonly followSymbolicLink: boolean;
|
|
11
|
+
readonly fs: fs.FileSystemAdapter;
|
|
12
|
+
readonly markSymbolicLink: boolean;
|
|
13
|
+
readonly throwErrorOnBrokenSymbolicLink: boolean;
|
|
14
|
+
constructor(_options?: Options);
|
|
15
|
+
private _getValue;
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const fs = require("./adapters/fs");
|
|
4
|
+
class Settings {
|
|
5
|
+
constructor(_options = {}) {
|
|
6
|
+
this._options = _options;
|
|
7
|
+
this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
|
|
8
|
+
this.fs = fs.createFileSystemAdapter(this._options.fs);
|
|
9
|
+
this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
|
|
10
|
+
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
|
11
|
+
}
|
|
12
|
+
_getValue(option, value) {
|
|
13
|
+
return option !== null && option !== void 0 ? option : value;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.default = Settings;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nodelib/fs.stat",
|
|
3
|
+
"version": "2.0.5",
|
|
4
|
+
"description": "Get the status of a file with some features",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": "https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.stat",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"NodeLib",
|
|
9
|
+
"fs",
|
|
10
|
+
"FileSystem",
|
|
11
|
+
"file system",
|
|
12
|
+
"stat"
|
|
13
|
+
],
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">= 8"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"out/**",
|
|
19
|
+
"!out/**/*.map",
|
|
20
|
+
"!out/**/*.spec.*"
|
|
21
|
+
],
|
|
22
|
+
"main": "out/index.js",
|
|
23
|
+
"typings": "out/index.d.ts",
|
|
24
|
+
"scripts": {
|
|
25
|
+
"clean": "rimraf {tsconfig.tsbuildinfo,out}",
|
|
26
|
+
"lint": "eslint \"src/**/*.ts\" --cache",
|
|
27
|
+
"compile": "tsc -b .",
|
|
28
|
+
"compile:watch": "tsc -p . --watch --sourceMap",
|
|
29
|
+
"test": "mocha \"out/**/*.spec.js\" -s 0",
|
|
30
|
+
"build": "npm run clean && npm run compile && npm run lint && npm test",
|
|
31
|
+
"watch": "npm run clean && npm run compile:watch"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@nodelib/fs.macchiato": "1.0.4"
|
|
35
|
+
},
|
|
36
|
+
"gitHead": "d6a7960d5281d3dd5f8e2efba49bb552d090f562"
|
|
37
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) Denis Malinochkin
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|