libero/config
Types
Everything libero needs to drive a single client’s codegen output.
Built by toml_config.to_codegen_config from gleam.toml.
pub type Config {
Config(
ws_path: String,
atoms_output: String,
atoms_module: String,
config_output: String,
register_relpath_prefix: String,
decoders_ffi_output: String,
decoders_gleam_output: String,
decoders_prelude_import_path: String,
server_generated: String,
client_generated: String,
)
}
Constructors
-
Config( ws_path: String, atoms_output: String, atoms_module: String, config_output: String, register_relpath_prefix: String, decoders_ffi_output: String, decoders_gleam_output: String, decoders_prelude_import_path: String, server_generated: String, client_generated: String, )Arguments
- ws_path
-
Path-only WebSocket route. The generated client resolves it against
window.locationat boot, which lets multi-tenant deployments share one bundle across subdomains. - atoms_output
-
Path to the generated .erl file that pre-registers all constructor atoms for safe ETF decoding.
- atoms_module
-
Erlang module name for the atoms .erl file, using Gleam’s path-to-module convention (@ separators).
- register_relpath_prefix
-
Bundle-relative prefix that prepends every import in the generated FFI .mjs file. Depth depends on where the decoder files land inside the consumer client package.
- decoders_ffi_output
-
Path to the generated rpc_decoders_ffi.mjs file.
- decoders_gleam_output
-
Path to the generated rpc_decoders.gleam wrapper file.
- decoders_prelude_import_path
-
Import path the generated decoders FFI uses to pull from the static decoders_prelude.mjs shipped with libero.
Values
pub fn prefix_paths(
config config: Config,
project_path project_path: String,
) -> Config
Return a copy of config whose output paths are rooted at project_path.
to_codegen_config builds a Config with paths relative to the project
root. The codegen functions write at those paths via simplifile, which
resolves them against CWD. When the caller (typically cli/gen.run) is
driving codegen against a project at a path other than CWD, the writes
land in the wrong place. This helper rewrites the output fields so they
resolve correctly regardless of CWD.
atoms_module, register_relpath_prefix, decoders_prelude_import_path
are NOT prefixed: they’re not filesystem paths the codegen writes to.