webpack 5.100.2 → 5.101.0
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/README.md +12 -10
- package/bin/webpack.js +7 -7
- package/lib/APIPlugin.js +12 -14
- package/lib/AutomaticPrefetchPlugin.js +2 -2
- package/lib/BannerPlugin.js +4 -4
- package/lib/Cache.js +1 -1
- package/lib/CacheFacade.js +7 -7
- package/lib/CaseSensitiveModulesWarning.js +2 -2
- package/lib/Chunk.js +3 -3
- package/lib/ChunkGraph.js +21 -18
- package/lib/ChunkGroup.js +4 -4
- package/lib/CleanPlugin.js +19 -53
- package/lib/CodeGenerationResults.js +3 -3
- package/lib/CompatibilityPlugin.js +6 -6
- package/lib/Compilation.js +126 -113
- package/lib/Compiler.js +37 -37
- package/lib/ConcatenationScope.js +39 -1
- package/lib/ConstPlugin.js +11 -11
- package/lib/ContextExclusionPlugin.js +3 -3
- package/lib/ContextModule.js +12 -11
- package/lib/ContextModuleFactory.js +11 -11
- package/lib/ContextReplacementPlugin.js +5 -5
- package/lib/DefinePlugin.js +24 -22
- package/lib/DelegatedModuleFactoryPlugin.js +1 -1
- package/lib/DllEntryPlugin.js +1 -1
- package/lib/DllReferencePlugin.js +1 -1
- package/lib/DynamicEntryPlugin.js +3 -3
- package/lib/EntryPlugin.js +1 -1
- package/lib/EnvironmentPlugin.js +1 -1
- package/lib/ErrorHelpers.js +2 -2
- package/lib/EvalDevToolModulePlugin.js +2 -2
- package/lib/EvalSourceMapDevToolPlugin.js +5 -5
- package/lib/ExportsInfo.js +9 -9
- package/lib/ExportsInfoApiPlugin.js +2 -2
- package/lib/ExternalModule.js +163 -48
- package/lib/ExternalModuleFactoryPlugin.js +2 -2
- package/lib/ExternalsPlugin.js +45 -0
- package/lib/FileSystemInfo.js +64 -61
- package/lib/FlagAllModulesAsUsedPlugin.js +2 -2
- package/lib/FlagDependencyExportsPlugin.js +7 -7
- package/lib/FlagDependencyUsagePlugin.js +4 -4
- package/lib/FlagEntryExportAsUsedPlugin.js +1 -1
- package/lib/HotModuleReplacementPlugin.js +27 -27
- package/lib/IgnorePlugin.js +3 -3
- package/lib/IgnoreWarningsPlugin.js +4 -4
- package/lib/InitFragment.js +6 -0
- package/lib/InvalidDependenciesModuleWarning.js +1 -1
- package/lib/JavascriptMetaInfoPlugin.js +1 -1
- package/lib/LibManifestPlugin.js +2 -2
- package/lib/LoaderOptionsPlugin.js +1 -1
- package/lib/LoaderTargetPlugin.js +2 -2
- package/lib/MainTemplate.js +1 -1
- package/lib/Module.js +1 -1
- package/lib/ModuleFilenameHelpers.js +3 -3
- package/lib/ModuleGraph.js +9 -5
- package/lib/ModuleInfoHeaderPlugin.js +3 -3
- package/lib/ModuleParseError.js +5 -3
- package/lib/MultiCompiler.js +29 -24
- package/lib/MultiStats.js +18 -13
- package/lib/MultiWatching.js +1 -1
- package/lib/NoEmitOnErrorsPlugin.js +2 -2
- package/lib/NodeStuffPlugin.js +27 -15
- package/lib/NormalModule.js +23 -23
- package/lib/NormalModuleFactory.js +23 -21
- package/lib/NormalModuleReplacementPlugin.js +3 -3
- package/lib/PrefetchPlugin.js +1 -1
- package/lib/ProgressPlugin.js +11 -11
- package/lib/ProvidePlugin.js +2 -2
- package/lib/RecordIdsPlugin.js +3 -3
- package/lib/ResolverFactory.js +3 -3
- package/lib/RuntimeGlobals.js +20 -0
- package/lib/RuntimePlugin.js +16 -16
- package/lib/RuntimeTemplate.js +35 -26
- package/lib/SizeFormatHelpers.js +1 -1
- package/lib/SourceMapDevToolModuleOptionsPlugin.js +4 -4
- package/lib/SourceMapDevToolPlugin.js +9 -9
- package/lib/Stats.js +2 -2
- package/lib/Template.js +1 -1
- package/lib/TemplatedPathPlugin.js +2 -2
- package/lib/UseStrictPlugin.js +1 -1
- package/lib/WarnCaseSensitiveModulesPlugin.js +1 -1
- package/lib/WarnDeprecatedOptionPlugin.js +1 -1
- package/lib/WarnNoModeSetPlugin.js +1 -1
- package/lib/WatchIgnorePlugin.js +2 -2
- package/lib/Watching.js +12 -12
- package/lib/WebpackIsIncludedPlugin.js +2 -2
- package/lib/WebpackOptionsApply.js +3 -3
- package/lib/asset/AssetGenerator.js +1 -1
- package/lib/asset/AssetModulesPlugin.js +6 -6
- package/lib/async-modules/AsyncModuleHelpers.js +1 -1
- package/lib/async-modules/AwaitDependenciesInitFragment.js +36 -24
- package/lib/async-modules/InferAsyncModulesPlugin.js +3 -3
- package/lib/buildChunkGraph.js +5 -5
- package/lib/cache/AddBuildDependenciesPlugin.js +1 -1
- package/lib/cache/IdleFileCachePlugin.js +5 -5
- package/lib/cache/PackFileCacheStrategy.js +20 -20
- package/lib/cache/ResolverCachePlugin.js +4 -4
- package/lib/cli.js +196 -14
- package/lib/config/browserslistTargetHandler.js +6 -6
- package/lib/config/defaults.js +23 -14
- package/lib/config/normalization.js +41 -38
- package/lib/config/target.js +4 -4
- package/lib/container/ContainerEntryModule.js +3 -3
- package/lib/container/ContainerPlugin.js +3 -3
- package/lib/container/ContainerReferencePlugin.js +3 -3
- package/lib/container/FallbackModule.js +1 -1
- package/lib/container/HoistContainerReferencesPlugin.js +7 -7
- package/lib/container/options.js +4 -4
- package/lib/css/CssGenerator.js +5 -3
- package/lib/css/CssLoadingRuntimeModule.js +1 -1
- package/lib/css/CssModulesPlugin.js +25 -22
- package/lib/css/CssParser.js +5 -5
- package/lib/css/walkCssTokens.js +9 -9
- package/lib/debug/ProfilingPlugin.js +5 -5
- package/lib/dependencies/AMDDefineDependencyParserPlugin.js +4 -4
- package/lib/dependencies/AMDPlugin.js +3 -3
- package/lib/dependencies/AMDRequireArrayDependency.js +1 -1
- package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +3 -3
- package/lib/dependencies/CommonJsExportRequireDependency.js +2 -2
- package/lib/dependencies/CommonJsExportsParserPlugin.js +12 -10
- package/lib/dependencies/CommonJsImportsParserPlugin.js +21 -19
- package/lib/dependencies/CommonJsPlugin.js +2 -2
- package/lib/dependencies/ContextDependency.js +1 -1
- package/lib/dependencies/ContextDependencyHelpers.js +3 -3
- package/lib/dependencies/CssIcssExportDependency.js +2 -2
- package/lib/dependencies/CssLocalIdentifierDependency.js +2 -2
- package/lib/dependencies/CssUrlDependency.js +4 -4
- package/lib/dependencies/DynamicExports.js +5 -5
- package/lib/dependencies/HarmonyAcceptDependency.js +39 -5
- package/lib/dependencies/HarmonyDetectionParserPlugin.js +2 -2
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +17 -13
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +7 -8
- package/lib/dependencies/HarmonyExportInitFragment.js +1 -1
- package/lib/dependencies/HarmonyExports.js +1 -1
- package/lib/dependencies/HarmonyImportDependency.js +28 -9
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +56 -48
- package/lib/dependencies/HarmonyImportSideEffectDependency.js +4 -5
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +3 -4
- package/lib/dependencies/HarmonyModulesPlugin.js +2 -8
- package/lib/dependencies/HarmonyTopLevelThisParserPlugin.js +1 -1
- package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +4 -4
- package/lib/dependencies/ImportMetaPlugin.js +7 -7
- package/lib/dependencies/ImportParserPlugin.js +4 -4
- package/lib/dependencies/JsonExportsDependency.js +1 -1
- package/lib/dependencies/LoaderPlugin.js +4 -4
- package/lib/dependencies/ProvidedDependency.js +2 -2
- package/lib/dependencies/PureExpressionDependency.js +1 -1
- package/lib/dependencies/RequireContextDependencyParserPlugin.js +1 -1
- package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +1 -1
- package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +3 -3
- package/lib/dependencies/SystemPlugin.js +3 -3
- package/lib/dependencies/WorkerPlugin.js +5 -5
- package/lib/dependencies/getFunctionExpression.js +1 -1
- package/lib/esm/ModuleChunkFormatPlugin.js +5 -5
- package/lib/esm/ModuleChunkLoadingPlugin.js +2 -2
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +15 -11
- package/lib/formatLocation.js +2 -2
- package/lib/hmr/HotModuleReplacement.runtime.js +39 -27
- package/lib/hmr/JavascriptHotModuleReplacement.runtime.js +43 -32
- package/lib/hmr/JavascriptHotModuleReplacementHelper.js +1 -1
- package/lib/hmr/LazyCompilationPlugin.js +6 -6
- package/lib/hmr/lazyCompilationBackend.js +6 -6
- package/lib/ids/ChunkModuleIdRangePlugin.js +4 -4
- package/lib/ids/DeterministicChunkIdsPlugin.js +5 -4
- package/lib/ids/DeterministicModuleIdsPlugin.js +2 -2
- package/lib/ids/HashedModuleIdsPlugin.js +1 -1
- package/lib/ids/IdHelpers.js +9 -9
- package/lib/ids/NamedChunkIdsPlugin.js +5 -5
- package/lib/ids/NamedModuleIdsPlugin.js +2 -2
- package/lib/ids/NaturalChunkIdsPlugin.js +2 -2
- package/lib/ids/NaturalModuleIdsPlugin.js +1 -1
- package/lib/ids/OccurrenceChunkIdsPlugin.js +2 -2
- package/lib/ids/OccurrenceModuleIdsPlugin.js +4 -4
- package/lib/ids/SyncModuleIdsPlugin.js +4 -4
- package/lib/index.js +10 -6
- package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +1 -1
- package/lib/javascript/BasicEvaluatedExpression.js +3 -3
- package/lib/javascript/CommonJsChunkFormatPlugin.js +1 -1
- package/lib/javascript/EnableChunkLoadingPlugin.js +1 -1
- package/lib/javascript/JavascriptGenerator.js +1 -1
- package/lib/javascript/JavascriptModulesPlugin.js +16 -16
- package/lib/javascript/JavascriptParser.js +80 -78
- package/lib/javascript/JavascriptParserHelpers.js +3 -3
- package/lib/javascript/StartupHelpers.js +2 -2
- package/lib/json/JsonGenerator.js +2 -2
- package/lib/json/JsonModulesPlugin.js +2 -2
- package/lib/library/AbstractLibraryPlugin.js +3 -3
- package/lib/library/AmdLibraryPlugin.js +3 -3
- package/lib/library/AssignLibraryPlugin.js +2 -2
- package/lib/library/EnableLibraryPlugin.js +2 -2
- package/lib/library/ModuleLibraryPlugin.js +7 -2
- package/lib/library/SystemLibraryPlugin.js +6 -4
- package/lib/library/UmdLibraryPlugin.js +14 -14
- package/lib/logging/createConsoleLogger.js +4 -4
- package/lib/logging/runtime.js +3 -3
- package/lib/logging/truncateArgs.js +4 -4
- package/lib/node/CommonJsChunkLoadingPlugin.js +2 -2
- package/lib/node/NodeEnvironmentPlugin.js +1 -1
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +16 -14
- package/lib/node/ReadFileCompileAsyncWasmPlugin.js +7 -7
- package/lib/node/ReadFileCompileWasmPlugin.js +7 -7
- package/lib/node/RequireChunkLoadingRuntimeModule.js +6 -4
- package/lib/node/nodeConsole.js +2 -2
- package/lib/optimize/AggressiveMergingPlugin.js +2 -2
- package/lib/optimize/AggressiveSplittingPlugin.js +10 -10
- package/lib/optimize/ConcatenatedModule.js +161 -52
- package/lib/optimize/EnsureChunkConditionsPlugin.js +2 -2
- package/lib/optimize/FlagIncludedChunksPlugin.js +2 -2
- package/lib/optimize/InnerGraph.js +5 -5
- package/lib/optimize/InnerGraphPlugin.js +14 -12
- package/lib/optimize/LimitChunkCountPlugin.js +5 -5
- package/lib/optimize/MangleExportsPlugin.js +5 -5
- package/lib/optimize/MergeDuplicateChunksPlugin.js +2 -2
- package/lib/optimize/MinChunkSizePlugin.js +3 -3
- package/lib/optimize/ModuleConcatenationPlugin.js +45 -38
- package/lib/optimize/RealContentHashPlugin.js +23 -23
- package/lib/optimize/RemoveEmptyChunksPlugin.js +2 -2
- package/lib/optimize/RemoveParentModulesPlugin.js +3 -3
- package/lib/optimize/RuntimeChunkPlugin.js +2 -2
- package/lib/optimize/SideEffectsFlagPlugin.js +5 -5
- package/lib/optimize/SplitChunksPlugin.js +20 -20
- package/lib/performance/AssetsOverSizeLimitWarning.js +1 -1
- package/lib/performance/EntrypointsOverSizeLimitWarning.js +2 -2
- package/lib/performance/SizeLimitsPlugin.js +4 -4
- package/lib/prefetch/ChunkPrefetchPreloadPlugin.js +1 -1
- package/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js +3 -3
- package/lib/rules/BasicMatcherRulePlugin.js +1 -1
- package/lib/rules/RuleSetCompiler.js +10 -10
- package/lib/rules/UseEffectRulePlugin.js +2 -2
- package/lib/runtime/GetChunkFilenameRuntimeModule.js +15 -15
- package/lib/runtime/GetMainFilenameRuntimeModule.js +1 -1
- package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +1 -1
- package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +1 -1
- package/lib/runtime/StartupChunkDependenciesPlugin.js +2 -2
- package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +3 -3
- package/lib/schemes/DataUriPlugin.js +3 -3
- package/lib/schemes/FileUriPlugin.js +1 -1
- package/lib/schemes/HttpUriPlugin.js +40 -36
- package/lib/schemes/VirtualUrlPlugin.js +1 -1
- package/lib/serialization/BinaryMiddleware.js +11 -11
- package/lib/serialization/FileMiddleware.js +17 -17
- package/lib/serialization/ObjectMiddleware.js +8 -8
- package/lib/serialization/Serializer.js +2 -2
- package/lib/serialization/SerializerMiddleware.js +2 -2
- package/lib/sharing/ConsumeSharedPlugin.js +4 -4
- package/lib/sharing/ProvideSharedPlugin.js +4 -4
- package/lib/sharing/SharePlugin.js +1 -1
- package/lib/sharing/resolveMatchedConfigs.js +1 -1
- package/lib/stats/DefaultStatsFactoryPlugin.js +85 -80
- package/lib/stats/DefaultStatsPresetPlugin.js +15 -15
- package/lib/stats/DefaultStatsPrinterPlugin.js +87 -87
- package/lib/stats/StatsFactory.js +7 -7
- package/lib/stats/StatsPrinter.js +9 -9
- package/lib/url/URLParserPlugin.js +5 -5
- package/lib/util/AsyncQueue.js +4 -4
- package/lib/util/IterableHelpers.js +2 -2
- package/lib/util/LazyBucketSortedSet.js +3 -3
- package/lib/util/SetHelpers.js +2 -2
- package/lib/util/StackedCacheMap.js +1 -1
- package/lib/util/StackedMap.js +1 -1
- package/lib/util/TupleSet.js +1 -1
- package/lib/util/WeakTupleMap.js +1 -1
- package/lib/util/cleverMerge.js +8 -8
- package/lib/util/comparators.js +10 -10
- package/lib/util/compileBooleanMatcher.js +20 -20
- package/lib/util/concatenate.js +3 -3
- package/lib/util/conventions.js +4 -4
- package/lib/util/create-schema-validation.js +1 -1
- package/lib/util/createHash.js +1 -1
- package/lib/util/deprecation.js +4 -4
- package/lib/util/deterministicGrouping.js +7 -7
- package/lib/util/findGraphRoots.js +1 -1
- package/lib/util/fs.js +3 -3
- package/lib/util/identifier.js +14 -14
- package/lib/util/magicComment.js +5 -1
- package/lib/util/memoize.js +1 -1
- package/lib/util/processAsyncTree.js +2 -2
- package/lib/util/propertyName.js +1 -1
- package/lib/util/removeBOM.js +1 -1
- package/lib/util/runtime.js +6 -6
- package/lib/util/semver.js +16 -16
- package/lib/util/serialization.js +5 -5
- package/lib/util/smartGrouping.js +1 -1
- package/lib/validateSchema.js +2 -2
- package/lib/wasm/EnableWasmLoadingPlugin.js +1 -1
- package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +1 -1
- package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +1 -1
- package/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js +4 -4
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +13 -9
- package/lib/wasm-sync/WasmFinalizeExportsPlugin.js +2 -2
- package/lib/wasm-sync/WebAssemblyGenerator.js +14 -14
- package/lib/wasm-sync/WebAssemblyInInitialChunkError.js +4 -2
- package/lib/wasm-sync/WebAssemblyParser.js +2 -2
- package/lib/web/FetchCompileAsyncWasmPlugin.js +4 -4
- package/lib/web/FetchCompileWasmPlugin.js +4 -4
- package/lib/web/JsonpChunkLoadingPlugin.js +2 -2
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +1 -1
- package/lib/webpack.js +17 -12
- package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +2 -2
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +1 -1
- package/package.json +13 -13
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +4 -0
- package/types.d.ts +151 -44
|
@@ -64,7 +64,7 @@ const { makePathsRelative, parseResource } = require("../util/identifier");
|
|
|
64
64
|
/** @typedef {KnownStatsCompilation & Record<string, EXPECTED_ANY>} StatsCompilation */
|
|
65
65
|
/**
|
|
66
66
|
* @typedef {object} KnownStatsCompilation
|
|
67
|
-
* @property {
|
|
67
|
+
* @property {EXPECTED_ANY=} env
|
|
68
68
|
* @property {string=} name
|
|
69
69
|
* @property {string=} hash
|
|
70
70
|
* @property {string=} version
|
|
@@ -556,19 +556,19 @@ const SIMPLE_EXTRACTORS = {
|
|
|
556
556
|
}
|
|
557
557
|
if (!context.cachedGetErrors) {
|
|
558
558
|
const map = new WeakMap();
|
|
559
|
-
context.cachedGetErrors = compilation =>
|
|
559
|
+
context.cachedGetErrors = (compilation) =>
|
|
560
560
|
map.get(compilation) ||
|
|
561
561
|
// eslint-disable-next-line no-sequences
|
|
562
|
-
(errors => (map.set(compilation, errors), errors))(
|
|
562
|
+
((errors) => (map.set(compilation, errors), errors))(
|
|
563
563
|
compilation.getErrors()
|
|
564
564
|
);
|
|
565
565
|
}
|
|
566
566
|
if (!context.cachedGetWarnings) {
|
|
567
567
|
const map = new WeakMap();
|
|
568
|
-
context.cachedGetWarnings = compilation =>
|
|
568
|
+
context.cachedGetWarnings = (compilation) =>
|
|
569
569
|
map.get(compilation) ||
|
|
570
570
|
// eslint-disable-next-line no-sequences
|
|
571
|
-
(warnings => (map.set(compilation, warnings), warnings))(
|
|
571
|
+
((warnings) => (map.set(compilation, warnings), warnings))(
|
|
572
572
|
compilation.getWarnings()
|
|
573
573
|
);
|
|
574
574
|
}
|
|
@@ -639,7 +639,7 @@ const SIMPLE_EXTRACTORS = {
|
|
|
639
639
|
);
|
|
640
640
|
let depthInCollapsedGroup = 0;
|
|
641
641
|
for (const [origin, logEntries] of compilation.logging) {
|
|
642
|
-
const debugMode = loggingDebug.some(fn => fn(origin));
|
|
642
|
+
const debugMode = loggingDebug.some((fn) => fn(origin));
|
|
643
643
|
if (logging === false && !debugMode) continue;
|
|
644
644
|
/** @type {KnownStatsLoggingEntry[]} */
|
|
645
645
|
const groupStack = [];
|
|
@@ -724,7 +724,7 @@ const SIMPLE_EXTRACTORS = {
|
|
|
724
724
|
hash: (object, compilation) => {
|
|
725
725
|
object.hash = /** @type {string} */ (compilation.hash);
|
|
726
726
|
},
|
|
727
|
-
version: object => {
|
|
727
|
+
version: (object) => {
|
|
728
728
|
object.version = require("../../package.json").version;
|
|
729
729
|
},
|
|
730
730
|
env: (object, compilation, context, { _env }) => {
|
|
@@ -913,7 +913,7 @@ const SIMPLE_EXTRACTORS = {
|
|
|
913
913
|
let filtered = 0;
|
|
914
914
|
if (options.errorDetails === "auto" && rawErrors.length >= 3) {
|
|
915
915
|
filtered = rawErrors
|
|
916
|
-
.map(e => typeof e !== "string" && e.details)
|
|
916
|
+
.map((e) => typeof e !== "string" && e.details)
|
|
917
917
|
.filter(Boolean).length;
|
|
918
918
|
}
|
|
919
919
|
if (
|
|
@@ -933,7 +933,7 @@ const SIMPLE_EXTRACTORS = {
|
|
|
933
933
|
object.errors = errors;
|
|
934
934
|
},
|
|
935
935
|
errorsCount: (object, compilation, { cachedGetErrors }) => {
|
|
936
|
-
object.errorsCount = countWithChildren(compilation, c =>
|
|
936
|
+
object.errorsCount = countWithChildren(compilation, (c) =>
|
|
937
937
|
cachedGetErrors(c)
|
|
938
938
|
);
|
|
939
939
|
},
|
|
@@ -947,7 +947,7 @@ const SIMPLE_EXTRACTORS = {
|
|
|
947
947
|
let filtered = 0;
|
|
948
948
|
if (options.errorDetails === "auto") {
|
|
949
949
|
filtered = cachedGetWarnings(compilation)
|
|
950
|
-
.map(e => typeof e !== "string" && e.details)
|
|
950
|
+
.map((e) => typeof e !== "string" && e.details)
|
|
951
951
|
.filter(Boolean).length;
|
|
952
952
|
}
|
|
953
953
|
if (
|
|
@@ -990,14 +990,14 @@ const SIMPLE_EXTRACTORS = {
|
|
|
990
990
|
* @param {StatsError} warning warning
|
|
991
991
|
* @returns {boolean} result
|
|
992
992
|
*/
|
|
993
|
-
warning => {
|
|
993
|
+
(warning) => {
|
|
994
994
|
const warningString = Object.keys(warning)
|
|
995
995
|
.map(
|
|
996
|
-
key =>
|
|
996
|
+
(key) =>
|
|
997
997
|
`${warning[/** @type {keyof KnownStatsError} */ (key)]}`
|
|
998
998
|
)
|
|
999
999
|
.join("\n");
|
|
1000
|
-
return !warningsFilter.some(filter =>
|
|
1000
|
+
return !warningsFilter.some((filter) =>
|
|
1001
1001
|
filter(warning, warningString)
|
|
1002
1002
|
);
|
|
1003
1003
|
}
|
|
@@ -1045,22 +1045,22 @@ const SIMPLE_EXTRACTORS = {
|
|
|
1045
1045
|
compilationAuxiliaryFileToChunks.get(asset.name) || [];
|
|
1046
1046
|
object.chunkNames = uniqueOrderedArray(
|
|
1047
1047
|
chunks,
|
|
1048
|
-
c => (c.name ? [c.name] : []),
|
|
1048
|
+
(c) => (c.name ? [c.name] : []),
|
|
1049
1049
|
compareIds
|
|
1050
1050
|
);
|
|
1051
1051
|
object.chunkIdHints = uniqueOrderedArray(
|
|
1052
1052
|
chunks,
|
|
1053
|
-
c => [...c.idNameHints],
|
|
1053
|
+
(c) => [...c.idNameHints],
|
|
1054
1054
|
compareIds
|
|
1055
1055
|
);
|
|
1056
1056
|
object.auxiliaryChunkNames = uniqueOrderedArray(
|
|
1057
1057
|
auxiliaryChunks,
|
|
1058
|
-
c => (c.name ? [c.name] : []),
|
|
1058
|
+
(c) => (c.name ? [c.name] : []),
|
|
1059
1059
|
compareIds
|
|
1060
1060
|
);
|
|
1061
1061
|
object.auxiliaryChunkIdHints = uniqueOrderedArray(
|
|
1062
1062
|
auxiliaryChunks,
|
|
1063
|
-
c => [...c.idNameHints],
|
|
1063
|
+
(c) => [...c.idNameHints],
|
|
1064
1064
|
compareIds
|
|
1065
1065
|
);
|
|
1066
1066
|
object.filteredRelated = asset.related ? asset.related.length : undefined;
|
|
@@ -1087,12 +1087,12 @@ const SIMPLE_EXTRACTORS = {
|
|
|
1087
1087
|
compilationAuxiliaryFileToChunks.get(asset.name) || [];
|
|
1088
1088
|
object.chunks = uniqueOrderedArray(
|
|
1089
1089
|
chunks,
|
|
1090
|
-
c => /** @type {ChunkId[]} */ (c.ids),
|
|
1090
|
+
(c) => /** @type {ChunkId[]} */ (c.ids),
|
|
1091
1091
|
compareIds
|
|
1092
1092
|
);
|
|
1093
1093
|
object.auxiliaryChunks = uniqueOrderedArray(
|
|
1094
1094
|
auxiliaryChunks,
|
|
1095
|
-
c => /** @type {ChunkId[]} */ (c.ids),
|
|
1095
|
+
(c) => /** @type {ChunkId[]} */ (c.ids),
|
|
1096
1096
|
compareIds
|
|
1097
1097
|
);
|
|
1098
1098
|
},
|
|
@@ -1114,7 +1114,7 @@ const SIMPLE_EXTRACTORS = {
|
|
|
1114
1114
|
* @param {string} name Name
|
|
1115
1115
|
* @returns {{ name: string, size: number }} Asset object
|
|
1116
1116
|
*/
|
|
1117
|
-
const toAsset = name => {
|
|
1117
|
+
const toAsset = (name) => {
|
|
1118
1118
|
const asset = compilation.getAsset(name);
|
|
1119
1119
|
return {
|
|
1120
1120
|
name,
|
|
@@ -1123,10 +1123,12 @@ const SIMPLE_EXTRACTORS = {
|
|
|
1123
1123
|
};
|
|
1124
1124
|
/** @type {(total: number, asset: { size: number }) => number} */
|
|
1125
1125
|
const sizeReducer = (total, { size }) => total + size;
|
|
1126
|
-
const assets = uniqueArray(chunkGroup.chunks, c => c.files).map(
|
|
1126
|
+
const assets = uniqueArray(chunkGroup.chunks, (c) => c.files).map(
|
|
1127
|
+
toAsset
|
|
1128
|
+
);
|
|
1127
1129
|
const auxiliaryAssets = uniqueOrderedArray(
|
|
1128
1130
|
chunkGroup.chunks,
|
|
1129
|
-
c => c.auxiliaryFiles,
|
|
1131
|
+
(c) => c.auxiliaryFiles,
|
|
1130
1132
|
compareIds
|
|
1131
1133
|
).map(toAsset);
|
|
1132
1134
|
const assetsSize = assets.reduce(sizeReducer, 0);
|
|
@@ -1135,7 +1137,7 @@ const SIMPLE_EXTRACTORS = {
|
|
|
1135
1137
|
const statsChunkGroup = {
|
|
1136
1138
|
name,
|
|
1137
1139
|
chunks: ids
|
|
1138
|
-
? /** @type {ChunkId[]} */ (chunkGroup.chunks.map(c => c.id))
|
|
1140
|
+
? /** @type {ChunkId[]} */ (chunkGroup.chunks.map((c) => c.id))
|
|
1139
1141
|
: undefined,
|
|
1140
1142
|
assets: assets.length <= chunkGroupMaxAssets ? assets : undefined,
|
|
1141
1143
|
filteredAssets:
|
|
@@ -1151,14 +1153,14 @@ const SIMPLE_EXTRACTORS = {
|
|
|
1151
1153
|
: auxiliaryAssets.length,
|
|
1152
1154
|
auxiliaryAssetsSize,
|
|
1153
1155
|
children: children
|
|
1154
|
-
? mapObject(children, groups =>
|
|
1155
|
-
groups.map(group => {
|
|
1156
|
-
const assets = uniqueArray(group.chunks, c => c.files).map(
|
|
1156
|
+
? mapObject(children, (groups) =>
|
|
1157
|
+
groups.map((group) => {
|
|
1158
|
+
const assets = uniqueArray(group.chunks, (c) => c.files).map(
|
|
1157
1159
|
toAsset
|
|
1158
1160
|
);
|
|
1159
1161
|
const auxiliaryAssets = uniqueOrderedArray(
|
|
1160
1162
|
group.chunks,
|
|
1161
|
-
c => c.auxiliaryFiles,
|
|
1163
|
+
(c) => c.auxiliaryFiles,
|
|
1162
1164
|
compareIds
|
|
1163
1165
|
).map(toAsset);
|
|
1164
1166
|
|
|
@@ -1167,7 +1169,7 @@ const SIMPLE_EXTRACTORS = {
|
|
|
1167
1169
|
name: group.name,
|
|
1168
1170
|
chunks: ids
|
|
1169
1171
|
? /** @type {ChunkId[]} */
|
|
1170
|
-
(group.chunks.map(c => c.id))
|
|
1172
|
+
(group.chunks.map((c) => c.id))
|
|
1171
1173
|
: undefined,
|
|
1172
1174
|
assets:
|
|
1173
1175
|
assets.length <= chunkGroupMaxAssets ? assets : undefined,
|
|
@@ -1190,7 +1192,7 @@ const SIMPLE_EXTRACTORS = {
|
|
|
1190
1192
|
)
|
|
1191
1193
|
: undefined,
|
|
1192
1194
|
childAssets: children
|
|
1193
|
-
? mapObject(children, groups => {
|
|
1195
|
+
? mapObject(children, (groups) => {
|
|
1194
1196
|
/** @type {Set<string>} */
|
|
1195
1197
|
const set = new Set();
|
|
1196
1198
|
for (const group of groups) {
|
|
@@ -1314,7 +1316,7 @@ const SIMPLE_EXTRACTORS = {
|
|
|
1314
1316
|
module,
|
|
1315
1317
|
compareChunksById
|
|
1316
1318
|
),
|
|
1317
|
-
chunk => chunk.id
|
|
1319
|
+
(chunk) => chunk.id
|
|
1318
1320
|
)
|
|
1319
1321
|
);
|
|
1320
1322
|
},
|
|
@@ -1369,7 +1371,7 @@ const SIMPLE_EXTRACTORS = {
|
|
|
1369
1371
|
) => {
|
|
1370
1372
|
object.optimizationBailout = moduleGraph
|
|
1371
1373
|
.getOptimizationBailout(module)
|
|
1372
|
-
.map(item => {
|
|
1374
|
+
.map((item) => {
|
|
1373
1375
|
if (typeof item === "function") return item(requestShortener);
|
|
1374
1376
|
return item;
|
|
1375
1377
|
});
|
|
@@ -1579,7 +1581,7 @@ const SIMPLE_EXTRACTORS = {
|
|
|
1579
1581
|
for (const g of chunk.groupsIterable) {
|
|
1580
1582
|
origins.push(...g.origins);
|
|
1581
1583
|
}
|
|
1582
|
-
const array = origins.filter(origin => {
|
|
1584
|
+
const array = origins.filter((origin) => {
|
|
1583
1585
|
const key = [
|
|
1584
1586
|
origin.module ? chunkGraph.getModuleId(origin.module) : undefined,
|
|
1585
1587
|
formatLocation(origin.loc),
|
|
@@ -1626,8 +1628,8 @@ const SIMPLE_EXTRACTORS = {
|
|
|
1626
1628
|
object.moduleIdentifier = module.identifier();
|
|
1627
1629
|
object.moduleName = module.readableIdentifier(requestShortener);
|
|
1628
1630
|
const dependencies = [...moduleGraph.getIncomingConnections(module)]
|
|
1629
|
-
.filter(c => c.resolvedOriginModule === origin && c.dependency)
|
|
1630
|
-
.map(c => c.dependency);
|
|
1631
|
+
.filter((c) => c.resolvedOriginModule === origin && c.dependency)
|
|
1632
|
+
.map((c) => c.dependency);
|
|
1631
1633
|
object.dependencies = factory.create(
|
|
1632
1634
|
`${type}.dependencies`,
|
|
1633
1635
|
/** @type {Dependency[]} */
|
|
@@ -1671,9 +1673,11 @@ const FILTER_RESULTS = {
|
|
|
1671
1673
|
warningsFilter: util.deprecate(
|
|
1672
1674
|
(warning, context, { warningsFilter }) => {
|
|
1673
1675
|
const warningString = Object.keys(warning)
|
|
1674
|
-
.map(
|
|
1676
|
+
.map(
|
|
1677
|
+
(key) => `${warning[/** @type {keyof KnownStatsError} */ (key)]}`
|
|
1678
|
+
)
|
|
1675
1679
|
.join("\n");
|
|
1676
|
-
return !warningsFilter.some(filter => filter(warning, warningString));
|
|
1680
|
+
return !warningsFilter.some((filter) => filter(warning, warningString));
|
|
1677
1681
|
},
|
|
1678
1682
|
"config.stats.warningsFilter is deprecated in favor of config.ignoreWarnings",
|
|
1679
1683
|
"DEP_WEBPACK_STATS_WARNINGS_FILTER"
|
|
@@ -1685,9 +1689,9 @@ const FILTER_RESULTS = {
|
|
|
1685
1689
|
const MODULES_SORTER = {
|
|
1686
1690
|
_: (comparators, { compilation: { moduleGraph } }) => {
|
|
1687
1691
|
comparators.push(
|
|
1688
|
-
compareSelect(m => moduleGraph.getDepth(m), compareNumbers),
|
|
1689
|
-
compareSelect(m => moduleGraph.getPreOrderIndex(m), compareNumbers),
|
|
1690
|
-
compareSelect(m => m.identifier(), compareIds)
|
|
1692
|
+
compareSelect((m) => moduleGraph.getDepth(m), compareNumbers),
|
|
1693
|
+
compareSelect((m) => moduleGraph.getPreOrderIndex(m), compareNumbers),
|
|
1694
|
+
compareSelect((m) => m.identifier(), compareIds)
|
|
1691
1695
|
);
|
|
1692
1696
|
}
|
|
1693
1697
|
};
|
|
@@ -1695,8 +1699,8 @@ const MODULES_SORTER = {
|
|
|
1695
1699
|
/** @type {Record<string, Record<string, (comparators: Comparator<TODO>[], context: StatsFactoryContext, options: NormalizedStatsOptions) => void>>} */
|
|
1696
1700
|
const SORTERS = {
|
|
1697
1701
|
"compilation.chunks": {
|
|
1698
|
-
_: comparators => {
|
|
1699
|
-
comparators.push(compareSelect(c => c.id, compareIds));
|
|
1702
|
+
_: (comparators) => {
|
|
1703
|
+
comparators.push(compareSelect((c) => c.id, compareIds));
|
|
1700
1704
|
}
|
|
1701
1705
|
},
|
|
1702
1706
|
"compilation.modules": MODULES_SORTER,
|
|
@@ -1706,24 +1710,24 @@ const SORTERS = {
|
|
|
1706
1710
|
"module.reasons": {
|
|
1707
1711
|
_: (comparators, _context) => {
|
|
1708
1712
|
comparators.push(
|
|
1709
|
-
compareSelect(x => x.originModule, compareModulesByIdentifier)
|
|
1713
|
+
compareSelect((x) => x.originModule, compareModulesByIdentifier)
|
|
1710
1714
|
);
|
|
1711
1715
|
comparators.push(
|
|
1712
|
-
compareSelect(x => x.resolvedOriginModule, compareModulesByIdentifier)
|
|
1716
|
+
compareSelect((x) => x.resolvedOriginModule, compareModulesByIdentifier)
|
|
1713
1717
|
);
|
|
1714
1718
|
comparators.push(
|
|
1715
1719
|
compareSelect(
|
|
1716
|
-
x => x.dependency,
|
|
1720
|
+
(x) => x.dependency,
|
|
1717
1721
|
concatComparators(
|
|
1718
1722
|
compareSelect(
|
|
1719
1723
|
/**
|
|
1720
1724
|
* @param {Dependency} x dependency
|
|
1721
1725
|
* @returns {DependencyLocation} location
|
|
1722
1726
|
*/
|
|
1723
|
-
x => x.loc,
|
|
1727
|
+
(x) => x.loc,
|
|
1724
1728
|
compareLocations
|
|
1725
1729
|
),
|
|
1726
|
-
compareSelect(x => x.type, compareIds)
|
|
1730
|
+
compareSelect((x) => x.type, compareIds)
|
|
1727
1731
|
)
|
|
1728
1732
|
)
|
|
1729
1733
|
);
|
|
@@ -1733,12 +1737,12 @@ const SORTERS = {
|
|
|
1733
1737
|
_: (comparators, { compilation: { chunkGraph } }) => {
|
|
1734
1738
|
comparators.push(
|
|
1735
1739
|
compareSelect(
|
|
1736
|
-
origin =>
|
|
1740
|
+
(origin) =>
|
|
1737
1741
|
origin.module ? chunkGraph.getModuleId(origin.module) : undefined,
|
|
1738
1742
|
compareIds
|
|
1739
1743
|
),
|
|
1740
|
-
compareSelect(origin => formatLocation(origin.loc), compareIds),
|
|
1741
|
-
compareSelect(origin => origin.request, compareIds)
|
|
1744
|
+
compareSelect((origin) => formatLocation(origin.loc), compareIds),
|
|
1745
|
+
compareSelect((origin) => origin.request, compareIds)
|
|
1742
1746
|
);
|
|
1743
1747
|
}
|
|
1744
1748
|
}
|
|
@@ -1754,7 +1758,7 @@ const SORTERS = {
|
|
|
1754
1758
|
* @param {Children<T>} item item
|
|
1755
1759
|
* @returns {number} item size
|
|
1756
1760
|
*/
|
|
1757
|
-
const getItemSize = item =>
|
|
1761
|
+
const getItemSize = (item) =>
|
|
1758
1762
|
// Each item takes 1 line
|
|
1759
1763
|
// + the size of the children
|
|
1760
1764
|
// + 1 extra line when it has children and filteredChildren
|
|
@@ -1769,7 +1773,7 @@ const getItemSize = item =>
|
|
|
1769
1773
|
* @param {Children<T>[]} children children
|
|
1770
1774
|
* @returns {number} total size
|
|
1771
1775
|
*/
|
|
1772
|
-
const getTotalSize = children => {
|
|
1776
|
+
const getTotalSize = (children) => {
|
|
1773
1777
|
let size = 0;
|
|
1774
1778
|
for (const child of children) {
|
|
1775
1779
|
size += getItemSize(child);
|
|
@@ -1782,7 +1786,7 @@ const getTotalSize = children => {
|
|
|
1782
1786
|
* @param {Children<T>[]} children children
|
|
1783
1787
|
* @returns {number} total items
|
|
1784
1788
|
*/
|
|
1785
|
-
const getTotalItems = children => {
|
|
1789
|
+
const getTotalItems = (children) => {
|
|
1786
1790
|
let count = 0;
|
|
1787
1791
|
for (const child of children) {
|
|
1788
1792
|
if (!child.children && !child.filteredChildren) {
|
|
@@ -1800,7 +1804,7 @@ const getTotalItems = children => {
|
|
|
1800
1804
|
* @param {Children<T>[]} children children
|
|
1801
1805
|
* @returns {Children<T>[]} collapsed children
|
|
1802
1806
|
*/
|
|
1803
|
-
const collapse = children => {
|
|
1807
|
+
const collapse = (children) => {
|
|
1804
1808
|
// After collapse each child must take exactly one line
|
|
1805
1809
|
const newChildren = [];
|
|
1806
1810
|
for (const child of children) {
|
|
@@ -1957,7 +1961,7 @@ const errorsSpaceLimit = (errors, max) => {
|
|
|
1957
1961
|
// print only messages
|
|
1958
1962
|
if (errors.length + 1 >= max) {
|
|
1959
1963
|
return [
|
|
1960
|
-
errors.map(error => {
|
|
1964
|
+
errors.map((error) => {
|
|
1961
1965
|
if (typeof error === "string" || !error.details) return error;
|
|
1962
1966
|
filtered++;
|
|
1963
1967
|
return { ...error, details: "" };
|
|
@@ -2076,7 +2080,7 @@ const ASSETS_GROUPERS = {
|
|
|
2076
2080
|
*/
|
|
2077
2081
|
const groupByFlag = (name, exclude) => {
|
|
2078
2082
|
groupConfigs.push({
|
|
2079
|
-
getKeys: asset => (asset[name] ? ["1"] : undefined),
|
|
2083
|
+
getKeys: (asset) => (asset[name] ? ["1"] : undefined),
|
|
2080
2084
|
getOptions: () => ({
|
|
2081
2085
|
groupChildren: !exclude,
|
|
2082
2086
|
force: exclude
|
|
@@ -2112,7 +2116,7 @@ const ASSETS_GROUPERS = {
|
|
|
2112
2116
|
}
|
|
2113
2117
|
if (groupAssetsByPath || groupAssetsByExtension) {
|
|
2114
2118
|
groupConfigs.push({
|
|
2115
|
-
getKeys: asset => {
|
|
2119
|
+
getKeys: (asset) => {
|
|
2116
2120
|
const extensionMatch =
|
|
2117
2121
|
groupAssetsByExtension && GROUP_EXTENSION_REGEXP.exec(asset.name);
|
|
2118
2122
|
const extension = extensionMatch ? extensionMatch[1] : "";
|
|
@@ -2152,9 +2156,10 @@ const ASSETS_GROUPERS = {
|
|
|
2152
2156
|
/**
|
|
2153
2157
|
* @param {string} name name
|
|
2154
2158
|
*/
|
|
2155
|
-
const groupByAssetInfoFlag = name => {
|
|
2159
|
+
const groupByAssetInfoFlag = (name) => {
|
|
2156
2160
|
groupConfigs.push({
|
|
2157
|
-
getKeys: asset =>
|
|
2161
|
+
getKeys: (asset) =>
|
|
2162
|
+
asset.info && asset.info[name] ? ["1"] : undefined,
|
|
2158
2163
|
createGroup: (key, children, assets) => ({
|
|
2159
2164
|
type: "assets by info",
|
|
2160
2165
|
info: {
|
|
@@ -2173,9 +2178,9 @@ const ASSETS_GROUPERS = {
|
|
|
2173
2178
|
/**
|
|
2174
2179
|
* @param {keyof KnownStatsAsset} name name
|
|
2175
2180
|
*/
|
|
2176
|
-
const groupByNames = name => {
|
|
2181
|
+
const groupByNames = (name) => {
|
|
2177
2182
|
groupConfigs.push({
|
|
2178
|
-
getKeys: asset => /** @type {string[]} */ (asset[name]),
|
|
2183
|
+
getKeys: (asset) => /** @type {string[]} */ (asset[name]),
|
|
2179
2184
|
createGroup: (key, children, assets) => ({
|
|
2180
2185
|
type: "assets by chunk",
|
|
2181
2186
|
[name]: [key],
|
|
@@ -2191,9 +2196,9 @@ const ASSETS_GROUPERS = {
|
|
|
2191
2196
|
},
|
|
2192
2197
|
excludeAssets: (groupConfigs, context, { excludeAssets }) => {
|
|
2193
2198
|
groupConfigs.push({
|
|
2194
|
-
getKeys: asset => {
|
|
2199
|
+
getKeys: (asset) => {
|
|
2195
2200
|
const ident = asset.name;
|
|
2196
|
-
const excluded = excludeAssets.some(fn => fn(ident, asset));
|
|
2201
|
+
const excluded = excludeAssets.some((fn) => fn(ident, asset));
|
|
2197
2202
|
if (excluded) return ["excluded"];
|
|
2198
2203
|
},
|
|
2199
2204
|
getOptions: () => ({
|
|
@@ -2212,7 +2217,7 @@ const ASSETS_GROUPERS = {
|
|
|
2212
2217
|
/** @typedef {Record<string, (groupConfigs: GroupConfig<KnownStatsModule, TODO>[], context: StatsFactoryContext, options: NormalizedStatsOptions) => void>} ModulesGroupers */
|
|
2213
2218
|
|
|
2214
2219
|
/** @type {(type: ExcludeModulesType) => ModulesGroupers} */
|
|
2215
|
-
const MODULES_GROUPERS = type => ({
|
|
2220
|
+
const MODULES_GROUPERS = (type) => ({
|
|
2216
2221
|
_: (groupConfigs, context, options) => {
|
|
2217
2222
|
/**
|
|
2218
2223
|
* @param {keyof KnownStatsModule} name name
|
|
@@ -2221,7 +2226,7 @@ const MODULES_GROUPERS = type => ({
|
|
|
2221
2226
|
*/
|
|
2222
2227
|
const groupByFlag = (name, type, exclude) => {
|
|
2223
2228
|
groupConfigs.push({
|
|
2224
|
-
getKeys: module => (module[name] ? ["1"] : undefined),
|
|
2229
|
+
getKeys: (module) => (module[name] ? ["1"] : undefined),
|
|
2225
2230
|
getOptions: () => ({
|
|
2226
2231
|
groupChildren: !exclude,
|
|
2227
2232
|
force: exclude
|
|
@@ -2264,7 +2269,7 @@ const MODULES_GROUPERS = type => ({
|
|
|
2264
2269
|
}
|
|
2265
2270
|
if (groupModulesByType || !options.runtimeModules) {
|
|
2266
2271
|
groupConfigs.push({
|
|
2267
|
-
getKeys: module => {
|
|
2272
|
+
getKeys: (module) => {
|
|
2268
2273
|
if (!module.moduleType) return;
|
|
2269
2274
|
if (groupModulesByType) {
|
|
2270
2275
|
return [module.moduleType.split("/", 1)[0]];
|
|
@@ -2272,7 +2277,7 @@ const MODULES_GROUPERS = type => ({
|
|
|
2272
2277
|
return [WEBPACK_MODULE_TYPE_RUNTIME];
|
|
2273
2278
|
}
|
|
2274
2279
|
},
|
|
2275
|
-
getOptions: key => {
|
|
2280
|
+
getOptions: (key) => {
|
|
2276
2281
|
const exclude =
|
|
2277
2282
|
key === WEBPACK_MODULE_TYPE_RUNTIME && !options.runtimeModules;
|
|
2278
2283
|
return {
|
|
@@ -2294,7 +2299,7 @@ const MODULES_GROUPERS = type => ({
|
|
|
2294
2299
|
}
|
|
2295
2300
|
if (groupModulesByLayer) {
|
|
2296
2301
|
groupConfigs.push({
|
|
2297
|
-
getKeys: module => /** @type {string[]} */ ([module.layer]),
|
|
2302
|
+
getKeys: (module) => /** @type {string[]} */ ([module.layer]),
|
|
2298
2303
|
createGroup: (key, children, modules) => ({
|
|
2299
2304
|
type: "modules by layer",
|
|
2300
2305
|
layer: key,
|
|
@@ -2305,7 +2310,7 @@ const MODULES_GROUPERS = type => ({
|
|
|
2305
2310
|
}
|
|
2306
2311
|
if (groupModulesByPath || groupModulesByExtension) {
|
|
2307
2312
|
groupConfigs.push({
|
|
2308
|
-
getKeys: module => {
|
|
2313
|
+
getKeys: (module) => {
|
|
2309
2314
|
if (!module.name) return;
|
|
2310
2315
|
const resource = parseResource(
|
|
2311
2316
|
/** @type {string} */ (module.name.split("!").pop())
|
|
@@ -2354,10 +2359,10 @@ const MODULES_GROUPERS = type => ({
|
|
|
2354
2359
|
},
|
|
2355
2360
|
excludeModules: (groupConfigs, context, { excludeModules }) => {
|
|
2356
2361
|
groupConfigs.push({
|
|
2357
|
-
getKeys: module => {
|
|
2362
|
+
getKeys: (module) => {
|
|
2358
2363
|
const name = module.name;
|
|
2359
2364
|
if (name) {
|
|
2360
|
-
const excluded = excludeModules.some(fn => fn(name, module, type));
|
|
2365
|
+
const excluded = excludeModules.some((fn) => fn(name, module, type));
|
|
2361
2366
|
if (excluded) return ["1"];
|
|
2362
2367
|
}
|
|
2363
2368
|
},
|
|
@@ -2378,9 +2383,9 @@ const MODULES_GROUPERS = type => ({
|
|
|
2378
2383
|
|
|
2379
2384
|
/** @type {ModuleReasonsGroupers} */
|
|
2380
2385
|
const MODULE_REASONS_GROUPERS = {
|
|
2381
|
-
groupReasonsByOrigin: groupConfigs => {
|
|
2386
|
+
groupReasonsByOrigin: (groupConfigs) => {
|
|
2382
2387
|
groupConfigs.push({
|
|
2383
|
-
getKeys: reason => /** @type {string[]} */ ([reason.module]),
|
|
2388
|
+
getKeys: (reason) => /** @type {string[]} */ ([reason.module]),
|
|
2384
2389
|
createGroup: (key, children, reasons) => ({
|
|
2385
2390
|
type: "from origin",
|
|
2386
2391
|
module: key,
|
|
@@ -2407,7 +2412,7 @@ const RESULT_GROUPERS = {
|
|
|
2407
2412
|
* @param {string} field a field name
|
|
2408
2413
|
* @returns {field} normalized field
|
|
2409
2414
|
*/
|
|
2410
|
-
const normalizeFieldKey = field => {
|
|
2415
|
+
const normalizeFieldKey = (field) => {
|
|
2411
2416
|
if (field[0] === "!") {
|
|
2412
2417
|
return field.slice(1);
|
|
2413
2418
|
}
|
|
@@ -2419,7 +2424,7 @@ const normalizeFieldKey = field => {
|
|
|
2419
2424
|
* @param {string} field a field name
|
|
2420
2425
|
* @returns {boolean} result
|
|
2421
2426
|
*/
|
|
2422
|
-
const sortOrderRegular = field => {
|
|
2427
|
+
const sortOrderRegular = (field) => {
|
|
2423
2428
|
if (field[0] === "!") {
|
|
2424
2429
|
return false;
|
|
2425
2430
|
}
|
|
@@ -2431,7 +2436,7 @@ const sortOrderRegular = field => {
|
|
|
2431
2436
|
* @param {string | false} field field name
|
|
2432
2437
|
* @returns {(a: T, b: T) => 0 | 1 | -1} comparators
|
|
2433
2438
|
*/
|
|
2434
|
-
const sortByField = field => {
|
|
2439
|
+
const sortByField = (field) => {
|
|
2435
2440
|
if (!field) {
|
|
2436
2441
|
/**
|
|
2437
2442
|
* @param {T} a first
|
|
@@ -2444,7 +2449,7 @@ const sortByField = field => {
|
|
|
2444
2449
|
|
|
2445
2450
|
const fieldKey = normalizeFieldKey(field);
|
|
2446
2451
|
|
|
2447
|
-
let sortFn = compareSelect(m => m[fieldKey], compareIds);
|
|
2452
|
+
let sortFn = compareSelect((m) => m[fieldKey], compareIds);
|
|
2448
2453
|
|
|
2449
2454
|
// if a field is prefixed with a "!" the sort is reversed!
|
|
2450
2455
|
const sortIsRegular = sortOrderRegular(field);
|
|
@@ -2462,8 +2467,8 @@ const ASSET_SORTERS = {
|
|
|
2462
2467
|
assetsSort: (comparators, context, { assetsSort }) => {
|
|
2463
2468
|
comparators.push(sortByField(assetsSort));
|
|
2464
2469
|
},
|
|
2465
|
-
_: comparators => {
|
|
2466
|
-
comparators.push(compareSelect(a => a.name, compareIds));
|
|
2470
|
+
_: (comparators) => {
|
|
2471
|
+
comparators.push(compareSelect((a) => a.name, compareIds));
|
|
2467
2472
|
}
|
|
2468
2473
|
};
|
|
2469
2474
|
|
|
@@ -2557,7 +2562,7 @@ const ITEM_NAMES = {
|
|
|
2557
2562
|
* @param {T[]} items items to be merged
|
|
2558
2563
|
* @returns {NamedObject<T>} an object
|
|
2559
2564
|
*/
|
|
2560
|
-
const mergeToObject = items => {
|
|
2565
|
+
const mergeToObject = (items) => {
|
|
2561
2566
|
const obj = Object.create(null);
|
|
2562
2567
|
for (const item of items) {
|
|
2563
2568
|
obj[item.name] = item;
|
|
@@ -2583,7 +2588,7 @@ class DefaultStatsFactoryPlugin {
|
|
|
2583
2588
|
* @returns {void}
|
|
2584
2589
|
*/
|
|
2585
2590
|
apply(compiler) {
|
|
2586
|
-
compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
|
|
2591
|
+
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
|
|
2587
2592
|
compilation.hooks.statsFactory.tap(
|
|
2588
2593
|
PLUGIN_NAME,
|
|
2589
2594
|
/**
|
|
@@ -144,31 +144,31 @@ const NAMED_PRESETS = {
|
|
|
144
144
|
};
|
|
145
145
|
|
|
146
146
|
/**
|
|
147
|
-
* @param {Partial<NormalizedStatsOptions>} all stats
|
|
147
|
+
* @param {Partial<NormalizedStatsOptions>} all stats options
|
|
148
148
|
* @returns {boolean} true when enabled, otherwise false
|
|
149
149
|
*/
|
|
150
150
|
const NORMAL_ON = ({ all }) => all !== false;
|
|
151
151
|
/**
|
|
152
|
-
* @param {Partial<NormalizedStatsOptions>} all stats
|
|
152
|
+
* @param {Partial<NormalizedStatsOptions>} all stats options
|
|
153
153
|
* @returns {boolean} true when enabled, otherwise false
|
|
154
154
|
*/
|
|
155
155
|
const NORMAL_OFF = ({ all }) => all === true;
|
|
156
156
|
/**
|
|
157
|
-
* @param {Partial<NormalizedStatsOptions>} all stats
|
|
157
|
+
* @param {Partial<NormalizedStatsOptions>} all stats options
|
|
158
158
|
* @param {CreateStatsOptionsContext} forToString stats options context
|
|
159
159
|
* @returns {boolean} true when enabled, otherwise false
|
|
160
160
|
*/
|
|
161
161
|
const ON_FOR_TO_STRING = ({ all }, { forToString }) =>
|
|
162
162
|
forToString ? all !== false : all === true;
|
|
163
163
|
/**
|
|
164
|
-
* @param {Partial<NormalizedStatsOptions>} all stats
|
|
164
|
+
* @param {Partial<NormalizedStatsOptions>} all stats options
|
|
165
165
|
* @param {CreateStatsOptionsContext} forToString stats options context
|
|
166
166
|
* @returns {boolean} true when enabled, otherwise false
|
|
167
167
|
*/
|
|
168
168
|
const OFF_FOR_TO_STRING = ({ all }, { forToString }) =>
|
|
169
169
|
forToString ? all === true : all !== false;
|
|
170
170
|
/**
|
|
171
|
-
* @param {Partial<NormalizedStatsOptions>} all stats
|
|
171
|
+
* @param {Partial<NormalizedStatsOptions>} all stats options
|
|
172
172
|
* @param {CreateStatsOptionsContext} forToString stats options context
|
|
173
173
|
* @returns {boolean | "auto"} true when enabled, otherwise false
|
|
174
174
|
*/
|
|
@@ -289,15 +289,15 @@ const DEFAULTS = {
|
|
|
289
289
|
* @param {string | ({ test: (value: T) => boolean }) | ((value: T, ...args: EXPECTED_ANY[]) => boolean) | boolean} item item to normalize
|
|
290
290
|
* @returns {(value: T, ...args: EXPECTED_ANY[]) => boolean} normalize fn
|
|
291
291
|
*/
|
|
292
|
-
const normalizeFilter = item => {
|
|
292
|
+
const normalizeFilter = (item) => {
|
|
293
293
|
if (typeof item === "string") {
|
|
294
294
|
const regExp = new RegExp(
|
|
295
295
|
`[\\\\/]${item.replace(/[-[\]{}()*+?.\\^$|]/g, "\\$&")}([\\\\/]|$|!|\\?)`
|
|
296
296
|
);
|
|
297
|
-
return ident => regExp.test(/** @type {T} */ (ident));
|
|
297
|
+
return (ident) => regExp.test(/** @type {T} */ (ident));
|
|
298
298
|
}
|
|
299
299
|
if (item && typeof item === "object" && typeof item.test === "function") {
|
|
300
|
-
return ident => item.test(ident);
|
|
300
|
+
return (ident) => item.test(ident);
|
|
301
301
|
}
|
|
302
302
|
if (typeof item === "boolean") {
|
|
303
303
|
return () => item;
|
|
@@ -311,7 +311,7 @@ const normalizeFilter = item => {
|
|
|
311
311
|
|
|
312
312
|
/** @type {Normalizers} */
|
|
313
313
|
const NORMALIZER = {
|
|
314
|
-
excludeModules: value => {
|
|
314
|
+
excludeModules: (value) => {
|
|
315
315
|
if (!Array.isArray(value)) {
|
|
316
316
|
value = value
|
|
317
317
|
? /** @type {KnownNormalizedStatsOptions["excludeModules"]} */ ([value])
|
|
@@ -319,13 +319,13 @@ const NORMALIZER = {
|
|
|
319
319
|
}
|
|
320
320
|
return value.map(normalizeFilter);
|
|
321
321
|
},
|
|
322
|
-
excludeAssets: value => {
|
|
322
|
+
excludeAssets: (value) => {
|
|
323
323
|
if (!Array.isArray(value)) {
|
|
324
324
|
value = value ? [value] : [];
|
|
325
325
|
}
|
|
326
326
|
return value.map(normalizeFilter);
|
|
327
327
|
},
|
|
328
|
-
warningsFilter: value => {
|
|
328
|
+
warningsFilter: (value) => {
|
|
329
329
|
if (!Array.isArray(value)) {
|
|
330
330
|
value = value ? [value] : [];
|
|
331
331
|
}
|
|
@@ -340,7 +340,7 @@ const NORMALIZER = {
|
|
|
340
340
|
* @param {StatsOptions["warningsFilter"]} filter a warning filter
|
|
341
341
|
* @returns {WarningFilterFn} result
|
|
342
342
|
*/
|
|
343
|
-
filter => {
|
|
343
|
+
(filter) => {
|
|
344
344
|
if (typeof filter === "string") {
|
|
345
345
|
return (warning, warningString) => warningString.includes(filter);
|
|
346
346
|
}
|
|
@@ -356,11 +356,11 @@ const NORMALIZER = {
|
|
|
356
356
|
}
|
|
357
357
|
);
|
|
358
358
|
},
|
|
359
|
-
logging: value => {
|
|
359
|
+
logging: (value) => {
|
|
360
360
|
if (value === true) value = "log";
|
|
361
361
|
return /** @type {KnownNormalizedStatsOptions["logging"]} */ (value);
|
|
362
362
|
},
|
|
363
|
-
loggingDebug: value => {
|
|
363
|
+
loggingDebug: (value) => {
|
|
364
364
|
if (!Array.isArray(value)) {
|
|
365
365
|
value = value
|
|
366
366
|
? /** @type {KnownNormalizedStatsOptions["loggingDebug"]} */ ([value])
|
|
@@ -379,7 +379,7 @@ class DefaultStatsPresetPlugin {
|
|
|
379
379
|
* @returns {void}
|
|
380
380
|
*/
|
|
381
381
|
apply(compiler) {
|
|
382
|
-
compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
|
|
382
|
+
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
|
|
383
383
|
for (const key of Object.keys(NAMED_PRESETS)) {
|
|
384
384
|
const defaults = NAMED_PRESETS[/** @type {keyof NamedPresets} */ (key)];
|
|
385
385
|
compilation.hooks.statsPreset
|