webpack 5.94.0 → 5.96.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 +1 -1
- package/lib/AsyncDependenciesBlock.js +1 -1
- package/lib/BannerPlugin.js +2 -1
- package/lib/Chunk.js +30 -0
- package/lib/ChunkGraph.js +11 -6
- package/lib/ChunkGroup.js +2 -2
- package/lib/CleanPlugin.js +4 -5
- package/lib/CodeGenerationResults.js +6 -5
- package/lib/Compilation.js +71 -48
- package/lib/Compiler.js +7 -5
- package/lib/ConcatenationScope.js +7 -20
- package/lib/ContextModule.js +7 -8
- package/lib/CssModule.js +25 -21
- package/lib/DefinePlugin.js +14 -8
- package/lib/DelegatedModule.js +3 -3
- package/lib/DllModule.js +4 -4
- package/lib/DynamicEntryPlugin.js +29 -22
- package/lib/EnvironmentPlugin.js +3 -2
- package/lib/EvalDevToolModulePlugin.js +5 -2
- package/lib/EvalSourceMapDevToolPlugin.js +5 -2
- package/lib/ExternalModule.js +118 -99
- package/lib/ExternalModuleFactoryPlugin.js +33 -9
- package/lib/FileSystemInfo.js +12 -8
- package/lib/Generator.js +5 -4
- package/lib/HotModuleReplacementPlugin.js +8 -6
- package/lib/IgnorePlugin.js +19 -1
- package/lib/LoaderOptionsPlugin.js +3 -1
- package/lib/Module.js +9 -8
- package/lib/ModuleSourceTypesConstants.js +100 -0
- package/lib/NormalModule.js +27 -13
- package/lib/NormalModuleFactory.js +38 -22
- package/lib/OptionsApply.js +12 -1
- package/lib/ProgressPlugin.js +50 -10
- package/lib/RawModule.js +3 -4
- package/lib/RuntimeModule.js +3 -4
- package/lib/RuntimePlugin.js +11 -4
- package/lib/RuntimeTemplate.js +13 -42
- package/lib/SourceMapDevToolPlugin.js +10 -7
- package/lib/TemplatedPathPlugin.js +9 -3
- package/lib/Watching.js +2 -2
- package/lib/WebpackOptionsApply.js +42 -21
- package/lib/asset/AssetGenerator.js +347 -194
- package/lib/asset/AssetModulesPlugin.js +2 -1
- package/lib/asset/AssetSourceGenerator.js +82 -27
- package/lib/asset/RawDataUrlModule.js +5 -4
- package/lib/buildChunkGraph.js +79 -62
- package/lib/cache/PackFileCacheStrategy.js +69 -31
- package/lib/cache/ResolverCachePlugin.js +248 -173
- package/lib/config/defaults.js +135 -126
- package/lib/container/ContainerEntryModule.js +3 -4
- package/lib/container/ContainerPlugin.js +8 -0
- package/lib/container/FallbackModule.js +2 -2
- package/lib/container/HoistContainerReferencesPlugin.js +250 -0
- package/lib/container/ModuleFederationPlugin.js +38 -1
- package/lib/container/RemoteModule.js +4 -2
- package/lib/container/RemoteRuntimeModule.js +4 -2
- package/lib/css/CssExportsGenerator.js +16 -12
- package/lib/css/CssGenerator.js +22 -16
- package/lib/css/CssLoadingRuntimeModule.js +7 -6
- package/lib/css/CssModulesPlugin.js +122 -77
- package/lib/css/CssParser.js +655 -526
- package/lib/css/walkCssTokens.js +1168 -338
- package/lib/debug/ProfilingPlugin.js +5 -0
- package/lib/dependencies/CommonJsExportsParserPlugin.js +5 -2
- package/lib/dependencies/CommonJsImportsParserPlugin.js +3 -6
- package/lib/dependencies/ContextDependency.js +6 -1
- package/lib/dependencies/ContextElementDependency.js +33 -6
- package/lib/dependencies/CssExportDependency.js +3 -3
- package/lib/dependencies/CssLocalIdentifierDependency.js +26 -17
- package/lib/dependencies/CssUrlDependency.js +33 -3
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +3 -3
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +39 -14
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +15 -82
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +5 -2
- package/lib/dependencies/ImportParserPlugin.js +9 -7
- package/lib/dependencies/LoaderPlugin.js +19 -0
- package/lib/dependencies/SystemPlugin.js +2 -1
- package/lib/dependencies/URLPlugin.js +7 -1
- package/lib/dependencies/WorkerPlugin.js +1 -1
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +4 -2
- package/lib/hmr/HotModuleReplacement.runtime.js +1 -0
- package/lib/hmr/JavascriptHotModuleReplacement.runtime.js +1 -0
- package/lib/hmr/LazyCompilationPlugin.js +16 -4
- package/lib/hmr/lazyCompilationBackend.js +1 -7
- package/lib/index.js +35 -6
- package/lib/javascript/EnableChunkLoadingPlugin.js +2 -2
- package/lib/javascript/JavascriptGenerator.js +8 -8
- package/lib/javascript/JavascriptModulesPlugin.js +166 -88
- package/lib/javascript/JavascriptParser.js +338 -117
- package/lib/json/JsonGenerator.js +5 -5
- package/lib/library/EnableLibraryPlugin.js +2 -2
- package/lib/library/ExportPropertyLibraryPlugin.js +1 -1
- package/lib/library/UmdLibraryPlugin.js +16 -8
- package/lib/logging/Logger.js +11 -11
- package/lib/logging/createConsoleLogger.js +14 -14
- package/lib/logging/truncateArgs.js +1 -1
- package/lib/node/NodeWatchFileSystem.js +3 -1
- package/lib/node/ReadFileCompileAsyncWasmPlugin.js +20 -18
- package/lib/node/ReadFileCompileWasmPlugin.js +1 -2
- package/lib/node/nodeConsole.js +11 -8
- package/lib/optimize/AggressiveSplittingPlugin.js +21 -7
- package/lib/optimize/ConcatenatedModule.js +44 -148
- package/lib/optimize/FlagIncludedChunksPlugin.js +6 -0
- package/lib/optimize/InnerGraphPlugin.js +57 -16
- package/lib/optimize/LimitChunkCountPlugin.js +2 -4
- package/lib/optimize/MergeDuplicateChunksPlugin.js +2 -2
- package/lib/optimize/ModuleConcatenationPlugin.js +4 -2
- package/lib/optimize/RealContentHashPlugin.js +1 -1
- package/lib/optimize/SideEffectsFlagPlugin.js +6 -3
- package/lib/rules/RuleSetCompiler.js +2 -2
- package/lib/runtime/GetChunkFilenameRuntimeModule.js +2 -2
- package/lib/schemes/DataUriPlugin.js +1 -1
- package/lib/serialization/BinaryMiddleware.js +32 -19
- package/lib/serialization/ObjectMiddleware.js +23 -9
- package/lib/serialization/SerializerMiddleware.js +3 -2
- package/lib/serialization/types.js +2 -2
- package/lib/sharing/ConsumeSharedModule.js +2 -3
- package/lib/sharing/ConsumeSharedRuntimeModule.js +3 -1
- package/lib/sharing/ProvideSharedModule.js +2 -3
- package/lib/stats/DefaultStatsFactoryPlugin.js +22 -20
- package/lib/stats/StatsFactory.js +12 -12
- package/lib/stats/StatsPrinter.js +7 -7
- package/lib/util/AsyncQueue.js +17 -1
- package/lib/util/IterableHelpers.js +1 -1
- package/lib/util/LazySet.js +12 -0
- package/lib/util/SetHelpers.js +1 -1
- package/lib/util/cleverMerge.js +48 -24
- package/lib/util/concatenate.js +227 -0
- package/lib/util/create-schema-validation.js +22 -9
- package/lib/util/deprecation.js +86 -28
- package/lib/util/fs.js +10 -10
- package/lib/util/hash/wasm-hash.js +12 -1
- package/lib/util/magicComment.js +21 -0
- package/lib/util/makeSerializable.js +24 -1
- package/lib/util/memoize.js +2 -1
- package/lib/util/runtime.js +10 -1
- package/lib/util/semver.js +130 -23
- package/lib/wasm/EnableWasmLoadingPlugin.js +2 -2
- package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +3 -3
- package/lib/wasm-async/AsyncWebAssemblyGenerator.js +5 -5
- package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +5 -5
- package/lib/wasm-sync/WebAssemblyGenerator.js +8 -9
- package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +5 -5
- package/lib/web/FetchCompileAsyncWasmPlugin.js +1 -2
- package/lib/web/FetchCompileWasmPlugin.js +1 -2
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +6 -6
- package/package.json +19 -20
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +12 -2
- package/types.d.ts +817 -269
- package/lib/util/mergeScope.js +0 -76
@@ -9,6 +9,7 @@ const { RawSource } = require("webpack-sources");
|
|
9
9
|
const { UsageState } = require("../ExportsInfo");
|
10
10
|
const Generator = require("../Generator");
|
11
11
|
const InitFragment = require("../InitFragment");
|
12
|
+
const { WEBASSEMBLY_TYPES } = require("../ModuleSourceTypesConstants");
|
12
13
|
const RuntimeGlobals = require("../RuntimeGlobals");
|
13
14
|
const Template = require("../Template");
|
14
15
|
const ModuleDependency = require("../dependencies/ModuleDependency");
|
@@ -20,18 +21,17 @@ const WebAssemblyImportDependency = require("../dependencies/WebAssemblyImportDe
|
|
20
21
|
/** @typedef {import("../DependencyTemplates")} DependencyTemplates */
|
21
22
|
/** @typedef {import("../Generator").GenerateContext} GenerateContext */
|
22
23
|
/** @typedef {import("../Module")} Module */
|
24
|
+
/** @typedef {import("../Module").SourceTypes} SourceTypes */
|
23
25
|
/** @typedef {import("../NormalModule")} NormalModule */
|
24
26
|
/** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */
|
25
27
|
|
26
|
-
const TYPES = new Set(["webassembly"]);
|
27
|
-
|
28
28
|
class WebAssemblyJavascriptGenerator extends Generator {
|
29
29
|
/**
|
30
30
|
* @param {NormalModule} module fresh module
|
31
|
-
* @returns {
|
31
|
+
* @returns {SourceTypes} available types (do not mutate)
|
32
32
|
*/
|
33
33
|
getTypes(module) {
|
34
|
-
return
|
34
|
+
return WEBASSEMBLY_TYPES;
|
35
35
|
}
|
36
36
|
|
37
37
|
/**
|
@@ -46,7 +46,7 @@ class WebAssemblyJavascriptGenerator extends Generator {
|
|
46
46
|
/**
|
47
47
|
* @param {NormalModule} module module for which the code should be generated
|
48
48
|
* @param {GenerateContext} generateContext context for generate
|
49
|
-
* @returns {Source} generated code
|
49
|
+
* @returns {Source | null} generated code
|
50
50
|
*/
|
51
51
|
generate(module, generateContext) {
|
52
52
|
const {
|
@@ -44,9 +44,8 @@ class FetchCompileAsyncWasmPlugin {
|
|
44
44
|
|
45
45
|
compilation.hooks.runtimeRequirementInTree
|
46
46
|
.for(RuntimeGlobals.instantiateWasm)
|
47
|
-
.tap("FetchCompileAsyncWasmPlugin", (chunk, set) => {
|
47
|
+
.tap("FetchCompileAsyncWasmPlugin", (chunk, set, { chunkGraph }) => {
|
48
48
|
if (!isEnabledForChunk(chunk)) return;
|
49
|
-
const chunkGraph = compilation.chunkGraph;
|
50
49
|
if (
|
51
50
|
!chunkGraph.hasModuleInGraph(
|
52
51
|
chunk,
|
@@ -58,9 +58,8 @@ class FetchCompileWasmPlugin {
|
|
58
58
|
|
59
59
|
compilation.hooks.runtimeRequirementInTree
|
60
60
|
.for(RuntimeGlobals.ensureChunkHandlers)
|
61
|
-
.tap(PLUGIN_NAME, (chunk, set) => {
|
61
|
+
.tap(PLUGIN_NAME, (chunk, set, { chunkGraph }) => {
|
62
62
|
if (!isEnabledForChunk(chunk)) return;
|
63
|
-
const chunkGraph = compilation.chunkGraph;
|
64
63
|
if (
|
65
64
|
!chunkGraph.hasModuleInGraph(
|
66
65
|
chunk,
|
@@ -103,12 +103,6 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
|
|
103
103
|
const withHmrManifest = this._runtimeRequirements.has(
|
104
104
|
RuntimeGlobals.hmrDownloadManifest
|
105
105
|
);
|
106
|
-
const withPrefetch = this._runtimeRequirements.has(
|
107
|
-
RuntimeGlobals.prefetchChunkHandlers
|
108
|
-
);
|
109
|
-
const withPreload = this._runtimeRequirements.has(
|
110
|
-
RuntimeGlobals.preloadChunkHandlers
|
111
|
-
);
|
112
106
|
const withFetchPriority = this._runtimeRequirements.has(
|
113
107
|
RuntimeGlobals.hasFetchPriority
|
114
108
|
);
|
@@ -117,6 +111,12 @@ class JsonpChunkLoadingRuntimeModule extends RuntimeModule {
|
|
117
111
|
)}]`;
|
118
112
|
const chunkGraph = /** @type {ChunkGraph} */ (this.chunkGraph);
|
119
113
|
const chunk = /** @type {Chunk} */ (this.chunk);
|
114
|
+
const withPrefetch =
|
115
|
+
this._runtimeRequirements.has(RuntimeGlobals.prefetchChunkHandlers) &&
|
116
|
+
chunk.hasChildByOrder(chunkGraph, "prefetch", true, chunkHasJs);
|
117
|
+
const withPreload =
|
118
|
+
this._runtimeRequirements.has(RuntimeGlobals.preloadChunkHandlers) &&
|
119
|
+
chunk.hasChildByOrder(chunkGraph, "preload", true, chunkHasJs);
|
120
120
|
const conditionMap = chunkGraph.getChunkConditionMap(chunk, chunkHasJs);
|
121
121
|
const hasJsMatcher = compileBooleanMatcher(conditionMap);
|
122
122
|
const initialChunkIds = getInitialChunkIds(chunk, chunkGraph, chunkHasJs);
|
package/package.json
CHANGED
@@ -1,17 +1,16 @@
|
|
1
1
|
{
|
2
2
|
"name": "webpack",
|
3
|
-
"version": "5.
|
3
|
+
"version": "5.96.0",
|
4
4
|
"author": "Tobias Koppers @sokra",
|
5
5
|
"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.",
|
6
6
|
"license": "MIT",
|
7
7
|
"dependencies": {
|
8
|
-
"@types/estree": "^1.0.
|
8
|
+
"@types/estree": "^1.0.6",
|
9
9
|
"@webassemblyjs/ast": "^1.12.1",
|
10
10
|
"@webassemblyjs/wasm-edit": "^1.12.1",
|
11
11
|
"@webassemblyjs/wasm-parser": "^1.12.1",
|
12
|
-
"acorn": "^8.
|
13
|
-
"
|
14
|
-
"browserslist": "^4.21.10",
|
12
|
+
"acorn": "^8.14.0",
|
13
|
+
"browserslist": "^4.24.0",
|
15
14
|
"chrome-trace-event": "^1.0.2",
|
16
15
|
"enhanced-resolve": "^5.17.1",
|
17
16
|
"es-module-lexer": "^1.2.1",
|
@@ -35,16 +34,16 @@
|
|
35
34
|
}
|
36
35
|
},
|
37
36
|
"devDependencies": {
|
38
|
-
"@babel/core": "^7.
|
39
|
-
"@babel/preset-react": "^7.
|
40
|
-
"@eslint/js": "^9.
|
41
|
-
"@stylistic/eslint-plugin": "^2.
|
37
|
+
"@babel/core": "^7.25.8",
|
38
|
+
"@babel/preset-react": "^7.25.7",
|
39
|
+
"@eslint/js": "^9.12.0",
|
40
|
+
"@stylistic/eslint-plugin": "^2.9.0",
|
42
41
|
"@types/eslint-scope": "^3.7.7",
|
43
42
|
"@types/glob-to-regexp": "^0.4.4",
|
44
43
|
"@types/jest": "^29.5.11",
|
45
44
|
"@types/mime-types": "^2.1.4",
|
46
45
|
"@types/node": "^22.0.0",
|
47
|
-
"assemblyscript": "^0.27.
|
46
|
+
"assemblyscript": "^0.27.30",
|
48
47
|
"babel-loader": "^9.1.3",
|
49
48
|
"benchmark": "^2.1.4",
|
50
49
|
"bundle-loader": "^0.5.6",
|
@@ -53,16 +52,16 @@
|
|
53
52
|
"core-js": "^3.6.5",
|
54
53
|
"cspell": "^8.8.4",
|
55
54
|
"css-loader": "^7.1.2",
|
56
|
-
"date-fns": "^
|
55
|
+
"date-fns": "^4.0.0",
|
57
56
|
"es5-ext": "^0.10.53",
|
58
57
|
"es6-promise-polyfill": "^1.2.0",
|
59
|
-
"eslint": "^9.
|
58
|
+
"eslint": "^9.12.0",
|
60
59
|
"eslint-config-prettier": "^9.1.0",
|
61
60
|
"eslint-plugin-jest": "^28.6.0",
|
62
61
|
"eslint-plugin-jsdoc": "^48.10.1",
|
63
|
-
"eslint-plugin-n": "^17.
|
62
|
+
"eslint-plugin-n": "^17.11.1",
|
64
63
|
"eslint-plugin-prettier": "^5.1.3",
|
65
|
-
"eslint-plugin-unicorn": "^
|
64
|
+
"eslint-plugin-unicorn": "^56.0.0",
|
66
65
|
"file-loader": "^6.0.0",
|
67
66
|
"fork-ts-checker-webpack-plugin": "^9.0.2",
|
68
67
|
"globals": "^15.4.0",
|
@@ -83,10 +82,10 @@
|
|
83
82
|
"lint-staged": "^15.2.5",
|
84
83
|
"lodash": "^4.17.19",
|
85
84
|
"lodash-es": "^4.17.15",
|
86
|
-
"memfs": "^4.
|
85
|
+
"memfs": "^4.14.0",
|
87
86
|
"mini-css-extract-plugin": "^2.9.0",
|
88
87
|
"mini-svg-data-uri": "^1.2.3",
|
89
|
-
"nyc": "^17.
|
88
|
+
"nyc": "^17.1.0",
|
90
89
|
"open-cli": "^8.0.0",
|
91
90
|
"prettier": "^3.2.1",
|
92
91
|
"prettier-2": "npm:prettier@^2",
|
@@ -98,14 +97,14 @@
|
|
98
97
|
"react-dom": "^18.3.1",
|
99
98
|
"rimraf": "^3.0.2",
|
100
99
|
"script-loader": "^0.7.2",
|
101
|
-
"simple-git": "^3.
|
100
|
+
"simple-git": "^3.27.0",
|
102
101
|
"strip-ansi": "^6.0.0",
|
103
102
|
"style-loader": "^4.0.0",
|
104
|
-
"terser": "^5.
|
103
|
+
"terser": "^5.34.1",
|
105
104
|
"toml": "^3.0.0",
|
106
|
-
"tooling": "webpack/tooling#v1.23.
|
105
|
+
"tooling": "webpack/tooling#v1.23.5",
|
107
106
|
"ts-loader": "^9.5.1",
|
108
|
-
"typescript": "^5.
|
107
|
+
"typescript": "^5.6.2",
|
109
108
|
"url-loader": "^4.1.0",
|
110
109
|
"wast-loader": "^1.12.1",
|
111
110
|
"webassembly-feature": "1.3.0",
|