# `PhoenixReplay.Recording.Code`
[🔗](https://github.com/elixir-vibe/phoenix_replay/blob/v0.6.2/lib/phoenix_replay/recording/code.ex#L1)

Which code a recording was made with, as its `code`, so the player can
say what changed since.

Replay renders today's code with the assigns recorded then. A recording
keeps:

  * `release` — the name of the deploy, from the `:release` config, such
    as a commit, or the version of the view's application. For people
    and the recording list's filter; nothing is decided by it.
  * `modules` — the MD5 of each module that rendered the session, its
    view and its LiveComponents, as `module_info(:md5)` gives it, which
    changes whenever the module's code does.
  * `migration` — the newest `PhoenixReplay.Migration` the app had,
    whose newer ones replay applies, or `nil` without any.
  * `deps` — the versions of the dependencies that render: Phoenix,
    LiveView, `phoenix_html`, `phoenix_template`, and any direct
    dependency of the view's application built on LiveView, such as a
    component library. One that comes in through another dependency is
    not covered.

Modules and dependencies are kept by name, as strings, not as atoms:
stored recordings decode only atoms the node knows, so a module deleted
since would otherwise make every recording naming it unreadable. One the
node no longer has counts as changed.

Reading them costs a few function calls when a session starts; the
dependency versions are read once per application.

# `changes`

```elixir
@type changes() :: %{
  modules: [String.t()],
  deps: [{String.t(), String.t(), String.t() | nil}]
}
```

What changed since a recording, as `changes/1` tells, by name.

# `t`

```elixir
@type t() :: %{
  release: String.t() | nil,
  modules: %{required(String.t()) =&gt; String.t()},
  migration: pos_integer() | nil,
  deps: %{required(String.t()) =&gt; String.t()}
}
```

# `changes`

```elixir
@spec changes(t() | nil) :: changes()
```

What changed since the recording was made, by name: its modules whose
code is different now, or that are gone, and its rendering dependencies
at another version now, as `{dep, then, now}`. A recording made before
code was recorded has no changes to tell.

# `of`

```elixir
@spec of(module(), String.t() | nil, pos_integer() | nil) :: t()
```

The code `view` runs now: the release named `release`, or its
application's version, the view's MD5, the rendering dependencies, and
`migration`, the newest migration version the app has.

# `with_modules`

```elixir
@spec with_modules(t() | nil, [module()]) :: t() | nil
```

Adds the MD5 of `modules`, such as the LiveComponents a session rendered.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
