Skip to content

Commit b79ab95

Browse files
jzylksgeoffrich
andauthored
feat: support SvelteKit 1.0.0-next.287 (#33)
Co-authored-by: Geoff Rich <[email protected]>
1 parent e0070cb commit b79ab95

File tree

5 files changed

+599
-69
lines changed

5 files changed

+599
-69
lines changed

files/entry.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
declare module 'SERVER' {
2+
export { Server } from '@sveltejs/kit';
3+
}
4+
5+
declare module 'MANIFEST' {
6+
import { SSRManifest } from '@sveltejs/kit';
7+
export const manifest: SSRManifest;
8+
}

files/entry.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
import { __fetch_polyfill } from '@sveltejs/kit/install-fetch';
2-
import { App } from 'APP';
1+
import { installFetch } from '@sveltejs/kit/install-fetch';
2+
import { Server } from 'SERVER';
33
import { manifest } from 'MANIFEST';
44

55
// replaced at build time
66
const debug = DEBUG;
77

8-
__fetch_polyfill();
8+
installFetch();
99

10-
/** @type {import('@sveltejs/kit').App} */
11-
const app = new App(manifest);
10+
const server = new Server(manifest);
1211

1312
/**
1413
* @typedef {import('@azure/functions').AzureFunction} AzureFunction
@@ -26,7 +25,7 @@ export async function index(context) {
2625
context.log(`Request: ${JSON.stringify(request)}`);
2726
}
2827

29-
const rendered = await app.render(request);
28+
const rendered = await server.respond(request);
3029
const response = await toResponse(rendered);
3130

3231
if (debug) {

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export default function ({ debug = false, customStaticWebAppConfig = {} } = {})
100100

101101
builder.copy(join(files, 'entry.js'), entry, {
102102
replace: {
103-
APP: `${relativePath}/app.js`,
103+
SERVER: `${relativePath}/index.js`,
104104
MANIFEST: './manifest.js',
105105
DEBUG: debug.toString()
106106
}

0 commit comments

Comments
 (0)