PhoenixAssets.DevSupervisor (PhoenixAssets v0.1.0)

View Source

Supervises the development asset processes for a host application.

Starts the dev-process tracker (PhoenixAssets.DevServer), the generated-contracts watcher (PhoenixAssets.Generated.Watcher), and one MuonTrap.Daemon per enabled PhoenixAssets.DevProcess contributed by the plugins (Vite, Storybook). Stopping the supervisor (Ctrl+C on mix phx.server stops Phoenix, which stops this supervisor) stops each daemon and frees its port. Full OS process-tree teardown is only guaranteed where MuonTrap can use Linux cgroups; on macOS (and other systems without cgroups) MuonTrap kills the immediate child, so a grandchild that ignores its parent's exit can still escape.

The daemons restart :transient under a deliberately generous restart intensity so a transiently failing process (e.g. Vite exiting nonzero on a busy port) is retried rather than exhausting the supervisor and tearing the failure into the host application's tree.

Started only in development -- PhoenixAssets.child_specs/1 includes it only when PhoenixAssets.dev?/0 is true.

Summary

Functions

Returns a specification to start this module under a supervisor.

Starts the dev supervisor.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts)

@spec start_link(keyword()) :: Supervisor.on_start()

Starts the dev supervisor.

Options:

  • :ctx (required) -- the PhoenixAssets.Context.
  • :watch_dirs -- directories the generated-file watcher observes (default ["lib", "priv/gettext"]).