webpack 5.30.0 → 5.31.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/Dependency.js +2 -0
- package/lib/ExportsInfo.js +62 -28
- package/lib/FileSystemInfo.js +90 -31
- package/lib/FlagDependencyExportsPlugin.js +12 -3
- package/lib/cache/PackFileCacheStrategy.js +3 -3
- package/lib/config/defaults.js +7 -2
- package/lib/dependencies/HarmonyExportExpressionDependency.js +1 -0
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +5 -0
- package/lib/dependencies/HarmonyExportSpecifierDependency.js +1 -0
- package/lib/hmr/HotModuleReplacement.runtime.js +3 -2
- package/lib/hmr/JavascriptHotModuleReplacement.runtime.js +1 -1
- package/lib/logging/createConsoleLogger.js +19 -1
- package/lib/node/NodeEnvironmentPlugin.js +18 -11
- package/lib/node/nodeConsole.js +121 -112
- package/lib/util/runtime.js +1 -1
- package/package.json +2 -2
- package/schemas/WebpackOptions.json +16 -0
- package/types.d.ts +50 -8
package/lib/Dependency.js
CHANGED
@@ -55,6 +55,7 @@ const memoize = require("./util/memoize");
|
|
55
55
|
* @property {(string | ExportSpec)[]=} exports nested exports
|
56
56
|
* @property {ModuleGraphConnection=} from when reexported: from which module
|
57
57
|
* @property {string[] | null=} export when reexported: from which export
|
58
|
+
* @property {number=} priority when reexported: with which priority
|
58
59
|
* @property {boolean=} hidden export is not visible, because another export blends over it
|
59
60
|
*/
|
60
61
|
|
@@ -64,6 +65,7 @@ const memoize = require("./util/memoize");
|
|
64
65
|
* @property {Set<string>=} excludeExports when exports = true, list of unaffected exports
|
65
66
|
* @property {Set<string>=} hideExports list of maybe prior exposed, but now hidden exports
|
66
67
|
* @property {ModuleGraphConnection=} from when reexported: from which module
|
68
|
+
* @property {number=} priority when reexported: with which priority
|
67
69
|
* @property {boolean=} canMangle can the export be renamed (defaults to true)
|
68
70
|
* @property {boolean=} terminalBinding are the exports terminal bindings that should be checked for export star conflicts
|
69
71
|
* @property {Module[]=} dependencies module on which the result depends on
|
package/lib/ExportsInfo.js
CHANGED
@@ -269,13 +269,15 @@ class ExportsInfo {
|
|
269
269
|
* @param {Set<string>=} excludeExports list of unaffected exports
|
270
270
|
* @param {any=} targetKey use this as key for the target
|
271
271
|
* @param {ModuleGraphConnection=} targetModule set this module as target
|
272
|
+
* @param {number=} priority priority
|
272
273
|
* @returns {boolean} true, if this call changed something
|
273
274
|
*/
|
274
275
|
setUnknownExportsProvided(
|
275
276
|
canMangle,
|
276
277
|
excludeExports,
|
277
278
|
targetKey,
|
278
|
-
targetModule
|
279
|
+
targetModule,
|
280
|
+
priority
|
279
281
|
) {
|
280
282
|
let changed = false;
|
281
283
|
if (excludeExports) {
|
@@ -295,7 +297,7 @@ class ExportsInfo {
|
|
295
297
|
changed = true;
|
296
298
|
}
|
297
299
|
if (targetKey) {
|
298
|
-
exportInfo.setTarget(targetKey, targetModule, [exportInfo.name]);
|
300
|
+
exportInfo.setTarget(targetKey, targetModule, [exportInfo.name], -1);
|
299
301
|
}
|
300
302
|
}
|
301
303
|
if (this._redirectTo !== undefined) {
|
@@ -304,7 +306,8 @@ class ExportsInfo {
|
|
304
306
|
canMangle,
|
305
307
|
excludeExports,
|
306
308
|
targetKey,
|
307
|
-
targetModule
|
309
|
+
targetModule,
|
310
|
+
priority
|
308
311
|
)
|
309
312
|
) {
|
310
313
|
changed = true;
|
@@ -322,7 +325,12 @@ class ExportsInfo {
|
|
322
325
|
changed = true;
|
323
326
|
}
|
324
327
|
if (targetKey) {
|
325
|
-
this._otherExportsInfo.setTarget(
|
328
|
+
this._otherExportsInfo.setTarget(
|
329
|
+
targetKey,
|
330
|
+
targetModule,
|
331
|
+
undefined,
|
332
|
+
priority
|
333
|
+
);
|
326
334
|
}
|
327
335
|
}
|
328
336
|
return changed;
|
@@ -819,17 +827,20 @@ class ExportInfo {
|
|
819
827
|
this.exportsInfoOwned = false;
|
820
828
|
/** @type {ExportsInfo=} */
|
821
829
|
this.exportsInfo = undefined;
|
822
|
-
/** @type {Map<any, { connection: ModuleGraphConnection, export: string[]
|
830
|
+
/** @type {Map<any, { connection: ModuleGraphConnection | null, export: string[], priority: number }>=} */
|
823
831
|
this._target = undefined;
|
824
832
|
if (initFrom && initFrom._target) {
|
825
833
|
this._target = new Map();
|
826
834
|
for (const [key, value] of initFrom._target) {
|
827
|
-
this._target.set(
|
828
|
-
|
829
|
-
|
830
|
-
|
835
|
+
this._target.set(key, {
|
836
|
+
connection: value.connection,
|
837
|
+
export: value.export || [name],
|
838
|
+
priority: value.priority
|
839
|
+
});
|
831
840
|
}
|
832
841
|
}
|
842
|
+
/** @type {Map<any, { connection: ModuleGraphConnection | null, export: string[], priority: number }>=} */
|
843
|
+
this._maxTarget = undefined;
|
833
844
|
}
|
834
845
|
|
835
846
|
// TODO webpack 5 remove
|
@@ -1023,46 +1034,45 @@ class ExportInfo {
|
|
1023
1034
|
*/
|
1024
1035
|
unsetTarget(key) {
|
1025
1036
|
if (!this._target) return false;
|
1026
|
-
|
1037
|
+
if (this._target.delete(key)) {
|
1038
|
+
this._maxTarget = undefined;
|
1039
|
+
return true;
|
1040
|
+
}
|
1041
|
+
return false;
|
1027
1042
|
}
|
1028
1043
|
|
1029
1044
|
/**
|
1030
1045
|
* @param {any} key the key
|
1031
|
-
* @param {ModuleGraphConnection
|
1046
|
+
* @param {ModuleGraphConnection} connection the target module if a single one
|
1032
1047
|
* @param {string[]=} exportName the exported name
|
1048
|
+
* @param {number=} priority priority
|
1033
1049
|
* @returns {boolean} true, if something has changed
|
1034
1050
|
*/
|
1035
|
-
setTarget(key, connection, exportName) {
|
1051
|
+
setTarget(key, connection, exportName, priority = 0) {
|
1036
1052
|
if (exportName) exportName = [...exportName];
|
1037
1053
|
if (!this._target) {
|
1038
1054
|
this._target = new Map();
|
1039
|
-
this._target.set(
|
1040
|
-
key,
|
1041
|
-
connection ? { connection, export: exportName } : null
|
1042
|
-
);
|
1055
|
+
this._target.set(key, { connection, export: exportName, priority });
|
1043
1056
|
return true;
|
1044
1057
|
}
|
1045
1058
|
const oldTarget = this._target.get(key);
|
1046
1059
|
if (!oldTarget) {
|
1047
1060
|
if (oldTarget === null && !connection) return false;
|
1048
|
-
this._target.set(
|
1049
|
-
|
1050
|
-
connection ? { connection, export: exportName } : null
|
1051
|
-
);
|
1052
|
-
return true;
|
1053
|
-
}
|
1054
|
-
if (!connection) {
|
1055
|
-
this._target.set(key, null);
|
1061
|
+
this._target.set(key, { connection, export: exportName, priority });
|
1062
|
+
this._maxTarget = undefined;
|
1056
1063
|
return true;
|
1057
1064
|
}
|
1058
1065
|
if (
|
1059
1066
|
oldTarget.connection !== connection ||
|
1067
|
+
oldTarget.priority !== priority ||
|
1060
1068
|
(exportName
|
1061
1069
|
? !oldTarget.export || !equals(oldTarget.export, exportName)
|
1062
1070
|
: oldTarget.export)
|
1063
1071
|
) {
|
1064
1072
|
oldTarget.connection = connection;
|
1065
1073
|
oldTarget.export = exportName;
|
1074
|
+
oldTarget.priority = priority;
|
1075
|
+
this._maxTarget = undefined;
|
1066
1076
|
return true;
|
1067
1077
|
}
|
1068
1078
|
return false;
|
@@ -1171,6 +1181,29 @@ class ExportInfo {
|
|
1171
1181
|
return !this.terminalBinding && this._target && this._target.size > 0;
|
1172
1182
|
}
|
1173
1183
|
|
1184
|
+
_getMaxTarget() {
|
1185
|
+
if (this._maxTarget !== undefined) return this._maxTarget;
|
1186
|
+
if (this._target.size <= 1) return (this._maxTarget = this._target);
|
1187
|
+
let maxPriority = -Infinity;
|
1188
|
+
let minPriority = Infinity;
|
1189
|
+
for (const { priority } of this._target.values()) {
|
1190
|
+
if (maxPriority < priority) maxPriority = priority;
|
1191
|
+
if (minPriority > priority) minPriority = priority;
|
1192
|
+
}
|
1193
|
+
// This should be very common
|
1194
|
+
if (maxPriority === minPriority) return (this._maxTarget = this._target);
|
1195
|
+
|
1196
|
+
// This is an edge case
|
1197
|
+
const map = new Map();
|
1198
|
+
for (const [key, value] of this._target) {
|
1199
|
+
if (maxPriority === value.priority) {
|
1200
|
+
map.set(key, value);
|
1201
|
+
}
|
1202
|
+
}
|
1203
|
+
this._maxTarget = map;
|
1204
|
+
return map;
|
1205
|
+
}
|
1206
|
+
|
1174
1207
|
/**
|
1175
1208
|
* @param {ModuleGraph} moduleGraph the module graph
|
1176
1209
|
* @param {function(Module): boolean} validTargetModuleFilter a valid target module
|
@@ -1188,7 +1221,7 @@ class ExportInfo {
|
|
1188
1221
|
*/
|
1189
1222
|
_findTarget(moduleGraph, validTargetModuleFilter, alreadyVisited) {
|
1190
1223
|
if (!this._target || this._target.size === 0) return undefined;
|
1191
|
-
let rawTarget = this.
|
1224
|
+
let rawTarget = this._getMaxTarget().values().next().value;
|
1192
1225
|
if (!rawTarget) return undefined;
|
1193
1226
|
/** @type {{ module: Module, export: string[] | undefined }} */
|
1194
1227
|
let target = {
|
@@ -1296,7 +1329,7 @@ class ExportInfo {
|
|
1296
1329
|
if (alreadyVisited && alreadyVisited.has(this)) return CIRCULAR;
|
1297
1330
|
const newAlreadyVisited = new Set(alreadyVisited);
|
1298
1331
|
newAlreadyVisited.add(this);
|
1299
|
-
const values = this.
|
1332
|
+
const values = this._getMaxTarget().values();
|
1300
1333
|
const target = resolveTarget(values.next().value, newAlreadyVisited);
|
1301
1334
|
if (target === CIRCULAR) return CIRCULAR;
|
1302
1335
|
if (target === null) return undefined;
|
@@ -1324,7 +1357,7 @@ class ExportInfo {
|
|
1324
1357
|
const target = this._getTarget(moduleGraph, resolveTargetFilter, undefined);
|
1325
1358
|
if (target === CIRCULAR) return undefined;
|
1326
1359
|
if (!target) return undefined;
|
1327
|
-
const originalTarget = this.
|
1360
|
+
const originalTarget = this._getMaxTarget().values().next().value;
|
1328
1361
|
if (
|
1329
1362
|
originalTarget.connection === target.connection &&
|
1330
1363
|
originalTarget.export === target.export
|
@@ -1336,7 +1369,8 @@ class ExportInfo {
|
|
1336
1369
|
connection: updateOriginalConnection
|
1337
1370
|
? updateOriginalConnection(target)
|
1338
1371
|
: target.connection,
|
1339
|
-
export: target.export
|
1372
|
+
export: target.export,
|
1373
|
+
priority: 0
|
1340
1374
|
});
|
1341
1375
|
return target;
|
1342
1376
|
}
|
package/lib/FileSystemInfo.js
CHANGED
@@ -27,11 +27,12 @@ const RBDT_RESOLVE_CJS = 0;
|
|
27
27
|
const RBDT_RESOLVE_ESM = 1;
|
28
28
|
const RBDT_RESOLVE_DIRECTORY = 2;
|
29
29
|
const RBDT_RESOLVE_CJS_FILE = 3;
|
30
|
-
const
|
31
|
-
const
|
32
|
-
const
|
33
|
-
const
|
34
|
-
const
|
30
|
+
const RBDT_RESOLVE_CJS_FILE_AS_CHILD = 4;
|
31
|
+
const RBDT_RESOLVE_ESM_FILE = 5;
|
32
|
+
const RBDT_DIRECTORY = 6;
|
33
|
+
const RBDT_FILE = 7;
|
34
|
+
const RBDT_DIRECTORY_DEPENDENCIES = 8;
|
35
|
+
const RBDT_FILE_DEPENDENCIES = 9;
|
35
36
|
|
36
37
|
const INVALID = Symbol("invalid");
|
37
38
|
|
@@ -63,7 +64,7 @@ const INVALID = Symbol("invalid");
|
|
63
64
|
* @property {Set<string>} files list of files
|
64
65
|
* @property {Set<string>} directories list of directories
|
65
66
|
* @property {Set<string>} missing list of missing entries
|
66
|
-
* @property {Map<string, string>} resolveResults stored resolve results
|
67
|
+
* @property {Map<string, string | false>} resolveResults stored resolve results
|
67
68
|
* @property {Object} resolveDependencies dependencies of the resolving
|
68
69
|
* @property {Set<string>} resolveDependencies.files list of files
|
69
70
|
* @property {Set<string>} resolveDependencies.directories list of directories
|
@@ -1103,15 +1104,23 @@ class FileSystemInfo {
|
|
1103
1104
|
const resolveCjs = createResolver({
|
1104
1105
|
extensions: [".js", ".json", ".node"],
|
1105
1106
|
conditionNames: ["require", "node"],
|
1107
|
+
exportsFields: ["exports"],
|
1108
|
+
fileSystem: this.fs
|
1109
|
+
});
|
1110
|
+
const resolveCjsAsChild = createResolver({
|
1111
|
+
extensions: [".js", ".json", ".node"],
|
1112
|
+
conditionNames: ["require", "node"],
|
1113
|
+
exportsFields: [],
|
1106
1114
|
fileSystem: this.fs
|
1107
1115
|
});
|
1108
1116
|
const resolveEsm = createResolver({
|
1109
1117
|
extensions: [".js", ".json", ".node"],
|
1110
1118
|
fullySpecified: true,
|
1111
1119
|
conditionNames: ["import", "node"],
|
1120
|
+
exportsFields: ["exports"],
|
1112
1121
|
fileSystem: this.fs
|
1113
1122
|
});
|
1114
|
-
return { resolveContext, resolveEsm, resolveCjs };
|
1123
|
+
return { resolveContext, resolveEsm, resolveCjs, resolveCjsAsChild };
|
1115
1124
|
}
|
1116
1125
|
|
1117
1126
|
/**
|
@@ -1124,7 +1133,8 @@ class FileSystemInfo {
|
|
1124
1133
|
const {
|
1125
1134
|
resolveContext,
|
1126
1135
|
resolveEsm,
|
1127
|
-
resolveCjs
|
1136
|
+
resolveCjs,
|
1137
|
+
resolveCjsAsChild
|
1128
1138
|
} = this._createBuildDependenciesResolvers();
|
1129
1139
|
|
1130
1140
|
/** @type {Set<string>} */
|
@@ -1143,7 +1153,7 @@ class FileSystemInfo {
|
|
1143
1153
|
const resolveDirectories = new Set();
|
1144
1154
|
/** @type {Set<string>} */
|
1145
1155
|
const resolveMissing = new Set();
|
1146
|
-
/** @type {Map<string, string>} */
|
1156
|
+
/** @type {Map<string, string | false>} */
|
1147
1157
|
const resolveResults = new Map();
|
1148
1158
|
const invalidResolveResults = new Set();
|
1149
1159
|
const resolverContext = {
|
@@ -1211,13 +1221,11 @@ class FileSystemInfo {
|
|
1211
1221
|
resolveResults.set(key, undefined);
|
1212
1222
|
resolveContext(context, path, resolverContext, (err, result) => {
|
1213
1223
|
if (err) {
|
1214
|
-
|
1215
|
-
|
1216
|
-
err.code === "ENOENT" ||
|
1217
|
-
err.code === "UNDECLARED_DEPENDENCY"
|
1218
|
-
) {
|
1224
|
+
if (expected === false) {
|
1225
|
+
resolveResults.set(key, false);
|
1219
1226
|
return callback();
|
1220
1227
|
}
|
1228
|
+
invalidResolveResults.add(key);
|
1221
1229
|
err.message += `\nwhile resolving '${path}' in ${context} to a directory`;
|
1222
1230
|
return callback(err);
|
1223
1231
|
}
|
@@ -1239,12 +1247,12 @@ class FileSystemInfo {
|
|
1239
1247
|
}
|
1240
1248
|
resolveResults.set(key, undefined);
|
1241
1249
|
resolve(context, path, resolverContext, (err, result) => {
|
1242
|
-
if (expected) {
|
1250
|
+
if (typeof expected === "string") {
|
1243
1251
|
if (result === expected) {
|
1244
1252
|
resolveResults.set(key, result);
|
1245
1253
|
} else {
|
1246
1254
|
invalidResolveResults.add(key);
|
1247
|
-
this.logger.
|
1255
|
+
this.logger.warn(
|
1248
1256
|
`Resolving '${path}' in ${context} for build dependencies doesn't lead to expected result '${expected}', but to '${result}' instead. Resolving dependencies are ignored for this path.\n${pathToString(
|
1249
1257
|
job
|
1250
1258
|
)}`
|
@@ -1252,13 +1260,11 @@ class FileSystemInfo {
|
|
1252
1260
|
}
|
1253
1261
|
} else {
|
1254
1262
|
if (err) {
|
1255
|
-
|
1256
|
-
|
1257
|
-
err.code === "ENOENT" ||
|
1258
|
-
err.code === "UNDECLARED_DEPENDENCY"
|
1259
|
-
) {
|
1263
|
+
if (expected === false) {
|
1264
|
+
resolveResults.set(key, false);
|
1260
1265
|
return callback();
|
1261
1266
|
}
|
1267
|
+
invalidResolveResults.add(key);
|
1262
1268
|
err.message += `\nwhile resolving '${path}' in ${context} as file\n${pathToString(
|
1263
1269
|
job
|
1264
1270
|
)}`;
|
@@ -1303,6 +1309,10 @@ class FileSystemInfo {
|
|
1303
1309
|
resolveFile(path, "f", resolveCjs);
|
1304
1310
|
break;
|
1305
1311
|
}
|
1312
|
+
case RBDT_RESOLVE_CJS_FILE_AS_CHILD: {
|
1313
|
+
resolveFile(path, "c", resolveCjsAsChild);
|
1314
|
+
break;
|
1315
|
+
}
|
1306
1316
|
case RBDT_RESOLVE_ESM_FILE: {
|
1307
1317
|
resolveFile(path, "e", resolveEsm);
|
1308
1318
|
break;
|
@@ -1382,11 +1392,29 @@ class FileSystemInfo {
|
|
1382
1392
|
const context = dirname(this.fs, path);
|
1383
1393
|
for (const modulePath of module.paths) {
|
1384
1394
|
if (childPath.startsWith(modulePath)) {
|
1385
|
-
let
|
1395
|
+
let subPath = childPath.slice(modulePath.length + 1);
|
1396
|
+
const packageMatch = /^(@[^\\/]+[\\/])[^\\/]+/.exec(
|
1397
|
+
subPath
|
1398
|
+
);
|
1399
|
+
if (packageMatch) {
|
1400
|
+
push({
|
1401
|
+
type: RBDT_FILE,
|
1402
|
+
context: undefined,
|
1403
|
+
path:
|
1404
|
+
modulePath +
|
1405
|
+
childPath[modulePath.length] +
|
1406
|
+
packageMatch[0] +
|
1407
|
+
childPath[modulePath.length] +
|
1408
|
+
"package.json",
|
1409
|
+
expected: false,
|
1410
|
+
issuer: job
|
1411
|
+
});
|
1412
|
+
}
|
1413
|
+
let request = subPath.replace(/\\/g, "/");
|
1386
1414
|
if (request.endsWith(".js"))
|
1387
1415
|
request = request.slice(0, -3);
|
1388
1416
|
push({
|
1389
|
-
type:
|
1417
|
+
type: RBDT_RESOLVE_CJS_FILE_AS_CHILD,
|
1390
1418
|
context,
|
1391
1419
|
path: request,
|
1392
1420
|
expected: child.filename,
|
@@ -1517,17 +1545,32 @@ class FileSystemInfo {
|
|
1517
1545
|
return callback(e);
|
1518
1546
|
}
|
1519
1547
|
const depsObject = packageData.dependencies;
|
1548
|
+
const optionalDepsObject = packageData.optionalDependencies;
|
1549
|
+
const allDeps = new Set();
|
1550
|
+
const optionalDeps = new Set();
|
1520
1551
|
if (typeof depsObject === "object" && depsObject) {
|
1521
1552
|
for (const dep of Object.keys(depsObject)) {
|
1522
|
-
|
1523
|
-
type: RBDT_RESOLVE_DIRECTORY,
|
1524
|
-
context: packagePath,
|
1525
|
-
path: dep,
|
1526
|
-
expected: undefined,
|
1527
|
-
issuer: job
|
1528
|
-
});
|
1553
|
+
allDeps.add(dep);
|
1529
1554
|
}
|
1530
1555
|
}
|
1556
|
+
if (
|
1557
|
+
typeof optionalDepsObject === "object" &&
|
1558
|
+
optionalDepsObject
|
1559
|
+
) {
|
1560
|
+
for (const dep of Object.keys(optionalDepsObject)) {
|
1561
|
+
allDeps.add(dep);
|
1562
|
+
optionalDeps.add(dep);
|
1563
|
+
}
|
1564
|
+
}
|
1565
|
+
for (const dep of allDeps) {
|
1566
|
+
push({
|
1567
|
+
type: RBDT_RESOLVE_DIRECTORY,
|
1568
|
+
context: packagePath,
|
1569
|
+
path: dep,
|
1570
|
+
expected: !optionalDeps.has(dep),
|
1571
|
+
issuer: job
|
1572
|
+
});
|
1573
|
+
}
|
1531
1574
|
callback();
|
1532
1575
|
});
|
1533
1576
|
break;
|
@@ -1555,13 +1598,14 @@ class FileSystemInfo {
|
|
1555
1598
|
}
|
1556
1599
|
|
1557
1600
|
/**
|
1558
|
-
* @param {Map<string, string>} resolveResults results from resolving
|
1601
|
+
* @param {Map<string, string | false>} resolveResults results from resolving
|
1559
1602
|
* @param {function(Error=, boolean=): void} callback callback with true when resolveResults resolve the same way
|
1560
1603
|
* @returns {void}
|
1561
1604
|
*/
|
1562
1605
|
checkResolveResultsValid(resolveResults, callback) {
|
1563
1606
|
const {
|
1564
1607
|
resolveCjs,
|
1608
|
+
resolveCjsAsChild,
|
1565
1609
|
resolveEsm,
|
1566
1610
|
resolveContext
|
1567
1611
|
} = this._createBuildDependenciesResolvers();
|
@@ -1573,6 +1617,8 @@ class FileSystemInfo {
|
|
1573
1617
|
switch (type) {
|
1574
1618
|
case "d":
|
1575
1619
|
resolveContext(context, path, {}, (err, result) => {
|
1620
|
+
if (expectedResult === false)
|
1621
|
+
return callback(err ? undefined : INVALID);
|
1576
1622
|
if (err) return callback(err);
|
1577
1623
|
if (result !== expectedResult) return callback(INVALID);
|
1578
1624
|
callback();
|
@@ -1580,6 +1626,17 @@ class FileSystemInfo {
|
|
1580
1626
|
break;
|
1581
1627
|
case "f":
|
1582
1628
|
resolveCjs(context, path, {}, (err, result) => {
|
1629
|
+
if (expectedResult === false)
|
1630
|
+
return callback(err ? undefined : INVALID);
|
1631
|
+
if (err) return callback(err);
|
1632
|
+
if (result !== expectedResult) return callback(INVALID);
|
1633
|
+
callback();
|
1634
|
+
});
|
1635
|
+
break;
|
1636
|
+
case "c":
|
1637
|
+
resolveCjsAsChild(context, path, {}, (err, result) => {
|
1638
|
+
if (expectedResult === false)
|
1639
|
+
return callback(err ? undefined : INVALID);
|
1583
1640
|
if (err) return callback(err);
|
1584
1641
|
if (result !== expectedResult) return callback(INVALID);
|
1585
1642
|
callback();
|
@@ -1587,6 +1644,8 @@ class FileSystemInfo {
|
|
1587
1644
|
break;
|
1588
1645
|
case "e":
|
1589
1646
|
resolveEsm(context, path, {}, (err, result) => {
|
1647
|
+
if (expectedResult === false)
|
1648
|
+
return callback(err ? undefined : INVALID);
|
1590
1649
|
if (err) return callback(err);
|
1591
1650
|
if (result !== expectedResult) return callback(INVALID);
|
1592
1651
|
callback();
|
@@ -119,6 +119,7 @@ class FlagDependencyExportsPlugin {
|
|
119
119
|
const exports = exportDesc.exports;
|
120
120
|
const globalCanMangle = exportDesc.canMangle;
|
121
121
|
const globalFrom = exportDesc.from;
|
122
|
+
const globalPriority = exportDesc.priority;
|
122
123
|
const globalTerminalBinding =
|
123
124
|
exportDesc.terminalBinding || false;
|
124
125
|
const exportDeps = exportDesc.dependencies;
|
@@ -135,7 +136,8 @@ class FlagDependencyExportsPlugin {
|
|
135
136
|
globalCanMangle,
|
136
137
|
exportDesc.excludeExports,
|
137
138
|
globalFrom && dep,
|
138
|
-
globalFrom
|
139
|
+
globalFrom,
|
140
|
+
globalPriority
|
139
141
|
)
|
140
142
|
) {
|
141
143
|
changed = true;
|
@@ -154,6 +156,7 @@ class FlagDependencyExportsPlugin {
|
|
154
156
|
let exports = undefined;
|
155
157
|
let from = globalFrom;
|
156
158
|
let fromExport = undefined;
|
159
|
+
let priority = globalPriority;
|
157
160
|
let hidden = false;
|
158
161
|
if (typeof exportNameOrSpec === "string") {
|
159
162
|
name = exportNameOrSpec;
|
@@ -167,6 +170,8 @@ class FlagDependencyExportsPlugin {
|
|
167
170
|
exports = exportNameOrSpec.exports;
|
168
171
|
if (exportNameOrSpec.from !== undefined)
|
169
172
|
from = exportNameOrSpec.from;
|
173
|
+
if (exportNameOrSpec.priority !== undefined)
|
174
|
+
priority = exportNameOrSpec.priority;
|
170
175
|
if (exportNameOrSpec.terminalBinding !== undefined)
|
171
176
|
terminalBinding = exportNameOrSpec.terminalBinding;
|
172
177
|
if (exportNameOrSpec.hidden !== undefined)
|
@@ -174,7 +179,10 @@ class FlagDependencyExportsPlugin {
|
|
174
179
|
}
|
175
180
|
const exportInfo = exportsInfo.getExportInfo(name);
|
176
181
|
|
177
|
-
if (
|
182
|
+
if (
|
183
|
+
exportInfo.provided === false ||
|
184
|
+
exportInfo.provided === null
|
185
|
+
) {
|
178
186
|
exportInfo.provided = true;
|
179
187
|
changed = true;
|
180
188
|
}
|
@@ -204,7 +212,8 @@ class FlagDependencyExportsPlugin {
|
|
204
212
|
: exportInfo.setTarget(
|
205
213
|
dep,
|
206
214
|
from,
|
207
|
-
fromExport === undefined ? [name] : fromExport
|
215
|
+
fromExport === undefined ? [name] : fromExport,
|
216
|
+
priority
|
208
217
|
))
|
209
218
|
) {
|
210
219
|
changed = true;
|
@@ -29,7 +29,7 @@ class PackContainer {
|
|
29
29
|
* @param {string} version version identifier
|
30
30
|
* @param {Snapshot} buildSnapshot snapshot of all build dependencies
|
31
31
|
* @param {Set<string>} buildDependencies list of all unresolved build dependencies captured
|
32
|
-
* @param {Map<string, string>} resolveResults result of the resolved build dependencies
|
32
|
+
* @param {Map<string, string | false>} resolveResults result of the resolved build dependencies
|
33
33
|
* @param {Snapshot} resolveBuildDependenciesSnapshot snapshot of the dependencies of the build dependencies resolving
|
34
34
|
*/
|
35
35
|
constructor(
|
@@ -809,7 +809,7 @@ class PackFileCacheStrategy {
|
|
809
809
|
this.newBuildDependencies = new LazySet();
|
810
810
|
/** @type {Snapshot} */
|
811
811
|
this.resolveBuildDependenciesSnapshot = undefined;
|
812
|
-
/** @type {Map<string, string>} */
|
812
|
+
/** @type {Map<string, string | false>} */
|
813
813
|
this.resolveResults = undefined;
|
814
814
|
/** @type {Snapshot} */
|
815
815
|
this.buildSnapshot = undefined;
|
@@ -838,7 +838,7 @@ class PackFileCacheStrategy {
|
|
838
838
|
let newBuildDependencies;
|
839
839
|
/** @type {Snapshot} */
|
840
840
|
let resolveBuildDependenciesSnapshot;
|
841
|
-
/** @type {Map<string, string>} */
|
841
|
+
/** @type {Map<string, string | false>} */
|
842
842
|
let resolveResults;
|
843
843
|
logger.time("restore cache container");
|
844
844
|
return this.fileSerializer
|
package/lib/config/defaults.js
CHANGED
@@ -117,6 +117,7 @@ const A = (obj, prop, factory) => {
|
|
117
117
|
*/
|
118
118
|
const applyWebpackOptionsBaseDefaults = options => {
|
119
119
|
F(options, "context", () => process.cwd());
|
120
|
+
applyInfrastructureLoggingDefaults(options.infrastructureLogging);
|
120
121
|
};
|
121
122
|
|
122
123
|
/**
|
@@ -235,8 +236,6 @@ const applyWebpackOptionsDefaults = options => {
|
|
235
236
|
getResolveLoaderDefaults({ cache }),
|
236
237
|
options.resolveLoader
|
237
238
|
);
|
238
|
-
|
239
|
-
applyInfrastructureLoggingDefaults(options.infrastructureLogging);
|
240
239
|
};
|
241
240
|
|
242
241
|
/**
|
@@ -1077,8 +1076,14 @@ const getResolveLoaderDefaults = ({ cache }) => {
|
|
1077
1076
|
* @returns {void}
|
1078
1077
|
*/
|
1079
1078
|
const applyInfrastructureLoggingDefaults = infrastructureLogging => {
|
1079
|
+
F(infrastructureLogging, "stream", () => process.stderr);
|
1080
|
+
const tty =
|
1081
|
+
/** @type {any} */ (infrastructureLogging.stream).isTTY &&
|
1082
|
+
process.env.TERM !== "dumb";
|
1080
1083
|
D(infrastructureLogging, "level", "info");
|
1081
1084
|
D(infrastructureLogging, "debug", false);
|
1085
|
+
D(infrastructureLogging, "colors", tty);
|
1086
|
+
D(infrastructureLogging, "appendOnly", !tty);
|
1082
1087
|
};
|
1083
1088
|
|
1084
1089
|
exports.applyWebpackOptionsBaseDefaults = applyWebpackOptionsBaseDefaults;
|
@@ -543,6 +543,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|
543
543
|
export: item.ids,
|
544
544
|
hidden: item.hidden
|
545
545
|
})),
|
546
|
+
priority: 1,
|
546
547
|
dependencies: [from.module]
|
547
548
|
};
|
548
549
|
}
|
@@ -557,6 +558,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|
557
558
|
export: ["default"]
|
558
559
|
}
|
559
560
|
],
|
561
|
+
priority: 1,
|
560
562
|
dependencies: [from.module]
|
561
563
|
};
|
562
564
|
}
|
@@ -584,6 +586,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|
584
586
|
]
|
585
587
|
}
|
586
588
|
],
|
589
|
+
priority: 1,
|
587
590
|
dependencies: [from.module]
|
588
591
|
};
|
589
592
|
}
|
@@ -597,6 +600,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|
597
600
|
export: null
|
598
601
|
}
|
599
602
|
],
|
603
|
+
priority: 1,
|
600
604
|
dependencies: [from.module]
|
601
605
|
};
|
602
606
|
}
|
@@ -610,6 +614,7 @@ class HarmonyExportImportedSpecifierDependency extends HarmonyImportDependency {
|
|
610
614
|
export: ["default"]
|
611
615
|
}
|
612
616
|
],
|
617
|
+
priority: 1,
|
613
618
|
dependencies: [from.module]
|
614
619
|
};
|
615
620
|
}
|
@@ -101,6 +101,7 @@ module.exports = function () {
|
|
101
101
|
}
|
102
102
|
|
103
103
|
function createModuleHotObject(moduleId, me) {
|
104
|
+
var _main = currentChildModule !== moduleId;
|
104
105
|
var hot = {
|
105
106
|
// private stuff
|
106
107
|
_acceptedDependencies: {},
|
@@ -110,10 +111,10 @@ module.exports = function () {
|
|
110
111
|
_selfDeclined: false,
|
111
112
|
_selfInvalidated: false,
|
112
113
|
_disposeHandlers: [],
|
113
|
-
_main:
|
114
|
+
_main: _main,
|
114
115
|
_requireSelf: function () {
|
115
116
|
currentParents = me.parents.slice();
|
116
|
-
currentChildModule = moduleId;
|
117
|
+
currentChildModule = _main ? undefined : moduleId;
|
117
118
|
__webpack_require__(moduleId);
|
118
119
|
},
|
119
120
|
|
@@ -207,7 +207,7 @@ module.exports = function () {
|
|
207
207
|
var module = $moduleCache$[outdatedModuleId];
|
208
208
|
if (
|
209
209
|
module &&
|
210
|
-
module.hot._selfAccepted &&
|
210
|
+
(module.hot._selfAccepted || module.hot._main) &&
|
211
211
|
// removed self-accepted modules should not be required
|
212
212
|
appliedUpdate[outdatedModuleId] !== warnUnexpectedRequire &&
|
213
213
|
// when called invalidate self-accepting is not possible
|
@@ -13,11 +13,29 @@ const { LogType } = require("./Logger");
|
|
13
13
|
|
14
14
|
/** @typedef {function(string): boolean} FilterFunction */
|
15
15
|
|
16
|
+
/**
|
17
|
+
* @typedef {Object} LoggerConsole
|
18
|
+
* @property {function(): void} clear
|
19
|
+
* @property {function(): void} trace
|
20
|
+
* @property {(...args: any[]) => void} info
|
21
|
+
* @property {(...args: any[]) => void} log
|
22
|
+
* @property {(...args: any[]) => void} warn
|
23
|
+
* @property {(...args: any[]) => void} error
|
24
|
+
* @property {(...args: any[]) => void=} debug
|
25
|
+
* @property {(...args: any[]) => void=} group
|
26
|
+
* @property {(...args: any[]) => void=} groupCollapsed
|
27
|
+
* @property {(...args: any[]) => void=} groupEnd
|
28
|
+
* @property {(...args: any[]) => void=} status
|
29
|
+
* @property {(...args: any[]) => void=} profile
|
30
|
+
* @property {(...args: any[]) => void=} profileEnd
|
31
|
+
* @property {(...args: any[]) => void=} logTime
|
32
|
+
*/
|
33
|
+
|
16
34
|
/**
|
17
35
|
* @typedef {Object} LoggerOptions
|
18
36
|
* @property {false|true|"none"|"error"|"warn"|"info"|"log"|"verbose"} level loglevel
|
19
37
|
* @property {FilterTypes|boolean} debug filter for debug logging
|
20
|
-
* @property {
|
38
|
+
* @property {LoggerConsole} console the console to log to
|
21
39
|
*/
|
22
40
|
|
23
41
|
/**
|
@@ -11,11 +11,16 @@ const createConsoleLogger = require("../logging/createConsoleLogger");
|
|
11
11
|
const NodeWatchFileSystem = require("./NodeWatchFileSystem");
|
12
12
|
const nodeConsole = require("./nodeConsole");
|
13
13
|
|
14
|
+
/** @typedef {import("../../declarations/WebpackOptions").InfrastructureLogging} InfrastructureLogging */
|
14
15
|
/** @typedef {import("../Compiler")} Compiler */
|
15
16
|
|
16
17
|
class NodeEnvironmentPlugin {
|
18
|
+
/**
|
19
|
+
* @param {Object} options options
|
20
|
+
* @param {InfrastructureLogging} options.infrastructureLogging infrastructure logging options
|
21
|
+
*/
|
17
22
|
constructor(options) {
|
18
|
-
this.options = options
|
23
|
+
this.options = options;
|
19
24
|
}
|
20
25
|
|
21
26
|
/**
|
@@ -24,16 +29,18 @@ class NodeEnvironmentPlugin {
|
|
24
29
|
* @returns {void}
|
25
30
|
*/
|
26
31
|
apply(compiler) {
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
32
|
+
const { infrastructureLogging } = this.options;
|
33
|
+
compiler.infrastructureLogger = createConsoleLogger({
|
34
|
+
level: infrastructureLogging.level || "info",
|
35
|
+
debug: infrastructureLogging.debug || false,
|
36
|
+
console:
|
37
|
+
infrastructureLogging.console ||
|
38
|
+
nodeConsole({
|
39
|
+
colors: infrastructureLogging.colors,
|
40
|
+
appendOnly: infrastructureLogging.appendOnly,
|
41
|
+
stream: infrastructureLogging.stream
|
42
|
+
})
|
43
|
+
});
|
37
44
|
compiler.inputFileSystem = new CachedInputFileSystem(fs, 60000);
|
38
45
|
const inputFileSystem = compiler.inputFileSystem;
|
39
46
|
compiler.outputFileSystem = fs;
|
package/lib/node/nodeConsole.js
CHANGED
@@ -8,127 +8,136 @@
|
|
8
8
|
const util = require("util");
|
9
9
|
const truncateArgs = require("../logging/truncateArgs");
|
10
10
|
|
11
|
-
|
11
|
+
module.exports = ({ colors, appendOnly, stream }) => {
|
12
|
+
let currentStatusMessage = undefined;
|
13
|
+
let hasStatusMessage = false;
|
14
|
+
let currentIndent = "";
|
15
|
+
let currentCollapsed = 0;
|
12
16
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
);
|
28
|
-
} else {
|
29
|
-
return prefix + str.replace(/\n/g, "\n" + prefix);
|
30
|
-
}
|
31
|
-
};
|
17
|
+
const indent = (str, prefix, colorPrefix, colorSuffix) => {
|
18
|
+
if (str === "") return str;
|
19
|
+
prefix = currentIndent + prefix;
|
20
|
+
if (colors) {
|
21
|
+
return (
|
22
|
+
prefix +
|
23
|
+
colorPrefix +
|
24
|
+
str.replace(/\n/g, colorSuffix + "\n" + prefix + colorPrefix) +
|
25
|
+
colorSuffix
|
26
|
+
);
|
27
|
+
} else {
|
28
|
+
return prefix + str.replace(/\n/g, "\n" + prefix);
|
29
|
+
}
|
30
|
+
};
|
32
31
|
|
33
|
-
const clearStatusMessage = () => {
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
};
|
32
|
+
const clearStatusMessage = () => {
|
33
|
+
if (hasStatusMessage) {
|
34
|
+
stream.write("\x1b[2K\r");
|
35
|
+
hasStatusMessage = false;
|
36
|
+
}
|
37
|
+
};
|
39
38
|
|
40
|
-
const writeStatusMessage = () => {
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
};
|
39
|
+
const writeStatusMessage = () => {
|
40
|
+
if (!currentStatusMessage) return;
|
41
|
+
const l = stream.columns;
|
42
|
+
const args = l
|
43
|
+
? truncateArgs(currentStatusMessage, l - 1)
|
44
|
+
: currentStatusMessage;
|
45
|
+
const str = args.join(" ");
|
46
|
+
const coloredStr = `\u001b[1m${str}\u001b[39m\u001b[22m`;
|
47
|
+
stream.write(`\x1b[2K\r${coloredStr}`);
|
48
|
+
hasStatusMessage = true;
|
49
|
+
};
|
51
50
|
|
52
|
-
const writeColored = (prefix, colorPrefix, colorSuffix) => {
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
51
|
+
const writeColored = (prefix, colorPrefix, colorSuffix) => {
|
52
|
+
return (...args) => {
|
53
|
+
if (currentCollapsed > 0) return;
|
54
|
+
clearStatusMessage();
|
55
|
+
const str = indent(
|
56
|
+
util.format(...args),
|
57
|
+
prefix,
|
58
|
+
colorPrefix,
|
59
|
+
colorSuffix
|
60
|
+
);
|
61
|
+
stream.write(str + "\n");
|
62
|
+
writeStatusMessage();
|
63
|
+
};
|
59
64
|
};
|
60
|
-
};
|
61
65
|
|
62
|
-
const writeGroupMessage = writeColored(
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
);
|
66
|
+
const writeGroupMessage = writeColored(
|
67
|
+
"<-> ",
|
68
|
+
"\u001b[1m\u001b[36m",
|
69
|
+
"\u001b[39m\u001b[22m"
|
70
|
+
);
|
67
71
|
|
68
|
-
const writeGroupCollapsedMessage = writeColored(
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
);
|
72
|
+
const writeGroupCollapsedMessage = writeColored(
|
73
|
+
"<+> ",
|
74
|
+
"\u001b[1m\u001b[36m",
|
75
|
+
"\u001b[39m\u001b[22m"
|
76
|
+
);
|
73
77
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
78
|
+
return {
|
79
|
+
log: writeColored(" ", "\u001b[1m", "\u001b[22m"),
|
80
|
+
debug: writeColored(" ", "", ""),
|
81
|
+
trace: writeColored(" ", "", ""),
|
82
|
+
info: writeColored("<i> ", "\u001b[1m\u001b[32m", "\u001b[39m\u001b[22m"),
|
83
|
+
warn: writeColored("<w> ", "\u001b[1m\u001b[33m", "\u001b[39m\u001b[22m"),
|
84
|
+
error: writeColored("<e> ", "\u001b[1m\u001b[31m", "\u001b[39m\u001b[22m"),
|
85
|
+
logTime: writeColored(
|
86
|
+
"<t> ",
|
87
|
+
"\u001b[1m\u001b[35m",
|
88
|
+
"\u001b[39m\u001b[22m"
|
89
|
+
),
|
90
|
+
group: (...args) => {
|
91
|
+
writeGroupMessage(...args);
|
92
|
+
if (currentCollapsed > 0) {
|
93
|
+
currentCollapsed++;
|
94
|
+
} else {
|
95
|
+
currentIndent += " ";
|
96
|
+
}
|
97
|
+
},
|
98
|
+
groupCollapsed: (...args) => {
|
99
|
+
writeGroupCollapsedMessage(...args);
|
85
100
|
currentCollapsed++;
|
86
|
-
}
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
currentCollapsed++;
|
93
|
-
},
|
94
|
-
groupEnd: () => {
|
95
|
-
if (currentCollapsed > 0) currentCollapsed--;
|
96
|
-
else if (currentIndent.length >= 2)
|
97
|
-
currentIndent = currentIndent.slice(0, currentIndent.length - 2);
|
98
|
-
},
|
99
|
-
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
100
|
-
profile: console.profile && (name => console.profile(name)),
|
101
|
-
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
102
|
-
profileEnd: console.profileEnd && (name => console.profileEnd(name)),
|
103
|
-
clear:
|
104
|
-
tty &&
|
101
|
+
},
|
102
|
+
groupEnd: () => {
|
103
|
+
if (currentCollapsed > 0) currentCollapsed--;
|
104
|
+
else if (currentIndent.length >= 2)
|
105
|
+
currentIndent = currentIndent.slice(0, currentIndent.length - 2);
|
106
|
+
},
|
105
107
|
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
106
|
-
console.
|
107
|
-
|
108
|
-
|
108
|
+
profile: console.profile && (name => console.profile(name)),
|
109
|
+
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
110
|
+
profileEnd: console.profileEnd && (name => console.profileEnd(name)),
|
111
|
+
clear:
|
112
|
+
!appendOnly &&
|
109
113
|
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
110
|
-
console.clear
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
name.
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
114
|
+
console.clear &&
|
115
|
+
(() => {
|
116
|
+
clearStatusMessage();
|
117
|
+
// eslint-disable-next-line node/no-unsupported-features/node-builtins
|
118
|
+
console.clear();
|
119
|
+
writeStatusMessage();
|
120
|
+
}),
|
121
|
+
status: appendOnly
|
122
|
+
? writeColored("<s> ", "", "")
|
123
|
+
: (name, ...args) => {
|
124
|
+
args = args.filter(Boolean);
|
125
|
+
if (name === undefined && args.length === 0) {
|
126
|
+
clearStatusMessage();
|
127
|
+
currentStatusMessage = undefined;
|
128
|
+
} else if (
|
129
|
+
typeof name === "string" &&
|
130
|
+
name.startsWith("[webpack.Progress] ")
|
131
|
+
) {
|
132
|
+
currentStatusMessage = [name.slice(19), ...args];
|
133
|
+
writeStatusMessage();
|
134
|
+
} else if (name === "[webpack.Progress]") {
|
135
|
+
currentStatusMessage = [...args];
|
136
|
+
writeStatusMessage();
|
137
|
+
} else {
|
138
|
+
currentStatusMessage = [name, ...args];
|
139
|
+
writeStatusMessage();
|
140
|
+
}
|
141
|
+
}
|
142
|
+
};
|
134
143
|
};
|
package/lib/util/runtime.js
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "webpack",
|
3
|
-
"version": "5.
|
3
|
+
"version": "5.31.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",
|
@@ -53,7 +53,7 @@
|
|
53
53
|
"es5-ext": "^0.10.53",
|
54
54
|
"es6-promise-polyfill": "^1.2.0",
|
55
55
|
"eslint": "^7.14.0",
|
56
|
-
"eslint-config-prettier": "^
|
56
|
+
"eslint-config-prettier": "^8.1.0",
|
57
57
|
"eslint-plugin-jest": "^24.1.3",
|
58
58
|
"eslint-plugin-jsdoc": "^32.0.2",
|
59
59
|
"eslint-plugin-node": "^11.0.0",
|
@@ -1211,6 +1211,18 @@
|
|
1211
1211
|
"type": "object",
|
1212
1212
|
"additionalProperties": false,
|
1213
1213
|
"properties": {
|
1214
|
+
"appendOnly": {
|
1215
|
+
"description": "Only appends lines to the output. Avoids updating existing output e. g. for status messages. This option is only used when no custom console is provided.",
|
1216
|
+
"type": "boolean"
|
1217
|
+
},
|
1218
|
+
"colors": {
|
1219
|
+
"description": "Enables/Disables colorful output. This option is only used when no custom console is provided.",
|
1220
|
+
"type": "boolean"
|
1221
|
+
},
|
1222
|
+
"console": {
|
1223
|
+
"description": "Custom console used for logging.",
|
1224
|
+
"tsType": "Console"
|
1225
|
+
},
|
1214
1226
|
"debug": {
|
1215
1227
|
"description": "Enable debug logging for specific loggers.",
|
1216
1228
|
"anyOf": [
|
@@ -1226,6 +1238,10 @@
|
|
1226
1238
|
"level": {
|
1227
1239
|
"description": "Log level.",
|
1228
1240
|
"enum": ["none", "error", "warn", "info", "log", "verbose"]
|
1241
|
+
},
|
1242
|
+
"stream": {
|
1243
|
+
"description": "Stream used for logging output. Defaults to process.stderr. This option is only used when no custom console is provided.",
|
1244
|
+
"tsType": "NodeJS.WritableStream"
|
1229
1245
|
}
|
1230
1246
|
}
|
1231
1247
|
},
|
package/types.d.ts
CHANGED
@@ -3197,9 +3197,10 @@ declare abstract class ExportInfo {
|
|
3197
3197
|
setUsed(newValue: UsageStateType, runtime: RuntimeSpec): boolean;
|
3198
3198
|
unsetTarget(key?: any): boolean;
|
3199
3199
|
setTarget(
|
3200
|
-
key
|
3201
|
-
connection
|
3202
|
-
exportName?: string[]
|
3200
|
+
key: any,
|
3201
|
+
connection: ModuleGraphConnection,
|
3202
|
+
exportName?: string[],
|
3203
|
+
priority?: number
|
3203
3204
|
): boolean;
|
3204
3205
|
getUsed(runtime: RuntimeSpec): UsageStateType;
|
3205
3206
|
|
@@ -3303,6 +3304,11 @@ declare interface ExportSpec {
|
|
3303
3304
|
*/
|
3304
3305
|
export?: null | string[];
|
3305
3306
|
|
3307
|
+
/**
|
3308
|
+
* when reexported: with which priority
|
3309
|
+
*/
|
3310
|
+
priority?: number;
|
3311
|
+
|
3306
3312
|
/**
|
3307
3313
|
* export is not visible, because another export blends over it
|
3308
3314
|
*/
|
@@ -3327,7 +3333,8 @@ declare abstract class ExportsInfo {
|
|
3327
3333
|
canMangle?: boolean,
|
3328
3334
|
excludeExports?: Set<string>,
|
3329
3335
|
targetKey?: any,
|
3330
|
-
targetModule?: ModuleGraphConnection
|
3336
|
+
targetModule?: ModuleGraphConnection,
|
3337
|
+
priority?: number
|
3331
3338
|
): boolean;
|
3332
3339
|
setUsedInUnknownWay(runtime: RuntimeSpec): boolean;
|
3333
3340
|
setUsedWithoutInfo(runtime: RuntimeSpec): boolean;
|
@@ -3376,6 +3383,11 @@ declare interface ExportsSpec {
|
|
3376
3383
|
*/
|
3377
3384
|
from?: ModuleGraphConnection;
|
3378
3385
|
|
3386
|
+
/**
|
3387
|
+
* when reexported: with which priority
|
3388
|
+
*/
|
3389
|
+
priority?: number;
|
3390
|
+
|
3379
3391
|
/**
|
3380
3392
|
* can the export be renamed (defaults to true)
|
3381
3393
|
*/
|
@@ -3829,7 +3841,7 @@ declare abstract class FileSystemInfo {
|
|
3829
3841
|
callback: (arg0?: Error, arg1?: ResolveBuildDependenciesResult) => void
|
3830
3842
|
): void;
|
3831
3843
|
checkResolveResultsValid(
|
3832
|
-
resolveResults: Map<string, string>,
|
3844
|
+
resolveResults: Map<string, string | false>,
|
3833
3845
|
callback: (arg0?: Error, arg1?: boolean) => void
|
3834
3846
|
): void;
|
3835
3847
|
createSnapshot(
|
@@ -4184,6 +4196,21 @@ type ImportSource = undefined | null | string | SimpleLiteral | RegExpLiteral;
|
|
4184
4196
|
* Options for infrastructure level logging.
|
4185
4197
|
*/
|
4186
4198
|
declare interface InfrastructureLogging {
|
4199
|
+
/**
|
4200
|
+
* Only appends lines to the output. Avoids updating existing output e. g. for status messages. This option is only used when no custom console is provided.
|
4201
|
+
*/
|
4202
|
+
appendOnly?: boolean;
|
4203
|
+
|
4204
|
+
/**
|
4205
|
+
* Enables/Disables colorful output. This option is only used when no custom console is provided.
|
4206
|
+
*/
|
4207
|
+
colors?: boolean;
|
4208
|
+
|
4209
|
+
/**
|
4210
|
+
* Custom console used for logging.
|
4211
|
+
*/
|
4212
|
+
console?: Console;
|
4213
|
+
|
4187
4214
|
/**
|
4188
4215
|
* Enable debug logging for specific loggers.
|
4189
4216
|
*/
|
@@ -4198,6 +4225,11 @@ declare interface InfrastructureLogging {
|
|
4198
4225
|
* Log level.
|
4199
4226
|
*/
|
4200
4227
|
level?: "none" | "verbose" | "error" | "warn" | "info" | "log";
|
4228
|
+
|
4229
|
+
/**
|
4230
|
+
* Stream used for logging output. Defaults to process.stderr. This option is only used when no custom console is provided.
|
4231
|
+
*/
|
4232
|
+
stream?: NodeJS.WritableStream;
|
4201
4233
|
}
|
4202
4234
|
declare abstract class InitFragment {
|
4203
4235
|
content: string | Source;
|
@@ -6493,8 +6525,18 @@ declare class NoEmitOnErrorsPlugin {
|
|
6493
6525
|
apply(compiler: Compiler): void;
|
6494
6526
|
}
|
6495
6527
|
declare class NodeEnvironmentPlugin {
|
6496
|
-
constructor(options
|
6497
|
-
|
6528
|
+
constructor(options: {
|
6529
|
+
/**
|
6530
|
+
* infrastructure logging options
|
6531
|
+
*/
|
6532
|
+
infrastructureLogging: InfrastructureLogging;
|
6533
|
+
});
|
6534
|
+
options: {
|
6535
|
+
/**
|
6536
|
+
* infrastructure logging options
|
6537
|
+
*/
|
6538
|
+
infrastructureLogging: InfrastructureLogging;
|
6539
|
+
};
|
6498
6540
|
|
6499
6541
|
/**
|
6500
6542
|
* Apply the plugin
|
@@ -8333,7 +8375,7 @@ declare interface ResolveBuildDependenciesResult {
|
|
8333
8375
|
/**
|
8334
8376
|
* stored resolve results
|
8335
8377
|
*/
|
8336
|
-
resolveResults: Map<string, string>;
|
8378
|
+
resolveResults: Map<string, string | false>;
|
8337
8379
|
|
8338
8380
|
/**
|
8339
8381
|
* dependencies of the resolving
|