Socket
Socket
Sign inDemoInstall

@sveltejs/adapter-vercel

Package Overview
Dependencies
Maintainers
4
Versions
137
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sveltejs/adapter-vercel - npm Package Compare versions

Comparing version 5.1.1 to 5.2.0

1

files/edge.js

@@ -15,2 +15,3 @@ import { Server } from 'SERVER';

await initialized;
return server.respond(request, {

@@ -17,0 +18,0 @@ getClientAddress() {

92

index.js

@@ -7,2 +7,3 @@ import fs from 'node:fs';

import { get_pathname, pattern_to_src } from './utils.js';
import { VERSION } from '@sveltejs/kit';

@@ -61,4 +62,9 @@ const name = '@sveltejs/adapter-vercel';

const static_config = static_vercel_config(builder, defaults);
builder.log.minor('Copying assets...');
builder.writeClient(dirs.static);
builder.writePrerendered(dirs.static);
const static_config = static_vercel_config(builder, defaults, dirs.static);
builder.log.minor('Generating serverless function...');

@@ -179,3 +185,7 @@

regions: config.regions,
entrypoint: 'index.js'
entrypoint: 'index.js',
framework: {
slug: 'sveltekit',
version: VERSION
}
},

@@ -369,7 +379,2 @@ null,

builder.log.minor('Copying assets...');
builder.writeClient(dirs.static);
builder.writePrerendered(dirs.static);
builder.log.minor('Writing routes...');

@@ -427,4 +432,5 @@

* @param {import('.').Config} config
* @param {string} dir
*/
function static_vercel_config(builder, config) {
function static_vercel_config(builder, config, dir) {
/** @type {any[]} */

@@ -470,16 +476,56 @@ const prerendered_redirects = [];

const routes = [
...prerendered_redirects,
{
src: `/${builder.getAppPath()}/immutable/.+`,
headers: {
'cache-control': 'public, immutable, max-age=31536000'
}
}
];
// https://vercel.com/docs/deployments/skew-protection
if (process.env.VERCEL_SKEW_PROTECTION_ENABLED) {
routes.push({
src: '/.*',
has: [
{
type: 'header',
key: 'Sec-Fetch-Dest',
value: 'document'
}
],
headers: {
'Set-Cookie': `__vdpl=${process.env.VERCEL_DEPLOYMENT_ID}; Path=${builder.config.kit.paths.base}/; SameSite=Strict; Secure; HttpOnly`
},
continue: true
});
// this is a dreadful hack that is necessary until the Vercel Build Output API
// allows you to set multiple cookies for a single route. essentially, since we
// know that the entry file will be requested immediately, we can set the second
// cookie in _that_ response rather than the document response
const base = `${dir}/${builder.config.kit.appDir}/immutable/entry`;
const entry = fs.readdirSync(base).find((file) => file.startsWith('start.'));
if (!entry) {
throw new Error('Could not find entry point');
}
routes.splice(-2, 0, {
src: `/${builder.getAppPath()}/immutable/entry/${entry}`,
headers: {
'Set-Cookie': `__vdpl=; Path=/${builder.getAppPath()}/version.json; SameSite=Strict; Secure; HttpOnly`
},
continue: true
});
}
routes.push({
handle: 'filesystem'
});
return {
version: 3,
routes: [
...prerendered_redirects,
{
src: `/${builder.getAppPath()}/immutable/.+`,
headers: {
'cache-control': 'public, immutable, max-age=31536000'
}
},
{
handle: 'filesystem'
}
],
routes,
overrides,

@@ -597,3 +643,7 @@ images

launcherType: 'Nodejs',
experimentalResponseStreaming: !config.isr
experimentalResponseStreaming: !config.isr,
framework: {
slug: 'sveltekit',
version: VERSION
}
},

@@ -600,0 +650,0 @@ null,

{
"name": "@sveltejs/adapter-vercel",
"version": "5.1.1",
"version": "5.2.0",
"description": "A SvelteKit adapter that creates a Vercel app",

@@ -36,3 +36,3 @@ "repository": {

"vitest": "^1.2.0",
"@sveltejs/kit": "^2.5.3"
"@sveltejs/kit": "^2.5.4"
},

@@ -39,0 +39,0 @@ "peerDependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc