webpack 5.100.1 → 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 +127 -114
- 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 +86 -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 +28 -24
- 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 +42 -44
- 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 +10 -3
- package/lib/asset/AssetGenerator.js +3 -3
- package/lib/asset/AssetModulesPlugin.js +6 -6
- package/lib/async-modules/AsyncModuleHelpers.js +50 -0
- 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 -23
- 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 +59 -75
- 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 +90 -83
- 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 +22 -6
- 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 +86 -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 +107 -8
- 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 +186 -54
|
@@ -51,10 +51,10 @@ const plural = (n, singular, plural) => (n === 1 ? singular : plural);
|
|
|
51
51
|
* @param {StatsPrinterContext} options options
|
|
52
52
|
* @returns {string | undefined} text
|
|
53
53
|
*/
|
|
54
|
-
const printSizes = (sizes, { formatSize = n => `${n}` }) => {
|
|
54
|
+
const printSizes = (sizes, { formatSize = (n) => `${n}` }) => {
|
|
55
55
|
const keys = Object.keys(sizes);
|
|
56
56
|
if (keys.length > 1) {
|
|
57
|
-
return keys.map(key => `${formatSize(sizes[key])} (${key})`).join(" ");
|
|
57
|
+
return keys.map((key) => `${formatSize(sizes[key])} (${key})`).join(" ");
|
|
58
58
|
} else if (keys.length === 1) {
|
|
59
59
|
return formatSize(sizes[keys[0]]);
|
|
60
60
|
}
|
|
@@ -64,7 +64,7 @@ const printSizes = (sizes, { formatSize = n => `${n}` }) => {
|
|
|
64
64
|
* @param {string | null} resource resource
|
|
65
65
|
* @returns {string} resource name for display
|
|
66
66
|
*/
|
|
67
|
-
const getResourceName = resource => {
|
|
67
|
+
const getResourceName = (resource) => {
|
|
68
68
|
if (!resource) return "";
|
|
69
69
|
const dataUrl = /^data:[^,]+,/.exec(resource);
|
|
70
70
|
if (!dataUrl) return resource;
|
|
@@ -81,7 +81,7 @@ const getResourceName = resource => {
|
|
|
81
81
|
* @param {string} name module name
|
|
82
82
|
* @returns {[string,string]} prefix and module name
|
|
83
83
|
*/
|
|
84
|
-
const getModuleName = name => {
|
|
84
|
+
const getModuleName = (name) => {
|
|
85
85
|
const [, prefix, resource] =
|
|
86
86
|
/** @type {[string, string, string]} */
|
|
87
87
|
(/** @type {unknown} */ (/^(.*!)?([^!]*)$/.exec(name)));
|
|
@@ -112,13 +112,13 @@ const mapLines = (str, fn) => str.split("\n").map(fn).join("\n");
|
|
|
112
112
|
* @param {number} n a number
|
|
113
113
|
* @returns {string} number as two digit string, leading 0
|
|
114
114
|
*/
|
|
115
|
-
const twoDigit = n => (n >= 10 ? `${n}` : `0${n}`);
|
|
115
|
+
const twoDigit = (n) => (n >= 10 ? `${n}` : `0${n}`);
|
|
116
116
|
|
|
117
117
|
/**
|
|
118
118
|
* @param {string | number | null} id an id
|
|
119
119
|
* @returns {id is string | number} is i
|
|
120
120
|
*/
|
|
121
|
-
const isValidId = id => {
|
|
121
|
+
const isValidId = (id) => {
|
|
122
122
|
if (typeof id === "number" || id) {
|
|
123
123
|
return true;
|
|
124
124
|
}
|
|
@@ -281,7 +281,7 @@ const COMPILATION_SIMPLE_PRINTERS = {
|
|
|
281
281
|
return `${builtAtMessage}${subjectMessage} ${statusMessage}${timeMessage}${hashMessage}`;
|
|
282
282
|
}
|
|
283
283
|
},
|
|
284
|
-
"compilation.filteredWarningDetailsCount": count =>
|
|
284
|
+
"compilation.filteredWarningDetailsCount": (count) =>
|
|
285
285
|
count
|
|
286
286
|
? `${count} ${plural(
|
|
287
287
|
count,
|
|
@@ -320,7 +320,7 @@ const COMPILATION_SIMPLE_PRINTERS = {
|
|
|
320
320
|
let chunkGroups = Object.values(namedChunkGroups);
|
|
321
321
|
if (entrypoints) {
|
|
322
322
|
chunkGroups = chunkGroups.filter(
|
|
323
|
-
group =>
|
|
323
|
+
(group) =>
|
|
324
324
|
!Object.prototype.hasOwnProperty.call(
|
|
325
325
|
entrypoints,
|
|
326
326
|
/** @type {string} */
|
|
@@ -428,7 +428,7 @@ const COMPILATION_SIMPLE_PRINTERS = {
|
|
|
428
428
|
|
|
429
429
|
/** @type {AssetSimplePrinters} */
|
|
430
430
|
const ASSET_SIMPLE_PRINTERS = {
|
|
431
|
-
"asset.type": type => type,
|
|
431
|
+
"asset.type": (type) => type,
|
|
432
432
|
"asset.name": (name, { formatFilename, asset: { isOverSizeLimit } }) =>
|
|
433
433
|
formatFilename(name, isOverSizeLimit),
|
|
434
434
|
"asset.size": (size, { asset: { isOverSizeLimit }, yellow, formatSize }) =>
|
|
@@ -474,8 +474,8 @@ const ASSET_SIMPLE_PRINTERS = {
|
|
|
474
474
|
|
|
475
475
|
assetChunk: (id, { formatChunkId }) => formatChunkId(id),
|
|
476
476
|
|
|
477
|
-
assetChunkName: name => name || undefined,
|
|
478
|
-
assetChunkIdHint: name => name || undefined
|
|
477
|
+
assetChunkName: (name) => name || undefined,
|
|
478
|
+
assetChunkIdHint: (name) => name || undefined
|
|
479
479
|
};
|
|
480
480
|
|
|
481
481
|
/**
|
|
@@ -487,14 +487,14 @@ const ASSET_SIMPLE_PRINTERS = {
|
|
|
487
487
|
|
|
488
488
|
/** @type {ModuleSimplePrinters} */
|
|
489
489
|
const MODULE_SIMPLE_PRINTERS = {
|
|
490
|
-
"module.type": type => (type !== "module" ? type : undefined),
|
|
490
|
+
"module.type": (type) => (type !== "module" ? type : undefined),
|
|
491
491
|
"module.id": (id, { formatModuleId }) =>
|
|
492
492
|
isValidId(id) ? formatModuleId(id) : undefined,
|
|
493
493
|
"module.name": (name, { bold }) => {
|
|
494
494
|
const [prefix, resource] = getModuleName(name);
|
|
495
495
|
return `${prefix || ""}${bold(resource || "")}`;
|
|
496
496
|
},
|
|
497
|
-
"module.identifier": _identifier => undefined,
|
|
497
|
+
"module.identifier": (_identifier) => undefined,
|
|
498
498
|
"module.layer": (layer, { formatLayer }) =>
|
|
499
499
|
layer ? formatLayer(layer) : undefined,
|
|
500
500
|
"module.sizes": printSizes,
|
|
@@ -571,7 +571,7 @@ const MODULE_SIMPLE_PRINTERS = {
|
|
|
571
571
|
yellow(optimizationBailout),
|
|
572
572
|
"module.issuerPath": (issuerPath, { module }) =>
|
|
573
573
|
module.profile ? undefined : "",
|
|
574
|
-
"module.profile": _profile => undefined,
|
|
574
|
+
"module.profile": (_profile) => undefined,
|
|
575
575
|
"module.filteredModules": (filteredModules, { module: { modules } }) =>
|
|
576
576
|
filteredModules > 0
|
|
577
577
|
? `${moreCount(modules, filteredModules)} nested ${plural(
|
|
@@ -617,14 +617,14 @@ const MODULE_ISSUER_PRINTERS = {
|
|
|
617
617
|
|
|
618
618
|
/** @type {ModuleReasonsPrinters} */
|
|
619
619
|
const MODULE_REASON_PRINTERS = {
|
|
620
|
-
"moduleReason.type": type => type || undefined,
|
|
620
|
+
"moduleReason.type": (type) => type || undefined,
|
|
621
621
|
"moduleReason.userRequest": (userRequest, { cyan }) =>
|
|
622
622
|
cyan(getResourceName(userRequest)),
|
|
623
623
|
"moduleReason.moduleId": (moduleId, { formatModuleId }) =>
|
|
624
624
|
isValidId(moduleId) ? formatModuleId(moduleId) : undefined,
|
|
625
625
|
"moduleReason.module": (module, { magenta }) =>
|
|
626
626
|
module ? magenta(module) : undefined,
|
|
627
|
-
"moduleReason.loc": loc => loc || undefined,
|
|
627
|
+
"moduleReason.loc": (loc) => loc || undefined,
|
|
628
628
|
"moduleReason.explanation": (explanation, { cyan }) =>
|
|
629
629
|
explanation ? cyan(explanation) : undefined,
|
|
630
630
|
"moduleReason.active": (active, { formatFlag }) =>
|
|
@@ -716,17 +716,17 @@ const CHUNK_GROUP_PRINTERS = {
|
|
|
716
716
|
? undefined
|
|
717
717
|
: printer.print(
|
|
718
718
|
context.type,
|
|
719
|
-
Object.keys(children).map(key => ({
|
|
719
|
+
Object.keys(children).map((key) => ({
|
|
720
720
|
type: key,
|
|
721
721
|
children: children[key]
|
|
722
722
|
})),
|
|
723
723
|
context
|
|
724
724
|
),
|
|
725
|
-
"chunkGroupChildGroup.type": type => `${type}:`,
|
|
725
|
+
"chunkGroupChildGroup.type": (type) => `${type}:`,
|
|
726
726
|
"chunkGroupChild.assets[]": (file, { formatFilename }) =>
|
|
727
727
|
formatFilename(file),
|
|
728
728
|
"chunkGroupChild.chunks[]": (id, { formatChunkId }) => formatChunkId(id),
|
|
729
|
-
"chunkGroupChild.name": name => (name ? `(name: ${name})` : undefined)
|
|
729
|
+
"chunkGroupChild.name": (name) => (name ? `(name: ${name})` : undefined)
|
|
730
730
|
};
|
|
731
731
|
|
|
732
732
|
/**
|
|
@@ -741,9 +741,9 @@ const CHUNK_GROUP_PRINTERS = {
|
|
|
741
741
|
const CHUNK_PRINTERS = {
|
|
742
742
|
"chunk.id": (id, { formatChunkId }) => formatChunkId(id),
|
|
743
743
|
"chunk.files[]": (file, { formatFilename }) => formatFilename(file),
|
|
744
|
-
"chunk.names[]": name => name,
|
|
745
|
-
"chunk.idHints[]": name => name,
|
|
746
|
-
"chunk.runtime[]": name => name,
|
|
744
|
+
"chunk.names[]": (name) => name,
|
|
745
|
+
"chunk.idHints[]": (name) => name,
|
|
746
|
+
"chunk.runtime[]": (name) => name,
|
|
747
747
|
"chunk.sizes": (sizes, context) => printSizes(sizes, context),
|
|
748
748
|
"chunk.parents[]": (parents, context) =>
|
|
749
749
|
context.formatChunkId(parents, "parent"),
|
|
@@ -756,13 +756,13 @@ const CHUNK_PRINTERS = {
|
|
|
756
756
|
? undefined
|
|
757
757
|
: printer.print(
|
|
758
758
|
context.type,
|
|
759
|
-
Object.keys(childrenByOrder).map(key => ({
|
|
759
|
+
Object.keys(childrenByOrder).map((key) => ({
|
|
760
760
|
type: key,
|
|
761
761
|
children: childrenByOrder[key]
|
|
762
762
|
})),
|
|
763
763
|
context
|
|
764
764
|
),
|
|
765
|
-
"chunk.childrenByOrder[].type": type => `${type}:`,
|
|
765
|
+
"chunk.childrenByOrder[].type": (type) => `${type}:`,
|
|
766
766
|
"chunk.childrenByOrder[].children[]": (id, { formatChunkId }) =>
|
|
767
767
|
isValidId(id) ? formatChunkId(id) : undefined,
|
|
768
768
|
"chunk.entry": (entry, { formatFlag, yellow }) =>
|
|
@@ -784,11 +784,11 @@ const CHUNK_PRINTERS = {
|
|
|
784
784
|
: undefined,
|
|
785
785
|
"chunk.separator!": () => "\n",
|
|
786
786
|
|
|
787
|
-
"chunkOrigin.request": request => request,
|
|
787
|
+
"chunkOrigin.request": (request) => request,
|
|
788
788
|
"chunkOrigin.moduleId": (moduleId, { formatModuleId }) =>
|
|
789
789
|
isValidId(moduleId) ? formatModuleId(moduleId) : undefined,
|
|
790
790
|
"chunkOrigin.moduleName": (moduleName, { bold }) => bold(moduleName),
|
|
791
|
-
"chunkOrigin.loc": loc => loc
|
|
791
|
+
"chunkOrigin.loc": (loc) => loc
|
|
792
792
|
};
|
|
793
793
|
|
|
794
794
|
/**
|
|
@@ -818,9 +818,9 @@ const ERROR_PRINTERS = {
|
|
|
818
818
|
"error.message": (message, { bold, formatError }) =>
|
|
819
819
|
message.includes("\u001B[") ? message : bold(formatError(message)),
|
|
820
820
|
"error.details": (details, { formatError }) => formatError(details),
|
|
821
|
-
"error.filteredDetails": filteredDetails =>
|
|
821
|
+
"error.filteredDetails": (filteredDetails) =>
|
|
822
822
|
filteredDetails ? `+ ${filteredDetails} hidden lines` : undefined,
|
|
823
|
-
"error.stack": stack => stack,
|
|
823
|
+
"error.stack": (stack) => stack,
|
|
824
824
|
"error.cause": (cause, context, printer) =>
|
|
825
825
|
cause
|
|
826
826
|
? indent(
|
|
@@ -831,7 +831,7 @@ const ERROR_PRINTERS = {
|
|
|
831
831
|
" "
|
|
832
832
|
)
|
|
833
833
|
: undefined,
|
|
834
|
-
"error.moduleTrace": _moduleTrace => undefined,
|
|
834
|
+
"error.moduleTrace": (_moduleTrace) => undefined,
|
|
835
835
|
"error.separator!": () => "\n"
|
|
836
836
|
};
|
|
837
837
|
|
|
@@ -847,40 +847,40 @@ const ERROR_PRINTERS = {
|
|
|
847
847
|
/** @type {LogEntryPrinters} */
|
|
848
848
|
const LOG_ENTRY_PRINTERS = {
|
|
849
849
|
"loggingEntry(error).loggingEntry.message": (message, { red }) =>
|
|
850
|
-
mapLines(message, x => `<e> ${red(x)}`),
|
|
850
|
+
mapLines(message, (x) => `<e> ${red(x)}`),
|
|
851
851
|
"loggingEntry(warn).loggingEntry.message": (message, { yellow }) =>
|
|
852
|
-
mapLines(message, x => `<w> ${yellow(x)}`),
|
|
852
|
+
mapLines(message, (x) => `<w> ${yellow(x)}`),
|
|
853
853
|
"loggingEntry(info).loggingEntry.message": (message, { green }) =>
|
|
854
|
-
mapLines(message, x => `<i> ${green(x)}`),
|
|
854
|
+
mapLines(message, (x) => `<i> ${green(x)}`),
|
|
855
855
|
"loggingEntry(log).loggingEntry.message": (message, { bold }) =>
|
|
856
|
-
mapLines(message, x => ` ${bold(x)}`),
|
|
857
|
-
"loggingEntry(debug).loggingEntry.message": message =>
|
|
858
|
-
mapLines(message, x => ` ${x}`),
|
|
859
|
-
"loggingEntry(trace).loggingEntry.message": message =>
|
|
860
|
-
mapLines(message, x => ` ${x}`),
|
|
856
|
+
mapLines(message, (x) => ` ${bold(x)}`),
|
|
857
|
+
"loggingEntry(debug).loggingEntry.message": (message) =>
|
|
858
|
+
mapLines(message, (x) => ` ${x}`),
|
|
859
|
+
"loggingEntry(trace).loggingEntry.message": (message) =>
|
|
860
|
+
mapLines(message, (x) => ` ${x}`),
|
|
861
861
|
"loggingEntry(status).loggingEntry.message": (message, { magenta }) =>
|
|
862
|
-
mapLines(message, x => `<s> ${magenta(x)}`),
|
|
862
|
+
mapLines(message, (x) => `<s> ${magenta(x)}`),
|
|
863
863
|
"loggingEntry(profile).loggingEntry.message": (message, { magenta }) =>
|
|
864
|
-
mapLines(message, x => `<p> ${magenta(x)}`),
|
|
864
|
+
mapLines(message, (x) => `<p> ${magenta(x)}`),
|
|
865
865
|
"loggingEntry(profileEnd).loggingEntry.message": (message, { magenta }) =>
|
|
866
|
-
mapLines(message, x => `</p> ${magenta(x)}`),
|
|
866
|
+
mapLines(message, (x) => `</p> ${magenta(x)}`),
|
|
867
867
|
"loggingEntry(time).loggingEntry.message": (message, { magenta }) =>
|
|
868
|
-
mapLines(message, x => `<t> ${magenta(x)}`),
|
|
868
|
+
mapLines(message, (x) => `<t> ${magenta(x)}`),
|
|
869
869
|
"loggingEntry(group).loggingEntry.message": (message, { cyan }) =>
|
|
870
|
-
mapLines(message, x => `<-> ${cyan(x)}`),
|
|
870
|
+
mapLines(message, (x) => `<-> ${cyan(x)}`),
|
|
871
871
|
"loggingEntry(groupCollapsed).loggingEntry.message": (message, { cyan }) =>
|
|
872
|
-
mapLines(message, x => `<+> ${cyan(x)}`),
|
|
872
|
+
mapLines(message, (x) => `<+> ${cyan(x)}`),
|
|
873
873
|
"loggingEntry(clear).loggingEntry": () => " -------",
|
|
874
874
|
"loggingEntry(groupCollapsed).loggingEntry.children": () => "",
|
|
875
|
-
"loggingEntry.trace[]": trace =>
|
|
876
|
-
trace ? mapLines(trace, x => `| ${x}`) : undefined,
|
|
875
|
+
"loggingEntry.trace[]": (trace) =>
|
|
876
|
+
trace ? mapLines(trace, (x) => `| ${x}`) : undefined,
|
|
877
877
|
|
|
878
|
-
loggingGroup: loggingGroup =>
|
|
878
|
+
loggingGroup: (loggingGroup) =>
|
|
879
879
|
loggingGroup.entries.length === 0 ? "" : undefined,
|
|
880
880
|
"loggingGroup.debug": (flag, { red }) => (flag ? red("DEBUG") : undefined),
|
|
881
881
|
"loggingGroup.name": (name, { bold }) => bold(`LOG from ${name}`),
|
|
882
882
|
"loggingGroup.separator!": () => "\n",
|
|
883
|
-
"loggingGroup.filteredEntries": filteredEntries =>
|
|
883
|
+
"loggingGroup.filteredEntries": (filteredEntries) =>
|
|
884
884
|
filteredEntries > 0 ? `+ ${filteredEntries} hidden lines` : undefined
|
|
885
885
|
};
|
|
886
886
|
|
|
@@ -888,14 +888,14 @@ const LOG_ENTRY_PRINTERS = {
|
|
|
888
888
|
|
|
889
889
|
/** @type {ModuleTraceItemPrinters} */
|
|
890
890
|
const MODULE_TRACE_ITEM_PRINTERS = {
|
|
891
|
-
"moduleTraceItem.originName": originName => originName
|
|
891
|
+
"moduleTraceItem.originName": (originName) => originName
|
|
892
892
|
};
|
|
893
893
|
|
|
894
894
|
/** @typedef {Printers<KnownStatsModuleTraceDependency, "moduleTraceDependency">} ModuleTraceDependencyPrinters */
|
|
895
895
|
|
|
896
896
|
/** @type {ModuleTraceDependencyPrinters} */
|
|
897
897
|
const MODULE_TRACE_DEPENDENCY_PRINTERS = {
|
|
898
|
-
"moduleTraceDependency.loc": loc => loc
|
|
898
|
+
"moduleTraceDependency.loc": (loc) => loc
|
|
899
899
|
};
|
|
900
900
|
|
|
901
901
|
/**
|
|
@@ -932,9 +932,9 @@ const ITEM_NAMES = {
|
|
|
932
932
|
"module.issuerPath[]": "moduleIssuer",
|
|
933
933
|
"chunk.origins[]": "chunkOrigin",
|
|
934
934
|
"chunk.modules[]": "module",
|
|
935
|
-
"loggingGroup.entries[]": logEntry =>
|
|
935
|
+
"loggingGroup.entries[]": (logEntry) =>
|
|
936
936
|
`loggingEntry(${logEntry.type}).loggingEntry`,
|
|
937
|
-
"loggingEntry.children[]": logEntry =>
|
|
937
|
+
"loggingEntry.children[]": (logEntry) =>
|
|
938
938
|
`loggingEntry(${logEntry.type}).loggingEntry`,
|
|
939
939
|
"error.moduleTrace[]": "moduleTraceItem",
|
|
940
940
|
"error.errors[]": "error",
|
|
@@ -1135,19 +1135,19 @@ const PREFERRED_ORDERS = {
|
|
|
1135
1135
|
/** @typedef {(items: string[]) => string | undefined} SimpleItemsJoiner */
|
|
1136
1136
|
|
|
1137
1137
|
/** @type {SimpleItemsJoiner} */
|
|
1138
|
-
const itemsJoinOneLine = items => items.filter(Boolean).join(" ");
|
|
1138
|
+
const itemsJoinOneLine = (items) => items.filter(Boolean).join(" ");
|
|
1139
1139
|
/** @type {SimpleItemsJoiner} */
|
|
1140
|
-
const itemsJoinOneLineBrackets = items =>
|
|
1140
|
+
const itemsJoinOneLineBrackets = (items) =>
|
|
1141
1141
|
items.length > 0 ? `(${items.filter(Boolean).join(" ")})` : undefined;
|
|
1142
1142
|
/** @type {SimpleItemsJoiner} */
|
|
1143
|
-
const itemsJoinMoreSpacing = items => items.filter(Boolean).join("\n\n");
|
|
1143
|
+
const itemsJoinMoreSpacing = (items) => items.filter(Boolean).join("\n\n");
|
|
1144
1144
|
/** @type {SimpleItemsJoiner} */
|
|
1145
|
-
const itemsJoinComma = items => items.filter(Boolean).join(", ");
|
|
1145
|
+
const itemsJoinComma = (items) => items.filter(Boolean).join(", ");
|
|
1146
1146
|
/** @type {SimpleItemsJoiner} */
|
|
1147
|
-
const itemsJoinCommaBrackets = items =>
|
|
1147
|
+
const itemsJoinCommaBrackets = (items) =>
|
|
1148
1148
|
items.length > 0 ? `(${items.filter(Boolean).join(", ")})` : undefined;
|
|
1149
1149
|
/** @type {(item: string) => SimpleItemsJoiner} */
|
|
1150
|
-
const itemsJoinCommaBracketsWithName = name => items =>
|
|
1150
|
+
const itemsJoinCommaBracketsWithName = (name) => (items) =>
|
|
1151
1151
|
items.length > 0
|
|
1152
1152
|
? `(${name}: ${items.filter(Boolean).join(", ")})`
|
|
1153
1153
|
: undefined;
|
|
@@ -1176,18 +1176,18 @@ const SIMPLE_ITEMS_JOINER = {
|
|
|
1176
1176
|
"asset.auxiliaryChunkIdHints":
|
|
1177
1177
|
itemsJoinCommaBracketsWithName("auxiliary id hint"),
|
|
1178
1178
|
"module.chunks": itemsJoinOneLine,
|
|
1179
|
-
"module.issuerPath": items =>
|
|
1179
|
+
"module.issuerPath": (items) =>
|
|
1180
1180
|
items
|
|
1181
1181
|
.filter(Boolean)
|
|
1182
|
-
.map(item => `${item} ->`)
|
|
1182
|
+
.map((item) => `${item} ->`)
|
|
1183
1183
|
.join(" "),
|
|
1184
1184
|
"compilation.errors": itemsJoinMoreSpacing,
|
|
1185
1185
|
"compilation.warnings": itemsJoinMoreSpacing,
|
|
1186
1186
|
"compilation.logging": itemsJoinMoreSpacing,
|
|
1187
|
-
"compilation.children": items =>
|
|
1187
|
+
"compilation.children": (items) =>
|
|
1188
1188
|
indent(/** @type {string} */ (itemsJoinMoreSpacing(items)), " "),
|
|
1189
1189
|
"moduleTraceItem.dependencies": itemsJoinOneLine,
|
|
1190
|
-
"loggingEntry.children": items =>
|
|
1190
|
+
"loggingEntry.children": (items) =>
|
|
1191
1191
|
indent(items.filter(Boolean).join("\n"), " ", false)
|
|
1192
1192
|
};
|
|
1193
1193
|
|
|
@@ -1195,9 +1195,9 @@ const SIMPLE_ITEMS_JOINER = {
|
|
|
1195
1195
|
* @param {Item[]} items items
|
|
1196
1196
|
* @returns {string} result
|
|
1197
1197
|
*/
|
|
1198
|
-
const joinOneLine = items =>
|
|
1198
|
+
const joinOneLine = (items) =>
|
|
1199
1199
|
items
|
|
1200
|
-
.map(item => item.content)
|
|
1200
|
+
.map((item) => item.content)
|
|
1201
1201
|
.filter(Boolean)
|
|
1202
1202
|
.join(" ");
|
|
1203
1203
|
|
|
@@ -1205,7 +1205,7 @@ const joinOneLine = items =>
|
|
|
1205
1205
|
* @param {Item[]} items items
|
|
1206
1206
|
* @returns {string} result
|
|
1207
1207
|
*/
|
|
1208
|
-
const joinInBrackets = items => {
|
|
1208
|
+
const joinInBrackets = (items) => {
|
|
1209
1209
|
const res = [];
|
|
1210
1210
|
let mode = 0;
|
|
1211
1211
|
for (const item of items) {
|
|
@@ -1269,7 +1269,7 @@ const joinExplicitNewLine = (items, indenter) => {
|
|
|
1269
1269
|
let firstInLine = true;
|
|
1270
1270
|
let first = true;
|
|
1271
1271
|
return items
|
|
1272
|
-
.map(item => {
|
|
1272
|
+
.map((item) => {
|
|
1273
1273
|
if (!item || !item.content) return;
|
|
1274
1274
|
let content = indent(item.content, first ? "" : indenter, !firstInLine);
|
|
1275
1275
|
if (firstInLine) {
|
|
@@ -1291,7 +1291,7 @@ const joinExplicitNewLine = (items, indenter) => {
|
|
|
1291
1291
|
* @returns {SimpleElementJoiner} joiner
|
|
1292
1292
|
*/
|
|
1293
1293
|
const joinError =
|
|
1294
|
-
error =>
|
|
1294
|
+
(error) =>
|
|
1295
1295
|
/**
|
|
1296
1296
|
* @param {Item[]} items items
|
|
1297
1297
|
* @param {StatsPrinterContextWithExtra} ctx context
|
|
@@ -1308,7 +1308,7 @@ const joinError =
|
|
|
1308
1308
|
|
|
1309
1309
|
/** @type {Record<string, SimpleElementJoiner>} */
|
|
1310
1310
|
const SIMPLE_ELEMENT_JOINERS = {
|
|
1311
|
-
compilation: items => {
|
|
1311
|
+
compilation: (items) => {
|
|
1312
1312
|
const result = [];
|
|
1313
1313
|
let lastNeedMore = false;
|
|
1314
1314
|
for (const item of items) {
|
|
@@ -1328,9 +1328,9 @@ const SIMPLE_ELEMENT_JOINERS = {
|
|
|
1328
1328
|
if (lastNeedMore) result.push("\n");
|
|
1329
1329
|
return result.join("");
|
|
1330
1330
|
},
|
|
1331
|
-
asset: items =>
|
|
1331
|
+
asset: (items) =>
|
|
1332
1332
|
joinExplicitNewLine(
|
|
1333
|
-
items.map(item => {
|
|
1333
|
+
items.map((item) => {
|
|
1334
1334
|
if (
|
|
1335
1335
|
(item.element === "related" || item.element === "children") &&
|
|
1336
1336
|
item.content
|
|
@@ -1348,7 +1348,7 @@ const SIMPLE_ELEMENT_JOINERS = {
|
|
|
1348
1348
|
module: (items, { module }) => {
|
|
1349
1349
|
let hasName = false;
|
|
1350
1350
|
return joinExplicitNewLine(
|
|
1351
|
-
items.map(item => {
|
|
1351
|
+
items.map((item) => {
|
|
1352
1352
|
switch (item.element) {
|
|
1353
1353
|
case "id":
|
|
1354
1354
|
if (module.id === module.name) {
|
|
@@ -1381,10 +1381,10 @@ const SIMPLE_ELEMENT_JOINERS = {
|
|
|
1381
1381
|
" "
|
|
1382
1382
|
);
|
|
1383
1383
|
},
|
|
1384
|
-
chunk: items => {
|
|
1384
|
+
chunk: (items) => {
|
|
1385
1385
|
let hasEntry = false;
|
|
1386
1386
|
return `chunk ${joinExplicitNewLine(
|
|
1387
|
-
items.filter(item => {
|
|
1387
|
+
items.filter((item) => {
|
|
1388
1388
|
switch (item.element) {
|
|
1389
1389
|
case "entry":
|
|
1390
1390
|
if (item.content) hasEntry = true;
|
|
@@ -1398,15 +1398,15 @@ const SIMPLE_ELEMENT_JOINERS = {
|
|
|
1398
1398
|
" "
|
|
1399
1399
|
)}`;
|
|
1400
1400
|
},
|
|
1401
|
-
"chunk.childrenByOrder[]": items => `(${joinOneLine(items)})`,
|
|
1402
|
-
chunkGroup: items => joinExplicitNewLine(items, " "),
|
|
1401
|
+
"chunk.childrenByOrder[]": (items) => `(${joinOneLine(items)})`,
|
|
1402
|
+
chunkGroup: (items) => joinExplicitNewLine(items, " "),
|
|
1403
1403
|
chunkGroupAsset: joinOneLine,
|
|
1404
1404
|
chunkGroupChildGroup: joinOneLine,
|
|
1405
1405
|
chunkGroupChild: joinOneLine,
|
|
1406
1406
|
moduleReason: (items, { moduleReason }) => {
|
|
1407
1407
|
let hasName = false;
|
|
1408
1408
|
return joinExplicitNewLine(
|
|
1409
|
-
items.map(item => {
|
|
1409
|
+
items.map((item) => {
|
|
1410
1410
|
switch (item.element) {
|
|
1411
1411
|
case "moduleId":
|
|
1412
1412
|
if (moduleReason.moduleId === moduleReason.module && item.content) {
|
|
@@ -1437,14 +1437,14 @@ const SIMPLE_ELEMENT_JOINERS = {
|
|
|
1437
1437
|
},
|
|
1438
1438
|
"module.profile": joinInBrackets,
|
|
1439
1439
|
moduleIssuer: joinOneLine,
|
|
1440
|
-
chunkOrigin: items => `> ${joinOneLine(items)}`,
|
|
1440
|
+
chunkOrigin: (items) => `> ${joinOneLine(items)}`,
|
|
1441
1441
|
"errors[].error": joinError(true),
|
|
1442
1442
|
"warnings[].error": joinError(false),
|
|
1443
|
-
error: items => joinExplicitNewLine(items, ""),
|
|
1444
|
-
"error.errors[].error": items =>
|
|
1443
|
+
error: (items) => joinExplicitNewLine(items, ""),
|
|
1444
|
+
"error.errors[].error": (items) =>
|
|
1445
1445
|
indent(`[errors]: ${joinExplicitNewLine(items, "")}`, " "),
|
|
1446
|
-
loggingGroup: items => joinExplicitNewLine(items, "").trimEnd(),
|
|
1447
|
-
moduleTraceItem: items => ` @ ${joinOneLine(items)}`,
|
|
1446
|
+
loggingGroup: (items) => joinExplicitNewLine(items, "").trimEnd(),
|
|
1447
|
+
moduleTraceItem: (items) => ` @ ${joinOneLine(items)}`,
|
|
1448
1448
|
moduleTraceDependency: joinOneLine
|
|
1449
1449
|
};
|
|
1450
1450
|
|
|
@@ -1479,11 +1479,11 @@ const AVAILABLE_FORMATS = {
|
|
|
1479
1479
|
return `{${yellow(id)}}`;
|
|
1480
1480
|
}
|
|
1481
1481
|
},
|
|
1482
|
-
formatModuleId: id => `[${id}]`,
|
|
1482
|
+
formatModuleId: (id) => `[${id}]`,
|
|
1483
1483
|
formatFilename: (filename, { green, yellow }, oversize) =>
|
|
1484
1484
|
(oversize ? yellow : green)(filename),
|
|
1485
|
-
formatFlag: flag => `[${flag}]`,
|
|
1486
|
-
formatLayer: layer => `(in ${layer})`,
|
|
1485
|
+
formatFlag: (flag) => `[${flag}]`,
|
|
1486
|
+
formatLayer: (layer) => `(in ${layer})`,
|
|
1487
1487
|
formatSize: require("../SizeFormatHelpers").formatSize,
|
|
1488
1488
|
formatDateTime: (dateTime, { bold }) => {
|
|
1489
1489
|
const d = new Date(dateTime);
|
|
@@ -1559,7 +1559,7 @@ const AVAILABLE_FORMATS = {
|
|
|
1559
1559
|
/** @typedef {(result: string) => string} ResultModifierFn */
|
|
1560
1560
|
/** @type {Record<string, ResultModifierFn>} */
|
|
1561
1561
|
const RESULT_MODIFIER = {
|
|
1562
|
-
"module.modules": result => indent(result, "| ")
|
|
1562
|
+
"module.modules": (result) => indent(result, "| ")
|
|
1563
1563
|
};
|
|
1564
1564
|
|
|
1565
1565
|
/**
|
|
@@ -1597,7 +1597,7 @@ class DefaultStatsPrinterPlugin {
|
|
|
1597
1597
|
* @returns {void}
|
|
1598
1598
|
*/
|
|
1599
1599
|
apply(compiler) {
|
|
1600
|
-
compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
|
|
1600
|
+
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
|
|
1601
1601
|
compilation.hooks.statsPrinter.tap(PLUGIN_NAME, (stats, options) => {
|
|
1602
1602
|
// Put colors into context
|
|
1603
1603
|
stats.hooks.print
|
|
@@ -1621,7 +1621,7 @@ class DefaultStatsPrinterPlugin {
|
|
|
1621
1621
|
}
|
|
1622
1622
|
if (start) {
|
|
1623
1623
|
/** @type {ColorFunction} */
|
|
1624
|
-
context[color] = str =>
|
|
1624
|
+
context[color] = (str) =>
|
|
1625
1625
|
`${start}${
|
|
1626
1626
|
typeof str === "string"
|
|
1627
1627
|
? str.replace(
|
|
@@ -1636,7 +1636,7 @@ class DefaultStatsPrinterPlugin {
|
|
|
1636
1636
|
* @param {string} str string
|
|
1637
1637
|
* @returns {string} str string
|
|
1638
1638
|
*/
|
|
1639
|
-
context[color] = str => str;
|
|
1639
|
+
context[color] = (str) => str;
|
|
1640
1640
|
}
|
|
1641
1641
|
}
|
|
1642
1642
|
for (const _format of Object.keys(AVAILABLE_FORMATS)) {
|
|
@@ -273,7 +273,7 @@ class StatsFactory {
|
|
|
273
273
|
// sort items
|
|
274
274
|
/** @type {Comparator[]} */
|
|
275
275
|
const comparators = [];
|
|
276
|
-
this._forEachLevel(this.hooks.sort, this._caches.sort, type, h =>
|
|
276
|
+
this._forEachLevel(this.hooks.sort, this._caches.sort, type, (h) =>
|
|
277
277
|
h.call(comparators, context)
|
|
278
278
|
);
|
|
279
279
|
if (comparators.length > 0) {
|
|
@@ -306,7 +306,7 @@ class StatsFactory {
|
|
|
306
306
|
this.hooks.getItemName,
|
|
307
307
|
this._caches.getItemName,
|
|
308
308
|
`${type}[]`,
|
|
309
|
-
h => h.call(item, itemContext)
|
|
309
|
+
(h) => h.call(item, itemContext)
|
|
310
310
|
);
|
|
311
311
|
if (itemName) itemContext[itemName] = item;
|
|
312
312
|
const innerType = itemName ? `${type}[].${itemName}` : `${type}[]`;
|
|
@@ -317,7 +317,7 @@ class StatsFactory {
|
|
|
317
317
|
this.hooks.getItemFactory,
|
|
318
318
|
this._caches.getItemFactory,
|
|
319
319
|
innerType,
|
|
320
|
-
h => h.call(item, itemContext)
|
|
320
|
+
(h) => h.call(item, itemContext)
|
|
321
321
|
) || this;
|
|
322
322
|
|
|
323
323
|
// run item factory
|
|
@@ -331,7 +331,7 @@ class StatsFactory {
|
|
|
331
331
|
this.hooks.sortResults,
|
|
332
332
|
this._caches.sortResults,
|
|
333
333
|
type,
|
|
334
|
-
h => h.call(comparators2, context)
|
|
334
|
+
(h) => h.call(comparators2, context)
|
|
335
335
|
);
|
|
336
336
|
if (comparators2.length > 0) {
|
|
337
337
|
resultItems.sort(
|
|
@@ -347,7 +347,7 @@ class StatsFactory {
|
|
|
347
347
|
this.hooks.groupResults,
|
|
348
348
|
this._caches.groupResults,
|
|
349
349
|
type,
|
|
350
|
-
h => h.call(groupConfigs, context)
|
|
350
|
+
(h) => h.call(groupConfigs, context)
|
|
351
351
|
);
|
|
352
352
|
if (groupConfigs.length > 0) {
|
|
353
353
|
resultItems = smartGrouping(resultItems, groupConfigs);
|
|
@@ -368,7 +368,7 @@ class StatsFactory {
|
|
|
368
368
|
this.hooks.merge,
|
|
369
369
|
this._caches.merge,
|
|
370
370
|
type,
|
|
371
|
-
h => h.call(finalResultItems, context)
|
|
371
|
+
(h) => h.call(finalResultItems, context)
|
|
372
372
|
);
|
|
373
373
|
if (result === undefined) result = finalResultItems;
|
|
374
374
|
|
|
@@ -385,7 +385,7 @@ class StatsFactory {
|
|
|
385
385
|
const object = {};
|
|
386
386
|
|
|
387
387
|
// run extract on value
|
|
388
|
-
this._forEachLevel(this.hooks.extract, this._caches.extract, type, h =>
|
|
388
|
+
this._forEachLevel(this.hooks.extract, this._caches.extract, type, (h) =>
|
|
389
389
|
h.call(object, data, context)
|
|
390
390
|
);
|
|
391
391
|
|
|
@@ -210,13 +210,13 @@ class StatsPrinter {
|
|
|
210
210
|
};
|
|
211
211
|
|
|
212
212
|
/** @type {string | undefined} */
|
|
213
|
-
let printResult = this._forEachLevel(this.hooks.print, type, hook =>
|
|
213
|
+
let printResult = this._forEachLevel(this.hooks.print, type, (hook) =>
|
|
214
214
|
hook.call(object, context)
|
|
215
215
|
);
|
|
216
216
|
if (printResult === undefined) {
|
|
217
217
|
if (Array.isArray(object)) {
|
|
218
218
|
const sortedItems = [...object];
|
|
219
|
-
this._forEachLevel(this.hooks.sortItems, type, h =>
|
|
219
|
+
this._forEachLevel(this.hooks.sortItems, type, (h) =>
|
|
220
220
|
h.call(
|
|
221
221
|
sortedItems,
|
|
222
222
|
/** @type {StatsPrinterContextWithExtra} */
|
|
@@ -233,7 +233,7 @@ class StatsPrinter {
|
|
|
233
233
|
const itemName = this._forEachLevel(
|
|
234
234
|
this.hooks.getItemName,
|
|
235
235
|
`${type}[]`,
|
|
236
|
-
h => h.call(item, itemContext)
|
|
236
|
+
(h) => h.call(item, itemContext)
|
|
237
237
|
);
|
|
238
238
|
if (itemName) itemContext[itemName] = item;
|
|
239
239
|
return this.print(
|
|
@@ -242,7 +242,7 @@ class StatsPrinter {
|
|
|
242
242
|
itemContext
|
|
243
243
|
);
|
|
244
244
|
});
|
|
245
|
-
printResult = this._forEachLevel(this.hooks.printItems, type, h =>
|
|
245
|
+
printResult = this._forEachLevel(this.hooks.printItems, type, (h) =>
|
|
246
246
|
h.call(
|
|
247
247
|
/** @type {string[]} */ (printedItems),
|
|
248
248
|
/** @type {StatsPrinterContextWithExtra} */
|
|
@@ -255,16 +255,16 @@ class StatsPrinter {
|
|
|
255
255
|
}
|
|
256
256
|
} else if (object !== null && typeof object === "object") {
|
|
257
257
|
const elements = Object.keys(object).filter(
|
|
258
|
-
key => object[key] !== undefined
|
|
258
|
+
(key) => object[key] !== undefined
|
|
259
259
|
);
|
|
260
|
-
this._forEachLevel(this.hooks.sortElements, type, h =>
|
|
260
|
+
this._forEachLevel(this.hooks.sortElements, type, (h) =>
|
|
261
261
|
h.call(
|
|
262
262
|
elements,
|
|
263
263
|
/** @type {StatsPrinterContextWithExtra} */
|
|
264
264
|
(context)
|
|
265
265
|
)
|
|
266
266
|
);
|
|
267
|
-
const printedElements = elements.map(element => {
|
|
267
|
+
const printedElements = elements.map((element) => {
|
|
268
268
|
const content = this.print(`${type}.${element}`, object[element], {
|
|
269
269
|
...context,
|
|
270
270
|
_parent: object,
|
|
@@ -273,7 +273,7 @@ class StatsPrinter {
|
|
|
273
273
|
});
|
|
274
274
|
return { element, content };
|
|
275
275
|
});
|
|
276
|
-
printResult = this._forEachLevel(this.hooks.printElements, type, h =>
|
|
276
|
+
printResult = this._forEachLevel(this.hooks.printElements, type, (h) =>
|
|
277
277
|
h.call(
|
|
278
278
|
printedElements,
|
|
279
279
|
/** @type {StatsPrinterContextWithExtra} */
|
|
@@ -281,7 +281,7 @@ class StatsPrinter {
|
|
|
281
281
|
)
|
|
282
282
|
);
|
|
283
283
|
if (printResult === undefined) {
|
|
284
|
-
const result = printedElements.map(e => e.content).filter(Boolean);
|
|
284
|
+
const result = printedElements.map((e) => e.content).filter(Boolean);
|
|
285
285
|
if (result.length > 0) printResult = result.join("\n");
|
|
286
286
|
}
|
|
287
287
|
}
|