@ainc/script
Version:
Script compiler for typescript
62 lines • 1.97 kB
TypeScript
/**
*****************************************
* 加载依赖
*****************************************
*/
import * as babel from '@babel/core';
import { Options as ModulePathsOptions } from './helpers/module-paths-plugin';
/**
*****************************************
* 转换器
*****************************************
*/
export interface Transform {
(filename: string, code: string): string;
}
/**
*****************************************
* 转换代码
*****************************************
*/
export declare function transform(code: string, options: babel.TransformOptions): string;
/**
*****************************************
* 转码【JavaScript】
*****************************************
*/
export declare function transformJavaScript(filename: string, code: string): string;
/**
*****************************************
* 转码【TypeScript】
*****************************************
*/
export declare function transformTypeScript(filename: string, code: string): string;
/**
*****************************************
* 转码【JSX】
*****************************************
*/
export declare function transformJSXScript(filename: string, code: string): string;
/**
*****************************************
* 转码【TSX】
*****************************************
*/
export declare function transformTSXScript(filename: string, code: string): string;
/**
*****************************************
* 转换配置
*****************************************
*/
export interface TransformOptions extends babel.TransformOptions {
typescript?: Record<string, unknown>;
jsx?: Record<string, unknown>;
modulePaths?: ModulePathsOptions;
}
/**
*****************************************
* 转码脚本
*****************************************
*/
export declare function transformScript(filename: string, code: string, options?: TransformOptions): string;
//# sourceMappingURL=transform.d.ts.map