ts-budgie
Version:
Converts TypeScript code to Budgie.
68 lines (67 loc) • 2.17 kB
TypeScript
import * as ts from "typescript";
import { Transformation } from "./output/transformation";
import { TransformationsPrinter } from "./printing/transformationsPrinter";
import { IContextOptions, TransformationService } from "./service";
/**
* Dependencies to initialize a new instance of the Transformer class.
*/
export interface ITransformerDependencies {
/**
* TypeScript compiler options to transform with.
*/
compilerOptions: ts.CompilerOptions;
/**
* Constant conversion options for visiting nodes.
*/
contextOptions: IContextOptions;
/**
* Prints series of transformations as lines of Budgie.
*/
printer: TransformationsPrinter;
/**
* Retrieves and merges source-to-Budgie transforms from a file.
*/
service: TransformationService;
/**
* Source files that may be transformed and referenced.
*/
sourceFiles: ts.SourceFile[];
}
/**
* Raw and formatted results from transforming a source file.
*/
export interface ITransformationResults {
transforms: Transformation[];
printed: string[];
}
/**
* Transforms TypeScript to Budgie.
*/
export declare class Transformer {
/**
* Dependencies used for initialization.
*/
private readonly dependencies;
private readonly typeChecker;
/**
* Initializes a new instance of the Transformer class.
*
* @param dependencies Dependencies to be used for initialization.
*/
constructor(dependencies: ITransformerDependencies);
/**
* Transforms a source file to Budgie.
*
* @param sourceText Source file to transform.
* @returns Raw and formatted results from transforming the source file.
*/
transformSourceFile(sourceFile: ts.SourceFile): ITransformationResults;
/**
* Creates transformations for a source file.
*
* @param sourceFile Source file to transform.
* @param typeChecker Type checker for the source file.
* @returns Transformations for the file, or a complaint for unsupported syntax.
*/
private getSourceFileTransforms;
}