* The frameworks that came or went since the last full index (#2516): files * indexed before the change were read without the frameworks added, and with * the ones removed, so a full re-index brings them in line. Null when nothing * changed; an index built before a half of this was recorded
()
| 1117 | * one the last full index had, covers that. |
| 1118 | */ |
| 1119 | getFrameworkChangesSinceIndex(): { added: string[]; removed: string[] } | null { |
| 1120 | const names = (list: unknown): string[] => (Array.isArray(list) ? list.filter((n): n is string => typeof n === 'string') : []); |
| 1121 | const added = new Set<string>(); |
| 1122 | const removed = new Set<string>(); |
| 1123 | try { |
| 1124 | const value = this.queries.getMetadata(FRAMEWORKS_SINCE_INDEX_KEY); |
| 1125 | if (value) { |
| 1126 | const parsed = JSON.parse(value) as { added?: unknown; removed?: unknown }; |
| 1127 | for (const name of names(parsed.added)) added.add(name); |
| 1128 | for (const name of names(parsed.removed)) removed.add(name); |
| 1129 | } |
| 1130 | } catch { /* metadata is advisory */ } |
| 1131 | try { |
| 1132 | const atIndex = parseNameList(this.queries.getMetadata(RESOLVER_FRAMEWORKS_AT_INDEX_KEY)); |
| 1133 | if (atIndex) { |
| 1134 | const now = this.resolver.getDetectedFrameworks(); |
| 1135 | for (const name of now) if (!atIndex.includes(name)) added.add(name); |
| 1136 | for (const name of atIndex) if (!now.includes(name)) removed.add(name); |
| 1137 | } |
| 1138 | } catch { /* metadata is advisory */ } |
| 1139 | return added.size > 0 || removed.size > 0 ? { added: [...added].sort(), removed: [...removed].sort() } : null; |
| 1140 | } |
| 1141 | |
| 1142 | async sync(options: IndexOptions = {}): Promise<SyncResult> { |
| 1143 | const { |
no test coverage detected