Skip to main content

compile_in_memory

Function compile_in_memory 

Source
pub fn compile_in_memory(
    source: &str,
    target: BuildTarget,
    platform: Platform,
) -> Result<ProjectOutput, ProjectFailure>
Expand description

Compile a single in-memory Bynk source through the full project pipeline — no filesystem access (in-browser track, slice 3). The source is the in-process Bundle subset that consumes bynk; first-party injection and the per-platform binding emission run exactly as for an on-disk build, so the returned ProjectOutput is the complete module graph (the user unit + runtime.ts + the bynk-<platform>.ts binding + compose.ts). The wasm entry point pairs this with bynk-strip to produce JavaScript for the playground.

The module’s logical path is derived from its declared unit name (a context app.demoapp/demo.bynk), so the name↔path alignment check passes without real files; a source that does not parse falls back to main.bynk and the parse error is reported normally.