browser-db-sqlite-persistence: option to load the wa-sqlite WASM by URL instead of inlined base64
Mantenedores costumam responder em até 1 dia
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 35/100
- Tipo de issue
- Funcionalidade
- Clareza
- Razoavelmente clara
- Status de atividade
- Ativa
- Stack de tecnologia
- sqlite, typescript, wasm
Direção de pesquisa
Start in src/opfs-worker.ts, where SQLiteESMFactory() is called with no options, and in the openBrowserWASQLiteOPFSDatabase entry point that creates the worker. Pick one of the three proposed approaches (a wasmUrl/locateFile option, a createWorker option, or an unInlined WASM asset) and confirm it with the maintainers first, since the issue leaves the choice open. Done means a consumer can supply the WASM location and the worker loads it without the inlined base64 build.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
What
@tanstack/browser-db-sqlite-persistence (seen on 0.2.30) ships its OPFS worker prebuilt as dist/assets/opfs-worker-*.js, with wa-sqlite's WebAssembly inlined as a data:application/wasm;base64,… URL. That makes the worker about 1.7 MB raw (about 573 KB brotli). Most of that is the base64 WASM, which compresses worse than the binary and cannot be compiled by WebAssembly.instantiateStreaming.
src/opfs-worker.ts calls SQLiteESMFactory() with no options, and the package offers no option to pass a locateFile, a wasmBinary or a worker of one's own.
Ask
An option for where the WASM comes from. Any of these would do:
- a
wasmUrl(orlocateFile) option onopenBrowserWASQLiteOPFSDatabase, passed to the worker and on toSQLiteESMFactory({ locateFile }); - a
createWorkeroption, so an app can build the worker from source with its own bundler; - or ship the worker without inlining the WASM, since
@journeyapps/wa-sqlitealready resolvesnew URL("wa-sqlite.wasm", import.meta.url), which Vite, Rollup and webpack all emit as a separate asset.
What we do meanwhile
We patch dist/esm/opfs-worker.js so the consumer's Vite build makes the worker from the package's own source:
function WorkerWrapper(options) {
return new Worker(new URL("../../src/opfs-worker.ts", import.meta.url), {
type: "module",
name: options?.name
});
}
With Vite 8 that gives an 88 KB worker plus a separate 1,129,661 B wa-sqlite-*.wasm: 468 KB brotli in total instead of 573 KB, compiled by streaming. It works in dev too, because Vite's dep optimizer rewrites the worker URL. We would like to drop the patch once the package has an option for it.
- Linguagem predominante
- TypeScript
- Estrelas
- 4k
- Forks
- 277
- Merge médio
- 1d 7h
- PRs com merge (30d)
- 176
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de TanStack/db
-
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 88/100
Mantenedores costumam responder em até 1 dia
-
OfflineExecutor.dispose() never settles pendingTransactionPromisesTalvez livre de novo @Claire-ovo assumiu há 9 dias e não há nenhum pull request aberto. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
TanStack/db#2254 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
Two @tanstack/db tests time out under CPU load because a cold module import counts against the 5 s default timeoutTalvez já em andamento @jp-knj assumiu há 7 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 52/100
Mantenedores costumam responder em até 1 dia
Todas as issues de TanStack/db
Issues semelhantes
-
apps/stage-web bug env/os-linux pending triage scope/audio-output
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
Mantenedores costumam responder em até 1 dia
-
reproduced
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
anomalyco/opencode#61640 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
scope: data grid status: waiting for maintainer
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
mui/mui-x#24090 · 1 comentário ·
Mantenedores costumam responder em até 2 dias
-
ai-driven-fuzzing bug Minor
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
Mantenedores costumam responder em até 1 dia
-
ai-driven-fuzzing bug claude Minor
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
linagora/twake-calendar-frontend#1944 ·
Mantenedores costumam responder em até 1 dia