import { APIContext, RouteData } from "astro";
//#region src/islands/types.d.ts
/**
* One island as seen by the streaming scanner, with its chunk closures resolved.
* URLs are public (prefixed) — `staticClosure` and `fullClosure` include the
* component and renderer entry URLs themselves.
*/
type IslandInfo = {
componentUrl: string;
rendererUrl: string | null;
/** raw `client` attribute value, e.g. `load`, `visible`, `idle-x` */
client: string | null;
/** transitive static imports of component + renderer — what preloading warms */
staticClosure: string[];
/** static + dynamic transitive imports — what data providers must cover */
fullClosure: string[];
};
/**
* What an emitter contributes for one island. `links` are merged across emitters
* and either emitted as `` tags (immediate directives)
* or registered for the gate runtime (deferred). `imports` are data-module urls
* (safe to evaluate early, e.g. translation chunks) the deferred gate eagerly
* `import()`s on directive fire, landing them in the module cache before the
* component's own awaited import — urls in both sets register as imports only,
* and immediate directives ignore them. `html` is emitted right before the
* island tag regardless of directive — parsed strictly before the island
* connects, the place for data its chunks read at execution time.
*/
type IslandEmission = {
links?: string[] | undefined;
imports?: string[] | undefined;
html?: string | undefined;
};
/**
* `context` is the request's APIContext when the transform runs in the middleware,
* and undefined when it runs over prerendered HTML at build time.
*/
type IslandEmitter = (island: IslandInfo, context?: APIContext | undefined) => IslandEmission | null;
/**
* What a document emitter contributes for one html page response.
*/
type DocumentEmission = {
head?: string | undefined;
end?: (() => string | null) | undefined;
};
/**
* Called once per html page response by the islands middleware, before the body
* streams. Return null to contribute nothing. Unlike island emitters, document
* emitters never run over prerendered HTML — their data is per-request by nature.
*/
type DocumentEmitter = (context: APIContext) => DocumentEmission | null;
//#endregion
//#region src/islands/emitters.d.ts
/**
* Register an emitter that contributes preload links, eager imports and/or inline
* html for every island the islands middleware sees. Registration is process-wide — call it once
* during boot or module initialization, not per request.
*/
declare function registerIslandEmitter(emitter: IslandEmitter): void;
/**
* Register an emitter that contributes document-level content (a head bootstrap
* script, a stream-end script) for every html page response the islands middleware
* streams. Registration is process-wide — call it once during boot or module
* initialization, not per request.
*/
declare function registerDocumentEmitter(emitter: DocumentEmitter): void;
//#endregion
//#region src/server/route-store.d.ts
declare function setRequestRouteData(request: Request, locals: object, routeData: RouteData): void;
/**
* Look the route up by the api context (survives `next(url)` rewrites) or by
* the request as the handler created it.
*/
declare function getRequestRouteData(key: Request | Pick): RouteData | undefined;
//#endregion
export { DocumentEmission as a, IslandEmitter as c, registerIslandEmitter as i, IslandInfo as l, setRequestRouteData as n, DocumentEmitter as o, registerDocumentEmitter as r, IslandEmission as s, getRequestRouteData as t };
//# sourceMappingURL=route-store-fIZy4iN0.d.ts.map