@vercel/build-utils 13.29.1 → 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 +12 -0
- package/dist/index.js +20 -4
- package/dist/prerender.d.ts +23 -1
- package/dist/prerender.js +20 -4
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
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
|
+
|
|
3
15
|
## 13.29.1
|
|
4
16
|
|
|
5
17
|
### Patch 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
|
-
|
|
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 `
|
|
35606
|
+
"The `htmlSize` argument for `Prerender` must be a non-negative integer or undefined."
|
|
35591
35607
|
);
|
|
35592
35608
|
}
|
|
35593
|
-
this.
|
|
35609
|
+
this.htmlSize = htmlSize;
|
|
35594
35610
|
this.lambda = lambda;
|
|
35595
35611
|
if (this.lambda) {
|
|
35596
35612
|
this.lambda.operationType = this.lambda.operationType || "ISR";
|
package/dist/prerender.d.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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 `
|
|
67
|
+
"The `htmlSize` argument for `Prerender` must be a non-negative integer or undefined."
|
|
52
68
|
);
|
|
53
69
|
}
|
|
54
|
-
this.
|
|
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.
|
|
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/
|
|
59
|
-
"@vercel/
|
|
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",
|