webpack 5.45.1 → 5.48.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.

Files changed (31) hide show
  1. package/bin/webpack.js +0 -0
  2. package/hot/only-dev-server.js +1 -1
  3. package/hot/poll.js +1 -1
  4. package/hot/signal.js +1 -1
  5. package/lib/NormalModule.js +14 -8
  6. package/lib/NormalModuleFactory.js +8 -2
  7. package/lib/Template.js +1 -4
  8. package/lib/asset/AssetGenerator.js +1 -1
  9. package/lib/asset/AssetModulesPlugin.js +23 -18
  10. package/lib/config/defaults.js +18 -12
  11. package/lib/dependencies/AMDRequireDependency.js +2 -8
  12. package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +6 -3
  13. package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +4 -2
  14. package/lib/dependencies/HarmonyImportDependency.js +5 -1
  15. package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +40 -5
  16. package/lib/dependencies/HarmonyImportSideEffectDependency.js +2 -2
  17. package/lib/dependencies/HarmonyImportSpecifierDependency.js +10 -2
  18. package/lib/dependencies/ModuleDependency.js +8 -1
  19. package/lib/hmr/HotModuleReplacement.runtime.js +66 -60
  20. package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +2 -8
  21. package/lib/javascript/JavascriptModulesPlugin.js +48 -29
  22. package/lib/javascript/JavascriptParser.js +14 -9
  23. package/lib/rules/{DescriptionDataMatcherRulePlugin.js → ObjectMatcherRulePlugin.js} +14 -10
  24. package/lib/stats/DefaultStatsFactoryPlugin.js +32 -2
  25. package/lib/stats/DefaultStatsPresetPlugin.js +6 -2
  26. package/lib/stats/DefaultStatsPrinterPlugin.js +51 -9
  27. package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +2 -2
  28. package/package.json +3 -2
  29. package/schemas/WebpackOptions.check.js +1 -1
  30. package/schemas/WebpackOptions.json +15 -0
  31. package/types.d.ts +98 -11
@@ -3585,6 +3585,13 @@
3585
3585
  "type": "object",
3586
3586
  "additionalProperties": false,
3587
3587
  "properties": {
3588
+ "assert": {
3589
+ "description": "Match on import assertions of the dependency.",
3590
+ "type": "object",
3591
+ "additionalProperties": {
3592
+ "$ref": "#/definitions/RuleSetConditionOrConditions"
3593
+ }
3594
+ },
3588
3595
  "compiler": {
3589
3596
  "description": "Match the child compiler name.",
3590
3597
  "oneOf": [
@@ -4210,6 +4217,10 @@
4210
4217
  "description": "Group modules by their type.",
4211
4218
  "type": "boolean"
4212
4219
  },
4220
+ "groupReasonsByOrigin": {
4221
+ "description": "Group reasons by their origin module.",
4222
+ "type": "boolean"
4223
+ },
4213
4224
  "hash": {
4214
4225
  "description": "Add the hash of the compilation.",
4215
4226
  "type": "boolean"
@@ -4314,6 +4325,10 @@
4314
4325
  "description": "Add information about the reasons why modules are included.",
4315
4326
  "type": "boolean"
4316
4327
  },
4328
+ "reasonsSpace": {
4329
+ "description": "Space to display reasons (groups will be collapsed to fit this space).",
4330
+ "type": "number"
4331
+ },
4317
4332
  "relatedAssets": {
4318
4333
  "description": "Add information about assets that are related to other assets (like SourceMaps for assets).",
4319
4334
  "type": "boolean"
package/types.d.ts CHANGED
@@ -1099,6 +1099,11 @@ declare interface ChunkRenderContext {
1099
1099
  * init fragments for the chunk
1100
1100
  */
1101
1101
  chunkInitFragments: InitFragment<ChunkRenderContext>[];
1102
+
1103
+ /**
1104
+ * rendering in strict context
1105
+ */
1106
+ strictMode: boolean;
1102
1107
  }
1103
1108
  declare interface ChunkSizeOptions {
1104
1109
  /**
@@ -1787,7 +1792,9 @@ declare interface CompilationAssets {
1787
1792
  [index: string]: Source;
1788
1793
  }
1789
1794
  declare interface CompilationHooksAsyncWebAssemblyModulesPlugin {
1790
- renderModuleContent: SyncWaterfallHook<[Source, Module, RenderContext]>;
1795
+ renderModuleContent: SyncWaterfallHook<
1796
+ [Source, Module, WebAssemblyRenderContext]
1797
+ >;
1791
1798
  }
1792
1799
  declare interface CompilationHooksJavascriptModulesPlugin {
1793
1800
  renderModuleContent: SyncWaterfallHook<[Source, Module, ChunkRenderContext]>;
@@ -4517,7 +4524,7 @@ declare class JavascriptModulesPlugin {
4517
4524
  module: Module,
4518
4525
  renderContext: ChunkRenderContext,
4519
4526
  hooks: CompilationHooksJavascriptModulesPlugin,
4520
- factory: boolean | "strict"
4527
+ factory: boolean
4521
4528
  ): Source;
4522
4529
  renderChunk(
4523
4530
  renderContext: RenderContext,
@@ -4735,21 +4742,44 @@ declare class JavascriptParser extends Parser {
4735
4742
  boolean | void
4736
4743
  >;
4737
4744
  label: HookMap<SyncBailHook<[LabeledStatement], boolean | void>>;
4738
- import: SyncBailHook<[Statement, ImportSource], boolean | void>;
4745
+ import: SyncBailHook<[ImportDeclaration, ImportSource], boolean | void>;
4739
4746
  importSpecifier: SyncBailHook<
4740
- [Statement, ImportSource, string, string],
4747
+ [ImportDeclaration, ImportSource, string, string],
4748
+ boolean | void
4749
+ >;
4750
+ export: SyncBailHook<
4751
+ [ExportNamedDeclaration | ExportAllDeclaration],
4752
+ boolean | void
4753
+ >;
4754
+ exportImport: SyncBailHook<
4755
+ [ExportNamedDeclaration | ExportAllDeclaration, ImportSource],
4756
+ boolean | void
4757
+ >;
4758
+ exportDeclaration: SyncBailHook<
4759
+ [ExportNamedDeclaration | ExportAllDeclaration, Declaration],
4760
+ boolean | void
4761
+ >;
4762
+ exportExpression: SyncBailHook<
4763
+ [ExportDefaultDeclaration, Declaration],
4741
4764
  boolean | void
4742
4765
  >;
4743
- export: SyncBailHook<[Statement], boolean | void>;
4744
- exportImport: SyncBailHook<[Statement, ImportSource], boolean | void>;
4745
- exportDeclaration: SyncBailHook<[Statement, Declaration], boolean | void>;
4746
- exportExpression: SyncBailHook<[Statement, Declaration], boolean | void>;
4747
4766
  exportSpecifier: SyncBailHook<
4748
- [Statement, string, string, undefined | number],
4767
+ [
4768
+ ExportNamedDeclaration | ExportAllDeclaration,
4769
+ string,
4770
+ string,
4771
+ undefined | number
4772
+ ],
4749
4773
  boolean | void
4750
4774
  >;
4751
4775
  exportImportSpecifier: SyncBailHook<
4752
- [Statement, ImportSource, string, string, undefined | number],
4776
+ [
4777
+ ExportNamedDeclaration | ExportAllDeclaration,
4778
+ ImportSource,
4779
+ string,
4780
+ string,
4781
+ undefined | number
4782
+ ],
4753
4783
  boolean | void
4754
4784
  >;
4755
4785
  preDeclarator: SyncBailHook<
@@ -6132,6 +6162,11 @@ declare interface MainRenderContext {
6132
6162
  * hash to be used for render call
6133
6163
  */
6134
6164
  hash: string;
6165
+
6166
+ /**
6167
+ * rendering in strict context
6168
+ */
6169
+ strictMode: boolean;
6135
6170
  }
6136
6171
  declare abstract class MainTemplate {
6137
6172
  hooks: Readonly<{
@@ -6374,6 +6409,7 @@ declare class ModuleDependency extends Dependency {
6374
6409
  request: string;
6375
6410
  userRequest: string;
6376
6411
  range: any;
6412
+ assertions?: Record<string, any>;
6377
6413
  static Template: typeof DependencyTemplate;
6378
6414
  static NO_EXPORTS_REFERENCED: string[][];
6379
6415
  static EXPORTS_OBJECT_REFERENCED: string[][];
@@ -8805,6 +8841,11 @@ declare interface RenderContext {
8805
8841
  * results of code generation
8806
8842
  */
8807
8843
  codeGenerationResults: CodeGenerationResults;
8844
+
8845
+ /**
8846
+ * rendering in strict context
8847
+ */
8848
+ strictMode: boolean;
8808
8849
  }
8809
8850
  type RenderManifestEntry =
8810
8851
  | RenderManifestEntryTemplated
@@ -8930,6 +8971,7 @@ declare interface ResolveData {
8930
8971
  resolveOptions?: ResolveOptionsWebpackOptions;
8931
8972
  context: string;
8932
8973
  request: string;
8974
+ assertions?: Record<string, any>;
8933
8975
  dependencies: ModuleDependency[];
8934
8976
  createData: Object;
8935
8977
  fileDependencies: LazySet<string>;
@@ -9341,6 +9383,11 @@ declare interface RuleSetLogicalConditionsAbsolute {
9341
9383
  * A rule description with conditions and effects for modules.
9342
9384
  */
9343
9385
  declare interface RuleSetRule {
9386
+ /**
9387
+ * Match on import assertions of the dependency.
9388
+ */
9389
+ assert?: { [index: string]: RuleSetConditionOrConditions };
9390
+
9344
9391
  /**
9345
9392
  * Match the child compiler name.
9346
9393
  */
@@ -10899,6 +10946,11 @@ declare interface StatsOptions {
10899
10946
  */
10900
10947
  groupModulesByType?: boolean;
10901
10948
 
10949
+ /**
10950
+ * Group reasons by their origin module.
10951
+ */
10952
+ groupReasonsByOrigin?: boolean;
10953
+
10902
10954
  /**
10903
10955
  * Add the hash of the compilation.
10904
10956
  */
@@ -11004,6 +11056,11 @@ declare interface StatsOptions {
11004
11056
  */
11005
11057
  reasons?: boolean;
11006
11058
 
11059
+ /**
11060
+ * Space to display reasons (groups will be collapsed to fit this space).
11061
+ */
11062
+ reasonsSpace?: number;
11063
+
11007
11064
  /**
11008
11065
  * Add information about assets that are related to other assets (like SourceMaps for assets).
11009
11066
  */
@@ -11119,7 +11176,6 @@ declare class Template {
11119
11176
  runtimeModules: RuntimeModule[],
11120
11177
  renderContext: RenderContext & {
11121
11178
  codeGenerationResults?: CodeGenerationResults;
11122
- useStrict?: boolean;
11123
11179
  }
11124
11180
  ): Source;
11125
11181
  static renderChunkRuntimeModules(
@@ -11452,6 +11508,37 @@ declare abstract class Watching {
11452
11508
  resume(): void;
11453
11509
  close(callback: CallbackFunction<void>): void;
11454
11510
  }
11511
+ declare interface WebAssemblyRenderContext {
11512
+ /**
11513
+ * the chunk
11514
+ */
11515
+ chunk: Chunk;
11516
+
11517
+ /**
11518
+ * the dependency templates
11519
+ */
11520
+ dependencyTemplates: DependencyTemplates;
11521
+
11522
+ /**
11523
+ * the runtime template
11524
+ */
11525
+ runtimeTemplate: RuntimeTemplate;
11526
+
11527
+ /**
11528
+ * the module graph
11529
+ */
11530
+ moduleGraph: ModuleGraph;
11531
+
11532
+ /**
11533
+ * the chunk graph
11534
+ */
11535
+ chunkGraph: ChunkGraph;
11536
+
11537
+ /**
11538
+ * results of code generation
11539
+ */
11540
+ codeGenerationResults: CodeGenerationResults;
11541
+ }
11455
11542
  declare class WebWorkerTemplatePlugin {
11456
11543
  constructor();
11457
11544