@sveltejs/adapter-netlify 1.0.0-next.32 → 1.0.0-next.36
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/README.md +0 -2
- package/files/entry.js +22 -8
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -8,8 +8,6 @@ This is very experimental; the adapter API isn't at all fleshed out, and things
|
|
|
8
8
|
|
|
9
9
|
> ⚠️ For the time being, the latest version of adapter-netlify is at the @next tag. If you get the error `config.kit.adapter should be an object with an "adapt" method.`, this is a sign that you are using the wrong version (eg `1.0.0-next.0` instead of `1.0.0-next.9`).
|
|
10
10
|
|
|
11
|
-
> ⚠️ Netlify defaults to Node 12.16. SvelteKit requires Node v12.20 to build. You can pin the Node version with a `.node-version` or [`.nvmrc`](https://github.com/nvm-sh/nvm#nvmrc) file: `echo "14" > .nvmrc` or [set the `NODE_ENV` environment variable](https://docs.netlify.com/configure-builds/manage-dependencies/#node-js-and-javascript).
|
|
12
|
-
|
|
13
11
|
```bash
|
|
14
12
|
npm i -D @sveltejs/adapter-netlify@next
|
|
15
13
|
```
|
package/files/entry.js
CHANGED
|
@@ -19,18 +19,32 @@ export async function handler(event) {
|
|
|
19
19
|
rawBody
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
if (rendered) {
|
|
22
|
+
if (!rendered) {
|
|
23
23
|
return {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
statusCode: 404,
|
|
25
|
+
body: 'Not found'
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const partial_response = {
|
|
30
|
+
statusCode: rendered.status,
|
|
31
|
+
...split_headers(rendered.headers)
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
if (rendered.body instanceof Uint8Array) {
|
|
35
|
+
// Function responses should be strings (or undefined), and responses with binary
|
|
36
|
+
// content should be base64 encoded and set isBase64Encoded to true.
|
|
37
|
+
// https://github.com/netlify/functions/blob/main/src/function/response.ts
|
|
38
|
+
return {
|
|
39
|
+
...partial_response,
|
|
40
|
+
isBase64Encoded: true,
|
|
41
|
+
body: Buffer.from(rendered.body).toString('base64')
|
|
28
42
|
};
|
|
29
43
|
}
|
|
30
44
|
|
|
31
45
|
return {
|
|
32
|
-
|
|
33
|
-
body:
|
|
46
|
+
...partial_response,
|
|
47
|
+
body: rendered.body
|
|
34
48
|
};
|
|
35
49
|
}
|
|
36
50
|
|
|
@@ -42,7 +56,7 @@ export async function handler(event) {
|
|
|
42
56
|
* multiValueHeaders: Record<string, string[]>
|
|
43
57
|
* }}
|
|
44
58
|
*/
|
|
45
|
-
function
|
|
59
|
+
function split_headers(headers) {
|
|
46
60
|
const h = {};
|
|
47
61
|
const m = {};
|
|
48
62
|
for (const key in headers) {
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltejs/adapter-netlify",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.36",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/sveltejs/kit",
|
|
7
7
|
"directory": "packages/adapter-netlify"
|
|
8
8
|
},
|
|
9
|
+
"license": "MIT",
|
|
9
10
|
"homepage": "https://kit.svelte.dev",
|
|
10
11
|
"type": "module",
|
|
11
12
|
"exports": {
|
|
@@ -22,10 +23,10 @@
|
|
|
22
23
|
],
|
|
23
24
|
"dependencies": {
|
|
24
25
|
"@iarna/toml": "^2.2.5",
|
|
25
|
-
"esbuild": "^0.13.
|
|
26
|
+
"esbuild": "^0.13.15"
|
|
26
27
|
},
|
|
27
28
|
"devDependencies": {
|
|
28
|
-
"@sveltejs/kit": "1.0.0-next.
|
|
29
|
+
"@sveltejs/kit": "1.0.0-next.202"
|
|
29
30
|
},
|
|
30
31
|
"scripts": {
|
|
31
32
|
"lint": "eslint --ignore-path .gitignore \"**/*.{ts,js,svelte}\" && npm run check-format",
|