[package]
name = "hypen-engine"
version = "0.4.22"
edition = "2021"
description = "A Rust implementation of the Hypen engine"
license = "MIT"
repository = "https://github.com/hypen-lang/hypen-engine-rs"
readme = "README.md"
authors = ["Hypen Contributors"]

[lib]
crate-type = ["cdylib", "rlib"]

[dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
indexmap = { version = "2.0", features = ["serde"] }
slotmap = "1.0"
hypen-parser = { version = "0.4.22", path = "../parser" }
exprimo = "0.6.1"
im = { version = "15.1", features = ["serde"] }  # Persistent/immutable data structures for O(1) clone
hypen-tailwind-parse = { version = "0.4.22", path = "../tailwind-parse" }

# UniFFI for native bindings (Kotlin, Swift, Python, Ruby)
uniffi = { version = "0.28", features = ["cli"], optional = true }
thiserror = { version = "1.0", optional = true }

# WASM JS dependencies (only needed for js feature)
[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen = { version = "0.2", optional = true }
serde-wasm-bindgen = { version = "0.6", optional = true }
js-sys = { version = "0.3", optional = true }
web-sys = { version = "0.3", features = ["console"], optional = true }
console_error_panic_hook = { version = "0.1", optional = true }

[build-dependencies]
uniffi = { version = "0.28", features = ["build"], optional = true }

[features]
default = []
# JavaScript runtimes (Node.js, Bun, Deno, browsers) via wasm-bindgen
js = ["wasm-bindgen", "serde-wasm-bindgen", "js-sys", "web-sys"]
# WASI runtimes (Go, Python, Rust, etc.) via C-compatible FFI
# Use this for basic WASI support with manual FFI
wasi = []
# Component Model support (requires wit-bindgen)
# Use this for type-safe cross-language bindings via WIT interfaces
# Generates bindings from wit/hypen.wit
component-model = ["wasi"]
# Better panic messages in browser console (JS only)
console_error_panic_hook = ["dep:console_error_panic_hook"]
# UniFFI bindings for native platforms (Kotlin, Swift, Python, Ruby)
uniffi = ["dep:uniffi", "dep:thiserror"]

[dev-dependencies]
lazy_static = "1.4"
criterion = { version = "0.5", features = ["html_reports"] }

[[bench]]
name = "state_clone"
harness = false

[[bin]]
name = "uniffi-bindgen"
required-features = ["uniffi"]

[profile.release]
opt-level = "z"
lto = true
codegen-units = 1

# Disable wasm-opt to avoid network download requirement
[package.metadata.wasm-pack.profile.release]
wasm-opt = false
