@vercel/build-utils 13.26.0 → 13.26.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.
- package/CHANGELOG.md +11 -0
- package/dist/deserialize/deserialize-build-output-types.d.ts +2 -4
- package/dist/deserialize/deserialize-build-output.d.ts +2 -2
- package/dist/deserialize/deserialize-build-output.js +2 -4
- package/dist/deserialize/validate-framework-version.d.ts +2 -1
- package/dist/deserialize/validate-framework-version.js +20 -10
- package/dist/index.js +32 -14
- package/dist/types.d.ts +9 -0
- package/dist/types.js +12 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @vercel/build-utils
|
|
2
2
|
|
|
3
|
+
## 13.26.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fa25cb7: Fix config.framework in deserializeBuildOutput
|
|
8
|
+
- 972cc84: Support workflow-triggered job services in queue infrastructure
|
|
9
|
+
|
|
10
|
+
Add `isWorkflowTriggeredService()` and `isQueueBackedService()` helpers so workflow services
|
|
11
|
+
are recognized by the queue broker, dev server, and build pipeline. Update Python runtime to
|
|
12
|
+
bootstrap workflow services as queue-backed workers.
|
|
13
|
+
|
|
3
14
|
## 13.26.0
|
|
4
15
|
|
|
5
16
|
### Minor Changes
|
|
@@ -35,7 +35,7 @@ export type GroupLambdasOptions = {
|
|
|
35
35
|
export type DeserializeBuildOutputLambda<TLambda extends Lambda> = (files: Files, config: SerializedLambda | SerializedNodejsLambda, repoRootPath: string, fileFsRefsCache: Map<string, FileFsRef>, options?: DeserializeBuildOutputLambdaOptions) => Promise<TLambda>;
|
|
36
36
|
export type GroupLambdas<TLambda extends Lambda> = (lambdas: Record<string, TLambda>, options: GroupLambdasOptions) => Promise<Record<string, TLambda>>;
|
|
37
37
|
export type InspectSerializedLambda = (path: string, config: SerializedLambda | SerializedNodejsLambda, repoRootPath: string, hasServerActions: boolean) => Promise<boolean>;
|
|
38
|
-
export interface DeserializeBuildOutputOptions<
|
|
38
|
+
export interface DeserializeBuildOutputOptions<TMeta = unknown, TLambda extends Lambda = Lambda> {
|
|
39
39
|
outputDir: string;
|
|
40
40
|
repoRootPath: string;
|
|
41
41
|
maxBundleSizeMb?: number;
|
|
@@ -47,9 +47,7 @@ export interface DeserializeBuildOutputOptions<TResult extends DeserializeBuildO
|
|
|
47
47
|
inspectSerializedLambda?: InspectSerializedLambda;
|
|
48
48
|
warn?: (message: string) => void;
|
|
49
49
|
includeDeploymentId?: boolean;
|
|
50
|
-
getMeta?: (hasServerActions: boolean) =>
|
|
51
|
-
meta?: infer TMeta;
|
|
52
|
-
} ? TMeta : never;
|
|
50
|
+
getMeta?: (hasServerActions: boolean) => TMeta;
|
|
53
51
|
}
|
|
54
52
|
export type DeserializeBuildOutputFiles = BuildResultV2Typical['output'];
|
|
55
53
|
export type DeserializeBuildOutputPrerenderFallback = Prerender['fallback'];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Lambda } from '../lambda';
|
|
2
|
-
import type {
|
|
2
|
+
import type { DeserializeBuildOutputOptions, DeserializeBuildOutputResult } from './deserialize-build-output-types';
|
|
3
3
|
export declare function validateDeploymentId(deploymentId?: string): void;
|
|
4
|
-
export declare function deserializeBuildOutput<
|
|
4
|
+
export declare function deserializeBuildOutput<TFlags = unknown, TMeta = unknown, TLambda extends Lambda = Lambda>(options: DeserializeBuildOutputOptions<TMeta, TLambda>): Promise<DeserializeBuildOutputResult<TFlags, TMeta>>;
|
|
@@ -186,9 +186,7 @@ async function deserializeBuildOutput(options) {
|
|
|
186
186
|
);
|
|
187
187
|
}
|
|
188
188
|
validateDeploymentId(config.deploymentId);
|
|
189
|
-
const flags = await (0, import_maybe_read_json.maybeReadJSON)(
|
|
190
|
-
(0, import_path.join)(outputDir, "flags.json")
|
|
191
|
-
);
|
|
189
|
+
const flags = await (0, import_maybe_read_json.maybeReadJSON)((0, import_path.join)(outputDir, "flags.json"));
|
|
192
190
|
const staticDir = (0, import_path.join)(outputDir, "static");
|
|
193
191
|
const output = await (0, import_glob.default)("**", {
|
|
194
192
|
cwd: staticDir,
|
|
@@ -276,7 +274,7 @@ async function deserializeBuildOutput(options) {
|
|
|
276
274
|
}
|
|
277
275
|
);
|
|
278
276
|
applyGroupedLambdas(output, groupedLambdas);
|
|
279
|
-
const framework = (0, import_validate_framework_version.validateFrameworkVersion)(config?.framework
|
|
277
|
+
const framework = (0, import_validate_framework_version.validateFrameworkVersion)(config?.framework);
|
|
280
278
|
const meta = getMeta?.(hasServerActions);
|
|
281
279
|
return {
|
|
282
280
|
wildcard: config.wildcard,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
type FrameworkMeta = {
|
|
2
|
+
slug: string;
|
|
2
3
|
version: string;
|
|
3
4
|
};
|
|
4
|
-
export declare function validateFrameworkVersion(
|
|
5
|
+
export declare function validateFrameworkVersion(framework: FrameworkMeta | undefined): FrameworkMeta | undefined;
|
|
5
6
|
export {};
|
|
@@ -22,30 +22,40 @@ __export(validate_framework_version_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(validate_framework_version_exports);
|
|
24
24
|
var import_errors = require("../errors");
|
|
25
|
+
const MAX_SLUG_LENGTH = 50;
|
|
25
26
|
const MAX_FRAMEWORK_VERSION_LENGTH = 50;
|
|
26
|
-
function validateFrameworkVersion(
|
|
27
|
-
if (!
|
|
27
|
+
function validateFrameworkVersion(framework) {
|
|
28
|
+
if (!framework) {
|
|
28
29
|
return void 0;
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
+
const { slug, version } = framework;
|
|
32
|
+
if (typeof slug !== "string") {
|
|
33
|
+
return void 0;
|
|
34
|
+
}
|
|
35
|
+
if (typeof version !== "string") {
|
|
31
36
|
throw new import_errors.NowBuildError({
|
|
32
|
-
message: `Invalid config.json: "
|
|
37
|
+
message: `Invalid config.json: "version" type "${typeof version}" should be "string"`,
|
|
33
38
|
code: "VC_BUILD_INVALID_CONFIG_JSON_FRAMEWORK_VERSION_TYPE"
|
|
34
39
|
});
|
|
35
40
|
}
|
|
36
|
-
if (
|
|
37
|
-
const
|
|
41
|
+
if (slug.length > MAX_SLUG_LENGTH) {
|
|
42
|
+
const trimmedFrameworkSlug = slug.slice(0, MAX_SLUG_LENGTH);
|
|
43
|
+
throw new import_errors.NowBuildError({
|
|
44
|
+
message: `Invalid config.json: "framework.slug" length ${slug.length} > ${MAX_SLUG_LENGTH}. "${trimmedFrameworkSlug}..."`,
|
|
45
|
+
code: "VC_BUILD_INVALID_CONFIG_JSON_FRAMEWORK_SLUG_LENGTH"
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
if (version.length > MAX_FRAMEWORK_VERSION_LENGTH) {
|
|
49
|
+
const trimmedFrameworkVersion = version.slice(
|
|
38
50
|
0,
|
|
39
51
|
MAX_FRAMEWORK_VERSION_LENGTH
|
|
40
52
|
);
|
|
41
53
|
throw new import_errors.NowBuildError({
|
|
42
|
-
message: `Invalid config.json: "framework.version" length ${
|
|
54
|
+
message: `Invalid config.json: "framework.version" length ${version.length} > ${MAX_FRAMEWORK_VERSION_LENGTH}. "${trimmedFrameworkVersion}..."`,
|
|
43
55
|
code: "VC_BUILD_INVALID_CONFIG_JSON_FRAMEWORK_VERSION_LENGTH"
|
|
44
56
|
});
|
|
45
57
|
}
|
|
46
|
-
return
|
|
47
|
-
version: frameworkVersion
|
|
48
|
-
};
|
|
58
|
+
return framework;
|
|
49
59
|
}
|
|
50
60
|
// Annotate the CommonJS export names for ESM import in node:
|
|
51
61
|
0 && (module.exports = {
|
package/dist/index.js
CHANGED
|
@@ -34586,10 +34586,12 @@ __export(src_exports, {
|
|
|
34586
34586
|
isNodeEntrypoint: () => isNodeEntrypoint,
|
|
34587
34587
|
isPythonEntrypoint: () => isPythonEntrypoint,
|
|
34588
34588
|
isPythonFramework: () => isPythonFramework,
|
|
34589
|
+
isQueueBackedService: () => isQueueBackedService,
|
|
34589
34590
|
isQueueTriggeredService: () => isQueueTriggeredService,
|
|
34590
34591
|
isRouteMiddleware: () => isRouteMiddleware,
|
|
34591
34592
|
isScheduleTriggeredService: () => isScheduleTriggeredService,
|
|
34592
34593
|
isSymbolicLink: () => isSymbolicLink,
|
|
34594
|
+
isWorkflowTriggeredService: () => isWorkflowTriggeredService,
|
|
34593
34595
|
manifestPath: () => manifestPath,
|
|
34594
34596
|
maybeReadJSON: () => maybeReadJSON,
|
|
34595
34597
|
md5: () => md5,
|
|
@@ -35824,6 +35826,12 @@ function isQueueTriggeredService(service) {
|
|
|
35824
35826
|
function isScheduleTriggeredService(service) {
|
|
35825
35827
|
return service.type === "cron" || service.type === "job" && service.trigger === "schedule";
|
|
35826
35828
|
}
|
|
35829
|
+
function isWorkflowTriggeredService(service) {
|
|
35830
|
+
return service.type === "job" && service.trigger === "workflow";
|
|
35831
|
+
}
|
|
35832
|
+
function isQueueBackedService(service) {
|
|
35833
|
+
return isQueueTriggeredService(service) || isWorkflowTriggeredService(service);
|
|
35834
|
+
}
|
|
35827
35835
|
function getReportedServiceType(service) {
|
|
35828
35836
|
switch (service.type) {
|
|
35829
35837
|
case "web":
|
|
@@ -39787,30 +39795,40 @@ function validateEnvWrapperSupport(encryptedEnvFilename, encryptedEnvContent, la
|
|
|
39787
39795
|
}
|
|
39788
39796
|
|
|
39789
39797
|
// src/deserialize/validate-framework-version.ts
|
|
39798
|
+
var MAX_SLUG_LENGTH = 50;
|
|
39790
39799
|
var MAX_FRAMEWORK_VERSION_LENGTH = 50;
|
|
39791
|
-
function validateFrameworkVersion(
|
|
39792
|
-
if (!
|
|
39800
|
+
function validateFrameworkVersion(framework) {
|
|
39801
|
+
if (!framework) {
|
|
39793
39802
|
return void 0;
|
|
39794
39803
|
}
|
|
39795
|
-
|
|
39804
|
+
const { slug, version } = framework;
|
|
39805
|
+
if (typeof slug !== "string") {
|
|
39806
|
+
return void 0;
|
|
39807
|
+
}
|
|
39808
|
+
if (typeof version !== "string") {
|
|
39796
39809
|
throw new NowBuildError({
|
|
39797
|
-
message: `Invalid config.json: "
|
|
39810
|
+
message: `Invalid config.json: "version" type "${typeof version}" should be "string"`,
|
|
39798
39811
|
code: "VC_BUILD_INVALID_CONFIG_JSON_FRAMEWORK_VERSION_TYPE"
|
|
39799
39812
|
});
|
|
39800
39813
|
}
|
|
39801
|
-
if (
|
|
39802
|
-
const
|
|
39814
|
+
if (slug.length > MAX_SLUG_LENGTH) {
|
|
39815
|
+
const trimmedFrameworkSlug = slug.slice(0, MAX_SLUG_LENGTH);
|
|
39816
|
+
throw new NowBuildError({
|
|
39817
|
+
message: `Invalid config.json: "framework.slug" length ${slug.length} > ${MAX_SLUG_LENGTH}. "${trimmedFrameworkSlug}..."`,
|
|
39818
|
+
code: "VC_BUILD_INVALID_CONFIG_JSON_FRAMEWORK_SLUG_LENGTH"
|
|
39819
|
+
});
|
|
39820
|
+
}
|
|
39821
|
+
if (version.length > MAX_FRAMEWORK_VERSION_LENGTH) {
|
|
39822
|
+
const trimmedFrameworkVersion = version.slice(
|
|
39803
39823
|
0,
|
|
39804
39824
|
MAX_FRAMEWORK_VERSION_LENGTH
|
|
39805
39825
|
);
|
|
39806
39826
|
throw new NowBuildError({
|
|
39807
|
-
message: `Invalid config.json: "framework.version" length ${
|
|
39827
|
+
message: `Invalid config.json: "framework.version" length ${version.length} > ${MAX_FRAMEWORK_VERSION_LENGTH}. "${trimmedFrameworkVersion}..."`,
|
|
39808
39828
|
code: "VC_BUILD_INVALID_CONFIG_JSON_FRAMEWORK_VERSION_LENGTH"
|
|
39809
39829
|
});
|
|
39810
39830
|
}
|
|
39811
|
-
return
|
|
39812
|
-
version: frameworkVersion
|
|
39813
|
-
};
|
|
39831
|
+
return framework;
|
|
39814
39832
|
}
|
|
39815
39833
|
|
|
39816
39834
|
// src/deserialize/hydrate-files-map.ts
|
|
@@ -40040,9 +40058,7 @@ async function deserializeBuildOutput(options) {
|
|
|
40040
40058
|
);
|
|
40041
40059
|
}
|
|
40042
40060
|
validateDeploymentId(config.deploymentId);
|
|
40043
|
-
const flags = await maybeReadJSON(
|
|
40044
|
-
(0, import_path15.join)(outputDir, "flags.json")
|
|
40045
|
-
);
|
|
40061
|
+
const flags = await maybeReadJSON((0, import_path15.join)(outputDir, "flags.json"));
|
|
40046
40062
|
const staticDir = (0, import_path15.join)(outputDir, "static");
|
|
40047
40063
|
const output = await glob("**", {
|
|
40048
40064
|
cwd: staticDir,
|
|
@@ -40130,7 +40146,7 @@ async function deserializeBuildOutput(options) {
|
|
|
40130
40146
|
}
|
|
40131
40147
|
);
|
|
40132
40148
|
applyGroupedLambdas(output, groupedLambdas);
|
|
40133
|
-
const framework = validateFrameworkVersion(config?.framework
|
|
40149
|
+
const framework = validateFrameworkVersion(config?.framework);
|
|
40134
40150
|
const meta = getMeta?.(hasServerActions);
|
|
40135
40151
|
return {
|
|
40136
40152
|
wildcard: config.wildcard,
|
|
@@ -40381,10 +40397,12 @@ function getExtendedPayload({
|
|
|
40381
40397
|
isNodeEntrypoint,
|
|
40382
40398
|
isPythonEntrypoint,
|
|
40383
40399
|
isPythonFramework,
|
|
40400
|
+
isQueueBackedService,
|
|
40384
40401
|
isQueueTriggeredService,
|
|
40385
40402
|
isRouteMiddleware,
|
|
40386
40403
|
isScheduleTriggeredService,
|
|
40387
40404
|
isSymbolicLink,
|
|
40405
|
+
isWorkflowTriggeredService,
|
|
40388
40406
|
manifestPath,
|
|
40389
40407
|
maybeReadJSON,
|
|
40390
40408
|
md5,
|
package/dist/types.d.ts
CHANGED
|
@@ -550,6 +550,15 @@ export declare function isScheduleTriggeredService(service: {
|
|
|
550
550
|
type?: ServiceType;
|
|
551
551
|
trigger?: JobTrigger;
|
|
552
552
|
}): boolean;
|
|
553
|
+
export declare function isWorkflowTriggeredService(service: {
|
|
554
|
+
type?: ServiceType;
|
|
555
|
+
trigger?: JobTrigger;
|
|
556
|
+
}): boolean;
|
|
557
|
+
/** Returns true for any service that consumes queue messages (worker, queue-triggered job, workflow-triggered job). */
|
|
558
|
+
export declare function isQueueBackedService(service: {
|
|
559
|
+
type?: ServiceType;
|
|
560
|
+
trigger?: JobTrigger;
|
|
561
|
+
}): boolean;
|
|
553
562
|
export type ReportedServiceType = 'web' | 'schedule' | 'queue' | 'workflow';
|
|
554
563
|
export declare function getReportedServiceType(service: {
|
|
555
564
|
type?: ServiceType;
|
package/dist/types.js
CHANGED
|
@@ -25,8 +25,10 @@ __export(types_exports, {
|
|
|
25
25
|
getReportedServiceType: () => getReportedServiceType,
|
|
26
26
|
getServiceQueueTopicConfigs: () => getServiceQueueTopicConfigs,
|
|
27
27
|
getServiceQueueTopics: () => getServiceQueueTopics,
|
|
28
|
+
isQueueBackedService: () => isQueueBackedService,
|
|
28
29
|
isQueueTriggeredService: () => isQueueTriggeredService,
|
|
29
|
-
isScheduleTriggeredService: () => isScheduleTriggeredService
|
|
30
|
+
isScheduleTriggeredService: () => isScheduleTriggeredService,
|
|
31
|
+
isWorkflowTriggeredService: () => isWorkflowTriggeredService
|
|
30
32
|
});
|
|
31
33
|
module.exports = __toCommonJS(types_exports);
|
|
32
34
|
class Version {
|
|
@@ -69,6 +71,12 @@ function isQueueTriggeredService(service) {
|
|
|
69
71
|
function isScheduleTriggeredService(service) {
|
|
70
72
|
return service.type === "cron" || service.type === "job" && service.trigger === "schedule";
|
|
71
73
|
}
|
|
74
|
+
function isWorkflowTriggeredService(service) {
|
|
75
|
+
return service.type === "job" && service.trigger === "workflow";
|
|
76
|
+
}
|
|
77
|
+
function isQueueBackedService(service) {
|
|
78
|
+
return isQueueTriggeredService(service) || isWorkflowTriggeredService(service);
|
|
79
|
+
}
|
|
72
80
|
function getReportedServiceType(service) {
|
|
73
81
|
switch (service.type) {
|
|
74
82
|
case "web":
|
|
@@ -98,6 +106,8 @@ function getReportedServiceType(service) {
|
|
|
98
106
|
getReportedServiceType,
|
|
99
107
|
getServiceQueueTopicConfigs,
|
|
100
108
|
getServiceQueueTopics,
|
|
109
|
+
isQueueBackedService,
|
|
101
110
|
isQueueTriggeredService,
|
|
102
|
-
isScheduleTriggeredService
|
|
111
|
+
isScheduleTriggeredService,
|
|
112
|
+
isWorkflowTriggeredService
|
|
103
113
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/build-utils",
|
|
3
|
-
"version": "13.26.
|
|
3
|
+
"version": "13.26.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.js",
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
"vitest": "2.0.1",
|
|
56
56
|
"typescript": "4.9.5",
|
|
57
57
|
"yazl": "2.5.1",
|
|
58
|
-
"@vercel/
|
|
59
|
-
"@vercel/
|
|
58
|
+
"@vercel/routing-utils": "6.2.0",
|
|
59
|
+
"@vercel/error-utils": "2.1.0"
|
|
60
60
|
},
|
|
61
61
|
"scripts": {
|
|
62
62
|
"build": "node build.mjs",
|