[package]
name = "beanfmt"
version = "0.7.0"
edition = "2024"
description = "A fast beancount file formatter with CJK support"
license = "MIT"
repository = "https://github.com/Xm798/beanfmt"
homepage = "https://github.com/Xm798/beanfmt"
readme = "README.md"
keywords = ["beancount", "formatter", "cjk", "accounting"]
categories = ["command-line-utilities", "text-processing"]

[package.metadata.wasm-pack.profile.release]
# Disabled: bundled wasm-opt lacks bulk-memory support required by Rust 2024 edition.
# Re-enable after upgrading wasm-pack or installing system binaryen.
wasm-opt = false

[lib]
name = "beanfmt"
path = "src/lib.rs"
crate-type = ["cdylib", "rlib"]

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

[features]
default = ["cli"]
file-config = ["dep:serde", "dep:toml"]
cli = ["file-config", "dep:clap", "dep:glob"]
wasm = ["dep:wasm-bindgen"]
python = ["file-config", "dep:pyo3", "dep:glob"]

[dependencies]
regex = { version = "1", default-features = false, features = ["std", "unicode-perl", "unicode-gencat"] }
unicode-width = "0.2"

[dependencies.clap]
version = "4"
features = ["derive"]
optional = true

[dependencies.glob]
version = "0.3"
optional = true

[dependencies.wasm-bindgen]
version = "0.2"
optional = true

[dependencies.serde]
version = "1"
features = ["derive"]
optional = true

[dependencies.toml]
version = "0.9"
optional = true

[dependencies.pyo3]
version = "0.24"
optional = true
features = ["extension-module", "abi3-py39"]

[dev-dependencies]
tempfile = "3"

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