[workspace]
members = [".", "ruitl_compiler", "ruitl_lsp"]
# tree-sitter-ruitl/ carries its own Cargo.toml for the Rust grammar
# bindings (generated by `tree-sitter generate`). It's a standalone crate
# published separately and intentionally kept out of this workspace.
# vscode-extension-ruitl/ is a Node/TypeScript package (no Cargo).
exclude = [
    "test-project",
    "tree-sitter-ruitl",
    "zed-extension-ruitl",
    "vscode-extension-ruitl",
]

[package]
name = "ruitl"
version = "0.2.1"
edition = "2021"
description = "Template compiler for type-safe, server-rendered HTML components in Rust"
license = "MIT OR Apache-2.0"
repository = "https://github.com/sirhco/ruitl"
documentation = "https://docs.rs/ruitl"
readme = "README.md"
keywords = ["html", "template", "ssr", "components", "templ"]
categories = ["web-programming", "template-engine", "compilers"]

[package.metadata.docs.rs]
# Explicit feature list: covers the full API (server, dev, testing) but
# deliberately omits `minify`. `minify-html-common`'s build script fetches
# HTML-spec data from the network, which docs.rs sandboxes disallow.
features = ["server", "static", "dev", "testing"]
rustdoc-args = ["--cfg", "docsrs"]

[[bin]]
name = "ruitl"
path = "src/main.rs"

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

[dependencies]
# Core dependencies
tokio = { version = "1.0", features = ["full"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
anyhow = "1.0"
thiserror = "1.0"

# HTML and templating
html-escape = "0.2"
pulldown-cmark = "0.9"
minify-html = { version = "0.11", optional = true }

# CLI and file handling
clap = { version = "4.0", features = ["derive", "cargo"] }
walkdir = "2.3"
notify = { version = "6.0", optional = true }
colored = "2.0"

# HTTP server for development
hyper = { version = "0.14", features = ["full"], optional = true }
hyper-tls = { version = "0.5", optional = true }

# Build and compilation
proc-macro2 = "1.0"
quote = "1.0"
syn = { version = "2.0", features = ["full"] }
md5 = "0.7"

# File watching and hot reload
hotwatch = { version = "0.4", optional = true }

# Configuration
toml = "0.8"
dirs = "5.0"

# Async utilities
futures = "0.3"
async-trait = "0.1"

# Additional dependencies
urlencoding = "2.1"
uuid = { version = "1.0", features = ["v4"] }
tokio-stream = { version = "0.1", features = ["sync"] }

# Compiler (parser + codegen) — shared with build.rs.
# Path + version: path wins for workspace dev, version is what crates.io uses.
ruitl_compiler = { path = "ruitl_compiler", version = "0.2.1" }

# Development dependencies
# Build dependencies
[build-dependencies]
walkdir = "2.3"
ruitl_compiler = { path = "ruitl_compiler", version = "0.2.1" }

[dev-dependencies]
tempfile = "3.0"
pretty_assertions = "1.0"
tokio-test = "0.4"
insta = "1.40"
prettyplease = "0.2"
criterion = { version = "0.5", features = ["html_reports"] }

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

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

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

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

[features]
default = ["server", "static", "dev"]
server = ["dep:hyper", "dep:hyper-tls", "tokio/rt-multi-thread"]
static = []
dev = ["dep:hotwatch", "dep:notify"]
minify = ["dep:minify-html"]
# `testing` exposes `ruitl::testing` (harness + html assertions + macros).
# Off by default so release builds don't carry test helpers.
testing = []

[profile.release]
opt-level = 3
lto = true
codegen-units = 1
panic = "abort"

[profile.dev]
opt-level = 0
debug = true
