webpack 5.99.6 → 5.99.7
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/AutomaticPrefetchPlugin.js +21 -22
- package/lib/BannerPlugin.js +31 -35
- package/lib/CleanPlugin.js +5 -3
- package/lib/Compilation.js +9 -8
- package/lib/Compiler.js +2 -1
- package/lib/ContextExclusionPlugin.js +4 -2
- package/lib/ContextReplacementPlugin.js +5 -3
- package/lib/DelegatedPlugin.js +4 -2
- package/lib/DllEntryPlugin.js +4 -2
- package/lib/DllPlugin.js +5 -3
- package/lib/DllReferencePlugin.js +56 -60
- package/lib/DynamicEntryPlugin.js +4 -2
- package/lib/EntryOptionPlugin.js +3 -1
- package/lib/EntryPlugin.js +4 -2
- package/lib/EnvironmentPlugin.js +4 -2
- package/lib/EvalDevToolModulePlugin.js +9 -7
- package/lib/EvalSourceMapDevToolPlugin.js +137 -138
- package/lib/ExternalsPlugin.js +3 -1
- package/lib/FlagDependencyExportsPlugin.js +2 -1
- package/lib/IgnorePlugin.js +6 -4
- package/lib/IgnoreWarningsPlugin.js +4 -2
- package/lib/LibManifestPlugin.js +3 -4
- package/lib/LoaderOptionsPlugin.js +4 -2
- package/lib/LoaderTargetPlugin.js +4 -2
- package/lib/Module.js +19 -12
- package/lib/ModuleInfoHeaderPlugin.js +11 -12
- package/lib/MultiCompiler.js +5 -3
- package/lib/NoEmitOnErrorsPlugin.js +5 -3
- package/lib/NormalModule.js +5 -1
- package/lib/NormalModuleReplacementPlugin.js +33 -36
- package/lib/PlatformPlugin.js +3 -1
- package/lib/PrefetchPlugin.js +4 -2
- package/lib/ProgressPlugin.js +23 -26
- package/lib/RecordIdsPlugin.js +72 -102
- package/lib/RuntimePlugin.js +34 -32
- package/lib/SourceMapDevToolPlugin.js +7 -5
- package/lib/WarnCaseSensitiveModulesPlugin.js +36 -37
- package/lib/WarnNoModeSetPlugin.js +3 -1
- package/lib/WatchIgnorePlugin.js +3 -1
- package/lib/WebpackError.js +11 -3
- package/lib/WebpackOptionsApply.js +5 -3
- package/lib/async-modules/InferAsyncModulesPlugin.js +25 -26
- package/lib/cache/IdleFileCachePlugin.js +11 -12
- package/lib/cache/MemoryWithGcCachePlugin.js +7 -5
- package/lib/cache/ResolverCachePlugin.js +8 -6
- package/lib/cli.js +5 -1
- package/lib/config/normalization.js +9 -3
- package/lib/container/ContainerReferencePlugin.js +24 -26
- package/lib/container/ModuleFederationPlugin.js +2 -1
- package/lib/css/CssGenerator.js +1 -1
- package/lib/css/CssModulesPlugin.js +6 -4
- package/lib/dependencies/HarmonyDetectionParserPlugin.js +9 -15
- package/lib/dependencies/HarmonyTopLevelThisParserPlugin.js +15 -15
- package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +4 -2
- package/lib/dependencies/LoaderPlugin.js +5 -3
- package/lib/dependencies/RequireContextDependencyParserPlugin.js +46 -46
- package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +94 -100
- package/lib/esm/ModuleChunkLoadingPlugin.js +72 -73
- package/lib/hmr/HotModuleReplacement.runtime.js +0 -1
- package/lib/hmr/JavascriptHotModuleReplacement.runtime.js +0 -1
- package/lib/hmr/LazyCompilationPlugin.js +17 -18
- package/lib/ids/ChunkModuleIdRangePlugin.js +6 -6
- package/lib/ids/DeterministicModuleIdsPlugin.js +47 -48
- package/lib/ids/HashedModuleIdsPlugin.js +4 -2
- package/lib/ids/NamedChunkIdsPlugin.js +4 -2
- package/lib/ids/NamedModuleIdsPlugin.js +4 -2
- package/lib/ids/NaturalChunkIdsPlugin.js +4 -2
- package/lib/ids/NaturalModuleIdsPlugin.js +4 -2
- package/lib/ids/OccurrenceChunkIdsPlugin.js +4 -2
- package/lib/ids/OccurrenceModuleIdsPlugin.js +4 -2
- package/lib/javascript/JavascriptParser.js +634 -656
- package/lib/library/ModuleLibraryPlugin.js +60 -42
- package/lib/node/CommonJsChunkLoadingPlugin.js +69 -73
- package/lib/node/NodeEnvironmentPlugin.js +3 -1
- package/lib/optimize/AggressiveSplittingPlugin.js +224 -232
- package/lib/optimize/ConcatenatedModule.js +12 -15
- package/lib/optimize/FlagIncludedChunksPlugin.js +92 -97
- package/lib/optimize/LimitChunkCountPlugin.js +4 -2
- package/lib/optimize/MangleExportsPlugin.js +15 -16
- package/lib/optimize/MinChunkSizePlugin.js +4 -2
- package/lib/optimize/ModuleConcatenationPlugin.js +4 -2
- package/lib/optimize/RealContentHashPlugin.js +4 -2
- package/lib/optimize/RemoveEmptyChunksPlugin.js +5 -3
- package/lib/optimize/RemoveParentModulesPlugin.js +4 -2
- package/lib/optimize/RuntimeChunkPlugin.js +17 -18
- package/lib/optimize/SplitChunksPlugin.js +7 -5
- package/lib/performance/SizeLimitsPlugin.js +3 -1
- package/lib/prefetch/ChunkPrefetchPreloadPlugin.js +61 -62
- package/lib/runtime/StartupChunkDependenciesPlugin.js +39 -42
- package/lib/schemes/DataUriPlugin.js +5 -3
- package/lib/schemes/FileUriPlugin.js +5 -3
- package/lib/schemes/HttpUriPlugin.js +32 -39
- package/lib/serialization/AggregateErrorSerializer.js +42 -0
- package/lib/serialization/ErrorObjectSerializer.js +7 -2
- package/lib/serialization/ObjectMiddleware.js +13 -0
- package/lib/sharing/ProvideSharedPlugin.js +6 -4
- package/lib/stats/DefaultStatsFactoryPlugin.js +89 -33
- package/lib/stats/DefaultStatsPresetPlugin.js +25 -20
- package/lib/stats/DefaultStatsPrinterPlugin.js +306 -341
- package/lib/util/concatenate.js +4 -2
- package/lib/wasm-sync/WasmFinalizeExportsPlugin.js +55 -57
- package/lib/web/JsonpChunkLoadingPlugin.js +73 -74
- package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +77 -78
- package/package.json +4 -3
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +24 -2
- package/types.d.ts +148 -55
@@ -307,6 +307,8 @@ const { makePathsRelative, parseResource } = require("../util/identifier");
|
|
307
307
|
* @property {StatsModuleTraceItem[]=} moduleTrace
|
308
308
|
* @property {string=} details
|
309
309
|
* @property {string=} stack
|
310
|
+
* @property {KnownStatsError=} cause
|
311
|
+
* @property {KnownStatsError[]=} errors
|
310
312
|
* @property {string=} compilerPath
|
311
313
|
*/
|
312
314
|
|
@@ -336,6 +338,7 @@ const { makePathsRelative, parseResource } = require("../util/identifier");
|
|
336
338
|
* @property {ExtractorsByOption<OriginRecord, StatsChunkOrigin>} chunkOrigin
|
337
339
|
* @property {ExtractorsByOption<WebpackError, StatsError>} error
|
338
340
|
* @property {ExtractorsByOption<WebpackError, StatsError>} warning
|
341
|
+
* @property {ExtractorsByOption<WebpackError, StatsError>} cause
|
339
342
|
* @property {ExtractorsByOption<ModuleTrace, StatsModuleTraceItem>} moduleTraceItem
|
340
343
|
* @property {ExtractorsByOption<Dependency, StatsModuleTraceDependency>} moduleTraceDependency
|
341
344
|
*/
|
@@ -405,47 +408,66 @@ const countWithChildren = (compilation, getItems) => {
|
|
405
408
|
return count;
|
406
409
|
};
|
407
410
|
|
408
|
-
/** @
|
411
|
+
/** @typedef {Error & { cause?: unknown }} ErrorWithCause */
|
412
|
+
/** @typedef {Error & { errors: EXPECTED_ANY[] }} AggregateError */
|
413
|
+
|
414
|
+
/** @type {ExtractorsByOption<string | ErrorWithCause | AggregateError | WebpackError, StatsError>} */
|
409
415
|
const EXTRACT_ERROR = {
|
410
416
|
_: (object, error, context, { requestShortener }) => {
|
411
417
|
// TODO webpack 6 disallow strings in the errors/warnings list
|
412
418
|
if (typeof error === "string") {
|
413
419
|
object.message = error;
|
414
420
|
} else {
|
415
|
-
if (error.chunk) {
|
421
|
+
if (/** @type {WebpackError} */ (error).chunk) {
|
422
|
+
const chunk = /** @type {WebpackError} */ (error).chunk;
|
416
423
|
object.chunkName =
|
417
424
|
/** @type {string | undefined} */
|
418
|
-
(
|
419
|
-
object.chunkEntry =
|
420
|
-
object.chunkInitial =
|
425
|
+
(chunk.name);
|
426
|
+
object.chunkEntry = chunk.hasRuntime();
|
427
|
+
object.chunkInitial = chunk.canBeInitial();
|
421
428
|
}
|
422
|
-
|
423
|
-
|
429
|
+
|
430
|
+
if (/** @type {WebpackError} */ (error).file) {
|
431
|
+
object.file = /** @type {WebpackError} */ (error).file;
|
424
432
|
}
|
425
|
-
|
426
|
-
|
427
|
-
object.
|
433
|
+
|
434
|
+
if (/** @type {WebpackError} */ (error).module) {
|
435
|
+
object.moduleIdentifier =
|
436
|
+
/** @type {WebpackError} */
|
437
|
+
(error).module.identifier();
|
438
|
+
object.moduleName =
|
439
|
+
/** @type {WebpackError} */
|
440
|
+
(error).module.readableIdentifier(requestShortener);
|
428
441
|
}
|
429
|
-
|
430
|
-
|
442
|
+
|
443
|
+
if (/** @type {WebpackError} */ (error).loc) {
|
444
|
+
object.loc = formatLocation(/** @type {WebpackError} */ (error).loc);
|
431
445
|
}
|
446
|
+
|
432
447
|
object.message = error.message;
|
433
448
|
}
|
434
449
|
},
|
435
450
|
ids: (object, error, { compilation: { chunkGraph } }) => {
|
436
451
|
if (typeof error !== "string") {
|
437
|
-
if (error.chunk) {
|
438
|
-
object.chunkId = /** @type {ChunkId} */ (
|
452
|
+
if (/** @type {WebpackError} */ (error).chunk) {
|
453
|
+
object.chunkId = /** @type {ChunkId} */ (
|
454
|
+
/** @type {WebpackError} */
|
455
|
+
(error).chunk.id
|
456
|
+
);
|
439
457
|
}
|
440
|
-
|
458
|
+
|
459
|
+
if (/** @type {WebpackError} */ (error).module) {
|
441
460
|
object.moduleId =
|
442
461
|
/** @type {ModuleId} */
|
443
|
-
(chunkGraph.getModuleId(error.module));
|
462
|
+
(chunkGraph.getModuleId(/** @type {WebpackError} */ (error).module));
|
444
463
|
}
|
445
464
|
}
|
446
465
|
},
|
447
466
|
moduleTrace: (object, error, context, options, factory) => {
|
448
|
-
if (
|
467
|
+
if (
|
468
|
+
typeof error !== "string" &&
|
469
|
+
/** @type {WebpackError} */ (error).module
|
470
|
+
) {
|
449
471
|
const {
|
450
472
|
type,
|
451
473
|
compilation: { moduleGraph }
|
@@ -454,7 +476,7 @@ const EXTRACT_ERROR = {
|
|
454
476
|
const visitedModules = new Set();
|
455
477
|
/** @type {ModuleTrace[]} */
|
456
478
|
const moduleTrace = [];
|
457
|
-
let current = error.module;
|
479
|
+
let current = /** @type {WebpackError} */ (error).module;
|
458
480
|
while (current) {
|
459
481
|
if (visitedModules.has(current)) break; // circular (technically impossible, but how knows)
|
460
482
|
visitedModules.add(current);
|
@@ -481,13 +503,44 @@ const EXTRACT_ERROR = {
|
|
481
503
|
(errorDetails === true ||
|
482
504
|
(type.endsWith(".error") && cachedGetErrors(compilation).length < 3))
|
483
505
|
) {
|
484
|
-
object.details = error.details;
|
506
|
+
object.details = /** @type {WebpackError} */ (error).details;
|
485
507
|
}
|
486
508
|
},
|
487
509
|
errorStack: (object, error) => {
|
488
510
|
if (typeof error !== "string") {
|
489
511
|
object.stack = error.stack;
|
490
512
|
}
|
513
|
+
},
|
514
|
+
errorCause: (object, error, context, options, factory) => {
|
515
|
+
if (
|
516
|
+
typeof error !== "string" &&
|
517
|
+
/** @type {ErrorWithCause} */ (error).cause
|
518
|
+
) {
|
519
|
+
const rawCause = /** @type {ErrorWithCause} */ (error).cause;
|
520
|
+
/** @type {Error} */
|
521
|
+
const cause =
|
522
|
+
typeof rawCause === "string"
|
523
|
+
? /** @type {Error} */ ({ message: rawCause })
|
524
|
+
: /** @type {Error} */ (rawCause);
|
525
|
+
const { type } = context;
|
526
|
+
|
527
|
+
object.cause = factory.create(`${type}.cause`, cause, context);
|
528
|
+
}
|
529
|
+
},
|
530
|
+
errorErrors: (object, error, context, options, factory) => {
|
531
|
+
if (
|
532
|
+
typeof error !== "string" &&
|
533
|
+
/** @type {AggregateError} */
|
534
|
+
(error).errors
|
535
|
+
) {
|
536
|
+
const { type } = context;
|
537
|
+
object.errors = factory.create(
|
538
|
+
`${type}.errors`,
|
539
|
+
/** @type {Error[]} */
|
540
|
+
(/** @type {AggregateError} */ (error).errors),
|
541
|
+
context
|
542
|
+
);
|
543
|
+
}
|
491
544
|
}
|
492
545
|
};
|
493
546
|
|
@@ -1560,6 +1613,7 @@ const SIMPLE_EXTRACTORS = {
|
|
1560
1613
|
},
|
1561
1614
|
error: EXTRACT_ERROR,
|
1562
1615
|
warning: EXTRACT_ERROR,
|
1616
|
+
cause: EXTRACT_ERROR,
|
1563
1617
|
moduleTraceItem: {
|
1564
1618
|
_: (object, { origin, module }, context, { requestShortener }, factory) => {
|
1565
1619
|
const {
|
@@ -2474,6 +2528,8 @@ const ITEM_NAMES = {
|
|
2474
2528
|
"compilation.namedChunkGroups[]": "chunkGroup",
|
2475
2529
|
"compilation.errors[]": "error",
|
2476
2530
|
"compilation.warnings[]": "warning",
|
2531
|
+
"error.errors[]": "error",
|
2532
|
+
"warning.errors[]": "error",
|
2477
2533
|
"chunk.modules[]": "module",
|
2478
2534
|
"chunk.rootModules[]": "module",
|
2479
2535
|
"chunk.origins[]": "chunkOrigin",
|
@@ -2515,6 +2571,8 @@ const MERGER = {
|
|
2515
2571
|
"compilation.namedChunkGroups": mergeToObject
|
2516
2572
|
};
|
2517
2573
|
|
2574
|
+
const PLUGIN_NAME = "DefaultStatsFactoryPlugin";
|
2575
|
+
|
2518
2576
|
class DefaultStatsFactoryPlugin {
|
2519
2577
|
/**
|
2520
2578
|
* Apply the plugin
|
@@ -2522,9 +2580,9 @@ class DefaultStatsFactoryPlugin {
|
|
2522
2580
|
* @returns {void}
|
2523
2581
|
*/
|
2524
2582
|
apply(compiler) {
|
2525
|
-
compiler.hooks.compilation.tap(
|
2583
|
+
compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
|
2526
2584
|
compilation.hooks.statsFactory.tap(
|
2527
|
-
|
2585
|
+
PLUGIN_NAME,
|
2528
2586
|
/**
|
2529
2587
|
* @param {StatsFactory} stats stats factory
|
2530
2588
|
* @param {NormalizedStatsOptions} options stats options
|
@@ -2537,7 +2595,7 @@ class DefaultStatsFactoryPlugin {
|
|
2537
2595
|
(hookFor, fn) => {
|
2538
2596
|
stats.hooks.extract
|
2539
2597
|
.for(hookFor)
|
2540
|
-
.tap(
|
2598
|
+
.tap(PLUGIN_NAME, (obj, data, ctx) =>
|
2541
2599
|
fn(obj, data, ctx, options, stats)
|
2542
2600
|
);
|
2543
2601
|
}
|
@@ -2545,28 +2603,28 @@ class DefaultStatsFactoryPlugin {
|
|
2545
2603
|
iterateConfig(FILTER, options, (hookFor, fn) => {
|
2546
2604
|
stats.hooks.filter
|
2547
2605
|
.for(hookFor)
|
2548
|
-
.tap(
|
2606
|
+
.tap(PLUGIN_NAME, (item, ctx, idx, i) =>
|
2549
2607
|
fn(item, ctx, options, idx, i)
|
2550
2608
|
);
|
2551
2609
|
});
|
2552
2610
|
iterateConfig(FILTER_RESULTS, options, (hookFor, fn) => {
|
2553
2611
|
stats.hooks.filterResults
|
2554
2612
|
.for(hookFor)
|
2555
|
-
.tap(
|
2613
|
+
.tap(PLUGIN_NAME, (item, ctx, idx, i) =>
|
2556
2614
|
fn(item, ctx, options, idx, i)
|
2557
2615
|
);
|
2558
2616
|
});
|
2559
2617
|
iterateConfig(SORTERS, options, (hookFor, fn) => {
|
2560
2618
|
stats.hooks.sort
|
2561
2619
|
.for(hookFor)
|
2562
|
-
.tap(
|
2620
|
+
.tap(PLUGIN_NAME, (comparators, ctx) =>
|
2563
2621
|
fn(comparators, ctx, options)
|
2564
2622
|
);
|
2565
2623
|
});
|
2566
2624
|
iterateConfig(RESULT_SORTERS, options, (hookFor, fn) => {
|
2567
2625
|
stats.hooks.sortResults
|
2568
2626
|
.for(hookFor)
|
2569
|
-
.tap(
|
2627
|
+
.tap(PLUGIN_NAME, (comparators, ctx) =>
|
2570
2628
|
fn(comparators, ctx, options)
|
2571
2629
|
);
|
2572
2630
|
});
|
@@ -2577,27 +2635,25 @@ class DefaultStatsFactoryPlugin {
|
|
2577
2635
|
(hookFor, fn) => {
|
2578
2636
|
stats.hooks.groupResults
|
2579
2637
|
.for(hookFor)
|
2580
|
-
.tap(
|
2638
|
+
.tap(PLUGIN_NAME, (groupConfigs, ctx) =>
|
2581
2639
|
fn(groupConfigs, ctx, options)
|
2582
2640
|
);
|
2583
2641
|
}
|
2584
2642
|
);
|
2585
2643
|
for (const key of Object.keys(ITEM_NAMES)) {
|
2586
2644
|
const itemName = ITEM_NAMES[key];
|
2587
|
-
stats.hooks.getItemName
|
2588
|
-
.for(key)
|
2589
|
-
.tap("DefaultStatsFactoryPlugin", () => itemName);
|
2645
|
+
stats.hooks.getItemName.for(key).tap(PLUGIN_NAME, () => itemName);
|
2590
2646
|
}
|
2591
2647
|
for (const key of Object.keys(MERGER)) {
|
2592
2648
|
const merger = MERGER[key];
|
2593
|
-
stats.hooks.merge.for(key).tap(
|
2649
|
+
stats.hooks.merge.for(key).tap(PLUGIN_NAME, merger);
|
2594
2650
|
}
|
2595
2651
|
if (options.children) {
|
2596
2652
|
if (Array.isArray(options.children)) {
|
2597
2653
|
stats.hooks.getItemFactory
|
2598
2654
|
.for("compilation.children[].compilation")
|
2599
2655
|
.tap(
|
2600
|
-
|
2656
|
+
PLUGIN_NAME,
|
2601
2657
|
/**
|
2602
2658
|
* @param {Compilation} comp compilation
|
2603
2659
|
* @param {StatsFactoryContext} options options
|
@@ -2620,7 +2676,7 @@ class DefaultStatsFactoryPlugin {
|
|
2620
2676
|
);
|
2621
2677
|
stats.hooks.getItemFactory
|
2622
2678
|
.for("compilation.children[].compilation")
|
2623
|
-
.tap(
|
2679
|
+
.tap(PLUGIN_NAME, () => childFactory);
|
2624
2680
|
}
|
2625
2681
|
}
|
2626
2682
|
}
|
@@ -55,6 +55,8 @@ const NAMED_PRESETS = {
|
|
55
55
|
optimizationBailout: true,
|
56
56
|
errorDetails: true,
|
57
57
|
errorStack: true,
|
58
|
+
errorCause: true,
|
59
|
+
errorErrors: true,
|
58
60
|
publicPath: true,
|
59
61
|
logging: "verbose",
|
60
62
|
orphanModules: true,
|
@@ -84,6 +86,8 @@ const NAMED_PRESETS = {
|
|
84
86
|
providedExports: true,
|
85
87
|
optimizationBailout: true,
|
86
88
|
errorDetails: true,
|
89
|
+
errorCause: true,
|
90
|
+
errorErrors: true,
|
87
91
|
publicPath: true,
|
88
92
|
logging: true,
|
89
93
|
runtimeModules: true,
|
@@ -260,6 +264,8 @@ const DEFAULTS = {
|
|
260
264
|
errorsCount: NORMAL_ON,
|
261
265
|
errorDetails: AUTO_FOR_TO_STRING,
|
262
266
|
errorStack: OFF_FOR_TO_STRING,
|
267
|
+
errorCause: AUTO_FOR_TO_STRING,
|
268
|
+
errorErrors: AUTO_FOR_TO_STRING,
|
263
269
|
warnings: NORMAL_ON,
|
264
270
|
warningsCount: NORMAL_ON,
|
265
271
|
publicPath: OFF_FOR_TO_STRING,
|
@@ -364,6 +370,8 @@ const NORMALIZER = {
|
|
364
370
|
}
|
365
371
|
};
|
366
372
|
|
373
|
+
const PLUGIN_NAME = "DefaultStatsPresetPlugin";
|
374
|
+
|
367
375
|
class DefaultStatsPresetPlugin {
|
368
376
|
/**
|
369
377
|
* Apply the plugin
|
@@ -371,35 +379,32 @@ class DefaultStatsPresetPlugin {
|
|
371
379
|
* @returns {void}
|
372
380
|
*/
|
373
381
|
apply(compiler) {
|
374
|
-
compiler.hooks.compilation.tap(
|
382
|
+
compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
|
375
383
|
for (const key of Object.keys(NAMED_PRESETS)) {
|
376
384
|
const defaults = NAMED_PRESETS[/** @type {keyof NamedPresets} */ (key)];
|
377
385
|
compilation.hooks.statsPreset
|
378
386
|
.for(key)
|
379
|
-
.tap(
|
387
|
+
.tap(PLUGIN_NAME, (options, context) => {
|
380
388
|
applyDefaults(options, defaults);
|
381
389
|
});
|
382
390
|
}
|
383
|
-
compilation.hooks.statsNormalize.tap(
|
384
|
-
|
385
|
-
|
386
|
-
for (const key of Object.keys(DEFAULTS)) {
|
387
|
-
if (options[key] === undefined)
|
388
|
-
options[key] =
|
389
|
-
/** @type {Defaults[DefaultsKeys]} */
|
390
|
-
(DEFAULTS[/** @type {DefaultsKeys} */ (key)])(
|
391
|
-
options,
|
392
|
-
context,
|
393
|
-
compilation
|
394
|
-
);
|
395
|
-
}
|
396
|
-
for (const key of Object.keys(NORMALIZER)) {
|
391
|
+
compilation.hooks.statsNormalize.tap(PLUGIN_NAME, (options, context) => {
|
392
|
+
for (const key of Object.keys(DEFAULTS)) {
|
393
|
+
if (options[key] === undefined)
|
397
394
|
options[key] =
|
398
|
-
/** @type {
|
399
|
-
(
|
400
|
-
|
395
|
+
/** @type {Defaults[DefaultsKeys]} */
|
396
|
+
(DEFAULTS[/** @type {DefaultsKeys} */ (key)])(
|
397
|
+
options,
|
398
|
+
context,
|
399
|
+
compilation
|
400
|
+
);
|
401
|
+
}
|
402
|
+
for (const key of Object.keys(NORMALIZER)) {
|
403
|
+
options[key] =
|
404
|
+
/** @type {TODO} */
|
405
|
+
(NORMALIZER[/** @type {NormalizerKeys} */ (key)])(options[key]);
|
401
406
|
}
|
402
|
-
);
|
407
|
+
});
|
403
408
|
});
|
404
409
|
}
|
405
410
|
}
|