Web: replacing the jeep-sqlite engine with @sqlite.org/sqlite-wasm + OPFS (complete implementation with tests and a data migration; offering it upstream)
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 25/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- sqlite, typescript, wasm
调研方向
从 feat/web-sqlite-wasm 分支开始,并结合 definitions.ts 检查 Web 实现。针对两个持久化层,在真实的 Chromium 中运行 259 个 Vitest 浏览器测试,然后检查迁移和现有的 CI 连接。完成的标准是方法和事件保持对等、迁移安全、记录浏览器最低版本,并且在不修改原生包装器的情况下测试通过。
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- Swift
- 星标
- 663
- 派生
- 159
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
capacitor-community/sqlite 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 72/100
capacitor-community/sqlite#700 · 1 条评论 · 1 个 reaction ·
-
bug/fix needs: triage
难度 3/5 1-2 天 新手友好度 68/100
capacitor-community/sqlite#690 ·
-
feature needs: triage
难度 3/5 1-2 天 新手友好度 55/100
capacitor-community/sqlite#689 ·
-
bug/fix needs: triage
难度 3/5 1-2 天 新手友好度 45/100
capacitor-community/sqlite#685 ·
-
bug/fix needs: triage
难度 3/5 1-2 天 新手友好度 48/100
capacitor-community/sqlite#671 ·
查看 capacitor-community/sqlite 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 65/100
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
jamesmontemagno/tiny-clips#378 · 2 条评论 ·
维护者通常 1 天内回复
-
area: agents area: cli bug difficulty:2 help wanted S3: minor
难度 2/5 1-3 小时 新手友好度 82/100
manaflow-ai/cmux#15718 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
mozilla-mobile/firefox-ios#35850 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
lognorman20/monaco#998 ·