/** * Request scope for server-owned island rendering. * * A `.server.tsx` island's render function always executes on the server — * page SSR through the router, or streamed frames through the plugin's * `/__ilha/frame` endpoint. Both seed this scope with the originating * `Request`, so render functions can read request data (URL, headers, * cookies) through `useContext().request` or a host integration such as Oxide's `useRequest()`. * * The storage lives on `globalThis` under `ilha.requestAls` so every module * copy (plugin bundle, SSR graph) shares one instance. The public accessor * is `useContext()` from the main `@ilha/router` entry, which reads the * storage without importing `node:async_hooks`; this node-only module is the * sole place that constructs it. * * StackBlitz WebContainers lose AsyncLocalStorage across `async/await`. A * module sync fallback keeps `useContext().request` readable, and unrelated * fallback entries are serialized so concurrent renders cannot stomp each * other. Nested calls reenter only while owned by the active entry (sync nest * or ALS owner) so a suspended outer cannot admit unrelated concurrent work. */ export { REQUEST_ALS_KEY } from "./als-key"; export { __setInWebcontainerForTests } from "./webcontainer"; export type { IslandContext } from "./index"; /** Test-only: force getStore() to skip ALS (simulates WebContainer ALS loss). */ export declare const __setAlsBypassForTests: (value: boolean) => void; /** * Run `fn` with `request` available to `useContext().request`. When oxidejs * is loaded, its action scope is entered too, so `useRequest()` works in * island renders and streamed frames. * * On WebContainer the return is always a `Promise` (fallback lock). Elsewhere * the return matches `fn` (sync or async). */ export declare const runWithIslandRequest: (request: Request, fn: () => T) => T | Promise>;