1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! WASM/WASI interface for Hypen Engine
//!
//! This module provides bindings for running the engine in WASM environments.
//! Two interface types are available:
//!
//! ## JavaScript Runtimes (`js` feature)
//!
//! For Node.js, Bun, Deno, and browsers. Uses wasm-bindgen for seamless JavaScript
//! interop with native JS types and callbacks.
//!
//! ```toml
//! [dependencies]
//! hypen-engine = { features = ["js"] }
//! ```
//!
//! ## WASI Runtimes (`wasi` feature)
//!
//! For Go (wazero, wasmtime-go), Python (wasmtime, wasmer), Rust, and other
//! languages that embed WASM via WASI. Uses a C-compatible FFI with JSON
//! serialization for data exchange.
//!
//! ```toml
//! [dependencies]
//! hypen-engine = { features = ["wasi"] }
//! ```
//!
//! ## Feature Flags
//!
//! - `js` - Enable JavaScript bindings via wasm-bindgen (default for wasm-pack builds)
//! - `wasi` - Enable WASI-compatible C FFI bindings
//!
//! These features are mutually exclusive. If both are enabled, `js` takes precedence.
// Shared FFI utilities (available on all platforms for testing)
// JavaScript bindings (wasm-bindgen)
// Re-export JS types at module root for backward compatibility
pub use *;
// WASI bindings (C FFI)
// Re-export WASI functions at module root
pub use *;
// If neither feature is enabled but we're on wasm32, provide a helpful error
compile_error!;