webpack 5.84.1 → 5.85.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/lib/AsyncDependenciesBlock.js +2 -2
- package/lib/AutomaticPrefetchPlugin.js +1 -0
- package/lib/BannerPlugin.js +4 -0
- package/lib/CacheFacade.js +4 -0
- package/lib/ChunkGroup.js +5 -1
- package/lib/CleanPlugin.js +30 -7
- package/lib/CompatibilityPlugin.js +1 -1
- package/lib/Compilation.js +1 -1
- package/lib/Compiler.js +1 -1
- package/lib/ContextModuleFactory.js +1 -1
- package/lib/DllModuleFactory.js +1 -1
- package/lib/HookWebpackError.js +1 -1
- package/lib/IgnoreErrorModuleFactory.js +1 -1
- package/lib/Module.js +21 -9
- package/lib/ModuleFactory.js +1 -1
- package/lib/ModuleTypeConstants.js +2 -1
- package/lib/NormalModuleFactory.js +1 -1
- package/lib/NormalModuleReplacementPlugin.js +4 -2
- package/lib/NullFactory.js +1 -1
- package/lib/RecordIdsPlugin.js +4 -4
- package/lib/RuntimeModule.js +5 -5
- package/lib/RuntimePlugin.js +4 -0
- package/lib/RuntimeTemplate.js +2 -2
- package/lib/SelfModuleFactory.js +1 -1
- package/lib/Template.js +1 -1
- package/lib/UseStrictPlugin.js +4 -0
- package/lib/WarnDeprecatedOptionPlugin.js +7 -0
- package/lib/WatchIgnorePlugin.js +4 -0
- package/lib/WebpackOptionsApply.js +2 -1
- package/lib/asset/AssetGenerator.js +7 -2
- package/lib/asset/AssetModulesPlugin.js +7 -1
- package/lib/asset/AssetParser.js +4 -1
- package/lib/asset/RawDataUrlModule.js +5 -3
- package/lib/async-modules/InferAsyncModulesPlugin.js +1 -1
- package/lib/cache/PackFileCacheStrategy.js +7 -1
- package/lib/config/defaults.js +38 -10
- package/lib/config/normalization.js +2 -1
- package/lib/container/ContainerEntryModule.js +4 -0
- package/lib/container/ContainerEntryModuleFactory.js +1 -1
- package/lib/container/FallbackDependency.js +7 -0
- package/lib/container/FallbackItemDependency.js +3 -0
- package/lib/container/FallbackModule.js +4 -0
- package/lib/container/FallbackModuleFactory.js +1 -1
- package/lib/container/RemoteModule.js +4 -0
- package/lib/container/RemoteRuntimeModule.js +1 -0
- package/lib/container/RemoteToExternalDependency.js +3 -0
- package/lib/dependencies/CommonJsPlugin.js +14 -12
- package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +1 -1
- package/lib/dependencies/HarmonyExports.js +3 -1
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +18 -5
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +75 -6
- package/lib/dependencies/WorkerPlugin.js +25 -1
- package/lib/esm/ModuleChunkFormatPlugin.js +13 -5
- package/lib/esm/ModuleChunkLoadingPlugin.js +9 -0
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +10 -8
- package/lib/hmr/LazyCompilationPlugin.js +1 -1
- 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 +8 -1
- 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/SyncModuleIdsPlugin.js +2 -2
- package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +1 -1
- package/lib/javascript/BasicEvaluatedExpression.js +11 -1
- package/lib/javascript/ChunkHelpers.js +2 -2
- package/lib/javascript/EnableChunkLoadingPlugin.js +4 -0
- package/lib/javascript/JavascriptModulesPlugin.js +24 -19
- package/lib/javascript/JavascriptParser.js +40 -16
- package/lib/javascript/StartupHelpers.js +1 -1
- package/lib/json/JsonGenerator.js +7 -5
- package/lib/json/JsonParser.js +1 -1
- package/lib/library/AbstractLibraryPlugin.js +4 -0
- package/lib/library/AssignLibraryPlugin.js +6 -4
- package/lib/library/ExportPropertyLibraryPlugin.js +4 -1
- package/lib/library/ModuleLibraryPlugin.js +6 -3
- package/lib/library/SystemLibraryPlugin.js +1 -0
- package/lib/library/UmdLibraryPlugin.js +4 -0
- package/lib/node/CommonJsChunkLoadingPlugin.js +17 -2
- package/lib/node/NodeTemplatePlugin.js +10 -2
- package/lib/node/NodeWatchFileSystem.js +1 -1
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +4 -1
- package/lib/node/ReadFileCompileAsyncWasmPlugin.js +8 -0
- package/lib/node/ReadFileCompileWasmPlugin.js +19 -2
- package/lib/node/RequireChunkLoadingRuntimeModule.js +4 -1
- package/lib/runtime/AsyncModuleRuntimeModule.js +1 -1
- package/lib/runtime/AutoPublicPathRuntimeModule.js +5 -1
- package/lib/runtime/BaseUriRuntimeModule.js +5 -1
- package/lib/runtime/EnsureChunkRuntimeModule.js +3 -0
- package/lib/runtime/GetChunkFilenameRuntimeModule.js +35 -16
- package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +1 -1
- package/lib/runtime/LoadScriptRuntimeModule.js +1 -1
- package/lib/runtime/PublicPathRuntimeModule.js +5 -0
- package/lib/runtime/StartupChunkDependenciesPlugin.js +15 -0
- package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +3 -0
- package/lib/runtime/StartupEntrypointRuntimeModule.js +3 -0
- package/lib/sharing/ProvideSharedModuleFactory.js +1 -1
- package/lib/util/createHash.js +1 -1
- package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +9 -0
- package/lib/wasm-async/AsyncWebAssemblyGenerator.js +9 -1
- package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +13 -3
- package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +19 -2
- package/lib/wasm-async/AsyncWebAssemblyParser.js +3 -0
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +25 -1
- package/lib/wasm-sync/WasmFinalizeExportsPlugin.js +14 -5
- package/lib/wasm-sync/WebAssemblyGenerator.js +18 -5
- package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +1 -1
- package/lib/wasm-sync/WebAssemblyModulesPlugin.js +12 -1
- package/lib/wasm-sync/WebAssemblyParser.js +9 -2
- package/lib/wasm-sync/WebAssemblyUtils.js +1 -1
- package/lib/web/FetchCompileAsyncWasmPlugin.js +9 -0
- package/lib/web/FetchCompileWasmPlugin.js +19 -2
- package/lib/web/JsonpChunkLoadingPlugin.js +9 -0
- package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +9 -0
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +1 -1
- package/package.json +1 -1
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +12 -0
- package/types.d.ts +186 -141
@@ -9,6 +9,7 @@ const { WEBASSEMBLY_MODULE_TYPE_ASYNC } = require("../ModuleTypeConstants");
|
|
9
9
|
const RuntimeGlobals = require("../RuntimeGlobals");
|
10
10
|
const AsyncWasmLoadingRuntimeModule = require("../wasm-async/AsyncWasmLoadingRuntimeModule");
|
11
11
|
|
12
|
+
/** @typedef {import("../Chunk")} Chunk */
|
12
13
|
/** @typedef {import("../Compiler")} Compiler */
|
13
14
|
|
14
15
|
class FetchCompileAsyncWasmPlugin {
|
@@ -22,6 +23,10 @@ class FetchCompileAsyncWasmPlugin {
|
|
22
23
|
"FetchCompileAsyncWasmPlugin",
|
23
24
|
compilation => {
|
24
25
|
const globalWasmLoading = compilation.outputOptions.wasmLoading;
|
26
|
+
/**
|
27
|
+
* @param {Chunk} chunk chunk
|
28
|
+
* @returns {boolean} true, if wasm loading is enabled for the chunk
|
29
|
+
*/
|
25
30
|
const isEnabledForChunk = chunk => {
|
26
31
|
const options = chunk.getEntryOptions();
|
27
32
|
const wasmLoading =
|
@@ -30,6 +35,10 @@ class FetchCompileAsyncWasmPlugin {
|
|
30
35
|
: globalWasmLoading;
|
31
36
|
return wasmLoading === "fetch";
|
32
37
|
};
|
38
|
+
/**
|
39
|
+
* @param {string} path path to the wasm file
|
40
|
+
* @returns {string} code to load the wasm file
|
41
|
+
*/
|
33
42
|
const generateLoadBinaryCode = path =>
|
34
43
|
`fetch(${RuntimeGlobals.publicPath} + ${path})`;
|
35
44
|
|
@@ -9,15 +9,24 @@ const { WEBASSEMBLY_MODULE_TYPE_SYNC } = require("../ModuleTypeConstants");
|
|
9
9
|
const RuntimeGlobals = require("../RuntimeGlobals");
|
10
10
|
const WasmChunkLoadingRuntimeModule = require("../wasm-sync/WasmChunkLoadingRuntimeModule");
|
11
11
|
|
12
|
+
/** @typedef {import("../Chunk")} Chunk */
|
12
13
|
/** @typedef {import("../Compiler")} Compiler */
|
13
14
|
|
14
15
|
// TODO webpack 6 remove
|
15
16
|
|
16
17
|
const PLUGIN_NAME = "FetchCompileWasmPlugin";
|
17
18
|
|
19
|
+
/**
|
20
|
+
* @typedef {Object} FetchCompileWasmPluginOptions
|
21
|
+
* @property {boolean} [mangleImports] mangle imports
|
22
|
+
*/
|
23
|
+
|
18
24
|
class FetchCompileWasmPlugin {
|
19
|
-
|
20
|
-
|
25
|
+
/**
|
26
|
+
* @param {FetchCompileWasmPluginOptions} [options] options
|
27
|
+
*/
|
28
|
+
constructor(options = {}) {
|
29
|
+
this.options = options;
|
21
30
|
}
|
22
31
|
|
23
32
|
/**
|
@@ -28,6 +37,10 @@ class FetchCompileWasmPlugin {
|
|
28
37
|
apply(compiler) {
|
29
38
|
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => {
|
30
39
|
const globalWasmLoading = compilation.outputOptions.wasmLoading;
|
40
|
+
/**
|
41
|
+
* @param {Chunk} chunk chunk
|
42
|
+
* @returns {boolean} true, if wasm loading is enabled for the chunk
|
43
|
+
*/
|
31
44
|
const isEnabledForChunk = chunk => {
|
32
45
|
const options = chunk.getEntryOptions();
|
33
46
|
const wasmLoading =
|
@@ -36,6 +49,10 @@ class FetchCompileWasmPlugin {
|
|
36
49
|
: globalWasmLoading;
|
37
50
|
return wasmLoading === "fetch";
|
38
51
|
};
|
52
|
+
/**
|
53
|
+
* @param {string} path path to the wasm file
|
54
|
+
* @returns {string} code to load the wasm file
|
55
|
+
*/
|
39
56
|
const generateLoadBinaryCode = path =>
|
40
57
|
`fetch(${RuntimeGlobals.publicPath} + ${path})`;
|
41
58
|
|
@@ -8,6 +8,7 @@
|
|
8
8
|
const RuntimeGlobals = require("../RuntimeGlobals");
|
9
9
|
const JsonpChunkLoadingRuntimeModule = require("./JsonpChunkLoadingRuntimeModule");
|
10
10
|
|
11
|
+
/** @typedef {import("../Chunk")} Chunk */
|
11
12
|
/** @typedef {import("../Compiler")} Compiler */
|
12
13
|
|
13
14
|
class JsonpChunkLoadingPlugin {
|
@@ -21,6 +22,10 @@ class JsonpChunkLoadingPlugin {
|
|
21
22
|
"JsonpChunkLoadingPlugin",
|
22
23
|
compilation => {
|
23
24
|
const globalChunkLoading = compilation.outputOptions.chunkLoading;
|
25
|
+
/**
|
26
|
+
* @param {Chunk} chunk chunk
|
27
|
+
* @returns {boolean} true, if wasm loading is enabled for the chunk
|
28
|
+
*/
|
24
29
|
const isEnabledForChunk = chunk => {
|
25
30
|
const options = chunk.getEntryOptions();
|
26
31
|
const chunkLoading =
|
@@ -30,6 +35,10 @@ class JsonpChunkLoadingPlugin {
|
|
30
35
|
return chunkLoading === "jsonp";
|
31
36
|
};
|
32
37
|
const onceForChunkSet = new WeakSet();
|
38
|
+
/**
|
39
|
+
* @param {Chunk} chunk chunk
|
40
|
+
* @param {Set<string>} set runtime requirements
|
41
|
+
*/
|
33
42
|
const handler = (chunk, set) => {
|
34
43
|
if (onceForChunkSet.has(chunk)) return;
|
35
44
|
onceForChunkSet.add(chunk);
|
@@ -9,6 +9,7 @@ const RuntimeGlobals = require("../RuntimeGlobals");
|
|
9
9
|
const StartupChunkDependenciesPlugin = require("../runtime/StartupChunkDependenciesPlugin");
|
10
10
|
const ImportScriptsChunkLoadingRuntimeModule = require("./ImportScriptsChunkLoadingRuntimeModule");
|
11
11
|
|
12
|
+
/** @typedef {import("../Chunk")} Chunk */
|
12
13
|
/** @typedef {import("../Compiler")} Compiler */
|
13
14
|
|
14
15
|
class ImportScriptsChunkLoadingPlugin {
|
@@ -26,6 +27,10 @@ class ImportScriptsChunkLoadingPlugin {
|
|
26
27
|
"ImportScriptsChunkLoadingPlugin",
|
27
28
|
compilation => {
|
28
29
|
const globalChunkLoading = compilation.outputOptions.chunkLoading;
|
30
|
+
/**
|
31
|
+
* @param {Chunk} chunk chunk
|
32
|
+
* @returns {boolean} true, if wasm loading is enabled for the chunk
|
33
|
+
*/
|
29
34
|
const isEnabledForChunk = chunk => {
|
30
35
|
const options = chunk.getEntryOptions();
|
31
36
|
const chunkLoading =
|
@@ -35,6 +40,10 @@ class ImportScriptsChunkLoadingPlugin {
|
|
35
40
|
return chunkLoading === "import-scripts";
|
36
41
|
};
|
37
42
|
const onceForChunkSet = new WeakSet();
|
43
|
+
/**
|
44
|
+
* @param {Chunk} chunk chunk
|
45
|
+
* @param {Set<string>} set runtime requirements
|
46
|
+
*/
|
38
47
|
const handler = (chunk, set) => {
|
39
48
|
if (onceForChunkSet.has(chunk)) return;
|
40
49
|
onceForChunkSet.add(chunk);
|
@@ -47,7 +47,7 @@ class ImportScriptsChunkLoadingRuntimeModule extends RuntimeModule {
|
|
47
47
|
);
|
48
48
|
const rootOutputDir = getUndoPath(
|
49
49
|
outputName,
|
50
|
-
this.compilation.outputOptions.path,
|
50
|
+
/** @type {string} */ (this.compilation.outputOptions.path),
|
51
51
|
false
|
52
52
|
);
|
53
53
|
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.85.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",
|