import type MagicString from "magic-string"; /** Minimal ESTree Program node — avoids importing from `rollup` (not a direct dep). */ interface ProgramNode { type: "Program"; body: any[]; } export interface HandlerCallSite { callStart: number; callEnd: number; argCount: number; lineNumber: number; calleeName: string; exportInfo: { exportName: string; statementEnd: number; } | null; } export interface VirtualHandlerEntry { originalModuleId: string; imports: string[]; handlerCode: string; exportName: string; } /** * Parse the file with Vite's parseAst and find all calls to `fnName`. * Distinguishes between `export const X = fnName(...)` (exportInfo set) * and inline calls like `layout(fnName(...))` (exportInfo null). */ export declare function findHandlerCalls(code: string, fnName: string, parseAst: (code: string, options?: any) => ProgramNode): HandlerCallSite[]; export declare function getImportedLocalNames(code: string, importedName: string, parseAst: (code: string, options?: any) => ProgramNode): Set; /** * Extract all import declarations from the source as raw text slices. * Copies ALL imports -- Rollup tree-shakes unused ones from virtual modules. */ export declare function extractImportDeclarations(code: string, parseAst: (code: string, options?: any) => ProgramNode): string[]; /** * Transform inline handler calls by extracting them into virtual modules. * Only processes inline calls (exportInfo === null); export const calls are * handled by the existing regex fast path. * * Always extracts (dev and build) to keep server-only imports out of non-RSC * environments. The virtual module goes through the standard transform pipeline * automatically -- the existing export const regex path handles it. * * Returns true if any inline calls were transformed. */ export declare function transformInlineHandlers(fnName: string, virtualPrefix: string, s: MagicString, code: string, filePath: string, virtualRegistry: Map, moduleId: string, parseAst: (code: string, options?: any) => ProgramNode): boolean; export {}; //# sourceMappingURL=ast-handler-extract.d.ts.map