From 33340b00d280defc50a0d6afc316b6c7a0223f30 Mon Sep 17 00:00:00 2001 From: Tee Ming Chew Date: Thu, 27 Aug 2026 21:58:33 +0800 Subject: [PATCH] remove Server constructor from public type --- packages/kit/src/exports/public.d.ts | 5 ++--- packages/kit/src/types/internal.d.ts | 19 ++++--------------- packages/kit/types/index.d.ts | 11 +---------- 3 files changed, 7 insertions(+), 28 deletions(-) diff --git a/packages/kit/src/exports/public.d.ts b/packages/kit/src/exports/public.d.ts index 5a09788b2ba2..b8452af4354c 100644 --- a/packages/kit/src/exports/public.d.ts +++ b/packages/kit/src/exports/public.d.ts @@ -12,7 +12,7 @@ import { RequestOptions, RouteSegment } from '../types/private.js'; -import { SSRManifest, ValidatedConfig } from 'types'; +import { ValidatedConfig } from 'types'; import { Plugin } from 'vite'; import { RouteId as AppRouteId, LayoutParams as AppLayoutParams } from '$app/types'; import { StandardSchemaV1 } from '@standard-schema/spec'; @@ -681,8 +681,7 @@ export interface RouteDefinition { config: Config; } -export class Server { - constructor(manifest: SSRManifest); +export interface Server { init(options: ServerInitOptions): Promise; respond(request: Request, options: RequestOptions): Promise; } diff --git a/packages/kit/src/types/internal.d.ts b/packages/kit/src/types/internal.d.ts index 1a6ac4591c4d..ab935ae0938a 100644 --- a/packages/kit/src/types/internal.d.ts +++ b/packages/kit/src/types/internal.d.ts @@ -194,7 +194,8 @@ export interface InternalRequestOptions extends RequestOptions { emulator?: Emulator; } -export class InternalServer extends Server { +export class InternalServer implements Server { + constructor(manifest: SSRManifest); init(options: ServerInitOptions): Promise; respond(request: Request, options: InternalRequestOptions): Promise; } @@ -461,48 +462,36 @@ export interface ServerNode { /** * Information required to instantiate a new `Server` instance. - * This interface's fields are internal implementation details, and - * changes may be made at any time without being considered breaking. */ export interface SSRManifest { /** - * The directory where SvelteKit keeps its stuff, including static assets (such as JS and CSS) and internally-used routes. - * @internal + * The directory where SvelteKit keeps its stuff, including static assets + * (such as JS and CSS) and internally-used routes. */ app_dir: string; /** * The `base` and `appDir` settings combined without a leading slash. - * @internal */ app_path: string; /** * Static files from `config.files.assets` and the service worker (if any). - * @internal */ assets: Set; /** * Map of file extensions to MIME types - * @internal */ mime_types: Record; - /** @internal */ client: BuildData['client']; - /** @internal */ nodes: SSRNodeLoader[]; /** * hashed filename -> import to that file - * @internal */ remotes: Record Promise<{ default: Record }>>; - /** @internal */ routes: SSRRoute[]; - /** @internal */ prerendered_routes: Set; - /** @internal */ matchers: () => Promise>; /** * A `[file]: size` map of all assets imported by server code. - * @internal */ server_assets: Record; } diff --git a/packages/kit/types/index.d.ts b/packages/kit/types/index.d.ts index a6131ab727d9..1411d3671942 100644 --- a/packages/kit/types/index.d.ts +++ b/packages/kit/types/index.d.ts @@ -665,8 +665,7 @@ declare module '@sveltejs/kit' { config: Config; } - export class Server { - constructor(manifest: SSRManifest); + export interface Server { init(options: ServerInitOptions): Promise; respond(request: Request, options: RequestOptions): Promise; } @@ -917,14 +916,6 @@ declare module '@sveltejs/kit' { : T[K]; // Use the exact type for everything else }; - /** - * Information required to instantiate a new `Server` instance. - * This interface's fields are internal implementation details, and - * changes may be made at any time without being considered breaking. - */ - interface SSRManifest { - } - type ValidatedConfig = RecursiveRequired> & { preprocess: Config['preprocess']; };