The import nodes named one of `names` (an import node is named by the module path it imports).
(names: string[])
| 4116 | |
| 4117 | /** The import nodes named one of `names` (an import node is named by the module path it imports). */ |
| 4118 | getImportNodesByNames(names: string[]): Array<{ filePath: string; name: string; language: Language }> { |
| 4119 | const out: Array<{ filePath: string; name: string; language: Language }> = []; |
| 4120 | for (let i = 0; i < names.length; i += SQLITE_PARAM_CHUNK_SIZE) { |
| 4121 | const chunk = names.slice(i, i + SQLITE_PARAM_CHUNK_SIZE); |
| 4122 | const placeholders = chunk.map(() => '?').join(','); |
| 4123 | const rows = this.db |
| 4124 | .prepare(`SELECT file_path, name, language FROM nodes WHERE name IN (${placeholders}) AND kind = 'import'`) |
| 4125 | .all(...chunk) as Array<{ file_path: string; name: string; language: Language }>; |
| 4126 | for (const row of rows) out.push({ filePath: row.file_path, name: row.name, language: row.language }); |
| 4127 | } |
| 4128 | return out; |
| 4129 | } |
| 4130 | |
| 4131 | // =========================================================================== |
| 4132 | // File Operations |