I drive the hot-reload pipeline: write source to disk, compile, persist beam files, broadcast events, and return a payload that GT-side subscribers can re-render from directly.
See reload/2 for the full sequence and the recompiled payload
shape carried back to the GT side.
Summary
Functions
I return the compile dependency graph as {from, to, label} edges.
I drop mod from the BEAM so a stale loaded copy does not survive
source-file deletion, then broadcast :source_removed. GT-side
caches subscribe to that event and drop their derived state.
I hot-reload a source file and its dependents.
Functions
I return the compile dependency graph as {from, to, label} edges.
Edges represent: changing to forces recompilation of from.
Label is :compile, :export, or :runtime.
@spec purge_module(module()) :: :ok
I drop mod from the BEAM so a stale loaded copy does not survive
source-file deletion, then broadcast :source_removed. GT-side
caches subscribe to that event and drop their derived state.
I hot-reload a source file and its dependents.
- Writes
contenttopathand formats it - Compiles the dep's full source tree via ParallelCompiler (excludes the currently running eval module)
- Persists compiled beams to ebin
- Recompiles the main project via IEx.Helpers.recompile
- Broadcasts a
%GtBridge.Events.ModuleEvent{kind: :recompiled}for each module that was compiled. On parse/compile failure, broadcasts a%ModuleEvent{kind: :compile_failed}and reraises.
Returns %{recompiled: [payload]} where each payload is a map. Every
module compiled from the saved file carries mod, source_hash, and
functions (the Analysis.all_functions/1 result, scoped to that
module) inline, so each module's GT-side cache re-renders from the
announcement without a follow-up bridge call. A sibling or nested
module gets refreshed too, not just the file's first module. Modules
from ParallelCompiler propagation of other files arrive bare
(%{mod: name, source_hash: nil, functions: nil})
and let any subscribers fall back to refetching on demand.
Returns :ok regardless of success/failure; subscribers learn the
outcome via the broadcast events (:source_written, :recompiled,
:compile_failed). No GT-side caller inspects the response.