webpack 5.59.0 → 5.94.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 +48 -38
- package/bin/webpack.js +34 -10
- package/hot/dev-server.js +19 -5
- package/hot/lazy-compilation-node.js +13 -1
- package/hot/lazy-compilation-web.js +9 -0
- package/hot/log-apply-result.js +5 -0
- package/hot/log.js +23 -4
- package/hot/only-dev-server.js +3 -2
- package/hot/poll.js +5 -2
- package/hot/signal.js +6 -2
- package/lib/APIPlugin.js +226 -122
- package/lib/AbstractMethodError.js +10 -5
- package/lib/AsyncDependenciesBlock.js +13 -5
- package/lib/AutomaticPrefetchPlugin.js +2 -1
- package/lib/BannerPlugin.js +33 -12
- package/lib/Cache.js +16 -12
- package/lib/CacheFacade.js +13 -16
- package/lib/CaseSensitiveModulesWarning.js +8 -8
- package/lib/Chunk.js +60 -33
- package/lib/ChunkGraph.js +207 -72
- package/lib/ChunkGroup.js +40 -20
- package/lib/ChunkTemplate.js +43 -0
- package/lib/CleanPlugin.js +117 -32
- package/lib/CodeGenerationResults.js +8 -7
- package/lib/CommentCompilationWarning.js +0 -1
- package/lib/CompatibilityPlugin.js +85 -46
- package/lib/Compilation.js +712 -392
- package/lib/Compiler.js +393 -172
- package/lib/ConcatenationScope.js +10 -13
- package/lib/ConditionalInitFragment.js +22 -14
- package/lib/ConstPlugin.js +104 -64
- package/lib/ContextExclusionPlugin.js +3 -3
- package/lib/ContextModule.js +283 -108
- package/lib/ContextModuleFactory.js +151 -63
- package/lib/ContextReplacementPlugin.js +25 -10
- package/lib/CssModule.js +166 -0
- package/lib/DefinePlugin.js +254 -148
- package/lib/DelegatedModule.js +29 -6
- package/lib/DelegatedModuleFactoryPlugin.js +42 -22
- package/lib/DelegatedPlugin.js +4 -0
- package/lib/DependenciesBlock.js +17 -2
- package/lib/Dependency.js +58 -29
- package/lib/DependencyTemplate.js +24 -3
- package/lib/DependencyTemplates.js +2 -2
- package/lib/DllEntryPlugin.js +18 -1
- package/lib/DllModule.js +21 -4
- package/lib/DllModuleFactory.js +2 -1
- package/lib/DllPlugin.js +9 -7
- package/lib/DllReferencePlugin.js +50 -19
- package/lib/EntryOptionPlugin.js +6 -1
- package/lib/EntryPlugin.js +7 -4
- package/lib/Entrypoint.js +2 -2
- package/lib/EnvironmentNotSupportAsyncWarning.js +52 -0
- package/lib/EnvironmentPlugin.js +5 -2
- package/lib/ErrorHelpers.js +65 -26
- package/lib/EvalDevToolModulePlugin.js +37 -13
- package/lib/EvalSourceMapDevToolPlugin.js +50 -20
- package/lib/ExportsInfo.js +234 -133
- package/lib/ExportsInfoApiPlugin.js +31 -15
- package/lib/ExternalModule.js +391 -129
- package/lib/ExternalModuleFactoryPlugin.js +65 -17
- package/lib/FileSystemInfo.js +1038 -523
- package/lib/FlagAllModulesAsUsedPlugin.js +27 -27
- package/lib/FlagDependencyExportsPlugin.js +352 -349
- package/lib/FlagDependencyUsagePlugin.js +10 -10
- package/lib/FlagEntryExportAsUsedPlugin.js +26 -23
- package/lib/Generator.js +16 -8
- package/lib/GraphHelpers.js +3 -2
- package/lib/HookWebpackError.js +11 -13
- package/lib/HotModuleReplacementPlugin.js +221 -128
- package/lib/IgnoreErrorModuleFactory.js +4 -4
- package/lib/IgnorePlugin.js +5 -4
- package/lib/IgnoreWarningsPlugin.js +6 -9
- package/lib/InitFragment.js +39 -15
- package/lib/JavascriptMetaInfoPlugin.js +27 -15
- package/lib/LibManifestPlugin.js +45 -16
- package/lib/LoaderOptionsPlugin.js +13 -3
- package/lib/MainTemplate.js +74 -21
- package/lib/Module.js +155 -34
- package/lib/ModuleBuildError.js +13 -11
- package/lib/ModuleDependencyError.js +6 -4
- package/lib/ModuleDependencyWarning.js +6 -4
- package/lib/ModuleError.js +10 -5
- package/lib/ModuleFactory.js +4 -4
- package/lib/ModuleFilenameHelpers.js +164 -54
- package/lib/ModuleGraph.js +93 -53
- package/lib/ModuleGraphConnection.js +27 -13
- package/lib/ModuleHashingError.js +29 -0
- package/lib/ModuleInfoHeaderPlugin.js +92 -33
- package/lib/ModuleNotFoundError.js +5 -2
- package/lib/ModuleParseError.js +17 -9
- package/lib/ModuleProfile.js +1 -0
- package/lib/ModuleRestoreError.js +3 -1
- package/lib/ModuleStoreError.js +3 -2
- package/lib/ModuleTemplate.js +33 -1
- package/lib/ModuleTypeConstants.js +168 -0
- package/lib/ModuleWarning.js +10 -5
- package/lib/MultiCompiler.js +115 -38
- package/lib/MultiStats.js +75 -33
- package/lib/MultiWatching.js +6 -2
- package/lib/NodeStuffPlugin.js +136 -37
- package/lib/NormalModule.js +437 -194
- package/lib/NormalModuleFactory.js +313 -116
- package/lib/NormalModuleReplacementPlugin.js +10 -4
- package/lib/NullFactory.js +1 -1
- package/lib/OptimizationStages.js +3 -3
- package/lib/Parser.js +1 -1
- package/lib/PlatformPlugin.js +39 -0
- package/lib/PrefetchPlugin.js +4 -0
- package/lib/ProgressPlugin.js +83 -28
- package/lib/ProvidePlugin.js +37 -19
- package/lib/RawModule.js +18 -5
- package/lib/RecordIdsPlugin.js +8 -8
- package/lib/RequireJsStuffPlugin.js +22 -15
- package/lib/ResolverFactory.js +8 -4
- package/lib/RuntimeGlobals.js +99 -65
- package/lib/RuntimeModule.js +17 -15
- package/lib/RuntimePlugin.js +116 -13
- package/lib/RuntimeTemplate.js +304 -102
- package/lib/SelfModuleFactory.js +12 -0
- package/lib/SizeFormatHelpers.js +2 -4
- package/lib/SourceMapDevToolModuleOptionsPlugin.js +4 -0
- package/lib/SourceMapDevToolPlugin.js +89 -42
- package/lib/Stats.js +12 -7
- package/lib/Template.js +30 -33
- package/lib/TemplatedPathPlugin.js +102 -34
- package/lib/UseStrictPlugin.js +37 -12
- package/lib/WarnCaseSensitiveModulesPlugin.js +12 -0
- package/lib/WarnDeprecatedOptionPlugin.js +6 -0
- package/lib/WatchIgnorePlugin.js +46 -13
- package/lib/Watching.js +139 -76
- package/lib/WebpackError.js +14 -5
- package/lib/WebpackIsIncludedPlugin.js +22 -13
- package/lib/WebpackOptionsApply.js +162 -56
- package/lib/WebpackOptionsDefaulter.js +10 -3
- package/lib/asset/AssetGenerator.js +351 -99
- package/lib/asset/AssetModulesPlugin.js +57 -33
- package/lib/asset/AssetParser.js +15 -6
- package/lib/asset/AssetSourceGenerator.js +30 -10
- package/lib/asset/AssetSourceParser.js +8 -2
- package/lib/asset/RawDataUrlModule.js +162 -0
- package/lib/async-modules/AwaitDependenciesInitFragment.js +16 -13
- package/lib/async-modules/InferAsyncModulesPlugin.js +1 -1
- package/lib/buildChunkGraph.js +376 -420
- package/lib/cache/AddManagedPathsPlugin.js +6 -1
- package/lib/cache/IdleFileCachePlugin.js +26 -13
- package/lib/cache/MemoryCachePlugin.js +1 -1
- package/lib/cache/MemoryWithGcCachePlugin.js +13 -7
- package/lib/cache/PackFileCacheStrategy.js +172 -94
- package/lib/cache/ResolverCachePlugin.js +115 -43
- package/lib/cache/getLazyHashedEtag.js +2 -2
- package/lib/cache/mergeEtags.js +16 -21
- package/lib/cli.js +195 -110
- package/lib/config/browserslistTargetHandler.js +106 -41
- package/lib/config/defaults.js +572 -154
- package/lib/config/normalization.js +361 -322
- package/lib/config/target.js +105 -66
- package/lib/container/ContainerEntryDependency.js +2 -1
- package/lib/container/ContainerEntryModule.js +27 -11
- package/lib/container/ContainerEntryModuleFactory.js +1 -1
- package/lib/container/ContainerExposedDependency.js +9 -0
- package/lib/container/ContainerPlugin.js +18 -12
- package/lib/container/ContainerReferencePlugin.js +1 -1
- package/lib/container/FallbackDependency.js +13 -0
- package/lib/container/FallbackItemDependency.js +3 -0
- package/lib/container/FallbackModule.js +19 -8
- package/lib/container/FallbackModuleFactory.js +1 -1
- package/lib/container/ModuleFederationPlugin.js +2 -0
- package/lib/container/RemoteModule.js +17 -4
- package/lib/container/RemoteRuntimeModule.js +31 -17
- package/lib/container/RemoteToExternalDependency.js +3 -0
- package/lib/container/options.js +18 -4
- package/lib/css/CssExportsGenerator.js +203 -0
- package/lib/css/CssGenerator.js +151 -0
- package/lib/css/CssLoadingRuntimeModule.js +592 -0
- package/lib/css/CssModulesPlugin.js +888 -0
- package/lib/css/CssParser.js +1049 -0
- package/lib/css/walkCssTokens.js +775 -0
- package/lib/debug/ProfilingPlugin.js +102 -54
- package/lib/dependencies/AMDDefineDependency.js +54 -10
- package/lib/dependencies/AMDDefineDependencyParserPlugin.js +204 -61
- package/lib/dependencies/AMDPlugin.js +44 -24
- package/lib/dependencies/AMDRequireArrayDependency.js +34 -10
- package/lib/dependencies/AMDRequireContextDependency.js +15 -0
- package/lib/dependencies/AMDRequireDependenciesBlock.js +6 -0
- package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +185 -54
- package/lib/dependencies/AMDRequireDependency.js +21 -6
- package/lib/dependencies/AMDRequireItemDependency.js +6 -0
- package/lib/dependencies/AMDRuntimeModules.js +4 -4
- package/lib/dependencies/CachedConstDependency.js +22 -1
- package/lib/dependencies/CommonJsDependencyHelpers.js +16 -2
- package/lib/dependencies/CommonJsExportRequireDependency.js +77 -47
- package/lib/dependencies/CommonJsExportsDependency.js +28 -5
- package/lib/dependencies/CommonJsExportsParserPlugin.js +111 -39
- package/lib/dependencies/CommonJsFullRequireDependency.js +42 -8
- package/lib/dependencies/CommonJsImportsParserPlugin.js +530 -130
- package/lib/dependencies/CommonJsPlugin.js +51 -26
- package/lib/dependencies/CommonJsRequireContextDependency.js +23 -2
- package/lib/dependencies/CommonJsRequireDependency.js +9 -1
- package/lib/dependencies/CommonJsSelfReferenceDependency.js +22 -8
- package/lib/dependencies/ConstDependency.js +12 -3
- package/lib/dependencies/ContextDependency.js +32 -5
- package/lib/dependencies/ContextDependencyHelpers.js +92 -62
- package/lib/dependencies/ContextDependencyTemplateAsRequireCall.js +4 -1
- package/lib/dependencies/ContextElementDependency.js +41 -4
- package/lib/dependencies/CreateScriptUrlDependency.js +22 -1
- package/lib/dependencies/CriticalDependencyWarning.js +4 -1
- package/lib/dependencies/CssExportDependency.js +156 -0
- package/lib/dependencies/CssImportDependency.js +125 -0
- package/lib/dependencies/CssLocalIdentifierDependency.js +245 -0
- package/lib/dependencies/CssSelfLocalIdentifierDependency.js +111 -0
- package/lib/dependencies/CssUrlDependency.js +164 -0
- package/lib/dependencies/DelegatedSourceDependency.js +3 -0
- package/lib/dependencies/DllEntryDependency.js +14 -0
- package/lib/dependencies/DynamicExports.js +15 -11
- package/lib/dependencies/ExportsInfoDependency.js +26 -5
- package/lib/dependencies/ExternalModuleDependency.js +109 -0
- package/lib/dependencies/ExternalModuleInitFragment.js +133 -0
- package/lib/dependencies/HarmonyAcceptDependency.js +11 -2
- package/lib/dependencies/HarmonyAcceptImportDependency.js +9 -4
- package/lib/dependencies/HarmonyCompatibilityDependency.js +6 -5
- package/lib/dependencies/HarmonyDetectionParserPlugin.js +29 -3
- package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +152 -0
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +96 -51
- package/lib/dependencies/HarmonyExportExpressionDependency.js +21 -4
- package/lib/dependencies/HarmonyExportHeaderDependency.js +13 -0
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +216 -108
- package/lib/dependencies/HarmonyExportInitFragment.js +21 -9
- package/lib/dependencies/HarmonyExportSpecifierDependency.js +12 -0
- package/lib/dependencies/HarmonyExports.js +13 -7
- package/lib/dependencies/HarmonyImportDependency.js +65 -19
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +268 -74
- package/lib/dependencies/HarmonyImportSideEffectDependency.js +11 -5
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +180 -36
- package/lib/dependencies/HarmonyModulesPlugin.js +33 -5
- package/lib/dependencies/HarmonyTopLevelThisParserPlugin.js +15 -3
- package/lib/dependencies/ImportContextDependency.js +15 -2
- package/lib/dependencies/ImportDependency.js +50 -12
- package/lib/dependencies/ImportEagerDependency.js +11 -6
- package/lib/dependencies/ImportMetaContextDependency.js +42 -0
- package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +301 -0
- package/lib/dependencies/ImportMetaContextPlugin.js +72 -0
- package/lib/dependencies/ImportMetaHotAcceptDependency.js +6 -0
- package/lib/dependencies/ImportMetaHotDeclineDependency.js +6 -0
- package/lib/dependencies/ImportMetaPlugin.js +128 -59
- package/lib/dependencies/ImportParserPlugin.js +153 -83
- package/lib/dependencies/ImportPlugin.js +21 -7
- package/lib/dependencies/ImportWeakDependency.js +11 -6
- package/lib/dependencies/JsonExportsDependency.js +38 -30
- package/lib/dependencies/LoaderDependency.js +14 -0
- package/lib/dependencies/LoaderImportDependency.js +14 -0
- package/lib/dependencies/LoaderPlugin.js +54 -40
- package/lib/dependencies/LocalModule.js +17 -1
- package/lib/dependencies/LocalModuleDependency.js +15 -0
- package/lib/dependencies/LocalModulesHelpers.js +22 -4
- package/lib/dependencies/ModuleDecoratorDependency.js +9 -1
- package/lib/dependencies/ModuleDependency.js +24 -7
- package/lib/dependencies/ModuleDependencyTemplateAsId.js +2 -1
- package/lib/dependencies/ModuleHotAcceptDependency.js +6 -0
- package/lib/dependencies/ModuleHotDeclineDependency.js +6 -0
- package/lib/dependencies/PrefetchDependency.js +3 -0
- package/lib/dependencies/ProvidedDependency.js +43 -8
- package/lib/dependencies/PureExpressionDependency.js +73 -39
- package/lib/dependencies/RequireContextDependency.js +6 -16
- package/lib/dependencies/RequireContextDependencyParserPlugin.js +14 -6
- package/lib/dependencies/RequireContextPlugin.js +20 -7
- package/lib/dependencies/RequireEnsureDependenciesBlock.js +7 -0
- package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +29 -12
- package/lib/dependencies/RequireEnsureDependency.js +16 -2
- package/lib/dependencies/RequireEnsureItemDependency.js +3 -0
- package/lib/dependencies/RequireEnsurePlugin.js +27 -7
- package/lib/dependencies/RequireHeaderDependency.js +14 -1
- package/lib/dependencies/RequireIncludeDependency.js +6 -1
- package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +29 -5
- package/lib/dependencies/RequireIncludePlugin.js +25 -5
- package/lib/dependencies/RequireResolveContextDependency.js +19 -2
- package/lib/dependencies/RequireResolveDependency.js +8 -1
- package/lib/dependencies/RequireResolveHeaderDependency.js +18 -0
- package/lib/dependencies/RuntimeRequirementsDependency.js +9 -1
- package/lib/dependencies/StaticExportsDependency.js +8 -0
- package/lib/dependencies/SystemPlugin.js +49 -22
- package/lib/dependencies/SystemRuntimeModule.js +1 -1
- package/lib/dependencies/URLDependency.js +20 -13
- package/lib/dependencies/URLPlugin.js +115 -27
- package/lib/dependencies/UnsupportedDependency.js +13 -0
- package/lib/dependencies/WebAssemblyExportImportedDependency.js +14 -0
- package/lib/dependencies/WebAssemblyImportDependency.js +9 -1
- package/lib/dependencies/WebpackIsIncludedDependency.js +6 -1
- package/lib/dependencies/WorkerDependency.js +47 -3
- package/lib/dependencies/WorkerPlugin.js +143 -59
- package/lib/dependencies/getFunctionExpression.js +9 -0
- package/lib/dependencies/processExportInfo.js +3 -1
- package/lib/electron/ElectronTargetPlugin.js +1 -0
- package/lib/esm/ExportWebpackRequireRuntimeModule.js +3 -2
- package/lib/esm/ModuleChunkFormatPlugin.js +92 -55
- package/lib/esm/ModuleChunkLoadingPlugin.js +12 -1
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +141 -25
- package/lib/formatLocation.js +1 -2
- package/lib/hmr/HotModuleReplacement.runtime.js +37 -25
- package/lib/hmr/HotModuleReplacementRuntimeModule.js +2 -1
- package/lib/hmr/JavascriptHotModuleReplacement.runtime.js +13 -15
- package/lib/hmr/LazyCompilationPlugin.js +94 -41
- package/lib/hmr/lazyCompilationBackend.js +107 -44
- package/lib/ids/ChunkModuleIdRangePlugin.js +12 -3
- package/lib/ids/DeterministicChunkIdsPlugin.js +13 -6
- package/lib/ids/DeterministicModuleIdsPlugin.js +59 -35
- package/lib/ids/HashedModuleIdsPlugin.js +24 -16
- package/lib/ids/IdHelpers.js +59 -49
- package/lib/ids/NamedChunkIdsPlugin.js +13 -1
- package/lib/ids/NamedModuleIdsPlugin.js +20 -12
- package/lib/ids/NaturalModuleIdsPlugin.js +10 -13
- package/lib/ids/OccurrenceChunkIdsPlugin.js +6 -2
- package/lib/ids/OccurrenceModuleIdsPlugin.js +14 -11
- package/lib/ids/SyncModuleIdsPlugin.js +146 -0
- package/lib/index.js +44 -5
- package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +9 -7
- package/lib/javascript/BasicEvaluatedExpression.js +133 -19
- package/lib/javascript/ChunkHelpers.js +33 -0
- package/lib/javascript/CommonJsChunkFormatPlugin.js +18 -15
- package/lib/javascript/EnableChunkLoadingPlugin.js +11 -6
- package/lib/javascript/JavascriptGenerator.js +37 -6
- package/lib/javascript/JavascriptModulesPlugin.js +523 -295
- package/lib/javascript/JavascriptParser.js +1591 -574
- package/lib/javascript/JavascriptParserHelpers.js +58 -37
- package/lib/javascript/StartupHelpers.js +69 -47
- package/lib/json/JsonData.js +33 -0
- package/lib/json/JsonGenerator.js +29 -21
- package/lib/json/JsonModulesPlugin.js +13 -7
- package/lib/json/JsonParser.js +30 -16
- package/lib/library/AbstractLibraryPlugin.js +6 -2
- package/lib/library/AmdLibraryPlugin.js +34 -18
- package/lib/library/AssignLibraryPlugin.js +68 -32
- package/lib/library/EnableLibraryPlugin.js +39 -14
- package/lib/library/ExportPropertyLibraryPlugin.js +14 -5
- package/lib/library/JsonpLibraryPlugin.js +4 -3
- package/lib/library/ModernModuleLibraryPlugin.js +144 -0
- package/lib/library/ModuleLibraryPlugin.js +12 -7
- package/lib/library/SystemLibraryPlugin.js +6 -4
- package/lib/library/UmdLibraryPlugin.js +119 -100
- package/lib/logging/Logger.js +59 -6
- package/lib/logging/createConsoleLogger.js +25 -40
- package/lib/logging/runtime.js +8 -9
- package/lib/logging/truncateArgs.js +9 -8
- package/lib/node/CommonJsChunkLoadingPlugin.js +18 -2
- package/lib/node/NodeEnvironmentPlugin.js +14 -8
- package/lib/node/NodeTargetPlugin.js +7 -0
- package/lib/node/NodeTemplatePlugin.js +10 -2
- package/lib/node/NodeWatchFileSystem.js +100 -50
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +51 -26
- package/lib/node/ReadFileCompileAsyncWasmPlugin.js +13 -2
- package/lib/node/ReadFileCompileWasmPlugin.js +21 -3
- package/lib/node/RequireChunkLoadingRuntimeModule.js +49 -26
- package/lib/node/nodeConsole.js +48 -31
- package/lib/optimize/AggressiveMergingPlugin.js +10 -4
- package/lib/optimize/AggressiveSplittingPlugin.js +26 -21
- package/lib/optimize/ConcatenatedModule.js +353 -212
- package/lib/optimize/EnsureChunkConditionsPlugin.js +4 -1
- package/lib/optimize/FlagIncludedChunksPlugin.js +14 -8
- package/lib/optimize/InnerGraph.js +30 -25
- package/lib/optimize/InnerGraphPlugin.js +105 -64
- package/lib/optimize/LimitChunkCountPlugin.js +32 -9
- package/lib/optimize/MangleExportsPlugin.js +7 -2
- package/lib/optimize/MinMaxSizeWarning.js +6 -1
- package/lib/optimize/ModuleConcatenationPlugin.js +150 -83
- package/lib/optimize/RealContentHashPlugin.js +99 -43
- package/lib/optimize/RemoveParentModulesPlugin.js +131 -48
- package/lib/optimize/RuntimeChunkPlugin.js +15 -2
- package/lib/optimize/SideEffectsFlagPlugin.js +119 -63
- package/lib/optimize/SplitChunksPlugin.js +129 -78
- package/lib/performance/SizeLimitsPlugin.js +22 -8
- package/lib/prefetch/ChunkPrefetchFunctionRuntimeModule.js +4 -2
- package/lib/prefetch/ChunkPrefetchPreloadPlugin.js +4 -1
- package/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js +8 -5
- package/lib/prefetch/ChunkPrefetchTriggerRuntimeModule.js +5 -3
- package/lib/prefetch/ChunkPreloadTriggerRuntimeModule.js +5 -3
- package/lib/rules/BasicEffectRulePlugin.js +7 -1
- package/lib/rules/BasicMatcherRulePlugin.js +8 -1
- package/lib/rules/ObjectMatcherRulePlugin.js +19 -2
- package/lib/rules/RuleSetCompiler.js +53 -32
- package/lib/rules/UseEffectRulePlugin.js +42 -36
- package/lib/runtime/AsyncModuleRuntimeModule.js +56 -69
- package/lib/runtime/AutoPublicPathRuntimeModule.js +25 -9
- package/lib/runtime/BaseUriRuntimeModule.js +35 -0
- package/lib/runtime/ChunkNameRuntimeModule.js +1 -1
- package/lib/runtime/CompatGetDefaultExportRuntimeModule.js +5 -2
- package/lib/runtime/CompatRuntimeModule.js +7 -2
- package/lib/runtime/CreateFakeNamespaceObjectRuntimeModule.js +7 -4
- package/lib/runtime/CreateScriptRuntimeModule.js +38 -0
- package/lib/runtime/CreateScriptUrlRuntimeModule.js +13 -36
- package/lib/runtime/DefinePropertyGettersRuntimeModule.js +6 -3
- package/lib/runtime/EnsureChunkRuntimeModule.js +29 -15
- package/lib/runtime/GetChunkFilenameRuntimeModule.js +56 -43
- package/lib/runtime/GetFullHashRuntimeModule.js +4 -3
- package/lib/runtime/GetMainFilenameRuntimeModule.js +5 -2
- package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +98 -0
- package/lib/runtime/GlobalRuntimeModule.js +1 -1
- package/lib/runtime/HasOwnPropertyRuntimeModule.js +5 -2
- package/lib/runtime/LoadScriptRuntimeModule.js +61 -45
- package/lib/runtime/MakeNamespaceObjectRuntimeModule.js +5 -2
- package/lib/runtime/NonceRuntimeModule.js +24 -0
- package/lib/runtime/OnChunksLoadedRuntimeModule.js +4 -2
- package/lib/runtime/PublicPathRuntimeModule.js +9 -2
- package/lib/runtime/RelativeUrlRuntimeModule.js +5 -2
- package/lib/runtime/RuntimeIdRuntimeModule.js +6 -2
- package/lib/runtime/StartupChunkDependenciesPlugin.js +15 -0
- package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +36 -28
- package/lib/runtime/StartupEntrypointRuntimeModule.js +13 -9
- package/lib/runtime/SystemContextRuntimeModule.js +1 -1
- package/lib/schemes/DataUriPlugin.js +16 -3
- package/lib/schemes/HttpUriPlugin.js +336 -120
- package/lib/serialization/ArraySerializer.js +22 -6
- package/lib/serialization/BinaryMiddleware.js +212 -33
- package/lib/serialization/DateObjectSerializer.js +16 -4
- package/lib/serialization/ErrorObjectSerializer.js +23 -6
- package/lib/serialization/FileMiddleware.js +187 -86
- package/lib/serialization/MapObjectSerializer.js +25 -8
- package/lib/serialization/NullPrototypeObjectSerializer.js +26 -8
- package/lib/serialization/ObjectMiddleware.js +96 -66
- package/lib/serialization/PlainObjectSerializer.js +51 -14
- package/lib/serialization/RegExpObjectSerializer.js +17 -5
- package/lib/serialization/Serializer.js +23 -5
- package/lib/serialization/SerializerMiddleware.js +8 -8
- package/lib/serialization/SetObjectSerializer.js +22 -6
- package/lib/serialization/SingleItemMiddleware.js +2 -2
- package/lib/serialization/types.js +2 -2
- package/lib/sharing/ConsumeSharedFallbackDependency.js +3 -0
- package/lib/sharing/ConsumeSharedModule.js +40 -17
- package/lib/sharing/ConsumeSharedPlugin.js +139 -102
- package/lib/sharing/ConsumeSharedRuntimeModule.js +144 -130
- package/lib/sharing/ProvideForSharedDependency.js +0 -1
- package/lib/sharing/ProvideSharedDependency.js +17 -0
- package/lib/sharing/ProvideSharedModule.js +19 -6
- package/lib/sharing/ProvideSharedModuleFactory.js +1 -1
- package/lib/sharing/ProvideSharedPlugin.js +37 -30
- package/lib/sharing/SharePlugin.js +2 -2
- package/lib/sharing/ShareRuntimeModule.js +20 -10
- package/lib/sharing/resolveMatchedConfigs.js +6 -5
- package/lib/sharing/utils.js +338 -34
- package/lib/stats/DefaultStatsFactoryPlugin.js +660 -396
- package/lib/stats/DefaultStatsPresetPlugin.js +85 -25
- package/lib/stats/DefaultStatsPrinterPlugin.js +525 -145
- package/lib/stats/StatsFactory.js +128 -57
- package/lib/stats/StatsPrinter.js +77 -46
- package/lib/util/ArrayHelpers.js +35 -1
- package/lib/util/ArrayQueue.js +15 -22
- package/lib/util/AsyncQueue.js +37 -16
- package/lib/util/IterableHelpers.js +3 -4
- package/lib/util/LazyBucketSortedSet.js +60 -44
- package/lib/util/LazySet.js +11 -2
- package/lib/util/MapHelpers.js +17 -5
- package/lib/util/ParallelismFactorCalculator.js +11 -1
- package/lib/util/Queue.js +9 -3
- package/lib/util/Semaphore.js +4 -7
- package/lib/util/SetHelpers.js +5 -5
- package/lib/util/SortableSet.js +19 -6
- package/lib/util/StackedCacheMap.js +33 -3
- package/lib/util/StackedMap.js +1 -3
- package/lib/util/StringXor.js +46 -0
- package/lib/util/TupleQueue.js +9 -3
- package/lib/util/TupleSet.js +15 -5
- package/lib/util/URLAbsoluteSpecifier.js +8 -8
- package/lib/util/WeakTupleMap.js +70 -28
- package/lib/util/binarySearchBounds.js +51 -9
- package/lib/util/chainedImports.js +97 -0
- package/lib/util/cleverMerge.js +51 -36
- package/lib/util/comparators.js +146 -83
- package/lib/util/compileBooleanMatcher.js +35 -7
- package/lib/util/conventions.js +126 -0
- package/lib/util/create-schema-validation.js +9 -2
- package/lib/util/createHash.js +49 -14
- package/lib/util/deprecation.js +48 -15
- package/lib/util/deterministicGrouping.js +71 -39
- package/lib/util/extractUrlAndGlobal.js +3 -0
- package/lib/util/findGraphRoots.js +7 -5
- package/lib/util/fs.js +419 -94
- package/lib/util/hash/BatchedHash.js +10 -4
- package/lib/util/hash/md4.js +20 -0
- package/lib/util/hash/wasm-hash.js +163 -0
- package/lib/util/hash/xxhash64.js +7 -141
- package/lib/util/identifier.js +140 -93
- package/lib/util/internalSerializables.js +22 -0
- package/lib/util/makeSerializable.js +7 -0
- package/lib/util/memoize.js +10 -10
- package/lib/util/mergeScope.js +76 -0
- package/lib/util/nonNumericOnlyHash.js +22 -0
- package/lib/util/numberHash.js +84 -34
- package/lib/util/objectToMap.js +0 -1
- package/lib/util/processAsyncTree.js +7 -1
- package/lib/util/propertyAccess.js +7 -55
- package/lib/util/propertyName.js +77 -0
- package/lib/util/registerExternalSerializer.js +2 -2
- package/lib/util/runtime.js +188 -133
- package/lib/util/semver.js +64 -56
- package/lib/util/serialization.js +26 -1
- package/lib/util/smartGrouping.js +10 -10
- package/lib/util/source.js +1 -1
- package/lib/validateSchema.js +6 -2
- package/lib/wasm/EnableWasmLoadingPlugin.js +9 -4
- package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +70 -30
- package/lib/wasm-async/AsyncWebAssemblyGenerator.js +9 -1
- package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +34 -16
- package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +32 -12
- package/lib/wasm-async/AsyncWebAssemblyParser.js +17 -4
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +72 -31
- package/lib/wasm-sync/WasmFinalizeExportsPlugin.js +17 -6
- package/lib/wasm-sync/WebAssemblyGenerator.js +72 -52
- package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +5 -4
- package/lib/wasm-sync/WebAssemblyModulesPlugin.js +53 -43
- package/lib/wasm-sync/WebAssemblyParser.js +23 -9
- package/lib/wasm-sync/WebAssemblyUtils.js +5 -4
- package/lib/web/FetchCompileAsyncWasmPlugin.js +11 -1
- package/lib/web/FetchCompileWasmPlugin.js +59 -42
- package/lib/web/JsonpChunkLoadingPlugin.js +9 -0
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +71 -41
- package/lib/webpack.js +43 -12
- package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +15 -12
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +55 -40
- package/module.d.ts +233 -0
- package/package.json +85 -139
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +679 -47
- package/schemas/plugins/BannerPlugin.check.js +1 -1
- package/schemas/plugins/BannerPlugin.json +9 -1
- package/schemas/plugins/DllReferencePlugin.check.js +1 -1
- package/schemas/plugins/HashedModuleIdsPlugin.check.js +1 -1
- package/schemas/plugins/ProgressPlugin.check.js +1 -1
- package/schemas/plugins/SourceMapDevToolPlugin.check.js +1 -1
- package/schemas/plugins/SourceMapDevToolPlugin.json +4 -0
- package/schemas/plugins/asset/AssetGeneratorOptions.check.js +1 -1
- package/schemas/plugins/asset/AssetInlineGeneratorOptions.check.js +1 -1
- package/schemas/plugins/asset/AssetParserOptions.check.js +1 -1
- package/schemas/plugins/asset/AssetResourceGeneratorOptions.check.js +1 -1
- package/schemas/plugins/container/ContainerPlugin.check.js +1 -1
- package/schemas/plugins/container/ContainerPlugin.json +10 -1
- package/schemas/plugins/container/ContainerReferencePlugin.check.js +1 -1
- package/schemas/plugins/container/ContainerReferencePlugin.json +2 -0
- package/schemas/plugins/container/ExternalsType.check.js +1 -1
- package/schemas/plugins/container/ModuleFederationPlugin.check.js +1 -1
- package/schemas/plugins/container/ModuleFederationPlugin.json +12 -1
- package/schemas/plugins/css/CssAutoGeneratorOptions.check.d.ts +7 -0
- package/schemas/plugins/css/CssAutoGeneratorOptions.check.js +6 -0
- package/schemas/plugins/css/CssAutoGeneratorOptions.json +3 -0
- package/schemas/plugins/css/CssAutoParserOptions.check.d.ts +7 -0
- package/schemas/plugins/css/CssAutoParserOptions.check.js +6 -0
- package/schemas/plugins/css/CssAutoParserOptions.json +3 -0
- package/schemas/plugins/css/CssGeneratorOptions.check.d.ts +7 -0
- package/schemas/plugins/css/CssGeneratorOptions.check.js +6 -0
- package/schemas/plugins/css/CssGeneratorOptions.json +3 -0
- package/schemas/plugins/css/CssGlobalGeneratorOptions.check.d.ts +7 -0
- package/schemas/plugins/css/CssGlobalGeneratorOptions.check.js +6 -0
- package/schemas/plugins/css/CssGlobalGeneratorOptions.json +3 -0
- package/schemas/plugins/css/CssGlobalParserOptions.check.d.ts +7 -0
- package/schemas/plugins/css/CssGlobalParserOptions.check.js +6 -0
- package/schemas/plugins/css/CssGlobalParserOptions.json +3 -0
- package/schemas/plugins/css/CssModuleGeneratorOptions.check.d.ts +7 -0
- package/schemas/plugins/css/CssModuleGeneratorOptions.check.js +6 -0
- package/schemas/plugins/css/CssModuleGeneratorOptions.json +3 -0
- package/schemas/plugins/css/CssModuleParserOptions.check.d.ts +7 -0
- package/schemas/plugins/css/CssModuleParserOptions.check.js +6 -0
- package/schemas/plugins/css/CssModuleParserOptions.json +3 -0
- package/schemas/plugins/css/CssParserOptions.check.d.ts +7 -0
- package/schemas/plugins/css/CssParserOptions.check.js +6 -0
- package/schemas/plugins/css/CssParserOptions.json +3 -0
- package/schemas/plugins/optimize/AggressiveSplittingPlugin.check.js +1 -1
- package/schemas/plugins/optimize/LimitChunkCountPlugin.check.js +1 -1
- package/schemas/plugins/optimize/MinChunkSizePlugin.check.js +1 -1
- package/schemas/plugins/schemes/HttpUriPlugin.check.js +1 -1
- package/schemas/plugins/schemes/HttpUriPlugin.json +4 -0
- package/schemas/plugins/sharing/SharePlugin.check.js +1 -1
- package/types.d.ts +5026 -1756
@@ -6,16 +6,27 @@
|
|
6
6
|
"use strict";
|
7
7
|
|
8
8
|
/** @typedef {import("../Compiler")} Compiler */
|
9
|
+
/** @typedef {import("./DefaultStatsFactoryPlugin").KnownStatsChunkGroup} KnownStatsChunkGroup */
|
9
10
|
/** @typedef {import("./StatsPrinter")} StatsPrinter */
|
11
|
+
/** @typedef {import("./StatsPrinter").KnownStatsPrinterColorFn} KnownStatsPrinterColorFn */
|
12
|
+
/** @typedef {import("./StatsPrinter").KnownStatsPrinterFormaters} KnownStatsPrinterFormaters */
|
10
13
|
/** @typedef {import("./StatsPrinter").StatsPrinterContext} StatsPrinterContext */
|
11
14
|
|
15
|
+
const DATA_URI_CONTENT_LENGTH = 16;
|
16
|
+
const MAX_MODULE_IDENTIFIER_LENGTH = 80;
|
17
|
+
|
18
|
+
/**
|
19
|
+
* @param {number} n a number
|
20
|
+
* @param {string} singular singular
|
21
|
+
* @param {string} plural plural
|
22
|
+
* @returns {string} if n is 1, singular, else plural
|
23
|
+
*/
|
12
24
|
const plural = (n, singular, plural) => (n === 1 ? singular : plural);
|
13
25
|
|
14
26
|
/**
|
15
27
|
* @param {Record<string, number>} sizes sizes by source type
|
16
|
-
* @param {
|
17
|
-
* @
|
18
|
-
* @returns {string} text
|
28
|
+
* @param {StatsPrinterContext} options options
|
29
|
+
* @returns {string | undefined} text
|
19
30
|
*/
|
20
31
|
const printSizes = (sizes, { formatSize = n => `${n}` }) => {
|
21
32
|
const keys = Object.keys(sizes);
|
@@ -26,6 +37,51 @@ const printSizes = (sizes, { formatSize = n => `${n}` }) => {
|
|
26
37
|
}
|
27
38
|
};
|
28
39
|
|
40
|
+
/**
|
41
|
+
* @param {string} resource resource
|
42
|
+
* @returns {string} resource name for display
|
43
|
+
*/
|
44
|
+
const getResourceName = resource => {
|
45
|
+
const dataUrl = /^data:[^,]+,/.exec(resource);
|
46
|
+
if (!dataUrl) return resource;
|
47
|
+
|
48
|
+
const len = dataUrl[0].length + DATA_URI_CONTENT_LENGTH;
|
49
|
+
if (resource.length < len) return resource;
|
50
|
+
return `${resource.slice(
|
51
|
+
0,
|
52
|
+
Math.min(resource.length - /* '..'.length */ 2, len)
|
53
|
+
)}..`;
|
54
|
+
};
|
55
|
+
|
56
|
+
/**
|
57
|
+
* @param {string} name module name
|
58
|
+
* @returns {[string,string]} prefix and module name
|
59
|
+
*/
|
60
|
+
const getModuleName = name => {
|
61
|
+
const [, prefix, resource] =
|
62
|
+
/** @type {[any, string, string]} */
|
63
|
+
(/** @type {unknown} */ (/^(.*!)?([^!]*)$/.exec(name)));
|
64
|
+
|
65
|
+
if (resource.length > MAX_MODULE_IDENTIFIER_LENGTH) {
|
66
|
+
const truncatedResource = `${resource.slice(
|
67
|
+
0,
|
68
|
+
Math.min(
|
69
|
+
resource.length - /* '...(truncated)'.length */ 14,
|
70
|
+
MAX_MODULE_IDENTIFIER_LENGTH
|
71
|
+
)
|
72
|
+
)}...(truncated)`;
|
73
|
+
|
74
|
+
return [prefix, getResourceName(truncatedResource)];
|
75
|
+
}
|
76
|
+
|
77
|
+
return [prefix, getResourceName(resource)];
|
78
|
+
};
|
79
|
+
|
80
|
+
/**
|
81
|
+
* @param {string} str string
|
82
|
+
* @param {function(string): string} fn function to apply to each line
|
83
|
+
* @returns {string} joined string
|
84
|
+
*/
|
29
85
|
const mapLines = (str, fn) => str.split("\n").map(fn).join("\n");
|
30
86
|
|
31
87
|
/**
|
@@ -34,12 +90,29 @@ const mapLines = (str, fn) => str.split("\n").map(fn).join("\n");
|
|
34
90
|
*/
|
35
91
|
const twoDigit = n => (n >= 10 ? `${n}` : `0${n}`);
|
36
92
|
|
37
|
-
|
38
|
-
|
39
|
-
}
|
93
|
+
/**
|
94
|
+
* @param {string | number} id an id
|
95
|
+
* @returns {boolean | string} is i
|
96
|
+
*/
|
97
|
+
const isValidId = id => typeof id === "number" || id;
|
98
|
+
|
99
|
+
/**
|
100
|
+
* @template T
|
101
|
+
* @param {Array<T> | undefined} list of items
|
102
|
+
* @param {number} count number of items to show
|
103
|
+
* @returns {string} string representation of list
|
104
|
+
*/
|
105
|
+
const moreCount = (list, count) =>
|
106
|
+
list && list.length > 0 ? `+ ${count}` : `${count}`;
|
40
107
|
|
41
|
-
/**
|
42
|
-
|
108
|
+
/**
|
109
|
+
* @template T
|
110
|
+
* @template {keyof T} K
|
111
|
+
* @typedef {{ [P in K]-?: T[P] }} WithRequired
|
112
|
+
*/
|
113
|
+
|
114
|
+
/** @type {Record<string, (thing: any, context: Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation">, printer: StatsPrinter) => string | undefined>} */
|
115
|
+
const COMPILATION_SIMPLE_PRINTERS = {
|
43
116
|
"compilation.summary!": (
|
44
117
|
_,
|
45
118
|
{
|
@@ -63,14 +136,16 @@ const SIMPLE_PRINTERS = {
|
|
63
136
|
) => {
|
64
137
|
const root = type === "compilation.summary!";
|
65
138
|
const warningsMessage =
|
66
|
-
warningsCount > 0
|
139
|
+
/** @type {number} */ (warningsCount) > 0
|
67
140
|
? yellow(
|
68
|
-
`${warningsCount} ${plural(warningsCount, "warning", "warnings")}`
|
69
|
-
|
141
|
+
`${warningsCount} ${plural(/** @type {number} */ (warningsCount), "warning", "warnings")}`
|
142
|
+
)
|
70
143
|
: "";
|
71
144
|
const errorsMessage =
|
72
|
-
errorsCount > 0
|
73
|
-
? red(
|
145
|
+
/** @type {number} */ (errorsCount) > 0
|
146
|
+
? red(
|
147
|
+
`${errorsCount} ${plural(/** @type {number} */ (errorsCount), "error", "errors")}`
|
148
|
+
)
|
74
149
|
: "";
|
75
150
|
const timeMessage = root && time ? ` in ${formatTime(time)}` : "";
|
76
151
|
const hashMessage = hash ? ` (${hash})` : "";
|
@@ -81,10 +156,10 @@ const SIMPLE_PRINTERS = {
|
|
81
156
|
root && name
|
82
157
|
? bold(name)
|
83
158
|
: name
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
159
|
+
? `Child ${bold(name)}`
|
160
|
+
: root
|
161
|
+
? ""
|
162
|
+
: "Child";
|
88
163
|
const subjectMessage =
|
89
164
|
nameMessage && versionMessage
|
90
165
|
? `${nameMessage} (${versionMessage})`
|
@@ -99,7 +174,7 @@ const SIMPLE_PRINTERS = {
|
|
99
174
|
} else if (errorsCount === 0 && warningsCount === 0) {
|
100
175
|
statusMessage = `compiled ${green("successfully")}`;
|
101
176
|
} else {
|
102
|
-
statusMessage =
|
177
|
+
statusMessage = "compiled";
|
103
178
|
}
|
104
179
|
if (
|
105
180
|
builtAtMessage ||
|
@@ -118,7 +193,7 @@ const SIMPLE_PRINTERS = {
|
|
118
193
|
count,
|
119
194
|
"warning has",
|
120
195
|
"warnings have"
|
121
|
-
|
196
|
+
)} detailed information that is not shown.\nUse 'stats.errorDetails: true' resp. '--stats-error-details' to show it.`
|
122
197
|
: undefined,
|
123
198
|
"compilation.filteredErrorDetailsCount": (count, { yellow }) =>
|
124
199
|
count
|
@@ -128,7 +203,7 @@ const SIMPLE_PRINTERS = {
|
|
128
203
|
"error has",
|
129
204
|
"errors have"
|
130
205
|
)} detailed information that is not shown.\nUse 'stats.errorDetails: true' resp. '--stats-error-details' to show it.`
|
131
|
-
|
206
|
+
)
|
132
207
|
: undefined,
|
133
208
|
"compilation.env": (env, { bold }) =>
|
134
209
|
env
|
@@ -142,7 +217,7 @@ const SIMPLE_PRINTERS = {
|
|
142
217
|
: printer.print(context.type, Object.values(entrypoints), {
|
143
218
|
...context,
|
144
219
|
chunkGroupKind: "Entrypoint"
|
145
|
-
|
220
|
+
}),
|
146
221
|
"compilation.namedChunkGroups": (namedChunkGroups, context, printer) => {
|
147
222
|
if (!Array.isArray(namedChunkGroups)) {
|
148
223
|
const {
|
@@ -163,13 +238,27 @@ const SIMPLE_PRINTERS = {
|
|
163
238
|
},
|
164
239
|
"compilation.assetsByChunkName": () => "",
|
165
240
|
|
166
|
-
"compilation.filteredModules":
|
241
|
+
"compilation.filteredModules": (
|
242
|
+
filteredModules,
|
243
|
+
{ compilation: { modules } }
|
244
|
+
) =>
|
167
245
|
filteredModules > 0
|
168
|
-
? `${filteredModules} ${plural(
|
246
|
+
? `${moreCount(modules, filteredModules)} ${plural(
|
247
|
+
filteredModules,
|
248
|
+
"module",
|
249
|
+
"modules"
|
250
|
+
)}`
|
169
251
|
: undefined,
|
170
|
-
"compilation.filteredAssets": (
|
252
|
+
"compilation.filteredAssets": (
|
253
|
+
filteredAssets,
|
254
|
+
{ compilation: { assets } }
|
255
|
+
) =>
|
171
256
|
filteredAssets > 0
|
172
|
-
? `${filteredAssets} ${plural(
|
257
|
+
? `${moreCount(assets, filteredAssets)} ${plural(
|
258
|
+
filteredAssets,
|
259
|
+
"asset",
|
260
|
+
"assets"
|
261
|
+
)}`
|
173
262
|
: undefined,
|
174
263
|
"compilation.logging": (logging, context, printer) =>
|
175
264
|
Array.isArray(logging)
|
@@ -178,15 +267,16 @@ const SIMPLE_PRINTERS = {
|
|
178
267
|
context.type,
|
179
268
|
Object.entries(logging).map(([name, value]) => ({ ...value, name })),
|
180
269
|
context
|
181
|
-
|
270
|
+
),
|
182
271
|
"compilation.warningsInChildren!": (_, { yellow, compilation }) => {
|
183
272
|
if (
|
184
273
|
!compilation.children &&
|
185
|
-
compilation.warningsCount > 0 &&
|
274
|
+
/** @type {number} */ (compilation.warningsCount) > 0 &&
|
186
275
|
compilation.warnings
|
187
276
|
) {
|
188
277
|
const childWarnings =
|
189
|
-
compilation.warningsCount -
|
278
|
+
/** @type {number} */ (compilation.warningsCount) -
|
279
|
+
compilation.warnings.length;
|
190
280
|
if (childWarnings > 0) {
|
191
281
|
return yellow(
|
192
282
|
`${childWarnings} ${plural(
|
@@ -205,10 +295,12 @@ const SIMPLE_PRINTERS = {
|
|
205
295
|
"compilation.errorsInChildren!": (_, { red, compilation }) => {
|
206
296
|
if (
|
207
297
|
!compilation.children &&
|
208
|
-
compilation.errorsCount > 0 &&
|
298
|
+
/** @type {number} */ (compilation.errorsCount) > 0 &&
|
209
299
|
compilation.errors
|
210
300
|
) {
|
211
|
-
const childErrors =
|
301
|
+
const childErrors =
|
302
|
+
/** @type {number} */ (compilation.errorsCount) -
|
303
|
+
compilation.errors.length;
|
212
304
|
if (childErrors > 0) {
|
213
305
|
return red(
|
214
306
|
`${childErrors} ${plural(
|
@@ -223,15 +315,16 @@ const SIMPLE_PRINTERS = {
|
|
223
315
|
);
|
224
316
|
}
|
225
317
|
}
|
226
|
-
}
|
318
|
+
}
|
319
|
+
};
|
227
320
|
|
321
|
+
/** @type {Record<string, (thing: any, context: Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "asset">, printer: StatsPrinter) => string | undefined>} */
|
322
|
+
const ASSET_SIMPLE_PRINTERS = {
|
228
323
|
"asset.type": type => type,
|
229
324
|
"asset.name": (name, { formatFilename, asset: { isOverSizeLimit } }) =>
|
230
325
|
formatFilename(name, isOverSizeLimit),
|
231
|
-
"asset.size": (
|
232
|
-
size,
|
233
|
-
{ asset: { isOverSizeLimit }, yellow, green, formatSize }
|
234
|
-
) => (isOverSizeLimit ? yellow(formatSize(size)) : formatSize(size)),
|
326
|
+
"asset.size": (size, { asset: { isOverSizeLimit }, yellow, formatSize }) =>
|
327
|
+
isOverSizeLimit ? yellow(formatSize(size)) : formatSize(size),
|
235
328
|
"asset.emitted": (emitted, { green, formatFlag }) =>
|
236
329
|
emitted ? green(formatFlag("emitted")) : undefined,
|
237
330
|
"asset.comparedForEmit": (comparedForEmit, { yellow, formatFlag }) =>
|
@@ -251,7 +344,7 @@ const SIMPLE_PRINTERS = {
|
|
251
344
|
sourceFilename === true
|
252
345
|
? "from source file"
|
253
346
|
: `from: ${sourceFilename}`
|
254
|
-
|
347
|
+
)
|
255
348
|
: undefined,
|
256
349
|
"asset.info.development": (development, { green, formatFlag }) =>
|
257
350
|
development ? green(formatFlag("dev")) : undefined,
|
@@ -262,28 +355,35 @@ const SIMPLE_PRINTERS = {
|
|
262
355
|
"asset.separator!": () => "\n",
|
263
356
|
"asset.filteredRelated": (filteredRelated, { asset: { related } }) =>
|
264
357
|
filteredRelated > 0
|
265
|
-
? `${filteredRelated} related ${plural(
|
358
|
+
? `${moreCount(related, filteredRelated)} related ${plural(
|
266
359
|
filteredRelated,
|
267
360
|
"asset",
|
268
361
|
"assets"
|
269
|
-
|
362
|
+
)}`
|
270
363
|
: undefined,
|
271
|
-
"asset.filteredChildren": filteredChildren =>
|
364
|
+
"asset.filteredChildren": (filteredChildren, { asset: { children } }) =>
|
272
365
|
filteredChildren > 0
|
273
|
-
? `${filteredChildren} ${plural(
|
366
|
+
? `${moreCount(children, filteredChildren)} ${plural(
|
367
|
+
filteredChildren,
|
368
|
+
"asset",
|
369
|
+
"assets"
|
370
|
+
)}`
|
274
371
|
: undefined,
|
275
372
|
|
276
373
|
assetChunk: (id, { formatChunkId }) => formatChunkId(id),
|
277
374
|
|
278
375
|
assetChunkName: name => name,
|
279
|
-
assetChunkIdHint: name => name
|
376
|
+
assetChunkIdHint: name => name
|
377
|
+
};
|
280
378
|
|
379
|
+
/** @type {Record<string, (thing: any, context: Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "module">, printer: StatsPrinter) => string | undefined>} */
|
380
|
+
const MODULE_SIMPLE_PRINTERS = {
|
281
381
|
"module.type": type => (type !== "module" ? type : undefined),
|
282
382
|
"module.id": (id, { formatModuleId }) =>
|
283
383
|
isValidId(id) ? formatModuleId(id) : undefined,
|
284
384
|
"module.name": (name, { bold }) => {
|
285
|
-
const [
|
286
|
-
return
|
385
|
+
const [prefix, resource] = getModuleName(name);
|
386
|
+
return `${prefix || ""}${bold(resource || "")}`;
|
287
387
|
},
|
288
388
|
"module.identifier": identifier => undefined,
|
289
389
|
"module.layer": (layer, { formatLayer }) =>
|
@@ -316,22 +416,22 @@ const SIMPLE_PRINTERS = {
|
|
316
416
|
formatFlag(
|
317
417
|
`${assets.length} ${plural(assets.length, "asset", "assets")}`
|
318
418
|
)
|
319
|
-
|
419
|
+
)
|
320
420
|
: undefined,
|
321
421
|
"module.warnings": (warnings, { formatFlag, yellow }) =>
|
322
422
|
warnings === true
|
323
423
|
? yellow(formatFlag("warnings"))
|
324
424
|
: warnings
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
425
|
+
? yellow(
|
426
|
+
formatFlag(`${warnings} ${plural(warnings, "warning", "warnings")}`)
|
427
|
+
)
|
428
|
+
: undefined,
|
329
429
|
"module.errors": (errors, { formatFlag, red }) =>
|
330
430
|
errors === true
|
331
431
|
? red(formatFlag("errors"))
|
332
432
|
: errors
|
333
|
-
|
334
|
-
|
433
|
+
? red(formatFlag(`${errors} ${plural(errors, "error", "errors")}`))
|
434
|
+
: undefined,
|
335
435
|
"module.providedExports": (providedExports, { formatFlag, cyan }) => {
|
336
436
|
if (Array.isArray(providedExports)) {
|
337
437
|
if (providedExports.length === 0) return cyan(formatFlag("no exports"));
|
@@ -353,11 +453,11 @@ const SIMPLE_PRINTERS = {
|
|
353
453
|
providedExportsCount === usedExports.length
|
354
454
|
) {
|
355
455
|
return cyan(formatFlag("all exports used"));
|
356
|
-
} else {
|
357
|
-
return cyan(
|
358
|
-
formatFlag(`only some exports used: ${usedExports.join(", ")}`)
|
359
|
-
);
|
360
456
|
}
|
457
|
+
|
458
|
+
return cyan(
|
459
|
+
formatFlag(`only some exports used: ${usedExports.join(", ")}`)
|
460
|
+
);
|
361
461
|
}
|
362
462
|
}
|
363
463
|
},
|
@@ -366,29 +466,44 @@ const SIMPLE_PRINTERS = {
|
|
366
466
|
"module.issuerPath": (issuerPath, { module }) =>
|
367
467
|
module.profile ? undefined : "",
|
368
468
|
"module.profile": profile => undefined,
|
369
|
-
"module.filteredModules": filteredModules =>
|
469
|
+
"module.filteredModules": (filteredModules, { module: { modules } }) =>
|
370
470
|
filteredModules > 0
|
371
|
-
? `${filteredModules} nested ${plural(
|
471
|
+
? `${moreCount(modules, filteredModules)} nested ${plural(
|
372
472
|
filteredModules,
|
373
473
|
"module",
|
374
474
|
"modules"
|
375
|
-
|
475
|
+
)}`
|
376
476
|
: undefined,
|
377
|
-
"module.filteredReasons": filteredReasons =>
|
477
|
+
"module.filteredReasons": (filteredReasons, { module: { reasons } }) =>
|
378
478
|
filteredReasons > 0
|
379
|
-
? `${filteredReasons} ${plural(
|
479
|
+
? `${moreCount(reasons, filteredReasons)} ${plural(
|
480
|
+
filteredReasons,
|
481
|
+
"reason",
|
482
|
+
"reasons"
|
483
|
+
)}`
|
380
484
|
: undefined,
|
381
|
-
"module.filteredChildren": filteredChildren =>
|
485
|
+
"module.filteredChildren": (filteredChildren, { module: { children } }) =>
|
382
486
|
filteredChildren > 0
|
383
|
-
? `${filteredChildren} ${plural(
|
487
|
+
? `${moreCount(children, filteredChildren)} ${plural(
|
488
|
+
filteredChildren,
|
489
|
+
"module",
|
490
|
+
"modules"
|
491
|
+
)}`
|
384
492
|
: undefined,
|
385
|
-
"module.separator!": () => "\n"
|
493
|
+
"module.separator!": () => "\n"
|
494
|
+
};
|
386
495
|
|
496
|
+
/** @type {Record<string, (thing: any, context: Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "moduleIssuer">, printer: StatsPrinter) => string | undefined>} */
|
497
|
+
const MODULE_ISSUER_PRINTERS = {
|
387
498
|
"moduleIssuer.id": (id, { formatModuleId }) => formatModuleId(id),
|
388
|
-
"moduleIssuer.profile.total": (value, { formatTime }) => formatTime(value)
|
499
|
+
"moduleIssuer.profile.total": (value, { formatTime }) => formatTime(value)
|
500
|
+
};
|
389
501
|
|
502
|
+
/** @type {Record<string, (thing: any, context: Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "moduleReason">, printer: StatsPrinter) => string | undefined>} */
|
503
|
+
const MODULE_REASON_PRINTERS = {
|
390
504
|
"moduleReason.type": type => type,
|
391
|
-
"moduleReason.userRequest": (userRequest, { cyan }) =>
|
505
|
+
"moduleReason.userRequest": (userRequest, { cyan }) =>
|
506
|
+
cyan(getResourceName(userRequest)),
|
392
507
|
"moduleReason.moduleId": (moduleId, { formatModuleId }) =>
|
393
508
|
isValidId(moduleId) ? formatModuleId(moduleId) : undefined,
|
394
509
|
"moduleReason.module": (module, { magenta }) => magenta(module),
|
@@ -397,11 +512,21 @@ const SIMPLE_PRINTERS = {
|
|
397
512
|
"moduleReason.active": (active, { formatFlag }) =>
|
398
513
|
active ? undefined : formatFlag("inactive"),
|
399
514
|
"moduleReason.resolvedModule": (module, { magenta }) => magenta(module),
|
400
|
-
"moduleReason.filteredChildren":
|
515
|
+
"moduleReason.filteredChildren": (
|
516
|
+
filteredChildren,
|
517
|
+
{ moduleReason: { children } }
|
518
|
+
) =>
|
401
519
|
filteredChildren > 0
|
402
|
-
? `${filteredChildren} ${plural(
|
403
|
-
|
520
|
+
? `${moreCount(children, filteredChildren)} ${plural(
|
521
|
+
filteredChildren,
|
522
|
+
"reason",
|
523
|
+
"reasons"
|
524
|
+
)}`
|
525
|
+
: undefined
|
526
|
+
};
|
404
527
|
|
528
|
+
/** @type {Record<string, (thing: any, context: Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "profile">, printer: StatsPrinter) => string | undefined>} */
|
529
|
+
const MODULE_PROFILE_PRINTERS = {
|
405
530
|
"module.profile.total": (value, { formatTime }) => formatTime(value),
|
406
531
|
"module.profile.resolving": (value, { formatTime }) =>
|
407
532
|
`resolving: ${formatTime(value)}`,
|
@@ -416,8 +541,11 @@ const SIMPLE_PRINTERS = {
|
|
416
541
|
"module.profile.additionalResolving": (value, { formatTime }) =>
|
417
542
|
value ? `additional resolving: ${formatTime(value)}` : undefined,
|
418
543
|
"module.profile.additionalIntegration": (value, { formatTime }) =>
|
419
|
-
value ? `additional integration: ${formatTime(value)}` : undefined
|
544
|
+
value ? `additional integration: ${formatTime(value)}` : undefined
|
545
|
+
};
|
420
546
|
|
547
|
+
/** @type {Record<string, (thing: any, context: Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "chunkGroupKind" | "chunkGroup">, printer: StatsPrinter) => string | undefined>} */
|
548
|
+
const CHUNK_GROUP_PRINTERS = {
|
421
549
|
"chunkGroup.kind!": (_, { chunkGroupKind }) => chunkGroupKind,
|
422
550
|
"chunkGroup.separator!": () => "\n",
|
423
551
|
"chunkGroup.name": (name, { bold }) => bold(name),
|
@@ -427,17 +555,29 @@ const SIMPLE_PRINTERS = {
|
|
427
555
|
size ? formatSize(size) : undefined,
|
428
556
|
"chunkGroup.auxiliaryAssetsSize": (size, { formatSize }) =>
|
429
557
|
size ? `(${formatSize(size)})` : undefined,
|
430
|
-
"chunkGroup.filteredAssets": n =>
|
431
|
-
n > 0
|
432
|
-
|
433
|
-
|
558
|
+
"chunkGroup.filteredAssets": (n, { chunkGroup: { assets } }) =>
|
559
|
+
n > 0
|
560
|
+
? `${moreCount(assets, n)} ${plural(n, "asset", "assets")}`
|
561
|
+
: undefined,
|
562
|
+
"chunkGroup.filteredAuxiliaryAssets": (
|
563
|
+
n,
|
564
|
+
{ chunkGroup: { auxiliaryAssets } }
|
565
|
+
) =>
|
566
|
+
n > 0
|
567
|
+
? `${moreCount(auxiliaryAssets, n)} auxiliary ${plural(
|
568
|
+
n,
|
569
|
+
"asset",
|
570
|
+
"assets"
|
571
|
+
)}`
|
572
|
+
: undefined,
|
434
573
|
"chunkGroup.is!": () => "=",
|
435
574
|
"chunkGroupAsset.name": (asset, { green }) => green(asset),
|
436
575
|
"chunkGroupAsset.size": (size, { formatSize, chunkGroup }) =>
|
437
|
-
chunkGroup.assets
|
576
|
+
chunkGroup.assets &&
|
577
|
+
(chunkGroup.assets.length > 1 ||
|
438
578
|
(chunkGroup.auxiliaryAssets && chunkGroup.auxiliaryAssets.length > 0)
|
439
579
|
? formatSize(size)
|
440
|
-
: undefined,
|
580
|
+
: undefined),
|
441
581
|
"chunkGroup.children": (children, context, printer) =>
|
442
582
|
Array.isArray(children)
|
443
583
|
? undefined
|
@@ -448,13 +588,16 @@ const SIMPLE_PRINTERS = {
|
|
448
588
|
children: children[key]
|
449
589
|
})),
|
450
590
|
context
|
451
|
-
|
591
|
+
),
|
452
592
|
"chunkGroupChildGroup.type": type => `${type}:`,
|
453
593
|
"chunkGroupChild.assets[]": (file, { formatFilename }) =>
|
454
594
|
formatFilename(file),
|
455
595
|
"chunkGroupChild.chunks[]": (id, { formatChunkId }) => formatChunkId(id),
|
456
|
-
"chunkGroupChild.name": name => (name ? `(name: ${name})` : undefined)
|
596
|
+
"chunkGroupChild.name": name => (name ? `(name: ${name})` : undefined)
|
597
|
+
};
|
457
598
|
|
599
|
+
/** @type {Record<string, (thing: any, context: Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "chunk">, printer: StatsPrinter) => string | undefined>} */
|
600
|
+
const CHUNK_PRINTERS = {
|
458
601
|
"chunk.id": (id, { formatChunkId }) => formatChunkId(id),
|
459
602
|
"chunk.files[]": (file, { formatFilename }) => formatFilename(file),
|
460
603
|
"chunk.names[]": name => name,
|
@@ -477,7 +620,7 @@ const SIMPLE_PRINTERS = {
|
|
477
620
|
children: childrenByOrder[key]
|
478
621
|
})),
|
479
622
|
context
|
480
|
-
|
623
|
+
),
|
481
624
|
"chunk.childrenByOrder[].type": type => `${type}:`,
|
482
625
|
"chunk.childrenByOrder[].children[]": (id, { formatChunkId }) =>
|
483
626
|
isValidId(id) ? formatChunkId(id) : undefined,
|
@@ -490,13 +633,13 @@ const SIMPLE_PRINTERS = {
|
|
490
633
|
"chunk.recorded": (recorded, { formatFlag, green }) =>
|
491
634
|
recorded ? green(formatFlag("recorded")) : undefined,
|
492
635
|
"chunk.reason": (reason, { yellow }) => (reason ? yellow(reason) : undefined),
|
493
|
-
"chunk.filteredModules": filteredModules =>
|
636
|
+
"chunk.filteredModules": (filteredModules, { chunk: { modules } }) =>
|
494
637
|
filteredModules > 0
|
495
|
-
? `${filteredModules} chunk ${plural(
|
638
|
+
? `${moreCount(modules, filteredModules)} chunk ${plural(
|
496
639
|
filteredModules,
|
497
640
|
"module",
|
498
641
|
"modules"
|
499
|
-
|
642
|
+
)}`
|
500
643
|
: undefined,
|
501
644
|
"chunk.separator!": () => "\n",
|
502
645
|
|
@@ -504,8 +647,11 @@ const SIMPLE_PRINTERS = {
|
|
504
647
|
"chunkOrigin.moduleId": (moduleId, { formatModuleId }) =>
|
505
648
|
isValidId(moduleId) ? formatModuleId(moduleId) : undefined,
|
506
649
|
"chunkOrigin.moduleName": (moduleName, { bold }) => bold(moduleName),
|
507
|
-
"chunkOrigin.loc": loc => loc
|
650
|
+
"chunkOrigin.loc": loc => loc
|
651
|
+
};
|
508
652
|
|
653
|
+
/** @type {Record<string, (thing: any, context: Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "error">, printer: StatsPrinter) => string | undefined>} */
|
654
|
+
const ERROR_PRINTERS = {
|
509
655
|
"error.compilerPath": (compilerPath, { bold }) =>
|
510
656
|
compilerPath ? bold(`(${compilerPath})`) : undefined,
|
511
657
|
"error.chunkId": (chunkId, { formatChunkId }) =>
|
@@ -515,19 +661,23 @@ const SIMPLE_PRINTERS = {
|
|
515
661
|
"error.chunkInitial": (chunkInitial, { formatFlag }) =>
|
516
662
|
chunkInitial ? formatFlag("initial") : undefined,
|
517
663
|
"error.file": (file, { bold }) => bold(file),
|
518
|
-
"error.moduleName": (moduleName, { bold }) =>
|
519
|
-
|
664
|
+
"error.moduleName": (moduleName, { bold }) =>
|
665
|
+
moduleName.includes("!")
|
520
666
|
? `${bold(moduleName.replace(/^(\s|\S)*!/, ""))} (${moduleName})`
|
521
|
-
: `${bold(moduleName)}
|
522
|
-
},
|
667
|
+
: `${bold(moduleName)}`,
|
523
668
|
"error.loc": (loc, { green }) => green(loc),
|
524
669
|
"error.message": (message, { bold, formatError }) =>
|
525
|
-
message.includes("\
|
670
|
+
message.includes("\u001B[") ? message : bold(formatError(message)),
|
526
671
|
"error.details": (details, { formatError }) => formatError(details),
|
672
|
+
"error.filteredDetails": filteredDetails =>
|
673
|
+
filteredDetails ? `+ ${filteredDetails} hidden lines` : undefined,
|
527
674
|
"error.stack": stack => stack,
|
528
675
|
"error.moduleTrace": moduleTrace => undefined,
|
529
|
-
"error.separator!": () => "\n"
|
676
|
+
"error.separator!": () => "\n"
|
677
|
+
};
|
530
678
|
|
679
|
+
/** @type {Record<string, (thing: any, context: Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "logging">, printer: StatsPrinter) => string | undefined>} */
|
680
|
+
const LOG_ENTRY_PRINTERS = {
|
531
681
|
"loggingEntry(error).loggingEntry.message": (message, { red }) =>
|
532
682
|
mapLines(message, x => `<e> ${red(x)}`),
|
533
683
|
"loggingEntry(warn).loggingEntry.message": (message, { yellow }) =>
|
@@ -557,20 +707,26 @@ const SIMPLE_PRINTERS = {
|
|
557
707
|
"loggingEntry.trace[]": trace =>
|
558
708
|
trace ? mapLines(trace, x => `| ${x}`) : undefined,
|
559
709
|
|
560
|
-
"moduleTraceItem.originName": originName => originName,
|
561
|
-
|
562
710
|
loggingGroup: loggingGroup =>
|
563
711
|
loggingGroup.entries.length === 0 ? "" : undefined,
|
564
712
|
"loggingGroup.debug": (flag, { red }) => (flag ? red("DEBUG") : undefined),
|
565
713
|
"loggingGroup.name": (name, { bold }) => bold(`LOG from ${name}`),
|
566
714
|
"loggingGroup.separator!": () => "\n",
|
567
715
|
"loggingGroup.filteredEntries": filteredEntries =>
|
568
|
-
filteredEntries > 0 ? `+ ${filteredEntries} hidden lines` : undefined
|
716
|
+
filteredEntries > 0 ? `+ ${filteredEntries} hidden lines` : undefined
|
717
|
+
};
|
718
|
+
|
719
|
+
/** @type {Record<string, (thing: any, context: Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "moduleTraceItem">, printer: StatsPrinter) => string | undefined>} */
|
720
|
+
const MODULE_TRACE_ITEM_PRINTERS = {
|
721
|
+
"moduleTraceItem.originName": originName => originName
|
722
|
+
};
|
569
723
|
|
724
|
+
/** @type {Record<string, (thing: any, context: Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "moduleTraceDependency">, printer: StatsPrinter) => string | undefined>} */
|
725
|
+
const MODULE_TRACE_DEPENDENCY_PRINTERS = {
|
570
726
|
"moduleTraceDependency.loc": loc => loc
|
571
727
|
};
|
572
728
|
|
573
|
-
/** @type {Record<string, string |
|
729
|
+
/** @type {Record<string, string | function(any): string>} */
|
574
730
|
const ITEM_NAMES = {
|
575
731
|
"compilation.assets[]": "asset",
|
576
732
|
"compilation.modules[]": "module",
|
@@ -624,6 +780,8 @@ const ERROR_PREFERRED_ORDER = [
|
|
624
780
|
"separator!",
|
625
781
|
"details",
|
626
782
|
"separator!",
|
783
|
+
"filteredDetails",
|
784
|
+
"separator!",
|
627
785
|
"stack",
|
628
786
|
"separator!",
|
629
787
|
"missing",
|
@@ -797,19 +955,27 @@ const PREFERRED_ORDERS = {
|
|
797
955
|
loggingEntry: ["message", "trace", "children"]
|
798
956
|
};
|
799
957
|
|
958
|
+
/** @typedef {(items: string[]) => string | undefined} SimpleItemsJoiner */
|
959
|
+
|
960
|
+
/** @type {SimpleItemsJoiner} */
|
800
961
|
const itemsJoinOneLine = items => items.filter(Boolean).join(" ");
|
962
|
+
/** @type {SimpleItemsJoiner} */
|
801
963
|
const itemsJoinOneLineBrackets = items =>
|
802
964
|
items.length > 0 ? `(${items.filter(Boolean).join(" ")})` : undefined;
|
965
|
+
/** @type {SimpleItemsJoiner} */
|
803
966
|
const itemsJoinMoreSpacing = items => items.filter(Boolean).join("\n\n");
|
967
|
+
/** @type {SimpleItemsJoiner} */
|
804
968
|
const itemsJoinComma = items => items.filter(Boolean).join(", ");
|
969
|
+
/** @type {SimpleItemsJoiner} */
|
805
970
|
const itemsJoinCommaBrackets = items =>
|
806
971
|
items.length > 0 ? `(${items.filter(Boolean).join(", ")})` : undefined;
|
972
|
+
/** @type {function(string): SimpleItemsJoiner} */
|
807
973
|
const itemsJoinCommaBracketsWithName = name => items =>
|
808
974
|
items.length > 0
|
809
975
|
? `(${name}: ${items.filter(Boolean).join(", ")})`
|
810
976
|
: undefined;
|
811
977
|
|
812
|
-
/** @type {Record<string,
|
978
|
+
/** @type {Record<string, SimpleItemsJoiner>} */
|
813
979
|
const SIMPLE_ITEMS_JOINER = {
|
814
980
|
"chunk.parents": itemsJoinOneLine,
|
815
981
|
"chunk.siblings": itemsJoinOneLine,
|
@@ -841,18 +1007,27 @@ const SIMPLE_ITEMS_JOINER = {
|
|
841
1007
|
"compilation.errors": itemsJoinMoreSpacing,
|
842
1008
|
"compilation.warnings": itemsJoinMoreSpacing,
|
843
1009
|
"compilation.logging": itemsJoinMoreSpacing,
|
844
|
-
"compilation.children": items =>
|
1010
|
+
"compilation.children": items =>
|
1011
|
+
indent(/** @type {string} */ (itemsJoinMoreSpacing(items)), " "),
|
845
1012
|
"moduleTraceItem.dependencies": itemsJoinOneLine,
|
846
1013
|
"loggingEntry.children": items =>
|
847
1014
|
indent(items.filter(Boolean).join("\n"), " ", false)
|
848
1015
|
};
|
849
1016
|
|
1017
|
+
/**
|
1018
|
+
* @param {Item[]} items items
|
1019
|
+
* @returns {string} result
|
1020
|
+
*/
|
850
1021
|
const joinOneLine = items =>
|
851
1022
|
items
|
852
1023
|
.map(item => item.content)
|
853
1024
|
.filter(Boolean)
|
854
1025
|
.join(" ");
|
855
1026
|
|
1027
|
+
/**
|
1028
|
+
* @param {Item[]} items items
|
1029
|
+
* @returns {string} result
|
1030
|
+
*/
|
856
1031
|
const joinInBrackets = items => {
|
857
1032
|
const res = [];
|
858
1033
|
let mode = 0;
|
@@ -895,13 +1070,24 @@ const joinInBrackets = items => {
|
|
895
1070
|
return res.join("");
|
896
1071
|
};
|
897
1072
|
|
1073
|
+
/**
|
1074
|
+
* @param {string} str a string
|
1075
|
+
* @param {string} prefix prefix
|
1076
|
+
* @param {boolean=} noPrefixInFirstLine need prefix in the first line?
|
1077
|
+
* @returns {string} result
|
1078
|
+
*/
|
898
1079
|
const indent = (str, prefix, noPrefixInFirstLine) => {
|
899
|
-
const rem = str.replace(/\n([^\n])/g,
|
1080
|
+
const rem = str.replace(/\n([^\n])/g, `\n${prefix}$1`);
|
900
1081
|
if (noPrefixInFirstLine) return rem;
|
901
1082
|
const ind = str[0] === "\n" ? "" : prefix;
|
902
1083
|
return ind + rem;
|
903
1084
|
};
|
904
1085
|
|
1086
|
+
/**
|
1087
|
+
* @param {(false | Item)[]} items items
|
1088
|
+
* @param {string} indenter indenter
|
1089
|
+
* @returns {string} result
|
1090
|
+
*/
|
905
1091
|
const joinExplicitNewLine = (items, indenter) => {
|
906
1092
|
let firstInLine = true;
|
907
1093
|
let first = true;
|
@@ -916,22 +1102,34 @@ const joinExplicitNewLine = (items, indenter) => {
|
|
916
1102
|
first = false;
|
917
1103
|
const noJoiner = firstInLine || content.startsWith("\n");
|
918
1104
|
firstInLine = content.endsWith("\n");
|
919
|
-
return noJoiner ? content :
|
1105
|
+
return noJoiner ? content : ` ${content}`;
|
920
1106
|
})
|
921
1107
|
.filter(Boolean)
|
922
1108
|
.join("")
|
923
1109
|
.trim();
|
924
1110
|
};
|
925
1111
|
|
1112
|
+
/**
|
1113
|
+
* @param {boolean} error is an error
|
1114
|
+
* @returns {SimpleElementJoiner} joiner
|
1115
|
+
*/
|
926
1116
|
const joinError =
|
927
1117
|
error =>
|
1118
|
+
/**
|
1119
|
+
* @param {Item[]} items items
|
1120
|
+
* @param {Required<StatsPrinterContext>} ctx context
|
1121
|
+
* @returns {string} result
|
1122
|
+
*/
|
928
1123
|
(items, { red, yellow }) =>
|
929
1124
|
`${error ? red("ERROR") : yellow("WARNING")} in ${joinExplicitNewLine(
|
930
1125
|
items,
|
931
1126
|
""
|
932
1127
|
)}`;
|
933
1128
|
|
934
|
-
/** @
|
1129
|
+
/** @typedef {{ element: string, content: string }} Item */
|
1130
|
+
/** @typedef {(items: Item[], context: Required<StatsPrinterContext>) => string} SimpleElementJoiner */
|
1131
|
+
|
1132
|
+
/** @type {Record<string, SimpleElementJoiner>} */
|
935
1133
|
const SIMPLE_ELEMENT_JOINERS = {
|
936
1134
|
compilation: items => {
|
937
1135
|
const result = [];
|
@@ -1008,23 +1206,20 @@ const SIMPLE_ELEMENT_JOINERS = {
|
|
1008
1206
|
},
|
1009
1207
|
chunk: items => {
|
1010
1208
|
let hasEntry = false;
|
1011
|
-
return (
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
" "
|
1026
|
-
)
|
1027
|
-
);
|
1209
|
+
return `chunk ${joinExplicitNewLine(
|
1210
|
+
items.filter(item => {
|
1211
|
+
switch (item.element) {
|
1212
|
+
case "entry":
|
1213
|
+
if (item.content) hasEntry = true;
|
1214
|
+
break;
|
1215
|
+
case "initial":
|
1216
|
+
if (hasEntry) return false;
|
1217
|
+
break;
|
1218
|
+
}
|
1219
|
+
return true;
|
1220
|
+
}),
|
1221
|
+
" "
|
1222
|
+
)}`;
|
1028
1223
|
},
|
1029
1224
|
"chunk.childrenByOrder[]": items => `(${joinOneLine(items)})`,
|
1030
1225
|
chunkGroup: items => joinExplicitNewLine(items, " "),
|
@@ -1085,23 +1280,27 @@ const SIMPLE_ELEMENT_JOINERS = {
|
|
1085
1280
|
},
|
1086
1281
|
"module.profile": joinInBrackets,
|
1087
1282
|
moduleIssuer: joinOneLine,
|
1088
|
-
chunkOrigin: items =>
|
1283
|
+
chunkOrigin: items => `> ${joinOneLine(items)}`,
|
1089
1284
|
"errors[].error": joinError(true),
|
1090
1285
|
"warnings[].error": joinError(false),
|
1091
|
-
loggingGroup: items => joinExplicitNewLine(items, "").
|
1092
|
-
moduleTraceItem: items =>
|
1286
|
+
loggingGroup: items => joinExplicitNewLine(items, "").trimEnd(),
|
1287
|
+
moduleTraceItem: items => ` @ ${joinOneLine(items)}`,
|
1093
1288
|
moduleTraceDependency: joinOneLine
|
1094
1289
|
};
|
1095
1290
|
|
1291
|
+
/** @typedef {"bold" | "yellow" | "red" | "green" | "cyan" | "magenta"} ColorNames */
|
1292
|
+
|
1293
|
+
/** @type {Record<ColorNames, string>} */
|
1096
1294
|
const AVAILABLE_COLORS = {
|
1097
|
-
bold: "\
|
1098
|
-
yellow: "\
|
1099
|
-
red: "\
|
1100
|
-
green: "\
|
1101
|
-
cyan: "\
|
1102
|
-
magenta: "\
|
1295
|
+
bold: "\u001B[1m",
|
1296
|
+
yellow: "\u001B[1m\u001B[33m",
|
1297
|
+
red: "\u001B[1m\u001B[31m",
|
1298
|
+
green: "\u001B[1m\u001B[32m",
|
1299
|
+
cyan: "\u001B[1m\u001B[36m",
|
1300
|
+
magenta: "\u001B[1m\u001B[35m"
|
1103
1301
|
};
|
1104
1302
|
|
1303
|
+
/** @type {Record<string, function(any, Required<KnownStatsPrinterColorFn> & StatsPrinterContext, ...any): string>} */
|
1105
1304
|
const AVAILABLE_FORMATS = {
|
1106
1305
|
formatChunkId: (id, { yellow }, direction) => {
|
1107
1306
|
switch (direction) {
|
@@ -1145,13 +1344,12 @@ const AVAILABLE_FORMATS = {
|
|
1145
1344
|
else if (time < times[2]) return bold(`${time}${unit}`);
|
1146
1345
|
else if (time < times[1]) return green(`${time}${unit}`);
|
1147
1346
|
else if (time < times[0]) return yellow(`${time}${unit}`);
|
1148
|
-
|
1149
|
-
} else {
|
1150
|
-
return `${boldQuantity ? bold(time) : time}${unit}`;
|
1347
|
+
return red(`${time}${unit}`);
|
1151
1348
|
}
|
1349
|
+
return `${boldQuantity ? bold(time) : time}${unit}`;
|
1152
1350
|
},
|
1153
1351
|
formatError: (message, { green, yellow, red }) => {
|
1154
|
-
if (message.includes("\
|
1352
|
+
if (message.includes("\u001B[")) return message;
|
1155
1353
|
const highlights = [
|
1156
1354
|
{ regExp: /(Did you mean .+)/g, format: green },
|
1157
1355
|
{
|
@@ -1160,7 +1358,7 @@ const AVAILABLE_FORMATS = {
|
|
1160
1358
|
},
|
1161
1359
|
{ regExp: /(\(module has no exports\))/g, format: red },
|
1162
1360
|
{ regExp: /\(possible exports: (.+)\)/g, format: green },
|
1163
|
-
{ regExp:
|
1361
|
+
{ regExp: /(?:^|\n)(.* doesn't exist)/g, format: red },
|
1164
1362
|
{ regExp: /('\w+' option has not been set)/g, format: red },
|
1165
1363
|
{
|
1166
1364
|
regExp: /(Emitted value instead of an instance of Error)/g,
|
@@ -1179,23 +1377,36 @@ const AVAILABLE_FORMATS = {
|
|
1179
1377
|
}
|
1180
1378
|
];
|
1181
1379
|
for (const { regExp, format } of highlights) {
|
1182
|
-
message = message.replace(
|
1183
|
-
|
1184
|
-
|
1380
|
+
message = message.replace(
|
1381
|
+
regExp,
|
1382
|
+
/**
|
1383
|
+
* @param {string} match match
|
1384
|
+
* @param {string} content content
|
1385
|
+
* @returns {string} result
|
1386
|
+
*/
|
1387
|
+
(match, content) => match.replace(content, format(content))
|
1388
|
+
);
|
1185
1389
|
}
|
1186
1390
|
return message;
|
1187
1391
|
}
|
1188
1392
|
};
|
1189
1393
|
|
1394
|
+
/** @typedef {function(string): string} ResultModifierFn */
|
1395
|
+
/** @type {Record<string, ResultModifierFn>} */
|
1190
1396
|
const RESULT_MODIFIER = {
|
1191
|
-
"module.modules": result =>
|
1192
|
-
return indent(result, "| ");
|
1193
|
-
}
|
1397
|
+
"module.modules": result => indent(result, "| ")
|
1194
1398
|
};
|
1195
1399
|
|
1400
|
+
/**
|
1401
|
+
* @param {string[]} array array
|
1402
|
+
* @param {string[]} preferredOrder preferred order
|
1403
|
+
* @returns {string[]} result
|
1404
|
+
*/
|
1196
1405
|
const createOrder = (array, preferredOrder) => {
|
1197
1406
|
const originalArray = array.slice();
|
1407
|
+
/** @type {Set<string>} */
|
1198
1408
|
const set = new Set(array);
|
1409
|
+
/** @type {Set<string>} */
|
1199
1410
|
const usedSet = new Set();
|
1200
1411
|
array.length = 0;
|
1201
1412
|
for (const element of preferredOrder) {
|
@@ -1222,49 +1433,218 @@ class DefaultStatsPrinterPlugin {
|
|
1222
1433
|
compiler.hooks.compilation.tap("DefaultStatsPrinterPlugin", compilation => {
|
1223
1434
|
compilation.hooks.statsPrinter.tap(
|
1224
1435
|
"DefaultStatsPrinterPlugin",
|
1225
|
-
(stats, options
|
1436
|
+
(stats, options) => {
|
1226
1437
|
// Put colors into context
|
1227
1438
|
stats.hooks.print
|
1228
1439
|
.for("compilation")
|
1229
1440
|
.tap("DefaultStatsPrinterPlugin", (compilation, context) => {
|
1230
1441
|
for (const color of Object.keys(AVAILABLE_COLORS)) {
|
1442
|
+
const name = /** @type {ColorNames} */ (color);
|
1443
|
+
/** @type {string | undefined} */
|
1231
1444
|
let start;
|
1232
1445
|
if (options.colors) {
|
1233
1446
|
if (
|
1234
1447
|
typeof options.colors === "object" &&
|
1235
|
-
typeof options.colors[
|
1448
|
+
typeof options.colors[name] === "string"
|
1236
1449
|
) {
|
1237
|
-
start = options.colors[
|
1450
|
+
start = options.colors[name];
|
1238
1451
|
} else {
|
1239
|
-
start = AVAILABLE_COLORS[
|
1452
|
+
start = AVAILABLE_COLORS[name];
|
1240
1453
|
}
|
1241
1454
|
}
|
1242
1455
|
if (start) {
|
1456
|
+
/**
|
1457
|
+
* @param {string} str string
|
1458
|
+
* @returns {string} string with color
|
1459
|
+
*/
|
1243
1460
|
context[color] = str =>
|
1244
1461
|
`${start}${
|
1245
1462
|
typeof str === "string"
|
1246
1463
|
? str.replace(
|
1247
|
-
/((\
|
1464
|
+
/((\u001B\[39m|\u001B\[22m|\u001B\[0m)+)/g,
|
1248
1465
|
`$1${start}`
|
1249
|
-
|
1466
|
+
)
|
1250
1467
|
: str
|
1251
|
-
}\
|
1468
|
+
}\u001B[39m\u001B[22m`;
|
1252
1469
|
} else {
|
1470
|
+
/**
|
1471
|
+
* @param {string} str string
|
1472
|
+
* @returns {string} str string
|
1473
|
+
*/
|
1253
1474
|
context[color] = str => str;
|
1254
1475
|
}
|
1255
1476
|
}
|
1256
1477
|
for (const format of Object.keys(AVAILABLE_FORMATS)) {
|
1257
|
-
context[format] =
|
1258
|
-
|
1478
|
+
context[format] =
|
1479
|
+
/**
|
1480
|
+
* @param {string | number} content content
|
1481
|
+
* @param {...TODO} args args
|
1482
|
+
* @returns {string} result
|
1483
|
+
*/
|
1484
|
+
(content, ...args) =>
|
1485
|
+
AVAILABLE_FORMATS[format](
|
1486
|
+
content,
|
1487
|
+
/** @type {Required<KnownStatsPrinterColorFn> & StatsPrinterContext} */
|
1488
|
+
(context),
|
1489
|
+
...args
|
1490
|
+
);
|
1259
1491
|
}
|
1260
1492
|
context.timeReference = compilation.time;
|
1261
1493
|
});
|
1262
1494
|
|
1263
|
-
for (const key of Object.keys(
|
1495
|
+
for (const key of Object.keys(COMPILATION_SIMPLE_PRINTERS)) {
|
1264
1496
|
stats.hooks.print
|
1265
1497
|
.for(key)
|
1266
1498
|
.tap("DefaultStatsPrinterPlugin", (obj, ctx) =>
|
1267
|
-
|
1499
|
+
COMPILATION_SIMPLE_PRINTERS[key](
|
1500
|
+
obj,
|
1501
|
+
/** @type {Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation">} */
|
1502
|
+
(ctx),
|
1503
|
+
stats
|
1504
|
+
)
|
1505
|
+
);
|
1506
|
+
}
|
1507
|
+
|
1508
|
+
for (const key of Object.keys(ASSET_SIMPLE_PRINTERS)) {
|
1509
|
+
stats.hooks.print
|
1510
|
+
.for(key)
|
1511
|
+
.tap("DefaultStatsPrinterPlugin", (obj, ctx) =>
|
1512
|
+
ASSET_SIMPLE_PRINTERS[key](
|
1513
|
+
obj,
|
1514
|
+
/** @type {Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "asset">} */
|
1515
|
+
(ctx),
|
1516
|
+
stats
|
1517
|
+
)
|
1518
|
+
);
|
1519
|
+
}
|
1520
|
+
|
1521
|
+
for (const key of Object.keys(MODULE_SIMPLE_PRINTERS)) {
|
1522
|
+
stats.hooks.print
|
1523
|
+
.for(key)
|
1524
|
+
.tap("DefaultStatsPrinterPlugin", (obj, ctx) =>
|
1525
|
+
MODULE_SIMPLE_PRINTERS[key](
|
1526
|
+
obj,
|
1527
|
+
/** @type {Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "module">} */
|
1528
|
+
(ctx),
|
1529
|
+
stats
|
1530
|
+
)
|
1531
|
+
);
|
1532
|
+
}
|
1533
|
+
|
1534
|
+
for (const key of Object.keys(MODULE_ISSUER_PRINTERS)) {
|
1535
|
+
stats.hooks.print
|
1536
|
+
.for(key)
|
1537
|
+
.tap("DefaultStatsPrinterPlugin", (obj, ctx) =>
|
1538
|
+
MODULE_ISSUER_PRINTERS[key](
|
1539
|
+
obj,
|
1540
|
+
/** @type {Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "moduleIssuer">} */
|
1541
|
+
(ctx),
|
1542
|
+
stats
|
1543
|
+
)
|
1544
|
+
);
|
1545
|
+
}
|
1546
|
+
|
1547
|
+
for (const key of Object.keys(MODULE_REASON_PRINTERS)) {
|
1548
|
+
stats.hooks.print
|
1549
|
+
.for(key)
|
1550
|
+
.tap("DefaultStatsPrinterPlugin", (obj, ctx) =>
|
1551
|
+
MODULE_REASON_PRINTERS[key](
|
1552
|
+
obj,
|
1553
|
+
/** @type {Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "moduleReason">} */
|
1554
|
+
(ctx),
|
1555
|
+
stats
|
1556
|
+
)
|
1557
|
+
);
|
1558
|
+
}
|
1559
|
+
|
1560
|
+
for (const key of Object.keys(MODULE_PROFILE_PRINTERS)) {
|
1561
|
+
stats.hooks.print
|
1562
|
+
.for(key)
|
1563
|
+
.tap("DefaultStatsPrinterPlugin", (obj, ctx) =>
|
1564
|
+
MODULE_PROFILE_PRINTERS[key](
|
1565
|
+
obj,
|
1566
|
+
/** @type {Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "profile">} */
|
1567
|
+
(ctx),
|
1568
|
+
stats
|
1569
|
+
)
|
1570
|
+
);
|
1571
|
+
}
|
1572
|
+
|
1573
|
+
for (const key of Object.keys(CHUNK_GROUP_PRINTERS)) {
|
1574
|
+
stats.hooks.print
|
1575
|
+
.for(key)
|
1576
|
+
.tap("DefaultStatsPrinterPlugin", (obj, ctx) =>
|
1577
|
+
CHUNK_GROUP_PRINTERS[key](
|
1578
|
+
obj,
|
1579
|
+
/** @type {Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "chunkGroupKind" | "chunkGroup">} */
|
1580
|
+
(ctx),
|
1581
|
+
stats
|
1582
|
+
)
|
1583
|
+
);
|
1584
|
+
}
|
1585
|
+
|
1586
|
+
for (const key of Object.keys(CHUNK_PRINTERS)) {
|
1587
|
+
stats.hooks.print
|
1588
|
+
.for(key)
|
1589
|
+
.tap("DefaultStatsPrinterPlugin", (obj, ctx) =>
|
1590
|
+
CHUNK_PRINTERS[key](
|
1591
|
+
obj,
|
1592
|
+
/** @type {Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "chunk">} */
|
1593
|
+
(ctx),
|
1594
|
+
stats
|
1595
|
+
)
|
1596
|
+
);
|
1597
|
+
}
|
1598
|
+
|
1599
|
+
for (const key of Object.keys(ERROR_PRINTERS)) {
|
1600
|
+
stats.hooks.print
|
1601
|
+
.for(key)
|
1602
|
+
.tap("DefaultStatsPrinterPlugin", (obj, ctx) =>
|
1603
|
+
ERROR_PRINTERS[key](
|
1604
|
+
obj,
|
1605
|
+
/** @type {Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "error">} */
|
1606
|
+
(ctx),
|
1607
|
+
stats
|
1608
|
+
)
|
1609
|
+
);
|
1610
|
+
}
|
1611
|
+
|
1612
|
+
for (const key of Object.keys(LOG_ENTRY_PRINTERS)) {
|
1613
|
+
stats.hooks.print
|
1614
|
+
.for(key)
|
1615
|
+
.tap("DefaultStatsPrinterPlugin", (obj, ctx) =>
|
1616
|
+
LOG_ENTRY_PRINTERS[key](
|
1617
|
+
obj,
|
1618
|
+
/** @type {Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "logging">} */
|
1619
|
+
(ctx),
|
1620
|
+
stats
|
1621
|
+
)
|
1622
|
+
);
|
1623
|
+
}
|
1624
|
+
|
1625
|
+
for (const key of Object.keys(MODULE_TRACE_DEPENDENCY_PRINTERS)) {
|
1626
|
+
stats.hooks.print
|
1627
|
+
.for(key)
|
1628
|
+
.tap("DefaultStatsPrinterPlugin", (obj, ctx) =>
|
1629
|
+
MODULE_TRACE_DEPENDENCY_PRINTERS[key](
|
1630
|
+
obj,
|
1631
|
+
/** @type {Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "moduleTraceDependency">} */
|
1632
|
+
(ctx),
|
1633
|
+
stats
|
1634
|
+
)
|
1635
|
+
);
|
1636
|
+
}
|
1637
|
+
|
1638
|
+
for (const key of Object.keys(MODULE_TRACE_ITEM_PRINTERS)) {
|
1639
|
+
stats.hooks.print
|
1640
|
+
.for(key)
|
1641
|
+
.tap("DefaultStatsPrinterPlugin", (obj, ctx) =>
|
1642
|
+
MODULE_TRACE_ITEM_PRINTERS[key](
|
1643
|
+
obj,
|
1644
|
+
/** @type {Required<KnownStatsPrinterColorFn> & Required<KnownStatsPrinterFormaters> & WithRequired<StatsPrinterContext, "type" | "compilation" | "moduleTraceItem">} */
|
1645
|
+
(ctx),
|
1646
|
+
stats
|
1647
|
+
)
|
1268
1648
|
);
|
1269
1649
|
}
|
1270
1650
|
|
@@ -1298,7 +1678,7 @@ class DefaultStatsPrinterPlugin {
|
|
1298
1678
|
const joiner = SIMPLE_ELEMENT_JOINERS[key];
|
1299
1679
|
stats.hooks.printElements
|
1300
1680
|
.for(key)
|
1301
|
-
.tap("DefaultStatsPrinterPlugin", joiner);
|
1681
|
+
.tap("DefaultStatsPrinterPlugin", /** @type {TODO} */ (joiner));
|
1302
1682
|
}
|
1303
1683
|
|
1304
1684
|
for (const key of Object.keys(RESULT_MODIFIER)) {
|