webpack 5.101.3 → 5.102.1
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 +21 -26
- package/lib/APIPlugin.js +30 -36
- package/lib/AsyncDependenciesBlock.js +1 -4
- package/lib/BannerPlugin.js +0 -1
- package/lib/Cache.js +7 -6
- package/lib/CacheFacade.js +0 -1
- package/lib/Chunk.js +49 -31
- package/lib/ChunkGraph.js +37 -27
- package/lib/ChunkGroup.js +8 -10
- package/lib/ChunkTemplate.js +1 -1
- package/lib/CleanPlugin.js +3 -3
- package/lib/CodeGenerationResults.js +3 -2
- package/lib/CompatibilityPlugin.js +29 -12
- package/lib/Compilation.js +209 -196
- package/lib/Compiler.js +36 -35
- package/lib/ConcatenationScope.js +6 -1
- package/lib/ConditionalInitFragment.js +1 -1
- package/lib/ConstPlugin.js +6 -5
- package/lib/ContextExclusionPlugin.js +0 -1
- package/lib/ContextModule.js +25 -21
- package/lib/ContextModuleFactory.js +30 -11
- package/lib/ContextReplacementPlugin.js +38 -15
- package/lib/DefinePlugin.js +5 -9
- package/lib/DelegatedModule.js +7 -11
- package/lib/DependenciesBlock.js +0 -2
- package/lib/Dependency.js +9 -11
- package/lib/DependencyTemplates.js +2 -4
- package/lib/DllModule.js +1 -7
- package/lib/DllReferencePlugin.js +2 -4
- package/lib/DynamicEntryPlugin.js +0 -2
- package/lib/EntryOptionPlugin.js +0 -5
- package/lib/EnvironmentNotSupportAsyncWarning.js +0 -3
- package/lib/EvalDevToolModulePlugin.js +4 -3
- package/lib/EvalSourceMapDevToolPlugin.js +3 -4
- package/lib/ExportsInfo.js +50 -49
- package/lib/ExternalModule.js +84 -52
- package/lib/ExternalModuleFactoryPlugin.js +27 -7
- package/lib/ExternalsPlugin.js +24 -17
- package/lib/FileSystemInfo.js +105 -90
- package/lib/FlagDependencyUsagePlugin.js +3 -4
- package/lib/Generator.js +2 -13
- package/lib/GraphHelpers.js +0 -3
- package/lib/HookWebpackError.js +0 -2
- package/lib/HotModuleReplacementPlugin.js +22 -24
- package/lib/HotUpdateChunk.js +0 -3
- package/lib/IgnorePlugin.js +5 -2
- package/lib/InitFragment.js +41 -29
- package/lib/InvalidDependenciesModuleWarning.js +0 -1
- package/lib/LibManifestPlugin.js +4 -6
- package/lib/LoaderOptionsPlugin.js +1 -10
- package/lib/MainTemplate.js +8 -19
- package/lib/Module.js +32 -20
- package/lib/ModuleFactory.js +1 -1
- package/lib/ModuleFilenameHelpers.js +42 -25
- package/lib/ModuleGraph.js +30 -16
- package/lib/ModuleInfoHeaderPlugin.js +0 -1
- package/lib/ModuleTemplate.js +0 -2
- package/lib/ModuleTypeConstants.js +11 -1
- package/lib/MultiCompiler.js +23 -15
- package/lib/MultiWatching.js +6 -10
- package/lib/NodeStuffPlugin.js +2 -10
- package/lib/NormalModule.js +146 -89
- package/lib/NormalModuleFactory.js +132 -42
- package/lib/OptionsApply.js +1 -1
- package/lib/Parser.js +1 -1
- package/lib/ProgressPlugin.js +6 -10
- package/lib/ProvidePlugin.js +5 -7
- package/lib/RawModule.js +1 -6
- package/lib/RecordIdsPlugin.js +10 -6
- package/lib/ResolverFactory.js +0 -2
- package/lib/RuntimeGlobals.js +5 -0
- package/lib/RuntimeModule.js +1 -3
- package/lib/RuntimePlugin.js +26 -22
- package/lib/RuntimeTemplate.js +22 -12
- package/lib/SourceMapDevToolModuleOptionsPlugin.js +2 -2
- package/lib/SourceMapDevToolPlugin.js +11 -18
- package/lib/Stats.js +0 -1
- package/lib/Template.js +6 -11
- package/lib/TemplatedPathPlugin.js +2 -1
- package/lib/WatchIgnorePlugin.js +2 -3
- package/lib/Watching.js +15 -15
- package/lib/WebpackIsIncludedPlugin.js +0 -2
- package/lib/WebpackOptionsApply.js +74 -107
- package/lib/asset/AssetBytesGenerator.js +167 -0
- package/lib/asset/AssetBytesParser.js +37 -0
- package/lib/asset/AssetGenerator.js +22 -37
- package/lib/asset/AssetModulesPlugin.js +34 -16
- package/lib/asset/AssetParser.js +7 -3
- package/lib/asset/AssetSourceGenerator.js +1 -1
- package/lib/asset/RawDataUrlModule.js +3 -2
- package/lib/async-modules/AsyncModuleHelpers.js +6 -4
- package/lib/buildChunkGraph.js +0 -1
- package/lib/cache/MemoryCachePlugin.js +0 -2
- package/lib/cache/MemoryWithGcCachePlugin.js +0 -2
- package/lib/cache/PackFileCacheStrategy.js +14 -1
- package/lib/cache/ResolverCachePlugin.js +9 -15
- package/lib/cache/getLazyHashedEtag.js +1 -1
- package/lib/config/browserslistTargetHandler.js +77 -76
- package/lib/config/defaults.js +162 -23
- package/lib/config/normalization.js +18 -3
- package/lib/config/target.js +1 -1
- package/lib/container/ContainerEntryDependency.js +0 -1
- package/lib/container/ContainerEntryModule.js +3 -7
- package/lib/container/ContainerPlugin.js +1 -2
- package/lib/container/ContainerReferencePlugin.js +0 -1
- package/lib/container/FallbackDependency.js +2 -1
- package/lib/container/FallbackModule.js +6 -7
- package/lib/container/ModuleFederationPlugin.js +0 -1
- package/lib/container/RemoteModule.js +8 -8
- package/lib/container/RemoteRuntimeModule.js +2 -2
- package/lib/css/CssGenerator.js +3 -6
- package/lib/css/CssLoadingRuntimeModule.js +6 -9
- package/lib/css/CssModulesPlugin.js +13 -19
- package/lib/css/CssParser.js +3 -3
- package/lib/css/walkCssTokens.js +2 -2
- package/lib/debug/ProfilingPlugin.js +35 -8
- package/lib/dependencies/AMDDefineDependencyParserPlugin.js +12 -17
- package/lib/dependencies/AMDPlugin.js +2 -2
- package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +1 -2
- package/lib/dependencies/CachedConstDependency.js +0 -4
- package/lib/dependencies/CommonJsExportRequireDependency.js +20 -14
- package/lib/dependencies/CommonJsExportsDependency.js +2 -1
- package/lib/dependencies/CommonJsExportsParserPlugin.js +20 -5
- package/lib/dependencies/CommonJsFullRequireDependency.js +6 -4
- package/lib/dependencies/CommonJsImportsParserPlugin.js +16 -7
- package/lib/dependencies/CommonJsRequireContextDependency.js +1 -1
- package/lib/dependencies/CommonJsSelfReferenceDependency.js +4 -4
- package/lib/dependencies/ConstDependency.js +2 -2
- package/lib/dependencies/ContextDependency.js +9 -4
- package/lib/dependencies/ContextDependencyHelpers.js +2 -2
- package/lib/dependencies/ContextDependencyTemplateAsId.js +9 -9
- package/lib/dependencies/ContextDependencyTemplateAsRequireCall.js +9 -9
- package/lib/dependencies/ContextElementDependency.js +22 -11
- package/lib/dependencies/CssIcssImportDependency.js +0 -2
- package/lib/dependencies/CssIcssSymbolDependency.js +2 -2
- package/lib/dependencies/CssImportDependency.js +0 -8
- package/lib/dependencies/CssLocalIdentifierDependency.js +4 -7
- package/lib/dependencies/CssSelfLocalIdentifierDependency.js +2 -2
- package/lib/dependencies/CssUrlDependency.js +0 -6
- package/lib/dependencies/ExportsInfoDependency.js +7 -9
- package/lib/dependencies/ExternalModuleDependency.js +0 -3
- package/lib/dependencies/ExternalModuleInitFragment.js +1 -1
- package/lib/dependencies/HarmonyAcceptDependency.js +1 -1
- package/lib/dependencies/HarmonyAcceptImportDependency.js +0 -4
- package/lib/dependencies/HarmonyCompatibilityDependency.js +0 -1
- package/lib/dependencies/HarmonyDetectionParserPlugin.js +0 -14
- package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +3 -3
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +4 -1
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +29 -35
- package/lib/dependencies/HarmonyImportDependency.js +33 -14
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +20 -23
- package/lib/dependencies/HarmonyImportSideEffectDependency.js +0 -4
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +46 -31
- package/lib/dependencies/HarmonyModulesPlugin.js +3 -3
- package/lib/dependencies/ImportContextDependency.js +13 -0
- package/lib/dependencies/ImportDependency.js +18 -6
- package/lib/dependencies/ImportEagerDependency.js +2 -3
- package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +8 -5
- package/lib/dependencies/ImportMetaContextPlugin.js +0 -1
- package/lib/dependencies/ImportMetaPlugin.js +3 -2
- package/lib/dependencies/ImportParserPlugin.js +288 -45
- package/lib/dependencies/ImportWeakDependency.js +2 -3
- package/lib/dependencies/JsonExportsDependency.js +0 -1
- package/lib/dependencies/LoaderDependency.js +0 -3
- package/lib/dependencies/LoaderImportDependency.js +0 -3
- package/lib/dependencies/LoaderPlugin.js +11 -5
- package/lib/dependencies/ModuleDecoratorDependency.js +2 -4
- package/lib/dependencies/ModuleDependency.js +3 -9
- package/lib/dependencies/NullDependency.js +2 -0
- package/lib/dependencies/ProvidedDependency.js +6 -8
- package/lib/dependencies/PureExpressionDependency.js +0 -1
- package/lib/dependencies/RequireEnsureDependenciesBlock.js +0 -1
- package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +1 -2
- package/lib/dependencies/RequireIncludeDependency.js +2 -2
- package/lib/dependencies/RequireResolveDependency.js +2 -2
- package/lib/dependencies/RuntimeRequirementsDependency.js +2 -3
- package/lib/dependencies/StaticExportsDependency.js +3 -5
- package/lib/dependencies/URLDependency.js +2 -7
- package/lib/dependencies/URLPlugin.js +1 -2
- package/lib/dependencies/WebAssemblyExportImportedDependency.js +2 -2
- package/lib/dependencies/WebAssemblyImportDependency.js +2 -2
- package/lib/dependencies/WebpackIsIncludedDependency.js +2 -3
- package/lib/dependencies/WorkerDependency.js +2 -3
- package/lib/dependencies/WorkerPlugin.js +4 -12
- package/lib/dependencies/processExportInfo.js +2 -3
- package/lib/esm/ModuleChunkFormatPlugin.js +0 -3
- package/lib/esm/ModuleChunkLoadingPlugin.js +2 -1
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +7 -7
- package/lib/hmr/LazyCompilationPlugin.js +6 -4
- package/lib/hmr/lazyCompilationBackend.js +13 -10
- package/lib/ids/DeterministicChunkIdsPlugin.js +0 -1
- package/lib/ids/HashedModuleIdsPlugin.js +5 -7
- package/lib/ids/IdHelpers.js +1 -1
- package/lib/ids/NamedChunkIdsPlugin.js +1 -6
- package/lib/ids/NamedModuleIdsPlugin.js +1 -5
- package/lib/ids/NaturalChunkIdsPlugin.js +0 -1
- package/lib/ids/NaturalModuleIdsPlugin.js +0 -1
- package/lib/ids/OccurrenceChunkIdsPlugin.js +0 -1
- package/lib/ids/OccurrenceModuleIdsPlugin.js +0 -1
- package/lib/ids/SyncModuleIdsPlugin.js +4 -3
- package/lib/index.js +8 -7
- package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +4 -1
- package/lib/javascript/BasicEvaluatedExpression.js +13 -6
- package/lib/javascript/ChunkFormatHelpers.js +1 -1
- package/lib/javascript/CommonJsChunkFormatPlugin.js +0 -1
- package/lib/javascript/JavascriptGenerator.js +2 -3
- package/lib/javascript/JavascriptModulesPlugin.js +46 -24
- package/lib/javascript/JavascriptParser.js +120 -55
- package/lib/javascript/JavascriptParserHelpers.js +2 -2
- package/lib/javascript/StartupHelpers.js +2 -4
- package/lib/json/JsonData.js +1 -1
- package/lib/json/JsonGenerator.js +4 -5
- package/lib/json/JsonModulesPlugin.js +0 -3
- package/lib/json/JsonParser.js +4 -2
- package/lib/library/AbstractLibraryPlugin.js +2 -2
- package/lib/library/AmdLibraryPlugin.js +0 -1
- package/lib/library/AssignLibraryPlugin.js +23 -12
- package/lib/library/EnableLibraryPlugin.js +7 -11
- package/lib/library/ExportPropertyLibraryPlugin.js +8 -20
- package/lib/library/JsonpLibraryPlugin.js +5 -2
- package/lib/library/ModuleLibraryPlugin.js +88 -43
- package/lib/library/SystemLibraryPlugin.js +15 -6
- package/lib/library/UmdLibraryPlugin.js +12 -18
- package/lib/logging/Logger.js +12 -10
- package/lib/logging/createConsoleLogger.js +15 -14
- package/lib/logging/truncateArgs.js +1 -1
- package/lib/node/CommonJsChunkLoadingPlugin.js +2 -1
- package/lib/node/NodeWatchFileSystem.js +4 -4
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +2 -2
- package/lib/node/RequireChunkLoadingRuntimeModule.js +5 -2
- package/lib/node/nodeConsole.js +2 -2
- package/lib/optimize/AggressiveSplittingPlugin.js +2 -0
- package/lib/optimize/ConcatenatedModule.js +142 -100
- package/lib/optimize/InnerGraph.js +17 -11
- package/lib/optimize/InnerGraphPlugin.js +0 -3
- package/lib/optimize/ModuleConcatenationPlugin.js +3 -4
- package/lib/optimize/RealContentHashPlugin.js +5 -3
- package/lib/optimize/RuntimeChunkPlugin.js +0 -1
- package/lib/optimize/SideEffectsFlagPlugin.js +3 -10
- package/lib/optimize/SplitChunksPlugin.js +46 -40
- package/lib/performance/SizeLimitsPlugin.js +2 -1
- package/lib/prefetch/ChunkPrefetchFunctionRuntimeModule.js +5 -7
- package/lib/prefetch/ChunkPrefetchPreloadPlugin.js +0 -2
- package/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js +0 -1
- package/lib/prefetch/ChunkPrefetchTriggerRuntimeModule.js +2 -2
- package/lib/prefetch/ChunkPreloadTriggerRuntimeModule.js +2 -2
- package/lib/rules/BasicMatcherRulePlugin.js +0 -2
- package/lib/rules/ObjectMatcherRulePlugin.js +0 -1
- package/lib/rules/RuleSetCompiler.js +8 -6
- package/lib/runtime/BaseUriRuntimeModule.js +2 -2
- package/lib/runtime/CompatRuntimeModule.js +0 -1
- package/lib/runtime/GetChunkFilenameRuntimeModule.js +8 -9
- package/lib/runtime/LoadScriptRuntimeModule.js +0 -2
- package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +1 -1
- package/lib/runtime/PublicPathRuntimeModule.js +2 -2
- package/lib/runtime/StartupEntrypointRuntimeModule.js +0 -1
- package/lib/runtime/SystemContextRuntimeModule.js +0 -2
- package/lib/runtime/ToBinaryRuntimeModule.js +64 -0
- package/lib/schemes/DataUriPlugin.js +2 -28
- package/lib/schemes/FileUriPlugin.js +5 -2
- package/lib/schemes/HttpUriPlugin.js +4 -2
- package/lib/schemes/VirtualUrlPlugin.js +11 -11
- package/lib/serialization/FileMiddleware.js +1 -1
- package/lib/serialization/NullPrototypeObjectSerializer.js +5 -3
- package/lib/serialization/ObjectMiddleware.js +31 -20
- package/lib/serialization/SerializerMiddleware.js +1 -3
- package/lib/serialization/types.js +1 -1
- package/lib/sharing/ConsumeSharedModule.js +3 -5
- package/lib/sharing/ConsumeSharedPlugin.js +2 -4
- package/lib/sharing/ConsumeSharedRuntimeModule.js +9 -6
- package/lib/sharing/ProvideSharedModule.js +3 -7
- package/lib/sharing/SharePlugin.js +0 -2
- package/lib/sharing/ShareRuntimeModule.js +4 -1
- package/lib/sharing/resolveMatchedConfigs.js +14 -6
- package/lib/sharing/utils.js +0 -6
- package/lib/stats/DefaultStatsFactoryPlugin.js +179 -95
- package/lib/stats/DefaultStatsPresetPlugin.js +15 -9
- package/lib/stats/DefaultStatsPrinterPlugin.js +77 -113
- package/lib/stats/StatsFactory.js +14 -11
- package/lib/url/URLParserPlugin.js +2 -4
- package/lib/util/ArrayHelpers.js +4 -4
- package/lib/util/AsyncQueue.js +1 -0
- package/lib/util/Hash.js +35 -5
- package/lib/util/LazySet.js +2 -2
- package/lib/util/StackedCacheMap.js +0 -2
- package/lib/util/TupleSet.js +9 -4
- package/lib/util/URLAbsoluteSpecifier.js +0 -1
- package/lib/util/WeakTupleMap.js +1 -1
- package/lib/util/chainedImports.js +3 -1
- package/lib/util/cleverMerge.js +15 -18
- package/lib/util/comparators.js +2 -4
- package/lib/util/compileBooleanMatcher.js +11 -9
- package/lib/util/concatenate.js +1 -2
- package/lib/util/create-schema-validation.js +1 -2
- package/lib/util/createHash.js +85 -15
- package/lib/util/dataURL.js +39 -0
- package/lib/util/deprecation.js +29 -31
- package/lib/util/deterministicGrouping.js +34 -30
- package/lib/util/extractSourceMap.js +319 -0
- package/lib/util/findGraphRoots.js +15 -5
- package/lib/util/fs.js +29 -8
- package/lib/util/hash/BatchedHash.js +47 -8
- package/lib/util/hash/wasm-hash.js +53 -13
- package/lib/util/semver.js +9 -8
- package/lib/util/smartGrouping.js +41 -26
- package/lib/util/traverseDestructuringAssignmentProperties.js +45 -0
- package/lib/wasm/EnableWasmLoadingPlugin.js +3 -2
- package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +5 -1
- package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +2 -13
- package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +2 -9
- package/lib/wasm-async/AsyncWebAssemblyParser.js +2 -10
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +6 -4
- package/lib/wasm-sync/WebAssemblyGenerator.js +1 -3
- package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +1 -4
- package/lib/wasm-sync/WebAssemblyModulesPlugin.js +2 -7
- package/lib/wasm-sync/WebAssemblyParser.js +1 -13
- package/lib/web/JsonpChunkLoadingPlugin.js +2 -1
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +1 -1
- package/lib/web/JsonpTemplatePlugin.js +0 -1
- package/lib/webpack.js +21 -8
- package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +2 -1
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +1 -1
- package/package.json +21 -21
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +93 -96
- package/schemas/plugins/BannerPlugin.check.js +1 -1
- package/schemas/plugins/BannerPlugin.json +4 -0
- package/schemas/plugins/IgnorePlugin.json +1 -1
- package/schemas/plugins/ProgressPlugin.json +1 -1
- package/schemas/plugins/SourceMapDevToolPlugin.check.js +1 -1
- package/schemas/plugins/SourceMapDevToolPlugin.json +5 -1
- package/schemas/plugins/ids/HashedModuleIdsPlugin.check.d.ts +7 -0
- package/schemas/plugins/ids/HashedModuleIdsPlugin.check.js +6 -0
- package/schemas/plugins/{HashedModuleIdsPlugin.json → ids/HashedModuleIdsPlugin.json} +15 -2
- package/schemas/plugins/schemes/VirtualUrlPlugin.json +3 -3
- package/types.d.ts +1699 -706
- package/SECURITY.md +0 -9
- package/schemas/plugins/HashedModuleIdsPlugin.check.d.ts +0 -7
- package/schemas/plugins/HashedModuleIdsPlugin.check.js +0 -6
|
@@ -13,12 +13,8 @@ const { compareModulesByIdOrIdentifier } = require("../util/comparators");
|
|
|
13
13
|
const memoize = require("../util/memoize");
|
|
14
14
|
const WebAssemblyInInitialChunkError = require("./WebAssemblyInInitialChunkError");
|
|
15
15
|
|
|
16
|
-
/** @typedef {import("webpack-sources").Source} Source */
|
|
17
|
-
/** @typedef {import("../../declarations/WebpackOptions").OutputNormalized} OutputOptions */
|
|
18
16
|
/** @typedef {import("../Compiler")} Compiler */
|
|
19
17
|
/** @typedef {import("../Module")} Module */
|
|
20
|
-
/** @typedef {import("../ModuleTemplate")} ModuleTemplate */
|
|
21
|
-
/** @typedef {import("../javascript/JavascriptModulesPlugin").RenderContext} RenderContext */
|
|
22
18
|
|
|
23
19
|
const getWebAssemblyGenerator = memoize(() =>
|
|
24
20
|
require("./WebAssemblyGenerator")
|
|
@@ -92,9 +88,7 @@ class WebAssemblyModulesPlugin {
|
|
|
92
88
|
compareModulesByIdOrIdentifier(chunkGraph)
|
|
93
89
|
)) {
|
|
94
90
|
if (module.type === WEBASSEMBLY_MODULE_TYPE_SYNC) {
|
|
95
|
-
const filenameTemplate =
|
|
96
|
-
/** @type {NonNullable<OutputOptions["webassemblyModuleFilename"]>} */
|
|
97
|
-
(outputOptions.webassemblyModuleFilename);
|
|
91
|
+
const filenameTemplate = outputOptions.webassemblyModuleFilename;
|
|
98
92
|
|
|
99
93
|
result.push({
|
|
100
94
|
render: () =>
|
|
@@ -123,6 +117,7 @@ class WebAssemblyModulesPlugin {
|
|
|
123
117
|
|
|
124
118
|
compilation.hooks.afterChunks.tap(PLUGIN_NAME, () => {
|
|
125
119
|
const chunkGraph = compilation.chunkGraph;
|
|
120
|
+
/** @type {Set<Module>} */
|
|
126
121
|
const initialWasmModules = new Set();
|
|
127
122
|
for (const chunk of compilation.chunks) {
|
|
128
123
|
if (chunk.canBeInitial()) {
|
|
@@ -14,8 +14,6 @@ const WebAssemblyExportImportedDependency = require("../dependencies/WebAssembly
|
|
|
14
14
|
const WebAssemblyImportDependency = require("../dependencies/WebAssemblyImportDependency");
|
|
15
15
|
|
|
16
16
|
/** @typedef {import("@webassemblyjs/ast").ModuleImport} ModuleImport */
|
|
17
|
-
/** @typedef {import("@webassemblyjs/ast").NumberLiteral} NumberLiteral */
|
|
18
|
-
/** @typedef {import("../Module")} Module */
|
|
19
17
|
/** @typedef {import("../Module").BuildInfo} BuildInfo */
|
|
20
18
|
/** @typedef {import("../Module").BuildMeta} BuildMeta */
|
|
21
19
|
/** @typedef {import("../Parser").ParserState} ParserState */
|
|
@@ -65,15 +63,6 @@ const decoderOpts = {
|
|
|
65
63
|
};
|
|
66
64
|
|
|
67
65
|
class WebAssemblyParser extends Parser {
|
|
68
|
-
/**
|
|
69
|
-
* @param {{}=} options parser options
|
|
70
|
-
*/
|
|
71
|
-
constructor(options) {
|
|
72
|
-
super();
|
|
73
|
-
this.hooks = Object.freeze({});
|
|
74
|
-
this.options = options;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
66
|
/**
|
|
78
67
|
* @param {string | Buffer | PreparsedAst} source the source to parse
|
|
79
68
|
* @param {ParserState} state the parser state
|
|
@@ -132,8 +121,7 @@ class WebAssemblyParser extends Parser {
|
|
|
132
121
|
exports.push(node.name);
|
|
133
122
|
|
|
134
123
|
if (node.descr && node.descr.exportType === "Global") {
|
|
135
|
-
const refNode =
|
|
136
|
-
importedGlobals[/** @type {NumberLiteral} */ (node.descr.id).value];
|
|
124
|
+
const refNode = importedGlobals[node.descr.id.value];
|
|
137
125
|
if (refNode) {
|
|
138
126
|
const dep = new WebAssemblyExportImportedDependency(
|
|
139
127
|
node.name,
|
|
@@ -10,6 +10,7 @@ const JsonpChunkLoadingRuntimeModule = require("./JsonpChunkLoadingRuntimeModule
|
|
|
10
10
|
|
|
11
11
|
/** @typedef {import("../Chunk")} Chunk */
|
|
12
12
|
/** @typedef {import("../Compiler")} Compiler */
|
|
13
|
+
/** @typedef {import("../Module").RuntimeRequirements} RuntimeRequirements */
|
|
13
14
|
|
|
14
15
|
const PLUGIN_NAME = "JsonpChunkLoadingPlugin";
|
|
15
16
|
|
|
@@ -37,7 +38,7 @@ class JsonpChunkLoadingPlugin {
|
|
|
37
38
|
const onceForChunkSet = new WeakSet();
|
|
38
39
|
/**
|
|
39
40
|
* @param {Chunk} chunk chunk
|
|
40
|
-
* @param {
|
|
41
|
+
* @param {RuntimeRequirements} set runtime requirements
|
|
41
42
|
*/
|
|
42
43
|
const handler = (chunk, set) => {
|
|
43
44
|
if (onceForChunkSet.has(chunk)) return;
|
|
@@ -69,7 +69,7 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
|
|
|
69
69
|
if (options && options.baseUri) {
|
|
70
70
|
return `${RuntimeGlobals.baseURI} = ${JSON.stringify(options.baseUri)};`;
|
|
71
71
|
}
|
|
72
|
-
return `${RuntimeGlobals.baseURI} = document.baseURI || self.location.href;`;
|
|
72
|
+
return `${RuntimeGlobals.baseURI} = (typeof document !== 'undefined' && document.baseURI) || self.location.href;`;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
/**
|
|
@@ -9,7 +9,6 @@ const ArrayPushCallbackChunkFormatPlugin = require("../javascript/ArrayPushCallb
|
|
|
9
9
|
const EnableChunkLoadingPlugin = require("../javascript/EnableChunkLoadingPlugin");
|
|
10
10
|
const JsonpChunkLoadingRuntimeModule = require("./JsonpChunkLoadingRuntimeModule");
|
|
11
11
|
|
|
12
|
-
/** @typedef {import("../Chunk")} Chunk */
|
|
13
12
|
/** @typedef {import("../Compilation")} Compilation */
|
|
14
13
|
/** @typedef {import("../Compiler")} Compiler */
|
|
15
14
|
|
package/lib/webpack.js
CHANGED
|
@@ -21,6 +21,7 @@ const memoize = require("./util/memoize");
|
|
|
21
21
|
|
|
22
22
|
/** @typedef {import("../declarations/WebpackOptions").WebpackOptions} WebpackOptions */
|
|
23
23
|
/** @typedef {import("../declarations/WebpackOptions").WebpackPluginFunction} WebpackPluginFunction */
|
|
24
|
+
/** @typedef {import("./config/defaults").WebpackOptionsNormalizedWithDefaults} WebpackOptionsNormalizedWithDefaults */
|
|
24
25
|
/** @typedef {import("./Compiler").WatchOptions} WatchOptions */
|
|
25
26
|
/** @typedef {import("./MultiCompiler").MultiCompilerOptions} MultiCompilerOptions */
|
|
26
27
|
/** @typedef {import("./MultiCompiler").MultiWebpackOptions} MultiWebpackOptions */
|
|
@@ -31,12 +32,15 @@ const getValidateSchema = memoize(() => require("./validateSchema"));
|
|
|
31
32
|
|
|
32
33
|
/**
|
|
33
34
|
* @template T
|
|
35
|
+
* @template [R=void]
|
|
34
36
|
* @callback Callback
|
|
35
37
|
* @param {Error | null} err
|
|
36
|
-
* @param {T=}
|
|
37
|
-
* @returns {
|
|
38
|
+
* @param {T=} result
|
|
39
|
+
* @returns {R}
|
|
38
40
|
*/
|
|
39
41
|
|
|
42
|
+
/** @typedef {Callback<void>} ErrorCallback */
|
|
43
|
+
|
|
40
44
|
/**
|
|
41
45
|
* @param {ReadonlyArray<WebpackOptions>} childOptions options array
|
|
42
46
|
* @param {MultiCompilerOptions} options options
|
|
@@ -92,7 +96,11 @@ const createCompiler = (rawOptions, compilerIndex) => {
|
|
|
92
96
|
}
|
|
93
97
|
compiler.hooks.environment.call();
|
|
94
98
|
compiler.hooks.afterEnvironment.call();
|
|
95
|
-
new WebpackOptionsApply().process(
|
|
99
|
+
new WebpackOptionsApply().process(
|
|
100
|
+
/** @type {WebpackOptionsNormalizedWithDefaults} */
|
|
101
|
+
(options),
|
|
102
|
+
compiler
|
|
103
|
+
);
|
|
96
104
|
compiler.hooks.initialize.call();
|
|
97
105
|
return compiler;
|
|
98
106
|
};
|
|
@@ -113,8 +121,8 @@ const createCompiler = (rawOptions, compilerIndex) => {
|
|
|
113
121
|
|
|
114
122
|
/**
|
|
115
123
|
* @template T
|
|
116
|
-
* @param {
|
|
117
|
-
* @returns {
|
|
124
|
+
* @param {T[] | T} options options
|
|
125
|
+
* @returns {T[]} array of options
|
|
118
126
|
*/
|
|
119
127
|
const asArray = (options) =>
|
|
120
128
|
Array.isArray(options) ? [...options] : [options];
|
|
@@ -130,7 +138,11 @@ const webpack = /** @type {WebpackFunctionSingle & WebpackFunctionMulti} */ (
|
|
|
130
138
|
/** @type {WebpackCallback} */
|
|
131
139
|
(options, callback) => {
|
|
132
140
|
const create = () => {
|
|
133
|
-
if (
|
|
141
|
+
if (
|
|
142
|
+
!asArray(/** @type {WebpackOptions} */ (options)).every(
|
|
143
|
+
webpackOptionsSchemaCheck
|
|
144
|
+
)
|
|
145
|
+
) {
|
|
134
146
|
getValidateSchema()(webpackOptionsSchema, options);
|
|
135
147
|
util.deprecate(
|
|
136
148
|
() => {},
|
|
@@ -142,13 +154,14 @@ const webpack = /** @type {WebpackFunctionSingle & WebpackFunctionMulti} */ (
|
|
|
142
154
|
let compiler;
|
|
143
155
|
/** @type {boolean | undefined} */
|
|
144
156
|
let watch = false;
|
|
145
|
-
/** @type {WatchOptions|WatchOptions[]} */
|
|
157
|
+
/** @type {WatchOptions | WatchOptions[]} */
|
|
146
158
|
let watchOptions;
|
|
147
159
|
if (Array.isArray(options)) {
|
|
148
160
|
/** @type {MultiCompiler} */
|
|
149
161
|
compiler = createMultiCompiler(
|
|
150
162
|
options,
|
|
151
|
-
/** @type {MultiCompilerOptions} */
|
|
163
|
+
/** @type {MultiCompilerOptions} */
|
|
164
|
+
(options)
|
|
152
165
|
);
|
|
153
166
|
watch = options.some((options) => options.watch);
|
|
154
167
|
watchOptions = options.map((options) => options.watchOptions || {});
|
|
@@ -11,6 +11,7 @@ const ImportScriptsChunkLoadingRuntimeModule = require("./ImportScriptsChunkLoad
|
|
|
11
11
|
|
|
12
12
|
/** @typedef {import("../Chunk")} Chunk */
|
|
13
13
|
/** @typedef {import("../Compiler")} Compiler */
|
|
14
|
+
/** @typedef {import("../Module").RuntimeRequirements} RuntimeRequirements */
|
|
14
15
|
|
|
15
16
|
const PLUGIN_NAME = "ImportScriptsChunkLoadingPlugin";
|
|
16
17
|
|
|
@@ -42,7 +43,7 @@ class ImportScriptsChunkLoadingPlugin {
|
|
|
42
43
|
const onceForChunkSet = new WeakSet();
|
|
43
44
|
/**
|
|
44
45
|
* @param {Chunk} chunk chunk
|
|
45
|
-
* @param {
|
|
46
|
+
* @param {RuntimeRequirements} set runtime requirements
|
|
46
47
|
*/
|
|
47
48
|
const handler = (chunk, set) => {
|
|
48
49
|
if (onceForChunkSet.has(chunk)) return;
|
|
@@ -54,7 +54,7 @@ class ImportScriptsChunkLoadingRuntimeModule extends RuntimeModule {
|
|
|
54
54
|
);
|
|
55
55
|
const rootOutputDir = getUndoPath(
|
|
56
56
|
outputName,
|
|
57
|
-
|
|
57
|
+
compilation.outputOptions.path,
|
|
58
58
|
false
|
|
59
59
|
);
|
|
60
60
|
return `${RuntimeGlobals.baseURI} = self.location + ${JSON.stringify(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webpack",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.102.1",
|
|
4
4
|
"description": "Packs ECMAScript/CommonJs/AMD modules for the browser. Allows you to split your codebase into multiple bundles, which can be loaded on demand. Supports loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.",
|
|
5
5
|
"homepage": "https://github.com/webpack/webpack",
|
|
6
6
|
"bugs": "https://github.com/webpack/webpack/issues",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"@webassemblyjs/wasm-parser": "^1.14.1",
|
|
90
90
|
"acorn": "^8.15.0",
|
|
91
91
|
"acorn-import-phases": "^1.0.3",
|
|
92
|
-
"browserslist": "^4.
|
|
92
|
+
"browserslist": "^4.26.3",
|
|
93
93
|
"chrome-trace-event": "^1.0.2",
|
|
94
94
|
"enhanced-resolve": "^5.17.3",
|
|
95
95
|
"es-module-lexer": "^1.2.1",
|
|
@@ -101,26 +101,26 @@
|
|
|
101
101
|
"loader-runner": "^4.2.0",
|
|
102
102
|
"mime-types": "^2.1.27",
|
|
103
103
|
"neo-async": "^2.6.2",
|
|
104
|
-
"schema-utils": "^4.3.
|
|
105
|
-
"tapable": "^2.
|
|
104
|
+
"schema-utils": "^4.3.3",
|
|
105
|
+
"tapable": "^2.3.0",
|
|
106
106
|
"terser-webpack-plugin": "^5.3.11",
|
|
107
|
-
"watchpack": "^2.4.
|
|
107
|
+
"watchpack": "^2.4.4",
|
|
108
108
|
"webpack-sources": "^3.3.3"
|
|
109
109
|
},
|
|
110
110
|
"devDependencies": {
|
|
111
111
|
"@babel/core": "^7.27.1",
|
|
112
112
|
"@babel/preset-react": "^7.27.1",
|
|
113
|
-
"@codspeed/core": "^
|
|
114
|
-
"@eslint/js": "^9.
|
|
115
|
-
"@eslint/markdown": "^7.
|
|
116
|
-
"@stylistic/eslint-plugin": "^5.
|
|
113
|
+
"@codspeed/core": "^5.0.1",
|
|
114
|
+
"@eslint/js": "^9.36.0",
|
|
115
|
+
"@eslint/markdown": "^7.3.0",
|
|
116
|
+
"@stylistic/eslint-plugin": "^5.4.0",
|
|
117
117
|
"@types/glob-to-regexp": "^0.4.4",
|
|
118
118
|
"@types/graceful-fs": "^4.1.9",
|
|
119
119
|
"@types/jest": "^30.0.0",
|
|
120
120
|
"@types/mime-types": "^2.1.4",
|
|
121
|
-
"@types/node": "^24.
|
|
121
|
+
"@types/node": "^24.5.2",
|
|
122
122
|
"@types/xxhashjs": "^0.2.4",
|
|
123
|
-
"assemblyscript": "^0.28.
|
|
123
|
+
"assemblyscript": "^0.28.8",
|
|
124
124
|
"babel-loader": "^10.0.0",
|
|
125
125
|
"bundle-loader": "^0.5.6",
|
|
126
126
|
"coffee-loader": "^5.0.0",
|
|
@@ -131,26 +131,26 @@
|
|
|
131
131
|
"date-fns": "^4.0.0",
|
|
132
132
|
"es5-ext": "^0.10.53",
|
|
133
133
|
"es6-promise-polyfill": "^1.2.0",
|
|
134
|
-
"eslint": "^9.
|
|
134
|
+
"eslint": "^9.36.0",
|
|
135
135
|
"eslint-config-prettier": "^10.1.1",
|
|
136
136
|
"eslint-config-webpack": "^4.5.1",
|
|
137
137
|
"eslint-plugin-import": "^2.32.0",
|
|
138
138
|
"eslint-plugin-jest": "^29.0.1",
|
|
139
139
|
"eslint-plugin-jsdoc": "^51.2.3",
|
|
140
|
-
"eslint-plugin-n": "^17.
|
|
140
|
+
"eslint-plugin-n": "^17.23.1",
|
|
141
141
|
"eslint-plugin-prettier": "^5.5.0",
|
|
142
|
-
"eslint-plugin-unicorn": "^
|
|
142
|
+
"eslint-plugin-unicorn": "^61.0.1",
|
|
143
143
|
"file-loader": "^6.0.0",
|
|
144
144
|
"fork-ts-checker-webpack-plugin": "^9.0.2",
|
|
145
145
|
"globals": "^16.0.0",
|
|
146
146
|
"hash-wasm": "^4.9.0",
|
|
147
147
|
"husky": "^9.0.11",
|
|
148
148
|
"istanbul": "^0.4.5",
|
|
149
|
-
"jest": "^30.0
|
|
150
|
-
"jest-circus": "^30.0
|
|
151
|
-
"jest-cli": "^30.0
|
|
152
|
-
"jest-diff": "^30.0
|
|
153
|
-
"jest-environment-node": "^30.0
|
|
149
|
+
"jest": "^30.2.0",
|
|
150
|
+
"jest-circus": "^30.2.0",
|
|
151
|
+
"jest-cli": "^30.2.0",
|
|
152
|
+
"jest-diff": "^30.2.0",
|
|
153
|
+
"jest-environment-node": "^30.2.0",
|
|
154
154
|
"jest-junit": "^16.0.0",
|
|
155
155
|
"json-loader": "^0.5.7",
|
|
156
156
|
"json5": "^2.1.3",
|
|
@@ -179,12 +179,12 @@
|
|
|
179
179
|
"strip-ansi": "^6.0.0",
|
|
180
180
|
"style-loader": "^4.0.0",
|
|
181
181
|
"terser": "^5.43.1",
|
|
182
|
-
"three": "^0.
|
|
182
|
+
"three": "^0.180.0",
|
|
183
183
|
"tinybench": "^5.0.0",
|
|
184
184
|
"toml": "^3.0.0",
|
|
185
185
|
"tooling": "webpack/tooling#v1.24.3",
|
|
186
186
|
"ts-loader": "^9.5.1",
|
|
187
|
-
"typescript": "^5.9.
|
|
187
|
+
"typescript": "^5.9.3",
|
|
188
188
|
"url-loader": "^4.1.0",
|
|
189
189
|
"wast-loader": "^1.12.1",
|
|
190
190
|
"webassembly-feature": "1.3.0",
|