Astral.PluginRunner (Astral v0.1.4)

Copy Markdown View Source

Execute Astral plugin hooks.

Summary

Functions

Run build_done hooks until one returns an error.

Run build_start hooks until one returns an error.

Run an optional hook with Volt-style extra-arity opts support.

Run config hooks in sequence.

Normalize and order plugins.

Run render_page hooks in sequence, piping HTML through each plugin.

Render a generated route with the first plugin that owns it.

Collect generated routes from plugins.

Run site_discovered hooks in sequence.

Types

plugin()

@type plugin() :: Astral.Plugin.plugin()

Functions

build_done(plugins, result)

@spec build_done([plugin()], Astral.BuildResult.t()) :: :ok | {:error, term()}

Run build_done hooks until one returns an error.

build_start(plugins, config)

@spec build_start([plugin()], Astral.Config.t()) :: :ok | {:error, term()}

Run build_start hooks until one returns an error.

call_optional(plugin, fun, args, default)

@spec call_optional(plugin(), atom(), [term()], term()) :: term()

Run an optional hook with Volt-style extra-arity opts support.

config(plugins, config)

@spec config([plugin()], Astral.Config.t()) :: Astral.Config.t()

Run config hooks in sequence.

plugins(plugins)

@spec plugins([plugin()] | plugin() | nil) :: [plugin()]

Normalize and order plugins.

render_page(plugins, html, page, site)

@spec render_page([plugin()], String.t(), Astral.Page.t(), Astral.Site.t()) ::
  {:ok, String.t()} | {:error, term()}

Run render_page hooks in sequence, piping HTML through each plugin.

render_route(plugins, route, site)

@spec render_route([plugin()], Astral.Route.t(), Astral.Site.t()) ::
  {:ok, iodata(), String.t()}
  | {:ok, iodata(), String.t(), [{String.t(), String.t()}]}
  | {:error, term()}
  | nil

Render a generated route with the first plugin that owns it.

routes(plugins, site)

@spec routes([plugin()], Astral.Site.t()) :: [Astral.Route.t()]

Collect generated routes from plugins.

site_discovered(plugins, site)

@spec site_discovered([plugin()], Astral.Site.t()) :: Astral.Site.t()

Run site_discovered hooks in sequence.