webpack 5.90.0 → 5.90.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.

Potentially problematic release.


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

Files changed (38) hide show
  1. package/lib/APIPlugin.js +16 -12
  2. package/lib/Compilation.js +1 -1
  3. package/lib/ConditionalInitFragment.js +3 -3
  4. package/lib/DefinePlugin.js +47 -26
  5. package/lib/EvalSourceMapDevToolPlugin.js +1 -1
  6. package/lib/InitFragment.js +7 -7
  7. package/lib/NodeStuffPlugin.js +3 -3
  8. package/lib/Stats.js +4 -0
  9. package/lib/async-modules/AwaitDependenciesInitFragment.js +2 -2
  10. package/lib/buildChunkGraph.js +101 -15
  11. package/lib/config/browserslistTargetHandler.js +18 -16
  12. package/lib/config/defaults.js +1 -0
  13. package/lib/dependencies/AMDDefineDependency.js +4 -4
  14. package/lib/dependencies/AMDDefineDependencyParserPlugin.js +126 -34
  15. package/lib/dependencies/AMDPlugin.js +11 -4
  16. package/lib/dependencies/AMDRequireArrayDependency.js +13 -1
  17. package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +159 -43
  18. package/lib/dependencies/AMDRequireDependency.js +2 -2
  19. package/lib/dependencies/AMDRequireItemDependency.js +1 -1
  20. package/lib/dependencies/ExportsInfoDependency.js +6 -12
  21. package/lib/dependencies/ExternalModuleDependency.js +9 -0
  22. package/lib/dependencies/ExternalModuleInitFragment.js +10 -3
  23. package/lib/dependencies/HarmonyExportInitFragment.js +2 -2
  24. package/lib/dependencies/HarmonyImportSpecifierDependency.js +1 -1
  25. package/lib/dependencies/ImportParserPlugin.js +1 -0
  26. package/lib/dependencies/LocalModuleDependency.js +1 -1
  27. package/lib/dependencies/WorkerPlugin.js +3 -2
  28. package/lib/dependencies/getFunctionExpression.js +2 -2
  29. package/lib/hmr/HotModuleReplacement.runtime.js +1 -1
  30. package/lib/javascript/JavascriptParser.js +212 -74
  31. package/lib/optimize/MangleExportsPlugin.js +5 -1
  32. package/lib/runtime/AutoPublicPathRuntimeModule.js +1 -1
  33. package/lib/util/chainedImports.js +7 -6
  34. package/lib/util/comparators.js +59 -23
  35. package/lib/util/numberHash.js +53 -52
  36. package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +53 -28
  37. package/package.json +4 -59
  38. package/types.d.ts +101 -74
package/types.d.ts CHANGED
@@ -106,6 +106,7 @@ import {
106
106
  SyncWaterfallHook
107
107
  } from "tapable";
108
108
  import { SecureContextOptions, TlsOptions } from "tls";
109
+ import { Context } from "vm";
109
110
 
110
111
  declare class AbstractLibraryPlugin<T> {
111
112
  constructor(__0: {
@@ -1857,7 +1858,7 @@ declare class Compilation {
1857
1858
  compilationDependencies: { add: (item?: any) => LazySet<string> };
1858
1859
  getStats(): Stats;
1859
1860
  createStatsOptions(
1860
- optionsOrPreset: string | StatsOptions,
1861
+ optionsOrPreset?: string | StatsOptions,
1861
1862
  context?: CreateStatsOptionsContext
1862
1863
  ): NormalizedStatsOptions;
1863
1864
  createStatsFactory(options?: any): StatsFactory;
@@ -5237,14 +5238,14 @@ declare interface InfrastructureLogging {
5237
5238
  */
5238
5239
  stream?: NodeJS.WritableStream;
5239
5240
  }
5240
- declare abstract class InitFragment<Context> {
5241
+ declare abstract class InitFragment<GenerateContext> {
5241
5242
  content: string | Source;
5242
5243
  stage: number;
5243
5244
  position: number;
5244
5245
  key?: string;
5245
5246
  endContent?: string | Source;
5246
- getContent(context: Context): string | Source;
5247
- getEndContent(context: Context): undefined | string | Source;
5247
+ getContent(context: GenerateContext): string | Source;
5248
+ getEndContent(context: GenerateContext): undefined | string | Source;
5248
5249
  serialize(context: ObjectSerializerContext): void;
5249
5250
  deserialize(context: ObjectDeserializerContext): void;
5250
5251
  merge: any;
@@ -5680,63 +5681,9 @@ declare class JavascriptParser extends Parser {
5680
5681
  sourceType: "module" | "auto" | "script";
5681
5682
  scope: ScopeInfo;
5682
5683
  state: ParserState;
5683
- comments: any;
5684
- semicolons: any;
5685
- statementPath: (
5686
- | UnaryExpression
5687
- | ArrayExpression
5688
- | ArrowFunctionExpression
5689
- | AssignmentExpression
5690
- | AwaitExpression
5691
- | BinaryExpression
5692
- | SimpleCallExpression
5693
- | NewExpression
5694
- | ChainExpression
5695
- | ClassExpression
5696
- | ConditionalExpression
5697
- | FunctionExpression
5698
- | Identifier
5699
- | ImportExpression
5700
- | SimpleLiteral
5701
- | RegExpLiteral
5702
- | BigIntLiteral
5703
- | LogicalExpression
5704
- | MemberExpression
5705
- | MetaProperty
5706
- | ObjectExpression
5707
- | SequenceExpression
5708
- | TaggedTemplateExpression
5709
- | TemplateLiteral
5710
- | ThisExpression
5711
- | UpdateExpression
5712
- | YieldExpression
5713
- | FunctionDeclaration
5714
- | VariableDeclaration
5715
- | ClassDeclaration
5716
- | ExpressionStatement
5717
- | BlockStatement
5718
- | StaticBlock
5719
- | EmptyStatement
5720
- | DebuggerStatement
5721
- | WithStatement
5722
- | ReturnStatement
5723
- | LabeledStatement
5724
- | BreakStatement
5725
- | ContinueStatement
5726
- | IfStatement
5727
- | SwitchStatement
5728
- | ThrowStatement
5729
- | TryStatement
5730
- | WhileStatement
5731
- | DoWhileStatement
5732
- | ForStatement
5733
- | ForInStatement
5734
- | ForOfStatement
5735
- | ImportDeclaration
5736
- | ExportNamedDeclaration
5737
- | ExportDefaultDeclaration
5738
- | ExportAllDeclaration
5739
- )[];
5684
+ comments?: Comment[];
5685
+ semicolons?: Set<number>;
5686
+ statementPath: StatementPathItem[];
5740
5687
  prevStatement?:
5741
5688
  | UnaryExpression
5742
5689
  | ArrayExpression
@@ -5791,8 +5738,9 @@ declare class JavascriptParser extends Parser {
5791
5738
  | ExportNamedDeclaration
5792
5739
  | ExportDefaultDeclaration
5793
5740
  | ExportAllDeclaration;
5794
- destructuringAssignmentProperties: WeakMap<Expression, Set<string>>;
5741
+ destructuringAssignmentProperties?: WeakMap<Expression, Set<string>>;
5795
5742
  currentTagData: any;
5743
+ magicCommentContext: Context;
5796
5744
  destructuringAssignmentPropertiesFor(
5797
5745
  node: Expression
5798
5746
  ): undefined | Set<string>;
@@ -6031,7 +5979,7 @@ declare class JavascriptParser extends Parser {
6031
5979
  blockPreWalkExpressionStatement(statement: ExpressionStatement): void;
6032
5980
  preWalkAssignmentExpression(expression: AssignmentExpression): void;
6033
5981
  blockPreWalkImportDeclaration(statement?: any): void;
6034
- enterDeclaration(declaration?: any, onIdent?: any): void;
5982
+ enterDeclaration(declaration: Declaration, onIdent?: any): void;
6035
5983
  blockPreWalkExportNamedDeclaration(statement?: any): void;
6036
5984
  walkExportNamedDeclaration(statement: ExportNamedDeclaration): void;
6037
5985
  blockPreWalkExportDefaultDeclaration(statement?: any): void;
@@ -6113,16 +6061,20 @@ declare class JavascriptParser extends Parser {
6113
6061
  walkCallExpression(expression?: any): void;
6114
6062
  walkMemberExpression(expression: MemberExpression): void;
6115
6063
  walkMemberExpressionWithExpressionName(
6116
- expression?: any,
6117
- name?: any,
6118
- rootInfo?: any,
6119
- members?: any,
6064
+ expression: any,
6065
+ name: string,
6066
+ rootInfo: string | VariableInfo,
6067
+ members: string[],
6120
6068
  onUnhandled?: any
6121
6069
  ): void;
6122
6070
  walkThisExpression(expression: ThisExpression): void;
6123
6071
  walkIdentifier(expression: Identifier): void;
6124
6072
  walkMetaProperty(metaProperty: MetaProperty): void;
6125
- callHooksForExpression(hookMap: any, expr: any, ...args: any[]): any;
6073
+ callHooksForExpression<T, R>(
6074
+ hookMap: HookMap<SyncBailHook<T, R>>,
6075
+ expr: any,
6076
+ ...args: AsArray<T>
6077
+ ): undefined | R;
6126
6078
  callHooksForExpressionWithFallback<T, R>(
6127
6079
  hookMap: HookMap<SyncBailHook<T, R>>,
6128
6080
  expr: MemberExpression,
@@ -6195,8 +6147,29 @@ declare class JavascriptParser extends Parser {
6195
6147
  | Directive
6196
6148
  )[]
6197
6149
  ): void;
6198
- enterPatterns(patterns?: any, onIdent?: any): void;
6199
- enterPattern(pattern?: any, onIdent?: any): void;
6150
+ enterPatterns(
6151
+ patterns: (
6152
+ | Identifier
6153
+ | MemberExpression
6154
+ | ObjectPattern
6155
+ | ArrayPattern
6156
+ | RestElement
6157
+ | AssignmentPattern
6158
+ | Property
6159
+ )[],
6160
+ onIdent?: any
6161
+ ): void;
6162
+ enterPattern(
6163
+ pattern:
6164
+ | Identifier
6165
+ | MemberExpression
6166
+ | ObjectPattern
6167
+ | ArrayPattern
6168
+ | RestElement
6169
+ | AssignmentPattern
6170
+ | Property,
6171
+ onIdent?: any
6172
+ ): void;
6200
6173
  enterIdentifier(pattern: Identifier, onIdent?: any): void;
6201
6174
  enterObjectPattern(pattern: ObjectPattern, onIdent?: any): void;
6202
6175
  enterArrayPattern(pattern: ArrayPattern, onIdent?: any): void;
@@ -6243,12 +6216,12 @@ declare class JavascriptParser extends Parser {
6243
6216
  | PrivateIdentifier,
6244
6217
  commentsStartPos: number
6245
6218
  ): boolean;
6246
- getComments(range: [number, number]): any[];
6219
+ getComments(range: [number, number]): Comment[];
6247
6220
  isAsiPosition(pos: number): boolean;
6248
6221
  unsetAsiPosition(pos: number): void;
6249
6222
  isStatementLevelExpression(expr: Expression): boolean;
6250
- getTagData(name?: any, tag?: any): any;
6251
- tagVariable(name?: any, tag?: any, data?: any): void;
6223
+ getTagData(name: string, tag?: any): any;
6224
+ tagVariable(name: string, tag?: any, data?: any): void;
6252
6225
  defineVariable(name: string): void;
6253
6226
  undefineVariable(name: string): void;
6254
6227
  isVariableDefined(name: string): boolean;
@@ -12323,6 +12296,60 @@ type Statement =
12323
12296
  | ForStatement
12324
12297
  | ForInStatement
12325
12298
  | ForOfStatement;
12299
+ type StatementPathItem =
12300
+ | UnaryExpression
12301
+ | ArrayExpression
12302
+ | ArrowFunctionExpression
12303
+ | AssignmentExpression
12304
+ | AwaitExpression
12305
+ | BinaryExpression
12306
+ | SimpleCallExpression
12307
+ | NewExpression
12308
+ | ChainExpression
12309
+ | ClassExpression
12310
+ | ConditionalExpression
12311
+ | FunctionExpression
12312
+ | Identifier
12313
+ | ImportExpression
12314
+ | SimpleLiteral
12315
+ | RegExpLiteral
12316
+ | BigIntLiteral
12317
+ | LogicalExpression
12318
+ | MemberExpression
12319
+ | MetaProperty
12320
+ | ObjectExpression
12321
+ | SequenceExpression
12322
+ | TaggedTemplateExpression
12323
+ | TemplateLiteral
12324
+ | ThisExpression
12325
+ | UpdateExpression
12326
+ | YieldExpression
12327
+ | FunctionDeclaration
12328
+ | VariableDeclaration
12329
+ | ClassDeclaration
12330
+ | ExpressionStatement
12331
+ | BlockStatement
12332
+ | StaticBlock
12333
+ | EmptyStatement
12334
+ | DebuggerStatement
12335
+ | WithStatement
12336
+ | ReturnStatement
12337
+ | LabeledStatement
12338
+ | BreakStatement
12339
+ | ContinueStatement
12340
+ | IfStatement
12341
+ | SwitchStatement
12342
+ | ThrowStatement
12343
+ | TryStatement
12344
+ | WhileStatement
12345
+ | DoWhileStatement
12346
+ | ForStatement
12347
+ | ForInStatement
12348
+ | ForOfStatement
12349
+ | ImportDeclaration
12350
+ | ExportNamedDeclaration
12351
+ | ExportDefaultDeclaration
12352
+ | ExportAllDeclaration;
12326
12353
  declare class Stats {
12327
12354
  constructor(compilation: Compilation);
12328
12355
  compilation: Compilation;
@@ -12332,7 +12359,7 @@ declare class Stats {
12332
12359
  hasWarnings(): boolean;
12333
12360
  hasErrors(): boolean;
12334
12361
  toJson(options?: string | StatsOptions): StatsCompilation;
12335
- toString(options?: any): string;
12362
+ toString(options?: string | StatsOptions): string;
12336
12363
  }
12337
12364
  type StatsAsset = KnownStatsAsset & Record<string, any>;
12338
12365
  type StatsChunk = KnownStatsChunk & Record<string, any>;