(dbPath: string, opts?: { readOnly?: boolean })
| 152 | * a process-global would race. |
| 153 | */ |
| 154 | export function createDatabase(dbPath: string, opts?: { readOnly?: boolean }): { db: SqliteDatabase; backend: SqliteBackend } { |
| 155 | try { |
| 156 | return { db: new NodeSqliteAdapter(dbPath, opts), backend: 'node-sqlite' }; |
| 157 | } catch (error) { |
| 158 | const msg = error instanceof Error ? error.message : String(error); |
| 159 | throw new Error( |
| 160 | 'Failed to open SQLite via the built-in node:sqlite module.\n' + |
| 161 | 'CodeGraph requires node:sqlite (Node.js 22.5+). Install the self-contained\n' + |
| 162 | 'CodeGraph release (it bundles a compatible Node), or run on Node 22.5+.\n' + |
| 163 | `Underlying error: ${msg}` |
| 164 | ); |
| 165 | } |
| 166 | } |
no outgoing calls
no test coverage detected