@sveltejs/adapter-vercel 6.0.0 → 6.1.0
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/index.d.ts +1 -2
- package/index.js +15 -6
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -7,9 +7,8 @@ export interface ServerlessConfig {
|
|
|
7
7
|
/**
|
|
8
8
|
* Whether to use [Edge Functions](https://vercel.com/docs/concepts/functions/edge-functions) (`'edge'`) or [Serverless Functions](https://vercel.com/docs/concepts/functions/serverless-functions) (`'nodejs18.x'`, `'nodejs20.x'` etc).
|
|
9
9
|
* @default Same as the build environment
|
|
10
|
-
* @deprecated
|
|
11
10
|
*/
|
|
12
|
-
runtime?: `nodejs${number}.x`;
|
|
11
|
+
runtime?: `nodejs${number}.x` | `experimental_bun1.x`;
|
|
13
12
|
/**
|
|
14
13
|
* To which regions to deploy the app. A list of regions.
|
|
15
14
|
* More info: https://vercel.com/docs/concepts/edge-network/regions
|
package/index.js
CHANGED
|
@@ -294,7 +294,11 @@ const plugin = function (defaults = {}) {
|
|
|
294
294
|
|
|
295
295
|
// group routes by config
|
|
296
296
|
for (const route of builder.routes) {
|
|
297
|
-
const runtime =
|
|
297
|
+
const runtime = (
|
|
298
|
+
route.config?.runtime ??
|
|
299
|
+
defaults?.runtime ??
|
|
300
|
+
get_default_runtime()
|
|
301
|
+
).replace('experimental_', '');
|
|
298
302
|
const config = { runtime, ...defaults, ...route.config };
|
|
299
303
|
|
|
300
304
|
if (is_prerendered(route)) {
|
|
@@ -305,9 +309,14 @@ const plugin = function (defaults = {}) {
|
|
|
305
309
|
}
|
|
306
310
|
|
|
307
311
|
const node_runtime = /nodejs([0-9]+)\.x/.exec(runtime);
|
|
308
|
-
|
|
312
|
+
const bun_runtime = /^bun/.exec(runtime);
|
|
313
|
+
if (
|
|
314
|
+
runtime !== 'edge' &&
|
|
315
|
+
!bun_runtime &&
|
|
316
|
+
(!node_runtime || parseInt(node_runtime[1]) < 20)
|
|
317
|
+
) {
|
|
309
318
|
throw new Error(
|
|
310
|
-
`Invalid runtime '${runtime}' for route ${route.id}. Valid runtimes are 'edge'
|
|
319
|
+
`Invalid runtime '${runtime}' for route ${route.id}. Valid runtimes are 'edge', 'experimental_bun1.x', 'nodejs20.x' or 'nodejs22.x' ` +
|
|
311
320
|
'(see the Node.js Version section in your Vercel project settings for info on the currently supported versions).'
|
|
312
321
|
);
|
|
313
322
|
}
|
|
@@ -315,9 +324,9 @@ const plugin = function (defaults = {}) {
|
|
|
315
324
|
if (config.isr) {
|
|
316
325
|
const directory = path.relative('.', builder.config.kit.files.routes + route.id);
|
|
317
326
|
|
|
318
|
-
if (!runtime.startsWith('nodejs')) {
|
|
327
|
+
if (!runtime.startsWith('nodejs') && !bun_runtime) {
|
|
319
328
|
throw new Error(
|
|
320
|
-
`${directory}: Routes using \`isr\` must use a Node.js runtime (for example '
|
|
329
|
+
`${directory}: Routes using \`isr\` must use a Node.js or Bun runtime (for example 'nodejs22.x' or 'experimental_bun1.x')`
|
|
321
330
|
);
|
|
322
331
|
}
|
|
323
332
|
|
|
@@ -400,7 +409,7 @@ const plugin = function (defaults = {}) {
|
|
|
400
409
|
// we need to create a catch-all route so that 404s are handled
|
|
401
410
|
// by SvelteKit rather than Vercel
|
|
402
411
|
|
|
403
|
-
const runtime = defaults.runtime ?? get_default_runtime();
|
|
412
|
+
const runtime = (defaults.runtime ?? get_default_runtime()).replace('experimental_', '');
|
|
404
413
|
const generate_function =
|
|
405
414
|
runtime === 'edge' ? generate_edge_function : generate_serverless_function;
|
|
406
415
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltejs/adapter-vercel",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.1.0",
|
|
4
4
|
"description": "A SvelteKit adapter that creates a Vercel app",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"adapter",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@types/node": "^18.19.119",
|
|
43
43
|
"typescript": "^5.3.3",
|
|
44
44
|
"vitest": "^3.2.4",
|
|
45
|
-
"@sveltejs/kit": "^2.
|
|
45
|
+
"@sveltejs/kit": "^2.48.1"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"@sveltejs/kit": "^2.4.0"
|