Web: replacing the jeep-sqlite engine with @sqlite.org/sqlite-wasm + OPFS (complete implementation with tests and a data migration; offering it upstream)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- sqlite, typescript, wasm
Hướng nghiên cứu
Bắt đầu với branch feat/web-sqlite-wasm và xem xét triển khai web cùng với definitions.ts. Chạy 259 bài kiểm thử trình duyệt của Vitest trong Chromium thực cho cả hai tầng persistence, sau đó kiểm tra migration và phần kết nối CI hiện có. Được xem là hoàn tất khi đạt parity về method và event, migration an toàn, các phiên bản trình duyệt tối thiểu được tài liệu hóa và các bài kiểm thử đều đạt mà không thay đổi các native wrapper.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary. The web implementation forwards every call to jeep-sqlite (sql.js in-memory, whole-database images in a localforage IndexedDB store). jeep-sqlite's last publish is 2.8.0 (August 2024), the ^2.7.2 pin here has not moved since June 2024, and the web layer has no test coverage in CI. The official @sqlite.org/sqlite-wasm now offers an OPFS VFS (opfs-sahpool) that needs no COOP/COEP headers and no SharedArrayBuffer, which makes a proper, durable web engine possible for exactly the deployments this plugin serves.
We maintain a Capacitor reading app that depends on this plugin, and we have built and are running a complete replacement of the web implementation. We would like to contribute it.
What it is.
- All SQL runs in a dedicated worker on
@sqlite.org/sqlite-wasm. Databases are durable OPFS files viaopfs-sahpool: no COOP/COEP, no SharedArrayBuffer, works on ordinary hosting. - Automatic fallback tier for browsers without OPFS sync access handles: the same engine with whole-image IndexedDB persistence (jeep's durability model), so FTS5 and behavior are identical on both tiers. Floors are measured and documented, including the syntax floor below which the wasm bundle cannot parse at all.
- A one-time, transparent migration of existing users' data out of the jeep store: raw IndexedDB read,
PRAGMA integrity_checkon every database, at-most-once by design, never overwrites, tolerates jeep'sbackup-*keys and never-saved placeholders. Interrupted migrations cannot corrupt anything. - Full method parity for all 36 web-supported methods and all five web events, driven through the unmodified
SQLiteConnection/SQLiteDBConnectionwrappers. Read-only connections become real on web.definitions.tssignatures are untouched, so there is zero impact on iOS, Android or Electron. - 259 tests in vitest browser mode (real Chromium) parameterized over both tiers, wired into the existing CI build.
- The worker ships as a classic script, so Firefox 111-113 (OPFS but no module workers) still works. Docs are swept: no element to define, no extra packages, no
sql-wasm.wasmcopy step.
Defects found in the current lineage while porting (fixed on our branch; we are happy to file the pieces that affect other platforms as standalone issues): the soft-delete rewrite performs a REAL delete when the table name is double-quoted; an unbracketed WHERE lets AND bind over OR and re-marks already-deleted rows; execute() bypasses soft-delete entirely; foreign-key enforcement was never enabled on web (PRAGMA foreign_keys defaults OFF), so declared constraints were silently ignored; and the foreign-key cascade logic misses referencing tables and deeper levels (that one also affects Electron).
The one breaking change, clearly marked in the branch as fix(web)!: foreign keys are now enforced on web connections. Apps whose data violates their declared schema will begin receiving constraint errors. We flag it for your versioning call.
What we ask. Is there interest in a PR? The branch is kklem0/sqlite:feat/web-sqlite-wasm, a reviewed series of conventional commits that each build. We are happy to split or reshape it however review works best for you. In the meantime we are publishing the fork as sssf-capacitor-sqlite so our app can ship, with the explicit goal of retiring it into upstream.
- Ngôn ngữ chính
- Swift
- Star
- 661
- Fork
- 158
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của capacitor-community/sqlite
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
capacitor-community/sqlite#700 · 1 bình luận · 1 reaction ·
-
bug/fix needs: triage
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
capacitor-community/sqlite#690 ·
-
feature needs: triage
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
capacitor-community/sqlite#689 ·
-
bug/fix needs: triage
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
capacitor-community/sqlite#685 ·
-
bug/fix needs: triage
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
capacitor-community/sqlite#671 ·
Tất cả issue của capacitor-community/sqlite
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area:dictation bug P2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
uttrflow/uttrflow-swift#2721 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[@capacitor/app] iOS: 'Expression implicitly coerced from String? to Any' warning in getAppLanguageĐang mởtriage
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
ionic-team/capacitor-plugins#2604 ·
-
auth type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
googleapis/google-cloud-swift#1260 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Catalog audit: broken entriesĐang mởcatalog-audit
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày