From a3d4afe5a800c78235aca5e53a92dcf67985e295 Mon Sep 17 00:00:00 2001 From: Simon Koudijs Date: Tue, 14 Jul 2026 09:29:18 +0000 Subject: [PATCH] feat(client): publish a single-file browser bundle as ./bundle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gitops-api embeds the client rather than bundling it: the Go server go:embeds the published ESM and serves it, with no npm, no node_modules and no bundler anywhere in that build. That is the constraint the library was designed around, and it works — but vendoring means copying all eleven files of dist/, because index.js imports ./store.js imports ./merge.js and the browser resolves that graph at runtime. Publish the graph flattened as well: dist/index.js unchanged, per-module, tree-shakeable dist/krm-stream.js same public API, one file, no relative imports addressable as @configbutler/krm-stream/bundle. A host with no bundler now vendors one file instead of eleven. esbuild is the fourth devDependency, and it carries the same one-line justification as the other three: it runs once per release here so that every no-bundler consumer does not each reinvent the step, it emits no polyfill and no runtime dependency, and no sourcemap — a host serving the file publicly should not have to serve a .map or field a console warning for not doing so. The browser suite now runs twice, once per entry point (chromium and chromium-bundle projects), against a real EventSource. "The bundle exports the same things" is a claim about a browser, not about a build log — if a flatten ever drops an export, the bundle project goes red on its own. Also fixes the package README, which still told npm readers the package "has not been published to npm yet". Co-Authored-By: Claude Opus 4.8 (1M context) --- Taskfile.yml | 13 +- examples/vanilla-browser/index.html | 19 +- examples/vanilla-browser/playwright.config.ts | 26 +- examples/vanilla-browser/tests/fixtures.ts | 30 ++ .../vanilla-browser/tests/live-krm.spec.ts | 26 +- packages/krm-stream/README.md | 28 +- packages/krm-stream/package-lock.json | 485 ++++++++++++++++++ packages/krm-stream/package.json | 11 +- 8 files changed, 606 insertions(+), 32 deletions(-) create mode 100644 examples/vanilla-browser/tests/fixtures.ts diff --git a/Taskfile.yml b/Taskfile.yml index 3b1793a..ecb6b21 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -191,15 +191,20 @@ tasks: # ------------------------------------------------------------------- build -- build-client: - desc: "Emit the dependency-free ESM bundle a browser can