[package]
name = "assay-lua"
version = "0.5.6"
categories = ["command-line-utilities", "development-tools::testing"]
edition = "2024"
homepage = "https://assay.rs"
keywords = ["lua", "scripting", "automation", "runtime", "kubernetes"]
license = "MIT"
repository = "https://github.com/developerinlondon/assay"
description = "General-purpose enhanced Lua runtime. Batteries-included scripting, automation, and web services."

[[bin]]
name = "assay"
path = "src/main.rs"
required-features = ["cli"]

[lib]
name = "assay"
path = "src/lib.rs"

[features]
default = ["db", "server", "cli"]
db = ["dep:sqlx"]
server = ["dep:http-body-util", "dep:hyper", "dep:hyper-util"]
cli = ["dep:clap", "dep:tracing-subscriber"]

[dependencies]
# Lua scripting engine
mlua = { version = "0.11.6", features = ["lua55", "vendored", "async", "serialize"] }

# HTTP client
reqwest = { version = "0.13.2", features = ["json", "rustls", "query"], default-features = false }

# Async runtime
tokio = { version = "1.49.0", features = ["full"] }

# Serialization
serde = { version = "1.0.228", features = ["derive"] }
serde_json = "1.0.149"
serde_yml = "0.0.12"

# CLI (optional — only needed for the assay binary)
clap = { version = "4.5.57", features = ["derive"], optional = true }

# Error handling
anyhow = "1"

# Logging
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter", "json"], optional = true }

# JWT signing (RS256)
jsonwebtoken = { version = "10.3.0", features = ["rust_crypto"] }
zeroize = "1.8.2"

# Base64 encoding/decoding
data-encoding = "2.10.0"

# Embed stdlib .lua files in binary
include_dir = "0.7.4"

# Hashing (SHA2 + SHA3)
digest = "0.10.7"
sha2 = "0.10.9"
sha3 = "0.10.8"

# Secure random
rand = "0.10.0"

# Lightweight regex
regex-lite = "0.1.9"

# Process signals (kill)
libc = "0.2"

# Glob pattern matching
glob = "0.3.3"

# TOML parsing/encoding
toml = "0.9.12"

# SQL database (optional — Postgres, MySQL, SQLite)
sqlx = { version = "0.8.6", features = ["runtime-tokio-rustls", "postgres", "mysql", "sqlite", "any"], optional = true }

# WebSocket client
futures-util = "0.3"
tokio-tungstenite = { version = "0.28.0", features = ["connect", "rustls-tls-webpki-roots"] }

# Template engine (Jinja2-compatible)
minijinja = "2.15.1"

# HTTP server (optional — only needed for http.serve() Lua builtin)
axum = "0.8.8"
http-body-util = { version = "0.1", optional = true }
hyper = { version = "1", features = ["http1", "server"], optional = true }
hyper-util = { version = "0.1", features = ["tokio"], optional = true }
tower-http = { version = "0.6.8", features = ["cors", "trace"] }

[dev-dependencies]
tokio-test = "0.4"
wiremock = "0.6.5"

[profile.release]
opt-level = "z" # Optimize for size
lto = true # Link-time optimization
codegen-units = 1 # Single codegen unit for better optimization
strip = true # Strip debug symbols
panic = "abort" # Abort on panic (smaller binary)
