webpack 5.89.0 → 5.90.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 +3 -0
- package/bin/webpack.js +1 -3
- package/hot/log.js +0 -2
- package/lib/APIPlugin.js +1 -1
- package/lib/ChunkGraph.js +1 -1
- package/lib/CleanPlugin.js +12 -12
- package/lib/Compilation.js +25 -16
- package/lib/Compiler.js +13 -0
- package/lib/ConcatenationScope.js +2 -2
- package/lib/ContextModule.js +4 -4
- package/lib/ContextModuleFactory.js +1 -1
- package/lib/DependencyTemplate.js +3 -1
- package/lib/EnvironmentNotSupportAsyncWarning.js +52 -0
- package/lib/EvalDevToolModulePlugin.js +1 -1
- package/lib/EvalSourceMapDevToolPlugin.js +1 -1
- package/lib/ExportsInfoApiPlugin.js +2 -2
- package/lib/ExternalModule.js +47 -12
- package/lib/ExternalModuleFactoryPlugin.js +1 -1
- package/lib/FileSystemInfo.js +20 -3
- package/lib/FlagDependencyExportsPlugin.js +1 -1
- package/lib/Generator.js +1 -0
- package/lib/HotModuleReplacementPlugin.js +3 -3
- package/lib/LibManifestPlugin.js +4 -1
- package/lib/Module.js +2 -1
- package/lib/ModuleFilenameHelpers.js +1 -1
- package/lib/ModuleInfoHeaderPlugin.js +1 -1
- package/lib/MultiStats.js +2 -2
- package/lib/NodeStuffPlugin.js +48 -0
- package/lib/NormalModule.js +13 -11
- package/lib/NormalModuleFactory.js +7 -7
- package/lib/RuntimeTemplate.js +15 -11
- package/lib/SourceMapDevToolPlugin.js +2 -2
- package/lib/WebpackOptionsApply.js +4 -3
- package/lib/asset/AssetModulesPlugin.js +2 -3
- package/lib/cache/AddManagedPathsPlugin.js +6 -1
- package/lib/cache/IdleFileCachePlugin.js +12 -5
- package/lib/cache/PackFileCacheStrategy.js +3 -3
- package/lib/cache/ResolverCachePlugin.js +2 -2
- package/lib/config/browserslistTargetHandler.js +24 -5
- package/lib/config/defaults.js +87 -52
- package/lib/config/normalization.js +17 -18
- package/lib/config/target.js +5 -0
- package/lib/container/ContainerReferencePlugin.js +1 -1
- package/lib/css/CssExportsGenerator.js +14 -1
- package/lib/css/CssGenerator.js +14 -1
- package/lib/css/CssLoadingRuntimeModule.js +23 -23
- package/lib/css/CssModulesPlugin.js +68 -32
- package/lib/css/CssParser.js +8 -3
- package/lib/debug/ProfilingPlugin.js +2 -2
- package/lib/dependencies/CachedConstDependency.js +8 -1
- package/lib/dependencies/CommonJsImportsParserPlugin.js +1 -1
- package/lib/dependencies/ContextElementDependency.js +1 -1
- package/lib/dependencies/ExternalModuleDependency.js +98 -0
- package/lib/dependencies/ExternalModuleInitFragment.js +124 -0
- package/lib/dependencies/HarmonyAcceptDependency.js +1 -1
- package/lib/dependencies/HarmonyDetectionParserPlugin.js +7 -1
- package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +18 -18
- package/lib/dependencies/HarmonyExportInitFragment.js +4 -4
- package/lib/dependencies/HarmonyImportDependency.js +4 -4
- package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +6 -6
- package/lib/dependencies/ImportDependency.js +26 -6
- package/lib/dependencies/JsonExportsDependency.js +1 -1
- package/lib/dependencies/LoaderPlugin.js +2 -1
- package/lib/dependencies/PureExpressionDependency.js +12 -4
- package/lib/dependencies/RequireIncludeDependency.js +1 -1
- package/lib/dependencies/WebpackIsIncludedDependency.js +1 -1
- package/lib/dependencies/WorkerPlugin.js +7 -1
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +6 -6
- package/lib/hmr/HotModuleReplacement.runtime.js +3 -5
- package/lib/hmr/lazyCompilationBackend.js +4 -4
- package/lib/ids/DeterministicModuleIdsPlugin.js +1 -1
- package/lib/index.js +4 -0
- package/lib/javascript/JavascriptGenerator.js +16 -1
- package/lib/javascript/JavascriptModulesPlugin.js +33 -33
- package/lib/javascript/JavascriptParser.js +8 -0
- package/lib/json/JsonGenerator.js +1 -1
- package/lib/library/AmdLibraryPlugin.js +5 -1
- package/lib/library/AssignLibraryPlugin.js +1 -1
- package/lib/library/SystemLibraryPlugin.js +1 -1
- package/lib/library/UmdLibraryPlugin.js +39 -39
- package/lib/logging/createConsoleLogger.js +1 -19
- package/lib/node/ReadFileChunkLoadingRuntimeModule.js +8 -8
- package/lib/node/RequireChunkLoadingRuntimeModule.js +8 -8
- package/lib/node/nodeConsole.js +1 -5
- package/lib/optimize/ConcatenatedModule.js +7 -7
- package/lib/optimize/InnerGraphPlugin.js +9 -1
- package/lib/optimize/ModuleConcatenationPlugin.js +2 -2
- package/lib/optimize/RemoveParentModulesPlugin.js +123 -47
- package/lib/optimize/SideEffectsFlagPlugin.js +15 -3
- package/lib/optimize/SplitChunksPlugin.js +16 -16
- package/lib/prefetch/ChunkPrefetchStartupRuntimeModule.js +2 -2
- package/lib/rules/RuleSetCompiler.js +1 -1
- package/lib/runtime/AutoPublicPathRuntimeModule.js +2 -2
- package/lib/runtime/GetChunkFilenameRuntimeModule.js +4 -4
- package/lib/runtime/GetTrustedTypesPolicyRuntimeModule.js +4 -4
- package/lib/runtime/LoadScriptRuntimeModule.js +2 -2
- package/lib/runtime/StartupChunkDependenciesRuntimeModule.js +23 -22
- package/lib/runtime/StartupEntrypointRuntimeModule.js +2 -2
- package/lib/schemes/HttpUriPlugin.js +1 -1
- package/lib/serialization/FileMiddleware.js +4 -4
- package/lib/serialization/ObjectMiddleware.js +4 -4
- package/lib/sharing/ConsumeSharedPlugin.js +5 -5
- package/lib/sharing/ConsumeSharedRuntimeModule.js +8 -4
- package/lib/sharing/ProvideSharedModule.js +2 -2
- package/lib/sharing/SharePlugin.js +2 -2
- package/lib/sharing/ShareRuntimeModule.js +1 -1
- package/lib/sharing/utils.js +24 -28
- package/lib/stats/DefaultStatsFactoryPlugin.js +10 -10
- package/lib/stats/DefaultStatsPresetPlugin.js +3 -7
- package/lib/stats/DefaultStatsPrinterPlugin.js +34 -31
- package/lib/util/cleverMerge.js +4 -4
- package/lib/util/hash/xxhash64.js +2 -2
- package/lib/util/identifier.js +2 -2
- package/lib/util/internalSerializables.js +6 -0
- package/lib/util/runtime.js +18 -1
- package/lib/util/semver.js +19 -24
- package/lib/util/smartGrouping.js +1 -1
- package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +1 -1
- package/lib/wasm-async/AsyncWebAssemblyJavascriptGenerator.js +2 -2
- package/lib/wasm-async/AsyncWebAssemblyParser.js +6 -0
- package/lib/wasm-sync/WasmChunkLoadingRuntimeModule.js +2 -2
- package/lib/wasm-sync/WebAssemblyJavascriptGenerator.js +2 -2
- package/lib/web/JsonpChunkLoadingRuntimeModule.js +13 -13
- package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +6 -6
- package/package.json +23 -23
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +140 -32
- package/schemas/plugins/css/CssAutoGeneratorOptions.check.d.ts +7 -0
- package/schemas/plugins/css/CssAutoGeneratorOptions.check.js +6 -0
- package/schemas/plugins/css/CssAutoGeneratorOptions.json +3 -0
- package/schemas/plugins/css/CssAutoParserOptions.check.d.ts +7 -0
- package/schemas/plugins/css/CssAutoParserOptions.check.js +6 -0
- package/schemas/plugins/css/CssAutoParserOptions.json +3 -0
- package/schemas/plugins/css/CssGeneratorOptions.check.js +1 -1
- package/schemas/plugins/css/CssGlobalGeneratorOptions.check.d.ts +7 -0
- package/schemas/plugins/css/CssGlobalGeneratorOptions.check.js +6 -0
- package/schemas/plugins/css/CssGlobalGeneratorOptions.json +3 -0
- package/schemas/plugins/css/CssGlobalParserOptions.check.d.ts +7 -0
- package/schemas/plugins/css/CssGlobalParserOptions.check.js +6 -0
- package/schemas/plugins/css/CssGlobalParserOptions.json +3 -0
- package/schemas/plugins/css/CssModuleGeneratorOptions.check.d.ts +7 -0
- package/schemas/plugins/css/CssModuleGeneratorOptions.check.js +6 -0
- package/schemas/plugins/css/CssModuleGeneratorOptions.json +3 -0
- package/schemas/plugins/css/CssModuleParserOptions.check.d.ts +7 -0
- package/schemas/plugins/css/CssModuleParserOptions.check.js +6 -0
- package/schemas/plugins/css/CssModuleParserOptions.json +3 -0
- package/schemas/plugins/css/CssParserOptions.check.js +1 -1
- package/types.d.ts +172 -20
@@ -90,7 +90,7 @@ class LoadScriptRuntimeModule extends HelperRuntimeModule {
|
|
90
90
|
'script.setAttribute("fetchpriority", fetchPriority);'
|
91
91
|
),
|
92
92
|
"}"
|
93
|
-
|
93
|
+
])
|
94
94
|
: "",
|
95
95
|
`script.src = ${
|
96
96
|
this._withCreateScriptUrl
|
@@ -106,7 +106,7 @@ class LoadScriptRuntimeModule extends HelperRuntimeModule {
|
|
106
106
|
`script.crossOrigin = ${JSON.stringify(crossOriginLoading)};`
|
107
107
|
),
|
108
108
|
"}"
|
109
|
-
|
109
|
+
])
|
110
110
|
: ""
|
111
111
|
]);
|
112
112
|
|
@@ -46,28 +46,29 @@ class StartupChunkDependenciesRuntimeModule extends RuntimeModule {
|
|
46
46
|
)
|
47
47
|
.concat("return next();")
|
48
48
|
: chunkIds.length === 1
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
49
|
+
? `return ${RuntimeGlobals.ensureChunk}(${JSON.stringify(
|
50
|
+
chunkIds[0]
|
51
|
+
)}).then(next);`
|
52
|
+
: chunkIds.length > 2
|
53
|
+
? [
|
54
|
+
// using map is shorter for 3 or more chunks
|
55
|
+
`return Promise.all(${JSON.stringify(chunkIds)}.map(${
|
56
|
+
RuntimeGlobals.ensureChunk
|
57
|
+
}, ${RuntimeGlobals.require})).then(next);`
|
58
|
+
]
|
59
|
+
: [
|
60
|
+
// calling ensureChunk directly is shorter for 0 - 2 chunks
|
61
|
+
"return Promise.all([",
|
62
|
+
Template.indent(
|
63
|
+
chunkIds
|
64
|
+
.map(
|
65
|
+
id =>
|
66
|
+
`${RuntimeGlobals.ensureChunk}(${JSON.stringify(id)})`
|
67
|
+
)
|
68
|
+
.join(",\n")
|
69
|
+
),
|
70
|
+
"]).then(next);"
|
71
|
+
]
|
71
72
|
)};`
|
72
73
|
]);
|
73
74
|
}
|
@@ -41,12 +41,12 @@ class StartupEntrypointRuntimeModule extends RuntimeModule {
|
|
41
41
|
"var r = fn();",
|
42
42
|
"return r === undefined ? result : r;"
|
43
43
|
])})`
|
44
|
-
|
44
|
+
]
|
45
45
|
: [
|
46
46
|
`chunkIds.map(${RuntimeGlobals.ensureChunk}, ${RuntimeGlobals.require})`,
|
47
47
|
"var r = fn();",
|
48
48
|
"return r === undefined ? result : r;"
|
49
|
-
|
49
|
+
])
|
50
50
|
])}`;
|
51
51
|
}
|
52
52
|
}
|
@@ -60,23 +60,23 @@ const DECOMPRESSION_CHUNK_SIZE = 100 * 1024 * 1024;
|
|
60
60
|
const writeUInt64LE = Buffer.prototype.writeBigUInt64LE
|
61
61
|
? (buf, value, offset) => {
|
62
62
|
buf.writeBigUInt64LE(BigInt(value), offset);
|
63
|
-
|
63
|
+
}
|
64
64
|
: (buf, value, offset) => {
|
65
65
|
const low = value % 0x100000000;
|
66
66
|
const high = (value - low) / 0x100000000;
|
67
67
|
buf.writeUInt32LE(low, offset);
|
68
68
|
buf.writeUInt32LE(high, offset + 4);
|
69
|
-
|
69
|
+
};
|
70
70
|
|
71
71
|
const readUInt64LE = Buffer.prototype.readBigUInt64LE
|
72
72
|
? (buf, offset) => {
|
73
73
|
return Number(buf.readBigUInt64LE(offset));
|
74
|
-
|
74
|
+
}
|
75
75
|
: (buf, offset) => {
|
76
76
|
const low = buf.readUInt32LE(offset);
|
77
77
|
const high = buf.readUInt32LE(offset + 4);
|
78
78
|
return high * 0x100000000 + low;
|
79
|
-
|
79
|
+
};
|
80
80
|
|
81
81
|
/**
|
82
82
|
* @typedef {Object} SerializeResult
|
@@ -718,10 +718,10 @@ class ObjectMiddleware extends SerializerMiddleware {
|
|
718
718
|
const name = !serializerEntry
|
719
719
|
? "unknown"
|
720
720
|
: !serializerEntry[1].request
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
721
|
+
? serializerEntry[0].name
|
722
|
+
: serializerEntry[1].name
|
723
|
+
? `${serializerEntry[1].request} ${serializerEntry[1].name}`
|
724
|
+
: serializerEntry[1].request;
|
725
725
|
err.message += `\n(during deserialization of ${name})`;
|
726
726
|
throw err;
|
727
727
|
}
|
@@ -60,7 +60,7 @@ class ConsumeSharedPlugin {
|
|
60
60
|
let result =
|
61
61
|
item === key || !isRequiredVersion(item)
|
62
62
|
? // item is a request/key
|
63
|
-
|
63
|
+
{
|
64
64
|
import: key,
|
65
65
|
shareScope: options.shareScope || "default",
|
66
66
|
shareKey: key,
|
@@ -69,10 +69,10 @@ class ConsumeSharedPlugin {
|
|
69
69
|
strictVersion: false,
|
70
70
|
singleton: false,
|
71
71
|
eager: false
|
72
|
-
|
72
|
+
}
|
73
73
|
: // key is a request/key
|
74
|
-
|
75
|
-
|
74
|
+
// item is a version
|
75
|
+
{
|
76
76
|
import: key,
|
77
77
|
shareScope: options.shareScope || "default",
|
78
78
|
shareKey: key,
|
@@ -81,7 +81,7 @@ class ConsumeSharedPlugin {
|
|
81
81
|
packageName: undefined,
|
82
82
|
singleton: false,
|
83
83
|
eager: false
|
84
|
-
|
84
|
+
};
|
85
85
|
return result;
|
86
86
|
},
|
87
87
|
(item, key) => ({
|
@@ -179,7 +179,7 @@ class ConsumeSharedRuntimeModule extends RuntimeModule {
|
|
179
179
|
? runtimeTemplate.basicFunction("", "")
|
180
180
|
: runtimeTemplate.basicFunction("msg", [
|
181
181
|
'if (typeof console !== "undefined" && console.warn) console.warn(msg);'
|
182
|
-
|
182
|
+
])
|
183
183
|
};`,
|
184
184
|
`var warnInvalidVersion = ${runtimeTemplate.basicFunction(
|
185
185
|
"scope, scopeName, key, requiredVersion",
|
@@ -312,7 +312,7 @@ class ConsumeSharedRuntimeModule extends RuntimeModule {
|
|
312
312
|
`module.exports = factory();`
|
313
313
|
])}`
|
314
314
|
])});`
|
315
|
-
|
315
|
+
])
|
316
316
|
: "// no consumes in initial chunks",
|
317
317
|
this._runtimeRequirements.has(RuntimeGlobals.ensureChunkHandlers)
|
318
318
|
? Template.asString([
|
@@ -321,6 +321,7 @@ class ConsumeSharedRuntimeModule extends RuntimeModule {
|
|
321
321
|
null,
|
322
322
|
"\t"
|
323
323
|
)};`,
|
324
|
+
"var startedInstallModules = {};",
|
324
325
|
`${
|
325
326
|
RuntimeGlobals.ensureChunkHandlers
|
326
327
|
}.consumes = ${runtimeTemplate.basicFunction("chunkId, promises", [
|
@@ -330,6 +331,7 @@ class ConsumeSharedRuntimeModule extends RuntimeModule {
|
|
330
331
|
"id",
|
331
332
|
[
|
332
333
|
`if(${RuntimeGlobals.hasOwnProperty}(installedModules, id)) return promises.push(installedModules[id]);`,
|
334
|
+
"if(!startedInstallModules[id]) {",
|
333
335
|
`var onFactory = ${runtimeTemplate.basicFunction(
|
334
336
|
"factory",
|
335
337
|
[
|
@@ -342,6 +344,7 @@ class ConsumeSharedRuntimeModule extends RuntimeModule {
|
|
342
344
|
])}`
|
343
345
|
]
|
344
346
|
)};`,
|
347
|
+
"startedInstallModules[id] = true;",
|
345
348
|
`var onError = ${runtimeTemplate.basicFunction("error", [
|
346
349
|
"delete installedModules[id];",
|
347
350
|
`${
|
@@ -360,13 +363,14 @@ class ConsumeSharedRuntimeModule extends RuntimeModule {
|
|
360
363
|
),
|
361
364
|
"} else onFactory(promise);"
|
362
365
|
]),
|
363
|
-
"} catch(e) { onError(e); }"
|
366
|
+
"} catch(e) { onError(e); }",
|
367
|
+
"}"
|
364
368
|
]
|
365
369
|
)});`
|
366
370
|
]),
|
367
371
|
"}"
|
368
372
|
])}`
|
369
|
-
|
373
|
+
])
|
370
374
|
: "// no chunk loading of consumes"
|
371
375
|
]);
|
372
376
|
}
|
@@ -141,13 +141,13 @@ class ProvideSharedModule extends Module {
|
|
141
141
|
chunkGraph,
|
142
142
|
request: this._request,
|
143
143
|
runtimeRequirements
|
144
|
-
|
144
|
+
})
|
145
145
|
: runtimeTemplate.asyncModuleFactory({
|
146
146
|
block: this.blocks[0],
|
147
147
|
chunkGraph,
|
148
148
|
request: this._request,
|
149
149
|
runtimeRequirements
|
150
|
-
|
150
|
+
})
|
151
151
|
}${this._eager ? ", 1" : ""});`;
|
152
152
|
const sources = new Map();
|
153
153
|
const data = new Map();
|
@@ -89,7 +89,7 @@ class ShareRuntimeModule extends RuntimeModule {
|
|
89
89
|
? runtimeTemplate.basicFunction("", "")
|
90
90
|
: runtimeTemplate.basicFunction("msg", [
|
91
91
|
'if (typeof console !== "undefined" && console.warn) console.warn(msg);'
|
92
|
-
|
92
|
+
])
|
93
93
|
};`,
|
94
94
|
`var uniqueName = ${JSON.stringify(uniqueName || undefined)};`,
|
95
95
|
`var register = ${runtimeTemplate.basicFunction(
|
package/lib/sharing/utils.js
CHANGED
@@ -371,33 +371,29 @@ const getDescriptionFile = (fs, directory, descriptionFiles, callback) => {
|
|
371
371
|
};
|
372
372
|
exports.getDescriptionFile = getDescriptionFile;
|
373
373
|
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
if (
|
397
|
-
data.devDependencies &&
|
398
|
-
typeof data.devDependencies === "object" &&
|
399
|
-
packageName in data.devDependencies
|
400
|
-
) {
|
401
|
-
return normalizeVersion(data.devDependencies[packageName]);
|
374
|
+
/**
|
375
|
+
*
|
376
|
+
* @param {object} data description file data i.e.: package.json
|
377
|
+
* @param {string} packageName name of the dependency
|
378
|
+
* @returns {string} normalized version
|
379
|
+
*/
|
380
|
+
const getRequiredVersionFromDescriptionFile = (data, packageName) => {
|
381
|
+
const dependencyTypes = [
|
382
|
+
"optionalDependencies",
|
383
|
+
"dependencies",
|
384
|
+
"peerDependencies",
|
385
|
+
"devDependencies"
|
386
|
+
];
|
387
|
+
|
388
|
+
for (const dependencyType of dependencyTypes) {
|
389
|
+
if (
|
390
|
+
data[dependencyType] &&
|
391
|
+
typeof data[dependencyType] === "object" &&
|
392
|
+
packageName in data[dependencyType]
|
393
|
+
) {
|
394
|
+
return normalizeVersion(data[dependencyType][packageName]);
|
395
|
+
}
|
402
396
|
}
|
403
397
|
};
|
398
|
+
exports.getRequiredVersionFromDescriptionFile =
|
399
|
+
getRequiredVersionFromDescriptionFile;
|
@@ -1068,7 +1068,7 @@ const SIMPLE_EXTRACTORS = {
|
|
1068
1068
|
|
1069
1069
|
return childStatsChunkGroup;
|
1070
1070
|
})
|
1071
|
-
|
1071
|
+
)
|
1072
1072
|
: undefined,
|
1073
1073
|
childAssets: children
|
1074
1074
|
? mapObject(children, groups => {
|
@@ -1082,7 +1082,7 @@ const SIMPLE_EXTRACTORS = {
|
|
1082
1082
|
}
|
1083
1083
|
}
|
1084
1084
|
return Array.from(set);
|
1085
|
-
|
1085
|
+
})
|
1086
1086
|
: undefined
|
1087
1087
|
};
|
1088
1088
|
Object.assign(object, statsChunkGroup);
|
@@ -1379,8 +1379,8 @@ const SIMPLE_EXTRACTORS = {
|
|
1379
1379
|
chunk.runtime === undefined
|
1380
1380
|
? undefined
|
1381
1381
|
: typeof chunk.runtime === "string"
|
1382
|
-
|
1383
|
-
|
1382
|
+
? [makePathsRelative(chunk.runtime)]
|
1383
|
+
: Array.from(chunk.runtime.sort(), makePathsRelative),
|
1384
1384
|
files: Array.from(chunk.files),
|
1385
1385
|
auxiliaryFiles: Array.from(chunk.auxiliaryFiles).sort(compareIds),
|
1386
1386
|
hash: chunk.renderedHash,
|
@@ -1633,8 +1633,8 @@ const getItemSize = item => {
|
|
1633
1633
|
return !item.children
|
1634
1634
|
? 1
|
1635
1635
|
: item.filteredChildren
|
1636
|
-
|
1637
|
-
|
1636
|
+
? 2 + getTotalSize(item.children)
|
1637
|
+
: 1 + getTotalSize(item.children);
|
1638
1638
|
};
|
1639
1639
|
|
1640
1640
|
const getTotalSize = children => {
|
@@ -1912,13 +1912,13 @@ const ASSETS_GROUPERS = {
|
|
1912
1912
|
[name]: !!key,
|
1913
1913
|
filteredChildren: assets.length,
|
1914
1914
|
...assetGroup(children, assets)
|
1915
|
-
|
1915
|
+
}
|
1916
1916
|
: {
|
1917
1917
|
type: "assets by status",
|
1918
1918
|
[name]: !!key,
|
1919
1919
|
children,
|
1920
1920
|
...assetGroup(children, assets)
|
1921
|
-
|
1921
|
+
};
|
1922
1922
|
}
|
1923
1923
|
});
|
1924
1924
|
};
|
@@ -2169,8 +2169,8 @@ const MODULES_GROUPERS = type => ({
|
|
2169
2169
|
type: isDataUrl
|
2170
2170
|
? "modules by mime type"
|
2171
2171
|
: groupModulesByPath
|
2172
|
-
|
2173
|
-
|
2172
|
+
? "modules by path"
|
2173
|
+
: "modules by extension",
|
2174
2174
|
name: isDataUrl ? key.slice(/* 'data:'.length */ 5) : key,
|
2175
2175
|
children,
|
2176
2176
|
...moduleGroup(children, modules)
|
@@ -197,8 +197,8 @@ const DEFAULTS = {
|
|
197
197
|
runtime !== undefined
|
198
198
|
? runtime
|
199
199
|
: forToString
|
200
|
-
|
201
|
-
|
200
|
+
? all === true
|
201
|
+
: all !== false,
|
202
202
|
cachedModules: ({ all, cached }, { forToString }) =>
|
203
203
|
cached !== undefined ? cached : forToString ? all === true : all !== false,
|
204
204
|
moduleAssets: OFF_FOR_TO_STRING,
|
@@ -238,11 +238,7 @@ const DEFAULTS = {
|
|
238
238
|
const normalizeFilter = item => {
|
239
239
|
if (typeof item === "string") {
|
240
240
|
const regExp = new RegExp(
|
241
|
-
`[\\\\/]${item.replace(
|
242
|
-
// eslint-disable-next-line no-useless-escape
|
243
|
-
/[-[\]{}()*+?.\\^$|]/g,
|
244
|
-
"\\$&"
|
245
|
-
)}([\\\\/]|$|!|\\?)`
|
241
|
+
`[\\\\/]${item.replace(/[-[\]{}()*+?.\\^$|]/g, "\\$&")}([\\\\/]|$|!|\\?)`
|
246
242
|
);
|
247
243
|
return ident => regExp.test(ident);
|
248
244
|
}
|
@@ -128,7 +128,7 @@ const SIMPLE_PRINTERS = {
|
|
128
128
|
warningsCount > 0
|
129
129
|
? yellow(
|
130
130
|
`${warningsCount} ${plural(warningsCount, "warning", "warnings")}`
|
131
|
-
|
131
|
+
)
|
132
132
|
: "";
|
133
133
|
const errorsMessage =
|
134
134
|
errorsCount > 0
|
@@ -143,10 +143,10 @@ const SIMPLE_PRINTERS = {
|
|
143
143
|
root && name
|
144
144
|
? bold(name)
|
145
145
|
: name
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
146
|
+
? `Child ${bold(name)}`
|
147
|
+
: root
|
148
|
+
? ""
|
149
|
+
: "Child";
|
150
150
|
const subjectMessage =
|
151
151
|
nameMessage && versionMessage
|
152
152
|
? `${nameMessage} (${versionMessage})`
|
@@ -180,7 +180,7 @@ const SIMPLE_PRINTERS = {
|
|
180
180
|
count,
|
181
181
|
"warning has",
|
182
182
|
"warnings have"
|
183
|
-
|
183
|
+
)} detailed information that is not shown.\nUse 'stats.errorDetails: true' resp. '--stats-error-details' to show it.`
|
184
184
|
: undefined,
|
185
185
|
"compilation.filteredErrorDetailsCount": (count, { yellow }) =>
|
186
186
|
count
|
@@ -190,7 +190,7 @@ const SIMPLE_PRINTERS = {
|
|
190
190
|
"error has",
|
191
191
|
"errors have"
|
192
192
|
)} detailed information that is not shown.\nUse 'stats.errorDetails: true' resp. '--stats-error-details' to show it.`
|
193
|
-
|
193
|
+
)
|
194
194
|
: undefined,
|
195
195
|
"compilation.env": (env, { bold }) =>
|
196
196
|
env
|
@@ -204,7 +204,7 @@ const SIMPLE_PRINTERS = {
|
|
204
204
|
: printer.print(context.type, Object.values(entrypoints), {
|
205
205
|
...context,
|
206
206
|
chunkGroupKind: "Entrypoint"
|
207
|
-
|
207
|
+
}),
|
208
208
|
"compilation.namedChunkGroups": (namedChunkGroups, context, printer) => {
|
209
209
|
if (!Array.isArray(namedChunkGroups)) {
|
210
210
|
const {
|
@@ -234,15 +234,18 @@ const SIMPLE_PRINTERS = {
|
|
234
234
|
filteredModules,
|
235
235
|
"module",
|
236
236
|
"modules"
|
237
|
-
|
237
|
+
)}`
|
238
238
|
: undefined,
|
239
|
-
"compilation.filteredAssets": (
|
239
|
+
"compilation.filteredAssets": (
|
240
|
+
filteredAssets,
|
241
|
+
{ compilation: { assets } }
|
242
|
+
) =>
|
240
243
|
filteredAssets > 0
|
241
244
|
? `${moreCount(assets, filteredAssets)} ${plural(
|
242
245
|
filteredAssets,
|
243
246
|
"asset",
|
244
247
|
"assets"
|
245
|
-
|
248
|
+
)}`
|
246
249
|
: undefined,
|
247
250
|
"compilation.logging": (logging, context, printer) =>
|
248
251
|
Array.isArray(logging)
|
@@ -251,7 +254,7 @@ const SIMPLE_PRINTERS = {
|
|
251
254
|
context.type,
|
252
255
|
Object.entries(logging).map(([name, value]) => ({ ...value, name })),
|
253
256
|
context
|
254
|
-
|
257
|
+
),
|
255
258
|
"compilation.warningsInChildren!": (_, { yellow, compilation }) => {
|
256
259
|
if (
|
257
260
|
!compilation.children &&
|
@@ -324,7 +327,7 @@ const SIMPLE_PRINTERS = {
|
|
324
327
|
sourceFilename === true
|
325
328
|
? "from source file"
|
326
329
|
: `from: ${sourceFilename}`
|
327
|
-
|
330
|
+
)
|
328
331
|
: undefined,
|
329
332
|
"asset.info.development": (development, { green, formatFlag }) =>
|
330
333
|
development ? green(formatFlag("dev")) : undefined,
|
@@ -339,7 +342,7 @@ const SIMPLE_PRINTERS = {
|
|
339
342
|
filteredRelated,
|
340
343
|
"asset",
|
341
344
|
"assets"
|
342
|
-
|
345
|
+
)}`
|
343
346
|
: undefined,
|
344
347
|
"asset.filteredChildren": (filteredChildren, { asset: { children } }) =>
|
345
348
|
filteredChildren > 0
|
@@ -347,7 +350,7 @@ const SIMPLE_PRINTERS = {
|
|
347
350
|
filteredChildren,
|
348
351
|
"asset",
|
349
352
|
"assets"
|
350
|
-
|
353
|
+
)}`
|
351
354
|
: undefined,
|
352
355
|
|
353
356
|
assetChunk: (id, { formatChunkId }) => formatChunkId(id),
|
@@ -393,22 +396,22 @@ const SIMPLE_PRINTERS = {
|
|
393
396
|
formatFlag(
|
394
397
|
`${assets.length} ${plural(assets.length, "asset", "assets")}`
|
395
398
|
)
|
396
|
-
|
399
|
+
)
|
397
400
|
: undefined,
|
398
401
|
"module.warnings": (warnings, { formatFlag, yellow }) =>
|
399
402
|
warnings === true
|
400
403
|
? yellow(formatFlag("warnings"))
|
401
404
|
: warnings
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
405
|
+
? yellow(
|
406
|
+
formatFlag(`${warnings} ${plural(warnings, "warning", "warnings")}`)
|
407
|
+
)
|
408
|
+
: undefined,
|
406
409
|
"module.errors": (errors, { formatFlag, red }) =>
|
407
410
|
errors === true
|
408
411
|
? red(formatFlag("errors"))
|
409
412
|
: errors
|
410
|
-
|
411
|
-
|
413
|
+
? red(formatFlag(`${errors} ${plural(errors, "error", "errors")}`))
|
414
|
+
: undefined,
|
412
415
|
"module.providedExports": (providedExports, { formatFlag, cyan }) => {
|
413
416
|
if (Array.isArray(providedExports)) {
|
414
417
|
if (providedExports.length === 0) return cyan(formatFlag("no exports"));
|
@@ -449,7 +452,7 @@ const SIMPLE_PRINTERS = {
|
|
449
452
|
filteredModules,
|
450
453
|
"module",
|
451
454
|
"modules"
|
452
|
-
|
455
|
+
)}`
|
453
456
|
: undefined,
|
454
457
|
"module.filteredReasons": (filteredReasons, { module: { reasons } }) =>
|
455
458
|
filteredReasons > 0
|
@@ -457,7 +460,7 @@ const SIMPLE_PRINTERS = {
|
|
457
460
|
filteredReasons,
|
458
461
|
"reason",
|
459
462
|
"reasons"
|
460
|
-
|
463
|
+
)}`
|
461
464
|
: undefined,
|
462
465
|
"module.filteredChildren": (filteredChildren, { module: { children } }) =>
|
463
466
|
filteredChildren > 0
|
@@ -465,7 +468,7 @@ const SIMPLE_PRINTERS = {
|
|
465
468
|
filteredChildren,
|
466
469
|
"module",
|
467
470
|
"modules"
|
468
|
-
|
471
|
+
)}`
|
469
472
|
: undefined,
|
470
473
|
"module.separator!": () => "\n",
|
471
474
|
|
@@ -492,7 +495,7 @@ const SIMPLE_PRINTERS = {
|
|
492
495
|
filteredChildren,
|
493
496
|
"reason",
|
494
497
|
"reasons"
|
495
|
-
|
498
|
+
)}`
|
496
499
|
: undefined,
|
497
500
|
|
498
501
|
"module.profile.total": (value, { formatTime }) => formatTime(value),
|
@@ -533,7 +536,7 @@ const SIMPLE_PRINTERS = {
|
|
533
536
|
n,
|
534
537
|
"asset",
|
535
538
|
"assets"
|
536
|
-
|
539
|
+
)}`
|
537
540
|
: undefined,
|
538
541
|
"chunkGroup.is!": () => "=",
|
539
542
|
"chunkGroupAsset.name": (asset, { green }) => green(asset),
|
@@ -552,7 +555,7 @@ const SIMPLE_PRINTERS = {
|
|
552
555
|
children: children[key]
|
553
556
|
})),
|
554
557
|
context
|
555
|
-
|
558
|
+
),
|
556
559
|
"chunkGroupChildGroup.type": type => `${type}:`,
|
557
560
|
"chunkGroupChild.assets[]": (file, { formatFilename }) =>
|
558
561
|
formatFilename(file),
|
@@ -581,7 +584,7 @@ const SIMPLE_PRINTERS = {
|
|
581
584
|
children: childrenByOrder[key]
|
582
585
|
})),
|
583
586
|
context
|
584
|
-
|
587
|
+
),
|
585
588
|
"chunk.childrenByOrder[].type": type => `${type}:`,
|
586
589
|
"chunk.childrenByOrder[].children[]": (id, { formatChunkId }) =>
|
587
590
|
isValidId(id) ? formatChunkId(id) : undefined,
|
@@ -600,7 +603,7 @@ const SIMPLE_PRINTERS = {
|
|
600
603
|
filteredModules,
|
601
604
|
"module",
|
602
605
|
"modules"
|
603
|
-
|
606
|
+
)}`
|
604
607
|
: undefined,
|
605
608
|
"chunk.separator!": () => "\n",
|
606
609
|
|
@@ -1354,7 +1357,7 @@ class DefaultStatsPrinterPlugin {
|
|
1354
1357
|
? str.replace(
|
1355
1358
|
/((\u001b\[39m|\u001b\[22m|\u001b\[0m)+)/g,
|
1356
1359
|
`$1${start}`
|
1357
|
-
|
1360
|
+
)
|
1358
1361
|
: str
|
1359
1362
|
}\u001b[39m\u001b[22m`;
|
1360
1363
|
} else {
|
package/lib/util/cleverMerge.js
CHANGED
@@ -457,8 +457,8 @@ const mergeSingleValue = (a, b, internalCaching) => {
|
|
457
457
|
return aType !== VALUE_TYPE_OBJECT
|
458
458
|
? b
|
459
459
|
: internalCaching
|
460
|
-
|
461
|
-
|
460
|
+
? cachedCleverMerge(a, b)
|
461
|
+
: cleverMerge(a, b);
|
462
462
|
}
|
463
463
|
case VALUE_TYPE_UNDEFINED:
|
464
464
|
return a;
|
@@ -467,8 +467,8 @@ const mergeSingleValue = (a, b, internalCaching) => {
|
|
467
467
|
aType !== VALUE_TYPE_ATOM
|
468
468
|
? aType
|
469
469
|
: Array.isArray(a)
|
470
|
-
|
471
|
-
|
470
|
+
? VALUE_TYPE_ARRAY_EXTEND
|
471
|
+
: VALUE_TYPE_OBJECT
|
472
472
|
) {
|
473
473
|
case VALUE_TYPE_UNDEFINED:
|
474
474
|
return b;
|