browser-db-sqlite-persistence: option to load the wa-sqlite WASM by URL instead of inlined base64
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- sqlite, typescript, wasm
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 3.9k
- Forks
- 272
- Merge medio
- 1 d 1 h
- PR fusionados (30 d)
- 210
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de TanStack/db
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 5/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
electric-db-collection: on-demand + persistence fails after relaunch with "Snapshot requests are not supported in full mode"Posiblemente ocupada @KyleAMathews la tomó hace 3 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
TanStack/db#2056 · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
TanStack/db#1972 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de TanStack/db
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
JoviDeCroock/pracht#432 ·
Los mantenedores suelen responder en 1 día
-
Add: CNN en Espanol SDAbiertoapproved check:passed streams:add
Dificultad 1/5 Menos de una hora Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
Hardware attribute name "app Connection Support" has inconsistent casingPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
walletbeat/walletbeat#1628 ·
Los mantenedores suelen responder en 1 día
-
bug go
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
genkit-ai/genkit#6761 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
NousResearch/hermes-agent#136483 ·
Los mantenedores suelen responder en 1 día