webpack 5.85.1 → 5.86.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/APIPlugin.js +150 -99
- package/lib/Chunk.js +35 -17
- package/lib/ChunkGroup.js +10 -6
- package/lib/Compiler.js +1 -2
- package/lib/ContextModule.js +4 -2
- package/lib/ContextModuleFactory.js +1 -0
- package/lib/DependenciesBlock.js +1 -1
- package/lib/DllModule.js +6 -0
- package/lib/EvalSourceMapDevToolPlugin.js +2 -1
- package/lib/ExternalModule.js +15 -8
- package/lib/Module.js +7 -1
- package/lib/ProgressPlugin.js +71 -15
- package/lib/WebpackOptionsApply.js +3 -1
- package/lib/css/CssExportsGenerator.js +9 -0
- package/lib/css/CssGenerator.js +1 -1
- package/lib/css/CssLoadingRuntimeModule.js +13 -6
- package/lib/css/CssModulesPlugin.js +37 -12
- package/lib/dependencies/JsonExportsDependency.js +1 -1
- package/lib/javascript/JavascriptModulesPlugin.js +1 -0
- package/lib/json/JsonData.js +2 -2
- package/lib/json/JsonParser.js +25 -12
- package/lib/node/ReadFileCompileAsyncWasmPlugin.js +2 -1
- package/lib/optimize/AggressiveMergingPlugin.js +8 -0
- package/lib/optimize/AggressiveSplittingPlugin.js +9 -2
- package/lib/optimize/EnsureChunkConditionsPlugin.js +3 -0
- package/lib/optimize/FlagIncludedChunksPlugin.js +11 -5
- package/lib/optimize/InnerGraph.js +4 -4
- package/lib/optimize/LimitChunkCountPlugin.js +29 -4
- package/lib/optimize/MangleExportsPlugin.js +1 -1
- package/lib/optimize/MinMaxSizeWarning.js +5 -0
- package/lib/optimize/ModuleConcatenationPlugin.js +59 -2
- package/lib/optimize/RealContentHashPlugin.js +80 -30
- package/lib/optimize/RemoveParentModulesPlugin.js +6 -0
- package/lib/optimize/RuntimeChunkPlugin.js +9 -1
- package/lib/optimize/SideEffectsFlagPlugin.js +10 -1
- package/lib/optimize/SplitChunksPlugin.js +71 -31
- package/lib/serialization/BinaryMiddleware.js +143 -1
- package/lib/serialization/ErrorObjectSerializer.js +3 -0
- package/lib/serialization/ObjectMiddleware.js +3 -0
- package/lib/serialization/types.js +1 -1
- package/package.json +1 -1
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +12 -0
- package/types.d.ts +43 -34
@@ -41,7 +41,7 @@ const MinMaxSizeWarning = require("./MinMaxSizeWarning");
|
|
41
41
|
/**
|
42
42
|
* @callback ChunkFilterFunction
|
43
43
|
* @param {Chunk} chunk
|
44
|
-
* @returns {boolean}
|
44
|
+
* @returns {boolean | undefined}
|
45
45
|
*/
|
46
46
|
|
47
47
|
/**
|
@@ -69,7 +69,7 @@ const MinMaxSizeWarning = require("./MinMaxSizeWarning");
|
|
69
69
|
* @property {number=} maxInitialRequests
|
70
70
|
* @property {(string | function(PathData, AssetInfo=): string)=} filename
|
71
71
|
* @property {string=} idHint
|
72
|
-
* @property {string} automaticNameDelimiter
|
72
|
+
* @property {string=} automaticNameDelimiter
|
73
73
|
* @property {boolean=} reuseExistingChunk
|
74
74
|
* @property {boolean=} usedExports
|
75
75
|
*/
|
@@ -254,12 +254,24 @@ const compareEntries = (a, b) => {
|
|
254
254
|
return compareModuleIterables(modulesA, modulesB);
|
255
255
|
};
|
256
256
|
|
257
|
+
/**
|
258
|
+
* @param {Chunk} chunk the chunk
|
259
|
+
* @returns {boolean} true, if the chunk is an entry chunk
|
260
|
+
*/
|
257
261
|
const INITIAL_CHUNK_FILTER = chunk => chunk.canBeInitial();
|
262
|
+
/**
|
263
|
+
* @param {Chunk} chunk the chunk
|
264
|
+
* @returns {boolean} true, if the chunk is an async chunk
|
265
|
+
*/
|
258
266
|
const ASYNC_CHUNK_FILTER = chunk => !chunk.canBeInitial();
|
267
|
+
/**
|
268
|
+
* @param {Chunk} chunk the chunk
|
269
|
+
* @returns {boolean} always true
|
270
|
+
*/
|
259
271
|
const ALL_CHUNK_FILTER = chunk => true;
|
260
272
|
|
261
273
|
/**
|
262
|
-
* @param {OptimizationSplitChunksSizes} value the sizes
|
274
|
+
* @param {OptimizationSplitChunksSizes | undefined} value the sizes
|
263
275
|
* @param {string[]} defaultSizeTypes the default size types
|
264
276
|
* @returns {SplitChunksSizes} normalized representation
|
265
277
|
*/
|
@@ -386,8 +398,8 @@ const totalSize = sizes => {
|
|
386
398
|
};
|
387
399
|
|
388
400
|
/**
|
389
|
-
* @param {false|string|Function} name the chunk name
|
390
|
-
* @returns {GetName} a function to get the name of the chunk
|
401
|
+
* @param {false|string|Function|undefined} name the chunk name
|
402
|
+
* @returns {GetName | undefined} a function to get the name of the chunk
|
391
403
|
*/
|
392
404
|
const normalizeName = name => {
|
393
405
|
if (typeof name === "string") {
|
@@ -412,6 +424,11 @@ const normalizeChunksFilter = chunks => {
|
|
412
424
|
if (chunks === "all") {
|
413
425
|
return ALL_CHUNK_FILTER;
|
414
426
|
}
|
427
|
+
if (chunks instanceof RegExp) {
|
428
|
+
return chunk => {
|
429
|
+
return chunk.name ? chunks.test(chunk.name) : false;
|
430
|
+
};
|
431
|
+
}
|
415
432
|
if (typeof chunks === "function") {
|
416
433
|
return chunks;
|
417
434
|
}
|
@@ -839,6 +856,10 @@ module.exports = class SplitChunksPlugin {
|
|
839
856
|
}
|
840
857
|
return key;
|
841
858
|
};
|
859
|
+
/**
|
860
|
+
* @param {bigint | Chunk} key key of the chunks
|
861
|
+
* @returns {string} stringified key
|
862
|
+
*/
|
842
863
|
const keyToString = key => {
|
843
864
|
if (typeof key === "bigint") return key.toString(16);
|
844
865
|
return chunkIndexMap.get(key).toString(16);
|
@@ -910,6 +931,10 @@ module.exports = class SplitChunksPlugin {
|
|
910
931
|
// group these set of chunks by count
|
911
932
|
// to allow to check less sets via isSubset
|
912
933
|
// (only smaller sets can be subset)
|
934
|
+
/**
|
935
|
+
* @param {IterableIterator<Set<Chunk>>} chunkSets set of sets of chunks
|
936
|
+
* @returns {Map<number, Array<Set<Chunk>>>} map of sets of chunks by count
|
937
|
+
*/
|
913
938
|
const groupChunkSetsByCount = chunkSets => {
|
914
939
|
/** @type {Map<number, Array<Set<Chunk>>>} */
|
915
940
|
const chunkSetsByCount = new Map();
|
@@ -1019,8 +1044,9 @@ module.exports = class SplitChunksPlugin {
|
|
1019
1044
|
entry = new WeakMap();
|
1020
1045
|
selectedChunksCacheByChunksSet.set(chunks, entry);
|
1021
1046
|
}
|
1022
|
-
|
1023
|
-
|
1047
|
+
let entry2 =
|
1048
|
+
/** @type {SelectedChunksResult} */
|
1049
|
+
(entry.get(chunkFilter));
|
1024
1050
|
if (entry2 === undefined) {
|
1025
1051
|
/** @type {Chunk[]} */
|
1026
1052
|
const selectedChunks = [];
|
@@ -1068,11 +1094,9 @@ module.exports = class SplitChunksPlugin {
|
|
1068
1094
|
// Break if minimum number of chunks is not reached
|
1069
1095
|
if (selectedChunks.length < cacheGroup.minChunks) return;
|
1070
1096
|
// Determine name for split chunk
|
1071
|
-
const name =
|
1072
|
-
|
1073
|
-
selectedChunks,
|
1074
|
-
cacheGroup.key
|
1075
|
-
);
|
1097
|
+
const name =
|
1098
|
+
/** @type {string} */
|
1099
|
+
(cacheGroup.getName(module, selectedChunks, cacheGroup.key));
|
1076
1100
|
// Check if the name is ok
|
1077
1101
|
const existingChunk = compilation.namedChunks.get(name);
|
1078
1102
|
if (existingChunk) {
|
@@ -1139,7 +1163,7 @@ module.exports = class SplitChunksPlugin {
|
|
1139
1163
|
? ` name:${name}`
|
1140
1164
|
: ` chunks:${keyToString(selectedChunksKey)}`);
|
1141
1165
|
// Add module to maps
|
1142
|
-
let info = chunksInfoMap.get(key);
|
1166
|
+
let info = /** @type {ChunksInfoItem} */ (chunksInfoMap.get(key));
|
1143
1167
|
if (info === undefined) {
|
1144
1168
|
chunksInfoMap.set(
|
1145
1169
|
key,
|
@@ -1204,7 +1228,9 @@ module.exports = class SplitChunksPlugin {
|
|
1204
1228
|
getExportsChunkSetsInGraph();
|
1205
1229
|
/** @type {Set<Set<Chunk> | Chunk>} */
|
1206
1230
|
const set = new Set();
|
1207
|
-
const groupedByUsedExports =
|
1231
|
+
const groupedByUsedExports =
|
1232
|
+
/** @type {Iterable<Chunk[]>} */
|
1233
|
+
(groupedByExportsMap.get(module));
|
1208
1234
|
for (const chunks of groupedByUsedExports) {
|
1209
1235
|
const chunksKey = getKey(chunks);
|
1210
1236
|
for (const comb of getExportsCombinations(chunksKey))
|
@@ -1228,7 +1254,10 @@ module.exports = class SplitChunksPlugin {
|
|
1228
1254
|
if (count < cacheGroup.minChunks) continue;
|
1229
1255
|
// Select chunks by configuration
|
1230
1256
|
const { chunks: selectedChunks, key: selectedChunksKey } =
|
1231
|
-
getSelectedChunks(
|
1257
|
+
getSelectedChunks(
|
1258
|
+
chunkCombination,
|
1259
|
+
/** @type {ChunkFilterFunction} */ (cacheGroup.chunksFilter)
|
1260
|
+
);
|
1232
1261
|
|
1233
1262
|
addModuleToChunksInfoMap(
|
1234
1263
|
cacheGroup,
|
@@ -1320,12 +1349,13 @@ module.exports = class SplitChunksPlugin {
|
|
1320
1349
|
}
|
1321
1350
|
}
|
1322
1351
|
|
1323
|
-
const item = bestEntry;
|
1324
|
-
chunksInfoMap.delete(bestEntryKey);
|
1352
|
+
const item = /** @type {ChunksInfoItem} */ (bestEntry);
|
1353
|
+
chunksInfoMap.delete(/** @type {string} */ (bestEntryKey));
|
1325
1354
|
|
1355
|
+
/** @type {Chunk["name"] | undefined} */
|
1326
1356
|
let chunkName = item.name;
|
1327
1357
|
// Variable for the new chunk (lazy created)
|
1328
|
-
/** @type {Chunk} */
|
1358
|
+
/** @type {Chunk | undefined} */
|
1329
1359
|
let newChunk;
|
1330
1360
|
// When no chunk name, check if we can reuse a chunk instead of creating a new one
|
1331
1361
|
let isExistingChunk = false;
|
@@ -1394,14 +1424,18 @@ module.exports = class SplitChunksPlugin {
|
|
1394
1424
|
) {
|
1395
1425
|
for (const chunk of usedChunks) {
|
1396
1426
|
// respect max requests
|
1397
|
-
const maxRequests =
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1427
|
+
const maxRequests = /** @type {number} */ (
|
1428
|
+
chunk.isOnlyInitial()
|
1429
|
+
? item.cacheGroup.maxInitialRequests
|
1430
|
+
: chunk.canBeInitial()
|
1431
|
+
? Math.min(
|
1432
|
+
/** @type {number} */
|
1433
|
+
(item.cacheGroup.maxInitialRequests),
|
1434
|
+
/** @type {number} */
|
1435
|
+
(item.cacheGroup.maxAsyncRequests)
|
1436
|
+
)
|
1437
|
+
: item.cacheGroup.maxAsyncRequests
|
1438
|
+
);
|
1405
1439
|
if (
|
1406
1440
|
isFinite(maxRequests) &&
|
1407
1441
|
getRequests(chunk) >= maxRequests
|
@@ -1421,8 +1455,12 @@ module.exports = class SplitChunksPlugin {
|
|
1421
1455
|
// Were some (invalid) chunks removed from usedChunks?
|
1422
1456
|
// => readd all modules to the queue, as things could have been changed
|
1423
1457
|
if (usedChunks.size < item.chunks.size) {
|
1424
|
-
if (isExistingChunk)
|
1425
|
-
|
1458
|
+
if (isExistingChunk)
|
1459
|
+
usedChunks.add(/** @type {Chunk} */ (newChunk));
|
1460
|
+
if (
|
1461
|
+
/** @type {number} */ (usedChunks.size) >=
|
1462
|
+
/** @type {number} */ (item.cacheGroup.minChunks)
|
1463
|
+
) {
|
1426
1464
|
const chunksArr = Array.from(usedChunks);
|
1427
1465
|
for (const module of item.modules) {
|
1428
1466
|
addModuleToChunksInfoMap(
|
@@ -1466,7 +1504,7 @@ module.exports = class SplitChunksPlugin {
|
|
1466
1504
|
) {
|
1467
1505
|
// queue this item again to be processed again
|
1468
1506
|
// without violating modules
|
1469
|
-
chunksInfoMap.set(bestEntryKey, item);
|
1507
|
+
chunksInfoMap.set(/** @type {string} */ (bestEntryKey), item);
|
1470
1508
|
}
|
1471
1509
|
continue;
|
1472
1510
|
}
|
@@ -1696,7 +1734,9 @@ module.exports = class SplitChunksPlugin {
|
|
1696
1734
|
hashFilename(name, outputOptions);
|
1697
1735
|
}
|
1698
1736
|
if (i !== results.length - 1) {
|
1699
|
-
const newPart = compilation.addChunk(
|
1737
|
+
const newPart = compilation.addChunk(
|
1738
|
+
/** @type {Chunk["name"]} */ (name)
|
1739
|
+
);
|
1700
1740
|
chunk.split(newPart);
|
1701
1741
|
newPart.chunkReason = chunk.chunkReason;
|
1702
1742
|
// Add all modules to the new chunk
|
@@ -1711,7 +1751,7 @@ module.exports = class SplitChunksPlugin {
|
|
1711
1751
|
}
|
1712
1752
|
} else {
|
1713
1753
|
// change the chunk to be a part
|
1714
|
-
chunk.name = name;
|
1754
|
+
chunk.name = /** @type {Chunk["name"]} */ (name);
|
1715
1755
|
}
|
1716
1756
|
}
|
1717
1757
|
}
|
@@ -21,6 +21,9 @@ Section -> NullsSection |
|
|
21
21
|
I32NumbersSection |
|
22
22
|
I8NumbersSection |
|
23
23
|
ShortStringSection |
|
24
|
+
BigIntSection |
|
25
|
+
I32BigIntSection |
|
26
|
+
I8BigIntSection
|
24
27
|
StringSection |
|
25
28
|
BufferSection |
|
26
29
|
NopSection
|
@@ -39,6 +42,9 @@ ShortStringSection -> ShortStringSectionHeaderByte ascii-byte*
|
|
39
42
|
StringSection -> StringSectionHeaderByte i32:length utf8-byte*
|
40
43
|
BufferSection -> BufferSectionHeaderByte i32:length byte*
|
41
44
|
NopSection --> NopSectionHeaderByte
|
45
|
+
BigIntSection -> BigIntSectionHeaderByte i32:length ascii-byte*
|
46
|
+
I32BigIntSection -> I32BigIntSectionHeaderByte i32
|
47
|
+
I8BigIntSection -> I8BigIntSectionHeaderByte i8
|
42
48
|
|
43
49
|
ShortStringSectionHeaderByte -> 0b1nnn_nnnn (n:length)
|
44
50
|
|
@@ -58,6 +64,9 @@ BooleansCountAndBitsByte ->
|
|
58
64
|
StringSectionHeaderByte -> 0b0000_1110
|
59
65
|
BufferSectionHeaderByte -> 0b0000_1111
|
60
66
|
NopSectionHeaderByte -> 0b0000_1011
|
67
|
+
BigIntSectionHeaderByte -> 0b0001_1010
|
68
|
+
I32BigIntSectionHeaderByte -> 0b0001_1100
|
69
|
+
I8BigIntSectionHeaderByte -> 0b0001_1011
|
61
70
|
FalseHeaderByte -> 0b0000_1100
|
62
71
|
TrueHeaderByte -> 0b0000_1101
|
63
72
|
|
@@ -78,6 +87,9 @@ const NULL_AND_I8_HEADER = 0x15;
|
|
78
87
|
const NULL_AND_I32_HEADER = 0x16;
|
79
88
|
const NULL_AND_TRUE_HEADER = 0x17;
|
80
89
|
const NULL_AND_FALSE_HEADER = 0x18;
|
90
|
+
const BIGINT_HEADER = 0x1a;
|
91
|
+
const BIGINT_I8_HEADER = 0x1b;
|
92
|
+
const BIGINT_I32_HEADER = 0x1c;
|
81
93
|
const STRING_HEADER = 0x1e;
|
82
94
|
const BUFFER_HEADER = 0x1f;
|
83
95
|
const I8_HEADER = 0x60;
|
@@ -86,7 +98,7 @@ const F64_HEADER = 0x20;
|
|
86
98
|
const SHORT_STRING_HEADER = 0x80;
|
87
99
|
|
88
100
|
/** Uplift high-order bits */
|
89
|
-
const NUMBERS_HEADER_MASK = 0xe0;
|
101
|
+
const NUMBERS_HEADER_MASK = 0xe0; // 0b1010_0000
|
90
102
|
const NUMBERS_COUNT_MASK = 0x1f; // 0b0001_1111
|
91
103
|
const SHORT_STRING_LENGTH_MASK = 0x7f; // 0b0111_1111
|
92
104
|
|
@@ -113,6 +125,16 @@ const identifyNumber = n => {
|
|
113
125
|
return 2;
|
114
126
|
};
|
115
127
|
|
128
|
+
/**
|
129
|
+
* @param {bigint} n bigint
|
130
|
+
* @returns {0 | 1 | 2} type of bigint for serialization
|
131
|
+
*/
|
132
|
+
const identifyBigInt = n => {
|
133
|
+
if (n <= BigInt(127) && n >= BigInt(-128)) return 0;
|
134
|
+
if (n <= BigInt(2147483647) && n >= BigInt(-2147483648)) return 1;
|
135
|
+
return 2;
|
136
|
+
};
|
137
|
+
|
116
138
|
/**
|
117
139
|
* @typedef {PrimitiveSerializableType[]} DeserializedType
|
118
140
|
* @typedef {BufferSerializableType[]} SerializedType
|
@@ -331,6 +353,62 @@ class BinaryMiddleware extends SerializerMiddleware {
|
|
331
353
|
}
|
332
354
|
break;
|
333
355
|
}
|
356
|
+
case "bigint": {
|
357
|
+
const type = identifyBigInt(thing);
|
358
|
+
if (type === 0 && thing >= 0 && thing <= BigInt(10)) {
|
359
|
+
// shortcut for very small bigints
|
360
|
+
allocate(HEADER_SIZE + I8_SIZE);
|
361
|
+
writeU8(BIGINT_I8_HEADER);
|
362
|
+
writeU8(Number(thing));
|
363
|
+
break;
|
364
|
+
}
|
365
|
+
|
366
|
+
switch (type) {
|
367
|
+
case 0: {
|
368
|
+
let n = 1;
|
369
|
+
allocate(HEADER_SIZE + I8_SIZE * n);
|
370
|
+
writeU8(BIGINT_I8_HEADER | (n - 1));
|
371
|
+
while (n > 0) {
|
372
|
+
currentBuffer.writeInt8(
|
373
|
+
Number(/** @type {bigint} */ (data[i])),
|
374
|
+
currentPosition
|
375
|
+
);
|
376
|
+
currentPosition += I8_SIZE;
|
377
|
+
n--;
|
378
|
+
i++;
|
379
|
+
}
|
380
|
+
i--;
|
381
|
+
break;
|
382
|
+
}
|
383
|
+
case 1: {
|
384
|
+
let n = 1;
|
385
|
+
allocate(HEADER_SIZE + I32_SIZE * n);
|
386
|
+
writeU8(BIGINT_I32_HEADER | (n - 1));
|
387
|
+
while (n > 0) {
|
388
|
+
currentBuffer.writeInt32LE(
|
389
|
+
Number(/** @type {bigint} */ (data[i])),
|
390
|
+
currentPosition
|
391
|
+
);
|
392
|
+
currentPosition += I32_SIZE;
|
393
|
+
n--;
|
394
|
+
i++;
|
395
|
+
}
|
396
|
+
i--;
|
397
|
+
break;
|
398
|
+
}
|
399
|
+
default: {
|
400
|
+
const value = thing.toString();
|
401
|
+
const len = Buffer.byteLength(value);
|
402
|
+
allocate(len + HEADER_SIZE + I32_SIZE);
|
403
|
+
writeU8(BIGINT_HEADER);
|
404
|
+
writeU32(len);
|
405
|
+
currentBuffer.write(value, currentPosition);
|
406
|
+
currentPosition += len;
|
407
|
+
break;
|
408
|
+
}
|
409
|
+
}
|
410
|
+
break;
|
411
|
+
}
|
334
412
|
case "number": {
|
335
413
|
const type = identifyNumber(thing);
|
336
414
|
if (type === 0 && thing >= 0 && thing <= 10) {
|
@@ -847,6 +925,70 @@ class BinaryMiddleware extends SerializerMiddleware {
|
|
847
925
|
result.push(read(1).readInt8(0));
|
848
926
|
}
|
849
927
|
};
|
928
|
+
case BIGINT_I8_HEADER: {
|
929
|
+
const len = 1;
|
930
|
+
return () => {
|
931
|
+
const need = I8_SIZE * len;
|
932
|
+
|
933
|
+
if (isInCurrentBuffer(need)) {
|
934
|
+
for (let i = 0; i < len; i++) {
|
935
|
+
const value =
|
936
|
+
/** @type {Buffer} */
|
937
|
+
(currentBuffer).readInt8(currentPosition);
|
938
|
+
result.push(BigInt(value));
|
939
|
+
currentPosition += I8_SIZE;
|
940
|
+
}
|
941
|
+
checkOverflow();
|
942
|
+
} else {
|
943
|
+
const buf = read(need);
|
944
|
+
for (let i = 0; i < len; i++) {
|
945
|
+
const value = buf.readInt8(i * I8_SIZE);
|
946
|
+
result.push(BigInt(value));
|
947
|
+
}
|
948
|
+
}
|
949
|
+
};
|
950
|
+
}
|
951
|
+
case BIGINT_I32_HEADER: {
|
952
|
+
const len = 1;
|
953
|
+
return () => {
|
954
|
+
const need = I32_SIZE * len;
|
955
|
+
if (isInCurrentBuffer(need)) {
|
956
|
+
for (let i = 0; i < len; i++) {
|
957
|
+
const value = /** @type {Buffer} */ (currentBuffer).readInt32LE(
|
958
|
+
currentPosition
|
959
|
+
);
|
960
|
+
result.push(BigInt(value));
|
961
|
+
currentPosition += I32_SIZE;
|
962
|
+
}
|
963
|
+
checkOverflow();
|
964
|
+
} else {
|
965
|
+
const buf = read(need);
|
966
|
+
for (let i = 0; i < len; i++) {
|
967
|
+
const value = buf.readInt32LE(i * I32_SIZE);
|
968
|
+
result.push(BigInt(value));
|
969
|
+
}
|
970
|
+
}
|
971
|
+
};
|
972
|
+
}
|
973
|
+
case BIGINT_HEADER: {
|
974
|
+
return () => {
|
975
|
+
const len = readU32();
|
976
|
+
if (isInCurrentBuffer(len) && currentPosition + len < 0x7fffffff) {
|
977
|
+
const value = currentBuffer.toString(
|
978
|
+
undefined,
|
979
|
+
currentPosition,
|
980
|
+
currentPosition + len
|
981
|
+
);
|
982
|
+
|
983
|
+
result.push(BigInt(value));
|
984
|
+
currentPosition += len;
|
985
|
+
checkOverflow();
|
986
|
+
} else {
|
987
|
+
const value = read(len).toString();
|
988
|
+
result.push(BigInt(value));
|
989
|
+
}
|
990
|
+
};
|
991
|
+
}
|
850
992
|
default:
|
851
993
|
if (header <= 10) {
|
852
994
|
return () => result.push(header);
|
@@ -21,6 +21,7 @@ class ErrorObjectSerializer {
|
|
21
21
|
serialize(obj, context) {
|
22
22
|
context.write(obj.message);
|
23
23
|
context.write(obj.stack);
|
24
|
+
context.write(/** @type {Error & { cause: "unknown" }} */ (obj).cause);
|
24
25
|
}
|
25
26
|
/**
|
26
27
|
* @param {ObjectDeserializerContext} context context
|
@@ -31,6 +32,8 @@ class ErrorObjectSerializer {
|
|
31
32
|
|
32
33
|
err.message = context.read();
|
33
34
|
err.stack = context.read();
|
35
|
+
/** @type {Error & { cause: "unknown" }} */
|
36
|
+
(err).cause = context.read();
|
34
37
|
|
35
38
|
return err;
|
36
39
|
}
|
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
/** @typedef {undefined|null|number|string|boolean|Buffer|Object|(() => ComplexSerializableType[] | Promise<ComplexSerializableType[]>)} ComplexSerializableType */
|
8
8
|
|
9
|
-
/** @typedef {undefined|null|number|string|boolean|Buffer|(() => PrimitiveSerializableType[] | Promise<PrimitiveSerializableType[]>)} PrimitiveSerializableType */
|
9
|
+
/** @typedef {undefined|null|number|bigint|string|boolean|Buffer|(() => PrimitiveSerializableType[] | Promise<PrimitiveSerializableType[]>)} PrimitiveSerializableType */
|
10
10
|
|
11
11
|
/** @typedef {Buffer|(() => BufferSerializableType[] | Promise<BufferSerializableType[]>)} BufferSerializableType */
|
12
12
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "webpack",
|
3
|
-
"version": "5.
|
3
|
+
"version": "5.86.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",
|