Skip to content

Commit 65cb976

Browse files
committed
feat(introspector): improve Bun support
1 parent 09aa989 commit 65cb976

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

package.json

+6
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@
141141
"prefer": "type-imports"
142142
}
143143
],
144+
"unicorn/no-typeof-undefined": [
145+
1,
146+
{
147+
"checkGlobalVariables": false
148+
}
149+
],
144150
"unicorn/prefer-node-protocol": 0
145151
}
146152
},

src/introspector/dialects/kysely-bun-sqlite/kysely-bun-sqlite-dialect.ts

+6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ export class KyselyBunSqliteIntrospectorDialect extends IntrospectorDialect {
66
override readonly introspector = new KyselyBunSqliteIntrospector();
77

88
async createKyselyDialect(options: CreateKyselyDialectOptions) {
9+
if (typeof Bun === 'undefined') {
10+
throw new ReferenceError(
11+
"Dialect 'kysely-bun-sqlite' is only available in a Bun environment.",
12+
);
13+
}
14+
915
const { default: Database } = await import('bun:sqlite');
1016
const { BunSqliteDialect: KyselyBunSqliteDialect } = await import(
1117
'kysely-bun-sqlite'

src/introspector/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
export * from './dialect';
2+
export * from './dialects/kysely-bun-sqlite/kysely-bun-sqlite-dialect';
3+
export * from './dialects/kysely-bun-sqlite/kysely-bun-sqlite-introspector';
24
export * from './dialects/libsql/libsql-dialect';
35
export * from './dialects/libsql/libsql-introspector';
46
export * from './dialects/mssql/mssql-dialect';

tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"sourceMap": true,
2020
"strict": true,
2121
"target": "es2020",
22-
"types": ["vitest/globals"]
22+
"types": ["bun", "vitest/globals"]
2323
},
2424
"include": ["src"]
2525
}

0 commit comments

Comments
 (0)