UNPKG

24.7 kBTypeScriptView Raw
1/*
2 * This file was automatically generated.
3 * DO NOT MODIFY BY HAND.
4 * Run `yarn special-lint-fix` to update
5 */
6
7import { Buffer } from "buffer";
8import { AsyncSeriesBailHook, AsyncSeriesHook, SyncHook } from "tapable";
9import { URL as URL_Import } from "url";
10
11declare interface Abortable {
12 /**
13 * When provided the corresponding `AbortController` can be used to cancel an asynchronous action.
14 */
15 signal?: AbortSignal;
16}
17type Alias = string | false | string[];
18declare interface AliasOption {
19 alias: Alias;
20 name: string;
21 onlyModule?: boolean;
22}
23type AliasOptionNewRequest = string | false | string[];
24declare interface AliasOptions {
25 [index: string]: AliasOptionNewRequest;
26}
27type BaseFileSystem = FileSystem & SyncFileSystem;
28declare interface BaseResolveRequest {
29 path: string | false;
30 context?: object;
31 descriptionFilePath?: string;
32 descriptionFileRoot?: string;
33 descriptionFileData?: JsonObject;
34 relativePath?: string;
35 ignoreSymlinks?: boolean;
36 fullySpecified?: boolean;
37 __innerRequest?: string;
38 __innerRequest_request?: string;
39 __innerRequest_relativePath?: string;
40}
41type BufferEncoding =
42 | "ascii"
43 | "utf8"
44 | "utf-8"
45 | "utf16le"
46 | "utf-16le"
47 | "ucs2"
48 | "ucs-2"
49 | "base64"
50 | "base64url"
51 | "latin1"
52 | "binary"
53 | "hex";
54type BufferEncodingOption = "buffer" | { encoding: "buffer" };
55declare class CachedInputFileSystem {
56 constructor(fileSystem: BaseFileSystem, duration: number);
57 fileSystem: BaseFileSystem;
58 lstat?: LStat;
59 lstatSync?: LStatSync;
60 stat: Stat;
61 statSync: StatSync;
62 readdir: Readdir;
63 readdirSync: ReaddirSync;
64 readFile: ReadFile;
65 readFileSync: ReadFileSync;
66 readJson?: (
67 arg0: PathOrFileDescriptor,
68 arg1: (
69 arg0: null | Error | NodeJS.ErrnoException,
70 arg1?: JsonObject
71 ) => void
72 ) => void;
73 readJsonSync?: (arg0: PathOrFileDescriptor) => JsonObject;
74 readlink: Readlink;
75 readlinkSync: ReadlinkSync;
76 realpath?: RealPath;
77 realpathSync?: RealPathSync;
78 purge(
79 what?:
80 | string
81 | number
82 | Buffer
83 | URL_url
84 | (string | number | Buffer | URL_url)[]
85 | Set<string | number | Buffer | URL_url>
86 ): void;
87}
88declare class CloneBasenamePlugin {
89 constructor(
90 source:
91 | string
92 | AsyncSeriesBailHook<
93 [ResolveRequest, ResolveContext],
94 null | ResolveRequest
95 >,
96 target:
97 | string
98 | AsyncSeriesBailHook<
99 [ResolveRequest, ResolveContext],
100 null | ResolveRequest
101 >
102 );
103 source:
104 | string
105 | AsyncSeriesBailHook<
106 [ResolveRequest, ResolveContext],
107 null | ResolveRequest
108 >;
109 target:
110 | string
111 | AsyncSeriesBailHook<
112 [ResolveRequest, ResolveContext],
113 null | ResolveRequest
114 >;
115 apply(resolver: Resolver): void;
116}
117declare interface Dirent {
118 isFile: () => boolean;
119 isDirectory: () => boolean;
120 isBlockDevice: () => boolean;
121 isCharacterDevice: () => boolean;
122 isSymbolicLink: () => boolean;
123 isFIFO: () => boolean;
124 isSocket: () => boolean;
125 name: string;
126 path: string;
127}
128type EncodingOption =
129 | undefined
130 | null
131 | "ascii"
132 | "utf8"
133 | "utf-8"
134 | "utf16le"
135 | "utf-16le"
136 | "ucs2"
137 | "ucs-2"
138 | "base64"
139 | "base64url"
140 | "latin1"
141 | "binary"
142 | "hex"
143 | ObjectEncodingOptions;
144type ErrorWithDetail = Error & { details?: string };
145declare interface ExtensionAliasOption {
146 alias: string | string[];
147 extension: string;
148}
149declare interface ExtensionAliasOptions {
150 [index: string]: string | string[];
151}
152declare interface FileSystem {
153 readFile: ReadFile;
154 readdir: Readdir;
155 readJson?: (
156 arg0: PathOrFileDescriptor,
157 arg1: (
158 arg0: null | Error | NodeJS.ErrnoException,
159 arg1?: JsonObject
160 ) => void
161 ) => void;
162 readlink: Readlink;
163 lstat?: LStat;
164 stat: Stat;
165 realpath?: RealPath;
166}
167type IBigIntStats = IStatsBase<bigint> & {
168 atimeNs: bigint;
169 mtimeNs: bigint;
170 ctimeNs: bigint;
171 birthtimeNs: bigint;
172};
173declare interface IStats {
174 isFile: () => boolean;
175 isDirectory: () => boolean;
176 isBlockDevice: () => boolean;
177 isCharacterDevice: () => boolean;
178 isSymbolicLink: () => boolean;
179 isFIFO: () => boolean;
180 isSocket: () => boolean;
181 dev: number;
182 ino: number;
183 mode: number;
184 nlink: number;
185 uid: number;
186 gid: number;
187 rdev: number;
188 size: number;
189 blksize: number;
190 blocks: number;
191 atimeMs: number;
192 mtimeMs: number;
193 ctimeMs: number;
194 birthtimeMs: number;
195 atime: Date;
196 mtime: Date;
197 ctime: Date;
198 birthtime: Date;
199}
200declare interface IStatsBase<T> {
201 isFile: () => boolean;
202 isDirectory: () => boolean;
203 isBlockDevice: () => boolean;
204 isCharacterDevice: () => boolean;
205 isSymbolicLink: () => boolean;
206 isFIFO: () => boolean;
207 isSocket: () => boolean;
208 dev: T;
209 ino: T;
210 mode: T;
211 nlink: T;
212 uid: T;
213 gid: T;
214 rdev: T;
215 size: T;
216 blksize: T;
217 blocks: T;
218 atimeMs: T;
219 mtimeMs: T;
220 ctimeMs: T;
221 birthtimeMs: T;
222 atime: Date;
223 mtime: Date;
224 ctime: Date;
225 birthtime: Date;
226}
227declare interface Iterator<T, Z> {
228 (
229 item: T,
230 callback: (err?: null | Error, result?: null | Z) => void,
231 i: number
232 ): void;
233}
234type JsonObject = { [index: string]: JsonValue } & {
235 [index: string]:
236 | undefined
237 | null
238 | string
239 | number
240 | boolean
241 | JsonObject
242 | JsonValue[];
243};
244type JsonValue = null | string | number | boolean | JsonObject | JsonValue[];
245declare interface KnownHooks {
246 resolveStep: SyncHook<
247 [
248 AsyncSeriesBailHook<
249 [ResolveRequest, ResolveContext],
250 null | ResolveRequest
251 >,
252 ResolveRequest
253 ]
254 >;
255 noResolve: SyncHook<[ResolveRequest, Error]>;
256 resolve: AsyncSeriesBailHook<
257 [ResolveRequest, ResolveContext],
258 null | ResolveRequest
259 >;
260 result: AsyncSeriesHook<[ResolveRequest, ResolveContext]>;
261}
262declare interface LStat {
263 (
264 path: PathLike,
265 callback: (arg0: null | NodeJS.ErrnoException, arg1?: IStats) => void
266 ): void;
267 (
268 path: PathLike,
269 options: undefined | (StatOptions & { bigint?: false }),
270 callback: (arg0: null | NodeJS.ErrnoException, arg1?: IStats) => void
271 ): void;
272 (
273 path: PathLike,
274 options: StatOptions & { bigint: true },
275 callback: (arg0: null | NodeJS.ErrnoException, arg1?: IBigIntStats) => void
276 ): void;
277 (
278 path: PathLike,
279 options: undefined | StatOptions,
280 callback: (
281 arg0: null | NodeJS.ErrnoException,
282 arg1?: IStats | IBigIntStats
283 ) => void
284 ): void;
285}
286declare interface LStatSync {
287 (path: PathLike, options?: undefined): IStats;
288 (
289 path: PathLike,
290 options?: StatSyncOptions & { bigint?: false; throwIfNoEntry: false }
291 ): undefined | IStats;
292 (
293 path: PathLike,
294 options: StatSyncOptions & { bigint: true; throwIfNoEntry: false }
295 ): undefined | IBigIntStats;
296 (path: PathLike, options?: StatSyncOptions & { bigint?: false }): IStats;
297 (path: PathLike, options: StatSyncOptions & { bigint: true }): IBigIntStats;
298 (
299 path: PathLike,
300 options: StatSyncOptions & { bigint: boolean; throwIfNoEntry?: false }
301 ): IStats | IBigIntStats;
302 (path: PathLike, options?: StatSyncOptions):
303 | undefined
304 | IStats
305 | IBigIntStats;
306}
307declare class LogInfoPlugin {
308 constructor(
309 source:
310 | string
311 | AsyncSeriesBailHook<
312 [ResolveRequest, ResolveContext],
313 null | ResolveRequest
314 >
315 );
316 source:
317 | string
318 | AsyncSeriesBailHook<
319 [ResolveRequest, ResolveContext],
320 null | ResolveRequest
321 >;
322 apply(resolver: Resolver): void;
323}
324declare interface ObjectEncodingOptions {
325 encoding?:
326 | null
327 | "ascii"
328 | "utf8"
329 | "utf-8"
330 | "utf16le"
331 | "utf-16le"
332 | "ucs2"
333 | "ucs-2"
334 | "base64"
335 | "base64url"
336 | "latin1"
337 | "binary"
338 | "hex";
339}
340declare interface ParsedIdentifier {
341 request: string;
342 query: string;
343 fragment: string;
344 directory: boolean;
345 module: boolean;
346 file: boolean;
347 internal: boolean;
348}
349type PathLike = string | Buffer | URL_url;
350type PathOrFileDescriptor = string | number | Buffer | URL_url;
351type Plugin =
352 | undefined
353 | null
354 | false
355 | ""
356 | 0
357 | { apply: (arg0: Resolver) => void }
358 | ((this: Resolver, arg1: Resolver) => void);
359declare interface PnpApi {
360 resolveToUnqualified: (
361 arg0: string,
362 arg1: string,
363 arg2: object
364 ) => null | string;
365}
366declare interface ReadFile {
367 (
368 path: PathOrFileDescriptor,
369 options:
370 | undefined
371 | null
372 | ({ encoding?: null; flag?: string } & Abortable),
373 callback: (arg0: null | NodeJS.ErrnoException, arg1?: Buffer) => void
374 ): void;
375 (
376 path: PathOrFileDescriptor,
377 options:
378 | ({ encoding: BufferEncoding; flag?: string } & Abortable)
379 | "ascii"
380 | "utf8"
381 | "utf-8"
382 | "utf16le"
383 | "utf-16le"
384 | "ucs2"
385 | "ucs-2"
386 | "base64"
387 | "base64url"
388 | "latin1"
389 | "binary"
390 | "hex",
391 callback: (arg0: null | NodeJS.ErrnoException, arg1?: string) => void
392 ): void;
393 (
394 path: PathOrFileDescriptor,
395 options:
396 | undefined
397 | null
398 | "ascii"
399 | "utf8"
400 | "utf-8"
401 | "utf16le"
402 | "utf-16le"
403 | "ucs2"
404 | "ucs-2"
405 | "base64"
406 | "base64url"
407 | "latin1"
408 | "binary"
409 | "hex"
410 | (ObjectEncodingOptions & { flag?: string } & Abortable),
411 callback: (
412 arg0: null | NodeJS.ErrnoException,
413 arg1?: string | Buffer
414 ) => void
415 ): void;
416 (
417 path: PathOrFileDescriptor,
418 callback: (arg0: null | NodeJS.ErrnoException, arg1?: Buffer) => void
419 ): void;
420}
421declare interface ReadFileSync {
422 (
423 path: PathOrFileDescriptor,
424 options?: null | { encoding?: null; flag?: string }
425 ): Buffer;
426 (
427 path: PathOrFileDescriptor,
428 options:
429 | "ascii"
430 | "utf8"
431 | "utf-8"
432 | "utf16le"
433 | "utf-16le"
434 | "ucs2"
435 | "ucs-2"
436 | "base64"
437 | "base64url"
438 | "latin1"
439 | "binary"
440 | "hex"
441 | { encoding: BufferEncoding; flag?: string }
442 ): string;
443 (
444 path: PathOrFileDescriptor,
445 options?:
446 | null
447 | "ascii"
448 | "utf8"
449 | "utf-8"
450 | "utf16le"
451 | "utf-16le"
452 | "ucs2"
453 | "ucs-2"
454 | "base64"
455 | "base64url"
456 | "latin1"
457 | "binary"
458 | "hex"
459 | (ObjectEncodingOptions & { flag?: string })
460 ): string | Buffer;
461}
462declare interface Readdir {
463 (
464 path: PathLike,
465 options:
466 | undefined
467 | null
468 | "ascii"
469 | "utf8"
470 | "utf-8"
471 | "utf16le"
472 | "utf-16le"
473 | "ucs2"
474 | "ucs-2"
475 | "base64"
476 | "base64url"
477 | "latin1"
478 | "binary"
479 | "hex"
480 | {
481 encoding:
482 | null
483 | "ascii"
484 | "utf8"
485 | "utf-8"
486 | "utf16le"
487 | "utf-16le"
488 | "ucs2"
489 | "ucs-2"
490 | "base64"
491 | "base64url"
492 | "latin1"
493 | "binary"
494 | "hex";
495 withFileTypes?: false;
496 recursive?: boolean;
497 },
498 callback: (arg0: null | NodeJS.ErrnoException, arg1?: string[]) => void
499 ): void;
500 (
501 path: PathLike,
502 options:
503 | { encoding: "buffer"; withFileTypes?: false; recursive?: boolean }
504 | "buffer",
505 callback: (arg0: null | NodeJS.ErrnoException, arg1?: Buffer[]) => void
506 ): void;
507 (
508 path: PathLike,
509 callback: (arg0: null | NodeJS.ErrnoException, arg1?: string[]) => void
510 ): void;
511 (
512 path: PathLike,
513 options:
514 | undefined
515 | null
516 | "ascii"
517 | "utf8"
518 | "utf-8"
519 | "utf16le"
520 | "utf-16le"
521 | "ucs2"
522 | "ucs-2"
523 | "base64"
524 | "base64url"
525 | "latin1"
526 | "binary"
527 | "hex"
528 | (ObjectEncodingOptions & {
529 withFileTypes?: false;
530 recursive?: boolean;
531 }),
532 callback: (
533 arg0: null | NodeJS.ErrnoException,
534 arg1?: string[] | Buffer[]
535 ) => void
536 ): void;
537 (
538 path: PathLike,
539 options: ObjectEncodingOptions & {
540 withFileTypes: true;
541 recursive?: boolean;
542 },
543 callback: (arg0: null | NodeJS.ErrnoException, arg1?: Dirent[]) => void
544 ): void;
545}
546declare interface ReaddirSync {
547 (
548 path: PathLike,
549 options?:
550 | null
551 | "ascii"
552 | "utf8"
553 | "utf-8"
554 | "utf16le"
555 | "utf-16le"
556 | "ucs2"
557 | "ucs-2"
558 | "base64"
559 | "base64url"
560 | "latin1"
561 | "binary"
562 | "hex"
563 | {
564 encoding:
565 | null
566 | "ascii"
567 | "utf8"
568 | "utf-8"
569 | "utf16le"
570 | "utf-16le"
571 | "ucs2"
572 | "ucs-2"
573 | "base64"
574 | "base64url"
575 | "latin1"
576 | "binary"
577 | "hex";
578 withFileTypes?: false;
579 recursive?: boolean;
580 }
581 ): string[];
582 (
583 path: PathLike,
584 options:
585 | "buffer"
586 | { encoding: "buffer"; withFileTypes?: false; recursive?: boolean }
587 ): Buffer[];
588 (
589 path: PathLike,
590 options?:
591 | null
592 | "ascii"
593 | "utf8"
594 | "utf-8"
595 | "utf16le"
596 | "utf-16le"
597 | "ucs2"
598 | "ucs-2"
599 | "base64"
600 | "base64url"
601 | "latin1"
602 | "binary"
603 | "hex"
604 | (ObjectEncodingOptions & { withFileTypes?: false; recursive?: boolean })
605 ): string[] | Buffer[];
606 (
607 path: PathLike,
608 options: ObjectEncodingOptions & {
609 withFileTypes: true;
610 recursive?: boolean;
611 }
612 ): Dirent[];
613}
614declare interface Readlink {
615 (
616 path: PathLike,
617 options: EncodingOption,
618 callback: (arg0: null | NodeJS.ErrnoException, arg1?: string) => void
619 ): void;
620 (
621 path: PathLike,
622 options: BufferEncodingOption,
623 callback: (arg0: null | NodeJS.ErrnoException, arg1?: Buffer) => void
624 ): void;
625 (
626 path: PathLike,
627 options: EncodingOption,
628 callback: (
629 arg0: null | NodeJS.ErrnoException,
630 arg1?: string | Buffer
631 ) => void
632 ): void;
633 (
634 path: PathLike,
635 callback: (arg0: null | NodeJS.ErrnoException, arg1?: string) => void
636 ): void;
637}
638declare interface ReadlinkSync {
639 (path: PathLike, options?: EncodingOption): string;
640 (path: PathLike, options: BufferEncodingOption): Buffer;
641 (path: PathLike, options?: EncodingOption): string | Buffer;
642}
643declare interface RealPath {
644 (
645 path: PathLike,
646 options: EncodingOption,
647 callback: (arg0: null | NodeJS.ErrnoException, arg1?: string) => void
648 ): void;
649 (
650 path: PathLike,
651 options: BufferEncodingOption,
652 callback: (arg0: null | NodeJS.ErrnoException, arg1?: Buffer) => void
653 ): void;
654 (
655 path: PathLike,
656 options: EncodingOption,
657 callback: (
658 arg0: null | NodeJS.ErrnoException,
659 arg1?: string | Buffer
660 ) => void
661 ): void;
662 (
663 path: PathLike,
664 callback: (arg0: null | NodeJS.ErrnoException, arg1?: string) => void
665 ): void;
666}
667declare interface RealPathSync {
668 (path: PathLike, options?: EncodingOption): string;
669 (path: PathLike, options: BufferEncodingOption): Buffer;
670 (path: PathLike, options?: EncodingOption): string | Buffer;
671}
672declare interface ResolveContext {
673 contextDependencies?: WriteOnlySet<string>;
674
675 /**
676 * files that was found on file system
677 */
678 fileDependencies?: WriteOnlySet<string>;
679
680 /**
681 * dependencies that was not found on file system
682 */
683 missingDependencies?: WriteOnlySet<string>;
684
685 /**
686 * set of hooks' calls. For instance, `resolve → parsedResolve → describedResolve`,
687 */
688 stack?: Set<string>;
689
690 /**
691 * log function
692 */
693 log?: (arg0: string) => void;
694
695 /**
696 * yield result, if provided plugins can return several results
697 */
698 yield?: (arg0: ResolveRequest) => void;
699}
700declare interface ResolveFunction {
701 (context: object, path: string, request: string): string | false;
702 (path: string, request: string): string | false;
703}
704declare interface ResolveFunctionAsync {
705 (
706 context: object,
707 path: string,
708 request: string,
709 resolveContext: ResolveContext,
710 callback: (
711 err: null | ErrorWithDetail,
712 res?: string | false,
713 req?: ResolveRequest
714 ) => void
715 ): void;
716 (
717 context: object,
718 path: string,
719 request: string,
720 callback: (
721 err: null | ErrorWithDetail,
722 res?: string | false,
723 req?: ResolveRequest
724 ) => void
725 ): void;
726 (
727 path: string,
728 request: string,
729 resolveContext: ResolveContext,
730 callback: (
731 err: null | ErrorWithDetail,
732 res?: string | false,
733 req?: ResolveRequest
734 ) => void
735 ): void;
736 (
737 path: string,
738 request: string,
739 callback: (
740 err: null | ErrorWithDetail,
741 res?: string | false,
742 req?: ResolveRequest
743 ) => void
744 ): void;
745}
746type ResolveOptionsOptionalFS = Omit<
747 ResolveOptionsResolverFactoryObject_2,
748 "fileSystem"
749> &
750 Partial<Pick<ResolveOptionsResolverFactoryObject_2, "fileSystem">>;
751declare interface ResolveOptionsResolverFactoryObject_1 {
752 alias: AliasOption[];
753 fallback: AliasOption[];
754 aliasFields: Set<string | string[]>;
755 extensionAlias: ExtensionAliasOption[];
756 cachePredicate: (arg0: ResolveRequest) => boolean;
757 cacheWithContext: boolean;
758
759 /**
760 * A list of exports field condition names.
761 */
762 conditionNames: Set<string>;
763 descriptionFiles: string[];
764 enforceExtension: boolean;
765 exportsFields: Set<string | string[]>;
766 importsFields: Set<string | string[]>;
767 extensions: Set<string>;
768 fileSystem: FileSystem;
769 unsafeCache: false | object;
770 symlinks: boolean;
771 resolver?: Resolver;
772 modules: (string | string[])[];
773 mainFields: { name: string[]; forceRelative: boolean }[];
774 mainFiles: Set<string>;
775 plugins: Plugin[];
776 pnpApi: null | PnpApi;
777 roots: Set<string>;
778 fullySpecified: boolean;
779 resolveToContext: boolean;
780 restrictions: Set<string | RegExp>;
781 preferRelative: boolean;
782 preferAbsolute: boolean;
783}
784declare interface ResolveOptionsResolverFactoryObject_2 {
785 /**
786 * A list of module alias configurations or an object which maps key to value
787 */
788 alias?: AliasOptions | AliasOption[];
789
790 /**
791 * A list of module alias configurations or an object which maps key to value, applied only after modules option
792 */
793 fallback?: AliasOptions | AliasOption[];
794
795 /**
796 * An object which maps extension to extension aliases
797 */
798 extensionAlias?: ExtensionAliasOptions;
799
800 /**
801 * A list of alias fields in description files
802 */
803 aliasFields?: (string | string[])[];
804
805 /**
806 * A function which decides whether a request should be cached or not. An object is passed with at least `path` and `request` properties.
807 */
808 cachePredicate?: (arg0: ResolveRequest) => boolean;
809
810 /**
811 * Whether or not the unsafeCache should include request context as part of the cache key.
812 */
813 cacheWithContext?: boolean;
814
815 /**
816 * A list of description files to read from
817 */
818 descriptionFiles?: string[];
819
820 /**
821 * A list of exports field condition names.
822 */
823 conditionNames?: string[];
824
825 /**
826 * Enforce that a extension from extensions must be used
827 */
828 enforceExtension?: boolean;
829
830 /**
831 * A list of exports fields in description files
832 */
833 exportsFields?: (string | string[])[];
834
835 /**
836 * A list of imports fields in description files
837 */
838 importsFields?: (string | string[])[];
839
840 /**
841 * A list of extensions which should be tried for files
842 */
843 extensions?: string[];
844
845 /**
846 * The file system which should be used
847 */
848 fileSystem: FileSystem;
849
850 /**
851 * Use this cache object to unsafely cache the successful requests
852 */
853 unsafeCache?: boolean | object;
854
855 /**
856 * Resolve symlinks to their symlinked location
857 */
858 symlinks?: boolean;
859
860 /**
861 * A prepared Resolver to which the plugins are attached
862 */
863 resolver?: Resolver;
864
865 /**
866 * A list of directories to resolve modules from, can be absolute path or folder name
867 */
868 modules?: string | string[];
869
870 /**
871 * A list of main fields in description files
872 */
873 mainFields?: (
874 | string
875 | string[]
876 | { name: string | string[]; forceRelative: boolean }
877 )[];
878
879 /**
880 * A list of main files in directories
881 */
882 mainFiles?: string[];
883
884 /**
885 * A list of additional resolve plugins which should be applied
886 */
887 plugins?: Plugin[];
888
889 /**
890 * A PnP API that should be used - null is "never", undefined is "auto"
891 */
892 pnpApi?: null | PnpApi;
893
894 /**
895 * A list of root paths
896 */
897 roots?: string[];
898
899 /**
900 * The request is already fully specified and no extensions or directories are resolved for it
901 */
902 fullySpecified?: boolean;
903
904 /**
905 * Resolve to a context instead of a file
906 */
907 resolveToContext?: boolean;
908
909 /**
910 * A list of resolve restrictions
911 */
912 restrictions?: (string | RegExp)[];
913
914 /**
915 * Use only the sync constraints of the file system calls
916 */
917 useSyncFileSystemCalls?: boolean;
918
919 /**
920 * Prefer to resolve module requests as relative requests before falling back to modules
921 */
922 preferRelative?: boolean;
923
924 /**
925 * Prefer to resolve server-relative urls as absolute paths before falling back to resolve in roots
926 */
927 preferAbsolute?: boolean;
928}
929type ResolveRequest = BaseResolveRequest & Partial<ParsedIdentifier>;
930declare abstract class Resolver {
931 fileSystem: FileSystem;
932 options: ResolveOptionsResolverFactoryObject_1;
933 hooks: KnownHooks;
934 ensureHook(
935 name:
936 | string
937 | AsyncSeriesBailHook<
938 [ResolveRequest, ResolveContext],
939 null | ResolveRequest
940 >
941 ): AsyncSeriesBailHook<
942 [ResolveRequest, ResolveContext],
943 null | ResolveRequest
944 >;
945 getHook(
946 name:
947 | string
948 | AsyncSeriesBailHook<
949 [ResolveRequest, ResolveContext],
950 null | ResolveRequest
951 >
952 ): AsyncSeriesBailHook<
953 [ResolveRequest, ResolveContext],
954 null | ResolveRequest
955 >;
956 resolveSync(context: object, path: string, request: string): string | false;
957 resolve(
958 context: object,
959 path: string,
960 request: string,
961 resolveContext: ResolveContext,
962 callback: (
963 err: null | ErrorWithDetail,
964 res?: string | false,
965 req?: ResolveRequest
966 ) => void
967 ): void;
968 doResolve(
969 hook: AsyncSeriesBailHook<
970 [ResolveRequest, ResolveContext],
971 null | ResolveRequest
972 >,
973 request: ResolveRequest,
974 message: null | string,
975 resolveContext: ResolveContext,
976 callback: (err?: null | Error, result?: ResolveRequest) => void
977 ): void;
978 parse(identifier: string): ParsedIdentifier;
979 isModule(path: string): boolean;
980 isPrivate(path: string): boolean;
981 isDirectory(path: string): boolean;
982 join(path: string, request: string): string;
983 normalize(path: string): string;
984}
985declare interface Stat {
986 (
987 path: PathLike,
988 callback: (arg0: null | NodeJS.ErrnoException, arg1?: IStats) => void
989 ): void;
990 (
991 path: PathLike,
992 options: undefined | (StatOptions & { bigint?: false }),
993 callback: (arg0: null | NodeJS.ErrnoException, arg1?: IStats) => void
994 ): void;
995 (
996 path: PathLike,
997 options: StatOptions & { bigint: true },
998 callback: (arg0: null | NodeJS.ErrnoException, arg1?: IBigIntStats) => void
999 ): void;
1000 (
1001 path: PathLike,
1002 options: undefined | StatOptions,
1003 callback: (
1004 arg0: null | NodeJS.ErrnoException,
1005 arg1?: IStats | IBigIntStats
1006 ) => void
1007 ): void;
1008}
1009declare interface StatOptions {
1010 bigint?: boolean;
1011}
1012declare interface StatSync {
1013 (path: PathLike, options?: undefined): IStats;
1014 (
1015 path: PathLike,
1016 options?: StatSyncOptions & { bigint?: false; throwIfNoEntry: false }
1017 ): undefined | IStats;
1018 (
1019 path: PathLike,
1020 options: StatSyncOptions & { bigint: true; throwIfNoEntry: false }
1021 ): undefined | IBigIntStats;
1022 (path: PathLike, options?: StatSyncOptions & { bigint?: false }): IStats;
1023 (path: PathLike, options: StatSyncOptions & { bigint: true }): IBigIntStats;
1024 (
1025 path: PathLike,
1026 options: StatSyncOptions & { bigint: boolean; throwIfNoEntry?: false }
1027 ): IStats | IBigIntStats;
1028 (path: PathLike, options?: StatSyncOptions):
1029 | undefined
1030 | IStats
1031 | IBigIntStats;
1032}
1033declare interface StatSyncOptions {
1034 bigint?: boolean;
1035 throwIfNoEntry?: boolean;
1036}
1037declare interface SyncFileSystem {
1038 readFileSync: ReadFileSync;
1039 readdirSync: ReaddirSync;
1040 readJsonSync?: (arg0: PathOrFileDescriptor) => JsonObject;
1041 readlinkSync: ReadlinkSync;
1042 lstatSync?: LStatSync;
1043 statSync: StatSync;
1044 realpathSync?: RealPathSync;
1045}
1046
1047/**
1048 * `URL` class is a global reference for `require('url').URL`
1049 * https://nodejs.org/api/url.html#the-whatwg-url-api
1050 */
1051declare interface URL_url extends URL_Import {}
1052declare interface WriteOnlySet<T> {
1053 add: (item: T) => void;
1054}
1055declare function exports(
1056 context: object,
1057 path: string,
1058 request: string,
1059 resolveContext: ResolveContext,
1060 callback: (
1061 err: null | ErrorWithDetail,
1062 res?: string | false,
1063 req?: ResolveRequest
1064 ) => void
1065): void;
1066declare function exports(
1067 context: object,
1068 path: string,
1069 request: string,
1070 callback: (
1071 err: null | ErrorWithDetail,
1072 res?: string | false,
1073 req?: ResolveRequest
1074 ) => void
1075): void;
1076declare function exports(
1077 path: string,
1078 request: string,
1079 resolveContext: ResolveContext,
1080 callback: (
1081 err: null | ErrorWithDetail,
1082 res?: string | false,
1083 req?: ResolveRequest
1084 ) => void
1085): void;
1086declare function exports(
1087 path: string,
1088 request: string,
1089 callback: (
1090 err: null | ErrorWithDetail,
1091 res?: string | false,
1092 req?: ResolveRequest
1093 ) => void
1094): void;
1095declare namespace exports {
1096 export const sync: ResolveFunction;
1097 export function create(
1098 options: ResolveOptionsOptionalFS
1099 ): ResolveFunctionAsync;
1100 export namespace create {
1101 export const sync: (options: ResolveOptionsOptionalFS) => ResolveFunction;
1102 }
1103 export namespace ResolverFactory {
1104 export let createResolver: (
1105 options: ResolveOptionsResolverFactoryObject_2
1106 ) => Resolver;
1107 }
1108 export const forEachBail: <T, Z>(
1109 array: T[],
1110 iterator: Iterator<T, Z>,
1111 callback: (err?: null | Error, result?: null | Z) => void
1112 ) => void;
1113 export type ResolveCallback = (
1114 err: null | ErrorWithDetail,
1115 res?: string | false,
1116 req?: ResolveRequest
1117 ) => void;
1118 export {
1119 CachedInputFileSystem,
1120 CloneBasenamePlugin,
1121 LogInfoPlugin,
1122 ResolveOptionsOptionalFS,
1123 PnpApi,
1124 Resolver,
1125 FileSystem,
1126 ResolveContext,
1127 ResolveRequest,
1128 Plugin,
1129 ResolveOptionsResolverFactoryObject_2 as ResolveOptions,
1130 ResolveFunctionAsync,
1131 ResolveFunction
1132 };
1133}
1134
1135export = exports;