libero/codegen_decoders
Typed decoder generators.
Emits JS decoder source from discovered types and handler endpoints. Returns strings; writing to disk is the consumer’s responsibility.
Values
pub fn emit_class_statics(
discovered: List(walker.DiscoveredType),
) -> String
Emit per-variant class-static assignments for every discovered user
type. __wireAtom carries the 10-char hash; __fieldTypes carries
the positional field-type hints the encoder needs (Float marked,
containers wrapped, primitives null). These statics replace the
runtime _bareToQualifiedAtom and fieldTypeRegistry lookup tables.
Even 0-arity variants get a __fieldTypes = [] for symmetry; the
encoder branches on key count so the empty array is never indexed.
pub fn emit_client_msg_statics(
endpoints endpoints: List(scanner.HandlerEndpoint),
dispatch_module_ref dispatch_module_ref: String,
) -> String
pub fn emit_typed_decoders(
discovered: List(walker.DiscoveredType),
) -> String
Emit a JS string with one decoder function per discovered type,
registration calls that populate etf/wire_ffi.mjs’s typed decoder registry,
and an ensure_decoders entry point.
pub fn generate_decoders_ffi(
discovered discovered: List(walker.DiscoveredType),
endpoints endpoints: List(scanner.HandlerEndpoint),
relpath_prefix relpath_prefix: String,
package package: String,
dispatch_module dispatch_module: option.Option(String),
) -> String
Generate the JS FFI decoder source from discovered types and endpoints.
pub fn generate_decoders_gleam(
ffi_module_path ffi_module_path: String,
) -> String
Generate the Gleam wrapper module source for the typed decoder FFI.