webpack 5.76.1 → 5.88.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.
Potentially problematic release.
This version of webpack might be problematic. Click here for more details.
- package/README.md +10 -4
- package/bin/webpack.js +26 -2
- package/hot/dev-server.js +2 -1
- package/hot/lazy-compilation-node.js +10 -0
- package/hot/lazy-compilation-web.js +9 -0
- package/hot/log-apply-result.js +5 -0
- package/hot/log.js +22 -0
- package/hot/only-dev-server.js +2 -1
- package/hot/poll.js +3 -0
- package/hot/signal.js +4 -0
- package/lib/APIPlugin.js +174 -116
- package/lib/AsyncDependenciesBlock.js +13 -5
- package/lib/AutomaticPrefetchPlugin.js +1 -0
- package/lib/BannerPlugin.js +4 -0
- package/lib/CacheFacade.js +4 -0
- package/lib/CaseSensitiveModulesWarning.js +3 -1
- package/lib/Chunk.js +36 -18
- package/lib/ChunkGraph.js +4 -4
- package/lib/ChunkGroup.js +25 -10
- package/lib/CleanPlugin.js +30 -7
- package/lib/CodeGenerationResults.js +2 -2
- package/lib/CompatibilityPlugin.js +85 -46
- package/lib/Compilation.js +17 -8
- package/lib/Compiler.js +12 -8
- package/lib/ConcatenationScope.js +2 -2
- package/lib/ConditionalInitFragment.js +11 -1
- package/lib/ConstPlugin.js +79 -44
- package/lib/ContextModule.js +20 -6
- package/lib/ContextModuleFactory.js +2 -1
- package/lib/ContextReplacementPlugin.js +13 -0
- package/lib/CssModule.js +169 -0
- package/lib/DefinePlugin.js +152 -86
- package/lib/DelegatedModule.js +22 -4
- package/lib/DelegatedModuleFactoryPlugin.js +6 -0
- package/lib/DependenciesBlock.js +17 -1
- package/lib/Dependency.js +19 -5
- package/lib/DllEntryPlugin.js +16 -1
- package/lib/DllModule.js +17 -2
- package/lib/DllModuleFactory.js +1 -1
- package/lib/DllReferencePlugin.js +13 -1
- package/lib/Entrypoint.js +1 -1
- package/lib/ErrorHelpers.js +62 -22
- package/lib/EvalSourceMapDevToolPlugin.js +9 -2
- package/lib/ExportsInfo.js +20 -3
- package/lib/ExportsInfoApiPlugin.js +30 -14
- package/lib/ExternalModule.js +30 -9
- package/lib/FileSystemInfo.js +9 -1
- package/lib/FlagAllModulesAsUsedPlugin.js +27 -27
- package/lib/FlagDependencyExportsPlugin.js +336 -348
- package/lib/FlagDependencyUsagePlugin.js +9 -9
- package/lib/FlagEntryExportAsUsedPlugin.js +26 -23
- package/lib/HookWebpackError.js +1 -1
- package/lib/HotModuleReplacementPlugin.js +60 -46
- package/lib/IgnoreErrorModuleFactory.js +1 -1
- package/lib/InitFragment.js +28 -5
- package/lib/JavascriptMetaInfoPlugin.js +27 -15
- package/lib/LibManifestPlugin.js +22 -5
- package/lib/LoaderOptionsPlugin.js +12 -2
- package/lib/MainTemplate.js +2 -2
- package/lib/Module.js +44 -12
- package/lib/ModuleBuildError.js +9 -0
- package/lib/ModuleDependencyError.js +4 -2
- package/lib/ModuleDependencyWarning.js +4 -2
- package/lib/ModuleError.js +9 -0
- package/lib/ModuleFactory.js +1 -1
- package/lib/ModuleFilenameHelpers.js +114 -4
- package/lib/ModuleGraph.js +33 -23
- package/lib/ModuleGraphConnection.js +19 -6
- package/lib/ModuleInfoHeaderPlugin.js +9 -2
- package/lib/ModuleNotFoundError.js +5 -2
- package/lib/ModuleParseError.js +9 -0
- package/lib/ModuleProfile.js +1 -0
- package/lib/ModuleRestoreError.js +2 -0
- package/lib/ModuleStoreError.js +2 -1
- package/lib/ModuleTypeConstants.js +169 -0
- package/lib/ModuleWarning.js +9 -0
- package/lib/MultiWatching.js +4 -0
- package/lib/NodeStuffPlugin.js +65 -35
- package/lib/NormalModule.js +12 -2
- package/lib/NormalModuleFactory.js +56 -8
- package/lib/NormalModuleReplacementPlugin.js +5 -3
- package/lib/NullFactory.js +1 -1
- package/lib/PrefetchPlugin.js +4 -0
- package/lib/ProgressPlugin.js +71 -15
- package/lib/ProvidePlugin.js +30 -14
- package/lib/RawModule.js +13 -2
- package/lib/RecordIdsPlugin.js +4 -4
- package/lib/RequireJsStuffPlugin.js +22 -15
- package/lib/RuntimeGlobals.js +5 -0
- package/lib/RuntimeModule.js +12 -11
- package/lib/RuntimePlugin.js +10 -3
- package/lib/RuntimeTemplate.js +29 -11
- package/lib/SelfModuleFactory.js +12 -0
- package/lib/SourceMapDevToolModuleOptionsPlugin.js +4 -0
- package/lib/SourceMapDevToolPlugin.js +47 -11
- package/lib/Template.js +5 -3
- package/lib/UseStrictPlugin.js +29 -11
- package/lib/WarnCaseSensitiveModulesPlugin.js +12 -0
- package/lib/WarnDeprecatedOptionPlugin.js +7 -0
- package/lib/WatchIgnorePlugin.js +4 -0
- package/lib/WebpackError.js +14 -5
- package/lib/WebpackIsIncludedPlugin.js +22 -13
- package/lib/WebpackOptionsApply.js +41 -44
- package/lib/WebpackOptionsDefaulter.js +10 -3
- package/lib/asset/AssetGenerator.js +24 -9
- package/lib/asset/AssetModulesPlugin.js +28 -12
- package/lib/asset/AssetParser.js +15 -7
- package/lib/asset/AssetSourceParser.js +8 -3
- package/lib/asset/RawDataUrlModule.js +15 -4
- package/lib/async-modules/AwaitDependenciesInitFragment.js +4 -0
- package/lib/async-modules/InferAsyncModulesPlugin.js +1 -1
- package/lib/cache/IdleFileCachePlugin.js +2 -1
- package/lib/cache/MemoryWithGcCachePlugin.js +2 -0
- package/lib/cache/PackFileCacheStrategy.js +42 -15
- package/lib/cache/ResolverCachePlugin.js +3 -0
- package/lib/config/browserslistTargetHandler.js +10 -10
- package/lib/config/defaults.js +306 -105
- package/lib/config/normalization.js +110 -71
- package/lib/config/target.js +37 -10
- package/lib/container/ContainerEntryModule.js +11 -1
- package/lib/container/ContainerEntryModuleFactory.js +1 -1
- package/lib/container/ContainerExposedDependency.js +9 -0
- package/lib/container/ContainerPlugin.js +3 -1
- package/lib/container/FallbackDependency.js +13 -0
- package/lib/container/FallbackItemDependency.js +3 -0
- package/lib/container/FallbackModule.js +12 -2
- package/lib/container/FallbackModuleFactory.js +1 -1
- package/lib/container/RemoteModule.js +11 -1
- package/lib/container/RemoteRuntimeModule.js +3 -2
- package/lib/container/RemoteToExternalDependency.js +3 -0
- package/lib/css/CssExportsGenerator.js +9 -0
- package/lib/css/CssGenerator.js +5 -1
- package/lib/css/CssLoadingRuntimeModule.js +53 -22
- package/lib/css/CssModulesPlugin.js +253 -74
- package/lib/css/CssParser.js +697 -282
- package/lib/css/walkCssTokens.js +269 -138
- package/lib/debug/ProfilingPlugin.js +33 -12
- package/lib/dependencies/AMDDefineDependency.js +54 -10
- package/lib/dependencies/AMDDefineDependencyParserPlugin.js +13 -2
- package/lib/dependencies/AMDPlugin.js +33 -20
- package/lib/dependencies/AMDRequireArrayDependency.js +13 -0
- package/lib/dependencies/AMDRequireContextDependency.js +15 -0
- package/lib/dependencies/AMDRequireDependenciesBlock.js +6 -0
- package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +8 -2
- package/lib/dependencies/AMDRequireDependency.js +16 -1
- package/lib/dependencies/AMDRequireItemDependency.js +6 -0
- package/lib/dependencies/AMDRuntimeModules.js +2 -2
- package/lib/dependencies/CachedConstDependency.js +14 -0
- package/lib/dependencies/CommonJsDependencyHelpers.js +9 -0
- package/lib/dependencies/CommonJsExportRequireDependency.js +19 -0
- package/lib/dependencies/CommonJsExportsDependency.js +16 -0
- package/lib/dependencies/CommonJsExportsParserPlugin.js +77 -5
- package/lib/dependencies/CommonJsFullRequireDependency.js +10 -1
- package/lib/dependencies/CommonJsImportsParserPlugin.js +174 -63
- package/lib/dependencies/CommonJsPlugin.js +51 -26
- package/lib/dependencies/CommonJsRequireContextDependency.js +17 -0
- package/lib/dependencies/CommonJsRequireDependency.js +7 -0
- package/lib/dependencies/CommonJsSelfReferenceDependency.js +16 -0
- package/lib/dependencies/ConstDependency.js +11 -2
- package/lib/dependencies/ContextDependency.js +15 -2
- package/lib/dependencies/ContextDependencyHelpers.js +3 -3
- package/lib/dependencies/ContextElementDependency.js +8 -0
- package/lib/dependencies/CreateScriptUrlDependency.js +10 -1
- package/lib/dependencies/CriticalDependencyWarning.js +3 -0
- package/lib/dependencies/CssExportDependency.js +8 -0
- package/lib/dependencies/CssImportDependency.js +55 -3
- package/lib/dependencies/CssLocalIdentifierDependency.js +15 -1
- package/lib/dependencies/CssSelfLocalIdentifierDependency.js +10 -1
- package/lib/dependencies/CssUrlDependency.js +46 -16
- package/lib/dependencies/DelegatedSourceDependency.js +3 -0
- package/lib/dependencies/DllEntryDependency.js +14 -0
- package/lib/dependencies/DynamicExports.js +10 -6
- package/lib/dependencies/ExportsInfoDependency.js +25 -4
- package/lib/dependencies/HarmonyAcceptDependency.js +10 -1
- package/lib/dependencies/HarmonyAcceptImportDependency.js +3 -0
- package/lib/dependencies/HarmonyCompatibilityDependency.js +2 -1
- package/lib/dependencies/HarmonyDetectionParserPlugin.js +22 -2
- package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +32 -6
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +5 -0
- package/lib/dependencies/HarmonyExportExpressionDependency.js +20 -3
- package/lib/dependencies/HarmonyExportHeaderDependency.js +13 -0
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +22 -6
- package/lib/dependencies/HarmonyExportInitFragment.js +2 -1
- package/lib/dependencies/HarmonyExportSpecifierDependency.js +12 -0
- package/lib/dependencies/HarmonyExports.js +11 -5
- package/lib/dependencies/HarmonyImportDependency.js +10 -1
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +53 -22
- package/lib/dependencies/HarmonyImportSideEffectDependency.js +7 -2
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +139 -16
- package/lib/dependencies/HarmonyModulesPlugin.js +23 -5
- package/lib/dependencies/HarmonyTopLevelThisParserPlugin.js +15 -3
- package/lib/dependencies/ImportContextDependency.js +15 -0
- package/lib/dependencies/ImportDependency.js +15 -4
- package/lib/dependencies/ImportEagerDependency.js +7 -4
- package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +51 -13
- package/lib/dependencies/ImportMetaContextPlugin.js +18 -5
- package/lib/dependencies/ImportMetaHotAcceptDependency.js +6 -0
- package/lib/dependencies/ImportMetaHotDeclineDependency.js +6 -0
- package/lib/dependencies/ImportMetaPlugin.js +103 -51
- package/lib/dependencies/ImportParserPlugin.js +83 -25
- package/lib/dependencies/ImportPlugin.js +21 -7
- package/lib/dependencies/ImportWeakDependency.js +7 -4
- package/lib/dependencies/JsonExportsDependency.js +9 -1
- package/lib/dependencies/LocalModule.js +16 -0
- package/lib/dependencies/LocalModuleDependency.js +15 -0
- package/lib/dependencies/LocalModulesHelpers.js +18 -0
- package/lib/dependencies/ModuleDecoratorDependency.js +8 -0
- package/lib/dependencies/ModuleDependency.js +9 -1
- package/lib/dependencies/ModuleDependencyTemplateAsId.js +2 -1
- package/lib/dependencies/ModuleHotAcceptDependency.js +6 -0
- package/lib/dependencies/ModuleHotDeclineDependency.js +6 -0
- package/lib/dependencies/PrefetchDependency.js +3 -0
- package/lib/dependencies/ProvidedDependency.js +14 -2
- package/lib/dependencies/PureExpressionDependency.js +10 -1
- package/lib/dependencies/RequireContextDependency.js +6 -0
- package/lib/dependencies/RequireContextDependencyParserPlugin.js +13 -5
- package/lib/dependencies/RequireContextPlugin.js +19 -6
- package/lib/dependencies/RequireEnsureDependenciesBlock.js +7 -0
- package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +6 -1
- package/lib/dependencies/RequireEnsureDependency.js +16 -2
- package/lib/dependencies/RequireEnsureItemDependency.js +3 -0
- package/lib/dependencies/RequireEnsurePlugin.js +27 -7
- package/lib/dependencies/RequireHeaderDependency.js +14 -1
- package/lib/dependencies/RequireIncludeDependency.js +5 -0
- package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +29 -5
- package/lib/dependencies/RequireIncludePlugin.js +25 -5
- package/lib/dependencies/RequireResolveContextDependency.js +17 -0
- package/lib/dependencies/RequireResolveDependency.js +6 -0
- package/lib/dependencies/RequireResolveHeaderDependency.js +18 -0
- package/lib/dependencies/RuntimeRequirementsDependency.js +8 -0
- package/lib/dependencies/StaticExportsDependency.js +8 -0
- package/lib/dependencies/SystemPlugin.js +48 -21
- package/lib/dependencies/SystemRuntimeModule.js +1 -1
- package/lib/dependencies/URLDependency.js +13 -4
- package/lib/dependencies/URLPlugin.js +31 -18
- package/lib/dependencies/UnsupportedDependency.js +13 -0
- package/lib/dependencies/WebAssemblyExportImportedDependency.js +14 -0
- package/lib/dependencies/WebAssemblyImportDependency.js +9 -1
- package/lib/dependencies/WebpackIsIncludedDependency.js +5 -0
- package/lib/dependencies/WorkerDependency.js +47 -3
- package/lib/dependencies/WorkerPlugin.js +105 -32
- package/lib/dependencies/getFunctionExpression.js +7 -0
- package/lib/esm/ExportWebpackRequireRuntimeModule.js +3 -2
- package/lib/esm/ModuleChunkFormatPlugin.js +21 -8
- package/lib/esm/ModuleChunkLoadingPlugin.js +9 -0
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +19 -12
- package/lib/hmr/HotModuleReplacementRuntimeModule.js +1 -1
- package/lib/hmr/LazyCompilationPlugin.js +14 -5
- package/lib/ids/ChunkModuleIdRangePlugin.js +11 -0
- package/lib/ids/DeterministicChunkIdsPlugin.js +11 -2
- package/lib/ids/DeterministicModuleIdsPlugin.js +11 -7
- package/lib/ids/HashedModuleIdsPlugin.js +9 -2
- package/lib/ids/IdHelpers.js +6 -0
- package/lib/ids/NamedChunkIdsPlugin.js +13 -1
- package/lib/ids/NamedModuleIdsPlugin.js +14 -3
- package/lib/ids/OccurrenceChunkIdsPlugin.js +6 -2
- package/lib/ids/OccurrenceModuleIdsPlugin.js +1 -1
- package/lib/ids/SyncModuleIdsPlugin.js +3 -2
- package/lib/index.js +8 -0
- package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +3 -3
- package/lib/javascript/BasicEvaluatedExpression.js +137 -11
- package/lib/javascript/ChunkHelpers.js +2 -2
- package/lib/javascript/CommonJsChunkFormatPlugin.js +7 -3
- package/lib/javascript/EnableChunkLoadingPlugin.js +4 -0
- package/lib/javascript/JavascriptModulesPlugin.js +194 -194
- package/lib/javascript/JavascriptParser.js +941 -256
- package/lib/javascript/JavascriptParserHelpers.js +37 -15
- package/lib/javascript/StartupHelpers.js +2 -2
- package/lib/json/JsonData.js +26 -1
- package/lib/json/JsonGenerator.js +21 -7
- package/lib/json/JsonModulesPlugin.js +14 -5
- package/lib/json/JsonParser.js +27 -13
- package/lib/library/AbstractLibraryPlugin.js +4 -0
- package/lib/library/AmdLibraryPlugin.js +22 -6
- package/lib/library/AssignLibraryPlugin.js +6 -4
- package/lib/library/ExportPropertyLibraryPlugin.js +4 -1
- package/lib/library/ModuleLibraryPlugin.js +8 -4
- package/lib/library/SystemLibraryPlugin.js +1 -0
- package/lib/library/UmdLibraryPlugin.js +4 -0
- package/lib/logging/runtime.js +1 -1
- package/lib/logging/truncateArgs.js +4 -0
- package/lib/node/CommonJsChunkLoadingPlugin.js +17 -2
- package/lib/node/NodeTargetPlugin.js +3 -0
- package/lib/node/NodeTemplatePlugin.js +10 -2
- package/lib/node/NodeWatchFileSystem.js +1 -1
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +18 -9
- package/lib/node/ReadFileCompileAsyncWasmPlugin.js +12 -2
- package/lib/node/ReadFileCompileWasmPlugin.js +21 -3
- package/lib/node/RequireChunkLoadingRuntimeModule.js +15 -8
- package/lib/node/nodeConsole.js +2 -4
- package/lib/optimize/AggressiveMergingPlugin.js +8 -0
- package/lib/optimize/AggressiveSplittingPlugin.js +9 -2
- package/lib/optimize/ConcatenatedModule.js +8 -6
- package/lib/optimize/EnsureChunkConditionsPlugin.js +3 -0
- package/lib/optimize/FlagIncludedChunksPlugin.js +11 -5
- package/lib/optimize/InnerGraph.js +5 -5
- package/lib/optimize/InnerGraphPlugin.js +57 -48
- package/lib/optimize/LimitChunkCountPlugin.js +29 -4
- package/lib/optimize/MangleExportsPlugin.js +1 -1
- package/lib/optimize/MinMaxSizeWarning.js +5 -0
- package/lib/optimize/ModuleConcatenationPlugin.js +59 -2
- package/lib/optimize/RealContentHashPlugin.js +86 -30
- package/lib/optimize/RemoveParentModulesPlugin.js +6 -0
- package/lib/optimize/RuntimeChunkPlugin.js +9 -1
- package/lib/optimize/SideEffectsFlagPlugin.js +53 -44
- package/lib/optimize/SplitChunksPlugin.js +71 -31
- package/lib/performance/SizeLimitsPlugin.js +7 -4
- package/lib/prefetch/ChunkPrefetchFunctionRuntimeModule.js +4 -2
- package/lib/prefetch/ChunkPrefetchPreloadPlugin.js +3 -1
- package/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js +6 -3
- package/lib/prefetch/ChunkPrefetchTriggerRuntimeModule.js +4 -2
- package/lib/prefetch/ChunkPreloadTriggerRuntimeModule.js +4 -2
- package/lib/rules/BasicEffectRulePlugin.js +4 -0
- package/lib/rules/BasicMatcherRulePlugin.js +5 -0
- package/lib/rules/RuleSetCompiler.js +3 -3
- package/lib/rules/UseEffectRulePlugin.js +6 -4
- package/lib/runtime/AsyncModuleRuntimeModule.js +9 -6
- package/lib/runtime/AutoPublicPathRuntimeModule.js +16 -5
- package/lib/runtime/BaseUriRuntimeModule.js +8 -4
- package/lib/runtime/ChunkNameRuntimeModule.js +1 -1
- package/lib/runtime/CompatGetDefaultExportRuntimeModule.js +5 -2
- package/lib/runtime/CompatRuntimeModule.js +7 -2
- package/lib/runtime/CreateFakeNamespaceObjectRuntimeModule.js +5 -2
- package/lib/runtime/CreateScriptRuntimeModule.js +4 -2
- package/lib/runtime/CreateScriptUrlRuntimeModule.js +4 -2
- package/lib/runtime/DefinePropertyGettersRuntimeModule.js +5 -2
- package/lib/runtime/EnsureChunkRuntimeModule.js +18 -4
- package/lib/runtime/GetChunkFilenameRuntimeModule.js +45 -26
- package/lib/runtime/GetFullHashRuntimeModule.js +4 -3
- package/lib/runtime/GetMainFilenameRuntimeModule.js +5 -2
- package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +27 -6
- package/lib/runtime/GlobalRuntimeModule.js +1 -1
- package/lib/runtime/HasOwnPropertyRuntimeModule.js +5 -2
- package/lib/runtime/LoadScriptRuntimeModule.js +65 -50
- package/lib/runtime/MakeNamespaceObjectRuntimeModule.js +5 -2
- package/lib/runtime/NonceRuntimeModule.js +1 -1
- package/lib/runtime/OnChunksLoadedRuntimeModule.js +4 -2
- package/lib/runtime/PublicPathRuntimeModule.js +9 -2
- package/lib/runtime/RelativeUrlRuntimeModule.js +5 -2
- package/lib/runtime/RuntimeIdRuntimeModule.js +6 -2
- package/lib/runtime/StartupChunkDependenciesPlugin.js +15 -0
- package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +13 -4
- package/lib/runtime/StartupEntrypointRuntimeModule.js +11 -7
- package/lib/runtime/SystemContextRuntimeModule.js +1 -1
- package/lib/schemes/DataUriPlugin.js +16 -3
- package/lib/schemes/HttpUriPlugin.js +38 -0
- package/lib/serialization/ArraySerializer.js +22 -6
- package/lib/serialization/BinaryMiddleware.js +164 -1
- package/lib/serialization/DateObjectSerializer.js +15 -4
- package/lib/serialization/ErrorObjectSerializer.js +23 -8
- package/lib/serialization/FileMiddleware.js +17 -0
- package/lib/serialization/MapObjectSerializer.js +24 -8
- package/lib/serialization/NullPrototypeObjectSerializer.js +25 -8
- package/lib/serialization/ObjectMiddleware.js +33 -2
- package/lib/serialization/PlainObjectSerializer.js +23 -12
- package/lib/serialization/RegExpObjectSerializer.js +16 -5
- package/lib/serialization/SetObjectSerializer.js +21 -6
- package/lib/serialization/types.js +1 -1
- package/lib/sharing/ConsumeSharedFallbackDependency.js +3 -0
- package/lib/sharing/ConsumeSharedModule.js +13 -2
- package/lib/sharing/ConsumeSharedPlugin.js +4 -0
- package/lib/sharing/ConsumeSharedRuntimeModule.js +22 -7
- package/lib/sharing/ProvideSharedDependency.js +17 -0
- package/lib/sharing/ProvideSharedModule.js +11 -1
- package/lib/sharing/ProvideSharedModuleFactory.js +1 -1
- package/lib/sharing/ProvideSharedPlugin.js +22 -21
- package/lib/sharing/ShareRuntimeModule.js +19 -9
- package/lib/sharing/resolveMatchedConfigs.js +1 -1
- package/lib/sharing/utils.js +320 -7
- package/lib/stats/DefaultStatsFactoryPlugin.js +105 -29
- package/lib/stats/DefaultStatsPresetPlugin.js +9 -0
- package/lib/stats/DefaultStatsPrinterPlugin.js +43 -0
- package/lib/util/AsyncQueue.js +4 -2
- package/lib/util/LazySet.js +10 -2
- package/lib/util/MapHelpers.js +19 -5
- package/lib/util/ParallelismFactorCalculator.js +10 -0
- package/lib/util/Semaphore.js +1 -1
- package/lib/util/StackedCacheMap.js +6 -0
- package/lib/util/StringXor.js +51 -0
- package/lib/util/binarySearchBounds.js +49 -0
- package/lib/util/compileBooleanMatcher.js +31 -0
- package/lib/util/createHash.js +35 -13
- package/lib/util/deprecation.js +18 -3
- package/lib/util/deterministicGrouping.js +50 -11
- package/lib/util/findGraphRoots.js +4 -2
- package/lib/util/hash/md4.js +2 -2
- package/lib/util/hash/xxhash64.js +1 -1
- package/lib/util/identifier.js +4 -0
- package/lib/util/internalSerializables.js +1 -0
- package/lib/util/makeSerializable.js +7 -0
- package/lib/util/memoize.js +3 -3
- package/lib/util/numberHash.js +75 -21
- package/lib/util/processAsyncTree.js +7 -1
- package/lib/util/propertyAccess.js +9 -54
- package/lib/util/propertyName.js +79 -0
- package/lib/util/registerExternalSerializer.js +1 -1
- package/lib/util/runtime.js +14 -1
- package/lib/util/semver.js +1 -1
- package/lib/util/serialization.js +10 -0
- package/lib/util/smartGrouping.js +1 -1
- package/lib/validateSchema.js +6 -2
- package/lib/wasm/EnableWasmLoadingPlugin.js +4 -0
- package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +15 -2
- package/lib/wasm-async/AsyncWebAssemblyGenerator.js +9 -1
- package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +14 -3
- package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +28 -8
- package/lib/wasm-async/AsyncWebAssemblyParser.js +11 -4
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +39 -8
- package/lib/wasm-sync/WasmFinalizeExportsPlugin.js +17 -6
- package/lib/wasm-sync/WebAssemblyGenerator.js +19 -5
- package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +1 -1
- package/lib/wasm-sync/WebAssemblyModulesPlugin.js +53 -43
- package/lib/wasm-sync/WebAssemblyParser.js +15 -4
- package/lib/wasm-sync/WebAssemblyUtils.js +1 -1
- package/lib/web/FetchCompileAsyncWasmPlugin.js +11 -1
- package/lib/web/FetchCompileWasmPlugin.js +59 -42
- package/lib/web/JsonpChunkLoadingPlugin.js +9 -0
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +26 -9
- package/lib/webpack.js +12 -3
- package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +9 -0
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +20 -17
- package/module.d.ts +55 -37
- package/package.json +59 -56
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +132 -5
- package/schemas/plugins/ProgressPlugin.check.js +1 -1
- package/schemas/plugins/SourceMapDevToolPlugin.check.js +1 -1
- package/schemas/plugins/SourceMapDevToolPlugin.json +4 -0
- package/schemas/plugins/container/ContainerPlugin.check.js +1 -1
- package/schemas/plugins/container/ContainerPlugin.json +8 -0
- package/schemas/plugins/container/ModuleFederationPlugin.check.js +1 -1
- package/schemas/plugins/container/ModuleFederationPlugin.json +8 -0
- package/schemas/plugins/css/CssGeneratorOptions.json +1 -1
- package/schemas/plugins/css/CssParserOptions.json +1 -1
- package/schemas/plugins/sharing/SharePlugin.check.js +1 -1
- package/types.d.ts +1608 -667
package/lib/util/deprecation.js
CHANGED
@@ -78,7 +78,7 @@ exports.arrayToSetDeprecation = (set, name) => {
|
|
78
78
|
);
|
79
79
|
/**
|
80
80
|
* @deprecated
|
81
|
-
* @this {Set}
|
81
|
+
* @this {Set<any>}
|
82
82
|
* @returns {number} count
|
83
83
|
*/
|
84
84
|
set[method] = function () {
|
@@ -101,7 +101,7 @@ exports.arrayToSetDeprecation = (set, name) => {
|
|
101
101
|
);
|
102
102
|
/**
|
103
103
|
* @deprecated
|
104
|
-
* @this {Set}
|
104
|
+
* @this {Set<any>}
|
105
105
|
* @returns {number} count
|
106
106
|
*/
|
107
107
|
set.push = function () {
|
@@ -119,9 +119,13 @@ exports.arrayToSetDeprecation = (set, name) => {
|
|
119
119
|
);
|
120
120
|
};
|
121
121
|
}
|
122
|
+
/**
|
123
|
+
* @param {number} index index
|
124
|
+
* @returns {any} value
|
125
|
+
*/
|
122
126
|
const createIndexGetter = index => {
|
123
127
|
/**
|
124
|
-
* @this {Set} a Set
|
128
|
+
* @this {Set<any>} a Set
|
125
129
|
* @returns {any} the value at this location
|
126
130
|
*/
|
127
131
|
const fn = function () {
|
@@ -134,6 +138,9 @@ exports.arrayToSetDeprecation = (set, name) => {
|
|
134
138
|
};
|
135
139
|
return fn;
|
136
140
|
};
|
141
|
+
/**
|
142
|
+
* @param {number} index index
|
143
|
+
*/
|
137
144
|
const defineIndexGetter = index => {
|
138
145
|
Object.defineProperty(set, index, {
|
139
146
|
get: createIndexGetter(index),
|
@@ -178,6 +185,14 @@ exports.createArrayToSetDeprecationSet = name => {
|
|
178
185
|
return SetDeprecatedArray;
|
179
186
|
};
|
180
187
|
|
188
|
+
/**
|
189
|
+
* @template T
|
190
|
+
* @param {Object} obj object
|
191
|
+
* @param {string} name property name
|
192
|
+
* @param {string} code deprecation code
|
193
|
+
* @param {string} note additional note
|
194
|
+
* @returns {Object} frozen object with deprecation when modifying
|
195
|
+
*/
|
181
196
|
exports.soonFrozenObjectDeprecation = (obj, name, code, note = "") => {
|
182
197
|
const message = `${name} will be frozen in future, all modifications are deprecated.${
|
183
198
|
note && `\n${note}`
|
@@ -94,7 +94,8 @@ const subtractSizeFrom = (total, size) => {
|
|
94
94
|
};
|
95
95
|
|
96
96
|
/**
|
97
|
-
* @
|
97
|
+
* @template T
|
98
|
+
* @param {Iterable<Node<T>>} nodes some nodes
|
98
99
|
* @returns {Record<string, number>} total size
|
99
100
|
*/
|
100
101
|
const sumSize = nodes => {
|
@@ -105,6 +106,11 @@ const sumSize = nodes => {
|
|
105
106
|
return sum;
|
106
107
|
};
|
107
108
|
|
109
|
+
/**
|
110
|
+
* @param {Record<string, number>} size size
|
111
|
+
* @param {Record<string, number>} maxSize minimum size
|
112
|
+
* @returns {boolean} true, when size is too big
|
113
|
+
*/
|
108
114
|
const isTooBig = (size, maxSize) => {
|
109
115
|
for (const key of Object.keys(size)) {
|
110
116
|
const s = size[key];
|
@@ -117,6 +123,11 @@ const isTooBig = (size, maxSize) => {
|
|
117
123
|
return false;
|
118
124
|
};
|
119
125
|
|
126
|
+
/**
|
127
|
+
* @param {Record<string, number>} size size
|
128
|
+
* @param {Record<string, number>} minSize minimum size
|
129
|
+
* @returns {boolean} true, when size is too small
|
130
|
+
*/
|
120
131
|
const isTooSmall = (size, minSize) => {
|
121
132
|
for (const key of Object.keys(size)) {
|
122
133
|
const s = size[key];
|
@@ -129,6 +140,11 @@ const isTooSmall = (size, minSize) => {
|
|
129
140
|
return false;
|
130
141
|
};
|
131
142
|
|
143
|
+
/**
|
144
|
+
* @param {Record<string, number>} size size
|
145
|
+
* @param {Record<string, number>} minSize minimum size
|
146
|
+
* @returns {Set<string>} set of types that are too small
|
147
|
+
*/
|
132
148
|
const getTooSmallTypes = (size, minSize) => {
|
133
149
|
const types = new Set();
|
134
150
|
for (const key of Object.keys(size)) {
|
@@ -142,6 +158,12 @@ const getTooSmallTypes = (size, minSize) => {
|
|
142
158
|
return types;
|
143
159
|
};
|
144
160
|
|
161
|
+
/**
|
162
|
+
* @template T
|
163
|
+
* @param {TODO} size size
|
164
|
+
* @param {Set<string>} types types
|
165
|
+
* @returns {number} number of matching size types
|
166
|
+
*/
|
145
167
|
const getNumberOfMatchingSizeTypes = (size, types) => {
|
146
168
|
let i = 0;
|
147
169
|
for (const key of Object.keys(size)) {
|
@@ -150,6 +172,11 @@ const getNumberOfMatchingSizeTypes = (size, types) => {
|
|
150
172
|
return i;
|
151
173
|
};
|
152
174
|
|
175
|
+
/**
|
176
|
+
* @param {Record<string, number>} size size
|
177
|
+
* @param {Set<string>} types types
|
178
|
+
* @returns {number} selective size sum
|
179
|
+
*/
|
153
180
|
const selectiveSizeSum = (size, types) => {
|
154
181
|
let sum = 0;
|
155
182
|
for (const key of Object.keys(size)) {
|
@@ -180,20 +207,20 @@ class Node {
|
|
180
207
|
class Group {
|
181
208
|
/**
|
182
209
|
* @param {Node<T>[]} nodes nodes
|
183
|
-
* @param {number[]} similarities similarities between the nodes (length = nodes.length - 1)
|
210
|
+
* @param {number[] | null} similarities similarities between the nodes (length = nodes.length - 1)
|
184
211
|
* @param {Record<string, number>=} size size of the group
|
185
212
|
*/
|
186
213
|
constructor(nodes, similarities, size) {
|
187
214
|
this.nodes = nodes;
|
188
215
|
this.similarities = similarities;
|
189
216
|
this.size = size || sumSize(nodes);
|
190
|
-
/** @type {string} */
|
217
|
+
/** @type {string | undefined} */
|
191
218
|
this.key = undefined;
|
192
219
|
}
|
193
220
|
|
194
221
|
/**
|
195
|
-
* @param {function(Node): boolean} filter filter function
|
196
|
-
* @returns {Node[]} removed nodes
|
222
|
+
* @param {function(Node<T>): boolean} filter filter function
|
223
|
+
* @returns {Node<T>[] | undefined} removed nodes
|
197
224
|
*/
|
198
225
|
popNodes(filter) {
|
199
226
|
const newNodes = [];
|
@@ -208,7 +235,7 @@ class Group {
|
|
208
235
|
if (newNodes.length > 0) {
|
209
236
|
newSimilarities.push(
|
210
237
|
lastNode === this.nodes[i - 1]
|
211
|
-
? this.similarities[i - 1]
|
238
|
+
? /** @type {number[]} */ (this.similarities)[i - 1]
|
212
239
|
: similarity(lastNode.key, node.key)
|
213
240
|
);
|
214
241
|
}
|
@@ -225,7 +252,8 @@ class Group {
|
|
225
252
|
}
|
226
253
|
|
227
254
|
/**
|
228
|
-
* @
|
255
|
+
* @template T
|
256
|
+
* @param {Iterable<Node<T>>} nodes nodes
|
229
257
|
* @returns {number[]} similarities
|
230
258
|
*/
|
231
259
|
const getSimilarities = nodes => {
|
@@ -297,6 +325,11 @@ module.exports = ({ maxSize, minSize, items, getSize, getKey }) => {
|
|
297
325
|
if (initialNodes.length > 0) {
|
298
326
|
const initialGroup = new Group(initialNodes, getSimilarities(initialNodes));
|
299
327
|
|
328
|
+
/**
|
329
|
+
* @param {Group<T>} group group
|
330
|
+
* @param {Record<string, number>} consideredSize size of the group to consider
|
331
|
+
* @returns {boolean} true, if the group was modified
|
332
|
+
*/
|
300
333
|
const removeProblematicNodes = (group, consideredSize = group.size) => {
|
301
334
|
const problemTypes = getTooSmallTypes(consideredSize, minSize);
|
302
335
|
if (problemTypes.size > 0) {
|
@@ -347,7 +380,7 @@ module.exports = ({ maxSize, minSize, items, getSize, getKey }) => {
|
|
347
380
|
const queue = [initialGroup];
|
348
381
|
|
349
382
|
while (queue.length) {
|
350
|
-
const group = queue.pop();
|
383
|
+
const group = /** @type {Group<T>} */ (queue.pop());
|
351
384
|
// only groups bigger than maxSize need to be splitted
|
352
385
|
if (!isTooBig(group.size, maxSize)) {
|
353
386
|
result.push(group);
|
@@ -428,7 +461,9 @@ module.exports = ({ maxSize, minSize, items, getSize, getKey }) => {
|
|
428
461
|
// rightSize ^^^^^^^^^^^^^^^
|
429
462
|
|
430
463
|
while (pos <= right + 1) {
|
431
|
-
const similarity = group.similarities[
|
464
|
+
const similarity = /** @type {number[]} */ (group.similarities)[
|
465
|
+
pos - 1
|
466
|
+
];
|
432
467
|
if (
|
433
468
|
similarity < bestSimilarity &&
|
434
469
|
!isTooSmall(leftSize, minSize) &&
|
@@ -458,7 +493,9 @@ module.exports = ({ maxSize, minSize, items, getSize, getKey }) => {
|
|
458
493
|
/** @type {number[]} */
|
459
494
|
const rightSimilarities = [];
|
460
495
|
for (let i = right + 2; i < group.nodes.length; i++) {
|
461
|
-
rightSimilarities.push(
|
496
|
+
rightSimilarities.push(
|
497
|
+
/** @type {number[]} */ (group.similarities)[i - 1]
|
498
|
+
);
|
462
499
|
rightNodes.push(group.nodes[i]);
|
463
500
|
}
|
464
501
|
queue.push(new Group(rightNodes, rightSimilarities));
|
@@ -467,7 +504,9 @@ module.exports = ({ maxSize, minSize, items, getSize, getKey }) => {
|
|
467
504
|
/** @type {number[]} */
|
468
505
|
const leftSimilarities = [];
|
469
506
|
for (let i = 1; i < left; i++) {
|
470
|
-
leftSimilarities.push(
|
507
|
+
leftSimilarities.push(
|
508
|
+
/** @type {number[]} */ (group.similarities)[i - 1]
|
509
|
+
);
|
471
510
|
leftNodes.push(group.nodes[i]);
|
472
511
|
}
|
473
512
|
queue.push(new Group(leftNodes, leftSimilarities));
|
@@ -109,7 +109,9 @@ module.exports = (items, getDependencies) => {
|
|
109
109
|
// Are there still edges unprocessed in the current node?
|
110
110
|
if (topOfStack.openEdges.length > 0) {
|
111
111
|
// Process one dependency
|
112
|
-
const dependency =
|
112
|
+
const dependency =
|
113
|
+
/** @type {Node<T>} */
|
114
|
+
(topOfStack.openEdges.pop());
|
113
115
|
switch (dependency.marker) {
|
114
116
|
case NO_MARKER:
|
115
117
|
// dependency has not be visited yet
|
@@ -169,7 +171,7 @@ module.exports = (items, getDependencies) => {
|
|
169
171
|
// so it's not really a root cycle
|
170
172
|
// remove the cycle from the root cycles
|
171
173
|
// and convert it to a normal node
|
172
|
-
rootCycles.delete(dependency.cycle);
|
174
|
+
rootCycles.delete(/** @type {Cycle<T>} */ (dependency.cycle));
|
173
175
|
dependency.marker = DONE_MARKER;
|
174
176
|
break;
|
175
177
|
// DONE_MARKER: nothing to do, don't recurse into dependencies
|
package/lib/util/hash/md4.js
CHANGED
@@ -10,8 +10,8 @@ const create = require("./wasm-hash");
|
|
10
10
|
//#region wasm code: md4 (../../../assembly/hash/md4.asm.ts) --initialMemory 1
|
11
11
|
const md4 = new WebAssembly.Module(
|
12
12
|
Buffer.from(
|
13
|
-
//
|
14
|
-
"AGFzbQEAAAABCAJgAX8AYAAAAwUEAQAAAAUDAQABBhoFfwFBAAt/AUEAC38BQQALfwFBAAt/
|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gBDcDACACEAFBACMBrSIEQv//A4MgBEKAgPz/D4NCEIaEIgRC/4GAgPAfgyAEQoD+g4CA4D+DQgiGhCIEQo+AvIDwgcAHg0IIhiAEQvCBwIeAnoD4AINCBIiEIgRChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IARCsODAgYOGjJgwhHw3AwBBCCMCrSIEQv//A4MgBEKAgPz/D4NCEIaEIgRC/4GAgPAfgyAEQoD+g4CA4D+DQgiGhCIEQo+AvIDwgcAHg0IIhiAEQvCBwIeAnoD4AINCBIiEIgRChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IARCsODAgYOGjJgwhHw3AwBBECMDrSIEQv//A4MgBEKAgPz/D4NCEIaEIgRC/4GAgPAfgyAEQoD+g4CA4D+DQgiGhCIEQo+AvIDwgcAHg0IIhiAEQvCBwIeAnoD4AINCBIiEIgRChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IARCsODAgYOGjJgwhHw3AwBBGCMErSIEQv//A4MgBEKAgPz/D4NCEIaEIgRC/4GAgPAfgyAEQoD+g4CA4D+DQgiGhCIEQo+AvIDwgcAHg0IIhiAEQvCBwIeAnoD4AINCBIiEIgRChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IARCsODAgYOGjJgwhHw3AwAL",
|
15
15
|
"base64"
|
16
16
|
)
|
17
17
|
);
|
@@ -11,7 +11,7 @@ const create = require("./wasm-hash");
|
|
11
11
|
const xxhash64 = new WebAssembly.Module(
|
12
12
|
Buffer.from(
|
13
13
|
// 1170 bytes
|
14
|
-
"AGFzbQEAAAABCAJgAX8AYAAAAwQDAQAABQMBAAEGGgV+AUIAC34BQgALfgFCAAt+AUIAC34BQgALByIEBGluaXQAAAZ1cGRhdGUAAQVmaW5hbAACBm1lbW9yeQIACrIIAzAAQtbrgu7q/Yn14AAkAELP1tO+0ser2UIkAUIAJAJC+erQ0OfJoeThACQDQgAkBAvUAQIBfwR+IABFBEAPCyMEIACtfCQEIwAhAiMB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Wvr5i23puef36FQhuJQoeVr6+Ytt6bnn9+Qp2jteqDsY2K+gB9IQIgAUEIaiEBDAELCyABQQRqIABNBEAgAiABNQIAQoeVr6+Ytt6bnn9+hUIXiULP1tO+0ser2UJ+Qvnz3fGZ9pmrFnwhAiABQQRqIQELA0AgACABRwRAIAIgATEAAELFz9my8eW66id+hUILiUKHla+vmLbem55/fiECIAFBAWohAQwBCwtBACACIAJCIYiFQs/W077Sx6vZQn4iAkIdiCAChUL5893xmfaZqxZ+IgJCIIggAoUiAkIgiCIDQv//A4NCIIYgA0KAgPz/D4NCEIiEIgNC/4GAgPAfg0IQhiADQoD+g4CA4D+DQgiIhCIDQo+AvIDwgcAHg0IIhiADQvCBwIeAnoD4AINCBIiEIgNChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IANCsODAgYOGjJgwhHw3AwBBCCACQv////8PgyICQv//A4NCIIYgAkKAgPz/D4NCEIiEIgJC/4GAgPAfg0IQhiACQoD+g4CA4D+DQgiIhCICQo+AvIDwgcAHg0IIhiACQvCBwIeAnoD4AINCBIiEIgJChoyYsODAgYMGfEIEiEKBgoSIkKDAgAGDQid+IAJCsODAgYOGjJgwhHw3AwAL",
|
15
15
|
"base64"
|
16
16
|
)
|
17
17
|
);
|
package/lib/util/identifier.js
CHANGED
@@ -15,6 +15,10 @@ const WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g;
|
|
15
15
|
* @property {Map<string, Map<string, string>>=} relativePaths
|
16
16
|
*/
|
17
17
|
|
18
|
+
/**
|
19
|
+
* @param {string} relativePath relative path
|
20
|
+
* @returns {string} request
|
21
|
+
*/
|
18
22
|
const relativePathToRequest = relativePath => {
|
19
23
|
if (relativePath === "") return "./.";
|
20
24
|
if (relativePath === "..") return "../.";
|
@@ -189,6 +189,7 @@ module.exports = {
|
|
189
189
|
ModuleParseError: () => require("../ModuleParseError"),
|
190
190
|
ModuleWarning: () => require("../ModuleWarning"),
|
191
191
|
NormalModule: () => require("../NormalModule"),
|
192
|
+
CssModule: () => require("../CssModule"),
|
192
193
|
RawDataUrlModule: () => require("../asset/RawDataUrlModule"),
|
193
194
|
RawModule: () => require("../RawModule"),
|
194
195
|
"sharing/ConsumeSharedModule": () =>
|
@@ -6,6 +6,8 @@
|
|
6
6
|
|
7
7
|
const { register } = require("./serialization");
|
8
8
|
|
9
|
+
/** @typedef {import("../serialization/ObjectMiddleware").Constructor} Constructor */
|
10
|
+
|
9
11
|
class ClassSerializer {
|
10
12
|
constructor(Constructor) {
|
11
13
|
this.Constructor = Constructor;
|
@@ -25,6 +27,11 @@ class ClassSerializer {
|
|
25
27
|
}
|
26
28
|
}
|
27
29
|
|
30
|
+
/**
|
31
|
+
* @param {Constructor} Constructor the constructor
|
32
|
+
* @param {string} request the request which will be required when deserializing
|
33
|
+
* @param {string | null} [name] the name to make multiple serializer unique when sharing a request
|
34
|
+
*/
|
28
35
|
module.exports = (Constructor, request, name = null) => {
|
29
36
|
register(Constructor, request, name, new ClassSerializer(Constructor));
|
30
37
|
};
|
package/lib/util/memoize.js
CHANGED
@@ -13,18 +13,18 @@
|
|
13
13
|
*/
|
14
14
|
const memoize = fn => {
|
15
15
|
let cache = false;
|
16
|
-
/** @type {T} */
|
16
|
+
/** @type {T | undefined} */
|
17
17
|
let result = undefined;
|
18
18
|
return () => {
|
19
19
|
if (cache) {
|
20
|
-
return result;
|
20
|
+
return /** @type {T} */ (result);
|
21
21
|
} else {
|
22
22
|
result = fn();
|
23
23
|
cache = true;
|
24
24
|
// Allow to clean up memory for fn
|
25
25
|
// and all dependent resources
|
26
26
|
fn = undefined;
|
27
|
-
return result;
|
27
|
+
return /** @type {T} */ (result);
|
28
28
|
}
|
29
29
|
};
|
30
30
|
};
|
package/lib/util/numberHash.js
CHANGED
@@ -5,41 +5,95 @@
|
|
5
5
|
|
6
6
|
"use strict";
|
7
7
|
|
8
|
+
/**
|
9
|
+
* The maximum safe integer value for 32-bit integers.
|
10
|
+
* @type {number}
|
11
|
+
*/
|
8
12
|
const SAFE_LIMIT = 0x80000000;
|
13
|
+
|
14
|
+
/**
|
15
|
+
* The maximum safe integer value for 32-bit integers minus one. This is used
|
16
|
+
* in the algorithm to ensure that intermediate hash values do not exceed the
|
17
|
+
* 32-bit integer limit.
|
18
|
+
* @type {number}
|
19
|
+
*/
|
9
20
|
const SAFE_PART = SAFE_LIMIT - 1;
|
21
|
+
|
22
|
+
/**
|
23
|
+
* The number of 32-bit integers used to store intermediate hash values.
|
24
|
+
* @type {number}
|
25
|
+
*/
|
10
26
|
const COUNT = 4;
|
27
|
+
|
28
|
+
/**
|
29
|
+
* An array used to store intermediate hash values during the calculation.
|
30
|
+
* @type {number[]}
|
31
|
+
*/
|
11
32
|
const arr = [0, 0, 0, 0, 0];
|
33
|
+
|
34
|
+
/**
|
35
|
+
* An array of prime numbers used in the hash calculation.
|
36
|
+
* @type {number[]}
|
37
|
+
*/
|
12
38
|
const primes = [3, 7, 17, 19];
|
13
39
|
|
40
|
+
/**
|
41
|
+
* Computes a hash value for the given string and range. This hashing algorithm is a modified
|
42
|
+
* version of the [FNV-1a algorithm](https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function).
|
43
|
+
* It is optimized for speed and does **not** generate a cryptographic hash value.
|
44
|
+
*
|
45
|
+
* We use `numberHash` in `lib/ids/IdHelpers.js` to generate hash values for the module identifier. The generated
|
46
|
+
* hash is used as a prefix for the module id's to avoid collisions with other modules.
|
47
|
+
*
|
48
|
+
* @param {string} str The input string to hash.
|
49
|
+
* @param {number} range The range of the hash value (0 to range-1).
|
50
|
+
* @returns {number} - The computed hash value.
|
51
|
+
*
|
52
|
+
* @example
|
53
|
+
*
|
54
|
+
* ```js
|
55
|
+
* const numberHash = require("webpack/lib/util/numberHash");
|
56
|
+
* numberHash("hello", 1000); // 57
|
57
|
+
* numberHash("hello world"); // 990
|
58
|
+
* ```
|
59
|
+
*
|
60
|
+
*/
|
14
61
|
module.exports = (str, range) => {
|
62
|
+
/**
|
63
|
+
* Initialize the array with zeros before it is used
|
64
|
+
* to store intermediate hash values.
|
65
|
+
*/
|
15
66
|
arr.fill(0);
|
67
|
+
// For each character in the string
|
16
68
|
for (let i = 0; i < str.length; i++) {
|
69
|
+
// Get the character code.
|
17
70
|
const c = str.charCodeAt(i);
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
71
|
+
|
72
|
+
// For each 32-bit integer used to store the hash value
|
73
|
+
// add the character code to the current hash value and multiply by the prime number and
|
74
|
+
// add the previous 32-bit integer.
|
75
|
+
arr[0] = (arr[0] + c * primes[0] + arr[3]) & SAFE_PART;
|
76
|
+
arr[1] = (arr[1] + c * primes[1] + arr[0]) & SAFE_PART;
|
77
|
+
arr[2] = (arr[2] + c * primes[2] + arr[1]) & SAFE_PART;
|
78
|
+
arr[3] = (arr[3] + c * primes[3] + arr[2]) & SAFE_PART;
|
79
|
+
|
80
|
+
// For each 32-bit integer used to store the hash value
|
81
|
+
// XOR the current hash value with the value of the next 32-bit integer.
|
82
|
+
arr[0] = arr[0] ^ (arr[arr[0] % COUNT] >> 1);
|
83
|
+
arr[1] = arr[1] ^ (arr[arr[1] % COUNT] >> 1);
|
84
|
+
arr[2] = arr[2] ^ (arr[arr[2] % COUNT] >> 1);
|
85
|
+
arr[3] = arr[3] ^ (arr[arr[3] % COUNT] >> 1);
|
26
86
|
}
|
87
|
+
|
27
88
|
if (range <= SAFE_PART) {
|
28
|
-
|
29
|
-
for (let j = 0; j < COUNT; j++) {
|
30
|
-
sum = (sum + arr[j]) % range;
|
31
|
-
}
|
32
|
-
return sum;
|
89
|
+
return (arr[0] + arr[1] + arr[2] + arr[3]) % range;
|
33
90
|
} else {
|
34
|
-
|
35
|
-
let sum2 = 0;
|
91
|
+
// Calculate the range extension.
|
36
92
|
const rangeExt = Math.floor(range / SAFE_LIMIT);
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
sum2 = (sum2 + arr[j]) % rangeExt;
|
42
|
-
}
|
93
|
+
|
94
|
+
const sum1 = (arr[0] + arr[2]) & SAFE_PART;
|
95
|
+
const sum2 = (arr[0] + arr[2]) % rangeExt;
|
96
|
+
|
43
97
|
return (sum2 * SAFE_LIMIT + sum1) % range;
|
44
98
|
}
|
45
99
|
};
|
@@ -21,6 +21,9 @@ const processAsyncTree = (items, concurrency, processor, callback) => {
|
|
21
21
|
let finished = false;
|
22
22
|
let processScheduled = true;
|
23
23
|
|
24
|
+
/**
|
25
|
+
* @param {T} item item
|
26
|
+
*/
|
24
27
|
const push = item => {
|
25
28
|
queue.push(item);
|
26
29
|
if (!processScheduled && processing < concurrency) {
|
@@ -29,6 +32,9 @@ const processAsyncTree = (items, concurrency, processor, callback) => {
|
|
29
32
|
}
|
30
33
|
};
|
31
34
|
|
35
|
+
/**
|
36
|
+
* @param {E | null | undefined} err error
|
37
|
+
*/
|
32
38
|
const processorCallback = err => {
|
33
39
|
processing--;
|
34
40
|
if (err && !finished) {
|
@@ -46,7 +52,7 @@ const processAsyncTree = (items, concurrency, processor, callback) => {
|
|
46
52
|
if (finished) return;
|
47
53
|
while (processing < concurrency && queue.length > 0) {
|
48
54
|
processing++;
|
49
|
-
const item = queue.pop();
|
55
|
+
const item = /** @type {T} */ (queue.pop());
|
50
56
|
processor(item, push, processorCallback);
|
51
57
|
}
|
52
58
|
processScheduled = false;
|
@@ -5,61 +5,16 @@
|
|
5
5
|
|
6
6
|
"use strict";
|
7
7
|
|
8
|
-
const
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
"catch",
|
13
|
-
"class",
|
14
|
-
"const",
|
15
|
-
"continue",
|
16
|
-
"debugger",
|
17
|
-
"default",
|
18
|
-
"delete",
|
19
|
-
"do",
|
20
|
-
"else",
|
21
|
-
"export",
|
22
|
-
"extends",
|
23
|
-
"finally",
|
24
|
-
"for",
|
25
|
-
"function",
|
26
|
-
"if",
|
27
|
-
"import",
|
28
|
-
"in",
|
29
|
-
"instanceof",
|
30
|
-
"new",
|
31
|
-
"return",
|
32
|
-
"super",
|
33
|
-
"switch",
|
34
|
-
"this",
|
35
|
-
"throw",
|
36
|
-
"try",
|
37
|
-
"typeof",
|
38
|
-
"var",
|
39
|
-
"void",
|
40
|
-
"while",
|
41
|
-
"with",
|
42
|
-
"enum",
|
43
|
-
// strict mode
|
44
|
-
"implements",
|
45
|
-
"interface",
|
46
|
-
"let",
|
47
|
-
"package",
|
48
|
-
"private",
|
49
|
-
"protected",
|
50
|
-
"public",
|
51
|
-
"static",
|
52
|
-
"yield",
|
53
|
-
"yield",
|
54
|
-
// module code
|
55
|
-
"await",
|
56
|
-
// skip future reserved keywords defined under ES1 till ES3
|
57
|
-
// additional
|
58
|
-
"null",
|
59
|
-
"true",
|
60
|
-
"false"
|
61
|
-
]);
|
8
|
+
const {
|
9
|
+
SAFE_IDENTIFIER,
|
10
|
+
RESERVED_IDENTIFIER
|
11
|
+
} = require("../util/propertyName");
|
62
12
|
|
13
|
+
/**
|
14
|
+
* @param {ArrayLike<string>} properties properties
|
15
|
+
* @param {number} start start index
|
16
|
+
* @returns {string} chain of property accesses
|
17
|
+
*/
|
63
18
|
const propertyAccess = (properties, start = 0) => {
|
64
19
|
let str = "";
|
65
20
|
for (let i = start; i < properties.length; i++) {
|
@@ -0,0 +1,79 @@
|
|
1
|
+
/*
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
+
Author Tobias Koppers @sokra
|
4
|
+
*/
|
5
|
+
|
6
|
+
"use strict";
|
7
|
+
|
8
|
+
const SAFE_IDENTIFIER = /^[_a-zA-Z$][_a-zA-Z$0-9]*$/;
|
9
|
+
const RESERVED_IDENTIFIER = new Set([
|
10
|
+
"break",
|
11
|
+
"case",
|
12
|
+
"catch",
|
13
|
+
"class",
|
14
|
+
"const",
|
15
|
+
"continue",
|
16
|
+
"debugger",
|
17
|
+
"default",
|
18
|
+
"delete",
|
19
|
+
"do",
|
20
|
+
"else",
|
21
|
+
"export",
|
22
|
+
"extends",
|
23
|
+
"finally",
|
24
|
+
"for",
|
25
|
+
"function",
|
26
|
+
"if",
|
27
|
+
"import",
|
28
|
+
"in",
|
29
|
+
"instanceof",
|
30
|
+
"new",
|
31
|
+
"return",
|
32
|
+
"super",
|
33
|
+
"switch",
|
34
|
+
"this",
|
35
|
+
"throw",
|
36
|
+
"try",
|
37
|
+
"typeof",
|
38
|
+
"var",
|
39
|
+
"void",
|
40
|
+
"while",
|
41
|
+
"with",
|
42
|
+
"enum",
|
43
|
+
// strict mode
|
44
|
+
"implements",
|
45
|
+
"interface",
|
46
|
+
"let",
|
47
|
+
"package",
|
48
|
+
"private",
|
49
|
+
"protected",
|
50
|
+
"public",
|
51
|
+
"static",
|
52
|
+
"yield",
|
53
|
+
"yield",
|
54
|
+
// module code
|
55
|
+
"await",
|
56
|
+
// skip future reserved keywords defined under ES1 till ES3
|
57
|
+
// additional
|
58
|
+
"null",
|
59
|
+
"true",
|
60
|
+
"false"
|
61
|
+
]);
|
62
|
+
|
63
|
+
/**
|
64
|
+
* @summary Returns a valid JS property name for the given property.
|
65
|
+
* Certain strings like "default", "null", and names with whitespace are not
|
66
|
+
* valid JS property names, so they are returned as strings.
|
67
|
+
*
|
68
|
+
* @param {string} prop property name to analyze
|
69
|
+
* @returns {string} valid JS property name
|
70
|
+
*/
|
71
|
+
const propertyName = prop => {
|
72
|
+
if (SAFE_IDENTIFIER.test(prop) && !RESERVED_IDENTIFIER.has(prop)) {
|
73
|
+
return prop;
|
74
|
+
} else {
|
75
|
+
return JSON.stringify(prop);
|
76
|
+
}
|
77
|
+
};
|
78
|
+
|
79
|
+
module.exports = { SAFE_IDENTIFIER, RESERVED_IDENTIFIER, propertyName };
|
@@ -26,7 +26,7 @@ const {
|
|
26
26
|
/** @typedef {import("./serialization").ObjectDeserializerContext} ObjectDeserializerContext */
|
27
27
|
/** @typedef {import("./serialization").ObjectSerializerContext} ObjectSerializerContext */
|
28
28
|
|
29
|
-
/** @typedef {ObjectSerializerContext & { writeLazy?: (any) => void }} WebpackObjectSerializerContext */
|
29
|
+
/** @typedef {ObjectSerializerContext & { writeLazy?: (value: any) => void }} WebpackObjectSerializerContext */
|
30
30
|
|
31
31
|
const CURRENT_MODULE = "webpack/lib/util/registerExternalSerializer";
|
32
32
|
|