webpack 5.63.0 → 5.64.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/EntryOptionPlugin.js +1 -0
- package/lib/WatchIgnorePlugin.js +5 -6
- package/lib/buildChunkGraph.js +19 -9
- package/lib/config/defaults.js +1 -0
- package/lib/config/normalization.js +2 -0
- package/lib/debug/ProfilingPlugin.js +9 -7
- package/lib/util/ArrayHelpers.js +16 -0
- package/package.json +1 -1
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +16 -0
- package/types.d.ts +20 -0
package/lib/EntryOptionPlugin.js
CHANGED
package/lib/WatchIgnorePlugin.js
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
|
6
6
|
"use strict";
|
7
7
|
|
8
|
+
const { groupBy } = require("./util/ArrayHelpers");
|
8
9
|
const createSchemaValidation = require("./util/create-schema-validation");
|
9
10
|
|
10
11
|
/** @typedef {import("../declarations/plugins/WatchIgnorePlugin").WatchIgnorePluginOptions} WatchIgnorePluginOptions */
|
@@ -40,14 +41,12 @@ class IgnoringWatchFileSystem {
|
|
40
41
|
p instanceof RegExp ? p.test(path) : path.indexOf(p) === 0
|
41
42
|
);
|
42
43
|
|
43
|
-
const
|
44
|
-
|
45
|
-
const ignoredFiles = files.filter(ignored);
|
46
|
-
const ignoredDirs = dirs.filter(ignored);
|
44
|
+
const [ignoredFiles, notIgnoredFiles] = groupBy(files, ignored);
|
45
|
+
const [ignoredDirs, notIgnoredDirs] = groupBy(dirs, ignored);
|
47
46
|
|
48
47
|
const watcher = this.wfs.watch(
|
49
|
-
|
50
|
-
|
48
|
+
notIgnoredFiles,
|
49
|
+
notIgnoredDirs,
|
51
50
|
missing,
|
52
51
|
startTime,
|
53
52
|
options,
|
package/lib/buildChunkGraph.js
CHANGED
@@ -50,7 +50,8 @@ const { getEntryRuntime, mergeRuntime } = require("./util/runtime");
|
|
50
50
|
* @property {Set<ChunkGroupInfo>} availableChildren set of chunk groups which depend on the this chunk group as availableSource
|
51
51
|
* @property {number} preOrderIndex next pre order index
|
52
52
|
* @property {number} postOrderIndex next post order index
|
53
|
-
* @property {boolean}
|
53
|
+
* @property {boolean} chunkLoading has a chunk loading mechanism
|
54
|
+
* @property {boolean} asyncChunks create async chunks
|
54
55
|
*/
|
55
56
|
|
56
57
|
/**
|
@@ -306,10 +307,14 @@ const visitModules = (
|
|
306
307
|
availableChildren: undefined,
|
307
308
|
preOrderIndex: 0,
|
308
309
|
postOrderIndex: 0,
|
309
|
-
|
310
|
-
chunkGroup.options.chunkLoading
|
311
|
-
? false
|
312
|
-
: compilation.outputOptions.chunkLoading !== false
|
310
|
+
chunkLoading:
|
311
|
+
chunkGroup.options.chunkLoading !== undefined
|
312
|
+
? chunkGroup.options.chunkLoading !== false
|
313
|
+
: compilation.outputOptions.chunkLoading !== false,
|
314
|
+
asyncChunks:
|
315
|
+
chunkGroup.options.asyncChunks !== undefined
|
316
|
+
? chunkGroup.options.asyncChunks
|
317
|
+
: compilation.outputOptions.asyncChunks !== false
|
313
318
|
};
|
314
319
|
chunkGroup.index = nextChunkGroupIndex++;
|
315
320
|
if (chunkGroup.getNumberOfParents() > 0) {
|
@@ -424,10 +429,14 @@ const visitModules = (
|
|
424
429
|
availableChildren: undefined,
|
425
430
|
preOrderIndex: 0,
|
426
431
|
postOrderIndex: 0,
|
427
|
-
|
432
|
+
chunkLoading:
|
428
433
|
entryOptions.chunkLoading !== undefined
|
429
434
|
? entryOptions.chunkLoading !== false
|
430
|
-
: chunkGroupInfo.
|
435
|
+
: chunkGroupInfo.chunkLoading,
|
436
|
+
asyncChunks:
|
437
|
+
entryOptions.asyncChunks !== undefined
|
438
|
+
? entryOptions.asyncChunks
|
439
|
+
: chunkGroupInfo.asyncChunks
|
431
440
|
};
|
432
441
|
chunkGroupInfoMap.set(entrypoint, cgi);
|
433
442
|
|
@@ -451,7 +460,7 @@ const visitModules = (
|
|
451
460
|
chunkGroup: entrypoint,
|
452
461
|
chunkGroupInfo: cgi
|
453
462
|
});
|
454
|
-
} else if (!chunkGroupInfo.
|
463
|
+
} else if (!chunkGroupInfo.asyncChunks || !chunkGroupInfo.chunkLoading) {
|
455
464
|
// Just queue the block into the current chunk group
|
456
465
|
queue.push({
|
457
466
|
action: PROCESS_BLOCK,
|
@@ -484,7 +493,8 @@ const visitModules = (
|
|
484
493
|
availableChildren: undefined,
|
485
494
|
preOrderIndex: 0,
|
486
495
|
postOrderIndex: 0,
|
487
|
-
|
496
|
+
chunkLoading: chunkGroupInfo.chunkLoading,
|
497
|
+
asyncChunks: chunkGroupInfo.asyncChunks
|
488
498
|
};
|
489
499
|
allCreatedChunkGroups.add(c);
|
490
500
|
chunkGroupInfoMap.set(c, cgi);
|
package/lib/config/defaults.js
CHANGED
@@ -290,6 +290,7 @@ const getNormalizedWebpackOptions = config => {
|
|
290
290
|
/** @type {OutputNormalized} */
|
291
291
|
const result = {
|
292
292
|
assetModuleFilename: output.assetModuleFilename,
|
293
|
+
asyncChunks: output.asyncChunks,
|
293
294
|
charset: output.charset,
|
294
295
|
chunkFilename: output.chunkFilename,
|
295
296
|
chunkFormat: output.chunkFormat,
|
@@ -484,6 +485,7 @@ const getNormalizedEntryStatic = entry => {
|
|
484
485
|
runtime: value.runtime,
|
485
486
|
publicPath: value.publicPath,
|
486
487
|
chunkLoading: value.chunkLoading,
|
488
|
+
asyncChunks: value.asyncChunks,
|
487
489
|
wasmLoading: value.wasmLoading,
|
488
490
|
dependOn:
|
489
491
|
value.dependOn &&
|
@@ -203,15 +203,17 @@ class ProfilingPlugin {
|
|
203
203
|
|
204
204
|
// Compiler Hooks
|
205
205
|
Object.keys(compiler.hooks).forEach(hookName => {
|
206
|
-
compiler.hooks[hookName]
|
207
|
-
|
208
|
-
|
206
|
+
const hook = compiler.hooks[hookName];
|
207
|
+
if (hook) {
|
208
|
+
hook.intercept(makeInterceptorFor("Compiler", tracer)(hookName));
|
209
|
+
}
|
209
210
|
});
|
210
211
|
|
211
212
|
Object.keys(compiler.resolverFactory.hooks).forEach(hookName => {
|
212
|
-
compiler.resolverFactory.hooks[hookName]
|
213
|
-
|
214
|
-
|
213
|
+
const hook = compiler.resolverFactory.hooks[hookName];
|
214
|
+
if (hook) {
|
215
|
+
hook.intercept(makeInterceptorFor("Resolver", tracer)(hookName));
|
216
|
+
}
|
215
217
|
});
|
216
218
|
|
217
219
|
compiler.hooks.compilation.tap(
|
@@ -303,7 +305,7 @@ const interceptAllHooksFor = (instance, tracer, logLabel) => {
|
|
303
305
|
if (Reflect.has(instance, "hooks")) {
|
304
306
|
Object.keys(instance.hooks).forEach(hookName => {
|
305
307
|
const hook = instance.hooks[hookName];
|
306
|
-
if (!hook._fakeHook) {
|
308
|
+
if (hook && !hook._fakeHook) {
|
307
309
|
hook.intercept(makeInterceptorFor(logLabel, tracer)(hookName));
|
308
310
|
}
|
309
311
|
});
|
package/lib/util/ArrayHelpers.js
CHANGED
@@ -12,3 +12,19 @@ exports.equals = (a, b) => {
|
|
12
12
|
}
|
13
13
|
return true;
|
14
14
|
};
|
15
|
+
|
16
|
+
/**
|
17
|
+
*
|
18
|
+
* @param {Array} arr Array of values to be partitioned
|
19
|
+
* @param {(value: any) => boolean} fn Partition function which partitions based on truthiness of result.
|
20
|
+
* @returns {[Array, Array]} returns the values of `arr` partitioned into two new arrays based on fn predicate.
|
21
|
+
*/
|
22
|
+
exports.groupBy = (arr = [], fn) => {
|
23
|
+
return arr.reduce(
|
24
|
+
(groups, value) => {
|
25
|
+
groups[fn(value) ? 0 : 1].push(value);
|
26
|
+
return groups;
|
27
|
+
},
|
28
|
+
[[], []]
|
29
|
+
);
|
30
|
+
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "webpack",
|
3
|
-
"version": "5.
|
3
|
+
"version": "5.64.0",
|
4
4
|
"author": "Tobias Koppers @sokra",
|
5
5
|
"description": "Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.",
|
6
6
|
"license": "MIT",
|