Skip to main content

hyperlight_js_runtime/
host.rs

1use alloc::string::String;
2
3use anyhow::Result;
4
5/// A trait representing the host environment for the JS runtime.
6/// In hyperlight this would represent the host function calls that
7/// the runtime needs.
8pub trait Host: Send + Sync {
9    /// Resolve a module name to a module specifier (usually a path).
10    /// The base is the specifier of the module that is importing the module.
11    fn resolve_module(&self, base: String, name: String) -> Result<String>;
12
13    /// Obtain the module source code for a given module specifier.
14    fn load_module(&self, name: String) -> Result<String>;
15}