webpack 5.70.0 → 5.72.1

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 (60) hide show
  1. package/hot/poll.js +1 -1
  2. package/hot/signal.js +1 -1
  3. package/lib/BannerPlugin.js +3 -1
  4. package/lib/Chunk.js +1 -1
  5. package/lib/ChunkGraph.js +93 -6
  6. package/lib/ChunkGroup.js +1 -1
  7. package/lib/Compilation.js +10 -8
  8. package/lib/Compiler.js +17 -4
  9. package/lib/ConstPlugin.js +2 -2
  10. package/lib/ContextModule.js +31 -8
  11. package/lib/ContextModuleFactory.js +7 -11
  12. package/lib/DelegatedModuleFactoryPlugin.js +1 -1
  13. package/lib/Dependency.js +7 -0
  14. package/lib/DllReferencePlugin.js +1 -1
  15. package/lib/ErrorHelpers.js +2 -2
  16. package/lib/ExportsInfo.js +1 -1
  17. package/lib/ExternalModuleFactoryPlugin.js +4 -4
  18. package/lib/FileSystemInfo.js +8 -0
  19. package/lib/LoaderOptionsPlugin.js +1 -1
  20. package/lib/Module.js +3 -0
  21. package/lib/ModuleFilenameHelpers.js +3 -3
  22. package/lib/NormalModule.js +6 -5
  23. package/lib/NormalModuleFactory.js +2 -2
  24. package/lib/RuntimePlugin.js +25 -0
  25. package/lib/asset/AssetGenerator.js +36 -9
  26. package/lib/asset/AssetParser.js +1 -0
  27. package/lib/asset/AssetSourceGenerator.js +31 -6
  28. package/lib/asset/AssetSourceParser.js +1 -0
  29. package/lib/cache/PackFileCacheStrategy.js +8 -4
  30. package/lib/config/defaults.js +9 -1
  31. package/lib/container/RemoteRuntimeModule.js +8 -7
  32. package/lib/dependencies/CommonJsExportsParserPlugin.js +1 -2
  33. package/lib/dependencies/ContextDependencyHelpers.js +2 -2
  34. package/lib/dependencies/ContextElementDependency.js +33 -1
  35. package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +127 -0
  36. package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +127 -43
  37. package/lib/dependencies/HarmonyImportSpecifierDependency.js +22 -8
  38. package/lib/dependencies/HarmonyModulesPlugin.js +10 -0
  39. package/lib/dependencies/LoaderDependency.js +13 -0
  40. package/lib/dependencies/LoaderImportDependency.js +13 -0
  41. package/lib/esm/ModuleChunkLoadingPlugin.js +3 -1
  42. package/lib/hmr/HotModuleReplacement.runtime.js +29 -14
  43. package/lib/hmr/JavascriptHotModuleReplacement.runtime.js +4 -3
  44. package/lib/ids/HashedModuleIdsPlugin.js +2 -2
  45. package/lib/ids/IdHelpers.js +1 -1
  46. package/lib/javascript/BasicEvaluatedExpression.js +5 -2
  47. package/lib/javascript/JavascriptParser.js +66 -40
  48. package/lib/json/JsonParser.js +1 -1
  49. package/lib/library/UmdLibraryPlugin.js +5 -3
  50. package/lib/optimize/ConcatenatedModule.js +2 -1
  51. package/lib/optimize/ModuleConcatenationPlugin.js +21 -2
  52. package/lib/runtime/BaseUriRuntimeModule.js +31 -0
  53. package/lib/runtime/NonceRuntimeModule.js +24 -0
  54. package/lib/stats/DefaultStatsFactoryPlugin.js +1 -1
  55. package/lib/util/internalSerializables.js +2 -0
  56. package/lib/web/JsonpChunkLoadingRuntimeModule.js +2 -1
  57. package/package.json +3 -3
  58. package/schemas/plugins/BannerPlugin.check.js +1 -1
  59. package/schemas/plugins/BannerPlugin.json +4 -0
  60. package/types.d.ts +38 -11
package/types.d.ts CHANGED
@@ -430,6 +430,11 @@ declare interface BannerPluginOptions {
430
430
  */
431
431
  exclude?: string | RegExp | Rule[];
432
432
 
433
+ /**
434
+ * If true, banner will be placed at the end of the output.
435
+ */
436
+ footer?: boolean;
437
+
433
438
  /**
434
439
  * Include all modules matching any of these conditions.
435
440
  */
@@ -474,9 +479,10 @@ declare abstract class BasicEvaluatedExpression {
474
479
  prefix?: BasicEvaluatedExpression;
475
480
  postfix?: BasicEvaluatedExpression;
476
481
  wrappedInnerExpressions: any;
477
- identifier?: string;
482
+ identifier?: string | VariableInfoInterface;
478
483
  rootInfo: VariableInfoInterface;
479
484
  getMembers: () => string[];
485
+ getMembersOptionals: () => boolean[];
480
486
  expression: NodeEstreeIndex;
481
487
  isUnknown(): boolean;
482
488
  isNull(): boolean;
@@ -528,7 +534,8 @@ declare abstract class BasicEvaluatedExpression {
528
534
  setIdentifier(
529
535
  identifier?: any,
530
536
  rootInfo?: any,
531
- getMembers?: any
537
+ getMembers?: any,
538
+ getMembersOptionals?: any
532
539
  ): BasicEvaluatedExpression;
533
540
  setWrapped(
534
541
  prefix?: any,
@@ -681,6 +688,7 @@ declare interface CallExpressionInfo {
681
688
  getCalleeMembers: () => string[];
682
689
  name: string;
683
690
  getMembers: () => string[];
691
+ getMembersOptionals: () => boolean[];
684
692
  }
685
693
  declare interface CallbackAsyncQueue<T> {
686
694
  (err?: null | WebpackError, result?: T): any;
@@ -809,6 +817,13 @@ declare class ChunkGraph {
809
817
  chunk: Chunk,
810
818
  sourceType: string
811
819
  ): undefined | Iterable<Module>;
820
+ setChunkModuleSourceTypes(
821
+ chunk: Chunk,
822
+ module: Module,
823
+ sourceTypes: Set<string>
824
+ ): void;
825
+ getChunkModuleSourceTypes(chunk: Chunk, module: Module): Set<string>;
826
+ getModuleSourceTypes(module: Module): Set<string>;
812
827
  getOrderedChunkModulesIterable(
813
828
  chunk: Chunk,
814
829
  comparator: (arg0: Module, arg1: Module) => 0 | 1 | -1
@@ -1239,6 +1254,16 @@ declare interface CodeGenerationContext {
1239
1254
  * code generation results of other modules (need to have a codeGenerationDependency to use that)
1240
1255
  */
1241
1256
  codeGenerationResults: CodeGenerationResults;
1257
+
1258
+ /**
1259
+ * the compilation
1260
+ */
1261
+ compilation?: Compilation;
1262
+
1263
+ /**
1264
+ * source types
1265
+ */
1266
+ sourceTypes?: ReadonlySet<string>;
1242
1267
  }
1243
1268
  declare interface CodeGenerationResult {
1244
1269
  /**
@@ -2454,7 +2479,7 @@ declare interface ContainerReferencePluginOptions {
2454
2479
  shareScope?: string;
2455
2480
  }
2456
2481
  declare abstract class ContextElementDependency extends ModuleDependency {
2457
- referencedExports: any;
2482
+ referencedExports?: string[][];
2458
2483
  }
2459
2484
  declare class ContextExclusionPlugin {
2460
2485
  constructor(negativeMatcher: RegExp);
@@ -2637,6 +2662,7 @@ declare class Dependency {
2637
2662
  endLine?: any,
2638
2663
  endColumn?: any
2639
2664
  ): void;
2665
+ getContext(): undefined | string;
2640
2666
  getResourceIdentifier(): null | string;
2641
2667
  couldAffectReferencingModule(): boolean | typeof TRANSITIVE;
2642
2668
 
@@ -3819,6 +3845,7 @@ declare interface ExpressionExpressionInfo {
3819
3845
  rootInfo: string | VariableInfo;
3820
3846
  name: string;
3821
3847
  getMembers: () => string[];
3848
+ getMembersOptionals: () => boolean[];
3822
3849
  }
3823
3850
  type ExternalItem =
3824
3851
  | string
@@ -5097,7 +5124,7 @@ declare class JavascriptParser extends Parser {
5097
5124
  topLevelAwait: SyncBailHook<[Expression], boolean | void>;
5098
5125
  call: HookMap<SyncBailHook<[Expression], boolean | void>>;
5099
5126
  callMemberChain: HookMap<
5100
- SyncBailHook<[CallExpression, string[]], boolean | void>
5127
+ SyncBailHook<[CallExpression, string[], boolean[]], boolean | void>
5101
5128
  >;
5102
5129
  memberChainOfCallMemberChain: HookMap<
5103
5130
  SyncBailHook<
@@ -5113,9 +5140,10 @@ declare class JavascriptParser extends Parser {
5113
5140
  >;
5114
5141
  optionalChaining: SyncBailHook<[ChainExpression], boolean | void>;
5115
5142
  new: HookMap<SyncBailHook<[NewExpression], boolean | void>>;
5143
+ binaryExpression: SyncBailHook<[BinaryExpression], boolean | void>;
5116
5144
  expression: HookMap<SyncBailHook<[Expression], boolean | void>>;
5117
5145
  expressionMemberChain: HookMap<
5118
- SyncBailHook<[Expression, string[]], boolean | void>
5146
+ SyncBailHook<[Expression, string[], boolean[]], boolean | void>
5119
5147
  >;
5120
5148
  unhandledExpressionMemberChain: HookMap<
5121
5149
  SyncBailHook<[Expression, string[]], boolean | void>
@@ -5183,7 +5211,7 @@ declare class JavascriptParser extends Parser {
5183
5211
  )[];
5184
5212
  prevStatement: any;
5185
5213
  currentTagData: any;
5186
- getRenameIdentifier(expr?: any): undefined | string;
5214
+ getRenameIdentifier(expr?: any): undefined | string | VariableInfoInterface;
5187
5215
  walkClass(classy: ClassExpression | ClassDeclaration): void;
5188
5216
  preWalkStatements(statements?: any): void;
5189
5217
  blockPreWalkStatements(statements?: any): void;
@@ -5330,12 +5358,10 @@ declare class JavascriptParser extends Parser {
5330
5358
  enterArrayPattern(pattern?: any, onIdent?: any): void;
5331
5359
  enterRestElement(pattern?: any, onIdent?: any): void;
5332
5360
  enterAssignmentPattern(pattern?: any, onIdent?: any): void;
5333
- evaluateExpression(
5334
- expression: Expression
5335
- ): undefined | BasicEvaluatedExpression;
5361
+ evaluateExpression(expression: Expression): BasicEvaluatedExpression;
5336
5362
  parseString(expression?: any): any;
5337
5363
  parseCalculatedString(expression?: any): any;
5338
- evaluate(source?: any): undefined | BasicEvaluatedExpression;
5364
+ evaluate(source: string): BasicEvaluatedExpression;
5339
5365
  isPure(
5340
5366
  expr:
5341
5367
  | undefined
@@ -5418,6 +5444,7 @@ declare class JavascriptParser extends Parser {
5418
5444
  | ImportExpression
5419
5445
  | ChainExpression
5420
5446
  | Super;
5447
+ membersOptionals: boolean[];
5421
5448
  };
5422
5449
  getFreeInfoFromVariable(varName: string): {
5423
5450
  name: string;
@@ -7481,11 +7508,11 @@ type NodeEstreeIndex =
7481
7508
  | PropertyDefinition
7482
7509
  | VariableDeclarator
7483
7510
  | Program
7484
- | Super
7485
7511
  | SwitchCase
7486
7512
  | CatchClause
7487
7513
  | Property
7488
7514
  | AssignmentProperty
7515
+ | Super
7489
7516
  | TemplateElement
7490
7517
  | SpreadElement
7491
7518
  | ObjectPattern