@vercel/build-utils 13.27.2 → 13.29.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 CHANGED
@@ -1,5 +1,25 @@
1
1
  # @vercel/build-utils
2
2
 
3
+ ## 13.29.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 8d8e871: Evaluate the `maxDuration` upper bound at validation time so `VERCEL_CLI_SKIP_MAX_DURATION_LIMIT` works regardless of import order.
8
+
9
+ The gate was read when `@vercel/build-utils`' `functionsSchema` was constructed and when the CLI compiled its `vercel.json` validator — both at module load. Any process that imports these modules before setting the env var baked in the default 900-second maximum and ignored the flag, failing with `Invalid vercel.json - functions[...].maxDuration should be <= 900`.
10
+
11
+ `@vercel/build-utils` now exposes `getFunctionsSchema()`, which reads the limit at call time (the existing `functionsSchema` const is kept but deprecated). The CLI builds and compiles its config validator lazily, caching one validator per resolved limit, so setting the variable after import takes effect. Default behavior is unchanged — the 900s maximum, the lower bound, and the integer check are all still enforced when the variable is unset.
12
+
13
+ ## 13.28.0
14
+
15
+ ### Minor Changes
16
+
17
+ - 4e849dd: Add a per-route `hasPostponed` signal to `Prerender`.
18
+
19
+ `@vercel/build-utils` exposes a new optional `hasPostponed?: boolean` field on `Prerender` / `PrerenderOptions`. It is a tri-state: `true` when the route's `.meta` postponed state is present (React suspended during the build-time prerender), `false` when the framework prerendered a Prerender route without postponing, and `undefined` when the framework did not provide the signal.
20
+
21
+ `@vercel/next` populates it for app-router PPR routes (computed from the route's postponed state) and leaves it `undefined` for pages-router and other non-app-router prerenders. This is an additive, finer-grained signal — it does not change the existing `chain` / `experimentalStreamingLambdaPath` behavior — so downstream consumers can distinguish a route that actually postponed from one that has PPR machinery but fully prerendered (e.g. under `cacheComponents: true`).
22
+
3
23
  ## 13.27.2
4
24
 
5
25
  ### Patch Changes
package/dist/index.js CHANGED
@@ -34562,6 +34562,7 @@ __export(src_exports, {
34562
34562
  getEncryptedEnv: () => getEncryptedEnv,
34563
34563
  getEnvForPackageManager: () => getEnvForPackageManager,
34564
34564
  getExperimentalServiceUrlEnvVars: () => getExperimentalServiceUrlEnvVars,
34565
+ getFunctionsSchema: () => getFunctionsSchema,
34565
34566
  getIgnoreFilter: () => get_ignore_filter_default,
34566
34567
  getInstalledPackageVersion: () => getInstalledPackageVersion,
34567
34568
  getInternalServiceCronPath: () => getInternalServiceCronPath,
@@ -35577,12 +35578,19 @@ var Prerender = class {
35577
35578
  experimentalStreamingLambdaPath,
35578
35579
  chain,
35579
35580
  exposeErrBody,
35580
- partialFallback
35581
+ partialFallback,
35582
+ hasPostponed
35581
35583
  }) {
35582
35584
  this.type = "Prerender";
35583
35585
  this.expiration = expiration;
35584
35586
  this.staleExpiration = staleExpiration;
35585
35587
  this.sourcePath = sourcePath;
35588
+ if (hasPostponed !== void 0 && typeof hasPostponed !== "boolean") {
35589
+ throw new Error(
35590
+ "The `hasPostponed` argument for `Prerender` must be a boolean or undefined."
35591
+ );
35592
+ }
35593
+ this.hasPostponed = hasPostponed;
35586
35594
  this.lambda = lambda;
35587
35595
  if (this.lambda) {
35588
35596
  this.lambda.operationType = this.lambda.operationType || "ISR";
@@ -38344,7 +38352,7 @@ var triggerEventSchemaV2 = {
38344
38352
  var triggerEventSchema = {
38345
38353
  oneOf: [triggerEventSchemaV1, triggerEventSchemaV2]
38346
38354
  };
38347
- var functionsSchema = {
38355
+ var getFunctionsSchema = () => ({
38348
38356
  type: "object",
38349
38357
  minProperties: 1,
38350
38358
  maxProperties: 50,
@@ -38397,7 +38405,8 @@ var functionsSchema = {
38397
38405
  }
38398
38406
  }
38399
38407
  }
38400
- };
38408
+ });
38409
+ var functionsSchema = getFunctionsSchema();
38401
38410
  var buildsSchema = {
38402
38411
  type: "array",
38403
38412
  minItems: 0,
@@ -40609,6 +40618,7 @@ function getExtendedPayload({
40609
40618
  getEncryptedEnv,
40610
40619
  getEnvForPackageManager,
40611
40620
  getExperimentalServiceUrlEnvVars,
40621
+ getFunctionsSchema,
40612
40622
  getIgnoreFilter,
40613
40623
  getInstalledPackageVersion,
40614
40624
  getInternalServiceCronPath,
@@ -18,6 +18,7 @@ interface PrerenderOptions {
18
18
  chain?: Chain;
19
19
  exposeErrBody?: boolean;
20
20
  partialFallback?: boolean;
21
+ hasPostponed?: boolean;
21
22
  }
22
23
  export declare class Prerender {
23
24
  type: 'Prerender';
@@ -47,6 +48,13 @@ export declare class Prerender {
47
48
  chain?: Chain;
48
49
  exposeErrBody?: boolean;
49
50
  partialFallback?: boolean;
50
- constructor({ expiration, staleExpiration, lambda, fallback, group, bypassToken, allowQuery, allowHeader, initialHeaders, initialStatus, passQuery, sourcePath, experimentalBypassFor, experimentalStreamingLambdaPath, chain, exposeErrBody, partialFallback, }: PrerenderOptions);
51
+ /**
52
+ * Set to `true` when the route's `.meta` postponed state is present (React
53
+ * suspended during build prerender). `false` when the framework prerendered
54
+ * a Prerender route without postponing. `undefined` when the framework did
55
+ * not provide the signal.
56
+ */
57
+ hasPostponed?: boolean;
58
+ constructor({ expiration, staleExpiration, lambda, fallback, group, bypassToken, allowQuery, allowHeader, initialHeaders, initialStatus, passQuery, sourcePath, experimentalBypassFor, experimentalStreamingLambdaPath, chain, exposeErrBody, partialFallback, hasPostponed, }: PrerenderOptions);
51
59
  }
52
60
  export {};
package/dist/prerender.js CHANGED
@@ -39,12 +39,19 @@ class Prerender {
39
39
  experimentalStreamingLambdaPath,
40
40
  chain,
41
41
  exposeErrBody,
42
- partialFallback
42
+ partialFallback,
43
+ hasPostponed
43
44
  }) {
44
45
  this.type = "Prerender";
45
46
  this.expiration = expiration;
46
47
  this.staleExpiration = staleExpiration;
47
48
  this.sourcePath = sourcePath;
49
+ if (hasPostponed !== void 0 && typeof hasPostponed !== "boolean") {
50
+ throw new Error(
51
+ "The `hasPostponed` argument for `Prerender` must be a boolean or undefined."
52
+ );
53
+ }
54
+ this.hasPostponed = hasPostponed;
48
55
  this.lambda = lambda;
49
56
  if (this.lambda) {
50
57
  this.lambda.operationType = this.lambda.operationType || "ISR";
package/dist/schemas.d.ts CHANGED
@@ -1,3 +1,105 @@
1
+ export declare const getFunctionsSchema: () => {
2
+ type: string;
3
+ minProperties: number;
4
+ maxProperties: number;
5
+ additionalProperties: boolean;
6
+ patternProperties: {
7
+ '^.{1,256}$': {
8
+ type: string;
9
+ additionalProperties: boolean;
10
+ properties: {
11
+ architecture: {
12
+ type: string;
13
+ enum: string[];
14
+ };
15
+ runtime: {
16
+ type: string;
17
+ maxLength: number;
18
+ };
19
+ memory: {
20
+ minimum: number;
21
+ maximum: number;
22
+ };
23
+ maxDuration: {
24
+ oneOf: ({
25
+ maximum?: number | undefined;
26
+ type: string;
27
+ minimum: number;
28
+ enum?: undefined;
29
+ } | {
30
+ type: string;
31
+ enum: string[];
32
+ })[];
33
+ };
34
+ regions: {
35
+ type: string;
36
+ items: {
37
+ type: string;
38
+ };
39
+ };
40
+ functionFailoverRegions: {
41
+ type: string;
42
+ items: {
43
+ type: string;
44
+ };
45
+ };
46
+ includeFiles: {
47
+ type: string;
48
+ maxLength: number;
49
+ };
50
+ excludeFiles: {
51
+ type: string;
52
+ maxLength: number;
53
+ };
54
+ experimentalTriggers: {
55
+ type: string;
56
+ items: {
57
+ oneOf: {
58
+ type: string;
59
+ properties: {
60
+ type: {
61
+ type: string;
62
+ const: string;
63
+ };
64
+ topic: {
65
+ type: string;
66
+ minLength: number;
67
+ };
68
+ maxDeliveries: {
69
+ type: string;
70
+ minimum: number;
71
+ };
72
+ retryAfterSeconds: {
73
+ type: string;
74
+ exclusiveMinimum: number;
75
+ };
76
+ initialDelaySeconds: {
77
+ type: string;
78
+ minimum: number;
79
+ };
80
+ maxConcurrency: {
81
+ type: string;
82
+ minimum: number;
83
+ };
84
+ };
85
+ required: string[];
86
+ additionalProperties: boolean;
87
+ }[];
88
+ };
89
+ };
90
+ supportsCancellation: {
91
+ type: string;
92
+ };
93
+ };
94
+ };
95
+ };
96
+ };
97
+ /**
98
+ * @deprecated Evaluated once at module load, so it does not reflect
99
+ * `VERCEL_CLI_SKIP_MAX_DURATION_LIMIT` when the variable is set after this
100
+ * module is first imported. Prefer {@link getFunctionsSchema}, which reads the
101
+ * limit at call time.
102
+ */
1
103
  export declare const functionsSchema: {
2
104
  type: string;
3
105
  minProperties: number;
package/dist/schemas.js CHANGED
@@ -20,6 +20,7 @@ var schemas_exports = {};
20
20
  __export(schemas_exports, {
21
21
  buildsSchema: () => buildsSchema,
22
22
  functionsSchema: () => functionsSchema,
23
+ getFunctionsSchema: () => getFunctionsSchema,
23
24
  packageManifestSchema: () => packageManifestSchema
24
25
  });
25
26
  module.exports = __toCommonJS(schemas_exports);
@@ -93,7 +94,7 @@ const triggerEventSchemaV2 = {
93
94
  const triggerEventSchema = {
94
95
  oneOf: [triggerEventSchemaV1, triggerEventSchemaV2]
95
96
  };
96
- const functionsSchema = {
97
+ const getFunctionsSchema = () => ({
97
98
  type: "object",
98
99
  minProperties: 1,
99
100
  maxProperties: 50,
@@ -146,7 +147,8 @@ const functionsSchema = {
146
147
  }
147
148
  }
148
149
  }
149
- };
150
+ });
151
+ const functionsSchema = getFunctionsSchema();
150
152
  const buildsSchema = {
151
153
  type: "array",
152
154
  minItems: 0,
@@ -249,5 +251,6 @@ const packageManifestSchema = {
249
251
  0 && (module.exports = {
250
252
  buildsSchema,
251
253
  functionsSchema,
254
+ getFunctionsSchema,
252
255
  packageManifestSchema
253
256
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "13.27.2",
3
+ "version": "13.29.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",
@@ -55,7 +55,7 @@
55
55
  "vitest": "2.0.1",
56
56
  "typescript": "4.9.5",
57
57
  "yazl": "2.5.1",
58
- "@vercel/routing-utils": "6.2.0",
58
+ "@vercel/routing-utils": "6.3.0",
59
59
  "@vercel/error-utils": "2.2.0"
60
60
  },
61
61
  "scripts": {