@rspack/core 1.0.14 → 1.1.0

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.
Files changed (46) hide show
  1. package/compiled/@swc/types/index.d.ts +1962 -0
  2. package/compiled/@swc/types/index.js +19 -0
  3. package/compiled/@swc/types/license +201 -0
  4. package/compiled/@swc/types/package.json +1 -0
  5. package/compiled/enhanced-resolve/CachedInputFileSystem.js +267 -80
  6. package/compiled/enhanced-resolve/index.d.ts +849 -236
  7. package/compiled/enhanced-resolve/package.json +1 -1
  8. package/compiled/graceful-fs/index.js +10 -10
  9. package/compiled/graceful-fs/package.json +1 -1
  10. package/compiled/zod/index.d.ts +2 -2
  11. package/dist/Compilation.d.ts +7 -18
  12. package/dist/DependenciesBlock.d.ts +6 -4
  13. package/dist/FileSystem.d.ts +7 -2
  14. package/dist/Module.d.ts +17 -14
  15. package/dist/builtin-loader/swc/types.d.ts +9 -435
  16. package/dist/builtin-plugin/EntryPlugin.d.ts +14 -11
  17. package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +10 -10
  18. package/dist/builtin-plugin/HtmlRspackPlugin.d.ts +1 -1
  19. package/dist/builtin-plugin/MangleExportsPlugin.d.ts +10 -10
  20. package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +8 -10
  21. package/dist/builtin-plugin/RemoveDuplicateModulesPlugin.d.ts +10 -0
  22. package/dist/builtin-plugin/SizeLimitsPlugin.d.ts +8 -8
  23. package/dist/builtin-plugin/SplitChunksPlugin.d.ts +1 -1
  24. package/dist/builtin-plugin/index.d.ts +4 -2
  25. package/dist/builtin-plugin/lazy-compilation/lazyCompilation.d.ts +3 -3
  26. package/dist/builtin-plugin/lazy-compilation/plugin.d.ts +3 -3
  27. package/dist/config/adapter.d.ts +1 -1
  28. package/dist/config/adapterRuleUse.d.ts +1 -1
  29. package/dist/config/index.d.ts +1 -0
  30. package/dist/config/normalization.d.ts +4 -11
  31. package/dist/config/types.d.ts +417 -9
  32. package/dist/config/zod.d.ts +1044 -1303
  33. package/dist/exports.d.ts +4 -2
  34. package/dist/index.d.ts +1 -0
  35. package/dist/index.js +1023 -5103
  36. package/dist/util/ArrayQueue.d.ts +1 -9
  37. package/dist/util/asyncLib.d.ts +54 -0
  38. package/package.json +9 -9
  39. package/dist/builtin-loader/swc/react.d.ts +0 -15
  40. package/dist/lib/Dependency.d.ts +0 -23
  41. package/dist/lib/formatLocation.d.ts +0 -16
  42. package/dist/logging/runtime.d.ts +0 -16
  43. package/dist/util/IterableHelpers.d.ts +0 -12
  44. package/dist/util/scheme.d.ts +0 -6
  45. package/dist/util/webpack.d.ts +0 -4
  46. /package/dist/builtin-plugin/{LightningCssMiminizerRspackPlugin.d.ts → LightningCssMinimizerRspackPlugin.d.ts} +0 -0
@@ -1,4 +1,6 @@
1
- import { SyncHook, AsyncSeriesBailHook, AsyncSeriesHook } from 'tapable';
1
+ import { Buffer } from 'buffer';
2
+ import { AsyncSeriesBailHook, SyncHook, AsyncSeriesHook } from 'tapable';
3
+ import { URL } from 'url';
2
4
 
3
5
  /*
4
6
  * This file was automatically generated.
@@ -8,8 +10,15 @@ import { SyncHook, AsyncSeriesBailHook, AsyncSeriesHook } from 'tapable';
8
10
 
9
11
 
10
12
 
13
+ declare interface Abortable {
14
+ /**
15
+ * When provided the corresponding `AbortController` can be used to cancel an asynchronous action.
16
+ */
17
+ signal?: AbortSignal;
18
+ }
19
+ type Alias = string | false | string[];
11
20
  declare interface AliasOption {
12
- alias: string | false | string[];
21
+ alias: Alias;
13
22
  name: string;
14
23
  onlyModule?: boolean;
15
24
  }
@@ -17,82 +26,124 @@ type AliasOptionNewRequest = string | false | string[];
17
26
  declare interface AliasOptions {
18
27
  [index: string]: AliasOptionNewRequest;
19
28
  }
29
+ type BaseFileSystem = FileSystem & SyncFileSystem;
20
30
  declare interface BaseResolveRequest {
21
31
  path: string | false;
32
+ context?: object;
22
33
  descriptionFilePath?: string;
23
34
  descriptionFileRoot?: string;
24
- descriptionFileData?: object;
35
+ descriptionFileData?: JsonObject;
25
36
  relativePath?: string;
26
37
  ignoreSymlinks?: boolean;
27
38
  fullySpecified?: boolean;
39
+ __innerRequest?: string;
40
+ __innerRequest_request?: string;
41
+ __innerRequest_relativePath?: string;
28
42
  }
43
+ type BufferEncoding =
44
+ | "ascii"
45
+ | "utf8"
46
+ | "utf-8"
47
+ | "utf16le"
48
+ | "utf-16le"
49
+ | "ucs2"
50
+ | "ucs-2"
51
+ | "base64"
52
+ | "base64url"
53
+ | "latin1"
54
+ | "binary"
55
+ | "hex";
56
+ type BufferEncodingOption = "buffer" | { encoding: "buffer" };
29
57
  declare class CachedInputFileSystem {
30
- constructor(fileSystem?: any, duration?: any);
31
- fileSystem: any;
32
- lstat?: {
33
- (arg0: string, arg1: FileSystemCallback<FileSystemStats>): void;
34
- (
35
- arg0: string,
36
- arg1: object,
37
- arg2: FileSystemCallback<string | Buffer>
38
- ): void;
39
- };
40
- lstatSync?: (arg0: string, arg1?: object) => FileSystemStats;
41
- stat: {
42
- (arg0: string, arg1: FileSystemCallback<FileSystemStats>): void;
43
- (
44
- arg0: string,
45
- arg1: object,
46
- arg2: FileSystemCallback<string | Buffer>
47
- ): void;
48
- };
49
- statSync: (arg0: string, arg1?: object) => FileSystemStats;
50
- readdir: {
51
- (
52
- arg0: string,
53
- arg1: FileSystemCallback<(string | Buffer)[] | FileSystemDirent[]>
54
- ): void;
55
- (
56
- arg0: string,
57
- arg1: object,
58
- arg2: FileSystemCallback<(string | Buffer)[] | FileSystemDirent[]>
59
- ): void;
60
- };
61
- readdirSync: (
62
- arg0: string,
63
- arg1?: object
64
- ) => (string | Buffer)[] | FileSystemDirent[];
65
- readFile: {
66
- (arg0: string, arg1: FileSystemCallback<string | Buffer>): void;
67
- (
68
- arg0: string,
69
- arg1: object,
70
- arg2: FileSystemCallback<string | Buffer>
71
- ): void;
72
- };
73
- readFileSync: (arg0: string, arg1?: object) => string | Buffer;
74
- readJson?: {
75
- (arg0: string, arg1: FileSystemCallback<object>): void;
76
- (arg0: string, arg1: object, arg2: FileSystemCallback<object>): void;
77
- };
78
- readJsonSync?: (arg0: string, arg1?: object) => object;
79
- readlink: {
80
- (arg0: string, arg1: FileSystemCallback<string | Buffer>): void;
81
- (
82
- arg0: string,
83
- arg1: object,
84
- arg2: FileSystemCallback<string | Buffer>
85
- ): void;
86
- };
87
- readlinkSync: (arg0: string, arg1?: object) => string | Buffer;
88
- purge(what?: any): void;
58
+ constructor(fileSystem: BaseFileSystem, duration: number);
59
+ fileSystem: BaseFileSystem;
60
+ lstat?: LStat;
61
+ lstatSync?: LStatSync;
62
+ stat: Stat;
63
+ statSync: StatSync;
64
+ readdir: Readdir;
65
+ readdirSync: ReaddirSync;
66
+ readFile: ReadFile;
67
+ readFileSync: ReadFileSync;
68
+ readJson?: (
69
+ arg0: PathOrFileDescriptor,
70
+ arg1: (
71
+ arg0: null | Error | NodeJS.ErrnoException,
72
+ arg1?: JsonObject
73
+ ) => void
74
+ ) => void;
75
+ readJsonSync?: (arg0: PathOrFileDescriptor) => JsonObject;
76
+ readlink: Readlink;
77
+ readlinkSync: ReadlinkSync;
78
+ realpath?: RealPath;
79
+ realpathSync?: RealPathSync;
80
+ purge(
81
+ what?:
82
+ | string
83
+ | number
84
+ | Buffer
85
+ | URL_url
86
+ | (string | number | Buffer | URL_url)[]
87
+ | Set<string | number | Buffer | URL_url>
88
+ ): void;
89
89
  }
90
90
  declare class CloneBasenamePlugin {
91
- constructor(source?: any, target?: any);
92
- source: any;
93
- target: any;
91
+ constructor(
92
+ source:
93
+ | string
94
+ | AsyncSeriesBailHook<
95
+ [ResolveRequest, ResolveContext],
96
+ null | ResolveRequest
97
+ >,
98
+ target:
99
+ | string
100
+ | AsyncSeriesBailHook<
101
+ [ResolveRequest, ResolveContext],
102
+ null | ResolveRequest
103
+ >
104
+ );
105
+ source:
106
+ | string
107
+ | AsyncSeriesBailHook<
108
+ [ResolveRequest, ResolveContext],
109
+ null | ResolveRequest
110
+ >;
111
+ target:
112
+ | string
113
+ | AsyncSeriesBailHook<
114
+ [ResolveRequest, ResolveContext],
115
+ null | ResolveRequest
116
+ >;
94
117
  apply(resolver: Resolver): void;
95
118
  }
119
+ declare interface Dirent {
120
+ isFile: () => boolean;
121
+ isDirectory: () => boolean;
122
+ isBlockDevice: () => boolean;
123
+ isCharacterDevice: () => boolean;
124
+ isSymbolicLink: () => boolean;
125
+ isFIFO: () => boolean;
126
+ isSocket: () => boolean;
127
+ name: string;
128
+ path: string;
129
+ }
130
+ type EncodingOption =
131
+ | undefined
132
+ | null
133
+ | "ascii"
134
+ | "utf8"
135
+ | "utf-8"
136
+ | "utf16le"
137
+ | "utf-16le"
138
+ | "ucs2"
139
+ | "ucs-2"
140
+ | "base64"
141
+ | "base64url"
142
+ | "latin1"
143
+ | "binary"
144
+ | "hex"
145
+ | ObjectEncodingOptions;
146
+ type ErrorWithDetail = Error & { details?: string };
96
147
  declare interface ExtensionAliasOption {
97
148
  alias: string | string[];
98
149
  extension: string;
@@ -101,71 +152,193 @@ declare interface ExtensionAliasOptions {
101
152
  [index: string]: string | string[];
102
153
  }
103
154
  declare interface FileSystem {
104
- readFile: {
105
- (arg0: string, arg1: FileSystemCallback<string | Buffer>): void;
106
- (
107
- arg0: string,
108
- arg1: object,
109
- arg2: FileSystemCallback<string | Buffer>
110
- ): void;
111
- };
112
- readdir: {
113
- (
114
- arg0: string,
115
- arg1: FileSystemCallback<(string | Buffer)[] | FileSystemDirent[]>
116
- ): void;
117
- (
118
- arg0: string,
119
- arg1: object,
120
- arg2: FileSystemCallback<(string | Buffer)[] | FileSystemDirent[]>
121
- ): void;
122
- };
123
- readJson?: {
124
- (arg0: string, arg1: FileSystemCallback<object>): void;
125
- (arg0: string, arg1: object, arg2: FileSystemCallback<object>): void;
126
- };
127
- readlink: {
128
- (arg0: string, arg1: FileSystemCallback<string | Buffer>): void;
129
- (
130
- arg0: string,
131
- arg1: object,
132
- arg2: FileSystemCallback<string | Buffer>
133
- ): void;
134
- };
135
- lstat?: {
136
- (arg0: string, arg1: FileSystemCallback<FileSystemStats>): void;
137
- (
138
- arg0: string,
139
- arg1: object,
140
- arg2: FileSystemCallback<string | Buffer>
141
- ): void;
142
- };
143
- stat: {
144
- (arg0: string, arg1: FileSystemCallback<FileSystemStats>): void;
145
- (
146
- arg0: string,
147
- arg1: object,
148
- arg2: FileSystemCallback<string | Buffer>
149
- ): void;
150
- };
151
- }
152
- declare interface FileSystemCallback<T> {
153
- (err?: null | (PossibleFileSystemError & Error), result?: T): any;
154
- }
155
- declare interface FileSystemDirent {
156
- name: string | Buffer;
157
- isDirectory: () => boolean;
158
- isFile: () => boolean;
155
+ readFile: ReadFile;
156
+ readdir: Readdir;
157
+ readJson?: (
158
+ arg0: PathOrFileDescriptor,
159
+ arg1: (
160
+ arg0: null | Error | NodeJS.ErrnoException,
161
+ arg1?: JsonObject
162
+ ) => void
163
+ ) => void;
164
+ readlink: Readlink;
165
+ lstat?: LStat;
166
+ stat: Stat;
167
+ realpath?: RealPath;
159
168
  }
160
- declare interface FileSystemStats {
169
+ type IBigIntStats = IStatsBase<bigint> & {
170
+ atimeNs: bigint;
171
+ mtimeNs: bigint;
172
+ ctimeNs: bigint;
173
+ birthtimeNs: bigint;
174
+ };
175
+ declare interface IStats {
176
+ isFile: () => boolean;
161
177
  isDirectory: () => boolean;
178
+ isBlockDevice: () => boolean;
179
+ isCharacterDevice: () => boolean;
180
+ isSymbolicLink: () => boolean;
181
+ isFIFO: () => boolean;
182
+ isSocket: () => boolean;
183
+ dev: number;
184
+ ino: number;
185
+ mode: number;
186
+ nlink: number;
187
+ uid: number;
188
+ gid: number;
189
+ rdev: number;
190
+ size: number;
191
+ blksize: number;
192
+ blocks: number;
193
+ atimeMs: number;
194
+ mtimeMs: number;
195
+ ctimeMs: number;
196
+ birthtimeMs: number;
197
+ atime: Date;
198
+ mtime: Date;
199
+ ctime: Date;
200
+ birthtime: Date;
201
+ }
202
+ declare interface IStatsBase<T> {
162
203
  isFile: () => boolean;
204
+ isDirectory: () => boolean;
205
+ isBlockDevice: () => boolean;
206
+ isCharacterDevice: () => boolean;
207
+ isSymbolicLink: () => boolean;
208
+ isFIFO: () => boolean;
209
+ isSocket: () => boolean;
210
+ dev: T;
211
+ ino: T;
212
+ mode: T;
213
+ nlink: T;
214
+ uid: T;
215
+ gid: T;
216
+ rdev: T;
217
+ size: T;
218
+ blksize: T;
219
+ blocks: T;
220
+ atimeMs: T;
221
+ mtimeMs: T;
222
+ ctimeMs: T;
223
+ birthtimeMs: T;
224
+ atime: Date;
225
+ mtime: Date;
226
+ ctime: Date;
227
+ birthtime: Date;
228
+ }
229
+ declare interface Iterator<T, Z> {
230
+ (
231
+ item: T,
232
+ callback: (err?: null | Error, result?: null | Z) => void,
233
+ i: number
234
+ ): void;
235
+ }
236
+ type JsonObject = { [index: string]: JsonValue } & {
237
+ [index: string]:
238
+ | undefined
239
+ | null
240
+ | string
241
+ | number
242
+ | boolean
243
+ | JsonObject
244
+ | JsonValue[];
245
+ };
246
+ type JsonValue = null | string | number | boolean | JsonObject | JsonValue[];
247
+ declare interface KnownHooks {
248
+ resolveStep: SyncHook<
249
+ [
250
+ AsyncSeriesBailHook<
251
+ [ResolveRequest, ResolveContext],
252
+ null | ResolveRequest
253
+ >,
254
+ ResolveRequest
255
+ ]
256
+ >;
257
+ noResolve: SyncHook<[ResolveRequest, Error]>;
258
+ resolve: AsyncSeriesBailHook<
259
+ [ResolveRequest, ResolveContext],
260
+ null | ResolveRequest
261
+ >;
262
+ result: AsyncSeriesHook<[ResolveRequest, ResolveContext]>;
263
+ }
264
+ declare interface LStat {
265
+ (
266
+ path: PathLike,
267
+ callback: (arg0: null | NodeJS.ErrnoException, arg1?: IStats) => void
268
+ ): void;
269
+ (
270
+ path: PathLike,
271
+ options: undefined | (StatOptions & { bigint?: false }),
272
+ callback: (arg0: null | NodeJS.ErrnoException, arg1?: IStats) => void
273
+ ): void;
274
+ (
275
+ path: PathLike,
276
+ options: StatOptions & { bigint: true },
277
+ callback: (arg0: null | NodeJS.ErrnoException, arg1?: IBigIntStats) => void
278
+ ): void;
279
+ (
280
+ path: PathLike,
281
+ options: undefined | StatOptions,
282
+ callback: (
283
+ arg0: null | NodeJS.ErrnoException,
284
+ arg1?: IStats | IBigIntStats
285
+ ) => void
286
+ ): void;
287
+ }
288
+ declare interface LStatSync {
289
+ (path: PathLike, options?: undefined): IStats;
290
+ (
291
+ path: PathLike,
292
+ options?: StatSyncOptions & { bigint?: false; throwIfNoEntry: false }
293
+ ): undefined | IStats;
294
+ (
295
+ path: PathLike,
296
+ options: StatSyncOptions & { bigint: true; throwIfNoEntry: false }
297
+ ): undefined | IBigIntStats;
298
+ (path: PathLike, options?: StatSyncOptions & { bigint?: false }): IStats;
299
+ (path: PathLike, options: StatSyncOptions & { bigint: true }): IBigIntStats;
300
+ (
301
+ path: PathLike,
302
+ options: StatSyncOptions & { bigint: boolean; throwIfNoEntry?: false }
303
+ ): IStats | IBigIntStats;
304
+ (path: PathLike, options?: StatSyncOptions):
305
+ | undefined
306
+ | IStats
307
+ | IBigIntStats;
163
308
  }
164
309
  declare class LogInfoPlugin {
165
- constructor(source?: any);
166
- source: any;
310
+ constructor(
311
+ source:
312
+ | string
313
+ | AsyncSeriesBailHook<
314
+ [ResolveRequest, ResolveContext],
315
+ null | ResolveRequest
316
+ >
317
+ );
318
+ source:
319
+ | string
320
+ | AsyncSeriesBailHook<
321
+ [ResolveRequest, ResolveContext],
322
+ null | ResolveRequest
323
+ >;
167
324
  apply(resolver: Resolver): void;
168
325
  }
326
+ declare interface ObjectEncodingOptions {
327
+ encoding?:
328
+ | null
329
+ | "ascii"
330
+ | "utf8"
331
+ | "utf-8"
332
+ | "utf16le"
333
+ | "utf-16le"
334
+ | "ucs2"
335
+ | "ucs-2"
336
+ | "base64"
337
+ | "base64url"
338
+ | "latin1"
339
+ | "binary"
340
+ | "hex";
341
+ }
169
342
  declare interface ParsedIdentifier {
170
343
  request: string;
171
344
  query: string;
@@ -175,22 +348,329 @@ declare interface ParsedIdentifier {
175
348
  file: boolean;
176
349
  internal: boolean;
177
350
  }
351
+ type PathLike = string | Buffer | URL_url;
352
+ type PathOrFileDescriptor = string | number | Buffer | URL_url;
178
353
  type Plugin =
354
+ | undefined
355
+ | null
356
+ | false
357
+ | ""
358
+ | 0
179
359
  | { apply: (arg0: Resolver) => void }
180
360
  | ((this: Resolver, arg1: Resolver) => void);
181
- declare interface PnpApiImpl {
182
- resolveToUnqualified: (arg0: string, arg1: string, arg2: object) => string;
361
+ declare interface PnpApi {
362
+ resolveToUnqualified: (
363
+ arg0: string,
364
+ arg1: string,
365
+ arg2: object
366
+ ) => null | string;
183
367
  }
184
- declare interface PossibleFileSystemError {
185
- code?: string;
186
- errno?: number;
187
- path?: string;
188
- syscall?: string;
368
+ declare interface ReadFile {
369
+ (
370
+ path: PathOrFileDescriptor,
371
+ options:
372
+ | undefined
373
+ | null
374
+ | ({ encoding?: null; flag?: string } & Abortable),
375
+ callback: (arg0: null | NodeJS.ErrnoException, arg1?: Buffer) => void
376
+ ): void;
377
+ (
378
+ path: PathOrFileDescriptor,
379
+ options:
380
+ | ({ encoding: BufferEncoding; flag?: string } & Abortable)
381
+ | "ascii"
382
+ | "utf8"
383
+ | "utf-8"
384
+ | "utf16le"
385
+ | "utf-16le"
386
+ | "ucs2"
387
+ | "ucs-2"
388
+ | "base64"
389
+ | "base64url"
390
+ | "latin1"
391
+ | "binary"
392
+ | "hex",
393
+ callback: (arg0: null | NodeJS.ErrnoException, arg1?: string) => void
394
+ ): void;
395
+ (
396
+ path: PathOrFileDescriptor,
397
+ options:
398
+ | undefined
399
+ | null
400
+ | "ascii"
401
+ | "utf8"
402
+ | "utf-8"
403
+ | "utf16le"
404
+ | "utf-16le"
405
+ | "ucs2"
406
+ | "ucs-2"
407
+ | "base64"
408
+ | "base64url"
409
+ | "latin1"
410
+ | "binary"
411
+ | "hex"
412
+ | (ObjectEncodingOptions & { flag?: string } & Abortable),
413
+ callback: (
414
+ arg0: null | NodeJS.ErrnoException,
415
+ arg1?: string | Buffer
416
+ ) => void
417
+ ): void;
418
+ (
419
+ path: PathOrFileDescriptor,
420
+ callback: (arg0: null | NodeJS.ErrnoException, arg1?: Buffer) => void
421
+ ): void;
422
+ }
423
+ declare interface ReadFileSync {
424
+ (
425
+ path: PathOrFileDescriptor,
426
+ options?: null | { encoding?: null; flag?: string }
427
+ ): Buffer;
428
+ (
429
+ path: PathOrFileDescriptor,
430
+ options:
431
+ | "ascii"
432
+ | "utf8"
433
+ | "utf-8"
434
+ | "utf16le"
435
+ | "utf-16le"
436
+ | "ucs2"
437
+ | "ucs-2"
438
+ | "base64"
439
+ | "base64url"
440
+ | "latin1"
441
+ | "binary"
442
+ | "hex"
443
+ | { encoding: BufferEncoding; flag?: string }
444
+ ): string;
445
+ (
446
+ path: PathOrFileDescriptor,
447
+ options?:
448
+ | null
449
+ | "ascii"
450
+ | "utf8"
451
+ | "utf-8"
452
+ | "utf16le"
453
+ | "utf-16le"
454
+ | "ucs2"
455
+ | "ucs-2"
456
+ | "base64"
457
+ | "base64url"
458
+ | "latin1"
459
+ | "binary"
460
+ | "hex"
461
+ | (ObjectEncodingOptions & { flag?: string })
462
+ ): string | Buffer;
463
+ }
464
+ declare interface Readdir {
465
+ (
466
+ path: PathLike,
467
+ options:
468
+ | undefined
469
+ | null
470
+ | "ascii"
471
+ | "utf8"
472
+ | "utf-8"
473
+ | "utf16le"
474
+ | "utf-16le"
475
+ | "ucs2"
476
+ | "ucs-2"
477
+ | "base64"
478
+ | "base64url"
479
+ | "latin1"
480
+ | "binary"
481
+ | "hex"
482
+ | {
483
+ encoding:
484
+ | null
485
+ | "ascii"
486
+ | "utf8"
487
+ | "utf-8"
488
+ | "utf16le"
489
+ | "utf-16le"
490
+ | "ucs2"
491
+ | "ucs-2"
492
+ | "base64"
493
+ | "base64url"
494
+ | "latin1"
495
+ | "binary"
496
+ | "hex";
497
+ withFileTypes?: false;
498
+ recursive?: boolean;
499
+ },
500
+ callback: (arg0: null | NodeJS.ErrnoException, arg1?: string[]) => void
501
+ ): void;
502
+ (
503
+ path: PathLike,
504
+ options:
505
+ | { encoding: "buffer"; withFileTypes?: false; recursive?: boolean }
506
+ | "buffer",
507
+ callback: (arg0: null | NodeJS.ErrnoException, arg1?: Buffer[]) => void
508
+ ): void;
509
+ (
510
+ path: PathLike,
511
+ callback: (arg0: null | NodeJS.ErrnoException, arg1?: string[]) => void
512
+ ): void;
513
+ (
514
+ path: PathLike,
515
+ options:
516
+ | undefined
517
+ | null
518
+ | "ascii"
519
+ | "utf8"
520
+ | "utf-8"
521
+ | "utf16le"
522
+ | "utf-16le"
523
+ | "ucs2"
524
+ | "ucs-2"
525
+ | "base64"
526
+ | "base64url"
527
+ | "latin1"
528
+ | "binary"
529
+ | "hex"
530
+ | (ObjectEncodingOptions & {
531
+ withFileTypes?: false;
532
+ recursive?: boolean;
533
+ }),
534
+ callback: (
535
+ arg0: null | NodeJS.ErrnoException,
536
+ arg1?: string[] | Buffer[]
537
+ ) => void
538
+ ): void;
539
+ (
540
+ path: PathLike,
541
+ options: ObjectEncodingOptions & {
542
+ withFileTypes: true;
543
+ recursive?: boolean;
544
+ },
545
+ callback: (arg0: null | NodeJS.ErrnoException, arg1?: Dirent[]) => void
546
+ ): void;
547
+ }
548
+ declare interface ReaddirSync {
549
+ (
550
+ path: PathLike,
551
+ options?:
552
+ | null
553
+ | "ascii"
554
+ | "utf8"
555
+ | "utf-8"
556
+ | "utf16le"
557
+ | "utf-16le"
558
+ | "ucs2"
559
+ | "ucs-2"
560
+ | "base64"
561
+ | "base64url"
562
+ | "latin1"
563
+ | "binary"
564
+ | "hex"
565
+ | {
566
+ encoding:
567
+ | null
568
+ | "ascii"
569
+ | "utf8"
570
+ | "utf-8"
571
+ | "utf16le"
572
+ | "utf-16le"
573
+ | "ucs2"
574
+ | "ucs-2"
575
+ | "base64"
576
+ | "base64url"
577
+ | "latin1"
578
+ | "binary"
579
+ | "hex";
580
+ withFileTypes?: false;
581
+ recursive?: boolean;
582
+ }
583
+ ): string[];
584
+ (
585
+ path: PathLike,
586
+ options:
587
+ | "buffer"
588
+ | { encoding: "buffer"; withFileTypes?: false; recursive?: boolean }
589
+ ): Buffer[];
590
+ (
591
+ path: PathLike,
592
+ options?:
593
+ | null
594
+ | "ascii"
595
+ | "utf8"
596
+ | "utf-8"
597
+ | "utf16le"
598
+ | "utf-16le"
599
+ | "ucs2"
600
+ | "ucs-2"
601
+ | "base64"
602
+ | "base64url"
603
+ | "latin1"
604
+ | "binary"
605
+ | "hex"
606
+ | (ObjectEncodingOptions & { withFileTypes?: false; recursive?: boolean })
607
+ ): string[] | Buffer[];
608
+ (
609
+ path: PathLike,
610
+ options: ObjectEncodingOptions & {
611
+ withFileTypes: true;
612
+ recursive?: boolean;
613
+ }
614
+ ): Dirent[];
615
+ }
616
+ declare interface Readlink {
617
+ (
618
+ path: PathLike,
619
+ options: EncodingOption,
620
+ callback: (arg0: null | NodeJS.ErrnoException, arg1?: string) => void
621
+ ): void;
622
+ (
623
+ path: PathLike,
624
+ options: BufferEncodingOption,
625
+ callback: (arg0: null | NodeJS.ErrnoException, arg1?: Buffer) => void
626
+ ): void;
627
+ (
628
+ path: PathLike,
629
+ options: EncodingOption,
630
+ callback: (
631
+ arg0: null | NodeJS.ErrnoException,
632
+ arg1?: string | Buffer
633
+ ) => void
634
+ ): void;
635
+ (
636
+ path: PathLike,
637
+ callback: (arg0: null | NodeJS.ErrnoException, arg1?: string) => void
638
+ ): void;
639
+ }
640
+ declare interface ReadlinkSync {
641
+ (path: PathLike, options?: EncodingOption): string;
642
+ (path: PathLike, options: BufferEncodingOption): Buffer;
643
+ (path: PathLike, options?: EncodingOption): string | Buffer;
644
+ }
645
+ declare interface RealPath {
646
+ (
647
+ path: PathLike,
648
+ options: EncodingOption,
649
+ callback: (arg0: null | NodeJS.ErrnoException, arg1?: string) => void
650
+ ): void;
651
+ (
652
+ path: PathLike,
653
+ options: BufferEncodingOption,
654
+ callback: (arg0: null | NodeJS.ErrnoException, arg1?: Buffer) => void
655
+ ): void;
656
+ (
657
+ path: PathLike,
658
+ options: EncodingOption,
659
+ callback: (
660
+ arg0: null | NodeJS.ErrnoException,
661
+ arg1?: string | Buffer
662
+ ) => void
663
+ ): void;
664
+ (
665
+ path: PathLike,
666
+ callback: (arg0: null | NodeJS.ErrnoException, arg1?: string) => void
667
+ ): void;
668
+ }
669
+ declare interface RealPathSync {
670
+ (path: PathLike, options?: EncodingOption): string;
671
+ (path: PathLike, options: BufferEncodingOption): Buffer;
672
+ (path: PathLike, options?: EncodingOption): string | Buffer;
189
673
  }
190
-
191
- /**
192
- * Resolve context
193
- */
194
674
  declare interface ResolveContext {
195
675
  contextDependencies?: WriteOnlySet<string>;
196
676
 
@@ -219,7 +699,58 @@ declare interface ResolveContext {
219
699
  */
220
700
  yield?: (arg0: ResolveRequest) => void;
221
701
  }
222
- declare interface ResolveOptions {
702
+ declare interface ResolveFunction {
703
+ (context: object, path: string, request: string): string | false;
704
+ (path: string, request: string): string | false;
705
+ }
706
+ declare interface ResolveFunctionAsync {
707
+ (
708
+ context: object,
709
+ path: string,
710
+ request: string,
711
+ resolveContext: ResolveContext,
712
+ callback: (
713
+ err: null | ErrorWithDetail,
714
+ res?: string | false,
715
+ req?: ResolveRequest
716
+ ) => void
717
+ ): void;
718
+ (
719
+ context: object,
720
+ path: string,
721
+ request: string,
722
+ callback: (
723
+ err: null | ErrorWithDetail,
724
+ res?: string | false,
725
+ req?: ResolveRequest
726
+ ) => void
727
+ ): void;
728
+ (
729
+ path: string,
730
+ request: string,
731
+ resolveContext: ResolveContext,
732
+ callback: (
733
+ err: null | ErrorWithDetail,
734
+ res?: string | false,
735
+ req?: ResolveRequest
736
+ ) => void
737
+ ): void;
738
+ (
739
+ path: string,
740
+ request: string,
741
+ callback: (
742
+ err: null | ErrorWithDetail,
743
+ res?: string | false,
744
+ req?: ResolveRequest
745
+ ) => void
746
+ ): void;
747
+ }
748
+ type ResolveOptionsOptionalFS = Omit<
749
+ ResolveOptionsResolverFactoryObject_2,
750
+ "fileSystem"
751
+ > &
752
+ Partial<Pick<ResolveOptionsResolverFactoryObject_2, "fileSystem">>;
753
+ declare interface ResolveOptionsResolverFactoryObject_1 {
223
754
  alias: AliasOption[];
224
755
  fallback: AliasOption[];
225
756
  aliasFields: Set<string | string[]>;
@@ -244,7 +775,7 @@ declare interface ResolveOptions {
244
775
  mainFields: { name: string[]; forceRelative: boolean }[];
245
776
  mainFiles: Set<string>;
246
777
  plugins: Plugin[];
247
- pnpApi: null | PnpApiImpl;
778
+ pnpApi: null | PnpApi;
248
779
  roots: Set<string>;
249
780
  fullySpecified: boolean;
250
781
  resolveToContext: boolean;
@@ -252,76 +783,7 @@ declare interface ResolveOptions {
252
783
  preferRelative: boolean;
253
784
  preferAbsolute: boolean;
254
785
  }
255
- export type ResolveRequest = BaseResolveRequest & Partial<ParsedIdentifier>;
256
- declare abstract class Resolver {
257
- fileSystem: FileSystem;
258
- options: ResolveOptions;
259
- hooks: {
260
- resolveStep: SyncHook<
261
- [
262
- AsyncSeriesBailHook<
263
- [ResolveRequest, ResolveContext],
264
- null | ResolveRequest
265
- >,
266
- ResolveRequest
267
- ]
268
- >;
269
- noResolve: SyncHook<[ResolveRequest, Error]>;
270
- resolve: AsyncSeriesBailHook<
271
- [ResolveRequest, ResolveContext],
272
- null | ResolveRequest
273
- >;
274
- result: AsyncSeriesHook<[ResolveRequest, ResolveContext]>;
275
- };
276
- ensureHook(
277
- name:
278
- | string
279
- | AsyncSeriesBailHook<
280
- [ResolveRequest, ResolveContext],
281
- null | ResolveRequest
282
- >
283
- ): AsyncSeriesBailHook<
284
- [ResolveRequest, ResolveContext],
285
- null | ResolveRequest
286
- >;
287
- getHook(
288
- name:
289
- | string
290
- | AsyncSeriesBailHook<
291
- [ResolveRequest, ResolveContext],
292
- null | ResolveRequest
293
- >
294
- ): AsyncSeriesBailHook<
295
- [ResolveRequest, ResolveContext],
296
- null | ResolveRequest
297
- >;
298
- resolveSync(context: object, path: string, request: string): string | false;
299
- resolve(
300
- context: object,
301
- path: string,
302
- request: string,
303
- resolveContext: ResolveContext,
304
- callback: (
305
- arg0: null | Error,
306
- arg1?: string | false,
307
- arg2?: ResolveRequest
308
- ) => void
309
- ): void;
310
- doResolve(
311
- hook?: any,
312
- request?: any,
313
- message?: any,
314
- resolveContext?: any,
315
- callback?: any
316
- ): any;
317
- parse(identifier: string): ParsedIdentifier;
318
- isModule(path?: any): boolean;
319
- isPrivate(path?: any): boolean;
320
- isDirectory(path: string): boolean;
321
- join(path?: any, request?: any): string;
322
- normalize(path?: any): string;
323
- }
324
- declare interface UserResolveOptions {
786
+ declare interface ResolveOptionsResolverFactoryObject_2 {
325
787
  /**
326
788
  * A list of module alias configurations or an object which maps key to value
327
789
  */
@@ -429,7 +891,7 @@ declare interface UserResolveOptions {
429
891
  /**
430
892
  * A PnP API that should be used - null is "never", undefined is "auto"
431
893
  */
432
- pnpApi?: null | PnpApiImpl;
894
+ pnpApi?: null | PnpApi;
433
895
 
434
896
  /**
435
897
  * A list of root paths
@@ -466,45 +928,196 @@ declare interface UserResolveOptions {
466
928
  */
467
929
  preferAbsolute?: boolean;
468
930
  }
931
+ export type ResolveRequest = BaseResolveRequest & Partial<ParsedIdentifier>;
932
+ declare abstract class Resolver {
933
+ fileSystem: FileSystem;
934
+ options: ResolveOptionsResolverFactoryObject_1;
935
+ hooks: KnownHooks;
936
+ ensureHook(
937
+ name:
938
+ | string
939
+ | AsyncSeriesBailHook<
940
+ [ResolveRequest, ResolveContext],
941
+ null | ResolveRequest
942
+ >
943
+ ): AsyncSeriesBailHook<
944
+ [ResolveRequest, ResolveContext],
945
+ null | ResolveRequest
946
+ >;
947
+ getHook(
948
+ name:
949
+ | string
950
+ | AsyncSeriesBailHook<
951
+ [ResolveRequest, ResolveContext],
952
+ null | ResolveRequest
953
+ >
954
+ ): AsyncSeriesBailHook<
955
+ [ResolveRequest, ResolveContext],
956
+ null | ResolveRequest
957
+ >;
958
+ resolveSync(context: object, path: string, request: string): string | false;
959
+ resolve(
960
+ context: object,
961
+ path: string,
962
+ request: string,
963
+ resolveContext: ResolveContext,
964
+ callback: (
965
+ err: null | ErrorWithDetail,
966
+ res?: string | false,
967
+ req?: ResolveRequest
968
+ ) => void
969
+ ): void;
970
+ doResolve(
971
+ hook: AsyncSeriesBailHook<
972
+ [ResolveRequest, ResolveContext],
973
+ null | ResolveRequest
974
+ >,
975
+ request: ResolveRequest,
976
+ message: null | string,
977
+ resolveContext: ResolveContext,
978
+ callback: (err?: null | Error, result?: ResolveRequest) => void
979
+ ): void;
980
+ parse(identifier: string): ParsedIdentifier;
981
+ isModule(path: string): boolean;
982
+ isPrivate(path: string): boolean;
983
+ isDirectory(path: string): boolean;
984
+ join(path: string, request: string): string;
985
+ normalize(path: string): string;
986
+ }
987
+ declare interface Stat {
988
+ (
989
+ path: PathLike,
990
+ callback: (arg0: null | NodeJS.ErrnoException, arg1?: IStats) => void
991
+ ): void;
992
+ (
993
+ path: PathLike,
994
+ options: undefined | (StatOptions & { bigint?: false }),
995
+ callback: (arg0: null | NodeJS.ErrnoException, arg1?: IStats) => void
996
+ ): void;
997
+ (
998
+ path: PathLike,
999
+ options: StatOptions & { bigint: true },
1000
+ callback: (arg0: null | NodeJS.ErrnoException, arg1?: IBigIntStats) => void
1001
+ ): void;
1002
+ (
1003
+ path: PathLike,
1004
+ options: undefined | StatOptions,
1005
+ callback: (
1006
+ arg0: null | NodeJS.ErrnoException,
1007
+ arg1?: IStats | IBigIntStats
1008
+ ) => void
1009
+ ): void;
1010
+ }
1011
+ declare interface StatOptions {
1012
+ bigint?: boolean;
1013
+ }
1014
+ declare interface StatSync {
1015
+ (path: PathLike, options?: undefined): IStats;
1016
+ (
1017
+ path: PathLike,
1018
+ options?: StatSyncOptions & { bigint?: false; throwIfNoEntry: false }
1019
+ ): undefined | IStats;
1020
+ (
1021
+ path: PathLike,
1022
+ options: StatSyncOptions & { bigint: true; throwIfNoEntry: false }
1023
+ ): undefined | IBigIntStats;
1024
+ (path: PathLike, options?: StatSyncOptions & { bigint?: false }): IStats;
1025
+ (path: PathLike, options: StatSyncOptions & { bigint: true }): IBigIntStats;
1026
+ (
1027
+ path: PathLike,
1028
+ options: StatSyncOptions & { bigint: boolean; throwIfNoEntry?: false }
1029
+ ): IStats | IBigIntStats;
1030
+ (path: PathLike, options?: StatSyncOptions):
1031
+ | undefined
1032
+ | IStats
1033
+ | IBigIntStats;
1034
+ }
1035
+ declare interface StatSyncOptions {
1036
+ bigint?: boolean;
1037
+ throwIfNoEntry?: boolean;
1038
+ }
1039
+ declare interface SyncFileSystem {
1040
+ readFileSync: ReadFileSync;
1041
+ readdirSync: ReaddirSync;
1042
+ readJsonSync?: (arg0: PathOrFileDescriptor) => JsonObject;
1043
+ readlinkSync: ReadlinkSync;
1044
+ lstatSync?: LStatSync;
1045
+ statSync: StatSync;
1046
+ realpathSync?: RealPathSync;
1047
+ }
1048
+
1049
+ /**
1050
+ * `URL` class is a global reference for `require('url').URL`
1051
+ * https://nodejs.org/api/url.html#the-whatwg-url-api
1052
+ */
1053
+ declare interface URL_url extends URL {}
469
1054
  declare interface WriteOnlySet<T> {
470
- add: (T?: any) => void;
1055
+ add: (item: T) => void;
471
1056
  }
472
1057
  declare function exports(
473
- context?: any,
474
- path?: any,
475
- request?: any,
476
- resolveContext?: any,
477
- callback?: any
1058
+ context: object,
1059
+ path: string,
1060
+ request: string,
1061
+ resolveContext: ResolveContext,
1062
+ callback: (
1063
+ err: null | ErrorWithDetail,
1064
+ res?: string | false,
1065
+ req?: ResolveRequest
1066
+ ) => void
1067
+ ): void;
1068
+ declare function exports(
1069
+ context: object,
1070
+ path: string,
1071
+ request: string,
1072
+ callback: (
1073
+ err: null | ErrorWithDetail,
1074
+ res?: string | false,
1075
+ req?: ResolveRequest
1076
+ ) => void
1077
+ ): void;
1078
+ declare function exports(
1079
+ path: string,
1080
+ request: string,
1081
+ resolveContext: ResolveContext,
1082
+ callback: (
1083
+ err: null | ErrorWithDetail,
1084
+ res?: string | false,
1085
+ req?: ResolveRequest
1086
+ ) => void
1087
+ ): void;
1088
+ declare function exports(
1089
+ path: string,
1090
+ request: string,
1091
+ callback: (
1092
+ err: null | ErrorWithDetail,
1093
+ res?: string | false,
1094
+ req?: ResolveRequest
1095
+ ) => void
478
1096
  ): void;
479
1097
  declare namespace exports {
480
- export const sync: (
481
- context?: any,
482
- path?: any,
483
- request?: any
484
- ) => string | false;
1098
+ export const sync: ResolveFunction;
485
1099
  export function create(
486
- options?: any
487
- ): (
488
- context?: any,
489
- path?: any,
490
- request?: any,
491
- resolveContext?: any,
492
- callback?: any
493
- ) => void;
1100
+ options: ResolveOptionsOptionalFS
1101
+ ): ResolveFunctionAsync;
494
1102
  export namespace create {
495
- export const sync: (
496
- options?: any
497
- ) => (context?: any, path?: any, request?: any) => string | false;
1103
+ export const sync: (options: ResolveOptionsOptionalFS) => ResolveFunction;
498
1104
  }
499
1105
  export namespace ResolverFactory {
500
- export let createResolver: (options: UserResolveOptions) => Resolver;
1106
+ export let createResolver: (
1107
+ options: ResolveOptionsResolverFactoryObject_2
1108
+ ) => Resolver;
501
1109
  }
502
- export const forEachBail: (
503
- array?: any,
504
- iterator?: any,
505
- callback?: any
506
- ) => any;
507
- export { CachedInputFileSystem, CloneBasenamePlugin, LogInfoPlugin, type PnpApiImpl as PnpApi, Resolver, type FileSystem, type ResolveContext, type ResolveRequest, type Plugin, type UserResolveOptions as ResolveOptions };
1110
+ export const forEachBail: <T, Z>(
1111
+ array: T[],
1112
+ iterator: Iterator<T, Z>,
1113
+ callback: (err?: null | Error, result?: null | Z, i?: number) => void
1114
+ ) => void;
1115
+ export type ResolveCallback = (
1116
+ err: null | ErrorWithDetail,
1117
+ res?: string | false,
1118
+ req?: ResolveRequest
1119
+ ) => void;
1120
+ export { CachedInputFileSystem, CloneBasenamePlugin, LogInfoPlugin, type ResolveOptionsOptionalFS, type PnpApi, Resolver, type FileSystem, type ResolveContext, type ResolveRequest, type Plugin, type ResolveOptionsResolverFactoryObject_2 as ResolveOptions, type ResolveFunctionAsync, type ResolveFunction };
508
1121
  }
509
1122
 
510
1123
  export { exports as default };