use std::{path::PathBuf, sync::Arc};
use wasmer_wasix::WasiRuntime;
pub fn build_wasi_runtime(
fs_cache_path: Option<PathBuf>,
) -> Option<Arc<dyn WasiRuntime + Send + Sync>> {
#[cfg(not(feature = "plugin_transform_host_native_shared_runtime"))]
return None;
#[cfg(feature = "plugin_transform_host_native_shared_runtime")]
{
use wasmer_wasix::{
runners::Runner, runtime::task_manager::tokio::TokioTaskManager, PluggableRuntime,
};
let tasks = TokioTaskManager::new(tokio::runtime::Handle::current());
let mut rt = PluggableRuntime::new(Arc::new(tasks));
rt.set_engine(Some(wasmer::Engine::default()));
return Some(Arc::new(rt));
}
}