vite-plugin-vercel 5.0.5 → 6.0.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/README.md +7 -0
- package/dist/index.cjs +17 -12
- package/dist/index.d.cts +45 -23
- package/dist/index.d.ts +45 -23
- package/dist/index.js +17 -12
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -75,6 +75,9 @@ export const headers = {
|
|
|
75
75
|
'Some-Header': 'some value',
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
+
// Stream the response
|
|
79
|
+
export const streaming = true;
|
|
80
|
+
|
|
78
81
|
// Enable Incremental Static Regeneration for this endpoint
|
|
79
82
|
export const isr = {
|
|
80
83
|
expiration: 30,
|
|
@@ -148,6 +151,10 @@ export default defineConfig({
|
|
|
148
151
|
* If left empty, default value for your plan will be used.
|
|
149
152
|
*/
|
|
150
153
|
defaultMaxDuration: 30,
|
|
154
|
+
/**
|
|
155
|
+
* Enable streaming responses by default for all Serverless Functions
|
|
156
|
+
*/
|
|
157
|
+
defaultSupportsResponseStreaming: true,
|
|
151
158
|
/**
|
|
152
159
|
* Default expiration time (in seconds) for prerender functions.
|
|
153
160
|
* Defaults to 86400 seconds (24h).
|
package/dist/index.cjs
CHANGED
|
@@ -262,7 +262,9 @@ var vercelOutputServerlessVcConfigSchema = import_zod2.z.object({
|
|
|
262
262
|
memory: import_zod2.z.number().int().min(128).max(3008).optional(),
|
|
263
263
|
maxDuration: import_zod2.z.number().int().positive().optional(),
|
|
264
264
|
environment: import_zod2.z.record(import_zod2.z.string()).optional(),
|
|
265
|
-
regions: import_zod2.z.array(import_zod2.z.string()).optional()
|
|
265
|
+
regions: import_zod2.z.array(import_zod2.z.string()).optional(),
|
|
266
|
+
supportsWrapper: import_zod2.z.boolean().optional(),
|
|
267
|
+
supportsResponseStreaming: import_zod2.z.boolean().optional()
|
|
266
268
|
}).strict();
|
|
267
269
|
var vercelOutputServerlessNodeVcConfigSchema = vercelOutputServerlessVcConfigSchema.extend({
|
|
268
270
|
launcherType: import_zod2.z.literal("Nodejs"),
|
|
@@ -285,6 +287,7 @@ var import_zod3 = require("zod");
|
|
|
285
287
|
var vercelEndpointExports = import_zod3.z.object({
|
|
286
288
|
edge: import_zod3.z.boolean().optional(),
|
|
287
289
|
headers: import_zod3.z.record(import_zod3.z.string()).optional(),
|
|
290
|
+
streaming: import_zod3.z.boolean().optional(),
|
|
288
291
|
isr: import_zod3.z.object({
|
|
289
292
|
expiration: import_zod3.z.number().or(import_zod3.z.literal(false))
|
|
290
293
|
}).optional()
|
|
@@ -355,7 +358,7 @@ var vercelOgPlugin = (ctx) => {
|
|
|
355
358
|
};
|
|
356
359
|
var standardBuildOptions = {
|
|
357
360
|
bundle: true,
|
|
358
|
-
target: "
|
|
361
|
+
target: "es2022",
|
|
359
362
|
format: "esm",
|
|
360
363
|
platform: "node",
|
|
361
364
|
logLevel: "info",
|
|
@@ -465,16 +468,14 @@ const __dirname = VPV_dirname(__filename);
|
|
|
465
468
|
}
|
|
466
469
|
}
|
|
467
470
|
}
|
|
468
|
-
await writeVcConfig(
|
|
469
|
-
|
|
470
|
-
entry.
|
|
471
|
-
|
|
472
|
-
filename
|
|
473
|
-
);
|
|
471
|
+
await writeVcConfig(resolvedConfig, entry.destination, filename, {
|
|
472
|
+
edge: Boolean(entry.edge),
|
|
473
|
+
streaming: entry.streaming
|
|
474
|
+
});
|
|
474
475
|
return output;
|
|
475
476
|
}
|
|
476
|
-
async function writeVcConfig(resolvedConfig, destination,
|
|
477
|
-
var _a;
|
|
477
|
+
async function writeVcConfig(resolvedConfig, destination, filename, options) {
|
|
478
|
+
var _a, _b;
|
|
478
479
|
const vcConfig = import_path3.default.join(
|
|
479
480
|
getOutput(resolvedConfig, "functions"),
|
|
480
481
|
destination,
|
|
@@ -485,7 +486,7 @@ async function writeVcConfig(resolvedConfig, destination, edge, filename) {
|
|
|
485
486
|
vcConfig,
|
|
486
487
|
JSON.stringify(
|
|
487
488
|
vercelOutputVcConfigSchema.parse(
|
|
488
|
-
edge ? {
|
|
489
|
+
options.edge ? {
|
|
489
490
|
runtime: "edge",
|
|
490
491
|
entrypoint: filename
|
|
491
492
|
} : {
|
|
@@ -493,7 +494,8 @@ async function writeVcConfig(resolvedConfig, destination, edge, filename) {
|
|
|
493
494
|
handler: filename,
|
|
494
495
|
maxDuration: (_a = resolvedConfig.vercel) == null ? void 0 : _a.defaultMaxDuration,
|
|
495
496
|
launcherType: "Nodejs",
|
|
496
|
-
shouldAddHelpers: true
|
|
497
|
+
shouldAddHelpers: true,
|
|
498
|
+
supportsResponseStreaming: options.streaming ?? ((_b = resolvedConfig.vercel) == null ? void 0 : _b.defaultSupportsResponseStreaming)
|
|
497
499
|
}
|
|
498
500
|
),
|
|
499
501
|
void 0,
|
|
@@ -577,6 +579,9 @@ async function buildEndpoints(resolvedConfig) {
|
|
|
577
579
|
if (exports2.isr) {
|
|
578
580
|
entry.isr = exports2.isr;
|
|
579
581
|
}
|
|
582
|
+
if (typeof exports2.streaming === "boolean") {
|
|
583
|
+
entry.streaming = exports2.streaming;
|
|
584
|
+
}
|
|
580
585
|
}
|
|
581
586
|
}
|
|
582
587
|
await buildFn(resolvedConfig, entry);
|
package/dist/index.d.cts
CHANGED
|
@@ -114,19 +114,19 @@ declare const vercelOutputConfigSchema: z.ZodObject<{
|
|
|
114
114
|
redirect: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
115
115
|
cookie: z.ZodOptional<z.ZodString>;
|
|
116
116
|
}, "strict", z.ZodTypeAny, {
|
|
117
|
-
redirect?: Record<string, string> | undefined;
|
|
118
117
|
cookie?: string | undefined;
|
|
119
|
-
}, {
|
|
120
118
|
redirect?: Record<string, string> | undefined;
|
|
119
|
+
}, {
|
|
121
120
|
cookie?: string | undefined;
|
|
121
|
+
redirect?: Record<string, string> | undefined;
|
|
122
122
|
}>>;
|
|
123
123
|
middlewarePath: z.ZodOptional<z.ZodString>;
|
|
124
124
|
}, "strict", z.ZodTypeAny, {
|
|
125
125
|
src: string;
|
|
126
|
+
status?: number | undefined;
|
|
126
127
|
dest?: string | undefined;
|
|
127
128
|
headers?: Record<string, string> | undefined;
|
|
128
129
|
methods?: string[] | undefined;
|
|
129
|
-
status?: number | undefined;
|
|
130
130
|
continue?: boolean | undefined;
|
|
131
131
|
check?: boolean | undefined;
|
|
132
132
|
missing?: ({
|
|
@@ -162,16 +162,16 @@ declare const vercelOutputConfigSchema: z.ZodObject<{
|
|
|
162
162
|
value?: string | undefined;
|
|
163
163
|
})[] | undefined;
|
|
164
164
|
locale?: {
|
|
165
|
-
redirect?: Record<string, string> | undefined;
|
|
166
165
|
cookie?: string | undefined;
|
|
166
|
+
redirect?: Record<string, string> | undefined;
|
|
167
167
|
} | undefined;
|
|
168
168
|
middlewarePath?: string | undefined;
|
|
169
169
|
}, {
|
|
170
170
|
src: string;
|
|
171
|
+
status?: number | undefined;
|
|
171
172
|
dest?: string | undefined;
|
|
172
173
|
headers?: Record<string, string> | undefined;
|
|
173
174
|
methods?: string[] | undefined;
|
|
174
|
-
status?: number | undefined;
|
|
175
175
|
continue?: boolean | undefined;
|
|
176
176
|
check?: boolean | undefined;
|
|
177
177
|
missing?: ({
|
|
@@ -207,8 +207,8 @@ declare const vercelOutputConfigSchema: z.ZodObject<{
|
|
|
207
207
|
value?: string | undefined;
|
|
208
208
|
})[] | undefined;
|
|
209
209
|
locale?: {
|
|
210
|
-
redirect?: Record<string, string> | undefined;
|
|
211
210
|
cookie?: string | undefined;
|
|
211
|
+
redirect?: Record<string, string> | undefined;
|
|
212
212
|
} | undefined;
|
|
213
213
|
middlewarePath?: string | undefined;
|
|
214
214
|
}>, z.ZodObject<{
|
|
@@ -217,15 +217,15 @@ declare const vercelOutputConfigSchema: z.ZodObject<{
|
|
|
217
217
|
dest: z.ZodOptional<z.ZodString>;
|
|
218
218
|
status: z.ZodOptional<z.ZodNumber>;
|
|
219
219
|
}, "strict", z.ZodTypeAny, {
|
|
220
|
-
handle: "
|
|
220
|
+
handle: "rewrite" | "filesystem" | "resource" | "miss" | "hit" | "error";
|
|
221
|
+
status?: number | undefined;
|
|
221
222
|
src?: string | undefined;
|
|
222
223
|
dest?: string | undefined;
|
|
223
|
-
status?: number | undefined;
|
|
224
224
|
}, {
|
|
225
|
-
handle: "
|
|
225
|
+
handle: "rewrite" | "filesystem" | "resource" | "miss" | "hit" | "error";
|
|
226
|
+
status?: number | undefined;
|
|
226
227
|
src?: string | undefined;
|
|
227
228
|
dest?: string | undefined;
|
|
228
|
-
status?: number | undefined;
|
|
229
229
|
}>]>, "many">>;
|
|
230
230
|
images: z.ZodOptional<z.ZodObject<{
|
|
231
231
|
sizes: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
@@ -274,10 +274,10 @@ declare const vercelOutputConfigSchema: z.ZodObject<{
|
|
|
274
274
|
version: 3;
|
|
275
275
|
routes?: ({
|
|
276
276
|
src: string;
|
|
277
|
+
status?: number | undefined;
|
|
277
278
|
dest?: string | undefined;
|
|
278
279
|
headers?: Record<string, string> | undefined;
|
|
279
280
|
methods?: string[] | undefined;
|
|
280
|
-
status?: number | undefined;
|
|
281
281
|
continue?: boolean | undefined;
|
|
282
282
|
check?: boolean | undefined;
|
|
283
283
|
missing?: ({
|
|
@@ -313,15 +313,15 @@ declare const vercelOutputConfigSchema: z.ZodObject<{
|
|
|
313
313
|
value?: string | undefined;
|
|
314
314
|
})[] | undefined;
|
|
315
315
|
locale?: {
|
|
316
|
-
redirect?: Record<string, string> | undefined;
|
|
317
316
|
cookie?: string | undefined;
|
|
317
|
+
redirect?: Record<string, string> | undefined;
|
|
318
318
|
} | undefined;
|
|
319
319
|
middlewarePath?: string | undefined;
|
|
320
320
|
} | {
|
|
321
|
-
handle: "
|
|
321
|
+
handle: "rewrite" | "filesystem" | "resource" | "miss" | "hit" | "error";
|
|
322
|
+
status?: number | undefined;
|
|
322
323
|
src?: string | undefined;
|
|
323
324
|
dest?: string | undefined;
|
|
324
|
-
status?: number | undefined;
|
|
325
325
|
})[] | undefined;
|
|
326
326
|
images?: {
|
|
327
327
|
sizes: [number, number];
|
|
@@ -344,10 +344,10 @@ declare const vercelOutputConfigSchema: z.ZodObject<{
|
|
|
344
344
|
version: 3;
|
|
345
345
|
routes?: ({
|
|
346
346
|
src: string;
|
|
347
|
+
status?: number | undefined;
|
|
347
348
|
dest?: string | undefined;
|
|
348
349
|
headers?: Record<string, string> | undefined;
|
|
349
350
|
methods?: string[] | undefined;
|
|
350
|
-
status?: number | undefined;
|
|
351
351
|
continue?: boolean | undefined;
|
|
352
352
|
check?: boolean | undefined;
|
|
353
353
|
missing?: ({
|
|
@@ -383,15 +383,15 @@ declare const vercelOutputConfigSchema: z.ZodObject<{
|
|
|
383
383
|
value?: string | undefined;
|
|
384
384
|
})[] | undefined;
|
|
385
385
|
locale?: {
|
|
386
|
-
redirect?: Record<string, string> | undefined;
|
|
387
386
|
cookie?: string | undefined;
|
|
387
|
+
redirect?: Record<string, string> | undefined;
|
|
388
388
|
} | undefined;
|
|
389
389
|
middlewarePath?: string | undefined;
|
|
390
390
|
} | {
|
|
391
|
-
handle: "
|
|
391
|
+
handle: "rewrite" | "filesystem" | "resource" | "miss" | "hit" | "error";
|
|
392
|
+
status?: number | undefined;
|
|
392
393
|
src?: string | undefined;
|
|
393
394
|
dest?: string | undefined;
|
|
394
|
-
status?: number | undefined;
|
|
395
395
|
})[] | undefined;
|
|
396
396
|
images?: {
|
|
397
397
|
sizes: [number, number];
|
|
@@ -414,8 +414,8 @@ declare const vercelOutputConfigSchema: z.ZodObject<{
|
|
|
414
414
|
type VercelOutputConfig = z.infer<typeof vercelOutputConfigSchema>;
|
|
415
415
|
|
|
416
416
|
/**
|
|
417
|
-
* Schema definition for `.vercel/output/config.json`
|
|
418
|
-
* @see {@link https://vercel.com/docs/build-output-api/v3#
|
|
417
|
+
* Schema definition for `.vercel/output/functions/<name>.func/.vc-config.json`
|
|
418
|
+
* @see {@link https://vercel.com/docs/build-output-api/v3/primitives#serverless-function-configuration}
|
|
419
419
|
*/
|
|
420
420
|
|
|
421
421
|
declare const vercelOutputVcConfigSchema: z.ZodUnion<[z.ZodObject<{
|
|
@@ -437,6 +437,8 @@ declare const vercelOutputVcConfigSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
437
437
|
maxDuration: z.ZodOptional<z.ZodNumber>;
|
|
438
438
|
environment: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
439
439
|
regions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
440
|
+
supportsWrapper: z.ZodOptional<z.ZodBoolean>;
|
|
441
|
+
supportsResponseStreaming: z.ZodOptional<z.ZodBoolean>;
|
|
440
442
|
}, "strict", z.ZodTypeAny, {
|
|
441
443
|
handler: string;
|
|
442
444
|
runtime: string;
|
|
@@ -444,6 +446,8 @@ declare const vercelOutputVcConfigSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
444
446
|
maxDuration?: number | undefined;
|
|
445
447
|
environment?: Record<string, string> | undefined;
|
|
446
448
|
regions?: string[] | undefined;
|
|
449
|
+
supportsWrapper?: boolean | undefined;
|
|
450
|
+
supportsResponseStreaming?: boolean | undefined;
|
|
447
451
|
}, {
|
|
448
452
|
handler: string;
|
|
449
453
|
runtime: string;
|
|
@@ -451,18 +455,23 @@ declare const vercelOutputVcConfigSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
451
455
|
maxDuration?: number | undefined;
|
|
452
456
|
environment?: Record<string, string> | undefined;
|
|
453
457
|
regions?: string[] | undefined;
|
|
454
|
-
|
|
455
|
-
|
|
458
|
+
supportsWrapper?: boolean | undefined;
|
|
459
|
+
supportsResponseStreaming?: boolean | undefined;
|
|
460
|
+
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
456
461
|
runtime: z.ZodString;
|
|
462
|
+
handler: z.ZodString;
|
|
457
463
|
memory: z.ZodOptional<z.ZodNumber>;
|
|
458
464
|
maxDuration: z.ZodOptional<z.ZodNumber>;
|
|
459
465
|
environment: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
460
466
|
regions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
467
|
+
supportsWrapper: z.ZodOptional<z.ZodBoolean>;
|
|
468
|
+
supportsResponseStreaming: z.ZodOptional<z.ZodBoolean>;
|
|
469
|
+
}, {
|
|
461
470
|
launcherType: z.ZodLiteral<"Nodejs">;
|
|
462
471
|
shouldAddHelpers: z.ZodOptional<z.ZodBoolean>;
|
|
463
472
|
shouldAddSourcemapSupport: z.ZodOptional<z.ZodBoolean>;
|
|
464
473
|
awsLambdaHandler: z.ZodOptional<z.ZodString>;
|
|
465
|
-
}
|
|
474
|
+
}>, "strict", z.ZodTypeAny, {
|
|
466
475
|
handler: string;
|
|
467
476
|
runtime: string;
|
|
468
477
|
launcherType: "Nodejs";
|
|
@@ -470,6 +479,8 @@ declare const vercelOutputVcConfigSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
470
479
|
maxDuration?: number | undefined;
|
|
471
480
|
environment?: Record<string, string> | undefined;
|
|
472
481
|
regions?: string[] | undefined;
|
|
482
|
+
supportsWrapper?: boolean | undefined;
|
|
483
|
+
supportsResponseStreaming?: boolean | undefined;
|
|
473
484
|
shouldAddHelpers?: boolean | undefined;
|
|
474
485
|
shouldAddSourcemapSupport?: boolean | undefined;
|
|
475
486
|
awsLambdaHandler?: string | undefined;
|
|
@@ -481,6 +492,8 @@ declare const vercelOutputVcConfigSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
481
492
|
maxDuration?: number | undefined;
|
|
482
493
|
environment?: Record<string, string> | undefined;
|
|
483
494
|
regions?: string[] | undefined;
|
|
495
|
+
supportsWrapper?: boolean | undefined;
|
|
496
|
+
supportsResponseStreaming?: boolean | undefined;
|
|
484
497
|
shouldAddHelpers?: boolean | undefined;
|
|
485
498
|
shouldAddSourcemapSupport?: boolean | undefined;
|
|
486
499
|
awsLambdaHandler?: string | undefined;
|
|
@@ -554,6 +567,11 @@ interface ViteVercelConfig {
|
|
|
554
567
|
* @see {@link https://vercel.com/docs/projects/project-configuration#trailingslash}
|
|
555
568
|
*/
|
|
556
569
|
trailingSlash?: boolean;
|
|
570
|
+
/**
|
|
571
|
+
* When true, the Serverless Function will stream the response to the client.
|
|
572
|
+
* @see {@link https://vercel.com/docs/build-output-api/v3/primitives#serverless-function-configuration}
|
|
573
|
+
*/
|
|
574
|
+
defaultSupportsResponseStreaming?: boolean;
|
|
557
575
|
/**
|
|
558
576
|
* By default, all `api/*` endpoints are compiled under `.vercel/output/functions/api/*.func`.
|
|
559
577
|
* If others serverless functions need to be compiled under `.vercel/output/functions`, they should be added here.
|
|
@@ -654,6 +672,10 @@ interface ViteVercelApiEntry {
|
|
|
654
672
|
* ISR config
|
|
655
673
|
*/
|
|
656
674
|
isr?: VercelOutputIsr;
|
|
675
|
+
/**
|
|
676
|
+
* When true, the Serverless Function will stream the response to the client
|
|
677
|
+
*/
|
|
678
|
+
streaming?: boolean;
|
|
657
679
|
}
|
|
658
680
|
|
|
659
681
|
declare function allPlugins(options?: {
|
package/dist/index.d.ts
CHANGED
|
@@ -114,19 +114,19 @@ declare const vercelOutputConfigSchema: z.ZodObject<{
|
|
|
114
114
|
redirect: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
115
115
|
cookie: z.ZodOptional<z.ZodString>;
|
|
116
116
|
}, "strict", z.ZodTypeAny, {
|
|
117
|
-
redirect?: Record<string, string> | undefined;
|
|
118
117
|
cookie?: string | undefined;
|
|
119
|
-
}, {
|
|
120
118
|
redirect?: Record<string, string> | undefined;
|
|
119
|
+
}, {
|
|
121
120
|
cookie?: string | undefined;
|
|
121
|
+
redirect?: Record<string, string> | undefined;
|
|
122
122
|
}>>;
|
|
123
123
|
middlewarePath: z.ZodOptional<z.ZodString>;
|
|
124
124
|
}, "strict", z.ZodTypeAny, {
|
|
125
125
|
src: string;
|
|
126
|
+
status?: number | undefined;
|
|
126
127
|
dest?: string | undefined;
|
|
127
128
|
headers?: Record<string, string> | undefined;
|
|
128
129
|
methods?: string[] | undefined;
|
|
129
|
-
status?: number | undefined;
|
|
130
130
|
continue?: boolean | undefined;
|
|
131
131
|
check?: boolean | undefined;
|
|
132
132
|
missing?: ({
|
|
@@ -162,16 +162,16 @@ declare const vercelOutputConfigSchema: z.ZodObject<{
|
|
|
162
162
|
value?: string | undefined;
|
|
163
163
|
})[] | undefined;
|
|
164
164
|
locale?: {
|
|
165
|
-
redirect?: Record<string, string> | undefined;
|
|
166
165
|
cookie?: string | undefined;
|
|
166
|
+
redirect?: Record<string, string> | undefined;
|
|
167
167
|
} | undefined;
|
|
168
168
|
middlewarePath?: string | undefined;
|
|
169
169
|
}, {
|
|
170
170
|
src: string;
|
|
171
|
+
status?: number | undefined;
|
|
171
172
|
dest?: string | undefined;
|
|
172
173
|
headers?: Record<string, string> | undefined;
|
|
173
174
|
methods?: string[] | undefined;
|
|
174
|
-
status?: number | undefined;
|
|
175
175
|
continue?: boolean | undefined;
|
|
176
176
|
check?: boolean | undefined;
|
|
177
177
|
missing?: ({
|
|
@@ -207,8 +207,8 @@ declare const vercelOutputConfigSchema: z.ZodObject<{
|
|
|
207
207
|
value?: string | undefined;
|
|
208
208
|
})[] | undefined;
|
|
209
209
|
locale?: {
|
|
210
|
-
redirect?: Record<string, string> | undefined;
|
|
211
210
|
cookie?: string | undefined;
|
|
211
|
+
redirect?: Record<string, string> | undefined;
|
|
212
212
|
} | undefined;
|
|
213
213
|
middlewarePath?: string | undefined;
|
|
214
214
|
}>, z.ZodObject<{
|
|
@@ -217,15 +217,15 @@ declare const vercelOutputConfigSchema: z.ZodObject<{
|
|
|
217
217
|
dest: z.ZodOptional<z.ZodString>;
|
|
218
218
|
status: z.ZodOptional<z.ZodNumber>;
|
|
219
219
|
}, "strict", z.ZodTypeAny, {
|
|
220
|
-
handle: "
|
|
220
|
+
handle: "rewrite" | "filesystem" | "resource" | "miss" | "hit" | "error";
|
|
221
|
+
status?: number | undefined;
|
|
221
222
|
src?: string | undefined;
|
|
222
223
|
dest?: string | undefined;
|
|
223
|
-
status?: number | undefined;
|
|
224
224
|
}, {
|
|
225
|
-
handle: "
|
|
225
|
+
handle: "rewrite" | "filesystem" | "resource" | "miss" | "hit" | "error";
|
|
226
|
+
status?: number | undefined;
|
|
226
227
|
src?: string | undefined;
|
|
227
228
|
dest?: string | undefined;
|
|
228
|
-
status?: number | undefined;
|
|
229
229
|
}>]>, "many">>;
|
|
230
230
|
images: z.ZodOptional<z.ZodObject<{
|
|
231
231
|
sizes: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
@@ -274,10 +274,10 @@ declare const vercelOutputConfigSchema: z.ZodObject<{
|
|
|
274
274
|
version: 3;
|
|
275
275
|
routes?: ({
|
|
276
276
|
src: string;
|
|
277
|
+
status?: number | undefined;
|
|
277
278
|
dest?: string | undefined;
|
|
278
279
|
headers?: Record<string, string> | undefined;
|
|
279
280
|
methods?: string[] | undefined;
|
|
280
|
-
status?: number | undefined;
|
|
281
281
|
continue?: boolean | undefined;
|
|
282
282
|
check?: boolean | undefined;
|
|
283
283
|
missing?: ({
|
|
@@ -313,15 +313,15 @@ declare const vercelOutputConfigSchema: z.ZodObject<{
|
|
|
313
313
|
value?: string | undefined;
|
|
314
314
|
})[] | undefined;
|
|
315
315
|
locale?: {
|
|
316
|
-
redirect?: Record<string, string> | undefined;
|
|
317
316
|
cookie?: string | undefined;
|
|
317
|
+
redirect?: Record<string, string> | undefined;
|
|
318
318
|
} | undefined;
|
|
319
319
|
middlewarePath?: string | undefined;
|
|
320
320
|
} | {
|
|
321
|
-
handle: "
|
|
321
|
+
handle: "rewrite" | "filesystem" | "resource" | "miss" | "hit" | "error";
|
|
322
|
+
status?: number | undefined;
|
|
322
323
|
src?: string | undefined;
|
|
323
324
|
dest?: string | undefined;
|
|
324
|
-
status?: number | undefined;
|
|
325
325
|
})[] | undefined;
|
|
326
326
|
images?: {
|
|
327
327
|
sizes: [number, number];
|
|
@@ -344,10 +344,10 @@ declare const vercelOutputConfigSchema: z.ZodObject<{
|
|
|
344
344
|
version: 3;
|
|
345
345
|
routes?: ({
|
|
346
346
|
src: string;
|
|
347
|
+
status?: number | undefined;
|
|
347
348
|
dest?: string | undefined;
|
|
348
349
|
headers?: Record<string, string> | undefined;
|
|
349
350
|
methods?: string[] | undefined;
|
|
350
|
-
status?: number | undefined;
|
|
351
351
|
continue?: boolean | undefined;
|
|
352
352
|
check?: boolean | undefined;
|
|
353
353
|
missing?: ({
|
|
@@ -383,15 +383,15 @@ declare const vercelOutputConfigSchema: z.ZodObject<{
|
|
|
383
383
|
value?: string | undefined;
|
|
384
384
|
})[] | undefined;
|
|
385
385
|
locale?: {
|
|
386
|
-
redirect?: Record<string, string> | undefined;
|
|
387
386
|
cookie?: string | undefined;
|
|
387
|
+
redirect?: Record<string, string> | undefined;
|
|
388
388
|
} | undefined;
|
|
389
389
|
middlewarePath?: string | undefined;
|
|
390
390
|
} | {
|
|
391
|
-
handle: "
|
|
391
|
+
handle: "rewrite" | "filesystem" | "resource" | "miss" | "hit" | "error";
|
|
392
|
+
status?: number | undefined;
|
|
392
393
|
src?: string | undefined;
|
|
393
394
|
dest?: string | undefined;
|
|
394
|
-
status?: number | undefined;
|
|
395
395
|
})[] | undefined;
|
|
396
396
|
images?: {
|
|
397
397
|
sizes: [number, number];
|
|
@@ -414,8 +414,8 @@ declare const vercelOutputConfigSchema: z.ZodObject<{
|
|
|
414
414
|
type VercelOutputConfig = z.infer<typeof vercelOutputConfigSchema>;
|
|
415
415
|
|
|
416
416
|
/**
|
|
417
|
-
* Schema definition for `.vercel/output/config.json`
|
|
418
|
-
* @see {@link https://vercel.com/docs/build-output-api/v3#
|
|
417
|
+
* Schema definition for `.vercel/output/functions/<name>.func/.vc-config.json`
|
|
418
|
+
* @see {@link https://vercel.com/docs/build-output-api/v3/primitives#serverless-function-configuration}
|
|
419
419
|
*/
|
|
420
420
|
|
|
421
421
|
declare const vercelOutputVcConfigSchema: z.ZodUnion<[z.ZodObject<{
|
|
@@ -437,6 +437,8 @@ declare const vercelOutputVcConfigSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
437
437
|
maxDuration: z.ZodOptional<z.ZodNumber>;
|
|
438
438
|
environment: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
439
439
|
regions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
440
|
+
supportsWrapper: z.ZodOptional<z.ZodBoolean>;
|
|
441
|
+
supportsResponseStreaming: z.ZodOptional<z.ZodBoolean>;
|
|
440
442
|
}, "strict", z.ZodTypeAny, {
|
|
441
443
|
handler: string;
|
|
442
444
|
runtime: string;
|
|
@@ -444,6 +446,8 @@ declare const vercelOutputVcConfigSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
444
446
|
maxDuration?: number | undefined;
|
|
445
447
|
environment?: Record<string, string> | undefined;
|
|
446
448
|
regions?: string[] | undefined;
|
|
449
|
+
supportsWrapper?: boolean | undefined;
|
|
450
|
+
supportsResponseStreaming?: boolean | undefined;
|
|
447
451
|
}, {
|
|
448
452
|
handler: string;
|
|
449
453
|
runtime: string;
|
|
@@ -451,18 +455,23 @@ declare const vercelOutputVcConfigSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
451
455
|
maxDuration?: number | undefined;
|
|
452
456
|
environment?: Record<string, string> | undefined;
|
|
453
457
|
regions?: string[] | undefined;
|
|
454
|
-
|
|
455
|
-
|
|
458
|
+
supportsWrapper?: boolean | undefined;
|
|
459
|
+
supportsResponseStreaming?: boolean | undefined;
|
|
460
|
+
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
456
461
|
runtime: z.ZodString;
|
|
462
|
+
handler: z.ZodString;
|
|
457
463
|
memory: z.ZodOptional<z.ZodNumber>;
|
|
458
464
|
maxDuration: z.ZodOptional<z.ZodNumber>;
|
|
459
465
|
environment: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
460
466
|
regions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
467
|
+
supportsWrapper: z.ZodOptional<z.ZodBoolean>;
|
|
468
|
+
supportsResponseStreaming: z.ZodOptional<z.ZodBoolean>;
|
|
469
|
+
}, {
|
|
461
470
|
launcherType: z.ZodLiteral<"Nodejs">;
|
|
462
471
|
shouldAddHelpers: z.ZodOptional<z.ZodBoolean>;
|
|
463
472
|
shouldAddSourcemapSupport: z.ZodOptional<z.ZodBoolean>;
|
|
464
473
|
awsLambdaHandler: z.ZodOptional<z.ZodString>;
|
|
465
|
-
}
|
|
474
|
+
}>, "strict", z.ZodTypeAny, {
|
|
466
475
|
handler: string;
|
|
467
476
|
runtime: string;
|
|
468
477
|
launcherType: "Nodejs";
|
|
@@ -470,6 +479,8 @@ declare const vercelOutputVcConfigSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
470
479
|
maxDuration?: number | undefined;
|
|
471
480
|
environment?: Record<string, string> | undefined;
|
|
472
481
|
regions?: string[] | undefined;
|
|
482
|
+
supportsWrapper?: boolean | undefined;
|
|
483
|
+
supportsResponseStreaming?: boolean | undefined;
|
|
473
484
|
shouldAddHelpers?: boolean | undefined;
|
|
474
485
|
shouldAddSourcemapSupport?: boolean | undefined;
|
|
475
486
|
awsLambdaHandler?: string | undefined;
|
|
@@ -481,6 +492,8 @@ declare const vercelOutputVcConfigSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
481
492
|
maxDuration?: number | undefined;
|
|
482
493
|
environment?: Record<string, string> | undefined;
|
|
483
494
|
regions?: string[] | undefined;
|
|
495
|
+
supportsWrapper?: boolean | undefined;
|
|
496
|
+
supportsResponseStreaming?: boolean | undefined;
|
|
484
497
|
shouldAddHelpers?: boolean | undefined;
|
|
485
498
|
shouldAddSourcemapSupport?: boolean | undefined;
|
|
486
499
|
awsLambdaHandler?: string | undefined;
|
|
@@ -554,6 +567,11 @@ interface ViteVercelConfig {
|
|
|
554
567
|
* @see {@link https://vercel.com/docs/projects/project-configuration#trailingslash}
|
|
555
568
|
*/
|
|
556
569
|
trailingSlash?: boolean;
|
|
570
|
+
/**
|
|
571
|
+
* When true, the Serverless Function will stream the response to the client.
|
|
572
|
+
* @see {@link https://vercel.com/docs/build-output-api/v3/primitives#serverless-function-configuration}
|
|
573
|
+
*/
|
|
574
|
+
defaultSupportsResponseStreaming?: boolean;
|
|
557
575
|
/**
|
|
558
576
|
* By default, all `api/*` endpoints are compiled under `.vercel/output/functions/api/*.func`.
|
|
559
577
|
* If others serverless functions need to be compiled under `.vercel/output/functions`, they should be added here.
|
|
@@ -654,6 +672,10 @@ interface ViteVercelApiEntry {
|
|
|
654
672
|
* ISR config
|
|
655
673
|
*/
|
|
656
674
|
isr?: VercelOutputIsr;
|
|
675
|
+
/**
|
|
676
|
+
* When true, the Serverless Function will stream the response to the client
|
|
677
|
+
*/
|
|
678
|
+
streaming?: boolean;
|
|
657
679
|
}
|
|
658
680
|
|
|
659
681
|
declare function allPlugins(options?: {
|
package/dist/index.js
CHANGED
|
@@ -232,7 +232,9 @@ var vercelOutputServerlessVcConfigSchema = z2.object({
|
|
|
232
232
|
memory: z2.number().int().min(128).max(3008).optional(),
|
|
233
233
|
maxDuration: z2.number().int().positive().optional(),
|
|
234
234
|
environment: z2.record(z2.string()).optional(),
|
|
235
|
-
regions: z2.array(z2.string()).optional()
|
|
235
|
+
regions: z2.array(z2.string()).optional(),
|
|
236
|
+
supportsWrapper: z2.boolean().optional(),
|
|
237
|
+
supportsResponseStreaming: z2.boolean().optional()
|
|
236
238
|
}).strict();
|
|
237
239
|
var vercelOutputServerlessNodeVcConfigSchema = vercelOutputServerlessVcConfigSchema.extend({
|
|
238
240
|
launcherType: z2.literal("Nodejs"),
|
|
@@ -255,6 +257,7 @@ import { z as z3 } from "zod";
|
|
|
255
257
|
var vercelEndpointExports = z3.object({
|
|
256
258
|
edge: z3.boolean().optional(),
|
|
257
259
|
headers: z3.record(z3.string()).optional(),
|
|
260
|
+
streaming: z3.boolean().optional(),
|
|
258
261
|
isr: z3.object({
|
|
259
262
|
expiration: z3.number().or(z3.literal(false))
|
|
260
263
|
}).optional()
|
|
@@ -325,7 +328,7 @@ var vercelOgPlugin = (ctx) => {
|
|
|
325
328
|
};
|
|
326
329
|
var standardBuildOptions = {
|
|
327
330
|
bundle: true,
|
|
328
|
-
target: "
|
|
331
|
+
target: "es2022",
|
|
329
332
|
format: "esm",
|
|
330
333
|
platform: "node",
|
|
331
334
|
logLevel: "info",
|
|
@@ -435,16 +438,14 @@ const __dirname = VPV_dirname(__filename);
|
|
|
435
438
|
}
|
|
436
439
|
}
|
|
437
440
|
}
|
|
438
|
-
await writeVcConfig(
|
|
439
|
-
|
|
440
|
-
entry.
|
|
441
|
-
|
|
442
|
-
filename
|
|
443
|
-
);
|
|
441
|
+
await writeVcConfig(resolvedConfig, entry.destination, filename, {
|
|
442
|
+
edge: Boolean(entry.edge),
|
|
443
|
+
streaming: entry.streaming
|
|
444
|
+
});
|
|
444
445
|
return output;
|
|
445
446
|
}
|
|
446
|
-
async function writeVcConfig(resolvedConfig, destination,
|
|
447
|
-
var _a;
|
|
447
|
+
async function writeVcConfig(resolvedConfig, destination, filename, options) {
|
|
448
|
+
var _a, _b;
|
|
448
449
|
const vcConfig = path3.join(
|
|
449
450
|
getOutput(resolvedConfig, "functions"),
|
|
450
451
|
destination,
|
|
@@ -455,7 +456,7 @@ async function writeVcConfig(resolvedConfig, destination, edge, filename) {
|
|
|
455
456
|
vcConfig,
|
|
456
457
|
JSON.stringify(
|
|
457
458
|
vercelOutputVcConfigSchema.parse(
|
|
458
|
-
edge ? {
|
|
459
|
+
options.edge ? {
|
|
459
460
|
runtime: "edge",
|
|
460
461
|
entrypoint: filename
|
|
461
462
|
} : {
|
|
@@ -463,7 +464,8 @@ async function writeVcConfig(resolvedConfig, destination, edge, filename) {
|
|
|
463
464
|
handler: filename,
|
|
464
465
|
maxDuration: (_a = resolvedConfig.vercel) == null ? void 0 : _a.defaultMaxDuration,
|
|
465
466
|
launcherType: "Nodejs",
|
|
466
|
-
shouldAddHelpers: true
|
|
467
|
+
shouldAddHelpers: true,
|
|
468
|
+
supportsResponseStreaming: options.streaming ?? ((_b = resolvedConfig.vercel) == null ? void 0 : _b.defaultSupportsResponseStreaming)
|
|
467
469
|
}
|
|
468
470
|
),
|
|
469
471
|
void 0,
|
|
@@ -547,6 +549,9 @@ async function buildEndpoints(resolvedConfig) {
|
|
|
547
549
|
if (exports.isr) {
|
|
548
550
|
entry.isr = exports.isr;
|
|
549
551
|
}
|
|
552
|
+
if (typeof exports.streaming === "boolean") {
|
|
553
|
+
entry.streaming = exports.streaming;
|
|
554
|
+
}
|
|
550
555
|
}
|
|
551
556
|
}
|
|
552
557
|
await buildFn(resolvedConfig, entry);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-vercel",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"vike": "*",
|
|
24
24
|
"vite": "^4.4 || ^5.0.2",
|
|
25
|
-
"@vite-plugin-vercel/vike": "
|
|
25
|
+
"@vite-plugin-vercel/vike": "6.0.1"
|
|
26
26
|
},
|
|
27
27
|
"peerDependenciesMeta": {
|
|
28
28
|
"@vite-plugin-vercel/vike": {
|
|
@@ -33,27 +33,27 @@
|
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@types/node": "^
|
|
37
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
38
|
-
"@typescript-eslint/parser": "^7.
|
|
36
|
+
"@types/node": "^18.19.31",
|
|
37
|
+
"@typescript-eslint/eslint-plugin": "^7.7.0",
|
|
38
|
+
"@typescript-eslint/parser": "^7.7.0",
|
|
39
39
|
"eslint": "^8.57.0",
|
|
40
40
|
"tsup": "^8.0.2",
|
|
41
|
-
"typescript": "^5.4.
|
|
42
|
-
"vike": "^0.4.
|
|
43
|
-
"vite": "^5.2.
|
|
44
|
-
"@vite-plugin-vercel/vike": "
|
|
41
|
+
"typescript": "^5.4.5",
|
|
42
|
+
"vike": "^0.4.171",
|
|
43
|
+
"vite": "^5.2.10",
|
|
44
|
+
"@vite-plugin-vercel/vike": "6.0.1"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@brillout/libassert": "^0.5.8",
|
|
48
48
|
"@manypkg/find-root": "^2.2.1",
|
|
49
|
-
"@vercel/build-utils": "^7.
|
|
49
|
+
"@vercel/build-utils": "^7.12.0",
|
|
50
50
|
"@vercel/nft": "^0.26.4",
|
|
51
51
|
"@vercel/routing-utils": "^3.1.0",
|
|
52
52
|
"esbuild": "^0.20.2",
|
|
53
53
|
"eval": "^0.1.8",
|
|
54
54
|
"fast-glob": "^3.3.2",
|
|
55
|
-
"magicast": "^0.3.
|
|
56
|
-
"zod": "^3.
|
|
55
|
+
"magicast": "^0.3.4",
|
|
56
|
+
"zod": "^3.23.0"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"build": "tsup",
|