Skip to content

Commit 514b63f

Browse files
committed
feat: add in-memory diagnostics collector
1 parent 2514929 commit 514b63f

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/diagnostics.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import type { ApiDiagnostic, DiagnosticCollector } from "./types.js";
2+
3+
export class MemoryDiagnosticCollector implements DiagnosticCollector {
4+
readonly #items: ApiDiagnostic[] = [];
5+
6+
add(diagnostic: ApiDiagnostic): void {
7+
this.#items.push(diagnostic);
8+
}
9+
10+
snapshot(): readonly ApiDiagnostic[] {
11+
return [...this.#items];
12+
}
13+
}

0 commit comments

Comments
 (0)