From 2ed30ec0100909e6015b231921a383f0f6800c9b Mon Sep 17 00:00:00 2001 From: GitHub Date: Sat, 12 Oct 2024 17:18:30 +0800 Subject: [PATCH] reduce binary size --- Cargo.lock | 155 ++++++++++++++++++++++++++++------------------------- Cargo.toml | 8 +-- 2 files changed, 85 insertions(+), 78 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cff013c0..750b0191 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -23,6 +23,12 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" +[[package]] +name = "adler32" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" + [[package]] name = "ahash" version = "0.7.8" @@ -238,12 +244,6 @@ dependencies = [ "windows-targets", ] -[[package]] -name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - [[package]] name = "base64" version = "0.21.7" @@ -404,11 +404,10 @@ checksum = "ade8366b8bd5ba243f0a58f036cc0ca8a2f069cff1a2351ef1cac6b083e16fc0" [[package]] name = "captcha" version = "0.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db21780337b425f968a2c3efa842eeaa4fe53d2bcb1eb27d2877460a862fb0ab" +source = "git+https://github.com/freedit-dev/captcha.git#5a9e20322dc1cc5b192554f53e50c8ebf85cc77b" dependencies = [ - "base64 0.13.1", - "image 0.24.9", + "base64 0.22.1", + "image", "lodepng", "rand", "serde_json", @@ -483,6 +482,15 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "core2" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b49ba7ef1ad6107f8824dbe97de947cbaac53c44e7f9756a1fba0d37c1eec505" +dependencies = [ + "memchr", +] + [[package]] name = "cpufeatures" version = "0.2.14" @@ -586,6 +594,12 @@ dependencies = [ "syn", ] +[[package]] +name = "dary_heap" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7762d17f1241643615821a8455a0b2c3e803784b058693d990b11f2dce25a0ca" + [[package]] name = "data-encoding" version = "2.6.0" @@ -755,7 +769,7 @@ dependencies = [ "garde", "http", "identicon", - "image 0.25.2", + "image", "img-parts", "indexmap", "jieba-rs", @@ -1156,7 +1170,7 @@ name = "identicon" version = "0.2.1" source = "git+https://github.com/freedit-dev/identicon.git#51e94d7fd3f472b27e8735b3c3bed90c685751de" dependencies = [ - "image 0.25.2", + "image", ] [[package]] @@ -1169,19 +1183,6 @@ dependencies = [ "unicode-normalization", ] -[[package]] -name = "image" -version = "0.24.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5690139d2f55868e080017335e4b94cb7414274c74f1669c84fb5feba2c9f69d" -dependencies = [ - "bytemuck", - "byteorder", - "color_quant", - "num-traits", - "png", -] - [[package]] name = "image" version = "0.25.2" @@ -1209,6 +1210,29 @@ dependencies = [ "miniz_oxide 0.5.4", ] +[[package]] +name = "include-flate" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df49c16750695486c1f34de05da5b7438096156466e7f76c38fcdf285cf0113e" +dependencies = [ + "include-flate-codegen", + "lazy_static", + "libflate", +] + +[[package]] +name = "include-flate-codegen" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c5b246c6261be723b85c61ecf87804e8ea4a35cb68be0ff282ed84b95ffe7d7" +dependencies = [ + "libflate", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "indexmap" version = "2.6.0" @@ -1255,10 +1279,11 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jieba-rs" version = "0.7.0" -source = "git+https://github.com/messense/jieba-rs.git?rev=b39957e#b39957e9a6d738c4b00f3fa645da971ad426ec21" +source = "git+https://github.com/messense/jieba-rs.git#7f3b27375b638bc22a2efe2fd889ea60130d265c" dependencies = [ "cedarwood", "fxhash", + "include-flate", "lazy_static", "phf", "phf_codegen", @@ -1313,6 +1338,30 @@ version = "0.2.159" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" +[[package]] +name = "libflate" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45d9dfdc14ea4ef0900c1cddbc8dcd553fbaacd8a4a282cf4018ae9dd04fb21e" +dependencies = [ + "adler32", + "core2", + "crc32fast", + "dary_heap", + "libflate_lz77", +] + +[[package]] +name = "libflate_lz77" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e0d73b369f386f1c44abd9c570d5318f55ccde816ff4b562fa452e5182863d" +dependencies = [ + "core2", + "hashbrown 0.14.5", + "rle-decode-fast", +] + [[package]] name = "libm" version = "0.2.8" @@ -1569,16 +1618,6 @@ dependencies = [ "minimal-lexical", ] -[[package]] -name = "nu-ansi-term" -version = "0.46.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" -dependencies = [ - "overload", - "winapi", -] - [[package]] name = "num-conv" version = "0.1.0" @@ -1638,12 +1677,6 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e296cf87e61c9cfc1a61c3c63a0f7f286ed4554e0e22be84e8a38e1d264a2a29" -[[package]] -name = "overload" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" - [[package]] name = "ownedbytes" version = "0.7.0" @@ -2153,6 +2186,12 @@ dependencies = [ "serde", ] +[[package]] +name = "rle-decode-fast" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3582f63211428f83597b51b2ddb88e2a91a9d52d12831f9d08f5e624e8977422" + [[package]] name = "rss" version = "2.0.9" @@ -2908,21 +2947,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ "pin-project-lite", - "tracing-attributes", "tracing-core", ] -[[package]] -name = "tracing-attributes" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "tracing-core" version = "0.1.32" @@ -2930,18 +2957,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", - "valuable", -] - -[[package]] -name = "tracing-log" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" -dependencies = [ - "log", - "once_cell", - "tracing-core", ] [[package]] @@ -2951,7 +2966,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" dependencies = [ "matchers", - "nu-ansi-term", "once_cell", "regex", "sharded-slab", @@ -2959,7 +2973,6 @@ dependencies = [ "thread_local", "tracing", "tracing-core", - "tracing-log", ] [[package]] @@ -3055,12 +3068,6 @@ dependencies = [ "serde", ] -[[package]] -name = "valuable" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" - [[package]] name = "version_check" version = "0.9.5" diff --git a/Cargo.toml b/Cargo.toml index 320f208a..da6f32d0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ axum_garde = { version = "0.20.0", default-features = false, features = ["form"] basic-toml = "*" bincode = "2.0.0-rc.3" cached = { version = "0.53", default-features = false, features = ["proc_macro", "ahash"] } -captcha = { version = "0.0", default-features = false } +captcha = { git = "https://github.com/freedit-dev/captcha.git", default-features = false } data-encoding = "*" fast2s = "0.3" garde = { version = "0.20.0", features = ["derive"] } @@ -22,7 +22,7 @@ identicon = { git = "https://github.com/freedit-dev/identicon.git", default-feat image = { version = "0.25.2", default-features = false, features = ["jpeg", "png", "gif"] } img-parts = "0.3.0" indexmap = "2" -jieba-rs = { git = "https://github.com/messense/jieba-rs.git", rev = "b39957e" } +jieba-rs = { git = "https://github.com/messense/jieba-rs.git" } jiff = { version = "0.1.13", default-features = false, features = ["std"] } latex2mathml = "0.2.3" mozjpeg = "0.10.10" @@ -46,8 +46,8 @@ thiserror = "1" tokio = { version = "1", features = ["macros", "rt-multi-thread"] } tower = { version = "0.5.1", features = ["timeout"] } tower-http = { version = "0.6.1", features = ["fs", "compression-zstd", "trace"] } -tracing = { version = "0.1", features = ["release_max_level_info", "max_level_info"] } -tracing-subscriber = { version = "0.3", features = ["env-filter"] } +tracing = { version = "0.1", features = ["release_max_level_info", "max_level_info"], default-features = false } +tracing-subscriber = { version = "0.3", features = ["env-filter", "fmt", "smallvec"], default-features = false } unicode-segmentation = "1" webpki-roots = "0.26" whichlang = "0.1.0"