Testversion: Datenbankabbild als .wasm ausliefern
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AmyPfuNc4sCRfaF3oURXZz
This commit is contained in:
@@ -24,7 +24,8 @@ async function pglite(): Promise<PGlite> {
|
|||||||
const [wasm, initdb, daten] = await Promise.all([
|
const [wasm, initdb, daten] = await Promise.all([
|
||||||
modul("pglite.wasm"),
|
modul("pglite.wasm"),
|
||||||
modul("initdb.wasm"),
|
modul("initdb.wasm"),
|
||||||
fetch(adresse("pglite.data")).then((r) => { if (!r.ok) throw new Error(`pglite.data: ${r.status}`); return r.blob(); }),
|
// Dateisystem-Abbild von Postgres (pglite.data, beim Bauen umbenannt)
|
||||||
|
fetch(adresse("pglite-data.wasm")).then((r) => { if (!r.ok) throw new Error(`pglite-data.wasm: ${r.status}`); return r.blob(); }),
|
||||||
]);
|
]);
|
||||||
return PGlite.create({ pgliteWasmModule: wasm, initdbWasmModule: initdb, fsBundle: daten, parsers: PARSER } as ConstructorParameters<typeof PGlite>[1] & object);
|
return PGlite.create({ pgliteWasmModule: wasm, initdbWasmModule: initdb, fsBundle: daten, parsers: PARSER } as ConstructorParameters<typeof PGlite>[1] & object);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,10 @@ await build({
|
|||||||
minify: true,
|
minify: true,
|
||||||
logLevel: "warning",
|
logLevel: "warning",
|
||||||
});
|
});
|
||||||
for (const f of ["pglite.wasm", "initdb.wasm", "pglite.data"]) await cp(`node_modules/@electric-sql/pglite/dist/${f}`, `dist/demo/${f}`);
|
// pglite.data heißt .wasm, weil Artifacts keine .data-Dateien ausliefern
|
||||||
|
for (const [f, ziel] of [["pglite.wasm"], ["initdb.wasm"], ["pglite.data", "pglite-data.wasm"]]) {
|
||||||
|
await cp(`node_modules/@electric-sql/pglite/dist/${f}`, `dist/demo/${ziel ?? f}`);
|
||||||
|
}
|
||||||
const js = (await readFile("dist/demo/app.js", "utf8")).replaceAll("</script", "<\\/script");
|
const js = (await readFile("dist/demo/app.js", "utf8")).replaceAll("</script", "<\\/script");
|
||||||
const logo = `data:image/png;base64,${(await readFile("src/web/bilder/logo.png")).toString("base64")}`;
|
const logo = `data:image/png;base64,${(await readFile("src/web/bilder/logo.png")).toString("base64")}`;
|
||||||
const seite = (await readFile("demo/index.html", "utf8"))
|
const seite = (await readFile("demo/index.html", "utf8"))
|
||||||
|
|||||||
Reference in New Issue
Block a user