UNPKG

typescript-runtime-schemas

Version:

A TypeScript schema generation tool that extracts Zod schemas from TypeScript source files with runtime validation support. Generate validation schemas directly from your existing TypeScript types with support for computed types and constraint-based valid

35 lines (34 loc) 954 B
import { Project, SourceFile } from "ts-morph"; import { FileDiscoveryOptions } from "./file-discovery"; export interface SourceContent { content: string; filePath?: string; files?: Array<{ path: string; content: string; }>; } export interface ProjectResult { project: Project; sourceFiles: SourceFile[]; } export declare class SourceLoader { /** * Create a ts-morph project with proper file structure */ static createProject(input: string, options?: FileDiscoveryOptions & { compilerOptions?: any; }): Promise<ProjectResult>; /** * Create project with real file system for proper import resolution */ private static createFileSystemProject; /** * Create in-memory project for source code strings */ private static createInMemoryProject; /** * Combine multiple files into a single source content */ private static combineFiles; }