|
|
|
@ -28,15 +28,9 @@ function applyDefaultPragmas(instance: any): void {
|
|
|
|
* - En Node (Vite dev SSR): better-sqlite3
|
|
|
|
* - En Node (Vite dev SSR): better-sqlite3
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
async function importSqliteDatabase(): Promise<any> {
|
|
|
|
async function importSqliteDatabase(): Promise<any> {
|
|
|
|
try {
|
|
|
|
// En desarrollo, el alias de Vite resolverá 'bun:sqlite' -> 'better-sqlite3'
|
|
|
|
// @ts-ignore
|
|
|
|
const mod: any = await import('bun:sqlite');
|
|
|
|
if (typeof Bun !== 'undefined') {
|
|
|
|
return (mod as any).Database || (mod as any).default || mod;
|
|
|
|
const mod = await import('bun:sqlite');
|
|
|
|
|
|
|
|
return (mod as any).Database;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch {}
|
|
|
|
|
|
|
|
const mod = await import('better-sqlite3');
|
|
|
|
|
|
|
|
return (mod as any).default || (mod as any).Database || mod;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
|