{"version":3,"file":"applyBatchedDiagnostics.js","names":[],"sources":["../../../src/checkers/_shared/applyBatchedDiagnostics.ts"],"sourcesContent":["import type { FileDiagnosticManager } from '../../FileDiagnosticManager.js'\nimport type { NormalizedDiagnostic } from '../../logger.js'\nimport { normalizePath } from '../../sources.js'\n\n/**\n * Bucket a flat diagnostic list by file and write per-file diagnostics\n * to the manager. Every file in `scannedFiles` is written (empty list\n * clears stale diagnostics). Files not in `scannedFiles` are untouched.\n *\n * Paths are normalized via `sources.ts#normalizePath(root)` on both sides\n * before keying to defend against checker normalizers that differ in\n * casing, separators, or unresolved `.` segments.\n */\nexport function applyBatchedDiagnostics(\n manager: FileDiagnosticManager,\n scannedFiles: string[],\n diagnostics: NormalizedDiagnostic[],\n root: string,\n): void {\n const byFile = new Map()\n for (const d of diagnostics) {\n if (!d.id) continue // stylelint stdin or malformed entries\n const key = normalizePath(d.id, root)\n const normalized = { ...d, id: key }\n const bucket = byFile.get(key)\n if (bucket) {\n bucket.push(normalized)\n } else {\n byFile.set(key, [normalized])\n }\n }\n\n for (const file of scannedFiles) {\n const key = normalizePath(file, root)\n manager.updateByFileId(key, byFile.get(key) ?? [])\n }\n}\n"],"mappings":";;;;;;;;;;;AAaA,SAAgB,wBACd,SACA,cACA,aACA,MACM;CACN,MAAM,yBAAS,IAAI,IAAoC;CACvD,KAAK,MAAM,KAAK,aAAa;EAC3B,IAAI,CAAC,EAAE,IAAI;EACX,MAAM,MAAM,cAAc,EAAE,IAAI,IAAI;EACpC,MAAM,aAAa;GAAE,GAAG;GAAG,IAAI;EAAI;EACnC,MAAM,SAAS,OAAO,IAAI,GAAG;EAC7B,IAAI,QACF,OAAO,KAAK,UAAU;OAEtB,OAAO,IAAI,KAAK,CAAC,UAAU,CAAC;CAEhC;CAEA,KAAK,MAAM,QAAQ,cAAc;EAC/B,MAAM,MAAM,cAAc,MAAM,IAAI;EACpC,QAAQ,eAAe,KAAK,OAAO,IAAI,GAAG,KAAK,CAAC,CAAC;CACnD;AACF"}