webpack 5.66.0 → 5.67.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/README.md +1 -1
- package/lib/Cache.js +1 -1
- package/lib/CacheFacade.js +2 -2
- package/lib/CleanPlugin.js +1 -1
- package/lib/Compilation.js +12 -9
- package/lib/Compiler.js +57 -3
- package/lib/ContextModule.js +21 -17
- package/lib/DelegatedModule.js +1 -1
- package/lib/DependencyTemplates.js +1 -1
- package/lib/DllModule.js +1 -1
- package/lib/EvalDevToolModulePlugin.js +16 -1
- package/lib/EvalSourceMapDevToolPlugin.js +18 -1
- package/lib/ExternalModule.js +1 -1
- package/lib/ExternalModuleFactoryPlugin.js +1 -1
- package/lib/FileSystemInfo.js +29 -25
- package/lib/HookWebpackError.js +1 -1
- package/lib/Module.js +1 -1
- package/lib/MultiCompiler.js +1 -1
- package/lib/MultiWatching.js +1 -1
- package/lib/NormalModule.js +6 -4
- package/lib/RawModule.js +1 -1
- package/lib/RuntimeGlobals.js +18 -0
- package/lib/RuntimeModule.js +1 -1
- package/lib/RuntimePlugin.js +28 -3
- package/lib/RuntimeTemplate.js +1 -1
- package/lib/Watching.js +1 -1
- package/lib/WebpackOptionsApply.js +1 -1
- package/lib/asset/AssetGenerator.js +62 -24
- package/lib/asset/AssetModulesPlugin.js +3 -0
- package/lib/asset/RawDataUrlModule.js +8 -5
- package/lib/cache/ResolverCachePlugin.js +1 -1
- package/lib/cli.js +44 -3
- package/lib/config/defaults.js +22 -5
- package/lib/config/normalization.js +5 -0
- package/lib/container/ContainerEntryModule.js +4 -2
- package/lib/container/FallbackModule.js +4 -4
- package/lib/container/RemoteModule.js +4 -2
- package/lib/css/CssExportsGenerator.js +139 -0
- package/lib/css/CssGenerator.js +3 -0
- package/lib/css/CssLoadingRuntimeModule.js +139 -85
- package/lib/css/CssModulesPlugin.js +20 -3
- package/lib/debug/ProfilingPlugin.js +12 -10
- package/lib/dependencies/CreateScriptUrlDependency.js +12 -0
- package/lib/dependencies/LoaderPlugin.js +2 -2
- package/lib/hmr/LazyCompilationPlugin.js +45 -21
- package/lib/hmr/lazyCompilationBackend.js +1 -1
- package/lib/ids/DeterministicModuleIdsPlugin.js +55 -35
- package/lib/ids/HashedModuleIdsPlugin.js +9 -12
- package/lib/ids/IdHelpers.js +24 -10
- package/lib/ids/NamedModuleIdsPlugin.js +6 -9
- package/lib/ids/NaturalModuleIdsPlugin.js +10 -13
- package/lib/ids/OccurrenceModuleIdsPlugin.js +13 -10
- package/lib/ids/SyncModuleIdsPlugin.js +140 -0
- package/lib/index.js +5 -0
- package/lib/optimize/ConcatenatedModule.js +1 -1
- package/lib/runtime/CreateScriptRuntimeModule.js +36 -0
- package/lib/runtime/CreateScriptUrlRuntimeModule.js +9 -34
- package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +76 -0
- package/lib/schemes/HttpUriPlugin.js +8 -8
- package/lib/sharing/ConsumeSharedModule.js +4 -2
- package/lib/sharing/ProvideSharedModule.js +4 -2
- package/lib/sharing/utils.js +1 -1
- package/lib/stats/DefaultStatsFactoryPlugin.js +112 -67
- package/lib/stats/DefaultStatsPrinterPlugin.js +88 -23
- package/lib/util/AsyncQueue.js +1 -1
- package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +3 -11
- package/package.json +3 -10
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +43 -6
- package/schemas/plugins/asset/AssetGeneratorOptions.check.js +1 -1
- package/schemas/plugins/asset/AssetResourceGeneratorOptions.check.js +1 -1
- package/types.d.ts +163 -42
@@ -9,6 +9,8 @@
|
|
9
9
|
/** @typedef {import("./StatsPrinter")} StatsPrinter */
|
10
10
|
/** @typedef {import("./StatsPrinter").StatsPrinterContext} StatsPrinterContext */
|
11
11
|
|
12
|
+
const DATA_URI_CONTENT_LENGTH = 16;
|
13
|
+
|
12
14
|
const plural = (n, singular, plural) => (n === 1 ? singular : plural);
|
13
15
|
|
14
16
|
/**
|
@@ -26,6 +28,23 @@ const printSizes = (sizes, { formatSize = n => `${n}` }) => {
|
|
26
28
|
}
|
27
29
|
};
|
28
30
|
|
31
|
+
const getResourceName = resource => {
|
32
|
+
const dataUrl = /^data:[^,]+,/.exec(resource);
|
33
|
+
if (!dataUrl) return resource;
|
34
|
+
|
35
|
+
const len = dataUrl[0].length + DATA_URI_CONTENT_LENGTH;
|
36
|
+
if (resource.length < len) return resource;
|
37
|
+
return `${resource.slice(
|
38
|
+
0,
|
39
|
+
Math.min(resource.length - /* '..'.length */ 2, len)
|
40
|
+
)}..`;
|
41
|
+
};
|
42
|
+
|
43
|
+
const getModuleName = name => {
|
44
|
+
const [, prefix, resource] = /^(.*!)?([^!]*)$/.exec(name);
|
45
|
+
return [prefix, getResourceName(resource)];
|
46
|
+
};
|
47
|
+
|
29
48
|
const mapLines = (str, fn) => str.split("\n").map(fn).join("\n");
|
30
49
|
|
31
50
|
/**
|
@@ -38,6 +57,10 @@ const isValidId = id => {
|
|
38
57
|
return typeof id === "number" || id;
|
39
58
|
};
|
40
59
|
|
60
|
+
const moreCount = (list, count) => {
|
61
|
+
return list && list.length > 0 ? `+ ${count}` : `${count}`;
|
62
|
+
};
|
63
|
+
|
41
64
|
/** @type {Record<string, (thing: any, context: StatsPrinterContext, printer: StatsPrinter) => string | void>} */
|
42
65
|
const SIMPLE_PRINTERS = {
|
43
66
|
"compilation.summary!": (
|
@@ -163,13 +186,24 @@ const SIMPLE_PRINTERS = {
|
|
163
186
|
},
|
164
187
|
"compilation.assetsByChunkName": () => "",
|
165
188
|
|
166
|
-
"compilation.filteredModules":
|
189
|
+
"compilation.filteredModules": (
|
190
|
+
filteredModules,
|
191
|
+
{ compilation: { modules } }
|
192
|
+
) =>
|
167
193
|
filteredModules > 0
|
168
|
-
? `${filteredModules} ${plural(
|
194
|
+
? `${moreCount(modules, filteredModules)} ${plural(
|
195
|
+
filteredModules,
|
196
|
+
"module",
|
197
|
+
"modules"
|
198
|
+
)}`
|
169
199
|
: undefined,
|
170
200
|
"compilation.filteredAssets": (filteredAssets, { compilation: { assets } }) =>
|
171
201
|
filteredAssets > 0
|
172
|
-
? `${filteredAssets} ${plural(
|
202
|
+
? `${moreCount(assets, filteredAssets)} ${plural(
|
203
|
+
filteredAssets,
|
204
|
+
"asset",
|
205
|
+
"assets"
|
206
|
+
)}`
|
173
207
|
: undefined,
|
174
208
|
"compilation.logging": (logging, context, printer) =>
|
175
209
|
Array.isArray(logging)
|
@@ -262,15 +296,19 @@ const SIMPLE_PRINTERS = {
|
|
262
296
|
"asset.separator!": () => "\n",
|
263
297
|
"asset.filteredRelated": (filteredRelated, { asset: { related } }) =>
|
264
298
|
filteredRelated > 0
|
265
|
-
? `${filteredRelated} related ${plural(
|
299
|
+
? `${moreCount(related, filteredRelated)} related ${plural(
|
266
300
|
filteredRelated,
|
267
301
|
"asset",
|
268
302
|
"assets"
|
269
303
|
)}`
|
270
304
|
: undefined,
|
271
|
-
"asset.filteredChildren": filteredChildren =>
|
305
|
+
"asset.filteredChildren": (filteredChildren, { asset: { children } }) =>
|
272
306
|
filteredChildren > 0
|
273
|
-
? `${filteredChildren} ${plural(
|
307
|
+
? `${moreCount(children, filteredChildren)} ${plural(
|
308
|
+
filteredChildren,
|
309
|
+
"asset",
|
310
|
+
"assets"
|
311
|
+
)}`
|
274
312
|
: undefined,
|
275
313
|
|
276
314
|
assetChunk: (id, { formatChunkId }) => formatChunkId(id),
|
@@ -282,8 +320,8 @@ const SIMPLE_PRINTERS = {
|
|
282
320
|
"module.id": (id, { formatModuleId }) =>
|
283
321
|
isValidId(id) ? formatModuleId(id) : undefined,
|
284
322
|
"module.name": (name, { bold }) => {
|
285
|
-
const [
|
286
|
-
return
|
323
|
+
const [prefix, resource] = getModuleName(name);
|
324
|
+
return `${prefix || ""}${bold(resource || "")}`;
|
287
325
|
},
|
288
326
|
"module.identifier": identifier => undefined,
|
289
327
|
"module.layer": (layer, { formatLayer }) =>
|
@@ -366,21 +404,29 @@ const SIMPLE_PRINTERS = {
|
|
366
404
|
"module.issuerPath": (issuerPath, { module }) =>
|
367
405
|
module.profile ? undefined : "",
|
368
406
|
"module.profile": profile => undefined,
|
369
|
-
"module.filteredModules": filteredModules =>
|
407
|
+
"module.filteredModules": (filteredModules, { module: { modules } }) =>
|
370
408
|
filteredModules > 0
|
371
|
-
? `${filteredModules} nested ${plural(
|
409
|
+
? `${moreCount(modules, filteredModules)} nested ${plural(
|
372
410
|
filteredModules,
|
373
411
|
"module",
|
374
412
|
"modules"
|
375
413
|
)}`
|
376
414
|
: undefined,
|
377
|
-
"module.filteredReasons": filteredReasons =>
|
415
|
+
"module.filteredReasons": (filteredReasons, { module: { reasons } }) =>
|
378
416
|
filteredReasons > 0
|
379
|
-
? `${filteredReasons} ${plural(
|
417
|
+
? `${moreCount(reasons, filteredReasons)} ${plural(
|
418
|
+
filteredReasons,
|
419
|
+
"reason",
|
420
|
+
"reasons"
|
421
|
+
)}`
|
380
422
|
: undefined,
|
381
|
-
"module.filteredChildren": filteredChildren =>
|
423
|
+
"module.filteredChildren": (filteredChildren, { module: { children } }) =>
|
382
424
|
filteredChildren > 0
|
383
|
-
? `${filteredChildren} ${plural(
|
425
|
+
? `${moreCount(children, filteredChildren)} ${plural(
|
426
|
+
filteredChildren,
|
427
|
+
"module",
|
428
|
+
"modules"
|
429
|
+
)}`
|
384
430
|
: undefined,
|
385
431
|
"module.separator!": () => "\n",
|
386
432
|
|
@@ -388,7 +434,8 @@ const SIMPLE_PRINTERS = {
|
|
388
434
|
"moduleIssuer.profile.total": (value, { formatTime }) => formatTime(value),
|
389
435
|
|
390
436
|
"moduleReason.type": type => type,
|
391
|
-
"moduleReason.userRequest": (userRequest, { cyan }) =>
|
437
|
+
"moduleReason.userRequest": (userRequest, { cyan }) =>
|
438
|
+
cyan(getResourceName(userRequest)),
|
392
439
|
"moduleReason.moduleId": (moduleId, { formatModuleId }) =>
|
393
440
|
isValidId(moduleId) ? formatModuleId(moduleId) : undefined,
|
394
441
|
"moduleReason.module": (module, { magenta }) => magenta(module),
|
@@ -397,9 +444,16 @@ const SIMPLE_PRINTERS = {
|
|
397
444
|
"moduleReason.active": (active, { formatFlag }) =>
|
398
445
|
active ? undefined : formatFlag("inactive"),
|
399
446
|
"moduleReason.resolvedModule": (module, { magenta }) => magenta(module),
|
400
|
-
"moduleReason.filteredChildren":
|
447
|
+
"moduleReason.filteredChildren": (
|
448
|
+
filteredChildren,
|
449
|
+
{ moduleReason: { children } }
|
450
|
+
) =>
|
401
451
|
filteredChildren > 0
|
402
|
-
? `${filteredChildren} ${plural(
|
452
|
+
? `${moreCount(children, filteredChildren)} ${plural(
|
453
|
+
filteredChildren,
|
454
|
+
"reason",
|
455
|
+
"reasons"
|
456
|
+
)}`
|
403
457
|
: undefined,
|
404
458
|
|
405
459
|
"module.profile.total": (value, { formatTime }) => formatTime(value),
|
@@ -427,10 +481,21 @@ const SIMPLE_PRINTERS = {
|
|
427
481
|
size ? formatSize(size) : undefined,
|
428
482
|
"chunkGroup.auxiliaryAssetsSize": (size, { formatSize }) =>
|
429
483
|
size ? `(${formatSize(size)})` : undefined,
|
430
|
-
"chunkGroup.filteredAssets": n =>
|
431
|
-
n > 0
|
432
|
-
|
433
|
-
|
484
|
+
"chunkGroup.filteredAssets": (n, { chunkGroup: { assets } }) =>
|
485
|
+
n > 0
|
486
|
+
? `${moreCount(assets, n)} ${plural(n, "asset", "assets")}`
|
487
|
+
: undefined,
|
488
|
+
"chunkGroup.filteredAuxiliaryAssets": (
|
489
|
+
n,
|
490
|
+
{ chunkGroup: { auxiliaryAssets } }
|
491
|
+
) =>
|
492
|
+
n > 0
|
493
|
+
? `${moreCount(auxiliaryAssets, n)} auxiliary ${plural(
|
494
|
+
n,
|
495
|
+
"asset",
|
496
|
+
"assets"
|
497
|
+
)}`
|
498
|
+
: undefined,
|
434
499
|
"chunkGroup.is!": () => "=",
|
435
500
|
"chunkGroupAsset.name": (asset, { green }) => green(asset),
|
436
501
|
"chunkGroupAsset.size": (size, { formatSize, chunkGroup }) =>
|
@@ -490,9 +555,9 @@ const SIMPLE_PRINTERS = {
|
|
490
555
|
"chunk.recorded": (recorded, { formatFlag, green }) =>
|
491
556
|
recorded ? green(formatFlag("recorded")) : undefined,
|
492
557
|
"chunk.reason": (reason, { yellow }) => (reason ? yellow(reason) : undefined),
|
493
|
-
"chunk.filteredModules": filteredModules =>
|
558
|
+
"chunk.filteredModules": (filteredModules, { chunk: { modules } }) =>
|
494
559
|
filteredModules > 0
|
495
|
-
? `${filteredModules} chunk ${plural(
|
560
|
+
? `${moreCount(modules, filteredModules)} chunk ${plural(
|
496
561
|
filteredModules,
|
497
562
|
"module",
|
498
563
|
"modules"
|
package/lib/util/AsyncQueue.js
CHANGED
@@ -6,7 +6,6 @@
|
|
6
6
|
"use strict";
|
7
7
|
|
8
8
|
const RuntimeGlobals = require("../RuntimeGlobals");
|
9
|
-
const CreateScriptUrlRuntimeModule = require("../runtime/CreateScriptUrlRuntimeModule");
|
10
9
|
const StartupChunkDependenciesPlugin = require("../runtime/StartupChunkDependenciesPlugin");
|
11
10
|
const ImportScriptsChunkLoadingRuntimeModule = require("./ImportScriptsChunkLoadingRuntimeModule");
|
12
11
|
|
@@ -43,7 +42,9 @@ class ImportScriptsChunkLoadingPlugin {
|
|
43
42
|
const withCreateScriptUrl = !!compilation.outputOptions.trustedTypes;
|
44
43
|
set.add(RuntimeGlobals.moduleFactoriesAddOnly);
|
45
44
|
set.add(RuntimeGlobals.hasOwnProperty);
|
46
|
-
if (withCreateScriptUrl)
|
45
|
+
if (withCreateScriptUrl) {
|
46
|
+
set.add(RuntimeGlobals.createScriptUrl);
|
47
|
+
}
|
47
48
|
compilation.addRuntimeModule(
|
48
49
|
chunk,
|
49
50
|
new ImportScriptsChunkLoadingRuntimeModule(set, withCreateScriptUrl)
|
@@ -61,15 +62,6 @@ class ImportScriptsChunkLoadingPlugin {
|
|
61
62
|
compilation.hooks.runtimeRequirementInTree
|
62
63
|
.for(RuntimeGlobals.baseURI)
|
63
64
|
.tap("ImportScriptsChunkLoadingPlugin", handler);
|
64
|
-
compilation.hooks.runtimeRequirementInTree
|
65
|
-
.for(RuntimeGlobals.createScriptUrl)
|
66
|
-
.tap("RuntimePlugin", (chunk, set) => {
|
67
|
-
compilation.addRuntimeModule(
|
68
|
-
chunk,
|
69
|
-
new CreateScriptUrlRuntimeModule()
|
70
|
-
);
|
71
|
-
return true;
|
72
|
-
});
|
73
65
|
|
74
66
|
compilation.hooks.runtimeRequirementInTree
|
75
67
|
.for(RuntimeGlobals.ensureChunkHandlers)
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "webpack",
|
3
|
-
"version": "5.
|
3
|
+
"version": "5.67.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",
|
@@ -28,7 +28,7 @@
|
|
28
28
|
"tapable": "^2.1.1",
|
29
29
|
"terser-webpack-plugin": "^5.1.3",
|
30
30
|
"watchpack": "^2.3.1",
|
31
|
-
"webpack-sources": "^3.2.
|
31
|
+
"webpack-sources": "^3.2.3"
|
32
32
|
},
|
33
33
|
"peerDependenciesMeta": {
|
34
34
|
"webpack-cli": {
|
@@ -143,13 +143,6 @@
|
|
143
143
|
"test:integration": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --logHeapUsage --testMatch \"<rootDir>/test/*.{basictest,longtest,test}.js\"",
|
144
144
|
"test:basic": "node --expose-gc --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --logHeapUsage --testMatch \"<rootDir>/test/*.basictest.js\"",
|
145
145
|
"test:unit": "node --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.unittest.js\"",
|
146
|
-
"travis:integration": "yarn cover:integration --ci $JEST",
|
147
|
-
"travis:basic": "yarn cover:basic --ci $JEST",
|
148
|
-
"travis:lintunit": "yarn lint && yarn cover:unit --ci $JEST",
|
149
|
-
"travis:benchmark": "yarn benchmark --ci",
|
150
|
-
"appveyor:integration": "yarn cover:integration --ci %JEST%",
|
151
|
-
"appveyor:unit": "yarn cover:unit --ci %JEST%",
|
152
|
-
"appveyor:benchmark": "yarn benchmark --ci",
|
153
146
|
"build:examples": "cd examples && node buildAll.js",
|
154
147
|
"type-report": "rimraf coverage && yarn cover:types && yarn cover:report && open-cli coverage/lcov-report/index.html",
|
155
148
|
"pretest": "yarn lint",
|
@@ -159,7 +152,7 @@
|
|
159
152
|
"type-lint": "tsc",
|
160
153
|
"typings-test": "tsc -p tsconfig.types.test.json",
|
161
154
|
"module-typings-test": "tsc -p tsconfig.module.test.json",
|
162
|
-
"spellcheck": "cspell \"
|
155
|
+
"spellcheck": "cspell \"**/*\"",
|
163
156
|
"special-lint": "node node_modules/tooling/lockfile-lint && node node_modules/tooling/schemas-lint && node node_modules/tooling/inherit-types && node node_modules/tooling/format-schemas && node tooling/generate-runtime-code.js && node tooling/generate-wasm-code.js && node node_modules/tooling/format-file-header && node node_modules/tooling/compile-to-definitions && node node_modules/tooling/precompile-schemas && node node_modules/tooling/generate-types --no-template-literals",
|
164
157
|
"special-lint-fix": "node node_modules/tooling/inherit-types --write && node node_modules/tooling/format-schemas --write && node tooling/generate-runtime-code.js --write && node tooling/generate-wasm-code.js --write && node node_modules/tooling/format-file-header --write && node node_modules/tooling/compile-to-definitions --write && node node_modules/tooling/precompile-schemas --write && node node_modules/tooling/generate-types --no-template-literals --write",
|
165
158
|
"fix": "yarn code-lint --fix && yarn special-lint-fix && yarn pretty-lint-fix",
|