[package]
name = "spacetimedb-lib"
version.workspace = true
edition.workspace = true
license-file = "LICENSE"
description = "A common library for SpacetimeDB"
rust-version.workspace = true

[lib]
# Benching off, because of https://bheisler.github.io/criterion.rs/book/faq.html#cargo-bench-gives-unrecognized-option-errors-for-valid-command-line-options
bench = false

[[test]]
name = "serde"
required-features = ["serde"]

[features]
default = ["serde", "metrics_impls"]
serde = ["dep:serde", "spacetimedb-sats/serde"]
# Allows using `Arbitrary` impls defined in this crate.
proptest = ["dep:proptest", "dep:proptest-derive"]
# Allows using additional test methods.
test = ["proptest", "spacetimedb-sats/test"]
metrics_impls = ["dep:spacetimedb-metrics", "spacetimedb-sats/metrics_impls"]
enum-map = ["dep:enum-map"]
# Gated to avoid including this in `spacetimedb_bindings`.
memory-usage = [
    "dep:spacetimedb-memory-usage",
    "spacetimedb-primitives/memory-usage",
    "spacetimedb-sats/memory-usage",
]

[dependencies]
spacetimedb-bindings-macro.workspace = true
spacetimedb-sats.workspace = true
spacetimedb-primitives.workspace = true
spacetimedb-memory-usage = { workspace = true, optional = true }
spacetimedb-metrics = { workspace = true, optional = true }

anyhow.workspace = true
bitflags.workspace = true
bytes.workspace = true
chrono.workspace = true
derive_more.workspace = true
enum-as-inner.workspace = true
hex.workspace = true
itertools.workspace = true
log.workspace = true
serde = { workspace = true, optional = true }
thiserror.workspace = true
blake3.workspace = true
enum-map = { workspace = true, optional = true }

# For the 'proptest' feature.
proptest = { workspace = true, optional = true }
proptest-derive = { workspace = true, optional = true }

[dev-dependencies]
spacetimedb-sats = { path = "../sats", features = ["test"] }
bytes.workspace = true
serde_json.workspace = true
insta.workspace = true
ron.workspace = true

# Also as dev-dependencies for use in _this_ crate's tests.
proptest.workspace = true
proptest-derive.workspace = true

[lints]
workspace = true
