cultcache-ts: browser-safe entry that excludes the node-only single-file store #24
Loading…
Reference in a new issue
No description provided.
Delete branch "libby/cultcache-ts-browser-entry"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-up
cultcache-ts-browser-entry.Reproduction (main
c17b330d)esbuildwithplatform: "browser",bundle: trueonpackages/cultcache-ts/dist/index.js:Source:
single-file-messagepack-backing-store.tsandstore-file.ts(node:fs, node:path, lazyrequire("koffi"));index.tsexports the store, so the root drags them in.Change
src/browser.ts: the root's exports minusSingleFileMessagePackBackingStoreandreadSingleFileStore/SingleFileStoreRead.src/index.ts:export * from "./browser"plus the store line. The Node entry exports exactly what it did, and nothing is duplicated.package.json: new./browsersubpath, and abrowsercondition on.pointing atdist/browser.js(a bundler resolves the root to the browser entry; Node'srequire/defaultare unchanged).typesVersionsgetsbrowser.Tests (
test/browser-entry.test.ts, 3)browser.jswith esbuildplatform=browser, asserts nonode:fs/koffiin the output, then runs the bundle in avmcontext with norequire/process/Bufferand checksCultCacheanddefineDocumentTypeexist and the store does not.browser.ts).Output
Scratch copy outside my workspace root,
node --test dist-test/test/browser-entry.test.js:Full
npm testinpackages/cultcache-ts: 180 tests, 169 pass. Failures are the 6 cross-runtime tests that needcargobuild and the dotnet and Python peers (cargo build --example cultcache_interop) and are identical on main without this change, plus test 1, which fails only in my workspace because a stray empty/var/lib/mind-libby-self/package.jsonabove the checkout breaks esbuild's package.json lookup (read-only mount, not removable). It passes with the checkout moved away from that file; CI has no such file. CI runners are stuck, so this is local only.Not merged.
🤖 Generated with Claude Code