UNPKG

histoire

Version:

A fast story book powered by Vite

54 lines • 2.51 kB
import type { HistoirePreviewHandle } from '../../api/types.js'; import type { Context } from '../../context.js'; import type { PreviewHostRegistry } from '../browser/preview-host.js'; import type { ScreenshotSetupOwner } from '../browser/setup/types.js'; import type { BuiltPreviewSnapshot } from '../catalog/built.js'; import type { ExecutionService } from '../execution-service.js'; /** Private capture source; consumers retain this exact immutable generation at admission. */ export interface PreviewGeneration { /** Unique preview lifetime, replaced before restart reads new output. */ epoch: string; /** Actual listened origin. */ origin: string; /** Actual mounted base recorded by the build. */ base: string; /** Canonical built target authority. */ snapshot: BuiltPreviewSnapshot; /** Shared same-origin nonce host implementation. */ registry: PreviewHostRegistry; /** Scoped view of the canonical project lane. */ execution: ExecutionService; /** Browser setup policy owned by this preview's captured Context. */ setupOwner: ScreenshotSetupOwner; /** False immediately after restart/close begins. */ isActive: () => boolean; } /** Owned built source and its active immutable capture generation. */ export interface PreviewHosting { /** Public acquired resource. */ handle: HistoirePreviewHandle; /** Captured configured output, protected against owned replacement. */ outputRoot: string; /** Current authority, absent while unavailable. */ readonly current: PreviewGeneration | undefined; } /** Validates built output and owns only its listener, nonce leases and capture jobs. */ export declare function createPreviewHosting(options: { /** Fresh preview configuration capture. */ context: Context; /** Optional output override used by compatible legacy CLI wrapper. */ outputRoot?: string; /** Shared parent lane; this resource owns a scoped cancellation adapter. */ execution: ExecutionService; /** Explicit binding hostname. */ host?: string | boolean; /** Explicit TCP port; zero chooses an actual ephemeral address. */ port?: number; /** CLI compatibility permits trying adjacent occupied ports; SDK defaults strict. */ strictPort?: boolean; /** Publishes coherent source changes. */ onChange: () => void; /** Releases project slot after confirmed close. */ onClose: () => void; }): Promise<PreviewHosting>; //# sourceMappingURL=preview.d.ts.map