@vercel/build-utils 7.1.1 → 7.2.1
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 +18 -0
- package/dist/fs/run-user-scripts.d.ts +1 -1
- package/dist/fs/run-user-scripts.js +31 -7
- package/dist/index.js +240 -1003
- package/dist/prerender.d.ts +6 -2
- package/dist/prerender.js +22 -1
- package/dist/types.d.ts +14 -0
- package/package.json +1 -1
package/dist/prerender.d.ts
CHANGED
@@ -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
|
-
|
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;
|
@@ -372,6 +380,11 @@ export interface Cron {
|
|
372
380
|
path: string;
|
373
381
|
schedule: string;
|
374
382
|
}
|
383
|
+
export interface Flag {
|
384
|
+
key: string;
|
385
|
+
defaultValue?: unknown;
|
386
|
+
metadata: Record<string, unknown>;
|
387
|
+
}
|
375
388
|
/** The framework which created the function */
|
376
389
|
export interface FunctionFramework {
|
377
390
|
slug: string;
|
@@ -394,6 +407,7 @@ export interface BuildResultV2Typical {
|
|
394
407
|
framework?: {
|
395
408
|
version: string;
|
396
409
|
};
|
410
|
+
flags?: Flag[];
|
397
411
|
}
|
398
412
|
export type BuildResultV2 = BuildResultV2Typical | BuildResultBuildOutput;
|
399
413
|
export interface BuildResultV3 {
|