Luke Valenta fba130e663
refactor: Clean up worker-sandbox (#763)
* Clean up worker-sandbox

- Remove unexpected fields from wrangler.toml (type, miniflare, package)
- Address or add allow rules for clippy::pedantic lints
- Add macros to avoid duplicate route configurations
- Move files from src/test/* to src/ and add test handlers and routes to
  make it possible to run the tests from the sandbox worker
- Move several handlers out of alarm.rs and into more suitable files
  (e.g., counter.rs where the corresponding Durable Objects live). Note
  that the SHARED_COUNTER Durable Object class is still not yet defined.
- Fix and add test handler for handle_basic_test, which passes
  except for the transactional storage API tests

* Address review comments

- Clean up additional clippy lints rather than add exceptions
- Describe how to get tests to pass even with dwarf-debug-info enabled

* Fix new clippy complaints
2025-07-07 15:28:41 -07:00

14 lines
450 B
Rust

use std::env::var;
use worker_codegen::wit::expand_wit_source;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Tell Cargo that if the given file changes, to rerun this build script.
println!("cargo::rerun-if-changed=wit/calculator.wit");
let source = expand_wit_source("wit/calculator.wit")?;
let out_dir = var("OUT_DIR")?;
let dest = format!("{out_dir}/calculator.rs");
std::fs::write(dest, source)?;
Ok(())
}