webpack 5.100.2 → 5.101.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 +12 -10
- package/bin/webpack.js +7 -7
- package/lib/APIPlugin.js +12 -14
- package/lib/AutomaticPrefetchPlugin.js +2 -2
- package/lib/BannerPlugin.js +4 -4
- package/lib/Cache.js +1 -1
- package/lib/CacheFacade.js +7 -7
- package/lib/CaseSensitiveModulesWarning.js +2 -2
- package/lib/Chunk.js +3 -3
- package/lib/ChunkGraph.js +21 -18
- package/lib/ChunkGroup.js +4 -4
- package/lib/CleanPlugin.js +19 -53
- package/lib/CodeGenerationResults.js +3 -3
- package/lib/CompatibilityPlugin.js +6 -6
- package/lib/Compilation.js +126 -113
- package/lib/Compiler.js +37 -37
- package/lib/ConcatenationScope.js +39 -1
- package/lib/ConstPlugin.js +11 -11
- package/lib/ContextExclusionPlugin.js +3 -3
- package/lib/ContextModule.js +12 -11
- package/lib/ContextModuleFactory.js +11 -11
- package/lib/ContextReplacementPlugin.js +5 -5
- package/lib/DefinePlugin.js +24 -22
- package/lib/DelegatedModuleFactoryPlugin.js +1 -1
- package/lib/DllEntryPlugin.js +1 -1
- package/lib/DllReferencePlugin.js +1 -1
- package/lib/DynamicEntryPlugin.js +3 -3
- package/lib/EntryPlugin.js +1 -1
- package/lib/EnvironmentPlugin.js +1 -1
- package/lib/ErrorHelpers.js +2 -2
- package/lib/EvalDevToolModulePlugin.js +2 -2
- package/lib/EvalSourceMapDevToolPlugin.js +5 -5
- package/lib/ExportsInfo.js +9 -9
- package/lib/ExportsInfoApiPlugin.js +2 -2
- package/lib/ExternalModule.js +163 -48
- package/lib/ExternalModuleFactoryPlugin.js +2 -2
- package/lib/ExternalsPlugin.js +45 -0
- package/lib/FileSystemInfo.js +64 -61
- package/lib/FlagAllModulesAsUsedPlugin.js +2 -2
- package/lib/FlagDependencyExportsPlugin.js +7 -7
- package/lib/FlagDependencyUsagePlugin.js +4 -4
- package/lib/FlagEntryExportAsUsedPlugin.js +1 -1
- package/lib/HotModuleReplacementPlugin.js +27 -27
- package/lib/IgnorePlugin.js +3 -3
- package/lib/IgnoreWarningsPlugin.js +4 -4
- package/lib/InitFragment.js +6 -0
- package/lib/InvalidDependenciesModuleWarning.js +1 -1
- package/lib/JavascriptMetaInfoPlugin.js +1 -1
- package/lib/LibManifestPlugin.js +2 -2
- package/lib/LoaderOptionsPlugin.js +1 -1
- package/lib/LoaderTargetPlugin.js +2 -2
- package/lib/MainTemplate.js +1 -1
- package/lib/Module.js +1 -1
- package/lib/ModuleFilenameHelpers.js +3 -3
- package/lib/ModuleGraph.js +9 -5
- package/lib/ModuleInfoHeaderPlugin.js +3 -3
- package/lib/ModuleParseError.js +5 -3
- package/lib/MultiCompiler.js +29 -24
- package/lib/MultiStats.js +18 -13
- package/lib/MultiWatching.js +1 -1
- package/lib/NoEmitOnErrorsPlugin.js +2 -2
- package/lib/NodeStuffPlugin.js +27 -15
- package/lib/NormalModule.js +23 -23
- package/lib/NormalModuleFactory.js +23 -21
- package/lib/NormalModuleReplacementPlugin.js +3 -3
- package/lib/PrefetchPlugin.js +1 -1
- package/lib/ProgressPlugin.js +11 -11
- package/lib/ProvidePlugin.js +2 -2
- package/lib/RecordIdsPlugin.js +3 -3
- package/lib/ResolverFactory.js +3 -3
- package/lib/RuntimeGlobals.js +20 -0
- package/lib/RuntimePlugin.js +16 -16
- package/lib/RuntimeTemplate.js +35 -26
- package/lib/SizeFormatHelpers.js +1 -1
- package/lib/SourceMapDevToolModuleOptionsPlugin.js +4 -4
- package/lib/SourceMapDevToolPlugin.js +9 -9
- package/lib/Stats.js +2 -2
- package/lib/Template.js +1 -1
- package/lib/TemplatedPathPlugin.js +2 -2
- package/lib/UseStrictPlugin.js +1 -1
- package/lib/WarnCaseSensitiveModulesPlugin.js +1 -1
- package/lib/WarnDeprecatedOptionPlugin.js +1 -1
- package/lib/WarnNoModeSetPlugin.js +1 -1
- package/lib/WatchIgnorePlugin.js +2 -2
- package/lib/Watching.js +12 -12
- package/lib/WebpackIsIncludedPlugin.js +2 -2
- package/lib/WebpackOptionsApply.js +3 -3
- package/lib/asset/AssetGenerator.js +1 -1
- package/lib/asset/AssetModulesPlugin.js +6 -6
- package/lib/async-modules/AsyncModuleHelpers.js +1 -1
- package/lib/async-modules/AwaitDependenciesInitFragment.js +36 -24
- package/lib/async-modules/InferAsyncModulesPlugin.js +3 -3
- package/lib/buildChunkGraph.js +5 -5
- package/lib/cache/AddBuildDependenciesPlugin.js +1 -1
- package/lib/cache/IdleFileCachePlugin.js +5 -5
- package/lib/cache/PackFileCacheStrategy.js +20 -20
- package/lib/cache/ResolverCachePlugin.js +4 -4
- package/lib/cli.js +196 -14
- package/lib/config/browserslistTargetHandler.js +6 -6
- package/lib/config/defaults.js +23 -14
- package/lib/config/normalization.js +41 -38
- package/lib/config/target.js +4 -4
- package/lib/container/ContainerEntryModule.js +3 -3
- package/lib/container/ContainerPlugin.js +3 -3
- package/lib/container/ContainerReferencePlugin.js +3 -3
- package/lib/container/FallbackModule.js +1 -1
- package/lib/container/HoistContainerReferencesPlugin.js +7 -7
- package/lib/container/options.js +4 -4
- package/lib/css/CssGenerator.js +5 -3
- package/lib/css/CssLoadingRuntimeModule.js +1 -1
- package/lib/css/CssModulesPlugin.js +25 -22
- package/lib/css/CssParser.js +5 -5
- package/lib/css/walkCssTokens.js +9 -9
- package/lib/debug/ProfilingPlugin.js +5 -5
- package/lib/dependencies/AMDDefineDependencyParserPlugin.js +4 -4
- package/lib/dependencies/AMDPlugin.js +3 -3
- package/lib/dependencies/AMDRequireArrayDependency.js +1 -1
- package/lib/dependencies/AMDRequireDependenciesBlockParserPlugin.js +3 -3
- package/lib/dependencies/CommonJsExportRequireDependency.js +2 -2
- package/lib/dependencies/CommonJsExportsParserPlugin.js +12 -10
- package/lib/dependencies/CommonJsImportsParserPlugin.js +21 -19
- package/lib/dependencies/CommonJsPlugin.js +2 -2
- package/lib/dependencies/ContextDependency.js +1 -1
- package/lib/dependencies/ContextDependencyHelpers.js +3 -3
- package/lib/dependencies/CssIcssExportDependency.js +2 -2
- package/lib/dependencies/CssLocalIdentifierDependency.js +2 -2
- package/lib/dependencies/CssUrlDependency.js +4 -4
- package/lib/dependencies/DynamicExports.js +5 -5
- package/lib/dependencies/HarmonyAcceptDependency.js +39 -5
- package/lib/dependencies/HarmonyDetectionParserPlugin.js +2 -2
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +17 -13
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +7 -8
- package/lib/dependencies/HarmonyExportInitFragment.js +1 -1
- package/lib/dependencies/HarmonyExports.js +1 -1
- package/lib/dependencies/HarmonyImportDependency.js +28 -9
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +56 -48
- package/lib/dependencies/HarmonyImportSideEffectDependency.js +4 -5
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +3 -4
- package/lib/dependencies/HarmonyModulesPlugin.js +2 -8
- package/lib/dependencies/HarmonyTopLevelThisParserPlugin.js +1 -1
- package/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +4 -4
- package/lib/dependencies/ImportMetaPlugin.js +7 -7
- package/lib/dependencies/ImportParserPlugin.js +4 -4
- package/lib/dependencies/JsonExportsDependency.js +1 -1
- package/lib/dependencies/LoaderPlugin.js +4 -4
- package/lib/dependencies/ProvidedDependency.js +2 -2
- package/lib/dependencies/PureExpressionDependency.js +1 -1
- package/lib/dependencies/RequireContextDependencyParserPlugin.js +1 -1
- package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +1 -1
- package/lib/dependencies/RequireIncludeDependencyParserPlugin.js +3 -3
- package/lib/dependencies/SystemPlugin.js +3 -3
- package/lib/dependencies/WorkerPlugin.js +5 -5
- package/lib/dependencies/getFunctionExpression.js +1 -1
- package/lib/esm/ModuleChunkFormatPlugin.js +5 -5
- package/lib/esm/ModuleChunkLoadingPlugin.js +2 -2
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +15 -11
- package/lib/formatLocation.js +2 -2
- package/lib/hmr/HotModuleReplacement.runtime.js +39 -27
- package/lib/hmr/JavascriptHotModuleReplacement.runtime.js +43 -32
- package/lib/hmr/JavascriptHotModuleReplacementHelper.js +1 -1
- package/lib/hmr/LazyCompilationPlugin.js +6 -6
- package/lib/hmr/lazyCompilationBackend.js +6 -6
- package/lib/ids/ChunkModuleIdRangePlugin.js +4 -4
- package/lib/ids/DeterministicChunkIdsPlugin.js +5 -4
- package/lib/ids/DeterministicModuleIdsPlugin.js +2 -2
- package/lib/ids/HashedModuleIdsPlugin.js +1 -1
- package/lib/ids/IdHelpers.js +9 -9
- package/lib/ids/NamedChunkIdsPlugin.js +5 -5
- package/lib/ids/NamedModuleIdsPlugin.js +2 -2
- package/lib/ids/NaturalChunkIdsPlugin.js +2 -2
- package/lib/ids/NaturalModuleIdsPlugin.js +1 -1
- package/lib/ids/OccurrenceChunkIdsPlugin.js +2 -2
- package/lib/ids/OccurrenceModuleIdsPlugin.js +4 -4
- package/lib/ids/SyncModuleIdsPlugin.js +4 -4
- package/lib/index.js +10 -6
- package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +1 -1
- package/lib/javascript/BasicEvaluatedExpression.js +3 -3
- package/lib/javascript/CommonJsChunkFormatPlugin.js +1 -1
- package/lib/javascript/EnableChunkLoadingPlugin.js +1 -1
- package/lib/javascript/JavascriptGenerator.js +1 -1
- package/lib/javascript/JavascriptModulesPlugin.js +16 -16
- package/lib/javascript/JavascriptParser.js +80 -78
- package/lib/javascript/JavascriptParserHelpers.js +3 -3
- package/lib/javascript/StartupHelpers.js +2 -2
- package/lib/json/JsonGenerator.js +2 -2
- package/lib/json/JsonModulesPlugin.js +2 -2
- package/lib/library/AbstractLibraryPlugin.js +3 -3
- package/lib/library/AmdLibraryPlugin.js +3 -3
- package/lib/library/AssignLibraryPlugin.js +2 -2
- package/lib/library/EnableLibraryPlugin.js +2 -2
- package/lib/library/ModuleLibraryPlugin.js +7 -2
- package/lib/library/SystemLibraryPlugin.js +6 -4
- package/lib/library/UmdLibraryPlugin.js +14 -14
- package/lib/logging/createConsoleLogger.js +4 -4
- package/lib/logging/runtime.js +3 -3
- package/lib/logging/truncateArgs.js +4 -4
- package/lib/node/CommonJsChunkLoadingPlugin.js +2 -2
- package/lib/node/NodeEnvironmentPlugin.js +1 -1
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +16 -14
- package/lib/node/ReadFileCompileAsyncWasmPlugin.js +7 -7
- package/lib/node/ReadFileCompileWasmPlugin.js +7 -7
- package/lib/node/RequireChunkLoadingRuntimeModule.js +6 -4
- package/lib/node/nodeConsole.js +2 -2
- package/lib/optimize/AggressiveMergingPlugin.js +2 -2
- package/lib/optimize/AggressiveSplittingPlugin.js +10 -10
- package/lib/optimize/ConcatenatedModule.js +161 -52
- package/lib/optimize/EnsureChunkConditionsPlugin.js +2 -2
- package/lib/optimize/FlagIncludedChunksPlugin.js +2 -2
- package/lib/optimize/InnerGraph.js +5 -5
- package/lib/optimize/InnerGraphPlugin.js +14 -12
- package/lib/optimize/LimitChunkCountPlugin.js +5 -5
- package/lib/optimize/MangleExportsPlugin.js +5 -5
- package/lib/optimize/MergeDuplicateChunksPlugin.js +2 -2
- package/lib/optimize/MinChunkSizePlugin.js +3 -3
- package/lib/optimize/ModuleConcatenationPlugin.js +45 -38
- package/lib/optimize/RealContentHashPlugin.js +23 -23
- package/lib/optimize/RemoveEmptyChunksPlugin.js +2 -2
- package/lib/optimize/RemoveParentModulesPlugin.js +3 -3
- package/lib/optimize/RuntimeChunkPlugin.js +2 -2
- package/lib/optimize/SideEffectsFlagPlugin.js +5 -5
- package/lib/optimize/SplitChunksPlugin.js +20 -20
- package/lib/performance/AssetsOverSizeLimitWarning.js +1 -1
- package/lib/performance/EntrypointsOverSizeLimitWarning.js +2 -2
- package/lib/performance/SizeLimitsPlugin.js +4 -4
- package/lib/prefetch/ChunkPrefetchPreloadPlugin.js +1 -1
- package/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js +3 -3
- package/lib/rules/BasicMatcherRulePlugin.js +1 -1
- package/lib/rules/RuleSetCompiler.js +10 -10
- package/lib/rules/UseEffectRulePlugin.js +2 -2
- package/lib/runtime/GetChunkFilenameRuntimeModule.js +15 -15
- package/lib/runtime/GetMainFilenameRuntimeModule.js +1 -1
- package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +1 -1
- package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +1 -1
- package/lib/runtime/StartupChunkDependenciesPlugin.js +2 -2
- package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +3 -3
- package/lib/schemes/DataUriPlugin.js +3 -3
- package/lib/schemes/FileUriPlugin.js +1 -1
- package/lib/schemes/HttpUriPlugin.js +40 -36
- package/lib/schemes/VirtualUrlPlugin.js +1 -1
- package/lib/serialization/BinaryMiddleware.js +11 -11
- package/lib/serialization/FileMiddleware.js +17 -17
- package/lib/serialization/ObjectMiddleware.js +8 -8
- package/lib/serialization/Serializer.js +2 -2
- package/lib/serialization/SerializerMiddleware.js +2 -2
- package/lib/sharing/ConsumeSharedPlugin.js +4 -4
- package/lib/sharing/ProvideSharedPlugin.js +4 -4
- package/lib/sharing/SharePlugin.js +1 -1
- package/lib/sharing/resolveMatchedConfigs.js +1 -1
- package/lib/stats/DefaultStatsFactoryPlugin.js +85 -80
- package/lib/stats/DefaultStatsPresetPlugin.js +15 -15
- package/lib/stats/DefaultStatsPrinterPlugin.js +87 -87
- package/lib/stats/StatsFactory.js +7 -7
- package/lib/stats/StatsPrinter.js +9 -9
- package/lib/url/URLParserPlugin.js +5 -5
- package/lib/util/AsyncQueue.js +4 -4
- package/lib/util/IterableHelpers.js +2 -2
- package/lib/util/LazyBucketSortedSet.js +3 -3
- package/lib/util/SetHelpers.js +2 -2
- package/lib/util/StackedCacheMap.js +1 -1
- package/lib/util/StackedMap.js +1 -1
- package/lib/util/TupleSet.js +1 -1
- package/lib/util/WeakTupleMap.js +1 -1
- package/lib/util/cleverMerge.js +8 -8
- package/lib/util/comparators.js +10 -10
- package/lib/util/compileBooleanMatcher.js +20 -20
- package/lib/util/concatenate.js +3 -3
- package/lib/util/conventions.js +4 -4
- package/lib/util/create-schema-validation.js +1 -1
- package/lib/util/createHash.js +1 -1
- package/lib/util/deprecation.js +4 -4
- package/lib/util/deterministicGrouping.js +7 -7
- package/lib/util/findGraphRoots.js +1 -1
- package/lib/util/fs.js +3 -3
- package/lib/util/identifier.js +14 -14
- package/lib/util/magicComment.js +5 -1
- package/lib/util/memoize.js +1 -1
- package/lib/util/processAsyncTree.js +2 -2
- package/lib/util/propertyName.js +1 -1
- package/lib/util/removeBOM.js +1 -1
- package/lib/util/runtime.js +6 -6
- package/lib/util/semver.js +16 -16
- package/lib/util/serialization.js +5 -5
- package/lib/util/smartGrouping.js +1 -1
- package/lib/validateSchema.js +2 -2
- package/lib/wasm/EnableWasmLoadingPlugin.js +1 -1
- package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +1 -1
- package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +1 -1
- package/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js +4 -4
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +13 -9
- package/lib/wasm-sync/WasmFinalizeExportsPlugin.js +2 -2
- package/lib/wasm-sync/WebAssemblyGenerator.js +14 -14
- package/lib/wasm-sync/WebAssemblyInInitialChunkError.js +4 -2
- package/lib/wasm-sync/WebAssemblyParser.js +2 -2
- package/lib/web/FetchCompileAsyncWasmPlugin.js +4 -4
- package/lib/web/FetchCompileWasmPlugin.js +4 -4
- package/lib/web/JsonpChunkLoadingPlugin.js +2 -2
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +1 -1
- package/lib/webpack.js +17 -12
- package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +2 -2
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +1 -1
- package/package.json +13 -13
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +4 -0
- package/types.d.ts +151 -44
|
@@ -47,8 +47,8 @@ const WebAssemblyUtils = require("./WebAssemblyUtils");
|
|
|
47
47
|
*/
|
|
48
48
|
const compose = (...fns) =>
|
|
49
49
|
fns.reduce(
|
|
50
|
-
(prevFn, nextFn) => value => nextFn(prevFn(value)),
|
|
51
|
-
value => value
|
|
50
|
+
(prevFn, nextFn) => (value) => nextFn(prevFn(value)),
|
|
51
|
+
(value) => value
|
|
52
52
|
);
|
|
53
53
|
|
|
54
54
|
/**
|
|
@@ -57,7 +57,7 @@ const compose = (...fns) =>
|
|
|
57
57
|
* @param {AST} state.ast Module's ast
|
|
58
58
|
* @returns {ArrayBufferTransform} transform
|
|
59
59
|
*/
|
|
60
|
-
const removeStartFunc = state => bin =>
|
|
60
|
+
const removeStartFunc = (state) => (bin) =>
|
|
61
61
|
editWithAST(state.ast, bin, {
|
|
62
62
|
Start(path) {
|
|
63
63
|
path.remove();
|
|
@@ -69,7 +69,7 @@ const removeStartFunc = state => bin =>
|
|
|
69
69
|
* @param {AST} ast Module's AST
|
|
70
70
|
* @returns {t.ModuleImport[]} - nodes
|
|
71
71
|
*/
|
|
72
|
-
const getImportedGlobals = ast => {
|
|
72
|
+
const getImportedGlobals = (ast) => {
|
|
73
73
|
/** @type {t.ModuleImport[]} */
|
|
74
74
|
const importedGlobals = [];
|
|
75
75
|
|
|
@@ -89,7 +89,7 @@ const getImportedGlobals = ast => {
|
|
|
89
89
|
* @param {AST} ast Module's AST
|
|
90
90
|
* @returns {number} - count
|
|
91
91
|
*/
|
|
92
|
-
const getCountImportedFunc = ast => {
|
|
92
|
+
const getCountImportedFunc = (ast) => {
|
|
93
93
|
let count = 0;
|
|
94
94
|
|
|
95
95
|
t.traverse(ast, {
|
|
@@ -108,7 +108,7 @@ const getCountImportedFunc = ast => {
|
|
|
108
108
|
* @param {AST} ast Module's AST
|
|
109
109
|
* @returns {t.Index} - index
|
|
110
110
|
*/
|
|
111
|
-
const getNextTypeIndex = ast => {
|
|
111
|
+
const getNextTypeIndex = (ast) => {
|
|
112
112
|
const typeSectionMetadata = t.getSectionMetadata(ast, "type");
|
|
113
113
|
|
|
114
114
|
if (typeSectionMetadata === undefined) {
|
|
@@ -144,7 +144,7 @@ const getNextFuncIndex = (ast, countImportedFunc) => {
|
|
|
144
144
|
* @param {t.GlobalType} globalType the global type
|
|
145
145
|
* @returns {t.Instruction} init expression
|
|
146
146
|
*/
|
|
147
|
-
const createDefaultInitForGlobal = globalType => {
|
|
147
|
+
const createDefaultInitForGlobal = (globalType) => {
|
|
148
148
|
if (globalType.valtype[0] === "i") {
|
|
149
149
|
// create NumberLiteral global initializer
|
|
150
150
|
return t.objectInstruction("const", globalType.valtype, [
|
|
@@ -173,7 +173,7 @@ const createDefaultInitForGlobal = globalType => {
|
|
|
173
173
|
* @param {t.Instruction[]} state.additionalInitCode list of addition instructions for the init function
|
|
174
174
|
* @returns {ArrayBufferTransform} transform
|
|
175
175
|
*/
|
|
176
|
-
const rewriteImportedGlobals = state => bin => {
|
|
176
|
+
const rewriteImportedGlobals = (state) => (bin) => {
|
|
177
177
|
const additionalInitCode = state.additionalInitCode;
|
|
178
178
|
/** @type {Array<t.Global>} */
|
|
179
179
|
const newGlobals = [];
|
|
@@ -250,7 +250,7 @@ const rewriteImportedGlobals = state => bin => {
|
|
|
250
250
|
*/
|
|
251
251
|
const rewriteExportNames =
|
|
252
252
|
({ ast, moduleGraph, module, externalExports, runtime }) =>
|
|
253
|
-
bin =>
|
|
253
|
+
(bin) =>
|
|
254
254
|
editWithAST(ast, bin, {
|
|
255
255
|
/**
|
|
256
256
|
* @param {NodePath<ModuleExport>} path path
|
|
@@ -281,7 +281,7 @@ const rewriteExportNames =
|
|
|
281
281
|
*/
|
|
282
282
|
const rewriteImports =
|
|
283
283
|
({ ast, usedDependencyMap }) =>
|
|
284
|
-
bin =>
|
|
284
|
+
(bin) =>
|
|
285
285
|
editWithAST(ast, bin, {
|
|
286
286
|
/**
|
|
287
287
|
* @param {NodePath<ModuleImport>} path path
|
|
@@ -322,8 +322,8 @@ const addInitFunction =
|
|
|
322
322
|
nextFuncIndex,
|
|
323
323
|
nextTypeIndex
|
|
324
324
|
}) =>
|
|
325
|
-
bin => {
|
|
326
|
-
const funcParams = importedGlobals.map(importedGlobal => {
|
|
325
|
+
(bin) => {
|
|
326
|
+
const funcParams = importedGlobals.map((importedGlobal) => {
|
|
327
327
|
// used for debugging
|
|
328
328
|
const id = t.identifier(
|
|
329
329
|
`${importedGlobal.module}.${importedGlobal.name}`
|
|
@@ -473,8 +473,8 @@ class WebAssemblyGenerator extends Generator {
|
|
|
473
473
|
);
|
|
474
474
|
const externalExports = new Set(
|
|
475
475
|
module.dependencies
|
|
476
|
-
.filter(d => d instanceof WebAssemblyExportImportedDependency)
|
|
477
|
-
.map(d => {
|
|
476
|
+
.filter((d) => d instanceof WebAssemblyExportImportedDependency)
|
|
477
|
+
.map((d) => {
|
|
478
478
|
const wasmDep = /** @type {WebAssemblyExportImportedDependency} */ (
|
|
479
479
|
d
|
|
480
480
|
);
|
|
@@ -42,7 +42,9 @@ const getInitialModuleChains = (
|
|
|
42
42
|
for (const connection of moduleGraph.getIncomingConnections(head)) {
|
|
43
43
|
const newHead = connection.originModule;
|
|
44
44
|
if (newHead) {
|
|
45
|
-
if (
|
|
45
|
+
if (
|
|
46
|
+
!chunkGraph.getModuleChunks(newHead).some((c) => c.canBeInitial())
|
|
47
|
+
) {
|
|
46
48
|
continue;
|
|
47
49
|
}
|
|
48
50
|
final = false;
|
|
@@ -97,7 +99,7 @@ module.exports = class WebAssemblyInInitialChunkError extends WebpackError {
|
|
|
97
99
|
const message = `WebAssembly module is included in initial chunk.
|
|
98
100
|
This is not allowed, because WebAssembly download and compilation must happen asynchronous.
|
|
99
101
|
Add an async split point (i. e. import()) somewhere between your entrypoint and the WebAssembly module:
|
|
100
|
-
${moduleChains.map(s => `* ${s}`).join("\n")}`;
|
|
102
|
+
${moduleChains.map((s) => `* ${s}`).join("\n")}`;
|
|
101
103
|
|
|
102
104
|
super(message);
|
|
103
105
|
this.name = "WebAssemblyInInitialChunkError";
|
|
@@ -27,7 +27,7 @@ const JS_COMPAT_TYPES = new Set(["i32", "i64", "f32", "f64", "externref"]);
|
|
|
27
27
|
* @param {t.Signature} signature the func signature
|
|
28
28
|
* @returns {null | string} the type incompatible with js types
|
|
29
29
|
*/
|
|
30
|
-
const getJsIncompatibleType = signature => {
|
|
30
|
+
const getJsIncompatibleType = (signature) => {
|
|
31
31
|
for (const param of signature.params) {
|
|
32
32
|
if (!JS_COMPAT_TYPES.has(param.valtype)) {
|
|
33
33
|
return `${param.valtype} as parameter`;
|
|
@@ -44,7 +44,7 @@ const getJsIncompatibleType = signature => {
|
|
|
44
44
|
* @param {t.FuncSignature} signature the func signature
|
|
45
45
|
* @returns {null | string} the type incompatible with js types
|
|
46
46
|
*/
|
|
47
|
-
const getJsIncompatibleTypeOfFuncSignature = signature => {
|
|
47
|
+
const getJsIncompatibleTypeOfFuncSignature = (signature) => {
|
|
48
48
|
for (const param of signature.args) {
|
|
49
49
|
if (!JS_COMPAT_TYPES.has(param)) {
|
|
50
50
|
return `${param} as parameter`;
|
|
@@ -21,13 +21,13 @@ class FetchCompileAsyncWasmPlugin {
|
|
|
21
21
|
* @returns {void}
|
|
22
22
|
*/
|
|
23
23
|
apply(compiler) {
|
|
24
|
-
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => {
|
|
24
|
+
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
|
|
25
25
|
const globalWasmLoading = compilation.outputOptions.wasmLoading;
|
|
26
26
|
/**
|
|
27
27
|
* @param {Chunk} chunk chunk
|
|
28
28
|
* @returns {boolean} true, if wasm loading is enabled for the chunk
|
|
29
29
|
*/
|
|
30
|
-
const isEnabledForChunk = chunk => {
|
|
30
|
+
const isEnabledForChunk = (chunk) => {
|
|
31
31
|
const options = chunk.getEntryOptions();
|
|
32
32
|
const wasmLoading =
|
|
33
33
|
options && options.wasmLoading !== undefined
|
|
@@ -39,7 +39,7 @@ class FetchCompileAsyncWasmPlugin {
|
|
|
39
39
|
* @param {string} path path to the wasm file
|
|
40
40
|
* @returns {string} code to load the wasm file
|
|
41
41
|
*/
|
|
42
|
-
const generateLoadBinaryCode = path =>
|
|
42
|
+
const generateLoadBinaryCode = (path) =>
|
|
43
43
|
`fetch(${RuntimeGlobals.publicPath} + ${path})`;
|
|
44
44
|
|
|
45
45
|
compilation.hooks.runtimeRequirementInTree
|
|
@@ -49,7 +49,7 @@ class FetchCompileAsyncWasmPlugin {
|
|
|
49
49
|
if (
|
|
50
50
|
!chunkGraph.hasModuleInGraph(
|
|
51
51
|
chunk,
|
|
52
|
-
m => m.type === WEBASSEMBLY_MODULE_TYPE_ASYNC
|
|
52
|
+
(m) => m.type === WEBASSEMBLY_MODULE_TYPE_ASYNC
|
|
53
53
|
)
|
|
54
54
|
) {
|
|
55
55
|
return;
|
|
@@ -35,13 +35,13 @@ class FetchCompileWasmPlugin {
|
|
|
35
35
|
* @returns {void}
|
|
36
36
|
*/
|
|
37
37
|
apply(compiler) {
|
|
38
|
-
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => {
|
|
38
|
+
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
|
|
39
39
|
const globalWasmLoading = compilation.outputOptions.wasmLoading;
|
|
40
40
|
/**
|
|
41
41
|
* @param {Chunk} chunk chunk
|
|
42
42
|
* @returns {boolean} true, if wasm loading is enabled for the chunk
|
|
43
43
|
*/
|
|
44
|
-
const isEnabledForChunk = chunk => {
|
|
44
|
+
const isEnabledForChunk = (chunk) => {
|
|
45
45
|
const options = chunk.getEntryOptions();
|
|
46
46
|
const wasmLoading =
|
|
47
47
|
options && options.wasmLoading !== undefined
|
|
@@ -53,7 +53,7 @@ class FetchCompileWasmPlugin {
|
|
|
53
53
|
* @param {string} path path to the wasm file
|
|
54
54
|
* @returns {string} code to load the wasm file
|
|
55
55
|
*/
|
|
56
|
-
const generateLoadBinaryCode = path =>
|
|
56
|
+
const generateLoadBinaryCode = (path) =>
|
|
57
57
|
`fetch(${RuntimeGlobals.publicPath} + ${path})`;
|
|
58
58
|
|
|
59
59
|
compilation.hooks.runtimeRequirementInTree
|
|
@@ -63,7 +63,7 @@ class FetchCompileWasmPlugin {
|
|
|
63
63
|
if (
|
|
64
64
|
!chunkGraph.hasModuleInGraph(
|
|
65
65
|
chunk,
|
|
66
|
-
m => m.type === WEBASSEMBLY_MODULE_TYPE_SYNC
|
|
66
|
+
(m) => m.type === WEBASSEMBLY_MODULE_TYPE_SYNC
|
|
67
67
|
)
|
|
68
68
|
) {
|
|
69
69
|
return;
|
|
@@ -20,13 +20,13 @@ class JsonpChunkLoadingPlugin {
|
|
|
20
20
|
* @returns {void}
|
|
21
21
|
*/
|
|
22
22
|
apply(compiler) {
|
|
23
|
-
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => {
|
|
23
|
+
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
|
|
24
24
|
const globalChunkLoading = compilation.outputOptions.chunkLoading;
|
|
25
25
|
/**
|
|
26
26
|
* @param {Chunk} chunk chunk
|
|
27
27
|
* @returns {boolean} true, if wasm loading is enabled for the chunk
|
|
28
28
|
*/
|
|
29
|
-
const isEnabledForChunk = chunk => {
|
|
29
|
+
const isEnabledForChunk = (chunk) => {
|
|
30
30
|
const options = chunk.getEntryOptions();
|
|
31
31
|
const chunkLoading =
|
|
32
32
|
options && options.chunkLoading !== undefined
|
|
@@ -139,7 +139,7 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
|
|
|
139
139
|
stateExpression ? `${stateExpression} = ${stateExpression} || ` : ""
|
|
140
140
|
}{`,
|
|
141
141
|
Template.indent(
|
|
142
|
-
Array.from(initialChunkIds, id => `${JSON.stringify(id)}: 0`).join(
|
|
142
|
+
Array.from(initialChunkIds, (id) => `${JSON.stringify(id)}: 0`).join(
|
|
143
143
|
",\n"
|
|
144
144
|
)
|
|
145
145
|
),
|
package/lib/webpack.js
CHANGED
|
@@ -23,6 +23,7 @@ const memoize = require("./util/memoize");
|
|
|
23
23
|
/** @typedef {import("../declarations/WebpackOptions").WebpackPluginFunction} WebpackPluginFunction */
|
|
24
24
|
/** @typedef {import("./Compiler").WatchOptions} WatchOptions */
|
|
25
25
|
/** @typedef {import("./MultiCompiler").MultiCompilerOptions} MultiCompilerOptions */
|
|
26
|
+
/** @typedef {import("./MultiCompiler").MultiWebpackOptions} MultiWebpackOptions */
|
|
26
27
|
/** @typedef {import("./MultiStats")} MultiStats */
|
|
27
28
|
/** @typedef {import("./Stats")} Stats */
|
|
28
29
|
|
|
@@ -100,14 +101,14 @@ const createCompiler = (rawOptions, compilerIndex) => {
|
|
|
100
101
|
* @callback WebpackFunctionSingle
|
|
101
102
|
* @param {WebpackOptions} options options object
|
|
102
103
|
* @param {Callback<Stats>=} callback callback
|
|
103
|
-
* @returns {Compiler} the compiler object
|
|
104
|
+
* @returns {Compiler | null} the compiler object
|
|
104
105
|
*/
|
|
105
106
|
|
|
106
107
|
/**
|
|
107
108
|
* @callback WebpackFunctionMulti
|
|
108
|
-
* @param {
|
|
109
|
+
* @param {MultiWebpackOptions} options options objects
|
|
109
110
|
* @param {Callback<MultiStats>=} callback callback
|
|
110
|
-
* @returns {MultiCompiler} the multi compiler object
|
|
111
|
+
* @returns {MultiCompiler | null} the multi compiler object
|
|
111
112
|
*/
|
|
112
113
|
|
|
113
114
|
/**
|
|
@@ -115,14 +116,18 @@ const createCompiler = (rawOptions, compilerIndex) => {
|
|
|
115
116
|
* @param {Array<T> | T} options options
|
|
116
117
|
* @returns {Array<T>} array of options
|
|
117
118
|
*/
|
|
118
|
-
const asArray =
|
|
119
|
+
const asArray = (options) =>
|
|
120
|
+
Array.isArray(options) ? [...options] : [options];
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* @callback WebpackCallback
|
|
124
|
+
* @param {WebpackOptions | MultiWebpackOptions} options options
|
|
125
|
+
* @param {Callback<Stats> & Callback<MultiStats>=} callback callback
|
|
126
|
+
* @returns {Compiler | MultiCompiler | null} Compiler or MultiCompiler
|
|
127
|
+
*/
|
|
119
128
|
|
|
120
129
|
const webpack = /** @type {WebpackFunctionSingle & WebpackFunctionMulti} */ (
|
|
121
|
-
/**
|
|
122
|
-
* @param {WebpackOptions | (ReadonlyArray<WebpackOptions> & MultiCompilerOptions)} options options
|
|
123
|
-
* @param {Callback<Stats> & Callback<MultiStats>=} callback callback
|
|
124
|
-
* @returns {Compiler | MultiCompiler | null} Compiler or MultiCompiler
|
|
125
|
-
*/
|
|
130
|
+
/** @type {WebpackCallback} */
|
|
126
131
|
(options, callback) => {
|
|
127
132
|
const create = () => {
|
|
128
133
|
if (!asArray(options).every(webpackOptionsSchemaCheck)) {
|
|
@@ -145,8 +150,8 @@ const webpack = /** @type {WebpackFunctionSingle & WebpackFunctionMulti} */ (
|
|
|
145
150
|
options,
|
|
146
151
|
/** @type {MultiCompilerOptions} */ (options)
|
|
147
152
|
);
|
|
148
|
-
watch = options.some(options => options.watch);
|
|
149
|
-
watchOptions = options.map(options => options.watchOptions || {});
|
|
153
|
+
watch = options.some((options) => options.watch);
|
|
154
|
+
watchOptions = options.map((options) => options.watchOptions || {});
|
|
150
155
|
} else {
|
|
151
156
|
const webpackOptions = /** @type {WebpackOptions} */ (options);
|
|
152
157
|
/** @type {Compiler} */
|
|
@@ -163,7 +168,7 @@ const webpack = /** @type {WebpackFunctionSingle & WebpackFunctionMulti} */ (
|
|
|
163
168
|
compiler.watch(watchOptions, callback);
|
|
164
169
|
} else {
|
|
165
170
|
compiler.run((err, stats) => {
|
|
166
|
-
compiler.close(err2 => {
|
|
171
|
+
compiler.close((err2) => {
|
|
167
172
|
callback(
|
|
168
173
|
err || err2,
|
|
169
174
|
/** @type {options extends WebpackOptions ? Stats : MultiStats} */
|
|
@@ -25,13 +25,13 @@ class ImportScriptsChunkLoadingPlugin {
|
|
|
25
25
|
chunkLoading: "import-scripts",
|
|
26
26
|
asyncChunkLoading: true
|
|
27
27
|
}).apply(compiler);
|
|
28
|
-
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => {
|
|
28
|
+
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
|
|
29
29
|
const globalChunkLoading = compilation.outputOptions.chunkLoading;
|
|
30
30
|
/**
|
|
31
31
|
* @param {Chunk} chunk chunk
|
|
32
32
|
* @returns {boolean} true, if wasm loading is enabled for the chunk
|
|
33
33
|
*/
|
|
34
|
-
const isEnabledForChunk = chunk => {
|
|
34
|
+
const isEnabledForChunk = (chunk) => {
|
|
35
35
|
const options = chunk.getEntryOptions();
|
|
36
36
|
const chunkLoading =
|
|
37
37
|
options && options.chunkLoading !== undefined
|
|
@@ -107,7 +107,7 @@ class ImportScriptsChunkLoadingRuntimeModule extends RuntimeModule {
|
|
|
107
107
|
stateExpression ? `${stateExpression} = ${stateExpression} || ` : ""
|
|
108
108
|
}{`,
|
|
109
109
|
Template.indent(
|
|
110
|
-
Array.from(initialChunkIds, id => `${JSON.stringify(id)}: 1`).join(
|
|
110
|
+
Array.from(initialChunkIds, (id) => `${JSON.stringify(id)}: 1`).join(
|
|
111
111
|
",\n"
|
|
112
112
|
)
|
|
113
113
|
),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webpack",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.101.0",
|
|
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",
|
|
@@ -110,15 +110,15 @@
|
|
|
110
110
|
"devDependencies": {
|
|
111
111
|
"@babel/core": "^7.27.1",
|
|
112
112
|
"@babel/preset-react": "^7.27.1",
|
|
113
|
-
"@codspeed/
|
|
113
|
+
"@codspeed/core": "^4.0.1",
|
|
114
114
|
"@eslint/js": "^9.29.0",
|
|
115
|
-
"@eslint/markdown": "^7.
|
|
116
|
-
"@stylistic/eslint-plugin": "^5.
|
|
115
|
+
"@eslint/markdown": "^7.1.0",
|
|
116
|
+
"@stylistic/eslint-plugin": "^5.2.2",
|
|
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.0
|
|
121
|
+
"@types/node": "^24.1.0",
|
|
122
122
|
"@types/xxhashjs": "^0.2.4",
|
|
123
123
|
"assemblyscript": "^0.28.2",
|
|
124
124
|
"babel-loader": "^10.0.0",
|
|
@@ -133,24 +133,24 @@
|
|
|
133
133
|
"es6-promise-polyfill": "^1.2.0",
|
|
134
134
|
"eslint": "^9.29.0",
|
|
135
135
|
"eslint-config-prettier": "^10.1.1",
|
|
136
|
-
"eslint-config-webpack": "^4.
|
|
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
140
|
"eslint-plugin-n": "^17.21.0",
|
|
141
141
|
"eslint-plugin-prettier": "^5.5.0",
|
|
142
|
-
"eslint-plugin-unicorn": "^
|
|
142
|
+
"eslint-plugin-unicorn": "^60.0.0",
|
|
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.0.5",
|
|
150
|
+
"jest-circus": "^30.0.5",
|
|
151
|
+
"jest-cli": "^30.0.5",
|
|
152
|
+
"jest-diff": "^30.0.5",
|
|
153
|
+
"jest-environment-node": "^30.0.5",
|
|
154
154
|
"jest-junit": "^16.0.0",
|
|
155
155
|
"json-loader": "^0.5.7",
|
|
156
156
|
"json5": "^2.1.3",
|
|
@@ -167,7 +167,7 @@
|
|
|
167
167
|
"open-cli": "^8.0.0",
|
|
168
168
|
"prettier": "^3.6.0",
|
|
169
169
|
"prettier-2": "npm:prettier@^2",
|
|
170
|
-
"pretty-format": "^30.0.
|
|
170
|
+
"pretty-format": "^30.0.5",
|
|
171
171
|
"pug": "^3.0.3",
|
|
172
172
|
"pug-loader": "^2.4.0",
|
|
173
173
|
"raw-loader": "^4.0.1",
|