(dbPath: string)
| 135 | * a process-global would race. |
| 136 | */ |
| 137 | export function createDatabase(dbPath: string): { db: SqliteDatabase; backend: SqliteBackend } { |
| 138 | try { |
| 139 | return { db: new NodeSqliteAdapter(dbPath), backend: 'node-sqlite' }; |
| 140 | } catch (error) { |
| 141 | const msg = error instanceof Error ? error.message : String(error); |
| 142 | throw new Error( |
| 143 | 'Failed to open SQLite via the built-in node:sqlite module.\n' + |
| 144 | 'CodeGraph requires node:sqlite (Node.js 22.5+). Install the self-contained\n' + |
| 145 | 'CodeGraph release (it bundles a compatible Node), or run on Node 22.5+.\n' + |
| 146 | `Underlying error: ${msg}` |
| 147 | ); |
| 148 | } |
| 149 | } |
no outgoing calls
no test coverage detected