molt-framework 1.1.0

Fast, type-safe HTML DSL and static site generation engine in Rust and WebAssembly
Documentation
[package]
name = "molt-framework"
version = "1.1.0"
edition = "2024"
rust-version = "1.85"
authors = ["Michel Anderson Lutz Teixeira <michel@micheltlutz.me>"]
description = "Fast, type-safe HTML DSL and static site generation engine in Rust and WebAssembly"
documentation = "https://docs.rs/molt-framework"
repository = "https://github.com/micheltlutz/molt"
homepage = "https://github.com/micheltlutz/molt"
license = "MIT"
readme = "README.md"
keywords = ["html", "dsl", "wasm", "static-site", "templating"]
categories = ["web-programming", "template-engine", "wasm"]
# Development tooling stays out of the published crate. `rust-toolchain.toml` matters most: it
# makes rustup install a wasm target and extra components for anyone who builds inside the
# unpacked tarball, which breaks an offline packager. `AGENTS.md` and `CLAUDE.md` point at
# `.claude/`, which is not shipped either.
exclude = [
    "/.claude",
    "/AGENTS.md",
    "/CLAUDE.md",
    "/clippy.toml",
    "/codecov.yml",
    "/deny.toml",
    "/rust-toolchain.toml",
    "/rustfmt.toml",
    "/.github",
    "/scripts",
    "/examples/web",
    "/examples/node",
    "/fuzz",
    "/docs/plans",
    "/docs/history",
    "molt-logo.png",
    "*.code-workspace",
]

# `molt` on crates.io is an unrelated TCL interpreter, so the package is published as
# `molt-framework` while the library keeps the short name: `use molt::prelude::*`.
[lib]
name = "molt"
# `cdylib` is what wasm-pack links; it is also built on a native `cargo build`, which is
# harmless but not free. Library users only get the `rlib`.
crate-type = ["cdylib", "rlib"]

[features]
default = ["ssg"]
# Static site generation. Pulls in std::fs; compiled out on wasm32 regardless.
ssg = []
# WebAssembly bindings. Gated on the feature, never on target_arch — see docs/history/PORTING.md.
wasm = ["dep:wasm-bindgen"]
# Parallel bulk generation (implies `ssg`: it only parallelises `generate_multiple`).
# Sound only because the node tree is Send + Sync.
parallel = ["ssg", "dep:rayon"]

[dependencies]
wasm-bindgen = { version = "0.2", optional = true }
rayon = { version = "1.10", optional = true }

[dev-dependencies]
wasm-bindgen-test = "0.3"

# criterion pulls rayon, which refuses to compile for wasm32 ("Rayon cannot be used when
# targeting wasi32"). Keeping it off the wasm target is what lets `wasm-pack test` build.
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
criterion = "0.7"
# Counts allocations in `tests/allocations.rs`. The crate is `unsafe_code = "forbid"`, which
# also covers its tests, so an allocator written here would not compile; this one is MIT,
# has no dependencies, and is not part of the shipped library.
stats_alloc = "0.1"

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

# Both examples write to disk, so they need the `ssg` feature. Without this,
# `cargo test --no-default-features` tries to build them and fails on the missing module.
[[example]]
name = "static_site"
required-features = ["ssg"]

[[example]]
name = "marketing_page"

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

[profile.release]
opt-level = "z"
lto = true
codegen-units = 1
panic = "abort"
# Measured 2026-10-17: nodejs target, 22 KB gzip, under the 120 KB budget in
# scripts/build-wasm.sh. The flag is kept for safety, not size: it turns an arithmetic
# overflow into a trap instead of a silent wrap, and costs a few hundred bytes.
overflow-checks = true

# `cargo bench` inherits `release`, whose `opt-level = "z"` optimises for the WASM size
# budget. Benchmarking size-optimised code measures a build nobody runs on a server, so the
# bench profile goes back to speed.
[profile.bench]
opt-level = 3

[lints.rust]
missing_docs = "deny"
unsafe_code = "forbid"

[lints.clippy]
pedantic = { level = "warn", priority = -1 }
module_name_repetitions = "allow"
must_use_candidate = "allow"
unwrap_used = "deny"
expect_used = "deny"