libero/codegen_stubs
Per-client RPC stub, config, and SSR-flag generators.
Emits the files that ship inside each consumer client package:
messages.gleam (typed RPC stubs), rpc_config.gleam + _ffi.mjs
(WebSocket URL resolution), and ssr.gleam + ssr_ffi.mjs (SSR flag
reader).
Values
pub fn write_config(
config config: config.Config,
) -> Result(Nil, gen_error.GenError)
Generate the client-side rpc_config.gleam plus its _ffi.mjs
resolver.
pub fn write_endpoint_client_stubs(
endpoints endpoints: List(scanner.HandlerEndpoint),
client_generated client_generated: String,
wire_module_tag wire_module_tag: String,
) -> Result(Nil, gen_error.GenError)
Generate typed client stubs from handler endpoints. Each endpoint becomes a function that sends a ClientMsg variant and decodes the response to RpcData(payload, domain).
pub fn write_ssr_flags(
client_generated client_generated: String,
) -> Result(Nil, gen_error.GenError)
Generate the client-side SSR flags reader (gleam + mjs). Produces a read_flags() function that reads window.LIBERO_FLAGS and returns it as a Dynamic value for ssr.decode_flags().