wx-to-tt
Version:
transform wx micro app to bytedance micro app
104 lines (103 loc) • 2.36 kB
TypeScript
import { LOG_TYPE, ERROR_TYPE } from './constant';
export declare enum Level {
SUCCESS = "success",
ERROR = "error",
WARNING = "warning",
INFO = "info",
UNDERLINE = "underline"
}
declare type ValueOf<T> = T[keyof T];
declare type LogInfo = {
type: ValueOf<typeof LOG_TYPE>;
file?: string;
message: string;
} | {
type: typeof ERROR_TYPE.apiNotSupport;
name: string;
file: string;
message: string;
doc?: string;
} | {
type: typeof ERROR_TYPE.componentNotSupport;
name: string;
file: string;
message: string;
doc?: string;
} | {
type: typeof ERROR_TYPE.configNotSupport;
name: string;
file: string;
message: string;
doc?: string;
} | {
type: typeof ERROR_TYPE.attribNotSupport;
name: string;
attr: string;
file: string;
message: string;
doc?: string;
} | {
type: typeof ERROR_TYPE.paramNotSupport;
name: string;
param: string;
file: string;
message: string;
doc?: string;
} | {
type: typeof ERROR_TYPE.compileError;
file?: string;
message: string;
} | string;
declare type Store = {
info: LogInfo[];
warning: LogInfo[];
error: LogInfo[];
success: LogInfo[];
};
declare type LogInitParams = {
isIDE: boolean;
src: string;
dist: string;
logPath: string;
};
declare type DataItem = {
type: string;
level: number;
log: {
name: string;
info: string;
hint: string;
doc?: string;
}[];
};
declare class Log {
store: Store;
logMap: Map<any, any>;
isIDE: boolean;
beginTime: Date | null;
endTime: Date | null;
result: string | null;
status: any;
src: string;
dist: string;
logPath: string;
logDetail: Record<string, DataItem>;
constructor();
init(params: LogInitParams): void;
isLogExist(log: LogInfo, level: Level): boolean;
recordLog(log: LogInfo, level: Level, isPrint?: boolean): void;
printLog(log: LogInfo, level: Level): void;
attentionLog(log: LogInfo, level: Level, msg: string): boolean;
sortLog(): string;
save(): void;
clear(): void;
getLogItem(log: LogInfo): {
name: string;
info: string;
hint: string;
doc: string;
};
recordTransformFile(file: string): void;
}
export declare const log: Log;
export {};