webpack 5.77.0 → 5.79.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 (82) hide show
  1. package/bin/webpack.js +0 -0
  2. package/lib/APIPlugin.js +25 -18
  3. package/lib/CompatibilityPlugin.js +80 -62
  4. package/lib/Compiler.js +7 -4
  5. package/lib/ConstPlugin.js +22 -15
  6. package/lib/ContextModule.js +3 -2
  7. package/lib/DefinePlugin.js +62 -42
  8. package/lib/DelegatedModule.js +2 -1
  9. package/lib/DllModule.js +2 -1
  10. package/lib/ErrorHelpers.js +61 -22
  11. package/lib/ExportsInfoApiPlugin.js +16 -9
  12. package/lib/ExternalModule.js +2 -1
  13. package/lib/FlagAllModulesAsUsedPlugin.js +22 -27
  14. package/lib/FlagDependencyExportsPlugin.js +336 -348
  15. package/lib/FlagDependencyUsagePlugin.js +6 -8
  16. package/lib/FlagEntryExportAsUsedPlugin.js +22 -23
  17. package/lib/HotModuleReplacementPlugin.js +50 -45
  18. package/lib/JavascriptMetaInfoPlugin.js +16 -9
  19. package/lib/LibManifestPlugin.js +2 -1
  20. package/lib/ModuleTypeConstants.js +50 -0
  21. package/lib/NodeStuffPlugin.js +35 -31
  22. package/lib/NormalModule.js +2 -1
  23. package/lib/NormalModuleFactory.js +7 -1
  24. package/lib/NormalModuleReplacementPlugin.js +1 -1
  25. package/lib/ProvidePlugin.js +17 -10
  26. package/lib/RawModule.js +2 -1
  27. package/lib/RequireJsStuffPlugin.js +15 -15
  28. package/lib/UseStrictPlugin.js +15 -8
  29. package/lib/WebpackIsIncludedPlugin.js +16 -9
  30. package/lib/config/defaults.js +16 -8
  31. package/lib/config/normalization.js +4 -0
  32. package/lib/container/ContainerEntryModule.js +2 -1
  33. package/lib/css/CssLoadingRuntimeModule.js +1 -1
  34. package/lib/css/CssParser.js +28 -8
  35. package/lib/css/walkCssTokens.js +6 -1
  36. package/lib/debug/ProfilingPlugin.js +20 -12
  37. package/lib/dependencies/AMDPlugin.js +26 -20
  38. package/lib/dependencies/CommonJsImportsParserPlugin.js +5 -4
  39. package/lib/dependencies/CommonJsPlugin.js +29 -25
  40. package/lib/dependencies/HarmonyDetectionParserPlugin.js +3 -1
  41. package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +4 -0
  42. package/lib/dependencies/HarmonyImportSpecifierDependency.js +28 -3
  43. package/lib/dependencies/HarmonyModulesPlugin.js +11 -5
  44. package/lib/dependencies/ImportMetaContextPlugin.js +11 -5
  45. package/lib/dependencies/ImportMetaPlugin.js +26 -20
  46. package/lib/dependencies/ImportPlugin.js +14 -7
  47. package/lib/dependencies/RequireContextPlugin.js +12 -6
  48. package/lib/dependencies/RequireEnsurePlugin.js +13 -7
  49. package/lib/dependencies/RequireIncludePlugin.js +11 -5
  50. package/lib/dependencies/SystemPlugin.js +21 -15
  51. package/lib/dependencies/URLPlugin.js +15 -9
  52. package/lib/dependencies/WorkerPlugin.js +14 -8
  53. package/lib/index.js +5 -0
  54. package/lib/javascript/JavascriptModulesPlugin.js +157 -164
  55. package/lib/javascript/JavascriptParser.js +88 -0
  56. package/lib/json/JsonModulesPlugin.js +13 -5
  57. package/lib/library/AmdLibraryPlugin.js +22 -6
  58. package/lib/node/ReadFileCompileAsyncWasmPlugin.js +2 -1
  59. package/lib/node/ReadFileCompileWasmPlugin.js +2 -1
  60. package/lib/optimize/ConcatenatedModule.js +2 -1
  61. package/lib/optimize/InnerGraphPlugin.js +47 -46
  62. package/lib/optimize/SideEffectsFlagPlugin.js +43 -43
  63. package/lib/sharing/ConsumeSharedPlugin.js +4 -0
  64. package/lib/stats/DefaultStatsPrinterPlugin.js +14 -0
  65. package/lib/util/hash/md4.js +2 -2
  66. package/lib/util/hash/xxhash64.js +1 -1
  67. package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +9 -6
  68. package/lib/wasm-sync/WebAssemblyModulesPlugin.js +42 -43
  69. package/lib/web/FetchCompileAsyncWasmPlugin.js +2 -1
  70. package/lib/web/FetchCompileWasmPlugin.js +40 -40
  71. package/lib/webpack.js +1 -1
  72. package/package.json +41 -36
  73. package/schemas/WebpackOptions.check.js +1 -1
  74. package/schemas/WebpackOptions.json +18 -0
  75. package/schemas/plugins/ProgressPlugin.check.js +1 -1
  76. package/schemas/plugins/SourceMapDevToolPlugin.check.js +1 -1
  77. package/schemas/plugins/container/ContainerPlugin.check.js +1 -1
  78. package/schemas/plugins/container/ContainerPlugin.json +8 -0
  79. package/schemas/plugins/container/ModuleFederationPlugin.check.js +1 -1
  80. package/schemas/plugins/container/ModuleFederationPlugin.json +8 -0
  81. package/schemas/plugins/sharing/SharePlugin.check.js +1 -1
  82. package/types.d.ts +152 -122
package/types.d.ts CHANGED
@@ -82,7 +82,11 @@ import {
82
82
  WithStatement,
83
83
  YieldExpression
84
84
  } from "estree";
85
- import { ServerOptions as ServerOptionsImport } from "http";
85
+ import {
86
+ IncomingMessage,
87
+ ServerOptions as ServerOptionsImport,
88
+ ServerResponse
89
+ } from "http";
86
90
  import { ListenOptions, Server } from "net";
87
91
  import { validate as validateFunction } from "schema-utils";
88
92
  import { default as ValidationError } from "schema-utils/declarations/ValidationError";
@@ -3825,32 +3829,32 @@ declare interface ExposesObject {
3825
3829
  }
3826
3830
  type Expression =
3827
3831
  | UnaryExpression
3828
- | ThisExpression
3829
3832
  | ArrayExpression
3830
- | ObjectExpression
3831
- | FunctionExpression
3832
3833
  | ArrowFunctionExpression
3833
- | YieldExpression
3834
+ | AssignmentExpression
3835
+ | AwaitExpression
3836
+ | BinaryExpression
3837
+ | SimpleCallExpression
3838
+ | NewExpression
3839
+ | ChainExpression
3840
+ | ClassExpression
3841
+ | ConditionalExpression
3842
+ | FunctionExpression
3843
+ | Identifier
3844
+ | ImportExpression
3834
3845
  | SimpleLiteral
3835
3846
  | RegExpLiteral
3836
3847
  | BigIntLiteral
3837
- | UpdateExpression
3838
- | BinaryExpression
3839
- | AssignmentExpression
3840
3848
  | LogicalExpression
3841
3849
  | MemberExpression
3842
- | ConditionalExpression
3843
- | SimpleCallExpression
3844
- | NewExpression
3850
+ | MetaProperty
3851
+ | ObjectExpression
3845
3852
  | SequenceExpression
3846
- | TemplateLiteral
3847
3853
  | TaggedTemplateExpression
3848
- | ClassExpression
3849
- | MetaProperty
3850
- | Identifier
3851
- | AwaitExpression
3852
- | ImportExpression
3853
- | ChainExpression;
3854
+ | TemplateLiteral
3855
+ | ThisExpression
3856
+ | UpdateExpression
3857
+ | YieldExpression;
3854
3858
  declare interface ExpressionExpressionInfo {
3855
3859
  type: "expression";
3856
3860
  rootInfo: string | VariableInfo;
@@ -4946,13 +4950,13 @@ declare class JavascriptParser extends Parser {
4946
4950
  >;
4947
4951
  evaluateIdentifier: HookMap<
4948
4952
  SyncBailHook<
4949
- [ThisExpression | MemberExpression | MetaProperty | Identifier],
4953
+ [Identifier | MemberExpression | MetaProperty | ThisExpression],
4950
4954
  undefined | null | BasicEvaluatedExpression
4951
4955
  >
4952
4956
  >;
4953
4957
  evaluateDefinedIdentifier: HookMap<
4954
4958
  SyncBailHook<
4955
- [ThisExpression | MemberExpression | Identifier],
4959
+ [Identifier | MemberExpression | ThisExpression],
4956
4960
  undefined | null | BasicEvaluatedExpression
4957
4961
  >
4958
4962
  >;
@@ -4976,32 +4980,32 @@ declare class JavascriptParser extends Parser {
4976
4980
  [
4977
4981
  (
4978
4982
  | UnaryExpression
4979
- | ThisExpression
4980
4983
  | ArrayExpression
4981
- | ObjectExpression
4982
- | FunctionExpression
4983
4984
  | ArrowFunctionExpression
4984
- | YieldExpression
4985
+ | AssignmentExpression
4986
+ | AwaitExpression
4987
+ | BinaryExpression
4988
+ | SimpleCallExpression
4989
+ | NewExpression
4990
+ | ChainExpression
4991
+ | ClassExpression
4992
+ | ConditionalExpression
4993
+ | FunctionExpression
4994
+ | Identifier
4995
+ | ImportExpression
4985
4996
  | SimpleLiteral
4986
4997
  | RegExpLiteral
4987
4998
  | BigIntLiteral
4988
- | UpdateExpression
4989
- | BinaryExpression
4990
- | AssignmentExpression
4991
4999
  | LogicalExpression
4992
5000
  | MemberExpression
4993
- | ConditionalExpression
4994
- | SimpleCallExpression
4995
- | NewExpression
5001
+ | MetaProperty
5002
+ | ObjectExpression
4996
5003
  | SequenceExpression
4997
- | TemplateLiteral
4998
5004
  | TaggedTemplateExpression
4999
- | ClassExpression
5000
- | MetaProperty
5001
- | Identifier
5002
- | AwaitExpression
5003
- | ImportExpression
5004
- | ChainExpression
5005
+ | TemplateLiteral
5006
+ | ThisExpression
5007
+ | UpdateExpression
5008
+ | YieldExpression
5005
5009
  | FunctionDeclaration
5006
5010
  | VariableDeclaration
5007
5011
  | ClassDeclaration
@@ -5223,32 +5227,32 @@ declare class JavascriptParser extends Parser {
5223
5227
  semicolons: any;
5224
5228
  statementPath: (
5225
5229
  | UnaryExpression
5226
- | ThisExpression
5227
5230
  | ArrayExpression
5228
- | ObjectExpression
5229
- | FunctionExpression
5230
5231
  | ArrowFunctionExpression
5231
- | YieldExpression
5232
+ | AssignmentExpression
5233
+ | AwaitExpression
5234
+ | BinaryExpression
5235
+ | SimpleCallExpression
5236
+ | NewExpression
5237
+ | ChainExpression
5238
+ | ClassExpression
5239
+ | ConditionalExpression
5240
+ | FunctionExpression
5241
+ | Identifier
5242
+ | ImportExpression
5232
5243
  | SimpleLiteral
5233
5244
  | RegExpLiteral
5234
5245
  | BigIntLiteral
5235
- | UpdateExpression
5236
- | BinaryExpression
5237
- | AssignmentExpression
5238
5246
  | LogicalExpression
5239
5247
  | MemberExpression
5240
- | ConditionalExpression
5241
- | SimpleCallExpression
5242
- | NewExpression
5248
+ | MetaProperty
5249
+ | ObjectExpression
5243
5250
  | SequenceExpression
5244
- | TemplateLiteral
5245
5251
  | TaggedTemplateExpression
5246
- | ClassExpression
5247
- | MetaProperty
5248
- | Identifier
5249
- | AwaitExpression
5250
- | ImportExpression
5251
- | ChainExpression
5252
+ | TemplateLiteral
5253
+ | ThisExpression
5254
+ | UpdateExpression
5255
+ | YieldExpression
5252
5256
  | FunctionDeclaration
5253
5257
  | VariableDeclaration
5254
5258
  | ClassDeclaration
@@ -5273,7 +5277,11 @@ declare class JavascriptParser extends Parser {
5273
5277
  | ForOfStatement
5274
5278
  )[];
5275
5279
  prevStatement: any;
5280
+ destructuringAssignmentProperties: WeakMap<Expression, Set<string>>;
5276
5281
  currentTagData: any;
5282
+ destructuringAssignmentPropertiesFor(
5283
+ node: Expression
5284
+ ): undefined | Set<string>;
5277
5285
  getRenameIdentifier(expr?: any): undefined | string | VariableInfoInterface;
5278
5286
  walkClass(classy: ClassExpression | ClassDeclaration): void;
5279
5287
  preWalkStatements(statements?: any): void;
@@ -5317,6 +5325,8 @@ declare class JavascriptParser extends Parser {
5317
5325
  walkForOfStatement(statement?: any): void;
5318
5326
  preWalkFunctionDeclaration(statement?: any): void;
5319
5327
  walkFunctionDeclaration(statement?: any): void;
5328
+ blockPreWalkExpressionStatement(statement?: any): void;
5329
+ preWalkAssignmentExpression(expression?: any): void;
5320
5330
  blockPreWalkImportDeclaration(statement?: any): void;
5321
5331
  enterDeclaration(declaration?: any, onIdent?: any): void;
5322
5332
  blockPreWalkExportNamedDeclaration(statement?: any): void;
@@ -5326,6 +5336,7 @@ declare class JavascriptParser extends Parser {
5326
5336
  blockPreWalkExportAllDeclaration(statement?: any): void;
5327
5337
  preWalkVariableDeclaration(statement?: any): void;
5328
5338
  blockPreWalkVariableDeclaration(statement?: any): void;
5339
+ preWalkVariableDeclarator(declarator?: any): void;
5329
5340
  walkVariableDeclaration(statement?: any): void;
5330
5341
  blockPreWalkClassDeclaration(statement?: any): void;
5331
5342
  walkClassDeclaration(statement?: any): void;
@@ -5430,32 +5441,32 @@ declare class JavascriptParser extends Parser {
5430
5441
  | undefined
5431
5442
  | null
5432
5443
  | UnaryExpression
5433
- | ThisExpression
5434
5444
  | ArrayExpression
5435
- | ObjectExpression
5436
- | FunctionExpression
5437
5445
  | ArrowFunctionExpression
5438
- | YieldExpression
5446
+ | AssignmentExpression
5447
+ | AwaitExpression
5448
+ | BinaryExpression
5449
+ | SimpleCallExpression
5450
+ | NewExpression
5451
+ | ChainExpression
5452
+ | ClassExpression
5453
+ | ConditionalExpression
5454
+ | FunctionExpression
5455
+ | Identifier
5456
+ | ImportExpression
5439
5457
  | SimpleLiteral
5440
5458
  | RegExpLiteral
5441
5459
  | BigIntLiteral
5442
- | UpdateExpression
5443
- | BinaryExpression
5444
- | AssignmentExpression
5445
5460
  | LogicalExpression
5446
5461
  | MemberExpression
5447
- | ConditionalExpression
5448
- | SimpleCallExpression
5449
- | NewExpression
5462
+ | MetaProperty
5463
+ | ObjectExpression
5450
5464
  | SequenceExpression
5451
- | TemplateLiteral
5452
5465
  | TaggedTemplateExpression
5453
- | ClassExpression
5454
- | MetaProperty
5455
- | Identifier
5456
- | AwaitExpression
5457
- | ImportExpression
5458
- | ChainExpression
5466
+ | TemplateLiteral
5467
+ | ThisExpression
5468
+ | UpdateExpression
5469
+ | YieldExpression
5459
5470
  | FunctionDeclaration
5460
5471
  | VariableDeclaration
5461
5472
  | ClassDeclaration
@@ -5481,32 +5492,32 @@ declare class JavascriptParser extends Parser {
5481
5492
  members: string[];
5482
5493
  object:
5483
5494
  | UnaryExpression
5484
- | ThisExpression
5485
5495
  | ArrayExpression
5486
- | ObjectExpression
5487
- | FunctionExpression
5488
5496
  | ArrowFunctionExpression
5489
- | YieldExpression
5497
+ | AssignmentExpression
5498
+ | AwaitExpression
5499
+ | BinaryExpression
5500
+ | SimpleCallExpression
5501
+ | NewExpression
5502
+ | ChainExpression
5503
+ | ClassExpression
5504
+ | ConditionalExpression
5505
+ | FunctionExpression
5506
+ | Identifier
5507
+ | ImportExpression
5490
5508
  | SimpleLiteral
5491
5509
  | RegExpLiteral
5492
5510
  | BigIntLiteral
5493
- | UpdateExpression
5494
- | BinaryExpression
5495
- | AssignmentExpression
5496
5511
  | LogicalExpression
5497
5512
  | MemberExpression
5498
- | ConditionalExpression
5499
- | SimpleCallExpression
5500
- | NewExpression
5513
+ | MetaProperty
5514
+ | ObjectExpression
5501
5515
  | SequenceExpression
5502
- | TemplateLiteral
5503
5516
  | TaggedTemplateExpression
5504
- | ClassExpression
5505
- | MetaProperty
5506
- | Identifier
5507
- | AwaitExpression
5508
- | ImportExpression
5509
- | ChainExpression
5517
+ | TemplateLiteral
5518
+ | ThisExpression
5519
+ | UpdateExpression
5520
+ | YieldExpression
5510
5521
  | Super;
5511
5522
  membersOptionals: boolean[];
5512
5523
  };
@@ -6133,7 +6144,10 @@ declare interface LazyCompilationDefaultBackendOptions {
6133
6144
  /**
6134
6145
  * Specifies how to create the server handling the EventSource requests.
6135
6146
  */
6136
- server?: ServerOptionsImport | ServerOptionsHttps | (() => typeof Server);
6147
+ server?:
6148
+ | ServerOptionsImport<typeof IncomingMessage>
6149
+ | ServerOptionsHttps<typeof IncomingMessage, typeof ServerResponse>
6150
+ | (() => typeof Server);
6137
6151
  }
6138
6152
 
6139
6153
  /**
@@ -6262,6 +6276,11 @@ type LibraryName = string | string[] | LibraryCustomUmdObject;
6262
6276
  * Options for library.
6263
6277
  */
6264
6278
  declare interface LibraryOptions {
6279
+ /**
6280
+ * Add a container for define/require functions in the AMD module.
6281
+ */
6282
+ amdContainer?: string;
6283
+
6265
6284
  /**
6266
6285
  * Add a comment in the UMD wrapper.
6267
6286
  */
@@ -7541,32 +7560,32 @@ declare class NodeEnvironmentPlugin {
7541
7560
  }
7542
7561
  type NodeEstreeIndex =
7543
7562
  | UnaryExpression
7544
- | ThisExpression
7545
7563
  | ArrayExpression
7546
- | ObjectExpression
7547
- | FunctionExpression
7548
7564
  | ArrowFunctionExpression
7549
- | YieldExpression
7565
+ | AssignmentExpression
7566
+ | AwaitExpression
7567
+ | BinaryExpression
7568
+ | SimpleCallExpression
7569
+ | NewExpression
7570
+ | ChainExpression
7571
+ | ClassExpression
7572
+ | ConditionalExpression
7573
+ | FunctionExpression
7574
+ | Identifier
7575
+ | ImportExpression
7550
7576
  | SimpleLiteral
7551
7577
  | RegExpLiteral
7552
7578
  | BigIntLiteral
7553
- | UpdateExpression
7554
- | BinaryExpression
7555
- | AssignmentExpression
7556
7579
  | LogicalExpression
7557
7580
  | MemberExpression
7558
- | ConditionalExpression
7559
- | SimpleCallExpression
7560
- | NewExpression
7581
+ | MetaProperty
7582
+ | ObjectExpression
7561
7583
  | SequenceExpression
7562
- | TemplateLiteral
7563
7584
  | TaggedTemplateExpression
7564
- | ClassExpression
7565
- | MetaProperty
7566
- | Identifier
7567
- | AwaitExpression
7568
- | ImportExpression
7569
- | ChainExpression
7585
+ | TemplateLiteral
7586
+ | ThisExpression
7587
+ | UpdateExpression
7588
+ | YieldExpression
7570
7589
  | FunctionDeclaration
7571
7590
  | VariableDeclaration
7572
7591
  | ClassDeclaration
@@ -7598,22 +7617,22 @@ type NodeEstreeIndex =
7598
7617
  | PropertyDefinition
7599
7618
  | VariableDeclarator
7600
7619
  | Program
7601
- | SwitchCase
7602
- | CatchClause
7603
- | Property
7604
7620
  | AssignmentProperty
7605
- | Super
7606
- | TemplateElement
7607
- | SpreadElement
7608
- | ObjectPattern
7609
- | ArrayPattern
7610
- | RestElement
7611
- | AssignmentPattern
7621
+ | Property
7622
+ | CatchClause
7612
7623
  | ClassBody
7613
7624
  | ImportSpecifier
7614
7625
  | ImportDefaultSpecifier
7615
7626
  | ImportNamespaceSpecifier
7616
- | ExportSpecifier;
7627
+ | ExportSpecifier
7628
+ | ObjectPattern
7629
+ | ArrayPattern
7630
+ | RestElement
7631
+ | AssignmentPattern
7632
+ | SpreadElement
7633
+ | Super
7634
+ | SwitchCase
7635
+ | TemplateElement;
7617
7636
 
7618
7637
  /**
7619
7638
  * Options object for node compatibility features.
@@ -7907,10 +7926,10 @@ declare class NormalModuleReplacementPlugin {
7907
7926
  */
7908
7927
  constructor(
7909
7928
  resourceRegExp: RegExp,
7910
- newResource: string | ((arg0?: any) => void)
7929
+ newResource: string | ((arg0: ResolveData) => void)
7911
7930
  );
7912
7931
  resourceRegExp: RegExp;
7913
- newResource: string | ((arg0?: any) => void);
7932
+ newResource: string | ((arg0: ResolveData) => void);
7914
7933
 
7915
7934
  /**
7916
7935
  * Apply the plugin
@@ -8417,6 +8436,11 @@ declare class OriginalSource extends Source {
8417
8436
  * Options affecting the output of the compilation. `output` options tell webpack how to write the compiled files to disk.
8418
8437
  */
8419
8438
  declare interface Output {
8439
+ /**
8440
+ * Add a container for define/require functions in the AMD module.
8441
+ */
8442
+ amdContainer?: string;
8443
+
8420
8444
  /**
8421
8445
  * The filename of asset modules as relative path inside the 'output.path' directory.
8422
8446
  */
@@ -10878,9 +10902,10 @@ declare abstract class Serializer {
10878
10902
  serialize(obj?: any, context?: any): any;
10879
10903
  deserialize(value?: any, context?: any): any;
10880
10904
  }
10881
- type ServerOptionsHttps = SecureContextOptions &
10882
- TlsOptions &
10883
- ServerOptionsImport;
10905
+ type ServerOptionsHttps<
10906
+ Request extends typeof IncomingMessage = typeof IncomingMessage,
10907
+ Response extends typeof ServerResponse = typeof ServerResponse
10908
+ > = SecureContextOptions & TlsOptions & ServerOptionsImport<Request, Response>;
10884
10909
  declare class SharePlugin {
10885
10910
  constructor(options: SharePluginOptions);
10886
10911
 
@@ -13172,6 +13197,11 @@ declare namespace exports {
13172
13197
  Entry,
13173
13198
  EntryNormalized,
13174
13199
  EntryObject,
13200
+ ExternalItemFunctionData,
13201
+ ExternalItemObjectKnown,
13202
+ ExternalItemObjectUnknown,
13203
+ ExternalItemValue,
13204
+ Externals,
13175
13205
  FileCacheOptions,
13176
13206
  LibraryOptions,
13177
13207
  ModuleOptions,