wasm_runtime/
lib.rs

1//! # WASM Runtime
2//!
3//! A library for downloading and managing WebAssembly runtimes for multiple languages.
4//!
5//! ## Features
6//!
7//! - Download and cache WASM runtimes for Node.js, Python, Ruby, PHP, Go, and Rust
8//! - Automatic integrity verification using SHA256
9//! - Local caching to avoid redundant downloads
10//! - Support for multiple runtime versions
11//! - Multiple CDN sources with automatic fallback
12//!
13//! ## Example
14//!
15//! ```no_run
16//! use wasm_runtime::{RuntimeLoader, Language};
17//!
18//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
19//! let loader = RuntimeLoader::new()?;
20//!
21//! // Download a runtime (or get from cache)
22//! let runtime = loader.get_runtime(Language::Python, "3.11.7").await?;
23//! println!("Runtime path: {:?}", runtime.path);
24//!
25//! // List available runtimes
26//! let manifest = loader.list_available().await?;
27//! for (lang, info) in &manifest.languages {
28//!     println!("{}: latest = {}", lang, info.latest);
29//! }
30//!
31//! // Get latest version for a language
32//! let latest = loader.get_latest_version(Language::Python).await?;
33//! println!("Latest Python: {}", latest);
34//! # Ok(())
35//! # }
36//! ```
37
38pub mod cache;
39pub mod error;
40pub mod loader;
41pub mod manifest;
42pub mod runtime;
43
44pub use cache::CacheManager;
45pub use error::{Error, Result};
46pub use loader::{CdnSource, RuntimeLoader, RuntimeLoaderBuilder};
47pub use manifest::{GlobalManifest, RuntimeInfo, RuntimeManifest, RuntimeVersion};
48pub use runtime::{Language, Runtime};