/** * Async data helpers for SSR. * * These tiny utilities let `renderToStringAsync()`/`renderToStream()` await * `Promise`-shaped values inside the binding context before the templates are * evaluated, without coupling the synchronous renderer to async semantics. * * @module bquery/ssr */ import type { BindingContext } from '../view/types'; import type { SSRContext } from './context'; /** A loader function executed before render. */ export type SSRLoader = (ctx: SSRContext) => T | Promise; /** * Wraps a loader so it can be invoked or stored uniformly. The wrapper is * tagged with the internal defer brand so `resolveContext()` recognises it * and calls the loader with the active `SSRContext`. */ export declare const defineLoader: (loader: SSRLoader) => SSRLoader; interface DeferredValue { promise: Promise; fallback?: unknown; } /** * Marks a promise as "may resolve in parallel". When `renderToStringAsync()` * sees a deferred value in the context, it awaits the underlying promise. * Streaming renderers can flush a fallback first and patch the resolved value * later (see `renderToStreamSuspense()`). */ export declare const defer: (promise: Promise | T, fallback?: unknown) => DeferredValue; /** * Walks the binding context, awaits all promises and deferred values, and * returns a new context with the resolved values. Signals/computeds are kept * as-is so the renderer can still unwrap them lazily. * * @internal */ export declare const resolveContext: (context: BindingContext, ctx: SSRContext) => Promise; export {}; //# sourceMappingURL=async.d.ts.map