Repository navigation
Closed
Labels
epic:surfacesEpic: behold as an infrastructure viewer inside other tools (INTENTIUS/behold#1049)wave:2Wave 2 of an epic's rollout: can start once earlier waves land
Description
The single-file viewer has to lay out and paint in the page, because a host that only passes a graph document cannot ask a server for SVG. behold's painter already bundles small, but it still pulls in Node built-ins through a few imports. This issue removes them in behold and in pinhole. Part of #1049, phase 2.
Today
renderGraph(src/render.ts:434) lays out with pinhole'slayoutIrand paints with itsrenderSvg, plus behold's edge routing.- A scoping bundle of
renderGraphwith pinhole for the browser came to 126 KB minified, 45 KB gzipped, but still importednode:fs,node:path,node:url,node:child_processandnode:module. - On
origin/mainthose come from:src/icon-packs.ts:25-27, which reads icon files from disk withreadFileSync(line 145);src/choudoufu-member.ts:36-37(spawn,node:fs), imported bysrc/render.ts:31for a constant and card fields; and pinhole 0.5.0, whose rootsrc/index.ts:3re-exportsgraphIrfromsrc/chant.ts, which importsnode:child_process,node:module,node:fsandnode:path. - Scoping also found
@kubernetes/client-nodein the bundle's resolution throughsrc/k8s-target.ts. Onorigin/mainthat file importsKubeconfigViewas a type only (line 48), so this chain may already be gone. A fresh bundle will tell.
Change
- Icons as a generated module, written by a script and checked in CI the way
generate:graph-layoutandcheck:graph-layoutare, in place of disk reads at load. - Move what
src/render.tstakes fromsrc/choudoufu-member.tsinto a module with no Node imports. - In pinhole, move the chant CLI wrapper to its own subpath export (for example
@intentius/pinhole/chant) so the root entry imports nonode:*. Release pinhole and bump it in behold. - A CI step that bundles
src/render.tswith esbuild for--platform=browser, fails on anynode:import, and prints the minified and gzipped sizes.
Done when
- The CI bundle step exits 0 and its log shows the sizes.
- pinhole's root entry bundles for the browser on its own (pinhole CI).
/api/graphSVG forexample-terraform-estateis byte-identical before and after (snapshot test).- Icons still draw in an export of a fixture with AWS, GCP and Kubernetes cards.
Depends on
Nothing. Scoping listed it after #1057, but the files it changes sit outside the pipeline #1057 moves out of src/server.ts. If #1057 is in flight, rebase on it.
Not in this issue
Layout in a Web Worker and the viewer bundle (the single-file viewer build).
Metadata
Metadata
Assignees
Labels
epic:surfacesEpic: behold as an infrastructure viewer inside other tools (INTENTIUS/behold#1049)wave:2Wave 2 of an epic's rollout: can start once earlier waves land
Activity
feat: estate-read batch 1, readGraph, graph document, contract kinds,…
feat!: the chant CLI wrapper moves to @intentius/pinhole/chant, and t…
build: pinhole 0.6.0, the painter and viewer build for a browser in C…