webpack 5.59.1 → 5.62.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.
Potentially problematic release.
This version of webpack might be problematic. Click here for more details.
- package/hot/lazy-compilation-node.js +3 -1
- package/lib/Chunk.js +3 -2
- package/lib/Compilation.js +29 -16
- package/lib/Compiler.js +13 -11
- package/lib/HotModuleReplacementPlugin.js +3 -1
- package/lib/NormalModule.js +9 -3
- package/lib/WebpackOptionsApply.js +12 -9
- package/lib/cache/PackFileCacheStrategy.js +7 -4
- package/lib/config/defaults.js +4 -6
- package/lib/dependencies/AMDRequireDependency.js +6 -6
- package/lib/dependencies/CommonJsFullRequireDependency.js +5 -1
- package/lib/dependencies/CommonJsImportsParserPlugin.js +3 -1
- package/lib/dependencies/CommonJsRequireContextDependency.js +5 -1
- package/lib/dependencies/ContextDependency.js +1 -0
- package/lib/dependencies/ContextDependencyTemplateAsRequireCall.js +4 -1
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +12 -3
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +25 -17
- package/lib/dependencies/HarmonyImportDependency.js +21 -0
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +17 -4
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +24 -14
- package/lib/dependencies/RequireEnsureDependency.js +2 -2
- package/lib/hmr/LazyCompilationPlugin.js +9 -5
- package/lib/hmr/lazyCompilationBackend.js +47 -10
- package/lib/node/NodeTargetPlugin.js +2 -0
- package/lib/node/RequireChunkLoadingRuntimeModule.js +1 -1
- package/lib/optimize/ModuleConcatenationPlugin.js +5 -2
- package/lib/optimize/SplitChunksPlugin.js +8 -1
- package/lib/runtime/AsyncModuleRuntimeModule.js +2 -2
- package/lib/sharing/ConsumeSharedRuntimeModule.js +1 -1
- package/lib/sharing/ShareRuntimeModule.js +1 -1
- package/lib/util/createHash.js +12 -0
- package/lib/util/deprecation.js +10 -2
- package/lib/util/hash/BatchedHash.js +7 -4
- package/lib/util/hash/md4.js +20 -0
- package/lib/util/hash/wasm-hash.js +163 -0
- package/lib/util/hash/xxhash64.js +5 -139
- package/lib/webpack.js +1 -2
- package/module.d.ts +200 -0
- package/package.json +12 -10
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +117 -27
- package/types.d.ts +73 -22
@@ -27,6 +27,25 @@ const ModuleDependency = require("./ModuleDependency");
|
|
27
27
|
/** @typedef {import("../util/Hash")} Hash */
|
28
28
|
/** @typedef {import("../util/runtime").RuntimeSpec} RuntimeSpec */
|
29
29
|
|
30
|
+
const ExportPresenceModes = {
|
31
|
+
NONE: /** @type {0} */ (0),
|
32
|
+
WARN: /** @type {1} */ (1),
|
33
|
+
AUTO: /** @type {2} */ (2),
|
34
|
+
ERROR: /** @type {3} */ (3),
|
35
|
+
fromUserOption(str) {
|
36
|
+
switch (str) {
|
37
|
+
case "error":
|
38
|
+
return ExportPresenceModes.ERROR;
|
39
|
+
case "warn":
|
40
|
+
return ExportPresenceModes.WARN;
|
41
|
+
case false:
|
42
|
+
return ExportPresenceModes.NONE;
|
43
|
+
default:
|
44
|
+
throw new Error(`Invalid export presence value ${str}`);
|
45
|
+
}
|
46
|
+
}
|
47
|
+
};
|
48
|
+
|
30
49
|
class HarmonyImportDependency extends ModuleDependency {
|
31
50
|
/**
|
32
51
|
*
|
@@ -334,3 +353,5 @@ HarmonyImportDependency.Template = class HarmonyImportDependencyTemplate extends
|
|
334
353
|
return emittedModules.get(referencedModule) || false;
|
335
354
|
}
|
336
355
|
};
|
356
|
+
|
357
|
+
module.exports.ExportPresenceModes = ExportPresenceModes;
|
@@ -11,6 +11,7 @@ const ConstDependency = require("./ConstDependency");
|
|
11
11
|
const HarmonyAcceptDependency = require("./HarmonyAcceptDependency");
|
12
12
|
const HarmonyAcceptImportDependency = require("./HarmonyAcceptImportDependency");
|
13
13
|
const HarmonyExports = require("./HarmonyExports");
|
14
|
+
const { ExportPresenceModes } = require("./HarmonyImportDependency");
|
14
15
|
const HarmonyImportSideEffectDependency = require("./HarmonyImportSideEffectDependency");
|
15
16
|
const HarmonyImportSpecifierDependency = require("./HarmonyImportSpecifierDependency");
|
16
17
|
|
@@ -19,6 +20,7 @@ const HarmonyImportSpecifierDependency = require("./HarmonyImportSpecifierDepend
|
|
19
20
|
/** @typedef {import("estree").Identifier} Identifier */
|
20
21
|
/** @typedef {import("estree").ImportDeclaration} ImportDeclaration */
|
21
22
|
/** @typedef {import("estree").ImportExpression} ImportExpression */
|
23
|
+
/** @typedef {import("../../declarations/WebpackOptions").JavascriptParserOptions} JavascriptParserOptions */
|
22
24
|
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
|
23
25
|
/** @typedef {import("../optimize/InnerGraph").InnerGraph} InnerGraph */
|
24
26
|
/** @typedef {import("../optimize/InnerGraph").TopLevelSymbol} TopLevelSymbol */
|
@@ -60,8 +62,18 @@ function getAssertions(node) {
|
|
60
62
|
}
|
61
63
|
|
62
64
|
module.exports = class HarmonyImportDependencyParserPlugin {
|
65
|
+
/**
|
66
|
+
* @param {JavascriptParserOptions} options options
|
67
|
+
*/
|
63
68
|
constructor(options) {
|
64
|
-
this.
|
69
|
+
this.exportPresenceMode =
|
70
|
+
options.importExportPresence !== undefined
|
71
|
+
? ExportPresenceModes.fromUserOption(options.importExportPresence)
|
72
|
+
: options.exportPresence !== undefined
|
73
|
+
? ExportPresenceModes.fromUserOption(options.exportPresence)
|
74
|
+
: options.strictExportPresence
|
75
|
+
? ExportPresenceModes.ERROR
|
76
|
+
: ExportPresenceModes.AUTO;
|
65
77
|
this.strictThisContextOnImports = options.strictThisContextOnImports;
|
66
78
|
}
|
67
79
|
|
@@ -70,6 +82,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
|
|
70
82
|
* @returns {void}
|
71
83
|
*/
|
72
84
|
apply(parser) {
|
85
|
+
const { exportPresenceMode } = this;
|
73
86
|
parser.hooks.isPure
|
74
87
|
.for("Identifier")
|
75
88
|
.tap("HarmonyImportDependencyParserPlugin", expression => {
|
@@ -128,7 +141,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
|
|
128
141
|
settings.ids,
|
129
142
|
settings.name,
|
130
143
|
expr.range,
|
131
|
-
|
144
|
+
exportPresenceMode,
|
132
145
|
settings.assertions
|
133
146
|
);
|
134
147
|
dep.shorthand = parser.scope.inShorthand;
|
@@ -150,7 +163,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
|
|
150
163
|
ids,
|
151
164
|
settings.name,
|
152
165
|
expr.range,
|
153
|
-
|
166
|
+
exportPresenceMode,
|
154
167
|
settings.assertions
|
155
168
|
);
|
156
169
|
dep.asiSafe = !parser.isAsiPosition(expr.range[0]);
|
@@ -171,7 +184,7 @@ module.exports = class HarmonyImportDependencyParserPlugin {
|
|
171
184
|
ids,
|
172
185
|
settings.name,
|
173
186
|
callee.range,
|
174
|
-
|
187
|
+
exportPresenceMode,
|
175
188
|
settings.assertions
|
176
189
|
);
|
177
190
|
dep.directImport = members.length === 0;
|
@@ -28,6 +28,8 @@ const HarmonyImportDependency = require("./HarmonyImportDependency");
|
|
28
28
|
|
29
29
|
const idsSymbol = Symbol("HarmonyImportSpecifierDependency.ids");
|
30
30
|
|
31
|
+
const { ExportPresenceModes } = HarmonyImportDependency;
|
32
|
+
|
31
33
|
class HarmonyImportSpecifierDependency extends HarmonyImportDependency {
|
32
34
|
constructor(
|
33
35
|
request,
|
@@ -35,14 +37,14 @@ class HarmonyImportSpecifierDependency extends HarmonyImportDependency {
|
|
35
37
|
ids,
|
36
38
|
name,
|
37
39
|
range,
|
38
|
-
|
40
|
+
exportPresenceMode,
|
39
41
|
assertions
|
40
42
|
) {
|
41
43
|
super(request, sourceOrder, assertions);
|
42
44
|
this.ids = ids;
|
43
45
|
this.name = name;
|
44
46
|
this.range = range;
|
45
|
-
this.
|
47
|
+
this.exportPresenceMode = exportPresenceMode;
|
46
48
|
this.namespaceObjectAsContext = false;
|
47
49
|
this.call = undefined;
|
48
50
|
this.directImport = undefined;
|
@@ -153,19 +155,29 @@ class HarmonyImportSpecifierDependency extends HarmonyImportDependency {
|
|
153
155
|
return [ids];
|
154
156
|
}
|
155
157
|
|
158
|
+
/**
|
159
|
+
* @param {ModuleGraph} moduleGraph module graph
|
160
|
+
* @returns {number} effective mode
|
161
|
+
*/
|
162
|
+
_getEffectiveExportPresenceLevel(moduleGraph) {
|
163
|
+
if (this.exportPresenceMode !== ExportPresenceModes.AUTO)
|
164
|
+
return this.exportPresenceMode;
|
165
|
+
return moduleGraph.getParentModule(this).buildMeta.strictHarmonyModule
|
166
|
+
? ExportPresenceModes.ERROR
|
167
|
+
: ExportPresenceModes.WARN;
|
168
|
+
}
|
169
|
+
|
156
170
|
/**
|
157
171
|
* Returns warnings
|
158
172
|
* @param {ModuleGraph} moduleGraph module graph
|
159
173
|
* @returns {WebpackError[]} warnings
|
160
174
|
*/
|
161
175
|
getWarnings(moduleGraph) {
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
) {
|
166
|
-
return null;
|
176
|
+
const exportPresence = this._getEffectiveExportPresenceLevel(moduleGraph);
|
177
|
+
if (exportPresence === ExportPresenceModes.WARN) {
|
178
|
+
return this._getErrors(moduleGraph);
|
167
179
|
}
|
168
|
-
return
|
180
|
+
return null;
|
169
181
|
}
|
170
182
|
|
171
183
|
/**
|
@@ -174,10 +186,8 @@ class HarmonyImportSpecifierDependency extends HarmonyImportDependency {
|
|
174
186
|
* @returns {WebpackError[]} errors
|
175
187
|
*/
|
176
188
|
getErrors(moduleGraph) {
|
177
|
-
|
178
|
-
|
179
|
-
moduleGraph.getParentModule(this).buildMeta.strictHarmonyModule
|
180
|
-
) {
|
189
|
+
const exportPresence = this._getEffectiveExportPresenceLevel(moduleGraph);
|
190
|
+
if (exportPresence === ExportPresenceModes.ERROR) {
|
181
191
|
return this._getErrors(moduleGraph);
|
182
192
|
}
|
183
193
|
return null;
|
@@ -209,7 +219,7 @@ class HarmonyImportSpecifierDependency extends HarmonyImportDependency {
|
|
209
219
|
write(this.ids);
|
210
220
|
write(this.name);
|
211
221
|
write(this.range);
|
212
|
-
write(this.
|
222
|
+
write(this.exportPresenceMode);
|
213
223
|
write(this.namespaceObjectAsContext);
|
214
224
|
write(this.call);
|
215
225
|
write(this.directImport);
|
@@ -224,7 +234,7 @@ class HarmonyImportSpecifierDependency extends HarmonyImportDependency {
|
|
224
234
|
this.ids = read();
|
225
235
|
this.name = read();
|
226
236
|
this.range = read();
|
227
|
-
this.
|
237
|
+
this.exportPresenceMode = read();
|
228
238
|
this.namespaceObjectAsContext = read();
|
229
239
|
this.call = read();
|
230
240
|
this.directImport = read();
|
@@ -85,14 +85,14 @@ RequireEnsureDependency.Template = class RequireEnsureDependencyTemplate extends
|
|
85
85
|
source.replace(
|
86
86
|
contentRange[1],
|
87
87
|
errorHandlerRange[0] - 1,
|
88
|
-
").bind(null, __webpack_require__))
|
88
|
+
").bind(null, __webpack_require__))['catch']("
|
89
89
|
);
|
90
90
|
source.replace(errorHandlerRange[1], range[1] - 1, ")");
|
91
91
|
} else {
|
92
92
|
source.replace(
|
93
93
|
contentRange[1],
|
94
94
|
range[1] - 1,
|
95
|
-
`).bind(null, __webpack_require__))
|
95
|
+
`).bind(null, __webpack_require__))['catch'](${RuntimeGlobals.uncaughtErrorHandler})`
|
96
96
|
);
|
97
97
|
}
|
98
98
|
}
|
@@ -32,6 +32,12 @@ const { registerNotSerializable } = require("../util/serialization");
|
|
32
32
|
/** @typedef {import("../util/Hash")} Hash */
|
33
33
|
/** @typedef {import("../util/fs").InputFileSystem} InputFileSystem */
|
34
34
|
|
35
|
+
/**
|
36
|
+
* @typedef {Object} BackendApi
|
37
|
+
* @property {function(Error=): void} dispose
|
38
|
+
* @property {function(Module): { client: string, data: string, active: boolean }} module
|
39
|
+
*/
|
40
|
+
|
35
41
|
const IGNORED_DEPENDENCY_TYPES = new Set([
|
36
42
|
"import.meta.webpackHot.accept",
|
37
43
|
"import.meta.webpackHot.decline",
|
@@ -303,15 +309,13 @@ class LazyCompilationDependencyFactory extends ModuleFactory {
|
|
303
309
|
class LazyCompilationPlugin {
|
304
310
|
/**
|
305
311
|
* @param {Object} options options
|
306
|
-
* @param {(function(Compiler,
|
307
|
-
* @param {string} options.client the client reference
|
312
|
+
* @param {(function(Compiler, function(Error?, BackendApi?): void): void) | function(Compiler): Promise<BackendApi>} options.backend the backend
|
308
313
|
* @param {boolean} options.entries true, when entries are lazy compiled
|
309
314
|
* @param {boolean} options.imports true, when import() modules are lazy compiled
|
310
315
|
* @param {RegExp | string | (function(Module): boolean)} options.test additional filter for lazy compiled entrypoint modules
|
311
316
|
*/
|
312
|
-
constructor({ backend,
|
317
|
+
constructor({ backend, entries, imports, test }) {
|
313
318
|
this.backend = backend;
|
314
|
-
this.client = client;
|
315
319
|
this.entries = entries;
|
316
320
|
this.imports = imports;
|
317
321
|
this.test = test;
|
@@ -327,7 +331,7 @@ class LazyCompilationPlugin {
|
|
327
331
|
"LazyCompilationPlugin",
|
328
332
|
(params, callback) => {
|
329
333
|
if (backend !== undefined) return callback();
|
330
|
-
const promise = this.backend(compiler,
|
334
|
+
const promise = this.backend(compiler, (err, result) => {
|
331
335
|
if (err) return callback(err);
|
332
336
|
backend = result;
|
333
337
|
callback();
|
@@ -5,21 +5,51 @@
|
|
5
5
|
|
6
6
|
"use strict";
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
/** @typedef {import("http").ServerOptions} HttpServerOptions */
|
9
|
+
/** @typedef {import("https").ServerOptions} HttpsServerOptions */
|
10
|
+
/** @typedef {import("../../declarations/WebpackOptions").LazyCompilationDefaultBackendOptions} LazyCompilationDefaultBackendOptions */
|
10
11
|
/** @typedef {import("../Compiler")} Compiler */
|
11
12
|
|
12
13
|
/**
|
14
|
+
* @callback BackendHandler
|
13
15
|
* @param {Compiler} compiler compiler
|
14
|
-
* @param {string} client client reference
|
15
16
|
* @param {function(Error?, any?): void} callback callback
|
16
17
|
* @returns {void}
|
17
18
|
*/
|
18
|
-
|
19
|
+
|
20
|
+
/**
|
21
|
+
* @param {Omit<LazyCompilationDefaultBackendOptions, "client"> & { client: NonNullable<LazyCompilationDefaultBackendOptions["client"]>}} options additional options for the backend
|
22
|
+
* @returns {BackendHandler} backend
|
23
|
+
*/
|
24
|
+
module.exports = options => (compiler, callback) => {
|
19
25
|
const logger = compiler.getInfrastructureLogger("LazyCompilationBackend");
|
20
26
|
const activeModules = new Map();
|
21
27
|
const prefix = "/lazy-compilation-using-";
|
22
28
|
|
29
|
+
const isHttps =
|
30
|
+
options.protocol === "https" ||
|
31
|
+
(typeof options.server === "object" &&
|
32
|
+
("key" in options.server || "pfx" in options.server));
|
33
|
+
|
34
|
+
const createServer =
|
35
|
+
typeof options.server === "function"
|
36
|
+
? options.server
|
37
|
+
: (() => {
|
38
|
+
const http = isHttps ? require("https") : require("http");
|
39
|
+
return http.createServer.bind(http, options.server);
|
40
|
+
})();
|
41
|
+
const listen =
|
42
|
+
typeof options.listen === "function"
|
43
|
+
? options.listen
|
44
|
+
: server => {
|
45
|
+
let listen = options.listen;
|
46
|
+
if (typeof listen === "object" && !("port" in listen))
|
47
|
+
listen = { ...listen, port: undefined };
|
48
|
+
server.listen(listen);
|
49
|
+
};
|
50
|
+
|
51
|
+
const protocol = options.protocol || (isHttps ? "https" : "http");
|
52
|
+
|
23
53
|
const requestListener = (req, res) => {
|
24
54
|
const keys = req.url.slice(prefix.length).split("@");
|
25
55
|
req.socket.on("close", () => {
|
@@ -52,7 +82,10 @@ module.exports = (compiler, client, callback) => {
|
|
52
82
|
}
|
53
83
|
if (moduleActivated && compiler.watching) compiler.watching.invalidate();
|
54
84
|
};
|
55
|
-
|
85
|
+
|
86
|
+
const server = /** @type {import("net").Server} */ (createServer());
|
87
|
+
server.on("request", requestListener);
|
88
|
+
|
56
89
|
let isClosing = false;
|
57
90
|
/** @type {Set<import("net").Socket>} */
|
58
91
|
const sockets = new Set();
|
@@ -63,16 +96,19 @@ module.exports = (compiler, client, callback) => {
|
|
63
96
|
});
|
64
97
|
if (isClosing) socket.destroy();
|
65
98
|
});
|
66
|
-
server.
|
99
|
+
server.on("clientError", e => {
|
100
|
+
if (e.message !== "Server is disposing") logger.warn(e);
|
101
|
+
});
|
102
|
+
server.on("listening", err => {
|
67
103
|
if (err) return callback(err);
|
68
104
|
const addr = server.address();
|
69
105
|
if (typeof addr === "string") throw new Error("addr must not be a string");
|
70
106
|
const urlBase =
|
71
107
|
addr.address === "::" || addr.address === "0.0.0.0"
|
72
|
-
?
|
108
|
+
? `${protocol}://localhost:${addr.port}`
|
73
109
|
: addr.family === "IPv6"
|
74
|
-
?
|
75
|
-
:
|
110
|
+
? `${protocol}://[${addr.address}]:${addr.port}`
|
111
|
+
: `${protocol}://${addr.address}:${addr.port}`;
|
76
112
|
logger.log(
|
77
113
|
`Server-Sent-Events server for lazy compilation open at ${urlBase}.`
|
78
114
|
);
|
@@ -94,11 +130,12 @@ module.exports = (compiler, client, callback) => {
|
|
94
130
|
).replace(/%(2F|3A|24|26|2B|2C|3B|3D|3A)/g, decodeURIComponent)}`;
|
95
131
|
const active = activeModules.get(key) > 0;
|
96
132
|
return {
|
97
|
-
client: `${client}?${encodeURIComponent(urlBase + prefix)}`,
|
133
|
+
client: `${options.client}?${encodeURIComponent(urlBase + prefix)}`,
|
98
134
|
data: key,
|
99
135
|
active
|
100
136
|
};
|
101
137
|
}
|
102
138
|
});
|
103
139
|
});
|
140
|
+
listen(server);
|
104
141
|
};
|
@@ -211,7 +211,7 @@ class RequireChunkLoadingRuntimeModule extends RuntimeModule {
|
|
211
211
|
RuntimeGlobals.getUpdateManifestFilename
|
212
212
|
}());`
|
213
213
|
]),
|
214
|
-
|
214
|
+
"})['catch'](function(err) { if(err.code !== 'MODULE_NOT_FOUND') throw err; });"
|
215
215
|
]),
|
216
216
|
"}"
|
217
217
|
])
|
@@ -56,6 +56,7 @@ class ModuleConcatenationPlugin {
|
|
56
56
|
* @returns {void}
|
57
57
|
*/
|
58
58
|
apply(compiler) {
|
59
|
+
const { _backCompat: backCompat } = compiler;
|
59
60
|
compiler.hooks.compilation.tap("ModuleConcatenationPlugin", compilation => {
|
60
61
|
const moduleGraph = compilation.moduleGraph;
|
61
62
|
const bailoutReasonMap = new Map();
|
@@ -389,8 +390,10 @@ class ModuleConcatenationPlugin {
|
|
389
390
|
};
|
390
391
|
|
391
392
|
const integrate = () => {
|
392
|
-
|
393
|
-
|
393
|
+
if (backCompat) {
|
394
|
+
ChunkGraph.setChunkGraphForModule(newModule, chunkGraph);
|
395
|
+
ModuleGraph.setModuleGraphForModule(newModule, moduleGraph);
|
396
|
+
}
|
394
397
|
|
395
398
|
for (const warning of concatConfiguration.getWarningsSorted()) {
|
396
399
|
moduleGraph
|
@@ -102,6 +102,7 @@ const MinMaxSizeWarning = require("./MinMaxSizeWarning");
|
|
102
102
|
|
103
103
|
/**
|
104
104
|
* @typedef {Object} FallbackCacheGroup
|
105
|
+
* @property {ChunkFilterFunction} chunksFilter
|
105
106
|
* @property {SplitChunksSizes} minSize
|
106
107
|
* @property {SplitChunksSizes} maxAsyncSize
|
107
108
|
* @property {SplitChunksSizes} maxInitialSize
|
@@ -658,6 +659,9 @@ module.exports = class SplitChunksPlugin {
|
|
658
659
|
automaticNameDelimiter: options.automaticNameDelimiter,
|
659
660
|
usedExports: options.usedExports,
|
660
661
|
fallbackCacheGroup: {
|
662
|
+
chunksFilter: normalizeChunksFilter(
|
663
|
+
fallbackCacheGroup.chunks || options.chunks || "all"
|
664
|
+
),
|
661
665
|
minSize: mergeSizes(
|
662
666
|
normalizeSizes(fallbackCacheGroup.minSize, defaultSizeTypes),
|
663
667
|
minSize
|
@@ -1598,6 +1602,7 @@ module.exports = class SplitChunksPlugin {
|
|
1598
1602
|
const { outputOptions } = compilation;
|
1599
1603
|
|
1600
1604
|
// Make sure that maxSize is fulfilled
|
1605
|
+
const { fallbackCacheGroup } = this.options;
|
1601
1606
|
for (const chunk of Array.from(compilation.chunks)) {
|
1602
1607
|
const chunkConfig = maxSizeQueueMap.get(chunk);
|
1603
1608
|
const {
|
@@ -1605,7 +1610,9 @@ module.exports = class SplitChunksPlugin {
|
|
1605
1610
|
maxAsyncSize,
|
1606
1611
|
maxInitialSize,
|
1607
1612
|
automaticNameDelimiter
|
1608
|
-
} = chunkConfig ||
|
1613
|
+
} = chunkConfig || fallbackCacheGroup;
|
1614
|
+
if (!chunkConfig && !fallbackCacheGroup.chunksFilter(chunk))
|
1615
|
+
continue;
|
1609
1616
|
/** @type {SplitChunksSizes} */
|
1610
1617
|
let maxSize;
|
1611
1618
|
if (chunk.isOnlyInitial()) {
|
@@ -59,7 +59,7 @@ class AsyncModuleRuntimeModule extends HelperRuntimeModule {
|
|
59
59
|
])});`,
|
60
60
|
`var obj = {};
|
61
61
|
obj[webpackThen] = ${runtimeTemplate.expressionFunction(
|
62
|
-
"queueFunction(queue, fn), dep
|
62
|
+
"queueFunction(queue, fn), dep['catch'](reject)",
|
63
63
|
"fn, reject"
|
64
64
|
)};`,
|
65
65
|
"return obj;"
|
@@ -114,7 +114,7 @@ class AsyncModuleRuntimeModule extends HelperRuntimeModule {
|
|
114
114
|
"if (isEvaluating) { return completeFunction(fn); }",
|
115
115
|
"if (currentDeps) whenAll(currentDeps, fn, rejectFn);",
|
116
116
|
"queueFunction(queue, fn);",
|
117
|
-
"promise
|
117
|
+
"promise['catch'](rejectFn);"
|
118
118
|
]
|
119
119
|
)};`,
|
120
120
|
"module.exports = promise;",
|
@@ -320,7 +320,7 @@ class ConsumeSharedRuntimeModule extends RuntimeModule {
|
|
320
320
|
"var promise = moduleToHandlerMapping[id]();",
|
321
321
|
"if(promise.then) {",
|
322
322
|
Template.indent(
|
323
|
-
|
323
|
+
"promises.push(installedModules[id] = promise.then(onFactory)['catch'](onError));"
|
324
324
|
),
|
325
325
|
"} else onFactory(promise);"
|
326
326
|
]),
|
@@ -105,7 +105,7 @@ class ShareRuntimeModule extends RuntimeModule {
|
|
105
105
|
)}`,
|
106
106
|
"if(module.then) return promises.push(module.then(initFn, handleError));",
|
107
107
|
"var initResult = initFn(module);",
|
108
|
-
"if(initResult && initResult.then) return promises.push(initResult
|
108
|
+
"if(initResult && initResult.then) return promises.push(initResult['catch'](handleError));"
|
109
109
|
]),
|
110
110
|
"} catch(err) { handleError(err); }"
|
111
111
|
])}`,
|
package/lib/util/createHash.js
CHANGED
@@ -126,6 +126,7 @@ class DebugHash extends Hash {
|
|
126
126
|
|
127
127
|
let crypto = undefined;
|
128
128
|
let createXXHash64 = undefined;
|
129
|
+
let createMd4 = undefined;
|
129
130
|
let BatchedHash = undefined;
|
130
131
|
|
131
132
|
/**
|
@@ -149,6 +150,17 @@ module.exports = algorithm => {
|
|
149
150
|
}
|
150
151
|
}
|
151
152
|
return new BatchedHash(createXXHash64());
|
153
|
+
case "md4":
|
154
|
+
if (createMd4 === undefined) {
|
155
|
+
createMd4 = require("./hash/md4");
|
156
|
+
if (BatchedHash === undefined) {
|
157
|
+
BatchedHash = require("./hash/BatchedHash");
|
158
|
+
}
|
159
|
+
}
|
160
|
+
return new BatchedHash(createMd4());
|
161
|
+
case "native-md4":
|
162
|
+
if (crypto === undefined) crypto = require("crypto");
|
163
|
+
return new BulkUpdateDecorator(() => crypto.createHash("md4"), "md4");
|
152
164
|
default:
|
153
165
|
if (crypto === undefined) crypto = require("crypto");
|
154
166
|
return new BulkUpdateDecorator(
|
package/lib/util/deprecation.js
CHANGED
@@ -165,8 +165,16 @@ exports.arrayToSetDeprecation = (set, name) => {
|
|
165
165
|
};
|
166
166
|
|
167
167
|
exports.createArrayToSetDeprecationSet = name => {
|
168
|
-
|
169
|
-
|
168
|
+
let initialized = false;
|
169
|
+
class SetDeprecatedArray extends Set {
|
170
|
+
constructor(items) {
|
171
|
+
super(items);
|
172
|
+
if (!initialized) {
|
173
|
+
initialized = true;
|
174
|
+
exports.arrayToSetDeprecation(SetDeprecatedArray.prototype, name);
|
175
|
+
}
|
176
|
+
}
|
177
|
+
}
|
170
178
|
return SetDeprecatedArray;
|
171
179
|
};
|
172
180
|
|
@@ -6,8 +6,7 @@
|
|
6
6
|
"use strict";
|
7
7
|
|
8
8
|
const Hash = require("../Hash");
|
9
|
-
|
10
|
-
const MAX_STRING_LENGTH = 21845;
|
9
|
+
const MAX_SHORT_STRING = require("./wasm-hash").MAX_SHORT_STRING;
|
11
10
|
|
12
11
|
class BatchedHash extends Hash {
|
13
12
|
constructor(hash) {
|
@@ -28,7 +27,7 @@ class BatchedHash extends Hash {
|
|
28
27
|
if (
|
29
28
|
typeof data === "string" &&
|
30
29
|
inputEncoding === this.encoding &&
|
31
|
-
this.string.length + data.length <
|
30
|
+
this.string.length + data.length < MAX_SHORT_STRING
|
32
31
|
) {
|
33
32
|
this.string += data;
|
34
33
|
return this;
|
@@ -37,7 +36,11 @@ class BatchedHash extends Hash {
|
|
37
36
|
this.string = undefined;
|
38
37
|
}
|
39
38
|
if (typeof data === "string") {
|
40
|
-
if (
|
39
|
+
if (
|
40
|
+
data.length < MAX_SHORT_STRING &&
|
41
|
+
// base64 encoding is not valid since it may contain padding chars
|
42
|
+
(!inputEncoding || !inputEncoding.startsWith("ba"))
|
43
|
+
) {
|
41
44
|
this.string = data;
|
42
45
|
this.encoding = inputEncoding;
|
43
46
|
} else {
|
@@ -0,0 +1,20 @@
|
|
1
|
+
/*
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
+
Author Tobias Koppers @sokra
|
4
|
+
*/
|
5
|
+
|
6
|
+
"use strict";
|
7
|
+
|
8
|
+
const create = require("./wasm-hash");
|
9
|
+
|
10
|
+
//#region wasm code: md4 (../../../assembly/hash/md4.asm.ts) --initialMemory 1
|
11
|
+
const md4 = new WebAssembly.Module(
|
12
|
+
Buffer.from(
|
13
|
+
// 2150 bytes
|
14
|
+
"AGFzbQEAAAABCAJgAX8AYAAAAwUEAQAAAAUDAQABBhoFfwFBAAt/AUEAC38BQQALfwFBAAt/AUEACwciBARpbml0AAAGdXBkYXRlAAIFZmluYWwAAwZtZW1vcnkCAAqFEAQmAEGBxpS6BiQBQYnXtv5+JAJB/rnrxXkkA0H2qMmBASQEQQAkAAvMCgEYfyMBIQojAiEGIwMhByMEIQgDQCAAIAVLBEAgBSgCCCINIAcgBiAFKAIEIgsgCCAHIAUoAgAiDCAKIAggBiAHIAhzcXNqakEDdyIDIAYgB3Nxc2pqQQd3IgEgAyAGc3FzampBC3chAiAFKAIUIg8gASACIAUoAhAiCSADIAEgBSgCDCIOIAYgAyACIAEgA3Nxc2pqQRN3IgQgASACc3FzampBA3ciAyACIARzcXNqakEHdyEBIAUoAiAiEiADIAEgBSgCHCIRIAQgAyAFKAIYIhAgAiAEIAEgAyAEc3FzampBC3ciAiABIANzcXNqakETdyIEIAEgAnNxc2pqQQN3IQMgBSgCLCIVIAQgAyAFKAIoIhQgAiAEIAUoAiQiEyABIAIgAyACIARzcXNqakEHdyIBIAMgBHNxc2pqQQt3IgIgASADc3FzampBE3chBCAPIBAgCSAVIBQgEyAFKAI4IhYgAiAEIAUoAjQiFyABIAIgBSgCMCIYIAMgASAEIAEgAnNxc2pqQQN3IgEgAiAEc3FzampBB3ciAiABIARzcXNqakELdyIDIAkgAiAMIAEgBSgCPCIJIAQgASADIAEgAnNxc2pqQRN3IgEgAiADcnEgAiADcXJqakGZ84nUBWpBA3ciAiABIANycSABIANxcmpqQZnzidQFakEFdyIEIAEgAnJxIAEgAnFyaiASakGZ84nUBWpBCXciAyAPIAQgCyACIBggASADIAIgBHJxIAIgBHFyampBmfOJ1AVqQQ13IgEgAyAEcnEgAyAEcXJqakGZ84nUBWpBA3ciAiABIANycSABIANxcmpqQZnzidQFakEFdyIEIAEgAnJxIAEgAnFyampBmfOJ1AVqQQl3IgMgECAEIAIgFyABIAMgAiAEcnEgAiAEcXJqakGZ84nUBWpBDXciASADIARycSADIARxcmogDWpBmfOJ1AVqQQN3IgIgASADcnEgASADcXJqakGZ84nUBWpBBXciBCABIAJycSABIAJxcmpqQZnzidQFakEJdyIDIBEgBCAOIAIgFiABIAMgAiAEcnEgAiAEcXJqakGZ84nUBWpBDXciASADIARycSADIARxcmpqQZnzidQFakEDdyICIAEgA3JxIAEgA3FyampBmfOJ1AVqQQV3IgQgASACcnEgASACcXJqakGZ84nUBWpBCXciAyAMIAIgAyAJIAEgAyACIARycSACIARxcmpqQZnzidQFakENdyIBcyAEc2pqQaHX5/YGakEDdyICIAQgASACcyADc2ogEmpBodfn9gZqQQl3IgRzIAFzampBodfn9gZqQQt3IgMgAiADIBggASADIARzIAJzampBodfn9gZqQQ93IgFzIARzaiANakGh1+f2BmpBA3ciAiAUIAQgASACcyADc2pqQaHX5/YGakEJdyIEcyABc2pqQaHX5/YGakELdyIDIAsgAiADIBYgASADIARzIAJzampBodfn9gZqQQ93IgFzIARzampBodfn9gZqQQN3IgIgEyAEIAEgAnMgA3NqakGh1+f2BmpBCXciBHMgAXNqakGh1+f2BmpBC3chAyAKIA4gAiADIBcgASADIARzIAJzampBodfn9gZqQQ93IgFzIARzampBodfn9gZqQQN3IgJqIQogBiAJIAEgESADIAIgFSAEIAEgAnMgA3NqakGh1+f2BmpBCXciBHMgAXNqakGh1+f2BmpBC3ciAyAEcyACc2pqQaHX5/YGakEPd2ohBiADIAdqIQcgBCAIaiEIIAVBQGshBQwBCwsgCiQBIAYkAiAHJAMgCCQECw0AIAAQASMAIABqJAAL/wQCA38BfiMAIABqrUIDhiEEIABByABqQUBxIgJBCGshAyAAIgFBAWohACABQYABOgAAA0AgACACSUEAIABBB3EbBEAgAEEAOgAAIABBAWohAAwBCwsDQCAAIAJJBEAgAEIANwMAIABBCGohAAwBCwsgAyAENwMAIAIQAUEAIwGtIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAEEIIwKtIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAEEQIwOtIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAEEYIwStIgRC//8DgyAEQoCA/P8Pg0IQhoQiBEL/gYCA8B+DIARCgP6DgIDgP4NCCIaEIgRCj4C8gPCBwAeDQgiGIARC8IHAh4CegPgAg0IEiIQiBEKGjJiw4MCBgwZ8QgSIQoGChIiQoMCAAYNCJ34gBEKw4MCBg4aMmDCEfDcDAAs=",
|
15
|
+
"base64"
|
16
|
+
)
|
17
|
+
);
|
18
|
+
//#endregion
|
19
|
+
|
20
|
+
module.exports = create.bind(null, md4, [], 64, 32);
|