fix: verify durable browser-safe exports

This commit is contained in:
Mario Zechner
2026-09-22 17:56:51 +02:00
parent 2c2cd636f3
commit 81274f0e18
2 changed files with 31 additions and 0 deletions
+25
View File
@@ -4,6 +4,7 @@ import { dirname, join, resolve } from "node:path";
import { build } from "esbuild";
const outputPath = join(tmpdir(), "pi-browser-smoke.js");
const durableOutputPath = join(tmpdir(), "pi-durable-browser-smoke.js");
const agentTreeshakeOutputPath = join(tmpdir(), "pi-agent-treeshake-smoke.js");
const errorLogPath = join(tmpdir(), "pi-browser-smoke-errors.log");
const generatedCatalogDataDir = join(process.cwd(), "packages/ai/src/providers/data");
@@ -51,6 +52,30 @@ try {
plugins: [generatedCatalogDataPlugin],
});
const durableBuild = await build({
entryPoints: ["scripts/durable-browser-smoke-entry.ts"],
bundle: true,
platform: "browser",
format: "esm",
logLevel: "silent",
metafile: true,
outfile: durableOutputPath,
write: false,
});
const durableInputs = durableBuild.metafile.inputs;
for (const expectedInput of [
"packages/durable/src/index.ts",
"packages/durable/src/storage/memory.ts",
"packages/durable/src/storage/sqlite/index.ts",
"packages/durable/src/storage/sqlite/storage.ts",
]) {
if (!findInput(durableInputs, expectedInput)) {
throw new Error(`Durable browser bundle does not include ${expectedInput}`);
}
}
const nodeAdapter = findInput(durableInputs, "packages/durable/src/storage/sqlite/node.ts");
if (nodeAdapter) throw new Error(`Durable browser bundle unexpectedly includes ${nodeAdapter}`);
const agentTreeshakeBuild = await build({
entryPoints: ["scripts/agent-treeshake-smoke-entry.ts"],
bundle: true,
+6
View File
@@ -0,0 +1,6 @@
import * as durable from "@earendil-works/pi-durable";
import * as sqlite from "@earendil-works/pi-durable/storage/sqlite";
// Keep both runtime-neutral public entry points live so the browser smoke build
// catches accidental imports of Node-only adapters or built-ins.
console.log(Object.keys(durable), Object.keys(sqlite));