caffeine_lang/compiler

Types

Output of the compilation process. Includes Terraform (always), the dependency graph when relations exist, the relay’s signals.json, the GHA workflow, and the bundled relay Gleam project when any expectation uses external-signal indicators, and any warnings the codegen accumulated.

relay_bundle is a path -> contents map relative to the bundle root (build/relay/relay/ is the conventional drop location). The CLI is responsible for writing the files; the compiler just produces them.

pub type CompilationOutput {
  CompilationOutput(
    terraform: String,
    dependency_graph: option.Option(String),
    relay_signals: option.Option(String),
    relay_workflow: option.Option(String),
    relay_bundle: option.Option(dict.Dict(String, String)),
    warnings: List(String),
  )
}

Constructors

Values

pub fn compile(
  measurements: List(source_file.VendorMeasurementSource),
  expectations: List(
    source_file.SourceFile(source_file.ExpectationSource),
  ),
) -> Result(CompilationOutput, errors.CompilationError)

Compiles measurement sources and expectation sources into Terraform configuration. Pure function — all file reading happens before this function is called.

pub fn compile_from_strings(
  measurements_source: String,
  expectations_source: String,
  expectations_path: String,
  vendor vendor_string: String,
) -> Result(CompilationOutput, errors.CompilationError)

Compiles from source strings directly (no file I/O). Used for browser-based compilation. The vendor parameter specifies which vendor the measurements belong to.

Search Document