* 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
()
| 1107 | * one the last full index had, covers that. |
| 1108 | */ |
| 1109 | getFrameworkChangesSinceIndex(): { added: string[]; removed: string[] } | null { |
| 1110 | const names = (list: unknown): string[] => (Array.isArray(list) ? list.filter((n): n is string => typeof n === 'string') : []); |
| 1111 | const added = new Set<string>(); |
| 1112 | const removed = new Set<string>(); |
| 1113 | try { |
| 1114 | const value = this.queries.getMetadata(FRAMEWORKS_SINCE_INDEX_KEY); |
| 1115 | if (value) { |
| 1116 | const parsed = JSON.parse(value) as { added?: unknown; removed?: unknown }; |
| 1117 | for (const name of names(parsed.added)) added.add(name); |
| 1118 | for (const name of names(parsed.removed)) removed.add(name); |
| 1119 | } |
| 1120 | } catch { /* metadata is advisory */ } |
| 1121 | try { |
| 1122 | const atIndex = parseNameList(this.queries.getMetadata(RESOLVER_FRAMEWORKS_AT_INDEX_KEY)); |
| 1123 | if (atIndex) { |
| 1124 | const now = this.resolver.getDetectedFrameworks(); |
| 1125 | for (const name of now) if (!atIndex.includes(name)) added.add(name); |
| 1126 | for (const name of atIndex) if (!now.includes(name)) removed.add(name); |
| 1127 | } |
| 1128 | } catch { /* metadata is advisory */ } |
| 1129 | return added.size > 0 || removed.size > 0 ? { added: [...added].sort(), removed: [...removed].sort() } : null; |
| 1130 | } |
| 1131 | |
| 1132 | async sync(options: IndexOptions = {}): Promise<SyncResult> { |
| 1133 | const { |
no test coverage detected