webpack 5.89.0 → 5.90.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 (167) hide show
  1. package/README.md +3 -0
  2. package/bin/webpack.js +1 -3
  3. package/hot/log.js +0 -2
  4. package/lib/APIPlugin.js +17 -13
  5. package/lib/ChunkGraph.js +1 -1
  6. package/lib/CleanPlugin.js +12 -12
  7. package/lib/Compilation.js +26 -17
  8. package/lib/Compiler.js +13 -0
  9. package/lib/ConcatenationScope.js +2 -2
  10. package/lib/ConditionalInitFragment.js +3 -3
  11. package/lib/ContextModule.js +4 -4
  12. package/lib/ContextModuleFactory.js +1 -1
  13. package/lib/DefinePlugin.js +47 -26
  14. package/lib/DependencyTemplate.js +3 -1
  15. package/lib/EnvironmentNotSupportAsyncWarning.js +52 -0
  16. package/lib/EvalDevToolModulePlugin.js +1 -1
  17. package/lib/EvalSourceMapDevToolPlugin.js +2 -2
  18. package/lib/ExportsInfoApiPlugin.js +2 -2
  19. package/lib/ExternalModule.js +47 -12
  20. package/lib/ExternalModuleFactoryPlugin.js +1 -1
  21. package/lib/FileSystemInfo.js +20 -3
  22. package/lib/FlagDependencyExportsPlugin.js +1 -1
  23. package/lib/Generator.js +1 -0
  24. package/lib/HotModuleReplacementPlugin.js +3 -3
  25. package/lib/InitFragment.js +7 -7
  26. package/lib/LibManifestPlugin.js +4 -1
  27. package/lib/Module.js +2 -1
  28. package/lib/ModuleFilenameHelpers.js +1 -1
  29. package/lib/ModuleInfoHeaderPlugin.js +1 -1
  30. package/lib/MultiStats.js +2 -2
  31. package/lib/NodeStuffPlugin.js +48 -0
  32. package/lib/NormalModule.js +13 -11
  33. package/lib/NormalModuleFactory.js +7 -7
  34. package/lib/RuntimeTemplate.js +15 -11
  35. package/lib/SourceMapDevToolPlugin.js +2 -2
  36. package/lib/Stats.js +4 -0
  37. package/lib/WebpackOptionsApply.js +4 -3
  38. package/lib/asset/AssetModulesPlugin.js +2 -3
  39. package/lib/async-modules/AwaitDependenciesInitFragment.js +2 -2
  40. package/lib/buildChunkGraph.js +53 -0
  41. package/lib/cache/AddManagedPathsPlugin.js +6 -1
  42. package/lib/cache/IdleFileCachePlugin.js +12 -5
  43. package/lib/cache/PackFileCacheStrategy.js +3 -3
  44. package/lib/cache/ResolverCachePlugin.js +2 -2
  45. package/lib/config/browserslistTargetHandler.js +35 -14
  46. package/lib/config/defaults.js +88 -52
  47. package/lib/config/normalization.js +17 -18
  48. package/lib/config/target.js +5 -0
  49. package/lib/container/ContainerReferencePlugin.js +1 -1
  50. package/lib/css/CssExportsGenerator.js +14 -1
  51. package/lib/css/CssGenerator.js +14 -1
  52. package/lib/css/CssLoadingRuntimeModule.js +23 -23
  53. package/lib/css/CssModulesPlugin.js +68 -32
  54. package/lib/css/CssParser.js +8 -3
  55. package/lib/debug/ProfilingPlugin.js +2 -2
  56. package/lib/dependencies/AMDDefineDependency.js +4 -4
  57. package/lib/dependencies/AMDDefineDependencyParserPlugin.js +126 -34
  58. package/lib/dependencies/AMDPlugin.js +11 -4
  59. package/lib/dependencies/AMDRequireArrayDependency.js +13 -1
  60. package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +159 -43
  61. package/lib/dependencies/AMDRequireDependency.js +2 -2
  62. package/lib/dependencies/AMDRequireItemDependency.js +1 -1
  63. package/lib/dependencies/CachedConstDependency.js +8 -1
  64. package/lib/dependencies/CommonJsImportsParserPlugin.js +1 -1
  65. package/lib/dependencies/ContextElementDependency.js +1 -1
  66. package/lib/dependencies/ExternalModuleDependency.js +107 -0
  67. package/lib/dependencies/ExternalModuleInitFragment.js +131 -0
  68. package/lib/dependencies/HarmonyAcceptDependency.js +1 -1
  69. package/lib/dependencies/HarmonyDetectionParserPlugin.js +7 -1
  70. package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +18 -18
  71. package/lib/dependencies/HarmonyExportInitFragment.js +6 -6
  72. package/lib/dependencies/HarmonyImportDependency.js +4 -4
  73. package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +6 -6
  74. package/lib/dependencies/ImportDependency.js +26 -6
  75. package/lib/dependencies/JsonExportsDependency.js +1 -1
  76. package/lib/dependencies/LoaderPlugin.js +2 -1
  77. package/lib/dependencies/LocalModuleDependency.js +1 -1
  78. package/lib/dependencies/PureExpressionDependency.js +12 -4
  79. package/lib/dependencies/RequireIncludeDependency.js +1 -1
  80. package/lib/dependencies/WebpackIsIncludedDependency.js +1 -1
  81. package/lib/dependencies/WorkerPlugin.js +10 -3
  82. package/lib/dependencies/getFunctionExpression.js +2 -2
  83. package/lib/esm/ModuleChunkLoadingRuntimeModule.js +6 -6
  84. package/lib/hmr/HotModuleReplacement.runtime.js +3 -5
  85. package/lib/hmr/lazyCompilationBackend.js +4 -4
  86. package/lib/ids/DeterministicModuleIdsPlugin.js +1 -1
  87. package/lib/index.js +4 -0
  88. package/lib/javascript/JavascriptGenerator.js +16 -1
  89. package/lib/javascript/JavascriptModulesPlugin.js +33 -33
  90. package/lib/javascript/JavascriptParser.js +220 -74
  91. package/lib/json/JsonGenerator.js +1 -1
  92. package/lib/library/AmdLibraryPlugin.js +5 -1
  93. package/lib/library/AssignLibraryPlugin.js +1 -1
  94. package/lib/library/SystemLibraryPlugin.js +1 -1
  95. package/lib/library/UmdLibraryPlugin.js +39 -39
  96. package/lib/logging/createConsoleLogger.js +1 -19
  97. package/lib/node/ReadFileChunkLoadingRuntimeModule.js +8 -8
  98. package/lib/node/RequireChunkLoadingRuntimeModule.js +8 -8
  99. package/lib/node/nodeConsole.js +1 -5
  100. package/lib/optimize/ConcatenatedModule.js +7 -7
  101. package/lib/optimize/InnerGraphPlugin.js +9 -1
  102. package/lib/optimize/MangleExportsPlugin.js +5 -1
  103. package/lib/optimize/ModuleConcatenationPlugin.js +2 -2
  104. package/lib/optimize/RemoveParentModulesPlugin.js +123 -47
  105. package/lib/optimize/SideEffectsFlagPlugin.js +15 -3
  106. package/lib/optimize/SplitChunksPlugin.js +16 -16
  107. package/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js +2 -2
  108. package/lib/rules/RuleSetCompiler.js +1 -1
  109. package/lib/runtime/AutoPublicPathRuntimeModule.js +2 -2
  110. package/lib/runtime/GetChunkFilenameRuntimeModule.js +4 -4
  111. package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +4 -4
  112. package/lib/runtime/LoadScriptRuntimeModule.js +2 -2
  113. package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +23 -22
  114. package/lib/runtime/StartupEntrypointRuntimeModule.js +2 -2
  115. package/lib/schemes/HttpUriPlugin.js +1 -1
  116. package/lib/serialization/FileMiddleware.js +4 -4
  117. package/lib/serialization/ObjectMiddleware.js +4 -4
  118. package/lib/sharing/ConsumeSharedPlugin.js +5 -5
  119. package/lib/sharing/ConsumeSharedRuntimeModule.js +8 -4
  120. package/lib/sharing/ProvideSharedModule.js +2 -2
  121. package/lib/sharing/SharePlugin.js +2 -2
  122. package/lib/sharing/ShareRuntimeModule.js +1 -1
  123. package/lib/sharing/utils.js +24 -28
  124. package/lib/stats/DefaultStatsFactoryPlugin.js +10 -10
  125. package/lib/stats/DefaultStatsPresetPlugin.js +3 -7
  126. package/lib/stats/DefaultStatsPrinterPlugin.js +34 -31
  127. package/lib/util/chainedImports.js +7 -6
  128. package/lib/util/cleverMerge.js +4 -4
  129. package/lib/util/comparators.js +59 -23
  130. package/lib/util/hash/xxhash64.js +2 -2
  131. package/lib/util/identifier.js +2 -2
  132. package/lib/util/internalSerializables.js +6 -0
  133. package/lib/util/numberHash.js +64 -52
  134. package/lib/util/runtime.js +18 -1
  135. package/lib/util/semver.js +19 -24
  136. package/lib/util/smartGrouping.js +1 -1
  137. package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +53 -28
  138. package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +2 -2
  139. package/lib/wasm-async/AsyncWebAssemblyParser.js +6 -0
  140. package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +2 -2
  141. package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +2 -2
  142. package/lib/web/JsonpChunkLoadingRuntimeModule.js +13 -13
  143. package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +6 -6
  144. package/package.json +25 -80
  145. package/schemas/WebpackOptions.check.js +1 -1
  146. package/schemas/WebpackOptions.json +140 -32
  147. package/schemas/plugins/css/CssAutoGeneratorOptions.check.d.ts +7 -0
  148. package/schemas/plugins/css/CssAutoGeneratorOptions.check.js +6 -0
  149. package/schemas/plugins/css/CssAutoGeneratorOptions.json +3 -0
  150. package/schemas/plugins/css/CssAutoParserOptions.check.d.ts +7 -0
  151. package/schemas/plugins/css/CssAutoParserOptions.check.js +6 -0
  152. package/schemas/plugins/css/CssAutoParserOptions.json +3 -0
  153. package/schemas/plugins/css/CssGeneratorOptions.check.js +1 -1
  154. package/schemas/plugins/css/CssGlobalGeneratorOptions.check.d.ts +7 -0
  155. package/schemas/plugins/css/CssGlobalGeneratorOptions.check.js +6 -0
  156. package/schemas/plugins/css/CssGlobalGeneratorOptions.json +3 -0
  157. package/schemas/plugins/css/CssGlobalParserOptions.check.d.ts +7 -0
  158. package/schemas/plugins/css/CssGlobalParserOptions.check.js +6 -0
  159. package/schemas/plugins/css/CssGlobalParserOptions.json +3 -0
  160. package/schemas/plugins/css/CssModuleGeneratorOptions.check.d.ts +7 -0
  161. package/schemas/plugins/css/CssModuleGeneratorOptions.check.js +6 -0
  162. package/schemas/plugins/css/CssModuleGeneratorOptions.json +3 -0
  163. package/schemas/plugins/css/CssModuleParserOptions.check.d.ts +7 -0
  164. package/schemas/plugins/css/CssModuleParserOptions.check.js +6 -0
  165. package/schemas/plugins/css/CssModuleParserOptions.json +3 -0
  166. package/schemas/plugins/css/CssParserOptions.check.js +1 -1
  167. package/types.d.ts +273 -94
@@ -6,12 +6,58 @@
6
6
  "use strict";
7
7
 
8
8
  const { STAGE_BASIC } = require("../OptimizationStages");
9
- const Queue = require("../util/Queue");
10
- const { intersect } = require("../util/SetHelpers");
11
9
 
12
10
  /** @typedef {import("../Chunk")} Chunk */
13
11
  /** @typedef {import("../ChunkGroup")} ChunkGroup */
14
12
  /** @typedef {import("../Compiler")} Compiler */
13
+ /** @typedef {import("../Module")} Module */
14
+
15
+ /**
16
+ * Intersects multiple masks represented as bigints
17
+ * @param {bigint[]} masks The module masks to intersect
18
+ * @returns {bigint} The intersection of all masks
19
+ */
20
+ function intersectMasks(masks) {
21
+ let result = masks[0];
22
+ for (let i = masks.length - 1; i >= 1; i--) {
23
+ result &= masks[i];
24
+ }
25
+ return result;
26
+ }
27
+
28
+ const ZERO_BIGINT = BigInt(0);
29
+ const ONE_BIGINT = BigInt(1);
30
+ const THIRTY_TWO_BIGINT = BigInt(32);
31
+
32
+ /**
33
+ * Parses the module mask and returns the modules represented by it
34
+ * @param {bigint} mask the module mask
35
+ * @param {Module[]} ordinalModules the modules in the order they were added to the mask (LSB is index 0)
36
+ * @returns {Generator<Module>} the modules represented by the mask
37
+ */
38
+ function* getModulesFromMask(mask, ordinalModules) {
39
+ let offset = 31;
40
+ while (mask !== ZERO_BIGINT) {
41
+ // Consider the last 32 bits, since that's what Math.clz32 can handle
42
+ let last32 = Number(BigInt.asUintN(32, mask));
43
+ while (last32 > 0) {
44
+ let last = Math.clz32(last32);
45
+ // The number of trailing zeros is the number trimmed off the input mask + 31 - the number of leading zeros
46
+ // The 32 is baked into the initial value of offset
47
+ const moduleIndex = offset - last;
48
+ // The number of trailing zeros is the index into the array generated by getOrCreateModuleMask
49
+ const module = ordinalModules[moduleIndex];
50
+ yield module;
51
+ // Remove the matched module from the mask
52
+ // Since we can only count leading zeros, not trailing, we can't just downshift the mask
53
+ last32 &= ~(1 << (31 - last));
54
+ }
55
+
56
+ // Remove the processed chunk from the mask
57
+ mask >>= THIRTY_TWO_BIGINT;
58
+ offset += 32;
59
+ }
60
+ }
15
61
 
16
62
  class RemoveParentModulesPlugin {
17
63
  /**
@@ -26,92 +72,122 @@ class RemoveParentModulesPlugin {
26
72
  */
27
73
  const handler = (chunks, chunkGroups) => {
28
74
  const chunkGraph = compilation.chunkGraph;
29
- const queue = new Queue();
75
+ const queue = new Set();
30
76
  const availableModulesMap = new WeakMap();
31
77
 
78
+ let nextModuleMask = ONE_BIGINT;
79
+ const maskByModule = new WeakMap();
80
+ const ordinalModules = [];
81
+
82
+ /**
83
+ * Gets or creates a unique mask for a module
84
+ * @param {Module} mod the module to get the mask for
85
+ * @returns {bigint} the module mask to uniquely identify the module
86
+ */
87
+ const getOrCreateModuleMask = mod => {
88
+ let id = maskByModule.get(mod);
89
+ if (id === undefined) {
90
+ id = nextModuleMask;
91
+ ordinalModules.push(mod);
92
+ maskByModule.set(mod, id);
93
+ nextModuleMask <<= ONE_BIGINT;
94
+ }
95
+ return id;
96
+ };
97
+
98
+ // Initialize masks by chunk and by chunk group for quicker comparisons
99
+ const chunkMasks = new WeakMap();
100
+ for (const chunk of chunks) {
101
+ let mask = ZERO_BIGINT;
102
+ for (const m of chunkGraph.getChunkModulesIterable(chunk)) {
103
+ const id = getOrCreateModuleMask(m);
104
+ mask |= id;
105
+ }
106
+ chunkMasks.set(chunk, mask);
107
+ }
108
+
109
+ const chunkGroupMasks = new WeakMap();
110
+ for (const chunkGroup of chunkGroups) {
111
+ let mask = ZERO_BIGINT;
112
+ for (const chunk of chunkGroup.chunks) {
113
+ const chunkMask = chunkMasks.get(chunk);
114
+ if (chunkMask !== undefined) {
115
+ mask |= chunkMask;
116
+ }
117
+ }
118
+ chunkGroupMasks.set(chunkGroup, mask);
119
+ }
120
+
32
121
  for (const chunkGroup of compilation.entrypoints.values()) {
33
122
  // initialize available modules for chunks without parents
34
- availableModulesMap.set(chunkGroup, new Set());
123
+ availableModulesMap.set(chunkGroup, ZERO_BIGINT);
35
124
  for (const child of chunkGroup.childrenIterable) {
36
- queue.enqueue(child);
125
+ queue.add(child);
37
126
  }
38
127
  }
39
128
  for (const chunkGroup of compilation.asyncEntrypoints) {
40
129
  // initialize available modules for chunks without parents
41
- availableModulesMap.set(chunkGroup, new Set());
130
+ availableModulesMap.set(chunkGroup, ZERO_BIGINT);
42
131
  for (const child of chunkGroup.childrenIterable) {
43
- queue.enqueue(child);
132
+ queue.add(child);
44
133
  }
45
134
  }
46
135
 
47
- while (queue.length > 0) {
48
- const chunkGroup = queue.dequeue();
49
- let availableModules = availableModulesMap.get(chunkGroup);
136
+ for (const chunkGroup of queue) {
137
+ let availableModulesMask = availableModulesMap.get(chunkGroup);
50
138
  let changed = false;
51
139
  for (const parent of chunkGroup.parentsIterable) {
52
140
  const availableModulesInParent = availableModulesMap.get(parent);
53
141
  if (availableModulesInParent !== undefined) {
142
+ const parentMask =
143
+ availableModulesInParent | chunkGroupMasks.get(parent);
54
144
  // If we know the available modules in parent: process these
55
- if (availableModules === undefined) {
145
+ if (availableModulesMask === undefined) {
56
146
  // if we have not own info yet: create new entry
57
- availableModules = new Set(availableModulesInParent);
58
- for (const chunk of parent.chunks) {
59
- for (const m of chunkGraph.getChunkModulesIterable(chunk)) {
60
- availableModules.add(m);
61
- }
62
- }
63
- availableModulesMap.set(chunkGroup, availableModules);
147
+ availableModulesMask = parentMask;
64
148
  changed = true;
65
149
  } else {
66
- for (const m of availableModules) {
67
- if (
68
- !chunkGraph.isModuleInChunkGroup(m, parent) &&
69
- !availableModulesInParent.has(m)
70
- ) {
71
- availableModules.delete(m);
72
- changed = true;
73
- }
150
+ let newMask = availableModulesMask & parentMask;
151
+ if (newMask !== availableModulesMask) {
152
+ changed = true;
153
+ availableModulesMask = newMask;
74
154
  }
75
155
  }
76
156
  }
77
157
  }
158
+
78
159
  if (changed) {
160
+ availableModulesMap.set(chunkGroup, availableModulesMask);
79
161
  // if something changed: enqueue our children
80
162
  for (const child of chunkGroup.childrenIterable) {
81
- queue.enqueue(child);
163
+ // Push the child to the end of the queue
164
+ queue.delete(child);
165
+ queue.add(child);
82
166
  }
83
167
  }
84
168
  }
85
169
 
86
170
  // now we have available modules for every chunk
87
171
  for (const chunk of chunks) {
172
+ const chunkMask = chunkMasks.get(chunk);
173
+ if (chunkMask === undefined) continue; // No info about this chunk
174
+
88
175
  const availableModulesSets = Array.from(
89
176
  chunk.groupsIterable,
90
177
  chunkGroup => availableModulesMap.get(chunkGroup)
91
178
  );
92
179
  if (availableModulesSets.some(s => s === undefined)) continue; // No info about this chunk group
93
- const availableModules =
94
- availableModulesSets.length === 1
95
- ? availableModulesSets[0]
96
- : intersect(availableModulesSets);
97
- const numberOfModules = chunkGraph.getNumberOfChunkModules(chunk);
98
- const toRemove = new Set();
99
- if (numberOfModules < availableModules.size) {
100
- for (const m of chunkGraph.getChunkModulesIterable(chunk)) {
101
- if (availableModules.has(m)) {
102
- toRemove.add(m);
103
- }
104
- }
105
- } else {
106
- for (const m of availableModules) {
107
- if (chunkGraph.isModuleInChunk(m, chunk)) {
108
- toRemove.add(m);
109
- }
180
+
181
+ const availableModulesMask = intersectMasks(availableModulesSets);
182
+ const toRemoveMask = chunkMask & availableModulesMask;
183
+ if (toRemoveMask !== ZERO_BIGINT) {
184
+ for (const module of getModulesFromMask(
185
+ toRemoveMask,
186
+ ordinalModules
187
+ )) {
188
+ chunkGraph.disconnectChunkAndModule(chunk, module);
110
189
  }
111
190
  }
112
- for (const module of toRemove) {
113
- chunkGraph.disconnectChunkAndModule(chunk, module);
114
- }
115
191
  }
116
192
  };
117
193
  compilation.hooks.optimizeChunks.tap(
@@ -159,8 +159,8 @@ class SideEffectsFlagPlugin {
159
159
  statement.test
160
160
  ? statement.test.range[1]
161
161
  : statement.init
162
- ? statement.init.range[1]
163
- : statement.range[0]
162
+ ? statement.init.range[1]
163
+ : statement.range[0]
164
164
  )
165
165
  ) {
166
166
  sideEffectsStatement = statement;
@@ -243,7 +243,12 @@ class SideEffectsFlagPlugin {
243
243
  );
244
244
 
245
245
  logger.time("update dependencies");
246
- for (const module of modules) {
246
+
247
+ const optimizedModules = new Set();
248
+
249
+ const optimizeIncomingConnections = module => {
250
+ if (optimizedModules.has(module)) return;
251
+ optimizedModules.add(module);
247
252
  if (module.getSideEffectsConnectionState(moduleGraph) === false) {
248
253
  const exportsInfo = moduleGraph.getExportsInfo(module);
249
254
  for (const connection of moduleGraph.getIncomingConnections(
@@ -258,6 +263,9 @@ class SideEffectsFlagPlugin {
258
263
  (dep instanceof HarmonyImportSpecifierDependency &&
259
264
  !dep.namespaceObjectAsContext)
260
265
  ) {
266
+ if (connection.originModule !== null) {
267
+ optimizeIncomingConnections(connection.originModule);
268
+ }
261
269
  // TODO improve for export *
262
270
  if (isReexport && dep.name) {
263
271
  const exportInfo = moduleGraph.getExportInfo(
@@ -314,6 +322,10 @@ class SideEffectsFlagPlugin {
314
322
  }
315
323
  }
316
324
  }
325
+ };
326
+
327
+ for (const module of modules) {
328
+ optimizeIncomingConnections(module);
317
329
  }
318
330
  logger.timeEnd("update dependencies");
319
331
  }
@@ -749,20 +749,20 @@ module.exports = class SplitChunksPlugin {
749
749
  cacheGroupSource.minChunks !== undefined
750
750
  ? cacheGroupSource.minChunks
751
751
  : cacheGroupSource.enforce
752
- ? 1
753
- : this.options.minChunks,
752
+ ? 1
753
+ : this.options.minChunks,
754
754
  maxAsyncRequests:
755
755
  cacheGroupSource.maxAsyncRequests !== undefined
756
756
  ? cacheGroupSource.maxAsyncRequests
757
757
  : cacheGroupSource.enforce
758
- ? Infinity
759
- : this.options.maxAsyncRequests,
758
+ ? Infinity
759
+ : this.options.maxAsyncRequests,
760
760
  maxInitialRequests:
761
761
  cacheGroupSource.maxInitialRequests !== undefined
762
762
  ? cacheGroupSource.maxInitialRequests
763
763
  : cacheGroupSource.enforce
764
- ? Infinity
765
- : this.options.maxInitialRequests,
764
+ ? Infinity
765
+ : this.options.maxInitialRequests,
766
766
  getName:
767
767
  cacheGroupSource.getName !== undefined
768
768
  ? cacheGroupSource.getName
@@ -1428,13 +1428,13 @@ module.exports = class SplitChunksPlugin {
1428
1428
  chunk.isOnlyInitial()
1429
1429
  ? item.cacheGroup.maxInitialRequests
1430
1430
  : chunk.canBeInitial()
1431
- ? Math.min(
1432
- /** @type {number} */
1433
- (item.cacheGroup.maxInitialRequests),
1434
- /** @type {number} */
1435
- (item.cacheGroup.maxAsyncRequests)
1436
- )
1437
- : item.cacheGroup.maxAsyncRequests
1431
+ ? Math.min(
1432
+ /** @type {number} */
1433
+ (item.cacheGroup.maxInitialRequests),
1434
+ /** @type {number} */
1435
+ (item.cacheGroup.maxAsyncRequests)
1436
+ )
1437
+ : item.cacheGroup.maxAsyncRequests
1438
1438
  );
1439
1439
  if (
1440
1440
  isFinite(maxRequests) &&
@@ -1569,21 +1569,21 @@ module.exports = class SplitChunksPlugin {
1569
1569
  oldMaxSizeSettings.minSize,
1570
1570
  item.cacheGroup._minSizeForMaxSize,
1571
1571
  Math.max
1572
- )
1572
+ )
1573
1573
  : item.cacheGroup.minSize,
1574
1574
  maxAsyncSize: oldMaxSizeSettings
1575
1575
  ? combineSizes(
1576
1576
  oldMaxSizeSettings.maxAsyncSize,
1577
1577
  item.cacheGroup.maxAsyncSize,
1578
1578
  Math.min
1579
- )
1579
+ )
1580
1580
  : item.cacheGroup.maxAsyncSize,
1581
1581
  maxInitialSize: oldMaxSizeSettings
1582
1582
  ? combineSizes(
1583
1583
  oldMaxSizeSettings.maxInitialSize,
1584
1584
  item.cacheGroup.maxInitialSize,
1585
1585
  Math.min
1586
- )
1586
+ )
1587
1587
  : item.cacheGroup.maxInitialSize,
1588
1588
  automaticNameDelimiter: item.cacheGroup.automaticNameDelimiter,
1589
1589
  keys: oldMaxSizeSettings
@@ -42,10 +42,10 @@ class ChunkPrefetchStartupRuntimeModule extends RuntimeModule {
42
42
  chunks,
43
43
  c =>
44
44
  `${RuntimeGlobals.prefetchChunk}(${JSON.stringify(c.id)});`
45
- )
45
+ )
46
46
  : `${JSON.stringify(Array.from(chunks, c => c.id))}.map(${
47
47
  RuntimeGlobals.prefetchChunk
48
- });`
48
+ });`
49
49
  )}, 5);`
50
50
  )
51
51
  );
@@ -272,7 +272,7 @@ class RuleSetCompiler {
272
272
  if (!Array.isArray(value)) {
273
273
  throw this.error(
274
274
  `${path}.or`,
275
- condition.and,
275
+ condition.or,
276
276
  "Expected array of conditions"
277
277
  );
278
278
  }
@@ -63,7 +63,7 @@ class AutoPublicPathRuntimeModule extends RuntimeModule {
63
63
  "}"
64
64
  ]),
65
65
  "}"
66
- ]),
66
+ ]),
67
67
  "// When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration",
68
68
  '// or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.',
69
69
  'if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");',
@@ -72,7 +72,7 @@ class AutoPublicPathRuntimeModule extends RuntimeModule {
72
72
  ? `${RuntimeGlobals.publicPath} = scriptUrl;`
73
73
  : `${RuntimeGlobals.publicPath} = scriptUrl + ${JSON.stringify(
74
74
  undoPath
75
- )};`
75
+ )};`
76
76
  ]);
77
77
  }
78
78
  }
@@ -152,7 +152,7 @@ class GetChunkFilenameRuntimeModule extends RuntimeModule {
152
152
  chunk: c,
153
153
  contentHashType: contentType
154
154
  })
155
- )
155
+ )
156
156
  : JSON.stringify(chunkFilename);
157
157
  const staticChunkFilename = compilation.getPath(chunkFilenameValue, {
158
158
  hash: `" + ${RuntimeGlobals.getFullHash}() + "`,
@@ -219,7 +219,7 @@ class GetChunkFilenameRuntimeModule extends RuntimeModule {
219
219
  return useId
220
220
  ? `(chunkId === ${JSON.stringify(lastKey)} ? ${JSON.stringify(
221
221
  obj[/** @type {number | string} */ (lastKey)]
222
- )} : chunkId)`
222
+ )} : chunkId)`
223
223
  : JSON.stringify(obj[/** @type {number | string} */ (lastKey)]);
224
224
  }
225
225
  return useId
@@ -285,13 +285,13 @@ class GetChunkFilenameRuntimeModule extends RuntimeModule {
285
285
  : `{${Array.from(
286
286
  ids,
287
287
  id => `${JSON.stringify(id)}:1`
288
- ).join(",")}}[chunkId]`;
288
+ ).join(",")}}[chunkId]`;
289
289
  return `if (${condition}) return ${url};`;
290
290
  })
291
291
  ),
292
292
  "// return url for filenames based on template",
293
293
  `return ${url};`
294
- ]
294
+ ]
295
295
  : ["// return url for filenames based on template", `return ${url};`]
296
296
  )};`
297
297
  ]);
@@ -46,7 +46,7 @@ class GetTrustedTypesPolicyRuntimeModule extends HelperRuntimeModule {
46
46
  "script",
47
47
  "script"
48
48
  )}`
49
- ]
49
+ ]
50
50
  : []),
51
51
  ...(this.runtimeRequirements.has(RuntimeGlobals.createScriptUrl)
52
52
  ? [
@@ -54,7 +54,7 @@ class GetTrustedTypesPolicyRuntimeModule extends HelperRuntimeModule {
54
54
  "url",
55
55
  "url"
56
56
  )}`
57
- ]
57
+ ]
58
58
  : [])
59
59
  ].join(",\n")
60
60
  ),
@@ -80,11 +80,11 @@ class GetTrustedTypesPolicyRuntimeModule extends HelperRuntimeModule {
80
80
  )}');`
81
81
  ]),
82
82
  "}"
83
- ]
83
+ ]
84
84
  : [])
85
85
  ]),
86
86
  "}"
87
- ]
87
+ ]
88
88
  : [])
89
89
  ]),
90
90
  "}",
@@ -90,7 +90,7 @@ class LoadScriptRuntimeModule extends HelperRuntimeModule {
90
90
  'script.setAttribute("fetchpriority", fetchPriority);'
91
91
  ),
92
92
  "}"
93
- ])
93
+ ])
94
94
  : "",
95
95
  `script.src = ${
96
96
  this._withCreateScriptUrl
@@ -106,7 +106,7 @@ class LoadScriptRuntimeModule extends HelperRuntimeModule {
106
106
  `script.crossOrigin = ${JSON.stringify(crossOriginLoading)};`
107
107
  ),
108
108
  "}"
109
- ])
109
+ ])
110
110
  : ""
111
111
  ]);
112
112
 
@@ -46,28 +46,29 @@ class StartupChunkDependenciesRuntimeModule extends RuntimeModule {
46
46
  )
47
47
  .concat("return next();")
48
48
  : chunkIds.length === 1
49
- ? `return ${RuntimeGlobals.ensureChunk}(${JSON.stringify(
50
- chunkIds[0]
51
- )}).then(next);`
52
- : chunkIds.length > 2
53
- ? [
54
- // using map is shorter for 3 or more chunks
55
- `return Promise.all(${JSON.stringify(chunkIds)}.map(${
56
- RuntimeGlobals.ensureChunk
57
- }, ${RuntimeGlobals.require})).then(next);`
58
- ]
59
- : [
60
- // calling ensureChunk directly is shorter for 0 - 2 chunks
61
- "return Promise.all([",
62
- Template.indent(
63
- chunkIds
64
- .map(
65
- id => `${RuntimeGlobals.ensureChunk}(${JSON.stringify(id)})`
66
- )
67
- .join(",\n")
68
- ),
69
- "]).then(next);"
70
- ]
49
+ ? `return ${RuntimeGlobals.ensureChunk}(${JSON.stringify(
50
+ chunkIds[0]
51
+ )}).then(next);`
52
+ : chunkIds.length > 2
53
+ ? [
54
+ // using map is shorter for 3 or more chunks
55
+ `return Promise.all(${JSON.stringify(chunkIds)}.map(${
56
+ RuntimeGlobals.ensureChunk
57
+ }, ${RuntimeGlobals.require})).then(next);`
58
+ ]
59
+ : [
60
+ // calling ensureChunk directly is shorter for 0 - 2 chunks
61
+ "return Promise.all([",
62
+ Template.indent(
63
+ chunkIds
64
+ .map(
65
+ id =>
66
+ `${RuntimeGlobals.ensureChunk}(${JSON.stringify(id)})`
67
+ )
68
+ .join(",\n")
69
+ ),
70
+ "]).then(next);"
71
+ ]
71
72
  )};`
72
73
  ]);
73
74
  }
@@ -41,12 +41,12 @@ class StartupEntrypointRuntimeModule extends RuntimeModule {
41
41
  "var r = fn();",
42
42
  "return r === undefined ? result : r;"
43
43
  ])})`
44
- ]
44
+ ]
45
45
  : [
46
46
  `chunkIds.map(${RuntimeGlobals.ensureChunk}, ${RuntimeGlobals.require})`,
47
47
  "var r = fn();",
48
48
  "return r === undefined ? result : r;"
49
- ])
49
+ ])
50
50
  ])}`;
51
51
  }
52
52
  }
@@ -200,7 +200,7 @@ class Lockfile {
200
200
  : {
201
201
  resolved: key,
202
202
  ...entry
203
- }
203
+ }
204
204
  );
205
205
  }
206
206
  return lockfile;
@@ -60,23 +60,23 @@ const DECOMPRESSION_CHUNK_SIZE = 100 * 1024 * 1024;
60
60
  const writeUInt64LE = Buffer.prototype.writeBigUInt64LE
61
61
  ? (buf, value, offset) => {
62
62
  buf.writeBigUInt64LE(BigInt(value), offset);
63
- }
63
+ }
64
64
  : (buf, value, offset) => {
65
65
  const low = value % 0x100000000;
66
66
  const high = (value - low) / 0x100000000;
67
67
  buf.writeUInt32LE(low, offset);
68
68
  buf.writeUInt32LE(high, offset + 4);
69
- };
69
+ };
70
70
 
71
71
  const readUInt64LE = Buffer.prototype.readBigUInt64LE
72
72
  ? (buf, offset) => {
73
73
  return Number(buf.readBigUInt64LE(offset));
74
- }
74
+ }
75
75
  : (buf, offset) => {
76
76
  const low = buf.readUInt32LE(offset);
77
77
  const high = buf.readUInt32LE(offset + 4);
78
78
  return high * 0x100000000 + low;
79
- };
79
+ };
80
80
 
81
81
  /**
82
82
  * @typedef {Object} SerializeResult
@@ -718,10 +718,10 @@ class ObjectMiddleware extends SerializerMiddleware {
718
718
  const name = !serializerEntry
719
719
  ? "unknown"
720
720
  : !serializerEntry[1].request
721
- ? serializerEntry[0].name
722
- : serializerEntry[1].name
723
- ? `${serializerEntry[1].request} ${serializerEntry[1].name}`
724
- : serializerEntry[1].request;
721
+ ? serializerEntry[0].name
722
+ : serializerEntry[1].name
723
+ ? `${serializerEntry[1].request} ${serializerEntry[1].name}`
724
+ : serializerEntry[1].request;
725
725
  err.message += `\n(during deserialization of ${name})`;
726
726
  throw err;
727
727
  }
@@ -60,7 +60,7 @@ class ConsumeSharedPlugin {
60
60
  let result =
61
61
  item === key || !isRequiredVersion(item)
62
62
  ? // item is a request/key
63
- {
63
+ {
64
64
  import: key,
65
65
  shareScope: options.shareScope || "default",
66
66
  shareKey: key,
@@ -69,10 +69,10 @@ class ConsumeSharedPlugin {
69
69
  strictVersion: false,
70
70
  singleton: false,
71
71
  eager: false
72
- }
72
+ }
73
73
  : // key is a request/key
74
- // item is a version
75
- {
74
+ // item is a version
75
+ {
76
76
  import: key,
77
77
  shareScope: options.shareScope || "default",
78
78
  shareKey: key,
@@ -81,7 +81,7 @@ class ConsumeSharedPlugin {
81
81
  packageName: undefined,
82
82
  singleton: false,
83
83
  eager: false
84
- };
84
+ };
85
85
  return result;
86
86
  },
87
87
  (item, key) => ({