import type { RuntimeAdapter } from "../../platform/adapters/base.js"; import type { VeryfrontConfig } from "../../config/index.js"; import type { HandlerContext } from "../../types/index.js"; import type { EnrichedContext } from "../../server/context/enriched-context.js"; import { parseRenderCacheKey } from "../../cache/keys.js"; export type RenderEnvironment = "preview" | "production"; /** * The two independent mode vocabularies a render carries. * * `compileMode` is the compile vocabulary. It selects minification, tree * shaking, sourcemaps and the SSR transform budget. It is derived from whether * the project runs on a local filesystem, so a hosted render is always * `"production"`. * * `environment` is the request vocabulary. It selects preview-only * instrumentation such as the Studio Navigator node positions. It comes from * the already-validated request mode and is never derived from a Host header, * a query parameter, or anything else a client controls. * * A hosted preview render is `{ compileMode: "production", environment: * "preview" }`, so neither field can be derived from the other. Passing one * where the other is expected is a bug: keep them in this pair. */ export interface RenderModes { compileMode: "development" | "production"; environment: RenderEnvironment; } /** Read the render mode pair off a {@link RenderContext}. */ export declare function renderModesOf(ctx: RenderContext): RenderModes; export interface RenderContext { projectId: string; projectSlug: string; projectDir: string; config: VeryfrontConfig; mode: "development" | "production"; /** Whether browser-facing local filesystem module URLs are trusted. */ isLocalProject?: boolean; /** Narrow host-owned capability for project-code execution. */ allowHostProjectCodeExecution?: boolean; adapter: RuntimeAdapter; cachePrefix: string; environment: RenderEnvironment; /** Content source identifier for cache isolation (e.g., "release-abc123", "preview-main", "local-main") */ contentSourceId: string; branch?: string | null; releaseId?: string; proxyToken?: string; moduleServerUrl?: string; port?: number; nonce?: string; } export interface CreateRenderContextOptions { port?: number; moduleServerUrl?: string; nonce?: string; } export declare function createRenderContext(ctx: HandlerContext, options?: CreateRenderContextOptions): RenderContext; export declare function createRenderContextFromEnriched(enriched: EnrichedContext, options?: CreateRenderContextOptions): RenderContext; export declare function createCacheKey(ctx: RenderContext, contentKey: string): string; export declare const parseCacheKey: typeof parseRenderCacheKey; export declare function isSameTenant(a: RenderContext, b: RenderContext): boolean; //# sourceMappingURL=render-context.d.ts.map