@modern-js/utils 1.3.8-canary.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (186) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/compiled/address/index.js +1 -0
  3. package/compiled/address/lib/address.d.ts +28 -0
  4. package/compiled/address/package.json +1 -0
  5. package/compiled/browserslist/index.js +1 -1
  6. package/compiled/dotenv/index.js +1 -0
  7. package/compiled/dotenv/license +23 -0
  8. package/compiled/dotenv/package.json +1 -0
  9. package/compiled/dotenv/types/index.d.ts +59 -0
  10. package/compiled/dotenv-expand/index.d.ts +15 -0
  11. package/compiled/dotenv-expand/index.js +1 -0
  12. package/compiled/dotenv-expand/license +24 -0
  13. package/compiled/dotenv-expand/package.json +1 -0
  14. package/compiled/fast-glob/@nodelib/fs.scandir/out/adapters/fs.d.ts +20 -0
  15. package/compiled/fast-glob/@nodelib/fs.scandir/out/index.d.ts +12 -0
  16. package/compiled/fast-glob/@nodelib/fs.scandir/out/providers/async.d.ts +7 -0
  17. package/compiled/fast-glob/@nodelib/fs.scandir/out/settings.d.ts +20 -0
  18. package/compiled/fast-glob/@nodelib/fs.scandir/out/types/index.d.ts +20 -0
  19. package/compiled/fast-glob/@nodelib/fs.stat/out/adapters/fs.d.ts +13 -0
  20. package/compiled/fast-glob/@nodelib/fs.stat/out/index.d.ts +12 -0
  21. package/compiled/fast-glob/@nodelib/fs.stat/out/providers/async.d.ts +4 -0
  22. package/compiled/fast-glob/@nodelib/fs.stat/out/settings.d.ts +16 -0
  23. package/compiled/fast-glob/@nodelib/fs.stat/out/types/index.d.ts +4 -0
  24. package/compiled/fast-glob/@nodelib/fs.walk/out/index.d.ts +14 -0
  25. package/compiled/fast-glob/@nodelib/fs.walk/out/providers/async.d.ts +12 -0
  26. package/compiled/fast-glob/@nodelib/fs.walk/out/readers/async.d.ts +30 -0
  27. package/compiled/fast-glob/@nodelib/fs.walk/out/readers/reader.d.ts +6 -0
  28. package/compiled/fast-glob/@nodelib/fs.walk/out/settings.d.ts +30 -0
  29. package/compiled/fast-glob/@nodelib/fs.walk/out/types/index.d.ts +8 -0
  30. package/compiled/fast-glob/index.js +37 -0
  31. package/compiled/fast-glob/license +21 -0
  32. package/compiled/fast-glob/out/index.d.ts +27 -0
  33. package/compiled/fast-glob/out/managers/tasks.d.ts +22 -0
  34. package/compiled/fast-glob/out/settings.d.ts +164 -0
  35. package/compiled/fast-glob/out/types/index.d.ts +31 -0
  36. package/compiled/fast-glob/package.json +1 -0
  37. package/compiled/globby/@nodelib/fs.scandir/out/adapters/fs.d.ts +20 -0
  38. package/compiled/globby/@nodelib/fs.scandir/out/index.d.ts +12 -0
  39. package/compiled/globby/@nodelib/fs.scandir/out/providers/async.d.ts +7 -0
  40. package/compiled/globby/@nodelib/fs.scandir/out/settings.d.ts +20 -0
  41. package/compiled/globby/@nodelib/fs.scandir/out/types/index.d.ts +20 -0
  42. package/compiled/globby/@nodelib/fs.stat/out/adapters/fs.d.ts +13 -0
  43. package/compiled/globby/@nodelib/fs.stat/out/index.d.ts +12 -0
  44. package/compiled/globby/@nodelib/fs.stat/out/providers/async.d.ts +4 -0
  45. package/compiled/globby/@nodelib/fs.stat/out/settings.d.ts +16 -0
  46. package/compiled/globby/@nodelib/fs.stat/out/types/index.d.ts +4 -0
  47. package/compiled/globby/@nodelib/fs.walk/out/index.d.ts +14 -0
  48. package/compiled/globby/@nodelib/fs.walk/out/providers/async.d.ts +12 -0
  49. package/compiled/globby/@nodelib/fs.walk/out/readers/async.d.ts +30 -0
  50. package/compiled/globby/@nodelib/fs.walk/out/readers/reader.d.ts +6 -0
  51. package/compiled/globby/@nodelib/fs.walk/out/settings.d.ts +30 -0
  52. package/compiled/globby/@nodelib/fs.walk/out/types/index.d.ts +8 -0
  53. package/compiled/globby/fast-glob/index.d.ts +27 -0
  54. package/compiled/globby/fast-glob/managers/tasks.d.ts +22 -0
  55. package/compiled/globby/fast-glob/settings.d.ts +164 -0
  56. package/compiled/globby/fast-glob/types/index.d.ts +31 -0
  57. package/compiled/globby/index.d.ts +186 -0
  58. package/compiled/globby/index.js +1 -0
  59. package/compiled/globby/license +9 -0
  60. package/compiled/globby/package.json +1 -0
  61. package/compiled/inquirer/index.d.ts +997 -0
  62. package/compiled/inquirer/index.js +9 -0
  63. package/compiled/inquirer/lib/objects/choice.d.ts +65 -0
  64. package/compiled/inquirer/lib/objects/choices.d.ts +206 -0
  65. package/compiled/inquirer/lib/objects/separator.d.ts +37 -0
  66. package/compiled/inquirer/lib/ui/baseUI.d.ts +37 -0
  67. package/compiled/inquirer/lib/ui/bottom-bar.d.ts +65 -0
  68. package/compiled/inquirer/lib/ui/prompt.d.ts +104 -0
  69. package/compiled/inquirer/license +22 -0
  70. package/compiled/inquirer/package.json +1 -0
  71. package/compiled/inquirer/through/index.d.ts +25 -0
  72. package/compiled/json5/index.js +1 -0
  73. package/compiled/json5/lib/index.d.ts +4 -0
  74. package/compiled/json5/lib/parse.d.ts +15 -0
  75. package/compiled/json5/lib/stringify.d.ts +89 -0
  76. package/compiled/json5/package.json +1 -0
  77. package/compiled/mime-types/index.d.ts +14 -0
  78. package/compiled/mime-types/index.js +14 -0
  79. package/compiled/mime-types/license +23 -0
  80. package/compiled/mime-types/package.json +1 -0
  81. package/compiled/minimist/index.d.ts +95 -0
  82. package/compiled/minimist/index.js +1 -0
  83. package/compiled/minimist/license +18 -0
  84. package/compiled/minimist/package.json +1 -0
  85. package/compiled/ora/cli-spinners/index.d.ts +125 -0
  86. package/compiled/ora/index.d.ts +277 -0
  87. package/compiled/ora/index.js +3 -0
  88. package/compiled/ora/license +9 -0
  89. package/compiled/ora/package.json +1 -0
  90. package/compiled/slash/index.d.ts +25 -0
  91. package/compiled/slash/index.js +1 -0
  92. package/compiled/slash/license +9 -0
  93. package/compiled/slash/package.json +1 -0
  94. package/compiled/url-join/index.d.ts +17 -0
  95. package/compiled/url-join/index.js +1 -0
  96. package/compiled/url-join/license +21 -0
  97. package/compiled/url-join/package.json +1 -0
  98. package/dist/analyzeProject.d.ts +1 -0
  99. package/dist/analyzeProject.js +40 -0
  100. package/dist/compiled.d.ts +33 -17
  101. package/dist/compiled.js +57 -21
  102. package/dist/constants.d.ts +1 -1
  103. package/dist/constants.js +1 -1
  104. package/dist/index.d.ts +2 -2
  105. package/dist/index.js +2 -2
  106. package/dist/prettyInstructions.js +3 -3
  107. package/dist/{ssrHelpers.d.ts → ssr.d.ts} +3 -0
  108. package/dist/{ssrHelpers.js → ssr.js} +0 -0
  109. package/dist/storage.js +1 -1
  110. package/package.json +12 -30
  111. package/dist/getCacheIdentifier.d.ts +0 -7
  112. package/dist/getCacheIdentifier.js +0 -24
  113. package/dist/js/modern/monorepo.js +0 -83
  114. package/dist/js/node/monorepo.js +0 -116
  115. package/dist/js/treeshaking/monorepo.js +0 -96
  116. package/dist/pkgUp.d.ts +0 -2
  117. package/dist/pkgUp.js +0 -8
  118. package/dist/types/FileSizeReporter.d.ts +0 -16
  119. package/dist/types/alias.d.ts +0 -21
  120. package/dist/types/applyOptionsChain.d.ts +0 -6
  121. package/dist/types/clearConsole.d.ts +0 -1
  122. package/dist/types/compatRequire.d.ts +0 -8
  123. package/dist/types/compiled.d.ts +0 -17
  124. package/dist/types/constants.d.ts +0 -222
  125. package/dist/types/debug.d.ts +0 -6
  126. package/dist/types/emptyDir.d.ts +0 -1
  127. package/dist/types/ensureAbsolutePath.d.ts +0 -7
  128. package/dist/types/findExists.d.ts +0 -6
  129. package/dist/types/format.d.ts +0 -16
  130. package/dist/types/generateMetaTags.d.ts +0 -16
  131. package/dist/types/getBrowserslist.d.ts +0 -2
  132. package/dist/types/getCacheIdentifier.d.ts +0 -7
  133. package/dist/types/getEntryOptions.d.ts +0 -1
  134. package/dist/types/getPackageManager.d.ts +0 -1
  135. package/dist/types/getPort.d.ts +0 -7
  136. package/dist/types/getServerConfig.d.ts +0 -1
  137. package/dist/types/import.d.ts +0 -5
  138. package/dist/types/index.d.ts +0 -32
  139. package/dist/types/is/index.d.ts +0 -34
  140. package/dist/types/is/node-env.d.ts +0 -4
  141. package/dist/types/is/platform.d.ts +0 -2
  142. package/dist/types/is/type.d.ts +0 -8
  143. package/dist/types/logger.d.ts +0 -63
  144. package/dist/types/monorepo.d.ts +0 -11
  145. package/dist/types/nodeEnv.d.ts +0 -3
  146. package/dist/types/path.d.ts +0 -3
  147. package/dist/types/prettyInstructions.d.ts +0 -6
  148. package/dist/types/printBuildError.d.ts +0 -8
  149. package/dist/types/readTsConfig.d.ts +0 -2
  150. package/dist/types/removeSlash.d.ts +0 -3
  151. package/dist/types/runtimeExports.d.ts +0 -4
  152. package/dist/types/wait.d.ts +0 -2
  153. package/dist/types/watch.d.ts +0 -8
  154. package/modern.config.js +0 -6
  155. package/tests/.eslintrc.js +0 -6
  156. package/tests/__snapshots__/prettyInstructions.test.ts.snap +0 -19
  157. package/tests/applyOptionsChain.test.ts +0 -100
  158. package/tests/compatRequire.test.ts +0 -32
  159. package/tests/debug.test.ts +0 -25
  160. package/tests/ensureAbsolutePath.test.ts +0 -16
  161. package/tests/findExists.test.ts +0 -22
  162. package/tests/fixtures/browserlist/develop/package.json +0 -11
  163. package/tests/fixtures/browserlist/dotfile/.browserslistrc +0 -3
  164. package/tests/fixtures/browserlist/pkg/package.json +0 -7
  165. package/tests/fixtures/compat-require/cjs.js +0 -1
  166. package/tests/fixtures/compat-require/empty.js +0 -1
  167. package/tests/fixtures/compat-require/esm.js +0 -5
  168. package/tests/fixtures/compat-require/foo.js +0 -3
  169. package/tests/fixtures/file-exists/a.ejs +0 -0
  170. package/tests/fixtures/file-exists/a.js/.gitkeep +0 -0
  171. package/tests/fixtures/file-exists/a.mjs +0 -0
  172. package/tests/fixtures/file-exists/a.ts +0 -0
  173. package/tests/format.test.ts +0 -60
  174. package/tests/generateMetaTags.test.ts +0 -19
  175. package/tests/getBrowserslist.test.ts +0 -32
  176. package/tests/getCacheIdentifier.test.ts +0 -37
  177. package/tests/getEntryOptions.test.ts +0 -53
  178. package/tests/index.test.ts +0 -18
  179. package/tests/is.test.ts +0 -27
  180. package/tests/isPlatform.test.ts +0 -19
  181. package/tests/isType.test.ts +0 -85
  182. package/tests/logger.test.ts +0 -53
  183. package/tests/prettyInstructions.test.ts +0 -139
  184. package/tests/removeSlash.test.ts +0 -19
  185. package/tests/tsconfig.json +0 -11
  186. package/tests/wait.ts +0 -38
@@ -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,27 @@
1
+ /// <reference types="node" />
2
+ import * as taskManager from './managers/tasks';
3
+ import { Options as OptionsInternal } from './settings';
4
+ import { Entry as EntryInternal, FileSystemAdapter as FileSystemAdapterInternal, Pattern as PatternInternal } from './types';
5
+ declare type EntryObjectModePredicate = {
6
+ [TKey in keyof Pick<OptionsInternal, 'objectMode'>]-?: true;
7
+ };
8
+ declare type EntryStatsPredicate = {
9
+ [TKey in keyof Pick<OptionsInternal, 'stats'>]-?: true;
10
+ };
11
+ declare type EntryObjectPredicate = EntryObjectModePredicate | EntryStatsPredicate;
12
+ declare function FastGlob(source: PatternInternal | PatternInternal[], options: OptionsInternal & EntryObjectPredicate): Promise<EntryInternal[]>;
13
+ declare function FastGlob(source: PatternInternal | PatternInternal[], options?: OptionsInternal): Promise<string[]>;
14
+ declare namespace FastGlob {
15
+ type Options = OptionsInternal;
16
+ type Entry = EntryInternal;
17
+ type Task = taskManager.Task;
18
+ type Pattern = PatternInternal;
19
+ type FileSystemAdapter = FileSystemAdapterInternal;
20
+ function sync(source: PatternInternal | PatternInternal[], options: OptionsInternal & EntryObjectPredicate): EntryInternal[];
21
+ function sync(source: PatternInternal | PatternInternal[], options?: OptionsInternal): string[];
22
+ function stream(source: PatternInternal | PatternInternal[], options?: OptionsInternal): NodeJS.ReadableStream;
23
+ function generateTasks(source: PatternInternal | PatternInternal[], options?: OptionsInternal): Task[];
24
+ function isDynamicPattern(source: PatternInternal, options?: OptionsInternal): boolean;
25
+ function escapePath(source: PatternInternal): PatternInternal;
26
+ }
27
+ export = FastGlob;
@@ -0,0 +1,22 @@
1
+ import Settings from '../settings';
2
+ import { Pattern, PatternsGroup } from '../types';
3
+ export declare type Task = {
4
+ base: string;
5
+ dynamic: boolean;
6
+ patterns: Pattern[];
7
+ positive: Pattern[];
8
+ negative: Pattern[];
9
+ };
10
+ export declare function generate(patterns: Pattern[], settings: Settings): Task[];
11
+ /**
12
+ * Returns tasks grouped by basic pattern directories.
13
+ *
14
+ * Patterns that can be found inside (`./`) and outside (`../`) the current directory are handled separately.
15
+ * This is necessary because directory traversal starts at the base directory and goes deeper.
16
+ */
17
+ export declare function convertPatternsToTasks(positive: Pattern[], negative: Pattern[], dynamic: boolean): Task[];
18
+ export declare function getPositivePatterns(patterns: Pattern[]): Pattern[];
19
+ export declare function getNegativePatternsAsPositive(patterns: Pattern[], ignore: Pattern[]): Pattern[];
20
+ export declare function groupPatternsByBaseDirectory(patterns: Pattern[]): PatternsGroup;
21
+ export declare function convertPatternGroupsToTasks(positive: PatternsGroup, negative: Pattern[], dynamic: boolean): Task[];
22
+ export declare function convertPatternGroupToTask(base: string, positive: Pattern[], negative: Pattern[], dynamic: boolean): Task;
@@ -0,0 +1,164 @@
1
+ import { FileSystemAdapter, Pattern } from './types';
2
+ export declare const DEFAULT_FILE_SYSTEM_ADAPTER: FileSystemAdapter;
3
+ export declare type Options = {
4
+ /**
5
+ * Return the absolute path for entries.
6
+ *
7
+ * @default false
8
+ */
9
+ absolute?: boolean;
10
+ /**
11
+ * If set to `true`, then patterns without slashes will be matched against
12
+ * the basename of the path if it contains slashes.
13
+ *
14
+ * @default false
15
+ */
16
+ baseNameMatch?: boolean;
17
+ /**
18
+ * Enables Bash-like brace expansion.
19
+ *
20
+ * @default true
21
+ */
22
+ braceExpansion?: boolean;
23
+ /**
24
+ * Enables a case-sensitive mode for matching files.
25
+ *
26
+ * @default true
27
+ */
28
+ caseSensitiveMatch?: boolean;
29
+ /**
30
+ * Specifies the maximum number of concurrent requests from a reader to read
31
+ * directories.
32
+ *
33
+ * @default os.cpus().length
34
+ */
35
+ concurrency?: number;
36
+ /**
37
+ * The current working directory in which to search.
38
+ *
39
+ * @default process.cwd()
40
+ */
41
+ cwd?: string;
42
+ /**
43
+ * Specifies the maximum depth of a read directory relative to the start
44
+ * directory.
45
+ *
46
+ * @default Infinity
47
+ */
48
+ deep?: number;
49
+ /**
50
+ * Allow patterns to match entries that begin with a period (`.`).
51
+ *
52
+ * @default false
53
+ */
54
+ dot?: boolean;
55
+ /**
56
+ * Enables Bash-like `extglob` functionality.
57
+ *
58
+ * @default true
59
+ */
60
+ extglob?: boolean;
61
+ /**
62
+ * Indicates whether to traverse descendants of symbolic link directories.
63
+ *
64
+ * @default true
65
+ */
66
+ followSymbolicLinks?: boolean;
67
+ /**
68
+ * Custom implementation of methods for working with the file system.
69
+ *
70
+ * @default fs.*
71
+ */
72
+ fs?: Partial<FileSystemAdapter>;
73
+ /**
74
+ * Enables recursively repeats a pattern containing `**`.
75
+ * If `false`, `**` behaves exactly like `*`.
76
+ *
77
+ * @default true
78
+ */
79
+ globstar?: boolean;
80
+ /**
81
+ * An array of glob patterns to exclude matches.
82
+ * This is an alternative way to use negative patterns.
83
+ *
84
+ * @default []
85
+ */
86
+ ignore?: Pattern[];
87
+ /**
88
+ * Mark the directory path with the final slash.
89
+ *
90
+ * @default false
91
+ */
92
+ markDirectories?: boolean;
93
+ /**
94
+ * Returns objects (instead of strings) describing entries.
95
+ *
96
+ * @default false
97
+ */
98
+ objectMode?: boolean;
99
+ /**
100
+ * Return only directories.
101
+ *
102
+ * @default false
103
+ */
104
+ onlyDirectories?: boolean;
105
+ /**
106
+ * Return only files.
107
+ *
108
+ * @default true
109
+ */
110
+ onlyFiles?: boolean;
111
+ /**
112
+ * Enables an object mode (`objectMode`) with an additional `stats` field.
113
+ *
114
+ * @default false
115
+ */
116
+ stats?: boolean;
117
+ /**
118
+ * By default this package suppress only `ENOENT` errors.
119
+ * Set to `true` to suppress any error.
120
+ *
121
+ * @default false
122
+ */
123
+ suppressErrors?: boolean;
124
+ /**
125
+ * Throw an error when symbolic link is broken if `true` or safely
126
+ * return `lstat` call if `false`.
127
+ *
128
+ * @default false
129
+ */
130
+ throwErrorOnBrokenSymbolicLink?: boolean;
131
+ /**
132
+ * Ensures that the returned entries are unique.
133
+ *
134
+ * @default true
135
+ */
136
+ unique?: boolean;
137
+ };
138
+ export default class Settings {
139
+ private readonly _options;
140
+ readonly absolute: boolean;
141
+ readonly baseNameMatch: boolean;
142
+ readonly braceExpansion: boolean;
143
+ readonly caseSensitiveMatch: boolean;
144
+ readonly concurrency: number;
145
+ readonly cwd: string;
146
+ readonly deep: number;
147
+ readonly dot: boolean;
148
+ readonly extglob: boolean;
149
+ readonly followSymbolicLinks: boolean;
150
+ readonly fs: FileSystemAdapter;
151
+ readonly globstar: boolean;
152
+ readonly ignore: Pattern[];
153
+ readonly markDirectories: boolean;
154
+ readonly objectMode: boolean;
155
+ readonly onlyDirectories: boolean;
156
+ readonly onlyFiles: boolean;
157
+ readonly stats: boolean;
158
+ readonly suppressErrors: boolean;
159
+ readonly throwErrorOnBrokenSymbolicLink: boolean;
160
+ readonly unique: boolean;
161
+ constructor(_options?: Options);
162
+ private _getValue;
163
+ private _getFileSystemMethods;
164
+ }
@@ -0,0 +1,31 @@
1
+ /// <reference types="node" />
2
+ import * as fsWalk from '../../@nodelib/fs.walk';
3
+ export declare type ErrnoException = NodeJS.ErrnoException;
4
+ export declare type Entry = fsWalk.Entry;
5
+ export declare type EntryItem = string | Entry;
6
+ export declare type Pattern = string;
7
+ export declare type PatternRe = RegExp;
8
+ export declare type PatternsGroup = Record<string, Pattern[]>;
9
+ export declare type ReaderOptions = fsWalk.Options & {
10
+ transform(entry: Entry): EntryItem;
11
+ deepFilter: DeepFilterFunction;
12
+ entryFilter: EntryFilterFunction;
13
+ errorFilter: ErrorFilterFunction;
14
+ fs: FileSystemAdapter;
15
+ stats: boolean;
16
+ };
17
+ export declare type ErrorFilterFunction = fsWalk.ErrorFilterFunction;
18
+ export declare type EntryFilterFunction = fsWalk.EntryFilterFunction;
19
+ export declare type DeepFilterFunction = fsWalk.DeepFilterFunction;
20
+ export declare type EntryTransformerFunction = (entry: Entry) => EntryItem;
21
+ export declare type MicromatchOptions = {
22
+ dot?: boolean;
23
+ matchBase?: boolean;
24
+ nobrace?: boolean;
25
+ nocase?: boolean;
26
+ noext?: boolean;
27
+ noglobstar?: boolean;
28
+ posix?: boolean;
29
+ strictSlashes?: boolean;
30
+ };
31
+ export declare type FileSystemAdapter = fsWalk.FileSystemAdapter;
@@ -0,0 +1 @@
1
+ {"name":"fast-glob","author":{"name":"Denis Malinochkin","url":"https://mrmlnc.com"},"version":"3.2.11","license":"MIT","typings":"out/index.d.ts"}
@@ -0,0 +1,20 @@
1
+ import type * as fsStat from '../../../@nodelib/fs.stat';
2
+ import type { Dirent, ErrnoException } from '../types';
3
+ export interface ReaddirAsynchronousMethod {
4
+ (filepath: string, options: {
5
+ withFileTypes: true;
6
+ }, callback: (error: ErrnoException | null, files: Dirent[]) => void): void;
7
+ (filepath: string, callback: (error: ErrnoException | null, files: string[]) => void): void;
8
+ }
9
+ export interface ReaddirSynchronousMethod {
10
+ (filepath: string, options: {
11
+ withFileTypes: true;
12
+ }): Dirent[];
13
+ (filepath: string): string[];
14
+ }
15
+ export declare type FileSystemAdapter = fsStat.FileSystemAdapter & {
16
+ readdir: ReaddirAsynchronousMethod;
17
+ readdirSync: ReaddirSynchronousMethod;
18
+ };
19
+ export declare const FILE_SYSTEM_ADAPTER: FileSystemAdapter;
20
+ export declare function createFileSystemAdapter(fsMethods?: Partial<FileSystemAdapter>): FileSystemAdapter;
@@ -0,0 +1,12 @@
1
+ import type { FileSystemAdapter, ReaddirAsynchronousMethod, ReaddirSynchronousMethod } from './adapters/fs';
2
+ import * as async from './providers/async';
3
+ import Settings, { Options } from './settings';
4
+ import type { Dirent, Entry } from './types';
5
+ declare type AsyncCallback = async.AsyncCallback;
6
+ declare function scandir(path: string, callback: AsyncCallback): void;
7
+ declare function scandir(path: string, optionsOrSettings: Options | Settings, callback: AsyncCallback): void;
8
+ declare namespace scandir {
9
+ function __promisify__(path: string, optionsOrSettings?: Options | Settings): Promise<Entry[]>;
10
+ }
11
+ declare function scandirSync(path: string, optionsOrSettings?: Options | Settings): Entry[];
12
+ export { scandir, scandirSync, Settings, AsyncCallback, Dirent, Entry, FileSystemAdapter, ReaddirAsynchronousMethod, ReaddirSynchronousMethod, Options };
@@ -0,0 +1,7 @@
1
+ /// <reference types="node" />
2
+ import type Settings from '../settings';
3
+ import type { Entry } from '../types';
4
+ export declare type AsyncCallback = (error: NodeJS.ErrnoException, entries: Entry[]) => void;
5
+ export declare function read(directory: string, settings: Settings, callback: AsyncCallback): void;
6
+ export declare function readdirWithFileTypes(directory: string, settings: Settings, callback: AsyncCallback): void;
7
+ export declare function readdir(directory: string, settings: Settings, callback: AsyncCallback): void;
@@ -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,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,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,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,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,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,4 @@
1
+ /// <reference types="node" />
2
+ import type * as fs from 'fs';
3
+ export declare type Stats = fs.Stats;
4
+ export declare type ErrnoException = NodeJS.ErrnoException;
@@ -0,0 +1,14 @@
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 };
@@ -0,0 +1,12 @@
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
+ }
@@ -0,0 +1,30 @@
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 {};
@@ -0,0 +1,6 @@
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
+ }
@@ -0,0 +1,30 @@
1
+ import * as fsScandir from '../../@nodelib/fs.scandir';
2
+ import type { Entry, Errno } from './types';
3
+ export declare type FilterFunction<T> = (value: T) => boolean;
4
+ export declare type DeepFilterFunction = FilterFunction<Entry>;
5
+ export declare type EntryFilterFunction = FilterFunction<Entry>;
6
+ export declare type ErrorFilterFunction = FilterFunction<Errno>;
7
+ export interface Options {
8
+ basePath?: string;
9
+ concurrency?: number;
10
+ deepFilter?: DeepFilterFunction;
11
+ entryFilter?: EntryFilterFunction;
12
+ errorFilter?: ErrorFilterFunction;
13
+ followSymbolicLinks?: boolean;
14
+ fs?: Partial<fsScandir.FileSystemAdapter>;
15
+ pathSegmentSeparator?: string;
16
+ stats?: boolean;
17
+ throwErrorOnBrokenSymbolicLink?: boolean;
18
+ }
19
+ export default class Settings {
20
+ private readonly _options;
21
+ readonly basePath?: string;
22
+ readonly concurrency: number;
23
+ readonly deepFilter: DeepFilterFunction | null;
24
+ readonly entryFilter: EntryFilterFunction | null;
25
+ readonly errorFilter: ErrorFilterFunction | null;
26
+ readonly pathSegmentSeparator: string;
27
+ readonly fsScandirSettings: fsScandir.Settings;
28
+ constructor(_options?: Options);
29
+ private _getValue;
30
+ }
@@ -0,0 +1,8 @@
1
+ /// <reference types="node" />
2
+ import type * as scandir from '../../../@nodelib/fs.scandir';
3
+ export declare type Entry = scandir.Entry;
4
+ export declare type Errno = NodeJS.ErrnoException;
5
+ export interface QueueItem {
6
+ directory: string;
7
+ base?: string;
8
+ }
@@ -0,0 +1,27 @@
1
+ /// <reference types="node" />
2
+ import * as taskManager from './managers/tasks';
3
+ import { Options as OptionsInternal } from './settings';
4
+ import { Entry as EntryInternal, FileSystemAdapter as FileSystemAdapterInternal, Pattern as PatternInternal } from './types';
5
+ declare type EntryObjectModePredicate = {
6
+ [TKey in keyof Pick<OptionsInternal, 'objectMode'>]-?: true;
7
+ };
8
+ declare type EntryStatsPredicate = {
9
+ [TKey in keyof Pick<OptionsInternal, 'stats'>]-?: true;
10
+ };
11
+ declare type EntryObjectPredicate = EntryObjectModePredicate | EntryStatsPredicate;
12
+ declare function FastGlob(source: PatternInternal | PatternInternal[], options: OptionsInternal & EntryObjectPredicate): Promise<EntryInternal[]>;
13
+ declare function FastGlob(source: PatternInternal | PatternInternal[], options?: OptionsInternal): Promise<string[]>;
14
+ declare namespace FastGlob {
15
+ type Options = OptionsInternal;
16
+ type Entry = EntryInternal;
17
+ type Task = taskManager.Task;
18
+ type Pattern = PatternInternal;
19
+ type FileSystemAdapter = FileSystemAdapterInternal;
20
+ function sync(source: PatternInternal | PatternInternal[], options: OptionsInternal & EntryObjectPredicate): EntryInternal[];
21
+ function sync(source: PatternInternal | PatternInternal[], options?: OptionsInternal): string[];
22
+ function stream(source: PatternInternal | PatternInternal[], options?: OptionsInternal): NodeJS.ReadableStream;
23
+ function generateTasks(source: PatternInternal | PatternInternal[], options?: OptionsInternal): Task[];
24
+ function isDynamicPattern(source: PatternInternal, options?: OptionsInternal): boolean;
25
+ function escapePath(source: PatternInternal): PatternInternal;
26
+ }
27
+ export = FastGlob;
@@ -0,0 +1,22 @@
1
+ import Settings from '../settings';
2
+ import { Pattern, PatternsGroup } from '../types';
3
+ export declare type Task = {
4
+ base: string;
5
+ dynamic: boolean;
6
+ patterns: Pattern[];
7
+ positive: Pattern[];
8
+ negative: Pattern[];
9
+ };
10
+ export declare function generate(patterns: Pattern[], settings: Settings): Task[];
11
+ /**
12
+ * Returns tasks grouped by basic pattern directories.
13
+ *
14
+ * Patterns that can be found inside (`./`) and outside (`../`) the current directory are handled separately.
15
+ * This is necessary because directory traversal starts at the base directory and goes deeper.
16
+ */
17
+ export declare function convertPatternsToTasks(positive: Pattern[], negative: Pattern[], dynamic: boolean): Task[];
18
+ export declare function getPositivePatterns(patterns: Pattern[]): Pattern[];
19
+ export declare function getNegativePatternsAsPositive(patterns: Pattern[], ignore: Pattern[]): Pattern[];
20
+ export declare function groupPatternsByBaseDirectory(patterns: Pattern[]): PatternsGroup;
21
+ export declare function convertPatternGroupsToTasks(positive: PatternsGroup, negative: Pattern[], dynamic: boolean): Task[];
22
+ export declare function convertPatternGroupToTask(base: string, positive: Pattern[], negative: Pattern[], dynamic: boolean): Task;