@vercel/build-utils 14.11.0 → 14.13.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.
@@ -22,6 +22,7 @@ export interface PrerenderInitialMetadata {
22
22
  */
23
23
  htmlSize?: number;
24
24
  }
25
+ export type PrerenderOnMiss = 'sync' | 'dynamic';
25
26
  interface PrerenderOptions {
26
27
  expiration: number | false;
27
28
  staleExpiration?: number;
@@ -41,6 +42,7 @@ interface PrerenderOptions {
41
42
  exposeErrBody?: boolean;
42
43
  partialFallback?: boolean;
43
44
  initialMetadata?: PrerenderInitialMetadata;
45
+ onMiss?: PrerenderOnMiss;
44
46
  }
45
47
  export declare class Prerender {
46
48
  type: 'Prerender';
@@ -77,6 +79,8 @@ export declare class Prerender {
77
79
  * from frameworks that predate the field carry none.
78
80
  */
79
81
  initialMetadata?: PrerenderInitialMetadata;
80
- constructor({ expiration, staleExpiration, lambda, fallback, group, bypassToken, allowQuery, allowHeader, initialHeaders, initialStatus, passQuery, sourcePath, experimentalBypassFor, experimentalStreamingLambdaPath, chain, exposeErrBody, partialFallback, initialMetadata, }: PrerenderOptions);
82
+ /** Serving mode when no prerendered output exists yet. Absent means `sync`. Interpreted by the proxy; carried unvalidated. */
83
+ onMiss?: PrerenderOnMiss;
84
+ constructor({ expiration, staleExpiration, lambda, fallback, group, bypassToken, allowQuery, allowHeader, initialHeaders, initialStatus, passQuery, sourcePath, experimentalBypassFor, experimentalStreamingLambdaPath, chain, exposeErrBody, partialFallback, initialMetadata, onMiss, }: PrerenderOptions);
81
85
  }
82
86
  export {};
package/dist/prerender.js CHANGED
@@ -40,13 +40,15 @@ class Prerender {
40
40
  chain,
41
41
  exposeErrBody,
42
42
  partialFallback,
43
- initialMetadata
43
+ initialMetadata,
44
+ onMiss
44
45
  }) {
45
46
  this.type = "Prerender";
46
47
  this.expiration = expiration;
47
48
  this.staleExpiration = staleExpiration;
48
49
  this.sourcePath = sourcePath;
49
50
  this.initialMetadata = initialMetadata;
51
+ this.onMiss = onMiss;
50
52
  this.lambda = lambda;
51
53
  if (this.lambda) {
52
54
  this.lambda.operationType = this.lambda.operationType || "ISR";
package/dist/types.d.ts CHANGED
@@ -769,12 +769,23 @@ export interface FunctionFramework {
769
769
  slug: string;
770
770
  version?: string;
771
771
  }
772
+ export interface AfterCacheCondition {
773
+ type: 'request.header' | 'cache.response.header';
774
+ key: string;
775
+ value?: HasField[number]['value'];
776
+ }
777
+ export interface AfterCacheBypassRule {
778
+ name?: string;
779
+ hasAll: AfterCacheCondition[];
780
+ }
772
781
  /**
773
782
  * When a Builder implements `version: 2`, the `build()` function is expected
774
783
  * to return this type.
775
784
  */
776
785
  export interface BuildResultV2Typical {
777
786
  routes?: any[];
787
+ /** Bypass cached responses when every condition in any rule matches. */
788
+ afterCacheBypass?: AfterCacheBypassRule[];
778
789
  images?: Images;
779
790
  output: {
780
791
  [key: string]: File | Lambda | Prerender | EdgeFunction | ContainerImage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "14.11.0",
3
+ "version": "14.13.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",
@@ -52,8 +52,8 @@
52
52
  "vitest": "4.1.10",
53
53
  "typescript": "4.9.5",
54
54
  "yazl": "2.5.1",
55
- "@vercel/error-utils": "2.2.1",
56
- "@vercel/routing-utils": "6.6.0"
55
+ "@vercel/routing-utils": "6.6.0",
56
+ "@vercel/error-utils": "2.2.1"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "node build.mjs",