[package]
name = "dmc-core"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
authors.workspace = true
repository.workspace = true
homepage.workspace = true
documentation.workspace = true
keywords.workspace = true
categories.workspace = true
description = "Engine, CLI, watch mode, and collection builds for the dmc MDX compiler"
readme = "README.md"

[features]
default = ["cli", "watch", "pretty-code", "math", "emoji"]
cli = ["dep:clap", "dep:toml"]
watch = ["dep:notify", "dep:notify-debouncer-mini"]
pretty-code = ["dmc-transform/pretty-code"]
math = ["dmc-transform/math"]
emoji = ["dmc-transform/emoji"]

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

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

[dependencies]
blake3.workspace = true
dmc-lexer.workspace = true
dmc-diagnostic = { workspace = true, features = ["lexer", "parser", "transform", "codegen", "core"] }
duck-diagnostic.workspace = true
dmc-parser = { version = "0.3.2", path = "../dmc-parser" }
dmc-codegen = { version = "0.3.2", path = "../dmc-codegen" }
dmc-transform = { version = "0.3.2", path = "../dmc-transform" }
dmc-schema = { version = "0.3.2", path = "../dmc-schema" }
serde_yaml.workspace = true
notify = { workspace = true, optional = true }
notify-debouncer-mini = { workspace = true, optional = true }
rayon.workspace = true
tempfile.workspace = true
serde.workspace = true
serde_json.workspace = true
globwalk.workspace = true
clap = { workspace = true, optional = true }
toml = { workspace = true, optional = true }

[dev-dependencies]
pretty_assertions.workspace = true
tempfile.workspace = true
assert_cmd.workspace = true
predicates.workspace = true
insta.workspace = true
criterion.workspace = true
plotters.workspace = true

# `pprof` runs in-process via `setitimer(ITIMER_PROF)` - no kernel
# `perf_event_open` access needed, which is what `samply` / `cargo
# flamegraph` require but `perf_event_paranoid=2` blocks. Lets the
# `flamegraph` example produce a real folded-stack SVG without sudo.
# Unix-only: pprof's signal sampler relies on `nix` / POSIX `libc`, so it
# does not build on Windows. The `flamegraph*` examples compile to a stub
# `main` there.
[target.'cfg(unix)'.dev-dependencies]
pprof = { version = "0.14", features = ["flamegraph"] }

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

[[example]]
name = "bench"
path = "examples/bench.rs"

[[example]]
name = "profile"
path = "examples/profile.rs"

[[example]]
name = "flamegraph"
path = "examples/flamegraph.rs"

[[example]]
name = "flamegraph_consumer"
path = "examples/flamegraph_consumer.rs"
