@telorun/sql 0.7.1 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -158,10 +158,12 @@ export async function openSqliteDatabase(file = ":memory:") {
158
158
  await mkdir(dir, { recursive: true });
159
159
  }
160
160
  }
161
- if (typeof Bun !== "undefined") {
162
- const { openDatabase } = await import("./sqlite-driver-bun.js");
163
- return openDatabase(file);
164
- }
165
- const { openDatabase } = await import("./sqlite-driver-node.js");
161
+ // Route through the package's own `./sqlite-driver` subpath export so the
162
+ // resolver selects the driver per runtime (Bun → bun:sqlite, Node →
163
+ // better-sqlite3). A manual `typeof Bun` check with relative imports gets
164
+ // flattened by the controller bundler into an unconditional top-level
165
+ // `import "bun:sqlite"`, which Node's ESM loader rejects before the guard
166
+ // runs; an external `@telorun/*` specifier stays a deferred dynamic import.
167
+ const { openDatabase } = await import("@telorun/sql/sqlite-driver");
166
168
  return openDatabase(file);
167
169
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telorun/sql",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "description": "Telo SQL module - SQL database resource kinds for Telo manifests.",
5
5
  "keywords": [
6
6
  "telo",
@@ -74,7 +74,7 @@
74
74
  "@types/node": "^20.0.0",
75
75
  "@types/pg": "^8.0.0",
76
76
  "typescript": "^5.0.0",
77
- "@telorun/sdk": "0.23.0"
77
+ "@telorun/sdk": "0.26.0"
78
78
  },
79
79
  "peerDependencies": {
80
80
  "@telorun/sdk": "*"
@@ -226,11 +226,12 @@ export async function openSqliteDatabase(file = ":memory:"): Promise<SqliteDb> {
226
226
  }
227
227
  }
228
228
 
229
- if (typeof Bun !== "undefined") {
230
- const { openDatabase } = await import("./sqlite-driver-bun.js");
231
- return openDatabase(file);
232
- }
233
-
234
- const { openDatabase } = await import("./sqlite-driver-node.js");
229
+ // Route through the package's own `./sqlite-driver` subpath export so the
230
+ // resolver selects the driver per runtime (Bun → bun:sqlite, Node →
231
+ // better-sqlite3). A manual `typeof Bun` check with relative imports gets
232
+ // flattened by the controller bundler into an unconditional top-level
233
+ // `import "bun:sqlite"`, which Node's ESM loader rejects before the guard
234
+ // runs; an external `@telorun/*` specifier stays a deferred dynamic import.
235
+ const { openDatabase } = await import("@telorun/sql/sqlite-driver");
235
236
  return openDatabase(file);
236
237
  }