28 lines
1.2 KiB
TypeScript
28 lines
1.2 KiB
TypeScript
/// <reference types="node" />
|
|
import type http from 'node:http';
|
|
import type { ComponentInstance, ManifestData, RouteData, SSRManifest } from '../@types/astro';
|
|
import type { DevelopmentEnvironment } from '../core/render/dev/index';
|
|
type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (...args: any) => Promise<infer R> ? R : any;
|
|
export interface MatchedRoute {
|
|
route: RouteData;
|
|
filePath: URL;
|
|
resolvedPathname: string;
|
|
preloadedComponent: ComponentInstance;
|
|
mod: ComponentInstance;
|
|
}
|
|
export declare function matchRoute(pathname: string, env: DevelopmentEnvironment, manifest: ManifestData): Promise<MatchedRoute | undefined>;
|
|
type HandleRoute = {
|
|
matchedRoute: AsyncReturnType<typeof matchRoute>;
|
|
url: URL;
|
|
pathname: string;
|
|
body: ArrayBuffer | undefined;
|
|
origin: string;
|
|
env: DevelopmentEnvironment;
|
|
manifestData: ManifestData;
|
|
incomingRequest: http.IncomingMessage;
|
|
incomingResponse: http.ServerResponse;
|
|
manifest: SSRManifest;
|
|
status?: number;
|
|
};
|
|
export declare function handleRoute({ matchedRoute, url, pathname, status, body, origin, env, manifestData, incomingRequest, incomingResponse, manifest, }: HandleRoute): Promise<void>;
|
|
export {};
|