Function compile_for_browser

Source
pub fn compile_for_browser(
    source_file: &Path,
    source_text: &str,
) -> Result<BrowserArtifacts, CompileError<Infallible>>
Expand description

Compile source into browser-facing artifacts.

use std::path::Path;

let source = std::fs::read_to_string("examples/basics.rk").expect("example should exist");
let artifacts = rukalang::driver::compile_for_browser(Path::new("examples/basics.rk"), &source)
    .expect("compile should succeed");

assert!(!artifacts.ast_graph.nodes.is_empty());
assert!(artifacts.rust_source.contains("pub fn run_main()"));