@sveltejs/adapter-vercel 6.2.0 → 6.3.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/ambient.d.ts +3 -1
- package/index.d.ts +2 -0
- package/index.js +25 -0
- package/package.json +3 -3
- package/utils.js +2 -1
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
|
@@ -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
|
@@ -379,6 +379,31 @@ const plugin = function (defaults = {}) {
|
|
|
379
379
|
);
|
|
380
380
|
}
|
|
381
381
|
|
|
382
|
+
if (builder.config.kit.experimental.remoteFunctions) {
|
|
383
|
+
// Ensure remote functions are always handled by the catchall route, which will be symlinked to /_app/remote.
|
|
384
|
+
// This stops them from being affected by ISR config from other routes that match /[...rest] (ref: #15085)
|
|
385
|
+
// and also makes them show as handled by `/_app/remote` in Vercel's observability.
|
|
386
|
+
|
|
387
|
+
const app_path = builder.getAppPath();
|
|
388
|
+
const remote_dir = path.join(dirs.functions, app_path, 'remote'); // Usually .vercel/output/functions/_app/remote
|
|
389
|
+
const remote_symlink_path = `${remote_dir}.func`;
|
|
390
|
+
|
|
391
|
+
// Handle remote functions with the catchall route as it won't have any ISR settings
|
|
392
|
+
const target = path.join(dirs.functions, INTERNAL, 'catchall.func');
|
|
393
|
+
|
|
394
|
+
// Ensure the parent directory exists before symlinking
|
|
395
|
+
builder.mkdirp(path.join(dirs.functions, app_path));
|
|
396
|
+
|
|
397
|
+
const relative = path.relative(path.dirname(remote_symlink_path), target);
|
|
398
|
+
|
|
399
|
+
fs.symlinkSync(relative, remote_symlink_path);
|
|
400
|
+
|
|
401
|
+
static_config.routes.push({
|
|
402
|
+
src: `/${app_path}/remote/.+`,
|
|
403
|
+
dest: `/${app_path}/remote` // Maps to /![-]/catchall via the symlink
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
|
|
382
407
|
for (const route of builder.routes) {
|
|
383
408
|
if (is_prerendered(route)) continue;
|
|
384
409
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltejs/adapter-vercel",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.3.1",
|
|
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": "^
|
|
45
|
-
"@sveltejs/kit": "^2.
|
|
44
|
+
"vitest": "^4.0.0",
|
|
45
|
+
"@sveltejs/kit": "^2.50.1"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"@sveltejs/kit": "^2.4.0"
|
package/utils.js
CHANGED
|
@@ -121,6 +121,7 @@ export function resolve_runtime(default_key, override_key) {
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
const valid_node_versions = [20, 22, 24];
|
|
124
|
+
const formatter = new Intl.ListFormat('en', { type: 'disjunction' });
|
|
124
125
|
|
|
125
126
|
/** @returns {RuntimeKey} */
|
|
126
127
|
function get_default_runtime() {
|
|
@@ -131,7 +132,7 @@ function get_default_runtime() {
|
|
|
131
132
|
|
|
132
133
|
if (!valid_node_versions.includes(major)) {
|
|
133
134
|
throw new Error(
|
|
134
|
-
`Unsupported Node.js version: ${process.version}. Please use Node ${
|
|
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.`
|
|
135
136
|
);
|
|
136
137
|
}
|
|
137
138
|
|