@sveltejs/adapter-vercel
Advanced tools
Comparing version 1.0.0-next.41 to 1.0.0-next.42
78
index.js
@@ -8,2 +8,79 @@ import { writeFileSync } from 'fs'; | ||
// rules for clean URLs and trailing slash handling, | ||
// generated with @vercel/routing-utils | ||
const redirects = { | ||
always: [ | ||
{ | ||
src: '^/(?:(.+)/)?index(?:\\.html)?/?$', | ||
headers: { | ||
Location: '/$1/' | ||
}, | ||
status: 308 | ||
}, | ||
{ | ||
src: '^/(.*)\\.html/?$', | ||
headers: { | ||
Location: '/$1/' | ||
}, | ||
status: 308 | ||
}, | ||
{ | ||
src: '^/\\.well-known(?:/.*)?$' | ||
}, | ||
{ | ||
src: '^/((?:[^/]+/)*[^/\\.]+)$', | ||
headers: { | ||
Location: '/$1/' | ||
}, | ||
status: 308 | ||
}, | ||
{ | ||
src: '^/((?:[^/]+/)*[^/]+\\.\\w+)/$', | ||
headers: { | ||
Location: '/$1' | ||
}, | ||
status: 308 | ||
} | ||
], | ||
never: [ | ||
{ | ||
src: '^/(?:(.+)/)?index(?:\\.html)?/?$', | ||
headers: { | ||
Location: '/$1' | ||
}, | ||
status: 308 | ||
}, | ||
{ | ||
src: '^/(.*)\\.html/?$', | ||
headers: { | ||
Location: '/$1' | ||
}, | ||
status: 308 | ||
}, | ||
{ | ||
src: '^/(.*)/$', | ||
headers: { | ||
Location: '/$1' | ||
}, | ||
status: 308 | ||
} | ||
], | ||
ignore: [ | ||
{ | ||
src: '^/(?:(.+)/)?index(?:\\.html)?/?$', | ||
headers: { | ||
Location: '/$1' | ||
}, | ||
status: 308 | ||
}, | ||
{ | ||
src: '^/(.*)\\.html/?$', | ||
headers: { | ||
Location: '/$1' | ||
}, | ||
status: 308 | ||
} | ||
] | ||
}; | ||
/** @type {import('.')} **/ | ||
@@ -73,2 +150,3 @@ export default function ({ external = [] } = {}) { | ||
JSON.stringify([ | ||
...redirects[builder.trailingSlash], | ||
{ | ||
@@ -75,0 +153,0 @@ src: `/${builder.appDir}/.+`, |
{ | ||
"name": "@sveltejs/adapter-vercel", | ||
"version": "1.0.0-next.41", | ||
"version": "1.0.0-next.42", | ||
"repository": { | ||
@@ -28,3 +28,3 @@ "type": "git", | ||
"devDependencies": { | ||
"@sveltejs/kit": "1.0.0-next.262" | ||
"@sveltejs/kit": "1.0.0-next.265" | ||
}, | ||
@@ -31,0 +31,0 @@ "scripts": { |
6886
182