oak-domain/lib/compiler/tscBuilder.d.ts

52 lines
1.5 KiB
TypeScript

import * as ts from 'typescript';
export declare const OAK_IGNORE_TAGS: string[];
interface OakBuildChecksConfig {
context?: {
checkAsyncContext?: boolean;
targetModules?: string[];
filePatterns?: string[];
};
locale?: {
checkI18nKeys?: boolean;
tFunctionModules?: string[];
checkTemplateLiterals?: boolean;
warnStringKeys?: boolean;
checkJsxLiterals?: boolean;
jsxLiteralPattern?: string;
};
}
interface CustomDiagnostic {
file: ts.SourceFile;
start: number;
length: number;
messageText: string;
category: ts.DiagnosticCategory;
code: number;
callChain?: string[];
contextCallNode?: ts.CallExpression;
reason?: string;
reasonDetails?: string[];
relatedInfo?: Array<{
file: ts.SourceFile;
start: number;
length: number;
message: string;
}>;
}
export type CompileOptions = {
project?: string;
noEmit?: boolean;
skipExtraCheck?: boolean;
skipEmitDiagnostics?: boolean;
};
/**
* 执行自定义检查
* @param program ts.Program
* @param typeChecker ts.TypeChecker
* @param customConfig 自定义配置
* @returns CustomDiagnostic[] 自定义诊断列表
*/
export declare function performCustomChecks(pwd: string, program: ts.Program, typeChecker: ts.TypeChecker, customConfig: OakBuildChecksConfig): CustomDiagnostic[];
export declare const build: (pwd: string, args: any[]) => void;
export {};