Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
8623ef6
Update issue templates
rhashimoto Jun 18, 2025
4f2b7e8
Replace Facade Proxy with handwritten proxy. (#285)
rhashimoto Jun 21, 2025
21cc38a
Use non-CAPTCHA SQLite download URL. (#289)
rhashimoto Aug 22, 2025
a47eda0
Fix WebLocksMixin state initialization. (#293)
rhashimoto Sep 24, 2025
a3b1324
Bump package version.
shoestringr Sep 24, 2025
c65ec43
Bump brace-expansion from 1.1.11 to 1.1.12
dependabot[bot] Nov 13, 2025
51983d3
Bump koa from 2.16.1 to 2.16.3
dependabot[bot] Nov 13, 2025
7f9841e
Bump tar-fs from 3.0.9 to 3.1.1
dependabot[bot] Nov 13, 2025
a50bad2
OPFS Error handling improvements (#304)
stevensJourney Jan 6, 2026
16a6de9
Bump qs from 6.11.2 to 6.14.1
dependabot[bot] Jan 6, 2026
7792195
Merge pull request #305 from rhashimoto/dependabot/npm_and_yarn/qs-6.…
rhashimoto Jan 6, 2026
b9579a5
Fix type declarations for VFS.Base.
shoestringr Apr 4, 2026
ac62f85
Bump basic-ftp from 5.0.4 to 5.2.0
dependabot[bot] Apr 4, 2026
7e978fe
Merge pull request #311 from rhashimoto/fix-typescript-declarations
rhashimoto Apr 4, 2026
09a4d41
Merge pull request #312 from rhashimoto/dependabot/npm_and_yarn/basic…
rhashimoto Apr 4, 2026
d6afd63
Update packages for dependabot.
shoestringr Apr 4, 2026
619f931
Update @types/estree version in yarn.lock
shoestringr Apr 4, 2026
1867a01
Merge pull request #313 from rhashimoto/updates-for-dependabot
rhashimoto Apr 4, 2026
c17fe55
Enable SQLite experimental write hint.
shoestringr Nov 22, 2025
6e1ba2a
Create OPFSWriteAheadVFS.js.
shoestringr Dec 5, 2025
73caf2c
Implement jOpen() retry.
shoestringr Dec 5, 2025
72ad4a5
Advertise batch atomic write support.
shoestringr Dec 5, 2025
f194b80
Treat an empty journal as non-existent.
shoestringr Dec 5, 2025
a20b1e2
Implement jLock() retry.
shoestringr Dec 5, 2025
27519f5
Comments and minor improvements.
shoestringr Dec 6, 2025
66f163a
Refactor writeHint handling.
shoestringr Dec 7, 2025
9f8e769
Create WriteAhead manager.
shoestringr Dec 7, 2025
78cb837
Implement write-ahead flush (full checkpoint).
shoestringr Dec 7, 2025
bd7afa6
Fix incorrect retention of view into WebAssembly memory.
shoestringr Dec 8, 2025
fb203ef
Minor improvements.
shoestringr Dec 8, 2025
fcbfcdf
Fixes for VACUUM.
shoestringr Dec 8, 2025
de213c8
Comments and minor code improvements.
shoestringr Dec 8, 2025
4cc68a2
Change the txId lock name encoding.
shoestringr Dec 8, 2025
a22c35a
Debug logging.
shoestringr Dec 8, 2025
0544781
Fix bug where handling a checkpoint could remove a newer page.
shoestringr Dec 9, 2025
0314862
Comments and fixes.
shoestringr Dec 9, 2025
6ded95c
Revert "Debug logging."
shoestringr Dec 9, 2025
d974eab
Fix exclusive locking_mode crash on read.
shoestringr Dec 9, 2025
c07d3e8
Add OPFSWriteAheadVFS to contention test.
shoestringr Dec 9, 2025
16e5703
Fix race condition in #retryOpen().
shoestringr Dec 9, 2025
eb57bf3
Simplify batch atomic enabling.
shoestringr Dec 10, 2025
91fd6fa
Allow databases in subdirectories.
shoestringr Dec 15, 2025
301d019
Add temporary file support.
shoestringr Dec 16, 2025
52a390e
Use PRAGMA wal_autocheckpoint for checkpoint invocation.
shoestringr Dec 16, 2025
8da739f
Implement heartbeat check for missing transactions.
shoestringr Dec 18, 2025
d415625
Tweak WriteAhead options.
shoestringr Dec 18, 2025
87fbbb6
Minor fixes.
shoestringr Dec 18, 2025
662c07c
Allow file resize on checkpoint.
shoestringr Dec 19, 2025
04c6ad8
Checkpoint in heartbeat.
shoestringr Dec 20, 2025
2b5b37b
Add write_ahead pragma.
shoestringr Dec 20, 2025
ad5bb3f
Fix WriteAhead.close() race condition.
shoestringr Dec 20, 2025
281e742
Fix checkpoint locking.
shoestringr Dec 20, 2025
720e92d
Work around spurious IDE type warning.
shoestringr Dec 20, 2025
c92d2bd
Add configurable error handler.
shoestringr Dec 21, 2025
7e08084
Fix VACUUM.
shoestringr Dec 21, 2025
bc9efca
Mostly comments.
shoestringr Dec 21, 2025
d446216
Disable write-ahead in exclusive locking mode.
shoestringr Dec 22, 2025
079dee4
Move isolateForWrite() sync with commit as late as possible.
shoestringr Dec 23, 2025
69100c8
Restore database size on batch atomic rollback.
shoestringr Dec 23, 2025
ae31c0c
Fix exit from exclusive locking mode.
shoestringr Dec 23, 2025
f3c0bf8
Avoid unnecessary syncing of temporary files.
shoestringr Dec 25, 2025
b752ab5
IDE syntax checking fixes for tsgo.
shoestringr Dec 29, 2025
40ed982
Replace write-ahead IndexedDB persistence with OPFS.
shoestringr Feb 22, 2026
ff3b70c
Fix LazyLock close failure.
shoestringr Feb 23, 2026
0976ff1
Make write lock lazy.
shoestringr Feb 23, 2026
12d926f
Add PRAGMA lazy_lock.
shoestringr Feb 23, 2026
f30dc10
Remove obsolete code.
shoestringr Feb 23, 2026
b060123
Implement WAL auto-checkpoint.
shoestringr Feb 23, 2026
310394a
Remove read lock from checkpoint.
shoestringr Feb 23, 2026
ecc3ffe
Adjust durability with PRAGMA synchronous.
shoestringr Feb 23, 2026
f483d02
Flush database file only on full checkpoint.
shoestringr Feb 24, 2026
ef89c41
Tweak logging.
shoestringr Mar 6, 2026
a1f0429
Revise #retryOpen() in preparation for WAL2.
shoestringr Mar 7, 2026
cf305b0
Encode lock name with radix 36.
shoestringr Mar 10, 2026
28f59bd
Manage dual WAL file access handles.
shoestringr Mar 10, 2026
159f322
Implement WAL2.
shoestringr Mar 10, 2026
01bff64
Always use write-ahead.
shoestringr Mar 12, 2026
cd4c017
Change default journal_size_limit to a reasonable value.
shoestringr Mar 12, 2026
4f50120
Fix missing salt1 when reading frames.
shoestringr Mar 12, 2026
24dbaf7
Start with a random salt1.
shoestringr Mar 12, 2026
19c38f4
Implement manual non-passive checkpoints.
shoestringr Mar 13, 2026
b20b4f8
Simplify checkpoint code.
shoestringr Mar 13, 2026
ddccf21
Handle a missing or corrupt file header.
shoestringr Mar 13, 2026
e2b16aa
Sync both WAL files on full checkpoint.
shoestringr Mar 13, 2026
451d0d7
Flush the correct file under strict durability.
shoestringr Mar 14, 2026
cca7157
Remove obsolete WAL1 comments and code.
shoestringr Mar 14, 2026
24e3458
Allow an empty transaction for future use.
shoestringr Mar 14, 2026
02211a9
Prep for future page size change support.
shoestringr Mar 15, 2026
1a5d165
Remove unused Transaction.dbPageSize assignments.
shoestringr Mar 15, 2026
0f70f95
Allow VACUUM page size change.
shoestringr Mar 16, 2026
9085bb1
Rework backstop implementation.
shoestringr Mar 26, 2026
b19be6c
Allow manual checkpoint in exclusive locking mode.
shoestringr Mar 26, 2026
d746d2c
Fix a checkpoint race condition.
shoestringr Mar 28, 2026
09da7ab
Allow lock client to enqueue a release before acquire completes.
shoestringr Mar 28, 2026
d889188
Move WriteAheadFile into WriteAhead.
shoestringr Mar 28, 2026
df556dd
Move static WriteAhead constants to file level.
shoestringr Mar 28, 2026
7e42e91
Remove redundant property.
shoestringr Mar 28, 2026
8a2aaf9
Move WAL loading inside #ready lambda.
shoestringr Mar 28, 2026
88d7147
Fix corrupt file header handling.
shoestringr Mar 28, 2026
6919cb6
Require at least 1 transaction to swap WAL files.
shoestringr Mar 29, 2026
2c1c5d6
Update VFS documentation for OPFSWriteAheadVFS.
rhashimoto Apr 1, 2026
2017653
Replace OPFSPermutedVFS with OPFSWriteAheadVFS.
shoestringr Apr 2, 2026
5d877d1
Fix file size tracking for ROLLBACK and VACUUM.
shoestringr Apr 5, 2026
6909030
Make exclusive locking mode block readers.
shoestringr Apr 5, 2026
b0d5ff4
Update SQLite to 3.53.
shoestringr Apr 10, 2026
52e0552
Merge pull request #314 from rhashimoto/write-ahead-rebase
rhashimoto Apr 11, 2026
cd681ea
Bump basic-ftp from 5.2.0 to 5.2.2
dependabot[bot] Apr 12, 2026
e54ac89
Merge pull request #316 from rhashimoto/dependabot/npm_and_yarn/basic…
rhashimoto Apr 12, 2026
9ee0c3f
Bump package version to 1.1.0.
shoestringr Apr 12, 2026
675ff8e
Merge remote-tracking branch 'upstream/master' into pull-upstream
simolus3 Apr 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# dependencies

BASE_SQLITE_VERSION=3.51.2
BASE_SQLITE_VERSION=3.53.0
SQLITE_VERSION = version-${BASE_SQLITE_VERSION}
MC_SQLITE_VERSION = 2.2.7
MC_SQLITE_VERSION = 2.3.3
SQLITE_TARBALL_URL = https://www.sqlite.org/src/tarball/$(SQLITE_VERSION)/sqlite.tar.gz
MC_SQLITE_URL = https://github.com/utelle/SQLite3MultipleCiphers/releases/download/v${MC_SQLITE_VERSION}/sqlite3mc-${MC_SQLITE_VERSION}-sqlite-${BASE_SQLITE_VERSION}-amalgamation.zip

Expand Down Expand Up @@ -77,6 +77,7 @@ EMCC ?= emcc
CFLAGS_COMMON = \
-I'deps/$(SQLITE_VERSION)' \
-Wno-non-literal-null-conversion \
-DSQLITE_EXPERIMENTAL_PRAGMA_20251114 \
$(CFLAGS_EXTRA)
CFLAGS_DEBUG = -g -fPIC $(CFLAGS_COMMON)
CFLAGS_DIST = -Oz -flto $(CFLAGS_COMMON)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This is a WebAssembly build of SQLite with support for writing SQLite virtual fi

IndexedDB and several Origin Private File System virtual file systems are among the examples provided as proof of concept. A table comparing the different VFS classes is [here](https://github.com/rhashimoto/wa-sqlite/tree/master/src/examples#vfs-comparison).

[Try the demo](https://rhashimoto.github.io/wa-sqlite/demo/?build=asyncify&config=IDBBatchAtomicVFS&reset) or run [benchmarks](https://rhashimoto.github.io/wa-sqlite/demo/benchmarks/?config=asyncify,IDBBatchAtomicVFS;asyncify,IDBMirrorVFS;default,AccessHandlePoolVFS;default,OPFSCoopSyncVFS;asyncify,OPFSAdaptiveVFS;asyncify,OPFSPermutedVFS) with a modern desktop web browser. More information is available in the [FAQ](https://github.com/rhashimoto/wa-sqlite/issues?q=is%3Aissue+label%3Afaq+), [discussion forums](https://github.com/rhashimoto/wa-sqlite/discussions), and [API reference](https://rhashimoto.github.io/wa-sqlite/docs/).
[Try the demo](https://rhashimoto.github.io/wa-sqlite/demo/?build=asyncify&config=IDBBatchAtomicVFS&reset) or run [benchmarks](https://rhashimoto.github.io/wa-sqlite/demo/benchmarks/?config=asyncify,IDBBatchAtomicVFS;asyncify,IDBMirrorVFS;default,AccessHandlePoolVFS;default,OPFSCoopSyncVFS;asyncify,OPFSAdaptiveVFS;asyncify,OPFSWriteAheadVFS) with a modern desktop web browser. More information is available in the [FAQ](https://github.com/rhashimoto/wa-sqlite/issues?q=is%3Aissue+label%3Afaq+), [discussion forums](https://github.com/rhashimoto/wa-sqlite/discussions), and [API reference](https://rhashimoto.github.io/wa-sqlite/docs/).

## Build
The primary motivation for this project is to enable additions to SQLite with only Javascript. Most developers should be able to use the pre-built artifacts in
Expand Down Expand Up @@ -91,7 +91,7 @@ The demo page provides access to databases on multiple VFS implementations. Quer
| Parameter | Purpose | Values | Default |
|----|----|----|----|
| build | Emscripten build type | default, asyncify, jspi | default |
| config | select VFS | MemoryVFS, MemoryAsyncVFS, IDBBatchAtomicVFS, IDBMirrorVFS, AccessHandlePoolVFS, OPFSAdaptiveVFS, OPFSAnyContextVFS, OPFSCoopSyncVFS, OPFSPermutedVFS | uses SQLite internal memory |
| config | select VFS | MemoryVFS, MemoryAsyncVFS, IDBBatchAtomicVFS, IDBMirrorVFS, AccessHandlePoolVFS, OPFSAdaptiveVFS, OPFSAnyContextVFS, OPFSCoopSyncVFS, OPFSWriteAheadVFS | uses SQLite internal memory |
| reset | clear persistent storage | | |

For convenience, if any text region is selected in the editor, only that region will be executed. In addition, the editor contents are restored across page reloads using browser localStorage.
Expand Down
6 changes: 5 additions & 1 deletion demo/contention/contention-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,13 @@ const BUILDS = new Map([
name: 'OPFSPermutedVFS',
vfsModule: '../../src/examples/OPFSPermutedVFS.js',
},
{
name: 'OPFSWriteAheadVFS',
vfsModule: '../../src/examples/OPFSWriteAheadVFS.js',
},
{
name: 'AccessHandlePoolVFS',
vfsModule: '../src/examples/AccessHandlePoolVFS.js',
vfsModule: '../../src/examples/AccessHandlePoolVFS.js',
},
{
name: 'FLOOR',
Expand Down
4 changes: 4 additions & 0 deletions demo/demo-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ const EXT_WASM = new Map([
name: 'OPFSPermutedVFS',
vfsModule: '../src/examples/OPFSPermutedVFS.js',
},
{
name: 'OPFSWriteAheadVFS',
vfsModule: '../src/examples/OPFSWriteAheadVFS.js',
},
{
name: 'AccessHandlePoolVFS',
vfsModule: '../src/examples/AccessHandlePoolVFS.js',
Expand Down
2 changes: 1 addition & 1 deletion demo/hello/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ are valid:

* As of May 2024, the JSPI build works only on recent Chromium browsers
behind an experiment flag.
* As of May 2024, OPFSPermutedVFS works only on recent Chromium browsers
* As of May 2024, OPFSWriteAheadVFS works only on recent Chromium browsers
as it requires FileSystemSyncAccessHandle "readwrite-unsafe" locking.
* Some VFS classes work only with an asynchronous build (Asyncify or JSPI).
* OPFS VFS classes work only within a Worker.
8 changes: 4 additions & 4 deletions demo/hello/hello.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ import SQLiteESMFactory from '../../dist/wa-sqlite-async.mjs';
// in a Worker.
//
// Note that certain VFS classes cannot read each others' databases, e.g.
// IDBBatchAtomicVFS and IDBMirrorVFS, OPFSPermutedVFS and any other OPFS
// VFS. If you change this demo to use a different VFS, you may need to
// clear the appropriate storage for things to work.
// IDBBatchAtomicVFS and IDBMirrorVFS. If you change this demo to use a
// different VFS, you may need to clear the appropriate storage for things
// to work.
import { IDBBatchAtomicVFS as MyVFS } from '../../src/examples/IDBBatchAtomicVFS.js';
// import { IDBMirrorVFS as MyVFS } from '../../src/examples/IDBMirrorVFS.js';
// import { AccessHandlePoolVFS as MyVFS } from '../../src/examples/AccessHandlePoolVFS.js';
// import { OPFSAdaptiveVFS as MyVFS } from '../../src/examples/OPFSAdaptiveVFS.js';
// import { OPFSAnyContextVFS as MyVFS } from '../../src/examples/OPFSAnyContextVFS.js';
// import { OPFSCoopSyncVFS as MyVFS } from '../../src/examples/OPFSCoopSyncVFS.js';
// import { OPFSPermutedVFS as MyVFS } from '../../src/examples/OPFSPermutedVFS.js';
// import { OPFSWriteAheadVFS as MyVFS } from '../../src/examples/OPFSWriteAheadVFS.js';

import * as SQLite from '../../src/sqlite-api.js';

Expand Down
2 changes: 1 addition & 1 deletion dist/mc-wa-sqlite-async.mjs

Large diffs are not rendered by default.

Binary file modified dist/mc-wa-sqlite-async.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/mc-wa-sqlite-jspi.mjs

Large diffs are not rendered by default.

Binary file modified dist/mc-wa-sqlite-jspi.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/mc-wa-sqlite.mjs

Large diffs are not rendered by default.

Binary file modified dist/mc-wa-sqlite.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/wa-sqlite-async-dynamic-main.mjs

Large diffs are not rendered by default.

Binary file modified dist/wa-sqlite-async-dynamic-main.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/wa-sqlite-async.mjs

Large diffs are not rendered by default.

Binary file modified dist/wa-sqlite-async.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/wa-sqlite-dynamic-main.mjs

Large diffs are not rendered by default.

Binary file modified dist/wa-sqlite-dynamic-main.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/wa-sqlite-jspi.mjs

Large diffs are not rendered by default.

Binary file modified dist/wa-sqlite-jspi.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/wa-sqlite.mjs

Large diffs are not rendered by default.

Binary file modified dist/wa-sqlite.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/assets/navigation.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/assets/search.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions docs/interfaces/SQLiteAPI.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/interfaces/SQLitePrepareOptions.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
</div><div class="tsd-comment tsd-typography"></div></section><div class="tsd-signature"><span class="tsd-signature-keyword">interface </span><span class="tsd-kind-interface">SQLitePrepareOptions</span> <span class="tsd-signature-symbol">{ </span><br/><span>    </span><a class="tsd-kind-property" href="SQLitePrepareOptions.html#flags">flags</a><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">; </span><br/><span>    </span><a class="tsd-kind-property" href="SQLitePrepareOptions.html#unscoped">unscoped</a><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">; </span><br/><span class="tsd-signature-symbol">}</span></div><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="SQLitePrepareOptions.html#flags" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-1024"></use></svg><span>flags?</span></a>
<a href="SQLitePrepareOptions.html#unscoped" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-1024"></use></svg><span>unscoped?</span></a>
</div></section></div></details></section></section><section class="tsd-panel-group tsd-member-group"><h2>Properties</h2><section class="tsd-panel tsd-member"><a id="flags" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagOptional">Optional</code> <span>flags</span><a href="#flags" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">flags</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">number</span></div><div class="tsd-comment tsd-typography"><p>SQLITE_PREPARE_* flags</p>
</div><div class="tsd-comment tsd-typography"><h4>See</h4><p><a href="https://www.sqlite.org/c3ref/c_prepare_normalize.html#sqlitepreparepersistent">https://www.sqlite.org/c3ref/c_prepare_normalize.html#sqlitepreparepersistent</a></p>
</div><div class="tsd-comment tsd-typography"><h4>See</h4><p><a href="https://sqlite.org/c3ref/c_prepare_dont_log.html#sqlitepreparepersistent">https://sqlite.org/c3ref/c_prepare_dont_log.html#sqlitepreparepersistent</a></p>
</div></section><section class="tsd-panel tsd-member"><a id="unscoped" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagOptional">Optional</code> <span>unscoped</span><a href="#unscoped" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">unscoped</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span></div><div class="tsd-comment tsd-typography"><p>Statement handles prepared and yielded by <a href="SQLiteAPI.html#statements" class="tsd-kind-method">SQLiteAPI.statements</a>
are normally valid only within the scope of an iteration.
Set <code>unscoped</code> to <code>true</code> to give iterated statements an arbitrary
Expand Down
Loading
Loading