* Which of the given languages the index records an EXPORT marker for. * * A self-measurement, and the honest basis for a whole class of exclusion. * The dead code report's strongest filter is "exported symbols may be reached * from outside this repository" — and that filter silently doe
(languages: Iterable<string>)
| 3171 | * languages its candidates are actually in. |
| 3172 | */ |
| 3173 | getLanguagesWithExports(languages: Iterable<string>): Set<string> { |
| 3174 | const unique = [...new Set(languages)].filter((language) => language.length > 0); |
| 3175 | const found = new Set<string>(); |
| 3176 | if (unique.length === 0) return found; |
| 3177 | |
| 3178 | for (let i = 0; i < unique.length; i += SQLITE_PARAM_CHUNK_SIZE) { |
| 3179 | const chunk = unique.slice(i, i + SQLITE_PARAM_CHUNK_SIZE); |
| 3180 | const placeholders = chunk.map(() => '?').join(','); |
| 3181 | const rows = this.db |
| 3182 | .prepare( |
| 3183 | `SELECT language, MAX(is_exported) AS any_exported |
| 3184 | FROM nodes |
| 3185 | WHERE language IN (${placeholders}) |
| 3186 | GROUP BY language` |
| 3187 | ) |
| 3188 | .all(...chunk) as Array<{ language: string; any_exported: number }>; |
| 3189 | for (const row of rows) if (row.any_exported === 1) found.add(row.language); |
| 3190 | } |
| 3191 | return found; |
| 3192 | } |
| 3193 | |
| 3194 | /** |
| 3195 | * The nodes with the most DISTINCT dependents, most first. |