Files
discord-clone/node_modules/vite-plugin-checker/dist/esm/FileDiagnosticManager.js
2023-01-03 09:29:04 -06:00

37 lines
925 B
JavaScript

class FileDiagnosticManager {
constructor() {
this.diagnostics = [];
this.initialized = false;
}
initWith(diagnostics) {
if (this.initialized) {
throw new Error("FileDiagnosticManager is already initialized");
}
diagnostics.forEach((d) => {
this.diagnostics.push(d);
});
this.initialized = true;
}
getDiagnostics(fileName) {
if (fileName) {
return this.diagnostics.filter((f) => f.id === fileName);
}
return this.diagnostics;
}
updateByFileId(fileId, next) {
var _a;
for (let i = 0; i < this.diagnostics.length; i++) {
if (((_a = this.diagnostics[i]) == null ? void 0 : _a.id) === fileId) {
this.diagnostics.splice(i, 1);
i--;
}
}
if (next == null ? void 0 : next.length) {
this.diagnostics.push(...next);
}
}
}
export {
FileDiagnosticManager
};
//# sourceMappingURL=FileDiagnosticManager.js.map