webpack 5.93.0 → 5.95.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 +8 -5
- package/bin/webpack.js +6 -7
- package/hot/log.js +1 -2
- package/hot/only-dev-server.js +1 -1
- package/hot/poll.js +1 -1
- package/hot/signal.js +1 -1
- package/lib/APIPlugin.js +4 -3
- package/lib/AbstractMethodError.js +10 -5
- package/lib/AutomaticPrefetchPlugin.js +1 -1
- package/lib/BannerPlugin.js +12 -6
- package/lib/Cache.js +8 -10
- package/lib/CacheFacade.js +3 -3
- package/lib/CaseSensitiveModulesWarning.js +5 -7
- package/lib/Chunk.js +14 -11
- package/lib/ChunkGraph.js +58 -36
- package/lib/ChunkGroup.js +2 -3
- package/lib/ChunkTemplate.js +43 -0
- package/lib/CleanPlugin.js +10 -11
- package/lib/CodeGenerationResults.js +6 -5
- package/lib/CommentCompilationWarning.js +0 -1
- package/lib/Compilation.js +223 -191
- package/lib/Compiler.js +81 -82
- package/lib/ConcatenationScope.js +3 -6
- package/lib/ConditionalInitFragment.js +6 -7
- package/lib/ConstPlugin.js +7 -15
- package/lib/ContextExclusionPlugin.js +3 -3
- package/lib/ContextModule.js +33 -20
- package/lib/ContextModuleFactory.js +89 -44
- package/lib/ContextReplacementPlugin.js +10 -9
- package/lib/DefinePlugin.js +75 -68
- package/lib/DelegatedModule.js +7 -3
- package/lib/DelegatedModuleFactoryPlugin.js +36 -22
- package/lib/DelegatedPlugin.js +4 -0
- package/lib/DependenciesBlock.js +0 -1
- package/lib/Dependency.js +10 -14
- package/lib/DllEntryPlugin.js +4 -2
- package/lib/DllModuleFactory.js +1 -0
- package/lib/DllPlugin.js +9 -7
- package/lib/DllReferencePlugin.js +30 -15
- package/lib/EntryPlugin.js +1 -3
- package/lib/EnvironmentPlugin.js +6 -2
- package/lib/ErrorHelpers.js +11 -12
- package/lib/EvalDevToolModulePlugin.js +10 -12
- package/lib/EvalSourceMapDevToolPlugin.js +15 -13
- package/lib/ExportsInfo.js +185 -120
- package/lib/ExternalModule.js +41 -15
- package/lib/ExternalModuleFactoryPlugin.js +23 -10
- package/lib/FileSystemInfo.js +791 -422
- package/lib/FlagAllModulesAsUsedPlugin.js +1 -1
- package/lib/FlagDependencyExportsPlugin.js +12 -11
- package/lib/FlagDependencyUsagePlugin.js +1 -1
- package/lib/Generator.js +2 -5
- package/lib/GraphHelpers.js +3 -2
- package/lib/HookWebpackError.js +8 -10
- package/lib/HotModuleReplacementPlugin.js +78 -64
- package/lib/IgnoreErrorModuleFactory.js +3 -3
- package/lib/IgnorePlugin.js +1 -3
- package/lib/IgnoreWarningsPlugin.js +6 -9
- package/lib/InitFragment.js +2 -3
- package/lib/LibManifestPlugin.js +4 -3
- package/lib/MainTemplate.js +72 -19
- package/lib/Module.js +25 -9
- package/lib/ModuleBuildError.js +4 -11
- package/lib/ModuleDependencyError.js +5 -5
- package/lib/ModuleDependencyWarning.js +5 -5
- package/lib/ModuleError.js +1 -5
- package/lib/ModuleFilenameHelpers.js +29 -46
- package/lib/ModuleGraph.js +7 -6
- package/lib/ModuleGraphConnection.js +6 -6
- package/lib/ModuleInfoHeaderPlugin.js +82 -30
- package/lib/ModuleParseError.js +8 -9
- package/lib/ModuleRestoreError.js +1 -1
- package/lib/ModuleStoreError.js +1 -1
- package/lib/ModuleTemplate.js +33 -1
- package/lib/ModuleTypeConstants.js +21 -22
- package/lib/ModuleWarning.js +1 -5
- package/lib/MultiCompiler.js +24 -26
- package/lib/MultiStats.js +73 -31
- package/lib/MultiWatching.js +1 -1
- package/lib/NormalModule.js +130 -69
- package/lib/NormalModuleFactory.js +53 -49
- package/lib/OptimizationStages.js +3 -3
- package/lib/ProgressPlugin.js +9 -9
- package/lib/ProvidePlugin.js +4 -4
- package/lib/RuntimeGlobals.js +71 -70
- package/lib/RuntimeModule.js +1 -1
- package/lib/RuntimePlugin.js +24 -12
- package/lib/RuntimeTemplate.js +40 -44
- package/lib/SizeFormatHelpers.js +2 -4
- package/lib/SourceMapDevToolPlugin.js +42 -34
- package/lib/Stats.js +5 -11
- package/lib/Template.js +18 -24
- package/lib/TemplatedPathPlugin.js +21 -13
- package/lib/WarnDeprecatedOptionPlugin.js +0 -1
- package/lib/WatchIgnorePlugin.js +26 -9
- package/lib/Watching.js +10 -5
- package/lib/WebpackOptionsApply.js +84 -62
- package/lib/asset/AssetGenerator.js +107 -42
- package/lib/asset/AssetModulesPlugin.js +29 -23
- package/lib/asset/AssetSourceGenerator.js +2 -7
- package/lib/async-modules/AwaitDependenciesInitFragment.js +6 -7
- package/lib/buildChunkGraph.js +93 -81
- package/lib/cache/IdleFileCachePlugin.js +4 -4
- package/lib/cache/MemoryWithGcCachePlugin.js +5 -5
- package/lib/cache/PackFileCacheStrategy.js +51 -50
- package/lib/cache/ResolverCachePlugin.js +6 -6
- package/lib/cache/mergeEtags.js +16 -21
- package/lib/cli.js +148 -104
- package/lib/config/browserslistTargetHandler.js +16 -13
- package/lib/config/defaults.js +32 -28
- package/lib/config/normalization.js +335 -344
- package/lib/config/target.js +42 -52
- package/lib/container/ContainerEntryModule.js +2 -2
- package/lib/container/ContainerPlugin.js +1 -1
- package/lib/container/RemoteRuntimeModule.js +11 -8
- package/lib/container/options.js +18 -4
- package/lib/css/CssExportsGenerator.js +26 -24
- package/lib/css/CssGenerator.js +9 -4
- package/lib/css/CssLoadingRuntimeModule.js +10 -10
- package/lib/css/CssModulesPlugin.js +127 -47
- package/lib/css/CssParser.js +20 -18
- package/lib/css/walkCssTokens.js +80 -95
- package/lib/debug/ProfilingPlugin.js +19 -20
- package/lib/dependencies/AMDDefineDependency.js +1 -1
- package/lib/dependencies/AMDDefineDependencyParserPlugin.js +83 -47
- package/lib/dependencies/AMDRequireArrayDependency.js +9 -10
- package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +22 -16
- package/lib/dependencies/AMDRuntimeModules.js +2 -2
- package/lib/dependencies/CommonJsDependencyHelpers.js +6 -2
- package/lib/dependencies/CommonJsExportRequireDependency.js +37 -41
- package/lib/dependencies/CommonJsExportsDependency.js +0 -1
- package/lib/dependencies/CommonJsExportsParserPlugin.js +19 -23
- package/lib/dependencies/CommonJsFullRequireDependency.js +1 -1
- package/lib/dependencies/CommonJsImportsParserPlugin.js +52 -61
- package/lib/dependencies/CommonJsSelfReferenceDependency.js +6 -8
- package/lib/dependencies/ConstDependency.js +1 -1
- package/lib/dependencies/ContextDependency.js +7 -2
- package/lib/dependencies/ContextDependencyHelpers.js +31 -34
- package/lib/dependencies/ContextElementDependency.js +35 -8
- package/lib/dependencies/CriticalDependencyWarning.js +1 -1
- package/lib/dependencies/CssExportDependency.js +7 -7
- package/lib/dependencies/CssImportDependency.js +0 -2
- package/lib/dependencies/CssLocalIdentifierDependency.js +3 -3
- package/lib/dependencies/CssSelfLocalIdentifierDependency.js +2 -1
- package/lib/dependencies/CssUrlDependency.js +4 -5
- package/lib/dependencies/DynamicExports.js +5 -5
- package/lib/dependencies/ExportsInfoDependency.js +1 -2
- package/lib/dependencies/HarmonyAcceptImportDependency.js +1 -1
- package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +4 -5
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +27 -16
- package/lib/dependencies/HarmonyExportExpressionDependency.js +1 -1
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +107 -64
- package/lib/dependencies/HarmonyExports.js +2 -2
- package/lib/dependencies/HarmonyImportDependency.js +2 -4
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +19 -4
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +40 -15
- package/lib/dependencies/ImportDependency.js +1 -1
- package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +5 -5
- package/lib/dependencies/ImportMetaPlugin.js +11 -13
- package/lib/dependencies/ImportParserPlugin.js +39 -44
- package/lib/dependencies/JsonExportsDependency.js +22 -18
- package/lib/dependencies/LoaderPlugin.js +47 -36
- package/lib/dependencies/LocalModule.js +1 -1
- package/lib/dependencies/LocalModulesHelpers.js +4 -4
- package/lib/dependencies/ModuleDecoratorDependency.js +1 -1
- package/lib/dependencies/ProvidedDependency.js +1 -1
- package/lib/dependencies/PureExpressionDependency.js +6 -6
- package/lib/dependencies/RequireContextDependencyParserPlugin.js +1 -1
- package/lib/dependencies/RuntimeRequirementsDependency.js +1 -1
- package/lib/dependencies/SystemPlugin.js +1 -1
- package/lib/dependencies/URLDependency.js +3 -3
- package/lib/dependencies/URLPlugin.js +66 -12
- package/lib/dependencies/WorkerPlugin.js +25 -24
- package/lib/dependencies/processExportInfo.js +3 -1
- package/lib/electron/ElectronTargetPlugin.js +1 -0
- package/lib/esm/ModuleChunkFormatPlugin.js +3 -3
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +7 -3
- package/lib/formatLocation.js +1 -2
- package/lib/hmr/HotModuleReplacement.runtime.js +4 -5
- package/lib/hmr/HotModuleReplacementRuntimeModule.js +1 -0
- package/lib/hmr/JavascriptHotModuleReplacement.runtime.js +9 -12
- package/lib/hmr/LazyCompilationPlugin.js +27 -12
- package/lib/hmr/lazyCompilationBackend.js +64 -40
- package/lib/ids/ChunkModuleIdRangePlugin.js +1 -3
- package/lib/ids/DeterministicChunkIdsPlugin.js +2 -4
- package/lib/ids/DeterministicModuleIdsPlugin.js +1 -1
- package/lib/ids/HashedModuleIdsPlugin.js +5 -1
- package/lib/ids/IdHelpers.js +29 -39
- package/lib/ids/SyncModuleIdsPlugin.js +7 -2
- package/lib/index.js +1 -5
- package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +5 -4
- package/lib/javascript/BasicEvaluatedExpression.js +4 -19
- package/lib/javascript/ChunkHelpers.js +1 -1
- package/lib/javascript/CommonJsChunkFormatPlugin.js +3 -2
- package/lib/javascript/EnableChunkLoadingPlugin.js +7 -6
- package/lib/javascript/JavascriptGenerator.js +23 -7
- package/lib/javascript/JavascriptModulesPlugin.js +133 -86
- package/lib/javascript/JavascriptParser.js +179 -200
- package/lib/javascript/JavascriptParserHelpers.js +20 -21
- package/lib/javascript/StartupHelpers.js +41 -13
- package/lib/json/JsonGenerator.js +7 -13
- package/lib/json/JsonModulesPlugin.js +1 -4
- package/lib/json/JsonParser.js +5 -3
- package/lib/library/AmdLibraryPlugin.js +12 -16
- package/lib/library/AssignLibraryPlugin.js +8 -10
- package/lib/library/EnableLibraryPlugin.js +15 -14
- package/lib/library/JsonpLibraryPlugin.js +2 -1
- package/lib/library/ModernModuleLibraryPlugin.js +8 -6
- package/lib/library/ModuleLibraryPlugin.js +2 -1
- package/lib/library/SystemLibraryPlugin.js +2 -1
- package/lib/library/UmdLibraryPlugin.js +66 -92
- package/lib/logging/Logger.js +32 -4
- package/lib/logging/createConsoleLogger.js +12 -13
- package/lib/logging/runtime.js +7 -8
- package/lib/logging/truncateArgs.js +5 -8
- package/lib/node/NodeWatchFileSystem.js +3 -18
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +2 -2
- package/lib/node/ReadFileCompileAsyncWasmPlugin.js +1 -0
- package/lib/node/RequireChunkLoadingRuntimeModule.js +2 -2
- package/lib/node/nodeConsole.js +22 -22
- package/lib/optimize/AggressiveMergingPlugin.js +2 -4
- package/lib/optimize/AggressiveSplittingPlugin.js +16 -19
- package/lib/optimize/ConcatenatedModule.js +81 -51
- package/lib/optimize/EnsureChunkConditionsPlugin.js +1 -1
- package/lib/optimize/FlagIncludedChunksPlugin.js +3 -3
- package/lib/optimize/InnerGraph.js +17 -17
- package/lib/optimize/InnerGraphPlugin.js +8 -7
- package/lib/optimize/LimitChunkCountPlugin.js +2 -3
- package/lib/optimize/MangleExportsPlugin.js +1 -0
- package/lib/optimize/MergeDuplicateChunksPlugin.js +2 -2
- package/lib/optimize/MinMaxSizeWarning.js +1 -1
- package/lib/optimize/ModuleConcatenationPlugin.js +54 -78
- package/lib/optimize/RealContentHashPlugin.js +7 -10
- package/lib/optimize/RemoveParentModulesPlugin.js +3 -3
- package/lib/optimize/SideEffectsFlagPlugin.js +6 -2
- package/lib/optimize/SplitChunksPlugin.js +34 -30
- package/lib/performance/SizeLimitsPlugin.js +2 -2
- package/lib/prefetch/ChunkPrefetchTriggerRuntimeModule.js +1 -1
- package/lib/prefetch/ChunkPreloadTriggerRuntimeModule.js +1 -1
- package/lib/rules/BasicEffectRulePlugin.js +3 -1
- package/lib/rules/BasicMatcherRulePlugin.js +3 -1
- package/lib/rules/ObjectMatcherRulePlugin.js +4 -1
- package/lib/rules/RuleSetCompiler.js +41 -22
- package/lib/rules/UseEffectRulePlugin.js +36 -32
- package/lib/runtime/AsyncModuleRuntimeModule.js +1 -1
- package/lib/runtime/AutoPublicPathRuntimeModule.js +8 -3
- package/lib/runtime/CreateFakeNamespaceObjectRuntimeModule.js +2 -2
- package/lib/runtime/DefinePropertyGettersRuntimeModule.js +1 -1
- package/lib/runtime/EnsureChunkRuntimeModule.js +10 -11
- package/lib/runtime/GetChunkFilenameRuntimeModule.js +11 -17
- package/lib/runtime/LoadScriptRuntimeModule.js +17 -18
- package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +1 -3
- package/lib/schemes/DataUriPlugin.js +1 -1
- package/lib/schemes/HttpUriPlugin.js +241 -126
- package/lib/serialization/BinaryMiddleware.js +44 -28
- package/lib/serialization/DateObjectSerializer.js +1 -0
- package/lib/serialization/ErrorObjectSerializer.js +2 -0
- package/lib/serialization/FileMiddleware.js +154 -106
- package/lib/serialization/MapObjectSerializer.js +2 -1
- package/lib/serialization/NullPrototypeObjectSerializer.js +3 -2
- package/lib/serialization/ObjectMiddleware.js +52 -56
- package/lib/serialization/PlainObjectSerializer.js +32 -6
- package/lib/serialization/RegExpObjectSerializer.js +1 -0
- package/lib/serialization/Serializer.js +4 -5
- package/lib/serialization/SerializerMiddleware.js +6 -6
- package/lib/serialization/SetObjectSerializer.js +2 -1
- package/lib/sharing/ConsumeSharedPlugin.js +116 -97
- package/lib/sharing/ConsumeSharedRuntimeModule.js +4 -4
- package/lib/sharing/ProvideForSharedDependency.js +0 -1
- package/lib/sharing/ProvideSharedPlugin.js +2 -2
- package/lib/sharing/resolveMatchedConfigs.js +2 -1
- package/lib/sharing/utils.js +15 -27
- package/lib/stats/DefaultStatsFactoryPlugin.js +424 -281
- package/lib/stats/DefaultStatsPresetPlugin.js +73 -18
- package/lib/stats/DefaultStatsPrinterPlugin.js +370 -101
- package/lib/stats/StatsFactory.js +127 -56
- package/lib/stats/StatsPrinter.js +75 -44
- package/lib/util/ArrayHelpers.js +8 -4
- package/lib/util/ArrayQueue.js +1 -1
- package/lib/util/AsyncQueue.js +31 -12
- package/lib/util/IterableHelpers.js +3 -4
- package/lib/util/LazyBucketSortedSet.js +60 -44
- package/lib/util/LazySet.js +13 -0
- package/lib/util/MapHelpers.js +1 -3
- package/lib/util/ParallelismFactorCalculator.js +1 -1
- package/lib/util/Queue.js +1 -1
- package/lib/util/Semaphore.js +4 -7
- package/lib/util/SetHelpers.js +5 -5
- package/lib/util/SortableSet.js +4 -3
- package/lib/util/StackedCacheMap.js +4 -6
- package/lib/util/StackedMap.js +1 -3
- package/lib/util/StringXor.js +0 -5
- package/lib/util/TupleQueue.js +1 -1
- package/lib/util/TupleSet.js +15 -5
- package/lib/util/URLAbsoluteSpecifier.js +7 -7
- package/lib/util/WeakTupleMap.js +19 -21
- package/lib/util/binarySearchBounds.js +5 -12
- package/lib/util/chainedImports.js +1 -1
- package/lib/util/cleverMerge.js +21 -19
- package/lib/util/comparators.js +57 -52
- package/lib/util/compileBooleanMatcher.js +3 -6
- package/lib/util/conventions.js +8 -11
- package/lib/util/createHash.js +9 -6
- package/lib/util/deprecation.js +22 -12
- package/lib/util/deterministicGrouping.js +19 -26
- package/lib/util/findGraphRoots.js +2 -2
- package/lib/util/fs.js +32 -32
- package/lib/util/hash/md4.js +2 -2
- package/lib/util/hash/wasm-hash.js +7 -7
- package/lib/util/hash/xxhash64.js +2 -2
- package/lib/util/identifier.js +81 -59
- package/lib/util/memoize.js +8 -10
- package/lib/util/mergeScope.js +6 -9
- package/lib/util/nonNumericOnlyHash.js +2 -2
- package/lib/util/numberHash.js +1 -6
- package/lib/util/objectToMap.js +0 -1
- package/lib/util/propertyAccess.js +2 -5
- package/lib/util/propertyName.js +1 -3
- package/lib/util/registerExternalSerializer.js +1 -1
- package/lib/util/runtime.js +109 -113
- package/lib/util/semver.js +29 -27
- package/lib/util/serialization.js +16 -1
- package/lib/util/smartGrouping.js +5 -5
- package/lib/util/source.js +1 -1
- package/lib/wasm/EnableWasmLoadingPlugin.js +5 -4
- package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +3 -3
- package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +5 -6
- package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +3 -3
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +20 -19
- package/lib/wasm-sync/WebAssemblyGenerator.js +14 -29
- package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +1 -1
- package/lib/wasm-sync/WebAssemblyUtils.js +2 -2
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +2 -3
- package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +3 -1
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +1 -1
- package/package.json +18 -17
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +5 -0
- package/schemas/plugins/container/ContainerReferencePlugin.check.js +1 -1
- package/schemas/plugins/container/ContainerReferencePlugin.json +1 -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 +1 -0
- package/types.d.ts +681 -355
package/lib/MultiStats.js
CHANGED
@@ -8,15 +8,25 @@
|
|
8
8
|
const identifierUtils = require("./util/identifier");
|
9
9
|
|
10
10
|
/** @typedef {import("../declarations/WebpackOptions").StatsOptions} StatsOptions */
|
11
|
+
/** @typedef {import("./Compilation").CreateStatsOptionsContext} CreateStatsOptionsContext */
|
12
|
+
/** @typedef {import("./Compilation").NormalizedStatsOptions} NormalizedStatsOptions */
|
11
13
|
/** @typedef {import("./Stats")} Stats */
|
12
14
|
/** @typedef {import("./stats/DefaultStatsFactoryPlugin").KnownStatsCompilation} KnownStatsCompilation */
|
13
15
|
/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsCompilation} StatsCompilation */
|
16
|
+
/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsError} StatsError */
|
14
17
|
|
18
|
+
/**
|
19
|
+
* @param {string} str string
|
20
|
+
* @param {string} prefix pref
|
21
|
+
* @returns {string} indent
|
22
|
+
*/
|
15
23
|
const indent = (str, prefix) => {
|
16
|
-
const rem = str.replace(/\n([^\n])/g,
|
24
|
+
const rem = str.replace(/\n([^\n])/g, `\n${prefix}$1`);
|
17
25
|
return prefix + rem;
|
18
26
|
};
|
19
27
|
|
28
|
+
/** @typedef {{ version: boolean, hash: boolean, errorsCount: boolean, warningsCount: boolean, errors: boolean, warnings: boolean, children: NormalizedStatsOptions[] }} ChildOptions */
|
29
|
+
|
20
30
|
class MultiStats {
|
21
31
|
/**
|
22
32
|
* @param {Stats[]} stats the child stats
|
@@ -43,13 +53,30 @@ class MultiStats {
|
|
43
53
|
return this.stats.some(stat => stat.hasWarnings());
|
44
54
|
}
|
45
55
|
|
56
|
+
/**
|
57
|
+
* @param {string | boolean | StatsOptions | undefined} options stats options
|
58
|
+
* @param {CreateStatsOptionsContext} context context
|
59
|
+
* @returns {ChildOptions} context context
|
60
|
+
*/
|
46
61
|
_createChildOptions(options, context) {
|
47
|
-
|
48
|
-
options
|
49
|
-
|
50
|
-
|
51
|
-
|
62
|
+
const getCreateStatsOptions = () => {
|
63
|
+
if (!options) {
|
64
|
+
options = {};
|
65
|
+
}
|
66
|
+
|
67
|
+
const { children: childrenOptions = undefined, ...baseOptions } =
|
68
|
+
typeof options === "string"
|
69
|
+
? { preset: options }
|
70
|
+
: /** @type {StatsOptions} */ (options);
|
71
|
+
|
72
|
+
return { childrenOptions, baseOptions };
|
73
|
+
};
|
74
|
+
|
52
75
|
const children = this.stats.map((stat, idx) => {
|
76
|
+
if (typeof options === "boolean") {
|
77
|
+
return stat.compilation.createStatsOptions(options, context);
|
78
|
+
}
|
79
|
+
const { childrenOptions, baseOptions } = getCreateStatsOptions();
|
53
80
|
const childOptions = Array.isArray(childrenOptions)
|
54
81
|
? childrenOptions[idx]
|
55
82
|
: childrenOptions;
|
@@ -77,81 +104,96 @@ class MultiStats {
|
|
77
104
|
}
|
78
105
|
|
79
106
|
/**
|
80
|
-
* @param {
|
107
|
+
* @param {(string | boolean | StatsOptions)=} options stats options
|
81
108
|
* @returns {StatsCompilation} json output
|
82
109
|
*/
|
83
110
|
toJson(options) {
|
84
|
-
|
111
|
+
const childOptions = this._createChildOptions(options, {
|
112
|
+
forToString: false
|
113
|
+
});
|
85
114
|
/** @type {KnownStatsCompilation} */
|
86
115
|
const obj = {};
|
87
116
|
obj.children = this.stats.map((stat, idx) => {
|
88
|
-
const obj = stat.toJson(
|
117
|
+
const obj = stat.toJson(childOptions.children[idx]);
|
89
118
|
const compilationName = stat.compilation.name;
|
90
119
|
const name =
|
91
120
|
compilationName &&
|
92
121
|
identifierUtils.makePathsRelative(
|
93
|
-
|
122
|
+
stat.compilation.compiler.context,
|
94
123
|
compilationName,
|
95
124
|
stat.compilation.compiler.root
|
96
125
|
);
|
97
126
|
obj.name = name;
|
98
127
|
return obj;
|
99
128
|
});
|
100
|
-
if (
|
129
|
+
if (childOptions.version) {
|
101
130
|
obj.version = obj.children[0].version;
|
102
131
|
}
|
103
|
-
if (
|
132
|
+
if (childOptions.hash) {
|
104
133
|
obj.hash = obj.children.map(j => j.hash).join("");
|
105
134
|
}
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
135
|
+
/**
|
136
|
+
* @param {StatsCompilation} j stats error
|
137
|
+
* @param {StatsError} obj Stats error
|
138
|
+
* @returns {TODO} result
|
139
|
+
*/
|
140
|
+
const mapError = (j, obj) => ({
|
141
|
+
...obj,
|
142
|
+
compilerPath: obj.compilerPath ? `${j.name}.${obj.compilerPath}` : j.name
|
143
|
+
});
|
144
|
+
if (childOptions.errors) {
|
115
145
|
obj.errors = [];
|
116
146
|
for (const j of obj.children) {
|
117
|
-
|
147
|
+
const errors =
|
148
|
+
/** @type {NonNullable<KnownStatsCompilation["errors"]>} */
|
149
|
+
(j.errors);
|
150
|
+
for (const i of errors) {
|
118
151
|
obj.errors.push(mapError(j, i));
|
119
152
|
}
|
120
153
|
}
|
121
154
|
}
|
122
|
-
if (
|
155
|
+
if (childOptions.warnings) {
|
123
156
|
obj.warnings = [];
|
124
157
|
for (const j of obj.children) {
|
125
|
-
|
158
|
+
const warnings =
|
159
|
+
/** @type {NonNullable<KnownStatsCompilation["warnings"]>} */
|
160
|
+
(j.warnings);
|
161
|
+
for (const i of warnings) {
|
126
162
|
obj.warnings.push(mapError(j, i));
|
127
163
|
}
|
128
164
|
}
|
129
165
|
}
|
130
|
-
if (
|
166
|
+
if (childOptions.errorsCount) {
|
131
167
|
obj.errorsCount = 0;
|
132
168
|
for (const j of obj.children) {
|
133
|
-
obj.errorsCount += j.errorsCount;
|
169
|
+
obj.errorsCount += /** @type {number} */ (j.errorsCount);
|
134
170
|
}
|
135
171
|
}
|
136
|
-
if (
|
172
|
+
if (childOptions.warningsCount) {
|
137
173
|
obj.warningsCount = 0;
|
138
174
|
for (const j of obj.children) {
|
139
|
-
obj.warningsCount += j.warningsCount;
|
175
|
+
obj.warningsCount += /** @type {number} */ (j.warningsCount);
|
140
176
|
}
|
141
177
|
}
|
142
178
|
return obj;
|
143
179
|
}
|
144
180
|
|
181
|
+
/**
|
182
|
+
* @param {(string | boolean | StatsOptions)=} options stats options
|
183
|
+
* @returns {string} string output
|
184
|
+
*/
|
145
185
|
toString(options) {
|
146
|
-
|
186
|
+
const childOptions = this._createChildOptions(options, {
|
187
|
+
forToString: true
|
188
|
+
});
|
147
189
|
const results = this.stats.map((stat, idx) => {
|
148
|
-
const str = stat.toString(
|
190
|
+
const str = stat.toString(childOptions.children[idx]);
|
149
191
|
const compilationName = stat.compilation.name;
|
150
192
|
const name =
|
151
193
|
compilationName &&
|
152
194
|
identifierUtils
|
153
195
|
.makePathsRelative(
|
154
|
-
|
196
|
+
stat.compilation.compiler.context,
|
155
197
|
compilationName,
|
156
198
|
stat.compilation.compiler.root
|
157
199
|
)
|
package/lib/MultiWatching.js
CHANGED
package/lib/NormalModule.js
CHANGED
@@ -82,12 +82,27 @@ const memoize = require("./util/memoize");
|
|
82
82
|
/** @typedef {import("./util/Hash")} Hash */
|
83
83
|
/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */
|
84
84
|
/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */
|
85
|
+
/** @typedef {import("./util/createHash").Algorithm} Algorithm */
|
86
|
+
/**
|
87
|
+
* @template T
|
88
|
+
* @typedef {import("./util/deprecation").FakeHook<T>} FakeHook
|
89
|
+
*/
|
85
90
|
|
86
91
|
/** @typedef {{[k: string]: any}} ParserOptions */
|
87
92
|
/** @typedef {{[k: string]: any}} GeneratorOptions */
|
88
93
|
|
89
94
|
/** @typedef {UnsafeCacheData & { parser: undefined | Parser, parserOptions: undefined | ParserOptions, generator: undefined | Generator, generatorOptions: undefined | GeneratorOptions }} NormalModuleUnsafeCacheData */
|
90
95
|
|
96
|
+
/**
|
97
|
+
* @template T
|
98
|
+
* @typedef {import("../declarations/LoaderContext").LoaderContext<T>} LoaderContext
|
99
|
+
*/
|
100
|
+
|
101
|
+
/**
|
102
|
+
* @template T
|
103
|
+
* @typedef {import("../declarations/LoaderContext").NormalModuleLoaderContext<T>} NormalModuleLoaderContext
|
104
|
+
*/
|
105
|
+
|
91
106
|
/**
|
92
107
|
* @typedef {object} SourceMap
|
93
108
|
* @property {number} version
|
@@ -184,11 +199,14 @@ const asBuffer = input => {
|
|
184
199
|
};
|
185
200
|
|
186
201
|
class NonErrorEmittedError extends WebpackError {
|
202
|
+
/**
|
203
|
+
* @param {any} error value which is not an instance of Error
|
204
|
+
*/
|
187
205
|
constructor(error) {
|
188
206
|
super();
|
189
207
|
|
190
208
|
this.name = "NonErrorEmittedError";
|
191
|
-
this.message =
|
209
|
+
this.message = `(Emitted value instead of an instance of Error) ${error}`;
|
192
210
|
}
|
193
211
|
}
|
194
212
|
|
@@ -200,12 +218,12 @@ makeSerializable(
|
|
200
218
|
|
201
219
|
/**
|
202
220
|
* @typedef {object} NormalModuleCompilationHooks
|
203
|
-
* @property {SyncHook<[
|
204
|
-
* @property {SyncHook<[LoaderItem[], NormalModule,
|
221
|
+
* @property {SyncHook<[LoaderContext<any>, NormalModule]>} loader
|
222
|
+
* @property {SyncHook<[LoaderItem[], NormalModule, LoaderContext<any>]>} beforeLoaders
|
205
223
|
* @property {SyncHook<[NormalModule]>} beforeParse
|
206
224
|
* @property {SyncHook<[NormalModule]>} beforeSnapshot
|
207
|
-
* @property {HookMap<AsyncSeriesBailHook<[string, NormalModule], string | Buffer
|
208
|
-
* @property {HookMap<AsyncSeriesBailHook<[
|
225
|
+
* @property {HookMap<FakeHook<AsyncSeriesBailHook<[string, NormalModule], string | Buffer | null>>>} readResourceForScheme
|
226
|
+
* @property {HookMap<AsyncSeriesBailHook<[LoaderContext<any>], string | Buffer | null>>} readResource
|
209
227
|
* @property {AsyncSeriesBailHook<[NormalModule, NeedBuildContext], boolean>} needBuild
|
210
228
|
*/
|
211
229
|
|
@@ -251,20 +269,32 @@ class NormalModule extends Module {
|
|
251
269
|
beforeSnapshot: new SyncHook(["module"]),
|
252
270
|
// TODO webpack 6 deprecate
|
253
271
|
readResourceForScheme: new HookMap(scheme => {
|
254
|
-
const hook =
|
272
|
+
const hook =
|
273
|
+
/** @type {NormalModuleCompilationHooks} */
|
274
|
+
(hooks).readResource.for(scheme);
|
255
275
|
return createFakeHook(
|
256
|
-
/** @type {AsyncSeriesBailHook<[string, NormalModule], string | Buffer>} */ ({
|
276
|
+
/** @type {AsyncSeriesBailHook<[string, NormalModule], string | Buffer | null>} */ ({
|
257
277
|
tap: (options, fn) =>
|
258
278
|
hook.tap(options, loaderContext =>
|
259
|
-
fn(
|
279
|
+
fn(
|
280
|
+
loaderContext.resource,
|
281
|
+
/** @type {NormalModule} */ (loaderContext._module)
|
282
|
+
)
|
260
283
|
),
|
261
284
|
tapAsync: (options, fn) =>
|
262
285
|
hook.tapAsync(options, (loaderContext, callback) =>
|
263
|
-
fn(
|
286
|
+
fn(
|
287
|
+
loaderContext.resource,
|
288
|
+
/** @type {NormalModule} */ (loaderContext._module),
|
289
|
+
callback
|
290
|
+
)
|
264
291
|
),
|
265
292
|
tapPromise: (options, fn) =>
|
266
293
|
hook.tapPromise(options, loaderContext =>
|
267
|
-
fn(
|
294
|
+
fn(
|
295
|
+
loaderContext.resource,
|
296
|
+
/** @type {NormalModule} */ (loaderContext._module)
|
297
|
+
)
|
268
298
|
)
|
269
299
|
})
|
270
300
|
);
|
@@ -343,7 +373,7 @@ class NormalModule extends Module {
|
|
343
373
|
this._source = null;
|
344
374
|
/**
|
345
375
|
* @private
|
346
|
-
* @type {Map<string, number> | undefined}
|
376
|
+
* @type {Map<string | undefined, number> | undefined}
|
347
377
|
*/
|
348
378
|
this._sourceSizes = undefined;
|
349
379
|
/**
|
@@ -369,12 +399,10 @@ class NormalModule extends Module {
|
|
369
399
|
if (this.layer === null) {
|
370
400
|
if (this.type === JAVASCRIPT_MODULE_TYPE_AUTO) {
|
371
401
|
return this.request;
|
372
|
-
} else {
|
373
|
-
return `${this.type}|${this.request}`;
|
374
402
|
}
|
375
|
-
|
376
|
-
return `${this.type}|${this.request}|${this.layer}`;
|
403
|
+
return `${this.type}|${this.request}`;
|
377
404
|
}
|
405
|
+
return `${this.type}|${this.request}|${this.layer}`;
|
378
406
|
}
|
379
407
|
|
380
408
|
/**
|
@@ -382,7 +410,7 @@ class NormalModule extends Module {
|
|
382
410
|
* @returns {string} a user readable identifier of the module
|
383
411
|
*/
|
384
412
|
readableIdentifier(requestShortener) {
|
385
|
-
return requestShortener.shorten(this.userRequest);
|
413
|
+
return /** @type {string} */ (requestShortener.shorten(this.userRequest));
|
386
414
|
}
|
387
415
|
|
388
416
|
/**
|
@@ -556,30 +584,36 @@ class NormalModule extends Module {
|
|
556
584
|
/**
|
557
585
|
* @returns {ResolveContext} resolve context
|
558
586
|
*/
|
559
|
-
const getResolveContext = () => {
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
};
|
571
|
-
};
|
587
|
+
const getResolveContext = () => ({
|
588
|
+
fileDependencies: {
|
589
|
+
add: d => /** @type {TODO} */ (loaderContext).addDependency(d)
|
590
|
+
},
|
591
|
+
contextDependencies: {
|
592
|
+
add: d => /** @type {TODO} */ (loaderContext).addContextDependency(d)
|
593
|
+
},
|
594
|
+
missingDependencies: {
|
595
|
+
add: d => /** @type {TODO} */ (loaderContext).addMissingDependency(d)
|
596
|
+
}
|
597
|
+
});
|
572
598
|
const getAbsolutify = memoize(() =>
|
573
599
|
absolutify.bindCache(compilation.compiler.root)
|
574
600
|
);
|
575
601
|
const getAbsolutifyInContext = memoize(() =>
|
576
|
-
absolutify.bindContextCache(
|
602
|
+
absolutify.bindContextCache(
|
603
|
+
/** @type {string} */
|
604
|
+
(this.context),
|
605
|
+
compilation.compiler.root
|
606
|
+
)
|
577
607
|
);
|
578
608
|
const getContextify = memoize(() =>
|
579
609
|
contextify.bindCache(compilation.compiler.root)
|
580
610
|
);
|
581
611
|
const getContextifyInContext = memoize(() =>
|
582
|
-
contextify.bindContextCache(
|
612
|
+
contextify.bindContextCache(
|
613
|
+
/** @type {string} */
|
614
|
+
(this.context),
|
615
|
+
compilation.compiler.root
|
616
|
+
)
|
583
617
|
);
|
584
618
|
const utils = {
|
585
619
|
/**
|
@@ -587,28 +621,29 @@ class NormalModule extends Module {
|
|
587
621
|
* @param {string} request request
|
588
622
|
* @returns {string} result
|
589
623
|
*/
|
590
|
-
absolutify: (context, request) =>
|
591
|
-
|
624
|
+
absolutify: (context, request) =>
|
625
|
+
context === this.context
|
592
626
|
? getAbsolutifyInContext()(request)
|
593
|
-
: getAbsolutify()(context, request)
|
594
|
-
},
|
627
|
+
: getAbsolutify()(context, request),
|
595
628
|
/**
|
596
629
|
* @param {string} context context
|
597
630
|
* @param {string} request request
|
598
631
|
* @returns {string} result
|
599
632
|
*/
|
600
|
-
contextify: (context, request) =>
|
601
|
-
|
633
|
+
contextify: (context, request) =>
|
634
|
+
context === this.context
|
602
635
|
? getContextifyInContext()(request)
|
603
|
-
: getContextify()(context, request)
|
604
|
-
},
|
636
|
+
: getContextify()(context, request),
|
605
637
|
/**
|
606
638
|
* @param {(string | typeof import("./util/Hash"))=} type type
|
607
639
|
* @returns {Hash} hash
|
608
640
|
*/
|
609
|
-
createHash: type =>
|
610
|
-
|
611
|
-
|
641
|
+
createHash: type =>
|
642
|
+
createHash(
|
643
|
+
type ||
|
644
|
+
/** @type {Algorithm} */
|
645
|
+
(compilation.outputOptions.hashFunction)
|
646
|
+
)
|
612
647
|
};
|
613
648
|
/** @type {import("../declarations/LoaderContext").NormalModuleLoaderContext<T>} */
|
614
649
|
const loaderContext = {
|
@@ -622,8 +657,10 @@ class NormalModule extends Module {
|
|
622
657
|
if (options.startsWith("{") && options.endsWith("}")) {
|
623
658
|
try {
|
624
659
|
options = parseJson(options);
|
625
|
-
} catch (
|
626
|
-
throw new Error(
|
660
|
+
} catch (err) {
|
661
|
+
throw new Error(
|
662
|
+
`Cannot parse string options: ${/** @type {Error} */ (err).message}`
|
663
|
+
);
|
627
664
|
}
|
628
665
|
} else {
|
629
666
|
options = querystring.parse(options, "&", "=", {
|
@@ -738,17 +775,21 @@ class NormalModule extends Module {
|
|
738
775
|
utils,
|
739
776
|
rootContext: /** @type {string} */ (options.context),
|
740
777
|
webpack: true,
|
741
|
-
sourceMap:
|
778
|
+
sourceMap: Boolean(this.useSourceMap),
|
742
779
|
mode: options.mode || "production",
|
780
|
+
hashFunction: options.output.hashFunction,
|
781
|
+
hashDigest: options.output.hashDigest,
|
782
|
+
hashDigestLength: options.output.hashDigestLength,
|
783
|
+
hashSalt: options.output.hashSalt,
|
743
784
|
_module: this,
|
744
785
|
_compilation: compilation,
|
745
786
|
_compiler: compilation.compiler,
|
746
|
-
fs
|
787
|
+
fs
|
747
788
|
};
|
748
789
|
|
749
790
|
Object.assign(loaderContext, options.loader);
|
750
791
|
|
751
|
-
hooks.loader.call(loaderContext, this);
|
792
|
+
hooks.loader.call(/** @type {LoaderContext<any>} */ (loaderContext), this);
|
752
793
|
|
753
794
|
return loaderContext;
|
754
795
|
}
|
@@ -775,7 +816,7 @@ class NormalModule extends Module {
|
|
775
816
|
/**
|
776
817
|
* @param {string} context the compilation context
|
777
818
|
* @param {string | Buffer} content the content
|
778
|
-
* @param {(string | SourceMapSource)=} sourceMap an optional source map
|
819
|
+
* @param {(string | SourceMapSource | null)=} sourceMap an optional source map
|
779
820
|
* @param {object=} associatedObjectForCache object for caching
|
780
821
|
* @returns {Source} the created source
|
781
822
|
*/
|
@@ -832,7 +873,14 @@ class NormalModule extends Module {
|
|
832
873
|
hooks
|
833
874
|
);
|
834
875
|
|
835
|
-
|
876
|
+
/** @typedef {[string | Buffer, string | SourceMapSource, Record<string, any>]} Result */
|
877
|
+
|
878
|
+
/**
|
879
|
+
* @param {Error | null} err err
|
880
|
+
* @param {(Result | null)=} _result result
|
881
|
+
* @returns {void}
|
882
|
+
*/
|
883
|
+
const processResult = (err, _result) => {
|
836
884
|
if (err) {
|
837
885
|
if (!(err instanceof Error)) {
|
838
886
|
err = new NonErrorEmittedError(err);
|
@@ -848,6 +896,7 @@ class NormalModule extends Module {
|
|
848
896
|
return callback(error);
|
849
897
|
}
|
850
898
|
|
899
|
+
const result = /** @type {Result} */ (_result);
|
851
900
|
const source = result[0];
|
852
901
|
const sourceMap = result.length >= 1 ? result[1] : null;
|
853
902
|
const extraInfo = result.length >= 2 ? result[2] : null;
|
@@ -896,7 +945,11 @@ class NormalModule extends Module {
|
|
896
945
|
buildInfo.cacheable = true;
|
897
946
|
|
898
947
|
try {
|
899
|
-
hooks.beforeLoaders.call(
|
948
|
+
hooks.beforeLoaders.call(
|
949
|
+
this.loaders,
|
950
|
+
this,
|
951
|
+
/** @type {LoaderContext<any>} */ (loaderContext)
|
952
|
+
);
|
900
953
|
} catch (err) {
|
901
954
|
processResult(err);
|
902
955
|
return;
|
@@ -920,7 +973,13 @@ class NormalModule extends Module {
|
|
920
973
|
.callAsync(loaderContext, (err, result) => {
|
921
974
|
if (err) return callback(err);
|
922
975
|
if (typeof result !== "string" && !result) {
|
923
|
-
return callback(
|
976
|
+
return callback(
|
977
|
+
new UnhandledSchemeError(
|
978
|
+
/** @type {string} */
|
979
|
+
(scheme),
|
980
|
+
resource
|
981
|
+
)
|
982
|
+
);
|
924
983
|
}
|
925
984
|
return callback(null, result);
|
926
985
|
});
|
@@ -1037,7 +1096,10 @@ class NormalModule extends Module {
|
|
1037
1096
|
* @private
|
1038
1097
|
*/
|
1039
1098
|
_initBuildHash(compilation) {
|
1040
|
-
const hash = createHash(
|
1099
|
+
const hash = createHash(
|
1100
|
+
/** @type {Algorithm} */
|
1101
|
+
(compilation.outputOptions.hashFunction)
|
1102
|
+
);
|
1041
1103
|
if (this._source) {
|
1042
1104
|
hash.update("source");
|
1043
1105
|
this._source.updateHash(hash);
|
@@ -1128,7 +1190,7 @@ class NormalModule extends Module {
|
|
1128
1190
|
try {
|
1129
1191
|
hooks.beforeSnapshot.call(this);
|
1130
1192
|
} catch (err) {
|
1131
|
-
this.markModuleAsErrored(err);
|
1193
|
+
this.markModuleAsErrored(/** @type {WebpackError} */ (err));
|
1132
1194
|
return callback();
|
1133
1195
|
}
|
1134
1196
|
|
@@ -1140,7 +1202,7 @@ class NormalModule extends Module {
|
|
1140
1202
|
// add warning for all non-absolute paths in fileDependencies, etc
|
1141
1203
|
// This makes it easier to find problems with watching and/or caching
|
1142
1204
|
/** @type {undefined | Set<string>} */
|
1143
|
-
let nonAbsoluteDependencies
|
1205
|
+
let nonAbsoluteDependencies;
|
1144
1206
|
/**
|
1145
1207
|
* @param {LazySet<string>} deps deps
|
1146
1208
|
*/
|
@@ -1155,7 +1217,8 @@ class NormalModule extends Module {
|
|
1155
1217
|
const depWithoutGlob = dep.replace(/[\\/]?\*.*$/, "");
|
1156
1218
|
const absolute = join(
|
1157
1219
|
compilation.fileSystemInfo.fs,
|
1158
|
-
|
1220
|
+
/** @type {string} */
|
1221
|
+
(this.context),
|
1159
1222
|
depWithoutGlob
|
1160
1223
|
);
|
1161
1224
|
if (absolute !== dep && ABSOLUTE_PATH_REGEX.test(absolute)) {
|
@@ -1168,7 +1231,7 @@ class NormalModule extends Module {
|
|
1168
1231
|
: deps
|
1169
1232
|
).add(absolute);
|
1170
1233
|
}
|
1171
|
-
} catch (
|
1234
|
+
} catch (_err) {
|
1172
1235
|
// ignore
|
1173
1236
|
}
|
1174
1237
|
}
|
@@ -1218,7 +1281,7 @@ class NormalModule extends Module {
|
|
1218
1281
|
try {
|
1219
1282
|
hooks.beforeParse.call(this);
|
1220
1283
|
} catch (err) {
|
1221
|
-
this.markModuleAsErrored(err);
|
1284
|
+
this.markModuleAsErrored(/** @type {WebpackError} */ (err));
|
1222
1285
|
this._initBuildHash(compilation);
|
1223
1286
|
return callback();
|
1224
1287
|
}
|
@@ -1241,11 +1304,11 @@ class NormalModule extends Module {
|
|
1241
1304
|
source,
|
1242
1305
|
current: this,
|
1243
1306
|
module: this,
|
1244
|
-
compilation
|
1245
|
-
options
|
1307
|
+
compilation,
|
1308
|
+
options
|
1246
1309
|
});
|
1247
|
-
} catch (
|
1248
|
-
handleParseError(/** @type {Error} */ (
|
1310
|
+
} catch (parseErr) {
|
1311
|
+
handleParseError(/** @type {Error} */ (parseErr));
|
1249
1312
|
return;
|
1250
1313
|
}
|
1251
1314
|
handleParseResult();
|
@@ -1305,9 +1368,8 @@ class NormalModule extends Module {
|
|
1305
1368
|
// When caching is implemented here, make sure to not cache when
|
1306
1369
|
// at least one circular connection was in the loop above
|
1307
1370
|
return current;
|
1308
|
-
} else {
|
1309
|
-
return true;
|
1310
1371
|
}
|
1372
|
+
return true;
|
1311
1373
|
}
|
1312
1374
|
|
1313
1375
|
/**
|
@@ -1348,15 +1410,13 @@ class NormalModule extends Module {
|
|
1348
1410
|
}
|
1349
1411
|
|
1350
1412
|
/** @type {function(): Map<string, any>} */
|
1351
|
-
const getData = () =>
|
1352
|
-
return this._codeGeneratorData;
|
1353
|
-
};
|
1413
|
+
const getData = () => this._codeGeneratorData;
|
1354
1414
|
|
1355
1415
|
const sources = new Map();
|
1356
1416
|
for (const type of sourceTypes || chunkGraph.getModuleSourceTypes(this)) {
|
1357
1417
|
const source = this.error
|
1358
1418
|
? new RawSource(
|
1359
|
-
|
1419
|
+
`throw new Error(${JSON.stringify(this.error.message)});`
|
1360
1420
|
)
|
1361
1421
|
: /** @type {Generator} */ (this.generator).generate(this, {
|
1362
1422
|
dependencyTemplates,
|
@@ -1453,7 +1513,7 @@ class NormalModule extends Module {
|
|
1453
1513
|
)
|
1454
1514
|
);
|
1455
1515
|
}
|
1456
|
-
callback(null,
|
1516
|
+
callback(null, Boolean(needBuild));
|
1457
1517
|
});
|
1458
1518
|
});
|
1459
1519
|
}
|
@@ -1519,7 +1579,8 @@ class NormalModule extends Module {
|
|
1519
1579
|
*/
|
1520
1580
|
updateHash(hash, context) {
|
1521
1581
|
hash.update(/** @type {BuildInfo} */ (this.buildInfo).hash);
|
1522
|
-
|
1582
|
+
/** @type {Generator} */
|
1583
|
+
(this.generator).updateHash(hash, {
|
1523
1584
|
module: this,
|
1524
1585
|
...context
|
1525
1586
|
});
|