webpack 5.100.0 → 5.100.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.
package/lib/Dependency.js CHANGED
@@ -85,9 +85,11 @@ const memoize = require("./util/memoize");
85
85
 
86
86
  const TRANSITIVE = Symbol("transitive");
87
87
 
88
- const getIgnoredModule = memoize(
89
- () => new RawModule("/* (ignored) */", "ignored", "(ignored)")
90
- );
88
+ const getIgnoredModule = memoize(() => {
89
+ const module = new RawModule("/* (ignored) */", "ignored", "(ignored)");
90
+ module.factoryMeta = { sideEffectFree: true };
91
+ return module;
92
+ });
91
93
 
92
94
  class Dependency {
93
95
  constructor() {
@@ -80,11 +80,14 @@ class IgnorePlugin {
80
80
  resolveData.dependencies.length > 0 &&
81
81
  resolveData.dependencies[0] instanceof EntryDependency
82
82
  ) {
83
- resolveData.ignoredModule = new RawModule(
83
+ const module = new RawModule(
84
84
  "",
85
85
  "ignored-entry-module",
86
86
  "(ignored-entry-module)"
87
87
  );
88
+ module.factoryMeta = { sideEffectFree: true };
89
+
90
+ resolveData.ignoredModule = module;
88
91
  }
89
92
 
90
93
  return result;
@@ -572,8 +572,11 @@ class NormalModuleFactory extends ModuleFactory {
572
572
 
573
573
  /** @type {ModuleSettings} */
574
574
  const settings = {};
575
+ /** @type {LoaderItem[]} */
575
576
  const useLoadersPost = [];
577
+ /** @type {LoaderItem[]} */
576
578
  const useLoaders = [];
579
+ /** @type {LoaderItem[]} */
577
580
  const useLoadersPre = [];
578
581
 
579
582
  // handle .webpack[] suffix
@@ -632,7 +635,8 @@ class NormalModuleFactory extends ModuleFactory {
632
635
  typeof r.value === "object" &&
633
636
  r.value !== null &&
634
637
  typeof settings[
635
- /** @type {keyof ModuleSettings} */ (r.type)
638
+ /** @type {keyof ModuleSettings} */
639
+ (r.type)
636
640
  ] === "object" &&
637
641
  settings[/** @type {keyof ModuleSettings} */ (r.type)] !== null
638
642
  ) {
package/lib/RawModule.js CHANGED
@@ -24,6 +24,8 @@ const makeSerializable = require("./util/makeSerializable");
24
24
  /** @typedef {import("./Module").NeedBuildCallback} NeedBuildCallback */
25
25
  /** @typedef {import("./Module").NeedBuildContext} NeedBuildContext */
26
26
  /** @typedef {import("./Module").ReadOnlyRuntimeRequirements} ReadOnlyRuntimeRequirements */
27
+ /** @typedef {import("./ModuleGraph")} ModuleGraph */
28
+ /** @typedef {import("./ModuleGraphConnection").ConnectionState} ConnectionState */
27
29
  /** @typedef {import("./RequestShortener")} RequestShortener */
28
30
  /** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */
29
31
  /** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */
@@ -105,6 +107,18 @@ class RawModule extends Module {
105
107
  callback();
106
108
  }
107
109
 
110
+ /**
111
+ * @param {ModuleGraph} moduleGraph the module graph
112
+ * @returns {ConnectionState} how this module should be connected to referencing modules when consumed for side-effects only
113
+ */
114
+ getSideEffectsConnectionState(moduleGraph) {
115
+ if (this.factoryMeta !== undefined) {
116
+ if (this.factoryMeta.sideEffectFree) return false;
117
+ if (this.factoryMeta.sideEffectFree === false) return true;
118
+ }
119
+ return true;
120
+ }
121
+
108
122
  /**
109
123
  * @param {CodeGenerationContext} context context for code generation
110
124
  * @returns {CodeGenerationResult} result
@@ -61,11 +61,13 @@ class ModuleDependency extends Dependency {
61
61
  * @returns {Module} ignored module
62
62
  */
63
63
  createIgnoredModule(context) {
64
- return new RawModule(
64
+ const module = new RawModule(
65
65
  "/* (ignored) */",
66
66
  `ignored|${context}|${this.request}`,
67
67
  `${this.request} (ignored)`
68
68
  );
69
+ module.factoryMeta = { sideEffectFree: true };
70
+ return module;
69
71
  }
70
72
 
71
73
  /**
@@ -10,6 +10,7 @@ const { SyncHook } = require("tapable");
10
10
  /** @typedef {import("../../declarations/WebpackOptions").Falsy} Falsy */
11
11
  /** @typedef {import("../../declarations/WebpackOptions").RuleSetLoaderOptions} RuleSetLoaderOptions */
12
12
  /** @typedef {import("../../declarations/WebpackOptions").RuleSetRule} RuleSetRule */
13
+ /** @typedef {import("../NormalModule").LoaderItem} LoaderItem */
13
14
 
14
15
  /** @typedef {(Falsy | RuleSetRule)[]} RuleSetRules */
15
16
 
@@ -54,12 +55,22 @@ const { SyncHook } = require("tapable");
54
55
  * @property {CompiledRule[]=} oneOf
55
56
  */
56
57
 
58
+ /** @typedef {"use" | "use-pre" | "use-post"} EffectUseType */
59
+
57
60
  /**
58
- * @typedef {object} Effect
61
+ * @typedef {object} EffectUse
62
+ * @property {EffectUseType} type
63
+ * @property {{ loader: string, options?: string | null | Record<string, EXPECTED_ANY>, ident?: string }} value
64
+ */
65
+
66
+ /**
67
+ * @typedef {object} EffectBasic
59
68
  * @property {string} type
60
- * @property {TODO} value
69
+ * @property {EXPECTED_ANY} value
61
70
  */
62
71
 
72
+ /** @typedef {EffectUse | EffectBasic} Effect */
73
+
63
74
  /** @typedef {Map<string, RuleSetLoaderOptions>} References */
64
75
 
65
76
  /**
@@ -16,6 +16,7 @@ const util = require("util");
16
16
  /** @typedef {import("./RuleSetCompiler")} RuleSetCompiler */
17
17
  /** @typedef {import("./RuleSetCompiler").Effect} Effect */
18
18
  /** @typedef {import("./RuleSetCompiler").EffectData} EffectData */
19
+ /** @typedef {import("./RuleSetCompiler").EffectUseType} EffectUseType */
19
20
 
20
21
  const PLUGIN_NAME = "UseEffectRulePlugin";
21
22
 
@@ -52,7 +53,9 @@ class UseEffectRulePlugin {
52
53
  const use = /** @type {RuleSetUse} */ (rule.use);
53
54
  const enforce = rule.enforce;
54
55
 
55
- const type = enforce ? `use-${enforce}` : "use";
56
+ const type =
57
+ /** @type {EffectUseType} */
58
+ (enforce ? `use-${enforce}` : "use");
56
59
 
57
60
  /**
58
61
  * @param {string} path options path
@@ -89,7 +92,7 @@ class UseEffectRulePlugin {
89
92
  }
90
93
  };
91
94
  }
92
- const loader = item.loader;
95
+ const loader = /** @type {string} */ (item.loader);
93
96
  const options = item.options;
94
97
  let ident = item.ident;
95
98
  if (options && typeof options === "object") {
@@ -207,12 +210,15 @@ class UseEffectRulePlugin {
207
210
 
208
211
  const ident =
209
212
  options && typeof options === "object" ? path : undefined;
210
- references.set(
211
- /** @type {TODO} */
212
- (ident),
213
- /** @type {RuleSetLoaderOptions} */
214
- (options)
215
- );
213
+
214
+ if (ident) {
215
+ references.set(
216
+ ident,
217
+ /** @type {RuleSetLoaderOptions} */
218
+ (options)
219
+ );
220
+ }
221
+
216
222
  result.effects.push({
217
223
  type: enforce ? `use-${enforce}` : "use",
218
224
  value: {
@@ -182,7 +182,7 @@ const AUTO_FOR_TO_STRING = ({ all }, { forToString }) => {
182
182
  /** @typedef {keyof NormalizedStatsOptions} DefaultsKeys */
183
183
  /** @typedef {{ [Key in DefaultsKeys]: (options: Partial<NormalizedStatsOptions>, context: CreateStatsOptionsContext, compilation: Compilation) => NormalizedStatsOptions[Key] | RequestShortener }} Defaults */
184
184
 
185
- /** @type {Partial<Defaults>} */
185
+ /** @type {Defaults} */
186
186
  const DEFAULTS = {
187
187
  context: (options, context, compilation) => compilation.compiler.context,
188
188
  requestShortener: (options, context, compilation) =>
@@ -307,9 +307,9 @@ const normalizeFilter = item => {
307
307
  };
308
308
 
309
309
  /** @typedef {keyof (KnownNormalizedStatsOptions | StatsOptions)} NormalizerKeys */
310
- /** @typedef {{ [Key in NormalizerKeys]: (value: StatsOptions[Key]) => KnownNormalizedStatsOptions[Key] }} Normalizers */
310
+ /** @typedef {{ [Key in NormalizerKeys]?: (value: StatsOptions[Key]) => KnownNormalizedStatsOptions[Key] }} Normalizers */
311
311
 
312
- /** @type {Partial<Normalizers>} */
312
+ /** @type {Normalizers} */
313
313
  const NORMALIZER = {
314
314
  excludeModules: value => {
315
315
  if (!Array.isArray(value)) {
@@ -391,18 +391,16 @@ class DefaultStatsPresetPlugin {
391
391
  compilation.hooks.statsNormalize.tap(PLUGIN_NAME, (options, context) => {
392
392
  for (const key of Object.keys(DEFAULTS)) {
393
393
  if (options[key] === undefined) {
394
- options[key] =
395
- /** @type {Defaults[DefaultsKeys]} */
396
- (DEFAULTS[/** @type {DefaultsKeys} */ (key)])(
397
- options,
398
- context,
399
- compilation
400
- );
394
+ options[key] = DEFAULTS[/** @type {DefaultsKeys} */ (key)](
395
+ options,
396
+ context,
397
+ compilation
398
+ );
401
399
  }
402
400
  }
403
401
  for (const key of Object.keys(NORMALIZER)) {
404
402
  options[key] =
405
- /** @type {TODO} */
403
+ /** @type {NonNullable<Normalizers[keyof Normalizers]>} */
406
404
  (NORMALIZER[/** @type {NormalizerKeys} */ (key)])(options[key]);
407
405
  }
408
406
  });
@@ -121,7 +121,8 @@ class StatsFactory {
121
121
  getItemFactory: new HookMap(() => new SyncBailHook(["item", "context"]))
122
122
  });
123
123
  const hooks = this.hooks;
124
- this._caches = /** @type {TODO} */ ({});
124
+ this._caches =
125
+ /** @type {{ [Key in keyof StatsFactoryHooks]: Map<string, SyncBailHook<EXPECTED_ANY, EXPECTED_ANY>[]> }} */ ({});
125
126
  for (const key of Object.keys(hooks)) {
126
127
  this._caches[/** @type {keyof StatsFactoryHooks} */ (key)] = new Map();
127
128
  }
@@ -102,9 +102,7 @@ class StatsPrinter {
102
102
  print: new HookMap(() => new SyncBailHook(["object", "context"])),
103
103
  result: new HookMap(() => new SyncWaterfallHook(["result", "context"]))
104
104
  });
105
- /**
106
- * @type {TODO}
107
- */
105
+ /** @type {Map<StatsPrintHooks[keyof StatsPrintHooks], Map<string, import("tapable").Hook<EXPECTED_ANY, EXPECTED_ANY>[]>>} */
108
106
  this._levelHookCache = new Map();
109
107
  this._inPrint = false;
110
108
  }
@@ -126,7 +124,7 @@ class StatsPrinter {
126
124
  }
127
125
  const cacheEntry = cache.get(type);
128
126
  if (cacheEntry !== undefined) {
129
- return cacheEntry;
127
+ return /** @type {H[]} */ (cacheEntry);
130
128
  }
131
129
  /** @type {H[]} */
132
130
  const hooks = [];
@@ -146,7 +144,7 @@ class StatsPrinter {
146
144
  * @private
147
145
  * @template {StatsPrintHooks[keyof StatsPrintHooks]} HM
148
146
  * @template {HM extends HookMap<infer H> ? H : never} H
149
- * @template {H extends import("tapable").Hook<any, infer R> ? R : never} R
147
+ * @template {H extends import("tapable").Hook<EXPECTED_ANY, infer R> ? R : never} R
150
148
  * @param {HM} hookMap hook map
151
149
  * @param {string} type type
152
150
  * @param {(hooK: H) => R | undefined | void} fn fn
@@ -85,32 +85,43 @@ const cachedSetProperty = (obj, property, value) => {
85
85
  };
86
86
 
87
87
  /**
88
- * @template V
89
- * @typedef {Map<string, V | undefined>} ByValues
88
+ * @typedef {Map<string, EXPECTED_ANY>} ByValues
90
89
  */
91
90
 
92
91
  /**
92
+ * @template T
93
93
  * @typedef {object} ObjectParsedPropertyEntry
94
- * @property {TODO | undefined} base base value
94
+ * @property {T[keyof T] | undefined} base base value
95
95
  * @property {string | undefined} byProperty the name of the selector property
96
- * @property {ByValues<TODO>} byValues value depending on selector property, merged with base
96
+ * @property {ByValues | undefined} byValues value depending on selector property, merged with base
97
97
  */
98
98
 
99
99
  /** @typedef {(function(...EXPECTED_ANY): object) & { [DYNAMIC_INFO]: [DynamicFunction, object] }} DynamicFunction */
100
100
 
101
101
  /**
102
+ * @template {object} T
103
+ * @typedef {Map<keyof T, ObjectParsedPropertyEntry<T>>} ParsedObjectStatic
104
+ */
105
+
106
+ /**
107
+ * @template {object} T
108
+ * @typedef {{ byProperty: string, fn: DynamicFunction }} ParsedObjectDynamic
109
+ */
110
+
111
+ /**
112
+ * @template {object} T
102
113
  * @typedef {object} ParsedObject
103
- * @property {Map<string, ObjectParsedPropertyEntry>} static static properties (key is property name)
104
- * @property {{ byProperty: string, fn: DynamicFunction } | undefined} dynamic dynamic part
114
+ * @property {ParsedObjectStatic<T>} static static properties (key is property name)
115
+ * @property {ParsedObjectDynamic<T> | undefined} dynamic dynamic part
105
116
  */
106
117
 
107
- /** @type {WeakMap<EXPECTED_OBJECT, ParsedObject>} */
118
+ /** @type {WeakMap<EXPECTED_OBJECT, ParsedObject<EXPECTED_ANY>>} */
108
119
  const parseCache = new WeakMap();
109
120
 
110
121
  /**
111
122
  * @template {object} T
112
123
  * @param {T} obj the object
113
- * @returns {ParsedObject} parsed object
124
+ * @returns {ParsedObject<T>} parsed object
114
125
  */
115
126
  const cachedParseObject = obj => {
116
127
  const entry = parseCache.get(/** @type {EXPECTED_OBJECT} */ (obj));
@@ -120,18 +131,21 @@ const cachedParseObject = obj => {
120
131
  return result;
121
132
  };
122
133
 
134
+ /** @typedef {{ [p: string]: { [p: string]: EXPECTED_ANY } } | DynamicFunction} ByObject */
135
+
123
136
  /**
124
137
  * @template {object} T
125
- * @template V
126
138
  * @param {T} obj the object
127
- * @returns {ParsedObject} parsed object
139
+ * @returns {ParsedObject<T>} parsed object
128
140
  */
129
141
  const parseObject = obj => {
142
+ /** @type {ParsedObjectStatic<T>} */
130
143
  const info = new Map();
144
+ /** @type {ParsedObjectDynamic<T> | undefined} */
131
145
  let dynamicInfo;
132
146
  /**
133
- * @param {string} p path
134
- * @returns {Partial<ObjectParsedPropertyEntry>} object parsed property entry
147
+ * @param {keyof T} p path
148
+ * @returns {Partial<ObjectParsedPropertyEntry<T>>} object parsed property entry
135
149
  */
136
150
  const getInfo = p => {
137
151
  const entry = info.get(p);
@@ -144,37 +158,35 @@ const parseObject = obj => {
144
158
  info.set(p, newEntry);
145
159
  return newEntry;
146
160
  };
147
- for (const key of Object.keys(obj)) {
148
- if (key.startsWith("by")) {
149
- const byProperty = /** @type {keyof T} */ (key);
150
- const byObj = /** @type {TODO} */ (obj[byProperty]);
161
+ for (const key_ of Object.keys(obj)) {
162
+ const key = /** @type {keyof T} */ (key_);
163
+ if (typeof key === "string" && key.startsWith("by")) {
164
+ const byProperty = key;
165
+ const byObj = /** @type {ByObject} */ (obj[byProperty]);
151
166
  if (typeof byObj === "object") {
152
167
  for (const byValue of Object.keys(byObj)) {
153
168
  const obj = byObj[/** @type {keyof (keyof T)} */ (byValue)];
154
169
  for (const key of Object.keys(obj)) {
155
- const entry = getInfo(key);
170
+ const entry = getInfo(/** @type {keyof T} */ (key));
156
171
  if (entry.byProperty === undefined) {
157
- entry.byProperty = /** @type {string} */ (byProperty);
172
+ entry.byProperty = byProperty;
158
173
  entry.byValues = new Map();
159
174
  } else if (entry.byProperty !== byProperty) {
160
175
  throw new Error(
161
176
  `${/** @type {string} */ (byProperty)} and ${entry.byProperty} for a single property is not supported`
162
177
  );
163
178
  }
164
- /** @type {ByValues<V>} */
165
- (entry.byValues).set(
166
- byValue,
167
- obj[/** @type {keyof (keyof T)} */ (key)]
168
- );
179
+ /** @type {ByValues} */
180
+ (entry.byValues).set(byValue, obj[key]);
169
181
  if (byValue === "default") {
170
182
  for (const otherByValue of Object.keys(byObj)) {
171
183
  if (
172
184
  !(
173
- /** @type {ByValues<V>} */
185
+ /** @type {ByValues} */
174
186
  (entry.byValues).has(otherByValue)
175
187
  )
176
188
  ) {
177
- /** @type {ByValues<V>} */
189
+ /** @type {ByValues} */
178
190
  (entry.byValues).set(otherByValue, undefined);
179
191
  }
180
192
  }
@@ -194,11 +206,11 @@ const parseObject = obj => {
194
206
  }
195
207
  } else {
196
208
  const entry = getInfo(key);
197
- entry.base = obj[/** @type {keyof T} */ (key)];
209
+ entry.base = obj[key];
198
210
  }
199
211
  } else {
200
212
  const entry = getInfo(key);
201
- entry.base = obj[/** @type {keyof T} */ (key)];
213
+ entry.base = obj[key];
202
214
  }
203
215
  }
204
216
  return {
@@ -209,8 +221,8 @@ const parseObject = obj => {
209
221
 
210
222
  /**
211
223
  * @template {object} T
212
- * @param {Map<string, ObjectParsedPropertyEntry>} info static properties (key is property name)
213
- * @param {{ byProperty: string, fn: (...args: EXPECTED_ANY[]) => T } | undefined} dynamicInfo dynamic part
224
+ * @param {ParsedObjectStatic<T>} info static properties (key is property name)
225
+ * @param {{ byProperty: string, fn: DynamicFunction } | undefined} dynamicInfo dynamic part
214
226
  * @returns {T} the object
215
227
  */
216
228
  const serializeObject = (info, dynamicInfo) => {
@@ -221,7 +233,7 @@ const serializeObject = (info, dynamicInfo) => {
221
233
  const byProperty = /** @type {keyof T} */ (entry.byProperty);
222
234
  const byObj = (obj[byProperty] =
223
235
  obj[byProperty] || /** @type {TODO} */ ({}));
224
- for (const byValue of entry.byValues.keys()) {
236
+ for (const byValue of /** @type {ByValues} */ (entry.byValues).keys()) {
225
237
  byObj[byValue] = byObj[byValue] || {};
226
238
  }
227
239
  }
@@ -236,7 +248,11 @@ const serializeObject = (info, dynamicInfo) => {
236
248
  const byObj = (obj[byProperty] =
237
249
  obj[byProperty] || /** @type {TODO} */ ({}));
238
250
  for (const byValue of Object.keys(byObj)) {
239
- const value = getFromByValues(entry.byValues, byValue);
251
+ const value = getFromByValues(
252
+ /** @type {ByValues} */
253
+ (entry.byValues),
254
+ byValue
255
+ );
240
256
  if (value !== undefined) byObj[byValue][key] = value;
241
257
  }
242
258
  }
@@ -317,7 +333,7 @@ const _cleverMerge = (first, second, internalCaching = false) => {
317
333
  const fnInfo = fn[DYNAMIC_INFO];
318
334
  if (fnInfo) {
319
335
  second =
320
- /** @type {TODO} */
336
+ /** @type {O} */
321
337
  (
322
338
  internalCaching
323
339
  ? cachedCleverMerge(fnInfo[1], second)
@@ -343,10 +359,12 @@ const _cleverMerge = (first, second, internalCaching = false) => {
343
359
  ? cachedParseObject(second)
344
360
  : parseObject(second);
345
361
  const { static: secondInfo, dynamic: secondDynamicInfo } = secondObject;
346
- /** @type {Map<string, ObjectParsedPropertyEntry>} */
347
362
  const resultInfo = new Map();
348
363
  for (const [key, firstEntry] of firstInfo) {
349
- const secondEntry = secondInfo.get(key);
364
+ const secondEntry = secondInfo.get(
365
+ /** @type {keyof (T | O)} */
366
+ (key)
367
+ );
350
368
  const entry =
351
369
  secondEntry !== undefined
352
370
  ? mergeEntries(firstEntry, secondEntry, internalCaching)
@@ -354,7 +372,7 @@ const _cleverMerge = (first, second, internalCaching = false) => {
354
372
  resultInfo.set(key, entry);
355
373
  }
356
374
  for (const [key, secondEntry] of secondInfo) {
357
- if (!firstInfo.has(key)) {
375
+ if (!firstInfo.has(/** @type {keyof (T | O)} */ (key))) {
358
376
  resultInfo.set(key, secondEntry);
359
377
  }
360
378
  }
@@ -362,10 +380,11 @@ const _cleverMerge = (first, second, internalCaching = false) => {
362
380
  };
363
381
 
364
382
  /**
365
- * @param {ObjectParsedPropertyEntry} firstEntry a
366
- * @param {ObjectParsedPropertyEntry} secondEntry b
383
+ * @template T, O
384
+ * @param {ObjectParsedPropertyEntry<T>} firstEntry a
385
+ * @param {ObjectParsedPropertyEntry<O>} secondEntry b
367
386
  * @param {boolean} internalCaching should parsing of objects and nested merges be cached
368
- * @returns {ObjectParsedPropertyEntry} new entry
387
+ * @returns {ObjectParsedPropertyEntry<TODO>} new entry
369
388
  */
370
389
  const mergeEntries = (firstEntry, secondEntry, internalCaching) => {
371
390
  switch (getValueType(secondEntry.base)) {
@@ -391,8 +410,14 @@ const mergeEntries = (firstEntry, secondEntry, internalCaching) => {
391
410
  // = first.base + (first.byProperty + second.byProperty)
392
411
  // need to merge first and second byValues
393
412
  const newByValues = new Map(firstEntry.byValues);
394
- for (const [key, value] of secondEntry.byValues) {
395
- const firstValue = getFromByValues(firstEntry.byValues, key);
413
+ for (const [key, value] of /** @type {ByValues} */ (
414
+ secondEntry.byValues
415
+ )) {
416
+ const firstValue = getFromByValues(
417
+ /** @type {ByValues} */
418
+ (firstEntry.byValues),
419
+ key
420
+ );
396
421
  newByValues.set(
397
422
  key,
398
423
  mergeSingleValue(firstValue, value, internalCaching)
@@ -409,11 +434,15 @@ const mergeEntries = (firstEntry, secondEntry, internalCaching) => {
409
434
  // The simple case
410
435
  // = (first.base + second.base) + second.byProperty
411
436
  return {
412
- base: mergeSingleValue(
413
- firstEntry.base,
414
- secondEntry.base,
415
- internalCaching
416
- ),
437
+ base:
438
+ /** @type {T[keyof T] & O[keyof O]} */
439
+ (
440
+ mergeSingleValue(
441
+ firstEntry.base,
442
+ secondEntry.base,
443
+ internalCaching
444
+ )
445
+ ),
417
446
  byProperty: secondEntry.byProperty,
418
447
  byValues: secondEntry.byValues
419
448
  };
@@ -427,10 +456,12 @@ const mergeEntries = (firstEntry, secondEntry, internalCaching) => {
427
456
  );
428
457
  }
429
458
  if (
430
- [...firstEntry.byValues.values()].every(value => {
431
- const type = getValueType(value);
432
- return type === VALUE_TYPE_ATOM || type === VALUE_TYPE_DELETE;
433
- })
459
+ [.../** @type {ByValues} */ (firstEntry.byValues).values()].every(
460
+ value => {
461
+ const type = getValueType(value);
462
+ return type === VALUE_TYPE_ATOM || type === VALUE_TYPE_DELETE;
463
+ }
464
+ )
434
465
  ) {
435
466
  // = (first.base + second.base) + ((first.byProperty + second.base) + second.byProperty)
436
467
  newBase = mergeSingleValue(
@@ -458,7 +489,9 @@ const mergeEntries = (firstEntry, secondEntry, internalCaching) => {
458
489
  );
459
490
  }
460
491
  const newByValues = new Map(intermediateByValues);
461
- for (const [key, value] of secondEntry.byValues) {
492
+ for (const [key, value] of /** @type {ByValues} */ (
493
+ secondEntry.byValues
494
+ )) {
462
495
  const firstValue = getFromByValues(intermediateByValues, key);
463
496
  newByValues.set(
464
497
  key,
@@ -476,7 +509,7 @@ const mergeEntries = (firstEntry, secondEntry, internalCaching) => {
476
509
 
477
510
  /**
478
511
  * @template V
479
- * @param {ByValues<V>} byValues all values
512
+ * @param {ByValues} byValues all values
480
513
  * @param {string} key value of the selector
481
514
  * @returns {V | undefined} value
482
515
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpack",
3
- "version": "5.100.0",
3
+ "version": "5.100.1",
4
4
  "description": "Packs ECMAScript/CommonJs/AMD modules for the browser. Allows you to split your codebase into multiple bundles, which can be loaded on demand. Supports loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.",
5
5
  "homepage": "https://github.com/webpack/webpack",
6
6
  "bugs": "https://github.com/webpack/webpack/issues",
@@ -118,7 +118,7 @@
118
118
  "@types/graceful-fs": "^4.1.9",
119
119
  "@types/jest": "^30.0.0",
120
120
  "@types/mime-types": "^2.1.4",
121
- "@types/node": "^24.0.3",
121
+ "@types/node": "^24.0.13",
122
122
  "@types/xxhashjs": "^0.2.4",
123
123
  "assemblyscript": "^0.28.2",
124
124
  "babel-loader": "^10.0.0",
@@ -179,10 +179,10 @@
179
179
  "strip-ansi": "^6.0.0",
180
180
  "style-loader": "^4.0.0",
181
181
  "terser": "^5.43.1",
182
- "three": "^0.177.0",
182
+ "three": "^0.178.0",
183
183
  "tinybench": "^4.0.1",
184
184
  "toml": "^3.0.0",
185
- "tooling": "webpack/tooling#v1.24.0",
185
+ "tooling": "webpack/tooling#v1.24.3",
186
186
  "ts-loader": "^9.5.1",
187
187
  "typescript": "^5.8.2",
188
188
  "url-loader": "^4.1.0",
package/types.d.ts CHANGED
@@ -252,21 +252,6 @@ declare interface ArgumentConfig {
252
252
  type: "string" | "number" | "boolean" | "path" | "enum" | "RegExp" | "reset";
253
253
  values?: EnumValue[];
254
254
  }
255
- type ArrayBufferLike = ArrayBuffer | SharedArrayBuffer;
256
- type ArrayBufferView<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> =
257
- | Uint8Array
258
- | Uint8ClampedArray
259
- | Uint16Array
260
- | Uint32Array
261
- | Int8Array
262
- | Int16Array
263
- | Int32Array
264
- | BigUint64Array
265
- | BigInt64Array
266
- | Float16Array
267
- | Float32Array
268
- | Float64Array
269
- | DataView;
270
255
  declare interface Asset {
271
256
  /**
272
257
  * the filename of the asset
@@ -4158,7 +4143,8 @@ declare class DynamicEntryPlugin {
4158
4143
  */
4159
4144
  apply(compiler: Compiler): void;
4160
4145
  }
4161
- declare interface Effect {
4146
+ type Effect = EffectUse | EffectBasic;
4147
+ declare interface EffectBasic {
4162
4148
  type: string;
4163
4149
  value: any;
4164
4150
  }
@@ -4176,6 +4162,15 @@ declare interface EffectData {
4176
4162
  issuer: string;
4177
4163
  issuerLayer: string;
4178
4164
  }
4165
+ declare interface EffectUse {
4166
+ type: EffectUseType;
4167
+ value: {
4168
+ loader: string;
4169
+ options?: null | string | Record<string, any>;
4170
+ ident?: string;
4171
+ };
4172
+ }
4173
+ type EffectUseType = "use" | "use-pre" | "use-post";
4179
4174
  declare class ElectronTargetPlugin {
4180
4175
  constructor(context?: "main" | "preload" | "renderer");
4181
4176
 
@@ -6346,7 +6341,7 @@ declare interface IntermediateFileSystemExtras {
6346
6341
  | WriteStreamOptions
6347
6342
  ) => NodeJS.WritableStream;
6348
6343
  open: Open;
6349
- read: Read<ArrayBufferView<ArrayBufferLike>>;
6344
+ read: Read<NodeJS.ArrayBufferView>;
6350
6345
  close: (
6351
6346
  df: number,
6352
6347
  callback: (err: null | NodeJS.ErrnoException) => void
@@ -12787,8 +12782,7 @@ declare interface RawSourceMap {
12787
12782
  ignoreList?: number[];
12788
12783
  }
12789
12784
  declare interface Read<
12790
- TBuffer extends
12791
- ArrayBufferView<ArrayBufferLike> = ArrayBufferView<ArrayBufferLike>
12785
+ TBuffer extends NodeJS.ArrayBufferView = NodeJS.ArrayBufferView
12792
12786
  > {
12793
12787
  (
12794
12788
  fd: number,
@@ -12816,13 +12810,11 @@ declare interface Read<
12816
12810
  callback: (
12817
12811
  err: null | NodeJS.ErrnoException,
12818
12812
  bytesRead: number,
12819
- buffer: ArrayBufferView<ArrayBufferLike>
12813
+ buffer: NodeJS.ArrayBufferView
12820
12814
  ) => void
12821
12815
  ): void;
12822
12816
  }
12823
- declare interface ReadAsyncOptions<
12824
- TBuffer extends ArrayBufferView<ArrayBufferLike>
12825
- > {
12817
+ declare interface ReadAsyncOptions<TBuffer extends NodeJS.ArrayBufferView> {
12826
12818
  offset?: number;
12827
12819
  length?: number;
12828
12820
  position?: null | number | bigint;
@@ -17320,41 +17312,13 @@ declare interface WithOptions {
17320
17312
  declare interface WriteFile {
17321
17313
  (
17322
17314
  file: PathOrFileDescriptorFs,
17323
- data:
17324
- | string
17325
- | Uint8Array
17326
- | Uint8ClampedArray
17327
- | Uint16Array
17328
- | Uint32Array
17329
- | Int8Array
17330
- | Int16Array
17331
- | Int32Array
17332
- | BigUint64Array
17333
- | BigInt64Array
17334
- | Float16Array
17335
- | Float32Array
17336
- | Float64Array
17337
- | DataView,
17315
+ data: string | NodeJS.ArrayBufferView,
17338
17316
  options: WriteFileOptions,
17339
17317
  callback: (err: null | NodeJS.ErrnoException) => void
17340
17318
  ): void;
17341
17319
  (
17342
17320
  file: PathOrFileDescriptorFs,
17343
- data:
17344
- | string
17345
- | Uint8Array
17346
- | Uint8ClampedArray
17347
- | Uint16Array
17348
- | Uint32Array
17349
- | Int8Array
17350
- | Int16Array
17351
- | Int32Array
17352
- | BigUint64Array
17353
- | BigInt64Array
17354
- | Float16Array
17355
- | Float32Array
17356
- | Float64Array
17357
- | DataView,
17321
+ data: string | NodeJS.ArrayBufferView,
17358
17322
  callback: (err: null | NodeJS.ErrnoException) => void
17359
17323
  ): void;
17360
17324
  }