webpack 5.106.1 → 5.107.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 +2 -2
- package/lib/APIPlugin.js +4 -2
- package/lib/AsyncDependenciesBlock.js +3 -0
- package/lib/AutomaticPrefetchPlugin.js +6 -1
- package/lib/BannerPlugin.js +10 -1
- package/lib/Cache.js +27 -5
- package/lib/CacheFacade.js +26 -0
- package/lib/Chunk.js +46 -0
- package/lib/ChunkGraph.js +111 -0
- package/lib/ChunkGroup.js +57 -13
- package/lib/ChunkTemplate.js +9 -0
- package/lib/CleanPlugin.js +14 -1
- package/lib/CodeGenerationResults.js +19 -0
- package/lib/CompatibilityPlugin.js +23 -8
- package/lib/Compilation.js +161 -27
- package/lib/Compiler.js +41 -17
- package/lib/ConcatenationScope.js +24 -1
- package/lib/ConditionalInitFragment.js +6 -0
- package/lib/ConstPlugin.js +4 -1
- package/lib/ContextExclusionPlugin.js +2 -1
- package/lib/ContextModule.js +14 -2
- package/lib/ContextModuleFactory.js +10 -0
- package/lib/ContextReplacementPlugin.js +4 -1
- package/lib/DefinePlugin.js +22 -9
- package/lib/DependenciesBlock.js +6 -1
- package/lib/Dependency.js +48 -4
- package/lib/DependencyTemplate.js +7 -1
- package/lib/DependencyTemplates.js +4 -0
- package/lib/DotenvPlugin.js +3 -0
- package/lib/DynamicEntryPlugin.js +3 -1
- package/lib/EntryOptionPlugin.js +3 -0
- package/lib/EntryPlugin.js +2 -1
- package/lib/Entrypoint.js +4 -0
- package/lib/EnvironmentPlugin.js +3 -2
- package/lib/ErrorHelpers.js +7 -0
- package/lib/EvalDevToolModulePlugin.js +3 -1
- package/lib/EvalSourceMapDevToolPlugin.js +11 -10
- package/lib/ExportsInfo.js +56 -2
- package/lib/ExportsInfoApiPlugin.js +2 -1
- package/lib/ExternalModule.js +114 -15
- package/lib/ExternalModuleFactoryPlugin.js +15 -0
- package/lib/ExternalsPlugin.js +2 -1
- package/lib/FileSystemInfo.js +291 -71
- package/lib/FlagAllModulesAsUsedPlugin.js +2 -1
- package/lib/FlagDependencyExportsPlugin.js +4 -1
- package/lib/FlagDependencyUsagePlugin.js +5 -1
- package/lib/FlagEntryExportAsUsedPlugin.js +2 -1
- package/lib/Generator.js +16 -3
- package/lib/HotModuleReplacementPlugin.js +35 -9
- package/lib/IgnorePlugin.js +4 -2
- package/lib/IgnoreWarningsPlugin.js +2 -1
- package/lib/InitFragment.js +10 -0
- package/lib/JavascriptMetaInfoPlugin.js +2 -1
- package/lib/LibraryTemplatePlugin.js +2 -1
- package/lib/LoaderOptionsPlugin.js +3 -1
- package/lib/LoaderTargetPlugin.js +2 -1
- package/lib/MainTemplate.js +15 -0
- package/lib/ManifestPlugin.js +9 -2
- package/lib/Module.js +101 -19
- package/lib/ModuleFactory.js +6 -1
- package/lib/ModuleFilenameHelpers.js +3 -0
- package/lib/ModuleGraph.js +66 -0
- package/lib/ModuleGraphConnection.js +9 -0
- package/lib/ModuleInfoHeaderPlugin.js +5 -0
- package/lib/ModuleSourceTypeConstants.js +32 -1
- package/lib/ModuleTemplate.js +8 -0
- package/lib/ModuleTypeConstants.js +12 -3
- package/lib/MultiCompiler.js +30 -2
- package/lib/MultiStats.js +8 -0
- package/lib/MultiWatching.js +3 -0
- package/lib/NoEmitOnErrorsPlugin.js +1 -1
- package/lib/NodeStuffPlugin.js +11 -2
- package/lib/NormalModule.js +43 -33
- package/lib/NormalModuleFactory.js +35 -2
- package/lib/NormalModuleReplacementPlugin.js +1 -1
- package/lib/NullFactory.js +1 -0
- package/lib/OptionsApply.js +1 -0
- package/lib/Parser.js +3 -1
- package/lib/PlatformPlugin.js +2 -1
- package/lib/PrefetchPlugin.js +2 -1
- package/lib/ProgressPlugin.js +158 -68
- package/lib/ProvidePlugin.js +3 -1
- package/lib/RawModule.js +12 -0
- package/lib/RecordIdsPlugin.js +8 -0
- package/lib/RequestShortener.js +8 -0
- package/lib/ResolverFactory.js +5 -0
- package/lib/RuntimeGlobals.js +6 -5
- package/lib/RuntimeModule.js +22 -7
- package/lib/RuntimePlugin.js +13 -0
- package/lib/RuntimeTemplate.js +35 -1
- package/lib/SelfModuleFactory.js +2 -0
- package/lib/SourceMapDevToolModuleOptionsPlugin.js +2 -0
- package/lib/SourceMapDevToolPlugin.js +3 -1
- package/lib/Stats.js +5 -0
- package/lib/Template.js +20 -0
- package/lib/TemplatedPathPlugin.js +10 -3
- package/lib/UseStrictPlugin.js +2 -1
- package/lib/WarnCaseSensitiveModulesPlugin.js +71 -3
- package/lib/WarnDeprecatedOptionPlugin.js +2 -2
- package/lib/WarnNoModeSetPlugin.js +17 -2
- package/lib/WatchIgnorePlugin.js +4 -1
- package/lib/Watching.js +16 -3
- package/lib/WebpackError.js +3 -74
- package/lib/WebpackIsIncludedPlugin.js +3 -1
- package/lib/WebpackOptionsApply.js +14 -1
- package/lib/WebpackOptionsDefaulter.js +1 -0
- package/lib/asset/AssetBytesGenerator.js +12 -2
- package/lib/asset/AssetBytesParser.js +1 -0
- package/lib/asset/AssetGenerator.js +42 -10
- package/lib/asset/AssetModulesPlugin.js +7 -2
- package/lib/asset/AssetParser.js +2 -0
- package/lib/asset/AssetSourceGenerator.js +12 -2
- package/lib/asset/AssetSourceParser.js +1 -0
- package/lib/asset/RawDataUrlModule.js +11 -0
- package/lib/async-modules/AsyncModuleHelpers.js +1 -0
- package/lib/async-modules/AwaitDependenciesInitFragment.js +4 -0
- package/lib/async-modules/InferAsyncModulesPlugin.js +1 -1
- package/lib/buildChunkGraph.js +19 -6
- package/lib/cache/AddBuildDependenciesPlugin.js +2 -1
- package/lib/cache/AddManagedPathsPlugin.js +2 -1
- package/lib/cache/IdleFileCachePlugin.js +2 -1
- package/lib/cache/MemoryCachePlugin.js +1 -1
- package/lib/cache/MemoryWithGcCachePlugin.js +3 -1
- package/lib/cache/PackFileCacheStrategy.js +33 -4
- package/lib/cache/ResolverCachePlugin.js +10 -1
- package/lib/cache/getLazyHashedEtag.js +4 -0
- package/lib/cache/mergeEtags.js +2 -0
- package/lib/cli.js +33 -1
- package/lib/config/browserslistTargetHandler.js +2 -0
- package/lib/config/defaults.js +232 -12
- package/lib/config/normalization.js +15 -1
- package/lib/config/target.js +11 -0
- package/lib/container/ContainerEntryDependency.js +2 -0
- package/lib/container/ContainerEntryModule.js +12 -0
- package/lib/container/ContainerEntryModuleFactory.js +1 -0
- package/lib/container/ContainerExposedDependency.js +4 -0
- package/lib/container/ContainerPlugin.js +2 -1
- package/lib/container/ContainerReferencePlugin.js +2 -1
- package/lib/container/FallbackDependency.js +4 -0
- package/lib/container/FallbackItemDependency.js +1 -0
- package/lib/container/FallbackModule.js +12 -0
- package/lib/container/FallbackModuleFactory.js +1 -0
- package/lib/container/ModuleFederationPlugin.js +3 -1
- package/lib/container/RemoteModule.js +13 -0
- package/lib/container/RemoteRuntimeModule.js +1 -0
- package/lib/container/RemoteToExternalDependency.js +1 -0
- package/lib/container/options.js +7 -0
- package/lib/css/CssGenerator.js +336 -100
- package/lib/css/CssInjectStyleRuntimeModule.js +45 -42
- package/lib/css/CssLoadingRuntimeModule.js +23 -4
- package/lib/{CssModule.js → css/CssModule.js} +21 -15
- package/lib/css/CssModulesPlugin.js +235 -89
- package/lib/css/CssParser.js +616 -261
- package/lib/css/walkCssTokens.js +179 -2
- package/lib/debug/ProfilingPlugin.js +19 -1
- package/lib/dependencies/AMDDefineDependency.js +7 -0
- package/lib/dependencies/AMDDefineDependencyParserPlugin.js +12 -0
- package/lib/dependencies/AMDPlugin.js +4 -1
- package/lib/dependencies/AMDRequireArrayDependency.js +6 -0
- package/lib/dependencies/AMDRequireContextDependency.js +3 -0
- package/lib/dependencies/AMDRequireDependenciesBlock.js +1 -0
- package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +14 -1
- package/lib/dependencies/AMDRequireDependency.js +4 -0
- package/lib/dependencies/AMDRequireItemDependency.js +1 -0
- package/lib/dependencies/AMDRuntimeModules.js +3 -0
- package/lib/dependencies/CachedConstDependency.js +6 -1
- package/lib/dependencies/CommonJsDependencyHelpers.js +64 -0
- package/lib/dependencies/CommonJsExportRequireDependency.js +62 -10
- package/lib/dependencies/CommonJsExportsDependency.js +4 -0
- package/lib/dependencies/CommonJsExportsParserPlugin.js +9 -1
- package/lib/dependencies/CommonJsFullRequireDependency.js +36 -9
- package/lib/dependencies/CommonJsImportsParserPlugin.js +24 -3
- package/lib/dependencies/CommonJsPlugin.js +4 -1
- package/lib/dependencies/CommonJsRequireContextDependency.js +3 -0
- package/lib/dependencies/CommonJsRequireDependency.js +70 -4
- package/lib/dependencies/CommonJsSelfReferenceDependency.js +5 -0
- package/lib/dependencies/ConstDependency.js +6 -1
- package/lib/dependencies/ContextDependency.js +9 -2
- package/lib/dependencies/ContextDependencyHelpers.js +4 -1
- package/lib/dependencies/ContextDependencyTemplateAsId.js +1 -0
- package/lib/dependencies/ContextDependencyTemplateAsRequireCall.js +1 -0
- package/lib/dependencies/ContextElementDependency.js +4 -0
- package/lib/dependencies/CreateRequireParserPlugin.js +7 -1
- package/lib/dependencies/CreateScriptUrlDependency.js +4 -0
- package/lib/dependencies/CriticalDependencyWarning.js +2 -1
- package/lib/dependencies/CssIcssExportDependency.js +339 -66
- package/lib/dependencies/CssIcssImportDependency.js +53 -8
- package/lib/dependencies/CssIcssSymbolDependency.js +16 -4
- package/lib/dependencies/CssImportDependency.js +12 -0
- package/lib/dependencies/CssUrlDependency.js +32 -0
- package/lib/dependencies/DelegatedSourceDependency.js +1 -0
- package/lib/dependencies/DllEntryDependency.js +3 -0
- package/lib/dependencies/DynamicExports.js +5 -0
- package/lib/dependencies/EntryDependency.js +1 -0
- package/lib/dependencies/ExportsInfoDependency.js +6 -0
- package/lib/dependencies/ExternalModuleDependency.js +5 -0
- package/lib/dependencies/ExternalModuleInitFragment.js +3 -0
- package/lib/dependencies/ExternalModuleInitFragmentDependency.js +4 -0
- package/lib/dependencies/HarmonyAcceptDependency.js +6 -0
- package/lib/dependencies/HarmonyAcceptImportDependency.js +1 -0
- package/lib/dependencies/HarmonyCompatibilityDependency.js +1 -0
- package/lib/dependencies/HarmonyDetectionParserPlugin.js +4 -1
- package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +4 -0
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +10 -7
- package/lib/dependencies/HarmonyExportExpressionDependency.js +27 -14
- package/lib/dependencies/HarmonyExportHeaderDependency.js +4 -0
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +143 -5
- package/lib/dependencies/HarmonyExportInitFragment.js +6 -0
- package/lib/dependencies/HarmonyExportSpecifierDependency.js +5 -0
- package/lib/dependencies/HarmonyExports.js +2 -0
- package/lib/dependencies/HarmonyImportDependency.js +21 -2
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +31 -1
- package/lib/dependencies/HarmonyImportSideEffectDependency.js +4 -0
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +18 -3
- package/lib/{HarmonyLinkingError.js → dependencies/HarmonyLinkingError.js} +5 -3
- package/lib/dependencies/HarmonyModulesPlugin.js +4 -1
- package/lib/dependencies/HarmonyTopLevelThisParserPlugin.js +1 -0
- package/lib/dependencies/HtmlInlineScriptDependency.js +133 -0
- package/lib/dependencies/HtmlInlineStyleDependency.js +101 -0
- package/lib/dependencies/HtmlScriptSrcDependency.js +318 -0
- package/lib/dependencies/HtmlSourceDependency.js +127 -0
- package/lib/dependencies/ImportContextDependency.js +4 -0
- package/lib/dependencies/ImportDependency.js +5 -0
- package/lib/dependencies/ImportEagerDependency.js +2 -0
- package/lib/dependencies/ImportMetaContextDependency.js +1 -0
- package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +4 -1
- package/lib/dependencies/ImportMetaContextPlugin.js +2 -1
- package/lib/dependencies/ImportMetaHotAcceptDependency.js +1 -0
- package/lib/dependencies/ImportMetaHotDeclineDependency.js +1 -0
- package/lib/dependencies/ImportMetaPlugin.js +6 -0
- package/lib/dependencies/ImportParserPlugin.js +9 -2
- package/lib/dependencies/ImportPhase.js +7 -3
- package/lib/dependencies/ImportPlugin.js +2 -1
- package/lib/dependencies/ImportWeakDependency.js +2 -0
- package/lib/dependencies/JsonExportsDependency.js +6 -1
- package/lib/dependencies/LoaderDependency.js +2 -0
- package/lib/dependencies/LoaderImportDependency.js +2 -0
- package/lib/dependencies/LoaderPlugin.js +4 -1
- package/lib/dependencies/LocalModule.js +4 -0
- package/lib/dependencies/LocalModuleDependency.js +4 -0
- package/lib/dependencies/LocalModulesHelpers.js +3 -0
- package/lib/dependencies/ModuleDecoratorDependency.js +7 -1
- package/lib/dependencies/ModuleDependency.js +7 -0
- package/lib/dependencies/ModuleDependencyTemplateAsId.js +1 -0
- package/lib/dependencies/ModuleDependencyTemplateAsRequireId.js +1 -0
- package/lib/dependencies/ModuleHotAcceptDependency.js +1 -0
- package/lib/dependencies/ModuleHotDeclineDependency.js +1 -0
- package/lib/dependencies/ModuleInitFragmentDependency.js +4 -0
- package/lib/dependencies/NullDependency.js +2 -0
- package/lib/dependencies/PrefetchDependency.js +1 -0
- package/lib/dependencies/ProvidedDependency.js +6 -1
- package/lib/dependencies/PureExpressionDependency.js +7 -1
- package/lib/dependencies/RequireContextDependency.js +1 -0
- package/lib/dependencies/RequireContextDependencyParserPlugin.js +1 -0
- package/lib/dependencies/RequireContextPlugin.js +2 -1
- package/lib/dependencies/RequireEnsureDependenciesBlock.js +1 -0
- package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +1 -0
- package/lib/dependencies/RequireEnsureDependency.js +4 -0
- package/lib/dependencies/RequireEnsureItemDependency.js +1 -0
- package/lib/dependencies/RequireEnsurePlugin.js +2 -1
- package/lib/dependencies/RequireHeaderDependency.js +4 -0
- package/lib/dependencies/RequireIncludeDependency.js +2 -0
- package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +4 -1
- package/lib/dependencies/RequireIncludePlugin.js +2 -1
- package/lib/{RequireJsStuffPlugin.js → dependencies/RequireJsStuffPlugin.js} +9 -8
- package/lib/dependencies/RequireResolveContextDependency.js +3 -0
- package/lib/dependencies/RequireResolveDependency.js +1 -0
- package/lib/dependencies/RequireResolveHeaderDependency.js +5 -0
- package/lib/dependencies/RuntimeRequirementsDependency.js +5 -1
- package/lib/dependencies/StaticExportsDependency.js +3 -0
- package/lib/dependencies/SystemPlugin.js +5 -2
- package/lib/dependencies/SystemRuntimeModule.js +1 -0
- package/lib/dependencies/URLContextDependency.js +3 -0
- package/lib/dependencies/URLDependency.js +6 -0
- package/lib/dependencies/URLPlugin.js +2 -0
- package/lib/dependencies/UnsupportedDependency.js +4 -0
- package/lib/dependencies/WebAssemblyExportImportedDependency.js +4 -0
- package/lib/dependencies/WebAssemblyImportDependency.js +5 -2
- package/lib/dependencies/WebpackIsIncludedDependency.js +2 -0
- package/lib/dependencies/WorkerDependency.js +6 -1
- package/lib/dependencies/WorkerPlugin.js +11 -3
- package/lib/dependencies/getFunctionExpression.js +1 -0
- package/lib/dependencies/processExportInfo.js +1 -0
- package/lib/{DelegatedModule.js → dll/DelegatedModule.js} +44 -31
- package/lib/{DelegatedModuleFactoryPlugin.js → dll/DelegatedModuleFactoryPlugin.js} +7 -4
- package/lib/{DelegatedPlugin.js → dll/DelegatedPlugin.js} +4 -3
- package/lib/{DllEntryPlugin.js → dll/DllEntryPlugin.js} +6 -5
- package/lib/{DllModule.js → dll/DllModule.js} +35 -24
- package/lib/{DllModuleFactory.js → dll/DllModuleFactory.js} +5 -4
- package/lib/{DllPlugin.js → dll/DllPlugin.js} +8 -6
- package/lib/{DllReferencePlugin.js → dll/DllReferencePlugin.js} +23 -18
- package/lib/{LibManifestPlugin.js → dll/LibManifestPlugin.js} +13 -10
- package/lib/electron/ElectronTargetPlugin.js +2 -1
- package/lib/{AbstractMethodError.js → errors/AbstractMethodError.js} +10 -1
- package/lib/{AsyncDependencyToInitialChunkError.js → errors/AsyncDependencyToInitialChunkError.js} +8 -3
- package/lib/errors/BuildCycleError.js +1 -1
- package/lib/{ChunkRenderError.js → errors/ChunkRenderError.js} +1 -1
- package/lib/{CodeGenerationError.js → errors/CodeGenerationError.js} +1 -1
- package/lib/{CommentCompilationWarning.js → errors/CommentCompilationWarning.js} +9 -3
- package/lib/{ConcurrentCompilationError.js → errors/ConcurrentCompilationError.js} +4 -2
- package/lib/{EnvironmentNotSupportAsyncWarning.js → errors/EnvironmentNotSupportAsyncWarning.js} +4 -4
- package/lib/{HookWebpackError.js → errors/HookWebpackError.js} +11 -5
- package/lib/{IgnoreErrorModuleFactory.js → errors/IgnoreErrorModuleFactory.js} +6 -4
- package/lib/{InvalidDependenciesModuleWarning.js → errors/InvalidDependenciesModuleWarning.js} +4 -3
- package/lib/errors/JSONParseError.js +114 -0
- package/lib/{ModuleBuildError.js → errors/ModuleBuildError.js} +8 -5
- package/lib/{ModuleDependencyError.js → errors/ModuleDependencyError.js} +2 -2
- package/lib/{ModuleDependencyWarning.js → errors/ModuleDependencyWarning.js} +5 -4
- package/lib/{ModuleError.js → errors/ModuleError.js} +7 -5
- package/lib/{ModuleHashingError.js → errors/ModuleHashingError.js} +1 -1
- package/lib/{ModuleNotFoundError.js → errors/ModuleNotFoundError.js} +3 -2
- package/lib/{ModuleParseError.js → errors/ModuleParseError.js} +11 -6
- package/lib/{ModuleRestoreError.js → errors/ModuleRestoreError.js} +2 -1
- package/lib/{ModuleStoreError.js → errors/ModuleStoreError.js} +2 -1
- package/lib/{ModuleWarning.js → errors/ModuleWarning.js} +8 -5
- package/lib/{NodeStuffInWebError.js → errors/NodeStuffInWebError.js} +5 -4
- package/lib/errors/NonErrorEmittedError.js +28 -0
- package/lib/{UnhandledSchemeError.js → errors/UnhandledSchemeError.js} +8 -2
- package/lib/{UnsupportedFeatureWarning.js → errors/UnsupportedFeatureWarning.js} +4 -3
- package/lib/errors/WebpackError.js +84 -0
- package/lib/esm/ExportWebpackRequireRuntimeModule.js +2 -0
- package/lib/esm/ModuleChunkFormatPlugin.js +5 -1
- package/lib/esm/ModuleChunkLoadingPlugin.js +3 -1
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +5 -0
- package/lib/hmr/HotModuleReplacementRuntimeModule.js +1 -0
- package/lib/hmr/JavascriptHotModuleReplacementHelper.js +1 -0
- package/lib/hmr/LazyCompilationPlugin.js +20 -1
- package/lib/hmr/lazyCompilationBackend.js +2 -0
- package/lib/html/HtmlGenerator.js +379 -0
- package/lib/html/HtmlModulesPlugin.js +433 -0
- package/lib/html/HtmlParser.js +1489 -0
- package/lib/html/walkHtmlTokens.js +2733 -0
- package/lib/ids/ChunkModuleIdRangePlugin.js +3 -1
- package/lib/ids/DeterministicChunkIdsPlugin.js +3 -1
- package/lib/ids/DeterministicModuleIdsPlugin.js +3 -1
- package/lib/ids/HashedModuleIdsPlugin.js +2 -1
- package/lib/ids/IdHelpers.js +22 -1
- package/lib/ids/NamedChunkIdsPlugin.js +3 -1
- package/lib/ids/NamedModuleIdsPlugin.js +3 -1
- package/lib/ids/NaturalChunkIdsPlugin.js +1 -1
- package/lib/ids/NaturalModuleIdsPlugin.js +1 -1
- package/lib/ids/OccurrenceChunkIdsPlugin.js +2 -1
- package/lib/ids/OccurrenceModuleIdsPlugin.js +4 -1
- package/lib/ids/SyncModuleIdsPlugin.js +3 -1
- package/lib/index.js +39 -15
- package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +1 -1
- package/lib/javascript/BasicEvaluatedExpression.js +4 -2
- package/lib/javascript/ChunkFormatHelpers.js +2 -1
- package/lib/javascript/ChunkHelpers.js +1 -0
- package/lib/javascript/CommonJsChunkFormatPlugin.js +1 -1
- package/lib/javascript/EnableChunkLoadingPlugin.js +5 -1
- package/lib/javascript/JavascriptGenerator.js +10 -0
- package/lib/javascript/JavascriptModulesPlugin.js +112 -9
- package/lib/javascript/JavascriptParser.js +360 -16
- package/lib/javascript/JavascriptParserHelpers.js +7 -1
- package/lib/javascript/StartupHelpers.js +5 -0
- package/lib/json/JsonData.js +5 -0
- package/lib/json/JsonGenerator.js +21 -0
- package/lib/json/JsonModulesPlugin.js +1 -1
- package/lib/json/JsonParser.js +14 -25
- package/lib/library/AbstractLibraryPlugin.js +17 -2
- package/lib/library/AmdLibraryPlugin.js +8 -0
- package/lib/library/AssignLibraryPlugin.js +16 -0
- package/lib/library/EnableLibraryPlugin.js +8 -2
- package/lib/library/ExportPropertyLibraryPlugin.js +9 -0
- package/lib/{FalseIIFEUmdWarning.js → library/FalseIIFEUmdWarning.js} +1 -1
- package/lib/library/JsonpLibraryPlugin.js +8 -0
- package/lib/library/ModuleLibraryPlugin.js +86 -1
- package/lib/library/SystemLibraryPlugin.js +8 -0
- package/lib/library/UmdLibraryPlugin.js +16 -0
- package/lib/logging/Logger.js +17 -0
- package/lib/logging/createConsoleLogger.js +7 -0
- package/lib/logging/runtime.js +2 -0
- package/lib/logging/truncateArgs.js +2 -0
- package/lib/node/CommonJsChunkLoadingPlugin.js +5 -1
- package/lib/node/NodeEnvironmentPlugin.js +7 -3
- package/lib/node/NodeSourcePlugin.js +1 -1
- package/lib/node/NodeTargetPlugin.js +2 -1
- package/lib/node/NodeTemplatePlugin.js +3 -1
- package/lib/node/NodeWatchFileSystem.js +2 -0
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +3 -0
- package/lib/node/ReadFileCompileAsyncWasmPlugin.js +4 -1
- package/lib/node/ReadFileCompileWasmPlugin.js +4 -1
- package/lib/node/RequireChunkLoadingRuntimeModule.js +3 -0
- package/lib/node/nodeConsole.js +116 -64
- package/lib/optimize/AggressiveMergingPlugin.js +3 -1
- package/lib/optimize/AggressiveSplittingPlugin.js +6 -1
- package/lib/optimize/ConcatenatedModule.js +62 -6
- package/lib/optimize/EnsureChunkConditionsPlugin.js +2 -1
- package/lib/optimize/FlagIncludedChunksPlugin.js +2 -1
- package/lib/optimize/InnerGraph.js +16 -1
- package/lib/optimize/InnerGraphPlugin.js +14 -2
- package/lib/optimize/LimitChunkCountPlugin.js +9 -0
- package/lib/optimize/MangleExportsPlugin.js +5 -1
- package/lib/optimize/MergeDuplicateChunksPlugin.js +2 -0
- package/lib/optimize/MinChunkSizePlugin.js +2 -1
- package/lib/optimize/MinMaxSizeWarning.js +5 -4
- package/lib/optimize/ModuleConcatenationPlugin.js +36 -8
- package/lib/optimize/RealContentHashPlugin.js +104 -26
- package/lib/optimize/RemoveEmptyChunksPlugin.js +2 -1
- package/lib/optimize/RemoveParentModulesPlugin.js +3 -1
- package/lib/optimize/RuntimeChunkPlugin.js +2 -1
- package/lib/optimize/SideEffectsFlagPlugin.js +118 -4
- package/lib/optimize/SplitChunksPlugin.js +50 -2
- package/lib/performance/AssetsOverSizeLimitWarning.js +3 -2
- package/lib/performance/EntrypointsOverSizeLimitWarning.js +3 -2
- package/lib/performance/NoAsyncChunksWarning.js +5 -3
- package/lib/performance/SizeLimitsPlugin.js +8 -2
- package/lib/prefetch/ChunkPrefetchFunctionRuntimeModule.js +1 -0
- package/lib/prefetch/ChunkPrefetchPreloadPlugin.js +6 -0
- package/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js +1 -0
- package/lib/prefetch/ChunkPrefetchTriggerRuntimeModule.js +5 -1
- package/lib/prefetch/ChunkPreloadTriggerRuntimeModule.js +1 -0
- package/lib/rules/BasicEffectRulePlugin.js +3 -0
- package/lib/rules/BasicMatcherRulePlugin.js +3 -0
- package/lib/rules/ObjectMatcherRulePlugin.js +3 -0
- package/lib/rules/RuleSetCompiler.js +18 -0
- package/lib/rules/UseEffectRulePlugin.js +10 -3
- package/lib/runtime/AsyncModuleRuntimeModule.js +1 -0
- package/lib/runtime/AutoPublicPathRuntimeModule.js +1 -0
- package/lib/runtime/BaseUriRuntimeModule.js +1 -0
- package/lib/runtime/ChunkNameRuntimeModule.js +1 -0
- package/lib/runtime/CompatGetDefaultExportRuntimeModule.js +1 -0
- package/lib/runtime/CompatRuntimeModule.js +2 -0
- package/lib/runtime/CreateFakeNamespaceObjectRuntimeModule.js +1 -0
- package/lib/runtime/CreateScriptRuntimeModule.js +1 -0
- package/lib/runtime/CreateScriptUrlRuntimeModule.js +1 -0
- package/lib/runtime/DefinePropertyGettersRuntimeModule.js +1 -0
- package/lib/runtime/EnsureChunkRuntimeModule.js +1 -0
- package/lib/runtime/GetChunkFilenameRuntimeModule.js +1 -0
- package/lib/runtime/GetFullHashRuntimeModule.js +1 -0
- package/lib/runtime/GetMainFilenameRuntimeModule.js +1 -0
- package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +1 -0
- package/lib/runtime/GlobalRuntimeModule.js +1 -0
- package/lib/runtime/HasOwnPropertyRuntimeModule.js +1 -0
- package/lib/runtime/HelperRuntimeModule.js +5 -0
- package/lib/runtime/LoadScriptRuntimeModule.js +1 -0
- package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +121 -13
- package/lib/runtime/MakeNamespaceObjectRuntimeModule.js +1 -0
- package/lib/runtime/NonceRuntimeModule.js +1 -0
- package/lib/runtime/OnChunksLoadedRuntimeModule.js +1 -0
- package/lib/runtime/PublicPathRuntimeModule.js +1 -0
- package/lib/runtime/RelativeUrlRuntimeModule.js +1 -0
- package/lib/runtime/RuntimeIdRuntimeModule.js +1 -0
- package/lib/runtime/SetAnonymousDefaultNameRuntimeModule.js +35 -0
- package/lib/runtime/StartupChunkDependenciesPlugin.js +13 -1
- package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +1 -0
- package/lib/runtime/StartupEntrypointRuntimeModule.js +1 -0
- package/lib/runtime/SystemContextRuntimeModule.js +1 -0
- package/lib/runtime/ToBinaryRuntimeModule.js +1 -0
- package/lib/schemes/DataUriPlugin.js +14 -2
- package/lib/schemes/FileUriPlugin.js +1 -1
- package/lib/schemes/HttpUriPlugin.js +43 -1
- package/lib/schemes/VirtualUrlPlugin.js +7 -2
- package/lib/serialization/AggregateErrorSerializer.js +2 -0
- package/lib/serialization/ArraySerializer.js +2 -0
- package/lib/serialization/BinaryMiddleware.js +20 -1
- package/lib/serialization/DateObjectSerializer.js +2 -0
- package/lib/serialization/ErrorObjectSerializer.js +3 -0
- package/lib/serialization/FileMiddleware.js +21 -0
- package/lib/serialization/MapObjectSerializer.js +2 -0
- package/lib/serialization/NullPrototypeObjectSerializer.js +2 -0
- package/lib/serialization/ObjectMiddleware.js +23 -0
- package/lib/serialization/PlainObjectSerializer.js +7 -0
- package/lib/serialization/RegExpObjectSerializer.js +2 -0
- package/lib/serialization/Serializer.js +5 -0
- package/lib/serialization/SerializerMiddleware.js +14 -2
- package/lib/serialization/SetObjectSerializer.js +2 -0
- package/lib/serialization/SingleItemMiddleware.js +3 -0
- package/lib/sharing/ConsumeSharedFallbackDependency.js +1 -0
- package/lib/sharing/ConsumeSharedModule.js +15 -0
- package/lib/sharing/ConsumeSharedPlugin.js +8 -3
- package/lib/sharing/ConsumeSharedRuntimeModule.js +9 -4
- package/lib/sharing/ProvideForSharedDependency.js +1 -0
- package/lib/sharing/ProvideSharedDependency.js +4 -0
- package/lib/sharing/ProvideSharedModule.js +12 -1
- package/lib/sharing/ProvideSharedModuleFactory.js +1 -0
- package/lib/sharing/ProvideSharedPlugin.js +5 -2
- package/lib/sharing/SharePlugin.js +2 -1
- package/lib/sharing/ShareRuntimeModule.js +1 -0
- package/lib/sharing/resolveMatchedConfigs.js +4 -1
- package/lib/sharing/utils.js +8 -0
- package/lib/stats/DefaultStatsFactoryPlugin.js +58 -3
- package/lib/stats/DefaultStatsPresetPlugin.js +12 -2
- package/lib/stats/DefaultStatsPrinterPlugin.js +38 -2
- package/lib/stats/StatsFactory.js +13 -1
- package/lib/stats/StatsPrinter.js +7 -0
- package/lib/typescript/TypeScriptPlugin.js +210 -0
- package/lib/url/URLParserPlugin.js +8 -2
- package/lib/util/AppendOnlyStackedSet.js +15 -0
- package/lib/util/ArrayHelpers.js +1 -0
- package/lib/util/ArrayQueue.js +10 -5
- package/lib/util/AsyncQueue.js +22 -2
- package/lib/util/Hash.js +2 -2
- package/lib/util/IterableHelpers.js +3 -0
- package/lib/util/LazyBucketSortedSet.js +21 -0
- package/lib/util/LazySet.js +39 -0
- package/lib/util/LocConverter.js +53 -0
- package/lib/util/ParallelismFactorCalculator.js +1 -0
- package/lib/util/Queue.js +6 -3
- package/lib/util/Semaphore.js +14 -1
- package/lib/util/SetHelpers.js +3 -0
- package/lib/util/SortableSet.js +7 -1
- package/lib/util/StackedCacheMap.js +20 -3
- package/lib/util/StackedMap.js +45 -0
- package/lib/util/StringXor.js +1 -1
- package/lib/util/TupleQueue.js +7 -3
- package/lib/util/TupleSet.js +13 -0
- package/lib/util/URLAbsoluteSpecifier.js +1 -0
- package/lib/util/WeakTupleMap.js +33 -0
- package/lib/util/binarySearchBounds.js +1 -0
- package/lib/util/cleverMerge.js +19 -2
- package/lib/util/comparators.js +34 -3
- package/lib/util/compileBooleanMatcher.js +9 -0
- package/lib/util/concatenate.js +9 -3
- package/lib/util/conventions.js +46 -1
- package/lib/util/createMappings.js +118 -0
- package/lib/util/dataURL.js +1 -0
- package/lib/util/deprecation.js +19 -0
- package/lib/util/deterministicGrouping.js +20 -0
- package/lib/util/extractSourceMap.js +1 -0
- package/lib/util/extractUrlAndGlobal.js +1 -0
- package/lib/util/findGraphRoots.js +5 -0
- package/lib/{formatLocation.js → util/formatLocation.js} +4 -2
- package/lib/{SizeFormatHelpers.js → util/formatSize.js} +4 -1
- package/lib/util/fs.js +71 -8
- package/lib/util/generateDebugId.js +1 -0
- package/lib/util/hash/BatchedHash.js +1 -0
- package/lib/util/hash/BulkUpdateHash.js +1 -0
- package/lib/util/hash/hash-digest.js +8 -0
- package/lib/util/hash/md4.js +1 -1
- package/lib/util/hash/wasm-hash.js +5 -0
- package/lib/util/hash/xxhash64.js +1 -1
- package/lib/util/identifier.js +67 -0
- package/lib/util/internalSerializables.js +35 -19
- package/lib/util/magicComment.js +10 -6
- package/lib/util/makeSerializable.js +6 -0
- package/lib/util/memoize.js +2 -0
- package/lib/util/mimeTypes.js +176 -0
- package/lib/util/nonNumericOnlyHash.js +1 -0
- package/lib/util/parseJson.js +41 -0
- package/lib/util/processAsyncTree.js +8 -0
- package/lib/util/property.js +1 -0
- package/lib/util/registerExternalSerializer.js +20 -0
- package/lib/util/removeBOM.js +1 -0
- package/lib/util/runtime.js +32 -0
- package/lib/util/semver.js +15 -0
- package/lib/util/serialization.js +2 -0
- package/lib/util/smartGrouping.js +8 -0
- package/lib/util/source.js +23 -0
- package/lib/util/topologicalSort.js +69 -0
- package/lib/validateSchema.js +1 -0
- package/lib/wasm/EnableWasmLoadingPlugin.js +15 -1
- package/lib/wasm-async/AsyncWasmCompileRuntimeModule.js +1 -0
- package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +1 -0
- package/lib/wasm-async/AsyncWebAssemblyGenerator.js +6 -0
- package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +5 -0
- package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +12 -3
- package/lib/wasm-async/AsyncWebAssemblyParser.js +2 -1
- package/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js +12 -1
- package/lib/wasm-sync/UnsupportedWebAssemblyFeatureError.js +6 -3
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +1 -0
- package/lib/wasm-sync/WasmFinalizeExportsPlugin.js +2 -2
- package/lib/wasm-sync/WebAssemblyGenerator.js +26 -1
- package/lib/wasm-sync/WebAssemblyInInitialChunkError.js +7 -3
- package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +4 -0
- package/lib/wasm-sync/WebAssemblyModulesPlugin.js +10 -1
- package/lib/wasm-sync/WebAssemblyParser.js +2 -0
- package/lib/wasm-sync/WebAssemblyUtils.js +2 -0
- package/lib/web/FetchCompileAsyncWasmPlugin.js +10 -1
- package/lib/web/FetchCompileWasmPlugin.js +13 -1
- package/lib/web/JsonpChunkLoadingPlugin.js +11 -1
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +1 -0
- package/lib/web/JsonpTemplatePlugin.js +2 -1
- package/lib/webpack.js +13 -1
- package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +10 -1
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +1 -0
- package/lib/webworker/WebWorkerTemplatePlugin.js +1 -1
- package/package.json +31 -31
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +161 -57
- package/schemas/plugins/{DllPlugin.check.d.ts → HtmlGeneratorOptions.check.d.ts} +1 -1
- package/schemas/plugins/HtmlGeneratorOptions.check.js +6 -0
- package/schemas/plugins/HtmlGeneratorOptions.json +3 -0
- package/schemas/plugins/ProgressPlugin.check.js +1 -1
- package/schemas/plugins/ProgressPlugin.json +22 -0
- package/schemas/plugins/{DllReferencePlugin.check.d.ts → css/CssAutoOrModuleParserOptions.check.d.ts} +1 -1
- package/schemas/plugins/css/CssAutoOrModuleParserOptions.check.js +6 -0
- package/schemas/plugins/css/CssAutoOrModuleParserOptions.json +3 -0
- package/schemas/plugins/dll/DllPlugin.check.d.ts +7 -0
- package/schemas/plugins/dll/DllReferencePlugin.check.d.ts +7 -0
- package/types.d.ts +5325 -353
- package/lib/CaseSensitiveModulesWarning.js +0 -72
- package/lib/GraphHelpers.js +0 -46
- package/lib/NoModeWarning.js +0 -23
- package/lib/css/CssMergeStyleSheetsRuntimeModule.js +0 -56
- /package/schemas/plugins/{DllPlugin.check.js → dll/DllPlugin.check.js} +0 -0
- /package/schemas/plugins/{DllPlugin.json → dll/DllPlugin.json} +0 -0
- /package/schemas/plugins/{DllReferencePlugin.check.js → dll/DllReferencePlugin.check.js} +0 -0
- /package/schemas/plugins/{DllReferencePlugin.json → dll/DllReferencePlugin.json} +0 -0
|
@@ -30,6 +30,7 @@ const { ImportPhase } = require("./ImportPhase");
|
|
|
30
30
|
*/
|
|
31
31
|
class HarmonyEvaluatedImportSpecifierDependency extends HarmonyImportSpecifierDependency {
|
|
32
32
|
/**
|
|
33
|
+
* Creates an instance of HarmonyEvaluatedImportSpecifierDependency.
|
|
33
34
|
* @param {string} request the request string
|
|
34
35
|
* @param {number} sourceOrder source order
|
|
35
36
|
* @param {Ids} ids ids
|
|
@@ -58,6 +59,7 @@ class HarmonyEvaluatedImportSpecifierDependency extends HarmonyImportSpecifierDe
|
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
/**
|
|
62
|
+
* Serializes this instance into the provided serializer context.
|
|
61
63
|
* @param {ObjectSerializerContext} context context
|
|
62
64
|
*/
|
|
63
65
|
serialize(context) {
|
|
@@ -67,6 +69,7 @@ class HarmonyEvaluatedImportSpecifierDependency extends HarmonyImportSpecifierDe
|
|
|
67
69
|
}
|
|
68
70
|
|
|
69
71
|
/**
|
|
72
|
+
* Restores this instance from the provided deserializer context.
|
|
70
73
|
* @param {ObjectDeserializerContext} context context
|
|
71
74
|
*/
|
|
72
75
|
deserialize(context) {
|
|
@@ -85,6 +88,7 @@ HarmonyEvaluatedImportSpecifierDependency.Template = class HarmonyEvaluatedImpor
|
|
|
85
88
|
HarmonyImportSpecifierDependency.Template
|
|
86
89
|
) {
|
|
87
90
|
/**
|
|
91
|
+
* Applies the plugin by registering its hooks on the compiler.
|
|
88
92
|
* @param {Dependency} dependency the dependency for which the template should be applied
|
|
89
93
|
* @param {ReplaceSource} source the current replace source which can be modified
|
|
90
94
|
* @param {DependencyTemplateContext} templateContext the context object
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
8
|
const CompatibilityPlugin = require("../CompatibilityPlugin");
|
|
9
|
-
const WebpackError = require("../WebpackError");
|
|
9
|
+
const WebpackError = require("../errors/WebpackError");
|
|
10
10
|
const { getImportAttributes } = require("../javascript/JavascriptParser");
|
|
11
11
|
const InnerGraph = require("../optimize/InnerGraph");
|
|
12
12
|
const ConstDependency = require("./ConstDependency");
|
|
@@ -36,6 +36,7 @@ const PLUGIN_NAME = "HarmonyExportDependencyParserPlugin";
|
|
|
36
36
|
|
|
37
37
|
module.exports = class HarmonyExportDependencyParserPlugin {
|
|
38
38
|
/**
|
|
39
|
+
* Creates an instance of HarmonyExportDependencyParserPlugin.
|
|
39
40
|
* @param {JavascriptParserOptions} options options
|
|
40
41
|
*/
|
|
41
42
|
constructor(options) {
|
|
@@ -47,6 +48,7 @@ module.exports = class HarmonyExportDependencyParserPlugin {
|
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
/**
|
|
51
|
+
* Applies the plugin by registering its hooks on the compiler.
|
|
50
52
|
* @param {JavascriptParser} parser the parser
|
|
51
53
|
* @returns {void}
|
|
52
54
|
*/
|
|
@@ -142,12 +144,13 @@ module.exports = class HarmonyExportDependencyParserPlugin {
|
|
|
142
144
|
: undefined
|
|
143
145
|
);
|
|
144
146
|
dep.isAnonymousDefault =
|
|
145
|
-
|
|
146
|
-
(
|
|
147
|
-
node.type === "
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
147
|
+
this.options.anonymousDefaultExportName !== false &&
|
|
148
|
+
(node.type === "ArrowFunctionExpression" ||
|
|
149
|
+
((node.type === "FunctionDeclaration" ||
|
|
150
|
+
node.type === "FunctionExpression" ||
|
|
151
|
+
node.type === "ClassDeclaration" ||
|
|
152
|
+
node.type === "ClassExpression") &&
|
|
153
|
+
!node.id));
|
|
151
154
|
dep.loc = Object.create(
|
|
152
155
|
/** @type {DependencyLocation} */ (statement.loc)
|
|
153
156
|
);
|
|
@@ -26,6 +26,7 @@ const NullDependency = require("./NullDependency");
|
|
|
26
26
|
|
|
27
27
|
class HarmonyExportExpressionDependency extends NullDependency {
|
|
28
28
|
/**
|
|
29
|
+
* Creates an instance of HarmonyExportExpressionDependency.
|
|
29
30
|
* @param {Range} range range
|
|
30
31
|
* @param {Range} rangeStatement range statement
|
|
31
32
|
* @param {string} prefix prefix
|
|
@@ -59,6 +60,7 @@ class HarmonyExportExpressionDependency extends NullDependency {
|
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
/**
|
|
63
|
+
* Gets module evaluation side effects state.
|
|
62
64
|
* @param {ModuleGraph} moduleGraph the module graph
|
|
63
65
|
* @returns {ConnectionState} how this dependency connects the module to referencing modules
|
|
64
66
|
*/
|
|
@@ -68,6 +70,7 @@ class HarmonyExportExpressionDependency extends NullDependency {
|
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
/**
|
|
73
|
+
* Serializes this instance into the provided serializer context.
|
|
71
74
|
* @param {ObjectSerializerContext} context context
|
|
72
75
|
*/
|
|
73
76
|
serialize(context) {
|
|
@@ -81,6 +84,7 @@ class HarmonyExportExpressionDependency extends NullDependency {
|
|
|
81
84
|
}
|
|
82
85
|
|
|
83
86
|
/**
|
|
87
|
+
* Restores this instance from the provided deserializer context.
|
|
84
88
|
* @param {ObjectDeserializerContext} context context
|
|
85
89
|
*/
|
|
86
90
|
deserialize(context) {
|
|
@@ -103,6 +107,7 @@ HarmonyExportExpressionDependency.Template = class HarmonyExportDependencyTempla
|
|
|
103
107
|
NullDependency.Template
|
|
104
108
|
) {
|
|
105
109
|
/**
|
|
110
|
+
* Applies the plugin by registering its hooks on the compiler.
|
|
106
111
|
* @param {Dependency} dependency the dependency for which the template should be applied
|
|
107
112
|
* @param {ReplaceSource} source the current replace source which can be modified
|
|
108
113
|
* @param {DependencyTemplateContext} templateContext the context object
|
|
@@ -138,18 +143,17 @@ HarmonyExportExpressionDependency.Template = class HarmonyExportDependencyTempla
|
|
|
138
143
|
);
|
|
139
144
|
}
|
|
140
145
|
|
|
146
|
+
const used = concatenationScope
|
|
147
|
+
? undefined
|
|
148
|
+
: moduleGraph.getExportsInfo(module).getUsedName("default", runtime);
|
|
149
|
+
|
|
141
150
|
if (concatenationScope) {
|
|
142
151
|
concatenationScope.registerExport("default", name);
|
|
143
|
-
} else {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
/** @type {ExportMap} */
|
|
149
|
-
const map = new Map();
|
|
150
|
-
map.set(used, `/* export default binding */ ${name}`);
|
|
151
|
-
initFragments.push(new HarmonyExportInitFragment(exportsName, map));
|
|
152
|
-
}
|
|
152
|
+
} else if (used) {
|
|
153
|
+
/** @type {ExportMap} */
|
|
154
|
+
const map = new Map();
|
|
155
|
+
map.set(used, `/* export default binding */ ${name}`);
|
|
156
|
+
initFragments.push(new HarmonyExportInitFragment(exportsName, map));
|
|
153
157
|
}
|
|
154
158
|
|
|
155
159
|
source.replace(
|
|
@@ -158,12 +162,17 @@ HarmonyExportExpressionDependency.Template = class HarmonyExportDependencyTempla
|
|
|
158
162
|
`/* harmony default export */ ${dep.prefix}`
|
|
159
163
|
);
|
|
160
164
|
|
|
161
|
-
if (
|
|
165
|
+
if (
|
|
166
|
+
typeof declarationId !== "string" &&
|
|
167
|
+
dep.isAnonymousDefault &&
|
|
168
|
+
(concatenationScope || used)
|
|
169
|
+
) {
|
|
162
170
|
// Fix .name for anonymous default export function declarations
|
|
163
171
|
// see test/test262-cases/test/language/module-code/instn-named-bndng-dflt-fun-anon.js cspell:disable-line
|
|
172
|
+
runtimeRequirements.add(RuntimeGlobals.setAnonymousDefaultName);
|
|
164
173
|
initFragments.push(
|
|
165
174
|
new InitFragment(
|
|
166
|
-
|
|
175
|
+
`${RuntimeGlobals.setAnonymousDefaultName}(${name});\n`,
|
|
167
176
|
InitFragment.STAGE_HARMONY_EXPORTS,
|
|
168
177
|
2
|
|
169
178
|
)
|
|
@@ -173,6 +182,7 @@ HarmonyExportExpressionDependency.Template = class HarmonyExportDependencyTempla
|
|
|
173
182
|
/** @type {string} */
|
|
174
183
|
let content;
|
|
175
184
|
let name = ConcatenationScope.DEFAULT_EXPORT;
|
|
185
|
+
let defaultIsUsed = Boolean(concatenationScope);
|
|
176
186
|
if (runtimeTemplate.supportsConst()) {
|
|
177
187
|
content = `/* harmony default export */ const ${name} = `;
|
|
178
188
|
if (concatenationScope) {
|
|
@@ -182,6 +192,7 @@ HarmonyExportExpressionDependency.Template = class HarmonyExportDependencyTempla
|
|
|
182
192
|
.getExportsInfo(module)
|
|
183
193
|
.getUsedName("default", runtime);
|
|
184
194
|
if (used) {
|
|
195
|
+
defaultIsUsed = true;
|
|
185
196
|
runtimeRequirements.add(RuntimeGlobals.exports);
|
|
186
197
|
/** @type {ExportMap} */
|
|
187
198
|
const map = new Map();
|
|
@@ -199,6 +210,7 @@ HarmonyExportExpressionDependency.Template = class HarmonyExportDependencyTempla
|
|
|
199
210
|
.getExportsInfo(module)
|
|
200
211
|
.getUsedName("default", runtime);
|
|
201
212
|
if (used) {
|
|
213
|
+
defaultIsUsed = true;
|
|
202
214
|
runtimeRequirements.add(RuntimeGlobals.exports);
|
|
203
215
|
// This is a little bit incorrect as TDZ is not correct, but we can't use const.
|
|
204
216
|
// No local `__WEBPACK_DEFAULT_EXPORT__` binding is created in this path,
|
|
@@ -219,13 +231,14 @@ HarmonyExportExpressionDependency.Template = class HarmonyExportDependencyTempla
|
|
|
219
231
|
dep.range[0] - 1,
|
|
220
232
|
`${content}(${dep.prefix}`
|
|
221
233
|
);
|
|
222
|
-
if (dep.isAnonymousDefault) {
|
|
234
|
+
if (dep.isAnonymousDefault && defaultIsUsed) {
|
|
223
235
|
// Fix .name for anonymous default export expressions
|
|
224
236
|
// see test/test262-cases/test/language/module-code/eval-export-dflt-cls-anon.js cspell:disable-line
|
|
237
|
+
runtimeRequirements.add(RuntimeGlobals.setAnonymousDefaultName);
|
|
225
238
|
source.replace(
|
|
226
239
|
dep.range[1],
|
|
227
240
|
dep.rangeStatement[1] - 0.5,
|
|
228
|
-
`);\n
|
|
241
|
+
`);\n${RuntimeGlobals.setAnonymousDefaultName}(${name});`
|
|
229
242
|
);
|
|
230
243
|
} else {
|
|
231
244
|
source.replace(dep.range[1], dep.rangeStatement[1] - 0.5, ");");
|
|
@@ -17,6 +17,7 @@ const NullDependency = require("./NullDependency");
|
|
|
17
17
|
|
|
18
18
|
class HarmonyExportHeaderDependency extends NullDependency {
|
|
19
19
|
/**
|
|
20
|
+
* Creates an instance of HarmonyExportHeaderDependency.
|
|
20
21
|
* @param {Range | false} range range
|
|
21
22
|
* @param {Range} rangeStatement range statement
|
|
22
23
|
*/
|
|
@@ -31,6 +32,7 @@ class HarmonyExportHeaderDependency extends NullDependency {
|
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
/**
|
|
35
|
+
* Serializes this instance into the provided serializer context.
|
|
34
36
|
* @param {ObjectSerializerContext} context context
|
|
35
37
|
*/
|
|
36
38
|
serialize(context) {
|
|
@@ -41,6 +43,7 @@ class HarmonyExportHeaderDependency extends NullDependency {
|
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
/**
|
|
46
|
+
* Restores this instance from the provided deserializer context.
|
|
44
47
|
* @param {ObjectDeserializerContext} context context
|
|
45
48
|
*/
|
|
46
49
|
deserialize(context) {
|
|
@@ -60,6 +63,7 @@ HarmonyExportHeaderDependency.Template = class HarmonyExportDependencyTemplate e
|
|
|
60
63
|
NullDependency.Template
|
|
61
64
|
) {
|
|
62
65
|
/**
|
|
66
|
+
* Applies the plugin by registering its hooks on the compiler.
|
|
63
67
|
* @param {Dependency} dependency the dependency for which the template should be applied
|
|
64
68
|
* @param {ReplaceSource} source the current replace source which can be modified
|
|
65
69
|
* @param {DependencyTemplateContext} templateContext the context object
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
const ConditionalInitFragment = require("../ConditionalInitFragment");
|
|
9
9
|
const Dependency = require("../Dependency");
|
|
10
10
|
const { UsageState } = require("../ExportsInfo");
|
|
11
|
-
const HarmonyLinkingError = require("../HarmonyLinkingError");
|
|
12
11
|
const InitFragment = require("../InitFragment");
|
|
13
12
|
const RuntimeGlobals = require("../RuntimeGlobals");
|
|
14
13
|
const Template = require("../Template");
|
|
@@ -26,6 +25,7 @@ const {
|
|
|
26
25
|
} = require("../util/runtime");
|
|
27
26
|
const HarmonyExportInitFragment = require("./HarmonyExportInitFragment");
|
|
28
27
|
const HarmonyImportDependency = require("./HarmonyImportDependency");
|
|
28
|
+
const HarmonyLinkingError = require("./HarmonyLinkingError");
|
|
29
29
|
const { ImportPhaseUtils } = require("./ImportPhase");
|
|
30
30
|
const processExportInfo = require("./processExportInfo");
|
|
31
31
|
|
|
@@ -50,7 +50,7 @@ const processExportInfo = require("./processExportInfo");
|
|
|
50
50
|
/** @typedef {import("../ModuleGraphConnection")} ModuleGraphConnection */
|
|
51
51
|
/** @typedef {import("../ModuleGraphConnection").ConnectionState} ConnectionState */
|
|
52
52
|
/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */
|
|
53
|
-
/** @typedef {import("../WebpackError")} WebpackError */
|
|
53
|
+
/** @typedef {import("../errors/WebpackError")} WebpackError */
|
|
54
54
|
/** @typedef {import("../javascript/JavascriptParser").ImportAttributes} ImportAttributes */
|
|
55
55
|
/** @typedef {import("../serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
|
56
56
|
/** @typedef {import("../serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
|
@@ -70,6 +70,7 @@ const idsSymbol = /** @type {symbol} */ (
|
|
|
70
70
|
|
|
71
71
|
class NormalReexportItem {
|
|
72
72
|
/**
|
|
73
|
+
* Creates an instance of NormalReexportItem.
|
|
73
74
|
* @param {string} name export name
|
|
74
75
|
* @param {Ids} ids reexported ids from other module
|
|
75
76
|
* @param {ExportInfo} exportInfo export info from other module
|
|
@@ -90,6 +91,7 @@ class NormalReexportItem {
|
|
|
90
91
|
|
|
91
92
|
class ExportMode {
|
|
92
93
|
/**
|
|
94
|
+
* Creates an instance of ExportMode.
|
|
93
95
|
* @param {ExportModeType} type type of the mode
|
|
94
96
|
*/
|
|
95
97
|
constructor(type) {
|
|
@@ -126,7 +128,81 @@ class ExportMode {
|
|
|
126
128
|
|
|
127
129
|
/** @typedef {number[]} DependencyIndices */
|
|
128
130
|
|
|
131
|
+
const RETURNS_TRUE = () => true;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Detect a per-name cycle when collecting `export *` contributions from
|
|
135
|
+
* `exportInfo`'s module into `parentModule`. The TC39 `ResolveExport`
|
|
136
|
+
* algorithm tracks a `resolveSet` of `(module, exportName)` pairs and
|
|
137
|
+
* returns null when an entry is revisited — letting the `StarExportEntries`
|
|
138
|
+
* loop fall through to a non-cyclic source. Webpack's static export graph
|
|
139
|
+
* does not run that resolution algorithm, so we approximate it: if the
|
|
140
|
+
* imported module's same-named export ultimately re-exports from
|
|
141
|
+
* `parentModule` under the same name, the star contribution is cyclic and
|
|
142
|
+
* must be skipped. The non-cyclic alternative (a sibling `export *` that
|
|
143
|
+
* provides a real binding) then wins.
|
|
144
|
+
*
|
|
145
|
+
* We walk the target chain one hop at a time using `findTarget` with a
|
|
146
|
+
* "match anything" filter so we can guard against namespace targets
|
|
147
|
+
* (`export * as ns from`, where `target.export` is undefined) and against
|
|
148
|
+
* unrelated cycles in the graph that would otherwise loop forever inside
|
|
149
|
+
* `_findTarget`.
|
|
150
|
+
* @param {ModuleGraph} moduleGraph the module graph
|
|
151
|
+
* @param {ExportInfo} exportInfo export info on the imported module
|
|
152
|
+
* @param {Module} parentModule the module that contains the star reexport
|
|
153
|
+
* @returns {boolean} true when this export reexports back to the parent module under the same name
|
|
154
|
+
*/
|
|
155
|
+
const isStarReexportBackToParent = (moduleGraph, exportInfo, parentModule) => {
|
|
156
|
+
// Fast path: probe the first hop directly. The overwhelmingly common case
|
|
157
|
+
// in real builds is a terminal local binding (no `_target`) — `findTarget`
|
|
158
|
+
// returns `undefined` and we exit without allocating a `visited` set.
|
|
159
|
+
const firstTarget = exportInfo.findTarget(moduleGraph, RETURNS_TRUE);
|
|
160
|
+
if (!firstTarget || typeof firstTarget !== "object") return false;
|
|
161
|
+
const name = exportInfo.name;
|
|
162
|
+
if (
|
|
163
|
+
firstTarget.module === parentModule &&
|
|
164
|
+
Array.isArray(firstTarget.export) &&
|
|
165
|
+
firstTarget.export.length === 1 &&
|
|
166
|
+
firstTarget.export[0] === name
|
|
167
|
+
) {
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
170
|
+
if (!Array.isArray(firstTarget.export) || firstTarget.export.length === 0) {
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
// Multi-hop chain — allocate visited tracking now. The set protects against
|
|
174
|
+
// unrelated cycles in the graph that would otherwise spin inside
|
|
175
|
+
// `_findTarget` (its `alreadyVisited` is only seeded for the entry node).
|
|
176
|
+
let current = moduleGraph
|
|
177
|
+
.getExportsInfo(firstTarget.module)
|
|
178
|
+
.getReadOnlyExportInfo(firstTarget.export[0]);
|
|
179
|
+
/** @type {Set<ExportInfo>} */
|
|
180
|
+
const visited = new Set([exportInfo, current]);
|
|
181
|
+
for (;;) {
|
|
182
|
+
const target = current.findTarget(moduleGraph, RETURNS_TRUE);
|
|
183
|
+
if (!target || typeof target !== "object") return false;
|
|
184
|
+
if (
|
|
185
|
+
target.module === parentModule &&
|
|
186
|
+
Array.isArray(target.export) &&
|
|
187
|
+
target.export.length === 1 &&
|
|
188
|
+
target.export[0] === name
|
|
189
|
+
) {
|
|
190
|
+
return true;
|
|
191
|
+
}
|
|
192
|
+
if (!Array.isArray(target.export) || target.export.length === 0) {
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
195
|
+
const next = moduleGraph
|
|
196
|
+
.getExportsInfo(target.module)
|
|
197
|
+
.getReadOnlyExportInfo(target.export[0]);
|
|
198
|
+
if (visited.has(next)) return false;
|
|
199
|
+
visited.add(next);
|
|
200
|
+
current = next;
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
|
|
129
204
|
/**
|
|
205
|
+
* Determine export assignments.
|
|
130
206
|
* @param {ModuleGraph} moduleGraph module graph
|
|
131
207
|
* @param {HarmonyExportImportedSpecifierDependency[]} dependencies dependencies
|
|
132
208
|
* @param {HarmonyExportImportedSpecifierDependency=} additionalDependency additional dependency
|
|
@@ -146,6 +222,11 @@ const determineExportAssignments = (
|
|
|
146
222
|
dependencies = [...dependencies, additionalDependency];
|
|
147
223
|
}
|
|
148
224
|
|
|
225
|
+
const referenceDep = dependencies[0] || additionalDependency;
|
|
226
|
+
const parentModule = referenceDep
|
|
227
|
+
? moduleGraph.getParentModule(referenceDep)
|
|
228
|
+
: null;
|
|
229
|
+
|
|
149
230
|
for (const dep of dependencies) {
|
|
150
231
|
const i = dependencyIndices.length;
|
|
151
232
|
dependencyIndices[i] = names.size;
|
|
@@ -156,7 +237,11 @@ const determineExportAssignments = (
|
|
|
156
237
|
if (
|
|
157
238
|
exportInfo.provided === true &&
|
|
158
239
|
exportInfo.name !== "default" &&
|
|
159
|
-
!names.has(exportInfo.name)
|
|
240
|
+
!names.has(exportInfo.name) &&
|
|
241
|
+
!(
|
|
242
|
+
parentModule &&
|
|
243
|
+
isStarReexportBackToParent(moduleGraph, exportInfo, parentModule)
|
|
244
|
+
)
|
|
160
245
|
) {
|
|
161
246
|
names.add(exportInfo.name);
|
|
162
247
|
dependencyIndices[i] = names.size;
|
|
@@ -170,6 +255,7 @@ const determineExportAssignments = (
|
|
|
170
255
|
};
|
|
171
256
|
|
|
172
257
|
/**
|
|
258
|
+
* Finds dependency for name.
|
|
173
259
|
* @param {object} options options
|
|
174
260
|
* @param {ExportInfoName[]} options.names names
|
|
175
261
|
* @param {DependencyIndices} options.dependencyIndices dependency indices
|
|
@@ -199,6 +285,7 @@ const findDependencyForName = (
|
|
|
199
285
|
};
|
|
200
286
|
|
|
201
287
|
/**
|
|
288
|
+
* Returns the export mode.
|
|
202
289
|
* @param {ModuleGraph} moduleGraph the module graph
|
|
203
290
|
* @param {HarmonyExportImportedSpecifierDependency} dep the dependency
|
|
204
291
|
* @param {string} runtimeKey the runtime key
|
|
@@ -373,6 +460,7 @@ const getMode = (moduleGraph, dep, runtimeKey) => {
|
|
|
373
460
|
|
|
374
461
|
class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|
375
462
|
/**
|
|
463
|
+
* Creates an instance of HarmonyExportImportedSpecifierDependency.
|
|
376
464
|
* @param {string} request the request string
|
|
377
465
|
* @param {number} sourceOrder the order in the original source file
|
|
378
466
|
* @param {Ids} ids the requested export name of the imported module
|
|
@@ -407,6 +495,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|
|
407
495
|
}
|
|
408
496
|
|
|
409
497
|
/**
|
|
498
|
+
* Could affect referencing module.
|
|
410
499
|
* @returns {boolean | TRANSITIVE} true, when changes to the referenced module could affect the referencing module; TRANSITIVE, when changes to the referenced module could affect referencing modules of the referencing module
|
|
411
500
|
*/
|
|
412
501
|
couldAffectReferencingModule() {
|
|
@@ -415,6 +504,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|
|
415
504
|
|
|
416
505
|
// TODO webpack 6 remove
|
|
417
506
|
/**
|
|
507
|
+
* Returns id.
|
|
418
508
|
* @deprecated
|
|
419
509
|
*/
|
|
420
510
|
get id() {
|
|
@@ -423,6 +513,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|
|
423
513
|
|
|
424
514
|
// TODO webpack 6 remove
|
|
425
515
|
/**
|
|
516
|
+
* Returns id.
|
|
426
517
|
* @deprecated
|
|
427
518
|
*/
|
|
428
519
|
getId() {
|
|
@@ -431,6 +522,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|
|
431
522
|
|
|
432
523
|
// TODO webpack 6 remove
|
|
433
524
|
/**
|
|
525
|
+
* Updates id.
|
|
434
526
|
* @deprecated
|
|
435
527
|
*/
|
|
436
528
|
setId() {
|
|
@@ -442,6 +534,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|
|
442
534
|
}
|
|
443
535
|
|
|
444
536
|
/**
|
|
537
|
+
* Returns the imported id.
|
|
445
538
|
* @param {ModuleGraph} moduleGraph the module graph
|
|
446
539
|
* @returns {Ids} the imported id
|
|
447
540
|
*/
|
|
@@ -450,6 +543,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|
|
450
543
|
}
|
|
451
544
|
|
|
452
545
|
/**
|
|
546
|
+
* Updates ids using the provided module graph.
|
|
453
547
|
* @param {ModuleGraph} moduleGraph the module graph
|
|
454
548
|
* @param {Ids} ids the imported ids
|
|
455
549
|
* @returns {void}
|
|
@@ -459,6 +553,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|
|
459
553
|
}
|
|
460
554
|
|
|
461
555
|
/**
|
|
556
|
+
* Returns the export mode.
|
|
462
557
|
* @param {ModuleGraph} moduleGraph the module graph
|
|
463
558
|
* @param {RuntimeSpec} runtime the runtime
|
|
464
559
|
* @returns {ExportMode} the export mode
|
|
@@ -472,6 +567,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|
|
472
567
|
}
|
|
473
568
|
|
|
474
569
|
/**
|
|
570
|
+
* Gets star reexports.
|
|
475
571
|
* @param {ModuleGraph} moduleGraph the module graph
|
|
476
572
|
* @param {RuntimeSpec} runtime the runtime
|
|
477
573
|
* @param {ExportsInfo} exportsInfo exports info about the current module (optional)
|
|
@@ -521,6 +617,10 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|
|
521
617
|
/** @type {Hidden | undefined} */
|
|
522
618
|
const hidden = hiddenExports !== undefined ? new Set() : undefined;
|
|
523
619
|
|
|
620
|
+
const parentModule = /** @type {Module} */ (
|
|
621
|
+
moduleGraph.getParentModule(this)
|
|
622
|
+
);
|
|
623
|
+
|
|
524
624
|
if (noExtraImports) {
|
|
525
625
|
for (const exportInfo of exportsInfo.orderedExports) {
|
|
526
626
|
const name = exportInfo.name;
|
|
@@ -530,10 +630,22 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|
|
530
630
|
importedExportsInfo.getReadOnlyExportInfo(name);
|
|
531
631
|
if (importedExportInfo.provided === false) continue;
|
|
532
632
|
if (hiddenExports !== undefined && hiddenExports.has(name)) {
|
|
633
|
+
// Earlier star deps already provided this name non-cyclically
|
|
634
|
+
// (`determineExportAssignments` filters cyclic candidates), so
|
|
635
|
+
// the cycle check below would be wasted work.
|
|
533
636
|
/** @type {Hidden} */
|
|
534
637
|
(hidden).add(name);
|
|
535
638
|
continue;
|
|
536
639
|
}
|
|
640
|
+
if (
|
|
641
|
+
isStarReexportBackToParent(
|
|
642
|
+
moduleGraph,
|
|
643
|
+
importedExportInfo,
|
|
644
|
+
parentModule
|
|
645
|
+
)
|
|
646
|
+
) {
|
|
647
|
+
continue;
|
|
648
|
+
}
|
|
537
649
|
exports.add(name);
|
|
538
650
|
if (importedExportInfo.provided === true) continue;
|
|
539
651
|
checked.add(name);
|
|
@@ -550,6 +662,15 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|
|
550
662
|
(hidden).add(name);
|
|
551
663
|
continue;
|
|
552
664
|
}
|
|
665
|
+
if (
|
|
666
|
+
isStarReexportBackToParent(
|
|
667
|
+
moduleGraph,
|
|
668
|
+
importedExportInfo,
|
|
669
|
+
parentModule
|
|
670
|
+
)
|
|
671
|
+
) {
|
|
672
|
+
continue;
|
|
673
|
+
}
|
|
553
674
|
exports.add(name);
|
|
554
675
|
if (importedExportInfo.provided === true) continue;
|
|
555
676
|
checked.add(name);
|
|
@@ -560,6 +681,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|
|
560
681
|
}
|
|
561
682
|
|
|
562
683
|
/**
|
|
684
|
+
* Returns function to determine if the connection is active.
|
|
563
685
|
* @param {ModuleGraph} moduleGraph module graph
|
|
564
686
|
* @returns {null | false | GetConditionFn} function to determine if the connection is active
|
|
565
687
|
*/
|
|
@@ -571,6 +693,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|
|
571
693
|
}
|
|
572
694
|
|
|
573
695
|
/**
|
|
696
|
+
* Gets module evaluation side effects state.
|
|
574
697
|
* @param {ModuleGraph} moduleGraph the module graph
|
|
575
698
|
* @returns {ConnectionState} how this dependency connects the module to referencing modules
|
|
576
699
|
*/
|
|
@@ -652,6 +775,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|
|
652
775
|
}
|
|
653
776
|
|
|
654
777
|
/**
|
|
778
|
+
* Discover active exports from other star exports.
|
|
655
779
|
* @param {ModuleGraph} moduleGraph the module graph
|
|
656
780
|
* @returns {{ names: ExportInfoName[], namesSlice: number, dependencyIndices: DependencyIndices, dependencyIndex: number } | undefined} exported names and their origin dependency
|
|
657
781
|
*/
|
|
@@ -830,6 +954,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|
|
830
954
|
}
|
|
831
955
|
|
|
832
956
|
/**
|
|
957
|
+
* Get effective export presence level.
|
|
833
958
|
* @param {ModuleGraph} moduleGraph module graph
|
|
834
959
|
* @returns {ExportPresenceMode} effective mode
|
|
835
960
|
*/
|
|
@@ -844,7 +969,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|
|
844
969
|
}
|
|
845
970
|
|
|
846
971
|
/**
|
|
847
|
-
* Returns warnings
|
|
972
|
+
* Returns warnings.
|
|
848
973
|
* @param {ModuleGraph} moduleGraph module graph
|
|
849
974
|
* @returns {WebpackError[] | null | undefined} warnings
|
|
850
975
|
*/
|
|
@@ -857,7 +982,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|
|
857
982
|
}
|
|
858
983
|
|
|
859
984
|
/**
|
|
860
|
-
* Returns errors
|
|
985
|
+
* Returns errors.
|
|
861
986
|
* @param {ModuleGraph} moduleGraph module graph
|
|
862
987
|
* @returns {WebpackError[] | null | undefined} errors
|
|
863
988
|
*/
|
|
@@ -870,6 +995,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|
|
870
995
|
}
|
|
871
996
|
|
|
872
997
|
/**
|
|
998
|
+
* Returns errors.
|
|
873
999
|
* @param {ModuleGraph} moduleGraph module graph
|
|
874
1000
|
* @returns {WebpackError[] | undefined} errors
|
|
875
1001
|
*/
|
|
@@ -956,6 +1082,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|
|
956
1082
|
}
|
|
957
1083
|
|
|
958
1084
|
/**
|
|
1085
|
+
* Serializes this instance into the provided serializer context.
|
|
959
1086
|
* @param {ObjectSerializerContext} context context
|
|
960
1087
|
*/
|
|
961
1088
|
serialize(context) {
|
|
@@ -973,6 +1100,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|
|
973
1100
|
}
|
|
974
1101
|
|
|
975
1102
|
/**
|
|
1103
|
+
* Restores this instance from the provided deserializer context.
|
|
976
1104
|
* @param {ObjectDeserializerContext} context context
|
|
977
1105
|
*/
|
|
978
1106
|
deserialize(context) {
|
|
@@ -999,6 +1127,7 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
|
|
|
999
1127
|
HarmonyImportDependency.Template
|
|
1000
1128
|
) {
|
|
1001
1129
|
/**
|
|
1130
|
+
* Applies the plugin by registering its hooks on the compiler.
|
|
1002
1131
|
* @param {Dependency} dependency the dependency for which the template should be applied
|
|
1003
1132
|
* @param {ReplaceSource} source the current replace source which can be modified
|
|
1004
1133
|
* @param {DependencyTemplateContext} templateContext the context object
|
|
@@ -1042,6 +1171,7 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
|
|
|
1042
1171
|
}
|
|
1043
1172
|
|
|
1044
1173
|
/**
|
|
1174
|
+
* Add export fragments.
|
|
1045
1175
|
* @param {InitFragment<GenerateContext>[]} initFragments target array for init fragments
|
|
1046
1176
|
* @param {HarmonyExportImportedSpecifierDependency} dep dependency
|
|
1047
1177
|
* @param {ExportMode} mode the export mode
|
|
@@ -1293,6 +1423,7 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
|
|
|
1293
1423
|
}
|
|
1294
1424
|
|
|
1295
1425
|
/**
|
|
1426
|
+
* Gets reexport fragment.
|
|
1296
1427
|
* @param {Module} module the current module
|
|
1297
1428
|
* @param {string} comment comment
|
|
1298
1429
|
* @param {UsedName} key key
|
|
@@ -1322,6 +1453,7 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
|
|
|
1322
1453
|
}
|
|
1323
1454
|
|
|
1324
1455
|
/**
|
|
1456
|
+
* Gets reexport fake namespace object fragments.
|
|
1325
1457
|
* @param {Module} module module
|
|
1326
1458
|
* @param {UsedName} key key
|
|
1327
1459
|
* @param {string} name name
|
|
@@ -1361,6 +1493,7 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
|
|
|
1361
1493
|
}
|
|
1362
1494
|
|
|
1363
1495
|
/**
|
|
1496
|
+
* Gets reexport deferred namespace object fragments.
|
|
1364
1497
|
* @param {Module} module module
|
|
1365
1498
|
* @param {ChunkGraph} chunkGraph chunkGraph
|
|
1366
1499
|
* @param {UsedName} key key
|
|
@@ -1402,6 +1535,7 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
|
|
|
1402
1535
|
}
|
|
1403
1536
|
|
|
1404
1537
|
/**
|
|
1538
|
+
* Gets conditional reexport statement.
|
|
1405
1539
|
* @param {Module} module module
|
|
1406
1540
|
* @param {string} key key
|
|
1407
1541
|
* @param {string} name name
|
|
@@ -1437,6 +1571,7 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
|
|
|
1437
1571
|
}
|
|
1438
1572
|
|
|
1439
1573
|
/**
|
|
1574
|
+
* Returns value.
|
|
1440
1575
|
* @param {string} name name
|
|
1441
1576
|
* @param {null | false | string | string[]} valueKey value key
|
|
1442
1577
|
* @returns {string | undefined} value
|
|
@@ -1465,6 +1600,7 @@ class HarmonyStarExportsList {
|
|
|
1465
1600
|
}
|
|
1466
1601
|
|
|
1467
1602
|
/**
|
|
1603
|
+
* Processes the provided dep.
|
|
1468
1604
|
* @param {HarmonyExportImportedSpecifierDependency} dep dependency
|
|
1469
1605
|
* @returns {void}
|
|
1470
1606
|
*/
|
|
@@ -1477,6 +1613,7 @@ class HarmonyStarExportsList {
|
|
|
1477
1613
|
}
|
|
1478
1614
|
|
|
1479
1615
|
/**
|
|
1616
|
+
* Serializes this instance into the provided serializer context.
|
|
1480
1617
|
* @param {ObjectSerializerContext} context context
|
|
1481
1618
|
*/
|
|
1482
1619
|
serialize({ write, setCircularReference }) {
|
|
@@ -1485,6 +1622,7 @@ class HarmonyStarExportsList {
|
|
|
1485
1622
|
}
|
|
1486
1623
|
|
|
1487
1624
|
/**
|
|
1625
|
+
* Restores this instance from the provided deserializer context.
|
|
1488
1626
|
* @param {ObjectDeserializerContext} context context
|
|
1489
1627
|
*/
|
|
1490
1628
|
deserialize({ read, setCircularReference }) {
|