webpack 5.105.0 → 5.105.2

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 (92) hide show
  1. package/README.md +2 -2
  2. package/lib/AsyncDependenciesBlock.js +5 -2
  3. package/lib/AsyncDependencyToInitialChunkError.js +2 -0
  4. package/lib/BannerPlugin.js +3 -1
  5. package/lib/Chunk.js +4 -4
  6. package/lib/ChunkRenderError.js +7 -2
  7. package/lib/Compilation.js +4 -0
  8. package/lib/Compiler.js +1 -1
  9. package/lib/DefinePlugin.js +12 -7
  10. package/lib/DynamicEntryPlugin.js +7 -1
  11. package/lib/ExternalModuleFactoryPlugin.js +9 -2
  12. package/lib/ExternalsPlugin.js +2 -1
  13. package/lib/IgnoreWarningsPlugin.js +5 -2
  14. package/lib/ManifestPlugin.js +4 -0
  15. package/lib/ModuleError.js +2 -0
  16. package/lib/ModuleFilenameHelpers.js +2 -1
  17. package/lib/NormalModule.js +2 -0
  18. package/lib/UnsupportedFeatureWarning.js +2 -0
  19. package/lib/WebpackOptionsApply.js +1 -1
  20. package/lib/asset/AssetGenerator.js +9 -0
  21. package/lib/asset/AssetParser.js +4 -0
  22. package/lib/container/ContainerEntryDependency.js +3 -0
  23. package/lib/container/ContainerEntryModule.js +3 -0
  24. package/lib/container/ContainerExposedDependency.js +1 -0
  25. package/lib/container/FallbackDependency.js +1 -0
  26. package/lib/container/FallbackItemDependency.js +1 -0
  27. package/lib/container/FallbackModule.js +2 -0
  28. package/lib/container/ModuleFederationPlugin.js +1 -1
  29. package/lib/container/RemoteModule.js +5 -0
  30. package/lib/dependencies/CssIcssExportDependency.js +2 -0
  31. package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +2 -1
  32. package/lib/dependencies/HarmonyImportDependency.js +1 -1
  33. package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +14 -11
  34. package/lib/dependencies/RequireEnsureDependenciesBlock.js +1 -1
  35. package/lib/electron/ElectronTargetPlugin.js +3 -1
  36. package/lib/ids/ChunkModuleIdRangePlugin.js +7 -7
  37. package/lib/ids/DeterministicChunkIdsPlugin.js +1 -0
  38. package/lib/ids/DeterministicModuleIdsPlugin.js +1 -0
  39. package/lib/ids/HashedModuleIdsPlugin.js +3 -8
  40. package/lib/ids/NamedChunkIdsPlugin.js +7 -5
  41. package/lib/ids/NamedModuleIdsPlugin.js +1 -0
  42. package/lib/ids/OccurrenceChunkIdsPlugin.js +2 -2
  43. package/lib/ids/OccurrenceModuleIdsPlugin.js +3 -3
  44. package/lib/ids/SyncModuleIdsPlugin.js +25 -19
  45. package/lib/json/JsonGenerator.js +1 -0
  46. package/lib/json/JsonParser.js +3 -2
  47. package/lib/logging/Logger.js +9 -5
  48. package/lib/logging/createConsoleLogger.js +2 -1
  49. package/lib/node/CommonJsChunkLoadingPlugin.js +5 -4
  50. package/lib/node/NodeEnvironmentPlugin.js +1 -0
  51. package/lib/node/NodeTargetPlugin.js +9 -1
  52. package/lib/node/NodeTemplatePlugin.js +1 -0
  53. package/lib/node/NodeWatchFileSystem.js +3 -0
  54. package/lib/node/ReadFileChunkLoadingRuntimeModule.js +1 -0
  55. package/lib/node/ReadFileCompileAsyncWasmPlugin.js +1 -0
  56. package/lib/node/ReadFileCompileWasmPlugin.js +1 -0
  57. package/lib/node/RequireChunkLoadingRuntimeModule.js +1 -0
  58. package/lib/optimize/AggressiveSplittingPlugin.js +5 -0
  59. package/lib/optimize/LimitChunkCountPlugin.js +3 -2
  60. package/lib/optimize/MergeDuplicateChunksPlugin.js +2 -1
  61. package/lib/optimize/RealContentHashPlugin.js +2 -0
  62. package/lib/optimize/RuntimeChunkPlugin.js +3 -5
  63. package/lib/optimize/SplitChunksPlugin.js +9 -2
  64. package/lib/performance/SizeLimitsPlugin.js +6 -6
  65. package/lib/prefetch/ChunkPrefetchFunctionRuntimeModule.js +2 -0
  66. package/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js +3 -1
  67. package/lib/prefetch/ChunkPrefetchTriggerRuntimeModule.js +1 -0
  68. package/lib/prefetch/ChunkPreloadTriggerRuntimeModule.js +1 -0
  69. package/lib/rules/RuleSetCompiler.js +4 -0
  70. package/lib/runtime/GetChunkFilenameRuntimeModule.js +1 -0
  71. package/lib/runtime/GetFullHashRuntimeModule.js +1 -0
  72. package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +1 -0
  73. package/lib/schemes/HttpUriPlugin.js +12 -13
  74. package/lib/schemes/VirtualUrlPlugin.js +21 -0
  75. package/lib/stats/DefaultStatsFactoryPlugin.js +6 -0
  76. package/lib/url/URLParserPlugin.js +1 -0
  77. package/lib/util/hash/BatchedHash.js +1 -0
  78. package/lib/util/hash/BulkUpdateHash.js +1 -0
  79. package/lib/util/hash/wasm-hash.js +2 -1
  80. package/lib/wasm/EnableWasmLoadingPlugin.js +1 -0
  81. package/lib/webpack.js +3 -1
  82. package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +2 -0
  83. package/package.json +15 -10
  84. package/schemas/WebpackOptions.json +50 -50
  85. package/schemas/plugins/BannerPlugin.json +2 -2
  86. package/schemas/plugins/IgnorePlugin.json +1 -1
  87. package/schemas/plugins/ManifestPlugin.json +3 -3
  88. package/schemas/plugins/ProgressPlugin.json +1 -1
  89. package/schemas/plugins/SourceMapDevToolPlugin.json +2 -2
  90. package/schemas/plugins/schemes/HttpUriPlugin.json +1 -1
  91. package/schemas/plugins/schemes/VirtualUrlPlugin.json +3 -3
  92. package/types.d.ts +100 -43
package/types.d.ts CHANGED
@@ -459,18 +459,11 @@ declare abstract class AssetSourceGenerator extends Generator {
459
459
  declare abstract class AssetSourceParser extends ParserClass {}
460
460
  declare class AsyncDependenciesBlock extends DependenciesBlock {
461
461
  constructor(
462
- groupOptions:
463
- | null
464
- | string
465
- | (RawChunkGroupOptions & { name?: null | string } & {
466
- entryOptions?: EntryOptions;
467
- } & { circular?: boolean }),
462
+ groupOptions: null | string | GroupOptionsAsyncDependenciesBlock,
468
463
  loc?: null | SyntheticDependencyLocation | RealDependencyLocation,
469
464
  request?: null | string
470
465
  );
471
- groupOptions: RawChunkGroupOptions & { name?: null | string } & {
472
- entryOptions?: EntryOptions;
473
- } & { circular?: boolean };
466
+ groupOptions: GroupOptionsAsyncDependenciesBlock;
474
467
  loc?: null | SyntheticDependencyLocation | RealDependencyLocation;
475
468
  request?: null | string;
476
469
  chunkName?: null | string;
@@ -571,7 +564,7 @@ declare interface BannerPluginOptions {
571
564
  /**
572
565
  * Exclude all modules matching any of these conditions.
573
566
  */
574
- exclude?: string | RegExp | Rule[] | ((str: string) => boolean);
567
+ exclude?: string | RegExp | ((str: string) => boolean) | Rule[];
575
568
 
576
569
  /**
577
570
  * If true, banner will be placed at the end of the output.
@@ -581,7 +574,7 @@ declare interface BannerPluginOptions {
581
574
  /**
582
575
  * Include all modules matching any of these conditions.
583
576
  */
584
- include?: string | RegExp | Rule[] | ((str: string) => boolean);
577
+ include?: string | RegExp | ((str: string) => boolean) | Rule[];
585
578
 
586
579
  /**
587
580
  * If true, banner will not be wrapped in a comment.
@@ -596,7 +589,7 @@ declare interface BannerPluginOptions {
596
589
  /**
597
590
  * Include all modules that pass test assertion.
598
591
  */
599
- test?: string | RegExp | Rule[] | ((str: string) => boolean);
592
+ test?: string | RegExp | ((str: string) => boolean) | Rule[];
600
593
  }
601
594
  declare interface BaseResolveRequest {
602
595
  /**
@@ -1327,7 +1320,7 @@ declare class Chunk {
1327
1320
  getChildrenOfTypeInOrder(
1328
1321
  chunkGraph: ChunkGraph,
1329
1322
  type: string
1330
- ): undefined | { onChunks: Chunk[]; chunks: Set<Chunk> }[];
1323
+ ): undefined | ChunkChildOfTypeInOrder[];
1331
1324
  getChildIdsByOrdersMap(
1332
1325
  chunkGraph: ChunkGraph,
1333
1326
  includeDirectChildren?: boolean,
@@ -1346,6 +1339,10 @@ declare interface ChunkChildIdsByOrdersMap {
1346
1339
  declare interface ChunkChildIdsByOrdersMapByData {
1347
1340
  [index: string]: ChunkChildIdsByOrdersMap;
1348
1341
  }
1342
+ declare interface ChunkChildOfTypeInOrder {
1343
+ onChunks: Chunk[];
1344
+ chunks: Set<Chunk>;
1345
+ }
1349
1346
  declare interface ChunkConditionMap {
1350
1347
  [index: number]: boolean;
1351
1348
  [index: string]: boolean;
@@ -3937,8 +3934,8 @@ declare class DefinePlugin {
3937
3934
  /**
3938
3935
  * Create a new define plugin
3939
3936
  */
3940
- constructor(definitions: Record<string, CodeValue>);
3941
- definitions: Record<string, CodeValue>;
3937
+ constructor(definitions: Definitions);
3938
+ definitions: Definitions;
3942
3939
 
3943
3940
  /**
3944
3941
  * Apply the plugin
@@ -3960,6 +3957,9 @@ declare interface DefinePluginHooks {
3960
3957
  Record<string, CodeValue>
3961
3958
  >;
3962
3959
  }
3960
+ declare interface Definitions {
3961
+ [index: string]: CodeValue;
3962
+ }
3963
3963
  declare class DelegatedPlugin {
3964
3964
  constructor(options: Options);
3965
3965
  options: Options;
@@ -5304,7 +5304,7 @@ type ExportModeType =
5304
5304
  | "reexport-undefined"
5305
5305
  | "normal-reexport"
5306
5306
  | "dynamic-reexport";
5307
- type ExportPresenceMode = false | 0 | 1 | 2 | 3;
5307
+ type ExportPresenceMode = 0 | 1 | 2 | 3;
5308
5308
  declare interface ExportSpec {
5309
5309
  /**
5310
5310
  * the name of the export
@@ -5684,8 +5684,63 @@ type Externals =
5684
5684
  | ((data: ExternalItemFunctionData) => Promise<ExternalItemValue>)
5685
5685
  | ExternalItem[];
5686
5686
  declare class ExternalsPlugin {
5687
- constructor(type: ExternalsType, externals: Externals);
5688
- type: ExternalsType;
5687
+ constructor(
5688
+ type:
5689
+ | "import"
5690
+ | "var"
5691
+ | "module"
5692
+ | "assign"
5693
+ | "this"
5694
+ | "window"
5695
+ | "self"
5696
+ | "global"
5697
+ | "commonjs"
5698
+ | "commonjs2"
5699
+ | "commonjs-module"
5700
+ | "commonjs-static"
5701
+ | "amd"
5702
+ | "amd-require"
5703
+ | "umd"
5704
+ | "umd2"
5705
+ | "jsonp"
5706
+ | "system"
5707
+ | "promise"
5708
+ | "module-import"
5709
+ | "script"
5710
+ | "node-commonjs"
5711
+ | "asset"
5712
+ | "css-import"
5713
+ | "css-url"
5714
+ | ((dependency: Dependency) => ExternalsType),
5715
+ externals: Externals
5716
+ );
5717
+ type:
5718
+ | "import"
5719
+ | "var"
5720
+ | "module"
5721
+ | "assign"
5722
+ | "this"
5723
+ | "window"
5724
+ | "self"
5725
+ | "global"
5726
+ | "commonjs"
5727
+ | "commonjs2"
5728
+ | "commonjs-module"
5729
+ | "commonjs-static"
5730
+ | "amd"
5731
+ | "amd-require"
5732
+ | "umd"
5733
+ | "umd2"
5734
+ | "jsonp"
5735
+ | "system"
5736
+ | "promise"
5737
+ | "module-import"
5738
+ | "script"
5739
+ | "node-commonjs"
5740
+ | "asset"
5741
+ | "css-import"
5742
+ | "css-url"
5743
+ | ((dependency: Dependency) => ExternalsType);
5689
5744
  externals: Externals;
5690
5745
 
5691
5746
  /**
@@ -6296,10 +6351,13 @@ declare interface GotHandler<T> {
6296
6351
  }
6297
6352
  declare interface GroupConfig<T, R> {
6298
6353
  getKeys: (item: T) => undefined | string[];
6299
- getOptions?: (name: string, items: T[]) => GroupOptions;
6354
+ getOptions?: (name: string, items: T[]) => GroupOptionsSmartGrouping;
6300
6355
  createGroup: (key: string, children: T[], items: T[]) => R;
6301
6356
  }
6302
- declare interface GroupOptions {
6357
+ type GroupOptionsAsyncDependenciesBlock = RawChunkGroupOptions & {
6358
+ name?: null | string;
6359
+ } & { entryOptions?: EntryOptions } & { circular?: boolean };
6360
+ declare interface GroupOptionsSmartGrouping {
6303
6361
  groupChildren?: boolean;
6304
6362
  force?: boolean;
6305
6363
  targetGroupCount?: number;
@@ -6588,6 +6646,7 @@ declare interface HttpUriOptions {
6588
6646
  }
6589
6647
  declare class HttpUriPlugin {
6590
6648
  constructor(options: HttpUriOptions);
6649
+ options: HttpUriOptions;
6591
6650
 
6592
6651
  /**
6593
6652
  * Apply the plugin
@@ -10009,8 +10068,8 @@ declare interface LogEntry {
10009
10068
  | "warn"
10010
10069
  | "info"
10011
10070
  | "log"
10012
- | "profile"
10013
10071
  | "debug"
10072
+ | "profile"
10014
10073
  | "trace"
10015
10074
  | "group"
10016
10075
  | "groupCollapsed"
@@ -10028,8 +10087,8 @@ type LogTypeEnum =
10028
10087
  | "warn"
10029
10088
  | "info"
10030
10089
  | "log"
10031
- | "profile"
10032
10090
  | "debug"
10091
+ | "profile"
10033
10092
  | "trace"
10034
10093
  | "group"
10035
10094
  | "groupCollapsed"
@@ -11061,8 +11120,8 @@ declare interface ModuleOptions {
11061
11120
  noParse?:
11062
11121
  | string
11063
11122
  | RegExp
11064
- | (string | RegExp | ((content: string) => boolean))[]
11065
- | ((content: string) => boolean);
11123
+ | ((content: string) => boolean)
11124
+ | (string | RegExp | ((content: string) => boolean))[];
11066
11125
 
11067
11126
  /**
11068
11127
  * Specify options for each parser.
@@ -11145,8 +11204,8 @@ declare interface ModuleOptionsNormalized {
11145
11204
  noParse?:
11146
11205
  | string
11147
11206
  | RegExp
11148
- | (string | RegExp | ((content: string) => boolean))[]
11149
- | ((content: string) => boolean);
11207
+ | ((content: string) => boolean)
11208
+ | (string | RegExp | ((content: string) => boolean))[];
11150
11209
 
11151
11210
  /**
11152
11211
  * Specify options for each parser.
@@ -11475,8 +11534,7 @@ declare abstract class MultiWatching {
11475
11534
  }
11476
11535
  declare class NamedChunkIdsPlugin {
11477
11536
  constructor(options?: NamedChunkIdsPluginOptions);
11478
- delimiter: string;
11479
- context?: string;
11537
+ options: NamedChunkIdsPluginOptions;
11480
11538
 
11481
11539
  /**
11482
11540
  * Apply the plugin
@@ -11533,11 +11591,6 @@ declare class NoEmitOnErrorsPlugin {
11533
11591
  */
11534
11592
  apply(compiler: Compiler): void;
11535
11593
  }
11536
- type NoParse =
11537
- | string
11538
- | RegExp
11539
- | (string | RegExp | ((content: string) => boolean))[]
11540
- | ((content: string) => boolean);
11541
11594
  type Node = false | NodeOptions;
11542
11595
  declare class NodeEnvironmentPlugin {
11543
11596
  constructor(options: NodeEnvironmentPluginOptions);
@@ -11649,14 +11702,17 @@ declare class NormalModule extends Module {
11649
11702
  associatedObjectForCache?: object
11650
11703
  ): Source;
11651
11704
  markModuleAsErrored(error: WebpackError): void;
11652
- applyNoParseRule(rule: Exclude<NoParse, any[]>, content: string): boolean;
11705
+ applyNoParseRule(
11706
+ rule: string | RegExp | ((content: string) => boolean),
11707
+ content: string
11708
+ ): boolean;
11653
11709
  shouldPreventParsing(
11654
11710
  noParseRule:
11655
11711
  | undefined
11656
11712
  | string
11657
11713
  | RegExp
11658
- | (string | RegExp | ((content: string) => boolean))[]
11659
- | ((content: string) => boolean),
11714
+ | ((content: string) => boolean)
11715
+ | (string | RegExp | ((content: string) => boolean))[],
11660
11716
  request: string
11661
11717
  ): boolean;
11662
11718
  static getCompilationHooks(
@@ -16322,7 +16378,7 @@ declare class RuntimeChunkPlugin {
16322
16378
  */
16323
16379
  name?: (entrypoint: { name: string }) => string;
16324
16380
  });
16325
- options: { name: (entrypoint: { name: string }) => string };
16381
+ options: { name: string | ((entrypoint: { name: string }) => string) };
16326
16382
 
16327
16383
  /**
16328
16384
  * Apply the plugin
@@ -17307,7 +17363,7 @@ declare interface SourceMapDevToolPluginOptions {
17307
17363
  /**
17308
17364
  * Exclude modules that match the given value from source map generation.
17309
17365
  */
17310
- exclude?: string | RegExp | Rule[] | ((str: string) => boolean);
17366
+ exclude?: string | RegExp | ((str: string) => boolean) | Rule[];
17311
17367
 
17312
17368
  /**
17313
17369
  * 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.
@@ -17329,12 +17385,12 @@ declare interface SourceMapDevToolPluginOptions {
17329
17385
  /**
17330
17386
  * Decide whether to ignore source files that match the specified value in the SourceMap.
17331
17387
  */
17332
- ignoreList?: string | RegExp | Rule[] | ((str: string) => boolean);
17388
+ ignoreList?: string | RegExp | ((str: string) => boolean) | Rule[];
17333
17389
 
17334
17390
  /**
17335
17391
  * Include source maps for module paths that match the given value.
17336
17392
  */
17337
- include?: string | RegExp | Rule[] | ((str: string) => boolean);
17393
+ include?: string | RegExp | ((str: string) => boolean) | Rule[];
17338
17394
 
17339
17395
  /**
17340
17396
  * Indicates whether SourceMaps from loaders should be used (defaults to true).
@@ -17371,7 +17427,7 @@ declare interface SourceMapDevToolPluginOptions {
17371
17427
  /**
17372
17428
  * Include source maps for modules based on their extension (defaults to .js and .css).
17373
17429
  */
17374
- test?: string | RegExp | Rule[] | ((str: string) => boolean);
17430
+ test?: string | RegExp | ((str: string) => boolean) | Rule[];
17375
17431
  }
17376
17432
  declare class SourceMapSource extends Source {
17377
17433
  constructor(
@@ -18282,7 +18338,8 @@ declare interface Stringable {
18282
18338
  }
18283
18339
  type Supports = undefined | string;
18284
18340
  declare class SyncModuleIdsPlugin {
18285
- constructor(__0: SyncModuleIdsPluginOptions);
18341
+ constructor(options: SyncModuleIdsPluginOptions);
18342
+ options: SyncModuleIdsPluginOptions;
18286
18343
 
18287
18344
  /**
18288
18345
  * Apply the plugin
@@ -18837,7 +18894,7 @@ declare abstract class WebpackLogger {
18837
18894
  info(...args: any[]): void;
18838
18895
  log(...args: any[]): void;
18839
18896
  debug(...args: any[]): void;
18840
- assert(assertion: any, ...args: any[]): void;
18897
+ assert(condition: undefined | boolean, ...args: any[]): void;
18841
18898
  trace(): void;
18842
18899
  clear(): void;
18843
18900
  status(...args: any[]): void;