@vercel/build-utils 13.29.0 → 13.30.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,23 @@
1
1
  # @vercel/build-utils
2
2
 
3
+ ## 13.30.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 01e18e8: Add `hasFallback`, `htmlSize`, and `isDynamicRoute` to `Prerender`
8
+
9
+ These optional fields surface per-route PPR shell metadata in the Build Output so consumers can classify prerenders (e.g. full shell vs. empty shell vs. concrete prerender):
10
+
11
+ - `hasFallback` — whether a dynamic route template had a static fallback (`undefined` for concrete prerenders)
12
+ - `htmlSize` — byte size of the prerendered `.html` shell (`0` for an empty shell, `undefined` when there's no `.html`)
13
+ - `isDynamicRoute` — whether the entry came from a dynamic route template rather than a concrete prerender
14
+
15
+ ## 13.29.1
16
+
17
+ ### Patch Changes
18
+
19
+ - 32a730e: Elevate maximum maxDuration to 1800s
20
+
3
21
  ## 13.29.0
4
22
 
5
23
  ### Minor Changes
package/dist/index.js CHANGED
@@ -35560,6 +35560,13 @@ var NodejsLambda = class extends Lambda {
35560
35560
  };
35561
35561
 
35562
35562
  // src/prerender.ts
35563
+ function assertOptionalBoolean(value, name) {
35564
+ if (value !== void 0 && typeof value !== "boolean") {
35565
+ throw new Error(
35566
+ `The \`${name}\` argument for \`Prerender\` must be a boolean or undefined.`
35567
+ );
35568
+ }
35569
+ }
35563
35570
  var Prerender = class {
35564
35571
  constructor({
35565
35572
  expiration,
@@ -35579,18 +35586,27 @@ var Prerender = class {
35579
35586
  chain,
35580
35587
  exposeErrBody,
35581
35588
  partialFallback,
35582
- hasPostponed
35589
+ hasPostponed,
35590
+ hasFallback,
35591
+ htmlSize,
35592
+ isDynamicRoute
35583
35593
  }) {
35584
35594
  this.type = "Prerender";
35585
35595
  this.expiration = expiration;
35586
35596
  this.staleExpiration = staleExpiration;
35587
35597
  this.sourcePath = sourcePath;
35588
- if (hasPostponed !== void 0 && typeof hasPostponed !== "boolean") {
35598
+ assertOptionalBoolean(hasPostponed, "hasPostponed");
35599
+ this.hasPostponed = hasPostponed;
35600
+ assertOptionalBoolean(hasFallback, "hasFallback");
35601
+ this.hasFallback = hasFallback;
35602
+ assertOptionalBoolean(isDynamicRoute, "isDynamicRoute");
35603
+ this.isDynamicRoute = isDynamicRoute;
35604
+ if (htmlSize !== void 0 && (!Number.isInteger(htmlSize) || htmlSize < 0)) {
35589
35605
  throw new Error(
35590
- "The `hasPostponed` argument for `Prerender` must be a boolean or undefined."
35606
+ "The `htmlSize` argument for `Prerender` must be a non-negative integer or undefined."
35591
35607
  );
35592
35608
  }
35593
- this.hasPostponed = hasPostponed;
35609
+ this.htmlSize = htmlSize;
35594
35610
  this.lambda = lambda;
35595
35611
  if (this.lambda) {
35596
35612
  this.lambda.operationType = this.lambda.operationType || "ISR";
@@ -38260,7 +38276,7 @@ function hasProp2(obj, key) {
38260
38276
  }
38261
38277
 
38262
38278
  // src/max-duration.ts
38263
- var DEFAULT_MAX_DURATION_LIMIT = 900;
38279
+ var DEFAULT_MAX_DURATION_LIMIT = 1800;
38264
38280
  var SKIP_MAX_DURATION_LIMIT_ENV = "VERCEL_CLI_SKIP_MAX_DURATION_LIMIT";
38265
38281
  function getMaxDurationLimit() {
38266
38282
  if (process.env[SKIP_MAX_DURATION_LIMIT_ENV] === "1") {
@@ -8,7 +8,7 @@
8
8
  * this client-side bound is intentionally coarse — it exists only to give fast
9
9
  * local feedback on obviously-invalid values.
10
10
  */
11
- export declare const DEFAULT_MAX_DURATION_LIMIT = 900;
11
+ export declare const DEFAULT_MAX_DURATION_LIMIT = 1800;
12
12
  /**
13
13
  * Internal env var used to skip the client-side `maxDuration` upper-bound check.
14
14
  * When set to `'1'`, the client-side maximum ({@link DEFAULT_MAX_DURATION_LIMIT})
@@ -24,7 +24,7 @@ __export(max_duration_exports, {
24
24
  getMaxDurationSchema: () => getMaxDurationSchema
25
25
  });
26
26
  module.exports = __toCommonJS(max_duration_exports);
27
- const DEFAULT_MAX_DURATION_LIMIT = 900;
27
+ const DEFAULT_MAX_DURATION_LIMIT = 1800;
28
28
  const SKIP_MAX_DURATION_LIMIT_ENV = "VERCEL_CLI_SKIP_MAX_DURATION_LIMIT";
29
29
  function getMaxDurationLimit() {
30
30
  if (process.env[SKIP_MAX_DURATION_LIMIT_ENV] === "1") {
@@ -19,6 +19,9 @@ interface PrerenderOptions {
19
19
  exposeErrBody?: boolean;
20
20
  partialFallback?: boolean;
21
21
  hasPostponed?: boolean;
22
+ hasFallback?: boolean;
23
+ htmlSize?: number;
24
+ isDynamicRoute?: boolean;
22
25
  }
23
26
  export declare class Prerender {
24
27
  type: 'Prerender';
@@ -55,6 +58,25 @@ export declare class Prerender {
55
58
  * not provide the signal.
56
59
  */
57
60
  hasPostponed?: boolean;
58
- constructor({ expiration, staleExpiration, lambda, fallback, group, bypassToken, allowQuery, allowHeader, initialHeaders, initialStatus, passQuery, sourcePath, experimentalBypassFor, experimentalStreamingLambdaPath, chain, exposeErrBody, partialFallback, hasPostponed, }: PrerenderOptions);
61
+ /**
62
+ * `true` when the route's dynamic template had a static fallback page (the
63
+ * prerender-manifest `fallback` was a string). `false` for blocking/omitted
64
+ * dynamic templates (manifest `fallback` was `null`/`false`). `undefined` for
65
+ * concrete prerenders, where the notion of a fallback doesn't apply.
66
+ */
67
+ hasFallback?: boolean;
68
+ /**
69
+ * Byte size on disk of the route's prerendered `.html` shell. `0` for an
70
+ * empty shell (PPR template that postponed everything). `undefined` when
71
+ * there's no `.html` on disk (pages router, route handlers, edge).
72
+ */
73
+ htmlSize?: number;
74
+ /**
75
+ * `true` when this entry came from a dynamic route template (the
76
+ * prerender-manifest `dynamicRoutes` section: fallback, blocking, or omitted)
77
+ * rather than a concrete prerender.
78
+ */
79
+ isDynamicRoute?: boolean;
80
+ constructor({ expiration, staleExpiration, lambda, fallback, group, bypassToken, allowQuery, allowHeader, initialHeaders, initialStatus, passQuery, sourcePath, experimentalBypassFor, experimentalStreamingLambdaPath, chain, exposeErrBody, partialFallback, hasPostponed, hasFallback, htmlSize, isDynamicRoute, }: PrerenderOptions);
59
81
  }
60
82
  export {};
package/dist/prerender.js CHANGED
@@ -21,6 +21,13 @@ __export(prerender_exports, {
21
21
  Prerender: () => Prerender
22
22
  });
23
23
  module.exports = __toCommonJS(prerender_exports);
24
+ function assertOptionalBoolean(value, name) {
25
+ if (value !== void 0 && typeof value !== "boolean") {
26
+ throw new Error(
27
+ `The \`${name}\` argument for \`Prerender\` must be a boolean or undefined.`
28
+ );
29
+ }
30
+ }
24
31
  class Prerender {
25
32
  constructor({
26
33
  expiration,
@@ -40,18 +47,27 @@ class Prerender {
40
47
  chain,
41
48
  exposeErrBody,
42
49
  partialFallback,
43
- hasPostponed
50
+ hasPostponed,
51
+ hasFallback,
52
+ htmlSize,
53
+ isDynamicRoute
44
54
  }) {
45
55
  this.type = "Prerender";
46
56
  this.expiration = expiration;
47
57
  this.staleExpiration = staleExpiration;
48
58
  this.sourcePath = sourcePath;
49
- if (hasPostponed !== void 0 && typeof hasPostponed !== "boolean") {
59
+ assertOptionalBoolean(hasPostponed, "hasPostponed");
60
+ this.hasPostponed = hasPostponed;
61
+ assertOptionalBoolean(hasFallback, "hasFallback");
62
+ this.hasFallback = hasFallback;
63
+ assertOptionalBoolean(isDynamicRoute, "isDynamicRoute");
64
+ this.isDynamicRoute = isDynamicRoute;
65
+ if (htmlSize !== void 0 && (!Number.isInteger(htmlSize) || htmlSize < 0)) {
50
66
  throw new Error(
51
- "The `hasPostponed` argument for `Prerender` must be a boolean or undefined."
67
+ "The `htmlSize` argument for `Prerender` must be a non-negative integer or undefined."
52
68
  );
53
69
  }
54
- this.hasPostponed = hasPostponed;
70
+ this.htmlSize = htmlSize;
55
71
  this.lambda = lambda;
56
72
  if (this.lambda) {
57
73
  this.lambda.operationType = this.lambda.operationType || "ISR";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "13.29.0",
3
+ "version": "13.30.0",
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/routing-utils": "6.3.0",
59
- "@vercel/error-utils": "2.2.0"
58
+ "@vercel/error-utils": "2.2.0",
59
+ "@vercel/routing-utils": "6.3.0"
60
60
  },
61
61
  "scripts": {
62
62
  "build": "node build.mjs",