Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 58x 58x 1x 3x 4x 4x | import type { Warning } from './types.js';
export class WarningCollector {
readonly warnings: Warning[] = [];
private onWarning?: (w: Warning) => void;
constructor(onWarning?: (w: Warning) => void) {
this.onWarning = onWarning;
}
warn(path: string, message: string): void {
this.add({ path, message, severity: 'warn' });
}
info(path: string, message: string): void {
this.add({ path, message, severity: 'info' });
}
private add(warning: Warning): void {
this.warnings.push(warning);
this.onWarning?.(warning);
}
}
|