rally/generator
Route type, parse function, path builder, and page dispatch codegen.
Generates router.gleam (Route type, parse_route, route_to_path, href), page_dispatch.gleam (PageModel/PageMsg unions, per-route init/update/view), protocol_wire.gleam facade, and RPC dispatch scaffolding.
Values
pub fn generate(routes: List(types.ScannedRoute)) -> String
Generate a complete Gleam source file from a list of scanned routes.
pub fn generate_dispatch(
routes routes: List(types.ScannedRoute),
contracts contracts: List(
#(types.ScannedRoute, types.PageContract),
),
has_client_context has_client_context: Bool,
router_module router_module: String,
client_context_module client_context_module: String,
) -> String
Generate a complete page_dispatch.gleam source file from scanned routes.
pub fn generate_empty_rpc_dispatch(
atoms_module atoms_module: String,
extra_params extra_params: List(codegen_dispatch.ExtraParam),
) -> String
pub fn generate_protocol_wire(
protocol: String,
atoms_module: String,
contract_hash: String,
rpc_dispatch_module: String,
endpoints: List(scanner.HandlerEndpoint),
auth_config: option.Option(types.AuthConfig),
wire_import_module: String,
) -> String
Generate the server-side protocol wire facade based on the protocol string.
pub fn generate_protocol_wire_js(
protocol: String,
contract_hash: String,
) -> String
Generate the client-side JS protocol facade module. Re-exports FFI functions from the correct libero wire module based on protocol (ETF re-exports from rpc_ffi.mjs, JSON wraps encode_request with the contract hash).
pub fn normalize_rpc_dispatch_context_import(
source: String,
) -> String
pub fn normalize_rpc_dispatch_unused_fields(
source: String,
) -> String