@sveltejs/adapter-vercel 1.0.0-next.35 → 1.0.0-next.39
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/files/ambient.d.ts +9 -0
- package/files/entry.js +9 -19
- package/files/shims.js +2 -0
- package/index.js +6 -0
- package/package.json +2 -2
package/files/entry.js
CHANGED
|
@@ -1,33 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import './shims';
|
|
2
|
+
import { getRequest, setResponse } from '@sveltejs/kit/node';
|
|
3
3
|
import { App } from 'APP';
|
|
4
4
|
import { manifest } from 'MANIFEST';
|
|
5
5
|
|
|
6
|
-
__fetch_polyfill();
|
|
7
|
-
|
|
8
6
|
const app = new App(manifest);
|
|
9
7
|
|
|
8
|
+
/**
|
|
9
|
+
* @param {import('http').IncomingMessage} req
|
|
10
|
+
* @param {import('http').ServerResponse} res
|
|
11
|
+
*/
|
|
10
12
|
export default async (req, res) => {
|
|
11
|
-
let
|
|
13
|
+
let request;
|
|
12
14
|
|
|
13
15
|
try {
|
|
14
|
-
|
|
16
|
+
request = await getRequest(`https://${req.headers.host}`, req);
|
|
15
17
|
} catch (err) {
|
|
16
18
|
res.statusCode = err.status || 400;
|
|
17
19
|
return res.end(err.reason || 'Invalid request body');
|
|
18
20
|
}
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
url: req.url,
|
|
22
|
-
method: req.method,
|
|
23
|
-
headers: req.headers,
|
|
24
|
-
rawBody: body
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
if (rendered) {
|
|
28
|
-
const { status, headers, body } = rendered;
|
|
29
|
-
return res.writeHead(status, headers).end(body);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return res.writeHead(404).end();
|
|
22
|
+
setResponse(res, await app.render(request));
|
|
33
23
|
};
|
package/files/shims.js
ADDED
package/index.js
CHANGED
|
@@ -68,6 +68,12 @@ export default function () {
|
|
|
68
68
|
writeFileSync(
|
|
69
69
|
`${dir}/config/routes.json`,
|
|
70
70
|
JSON.stringify([
|
|
71
|
+
{
|
|
72
|
+
src: `/${builder.appDir}/.+`,
|
|
73
|
+
headers: {
|
|
74
|
+
'cache-control': 'public, immutable, max-age=31536000'
|
|
75
|
+
}
|
|
76
|
+
},
|
|
71
77
|
{
|
|
72
78
|
handle: 'filesystem'
|
|
73
79
|
},
|
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.39",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/sveltejs/kit",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"esbuild": "^0.13.15"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@sveltejs/kit": "1.0.0-next.
|
|
28
|
+
"@sveltejs/kit": "1.0.0-next.234"
|
|
29
29
|
},
|
|
30
30
|
"scripts": {
|
|
31
31
|
"lint": "eslint --ignore-path .gitignore \"**/*.{ts,js,svelte}\" && npm run check-format",
|