@sveltejs/adapter-vercel 6.1.2 → 6.3.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/ambient.d.ts CHANGED
@@ -1,10 +1,12 @@
1
- import { RequestContext } from './index.js';
1
+ import type { RequestContext } from './index.js';
2
2
 
3
3
  declare global {
4
4
  namespace App {
5
5
  export interface Platform {
6
6
  /**
7
7
  * `context` is only available in Edge Functions
8
+ *
9
+ * @deprecated Vercel's context is deprecated. Use [`@vercel/functions`](https://vercel.com/docs/functions/functions-api-reference/vercel-functions-package) instead.
8
10
  */
9
11
  context?: RequestContext;
10
12
  }
package/index.d.ts CHANGED
@@ -6,7 +6,7 @@ export default function plugin(config?: Config): Adapter;
6
6
 
7
7
  export interface ServerlessConfig {
8
8
  /**
9
- * 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
+ * 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) (`'nodejs22.x'`, `'nodejs24.x'` etc).
10
10
  * @default Same as the build environment
11
11
  */
12
12
  runtime?: Exclude<RuntimeConfigKey, 'edge'>;
@@ -78,7 +78,7 @@ type ImagesConfig = {
78
78
  /** @deprecated */
79
79
  export interface EdgeConfig {
80
80
  /**
81
- * 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).
81
+ * 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) (`'nodejs22.x'`, `'nodejs24.x'` etc).
82
82
  */
83
83
  runtime?: 'edge';
84
84
  /**
@@ -110,6 +110,8 @@ export type Config = (EdgeConfig | ServerlessConfig) & {
110
110
  /**
111
111
  * An extension to the standard `Request` object that is passed to every Edge Function.
112
112
  *
113
+ * @deprecated - use [`@vercel/functions`](https://vercel.com/docs/functions/functions-api-reference/vercel-functions-package) instead.
114
+ *
113
115
  * @example
114
116
  * ```ts
115
117
  * import type { RequestContext } from '@vercel/edge';
package/index.js CHANGED
@@ -285,7 +285,7 @@ const plugin = function (defaults = {}) {
285
285
 
286
286
  if (runtime === 'edge') {
287
287
  throw new Error(
288
- `${directory}: Routes using \`isr\` must use a Node.js or Bun runtime (for example 'nodejs22.x' or 'experimental_bun1.x')`
288
+ `${directory}: Routes using \`isr\` must use a Node.js or Bun runtime (for example 'nodejs24.x' or 'experimental_bun1.x')`
289
289
  );
290
290
  }
291
291
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltejs/adapter-vercel",
3
- "version": "6.1.2",
3
+ "version": "6.3.0",
4
4
  "description": "A SvelteKit adapter that creates a Vercel app",
5
5
  "keywords": [
6
6
  "adapter",
@@ -41,8 +41,8 @@
41
41
  "@sveltejs/vite-plugin-svelte": "^6.0.0-next.3",
42
42
  "@types/node": "^18.19.119",
43
43
  "typescript": "^5.3.3",
44
- "vitest": "^3.2.4",
45
- "@sveltejs/kit": "^2.48.7"
44
+ "vitest": "^4.0.0",
45
+ "@sveltejs/kit": "^2.49.3"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "@sveltejs/kit": "^2.4.0"
package/utils.js CHANGED
@@ -120,6 +120,9 @@ export function resolve_runtime(default_key, override_key) {
120
120
  return key;
121
121
  }
122
122
 
123
+ const valid_node_versions = [20, 22, 24];
124
+ const formatter = new Intl.ListFormat('en', { type: 'disjunction' });
125
+
123
126
  /** @returns {RuntimeKey} */
124
127
  function get_default_runtime() {
125
128
  // TODO may someday need to auto-detect Bun, but this will be complicated because you may want to run your build
@@ -127,16 +130,22 @@ function get_default_runtime() {
127
130
  // to tell us what the bun configuration is.
128
131
  const major = Number(process.version.slice(1).split('.')[0]);
129
132
 
130
- if (major !== 20 && major !== 22) {
133
+ if (!valid_node_versions.includes(major)) {
131
134
  throw new Error(
132
- `Unsupported Node.js version: ${process.version}. Please use Node 20 or 22 to build your project, or explicitly specify a runtime in your adapter configuration.`
135
+ `Unsupported Node.js version: ${process.version}. Please use Node ${formatter.format(valid_node_versions.map((v) => `${v}`))} to build your project, or explicitly specify a runtime in your adapter configuration.`
133
136
  );
134
137
  }
135
138
 
136
- return `nodejs${major}.x`;
139
+ return `nodejs${/** @type {20 | 22 | 24} */ (major)}.x`;
137
140
  }
138
141
 
139
- const valid_runtimes = /** @type {const} */ (['nodejs20.x', 'nodejs22.x', 'bun1.x', 'edge']);
142
+ const valid_runtimes = /** @type {const} */ ([
143
+ 'nodejs20.x',
144
+ 'nodejs22.x',
145
+ 'nodejs24.x',
146
+ 'bun1.x',
147
+ 'edge'
148
+ ]);
140
149
 
141
150
  /**
142
151
  * @param {string} key