-
-
Notifications
You must be signed in to change notification settings - Fork 813
Expand file tree
/
Copy pathtypes.ts
More file actions
188 lines (166 loc) · 4.88 KB
/
types.ts
File metadata and controls
188 lines (166 loc) · 4.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
/**
* Vercel Build Output Configuration
* @see https://vercel.com/docs/build-output-api/v3
*/
export interface VercelBuildConfigV3 {
version: 3;
routes?: (
| {
src: string;
headers: {
"cache-control": string;
};
continue: boolean;
}
| {
handle: string;
}
| {
src: string;
dest: string;
}
)[];
images?: {
sizes: number[];
domains: string[];
remotePatterns?: {
protocol?: "http" | "https";
hostname: string;
port?: string;
pathname?: string;
}[];
minimumCacheTTL?: number;
formats?: ("image/avif" | "image/webp")[];
dangerouslyAllowSVG?: boolean;
contentSecurityPolicy?: string;
};
wildcard?: Array<{
domain: string;
value: string;
}>;
overrides?: Record<
string,
{
path?: string;
contentType?: string;
}
>;
cache?: string[];
bypassToken?: string;
crons?: {
path: string;
schedule: string;
}[];
}
/**
* https://vercel.com/docs/build-output-api/primitives#serverless-function-configuration
* https://vercel.com/docs/build-output-api/primitives#node.js-config
*/
export interface VercelServerlessFunctionConfig {
/**
* Amount of memory (RAM in MB) that will be allocated to the Serverless Function.
*/
memory?: number;
/**
* Specifies the instruction set "architecture" the Vercel Function supports.
*
* Either `x86_64` or `arm64`. The default value is `x86_64`
*/
architecture?: "x86_64" | "arm64";
/**
* Maximum execution duration (in seconds) that will be allowed for the Serverless Function.
*/
maxDuration?: number;
/**
* Map of additional environment variables that will be available to the Vercel Function,
* in addition to the env vars specified in the Project Settings.
*/
environment?: Record<string, string>;
/**
* List of Vercel Regions where the Vercel Function will be deployed to.
*/
regions?: string[];
/**
* True if a custom runtime has support for Lambda runtime wrappers.
*/
supportsWrapper?: boolean;
/**
* When true, the Serverless Function will stream the response to the client.
*/
supportsResponseStreaming?: boolean;
/**
* Enables source map generation.
*/
shouldAddSourcemapSupport?: boolean;
/**
* The runtime to use. Defaults to the auto-detected Node.js version.
*/
runtime?: "nodejs20.x" | "nodejs22.x" | "bun1.x" | (string & {});
[key: string]: unknown;
}
export interface VercelOptions {
config: VercelBuildConfigV3;
/**
* If you have enabled skew protection in the Vercel dashboard, it will
* be enabled by default.
*
* You can disable the Nitro integration by setting this option to `false`.
*/
skewProtection?: boolean;
/**
* If you are using `vercel-edge`, you can specify the region(s) for your edge function.
* @see https://vercel.com/docs/concepts/functions/edge-functions#edge-function-regions
*/
regions?: string[];
functions?: VercelServerlessFunctionConfig;
/**
* Per-route function configuration overrides.
*
* Keys are route patterns (e.g., `/api/queues/*`, `/api/slow-routes/**`).
* Values are partial {@link VercelServerlessFunctionConfig} objects.
*
* @example
* ```ts
* functionRules: {
* '/api/my-slow-routes/**': { maxDuration: 3600 },
* '/api/queues/fulfill-order': {
* experimentalTriggers: [{ type: 'queue/v2beta', topic: 'orders' }],
* },
* }
* ```
*/
functionRules?: Record<string, VercelServerlessFunctionConfig>;
}
/**
* https://vercel.com/docs/build-output-api/v3/primitives#prerender-configuration-file
*/
export type PrerenderFunctionConfig = {
/**
* Expiration time (in seconds) before the cached asset will be re-generated by invoking the Serverless Function. Setting the value to `false` means it will never expire.
*/
expiration: number | false;
/**
* Option group number of the asset. Prerender assets with the same group number will all be re-validated at the same time.
*/
group?: number;
/** Random token assigned to the `__prerender_bypass` cookie when Draft Mode is enabled, in order to safely bypass the Edge Network cache */
bypassToken?: string;
/**
* Name of the optional fallback file relative to the configuration file.
*/
fallback?: string;
/**
* List of query string parameter names that will be cached independently. If an empty array, query values are not considered for caching. If undefined each unique query value is cached independently
*/
allowQuery?: string[];
/**
* When `true`, the query string will be present on the `request` argument passed to the invoked function. The `allowQuery` filter still applies.
*/
passQuery?: boolean;
/**
* (vercel)
*
* When `true`, expose the response body regardless of status code including error status codes. (default `false`)
*/
exposeErrBody?: boolean;
};