From d26dedc3f7fac7c70e1bbb1ade9adacccc40723a Mon Sep 17 00:00:00 2001 From: Evan Almloff Date: Wed, 20 Mar 2024 17:07:18 -0500 Subject: [PATCH] fix streaming server functions, and precompress assets in release mode --- Cargo.lock | 404 +++++++++--------- packages/fullstack/Cargo.toml | 5 +- .../fullstack/examples/axum-auth/src/main.rs | 1 + packages/fullstack/src/assets.rs | 70 +++ packages/fullstack/src/axum_adapter.rs | 108 +++-- packages/fullstack/src/config.rs | 8 +- packages/fullstack/src/lib.rs | 2 + packages/signals/src/reactive_context.rs | 5 +- 8 files changed, 347 insertions(+), 256 deletions(-) create mode 100644 packages/fullstack/src/assets.rs diff --git a/Cargo.lock b/Cargo.lock index 409e5b0364..228d1ac465 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -85,9 +85,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] @@ -241,7 +241,7 @@ checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -263,7 +263,7 @@ dependencies = [ "argh_shared", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -338,13 +338,13 @@ dependencies = [ [[package]] name = "async-recursion" -version = "1.0.5" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0" +checksum = "30c5ef0ede93efbf733c1a727f3b6b5a1060bbedd5600183e66f6e4be4af0ec5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -355,13 +355,13 @@ checksum = "fbb36e985947064623dbd357f727af08ffd077f93d696782f3c56365fa2e2799" [[package]] name = "async-trait" -version = "0.1.77" +version = "0.1.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" +checksum = "461abc97219de0eaaf81fe3ef974a540158f3d079c2ab200f891f1a2ef201e85" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -415,9 +415,9 @@ dependencies = [ [[package]] name = "auth-git2" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41e7771d4ab6635cbd685ce8db215b29c78a468098126de77c57f3b2e6eb3757" +checksum = "e51bd0e4592409df8631ca807716dc1e5caafae5d01ce0157c966c71c7e49c3c" dependencies = [ "dirs", "git2", @@ -589,7 +589,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -733,15 +733,6 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" -[[package]] -name = "basic-toml" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "823388e228f614e9558c6804262db37960ec8821856535f5c3f59913140558f8" -dependencies = [ - "serde", -] - [[package]] name = "bigdecimal" version = "0.3.1" @@ -782,9 +773,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" dependencies = [ "serde", ] @@ -858,15 +849,15 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", "syn_derive", ] [[package]] name = "brotli" -version = "3.4.0" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "516074a47ef4bce09577a3b379392300159ce5b1ba2e501ff1c819950066100f" +checksum = "d640d25bc63c50fb1f0b545ffd80207d2e10a4c965530809b40ba3386825c391" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -991,7 +982,7 @@ version = "0.18.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ca26ef0159422fb77631dc9d17b102f253b876fe1586b03b803e63a309b4ee2" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "cairo-sys-rs", "glib", "libc", @@ -1055,7 +1046,7 @@ dependencies = [ "serde", "tempfile", "thiserror", - "toml 0.8.11", + "toml 0.8.12", "walkdir", ] @@ -1116,7 +1107,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3f9629bc6c4388ea699781dc988c2b99766d7679b151c81990b4fa1208fafd3" dependencies = [ "serde", - "toml 0.8.11", + "toml 0.8.12", ] [[package]] @@ -1126,7 +1117,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "802b755090e39835a4b0440fb0bbee0df7495a8b337f63db21e616f7821c7e8c" dependencies = [ "serde", - "toml 0.8.11", + "toml 0.8.12", ] [[package]] @@ -1278,7 +1269,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -1759,7 +1750,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" dependencies = [ "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -1790,7 +1781,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad291aa74992b9b7a7e88c38acbbf6ad7e107f1d90ee8775b7bc1fc3394f485c" dependencies = [ "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -1842,7 +1833,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -1853,7 +1844,7 @@ checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" dependencies = [ "darling_core", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -1987,7 +1978,7 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -1999,7 +1990,7 @@ dependencies = [ "pretty_assertions", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -2052,13 +2043,13 @@ dependencies = [ "serde", "serde_json", "subprocess", - "syn 2.0.52", + "syn 2.0.53", "tar", "tauri-bundler", "tempfile", "thiserror", "tokio", - "toml 0.8.11", + "toml 0.8.12", "toml_edit 0.21.1", "tower", "tower-http", @@ -2078,7 +2069,7 @@ dependencies = [ "serde_json", "tauri-bundler", "tauri-utils", - "toml 0.8.11", + "toml 0.8.12", "tracing", ] @@ -2092,37 +2083,38 @@ dependencies = [ [[package]] name = "dioxus-core" -version = "0.5.0-alpha.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f39bef0484998f724622964f04468ddfde7fd550f5f0f1aef9394306e9caba44" +version = "0.5.0-alpha.2" dependencies = [ + "dioxus", + "dioxus-ssr", "futures-channel", "futures-util", + "generational-box", "longest-increasing-subsequence", + "pretty_assertions", + "rand 0.8.5", + "reqwest", "rustc-hash", + "serde", "slab", + "tokio", "tracing", + "tracing-fluent-assertions", + "tracing-subscriber", ] [[package]] name = "dioxus-core" version = "0.5.0-alpha.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a46ef05152c03e3511e39097271e411b1ac13c74782077ade25382be16dd3531" dependencies = [ - "dioxus", - "dioxus-ssr", "futures-channel", "futures-util", - "generational-box", "longest-increasing-subsequence", - "pretty_assertions", - "rand 0.8.5", - "reqwest", "rustc-hash", - "serde", "slab", - "tokio", "tracing", - "tracing-fluent-assertions", "tracing-subscriber", ] @@ -2138,7 +2130,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.52", + "syn 2.0.53", "trybuild", ] @@ -2221,6 +2213,7 @@ name = "dioxus-fullstack" version = "0.5.0-alpha.2" dependencies = [ "anymap", + "async-compression", "async-trait", "axum", "base64", @@ -2319,7 +2312,7 @@ dependencies = [ "convert_case 0.6.0", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", "trybuild", ] @@ -2460,7 +2453,7 @@ dependencies = [ "proc-macro2", "quote", "slab", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -2473,7 +2466,7 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 2.0.52", + "syn 2.0.53", "tracing", ] @@ -2568,7 +2561,7 @@ dependencies = [ "proc-macro2", "quote", "server_fn_macro", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -2645,7 +2638,7 @@ checksum = "f2b99bf03862d7f545ebc28ddd33a665b50865f4dfd84031a393823879bd4c54" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -2714,7 +2707,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -2735,7 +2728,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -2887,7 +2880,7 @@ checksum = "ce8cd46a041ad005ab9c71263f9a0ff5b529eac0fe4cc9b4a20f4f0765d8cf4b" dependencies = [ "execute-command-tokens", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -3046,7 +3039,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -3195,9 +3188,9 @@ checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-lite" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445ba825b27408685aaecefd65178908c36c6e96aaf6d8599419d46e624192ba" +checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5" dependencies = [ "futures-core", "pin-project-lite", @@ -3211,7 +3204,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -3475,11 +3468,11 @@ dependencies = [ [[package]] name = "git2" -version = "0.18.2" +version = "0.18.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b3ba52851e73b46a4c3df1d89343741112003f0f6f13beb0dfac9e457c3fdcd" +checksum = "232e6a7bfe35766bf715e55a88b39a700596c0ccfd88cd3680b4cdb40d66ef70" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "libc", "libgit2-sys", "log", @@ -3529,7 +3522,7 @@ version = "0.14.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fbd06203b1a9b33a78c88252a625031b094d9e1b647260070c25b09910c0a804" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "bstr 1.9.1", "gix-path", "libc", @@ -3577,7 +3570,7 @@ version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5db19298c5eeea2961e5b3bf190767a2d1f09b8802aeb5f258e42276350aff19" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "bstr 1.9.1", "gix-features", "gix-path", @@ -3663,7 +3656,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fddc27984a643b20dd03e97790555804f98cf07404e0e552c0ad8133266a79a1" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "gix-path", "libc", "windows-sys 0.52.0", @@ -3714,7 +3707,7 @@ version = "0.18.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "233daaf6e83ae6a12a52055f568f9d7cf4671dabb78ff9560ab6da230ce00ee5" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "futures-channel", "futures-core", "futures-executor", @@ -3742,7 +3735,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -4048,14 +4041,14 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] name = "h2" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" +checksum = "4fbd2820c5e49886948654ab546d0688ff24530286bdcf8fca3cefb16d4618eb" dependencies = [ "bytes", "fnv", @@ -4072,9 +4065,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31d030e59af851932b72ceebadf4a2b5986dba4c3b99dd2493f8273a0f151943" +checksum = "51ee2dd2e4f378392eeff5d51618cd9a63166a2513846bbc55f21cfacd9199d4" dependencies = [ "bytes", "fnv", @@ -4213,6 +4206,12 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -4234,6 +4233,51 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hickory-proto" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "091a6fbccf4860009355e3efc52ff4acf37a63489aad7435372d44ceeb6fbbcf" +dependencies = [ + "async-trait", + "cfg-if", + "data-encoding", + "enum-as-inner", + "futures-channel", + "futures-io", + "futures-util", + "idna 0.4.0", + "ipnet", + "once_cell", + "rand 0.8.5", + "thiserror", + "tinyvec", + "tokio", + "tracing", + "url", +] + +[[package]] +name = "hickory-resolver" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35b8f021164e6a984c9030023544c57789c51760065cd510572fedcfb04164e8" +dependencies = [ + "cfg-if", + "futures-util", + "hickory-proto", + "ipconfig", + "lru-cache", + "once_cell", + "parking_lot", + "rand 0.8.5", + "resolv-conf", + "smallvec", + "thiserror", + "tokio", + "tracing", +] + [[package]] name = "hkdf" version = "0.12.4" @@ -4397,7 +4441,7 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2 0.3.24", + "h2 0.3.25", "http 0.2.12", "http-body 0.4.6", "httparse", @@ -4420,7 +4464,7 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "h2 0.4.2", + "h2 0.4.3", "http 1.1.0", "http-body 1.0.0", "httparse", @@ -4612,9 +4656,9 @@ dependencies = [ [[package]] name = "image-webp" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba6107a25f04af48ceeb4093eebc9b405ee5a1813a0bab5ecf1805d3eabb3337" +checksum = "7a84a25dcae3ac487bc24ef280f9e20c79c9b1a3e5e32cbed3041d1c514aa87c" dependencies = [ "byteorder", "thiserror", @@ -4754,7 +4798,7 @@ checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -4982,7 +5026,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b750dcadc39a09dbadd74e118f6dd6598df77fa01df0cfcdc52c28dece74528a" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "serde", "unicode-segmentation", ] @@ -5009,9 +5053,9 @@ dependencies = [ [[package]] name = "krates" -version = "0.16.6" +version = "0.16.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "320d34cfe880f2c6243b4cfff8aab3e34eab6325d0a26729f23356418fbdc809" +checksum = "b315eaab6cde3e2bcbd21810067a7b8bf4ced8cc63683ab7a96b18360c4e9df9" dependencies = [ "cargo_metadata 0.18.1", "cfg-expr", @@ -5126,7 +5170,7 @@ version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "libc", "redox_syscall", ] @@ -5194,7 +5238,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3bd5bed3814fb631bfc1e24c2be6f7e86a9837c660909acab79a38374dcb8798" dependencies = [ "ahash 0.8.11", - "bitflags 2.4.2", + "bitflags 2.5.0", "const-str", "cssparser 0.33.0", "cssparser-color", @@ -5278,7 +5322,7 @@ checksum = "fc2fb41a9bb4257a3803154bdf7e2df7d45197d1941c9b1a90ad815231630721" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -5398,7 +5442,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a42db80aa639f70d6bf1d2ef93612d2ffbb33f6ea17d473b91bfeb3f67bc24bc" dependencies = [ - "dioxus-core 0.5.0-alpha.0", + "dioxus-core 0.5.0-alpha.2 (registry+https://github.com/rust-lang/crates.io-index)", "manganis-macro", ] @@ -5455,7 +5499,7 @@ dependencies = [ "manganis-common", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -5755,9 +5799,9 @@ dependencies = [ [[package]] name = "new_debug_unreachable" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" [[package]] name = "nix" @@ -5789,7 +5833,7 @@ version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "cfg-if", "cfg_aliases", "libc", @@ -5903,7 +5947,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -6077,7 +6121,7 @@ version = "0.10.64" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "cfg-if", "foreign-types 0.3.2", "libc", @@ -6094,7 +6138,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -6202,7 +6246,7 @@ version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05d74befe2d076330d9a58bf9ca2da424568724ab278adf15fb5718253133887" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "cssparser 0.33.0", "fxhash", "log", @@ -6354,7 +6398,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -6482,7 +6526,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -6529,7 +6573,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -6700,7 +6744,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5" dependencies = [ "proc-macro2", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -6792,7 +6836,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8021cf59c8ec9c432cfc2526ac6b8aa508ecaf29cd415f271b8406c1b851c3fd" dependencies = [ "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -7115,16 +7159,17 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.26" +version = "0.11.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78bf93c4af7a8bb7d879d51cebe797356ff10ae8516ace542b5182d9dcac10b2" +checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" dependencies = [ "base64", "bytes", "encoding_rs", "futures-core", "futures-util", - "h2 0.3.24", + "h2 0.3.25", + "hickory-resolver", "http 0.2.12", "http-body 0.4.6", "hyper 0.14.28", @@ -7151,7 +7196,6 @@ dependencies = [ "tokio-rustls 0.24.1", "tokio-util", "tower-service", - "trust-dns-resolver", "url", "wasm-bindgen", "wasm-bindgen-futures", @@ -7210,7 +7254,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3625f343d89990133d013e39c46e350915178cf94f1bec9f49b0cbef98a3e3c" dependencies = [ "ahash 0.8.11", - "bitflags 2.4.2", + "bitflags 2.5.0", "instant", "num-traits", "once_cell", @@ -7227,7 +7271,7 @@ checksum = "853977598f084a492323fe2f7896b4100a86284ee8473612de60021ea341310f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -7287,7 +7331,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b91f7eff05f748767f183df4320a63d6936e9c6107d97c9e6bdd9784f4289c94" dependencies = [ "base64", - "bitflags 2.4.2", + "bitflags 2.5.0", "indexmap 2.2.5", "serde", "serde_derive", @@ -7325,7 +7369,7 @@ dependencies = [ "pretty_assertions", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -7367,11 +7411,11 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.31" +version = "0.38.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" +checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "errno", "libc", "linux-raw-sys", @@ -7652,7 +7696,7 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -7705,7 +7749,7 @@ checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -7756,7 +7800,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -7804,7 +7848,7 @@ dependencies = [ "convert_case 0.6.0", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", "xxhash-rust", ] @@ -7815,7 +7859,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "060af1def72353a779fcc184c53e1965d3055a38b9e827f2259b2bff2d9c371e" dependencies = [ "server_fn_macro", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -7974,7 +8018,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bdd941cc539bd3dc694edaf9d0c4e1221d02baa67c6b45ec04fad1024d9e8139" dependencies = [ "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -7990,9 +8034,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.13.1" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "smartstring" @@ -8197,7 +8241,7 @@ dependencies = [ "atoi", "base64", "bigdecimal", - "bitflags 2.4.2", + "bitflags 2.5.0", "byteorder", "bytes", "chrono", @@ -8245,7 +8289,7 @@ dependencies = [ "base64", "bigdecimal", "bit-vec", - "bitflags 2.4.2", + "bitflags 2.5.0", "byteorder", "chrono", "crc", @@ -8414,9 +8458,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.52" +version = "2.0.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07" +checksum = "7383cd0e49fff4b6b90ca5670bfd3e9d6a733b3f90c686605aa7eec8c4996032" dependencies = [ "proc-macro2", "quote", @@ -8432,7 +8476,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -8464,14 +8508,14 @@ dependencies = [ [[package]] name = "system-deps" -version = "6.2.1" +version = "6.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8e9199467bcbc77c6a13cc6e32a6af21721ab8c96aa0261856c4fda5a4433f0" +checksum = "a3e535eb8dded36d55ec13eddacd30dec501792ff23a0b1682c38601b8cf2349" dependencies = [ "cfg-expr", - "heck 0.4.1", + "heck 0.5.0", "pkg-config", - "toml 0.8.11", + "toml 0.8.12", "version-compare", ] @@ -8704,7 +8748,7 @@ checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -8828,7 +8872,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -8916,15 +8960,15 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.11" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af06656561d28735e9c1cd63dfd57132c8155426aa6af24f36a00a351f88c48e" +checksum = "e9dd1545e8208b4a5af1aa9bbd0b4cf7e9ea08fabc5d0a5c67fcaafa17433aa3" dependencies = [ "indexmap 2.2.5", "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.7", + "toml_edit 0.22.9", ] [[package]] @@ -8973,9 +9017,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.7" +version = "0.22.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18769cd1cec395d70860ceb4d932812a0b4d06b1a4bb336745a4d21b9496e992" +checksum = "8e40bb779c5187258fd7aad0eb68cb8706a0a81fa712fbea808ab43c4b8374c4" dependencies = [ "indexmap 2.2.5", "serde", @@ -9008,7 +9052,7 @@ checksum = "1e9cd434a998747dd2c4276bc96ee2e0c7a2eadf3cae88e52be55a05fa9053f5" dependencies = [ "async-compression", "base64", - "bitflags 2.4.2", + "bitflags 2.5.0", "bytes", "futures-core", "futures-util", @@ -9063,7 +9107,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -9142,52 +9186,6 @@ dependencies = [ "serde_json", ] -[[package]] -name = "trust-dns-proto" -version = "0.23.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3119112651c157f4488931a01e586aa459736e9d6046d3bd9105ffb69352d374" -dependencies = [ - "async-trait", - "cfg-if", - "data-encoding", - "enum-as-inner", - "futures-channel", - "futures-io", - "futures-util", - "idna 0.4.0", - "ipnet", - "once_cell", - "rand 0.8.5", - "smallvec", - "thiserror", - "tinyvec", - "tokio", - "tracing", - "url", -] - -[[package]] -name = "trust-dns-resolver" -version = "0.23.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a3e6c3aff1718b3c73e395d1f35202ba2ffa847c6a62eea0db8fb4cfe30be6" -dependencies = [ - "cfg-if", - "futures-util", - "ipconfig", - "lru-cache", - "once_cell", - "parking_lot", - "rand 0.8.5", - "resolv-conf", - "smallvec", - "thiserror", - "tokio", - "tracing", - "trust-dns-proto", -] - [[package]] name = "try-lock" version = "0.2.5" @@ -9196,11 +9194,10 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "trybuild" -version = "1.0.89" +version = "1.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a9d3ba662913483d6722303f619e75ea10b7855b0f8e0d72799cf8621bb488f" +checksum = "2aa6f84ec205ebf87fb7a0abdbcd1467fa5af0e86878eb6d888b78ecbb10b6d5" dependencies = [ - "basic-toml", "dissimilar", "glob", "once_cell", @@ -9208,6 +9205,7 @@ dependencies = [ "serde_derive", "serde_json", "termcolor", + "toml 0.8.12", ] [[package]] @@ -9366,9 +9364,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" +checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" dependencies = [ "getrandom 0.2.12", "serde", @@ -9394,9 +9392,9 @@ checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" [[package]] name = "value-bag" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fec26a25bd6fca441cdd0f769fd7f891bae119f996de31f86a5eddccef54c1d" +checksum = "74797339c3b98616c009c7c3eb53a0ce41e85c8ec66bd3db96ed132d20cfdee8" [[package]] name = "vcpkg" @@ -9406,9 +9404,9 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "version-compare" -version = "0.1.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "579a42fc0b8e0c63b76519a339be31bed574929511fa53c1a3acae26eb258f29" +checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b" [[package]] name = "version_check" @@ -9508,7 +9506,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", "wasm-bindgen-shared", ] @@ -9574,7 +9572,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -9617,7 +9615,7 @@ checksum = "b7f89739351a2e03cb94beb799d47fb2cac01759b40ec441f7de39b00cbf7ef0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -9800,7 +9798,7 @@ checksum = "ac1345798ecd8122468840bcdf1b95e5dc6d2206c5e4b0eafa078d061f59c9bc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -9908,7 +9906,7 @@ checksum = "12168c33176773b86799be25e2a2ba07c7aab9968b37541f1094dbd7a60c8946" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -9919,7 +9917,7 @@ checksum = "9d8dc32e0095a7eeccebd0e3f09e9509365ecb3fc6ac4d6f5f14a3f6392942d1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] @@ -10272,7 +10270,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.52", + "syn 2.0.53", ] [[package]] diff --git a/packages/fullstack/Cargo.toml b/packages/fullstack/Cargo.toml index e419205a97..98eac307bb 100644 --- a/packages/fullstack/Cargo.toml +++ b/packages/fullstack/Cargo.toml @@ -17,7 +17,8 @@ dioxus_server_macro = { workspace = true } # axum axum = { workspace = true, features = ["ws", "macros"], optional = true } -tower-http = { workspace = true, optional = true, features = ["fs", "compression-gzip"] } +tower-http = { workspace = true, optional = true, features = ["fs"] } +async-compression = { version = "0.4.6", features = ["gzip", "tokio"], optional = true } dioxus-lib = { workspace = true } @@ -73,7 +74,7 @@ desktop = ["dioxus-desktop"] mobile = ["dioxus-mobile"] default-tls = ["server_fn/default-tls"] rustls = ["server_fn/rustls"] -axum = ["dep:axum", "tower-http", "server", "server_fn/axum", "dioxus_server_macro/axum"] +axum = ["dep:axum", "tower-http", "server", "server_fn/axum", "dioxus_server_macro/axum", "async-compression"] server = [ "server_fn/ssr", "dioxus_server_macro/server", diff --git a/packages/fullstack/examples/axum-auth/src/main.rs b/packages/fullstack/examples/axum-auth/src/main.rs index e1638e1b6a..7410da416e 100644 --- a/packages/fullstack/examples/axum-auth/src/main.rs +++ b/packages/fullstack/examples/axum-auth/src/main.rs @@ -52,6 +52,7 @@ fn main() { .serve_dioxus_application(ServeConfig::builder().build(), || { VirtualDom::new(app) }) + .await .layer( axum_session_auth::AuthSessionLayer::< crate::auth::User, diff --git a/packages/fullstack/src/assets.rs b/packages/fullstack/src/assets.rs new file mode 100644 index 0000000000..5dd27da3e1 --- /dev/null +++ b/packages/fullstack/src/assets.rs @@ -0,0 +1,70 @@ +//! Handles pre-compression for any static assets + +use std::{ffi::OsString, path::PathBuf, pin::Pin}; + +use async_compression::tokio::bufread::GzipEncoder; +use futures_util::Future; +use tokio::task::JoinSet; + +#[allow(unused)] +pub async fn pre_compress_files(directory: PathBuf) -> tokio::io::Result<()> { + // print to stdin encoded gzip data + pre_compress_dir(directory).await?; + Ok(()) +} + +fn pre_compress_dir( + path: PathBuf, +) -> Pin> + Send + Sync>> { + Box::pin(async move { + let mut entries = tokio::fs::read_dir(&path).await?; + let mut set: JoinSet> = JoinSet::new(); + + while let Some(entry) = entries.next_entry().await? { + set.spawn(async move { + if entry.file_type().await?.is_dir() { + if let Err(err) = pre_compress_dir(entry.path()).await { + tracing::error!( + "Failed to pre-compress directory {}: {}", + entry.path().display(), + err + ); + } + } else if let Err(err) = pre_compress_file(entry.path()).await { + tracing::error!( + "Failed to pre-compress static assets {}: {}", + entry.path().display(), + err + ); + } + + Ok(()) + }); + } + while let Some(res) = set.join_next().await { + res??; + } + Ok(()) + }) +} + +async fn pre_compress_file(path: PathBuf) -> tokio::io::Result<()> { + let file = tokio::fs::File::open(&path).await?; + let stream = tokio::io::BufReader::new(file); + let mut encoder = GzipEncoder::new(stream); + let new_extension = match path.extension() { + Some(ext) => { + if ext.to_string_lossy().to_lowercase().ends_with("gz") { + return Ok(()); + } + let mut ext = ext.to_os_string(); + ext.push(".gz"); + ext + } + None => OsString::from("gz"), + }; + let output = path.with_extension(new_extension); + let mut buffer = tokio::fs::File::create(&output).await?; + tokio::io::copy(&mut encoder, &mut buffer).await?; + Ok(()) +} diff --git a/packages/fullstack/src/axum_adapter.rs b/packages/fullstack/src/axum_adapter.rs index df1485372e..6084b4370a 100644 --- a/packages/fullstack/src/axum_adapter.rs +++ b/packages/fullstack/src/axum_adapter.rs @@ -64,6 +64,7 @@ use axum::{ Router, }; use dioxus_lib::prelude::VirtualDom; +use futures_util::Future; use http::header::*; use std::sync::Arc; @@ -149,7 +150,12 @@ pub trait DioxusRouterExt { /// unimplemented!() /// } /// ``` - fn serve_static_assets(self, assets_path: impl Into) -> Self; + fn serve_static_assets( + self, + assets_path: impl Into, + ) -> impl Future + Send + Sync + where + Self: Sized; /// Serves the Dioxus application. This will serve a complete server side rendered application. /// This will serve static assets, server render the application, register server functions, and intigrate with hot reloading. @@ -182,7 +188,9 @@ pub trait DioxusRouterExt { self, cfg: impl Into, build_virtual_dom: impl Fn() -> VirtualDom + Send + Sync + 'static, - ) -> Self; + ) -> impl Future + Send + Sync + where + Self: Sized; } impl DioxusRouterExt for Router @@ -206,59 +214,75 @@ where self } - fn serve_static_assets(mut self, assets_path: impl Into) -> Self { + fn serve_static_assets( + mut self, + assets_path: impl Into, + ) -> impl Future + Send + Sync { use tower_http::services::{ServeDir, ServeFile}; let assets_path = assets_path.into(); - - // Serve all files in dist folder except index.html - let dir = std::fs::read_dir(&assets_path).unwrap_or_else(|e| { - panic!( - "Couldn't read assets directory at {:?}: {}", - &assets_path, e - ) - }); - - for entry in dir.flatten() { - let path = entry.path(); - if path.ends_with("index.html") { - continue; + async move { + #[cfg(not(debug_assertions))] + if let Err(err) = crate::assets::pre_compress_files(assets_path.clone()).await { + tracing::error!("Failed to pre-compress static assets: {}", err); } - let route = path - .strip_prefix(&assets_path) - .unwrap() - .iter() - .map(|segment| { - segment.to_str().unwrap_or_else(|| { - panic!("Failed to convert path segment {:?} to string", segment) + + // Serve all files in dist folder except index.html + let dir = std::fs::read_dir(&assets_path).unwrap_or_else(|e| { + panic!( + "Couldn't read assets directory at {:?}: {}", + &assets_path, e + ) + }); + + for entry in dir.flatten() { + let path = entry.path(); + if path.ends_with("index.html") { + continue; + } + let route = path + .strip_prefix(&assets_path) + .unwrap() + .iter() + .map(|segment| { + segment.to_str().unwrap_or_else(|| { + panic!("Failed to convert path segment {:?} to string", segment) + }) }) - }) - .collect::>() - .join("/"); - let route = format!("/{}", route); - if path.is_dir() { - self = self.nest_service(&route, ServeDir::new(path)); - } else { - self = self.nest_service(&route, ServeFile::new(path)); + .collect::>() + .join("/"); + let route = format!("/{}", route); + if path.is_dir() { + self = self.nest_service(&route, ServeDir::new(path).precompressed_gzip()); + } else { + self = self.nest_service(&route, ServeFile::new(path).precompressed_gzip()); + } } - } - self + self + } } fn serve_dioxus_application( self, cfg: impl Into, build_virtual_dom: impl Fn() -> VirtualDom + Send + Sync + 'static, - ) -> Self { + ) -> impl Future + Send + Sync { let cfg = cfg.into(); - let ssr_state = SSRState::new(&cfg); - - // Add server functions and render index.html - self.serve_static_assets(cfg.assets_path.clone()) - .connect_hot_reload() - .register_server_fns() - .fallback(get(render_handler).with_state((cfg, Arc::new(build_virtual_dom), ssr_state))) + async move { + let ssr_state = SSRState::new(&cfg); + + // Add server functions and render index.html + self.serve_static_assets(cfg.assets_path.clone()) + .await + .connect_hot_reload() + .register_server_fns() + .fallback(get(render_handler).with_state(( + cfg, + Arc::new(build_virtual_dom), + ssr_state, + ))) + } } fn connect_hot_reload(self) -> Self { @@ -469,7 +493,6 @@ async fn handle_server_fns_inner( if let Some(mut service) = server_fn::axum::get_server_fn_service(&path_string) { - let server_context = DioxusServerContext::new(Arc::new(tokio::sync::RwLock::new(parts))); additional_context(); @@ -485,7 +508,6 @@ async fn handle_server_fns_inner( // actually run the server fn let mut res = service.run(req).await; - // it it accepts text/html (i.e., is a plain form post) and doesn't already have a // Location set, then redirect to Referer if accepts_html { diff --git a/packages/fullstack/src/config.rs b/packages/fullstack/src/config.rs index a0f7211c68..3666665dae 100644 --- a/packages/fullstack/src/config.rs +++ b/packages/fullstack/src/config.rs @@ -133,18 +133,14 @@ impl Config { #[cfg(not(any(feature = "desktop", feature = "mobile")))] let router = router .serve_static_assets(cfg.assets_path.clone()) + .await .connect_hot_reload() .fallback(get(render_handler).with_state(( cfg, Arc::new(build_virtual_dom), ssr_state, ))); - let router = router - .layer( - ServiceBuilder::new() - .layer(tower_http::compression::CompressionLayer::new().gzip(true)), - ) - .into_make_service(); + let router = router.into_make_service(); let listener = tokio::net::TcpListener::bind(addr).await.unwrap(); axum::serve(listener, router).await.unwrap(); } diff --git a/packages/fullstack/src/lib.rs b/packages/fullstack/src/lib.rs index 31090670ed..ada1658302 100644 --- a/packages/fullstack/src/lib.rs +++ b/packages/fullstack/src/lib.rs @@ -8,6 +8,8 @@ pub use once_cell; mod html_storage; +#[cfg(feature = "axum")] +mod assets; #[cfg_attr(docsrs, doc(cfg(feature = "axum")))] #[cfg(feature = "axum")] mod axum_adapter; diff --git a/packages/signals/src/reactive_context.rs b/packages/signals/src/reactive_context.rs index b4062be781..b8c5e27d35 100644 --- a/packages/signals/src/reactive_context.rs +++ b/packages/signals/src/reactive_context.rs @@ -5,7 +5,7 @@ use futures_channel::mpsc::UnboundedReceiver; use generational_box::SyncStorage; use std::{cell::RefCell, hash::Hash}; -use crate::{CopyValue, Readable, Writable}; +use crate::{CopyValue, Writable}; /// A context for signal reads and writes to be directed to /// @@ -26,6 +26,7 @@ impl std::fmt::Display for ReactiveContext { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { #[cfg(debug_assertions)] { + use crate::Readable; if let Ok(read) = self.inner.try_read() { return write!(f, "ReactiveContext created at {}", read.origin); } @@ -58,7 +59,7 @@ impl ReactiveContext { pub fn new_with_callback( callback: impl FnMut() + Send + Sync + 'static, scope: ScopeId, - origin: &'static std::panic::Location<'static>, + #[allow(unused)] origin: &'static std::panic::Location<'static>, ) -> Self { let inner = Inner { self_: None,