@lage-run/globby 13.0.1
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/README.md +3 -0
- package/dist/index.d.ts +244 -0
- package/dist/index.js +6385 -0
- package/package.json +28 -0
package/README.md
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
|
|
3
|
+
declare type ErrnoException = NodeJS.ErrnoException;
|
|
4
|
+
declare type StatAsynchronousMethod = (path: string, callback: (error: ErrnoException | null, stats: fs.Stats) => void) => void;
|
|
5
|
+
declare type StatSynchronousMethod = (path: string) => fs.Stats;
|
|
6
|
+
interface FileSystemAdapter {
|
|
7
|
+
lstat: StatAsynchronousMethod;
|
|
8
|
+
stat: StatAsynchronousMethod;
|
|
9
|
+
lstatSync: StatSynchronousMethod;
|
|
10
|
+
statSync: StatSynchronousMethod;
|
|
11
|
+
}
|
|
12
|
+
interface Entry {
|
|
13
|
+
dirent: Dirent;
|
|
14
|
+
name: string;
|
|
15
|
+
path: string;
|
|
16
|
+
stats?: Stats;
|
|
17
|
+
}
|
|
18
|
+
declare type Stats = fs.Stats;
|
|
19
|
+
declare type ErrnoException$1 = NodeJS.ErrnoException;
|
|
20
|
+
interface Dirent {
|
|
21
|
+
isBlockDevice: () => boolean;
|
|
22
|
+
isCharacterDevice: () => boolean;
|
|
23
|
+
isDirectory: () => boolean;
|
|
24
|
+
isFIFO: () => boolean;
|
|
25
|
+
isFile: () => boolean;
|
|
26
|
+
isSocket: () => boolean;
|
|
27
|
+
isSymbolicLink: () => boolean;
|
|
28
|
+
name: string;
|
|
29
|
+
}
|
|
30
|
+
interface ReaddirAsynchronousMethod {
|
|
31
|
+
(filepath: string, options: {
|
|
32
|
+
withFileTypes: true;
|
|
33
|
+
}, callback: (error: ErrnoException$1 | null, files: Dirent[]) => void): void;
|
|
34
|
+
(filepath: string, callback: (error: ErrnoException$1 | null, files: string[]) => void): void;
|
|
35
|
+
}
|
|
36
|
+
interface ReaddirSynchronousMethod {
|
|
37
|
+
(filepath: string, options: {
|
|
38
|
+
withFileTypes: true;
|
|
39
|
+
}): Dirent[];
|
|
40
|
+
(filepath: string): string[];
|
|
41
|
+
}
|
|
42
|
+
declare type FileSystemAdapter$1 = FileSystemAdapter & {
|
|
43
|
+
readdir: ReaddirAsynchronousMethod;
|
|
44
|
+
readdirSync: ReaddirSynchronousMethod;
|
|
45
|
+
};
|
|
46
|
+
declare type Entry$1 = Entry;
|
|
47
|
+
type EntryInternal = Entry$1;
|
|
48
|
+
type Pattern = string;
|
|
49
|
+
type FileSystemAdapter$2 = FileSystemAdapter$1;
|
|
50
|
+
type OptionsInternal = {
|
|
51
|
+
/**
|
|
52
|
+
* Return the absolute path for entries.
|
|
53
|
+
*
|
|
54
|
+
* @default false
|
|
55
|
+
*/
|
|
56
|
+
absolute?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* If set to `true`, then patterns without slashes will be matched against
|
|
59
|
+
* the basename of the path if it contains slashes.
|
|
60
|
+
*
|
|
61
|
+
* @default false
|
|
62
|
+
*/
|
|
63
|
+
baseNameMatch?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Enables Bash-like brace expansion.
|
|
66
|
+
*
|
|
67
|
+
* @default true
|
|
68
|
+
*/
|
|
69
|
+
braceExpansion?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Enables a case-sensitive mode for matching files.
|
|
72
|
+
*
|
|
73
|
+
* @default true
|
|
74
|
+
*/
|
|
75
|
+
caseSensitiveMatch?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Specifies the maximum number of concurrent requests from a reader to read
|
|
78
|
+
* directories.
|
|
79
|
+
*
|
|
80
|
+
* @default os.cpus().length
|
|
81
|
+
*/
|
|
82
|
+
concurrency?: number;
|
|
83
|
+
/**
|
|
84
|
+
* The current working directory in which to search.
|
|
85
|
+
*
|
|
86
|
+
* @default process.cwd()
|
|
87
|
+
*/
|
|
88
|
+
cwd?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Specifies the maximum depth of a read directory relative to the start
|
|
91
|
+
* directory.
|
|
92
|
+
*
|
|
93
|
+
* @default Infinity
|
|
94
|
+
*/
|
|
95
|
+
deep?: number;
|
|
96
|
+
/**
|
|
97
|
+
* Allow patterns to match entries that begin with a period (`.`).
|
|
98
|
+
*
|
|
99
|
+
* @default false
|
|
100
|
+
*/
|
|
101
|
+
dot?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Enables Bash-like `extglob` functionality.
|
|
104
|
+
*
|
|
105
|
+
* @default true
|
|
106
|
+
*/
|
|
107
|
+
extglob?: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Indicates whether to traverse descendants of symbolic link directories.
|
|
110
|
+
*
|
|
111
|
+
* @default true
|
|
112
|
+
*/
|
|
113
|
+
followSymbolicLinks?: boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Custom implementation of methods for working with the file system.
|
|
116
|
+
*
|
|
117
|
+
* @default fs.*
|
|
118
|
+
*/
|
|
119
|
+
fs?: Partial<FileSystemAdapter$2>;
|
|
120
|
+
/**
|
|
121
|
+
* Enables recursively repeats a pattern containing `**`.
|
|
122
|
+
* If `false`, `**` behaves exactly like `*`.
|
|
123
|
+
*
|
|
124
|
+
* @default true
|
|
125
|
+
*/
|
|
126
|
+
globstar?: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* An array of glob patterns to exclude matches.
|
|
129
|
+
* This is an alternative way to use negative patterns.
|
|
130
|
+
*
|
|
131
|
+
* @default []
|
|
132
|
+
*/
|
|
133
|
+
ignore?: Pattern[];
|
|
134
|
+
/**
|
|
135
|
+
* Mark the directory path with the final slash.
|
|
136
|
+
*
|
|
137
|
+
* @default false
|
|
138
|
+
*/
|
|
139
|
+
markDirectories?: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Returns objects (instead of strings) describing entries.
|
|
142
|
+
*
|
|
143
|
+
* @default false
|
|
144
|
+
*/
|
|
145
|
+
objectMode?: boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Return only directories.
|
|
148
|
+
*
|
|
149
|
+
* @default false
|
|
150
|
+
*/
|
|
151
|
+
onlyDirectories?: boolean;
|
|
152
|
+
/**
|
|
153
|
+
* Return only files.
|
|
154
|
+
*
|
|
155
|
+
* @default true
|
|
156
|
+
*/
|
|
157
|
+
onlyFiles?: boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Enables an object mode (`objectMode`) with an additional `stats` field.
|
|
160
|
+
*
|
|
161
|
+
* @default false
|
|
162
|
+
*/
|
|
163
|
+
stats?: boolean;
|
|
164
|
+
/**
|
|
165
|
+
* By default this package suppress only `ENOENT` errors.
|
|
166
|
+
* Set to `true` to suppress any error.
|
|
167
|
+
*
|
|
168
|
+
* @default false
|
|
169
|
+
*/
|
|
170
|
+
suppressErrors?: boolean;
|
|
171
|
+
/**
|
|
172
|
+
* Throw an error when symbolic link is broken if `true` or safely
|
|
173
|
+
* return `lstat` call if `false`.
|
|
174
|
+
*
|
|
175
|
+
* @default false
|
|
176
|
+
*/
|
|
177
|
+
throwErrorOnBrokenSymbolicLink?: boolean;
|
|
178
|
+
/**
|
|
179
|
+
* Ensures that the returned entries are unique.
|
|
180
|
+
*
|
|
181
|
+
* @default true
|
|
182
|
+
*/
|
|
183
|
+
unique?: boolean;
|
|
184
|
+
};
|
|
185
|
+
declare namespace FastGlob {
|
|
186
|
+
type Options = OptionsInternal;
|
|
187
|
+
// workaround for dts-bundle-generator bug with namespace exports
|
|
188
|
+
type FastGlobOptions = OptionsInternal;
|
|
189
|
+
type Entry = EntryInternal;
|
|
190
|
+
}
|
|
191
|
+
type ExpandDirectoriesOption = boolean | readonly string[] | {
|
|
192
|
+
files?: readonly string[];
|
|
193
|
+
extensions?: readonly string[];
|
|
194
|
+
};
|
|
195
|
+
type FastGlobOptionsWithoutCwd = Omit<FastGlob.FastGlobOptions, "cwd">;
|
|
196
|
+
export interface Options extends FastGlobOptionsWithoutCwd {
|
|
197
|
+
/**
|
|
198
|
+
If set to `true`, `globby` will automatically glob directories for you. If you define an `Array` it will only glob files that matches the patterns inside the `Array`. You can also define an `Object` with `files` and `extensions` like in the example below.
|
|
199
|
+
|
|
200
|
+
Note that if you set this option to `false`, you won't get back matched directories unless you set `onlyFiles: false`.
|
|
201
|
+
|
|
202
|
+
@default true
|
|
203
|
+
|
|
204
|
+
@example
|
|
205
|
+
```
|
|
206
|
+
import {globby} from 'globby';
|
|
207
|
+
|
|
208
|
+
const paths = await globby('images', {
|
|
209
|
+
expandDirectories: {
|
|
210
|
+
files: ['cat', 'unicorn', '*.jpg'],
|
|
211
|
+
extensions: ['png']
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
console.log(paths);
|
|
216
|
+
//=> ['cat.png', 'unicorn.png', 'cow.jpg', 'rainbow.jpg']
|
|
217
|
+
```
|
|
218
|
+
*/
|
|
219
|
+
readonly expandDirectories?: ExpandDirectoriesOption;
|
|
220
|
+
/**
|
|
221
|
+
Respect ignore patterns in `.gitignore` files that apply to the globbed files.
|
|
222
|
+
|
|
223
|
+
@default false
|
|
224
|
+
*/
|
|
225
|
+
readonly gitignore?: boolean;
|
|
226
|
+
/**
|
|
227
|
+
Glob patterns to look for ignore files, which are then used to ignore globbed files.
|
|
228
|
+
|
|
229
|
+
This is a more generic form of the `gitignore` option, allowing you to find ignore files with a [compatible syntax](http://git-scm.com/docs/gitignore). For instance, this works with Babel's `.babelignore`, Prettier's `.prettierignore`, or ESLint's `.eslintignore` files.
|
|
230
|
+
|
|
231
|
+
@default undefined
|
|
232
|
+
*/
|
|
233
|
+
readonly ignoreFiles?: string | readonly string[];
|
|
234
|
+
/**
|
|
235
|
+
The current working directory in which to search.
|
|
236
|
+
|
|
237
|
+
@default process.cwd()
|
|
238
|
+
*/
|
|
239
|
+
readonly cwd?: URL | string;
|
|
240
|
+
}
|
|
241
|
+
export declare function globAsync(patterns: string[], options?: Options): Promise<string[]>;
|
|
242
|
+
export declare function glob(patterns: string[], options?: Options): string[];
|
|
243
|
+
|
|
244
|
+
export {};
|