@sveltejs/adapter-vercel 1.0.0-next.41 → 1.0.0-next.42
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/index.js +78 -0
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -5,6 +5,83 @@ import esbuild from 'esbuild';
|
|
|
5
5
|
|
|
6
6
|
const dir = '.vercel_build_output';
|
|
7
7
|
|
|
8
|
+
// rules for clean URLs and trailing slash handling,
|
|
9
|
+
// generated with @vercel/routing-utils
|
|
10
|
+
const redirects = {
|
|
11
|
+
always: [
|
|
12
|
+
{
|
|
13
|
+
src: '^/(?:(.+)/)?index(?:\\.html)?/?$',
|
|
14
|
+
headers: {
|
|
15
|
+
Location: '/$1/'
|
|
16
|
+
},
|
|
17
|
+
status: 308
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
src: '^/(.*)\\.html/?$',
|
|
21
|
+
headers: {
|
|
22
|
+
Location: '/$1/'
|
|
23
|
+
},
|
|
24
|
+
status: 308
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
src: '^/\\.well-known(?:/.*)?$'
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
src: '^/((?:[^/]+/)*[^/\\.]+)$',
|
|
31
|
+
headers: {
|
|
32
|
+
Location: '/$1/'
|
|
33
|
+
},
|
|
34
|
+
status: 308
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
src: '^/((?:[^/]+/)*[^/]+\\.\\w+)/$',
|
|
38
|
+
headers: {
|
|
39
|
+
Location: '/$1'
|
|
40
|
+
},
|
|
41
|
+
status: 308
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
never: [
|
|
45
|
+
{
|
|
46
|
+
src: '^/(?:(.+)/)?index(?:\\.html)?/?$',
|
|
47
|
+
headers: {
|
|
48
|
+
Location: '/$1'
|
|
49
|
+
},
|
|
50
|
+
status: 308
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
src: '^/(.*)\\.html/?$',
|
|
54
|
+
headers: {
|
|
55
|
+
Location: '/$1'
|
|
56
|
+
},
|
|
57
|
+
status: 308
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
src: '^/(.*)/$',
|
|
61
|
+
headers: {
|
|
62
|
+
Location: '/$1'
|
|
63
|
+
},
|
|
64
|
+
status: 308
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
ignore: [
|
|
68
|
+
{
|
|
69
|
+
src: '^/(?:(.+)/)?index(?:\\.html)?/?$',
|
|
70
|
+
headers: {
|
|
71
|
+
Location: '/$1'
|
|
72
|
+
},
|
|
73
|
+
status: 308
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
src: '^/(.*)\\.html/?$',
|
|
77
|
+
headers: {
|
|
78
|
+
Location: '/$1'
|
|
79
|
+
},
|
|
80
|
+
status: 308
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
};
|
|
84
|
+
|
|
8
85
|
/** @type {import('.')} **/
|
|
9
86
|
export default function ({ external = [] } = {}) {
|
|
10
87
|
return {
|
|
@@ -69,6 +146,7 @@ export default function ({ external = [] } = {}) {
|
|
|
69
146
|
writeFileSync(
|
|
70
147
|
`${dir}/config/routes.json`,
|
|
71
148
|
JSON.stringify([
|
|
149
|
+
...redirects[builder.trailingSlash],
|
|
72
150
|
{
|
|
73
151
|
src: `/${builder.appDir}/.+`,
|
|
74
152
|
headers: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltejs/adapter-vercel",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.42",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/sveltejs/kit",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"esbuild": "^0.14.21"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@sveltejs/kit": "1.0.0-next.
|
|
28
|
+
"@sveltejs/kit": "1.0.0-next.265"
|
|
29
29
|
},
|
|
30
30
|
"scripts": {
|
|
31
31
|
"lint": "eslint --ignore-path .gitignore \"**/*.{ts,js,svelte}\" && npm run check-format",
|