From 468442b0a1c81d2e6b4456d54cb1d632cdf27d19 Mon Sep 17 00:00:00 2001 From: Adam <24621027+adoyle0@users.noreply.github.com> Date: Fri, 26 Jan 2024 18:47:57 -0500 Subject: [PATCH] trim more fat --- Cargo.lock | 168 ++++++++++------------------------------- Cargo.toml | 5 +- app/Cargo.toml | 3 - frontend/Cargo.toml | 4 - frontend/src/lib.rs | 2 - server/Cargo.toml | 4 - server/src/fileserv.rs | 2 +- server/src/main.rs | 11 --- 8 files changed, 40 insertions(+), 159 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3247f6b..79bd0db 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -65,7 +65,6 @@ checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" name = "app" version = "0.1.0" dependencies = [ - "cfg-if", "femark", "http 1.0.0", "leptos", @@ -361,16 +360,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "186dce98367766de751c42c4f03970fc60fc012296e706ccbb9d5df9b6c1e271" -[[package]] -name = "colored" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" -dependencies = [ - "lazy_static", - "windows-sys", -] - [[package]] name = "config" version = "0.13.4" @@ -395,16 +384,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "console_log" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be8aed40e4edbf4d3b4431ab260b63fdc40f5780a4766824329ea0f1eefe3c0f" -dependencies = [ - "log", - "web-sys", -] - [[package]] name = "const_format" version = "0.2.32" @@ -488,15 +467,6 @@ dependencies = [ "parking_lot_core", ] -[[package]] -name = "deranged" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" -dependencies = [ - "powerfmt", -] - [[package]] name = "derive-where" version = "1.2.7" @@ -603,9 +573,7 @@ version = "0.1.0" dependencies = [ "app", "console_error_panic_hook", - "console_log", "leptos", - "log", "wasm-bindgen", ] @@ -1037,9 +1005,9 @@ checksum = "71dd52191aae121e8611f1e8dc3e324dd0dd1dee1e6dd91d10ee07a3cfb4d9d8" [[package]] name = "inventory" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8573b2b1fb643a372c73b23f4da5f888677feef3305146d68a539250a9bccc7" +checksum = "f958d3d68f4167080a18141e10381e7634563984a537f2a49a30fd8e53ac5767" [[package]] name = "itertools" @@ -1073,9 +1041,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "leptos" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3478784b7ea7f4329bfa6d222c79e67bdcb8541339682124b7e01f657debf89c" +checksum = "07ddb6345d8791d75a77621f38f96efac61f9de415521da49d4ec1d72841ad79" dependencies = [ "cfg-if", "leptos_config", @@ -1095,9 +1063,9 @@ dependencies = [ [[package]] name = "leptos_axum" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78d5965dea7f63b50a0049fd7ccd710340025fcaf677715895cf1b1ee301f1ff" +checksum = "fc09f66498d5932a0da61dfe988e5a39f5b210d7b2553f8a657ff2747b337925" dependencies = [ "axum", "cfg-if", @@ -1119,9 +1087,9 @@ dependencies = [ [[package]] name = "leptos_config" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66923ee5dfe1f46b35bd46140fb697a8f1ed876556f2d95af774ff53eb83a91d" +checksum = "007728ee99154fbaae4136816f2de73a9b6ee53bdca8c8e66303c68463f126cf" dependencies = [ "config", "regex", @@ -1132,9 +1100,9 @@ dependencies = [ [[package]] name = "leptos_dom" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f32aac29058236930139a25566bfae50aa1aed3f5a9535f73dad498d7198f629" +checksum = "073c7dddff5415f9efc95450ccfcecf6a70e4972ff5380899782e83f908cbae7" dependencies = [ "async-recursion", "cfg-if", @@ -1162,9 +1130,9 @@ dependencies = [ [[package]] name = "leptos_hot_reload" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "018635fa2c4d9df22b22a5db0a99ecdaa54fe0b8071e03804730e01ab6ee7dad" +checksum = "aa39ec2b81d532954adff1a3c95869b8f639a9dc44b1c8ebf190ab952ae7d0f0" dependencies = [ "anyhow", "camino", @@ -1180,9 +1148,9 @@ dependencies = [ [[package]] name = "leptos_integration_utils" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac17f1781bca258ea4b1d9807805e7ed29f179be331beb693ee10629baf0c782" +checksum = "16cca15d3ff715a9f326bc98073325e4f4087f280885b2dd0a78f0104ad536d8" dependencies = [ "futures", "leptos", @@ -1194,9 +1162,9 @@ dependencies = [ [[package]] name = "leptos_macro" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2e3b52e7e463f075ff453c225b4ca0fef3a306a11900f573a94a4e39a3b727f" +checksum = "ef651b98a10c087aaf827e75ce60435b1e5f75ed9dd6acf7fb29df480958a375" dependencies = [ "attribute-derive", "cfg-if", @@ -1217,9 +1185,9 @@ dependencies = [ [[package]] name = "leptos_meta" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41631f5793f6e8e1f76b126f3bbfde586e9224483f25a58ad0709d3d36da1412" +checksum = "e454c6bde92daf0d4f1dc785421cc53301c4973495d3389cb2b9d52baa938b29" dependencies = [ "cfg-if", "indexmap 2.1.0", @@ -1231,9 +1199,9 @@ dependencies = [ [[package]] name = "leptos_reactive" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d14dbf84793e5dd44c6c87bf7819839033671ae45da3242546cde253e670db7" +checksum = "ef4afa68353fff93870aaf0b222e273530ebb9b460ad51b9b527395fd4f11350" dependencies = [ "base64", "cfg-if", @@ -1260,9 +1228,9 @@ dependencies = [ [[package]] name = "leptos_router" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "404829710124417613cc311040420dce1f13e51bee2ffe7420bd6a91961ed300" +checksum = "11f20a15065fd2ac89c9b492b2c4acf746bf61f995c647d7e57bf070bdce1719" dependencies = [ "cached", "cfg-if", @@ -1292,9 +1260,9 @@ dependencies = [ [[package]] name = "leptos_server" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35019328184d6328846913c5a1ce3b491472b59a46ab0b8cda0c4dcdfda629d0" +checksum = "b5e518e25e671e8c99a1c3389afb9c094a6930735b555ee166b544a57f3f54a1" dependencies = [ "inventory", "lazy_static", @@ -1493,15 +1461,6 @@ dependencies = [ "libc", ] -[[package]] -name = "num_threads" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" -dependencies = [ - "libc", -] - [[package]] name = "object" version = "0.32.2" @@ -1596,12 +1555,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" -[[package]] -name = "powerfmt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" - [[package]] name = "ppv-lite86" version = "0.2.17" @@ -1935,9 +1888,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.195" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" +checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" dependencies = [ "serde_derive", ] @@ -1955,9 +1908,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.195" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" +checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" dependencies = [ "proc-macro2", "quote", @@ -1966,9 +1919,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.111" +version = "1.0.112" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4" +checksum = "4d1bd37ce2324cf3bf85e5a25f96eb4baf0d5aa6eba43e7ae8958870c4ec48ed" dependencies = [ "itoa", "ryu", @@ -2034,8 +1987,6 @@ dependencies = [ "axum", "leptos", "leptos_axum", - "log", - "simple_logger", "tokio", "tower", "tower-http", @@ -2043,9 +1994,9 @@ dependencies = [ [[package]] name = "server_fn" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a385f47db08f9d14c124c0e2a342bacac34ba4597c38ed6608ae00f4a2e1bdde" +checksum = "8f4a5fa078a95688bc5b065064647bb64682064408d5fa5a9705e9e85dec95bf" dependencies = [ "axum", "bytes", @@ -2078,9 +2029,9 @@ dependencies = [ [[package]] name = "server_fn_macro" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42c807bed78dcfe0357474f887a3d6820cc7b7b22afa65eb6e74986aa8192c7f" +checksum = "a5b20407751cd063e5bf529d5a56ff8a6485dbd2d5495b8a3a355d232ff4b3df" dependencies = [ "const_format", "convert_case", @@ -2092,9 +2043,9 @@ dependencies = [ [[package]] name = "server_fn_macro_default" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a24237266f429382c90f4329a6358a4ad9ecf4dfd445d0ccd5cdd2f02cead38" +checksum = "6ec18da12164b10d82315d0188d8c3ddecf173d7d59402475009729b4d8886b3" dependencies = [ "server_fn_macro", "syn 2.0.48", @@ -2115,18 +2066,6 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" -[[package]] -name = "simple_logger" -version = "4.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e7e46c8c90251d47d08b28b8a419ffb4aede0f87c2eea95e17d1d5bacbf3ef1" -dependencies = [ - "colored", - "log", - "time", - "windows-sys", -] - [[package]] name = "slab" version = "0.4.9" @@ -2250,37 +2189,6 @@ dependencies = [ "syn 2.0.48", ] -[[package]] -name = "time" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" -dependencies = [ - "deranged", - "itoa", - "libc", - "num_threads", - "powerfmt", - "serde", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" - -[[package]] -name = "time-macros" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" -dependencies = [ - "time-core", -] - [[package]] name = "tinyvec" version = "1.6.0" @@ -2910,9 +2818,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winnow" -version = "0.5.34" +version = "0.5.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7cf47b659b318dccbd69cc4797a39ae128f533dce7902a1096044d1967b9c16" +checksum = "1931d78a9c73861da0134f453bb1f790ce49b2e30eba8410b4b79bac72b46a2d" dependencies = [ "memchr", ] diff --git a/Cargo.toml b/Cargo.toml index 99d3e74..f9e8403 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,7 @@ members = ["app", "frontend", "server"] codegen-units = 1 lto = true opt-level = 'z' +panic = "abort" [workspace.dependencies] leptos = { version = "0.6", features = [ @@ -19,12 +20,8 @@ leptos_meta = { version = "0.6", features = ["nightly"] } leptos_router = { version = "0.6", features = ["nightly"] } axum = "0.7" -cfg-if = "1" console_error_panic_hook = "0.1" -console_log = "1" http = "1" -log = "0.4.20" -simple_logger = "4.2.0" thiserror = "1" tokio = { version = "1", features = ["full"] } tower = { version = "0.4", features = ["full"] } diff --git a/app/Cargo.toml b/app/Cargo.toml index 29d838e..7e4da7f 100644 --- a/app/Cargo.toml +++ b/app/Cargo.toml @@ -3,8 +3,6 @@ name = "app" version = "0.1.0" edition = "2021" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [dependencies] leptos.workspace = true leptos_meta.workspace = true @@ -12,7 +10,6 @@ leptos_router.workspace = true leptos_axum = { workspace = true, optional = true } http.workspace = true -cfg-if.workspace = true thiserror.workspace = true serde = "1.0.195" femark = { version = "0.1.5", optional = true } diff --git a/frontend/Cargo.toml b/frontend/Cargo.toml index 7c59a4e..37476df 100644 --- a/frontend/Cargo.toml +++ b/frontend/Cargo.toml @@ -6,13 +6,9 @@ edition = "2021" [lib] crate-type = ["cdylib", "rlib"] -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [dependencies] app = { path = "../app", features = ["hydrate"] } leptos = { workspace = true, features = [ "hydrate" ] } console_error_panic_hook.workspace = true -console_log.workspace = true -log.workspace = true wasm-bindgen.workspace = true diff --git a/frontend/src/lib.rs b/frontend/src/lib.rs index d196915..566c7f6 100644 --- a/frontend/src/lib.rs +++ b/frontend/src/lib.rs @@ -4,8 +4,6 @@ use wasm_bindgen::prelude::wasm_bindgen; #[wasm_bindgen] pub fn hydrate() { - // initializes logging using the `log` crate - _ = console_log::init_with_level(log::Level::Debug); console_error_panic_hook::set_once(); // leptos::mount_to_body(App); diff --git a/server/Cargo.toml b/server/Cargo.toml index 1ba9c36..724a5af 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -3,16 +3,12 @@ name = "server" version = "0.1.0" edition = "2021" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [dependencies] app = { path = "../app", default-features = false, features = ["ssr"] } leptos = { workspace = true, features = [ "ssr" ]} leptos_axum.workspace = true axum.workspace = true -simple_logger.workspace = true tokio.workspace = true tower.workspace = true tower-http.workspace = true -log.workspace = true diff --git a/server/src/fileserv.rs b/server/src/fileserv.rs index 3ec1e0e..eaf4170 100644 --- a/server/src/fileserv.rs +++ b/server/src/fileserv.rs @@ -31,7 +31,7 @@ async fn get_static_file(uri: Uri, root: &str) -> Result, (Status .uri(uri.clone()) .body(Body::empty()) .unwrap(); - // `ServeDir` implements `tower::Service` so we can call it with `tower::ServiceExt::oneshot` + // This path is relative to the cargo root match ServeDir::new(root).oneshot(req).await { Ok(res) => Ok(res.into_response()), diff --git a/server/src/main.rs b/server/src/main.rs index 4843122..e375937 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -8,29 +8,18 @@ pub mod fileserv; #[tokio::main] async fn main() { - simple_logger::init_with_level(log::Level::Debug).expect("couldn't initialize logging"); - - // Setting get_configuration(None) means we'll be using cargo-leptos's env values - // For deployment these variables are: - // - // Alternately a file can be specified such as Some("Cargo.toml") - // The file would need to be included with the executable when moved to deployment let conf = get_configuration(None).await.unwrap(); let leptos_options = conf.leptos_options; let addr = leptos_options.site_addr; let (routes, data) = generate_route_list_with_exclusions_and_ssg(App, None); build_static_routes(&leptos_options, App, &routes, data).await; - // build our application with a route let app = Router::new() .leptos_routes(&leptos_options, routes, App) .fallback(file_and_error_handler) .with_state(leptos_options); - // run our app with hyper - // `axum::Server` is a re-export of `hyper::Server` let listener = tokio::net::TcpListener::bind(&addr).await.unwrap(); - log::info!("listening on http://{}", &addr); axum::serve(listener, app.into_make_service()) .await .unwrap();