Hologram Elixir -> JS compilation

Hi Lucas!

I’m really happy that you found a project where you can try Hologram! :slight_smile: Your use case sounds like a perfect fit.

Your understanding is largely correct, with some additional details:

LUT: right!

Call tracing: Correct that calls are traced from pages, but the entry points aren’t just actions. For each page, Hologram traces from multiple entry points:

  • action/3 (user interactions)
  • template/0 (rendering)
  • __params__/0, __route__/0 (routing functions)
  • Plus similar functions for the layout module

When you call MyModule.foobar from any of these entry points, the entire reachable call graph gets included. There’s also special handling for:

  • Components: Automatically includes __props__/0, action/3, init/2, template/0
  • Protocols: Includes all protocol implementations
  • Structs: Includes __struct__/0 and __struct__/1
  • Apply calls: Can be determined for some cases

Page-specific JS: Correct - each page gets its own bundle with only the functions reachable from that page. Some commonly used functions go in the shared runtime bundle instead.

Function pruning: Yes, but it happens at the call graph level before transpilation - only reachable functions get transpiled to JavaScript at all.

Note that anything called from client-side actions gets compiled to JavaScript and runs in the browser. For server-side operations, you’d use commands instead of actions.

If you think something is unclear in the docs or should be added (like those examples you mentioned), I’m always open for such contributions :slight_smile:

And don’t hesitate to reach out if something doesn’t work or if you find that some feature is missing - I’m here to help.

Looking forward to hearing how it goes with your research project!