tstosc
Version:
A transpiler that convert TypeScript to SuperCollider's SCLang.
45 lines (42 loc) • 1.84 kB
TypeScript
import ts from 'typescript';
import { GeneratorContext, ExceptionalSyntax } from '../context.js';
import { Result } from '../../../util/Result.js';
import '../../../cli/args.js';
type FileConversionResult = {
/** The source file's result, without class. */
file: string;
/** The converted class from the source file. */
class: string;
};
type convertTSSourceFileToSC_Option = {
convert_file: boolean;
convert_class: boolean;
};
declare const default_convert_file_option: convertTSSourceFileToSC_Option;
/**
* ### Warning
*
* This will also convert class extracted from this file.
* Unless set `option_from_user.convert_class` to `false`.
*/
declare function convertTSSourceFileToSC(source_file: ts.SourceFile, generator_context?: GeneratorContext, option_from_user?: Partial<convertTSSourceFileToSC_Option>): Result<FileConversionResult, Error>;
/**
* A cached version of `findPreprocessingNeeded`.
*/
declare const findPreprocessingNeededByCached: (source_file: ts.SourceFile) => PreprocessingPack;
/**
* Search a file and return any option/task that needed pre-processing.
*/
declare function findPreprocessingNeeded(source_file: ts.SourceFile): PreprocessingPack;
type PreprocessingPack = {
/** Flags that used in generation. Needed by `generateHelperEnvironment`. */
exceptional_syntax: ExceptionalSyntax;
/** Any definition of class that are written to SuperCollider's user extension file. */
class_definitions: ({
/** The actual name that refer to the class. */
name: string;
/** The difinition body of class */
definition: ts.ClassLikeDeclaration;
})[];
};
export { type PreprocessingPack, convertTSSourceFileToSC, type convertTSSourceFileToSC_Option, default_convert_file_option, findPreprocessingNeeded, findPreprocessingNeededByCached };