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,1221 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const eslint_scope_1 = __importDefault(require("eslint-scope"));
|
|
30
|
+
const referencer_1 = __importDefault(require("eslint-scope/lib/referencer"));
|
|
31
|
+
const webpack_sources_1 = require("webpack-sources");
|
|
32
|
+
const ExportsInfo_1 = require("@/module/ExportsInfo");
|
|
33
|
+
const Module_1 = __importDefault(require("@/module/Module"));
|
|
34
|
+
const ModuleTypeConstants_1 = require("@/module/ModuleTypeConstants");
|
|
35
|
+
const RuntimeGlobals = __importStar(require("@/module/RuntimeGlobals"));
|
|
36
|
+
const Template_1 = require("@/template/Template");
|
|
37
|
+
const HarmonyImportDependency_1 = require("@/dependencies/harmony/HarmonyImportDependency");
|
|
38
|
+
const JavascriptParser_1 = require("@/module/javascript/JavascriptParser");
|
|
39
|
+
const ArrayHelpers_1 = require("@/base/ArrayHelpers");
|
|
40
|
+
const LazySet_1 = __importDefault(require("@/base/LazySet"));
|
|
41
|
+
const comparators_1 = require("@/base/comparators");
|
|
42
|
+
const createHash_1 = __importDefault(require("@/base/createHash"));
|
|
43
|
+
const identifier_1 = require("@/base/identifier");
|
|
44
|
+
const makeSerializable_1 = __importDefault(require("@/serialization/makeSerializable"));
|
|
45
|
+
const propertyAccess_1 = __importDefault(require("@/base/propertyAccess"));
|
|
46
|
+
const propertyName_1 = require("@/base/propertyName");
|
|
47
|
+
const RuntimeHelpers_1 = require("@/module/RuntimeHelpers");
|
|
48
|
+
const ConcatenationScope_1 = __importDefault(require("../../ConcatenationScope"));
|
|
49
|
+
/** @typedef {typeof import("../util/Hash")} HashConstructor */
|
|
50
|
+
// fix eslint-scope to support class properties correctly
|
|
51
|
+
// cspell:word Referencer
|
|
52
|
+
const ReferencerClass = referencer_1.default;
|
|
53
|
+
if (!ReferencerClass.prototype.PropertyDefinition) {
|
|
54
|
+
ReferencerClass.prototype.PropertyDefinition = ReferencerClass.prototype.Property;
|
|
55
|
+
}
|
|
56
|
+
const RESERVED_NAMES = new Set([
|
|
57
|
+
// internal names (should always be renamed)
|
|
58
|
+
ConcatenationScope_1.default.DEFAULT_EXPORT,
|
|
59
|
+
ConcatenationScope_1.default.NAMESPACE_OBJECT_EXPORT,
|
|
60
|
+
// keywords
|
|
61
|
+
'abstract,arguments,async,await,boolean,break,byte,case,catch,char,class,const,continue',
|
|
62
|
+
'debugger,default,delete,do,double,else,enum,eval,export,extends,false,final,finally,float',
|
|
63
|
+
'for,function,goto,if,implements,import,in,instanceof,int,interface,let,long,native,new,null',
|
|
64
|
+
'package,private,protected,public,return,short,static,super,switch,synchronized,this,throw',
|
|
65
|
+
'throws,transient,true,try,typeof,var,void,volatile,while,with,yield',
|
|
66
|
+
// commonjs/amd
|
|
67
|
+
'module,__dirname,__filename,exports,require,define',
|
|
68
|
+
// js globals
|
|
69
|
+
'Array,Date,eval,function,hasOwnProperty,Infinity,isFinite,isNaN,isPrototypeOf,length,Math',
|
|
70
|
+
'NaN,name,Number,Object,prototype,String,toString,undefined,valueOf',
|
|
71
|
+
// browser globals
|
|
72
|
+
'alert,all,anchor,anchors,area,assign,blur,button,checkbox,clearInterval,clearTimeout',
|
|
73
|
+
'clientInformation,close,closed,confirm,constructor,crypto,decodeURI,decodeURIComponent',
|
|
74
|
+
'defaultStatus,document,element,elements,embed,embeds,encodeURI,encodeURIComponent,escape',
|
|
75
|
+
'event,fileUpload,focus,form,forms,frame,innerHeight,innerWidth,layer,layers,link,location',
|
|
76
|
+
'mimeTypes,navigate,navigator,frames,frameRate,hidden,history,image,images,offscreenBuffering',
|
|
77
|
+
'open,opener,option,outerHeight,outerWidth,packages,pageXOffset,pageYOffset,parent,parseFloat',
|
|
78
|
+
'parseInt,password,pkcs11,plugin,prompt,propertyIsEnum,radio,reset,screenX,screenY,scroll',
|
|
79
|
+
'secure,select,self,setInterval,setTimeout,status,submit,taint,text,textarea,top,unescape',
|
|
80
|
+
'untaint,window',
|
|
81
|
+
// window events
|
|
82
|
+
'onblur,onclick,onerror,onfocus,onkeydown,onkeypress,onkeyup,onmouseover,onload,onmouseup,onmousedown,onsubmit',
|
|
83
|
+
]
|
|
84
|
+
.join(',')
|
|
85
|
+
.split(','));
|
|
86
|
+
const createComparator = (property, comparator) => (a, b) => comparator(a[property], b[property]);
|
|
87
|
+
const compareNumbers = (a, b) => {
|
|
88
|
+
if (isNaN(a)) {
|
|
89
|
+
if (!isNaN(b)) {
|
|
90
|
+
return 1;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
if (isNaN(b)) {
|
|
95
|
+
return -1;
|
|
96
|
+
}
|
|
97
|
+
if (a !== b) {
|
|
98
|
+
return a < b ? -1 : 1;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return 0;
|
|
102
|
+
};
|
|
103
|
+
const bySourceOrder = createComparator('sourceOrder', compareNumbers);
|
|
104
|
+
const byRangeStart = createComparator('rangeStart', compareNumbers);
|
|
105
|
+
const joinIterableWithComma = iterable => {
|
|
106
|
+
// This is more performant than Array.from().join(", ")
|
|
107
|
+
// as it doesn't create an array
|
|
108
|
+
let str = '';
|
|
109
|
+
let first = true;
|
|
110
|
+
for (const item of iterable) {
|
|
111
|
+
if (first) {
|
|
112
|
+
first = false;
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
str += ', ';
|
|
116
|
+
}
|
|
117
|
+
str += item;
|
|
118
|
+
}
|
|
119
|
+
return str;
|
|
120
|
+
};
|
|
121
|
+
const getFinalBinding = (moduleGraph, info, exportName, moduleToInfoMap, runtime, requestShortener, runtimeTemplate, neededNamespaceObjects, asCall, strictHarmonyModule, asiSafe, alreadyVisited = new Set()) => {
|
|
122
|
+
var _a, _b;
|
|
123
|
+
const exportsType = info.module.getExportsType(moduleGraph, strictHarmonyModule);
|
|
124
|
+
if (exportName.length === 0) {
|
|
125
|
+
switch (exportsType) {
|
|
126
|
+
case 'default-only':
|
|
127
|
+
info.interopNamespaceObject2Used = true;
|
|
128
|
+
return {
|
|
129
|
+
info,
|
|
130
|
+
rawName: info.interopNamespaceObject2Name,
|
|
131
|
+
ids: exportName,
|
|
132
|
+
exportName,
|
|
133
|
+
};
|
|
134
|
+
case 'default-with-named':
|
|
135
|
+
info.interopNamespaceObjectUsed = true;
|
|
136
|
+
return {
|
|
137
|
+
info,
|
|
138
|
+
rawName: info.interopNamespaceObjectName,
|
|
139
|
+
ids: exportName,
|
|
140
|
+
exportName,
|
|
141
|
+
};
|
|
142
|
+
case 'namespace':
|
|
143
|
+
case 'dynamic':
|
|
144
|
+
break;
|
|
145
|
+
default:
|
|
146
|
+
throw new Error(`Unexpected exportsType ${exportsType}`);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
switch (exportsType) {
|
|
151
|
+
case 'namespace':
|
|
152
|
+
break;
|
|
153
|
+
case 'default-with-named':
|
|
154
|
+
switch (exportName[0]) {
|
|
155
|
+
case 'default':
|
|
156
|
+
exportName = exportName.slice(1);
|
|
157
|
+
break;
|
|
158
|
+
case '__esModule':
|
|
159
|
+
return {
|
|
160
|
+
info,
|
|
161
|
+
rawName: '/* __esModule */true',
|
|
162
|
+
ids: exportName.slice(1),
|
|
163
|
+
exportName,
|
|
164
|
+
};
|
|
165
|
+
default:
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
break;
|
|
169
|
+
case 'default-only': {
|
|
170
|
+
const exportId = exportName[0];
|
|
171
|
+
if (exportId === '__esModule') {
|
|
172
|
+
return {
|
|
173
|
+
info,
|
|
174
|
+
rawName: '/* __esModule */true',
|
|
175
|
+
ids: exportName.slice(1),
|
|
176
|
+
exportName,
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
exportName = exportName.slice(1);
|
|
180
|
+
if (exportId !== 'default') {
|
|
181
|
+
return {
|
|
182
|
+
info,
|
|
183
|
+
rawName: '/* non-default import from default-exporting module */undefined',
|
|
184
|
+
ids: exportName,
|
|
185
|
+
exportName,
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
190
|
+
case 'dynamic':
|
|
191
|
+
switch (exportName[0]) {
|
|
192
|
+
case 'default': {
|
|
193
|
+
exportName = exportName.slice(1);
|
|
194
|
+
info.interopDefaultAccessUsed = true;
|
|
195
|
+
const defaultExport = asCall
|
|
196
|
+
? `${info.interopDefaultAccessName}()`
|
|
197
|
+
: asiSafe
|
|
198
|
+
? `(${info.interopDefaultAccessName}())`
|
|
199
|
+
: asiSafe === false
|
|
200
|
+
? `;(${info.interopDefaultAccessName}())`
|
|
201
|
+
: `${info.interopDefaultAccessName}.a`;
|
|
202
|
+
return {
|
|
203
|
+
info,
|
|
204
|
+
rawName: defaultExport,
|
|
205
|
+
ids: exportName,
|
|
206
|
+
exportName,
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
case '__esModule':
|
|
210
|
+
return {
|
|
211
|
+
info,
|
|
212
|
+
rawName: '/* __esModule */true',
|
|
213
|
+
ids: exportName.slice(1),
|
|
214
|
+
exportName,
|
|
215
|
+
};
|
|
216
|
+
default:
|
|
217
|
+
break;
|
|
218
|
+
}
|
|
219
|
+
break;
|
|
220
|
+
default:
|
|
221
|
+
throw new Error(`Unexpected exportsType ${exportsType}`);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
if (exportName.length === 0) {
|
|
225
|
+
switch (info.type) {
|
|
226
|
+
case 'concatenated':
|
|
227
|
+
neededNamespaceObjects.add(info);
|
|
228
|
+
return {
|
|
229
|
+
info,
|
|
230
|
+
rawName: info.namespaceObjectName,
|
|
231
|
+
ids: exportName,
|
|
232
|
+
exportName,
|
|
233
|
+
};
|
|
234
|
+
case 'external':
|
|
235
|
+
return { info, rawName: info.name, ids: exportName, exportName };
|
|
236
|
+
default:
|
|
237
|
+
break;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
const exportsInfo = moduleGraph.getExportsInfo(info.module);
|
|
241
|
+
const exportInfo = exportsInfo.getExportInfo(exportName[0]);
|
|
242
|
+
if (alreadyVisited.has(exportInfo)) {
|
|
243
|
+
return {
|
|
244
|
+
info,
|
|
245
|
+
rawName: '/* circular reexport */ Object(function x() { x() }())',
|
|
246
|
+
ids: [],
|
|
247
|
+
exportName,
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
alreadyVisited.add(exportInfo);
|
|
251
|
+
switch (info.type) {
|
|
252
|
+
case 'concatenated': {
|
|
253
|
+
const exportId = exportName[0];
|
|
254
|
+
if (exportInfo.provided === false) {
|
|
255
|
+
// It's not provided, but it could be on the prototype
|
|
256
|
+
neededNamespaceObjects.add(info);
|
|
257
|
+
return {
|
|
258
|
+
info,
|
|
259
|
+
rawName: info.namespaceObjectName,
|
|
260
|
+
ids: exportName,
|
|
261
|
+
exportName,
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
const directExport = (_a = info.exportMap) === null || _a === void 0 ? void 0 : _a.get(exportId);
|
|
265
|
+
if (directExport) {
|
|
266
|
+
const usedName = exportsInfo.getUsedName(exportName, runtime);
|
|
267
|
+
if (!usedName) {
|
|
268
|
+
return {
|
|
269
|
+
info,
|
|
270
|
+
rawName: '/* unused export */ undefined',
|
|
271
|
+
ids: exportName.slice(1),
|
|
272
|
+
exportName,
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
return {
|
|
276
|
+
info,
|
|
277
|
+
name: directExport,
|
|
278
|
+
ids: usedName.slice(1),
|
|
279
|
+
exportName,
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
const rawExport = (_b = info.rawExportMap) === null || _b === void 0 ? void 0 : _b.get(exportId);
|
|
283
|
+
if (rawExport) {
|
|
284
|
+
return {
|
|
285
|
+
info,
|
|
286
|
+
rawName: rawExport,
|
|
287
|
+
ids: exportName.slice(1),
|
|
288
|
+
exportName,
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
const reexport = exportInfo.findTarget(moduleGraph, module => moduleToInfoMap.has(module));
|
|
292
|
+
if (reexport === false) {
|
|
293
|
+
throw new Error(`Target module of reexport from '${info.module.readableIdentifier(requestShortener)}' is not part of the concatenation (export '${exportId}')\nModules in the concatenation:\n${Array.from(moduleToInfoMap, ([m, info]) => ` * ${info.type} ${m.readableIdentifier(requestShortener)}`).join('\n')}`);
|
|
294
|
+
}
|
|
295
|
+
if (reexport) {
|
|
296
|
+
const refInfo = moduleToInfoMap.get(reexport.module);
|
|
297
|
+
return getFinalBinding(moduleGraph, refInfo, reexport.export ? [...reexport.export, ...exportName.slice(1)] : exportName.slice(1), moduleToInfoMap, runtime, requestShortener, runtimeTemplate, neededNamespaceObjects, asCall, info.module.buildMeta.strictHarmonyModule, asiSafe, alreadyVisited);
|
|
298
|
+
}
|
|
299
|
+
if (info.namespaceExportSymbol) {
|
|
300
|
+
const usedName = exportsInfo.getUsedName(exportName, runtime);
|
|
301
|
+
return {
|
|
302
|
+
info,
|
|
303
|
+
rawName: info.namespaceObjectName,
|
|
304
|
+
ids: usedName,
|
|
305
|
+
exportName,
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
throw new Error(`Cannot get final name for export '${exportName.join('.')}' of ${info.module.readableIdentifier(requestShortener)}`);
|
|
309
|
+
}
|
|
310
|
+
case 'external': {
|
|
311
|
+
const used = exportsInfo.getUsedName(exportName, runtime);
|
|
312
|
+
if (!used) {
|
|
313
|
+
return {
|
|
314
|
+
info,
|
|
315
|
+
rawName: '/* unused export */ undefined',
|
|
316
|
+
ids: exportName.slice(1),
|
|
317
|
+
exportName,
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
const comment = (0, ArrayHelpers_1.equals)(used, exportName)
|
|
321
|
+
? ''
|
|
322
|
+
: Template_1.Template.toNormalComment(`${exportName.join('.')}`);
|
|
323
|
+
return { info, rawName: info.name + comment, ids: used, exportName };
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
const getFinalName = (moduleGraph, info, exportName, moduleToInfoMap, runtime, requestShortener, runtimeTemplate, neededNamespaceObjects, asCall, callContext, strictHarmonyModule, asiSafe) => {
|
|
328
|
+
const binding = getFinalBinding(moduleGraph, info, exportName, moduleToInfoMap, runtime, requestShortener, runtimeTemplate, neededNamespaceObjects, asCall, strictHarmonyModule, asiSafe);
|
|
329
|
+
{
|
|
330
|
+
const { ids, comment } = binding;
|
|
331
|
+
let reference;
|
|
332
|
+
let isPropertyAccess;
|
|
333
|
+
if ('rawName' in binding) {
|
|
334
|
+
reference = `${binding.rawName}${comment || ''}${(0, propertyAccess_1.default)(ids)}`;
|
|
335
|
+
isPropertyAccess = ids.length > 0;
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
const { info, name: exportId } = binding;
|
|
339
|
+
const name = info.internalNames.get(exportId);
|
|
340
|
+
if (!name) {
|
|
341
|
+
throw new Error(`The export "${exportId}" in "${info.module.readableIdentifier(requestShortener)}" has no internal name (existing names: ${Array.from(info.internalNames, ([name, symbol]) => `${name}: ${symbol}`).join(', ') ||
|
|
342
|
+
'none'})`);
|
|
343
|
+
}
|
|
344
|
+
reference = `${name}${comment || ''}${(0, propertyAccess_1.default)(ids)}`;
|
|
345
|
+
isPropertyAccess = ids.length > 1;
|
|
346
|
+
}
|
|
347
|
+
if (isPropertyAccess && asCall && callContext === false) {
|
|
348
|
+
return asiSafe
|
|
349
|
+
? `(0,${reference})`
|
|
350
|
+
: asiSafe === false
|
|
351
|
+
? `;(0,${reference})`
|
|
352
|
+
: `/*#__PURE__*/Object(${reference})`;
|
|
353
|
+
}
|
|
354
|
+
return reference;
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
const addScopeSymbols = (s, nameSet, scopeSet1, scopeSet2) => {
|
|
358
|
+
let scope = s;
|
|
359
|
+
while (scope) {
|
|
360
|
+
if (scopeSet1.has(scope))
|
|
361
|
+
break;
|
|
362
|
+
if (scopeSet2.has(scope))
|
|
363
|
+
break;
|
|
364
|
+
scopeSet1.add(scope);
|
|
365
|
+
for (const variable of scope.variables) {
|
|
366
|
+
nameSet.add(variable.name);
|
|
367
|
+
}
|
|
368
|
+
scope = scope.upper;
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
const getAllReferences = variable => {
|
|
372
|
+
let set = variable.references;
|
|
373
|
+
// Look for inner scope variables too (like in class Foo { t() { Foo } })
|
|
374
|
+
const identifiers = new Set(variable.identifiers);
|
|
375
|
+
for (const scope of variable.scope.childScopes) {
|
|
376
|
+
for (const innerVar of scope.variables) {
|
|
377
|
+
if (innerVar.identifiers.some(id => identifiers.has(id))) {
|
|
378
|
+
set = set.concat(innerVar.references);
|
|
379
|
+
break;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
return set;
|
|
384
|
+
};
|
|
385
|
+
const getPathInAst = (ast, node) => {
|
|
386
|
+
if (ast === node) {
|
|
387
|
+
return [];
|
|
388
|
+
}
|
|
389
|
+
const nr = node.range;
|
|
390
|
+
const enterNode = n => {
|
|
391
|
+
if (!n)
|
|
392
|
+
return undefined;
|
|
393
|
+
const r = n.range;
|
|
394
|
+
if (r) {
|
|
395
|
+
if (r[0] <= nr[0] && r[1] >= nr[1]) {
|
|
396
|
+
const path = getPathInAst(n, node);
|
|
397
|
+
if (path) {
|
|
398
|
+
path.push(n);
|
|
399
|
+
return path;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
return undefined;
|
|
404
|
+
};
|
|
405
|
+
if (Array.isArray(ast)) {
|
|
406
|
+
for (let i = 0; i < ast.length; i++) {
|
|
407
|
+
const enterResult = enterNode(ast[i]);
|
|
408
|
+
if (enterResult !== undefined)
|
|
409
|
+
return enterResult;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
else if (ast && typeof ast === 'object') {
|
|
413
|
+
const keys = Object.keys(ast);
|
|
414
|
+
for (let i = 0; i < keys.length; i++) {
|
|
415
|
+
const value = ast[keys[i]];
|
|
416
|
+
if (Array.isArray(value)) {
|
|
417
|
+
const pathResult = getPathInAst(value, node);
|
|
418
|
+
if (pathResult !== undefined)
|
|
419
|
+
return pathResult;
|
|
420
|
+
}
|
|
421
|
+
else if (value && typeof value === 'object') {
|
|
422
|
+
const enterResult = enterNode(value);
|
|
423
|
+
if (enterResult !== undefined)
|
|
424
|
+
return enterResult;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
};
|
|
429
|
+
const TYPES = new Set(['javascript']);
|
|
430
|
+
class ConcatenatedModule extends Module_1.default {
|
|
431
|
+
static create(rootModule, modules, runtime, associatedObjectForCache, hashFunction = 'md4') {
|
|
432
|
+
const identifier = ConcatenatedModule._createIdentifier(rootModule, modules, associatedObjectForCache, hashFunction);
|
|
433
|
+
return new ConcatenatedModule({
|
|
434
|
+
identifier,
|
|
435
|
+
rootModule,
|
|
436
|
+
modules,
|
|
437
|
+
runtime,
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
constructor({ identifier, rootModule, modules, runtime, }) {
|
|
441
|
+
super(ModuleTypeConstants_1.JAVASCRIPT_MODULE_TYPE_ESM, null, rootModule === null || rootModule === void 0 ? void 0 : rootModule.layer);
|
|
442
|
+
// Info from Factory
|
|
443
|
+
this._identifier = identifier;
|
|
444
|
+
this.rootModule = rootModule;
|
|
445
|
+
this._modules = modules;
|
|
446
|
+
this._runtime = runtime;
|
|
447
|
+
this.factoryMeta = rootModule === null || rootModule === void 0 ? void 0 : rootModule.factoryMeta;
|
|
448
|
+
}
|
|
449
|
+
updateCacheModule(module) {
|
|
450
|
+
throw new Error('Must not be called');
|
|
451
|
+
}
|
|
452
|
+
getSourceTypes() {
|
|
453
|
+
return TYPES;
|
|
454
|
+
}
|
|
455
|
+
get modules() {
|
|
456
|
+
return Array.from(this._modules);
|
|
457
|
+
}
|
|
458
|
+
identifier() {
|
|
459
|
+
return this._identifier;
|
|
460
|
+
}
|
|
461
|
+
readableIdentifier(requestShortener) {
|
|
462
|
+
return (`${this.rootModule.readableIdentifier(requestShortener)} + ${this._modules.size - 1} modules`);
|
|
463
|
+
}
|
|
464
|
+
libIdent(options) {
|
|
465
|
+
return this.rootModule.libIdent(options);
|
|
466
|
+
}
|
|
467
|
+
nameForCondition() {
|
|
468
|
+
return this.rootModule.nameForCondition();
|
|
469
|
+
}
|
|
470
|
+
getSideEffectsConnectionState(moduleGraph) {
|
|
471
|
+
return this.rootModule.getSideEffectsConnectionState(moduleGraph);
|
|
472
|
+
}
|
|
473
|
+
build(options, compilation, resolver, fs, callback) {
|
|
474
|
+
const { rootModule } = this;
|
|
475
|
+
this.buildInfo = {
|
|
476
|
+
strict: true,
|
|
477
|
+
cacheable: true,
|
|
478
|
+
moduleArgument: rootModule.buildInfo.moduleArgument,
|
|
479
|
+
exportsArgument: rootModule.buildInfo.exportsArgument,
|
|
480
|
+
fileDependencies: new LazySet_1.default(),
|
|
481
|
+
contextDependencies: new LazySet_1.default(),
|
|
482
|
+
missingDependencies: new LazySet_1.default(),
|
|
483
|
+
topLevelDeclarations: new Set(),
|
|
484
|
+
assets: undefined,
|
|
485
|
+
};
|
|
486
|
+
this.buildMeta = rootModule.buildMeta;
|
|
487
|
+
this.clearDependenciesAndBlocks();
|
|
488
|
+
this.clearWarningsAndErrors();
|
|
489
|
+
for (const m of this._modules) {
|
|
490
|
+
// populate cacheable
|
|
491
|
+
if (!m.buildInfo.cacheable) {
|
|
492
|
+
this.buildInfo.cacheable = false;
|
|
493
|
+
}
|
|
494
|
+
// populate dependencies
|
|
495
|
+
for (const d of m.dependencies.filter(dep => !(dep instanceof HarmonyImportDependency_1.HarmonyImportDependency) ||
|
|
496
|
+
!this._modules.has(compilation.moduleGraph.getModule(dep)))) {
|
|
497
|
+
this.dependencies.push(d);
|
|
498
|
+
}
|
|
499
|
+
// populate blocks
|
|
500
|
+
for (const d of m.blocks) {
|
|
501
|
+
this.blocks.push(d);
|
|
502
|
+
}
|
|
503
|
+
// populate warnings
|
|
504
|
+
const warnings = m.getWarnings();
|
|
505
|
+
if (warnings !== undefined) {
|
|
506
|
+
for (const warning of warnings) {
|
|
507
|
+
this.addWarning(warning);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
// populate errors
|
|
511
|
+
const errors = m.getErrors();
|
|
512
|
+
if (errors !== undefined) {
|
|
513
|
+
for (const error of errors) {
|
|
514
|
+
this.addError(error);
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
// populate topLevelDeclarations
|
|
518
|
+
if (m.buildInfo.topLevelDeclarations) {
|
|
519
|
+
const topLevelDeclarations = this.buildInfo.topLevelDeclarations;
|
|
520
|
+
if (topLevelDeclarations !== undefined) {
|
|
521
|
+
for (const decl of m.buildInfo.topLevelDeclarations) {
|
|
522
|
+
topLevelDeclarations.add(decl);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
else {
|
|
527
|
+
this.buildInfo.topLevelDeclarations = undefined;
|
|
528
|
+
}
|
|
529
|
+
// populate assets
|
|
530
|
+
if (m.buildInfo.assets) {
|
|
531
|
+
if (this.buildInfo.assets === undefined) {
|
|
532
|
+
this.buildInfo.assets = Object.create(null);
|
|
533
|
+
}
|
|
534
|
+
Object.assign(this.buildInfo.assets, m.buildInfo.assets);
|
|
535
|
+
}
|
|
536
|
+
if (m.buildInfo.assetsInfo) {
|
|
537
|
+
if (this.buildInfo.assetsInfo === undefined) {
|
|
538
|
+
this.buildInfo.assetsInfo = new Map();
|
|
539
|
+
}
|
|
540
|
+
for (const [key, value] of m.buildInfo.assetsInfo) {
|
|
541
|
+
this.buildInfo.assetsInfo.set(key, value);
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
callback();
|
|
546
|
+
}
|
|
547
|
+
size(type) {
|
|
548
|
+
// Guess size from embedded modules
|
|
549
|
+
let size = 0;
|
|
550
|
+
for (const module of this._modules) {
|
|
551
|
+
size += module.size(type);
|
|
552
|
+
}
|
|
553
|
+
return size;
|
|
554
|
+
}
|
|
555
|
+
_createConcatenationList(rootModule, modulesSet, runtime, moduleGraph) {
|
|
556
|
+
const list = [];
|
|
557
|
+
const existingEntries = new Map();
|
|
558
|
+
const getConcatenatedImports = module => {
|
|
559
|
+
const connections = Array.from(moduleGraph.getOutgoingConnections(module));
|
|
560
|
+
if (module === rootModule) {
|
|
561
|
+
for (const c of moduleGraph.getOutgoingConnections(this))
|
|
562
|
+
connections.push(c);
|
|
563
|
+
}
|
|
564
|
+
const references = connections
|
|
565
|
+
.filter((connection) => {
|
|
566
|
+
if (!(connection.dependency instanceof HarmonyImportDependency_1.HarmonyImportDependency))
|
|
567
|
+
return false;
|
|
568
|
+
return (connection &&
|
|
569
|
+
connection.resolvedOriginModule === module &&
|
|
570
|
+
connection.module &&
|
|
571
|
+
connection.isTargetActive(runtime));
|
|
572
|
+
})
|
|
573
|
+
.map(connection => {
|
|
574
|
+
var _a;
|
|
575
|
+
const dep = connection.dependency;
|
|
576
|
+
return {
|
|
577
|
+
connection,
|
|
578
|
+
sourceOrder: dep.sourceOrder,
|
|
579
|
+
rangeStart: (_a = dep.range) === null || _a === void 0 ? void 0 : _a[0],
|
|
580
|
+
};
|
|
581
|
+
});
|
|
582
|
+
/**
|
|
583
|
+
* bySourceOrder
|
|
584
|
+
* @example
|
|
585
|
+
* import a from "a"; // sourceOrder=1
|
|
586
|
+
* import b from "b"; // sourceOrder=2
|
|
587
|
+
*
|
|
588
|
+
* byRangeStart
|
|
589
|
+
* @example
|
|
590
|
+
* import {a, b} from "a"; // sourceOrder=1
|
|
591
|
+
* a.a(); // first range
|
|
592
|
+
* b.b(); // second range
|
|
593
|
+
*
|
|
594
|
+
* If there is no reexport, we have the same source.
|
|
595
|
+
* If there is reexport, but module has side effects, this will lead to reexport module only.
|
|
596
|
+
* If there is side-effects-free reexport, we can get simple deterministic result with range start comparison.
|
|
597
|
+
*/
|
|
598
|
+
references.sort((0, comparators_1.concatComparators)(bySourceOrder, byRangeStart));
|
|
599
|
+
const referencesMap = new Map();
|
|
600
|
+
for (const { connection } of references) {
|
|
601
|
+
const runtimeCondition = (0, RuntimeHelpers_1.filterRuntime)(runtime, r => connection.isTargetActive(r));
|
|
602
|
+
if (runtimeCondition === false)
|
|
603
|
+
continue;
|
|
604
|
+
const module = connection.module;
|
|
605
|
+
const entry = referencesMap.get(module);
|
|
606
|
+
if (entry === undefined) {
|
|
607
|
+
referencesMap.set(module, { connection, runtimeCondition });
|
|
608
|
+
continue;
|
|
609
|
+
}
|
|
610
|
+
entry.runtimeCondition = (0, RuntimeHelpers_1.mergeRuntimeConditionNonFalse)(entry.runtimeCondition, runtimeCondition, runtime);
|
|
611
|
+
}
|
|
612
|
+
return referencesMap.values();
|
|
613
|
+
};
|
|
614
|
+
const enterModule = (connection, runtimeCondition) => {
|
|
615
|
+
const module = connection.module;
|
|
616
|
+
if (!module)
|
|
617
|
+
return;
|
|
618
|
+
const existingEntry = existingEntries.get(module);
|
|
619
|
+
if (existingEntry === true) {
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
622
|
+
if (modulesSet.has(module)) {
|
|
623
|
+
existingEntries.set(module, true);
|
|
624
|
+
if (runtimeCondition !== true) {
|
|
625
|
+
throw new Error(`Cannot runtime-conditional concatenate a module (${module.identifier()} in ${this.rootModule.identifier()}, ${(0, RuntimeHelpers_1.runtimeConditionToString)(runtimeCondition)}). This should not happen.`);
|
|
626
|
+
}
|
|
627
|
+
const imports = getConcatenatedImports(module);
|
|
628
|
+
for (const { connection, runtimeCondition } of imports)
|
|
629
|
+
enterModule(connection, runtimeCondition);
|
|
630
|
+
list.push({
|
|
631
|
+
type: 'concatenated',
|
|
632
|
+
module: connection.module,
|
|
633
|
+
runtimeCondition,
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
else {
|
|
637
|
+
if (existingEntry !== undefined) {
|
|
638
|
+
const reducedRuntimeCondition = (0, RuntimeHelpers_1.subtractRuntimeCondition)(runtimeCondition, existingEntry, runtime);
|
|
639
|
+
if (reducedRuntimeCondition === false)
|
|
640
|
+
return;
|
|
641
|
+
runtimeCondition = reducedRuntimeCondition;
|
|
642
|
+
existingEntries.set(connection.module, (0, RuntimeHelpers_1.mergeRuntimeConditionNonFalse)(existingEntry, runtimeCondition, runtime));
|
|
643
|
+
}
|
|
644
|
+
else {
|
|
645
|
+
existingEntries.set(connection.module, runtimeCondition);
|
|
646
|
+
}
|
|
647
|
+
if (list.length > 0) {
|
|
648
|
+
const lastItem = list[list.length - 1];
|
|
649
|
+
if (lastItem.type === 'external' && lastItem.module === connection.module) {
|
|
650
|
+
lastItem.runtimeCondition = (0, RuntimeHelpers_1.mergeRuntimeCondition)(lastItem.runtimeCondition, runtimeCondition, runtime);
|
|
651
|
+
return;
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
list.push({
|
|
655
|
+
type: 'external',
|
|
656
|
+
get module() {
|
|
657
|
+
// We need to use a getter here, because the module in the dependency
|
|
658
|
+
// could be replaced by some other process (i. e. also replaced with a
|
|
659
|
+
// concatenated module)
|
|
660
|
+
return connection.module;
|
|
661
|
+
},
|
|
662
|
+
runtimeCondition,
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
};
|
|
666
|
+
existingEntries.set(rootModule, true);
|
|
667
|
+
const imports = getConcatenatedImports(rootModule);
|
|
668
|
+
for (const { connection, runtimeCondition } of imports)
|
|
669
|
+
enterModule(connection, runtimeCondition);
|
|
670
|
+
list.push({
|
|
671
|
+
type: 'concatenated',
|
|
672
|
+
module: rootModule,
|
|
673
|
+
runtimeCondition: true,
|
|
674
|
+
});
|
|
675
|
+
return list;
|
|
676
|
+
}
|
|
677
|
+
static _createIdentifier(rootModule, modules, associatedObjectForCache, hashFunction = 'md4') {
|
|
678
|
+
const cachedMakePathsRelative = identifier_1.makePathsRelative.bindContextCache(rootModule.context, associatedObjectForCache);
|
|
679
|
+
const identifiers = [];
|
|
680
|
+
for (const module of modules) {
|
|
681
|
+
identifiers.push(cachedMakePathsRelative(module.identifier()));
|
|
682
|
+
}
|
|
683
|
+
identifiers.sort();
|
|
684
|
+
const hash = (0, createHash_1.default)(hashFunction);
|
|
685
|
+
hash.update(identifiers.join(' '));
|
|
686
|
+
return `${rootModule.identifier()}|${hash.digest('hex')}`;
|
|
687
|
+
}
|
|
688
|
+
addCacheDependencies(fileDependencies, contextDependencies, missingDependencies, buildDependencies) {
|
|
689
|
+
for (const module of this._modules) {
|
|
690
|
+
module.addCacheDependencies(fileDependencies, contextDependencies, missingDependencies, buildDependencies);
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
codeGeneration({ dependencyTemplates, runtimeTemplate, moduleGraph, chunkGraph, runtime: generationRuntime, codeGenerationResults, }) {
|
|
694
|
+
const runtimeRequirements = new Set();
|
|
695
|
+
const runtime = (0, RuntimeHelpers_1.intersectRuntime)(generationRuntime, this._runtime);
|
|
696
|
+
const requestShortener = runtimeTemplate.requestShortener;
|
|
697
|
+
// Meta info for each module
|
|
698
|
+
const [modulesWithInfo, moduleToInfoMap] = this._getModulesWithInfo(moduleGraph, runtime);
|
|
699
|
+
// Set with modules that need a generated namespace object
|
|
700
|
+
const neededNamespaceObjects = new Set();
|
|
701
|
+
// Generate source code and analyse scopes
|
|
702
|
+
// Prepare a ReplaceSource for the final source
|
|
703
|
+
for (const info of moduleToInfoMap.values()) {
|
|
704
|
+
this._analyseModule(moduleToInfoMap, info, dependencyTemplates, runtimeTemplate, moduleGraph, chunkGraph, runtime, codeGenerationResults);
|
|
705
|
+
}
|
|
706
|
+
// List of all used names to avoid conflicts
|
|
707
|
+
const allUsedNames = new Set(RESERVED_NAMES);
|
|
708
|
+
// Updated Top level declarations are created by renaming
|
|
709
|
+
const topLevelDeclarations = new Set();
|
|
710
|
+
// List of additional names in scope for module references
|
|
711
|
+
const usedNamesInScopeInfo = new Map();
|
|
712
|
+
const getUsedNamesInScopeInfo = (module, id) => {
|
|
713
|
+
const key = `${module}-${id}`;
|
|
714
|
+
let info = usedNamesInScopeInfo.get(key);
|
|
715
|
+
if (info === undefined) {
|
|
716
|
+
info = {
|
|
717
|
+
usedNames: new Set(),
|
|
718
|
+
alreadyCheckedScopes: new Set(),
|
|
719
|
+
};
|
|
720
|
+
usedNamesInScopeInfo.set(key, info);
|
|
721
|
+
}
|
|
722
|
+
return info;
|
|
723
|
+
};
|
|
724
|
+
// Set of already checked scopes
|
|
725
|
+
const ignoredScopes = new Set();
|
|
726
|
+
// get all global names
|
|
727
|
+
for (const info of modulesWithInfo) {
|
|
728
|
+
if (info.type === 'concatenated') {
|
|
729
|
+
// ignore symbols from moduleScope
|
|
730
|
+
if (info.moduleScope) {
|
|
731
|
+
ignoredScopes.add(info.moduleScope);
|
|
732
|
+
}
|
|
733
|
+
// The super class expression in class scopes behaves weird
|
|
734
|
+
// We get ranges of all super class expressions to make
|
|
735
|
+
// renaming to work correctly
|
|
736
|
+
const superClassCache = new WeakMap();
|
|
737
|
+
const getSuperClassExpressions = scope => {
|
|
738
|
+
const cacheEntry = superClassCache.get(scope);
|
|
739
|
+
if (cacheEntry !== undefined)
|
|
740
|
+
return cacheEntry;
|
|
741
|
+
const superClassExpressions = [];
|
|
742
|
+
for (const childScope of scope.childScopes) {
|
|
743
|
+
if (childScope.type !== 'class')
|
|
744
|
+
continue;
|
|
745
|
+
const block = childScope.block;
|
|
746
|
+
if ((block.type === 'ClassDeclaration' || block.type === 'ClassExpression') &&
|
|
747
|
+
block.superClass) {
|
|
748
|
+
superClassExpressions.push({
|
|
749
|
+
range: block.superClass.range,
|
|
750
|
+
variables: childScope.variables,
|
|
751
|
+
});
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
superClassCache.set(scope, superClassExpressions);
|
|
755
|
+
return superClassExpressions;
|
|
756
|
+
};
|
|
757
|
+
// add global symbols
|
|
758
|
+
if (info.globalScope) {
|
|
759
|
+
for (const reference of info.globalScope.through) {
|
|
760
|
+
const name = reference.identifier.name;
|
|
761
|
+
if (ConcatenationScope_1.default.isModuleReference(name)) {
|
|
762
|
+
const match = ConcatenationScope_1.default.matchModuleReference(name);
|
|
763
|
+
if (!match)
|
|
764
|
+
continue;
|
|
765
|
+
const referencedInfo = modulesWithInfo[match.index];
|
|
766
|
+
if (referencedInfo.type === 'reference')
|
|
767
|
+
throw new Error("Module reference can't point to a reference");
|
|
768
|
+
const binding = getFinalBinding(moduleGraph, referencedInfo, match.ids, moduleToInfoMap, runtime, requestShortener, runtimeTemplate, neededNamespaceObjects, false, info.module.buildMeta.strictHarmonyModule, true);
|
|
769
|
+
if (!binding.ids)
|
|
770
|
+
continue;
|
|
771
|
+
const { usedNames, alreadyCheckedScopes } = getUsedNamesInScopeInfo(binding.info.module.identifier(), 'name' in binding ? binding.name : '');
|
|
772
|
+
for (const expr of getSuperClassExpressions(reference.from)) {
|
|
773
|
+
if (expr.range[0] <= reference.identifier.range[0] &&
|
|
774
|
+
expr.range[1] >= reference.identifier.range[1]) {
|
|
775
|
+
for (const variable of expr.variables) {
|
|
776
|
+
usedNames.add(variable.name);
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
addScopeSymbols(reference.from, usedNames, alreadyCheckedScopes, ignoredScopes);
|
|
781
|
+
}
|
|
782
|
+
else {
|
|
783
|
+
allUsedNames.add(name);
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
// generate names for symbols
|
|
790
|
+
for (const info of moduleToInfoMap.values()) {
|
|
791
|
+
const { usedNames: namespaceObjectUsedNames } = getUsedNamesInScopeInfo(info.module.identifier(), '');
|
|
792
|
+
switch (info.type) {
|
|
793
|
+
case 'concatenated': {
|
|
794
|
+
for (const variable of info.moduleScope.variables) {
|
|
795
|
+
const name = variable.name;
|
|
796
|
+
const { usedNames, alreadyCheckedScopes } = getUsedNamesInScopeInfo(info.module.identifier(), name);
|
|
797
|
+
if (allUsedNames.has(name) || usedNames.has(name)) {
|
|
798
|
+
const references = getAllReferences(variable);
|
|
799
|
+
for (const ref of references) {
|
|
800
|
+
addScopeSymbols(ref.from, usedNames, alreadyCheckedScopes, ignoredScopes);
|
|
801
|
+
}
|
|
802
|
+
const newName = this.findNewName(name, allUsedNames, usedNames, info.module.readableIdentifier(requestShortener));
|
|
803
|
+
allUsedNames.add(newName);
|
|
804
|
+
info.internalNames.set(name, newName);
|
|
805
|
+
topLevelDeclarations.add(newName);
|
|
806
|
+
const source = info.source;
|
|
807
|
+
const allIdentifiers = new Set(references.map(r => r.identifier).concat(variable.identifiers));
|
|
808
|
+
for (const identifier of allIdentifiers) {
|
|
809
|
+
const r = identifier.range;
|
|
810
|
+
const path = getPathInAst(info.ast, identifier);
|
|
811
|
+
if (path && path.length > 1) {
|
|
812
|
+
const maybeProperty = path[1].type === 'AssignmentPattern' && path[1].left === path[0]
|
|
813
|
+
? path[2]
|
|
814
|
+
: path[1];
|
|
815
|
+
if (maybeProperty.type === 'Property' && maybeProperty.shorthand) {
|
|
816
|
+
source.insert(r[1], `: ${newName}`);
|
|
817
|
+
continue;
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
source.replace(r[0], r[1] - 1, newName);
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
else {
|
|
824
|
+
allUsedNames.add(name);
|
|
825
|
+
info.internalNames.set(name, name);
|
|
826
|
+
topLevelDeclarations.add(name);
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
let namespaceObjectName;
|
|
830
|
+
if (info.namespaceExportSymbol) {
|
|
831
|
+
namespaceObjectName = info.internalNames.get(info.namespaceExportSymbol);
|
|
832
|
+
}
|
|
833
|
+
else {
|
|
834
|
+
namespaceObjectName = this.findNewName('namespaceObject', allUsedNames, namespaceObjectUsedNames, info.module.readableIdentifier(requestShortener));
|
|
835
|
+
allUsedNames.add(namespaceObjectName);
|
|
836
|
+
}
|
|
837
|
+
info.namespaceObjectName = namespaceObjectName;
|
|
838
|
+
topLevelDeclarations.add(namespaceObjectName);
|
|
839
|
+
break;
|
|
840
|
+
}
|
|
841
|
+
case 'external': {
|
|
842
|
+
const externalName = this.findNewName('', allUsedNames, namespaceObjectUsedNames, info.module.readableIdentifier(requestShortener));
|
|
843
|
+
allUsedNames.add(externalName);
|
|
844
|
+
info.name = externalName;
|
|
845
|
+
topLevelDeclarations.add(externalName);
|
|
846
|
+
break;
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
if (info.module.buildMeta.exportsType !== 'namespace') {
|
|
850
|
+
const externalNameInterop = this.findNewName('namespaceObject', allUsedNames, namespaceObjectUsedNames, info.module.readableIdentifier(requestShortener));
|
|
851
|
+
allUsedNames.add(externalNameInterop);
|
|
852
|
+
info.interopNamespaceObjectName = externalNameInterop;
|
|
853
|
+
topLevelDeclarations.add(externalNameInterop);
|
|
854
|
+
}
|
|
855
|
+
if (info.module.buildMeta.exportsType === 'default' &&
|
|
856
|
+
info.module.buildMeta.defaultObject !== 'redirect') {
|
|
857
|
+
const externalNameInterop = this.findNewName('namespaceObject2', allUsedNames, namespaceObjectUsedNames, info.module.readableIdentifier(requestShortener));
|
|
858
|
+
allUsedNames.add(externalNameInterop);
|
|
859
|
+
info.interopNamespaceObject2Name = externalNameInterop;
|
|
860
|
+
topLevelDeclarations.add(externalNameInterop);
|
|
861
|
+
}
|
|
862
|
+
if (info.module.buildMeta.exportsType === 'dynamic' || !info.module.buildMeta.exportsType) {
|
|
863
|
+
const externalNameInterop = this.findNewName('default', allUsedNames, namespaceObjectUsedNames, info.module.readableIdentifier(requestShortener));
|
|
864
|
+
allUsedNames.add(externalNameInterop);
|
|
865
|
+
info.interopDefaultAccessName = externalNameInterop;
|
|
866
|
+
topLevelDeclarations.add(externalNameInterop);
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
// Find and replace references to modules
|
|
870
|
+
for (const info of moduleToInfoMap.values()) {
|
|
871
|
+
if (info.type === 'concatenated') {
|
|
872
|
+
for (const reference of info.globalScope.through) {
|
|
873
|
+
const name = reference.identifier.name;
|
|
874
|
+
const match = ConcatenationScope_1.default.matchModuleReference(name);
|
|
875
|
+
if (match) {
|
|
876
|
+
const referencedInfo = modulesWithInfo[match.index];
|
|
877
|
+
if (referencedInfo.type === 'reference')
|
|
878
|
+
throw new Error("Module reference can't point to a reference");
|
|
879
|
+
const finalName = getFinalName(moduleGraph, referencedInfo, match.ids, moduleToInfoMap, runtime, requestShortener, runtimeTemplate, neededNamespaceObjects, match.call, !match.directImport, info.module.buildMeta.strictHarmonyModule, match.asiSafe);
|
|
880
|
+
const r = reference.identifier.range;
|
|
881
|
+
const source = info.source;
|
|
882
|
+
// range is extended by 2 chars to cover the appended "._"
|
|
883
|
+
source.replace(r[0], r[1] + 1, finalName);
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
// Map with all root exposed used exports
|
|
889
|
+
const exportsMap = new Map();
|
|
890
|
+
// Set with all root exposed unused exports
|
|
891
|
+
const unusedExports = new Set();
|
|
892
|
+
const rootInfo = moduleToInfoMap.get(this.rootModule);
|
|
893
|
+
const strictHarmonyModule = rootInfo.module.buildMeta.strictHarmonyModule;
|
|
894
|
+
const exportsInfo = moduleGraph.getExportsInfo(rootInfo.module);
|
|
895
|
+
for (const exportInfo of exportsInfo.orderedExports) {
|
|
896
|
+
const name = exportInfo.name;
|
|
897
|
+
if (exportInfo.provided === false)
|
|
898
|
+
continue;
|
|
899
|
+
const used = exportInfo.getUsedName(undefined, runtime);
|
|
900
|
+
if (!used) {
|
|
901
|
+
unusedExports.add(name);
|
|
902
|
+
continue;
|
|
903
|
+
}
|
|
904
|
+
exportsMap.set(used, requestShortener => {
|
|
905
|
+
try {
|
|
906
|
+
const finalName = getFinalName(moduleGraph, rootInfo, [name], moduleToInfoMap, runtime, requestShortener, runtimeTemplate, neededNamespaceObjects, false, false, strictHarmonyModule, true);
|
|
907
|
+
return `/* ${exportInfo.isReexport() ? 'reexport' : 'binding'} */ ${finalName}`;
|
|
908
|
+
}
|
|
909
|
+
catch (e) {
|
|
910
|
+
e.message += `\nwhile generating the root export '${name}' (used name: '${used}')`;
|
|
911
|
+
throw e;
|
|
912
|
+
}
|
|
913
|
+
});
|
|
914
|
+
}
|
|
915
|
+
const result = new webpack_sources_1.ConcatSource();
|
|
916
|
+
// add harmony compatibility flag (must be first because of possible circular dependencies)
|
|
917
|
+
if (moduleGraph.getExportsInfo(this).otherExportsInfo.getUsed(runtime) !== ExportsInfo_1.UsageState.Unused) {
|
|
918
|
+
result.add(`// ESM COMPAT FLAG\n`);
|
|
919
|
+
result.add(runtimeTemplate.defineEsModuleFlagStatement({
|
|
920
|
+
exportsArgument: this.exportsArgument,
|
|
921
|
+
runtimeRequirements,
|
|
922
|
+
}));
|
|
923
|
+
}
|
|
924
|
+
// define exports
|
|
925
|
+
if (exportsMap.size > 0) {
|
|
926
|
+
runtimeRequirements.add(RuntimeGlobals.exports);
|
|
927
|
+
runtimeRequirements.add(RuntimeGlobals.definePropertyGetters);
|
|
928
|
+
const definitions = [];
|
|
929
|
+
for (const [key, value] of exportsMap) {
|
|
930
|
+
definitions.push(`\n ${(0, propertyName_1.propertyName)(key)}: ${runtimeTemplate.returningFunction(value(requestShortener))}`);
|
|
931
|
+
}
|
|
932
|
+
result.add(`\n// EXPORTS\n`);
|
|
933
|
+
result.add(`${RuntimeGlobals.definePropertyGetters}(${this.exportsArgument}, {${definitions.join(',')}\n});\n`);
|
|
934
|
+
}
|
|
935
|
+
// list unused exports
|
|
936
|
+
if (unusedExports.size > 0) {
|
|
937
|
+
result.add(`\n// UNUSED EXPORTS: ${joinIterableWithComma(unusedExports)}\n`);
|
|
938
|
+
}
|
|
939
|
+
// generate namespace objects
|
|
940
|
+
const namespaceObjectSources = new Map();
|
|
941
|
+
for (const info of neededNamespaceObjects) {
|
|
942
|
+
if (info.namespaceExportSymbol)
|
|
943
|
+
continue;
|
|
944
|
+
const nsObj = [];
|
|
945
|
+
const exportsInfo = moduleGraph.getExportsInfo(info.module);
|
|
946
|
+
for (const exportInfo of exportsInfo.orderedExports) {
|
|
947
|
+
if (exportInfo.provided === false)
|
|
948
|
+
continue;
|
|
949
|
+
const usedName = exportInfo.getUsedName(undefined, runtime);
|
|
950
|
+
if (usedName) {
|
|
951
|
+
const finalName = getFinalName(moduleGraph, info, [exportInfo.name], moduleToInfoMap, runtime, requestShortener, runtimeTemplate, neededNamespaceObjects, false, undefined, info.module.buildMeta.strictHarmonyModule, true);
|
|
952
|
+
nsObj.push(`\n ${(0, propertyName_1.propertyName)(usedName)}: ${runtimeTemplate.returningFunction(finalName)}`);
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
const name = info.namespaceObjectName;
|
|
956
|
+
const defineGetters = nsObj.length > 0
|
|
957
|
+
? `${RuntimeGlobals.definePropertyGetters}(${name}, {${nsObj.join(',')}\n});\n`
|
|
958
|
+
: '';
|
|
959
|
+
if (nsObj.length > 0)
|
|
960
|
+
runtimeRequirements.add(RuntimeGlobals.definePropertyGetters);
|
|
961
|
+
namespaceObjectSources.set(info, `
|
|
962
|
+
// NAMESPACE OBJECT: ${info.module.readableIdentifier(requestShortener)}
|
|
963
|
+
var ${name} = {};
|
|
964
|
+
${RuntimeGlobals.makeNamespaceObject}(${name});
|
|
965
|
+
${defineGetters}`);
|
|
966
|
+
runtimeRequirements.add(RuntimeGlobals.makeNamespaceObject);
|
|
967
|
+
}
|
|
968
|
+
// define required namespace objects (must be before evaluation modules)
|
|
969
|
+
for (const info of modulesWithInfo) {
|
|
970
|
+
if (info.type === 'concatenated') {
|
|
971
|
+
const source = namespaceObjectSources.get(info);
|
|
972
|
+
if (!source)
|
|
973
|
+
continue;
|
|
974
|
+
result.add(source);
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
const chunkInitFragments = [];
|
|
978
|
+
// evaluate modules in order
|
|
979
|
+
for (const rawInfo of modulesWithInfo) {
|
|
980
|
+
let name;
|
|
981
|
+
let isConditional = false;
|
|
982
|
+
const info = rawInfo.type === 'reference' ? rawInfo.target : rawInfo;
|
|
983
|
+
switch (info.type) {
|
|
984
|
+
case 'concatenated': {
|
|
985
|
+
result.add(`\n;// CONCATENATED MODULE: ${info.module.readableIdentifier(requestShortener)}\n`);
|
|
986
|
+
result.add(info.source);
|
|
987
|
+
if (info.chunkInitFragments) {
|
|
988
|
+
for (const f of info.chunkInitFragments)
|
|
989
|
+
chunkInitFragments.push(f);
|
|
990
|
+
}
|
|
991
|
+
if (info.runtimeRequirements) {
|
|
992
|
+
for (const r of info.runtimeRequirements) {
|
|
993
|
+
runtimeRequirements.add(r);
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
name = info.namespaceObjectName;
|
|
997
|
+
break;
|
|
998
|
+
}
|
|
999
|
+
case 'external': {
|
|
1000
|
+
result.add(`\n// EXTERNAL MODULE: ${info.module.readableIdentifier(requestShortener)}\n`);
|
|
1001
|
+
runtimeRequirements.add(RuntimeGlobals.require);
|
|
1002
|
+
const { runtimeCondition } = rawInfo;
|
|
1003
|
+
const condition = runtimeTemplate.runtimeConditionExpression({
|
|
1004
|
+
chunkGraph,
|
|
1005
|
+
runtimeCondition,
|
|
1006
|
+
runtime,
|
|
1007
|
+
runtimeRequirements,
|
|
1008
|
+
});
|
|
1009
|
+
if (condition !== 'true') {
|
|
1010
|
+
isConditional = true;
|
|
1011
|
+
result.add(`if (${condition}) {\n`);
|
|
1012
|
+
}
|
|
1013
|
+
result.add(`var ${info.name} = ${RuntimeGlobals.require}(${JSON.stringify(chunkGraph.getModuleId(info.module))});`);
|
|
1014
|
+
name = info.name;
|
|
1015
|
+
break;
|
|
1016
|
+
}
|
|
1017
|
+
default:
|
|
1018
|
+
throw new Error(`Unsupported concatenation entry type ${info.type}`);
|
|
1019
|
+
}
|
|
1020
|
+
if (info.interopNamespaceObjectUsed) {
|
|
1021
|
+
runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject);
|
|
1022
|
+
result.add(`\nvar ${info.interopNamespaceObjectName} = /*#__PURE__*/${RuntimeGlobals.createFakeNamespaceObject}(${name}, 2);`);
|
|
1023
|
+
}
|
|
1024
|
+
if (info.interopNamespaceObject2Used) {
|
|
1025
|
+
runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject);
|
|
1026
|
+
result.add(`\nvar ${info.interopNamespaceObject2Name} = /*#__PURE__*/${RuntimeGlobals.createFakeNamespaceObject}(${name});`);
|
|
1027
|
+
}
|
|
1028
|
+
if (info.interopDefaultAccessUsed) {
|
|
1029
|
+
runtimeRequirements.add(RuntimeGlobals.compatGetDefaultExport);
|
|
1030
|
+
result.add(`\nvar ${info.interopDefaultAccessName} = /*#__PURE__*/${RuntimeGlobals.compatGetDefaultExport}(${name});`);
|
|
1031
|
+
}
|
|
1032
|
+
if (isConditional) {
|
|
1033
|
+
result.add('\n}');
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
const data = new Map();
|
|
1037
|
+
if (chunkInitFragments.length > 0)
|
|
1038
|
+
data.set('chunkInitFragments', chunkInitFragments);
|
|
1039
|
+
data.set('topLevelDeclarations', topLevelDeclarations);
|
|
1040
|
+
const resultEntry = {
|
|
1041
|
+
sources: new Map([['javascript', new webpack_sources_1.CachedSource(result)]]),
|
|
1042
|
+
data,
|
|
1043
|
+
runtimeRequirements,
|
|
1044
|
+
};
|
|
1045
|
+
return resultEntry;
|
|
1046
|
+
}
|
|
1047
|
+
_analyseModule(modulesMap, info, dependencyTemplates, runtimeTemplate, moduleGraph, chunkGraph, runtime, codeGenerationResults) {
|
|
1048
|
+
if (info.type === 'concatenated') {
|
|
1049
|
+
const m = info.module;
|
|
1050
|
+
try {
|
|
1051
|
+
// Create a concatenation scope to track and capture information
|
|
1052
|
+
const concatenationScope = new ConcatenationScope_1.default(modulesMap, info);
|
|
1053
|
+
// TODO cache codeGeneration results
|
|
1054
|
+
const codeGenResult = m.codeGeneration({
|
|
1055
|
+
dependencyTemplates,
|
|
1056
|
+
runtimeTemplate,
|
|
1057
|
+
moduleGraph,
|
|
1058
|
+
chunkGraph,
|
|
1059
|
+
runtime,
|
|
1060
|
+
concatenationScope,
|
|
1061
|
+
codeGenerationResults,
|
|
1062
|
+
sourceTypes: TYPES,
|
|
1063
|
+
});
|
|
1064
|
+
const source = codeGenResult.sources.get('javascript');
|
|
1065
|
+
const data = codeGenResult.data;
|
|
1066
|
+
const chunkInitFragments = data === null || data === void 0 ? void 0 : data.get('chunkInitFragments');
|
|
1067
|
+
const code = source.source().toString();
|
|
1068
|
+
let ast;
|
|
1069
|
+
try {
|
|
1070
|
+
ast = JavascriptParser_1.JavascriptParser._parse(code, {
|
|
1071
|
+
sourceType: 'module',
|
|
1072
|
+
});
|
|
1073
|
+
}
|
|
1074
|
+
catch (err) {
|
|
1075
|
+
if (err.loc && typeof err.loc === 'object' && typeof err.loc.line === 'number') {
|
|
1076
|
+
const lineNumber = err.loc.line;
|
|
1077
|
+
const lines = code.split('\n');
|
|
1078
|
+
err.message +=
|
|
1079
|
+
`\n| ${lines.slice(Math.max(0, lineNumber - 3), lineNumber + 2).join('\n| ')}`;
|
|
1080
|
+
}
|
|
1081
|
+
throw err;
|
|
1082
|
+
}
|
|
1083
|
+
const scopeManager = eslint_scope_1.default.analyze(ast, {
|
|
1084
|
+
ecmaVersion: 6,
|
|
1085
|
+
sourceType: 'module',
|
|
1086
|
+
optimistic: true,
|
|
1087
|
+
ignoreEval: true,
|
|
1088
|
+
impliedStrict: true,
|
|
1089
|
+
});
|
|
1090
|
+
const globalScope = scopeManager.acquire(ast);
|
|
1091
|
+
const moduleScope = globalScope.childScopes[0];
|
|
1092
|
+
const resultSource = new webpack_sources_1.ReplaceSource(source);
|
|
1093
|
+
info.runtimeRequirements = codeGenResult.runtimeRequirements;
|
|
1094
|
+
info.ast = ast;
|
|
1095
|
+
info.internalSource = source;
|
|
1096
|
+
info.source = resultSource;
|
|
1097
|
+
info.chunkInitFragments = chunkInitFragments;
|
|
1098
|
+
info.globalScope = globalScope;
|
|
1099
|
+
info.moduleScope = moduleScope;
|
|
1100
|
+
}
|
|
1101
|
+
catch (err) {
|
|
1102
|
+
err.message += `\nwhile analyzing module ${m.identifier()} for concatenation`;
|
|
1103
|
+
throw err;
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
_getModulesWithInfo(moduleGraph, runtime) {
|
|
1108
|
+
const orderedConcatenationList = this._createConcatenationList(this.rootModule, this._modules, runtime, moduleGraph);
|
|
1109
|
+
const map = new Map();
|
|
1110
|
+
const list = orderedConcatenationList.map((info, index) => {
|
|
1111
|
+
let item = map.get(info.module);
|
|
1112
|
+
if (item === undefined) {
|
|
1113
|
+
switch (info.type) {
|
|
1114
|
+
case 'concatenated':
|
|
1115
|
+
item = {
|
|
1116
|
+
type: 'concatenated',
|
|
1117
|
+
module: info.module,
|
|
1118
|
+
index,
|
|
1119
|
+
ast: undefined,
|
|
1120
|
+
internalSource: undefined,
|
|
1121
|
+
runtimeRequirements: undefined,
|
|
1122
|
+
source: undefined,
|
|
1123
|
+
globalScope: undefined,
|
|
1124
|
+
moduleScope: undefined,
|
|
1125
|
+
internalNames: new Map(),
|
|
1126
|
+
exportMap: undefined,
|
|
1127
|
+
rawExportMap: undefined,
|
|
1128
|
+
namespaceExportSymbol: undefined,
|
|
1129
|
+
namespaceObjectName: undefined,
|
|
1130
|
+
interopNamespaceObjectUsed: false,
|
|
1131
|
+
interopNamespaceObjectName: undefined,
|
|
1132
|
+
interopNamespaceObject2Used: false,
|
|
1133
|
+
interopNamespaceObject2Name: undefined,
|
|
1134
|
+
interopDefaultAccessUsed: false,
|
|
1135
|
+
interopDefaultAccessName: undefined,
|
|
1136
|
+
};
|
|
1137
|
+
break;
|
|
1138
|
+
case 'external':
|
|
1139
|
+
item = {
|
|
1140
|
+
type: 'external',
|
|
1141
|
+
module: info.module,
|
|
1142
|
+
runtimeCondition: info.runtimeCondition,
|
|
1143
|
+
index,
|
|
1144
|
+
name: undefined,
|
|
1145
|
+
interopNamespaceObjectUsed: false,
|
|
1146
|
+
interopNamespaceObjectName: undefined,
|
|
1147
|
+
interopNamespaceObject2Used: false,
|
|
1148
|
+
interopNamespaceObject2Name: undefined,
|
|
1149
|
+
interopDefaultAccessUsed: false,
|
|
1150
|
+
interopDefaultAccessName: undefined,
|
|
1151
|
+
};
|
|
1152
|
+
break;
|
|
1153
|
+
default:
|
|
1154
|
+
throw new Error(`Unsupported concatenation entry type ${info.type}`);
|
|
1155
|
+
}
|
|
1156
|
+
map.set(item.module, item);
|
|
1157
|
+
return item;
|
|
1158
|
+
}
|
|
1159
|
+
const ref = {
|
|
1160
|
+
type: 'reference',
|
|
1161
|
+
runtimeCondition: info.runtimeCondition,
|
|
1162
|
+
target: item,
|
|
1163
|
+
};
|
|
1164
|
+
return ref;
|
|
1165
|
+
});
|
|
1166
|
+
return [list, map];
|
|
1167
|
+
}
|
|
1168
|
+
findNewName(oldName, usedNamed1, usedNamed2, extraInfo) {
|
|
1169
|
+
let name = oldName;
|
|
1170
|
+
if (name === ConcatenationScope_1.default.DEFAULT_EXPORT) {
|
|
1171
|
+
name = '';
|
|
1172
|
+
}
|
|
1173
|
+
if (name === ConcatenationScope_1.default.NAMESPACE_OBJECT_EXPORT) {
|
|
1174
|
+
name = 'namespaceObject';
|
|
1175
|
+
}
|
|
1176
|
+
// Remove uncool stuff
|
|
1177
|
+
extraInfo = extraInfo.replace(/\.+\/|(\/index)?\.([a-zA-Z0-9]{1,4})($|\s|\?)|\s*\+\s*\d+\s*modules/g, '');
|
|
1178
|
+
const splittedInfo = extraInfo.split('/');
|
|
1179
|
+
while (splittedInfo.length) {
|
|
1180
|
+
name = splittedInfo.pop() + (name ? `_${name}` : '');
|
|
1181
|
+
const nameIdent = Template_1.Template.toIdentifier(name);
|
|
1182
|
+
if (!usedNamed1.has(nameIdent) && (!usedNamed2 || !usedNamed2.has(nameIdent)))
|
|
1183
|
+
return nameIdent;
|
|
1184
|
+
}
|
|
1185
|
+
let i = 0;
|
|
1186
|
+
let nameWithNumber = Template_1.Template.toIdentifier(`${name}_${i}`);
|
|
1187
|
+
while (usedNamed1.has(nameWithNumber) || (usedNamed2 === null || usedNamed2 === void 0 ? void 0 : usedNamed2.has(nameWithNumber))) {
|
|
1188
|
+
i++;
|
|
1189
|
+
nameWithNumber = Template_1.Template.toIdentifier(`${name}_${i}`);
|
|
1190
|
+
}
|
|
1191
|
+
return nameWithNumber;
|
|
1192
|
+
}
|
|
1193
|
+
updateHash(hash, context) {
|
|
1194
|
+
const { chunkGraph, runtime } = context;
|
|
1195
|
+
for (const info of this._createConcatenationList(this.rootModule, this._modules, (0, RuntimeHelpers_1.intersectRuntime)(runtime, this._runtime), chunkGraph.moduleGraph)) {
|
|
1196
|
+
switch (info.type) {
|
|
1197
|
+
case 'concatenated':
|
|
1198
|
+
info.module.updateHash(hash, context);
|
|
1199
|
+
break;
|
|
1200
|
+
case 'external':
|
|
1201
|
+
hash.update(`${chunkGraph.getModuleId(info.module)}`);
|
|
1202
|
+
// TODO runtimeCondition
|
|
1203
|
+
break;
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
super.updateHash(hash, context);
|
|
1207
|
+
}
|
|
1208
|
+
static deserialize(context) {
|
|
1209
|
+
const obj = new ConcatenatedModule({
|
|
1210
|
+
// @ts-ignore
|
|
1211
|
+
identifier: undefined,
|
|
1212
|
+
rootModule: undefined,
|
|
1213
|
+
modules: undefined,
|
|
1214
|
+
runtime: undefined,
|
|
1215
|
+
});
|
|
1216
|
+
obj.deserialize(context);
|
|
1217
|
+
return obj;
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
(0, makeSerializable_1.default)(ConcatenatedModule, 'mp-compiler/core/module/optimize/ConcatenatedModule');
|
|
1221
|
+
exports.default = ConcatenatedModule;
|