|
4 | 4 | declare module '@sveltejs/kit' {
|
5 | 5 | import type { CompileOptions } from 'svelte/compiler';
|
6 | 6 | import type { PluginOptions } from '@sveltejs/vite-plugin-svelte';
|
| 7 | + import type { IncomingMessage } from 'node:http'; |
| 8 | + import type { Duplex } from 'node:stream'; |
7 | 9 | /**
|
8 | 10 | * [Adapters](https://svelte.dev/docs/kit/adapters) are responsible for taking the production build and turning it into something that can be deployed to a platform of your choosing.
|
9 | 11 | */
|
@@ -667,8 +669,8 @@ declare module '@sveltejs/kit' {
|
667 | 669 | */
|
668 | 670 | export type Handle = (input: {
|
669 | 671 | event: RequestEvent;
|
670 |
| - resolve(event: RequestEvent, opts?: ResolveOptions): MaybePromise<Response>; |
671 |
| - }) => MaybePromise<Response>; |
| 672 | + resolve(event: RequestEvent, opts?: ResolveOptions): MaybePromise<void | Response>; |
| 673 | + }) => MaybePromise<void | Response>; |
672 | 674 |
|
673 | 675 | /**
|
674 | 676 | * The server-side [`handleError`](https://svelte.dev/docs/kit/hooks#shared-hooks-handleError) hook runs when an unexpected error is thrown while responding to a request.
|
@@ -1058,6 +1060,10 @@ declare module '@sveltejs/kit' {
|
1058 | 1060 | * The original request object
|
1059 | 1061 | */
|
1060 | 1062 | request: Request;
|
| 1063 | + /** |
| 1064 | + * The upgrade request object |
| 1065 | + */ |
| 1066 | + upgrade: { request: IncomingMessage; socket: Duplex; head: Buffer } | null; |
1061 | 1067 | /**
|
1062 | 1068 | * Info about the current route
|
1063 | 1069 | */
|
@@ -1115,6 +1121,16 @@ declare module '@sveltejs/kit' {
|
1115 | 1121 | RouteId extends string | null = string | null
|
1116 | 1122 | > = (event: RequestEvent<Params, RouteId>) => MaybePromise<Response>;
|
1117 | 1123 |
|
| 1124 | + /** |
| 1125 | + * A `(event: UpgradeEvent) => void` function exported from a `+server.js` file with the name UPGRADE and handles server upgrade requests. |
| 1126 | + * |
| 1127 | + * It receives `Params` as the first generic argument, which you can skip by using [generated types](https://svelte.dev/docs/kit/types#Generated-types) instead. |
| 1128 | + */ |
| 1129 | + export type UpgradeHandler< |
| 1130 | + Params extends Partial<Record<string, string>> = Partial<Record<string, string>>, |
| 1131 | + RouteId extends string | null = string | null |
| 1132 | + > = (event: RequestEvent<Params, RouteId>) => MaybePromise<void>; |
| 1133 | + |
1118 | 1134 | export interface ResolveOptions {
|
1119 | 1135 | /**
|
1120 | 1136 | * Applies custom transforms to HTML. If `done` is true, it's the final chunk. Chunks are not guaranteed to be well-formed HTML
|
@@ -1734,6 +1750,7 @@ declare module '@sveltejs/kit' {
|
1734 | 1750 | type PrerenderEntryGenerator = () => MaybePromise<Array<Record<string, string>>>;
|
1735 | 1751 |
|
1736 | 1752 | type SSREndpoint = Partial<Record<HttpMethod, RequestHandler>> & {
|
| 1753 | + UPGRADE?: UpgradeHandler; |
1737 | 1754 | prerender?: PrerenderOption;
|
1738 | 1755 | trailingSlash?: TrailingSlash;
|
1739 | 1756 | config?: any;
|
|
0 commit comments