webpack 5.91.0 → 5.92.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 (174) hide show
  1. package/bin/webpack.js +1 -2
  2. package/lib/APIPlugin.js +6 -2
  3. package/lib/Cache.js +1 -1
  4. package/lib/Chunk.js +7 -4
  5. package/lib/ChunkGraph.js +20 -7
  6. package/lib/ChunkGroup.js +9 -3
  7. package/lib/CleanPlugin.js +1 -1
  8. package/lib/Compilation.js +33 -27
  9. package/lib/Compiler.js +28 -8
  10. package/lib/ConcatenationScope.js +3 -3
  11. package/lib/ContextModule.js +95 -43
  12. package/lib/DefinePlugin.js +14 -4
  13. package/lib/Dependency.js +8 -8
  14. package/lib/DependencyTemplate.js +10 -5
  15. package/lib/DllReferencePlugin.js +1 -1
  16. package/lib/EvalDevToolModulePlugin.js +11 -0
  17. package/lib/ExportsInfo.js +22 -4
  18. package/lib/ExternalModule.js +49 -18
  19. package/lib/FileSystemInfo.js +68 -41
  20. package/lib/FlagDependencyExportsPlugin.js +21 -7
  21. package/lib/Generator.js +2 -3
  22. package/lib/HotModuleReplacementPlugin.js +108 -45
  23. package/lib/IgnorePlugin.js +4 -1
  24. package/lib/LibManifestPlugin.js +2 -2
  25. package/lib/Module.js +11 -12
  26. package/lib/ModuleFactory.js +3 -3
  27. package/lib/ModuleFilenameHelpers.js +29 -16
  28. package/lib/ModuleGraph.js +5 -5
  29. package/lib/MultiCompiler.js +36 -1
  30. package/lib/NormalModule.js +10 -12
  31. package/lib/NormalModuleFactory.js +17 -8
  32. package/lib/Parser.js +1 -1
  33. package/lib/PlatformPlugin.js +39 -0
  34. package/lib/ProgressPlugin.js +1 -1
  35. package/lib/RecordIdsPlugin.js +4 -4
  36. package/lib/ResolverFactory.js +3 -3
  37. package/lib/RuntimeTemplate.js +22 -18
  38. package/lib/Stats.js +1 -1
  39. package/lib/Template.js +5 -5
  40. package/lib/TemplatedPathPlugin.js +16 -1
  41. package/lib/asset/AssetGenerator.js +15 -0
  42. package/lib/buildChunkGraph.js +3 -3
  43. package/lib/cache/MemoryWithGcCachePlugin.js +1 -1
  44. package/lib/cache/PackFileCacheStrategy.js +2 -2
  45. package/lib/cache/ResolverCachePlugin.js +8 -8
  46. package/lib/cache/getLazyHashedEtag.js +1 -1
  47. package/lib/cli.js +5 -5
  48. package/lib/config/browserslistTargetHandler.js +7 -1
  49. package/lib/config/defaults.js +85 -34
  50. package/lib/config/target.js +18 -11
  51. package/lib/container/ContainerEntryModule.js +1 -1
  52. package/lib/css/CssExportsGenerator.js +43 -17
  53. package/lib/css/CssGenerator.js +22 -12
  54. package/lib/css/CssLoadingRuntimeModule.js +8 -5
  55. package/lib/css/CssModulesPlugin.js +197 -100
  56. package/lib/css/CssParser.js +24 -15
  57. package/lib/css/walkCssTokens.js +1 -1
  58. package/lib/debug/ProfilingPlugin.js +1 -1
  59. package/lib/dependencies/ContextElementDependency.js +2 -2
  60. package/lib/dependencies/CssExportDependency.js +2 -2
  61. package/lib/dependencies/CssLocalIdentifierDependency.js +9 -2
  62. package/lib/dependencies/CssUrlDependency.js +5 -4
  63. package/lib/dependencies/ExportsInfoDependency.js +1 -1
  64. package/lib/dependencies/ExternalModuleDependency.js +4 -2
  65. package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +2 -2
  66. package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +2 -2
  67. package/lib/dependencies/HarmonyImportDependency.js +2 -2
  68. package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +41 -18
  69. package/lib/dependencies/HarmonyImportSideEffectDependency.js +2 -2
  70. package/lib/dependencies/HarmonyImportSpecifierDependency.js +43 -32
  71. package/lib/dependencies/ImportDependency.js +2 -2
  72. package/lib/dependencies/ImportEagerDependency.js +2 -2
  73. package/lib/dependencies/ImportMetaPlugin.js +1 -1
  74. package/lib/dependencies/ImportParserPlugin.js +3 -1
  75. package/lib/dependencies/ImportWeakDependency.js +2 -2
  76. package/lib/dependencies/LoaderPlugin.js +2 -2
  77. package/lib/dependencies/ModuleDependency.js +2 -2
  78. package/lib/dependencies/PureExpressionDependency.js +63 -49
  79. package/lib/dependencies/WorkerDependency.js +1 -1
  80. package/lib/esm/ModuleChunkLoadingRuntimeModule.js +90 -2
  81. package/lib/hmr/LazyCompilationPlugin.js +2 -2
  82. package/lib/ids/ChunkModuleIdRangePlugin.js +1 -1
  83. package/lib/ids/DeterministicChunkIdsPlugin.js +1 -1
  84. package/lib/ids/DeterministicModuleIdsPlugin.js +1 -1
  85. package/lib/ids/IdHelpers.js +6 -6
  86. package/lib/ids/NamedChunkIdsPlugin.js +1 -1
  87. package/lib/ids/NamedModuleIdsPlugin.js +1 -1
  88. package/lib/ids/SyncModuleIdsPlugin.js +2 -2
  89. package/lib/index.js +11 -0
  90. package/lib/javascript/CommonJsChunkFormatPlugin.js +1 -1
  91. package/lib/javascript/JavascriptGenerator.js +0 -1
  92. package/lib/javascript/JavascriptModulesPlugin.js +174 -17
  93. package/lib/javascript/JavascriptParser.js +37 -16
  94. package/lib/library/AbstractLibraryPlugin.js +2 -2
  95. package/lib/library/AmdLibraryPlugin.js +2 -2
  96. package/lib/library/AssignLibraryPlugin.js +3 -3
  97. package/lib/library/ExportPropertyLibraryPlugin.js +2 -2
  98. package/lib/library/JsonpLibraryPlugin.js +2 -2
  99. package/lib/library/ModuleLibraryPlugin.js +2 -2
  100. package/lib/library/SystemLibraryPlugin.js +2 -2
  101. package/lib/library/UmdLibraryPlugin.js +33 -12
  102. package/lib/logging/createConsoleLogger.js +2 -2
  103. package/lib/node/CommonJsChunkLoadingPlugin.js +2 -1
  104. package/lib/node/NodeEnvironmentPlugin.js +1 -1
  105. package/lib/node/NodeTemplatePlugin.js +1 -1
  106. package/lib/node/ReadFileCompileWasmPlugin.js +1 -1
  107. package/lib/node/nodeConsole.js +1 -1
  108. package/lib/optimize/AggressiveMergingPlugin.js +1 -1
  109. package/lib/optimize/ConcatenatedModule.js +11 -76
  110. package/lib/optimize/InnerGraph.js +1 -1
  111. package/lib/optimize/LimitChunkCountPlugin.js +1 -2
  112. package/lib/optimize/ModuleConcatenationPlugin.js +1 -1
  113. package/lib/optimize/RealContentHashPlugin.js +3 -3
  114. package/lib/optimize/SideEffectsFlagPlugin.js +2 -2
  115. package/lib/optimize/SplitChunksPlugin.js +8 -8
  116. package/lib/performance/SizeLimitsPlugin.js +2 -2
  117. package/lib/rules/ObjectMatcherRulePlugin.js +11 -1
  118. package/lib/rules/RuleSetCompiler.js +9 -7
  119. package/lib/runtime/LoadScriptRuntimeModule.js +1 -1
  120. package/lib/runtime/StartupChunkDependenciesPlugin.js +1 -1
  121. package/lib/schemes/HttpUriPlugin.js +1 -1
  122. package/lib/serialization/BinaryMiddleware.js +4 -4
  123. package/lib/serialization/FileMiddleware.js +3 -3
  124. package/lib/serialization/NullPrototypeObjectSerializer.js +2 -2
  125. package/lib/serialization/ObjectMiddleware.js +6 -5
  126. package/lib/serialization/PlainObjectSerializer.js +2 -2
  127. package/lib/serialization/SerializerMiddleware.js +2 -2
  128. package/lib/serialization/SingleItemMiddleware.js +2 -2
  129. package/lib/serialization/types.js +1 -1
  130. package/lib/sharing/ConsumeSharedModule.js +1 -1
  131. package/lib/sharing/ProvideSharedPlugin.js +1 -1
  132. package/lib/sharing/resolveMatchedConfigs.js +1 -1
  133. package/lib/stats/DefaultStatsFactoryPlugin.js +20 -20
  134. package/lib/stats/DefaultStatsPrinterPlugin.js +1 -1
  135. package/lib/stats/StatsFactory.js +2 -2
  136. package/lib/stats/StatsPrinter.js +6 -6
  137. package/lib/util/ArrayQueue.js +14 -21
  138. package/lib/util/AsyncQueue.js +1 -1
  139. package/lib/util/Queue.js +8 -2
  140. package/lib/util/SortableSet.js +16 -4
  141. package/lib/util/TupleQueue.js +8 -2
  142. package/lib/util/WeakTupleMap.js +3 -3
  143. package/lib/util/binarySearchBounds.js +1 -1
  144. package/lib/util/cleverMerge.js +2 -2
  145. package/lib/util/comparators.js +4 -2
  146. package/lib/util/conventions.js +1 -1
  147. package/lib/util/createHash.js +3 -5
  148. package/lib/util/deprecation.js +3 -3
  149. package/lib/util/deterministicGrouping.js +2 -2
  150. package/lib/util/findGraphRoots.js +1 -1
  151. package/lib/util/fs.js +15 -15
  152. package/lib/util/identifier.js +5 -5
  153. package/lib/util/mergeScope.js +79 -0
  154. package/lib/util/runtime.js +2 -17
  155. package/lib/util/semver.js +3 -0
  156. package/lib/util/smartGrouping.js +3 -3
  157. package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +4 -2
  158. package/lib/wasm-async/AsyncWebAssemblyGenerator.js +1 -1
  159. package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +3 -3
  160. package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +1 -1
  161. package/lib/wasm-sync/WebAssemblyGenerator.js +17 -17
  162. package/lib/wasm-sync/WebAssemblyModulesPlugin.js +1 -1
  163. package/lib/wasm-sync/WebAssemblyUtils.js +2 -1
  164. package/lib/web/FetchCompileWasmPlugin.js +1 -1
  165. package/lib/web/JsonpChunkLoadingRuntimeModule.js +1 -1
  166. package/lib/webpack.js +12 -3
  167. package/package.json +20 -18
  168. package/schemas/WebpackOptions.check.js +1 -1
  169. package/schemas/WebpackOptions.json +30 -2
  170. package/schemas/plugins/css/CssAutoGeneratorOptions.check.js +1 -1
  171. package/schemas/plugins/css/CssGeneratorOptions.check.js +1 -1
  172. package/schemas/plugins/css/CssGlobalGeneratorOptions.check.js +1 -1
  173. package/schemas/plugins/css/CssModuleGeneratorOptions.check.js +1 -1
  174. package/types.d.ts +213 -81
package/types.d.ts CHANGED
@@ -430,9 +430,6 @@ declare interface AsyncWebAssemblyModulesPluginOptions {
430
430
  */
431
431
  mangleImports?: boolean;
432
432
  }
433
- declare interface Attributes {
434
- [index: string]: any;
435
- }
436
433
  declare class AutomaticPrefetchPlugin {
437
434
  constructor();
438
435
 
@@ -1210,8 +1207,8 @@ declare class ChunkGraph {
1210
1207
  chunkGroup: ChunkGroup
1211
1208
  ): void;
1212
1209
  disconnectChunkGroup(chunkGroup: ChunkGroup): void;
1213
- getModuleId(module: Module): string | number;
1214
- setModuleId(module: Module, id: string | number): void;
1210
+ getModuleId(module: Module): ModuleId;
1211
+ setModuleId(module: Module, id: ModuleId): void;
1215
1212
  getRuntimeId(runtime: string): string | number;
1216
1213
  setRuntimeId(runtime: string, id: string | number): void;
1217
1214
  hasModuleHashes(module: Module, runtime: RuntimeSpec): boolean;
@@ -1563,15 +1560,10 @@ declare interface CodeGenerationContext {
1563
1560
  */
1564
1561
  chunkGraph: ChunkGraph;
1565
1562
 
1566
- /**
1567
- * the runtime code should be generated for
1568
- */
1569
- runtime: RuntimeSpec;
1570
-
1571
1563
  /**
1572
1564
  * the runtimes code should be generated for
1573
1565
  */
1574
- runtimes?: RuntimeSpec[];
1566
+ runtime: RuntimeSpec;
1575
1567
 
1576
1568
  /**
1577
1569
  * when in concatenated module, information about other concatenated modules
@@ -1814,7 +1806,7 @@ declare class Compilation {
1814
1806
  chunkHash: SyncHook<[Chunk, Hash, ChunkHashContext]>;
1815
1807
  moduleAsset: SyncHook<[Module, string]>;
1816
1808
  chunkAsset: SyncHook<[Chunk, string]>;
1817
- assetPath: SyncWaterfallHook<[string, object, AssetInfo]>;
1809
+ assetPath: SyncWaterfallHook<[string, object, undefined | AssetInfo]>;
1818
1810
  needAdditionalPass: SyncBailHook<[], boolean>;
1819
1811
  childCompiler: SyncHook<[Compiler, string, number]>;
1820
1812
  log: SyncBailHook<[string, LogEntry], true>;
@@ -2308,6 +2300,7 @@ declare class Compiler {
2308
2300
  fsStartTime?: number;
2309
2301
  resolverFactory: ResolverFactory;
2310
2302
  infrastructureLogger?: (arg0: string, arg1: LogTypeEnum, arg2: any[]) => void;
2303
+ platform: Readonly<PlatformTargetProperties>;
2311
2304
  options: WebpackOptionsNormalized;
2312
2305
  context: string;
2313
2306
  requestShortener: RequestShortener;
@@ -2905,7 +2898,7 @@ declare interface ContextModuleOptions {
2905
2898
  */
2906
2899
  referencedExports?: null | string[][];
2907
2900
  layer?: string;
2908
- attributes?: Attributes;
2901
+ attributes?: ImportAttributes;
2909
2902
  resource: string | false | string[];
2910
2903
  resourceQuery?: string;
2911
2904
  resourceFragment?: string;
@@ -2948,6 +2941,11 @@ type CreateWriteStreamFSImplementation = FSImplementation & {
2948
2941
  * Generator options for css/auto modules.
2949
2942
  */
2950
2943
  declare interface CssAutoGeneratorOptions {
2944
+ /**
2945
+ * Configure the generated JS modules that use the ES modules syntax.
2946
+ */
2947
+ esModule?: boolean;
2948
+
2951
2949
  /**
2952
2950
  * Specifies the convention of exported names.
2953
2951
  */
@@ -2985,15 +2983,9 @@ declare interface CssAutoParserOptions {
2985
2983
  */
2986
2984
  declare interface CssGeneratorOptions {
2987
2985
  /**
2988
- * Specifies the convention of exported names.
2986
+ * Configure the generated JS modules that use the ES modules syntax.
2989
2987
  */
2990
- exportsConvention?:
2991
- | "as-is"
2992
- | "camel-case"
2993
- | "camel-case-only"
2994
- | "dashes"
2995
- | "dashes-only"
2996
- | ((name: string) => string);
2988
+ esModule?: boolean;
2997
2989
 
2998
2990
  /**
2999
2991
  * Avoid generating and loading a stylesheet and only embed exports from css into output javascript files.
@@ -3005,6 +2997,11 @@ declare interface CssGeneratorOptions {
3005
2997
  * Generator options for css/global modules.
3006
2998
  */
3007
2999
  declare interface CssGlobalGeneratorOptions {
3000
+ /**
3001
+ * Configure the generated JS modules that use the ES modules syntax.
3002
+ */
3003
+ esModule?: boolean;
3004
+
3008
3005
  /**
3009
3006
  * Specifies the convention of exported names.
3010
3007
  */
@@ -3046,6 +3043,11 @@ declare interface CssImportDependencyMeta {
3046
3043
  * Generator options for css/module modules.
3047
3044
  */
3048
3045
  declare interface CssModuleGeneratorOptions {
3046
+ /**
3047
+ * Configure the generated JS modules that use the ES modules syntax.
3048
+ */
3049
+ esModule?: boolean;
3050
+
3049
3051
  /**
3050
3052
  * Specifies the convention of exported names.
3051
3053
  */
@@ -3261,15 +3263,10 @@ declare interface DependencyTemplateContext {
3261
3263
  */
3262
3264
  module: Module;
3263
3265
 
3264
- /**
3265
- * current runtime, for which code is generated
3266
- */
3267
- runtime: RuntimeSpec;
3268
-
3269
3266
  /**
3270
3267
  * current runtimes, for which code is generated
3271
3268
  */
3272
- runtimes?: RuntimeSpec[];
3269
+ runtime: RuntimeSpec;
3273
3270
 
3274
3271
  /**
3275
3272
  * mutable array of init fragments for the current module
@@ -3301,6 +3298,17 @@ declare abstract class DependencyTemplates {
3301
3298
  getHash(): string;
3302
3299
  clone(): DependencyTemplates;
3303
3300
  }
3301
+
3302
+ /**
3303
+ * Helper function for joining two ranges into a single range. This is useful
3304
+ * when working with AST nodes, as it allows you to combine the ranges of child nodes
3305
+ * to create the range of the _parent node_.
3306
+ */
3307
+ declare interface DestructuringAssignmentProperty {
3308
+ id: string;
3309
+ range?: [number, number];
3310
+ shorthand: string | boolean;
3311
+ }
3304
3312
  declare class DeterministicChunkIdsPlugin {
3305
3313
  constructor(options?: DeterministicChunkIdsPluginOptions);
3306
3314
  options: DeterministicChunkIdsPluginOptions;
@@ -3361,6 +3369,7 @@ declare interface DeterministicModuleIdsPluginOptions {
3361
3369
  */
3362
3370
  failOnConflict?: boolean;
3363
3371
  }
3372
+ type DevtoolModuleFilenameTemplate = string | Function;
3364
3373
  declare interface Dirent {
3365
3374
  isFile: () => boolean;
3366
3375
  isDirectory: () => boolean;
@@ -3917,6 +3926,11 @@ declare interface Environment {
3917
3926
  */
3918
3927
  destructuring?: boolean;
3919
3928
 
3929
+ /**
3930
+ * The environment supports 'document'.
3931
+ */
3932
+ document?: boolean;
3933
+
3920
3934
  /**
3921
3935
  * The environment supports an async import() function to import EcmaScript modules.
3922
3936
  */
@@ -3942,6 +3956,11 @@ declare interface Environment {
3942
3956
  */
3943
3957
  module?: boolean;
3944
3958
 
3959
+ /**
3960
+ * The environment supports `node:` prefix for Node.js core modules.
3961
+ */
3962
+ nodePrefixForCoreModules?: boolean;
3963
+
3945
3964
  /**
3946
3965
  * The environment supports optional chaining ('obj?.a' or 'obj?.()').
3947
3966
  */
@@ -3967,16 +3986,32 @@ declare interface Etag {
3967
3986
  toString: () => string;
3968
3987
  }
3969
3988
  declare class EvalDevToolModulePlugin {
3970
- constructor(options?: any);
3971
- namespace: any;
3972
- sourceUrlComment: any;
3973
- moduleFilenameTemplate: any;
3989
+ constructor(options?: EvalDevToolModulePluginOptions);
3990
+ namespace: string;
3991
+ sourceUrlComment: string;
3992
+ moduleFilenameTemplate: DevtoolModuleFilenameTemplate;
3974
3993
 
3975
3994
  /**
3976
3995
  * Apply the plugin
3977
3996
  */
3978
3997
  apply(compiler: Compiler): void;
3979
3998
  }
3999
+ declare interface EvalDevToolModulePluginOptions {
4000
+ /**
4001
+ * namespace
4002
+ */
4003
+ namespace?: string;
4004
+
4005
+ /**
4006
+ * source url comment
4007
+ */
4008
+ sourceUrlComment?: string;
4009
+
4010
+ /**
4011
+ * module filename template
4012
+ */
4013
+ moduleFilenameTemplate?: string | Function;
4014
+ }
3980
4015
  declare class EvalSourceMapDevToolPlugin {
3981
4016
  constructor(inputOptions: string | SourceMapDevToolPluginOptions);
3982
4017
  sourceMapComment: string;
@@ -4257,7 +4292,7 @@ declare abstract class ExportsInfo {
4257
4292
  get exports(): Iterable<ExportInfo>;
4258
4293
  get orderedExports(): Iterable<ExportInfo>;
4259
4294
  get otherExportsInfo(): ExportInfo;
4260
- setRedirectNamedTo(exportsInfo?: any): boolean;
4295
+ setRedirectNamedTo(exportsInfo?: ExportsInfo): boolean;
4261
4296
  setHasProvideInfo(): void;
4262
4297
  setHasUseInfo(): void;
4263
4298
  getOwnExportInfo(name: string): ExportInfo;
@@ -4477,7 +4512,7 @@ declare interface ExternalItemObjectUnknown {
4477
4512
  type ExternalItemValue = string | boolean | string[] | { [index: string]: any };
4478
4513
  declare class ExternalModule extends Module {
4479
4514
  constructor(
4480
- request: string | string[] | Record<string, string | string[]>,
4515
+ request: string | string[] | RequestRecord,
4481
4516
  type: string,
4482
4517
  userRequest: string,
4483
4518
  dependencyMeta?: ImportDependencyMeta | CssImportDependencyMeta
@@ -4836,9 +4871,9 @@ declare abstract class FileSystemInfo {
4836
4871
  ): void;
4837
4872
  createSnapshot(
4838
4873
  startTime: undefined | null | number,
4839
- files: Iterable<string>,
4840
- directories: Iterable<string>,
4841
- missing: Iterable<string>,
4874
+ files: null | Iterable<string>,
4875
+ directories: null | Iterable<string>,
4876
+ missing: null | Iterable<string>,
4842
4877
  options: undefined | null | SnapshotOptionsFileSystemInfo,
4843
4878
  callback: (arg0?: null | WebpackError, arg1?: null | Snapshot) => void
4844
4879
  ): void;
@@ -4886,11 +4921,6 @@ declare interface GenerateContext {
4886
4921
  */
4887
4922
  runtime: RuntimeSpec;
4888
4923
 
4889
- /**
4890
- * the runtimes
4891
- */
4892
- runtimes?: RuntimeSpec[];
4893
-
4894
4924
  /**
4895
4925
  * when in concatenated module, information about other concatenated modules
4896
4926
  */
@@ -5069,7 +5099,11 @@ declare interface HandleModuleCreationOptions {
5069
5099
  checkCycle?: boolean;
5070
5100
  }
5071
5101
  declare class HarmonyImportDependency extends ModuleDependency {
5072
- constructor(request: string, sourceOrder: number, attributes?: Attributes);
5102
+ constructor(
5103
+ request: string,
5104
+ sourceOrder: number,
5105
+ attributes?: ImportAttributes
5106
+ );
5073
5107
  sourceOrder: number;
5074
5108
  getImportVar(moduleGraph: ModuleGraph): string;
5075
5109
  getImportStatement(
@@ -5148,8 +5182,8 @@ declare interface HashedModuleIdsPluginOptions {
5148
5182
  }
5149
5183
  declare abstract class HelperRuntimeModule extends RuntimeModule {}
5150
5184
  declare class HotModuleReplacementPlugin {
5151
- constructor(options?: any);
5152
- options: any;
5185
+ constructor(options?: object);
5186
+ options: object;
5153
5187
 
5154
5188
  /**
5155
5189
  * Apply the plugin
@@ -5302,8 +5336,9 @@ type IgnorePluginOptions =
5302
5336
  */
5303
5337
  checkResource: (resource: string, context: string) => boolean;
5304
5338
  };
5339
+ type ImportAttributes = Record<string, string> & {};
5305
5340
  declare interface ImportDependencyMeta {
5306
- attributes?: Attributes;
5341
+ attributes?: ImportAttributes;
5307
5342
  }
5308
5343
  declare interface ImportModuleOptions {
5309
5344
  /**
@@ -5368,7 +5403,14 @@ declare interface InfrastructureLogging {
5368
5403
  */
5369
5404
  stream?: NodeJS.WritableStream;
5370
5405
  }
5371
- declare abstract class InitFragment<GenerateContext> {
5406
+ declare class InitFragment<GenerateContext> {
5407
+ constructor(
5408
+ content: undefined | string | Source,
5409
+ stage: number,
5410
+ position: number,
5411
+ key?: string,
5412
+ endContent?: string | Source
5413
+ );
5372
5414
  content?: string | Source;
5373
5415
  stage: number;
5374
5416
  position: number;
@@ -5379,6 +5421,18 @@ declare abstract class InitFragment<GenerateContext> {
5379
5421
  serialize(context: ObjectSerializerContext): void;
5380
5422
  deserialize(context: ObjectDeserializerContext): void;
5381
5423
  merge: any;
5424
+ static addToSource<Context, T>(
5425
+ source: Source,
5426
+ initFragments: InitFragment<T>[],
5427
+ context: Context
5428
+ ): Source;
5429
+ static STAGE_CONSTANTS: number;
5430
+ static STAGE_ASYNC_BOUNDARY: number;
5431
+ static STAGE_HARMONY_EXPORTS: number;
5432
+ static STAGE_HARMONY_IMPORTS: number;
5433
+ static STAGE_PROVIDES: number;
5434
+ static STAGE_ASYNC_DEPENDENCIES: number;
5435
+ static STAGE_ASYNC_HARMONY_IMPORTS: number;
5382
5436
  }
5383
5437
  declare interface InputFileSystem {
5384
5438
  readFile: ReadFileFs;
@@ -5494,6 +5548,18 @@ declare class JavascriptModulesPlugin {
5494
5548
  renderContext: RenderBootstrapContext,
5495
5549
  hooks: CompilationHooksJavascriptModulesPlugin
5496
5550
  ): string;
5551
+ renameInlineModule(
5552
+ allModules: Module[],
5553
+ renderContext: MainRenderContext,
5554
+ inlinedModules: Set<Module>,
5555
+ chunkRenderContext: ChunkRenderContext,
5556
+ hooks: CompilationHooksJavascriptModulesPlugin
5557
+ ): Map<Module, Source>;
5558
+ findNewName(
5559
+ oldName: string,
5560
+ usedName: Set<string>,
5561
+ extraInfo: string
5562
+ ): string;
5497
5563
  static getCompilationHooks(
5498
5564
  compilation: Compilation
5499
5565
  ): CompilationHooksJavascriptModulesPlugin;
@@ -5905,12 +5971,15 @@ declare class JavascriptParser extends Parser {
5905
5971
  | ExportNamedDeclaration
5906
5972
  | ExportDefaultDeclaration
5907
5973
  | ExportAllDeclaration;
5908
- destructuringAssignmentProperties?: WeakMap<Expression, Set<string>>;
5974
+ destructuringAssignmentProperties?: WeakMap<
5975
+ Expression,
5976
+ Set<DestructuringAssignmentProperty>
5977
+ >;
5909
5978
  currentTagData: any;
5910
5979
  magicCommentContext: Context;
5911
5980
  destructuringAssignmentPropertiesFor(
5912
5981
  node: Expression
5913
- ): undefined | Set<string>;
5982
+ ): undefined | Set<DestructuringAssignmentProperty>;
5914
5983
  getRenameIdentifier(
5915
5984
  expr: Expression
5916
5985
  ): undefined | string | VariableInfoInterface;
@@ -7259,7 +7328,7 @@ declare interface LibIdentOptions {
7259
7328
  /**
7260
7329
  * object for caching
7261
7330
  */
7262
- associatedObjectForCache?: Object;
7331
+ associatedObjectForCache?: object;
7263
7332
  }
7264
7333
  declare class LibManifestPlugin {
7265
7334
  constructor(options: LibManifestPluginOptions);
@@ -7949,7 +8018,7 @@ declare class Module extends DependenciesBlock {
7949
8018
  buildInfo?: BuildInfo;
7950
8019
  presentationalDependencies?: Dependency[];
7951
8020
  codeGenerationDependencies?: Dependency[];
7952
- id: string | number;
8021
+ id: ModuleId;
7953
8022
  get hash(): string;
7954
8023
  get renderedHash(): string;
7955
8024
  profile?: ModuleProfile;
@@ -8086,7 +8155,7 @@ declare class ModuleDependency extends Dependency {
8086
8155
  request: string;
8087
8156
  userRequest: string;
8088
8157
  range: any;
8089
- assertions?: Attributes;
8158
+ assertions?: ImportAttributes;
8090
8159
  static Template: typeof DependencyTemplate;
8091
8160
  static NO_EXPORTS_REFERENCED: string[][];
8092
8161
  static EXPORTS_OBJECT_REFERENCED: string[][];
@@ -8283,8 +8352,8 @@ declare class ModuleGraph {
8283
8352
  setDepthIfLower(module: Module, depth: number): boolean;
8284
8353
  isAsync(module: Module): boolean;
8285
8354
  setAsync(module: Module): void;
8286
- getMeta(thing?: any): Object;
8287
- getMetaIfExisting(thing?: any): undefined | Object;
8355
+ getMeta(thing?: any): object;
8356
+ getMetaIfExisting(thing?: any): undefined | object;
8288
8357
  freeze(cacheStage?: string): void;
8289
8358
  unfreeze(): void;
8290
8359
  cached<T extends any[], V>(
@@ -8352,6 +8421,7 @@ declare class ModuleGraphConnection {
8352
8421
  static TRANSITIVE_ONLY: typeof TRANSITIVE_ONLY;
8353
8422
  static CIRCULAR_CONNECTION: typeof CIRCULAR_CONNECTION;
8354
8423
  }
8424
+ type ModuleId = string | number;
8355
8425
  type ModuleInfo = ConcatenatedModuleInfo | ExternalModuleInfo;
8356
8426
 
8357
8427
  /**
@@ -8816,14 +8886,14 @@ declare class NormalModule extends Module {
8816
8886
  name: string,
8817
8887
  content: string | Buffer,
8818
8888
  sourceMap?: string | SourceMap,
8819
- associatedObjectForCache?: Object
8889
+ associatedObjectForCache?: object
8820
8890
  ): Source;
8821
8891
  getCurrentLoader(loaderContext?: any, index?: number): null | LoaderItem;
8822
8892
  createSource(
8823
8893
  context: string,
8824
8894
  content: string | Buffer,
8825
8895
  sourceMap?: string | SourceMapSource,
8826
- associatedObjectForCache?: Object
8896
+ associatedObjectForCache?: object
8827
8897
  ): Source;
8828
8898
  markModuleAsErrored(error: WebpackError): void;
8829
8899
  applyNoParseRule(rule: any, content: string): boolean;
@@ -8957,8 +9027,8 @@ declare abstract class NormalModuleFactory extends ModuleFactory {
8957
9027
  ruleSet: RuleSet;
8958
9028
  context: string;
8959
9029
  fs: InputFileSystem;
8960
- parserCache: Map<string, WeakMap<Object, Parser>>;
8961
- generatorCache: Map<string, WeakMap<Object, Generator>>;
9030
+ parserCache: Map<string, WeakMap<object, Parser>>;
9031
+ generatorCache: Map<string, WeakMap<object, Generator>>;
8962
9032
  cleanupForCache(): void;
8963
9033
  resolveResource(
8964
9034
  contextInfo: ModuleFactoryCreateDataContextInfo,
@@ -10349,6 +10419,46 @@ declare interface PitchLoaderDefinitionFunction<
10349
10419
  data: object
10350
10420
  ): string | void | Buffer | Promise<string | Buffer>;
10351
10421
  }
10422
+ declare class PlatformPlugin {
10423
+ constructor(platform: Partial<PlatformTargetProperties>);
10424
+ platform: Partial<PlatformTargetProperties>;
10425
+
10426
+ /**
10427
+ * Apply the plugin
10428
+ */
10429
+ apply(compiler: Compiler): void;
10430
+ }
10431
+ declare interface PlatformTargetProperties {
10432
+ /**
10433
+ * web platform, importing of http(s) and std: is available
10434
+ */
10435
+ web: null | boolean;
10436
+
10437
+ /**
10438
+ * browser platform, running in a normal web browser
10439
+ */
10440
+ browser: null | boolean;
10441
+
10442
+ /**
10443
+ * (Web)Worker platform, running in a web/shared/service worker
10444
+ */
10445
+ webworker: null | boolean;
10446
+
10447
+ /**
10448
+ * node platform, require of node built-in modules is available
10449
+ */
10450
+ node: null | boolean;
10451
+
10452
+ /**
10453
+ * nwjs platform, require of legacy nw.gui is available
10454
+ */
10455
+ nwjs: null | boolean;
10456
+
10457
+ /**
10458
+ * electron platform, require of some electron built-in modules is available
10459
+ */
10460
+ electron: null | boolean;
10461
+ }
10352
10462
  type Plugin =
10353
10463
  | undefined
10354
10464
  | null
@@ -10685,10 +10795,10 @@ declare interface ReadFileFs {
10685
10795
  | "ucs-2"
10686
10796
  | "latin1"
10687
10797
  | "binary"
10798
+ | ({ encoding: BufferEncoding; flag?: string } & Abortable)
10688
10799
  | "base64"
10689
10800
  | "base64url"
10690
- | "hex"
10691
- | ({ encoding: BufferEncoding; flag?: string } & Abortable),
10801
+ | "hex",
10692
10802
  callback: (arg0: null | NodeJS.ErrnoException, arg1?: string) => void
10693
10803
  ): void;
10694
10804
  (
@@ -10781,10 +10891,10 @@ declare interface ReadFileTypes {
10781
10891
  | "ucs-2"
10782
10892
  | "latin1"
10783
10893
  | "binary"
10784
- | ({ encoding: BufferEncoding; flag?: string } & Abortable)
10785
10894
  | "base64"
10786
10895
  | "base64url"
10787
- | "hex",
10896
+ | "hex"
10897
+ | ({ encoding: BufferEncoding; flag?: string } & Abortable),
10788
10898
  callback: (arg0: null | NodeJS.ErrnoException, arg1?: string) => void
10789
10899
  ): void;
10790
10900
  (
@@ -11008,8 +11118,8 @@ declare interface ReaddirTypes {
11008
11118
  (
11009
11119
  path: PathLikeTypes,
11010
11120
  options:
11011
- | { encoding: "buffer"; withFileTypes?: false; recursive?: boolean }
11012
- | "buffer",
11121
+ | "buffer"
11122
+ | { encoding: "buffer"; withFileTypes?: false; recursive?: boolean },
11013
11123
  callback: (arg0: null | NodeJS.ErrnoException, arg1?: Buffer[]) => void
11014
11124
  ): void;
11015
11125
  (
@@ -11336,6 +11446,9 @@ declare class ReplaceSource extends Source {
11336
11446
  name: string;
11337
11447
  }[];
11338
11448
  }
11449
+ declare interface RequestRecord {
11450
+ [index: string]: string | string[];
11451
+ }
11339
11452
  declare abstract class RequestShortener {
11340
11453
  contextify: (arg0: string) => string;
11341
11454
  shorten(request?: null | string): undefined | null | string;
@@ -11816,6 +11929,12 @@ declare interface ResolvedContextTimestampAndHash {
11816
11929
  timestampHash?: string;
11817
11930
  hash: string;
11818
11931
  }
11932
+ declare interface ResolvedOptions {
11933
+ /**
11934
+ * - platform target properties
11935
+ */
11936
+ platform: false | PlatformTargetProperties;
11937
+ }
11819
11938
  declare abstract class Resolver {
11820
11939
  fileSystem: FileSystem;
11821
11940
  options: ResolveOptionsResolverFactoryObject1;
@@ -11872,7 +11991,7 @@ declare abstract class Resolver {
11872
11991
  normalize(path: string): string;
11873
11992
  }
11874
11993
  declare interface ResolverCache {
11875
- direct: WeakMap<Object, ResolverWithOptions>;
11994
+ direct: WeakMap<object, ResolverWithOptions>;
11876
11995
  stringified: Map<string, ResolverWithOptions>;
11877
11996
  }
11878
11997
  declare abstract class ResolverFactory {
@@ -12268,6 +12387,11 @@ declare interface RuleSetRule {
12268
12387
  options?: string | { [index: string]: any };
12269
12388
  }
12270
12389
  | __TypeWebpackOptions;
12390
+
12391
+ /**
12392
+ * Match on import attributes of the dependency.
12393
+ */
12394
+ with?: { [index: string]: RuleSetConditionOrConditions };
12271
12395
  }
12272
12396
  type RuleSetUse =
12273
12397
  | string
@@ -12449,6 +12573,7 @@ declare abstract class RuntimeTemplate {
12449
12573
  supportsDynamicImport(): undefined | boolean;
12450
12574
  supportsEcmaScriptModuleSyntax(): undefined | boolean;
12451
12575
  supportTemplateLiteral(): undefined | boolean;
12576
+ supportNodePrefixForCoreModules(): undefined | boolean;
12452
12577
  returningFunction(returnValue: string, args?: string): string;
12453
12578
  basicFunction(args: string, body: string | string[]): string;
12454
12579
  concatenation(...args: (string | { expr: string })[]): string;
@@ -12833,10 +12958,6 @@ declare abstract class RuntimeTemplate {
12833
12958
  * the module
12834
12959
  */
12835
12960
  module: Module;
12836
- /**
12837
- * the public path
12838
- */
12839
- publicPath: string;
12840
12961
  /**
12841
12962
  * runtime
12842
12963
  */
@@ -12897,11 +13018,11 @@ declare abstract class Serializer {
12897
13018
  declare abstract class SerializerMiddleware<DeserializedType, SerializedType> {
12898
13019
  serialize(
12899
13020
  data: DeserializedType,
12900
- context: Object
13021
+ context: object
12901
13022
  ): SerializedType | Promise<SerializedType>;
12902
13023
  deserialize(
12903
13024
  data: SerializedType,
12904
- context: Object
13025
+ context: object
12905
13026
  ): DeserializedType | Promise<DeserializedType>;
12906
13027
  }
12907
13028
  type ServerOptionsHttps<
@@ -13020,7 +13141,7 @@ declare abstract class Snapshot {
13020
13141
  managedMissing?: Set<string>;
13021
13142
  children?: Set<Snapshot>;
13022
13143
  hasStartTime(): boolean;
13023
- setStartTime(value?: any): void;
13144
+ setStartTime(value: number): void;
13024
13145
  setMergedStartTime(value?: any, snapshot?: any): void;
13025
13146
  hasFileTimestamps(): boolean;
13026
13147
  setFileTimestamps(value?: any): void;
@@ -13524,7 +13645,7 @@ type StatsCompilation = KnownStatsCompilation & Record<string, any>;
13524
13645
  type StatsError = KnownStatsError & Record<string, any>;
13525
13646
  declare abstract class StatsFactory {
13526
13647
  hooks: Readonly<{
13527
- extract: HookMap<SyncBailHook<[Object, any, StatsFactoryContext], any>>;
13648
+ extract: HookMap<SyncBailHook<[object, any, StatsFactoryContext], any>>;
13528
13649
  filter: HookMap<
13529
13650
  SyncBailHook<[any, StatsFactoryContext, number, number], any>
13530
13651
  >;
@@ -14029,7 +14150,7 @@ declare abstract class StatsPrinter {
14029
14150
  print: HookMap<SyncBailHook<[{}, StatsPrinterContext], string>>;
14030
14151
  result: HookMap<SyncWaterfallHook<[string, StatsPrinterContext]>>;
14031
14152
  }>;
14032
- print(type: string, object: Object, baseContext?: Object): string;
14153
+ print(type: string, object: object, baseContext?: object): string;
14033
14154
  }
14034
14155
  type StatsPrinterContext = KnownStatsPrinterContext & Record<string, any>;
14035
14156
  type StatsProfile = KnownStatsProfile & Record<string, any>;
@@ -14898,7 +15019,7 @@ declare namespace exports {
14898
15019
  /**
14899
15020
  * the hash function to use
14900
15021
  */
14901
- hashFunction: string | typeof Hash;
15022
+ hashFunction?: string | typeof Hash;
14902
15023
  }
14903
15024
  ) => string;
14904
15025
  export let replaceDuplicates: <T>(
@@ -15005,8 +15126,9 @@ declare namespace exports {
15005
15126
  config: Configuration
15006
15127
  ) => WebpackOptionsNormalized;
15007
15128
  export const applyWebpackOptionsDefaults: (
15008
- options: WebpackOptionsNormalized
15009
- ) => void;
15129
+ options: WebpackOptionsNormalized,
15130
+ compilerIndex?: number
15131
+ ) => ResolvedOptions;
15010
15132
  }
15011
15133
  export namespace dependencies {
15012
15134
  export {
@@ -15152,7 +15274,7 @@ declare namespace exports {
15152
15274
  export { ProfilingPlugin };
15153
15275
  }
15154
15276
  export namespace util {
15155
- export const createHash: (algorithm?: string | typeof Hash) => Hash;
15277
+ export const createHash: (algorithm: string | typeof Hash) => Hash;
15156
15278
  export namespace comparators {
15157
15279
  export let compareChunksById: (a: Chunk, b: Chunk) => 0 | 1 | -1;
15158
15280
  export let compareModulesByIdentifier: (
@@ -15228,10 +15350,6 @@ declare namespace exports {
15228
15350
  export let runtimeEqual: (a: RuntimeSpec, b: RuntimeSpec) => boolean;
15229
15351
  export let compareRuntime: (a: RuntimeSpec, b: RuntimeSpec) => 0 | 1 | -1;
15230
15352
  export let mergeRuntime: (a: RuntimeSpec, b: RuntimeSpec) => RuntimeSpec;
15231
- export let deepMergeRuntime: (
15232
- runtimes: undefined | RuntimeSpec[],
15233
- runtime: RuntimeSpec
15234
- ) => RuntimeSpec;
15235
15353
  export let mergeRuntimeCondition: (
15236
15354
  a: RuntimeCondition,
15237
15355
  b: RuntimeCondition,
@@ -15286,6 +15404,16 @@ declare namespace exports {
15286
15404
  export { MEASURE_START_OPERATION, MEASURE_END_OPERATION };
15287
15405
  }
15288
15406
  export const cleverMerge: <T, O>(first: T, second: O) => T | O | (T & O);
15407
+ export function compileBooleanMatcher(
15408
+ map: Record<string | number, boolean>
15409
+ ): boolean | ((arg0: string) => string);
15410
+ export namespace compileBooleanMatcher {
15411
+ export let fromLists: (
15412
+ positiveItems: string[],
15413
+ negativeItems: string[]
15414
+ ) => (arg0: string) => string;
15415
+ export let itemsToRegexp: (itemsArr: string[]) => string;
15416
+ }
15289
15417
  export { LazySet };
15290
15418
  }
15291
15419
  export namespace sources {
@@ -15343,6 +15471,7 @@ declare namespace exports {
15343
15471
  Generator,
15344
15472
  HotUpdateChunk,
15345
15473
  HotModuleReplacementPlugin,
15474
+ InitFragment,
15346
15475
  IgnorePlugin,
15347
15476
  JavascriptModulesPlugin,
15348
15477
  LibManifestPlugin,
@@ -15357,6 +15486,7 @@ declare namespace exports {
15357
15486
  NormalModuleReplacementPlugin,
15358
15487
  MultiCompiler,
15359
15488
  Parser,
15489
+ PlatformPlugin,
15360
15490
  PrefetchPlugin,
15361
15491
  ProgressPlugin,
15362
15492
  ProvidePlugin,
@@ -15422,6 +15552,8 @@ declare namespace exports {
15422
15552
  StatsModuleTraceDependency,
15423
15553
  StatsModuleTraceItem,
15424
15554
  StatsProfile,
15555
+ InputFileSystem,
15556
+ OutputFileSystem,
15425
15557
  LoaderModule,
15426
15558
  RawLoaderDefinition,
15427
15559
  LoaderDefinition,