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,1085 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const FileSystemInfo_1 = require("@/FileSystemInfo");
|
|
16
|
+
const ProgressPlugin_1 = __importDefault(require("@/plugins/ProgressPlugin"));
|
|
17
|
+
const SizeFormatHelpers_1 = require("@/base/SizeFormatHelpers");
|
|
18
|
+
const SerializerMiddleware_1 = __importDefault(require("@/serialization/SerializerMiddleware"));
|
|
19
|
+
const LazySet_1 = __importDefault(require("@/base/LazySet"));
|
|
20
|
+
const makeSerializable_1 = __importDefault(require("@/serialization/makeSerializable"));
|
|
21
|
+
const memoize_1 = __importDefault(require("@/base/memoize"));
|
|
22
|
+
const Serialization_1 = __importDefault(require("@/serialization/Serialization"));
|
|
23
|
+
class PackContainer {
|
|
24
|
+
constructor(data, version, buildSnapshot, buildDependencies, resolveResults, resolveBuildDependenciesSnapshot) {
|
|
25
|
+
this.data = data;
|
|
26
|
+
this.version = version;
|
|
27
|
+
this.buildSnapshot = buildSnapshot;
|
|
28
|
+
this.buildDependencies = buildDependencies;
|
|
29
|
+
this.resolveResults = resolveResults;
|
|
30
|
+
this.resolveBuildDependenciesSnapshot = resolveBuildDependenciesSnapshot;
|
|
31
|
+
}
|
|
32
|
+
serialize({ write, writeLazy }) {
|
|
33
|
+
write(this.version);
|
|
34
|
+
write(this.buildSnapshot);
|
|
35
|
+
write(this.buildDependencies);
|
|
36
|
+
write(this.resolveResults);
|
|
37
|
+
write(this.resolveBuildDependenciesSnapshot);
|
|
38
|
+
writeLazy(this.data);
|
|
39
|
+
}
|
|
40
|
+
deserialize({ read }) {
|
|
41
|
+
this.version = read();
|
|
42
|
+
this.buildSnapshot = read();
|
|
43
|
+
this.buildDependencies = read();
|
|
44
|
+
this.resolveResults = read();
|
|
45
|
+
this.resolveBuildDependenciesSnapshot = read();
|
|
46
|
+
this.data = read();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
(0, makeSerializable_1.default)(PackContainer, 'mp-compiler/core/cache/PackFileCacheStrategy', 'PackContainer');
|
|
50
|
+
const MIN_CONTENT_SIZE = 1024 * 1024; // 1 MB
|
|
51
|
+
const CONTENT_COUNT_TO_MERGE = 10;
|
|
52
|
+
const MIN_ITEMS_IN_FRESH_PACK = 100;
|
|
53
|
+
const MAX_ITEMS_IN_FRESH_PACK = 50000;
|
|
54
|
+
const MAX_TIME_IN_FRESH_PACK = 1 * 60 * 1000; // 1 min
|
|
55
|
+
class PackItemInfo {
|
|
56
|
+
constructor(identifier, etag, value) {
|
|
57
|
+
this.identifier = identifier;
|
|
58
|
+
this.etag = etag;
|
|
59
|
+
this.location = -1;
|
|
60
|
+
this.lastAccess = Date.now();
|
|
61
|
+
this.freshValue = value;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
class Pack {
|
|
65
|
+
constructor(logger, maxAge) {
|
|
66
|
+
this.itemInfo = new Map();
|
|
67
|
+
this.requests = [];
|
|
68
|
+
this.requestsTimeout = undefined;
|
|
69
|
+
this.freshContent = new Map();
|
|
70
|
+
this.content = [];
|
|
71
|
+
this.invalid = false;
|
|
72
|
+
this.logger = logger;
|
|
73
|
+
this.maxAge = maxAge;
|
|
74
|
+
}
|
|
75
|
+
_addRequest(identifier) {
|
|
76
|
+
this.requests.push(identifier);
|
|
77
|
+
if (this.requestsTimeout === undefined) {
|
|
78
|
+
this.requestsTimeout = setTimeout(() => {
|
|
79
|
+
this.requests.push(undefined);
|
|
80
|
+
this.requestsTimeout = undefined;
|
|
81
|
+
}, MAX_TIME_IN_FRESH_PACK);
|
|
82
|
+
if (this.requestsTimeout.unref)
|
|
83
|
+
this.requestsTimeout.unref();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
stopCapturingRequests() {
|
|
87
|
+
if (this.requestsTimeout !== undefined) {
|
|
88
|
+
clearTimeout(this.requestsTimeout);
|
|
89
|
+
this.requestsTimeout = undefined;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
get(identifier, etag) {
|
|
93
|
+
const info = this.itemInfo.get(identifier);
|
|
94
|
+
this._addRequest(identifier);
|
|
95
|
+
if (info === undefined) {
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
if (info.etag !== etag)
|
|
99
|
+
return null;
|
|
100
|
+
info.lastAccess = Date.now();
|
|
101
|
+
const loc = info.location;
|
|
102
|
+
if (loc === -1) {
|
|
103
|
+
return info.freshValue;
|
|
104
|
+
}
|
|
105
|
+
if (!this.content[loc]) {
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
108
|
+
return this.content[loc].get(identifier);
|
|
109
|
+
}
|
|
110
|
+
set(identifier, etag, data) {
|
|
111
|
+
if (!this.invalid) {
|
|
112
|
+
this.invalid = true;
|
|
113
|
+
this.logger.log(`Pack got invalid because of write to: ${identifier}`);
|
|
114
|
+
}
|
|
115
|
+
const info = this.itemInfo.get(identifier);
|
|
116
|
+
if (info === undefined) {
|
|
117
|
+
const newInfo = new PackItemInfo(identifier, etag, data);
|
|
118
|
+
this.itemInfo.set(identifier, newInfo);
|
|
119
|
+
this._addRequest(identifier);
|
|
120
|
+
this.freshContent.set(identifier, newInfo);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
const loc = info.location;
|
|
124
|
+
if (loc >= 0) {
|
|
125
|
+
this._addRequest(identifier);
|
|
126
|
+
this.freshContent.set(identifier, info);
|
|
127
|
+
const content = this.content[loc];
|
|
128
|
+
content.delete(identifier);
|
|
129
|
+
if (content.items.size === 0) {
|
|
130
|
+
this.content[loc] = undefined;
|
|
131
|
+
this.logger.debug('Pack %d got empty and is removed', loc);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
info.freshValue = data;
|
|
135
|
+
info.lastAccess = Date.now();
|
|
136
|
+
info.etag = etag;
|
|
137
|
+
info.location = -1;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
getContentStats() {
|
|
141
|
+
let count = 0;
|
|
142
|
+
let size = 0;
|
|
143
|
+
for (const content of this.content) {
|
|
144
|
+
if (content !== undefined) {
|
|
145
|
+
count++;
|
|
146
|
+
const s = content.getSize();
|
|
147
|
+
if (s > 0) {
|
|
148
|
+
size += s;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return { count, size };
|
|
153
|
+
}
|
|
154
|
+
_findLocation() {
|
|
155
|
+
let i;
|
|
156
|
+
for (i = 0; i < this.content.length && this.content[i] !== undefined; i++)
|
|
157
|
+
;
|
|
158
|
+
return i;
|
|
159
|
+
}
|
|
160
|
+
_gcAndUpdateLocation(items, usedItems, newLoc) {
|
|
161
|
+
let count = 0;
|
|
162
|
+
let lastGC;
|
|
163
|
+
const now = Date.now();
|
|
164
|
+
for (const identifier of items) {
|
|
165
|
+
const info = this.itemInfo.get(identifier);
|
|
166
|
+
if (now - info.lastAccess > this.maxAge) {
|
|
167
|
+
this.itemInfo.delete(identifier);
|
|
168
|
+
items.delete(identifier);
|
|
169
|
+
usedItems.delete(identifier);
|
|
170
|
+
count++;
|
|
171
|
+
lastGC = identifier;
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
info.location = newLoc;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
if (count > 0) {
|
|
178
|
+
this.logger.log('Garbage Collected %d old items at pack %d (%d items remaining) e. g. %s', count, newLoc, items.size, lastGC);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
_persistFreshContent() {
|
|
182
|
+
const itemsCount = this.freshContent.size;
|
|
183
|
+
if (itemsCount > 0) {
|
|
184
|
+
const packCount = Math.ceil(itemsCount / MAX_ITEMS_IN_FRESH_PACK);
|
|
185
|
+
const itemsPerPack = Math.ceil(itemsCount / packCount);
|
|
186
|
+
const packs = [];
|
|
187
|
+
let i = 0;
|
|
188
|
+
let ignoreNextTimeTick = false;
|
|
189
|
+
const createNextPack = () => {
|
|
190
|
+
const loc = this._findLocation();
|
|
191
|
+
this.content[loc] = null; // reserve
|
|
192
|
+
const pack = {
|
|
193
|
+
items: new Set(),
|
|
194
|
+
map: new Map(),
|
|
195
|
+
loc,
|
|
196
|
+
};
|
|
197
|
+
packs.push(pack);
|
|
198
|
+
return pack;
|
|
199
|
+
};
|
|
200
|
+
let pack = createNextPack();
|
|
201
|
+
if (this.requestsTimeout !== undefined)
|
|
202
|
+
clearTimeout(this.requestsTimeout);
|
|
203
|
+
for (const identifier of this.requests) {
|
|
204
|
+
if (identifier === undefined) {
|
|
205
|
+
if (ignoreNextTimeTick) {
|
|
206
|
+
ignoreNextTimeTick = false;
|
|
207
|
+
}
|
|
208
|
+
else if (pack.items.size >= MIN_ITEMS_IN_FRESH_PACK) {
|
|
209
|
+
i = 0;
|
|
210
|
+
pack = createNextPack();
|
|
211
|
+
}
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
const info = this.freshContent.get(identifier);
|
|
215
|
+
if (info === undefined)
|
|
216
|
+
continue;
|
|
217
|
+
pack.items.add(identifier);
|
|
218
|
+
pack.map.set(identifier, info.freshValue);
|
|
219
|
+
info.location = pack.loc;
|
|
220
|
+
info.freshValue = undefined;
|
|
221
|
+
this.freshContent.delete(identifier);
|
|
222
|
+
if (++i > itemsPerPack) {
|
|
223
|
+
i = 0;
|
|
224
|
+
pack = createNextPack();
|
|
225
|
+
ignoreNextTimeTick = true;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
this.requests.length = 0;
|
|
229
|
+
for (const pack of packs) {
|
|
230
|
+
this.content[pack.loc] = new PackContent(pack.items, new Set(pack.items), new PackContentItems(pack.map));
|
|
231
|
+
}
|
|
232
|
+
this.logger.log(`${itemsCount} fresh items in cache put into pack ${packs.length > 1
|
|
233
|
+
? packs.map(pack => `${pack.loc} (${pack.items.size} items)`).join(', ')
|
|
234
|
+
: packs[0].loc}`);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Merges small content files to a single content file
|
|
239
|
+
*/
|
|
240
|
+
_optimizeSmallContent() {
|
|
241
|
+
// 1. Find all small content files
|
|
242
|
+
// Treat unused content files separately to avoid
|
|
243
|
+
// a merge-split cycle
|
|
244
|
+
const smallUsedContents = [];
|
|
245
|
+
let smallUsedContentSize = 0;
|
|
246
|
+
const smallUnusedContents = [];
|
|
247
|
+
let smallUnusedContentSize = 0;
|
|
248
|
+
for (let i = 0; i < this.content.length; i++) {
|
|
249
|
+
const content = this.content[i];
|
|
250
|
+
if (content === undefined)
|
|
251
|
+
continue;
|
|
252
|
+
if (content.outdated)
|
|
253
|
+
continue;
|
|
254
|
+
const size = content.getSize();
|
|
255
|
+
if (size < 0 || size > MIN_CONTENT_SIZE)
|
|
256
|
+
continue;
|
|
257
|
+
if (content.used.size > 0) {
|
|
258
|
+
smallUsedContents.push(i);
|
|
259
|
+
smallUsedContentSize += size;
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
smallUnusedContents.push(i);
|
|
263
|
+
smallUnusedContentSize += size;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
// 2. Check if minimum number is reached
|
|
267
|
+
let mergedIndices;
|
|
268
|
+
if (smallUsedContents.length >= CONTENT_COUNT_TO_MERGE ||
|
|
269
|
+
smallUsedContentSize > MIN_CONTENT_SIZE) {
|
|
270
|
+
mergedIndices = smallUsedContents;
|
|
271
|
+
}
|
|
272
|
+
else if (smallUnusedContents.length >= CONTENT_COUNT_TO_MERGE ||
|
|
273
|
+
smallUnusedContentSize > MIN_CONTENT_SIZE) {
|
|
274
|
+
mergedIndices = smallUnusedContents;
|
|
275
|
+
}
|
|
276
|
+
else
|
|
277
|
+
return;
|
|
278
|
+
const mergedContent = [];
|
|
279
|
+
// 3. Remove old content entries
|
|
280
|
+
for (const i of mergedIndices) {
|
|
281
|
+
mergedContent.push(this.content[i]);
|
|
282
|
+
this.content[i] = undefined;
|
|
283
|
+
}
|
|
284
|
+
// 4. Determine merged items
|
|
285
|
+
const mergedItems = new Set();
|
|
286
|
+
const mergedUsedItems = new Set();
|
|
287
|
+
const addToMergedMap = [];
|
|
288
|
+
for (const content of mergedContent) {
|
|
289
|
+
for (const identifier of content.items) {
|
|
290
|
+
mergedItems.add(identifier);
|
|
291
|
+
}
|
|
292
|
+
for (const identifier of content.used) {
|
|
293
|
+
mergedUsedItems.add(identifier);
|
|
294
|
+
}
|
|
295
|
+
// @ts-ignore
|
|
296
|
+
addToMergedMap.push((map) => __awaiter(this, void 0, void 0, function* () {
|
|
297
|
+
// unpack existing content
|
|
298
|
+
// after that values are accessible in .content
|
|
299
|
+
yield content.unpack('it should be merged with other small pack contents');
|
|
300
|
+
for (const [identifier, value] of content.content) {
|
|
301
|
+
map.set(identifier, value);
|
|
302
|
+
}
|
|
303
|
+
}));
|
|
304
|
+
}
|
|
305
|
+
// 5. GC and update location of merged items
|
|
306
|
+
const newLoc = this._findLocation();
|
|
307
|
+
this._gcAndUpdateLocation(mergedItems, mergedUsedItems, newLoc);
|
|
308
|
+
// 6. If not empty, store content somewhere
|
|
309
|
+
if (mergedItems.size > 0) {
|
|
310
|
+
this.content[newLoc] = new PackContent(mergedItems, mergedUsedItems, (0, memoize_1.default)(() => __awaiter(this, void 0, void 0, function* () {
|
|
311
|
+
const map = new Map();
|
|
312
|
+
yield Promise.all(addToMergedMap.map((fn) => fn(map)));
|
|
313
|
+
return new PackContentItems(map);
|
|
314
|
+
})));
|
|
315
|
+
this.logger.log('Merged %d small files with %d cache items into pack %d', mergedContent.length, mergedItems.size, newLoc);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Split large content files with used and unused items
|
|
320
|
+
* into two parts to separate used from unused items
|
|
321
|
+
*/
|
|
322
|
+
_optimizeUnusedContent() {
|
|
323
|
+
// 1. Find a large content file with used and unused items
|
|
324
|
+
for (let i = 0; i < this.content.length; i++) {
|
|
325
|
+
const content = this.content[i];
|
|
326
|
+
if (content === undefined)
|
|
327
|
+
continue;
|
|
328
|
+
const size = content.getSize();
|
|
329
|
+
if (size < MIN_CONTENT_SIZE)
|
|
330
|
+
continue;
|
|
331
|
+
const used = content.used.size;
|
|
332
|
+
const total = content.items.size;
|
|
333
|
+
if (used > 0 && used < total) {
|
|
334
|
+
// 2. Remove this content
|
|
335
|
+
this.content[i] = undefined;
|
|
336
|
+
// 3. Determine items for the used content file
|
|
337
|
+
const usedItems = new Set(content.used);
|
|
338
|
+
const newLoc = this._findLocation();
|
|
339
|
+
this._gcAndUpdateLocation(usedItems, usedItems, newLoc);
|
|
340
|
+
// 4. Create content file for used items
|
|
341
|
+
if (usedItems.size > 0) {
|
|
342
|
+
this.content[newLoc] = new PackContent(usedItems, new Set(usedItems), () => __awaiter(this, void 0, void 0, function* () {
|
|
343
|
+
yield content.unpack('it should be splitted into used and unused items');
|
|
344
|
+
const map = new Map();
|
|
345
|
+
for (const identifier of usedItems) {
|
|
346
|
+
map.set(identifier, content.content.get(identifier));
|
|
347
|
+
}
|
|
348
|
+
return new PackContentItems(map);
|
|
349
|
+
}));
|
|
350
|
+
}
|
|
351
|
+
// 5. Determine items for the unused content file
|
|
352
|
+
const unusedItems = new Set(content.items);
|
|
353
|
+
const usedOfUnusedItems = new Set();
|
|
354
|
+
for (const identifier of usedItems) {
|
|
355
|
+
unusedItems.delete(identifier);
|
|
356
|
+
}
|
|
357
|
+
const newUnusedLoc = this._findLocation();
|
|
358
|
+
this._gcAndUpdateLocation(unusedItems, usedOfUnusedItems, newUnusedLoc);
|
|
359
|
+
// 6. Create content file for unused items
|
|
360
|
+
if (unusedItems.size > 0) {
|
|
361
|
+
this.content[newUnusedLoc] = new PackContent(unusedItems, usedOfUnusedItems, () => __awaiter(this, void 0, void 0, function* () {
|
|
362
|
+
yield content.unpack('it should be splitted into used and unused items');
|
|
363
|
+
const map = new Map();
|
|
364
|
+
for (const identifier of unusedItems) {
|
|
365
|
+
map.set(identifier, content.content.get(identifier));
|
|
366
|
+
}
|
|
367
|
+
return new PackContentItems(map);
|
|
368
|
+
}));
|
|
369
|
+
}
|
|
370
|
+
this.logger.log('Split pack %d into pack %d with %d used items and pack %d with %d unused items', i, newLoc, usedItems.size, newUnusedLoc, unusedItems.size);
|
|
371
|
+
// optimizing only one of them is good enough and
|
|
372
|
+
// reduces the amount of serialization needed
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Find the content with the oldest item and run GC on that.
|
|
379
|
+
* Only runs for one content to avoid large invalidation.
|
|
380
|
+
*/
|
|
381
|
+
_gcOldestContent() {
|
|
382
|
+
let oldest;
|
|
383
|
+
for (const info of this.itemInfo.values()) {
|
|
384
|
+
if (oldest === undefined || info.lastAccess < oldest.lastAccess) {
|
|
385
|
+
oldest = info;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
if (Date.now() - oldest.lastAccess > this.maxAge) {
|
|
389
|
+
const loc = oldest.location;
|
|
390
|
+
if (loc < 0)
|
|
391
|
+
return;
|
|
392
|
+
const content = this.content[loc];
|
|
393
|
+
const items = new Set(content.items);
|
|
394
|
+
const usedItems = new Set(content.used);
|
|
395
|
+
this._gcAndUpdateLocation(items, usedItems, loc);
|
|
396
|
+
this.content[loc] =
|
|
397
|
+
items.size > 0
|
|
398
|
+
? new PackContent(items, usedItems, () => __awaiter(this, void 0, void 0, function* () {
|
|
399
|
+
yield content.unpack('it contains old items that should be garbage collected');
|
|
400
|
+
const map = new Map();
|
|
401
|
+
for (const identifier of items) {
|
|
402
|
+
map.set(identifier, content.content.get(identifier));
|
|
403
|
+
}
|
|
404
|
+
return new PackContentItems(map);
|
|
405
|
+
}))
|
|
406
|
+
: undefined;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
serialize({ write, writeSeparate }) {
|
|
410
|
+
this._persistFreshContent();
|
|
411
|
+
this._optimizeSmallContent();
|
|
412
|
+
this._optimizeUnusedContent();
|
|
413
|
+
this._gcOldestContent();
|
|
414
|
+
for (const identifier of this.itemInfo.keys()) {
|
|
415
|
+
write(identifier);
|
|
416
|
+
}
|
|
417
|
+
write(null); // null as marker of the end of keys
|
|
418
|
+
for (const info of this.itemInfo.values()) {
|
|
419
|
+
write(info.etag);
|
|
420
|
+
}
|
|
421
|
+
for (const info of this.itemInfo.values()) {
|
|
422
|
+
write(info.lastAccess);
|
|
423
|
+
}
|
|
424
|
+
for (let i = 0; i < this.content.length; i++) {
|
|
425
|
+
const content = this.content[i];
|
|
426
|
+
if (content !== undefined) {
|
|
427
|
+
write(content.items);
|
|
428
|
+
content.writeLazy(lazy => writeSeparate(lazy, { name: `${i}` }));
|
|
429
|
+
}
|
|
430
|
+
else {
|
|
431
|
+
write(undefined); // undefined marks an empty content slot
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
write(null); // null as marker of the end of items
|
|
435
|
+
}
|
|
436
|
+
deserialize({ read, logger }) {
|
|
437
|
+
this.logger = logger;
|
|
438
|
+
{
|
|
439
|
+
const items = [];
|
|
440
|
+
let item = read();
|
|
441
|
+
while (item !== null) {
|
|
442
|
+
items.push(item);
|
|
443
|
+
item = read();
|
|
444
|
+
}
|
|
445
|
+
this.itemInfo.clear();
|
|
446
|
+
const infoItems = items.map(identifier => {
|
|
447
|
+
const info = new PackItemInfo(identifier, undefined, undefined);
|
|
448
|
+
this.itemInfo.set(identifier, info);
|
|
449
|
+
return info;
|
|
450
|
+
});
|
|
451
|
+
for (const info of infoItems) {
|
|
452
|
+
info.etag = read();
|
|
453
|
+
}
|
|
454
|
+
for (const info of infoItems) {
|
|
455
|
+
info.lastAccess = read();
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
this.content.length = 0;
|
|
459
|
+
let items = read();
|
|
460
|
+
while (items !== null) {
|
|
461
|
+
if (items === undefined) {
|
|
462
|
+
this.content.push(items);
|
|
463
|
+
}
|
|
464
|
+
else {
|
|
465
|
+
const idx = this.content.length;
|
|
466
|
+
const lazy = read();
|
|
467
|
+
this.content.push(new PackContent(items, new Set(), lazy, logger, `${this.content.length}`));
|
|
468
|
+
for (const identifier of items) {
|
|
469
|
+
this.itemInfo.get(identifier).location = idx;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
items = read();
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
(0, makeSerializable_1.default)(Pack, 'mp-compiler/core/cache/PackFileCacheStrategy', 'Pack');
|
|
477
|
+
class PackContentItems {
|
|
478
|
+
constructor(map) {
|
|
479
|
+
this.map = map;
|
|
480
|
+
}
|
|
481
|
+
serialize({ write, snapshot, rollback, logger, profile }) {
|
|
482
|
+
if (profile) {
|
|
483
|
+
write(false);
|
|
484
|
+
for (const [key, value] of this.map) {
|
|
485
|
+
const s = snapshot();
|
|
486
|
+
try {
|
|
487
|
+
write(key);
|
|
488
|
+
const start = process.hrtime();
|
|
489
|
+
write(value);
|
|
490
|
+
const durationHr = process.hrtime(start);
|
|
491
|
+
const duration = durationHr[0] * 1000 + durationHr[1] / 1e6;
|
|
492
|
+
if (duration > 1) {
|
|
493
|
+
if (duration > 500)
|
|
494
|
+
logger.error(`Serialization of '${key}': ${duration} ms`);
|
|
495
|
+
else if (duration > 50)
|
|
496
|
+
logger.warn(`Serialization of '${key}': ${duration} ms`);
|
|
497
|
+
else if (duration > 10)
|
|
498
|
+
logger.info(`Serialization of '${key}': ${duration} ms`);
|
|
499
|
+
else if (duration > 5)
|
|
500
|
+
logger.log(`Serialization of '${key}': ${duration} ms`);
|
|
501
|
+
else
|
|
502
|
+
logger.debug(`Serialization of '${key}': ${duration} ms`);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
catch (e) {
|
|
506
|
+
rollback(s);
|
|
507
|
+
if (e === Serialization_1.default.NOT_SERIALIZABLE)
|
|
508
|
+
continue;
|
|
509
|
+
const msg = 'Skipped not serializable cache item';
|
|
510
|
+
if (e.message.includes('ModuleBuildError')) {
|
|
511
|
+
logger.log(`${msg} (in build error): ${e.message}`);
|
|
512
|
+
logger.debug(`${msg} '${key}' (in build error): ${e.stack}`);
|
|
513
|
+
}
|
|
514
|
+
else {
|
|
515
|
+
logger.warn(`${msg}: ${e.message}`);
|
|
516
|
+
logger.debug(`${msg} '${key}': ${e.stack}`);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
write(null);
|
|
521
|
+
return;
|
|
522
|
+
}
|
|
523
|
+
// Try to serialize all at once
|
|
524
|
+
const s = snapshot();
|
|
525
|
+
try {
|
|
526
|
+
write(true);
|
|
527
|
+
write(this.map);
|
|
528
|
+
}
|
|
529
|
+
catch (e) {
|
|
530
|
+
rollback(s);
|
|
531
|
+
// Try to serialize each item on it's own
|
|
532
|
+
write(false);
|
|
533
|
+
for (const [key, value] of this.map) {
|
|
534
|
+
const s = snapshot();
|
|
535
|
+
try {
|
|
536
|
+
write(key);
|
|
537
|
+
write(value);
|
|
538
|
+
}
|
|
539
|
+
catch (e) {
|
|
540
|
+
rollback(s);
|
|
541
|
+
if (e === Serialization_1.default.NOT_SERIALIZABLE)
|
|
542
|
+
continue;
|
|
543
|
+
logger.warn(`Skipped not serializable cache item '${key}': ${e.message}`);
|
|
544
|
+
logger.debug(e.stack);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
write(null);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
deserialize({ read, logger, profile }) {
|
|
551
|
+
if (read()) {
|
|
552
|
+
this.map = read();
|
|
553
|
+
}
|
|
554
|
+
else if (profile) {
|
|
555
|
+
const map = new Map();
|
|
556
|
+
let key = read();
|
|
557
|
+
while (key !== null) {
|
|
558
|
+
const start = process.hrtime();
|
|
559
|
+
const value = read();
|
|
560
|
+
const durationHr = process.hrtime(start);
|
|
561
|
+
const duration = durationHr[0] * 1000 + durationHr[1] / 1e6;
|
|
562
|
+
if (duration > 1) {
|
|
563
|
+
if (duration > 100)
|
|
564
|
+
logger.error(`Deserialization of '${key}': ${duration} ms`);
|
|
565
|
+
else if (duration > 20)
|
|
566
|
+
logger.warn(`Deserialization of '${key}': ${duration} ms`);
|
|
567
|
+
else if (duration > 5)
|
|
568
|
+
logger.info(`Deserialization of '${key}': ${duration} ms`);
|
|
569
|
+
else if (duration > 2)
|
|
570
|
+
logger.log(`Deserialization of '${key}': ${duration} ms`);
|
|
571
|
+
else
|
|
572
|
+
logger.debug(`Deserialization of '${key}': ${duration} ms`);
|
|
573
|
+
}
|
|
574
|
+
map.set(key, value);
|
|
575
|
+
key = read();
|
|
576
|
+
}
|
|
577
|
+
this.map = map;
|
|
578
|
+
}
|
|
579
|
+
else {
|
|
580
|
+
const map = new Map();
|
|
581
|
+
let key = read();
|
|
582
|
+
while (key !== null) {
|
|
583
|
+
map.set(key, read());
|
|
584
|
+
key = read();
|
|
585
|
+
}
|
|
586
|
+
this.map = map;
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
(0, makeSerializable_1.default)(PackContentItems, 'mp-compiler/core/cache/PackFileCacheStrategy', 'PackContentItems');
|
|
591
|
+
class PackContent {
|
|
592
|
+
/*
|
|
593
|
+
This class can be in these states:
|
|
594
|
+
| this.lazy | this.content | this.outdated | state
|
|
595
|
+
A1 | undefined | Map | false | fresh content
|
|
596
|
+
A2 | undefined | Map | true | (will not happen)
|
|
597
|
+
B1 | lazy () => {} | undefined | false | not deserialized
|
|
598
|
+
B2 | lazy () => {} | undefined | true | not deserialized, but some items has been removed
|
|
599
|
+
C1 | lazy* () => {} | Map | false | deserialized
|
|
600
|
+
C2 | lazy* () => {} | Map | true | deserialized, and some items has been removed
|
|
601
|
+
|
|
602
|
+
this.used is a subset of this.items.
|
|
603
|
+
this.items is a subset of this.content.keys() resp. this.lazy().map.keys()
|
|
604
|
+
When this.outdated === false, this.items === this.content.keys() resp. this.lazy().map.keys()
|
|
605
|
+
When this.outdated === true, this.items should be used to recreated this.lazy/this.content.
|
|
606
|
+
When this.lazy and this.content is set, they contain the same data.
|
|
607
|
+
this.get must only be called with a valid item from this.items.
|
|
608
|
+
In state C this.lazy is unMemoized
|
|
609
|
+
*/
|
|
610
|
+
constructor(items, usedItems, dataOrFn, logger, lazyName) {
|
|
611
|
+
this.items = items;
|
|
612
|
+
this.lazy = typeof dataOrFn === 'function' ? dataOrFn : undefined;
|
|
613
|
+
this.content = typeof dataOrFn === 'function' ? undefined : dataOrFn.map;
|
|
614
|
+
this.outdated = false;
|
|
615
|
+
this.used = usedItems;
|
|
616
|
+
this.logger = logger;
|
|
617
|
+
this.lazyName = lazyName;
|
|
618
|
+
}
|
|
619
|
+
get(identifier) {
|
|
620
|
+
this.used.add(identifier);
|
|
621
|
+
if (this.content) {
|
|
622
|
+
return this.content.get(identifier);
|
|
623
|
+
}
|
|
624
|
+
// We are in state B
|
|
625
|
+
const { lazyName } = this;
|
|
626
|
+
let timeMessage;
|
|
627
|
+
if (lazyName) {
|
|
628
|
+
// only log once
|
|
629
|
+
this.lazyName = undefined;
|
|
630
|
+
timeMessage = `restore cache content ${lazyName} (${(0, SizeFormatHelpers_1.formatSize)(this.getSize())})`;
|
|
631
|
+
this.logger.log(`starting to restore cache content ${lazyName} (${(0, SizeFormatHelpers_1.formatSize)(this.getSize())}) because of request to: ${identifier}`);
|
|
632
|
+
this.logger.time(timeMessage);
|
|
633
|
+
}
|
|
634
|
+
const value = this.lazy();
|
|
635
|
+
if ('then' in value) {
|
|
636
|
+
return value.then(data => {
|
|
637
|
+
const map = data.map;
|
|
638
|
+
if (timeMessage) {
|
|
639
|
+
this.logger.timeEnd(timeMessage);
|
|
640
|
+
}
|
|
641
|
+
// Move to state C
|
|
642
|
+
this.content = map;
|
|
643
|
+
this.lazy = SerializerMiddleware_1.default.unMemoizeLazy(this.lazy);
|
|
644
|
+
return map.get(identifier);
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
const map = value.map;
|
|
648
|
+
if (timeMessage) {
|
|
649
|
+
this.logger.timeEnd(timeMessage);
|
|
650
|
+
}
|
|
651
|
+
// Move to state C
|
|
652
|
+
this.content = map;
|
|
653
|
+
this.lazy = SerializerMiddleware_1.default.unMemoizeLazy(this.lazy);
|
|
654
|
+
return map.get(identifier);
|
|
655
|
+
}
|
|
656
|
+
unpack(reason) {
|
|
657
|
+
if (this.content)
|
|
658
|
+
return;
|
|
659
|
+
// Move from state B to C
|
|
660
|
+
if (this.lazy) {
|
|
661
|
+
const { lazyName } = this;
|
|
662
|
+
let timeMessage;
|
|
663
|
+
if (lazyName) {
|
|
664
|
+
// only log once
|
|
665
|
+
this.lazyName = undefined;
|
|
666
|
+
timeMessage = `unpack cache content ${lazyName} (${(0, SizeFormatHelpers_1.formatSize)(this.getSize())})`;
|
|
667
|
+
this.logger.log(`starting to unpack cache content ${lazyName} (${(0, SizeFormatHelpers_1.formatSize)(this.getSize())}) because ${reason}`);
|
|
668
|
+
this.logger.time(timeMessage);
|
|
669
|
+
}
|
|
670
|
+
const value = this.lazy();
|
|
671
|
+
if ('then' in value) {
|
|
672
|
+
return value.then(data => {
|
|
673
|
+
if (timeMessage) {
|
|
674
|
+
this.logger.timeEnd(timeMessage);
|
|
675
|
+
}
|
|
676
|
+
this.content = data.map;
|
|
677
|
+
});
|
|
678
|
+
}
|
|
679
|
+
if (timeMessage) {
|
|
680
|
+
this.logger.timeEnd(timeMessage);
|
|
681
|
+
}
|
|
682
|
+
this.content = value.map;
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
getSize() {
|
|
686
|
+
if (!this.lazy)
|
|
687
|
+
return -1;
|
|
688
|
+
const options = this.lazy.options;
|
|
689
|
+
if (!options)
|
|
690
|
+
return -1;
|
|
691
|
+
const size = options.size;
|
|
692
|
+
if (typeof size !== 'number')
|
|
693
|
+
return -1;
|
|
694
|
+
return size;
|
|
695
|
+
}
|
|
696
|
+
delete(identifier) {
|
|
697
|
+
this.items.delete(identifier);
|
|
698
|
+
this.used.delete(identifier);
|
|
699
|
+
this.outdated = true;
|
|
700
|
+
}
|
|
701
|
+
writeLazy(write) {
|
|
702
|
+
if (!this.outdated && this.lazy) {
|
|
703
|
+
// State B1 or C1
|
|
704
|
+
// this.lazy is still the valid deserialized version
|
|
705
|
+
write(this.lazy);
|
|
706
|
+
return;
|
|
707
|
+
}
|
|
708
|
+
if (!this.outdated && this.content) {
|
|
709
|
+
// State A1
|
|
710
|
+
const map = new Map(this.content);
|
|
711
|
+
// Move to state C1
|
|
712
|
+
this.lazy = SerializerMiddleware_1.default.unMemoizeLazy(write(() => new PackContentItems(map)));
|
|
713
|
+
return;
|
|
714
|
+
}
|
|
715
|
+
if (this.content) {
|
|
716
|
+
// State A2 or C2
|
|
717
|
+
const map = new Map();
|
|
718
|
+
for (const item of this.items) {
|
|
719
|
+
map.set(item, this.content.get(item));
|
|
720
|
+
}
|
|
721
|
+
// Move to state C1
|
|
722
|
+
this.outdated = false;
|
|
723
|
+
this.content = map;
|
|
724
|
+
this.lazy = SerializerMiddleware_1.default.unMemoizeLazy(write(() => new PackContentItems(map)));
|
|
725
|
+
return;
|
|
726
|
+
}
|
|
727
|
+
// State B2
|
|
728
|
+
const { lazyName } = this;
|
|
729
|
+
let timeMessage;
|
|
730
|
+
if (lazyName) {
|
|
731
|
+
// only log once
|
|
732
|
+
this.lazyName = undefined;
|
|
733
|
+
timeMessage = `unpack cache content ${lazyName} (${(0, SizeFormatHelpers_1.formatSize)(this.getSize())})`;
|
|
734
|
+
this.logger.log(`starting to unpack cache content ${lazyName} (${(0, SizeFormatHelpers_1.formatSize)(this.getSize())}) because it's outdated and need to be serialized`);
|
|
735
|
+
this.logger.time(timeMessage);
|
|
736
|
+
}
|
|
737
|
+
const value = this.lazy();
|
|
738
|
+
this.outdated = false;
|
|
739
|
+
if ('then' in value) {
|
|
740
|
+
// Move to state B1
|
|
741
|
+
this.lazy = write(() => value.then(data => {
|
|
742
|
+
if (timeMessage) {
|
|
743
|
+
this.logger.timeEnd(timeMessage);
|
|
744
|
+
}
|
|
745
|
+
const oldMap = data.map;
|
|
746
|
+
const map = new Map();
|
|
747
|
+
for (const item of this.items) {
|
|
748
|
+
map.set(item, oldMap.get(item));
|
|
749
|
+
}
|
|
750
|
+
// Move to state C1 (or maybe C2)
|
|
751
|
+
this.content = map;
|
|
752
|
+
this.lazy = SerializerMiddleware_1.default.unMemoizeLazy(this.lazy);
|
|
753
|
+
return new PackContentItems(map);
|
|
754
|
+
}));
|
|
755
|
+
}
|
|
756
|
+
else {
|
|
757
|
+
// Move to state C1
|
|
758
|
+
if (timeMessage) {
|
|
759
|
+
this.logger.timeEnd(timeMessage);
|
|
760
|
+
}
|
|
761
|
+
const oldMap = value.map;
|
|
762
|
+
const map = new Map();
|
|
763
|
+
for (const item of this.items) {
|
|
764
|
+
map.set(item, oldMap.get(item));
|
|
765
|
+
}
|
|
766
|
+
this.content = map;
|
|
767
|
+
this.lazy = write(() => new PackContentItems(map));
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
const allowCollectingMemory = buf => {
|
|
772
|
+
const wasted = buf.buffer.byteLength - buf.byteLength;
|
|
773
|
+
if (wasted > 8192 && (wasted > 1048576 || wasted > buf.byteLength)) {
|
|
774
|
+
return Buffer.from(buf);
|
|
775
|
+
}
|
|
776
|
+
return buf;
|
|
777
|
+
};
|
|
778
|
+
class PackFileCacheStrategy {
|
|
779
|
+
constructor({ compiler, fs, context, cacheLocation, version, logger, snapshot, maxAge, profile, allowCollectingMemory, compression, readonly, }) {
|
|
780
|
+
this.fileSerializer = Serialization_1.default.createFileSerializer(fs, compiler.options.output.hashFunction);
|
|
781
|
+
this.fileSystemInfo = new FileSystemInfo_1.FileSystemInfo(fs, {
|
|
782
|
+
managedPaths: snapshot.managedPaths,
|
|
783
|
+
immutablePaths: snapshot.immutablePaths,
|
|
784
|
+
logger: logger.getChildLogger('webpack.FileSystemInfo'),
|
|
785
|
+
hashFunction: compiler.options.output.hashFunction,
|
|
786
|
+
});
|
|
787
|
+
this.compiler = compiler;
|
|
788
|
+
this.context = context;
|
|
789
|
+
this.cacheLocation = cacheLocation;
|
|
790
|
+
this.version = version;
|
|
791
|
+
this.logger = logger;
|
|
792
|
+
this.maxAge = maxAge;
|
|
793
|
+
this.profile = profile;
|
|
794
|
+
this.readonly = readonly;
|
|
795
|
+
this.allowCollectingMemory = allowCollectingMemory;
|
|
796
|
+
this.compression = compression;
|
|
797
|
+
this._extension =
|
|
798
|
+
compression === 'brotli' ? '.pack.br' : compression === 'gzip' ? '.pack.gz' : '.pack';
|
|
799
|
+
this.snapshot = snapshot;
|
|
800
|
+
this.buildDependencies = new Set();
|
|
801
|
+
this.newBuildDependencies = new LazySet_1.default();
|
|
802
|
+
this.packPromise = this._openPack();
|
|
803
|
+
this.storePromise = Promise.resolve();
|
|
804
|
+
}
|
|
805
|
+
_getPack() {
|
|
806
|
+
if (this.packPromise === undefined) {
|
|
807
|
+
this.packPromise = this.storePromise.then(() => this._openPack());
|
|
808
|
+
}
|
|
809
|
+
return this.packPromise;
|
|
810
|
+
}
|
|
811
|
+
_openPack() {
|
|
812
|
+
const { logger, profile, cacheLocation, version } = this;
|
|
813
|
+
let buildSnapshot;
|
|
814
|
+
let buildDependencies;
|
|
815
|
+
let newBuildDependencies;
|
|
816
|
+
let resolveBuildDependenciesSnapshot;
|
|
817
|
+
let resolveResults;
|
|
818
|
+
logger.time('restore cache container');
|
|
819
|
+
return this.fileSerializer
|
|
820
|
+
.deserialize(null, {
|
|
821
|
+
filename: `${cacheLocation}/index${this._extension}`,
|
|
822
|
+
extension: `${this._extension}`,
|
|
823
|
+
logger,
|
|
824
|
+
profile,
|
|
825
|
+
retainedBuffer: this.allowCollectingMemory ? allowCollectingMemory : undefined,
|
|
826
|
+
})
|
|
827
|
+
.catch(err => {
|
|
828
|
+
if (err.code !== 'ENOENT') {
|
|
829
|
+
logger.warn(`Restoring pack failed from ${cacheLocation}${this._extension}: ${err}`);
|
|
830
|
+
logger.debug(err.stack);
|
|
831
|
+
}
|
|
832
|
+
else {
|
|
833
|
+
logger.debug(`No pack exists at ${cacheLocation}${this._extension}: ${err}`);
|
|
834
|
+
}
|
|
835
|
+
return undefined;
|
|
836
|
+
})
|
|
837
|
+
.then(packContainer => {
|
|
838
|
+
logger.timeEnd('restore cache container');
|
|
839
|
+
if (!packContainer)
|
|
840
|
+
return undefined;
|
|
841
|
+
if (!(packContainer instanceof PackContainer)) {
|
|
842
|
+
logger.warn(`Restored pack from ${cacheLocation}${this._extension}, but contained content is unexpected.`, packContainer);
|
|
843
|
+
return undefined;
|
|
844
|
+
}
|
|
845
|
+
if (packContainer.version !== version) {
|
|
846
|
+
logger.log(`Restored pack from ${cacheLocation}${this._extension}, but version doesn't match.`);
|
|
847
|
+
return undefined;
|
|
848
|
+
}
|
|
849
|
+
logger.time('check build dependencies');
|
|
850
|
+
return Promise.all([
|
|
851
|
+
new Promise((resolve, reject) => {
|
|
852
|
+
this.fileSystemInfo.checkSnapshotValid(packContainer.buildSnapshot, (err, valid) => {
|
|
853
|
+
if (err) {
|
|
854
|
+
logger.log(`Restored pack from ${cacheLocation}${this._extension}, but checking snapshot of build dependencies errored: ${err}.`);
|
|
855
|
+
logger.debug(err.stack);
|
|
856
|
+
return resolve(false);
|
|
857
|
+
}
|
|
858
|
+
if (!valid) {
|
|
859
|
+
logger.log(`Restored pack from ${cacheLocation}${this._extension}, but build dependencies have changed.`);
|
|
860
|
+
return resolve(false);
|
|
861
|
+
}
|
|
862
|
+
buildSnapshot = packContainer.buildSnapshot;
|
|
863
|
+
return resolve(true);
|
|
864
|
+
});
|
|
865
|
+
}),
|
|
866
|
+
new Promise((resolve, reject) => {
|
|
867
|
+
this.fileSystemInfo.checkSnapshotValid(packContainer.resolveBuildDependenciesSnapshot, (err, valid) => {
|
|
868
|
+
if (err) {
|
|
869
|
+
logger.log(`Restored pack from ${cacheLocation}${this._extension}, but checking snapshot of resolving of build dependencies errored: ${err}.`);
|
|
870
|
+
logger.debug(err.stack);
|
|
871
|
+
return resolve(false);
|
|
872
|
+
}
|
|
873
|
+
if (valid) {
|
|
874
|
+
resolveBuildDependenciesSnapshot = packContainer.resolveBuildDependenciesSnapshot;
|
|
875
|
+
buildDependencies = packContainer.buildDependencies;
|
|
876
|
+
resolveResults = packContainer.resolveResults;
|
|
877
|
+
return resolve(true);
|
|
878
|
+
}
|
|
879
|
+
logger.log('resolving of build dependencies is invalid, will re-resolve build dependencies');
|
|
880
|
+
this.fileSystemInfo.checkResolveResultsValid(packContainer.resolveResults, (err, valid) => {
|
|
881
|
+
if (err) {
|
|
882
|
+
logger.log(`Restored pack from ${cacheLocation}${this._extension}, but resolving of build dependencies errored: ${err}.`);
|
|
883
|
+
logger.debug(err.stack);
|
|
884
|
+
return resolve(false);
|
|
885
|
+
}
|
|
886
|
+
if (valid) {
|
|
887
|
+
newBuildDependencies = packContainer.buildDependencies;
|
|
888
|
+
resolveResults = packContainer.resolveResults;
|
|
889
|
+
return resolve(true);
|
|
890
|
+
}
|
|
891
|
+
logger.log(`Restored pack from ${cacheLocation}${this._extension}, but build dependencies resolve to different locations.`);
|
|
892
|
+
return resolve(false);
|
|
893
|
+
});
|
|
894
|
+
});
|
|
895
|
+
}),
|
|
896
|
+
])
|
|
897
|
+
.catch(err => {
|
|
898
|
+
logger.timeEnd('check build dependencies');
|
|
899
|
+
throw err;
|
|
900
|
+
})
|
|
901
|
+
.then(([buildSnapshotValid, resolveValid]) => {
|
|
902
|
+
logger.timeEnd('check build dependencies');
|
|
903
|
+
if (buildSnapshotValid && resolveValid) {
|
|
904
|
+
logger.time('restore cache content metadata');
|
|
905
|
+
const d = packContainer.data();
|
|
906
|
+
logger.timeEnd('restore cache content metadata');
|
|
907
|
+
return d;
|
|
908
|
+
}
|
|
909
|
+
return undefined;
|
|
910
|
+
});
|
|
911
|
+
})
|
|
912
|
+
.then(pack => {
|
|
913
|
+
if (pack) {
|
|
914
|
+
pack.maxAge = this.maxAge;
|
|
915
|
+
this.buildSnapshot = buildSnapshot;
|
|
916
|
+
if (buildDependencies)
|
|
917
|
+
this.buildDependencies = buildDependencies;
|
|
918
|
+
if (newBuildDependencies)
|
|
919
|
+
this.newBuildDependencies.addAll(newBuildDependencies);
|
|
920
|
+
this.resolveResults = resolveResults;
|
|
921
|
+
this.resolveBuildDependenciesSnapshot = resolveBuildDependenciesSnapshot;
|
|
922
|
+
return pack;
|
|
923
|
+
}
|
|
924
|
+
return new Pack(logger, this.maxAge);
|
|
925
|
+
})
|
|
926
|
+
.catch(err => {
|
|
927
|
+
this.logger.warn(`Restoring pack from ${cacheLocation}${this._extension} failed: ${err}`);
|
|
928
|
+
this.logger.debug(err.stack);
|
|
929
|
+
return new Pack(logger, this.maxAge);
|
|
930
|
+
});
|
|
931
|
+
}
|
|
932
|
+
store(identifier, etag, data) {
|
|
933
|
+
if (this.readonly)
|
|
934
|
+
return Promise.resolve();
|
|
935
|
+
return this._getPack().then(pack => {
|
|
936
|
+
pack.set(identifier, etag === null ? null : etag.toString(), data);
|
|
937
|
+
});
|
|
938
|
+
}
|
|
939
|
+
restore(identifier, etag) {
|
|
940
|
+
return this._getPack()
|
|
941
|
+
.then(pack => pack.get(identifier, etag === null ? null : etag.toString()))
|
|
942
|
+
.catch(err => {
|
|
943
|
+
if (err && err.code !== 'ENOENT') {
|
|
944
|
+
this.logger.warn(`Restoring failed for ${identifier} from pack: ${err}`);
|
|
945
|
+
this.logger.debug(err.stack);
|
|
946
|
+
}
|
|
947
|
+
});
|
|
948
|
+
}
|
|
949
|
+
storeBuildDependencies(dependencies) {
|
|
950
|
+
if (this.readonly)
|
|
951
|
+
return;
|
|
952
|
+
this.newBuildDependencies.addAll(dependencies);
|
|
953
|
+
}
|
|
954
|
+
afterAllStored() {
|
|
955
|
+
const packPromise = this.packPromise;
|
|
956
|
+
if (packPromise === undefined)
|
|
957
|
+
return Promise.resolve();
|
|
958
|
+
const reportProgress = ProgressPlugin_1.default.getReporter(this.compiler);
|
|
959
|
+
this.storePromise = packPromise
|
|
960
|
+
.then(pack => {
|
|
961
|
+
pack.stopCapturingRequests();
|
|
962
|
+
if (!pack.invalid)
|
|
963
|
+
return;
|
|
964
|
+
this.packPromise = undefined;
|
|
965
|
+
this.logger.log(`Storing pack...`);
|
|
966
|
+
let promise;
|
|
967
|
+
const newBuildDependencies = new Set();
|
|
968
|
+
for (const dep of this.newBuildDependencies) {
|
|
969
|
+
if (!this.buildDependencies.has(dep)) {
|
|
970
|
+
newBuildDependencies.add(dep);
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
if (newBuildDependencies.size > 0 || !this.buildSnapshot) {
|
|
974
|
+
if (reportProgress)
|
|
975
|
+
reportProgress(0.5, 'resolve build dependencies');
|
|
976
|
+
this.logger.debug(`Capturing build dependencies... (${Array.from(newBuildDependencies).join(', ')})`);
|
|
977
|
+
promise = new Promise((resolve, reject) => {
|
|
978
|
+
this.logger.time('resolve build dependencies');
|
|
979
|
+
this.fileSystemInfo.resolveBuildDependencies(this.context, newBuildDependencies, (err, result) => {
|
|
980
|
+
this.logger.timeEnd('resolve build dependencies');
|
|
981
|
+
if (err)
|
|
982
|
+
return reject(err);
|
|
983
|
+
this.logger.time('snapshot build dependencies');
|
|
984
|
+
const { files, directories, missing, resolveResults, resolveDependencies } = result;
|
|
985
|
+
if (this.resolveResults) {
|
|
986
|
+
for (const [key, value] of resolveResults) {
|
|
987
|
+
this.resolveResults.set(key, value);
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
else {
|
|
991
|
+
this.resolveResults = resolveResults;
|
|
992
|
+
}
|
|
993
|
+
if (reportProgress) {
|
|
994
|
+
reportProgress(0.6, 'snapshot build dependencies', 'resolving');
|
|
995
|
+
}
|
|
996
|
+
this.fileSystemInfo.createSnapshot(undefined, resolveDependencies.files, resolveDependencies.directories, resolveDependencies.missing, this.snapshot.resolveBuildDependencies, (err, snapshot) => {
|
|
997
|
+
if (err) {
|
|
998
|
+
this.logger.timeEnd('snapshot build dependencies');
|
|
999
|
+
return reject(err);
|
|
1000
|
+
}
|
|
1001
|
+
if (!snapshot) {
|
|
1002
|
+
this.logger.timeEnd('snapshot build dependencies');
|
|
1003
|
+
return reject(new Error('Unable to snapshot resolve dependencies'));
|
|
1004
|
+
}
|
|
1005
|
+
if (this.resolveBuildDependenciesSnapshot) {
|
|
1006
|
+
this.resolveBuildDependenciesSnapshot = this.fileSystemInfo.mergeSnapshots(this.resolveBuildDependenciesSnapshot, snapshot);
|
|
1007
|
+
}
|
|
1008
|
+
else {
|
|
1009
|
+
this.resolveBuildDependenciesSnapshot = snapshot;
|
|
1010
|
+
}
|
|
1011
|
+
if (reportProgress) {
|
|
1012
|
+
reportProgress(0.7, 'snapshot build dependencies', 'modules');
|
|
1013
|
+
}
|
|
1014
|
+
this.fileSystemInfo.createSnapshot(undefined, files, directories, missing, this.snapshot.buildDependencies, (err, snapshot) => {
|
|
1015
|
+
this.logger.timeEnd('snapshot build dependencies');
|
|
1016
|
+
if (err)
|
|
1017
|
+
return reject(err);
|
|
1018
|
+
if (!snapshot) {
|
|
1019
|
+
return reject(new Error('Unable to snapshot build dependencies'));
|
|
1020
|
+
}
|
|
1021
|
+
this.logger.debug('Captured build dependencies');
|
|
1022
|
+
if (this.buildSnapshot) {
|
|
1023
|
+
this.buildSnapshot = this.fileSystemInfo.mergeSnapshots(this.buildSnapshot, snapshot);
|
|
1024
|
+
}
|
|
1025
|
+
else {
|
|
1026
|
+
this.buildSnapshot = snapshot;
|
|
1027
|
+
}
|
|
1028
|
+
resolve(null);
|
|
1029
|
+
});
|
|
1030
|
+
});
|
|
1031
|
+
});
|
|
1032
|
+
});
|
|
1033
|
+
}
|
|
1034
|
+
else {
|
|
1035
|
+
promise = Promise.resolve();
|
|
1036
|
+
}
|
|
1037
|
+
return promise.then(() => {
|
|
1038
|
+
if (reportProgress)
|
|
1039
|
+
reportProgress(0.8, 'serialize pack');
|
|
1040
|
+
this.logger.time(`store pack`);
|
|
1041
|
+
const updatedBuildDependencies = new Set(this.buildDependencies);
|
|
1042
|
+
for (const dep of newBuildDependencies) {
|
|
1043
|
+
updatedBuildDependencies.add(dep);
|
|
1044
|
+
}
|
|
1045
|
+
const content = new PackContainer(pack, this.version, this.buildSnapshot, updatedBuildDependencies, this.resolveResults, this.resolveBuildDependenciesSnapshot);
|
|
1046
|
+
return this.fileSerializer
|
|
1047
|
+
.serialize(content, {
|
|
1048
|
+
filename: `${this.cacheLocation}/index${this._extension}`,
|
|
1049
|
+
extension: `${this._extension}`,
|
|
1050
|
+
logger: this.logger,
|
|
1051
|
+
profile: this.profile,
|
|
1052
|
+
})
|
|
1053
|
+
.then(() => {
|
|
1054
|
+
for (const dep of newBuildDependencies) {
|
|
1055
|
+
this.buildDependencies.add(dep);
|
|
1056
|
+
}
|
|
1057
|
+
this.newBuildDependencies.clear();
|
|
1058
|
+
this.logger.timeEnd(`store pack`);
|
|
1059
|
+
const stats = pack.getContentStats();
|
|
1060
|
+
this.logger.log('Stored pack (%d items, %d files, %d MiB)', pack.itemInfo.size, stats.count, Math.round(stats.size / 1024 / 1024));
|
|
1061
|
+
})
|
|
1062
|
+
.catch(err => {
|
|
1063
|
+
this.logger.timeEnd(`store pack`);
|
|
1064
|
+
this.logger.warn(`Caching failed for pack: ${err}`);
|
|
1065
|
+
this.logger.debug(err.stack);
|
|
1066
|
+
});
|
|
1067
|
+
});
|
|
1068
|
+
})
|
|
1069
|
+
.catch(err => {
|
|
1070
|
+
this.logger.warn(`Caching failed for pack: ${err}`);
|
|
1071
|
+
this.logger.debug(err.stack);
|
|
1072
|
+
});
|
|
1073
|
+
return this.storePromise;
|
|
1074
|
+
}
|
|
1075
|
+
clear() {
|
|
1076
|
+
this.fileSystemInfo.clear();
|
|
1077
|
+
this.buildDependencies.clear();
|
|
1078
|
+
this.newBuildDependencies.clear();
|
|
1079
|
+
this.resolveBuildDependenciesSnapshot = undefined;
|
|
1080
|
+
this.resolveResults = undefined;
|
|
1081
|
+
this.buildSnapshot = undefined;
|
|
1082
|
+
this.packPromise = undefined;
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
exports.default = PackFileCacheStrategy;
|