webpack 5.82.1 → 5.83.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/hot/dev-server.js +2 -1
- package/hot/lazy-compilation-node.js +10 -0
- package/hot/lazy-compilation-web.js +9 -0
- package/hot/log-apply-result.js +5 -0
- package/hot/log.js +22 -0
- package/hot/only-dev-server.js +2 -1
- package/hot/poll.js +3 -0
- package/hot/signal.js +4 -0
- package/lib/Chunk.js +1 -1
- package/lib/Compilation.js +6 -1
- package/lib/ModuleFilenameHelpers.js +1 -1
- package/lib/config/defaults.js +7 -1
- package/lib/dependencies/HarmonyExportExpressionDependency.js +3 -2
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +2 -1
- package/lib/dependencies/HarmonyExportInitFragment.js +2 -1
- package/lib/index.js +2 -0
- package/lib/optimize/ConcatenatedModule.js +5 -4
- package/lib/util/propertyAccess.js +4 -54
- package/lib/util/propertyName.js +79 -0
- package/module.d.ts +54 -37
- package/package.json +3 -3
- package/types.d.ts +12 -5
package/hot/dev-server.js
CHANGED
@@ -4,9 +4,10 @@
|
|
4
4
|
*/
|
5
5
|
/* globals __webpack_hash__ */
|
6
6
|
if (module.hot) {
|
7
|
+
/** @type {undefined|string} */
|
7
8
|
var lastHash;
|
8
9
|
var upToDate = function upToDate() {
|
9
|
-
return lastHash.indexOf(__webpack_hash__) >= 0;
|
10
|
+
return /** @type {string} */ (lastHash).indexOf(__webpack_hash__) >= 0;
|
10
11
|
};
|
11
12
|
var log = require("./log");
|
12
13
|
var check = function check() {
|
@@ -3,11 +3,17 @@
|
|
3
3
|
"use strict";
|
4
4
|
|
5
5
|
var urlBase = decodeURIComponent(__resourceQuery.slice(1));
|
6
|
+
|
7
|
+
/**
|
8
|
+
* @param {{ data: string, onError: (err: Error) => void, active: boolean, module: module }} options options
|
9
|
+
* @returns {() => void} function to destroy response
|
10
|
+
*/
|
6
11
|
exports.keepAlive = function (options) {
|
7
12
|
var data = options.data;
|
8
13
|
var onError = options.onError;
|
9
14
|
var active = options.active;
|
10
15
|
var module = options.module;
|
16
|
+
/** @type {import("http").IncomingMessage} */
|
11
17
|
var response;
|
12
18
|
var request = (
|
13
19
|
urlBase.startsWith("https") ? require("https") : require("http")
|
@@ -27,6 +33,10 @@ exports.keepAlive = function (options) {
|
|
27
33
|
}
|
28
34
|
}
|
29
35
|
);
|
36
|
+
|
37
|
+
/**
|
38
|
+
* @param {Error} err error
|
39
|
+
*/
|
30
40
|
function errorHandler(err) {
|
31
41
|
err.message =
|
32
42
|
"Problem communicating active modules to the server: " + err.message;
|
@@ -9,6 +9,7 @@ if (typeof EventSource !== "function") {
|
|
9
9
|
}
|
10
10
|
|
11
11
|
var urlBase = decodeURIComponent(__resourceQuery.slice(1));
|
12
|
+
/** @type {EventSource | undefined} */
|
12
13
|
var activeEventSource;
|
13
14
|
var activeKeys = new Map();
|
14
15
|
var errorHandlers = new Set();
|
@@ -19,6 +20,10 @@ var updateEventSource = function updateEventSource() {
|
|
19
20
|
activeEventSource = new EventSource(
|
20
21
|
urlBase + Array.from(activeKeys.keys()).join("@")
|
21
22
|
);
|
23
|
+
/**
|
24
|
+
* @this {EventSource}
|
25
|
+
* @param {Event & { message?: string, filename?: string, lineno?: number, colno?: number, error?: Error }} event event
|
26
|
+
*/
|
22
27
|
activeEventSource.onerror = function (event) {
|
23
28
|
errorHandlers.forEach(function (onError) {
|
24
29
|
onError(
|
@@ -42,6 +47,10 @@ var updateEventSource = function updateEventSource() {
|
|
42
47
|
}
|
43
48
|
};
|
44
49
|
|
50
|
+
/**
|
51
|
+
* @param {{ data: string, onError: (err: Error) => void, active: boolean, module: module }} options options
|
52
|
+
* @returns {() => void} function to destroy response
|
53
|
+
*/
|
45
54
|
exports.keepAlive = function (options) {
|
46
55
|
var data = options.data;
|
47
56
|
var onError = options.onError;
|
package/hot/log-apply-result.js
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
3
|
Author Tobias Koppers @sokra
|
4
4
|
*/
|
5
|
+
|
6
|
+
/**
|
7
|
+
* @param {(string | number)[]} updatedModules updated modules
|
8
|
+
* @param {(string | number)[] | null} renewedModules renewed modules
|
9
|
+
*/
|
5
10
|
module.exports = function (updatedModules, renewedModules) {
|
6
11
|
var unacceptedModules = updatedModules.filter(function (moduleId) {
|
7
12
|
return renewedModules && renewedModules.indexOf(moduleId) < 0;
|
package/hot/log.js
CHANGED
@@ -1,7 +1,14 @@
|
|
1
|
+
/** @typedef {"info" | "warning" | "error"} LogLevel */
|
2
|
+
|
3
|
+
/** @type {LogLevel} */
|
1
4
|
var logLevel = "info";
|
2
5
|
|
3
6
|
function dummy() {}
|
4
7
|
|
8
|
+
/**
|
9
|
+
* @param {LogLevel} level log level
|
10
|
+
* @returns {boolean} true, if should log
|
11
|
+
*/
|
5
12
|
function shouldLog(level) {
|
6
13
|
var shouldLog =
|
7
14
|
(logLevel === "info" && level === "info") ||
|
@@ -10,6 +17,10 @@ function shouldLog(level) {
|
|
10
17
|
return shouldLog;
|
11
18
|
}
|
12
19
|
|
20
|
+
/**
|
21
|
+
* @param {(msg?: string) => void} logFn log function
|
22
|
+
* @returns {(level: LogLevel, msg?: string) => void} function that logs when log level is sufficient
|
23
|
+
*/
|
13
24
|
function logGroup(logFn) {
|
14
25
|
return function (level, msg) {
|
15
26
|
if (shouldLog(level)) {
|
@@ -18,6 +29,10 @@ function logGroup(logFn) {
|
|
18
29
|
};
|
19
30
|
}
|
20
31
|
|
32
|
+
/**
|
33
|
+
* @param {LogLevel} level log level
|
34
|
+
* @param {string|Error} msg message
|
35
|
+
*/
|
21
36
|
module.exports = function (level, msg) {
|
22
37
|
if (shouldLog(level)) {
|
23
38
|
if (level === "info") {
|
@@ -42,10 +57,17 @@ module.exports.groupCollapsed = logGroup(groupCollapsed);
|
|
42
57
|
|
43
58
|
module.exports.groupEnd = logGroup(groupEnd);
|
44
59
|
|
60
|
+
/**
|
61
|
+
* @param {LogLevel} level log level
|
62
|
+
*/
|
45
63
|
module.exports.setLogLevel = function (level) {
|
46
64
|
logLevel = level;
|
47
65
|
};
|
48
66
|
|
67
|
+
/**
|
68
|
+
* @param {Error} err error
|
69
|
+
* @returns {string} formatted error
|
70
|
+
*/
|
49
71
|
module.exports.formatError = function (err) {
|
50
72
|
var message = err.message;
|
51
73
|
var stack = err.stack;
|
package/hot/only-dev-server.js
CHANGED
@@ -4,9 +4,10 @@
|
|
4
4
|
*/
|
5
5
|
/*globals __webpack_hash__ */
|
6
6
|
if (module.hot) {
|
7
|
+
/** @type {undefined|string} */
|
7
8
|
var lastHash;
|
8
9
|
var upToDate = function upToDate() {
|
9
|
-
return lastHash.indexOf(__webpack_hash__) >= 0;
|
10
|
+
return /** @type {string} */ (lastHash).indexOf(__webpack_hash__) >= 0;
|
10
11
|
};
|
11
12
|
var log = require("./log");
|
12
13
|
var check = function check() {
|
package/hot/poll.js
CHANGED
@@ -7,6 +7,9 @@ if (module.hot) {
|
|
7
7
|
var hotPollInterval = +__resourceQuery.slice(1) || 10 * 60 * 1000;
|
8
8
|
var log = require("./log");
|
9
9
|
|
10
|
+
/**
|
11
|
+
* @param {boolean=} fromUpdate true when called from update
|
12
|
+
*/
|
10
13
|
var checkForUpdate = function checkForUpdate(fromUpdate) {
|
11
14
|
if (module.hot.status() === "idle") {
|
12
15
|
module.hot
|
package/hot/signal.js
CHANGED
package/lib/Chunk.js
CHANGED
@@ -505,7 +505,7 @@ class Chunk {
|
|
505
505
|
}
|
506
506
|
|
507
507
|
/**
|
508
|
-
* @returns {
|
508
|
+
* @returns {SortableSet<ChunkGroup>} the chunkGroups that the said chunk is referenced in
|
509
509
|
*/
|
510
510
|
get groupsIterable() {
|
511
511
|
this._groups.sort();
|
package/lib/Compilation.js
CHANGED
@@ -647,7 +647,12 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
|
|
647
647
|
|
648
648
|
/** @type {SyncHook<[]>} */
|
649
649
|
beforeChunks: new SyncHook([]),
|
650
|
-
/**
|
650
|
+
/**
|
651
|
+
* The `afterChunks` hook is called directly after the chunks and module graph have
|
652
|
+
* been created and before the chunks and modules have been optimized. This hook is useful to
|
653
|
+
* inspect, analyze, and/or modify the chunk graph.
|
654
|
+
* @type {SyncHook<[Iterable<Chunk>]>}
|
655
|
+
*/
|
651
656
|
afterChunks: new SyncHook(["chunks"]),
|
652
657
|
|
653
658
|
/** @type {SyncBailHook<[Iterable<Module>]>} */
|
@@ -14,7 +14,7 @@ const memoize = require("./util/memoize");
|
|
14
14
|
/** @typedef {import("./RequestShortener")} RequestShortener */
|
15
15
|
/** @typedef {typeof import("./util/Hash")} Hash */
|
16
16
|
|
17
|
-
/** @typedef {string | RegExp | string
|
17
|
+
/** @typedef {string | RegExp | (string | RegExp)[]} Matcher */
|
18
18
|
/** @typedef {{test?: Matcher, include?: Matcher, exclude?: Matcher }} MatchObject */
|
19
19
|
|
20
20
|
const ModuleFilenameHelpers = exports;
|
package/lib/config/defaults.js
CHANGED
@@ -289,7 +289,6 @@ const applyExperimentsDefaults = (
|
|
289
289
|
) => {
|
290
290
|
D(experiments, "futureDefaults", false);
|
291
291
|
D(experiments, "backCompat", !experiments.futureDefaults);
|
292
|
-
D(experiments, "topLevelAwait", experiments.futureDefaults);
|
293
292
|
D(experiments, "syncWebAssembly", false);
|
294
293
|
D(experiments, "asyncWebAssembly", experiments.futureDefaults);
|
295
294
|
D(experiments, "outputModule", false);
|
@@ -299,6 +298,13 @@ const applyExperimentsDefaults = (
|
|
299
298
|
D(experiments, "cacheUnaffected", experiments.futureDefaults);
|
300
299
|
F(experiments, "css", () => (experiments.futureDefaults ? {} : undefined));
|
301
300
|
|
301
|
+
// TODO webpack 6: remove this. topLevelAwait should be enabled by default
|
302
|
+
let shouldEnableTopLevelAwait = true;
|
303
|
+
if (typeof experiments.topLevelAwait === "boolean") {
|
304
|
+
shouldEnableTopLevelAwait = experiments.topLevelAwait;
|
305
|
+
}
|
306
|
+
D(experiments, "topLevelAwait", shouldEnableTopLevelAwait);
|
307
|
+
|
302
308
|
if (typeof experiments.buildHttp === "object") {
|
303
309
|
D(experiments.buildHttp, "frozen", production);
|
304
310
|
D(experiments.buildHttp, "upgrade", false);
|
@@ -8,6 +8,7 @@
|
|
8
8
|
const ConcatenationScope = require("../ConcatenationScope");
|
9
9
|
const RuntimeGlobals = require("../RuntimeGlobals");
|
10
10
|
const makeSerializable = require("../util/makeSerializable");
|
11
|
+
const propertyAccess = require("../util/propertyAccess");
|
11
12
|
const HarmonyExportInitFragment = require("./HarmonyExportInitFragment");
|
12
13
|
const NullDependency = require("./NullDependency");
|
13
14
|
|
@@ -172,9 +173,9 @@ HarmonyExportExpressionDependency.Template = class HarmonyExportDependencyTempla
|
|
172
173
|
if (used) {
|
173
174
|
runtimeRequirements.add(RuntimeGlobals.exports);
|
174
175
|
// This is a little bit incorrect as TDZ is not correct, but we can't use const.
|
175
|
-
content = `/* harmony default export */ ${exportsName}
|
176
|
+
content = `/* harmony default export */ ${exportsName}${propertyAccess(
|
176
177
|
used
|
177
|
-
)}
|
178
|
+
)} = `;
|
178
179
|
} else {
|
179
180
|
content = `/* unused harmony default export */ var ${name} = `;
|
180
181
|
}
|
@@ -15,6 +15,7 @@ const { countIterable } = require("../util/IterableHelpers");
|
|
15
15
|
const { first, combine } = require("../util/SetHelpers");
|
16
16
|
const makeSerializable = require("../util/makeSerializable");
|
17
17
|
const propertyAccess = require("../util/propertyAccess");
|
18
|
+
const { propertyName } = require("../util/propertyName");
|
18
19
|
const { getRuntimeKey, keyToRuntime } = require("../util/runtime");
|
19
20
|
const HarmonyExportInitFragment = require("./HarmonyExportInitFragment");
|
20
21
|
const HarmonyImportDependency = require("./HarmonyImportDependency");
|
@@ -1219,7 +1220,7 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
|
|
1219
1220
|
valueKey[0]
|
1220
1221
|
)})) ${
|
1221
1222
|
RuntimeGlobals.definePropertyGetters
|
1222
|
-
}(${exportsName}, { ${
|
1223
|
+
}(${exportsName}, { ${propertyName(
|
1223
1224
|
key
|
1224
1225
|
)}: function() { return ${returnValue}; } });\n`;
|
1225
1226
|
}
|
@@ -8,6 +8,7 @@
|
|
8
8
|
const InitFragment = require("../InitFragment");
|
9
9
|
const RuntimeGlobals = require("../RuntimeGlobals");
|
10
10
|
const { first } = require("../util/SetHelpers");
|
11
|
+
const { propertyName } = require("../util/propertyName");
|
11
12
|
|
12
13
|
/** @typedef {import("webpack-sources").Source} Source */
|
13
14
|
/** @typedef {import("../Generator").GenerateContext} GenerateContext */
|
@@ -150,7 +151,7 @@ class HarmonyExportInitFragment extends InitFragment {
|
|
150
151
|
);
|
151
152
|
for (const [key, value] of orderedExportMap) {
|
152
153
|
definitions.push(
|
153
|
-
`\n/* harmony export */ ${
|
154
|
+
`\n/* harmony export */ ${propertyName(
|
154
155
|
key
|
155
156
|
)}: ${runtimeTemplate.returningFunction(value)}`
|
156
157
|
);
|
package/lib/index.js
CHANGED
@@ -31,12 +31,14 @@ const memoize = require("./util/memoize");
|
|
31
31
|
/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptionsNormalized */
|
32
32
|
/** @typedef {import("../declarations/WebpackOptions").WebpackPluginFunction} WebpackPluginFunction */
|
33
33
|
/** @typedef {import("../declarations/WebpackOptions").WebpackPluginInstance} WebpackPluginInstance */
|
34
|
+
/** @typedef {import("./ChunkGroup")} ChunkGroup */
|
34
35
|
/** @typedef {import("./Compilation").Asset} Asset */
|
35
36
|
/** @typedef {import("./Compilation").AssetInfo} AssetInfo */
|
36
37
|
/** @typedef {import("./Compilation").EntryOptions} EntryOptions */
|
37
38
|
/** @typedef {import("./Compilation").PathData} PathData */
|
38
39
|
/** @typedef {import("./Compiler").AssetEmittedInfo} AssetEmittedInfo */
|
39
40
|
/** @typedef {import("./MultiStats")} MultiStats */
|
41
|
+
/** @typedef {import("./NormalModuleFactory").ResolveData} ResolveData */
|
40
42
|
/** @typedef {import("./Parser").ParserState} ParserState */
|
41
43
|
/** @typedef {import("./ResolverFactory").ResolvePluginInstance} ResolvePluginInstance */
|
42
44
|
/** @typedef {import("./ResolverFactory").Resolver} Resolver */
|
@@ -27,6 +27,7 @@ const createHash = require("../util/createHash");
|
|
27
27
|
const { makePathsRelative } = require("../util/identifier");
|
28
28
|
const makeSerializable = require("../util/makeSerializable");
|
29
29
|
const propertyAccess = require("../util/propertyAccess");
|
30
|
+
const { propertyName } = require("../util/propertyName");
|
30
31
|
const {
|
31
32
|
filterRuntime,
|
32
33
|
intersectRuntime,
|
@@ -1484,7 +1485,7 @@ class ConcatenatedModule extends Module {
|
|
1484
1485
|
const definitions = [];
|
1485
1486
|
for (const [key, value] of exportsMap) {
|
1486
1487
|
definitions.push(
|
1487
|
-
`\n ${
|
1488
|
+
`\n ${propertyName(key)}: ${runtimeTemplate.returningFunction(
|
1488
1489
|
value(requestShortener)
|
1489
1490
|
)}`
|
1490
1491
|
);
|
@@ -1529,9 +1530,9 @@ class ConcatenatedModule extends Module {
|
|
1529
1530
|
true
|
1530
1531
|
);
|
1531
1532
|
nsObj.push(
|
1532
|
-
`\n ${
|
1533
|
-
|
1534
|
-
)}
|
1533
|
+
`\n ${propertyName(usedName)}: ${runtimeTemplate.returningFunction(
|
1534
|
+
finalName
|
1535
|
+
)}`
|
1535
1536
|
);
|
1536
1537
|
}
|
1537
1538
|
}
|
@@ -5,60 +5,10 @@
|
|
5
5
|
|
6
6
|
"use strict";
|
7
7
|
|
8
|
-
const
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
"catch",
|
13
|
-
"class",
|
14
|
-
"const",
|
15
|
-
"continue",
|
16
|
-
"debugger",
|
17
|
-
"default",
|
18
|
-
"delete",
|
19
|
-
"do",
|
20
|
-
"else",
|
21
|
-
"export",
|
22
|
-
"extends",
|
23
|
-
"finally",
|
24
|
-
"for",
|
25
|
-
"function",
|
26
|
-
"if",
|
27
|
-
"import",
|
28
|
-
"in",
|
29
|
-
"instanceof",
|
30
|
-
"new",
|
31
|
-
"return",
|
32
|
-
"super",
|
33
|
-
"switch",
|
34
|
-
"this",
|
35
|
-
"throw",
|
36
|
-
"try",
|
37
|
-
"typeof",
|
38
|
-
"var",
|
39
|
-
"void",
|
40
|
-
"while",
|
41
|
-
"with",
|
42
|
-
"enum",
|
43
|
-
// strict mode
|
44
|
-
"implements",
|
45
|
-
"interface",
|
46
|
-
"let",
|
47
|
-
"package",
|
48
|
-
"private",
|
49
|
-
"protected",
|
50
|
-
"public",
|
51
|
-
"static",
|
52
|
-
"yield",
|
53
|
-
"yield",
|
54
|
-
// module code
|
55
|
-
"await",
|
56
|
-
// skip future reserved keywords defined under ES1 till ES3
|
57
|
-
// additional
|
58
|
-
"null",
|
59
|
-
"true",
|
60
|
-
"false"
|
61
|
-
]);
|
8
|
+
const {
|
9
|
+
SAFE_IDENTIFIER,
|
10
|
+
RESERVED_IDENTIFIER
|
11
|
+
} = require("../util/propertyName");
|
62
12
|
|
63
13
|
/**
|
64
14
|
* @param {ArrayLike<string>} properties properties
|
@@ -0,0 +1,79 @@
|
|
1
|
+
/*
|
2
|
+
MIT License http://www.opensource.org/licenses/mit-license.php
|
3
|
+
Author Tobias Koppers @sokra
|
4
|
+
*/
|
5
|
+
|
6
|
+
"use strict";
|
7
|
+
|
8
|
+
const SAFE_IDENTIFIER = /^[_a-zA-Z$][_a-zA-Z$0-9]*$/;
|
9
|
+
const RESERVED_IDENTIFIER = new Set([
|
10
|
+
"break",
|
11
|
+
"case",
|
12
|
+
"catch",
|
13
|
+
"class",
|
14
|
+
"const",
|
15
|
+
"continue",
|
16
|
+
"debugger",
|
17
|
+
"default",
|
18
|
+
"delete",
|
19
|
+
"do",
|
20
|
+
"else",
|
21
|
+
"export",
|
22
|
+
"extends",
|
23
|
+
"finally",
|
24
|
+
"for",
|
25
|
+
"function",
|
26
|
+
"if",
|
27
|
+
"import",
|
28
|
+
"in",
|
29
|
+
"instanceof",
|
30
|
+
"new",
|
31
|
+
"return",
|
32
|
+
"super",
|
33
|
+
"switch",
|
34
|
+
"this",
|
35
|
+
"throw",
|
36
|
+
"try",
|
37
|
+
"typeof",
|
38
|
+
"var",
|
39
|
+
"void",
|
40
|
+
"while",
|
41
|
+
"with",
|
42
|
+
"enum",
|
43
|
+
// strict mode
|
44
|
+
"implements",
|
45
|
+
"interface",
|
46
|
+
"let",
|
47
|
+
"package",
|
48
|
+
"private",
|
49
|
+
"protected",
|
50
|
+
"public",
|
51
|
+
"static",
|
52
|
+
"yield",
|
53
|
+
"yield",
|
54
|
+
// module code
|
55
|
+
"await",
|
56
|
+
// skip future reserved keywords defined under ES1 till ES3
|
57
|
+
// additional
|
58
|
+
"null",
|
59
|
+
"true",
|
60
|
+
"false"
|
61
|
+
]);
|
62
|
+
|
63
|
+
/**
|
64
|
+
* @summary Returns a valid JS property name for the given property.
|
65
|
+
* Certain strings like "default", "null", and names with whitespace are not
|
66
|
+
* valid JS property names, so they are returned as strings.
|
67
|
+
*
|
68
|
+
* @param {string} prop property name to analyze
|
69
|
+
* @returns {string} valid JS property name
|
70
|
+
*/
|
71
|
+
const propertyName = prop => {
|
72
|
+
if (SAFE_IDENTIFIER.test(prop) && !RESERVED_IDENTIFIER.has(prop)) {
|
73
|
+
return prop;
|
74
|
+
} else {
|
75
|
+
return JSON.stringify(prop);
|
76
|
+
}
|
77
|
+
};
|
78
|
+
|
79
|
+
module.exports = { SAFE_IDENTIFIER, RESERVED_IDENTIFIER, propertyName };
|
package/module.d.ts
CHANGED
@@ -1,45 +1,55 @@
|
|
1
1
|
declare namespace webpack {
|
2
|
-
type
|
3
|
-
| {
|
4
|
-
type: "disposed";
|
5
|
-
/** The module in question. */
|
6
|
-
moduleId: number;
|
7
|
-
}
|
8
|
-
| {
|
9
|
-
type: "self-declined" | "unaccepted";
|
10
|
-
/** The module in question. */
|
11
|
-
moduleId: number;
|
12
|
-
/** the chain from where the update was propagated. */
|
13
|
-
chain: number[];
|
14
|
-
}
|
2
|
+
type DeclinedEvent =
|
15
3
|
| {
|
16
4
|
type: "declined";
|
17
5
|
/** The module in question. */
|
18
|
-
moduleId: number;
|
6
|
+
moduleId: number | string;
|
19
7
|
/** the chain from where the update was propagated. */
|
20
|
-
chain: number[];
|
8
|
+
chain: (number | string)[];
|
21
9
|
/** the module id of the declining parent */
|
22
|
-
parentId: number;
|
10
|
+
parentId: number | string;
|
23
11
|
}
|
24
12
|
| {
|
25
|
-
type: "
|
13
|
+
type: "self-declined";
|
26
14
|
/** The module in question. */
|
27
|
-
moduleId: number;
|
15
|
+
moduleId: number | string;
|
28
16
|
/** the chain from where the update was propagated. */
|
29
|
-
chain: number[];
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
17
|
+
chain: (number | string)[];
|
18
|
+
};
|
19
|
+
|
20
|
+
type UnacceptedEvent = {
|
21
|
+
type: "unaccepted";
|
22
|
+
/** The module in question. */
|
23
|
+
moduleId: number | string;
|
24
|
+
/** the chain from where the update was propagated. */
|
25
|
+
chain: (number | string)[];
|
26
|
+
};
|
27
|
+
|
28
|
+
type AcceptedEvent = {
|
29
|
+
type: "accepted";
|
30
|
+
/** The module in question. */
|
31
|
+
moduleId: number | string;
|
32
|
+
/** the modules that are outdated and will be disposed */
|
33
|
+
outdatedModules: (number | string)[];
|
34
|
+
/** the accepted dependencies that are outdated */
|
35
|
+
outdatedDependencies: {
|
36
|
+
[id: number]: (number | string)[];
|
37
|
+
};
|
38
|
+
};
|
39
|
+
|
40
|
+
type DisposedEvent = {
|
41
|
+
type: "disposed";
|
42
|
+
/** The module in question. */
|
43
|
+
moduleId: number | string;
|
44
|
+
};
|
45
|
+
|
46
|
+
type ErroredEvent =
|
37
47
|
| {
|
38
48
|
type: "accept-error-handler-errored";
|
39
49
|
/** The module in question. */
|
40
|
-
moduleId: number;
|
50
|
+
moduleId: number | string;
|
41
51
|
/** the module id owning the accept handler. */
|
42
|
-
dependencyId: number;
|
52
|
+
dependencyId: number | string;
|
43
53
|
/** the thrown error */
|
44
54
|
error: Error;
|
45
55
|
/** the error thrown by the module before the error handler tried to handle it. */
|
@@ -48,7 +58,7 @@ declare namespace webpack {
|
|
48
58
|
| {
|
49
59
|
type: "self-accept-error-handler-errored";
|
50
60
|
/** The module in question. */
|
51
|
-
moduleId: number;
|
61
|
+
moduleId: number | string;
|
52
62
|
/** the thrown error */
|
53
63
|
error: Error;
|
54
64
|
/** the error thrown by the module before the error handler tried to handle it. */
|
@@ -57,29 +67,36 @@ declare namespace webpack {
|
|
57
67
|
| {
|
58
68
|
type: "accept-errored";
|
59
69
|
/** The module in question. */
|
60
|
-
moduleId: number;
|
70
|
+
moduleId: number | string;
|
61
71
|
/** the module id owning the accept handler. */
|
62
|
-
dependencyId: number;
|
72
|
+
dependencyId: number | string;
|
63
73
|
/** the thrown error */
|
64
74
|
error: Error;
|
65
75
|
}
|
66
76
|
| {
|
67
77
|
type: "self-accept-errored";
|
68
78
|
/** The module in question. */
|
69
|
-
moduleId: number;
|
79
|
+
moduleId: number | string;
|
70
80
|
/** the thrown error */
|
71
81
|
error: Error;
|
72
82
|
};
|
73
83
|
|
84
|
+
type HotEvent =
|
85
|
+
| DeclinedEvent
|
86
|
+
| UnacceptedEvent
|
87
|
+
| AcceptedEvent
|
88
|
+
| DisposedEvent
|
89
|
+
| ErroredEvent;
|
90
|
+
|
74
91
|
interface ApplyOptions {
|
75
92
|
ignoreUnaccepted?: boolean;
|
76
93
|
ignoreDeclined?: boolean;
|
77
94
|
ignoreErrored?: boolean;
|
78
|
-
onDeclined
|
79
|
-
onUnaccepted
|
80
|
-
onAccepted
|
81
|
-
onDisposed
|
82
|
-
onErrored
|
95
|
+
onDeclined?: (event: DeclinedEvent) => void;
|
96
|
+
onUnaccepted?: (event: UnacceptedEvent) => void;
|
97
|
+
onAccepted?: (event: AcceptedEvent) => void;
|
98
|
+
onDisposed?: (event: DisposedEvent) => void;
|
99
|
+
onErrored?: (event: ErroredEvent) => void;
|
83
100
|
}
|
84
101
|
|
85
102
|
const enum HotUpdateStatus {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "webpack",
|
3
|
-
"version": "5.
|
3
|
+
"version": "5.83.0",
|
4
4
|
"author": "Tobias Koppers @sokra",
|
5
5
|
"description": "Packs ECMAScript/CommonJs/AMD modules for the browser. Allows you to split your codebase into multiple bundles, which can be loaded on demand. Supports loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.",
|
6
6
|
"license": "MIT",
|
@@ -39,7 +39,7 @@
|
|
39
39
|
"@babel/core": "^7.21.4",
|
40
40
|
"@babel/preset-react": "^7.18.6",
|
41
41
|
"@types/jest": "^29.5.0",
|
42
|
-
"@types/node": "^
|
42
|
+
"@types/node": "^20.1.7",
|
43
43
|
"assemblyscript": "^0.27.2",
|
44
44
|
"babel-loader": "^8.1.0",
|
45
45
|
"benchmark": "^2.1.4",
|
@@ -173,7 +173,7 @@
|
|
173
173
|
"cover:unit": "node --max-old-space-size=4096 --experimental-vm-modules node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.unittest.js\" --coverage",
|
174
174
|
"cover:types": "node node_modules/tooling/type-coverage",
|
175
175
|
"cover:merge": "yarn mkdirp .nyc_output && nyc merge .nyc_output coverage/coverage-nyc.json && rimraf .nyc_output",
|
176
|
-
"cover:report": "nyc report -t coverage"
|
176
|
+
"cover:report": "nyc report --reporter=lcov --reporter=text -t coverage"
|
177
177
|
},
|
178
178
|
"lint-staged": {
|
179
179
|
"*.{js,cjs,mjs}": [
|
package/types.d.ts
CHANGED
@@ -839,7 +839,7 @@ declare class Chunk {
|
|
839
839
|
removeGroup(chunkGroup: ChunkGroup): void;
|
840
840
|
isInGroup(chunkGroup: ChunkGroup): boolean;
|
841
841
|
getNumberOfGroups(): number;
|
842
|
-
get groupsIterable():
|
842
|
+
get groupsIterable(): SortableSet<ChunkGroup>;
|
843
843
|
disconnectFromGroups(): void;
|
844
844
|
split(newChunk: Chunk): void;
|
845
845
|
updateHash(hash: Hash, chunkGraph: ChunkGraph): void;
|
@@ -1452,6 +1452,11 @@ declare class Compilation {
|
|
1452
1452
|
unseal: SyncHook<[]>;
|
1453
1453
|
seal: SyncHook<[]>;
|
1454
1454
|
beforeChunks: SyncHook<[]>;
|
1455
|
+
/**
|
1456
|
+
* The `afterChunks` hook is called directly after the chunks and module graph have
|
1457
|
+
* been created and before the chunks and modules have been optimized. This hook is useful to
|
1458
|
+
* inspect, analyze, and/or modify the chunk graph.
|
1459
|
+
*/
|
1455
1460
|
afterChunks: SyncHook<[Iterable<Chunk>]>;
|
1456
1461
|
optimizeDependencies: SyncBailHook<[Iterable<Module>], any>;
|
1457
1462
|
afterOptimizeDependencies: SyncHook<[Iterable<Module>]>;
|
@@ -6813,11 +6818,11 @@ declare interface MapOptions {
|
|
6813
6818
|
module?: boolean;
|
6814
6819
|
}
|
6815
6820
|
declare interface MatchObject {
|
6816
|
-
test?: string | RegExp | string
|
6817
|
-
include?: string | RegExp | string
|
6818
|
-
exclude?: string | RegExp | string
|
6821
|
+
test?: string | RegExp | (string | RegExp)[];
|
6822
|
+
include?: string | RegExp | (string | RegExp)[];
|
6823
|
+
exclude?: string | RegExp | (string | RegExp)[];
|
6819
6824
|
}
|
6820
|
-
type Matcher = string | RegExp | string
|
6825
|
+
type Matcher = string | RegExp | (string | RegExp)[];
|
6821
6826
|
|
6822
6827
|
/**
|
6823
6828
|
* Options object for in-memory caching.
|
@@ -13426,12 +13431,14 @@ declare namespace exports {
|
|
13426
13431
|
Configuration,
|
13427
13432
|
WebpackOptionsNormalized,
|
13428
13433
|
WebpackPluginInstance,
|
13434
|
+
ChunkGroup,
|
13429
13435
|
Asset,
|
13430
13436
|
AssetInfo,
|
13431
13437
|
EntryOptions,
|
13432
13438
|
PathData,
|
13433
13439
|
AssetEmittedInfo,
|
13434
13440
|
MultiStats,
|
13441
|
+
ResolveData,
|
13435
13442
|
ParserState,
|
13436
13443
|
ResolvePluginInstance,
|
13437
13444
|
Resolver,
|