/** * types/prepare.d.ts * TypeScript declarations for EUIX Prepare and Intermediate Representation (IR) Subsystem. */ import { EUIXEngineCore } from "./core"; export interface Diagnostic { code: string; type: string; file: string; path: string; message: string; severity?: "error" | "warning" | "info"; suggestion?: string | null; } export interface RuntimeIRState { id: number; name: string; initial: any; type: string; } export interface RuntimeIRComputed { id: number; name: string; deps: string[]; get: string; } export interface RuntimeIRAction { id: number; name: string; call: string; args?: any[]; assign?: string | null; set?: Record | null; mutate?: Record | null; } export interface RuntimeIRComponent { id: number; name: string; src?: string | null; inline: boolean; } export interface RuntimeIRRoute { path: string; params: string[]; name?: string | null; meta?: Record; } export interface RuntimeIR { irVersion: number; route: RuntimeIRRoute | null; states: RuntimeIRState[]; computed: RuntimeIRComputed[]; actions: RuntimeIRAction[]; components: RuntimeIRComponent[]; watchers: Array<{ path: string; actionId: number | null; actionName: string | null }>; lifecycle: { mount: Array<{ actionId: number | null; actionName: string }>; unmount: Array<{ actionId: number | null; actionName: string }>; }; view: any; } export class PreparedApp { ir: RuntimeIR; source: any; diagnostics: Diagnostic[]; options: Record; constructor(ir: RuntimeIR, source: any, diagnostics: Diagnostic[], options?: Record); mount(containerSelector?: string | HTMLElement, mountOptions?: Record): EUIXEngineCore; toJSON(): RuntimeIR; toXml(): string; renderToString(initialData?: Record, renderOptions?: Record): string; createSnapshot(options?: SnapshotOptions): Promise; verifySnapshot(snapshotDataOrPath: string | SnapshotPayload, options?: SnapshotOptions): Promise; } export function renderToString( appOrIrOrSource: PreparedApp | RuntimeIR | Record | string, initialData?: Record, options?: Record ): string; export interface PrepareOptions { currentFile?: string; bypassCache?: boolean; strict?: boolean; resolveImport?: (specifier: string, currentFile: string) => Promise | any; engineClass?: any; [key: string]: any; } export function prepare(source: string | Record, options?: PrepareOptions): Promise; export function mount( appOrSource: PreparedApp | RuntimeIR | string | Record, containerSelector?: string | HTMLElement, options?: Record ): EUIXEngineCore; export function inspect( source: string | Record, options?: PrepareOptions ): Promise<{ file: string; route: RuntimeIRRoute | null; imports: Record; states: string[]; computed: string[]; props: string[]; actions: string[]; components: string[]; diagnostics: Diagnostic[]; }>; export function validateSource( source: string | Record, options?: PrepareOptions ): Promise; export function clearPrepareCache(): void; export interface LlmContextComponent { name: string; file: string; props: Record; } export interface LlmContextRoute { path: string; params: string[]; file: string; } export interface LlmContextData { components: LlmContextComponent[]; routes: LlmContextRoute[]; services: string[]; actions: string[]; states: Array<{ name: string; type: string }>; } export interface LlmContextResult { text: string; data: LlmContextData; } export interface LlmContextOptions { baseDir?: string; format?: "markdown" | "json"; } export function generateLlmContext( targetPathOrFiles: string | string[], options?: LlmContextOptions ): Promise; export interface ConvertOptions { targetFormat?: "xml" | "json" | "auto"; format?: "xml" | "json" | "auto"; fileName?: string; } export function convert(source: string | Record, options?: ConvertOptions): string; export function jsonToXml(sourceJson: string | Record, options?: Record): string; export function xmlToJson(xmlString: string, fileName?: string): Record; export interface FixItem { code: string; type: string; path: string; original: any; fixed: any; message: string; } export interface FixResult> { fixedSource: T; fixesApplied: FixItem[]; remainingDiagnostics: Diagnostic[]; modified: boolean; } export interface FixOptions { currentFile?: string; maxPasses?: number; } export function applyFixes>( source: T, diagnostics?: Diagnostic[] | null, options?: FixOptions ): Promise>; export function fixSource>( source: T, options?: FixOptions ): Promise>; export function generateSourceSchema(): Record; export interface SnapshotPayload { version: number; target: string; hash: string; createdAt: string; ir: RuntimeIR; } export interface SnapshotDiff { path: string; expected: any; actual: any; message: string; } export interface SnapshotVerifyResult { match: boolean; diffs: SnapshotDiff[]; expectedHash: string | null; actualHash: string | null; target: string | null; exists?: boolean; snapshotPath?: string; } export interface SnapshotOptions { target?: string; currentFile?: string; fixedDate?: string; output?: string; [key: string]: any; } export function createSnapshot( sourceOrApp: PreparedApp | RuntimeIR | string | Record, options?: SnapshotOptions ): Promise; export function verifySnapshot( sourceOrApp: PreparedApp | RuntimeIR | string | Record, snapshotDataOrPath: string | SnapshotPayload, options?: SnapshotOptions ): Promise; export function updateSnapshotFile( sourceFilePath: string, options?: SnapshotOptions ): Promise<{ snapshotPath: string; created: boolean; updated: boolean; snapshot: SnapshotPayload }>; export function verifySnapshotFile( sourceFilePath: string, options?: SnapshotOptions ): Promise; export function resolveSnapshotPath(sourceFilePath: string, customOutput?: string): string; export function diffStructural(expected: any, actual: any, propPath?: string, diffs?: SnapshotDiff[]): SnapshotDiff[];