/**
 * Pre-render handler definition for build-time rendering of route segments.
 *
 * Prerender wraps a handler so that in production (phase 2)
 * it can be pre-rendered at build time and served as a static Flight payload.
 * In dev mode (phase 1), it behaves as a normal handler — the handler runs
 * on every request just like a regular path() handler.
 *
 * The $$id is auto-generated by the Vite exposeInternalIds plugin
 * based on file path and export name. No manual naming required.
 *
 * @example
 * ```ts
 * // Static page — no params
 * export const DocsPage = Prerender(async (ctx) => {
 *   return <div>Documentation</div>;
 * });
 *
 * // Dynamic page — params first, handler second
 * export const DocsArticle = Prerender(
 *   async () => [{ slug: "getting-started" }, { slug: "api-reference" }],
 *   async (ctx) => {
 *     return <div>{ctx.params.slug}</div>;
 *   }
 * );
 * ```
 */
import type { ReactNode } from "react";
import type { Handler, HandlerContext } from "./types.js";
import type { Handle } from "./handle.js";
export interface PrerenderOptions {
    /**
     * Keep handler in server bundle for live fallback (default: false).
     * false: handler replaced with stub, source-only APIs excluded from bundle.
     * true: handler stays in bundle, unknown params render live at request time.
     */
    passthrough?: boolean;
}
export interface BuildContext<TParams> {
    /** Params extracted from the route pattern (populated from getParams). */
    params: TParams;
    /** Push handle data (frozen into pre-rendered output at build time). */
    use: <T>(handle: Handle<T>) => (data: T) => void;
    /** Synthetic URL built from pattern + params (no real request). */
    url: URL;
    /** Pathname portion of the synthetic URL. */
    pathname: string;
}
export interface PrerenderHandlerDefinition<TParams extends Record<string, any> = any> {
    readonly __brand: "prerenderHandler";
    /** Auto-generated unique ID (injected by Vite plugin). */
    $$id: string;
    /** In dev mode, the actual handler function that path() can call. */
    handler: Handler<TParams>;
    /** Returns the list of param objects to pre-render (dynamic routes). */
    getParams?: () => Promise<TParams[]> | TParams[];
    /** Pre-render options. */
    options?: PrerenderOptions;
}
export declare function Prerender<TParams extends Record<string, any> = {}>(handler: (ctx: HandlerContext<TParams>) => ReactNode | Promise<ReactNode>, options?: PrerenderOptions, __injectedId?: string): PrerenderHandlerDefinition<TParams>;
export declare function Prerender<TParams extends Record<string, any>>(getParams: () => Promise<TParams[]> | TParams[], handler: (ctx: HandlerContext<TParams>) => ReactNode | Promise<ReactNode>, options?: PrerenderOptions, __injectedId?: string): PrerenderHandlerDefinition<TParams>;
/**
 * Type guard to check if a value is a PrerenderHandlerDefinition.
 */
export declare function isPrerenderHandler(value: unknown): value is PrerenderHandlerDefinition;
//# sourceMappingURL=prerender.d.ts.map