vite-plugin-vercel 0.0.2 → 0.0.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.
package/dist/index.d.ts CHANGED
@@ -1,113 +1,491 @@
1
1
  import { ResolvedConfig, Plugin } from 'vite';
2
2
  import { StdinOptions, BuildOptions } from 'esbuild';
3
- import * as myzod_libs_types from 'myzod/libs/types';
4
- import * as myzod from 'myzod';
3
+ import { z } from 'zod';
5
4
 
6
- declare const routesManifestDynamicRouteSchema: myzod.ObjectType<{
7
- page: myzod.StringType;
8
- regex: myzod.StringType;
9
- routeKeys: myzod.OptionalType<myzod.ObjectType<{
10
- [myzod.keySignature]: myzod.AnyType;
11
- }>>;
12
- namedRegex: myzod.OptionalType<myzod.StringType>;
5
+ declare const routesManifestDynamicRouteSchema: z.ZodObject<{
6
+ page: z.ZodString;
7
+ regex: z.ZodString;
8
+ routeKeys: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
9
+ namedRegex: z.ZodOptional<z.ZodString>;
10
+ }, "strict", z.ZodTypeAny, {
11
+ routeKeys?: Record<string, string> | undefined;
12
+ namedRegex?: string | undefined;
13
+ regex: string;
14
+ page: string;
15
+ }, {
16
+ routeKeys?: Record<string, string> | undefined;
17
+ namedRegex?: string | undefined;
18
+ regex: string;
19
+ page: string;
13
20
  }>;
14
- declare const routesManifestSchema: myzod.ObjectType<{
15
- version: myzod_libs_types.LiteralType<3>;
16
- basePath: myzod.StringType;
17
- pages404: myzod.BooleanType;
18
- redirects: myzod.OptionalType<myzod.ArrayType<myzod.ObjectType<{
19
- source: myzod.StringType;
20
- destination: myzod.StringType;
21
- statusCode: myzod.UnionType<[myzod_libs_types.LiteralType<301>, myzod_libs_types.LiteralType<302>, myzod_libs_types.LiteralType<307>, myzod_libs_types.LiteralType<308>]>;
22
- regex: myzod.StringType;
23
- }>>>;
24
- headers: myzod.OptionalType<myzod.ArrayType<myzod.ObjectType<{
25
- source: myzod.StringType;
26
- headers: myzod.ArrayType<myzod.ObjectType<{
27
- key: myzod.StringType;
28
- value: myzod.StringType;
29
- }>>;
30
- regex: myzod.StringType;
31
- }>>>;
32
- rewrites: myzod.OptionalType<myzod.ArrayType<myzod.ObjectType<{
33
- source: myzod.StringType;
34
- has: myzod.OptionalType<myzod.ArrayType<myzod.ObjectType<{
35
- key: myzod.StringType;
36
- value: myzod.StringType;
37
- type: myzod.UnionType<[myzod_libs_types.LiteralType<"header">, myzod_libs_types.LiteralType<"cookie">, myzod_libs_types.LiteralType<"host">, myzod_libs_types.LiteralType<"query">]>;
38
- }>>>;
39
- destination: myzod.StringType;
40
- regex: myzod.StringType;
41
- }>>>;
42
- dynamicRoutes: myzod.OptionalType<myzod.ArrayType<myzod.ObjectType<{
43
- page: myzod.StringType;
44
- regex: myzod.StringType;
45
- routeKeys: myzod.OptionalType<myzod.ObjectType<{
46
- [myzod.keySignature]: myzod.AnyType;
47
- }>>;
48
- namedRegex: myzod.OptionalType<myzod.StringType>;
49
- }>>>;
21
+ declare const routesManifestSchema: z.ZodObject<{
22
+ version: z.ZodLiteral<3>;
23
+ basePath: z.ZodString;
24
+ pages404: z.ZodBoolean;
25
+ redirects: z.ZodOptional<z.ZodArray<z.ZodObject<{
26
+ source: z.ZodString;
27
+ destination: z.ZodString;
28
+ statusCode: z.ZodEffects<z.ZodNumber, number, number>;
29
+ regex: z.ZodString;
30
+ }, "strict", z.ZodTypeAny, {
31
+ source: string;
32
+ destination: string;
33
+ statusCode: number;
34
+ regex: string;
35
+ }, {
36
+ source: string;
37
+ destination: string;
38
+ statusCode: number;
39
+ regex: string;
40
+ }>, "many">>;
41
+ headers: z.ZodOptional<z.ZodArray<z.ZodObject<{
42
+ source: z.ZodString;
43
+ headers: z.ZodArray<z.ZodObject<{
44
+ key: z.ZodString;
45
+ value: z.ZodString;
46
+ }, "strict", z.ZodTypeAny, {
47
+ value: string;
48
+ key: string;
49
+ }, {
50
+ value: string;
51
+ key: string;
52
+ }>, "many">;
53
+ regex: z.ZodString;
54
+ }, "strict", z.ZodTypeAny, {
55
+ source: string;
56
+ regex: string;
57
+ headers: {
58
+ value: string;
59
+ key: string;
60
+ }[];
61
+ }, {
62
+ source: string;
63
+ regex: string;
64
+ headers: {
65
+ value: string;
66
+ key: string;
67
+ }[];
68
+ }>, "many">>;
69
+ rewrites: z.ZodOptional<z.ZodArray<z.ZodObject<{
70
+ source: z.ZodString;
71
+ has: z.ZodOptional<z.ZodArray<z.ZodObject<{
72
+ key: z.ZodString;
73
+ value: z.ZodString;
74
+ type: z.ZodEnum<["header", "cookie", "host", "query"]>;
75
+ }, "strict", z.ZodTypeAny, {
76
+ value: string;
77
+ type: "header" | "cookie" | "host" | "query";
78
+ key: string;
79
+ }, {
80
+ value: string;
81
+ type: "header" | "cookie" | "host" | "query";
82
+ key: string;
83
+ }>, "many">>;
84
+ destination: z.ZodString;
85
+ regex: z.ZodString;
86
+ }, "strict", z.ZodTypeAny, {
87
+ has?: {
88
+ value: string;
89
+ type: "header" | "cookie" | "host" | "query";
90
+ key: string;
91
+ }[] | undefined;
92
+ source: string;
93
+ destination: string;
94
+ regex: string;
95
+ }, {
96
+ has?: {
97
+ value: string;
98
+ type: "header" | "cookie" | "host" | "query";
99
+ key: string;
100
+ }[] | undefined;
101
+ source: string;
102
+ destination: string;
103
+ regex: string;
104
+ }>, "many">>;
105
+ dynamicRoutes: z.ZodOptional<z.ZodArray<z.ZodObject<{
106
+ page: z.ZodString;
107
+ regex: z.ZodString;
108
+ routeKeys: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
109
+ namedRegex: z.ZodOptional<z.ZodString>;
110
+ }, "strict", z.ZodTypeAny, {
111
+ routeKeys?: Record<string, string> | undefined;
112
+ namedRegex?: string | undefined;
113
+ regex: string;
114
+ page: string;
115
+ }, {
116
+ routeKeys?: Record<string, string> | undefined;
117
+ namedRegex?: string | undefined;
118
+ regex: string;
119
+ page: string;
120
+ }>, "many">>;
121
+ }, "strict", z.ZodTypeAny, {
122
+ dynamicRoutes?: {
123
+ routeKeys?: Record<string, string> | undefined;
124
+ namedRegex?: string | undefined;
125
+ regex: string;
126
+ page: string;
127
+ }[] | undefined;
128
+ redirects?: {
129
+ source: string;
130
+ destination: string;
131
+ statusCode: number;
132
+ regex: string;
133
+ }[] | undefined;
134
+ headers?: {
135
+ source: string;
136
+ regex: string;
137
+ headers: {
138
+ value: string;
139
+ key: string;
140
+ }[];
141
+ }[] | undefined;
142
+ rewrites?: {
143
+ has?: {
144
+ value: string;
145
+ type: "header" | "cookie" | "host" | "query";
146
+ key: string;
147
+ }[] | undefined;
148
+ source: string;
149
+ destination: string;
150
+ regex: string;
151
+ }[] | undefined;
152
+ version: 3;
153
+ basePath: string;
154
+ pages404: boolean;
155
+ }, {
156
+ dynamicRoutes?: {
157
+ routeKeys?: Record<string, string> | undefined;
158
+ namedRegex?: string | undefined;
159
+ regex: string;
160
+ page: string;
161
+ }[] | undefined;
162
+ redirects?: {
163
+ source: string;
164
+ destination: string;
165
+ statusCode: number;
166
+ regex: string;
167
+ }[] | undefined;
168
+ headers?: {
169
+ source: string;
170
+ regex: string;
171
+ headers: {
172
+ value: string;
173
+ key: string;
174
+ }[];
175
+ }[] | undefined;
176
+ rewrites?: {
177
+ has?: {
178
+ value: string;
179
+ type: "header" | "cookie" | "host" | "query";
180
+ key: string;
181
+ }[] | undefined;
182
+ source: string;
183
+ destination: string;
184
+ regex: string;
185
+ }[] | undefined;
186
+ version: 3;
187
+ basePath: string;
188
+ pages404: boolean;
50
189
  }>;
51
- declare type RoutesManifest = myzod.Infer<typeof routesManifestSchema>;
52
- declare type RoutesManifestDynamicRoute = myzod.Infer<typeof routesManifestDynamicRouteSchema>;
190
+ declare type RoutesManifest = z.infer<typeof routesManifestSchema>;
191
+ declare type RoutesManifestDynamicRoute = z.infer<typeof routesManifestDynamicRouteSchema>;
53
192
  declare type RoutesManifestDefault = Partial<Omit<RoutesManifest, 'version'>>;
54
193
 
55
- declare const functionsManifestSchema: myzod.ObjectType<{
56
- version: myzod_libs_types.LiteralType<1>;
57
- pages: myzod.ObjectType<{
58
- '_middleware.js': myzod.OptionalType<myzod.ObjectType<{
59
- handler: myzod.OptionalType<myzod.StringType>;
60
- regions: myzod.OptionalType<myzod.ArrayType<myzod.StringType>>;
61
- maxDuration: myzod.OptionalType<myzod.NumberType>;
62
- memory: myzod.OptionalType<myzod.NumberType>;
63
- runtime: myzod_libs_types.LiteralType<"web">;
64
- env: myzod.ArrayType<myzod.StringType>;
65
- files: myzod.ArrayType<myzod.StringType>;
66
- name: myzod.StringType;
67
- page: myzod.StringType;
68
- regexp: myzod.StringType;
69
- sortingIndex: myzod.NumberType;
194
+ declare const functionsManifestSchema: z.ZodObject<{
195
+ version: z.ZodLiteral<1>;
196
+ pages: z.ZodIntersection<z.ZodObject<{
197
+ '_middleware.js': z.ZodOptional<z.ZodObject<z.extendShape<{
198
+ handler: z.ZodOptional<z.ZodString>;
199
+ regions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
200
+ maxDuration: z.ZodOptional<z.ZodNumber>;
201
+ memory: z.ZodOptional<z.ZodNumber>;
202
+ }, {
203
+ runtime: z.ZodLiteral<"web">;
204
+ env: z.ZodArray<z.ZodString, "many">;
205
+ files: z.ZodArray<z.ZodString, "many">;
206
+ name: z.ZodString;
207
+ page: z.ZodString;
208
+ regexp: z.ZodString;
209
+ sortingIndex: z.ZodNumber;
210
+ }>, "strict", z.ZodTypeAny, {
211
+ handler?: string | undefined;
212
+ regions?: string[] | undefined;
213
+ maxDuration?: number | undefined;
214
+ memory?: number | undefined;
215
+ env: string[];
216
+ page: string;
217
+ runtime: "web";
218
+ files: string[];
219
+ name: string;
220
+ regexp: string;
221
+ sortingIndex: number;
222
+ }, {
223
+ handler?: string | undefined;
224
+ regions?: string[] | undefined;
225
+ maxDuration?: number | undefined;
226
+ memory?: number | undefined;
227
+ env: string[];
228
+ page: string;
229
+ runtime: "web";
230
+ files: string[];
231
+ name: string;
232
+ regexp: string;
233
+ sortingIndex: number;
70
234
  }>>;
71
- [myzod.keySignature]: myzod.AnyType;
235
+ }, "strip", z.ZodTypeAny, {
236
+ "_middleware.js"?: {
237
+ handler?: string | undefined;
238
+ regions?: string[] | undefined;
239
+ maxDuration?: number | undefined;
240
+ memory?: number | undefined;
241
+ env: string[];
242
+ page: string;
243
+ runtime: "web";
244
+ files: string[];
245
+ name: string;
246
+ regexp: string;
247
+ sortingIndex: number;
248
+ } | undefined;
249
+ }, {
250
+ "_middleware.js"?: {
251
+ handler?: string | undefined;
252
+ regions?: string[] | undefined;
253
+ maxDuration?: number | undefined;
254
+ memory?: number | undefined;
255
+ env: string[];
256
+ page: string;
257
+ runtime: "web";
258
+ files: string[];
259
+ name: string;
260
+ regexp: string;
261
+ sortingIndex: number;
262
+ } | undefined;
263
+ }>, z.ZodRecord<z.ZodString, z.ZodIntersection<z.ZodObject<{
264
+ env: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
265
+ page: z.ZodOptional<z.ZodString>;
266
+ handler: z.ZodOptional<z.ZodOptional<z.ZodString>>;
267
+ regions: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
268
+ maxDuration: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
269
+ memory: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
270
+ files: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
271
+ name: z.ZodOptional<z.ZodString>;
272
+ regexp: z.ZodOptional<z.ZodString>;
273
+ sortingIndex: z.ZodOptional<z.ZodNumber>;
274
+ }, "strict", z.ZodTypeAny, {
275
+ env?: string[] | undefined;
276
+ page?: string | undefined;
277
+ handler?: string | undefined;
278
+ regions?: string[] | undefined;
279
+ maxDuration?: number | undefined;
280
+ memory?: number | undefined;
281
+ files?: string[] | undefined;
282
+ name?: string | undefined;
283
+ regexp?: string | undefined;
284
+ sortingIndex?: number | undefined;
285
+ }, {
286
+ env?: string[] | undefined;
287
+ page?: string | undefined;
288
+ handler?: string | undefined;
289
+ regions?: string[] | undefined;
290
+ maxDuration?: number | undefined;
291
+ memory?: number | undefined;
292
+ files?: string[] | undefined;
293
+ name?: string | undefined;
294
+ regexp?: string | undefined;
295
+ sortingIndex?: number | undefined;
296
+ }>, z.ZodObject<{
297
+ runtime: z.ZodOptional<z.ZodString>;
298
+ handler: z.ZodOptional<z.ZodString>;
299
+ regions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
300
+ maxDuration: z.ZodOptional<z.ZodNumber>;
301
+ memory: z.ZodOptional<z.ZodNumber>;
302
+ }, "strict", z.ZodTypeAny, {
303
+ runtime?: string | undefined;
304
+ handler?: string | undefined;
305
+ regions?: string[] | undefined;
306
+ maxDuration?: number | undefined;
307
+ memory?: number | undefined;
308
+ }, {
309
+ runtime?: string | undefined;
310
+ handler?: string | undefined;
311
+ regions?: string[] | undefined;
312
+ maxDuration?: number | undefined;
313
+ memory?: number | undefined;
314
+ }>>>>;
315
+ }, "strip", z.ZodTypeAny, {
316
+ version: 1;
317
+ pages: {
318
+ "_middleware.js"?: {
319
+ handler?: string | undefined;
320
+ regions?: string[] | undefined;
321
+ maxDuration?: number | undefined;
322
+ memory?: number | undefined;
323
+ env: string[];
324
+ page: string;
325
+ runtime: "web";
326
+ files: string[];
327
+ name: string;
328
+ regexp: string;
329
+ sortingIndex: number;
330
+ } | undefined;
331
+ } & Record<string, {
332
+ env?: string[] | undefined;
333
+ page?: string | undefined;
334
+ handler?: string | undefined;
335
+ regions?: string[] | undefined;
336
+ maxDuration?: number | undefined;
337
+ memory?: number | undefined;
338
+ files?: string[] | undefined;
339
+ name?: string | undefined;
340
+ regexp?: string | undefined;
341
+ sortingIndex?: number | undefined;
342
+ } & {
343
+ runtime?: string | undefined;
344
+ handler?: string | undefined;
345
+ regions?: string[] | undefined;
346
+ maxDuration?: number | undefined;
347
+ memory?: number | undefined;
348
+ }>;
349
+ }, {
350
+ version: 1;
351
+ pages: {
352
+ "_middleware.js"?: {
353
+ handler?: string | undefined;
354
+ regions?: string[] | undefined;
355
+ maxDuration?: number | undefined;
356
+ memory?: number | undefined;
357
+ env: string[];
358
+ page: string;
359
+ runtime: "web";
360
+ files: string[];
361
+ name: string;
362
+ regexp: string;
363
+ sortingIndex: number;
364
+ } | undefined;
365
+ } & Record<string, {
366
+ env?: string[] | undefined;
367
+ page?: string | undefined;
368
+ handler?: string | undefined;
369
+ regions?: string[] | undefined;
370
+ maxDuration?: number | undefined;
371
+ memory?: number | undefined;
372
+ files?: string[] | undefined;
373
+ name?: string | undefined;
374
+ regexp?: string | undefined;
375
+ sortingIndex?: number | undefined;
376
+ } & {
377
+ runtime?: string | undefined;
378
+ handler?: string | undefined;
379
+ regions?: string[] | undefined;
380
+ maxDuration?: number | undefined;
381
+ memory?: number | undefined;
72
382
  }>;
73
383
  }>;
74
- declare type FunctionsManifest = myzod.Infer<typeof functionsManifestSchema>;
384
+ declare type FunctionsManifest = z.infer<typeof functionsManifestSchema>;
75
385
 
76
- declare const prerenderManifestSchemaRoute: myzod.ObjectType<{
77
- initialRevalidateSeconds: myzod.NumberType;
78
- srcRoute: myzod.StringType;
79
- dataRoute: myzod.StringType;
386
+ declare const prerenderManifestSchemaRoute: z.ZodObject<{
387
+ initialRevalidateSeconds: z.ZodNumber;
388
+ srcRoute: z.ZodString;
389
+ dataRoute: z.ZodString;
390
+ }, "strict", z.ZodTypeAny, {
391
+ initialRevalidateSeconds: number;
392
+ srcRoute: string;
393
+ dataRoute: string;
394
+ }, {
395
+ initialRevalidateSeconds: number;
396
+ srcRoute: string;
397
+ dataRoute: string;
80
398
  }>;
81
- declare const prerenderManifestSchemaDynamicRoute: myzod.ObjectType<{
82
- routeRegex: myzod.StringType;
83
- fallback: myzod.UnionType<[myzod.StringType, myzod.NullType]>;
84
- dataRoute: myzod.StringType;
85
- dataRouteRegex: myzod.StringType;
399
+ declare const prerenderManifestSchemaDynamicRoute: z.ZodObject<{
400
+ routeRegex: z.ZodString;
401
+ fallback: z.ZodUnion<[z.ZodString, z.ZodNull]>;
402
+ dataRoute: z.ZodString;
403
+ dataRouteRegex: z.ZodString;
404
+ }, "strict", z.ZodTypeAny, {
405
+ dataRoute: string;
406
+ routeRegex: string;
407
+ fallback: string | null;
408
+ dataRouteRegex: string;
409
+ }, {
410
+ dataRoute: string;
411
+ routeRegex: string;
412
+ fallback: string | null;
413
+ dataRouteRegex: string;
86
414
  }>;
87
- declare const prerenderManifestSchema: myzod.ObjectType<{
88
- version: myzod_libs_types.LiteralType<3>;
89
- routes: myzod.ObjectType<{
90
- [myzod.keySignature]: myzod.ObjectType<{
91
- initialRevalidateSeconds: myzod.NumberType;
92
- srcRoute: myzod.StringType;
93
- dataRoute: myzod.StringType;
94
- }>;
415
+ declare const prerenderManifestSchema: z.ZodObject<{
416
+ version: z.ZodLiteral<3>;
417
+ routes: z.ZodRecord<z.ZodString, z.ZodObject<{
418
+ initialRevalidateSeconds: z.ZodNumber;
419
+ srcRoute: z.ZodString;
420
+ dataRoute: z.ZodString;
421
+ }, "strict", z.ZodTypeAny, {
422
+ initialRevalidateSeconds: number;
423
+ srcRoute: string;
424
+ dataRoute: string;
425
+ }, {
426
+ initialRevalidateSeconds: number;
427
+ srcRoute: string;
428
+ dataRoute: string;
429
+ }>>;
430
+ dynamicRoutes: z.ZodRecord<z.ZodString, z.ZodObject<{
431
+ routeRegex: z.ZodString;
432
+ fallback: z.ZodUnion<[z.ZodString, z.ZodNull]>;
433
+ dataRoute: z.ZodString;
434
+ dataRouteRegex: z.ZodString;
435
+ }, "strict", z.ZodTypeAny, {
436
+ dataRoute: string;
437
+ routeRegex: string;
438
+ fallback: string | null;
439
+ dataRouteRegex: string;
440
+ }, {
441
+ dataRoute: string;
442
+ routeRegex: string;
443
+ fallback: string | null;
444
+ dataRouteRegex: string;
445
+ }>>;
446
+ preview: z.ZodObject<{
447
+ previewModeId: z.ZodUnion<[z.ZodString, z.ZodNull]>;
448
+ }, "strict", z.ZodTypeAny, {
449
+ previewModeId: string | null;
450
+ }, {
451
+ previewModeId: string | null;
452
+ }>;
453
+ }, "strict", z.ZodTypeAny, {
454
+ preview: {
455
+ previewModeId: string | null;
456
+ };
457
+ version: 3;
458
+ routes: Record<string, {
459
+ initialRevalidateSeconds: number;
460
+ srcRoute: string;
461
+ dataRoute: string;
462
+ }>;
463
+ dynamicRoutes: Record<string, {
464
+ dataRoute: string;
465
+ routeRegex: string;
466
+ fallback: string | null;
467
+ dataRouteRegex: string;
95
468
  }>;
96
- dynamicRoutes: myzod.ObjectType<{
97
- [myzod.keySignature]: myzod.ObjectType<{
98
- routeRegex: myzod.StringType;
99
- fallback: myzod.UnionType<[myzod.StringType, myzod.NullType]>;
100
- dataRoute: myzod.StringType;
101
- dataRouteRegex: myzod.StringType;
102
- }>;
469
+ }, {
470
+ preview: {
471
+ previewModeId: string | null;
472
+ };
473
+ version: 3;
474
+ routes: Record<string, {
475
+ initialRevalidateSeconds: number;
476
+ srcRoute: string;
477
+ dataRoute: string;
103
478
  }>;
104
- preview: myzod.ObjectType<{
105
- previewModeId: myzod.UnionType<[myzod.StringType, myzod.NullType]>;
479
+ dynamicRoutes: Record<string, {
480
+ dataRoute: string;
481
+ routeRegex: string;
482
+ fallback: string | null;
483
+ dataRouteRegex: string;
106
484
  }>;
107
485
  }>;
108
- declare type PrerenderManifest = myzod.Infer<typeof prerenderManifestSchema>;
109
- declare type PrerenderManifestRoute = myzod.Infer<typeof prerenderManifestSchemaRoute>;
110
- declare type PrerenderManifestDynamicRoute = myzod.Infer<typeof prerenderManifestSchemaDynamicRoute>;
486
+ declare type PrerenderManifest = z.infer<typeof prerenderManifestSchema>;
487
+ declare type PrerenderManifestRoute = z.infer<typeof prerenderManifestSchemaRoute>;
488
+ declare type PrerenderManifestDynamicRoute = z.infer<typeof prerenderManifestSchemaDynamicRoute>;
111
489
  declare type DeepPartial<T> = T extends Function ? T : T extends object ? {
112
490
  [P in keyof T]?: DeepPartial<T[P]>;
113
491
  } : T;
@@ -189,8 +567,8 @@ interface ViteVercelConfig {
189
567
  outDir?: string;
190
568
  }
191
569
  declare type ViteVercelPrerenderRoute = {
192
- isr?: Pick<PrerenderManifestDefault, 'routes'>;
193
- ssr?: Pick<RoutesManifestDefault, 'rewrites' | 'dynamicRoutes'>;
570
+ isr?: Pick<PrerenderManifestDefault, 'routes' | 'dynamicRoutes'>;
571
+ ssr?: Pick<RoutesManifestDefault, 'rewrites' | 'dynamicRoutes' | 'headers'>;
194
572
  };
195
573
  declare type ViteVercelPrerenderFn = (resolvedConfig: ResolvedConfig) => ViteVercelPrerenderRoute | Promise<ViteVercelPrerenderRoute>;
196
574
  interface ViteVercelApiEntry {
package/dist/index.js CHANGED
@@ -93,108 +93,97 @@ function assert(condition, errorMessage) {
93
93
  }
94
94
 
95
95
  // src/schemas/manifests/routes.ts
96
- var myzod = __toESM(require("myzod"));
97
- function record(schema) {
98
- return myzod.object({
99
- [myzod.keySignature]: schema
100
- });
101
- }
102
- var routesManifestRedirectSchema = myzod.object({
103
- source: myzod.string(),
104
- destination: myzod.string(),
105
- statusCode: myzod.literals(301, 302, 307, 308),
106
- regex: myzod.string()
107
- });
108
- var routesManifestHeaderSchema = myzod.object({
109
- source: myzod.string(),
110
- headers: myzod.array(myzod.object({
111
- key: myzod.string(),
112
- value: myzod.string()
113
- })),
114
- regex: myzod.string()
115
- });
116
- var routesManifestRewriteSchema = myzod.object({
117
- source: myzod.string(),
118
- has: myzod.array(myzod.object({
119
- key: myzod.string(),
120
- value: myzod.string(),
121
- type: myzod.literals("header", "cookie", "host", "query")
122
- })).optional(),
123
- destination: myzod.string(),
124
- regex: myzod.string()
125
- });
126
- var routesManifestDynamicRouteSchema = myzod.object({
127
- page: myzod.string(),
128
- regex: myzod.string(),
129
- routeKeys: record(myzod.string()).optional(),
130
- namedRegex: myzod.string().optional()
131
- });
132
- var routesManifestSchema = myzod.object({
133
- version: myzod.literal(3),
134
- basePath: myzod.string().pattern(/^\/.*/),
135
- pages404: myzod.boolean(),
136
- redirects: myzod.array(routesManifestRedirectSchema).optional(),
137
- headers: myzod.array(routesManifestHeaderSchema).optional(),
138
- rewrites: myzod.array(routesManifestRewriteSchema).optional(),
139
- dynamicRoutes: myzod.array(routesManifestDynamicRouteSchema).optional()
140
- });
96
+ var import_zod = require("zod");
97
+ var routesManifestRedirectSchema = import_zod.z.object({
98
+ source: import_zod.z.string(),
99
+ destination: import_zod.z.string(),
100
+ statusCode: import_zod.z.number().refine((n) => [301, 302, 307, 308].includes(n)),
101
+ regex: import_zod.z.string()
102
+ }).strict();
103
+ var routesManifestHeaderSchema = import_zod.z.object({
104
+ source: import_zod.z.string(),
105
+ headers: import_zod.z.array(import_zod.z.object({
106
+ key: import_zod.z.string(),
107
+ value: import_zod.z.string()
108
+ }).strict()),
109
+ regex: import_zod.z.string()
110
+ }).strict();
111
+ var routesManifestRewriteSchema = import_zod.z.object({
112
+ source: import_zod.z.string(),
113
+ has: import_zod.z.array(import_zod.z.object({
114
+ key: import_zod.z.string(),
115
+ value: import_zod.z.string(),
116
+ type: import_zod.z.enum(["header", "cookie", "host", "query"])
117
+ }).strict()).optional(),
118
+ destination: import_zod.z.string(),
119
+ regex: import_zod.z.string()
120
+ }).strict();
121
+ var routesManifestDynamicRouteSchema = import_zod.z.object({
122
+ page: import_zod.z.string(),
123
+ regex: import_zod.z.string(),
124
+ routeKeys: import_zod.z.record(import_zod.z.string()).optional(),
125
+ namedRegex: import_zod.z.string().optional()
126
+ }).strict();
127
+ var routesManifestSchema = import_zod.z.object({
128
+ version: import_zod.z.literal(3),
129
+ basePath: import_zod.z.string().regex(/^\/.*/),
130
+ pages404: import_zod.z.boolean(),
131
+ redirects: import_zod.z.array(routesManifestRedirectSchema).optional(),
132
+ headers: import_zod.z.array(routesManifestHeaderSchema).optional(),
133
+ rewrites: import_zod.z.array(routesManifestRewriteSchema).optional(),
134
+ dynamicRoutes: import_zod.z.array(routesManifestDynamicRouteSchema).optional()
135
+ }).strict();
141
136
 
142
137
  // src/schemas/manifests/functions.ts
143
- var myzod2 = __toESM(require("myzod"));
144
- function record2(schema) {
145
- return myzod2.object({
146
- [myzod2.keySignature]: schema
147
- });
148
- }
149
- var functionsManifestSchemaPage = myzod2.object({
150
- runtime: myzod2.string().optional(),
151
- handler: myzod2.string().optional(),
152
- regions: myzod2.array(myzod2.string()).optional(),
153
- maxDuration: myzod2.number().min(1).max(900).optional(),
154
- memory: myzod2.number().min(128).max(3008).optional()
155
- });
156
- var functionsManifestSchemaPageWeb = myzod2.omit(functionsManifestSchemaPage, ["runtime"]).and(myzod2.object({
157
- runtime: myzod2.literal("web"),
158
- env: myzod2.array(myzod2.string()),
159
- files: myzod2.array(myzod2.string()),
160
- name: myzod2.string(),
161
- page: myzod2.string(),
162
- regexp: myzod2.string(),
163
- sortingIndex: myzod2.number()
164
- }));
165
- var functionsManifestSchema = myzod2.object({
166
- version: myzod2.literal(1),
167
- pages: myzod2.object({
138
+ var import_zod2 = require("zod");
139
+ var functionsManifestSchemaPage = import_zod2.z.object({
140
+ runtime: import_zod2.z.string().optional(),
141
+ handler: import_zod2.z.string().optional(),
142
+ regions: import_zod2.z.array(import_zod2.z.string()).optional(),
143
+ maxDuration: import_zod2.z.number().min(1).max(900).optional(),
144
+ memory: import_zod2.z.number().min(128).max(3008).optional()
145
+ }).strict();
146
+ var functionsManifestSchemaPageWeb = functionsManifestSchemaPage.omit({
147
+ runtime: true
148
+ }).merge(import_zod2.z.object({
149
+ runtime: import_zod2.z.literal("web"),
150
+ env: import_zod2.z.array(import_zod2.z.string()),
151
+ files: import_zod2.z.array(import_zod2.z.string()),
152
+ name: import_zod2.z.string(),
153
+ page: import_zod2.z.string(),
154
+ regexp: import_zod2.z.string(),
155
+ sortingIndex: import_zod2.z.number()
156
+ }).strict());
157
+ var functionsManifestSchema = import_zod2.z.object({
158
+ version: import_zod2.z.literal(1),
159
+ pages: import_zod2.z.object({
168
160
  "_middleware.js": functionsManifestSchemaPageWeb.optional()
169
- }).and(record2(myzod2.intersection(myzod2.partial(myzod2.omit(functionsManifestSchemaPageWeb, ["runtime"])), functionsManifestSchemaPage)))
161
+ }).and(import_zod2.z.record(import_zod2.z.intersection(functionsManifestSchemaPageWeb.omit({
162
+ runtime: true
163
+ }).partial(), functionsManifestSchemaPage)))
170
164
  });
171
165
 
172
166
  // src/schemas/manifests/prerender.ts
173
- var myzod3 = __toESM(require("myzod"));
174
- function record3(schema) {
175
- return myzod3.object({
176
- [myzod3.keySignature]: schema
177
- });
178
- }
179
- var prerenderManifestSchemaRoute = myzod3.object({
180
- initialRevalidateSeconds: myzod3.number(),
181
- srcRoute: myzod3.string(),
182
- dataRoute: myzod3.string()
183
- });
184
- var prerenderManifestSchemaDynamicRoute = myzod3.object({
185
- routeRegex: myzod3.string(),
186
- fallback: myzod3.string().or(myzod3.null()),
187
- dataRoute: myzod3.string(),
188
- dataRouteRegex: myzod3.string()
189
- });
190
- var prerenderManifestSchema = myzod3.object({
191
- version: myzod3.literal(3),
192
- routes: record3(prerenderManifestSchemaRoute),
193
- dynamicRoutes: record3(prerenderManifestSchemaDynamicRoute),
194
- preview: myzod3.object({
195
- previewModeId: myzod3.string().or(myzod3.null())
196
- })
197
- });
167
+ var import_zod3 = require("zod");
168
+ var prerenderManifestSchemaRoute = import_zod3.z.object({
169
+ initialRevalidateSeconds: import_zod3.z.number(),
170
+ srcRoute: import_zod3.z.string(),
171
+ dataRoute: import_zod3.z.string()
172
+ }).strict();
173
+ var prerenderManifestSchemaDynamicRoute = import_zod3.z.object({
174
+ routeRegex: import_zod3.z.string(),
175
+ fallback: import_zod3.z.string().or(import_zod3.z.null()),
176
+ dataRoute: import_zod3.z.string(),
177
+ dataRouteRegex: import_zod3.z.string()
178
+ }).strict();
179
+ var prerenderManifestSchema = import_zod3.z.object({
180
+ version: import_zod3.z.literal(3),
181
+ routes: import_zod3.z.record(prerenderManifestSchemaRoute),
182
+ dynamicRoutes: import_zod3.z.record(prerenderManifestSchemaDynamicRoute),
183
+ preview: import_zod3.z.object({
184
+ previewModeId: import_zod3.z.string().or(import_zod3.z.null())
185
+ }).strict()
186
+ }).strict();
198
187
 
199
188
  // src/manifests.ts
200
189
  function getPrerenderManifest(resolvedConfig, isrPages) {
@@ -211,14 +200,17 @@ function getPrerenderManifest(resolvedConfig, isrPages) {
211
200
  };
212
201
  return acc;
213
202
  }, {});
214
- const uniqueRoutes = Array.from(new Set(Object.values(routes).map((r) => r.srcRoute)));
215
- const dynamicRoutes = uniqueRoutes.reduce((acc, cur) => {
216
- var _a2, _b2, _c, _d, _e, _f;
217
- acc[cur] = {
218
- routeRegex: "^" + cur + "$",
219
- dataRoute: ((_b2 = (_a2 = prerenderManifestDefault == null ? void 0 : prerenderManifestDefault.dynamicRoutes) == null ? void 0 : _a2[cur]) == null ? void 0 : _b2.dataRoute) ?? "",
220
- fallback: ((_d = (_c = prerenderManifestDefault == null ? void 0 : prerenderManifestDefault.dynamicRoutes) == null ? void 0 : _c[cur]) == null ? void 0 : _d.fallback) ?? null,
221
- dataRouteRegex: ((_f = (_e = prerenderManifestDefault == null ? void 0 : prerenderManifestDefault.dynamicRoutes) == null ? void 0 : _e[cur]) == null ? void 0 : _f.dataRouteRegex) ?? ""
203
+ const dynamicRoutes = Object.entries((isrPages == null ? void 0 : isrPages.dynamicRoutes) ?? {}).reduce((acc, [key, val]) => {
204
+ var _a2;
205
+ const override = (_a2 = prerenderManifestDefault == null ? void 0 : prerenderManifestDefault.dynamicRoutes) == null ? void 0 : _a2[key];
206
+ const routeRegex = (val == null ? void 0 : val.routeRegex) ?? (override == null ? void 0 : override.routeRegex);
207
+ const fallback = (val == null ? void 0 : val.fallback) === null || typeof (val == null ? void 0 : val.fallback) === "string" ? val == null ? void 0 : val.fallback : (override == null ? void 0 : override.fallback) === null || typeof (override == null ? void 0 : override.fallback) === "string" ? override == null ? void 0 : override.fallback : null;
208
+ assert(routeRegex, `\`[prerender-manifest] { routeRegex }\` is required for route ${key}`);
209
+ acc[key] = {
210
+ routeRegex,
211
+ fallback,
212
+ dataRoute: (val == null ? void 0 : val.dataRoute) ?? (override == null ? void 0 : override.dataRoute) ?? "",
213
+ dataRouteRegex: (val == null ? void 0 : val.dataRouteRegex) ?? (override == null ? void 0 : override.dataRouteRegex) ?? ""
222
214
  };
223
215
  return acc;
224
216
  }, {});
@@ -229,8 +221,6 @@ function getPrerenderManifest(resolvedConfig, isrPages) {
229
221
  preview: {
230
222
  previewModeId: ((_b = prerenderManifestDefault == null ? void 0 : prerenderManifestDefault.preview) == null ? void 0 : _b.previewModeId) ?? null
231
223
  }
232
- }, {
233
- collectErrors: true
234
224
  });
235
225
  }
236
226
  function getPrerenderManifestDestination(resolvedConfig) {
@@ -240,12 +230,16 @@ function getRoutesManifest(resolvedConfig, ssr) {
240
230
  var _a;
241
231
  const routesManifest = (_a = resolvedConfig.vercel) == null ? void 0 : _a.routesManifest;
242
232
  const allRewrites = [
243
- ...(ssr == null ? void 0 : ssr.rewrites) ?? [],
244
- ...(routesManifest == null ? void 0 : routesManifest.rewrites) ?? []
233
+ ...(routesManifest == null ? void 0 : routesManifest.rewrites) ?? [],
234
+ ...(ssr == null ? void 0 : ssr.rewrites) ?? []
245
235
  ];
246
236
  const allDynamicRoutes = [
247
- ...(ssr == null ? void 0 : ssr.dynamicRoutes) ?? [],
248
- ...(routesManifest == null ? void 0 : routesManifest.dynamicRoutes) ?? []
237
+ ...(routesManifest == null ? void 0 : routesManifest.dynamicRoutes) ?? [],
238
+ ...(ssr == null ? void 0 : ssr.dynamicRoutes) ?? []
239
+ ];
240
+ const allHeaders = [
241
+ ...(routesManifest == null ? void 0 : routesManifest.headers) ?? [],
242
+ ...(ssr == null ? void 0 : ssr.headers) ?? []
249
243
  ];
250
244
  return routesManifestSchema.parse({
251
245
  version: 3,
@@ -254,9 +248,7 @@ function getRoutesManifest(resolvedConfig, ssr) {
254
248
  dynamicRoutes: allDynamicRoutes.length > 0 ? allDynamicRoutes : void 0,
255
249
  rewrites: allRewrites.length > 0 ? allRewrites : void 0,
256
250
  redirects: routesManifest == null ? void 0 : routesManifest.redirects,
257
- headers: routesManifest == null ? void 0 : routesManifest.headers
258
- }, {
259
- collectErrors: true
251
+ headers: allHeaders.length > 0 ? allHeaders : void 0
260
252
  });
261
253
  }
262
254
  function getRoutesManifestDestination(resolvedConfig) {
@@ -266,8 +258,6 @@ function getFunctionsManifest(pages) {
266
258
  return functionsManifestSchema.parse({
267
259
  version: 1,
268
260
  pages
269
- }, {
270
- collectErrors: true
271
261
  });
272
262
  }
273
263
  function getFunctionsManifestDestination(resolvedConfig) {
@@ -378,6 +368,9 @@ function vercelPlugin() {
378
368
  resolvedConfig = config;
379
369
  },
380
370
  async buildStart() {
371
+ if (process.env.VERCEL_ENV === "production" && !process.env.ENABLE_FILE_SYSTEM_API) {
372
+ throw new Error("Missing ENABLE_FILE_SYSTEM_API=1 to your environment variables in your project settings");
373
+ }
381
374
  if (resolvedConfig.build.ssr)
382
375
  return;
383
376
  await cleanOutputDirectory(resolvedConfig);
package/dist/index.mjs CHANGED
@@ -64,108 +64,97 @@ function assert(condition, errorMessage) {
64
64
  }
65
65
 
66
66
  // src/schemas/manifests/routes.ts
67
- import * as myzod from "myzod";
68
- function record(schema) {
69
- return myzod.object({
70
- [myzod.keySignature]: schema
71
- });
72
- }
73
- var routesManifestRedirectSchema = myzod.object({
74
- source: myzod.string(),
75
- destination: myzod.string(),
76
- statusCode: myzod.literals(301, 302, 307, 308),
77
- regex: myzod.string()
78
- });
79
- var routesManifestHeaderSchema = myzod.object({
80
- source: myzod.string(),
81
- headers: myzod.array(myzod.object({
82
- key: myzod.string(),
83
- value: myzod.string()
84
- })),
85
- regex: myzod.string()
86
- });
87
- var routesManifestRewriteSchema = myzod.object({
88
- source: myzod.string(),
89
- has: myzod.array(myzod.object({
90
- key: myzod.string(),
91
- value: myzod.string(),
92
- type: myzod.literals("header", "cookie", "host", "query")
93
- })).optional(),
94
- destination: myzod.string(),
95
- regex: myzod.string()
96
- });
97
- var routesManifestDynamicRouteSchema = myzod.object({
98
- page: myzod.string(),
99
- regex: myzod.string(),
100
- routeKeys: record(myzod.string()).optional(),
101
- namedRegex: myzod.string().optional()
102
- });
103
- var routesManifestSchema = myzod.object({
104
- version: myzod.literal(3),
105
- basePath: myzod.string().pattern(/^\/.*/),
106
- pages404: myzod.boolean(),
107
- redirects: myzod.array(routesManifestRedirectSchema).optional(),
108
- headers: myzod.array(routesManifestHeaderSchema).optional(),
109
- rewrites: myzod.array(routesManifestRewriteSchema).optional(),
110
- dynamicRoutes: myzod.array(routesManifestDynamicRouteSchema).optional()
111
- });
67
+ import { z } from "zod";
68
+ var routesManifestRedirectSchema = z.object({
69
+ source: z.string(),
70
+ destination: z.string(),
71
+ statusCode: z.number().refine((n) => [301, 302, 307, 308].includes(n)),
72
+ regex: z.string()
73
+ }).strict();
74
+ var routesManifestHeaderSchema = z.object({
75
+ source: z.string(),
76
+ headers: z.array(z.object({
77
+ key: z.string(),
78
+ value: z.string()
79
+ }).strict()),
80
+ regex: z.string()
81
+ }).strict();
82
+ var routesManifestRewriteSchema = z.object({
83
+ source: z.string(),
84
+ has: z.array(z.object({
85
+ key: z.string(),
86
+ value: z.string(),
87
+ type: z.enum(["header", "cookie", "host", "query"])
88
+ }).strict()).optional(),
89
+ destination: z.string(),
90
+ regex: z.string()
91
+ }).strict();
92
+ var routesManifestDynamicRouteSchema = z.object({
93
+ page: z.string(),
94
+ regex: z.string(),
95
+ routeKeys: z.record(z.string()).optional(),
96
+ namedRegex: z.string().optional()
97
+ }).strict();
98
+ var routesManifestSchema = z.object({
99
+ version: z.literal(3),
100
+ basePath: z.string().regex(/^\/.*/),
101
+ pages404: z.boolean(),
102
+ redirects: z.array(routesManifestRedirectSchema).optional(),
103
+ headers: z.array(routesManifestHeaderSchema).optional(),
104
+ rewrites: z.array(routesManifestRewriteSchema).optional(),
105
+ dynamicRoutes: z.array(routesManifestDynamicRouteSchema).optional()
106
+ }).strict();
112
107
 
113
108
  // src/schemas/manifests/functions.ts
114
- import * as myzod2 from "myzod";
115
- function record2(schema) {
116
- return myzod2.object({
117
- [myzod2.keySignature]: schema
118
- });
119
- }
120
- var functionsManifestSchemaPage = myzod2.object({
121
- runtime: myzod2.string().optional(),
122
- handler: myzod2.string().optional(),
123
- regions: myzod2.array(myzod2.string()).optional(),
124
- maxDuration: myzod2.number().min(1).max(900).optional(),
125
- memory: myzod2.number().min(128).max(3008).optional()
126
- });
127
- var functionsManifestSchemaPageWeb = myzod2.omit(functionsManifestSchemaPage, ["runtime"]).and(myzod2.object({
128
- runtime: myzod2.literal("web"),
129
- env: myzod2.array(myzod2.string()),
130
- files: myzod2.array(myzod2.string()),
131
- name: myzod2.string(),
132
- page: myzod2.string(),
133
- regexp: myzod2.string(),
134
- sortingIndex: myzod2.number()
135
- }));
136
- var functionsManifestSchema = myzod2.object({
137
- version: myzod2.literal(1),
138
- pages: myzod2.object({
109
+ import { z as z2 } from "zod";
110
+ var functionsManifestSchemaPage = z2.object({
111
+ runtime: z2.string().optional(),
112
+ handler: z2.string().optional(),
113
+ regions: z2.array(z2.string()).optional(),
114
+ maxDuration: z2.number().min(1).max(900).optional(),
115
+ memory: z2.number().min(128).max(3008).optional()
116
+ }).strict();
117
+ var functionsManifestSchemaPageWeb = functionsManifestSchemaPage.omit({
118
+ runtime: true
119
+ }).merge(z2.object({
120
+ runtime: z2.literal("web"),
121
+ env: z2.array(z2.string()),
122
+ files: z2.array(z2.string()),
123
+ name: z2.string(),
124
+ page: z2.string(),
125
+ regexp: z2.string(),
126
+ sortingIndex: z2.number()
127
+ }).strict());
128
+ var functionsManifestSchema = z2.object({
129
+ version: z2.literal(1),
130
+ pages: z2.object({
139
131
  "_middleware.js": functionsManifestSchemaPageWeb.optional()
140
- }).and(record2(myzod2.intersection(myzod2.partial(myzod2.omit(functionsManifestSchemaPageWeb, ["runtime"])), functionsManifestSchemaPage)))
132
+ }).and(z2.record(z2.intersection(functionsManifestSchemaPageWeb.omit({
133
+ runtime: true
134
+ }).partial(), functionsManifestSchemaPage)))
141
135
  });
142
136
 
143
137
  // src/schemas/manifests/prerender.ts
144
- import * as myzod3 from "myzod";
145
- function record3(schema) {
146
- return myzod3.object({
147
- [myzod3.keySignature]: schema
148
- });
149
- }
150
- var prerenderManifestSchemaRoute = myzod3.object({
151
- initialRevalidateSeconds: myzod3.number(),
152
- srcRoute: myzod3.string(),
153
- dataRoute: myzod3.string()
154
- });
155
- var prerenderManifestSchemaDynamicRoute = myzod3.object({
156
- routeRegex: myzod3.string(),
157
- fallback: myzod3.string().or(myzod3.null()),
158
- dataRoute: myzod3.string(),
159
- dataRouteRegex: myzod3.string()
160
- });
161
- var prerenderManifestSchema = myzod3.object({
162
- version: myzod3.literal(3),
163
- routes: record3(prerenderManifestSchemaRoute),
164
- dynamicRoutes: record3(prerenderManifestSchemaDynamicRoute),
165
- preview: myzod3.object({
166
- previewModeId: myzod3.string().or(myzod3.null())
167
- })
168
- });
138
+ import { z as z3 } from "zod";
139
+ var prerenderManifestSchemaRoute = z3.object({
140
+ initialRevalidateSeconds: z3.number(),
141
+ srcRoute: z3.string(),
142
+ dataRoute: z3.string()
143
+ }).strict();
144
+ var prerenderManifestSchemaDynamicRoute = z3.object({
145
+ routeRegex: z3.string(),
146
+ fallback: z3.string().or(z3.null()),
147
+ dataRoute: z3.string(),
148
+ dataRouteRegex: z3.string()
149
+ }).strict();
150
+ var prerenderManifestSchema = z3.object({
151
+ version: z3.literal(3),
152
+ routes: z3.record(prerenderManifestSchemaRoute),
153
+ dynamicRoutes: z3.record(prerenderManifestSchemaDynamicRoute),
154
+ preview: z3.object({
155
+ previewModeId: z3.string().or(z3.null())
156
+ }).strict()
157
+ }).strict();
169
158
 
170
159
  // src/manifests.ts
171
160
  function getPrerenderManifest(resolvedConfig, isrPages) {
@@ -182,14 +171,17 @@ function getPrerenderManifest(resolvedConfig, isrPages) {
182
171
  };
183
172
  return acc;
184
173
  }, {});
185
- const uniqueRoutes = Array.from(new Set(Object.values(routes).map((r) => r.srcRoute)));
186
- const dynamicRoutes = uniqueRoutes.reduce((acc, cur) => {
187
- var _a2, _b2, _c, _d, _e, _f;
188
- acc[cur] = {
189
- routeRegex: "^" + cur + "$",
190
- dataRoute: ((_b2 = (_a2 = prerenderManifestDefault == null ? void 0 : prerenderManifestDefault.dynamicRoutes) == null ? void 0 : _a2[cur]) == null ? void 0 : _b2.dataRoute) ?? "",
191
- fallback: ((_d = (_c = prerenderManifestDefault == null ? void 0 : prerenderManifestDefault.dynamicRoutes) == null ? void 0 : _c[cur]) == null ? void 0 : _d.fallback) ?? null,
192
- dataRouteRegex: ((_f = (_e = prerenderManifestDefault == null ? void 0 : prerenderManifestDefault.dynamicRoutes) == null ? void 0 : _e[cur]) == null ? void 0 : _f.dataRouteRegex) ?? ""
174
+ const dynamicRoutes = Object.entries((isrPages == null ? void 0 : isrPages.dynamicRoutes) ?? {}).reduce((acc, [key, val]) => {
175
+ var _a2;
176
+ const override = (_a2 = prerenderManifestDefault == null ? void 0 : prerenderManifestDefault.dynamicRoutes) == null ? void 0 : _a2[key];
177
+ const routeRegex = (val == null ? void 0 : val.routeRegex) ?? (override == null ? void 0 : override.routeRegex);
178
+ const fallback = (val == null ? void 0 : val.fallback) === null || typeof (val == null ? void 0 : val.fallback) === "string" ? val == null ? void 0 : val.fallback : (override == null ? void 0 : override.fallback) === null || typeof (override == null ? void 0 : override.fallback) === "string" ? override == null ? void 0 : override.fallback : null;
179
+ assert(routeRegex, `\`[prerender-manifest] { routeRegex }\` is required for route ${key}`);
180
+ acc[key] = {
181
+ routeRegex,
182
+ fallback,
183
+ dataRoute: (val == null ? void 0 : val.dataRoute) ?? (override == null ? void 0 : override.dataRoute) ?? "",
184
+ dataRouteRegex: (val == null ? void 0 : val.dataRouteRegex) ?? (override == null ? void 0 : override.dataRouteRegex) ?? ""
193
185
  };
194
186
  return acc;
195
187
  }, {});
@@ -200,8 +192,6 @@ function getPrerenderManifest(resolvedConfig, isrPages) {
200
192
  preview: {
201
193
  previewModeId: ((_b = prerenderManifestDefault == null ? void 0 : prerenderManifestDefault.preview) == null ? void 0 : _b.previewModeId) ?? null
202
194
  }
203
- }, {
204
- collectErrors: true
205
195
  });
206
196
  }
207
197
  function getPrerenderManifestDestination(resolvedConfig) {
@@ -211,12 +201,16 @@ function getRoutesManifest(resolvedConfig, ssr) {
211
201
  var _a;
212
202
  const routesManifest = (_a = resolvedConfig.vercel) == null ? void 0 : _a.routesManifest;
213
203
  const allRewrites = [
214
- ...(ssr == null ? void 0 : ssr.rewrites) ?? [],
215
- ...(routesManifest == null ? void 0 : routesManifest.rewrites) ?? []
204
+ ...(routesManifest == null ? void 0 : routesManifest.rewrites) ?? [],
205
+ ...(ssr == null ? void 0 : ssr.rewrites) ?? []
216
206
  ];
217
207
  const allDynamicRoutes = [
218
- ...(ssr == null ? void 0 : ssr.dynamicRoutes) ?? [],
219
- ...(routesManifest == null ? void 0 : routesManifest.dynamicRoutes) ?? []
208
+ ...(routesManifest == null ? void 0 : routesManifest.dynamicRoutes) ?? [],
209
+ ...(ssr == null ? void 0 : ssr.dynamicRoutes) ?? []
210
+ ];
211
+ const allHeaders = [
212
+ ...(routesManifest == null ? void 0 : routesManifest.headers) ?? [],
213
+ ...(ssr == null ? void 0 : ssr.headers) ?? []
220
214
  ];
221
215
  return routesManifestSchema.parse({
222
216
  version: 3,
@@ -225,9 +219,7 @@ function getRoutesManifest(resolvedConfig, ssr) {
225
219
  dynamicRoutes: allDynamicRoutes.length > 0 ? allDynamicRoutes : void 0,
226
220
  rewrites: allRewrites.length > 0 ? allRewrites : void 0,
227
221
  redirects: routesManifest == null ? void 0 : routesManifest.redirects,
228
- headers: routesManifest == null ? void 0 : routesManifest.headers
229
- }, {
230
- collectErrors: true
222
+ headers: allHeaders.length > 0 ? allHeaders : void 0
231
223
  });
232
224
  }
233
225
  function getRoutesManifestDestination(resolvedConfig) {
@@ -237,8 +229,6 @@ function getFunctionsManifest(pages) {
237
229
  return functionsManifestSchema.parse({
238
230
  version: 1,
239
231
  pages
240
- }, {
241
- collectErrors: true
242
232
  });
243
233
  }
244
234
  function getFunctionsManifestDestination(resolvedConfig) {
@@ -349,6 +339,9 @@ function vercelPlugin() {
349
339
  resolvedConfig = config;
350
340
  },
351
341
  async buildStart() {
342
+ if (process.env.VERCEL_ENV === "production" && !process.env.ENABLE_FILE_SYSTEM_API) {
343
+ throw new Error("Missing ENABLE_FILE_SYSTEM_API=1 to your environment variables in your project settings");
344
+ }
352
345
  if (resolvedConfig.build.ssr)
353
346
  return;
354
347
  await cleanOutputDirectory(resolvedConfig);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-vercel",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "module": "./dist/index.mjs",
5
5
  "files": [
6
6
  "dist",
@@ -34,7 +34,7 @@
34
34
  "@brillout/libassert": "^0.5.4",
35
35
  "esbuild": "^0.14.25",
36
36
  "fast-glob": "^3.2.11",
37
- "myzod": "^1.8.7"
37
+ "zod": "^3.14.2"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "tsup",