diff --git a/compiler-wasm/src/lib.rs b/compiler-wasm/src/lib.rs index 6702f2d1f..80e33a874 100644 --- a/compiler-wasm/src/lib.rs +++ b/compiler-wasm/src/lib.rs @@ -116,8 +116,9 @@ pub fn compile_package(project_id: usize, target: &str) -> Result<(), String> { let target = match target.to_lowercase().as_str() { "erl" | "erlang" => Target::Erlang, "js" | "javascript" => Target::JavaScript, + "nix" => Target::Nix, _ => { - let msg = format!("Unknown target `{target}`, expected `erlang` or `javascript`"); + let msg = format!("Unknown target `{target}`, expected `erlang`, `javascript` or `nix`"); return Err(msg); } }; @@ -150,6 +151,17 @@ pub fn read_compiled_erlang(project_id: usize, module_name: &str) -> Option Option { + let fs = get_filesystem(project_id); + let path = format!("/build/{}.nix", module_name); + fs.read(&Utf8PathBuf::from(path)).ok() +} + /// Clear any stored warnings. This is performed automatically when before compilation. /// #[wasm_bindgen]