openpkg-sdk
Version:
TypeScript package specification SDK
39 lines (38 loc) • 1.28 kB
TypeScript
import { z } from "zod";
declare const openPkgSchema: unknown;
type OpenPkgSpec = z.infer<typeof openPkgSchema>;
import { z as z2 } from "zod";
declare function extractPackageSpec(entryFile: string, packageDir?: string, content?: string, options?: OpenPkgOptions): Promise<z2.infer<typeof openPkgSchema>>;
interface OpenPkgOptions {
includePrivate?: boolean;
followImports?: boolean;
maxDepth?: number;
resolveExternalTypes?: boolean;
}
interface AnalysisResult {
spec: OpenPkgSpec;
diagnostics: any[];
}
declare class OpenPkg {
private options;
constructor(options?: OpenPkgOptions);
/**
* Analyze TypeScript code from a string
*/
analyze(code: string, fileName?: string): Promise<OpenPkgSpec>;
/**
* Analyze a single file from disk
*/
analyzeFile(filePath: string): Promise<OpenPkgSpec>;
/**
* Analyze a project directory
*/
analyzeProject(entryPath: string): Promise<OpenPkgSpec>;
/**
* Get analysis with diagnostics
*/
analyzeWithDiagnostics(code: string, fileName?: string): Promise<AnalysisResult>;
}
declare function analyze(code: string): Promise<OpenPkgSpec>;
declare function analyzeFile(filePath: string): Promise<OpenPkgSpec>;
export { openPkgSchema, extractPackageSpec, analyzeFile, analyze, OpenPkgSpec, OpenPkgOptions, OpenPkg, AnalysisResult };