1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | import { AsyncSeriesBailHook, AsyncSeriesHook, SyncHook } from "tapable";
|
8 |
|
9 | declare interface AliasOption {
|
10 | alias: string | false | string[];
|
11 | name: string;
|
12 | onlyModule?: boolean;
|
13 | }
|
14 | type AliasOptionNewRequest = string | false | string[];
|
15 | declare interface AliasOptions {
|
16 | [index: string]: AliasOptionNewRequest;
|
17 | }
|
18 | declare interface BaseResolveRequest {
|
19 | path: string | false;
|
20 | descriptionFilePath?: string;
|
21 | descriptionFileRoot?: string;
|
22 | descriptionFileData?: object;
|
23 | relativePath?: string;
|
24 | ignoreSymlinks?: boolean;
|
25 | fullySpecified?: boolean;
|
26 | }
|
27 | declare class CachedInputFileSystem {
|
28 | constructor(fileSystem?: any, duration?: any);
|
29 | fileSystem: any;
|
30 | lstat?: {
|
31 | (arg0: string, arg1: FileSystemCallback<FileSystemStats>): void;
|
32 | (
|
33 | arg0: string,
|
34 | arg1: object,
|
35 | arg2: FileSystemCallback<string | Buffer>
|
36 | ): void;
|
37 | };
|
38 | lstatSync?: (arg0: string, arg1?: object) => FileSystemStats;
|
39 | stat: {
|
40 | (arg0: string, arg1: FileSystemCallback<FileSystemStats>): void;
|
41 | (
|
42 | arg0: string,
|
43 | arg1: object,
|
44 | arg2: FileSystemCallback<string | Buffer>
|
45 | ): void;
|
46 | };
|
47 | statSync: (arg0: string, arg1?: object) => FileSystemStats;
|
48 | readdir: {
|
49 | (
|
50 | arg0: string,
|
51 | arg1: FileSystemCallback<(string | Buffer)[] | FileSystemDirent[]>
|
52 | ): void;
|
53 | (
|
54 | arg0: string,
|
55 | arg1: object,
|
56 | arg2: FileSystemCallback<(string | Buffer)[] | FileSystemDirent[]>
|
57 | ): void;
|
58 | };
|
59 | readdirSync: (
|
60 | arg0: string,
|
61 | arg1?: object
|
62 | ) => (string | Buffer)[] | FileSystemDirent[];
|
63 | readFile: {
|
64 | (arg0: string, arg1: FileSystemCallback<string | Buffer>): void;
|
65 | (
|
66 | arg0: string,
|
67 | arg1: object,
|
68 | arg2: FileSystemCallback<string | Buffer>
|
69 | ): void;
|
70 | };
|
71 | readFileSync: (arg0: string, arg1?: object) => string | Buffer;
|
72 | readJson?: {
|
73 | (arg0: string, arg1: FileSystemCallback<object>): void;
|
74 | (arg0: string, arg1: object, arg2: FileSystemCallback<object>): void;
|
75 | };
|
76 | readJsonSync?: (arg0: string, arg1?: object) => object;
|
77 | readlink: {
|
78 | (arg0: string, arg1: FileSystemCallback<string | Buffer>): void;
|
79 | (
|
80 | arg0: string,
|
81 | arg1: object,
|
82 | arg2: FileSystemCallback<string | Buffer>
|
83 | ): void;
|
84 | };
|
85 | readlinkSync: (arg0: string, arg1?: object) => string | Buffer;
|
86 | purge(what?: any): void;
|
87 | }
|
88 | declare class CloneBasenamePlugin {
|
89 | constructor(source?: any, target?: any);
|
90 | source: any;
|
91 | target: any;
|
92 | apply(resolver: Resolver): void;
|
93 | }
|
94 | declare interface FileSystem {
|
95 | readFile: {
|
96 | (arg0: string, arg1: FileSystemCallback<string | Buffer>): void;
|
97 | (
|
98 | arg0: string,
|
99 | arg1: object,
|
100 | arg2: FileSystemCallback<string | Buffer>
|
101 | ): void;
|
102 | };
|
103 | readdir: {
|
104 | (
|
105 | arg0: string,
|
106 | arg1: FileSystemCallback<(string | Buffer)[] | FileSystemDirent[]>
|
107 | ): void;
|
108 | (
|
109 | arg0: string,
|
110 | arg1: object,
|
111 | arg2: FileSystemCallback<(string | Buffer)[] | FileSystemDirent[]>
|
112 | ): void;
|
113 | };
|
114 | readJson?: {
|
115 | (arg0: string, arg1: FileSystemCallback<object>): void;
|
116 | (arg0: string, arg1: object, arg2: FileSystemCallback<object>): void;
|
117 | };
|
118 | readlink: {
|
119 | (arg0: string, arg1: FileSystemCallback<string | Buffer>): void;
|
120 | (
|
121 | arg0: string,
|
122 | arg1: object,
|
123 | arg2: FileSystemCallback<string | Buffer>
|
124 | ): void;
|
125 | };
|
126 | lstat?: {
|
127 | (arg0: string, arg1: FileSystemCallback<FileSystemStats>): void;
|
128 | (
|
129 | arg0: string,
|
130 | arg1: object,
|
131 | arg2: FileSystemCallback<string | Buffer>
|
132 | ): void;
|
133 | };
|
134 | stat: {
|
135 | (arg0: string, arg1: FileSystemCallback<FileSystemStats>): void;
|
136 | (
|
137 | arg0: string,
|
138 | arg1: object,
|
139 | arg2: FileSystemCallback<string | Buffer>
|
140 | ): void;
|
141 | };
|
142 | }
|
143 | declare interface FileSystemCallback<T> {
|
144 | (err?: null | (PossibleFileSystemError & Error), result?: T): any;
|
145 | }
|
146 | declare interface FileSystemDirent {
|
147 | name: string | Buffer;
|
148 | isDirectory: () => boolean;
|
149 | isFile: () => boolean;
|
150 | }
|
151 | declare interface FileSystemStats {
|
152 | isDirectory: () => boolean;
|
153 | isFile: () => boolean;
|
154 | }
|
155 | declare class LogInfoPlugin {
|
156 | constructor(source?: any);
|
157 | source: any;
|
158 | apply(resolver: Resolver): void;
|
159 | }
|
160 | declare interface ParsedIdentifier {
|
161 | request: string;
|
162 | query: string;
|
163 | fragment: string;
|
164 | directory: boolean;
|
165 | module: boolean;
|
166 | file: boolean;
|
167 | internal: boolean;
|
168 | }
|
169 | type Plugin =
|
170 | | { apply: (arg0: Resolver) => void }
|
171 | | ((this: Resolver, arg1: Resolver) => void);
|
172 | declare interface PnpApiImpl {
|
173 | resolveToUnqualified: (arg0: string, arg1: string, arg2: object) => string;
|
174 | }
|
175 | declare interface PossibleFileSystemError {
|
176 | code?: string;
|
177 | errno?: number;
|
178 | path?: string;
|
179 | syscall?: string;
|
180 | }
|
181 |
|
182 |
|
183 |
|
184 |
|
185 | declare interface ResolveContext {
|
186 | contextDependencies?: WriteOnlySet<string>;
|
187 |
|
188 | |
189 |
|
190 |
|
191 | fileDependencies?: WriteOnlySet<string>;
|
192 |
|
193 | |
194 |
|
195 |
|
196 | missingDependencies?: WriteOnlySet<string>;
|
197 |
|
198 | |
199 |
|
200 |
|
201 | stack?: Set<string>;
|
202 |
|
203 | |
204 |
|
205 |
|
206 | log?: (arg0: string) => void;
|
207 | }
|
208 | declare interface ResolveOptions {
|
209 | alias: AliasOption[];
|
210 | fallback: AliasOption[];
|
211 | aliasFields: Set<string | string[]>;
|
212 | cachePredicate: (arg0: ResolveRequest) => boolean;
|
213 | cacheWithContext: boolean;
|
214 |
|
215 | |
216 |
|
217 |
|
218 | conditionNames: Set<string>;
|
219 | descriptionFiles: string[];
|
220 | enforceExtension: boolean;
|
221 | exportsFields: Set<string | string[]>;
|
222 | importsFields: Set<string | string[]>;
|
223 | extensions: Set<string>;
|
224 | fileSystem: FileSystem;
|
225 | unsafeCache: false | object;
|
226 | symlinks: boolean;
|
227 | resolver?: Resolver;
|
228 | modules: (string | string[])[];
|
229 | mainFields: { name: string[]; forceRelative: boolean }[];
|
230 | mainFiles: Set<string>;
|
231 | plugins: Plugin[];
|
232 | pnpApi: null | PnpApiImpl;
|
233 | roots: Set<string>;
|
234 | fullySpecified: boolean;
|
235 | resolveToContext: boolean;
|
236 | restrictions: Set<string | RegExp>;
|
237 | preferRelative: boolean;
|
238 | preferAbsolute: boolean;
|
239 | }
|
240 | type ResolveRequest = BaseResolveRequest & Partial<ParsedIdentifier>;
|
241 | declare abstract class Resolver {
|
242 | fileSystem: FileSystem;
|
243 | options: ResolveOptions;
|
244 | hooks: {
|
245 | resolveStep: SyncHook<
|
246 | [
|
247 | AsyncSeriesBailHook<
|
248 | [ResolveRequest, ResolveContext],
|
249 | null | ResolveRequest
|
250 | >,
|
251 | ResolveRequest
|
252 | ]
|
253 | >;
|
254 | noResolve: SyncHook<[ResolveRequest, Error]>;
|
255 | resolve: AsyncSeriesBailHook<
|
256 | [ResolveRequest, ResolveContext],
|
257 | null | ResolveRequest
|
258 | >;
|
259 | result: AsyncSeriesHook<[ResolveRequest, ResolveContext]>;
|
260 | };
|
261 | ensureHook(
|
262 | name:
|
263 | | string
|
264 | | AsyncSeriesBailHook<
|
265 | [ResolveRequest, ResolveContext],
|
266 | null | ResolveRequest
|
267 | >
|
268 | ): AsyncSeriesBailHook<
|
269 | [ResolveRequest, ResolveContext],
|
270 | null | ResolveRequest
|
271 | >;
|
272 | getHook(
|
273 | name:
|
274 | | string
|
275 | | AsyncSeriesBailHook<
|
276 | [ResolveRequest, ResolveContext],
|
277 | null | ResolveRequest
|
278 | >
|
279 | ): AsyncSeriesBailHook<
|
280 | [ResolveRequest, ResolveContext],
|
281 | null | ResolveRequest
|
282 | >;
|
283 | resolveSync(context: object, path: string, request: string): string | false;
|
284 | resolve(
|
285 | context: object,
|
286 | path: string,
|
287 | request: string,
|
288 | resolveContext: ResolveContext,
|
289 | callback: (
|
290 | arg0: null | Error,
|
291 | arg1?: string | false,
|
292 | arg2?: ResolveRequest
|
293 | ) => void
|
294 | ): void;
|
295 | doResolve(
|
296 | hook?: any,
|
297 | request?: any,
|
298 | message?: any,
|
299 | resolveContext?: any,
|
300 | callback?: any
|
301 | ): any;
|
302 | parse(identifier: string): ParsedIdentifier;
|
303 | isModule(path?: any): boolean;
|
304 | isPrivate(path?: any): boolean;
|
305 | isDirectory(path: string): boolean;
|
306 | join(path?: any, request?: any): string;
|
307 | normalize(path?: any): string;
|
308 | }
|
309 | declare interface UserResolveOptions {
|
310 | |
311 |
|
312 |
|
313 | alias?: AliasOptions | AliasOption[];
|
314 |
|
315 | |
316 |
|
317 |
|
318 | fallback?: AliasOptions | AliasOption[];
|
319 |
|
320 | |
321 |
|
322 |
|
323 | aliasFields?: (string | string[])[];
|
324 |
|
325 | |
326 |
|
327 |
|
328 | cachePredicate?: (arg0: ResolveRequest) => boolean;
|
329 |
|
330 | |
331 |
|
332 |
|
333 | cacheWithContext?: boolean;
|
334 |
|
335 | |
336 |
|
337 |
|
338 | descriptionFiles?: string[];
|
339 |
|
340 | |
341 |
|
342 |
|
343 | conditionNames?: string[];
|
344 |
|
345 | |
346 |
|
347 |
|
348 | enforceExtension?: boolean;
|
349 |
|
350 | |
351 |
|
352 |
|
353 | exportsFields?: (string | string[])[];
|
354 |
|
355 | |
356 |
|
357 |
|
358 | importsFields?: (string | string[])[];
|
359 |
|
360 | |
361 |
|
362 |
|
363 | extensions?: string[];
|
364 |
|
365 | |
366 |
|
367 |
|
368 | fileSystem: FileSystem;
|
369 |
|
370 | |
371 |
|
372 |
|
373 | unsafeCache?: boolean | object;
|
374 |
|
375 | |
376 |
|
377 |
|
378 | symlinks?: boolean;
|
379 |
|
380 | |
381 |
|
382 |
|
383 | resolver?: Resolver;
|
384 |
|
385 | |
386 |
|
387 |
|
388 | modules?: string | string[];
|
389 |
|
390 | |
391 |
|
392 |
|
393 | mainFields?: (
|
394 | | string
|
395 | | string[]
|
396 | | { name: string | string[]; forceRelative: boolean }
|
397 | )[];
|
398 |
|
399 | |
400 |
|
401 |
|
402 | mainFiles?: string[];
|
403 |
|
404 | |
405 |
|
406 |
|
407 | plugins?: Plugin[];
|
408 |
|
409 | |
410 |
|
411 |
|
412 | pnpApi?: null | PnpApiImpl;
|
413 |
|
414 | |
415 |
|
416 |
|
417 | roots?: string[];
|
418 |
|
419 | |
420 |
|
421 |
|
422 | fullySpecified?: boolean;
|
423 |
|
424 | |
425 |
|
426 |
|
427 | resolveToContext?: boolean;
|
428 |
|
429 | |
430 |
|
431 |
|
432 | restrictions?: (string | RegExp)[];
|
433 |
|
434 | |
435 |
|
436 |
|
437 | useSyncFileSystemCalls?: boolean;
|
438 |
|
439 | |
440 |
|
441 |
|
442 | preferRelative?: boolean;
|
443 |
|
444 | |
445 |
|
446 |
|
447 | preferAbsolute?: boolean;
|
448 | }
|
449 | declare interface WriteOnlySet<T> {
|
450 | add: (T?: any) => void;
|
451 | }
|
452 | declare function exports(
|
453 | context?: any,
|
454 | path?: any,
|
455 | request?: any,
|
456 | resolveContext?: any,
|
457 | callback?: any
|
458 | ): void;
|
459 | declare namespace exports {
|
460 | export const sync: (
|
461 | context?: any,
|
462 | path?: any,
|
463 | request?: any
|
464 | ) => string | false;
|
465 | export function create(
|
466 | options?: any
|
467 | ): (
|
468 | context?: any,
|
469 | path?: any,
|
470 | request?: any,
|
471 | resolveContext?: any,
|
472 | callback?: any
|
473 | ) => void;
|
474 | export namespace create {
|
475 | export const sync: (
|
476 | options?: any
|
477 | ) => (context?: any, path?: any, request?: any) => string | false;
|
478 | }
|
479 | export namespace ResolverFactory {
|
480 | export let createResolver: (options: UserResolveOptions) => Resolver;
|
481 | }
|
482 | export const forEachBail: (
|
483 | array?: any,
|
484 | iterator?: any,
|
485 | callback?: any
|
486 | ) => any;
|
487 | export {
|
488 | CachedInputFileSystem,
|
489 | CloneBasenamePlugin,
|
490 | LogInfoPlugin,
|
491 | PnpApiImpl as PnpApi,
|
492 | Resolver,
|
493 | FileSystem,
|
494 | ResolveContext,
|
495 | ResolveRequest,
|
496 | Plugin,
|
497 | UserResolveOptions as ResolveOptions
|
498 | };
|
499 | }
|
500 |
|
501 | export = exports;
|