Foundry.Context.RouterIntrospector (foundry v0.1.3)

Copy Markdown

Introspects Phoenix router modules to extract LiveView route metadata.

Used by Foundry to discover page nodes from Router.__routes__() without requiring per-LiveView annotations. Extracts route path, module, and dynamic flag.

Summary

Functions

Find the router module for a given app by scanning compiled BEAM files for __routes__/0.

Extract all LiveView routes from a router module.

Functions

find_router(app_name, project_root)

@spec find_router(atom(), String.t()) :: module() | nil

Find the router module for a given app by scanning compiled BEAM files for __routes__/0.

Returns the module atom or nil if not found.

liveview_routes(router_module)

@spec liveview_routes(module()) :: [map()]

Extract all LiveView routes from a router module.

Returns a list of maps with keys: :module, :path, :dynamic, :helper.