Tier 2 spike: compiles ORDINARY Hologram components into standalone, host-agnostic bundles by driving Hologram's own compiler pipeline.
Approach (item 1 of the spike brief — "synthetic stub page"):
- a throwaway stub page + layout per target component is generated, compiled to BEAM in a scratch dir and loaded into the VM,
- the exact pipeline of
Mix.Tasks.Compile.Hologramis replayed against ONLY those stub pages —build_ir_plt→build_call_graph→list_async_mfas→ clone +remove_manually_ported_mfas→list_runtime_mfas→remove_runtime_mfas!→build_page_js/build_runtime_js, - the emitted page JS gets string surgery: the
globalThis.Hologram.pageReachableFunctionDefs = (deps) => {...}assignment becomes a plainconst tesseraDefs = (deps) => {...}+export default, and thepageScriptLoadeddispatch tail is stripped — so a component bundle NEVER touches the page-globalglobalThis.Hologramobject a host page may already own.
Internals dependence (documented deliberately)
Everything used is PUBLIC API of the 0.10.1 hex package
(Hologram.Compiler.*, Hologram.Compiler.CallGraph.*), but it is
pre-1.0 public API, and the string surgery anchors on the exact emitted
statements:
import PerformanceTimer from .../const startTime = ...header linesglobalThis.Hologram.pageReachableFunctionDefs = (deps) => {(page entry)globalThis.Hologram.pageScriptLoaded = true;(page entry tail)document.addEventListener("hologram:pageScriptLoaded", ...)(runtime entry tail)static #defineManuallyPortedFunctions() {(body extracted verbatim fromassets/js/hologram.mjsso the ~33 manual registrations stay in sync with upstream instead of being duplicated here)
Any of those drifting makes the compile fail loudly (anchored splits raise) rather than silently producing broken bundles.
Summary
Functions
Compiles the tessera runtime + one bundle set per given component module.
Functions
Compiles the tessera runtime + one bundle set per given component module.
Options:
:out— output dir (default:priv/static/tessera-holounder cwd)
Writes into out:
tessera-runtime.esm.js/tessera-runtime.umd.js— the shared runtime (Hologram client runtime exactly once + tessera shim)<base>.esm.js/<base>.umd.jsper component — only that component's compiled Elixir + a runtime-free registrar<base>.standalone.esm.js— runtime + component in one filemanifest.json— hologram version, prop contracts, file sizes