webpack 5.13.0 → 5.14.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.

Potentially problematic release.


This version of webpack might be problematic. Click here for more details.

package/types.d.ts CHANGED
@@ -77,7 +77,6 @@ import {
77
77
  WithStatement,
78
78
  YieldExpression
79
79
  } from "estree";
80
- import { Stats as FsStats, WriteStream } from "fs";
81
80
  import { JSONSchema4, JSONSchema6, JSONSchema7 } from "json-schema";
82
81
  import { default as ValidationError } from "schema-utils/declarations/ValidationError";
83
82
  import {
@@ -176,6 +175,15 @@ declare interface AggressiveSplittingPluginOptions {
176
175
  */
177
176
  minSize?: number;
178
177
  }
178
+ declare interface AliasOption {
179
+ alias: string | false | string[];
180
+ name: string;
181
+ onlyModule?: boolean;
182
+ }
183
+ type AliasOptionNewRequest = string | false | string[];
184
+ declare interface AliasOptions {
185
+ [index: string]: AliasOptionNewRequest;
186
+ }
179
187
  declare interface Argument {
180
188
  description: string;
181
189
  simpleType: "string" | "number" | "boolean";
@@ -359,12 +367,12 @@ declare interface BannerPluginOptions {
359
367
  /**
360
368
  * Exclude all modules matching any of these conditions.
361
369
  */
362
- exclude?: string | RegExp | (string | RegExp)[];
370
+ exclude?: string | RegExp | Rule[];
363
371
 
364
372
  /**
365
373
  * Include all modules matching any of these conditions.
366
374
  */
367
- include?: string | RegExp | (string | RegExp)[];
375
+ include?: string | RegExp | Rule[];
368
376
 
369
377
  /**
370
378
  * If true, banner will not be wrapped in a comment.
@@ -374,13 +382,13 @@ declare interface BannerPluginOptions {
374
382
  /**
375
383
  * Include all modules that pass test assertion.
376
384
  */
377
- test?: string | RegExp | (string | RegExp)[];
385
+ test?: string | RegExp | Rule[];
378
386
  }
379
387
  declare interface BaseResolveRequest {
380
- path: DevTool;
388
+ path: string | false;
381
389
  descriptionFilePath?: string;
382
390
  descriptionFileRoot?: string;
383
- descriptionFileData?: any;
391
+ descriptionFileData?: object;
384
392
  relativePath?: string;
385
393
  ignoreSymlinks?: boolean;
386
394
  fullySpecified?: boolean;
@@ -576,11 +584,11 @@ declare interface CacheGroupSource {
576
584
  ) => undefined | string;
577
585
  chunksFilter?: (chunk: Chunk) => boolean;
578
586
  enforce?: boolean;
579
- minSize: Record<string, number>;
580
- minRemainingSize: Record<string, number>;
581
- enforceSizeThreshold: Record<string, number>;
582
- maxAsyncSize: Record<string, number>;
583
- maxInitialSize: Record<string, number>;
587
+ minSize: SplitChunksSizes;
588
+ minRemainingSize: SplitChunksSizes;
589
+ enforceSizeThreshold: SplitChunksSizes;
590
+ maxAsyncSize: SplitChunksSizes;
591
+ maxInitialSize: SplitChunksSizes;
584
592
  minChunks?: number;
585
593
  maxAsyncRequests?: number;
586
594
  maxInitialRequests?: number;
@@ -1067,6 +1075,40 @@ declare abstract class CodeGenerationResults {
1067
1075
  getData(module: Module, runtime: RuntimeSpec, key: string): any;
1068
1076
  add(module: Module, runtime: RuntimeSpec, result: CodeGenerationResult): void;
1069
1077
  }
1078
+ type CodeValue =
1079
+ | undefined
1080
+ | null
1081
+ | string
1082
+ | number
1083
+ | bigint
1084
+ | boolean
1085
+ | Function
1086
+ | RegExp
1087
+ | RuntimeValue
1088
+ | {
1089
+ [index: string]: RecursiveArrayOrRecord<
1090
+ | undefined
1091
+ | null
1092
+ | string
1093
+ | number
1094
+ | bigint
1095
+ | boolean
1096
+ | Function
1097
+ | RegExp
1098
+ | RuntimeValue
1099
+ >;
1100
+ }
1101
+ | RecursiveArrayOrRecord<
1102
+ | undefined
1103
+ | null
1104
+ | string
1105
+ | number
1106
+ | bigint
1107
+ | boolean
1108
+ | Function
1109
+ | RegExp
1110
+ | RuntimeValue
1111
+ >[];
1070
1112
  declare interface Comparator<T> {
1071
1113
  (arg0: T, arg1: T): 0 | 1 | -1;
1072
1114
  }
@@ -1170,16 +1212,16 @@ declare class Compilation {
1170
1212
  >
1171
1213
  >;
1172
1214
  optimizeAssets: AsyncSeriesHook<
1173
- [Record<string, Source>],
1215
+ [CompilationAssets],
1174
1216
  ProcessAssetsAdditionalOptions
1175
1217
  >;
1176
- afterOptimizeAssets: SyncHook<[Record<string, Source>]>;
1218
+ afterOptimizeAssets: SyncHook<[CompilationAssets]>;
1177
1219
  processAssets: AsyncSeriesHook<
1178
- [Record<string, Source>],
1220
+ [CompilationAssets],
1179
1221
  ProcessAssetsAdditionalOptions
1180
1222
  >;
1181
- afterProcessAssets: SyncHook<[Record<string, Source>]>;
1182
- processAdditionalAssets: AsyncSeriesHook<[Record<string, Source>]>;
1223
+ afterProcessAssets: SyncHook<[CompilationAssets]>;
1224
+ processAdditionalAssets: AsyncSeriesHook<[CompilationAssets]>;
1183
1225
  needAdditionalSeal: SyncBailHook<[], boolean>;
1184
1226
  afterSeal: AsyncSeriesHook<[]>;
1185
1227
  renderManifest: SyncWaterfallHook<
@@ -1249,7 +1291,7 @@ declare class Compilation {
1249
1291
  modules: Set<Module>;
1250
1292
  records: any;
1251
1293
  additionalChunkAssets: string[];
1252
- assets: Record<string, Source>;
1294
+ assets: CompilationAssets;
1253
1295
  assetsInfo: Map<string, AssetInfo>;
1254
1296
  errors: WebpackError[];
1255
1297
  warnings: WebpackError[];
@@ -1527,6 +1569,9 @@ declare class Compilation {
1527
1569
  */
1528
1570
  static PROCESS_ASSETS_STAGE_REPORT: number;
1529
1571
  }
1572
+ declare interface CompilationAssets {
1573
+ [index: string]: Source;
1574
+ }
1530
1575
  declare interface CompilationHooksAsyncWebAssemblyModulesPlugin {
1531
1576
  renderModuleContent: SyncWaterfallHook<[Source, Module, RenderContextObject]>;
1532
1577
  }
@@ -1600,8 +1645,8 @@ declare class Compiler {
1600
1645
  immutablePaths: Set<string>;
1601
1646
  modifiedFiles: Set<string>;
1602
1647
  removedFiles: Set<string>;
1603
- fileTimestamps: Map<string, null | FileSystemInfoEntry>;
1604
- contextTimestamps: Map<string, null | FileSystemInfoEntry>;
1648
+ fileTimestamps: Map<string, null | FileSystemInfoEntry | "ignore">;
1649
+ contextTimestamps: Map<string, null | FileSystemInfoEntry | "ignore">;
1605
1650
  resolverFactory: ResolverFactory;
1606
1651
  infrastructureLogger: any;
1607
1652
  options: WebpackOptionsNormalized;
@@ -2163,36 +2208,8 @@ declare class DefinePlugin {
2163
2208
  /**
2164
2209
  * Create a new define plugin
2165
2210
  */
2166
- constructor(
2167
- definitions: Record<
2168
- string,
2169
- RecursiveArrayOrRecord<
2170
- | undefined
2171
- | null
2172
- | string
2173
- | number
2174
- | bigint
2175
- | boolean
2176
- | Function
2177
- | RegExp
2178
- | RuntimeValue
2179
- >
2180
- >
2181
- );
2182
- definitions: Record<
2183
- string,
2184
- RecursiveArrayOrRecord<
2185
- | undefined
2186
- | null
2187
- | string
2188
- | number
2189
- | bigint
2190
- | boolean
2191
- | Function
2192
- | RegExp
2193
- | RuntimeValue
2194
- >
2195
- >;
2211
+ constructor(definitions: Record<string, CodeValue>);
2212
+ definitions: Record<string, CodeValue>;
2196
2213
 
2197
2214
  /**
2198
2215
  * Apply the plugin
@@ -2387,8 +2404,6 @@ declare class DeterministicModuleIdsPlugin {
2387
2404
  declare interface DevServer {
2388
2405
  [index: string]: any;
2389
2406
  }
2390
- type DevTool = string | false;
2391
- type DevtoolFallbackModuleFilenameTemplate = string | Function;
2392
2407
  declare class DllPlugin {
2393
2408
  constructor(options: DllPluginOptions);
2394
2409
  options: {
@@ -2790,15 +2805,9 @@ declare class EntryOptionPlugin {
2790
2805
  desc: EntryDescriptionNormalized
2791
2806
  ): EntryOptions;
2792
2807
  }
2793
- type EntryOptions = { name?: string } & Pick<
2808
+ type EntryOptions = { name?: string } & Omit<
2794
2809
  EntryDescriptionNormalized,
2795
- | "filename"
2796
- | "chunkLoading"
2797
- | "dependOn"
2798
- | "layer"
2799
- | "library"
2800
- | "runtime"
2801
- | "wasmLoading"
2810
+ "import"
2802
2811
  >;
2803
2812
  declare class EntryPlugin {
2804
2813
  /**
@@ -2916,7 +2925,7 @@ declare class EvalDevToolModulePlugin {
2916
2925
  declare class EvalSourceMapDevToolPlugin {
2917
2926
  constructor(inputOptions: string | SourceMapDevToolPluginOptions);
2918
2927
  sourceMapComment: string;
2919
- moduleFilenameTemplate: DevtoolFallbackModuleFilenameTemplate;
2928
+ moduleFilenameTemplate: string | Function;
2920
2929
  namespace: string;
2921
2930
  options: SourceMapDevToolPluginOptions;
2922
2931
 
@@ -3011,7 +3020,10 @@ declare abstract class ExportInfo {
3011
3020
  /**
3012
3021
  * get used name
3013
3022
  */
3014
- getUsedName(fallbackName: undefined | string, runtime: RuntimeSpec): DevTool;
3023
+ getUsedName(
3024
+ fallbackName: undefined | string,
3025
+ runtime: RuntimeSpec
3026
+ ): string | false;
3015
3027
  hasUsedName(): boolean;
3016
3028
 
3017
3029
  /**
@@ -3058,7 +3070,17 @@ declare abstract class ExportInfo {
3058
3070
  | "maybe provided (runtime-defined)"
3059
3071
  | "provided"
3060
3072
  | "not provided";
3061
- getRenameInfo(): string;
3073
+ getRenameInfo():
3074
+ | string
3075
+ | "missing provision and use info prevents renaming"
3076
+ | "usage prevents renaming (no provision info)"
3077
+ | "missing provision info prevents renaming"
3078
+ | "missing usage info prevents renaming"
3079
+ | "usage prevents renaming"
3080
+ | "could be renamed"
3081
+ | "provision prevents renaming (no use info)"
3082
+ | "usage and provision prevents renaming"
3083
+ | "provision prevents renaming";
3062
3084
  }
3063
3085
  declare interface ExportSpec {
3064
3086
  /**
@@ -3121,11 +3143,14 @@ declare abstract class ExportsInfo {
3121
3143
  getUsedExports(runtime: RuntimeSpec): null | boolean | SortableSet<string>;
3122
3144
  getProvidedExports(): null | true | string[];
3123
3145
  getRelevantExports(runtime: RuntimeSpec): ExportInfo[];
3124
- isExportProvided(name: EntryItem): undefined | null | boolean;
3146
+ isExportProvided(name: string | string[]): undefined | null | boolean;
3125
3147
  getUsageKey(runtime: RuntimeSpec): string;
3126
3148
  isEquallyUsed(runtimeA: RuntimeSpec, runtimeB: RuntimeSpec): boolean;
3127
- getUsed(name: EntryItem, runtime: RuntimeSpec): UsageStateType;
3128
- getUsedName(name: EntryItem, runtime: RuntimeSpec): Target;
3149
+ getUsed(name: string | string[], runtime: RuntimeSpec): UsageStateType;
3150
+ getUsedName(
3151
+ name: string | string[],
3152
+ runtime: RuntimeSpec
3153
+ ): string | false | string[];
3129
3154
  updateHash(hash: Hash, runtime: RuntimeSpec): void;
3130
3155
  getRestoreProvidedData(): any;
3131
3156
  restoreProvided(__0: {
@@ -3250,7 +3275,7 @@ declare interface ExternalItemObjectUnknown {
3250
3275
  }
3251
3276
  declare class ExternalModule extends Module {
3252
3277
  constructor(request?: any, type?: any, userRequest?: any);
3253
- request: string | string[] | Record<string, EntryItem>;
3278
+ request: string | string[] | Record<string, string | string[]>;
3254
3279
  externalType: string;
3255
3280
  userRequest: string;
3256
3281
  getSourceData(
@@ -3362,9 +3387,9 @@ declare interface FactorizeModuleOptions {
3362
3387
  type FakeHook<T> = T & FakeHookMarker;
3363
3388
  declare interface FakeHookMarker {}
3364
3389
  declare interface FallbackCacheGroup {
3365
- minSize: Record<string, number>;
3366
- maxAsyncSize: Record<string, number>;
3367
- maxInitialSize: Record<string, number>;
3390
+ minSize: SplitChunksSizes;
3391
+ maxAsyncSize: SplitChunksSizes;
3392
+ maxInitialSize: SplitChunksSizes;
3368
3393
  automaticNameDelimiter: string;
3369
3394
  }
3370
3395
  declare class FetchCompileAsyncWasmPlugin {
@@ -3452,7 +3477,11 @@ declare interface FileCacheOptions {
3452
3477
  declare interface FileSystem {
3453
3478
  readFile: {
3454
3479
  (arg0: string, arg1: FileSystemCallback<string | Buffer>): void;
3455
- (arg0: string, arg1: any, arg2: FileSystemCallback<string | Buffer>): void;
3480
+ (
3481
+ arg0: string,
3482
+ arg1: object,
3483
+ arg2: FileSystemCallback<string | Buffer>
3484
+ ): void;
3456
3485
  };
3457
3486
  readdir: {
3458
3487
  (
@@ -3461,25 +3490,37 @@ declare interface FileSystem {
3461
3490
  ): void;
3462
3491
  (
3463
3492
  arg0: string,
3464
- arg1: any,
3493
+ arg1: object,
3465
3494
  arg2: FileSystemCallback<(string | Buffer)[] | FileSystemDirent[]>
3466
3495
  ): void;
3467
3496
  };
3468
3497
  readJson?: {
3469
- (arg0: string, arg1: FileSystemCallback<any>): void;
3470
- (arg0: string, arg1: any, arg2: FileSystemCallback<any>): void;
3498
+ (arg0: string, arg1: FileSystemCallback<object>): void;
3499
+ (arg0: string, arg1: object, arg2: FileSystemCallback<object>): void;
3471
3500
  };
3472
3501
  readlink: {
3473
3502
  (arg0: string, arg1: FileSystemCallback<string | Buffer>): void;
3474
- (arg0: string, arg1: any, arg2: FileSystemCallback<string | Buffer>): void;
3503
+ (
3504
+ arg0: string,
3505
+ arg1: object,
3506
+ arg2: FileSystemCallback<string | Buffer>
3507
+ ): void;
3475
3508
  };
3476
3509
  lstat?: {
3477
3510
  (arg0: string, arg1: FileSystemCallback<FileSystemStats>): void;
3478
- (arg0: string, arg1: any, arg2: FileSystemCallback<string | Buffer>): void;
3511
+ (
3512
+ arg0: string,
3513
+ arg1: object,
3514
+ arg2: FileSystemCallback<string | Buffer>
3515
+ ): void;
3479
3516
  };
3480
3517
  stat: {
3481
3518
  (arg0: string, arg1: FileSystemCallback<FileSystemStats>): void;
3482
- (arg0: string, arg1: any, arg2: FileSystemCallback<string | Buffer>): void;
3519
+ (
3520
+ arg0: string,
3521
+ arg1: object,
3522
+ arg2: FileSystemCallback<string | Buffer>
3523
+ ): void;
3483
3524
  };
3484
3525
  }
3485
3526
  declare interface FileSystemCallback<T> {
@@ -3666,10 +3707,10 @@ declare class GetChunkFilenameRuntimeModule extends RuntimeModule {
3666
3707
  */
3667
3708
  static STAGE_TRIGGER: number;
3668
3709
  }
3669
- declare interface GroupConfig<T, R> {
3670
- getKeys: (arg0: T) => string[];
3671
- createGroup: (arg0: string, arg1: (T | R)[], arg2: T[]) => R;
3672
- getOptions?: (arg0: string, arg1: T[]) => GroupOptions;
3710
+ declare interface GroupConfig {
3711
+ getKeys: (arg0?: any) => string[];
3712
+ createGroup: (arg0: string, arg1: any[], arg2: any[]) => object;
3713
+ getOptions?: (arg0: string, arg1: any[]) => GroupOptions;
3673
3714
  }
3674
3715
  declare interface GroupOptions {
3675
3716
  groupChildren?: boolean;
@@ -3705,7 +3746,6 @@ declare class Hash {
3705
3746
  */
3706
3747
  digest(encoding?: string): string | Buffer;
3707
3748
  }
3708
- type HashFunction = string | typeof Hash;
3709
3749
  declare interface HashableObject {
3710
3750
  updateHash: (arg0: Hash) => void;
3711
3751
  }
@@ -3765,6 +3805,43 @@ declare class HttpsUriPlugin {
3765
3805
  */
3766
3806
  apply(compiler: Compiler): void;
3767
3807
  }
3808
+ declare interface IDirent {
3809
+ isFile: () => boolean;
3810
+ isDirectory: () => boolean;
3811
+ isBlockDevice: () => boolean;
3812
+ isCharacterDevice: () => boolean;
3813
+ isSymbolicLink: () => boolean;
3814
+ isFIFO: () => boolean;
3815
+ isSocket: () => boolean;
3816
+ name: string | Buffer;
3817
+ }
3818
+ declare interface IStats {
3819
+ isFile: () => boolean;
3820
+ isDirectory: () => boolean;
3821
+ isBlockDevice: () => boolean;
3822
+ isCharacterDevice: () => boolean;
3823
+ isSymbolicLink: () => boolean;
3824
+ isFIFO: () => boolean;
3825
+ isSocket: () => boolean;
3826
+ dev: number | bigint;
3827
+ ino: number | bigint;
3828
+ mode: number | bigint;
3829
+ nlink: number | bigint;
3830
+ uid: number | bigint;
3831
+ gid: number | bigint;
3832
+ rdev: number | bigint;
3833
+ size: number | bigint;
3834
+ blksize: number | bigint;
3835
+ blocks: number | bigint;
3836
+ atimeMs: number | bigint;
3837
+ mtimeMs: number | bigint;
3838
+ ctimeMs: number | bigint;
3839
+ birthtimeMs: number | bigint;
3840
+ atime: Date;
3841
+ mtime: Date;
3842
+ ctime: Date;
3843
+ birthtime: Date;
3844
+ }
3768
3845
  declare class IgnorePlugin {
3769
3846
  constructor(options: IgnorePluginOptions);
3770
3847
  options: IgnorePluginOptions;
@@ -3831,7 +3908,7 @@ declare abstract class InitFragment {
3831
3908
  declare interface InputFileSystem {
3832
3909
  readFile: (
3833
3910
  arg0: string,
3834
- arg1: (arg0?: NodeJS.ErrnoException, arg1?: Buffer) => void
3911
+ arg1: (arg0?: NodeJS.ErrnoException, arg1?: string | Buffer) => void
3835
3912
  ) => void;
3836
3913
  readJson?: (
3837
3914
  arg0: string,
@@ -3843,15 +3920,18 @@ declare interface InputFileSystem {
3843
3920
  ) => void;
3844
3921
  readdir: (
3845
3922
  arg0: string,
3846
- arg1: (arg0?: NodeJS.ErrnoException, arg1?: string[]) => void
3923
+ arg1: (
3924
+ arg0?: NodeJS.ErrnoException,
3925
+ arg1?: (string | Buffer)[] | IDirent[]
3926
+ ) => void
3847
3927
  ) => void;
3848
3928
  stat: (
3849
3929
  arg0: string,
3850
- arg1: (arg0?: NodeJS.ErrnoException, arg1?: FsStats) => void
3930
+ arg1: (arg0?: NodeJS.ErrnoException, arg1?: IStats) => void
3851
3931
  ) => void;
3852
3932
  realpath?: (
3853
3933
  arg0: string,
3854
- arg1: (arg0?: NodeJS.ErrnoException, arg1?: string) => void
3934
+ arg1: (arg0?: NodeJS.ErrnoException, arg1?: string | Buffer) => void
3855
3935
  ) => void;
3856
3936
  purge?: (arg0?: string) => void;
3857
3937
  join?: (arg0: string, arg1: string) => string;
@@ -3863,7 +3943,7 @@ type IntermediateFileSystem = InputFileSystem &
3863
3943
  IntermediateFileSystemExtras;
3864
3944
  declare interface IntermediateFileSystemExtras {
3865
3945
  mkdirSync: (arg0: string) => void;
3866
- createWriteStream: (arg0: string) => WriteStream;
3946
+ createWriteStream: (arg0: string) => NodeJS.WritableStream;
3867
3947
  open: (
3868
3948
  arg0: string,
3869
3949
  arg1: string,
@@ -4341,7 +4421,7 @@ declare class JavascriptParser extends Parser {
4341
4421
  expr: MemberExpression,
4342
4422
  fallback: (
4343
4423
  arg0: string,
4344
- arg1: ExportedVariableInfo,
4424
+ arg1: string | ScopeInfo | VariableInfo,
4345
4425
  arg2: () => string[]
4346
4426
  ) => any,
4347
4427
  defined: (arg0: string) => any,
@@ -4660,7 +4740,7 @@ declare interface KnownAssetInfo {
4660
4740
  /**
4661
4741
  * object of pointers to other assets, keyed by type of relation (only points from parent to child)
4662
4742
  */
4663
- related?: Record<string, EntryItem>;
4743
+ related?: Record<string, string | string[]>;
4664
4744
  }
4665
4745
  declare interface KnownBuildMeta {
4666
4746
  moduleArgument?: string;
@@ -4841,6 +4921,7 @@ declare interface LibraryCustomUmdObject {
4841
4921
  */
4842
4922
  root?: string | string[];
4843
4923
  }
4924
+ type LibraryExport = string | string[];
4844
4925
  type LibraryName = string | string[] | LibraryCustomUmdObject;
4845
4926
 
4846
4927
  /**
@@ -4878,14 +4959,14 @@ declare class LibraryTemplatePlugin {
4878
4959
  target: string,
4879
4960
  umdNamedDefine: boolean,
4880
4961
  auxiliaryComment: AuxiliaryComment,
4881
- exportProperty: EntryItem
4962
+ exportProperty: LibraryExport
4882
4963
  );
4883
4964
  library: {
4884
4965
  type: string;
4885
4966
  name: LibraryName;
4886
4967
  umdNamedDefine: boolean;
4887
4968
  auxiliaryComment: AuxiliaryComment;
4888
- export: EntryItem;
4969
+ export: LibraryExport;
4889
4970
  };
4890
4971
 
4891
4972
  /**
@@ -5408,7 +5489,10 @@ declare class ModuleGraph {
5408
5489
  module: Module
5409
5490
  ): (string | ((requestShortener: RequestShortener) => string))[];
5410
5491
  getProvidedExports(module: Module): null | true | string[];
5411
- isExportProvided(module: Module, exportName: EntryItem): null | boolean;
5492
+ isExportProvided(
5493
+ module: Module,
5494
+ exportName: string | string[]
5495
+ ): null | boolean;
5412
5496
  getExportsInfo(module: Module): ExportsInfo;
5413
5497
  getExportInfo(module: Module, exportName: string): ExportInfo;
5414
5498
  getReadOnlyExportInfo(module: Module, exportName: string): ExportInfo;
@@ -6816,11 +6900,11 @@ declare interface OutputFileSystem {
6816
6900
  mkdir: (arg0: string, arg1: (arg0?: NodeJS.ErrnoException) => void) => void;
6817
6901
  stat: (
6818
6902
  arg0: string,
6819
- arg1: (arg0?: NodeJS.ErrnoException, arg1?: FsStats) => void
6903
+ arg1: (arg0?: NodeJS.ErrnoException, arg1?: IStats) => void
6820
6904
  ) => void;
6821
6905
  readFile: (
6822
6906
  arg0: string,
6823
- arg1: (arg0?: NodeJS.ErrnoException, arg1?: Buffer) => void
6907
+ arg1: (arg0?: NodeJS.ErrnoException, arg1?: string | Buffer) => void
6824
6908
  ) => void;
6825
6909
  join?: (arg0: string, arg1: string) => string;
6826
6910
  relative?: (arg0: string, arg1: string) => string;
@@ -7060,7 +7144,7 @@ declare interface ParsedIdentifier {
7060
7144
  declare class Parser {
7061
7145
  constructor();
7062
7146
  parse(
7063
- source: string | Record<string, any> | Buffer,
7147
+ source: string | Buffer | PreparsedAst,
7064
7148
  state: ParserState
7065
7149
  ): ParserState;
7066
7150
  }
@@ -7112,8 +7196,11 @@ declare interface PerformanceOptions {
7112
7196
  */
7113
7197
  maxEntrypointSize?: number;
7114
7198
  }
7199
+ type Plugin =
7200
+ | { apply: (arg0: Resolver) => void }
7201
+ | ((this: Resolver, arg1: Resolver) => void);
7115
7202
  declare interface PnpApiImpl {
7116
- resolveToUnqualified: (arg0: string, arg1: string, arg2?: any) => string;
7203
+ resolveToUnqualified: (arg0: string, arg1: string, arg2: object) => string;
7117
7204
  }
7118
7205
  declare interface PossibleFileSystemError {
7119
7206
  code?: string;
@@ -7136,6 +7223,9 @@ declare class PrefixSource extends Source {
7136
7223
  original(): Source;
7137
7224
  getPrefix(): string;
7138
7225
  }
7226
+ declare interface PreparsedAst {
7227
+ [index: string]: any;
7228
+ }
7139
7229
  declare interface PrintedElement {
7140
7230
  element: string;
7141
7231
  content: string;
@@ -7258,8 +7348,8 @@ declare interface ProgressPluginOptions {
7258
7348
  profile?: null | boolean;
7259
7349
  }
7260
7350
  declare class ProvidePlugin {
7261
- constructor(definitions: Record<string, EntryItem>);
7262
- definitions: Record<string, EntryItem>;
7351
+ constructor(definitions: Record<string, string | string[]>);
7352
+ definitions: Record<string, string | string[]>;
7263
7353
 
7264
7354
  /**
7265
7355
  * Apply the plugin
@@ -7569,17 +7659,17 @@ declare interface ResolveBuildDependenciesResult {
7569
7659
  * Resolve context
7570
7660
  */
7571
7661
  declare interface ResolveContext {
7572
- contextDependencies?: { add: (T?: any) => void };
7662
+ contextDependencies?: WriteOnlySet<string>;
7573
7663
 
7574
7664
  /**
7575
7665
  * files that was found on file system
7576
7666
  */
7577
- fileDependencies?: { add: (T?: any) => void };
7667
+ fileDependencies?: WriteOnlySet<string>;
7578
7668
 
7579
7669
  /**
7580
7670
  * dependencies that was not found on file system
7581
7671
  */
7582
- missingDependencies?: { add: (T?: any) => void };
7672
+ missingDependencies?: WriteOnlySet<string>;
7583
7673
 
7584
7674
  /**
7585
7675
  * set of hooks' calls. For instance, `resolve → parsedResolve → describedResolve`,
@@ -7608,35 +7698,9 @@ declare interface ResolveData {
7608
7698
  cacheable: boolean;
7609
7699
  }
7610
7700
  declare interface ResolveOptionsTypes {
7611
- alias: {
7612
- /**
7613
- * New request.
7614
- */
7615
- alias: Target;
7616
- /**
7617
- * Request to be redirected.
7618
- */
7619
- name: string;
7620
- /**
7621
- * Redirect only exact matching request.
7622
- */
7623
- onlyModule?: boolean;
7624
- }[];
7625
- fallback: {
7626
- /**
7627
- * New request.
7628
- */
7629
- alias: Target;
7630
- /**
7631
- * Request to be redirected.
7632
- */
7633
- name: string;
7634
- /**
7635
- * Redirect only exact matching request.
7636
- */
7637
- onlyModule?: boolean;
7638
- }[];
7639
- aliasFields: Set<EntryItem>;
7701
+ alias: AliasOption[];
7702
+ fallback: AliasOption[];
7703
+ aliasFields: Set<string | string[]>;
7640
7704
  cachePredicate: (arg0: ResolveRequest) => boolean;
7641
7705
  cacheWithContext: boolean;
7642
7706
 
@@ -7646,20 +7710,17 @@ declare interface ResolveOptionsTypes {
7646
7710
  conditionNames: Set<string>;
7647
7711
  descriptionFiles: string[];
7648
7712
  enforceExtension: boolean;
7649
- exportsFields: Set<EntryItem>;
7650
- importsFields: Set<EntryItem>;
7713
+ exportsFields: Set<string | string[]>;
7714
+ importsFields: Set<string | string[]>;
7651
7715
  extensions: Set<string>;
7652
7716
  fileSystem: FileSystem;
7653
- unsafeCache: any;
7717
+ unsafeCache: false | object;
7654
7718
  symlinks: boolean;
7655
7719
  resolver?: Resolver;
7656
- modules: EntryItem[];
7720
+ modules: (string | string[])[];
7657
7721
  mainFields: { name: string[]; forceRelative: boolean }[];
7658
7722
  mainFiles: Set<string>;
7659
- plugins: (
7660
- | { apply: (arg0: Resolver) => void }
7661
- | ((this: Resolver, arg1: Resolver) => void)
7662
- )[];
7723
+ plugins: Plugin[];
7663
7724
  pnpApi: null | PnpApiImpl;
7664
7725
  roots: Set<string>;
7665
7726
  fullySpecified: boolean;
@@ -7681,7 +7742,7 @@ declare interface ResolveOptionsWebpackOptions {
7681
7742
  /**
7682
7743
  * New request.
7683
7744
  */
7684
- alias: Target;
7745
+ alias: string | false | string[];
7685
7746
  /**
7686
7747
  * Request to be redirected.
7687
7748
  */
@@ -7691,12 +7752,12 @@ declare interface ResolveOptionsWebpackOptions {
7691
7752
  */
7692
7753
  onlyModule?: boolean;
7693
7754
  }[]
7694
- | { [index: string]: Target };
7755
+ | { [index: string]: string | false | string[] };
7695
7756
 
7696
7757
  /**
7697
7758
  * Fields in the description file (usually package.json) which are used to redirect requests inside the module.
7698
7759
  */
7699
- aliasFields?: EntryItem[];
7760
+ aliasFields?: (string | string[])[];
7700
7761
 
7701
7762
  /**
7702
7763
  * Extra resolve options per dependency category. Typical categories are "commonjs", "amd", "esm".
@@ -7751,7 +7812,7 @@ declare interface ResolveOptionsWebpackOptions {
7751
7812
  /**
7752
7813
  * New request.
7753
7814
  */
7754
- alias: Target;
7815
+ alias: string | false | string[];
7755
7816
  /**
7756
7817
  * Request to be redirected.
7757
7818
  */
@@ -7761,7 +7822,7 @@ declare interface ResolveOptionsWebpackOptions {
7761
7822
  */
7762
7823
  onlyModule?: boolean;
7763
7824
  }[]
7764
- | { [index: string]: Target };
7825
+ | { [index: string]: string | false | string[] };
7765
7826
 
7766
7827
  /**
7767
7828
  * Filesystem for the resolver.
@@ -7781,7 +7842,7 @@ declare interface ResolveOptionsWebpackOptions {
7781
7842
  /**
7782
7843
  * Field names from the description file (package.json) which are used to find the default entry point.
7783
7844
  */
7784
- mainFields?: EntryItem[];
7845
+ mainFields?: (string | string[])[];
7785
7846
 
7786
7847
  /**
7787
7848
  * Filenames used to find the default entry point if there is no description file or main field.
@@ -7897,9 +7958,9 @@ declare abstract class Resolver {
7897
7958
  [ResolveRequest, ResolveContext],
7898
7959
  null | ResolveRequest
7899
7960
  >;
7900
- resolveSync(context: any, path: string, request: string): DevTool;
7961
+ resolveSync(context: object, path: string, request: string): string | false;
7901
7962
  resolve(
7902
- context: any,
7963
+ context: object,
7903
7964
  path: string,
7904
7965
  request: string,
7905
7966
  resolveContext: ResolveContext,
@@ -7951,6 +8012,7 @@ declare interface ResourceDataWithData {
7951
8012
  fragment: string;
7952
8013
  data: Record<string, any>;
7953
8014
  }
8015
+ type Rule = string | RegExp;
7954
8016
  declare interface RuleSet {
7955
8017
  /**
7956
8018
  * map of references in the rule set (may grow over time)
@@ -8000,6 +8062,25 @@ type RuleSetConditionAbsolute =
8000
8062
  }
8001
8063
  | ((value: string) => boolean)
8002
8064
  | RuleSetConditionAbsolute[];
8065
+ type RuleSetConditionOrConditions =
8066
+ | string
8067
+ | RegExp
8068
+ | {
8069
+ /**
8070
+ * Logical AND.
8071
+ */
8072
+ and?: RuleSetCondition[];
8073
+ /**
8074
+ * Logical NOT.
8075
+ */
8076
+ not?: RuleSetCondition[];
8077
+ /**
8078
+ * Logical OR.
8079
+ */
8080
+ or?: RuleSetCondition[];
8081
+ }
8082
+ | ((value: string) => boolean)
8083
+ | RuleSetCondition[];
8003
8084
 
8004
8085
  /**
8005
8086
  * A rule description with conditions and effects for modules.
@@ -8054,7 +8135,7 @@ declare interface RuleSetRule {
8054
8135
  /**
8055
8136
  * Match values of properties in the description file (usually package.json).
8056
8137
  */
8057
- descriptionData?: { [index: string]: RuleSetCondition };
8138
+ descriptionData?: { [index: string]: RuleSetConditionOrConditions };
8058
8139
 
8059
8140
  /**
8060
8141
  * Enforce this rule as pre or post step.
@@ -8775,7 +8856,7 @@ declare abstract class RuntimeTemplate {
8775
8856
  /**
8776
8857
  * the export name
8777
8858
  */
8778
- exportName: EntryItem;
8859
+ exportName: string | string[];
8779
8860
  /**
8780
8861
  * the origin module
8781
8862
  */
@@ -9164,10 +9245,10 @@ declare interface SourceLike {
9164
9245
  }
9165
9246
  declare class SourceMapDevToolPlugin {
9166
9247
  constructor(options?: SourceMapDevToolPluginOptions);
9167
- sourceMapFilename: DevTool;
9168
- sourceMappingURLComment: DevTool;
9169
- moduleFilenameTemplate: DevtoolFallbackModuleFilenameTemplate;
9170
- fallbackModuleFilenameTemplate: DevtoolFallbackModuleFilenameTemplate;
9248
+ sourceMapFilename: string | false;
9249
+ sourceMappingURLComment: string | false;
9250
+ moduleFilenameTemplate: string | Function;
9251
+ fallbackModuleFilenameTemplate: string | Function;
9171
9252
  namespace: string;
9172
9253
  options: SourceMapDevToolPluginOptions;
9173
9254
 
@@ -9190,7 +9271,7 @@ declare interface SourceMapDevToolPluginOptions {
9190
9271
  /**
9191
9272
  * Exclude modules that match the given value from source map generation.
9192
9273
  */
9193
- exclude?: string | RegExp | (string | RegExp)[];
9274
+ exclude?: string | RegExp | Rule[];
9194
9275
 
9195
9276
  /**
9196
9277
  * Generator string or function to create identifiers of modules for the 'sources' array in the SourceMap used only if 'moduleFilenameTemplate' would result in a conflict.
@@ -9210,7 +9291,7 @@ declare interface SourceMapDevToolPluginOptions {
9210
9291
  /**
9211
9292
  * Include source maps for module paths that match the given value.
9212
9293
  */
9213
- include?: string | RegExp | (string | RegExp)[];
9294
+ include?: string | RegExp | Rule[];
9214
9295
 
9215
9296
  /**
9216
9297
  * Indicates whether SourceMaps from loaders should be used (defaults to true).
@@ -9245,7 +9326,7 @@ declare interface SourceMapDevToolPluginOptions {
9245
9326
  /**
9246
9327
  * Include source maps for modules based on their extension (defaults to .js and .css).
9247
9328
  */
9248
- test?: string | RegExp | (string | RegExp)[];
9329
+ test?: string | RegExp | Rule[];
9249
9330
  }
9250
9331
  declare class SourceMapSource extends Source {
9251
9332
  constructor(
@@ -9272,11 +9353,11 @@ declare interface SourcePosition {
9272
9353
  declare interface SplitChunksOptions {
9273
9354
  chunksFilter: (chunk: Chunk) => boolean;
9274
9355
  defaultSizeTypes: string[];
9275
- minSize: Record<string, number>;
9276
- minRemainingSize: Record<string, number>;
9277
- enforceSizeThreshold: Record<string, number>;
9278
- maxInitialSize: Record<string, number>;
9279
- maxAsyncSize: Record<string, number>;
9356
+ minSize: SplitChunksSizes;
9357
+ minRemainingSize: SplitChunksSizes;
9358
+ enforceSizeThreshold: SplitChunksSizes;
9359
+ maxInitialSize: SplitChunksSizes;
9360
+ maxAsyncSize: SplitChunksSizes;
9280
9361
  minChunks: number;
9281
9362
  maxAsyncRequests: number;
9282
9363
  maxInitialRequests: number;
@@ -9304,6 +9385,9 @@ declare class SplitChunksPlugin {
9304
9385
  */
9305
9386
  apply(compiler: Compiler): void;
9306
9387
  }
9388
+ declare interface SplitChunksSizes {
9389
+ [index: string]: number;
9390
+ }
9307
9391
  declare abstract class StackedMap<K, V> {
9308
9392
  map: Map<K, InternalCell<V>>;
9309
9393
  stack: Map<K, InternalCell<V>>[];
@@ -9367,7 +9451,7 @@ declare abstract class StatsFactory {
9367
9451
  SyncBailHook<[any, StatsFactoryContext, number, number], any>
9368
9452
  >;
9369
9453
  groupResults: HookMap<
9370
- SyncBailHook<[GroupConfig<any, object>[], StatsFactoryContext], any>
9454
+ SyncBailHook<[GroupConfig[], StatsFactoryContext], any>
9371
9455
  >;
9372
9456
  sortResults: HookMap<
9373
9457
  SyncBailHook<
@@ -9386,7 +9470,7 @@ declare abstract class StatsFactory {
9386
9470
  create(
9387
9471
  type: string,
9388
9472
  data: any,
9389
- baseContext: Pick<StatsFactoryContext, string>
9473
+ baseContext: Omit<StatsFactoryContext, "type">
9390
9474
  ): any;
9391
9475
  }
9392
9476
  type StatsFactoryContext = KnownStatsFactoryContext & Record<string, any>;
@@ -9837,7 +9921,6 @@ declare interface TagInfo {
9837
9921
  data: any;
9838
9922
  next?: TagInfo;
9839
9923
  }
9840
- type Target = string | false | string[];
9841
9924
  declare class Template {
9842
9925
  constructor();
9843
9926
  static getFunctionContent(fn: Function): string;
@@ -9847,9 +9930,9 @@ declare class Template {
9847
9930
  static toPath(str: string): string;
9848
9931
  static numberToIdentifier(n: number): string;
9849
9932
  static numberToIdentifierContinuation(n: number): string;
9850
- static indent(s: EntryItem): string;
9851
- static prefix(s: EntryItem, prefix: string): string;
9852
- static asString(str: EntryItem): string;
9933
+ static indent(s: string | string[]): string;
9934
+ static prefix(s: string | string[], prefix: string): string;
9935
+ static asString(str: string | string[]): string;
9853
9936
  static getModulesArrayBounds(modules: WithId[]): false | [number, number];
9854
9937
  static renderChunkModules(
9855
9938
  renderContext: RenderContextModuleTemplate,
@@ -9893,47 +9976,17 @@ declare interface UserResolveOptions {
9893
9976
  /**
9894
9977
  * A list of module alias configurations or an object which maps key to value
9895
9978
  */
9896
- alias?:
9897
- | { [index: string]: Target }
9898
- | {
9899
- /**
9900
- * New request.
9901
- */
9902
- alias: Target;
9903
- /**
9904
- * Request to be redirected.
9905
- */
9906
- name: string;
9907
- /**
9908
- * Redirect only exact matching request.
9909
- */
9910
- onlyModule?: boolean;
9911
- }[];
9979
+ alias?: AliasOption[] | AliasOptions;
9912
9980
 
9913
9981
  /**
9914
9982
  * A list of module alias configurations or an object which maps key to value, applied only after modules option
9915
9983
  */
9916
- fallback?:
9917
- | { [index: string]: Target }
9918
- | {
9919
- /**
9920
- * New request.
9921
- */
9922
- alias: Target;
9923
- /**
9924
- * Request to be redirected.
9925
- */
9926
- name: string;
9927
- /**
9928
- * Redirect only exact matching request.
9929
- */
9930
- onlyModule?: boolean;
9931
- }[];
9984
+ fallback?: AliasOption[] | AliasOptions;
9932
9985
 
9933
9986
  /**
9934
9987
  * A list of alias fields in description files
9935
9988
  */
9936
- aliasFields?: EntryItem[];
9989
+ aliasFields?: (string | string[])[];
9937
9990
 
9938
9991
  /**
9939
9992
  * A function which decides whether a request should be cached or not. An object is passed with at least `path` and `request` properties.
@@ -9963,12 +10016,12 @@ declare interface UserResolveOptions {
9963
10016
  /**
9964
10017
  * A list of exports fields in description files
9965
10018
  */
9966
- exportsFields?: EntryItem[];
10019
+ exportsFields?: (string | string[])[];
9967
10020
 
9968
10021
  /**
9969
10022
  * A list of imports fields in description files
9970
10023
  */
9971
- importsFields?: EntryItem[];
10024
+ importsFields?: (string | string[])[];
9972
10025
 
9973
10026
  /**
9974
10027
  * A list of extensions which should be tried for files
@@ -9983,7 +10036,7 @@ declare interface UserResolveOptions {
9983
10036
  /**
9984
10037
  * Use this cache object to unsafely cache the successful requests
9985
10038
  */
9986
- unsafeCache?: any;
10039
+ unsafeCache?: boolean | object;
9987
10040
 
9988
10041
  /**
9989
10042
  * Resolve symlinks to their symlinked location
@@ -10006,7 +10059,7 @@ declare interface UserResolveOptions {
10006
10059
  mainFields?: (
10007
10060
  | string
10008
10061
  | string[]
10009
- | { name: EntryItem; forceRelative: boolean }
10062
+ | { name: string | string[]; forceRelative: boolean }
10010
10063
  )[];
10011
10064
 
10012
10065
  /**
@@ -10017,10 +10070,7 @@ declare interface UserResolveOptions {
10017
10070
  /**
10018
10071
  * A list of additional resolve plugins which should be applied
10019
10072
  */
10020
- plugins?: (
10021
- | { apply: (arg0: Resolver) => void }
10022
- | ((this: Resolver, arg1: Resolver) => void)
10023
- )[];
10073
+ plugins?: Plugin[];
10024
10074
 
10025
10075
  /**
10026
10076
  * A PnP API that should be used - null is "never", undefined is "auto"
@@ -10081,8 +10131,8 @@ declare interface WatchFileSystem {
10081
10131
  options: WatchOptions,
10082
10132
  callback: (
10083
10133
  arg0: undefined | Error,
10084
- arg1: Map<string, FileSystemInfoEntry>,
10085
- arg2: Map<string, FileSystemInfoEntry>,
10134
+ arg1: Map<string, FileSystemInfoEntry | "ignore">,
10135
+ arg2: Map<string, FileSystemInfoEntry | "ignore">,
10086
10136
  arg3: Set<string>,
10087
10137
  arg4: Set<string>
10088
10138
  ) => void,
@@ -10148,12 +10198,12 @@ declare interface Watcher {
10148
10198
  /**
10149
10199
  * get info about files
10150
10200
  */
10151
- getFileTimeInfoEntries: () => Map<string, FileSystemInfoEntry>;
10201
+ getFileTimeInfoEntries: () => Map<string, FileSystemInfoEntry | "ignore">;
10152
10202
 
10153
10203
  /**
10154
10204
  * get info about directories
10155
10205
  */
10156
- getContextTimeInfoEntries: () => Map<string, FileSystemInfoEntry>;
10206
+ getContextTimeInfoEntries: () => Map<string, FileSystemInfoEntry | "ignore">;
10157
10207
  }
10158
10208
  declare abstract class Watching {
10159
10209
  startTime: null | number;
@@ -10489,6 +10539,9 @@ declare interface WithOptions {
10489
10539
  arg0: Partial<ResolveOptionsWithDependencyType>
10490
10540
  ) => ResolverWithOptions;
10491
10541
  }
10542
+ declare interface WriteOnlySet<T> {
10543
+ add: (T?: any) => void;
10544
+ }
10492
10545
  type __TypeWebpackOptions = (
10493
10546
  data: object
10494
10547
  ) =>
@@ -10753,7 +10806,7 @@ declare namespace exports {
10753
10806
  export { ProfilingPlugin };
10754
10807
  }
10755
10808
  export namespace util {
10756
- export const createHash: (algorithm: HashFunction) => Hash;
10809
+ export const createHash: (algorithm: string | typeof Hash) => Hash;
10757
10810
  export namespace comparators {
10758
10811
  export let compareChunksById: (a: Chunk, b: Chunk) => 0 | 1 | -1;
10759
10812
  export let compareModulesByIdentifier: (