webpack 5.41.0 → 5.41.1
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/bin/webpack.js +0 -0
- package/lib/TemplatedPathPlugin.js +24 -26
- package/lib/runtime/AsyncModuleRuntimeModule.js +8 -4
- package/lib/serialization/BinaryMiddleware.js +24 -14
- package/lib/serialization/FileMiddleware.js +30 -6
- package/package.json +1 -1
- package/schemas/WebpackOptions.check.js +1 -1
- package/schemas/WebpackOptions.json +5 -5
- package/types.d.ts +8 -8
package/bin/webpack.js
CHANGED
File without changes
|
@@ -116,32 +116,30 @@ const replacePathVariables = (path, data, assetInfo) => {
|
|
116
116
|
// [path] - /some/path/
|
117
117
|
// [name] - file
|
118
118
|
// [ext] - .js
|
119
|
-
if (data.filename) {
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
);
|
144
|
-
}
|
119
|
+
if (typeof data.filename === "string") {
|
120
|
+
const { path: file, query, fragment } = parseResource(data.filename);
|
121
|
+
|
122
|
+
const ext = extname(file);
|
123
|
+
const base = basename(file);
|
124
|
+
const name = base.slice(0, base.length - ext.length);
|
125
|
+
const path = file.slice(0, file.length - base.length);
|
126
|
+
|
127
|
+
replacements.set("file", replacer(file));
|
128
|
+
replacements.set("query", replacer(query, true));
|
129
|
+
replacements.set("fragment", replacer(fragment, true));
|
130
|
+
replacements.set("path", replacer(path, true));
|
131
|
+
replacements.set("base", replacer(base));
|
132
|
+
replacements.set("name", replacer(name));
|
133
|
+
replacements.set("ext", replacer(ext, true));
|
134
|
+
// Legacy
|
135
|
+
replacements.set(
|
136
|
+
"filebase",
|
137
|
+
deprecated(
|
138
|
+
replacer(base),
|
139
|
+
"[filebase] is now [base]",
|
140
|
+
"DEP_WEBPACK_TEMPLATE_PATH_PLUGIN_REPLACE_PATH_VARIABLES_FILENAME"
|
141
|
+
)
|
142
|
+
);
|
145
143
|
}
|
146
144
|
|
147
145
|
// Compilation context
|
@@ -57,19 +57,23 @@ class AsyncModuleRuntimeModule extends HelperRuntimeModule {
|
|
57
57
|
"completeQueue(queue);",
|
58
58
|
"queue = 0;"
|
59
59
|
])});`,
|
60
|
-
`var obj = {
|
60
|
+
`var obj = {};
|
61
|
+
obj[webpackThen] = ${runtimeTemplate.expressionFunction(
|
61
62
|
"queueFunction(queue, fn), dep.catch(reject)",
|
62
63
|
"fn, reject"
|
63
|
-
)}
|
64
|
+
)};`,
|
64
65
|
"return obj;"
|
65
66
|
]),
|
66
67
|
"}"
|
67
68
|
]),
|
68
69
|
"}",
|
69
|
-
`
|
70
|
+
`var ret = {};
|
71
|
+
ret[webpackThen] = ${runtimeTemplate.expressionFunction(
|
70
72
|
"completeFunction(fn)",
|
71
73
|
"fn"
|
72
|
-
)}
|
74
|
+
)};
|
75
|
+
ret[webpackExports] = dep;
|
76
|
+
return ret;`
|
73
77
|
])})`,
|
74
78
|
"deps"
|
75
79
|
)};`,
|
@@ -165,12 +165,23 @@ class BinaryMiddleware extends SerializerMiddleware {
|
|
165
165
|
};
|
166
166
|
const flush = () => {
|
167
167
|
if (currentBuffer !== null) {
|
168
|
-
buffers.push(
|
168
|
+
buffers.push(
|
169
|
+
Buffer.from(
|
170
|
+
currentBuffer.buffer,
|
171
|
+
currentBuffer.byteOffset,
|
172
|
+
currentPosition
|
173
|
+
)
|
174
|
+
);
|
169
175
|
if (
|
170
176
|
!leftOverBuffer ||
|
171
177
|
leftOverBuffer.length < currentBuffer.length - currentPosition
|
172
|
-
)
|
173
|
-
leftOverBuffer =
|
178
|
+
) {
|
179
|
+
leftOverBuffer = Buffer.from(
|
180
|
+
currentBuffer.buffer,
|
181
|
+
currentBuffer.byteOffset + currentPosition,
|
182
|
+
currentBuffer.byteLength - currentPosition
|
183
|
+
);
|
184
|
+
}
|
174
185
|
currentBuffer = null;
|
175
186
|
buffersTotalLength += currentPosition;
|
176
187
|
currentPosition = 0;
|
@@ -554,10 +565,8 @@ class BinaryMiddleware extends SerializerMiddleware {
|
|
554
565
|
if (rem < n) {
|
555
566
|
return Buffer.concat([read(rem), read(n - rem)]);
|
556
567
|
}
|
557
|
-
const
|
558
|
-
|
559
|
-
currentPosition + n
|
560
|
-
);
|
568
|
+
const b = /** @type {Buffer} */ (currentBuffer);
|
569
|
+
const res = Buffer.from(b.buffer, b.byteOffset + currentPosition, n);
|
561
570
|
currentPosition += n;
|
562
571
|
checkOverflow();
|
563
572
|
return res;
|
@@ -579,10 +588,8 @@ class BinaryMiddleware extends SerializerMiddleware {
|
|
579
588
|
if (rem < n) {
|
580
589
|
n = rem;
|
581
590
|
}
|
582
|
-
const
|
583
|
-
|
584
|
-
currentPosition + n
|
585
|
-
);
|
591
|
+
const b = /** @type {Buffer} */ (currentBuffer);
|
592
|
+
const res = Buffer.from(b.buffer, b.byteOffset + currentPosition, n);
|
586
593
|
currentPosition += n;
|
587
594
|
checkOverflow();
|
588
595
|
return res;
|
@@ -735,7 +742,7 @@ class BinaryMiddleware extends SerializerMiddleware {
|
|
735
742
|
case STRING_HEADER:
|
736
743
|
return () => {
|
737
744
|
const len = readU32();
|
738
|
-
if (isInCurrentBuffer(len)) {
|
745
|
+
if (isInCurrentBuffer(len) && currentPosition + len < 0x7fffffff) {
|
739
746
|
result.push(
|
740
747
|
currentBuffer.toString(
|
741
748
|
undefined,
|
@@ -753,7 +760,7 @@ class BinaryMiddleware extends SerializerMiddleware {
|
|
753
760
|
return () => result.push("");
|
754
761
|
case SHORT_STRING_HEADER | 1:
|
755
762
|
return () => {
|
756
|
-
if (currentIsBuffer) {
|
763
|
+
if (currentIsBuffer && currentPosition < 0x7ffffffe) {
|
757
764
|
result.push(
|
758
765
|
currentBuffer.toString(
|
759
766
|
"latin1",
|
@@ -785,7 +792,10 @@ class BinaryMiddleware extends SerializerMiddleware {
|
|
785
792
|
} else if ((header & SHORT_STRING_HEADER) === SHORT_STRING_HEADER) {
|
786
793
|
const len = header & SHORT_STRING_LENGTH_MASK;
|
787
794
|
return () => {
|
788
|
-
if (
|
795
|
+
if (
|
796
|
+
isInCurrentBuffer(len) &&
|
797
|
+
currentPosition + len < 0x7fffffff
|
798
|
+
) {
|
789
799
|
result.push(
|
790
800
|
currentBuffer.toString(
|
791
801
|
"latin1",
|
@@ -280,8 +280,16 @@ const deserialize = async (middleware, name, readFile) => {
|
|
280
280
|
}
|
281
281
|
const sectionCount = readUInt32LE();
|
282
282
|
const lengths = [];
|
283
|
+
let lastLengthPositive = false;
|
283
284
|
for (let i = 0; i < sectionCount; i++) {
|
284
|
-
|
285
|
+
const value = readInt32LE();
|
286
|
+
const valuePositive = value >= 0;
|
287
|
+
if (lastLengthPositive && valuePositive) {
|
288
|
+
lengths[lengths.length - 1] += value;
|
289
|
+
} else {
|
290
|
+
lengths.push(value);
|
291
|
+
lastLengthPositive = valuePositive;
|
292
|
+
}
|
285
293
|
}
|
286
294
|
const result = [];
|
287
295
|
for (let length of lengths) {
|
@@ -307,13 +315,24 @@ const deserialize = async (middleware, name, readFile) => {
|
|
307
315
|
} else if (contentPosition !== 0) {
|
308
316
|
if (length <= contentItemLength - contentPosition) {
|
309
317
|
result.push(
|
310
|
-
|
318
|
+
Buffer.from(
|
319
|
+
contentItem.buffer,
|
320
|
+
contentItem.byteOffset + contentPosition,
|
321
|
+
length
|
322
|
+
)
|
311
323
|
);
|
312
324
|
contentPosition += length;
|
313
325
|
length = 0;
|
314
326
|
} else {
|
315
|
-
|
316
|
-
|
327
|
+
const l = contentItemLength - contentPosition;
|
328
|
+
result.push(
|
329
|
+
Buffer.from(
|
330
|
+
contentItem.buffer,
|
331
|
+
contentItem.byteOffset + contentPosition,
|
332
|
+
l
|
333
|
+
)
|
334
|
+
);
|
335
|
+
length -= l;
|
317
336
|
contentPosition = contentItemLength;
|
318
337
|
}
|
319
338
|
} else {
|
@@ -322,7 +341,9 @@ const deserialize = async (middleware, name, readFile) => {
|
|
322
341
|
length -= contentItemLength;
|
323
342
|
contentPosition = contentItemLength;
|
324
343
|
} else {
|
325
|
-
result.push(
|
344
|
+
result.push(
|
345
|
+
Buffer.from(contentItem.buffer, contentItem.byteOffset, length)
|
346
|
+
);
|
326
347
|
contentPosition += length;
|
327
348
|
length = 0;
|
328
349
|
}
|
@@ -334,7 +355,9 @@ const deserialize = async (middleware, name, readFile) => {
|
|
334
355
|
length -= contentItemLength;
|
335
356
|
contentPosition = contentItemLength;
|
336
357
|
} else {
|
337
|
-
result.push(
|
358
|
+
result.push(
|
359
|
+
Buffer.from(contentItem.buffer, contentItem.byteOffset, length)
|
360
|
+
);
|
338
361
|
contentPosition += length;
|
339
362
|
length = 0;
|
340
363
|
}
|
@@ -462,6 +485,7 @@ class FileMiddleware extends SerializerMiddleware {
|
|
462
485
|
let readBuffer = currentBuffer;
|
463
486
|
let readOffset = currentBufferUsed;
|
464
487
|
let readLength = currentBuffer.length - currentBufferUsed;
|
488
|
+
// values passed to fs.read must be valid int32 values
|
465
489
|
if (readOffset > 0x7fffffff) {
|
466
490
|
readBuffer = currentBuffer.slice(readOffset);
|
467
491
|
readOffset = 0;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "webpack",
|
3
|
-
"version": "5.41.
|
3
|
+
"version": "5.41.1",
|
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",
|