@sveltejs/adapter-vercel 6.3.1 → 6.3.3
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 +25 -1
- package/package.json +3 -3
- package/utils.js +4 -6
package/index.js
CHANGED
|
@@ -231,7 +231,8 @@ const plugin = function (defaults = {}) {
|
|
|
231
231
|
throw new Error(
|
|
232
232
|
`Bundling with esbuild failed with ${error.errors.length} ${
|
|
233
233
|
error.errors.length === 1 ? 'error' : 'errors'
|
|
234
|
-
}
|
|
234
|
+
}`,
|
|
235
|
+
{ cause: err }
|
|
235
236
|
);
|
|
236
237
|
}
|
|
237
238
|
|
|
@@ -616,6 +617,19 @@ function static_vercel_config(builder, config, dir) {
|
|
|
616
617
|
}
|
|
617
618
|
|
|
618
619
|
const routes = [
|
|
620
|
+
// Strip any user-supplied __pathname query parameter; SvelteKit reserves
|
|
621
|
+
// this for ISR handlers
|
|
622
|
+
{
|
|
623
|
+
src: '.*',
|
|
624
|
+
continue: true,
|
|
625
|
+
transforms: [
|
|
626
|
+
{
|
|
627
|
+
type: 'request.query',
|
|
628
|
+
op: 'delete',
|
|
629
|
+
target: { key: '__pathname' }
|
|
630
|
+
}
|
|
631
|
+
]
|
|
632
|
+
},
|
|
619
633
|
...prerendered_redirects,
|
|
620
634
|
{
|
|
621
635
|
src: `/${builder.getAppPath()}/immutable/.+`,
|
|
@@ -666,6 +680,16 @@ function static_vercel_config(builder, config, dir) {
|
|
|
666
680
|
handle: 'filesystem'
|
|
667
681
|
});
|
|
668
682
|
|
|
683
|
+
// Prevent incorrect caching: if a request to /_app/immutable/* doesn't match
|
|
684
|
+
// a static file, return 404 instead of falling through to dynamic routes.
|
|
685
|
+
// Otherwise, we could accidentally immutably cache dynamic content served
|
|
686
|
+
// by the fallback function.
|
|
687
|
+
routes.push({
|
|
688
|
+
src: `/${builder.getAppPath()}/immutable/.+`,
|
|
689
|
+
status: 404,
|
|
690
|
+
continue: false
|
|
691
|
+
});
|
|
692
|
+
|
|
669
693
|
return {
|
|
670
694
|
version: 3,
|
|
671
695
|
routes,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltejs/adapter-vercel",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.3",
|
|
4
4
|
"description": "A SvelteKit adapter that creates a Vercel app",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"adapter",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"ambient.d.ts"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@vercel/nft": "^1.
|
|
37
|
+
"@vercel/nft": "^1.3.2",
|
|
38
38
|
"esbuild": "^0.25.4"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
@@ -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.
|
|
45
|
+
"@sveltejs/kit": "^2.53.1"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"@sveltejs/kit": "^2.4.0"
|
package/utils.js
CHANGED
|
@@ -11,7 +11,6 @@ export function get_pathname(route) {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
const parts = segment.content.split(/\[(.+?)\](?!\])/);
|
|
14
|
-
let result = '';
|
|
15
14
|
|
|
16
15
|
if (
|
|
17
16
|
parts.length === 3 &&
|
|
@@ -21,9 +20,9 @@ export function get_pathname(route) {
|
|
|
21
20
|
) {
|
|
22
21
|
// Special case: segment is a single optional or rest parameter.
|
|
23
22
|
// In that case we don't prepend a slash (also see comment in pattern_to_src).
|
|
24
|
-
|
|
23
|
+
return `$${i++}`;
|
|
25
24
|
} else {
|
|
26
|
-
|
|
25
|
+
return (
|
|
27
26
|
'/' +
|
|
28
27
|
parts
|
|
29
28
|
.map((content, j) => {
|
|
@@ -33,10 +32,9 @@ export function get_pathname(route) {
|
|
|
33
32
|
return content;
|
|
34
33
|
}
|
|
35
34
|
})
|
|
36
|
-
.join('')
|
|
35
|
+
.join('')
|
|
36
|
+
);
|
|
37
37
|
}
|
|
38
|
-
|
|
39
|
-
return result;
|
|
40
38
|
})
|
|
41
39
|
.join('');
|
|
42
40
|
|