Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
392 commits
Select commit Hold shift + click to select a range
d5c471a
Guarantee freeing open_v2() filename.
shoestringr Feb 7, 2024
2d6ab41
Rewrite statements() convenience function.
shoestringr Feb 7, 2024
c0e4550
Remove str and prepare_v2 functions.
shoestringr Feb 7, 2024
22eb7d4
Add options argument to statements().
shoestringr Feb 7, 2024
3697ae3
Fix statements() for WebAssembly memory growth.
shoestringr Feb 7, 2024
dbe7f14
Change statements() encoding back to UTF-8.
shoestringr Feb 7, 2024
c20cf28
Reimplement createUTF8() with TextEncoder.
shoestringr Feb 7, 2024
7efcc9b
Add contention demo.
shoestringr Feb 10, 2024
a757d82
Remove obsolete demos.
shoestringr Feb 10, 2024
507eda5
Update file demo.
shoestringr Feb 10, 2024
a4dc38b
Minor type fix.
shoestringr Feb 10, 2024
8e4eabc
Tweak contention demo.
shoestringr Feb 10, 2024
6e9a0e0
Switch IDBBatchAtomicVFS to WebLocksShared.
shoestringr Feb 11, 2024
09d7dbb
Reimplement AccessHandlePoolVFS with retry ops.
shoestringr Feb 16, 2024
b6fa913
Remove task release from contention worker.
shoestringr Feb 17, 2024
6423caf
Tweaks for AccessHandlePoolVFS.
shoestringr Feb 17, 2024
69c95bc
Fix OriginPrivateVFS race.
shoestringr Feb 17, 2024
dd42596
Restore WebLocksShared on OriginPrivateVFS.
shoestringr Feb 18, 2024
b5ee4ec
Improve UnsafeHandlePoolVFS logging.
shoestringr Feb 18, 2024
16bae9f
Remove AccessHandlePoolVFS unnecessary state.
shoestringr Feb 18, 2024
783c99e
Update IDBBatchAtomicVFS logging.
shoestringr Feb 18, 2024
a4e614e
Update README.md
rhashimoto Feb 18, 2024
68cfe9f
Checkpoint for PermutedVFS.
shoestringr Feb 20, 2024
e32c145
Reclaim unused offsets.
shoestringr Feb 21, 2024
d38e2b2
Add PermutedVFS to contention demo.
shoestringr Feb 21, 2024
e93764b
Refactor pending and reclaiming processing.
shoestringr Feb 21, 2024
c9cd240
Fix contention demo race condition bugs.
shoestringr Feb 21, 2024
7a78f5b
Update FLOOR.
shoestringr Feb 29, 2024
1be3b46
Add flush to PermutedVFS.
shoestringr Feb 29, 2024
e014f2f
Update package per Dependabot.
shoestringr Feb 29, 2024
cb83046
Remove prepack script.
shoestringr Feb 29, 2024
93d7498
Bump version.
shoestringr Feb 29, 2024
f1f8550
Merge pull request #160 from rhashimoto/remove-prepack-build
rhashimoto Feb 29, 2024
f847e6a
Rebuild on changes to Javascript libraries
joeyates Mar 23, 2024
1d81695
Bugfix: Avoid dot notation in minified Javascript
joeyates Mar 24, 2024
cb44d0d
Merge pull request #162 from joeyates/feature/rebuild-on-js-changes
rhashimoto Mar 25, 2024
d2a2f1c
Merge pull request #163 from joeyates/fix/avoid-dot-notation-with-man…
rhashimoto Mar 25, 2024
c4c2a46
Dependency update for dependabot.
shoestringr Mar 31, 2024
e1ebcdc
Bump package version.
shoestringr Mar 31, 2024
ca2084c
Merge pull request #166 from rhashimoto/dependabot
rhashimoto Mar 31, 2024
a4c3651
Abandon PermutedVFS for now.
shoestringr Apr 2, 2024
f85ba74
Attempt to fix GitHub Actions.
shoestringr Apr 2, 2024
17ec15f
Rename to OPFSCoopSyncVFS.
shoestringr May 1, 2024
d91d5eb
Port the original AccessHandlePoolVFS.
shoestringr May 2, 2024
071e865
Add AccessHandlePoolVFS tests.
shoestringr May 2, 2024
f91cd7b
Update dependencies per dependabot.
shoestringr May 2, 2024
70931a9
Merge pull request #170 from rhashimoto/dependabot
rhashimoto May 2, 2024
0549208
Merge branch 'master' into dev
shoestringr May 2, 2024
92f2694
Update README.md
rhashimoto May 2, 2024
d68f66f
Change GitHub Actions CI to node 20.
shoestringr May 2, 2024
9d5e3a2
Rework TestContext usage.
shoestringr May 3, 2024
98e8269
Add crash recovery test.
shoestringr May 3, 2024
d3ebdf4
Remove module (vtable) API.
shoestringr May 3, 2024
fcd8bec
Remove unused debugging code.
shoestringr May 3, 2024
66f2f0f
Add unscoped statement test.
shoestringr May 3, 2024
7af7dc4
Add create_function() tests.
shoestringr May 3, 2024
27f6779
Add MemoryAsyncVFS test.
shoestringr May 4, 2024
6321d75
Test VFS short read.
shoestringr May 4, 2024
013eb6f
Improve delete on close test.
shoestringr May 4, 2024
7014ec7
Add contention test.
shoestringr May 4, 2024
f5b5ca4
Update README.md
rhashimoto May 4, 2024
f65fb1b
Remove UnsafeHandlePoolVFS.
shoestringr May 4, 2024
8f8ce16
Remove AHP contention demo.
shoestringr May 4, 2024
8957f5a
Fix hello demo.
shoestringr May 4, 2024
ab910f4
Update README.md
rhashimoto May 4, 2024
e22a6ee
Update README.md
rhashimoto May 5, 2024
a3930bf
Restrict journal_mode accepted settings.
shoestringr May 5, 2024
942f89f
Rename OriginPrivateVFS to OPFSAdaptiveVFS.
shoestringr May 5, 2024
c75a4b3
Fix create_function asynchronous test.
shoestringr May 5, 2024
ccba448
Test callbacks on Asyncify and JSPI builds.
shoestringr May 5, 2024
8f13d97
Add progress handler test.
shoestringr May 5, 2024
9dfdda2
Fix set_authorizer() with async function.
shoestringr May 5, 2024
bac53b4
Removed unused directory reference.
shoestringr May 5, 2024
956462b
Fix libprogress_progress_handler return type.
shoestringr May 5, 2024
6b45afc
Update minimum EMSDK version.
shoestringr May 5, 2024
95c6d7c
Rework WebLocksMixin.
shoestringr May 10, 2024
760cd55
Rename method FacadeVFS.getFilename().
shoestringr May 10, 2024
ef70abd
Add option for IDBBatchAtomicVFS IndexedDB name.
shoestringr May 10, 2024
c6b8bd2
Add WebLocksMixin tests.
shoestringr May 10, 2024
ff4c9e1
Update web-test-runner-jasmine.
shoestringr May 10, 2024
d1ef697
Prepare for write transaction hints.
shoestringr May 10, 2024
c352775
Implement "shared+hint" locking with PRAGMA write_hint.
shoestringr May 11, 2024
9341282
Fix IDBBatchAtomicVFS synchronization bug.
shoestringr May 12, 2024
e669da9
Checkpoint for write_hint demo.
shoestringr May 12, 2024
55748b8
Create OPFSPermutedVFS.
shoestringr May 18, 2024
be729ff
Implement OPFSPermutedVFS VACUUM.
shoestringr May 18, 2024
7abd2f2
Fix OPFSPermutedVFS off-by-1 bug.
shoestringr May 19, 2024
5a29f03
Add OPFSPermutedVFS checksums.
shoestringr May 19, 2024
f6c84a1
Add OPFSPermutedVFS flush PRAGMAs.
shoestringr May 19, 2024
6303fd4
Fix OPFSPermutedVFS pageSize initialization.
shoestringr May 19, 2024
c7c2600
Add OPFSPermutedVFS tests.
shoestringr May 19, 2024
ad0c0ba
Fix example imports for demos.
shoestringr May 19, 2024
3ef2756
Add OPFSPermutedVFS to API tests.
shoestringr May 19, 2024
3f6a633
Fix OPFSPermutedVFS zero pageSize bug.
shoestringr May 19, 2024
29ec532
Fix OPFSPermutedVFS VACUUM file truncation.
shoestringr May 19, 2024
69549ee
Fix OPFSPermutedVFS consistency checks.
shoestringr May 19, 2024
4a42d8c
Optimize OPFSPermutedVFS IDB transactions.
shoestringr May 20, 2024
09820b8
Fix OPFSPermutedVFS free list initialization.
shoestringr May 21, 2024
031a00e
Improve OPFSPermutedVFS.#prepareOverwrite() performance.
shoestringr May 21, 2024
4b47b2e
Remove FLOOR.
shoestringr May 21, 2024
b9da74f
Update README.md
rhashimoto May 21, 2024
5420dd2
Add WebLocksMixin shared+hint tests.
shoestringr May 22, 2024
23acef9
Use write hint in OPFSPermutedVFS.
shoestringr May 23, 2024
518be94
Limit OPFSPermutedVFS calls to getSize().
shoestringr May 23, 2024
a287839
Add OPFSPermutedVFS synchronous setting.
shoestringr May 24, 2024
b4dcd3e
Code polishing.
shoestringr May 25, 2024
8224660
Bump package version.
shoestringr May 25, 2024
eb6e625
Merge pull request #174 from rhashimoto/merge-dev
rhashimoto May 26, 2024
12d5c0d
Improve hello demo.
shoestringr May 26, 2024
0968478
Update README.md
rhashimoto May 26, 2024
5666020
Merge pull request #175 from rhashimoto/hello-demo
rhashimoto May 26, 2024
477c331
Update README.md
rhashimoto May 26, 2024
8b4be5e
Update dependencies per dependabot.
shoestringr May 26, 2024
4dc6a19
Merge pull request #176 from rhashimoto/dependabot
rhashimoto May 26, 2024
bf27888
Update README.md
rhashimoto May 27, 2024
0845f27
Move hello demo to its own directory.
shoestringr May 27, 2024
c02a70d
Update README.md
rhashimoto May 27, 2024
bcf51ad
Merge pull request #177 from rhashimoto/move-hello
rhashimoto May 28, 2024
65e27b0
Update README.md
rhashimoto May 28, 2024
f7a1cc4
Merge pull request #178 from rhashimoto/move-hello
rhashimoto May 28, 2024
2511b98
Fix hello for GitHub Pages.
shoestringr May 28, 2024
1af11e6
Merge pull request #179 from rhashimoto/fix-hello
rhashimoto May 28, 2024
ac2a9b5
Output HTML tables in hello demo.
shoestringr May 28, 2024
7975871
Merge pull request #180 from rhashimoto/hello-tables
rhashimoto May 28, 2024
eee23f5
remove sql_0001
AlexErrant May 29, 2024
a6d71b9
Merge pull request #181 from AlexErrant/remove-sql_0001
rhashimoto May 29, 2024
de2fa2b
Update README.md
rhashimoto May 29, 2024
a16ed34
Add IDBBatchAtomicVFS version upgrade test.
shoestringr Jun 1, 2024
73cc8ac
Remove obsolete tests.
shoestringr Jun 1, 2024
3ddeca1
Remove unused package dependency.
shoestringr Jun 2, 2024
7aabd2f
Improve IDBBatchAtomicVFS update test data.
shoestringr Jun 2, 2024
90047fd
Update README.md
rhashimoto Jun 3, 2024
456ca21
Remove obsolete karma configuration file.
shoestringr Jun 3, 2024
0842353
Update README.md
rhashimoto Jun 5, 2024
f5a2f44
Update README.md
rhashimoto Jun 5, 2024
304dba3
Fix WebLocksMixin.jCheckReservedLock bug.
shoestringr Jun 8, 2024
a05f863
Merge pull request #182 from rhashimoto/WebLocksMixin-bug
rhashimoto Jun 8, 2024
c3a81a1
Add OPFSAnyContextVFS.
shoestringr Jun 11, 2024
d248b79
Update README.md
rhashimoto Jun 11, 2024
2f7b024
Add OPFSAnyContextVFS to hello demo.
shoestringr Jun 11, 2024
8d7eda9
Merge pull request #183 from rhashimoto/OPFSAnyContextVFS
rhashimoto Jun 11, 2024
0df7366
Update README.md
rhashimoto Jun 13, 2024
7c6a438
Add JSPI feature detection credit comment.
shoestringr Jun 16, 2024
44cc640
Upgrade SQLite to 3.46.0.
shoestringr Jun 16, 2024
5c36915
Merge pull request #185 from rhashimoto/sqlite-3.46.0
rhashimoto Jun 16, 2024
c451743
Update package version.
shoestringr Jun 16, 2024
2f0163f
Create IDBMirrorVFS.
shoestringr Jun 18, 2024
ddd82eb
Merge pull request #188 from rhashimoto/IDBMirrorVFS
rhashimoto Jun 29, 2024
3ccf9d8
Avoid IndexedDB name conflict in demo.
shoestringr Jun 29, 2024
1508eae
Updates per dependabot.
shoestringr Jun 29, 2024
82b7dc0
Merge pull request #190 from rhashimoto/dependabot
rhashimoto Jun 29, 2024
ec56366
More dependabot updates.
shoestringr Jun 29, 2024
230c4c5
Merge pull request #191 from rhashimoto/dependabot
rhashimoto Jun 29, 2024
6b411ef
Update README.md
rhashimoto Jun 29, 2024
7a99adc
Update README.md
rhashimoto Jun 29, 2024
61b4298
Fix #192. Incorrect package.json.
shoestringr Jun 30, 2024
8193d40
Merge pull request #193 from rhashimoto/package
rhashimoto Jun 30, 2024
6e74c76
Set package version to 1.0.0.
shoestringr Jul 5, 2024
55bf0b6
Merge pull request #194 from rhashimoto/release-1.0.0
rhashimoto Jul 6, 2024
100eea7
Update README.md
rhashimoto Jul 18, 2024
e635e31
Add IDBMirrorVFS to hello demo.
shoestringr Jul 23, 2024
f1ab3d5
Merge pull request #195 from rhashimoto/update-hello-demo
rhashimoto Jul 23, 2024
bfd23c5
Defer IDBMirrorVFS and OPFSPermutedVFS broadcasts.
shoestringr Jul 26, 2024
7722688
Merge pull request #197 from rhashimoto/sync-broadcast
rhashimoto Jul 26, 2024
3d5aa74
Update README.md
rhashimoto Jul 26, 2024
001852b
Fix #187. Add clear_bindings().
shoestringr Jul 26, 2024
5fef539
Merge pull request #198 from rhashimoto/clear-bindings
rhashimoto Jul 26, 2024
fc5c264
Update package.json
rhashimoto Jul 28, 2024
f5092b5
Merge pull request #199 from rhashimoto/increment-version
rhashimoto Jul 29, 2024
b1cf757
Bump @75lb/deep-merge from 1.1.1 to 1.1.2
dependabot[bot] Aug 15, 2024
160e2fb
Merge pull request #203 from rhashimoto/dependabot/npm_and_yarn/75lb/…
rhashimoto Aug 15, 2024
dbce4ca
Expose sqlite3_update_hook
fractalbeauty Sep 16, 2024
07d9b1c
Add test for update_hook
fractalbeauty Sep 16, 2024
1cb66ff
Bump micromatch from 4.0.5 to 4.0.8
dependabot[bot] Sep 18, 2024
b782c68
Merge pull request #211 from rhashimoto/dependabot/npm_and_yarn/micro…
rhashimoto Sep 18, 2024
c3beaf6
Fix set_authorizer() callback arguments.
shoestringr Sep 19, 2024
60d42e8
Bump version.
shoestringr Sep 19, 2024
6a29e15
Merge pull request #212 from rhashimoto/fix-set-authorizer
rhashimoto Sep 19, 2024
46fe2bd
Build
fractalbeauty Sep 20, 2024
a7e3676
Merge pull request #210 from hazelmeow/update-hook
rhashimoto Sep 23, 2024
aa49a25
Update CI Chrome version to 129.
rhashimoto Sep 23, 2024
c65c08c
Change minimum Emscripten version to 3.1.61.
shoestringr Sep 23, 2024
c1a458c
Bump package version.
shoestringr Sep 23, 2024
6364093
Merge pull request #213 from rhashimoto/jspi-updates
rhashimoto Sep 23, 2024
03dc36d
Rebuild docs.
shoestringr Sep 23, 2024
2083e2d
Update CI setup-emsdk.
rhashimoto Sep 23, 2024
b06ba8c
Merge pull request #214 from rhashimoto/setup-emsdk
rhashimoto Sep 23, 2024
4a2a07a
Bump rollup from 4.9.5 to 4.22.4
dependabot[bot] Sep 24, 2024
bfbbc6a
Merge pull request #216 from rhashimoto/dependabot/npm_and_yarn/rollu…
rhashimoto Sep 25, 2024
91ab436
Fix README.md CI badge.
rhashimoto Nov 3, 2024
8a2d66f
Update to SQLite 3.47.0.
shoestringr Nov 3, 2024
8dab4a8
Bump package version.
shoestringr Nov 3, 2024
ca1c304
Merge pull request #224 from rhashimoto/update-sqlite
rhashimoto Nov 3, 2024
2b4439b
Expose commit hook
davidisaaclee Nov 3, 2024
65b1681
make
davidisaaclee Nov 3, 2024
16c074c
Add TypeScript declaration for commit_hook
davidisaaclee Nov 3, 2024
c5fd169
Add (failing) test ensuring commit_hook does not overwrite update_hook
davidisaaclee Nov 5, 2024
7d68b39
Stop sharing pAsyncFlags between hooks
davidisaaclee Nov 5, 2024
62a139d
make (emsdk 3.1.61)
davidisaaclee Nov 5, 2024
729af6f
Return explicit value from commit hook in test
davidisaaclee Nov 6, 2024
dc9b8a1
Fix spacing
davidisaaclee Nov 6, 2024
605100a
Merge pull request #225 from davidisaaclee/commit-hook
rhashimoto Nov 6, 2024
e72d314
Update src/examples/README.md
rhashimoto Nov 24, 2024
4b9f235
Show demo query time in milliseconds.
shoestringr Nov 28, 2024
5669cfc
Merge pull request #227 from rhashimoto/demo-timing
rhashimoto Nov 28, 2024
428c815
Bump nanoid from 3.3.7 to 3.3.8
dependabot[bot] Dec 18, 2024
690dde7
Merge pull request #229 from rhashimoto/dependabot/npm_and_yarn/nanoi…
rhashimoto Dec 18, 2024
d66768e
Bump package version.
shoestringr Dec 18, 2024
7e4c4d0
Bump cross-spawn from 7.0.3 to 7.0.6
dependabot[bot] Dec 18, 2024
3c20261
Merge pull request #230 from rhashimoto/dependabot/npm_and_yarn/cross…
rhashimoto Dec 18, 2024
d1f6248
Make disabling WASM_BIGINT explicit. (#241)
rhashimoto Jan 22, 2025
32d9fc0
Fix xUnlock() call without prior call to xLock() (#245)
rhashimoto Jan 28, 2025
91cff2b
Ensure transaction state exists in jTruncate(). (#247)
rhashimoto Feb 2, 2025
e472300
Bump koa from 2.13.4 to 2.15.4 (#254)
dependabot[bot] Feb 14, 2025
33c1b68
Upgrade @web/test-runner. (#257)
rhashimoto Apr 1, 2025
7a14d78
Bump package version.
shoestringr Apr 1, 2025
8377bfb
Fix IDBBatchAtomicVFS use of completed transaction.
shoestringr Apr 11, 2025
52f5c4c
Merge pull request #261 from rhashimoto/attempted-ci-fix
rhashimoto Apr 11, 2025
c087b71
IDBMirrorVFS: Fix database corruption caused by unfilled blocks (#259)
Spxg Apr 11, 2025
2f74ba3
Fix #260. Avoid IDBBatchAtomicVFS null dereference. (#263)
rhashimoto Apr 11, 2025
13f059b
Bump koa from 2.15.4 to 2.16.1
dependabot[bot] Apr 11, 2025
c7804f9
Merge pull request #264 from rhashimoto/dependabot/npm_and_yarn/koa-2…
rhashimoto Apr 11, 2025
c861c61
Fix resetting isHandleRequested
simolus3 Apr 30, 2025
289c2c5
Merge pull request #269 from powersync-ja/opfs-sync-coop-typo
rhashimoto Apr 30, 2025
97db43a
Bump package version.
rhashimoto Apr 30, 2025
1caeb13
Merge pull request #270 from rhashimoto/bump-version
rhashimoto Apr 30, 2025
e4e87d6
Fix hello demo import paths.
shoestringr May 17, 2025
fa72fb0
Merge pull request #276 from rhashimoto/hello-path-fixes
rhashimoto May 17, 2025
7d45baf
Permit JS booleans to be bound to queries, as integer 0/1 values (#272)
grantcox May 17, 2025
848ca54
Using a single TextEncoder for all string conversions
grantcox May 13, 2025
a883e22
Merge pull request #274 from grantcox/single-textencoder-instance
rhashimoto May 19, 2025
687ab82
Export HEAP* module members for recent EMSDK changes.
shoestringr Jun 1, 2025
5b2ba05
Merge pull request #279 from rhashimoto/heap-module-members
rhashimoto Jun 1, 2025
1c7c058
Bump tar-fs from 3.0.8 to 3.0.9
dependabot[bot] Jun 3, 2025
6f40f89
Merge pull request #280 from rhashimoto/dependabot/npm_and_yarn/tar-f…
rhashimoto Jun 3, 2025
1f65ff0
Update SQLite to 3.50.1.
shoestringr Jun 7, 2025
98465d9
Merge pull request #281 from rhashimoto/update-sqlite
rhashimoto Jun 7, 2025
c8dd51d
Bump package version.
rhashimoto Jun 7, 2025
03c00ed
Merge pull request #282 from rhashimoto/update-version
rhashimoto Jun 7, 2025
8623ef6
Update issue templates
rhashimoto Jun 18, 2025
4f2b7e8
Replace Facade Proxy with handwritten proxy. (#285)
rhashimoto Jun 21, 2025
178fbe6
fix 'debug' build:
ikusteu Jun 25, 2025
7d2644a
temp: request IndexedDB version 6 in IDBBatchAtomicVFS adapter:
ikusteu Jun 25, 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
a939d6b
Merge branch 'reconcile/checkpoint-1' into reconcile-rhashimoto-wa-sq…
ikusteu Oct 10, 2025
b4217e9
Merge branch 'reconcile/checkpoint-2' into reconcile-rhashimoto-wa-sq…
ikusteu Oct 10, 2025
3d95bee
Merge branch 'reconcile/checkpoint-3' into reconcile-rhashimoto-wa-sq…
ikusteu Oct 10, 2025
ba66572
Merge branch 'master' into reconcile-rhashimoto-wa-sqlite
ikusteu Oct 10, 2025
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: " Do not post anything other than a bug report"
about: Issues are only for possible bugs in project code.
title: ''
labels: ''
assignees: ''

---


10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: Bug report
about: Report potential problems in project code
title: ''
labels: ''
assignees: ''

---

In this project, Issues are only for possible bugs in project code. Please don't ask for help debugging _your_ code; I have plenty of challenges debugging _my_ code. 🥲
27 changes: 17 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
branches: [ "master" ]

env:
EM_VERSION: 3.1.45
EM_VERSION: 3.1.61
EM_CACHE_FOLDER: 'emsdk-cache'

jobs:
Expand All @@ -20,21 +20,28 @@ jobs:

strategy:
matrix:
node-version: [16.x]
node-version: [20.x]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'


- uses: browser-actions/setup-chrome@v1
id: setup-chrome
with:
chrome-version: 129
- run: |
${{ steps.setup-chrome.outputs.chrome-path }} --version

# Install yarn dependencies.
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
- uses: actions/cache@v4
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
Expand All @@ -44,16 +51,16 @@ jobs:
- run: yarn install

- name: Test with checked-in WASM files
run: yarn test --reporters progress
run: yarn test

# Install EMSDK
- name: Setup Emscripten
id: cache-system-libraries
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{env.EM_CACHE_FOLDER}}
key: ${{env.EM_VERSION}}-${{ runner.os }}
- uses: mymindstorm/setup-emsdk@v12
- uses: mymindstorm/setup-emsdk@v14
with:
version: ${{env.EM_VERSION}}
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
Expand All @@ -62,4 +69,4 @@ jobs:
- name: Test WASM build
run: |
make clean && make
yarn test --reporters progress
yarn test
10 changes: 3 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.DS_Store

node_modules/

# https://yarnpkg.com/getting-started/qa/#which-files-should-be-gitignored
.yarn/*
!.yarn/patches
Expand All @@ -10,15 +12,9 @@
.pnp.*
*.o

.turbo/
/cache
/debug
/deps
/tmp

.DS_Store

node_modules/
.turbo/
/dist-xl.zip
/dist-xl
/dist
768 changes: 0 additions & 768 deletions .yarn/releases/yarn-3.1.1.cjs

This file was deleted.

893 changes: 893 additions & 0 deletions .yarn/releases/yarn-4.0.2.cjs

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
compressionLevel: mixed

enableGlobalCache: false

yarnPath: .yarn/releases/yarn-4.0.2.cjs
82 changes: 57 additions & 25 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# dependencies
SQLITE_VERSION = version-3.45.0
SQLITE_TARBALL_URL = https://www.sqlite.org/src/tarball/sqlite.tar.gz?r=${SQLITE_VERSION}
SQLITE_VERSION = version-3.50.1
SQLITE_TARBALL_URL = https://www.sqlite.org/src/tarball/$(SQLITE_VERSION)/sqlite.tar.gz

EXTENSION_FUNCTIONS = extension-functions.c
EXTENSION_FUNCTIONS_URL = https://www.sqlite.org/contrib/download/extension-functions.c?get=25
Expand All @@ -15,13 +15,21 @@ CFILES_EXTRA = \
CFILES = \
sqlite3-extra.c \
extension-functions.c \
main.c \
libauthorizer.c \
libfunction.c \
libmodule.c \
libhook.c \
libprogress.c \
libvfs.c \
$(CFILES_EXTRA)

JSFILES = \
src/libauthorizer.js \
src/libfunction.js \
src/libhook.js \
src/libprogress.js \
src/libvfs.js

dir.crsql := ./crsql/src

vpath %.c src
Expand All @@ -32,6 +40,7 @@ vpath %.c $(dir.crsql)
EXPORTED_FUNCTIONS = src/exported_functions.json
EXPORTED_RUNTIME_METHODS = src/extra_exported_runtime_methods.json
ASYNCIFY_IMPORTS = src/asyncify_imports.json
JSPI_EXPORTS = src/jspi_exports.json

# intermediate files
RS_LIB = crsql_bundle
Expand Down Expand Up @@ -65,29 +74,30 @@ EMFLAGS_COMMON = \
-s INVOKE_RUN \
-s ENVIRONMENT="web,worker" \
-s STACK_SIZE=512KB \
-s WASM_BIGINT=0 \
$(EMFLAGS_EXTRA)

EMFLAGS_DEBUG = \
-s ASSERTIONS=1 \
-g \
-g -O1 \
$(EMFLAGS_COMMON)

EMFLAGS_DIST = \
-O3 \
-flto \
--closure 1 \
$(EMFLAGS_COMMON)

EMFLAGS_INTERFACES = \
-s EXPORTED_FUNCTIONS=@$(EXPORTED_FUNCTIONS) \
-s EXPORTED_RUNTIME_METHODS=@$(EXPORTED_RUNTIME_METHODS)

EMFLAGS_LIBRARIES = \
--js-library src/libauthorizer.js \
--js-library src/libfunction.js \
--js-library src/libmodule.js \
--js-library src/libprogress.js \
--js-library src/libvfs.js
--js-library src/libadapters.js \
--post-js src/libauthorizer.js \
--post-js src/libfunction.js \
--post-js src/libhook.js \
--post-js src/libprogress.js \
--post-js src/libvfs.js

EMFLAGS_ASYNCIFY_COMMON = \
-s ASYNCIFY \
Expand All @@ -101,13 +111,20 @@ EMFLAGS_ASYNCIFY_DIST = \
$(EMFLAGS_ASYNCIFY_COMMON) \
-s ASYNCIFY_STACK_SIZE=16384

EMFLAGS_JSPI = \
-s JSPI \
-s ASYNCIFY_IMPORTS=@src/asyncify_imports.json \
-s JSPI_EXPORTS=@src/jspi_exports.json

# NOTE: The tests expect the default page size to be 8192 (not 4096 like the sqlite3 default)
WASQLITE_EXTRA_DEFINES = \
-DSQLITE_EXTRA_INIT=core_init \
-DSQLITE_ENABLE_FTS5 \
-DSQLITE_OMIT_UTF16 \
-DSQLITE_ENABLE_BYTECODE_VTAB \
-DDEFAULT_CACHE_SIZE=8000 \
-DCRSQLITE_WASM
-DCRSQLITE_WASM \
-DSQLITE_DEFAULT_PAGE_SIZE=8192

# https://www.sqlite.org/compile.html
WASQLITE_DEFINES = \
Expand Down Expand Up @@ -138,12 +155,12 @@ crsqlite-extra: $(sqlite3.extra.c)

.PHONY: clean
clean:
rm -rf dist dist-xl debug tmp
rm -rf dist debug tmp
rm -f *.o

.PHONY: spotless
spotless:
rm -rf dist dist-xl debug tmp deps cache
rm -rf dist debug tmp deps cache

## cache
.PHONY: clean-cache
Expand All @@ -159,8 +176,6 @@ cache/$(EXTENSION_FUNCTIONS):
clean-deps:
rm -rf deps

.PHONY: deps

deps/$(SQLITE_VERSION)/sqlite3.h deps/$(SQLITE_VERSION)/sqlite3.c:
mkdir -p cache/$(SQLITE_VERSION)
curl -LsS $(SQLITE_TARBALL_URL) | tar -xzf - -C cache/$(SQLITE_VERSION)/ --strip-components=1
Expand Down Expand Up @@ -208,23 +223,32 @@ clean-debug:
rm -rf debug

.PHONY: debug
debug: debug/crsqlite-sync.mjs debug/crsqlite.mjs
debug: debug/crsqlite-sync.mjs debug/crsqlite.mjs debug/crsqlite-jspi.mjs

debug/crsqlite-sync.mjs: $(OBJ_FILES_DEBUG) $(RS_DEBUG_BC) $(EXPORTED_FUNCTIONS) $(EXPORTED_RUNTIME_METHODS)
debug/crsqlite-sync.mjs: $(OBJ_FILES_DEBUG) $(JSFILES) $(RS_DEBUG_BC) $(EXPORTED_FUNCTIONS) $(EXPORTED_RUNTIME_METHODS)
mkdir -p debug
$(EMCC) $(EMFLAGS_DEBUG) \
$(EMFLAGS_INTERFACES) \
$(EMFLAGS_LIBRARIES) \
$(RS_WASM_TGT_DIR)/debug/deps/*.bc \
$(RS_WASM_TGT_DIR)/debug/deps/*.bc \
$(OBJ_FILES_DEBUG) -o $@

debug/crsqlite.mjs: $(OBJ_FILES_DEBUG) $(RS_DEBUG_BC) $(EXPORTED_FUNCTIONS) $(EXPORTED_RUNTIME_METHODS) $(ASYNCIFY_IMPORTS)
debug/crsqlite.mjs: $(OBJ_FILES_DEBUG) $(JSFILES) $(RS_DEBUG_BC) $(EXPORTED_FUNCTIONS) $(EXPORTED_RUNTIME_METHODS) $(ASYNCIFY_IMPORTS)
mkdir -p debug
$(EMCC) $(EMFLAGS_DEBUG) \
$(EMFLAGS_INTERFACES) \
$(EMFLAGS_LIBRARIES) \
$(EMFLAGS_ASYNCIFY_DEBUG) \
$(RS_WASM_TGT_DIR)/debug/deps/*.bc \
$(RS_WASM_TGT_DIR)/debug/deps/*.bc \
$(OBJ_FILES_DEBUG) -o $@

debug/crsqlite-jspi.mjs: $(OBJ_FILES_DEBUG) $(JSFILES) $(RS_RELEASE_BC) $(EXPORTED_FUNCTIONS) $(EXPORTED_RUNTIME_METHODS) $(ASYNCIFY_IMPORTS)
mkdir -p debug
$(EMCC) $(EMFLAGS_DEBUG) \
$(EMFLAGS_INTERFACES) \
$(EMFLAGS_LIBRARIES) \
$(EMFLAGS_JSPI) \
$(RS_WASM_TGT_DIR)/release/deps/*.bc \
$(OBJ_FILES_DEBUG) -o $@

## dist
Expand All @@ -233,24 +257,32 @@ clean-dist:
rm -rf dist

.PHONY: dist
dist: deps dist/crsqlite-sync.mjs dist/crsqlite.mjs
dist: dist/crsqlite-sync.mjs dist/crsqlite.mjs dist/crsqlite-jspi.mjs

FORCE: ;

dist/crsqlite-sync.mjs: $(OBJ_FILES_DIST) $(RS_RELEASE_BC) $(EXPORTED_FUNCTIONS) $(EXPORTED_RUNTIME_METHODS)
dist/crsqlite-sync.mjs: $(OBJ_FILES_DIST) $(JSFILES) $(RS_RELEASE_BC) $(EXPORTED_FUNCTIONS) $(EXPORTED_RUNTIME_METHODS)
mkdir -p dist
$(EMCC) $(EMFLAGS_DIST) \
$(EMFLAGS_INTERFACES) \
$(EMFLAGS_LIBRARIES) \
$(RS_WASM_TGT_DIR)/release/deps/*.bc \
$(RS_WASM_TGT_DIR)/release/deps/*.bc \
$(OBJ_FILES_DIST) -o $@

dist/crsqlite.mjs: $(OBJ_FILES_DIST) $(RS_RELEASE_BC) $(EXPORTED_FUNCTIONS) $(EXPORTED_RUNTIME_METHODS) $(ASYNCIFY_IMPORTS)
dist/crsqlite.mjs: $(OBJ_FILES_DIST) $(JSFILES) $(RS_RELEASE_BC) $(EXPORTED_FUNCTIONS) $(EXPORTED_RUNTIME_METHODS) $(ASYNCIFY_IMPORTS)
mkdir -p dist
$(EMCC) $(EMFLAGS_DIST) \
$(EMFLAGS_INTERFACES) \
$(EMFLAGS_LIBRARIES) \
$(EMFLAGS_ASYNCIFY_DIST) \
$(RS_WASM_TGT_DIR)/release/deps/*.bc \
$(RS_WASM_TGT_DIR)/release/deps/*.bc \
$(OBJ_FILES_DIST) -o $@

dist/crsqlite-jspi.mjs: $(OBJ_FILES_DIST) $(JSFILES) $(RS_RELEASE_BC) $(EXPORTED_FUNCTIONS) $(EXPORTED_RUNTIME_METHODS) $(ASYNCIFY_IMPORTS)
mkdir -p dist
$(EMCC) $(EMFLAGS_DIST) \
$(EMFLAGS_INTERFACES) \
$(EMFLAGS_LIBRARIES) \
$(EMFLAGS_JSPI) \
$(RS_WASM_TGT_DIR)/release/deps/*.bc \
$(OBJ_FILES_DIST) -o $@
37 changes: 18 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[![wa-sqlite CI](https://github.com/rhashimoto/wa-sqlite/actions/workflows/ci.yml/badge.svg?branch=breaking-changes)](https://github.com/rhashimoto/wa-sqlite/actions/workflows/ci.yml?branch=breaking-changes)
[![wa-sqlite CI](https://github.com/rhashimoto/wa-sqlite/actions/workflows/ci.yml/badge.svg)](https://github.com/rhashimoto/wa-sqlite/actions/workflows/ci.yml)

# wa-sqlite
This is a WebAssembly build of SQLite with experimental support for writing SQLite virtual filesystems and virtual table modules completely in Javascript. This allows alternative browser storage options such as IndexedDB and File System Access. Applications can opt to use either a synchronous or asynchronous (using Asyncify) SQLite library build (an asynchronous build is required for asynchronous extensions).
This is a WebAssembly build of SQLite with support for writing SQLite virtual filesystems completely in Javascript. This allows alternative browser storage options such as IndexedDB and Origin Private File System. Applications can opt to use either a synchronous or asynchronous (using Asyncify or JSPI) SQLite library build (an asynchronous build is required for asynchronous extensions).

[IndexedDB](https://github.com/rhashimoto/wa-sqlite/blob/master/src/examples/IDBMinimalVFS.js) and [Origin Private File System](https://github.com/rhashimoto/wa-sqlite/blob/master/src/examples/OriginPrivateFileSystemVFS.js) virtual file systems and a [virtual table module that accesses Javascript arrays](https://github.com/rhashimoto/wa-sqlite/blob/master/src/examples/ArrayModule.js) are among the examples provided as proof of concept.
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/) or run [benchmarks](https://rhashimoto.github.io/wa-sqlite/demo/benchmarks.html) 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,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/).

## 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 All @@ -19,20 +19,20 @@ If you do want to build yourself, here are the prerequisites:

* Building on Debian Linux is known to work, compatibility with other platforms is unknown.
* `yarn` - If you use a different package manager (e.g. `npm`) then file paths in the demo will need adjustment.
* [Emscripten SDK](https://emscripten.org/docs/getting_started/downloads.html) 3.1.25+.
* [Emscripten SDK](https://emscripten.org/docs/getting_started/downloads.html) 3.1.61+.
* `curl`, `make`, `openssl`, `sed`, `tclsh`, `unzip`

Here are the build steps:
* Make sure `emcc` works.
* `git clone [email protected]:rhashimoto/wa-sqlite.git`
* `cd wa-sqlite`
* `yarn install`
* `make` (or `yarn prepack`)
* `make`

The default build produces ES6 modules + WASM, [synchronous and asynchronous](https://github.com/rhashimoto/wa-sqlite/issues/7) (using Asyncify) in `dist/`.
The default build produces ES6 modules + WASM, [synchronous and asynchronous](https://github.com/rhashimoto/wa-sqlite/issues/7) (using Asyncify and JSPI) in `dist/`.

## API
Javascript wrappers for core SQLITE C API functions (and some others) are provided. Some convenience functions are also provided to reduce boilerplate. Here's sample code to load the library and call the API:
Javascript wrappers for core SQLITE C API functions (and some others) are provided. Some convenience functions are also provided to reduce boilerplate. Here is sample code to load the library and call the API:

```javascript
import SQLiteESMFactory from 'wa-sqlite/dist/crsqlite-sync.mjs';
Expand All @@ -51,25 +51,24 @@ Javascript wrappers for core SQLITE C API functions (and some others) are provid
hello();
```

The [implementation of `sqlite3.exec`](https://github.com/rhashimoto/wa-sqlite/blob/b5824ac0031da81712bee42671a917b252737c45/src/sqlite-api.js#L422-L434) may be of interest to anyone wanting more fine-grained use of SQLite statement objects (e.g. for binding parameters, explicit column datatypes, etc.).
There is a slightly more complicated example [here](https://github.com/rhashimoto/wa-sqlite/tree/master/demo/hello) that also shows how to use a virtual filesystem (VFS) for persistent storage.

The [implementation of `sqlite3.exec`](https://github.com/rhashimoto/wa-sqlite/blob/eb6e62584b2864d5029f51c6afe155d71ba0caa8/src/sqlite-api.js#L409-L418) may be of interest to anyone wanting more fine-grained use of SQLite statement objects (e.g. for binding parameters, explicit column datatypes, etc.).

[API reference](https://rhashimoto.github.io/wa-sqlite/docs/)

## Demo
To serve the demo directly from the source tree:
* `yarn start`
* Open a browser on http://localhost:8000/demo/

The demo page provides access to databases on multiple VFS implementations, including IndexedDB (which is the only one persistent across page loads and multiple tabs). In addition, in each database there is a SQLite module named "array" that provides some historical stock data from a common Javascript array - use it for virtual tables in SQL like this:
```sql
CREATE VIRTUAL TABLE IF NOT EXISTS goog USING array;
* Open a browser on http://localhost:8000/demo/?build=asyncify&config=IDBBatchAtomicVFS&reset

-- Use it directly out of the Javascript array:
SELECT * FROM goog LIMIT 5;
The demo page provides access to databases on multiple VFS implementations. Query parameters on the demo page URL can be used to specify the configuration and initial state:

-- Copy into a native table (on the current VFS):
CREATE TABLE IF NOT EXISTS tbl AS SELECT * FROM goog;
```
| 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 |
| 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
Loading