ts-oak-plugin/lib/core/checker.d.ts

68 lines
1.8 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import * as ts from 'typescript/lib/tsserverlibrary';
export interface OakBuildChecksConfig {
context?: {
checkAsyncContext?: boolean;
targetModules?: string[];
filePatterns?: string[];
};
locale?: {
checkI18nKeys?: boolean;
tFunctionModules?: string[];
checkTemplateLiterals?: boolean;
warnStringKeys?: boolean;
checkJsxLiterals?: boolean;
jsxLiteralPattern?: string;
};
}
export 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 declare class OakCustomChecker {
private pwd;
private config;
private program;
private typeChecker;
private tsLib;
private asyncContextChecker?;
private i18nChecker?;
private jsxLiteralChecker?;
private diagnosticsCache;
private fileVersionCache;
constructor(pwd: string, config: OakBuildChecksConfig, program: ts.Program, typeChecker: ts.TypeChecker, tsLib: typeof ts);
private initializeCheckers;
/**
* 检查单个文件(用于 TSServer 插件)
*/
checkFile(fileName: string, fileVersion?: string): CustomDiagnostic[];
/**
* 检查所有文件(用于 CLI 编译)
*/
checkAllFiles(): CustomDiagnostic[];
/**
* 清除缓存
*/
clearCache(fileName?: string): void;
/**
* 更新 Program当项目重新编译时
*/
updateProgram(program: ts.Program): void;
}