Skip to content

Commit 9428ad9

Browse files
authored
Drift web support (#55)
* Import sqlite3_common for web * Bump version * Add web instructions for drift * Bump version * Pin drift version * Lower drift version * Drift version bounds
1 parent b4c38b7 commit 9428ad9

File tree

5 files changed

+46
-13
lines changed

5 files changed

+46
-13
lines changed

CHANGELOG.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,23 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
1111

1212
Packages with breaking changes:
1313

14-
- There are no breaking changes in this release.
14+
- There are no breaking changes in this release.
1515

1616
Packages with other changes:
1717

18-
- [`sqlite_async` - `v0.8.1`](#sqlite_async---v081)
19-
- [`drift_sqlite_async` - `v0.1.0-alpha.3`](#drift_sqlite_async---v010-alpha3)
18+
- [`sqlite_async` - `v0.8.1`](#sqlite_async---v081)
19+
- [`drift_sqlite_async` - `v0.1.0-alpha.4`](#drift_sqlite_async---v010-alpha4)
2020

2121
Packages with dependency updates only:
2222

2323
> Packages listed below depend on other packages in this workspace that have had changes. Their versions have been incremented to bump the minimum dependency versions of the packages they depend upon in this project.
2424
25-
- `drift_sqlite_async` - `v0.1.0-alpha.3`
25+
#### `drift_sqlite_async` - `v0.1.0-alpha.4`
26+
27+
- **FEAT**: web support.
2628

2729
---
2830

2931
#### `sqlite_async` - `v0.8.1`
3032

31-
- **FEAT**: use navigator locks.
32-
33+
- **FEAT**: use navigator locks.

packages/drift_sqlite_async/CHANGELOG.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
## 0.1.0-alpha.4
2+
3+
- Import `sqlite3_common` instead of `sqlite3` for web support.
4+
15
## 0.1.0-alpha.3
26

3-
- Update a dependency to the latest release.
7+
- Update a dependency to the latest release.
48

59
## 0.1.0-alpha.2
610

packages/drift_sqlite_async/README.md

+22-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
`drift_sqlite_async` allows using drift on an sqlite_async database - the APIs from both can be seamlessly used together in the same application.
44

55
Supported functionality:
6+
67
1. All queries including select, insert, update, delete.
78
2. Transactions and nested transactions.
89
3. Table updates are propagated between sqlite_async and Drift - watching queries works using either API.
910
4. Select queries can run concurrently with writes and other select statements.
1011

11-
1212
## Usage
1313

1414
Use `SqliteAsyncDriftConnection` to create a DatabaseConnection / QueryExecutor for Drift from the sqlite_async SqliteDatabase:
@@ -59,4 +59,24 @@ These events are only sent while no write transaction is active.
5959

6060
Within Drift's transactions, Drift's own update notifications will still apply for watching queries within that transaction.
6161

62-
Note: There is a possibility of events being duplicated. This should not have a significant impact on most applications.
62+
Note: There is a possibility of events being duplicated. This should not have a significant impact on most applications.
63+
64+
## Web
65+
66+
Note: Web support is currently in Beta.
67+
68+
Web support requires Sqlite3 WASM and web worker Javascript files to be accessible. These file need to be put into the `web/` directory of your app.
69+
70+
The compiled web worker files can be found in our Github [releases](https://github.com/powersync-ja/sqlite_async.dart/releases)
71+
The `sqlite3.wasm` asset can be found [here](https://github.com/simolus3/sqlite3.dart/releases)
72+
73+
In the end your `web/` directory will look like the following
74+
75+
```
76+
web/
77+
├── favicon.png
78+
├── index.html
79+
├── manifest.json
80+
├── db_worker.js
81+
└── sqlite3.wasm
82+
```

packages/drift_sqlite_async/lib/src/executor.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import 'dart:async';
22

33
import 'package:drift/backends.dart';
44
import 'package:drift_sqlite_async/src/transaction_executor.dart';
5-
import 'package:sqlite_async/sqlite3.dart';
5+
import 'package:sqlite_async/sqlite3_common.dart';
66
import 'package:sqlite_async/sqlite_async.dart';
77

88
class _SqliteAsyncDelegate extends DatabaseDelegate {

packages/drift_sqlite_async/pubspec.yaml

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: drift_sqlite_async
2-
version: 0.1.0-alpha.3
2+
version: 0.1.0-alpha.4
33
homepage: https://github.com/powersync-ja/sqlite_async.dart
44
repository: https://github.com/powersync-ja/sqlite_async.dart
55
description: Use Drift with a sqlite_async database, allowing both to be used in the same application.
@@ -14,12 +14,20 @@ topics:
1414
environment:
1515
sdk: ">=3.0.0 <4.0.0"
1616
dependencies:
17-
drift: ^2.15.0
17+
drift: ">=2.15.0 <2.19.0"
1818
sqlite_async: ^0.8.1
1919
dev_dependencies:
2020
build_runner: ^2.4.8
21-
drift_dev: ^2.15.0
21+
drift_dev: ">=2.15.0 <2.19.0"
2222
glob: ^2.1.2
2323
sqlite3: ^2.4.0
2424
test: ^1.25.2
2525
test_api: ^0.7.0
26+
27+
platforms:
28+
android:
29+
ios:
30+
linux:
31+
macos:
32+
windows:
33+
web:

0 commit comments

Comments
 (0)