@vercel/build-utils 13.20.0 → 13.22.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 +17 -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 +41 -7
- package/dist/lambda.d.ts +0 -1
- package/dist/package-manifest.d.ts +1 -0
- package/dist/schemas.d.ts +4 -0
- package/dist/schemas.js +4 -0
- package/dist/types.d.ts +5 -2
- package/dist/types.js +22 -0
- package/dist/validate-lambda-size.d.ts +0 -1
- package/package.json +9 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @vercel/build-utils
|
|
2
2
|
|
|
3
|
+
## 13.22.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- e53dd86: Add service type to project manifest.
|
|
8
|
+
|
|
9
|
+
## 13.21.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- c56f851: Upgrade to TypeScript 5.9
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [8e999cb]
|
|
18
|
+
- @vercel/python-analysis@0.11.1
|
|
19
|
+
|
|
3
20
|
## 13.20.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
|
@@ -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
|
@@ -28319,6 +28319,7 @@ __export(src_exports, {
|
|
|
28319
28319
|
getPrerenderChain: () => getPrerenderChain,
|
|
28320
28320
|
getPrettyError: () => getPrettyError,
|
|
28321
28321
|
getProvidedRuntime: () => getProvidedRuntime,
|
|
28322
|
+
getReportedServiceType: () => getReportedServiceType,
|
|
28322
28323
|
getScriptName: () => getScriptName,
|
|
28323
28324
|
getServiceQueueTopicConfigs: () => getServiceQueueTopicConfigs,
|
|
28324
28325
|
getServiceQueueTopics: () => getServiceQueueTopics,
|
|
@@ -28412,7 +28413,9 @@ var FileBlob = class _FileBlob {
|
|
|
28412
28413
|
(chunk) => (
|
|
28413
28414
|
// Usually the chunks we receive here are already buffers, so we
|
|
28414
28415
|
// avoid the extra buffer copy in those cases to save memory
|
|
28415
|
-
chunks.push(
|
|
28416
|
+
chunks.push(
|
|
28417
|
+
Uint8Array.from(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk))
|
|
28418
|
+
)
|
|
28416
28419
|
)
|
|
28417
28420
|
);
|
|
28418
28421
|
stream.on("error", (error) => reject(error));
|
|
@@ -28739,7 +28742,10 @@ var import_end_of_stream = __toESM(require_end_of_stream());
|
|
|
28739
28742
|
function streamToBuffer(stream) {
|
|
28740
28743
|
return new Promise((resolve, reject) => {
|
|
28741
28744
|
const buffers = [];
|
|
28742
|
-
stream.on("data",
|
|
28745
|
+
stream.on("data", (chunk) => {
|
|
28746
|
+
const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
28747
|
+
buffers.push(Uint8Array.from(buffer));
|
|
28748
|
+
});
|
|
28743
28749
|
(0, import_end_of_stream.default)(stream, (err) => {
|
|
28744
28750
|
if (err) {
|
|
28745
28751
|
reject(err);
|
|
@@ -28751,7 +28757,7 @@ function streamToBuffer(stream) {
|
|
|
28751
28757
|
resolve(Buffer.allocUnsafe(0));
|
|
28752
28758
|
break;
|
|
28753
28759
|
case 1:
|
|
28754
|
-
resolve(buffers[0]);
|
|
28760
|
+
resolve(Buffer.from(buffers[0]));
|
|
28755
28761
|
break;
|
|
28756
28762
|
default:
|
|
28757
28763
|
resolve(Buffer.concat(buffers));
|
|
@@ -28773,7 +28779,9 @@ async function streamToBufferChunks(stream, chunkSize = 100 * MB) {
|
|
|
28773
28779
|
while (offset < buffer.length) {
|
|
28774
28780
|
const remainingSpace = chunkSize - currentSize;
|
|
28775
28781
|
const sliceSize = Math.min(remainingSpace, buffer.length - offset);
|
|
28776
|
-
currentChunk.push(
|
|
28782
|
+
currentChunk.push(
|
|
28783
|
+
Uint8Array.from(buffer.subarray(offset, offset + sliceSize))
|
|
28784
|
+
);
|
|
28777
28785
|
currentSize += sliceSize;
|
|
28778
28786
|
offset += sliceSize;
|
|
28779
28787
|
if (currentSize >= chunkSize) {
|
|
@@ -29572,6 +29580,26 @@ function isQueueTriggeredService(service) {
|
|
|
29572
29580
|
function isScheduleTriggeredService(service) {
|
|
29573
29581
|
return service.type === "cron" || service.type === "job" && service.trigger === "schedule";
|
|
29574
29582
|
}
|
|
29583
|
+
function getReportedServiceType(service) {
|
|
29584
|
+
switch (service.type) {
|
|
29585
|
+
case "web":
|
|
29586
|
+
return "web";
|
|
29587
|
+
case "cron":
|
|
29588
|
+
return "schedule";
|
|
29589
|
+
case "worker":
|
|
29590
|
+
return "queue";
|
|
29591
|
+
case "job":
|
|
29592
|
+
if (service.trigger === "schedule")
|
|
29593
|
+
return "schedule";
|
|
29594
|
+
if (service.trigger === "queue")
|
|
29595
|
+
return "queue";
|
|
29596
|
+
if (service.trigger === "workflow")
|
|
29597
|
+
return "workflow";
|
|
29598
|
+
return void 0;
|
|
29599
|
+
default:
|
|
29600
|
+
return void 0;
|
|
29601
|
+
}
|
|
29602
|
+
}
|
|
29575
29603
|
|
|
29576
29604
|
// src/fs/node-version.ts
|
|
29577
29605
|
var NODE_VERSIONS = [
|
|
@@ -32046,6 +32074,10 @@ var packageManifestSchema = {
|
|
|
32046
32074
|
type: "string",
|
|
32047
32075
|
description: 'Detected framework slug, e.g. "fastapi", "flask", "hono".'
|
|
32048
32076
|
},
|
|
32077
|
+
serviceType: {
|
|
32078
|
+
type: "string",
|
|
32079
|
+
description: 'Service type: one of "web", "schedule", "queue", "workflow".'
|
|
32080
|
+
},
|
|
32049
32081
|
runtimeVersion: {
|
|
32050
32082
|
type: "object",
|
|
32051
32083
|
additionalProperties: false,
|
|
@@ -32603,8 +32635,9 @@ async function streamToDigestAsync(stream) {
|
|
|
32603
32635
|
stream.on("readable", () => {
|
|
32604
32636
|
let chunk;
|
|
32605
32637
|
while (null !== (chunk = stream.read())) {
|
|
32606
|
-
|
|
32607
|
-
|
|
32638
|
+
const buffer = Buffer.isBuffer(chunk) ? Uint8Array.from(chunk) : Uint8Array.from(Buffer.from(chunk));
|
|
32639
|
+
md52.update(buffer);
|
|
32640
|
+
sha2562.update(buffer);
|
|
32608
32641
|
count += chunk.length;
|
|
32609
32642
|
}
|
|
32610
32643
|
});
|
|
@@ -32614,7 +32647,7 @@ function sha256(value) {
|
|
|
32614
32647
|
return (0, import_crypto.createHash)("sha256").update(value).digest("hex");
|
|
32615
32648
|
}
|
|
32616
32649
|
function md5(value) {
|
|
32617
|
-
return (0, import_crypto.createHash)("md5").update(value).digest("hex");
|
|
32650
|
+
return (0, import_crypto.createHash)("md5").update(Uint8Array.from(value)).digest("hex");
|
|
32618
32651
|
}
|
|
32619
32652
|
|
|
32620
32653
|
// src/collect-build-result/get-lambda-by-output-path.ts
|
|
@@ -33603,6 +33636,7 @@ function getExtendedPayload({
|
|
|
33603
33636
|
getPrerenderChain,
|
|
33604
33637
|
getPrettyError,
|
|
33605
33638
|
getProvidedRuntime,
|
|
33639
|
+
getReportedServiceType,
|
|
33606
33640
|
getScriptName,
|
|
33607
33641
|
getServiceQueueTopicConfigs,
|
|
33608
33642
|
getServiceQueueTopics,
|
package/dist/lambda.d.ts
CHANGED
package/dist/schemas.d.ts
CHANGED
|
@@ -144,6 +144,10 @@ export declare const packageManifestSchema: {
|
|
|
144
144
|
readonly type: "string";
|
|
145
145
|
readonly description: "Detected framework slug, e.g. \"fastapi\", \"flask\", \"hono\".";
|
|
146
146
|
};
|
|
147
|
+
readonly serviceType: {
|
|
148
|
+
readonly type: "string";
|
|
149
|
+
readonly description: "Service type: one of \"web\", \"schedule\", \"queue\", \"workflow\".";
|
|
150
|
+
};
|
|
147
151
|
readonly runtimeVersion: {
|
|
148
152
|
readonly type: "object";
|
|
149
153
|
readonly additionalProperties: false;
|
package/dist/schemas.js
CHANGED
|
@@ -191,6 +191,10 @@ const packageManifestSchema = {
|
|
|
191
191
|
type: "string",
|
|
192
192
|
description: 'Detected framework slug, e.g. "fastapi", "flask", "hono".'
|
|
193
193
|
},
|
|
194
|
+
serviceType: {
|
|
195
|
+
type: "string",
|
|
196
|
+
description: 'Service type: one of "web", "schedule", "queue", "workflow".'
|
|
197
|
+
},
|
|
194
198
|
runtimeVersion: {
|
|
195
199
|
type: "object",
|
|
196
200
|
additionalProperties: false,
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
1
|
import type FileRef from './file-ref';
|
|
4
2
|
import type FileFsRef from './file-fs-ref';
|
|
5
3
|
import type FileBlob from './file-blob';
|
|
@@ -539,6 +537,11 @@ export declare function isScheduleTriggeredService(service: {
|
|
|
539
537
|
type?: ServiceType;
|
|
540
538
|
trigger?: JobTrigger;
|
|
541
539
|
}): boolean;
|
|
540
|
+
export type ReportedServiceType = 'web' | 'schedule' | 'queue' | 'workflow';
|
|
541
|
+
export declare function getReportedServiceType(service: {
|
|
542
|
+
type?: ServiceType;
|
|
543
|
+
trigger?: JobTrigger;
|
|
544
|
+
}): ReportedServiceType | undefined;
|
|
542
545
|
/** The framework which created the function */
|
|
543
546
|
export interface FunctionFramework {
|
|
544
547
|
slug: string;
|
package/dist/types.js
CHANGED
|
@@ -22,6 +22,7 @@ __export(types_exports, {
|
|
|
22
22
|
JOB_TRIGGERS: () => JOB_TRIGGERS,
|
|
23
23
|
NodeVersion: () => NodeVersion,
|
|
24
24
|
Version: () => Version,
|
|
25
|
+
getReportedServiceType: () => getReportedServiceType,
|
|
25
26
|
getServiceQueueTopicConfigs: () => getServiceQueueTopicConfigs,
|
|
26
27
|
getServiceQueueTopics: () => getServiceQueueTopics,
|
|
27
28
|
isQueueTriggeredService: () => isQueueTriggeredService,
|
|
@@ -68,12 +69,33 @@ function isQueueTriggeredService(service) {
|
|
|
68
69
|
function isScheduleTriggeredService(service) {
|
|
69
70
|
return service.type === "cron" || service.type === "job" && service.trigger === "schedule";
|
|
70
71
|
}
|
|
72
|
+
function getReportedServiceType(service) {
|
|
73
|
+
switch (service.type) {
|
|
74
|
+
case "web":
|
|
75
|
+
return "web";
|
|
76
|
+
case "cron":
|
|
77
|
+
return "schedule";
|
|
78
|
+
case "worker":
|
|
79
|
+
return "queue";
|
|
80
|
+
case "job":
|
|
81
|
+
if (service.trigger === "schedule")
|
|
82
|
+
return "schedule";
|
|
83
|
+
if (service.trigger === "queue")
|
|
84
|
+
return "queue";
|
|
85
|
+
if (service.trigger === "workflow")
|
|
86
|
+
return "workflow";
|
|
87
|
+
return void 0;
|
|
88
|
+
default:
|
|
89
|
+
return void 0;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
71
92
|
// Annotate the CommonJS export names for ESM import in node:
|
|
72
93
|
0 && (module.exports = {
|
|
73
94
|
BunVersion,
|
|
74
95
|
JOB_TRIGGERS,
|
|
75
96
|
NodeVersion,
|
|
76
97
|
Version,
|
|
98
|
+
getReportedServiceType,
|
|
77
99
|
getServiceQueueTopicConfigs,
|
|
78
100
|
getServiceQueueTopics,
|
|
79
101
|
isQueueTriggeredService,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/build-utils",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.22.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.js",
|
|
@@ -13,18 +13,15 @@
|
|
|
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
|
-
"bytes": "3.1.2",
|
|
20
|
-
"smol-toml": "1.5.2",
|
|
21
19
|
"@types/async-retry": "^1.2.1",
|
|
22
20
|
"@types/bytes": "3.1.1",
|
|
23
21
|
"@types/cross-spawn": "6.0.0",
|
|
24
22
|
"@types/end-of-stream": "^1.4.0",
|
|
25
23
|
"@types/fs-extra": "9.0.13",
|
|
26
24
|
"@types/glob": "7.2.0",
|
|
27
|
-
"@types/jest": "27.4.1",
|
|
28
25
|
"@types/js-yaml": "3.12.1",
|
|
29
26
|
"@types/mime-types": "2.1.0",
|
|
30
27
|
"@types/minimatch": "^5.1.2",
|
|
@@ -37,6 +34,7 @@
|
|
|
37
34
|
"aggregate-error": "3.0.1",
|
|
38
35
|
"async-retry": "1.2.3",
|
|
39
36
|
"async-sema": "2.1.4",
|
|
37
|
+
"bytes": "3.1.2",
|
|
40
38
|
"cross-spawn": "6.0.5",
|
|
41
39
|
"end-of-stream": "1.4.1",
|
|
42
40
|
"execa": "3.2.0",
|
|
@@ -44,24 +42,23 @@
|
|
|
44
42
|
"glob": "8.0.3",
|
|
45
43
|
"ignore": "4.0.6",
|
|
46
44
|
"into-stream": "5.0.0",
|
|
47
|
-
"jest-junit": "16.0.0",
|
|
48
45
|
"js-yaml": "3.13.1",
|
|
46
|
+
"json5": "2.2.3",
|
|
49
47
|
"mime-types": "2.1.28",
|
|
50
48
|
"minimatch": "3.1.2",
|
|
51
49
|
"ms": "2.1.3",
|
|
52
50
|
"multistream": "2.1.1",
|
|
53
51
|
"node-fetch": "2.6.7",
|
|
54
52
|
"semver": "6.3.1",
|
|
55
|
-
"
|
|
56
|
-
"yazl": "2.5.1",
|
|
53
|
+
"smol-toml": "1.5.2",
|
|
57
54
|
"vitest": "2.0.1",
|
|
58
|
-
"
|
|
59
|
-
"@vercel/
|
|
60
|
-
"@vercel/
|
|
55
|
+
"yazl": "2.5.1",
|
|
56
|
+
"@vercel/routing-utils": "6.2.0",
|
|
57
|
+
"@vercel/error-utils": "2.1.0"
|
|
61
58
|
},
|
|
62
59
|
"scripts": {
|
|
63
60
|
"build": "node build.mjs",
|
|
64
|
-
"test": "
|
|
61
|
+
"test": "vitest run --config ../../vitest.config.mts",
|
|
65
62
|
"vitest-run": "vitest -c ../../vitest.config.mts",
|
|
66
63
|
"vitest-unit": "glob --absolute 'test/unit.*test.ts'",
|
|
67
64
|
"vitest-e2e": "glob --absolute 'test/integration*.test.ts'",
|