[package] name = "pages" version = "0.1.0" edition = "2021" license = "MIT OR Apache-2.0" [lib] crate-type = ["cdylib", "rlib"] # Shared dependencies: compile for both native host and wasm32-unknown-unknown. [dependencies] # Serialisation for API request/response payloads and D1 row (de)serialisation. serde = { version = "1", features = ["derive"] } serde_json = "1" # Error types with Display/std::error::Error derive — works on both native and wasm32. thiserror = "2" # Zip reading for upload validation (core::upload); deflate is the only # compression method we need to support. Pure Rust, compiles on wasm32. zip = { version = "2", default-features = false, features = ["deflate"] } # Compressed-tarball decompressors for upload validation (core::upload). All # three are pure Rust with no C (`*-sys`) bindings and no threads, so they # compile for wasm32-unknown-unknown and run in the single-threaded Worker. # gzip via miniz_oxide's rust_backend (no zlib-sys); ruzstd is a pure-Rust # streaming zstd decoder; lzma-rs is a pure-Rust (one-shot) xz decoder. flate2 = { version = "1", default-features = false, features = ["rust_backend"] } ruzstd = "0.8" lzma-rs = "0.3" # ustar tar reading for the compressed-tarball formats. Reads entries as # in-memory `io::Read` streams — entries are never unpacked to a filesystem. tar = "0.4" # SHA-256 for session token hashing (auth); pure Rust, compiles on wasm32. sha2 = "0.10" # Entropy for session/state token generation (auth.rs). Declared unconditionally # (no features) so `generate_token` compiles and is unit-testable on the native # host target too; the wasm_js feature required for wasm32-unknown-unknown is # layered on in the wasm-only dependency table below — Cargo unifies the two # declarations of the same crate/version, adding the feature only on that # target. getrandom = "0.4" # WASM-only dependencies (Workers entry point). # workers-rs, getrandom/wasm_js, and the axum Workers glue are wasm32-specific. [target.'cfg(target_arch = "wasm32")'.dependencies] # Cloudflare Workers SDK — provides D1 bindings, fetch, KV, etc. # The `http` feature makes the fetch handler accept/return standard http types, # enabling direct Axum router integration without manual request conversion. worker = { version = "0.7", features = ["d1", "http"] } # Axum HTTP framework for the WASM Workers entry point — minimal feature set # (no full tokio runtime needed; json and query features required for handlers). axum = { version = "0.8", default-features = false, features = ["json", "query"] } # Tower service trait — required by the WASM entry point to call the Axum router. tower-service = "0.3" # http crate — re-exported by axum and worker; needed explicitly so the return # type `http::Response` resolves in the fetch event handler. http = "1" # Enables the wasm_js feature of the unconditional `getrandom` dependency # above (see its comment) — routes entropy to crypto.getRandomValues() via # the Web Crypto API, required for wasm32-unknown-unknown. getrandom = { version = "0.4", features = ["wasm_js"] } [profile.release] opt-level = "z" lto = true strip = true codegen-units = 1