Skip to content

Commit 1f751cf

Browse files
committed
Fixes.
1 parent aa41480 commit 1f751cf

File tree

11 files changed

+81
-150
lines changed

11 files changed

+81
-150
lines changed

benchmarks/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"@sqlite-js/api": "workspace:^"
1616
},
1717
"devDependencies": {
18-
"@types/node": "^20.14.2",
18+
"@types/node": "^24.9.1",
1919
"typescript": "^5.9.3"
2020
}
2121
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"devDependencies": {
1212
"@types/better-sqlite3": "^7.6.9",
1313
"@types/mocha": "^10.0.6",
14-
"@types/node": "^20.14.2",
14+
"@types/node": "^24.9.1",
1515
"expect": "^29.7.0",
1616
"mocha": "^10.4.0",
1717
"prettier": "^3.2.5",

packages/api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"@sqlite-js/driver": "workspace:^"
1919
},
2020
"devDependencies": {
21-
"@types/node": "^22.3.0",
21+
"@types/node": "^24.9.1",
2222
"typescript": "^5.9.3",
2323
"vitest": "^2.0.5",
2424
"@sqlite-js/better-sqlite3-driver": "workspace:^",

packages/better-sqlite3-driver/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"@sqlite-js/driver": "workspace:^"
2020
},
2121
"devDependencies": {
22-
"@types/node": "^22.3.0",
22+
"@types/node": "^24.9.1",
2323
"typescript": "^5.9.3",
2424
"vitest": "^2.0.5",
2525
"@sqlite-js/driver-tests": "workspace:^"

packages/driver-tests/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"@sqlite-js/driver": "workspace:^"
2323
},
2424
"devDependencies": {
25-
"@types/node": "^22.3.0",
25+
"@types/node": "^24.9.1",
2626
"typescript": "^5.9.3"
2727
}
2828
}

packages/driver/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"license": "MIT",
2121
"dependencies": {},
2222
"devDependencies": {
23-
"@types/node": "^22.3.0",
23+
"@types/node": "^24.9.1",
2424
"typescript": "^5.9.3"
2525
}
2626
}

packages/wa-sqlite-driver/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"vite-plugin-top-level-await": "^1.4.2",
2424
"vite-plugin-wasm": "^3.3.0",
2525
"@sqlite-js/driver-tests": "workspace:^",
26-
"@types/node": "^22.3.0",
26+
"@types/node": "^24.9.1",
2727
"typescript": "^5.9.3",
2828
"@vitest/browser": "^2.0.5",
2929
"vitest": "^2.0.5",

packages/wa-sqlite-driver/src/OPFSCoopSyncVFS2.ts

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,25 @@ class PersistentFile {
5252
}
5353
}
5454

55+
interface WithModule {
56+
_module: { retryOps: Promise<void>[] };
57+
}
58+
5559
export class OPFSCoopSyncVFS2 extends FacadeVFS {
5660
mapIdToFile = new Map<number, File>();
5761

5862
lastError = null;
59-
log = null; //function(...args) { console.log(`[${contextName}]`, ...args) };
63+
// log = null; //function(...args) { console.log(`[${contextName}]`, ...args) };
64+
log = function (...args) {
65+
console.log(`[OPFSCoopSyncVFS2]`, ...args);
66+
};
6067

6168
persistentFiles = new Map<string, PersistentFile>();
6269
boundAccessHandles = new Map<string, FileSystemSyncAccessHandle>();
6370
unboundAccessHandles = new Set<FileSystemSyncAccessHandle>();
6471
accessiblePaths = new Set<string>();
6572
releaser: null | (() => void) = null;
6673

67-
_module: { retryOps: Promise<void>[] };
68-
6974
static async create(name, module) {
7075
const vfs = new OPFSCoopSyncVFS2(name, module);
7176
await Promise.all([
@@ -79,6 +84,10 @@ export class OPFSCoopSyncVFS2 extends FacadeVFS {
7984
super(name, module);
8085
}
8186

87+
get #module() {
88+
return (this as unknown as WithModule)._module;
89+
}
90+
8291
async #initialize(nTemporaryFiles) {
8392
// Delete temporary directories no longer in use.
8493
const root = await navigator.storage.getDirectory();
@@ -148,7 +157,7 @@ export class OPFSCoopSyncVFS2 extends FacadeVFS {
148157
// files are ready to be used.
149158
this.log?.(`creating persistent file for ${path}`);
150159
const create = !!(flags & VFS.SQLITE_OPEN_CREATE);
151-
this._module.retryOps.push(
160+
this.#module.retryOps.push(
152161
(async () => {
153162
try {
154163
// Get the path directory handle.
@@ -192,7 +201,7 @@ export class OPFSCoopSyncVFS2 extends FacadeVFS {
192201
} else if (!persistentFile.accessHandle) {
193202
// This branch is reached if the database was previously opened
194203
// and closed.
195-
this._module.retryOps.push(
204+
this.#module.retryOps.push(
196205
(async () => {
197206
const file = new File(path, flags);
198207
file.persistentFile = this.persistentFiles.get(path);
@@ -499,7 +508,7 @@ export class OPFSCoopSyncVFS2 extends FacadeVFS {
499508
console.assert(!file.persistentFile.handleLockReleaser);
500509
if (!file.persistentFile.isRequestInProgress) {
501510
file.persistentFile.isRequestInProgress = true;
502-
this._module.retryOps.push(
511+
this.#module.retryOps.push(
503512
(async () => {
504513
// Acquire the Web Lock.
505514
file.persistentFile.handleLockReleaser = await this.#acquireLock(
@@ -523,7 +532,7 @@ export class OPFSCoopSyncVFS2 extends FacadeVFS {
523532
file.persistentFile.isRequestInProgress = false;
524533
})()
525534
);
526-
return this._module.retryOps.at(-1);
535+
return this.#module.retryOps.at(-1);
527536
}
528537
return Promise.resolve();
529538
}

packages/wa-sqlite-driver/src/worker_threads/worker-driver.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ export class WorkerDriverConnection implements SqliteDriverConnection {
5151
this.ready = new Promise<void>((resolve) => {
5252
worker.addEventListener('message', (event) => {
5353
const { id, value } = event.data;
54-
console.log('gotta message', id, value);
5554
if (id == 0) {
5655
resolve();
5756
return;
@@ -121,7 +120,6 @@ export class WorkerDriverConnection implements SqliteDriverConnection {
121120
const p = new Promise<T>((resolve) => {
122121
id = this.registerCallback(resolve);
123122
});
124-
console.log('posting', command, id, args);
125123
this.worker.postMessage([command, id!, args]);
126124
const result = await p;
127125
const error = (result as any)?.error;

packages/wa-sqlite-driver/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"module": "ESNext",
99
"moduleResolution": "Bundler",
1010
// FIXME: issues with @journeyapps/wa-sqlite definitions
11-
"strict": false
11+
"strict": false,
12+
"skipLibCheck": true
1213
},
1314
"include": ["src"],
1415
"references": [{ "path": "../driver" }, { "path": "../driver-tests" }]

0 commit comments

Comments
 (0)