@sveltejs/adapter-vercel 6.3.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.
Files changed (2) hide show
  1. package/index.js +25 -0
  2. package/package.json +2 -2
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.0",
3
+ "version": "6.3.1",
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": "^4.0.0",
45
- "@sveltejs/kit": "^2.49.3"
45
+ "@sveltejs/kit": "^2.50.1"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "@sveltejs/kit": "^2.4.0"