The import nodes named one of `names` (an import node is named by the module path it imports).
(names: string[])
| 4005 | |
| 4006 | /** The import nodes named one of `names` (an import node is named by the module path it imports). */ |
| 4007 | getImportNodesByNames(names: string[]): Array<{ filePath: string; name: string; language: Language }> { |
| 4008 | const out: Array<{ filePath: string; name: string; language: Language }> = []; |
| 4009 | for (let i = 0; i < names.length; i += SQLITE_PARAM_CHUNK_SIZE) { |
| 4010 | const chunk = names.slice(i, i + SQLITE_PARAM_CHUNK_SIZE); |
| 4011 | const placeholders = chunk.map(() => '?').join(','); |
| 4012 | const rows = this.db |
| 4013 | .prepare(`SELECT file_path, name, language FROM nodes WHERE name IN (${placeholders}) AND kind = 'import'`) |
| 4014 | .all(...chunk) as Array<{ file_path: string; name: string; language: Language }>; |
| 4015 | for (const row of rows) out.push({ filePath: row.file_path, name: row.name, language: row.language }); |
| 4016 | } |
| 4017 | return out; |
| 4018 | } |
| 4019 | |
| 4020 | // =========================================================================== |
| 4021 | // File Operations |