[package]
name = "xitca-web"
version = "0.1.0"
edition = "2024"

[[bin]]
name = "xitca-web"
path = "./src/main.rs"
required-features = ["io-uring", "pg", "router", "template"]

[[bin]]
name = "xitca-web-unrealistic"
path = "./src/main_unrealistic.rs"
required-features = ["perf", "pg", "template"]

[[bin]]
name = "xitca-web-wasm"
path = "./src/main_wasm.rs"
required-features = ["web"]

[[bin]]
name = "xitca-web-orm"
path = "./src/main_orm.rs"
required-features = ["pg-orm-async", "template", "web-codegen"]

[[bin]]
name = "xitca-web-sync"
path = "./src/main_sync.rs"
required-features = ["pg-orm", "template", "web-codegen"]

[features]
# pg client optional
pg = ["dep:xitca-postgres"]
# diesel orm optional
pg-orm = ["diesel/r2d2"]
# diesel async orm optional
pg-orm-async = ["dep:diesel", "dep:diesel-async", "dep:xitca-postgres-diesel", "dep:futures-util"]
# http router optional
router = ["xitca-http/router"]
# web optional
web = ["dep:xitca-web"]
# web with macros optional
web-codegen = ["xitca-web/codegen", "xitca-web/urlencoded"]
# template optional
template = ["dep:sailfish"]
# io-uring optional
io-uring = ["dep:tokio-uring", "xitca-http/io-uring", "xitca-server/io-uring"]
# unrealistic performance optimization
perf = ["dep:core_affinity", "dep:mimalloc", "tokio/parking_lot", "simd-json", "simd-json-derive"]

[dependencies]
xitca-http = "0.7"
xitca-io = "0.4.1"
xitca-server = "0.5"
xitca-service = "0.3"
xitca-unsafe-collection = "0.2"

atoi = "2"
httparse = "1"
serde = { version = "1" }
serde_json = { version = "1" }

# web optional
xitca-web = { version = "0.7", features = ["json"], optional = true }

# raw-pg optional
xitca-postgres = { version = "0.3", optional = true }

# orm optional
diesel = { version = "2", features = ["postgres"], optional = true }

# orm async optional
diesel-async = { version = "0.5", features = ["bb8", "postgres"], optional = true }
xitca-postgres-diesel = { version = "0.1", optional = true }
futures-util = { version = "0.3", default-features = false, optional = true }

# template optional
sailfish = { version = "0.9", default-features = false, features = ["perf-inline"], optional = true }

# io-uring optional
tokio-uring = { version = "0.5", optional = true }

# perf optional
core_affinity = { version = "0.8.1", optional = true }
mimalloc = { version = "0.1", default-features = false, optional = true }
simd-json = { version = "0.14", optional = true }
simd-json-derive =  { version = "0.15", default-features = false, optional = true }

# stuff can not be used or not needed in wasi target
[target.'cfg(not(target_family = "wasm"))'.dependencies]
futures-core = { version = "0.3", default-features = false }
rand = { version = "0.9", features = ["os_rng", "small_rng"], default-features = false }
tokio = "1.41"

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

[patch.crates-io]
xitca-postgres-diesel = { git = "https://github.com/fakeshadow/xitca-postgres-diesel", rev = "ae93ee9" }

diesel-async = { git = "https://github.com/weiznich/diesel_async", rev = "5b8262b" }
mio = { git = "https://github.com/fakeshadow/mio", rev = "9bae6012b7ecfc6083350785f71a5e8265358178" }

xitca-codegen = { git = "http://github.com/HFQR/xitca-web", rev = "915b14d" }
xitca-http = { git = "http://github.com/HFQR/xitca-web", rev = "915b14d" }
xitca-postgres = { git = "http://github.com/HFQR/xitca-web", rev = "915b14d" }
xitca-server = { git = "http://github.com/HFQR/xitca-web", rev = "915b14d" }
xitca-service = { git = "http://github.com/HFQR/xitca-web", rev = "915b14d" }
xitca-web = { git = "http://github.com/HFQR/xitca-web", rev = "915b14d" }
