/** * Options for precompiling TypeScript schema files */ export interface PrecompileOptions { /** Directory to store compiled files (defaults to .sb-mig-cache) */ cacheDir?: string; /** Whether to clear cache before compiling (defaults to true) */ flushCache?: boolean; /** Project directory (defaults to process.cwd()) */ projectDir?: string; } /** * Result of precompiling files */ export interface PrecompileResult { /** Successfully compiled files with their output paths */ compiled: Array<{ input: string; outputCjs: string; outputEsm: string; }>; /** Files that failed to compile */ errors: Array<{ input: string; error: string; }>; } /** * Extract the component name from a file path * e.g., "/path/to/my-component.sb.ts" -> "my-component.sb" */ export declare const extractComponentName: (filePath: string) => string; /** * Precompile TypeScript schema files to JavaScript * * This uses Rollup with SWC for fast transpilation, producing * both CommonJS (.cjs) and ESM (.js) outputs. * * @param files - Array of TypeScript file paths to compile * @param options - Precompile options * @returns Result with compiled files and any errors * * @example * ```ts * const result = await precompile([ * '/path/to/hero.sb.ts', * '/path/to/card.sb.ts', * ], { cacheDir: '.cache/sb-mig' }); * * // Use compiled CJS files * for (const compiled of result.compiled) { * const content = require(compiled.outputCjs); * } * ``` */ export declare function precompile(files: string[], options?: PrecompileOptions): Promise; /** * Get the compiled file path for a TypeScript source file * * @param tsFilePath - Original .ts file path * @param options - Options with cacheDir and projectDir * @param format - Output format ('cjs' or 'esm') * @returns Path to the compiled file */ export declare function getCompiledPath(tsFilePath: string, options?: PrecompileOptions, format?: "cjs" | "esm"): string;