Skip to main content

Module codegen

Module codegen 

Source
Expand description

Code generation for foundry build.

foundry build does not compile HTML to machine code itself: it generates a small Cargo project whose main.rs embeds the (escaped) HTML as a string literal and calls crate::run_embedded, then shells out to cargo build --release. The helpers here produce that generated source, and are kept separate from the CLI so they can be unit-tested.

Constants§

CRATE_NAME
Package name published on crates.io.
CRATE_VERSION
Version of alia-foundry used for the crates.io fallback dependency.

Functions§

escape_html_literal
Escape an HTML document so it can be embedded as a Rust string literal.
foundry_dep_line
Build the [dependencies] line pointing at the Foundry runtime.
generate_cargo_toml
Render the Cargo.toml of the generated project.
generate_main_rs
Render the src/main.rs of the generated project.