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
package/lib/Module.js
CHANGED
|
@@ -47,10 +47,11 @@ const makeSerializable = require("./util/makeSerializable");
|
|
|
47
47
|
/** @typedef {import("./ResolverFactory").ResolverWithOptions} ResolverWithOptions */
|
|
48
48
|
/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */
|
|
49
49
|
/**
|
|
50
|
+
* Defines the init fragment type used by this module.
|
|
50
51
|
* @template T
|
|
51
52
|
* @typedef {import("./InitFragment")<T>} InitFragment
|
|
52
53
|
*/
|
|
53
|
-
/** @typedef {import("./WebpackError")} WebpackError */
|
|
54
|
+
/** @typedef {import("./errors/WebpackError")} WebpackError */
|
|
54
55
|
/** @typedef {import("./json/JsonData")} JsonData */
|
|
55
56
|
/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
|
|
56
57
|
/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
|
|
@@ -65,11 +66,13 @@ const makeSerializable = require("./util/makeSerializable");
|
|
|
65
66
|
/** @typedef {"namespace" | "default-only" | "default-with-named" | "dynamic"} ExportsType */
|
|
66
67
|
|
|
67
68
|
/**
|
|
69
|
+
* Defines the shared type used by this module.
|
|
68
70
|
* @template T
|
|
69
71
|
* @typedef {import("./util/LazySet")<T>} LazySet<T>
|
|
70
72
|
*/
|
|
71
73
|
|
|
72
74
|
/**
|
|
75
|
+
* Defines the source context type used by this module.
|
|
73
76
|
* @typedef {object} SourceContext
|
|
74
77
|
* @property {DependencyTemplates} dependencyTemplates the dependency templates
|
|
75
78
|
* @property {RuntimeTemplate} runtimeTemplate the runtime template
|
|
@@ -87,6 +90,7 @@ const makeSerializable = require("./util/makeSerializable");
|
|
|
87
90
|
|
|
88
91
|
// TODO webpack 6: compilation will be required in CodeGenerationContext
|
|
89
92
|
/**
|
|
93
|
+
* Defines the code generation context type used by this module.
|
|
90
94
|
* @typedef {object} CodeGenerationContext
|
|
91
95
|
* @property {DependencyTemplates} dependencyTemplates the dependency templates
|
|
92
96
|
* @property {RuntimeTemplate} runtimeTemplate the runtime template
|
|
@@ -101,6 +105,7 @@ const makeSerializable = require("./util/makeSerializable");
|
|
|
101
105
|
*/
|
|
102
106
|
|
|
103
107
|
/**
|
|
108
|
+
* Defines the concatenation bailout reason context type used by this module.
|
|
104
109
|
* @typedef {object} ConcatenationBailoutReasonContext
|
|
105
110
|
* @property {ModuleGraph} moduleGraph the module graph
|
|
106
111
|
* @property {ChunkGraph} chunkGraph the chunk graph
|
|
@@ -110,6 +115,7 @@ const makeSerializable = require("./util/makeSerializable");
|
|
|
110
115
|
/** @typedef {ReadonlySet<string>} ReadOnlyRuntimeRequirements */
|
|
111
116
|
|
|
112
117
|
/**
|
|
118
|
+
* Defines the all code generation schemas type used by this module.
|
|
113
119
|
* @typedef {object} AllCodeGenerationSchemas
|
|
114
120
|
* @property {Set<string>} topLevelDeclarations top level declarations for javascript modules
|
|
115
121
|
* @property {InitFragment<EXPECTED_ANY>[]} chunkInitFragments chunk init fragments for javascript modules
|
|
@@ -121,11 +127,13 @@ const makeSerializable = require("./util/makeSerializable");
|
|
|
121
127
|
*/
|
|
122
128
|
|
|
123
129
|
/**
|
|
130
|
+
* Defines the code gen value type used by this module.
|
|
124
131
|
* @template {string} K
|
|
125
|
-
* @typedef {K extends keyof AllCodeGenerationSchemas ? AllCodeGenerationSchemas[K] : EXPECTED_ANY} CodeGenValue
|
|
132
|
+
* @typedef {K extends (keyof AllCodeGenerationSchemas) ? AllCodeGenerationSchemas[K] : EXPECTED_ANY} CodeGenValue
|
|
126
133
|
*/
|
|
127
134
|
|
|
128
135
|
/**
|
|
136
|
+
* Defines the code gen map overloads type used by this module.
|
|
129
137
|
* @typedef {object} CodeGenMapOverloads
|
|
130
138
|
* @property {<K extends string>(key: K) => CodeGenValue<K> | undefined} get
|
|
131
139
|
* @property {<K extends string>(key: K, value: CodeGenValue<K>) => CodeGenerationResultData} set
|
|
@@ -134,12 +142,14 @@ const makeSerializable = require("./util/makeSerializable");
|
|
|
134
142
|
*/
|
|
135
143
|
|
|
136
144
|
/**
|
|
145
|
+
* Defines the code generation result data type used by this module.
|
|
137
146
|
* @typedef {Omit<Map<string, EXPECTED_ANY>, "get" | "set" | "has" | "delete"> & CodeGenMapOverloads} CodeGenerationResultData
|
|
138
147
|
*/
|
|
139
148
|
|
|
140
149
|
/** @typedef {Map<SourceType, Source>} Sources */
|
|
141
150
|
|
|
142
151
|
/**
|
|
152
|
+
* Defines the code generation result type used by this module.
|
|
143
153
|
* @typedef {object} CodeGenerationResult
|
|
144
154
|
* @property {Sources} sources the resulting sources for all source types
|
|
145
155
|
* @property {CodeGenerationResultData=} data the resulting data for all source types
|
|
@@ -148,12 +158,14 @@ const makeSerializable = require("./util/makeSerializable");
|
|
|
148
158
|
*/
|
|
149
159
|
|
|
150
160
|
/**
|
|
161
|
+
* Defines the lib ident options type used by this module.
|
|
151
162
|
* @typedef {object} LibIdentOptions
|
|
152
163
|
* @property {string} context absolute context path to which lib ident is relative to
|
|
153
164
|
* @property {AssociatedObjectForCache=} associatedObjectForCache object for caching
|
|
154
165
|
*/
|
|
155
166
|
|
|
156
167
|
/**
|
|
168
|
+
* Defines the known build meta type used by this module.
|
|
157
169
|
* @typedef {object} KnownBuildMeta
|
|
158
170
|
* @property {("default" | "namespace" | "flagged" | "dynamic")=} exportsType
|
|
159
171
|
* @property {(false | "redirect" | "redirect-warn")=} defaultObject
|
|
@@ -161,13 +173,15 @@ const makeSerializable = require("./util/makeSerializable");
|
|
|
161
173
|
* @property {boolean=} treatAsCommonJs
|
|
162
174
|
* @property {boolean=} async
|
|
163
175
|
* @property {boolean=} sideEffectFree
|
|
164
|
-
* @property {boolean=}
|
|
176
|
+
* @property {boolean=} isCssModule
|
|
177
|
+
* @property {boolean=} needIdInConcatenation
|
|
165
178
|
* @property {Record<string, string>=} jsIncompatibleExports
|
|
166
179
|
* @property {Map<string, Record<string, string>>=} exportsFinalNameByRuntime
|
|
167
180
|
* @property {Map<string, string>=} exportsSourceByRuntime
|
|
168
181
|
*/
|
|
169
182
|
|
|
170
183
|
/**
|
|
184
|
+
* Defines the known build info type used by this module.
|
|
171
185
|
* @typedef {object} KnownBuildInfo
|
|
172
186
|
* @property {boolean=} cacheable
|
|
173
187
|
* @property {boolean=} parsed
|
|
@@ -193,6 +207,7 @@ const makeSerializable = require("./util/makeSerializable");
|
|
|
193
207
|
* @property {boolean=} javascriptModule for external modules
|
|
194
208
|
* @property {boolean=} active for lazy compilation modules
|
|
195
209
|
* @property {CssData=} cssData for css modules
|
|
210
|
+
* @property {string=} charset for css modules (charset at-rule)
|
|
196
211
|
* @property {JsonData=} jsonData for json modules
|
|
197
212
|
* @property {Set<string>=} topLevelDeclarations top level declaration names
|
|
198
213
|
*/
|
|
@@ -201,6 +216,7 @@ const makeSerializable = require("./util/makeSerializable");
|
|
|
201
216
|
/** @typedef {Map<string, ValueCacheVersion>} ValueCacheVersions */
|
|
202
217
|
|
|
203
218
|
/**
|
|
219
|
+
* Defines the need build context type used by this module.
|
|
204
220
|
* @typedef {object} NeedBuildContext
|
|
205
221
|
* @property {Compilation} compilation
|
|
206
222
|
* @property {FileSystemInfo} fileSystemInfo
|
|
@@ -215,6 +231,7 @@ const makeSerializable = require("./util/makeSerializable");
|
|
|
215
231
|
/** @typedef {KnownBuildInfo & Record<string, EXPECTED_ANY>} BuildInfo */
|
|
216
232
|
|
|
217
233
|
/**
|
|
234
|
+
* Defines the factory meta type used by this module.
|
|
218
235
|
* @typedef {object} FactoryMeta
|
|
219
236
|
* @property {boolean=} sideEffectFree
|
|
220
237
|
*/
|
|
@@ -228,6 +245,7 @@ const DEFAULT_TYPES_UNKNOWN = new Set([UNKNOWN_TYPE]);
|
|
|
228
245
|
|
|
229
246
|
const deprecatedNeedRebuild = util.deprecate(
|
|
230
247
|
/**
|
|
248
|
+
* Handles the callback logic for this hook.
|
|
231
249
|
* @param {Module} module the module
|
|
232
250
|
* @param {NeedBuildContext} context context info
|
|
233
251
|
* @returns {boolean} true, when rebuild is needed
|
|
@@ -248,6 +266,7 @@ const deprecatedNeedRebuild = util.deprecate(
|
|
|
248
266
|
|
|
249
267
|
class Module extends DependenciesBlock {
|
|
250
268
|
/**
|
|
269
|
+
* Creates an instance of Module.
|
|
251
270
|
* @param {ModuleTypes | ""} type the module type, when deserializing the type is not known and is an empty string
|
|
252
271
|
* @param {(string | null)=} context an optional context
|
|
253
272
|
* @param {(string | null)=} layer an optional layer in which the module is
|
|
@@ -285,9 +304,9 @@ class Module extends DependenciesBlock {
|
|
|
285
304
|
/** @type {boolean} */
|
|
286
305
|
this.hot = false;
|
|
287
306
|
// Info from Build
|
|
288
|
-
/** @type {
|
|
307
|
+
/** @type {Error[] | undefined} */
|
|
289
308
|
this._warnings = undefined;
|
|
290
|
-
/** @type {
|
|
309
|
+
/** @type {Error[] | undefined} */
|
|
291
310
|
this._errors = undefined;
|
|
292
311
|
/** @type {BuildMeta | undefined} */
|
|
293
312
|
this.buildMeta = undefined;
|
|
@@ -302,6 +321,7 @@ class Module extends DependenciesBlock {
|
|
|
302
321
|
// TODO remove in webpack 6
|
|
303
322
|
// BACKWARD-COMPAT START
|
|
304
323
|
/**
|
|
324
|
+
* Returns the module id assigned by the chunk graph.
|
|
305
325
|
* @deprecated
|
|
306
326
|
* @returns {ModuleId | null} module id
|
|
307
327
|
*/
|
|
@@ -314,6 +334,7 @@ class Module extends DependenciesBlock {
|
|
|
314
334
|
}
|
|
315
335
|
|
|
316
336
|
/**
|
|
337
|
+
* Updates the module id using the provided value.
|
|
317
338
|
* @deprecated
|
|
318
339
|
* @param {ModuleId} value value
|
|
319
340
|
*/
|
|
@@ -330,6 +351,7 @@ class Module extends DependenciesBlock {
|
|
|
330
351
|
}
|
|
331
352
|
|
|
332
353
|
/**
|
|
354
|
+
* Returns the hash of the module.
|
|
333
355
|
* @deprecated
|
|
334
356
|
* @returns {string} the hash of the module
|
|
335
357
|
*/
|
|
@@ -342,6 +364,7 @@ class Module extends DependenciesBlock {
|
|
|
342
364
|
}
|
|
343
365
|
|
|
344
366
|
/**
|
|
367
|
+
* Returns the rendered hash of the module.
|
|
345
368
|
* @deprecated
|
|
346
369
|
* @returns {string} the shortened hash of the module
|
|
347
370
|
*/
|
|
@@ -378,6 +401,7 @@ class Module extends DependenciesBlock {
|
|
|
378
401
|
}
|
|
379
402
|
|
|
380
403
|
/**
|
|
404
|
+
* Returns the pre-order index.
|
|
381
405
|
* @deprecated
|
|
382
406
|
* @returns {number | null} the pre order index
|
|
383
407
|
*/
|
|
@@ -390,6 +414,7 @@ class Module extends DependenciesBlock {
|
|
|
390
414
|
}
|
|
391
415
|
|
|
392
416
|
/**
|
|
417
|
+
* Updates the pre-order index using the provided value.
|
|
393
418
|
* @deprecated
|
|
394
419
|
* @param {number} value the pre order index
|
|
395
420
|
*/
|
|
@@ -402,6 +427,7 @@ class Module extends DependenciesBlock {
|
|
|
402
427
|
}
|
|
403
428
|
|
|
404
429
|
/**
|
|
430
|
+
* Returns the post-order index.
|
|
405
431
|
* @deprecated
|
|
406
432
|
* @returns {number | null} the post order index
|
|
407
433
|
*/
|
|
@@ -414,6 +440,7 @@ class Module extends DependenciesBlock {
|
|
|
414
440
|
}
|
|
415
441
|
|
|
416
442
|
/**
|
|
443
|
+
* Updates the post-order index using the provided value.
|
|
417
444
|
* @deprecated
|
|
418
445
|
* @param {number} value the post order index
|
|
419
446
|
*/
|
|
@@ -426,6 +453,7 @@ class Module extends DependenciesBlock {
|
|
|
426
453
|
}
|
|
427
454
|
|
|
428
455
|
/**
|
|
456
|
+
* Returns the depth.
|
|
429
457
|
* @deprecated
|
|
430
458
|
* @returns {number | null} the depth
|
|
431
459
|
*/
|
|
@@ -438,6 +466,7 @@ class Module extends DependenciesBlock {
|
|
|
438
466
|
}
|
|
439
467
|
|
|
440
468
|
/**
|
|
469
|
+
* Updates the depth using the provided value.
|
|
441
470
|
* @deprecated
|
|
442
471
|
* @param {number} value the depth
|
|
443
472
|
*/
|
|
@@ -450,6 +479,7 @@ class Module extends DependenciesBlock {
|
|
|
450
479
|
}
|
|
451
480
|
|
|
452
481
|
/**
|
|
482
|
+
* Returns the issuer.
|
|
453
483
|
* @deprecated
|
|
454
484
|
* @returns {Module | null | undefined} issuer
|
|
455
485
|
*/
|
|
@@ -462,6 +492,7 @@ class Module extends DependenciesBlock {
|
|
|
462
492
|
}
|
|
463
493
|
|
|
464
494
|
/**
|
|
495
|
+
* Updates the issuer using the provided value.
|
|
465
496
|
* @deprecated
|
|
466
497
|
* @param {Module | null} value issuer
|
|
467
498
|
*/
|
|
@@ -486,6 +517,7 @@ class Module extends DependenciesBlock {
|
|
|
486
517
|
}
|
|
487
518
|
|
|
488
519
|
/**
|
|
520
|
+
* Gets optimization bailout.
|
|
489
521
|
* @deprecated
|
|
490
522
|
* @returns {OptimizationBailouts} list
|
|
491
523
|
*/
|
|
@@ -512,6 +544,7 @@ class Module extends DependenciesBlock {
|
|
|
512
544
|
}
|
|
513
545
|
|
|
514
546
|
/**
|
|
547
|
+
* Adds the provided chunk to the module.
|
|
515
548
|
* @deprecated
|
|
516
549
|
* @param {Chunk} chunk the chunk
|
|
517
550
|
* @returns {boolean} true, when the module was added
|
|
@@ -528,6 +561,7 @@ class Module extends DependenciesBlock {
|
|
|
528
561
|
}
|
|
529
562
|
|
|
530
563
|
/**
|
|
564
|
+
* Removes the provided chunk from the module.
|
|
531
565
|
* @deprecated
|
|
532
566
|
* @param {Chunk} chunk the chunk
|
|
533
567
|
* @returns {void}
|
|
@@ -541,6 +575,7 @@ class Module extends DependenciesBlock {
|
|
|
541
575
|
}
|
|
542
576
|
|
|
543
577
|
/**
|
|
578
|
+
* Checks whether this module is in the provided chunk.
|
|
544
579
|
* @deprecated
|
|
545
580
|
* @param {Chunk} chunk the chunk
|
|
546
581
|
* @returns {boolean} true, when the module is in the chunk
|
|
@@ -602,6 +637,7 @@ class Module extends DependenciesBlock {
|
|
|
602
637
|
}
|
|
603
638
|
|
|
604
639
|
/**
|
|
640
|
+
* Checks whether this module provides the specified export.
|
|
605
641
|
* @deprecated
|
|
606
642
|
* @param {string} exportName a name of an export
|
|
607
643
|
* @returns {boolean | null} true, if the export is provided why the module.
|
|
@@ -618,6 +654,7 @@ class Module extends DependenciesBlock {
|
|
|
618
654
|
// BACKWARD-COMPAT END
|
|
619
655
|
|
|
620
656
|
/**
|
|
657
|
+
* Gets exports argument.
|
|
621
658
|
* @returns {string} name of the exports argument
|
|
622
659
|
*/
|
|
623
660
|
get exportsArgument() {
|
|
@@ -625,6 +662,7 @@ class Module extends DependenciesBlock {
|
|
|
625
662
|
}
|
|
626
663
|
|
|
627
664
|
/**
|
|
665
|
+
* Gets module argument.
|
|
628
666
|
* @returns {string} name of the module argument
|
|
629
667
|
*/
|
|
630
668
|
get moduleArgument() {
|
|
@@ -632,6 +670,7 @@ class Module extends DependenciesBlock {
|
|
|
632
670
|
}
|
|
633
671
|
|
|
634
672
|
/**
|
|
673
|
+
* Returns export type.
|
|
635
674
|
* @param {ModuleGraph} moduleGraph the module graph
|
|
636
675
|
* @param {boolean | undefined} strict the importing module is strict
|
|
637
676
|
* @returns {ExportsType} export type
|
|
@@ -702,6 +741,7 @@ class Module extends DependenciesBlock {
|
|
|
702
741
|
}
|
|
703
742
|
|
|
704
743
|
/**
|
|
744
|
+
* Adds presentational dependency.
|
|
705
745
|
* @param {Dependency} presentationalDependency dependency being tied to module.
|
|
706
746
|
* This is a Dependency without edge in the module graph. It's only for presentation.
|
|
707
747
|
* @returns {void}
|
|
@@ -714,6 +754,7 @@ class Module extends DependenciesBlock {
|
|
|
714
754
|
}
|
|
715
755
|
|
|
716
756
|
/**
|
|
757
|
+
* Adds code generation dependency.
|
|
717
758
|
* @param {Dependency} codeGenerationDependency dependency being tied to module.
|
|
718
759
|
* This is a Dependency where the code generation result of the referenced module is needed during code generation.
|
|
719
760
|
* The Dependency should also be added to normal dependencies via addDependency.
|
|
@@ -727,7 +768,7 @@ class Module extends DependenciesBlock {
|
|
|
727
768
|
}
|
|
728
769
|
|
|
729
770
|
/**
|
|
730
|
-
*
|
|
771
|
+
* Clear dependencies and blocks.
|
|
731
772
|
* @returns {void}
|
|
732
773
|
*/
|
|
733
774
|
clearDependenciesAndBlocks() {
|
|
@@ -741,7 +782,8 @@ class Module extends DependenciesBlock {
|
|
|
741
782
|
}
|
|
742
783
|
|
|
743
784
|
/**
|
|
744
|
-
*
|
|
785
|
+
* Adds the provided warning to the module.
|
|
786
|
+
* @param {Error} warning the warning
|
|
745
787
|
* @returns {void}
|
|
746
788
|
*/
|
|
747
789
|
addWarning(warning) {
|
|
@@ -752,13 +794,15 @@ class Module extends DependenciesBlock {
|
|
|
752
794
|
}
|
|
753
795
|
|
|
754
796
|
/**
|
|
755
|
-
*
|
|
797
|
+
* Returns list of warnings if any.
|
|
798
|
+
* @returns {Error[] | undefined} list of warnings if any
|
|
756
799
|
*/
|
|
757
800
|
getWarnings() {
|
|
758
801
|
return this._warnings;
|
|
759
802
|
}
|
|
760
803
|
|
|
761
804
|
/**
|
|
805
|
+
* Gets number of warnings.
|
|
762
806
|
* @returns {number} number of warnings
|
|
763
807
|
*/
|
|
764
808
|
getNumberOfWarnings() {
|
|
@@ -766,7 +810,8 @@ class Module extends DependenciesBlock {
|
|
|
766
810
|
}
|
|
767
811
|
|
|
768
812
|
/**
|
|
769
|
-
*
|
|
813
|
+
* Adds the provided error to the module.
|
|
814
|
+
* @param {Error} error the error
|
|
770
815
|
* @returns {void}
|
|
771
816
|
*/
|
|
772
817
|
addError(error) {
|
|
@@ -777,13 +822,15 @@ class Module extends DependenciesBlock {
|
|
|
777
822
|
}
|
|
778
823
|
|
|
779
824
|
/**
|
|
780
|
-
*
|
|
825
|
+
* Returns list of errors if any.
|
|
826
|
+
* @returns {Error[] | undefined} list of errors if any
|
|
781
827
|
*/
|
|
782
828
|
getErrors() {
|
|
783
829
|
return this._errors;
|
|
784
830
|
}
|
|
785
831
|
|
|
786
832
|
/**
|
|
833
|
+
* Gets number of errors.
|
|
787
834
|
* @returns {number} number of errors
|
|
788
835
|
*/
|
|
789
836
|
getNumberOfErrors() {
|
|
@@ -804,6 +851,7 @@ class Module extends DependenciesBlock {
|
|
|
804
851
|
}
|
|
805
852
|
|
|
806
853
|
/**
|
|
854
|
+
* Checks whether this module is optional.
|
|
807
855
|
* @param {ModuleGraph} moduleGraph the module graph
|
|
808
856
|
* @returns {boolean} true, if the module is optional
|
|
809
857
|
*/
|
|
@@ -823,6 +871,7 @@ class Module extends DependenciesBlock {
|
|
|
823
871
|
}
|
|
824
872
|
|
|
825
873
|
/**
|
|
874
|
+
* Checks whether this module is accessible in chunk.
|
|
826
875
|
* @param {ChunkGraph} chunkGraph the chunk graph
|
|
827
876
|
* @param {Chunk} chunk a chunk
|
|
828
877
|
* @param {Chunk=} ignoreChunk chunk to be ignored
|
|
@@ -837,6 +886,7 @@ class Module extends DependenciesBlock {
|
|
|
837
886
|
}
|
|
838
887
|
|
|
839
888
|
/**
|
|
889
|
+
* Checks whether this module is accessible in chunk group.
|
|
840
890
|
* @param {ChunkGraph} chunkGraph the chunk graph
|
|
841
891
|
* @param {ChunkGroup} chunkGroup a chunk group
|
|
842
892
|
* @param {Chunk=} ignoreChunk chunk to be ignored
|
|
@@ -864,6 +914,7 @@ class Module extends DependenciesBlock {
|
|
|
864
914
|
}
|
|
865
915
|
|
|
866
916
|
/**
|
|
917
|
+
* Checks whether this module contains the chunk.
|
|
867
918
|
* @param {Chunk} chunk a chunk
|
|
868
919
|
* @param {ModuleGraph} moduleGraph the module graph
|
|
869
920
|
* @param {ChunkGraph} chunkGraph the chunk graph
|
|
@@ -889,6 +940,7 @@ class Module extends DependenciesBlock {
|
|
|
889
940
|
}
|
|
890
941
|
|
|
891
942
|
/**
|
|
943
|
+
* Checks whether this module contains the module graph.
|
|
892
944
|
* @param {ModuleGraph} moduleGraph the module graph
|
|
893
945
|
* @param {RuntimeSpec} runtime the runtime
|
|
894
946
|
* @returns {boolean} true if at least one other module depends on this module
|
|
@@ -901,6 +953,7 @@ class Module extends DependenciesBlock {
|
|
|
901
953
|
}
|
|
902
954
|
|
|
903
955
|
/**
|
|
956
|
+
* Returns a string representation.
|
|
904
957
|
* @returns {string} for debugging
|
|
905
958
|
*/
|
|
906
959
|
toString() {
|
|
@@ -908,6 +961,7 @@ class Module extends DependenciesBlock {
|
|
|
908
961
|
}
|
|
909
962
|
|
|
910
963
|
/**
|
|
964
|
+
* Checks whether the module needs to be rebuilt for the current build state.
|
|
911
965
|
* @param {NeedBuildContext} context context info
|
|
912
966
|
* @param {NeedBuildCallback} callback callback function, returns true, if the module needs a rebuild
|
|
913
967
|
* @returns {void}
|
|
@@ -922,6 +976,7 @@ class Module extends DependenciesBlock {
|
|
|
922
976
|
}
|
|
923
977
|
|
|
924
978
|
/**
|
|
979
|
+
* Checks whether it needs rebuild.
|
|
925
980
|
* @deprecated Use needBuild instead
|
|
926
981
|
* @param {Map<string, number | null>} fileTimestamps timestamps of files
|
|
927
982
|
* @param {Map<string, number | null>} contextTimestamps timestamps of directories
|
|
@@ -932,6 +987,7 @@ class Module extends DependenciesBlock {
|
|
|
932
987
|
}
|
|
933
988
|
|
|
934
989
|
/**
|
|
990
|
+
* Updates the hash with the data contributed by this instance.
|
|
935
991
|
* @param {Hash} hash the hash used to track dependencies
|
|
936
992
|
* @param {UpdateHashContext} context context
|
|
937
993
|
* @returns {void}
|
|
@@ -958,6 +1014,7 @@ class Module extends DependenciesBlock {
|
|
|
958
1014
|
}
|
|
959
1015
|
|
|
960
1016
|
/**
|
|
1017
|
+
* Invalidates the cached state associated with this value.
|
|
961
1018
|
* @returns {void}
|
|
962
1019
|
*/
|
|
963
1020
|
invalidateBuild() {
|
|
@@ -966,29 +1023,32 @@ class Module extends DependenciesBlock {
|
|
|
966
1023
|
|
|
967
1024
|
/* istanbul ignore next */
|
|
968
1025
|
/**
|
|
1026
|
+
* Returns the unique identifier used to reference this module.
|
|
969
1027
|
* @abstract
|
|
970
1028
|
* @returns {string} a unique identifier of the module
|
|
971
1029
|
*/
|
|
972
1030
|
identifier() {
|
|
973
|
-
const AbstractMethodError = require("./AbstractMethodError");
|
|
1031
|
+
const AbstractMethodError = require("./errors/AbstractMethodError");
|
|
974
1032
|
|
|
975
1033
|
throw new AbstractMethodError();
|
|
976
1034
|
}
|
|
977
1035
|
|
|
978
1036
|
/* istanbul ignore next */
|
|
979
1037
|
/**
|
|
1038
|
+
* Returns a human-readable identifier for this module.
|
|
980
1039
|
* @abstract
|
|
981
1040
|
* @param {RequestShortener} requestShortener the request shortener
|
|
982
1041
|
* @returns {string} a user readable identifier of the module
|
|
983
1042
|
*/
|
|
984
1043
|
readableIdentifier(requestShortener) {
|
|
985
|
-
const AbstractMethodError = require("./AbstractMethodError");
|
|
1044
|
+
const AbstractMethodError = require("./errors/AbstractMethodError");
|
|
986
1045
|
|
|
987
1046
|
throw new AbstractMethodError();
|
|
988
1047
|
}
|
|
989
1048
|
|
|
990
1049
|
/* istanbul ignore next */
|
|
991
1050
|
/**
|
|
1051
|
+
* Builds the module using the provided compilation context.
|
|
992
1052
|
* @abstract
|
|
993
1053
|
* @param {WebpackOptions} options webpack options
|
|
994
1054
|
* @param {Compilation} compilation the compilation
|
|
@@ -998,12 +1058,13 @@ class Module extends DependenciesBlock {
|
|
|
998
1058
|
* @returns {void}
|
|
999
1059
|
*/
|
|
1000
1060
|
build(options, compilation, resolver, fs, callback) {
|
|
1001
|
-
const AbstractMethodError = require("./AbstractMethodError");
|
|
1061
|
+
const AbstractMethodError = require("./errors/AbstractMethodError");
|
|
1002
1062
|
|
|
1003
1063
|
throw new AbstractMethodError();
|
|
1004
1064
|
}
|
|
1005
1065
|
|
|
1006
1066
|
/**
|
|
1067
|
+
* Returns the source types this module can generate.
|
|
1007
1068
|
* @abstract
|
|
1008
1069
|
* @returns {SourceTypes} types available (do not mutate)
|
|
1009
1070
|
*/
|
|
@@ -1029,6 +1090,7 @@ class Module extends DependenciesBlock {
|
|
|
1029
1090
|
}
|
|
1030
1091
|
|
|
1031
1092
|
/**
|
|
1093
|
+
* Returns generated source.
|
|
1032
1094
|
* @abstract
|
|
1033
1095
|
* @deprecated Use codeGeneration() instead
|
|
1034
1096
|
* @param {DependencyTemplates} dependencyTemplates the dependency templates
|
|
@@ -1038,7 +1100,7 @@ class Module extends DependenciesBlock {
|
|
|
1038
1100
|
*/
|
|
1039
1101
|
source(dependencyTemplates, runtimeTemplate, type = JAVASCRIPT_TYPE) {
|
|
1040
1102
|
if (this.codeGeneration === Module.prototype.codeGeneration) {
|
|
1041
|
-
const AbstractMethodError = require("./AbstractMethodError");
|
|
1103
|
+
const AbstractMethodError = require("./errors/AbstractMethodError");
|
|
1042
1104
|
|
|
1043
1105
|
throw new AbstractMethodError();
|
|
1044
1106
|
}
|
|
@@ -1068,17 +1130,19 @@ class Module extends DependenciesBlock {
|
|
|
1068
1130
|
|
|
1069
1131
|
/* istanbul ignore next */
|
|
1070
1132
|
/**
|
|
1133
|
+
* Returns the estimated size for the requested source type.
|
|
1071
1134
|
* @abstract
|
|
1072
1135
|
* @param {string=} type the source type for which the size should be estimated
|
|
1073
1136
|
* @returns {number} the estimated size of the module (must be non-zero)
|
|
1074
1137
|
*/
|
|
1075
1138
|
size(type) {
|
|
1076
|
-
const AbstractMethodError = require("./AbstractMethodError");
|
|
1139
|
+
const AbstractMethodError = require("./errors/AbstractMethodError");
|
|
1077
1140
|
|
|
1078
1141
|
throw new AbstractMethodError();
|
|
1079
1142
|
}
|
|
1080
1143
|
|
|
1081
1144
|
/**
|
|
1145
|
+
* Gets the library identifier.
|
|
1082
1146
|
* @param {LibIdentOptions} options options
|
|
1083
1147
|
* @returns {LibIdent | null} an identifier for library inclusion
|
|
1084
1148
|
*/
|
|
@@ -1087,6 +1151,7 @@ class Module extends DependenciesBlock {
|
|
|
1087
1151
|
}
|
|
1088
1152
|
|
|
1089
1153
|
/**
|
|
1154
|
+
* Returns the path used when matching this module against rule conditions.
|
|
1090
1155
|
* @returns {NameForCondition | null} absolute path which should be used for condition matching (usually the resource path)
|
|
1091
1156
|
*/
|
|
1092
1157
|
nameForCondition() {
|
|
@@ -1094,6 +1159,7 @@ class Module extends DependenciesBlock {
|
|
|
1094
1159
|
}
|
|
1095
1160
|
|
|
1096
1161
|
/**
|
|
1162
|
+
* Returns the reason this module cannot be concatenated, when one exists.
|
|
1097
1163
|
* @param {ConcatenationBailoutReasonContext} context context
|
|
1098
1164
|
* @returns {string | undefined} reason why this module can't be concatenated, undefined when it can be concatenated
|
|
1099
1165
|
*/
|
|
@@ -1102,6 +1168,7 @@ class Module extends DependenciesBlock {
|
|
|
1102
1168
|
}
|
|
1103
1169
|
|
|
1104
1170
|
/**
|
|
1171
|
+
* Gets side effects connection state.
|
|
1105
1172
|
* @param {ModuleGraph} moduleGraph the module graph
|
|
1106
1173
|
* @returns {ConnectionState} how this module should be connected to referencing modules when consumed for side-effects only
|
|
1107
1174
|
*/
|
|
@@ -1110,6 +1177,7 @@ class Module extends DependenciesBlock {
|
|
|
1110
1177
|
}
|
|
1111
1178
|
|
|
1112
1179
|
/**
|
|
1180
|
+
* Generates code and runtime requirements for this module.
|
|
1113
1181
|
* @param {CodeGenerationContext} context context for code generation
|
|
1114
1182
|
* @returns {CodeGenerationResult} result
|
|
1115
1183
|
*/
|
|
@@ -1140,6 +1208,7 @@ class Module extends DependenciesBlock {
|
|
|
1140
1208
|
}
|
|
1141
1209
|
|
|
1142
1210
|
/**
|
|
1211
|
+
* Returns true if the module can be placed in the chunk.
|
|
1143
1212
|
* @param {Chunk} chunk the chunk which condition should be checked
|
|
1144
1213
|
* @param {Compilation} compilation the compilation
|
|
1145
1214
|
* @returns {boolean} true if the module can be placed in the chunk
|
|
@@ -1198,6 +1267,7 @@ class Module extends DependenciesBlock {
|
|
|
1198
1267
|
}
|
|
1199
1268
|
|
|
1200
1269
|
/**
|
|
1270
|
+
* Gets the original source.
|
|
1201
1271
|
* @returns {Source | null} the original source for the module before webpack transformation
|
|
1202
1272
|
*/
|
|
1203
1273
|
originalSource() {
|
|
@@ -1205,6 +1275,7 @@ class Module extends DependenciesBlock {
|
|
|
1205
1275
|
}
|
|
1206
1276
|
|
|
1207
1277
|
/**
|
|
1278
|
+
* Adds the provided file dependencies to the module.
|
|
1208
1279
|
* @param {FileSystemDependencies} fileDependencies set where file dependencies are added to
|
|
1209
1280
|
* @param {FileSystemDependencies} contextDependencies set where context dependencies are added to
|
|
1210
1281
|
* @param {FileSystemDependencies} missingDependencies set where missing dependencies are added to
|
|
@@ -1218,6 +1289,7 @@ class Module extends DependenciesBlock {
|
|
|
1218
1289
|
) {}
|
|
1219
1290
|
|
|
1220
1291
|
/**
|
|
1292
|
+
* Serializes this instance into the provided serializer context.
|
|
1221
1293
|
* @param {ObjectSerializerContext} context context
|
|
1222
1294
|
*/
|
|
1223
1295
|
serialize(context) {
|
|
@@ -1248,6 +1320,7 @@ class Module extends DependenciesBlock {
|
|
|
1248
1320
|
}
|
|
1249
1321
|
|
|
1250
1322
|
/**
|
|
1323
|
+
* Restores this instance from the provided deserializer context.
|
|
1251
1324
|
* @param {ObjectDeserializerContext} context context
|
|
1252
1325
|
*/
|
|
1253
1326
|
deserialize(context) {
|
|
@@ -1271,6 +1344,7 @@ class Module extends DependenciesBlock {
|
|
|
1271
1344
|
|
|
1272
1345
|
// TODO remove in webpack 6
|
|
1273
1346
|
/**
|
|
1347
|
+
* Gets source basic types.
|
|
1274
1348
|
* @deprecated In webpack 6, call getSourceBasicTypes() directly on the module instance instead of using this static method.
|
|
1275
1349
|
* @param {Module} module the module
|
|
1276
1350
|
* @returns {ReturnType<Module["getSourceBasicTypes"]>} the source types of the module
|
|
@@ -1290,6 +1364,7 @@ makeSerializable(Module, "webpack/lib/Module");
|
|
|
1290
1364
|
// TODO remove in webpack 6
|
|
1291
1365
|
Object.defineProperty(Module.prototype, "hasEqualsChunks", {
|
|
1292
1366
|
/**
|
|
1367
|
+
* Gets has equals chunks.
|
|
1293
1368
|
* @deprecated
|
|
1294
1369
|
* @returns {EXPECTED_ANY} throw an error
|
|
1295
1370
|
*/
|
|
@@ -1303,6 +1378,7 @@ Object.defineProperty(Module.prototype, "hasEqualsChunks", {
|
|
|
1303
1378
|
// TODO remove in webpack 6
|
|
1304
1379
|
Object.defineProperty(Module.prototype, "isUsed", {
|
|
1305
1380
|
/**
|
|
1381
|
+
* Returns throw an error.
|
|
1306
1382
|
* @deprecated
|
|
1307
1383
|
* @returns {EXPECTED_ANY} throw an error
|
|
1308
1384
|
*/
|
|
@@ -1316,13 +1392,15 @@ Object.defineProperty(Module.prototype, "isUsed", {
|
|
|
1316
1392
|
// TODO remove in webpack 6
|
|
1317
1393
|
Object.defineProperty(Module.prototype, "errors", {
|
|
1318
1394
|
/**
|
|
1395
|
+
* Returns errors.
|
|
1319
1396
|
* @deprecated
|
|
1320
|
-
* @returns {
|
|
1397
|
+
* @returns {Error[]} errors
|
|
1321
1398
|
*/
|
|
1322
1399
|
get: util.deprecate(
|
|
1323
1400
|
/**
|
|
1401
|
+
* Returns errors.
|
|
1324
1402
|
* @this {Module}
|
|
1325
|
-
* @returns {
|
|
1403
|
+
* @returns {Error[]} errors
|
|
1326
1404
|
*/
|
|
1327
1405
|
function errors() {
|
|
1328
1406
|
if (this._errors === undefined) {
|
|
@@ -1338,13 +1416,15 @@ Object.defineProperty(Module.prototype, "errors", {
|
|
|
1338
1416
|
// TODO remove in webpack 6
|
|
1339
1417
|
Object.defineProperty(Module.prototype, "warnings", {
|
|
1340
1418
|
/**
|
|
1419
|
+
* Returns warnings.
|
|
1341
1420
|
* @deprecated
|
|
1342
|
-
* @returns {
|
|
1421
|
+
* @returns {Error[]} warnings
|
|
1343
1422
|
*/
|
|
1344
1423
|
get: util.deprecate(
|
|
1345
1424
|
/**
|
|
1425
|
+
* Returns warnings.
|
|
1346
1426
|
* @this {Module}
|
|
1347
|
-
* @returns {
|
|
1427
|
+
* @returns {Error[]} warnings
|
|
1348
1428
|
*/
|
|
1349
1429
|
function warnings() {
|
|
1350
1430
|
if (this._warnings === undefined) {
|
|
@@ -1360,6 +1440,7 @@ Object.defineProperty(Module.prototype, "warnings", {
|
|
|
1360
1440
|
// TODO remove in webpack 6
|
|
1361
1441
|
Object.defineProperty(Module.prototype, "used", {
|
|
1362
1442
|
/**
|
|
1443
|
+
* Returns throw an error.
|
|
1363
1444
|
* @deprecated
|
|
1364
1445
|
* @returns {EXPECTED_ANY} throw an error
|
|
1365
1446
|
*/
|
|
@@ -1369,6 +1450,7 @@ Object.defineProperty(Module.prototype, "used", {
|
|
|
1369
1450
|
);
|
|
1370
1451
|
},
|
|
1371
1452
|
/**
|
|
1453
|
+
* Updates used using the provided value.
|
|
1372
1454
|
* @param {EXPECTED_ANY} value value
|
|
1373
1455
|
*/
|
|
1374
1456
|
set(value) {
|