libero/source

Source-file helpers for seed-driven type discovery.

Frameworks such as Rally decide which types cross the boundary and pass those seeds to Libero.

Values

pub fn build_alias_resolution_map(
  imports: List(glance.Definition(glance.Import)),
) -> dict.Dict(String, String)

Build a map from import aliases and bare module names to the full module path.

pub fn build_type_alias_originals(
  imports: List(glance.Definition(glance.Import)),
) -> dict.Dict(String, String)

Map locally-bound type names back to their original names from the source module. Only populated when an import uses type X as Y.

pub fn build_type_import_map(
  imports: List(glance.Definition(glance.Import)),
) -> dict.Dict(String, String)

Build a map from unqualified type names to the full module path of their import.

pub fn derive_module_path(file_path file_path: String) -> String

Derive the Gleam module path from a file path by finding the last occurrence of /src/ and taking everything after it, then stripping the .gleam extension.

pub fn parse_module(
  file_path file_path: String,
) -> Result(glance.Module, gen_error.GenError)

Read a .gleam file and parse it via glance, surfacing both I/O and parser failures as GenError variants tagged with the file path.

pub fn walk_directory(
  path path: String,
) -> Result(List(String), gen_error.GenError)

Recursively walk a directory, returning every .gleam file found. Skips any subdirectory named generated.

Search Document