import type { ConnInfo, ServeInit } from "https://deno.land/std@0.180.0/http/server.ts";import type { Comment, Element, TextChunk } from "https://deno.land/x/lol_html@0.0.6/types.d.ts";import type { RouteModule } from "../framework/core/router.ts";
export type AlephConfig = { tls?: TLSOptions; router?: RouterInit; loaders?: ModuleLoader[]; middlewares?: Middleware[]; session?: SessionOptions; ssr?: SSR; build?: BuildOptions; atomicCSS?: AtomicCSSEngine; plugins?: Plugin[]; onError?: ErrorHandler;};
export interface Plugin { name?: string; setup(config: AlephConfig, env: PluginENV): void | Promise<void>;}
export type PluginENV = { isDev: boolean;};
export interface AtomicCSSGenerateOptions { id?: string; preflights?: boolean; minify?: boolean;}
export interface AtomicCSSGenerateResult { css: string; matched: Set<string>;}
export interface AtomicCSSEngine { name?: string; version?: string; test?: RegExp; resetCSS?: string; generate(input: string | string[], options?: AtomicCSSGenerateOptions): Promise<AtomicCSSGenerateResult>;}
export interface RouterInit { basePath?: string; glob?: string; dir?: string; exts?: string[]; moduleURL?: string; modules?: Record<string, Record<string, unknown>>; onChange?(): void;}
export type CookieOptions = { expires?: number | Date; maxAge?: number; domain?: string; path?: string; httpOnly?: boolean; secure?: boolean; sameSite?: "lax" | "strict" | "none";};
export interface Cookies { get(key: string): string | undefined;}
export interface SessionStorage { get(sid: string): Promise<Record<string, unknown> | undefined>; set(sid: string, data: Record<string, unknown>, expires: number): Promise<void>; delete(sid: string): Promise<void>;}
export type SessionCookieOptions = { name?: string; domain?: string; path?: string; secure?: boolean; sameSite?: "lax" | "strict" | "none";};
export type SessionOptions = { storage?: SessionStorage; cookie?: SessionCookieOptions; secret?: string; maxAge?: number;};
export interface Session<T> { store: T | undefined; update(store: T | ((store: T | undefined) => T)): Promise<void>; end(): Promise<void>; redirect(url: string | URL): Response;}
export interface HTMLRewriterHandlers { element?: (element: Element) => void; comments?: (comment: Comment) => void; text?: (text: TextChunk) => void;}
export interface HTMLRewriter { on: (selector: string, handlers: HTMLRewriterHandlers) => void;}
export interface Context extends Record<string, unknown> { readonly connInfo?: ConnInfo; readonly params: Record<string, string>; readonly cookies: Cookies; readonly htmlRewriter: HTMLRewriter; getSession: <T extends Record<string, unknown> = Record<string, unknown>>() => Promise<Session<T>>; next: () => Promise<Response> | Response; render: () => Promise<Response>;}
export interface Middleware { readonly name?: string; fetch(request: Request, context: Context): Promise<Response> | Response;}
export type ImportMap = { readonly __filename: string; readonly imports: Record<string, string>; readonly scopes: Record<string, Record<string, string>>;};
export type JSXConfig = { jsx?: "automatic" | "classic" | "preserve"; jsxPragma?: string; jsxPragmaFrag?: string; jsxImportSource?: string;};
export type ModuleLoaderEnv = { isDev?: boolean; importMap?: ImportMap; jsxConfig?: JSXConfig; sourceMap?: boolean; spaMode?: boolean; ssr?: boolean;};
export type ModuleLoaderOutput = { code: string; inlineCSS?: string; lang?: "js" | "jsx" | "ts" | "tsx"; map?: string;};
export interface ModuleLoader { test(path: string): boolean; load(specifier: string, content: string, env: ModuleLoaderEnv): Promise<ModuleLoaderOutput> | ModuleLoaderOutput;}
export type BuildOptions = { buildTarget?: "es2015" | "es2016" | "es2017" | "es2018" | "es2019" | "es2020" | "es2021" | "es2022"; outputDir?: string; ssg?: boolean | SSGOptions; sourceMap?: boolean;};
export type SSGOptions = { include?: RegExp; exclude?: RegExp; getStaticPaths?: () => string[] | Promise<string[]>; clientHeaders?: HeadersInit;};
export type SSRContext = { readonly url: URL; readonly modules: RouteModule[]; readonly headCollection: string[]; readonly signal: AbortSignal; readonly nonce?: string; setStatus(code: number): void; setSuspenseMarker(selector: string, test: (el: Element) => boolean): void;};
export type SuspenseMarker = { selector: string; test: (el: Element) => boolean;};
export type SSRFn = { (ssr: SSRContext): Promise<ReadableStream | string> | ReadableStream | string;};
export type CSP = { nonce?: boolean; getPolicy: (url: URL, nonce?: string) => string | null;};
export type SSROptions = { root?: string; include?: RegExp | RegExp[]; exclude?: RegExp | RegExp[]; CSP?: CSP;};
export type SSR = | SSRFn | SSROptions & { render: SSRFn; };
export type ErrorHandler = { ( error: unknown, cause: "fetch-route" | "fetch-route-data" | "ssr" | "transform" | "fs" | "middleware", request: Request, context?: Context, ): Response | void;};
export type TLSOptions = { certFile: string; keyFile: string;};
export type { ConnInfo, ServeInit };