webpack 5.85.0 → 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/HarmonyImportDependencyParserPlugin.js +8 -10
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +12 -12
- package/lib/dependencies/JsonExportsDependency.js +1 -1
- package/lib/javascript/BasicEvaluatedExpression.js +6 -5
- package/lib/javascript/JavascriptModulesPlugin.js +1 -0
- package/lib/javascript/JavascriptParser.js +23 -23
- 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 +53 -41
@@ -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",
|