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
43 lines (42 loc) • 1.25 kB
TypeScript
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>;
/**
* Load source content from various inputs
*/
static loadSource(input: string): Promise<SourceContent>;
/**
* Load source content with file discovery options
*/
static loadSourceWithOptions(input: string, options: FileDiscoveryOptions): Promise<SourceContent>;
/**
* 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;
}