45 lines
No EOL
2.6 KiB
TypeScript
45 lines
No EOL
2.6 KiB
TypeScript
import { ClientDiagnosticPayload, DiagnosticLevel, DiagnosticToRuntime } from "./types.js";
|
|
import { SourceLocation } from "@babel/code-frame";
|
|
import stylelint from "stylelint";
|
|
import { ESLint } from "eslint";
|
|
import { Diagnostic } from "typescript";
|
|
|
|
//#region src/logger.d.ts
|
|
interface NormalizedDiagnostic {
|
|
/** error message */
|
|
message?: string;
|
|
/** error conclusion */
|
|
conclusion?: string;
|
|
/** error stack */
|
|
stack?: string | string[];
|
|
/** file name */
|
|
id?: string;
|
|
/** checker diagnostic source */
|
|
checker: string;
|
|
/** raw code frame generated by @babel/code-frame */
|
|
codeFrame?: string;
|
|
/** code frame, but striped */
|
|
stripedCodeFrame?: string;
|
|
/** error code location */
|
|
loc?: SourceLocation;
|
|
/** error level */
|
|
level?: DiagnosticLevel;
|
|
}
|
|
declare function filterLogLevel(diagnostics: NormalizedDiagnostic, level?: DiagnosticLevel[]): NormalizedDiagnostic | null;
|
|
declare function filterLogLevel(diagnostics: NormalizedDiagnostic[], level?: DiagnosticLevel[]): NormalizedDiagnostic[];
|
|
declare function diagnosticToTerminalLog(d: NormalizedDiagnostic, name?: 'TypeScript' | 'vue-tsc' | 'ESLint' | 'Stylelint' | 'Biome' | 'oxlint'): string;
|
|
declare function diagnosticToConsoleLevel(d: NormalizedDiagnostic): "error" | "info" | "warn";
|
|
declare function diagnosticToRuntimeError(d: NormalizedDiagnostic): DiagnosticToRuntime;
|
|
declare function diagnosticToRuntimeError(d: NormalizedDiagnostic[]): DiagnosticToRuntime[];
|
|
declare function toClientPayload(id: string, diagnostics: DiagnosticToRuntime[]): ClientDiagnosticPayload;
|
|
declare function wrapCheckerSummary(checkerName: string, rawSummary: string): string;
|
|
declare function composeCheckerSummary(checkerName: string, errorCount: number, warningCount: number): string;
|
|
declare function normalizeTsDiagnostic(d: Diagnostic): NormalizedDiagnostic;
|
|
declare function normalizeVueTscDiagnostic(d: Diagnostic): NormalizedDiagnostic;
|
|
declare function normalizeEslintDiagnostic(diagnostic: ESLint.LintResult): NormalizedDiagnostic[];
|
|
declare function normalizeStylelintDiagnostic(diagnostic: stylelint.LintResult): NormalizedDiagnostic[];
|
|
declare function ensureCall(callback: CallableFunction): void;
|
|
declare function consoleLog(value: string, level: 'info' | 'warn' | 'error'): void;
|
|
//#endregion
|
|
export { NormalizedDiagnostic, composeCheckerSummary, consoleLog, diagnosticToConsoleLevel, diagnosticToRuntimeError, diagnosticToTerminalLog, ensureCall, filterLogLevel, normalizeEslintDiagnostic, normalizeStylelintDiagnostic, normalizeTsDiagnostic, normalizeVueTscDiagnostic, toClientPayload, wrapCheckerSummary };
|
|
//# sourceMappingURL=logger.d.ts.map
|