@vercel/build-utils 13.20.0 → 13.21.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.
- package/CHANGELOG.md +11 -0
- package/dist/collect-build-result/stream-with-extended-payload.d.ts +0 -1
- package/dist/collect-build-result/validate-regular-file.d.ts +0 -1
- package/dist/collect-uncompressed-size.d.ts +1 -1
- package/dist/file-blob.d.ts +0 -2
- package/dist/file-blob.js +3 -1
- package/dist/file-fs-ref.d.ts +0 -1
- package/dist/file-ref.d.ts +0 -1
- package/dist/finalize-lambda.d.ts +0 -1
- package/dist/fs/run-user-scripts.d.ts +0 -2
- package/dist/fs/stream-to-buffer.d.ts +0 -2
- package/dist/fs/stream-to-buffer.js +8 -3
- package/dist/fs/stream-to-digest-async.d.ts +0 -2
- package/dist/fs/stream-to-digest-async.js +4 -3
- package/dist/index.js +15 -7
- package/dist/lambda.d.ts +0 -1
- package/dist/types.d.ts +0 -2
- package/dist/validate-lambda-size.d.ts +0 -1
- package/package.json +4 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,4 +3,4 @@ import type { Files } from './types';
|
|
|
3
3
|
* Collects the total uncompressed size of a set of Lambda files.
|
|
4
4
|
* Handles both FileBlob (in-memory) and FileFsRef (on-disk) file types.
|
|
5
5
|
*/
|
|
6
|
-
export declare const collectUncompressedSize: (files: Files, ignoreFn?: (
|
|
6
|
+
export declare const collectUncompressedSize: (files: Files, ignoreFn?: (fileKey: string) => boolean) => Promise<number>;
|
package/dist/file-blob.d.ts
CHANGED
package/dist/file-blob.js
CHANGED
|
@@ -56,7 +56,9 @@ class FileBlob {
|
|
|
56
56
|
(chunk) => (
|
|
57
57
|
// Usually the chunks we receive here are already buffers, so we
|
|
58
58
|
// avoid the extra buffer copy in those cases to save memory
|
|
59
|
-
chunks.push(
|
|
59
|
+
chunks.push(
|
|
60
|
+
Uint8Array.from(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk))
|
|
61
|
+
)
|
|
60
62
|
)
|
|
61
63
|
);
|
|
62
64
|
stream.on("error", (error) => reject(error));
|
package/dist/file-fs-ref.d.ts
CHANGED
package/dist/file-ref.d.ts
CHANGED
|
@@ -36,7 +36,10 @@ var import_end_of_stream = __toESM(require("end-of-stream"));
|
|
|
36
36
|
function streamToBuffer(stream) {
|
|
37
37
|
return new Promise((resolve, reject) => {
|
|
38
38
|
const buffers = [];
|
|
39
|
-
stream.on("data",
|
|
39
|
+
stream.on("data", (chunk) => {
|
|
40
|
+
const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
41
|
+
buffers.push(Uint8Array.from(buffer));
|
|
42
|
+
});
|
|
40
43
|
(0, import_end_of_stream.default)(stream, (err) => {
|
|
41
44
|
if (err) {
|
|
42
45
|
reject(err);
|
|
@@ -48,7 +51,7 @@ function streamToBuffer(stream) {
|
|
|
48
51
|
resolve(Buffer.allocUnsafe(0));
|
|
49
52
|
break;
|
|
50
53
|
case 1:
|
|
51
|
-
resolve(buffers[0]);
|
|
54
|
+
resolve(Buffer.from(buffers[0]));
|
|
52
55
|
break;
|
|
53
56
|
default:
|
|
54
57
|
resolve(Buffer.concat(buffers));
|
|
@@ -70,7 +73,9 @@ async function streamToBufferChunks(stream, chunkSize = 100 * MB) {
|
|
|
70
73
|
while (offset < buffer.length) {
|
|
71
74
|
const remainingSpace = chunkSize - currentSize;
|
|
72
75
|
const sliceSize = Math.min(remainingSpace, buffer.length - offset);
|
|
73
|
-
currentChunk.push(
|
|
76
|
+
currentChunk.push(
|
|
77
|
+
Uint8Array.from(buffer.subarray(offset, offset + sliceSize))
|
|
78
|
+
);
|
|
74
79
|
currentSize += sliceSize;
|
|
75
80
|
offset += sliceSize;
|
|
76
81
|
if (currentSize >= chunkSize) {
|
|
@@ -41,8 +41,9 @@ async function streamToDigestAsync(stream) {
|
|
|
41
41
|
stream.on("readable", () => {
|
|
42
42
|
let chunk;
|
|
43
43
|
while (null !== (chunk = stream.read())) {
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
const buffer = Buffer.isBuffer(chunk) ? Uint8Array.from(chunk) : Uint8Array.from(Buffer.from(chunk));
|
|
45
|
+
md52.update(buffer);
|
|
46
|
+
sha2562.update(buffer);
|
|
46
47
|
count += chunk.length;
|
|
47
48
|
}
|
|
48
49
|
});
|
|
@@ -52,7 +53,7 @@ function sha256(value) {
|
|
|
52
53
|
return (0, import_crypto.createHash)("sha256").update(value).digest("hex");
|
|
53
54
|
}
|
|
54
55
|
function md5(value) {
|
|
55
|
-
return (0, import_crypto.createHash)("md5").update(value).digest("hex");
|
|
56
|
+
return (0, import_crypto.createHash)("md5").update(Uint8Array.from(value)).digest("hex");
|
|
56
57
|
}
|
|
57
58
|
// Annotate the CommonJS export names for ESM import in node:
|
|
58
59
|
0 && (module.exports = {
|
package/dist/index.js
CHANGED
|
@@ -28412,7 +28412,9 @@ var FileBlob = class _FileBlob {
|
|
|
28412
28412
|
(chunk) => (
|
|
28413
28413
|
// Usually the chunks we receive here are already buffers, so we
|
|
28414
28414
|
// avoid the extra buffer copy in those cases to save memory
|
|
28415
|
-
chunks.push(
|
|
28415
|
+
chunks.push(
|
|
28416
|
+
Uint8Array.from(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk))
|
|
28417
|
+
)
|
|
28416
28418
|
)
|
|
28417
28419
|
);
|
|
28418
28420
|
stream.on("error", (error) => reject(error));
|
|
@@ -28739,7 +28741,10 @@ var import_end_of_stream = __toESM(require_end_of_stream());
|
|
|
28739
28741
|
function streamToBuffer(stream) {
|
|
28740
28742
|
return new Promise((resolve, reject) => {
|
|
28741
28743
|
const buffers = [];
|
|
28742
|
-
stream.on("data",
|
|
28744
|
+
stream.on("data", (chunk) => {
|
|
28745
|
+
const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
28746
|
+
buffers.push(Uint8Array.from(buffer));
|
|
28747
|
+
});
|
|
28743
28748
|
(0, import_end_of_stream.default)(stream, (err) => {
|
|
28744
28749
|
if (err) {
|
|
28745
28750
|
reject(err);
|
|
@@ -28751,7 +28756,7 @@ function streamToBuffer(stream) {
|
|
|
28751
28756
|
resolve(Buffer.allocUnsafe(0));
|
|
28752
28757
|
break;
|
|
28753
28758
|
case 1:
|
|
28754
|
-
resolve(buffers[0]);
|
|
28759
|
+
resolve(Buffer.from(buffers[0]));
|
|
28755
28760
|
break;
|
|
28756
28761
|
default:
|
|
28757
28762
|
resolve(Buffer.concat(buffers));
|
|
@@ -28773,7 +28778,9 @@ async function streamToBufferChunks(stream, chunkSize = 100 * MB) {
|
|
|
28773
28778
|
while (offset < buffer.length) {
|
|
28774
28779
|
const remainingSpace = chunkSize - currentSize;
|
|
28775
28780
|
const sliceSize = Math.min(remainingSpace, buffer.length - offset);
|
|
28776
|
-
currentChunk.push(
|
|
28781
|
+
currentChunk.push(
|
|
28782
|
+
Uint8Array.from(buffer.subarray(offset, offset + sliceSize))
|
|
28783
|
+
);
|
|
28777
28784
|
currentSize += sliceSize;
|
|
28778
28785
|
offset += sliceSize;
|
|
28779
28786
|
if (currentSize >= chunkSize) {
|
|
@@ -32603,8 +32610,9 @@ async function streamToDigestAsync(stream) {
|
|
|
32603
32610
|
stream.on("readable", () => {
|
|
32604
32611
|
let chunk;
|
|
32605
32612
|
while (null !== (chunk = stream.read())) {
|
|
32606
|
-
|
|
32607
|
-
|
|
32613
|
+
const buffer = Buffer.isBuffer(chunk) ? Uint8Array.from(chunk) : Uint8Array.from(Buffer.from(chunk));
|
|
32614
|
+
md52.update(buffer);
|
|
32615
|
+
sha2562.update(buffer);
|
|
32608
32616
|
count += chunk.length;
|
|
32609
32617
|
}
|
|
32610
32618
|
});
|
|
@@ -32614,7 +32622,7 @@ function sha256(value) {
|
|
|
32614
32622
|
return (0, import_crypto.createHash)("sha256").update(value).digest("hex");
|
|
32615
32623
|
}
|
|
32616
32624
|
function md5(value) {
|
|
32617
|
-
return (0, import_crypto.createHash)("md5").update(value).digest("hex");
|
|
32625
|
+
return (0, import_crypto.createHash)("md5").update(Uint8Array.from(value)).digest("hex");
|
|
32618
32626
|
}
|
|
32619
32627
|
|
|
32620
32628
|
// src/collect-build-result/get-lambda-by-output-path.ts
|
package/dist/lambda.d.ts
CHANGED
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/build-utils",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.21.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.js",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"cjs-module-lexer": "1.2.3",
|
|
15
15
|
"es-module-lexer": "1.5.0",
|
|
16
|
-
"@vercel/python-analysis": "0.11.
|
|
16
|
+
"@vercel/python-analysis": "0.11.1"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"bytes": "3.1.2",
|
|
@@ -52,12 +52,11 @@
|
|
|
52
52
|
"multistream": "2.1.1",
|
|
53
53
|
"node-fetch": "2.6.7",
|
|
54
54
|
"semver": "6.3.1",
|
|
55
|
-
"typescript": "4.9.5",
|
|
56
55
|
"yazl": "2.5.1",
|
|
57
56
|
"vitest": "2.0.1",
|
|
58
57
|
"json5": "2.2.3",
|
|
59
|
-
"@vercel/error-utils": "2.0
|
|
60
|
-
"@vercel/routing-utils": "6.
|
|
58
|
+
"@vercel/error-utils": "2.1.0",
|
|
59
|
+
"@vercel/routing-utils": "6.2.0"
|
|
61
60
|
},
|
|
62
61
|
"scripts": {
|
|
63
62
|
"build": "node build.mjs",
|