#[cfg(target_os = "ios")]
pub(crate) fn platform_wasmtime_config() -> Option<wasmtime::Config> {
let mut config = wasmtime::Config::new();
if let Err(e) = config.target("pulley64") {
log::warn!("Failed to set Pulley target for wasmtime: {e}");
return None;
}
config.memory_reservation(10 * (1 << 20));
config.memory_guard_size(0x1_0000);
config.memory_reservation_for_growth(1 << 20);
Some(config)
}
#[cfg(all(not(target_os = "ios"), feature = "pulley"))]
pub(crate) fn platform_wasmtime_config() -> Option<wasmtime::Config> {
let mut config = wasmtime::Config::new();
if let Err(e) = config.target("pulley64") {
log::warn!("Failed to set Pulley target for wasmtime: {e}");
return None;
}
config.memory_reservation(10 * (1 << 20));
config.memory_guard_size(0x1_0000);
config.memory_reservation_for_growth(1 << 20);
Some(config)
}
#[cfg(not(any(feature = "pulley", target_os = "ios")))]
pub(crate) fn platform_wasmtime_config() -> Option<wasmtime::Config> {
None
}
pub mod adapter;
pub mod binary_protocol;
pub mod host_fns;
pub mod loader;
pub mod permission_checker;
pub mod plugin_fs;
pub mod protocol;
#[cfg(feature = "testing")]
pub mod testing;
#[cfg(feature = "wasi-runner")]
pub mod wasi_runner;
#[cfg(feature = "ws-transport")]
pub mod ws_transport;
pub use adapter::ExtismPluginAdapter;
pub use host_fns::{
BatchGetEntry, BatchGetResult, DEFAULT_STORAGE_QUOTA_BYTES, EventEmitter,
FilePluginSecretStore, FilePluginStorage, FileProvider, HostContext, MapFileProvider,
NamespaceEntry, NamespaceObjectMeta, NamespaceProvider, NoopEventEmitter, NoopFileProvider,
NoopNamespaceProvider, NoopPluginCommandBridge, NoopRuntimeContextProvider, NoopSecretStore,
NoopStorage, NoopWebSocketBridge, PermissionChecker, PluginCommandBridge, PluginSecretStore,
PluginStorage, RuntimeContextProvider, WebSocketBridge, parse_multipart_batch,
};
pub use loader::{
ExtismLoadError, inspect_plugin_wasm_manifest, load_plugin_from_wasm, load_plugins_from_dir,
};
pub use permission_checker::{
AllowAllPermissionChecker, DenyAllPermissionChecker, FrontmatterPermissionChecker,
};
#[cfg(test)]
mod tests {
#[test]
#[cfg(feature = "pulley")]
fn pulley_config_creates_plugin() {
let config =
super::platform_wasmtime_config().expect("pulley feature should produce config");
let manifest = extism::Manifest::new([extism::Wasm::data(b"\x00asm\x01\x00\x00\x00")]);
let result = extism::PluginBuilder::new(manifest)
.with_wasmtime_config(config)
.build();
assert!(
result.is_ok(),
"Pulley plugin build failed: {:?}",
result.err()
);
}
}
pub use plugin_fs::PluginFileSystem;
#[cfg(feature = "ws-transport")]
pub use ws_transport::{SyncGuestBridge, TokioWebSocketBridge};