From 486351386061a984c3a4fbaf97f4363ba3554013 Mon Sep 17 00:00:00 2001 From: Simon Binder Date: Mon, 12 Aug 2024 12:14:30 +0200 Subject: [PATCH] Backport package:web upgrade for drift 2.19.2 --- drift/CHANGELOG.md | 4 ++++ drift/lib/src/web/wasm_setup.dart | 4 ++-- drift/lib/src/web/wasm_setup/shared.dart | 2 +- drift/lib/src/web/wasm_setup/shared_worker.dart | 2 +- drift/pubspec.yaml | 4 ++-- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/drift/CHANGELOG.md b/drift/CHANGELOG.md index 734c1612c..fd691ff20 100644 --- a/drift/CHANGELOG.md +++ b/drift/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.19.2 + +- Support version `1.x` of `package:web`. + ## 2.19.1 - Fix `exclusively` breaking the database connection on the web. Please note diff --git a/drift/lib/src/web/wasm_setup.dart b/drift/lib/src/web/wasm_setup.dart index 82bc58853..a5f38845f 100644 --- a/drift/lib/src/web/wasm_setup.dart +++ b/drift/lib/src/web/wasm_setup.dart @@ -108,7 +108,7 @@ class WasmDatabaseOpener { Future _probeDedicated() async { if (supportsWorkers) { final dedicatedWorker = _dedicatedWorker = - _DriftWorker.dedicated(web.Worker(driftWorkerUri.toString())); + _DriftWorker.dedicated(web.Worker(driftWorkerUri.toString().toJS)); _createCompatibilityCheck().sendTo(dedicatedWorker.send); final status = await dedicatedWorker.workerMessages.nextNoError @@ -134,7 +134,7 @@ class WasmDatabaseOpener { Future _probeShared() async { if (supportsSharedWorkers) { final sharedWorker = - web.SharedWorker(driftWorkerUri.toString(), 'drift worker'.toJS); + web.SharedWorker(driftWorkerUri.toString().toJS, 'drift worker'.toJS); final port = sharedWorker.port; final shared = _sharedWorker = _DriftWorker.shared(sharedWorker, port); diff --git a/drift/lib/src/web/wasm_setup/shared.dart b/drift/lib/src/web/wasm_setup/shared.dart index 77c83e1e9..44afcca9b 100644 --- a/drift/lib/src/web/wasm_setup/shared.dart +++ b/drift/lib/src/web/wasm_setup/shared.dart @@ -328,7 +328,7 @@ class DriftServerController { final options = WasmVfs.createOptions( root: pathForOpfs(databaseName), ); - final worker = Worker(Uri.base.toString()); + final worker = Worker(Uri.base.toString().toJS); StartFileSystemServer(options).sendToWorker(worker); diff --git a/drift/lib/src/web/wasm_setup/shared_worker.dart b/drift/lib/src/web/wasm_setup/shared_worker.dart index c1a183877..512364493 100644 --- a/drift/lib/src/web/wasm_setup/shared_worker.dart +++ b/drift/lib/src/web/wasm_setup/shared_worker.dart @@ -83,7 +83,7 @@ class SharedDriftWorker { version: ProtocolVersion.current, ); } else { - final worker = _dedicatedWorker ??= Worker(Uri.base.toString()); + final worker = _dedicatedWorker ??= Worker(Uri.base.toString().toJS); // Ask the worker about the storage implementations it can support. RequestCompatibilityCheck(databaseName).sendToWorker(worker); diff --git a/drift/pubspec.yaml b/drift/pubspec.yaml index 6a54784f5..39d9e1832 100644 --- a/drift/pubspec.yaml +++ b/drift/pubspec.yaml @@ -1,6 +1,6 @@ name: drift description: Drift is a reactive library to store relational data in Dart and Flutter applications. -version: 2.19.1 +version: 2.19.2 repository: https://github.com/simolus3/drift homepage: https://drift.simonbinder.eu/ issue_tracker: https://github.com/simolus3/drift/issues @@ -18,7 +18,7 @@ dependencies: sqlite3: ^2.4.3 path: ^1.8.0 stack_trace: ^1.11.1 - web: ^0.5.0 + web: ^1.0.0 dev_dependencies: archive: ^3.3.1