webpack 5.101.2 → 5.102.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 +21 -26
- package/lib/APIPlugin.js +30 -36
- package/lib/AsyncDependenciesBlock.js +1 -4
- package/lib/BannerPlugin.js +0 -1
- package/lib/Cache.js +7 -6
- package/lib/CacheFacade.js +0 -1
- package/lib/Chunk.js +49 -31
- package/lib/ChunkGraph.js +35 -25
- package/lib/ChunkGroup.js +8 -10
- package/lib/ChunkTemplate.js +1 -1
- package/lib/CleanPlugin.js +3 -3
- package/lib/CodeGenerationResults.js +2 -1
- package/lib/CompatibilityPlugin.js +29 -12
- package/lib/Compilation.js +204 -185
- package/lib/Compiler.js +36 -35
- package/lib/ConcatenationScope.js +6 -1
- package/lib/ConditionalInitFragment.js +1 -1
- package/lib/ConstPlugin.js +18 -10
- package/lib/ContextExclusionPlugin.js +0 -1
- package/lib/ContextModule.js +22 -20
- package/lib/ContextModuleFactory.js +30 -11
- package/lib/ContextReplacementPlugin.js +38 -15
- package/lib/DefinePlugin.js +18 -8
- package/lib/DelegatedModule.js +7 -11
- package/lib/DependenciesBlock.js +0 -2
- package/lib/Dependency.js +9 -11
- package/lib/DependencyTemplates.js +1 -3
- package/lib/DllModule.js +1 -7
- package/lib/DllReferencePlugin.js +2 -4
- package/lib/DynamicEntryPlugin.js +0 -2
- package/lib/EntryOptionPlugin.js +0 -5
- package/lib/EnvironmentNotSupportAsyncWarning.js +0 -3
- package/lib/EvalDevToolModulePlugin.js +4 -3
- package/lib/EvalSourceMapDevToolPlugin.js +3 -4
- package/lib/ExportsInfo.js +50 -49
- package/lib/ExternalModule.js +84 -52
- package/lib/ExternalModuleFactoryPlugin.js +27 -7
- package/lib/ExternalsPlugin.js +24 -17
- package/lib/FileSystemInfo.js +96 -78
- package/lib/FlagDependencyUsagePlugin.js +3 -4
- package/lib/Generator.js +2 -13
- package/lib/GraphHelpers.js +0 -3
- package/lib/HookWebpackError.js +0 -2
- package/lib/HotModuleReplacementPlugin.js +22 -24
- package/lib/HotUpdateChunk.js +0 -3
- package/lib/IgnorePlugin.js +5 -2
- package/lib/InitFragment.js +41 -29
- package/lib/InvalidDependenciesModuleWarning.js +0 -1
- package/lib/LibManifestPlugin.js +4 -6
- package/lib/LoaderOptionsPlugin.js +1 -10
- package/lib/MainTemplate.js +8 -19
- package/lib/Module.js +32 -20
- package/lib/ModuleFactory.js +1 -1
- package/lib/ModuleFilenameHelpers.js +41 -24
- package/lib/ModuleGraph.js +30 -16
- package/lib/ModuleInfoHeaderPlugin.js +0 -1
- package/lib/ModuleTemplate.js +0 -2
- package/lib/ModuleTypeConstants.js +11 -1
- package/lib/MultiCompiler.js +23 -15
- package/lib/MultiWatching.js +6 -10
- package/lib/NodeStuffPlugin.js +2 -10
- package/lib/NormalModule.js +145 -88
- package/lib/NormalModuleFactory.js +59 -40
- package/lib/OptionsApply.js +1 -1
- package/lib/Parser.js +1 -1
- package/lib/ProgressPlugin.js +6 -10
- package/lib/ProvidePlugin.js +5 -7
- package/lib/RawModule.js +1 -6
- package/lib/RecordIdsPlugin.js +10 -6
- package/lib/ResolverFactory.js +0 -2
- package/lib/RuntimeGlobals.js +5 -0
- package/lib/RuntimeModule.js +1 -3
- package/lib/RuntimePlugin.js +26 -22
- package/lib/RuntimeTemplate.js +12 -11
- package/lib/SourceMapDevToolModuleOptionsPlugin.js +2 -2
- package/lib/SourceMapDevToolPlugin.js +6 -11
- package/lib/Stats.js +0 -1
- package/lib/Template.js +6 -11
- package/lib/TemplatedPathPlugin.js +2 -1
- package/lib/WatchIgnorePlugin.js +2 -3
- package/lib/Watching.js +15 -15
- package/lib/WebpackIsIncludedPlugin.js +0 -2
- package/lib/WebpackOptionsApply.js +74 -107
- package/lib/asset/AssetBytesGenerator.js +166 -0
- package/lib/asset/AssetBytesParser.js +37 -0
- package/lib/asset/AssetGenerator.js +20 -34
- package/lib/asset/AssetModulesPlugin.js +34 -16
- package/lib/asset/AssetParser.js +7 -3
- package/lib/asset/AssetSourceGenerator.js +1 -1
- package/lib/asset/RawDataUrlModule.js +3 -2
- package/lib/async-modules/AsyncModuleHelpers.js +6 -4
- package/lib/async-modules/AwaitDependenciesInitFragment.js +4 -1
- package/lib/buildChunkGraph.js +0 -1
- package/lib/cache/MemoryCachePlugin.js +0 -2
- package/lib/cache/MemoryWithGcCachePlugin.js +0 -2
- package/lib/cache/PackFileCacheStrategy.js +14 -1
- package/lib/cache/ResolverCachePlugin.js +9 -15
- package/lib/config/defaults.js +155 -21
- package/lib/config/normalization.js +18 -3
- package/lib/container/ContainerEntryDependency.js +0 -1
- package/lib/container/ContainerEntryModule.js +3 -7
- package/lib/container/ContainerPlugin.js +1 -2
- package/lib/container/ContainerReferencePlugin.js +0 -1
- package/lib/container/FallbackDependency.js +2 -1
- package/lib/container/FallbackModule.js +6 -7
- package/lib/container/ModuleFederationPlugin.js +0 -1
- package/lib/container/RemoteModule.js +8 -8
- package/lib/container/RemoteRuntimeModule.js +2 -2
- package/lib/css/CssGenerator.js +3 -6
- package/lib/css/CssLoadingRuntimeModule.js +6 -9
- package/lib/css/CssModulesPlugin.js +11 -13
- package/lib/css/CssParser.js +3 -3
- package/lib/css/walkCssTokens.js +1 -1
- package/lib/debug/ProfilingPlugin.js +35 -8
- package/lib/dependencies/AMDDefineDependencyParserPlugin.js +12 -17
- package/lib/dependencies/AMDPlugin.js +2 -2
- package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +1 -2
- package/lib/dependencies/CachedConstDependency.js +0 -4
- package/lib/dependencies/CommonJsExportRequireDependency.js +20 -14
- package/lib/dependencies/CommonJsExportsDependency.js +2 -1
- package/lib/dependencies/CommonJsExportsParserPlugin.js +20 -5
- package/lib/dependencies/CommonJsFullRequireDependency.js +6 -4
- package/lib/dependencies/CommonJsImportsParserPlugin.js +16 -7
- package/lib/dependencies/CommonJsRequireContextDependency.js +1 -1
- package/lib/dependencies/CommonJsSelfReferenceDependency.js +4 -4
- package/lib/dependencies/ConstDependency.js +2 -2
- package/lib/dependencies/ContextDependency.js +9 -4
- package/lib/dependencies/ContextDependencyHelpers.js +2 -2
- package/lib/dependencies/ContextDependencyTemplateAsId.js +9 -9
- package/lib/dependencies/ContextDependencyTemplateAsRequireCall.js +9 -9
- package/lib/dependencies/ContextElementDependency.js +22 -11
- package/lib/dependencies/CssIcssImportDependency.js +0 -2
- package/lib/dependencies/CssIcssSymbolDependency.js +2 -2
- package/lib/dependencies/CssImportDependency.js +0 -8
- package/lib/dependencies/CssLocalIdentifierDependency.js +3 -4
- package/lib/dependencies/CssSelfLocalIdentifierDependency.js +2 -2
- package/lib/dependencies/CssUrlDependency.js +0 -6
- package/lib/dependencies/ExportsInfoDependency.js +7 -9
- package/lib/dependencies/ExternalModuleDependency.js +0 -3
- package/lib/dependencies/ExternalModuleInitFragment.js +1 -1
- package/lib/dependencies/HarmonyAcceptDependency.js +1 -1
- package/lib/dependencies/HarmonyAcceptImportDependency.js +0 -4
- package/lib/dependencies/HarmonyCompatibilityDependency.js +0 -1
- package/lib/dependencies/HarmonyDetectionParserPlugin.js +0 -14
- package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +3 -3
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +4 -1
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +29 -35
- package/lib/dependencies/HarmonyImportDependency.js +30 -14
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +38 -24
- package/lib/dependencies/HarmonyImportSideEffectDependency.js +0 -4
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +46 -31
- package/lib/dependencies/HarmonyModulesPlugin.js +3 -3
- package/lib/dependencies/ImportDependency.js +18 -6
- package/lib/dependencies/ImportEagerDependency.js +2 -3
- package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +8 -5
- package/lib/dependencies/ImportMetaContextPlugin.js +0 -1
- package/lib/dependencies/ImportMetaPlugin.js +8 -1
- package/lib/dependencies/ImportParserPlugin.js +294 -45
- package/lib/dependencies/ImportWeakDependency.js +2 -3
- package/lib/dependencies/JsonExportsDependency.js +0 -1
- package/lib/dependencies/LoaderDependency.js +0 -3
- package/lib/dependencies/LoaderImportDependency.js +0 -3
- package/lib/dependencies/LoaderPlugin.js +11 -5
- package/lib/dependencies/ModuleDecoratorDependency.js +2 -4
- package/lib/dependencies/ModuleDependency.js +3 -9
- package/lib/dependencies/NullDependency.js +2 -0
- package/lib/dependencies/ProvidedDependency.js +6 -8
- package/lib/dependencies/PureExpressionDependency.js +0 -1
- package/lib/dependencies/RequireEnsureDependenciesBlock.js +0 -1
- package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +1 -2
- package/lib/dependencies/RequireIncludeDependency.js +2 -2
- package/lib/dependencies/RequireResolveDependency.js +2 -2
- package/lib/dependencies/RuntimeRequirementsDependency.js +2 -3
- package/lib/dependencies/StaticExportsDependency.js +3 -5
- package/lib/dependencies/URLDependency.js +2 -7
- package/lib/dependencies/URLPlugin.js +1 -2
- package/lib/dependencies/WebAssemblyExportImportedDependency.js +2 -2
- package/lib/dependencies/WebAssemblyImportDependency.js +2 -2
- package/lib/dependencies/WebpackIsIncludedDependency.js +2 -3
- package/lib/dependencies/WorkerDependency.js +2 -3
- package/lib/dependencies/WorkerPlugin.js +3 -9
- package/lib/dependencies/processExportInfo.js +2 -3
- package/lib/esm/ModuleChunkFormatPlugin.js +0 -3
- package/lib/esm/ModuleChunkLoadingPlugin.js +2 -1
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +7 -7
- package/lib/hmr/LazyCompilationPlugin.js +6 -4
- package/lib/hmr/lazyCompilationBackend.js +13 -10
- package/lib/ids/DeterministicChunkIdsPlugin.js +0 -1
- package/lib/ids/NamedChunkIdsPlugin.js +1 -6
- package/lib/ids/NamedModuleIdsPlugin.js +1 -5
- package/lib/ids/NaturalChunkIdsPlugin.js +0 -1
- package/lib/ids/NaturalModuleIdsPlugin.js +0 -1
- package/lib/ids/OccurrenceChunkIdsPlugin.js +0 -1
- package/lib/ids/OccurrenceModuleIdsPlugin.js +0 -1
- package/lib/ids/SyncModuleIdsPlugin.js +4 -3
- package/lib/index.js +8 -7
- package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +4 -1
- package/lib/javascript/BasicEvaluatedExpression.js +13 -6
- package/lib/javascript/ChunkFormatHelpers.js +1 -1
- package/lib/javascript/CommonJsChunkFormatPlugin.js +0 -1
- package/lib/javascript/JavascriptGenerator.js +2 -3
- package/lib/javascript/JavascriptModulesPlugin.js +44 -21
- package/lib/javascript/JavascriptParser.js +159 -93
- package/lib/javascript/JavascriptParserHelpers.js +2 -2
- package/lib/javascript/StartupHelpers.js +2 -4
- package/lib/json/JsonData.js +1 -1
- package/lib/json/JsonGenerator.js +4 -5
- package/lib/json/JsonModulesPlugin.js +0 -3
- package/lib/json/JsonParser.js +4 -2
- package/lib/library/AbstractLibraryPlugin.js +2 -2
- package/lib/library/AmdLibraryPlugin.js +0 -1
- package/lib/library/AssignLibraryPlugin.js +23 -12
- package/lib/library/EnableLibraryPlugin.js +7 -11
- package/lib/library/ExportPropertyLibraryPlugin.js +8 -20
- package/lib/library/JsonpLibraryPlugin.js +5 -2
- package/lib/library/ModuleLibraryPlugin.js +88 -43
- package/lib/library/SystemLibraryPlugin.js +0 -1
- package/lib/library/UmdLibraryPlugin.js +12 -18
- package/lib/logging/Logger.js +12 -10
- package/lib/logging/createConsoleLogger.js +15 -14
- package/lib/logging/truncateArgs.js +1 -1
- package/lib/node/CommonJsChunkLoadingPlugin.js +2 -1
- package/lib/node/NodeWatchFileSystem.js +4 -4
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +2 -2
- package/lib/node/RequireChunkLoadingRuntimeModule.js +5 -2
- package/lib/node/nodeConsole.js +2 -2
- package/lib/optimize/AggressiveSplittingPlugin.js +2 -0
- package/lib/optimize/ConcatenatedModule.js +142 -100
- package/lib/optimize/InnerGraph.js +17 -11
- package/lib/optimize/InnerGraphPlugin.js +0 -3
- package/lib/optimize/ModuleConcatenationPlugin.js +3 -4
- package/lib/optimize/RuntimeChunkPlugin.js +0 -1
- package/lib/optimize/SideEffectsFlagPlugin.js +3 -10
- package/lib/optimize/SplitChunksPlugin.js +46 -40
- package/lib/performance/SizeLimitsPlugin.js +2 -1
- package/lib/prefetch/ChunkPrefetchFunctionRuntimeModule.js +5 -7
- package/lib/prefetch/ChunkPrefetchPreloadPlugin.js +0 -2
- package/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js +0 -1
- package/lib/prefetch/ChunkPrefetchTriggerRuntimeModule.js +2 -2
- package/lib/prefetch/ChunkPreloadTriggerRuntimeModule.js +2 -2
- package/lib/rules/BasicMatcherRulePlugin.js +0 -2
- package/lib/rules/ObjectMatcherRulePlugin.js +0 -1
- package/lib/rules/RuleSetCompiler.js +8 -6
- package/lib/runtime/BaseUriRuntimeModule.js +2 -2
- package/lib/runtime/CompatRuntimeModule.js +0 -1
- package/lib/runtime/GetChunkFilenameRuntimeModule.js +8 -9
- package/lib/runtime/LoadScriptRuntimeModule.js +0 -2
- package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +1 -1
- package/lib/runtime/PublicPathRuntimeModule.js +2 -2
- package/lib/runtime/StartupEntrypointRuntimeModule.js +0 -1
- package/lib/runtime/SystemContextRuntimeModule.js +0 -2
- package/lib/runtime/ToBinaryRuntimeModule.js +64 -0
- package/lib/schemes/DataUriPlugin.js +2 -28
- package/lib/schemes/FileUriPlugin.js +5 -2
- package/lib/schemes/HttpUriPlugin.js +4 -2
- package/lib/schemes/VirtualUrlPlugin.js +11 -11
- package/lib/serialization/NullPrototypeObjectSerializer.js +5 -3
- package/lib/serialization/ObjectMiddleware.js +30 -19
- package/lib/serialization/SerializerMiddleware.js +1 -3
- package/lib/serialization/types.js +1 -1
- package/lib/sharing/ConsumeSharedModule.js +3 -5
- package/lib/sharing/ConsumeSharedPlugin.js +2 -4
- package/lib/sharing/ConsumeSharedRuntimeModule.js +9 -6
- package/lib/sharing/ProvideSharedModule.js +3 -7
- package/lib/sharing/SharePlugin.js +0 -2
- package/lib/sharing/ShareRuntimeModule.js +4 -1
- package/lib/sharing/resolveMatchedConfigs.js +14 -6
- package/lib/sharing/utils.js +0 -6
- package/lib/stats/DefaultStatsFactoryPlugin.js +178 -94
- package/lib/stats/DefaultStatsPresetPlugin.js +15 -9
- package/lib/stats/DefaultStatsPrinterPlugin.js +77 -113
- package/lib/stats/StatsFactory.js +14 -11
- package/lib/url/URLParserPlugin.js +2 -4
- package/lib/util/ArrayHelpers.js +4 -4
- package/lib/util/AsyncQueue.js +1 -0
- package/lib/util/LazySet.js +2 -2
- package/lib/util/StackedCacheMap.js +0 -2
- package/lib/util/TupleSet.js +9 -4
- package/lib/util/URLAbsoluteSpecifier.js +0 -1
- package/lib/util/WeakTupleMap.js +1 -1
- package/lib/util/chainedImports.js +3 -1
- package/lib/util/cleverMerge.js +15 -18
- package/lib/util/comparators.js +2 -4
- package/lib/util/compileBooleanMatcher.js +11 -9
- package/lib/util/concatenate.js +1 -2
- package/lib/util/create-schema-validation.js +0 -1
- package/lib/util/dataURL.js +39 -0
- package/lib/util/deprecation.js +29 -31
- package/lib/util/deterministicGrouping.js +34 -30
- package/lib/util/extractSourceMap.js +319 -0
- package/lib/util/findGraphRoots.js +15 -5
- package/lib/util/fs.js +29 -8
- package/lib/util/semver.js +9 -8
- package/lib/util/smartGrouping.js +41 -26
- package/lib/util/traverseDestructuringAssignmentProperties.js +45 -0
- package/lib/wasm/EnableWasmLoadingPlugin.js +3 -2
- package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +5 -1
- package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +2 -13
- package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +2 -9
- package/lib/wasm-async/AsyncWebAssemblyParser.js +2 -1
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +6 -4
- package/lib/wasm-sync/WebAssemblyGenerator.js +1 -3
- package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +1 -4
- package/lib/wasm-sync/WebAssemblyModulesPlugin.js +2 -7
- package/lib/wasm-sync/WebAssemblyParser.js +1 -4
- package/lib/web/JsonpChunkLoadingPlugin.js +2 -1
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +1 -1
- package/lib/web/JsonpTemplatePlugin.js +0 -1
- package/lib/webpack.js +21 -8
- package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +2 -1
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +1 -1
- package/package.json +13 -13
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +77 -93
- package/schemas/plugins/BannerPlugin.check.js +1 -1
- package/schemas/plugins/BannerPlugin.json +4 -0
- package/schemas/plugins/IgnorePlugin.json +1 -1
- package/schemas/plugins/ProgressPlugin.json +1 -1
- package/schemas/plugins/SourceMapDevToolPlugin.check.js +1 -1
- package/schemas/plugins/SourceMapDevToolPlugin.json +5 -1
- package/schemas/plugins/schemes/VirtualUrlPlugin.json +3 -3
- package/types.d.ts +1140 -505
- package/SECURITY.md +0 -9
|
@@ -10,9 +10,6 @@
|
|
|
10
10
|
/** @typedef {import("./DefaultStatsFactoryPlugin").ChunkId} ChunkId */
|
|
11
11
|
/** @typedef {import("./DefaultStatsFactoryPlugin").ChunkName} ChunkName */
|
|
12
12
|
/** @typedef {import("./DefaultStatsFactoryPlugin").KnownStatsAsset} KnownStatsAsset */
|
|
13
|
-
/** @typedef {import("./DefaultStatsFactoryPlugin").KnownStatsAssetChunk} KnownStatsAssetChunk */
|
|
14
|
-
/** @typedef {import("./DefaultStatsFactoryPlugin").KnownStatsAssetChunkIdHint} KnownStatsAssetChunkIdHint */
|
|
15
|
-
/** @typedef {import("./DefaultStatsFactoryPlugin").KnownStatsAssetChunkName} KnownStatsAssetChunkName */
|
|
16
13
|
/** @typedef {import("./DefaultStatsFactoryPlugin").KnownStatsChunk} KnownStatsChunk */
|
|
17
14
|
/** @typedef {import("./DefaultStatsFactoryPlugin").KnownStatsChunkGroup} KnownStatsChunkGroup */
|
|
18
15
|
/** @typedef {import("./DefaultStatsFactoryPlugin").KnownStatsChunkOrigin} KnownStatsChunkOrigin */
|
|
@@ -128,7 +125,7 @@ const isValidId = (id) => {
|
|
|
128
125
|
|
|
129
126
|
/**
|
|
130
127
|
* @template T
|
|
131
|
-
* @param {
|
|
128
|
+
* @param {T[] | undefined} list of items
|
|
132
129
|
* @param {number} count number of items to show
|
|
133
130
|
* @returns {string} string representation of list
|
|
134
131
|
*/
|
|
@@ -161,21 +158,14 @@ const moreCount = (list, count) =>
|
|
|
161
158
|
* @template {object} O
|
|
162
159
|
* @template {keyof O} K
|
|
163
160
|
* @template {string} B
|
|
164
|
-
* @typedef {K extends string ?
|
|
161
|
+
* @typedef {K extends string ? `${B}.${K}` : never} PropertyName
|
|
165
162
|
*/
|
|
166
163
|
|
|
167
164
|
/**
|
|
168
165
|
* @template {object} O
|
|
169
166
|
* @template {keyof O} K
|
|
170
167
|
* @template {string} B
|
|
171
|
-
* @typedef {K extends string ?
|
|
172
|
-
*/
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* @template {object} O
|
|
176
|
-
* @template {keyof O} K
|
|
177
|
-
* @template {string} B
|
|
178
|
-
* @typedef {K extends string ? Exclude<O[K], undefined> extends EXPECTED_ANY[] ? `${B}.${K}` : never : never} MultiplePropertyName
|
|
168
|
+
* @typedef {K extends string ? `${B}.${K}[]` : never} ArrayPropertyName
|
|
179
169
|
*/
|
|
180
170
|
|
|
181
171
|
/**
|
|
@@ -190,9 +180,7 @@ const moreCount = (list, count) =>
|
|
|
190
180
|
* @template {string} B
|
|
191
181
|
* @template {string} [R=B]
|
|
192
182
|
* @typedef {{ [K in keyof O as PropertyName<O, K, B>]?: SimplePrinter<O[K], R> } &
|
|
193
|
-
* { [K in keyof O as ArrayPropertyName<O, K, B>]?: Exclude<O[K], undefined> extends (infer I)[] ? SimplePrinter<I, R> : never }
|
|
194
|
-
* { [K in keyof O as MultiplePropertyName<O, K, B>]?: SimplePrinter<O[K], R> }
|
|
195
|
-
* } Printers
|
|
183
|
+
* { [K in keyof O as ArrayPropertyName<O, K, B>]?: Exclude<O[K], undefined> extends (infer I)[] ? SimplePrinter<I, R> : never }} Printers
|
|
196
184
|
*/
|
|
197
185
|
|
|
198
186
|
/**
|
|
@@ -421,9 +409,9 @@ const COMPILATION_SIMPLE_PRINTERS = {
|
|
|
421
409
|
* Printers<KnownStatsAsset["info"], "asset.info"> &
|
|
422
410
|
* Exclamation<KnownStatsAsset, "asset.separator", "asset"> &
|
|
423
411
|
* { ["asset.filteredChildren"]?: SimplePrinter<number, "asset"> } &
|
|
424
|
-
* { assetChunk?: SimplePrinter<
|
|
425
|
-
* { assetChunkName?: SimplePrinter<
|
|
426
|
-
* { assetChunkIdHint?: SimplePrinter<
|
|
412
|
+
* { assetChunk?: SimplePrinter<ChunkId, "asset"> } &
|
|
413
|
+
* { assetChunkName?: SimplePrinter<ChunkName, "asset"> } &
|
|
414
|
+
* { assetChunkIdHint?: SimplePrinter<string, "asset"> }} AssetSimplePrinters
|
|
427
415
|
*/
|
|
428
416
|
|
|
429
417
|
/** @type {AssetSimplePrinters} */
|
|
@@ -473,7 +461,6 @@ const ASSET_SIMPLE_PRINTERS = {
|
|
|
473
461
|
: undefined,
|
|
474
462
|
|
|
475
463
|
assetChunk: (id, { formatChunkId }) => formatChunkId(id),
|
|
476
|
-
|
|
477
464
|
assetChunkName: (name) => name || undefined,
|
|
478
465
|
assetChunkIdHint: (name) => name || undefined
|
|
479
466
|
};
|
|
@@ -1463,7 +1450,12 @@ const AVAILABLE_COLORS = {
|
|
|
1463
1450
|
* @typedef {T extends [infer Head, ...infer Tail] ? Tail : undefined} Tail
|
|
1464
1451
|
*/
|
|
1465
1452
|
|
|
1466
|
-
/**
|
|
1453
|
+
/**
|
|
1454
|
+
* @template {(...args: EXPECTED_ANY[]) => EXPECTED_ANY} T
|
|
1455
|
+
* @typedef {T extends (firstArg: EXPECTED_ANY, ...rest: infer R) => EXPECTED_ANY ? R : never} TailParameters
|
|
1456
|
+
*/
|
|
1457
|
+
|
|
1458
|
+
/** @typedef {{ [Key in keyof KnownStatsPrinterFormatters]: (value: Parameters<NonNullable<KnownStatsPrinterFormatters[Key]>>[0], options: Required<KnownStatsPrinterColorFunctions> & StatsPrinterContextWithExtra, ...args: TailParameters<NonNullable<KnownStatsPrinterFormatters[Key]>>) => string }} AvailableFormats */
|
|
1467
1459
|
|
|
1468
1460
|
/** @type {AvailableFormats} */
|
|
1469
1461
|
const AVAILABLE_FORMATS = {
|
|
@@ -1639,16 +1631,14 @@ class DefaultStatsPrinterPlugin {
|
|
|
1639
1631
|
context[color] = (str) => str;
|
|
1640
1632
|
}
|
|
1641
1633
|
}
|
|
1642
|
-
for (const
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
(_format);
|
|
1646
|
-
|
|
1634
|
+
for (const format of /** @type {(keyof KnownStatsPrinterFormatters)[]} */ (
|
|
1635
|
+
Object.keys(AVAILABLE_FORMATS)
|
|
1636
|
+
)) {
|
|
1647
1637
|
context[format] =
|
|
1648
1638
|
/** @type {(content: Parameters<NonNullable<KnownStatsPrinterFormatters[keyof KnownStatsPrinterFormatters]>>[0], ...args: Tail<Parameters<NonNullable<KnownStatsPrinterFormatters[keyof KnownStatsPrinterFormatters]>>>) => string} */
|
|
1649
1639
|
(content, ...args) =>
|
|
1650
|
-
/** @type {
|
|
1651
|
-
(AVAILABLE_FORMATS
|
|
1640
|
+
/** @type {EXPECTED_ANY} */
|
|
1641
|
+
(AVAILABLE_FORMATS[format])(
|
|
1652
1642
|
content,
|
|
1653
1643
|
/** @type {StatsPrinterContext & Required<KnownStatsPrinterColorFunctions>} */
|
|
1654
1644
|
(context),
|
|
@@ -1658,15 +1648,12 @@ class DefaultStatsPrinterPlugin {
|
|
|
1658
1648
|
context.timeReference = compilation.time;
|
|
1659
1649
|
});
|
|
1660
1650
|
|
|
1661
|
-
for (const key of
|
|
1651
|
+
for (const key of /** @type {(keyof CompilationSimplePrinters)[]} */ (
|
|
1652
|
+
Object.keys(COMPILATION_SIMPLE_PRINTERS)
|
|
1653
|
+
)) {
|
|
1662
1654
|
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
|
1663
|
-
/** @type {
|
|
1664
|
-
(
|
|
1665
|
-
COMPILATION_SIMPLE_PRINTERS[
|
|
1666
|
-
/** @type {keyof CompilationSimplePrinters} */
|
|
1667
|
-
(key)
|
|
1668
|
-
]
|
|
1669
|
-
)(
|
|
1655
|
+
/** @type {EXPECTED_ANY} */
|
|
1656
|
+
(COMPILATION_SIMPLE_PRINTERS)[key](
|
|
1670
1657
|
obj,
|
|
1671
1658
|
/** @type {DefineStatsPrinterContext<"compilation">} */
|
|
1672
1659
|
(ctx),
|
|
@@ -1675,15 +1662,12 @@ class DefaultStatsPrinterPlugin {
|
|
|
1675
1662
|
);
|
|
1676
1663
|
}
|
|
1677
1664
|
|
|
1678
|
-
for (const key of
|
|
1665
|
+
for (const key of /** @type {(keyof AssetSimplePrinters)[]} */ (
|
|
1666
|
+
Object.keys(ASSET_SIMPLE_PRINTERS)
|
|
1667
|
+
)) {
|
|
1679
1668
|
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
|
1680
1669
|
/** @type {NonNullable<AssetSimplePrinters[keyof AssetSimplePrinters]>} */
|
|
1681
|
-
(
|
|
1682
|
-
ASSET_SIMPLE_PRINTERS[
|
|
1683
|
-
/** @type {keyof AssetSimplePrinters} */
|
|
1684
|
-
(key)
|
|
1685
|
-
]
|
|
1686
|
-
)(
|
|
1670
|
+
(ASSET_SIMPLE_PRINTERS[key])(
|
|
1687
1671
|
obj,
|
|
1688
1672
|
/** @type {DefineStatsPrinterContext<"asset" | "asset.info">} */
|
|
1689
1673
|
(ctx),
|
|
@@ -1692,15 +1676,12 @@ class DefaultStatsPrinterPlugin {
|
|
|
1692
1676
|
);
|
|
1693
1677
|
}
|
|
1694
1678
|
|
|
1695
|
-
for (const key of
|
|
1679
|
+
for (const key of /** @type {(keyof ModuleSimplePrinters)[]} */ (
|
|
1680
|
+
Object.keys(MODULE_SIMPLE_PRINTERS)
|
|
1681
|
+
)) {
|
|
1696
1682
|
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
|
1697
|
-
/** @type {
|
|
1698
|
-
(
|
|
1699
|
-
MODULE_SIMPLE_PRINTERS[
|
|
1700
|
-
/** @type {keyof ModuleSimplePrinters} */
|
|
1701
|
-
(key)
|
|
1702
|
-
]
|
|
1703
|
-
)(
|
|
1683
|
+
/** @type {EXPECTED_ANY} */
|
|
1684
|
+
(MODULE_SIMPLE_PRINTERS)[key](
|
|
1704
1685
|
obj,
|
|
1705
1686
|
/** @type {DefineStatsPrinterContext<"module">} */
|
|
1706
1687
|
(ctx),
|
|
@@ -1709,15 +1690,12 @@ class DefaultStatsPrinterPlugin {
|
|
|
1709
1690
|
);
|
|
1710
1691
|
}
|
|
1711
1692
|
|
|
1712
|
-
for (const key of
|
|
1693
|
+
for (const key of /** @type {(keyof ModuleIssuerPrinters)[]} */ (
|
|
1694
|
+
Object.keys(MODULE_ISSUER_PRINTERS)
|
|
1695
|
+
)) {
|
|
1713
1696
|
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
|
1714
1697
|
/** @type {NonNullable<ModuleIssuerPrinters[keyof ModuleIssuerPrinters]>} */
|
|
1715
|
-
(
|
|
1716
|
-
MODULE_ISSUER_PRINTERS[
|
|
1717
|
-
/** @type {keyof ModuleIssuerPrinters} */
|
|
1718
|
-
(key)
|
|
1719
|
-
]
|
|
1720
|
-
)(
|
|
1698
|
+
(MODULE_ISSUER_PRINTERS[key])(
|
|
1721
1699
|
obj,
|
|
1722
1700
|
/** @type {DefineStatsPrinterContext<"moduleIssuer">} */
|
|
1723
1701
|
(ctx),
|
|
@@ -1726,15 +1704,12 @@ class DefaultStatsPrinterPlugin {
|
|
|
1726
1704
|
);
|
|
1727
1705
|
}
|
|
1728
1706
|
|
|
1729
|
-
for (const key of
|
|
1707
|
+
for (const key of /** @type {(keyof ModuleReasonsPrinters)[]} */ (
|
|
1708
|
+
Object.keys(MODULE_REASON_PRINTERS)
|
|
1709
|
+
)) {
|
|
1730
1710
|
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
|
1731
|
-
/** @type {
|
|
1732
|
-
(
|
|
1733
|
-
MODULE_REASON_PRINTERS[
|
|
1734
|
-
/** @type {keyof ModuleReasonsPrinters} */
|
|
1735
|
-
(key)
|
|
1736
|
-
]
|
|
1737
|
-
)(
|
|
1711
|
+
/** @type {EXPECTED_ANY} */
|
|
1712
|
+
(MODULE_REASON_PRINTERS)[key](
|
|
1738
1713
|
obj,
|
|
1739
1714
|
/** @type {DefineStatsPrinterContext<"moduleReason">} */
|
|
1740
1715
|
(ctx),
|
|
@@ -1743,15 +1718,12 @@ class DefaultStatsPrinterPlugin {
|
|
|
1743
1718
|
);
|
|
1744
1719
|
}
|
|
1745
1720
|
|
|
1746
|
-
for (const key of
|
|
1721
|
+
for (const key of /** @type {(keyof ModuleProfilePrinters)[]} */ (
|
|
1722
|
+
Object.keys(MODULE_PROFILE_PRINTERS)
|
|
1723
|
+
)) {
|
|
1747
1724
|
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
|
1748
1725
|
/** @type {NonNullable<ModuleProfilePrinters[keyof ModuleProfilePrinters]>} */
|
|
1749
|
-
(
|
|
1750
|
-
MODULE_PROFILE_PRINTERS[
|
|
1751
|
-
/** @type {keyof ModuleProfilePrinters} */
|
|
1752
|
-
(key)
|
|
1753
|
-
]
|
|
1754
|
-
)(
|
|
1726
|
+
(MODULE_PROFILE_PRINTERS[key])(
|
|
1755
1727
|
obj,
|
|
1756
1728
|
/** @type {DefineStatsPrinterContext<"profile">} */
|
|
1757
1729
|
(ctx),
|
|
@@ -1760,15 +1732,12 @@ class DefaultStatsPrinterPlugin {
|
|
|
1760
1732
|
);
|
|
1761
1733
|
}
|
|
1762
1734
|
|
|
1763
|
-
for (const key of
|
|
1735
|
+
for (const key of /** @type {(keyof ChunkGroupPrinters)[]} */ (
|
|
1736
|
+
Object.keys(CHUNK_GROUP_PRINTERS)
|
|
1737
|
+
)) {
|
|
1764
1738
|
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
|
1765
|
-
/** @type {
|
|
1766
|
-
(
|
|
1767
|
-
CHUNK_GROUP_PRINTERS[
|
|
1768
|
-
/** @type {keyof ChunkGroupPrinters} */
|
|
1769
|
-
(key)
|
|
1770
|
-
]
|
|
1771
|
-
)(
|
|
1739
|
+
/** @type {EXPECTED_ANY} */
|
|
1740
|
+
(CHUNK_GROUP_PRINTERS)[key](
|
|
1772
1741
|
obj,
|
|
1773
1742
|
/** @type {DefineStatsPrinterContext<"chunkGroupKind" | "chunkGroup">} */
|
|
1774
1743
|
(ctx),
|
|
@@ -1777,10 +1746,12 @@ class DefaultStatsPrinterPlugin {
|
|
|
1777
1746
|
);
|
|
1778
1747
|
}
|
|
1779
1748
|
|
|
1780
|
-
for (const key of
|
|
1749
|
+
for (const key of /** @type {(keyof ChunkPrinters)[]} */ (
|
|
1750
|
+
Object.keys(CHUNK_PRINTERS)
|
|
1751
|
+
)) {
|
|
1781
1752
|
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
|
1782
|
-
/** @type {
|
|
1783
|
-
(CHUNK_PRINTERS[
|
|
1753
|
+
/** @type {EXPECTED_ANY} */
|
|
1754
|
+
(CHUNK_PRINTERS)[key](
|
|
1784
1755
|
obj,
|
|
1785
1756
|
/** @type {DefineStatsPrinterContext<"chunk">} */
|
|
1786
1757
|
(ctx),
|
|
@@ -1789,10 +1760,12 @@ class DefaultStatsPrinterPlugin {
|
|
|
1789
1760
|
);
|
|
1790
1761
|
}
|
|
1791
1762
|
|
|
1792
|
-
for (const key of
|
|
1763
|
+
for (const key of /** @type {(keyof ErrorPrinters)[]} */ (
|
|
1764
|
+
Object.keys(ERROR_PRINTERS)
|
|
1765
|
+
)) {
|
|
1793
1766
|
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
|
1794
|
-
/** @type {
|
|
1795
|
-
(ERROR_PRINTERS[
|
|
1767
|
+
/** @type {EXPECTED_ANY} */
|
|
1768
|
+
(ERROR_PRINTERS)[key](
|
|
1796
1769
|
obj,
|
|
1797
1770
|
/** @type {DefineStatsPrinterContext<"error">} */
|
|
1798
1771
|
(ctx),
|
|
@@ -1801,15 +1774,12 @@ class DefaultStatsPrinterPlugin {
|
|
|
1801
1774
|
);
|
|
1802
1775
|
}
|
|
1803
1776
|
|
|
1804
|
-
for (const key of
|
|
1777
|
+
for (const key of /** @type {(keyof LogEntryPrinters)[]} */ (
|
|
1778
|
+
Object.keys(LOG_ENTRY_PRINTERS)
|
|
1779
|
+
)) {
|
|
1805
1780
|
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
|
1806
|
-
/** @type {
|
|
1807
|
-
(
|
|
1808
|
-
LOG_ENTRY_PRINTERS[
|
|
1809
|
-
/** @type {keyof LogEntryPrinters} */
|
|
1810
|
-
(key)
|
|
1811
|
-
]
|
|
1812
|
-
)(
|
|
1781
|
+
/** @type {EXPECTED_ANY} */
|
|
1782
|
+
(LOG_ENTRY_PRINTERS)[key](
|
|
1813
1783
|
obj,
|
|
1814
1784
|
/** @type {DefineStatsPrinterContext<"logging">} */
|
|
1815
1785
|
(ctx),
|
|
@@ -1818,15 +1788,12 @@ class DefaultStatsPrinterPlugin {
|
|
|
1818
1788
|
);
|
|
1819
1789
|
}
|
|
1820
1790
|
|
|
1821
|
-
for (const key of
|
|
1791
|
+
for (const key of /** @type {(keyof ModuleTraceDependencyPrinters)[]} */ (
|
|
1792
|
+
Object.keys(MODULE_TRACE_DEPENDENCY_PRINTERS)
|
|
1793
|
+
)) {
|
|
1822
1794
|
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
|
1823
1795
|
/** @type {NonNullable<ModuleTraceDependencyPrinters[keyof ModuleTraceDependencyPrinters]>} */
|
|
1824
|
-
(
|
|
1825
|
-
MODULE_TRACE_DEPENDENCY_PRINTERS[
|
|
1826
|
-
/** @type {keyof ModuleTraceDependencyPrinters} */
|
|
1827
|
-
(key)
|
|
1828
|
-
]
|
|
1829
|
-
)(
|
|
1796
|
+
(MODULE_TRACE_DEPENDENCY_PRINTERS[key])(
|
|
1830
1797
|
obj,
|
|
1831
1798
|
/** @type {DefineStatsPrinterContext<"moduleTraceDependency">} */
|
|
1832
1799
|
(ctx),
|
|
@@ -1835,15 +1802,12 @@ class DefaultStatsPrinterPlugin {
|
|
|
1835
1802
|
);
|
|
1836
1803
|
}
|
|
1837
1804
|
|
|
1838
|
-
for (const key of
|
|
1805
|
+
for (const key of /** @type {(keyof ModuleTraceItemPrinters)[]} */ (
|
|
1806
|
+
Object.keys(MODULE_TRACE_ITEM_PRINTERS)
|
|
1807
|
+
)) {
|
|
1839
1808
|
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
|
1840
1809
|
/** @type {NonNullable<ModuleTraceItemPrinters[keyof ModuleTraceItemPrinters]>} */
|
|
1841
|
-
(
|
|
1842
|
-
MODULE_TRACE_ITEM_PRINTERS[
|
|
1843
|
-
/** @type {keyof ModuleTraceItemPrinters} */
|
|
1844
|
-
(key)
|
|
1845
|
-
]
|
|
1846
|
-
)(
|
|
1810
|
+
(MODULE_TRACE_ITEM_PRINTERS[key])(
|
|
1847
1811
|
obj,
|
|
1848
1812
|
/** @type {DefineStatsPrinterContext<"moduleTraceItem">} */
|
|
1849
1813
|
(ctx),
|
|
@@ -1877,10 +1841,10 @@ class DefaultStatsPrinterPlugin {
|
|
|
1877
1841
|
}
|
|
1878
1842
|
|
|
1879
1843
|
for (const key of Object.keys(SIMPLE_ELEMENT_JOINERS)) {
|
|
1880
|
-
const joiner =
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1844
|
+
const joiner =
|
|
1845
|
+
/** @type {(items: Item[], context: StatsPrinterContext) => string} */
|
|
1846
|
+
(SIMPLE_ELEMENT_JOINERS[key]);
|
|
1847
|
+
stats.hooks.printElements.for(key).tap(PLUGIN_NAME, joiner);
|
|
1884
1848
|
}
|
|
1885
1849
|
|
|
1886
1850
|
for (const key of Object.keys(RESULT_MODIFIER)) {
|
|
@@ -21,7 +21,10 @@ const smartGrouping = require("../util/smartGrouping");
|
|
|
21
21
|
/** @typedef {import("../WebpackError")} WebpackError */
|
|
22
22
|
/** @typedef {import("../util/comparators").Comparator<EXPECTED_ANY>} Comparator */
|
|
23
23
|
/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
|
|
24
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* @template T, R
|
|
26
|
+
* @typedef {import("../util/smartGrouping").GroupConfig<T, R>} GroupConfig
|
|
27
|
+
*/
|
|
25
28
|
/** @typedef {import("./DefaultStatsFactoryPlugin").ChunkGroupInfoWithName} ChunkGroupInfoWithName */
|
|
26
29
|
/** @typedef {import("./DefaultStatsFactoryPlugin").ModuleIssuerPath} ModuleIssuerPath */
|
|
27
30
|
/** @typedef {import("./DefaultStatsFactoryPlugin").ModuleTrace} ModuleTrace */
|
|
@@ -41,14 +44,14 @@ const smartGrouping = require("../util/smartGrouping");
|
|
|
41
44
|
/**
|
|
42
45
|
* @typedef {object} KnownStatsFactoryContext
|
|
43
46
|
* @property {string} type
|
|
44
|
-
* @property {(path: string) => string} makePathsRelative
|
|
45
47
|
* @property {Compilation} compilation
|
|
48
|
+
* @property {(path: string) => string} makePathsRelative
|
|
46
49
|
* @property {Set<Module>} rootModules
|
|
47
50
|
* @property {Map<string, Chunk[]>} compilationFileToChunks
|
|
48
51
|
* @property {Map<string, Chunk[]>} compilationAuxiliaryFileToChunks
|
|
49
52
|
* @property {RuntimeSpec} runtime
|
|
50
|
-
* @property {(compilation: Compilation) =>
|
|
51
|
-
* @property {(compilation: Compilation) =>
|
|
53
|
+
* @property {(compilation: Compilation) => Error[]} cachedGetErrors
|
|
54
|
+
* @property {(compilation: Compilation) => Error[]} cachedGetWarnings
|
|
52
55
|
*/
|
|
53
56
|
|
|
54
57
|
/** @typedef {KnownStatsFactoryContext & Record<string, EXPECTED_ANY>} StatsFactoryContext */
|
|
@@ -67,10 +70,10 @@ const smartGrouping = require("../util/smartGrouping");
|
|
|
67
70
|
* @typedef {T extends ChunkGroupInfoWithName[] ? Record<string, StatsObject<ChunkGroupInfoWithName, F>> : T extends (infer V)[] ? StatsObject<V, F>[] : StatsObject<T, F>} CreatedObject
|
|
68
71
|
*/
|
|
69
72
|
|
|
70
|
-
/** @typedef {
|
|
71
|
-
/** @typedef {
|
|
72
|
-
/** @typedef {
|
|
73
|
-
/** @typedef {
|
|
73
|
+
/** @typedef {EXPECTED_ANY} ObjectForExtract */
|
|
74
|
+
/** @typedef {EXPECTED_ANY} FactoryData */
|
|
75
|
+
/** @typedef {EXPECTED_ANY} FactoryDataItem */
|
|
76
|
+
/** @typedef {EXPECTED_ANY} Result */
|
|
74
77
|
|
|
75
78
|
/**
|
|
76
79
|
* @typedef {object} StatsFactoryHooks
|
|
@@ -78,7 +81,7 @@ const smartGrouping = require("../util/smartGrouping");
|
|
|
78
81
|
* @property {HookMap<SyncBailHook<[FactoryDataItem, StatsFactoryContext, number, number], boolean | void>>} filter
|
|
79
82
|
* @property {HookMap<SyncBailHook<[Comparator[], StatsFactoryContext], void>>} sort
|
|
80
83
|
* @property {HookMap<SyncBailHook<[FactoryDataItem, StatsFactoryContext, number, number], boolean | void>>} filterSorted
|
|
81
|
-
* @property {HookMap<SyncBailHook<[GroupConfig[], StatsFactoryContext], void>>} groupResults
|
|
84
|
+
* @property {HookMap<SyncBailHook<[GroupConfig<EXPECTED_ANY, EXPECTED_ANY>[], StatsFactoryContext], void>>} groupResults
|
|
82
85
|
* @property {HookMap<SyncBailHook<[Comparator[], StatsFactoryContext], void>>} sortResults
|
|
83
86
|
* @property {HookMap<SyncBailHook<[FactoryDataItem, StatsFactoryContext, number, number], boolean | void>>} filterResults
|
|
84
87
|
* @property {HookMap<SyncBailHook<[FactoryDataItem[], StatsFactoryContext], Result | void>>} merge
|
|
@@ -198,7 +201,7 @@ class StatsFactory {
|
|
|
198
201
|
* @param {T} hookMap hook map
|
|
199
202
|
* @param {Caches<H>} cache cache
|
|
200
203
|
* @param {string} type type
|
|
201
|
-
* @param {
|
|
204
|
+
* @param {FactoryData[]} items items
|
|
202
205
|
* @param {(hook: H, item: R, idx: number, i: number) => R | undefined} fn fn
|
|
203
206
|
* @param {boolean} forceClone force clone
|
|
204
207
|
* @returns {R[]} result for each level
|
|
@@ -341,7 +344,7 @@ class StatsFactory {
|
|
|
341
344
|
}
|
|
342
345
|
|
|
343
346
|
// group result items
|
|
344
|
-
/** @type {GroupConfig[]} */
|
|
347
|
+
/** @type {GroupConfig<EXPECTED_ANY, EXPECTED_ANY>[]} */
|
|
345
348
|
const groupConfigs = [];
|
|
346
349
|
this._forEachLevel(
|
|
347
350
|
this.hooks.groupResults,
|
|
@@ -20,11 +20,9 @@ const InnerGraph = require("../optimize/InnerGraph");
|
|
|
20
20
|
/** @typedef {import("estree").MemberExpression} MemberExpression */
|
|
21
21
|
/** @typedef {import("estree").NewExpression} NewExpressionNode */
|
|
22
22
|
/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */
|
|
23
|
-
/** @typedef {import("../ContextModule").ContextMode} ContextMode */
|
|
24
23
|
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
|
|
25
24
|
/** @typedef {import("../NormalModule")} NormalModule */
|
|
26
25
|
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
|
|
27
|
-
/** @typedef {import("../javascript/JavascriptParser")} Parser */
|
|
28
26
|
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
|
29
27
|
|
|
30
28
|
const PLUGIN_NAME = "URLParserPlugin";
|
|
@@ -36,7 +34,7 @@ const PLUGIN_NAME = "URLParserPlugin";
|
|
|
36
34
|
const getUrl = (module) => pathToFileURL(module.resource);
|
|
37
35
|
|
|
38
36
|
/**
|
|
39
|
-
* @param {
|
|
37
|
+
* @param {JavascriptParser} parser parser parser
|
|
40
38
|
* @param {MemberExpression} arg arg
|
|
41
39
|
* @returns {boolean} true when it is `meta.url`, otherwise false
|
|
42
40
|
*/
|
|
@@ -63,7 +61,7 @@ const getEvaluatedExprCache = new WeakMap();
|
|
|
63
61
|
|
|
64
62
|
/**
|
|
65
63
|
* @param {NewExpressionNode} expr expression
|
|
66
|
-
* @param {
|
|
64
|
+
* @param {JavascriptParser} parser parser parser
|
|
67
65
|
* @returns {BasicEvaluatedExpression | undefined} basic evaluated expression
|
|
68
66
|
*/
|
|
69
67
|
const getEvaluatedExpr = (expr, parser) => {
|
package/lib/util/ArrayHelpers.js
CHANGED
|
@@ -23,9 +23,9 @@ module.exports.equals = (a, b) => {
|
|
|
23
23
|
/**
|
|
24
24
|
* Partition an array by calling a predicate function on each value.
|
|
25
25
|
* @template T
|
|
26
|
-
* @param {
|
|
26
|
+
* @param {T[]} arr Array of values to be partitioned
|
|
27
27
|
* @param {(value: T) => boolean} fn Partition function which partitions based on truthiness of result.
|
|
28
|
-
* @returns {[
|
|
28
|
+
* @returns {[T[], T[]]} returns the values of `arr` partitioned into two new arrays based on fn predicate.
|
|
29
29
|
*/
|
|
30
30
|
module.exports.groupBy = (
|
|
31
31
|
// eslint-disable-next-line default-param-last
|
|
@@ -34,9 +34,9 @@ module.exports.groupBy = (
|
|
|
34
34
|
) =>
|
|
35
35
|
arr.reduce(
|
|
36
36
|
/**
|
|
37
|
-
* @param {[
|
|
37
|
+
* @param {[T[], T[]]} groups An accumulator storing already partitioned values returned from previous call.
|
|
38
38
|
* @param {T} value The value of the current element
|
|
39
|
-
* @returns {[
|
|
39
|
+
* @returns {[T[], T[]]} returns an array of partitioned groups accumulator resulting from calling a predicate on the current value.
|
|
40
40
|
*/
|
|
41
41
|
(groups, value) => {
|
|
42
42
|
groups[fn(value) ? 0 : 1].push(value);
|
package/lib/util/AsyncQueue.js
CHANGED
package/lib/util/LazySet.js
CHANGED
|
@@ -24,7 +24,7 @@ const merge = (targetSet, toMerge) => {
|
|
|
24
24
|
/**
|
|
25
25
|
* @template T
|
|
26
26
|
* @param {Set<Iterable<T>>} targetSet set where iterables should be added
|
|
27
|
-
* @param {
|
|
27
|
+
* @param {LazySet<T>[]} toDeepMerge lazy sets to be flattened
|
|
28
28
|
* @returns {void}
|
|
29
29
|
*/
|
|
30
30
|
const flatten = (targetSet, toDeepMerge) => {
|
|
@@ -59,7 +59,7 @@ class LazySet {
|
|
|
59
59
|
this._set = new Set(iterable);
|
|
60
60
|
/** @type {Set<Iterable<T>>} */
|
|
61
61
|
this._toMerge = new Set();
|
|
62
|
-
/** @type {
|
|
62
|
+
/** @type {LazySet<T>[]} */
|
|
63
63
|
this._toDeepMerge = [];
|
|
64
64
|
this._needMerge = false;
|
|
65
65
|
this._deopt = false;
|
package/lib/util/TupleSet.js
CHANGED
|
@@ -112,9 +112,14 @@ class TupleSet {
|
|
|
112
112
|
* @returns {Iterator<[T, V, ...EXPECTED_ANY]>} iterator
|
|
113
113
|
*/
|
|
114
114
|
[Symbol.iterator]() {
|
|
115
|
+
/**
|
|
116
|
+
* @template T, V
|
|
117
|
+
* @typedef {MapIterator<[T, InnerMap<T, V> | Set<V>]>} IteratorStack
|
|
118
|
+
*/
|
|
119
|
+
|
|
115
120
|
// This is difficult to type because we can have a map inside a map inside a map, etc. where the end is a set (each key is an argument)
|
|
116
121
|
// But in basic use we only have 2 arguments in our methods, so we have `Map<K, Set<V>>`
|
|
117
|
-
/** @type {
|
|
122
|
+
/** @type {IteratorStack<T, V>[]} */
|
|
118
123
|
const iteratorStack = [];
|
|
119
124
|
/** @type {[T?, V?, ...EXPECTED_ANY]} */
|
|
120
125
|
const tuple = [];
|
|
@@ -122,7 +127,7 @@ class TupleSet {
|
|
|
122
127
|
let currentSetIterator;
|
|
123
128
|
|
|
124
129
|
/**
|
|
125
|
-
* @param {
|
|
130
|
+
* @param {IteratorStack<T, V>} it iterator
|
|
126
131
|
* @returns {boolean} result
|
|
127
132
|
*/
|
|
128
133
|
const next = (it) => {
|
|
@@ -131,7 +136,7 @@ class TupleSet {
|
|
|
131
136
|
if (iteratorStack.length === 0) return false;
|
|
132
137
|
tuple.pop();
|
|
133
138
|
return next(
|
|
134
|
-
/** @type {
|
|
139
|
+
/** @type {IteratorStack<T, V>} */
|
|
135
140
|
(iteratorStack.pop())
|
|
136
141
|
);
|
|
137
142
|
}
|
|
@@ -155,7 +160,7 @@ class TupleSet {
|
|
|
155
160
|
tuple.pop();
|
|
156
161
|
if (
|
|
157
162
|
!next(
|
|
158
|
-
/** @type {
|
|
163
|
+
/** @type {IteratorStack<T, V>} */
|
|
159
164
|
(iteratorStack.pop())
|
|
160
165
|
)
|
|
161
166
|
) {
|
package/lib/util/WeakTupleMap.js
CHANGED
|
@@ -25,7 +25,7 @@ const isWeakKey = (thing) => typeof thing === "object" && thing !== null;
|
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* @template {unknown[]} T
|
|
28
|
-
* @typedef {T extends
|
|
28
|
+
* @typedef {T extends ReadonlyArray<infer ElementType> ? ElementType : never} ArrayElement
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
31
|
/**
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
/** @typedef {import("../ModuleGraph")} ModuleGraph */
|
|
11
11
|
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
|
|
12
12
|
|
|
13
|
+
/** @typedef {Range[]} IdRanges */
|
|
14
|
+
|
|
13
15
|
/**
|
|
14
16
|
* @summary Get the subset of ids and their corresponding range in an id chain that should be re-rendered by webpack.
|
|
15
17
|
* Only those in the chain that are actually referring to namespaces or imports should be re-rendered.
|
|
@@ -18,7 +20,7 @@
|
|
|
18
20
|
* because minifiers treat quoted accessors differently. e.g. import { a } from "./module"; a["b"] vs a.b
|
|
19
21
|
* @param {string[]} untrimmedIds chained ids
|
|
20
22
|
* @param {Range} untrimmedRange range encompassing allIds
|
|
21
|
-
* @param {
|
|
23
|
+
* @param {IdRanges | undefined} ranges cumulative range of ids for each of allIds
|
|
22
24
|
* @param {ModuleGraph} moduleGraph moduleGraph
|
|
23
25
|
* @param {Dependency} dependency dependency
|
|
24
26
|
* @returns {{trimmedIds: string[], trimmedRange: Range}} computed trimmed ids and cumulative range of those ids
|