@dineroregnskab/eslint-plugin-custom-rules 2.0.6 → 2.0.7

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.
Files changed (174) hide show
  1. package/eslint-plugin-custom-rules.js +2 -0
  2. package/package.json +1 -1
  3. package/node_modules/@aashutoshrathi/word-wrap/LICENSE +0 -21
  4. package/node_modules/@aashutoshrathi/word-wrap/README.md +0 -182
  5. package/node_modules/@aashutoshrathi/word-wrap/index.d.ts +0 -50
  6. package/node_modules/@aashutoshrathi/word-wrap/index.js +0 -52
  7. package/node_modules/@aashutoshrathi/word-wrap/package.json +0 -81
  8. package/node_modules/@angular-eslint/bundled-angular-compiler/README.md +0 -1
  9. package/node_modules/@angular-eslint/bundled-angular-compiler/dist/index.d.ts +0 -5
  10. package/node_modules/@angular-eslint/bundled-angular-compiler/dist/index.js +0 -32004
  11. package/node_modules/@angular-eslint/bundled-angular-compiler/package.json +0 -19
  12. package/node_modules/@angular-eslint/template-parser/LICENSE +0 -21
  13. package/node_modules/@angular-eslint/template-parser/README.md +0 -1
  14. package/node_modules/@angular-eslint/template-parser/dist/convert-source-span-to-loc.d.ts +0 -6
  15. package/node_modules/@angular-eslint/template-parser/dist/convert-source-span-to-loc.js +0 -69
  16. package/node_modules/@angular-eslint/template-parser/dist/index.d.ts +0 -44
  17. package/node_modules/@angular-eslint/template-parser/dist/index.js +0 -219
  18. package/node_modules/@angular-eslint/template-parser/package.json +0 -28
  19. package/node_modules/@eslint/eslintrc/LICENSE +0 -19
  20. package/node_modules/@eslint/eslintrc/README.md +0 -115
  21. package/node_modules/@eslint/eslintrc/conf/config-schema.js +0 -79
  22. package/node_modules/@eslint/eslintrc/conf/environments.js +0 -215
  23. package/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs +0 -1104
  24. package/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs.map +0 -1
  25. package/node_modules/@eslint/eslintrc/dist/eslintrc.cjs +0 -4333
  26. package/node_modules/@eslint/eslintrc/dist/eslintrc.cjs.map +0 -1
  27. package/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js +0 -532
  28. package/node_modules/@eslint/eslintrc/lib/config-array/config-array.js +0 -523
  29. package/node_modules/@eslint/eslintrc/lib/config-array/config-dependency.js +0 -115
  30. package/node_modules/@eslint/eslintrc/lib/config-array/extracted-config.js +0 -145
  31. package/node_modules/@eslint/eslintrc/lib/config-array/ignore-pattern.js +0 -238
  32. package/node_modules/@eslint/eslintrc/lib/config-array/index.js +0 -19
  33. package/node_modules/@eslint/eslintrc/lib/config-array/override-tester.js +0 -225
  34. package/node_modules/@eslint/eslintrc/lib/config-array-factory.js +0 -1149
  35. package/node_modules/@eslint/eslintrc/lib/flat-compat.js +0 -318
  36. package/node_modules/@eslint/eslintrc/lib/index-universal.js +0 -29
  37. package/node_modules/@eslint/eslintrc/lib/index.js +0 -56
  38. package/node_modules/@eslint/eslintrc/lib/shared/ajv.js +0 -191
  39. package/node_modules/@eslint/eslintrc/lib/shared/config-ops.js +0 -135
  40. package/node_modules/@eslint/eslintrc/lib/shared/config-validator.js +0 -325
  41. package/node_modules/@eslint/eslintrc/lib/shared/deprecation-warnings.js +0 -63
  42. package/node_modules/@eslint/eslintrc/lib/shared/naming.js +0 -96
  43. package/node_modules/@eslint/eslintrc/lib/shared/relative-module-resolver.js +0 -42
  44. package/node_modules/@eslint/eslintrc/lib/shared/types.js +0 -149
  45. package/node_modules/@eslint/eslintrc/package.json +0 -82
  46. package/node_modules/@eslint/eslintrc/universal.js +0 -9
  47. package/node_modules/@eslint/js/LICENSE +0 -19
  48. package/node_modules/@eslint/js/README.md +0 -57
  49. package/node_modules/@eslint/js/package.json +0 -31
  50. package/node_modules/@eslint/js/src/configs/eslint-all.js +0 -211
  51. package/node_modules/@eslint/js/src/configs/eslint-recommended.js +0 -76
  52. package/node_modules/@eslint/js/src/index.js +0 -17
  53. package/node_modules/@eslint-community/eslint-utils/LICENSE +0 -21
  54. package/node_modules/@eslint-community/eslint-utils/README.md +0 -37
  55. package/node_modules/@eslint-community/eslint-utils/index.js +0 -2068
  56. package/node_modules/@eslint-community/eslint-utils/index.js.map +0 -1
  57. package/node_modules/@eslint-community/eslint-utils/index.mjs +0 -2027
  58. package/node_modules/@eslint-community/eslint-utils/index.mjs.map +0 -1
  59. package/node_modules/@eslint-community/eslint-utils/package.json +0 -73
  60. package/node_modules/@eslint-community/regexpp/LICENSE +0 -21
  61. package/node_modules/@eslint-community/regexpp/README.md +0 -177
  62. package/node_modules/@eslint-community/regexpp/index.d.ts +0 -1065
  63. package/node_modules/@eslint-community/regexpp/index.js +0 -2747
  64. package/node_modules/@eslint-community/regexpp/index.js.map +0 -1
  65. package/node_modules/@eslint-community/regexpp/index.mjs +0 -2737
  66. package/node_modules/@eslint-community/regexpp/index.mjs.map +0 -1
  67. package/node_modules/@eslint-community/regexpp/package.json +0 -93
  68. package/node_modules/@humanwhocodes/config-array/LICENSE +0 -201
  69. package/node_modules/@humanwhocodes/config-array/README.md +0 -342
  70. package/node_modules/@humanwhocodes/config-array/api.js +0 -1061
  71. package/node_modules/@humanwhocodes/config-array/package.json +0 -61
  72. package/node_modules/@humanwhocodes/module-importer/CHANGELOG.md +0 -15
  73. package/node_modules/@humanwhocodes/module-importer/LICENSE +0 -201
  74. package/node_modules/@humanwhocodes/module-importer/README.md +0 -80
  75. package/node_modules/@humanwhocodes/module-importer/dist/module-importer.cjs +0 -22
  76. package/node_modules/@humanwhocodes/module-importer/dist/module-importer.d.cts +0 -27
  77. package/node_modules/@humanwhocodes/module-importer/dist/module-importer.d.ts +0 -2
  78. package/node_modules/@humanwhocodes/module-importer/dist/module-importer.js +0 -18
  79. package/node_modules/@humanwhocodes/module-importer/package.json +0 -65
  80. package/node_modules/@humanwhocodes/module-importer/src/module-importer.cjs +0 -81
  81. package/node_modules/@humanwhocodes/module-importer/src/module-importer.js +0 -22
  82. package/node_modules/@humanwhocodes/object-schema/.eslintrc.js +0 -29
  83. package/node_modules/@humanwhocodes/object-schema/.github/workflows/nodejs-test.yml +0 -27
  84. package/node_modules/@humanwhocodes/object-schema/.github/workflows/release-please.yml +0 -39
  85. package/node_modules/@humanwhocodes/object-schema/CHANGELOG.md +0 -26
  86. package/node_modules/@humanwhocodes/object-schema/LICENSE +0 -29
  87. package/node_modules/@humanwhocodes/object-schema/README.md +0 -234
  88. package/node_modules/@humanwhocodes/object-schema/package.json +0 -33
  89. package/node_modules/@humanwhocodes/object-schema/src/index.js +0 -7
  90. package/node_modules/@humanwhocodes/object-schema/src/merge-strategy.js +0 -53
  91. package/node_modules/@humanwhocodes/object-schema/src/object-schema.js +0 -301
  92. package/node_modules/@humanwhocodes/object-schema/src/validation-strategy.js +0 -102
  93. package/node_modules/@humanwhocodes/object-schema/tests/merge-strategy.js +0 -66
  94. package/node_modules/@humanwhocodes/object-schema/tests/object-schema.js +0 -659
  95. package/node_modules/@humanwhocodes/object-schema/tests/validation-strategy.js +0 -186
  96. package/node_modules/@nodelib/fs.scandir/LICENSE +0 -21
  97. package/node_modules/@nodelib/fs.scandir/README.md +0 -171
  98. package/node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts +0 -20
  99. package/node_modules/@nodelib/fs.scandir/out/adapters/fs.js +0 -19
  100. package/node_modules/@nodelib/fs.scandir/out/constants.d.ts +0 -4
  101. package/node_modules/@nodelib/fs.scandir/out/constants.js +0 -17
  102. package/node_modules/@nodelib/fs.scandir/out/index.d.ts +0 -12
  103. package/node_modules/@nodelib/fs.scandir/out/index.js +0 -26
  104. package/node_modules/@nodelib/fs.scandir/out/providers/async.d.ts +0 -7
  105. package/node_modules/@nodelib/fs.scandir/out/providers/async.js +0 -104
  106. package/node_modules/@nodelib/fs.scandir/out/providers/common.d.ts +0 -1
  107. package/node_modules/@nodelib/fs.scandir/out/providers/common.js +0 -13
  108. package/node_modules/@nodelib/fs.scandir/out/providers/sync.d.ts +0 -5
  109. package/node_modules/@nodelib/fs.scandir/out/providers/sync.js +0 -54
  110. package/node_modules/@nodelib/fs.scandir/out/settings.d.ts +0 -20
  111. package/node_modules/@nodelib/fs.scandir/out/settings.js +0 -24
  112. package/node_modules/@nodelib/fs.scandir/out/types/index.d.ts +0 -20
  113. package/node_modules/@nodelib/fs.scandir/out/types/index.js +0 -2
  114. package/node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts +0 -2
  115. package/node_modules/@nodelib/fs.scandir/out/utils/fs.js +0 -19
  116. package/node_modules/@nodelib/fs.scandir/out/utils/index.d.ts +0 -2
  117. package/node_modules/@nodelib/fs.scandir/out/utils/index.js +0 -5
  118. package/node_modules/@nodelib/fs.scandir/package.json +0 -44
  119. package/node_modules/@nodelib/fs.stat/LICENSE +0 -21
  120. package/node_modules/@nodelib/fs.stat/README.md +0 -126
  121. package/node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts +0 -13
  122. package/node_modules/@nodelib/fs.stat/out/adapters/fs.js +0 -17
  123. package/node_modules/@nodelib/fs.stat/out/index.d.ts +0 -12
  124. package/node_modules/@nodelib/fs.stat/out/index.js +0 -26
  125. package/node_modules/@nodelib/fs.stat/out/providers/async.d.ts +0 -4
  126. package/node_modules/@nodelib/fs.stat/out/providers/async.js +0 -36
  127. package/node_modules/@nodelib/fs.stat/out/providers/sync.d.ts +0 -3
  128. package/node_modules/@nodelib/fs.stat/out/providers/sync.js +0 -23
  129. package/node_modules/@nodelib/fs.stat/out/settings.d.ts +0 -16
  130. package/node_modules/@nodelib/fs.stat/out/settings.js +0 -16
  131. package/node_modules/@nodelib/fs.stat/out/types/index.d.ts +0 -4
  132. package/node_modules/@nodelib/fs.stat/out/types/index.js +0 -2
  133. package/node_modules/@nodelib/fs.stat/package.json +0 -37
  134. package/node_modules/@nodelib/fs.walk/LICENSE +0 -21
  135. package/node_modules/@nodelib/fs.walk/README.md +0 -215
  136. package/node_modules/@nodelib/fs.walk/out/index.d.ts +0 -14
  137. package/node_modules/@nodelib/fs.walk/out/index.js +0 -34
  138. package/node_modules/@nodelib/fs.walk/out/providers/async.d.ts +0 -12
  139. package/node_modules/@nodelib/fs.walk/out/providers/async.js +0 -30
  140. package/node_modules/@nodelib/fs.walk/out/providers/index.d.ts +0 -4
  141. package/node_modules/@nodelib/fs.walk/out/providers/index.js +0 -9
  142. package/node_modules/@nodelib/fs.walk/out/providers/stream.d.ts +0 -12
  143. package/node_modules/@nodelib/fs.walk/out/providers/stream.js +0 -34
  144. package/node_modules/@nodelib/fs.walk/out/providers/sync.d.ts +0 -10
  145. package/node_modules/@nodelib/fs.walk/out/providers/sync.js +0 -14
  146. package/node_modules/@nodelib/fs.walk/out/readers/async.d.ts +0 -30
  147. package/node_modules/@nodelib/fs.walk/out/readers/async.js +0 -97
  148. package/node_modules/@nodelib/fs.walk/out/readers/common.d.ts +0 -7
  149. package/node_modules/@nodelib/fs.walk/out/readers/common.js +0 -31
  150. package/node_modules/@nodelib/fs.walk/out/readers/reader.d.ts +0 -6
  151. package/node_modules/@nodelib/fs.walk/out/readers/reader.js +0 -11
  152. package/node_modules/@nodelib/fs.walk/out/readers/sync.d.ts +0 -15
  153. package/node_modules/@nodelib/fs.walk/out/readers/sync.js +0 -59
  154. package/node_modules/@nodelib/fs.walk/out/settings.d.ts +0 -30
  155. package/node_modules/@nodelib/fs.walk/out/settings.js +0 -26
  156. package/node_modules/@nodelib/fs.walk/out/types/index.d.ts +0 -8
  157. package/node_modules/@nodelib/fs.walk/out/types/index.js +0 -2
  158. package/node_modules/@nodelib/fs.walk/package.json +0 -44
  159. package/node_modules/@ungap/structured-clone/.github/workflows/node.js.yml +0 -31
  160. package/node_modules/@ungap/structured-clone/LICENSE +0 -15
  161. package/node_modules/@ungap/structured-clone/README.md +0 -95
  162. package/node_modules/@ungap/structured-clone/cjs/deserialize.js +0 -78
  163. package/node_modules/@ungap/structured-clone/cjs/index.js +0 -27
  164. package/node_modules/@ungap/structured-clone/cjs/json.js +0 -24
  165. package/node_modules/@ungap/structured-clone/cjs/package.json +0 -1
  166. package/node_modules/@ungap/structured-clone/cjs/serialize.js +0 -160
  167. package/node_modules/@ungap/structured-clone/cjs/types.js +0 -22
  168. package/node_modules/@ungap/structured-clone/esm/deserialize.js +0 -79
  169. package/node_modules/@ungap/structured-clone/esm/index.js +0 -25
  170. package/node_modules/@ungap/structured-clone/esm/json.js +0 -21
  171. package/node_modules/@ungap/structured-clone/esm/serialize.js +0 -161
  172. package/node_modules/@ungap/structured-clone/esm/types.js +0 -11
  173. package/node_modules/@ungap/structured-clone/package.json +0 -53
  174. package/node_modules/@ungap/structured-clone/structured-json.js +0 -1
@@ -1,215 +0,0 @@
1
- # @nodelib/fs.walk
2
-
3
- > A library for efficiently walking a directory recursively.
4
-
5
- ## :bulb: Highlights
6
-
7
- * :moneybag: Returns useful information: `name`, `path`, `dirent` and `stats` (optional).
8
- * :rocket: On Node.js 10.10+ uses the mechanism without additional calls to determine the entry type for performance reasons. See [`old` and `modern` mode](https://github.com/nodelib/nodelib/blob/master/packages/fs/fs.scandir/README.md#old-and-modern-mode).
9
- * :gear: Built-in directories/files and error filtering system.
10
- * :link: Can safely work with broken symbolic links.
11
-
12
- ## Install
13
-
14
- ```console
15
- npm install @nodelib/fs.walk
16
- ```
17
-
18
- ## Usage
19
-
20
- ```ts
21
- import * as fsWalk from '@nodelib/fs.walk';
22
-
23
- fsWalk.walk('path', (error, entries) => { /* … */ });
24
- ```
25
-
26
- ## API
27
-
28
- ### .walk(path, [optionsOrSettings], callback)
29
-
30
- Reads the directory recursively and asynchronously. Requires a callback function.
31
-
32
- > :book: If you want to use the Promise API, use `util.promisify`.
33
-
34
- ```ts
35
- fsWalk.walk('path', (error, entries) => { /* … */ });
36
- fsWalk.walk('path', {}, (error, entries) => { /* … */ });
37
- fsWalk.walk('path', new fsWalk.Settings(), (error, entries) => { /* … */ });
38
- ```
39
-
40
- ### .walkStream(path, [optionsOrSettings])
41
-
42
- Reads the directory recursively and asynchronously. [Readable Stream](https://nodejs.org/dist/latest-v12.x/docs/api/stream.html#stream_readable_streams) is used as a provider.
43
-
44
- ```ts
45
- const stream = fsWalk.walkStream('path');
46
- const stream = fsWalk.walkStream('path', {});
47
- const stream = fsWalk.walkStream('path', new fsWalk.Settings());
48
- ```
49
-
50
- ### .walkSync(path, [optionsOrSettings])
51
-
52
- Reads the directory recursively and synchronously. Returns an array of entries.
53
-
54
- ```ts
55
- const entries = fsWalk.walkSync('path');
56
- const entries = fsWalk.walkSync('path', {});
57
- const entries = fsWalk.walkSync('path', new fsWalk.Settings());
58
- ```
59
-
60
- #### path
61
-
62
- * Required: `true`
63
- * Type: `string | Buffer | URL`
64
-
65
- A path to a file. If a URL is provided, it must use the `file:` protocol.
66
-
67
- #### optionsOrSettings
68
-
69
- * Required: `false`
70
- * Type: `Options | Settings`
71
- * Default: An instance of `Settings` class
72
-
73
- An [`Options`](#options) object or an instance of [`Settings`](#settings) class.
74
-
75
- > :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.
76
-
77
- ### Settings([options])
78
-
79
- A class of full settings of the package.
80
-
81
- ```ts
82
- const settings = new fsWalk.Settings({ followSymbolicLinks: true });
83
-
84
- const entries = fsWalk.walkSync('path', settings);
85
- ```
86
-
87
- ## Entry
88
-
89
- * `name` — The name of the entry (`unknown.txt`).
90
- * `path` — The path of the entry relative to call directory (`root/unknown.txt`).
91
- * `dirent` — An instance of [`fs.Dirent`](./src/types/index.ts) class.
92
- * [`stats`] — An instance of `fs.Stats` class.
93
-
94
- ## Options
95
-
96
- ### basePath
97
-
98
- * Type: `string`
99
- * Default: `undefined`
100
-
101
- By default, all paths are built relative to the root path. You can use this option to set custom root path.
102
-
103
- In the example below we read the files from the `root` directory, but in the results the root path will be `custom`.
104
-
105
- ```ts
106
- fsWalk.walkSync('root'); // → ['root/file.txt']
107
- fsWalk.walkSync('root', { basePath: 'custom' }); // → ['custom/file.txt']
108
- ```
109
-
110
- ### concurrency
111
-
112
- * Type: `number`
113
- * Default: `Infinity`
114
-
115
- The maximum number of concurrent calls to `fs.readdir`.
116
-
117
- > :book: The higher the number, the higher performance and the load on the File System. If you want to read in quiet mode, set the value to `4 * os.cpus().length` (4 is default size of [thread pool work scheduling](http://docs.libuv.org/en/v1.x/threadpool.html#thread-pool-work-scheduling)).
118
-
119
- ### deepFilter
120
-
121
- * Type: [`DeepFilterFunction`](./src/settings.ts)
122
- * Default: `undefined`
123
-
124
- A function that indicates whether the directory will be read deep or not.
125
-
126
- ```ts
127
- // Skip all directories that starts with `node_modules`
128
- const filter: DeepFilterFunction = (entry) => !entry.path.startsWith('node_modules');
129
- ```
130
-
131
- ### entryFilter
132
-
133
- * Type: [`EntryFilterFunction`](./src/settings.ts)
134
- * Default: `undefined`
135
-
136
- A function that indicates whether the entry will be included to results or not.
137
-
138
- ```ts
139
- // Exclude all `.js` files from results
140
- const filter: EntryFilterFunction = (entry) => !entry.name.endsWith('.js');
141
- ```
142
-
143
- ### errorFilter
144
-
145
- * Type: [`ErrorFilterFunction`](./src/settings.ts)
146
- * Default: `undefined`
147
-
148
- A function that allows you to skip errors that occur when reading directories.
149
-
150
- For example, you can skip `ENOENT` errors if required:
151
-
152
- ```ts
153
- // Skip all ENOENT errors
154
- const filter: ErrorFilterFunction = (error) => error.code == 'ENOENT';
155
- ```
156
-
157
- ### stats
158
-
159
- * Type: `boolean`
160
- * Default: `false`
161
-
162
- Adds an instance of `fs.Stats` class to the [`Entry`](#entry).
163
-
164
- > :book: Always use `fs.readdir` with additional `fs.lstat/fs.stat` calls to determine the entry type.
165
-
166
- ### followSymbolicLinks
167
-
168
- * Type: `boolean`
169
- * Default: `false`
170
-
171
- Follow symbolic links or not. Call `fs.stat` on symbolic link if `true`.
172
-
173
- ### `throwErrorOnBrokenSymbolicLink`
174
-
175
- * Type: `boolean`
176
- * Default: `true`
177
-
178
- Throw an error when symbolic link is broken if `true` or safely return `lstat` call if `false`.
179
-
180
- ### `pathSegmentSeparator`
181
-
182
- * Type: `string`
183
- * Default: `path.sep`
184
-
185
- 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.
186
-
187
- ### `fs`
188
-
189
- * Type: `FileSystemAdapter`
190
- * Default: A default FS methods
191
-
192
- 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.
193
-
194
- ```ts
195
- interface FileSystemAdapter {
196
- lstat: typeof fs.lstat;
197
- stat: typeof fs.stat;
198
- lstatSync: typeof fs.lstatSync;
199
- statSync: typeof fs.statSync;
200
- readdir: typeof fs.readdir;
201
- readdirSync: typeof fs.readdirSync;
202
- }
203
-
204
- const settings = new fsWalk.Settings({
205
- fs: { lstat: fakeLstat }
206
- });
207
- ```
208
-
209
- ## Changelog
210
-
211
- See the [Releases section of our GitHub project](https://github.com/nodelib/nodelib/releases) for changelog for each release version.
212
-
213
- ## License
214
-
215
- This software is released under the terms of the MIT license.
@@ -1,14 +0,0 @@
1
- /// <reference types="node" />
2
- import type { Readable } from 'stream';
3
- import type { Dirent, FileSystemAdapter } from '@nodelib/fs.scandir';
4
- import { AsyncCallback } from './providers/async';
5
- import Settings, { DeepFilterFunction, EntryFilterFunction, ErrorFilterFunction, Options } from './settings';
6
- import type { Entry } from './types';
7
- declare function walk(directory: string, callback: AsyncCallback): void;
8
- declare function walk(directory: string, optionsOrSettings: Options | Settings, callback: AsyncCallback): void;
9
- declare namespace walk {
10
- function __promisify__(directory: string, optionsOrSettings?: Options | Settings): Promise<Entry[]>;
11
- }
12
- declare function walkSync(directory: string, optionsOrSettings?: Options | Settings): Entry[];
13
- declare function walkStream(directory: string, optionsOrSettings?: Options | Settings): Readable;
14
- export { walk, walkSync, walkStream, Settings, AsyncCallback, Dirent, Entry, FileSystemAdapter, Options, DeepFilterFunction, EntryFilterFunction, ErrorFilterFunction };
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Settings = exports.walkStream = exports.walkSync = exports.walk = void 0;
4
- const async_1 = require("./providers/async");
5
- const stream_1 = require("./providers/stream");
6
- const sync_1 = require("./providers/sync");
7
- const settings_1 = require("./settings");
8
- exports.Settings = settings_1.default;
9
- function walk(directory, optionsOrSettingsOrCallback, callback) {
10
- if (typeof optionsOrSettingsOrCallback === 'function') {
11
- new async_1.default(directory, getSettings()).read(optionsOrSettingsOrCallback);
12
- return;
13
- }
14
- new async_1.default(directory, getSettings(optionsOrSettingsOrCallback)).read(callback);
15
- }
16
- exports.walk = walk;
17
- function walkSync(directory, optionsOrSettings) {
18
- const settings = getSettings(optionsOrSettings);
19
- const provider = new sync_1.default(directory, settings);
20
- return provider.read();
21
- }
22
- exports.walkSync = walkSync;
23
- function walkStream(directory, optionsOrSettings) {
24
- const settings = getSettings(optionsOrSettings);
25
- const provider = new stream_1.default(directory, settings);
26
- return provider.read();
27
- }
28
- exports.walkStream = walkStream;
29
- function getSettings(settingsOrOptions = {}) {
30
- if (settingsOrOptions instanceof settings_1.default) {
31
- return settingsOrOptions;
32
- }
33
- return new settings_1.default(settingsOrOptions);
34
- }
@@ -1,12 +0,0 @@
1
- import AsyncReader from '../readers/async';
2
- import type Settings from '../settings';
3
- import type { Entry, Errno } from '../types';
4
- export declare type AsyncCallback = (error: Errno, entries: Entry[]) => void;
5
- export default class AsyncProvider {
6
- private readonly _root;
7
- private readonly _settings;
8
- protected readonly _reader: AsyncReader;
9
- private readonly _storage;
10
- constructor(_root: string, _settings: Settings);
11
- read(callback: AsyncCallback): void;
12
- }
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const async_1 = require("../readers/async");
4
- class AsyncProvider {
5
- constructor(_root, _settings) {
6
- this._root = _root;
7
- this._settings = _settings;
8
- this._reader = new async_1.default(this._root, this._settings);
9
- this._storage = [];
10
- }
11
- read(callback) {
12
- this._reader.onError((error) => {
13
- callFailureCallback(callback, error);
14
- });
15
- this._reader.onEntry((entry) => {
16
- this._storage.push(entry);
17
- });
18
- this._reader.onEnd(() => {
19
- callSuccessCallback(callback, this._storage);
20
- });
21
- this._reader.read();
22
- }
23
- }
24
- exports.default = AsyncProvider;
25
- function callFailureCallback(callback, error) {
26
- callback(error);
27
- }
28
- function callSuccessCallback(callback, entries) {
29
- callback(null, entries);
30
- }
@@ -1,4 +0,0 @@
1
- import AsyncProvider from './async';
2
- import StreamProvider from './stream';
3
- import SyncProvider from './sync';
4
- export { AsyncProvider, StreamProvider, SyncProvider };
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SyncProvider = exports.StreamProvider = exports.AsyncProvider = void 0;
4
- const async_1 = require("./async");
5
- exports.AsyncProvider = async_1.default;
6
- const stream_1 = require("./stream");
7
- exports.StreamProvider = stream_1.default;
8
- const sync_1 = require("./sync");
9
- exports.SyncProvider = sync_1.default;
@@ -1,12 +0,0 @@
1
- /// <reference types="node" />
2
- import { Readable } from 'stream';
3
- import AsyncReader from '../readers/async';
4
- import type Settings from '../settings';
5
- export default class StreamProvider {
6
- private readonly _root;
7
- private readonly _settings;
8
- protected readonly _reader: AsyncReader;
9
- protected readonly _stream: Readable;
10
- constructor(_root: string, _settings: Settings);
11
- read(): Readable;
12
- }
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const stream_1 = require("stream");
4
- const async_1 = require("../readers/async");
5
- class StreamProvider {
6
- constructor(_root, _settings) {
7
- this._root = _root;
8
- this._settings = _settings;
9
- this._reader = new async_1.default(this._root, this._settings);
10
- this._stream = new stream_1.Readable({
11
- objectMode: true,
12
- read: () => { },
13
- destroy: () => {
14
- if (!this._reader.isDestroyed) {
15
- this._reader.destroy();
16
- }
17
- }
18
- });
19
- }
20
- read() {
21
- this._reader.onError((error) => {
22
- this._stream.emit('error', error);
23
- });
24
- this._reader.onEntry((entry) => {
25
- this._stream.push(entry);
26
- });
27
- this._reader.onEnd(() => {
28
- this._stream.push(null);
29
- });
30
- this._reader.read();
31
- return this._stream;
32
- }
33
- }
34
- exports.default = StreamProvider;
@@ -1,10 +0,0 @@
1
- import SyncReader from '../readers/sync';
2
- import type Settings from '../settings';
3
- import type { Entry } from '../types';
4
- export default class SyncProvider {
5
- private readonly _root;
6
- private readonly _settings;
7
- protected readonly _reader: SyncReader;
8
- constructor(_root: string, _settings: Settings);
9
- read(): Entry[];
10
- }
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const sync_1 = require("../readers/sync");
4
- class SyncProvider {
5
- constructor(_root, _settings) {
6
- this._root = _root;
7
- this._settings = _settings;
8
- this._reader = new sync_1.default(this._root, this._settings);
9
- }
10
- read() {
11
- return this._reader.read();
12
- }
13
- }
14
- exports.default = SyncProvider;
@@ -1,30 +0,0 @@
1
- /// <reference types="node" />
2
- import { EventEmitter } from 'events';
3
- import * as fsScandir from '@nodelib/fs.scandir';
4
- import type Settings from '../settings';
5
- import type { Entry, Errno } from '../types';
6
- import Reader from './reader';
7
- declare type EntryEventCallback = (entry: Entry) => void;
8
- declare type ErrorEventCallback = (error: Errno) => void;
9
- declare type EndEventCallback = () => void;
10
- export default class AsyncReader extends Reader {
11
- protected readonly _settings: Settings;
12
- protected readonly _scandir: typeof fsScandir.scandir;
13
- protected readonly _emitter: EventEmitter;
14
- private readonly _queue;
15
- private _isFatalError;
16
- private _isDestroyed;
17
- constructor(_root: string, _settings: Settings);
18
- read(): EventEmitter;
19
- get isDestroyed(): boolean;
20
- destroy(): void;
21
- onEntry(callback: EntryEventCallback): void;
22
- onError(callback: ErrorEventCallback): void;
23
- onEnd(callback: EndEventCallback): void;
24
- private _pushToQueue;
25
- private _worker;
26
- private _handleError;
27
- private _handleEntry;
28
- private _emitEntry;
29
- }
30
- export {};
@@ -1,97 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const events_1 = require("events");
4
- const fsScandir = require("@nodelib/fs.scandir");
5
- const fastq = require("fastq");
6
- const common = require("./common");
7
- const reader_1 = require("./reader");
8
- class AsyncReader extends reader_1.default {
9
- constructor(_root, _settings) {
10
- super(_root, _settings);
11
- this._settings = _settings;
12
- this._scandir = fsScandir.scandir;
13
- this._emitter = new events_1.EventEmitter();
14
- this._queue = fastq(this._worker.bind(this), this._settings.concurrency);
15
- this._isFatalError = false;
16
- this._isDestroyed = false;
17
- this._queue.drain = () => {
18
- if (!this._isFatalError) {
19
- this._emitter.emit('end');
20
- }
21
- };
22
- }
23
- read() {
24
- this._isFatalError = false;
25
- this._isDestroyed = false;
26
- setImmediate(() => {
27
- this._pushToQueue(this._root, this._settings.basePath);
28
- });
29
- return this._emitter;
30
- }
31
- get isDestroyed() {
32
- return this._isDestroyed;
33
- }
34
- destroy() {
35
- if (this._isDestroyed) {
36
- throw new Error('The reader is already destroyed');
37
- }
38
- this._isDestroyed = true;
39
- this._queue.killAndDrain();
40
- }
41
- onEntry(callback) {
42
- this._emitter.on('entry', callback);
43
- }
44
- onError(callback) {
45
- this._emitter.once('error', callback);
46
- }
47
- onEnd(callback) {
48
- this._emitter.once('end', callback);
49
- }
50
- _pushToQueue(directory, base) {
51
- const queueItem = { directory, base };
52
- this._queue.push(queueItem, (error) => {
53
- if (error !== null) {
54
- this._handleError(error);
55
- }
56
- });
57
- }
58
- _worker(item, done) {
59
- this._scandir(item.directory, this._settings.fsScandirSettings, (error, entries) => {
60
- if (error !== null) {
61
- done(error, undefined);
62
- return;
63
- }
64
- for (const entry of entries) {
65
- this._handleEntry(entry, item.base);
66
- }
67
- done(null, undefined);
68
- });
69
- }
70
- _handleError(error) {
71
- if (this._isDestroyed || !common.isFatalError(this._settings, error)) {
72
- return;
73
- }
74
- this._isFatalError = true;
75
- this._isDestroyed = true;
76
- this._emitter.emit('error', error);
77
- }
78
- _handleEntry(entry, base) {
79
- if (this._isDestroyed || this._isFatalError) {
80
- return;
81
- }
82
- const fullpath = entry.path;
83
- if (base !== undefined) {
84
- entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
85
- }
86
- if (common.isAppliedFilter(this._settings.entryFilter, entry)) {
87
- this._emitEntry(entry);
88
- }
89
- if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) {
90
- this._pushToQueue(fullpath, base === undefined ? undefined : entry.path);
91
- }
92
- }
93
- _emitEntry(entry) {
94
- this._emitter.emit('entry', entry);
95
- }
96
- }
97
- exports.default = AsyncReader;
@@ -1,7 +0,0 @@
1
- import type { FilterFunction } from '../settings';
2
- import type Settings from '../settings';
3
- import type { Errno } from '../types';
4
- export declare function isFatalError(settings: Settings, error: Errno): boolean;
5
- export declare function isAppliedFilter<T>(filter: FilterFunction<T> | null, value: T): boolean;
6
- export declare function replacePathSegmentSeparator(filepath: string, separator: string): string;
7
- export declare function joinPathSegments(a: string, b: string, separator: string): string;
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.joinPathSegments = exports.replacePathSegmentSeparator = exports.isAppliedFilter = exports.isFatalError = void 0;
4
- function isFatalError(settings, error) {
5
- if (settings.errorFilter === null) {
6
- return true;
7
- }
8
- return !settings.errorFilter(error);
9
- }
10
- exports.isFatalError = isFatalError;
11
- function isAppliedFilter(filter, value) {
12
- return filter === null || filter(value);
13
- }
14
- exports.isAppliedFilter = isAppliedFilter;
15
- function replacePathSegmentSeparator(filepath, separator) {
16
- return filepath.split(/[/\\]/).join(separator);
17
- }
18
- exports.replacePathSegmentSeparator = replacePathSegmentSeparator;
19
- function joinPathSegments(a, b, separator) {
20
- if (a === '') {
21
- return b;
22
- }
23
- /**
24
- * The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`).
25
- */
26
- if (a.endsWith(separator)) {
27
- return a + b;
28
- }
29
- return a + separator + b;
30
- }
31
- exports.joinPathSegments = joinPathSegments;
@@ -1,6 +0,0 @@
1
- import type Settings from '../settings';
2
- export default class Reader {
3
- protected readonly _root: string;
4
- protected readonly _settings: Settings;
5
- constructor(_root: string, _settings: Settings);
6
- }
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const common = require("./common");
4
- class Reader {
5
- constructor(_root, _settings) {
6
- this._root = _root;
7
- this._settings = _settings;
8
- this._root = common.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator);
9
- }
10
- }
11
- exports.default = Reader;
@@ -1,15 +0,0 @@
1
- import * as fsScandir from '@nodelib/fs.scandir';
2
- import type { Entry } from '../types';
3
- import Reader from './reader';
4
- export default class SyncReader extends Reader {
5
- protected readonly _scandir: typeof fsScandir.scandirSync;
6
- private readonly _storage;
7
- private readonly _queue;
8
- read(): Entry[];
9
- private _pushToQueue;
10
- private _handleQueue;
11
- private _handleDirectory;
12
- private _handleError;
13
- private _handleEntry;
14
- private _pushToStorage;
15
- }
@@ -1,59 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const fsScandir = require("@nodelib/fs.scandir");
4
- const common = require("./common");
5
- const reader_1 = require("./reader");
6
- class SyncReader extends reader_1.default {
7
- constructor() {
8
- super(...arguments);
9
- this._scandir = fsScandir.scandirSync;
10
- this._storage = [];
11
- this._queue = new Set();
12
- }
13
- read() {
14
- this._pushToQueue(this._root, this._settings.basePath);
15
- this._handleQueue();
16
- return this._storage;
17
- }
18
- _pushToQueue(directory, base) {
19
- this._queue.add({ directory, base });
20
- }
21
- _handleQueue() {
22
- for (const item of this._queue.values()) {
23
- this._handleDirectory(item.directory, item.base);
24
- }
25
- }
26
- _handleDirectory(directory, base) {
27
- try {
28
- const entries = this._scandir(directory, this._settings.fsScandirSettings);
29
- for (const entry of entries) {
30
- this._handleEntry(entry, base);
31
- }
32
- }
33
- catch (error) {
34
- this._handleError(error);
35
- }
36
- }
37
- _handleError(error) {
38
- if (!common.isFatalError(this._settings, error)) {
39
- return;
40
- }
41
- throw error;
42
- }
43
- _handleEntry(entry, base) {
44
- const fullpath = entry.path;
45
- if (base !== undefined) {
46
- entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
47
- }
48
- if (common.isAppliedFilter(this._settings.entryFilter, entry)) {
49
- this._pushToStorage(entry);
50
- }
51
- if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) {
52
- this._pushToQueue(fullpath, base === undefined ? undefined : entry.path);
53
- }
54
- }
55
- _pushToStorage(entry) {
56
- this._storage.push(entry);
57
- }
58
- }
59
- exports.default = SyncReader;