Skip to main content

with_module

Function with_module 

Source
pub fn with_module<T>(
    sources: &BTreeMap<String, String>,
    entry: &str,
    setup: impl FnOnce(&mut Context, &Logs) -> JsResult<()>,
    invoke: impl FnOnce(&Module, &mut Context) -> JsResult<T>,
) -> Result<T, Failure>
Expand description

Load and evaluate a package-local ESM graph in a fresh, bounded context. Host setup and callback invocation occur within the same owning context.