Mix compiler that walks every Musubi state do module exposed by the
current Mix project and writes one TypeScript bundle file with namespaces
mirroring the Elixir module tree.
Setup
Add :musubi_ts to the project's compiler chain:
def project do
[
...,
compilers: Mix.compilers() ++ [:musubi_ts]
]
endRunning mix compile then keeps the bundle in sync automatically. Invoke
the compiler directly with mix compile.musubi_ts if you want to regenerate
without a full project recompile.
Options
--check— exit non-zero with aMix.Task.Compiler.Diagnosticif the on-disk bundle differs from a freshly-rendered one. Wire this into aprecommit/ CI alias to gate drift:aliases: [ precommit: ["compile --warnings-as-errors", "compile.musubi_ts --check", ...] ]
Configuration
Output path defaults to priv/codegen/ts/musubi.ts. Override per-app:
config :musubi, :ts_codegen_output_path, "priv/codegen/ts/musubi.ts"Discovery
Every Musubi state do module ends up with a manifest entry under
Mix.Project.build_path()/musubi-codegen-ts/<inspect(module)>/state.term,
stamped at module-compile time by Musubi.Plugin.TypeScript's injected
@after_compile callback. This compiler simply lists those entries —
there is no beam scan or :application.get_key/2 walk. Modules whose
source lives under test/ (e.g. test/support/ fixtures) are skipped at
stamp time so they never appear in the bundle.