forked from webpack/enhanced-resolve
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtypes.d.ts
407 lines (377 loc) · 9.21 KB
/
types.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
/*
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update
*/
import { AsyncSeriesBailHook, AsyncSeriesHook, SyncHook } from "tapable";
declare class CachedInputFileSystem {
constructor(fileSystem?: any, duration?: any);
fileSystem: any;
stat(path?: any, callback?: any): void;
statSync(path?: any): any;
readdir(path?: any, callback?: any): void;
readdirSync(path?: any): any;
readFile(path?: any, callback?: any): void;
readFileSync(path?: any): any;
readJson(path?: any, callback?: any): void;
readJsonSync(path?: any): any;
readlink(path?: any, callback?: any): void;
readlinkSync(path?: any): any;
purge(what?: any): void;
}
declare class CloneBasenamePlugin {
constructor(source?: any, target?: any);
source: any;
target: any;
apply(resolver: Resolver): void;
}
declare interface FileSystem {
readFile: (
arg0: string,
arg1: (
arg0: undefined | null | (PossibleFileSystemError & Error),
arg1: undefined | string | Buffer
) => void
) => void;
readJson?:
| undefined
| ((
arg0: string,
arg1: (
arg0: undefined | null | (PossibleFileSystemError & Error),
arg1?: any
) => void
) => void);
readlink: (
arg0: string,
arg1: (
arg0: undefined | null | (PossibleFileSystemError & Error),
arg1: undefined | string | Buffer
) => void
) => void;
stat: (
arg0: string,
arg1: (
arg0: undefined | null | (PossibleFileSystemError & Error),
arg1: undefined | FileSystemStats
) => void
) => void;
}
declare interface FileSystemStats {
isDirectory: () => boolean;
isFile: () => boolean;
}
declare class LogInfoPlugin {
constructor(source?: any);
source: any;
apply(resolver: Resolver): void;
}
declare interface ParsedIdentifier {
request: string;
query: string;
fragment: string;
directory: boolean;
module: boolean;
file: boolean;
}
declare interface PnpApiImpl {
resolveToUnqualified: (arg0: string, arg1: string, arg2?: any) => string;
}
declare interface PossibleFileSystemError {
code?: undefined | string;
errno?: undefined | number;
path?: undefined | string;
syscall?: undefined | string;
}
/**
* Resolve context
*/
declare interface ResolveContext {
contextDependencies?: undefined | { add: (T?: any) => void };
/**
* files that was found on file system
*/
fileDependencies?: undefined | { add: (T?: any) => void };
/**
* dependencies that was not found on file system
*/
missingDependencies?: undefined | { add: (T?: any) => void };
/**
* set of hooks' calls. For instance, `resolve → parsedResolve → describedResolve`,
*/
stack?: undefined | Set<string>;
/**
* log function
*/
log?: undefined | ((arg0: string) => void);
}
declare interface ResolveOptions {
alias: ({
alias: string | false | (string)[];
name: string;
onlyModule?: undefined | boolean;
})[];
aliasFields: Set<string | (string)[]>;
cachePredicate: (arg0: ResolveRequest) => boolean;
cacheWithContext: boolean;
/**
* A list of exports field condition names.
*/
conditionNames: Set<string>;
descriptionFiles: (string)[];
enforceExtension: boolean;
exportsFields: Set<string | (string)[]>;
extensions: Set<string>;
fileSystem: FileSystem;
unsafeCache: any;
symlinks: boolean;
resolver?: undefined | Resolver;
modules: (string | (string)[])[];
mainFields: ({ name: (string)[]; forceRelative: boolean })[];
mainFiles: Set<string>;
plugins: (
| { apply: (arg0: Resolver) => void }
| ((this: Resolver, arg1: Resolver) => void))[];
pnpApi: null | PnpApiImpl;
roots: Set<string>;
resolveToContext: boolean;
restrictions: Set<string | RegExp>;
}
declare interface ResolveRequest {
path: string | false;
request?: undefined | string;
query?: undefined | string;
fragment?: undefined | string;
directory?: undefined | boolean;
module?: undefined | boolean;
descriptionFilePath?: undefined | string;
descriptionFileRoot?: undefined | string;
descriptionFileData?: any;
relativePath?: undefined | string;
ignoreSymlinks?: undefined | boolean;
}
declare abstract class Resolver {
fileSystem: FileSystem;
options: ResolveOptions;
hooks: {
resolveStep: SyncHook<
[
AsyncSeriesBailHook<
[ResolveRequest, ResolveContext],
null | ResolveRequest
>,
ResolveRequest
],
void
>;
noResolve: SyncHook<[ResolveRequest, Error], void>;
resolve: AsyncSeriesBailHook<
[ResolveRequest, ResolveContext],
null | ResolveRequest
>;
result: AsyncSeriesHook<[ResolveRequest, ResolveContext]>;
};
ensureHook(
name:
| string
| AsyncSeriesBailHook<
[ResolveRequest, ResolveContext],
null | ResolveRequest
>
): AsyncSeriesBailHook<
[ResolveRequest, ResolveContext],
null | ResolveRequest
>;
getHook(
name:
| string
| AsyncSeriesBailHook<
[ResolveRequest, ResolveContext],
null | ResolveRequest
>
): AsyncSeriesBailHook<
[ResolveRequest, ResolveContext],
null | ResolveRequest
>;
resolveSync(context: any, path: string, request: string): string | false;
resolve(
context: any,
path: string,
request: string,
resolveContext: ResolveContext,
callback: (
arg0: null | Error,
arg1: undefined | string | false,
arg2: undefined | ResolveRequest
) => void
): void;
doResolve(
hook?: any,
request?: any,
message?: any,
resolveContext?: any,
callback?: any
): any;
parse(identifier: string): ParsedIdentifier;
isModule(path?: any): boolean;
isDirectory(path: string): boolean;
join(path?: any, request?: any): string;
normalize(path?: any): string;
}
declare interface UserResolveOptions {
/**
* A list of module alias configurations or an object which maps key to value
*/
alias?:
| undefined
| { [index: string]: string | false | (string)[] }
| ({
alias: string | false | (string)[];
name: string;
onlyModule?: undefined | boolean;
})[];
/**
* A list of alias fields in description files
*/
aliasFields?: undefined | (string | (string)[])[];
/**
* A function which decides whether a request should be cached or not. An object is passed with at least `path` and `request` properties.
*/
cachePredicate?: undefined | ((arg0: ResolveRequest) => boolean);
/**
* Whether or not the unsafeCache should include request context as part of the cache key.
*/
cacheWithContext?: undefined | boolean;
/**
* A list of description files to read from
*/
descriptionFiles?: undefined | (string)[];
/**
* A list of exports field condition names.
*/
conditionNames?: undefined | (string)[];
/**
* Enforce that a extension from extensions must be used
*/
enforceExtension?: undefined | boolean;
/**
* A list of exports fields in description files
*/
exportsFields?: undefined | (string | (string)[])[];
/**
* A list of extensions which should be tried for files
*/
extensions?: undefined | (string)[];
/**
* The file system which should be used
*/
fileSystem: FileSystem;
/**
* Use this cache object to unsafely cache the successful requests
*/
unsafeCache?: any;
/**
* Resolve symlinks to their symlinked location
*/
symlinks?: undefined | boolean;
/**
* A prepared Resolver to which the plugins are attached
*/
resolver?: undefined | Resolver;
/**
* A list of directories to resolve modules from, can be absolute path or folder name
*/
modules?: undefined | string | (string)[];
/**
* A list of main fields in description files
*/
mainFields?:
| undefined
| (
| string
| (string)[]
| { name: string | (string)[]; forceRelative: boolean })[];
/**
* A list of main files in directories
*/
mainFiles?: undefined | (string)[];
/**
* A list of additional resolve plugins which should be applied
*/
plugins?:
| undefined
| (
| { apply: (arg0: Resolver) => void }
| ((this: Resolver, arg1: Resolver) => void))[];
/**
* A PnP API that should be used - null is "never", undefined is "auto"
*/
pnpApi?: undefined | null | PnpApiImpl;
/**
* A list of root paths
*/
roots?: undefined | (string)[];
/**
* Resolve to a context instead of a file
*/
resolveToContext?: undefined | boolean;
/**
* A list of resolve restrictions
*/
restrictions?: undefined | (string | RegExp)[];
/**
* Use only the sync constiants of the file system calls
*/
useSyncFileSystemCalls?: undefined | boolean;
}
declare function exports(
context?: any,
path?: any,
request?: any,
resolveContext?: any,
callback?: any
): void;
declare namespace exports {
export const sync: (
context?: any,
path?: any,
request?: any
) => string | false;
export function create(
options?: any
): (
context?: any,
path?: any,
request?: any,
resolveContext?: any,
callback?: any
) => void;
export namespace create {
export const sync: (
options?: any
) => (context?: any, path?: any, request?: any) => string | false;
}
export namespace ResolverFactory {
export let createResolver: (options: UserResolveOptions) => Resolver;
}
export const forEachBail: (
array?: any,
iterator?: any,
callback?: any
) => any;
export type Plugin =
| { apply: (arg0: Resolver) => void }
| ((this: Resolver, arg1: Resolver) => void);
export {
CachedInputFileSystem,
CloneBasenamePlugin,
LogInfoPlugin,
PnpApiImpl as PnpApi,
Resolver,
FileSystem,
ResolveContext,
ResolveRequest,
UserResolveOptions as ResolveOptions
};
}
export = exports;