@vercel/build-utils 7.1.1 → 7.2.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.
@@ -1,4 +1,4 @@
1
- import { File } from './types';
1
+ import type { File, HasField } from './types';
2
2
  import { Lambda } from './lambda';
3
3
  interface PrerenderOptions {
4
4
  expiration: number | false;
@@ -11,6 +11,8 @@ interface PrerenderOptions {
11
11
  initialStatus?: number;
12
12
  passQuery?: boolean;
13
13
  sourcePath?: string;
14
+ experimentalBypassFor?: HasField;
15
+ experimentalStreamingLambdaPath?: string;
14
16
  }
15
17
  export declare class Prerender {
16
18
  type: 'Prerender';
@@ -24,6 +26,8 @@ export declare class Prerender {
24
26
  initialStatus?: number;
25
27
  passQuery?: boolean;
26
28
  sourcePath?: string;
27
- constructor({ expiration, lambda, fallback, group, bypassToken, allowQuery, initialHeaders, initialStatus, passQuery, sourcePath, }: PrerenderOptions);
29
+ experimentalBypassFor?: HasField;
30
+ experimentalStreamingLambdaPath?: string;
31
+ constructor({ expiration, lambda, fallback, group, bypassToken, allowQuery, initialHeaders, initialStatus, passQuery, sourcePath, experimentalBypassFor, experimentalStreamingLambdaPath, }: PrerenderOptions);
28
32
  }
29
33
  export {};
package/dist/prerender.js CHANGED
@@ -32,7 +32,9 @@ class Prerender {
32
32
  initialHeaders,
33
33
  initialStatus,
34
34
  passQuery,
35
- sourcePath
35
+ sourcePath,
36
+ experimentalBypassFor,
37
+ experimentalStreamingLambdaPath
36
38
  }) {
37
39
  this.type = "Prerender";
38
40
  this.expiration = expiration;
@@ -68,6 +70,17 @@ class Prerender {
68
70
  "The `bypassToken` argument for `Prerender` must be a `string`."
69
71
  );
70
72
  }
73
+ if (experimentalBypassFor !== void 0) {
74
+ if (!Array.isArray(experimentalBypassFor) || experimentalBypassFor.some(
75
+ (field) => typeof field !== "object" || // host doesn't need a key
76
+ field.type !== "host" && typeof field.key !== "string" || typeof field.type !== "string" || field.value !== void 0 && typeof field.value !== "string"
77
+ )) {
78
+ throw new Error(
79
+ "The `experimentalBypassFor` argument for `Prerender` must be Array of objects with fields `type`, `key` and optionally `value`."
80
+ );
81
+ }
82
+ this.experimentalBypassFor = experimentalBypassFor;
83
+ }
71
84
  if (typeof fallback === "undefined") {
72
85
  throw new Error(
73
86
  "The `fallback` argument for `Prerender` needs to be a `FileBlob`, `FileFsRef`, `FileRef`, or null."
@@ -105,6 +118,14 @@ class Prerender {
105
118
  }
106
119
  this.allowQuery = allowQuery;
107
120
  }
121
+ if (experimentalStreamingLambdaPath !== void 0) {
122
+ if (typeof experimentalStreamingLambdaPath !== "string") {
123
+ throw new Error(
124
+ "The `experimentalStreamingLambdaPath` argument for `Prerender` must be a string."
125
+ );
126
+ }
127
+ this.experimentalStreamingLambdaPath = experimentalStreamingLambdaPath;
128
+ }
108
129
  }
109
130
  }
110
131
  // Annotate the CommonJS export names for ESM import in node:
package/dist/types.d.ts CHANGED
@@ -43,6 +43,14 @@ export interface Config {
43
43
  middleware?: boolean;
44
44
  [key: string]: unknown;
45
45
  }
46
+ export type HasField = Array<{
47
+ type: 'host';
48
+ value: string;
49
+ } | {
50
+ type: 'header' | 'cookie' | 'query';
51
+ key: string;
52
+ value?: string;
53
+ }>;
46
54
  export interface Meta {
47
55
  isDev?: boolean;
48
56
  devCacheDir?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "7.1.1",
3
+ "version": "7.2.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",