xhs-mp-pack 1.1.0-beta.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 +1 -0
- package/dist/Compilation.d.ts +239 -0
- package/dist/Compilation.js +3513 -0
- package/dist/Compiler.d.ts +76 -0
- package/dist/Compiler.js +845 -0
- package/dist/ConcatenationScope.d.ts +37 -0
- package/dist/ConcatenationScope.js +69 -0
- package/dist/FileSystemInfo.d.ts +183 -0
- package/dist/FileSystemInfo.js +2896 -0
- package/dist/MPPack.d.ts +33 -0
- package/dist/MPPack.js +163 -0
- package/dist/MPPackSetting.d.ts +52 -0
- package/dist/MPPackSetting.js +85 -0
- package/dist/MultiCompiler.d.ts +25 -0
- package/dist/MultiCompiler.js +387 -0
- package/dist/MultiWatching.d.ts +11 -0
- package/dist/MultiWatching.js +54 -0
- package/dist/PluginManager.d.ts +9 -0
- package/dist/PluginManager.js +359 -0
- package/dist/ResolverFactory.d.ts +7 -0
- package/dist/ResolverFactory.js +84 -0
- package/dist/Watching.d.ts +41 -0
- package/dist/Watching.js +359 -0
- package/dist/base/ArrayHelpers.d.ts +6 -0
- package/dist/base/ArrayHelpers.js +21 -0
- package/dist/base/ArrayQueue.d.ts +29 -0
- package/dist/base/ArrayQueue.js +87 -0
- package/dist/base/AsyncQueue.d.ts +37 -0
- package/dist/base/AsyncQueue.js +263 -0
- package/dist/base/ChunkHelpers.d.ts +3 -0
- package/dist/base/ChunkHelpers.js +26 -0
- package/dist/base/ConditionalInitFragment.d.ts +9 -0
- package/dist/base/ConditionalInitFragment.js +64 -0
- package/dist/base/GraphHelpers.d.ts +6 -0
- package/dist/base/GraphHelpers.js +32 -0
- package/dist/base/Hash.d.ts +6 -0
- package/dist/base/Hash.js +13 -0
- package/dist/base/InitFragment.d.ts +22 -0
- package/dist/base/InitFragment.js +113 -0
- package/dist/base/IterableHelpers.d.ts +4 -0
- package/dist/base/IterableHelpers.js +26 -0
- package/dist/base/LazyBucketSortedSet.d.ts +34 -0
- package/dist/base/LazyBucketSortedSet.js +188 -0
- package/dist/base/LazySet.d.ts +35 -0
- package/dist/base/LazySet.js +155 -0
- package/dist/base/MapHelpers.d.ts +14 -0
- package/dist/base/MapHelpers.js +27 -0
- package/dist/base/ModuleFilenameHelpers.d.ts +95 -0
- package/dist/base/ModuleFilenameHelpers.js +314 -0
- package/dist/base/NodeWatchFileSystem.d.ts +23 -0
- package/dist/base/NodeWatchFileSystem.js +135 -0
- package/dist/base/ParallelismFactorCalculator.d.ts +8 -0
- package/dist/base/ParallelismFactorCalculator.js +52 -0
- package/dist/base/Queue.d.ts +12 -0
- package/dist/base/Queue.js +25 -0
- package/dist/base/RequestShortener.d.ts +6 -0
- package/dist/base/RequestShortener.js +15 -0
- package/dist/base/Semaphore.d.ts +12 -0
- package/dist/base/Semaphore.js +37 -0
- package/dist/base/SetHelpers.d.ts +36 -0
- package/dist/base/SetHelpers.js +94 -0
- package/dist/base/SizeFormatHelpers.d.ts +2 -0
- package/dist/base/SizeFormatHelpers.js +15 -0
- package/dist/base/SizeOnlySource.d.ts +14 -0
- package/dist/base/SizeOnlySource.js +34 -0
- package/dist/base/SortableSet.d.ts +18 -0
- package/dist/base/SortableSet.js +90 -0
- package/dist/base/StackedCacheMap.d.ts +20 -0
- package/dist/base/StackedCacheMap.js +73 -0
- package/dist/base/StackedMap.d.ts +17 -0
- package/dist/base/StackedMap.js +103 -0
- package/dist/base/StartupHelpers.d.ts +4 -0
- package/dist/base/StartupHelpers.js +94 -0
- package/dist/base/StringXor.d.ts +53 -0
- package/dist/base/StringXor.js +94 -0
- package/dist/base/TupleQueue.d.ts +10 -0
- package/dist/base/TupleQueue.js +33 -0
- package/dist/base/TupleSet.d.ts +18 -0
- package/dist/base/TupleSet.js +115 -0
- package/dist/base/URLAbsoluteSpecifier.d.ts +3 -0
- package/dist/base/URLAbsoluteSpecifier.js +57 -0
- package/dist/base/WeakTupleMap.d.ts +20 -0
- package/dist/base/WeakTupleMap.js +124 -0
- package/dist/base/binarySearchBounds.d.ts +23 -0
- package/dist/base/binarySearchBounds.js +105 -0
- package/dist/base/cleverMerge.d.ts +27 -0
- package/dist/base/cleverMerge.js +450 -0
- package/dist/base/common.d.ts +7 -0
- package/dist/base/common.js +25 -0
- package/dist/base/commonjs.d.ts +1 -0
- package/dist/base/commonjs.js +48 -0
- package/dist/base/comparators.d.ts +22 -0
- package/dist/base/comparators.js +279 -0
- package/dist/base/compileBooleanMatcher.d.ts +6 -0
- package/dist/base/compileBooleanMatcher.js +162 -0
- package/dist/base/const.d.ts +29 -0
- package/dist/base/const.js +49 -0
- package/dist/base/copyPatterns.d.ts +14 -0
- package/dist/base/copyPatterns.js +501 -0
- package/dist/base/createHash.d.ts +3 -0
- package/dist/base/createHash.js +131 -0
- package/dist/base/defaults.d.ts +3 -0
- package/dist/base/defaults.js +671 -0
- package/dist/base/deprecation.d.ts +21 -0
- package/dist/base/deprecation.js +165 -0
- package/dist/base/deterministicGrouping.d.ts +8 -0
- package/dist/base/deterministicGrouping.js +395 -0
- package/dist/base/errors/AbstractMethodError.d.ts +5 -0
- package/dist/base/errors/AbstractMethodError.js +23 -0
- package/dist/base/errors/AsyncDependencyToInitialChunkError.d.ts +8 -0
- package/dist/base/errors/AsyncDependencyToInitialChunkError.js +18 -0
- package/dist/base/errors/BaseError.d.ts +17 -0
- package/dist/base/errors/BaseError.js +39 -0
- package/dist/base/errors/BuildCycleError.d.ts +8 -0
- package/dist/base/errors/BuildCycleError.js +17 -0
- package/dist/base/errors/CaseSensitiveModulesWarning.d.ts +5 -0
- package/dist/base/errors/CaseSensitiveModulesWarning.js +42 -0
- package/dist/base/errors/ChunkRenderError.d.ts +6 -0
- package/dist/base/errors/ChunkRenderError.js +18 -0
- package/dist/base/errors/CodeGenerationError.d.ts +8 -0
- package/dist/base/errors/CodeGenerationError.js +20 -0
- package/dist/base/errors/CommentCompilationWarning.d.ts +5 -0
- package/dist/base/errors/CommentCompilationWarning.js +16 -0
- package/dist/base/errors/ConcurrentCompilationError.d.ts +4 -0
- package/dist/base/errors/ConcurrentCompilationError.js +15 -0
- package/dist/base/errors/CriticalDependencyWarning.d.ts +5 -0
- package/dist/base/errors/CriticalDependencyWarning.js +16 -0
- package/dist/base/errors/ErrorHelpers.d.ts +8 -0
- package/dist/base/errors/ErrorHelpers.js +51 -0
- package/dist/base/errors/HarmonyLinkingError.d.ts +4 -0
- package/dist/base/errors/HarmonyLinkingError.js +14 -0
- package/dist/base/errors/HookBaseError.d.ts +10 -0
- package/dist/base/errors/HookBaseError.js +51 -0
- package/dist/base/errors/InvalidDependenciesModuleWarning.d.ts +5 -0
- package/dist/base/errors/InvalidDependenciesModuleWarning.js +26 -0
- package/dist/base/errors/MinMaxSizeWarning.d.ts +5 -0
- package/dist/base/errors/MinMaxSizeWarning.js +45 -0
- package/dist/base/errors/ModuleBuildError.d.ts +9 -0
- package/dist/base/errors/ModuleBuildError.js +62 -0
- package/dist/base/errors/ModuleDependencyError.d.ts +8 -0
- package/dist/base/errors/ModuleDependencyError.js +24 -0
- package/dist/base/errors/ModuleDependencyWarning.d.ts +6 -0
- package/dist/base/errors/ModuleDependencyWarning.js +23 -0
- package/dist/base/errors/ModuleError.d.ts +10 -0
- package/dist/base/errors/ModuleError.js +42 -0
- package/dist/base/errors/ModuleHashingError.d.ts +5 -0
- package/dist/base/errors/ModuleHashingError.js +17 -0
- package/dist/base/errors/ModuleNotFoundError.d.ts +5 -0
- package/dist/base/errors/ModuleNotFoundError.js +69 -0
- package/dist/base/errors/ModuleParseError.d.ts +8 -0
- package/dist/base/errors/ModuleParseError.js +77 -0
- package/dist/base/errors/ModuleRestoreError.d.ts +5 -0
- package/dist/base/errors/ModuleRestoreError.js +33 -0
- package/dist/base/errors/ModuleStoreError.d.ts +5 -0
- package/dist/base/errors/ModuleStoreError.js +33 -0
- package/dist/base/errors/ModuleWarning.d.ts +10 -0
- package/dist/base/errors/ModuleWarning.js +44 -0
- package/dist/base/errors/NodeStuffInWebError.d.ts +5 -0
- package/dist/base/errors/NodeStuffInWebError.js +17 -0
- package/dist/base/errors/UnhandledSchemeError.d.ts +5 -0
- package/dist/base/errors/UnhandledSchemeError.js +18 -0
- package/dist/base/errors/UnsupportedFeatureWarning.d.ts +5 -0
- package/dist/base/errors/UnsupportedFeatureWarning.js +17 -0
- package/dist/base/extractUrlAndGlobal.d.ts +1 -0
- package/dist/base/extractUrlAndGlobal.js +10 -0
- package/dist/base/findGraphRoots.d.ts +2 -0
- package/dist/base/findGraphRoots.js +183 -0
- package/dist/base/formatLocation.d.ts +2 -0
- package/dist/base/formatLocation.js +47 -0
- package/dist/base/fs.d.ts +94 -0
- package/dist/base/fs.js +218 -0
- package/dist/base/hash/BatchedHash.d.ts +11 -0
- package/dist/base/hash/BatchedHash.js +47 -0
- package/dist/base/hash/md4.d.ts +2 -0
- package/dist/base/hash/md4.js +10 -0
- package/dist/base/hash/wasm-hash.d.ts +3 -0
- package/dist/base/hash/wasm-hash.js +138 -0
- package/dist/base/hash/xxhash64.d.ts +2 -0
- package/dist/base/hash/xxhash64.js +10 -0
- package/dist/base/identifier.d.ts +30 -0
- package/dist/base/identifier.js +237 -0
- package/dist/base/logging/Logger.d.ts +40 -0
- package/dist/base/logging/Logger.js +128 -0
- package/dist/base/logging/createConsoleLogger.d.ts +6 -0
- package/dist/base/logging/createConsoleLogger.js +161 -0
- package/dist/base/logging/nodeConsole.d.ts +21 -0
- package/dist/base/logging/nodeConsole.js +109 -0
- package/dist/base/logging/runtime.d.ts +8 -0
- package/dist/base/logging/runtime.js +30 -0
- package/dist/base/logging/truncateArgs.d.ts +2 -0
- package/dist/base/logging/truncateArgs.js +66 -0
- package/dist/base/memoize.d.ts +2 -0
- package/dist/base/memoize.js +18 -0
- package/dist/base/missingModule.d.ts +4 -0
- package/dist/base/missingModule.js +16 -0
- package/dist/base/moduleAlias.d.ts +1 -0
- package/dist/base/moduleAlias.js +8 -0
- package/dist/base/nonNumericOnlyHash.d.ts +7 -0
- package/dist/base/nonNumericOnlyHash.js +16 -0
- package/dist/base/normalization.d.ts +32 -0
- package/dist/base/normalization.js +320 -0
- package/dist/base/numberHash.d.ts +17 -0
- package/dist/base/numberHash.js +72 -0
- package/dist/base/objectToMap.d.ts +1 -0
- package/dist/base/objectToMap.js +6 -0
- package/dist/base/processAsyncTree.d.ts +2 -0
- package/dist/base/processAsyncTree.js +45 -0
- package/dist/base/propertyAccess.d.ts +2 -0
- package/dist/base/propertyAccess.js +20 -0
- package/dist/base/propertyName.d.ts +9 -0
- package/dist/base/propertyName.js +71 -0
- package/dist/base/semver.d.ts +25 -0
- package/dist/base/semver.js +425 -0
- package/dist/base/singletontask.d.ts +27 -0
- package/dist/base/singletontask.js +124 -0
- package/dist/base/smartGrouping.d.ts +2 -0
- package/dist/base/smartGrouping.js +138 -0
- package/dist/base/source.d.ts +2 -0
- package/dist/base/source.js +48 -0
- package/dist/base/stats/MultiStats.d.ts +19 -0
- package/dist/base/stats/MultiStats.js +142 -0
- package/dist/base/stats/Stats.d.ts +13 -0
- package/dist/base/stats/Stats.js +49 -0
- package/dist/base/stats/StatsFactory.d.ts +26 -0
- package/dist/base/stats/StatsFactory.js +163 -0
- package/dist/base/stats/StatsPrinter.d.ts +12 -0
- package/dist/base/stats/StatsPrinter.js +104 -0
- package/dist/base/utils.d.ts +5 -0
- package/dist/base/utils.js +35 -0
- package/dist/cache/AddBuildDependenciesPlugin.d.ts +6 -0
- package/dist/cache/AddBuildDependenciesPlugin.js +13 -0
- package/dist/cache/AddManagedPathsPlugin.d.ts +7 -0
- package/dist/cache/AddManagedPathsPlugin.js +17 -0
- package/dist/cache/Cache.d.ts +15 -0
- package/dist/cache/Cache.js +69 -0
- package/dist/cache/CacheFacade.d.ts +37 -0
- package/dist/cache/CacheFacade.js +187 -0
- package/dist/cache/IdleFileCachePlugin.d.ts +9 -0
- package/dist/cache/IdleFileCachePlugin.js +165 -0
- package/dist/cache/MemoryCachePlugin.d.ts +4 -0
- package/dist/cache/MemoryCachePlugin.js +36 -0
- package/dist/cache/MemoryWithGcCachePlugin.d.ts +8 -0
- package/dist/cache/MemoryWithGcCachePlugin.js +104 -0
- package/dist/cache/PackFileCacheStrategy.d.ts +47 -0
- package/dist/cache/PackFileCacheStrategy.js +1085 -0
- package/dist/cache/ResolverCachePlugin.d.ts +4 -0
- package/dist/cache/ResolverCachePlugin.js +248 -0
- package/dist/cache/getLazyHashedEtag.d.ts +2 -0
- package/dist/cache/getLazyHashedEtag.js +53 -0
- package/dist/cache/mergeEtags.d.ts +2 -0
- package/dist/cache/mergeEtags.js +50 -0
- package/dist/chunk/Chunk.d.ts +75 -0
- package/dist/chunk/Chunk.js +445 -0
- package/dist/chunk/ChunkGraph.d.ts +102 -0
- package/dist/chunk/ChunkGraph.js +1037 -0
- package/dist/chunk/ChunkGroup.d.ts +62 -0
- package/dist/chunk/ChunkGroup.js +341 -0
- package/dist/chunk/CodeGenerationResults.d.ts +13 -0
- package/dist/chunk/CodeGenerationResults.js +82 -0
- package/dist/chunk/Entrypoint.d.ts +22 -0
- package/dist/chunk/Entrypoint.js +56 -0
- package/dist/chunk/GraphHelpers.d.ts +3 -0
- package/dist/chunk/GraphHelpers.js +15 -0
- package/dist/chunk/buildChunkGraph.d.ts +2 -0
- package/dist/chunk/buildChunkGraph.js +1067 -0
- package/dist/chunk/chunkFormat/ArrayPushCallbackChunkFormatPlugin.d.ts +4 -0
- package/dist/chunk/chunkFormat/ArrayPushCallbackChunkFormatPlugin.js +101 -0
- package/dist/chunk/chunkLoading/JsonpChunkLoadingPlugin.d.ts +4 -0
- package/dist/chunk/chunkLoading/JsonpChunkLoadingPlugin.js +98 -0
- package/dist/chunk/chunkLoading/JsonpChunkLoadingRuntimeModule.d.ts +15 -0
- package/dist/chunk/chunkLoading/JsonpChunkLoadingRuntimeModule.js +272 -0
- package/dist/dependencies/AsyncDependenciesBlock.d.ts +14 -0
- package/dist/dependencies/AsyncDependenciesBlock.js +64 -0
- package/dist/dependencies/CreateScriptUrlDependency.d.ts +9 -0
- package/dist/dependencies/CreateScriptUrlDependency.js +60 -0
- package/dist/dependencies/DelegatedSourceDependency.d.ts +7 -0
- package/dist/dependencies/DelegatedSourceDependency.js +20 -0
- package/dist/dependencies/DependenciesBlock.d.ts +29 -0
- package/dist/dependencies/DependenciesBlock.js +66 -0
- package/dist/dependencies/Dependency.d.ts +44 -0
- package/dist/dependencies/Dependency.js +171 -0
- package/dist/dependencies/DependencyTemplate.d.ts +4 -0
- package/dist/dependencies/DependencyTemplate.js +9 -0
- package/dist/dependencies/DependencyTemplates.d.ts +12 -0
- package/dist/dependencies/DependencyTemplates.js +34 -0
- package/dist/dependencies/DynamicExports.d.ts +6 -0
- package/dist/dependencies/DynamicExports.js +48 -0
- package/dist/dependencies/ExportsInfoDependency.d.ts +10 -0
- package/dist/dependencies/ExportsInfoDependency.js +80 -0
- package/dist/dependencies/LocalModule.d.ts +11 -0
- package/dist/dependencies/LocalModule.js +33 -0
- package/dist/dependencies/LocalModuleDependency.d.ts +10 -0
- package/dist/dependencies/LocalModuleDependency.js +42 -0
- package/dist/dependencies/LocalModulesHelpers.d.ts +4 -0
- package/dist/dependencies/LocalModulesHelpers.js +48 -0
- package/dist/dependencies/ModuleDecoratorDependency.d.ts +15 -0
- package/dist/dependencies/ModuleDecoratorDependency.js +85 -0
- package/dist/dependencies/ModuleDependency.d.ts +16 -0
- package/dist/dependencies/ModuleDependency.js +53 -0
- package/dist/dependencies/ModuleDependencyTemplateAsId.d.ts +9 -0
- package/dist/dependencies/ModuleDependencyTemplateAsId.js +21 -0
- package/dist/dependencies/ModuleDependencyTemplateAsRequireId.d.ts +10 -0
- package/dist/dependencies/ModuleDependencyTemplateAsRequireId.js +22 -0
- package/dist/dependencies/NullDependency.d.ts +7 -0
- package/dist/dependencies/NullDependency.js +19 -0
- package/dist/dependencies/PureExpressionDependency.d.ts +12 -0
- package/dist/dependencies/PureExpressionDependency.js +73 -0
- package/dist/dependencies/RequireHeaderDependency.d.ts +8 -0
- package/dist/dependencies/RequireHeaderDependency.js +58 -0
- package/dist/dependencies/RequireResolveContextDependency.d.ts +8 -0
- package/dist/dependencies/RequireResolveContextDependency.js +33 -0
- package/dist/dependencies/RequireResolveDependency.d.ts +10 -0
- package/dist/dependencies/RequireResolveDependency.js +29 -0
- package/dist/dependencies/RequireResolveHeaderDependency.d.ts +8 -0
- package/dist/dependencies/RequireResolveHeaderDependency.js +36 -0
- package/dist/dependencies/RuntimeRequirementsDependency.d.ts +10 -0
- package/dist/dependencies/RuntimeRequirementsDependency.js +40 -0
- package/dist/dependencies/StaticExportsDependency.d.ts +15 -0
- package/dist/dependencies/StaticExportsDependency.js +38 -0
- package/dist/dependencies/URLDependency.d.ts +16 -0
- package/dist/dependencies/URLDependency.js +103 -0
- package/dist/dependencies/URLPlugin.d.ts +4 -0
- package/dist/dependencies/URLPlugin.js +107 -0
- package/dist/dependencies/UnsupportedDependency.d.ts +9 -0
- package/dist/dependencies/UnsupportedDependency.js +36 -0
- package/dist/dependencies/commonjs/CommonJsDependencyHelpers.d.ts +2 -0
- package/dist/dependencies/commonjs/CommonJsDependencyHelpers.js +67 -0
- package/dist/dependencies/commonjs/CommonJsExportRequireDependency.d.ts +46 -0
- package/dist/dependencies/commonjs/CommonJsExportRequireDependency.js +260 -0
- package/dist/dependencies/commonjs/CommonJsExportsDependency.d.ts +19 -0
- package/dist/dependencies/commonjs/CommonJsExportsDependency.js +82 -0
- package/dist/dependencies/commonjs/CommonJsExportsParserPlugin.d.ts +6 -0
- package/dist/dependencies/commonjs/CommonJsExportsParserPlugin.js +314 -0
- package/dist/dependencies/commonjs/CommonJsFullRequireDependency.d.ts +13 -0
- package/dist/dependencies/commonjs/CommonJsFullRequireDependency.js +77 -0
- package/dist/dependencies/commonjs/CommonJsImportsParserPlugin.d.ts +6 -0
- package/dist/dependencies/commonjs/CommonJsImportsParserPlugin.js +500 -0
- package/dist/dependencies/commonjs/CommonJsPlugin.d.ts +4 -0
- package/dist/dependencies/commonjs/CommonJsPlugin.js +170 -0
- package/dist/dependencies/commonjs/CommonJsRequireContextDependency.d.ts +8 -0
- package/dist/dependencies/commonjs/CommonJsRequireContextDependency.js +37 -0
- package/dist/dependencies/commonjs/CommonJsRequireDependency.d.ts +7 -0
- package/dist/dependencies/commonjs/CommonJsRequireDependency.js +24 -0
- package/dist/dependencies/commonjs/CommonJsSelfReferenceDependency.d.ts +15 -0
- package/dist/dependencies/commonjs/CommonJsSelfReferenceDependency.js +112 -0
- package/dist/dependencies/const/CachedConstDependency.d.ts +12 -0
- package/dist/dependencies/const/CachedConstDependency.js +50 -0
- package/dist/dependencies/const/ConstDependency.d.ts +13 -0
- package/dist/dependencies/const/ConstDependency.js +63 -0
- package/dist/dependencies/context/ContextDependency.d.ts +26 -0
- package/dist/dependencies/context/ContextDependency.js +91 -0
- package/dist/dependencies/context/ContextDependencyHelpers.d.ts +2 -0
- package/dist/dependencies/context/ContextDependencyHelpers.js +128 -0
- package/dist/dependencies/context/ContextDependencyTemplateAsId.d.ts +10 -0
- package/dist/dependencies/context/ContextDependencyTemplateAsId.js +37 -0
- package/dist/dependencies/context/ContextDependencyTemplateAsRequireCall.d.ts +10 -0
- package/dist/dependencies/context/ContextDependencyTemplateAsRequireCall.js +39 -0
- package/dist/dependencies/context/ContextElementDependency.d.ts +13 -0
- package/dist/dependencies/context/ContextElementDependency.js +53 -0
- package/dist/dependencies/css/CssExportDependency.d.ts +17 -0
- package/dist/dependencies/css/CssExportDependency.js +49 -0
- package/dist/dependencies/css/CssImportDependency.d.ts +14 -0
- package/dist/dependencies/css/CssImportDependency.js +60 -0
- package/dist/dependencies/css/CssLocalIdentifierDependency.d.ts +12 -0
- package/dist/dependencies/css/CssLocalIdentifierDependency.js +69 -0
- package/dist/dependencies/css/CssSelfLocalIdentifierDependency.d.ts +13 -0
- package/dist/dependencies/css/CssSelfLocalIdentifierDependency.js +53 -0
- package/dist/dependencies/css/CssUrlDependency.d.ts +12 -0
- package/dist/dependencies/css/CssUrlDependency.js +89 -0
- package/dist/dependencies/entry/DynamicEntryPlugin.d.ts +22 -0
- package/dist/dependencies/entry/DynamicEntryPlugin.js +62 -0
- package/dist/dependencies/entry/EntryDependency.d.ts +7 -0
- package/dist/dependencies/entry/EntryDependency.js +20 -0
- package/dist/dependencies/getFunctionExpression.d.ts +10 -0
- package/dist/dependencies/getFunctionExpression.js +42 -0
- package/dist/dependencies/harmony/HarmonyAcceptDependency.d.ts +11 -0
- package/dist/dependencies/harmony/HarmonyAcceptDependency.js +81 -0
- package/dist/dependencies/harmony/HarmonyAcceptImportDependency.d.ts +6 -0
- package/dist/dependencies/harmony/HarmonyAcceptImportDependency.js +20 -0
- package/dist/dependencies/harmony/HarmonyCompatibilityDependency.d.ts +5 -0
- package/dist/dependencies/harmony/HarmonyCompatibilityDependency.js +61 -0
- package/dist/dependencies/harmony/HarmonyDetectionParserPlugin.d.ts +5 -0
- package/dist/dependencies/harmony/HarmonyDetectionParserPlugin.js +102 -0
- package/dist/dependencies/harmony/HarmonyEvaluatedImportSpecifierDependency.d.ts +16 -0
- package/dist/dependencies/harmony/HarmonyEvaluatedImportSpecifierDependency.js +84 -0
- package/dist/dependencies/harmony/HarmonyExportDependencyParserPlugin.d.ts +5 -0
- package/dist/dependencies/harmony/HarmonyExportDependencyParserPlugin.js +143 -0
- package/dist/dependencies/harmony/HarmonyExportExpressionDependency.d.ts +23 -0
- package/dist/dependencies/harmony/HarmonyExportExpressionDependency.js +148 -0
- package/dist/dependencies/harmony/HarmonyExportHeaderDependency.d.ts +10 -0
- package/dist/dependencies/harmony/HarmonyExportHeaderDependency.js +39 -0
- package/dist/dependencies/harmony/HarmonyExportImportedSpecifierDependency.d.ts +140 -0
- package/dist/dependencies/harmony/HarmonyExportImportedSpecifierDependency.js +763 -0
- package/dist/dependencies/harmony/HarmonyExportInitFragment.d.ts +14 -0
- package/dist/dependencies/harmony/HarmonyExportInitFragment.js +147 -0
- package/dist/dependencies/harmony/HarmonyExportSpecifierDependency.d.ts +17 -0
- package/dist/dependencies/harmony/HarmonyExportSpecifierDependency.js +62 -0
- package/dist/dependencies/harmony/HarmonyExports.d.ts +3 -0
- package/dist/dependencies/harmony/HarmonyExports.js +51 -0
- package/dist/dependencies/harmony/HarmonyImportDependency.d.ts +30 -0
- package/dist/dependencies/harmony/HarmonyImportDependency.js +217 -0
- package/dist/dependencies/harmony/HarmonyImportDependencyParserPlugin.d.ts +9 -0
- package/dist/dependencies/harmony/HarmonyImportDependencyParserPlugin.js +202 -0
- package/dist/dependencies/harmony/HarmonyImportSideEffectDependency.d.ts +8 -0
- package/dist/dependencies/harmony/HarmonyImportSideEffectDependency.js +43 -0
- package/dist/dependencies/harmony/HarmonyImportSpecifierDependency.d.ts +33 -0
- package/dist/dependencies/harmony/HarmonyImportSpecifierDependency.js +272 -0
- package/dist/dependencies/harmony/HarmonyModulesPlugin.d.ts +6 -0
- package/dist/dependencies/harmony/HarmonyModulesPlugin.js +57 -0
- package/dist/dependencies/harmony/HarmonyTopLevelThisParserPlugin.d.ts +4 -0
- package/dist/dependencies/harmony/HarmonyTopLevelThisParserPlugin.js +45 -0
- package/dist/dependencies/import/ImportContextDependency.d.ts +9 -0
- package/dist/dependencies/import/ImportContextDependency.js +34 -0
- package/dist/dependencies/import/ImportDependency.d.ts +11 -0
- package/dist/dependencies/import/ImportDependency.js +57 -0
- package/dist/dependencies/import/ImportEagerDependency.d.ts +7 -0
- package/dist/dependencies/import/ImportEagerDependency.js +34 -0
- package/dist/dependencies/import/ImportMetaContextDependency.d.ts +7 -0
- package/dist/dependencies/import/ImportMetaContextDependency.js +23 -0
- package/dist/dependencies/import/ImportMetaContextDependencyParserPlugin.d.ts +3 -0
- package/dist/dependencies/import/ImportMetaContextDependencyParserPlugin.js +207 -0
- package/dist/dependencies/import/ImportMetaContextPlugin.d.ts +4 -0
- package/dist/dependencies/import/ImportMetaContextPlugin.js +27 -0
- package/dist/dependencies/import/ImportMetaHotAcceptDependency.d.ts +7 -0
- package/dist/dependencies/import/ImportMetaHotAcceptDependency.js +24 -0
- package/dist/dependencies/import/ImportMetaHotDeclineDependency.d.ts +7 -0
- package/dist/dependencies/import/ImportMetaHotDeclineDependency.js +24 -0
- package/dist/dependencies/import/ImportMetaPlugin.d.ts +4 -0
- package/dist/dependencies/import/ImportMetaPlugin.js +129 -0
- package/dist/dependencies/import/ImportParserPlugin.d.ts +6 -0
- package/dist/dependencies/import/ImportParserPlugin.js +207 -0
- package/dist/dependencies/import/ImportPlugin.d.ts +4 -0
- package/dist/dependencies/import/ImportPlugin.js +37 -0
- package/dist/dependencies/import/ImportWeakDependency.d.ts +6 -0
- package/dist/dependencies/import/ImportWeakDependency.js +33 -0
- package/dist/dependencies/json/JsonExportsDependency.d.ts +14 -0
- package/dist/dependencies/json/JsonExportsDependency.js +61 -0
- package/dist/dependencies/loader/LoaderDependency.d.ts +8 -0
- package/dist/dependencies/loader/LoaderDependency.js +21 -0
- package/dist/dependencies/loader/LoaderImportDependency.d.ts +8 -0
- package/dist/dependencies/loader/LoaderImportDependency.js +22 -0
- package/dist/dependencies/loader/LoaderPlugin.d.ts +5 -0
- package/dist/dependencies/loader/LoaderPlugin.js +164 -0
- package/dist/dependencies/processExportInfo.d.ts +2 -0
- package/dist/dependencies/processExportInfo.js +32 -0
- package/dist/ids/DeterministicChunkIdsPlugin.d.ts +10 -0
- package/dist/ids/DeterministicChunkIdsPlugin.js +30 -0
- package/dist/ids/DeterministicModuleIdsPlugin.d.ts +6 -0
- package/dist/ids/DeterministicModuleIdsPlugin.js +38 -0
- package/dist/ids/IdHelpers.d.ts +16 -0
- package/dist/ids/IdHelpers.js +259 -0
- package/dist/ids/NamedChunkIdsPlugin.d.ts +11 -0
- package/dist/ids/NamedChunkIdsPlugin.js +34 -0
- package/dist/ids/NamedModuleIdsPlugin.d.ts +6 -0
- package/dist/ids/NamedModuleIdsPlugin.js +25 -0
- package/dist/ids/NaturalChunkIdsPlugin.d.ts +4 -0
- package/dist/ids/NaturalChunkIdsPlugin.js +17 -0
- package/dist/ids/NaturalModuleIdsPlugin.d.ts +4 -0
- package/dist/ids/NaturalModuleIdsPlugin.js +16 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +58 -0
- package/dist/library/AbstractLibraryPlugin.d.ts +21 -0
- package/dist/library/AbstractLibraryPlugin.js +177 -0
- package/dist/library/AssignLibraryPlugin.d.ts +53 -0
- package/dist/library/AssignLibraryPlugin.js +201 -0
- package/dist/library/EnableLibraryPlugin.d.ts +8 -0
- package/dist/library/EnableLibraryPlugin.js +174 -0
- package/dist/library/ExportPropertyLibraryPlugin.d.ts +22 -0
- package/dist/library/ExportPropertyLibraryPlugin.js +74 -0
- package/dist/library/JsonpLibraryPlugin.d.ts +19 -0
- package/dist/library/JsonpLibraryPlugin.js +35 -0
- package/dist/library/ModuleLibraryPlugin.d.ts +16 -0
- package/dist/library/ModuleLibraryPlugin.js +73 -0
- package/dist/library/UmdLibraryPlugin.d.ts +22 -0
- package/dist/library/UmdLibraryPlugin.js +161 -0
- package/dist/module/ContextExclusionPlugin.d.ts +6 -0
- package/dist/module/ContextExclusionPlugin.js +13 -0
- package/dist/module/ContextModule.d.ts +75 -0
- package/dist/module/ContextModule.js +844 -0
- package/dist/module/ContextModuleFactory.d.ts +8 -0
- package/dist/module/ContextModuleFactory.js +292 -0
- package/dist/module/ContextReplacementPlugin.d.ts +11 -0
- package/dist/module/ContextReplacementPlugin.js +128 -0
- package/dist/module/CssModule.d.ts +20 -0
- package/dist/module/CssModule.js +105 -0
- package/dist/module/ExportsInfo.d.ts +135 -0
- package/dist/module/ExportsInfo.js +1171 -0
- package/dist/module/ExportsInfoApiPlugin.d.ts +4 -0
- package/dist/module/ExportsInfoApiPlugin.js +38 -0
- package/dist/module/ExternalModule.d.ts +47 -0
- package/dist/module/ExternalModule.js +458 -0
- package/dist/module/ExternalModuleFactoryPlugin.d.ts +7 -0
- package/dist/module/ExternalModuleFactoryPlugin.js +176 -0
- package/dist/module/ExternalsPlugin.d.ts +7 -0
- package/dist/module/ExternalsPlugin.js +18 -0
- package/dist/module/Generator.d.ts +40 -0
- package/dist/module/Generator.js +49 -0
- package/dist/module/IgnoreErrorModuleFactory.d.ts +7 -0
- package/dist/module/IgnoreErrorModuleFactory.js +16 -0
- package/dist/module/JavascriptMetaInfoPlugin.d.ts +4 -0
- package/dist/module/JavascriptMetaInfoPlugin.js +65 -0
- package/dist/module/LazyModuleFactoryPlugin.d.ts +6 -0
- package/dist/module/LazyModuleFactoryPlugin.js +171 -0
- package/dist/module/Module.d.ts +175 -0
- package/dist/module/Module.js +550 -0
- package/dist/module/ModuleFactory.d.ts +25 -0
- package/dist/module/ModuleFactory.js +10 -0
- package/dist/module/ModuleGraph.d.ts +74 -0
- package/dist/module/ModuleGraph.js +470 -0
- package/dist/module/ModuleGraphConnection.d.ts +33 -0
- package/dist/module/ModuleGraphConnection.js +113 -0
- package/dist/module/ModuleProfile.d.ts +40 -0
- package/dist/module/ModuleProfile.js +77 -0
- package/dist/module/ModuleTypeConstants.d.ts +22 -0
- package/dist/module/ModuleTypeConstants.js +45 -0
- package/dist/module/NormalModule.d.ts +104 -0
- package/dist/module/NormalModule.js +904 -0
- package/dist/module/NormalModuleFactory.d.ts +36 -0
- package/dist/module/NormalModuleFactory.js +761 -0
- package/dist/module/Parser.d.ts +4 -0
- package/dist/module/Parser.js +9 -0
- package/dist/module/RawModule.d.ts +29 -0
- package/dist/module/RawModule.js +74 -0
- package/dist/module/RuntimeGlobals.d.ts +310 -0
- package/dist/module/RuntimeGlobals.js +316 -0
- package/dist/module/RuntimeHelpers.d.ts +43 -0
- package/dist/module/RuntimeHelpers.js +548 -0
- package/dist/module/RuntimeModule.d.ts +39 -0
- package/dist/module/RuntimeModule.js +114 -0
- package/dist/module/RuntimePlugin.d.ts +4 -0
- package/dist/module/RuntimePlugin.js +332 -0
- package/dist/module/SelfModuleFactory.d.ts +6 -0
- package/dist/module/SelfModuleFactory.js +14 -0
- package/dist/module/asset/AssetGenerator.d.ts +30 -0
- package/dist/module/asset/AssetGenerator.js +364 -0
- package/dist/module/asset/AssetModulesPlugin.d.ts +4 -0
- package/dist/module/asset/AssetModulesPlugin.js +98 -0
- package/dist/module/asset/AssetParser.d.ts +12 -0
- package/dist/module/asset/AssetParser.js +44 -0
- package/dist/module/asset/AssetSourceGenerator.d.ts +14 -0
- package/dist/module/asset/AssetSourceGenerator.js +74 -0
- package/dist/module/asset/AssetSourceParser.d.ts +5 -0
- package/dist/module/asset/AssetSourceParser.js +19 -0
- package/dist/module/asset/RawDataUrlModule.d.ts +27 -0
- package/dist/module/asset/RawDataUrlModule.js +102 -0
- package/dist/module/async-modules/AwaitDependenciesInitFragment.d.ts +10 -0
- package/dist/module/async-modules/AwaitDependenciesInitFragment.js +68 -0
- package/dist/module/async-modules/InferAsyncModulesPlugin.d.ts +4 -0
- package/dist/module/async-modules/InferAsyncModulesPlugin.js +28 -0
- package/dist/module/javascript/BasicEvaluatedExpression.d.ts +139 -0
- package/dist/module/javascript/BasicEvaluatedExpression.js +481 -0
- package/dist/module/javascript/JavascriptGenerator.d.ts +11 -0
- package/dist/module/javascript/JavascriptGenerator.js +103 -0
- package/dist/module/javascript/JavascriptModulesPlugin.d.ts +17 -0
- package/dist/module/javascript/JavascriptModulesPlugin.js +821 -0
- package/dist/module/javascript/JavascriptParser.d.ts +598 -0
- package/dist/module/javascript/JavascriptParser.js +3579 -0
- package/dist/module/javascript/JavascriptParserHelpers.d.ts +10 -0
- package/dist/module/javascript/JavascriptParserHelpers.js +61 -0
- package/dist/module/json/JsonData.d.ts +9 -0
- package/dist/module/json/JsonData.js +43 -0
- package/dist/module/json/JsonGenerator.d.ts +15 -0
- package/dist/module/json/JsonGenerator.js +137 -0
- package/dist/module/json/JsonModulesPlugin.d.ts +4 -0
- package/dist/module/json/JsonModulesPlugin.js +20 -0
- package/dist/module/json/JsonParser.d.ts +7 -0
- package/dist/module/json/JsonParser.js +41 -0
- package/dist/module/runtime/AsyncModuleRuntimeModule.d.ts +6 -0
- package/dist/module/runtime/AsyncModuleRuntimeModule.js +115 -0
- package/dist/module/runtime/AutoPublicPathRuntimeModule.d.ts +6 -0
- package/dist/module/runtime/AutoPublicPathRuntimeModule.js +81 -0
- package/dist/module/runtime/BaseUriRuntimeModule.d.ts +6 -0
- package/dist/module/runtime/BaseUriRuntimeModule.js +41 -0
- package/dist/module/runtime/ChunkNameRuntimeModule.d.ts +7 -0
- package/dist/module/runtime/ChunkNameRuntimeModule.js +40 -0
- package/dist/module/runtime/CompatGetDefaultExportRuntimeModule.d.ts +6 -0
- package/dist/module/runtime/CompatGetDefaultExportRuntimeModule.js +54 -0
- package/dist/module/runtime/CompatRuntimeModule.d.ts +7 -0
- package/dist/module/runtime/CompatRuntimeModule.js +59 -0
- package/dist/module/runtime/CreateFakeNamespaceObjectRuntimeModule.d.ts +6 -0
- package/dist/module/runtime/CreateFakeNamespaceObjectRuntimeModule.js +77 -0
- package/dist/module/runtime/CreateScriptRuntimeModule.d.ts +6 -0
- package/dist/module/runtime/CreateScriptRuntimeModule.js +44 -0
- package/dist/module/runtime/CreateScriptUrlRuntimeModule.d.ts +6 -0
- package/dist/module/runtime/CreateScriptUrlRuntimeModule.js +44 -0
- package/dist/module/runtime/DefinePropertyGettersRuntimeModule.d.ts +6 -0
- package/dist/module/runtime/DefinePropertyGettersRuntimeModule.js +56 -0
- package/dist/module/runtime/EnsureChunkRuntimeModule.d.ts +7 -0
- package/dist/module/runtime/EnsureChunkRuntimeModule.js +66 -0
- package/dist/module/runtime/GetChunkFilenameRuntimeModule.d.ts +10 -0
- package/dist/module/runtime/GetChunkFilenameRuntimeModule.js +220 -0
- package/dist/module/runtime/GetFullHashRuntimeModule.d.ts +6 -0
- package/dist/module/runtime/GetFullHashRuntimeModule.js +42 -0
- package/dist/module/runtime/GetMainFilenameRuntimeModule.d.ts +8 -0
- package/dist/module/runtime/GetMainFilenameRuntimeModule.js +52 -0
- package/dist/module/runtime/GetTrustedTypesPolicyRuntimeModule.d.ts +7 -0
- package/dist/module/runtime/GetTrustedTypesPolicyRuntimeModule.js +89 -0
- package/dist/module/runtime/GlobalRuntimeModule.d.ts +6 -0
- package/dist/module/runtime/GlobalRuntimeModule.js +61 -0
- package/dist/module/runtime/HasOwnPropertyRuntimeModule.d.ts +6 -0
- package/dist/module/runtime/HasOwnPropertyRuntimeModule.js +44 -0
- package/dist/module/runtime/HelperRuntimeModule.d.ts +5 -0
- package/dist/module/runtime/HelperRuntimeModule.js +12 -0
- package/dist/module/runtime/LoadScriptRuntimeModule.d.ts +9 -0
- package/dist/module/runtime/LoadScriptRuntimeModule.js +129 -0
- package/dist/module/runtime/MakeNamespaceObjectRuntimeModule.d.ts +6 -0
- package/dist/module/runtime/MakeNamespaceObjectRuntimeModule.js +53 -0
- package/dist/module/runtime/NonceRuntimeModule.d.ts +6 -0
- package/dist/module/runtime/NonceRuntimeModule.js +39 -0
- package/dist/module/runtime/OnChunksLoadedRuntimeModule.d.ts +6 -0
- package/dist/module/runtime/OnChunksLoadedRuntimeModule.js +81 -0
- package/dist/module/runtime/PublicPathRuntimeModule.d.ts +7 -0
- package/dist/module/runtime/PublicPathRuntimeModule.js +44 -0
- package/dist/module/runtime/RelativeUrlRuntimeModule.d.ts +6 -0
- package/dist/module/runtime/RelativeUrlRuntimeModule.js +56 -0
- package/dist/module/runtime/RuntimeIdRuntimeModule.d.ts +6 -0
- package/dist/module/runtime/RuntimeIdRuntimeModule.js +45 -0
- package/dist/module/runtime/StartupChunkDependenciesPlugin.d.ts +11 -0
- package/dist/module/runtime/StartupChunkDependenciesPlugin.js +69 -0
- package/dist/module/runtime/StartupChunkDependenciesRuntimeModule.d.ts +7 -0
- package/dist/module/runtime/StartupChunkDependenciesRuntimeModule.js +67 -0
- package/dist/module/runtime/StartupEntrypointRuntimeModule.d.ts +7 -0
- package/dist/module/runtime/StartupEntrypointRuntimeModule.js +58 -0
- package/dist/module/uri/DataUriPlugin.d.ts +4 -0
- package/dist/module/uri/DataUriPlugin.js +46 -0
- package/dist/module/uri/FileUriPlugin.d.ts +4 -0
- package/dist/module/uri/FileUriPlugin.js +31 -0
- package/dist/plugins/APIPlugin.d.ts +9 -0
- package/dist/plugins/APIPlugin.js +230 -0
- package/dist/plugins/CleanPlugin.d.ts +7 -0
- package/dist/plugins/CleanPlugin.js +295 -0
- package/dist/plugins/CompatibilityPlugin.d.ts +4 -0
- package/dist/plugins/CompatibilityPlugin.js +142 -0
- package/dist/plugins/ConstPlugin.d.ts +4 -0
- package/dist/plugins/ConstPlugin.js +409 -0
- package/dist/plugins/DefaultStatsFactoryPlugin.d.ts +4 -0
- package/dist/plugins/DefaultStatsFactoryPlugin.js +1552 -0
- package/dist/plugins/DefaultStatsPresetPlugin.d.ts +4 -0
- package/dist/plugins/DefaultStatsPresetPlugin.js +306 -0
- package/dist/plugins/DefaultStatsPrinterPlugin.d.ts +4 -0
- package/dist/plugins/DefaultStatsPrinterPlugin.js +986 -0
- package/dist/plugins/DefinePlugin.d.ts +15 -0
- package/dist/plugins/DefinePlugin.js +400 -0
- package/dist/plugins/NodeStuffPlugin.d.ts +6 -0
- package/dist/plugins/NodeStuffPlugin.js +134 -0
- package/dist/plugins/ProgressPlugin.d.ts +20 -0
- package/dist/plugins/ProgressPlugin.js +494 -0
- package/dist/plugins/RecordIdsPlugin.d.ts +9 -0
- package/dist/plugins/RecordIdsPlugin.js +175 -0
- package/dist/plugins/UseStrictPlugin.d.ts +4 -0
- package/dist/plugins/UseStrictPlugin.js +35 -0
- package/dist/plugins/WarnCaseSensitiveModulesPlugin.d.ts +4 -0
- package/dist/plugins/WarnCaseSensitiveModulesPlugin.js +37 -0
- package/dist/plugins/WarnDeprecatedOptionPlugin.d.ts +8 -0
- package/dist/plugins/WarnDeprecatedOptionPlugin.js +29 -0
- package/dist/plugins/cssMinimizer/CssMinimizerMinify.js +73 -0
- package/dist/plugins/cssMinimizer/CssMinimizerPlugin.d.ts +11 -0
- package/dist/plugins/cssMinimizer/CssMinimizerPlugin.js +329 -0
- package/dist/plugins/cssMinimizer/CssMinimizerUtils.js +147 -0
- package/dist/plugins/miniCssExtractPlugin/MiniCssExtractLoader.d.ts +1 -0
- package/dist/plugins/miniCssExtractPlugin/MiniCssExtractLoader.js +177 -0
- package/dist/plugins/miniCssExtractPlugin/MiniCssExtractPlugin.d.ts +22 -0
- package/dist/plugins/miniCssExtractPlugin/MiniCssExtractPlugin.js +780 -0
- package/dist/plugins/miniCssExtractPlugin/MiniCssUtils.d.ts +14 -0
- package/dist/plugins/miniCssExtractPlugin/MiniCssUtils.js +132 -0
- package/dist/plugins/optimize/AggressiveMergingPlugin.d.ts +6 -0
- package/dist/plugins/optimize/AggressiveMergingPlugin.js +62 -0
- package/dist/plugins/optimize/AggressiveSplittingPlugin.d.ts +7 -0
- package/dist/plugins/optimize/AggressiveSplittingPlugin.js +247 -0
- package/dist/plugins/optimize/ConcatenatedModule.d.ts +47 -0
- package/dist/plugins/optimize/ConcatenatedModule.js +1221 -0
- package/dist/plugins/optimize/EnsureChunkConditionsPlugin.d.ts +4 -0
- package/dist/plugins/optimize/EnsureChunkConditionsPlugin.js +61 -0
- package/dist/plugins/optimize/FlagAllModulesAsUsedPlugin.d.ts +6 -0
- package/dist/plugins/optimize/FlagAllModulesAsUsedPlugin.js +30 -0
- package/dist/plugins/optimize/FlagDependencyExportsPlugin.d.ts +4 -0
- package/dist/plugins/optimize/FlagDependencyExportsPlugin.js +275 -0
- package/dist/plugins/optimize/FlagDependencyUsagePlugin.d.ts +6 -0
- package/dist/plugins/optimize/FlagDependencyUsagePlugin.js +243 -0
- package/dist/plugins/optimize/FlagEntryExportAsUsedPlugin.d.ts +7 -0
- package/dist/plugins/optimize/FlagEntryExportAsUsedPlugin.js +34 -0
- package/dist/plugins/optimize/FlagIncludedChunksPlugin.d.ts +4 -0
- package/dist/plugins/optimize/FlagIncludedChunksPlugin.js +85 -0
- package/dist/plugins/optimize/InnerGraph.d.ts +20 -0
- package/dist/plugins/optimize/InnerGraph.js +234 -0
- package/dist/plugins/optimize/InnerGraphPlugin.d.ts +4 -0
- package/dist/plugins/optimize/InnerGraphPlugin.js +289 -0
- package/dist/plugins/optimize/LimitChunkCountPlugin.d.ts +6 -0
- package/dist/plugins/optimize/LimitChunkCountPlugin.js +200 -0
- package/dist/plugins/optimize/MangleExportsPlugin.d.ts +6 -0
- package/dist/plugins/optimize/MangleExportsPlugin.js +124 -0
- package/dist/plugins/optimize/MergeDuplicateChunksPlugin.d.ts +4 -0
- package/dist/plugins/optimize/MergeDuplicateChunksPlugin.js +84 -0
- package/dist/plugins/optimize/MinChunkSizePlugin.d.ts +6 -0
- package/dist/plugins/optimize/MinChunkSizePlugin.js +71 -0
- package/dist/plugins/optimize/ModuleConcatenationPlugin.d.ts +8 -0
- package/dist/plugins/optimize/ModuleConcatenationPlugin.js +525 -0
- package/dist/plugins/optimize/ModuleInfoHeaderPlugin.d.ts +6 -0
- package/dist/plugins/optimize/ModuleInfoHeaderPlugin.js +145 -0
- package/dist/plugins/optimize/NoEmitOnErrorsPlugin.d.ts +4 -0
- package/dist/plugins/optimize/NoEmitOnErrorsPlugin.js +17 -0
- package/dist/plugins/optimize/OptimizationStages.d.ts +4 -0
- package/dist/plugins/optimize/OptimizationStages.js +9 -0
- package/dist/plugins/optimize/RealContentHashPlugin.d.ts +11 -0
- package/dist/plugins/optimize/RealContentHashPlugin.js +295 -0
- package/dist/plugins/optimize/RemoveEmptyChunksPlugin.d.ts +4 -0
- package/dist/plugins/optimize/RemoveEmptyChunksPlugin.js +30 -0
- package/dist/plugins/optimize/RemoveParentModulesPlugin.d.ts +4 -0
- package/dist/plugins/optimize/RemoveParentModulesPlugin.js +103 -0
- package/dist/plugins/optimize/RuntimeChunkPlugin.d.ts +6 -0
- package/dist/plugins/optimize/RuntimeChunkPlugin.js +25 -0
- package/dist/plugins/optimize/SideEffectsFlagPlugin.d.ts +7 -0
- package/dist/plugins/optimize/SideEffectsFlagPlugin.js +211 -0
- package/dist/plugins/optimize/SplitChunksPlugin.d.ts +7 -0
- package/dist/plugins/optimize/SplitChunksPlugin.js +1113 -0
- package/dist/rules/BasicEffectRulePlugin.d.ts +7 -0
- package/dist/rules/BasicEffectRulePlugin.js +21 -0
- package/dist/rules/BasicMatcherRulePlugin.d.ts +8 -0
- package/dist/rules/BasicMatcherRulePlugin.js +25 -0
- package/dist/rules/ObjectMatcherRulePlugin.d.ts +7 -0
- package/dist/rules/ObjectMatcherRulePlugin.js +27 -0
- package/dist/rules/RuleSetCompiler.d.ts +20 -0
- package/dist/rules/RuleSetCompiler.js +242 -0
- package/dist/rules/UseEffectRulePlugin.d.ts +5 -0
- package/dist/rules/UseEffectRulePlugin.js +117 -0
- package/dist/serialization/Serialization.d.ts +11 -0
- package/dist/serialization/Serialization.js +95 -0
- package/dist/serialization/Serializer.d.ts +9 -0
- package/dist/serialization/Serializer.js +43 -0
- package/dist/serialization/SerializerMiddleware.d.ts +13 -0
- package/dist/serialization/SerializerMiddleware.js +86 -0
- package/dist/serialization/internalSerializables.d.ts +82 -0
- package/dist/serialization/internalSerializables.js +94 -0
- package/dist/serialization/makeSerializable.d.ts +2 -0
- package/dist/serialization/makeSerializable.js +25 -0
- package/dist/serialization/middlewares/BinaryMiddleware.d.ts +12 -0
- package/dist/serialization/middlewares/BinaryMiddleware.js +955 -0
- package/dist/serialization/middlewares/FileMiddleware.d.ts +9 -0
- package/dist/serialization/middlewares/FileMiddleware.js +546 -0
- package/dist/serialization/middlewares/ObjectMiddleware.d.ts +15 -0
- package/dist/serialization/middlewares/ObjectMiddleware.js +602 -0
- package/dist/serialization/middlewares/SingleItemMiddleware.d.ts +6 -0
- package/dist/serialization/middlewares/SingleItemMiddleware.js +15 -0
- package/dist/serialization/registerExternalSerializer.d.ts +1 -0
- package/dist/serialization/registerExternalSerializer.js +154 -0
- package/dist/serialization/serializers/ArraySerializer.d.ts +5 -0
- package/dist/serialization/serializers/ArraySerializer.js +18 -0
- package/dist/serialization/serializers/DateObjectSerializer.d.ts +5 -0
- package/dist/serialization/serializers/DateObjectSerializer.js +11 -0
- package/dist/serialization/serializers/ErrorObjectSerializer.d.ts +7 -0
- package/dist/serialization/serializers/ErrorObjectSerializer.js +20 -0
- package/dist/serialization/serializers/MapObjectSerializer.d.ts +5 -0
- package/dist/serialization/serializers/MapObjectSerializer.js +26 -0
- package/dist/serialization/serializers/NullPrototypeObjectSerializer.d.ts +5 -0
- package/dist/serialization/serializers/NullPrototypeObjectSerializer.js +28 -0
- package/dist/serialization/serializers/PlainObjectSerializer.d.ts +5 -0
- package/dist/serialization/serializers/PlainObjectSerializer.js +77 -0
- package/dist/serialization/serializers/RegExpObjectSerializer.d.ts +5 -0
- package/dist/serialization/serializers/RegExpObjectSerializer.js +12 -0
- package/dist/serialization/serializers/SetObjectSerializer.d.ts +5 -0
- package/dist/serialization/serializers/SetObjectSerializer.js +19 -0
- package/dist/sourcemap/EvalDevToolModulePlugin.d.ts +8 -0
- package/dist/sourcemap/EvalDevToolModulePlugin.js +97 -0
- package/dist/sourcemap/EvalSourceMapDevToolPlugin.d.ts +9 -0
- package/dist/sourcemap/EvalSourceMapDevToolPlugin.js +167 -0
- package/dist/sourcemap/SourceMapDevToolModuleOptionsPlugin.d.ts +6 -0
- package/dist/sourcemap/SourceMapDevToolModuleOptionsPlugin.js +29 -0
- package/dist/sourcemap/SourceMapDevToolPlugin.d.ts +11 -0
- package/dist/sourcemap/SourceMapDevToolPlugin.js +364 -0
- package/dist/template/ChunkTemplate.d.ts +6 -0
- package/dist/template/ChunkTemplate.js +69 -0
- package/dist/template/LibraryTemplatePlugin.d.ts +6 -0
- package/dist/template/LibraryTemplatePlugin.js +23 -0
- package/dist/template/MainTemplate.d.ts +10 -0
- package/dist/template/MainTemplate.js +177 -0
- package/dist/template/ModuleTemplate.d.ts +7 -0
- package/dist/template/ModuleTemplate.js +46 -0
- package/dist/template/RuntimeTemplate.d.ts +158 -0
- package/dist/template/RuntimeTemplate.js +663 -0
- package/dist/template/Template.d.ts +25 -0
- package/dist/template/Template.js +269 -0
- package/dist/template/TemplatedPathPlugin.d.ts +4 -0
- package/dist/template/TemplatedPathPlugin.js +228 -0
- package/dist/thread/WorkerError.d.ts +4 -0
- package/dist/thread/WorkerError.js +21 -0
- package/dist/thread/WorkerPool.d.ts +52 -0
- package/dist/thread/WorkerPool.js +370 -0
- package/dist/thread/readBuffer.d.ts +1 -0
- package/dist/thread/readBuffer.js +37 -0
- package/dist/thread/serializer.d.ts +2 -0
- package/dist/thread/serializer.js +24 -0
- package/dist/thread/worker.d.ts +1 -0
- package/dist/thread/worker.js +185 -0
- package/dist/thread/workerPools.d.ts +2 -0
- package/dist/thread/workerPools.js +31 -0
- package/dist/types/index.d.ts +58 -0
- package/dist/types/index.js +8 -0
- package/package.json +96 -0
|
@@ -0,0 +1,3513 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
+
var t = {};
|
|
27
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
+
t[p] = s[p];
|
|
29
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
+
t[p[i]] = s[p[i]];
|
|
33
|
+
}
|
|
34
|
+
return t;
|
|
35
|
+
};
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
const neo_async_1 = __importDefault(require("neo-async"));
|
|
41
|
+
const tapable_1 = require("tapable");
|
|
42
|
+
const util_1 = __importDefault(require("util"));
|
|
43
|
+
const webpack_sources_1 = require("webpack-sources");
|
|
44
|
+
const CacheFacade_1 = require("@/cache/CacheFacade");
|
|
45
|
+
const Chunk_1 = __importDefault(require("@/chunk/Chunk"));
|
|
46
|
+
const ChunkGraph_1 = __importDefault(require("@/chunk/ChunkGraph"));
|
|
47
|
+
const ChunkGroup_1 = __importDefault(require("@/chunk/ChunkGroup"));
|
|
48
|
+
const ChunkRenderError_1 = __importDefault(require("@/base/errors/ChunkRenderError"));
|
|
49
|
+
const ChunkTemplate_1 = __importDefault(require("@/template/ChunkTemplate"));
|
|
50
|
+
const CodeGenerationError_1 = __importDefault(require("@/base/errors/CodeGenerationError"));
|
|
51
|
+
const CodeGenerationResults_1 = __importDefault(require("@/chunk/CodeGenerationResults"));
|
|
52
|
+
const Dependency_1 = __importDefault(require("@/dependencies/Dependency"));
|
|
53
|
+
const DependencyTemplates_1 = __importDefault(require("@/dependencies/DependencyTemplates"));
|
|
54
|
+
const Entrypoint_1 = __importDefault(require("@/chunk/Entrypoint"));
|
|
55
|
+
const ErrorHelpers = __importStar(require("@/base/errors/ErrorHelpers"));
|
|
56
|
+
const GraphHelpers_1 = require("@/base/GraphHelpers");
|
|
57
|
+
const HookBaseError_1 = require("@/base/errors/HookBaseError");
|
|
58
|
+
const MainTemplate_1 = __importDefault(require("@/template/MainTemplate"));
|
|
59
|
+
const Module_1 = __importDefault(require("@/module/Module"));
|
|
60
|
+
const ModuleDependencyError_1 = __importDefault(require("@/base/errors/ModuleDependencyError"));
|
|
61
|
+
const ModuleDependencyWarning_1 = __importDefault(require("@/base/errors/ModuleDependencyWarning"));
|
|
62
|
+
const ModuleGraph_1 = __importDefault(require("@/module/ModuleGraph"));
|
|
63
|
+
const ModuleHashingError_1 = __importDefault(require("@/base/errors/ModuleHashingError"));
|
|
64
|
+
const ModuleNotFoundError_1 = __importDefault(require("@/base/errors/ModuleNotFoundError"));
|
|
65
|
+
const ModuleProfile_1 = __importDefault(require("@/module/ModuleProfile"));
|
|
66
|
+
const ModuleRestoreError_1 = __importDefault(require("@/base/errors/ModuleRestoreError"));
|
|
67
|
+
const ModuleStoreError_1 = __importDefault(require("@/base/errors/ModuleStoreError"));
|
|
68
|
+
const ModuleTemplate_1 = __importDefault(require("@/template/ModuleTemplate"));
|
|
69
|
+
const ModuleTypeConstants_1 = require("@/module/ModuleTypeConstants");
|
|
70
|
+
const RuntimeGlobals = __importStar(require("@/module/RuntimeGlobals"));
|
|
71
|
+
const RuntimeTemplate_1 = __importDefault(require("@/template/RuntimeTemplate"));
|
|
72
|
+
const Stats_1 = __importDefault(require("@/base/stats/Stats"));
|
|
73
|
+
const BaseError_1 = __importDefault(require("@/base/errors/BaseError"));
|
|
74
|
+
const buildChunkGraph_1 = __importDefault(require("@/chunk/buildChunkGraph"));
|
|
75
|
+
const BuildCycleError_1 = __importDefault(require("@/base/errors/BuildCycleError"));
|
|
76
|
+
const StatsFactory_1 = __importDefault(require("@/base/stats/StatsFactory"));
|
|
77
|
+
const StatsPrinter_1 = __importDefault(require("@/base/stats/StatsPrinter"));
|
|
78
|
+
const ArrayHelpers_1 = require("@/base/ArrayHelpers");
|
|
79
|
+
const AsyncQueue_1 = __importDefault(require("@/base/AsyncQueue"));
|
|
80
|
+
const LazySet_1 = __importDefault(require("@/base/LazySet"));
|
|
81
|
+
const MapHelpers_1 = require("@/base/MapHelpers");
|
|
82
|
+
const WeakTupleMap_1 = __importDefault(require("@/base/WeakTupleMap"));
|
|
83
|
+
const cleverMerge_1 = require("@/base/cleverMerge");
|
|
84
|
+
const comparators_1 = require("@/base/comparators");
|
|
85
|
+
const createHash_1 = __importDefault(require("@/base/createHash"));
|
|
86
|
+
const deprecation_1 = require("@/base/deprecation");
|
|
87
|
+
const processAsyncTree_1 = __importDefault(require("@/base/processAsyncTree"));
|
|
88
|
+
const RuntimeHelpers_1 = require("@/module/RuntimeHelpers");
|
|
89
|
+
const source_1 = require("@/base/source");
|
|
90
|
+
const NormalModule_1 = __importDefault(require("@/module/NormalModule"));
|
|
91
|
+
const ParallelismFactorCalculator_1 = __importDefault(require("@/base/ParallelismFactorCalculator"));
|
|
92
|
+
const Logger_1 = require("./base/logging/Logger");
|
|
93
|
+
const FileSystemInfo_1 = require("./FileSystemInfo");
|
|
94
|
+
const EMPTY_ASSET_INFO = Object.freeze({});
|
|
95
|
+
const esmDependencyCategory = 'esm';
|
|
96
|
+
const deprecatedNormalModuleLoaderHook = util_1.default.deprecate(compilation => NormalModule_1.default.getCompilationHooks(compilation).loader, 'Compilation.hooks.normalModuleLoader was moved to NormalModule.getCompilationHooks(compilation).loader', 'DEP_WEBPACK_COMPILATION_NORMAL_MODULE_LOADER_HOOK');
|
|
97
|
+
const defineRemovedModuleTemplates = moduleTemplates => {
|
|
98
|
+
Object.defineProperties(moduleTemplates, {
|
|
99
|
+
asset: {
|
|
100
|
+
enumerable: false,
|
|
101
|
+
configurable: false,
|
|
102
|
+
get: () => {
|
|
103
|
+
throw new BaseError_1.default('Compilation.moduleTemplates.asset has been removed');
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
webassembly: {
|
|
107
|
+
enumerable: false,
|
|
108
|
+
configurable: false,
|
|
109
|
+
get: () => {
|
|
110
|
+
throw new BaseError_1.default('Compilation.moduleTemplates.webassembly has been removed');
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
moduleTemplates = undefined;
|
|
115
|
+
};
|
|
116
|
+
const byId = (0, comparators_1.compareSelect)(c => c.id, comparators_1.compareIds);
|
|
117
|
+
const byNameOrHash = (0, comparators_1.concatComparators)((0, comparators_1.compareSelect)(c => c.name, comparators_1.compareIds), (0, comparators_1.compareSelect)(c => c.fullHash, comparators_1.compareIds));
|
|
118
|
+
const byMessage = (0, comparators_1.compareSelect)(err => `${err.message}`, comparators_1.compareStringsNumeric);
|
|
119
|
+
const byModule = (0, comparators_1.compareSelect)(err => { var _a; return ((_a = err.module) === null || _a === void 0 ? void 0 : _a.identifier()) || ''; }, comparators_1.compareStringsNumeric);
|
|
120
|
+
const byLocation = (0, comparators_1.compareSelect)(err => err.loc, comparators_1.compareLocations);
|
|
121
|
+
const compareErrors = (0, comparators_1.concatComparators)(byModule, byLocation, byMessage);
|
|
122
|
+
const unsafeCacheDependencies = new WeakMap();
|
|
123
|
+
const unsafeCacheData = new WeakMap();
|
|
124
|
+
class Compilation {
|
|
125
|
+
constructor(compiler, params) {
|
|
126
|
+
this._backCompat = false;
|
|
127
|
+
const getNormalModuleLoader = () => deprecatedNormalModuleLoaderHook(this);
|
|
128
|
+
const processAssetsHook = new tapable_1.AsyncSeriesHook(['assets']);
|
|
129
|
+
let savedAssets = new Set();
|
|
130
|
+
const popNewAssets = assets => {
|
|
131
|
+
let newAssets;
|
|
132
|
+
for (const file of Object.keys(assets)) {
|
|
133
|
+
if (savedAssets.has(file))
|
|
134
|
+
continue;
|
|
135
|
+
if (newAssets === undefined) {
|
|
136
|
+
newAssets = Object.create(null);
|
|
137
|
+
}
|
|
138
|
+
newAssets[file] = assets[file];
|
|
139
|
+
savedAssets.add(file);
|
|
140
|
+
}
|
|
141
|
+
return newAssets;
|
|
142
|
+
};
|
|
143
|
+
processAssetsHook.intercept({
|
|
144
|
+
name: 'Compilation',
|
|
145
|
+
call: () => {
|
|
146
|
+
savedAssets = new Set(Object.keys(this.assets));
|
|
147
|
+
},
|
|
148
|
+
register: (tap) => {
|
|
149
|
+
const { type, name } = tap;
|
|
150
|
+
const { fn, additionalAssets } = tap, remainingTap = __rest(tap, ["fn", "additionalAssets"]);
|
|
151
|
+
const additionalAssetsFn = additionalAssets === true ? fn : additionalAssets;
|
|
152
|
+
const processedAssets = additionalAssetsFn ? new WeakSet() : undefined;
|
|
153
|
+
switch (type) {
|
|
154
|
+
case 'sync':
|
|
155
|
+
if (additionalAssetsFn) {
|
|
156
|
+
this.hooks.processAdditionalAssets.tap(name, assets => {
|
|
157
|
+
if (processedAssets.has(this.assets))
|
|
158
|
+
additionalAssetsFn(assets);
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
return Object.assign(Object.assign({}, remainingTap), { type: 'async', fn: (assets, callback) => {
|
|
162
|
+
try {
|
|
163
|
+
fn(assets);
|
|
164
|
+
}
|
|
165
|
+
catch (e) {
|
|
166
|
+
return callback(e);
|
|
167
|
+
}
|
|
168
|
+
if (processedAssets !== undefined)
|
|
169
|
+
processedAssets.add(this.assets);
|
|
170
|
+
const newAssets = popNewAssets(assets);
|
|
171
|
+
if (newAssets !== undefined) {
|
|
172
|
+
this.hooks.processAdditionalAssets.callAsync(newAssets, callback);
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
callback();
|
|
176
|
+
} });
|
|
177
|
+
case 'async':
|
|
178
|
+
if (additionalAssetsFn) {
|
|
179
|
+
this.hooks.processAdditionalAssets.tapAsync(name, (assets, callback) => {
|
|
180
|
+
if (processedAssets.has(this.assets))
|
|
181
|
+
return additionalAssetsFn(assets, callback);
|
|
182
|
+
callback();
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
return Object.assign(Object.assign({}, remainingTap), { fn: (assets, callback) => {
|
|
186
|
+
fn(assets, err => {
|
|
187
|
+
if (err)
|
|
188
|
+
return callback(err);
|
|
189
|
+
if (processedAssets !== undefined)
|
|
190
|
+
processedAssets.add(this.assets);
|
|
191
|
+
const newAssets = popNewAssets(assets);
|
|
192
|
+
if (newAssets !== undefined) {
|
|
193
|
+
this.hooks.processAdditionalAssets.callAsync(newAssets, callback);
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
callback();
|
|
197
|
+
});
|
|
198
|
+
} });
|
|
199
|
+
case 'promise':
|
|
200
|
+
if (additionalAssetsFn) {
|
|
201
|
+
this.hooks.processAdditionalAssets.tapPromise(name, assets => {
|
|
202
|
+
if (processedAssets.has(this.assets))
|
|
203
|
+
return additionalAssetsFn(assets);
|
|
204
|
+
return Promise.resolve();
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
return Object.assign(Object.assign({}, remainingTap), { fn: assets => {
|
|
208
|
+
const p = fn(assets);
|
|
209
|
+
if (!p || !p.then)
|
|
210
|
+
return p;
|
|
211
|
+
const mem = process.memoryUsage();
|
|
212
|
+
const format = function (bytes) {
|
|
213
|
+
return `${(bytes / 1024 / 1024).toFixed(2)}MB`;
|
|
214
|
+
};
|
|
215
|
+
return p.then(() => {
|
|
216
|
+
if (processedAssets !== undefined)
|
|
217
|
+
processedAssets.add(this.assets);
|
|
218
|
+
const newAssets = popNewAssets(assets);
|
|
219
|
+
if (newAssets !== undefined) {
|
|
220
|
+
return this.hooks.processAdditionalAssets.promise(newAssets);
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
} });
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
});
|
|
227
|
+
const afterProcessAssetsHook = new tapable_1.SyncHook(['assets']);
|
|
228
|
+
const createProcessAssetsHook = (name, stage, getArgs, code) => {
|
|
229
|
+
if (!this._backCompat && code)
|
|
230
|
+
return undefined;
|
|
231
|
+
const errorMessage = reason => `Can't automatically convert plugin using Compilation.hooks.${name} to Compilation.hooks.processAssets because ${reason}.
|
|
232
|
+
BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a single Compilation.hooks.processAssets hook.`;
|
|
233
|
+
const getOptions = options => {
|
|
234
|
+
if (typeof options === 'string')
|
|
235
|
+
options = { name: options };
|
|
236
|
+
if (options.stage) {
|
|
237
|
+
throw new Error(errorMessage("it's using the 'stage' option"));
|
|
238
|
+
}
|
|
239
|
+
return Object.assign(Object.assign({}, options), { stage });
|
|
240
|
+
};
|
|
241
|
+
return (0, deprecation_1.createFakeHook)({
|
|
242
|
+
name,
|
|
243
|
+
intercept(interceptor) {
|
|
244
|
+
throw new Error(errorMessage("it's using 'intercept'"));
|
|
245
|
+
},
|
|
246
|
+
tap: (options, fn) => {
|
|
247
|
+
processAssetsHook.tap(getOptions(options), () => fn(...getArgs()));
|
|
248
|
+
},
|
|
249
|
+
tapAsync: (options, fn) => {
|
|
250
|
+
processAssetsHook.tapAsync(getOptions(options), (assets, callback) => fn(...getArgs(), callback));
|
|
251
|
+
},
|
|
252
|
+
tapPromise: (options, fn) => {
|
|
253
|
+
processAssetsHook.tapPromise(getOptions(options), () => fn(...getArgs()));
|
|
254
|
+
},
|
|
255
|
+
}, `${name} is deprecated (use Compilation.hooks.processAssets instead and use one of Compilation.PROCESS_ASSETS_STAGE_* as stage option)`, code);
|
|
256
|
+
};
|
|
257
|
+
this.hooks = Object.freeze({
|
|
258
|
+
buildModule: new tapable_1.SyncHook(['module']),
|
|
259
|
+
rebuildModule: new tapable_1.SyncHook(['module']),
|
|
260
|
+
failedModule: new tapable_1.SyncHook(['module', 'error']),
|
|
261
|
+
succeedModule: new tapable_1.SyncHook(['module']),
|
|
262
|
+
stillValidModule: new tapable_1.SyncHook(['module']),
|
|
263
|
+
addEntry: new tapable_1.SyncHook(['entry', 'options']),
|
|
264
|
+
failedEntry: new tapable_1.SyncHook(['entry', 'options', 'error']),
|
|
265
|
+
succeedEntry: new tapable_1.SyncHook(['entry', 'options', 'module']),
|
|
266
|
+
dependencyReferencedExports: new tapable_1.SyncWaterfallHook([
|
|
267
|
+
'referencedExports',
|
|
268
|
+
'dependency',
|
|
269
|
+
'runtime',
|
|
270
|
+
]),
|
|
271
|
+
executeModule: new tapable_1.SyncHook(['options', 'context']),
|
|
272
|
+
prepareModuleExecution: new tapable_1.AsyncParallelHook(['options', 'context']),
|
|
273
|
+
finishModules: new tapable_1.AsyncSeriesHook(['modules']),
|
|
274
|
+
finishRebuildingModule: new tapable_1.AsyncSeriesHook(['module']),
|
|
275
|
+
unseal: new tapable_1.SyncHook([]),
|
|
276
|
+
seal: new tapable_1.SyncHook([]),
|
|
277
|
+
beforeChunks: new tapable_1.SyncHook([]),
|
|
278
|
+
afterChunks: new tapable_1.SyncHook(['chunks']),
|
|
279
|
+
optimizeDependencies: new tapable_1.SyncBailHook(['modules']),
|
|
280
|
+
afterOptimizeDependencies: new tapable_1.SyncHook(['modules']),
|
|
281
|
+
optimize: new tapable_1.SyncHook([]),
|
|
282
|
+
optimizeModules: new tapable_1.SyncBailHook(['modules']),
|
|
283
|
+
afterOptimizeModules: new tapable_1.SyncHook(['modules']),
|
|
284
|
+
optimizeChunks: new tapable_1.SyncBailHook(['chunks', 'chunkGroups']),
|
|
285
|
+
afterOptimizeChunks: new tapable_1.SyncHook(['chunks', 'chunkGroups']),
|
|
286
|
+
optimizeTree: new tapable_1.AsyncSeriesHook(['chunks', 'modules']),
|
|
287
|
+
afterOptimizeTree: new tapable_1.SyncHook(['chunks', 'modules']),
|
|
288
|
+
optimizeChunkModules: new tapable_1.AsyncSeriesBailHook(['chunks', 'modules']),
|
|
289
|
+
afterOptimizeChunkModules: new tapable_1.SyncHook(['chunks', 'modules']),
|
|
290
|
+
shouldRecord: new tapable_1.SyncBailHook([]),
|
|
291
|
+
additionalChunkRuntimeRequirements: new tapable_1.SyncHook([
|
|
292
|
+
'chunk',
|
|
293
|
+
'runtimeRequirements',
|
|
294
|
+
'context',
|
|
295
|
+
]),
|
|
296
|
+
runtimeRequirementInChunk: new tapable_1.HookMap(() => new tapable_1.SyncBailHook(['chunk', 'runtimeRequirements', 'context'])),
|
|
297
|
+
additionalModuleRuntimeRequirements: new tapable_1.SyncHook([
|
|
298
|
+
'module',
|
|
299
|
+
'runtimeRequirements',
|
|
300
|
+
'context',
|
|
301
|
+
]),
|
|
302
|
+
runtimeRequirementInModule: new tapable_1.HookMap(() => new tapable_1.SyncBailHook(['module', 'runtimeRequirements', 'context'])),
|
|
303
|
+
additionalTreeRuntimeRequirements: new tapable_1.SyncHook([
|
|
304
|
+
'chunk',
|
|
305
|
+
'runtimeRequirements',
|
|
306
|
+
'context',
|
|
307
|
+
]),
|
|
308
|
+
runtimeRequirementInTree: new tapable_1.HookMap(() => new tapable_1.SyncBailHook(['chunk', 'runtimeRequirements', 'context'])),
|
|
309
|
+
runtimeModule: new tapable_1.SyncHook(['module', 'chunk']),
|
|
310
|
+
reviveModules: new tapable_1.SyncHook(['modules', 'records']),
|
|
311
|
+
beforeModuleIds: new tapable_1.SyncHook(['modules']),
|
|
312
|
+
moduleIds: new tapable_1.SyncHook(['modules']),
|
|
313
|
+
optimizeModuleIds: new tapable_1.SyncHook(['modules']),
|
|
314
|
+
afterOptimizeModuleIds: new tapable_1.SyncHook(['modules']),
|
|
315
|
+
reviveChunks: new tapable_1.SyncHook(['chunks', 'records']),
|
|
316
|
+
beforeChunkIds: new tapable_1.SyncHook(['chunks']),
|
|
317
|
+
chunkIds: new tapable_1.SyncHook(['chunks']),
|
|
318
|
+
optimizeChunkIds: new tapable_1.SyncHook(['chunks']),
|
|
319
|
+
afterOptimizeChunkIds: new tapable_1.SyncHook(['chunks']),
|
|
320
|
+
recordModules: new tapable_1.SyncHook(['modules', 'records']),
|
|
321
|
+
recordChunks: new tapable_1.SyncHook(['chunks', 'records']),
|
|
322
|
+
optimizeCodeGeneration: new tapable_1.SyncHook(['modules']),
|
|
323
|
+
beforeModuleHash: new tapable_1.SyncHook([]),
|
|
324
|
+
afterModuleHash: new tapable_1.SyncHook([]),
|
|
325
|
+
beforeCodeGeneration: new tapable_1.SyncHook([]),
|
|
326
|
+
afterCodeGeneration: new tapable_1.SyncHook([]),
|
|
327
|
+
beforeRuntimeRequirements: new tapable_1.SyncHook([]),
|
|
328
|
+
afterRuntimeRequirements: new tapable_1.SyncHook([]),
|
|
329
|
+
beforeHash: new tapable_1.SyncHook([]),
|
|
330
|
+
contentHash: new tapable_1.SyncHook(['chunk']),
|
|
331
|
+
afterHash: new tapable_1.SyncHook([]),
|
|
332
|
+
recordHash: new tapable_1.SyncHook(['records']),
|
|
333
|
+
record: new tapable_1.SyncHook(['compilation', 'records']),
|
|
334
|
+
beforeModuleAssets: new tapable_1.SyncHook([]),
|
|
335
|
+
shouldGenerateChunkAssets: new tapable_1.SyncBailHook([]),
|
|
336
|
+
beforeChunkAssets: new tapable_1.SyncHook([]),
|
|
337
|
+
additionalChunkAssets: createProcessAssetsHook('additionalChunkAssets', Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL, () => [this.chunks], 'DEP_WEBPACK_COMPILATION_ADDITIONAL_CHUNK_ASSETS'),
|
|
338
|
+
additionalAssets: createProcessAssetsHook('additionalAssets', Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL, () => []),
|
|
339
|
+
optimizeChunkAssets: createProcessAssetsHook('optimizeChunkAssets', Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE, () => [this.chunks], 'DEP_WEBPACK_COMPILATION_OPTIMIZE_CHUNK_ASSETS'),
|
|
340
|
+
afterOptimizeChunkAssets: createProcessAssetsHook('afterOptimizeChunkAssets', Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE + 1, () => [this.chunks], 'DEP_WEBPACK_COMPILATION_AFTER_OPTIMIZE_CHUNK_ASSETS'),
|
|
341
|
+
optimizeAssets: processAssetsHook,
|
|
342
|
+
afterOptimizeAssets: afterProcessAssetsHook,
|
|
343
|
+
processAssets: processAssetsHook,
|
|
344
|
+
afterProcessAssets: afterProcessAssetsHook,
|
|
345
|
+
processAdditionalAssets: new tapable_1.AsyncSeriesHook(['assets']),
|
|
346
|
+
needAdditionalSeal: new tapable_1.SyncBailHook([]),
|
|
347
|
+
afterSeal: new tapable_1.AsyncSeriesHook([]),
|
|
348
|
+
renderManifest: new tapable_1.SyncWaterfallHook(['result', 'options']),
|
|
349
|
+
fullHash: new tapable_1.SyncHook(['hash']),
|
|
350
|
+
chunkHash: new tapable_1.SyncHook(['chunk', 'chunkHash', 'ChunkHashContext']),
|
|
351
|
+
moduleAsset: new tapable_1.SyncHook(['module', 'filename']),
|
|
352
|
+
chunkAsset: new tapable_1.SyncHook(['chunk', 'filename']),
|
|
353
|
+
assetPath: new tapable_1.SyncWaterfallHook(['path', 'options', 'assetInfo']),
|
|
354
|
+
needAdditionalPass: new tapable_1.SyncBailHook([]),
|
|
355
|
+
childCompiler: new tapable_1.SyncHook([
|
|
356
|
+
'childCompiler',
|
|
357
|
+
'compilerName',
|
|
358
|
+
'compilerIndex',
|
|
359
|
+
]),
|
|
360
|
+
log: new tapable_1.SyncBailHook(['origin', 'logEntry']),
|
|
361
|
+
processWarnings: new tapable_1.SyncWaterfallHook(['warnings']),
|
|
362
|
+
processErrors: new tapable_1.SyncWaterfallHook(['errors']),
|
|
363
|
+
statsPreset: new tapable_1.HookMap(() => new tapable_1.SyncHook(['options', 'context'])),
|
|
364
|
+
statsNormalize: new tapable_1.SyncHook(['options', 'context']),
|
|
365
|
+
statsFactory: new tapable_1.SyncHook(['statsFactory', 'options']),
|
|
366
|
+
statsPrinter: new tapable_1.SyncHook(['statsPrinter', 'options']),
|
|
367
|
+
get normalModuleLoader() {
|
|
368
|
+
return getNormalModuleLoader();
|
|
369
|
+
},
|
|
370
|
+
});
|
|
371
|
+
this.name = undefined;
|
|
372
|
+
this.startTime = undefined;
|
|
373
|
+
this.endTime = undefined;
|
|
374
|
+
this.compiler = compiler;
|
|
375
|
+
this.resolverFactory = compiler.resolverFactory;
|
|
376
|
+
this.inputFileSystem = compiler.inputFileSystem;
|
|
377
|
+
this.fileSystemInfo = new FileSystemInfo_1.FileSystemInfo(this.inputFileSystem, {
|
|
378
|
+
managedPaths: compiler.managedPaths,
|
|
379
|
+
immutablePaths: compiler.immutablePaths,
|
|
380
|
+
logger: this.getLogger('webpack.FileSystemInfo'),
|
|
381
|
+
hashFunction: compiler.options.output.hashFunction,
|
|
382
|
+
});
|
|
383
|
+
if (compiler.fileTimestamps) {
|
|
384
|
+
this.fileSystemInfo.addFileTimestamps(compiler.fileTimestamps, true);
|
|
385
|
+
}
|
|
386
|
+
if (compiler.contextTimestamps) {
|
|
387
|
+
this.fileSystemInfo.addContextTimestamps(compiler.contextTimestamps, true);
|
|
388
|
+
}
|
|
389
|
+
this.valueCacheVersions = new Map();
|
|
390
|
+
this.requestShortener = compiler.requestShortener;
|
|
391
|
+
this.compilerPath = compiler.compilerPath;
|
|
392
|
+
this.logger = this.getLogger('webpack.Compilation');
|
|
393
|
+
const options = compiler.options;
|
|
394
|
+
this.options = options;
|
|
395
|
+
this.outputOptions = options === null || options === void 0 ? void 0 : options.output;
|
|
396
|
+
this.bail = (options === null || options === void 0 ? void 0 : options.bail) || false;
|
|
397
|
+
this.profile = (options === null || options === void 0 ? void 0 : options.profile) || false;
|
|
398
|
+
this.params = params;
|
|
399
|
+
this.mainTemplate = new MainTemplate_1.default(this.outputOptions, this);
|
|
400
|
+
this.chunkTemplate = new ChunkTemplate_1.default(this.outputOptions, this);
|
|
401
|
+
this.runtimeTemplate = new RuntimeTemplate_1.default(this, this.outputOptions, this.requestShortener);
|
|
402
|
+
this.moduleTemplates = {
|
|
403
|
+
javascript: new ModuleTemplate_1.default(this.runtimeTemplate, this),
|
|
404
|
+
};
|
|
405
|
+
defineRemovedModuleTemplates(this.moduleTemplates);
|
|
406
|
+
this.moduleMemCaches = undefined;
|
|
407
|
+
this.moduleMemCaches2 = undefined;
|
|
408
|
+
this.moduleGraph = new ModuleGraph_1.default();
|
|
409
|
+
this.chunkGraph = undefined;
|
|
410
|
+
this.codeGenerationResults = undefined;
|
|
411
|
+
this.processDependenciesQueue = new AsyncQueue_1.default({
|
|
412
|
+
name: 'processDependencies',
|
|
413
|
+
parallelism: options.parallelism || 100,
|
|
414
|
+
processor: this._processModuleDependencies.bind(this),
|
|
415
|
+
});
|
|
416
|
+
this.addModuleQueue = new AsyncQueue_1.default({
|
|
417
|
+
name: 'addModule',
|
|
418
|
+
parent: this.processDependenciesQueue,
|
|
419
|
+
getKey: module => module.identifier(),
|
|
420
|
+
processor: this._addModule.bind(this),
|
|
421
|
+
});
|
|
422
|
+
this.factorizeQueue = new AsyncQueue_1.default({
|
|
423
|
+
name: 'factorize',
|
|
424
|
+
parent: this.addModuleQueue,
|
|
425
|
+
processor: this._factorizeModule.bind(this),
|
|
426
|
+
});
|
|
427
|
+
this.buildQueue = new AsyncQueue_1.default({
|
|
428
|
+
name: 'build',
|
|
429
|
+
parent: this.factorizeQueue,
|
|
430
|
+
processor: this._buildModule.bind(this),
|
|
431
|
+
});
|
|
432
|
+
this.rebuildQueue = new AsyncQueue_1.default({
|
|
433
|
+
name: 'rebuild',
|
|
434
|
+
parallelism: options.parallelism || 100,
|
|
435
|
+
processor: this._rebuildModule.bind(this),
|
|
436
|
+
});
|
|
437
|
+
this.creatingModuleDuringBuild = new WeakMap();
|
|
438
|
+
this.entries = new Map();
|
|
439
|
+
this.globalEntry = {
|
|
440
|
+
dependencies: [],
|
|
441
|
+
includeDependencies: [],
|
|
442
|
+
options: {
|
|
443
|
+
name: undefined,
|
|
444
|
+
},
|
|
445
|
+
};
|
|
446
|
+
this.entrypoints = new Map();
|
|
447
|
+
this.asyncEntrypoints = [];
|
|
448
|
+
this.chunks = new Set();
|
|
449
|
+
this.chunkGroups = [];
|
|
450
|
+
this.namedChunkGroups = new Map();
|
|
451
|
+
this.namedChunks = new Map();
|
|
452
|
+
this.modules = new Set();
|
|
453
|
+
this._modules = new Map();
|
|
454
|
+
this.records = null;
|
|
455
|
+
this.additionalChunkAssets = [];
|
|
456
|
+
this.assets = {};
|
|
457
|
+
this.assetsInfo = new Map();
|
|
458
|
+
this._assetsRelatedIn = new Map();
|
|
459
|
+
this.errors = [];
|
|
460
|
+
this.warnings = [];
|
|
461
|
+
this.children = [];
|
|
462
|
+
this.logging = new Map();
|
|
463
|
+
this.dependencyFactories = new Map();
|
|
464
|
+
this.dependencyTemplates = new DependencyTemplates_1.default(this.outputOptions.hashFunction);
|
|
465
|
+
this.childrenCounters = {};
|
|
466
|
+
this.usedChunkIds = null;
|
|
467
|
+
this.usedModuleIds = null;
|
|
468
|
+
this.needAdditionalPass = false;
|
|
469
|
+
this._restoredUnsafeCacheModuleEntries = new Set();
|
|
470
|
+
this._restoredUnsafeCacheEntries = new Map();
|
|
471
|
+
this.builtModules = new WeakSet();
|
|
472
|
+
this.codeGeneratedModules = new WeakSet();
|
|
473
|
+
this.buildTimeExecutedModules = new WeakSet();
|
|
474
|
+
this._rebuildingModules = new Map();
|
|
475
|
+
this.emittedAssets = new Set();
|
|
476
|
+
this.comparedForEmitAssets = new Set();
|
|
477
|
+
this.fileDependencies = new LazySet_1.default();
|
|
478
|
+
this.contextDependencies = new LazySet_1.default();
|
|
479
|
+
this.missingDependencies = new LazySet_1.default();
|
|
480
|
+
this.buildDependencies = new LazySet_1.default();
|
|
481
|
+
// TODO webpack 6 remove
|
|
482
|
+
this.compilationDependencies = {
|
|
483
|
+
add: util_1.default.deprecate(item => this.fileDependencies.add(item), 'Compilation.compilationDependencies is deprecated (used Compilation.fileDependencies instead)', 'DEP_WEBPACK_COMPILATION_COMPILATION_DEPENDENCIES'),
|
|
484
|
+
};
|
|
485
|
+
this._modulesCache = this.getCache('Compilation/modules');
|
|
486
|
+
this._assetsCache = this.getCache('Compilation/assets');
|
|
487
|
+
this._codeGenerationCache = this.getCache('Compilation/codeGeneration');
|
|
488
|
+
const unsafeCache = options.module.unsafeCache;
|
|
489
|
+
this._unsafeCache = !!unsafeCache;
|
|
490
|
+
this._unsafeCachePredicate = typeof unsafeCache === 'function' ? unsafeCache : () => true;
|
|
491
|
+
}
|
|
492
|
+
getStats() {
|
|
493
|
+
return new Stats_1.default(this);
|
|
494
|
+
}
|
|
495
|
+
createStatsOptions(optionsOrPreset, context = {}) {
|
|
496
|
+
if (typeof optionsOrPreset === 'boolean' || typeof optionsOrPreset === 'string') {
|
|
497
|
+
optionsOrPreset = { preset: optionsOrPreset };
|
|
498
|
+
}
|
|
499
|
+
if (typeof optionsOrPreset === 'object' && optionsOrPreset !== null) {
|
|
500
|
+
// We use this method of shallow cloning this object to include
|
|
501
|
+
// properties in the prototype chain
|
|
502
|
+
const options = {};
|
|
503
|
+
for (const key in optionsOrPreset) {
|
|
504
|
+
options[key] = optionsOrPreset[key];
|
|
505
|
+
}
|
|
506
|
+
if (options.preset !== undefined) {
|
|
507
|
+
this.hooks.statsPreset.for(options.preset).call(options, context);
|
|
508
|
+
}
|
|
509
|
+
this.hooks.statsNormalize.call(options, context);
|
|
510
|
+
return options;
|
|
511
|
+
}
|
|
512
|
+
const options = {};
|
|
513
|
+
this.hooks.statsNormalize.call(options, context);
|
|
514
|
+
return options;
|
|
515
|
+
}
|
|
516
|
+
createStatsFactory(options) {
|
|
517
|
+
const statsFactory = new StatsFactory_1.default();
|
|
518
|
+
this.hooks.statsFactory.call(statsFactory, options);
|
|
519
|
+
return statsFactory;
|
|
520
|
+
}
|
|
521
|
+
createStatsPrinter(options) {
|
|
522
|
+
const statsPrinter = new StatsPrinter_1.default();
|
|
523
|
+
this.hooks.statsPrinter.call(statsPrinter, options);
|
|
524
|
+
return statsPrinter;
|
|
525
|
+
}
|
|
526
|
+
getCache(name) {
|
|
527
|
+
return this.compiler.getCache(name);
|
|
528
|
+
}
|
|
529
|
+
getLogger(name) {
|
|
530
|
+
if (!name) {
|
|
531
|
+
throw new TypeError('Compilation.getLogger(name) called without a name');
|
|
532
|
+
}
|
|
533
|
+
let logEntries;
|
|
534
|
+
return new Logger_1.Logger((type, args) => {
|
|
535
|
+
if (typeof name === 'function') {
|
|
536
|
+
name = name();
|
|
537
|
+
if (!name) {
|
|
538
|
+
throw new TypeError('Compilation.getLogger(name) called with a function not returning a name');
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
let trace;
|
|
542
|
+
switch (type) {
|
|
543
|
+
case Logger_1.LogType.warn:
|
|
544
|
+
case Logger_1.LogType.error:
|
|
545
|
+
case Logger_1.LogType.trace:
|
|
546
|
+
trace = ErrorHelpers.cutOffLoaderExecution(new Error('Trace').stack)
|
|
547
|
+
.split('\n')
|
|
548
|
+
.slice(3);
|
|
549
|
+
break;
|
|
550
|
+
}
|
|
551
|
+
const logEntry = {
|
|
552
|
+
time: Date.now(),
|
|
553
|
+
type,
|
|
554
|
+
args,
|
|
555
|
+
trace,
|
|
556
|
+
};
|
|
557
|
+
if (this.hooks.log.call(name, logEntry) === undefined) {
|
|
558
|
+
if (logEntry.type === Logger_1.LogType.profileEnd) {
|
|
559
|
+
if (typeof console.profileEnd === 'function') {
|
|
560
|
+
console.profileEnd(`[${name}] ${logEntry.args[0]}`);
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
if (logEntries === undefined) {
|
|
564
|
+
logEntries = this.logging.get(name);
|
|
565
|
+
if (logEntries === undefined) {
|
|
566
|
+
logEntries = [];
|
|
567
|
+
this.logging.set(name, logEntries);
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
logEntries.push(logEntry);
|
|
571
|
+
if (logEntry.type === Logger_1.LogType.profile) {
|
|
572
|
+
if (typeof console.profile === 'function') {
|
|
573
|
+
console.profile(`[${name}] ${logEntry.args[0]}`);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
}, childName => {
|
|
578
|
+
if (typeof name === 'function') {
|
|
579
|
+
if (typeof childName === 'function') {
|
|
580
|
+
return this.getLogger(() => {
|
|
581
|
+
if (typeof name === 'function') {
|
|
582
|
+
name = name();
|
|
583
|
+
if (!name) {
|
|
584
|
+
throw new TypeError('Compilation.getLogger(name) called with a function not returning a name');
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
if (typeof childName === 'function') {
|
|
588
|
+
childName = childName();
|
|
589
|
+
if (!childName) {
|
|
590
|
+
throw new TypeError('Logger.getChildLogger(name) called with a function not returning a name');
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
return `${name}/${childName}`;
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
return this.getLogger(() => {
|
|
597
|
+
if (typeof name === 'function') {
|
|
598
|
+
name = name();
|
|
599
|
+
if (!name) {
|
|
600
|
+
throw new TypeError('Compilation.getLogger(name) called with a function not returning a name');
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
return `${name}/${childName}`;
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
if (typeof childName === 'function') {
|
|
607
|
+
return this.getLogger(() => {
|
|
608
|
+
if (typeof childName === 'function') {
|
|
609
|
+
childName = childName();
|
|
610
|
+
if (!childName) {
|
|
611
|
+
throw new TypeError('Logger.getChildLogger(name) called with a function not returning a name');
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
return `${name}/${childName}`;
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
return this.getLogger(`${name}/${childName}`);
|
|
618
|
+
});
|
|
619
|
+
}
|
|
620
|
+
addModule(module, callback) {
|
|
621
|
+
this.addModuleQueue.add(module, callback);
|
|
622
|
+
}
|
|
623
|
+
_addModule(module, callback) {
|
|
624
|
+
const identifier = module.identifier();
|
|
625
|
+
const alreadyAddedModule = this._modules.get(identifier);
|
|
626
|
+
if (alreadyAddedModule) {
|
|
627
|
+
return callback(null, alreadyAddedModule);
|
|
628
|
+
}
|
|
629
|
+
const currentProfile = this.profile ? this.moduleGraph.getProfile(module) : undefined;
|
|
630
|
+
if (currentProfile !== undefined) {
|
|
631
|
+
currentProfile.markRestoringStart();
|
|
632
|
+
}
|
|
633
|
+
this._modulesCache.get(identifier, null, (err, cacheModule) => {
|
|
634
|
+
if (err)
|
|
635
|
+
return callback(new ModuleRestoreError_1.default(module, err));
|
|
636
|
+
if (currentProfile !== undefined) {
|
|
637
|
+
currentProfile.markRestoringEnd();
|
|
638
|
+
currentProfile.markIntegrationStart();
|
|
639
|
+
}
|
|
640
|
+
if (cacheModule) {
|
|
641
|
+
cacheModule.updateCacheModule(module);
|
|
642
|
+
module = cacheModule;
|
|
643
|
+
}
|
|
644
|
+
this._modules.set(identifier, module);
|
|
645
|
+
this.modules.add(module);
|
|
646
|
+
if (this._backCompat)
|
|
647
|
+
ModuleGraph_1.default.setModuleGraphForModule(module, this.moduleGraph);
|
|
648
|
+
if (currentProfile !== undefined) {
|
|
649
|
+
currentProfile.markIntegrationEnd();
|
|
650
|
+
}
|
|
651
|
+
callback(null, module);
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
getModule(module) {
|
|
655
|
+
const identifier = module.identifier();
|
|
656
|
+
return this._modules.get(identifier);
|
|
657
|
+
}
|
|
658
|
+
findModule(identifier) {
|
|
659
|
+
return this._modules.get(identifier);
|
|
660
|
+
}
|
|
661
|
+
buildModule(module, callback) {
|
|
662
|
+
this.buildQueue.add(module, callback);
|
|
663
|
+
}
|
|
664
|
+
_buildModule(module, callback) {
|
|
665
|
+
const currentProfile = this.profile ? this.moduleGraph.getProfile(module) : undefined;
|
|
666
|
+
if (currentProfile !== undefined) {
|
|
667
|
+
currentProfile.markBuildingStart();
|
|
668
|
+
}
|
|
669
|
+
module.needBuild({
|
|
670
|
+
compilation: this,
|
|
671
|
+
fileSystemInfo: this.fileSystemInfo,
|
|
672
|
+
valueCacheVersions: this.valueCacheVersions,
|
|
673
|
+
}, (err, needBuild) => {
|
|
674
|
+
if (err)
|
|
675
|
+
return callback(err);
|
|
676
|
+
if (!needBuild) {
|
|
677
|
+
if (currentProfile !== undefined) {
|
|
678
|
+
currentProfile.markBuildingEnd();
|
|
679
|
+
}
|
|
680
|
+
this.hooks.stillValidModule.call(module);
|
|
681
|
+
return callback();
|
|
682
|
+
}
|
|
683
|
+
this.hooks.buildModule.call(module);
|
|
684
|
+
this.builtModules.add(module);
|
|
685
|
+
module.build(this.options, this, this.resolverFactory.get('normal', module.resolveOptions), this.inputFileSystem, err => {
|
|
686
|
+
if (currentProfile !== undefined) {
|
|
687
|
+
currentProfile.markBuildingEnd();
|
|
688
|
+
}
|
|
689
|
+
if (err) {
|
|
690
|
+
this.hooks.failedModule.call(module, err);
|
|
691
|
+
return callback(err);
|
|
692
|
+
}
|
|
693
|
+
if (currentProfile !== undefined) {
|
|
694
|
+
currentProfile.markStoringStart();
|
|
695
|
+
}
|
|
696
|
+
this._modulesCache.store(module.identifier(), null, module, err => {
|
|
697
|
+
if (currentProfile !== undefined) {
|
|
698
|
+
currentProfile.markStoringEnd();
|
|
699
|
+
}
|
|
700
|
+
if (err) {
|
|
701
|
+
this.hooks.failedModule.call(module, err);
|
|
702
|
+
return callback(new ModuleStoreError_1.default(module, err));
|
|
703
|
+
}
|
|
704
|
+
this.hooks.succeedModule.call(module);
|
|
705
|
+
return callback();
|
|
706
|
+
});
|
|
707
|
+
});
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
processModuleDependencies(module, callback) {
|
|
711
|
+
this.processDependenciesQueue.add(module, callback);
|
|
712
|
+
}
|
|
713
|
+
processModuleDependenciesNonRecursive(module) {
|
|
714
|
+
const processDependenciesBlock = block => {
|
|
715
|
+
if (block.dependencies) {
|
|
716
|
+
let i = 0;
|
|
717
|
+
for (const dep of block.dependencies) {
|
|
718
|
+
this.moduleGraph.setParents(dep, block, module, i++);
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
if (block.blocks) {
|
|
722
|
+
for (const b of block.blocks)
|
|
723
|
+
processDependenciesBlock(b);
|
|
724
|
+
}
|
|
725
|
+
};
|
|
726
|
+
processDependenciesBlock(module);
|
|
727
|
+
}
|
|
728
|
+
_processModuleDependencies(module, callback) {
|
|
729
|
+
const sortedDependencies = [];
|
|
730
|
+
let currentBlock;
|
|
731
|
+
let dependencies;
|
|
732
|
+
let factoryCacheKey;
|
|
733
|
+
let factoryCacheKey2;
|
|
734
|
+
let factoryCacheValue;
|
|
735
|
+
let listCacheKey1;
|
|
736
|
+
let listCacheKey2;
|
|
737
|
+
let listCacheValue;
|
|
738
|
+
let inProgressSorting = 1;
|
|
739
|
+
let inProgressTransitive = 1;
|
|
740
|
+
const onDependenciesSorted = (err) => {
|
|
741
|
+
if (err)
|
|
742
|
+
return callback(err);
|
|
743
|
+
// early exit without changing parallelism back and forth
|
|
744
|
+
if (sortedDependencies.length === 0 && inProgressTransitive === 1) {
|
|
745
|
+
return callback();
|
|
746
|
+
}
|
|
747
|
+
// This is nested so we need to allow one additional task
|
|
748
|
+
this.processDependenciesQueue.increaseParallelism();
|
|
749
|
+
for (const item of sortedDependencies) {
|
|
750
|
+
inProgressTransitive++;
|
|
751
|
+
// eslint-disable-next-line no-loop-func
|
|
752
|
+
this.handleModuleCreation(item, (err) => {
|
|
753
|
+
// In V8, the Error objects keep a reference to the functions on the stack. These warnings &
|
|
754
|
+
// errors are created inside closures that keep a reference to the Compilation, so errors are
|
|
755
|
+
// leaking the Compilation object.
|
|
756
|
+
if (err && this.bail) {
|
|
757
|
+
if (inProgressTransitive <= 0)
|
|
758
|
+
return;
|
|
759
|
+
inProgressTransitive = -1;
|
|
760
|
+
// eslint-disable-next-line no-self-assign
|
|
761
|
+
err.stack = err.stack;
|
|
762
|
+
onTransitiveTasksFinished(err);
|
|
763
|
+
return;
|
|
764
|
+
}
|
|
765
|
+
if (--inProgressTransitive === 0)
|
|
766
|
+
onTransitiveTasksFinished();
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
if (--inProgressTransitive === 0)
|
|
770
|
+
onTransitiveTasksFinished();
|
|
771
|
+
};
|
|
772
|
+
const onTransitiveTasksFinished = (err) => {
|
|
773
|
+
if (err)
|
|
774
|
+
return callback(err);
|
|
775
|
+
this.processDependenciesQueue.decreaseParallelism();
|
|
776
|
+
return callback();
|
|
777
|
+
};
|
|
778
|
+
const processDependency = (dep, index) => {
|
|
779
|
+
this.moduleGraph.setParents(dep, currentBlock, module, index);
|
|
780
|
+
if (this._unsafeCache) {
|
|
781
|
+
try {
|
|
782
|
+
const unsafeCachedModule = unsafeCacheDependencies.get(dep);
|
|
783
|
+
if (unsafeCachedModule === null)
|
|
784
|
+
return;
|
|
785
|
+
if (unsafeCachedModule !== undefined) {
|
|
786
|
+
if (this._restoredUnsafeCacheModuleEntries.has(unsafeCachedModule)) {
|
|
787
|
+
this._handleExistingModuleFromUnsafeCache(module, dep, unsafeCachedModule);
|
|
788
|
+
return;
|
|
789
|
+
}
|
|
790
|
+
const identifier = unsafeCachedModule.identifier();
|
|
791
|
+
const cachedModule = this._restoredUnsafeCacheEntries.get(identifier);
|
|
792
|
+
if (cachedModule !== undefined) {
|
|
793
|
+
// update unsafe cache to new module
|
|
794
|
+
unsafeCacheDependencies.set(dep, cachedModule);
|
|
795
|
+
this._handleExistingModuleFromUnsafeCache(module, dep, cachedModule);
|
|
796
|
+
return;
|
|
797
|
+
}
|
|
798
|
+
inProgressSorting++;
|
|
799
|
+
this._modulesCache.get(identifier, null, (err, cachedModule) => {
|
|
800
|
+
if (err) {
|
|
801
|
+
if (inProgressSorting <= 0)
|
|
802
|
+
return;
|
|
803
|
+
inProgressSorting = -1;
|
|
804
|
+
onDependenciesSorted(err);
|
|
805
|
+
return;
|
|
806
|
+
}
|
|
807
|
+
try {
|
|
808
|
+
if (!this._restoredUnsafeCacheEntries.has(identifier)) {
|
|
809
|
+
const data = unsafeCacheData.get(cachedModule);
|
|
810
|
+
if (data === undefined) {
|
|
811
|
+
processDependencyForResolving(dep);
|
|
812
|
+
if (--inProgressSorting === 0)
|
|
813
|
+
onDependenciesSorted();
|
|
814
|
+
return;
|
|
815
|
+
}
|
|
816
|
+
if (cachedModule !== unsafeCachedModule) {
|
|
817
|
+
unsafeCacheDependencies.set(dep, cachedModule);
|
|
818
|
+
}
|
|
819
|
+
cachedModule.restoreFromUnsafeCache(data, this.params.normalModuleFactory, this.params);
|
|
820
|
+
this._restoredUnsafeCacheEntries.set(identifier, cachedModule);
|
|
821
|
+
this._restoredUnsafeCacheModuleEntries.add(cachedModule);
|
|
822
|
+
if (!this.modules.has(cachedModule)) {
|
|
823
|
+
inProgressTransitive++;
|
|
824
|
+
this._handleNewModuleFromUnsafeCache(module, dep, cachedModule, err => {
|
|
825
|
+
if (err) {
|
|
826
|
+
if (inProgressTransitive <= 0)
|
|
827
|
+
return;
|
|
828
|
+
inProgressTransitive = -1;
|
|
829
|
+
onTransitiveTasksFinished(err);
|
|
830
|
+
}
|
|
831
|
+
if (--inProgressTransitive === 0)
|
|
832
|
+
return onTransitiveTasksFinished();
|
|
833
|
+
});
|
|
834
|
+
if (--inProgressSorting === 0)
|
|
835
|
+
onDependenciesSorted();
|
|
836
|
+
return;
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
if (unsafeCachedModule !== cachedModule) {
|
|
840
|
+
unsafeCacheDependencies.set(dep, cachedModule);
|
|
841
|
+
}
|
|
842
|
+
this._handleExistingModuleFromUnsafeCache(module, dep, cachedModule); // a3
|
|
843
|
+
}
|
|
844
|
+
catch (err) {
|
|
845
|
+
if (inProgressSorting <= 0)
|
|
846
|
+
return;
|
|
847
|
+
inProgressSorting = -1;
|
|
848
|
+
onDependenciesSorted(err);
|
|
849
|
+
return;
|
|
850
|
+
}
|
|
851
|
+
if (--inProgressSorting === 0)
|
|
852
|
+
onDependenciesSorted();
|
|
853
|
+
});
|
|
854
|
+
return;
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
catch (e) {
|
|
858
|
+
console.error(e);
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
processDependencyForResolving(dep);
|
|
862
|
+
};
|
|
863
|
+
const processDependencyForResolving = dep => {
|
|
864
|
+
const resourceIdent = dep.getResourceIdentifier();
|
|
865
|
+
if (resourceIdent !== undefined && resourceIdent !== null) {
|
|
866
|
+
const category = dep.category;
|
|
867
|
+
const constructor = dep.constructor;
|
|
868
|
+
if (factoryCacheKey === constructor) {
|
|
869
|
+
// Fast path 1: same constructor as prev item
|
|
870
|
+
if (listCacheKey1 === category && listCacheKey2 === resourceIdent) {
|
|
871
|
+
// Super fast path 1: also same resource
|
|
872
|
+
listCacheValue.push(dep);
|
|
873
|
+
return;
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
else {
|
|
877
|
+
const factory = this.dependencyFactories.get(constructor);
|
|
878
|
+
if (factory === undefined) {
|
|
879
|
+
throw new Error(`No module factory available for dependency type: ${constructor.name}`);
|
|
880
|
+
}
|
|
881
|
+
if (factoryCacheKey2 === factory) {
|
|
882
|
+
// Fast path 2: same factory as prev item
|
|
883
|
+
factoryCacheKey = constructor;
|
|
884
|
+
if (listCacheKey1 === category && listCacheKey2 === resourceIdent) {
|
|
885
|
+
// Super fast path 2: also same resource
|
|
886
|
+
listCacheValue.push(dep);
|
|
887
|
+
return;
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
else {
|
|
891
|
+
// Slow path
|
|
892
|
+
if (factoryCacheKey2 !== undefined) {
|
|
893
|
+
// Archive last cache entry
|
|
894
|
+
if (dependencies === undefined)
|
|
895
|
+
dependencies = new Map();
|
|
896
|
+
dependencies.set(factoryCacheKey2, factoryCacheValue);
|
|
897
|
+
factoryCacheValue = dependencies.get(factory);
|
|
898
|
+
if (factoryCacheValue === undefined) {
|
|
899
|
+
factoryCacheValue = new Map();
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
else {
|
|
903
|
+
factoryCacheValue = new Map();
|
|
904
|
+
}
|
|
905
|
+
factoryCacheKey = constructor;
|
|
906
|
+
factoryCacheKey2 = factory;
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
// Here webpack is using heuristic that assumes
|
|
910
|
+
// mostly esm dependencies would be used
|
|
911
|
+
// so we don't allocate extra string for them
|
|
912
|
+
const cacheKey = category === esmDependencyCategory ? resourceIdent : `${category}${resourceIdent}`;
|
|
913
|
+
let list = factoryCacheValue.get(cacheKey);
|
|
914
|
+
if (list === undefined) {
|
|
915
|
+
factoryCacheValue.set(cacheKey, (list = []));
|
|
916
|
+
sortedDependencies.push({
|
|
917
|
+
factory: factoryCacheKey2,
|
|
918
|
+
dependencies: list,
|
|
919
|
+
context: dep.getContext(),
|
|
920
|
+
originModule: module,
|
|
921
|
+
});
|
|
922
|
+
}
|
|
923
|
+
list.push(dep);
|
|
924
|
+
listCacheKey1 = category;
|
|
925
|
+
listCacheKey2 = resourceIdent;
|
|
926
|
+
listCacheValue = list;
|
|
927
|
+
}
|
|
928
|
+
};
|
|
929
|
+
try {
|
|
930
|
+
const queue = [module];
|
|
931
|
+
do {
|
|
932
|
+
const block = queue.pop();
|
|
933
|
+
if (block.dependencies) {
|
|
934
|
+
currentBlock = block;
|
|
935
|
+
let i = 0;
|
|
936
|
+
for (const dep of block.dependencies)
|
|
937
|
+
processDependency(dep, i++);
|
|
938
|
+
}
|
|
939
|
+
if (block.blocks) {
|
|
940
|
+
for (const b of block.blocks)
|
|
941
|
+
queue.push(b);
|
|
942
|
+
}
|
|
943
|
+
} while (queue.length !== 0);
|
|
944
|
+
}
|
|
945
|
+
catch (e) {
|
|
946
|
+
return callback(e);
|
|
947
|
+
}
|
|
948
|
+
if (--inProgressSorting === 0)
|
|
949
|
+
onDependenciesSorted();
|
|
950
|
+
}
|
|
951
|
+
_handleNewModuleFromUnsafeCache(originModule, dependency, module, callback) {
|
|
952
|
+
const moduleGraph = this.moduleGraph;
|
|
953
|
+
moduleGraph.setResolvedModule(originModule, dependency, module);
|
|
954
|
+
moduleGraph.setIssuerIfUnset(module, originModule !== undefined ? originModule : null);
|
|
955
|
+
this._modules.set(module.identifier(), module);
|
|
956
|
+
this.modules.add(module);
|
|
957
|
+
if (this._backCompat)
|
|
958
|
+
ModuleGraph_1.default.setModuleGraphForModule(module, this.moduleGraph);
|
|
959
|
+
this._handleModuleBuildAndDependencies(originModule, module, true, callback);
|
|
960
|
+
}
|
|
961
|
+
_handleExistingModuleFromUnsafeCache(originModule, dependency, module) {
|
|
962
|
+
const moduleGraph = this.moduleGraph;
|
|
963
|
+
moduleGraph.setResolvedModule(originModule, dependency, module);
|
|
964
|
+
}
|
|
965
|
+
handleModuleCreation({ factory, dependencies, originModule, contextInfo, context, recursive = true, connectOrigin = recursive, }, callback) {
|
|
966
|
+
const moduleGraph = this.moduleGraph;
|
|
967
|
+
const currentProfile = this.profile ? new ModuleProfile_1.default() : undefined;
|
|
968
|
+
// @ts-ignore
|
|
969
|
+
this.factorizeModule({
|
|
970
|
+
currentProfile,
|
|
971
|
+
factory,
|
|
972
|
+
dependencies,
|
|
973
|
+
factoryResult: true,
|
|
974
|
+
originModule,
|
|
975
|
+
contextInfo,
|
|
976
|
+
context,
|
|
977
|
+
}, (err, factoryResult) => {
|
|
978
|
+
const applyFactoryResultDependencies = () => {
|
|
979
|
+
const { fileDependencies, contextDependencies, missingDependencies } = factoryResult;
|
|
980
|
+
if (fileDependencies) {
|
|
981
|
+
this.fileDependencies.addAll(fileDependencies);
|
|
982
|
+
}
|
|
983
|
+
if (contextDependencies) {
|
|
984
|
+
this.contextDependencies.addAll(contextDependencies);
|
|
985
|
+
}
|
|
986
|
+
if (missingDependencies) {
|
|
987
|
+
this.missingDependencies.addAll(missingDependencies);
|
|
988
|
+
}
|
|
989
|
+
};
|
|
990
|
+
if (err) {
|
|
991
|
+
if (factoryResult)
|
|
992
|
+
applyFactoryResultDependencies();
|
|
993
|
+
if (dependencies.every(d => d.optional)) {
|
|
994
|
+
this.warnings.push(err);
|
|
995
|
+
return callback();
|
|
996
|
+
}
|
|
997
|
+
this.errors.push(err);
|
|
998
|
+
return callback(err);
|
|
999
|
+
}
|
|
1000
|
+
const newModule = factoryResult.module;
|
|
1001
|
+
if (!newModule) {
|
|
1002
|
+
applyFactoryResultDependencies();
|
|
1003
|
+
return callback();
|
|
1004
|
+
}
|
|
1005
|
+
if (currentProfile !== undefined) {
|
|
1006
|
+
moduleGraph.setProfile(newModule, currentProfile);
|
|
1007
|
+
}
|
|
1008
|
+
this.addModule(newModule, (err, module) => {
|
|
1009
|
+
if (err) {
|
|
1010
|
+
applyFactoryResultDependencies();
|
|
1011
|
+
if (!err.module) {
|
|
1012
|
+
err.module = module;
|
|
1013
|
+
}
|
|
1014
|
+
this.errors.push(err);
|
|
1015
|
+
return callback(err);
|
|
1016
|
+
}
|
|
1017
|
+
if (this._unsafeCache &&
|
|
1018
|
+
factoryResult.cacheable !== false &&
|
|
1019
|
+
module.restoreFromUnsafeCache &&
|
|
1020
|
+
this._unsafeCachePredicate(module)) {
|
|
1021
|
+
const unsafeCacheableModule = module;
|
|
1022
|
+
for (let i = 0; i < dependencies.length; i++) {
|
|
1023
|
+
const dependency = dependencies[i];
|
|
1024
|
+
moduleGraph.setResolvedModule(connectOrigin ? originModule : null, dependency, unsafeCacheableModule);
|
|
1025
|
+
unsafeCacheDependencies.set(dependency, unsafeCacheableModule);
|
|
1026
|
+
}
|
|
1027
|
+
if (!unsafeCacheData.has(unsafeCacheableModule)) {
|
|
1028
|
+
unsafeCacheData.set(unsafeCacheableModule, unsafeCacheableModule.getUnsafeCacheData());
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
else {
|
|
1032
|
+
applyFactoryResultDependencies();
|
|
1033
|
+
for (let i = 0; i < dependencies.length; i++) {
|
|
1034
|
+
const dependency = dependencies[i];
|
|
1035
|
+
moduleGraph.setResolvedModule(connectOrigin ? originModule : null, dependency, module);
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
moduleGraph.setIssuerIfUnset(module, originModule !== undefined ? originModule : null);
|
|
1039
|
+
if (module !== newModule) {
|
|
1040
|
+
if (currentProfile !== undefined) {
|
|
1041
|
+
const otherProfile = moduleGraph.getProfile(module);
|
|
1042
|
+
if (otherProfile !== undefined) {
|
|
1043
|
+
currentProfile.mergeInto(otherProfile);
|
|
1044
|
+
}
|
|
1045
|
+
else {
|
|
1046
|
+
moduleGraph.setProfile(module, currentProfile);
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
this._handleModuleBuildAndDependencies(originModule, module, recursive, callback);
|
|
1051
|
+
});
|
|
1052
|
+
});
|
|
1053
|
+
}
|
|
1054
|
+
_handleModuleBuildAndDependencies(originModule, module, recursive, callback) {
|
|
1055
|
+
// Check for cycles when build is trigger inside another build
|
|
1056
|
+
let creatingModuleDuringBuildSet;
|
|
1057
|
+
if (!recursive && this.buildQueue.isProcessing(originModule)) {
|
|
1058
|
+
// Track build dependency
|
|
1059
|
+
creatingModuleDuringBuildSet = this.creatingModuleDuringBuild.get(originModule);
|
|
1060
|
+
if (creatingModuleDuringBuildSet === undefined) {
|
|
1061
|
+
creatingModuleDuringBuildSet = new Set();
|
|
1062
|
+
this.creatingModuleDuringBuild.set(originModule, creatingModuleDuringBuildSet);
|
|
1063
|
+
}
|
|
1064
|
+
creatingModuleDuringBuildSet.add(module);
|
|
1065
|
+
// When building is blocked by another module
|
|
1066
|
+
// search for a cycle, cancel the cycle by throwing
|
|
1067
|
+
// an error (otherwise this would deadlock)
|
|
1068
|
+
const blockReasons = this.creatingModuleDuringBuild.get(module);
|
|
1069
|
+
if (blockReasons !== undefined) {
|
|
1070
|
+
const set = new Set(blockReasons);
|
|
1071
|
+
for (const item of set) {
|
|
1072
|
+
const blockReasons = this.creatingModuleDuringBuild.get(item);
|
|
1073
|
+
if (blockReasons !== undefined) {
|
|
1074
|
+
for (const m of blockReasons) {
|
|
1075
|
+
if (m === module) {
|
|
1076
|
+
return callback(new BuildCycleError_1.default(module));
|
|
1077
|
+
}
|
|
1078
|
+
set.add(m);
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
this.buildModule(module, err => {
|
|
1085
|
+
if (creatingModuleDuringBuildSet !== undefined) {
|
|
1086
|
+
creatingModuleDuringBuildSet.delete(module);
|
|
1087
|
+
}
|
|
1088
|
+
if (err) {
|
|
1089
|
+
if (!err.module) {
|
|
1090
|
+
err.module = module;
|
|
1091
|
+
}
|
|
1092
|
+
this.errors.push(err);
|
|
1093
|
+
return callback(err);
|
|
1094
|
+
}
|
|
1095
|
+
if (!recursive) {
|
|
1096
|
+
this.processModuleDependenciesNonRecursive(module);
|
|
1097
|
+
callback(null, module);
|
|
1098
|
+
return;
|
|
1099
|
+
}
|
|
1100
|
+
// This avoids deadlocks for circular dependencies
|
|
1101
|
+
if (this.processDependenciesQueue.isProcessing(module)) {
|
|
1102
|
+
return callback(null, module);
|
|
1103
|
+
}
|
|
1104
|
+
this.processModuleDependencies(module, err => {
|
|
1105
|
+
if (err) {
|
|
1106
|
+
return callback(err);
|
|
1107
|
+
}
|
|
1108
|
+
callback(null, module);
|
|
1109
|
+
});
|
|
1110
|
+
});
|
|
1111
|
+
}
|
|
1112
|
+
_factorizeModule({ currentProfile, factory, dependencies, originModule, factoryResult, contextInfo, context }, callback) {
|
|
1113
|
+
if (currentProfile !== undefined) {
|
|
1114
|
+
currentProfile.markFactoryStart();
|
|
1115
|
+
}
|
|
1116
|
+
factory.create({
|
|
1117
|
+
contextInfo: Object.assign({ issuer: originModule ? originModule.nameForCondition() : '', issuerLayer: originModule ? originModule.layer : null, compiler: this.compiler.name }, contextInfo),
|
|
1118
|
+
resolveOptions: originModule ? originModule.resolveOptions : undefined,
|
|
1119
|
+
context: context || (originModule ? originModule.context : this.compiler.context),
|
|
1120
|
+
dependencies,
|
|
1121
|
+
}, (err, result) => {
|
|
1122
|
+
if (result) {
|
|
1123
|
+
// TODO webpack 6: remove
|
|
1124
|
+
// For backward-compat
|
|
1125
|
+
if (result.module === undefined && result instanceof Module_1.default) {
|
|
1126
|
+
result = {
|
|
1127
|
+
module: result,
|
|
1128
|
+
};
|
|
1129
|
+
}
|
|
1130
|
+
if (!factoryResult) {
|
|
1131
|
+
const { fileDependencies, contextDependencies, missingDependencies } = result;
|
|
1132
|
+
if (fileDependencies) {
|
|
1133
|
+
this.fileDependencies.addAll(fileDependencies);
|
|
1134
|
+
}
|
|
1135
|
+
if (contextDependencies) {
|
|
1136
|
+
this.contextDependencies.addAll(contextDependencies);
|
|
1137
|
+
}
|
|
1138
|
+
if (missingDependencies) {
|
|
1139
|
+
this.missingDependencies.addAll(missingDependencies);
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
if (err) {
|
|
1144
|
+
const notFoundError = new ModuleNotFoundError_1.default(originModule, err, dependencies.map(d => d.loc).filter(Boolean)[0]);
|
|
1145
|
+
return callback(notFoundError, factoryResult ? result : undefined);
|
|
1146
|
+
}
|
|
1147
|
+
if (!result) {
|
|
1148
|
+
return callback();
|
|
1149
|
+
}
|
|
1150
|
+
if (currentProfile !== undefined) {
|
|
1151
|
+
currentProfile.markFactoryEnd();
|
|
1152
|
+
}
|
|
1153
|
+
callback(null, factoryResult ? result : result.module);
|
|
1154
|
+
});
|
|
1155
|
+
}
|
|
1156
|
+
addModuleChain(context, dependency, callback) {
|
|
1157
|
+
return this.addModuleTree({ context, dependency }, callback);
|
|
1158
|
+
}
|
|
1159
|
+
addModuleTree({ context, dependency, contextInfo, }, callback) {
|
|
1160
|
+
if (typeof dependency !== 'object' || dependency === null || !dependency.constructor) {
|
|
1161
|
+
return callback(new BaseError_1.default("Parameter 'dependency' must be a Dependency"));
|
|
1162
|
+
}
|
|
1163
|
+
const Dep = dependency.constructor;
|
|
1164
|
+
const moduleFactory = this.dependencyFactories.get(Dep);
|
|
1165
|
+
if (!moduleFactory) {
|
|
1166
|
+
return callback(new BaseError_1.default(`No dependency factory available for this dependency type: ${dependency.constructor.name}`));
|
|
1167
|
+
}
|
|
1168
|
+
this.handleModuleCreation({
|
|
1169
|
+
factory: moduleFactory,
|
|
1170
|
+
dependencies: [dependency],
|
|
1171
|
+
originModule: null,
|
|
1172
|
+
contextInfo,
|
|
1173
|
+
context,
|
|
1174
|
+
}, (err, result) => {
|
|
1175
|
+
if (err && this.bail) {
|
|
1176
|
+
callback(err);
|
|
1177
|
+
this.buildQueue.stop();
|
|
1178
|
+
this.rebuildQueue.stop();
|
|
1179
|
+
this.processDependenciesQueue.stop();
|
|
1180
|
+
this.factorizeQueue.stop();
|
|
1181
|
+
}
|
|
1182
|
+
else if (!err && result) {
|
|
1183
|
+
callback(null, result);
|
|
1184
|
+
}
|
|
1185
|
+
else {
|
|
1186
|
+
callback();
|
|
1187
|
+
}
|
|
1188
|
+
});
|
|
1189
|
+
}
|
|
1190
|
+
addEntry(context, entry, optionsOrName, callback) {
|
|
1191
|
+
const options = typeof optionsOrName === 'object' ? optionsOrName : { name: optionsOrName };
|
|
1192
|
+
this._addEntryItem(context, entry, 'dependencies', options, callback);
|
|
1193
|
+
}
|
|
1194
|
+
addInclude(context, dependency, options, callback) {
|
|
1195
|
+
this._addEntryItem(context, dependency, 'includeDependencies', options, callback);
|
|
1196
|
+
}
|
|
1197
|
+
_addEntryItem(context, entry, target, options, callback) {
|
|
1198
|
+
const { name } = options;
|
|
1199
|
+
let entryData = name !== undefined ? this.entries.get(name) : this.globalEntry;
|
|
1200
|
+
if (entryData === undefined) {
|
|
1201
|
+
entryData = {
|
|
1202
|
+
dependencies: [],
|
|
1203
|
+
includeDependencies: [],
|
|
1204
|
+
options: Object.assign({ name: undefined }, options),
|
|
1205
|
+
};
|
|
1206
|
+
entryData[target].push(entry);
|
|
1207
|
+
this.entries.set(name, entryData);
|
|
1208
|
+
}
|
|
1209
|
+
else {
|
|
1210
|
+
entryData[target].push(entry);
|
|
1211
|
+
for (const key of Object.keys(options)) {
|
|
1212
|
+
if (options[key] === undefined)
|
|
1213
|
+
continue;
|
|
1214
|
+
if (entryData.options[key] === options[key])
|
|
1215
|
+
continue;
|
|
1216
|
+
if (Array.isArray(entryData.options[key]) &&
|
|
1217
|
+
Array.isArray(options[key]) &&
|
|
1218
|
+
(0, ArrayHelpers_1.equals)(entryData.options[key], options[key])) {
|
|
1219
|
+
continue;
|
|
1220
|
+
}
|
|
1221
|
+
if (entryData.options[key] === undefined) {
|
|
1222
|
+
entryData.options[key] = options[key];
|
|
1223
|
+
}
|
|
1224
|
+
else {
|
|
1225
|
+
return callback(new BaseError_1.default(`Conflicting entry option ${key} = ${entryData.options[key]} vs ${options[key]}`));
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
this.hooks.addEntry.call(entry, options);
|
|
1230
|
+
this.addModuleTree({
|
|
1231
|
+
context,
|
|
1232
|
+
dependency: entry,
|
|
1233
|
+
contextInfo: entryData.options.layer ? { issuerLayer: entryData.options.layer } : undefined,
|
|
1234
|
+
}, (err, module) => {
|
|
1235
|
+
if (err) {
|
|
1236
|
+
this.hooks.failedEntry.call(entry, options, err);
|
|
1237
|
+
return callback(err);
|
|
1238
|
+
}
|
|
1239
|
+
this.hooks.succeedEntry.call(entry, options, module);
|
|
1240
|
+
return callback(null, module);
|
|
1241
|
+
});
|
|
1242
|
+
}
|
|
1243
|
+
rebuildModule(module, callback) {
|
|
1244
|
+
this.rebuildQueue.add(module, callback);
|
|
1245
|
+
}
|
|
1246
|
+
_rebuildModule(module, callback) {
|
|
1247
|
+
this.hooks.rebuildModule.call(module);
|
|
1248
|
+
const oldDependencies = module.dependencies.slice();
|
|
1249
|
+
const oldBlocks = module.blocks.slice();
|
|
1250
|
+
module.invalidateBuild();
|
|
1251
|
+
this.buildQueue.invalidate(module);
|
|
1252
|
+
this.buildModule(module, err => {
|
|
1253
|
+
if (err) {
|
|
1254
|
+
return this.hooks.finishRebuildingModule.callAsync(module, err2 => {
|
|
1255
|
+
if (err2) {
|
|
1256
|
+
callback((0, HookBaseError_1.makeBaseError)(err2, 'Compilation.hooks.finishRebuildingModule'));
|
|
1257
|
+
return;
|
|
1258
|
+
}
|
|
1259
|
+
callback(err);
|
|
1260
|
+
});
|
|
1261
|
+
}
|
|
1262
|
+
this.processDependenciesQueue.invalidate(module);
|
|
1263
|
+
this.moduleGraph.unfreeze();
|
|
1264
|
+
this.processModuleDependencies(module, err => {
|
|
1265
|
+
if (err)
|
|
1266
|
+
return callback(err);
|
|
1267
|
+
this.removeReasonsOfDependencyBlock(module, {
|
|
1268
|
+
dependencies: oldDependencies,
|
|
1269
|
+
blocks: oldBlocks,
|
|
1270
|
+
});
|
|
1271
|
+
this.hooks.finishRebuildingModule.callAsync(module, err2 => {
|
|
1272
|
+
if (err2) {
|
|
1273
|
+
callback((0, HookBaseError_1.makeBaseError)(err2, 'Compilation.hooks.finishRebuildingModule'));
|
|
1274
|
+
return;
|
|
1275
|
+
}
|
|
1276
|
+
callback(null, module);
|
|
1277
|
+
});
|
|
1278
|
+
});
|
|
1279
|
+
});
|
|
1280
|
+
}
|
|
1281
|
+
_computeAffectedModules(modules) {
|
|
1282
|
+
const moduleMemCacheCache = this.compiler.moduleMemCaches;
|
|
1283
|
+
if (!moduleMemCacheCache)
|
|
1284
|
+
return;
|
|
1285
|
+
if (!this.moduleMemCaches) {
|
|
1286
|
+
this.moduleMemCaches = new Map();
|
|
1287
|
+
this.moduleGraph.setModuleMemCaches(this.moduleMemCaches);
|
|
1288
|
+
}
|
|
1289
|
+
const { moduleGraph, moduleMemCaches } = this;
|
|
1290
|
+
const affectedModules = new Set();
|
|
1291
|
+
const infectedModules = new Set();
|
|
1292
|
+
let statNew = 0;
|
|
1293
|
+
let statChanged = 0;
|
|
1294
|
+
let statUnchanged = 0;
|
|
1295
|
+
let statReferencesChanged = 0;
|
|
1296
|
+
let statWithoutBuild = 0;
|
|
1297
|
+
const computeReferences = module => {
|
|
1298
|
+
let references;
|
|
1299
|
+
for (const connection of moduleGraph.getOutgoingConnections(module)) {
|
|
1300
|
+
const d = connection.dependency;
|
|
1301
|
+
const m = connection.module;
|
|
1302
|
+
if (!d || !m || unsafeCacheDependencies.has(d))
|
|
1303
|
+
continue;
|
|
1304
|
+
if (references === undefined)
|
|
1305
|
+
references = new WeakMap();
|
|
1306
|
+
references.set(d, m);
|
|
1307
|
+
}
|
|
1308
|
+
return references;
|
|
1309
|
+
};
|
|
1310
|
+
const compareReferences = (module, references) => {
|
|
1311
|
+
if (references === undefined)
|
|
1312
|
+
return true;
|
|
1313
|
+
for (const connection of moduleGraph.getOutgoingConnections(module)) {
|
|
1314
|
+
const d = connection.dependency;
|
|
1315
|
+
if (!d)
|
|
1316
|
+
continue;
|
|
1317
|
+
const entry = references.get(d);
|
|
1318
|
+
if (entry === undefined)
|
|
1319
|
+
continue;
|
|
1320
|
+
if (entry !== connection.module)
|
|
1321
|
+
return false;
|
|
1322
|
+
}
|
|
1323
|
+
return true;
|
|
1324
|
+
};
|
|
1325
|
+
const modulesWithoutCache = new Set(modules);
|
|
1326
|
+
for (const [module, cachedMemCache] of moduleMemCacheCache) {
|
|
1327
|
+
if (modulesWithoutCache.has(module)) {
|
|
1328
|
+
const buildInfo = module.buildInfo;
|
|
1329
|
+
if (buildInfo) {
|
|
1330
|
+
if (cachedMemCache.buildInfo !== buildInfo) {
|
|
1331
|
+
// use a new one
|
|
1332
|
+
const memCache = new WeakTupleMap_1.default();
|
|
1333
|
+
moduleMemCaches.set(module, memCache);
|
|
1334
|
+
affectedModules.add(module);
|
|
1335
|
+
cachedMemCache.buildInfo = buildInfo;
|
|
1336
|
+
cachedMemCache.references = computeReferences(module);
|
|
1337
|
+
cachedMemCache.memCache = memCache;
|
|
1338
|
+
statChanged++;
|
|
1339
|
+
}
|
|
1340
|
+
else if (!compareReferences(module, cachedMemCache.references)) {
|
|
1341
|
+
// use a new one
|
|
1342
|
+
const memCache = new WeakTupleMap_1.default();
|
|
1343
|
+
moduleMemCaches.set(module, memCache);
|
|
1344
|
+
affectedModules.add(module);
|
|
1345
|
+
cachedMemCache.references = computeReferences(module);
|
|
1346
|
+
cachedMemCache.memCache = memCache;
|
|
1347
|
+
statReferencesChanged++;
|
|
1348
|
+
}
|
|
1349
|
+
else {
|
|
1350
|
+
// keep the old mem cache
|
|
1351
|
+
moduleMemCaches.set(module, cachedMemCache.memCache);
|
|
1352
|
+
statUnchanged++;
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
else {
|
|
1356
|
+
infectedModules.add(module);
|
|
1357
|
+
moduleMemCacheCache.delete(module);
|
|
1358
|
+
statWithoutBuild++;
|
|
1359
|
+
}
|
|
1360
|
+
modulesWithoutCache.delete(module);
|
|
1361
|
+
}
|
|
1362
|
+
else {
|
|
1363
|
+
moduleMemCacheCache.delete(module);
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
for (const module of modulesWithoutCache) {
|
|
1367
|
+
const buildInfo = module.buildInfo;
|
|
1368
|
+
if (buildInfo) {
|
|
1369
|
+
// create a new entry
|
|
1370
|
+
const memCache = new WeakTupleMap_1.default();
|
|
1371
|
+
moduleMemCacheCache.set(module, {
|
|
1372
|
+
buildInfo,
|
|
1373
|
+
references: computeReferences(module),
|
|
1374
|
+
memCache,
|
|
1375
|
+
});
|
|
1376
|
+
moduleMemCaches.set(module, memCache);
|
|
1377
|
+
affectedModules.add(module);
|
|
1378
|
+
statNew++;
|
|
1379
|
+
}
|
|
1380
|
+
else {
|
|
1381
|
+
infectedModules.add(module);
|
|
1382
|
+
statWithoutBuild++;
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
const reduceAffectType = connections => {
|
|
1386
|
+
let affected = false;
|
|
1387
|
+
for (const { dependency } of connections) {
|
|
1388
|
+
if (!dependency)
|
|
1389
|
+
continue;
|
|
1390
|
+
const type = dependency.couldAffectReferencingModule();
|
|
1391
|
+
if (type === Dependency_1.default.TRANSITIVE)
|
|
1392
|
+
return Dependency_1.default.TRANSITIVE;
|
|
1393
|
+
if (type === false)
|
|
1394
|
+
continue;
|
|
1395
|
+
affected = true;
|
|
1396
|
+
}
|
|
1397
|
+
return affected;
|
|
1398
|
+
};
|
|
1399
|
+
const directOnlyInfectedModules = new Set();
|
|
1400
|
+
for (const module of infectedModules) {
|
|
1401
|
+
for (const [referencingModule, connections,] of moduleGraph.getIncomingConnectionsByOriginModule(module)) {
|
|
1402
|
+
if (!referencingModule)
|
|
1403
|
+
continue;
|
|
1404
|
+
if (infectedModules.has(referencingModule))
|
|
1405
|
+
continue;
|
|
1406
|
+
const type = reduceAffectType(connections);
|
|
1407
|
+
if (!type)
|
|
1408
|
+
continue;
|
|
1409
|
+
if (type === true) {
|
|
1410
|
+
directOnlyInfectedModules.add(referencingModule);
|
|
1411
|
+
}
|
|
1412
|
+
else {
|
|
1413
|
+
infectedModules.add(referencingModule);
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
for (const module of directOnlyInfectedModules)
|
|
1418
|
+
infectedModules.add(module);
|
|
1419
|
+
const directOnlyAffectModules = new Set();
|
|
1420
|
+
for (const module of affectedModules) {
|
|
1421
|
+
for (const [referencingModule, connections,] of moduleGraph.getIncomingConnectionsByOriginModule(module)) {
|
|
1422
|
+
if (!referencingModule)
|
|
1423
|
+
continue;
|
|
1424
|
+
if (infectedModules.has(referencingModule))
|
|
1425
|
+
continue;
|
|
1426
|
+
if (affectedModules.has(referencingModule))
|
|
1427
|
+
continue;
|
|
1428
|
+
const type = reduceAffectType(connections);
|
|
1429
|
+
if (!type)
|
|
1430
|
+
continue;
|
|
1431
|
+
if (type === true) {
|
|
1432
|
+
directOnlyAffectModules.add(referencingModule);
|
|
1433
|
+
}
|
|
1434
|
+
else {
|
|
1435
|
+
affectedModules.add(referencingModule);
|
|
1436
|
+
}
|
|
1437
|
+
const memCache = new WeakTupleMap_1.default();
|
|
1438
|
+
const cache = moduleMemCacheCache.get(referencingModule);
|
|
1439
|
+
cache.memCache = memCache;
|
|
1440
|
+
moduleMemCaches.set(referencingModule, memCache);
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
for (const module of directOnlyAffectModules)
|
|
1444
|
+
affectedModules.add(module);
|
|
1445
|
+
this.logger.log(`${Math.round((100 * (affectedModules.size + infectedModules.size)) / this.modules.size)}% (${affectedModules.size} affected + ${infectedModules.size} infected of ${this.modules.size}) modules flagged as affected (${statNew} new modules, ${statChanged} changed, ${statReferencesChanged} references changed, ${statUnchanged} unchanged, ${statWithoutBuild} were not built)`);
|
|
1446
|
+
}
|
|
1447
|
+
_computeAffectedModulesWithChunkGraph() {
|
|
1448
|
+
const { moduleMemCaches } = this;
|
|
1449
|
+
if (!moduleMemCaches)
|
|
1450
|
+
return;
|
|
1451
|
+
const moduleMemCaches2 = (this.moduleMemCaches2 = new Map());
|
|
1452
|
+
const { moduleGraph, chunkGraph } = this;
|
|
1453
|
+
const key = 'memCache2';
|
|
1454
|
+
let statUnchanged = 0;
|
|
1455
|
+
let statChanged = 0;
|
|
1456
|
+
let statNew = 0;
|
|
1457
|
+
const computeReferences = module => {
|
|
1458
|
+
const id = chunkGraph.getModuleId(module);
|
|
1459
|
+
let modules;
|
|
1460
|
+
let blocks;
|
|
1461
|
+
const outgoing = moduleGraph.getOutgoingConnectionsByModule(module);
|
|
1462
|
+
if (outgoing !== undefined) {
|
|
1463
|
+
for (const m of outgoing.keys()) {
|
|
1464
|
+
if (!m)
|
|
1465
|
+
continue;
|
|
1466
|
+
if (modules === undefined)
|
|
1467
|
+
modules = new Map();
|
|
1468
|
+
modules.set(m, chunkGraph.getModuleId(m));
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
if (module.blocks.length > 0) {
|
|
1472
|
+
blocks = [];
|
|
1473
|
+
const queue = Array.from(module.blocks);
|
|
1474
|
+
for (const block of queue) {
|
|
1475
|
+
const chunkGroup = chunkGraph.getBlockChunkGroup(block);
|
|
1476
|
+
if (chunkGroup) {
|
|
1477
|
+
for (const chunk of chunkGroup.chunks) {
|
|
1478
|
+
blocks.push(chunk.id);
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
else {
|
|
1482
|
+
blocks.push(null);
|
|
1483
|
+
}
|
|
1484
|
+
queue.push.apply(queue, block.blocks);
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
return { id, modules, blocks };
|
|
1488
|
+
};
|
|
1489
|
+
const compareReferences = (module, { id, modules, blocks }) => {
|
|
1490
|
+
if (id !== chunkGraph.getModuleId(module))
|
|
1491
|
+
return false;
|
|
1492
|
+
if (modules !== undefined) {
|
|
1493
|
+
for (const [module, id] of modules) {
|
|
1494
|
+
if (chunkGraph.getModuleId(module) !== id)
|
|
1495
|
+
return false;
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1498
|
+
if (blocks !== undefined) {
|
|
1499
|
+
const queue = Array.from(module.blocks);
|
|
1500
|
+
let i = 0;
|
|
1501
|
+
for (const block of queue) {
|
|
1502
|
+
const chunkGroup = chunkGraph.getBlockChunkGroup(block);
|
|
1503
|
+
if (chunkGroup) {
|
|
1504
|
+
for (const chunk of chunkGroup.chunks) {
|
|
1505
|
+
if (i >= blocks.length || blocks[i++] !== chunk.id)
|
|
1506
|
+
return false;
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
else if (i >= blocks.length || blocks[i++] !== null)
|
|
1510
|
+
return false;
|
|
1511
|
+
queue.push.apply(queue, block.blocks);
|
|
1512
|
+
}
|
|
1513
|
+
if (i !== blocks.length)
|
|
1514
|
+
return false;
|
|
1515
|
+
}
|
|
1516
|
+
return true;
|
|
1517
|
+
};
|
|
1518
|
+
for (const [module, memCache] of moduleMemCaches) {
|
|
1519
|
+
const cache = memCache.get(key);
|
|
1520
|
+
if (cache === undefined) {
|
|
1521
|
+
const memCache2 = new WeakTupleMap_1.default();
|
|
1522
|
+
memCache.set(key, {
|
|
1523
|
+
references: computeReferences(module),
|
|
1524
|
+
memCache: memCache2,
|
|
1525
|
+
});
|
|
1526
|
+
moduleMemCaches2.set(module, memCache2);
|
|
1527
|
+
statNew++;
|
|
1528
|
+
}
|
|
1529
|
+
else if (!compareReferences(module, cache.references)) {
|
|
1530
|
+
const memCache = new WeakTupleMap_1.default();
|
|
1531
|
+
cache.references = computeReferences(module);
|
|
1532
|
+
cache.memCache = memCache;
|
|
1533
|
+
moduleMemCaches2.set(module, memCache);
|
|
1534
|
+
statChanged++;
|
|
1535
|
+
}
|
|
1536
|
+
else {
|
|
1537
|
+
moduleMemCaches2.set(module, cache.memCache);
|
|
1538
|
+
statUnchanged++;
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
this.logger.log(`${Math.round((100 * statChanged) / (statNew + statChanged + statUnchanged))}% modules flagged as affected by chunk graph (${statNew} new modules, ${statChanged} changed, ${statUnchanged} unchanged)`);
|
|
1542
|
+
}
|
|
1543
|
+
finish(callback) {
|
|
1544
|
+
this.factorizeQueue.clear();
|
|
1545
|
+
if (this.profile) {
|
|
1546
|
+
this.logger.time('finish module profiles');
|
|
1547
|
+
const p = new ParallelismFactorCalculator_1.default();
|
|
1548
|
+
const moduleGraph = this.moduleGraph;
|
|
1549
|
+
const modulesWithProfiles = new Map();
|
|
1550
|
+
for (const module of this.modules) {
|
|
1551
|
+
const profile = moduleGraph.getProfile(module);
|
|
1552
|
+
if (!profile)
|
|
1553
|
+
continue;
|
|
1554
|
+
modulesWithProfiles.set(module, profile);
|
|
1555
|
+
p.range(profile.buildingStartTime, profile.buildingEndTime, f => {
|
|
1556
|
+
profile.buildingParallelismFactor = f;
|
|
1557
|
+
});
|
|
1558
|
+
p.range(profile.factoryStartTime, profile.factoryEndTime, f => {
|
|
1559
|
+
profile.factoryParallelismFactor = f;
|
|
1560
|
+
});
|
|
1561
|
+
p.range(profile.integrationStartTime, profile.integrationEndTime, f => {
|
|
1562
|
+
profile.integrationParallelismFactor = f;
|
|
1563
|
+
});
|
|
1564
|
+
p.range(profile.storingStartTime, profile.storingEndTime, f => {
|
|
1565
|
+
profile.storingParallelismFactor = f;
|
|
1566
|
+
});
|
|
1567
|
+
p.range(profile.restoringStartTime, profile.restoringEndTime, f => {
|
|
1568
|
+
profile.restoringParallelismFactor = f;
|
|
1569
|
+
});
|
|
1570
|
+
if (profile.additionalFactoryTimes) {
|
|
1571
|
+
for (const { start, end } of profile.additionalFactoryTimes) {
|
|
1572
|
+
const influence = (end - start) / profile.additionalFactories;
|
|
1573
|
+
p.range(start, end, f => {
|
|
1574
|
+
profile.additionalFactoriesParallelismFactor += f * influence;
|
|
1575
|
+
});
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
p.calculate();
|
|
1580
|
+
const logger = this.getLogger('webpack.Compilation.ModuleProfile');
|
|
1581
|
+
// Avoid coverage problems due indirect changes
|
|
1582
|
+
/* istanbul ignore next */
|
|
1583
|
+
const logByValue = (value, msg) => {
|
|
1584
|
+
if (value > 1000) {
|
|
1585
|
+
logger.error(msg);
|
|
1586
|
+
}
|
|
1587
|
+
else if (value > 500) {
|
|
1588
|
+
logger.warn(msg);
|
|
1589
|
+
}
|
|
1590
|
+
else if (value > 200) {
|
|
1591
|
+
logger.info(msg);
|
|
1592
|
+
}
|
|
1593
|
+
else if (value > 30) {
|
|
1594
|
+
logger.log(msg);
|
|
1595
|
+
}
|
|
1596
|
+
else {
|
|
1597
|
+
logger.debug(msg);
|
|
1598
|
+
}
|
|
1599
|
+
};
|
|
1600
|
+
const logNormalSummary = (category, getDuration, getParallelism) => {
|
|
1601
|
+
let sum = 0;
|
|
1602
|
+
let max = 0;
|
|
1603
|
+
for (const [module, profile] of modulesWithProfiles) {
|
|
1604
|
+
const p = getParallelism(profile);
|
|
1605
|
+
const d = getDuration(profile);
|
|
1606
|
+
if (d === 0 || p === 0)
|
|
1607
|
+
continue;
|
|
1608
|
+
const t = d / p;
|
|
1609
|
+
sum += t;
|
|
1610
|
+
if (t <= 10)
|
|
1611
|
+
continue;
|
|
1612
|
+
logByValue(t, ` | ${Math.round(t)} ms${p >= 1.1 ? ` (parallelism ${Math.round(p * 10) / 10})` : ''} ${category} > ${module.readableIdentifier(this.requestShortener)}`);
|
|
1613
|
+
max = Math.max(max, t);
|
|
1614
|
+
}
|
|
1615
|
+
if (sum <= 10)
|
|
1616
|
+
return;
|
|
1617
|
+
logByValue(Math.max(sum / 10, max), `${Math.round(sum)} ms ${category}`);
|
|
1618
|
+
};
|
|
1619
|
+
const logByLoadersSummary = (category, getDuration, getParallelism) => {
|
|
1620
|
+
const map = new Map();
|
|
1621
|
+
for (const [module, profile] of modulesWithProfiles) {
|
|
1622
|
+
const list = (0, MapHelpers_1.getOrInsert)(map, `${module.type}!${module.identifier().replace(/(!|^)[^!]*$/, '')}`, () => []);
|
|
1623
|
+
list.push({ module, profile });
|
|
1624
|
+
}
|
|
1625
|
+
let sum = 0;
|
|
1626
|
+
let max = 0;
|
|
1627
|
+
for (const [key, modules] of map) {
|
|
1628
|
+
let innerSum = 0;
|
|
1629
|
+
let innerMax = 0;
|
|
1630
|
+
for (const { module, profile } of modules) {
|
|
1631
|
+
const p = getParallelism(profile);
|
|
1632
|
+
const d = getDuration(profile);
|
|
1633
|
+
if (d === 0 || p === 0)
|
|
1634
|
+
continue;
|
|
1635
|
+
const t = d / p;
|
|
1636
|
+
innerSum += t;
|
|
1637
|
+
if (t <= 10)
|
|
1638
|
+
continue;
|
|
1639
|
+
logByValue(t, ` | | ${Math.round(t)} ms${p >= 1.1 ? ` (parallelism ${Math.round(p * 10) / 10})` : ''} ${category} > ${module.readableIdentifier(this.requestShortener)}`);
|
|
1640
|
+
innerMax = Math.max(innerMax, t);
|
|
1641
|
+
}
|
|
1642
|
+
sum += innerSum;
|
|
1643
|
+
if (innerSum <= 10)
|
|
1644
|
+
continue;
|
|
1645
|
+
const idx = key.indexOf('!');
|
|
1646
|
+
const loaders = key.slice(idx + 1);
|
|
1647
|
+
const moduleType = key.slice(0, idx);
|
|
1648
|
+
const t = Math.max(innerSum / 10, innerMax);
|
|
1649
|
+
logByValue(t, ` | ${Math.round(innerSum)} ms ${category} > ${loaders
|
|
1650
|
+
? `${modules.length} x ${moduleType} with ${this.requestShortener.shorten(loaders)}`
|
|
1651
|
+
: `${modules.length} x ${moduleType}`}`);
|
|
1652
|
+
max = Math.max(max, t);
|
|
1653
|
+
}
|
|
1654
|
+
if (sum <= 10)
|
|
1655
|
+
return;
|
|
1656
|
+
logByValue(Math.max(sum / 10, max), `${Math.round(sum)} ms ${category}`);
|
|
1657
|
+
};
|
|
1658
|
+
logNormalSummary('resolve to new modules', p => p.factory, p => p.factoryParallelismFactor);
|
|
1659
|
+
logNormalSummary('resolve to existing modules', p => p.additionalFactories, p => p.additionalFactoriesParallelismFactor);
|
|
1660
|
+
logNormalSummary('integrate modules', p => p.restoring, p => p.restoringParallelismFactor);
|
|
1661
|
+
logByLoadersSummary('build modules', p => p.building, p => p.buildingParallelismFactor);
|
|
1662
|
+
logNormalSummary('store modules', p => p.storing, p => p.storingParallelismFactor);
|
|
1663
|
+
logNormalSummary('restore modules', p => p.restoring, p => p.restoringParallelismFactor);
|
|
1664
|
+
this.logger.timeEnd('finish module profiles');
|
|
1665
|
+
}
|
|
1666
|
+
this.logger.time('compute affected modules');
|
|
1667
|
+
this._computeAffectedModules(this.modules);
|
|
1668
|
+
this.logger.timeEnd('compute affected modules');
|
|
1669
|
+
this.logger.time('finish modules');
|
|
1670
|
+
const { modules, moduleMemCaches } = this;
|
|
1671
|
+
this.hooks.finishModules.callAsync(modules, err => {
|
|
1672
|
+
this.logger.timeEnd('finish modules');
|
|
1673
|
+
if (err)
|
|
1674
|
+
return callback(err);
|
|
1675
|
+
// extract warnings and errors from modules
|
|
1676
|
+
this.moduleGraph.freeze('dependency errors');
|
|
1677
|
+
// TODO keep a cacheToken (= {}) for each module in the graph
|
|
1678
|
+
// create a new one per compilation and flag all updated files
|
|
1679
|
+
// and parents with it
|
|
1680
|
+
this.logger.time('report dependency errors and warnings');
|
|
1681
|
+
for (const module of modules) {
|
|
1682
|
+
// TODO only run for modules with changed cacheToken
|
|
1683
|
+
// global WeakMap<CacheToken, WeakSet<Module>> to keep modules without errors/warnings
|
|
1684
|
+
const memCache = moduleMemCaches === null || moduleMemCaches === void 0 ? void 0 : moduleMemCaches.get(module);
|
|
1685
|
+
if (memCache === null || memCache === void 0 ? void 0 : memCache.get('noWarningsOrErrors'))
|
|
1686
|
+
continue;
|
|
1687
|
+
let hasProblems = this.reportDependencyErrorsAndWarnings(module, [module]);
|
|
1688
|
+
const errors = module.getErrors();
|
|
1689
|
+
if (errors !== undefined) {
|
|
1690
|
+
for (const error of errors) {
|
|
1691
|
+
if (!error.module) {
|
|
1692
|
+
error.module = module;
|
|
1693
|
+
}
|
|
1694
|
+
this.errors.push(error);
|
|
1695
|
+
hasProblems = true;
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
const warnings = module.getWarnings();
|
|
1699
|
+
if (warnings !== undefined) {
|
|
1700
|
+
for (const warning of warnings) {
|
|
1701
|
+
if (!warning.module) {
|
|
1702
|
+
warning.module = module;
|
|
1703
|
+
}
|
|
1704
|
+
this.warnings.push(warning);
|
|
1705
|
+
hasProblems = true;
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1708
|
+
if (!hasProblems && memCache)
|
|
1709
|
+
memCache.set('noWarningsOrErrors', true);
|
|
1710
|
+
}
|
|
1711
|
+
this.moduleGraph.unfreeze();
|
|
1712
|
+
this.logger.timeEnd('report dependency errors and warnings');
|
|
1713
|
+
callback();
|
|
1714
|
+
});
|
|
1715
|
+
}
|
|
1716
|
+
unseal() {
|
|
1717
|
+
this.hooks.unseal.call();
|
|
1718
|
+
this.chunks.clear();
|
|
1719
|
+
this.chunkGroups.length = 0;
|
|
1720
|
+
this.namedChunks.clear();
|
|
1721
|
+
this.namedChunkGroups.clear();
|
|
1722
|
+
this.entrypoints.clear();
|
|
1723
|
+
this.additionalChunkAssets.length = 0;
|
|
1724
|
+
this.assets = {};
|
|
1725
|
+
this.assetsInfo.clear();
|
|
1726
|
+
this.moduleGraph.removeAllModuleAttributes();
|
|
1727
|
+
this.moduleGraph.unfreeze();
|
|
1728
|
+
this.moduleMemCaches2 = undefined;
|
|
1729
|
+
}
|
|
1730
|
+
seal(callback) {
|
|
1731
|
+
const finalCallback = (err) => {
|
|
1732
|
+
this.factorizeQueue.clear();
|
|
1733
|
+
this.buildQueue.clear();
|
|
1734
|
+
this.rebuildQueue.clear();
|
|
1735
|
+
this.processDependenciesQueue.clear();
|
|
1736
|
+
this.addModuleQueue.clear();
|
|
1737
|
+
return callback(err);
|
|
1738
|
+
};
|
|
1739
|
+
const chunkGraph = new ChunkGraph_1.default(this.moduleGraph, this.outputOptions.hashFunction);
|
|
1740
|
+
this.chunkGraph = chunkGraph;
|
|
1741
|
+
if (this._backCompat) {
|
|
1742
|
+
for (const module of this.modules) {
|
|
1743
|
+
ChunkGraph_1.default.setChunkGraphForModule(module, chunkGraph);
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
this.hooks.seal.call();
|
|
1747
|
+
this.logger.time('optimize dependencies');
|
|
1748
|
+
while (this.hooks.optimizeDependencies.call(this.modules)) {
|
|
1749
|
+
/* empty */
|
|
1750
|
+
}
|
|
1751
|
+
this.hooks.afterOptimizeDependencies.call(this.modules);
|
|
1752
|
+
this.logger.timeEnd('optimize dependencies');
|
|
1753
|
+
this.logger.time('create chunks');
|
|
1754
|
+
this.hooks.beforeChunks.call();
|
|
1755
|
+
this.moduleGraph.freeze('seal');
|
|
1756
|
+
const chunkGraphInit = new Map();
|
|
1757
|
+
for (const [name, { dependencies, includeDependencies, options }] of this.entries) {
|
|
1758
|
+
const chunk = this.addChunk(name);
|
|
1759
|
+
if (options.filename) {
|
|
1760
|
+
chunk.filenameTemplate = options.filename;
|
|
1761
|
+
}
|
|
1762
|
+
const entrypoint = new Entrypoint_1.default(options);
|
|
1763
|
+
if (!options.dependOn && !options.runtime) {
|
|
1764
|
+
entrypoint.setRuntimeChunk(chunk);
|
|
1765
|
+
}
|
|
1766
|
+
entrypoint.setEntrypointChunk(chunk);
|
|
1767
|
+
this.namedChunkGroups.set(name, entrypoint);
|
|
1768
|
+
this.entrypoints.set(name, entrypoint);
|
|
1769
|
+
this.chunkGroups.push(entrypoint);
|
|
1770
|
+
(0, GraphHelpers_1.connectChunkGroupAndChunk)(entrypoint, chunk);
|
|
1771
|
+
const entryModules = new Set();
|
|
1772
|
+
for (const dep of [...this.globalEntry.dependencies, ...dependencies]) {
|
|
1773
|
+
entrypoint.addOrigin(null, { name }, dep.request);
|
|
1774
|
+
const module = this.moduleGraph.getModule(dep);
|
|
1775
|
+
if (module) {
|
|
1776
|
+
chunkGraph.connectChunkAndEntryModule(chunk, module, entrypoint);
|
|
1777
|
+
entryModules.add(module);
|
|
1778
|
+
const modulesList = chunkGraphInit.get(entrypoint);
|
|
1779
|
+
if (modulesList === undefined) {
|
|
1780
|
+
chunkGraphInit.set(entrypoint, [module]);
|
|
1781
|
+
}
|
|
1782
|
+
else {
|
|
1783
|
+
modulesList.push(module);
|
|
1784
|
+
}
|
|
1785
|
+
}
|
|
1786
|
+
}
|
|
1787
|
+
this.assignDepths(entryModules);
|
|
1788
|
+
const mapAndSort = deps => deps
|
|
1789
|
+
.map(dep => this.moduleGraph.getModule(dep))
|
|
1790
|
+
.filter(Boolean)
|
|
1791
|
+
.sort(comparators_1.compareModulesByIdentifier);
|
|
1792
|
+
const includedModules = [
|
|
1793
|
+
...mapAndSort(this.globalEntry.includeDependencies),
|
|
1794
|
+
...mapAndSort(includeDependencies),
|
|
1795
|
+
];
|
|
1796
|
+
let modulesList = chunkGraphInit.get(entrypoint);
|
|
1797
|
+
if (modulesList === undefined) {
|
|
1798
|
+
chunkGraphInit.set(entrypoint, (modulesList = []));
|
|
1799
|
+
}
|
|
1800
|
+
for (const module of includedModules) {
|
|
1801
|
+
this.assignDepth(module);
|
|
1802
|
+
modulesList.push(module);
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
const runtimeChunks = new Set();
|
|
1806
|
+
outer: for (const [name, { options: { dependOn, runtime }, },] of this.entries) {
|
|
1807
|
+
if (dependOn && runtime) {
|
|
1808
|
+
const err = new BaseError_1.default(`Entrypoint '${name}' has 'dependOn' and 'runtime' specified. This is not valid.
|
|
1809
|
+
Entrypoints that depend on other entrypoints do not have their own runtime.
|
|
1810
|
+
They will use the runtime(s) from referenced entrypoints instead.
|
|
1811
|
+
Remove the 'runtime' option from the entrypoint.`);
|
|
1812
|
+
const entry = this.entrypoints.get(name);
|
|
1813
|
+
err.chunk = entry.getEntrypointChunk();
|
|
1814
|
+
this.errors.push(err);
|
|
1815
|
+
}
|
|
1816
|
+
if (dependOn) {
|
|
1817
|
+
const entry = this.entrypoints.get(name);
|
|
1818
|
+
const referencedChunks = entry.getEntrypointChunk().getAllReferencedChunks();
|
|
1819
|
+
const dependOnEntries = [];
|
|
1820
|
+
for (const dep of dependOn) {
|
|
1821
|
+
const dependency = this.entrypoints.get(dep);
|
|
1822
|
+
if (!dependency) {
|
|
1823
|
+
throw new Error(`Entry ${name} depends on ${dep}, but this entry was not found`);
|
|
1824
|
+
}
|
|
1825
|
+
if (referencedChunks.has(dependency.getEntrypointChunk())) {
|
|
1826
|
+
const err = new BaseError_1.default(`Entrypoints '${name}' and '${dep}' use 'dependOn' to depend on each other in a circular way.`);
|
|
1827
|
+
const entryChunk = entry.getEntrypointChunk();
|
|
1828
|
+
err.chunk = entryChunk;
|
|
1829
|
+
this.errors.push(err);
|
|
1830
|
+
entry.setRuntimeChunk(entryChunk);
|
|
1831
|
+
continue outer;
|
|
1832
|
+
}
|
|
1833
|
+
dependOnEntries.push(dependency);
|
|
1834
|
+
}
|
|
1835
|
+
for (const dependency of dependOnEntries) {
|
|
1836
|
+
(0, GraphHelpers_1.connectChunkGroupParentAndChild)(dependency, entry);
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
else if (runtime) {
|
|
1840
|
+
const entry = this.entrypoints.get(name);
|
|
1841
|
+
let chunk = this.namedChunks.get(runtime);
|
|
1842
|
+
if (chunk) {
|
|
1843
|
+
if (!runtimeChunks.has(chunk)) {
|
|
1844
|
+
const err = new BaseError_1.default(`Entrypoint '${name}' has a 'runtime' option which points to another entrypoint named '${runtime}'.
|
|
1845
|
+
It's not valid to use other entrypoints as runtime chunk.
|
|
1846
|
+
Did you mean to use 'dependOn: ${JSON.stringify(runtime)}' instead to allow using entrypoint '${name}' within the runtime of entrypoint '${runtime}'? For this '${runtime}' must always be loaded when '${name}' is used.
|
|
1847
|
+
Or do you want to use the entrypoints '${name}' and '${runtime}' independently on the same page with a shared runtime? In this case give them both the same value for the 'runtime' option. It must be a name not already used by an entrypoint.`);
|
|
1848
|
+
const entryChunk = entry.getEntrypointChunk();
|
|
1849
|
+
err.chunk = entryChunk;
|
|
1850
|
+
this.errors.push(err);
|
|
1851
|
+
entry.setRuntimeChunk(entryChunk);
|
|
1852
|
+
continue;
|
|
1853
|
+
}
|
|
1854
|
+
}
|
|
1855
|
+
else {
|
|
1856
|
+
chunk = this.addChunk(runtime);
|
|
1857
|
+
chunk.preventIntegration = true;
|
|
1858
|
+
runtimeChunks.add(chunk);
|
|
1859
|
+
}
|
|
1860
|
+
entry.unshiftChunk(chunk);
|
|
1861
|
+
chunk.addGroup(entry);
|
|
1862
|
+
entry.setRuntimeChunk(chunk);
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
(0, buildChunkGraph_1.default)(this, chunkGraphInit);
|
|
1866
|
+
this.hooks.afterChunks.call(this.chunks);
|
|
1867
|
+
this.logger.timeEnd('create chunks');
|
|
1868
|
+
this.logger.time('optimize');
|
|
1869
|
+
this.hooks.optimize.call();
|
|
1870
|
+
while (this.hooks.optimizeModules.call(this.modules)) {
|
|
1871
|
+
/* empty */
|
|
1872
|
+
}
|
|
1873
|
+
this.hooks.afterOptimizeModules.call(this.modules);
|
|
1874
|
+
while (this.hooks.optimizeChunks.call(this.chunks, this.chunkGroups)) {
|
|
1875
|
+
/* empty */
|
|
1876
|
+
}
|
|
1877
|
+
this.hooks.afterOptimizeChunks.call(this.chunks, this.chunkGroups);
|
|
1878
|
+
this.hooks.optimizeTree.callAsync(this.chunks, this.modules, err => {
|
|
1879
|
+
if (err) {
|
|
1880
|
+
return finalCallback((0, HookBaseError_1.makeBaseError)(err, 'Compilation.hooks.optimizeTree'));
|
|
1881
|
+
}
|
|
1882
|
+
this.hooks.afterOptimizeTree.call(this.chunks, this.modules);
|
|
1883
|
+
this.hooks.optimizeChunkModules.callAsync(this.chunks, this.modules, err => {
|
|
1884
|
+
if (err) {
|
|
1885
|
+
return finalCallback((0, HookBaseError_1.makeBaseError)(err, 'Compilation.hooks.optimizeChunkModules'));
|
|
1886
|
+
}
|
|
1887
|
+
this.hooks.afterOptimizeChunkModules.call(this.chunks, this.modules);
|
|
1888
|
+
const shouldRecord = this.hooks.shouldRecord.call() !== false;
|
|
1889
|
+
this.hooks.reviveModules.call(this.modules, this.records);
|
|
1890
|
+
this.hooks.beforeModuleIds.call(this.modules);
|
|
1891
|
+
this.hooks.moduleIds.call(this.modules);
|
|
1892
|
+
this.hooks.optimizeModuleIds.call(this.modules);
|
|
1893
|
+
this.hooks.afterOptimizeModuleIds.call(this.modules);
|
|
1894
|
+
this.hooks.reviveChunks.call(this.chunks, this.records);
|
|
1895
|
+
this.hooks.beforeChunkIds.call(this.chunks);
|
|
1896
|
+
this.hooks.chunkIds.call(this.chunks);
|
|
1897
|
+
this.hooks.optimizeChunkIds.call(this.chunks);
|
|
1898
|
+
this.hooks.afterOptimizeChunkIds.call(this.chunks);
|
|
1899
|
+
this.assignRuntimeIds();
|
|
1900
|
+
this.logger.time('compute affected modules with chunk graph');
|
|
1901
|
+
this._computeAffectedModulesWithChunkGraph();
|
|
1902
|
+
this.logger.timeEnd('compute affected modules with chunk graph');
|
|
1903
|
+
this.sortItemsWithChunkIds();
|
|
1904
|
+
if (shouldRecord) {
|
|
1905
|
+
this.hooks.recordModules.call(this.modules, this.records);
|
|
1906
|
+
this.hooks.recordChunks.call(this.chunks, this.records);
|
|
1907
|
+
}
|
|
1908
|
+
this.hooks.optimizeCodeGeneration.call(this.modules);
|
|
1909
|
+
this.logger.timeEnd('optimize');
|
|
1910
|
+
this.logger.time('module hashing');
|
|
1911
|
+
this.hooks.beforeModuleHash.call();
|
|
1912
|
+
this.createModuleHashes();
|
|
1913
|
+
this.hooks.afterModuleHash.call();
|
|
1914
|
+
this.logger.timeEnd('module hashing');
|
|
1915
|
+
this.logger.time('code generation');
|
|
1916
|
+
this.hooks.beforeCodeGeneration.call();
|
|
1917
|
+
this.codeGeneration(err => {
|
|
1918
|
+
if (err) {
|
|
1919
|
+
return finalCallback(err);
|
|
1920
|
+
}
|
|
1921
|
+
this.hooks.afterCodeGeneration.call();
|
|
1922
|
+
this.logger.timeEnd('code generation');
|
|
1923
|
+
this.logger.time('runtime requirements');
|
|
1924
|
+
this.hooks.beforeRuntimeRequirements.call();
|
|
1925
|
+
this.processRuntimeRequirements();
|
|
1926
|
+
this.hooks.afterRuntimeRequirements.call();
|
|
1927
|
+
this.logger.timeEnd('runtime requirements');
|
|
1928
|
+
this.logger.time('hashing');
|
|
1929
|
+
this.hooks.beforeHash.call();
|
|
1930
|
+
const codeGenerationJobs = this.createHash();
|
|
1931
|
+
this.hooks.afterHash.call();
|
|
1932
|
+
this.logger.timeEnd('hashing');
|
|
1933
|
+
this._runCodeGenerationJobs(codeGenerationJobs, err => {
|
|
1934
|
+
if (err) {
|
|
1935
|
+
return finalCallback(err);
|
|
1936
|
+
}
|
|
1937
|
+
if (shouldRecord) {
|
|
1938
|
+
this.logger.time('record hash');
|
|
1939
|
+
this.hooks.recordHash.call(this.records);
|
|
1940
|
+
this.logger.timeEnd('record hash');
|
|
1941
|
+
}
|
|
1942
|
+
this.logger.time('module assets');
|
|
1943
|
+
this.clearAssets();
|
|
1944
|
+
this.hooks.beforeModuleAssets.call();
|
|
1945
|
+
this.createModuleAssets();
|
|
1946
|
+
this.logger.timeEnd('module assets');
|
|
1947
|
+
const cont = () => {
|
|
1948
|
+
this.logger.time('process assets');
|
|
1949
|
+
this.hooks.processAssets.callAsync(this.assets, err => {
|
|
1950
|
+
if (err) {
|
|
1951
|
+
return finalCallback((0, HookBaseError_1.makeBaseError)(err, 'Compilation.hooks.processAssets'));
|
|
1952
|
+
}
|
|
1953
|
+
this.hooks.afterProcessAssets.call(this.assets);
|
|
1954
|
+
this.logger.timeEnd('process assets');
|
|
1955
|
+
// this.assets = Object.freeze(this.assets)
|
|
1956
|
+
this.summarizeDependencies();
|
|
1957
|
+
if (shouldRecord) {
|
|
1958
|
+
this.hooks.record.call(this, this.records);
|
|
1959
|
+
}
|
|
1960
|
+
if (this.hooks.needAdditionalSeal.call()) {
|
|
1961
|
+
this.unseal();
|
|
1962
|
+
return this.seal(callback);
|
|
1963
|
+
}
|
|
1964
|
+
return this.hooks.afterSeal.callAsync(err => {
|
|
1965
|
+
if (err) {
|
|
1966
|
+
return finalCallback((0, HookBaseError_1.makeBaseError)(err, 'Compilation.hooks.afterSeal'));
|
|
1967
|
+
}
|
|
1968
|
+
this.fileSystemInfo.logStatistics();
|
|
1969
|
+
finalCallback();
|
|
1970
|
+
});
|
|
1971
|
+
});
|
|
1972
|
+
};
|
|
1973
|
+
this.logger.time('create chunk assets');
|
|
1974
|
+
if (this.hooks.shouldGenerateChunkAssets.call() !== false) {
|
|
1975
|
+
this.hooks.beforeChunkAssets.call();
|
|
1976
|
+
this.createChunkAssets(err => {
|
|
1977
|
+
this.logger.timeEnd('create chunk assets');
|
|
1978
|
+
if (err) {
|
|
1979
|
+
return finalCallback(err);
|
|
1980
|
+
}
|
|
1981
|
+
cont();
|
|
1982
|
+
});
|
|
1983
|
+
}
|
|
1984
|
+
else {
|
|
1985
|
+
this.logger.timeEnd('create chunk assets');
|
|
1986
|
+
cont();
|
|
1987
|
+
}
|
|
1988
|
+
});
|
|
1989
|
+
});
|
|
1990
|
+
});
|
|
1991
|
+
});
|
|
1992
|
+
}
|
|
1993
|
+
reportDependencyErrorsAndWarnings(module, blocks) {
|
|
1994
|
+
let hasProblems = false;
|
|
1995
|
+
for (let indexBlock = 0; indexBlock < blocks.length; indexBlock++) {
|
|
1996
|
+
const block = blocks[indexBlock];
|
|
1997
|
+
const dependencies = block.dependencies;
|
|
1998
|
+
for (let indexDep = 0; indexDep < dependencies.length; indexDep++) {
|
|
1999
|
+
const d = dependencies[indexDep];
|
|
2000
|
+
const warnings = d.getWarnings(this.moduleGraph);
|
|
2001
|
+
if (warnings) {
|
|
2002
|
+
for (let indexWar = 0; indexWar < warnings.length; indexWar++) {
|
|
2003
|
+
const w = warnings[indexWar];
|
|
2004
|
+
const warning = new ModuleDependencyWarning_1.default(module, w, d.loc);
|
|
2005
|
+
this.warnings.push(warning);
|
|
2006
|
+
hasProblems = true;
|
|
2007
|
+
}
|
|
2008
|
+
}
|
|
2009
|
+
const errors = d.getErrors(this.moduleGraph);
|
|
2010
|
+
if (errors) {
|
|
2011
|
+
for (let indexErr = 0; indexErr < errors.length; indexErr++) {
|
|
2012
|
+
const e = errors[indexErr];
|
|
2013
|
+
const error = new ModuleDependencyError_1.default(module, e, d.loc);
|
|
2014
|
+
this.errors.push(error);
|
|
2015
|
+
hasProblems = true;
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
2018
|
+
}
|
|
2019
|
+
if (this.reportDependencyErrorsAndWarnings(module, block.blocks))
|
|
2020
|
+
hasProblems = true;
|
|
2021
|
+
}
|
|
2022
|
+
return hasProblems;
|
|
2023
|
+
}
|
|
2024
|
+
codeGeneration(callback) {
|
|
2025
|
+
const { chunkGraph } = this;
|
|
2026
|
+
this.codeGenerationResults = new CodeGenerationResults_1.default(this.outputOptions.hashFunction);
|
|
2027
|
+
const jobs = [];
|
|
2028
|
+
for (const module of this.modules) {
|
|
2029
|
+
const runtimes = chunkGraph.getModuleRuntimes(module);
|
|
2030
|
+
if (runtimes.size === 1) {
|
|
2031
|
+
for (const runtime of runtimes) {
|
|
2032
|
+
const hash = chunkGraph.getModuleHash(module, runtime);
|
|
2033
|
+
jobs.push({ module, hash, runtime, runtimes: [runtime] });
|
|
2034
|
+
}
|
|
2035
|
+
}
|
|
2036
|
+
else if (runtimes.size > 1) {
|
|
2037
|
+
const map = new Map();
|
|
2038
|
+
for (const runtime of runtimes) {
|
|
2039
|
+
const hash = chunkGraph.getModuleHash(module, runtime);
|
|
2040
|
+
const job = map.get(hash);
|
|
2041
|
+
if (job === undefined) {
|
|
2042
|
+
const newJob = { module, hash, runtime, runtimes: [runtime] };
|
|
2043
|
+
jobs.push(newJob);
|
|
2044
|
+
map.set(hash, newJob);
|
|
2045
|
+
}
|
|
2046
|
+
else {
|
|
2047
|
+
job.runtimes.push(runtime);
|
|
2048
|
+
}
|
|
2049
|
+
}
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
2052
|
+
this._runCodeGenerationJobs(jobs, callback);
|
|
2053
|
+
}
|
|
2054
|
+
_runCodeGenerationJobs(jobs, callback) {
|
|
2055
|
+
if (jobs.length === 0) {
|
|
2056
|
+
return callback();
|
|
2057
|
+
}
|
|
2058
|
+
let statModulesFromCache = 0;
|
|
2059
|
+
let statModulesGenerated = 0;
|
|
2060
|
+
const { chunkGraph, moduleGraph, dependencyTemplates, runtimeTemplate } = this;
|
|
2061
|
+
const results = this.codeGenerationResults;
|
|
2062
|
+
const errors = [];
|
|
2063
|
+
let notCodeGeneratedModules;
|
|
2064
|
+
const runIteration = () => {
|
|
2065
|
+
let delayedJobs = [];
|
|
2066
|
+
let delayedModules = new Set();
|
|
2067
|
+
neo_async_1.default.eachLimit(jobs, this.options.parallelism, (job, callback) => {
|
|
2068
|
+
const { module } = job;
|
|
2069
|
+
const { codeGenerationDependencies } = module;
|
|
2070
|
+
if (codeGenerationDependencies !== undefined) {
|
|
2071
|
+
if (notCodeGeneratedModules === undefined ||
|
|
2072
|
+
codeGenerationDependencies.some(dep => {
|
|
2073
|
+
const referencedModule = moduleGraph.getModule(dep);
|
|
2074
|
+
return notCodeGeneratedModules.has(referencedModule);
|
|
2075
|
+
})) {
|
|
2076
|
+
delayedJobs.push(job);
|
|
2077
|
+
delayedModules.add(module);
|
|
2078
|
+
return callback();
|
|
2079
|
+
}
|
|
2080
|
+
}
|
|
2081
|
+
const { hash, runtime, runtimes } = job;
|
|
2082
|
+
this._codeGenerationModule(module, runtime, runtimes, hash, dependencyTemplates, chunkGraph, moduleGraph, runtimeTemplate, errors, results, (err, codeGenerated) => {
|
|
2083
|
+
if (codeGenerated)
|
|
2084
|
+
statModulesGenerated++;
|
|
2085
|
+
else
|
|
2086
|
+
statModulesFromCache++;
|
|
2087
|
+
callback(err);
|
|
2088
|
+
});
|
|
2089
|
+
}, err => {
|
|
2090
|
+
if (err)
|
|
2091
|
+
return callback(err);
|
|
2092
|
+
if (delayedJobs.length > 0) {
|
|
2093
|
+
if (delayedJobs.length === jobs.length) {
|
|
2094
|
+
return callback(new Error(`Unable to make progress during code generation because of circular code generation dependency: ${Array.from(delayedModules, (m) => m.identifier()).join(', ')}`));
|
|
2095
|
+
}
|
|
2096
|
+
jobs = delayedJobs;
|
|
2097
|
+
delayedJobs = [];
|
|
2098
|
+
notCodeGeneratedModules = delayedModules;
|
|
2099
|
+
delayedModules = new Set();
|
|
2100
|
+
return runIteration();
|
|
2101
|
+
}
|
|
2102
|
+
if (errors.length > 0) {
|
|
2103
|
+
errors.sort((0, comparators_1.compareSelect)(err => err.module, comparators_1.compareModulesByIdentifier));
|
|
2104
|
+
for (const error of errors) {
|
|
2105
|
+
this.errors.push(error);
|
|
2106
|
+
}
|
|
2107
|
+
}
|
|
2108
|
+
this.logger.log(`${Math.round((100 * statModulesGenerated) / (statModulesGenerated + statModulesFromCache))}% code generated (${statModulesGenerated} generated, ${statModulesFromCache} from cache)`);
|
|
2109
|
+
callback();
|
|
2110
|
+
});
|
|
2111
|
+
};
|
|
2112
|
+
runIteration();
|
|
2113
|
+
}
|
|
2114
|
+
_codeGenerationModule(module, runtime, runtimes, hash, dependencyTemplates, chunkGraph, moduleGraph, runtimeTemplate, errors, results, callback) {
|
|
2115
|
+
let codeGenerated = false;
|
|
2116
|
+
const cache = new CacheFacade_1.MultiItemCache(runtimes.map(runtime => this._codeGenerationCache.getItemCache(`${module.identifier()}|${(0, RuntimeHelpers_1.getRuntimeKey)(runtime)}`, `${hash}|${dependencyTemplates.getHash()}`)));
|
|
2117
|
+
cache.get((err, cachedResult) => {
|
|
2118
|
+
if (err)
|
|
2119
|
+
return callback(err);
|
|
2120
|
+
let result;
|
|
2121
|
+
if (!cachedResult) {
|
|
2122
|
+
try {
|
|
2123
|
+
codeGenerated = true;
|
|
2124
|
+
this.codeGeneratedModules.add(module);
|
|
2125
|
+
result = module.codeGeneration({
|
|
2126
|
+
chunkGraph,
|
|
2127
|
+
moduleGraph,
|
|
2128
|
+
dependencyTemplates,
|
|
2129
|
+
runtimeTemplate,
|
|
2130
|
+
runtime,
|
|
2131
|
+
codeGenerationResults: results,
|
|
2132
|
+
compilation: this,
|
|
2133
|
+
});
|
|
2134
|
+
}
|
|
2135
|
+
catch (err) {
|
|
2136
|
+
errors.push(new CodeGenerationError_1.default(module, err));
|
|
2137
|
+
result = cachedResult = {
|
|
2138
|
+
sources: new Map(),
|
|
2139
|
+
runtimeRequirements: null,
|
|
2140
|
+
};
|
|
2141
|
+
}
|
|
2142
|
+
}
|
|
2143
|
+
else {
|
|
2144
|
+
result = cachedResult;
|
|
2145
|
+
}
|
|
2146
|
+
for (const runtime of runtimes) {
|
|
2147
|
+
results.add(module, runtime, result);
|
|
2148
|
+
}
|
|
2149
|
+
if (!cachedResult) {
|
|
2150
|
+
cache.store(result, err => callback(err, codeGenerated));
|
|
2151
|
+
}
|
|
2152
|
+
else {
|
|
2153
|
+
callback(null, codeGenerated);
|
|
2154
|
+
}
|
|
2155
|
+
});
|
|
2156
|
+
}
|
|
2157
|
+
_getChunkGraphEntries() {
|
|
2158
|
+
const treeEntries = new Set();
|
|
2159
|
+
for (const ep of this.entrypoints.values()) {
|
|
2160
|
+
const chunk = ep.getRuntimeChunk();
|
|
2161
|
+
if (chunk)
|
|
2162
|
+
treeEntries.add(chunk);
|
|
2163
|
+
}
|
|
2164
|
+
for (const ep of this.asyncEntrypoints) {
|
|
2165
|
+
const chunk = ep.getRuntimeChunk();
|
|
2166
|
+
if (chunk)
|
|
2167
|
+
treeEntries.add(chunk);
|
|
2168
|
+
}
|
|
2169
|
+
return treeEntries;
|
|
2170
|
+
}
|
|
2171
|
+
processRuntimeRequirements({ chunkGraph = this.chunkGraph, modules = this.modules, chunks = this.chunks, codeGenerationResults = this.codeGenerationResults, chunkGraphEntries = this._getChunkGraphEntries(), } = {}) {
|
|
2172
|
+
const context = { chunkGraph, codeGenerationResults };
|
|
2173
|
+
const { moduleMemCaches2 } = this;
|
|
2174
|
+
this.logger.time('runtime requirements.modules');
|
|
2175
|
+
const additionalModuleRuntimeRequirements = this.hooks.additionalModuleRuntimeRequirements;
|
|
2176
|
+
const runtimeRequirementInModule = this.hooks.runtimeRequirementInModule;
|
|
2177
|
+
for (const module of modules) {
|
|
2178
|
+
if (chunkGraph.getNumberOfModuleChunks(module) > 0) {
|
|
2179
|
+
const memCache = moduleMemCaches2 === null || moduleMemCaches2 === void 0 ? void 0 : moduleMemCaches2.get(module);
|
|
2180
|
+
for (const runtime of chunkGraph.getModuleRuntimes(module)) {
|
|
2181
|
+
if (memCache) {
|
|
2182
|
+
const cached = memCache.get(`moduleRuntimeRequirements-${(0, RuntimeHelpers_1.getRuntimeKey)(runtime)}`);
|
|
2183
|
+
if (cached !== undefined) {
|
|
2184
|
+
if (cached !== null) {
|
|
2185
|
+
chunkGraph.addModuleRuntimeRequirements(module, runtime, cached, false);
|
|
2186
|
+
}
|
|
2187
|
+
continue;
|
|
2188
|
+
}
|
|
2189
|
+
}
|
|
2190
|
+
let set;
|
|
2191
|
+
const runtimeRequirements = codeGenerationResults.getRuntimeRequirements(module, runtime);
|
|
2192
|
+
if (runtimeRequirements && runtimeRequirements.size > 0) {
|
|
2193
|
+
set = new Set(runtimeRequirements);
|
|
2194
|
+
}
|
|
2195
|
+
else if (additionalModuleRuntimeRequirements.isUsed()) {
|
|
2196
|
+
set = new Set();
|
|
2197
|
+
}
|
|
2198
|
+
else {
|
|
2199
|
+
if (memCache) {
|
|
2200
|
+
memCache.set(`moduleRuntimeRequirements-${(0, RuntimeHelpers_1.getRuntimeKey)(runtime)}`, null);
|
|
2201
|
+
}
|
|
2202
|
+
continue;
|
|
2203
|
+
}
|
|
2204
|
+
additionalModuleRuntimeRequirements.call(module, set, context);
|
|
2205
|
+
for (const r of set) {
|
|
2206
|
+
const hook = runtimeRequirementInModule.get(r);
|
|
2207
|
+
if (hook !== undefined)
|
|
2208
|
+
hook.call(module, set, context);
|
|
2209
|
+
}
|
|
2210
|
+
if (set.size === 0) {
|
|
2211
|
+
if (memCache) {
|
|
2212
|
+
memCache.set(`moduleRuntimeRequirements-${(0, RuntimeHelpers_1.getRuntimeKey)(runtime)}`, null);
|
|
2213
|
+
}
|
|
2214
|
+
}
|
|
2215
|
+
else if (memCache) {
|
|
2216
|
+
memCache.set(`moduleRuntimeRequirements-${(0, RuntimeHelpers_1.getRuntimeKey)(runtime)}`, set);
|
|
2217
|
+
chunkGraph.addModuleRuntimeRequirements(module, runtime, set, false);
|
|
2218
|
+
}
|
|
2219
|
+
else {
|
|
2220
|
+
chunkGraph.addModuleRuntimeRequirements(module, runtime, set);
|
|
2221
|
+
}
|
|
2222
|
+
}
|
|
2223
|
+
}
|
|
2224
|
+
}
|
|
2225
|
+
this.logger.timeEnd('runtime requirements.modules');
|
|
2226
|
+
this.logger.time('runtime requirements.chunks');
|
|
2227
|
+
for (const chunk of chunks) {
|
|
2228
|
+
const set = new Set();
|
|
2229
|
+
for (const module of chunkGraph.getChunkModulesIterable(chunk)) {
|
|
2230
|
+
const runtimeRequirements = chunkGraph.getModuleRuntimeRequirements(module, chunk.runtime);
|
|
2231
|
+
for (const r of runtimeRequirements)
|
|
2232
|
+
set.add(r);
|
|
2233
|
+
}
|
|
2234
|
+
this.hooks.additionalChunkRuntimeRequirements.call(chunk, set, context);
|
|
2235
|
+
for (const r of set) {
|
|
2236
|
+
this.hooks.runtimeRequirementInChunk.for(r).call(chunk, set, context);
|
|
2237
|
+
}
|
|
2238
|
+
chunkGraph.addChunkRuntimeRequirements(chunk, set);
|
|
2239
|
+
}
|
|
2240
|
+
this.logger.timeEnd('runtime requirements.chunks');
|
|
2241
|
+
this.logger.time('runtime requirements.entries');
|
|
2242
|
+
for (const treeEntry of chunkGraphEntries) {
|
|
2243
|
+
const set = new Set();
|
|
2244
|
+
for (const chunk of treeEntry.getAllReferencedChunks()) {
|
|
2245
|
+
const runtimeRequirements = chunkGraph.getChunkRuntimeRequirements(chunk);
|
|
2246
|
+
for (const r of runtimeRequirements)
|
|
2247
|
+
set.add(r);
|
|
2248
|
+
}
|
|
2249
|
+
this.hooks.additionalTreeRuntimeRequirements.call(treeEntry, set, context);
|
|
2250
|
+
for (const r of set) {
|
|
2251
|
+
this.hooks.runtimeRequirementInTree.for(r).call(treeEntry, set, context);
|
|
2252
|
+
}
|
|
2253
|
+
chunkGraph.addTreeRuntimeRequirements(treeEntry, set);
|
|
2254
|
+
}
|
|
2255
|
+
this.logger.timeEnd('runtime requirements.entries');
|
|
2256
|
+
}
|
|
2257
|
+
addRuntimeModule(chunk, module, chunkGraph = this.chunkGraph) {
|
|
2258
|
+
// Deprecated ModuleGraph association
|
|
2259
|
+
if (this._backCompat)
|
|
2260
|
+
ModuleGraph_1.default.setModuleGraphForModule(module, this.moduleGraph);
|
|
2261
|
+
// add it to the list
|
|
2262
|
+
this.modules.add(module);
|
|
2263
|
+
this._modules.set(module.identifier(), module);
|
|
2264
|
+
// connect to the chunk graph
|
|
2265
|
+
chunkGraph.connectChunkAndModule(chunk, module);
|
|
2266
|
+
chunkGraph.connectChunkAndRuntimeModule(chunk, module);
|
|
2267
|
+
if (module.fullHash) {
|
|
2268
|
+
chunkGraph.addFullHashModuleToChunk(chunk, module);
|
|
2269
|
+
}
|
|
2270
|
+
else if (module.dependentHash) {
|
|
2271
|
+
chunkGraph.addDependentHashModuleToChunk(chunk, module);
|
|
2272
|
+
}
|
|
2273
|
+
// attach runtime module
|
|
2274
|
+
module.attach(this, chunk, chunkGraph);
|
|
2275
|
+
// Setup internals
|
|
2276
|
+
const exportsInfo = this.moduleGraph.getExportsInfo(module);
|
|
2277
|
+
exportsInfo.setHasProvideInfo();
|
|
2278
|
+
if (typeof chunk.runtime === 'string') {
|
|
2279
|
+
exportsInfo.setUsedForSideEffectsOnly(chunk.runtime);
|
|
2280
|
+
}
|
|
2281
|
+
else if (chunk.runtime === undefined) {
|
|
2282
|
+
exportsInfo.setUsedForSideEffectsOnly(undefined);
|
|
2283
|
+
}
|
|
2284
|
+
else {
|
|
2285
|
+
for (const runtime of chunk.runtime) {
|
|
2286
|
+
exportsInfo.setUsedForSideEffectsOnly(runtime);
|
|
2287
|
+
}
|
|
2288
|
+
}
|
|
2289
|
+
chunkGraph.addModuleRuntimeRequirements(module, chunk.runtime, new Set([RuntimeGlobals.requireScope]));
|
|
2290
|
+
// runtime modules don't need ids
|
|
2291
|
+
chunkGraph.setModuleId(module, '');
|
|
2292
|
+
// Call hook
|
|
2293
|
+
this.hooks.runtimeModule.call(module, chunk);
|
|
2294
|
+
}
|
|
2295
|
+
addChunkInGroup(groupOptions, module, loc, request) {
|
|
2296
|
+
if (typeof groupOptions === 'string') {
|
|
2297
|
+
groupOptions = { name: groupOptions };
|
|
2298
|
+
}
|
|
2299
|
+
const name = groupOptions.name;
|
|
2300
|
+
if (name) {
|
|
2301
|
+
const chunkGroup = this.namedChunkGroups.get(name);
|
|
2302
|
+
if (chunkGroup !== undefined) {
|
|
2303
|
+
chunkGroup.addOptions(groupOptions);
|
|
2304
|
+
if (module) {
|
|
2305
|
+
chunkGroup.addOrigin(module, loc, request);
|
|
2306
|
+
}
|
|
2307
|
+
return chunkGroup;
|
|
2308
|
+
}
|
|
2309
|
+
}
|
|
2310
|
+
const chunkGroup = new ChunkGroup_1.default(groupOptions);
|
|
2311
|
+
if (module)
|
|
2312
|
+
chunkGroup.addOrigin(module, loc, request);
|
|
2313
|
+
const chunk = this.addChunk(name);
|
|
2314
|
+
(0, GraphHelpers_1.connectChunkGroupAndChunk)(chunkGroup, chunk);
|
|
2315
|
+
this.chunkGroups.push(chunkGroup);
|
|
2316
|
+
if (name) {
|
|
2317
|
+
this.namedChunkGroups.set(name, chunkGroup);
|
|
2318
|
+
}
|
|
2319
|
+
return chunkGroup;
|
|
2320
|
+
}
|
|
2321
|
+
addAsyncEntrypoint(options, module, loc, request) {
|
|
2322
|
+
const name = options.name;
|
|
2323
|
+
if (name) {
|
|
2324
|
+
const entrypoint = this.namedChunkGroups.get(name);
|
|
2325
|
+
if (entrypoint instanceof Entrypoint_1.default) {
|
|
2326
|
+
if (entrypoint !== undefined) {
|
|
2327
|
+
if (module) {
|
|
2328
|
+
entrypoint.addOrigin(module, loc, request);
|
|
2329
|
+
}
|
|
2330
|
+
return entrypoint;
|
|
2331
|
+
}
|
|
2332
|
+
}
|
|
2333
|
+
else if (entrypoint) {
|
|
2334
|
+
throw new Error(`Cannot add an async entrypoint with the name '${name}', because there is already an chunk group with this name`);
|
|
2335
|
+
}
|
|
2336
|
+
}
|
|
2337
|
+
const chunk = this.addChunk(name);
|
|
2338
|
+
if (options.filename) {
|
|
2339
|
+
chunk.filenameTemplate = options.filename;
|
|
2340
|
+
}
|
|
2341
|
+
const entrypoint = new Entrypoint_1.default(options, false);
|
|
2342
|
+
entrypoint.setRuntimeChunk(chunk);
|
|
2343
|
+
entrypoint.setEntrypointChunk(chunk);
|
|
2344
|
+
if (name) {
|
|
2345
|
+
this.namedChunkGroups.set(name, entrypoint);
|
|
2346
|
+
}
|
|
2347
|
+
this.chunkGroups.push(entrypoint);
|
|
2348
|
+
this.asyncEntrypoints.push(entrypoint);
|
|
2349
|
+
(0, GraphHelpers_1.connectChunkGroupAndChunk)(entrypoint, chunk);
|
|
2350
|
+
if (module) {
|
|
2351
|
+
entrypoint.addOrigin(module, loc, request);
|
|
2352
|
+
}
|
|
2353
|
+
return entrypoint;
|
|
2354
|
+
}
|
|
2355
|
+
addChunk(name) {
|
|
2356
|
+
if (name) {
|
|
2357
|
+
const chunk = this.namedChunks.get(name);
|
|
2358
|
+
if (chunk !== undefined) {
|
|
2359
|
+
return chunk;
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
const chunk = new Chunk_1.default(name, this._backCompat);
|
|
2363
|
+
this.chunks.add(chunk);
|
|
2364
|
+
if (this._backCompat)
|
|
2365
|
+
ChunkGraph_1.default.setChunkGraphForChunk(chunk, this.chunkGraph);
|
|
2366
|
+
if (name) {
|
|
2367
|
+
this.namedChunks.set(name, chunk);
|
|
2368
|
+
}
|
|
2369
|
+
return chunk;
|
|
2370
|
+
}
|
|
2371
|
+
assignDepth(module) {
|
|
2372
|
+
const moduleGraph = this.moduleGraph;
|
|
2373
|
+
const queue = new Set([module]);
|
|
2374
|
+
let depth;
|
|
2375
|
+
moduleGraph.setDepth(module, 0);
|
|
2376
|
+
const processModule = module => {
|
|
2377
|
+
if (!moduleGraph.setDepthIfLower(module, depth))
|
|
2378
|
+
return;
|
|
2379
|
+
queue.add(module);
|
|
2380
|
+
};
|
|
2381
|
+
for (module of queue) {
|
|
2382
|
+
queue.delete(module);
|
|
2383
|
+
depth = moduleGraph.getDepth(module) + 1;
|
|
2384
|
+
for (const connection of moduleGraph.getOutgoingConnections(module)) {
|
|
2385
|
+
const refModule = connection.module;
|
|
2386
|
+
if (refModule) {
|
|
2387
|
+
processModule(refModule);
|
|
2388
|
+
}
|
|
2389
|
+
}
|
|
2390
|
+
}
|
|
2391
|
+
}
|
|
2392
|
+
assignDepths(modules) {
|
|
2393
|
+
const moduleGraph = this.moduleGraph;
|
|
2394
|
+
const queue = new Set(modules);
|
|
2395
|
+
queue.add(1);
|
|
2396
|
+
let depth = 0;
|
|
2397
|
+
let i = 0;
|
|
2398
|
+
for (const module of queue) {
|
|
2399
|
+
i++;
|
|
2400
|
+
if (typeof module === 'number') {
|
|
2401
|
+
depth = module;
|
|
2402
|
+
if (queue.size === i)
|
|
2403
|
+
return;
|
|
2404
|
+
queue.add(depth + 1);
|
|
2405
|
+
}
|
|
2406
|
+
else {
|
|
2407
|
+
moduleGraph.setDepth(module, depth);
|
|
2408
|
+
for (const { module: refModule } of moduleGraph.getOutgoingConnections(module)) {
|
|
2409
|
+
if (refModule) {
|
|
2410
|
+
queue.add(refModule);
|
|
2411
|
+
}
|
|
2412
|
+
}
|
|
2413
|
+
}
|
|
2414
|
+
}
|
|
2415
|
+
}
|
|
2416
|
+
getDependencyReferencedExports(dependency, runtime) {
|
|
2417
|
+
const referencedExports = dependency.getReferencedExports(this.moduleGraph, runtime);
|
|
2418
|
+
return this.hooks.dependencyReferencedExports.call(referencedExports, dependency, runtime);
|
|
2419
|
+
}
|
|
2420
|
+
removeReasonsOfDependencyBlock(module, block) {
|
|
2421
|
+
if (block.blocks) {
|
|
2422
|
+
for (const b of block.blocks) {
|
|
2423
|
+
this.removeReasonsOfDependencyBlock(module, b);
|
|
2424
|
+
}
|
|
2425
|
+
}
|
|
2426
|
+
if (block.dependencies) {
|
|
2427
|
+
for (const dep of block.dependencies) {
|
|
2428
|
+
const originalModule = this.moduleGraph.getModule(dep);
|
|
2429
|
+
if (originalModule) {
|
|
2430
|
+
this.moduleGraph.removeConnection(dep);
|
|
2431
|
+
if (this.chunkGraph) {
|
|
2432
|
+
for (const chunk of this.chunkGraph.getModuleChunks(originalModule)) {
|
|
2433
|
+
this.patchChunksAfterReasonRemoval(originalModule, chunk);
|
|
2434
|
+
}
|
|
2435
|
+
}
|
|
2436
|
+
}
|
|
2437
|
+
}
|
|
2438
|
+
}
|
|
2439
|
+
}
|
|
2440
|
+
patchChunksAfterReasonRemoval(module, chunk) {
|
|
2441
|
+
if (!module.hasReasons(this.moduleGraph, chunk.runtime)) {
|
|
2442
|
+
this.removeReasonsOfDependencyBlock(module, module);
|
|
2443
|
+
}
|
|
2444
|
+
if (!module.hasReasonForChunk(chunk, this.moduleGraph, this.chunkGraph)) {
|
|
2445
|
+
if (this.chunkGraph.isModuleInChunk(module, chunk)) {
|
|
2446
|
+
this.chunkGraph.disconnectChunkAndModule(chunk, module);
|
|
2447
|
+
this.removeChunkFromDependencies(module, chunk);
|
|
2448
|
+
}
|
|
2449
|
+
}
|
|
2450
|
+
}
|
|
2451
|
+
removeChunkFromDependencies(block, chunk) {
|
|
2452
|
+
const iteratorDependency = d => {
|
|
2453
|
+
const depModule = this.moduleGraph.getModule(d);
|
|
2454
|
+
if (!depModule) {
|
|
2455
|
+
return;
|
|
2456
|
+
}
|
|
2457
|
+
this.patchChunksAfterReasonRemoval(depModule, chunk);
|
|
2458
|
+
};
|
|
2459
|
+
const blocks = block.blocks;
|
|
2460
|
+
for (let indexBlock = 0; indexBlock < blocks.length; indexBlock++) {
|
|
2461
|
+
const asyncBlock = blocks[indexBlock];
|
|
2462
|
+
const chunkGroup = this.chunkGraph.getBlockChunkGroup(asyncBlock);
|
|
2463
|
+
// Grab all chunks from the first Block's AsyncDepBlock
|
|
2464
|
+
const chunks = chunkGroup.chunks;
|
|
2465
|
+
// For each chunk in chunkGroup
|
|
2466
|
+
for (let indexChunk = 0; indexChunk < chunks.length; indexChunk++) {
|
|
2467
|
+
const iteratedChunk = chunks[indexChunk];
|
|
2468
|
+
chunkGroup.removeChunk(iteratedChunk);
|
|
2469
|
+
// Recurse
|
|
2470
|
+
this.removeChunkFromDependencies(block, iteratedChunk);
|
|
2471
|
+
}
|
|
2472
|
+
}
|
|
2473
|
+
if (block.dependencies) {
|
|
2474
|
+
for (const dep of block.dependencies)
|
|
2475
|
+
iteratorDependency(dep);
|
|
2476
|
+
}
|
|
2477
|
+
}
|
|
2478
|
+
assignRuntimeIds() {
|
|
2479
|
+
const { chunkGraph } = this;
|
|
2480
|
+
const processEntrypoint = ep => {
|
|
2481
|
+
const runtime = ep.options.runtime || ep.name;
|
|
2482
|
+
const chunk = ep.getRuntimeChunk();
|
|
2483
|
+
chunkGraph.setRuntimeId(runtime, chunk.id);
|
|
2484
|
+
};
|
|
2485
|
+
for (const ep of this.entrypoints.values()) {
|
|
2486
|
+
processEntrypoint(ep);
|
|
2487
|
+
}
|
|
2488
|
+
for (const ep of this.asyncEntrypoints) {
|
|
2489
|
+
processEntrypoint(ep);
|
|
2490
|
+
}
|
|
2491
|
+
}
|
|
2492
|
+
sortItemsWithChunkIds() {
|
|
2493
|
+
for (const chunkGroup of this.chunkGroups) {
|
|
2494
|
+
chunkGroup.sortItems();
|
|
2495
|
+
}
|
|
2496
|
+
this.errors.sort(compareErrors);
|
|
2497
|
+
this.warnings.sort(compareErrors);
|
|
2498
|
+
this.children.sort(byNameOrHash);
|
|
2499
|
+
}
|
|
2500
|
+
summarizeDependencies() {
|
|
2501
|
+
for (let indexChildren = 0; indexChildren < this.children.length; indexChildren++) {
|
|
2502
|
+
const child = this.children[indexChildren];
|
|
2503
|
+
this.fileDependencies.addAll(child.fileDependencies);
|
|
2504
|
+
this.contextDependencies.addAll(child.contextDependencies);
|
|
2505
|
+
this.missingDependencies.addAll(child.missingDependencies);
|
|
2506
|
+
this.buildDependencies.addAll(child.buildDependencies);
|
|
2507
|
+
}
|
|
2508
|
+
for (const module of this.modules) {
|
|
2509
|
+
module.addCacheDependencies(this.fileDependencies, this.contextDependencies, this.missingDependencies, this.buildDependencies);
|
|
2510
|
+
}
|
|
2511
|
+
}
|
|
2512
|
+
createModuleHashes() {
|
|
2513
|
+
let statModulesHashed = 0;
|
|
2514
|
+
let statModulesFromCache = 0;
|
|
2515
|
+
const { chunkGraph, runtimeTemplate, moduleMemCaches2 } = this;
|
|
2516
|
+
const { hashFunction, hashDigest, hashDigestLength } = this.outputOptions;
|
|
2517
|
+
const errors = [];
|
|
2518
|
+
for (const module of this.modules) {
|
|
2519
|
+
const memCache = moduleMemCaches2 === null || moduleMemCaches2 === void 0 ? void 0 : moduleMemCaches2.get(module);
|
|
2520
|
+
for (const runtime of chunkGraph.getModuleRuntimes(module)) {
|
|
2521
|
+
if (memCache) {
|
|
2522
|
+
const digest = memCache.get(`moduleHash-${(0, RuntimeHelpers_1.getRuntimeKey)(runtime)}`);
|
|
2523
|
+
if (digest !== undefined) {
|
|
2524
|
+
chunkGraph.setModuleHashes(module, runtime, digest, digest.slice(0, hashDigestLength));
|
|
2525
|
+
statModulesFromCache++;
|
|
2526
|
+
continue;
|
|
2527
|
+
}
|
|
2528
|
+
}
|
|
2529
|
+
statModulesHashed++;
|
|
2530
|
+
const digest = this._createModuleHash(module, chunkGraph, runtime, hashFunction, runtimeTemplate, hashDigest, hashDigestLength, errors);
|
|
2531
|
+
if (memCache) {
|
|
2532
|
+
memCache.set(`moduleHash-${(0, RuntimeHelpers_1.getRuntimeKey)(runtime)}`, digest);
|
|
2533
|
+
}
|
|
2534
|
+
}
|
|
2535
|
+
}
|
|
2536
|
+
if (errors.length > 0) {
|
|
2537
|
+
errors.sort((0, comparators_1.compareSelect)(err => err.module, comparators_1.compareModulesByIdentifier));
|
|
2538
|
+
for (const error of errors) {
|
|
2539
|
+
this.errors.push(error);
|
|
2540
|
+
}
|
|
2541
|
+
}
|
|
2542
|
+
this.logger.log(`${statModulesHashed} modules hashed, ${statModulesFromCache} from cache (${Math.round((100 * (statModulesHashed + statModulesFromCache)) / this.modules.size) / 100} variants per module in average)`);
|
|
2543
|
+
}
|
|
2544
|
+
_createModuleHash(module, chunkGraph, runtime, hashFunction, runtimeTemplate, hashDigest, hashDigestLength, errors = []) {
|
|
2545
|
+
let moduleHashDigest;
|
|
2546
|
+
try {
|
|
2547
|
+
const moduleHash = (0, createHash_1.default)(hashFunction);
|
|
2548
|
+
module.updateHash(moduleHash, {
|
|
2549
|
+
chunkGraph,
|
|
2550
|
+
runtime,
|
|
2551
|
+
runtimeTemplate,
|
|
2552
|
+
});
|
|
2553
|
+
moduleHashDigest = moduleHash.digest(hashDigest);
|
|
2554
|
+
}
|
|
2555
|
+
catch (err) {
|
|
2556
|
+
errors.push(new ModuleHashingError_1.default(module, err));
|
|
2557
|
+
moduleHashDigest = 'XXXXXX';
|
|
2558
|
+
}
|
|
2559
|
+
chunkGraph.setModuleHashes(module, runtime, moduleHashDigest, moduleHashDigest.slice(0, hashDigestLength));
|
|
2560
|
+
return moduleHashDigest;
|
|
2561
|
+
}
|
|
2562
|
+
createHash() {
|
|
2563
|
+
this.logger.time('hashing: initialize hash');
|
|
2564
|
+
const chunkGraph = this.chunkGraph;
|
|
2565
|
+
const runtimeTemplate = this.runtimeTemplate;
|
|
2566
|
+
const outputOptions = this.outputOptions;
|
|
2567
|
+
const hashFunction = outputOptions.hashFunction;
|
|
2568
|
+
const hashDigest = outputOptions.hashDigest;
|
|
2569
|
+
const hashDigestLength = outputOptions.hashDigestLength;
|
|
2570
|
+
const hash = (0, createHash_1.default)(hashFunction);
|
|
2571
|
+
if (outputOptions.hashSalt) {
|
|
2572
|
+
hash.update(outputOptions.hashSalt);
|
|
2573
|
+
}
|
|
2574
|
+
this.logger.timeEnd('hashing: initialize hash');
|
|
2575
|
+
if (this.children.length > 0) {
|
|
2576
|
+
this.logger.time('hashing: hash child compilations');
|
|
2577
|
+
for (const child of this.children) {
|
|
2578
|
+
hash.update(child.hash);
|
|
2579
|
+
}
|
|
2580
|
+
this.logger.timeEnd('hashing: hash child compilations');
|
|
2581
|
+
}
|
|
2582
|
+
if (this.warnings.length > 0) {
|
|
2583
|
+
this.logger.time('hashing: hash warnings');
|
|
2584
|
+
for (const warning of this.warnings) {
|
|
2585
|
+
hash.update(`${warning.message}`);
|
|
2586
|
+
}
|
|
2587
|
+
this.logger.timeEnd('hashing: hash warnings');
|
|
2588
|
+
}
|
|
2589
|
+
if (this.errors.length > 0) {
|
|
2590
|
+
this.logger.time('hashing: hash errors');
|
|
2591
|
+
for (const error of this.errors) {
|
|
2592
|
+
hash.update(`${error.message}`);
|
|
2593
|
+
}
|
|
2594
|
+
this.logger.timeEnd('hashing: hash errors');
|
|
2595
|
+
}
|
|
2596
|
+
this.logger.time('hashing: sort chunks');
|
|
2597
|
+
/*
|
|
2598
|
+
* all non-runtime chunks need to be hashes first,
|
|
2599
|
+
* since runtime chunk might use their hashes.
|
|
2600
|
+
* runtime chunks need to be hashed in the correct order
|
|
2601
|
+
* since they may depend on each other (for async entrypoints).
|
|
2602
|
+
* So we put all non-runtime chunks first and hash them in any order.
|
|
2603
|
+
* And order runtime chunks according to referenced between each other.
|
|
2604
|
+
* Chunks need to be in deterministic order since we add hashes to full chunk
|
|
2605
|
+
* during these hashing.
|
|
2606
|
+
*/
|
|
2607
|
+
const unorderedRuntimeChunks = [];
|
|
2608
|
+
const otherChunks = [];
|
|
2609
|
+
for (const c of this.chunks) {
|
|
2610
|
+
if (c.hasRuntime()) {
|
|
2611
|
+
unorderedRuntimeChunks.push(c);
|
|
2612
|
+
}
|
|
2613
|
+
else {
|
|
2614
|
+
otherChunks.push(c);
|
|
2615
|
+
}
|
|
2616
|
+
}
|
|
2617
|
+
unorderedRuntimeChunks.sort(byId);
|
|
2618
|
+
otherChunks.sort(byId);
|
|
2619
|
+
const runtimeChunksMap = new Map();
|
|
2620
|
+
for (const chunk of unorderedRuntimeChunks) {
|
|
2621
|
+
runtimeChunksMap.set(chunk, {
|
|
2622
|
+
chunk,
|
|
2623
|
+
referencedBy: [],
|
|
2624
|
+
remaining: 0,
|
|
2625
|
+
});
|
|
2626
|
+
}
|
|
2627
|
+
let remaining = 0;
|
|
2628
|
+
for (const info of runtimeChunksMap.values()) {
|
|
2629
|
+
for (const other of new Set(Array.from(info.chunk.getAllReferencedAsyncEntrypoints()).map((e) => e.chunks[e.chunks.length - 1]))) {
|
|
2630
|
+
const otherInfo = runtimeChunksMap.get(other);
|
|
2631
|
+
otherInfo.referencedBy.push(info);
|
|
2632
|
+
info.remaining++;
|
|
2633
|
+
remaining++;
|
|
2634
|
+
}
|
|
2635
|
+
}
|
|
2636
|
+
const runtimeChunks = [];
|
|
2637
|
+
for (const info of runtimeChunksMap.values()) {
|
|
2638
|
+
if (info.remaining === 0) {
|
|
2639
|
+
runtimeChunks.push(info.chunk);
|
|
2640
|
+
}
|
|
2641
|
+
}
|
|
2642
|
+
// If there are any references between chunks
|
|
2643
|
+
// make sure to follow these chains
|
|
2644
|
+
if (remaining > 0) {
|
|
2645
|
+
const readyChunks = [];
|
|
2646
|
+
for (const chunk of runtimeChunks) {
|
|
2647
|
+
const hasFullHashModules = chunkGraph.getNumberOfChunkFullHashModules(chunk) !== 0;
|
|
2648
|
+
const info = runtimeChunksMap.get(chunk);
|
|
2649
|
+
for (const otherInfo of info.referencedBy) {
|
|
2650
|
+
if (hasFullHashModules) {
|
|
2651
|
+
chunkGraph.upgradeDependentToFullHashModules(otherInfo.chunk);
|
|
2652
|
+
}
|
|
2653
|
+
remaining--;
|
|
2654
|
+
if (--otherInfo.remaining === 0) {
|
|
2655
|
+
readyChunks.push(otherInfo.chunk);
|
|
2656
|
+
}
|
|
2657
|
+
}
|
|
2658
|
+
if (readyChunks.length > 0) {
|
|
2659
|
+
// This ensures deterministic ordering, since referencedBy is non-deterministic
|
|
2660
|
+
readyChunks.sort(byId);
|
|
2661
|
+
for (const c of readyChunks)
|
|
2662
|
+
runtimeChunks.push(c);
|
|
2663
|
+
readyChunks.length = 0;
|
|
2664
|
+
}
|
|
2665
|
+
}
|
|
2666
|
+
}
|
|
2667
|
+
// If there are still remaining references we have cycles and want to create a warning
|
|
2668
|
+
if (remaining > 0) {
|
|
2669
|
+
const circularRuntimeChunkInfo = [];
|
|
2670
|
+
for (const info of runtimeChunksMap.values()) {
|
|
2671
|
+
if (info.remaining !== 0) {
|
|
2672
|
+
circularRuntimeChunkInfo.push(info);
|
|
2673
|
+
}
|
|
2674
|
+
}
|
|
2675
|
+
circularRuntimeChunkInfo.sort((0, comparators_1.compareSelect)(i => i.chunk, byId));
|
|
2676
|
+
const err = new BaseError_1.default(`Circular dependency between chunks with runtime (${Array.from(circularRuntimeChunkInfo, c => c.chunk.name || c.chunk.id).join(', ')})
|
|
2677
|
+
This prevents using hashes of each other and should be avoided.`);
|
|
2678
|
+
err.chunk = circularRuntimeChunkInfo[0].chunk;
|
|
2679
|
+
this.warnings.push(err);
|
|
2680
|
+
for (const i of circularRuntimeChunkInfo)
|
|
2681
|
+
runtimeChunks.push(i.chunk);
|
|
2682
|
+
}
|
|
2683
|
+
this.logger.timeEnd('hashing: sort chunks');
|
|
2684
|
+
const fullHashChunks = new Set();
|
|
2685
|
+
const codeGenerationJobs = [];
|
|
2686
|
+
const codeGenerationJobsMap = new Map();
|
|
2687
|
+
const errors = [];
|
|
2688
|
+
const processChunk = chunk => {
|
|
2689
|
+
// Last minute module hash generation for modules that depend on chunk hashes
|
|
2690
|
+
this.logger.time('hashing: hash runtime modules');
|
|
2691
|
+
const runtime = chunk.runtime;
|
|
2692
|
+
for (const module of chunkGraph.getChunkModulesIterable(chunk)) {
|
|
2693
|
+
if (!chunkGraph.hasModuleHashes(module, runtime)) {
|
|
2694
|
+
const hash = this._createModuleHash(module, chunkGraph, runtime, hashFunction, runtimeTemplate, hashDigest, hashDigestLength, errors);
|
|
2695
|
+
let hashMap = codeGenerationJobsMap.get(hash);
|
|
2696
|
+
if (hashMap) {
|
|
2697
|
+
const moduleJob = hashMap.get(module);
|
|
2698
|
+
if (moduleJob) {
|
|
2699
|
+
moduleJob.runtimes.push(runtime);
|
|
2700
|
+
continue;
|
|
2701
|
+
}
|
|
2702
|
+
}
|
|
2703
|
+
else {
|
|
2704
|
+
hashMap = new Map();
|
|
2705
|
+
codeGenerationJobsMap.set(hash, hashMap);
|
|
2706
|
+
}
|
|
2707
|
+
const job = {
|
|
2708
|
+
module,
|
|
2709
|
+
hash,
|
|
2710
|
+
runtime,
|
|
2711
|
+
runtimes: [runtime],
|
|
2712
|
+
};
|
|
2713
|
+
hashMap.set(module, job);
|
|
2714
|
+
codeGenerationJobs.push(job);
|
|
2715
|
+
}
|
|
2716
|
+
}
|
|
2717
|
+
this.logger.timeAggregate('hashing: hash runtime modules');
|
|
2718
|
+
try {
|
|
2719
|
+
this.logger.time('hashing: hash chunks');
|
|
2720
|
+
const chunkHash = (0, createHash_1.default)(hashFunction);
|
|
2721
|
+
if (outputOptions.hashSalt) {
|
|
2722
|
+
chunkHash.update(outputOptions.hashSalt);
|
|
2723
|
+
}
|
|
2724
|
+
chunk.updateHash(chunkHash, chunkGraph);
|
|
2725
|
+
this.hooks.chunkHash.call(chunk, chunkHash, {
|
|
2726
|
+
chunkGraph,
|
|
2727
|
+
codeGenerationResults: this.codeGenerationResults,
|
|
2728
|
+
moduleGraph: this.moduleGraph,
|
|
2729
|
+
runtimeTemplate: this.runtimeTemplate,
|
|
2730
|
+
});
|
|
2731
|
+
const chunkHashDigest = chunkHash.digest(hashDigest);
|
|
2732
|
+
hash.update(chunkHashDigest);
|
|
2733
|
+
chunk.hash = chunkHashDigest;
|
|
2734
|
+
chunk.renderedHash = chunk.hash.slice(0, hashDigestLength);
|
|
2735
|
+
const fullHashModules = chunkGraph.getChunkFullHashModulesIterable(chunk);
|
|
2736
|
+
if (fullHashModules) {
|
|
2737
|
+
fullHashChunks.add(chunk);
|
|
2738
|
+
}
|
|
2739
|
+
else {
|
|
2740
|
+
this.hooks.contentHash.call(chunk);
|
|
2741
|
+
}
|
|
2742
|
+
}
|
|
2743
|
+
catch (err) {
|
|
2744
|
+
this.errors.push(new ChunkRenderError_1.default(chunk, '', err));
|
|
2745
|
+
}
|
|
2746
|
+
this.logger.timeAggregate('hashing: hash chunks');
|
|
2747
|
+
};
|
|
2748
|
+
otherChunks.forEach(processChunk);
|
|
2749
|
+
for (const chunk of runtimeChunks)
|
|
2750
|
+
processChunk(chunk);
|
|
2751
|
+
if (errors.length > 0) {
|
|
2752
|
+
errors.sort((0, comparators_1.compareSelect)(err => err.module, comparators_1.compareModulesByIdentifier));
|
|
2753
|
+
for (const error of errors) {
|
|
2754
|
+
this.errors.push(error);
|
|
2755
|
+
}
|
|
2756
|
+
}
|
|
2757
|
+
this.logger.timeAggregateEnd('hashing: hash runtime modules');
|
|
2758
|
+
this.logger.timeAggregateEnd('hashing: hash chunks');
|
|
2759
|
+
this.logger.time('hashing: hash digest');
|
|
2760
|
+
this.hooks.fullHash.call(hash);
|
|
2761
|
+
this.fullHash = hash.digest(hashDigest);
|
|
2762
|
+
this.hash = this.fullHash.slice(0, hashDigestLength);
|
|
2763
|
+
this.logger.timeEnd('hashing: hash digest');
|
|
2764
|
+
this.logger.time('hashing: process full hash modules');
|
|
2765
|
+
for (const chunk of fullHashChunks) {
|
|
2766
|
+
for (const module of chunkGraph.getChunkFullHashModulesIterable(chunk)) {
|
|
2767
|
+
const moduleHash = (0, createHash_1.default)(hashFunction);
|
|
2768
|
+
module.updateHash(moduleHash, {
|
|
2769
|
+
chunkGraph,
|
|
2770
|
+
runtime: chunk.runtime,
|
|
2771
|
+
runtimeTemplate,
|
|
2772
|
+
});
|
|
2773
|
+
const moduleHashDigest = moduleHash.digest(hashDigest);
|
|
2774
|
+
const oldHash = chunkGraph.getModuleHash(module, chunk.runtime);
|
|
2775
|
+
chunkGraph.setModuleHashes(module, chunk.runtime, moduleHashDigest, moduleHashDigest.slice(0, hashDigestLength));
|
|
2776
|
+
codeGenerationJobsMap.get(oldHash).get(module).hash = moduleHashDigest;
|
|
2777
|
+
}
|
|
2778
|
+
const chunkHash = (0, createHash_1.default)(hashFunction);
|
|
2779
|
+
chunkHash.update(chunk.hash);
|
|
2780
|
+
chunkHash.update(this.hash);
|
|
2781
|
+
const chunkHashDigest = chunkHash.digest(hashDigest);
|
|
2782
|
+
chunk.hash = chunkHashDigest;
|
|
2783
|
+
chunk.renderedHash = chunk.hash.slice(0, hashDigestLength);
|
|
2784
|
+
this.hooks.contentHash.call(chunk);
|
|
2785
|
+
}
|
|
2786
|
+
this.logger.timeEnd('hashing: process full hash modules');
|
|
2787
|
+
return codeGenerationJobs;
|
|
2788
|
+
}
|
|
2789
|
+
emitAsset(file, source, assetInfo = {}) {
|
|
2790
|
+
if (this.assets[file]) {
|
|
2791
|
+
if (!(0, source_1.isSourceEqual)(this.assets[file], source)) {
|
|
2792
|
+
this.errors.push(new BaseError_1.default(`Conflict: Multiple assets emit different content to the same filename ${file}${assetInfo.sourceFilename ? `. Original source ${assetInfo.sourceFilename}` : ''}`));
|
|
2793
|
+
this.assets[file] = source;
|
|
2794
|
+
this._setAssetInfo(file, assetInfo);
|
|
2795
|
+
return;
|
|
2796
|
+
}
|
|
2797
|
+
const oldInfo = this.assetsInfo.get(file);
|
|
2798
|
+
const newInfo = Object.assign(Object.assign({}, oldInfo), assetInfo);
|
|
2799
|
+
this._setAssetInfo(file, newInfo, oldInfo);
|
|
2800
|
+
return;
|
|
2801
|
+
}
|
|
2802
|
+
this.assets[file] = source;
|
|
2803
|
+
this._setAssetInfo(file, assetInfo, undefined);
|
|
2804
|
+
}
|
|
2805
|
+
_setAssetInfo(file, newInfo, oldInfo = this.assetsInfo.get(file)) {
|
|
2806
|
+
if (newInfo === undefined) {
|
|
2807
|
+
this.assetsInfo.delete(file);
|
|
2808
|
+
}
|
|
2809
|
+
else {
|
|
2810
|
+
this.assetsInfo.set(file, newInfo);
|
|
2811
|
+
}
|
|
2812
|
+
const oldRelated = oldInfo === null || oldInfo === void 0 ? void 0 : oldInfo.related;
|
|
2813
|
+
const newRelated = newInfo === null || newInfo === void 0 ? void 0 : newInfo.related;
|
|
2814
|
+
if (oldRelated) {
|
|
2815
|
+
for (const key of Object.keys(oldRelated)) {
|
|
2816
|
+
const remove = name => {
|
|
2817
|
+
const relatedIn = this._assetsRelatedIn.get(name);
|
|
2818
|
+
if (relatedIn === undefined)
|
|
2819
|
+
return;
|
|
2820
|
+
const entry = relatedIn.get(key);
|
|
2821
|
+
if (entry === undefined)
|
|
2822
|
+
return;
|
|
2823
|
+
entry.delete(file);
|
|
2824
|
+
if (entry.size !== 0)
|
|
2825
|
+
return;
|
|
2826
|
+
relatedIn.delete(key);
|
|
2827
|
+
if (relatedIn.size === 0)
|
|
2828
|
+
this._assetsRelatedIn.delete(name);
|
|
2829
|
+
};
|
|
2830
|
+
const entry = oldRelated[key];
|
|
2831
|
+
if (Array.isArray(entry)) {
|
|
2832
|
+
entry.forEach(remove);
|
|
2833
|
+
}
|
|
2834
|
+
else if (entry) {
|
|
2835
|
+
remove(entry);
|
|
2836
|
+
}
|
|
2837
|
+
}
|
|
2838
|
+
}
|
|
2839
|
+
if (newRelated) {
|
|
2840
|
+
for (const key of Object.keys(newRelated)) {
|
|
2841
|
+
const add = name => {
|
|
2842
|
+
let relatedIn = this._assetsRelatedIn.get(name);
|
|
2843
|
+
if (relatedIn === undefined) {
|
|
2844
|
+
this._assetsRelatedIn.set(name, (relatedIn = new Map()));
|
|
2845
|
+
}
|
|
2846
|
+
let entry = relatedIn.get(key);
|
|
2847
|
+
if (entry === undefined) {
|
|
2848
|
+
relatedIn.set(key, (entry = new Set()));
|
|
2849
|
+
}
|
|
2850
|
+
entry.add(file);
|
|
2851
|
+
};
|
|
2852
|
+
const entry = newRelated[key];
|
|
2853
|
+
if (Array.isArray(entry)) {
|
|
2854
|
+
entry.forEach(add);
|
|
2855
|
+
}
|
|
2856
|
+
else if (entry) {
|
|
2857
|
+
add(entry);
|
|
2858
|
+
}
|
|
2859
|
+
}
|
|
2860
|
+
}
|
|
2861
|
+
}
|
|
2862
|
+
updateAsset(file, newSourceOrFunction, assetInfoUpdateOrFunction = undefined) {
|
|
2863
|
+
if (!this.assets[file]) {
|
|
2864
|
+
throw new Error(`Called Compilation.updateAsset for not existing filename ${file}`);
|
|
2865
|
+
}
|
|
2866
|
+
if (typeof newSourceOrFunction === 'function') {
|
|
2867
|
+
this.assets[file] = newSourceOrFunction(this.assets[file]);
|
|
2868
|
+
}
|
|
2869
|
+
else {
|
|
2870
|
+
this.assets[file] = newSourceOrFunction;
|
|
2871
|
+
}
|
|
2872
|
+
if (assetInfoUpdateOrFunction !== undefined) {
|
|
2873
|
+
const oldInfo = this.assetsInfo.get(file) || EMPTY_ASSET_INFO;
|
|
2874
|
+
if (typeof assetInfoUpdateOrFunction === 'function') {
|
|
2875
|
+
this._setAssetInfo(file, assetInfoUpdateOrFunction(oldInfo), oldInfo);
|
|
2876
|
+
}
|
|
2877
|
+
else {
|
|
2878
|
+
this._setAssetInfo(file, (0, cleverMerge_1.cachedCleverMerge)(oldInfo, assetInfoUpdateOrFunction), oldInfo);
|
|
2879
|
+
}
|
|
2880
|
+
}
|
|
2881
|
+
}
|
|
2882
|
+
renameAsset(file, newFile) {
|
|
2883
|
+
const source = this.assets[file];
|
|
2884
|
+
if (!source) {
|
|
2885
|
+
throw new Error(`Called Compilation.renameAsset for not existing filename ${file}`);
|
|
2886
|
+
}
|
|
2887
|
+
if (this.assets[newFile]) {
|
|
2888
|
+
if (!(0, source_1.isSourceEqual)(this.assets[file], source)) {
|
|
2889
|
+
this.errors.push(new BaseError_1.default(`Conflict: Called Compilation.renameAsset for already existing filename ${newFile} with different content`));
|
|
2890
|
+
}
|
|
2891
|
+
}
|
|
2892
|
+
const assetInfo = this.assetsInfo.get(file);
|
|
2893
|
+
// Update related in all other assets
|
|
2894
|
+
const relatedInInfo = this._assetsRelatedIn.get(file);
|
|
2895
|
+
if (relatedInInfo) {
|
|
2896
|
+
for (const [key, assets] of relatedInInfo) {
|
|
2897
|
+
for (const name of assets) {
|
|
2898
|
+
const info = this.assetsInfo.get(name);
|
|
2899
|
+
if (!info)
|
|
2900
|
+
continue;
|
|
2901
|
+
const related = info.related;
|
|
2902
|
+
if (!related)
|
|
2903
|
+
continue;
|
|
2904
|
+
const entry = related[key];
|
|
2905
|
+
let newEntry;
|
|
2906
|
+
if (Array.isArray(entry)) {
|
|
2907
|
+
newEntry = entry.map(x => (x === file ? newFile : x));
|
|
2908
|
+
}
|
|
2909
|
+
else if (entry === file) {
|
|
2910
|
+
newEntry = newFile;
|
|
2911
|
+
}
|
|
2912
|
+
else
|
|
2913
|
+
continue;
|
|
2914
|
+
this.assetsInfo.set(name, Object.assign(Object.assign({}, info), { related: Object.assign(Object.assign({}, related), { [key]: newEntry }) }));
|
|
2915
|
+
}
|
|
2916
|
+
}
|
|
2917
|
+
}
|
|
2918
|
+
this._setAssetInfo(file, undefined, assetInfo);
|
|
2919
|
+
this._setAssetInfo(newFile, assetInfo);
|
|
2920
|
+
delete this.assets[file];
|
|
2921
|
+
this.assets[newFile] = source;
|
|
2922
|
+
for (const chunk of this.chunks) {
|
|
2923
|
+
{
|
|
2924
|
+
const size = chunk.files.size;
|
|
2925
|
+
chunk.files.delete(file);
|
|
2926
|
+
if (size !== chunk.files.size) {
|
|
2927
|
+
chunk.files.add(newFile);
|
|
2928
|
+
}
|
|
2929
|
+
}
|
|
2930
|
+
{
|
|
2931
|
+
const size = chunk.auxiliaryFiles.size;
|
|
2932
|
+
chunk.auxiliaryFiles.delete(file);
|
|
2933
|
+
if (size !== chunk.auxiliaryFiles.size) {
|
|
2934
|
+
chunk.auxiliaryFiles.add(newFile);
|
|
2935
|
+
}
|
|
2936
|
+
}
|
|
2937
|
+
}
|
|
2938
|
+
}
|
|
2939
|
+
deleteAsset(file) {
|
|
2940
|
+
if (!this.assets[file]) {
|
|
2941
|
+
return;
|
|
2942
|
+
}
|
|
2943
|
+
delete this.assets[file];
|
|
2944
|
+
const assetInfo = this.assetsInfo.get(file);
|
|
2945
|
+
this._setAssetInfo(file, undefined, assetInfo);
|
|
2946
|
+
const related = assetInfo === null || assetInfo === void 0 ? void 0 : assetInfo.related;
|
|
2947
|
+
if (related) {
|
|
2948
|
+
for (const key of Object.keys(related)) {
|
|
2949
|
+
const checkUsedAndDelete = file => {
|
|
2950
|
+
if (!this._assetsRelatedIn.has(file)) {
|
|
2951
|
+
this.deleteAsset(file);
|
|
2952
|
+
}
|
|
2953
|
+
};
|
|
2954
|
+
const items = related[key];
|
|
2955
|
+
if (Array.isArray(items)) {
|
|
2956
|
+
items.forEach(checkUsedAndDelete);
|
|
2957
|
+
}
|
|
2958
|
+
else if (items) {
|
|
2959
|
+
checkUsedAndDelete(items);
|
|
2960
|
+
}
|
|
2961
|
+
}
|
|
2962
|
+
}
|
|
2963
|
+
// TODO If this becomes a performance problem
|
|
2964
|
+
// store a reverse mapping from asset to chunk
|
|
2965
|
+
for (const chunk of this.chunks) {
|
|
2966
|
+
chunk.files.delete(file);
|
|
2967
|
+
chunk.auxiliaryFiles.delete(file);
|
|
2968
|
+
}
|
|
2969
|
+
}
|
|
2970
|
+
getAssets() {
|
|
2971
|
+
const array = [];
|
|
2972
|
+
for (const assetName of Object.keys(this.assets)) {
|
|
2973
|
+
if (Object.prototype.hasOwnProperty.call(this.assets, assetName)) {
|
|
2974
|
+
array.push({
|
|
2975
|
+
name: assetName,
|
|
2976
|
+
source: this.assets[assetName],
|
|
2977
|
+
info: this.assetsInfo.get(assetName) || EMPTY_ASSET_INFO,
|
|
2978
|
+
});
|
|
2979
|
+
}
|
|
2980
|
+
}
|
|
2981
|
+
return array;
|
|
2982
|
+
}
|
|
2983
|
+
getAsset(name) {
|
|
2984
|
+
if (!Object.prototype.hasOwnProperty.call(this.assets, name))
|
|
2985
|
+
return undefined;
|
|
2986
|
+
return {
|
|
2987
|
+
name,
|
|
2988
|
+
source: this.assets[name],
|
|
2989
|
+
info: this.assetsInfo.get(name) || EMPTY_ASSET_INFO,
|
|
2990
|
+
};
|
|
2991
|
+
}
|
|
2992
|
+
clearAssets() {
|
|
2993
|
+
for (const chunk of this.chunks) {
|
|
2994
|
+
chunk.files.clear();
|
|
2995
|
+
chunk.auxiliaryFiles.clear();
|
|
2996
|
+
}
|
|
2997
|
+
}
|
|
2998
|
+
createModuleAssets() {
|
|
2999
|
+
const { chunkGraph } = this;
|
|
3000
|
+
for (const module of this.modules) {
|
|
3001
|
+
if (module.buildInfo.assets) {
|
|
3002
|
+
const assetsInfo = module.buildInfo.assetsInfo;
|
|
3003
|
+
for (const assetName of Object.keys(module.buildInfo.assets)) {
|
|
3004
|
+
const fileName = this.getPath(assetName, {
|
|
3005
|
+
chunkGraph: this.chunkGraph,
|
|
3006
|
+
module,
|
|
3007
|
+
});
|
|
3008
|
+
for (const chunk of chunkGraph.getModuleChunksIterable(module)) {
|
|
3009
|
+
chunk.auxiliaryFiles.add(fileName);
|
|
3010
|
+
}
|
|
3011
|
+
this.emitAsset(fileName, module.buildInfo.assets[assetName], assetsInfo ? assetsInfo.get(assetName) : undefined);
|
|
3012
|
+
this.hooks.moduleAsset.call(module, fileName);
|
|
3013
|
+
}
|
|
3014
|
+
}
|
|
3015
|
+
}
|
|
3016
|
+
}
|
|
3017
|
+
getRenderManifest(options) {
|
|
3018
|
+
return this.hooks.renderManifest.call([], options);
|
|
3019
|
+
}
|
|
3020
|
+
createChunkAssets(callback) {
|
|
3021
|
+
const outputOptions = this.outputOptions;
|
|
3022
|
+
const cachedSourceMap = new WeakMap();
|
|
3023
|
+
const alreadyWrittenFiles = new Map();
|
|
3024
|
+
neo_async_1.default.forEachLimit(this.chunks, 15, (chunk, callback) => {
|
|
3025
|
+
let manifest;
|
|
3026
|
+
try {
|
|
3027
|
+
manifest = this.getRenderManifest({
|
|
3028
|
+
chunk,
|
|
3029
|
+
hash: this.hash,
|
|
3030
|
+
fullHash: this.fullHash,
|
|
3031
|
+
outputOptions,
|
|
3032
|
+
codeGenerationResults: this.codeGenerationResults,
|
|
3033
|
+
moduleTemplates: this.moduleTemplates,
|
|
3034
|
+
dependencyTemplates: this.dependencyTemplates,
|
|
3035
|
+
chunkGraph: this.chunkGraph,
|
|
3036
|
+
moduleGraph: this.moduleGraph,
|
|
3037
|
+
runtimeTemplate: this.runtimeTemplate,
|
|
3038
|
+
});
|
|
3039
|
+
}
|
|
3040
|
+
catch (err) {
|
|
3041
|
+
this.errors.push(new ChunkRenderError_1.default(chunk, '', err));
|
|
3042
|
+
return callback();
|
|
3043
|
+
}
|
|
3044
|
+
neo_async_1.default.forEach(manifest, (fileManifest, callback) => {
|
|
3045
|
+
const ident = fileManifest.identifier;
|
|
3046
|
+
const usedHash = fileManifest.hash;
|
|
3047
|
+
const assetCacheItem = this._assetsCache.getItemCache(ident, usedHash);
|
|
3048
|
+
assetCacheItem.get((err, sourceFromCache) => {
|
|
3049
|
+
let filenameTemplate;
|
|
3050
|
+
let file;
|
|
3051
|
+
let assetInfo;
|
|
3052
|
+
let inTry = true;
|
|
3053
|
+
const errorAndCallback = err => {
|
|
3054
|
+
const filename = file ||
|
|
3055
|
+
(typeof file === 'string'
|
|
3056
|
+
? file
|
|
3057
|
+
: typeof filenameTemplate === 'string'
|
|
3058
|
+
? filenameTemplate
|
|
3059
|
+
: '');
|
|
3060
|
+
this.errors.push(new ChunkRenderError_1.default(chunk, filename, err));
|
|
3061
|
+
inTry = false;
|
|
3062
|
+
return callback();
|
|
3063
|
+
};
|
|
3064
|
+
try {
|
|
3065
|
+
if ('filename' in fileManifest) {
|
|
3066
|
+
file = fileManifest.filename;
|
|
3067
|
+
assetInfo = fileManifest.info;
|
|
3068
|
+
}
|
|
3069
|
+
else {
|
|
3070
|
+
filenameTemplate = fileManifest.filenameTemplate;
|
|
3071
|
+
const pathAndInfo = this.getPathWithInfo(filenameTemplate, fileManifest.pathOptions);
|
|
3072
|
+
file = pathAndInfo.path;
|
|
3073
|
+
assetInfo = fileManifest.info
|
|
3074
|
+
? Object.assign(Object.assign({}, pathAndInfo.info), fileManifest.info) : pathAndInfo.info;
|
|
3075
|
+
}
|
|
3076
|
+
if (err) {
|
|
3077
|
+
return errorAndCallback(err);
|
|
3078
|
+
}
|
|
3079
|
+
let source = sourceFromCache;
|
|
3080
|
+
// check if the same filename was already written by another chunk
|
|
3081
|
+
const alreadyWritten = alreadyWrittenFiles.get(file);
|
|
3082
|
+
if (alreadyWritten !== undefined) {
|
|
3083
|
+
if (alreadyWritten.hash !== usedHash) {
|
|
3084
|
+
inTry = false;
|
|
3085
|
+
return callback(new BaseError_1.default(`Conflict: Multiple chunks emit assets to the same filename ${file}` +
|
|
3086
|
+
` (chunks ${alreadyWritten.chunk.id} and ${chunk.id})`));
|
|
3087
|
+
}
|
|
3088
|
+
source = alreadyWritten.source;
|
|
3089
|
+
}
|
|
3090
|
+
else if (!source) {
|
|
3091
|
+
// render the asset
|
|
3092
|
+
source = fileManifest.render();
|
|
3093
|
+
// Ensure that source is a cached source to avoid additional cost because of repeated access
|
|
3094
|
+
if (!(source instanceof webpack_sources_1.CachedSource)) {
|
|
3095
|
+
const cacheEntry = cachedSourceMap.get(source);
|
|
3096
|
+
if (cacheEntry) {
|
|
3097
|
+
source = cacheEntry;
|
|
3098
|
+
}
|
|
3099
|
+
else {
|
|
3100
|
+
const cachedSource = new webpack_sources_1.CachedSource(source);
|
|
3101
|
+
cachedSourceMap.set(source, cachedSource);
|
|
3102
|
+
source = cachedSource;
|
|
3103
|
+
}
|
|
3104
|
+
}
|
|
3105
|
+
}
|
|
3106
|
+
this.emitAsset(file, source, assetInfo);
|
|
3107
|
+
if (fileManifest.auxiliary) {
|
|
3108
|
+
chunk.auxiliaryFiles.add(file);
|
|
3109
|
+
}
|
|
3110
|
+
else {
|
|
3111
|
+
chunk.files.add(file);
|
|
3112
|
+
}
|
|
3113
|
+
this.hooks.chunkAsset.call(chunk, file);
|
|
3114
|
+
alreadyWrittenFiles.set(file, {
|
|
3115
|
+
hash: usedHash,
|
|
3116
|
+
source,
|
|
3117
|
+
chunk,
|
|
3118
|
+
});
|
|
3119
|
+
if (source !== sourceFromCache) {
|
|
3120
|
+
assetCacheItem.store(source, err => {
|
|
3121
|
+
if (err)
|
|
3122
|
+
return errorAndCallback(err);
|
|
3123
|
+
inTry = false;
|
|
3124
|
+
return callback();
|
|
3125
|
+
});
|
|
3126
|
+
}
|
|
3127
|
+
else {
|
|
3128
|
+
inTry = false;
|
|
3129
|
+
callback();
|
|
3130
|
+
}
|
|
3131
|
+
}
|
|
3132
|
+
catch (err) {
|
|
3133
|
+
if (!inTry)
|
|
3134
|
+
throw err;
|
|
3135
|
+
errorAndCallback(err);
|
|
3136
|
+
}
|
|
3137
|
+
});
|
|
3138
|
+
}, callback);
|
|
3139
|
+
}, callback);
|
|
3140
|
+
}
|
|
3141
|
+
getPath(filename, data = {}) {
|
|
3142
|
+
if (!data.hash) {
|
|
3143
|
+
data = Object.assign({ hash: this.hash }, data);
|
|
3144
|
+
}
|
|
3145
|
+
return this.getAssetPath(filename, data);
|
|
3146
|
+
}
|
|
3147
|
+
getPathWithInfo(filename, data = {}) {
|
|
3148
|
+
if (!data.hash) {
|
|
3149
|
+
data = Object.assign({ hash: this.hash }, data);
|
|
3150
|
+
}
|
|
3151
|
+
return this.getAssetPathWithInfo(filename, data);
|
|
3152
|
+
}
|
|
3153
|
+
getAssetPath(filename, data) {
|
|
3154
|
+
return this.hooks.assetPath.call(typeof filename === 'function' ? filename(data) : filename, data, undefined);
|
|
3155
|
+
}
|
|
3156
|
+
getAssetPathWithInfo(filename, data) {
|
|
3157
|
+
const assetInfo = {};
|
|
3158
|
+
// TODO webpack 5: refactor assetPath hook to receive { path, info } object
|
|
3159
|
+
const newPath = this.hooks.assetPath.call(typeof filename === 'function' ? filename(data, assetInfo) : filename, data, assetInfo);
|
|
3160
|
+
return { path: newPath, info: assetInfo };
|
|
3161
|
+
}
|
|
3162
|
+
getWarnings() {
|
|
3163
|
+
return this.hooks.processWarnings.call(this.warnings);
|
|
3164
|
+
}
|
|
3165
|
+
getErrors() {
|
|
3166
|
+
return this.hooks.processErrors.call(this.errors);
|
|
3167
|
+
}
|
|
3168
|
+
/**
|
|
3169
|
+
* This function allows you to run another instance of webpack inside of webpack however as
|
|
3170
|
+
* a child with different settings and configurations (if desired) applied. It copies all hooks, plugins
|
|
3171
|
+
* from parent (or top level compiler) and creates a child Compilation
|
|
3172
|
+
*/
|
|
3173
|
+
createChildCompiler(name, outputOptions, plugins) {
|
|
3174
|
+
const idx = this.childrenCounters[name] || 0;
|
|
3175
|
+
this.childrenCounters[name] = idx + 1;
|
|
3176
|
+
return this.compiler.createChildCompiler(this, name, idx, outputOptions, plugins);
|
|
3177
|
+
}
|
|
3178
|
+
executeModule(module, options, callback) {
|
|
3179
|
+
// Aggregate all referenced modules and ensure they are ready
|
|
3180
|
+
const modules = new Set([module]);
|
|
3181
|
+
(0, processAsyncTree_1.default)(modules, 10, (module, push, callback) => {
|
|
3182
|
+
this.buildQueue.waitFor(module, err => {
|
|
3183
|
+
if (err)
|
|
3184
|
+
return callback(err);
|
|
3185
|
+
this.processDependenciesQueue.waitFor(module, err => {
|
|
3186
|
+
if (err)
|
|
3187
|
+
return callback(err);
|
|
3188
|
+
for (const { module: m } of this.moduleGraph.getOutgoingConnections(module)) {
|
|
3189
|
+
const size = modules.size;
|
|
3190
|
+
modules.add(m);
|
|
3191
|
+
if (modules.size !== size)
|
|
3192
|
+
push(m);
|
|
3193
|
+
}
|
|
3194
|
+
callback();
|
|
3195
|
+
});
|
|
3196
|
+
});
|
|
3197
|
+
}, err => {
|
|
3198
|
+
if (err)
|
|
3199
|
+
return callback(err);
|
|
3200
|
+
// Create new chunk graph, chunk and entrypoint for the build time execution
|
|
3201
|
+
const chunkGraph = new ChunkGraph_1.default(this.moduleGraph, this.outputOptions.hashFunction);
|
|
3202
|
+
const runtime = 'build time';
|
|
3203
|
+
const { hashFunction, hashDigest, hashDigestLength } = this.outputOptions;
|
|
3204
|
+
const runtimeTemplate = this.runtimeTemplate;
|
|
3205
|
+
const chunk = new Chunk_1.default('build time chunk', this._backCompat);
|
|
3206
|
+
chunk.id = chunk.name;
|
|
3207
|
+
chunk.ids = [chunk.id];
|
|
3208
|
+
chunk.runtime = runtime;
|
|
3209
|
+
const entrypoint = new Entrypoint_1.default(Object.assign({ runtime, chunkLoading: false }, options.entryOptions));
|
|
3210
|
+
chunkGraph.connectChunkAndEntryModule(chunk, module, entrypoint);
|
|
3211
|
+
(0, GraphHelpers_1.connectChunkGroupAndChunk)(entrypoint, chunk);
|
|
3212
|
+
entrypoint.setRuntimeChunk(chunk);
|
|
3213
|
+
entrypoint.setEntrypointChunk(chunk);
|
|
3214
|
+
const chunks = new Set([chunk]);
|
|
3215
|
+
// Assign ids to modules and modules to the chunk
|
|
3216
|
+
for (const module of modules) {
|
|
3217
|
+
const id = module.identifier();
|
|
3218
|
+
chunkGraph.setModuleId(module, id);
|
|
3219
|
+
chunkGraph.connectChunkAndModule(chunk, module);
|
|
3220
|
+
}
|
|
3221
|
+
const errors = [];
|
|
3222
|
+
// Hash modules
|
|
3223
|
+
for (const module of modules) {
|
|
3224
|
+
this._createModuleHash(module, chunkGraph, runtime, hashFunction, runtimeTemplate, hashDigest, hashDigestLength, errors);
|
|
3225
|
+
}
|
|
3226
|
+
const codeGenerationResults = new CodeGenerationResults_1.default(this.outputOptions.hashFunction);
|
|
3227
|
+
const codeGen = (module, callback) => {
|
|
3228
|
+
this._codeGenerationModule(module, runtime, [runtime], chunkGraph.getModuleHash(module, runtime), this.dependencyTemplates, chunkGraph, this.moduleGraph, runtimeTemplate, errors, codeGenerationResults, (err, codeGenerated) => {
|
|
3229
|
+
callback(err);
|
|
3230
|
+
});
|
|
3231
|
+
};
|
|
3232
|
+
const reportErrors = () => {
|
|
3233
|
+
if (errors.length > 0) {
|
|
3234
|
+
errors.sort((0, comparators_1.compareSelect)(err => err.module, comparators_1.compareModulesByIdentifier));
|
|
3235
|
+
for (const error of errors) {
|
|
3236
|
+
this.errors.push(error);
|
|
3237
|
+
}
|
|
3238
|
+
errors.length = 0;
|
|
3239
|
+
}
|
|
3240
|
+
};
|
|
3241
|
+
// Generate code for all aggregated modules
|
|
3242
|
+
neo_async_1.default.eachLimit(modules, 10, codeGen, err => {
|
|
3243
|
+
if (err)
|
|
3244
|
+
return callback(err);
|
|
3245
|
+
reportErrors();
|
|
3246
|
+
// for backward-compat temporary set the chunk graph
|
|
3247
|
+
const old = this.chunkGraph;
|
|
3248
|
+
this.chunkGraph = chunkGraph;
|
|
3249
|
+
this.processRuntimeRequirements({
|
|
3250
|
+
chunkGraph,
|
|
3251
|
+
modules,
|
|
3252
|
+
chunks,
|
|
3253
|
+
codeGenerationResults,
|
|
3254
|
+
chunkGraphEntries: chunks,
|
|
3255
|
+
});
|
|
3256
|
+
this.chunkGraph = old;
|
|
3257
|
+
const runtimeModules = chunkGraph.getChunkRuntimeModulesIterable(chunk);
|
|
3258
|
+
// Hash runtime modules
|
|
3259
|
+
for (const module of runtimeModules) {
|
|
3260
|
+
modules.add(module);
|
|
3261
|
+
this._createModuleHash(module, chunkGraph, runtime, hashFunction, runtimeTemplate, hashDigest, hashDigestLength);
|
|
3262
|
+
}
|
|
3263
|
+
// Generate code for all runtime modules
|
|
3264
|
+
neo_async_1.default.eachLimit(runtimeModules, 10, codeGen, err => {
|
|
3265
|
+
if (err)
|
|
3266
|
+
return callback(err);
|
|
3267
|
+
reportErrors();
|
|
3268
|
+
const moduleArgumentsMap = new Map();
|
|
3269
|
+
const moduleArgumentsById = new Map();
|
|
3270
|
+
const fileDependencies = new LazySet_1.default();
|
|
3271
|
+
const contextDependencies = new LazySet_1.default();
|
|
3272
|
+
const missingDependencies = new LazySet_1.default();
|
|
3273
|
+
const buildDependencies = new LazySet_1.default();
|
|
3274
|
+
const assets = new Map();
|
|
3275
|
+
let cacheable = true;
|
|
3276
|
+
const context = {
|
|
3277
|
+
assets,
|
|
3278
|
+
__webpack_require__: undefined,
|
|
3279
|
+
chunk,
|
|
3280
|
+
chunkGraph,
|
|
3281
|
+
};
|
|
3282
|
+
// Prepare execution
|
|
3283
|
+
neo_async_1.default.eachLimit(modules, 10, (module, callback) => {
|
|
3284
|
+
var _a;
|
|
3285
|
+
const codeGenerationResult = codeGenerationResults.get(module, runtime);
|
|
3286
|
+
const moduleArgument = {
|
|
3287
|
+
module,
|
|
3288
|
+
codeGenerationResult,
|
|
3289
|
+
preparedInfo: undefined,
|
|
3290
|
+
moduleObject: undefined,
|
|
3291
|
+
};
|
|
3292
|
+
moduleArgumentsMap.set(module, moduleArgument);
|
|
3293
|
+
moduleArgumentsById.set(module.identifier(), moduleArgument);
|
|
3294
|
+
module.addCacheDependencies(fileDependencies, contextDependencies, missingDependencies, buildDependencies);
|
|
3295
|
+
if (module.buildInfo.cacheable === false) {
|
|
3296
|
+
cacheable = false;
|
|
3297
|
+
}
|
|
3298
|
+
if ((_a = module.buildInfo) === null || _a === void 0 ? void 0 : _a.assets) {
|
|
3299
|
+
const { assets: moduleAssets, assetsInfo } = module.buildInfo;
|
|
3300
|
+
for (const assetName of Object.keys(moduleAssets)) {
|
|
3301
|
+
assets.set(assetName, {
|
|
3302
|
+
source: moduleAssets[assetName],
|
|
3303
|
+
info: assetsInfo ? assetsInfo.get(assetName) : undefined,
|
|
3304
|
+
});
|
|
3305
|
+
}
|
|
3306
|
+
}
|
|
3307
|
+
this.hooks.prepareModuleExecution.callAsync(moduleArgument, context, callback);
|
|
3308
|
+
}, err => {
|
|
3309
|
+
if (err)
|
|
3310
|
+
return callback(err);
|
|
3311
|
+
let exports;
|
|
3312
|
+
try {
|
|
3313
|
+
const { strictModuleErrorHandling, strictModuleExceptionHandling } = this.outputOptions;
|
|
3314
|
+
// eslint-disable-next-line camelcase
|
|
3315
|
+
const __webpack_require__ = id => {
|
|
3316
|
+
const cached = moduleCache[id];
|
|
3317
|
+
if (cached !== undefined) {
|
|
3318
|
+
if (cached.error)
|
|
3319
|
+
throw cached.error;
|
|
3320
|
+
return cached.exports;
|
|
3321
|
+
}
|
|
3322
|
+
const moduleArgument = moduleArgumentsById.get(id);
|
|
3323
|
+
return __webpack_require_module__(moduleArgument, id);
|
|
3324
|
+
};
|
|
3325
|
+
const interceptModuleExecution = (__webpack_require__[RuntimeGlobals.interceptModuleExecution.replace(`${RuntimeGlobals.require}.`, '')] = []);
|
|
3326
|
+
const moduleCache = (__webpack_require__[RuntimeGlobals.moduleCache.replace(`${RuntimeGlobals.require}.`, '')] = {});
|
|
3327
|
+
// eslint-disable-next-line camelcase
|
|
3328
|
+
context.__webpack_require__ = __webpack_require__;
|
|
3329
|
+
// eslint-disable-next-line camelcase
|
|
3330
|
+
const __webpack_require_module__ = (moduleArgument, id) => {
|
|
3331
|
+
const execOptions = {
|
|
3332
|
+
id,
|
|
3333
|
+
module: {
|
|
3334
|
+
id,
|
|
3335
|
+
exports: {},
|
|
3336
|
+
loaded: false,
|
|
3337
|
+
error: undefined,
|
|
3338
|
+
},
|
|
3339
|
+
require: __webpack_require__,
|
|
3340
|
+
};
|
|
3341
|
+
interceptModuleExecution.forEach((handler) => handler(execOptions));
|
|
3342
|
+
const module = moduleArgument.module;
|
|
3343
|
+
this.buildTimeExecutedModules.add(module);
|
|
3344
|
+
const moduleObject = execOptions.module;
|
|
3345
|
+
moduleArgument.moduleObject = moduleObject;
|
|
3346
|
+
try {
|
|
3347
|
+
if (id)
|
|
3348
|
+
moduleCache[id] = moduleObject;
|
|
3349
|
+
(0, HookBaseError_1.tryRunOrBaseError)(() => this.hooks.executeModule.call(moduleArgument, context), 'Compilation.hooks.executeModule');
|
|
3350
|
+
moduleObject.loaded = true;
|
|
3351
|
+
return moduleObject.exports;
|
|
3352
|
+
}
|
|
3353
|
+
catch (e) {
|
|
3354
|
+
if (strictModuleExceptionHandling) {
|
|
3355
|
+
if (id)
|
|
3356
|
+
delete moduleCache[id];
|
|
3357
|
+
}
|
|
3358
|
+
else if (strictModuleErrorHandling) {
|
|
3359
|
+
moduleObject.error = e;
|
|
3360
|
+
}
|
|
3361
|
+
if (!e.module)
|
|
3362
|
+
e.module = module;
|
|
3363
|
+
throw e;
|
|
3364
|
+
}
|
|
3365
|
+
};
|
|
3366
|
+
for (const runtimeModule of chunkGraph.getChunkRuntimeModulesInOrder(chunk)) {
|
|
3367
|
+
__webpack_require_module__(moduleArgumentsMap.get(runtimeModule));
|
|
3368
|
+
}
|
|
3369
|
+
exports = __webpack_require__(module.identifier());
|
|
3370
|
+
}
|
|
3371
|
+
catch (e) {
|
|
3372
|
+
const err = new BaseError_1.default(`Execution of module code from module graph (${module.readableIdentifier(this.requestShortener)}) failed: ${e.message}`);
|
|
3373
|
+
err.stack = e.stack;
|
|
3374
|
+
err.module = e.module;
|
|
3375
|
+
return callback(err);
|
|
3376
|
+
}
|
|
3377
|
+
callback(null, {
|
|
3378
|
+
exports,
|
|
3379
|
+
assets,
|
|
3380
|
+
cacheable,
|
|
3381
|
+
fileDependencies,
|
|
3382
|
+
contextDependencies,
|
|
3383
|
+
missingDependencies,
|
|
3384
|
+
buildDependencies,
|
|
3385
|
+
});
|
|
3386
|
+
});
|
|
3387
|
+
});
|
|
3388
|
+
});
|
|
3389
|
+
});
|
|
3390
|
+
}
|
|
3391
|
+
checkConstraints() {
|
|
3392
|
+
const chunkGraph = this.chunkGraph;
|
|
3393
|
+
const usedIds = new Set();
|
|
3394
|
+
for (const module of this.modules) {
|
|
3395
|
+
if (module.type === ModuleTypeConstants_1.WEBPACK_MODULE_TYPE_RUNTIME)
|
|
3396
|
+
continue;
|
|
3397
|
+
const moduleId = chunkGraph.getModuleId(module);
|
|
3398
|
+
if (moduleId === null)
|
|
3399
|
+
continue;
|
|
3400
|
+
if (usedIds.has(moduleId)) {
|
|
3401
|
+
throw new Error(`checkConstraints: duplicate module id ${moduleId}`);
|
|
3402
|
+
}
|
|
3403
|
+
usedIds.add(moduleId);
|
|
3404
|
+
}
|
|
3405
|
+
for (const chunk of this.chunks) {
|
|
3406
|
+
for (const module of chunkGraph.getChunkModulesIterable(chunk)) {
|
|
3407
|
+
if (!this.modules.has(module)) {
|
|
3408
|
+
throw new Error('checkConstraints: module in chunk but not in compilation ' +
|
|
3409
|
+
` ${chunk.debugId} ${module.debugId}`);
|
|
3410
|
+
}
|
|
3411
|
+
}
|
|
3412
|
+
for (const module of chunkGraph.getChunkEntryModulesIterable(chunk)) {
|
|
3413
|
+
if (!this.modules.has(module)) {
|
|
3414
|
+
throw new Error('checkConstraints: entry module in chunk but not in compilation ' +
|
|
3415
|
+
` ${chunk.debugId} ${module.debugId}`);
|
|
3416
|
+
}
|
|
3417
|
+
}
|
|
3418
|
+
}
|
|
3419
|
+
for (const chunkGroup of this.chunkGroups) {
|
|
3420
|
+
chunkGroup.checkConstraints();
|
|
3421
|
+
}
|
|
3422
|
+
}
|
|
3423
|
+
}
|
|
3424
|
+
// Workaround for typescript as it doesn't support function overloading in jsdoc within a class
|
|
3425
|
+
// @ts-ignore
|
|
3426
|
+
Compilation.prototype.factorizeModule = function (options, callback) {
|
|
3427
|
+
this.factorizeQueue.add(options, callback);
|
|
3428
|
+
};
|
|
3429
|
+
// Hide from typescript
|
|
3430
|
+
const compilationPrototype = Compilation.prototype;
|
|
3431
|
+
Object.defineProperty(compilationPrototype, 'modifyHash', {
|
|
3432
|
+
writable: false,
|
|
3433
|
+
enumerable: false,
|
|
3434
|
+
configurable: false,
|
|
3435
|
+
value: () => {
|
|
3436
|
+
throw new Error('Compilation.modifyHash was removed in favor of Compilation.hooks.fullHash');
|
|
3437
|
+
},
|
|
3438
|
+
});
|
|
3439
|
+
Object.defineProperty(compilationPrototype, 'cache', {
|
|
3440
|
+
enumerable: false,
|
|
3441
|
+
configurable: false,
|
|
3442
|
+
get: util_1.default.deprecate(function () {
|
|
3443
|
+
return this.compiler.cache;
|
|
3444
|
+
}, 'Compilation.cache was removed in favor of Compilation.getCache()', 'DEP_WEBPACK_COMPILATION_CACHE'),
|
|
3445
|
+
set: util_1.default.deprecate(v => { }, 'Compilation.cache was removed in favor of Compilation.getCache()', 'DEP_WEBPACK_COMPILATION_CACHE'),
|
|
3446
|
+
});
|
|
3447
|
+
/**
|
|
3448
|
+
* Add additional assets to the compilation.
|
|
3449
|
+
*/
|
|
3450
|
+
Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL = -2000;
|
|
3451
|
+
/**
|
|
3452
|
+
* Basic preprocessing of assets.
|
|
3453
|
+
*/
|
|
3454
|
+
Compilation.PROCESS_ASSETS_STAGE_PRE_PROCESS = -1000;
|
|
3455
|
+
/**
|
|
3456
|
+
* Derive new assets from existing assets.
|
|
3457
|
+
* Existing assets should not be treated as complete.
|
|
3458
|
+
*/
|
|
3459
|
+
Compilation.PROCESS_ASSETS_STAGE_DERIVED = -200;
|
|
3460
|
+
/**
|
|
3461
|
+
* Add additional sections to existing assets, like a banner or initialization code.
|
|
3462
|
+
*/
|
|
3463
|
+
Compilation.PROCESS_ASSETS_STAGE_ADDITIONS = -100;
|
|
3464
|
+
/**
|
|
3465
|
+
* Optimize existing assets in a general way.
|
|
3466
|
+
*/
|
|
3467
|
+
Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE = 100;
|
|
3468
|
+
/**
|
|
3469
|
+
* Optimize the count of existing assets, e. g. by merging them.
|
|
3470
|
+
* Only assets of the same type should be merged.
|
|
3471
|
+
* For assets of different types see PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE.
|
|
3472
|
+
*/
|
|
3473
|
+
Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COUNT = 200;
|
|
3474
|
+
/**
|
|
3475
|
+
* Optimize the compatibility of existing assets, e. g. add polyfills or vendor-prefixes.
|
|
3476
|
+
*/
|
|
3477
|
+
Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_COMPATIBILITY = 300;
|
|
3478
|
+
/**
|
|
3479
|
+
* Optimize the size of existing assets, e. g. by minimizing or omitting whitespace.
|
|
3480
|
+
*/
|
|
3481
|
+
Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE = 400;
|
|
3482
|
+
/**
|
|
3483
|
+
* Add development tooling to assets, e. g. by extracting a SourceMap.
|
|
3484
|
+
*/
|
|
3485
|
+
Compilation.PROCESS_ASSETS_STAGE_DEV_TOOLING = 500;
|
|
3486
|
+
/**
|
|
3487
|
+
* Optimize the count of existing assets, e. g. by inlining assets of into other assets.
|
|
3488
|
+
* Only assets of different types should be inlined.
|
|
3489
|
+
* For assets of the same type see PROCESS_ASSETS_STAGE_OPTIMIZE_COUNT.
|
|
3490
|
+
*/
|
|
3491
|
+
Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE = 700;
|
|
3492
|
+
/**
|
|
3493
|
+
* Summarize the list of existing assets
|
|
3494
|
+
* e. g. creating an assets manifest of Service Workers.
|
|
3495
|
+
*/
|
|
3496
|
+
Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE = 1000;
|
|
3497
|
+
/**
|
|
3498
|
+
* Optimize the hashes of the assets, e. g. by generating real hashes of the asset content.
|
|
3499
|
+
*/
|
|
3500
|
+
Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_HASH = 2500;
|
|
3501
|
+
/**
|
|
3502
|
+
* Optimize the transfer of existing assets, e. g. by preparing a compressed (gzip) file as separate asset.
|
|
3503
|
+
*/
|
|
3504
|
+
Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER = 3000;
|
|
3505
|
+
/**
|
|
3506
|
+
* Analyse existing assets.
|
|
3507
|
+
*/
|
|
3508
|
+
Compilation.PROCESS_ASSETS_STAGE_ANALYSE = 4000;
|
|
3509
|
+
/**
|
|
3510
|
+
* Creating assets for reporting purposes.
|
|
3511
|
+
*/
|
|
3512
|
+
Compilation.PROCESS_ASSETS_STAGE_REPORT = 5000;
|
|
3513
|
+
exports.default = Compilation;
|