@vercel/build-utils 8.4.1 → 8.4.3

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 type { File, HasField } from './types';
1
+ import type { File, HasField, Chain } from './types';
2
2
  import { Lambda } from './lambda';
3
3
  interface PrerenderOptions {
4
4
  expiration: number | false;
@@ -13,6 +13,7 @@ interface PrerenderOptions {
13
13
  sourcePath?: string;
14
14
  experimentalBypassFor?: HasField;
15
15
  experimentalStreamingLambdaPath?: string;
16
+ chain?: Chain;
16
17
  }
17
18
  export declare class Prerender {
18
19
  type: 'Prerender';
@@ -28,6 +29,7 @@ export declare class Prerender {
28
29
  sourcePath?: string;
29
30
  experimentalBypassFor?: HasField;
30
31
  experimentalStreamingLambdaPath?: string;
31
- constructor({ expiration, lambda, fallback, group, bypassToken, allowQuery, initialHeaders, initialStatus, passQuery, sourcePath, experimentalBypassFor, experimentalStreamingLambdaPath, }: PrerenderOptions);
32
+ chain?: Chain;
33
+ constructor({ expiration, lambda, fallback, group, bypassToken, allowQuery, initialHeaders, initialStatus, passQuery, sourcePath, experimentalBypassFor, experimentalStreamingLambdaPath, chain, }: PrerenderOptions);
32
34
  }
33
35
  export {};
package/dist/prerender.js CHANGED
@@ -34,7 +34,8 @@ class Prerender {
34
34
  passQuery,
35
35
  sourcePath,
36
36
  experimentalBypassFor,
37
- experimentalStreamingLambdaPath
37
+ experimentalStreamingLambdaPath,
38
+ chain
38
39
  }) {
39
40
  this.type = "Prerender";
40
41
  this.expiration = expiration;
@@ -126,6 +127,26 @@ class Prerender {
126
127
  }
127
128
  this.experimentalStreamingLambdaPath = experimentalStreamingLambdaPath;
128
129
  }
130
+ if (chain !== void 0) {
131
+ if (typeof chain !== "object") {
132
+ throw new Error(
133
+ "The `chain` argument for `Prerender` must be an object."
134
+ );
135
+ }
136
+ if (!chain.headers || typeof chain.headers !== "object" || Object.entries(chain.headers).some(
137
+ ([key, value]) => typeof key !== "string" || typeof value !== "string"
138
+ )) {
139
+ throw new Error(
140
+ `The \`chain.headers\` argument for \`Prerender\` must be an object with string key/values`
141
+ );
142
+ }
143
+ if (!chain.outputPath || typeof chain.outputPath !== "string") {
144
+ throw new Error(
145
+ "The `chain.outputPath` argument for `Prerender` must be a string."
146
+ );
147
+ }
148
+ this.chain = chain;
149
+ }
129
150
  }
130
151
  }
131
152
  // Annotate the CommonJS export names for ESM import in node:
package/dist/types.d.ts CHANGED
@@ -448,4 +448,15 @@ export interface FlagDefinition {
448
448
  description?: string;
449
449
  }
450
450
  export type FlagDefinitions = Record<string, FlagDefinition>;
451
+ export interface Chain {
452
+ /**
453
+ * The build output to use that references the lambda that will be used to
454
+ * append to the response.
455
+ */
456
+ outputPath: string;
457
+ /**
458
+ * The headers to send when making the request to append to the response.
459
+ */
460
+ headers: Record<string, string>;
461
+ }
451
462
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "8.4.1",
3
+ "version": "8.4.3",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",