[workspace]
members = [".", "djvu-py"]
exclude = ["fuzz"]

[package]
name = "djvu-rs"
version = "0.11.1"
edition = "2024"
rust-version = "1.88"
license = "MIT"
description = "Pure-Rust DjVu decoder written from the DjVu v3 public specification"
repository = "https://github.com/matyushkin/djvu-rs"
documentation = "https://docs.rs/djvu-rs"
readme = "README.md"
keywords = ["djvu", "decoder", "document", "image", "pdf"]
categories = ["parser-implementations", "multimedia::images", "encoding"]
publish = true
exclude = [
    ".cargo/config.toml",
    "tests/corpus/*",
    "tests/golden/*",
    "tests/fixtures/*",
    "references/*",
    "benches/*",
    "fuzz/*",
    "scripts/*",
    "BENCHMARKS_RESULTS.md",
    "BENCHMARKS.md",
]

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[dependencies]
thiserror = "2"
wide = "0.7"
# Used only by the djvu CLI binary.
clap = { version = "4", features = ["derive"], optional = true }
png = { version = "0.17", optional = true }
zip = { version = "2", default-features = false, features = ["deflate"], optional = true }
miniz_oxide = { version = "0.8", optional = true }
zune-jpeg = { version = "0.5", optional = true }
tiff = { version = "0.9", optional = true }
jpeg-encoder = { version = "0.6", optional = true }
tokio = { version = "1", features = ["rt", "rt-multi-thread", "macros"], optional = true }
async-stream = { version = "0.3", optional = true }
futures-core = { version = "0.3", optional = true }
rayon = { version = "1", optional = true }
memmap2 = { version = "0.9", optional = true }
serde = { version = "1", features = ["derive"], optional = true }
image = { version = "0.24", default-features = false, optional = true }
wasm-bindgen = { version = "0.2", optional = true }
js-sys = { version = "0.3", optional = true }
tesseract = { version = "0.15", optional = true }
tract-onnx = { version = "0.21", optional = true }
candle-core = { version = "0.8", optional = true }
candle-nn = { version = "0.8", optional = true }
tokenizers = { version = "0.20", optional = true }

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

[features]
default = ["std"]
std = ["dep:png", "dep:zip", "dep:miniz_oxide", "dep:zune-jpeg", "dep:jpeg-encoder"]
cli = ["std", "dep:clap"]
jpeg = ["dep:zune-jpeg"]
tiff = ["dep:tiff", "std"]
async = ["dep:tokio", "dep:async-stream", "dep:futures-core", "std"]
parallel = ["dep:rayon", "std"]
mmap = ["dep:memmap2", "std"]
serde = ["dep:serde"]
image = ["dep:image", "std"]
wasm = ["dep:wasm-bindgen", "dep:js-sys", "std"]
epub = ["std"]
ocr-tesseract = ["dep:tesseract", "std"]
ocr-onnx = ["dep:tract-onnx", "std"]
ocr-neural = ["dep:candle-core", "dep:candle-nn", "dep:tokenizers", "std"]

[dev-dependencies]
criterion = "0.5"
assert_cmd = "2"
predicates = "3"
tempfile = "3"
serde_json = "1"
futures = "0.3"
zip = { version = "2", default-features = false, features = ["deflate"] }

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

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

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

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