//! Stub plugin surface when `plugin-host` is disabled (browser wasm). use std::collections::HashMap; use crate::host::HostContext; use crate::value::Value; pub const ABI_VERSION: u32 = 2; pub const ABI_VERSION_MIN: u32 = 1; /// Hook: resolve bare `lib.member` (unused without native plugins). #[derive(Clone, Copy)] pub struct LibPathCall { pub call: fn(*mut (), &str, Option<&Value>) -> Result, pub data: *mut (), } pub fn with_lib_path_call(_hook: LibPathCall, body: impl FnOnce() -> R) -> R { body() } #[derive(Clone)] pub struct RegisteredFn { pub params: Vec, } #[derive(Debug, Default, Clone)] pub struct PluginState; impl PluginState { pub fn get(&self, _name: &str) -> Option<&RegisteredFn> { None } pub fn list_names(&self) -> Vec { Vec::new() } } pub fn load(_ctx: &mut HostContext, _path: &Value) -> Result { Err("plugin.load unavailable in browser wasm".into()) } pub fn unload(_ctx: &mut HostContext) -> Result { Err("plugin.unload unavailable in browser wasm".into()) } pub fn list(_ctx: &HostContext) -> Result { Ok(Value::List(Vec::new())) } pub fn call_registered( _ctx: &mut HostContext, name: &str, _bound: &HashMap, ) -> Result { Err(format!("plugin `{name}` unavailable in browser wasm")) }