diff --git a/Cargo.lock b/Cargo.lock index 7ce945f42..9df22cc85 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -28,9 +28,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.0.4" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6748e8def348ed4d14996fa801f4122cd763fff530258cdc03f64b25f89d3a5a" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" dependencies = [ "memchr", ] @@ -52,30 +52,29 @@ dependencies = [ [[package]] name = "anstream" -version = "0.3.2" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" +checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", - "is-terminal", "utf8parse", ] [[package]] name = "anstyle" -version = "1.0.1" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" +checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" [[package]] name = "anstyle-parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" +checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" dependencies = [ "utf8parse", ] @@ -91,9 +90,9 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "1.0.2" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c677ab05e09154296dd37acecd46420c17b9713e8366facafa8fc0885167cf4c" +checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" dependencies = [ "anstyle", "windows-sys 0.48.0", @@ -107,9 +106,9 @@ checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" [[package]] name = "async-trait" -version = "0.1.73" +version = "0.1.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" +checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", @@ -145,9 +144,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.2" +version = "0.21.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" +checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" [[package]] name = "bincode" @@ -164,20 +163,14 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "bitflags" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" - [[package]] name = "bstr" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05" +checksum = "c79ad7fb2dd38f3dabd76b09c6a5a20c038fc0213ef1e9afd30eb777f120f019" dependencies = [ "memchr", - "regex-automata 0.3.8", + "regex-automata", "serde", ] @@ -193,21 +186,21 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.13.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "bytecount" -version = "0.6.3" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c676a478f63e9fa2dd5368a42f28bba0d6c560b775f38583c8bbaa7fcd67c9c" +checksum = "e1e5f035d16fc623ae5f74981db80a439803888314e3a555fd6f04acd51a3205" [[package]] name = "bytes" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "camino" @@ -226,24 +219,24 @@ checksum = "e11c675378efb449ed3ce8de78d75d0d80542fc98487c26aba28eb3b82feac72" dependencies = [ "semver", "serde", - "toml 0.7.6", + "toml 0.7.8", "url", ] [[package]] name = "cargo-platform" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cfa25e60aea747ec7e1124f238816749faa93759c6ff5b31f1ccdda137f4479" +checksum = "12024c4645c97566567129c204f65d5815a8c9aecf30fcbe682b2fe034996d36" dependencies = [ "serde", ] [[package]] name = "cargo_metadata" -version = "0.18.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb9ac64500cc83ce4b9f8dafa78186aa008c8dea77a09b94cd307fd0cd5022a8" +checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" dependencies = [ "camino", "cargo-platform", @@ -277,18 +270,17 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.26" +version = "0.4.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" +checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" dependencies = [ "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "serde", - "time 0.1.45", "wasm-bindgen", - "winapi", + "windows-targets 0.48.5", ] [[package]] @@ -302,20 +294,19 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.23" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03aef18ddf7d879c15ce20f04826ef8418101c7e528014c3eeea13321047dca3" +checksum = "ac495e00dcec98c83465d5ad66c5c4fabd652fd6686e7c6269b117e729a6f17b" dependencies = [ "clap_builder", "clap_derive", - "once_cell", ] [[package]] name = "clap_builder" -version = "4.3.23" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8ce6fffb678c9b80a70b6b6de0aad31df727623a70fd9a842c30cd573e2fa98" +checksum = "c77ed9a32a62e6ca27175d00d29d05ca32e396ea1eb5fb01d8256b669cec7663" dependencies = [ "anstream", "anstyle", @@ -325,9 +316,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.3.12" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050" +checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" dependencies = [ "heck", "proc-macro2", @@ -337,9 +328,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" +checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" [[package]] name = "cli" @@ -401,6 +392,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +[[package]] +name = "colors-transform" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9226dbc05df4fb986f48d730b001532580883c4c06c5d1c213f4b34c1c157178" + [[package]] name = "colorsys" version = "0.6.7" @@ -534,9 +531,12 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946" +checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" +dependencies = [ + "powerfmt", +] [[package]] name = "directories" @@ -586,9 +586,9 @@ checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" [[package]] name = "encoding_rs" -version = "0.8.32" +version = "0.8.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" dependencies = [ "cfg-if", ] @@ -608,27 +608,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" -[[package]] -name = "errno" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" -dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - [[package]] name = "extracted_fzy" version = "0.1.0" @@ -664,9 +643,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.27" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" +checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" dependencies = [ "crc32fast", "miniz_oxide", @@ -689,9 +668,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" dependencies = [ "futures-channel", "futures-core", @@ -704,9 +683,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" dependencies = [ "futures-core", "futures-sink", @@ -714,15 +693,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" [[package]] name = "futures-executor" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" dependencies = [ "futures-core", "futures-task", @@ -731,15 +710,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" [[package]] name = "futures-macro" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", @@ -748,21 +727,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" +checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" [[package]] name = "futures-task" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" [[package]] name = "futures-util" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" dependencies = [ "futures-channel", "futures-core", @@ -793,7 +772,7 @@ checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", ] [[package]] @@ -808,7 +787,7 @@ version = "0.17.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b989d6a7ca95a362cf2cfc5ad688b3a467be1f87e480b8dad07fee8c79b0044" dependencies = [ - "bitflags 1.3.2", + "bitflags", "libc", "libgit2-sys", "log", @@ -821,7 +800,7 @@ version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "759c97c1e17c55525b57192c06a267cda0ac5210b222d6b82189a2338fa1c13d" dependencies = [ - "aho-corasick 1.0.4", + "aho-corasick 1.1.2", "bstr", "fnv", "log", @@ -894,9 +873,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.14.0" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" [[package]] name = "heck" @@ -906,9 +885,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" [[package]] name = "highlighter" @@ -984,7 +963,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2 0.4.9", + "socket2 0.4.10", "tokio", "tower-service", "tracing", @@ -993,9 +972,9 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.24.1" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d78e1e73ec14cf7375674f74d7dde185c8206fd9dea6fb6295e8a98098aaa97" +checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", "http", @@ -1007,16 +986,16 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.57" +version = "0.1.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" +checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows", + "windows-core", ] [[package]] @@ -1088,12 +1067,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" dependencies = [ "equivalent", - "hashbrown 0.14.0", + "hashbrown 0.14.2", ] [[package]] @@ -1110,20 +1089,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.8.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" - -[[package]] -name = "is-terminal" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" -dependencies = [ - "hermit-abi", - "rustix", - "windows-sys 0.48.0", -] +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "itertools" @@ -1164,18 +1132,18 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] name = "jobserver" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "936cfd212a0155903bcbc060e316fb6cc7cbf2e1907329391ebadc1fe0ce77c2" +checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" dependencies = [ "libc", ] [[package]] name = "js-sys" -version = "0.3.64" +version = "0.3.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +checksum = "54c0c35952f67de54bb584e9fd912b3023117cbafc0a77d8f3dee1fb5f572fe8" dependencies = [ "wasm-bindgen", ] @@ -1188,9 +1156,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.147" +version = "0.2.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" [[package]] name = "libgit2-sys" @@ -1247,17 +1215,11 @@ dependencies = [ "tracing", ] -[[package]] -name = "linux-raw-sys" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" - [[package]] name = "lock_api" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" dependencies = [ "autocfg", "scopeguard", @@ -1302,6 +1264,7 @@ dependencies = [ "chrono", "chrono-humanize", "clap", + "colors-transform", "dirs", "dumb_analyzer", "filter", @@ -1323,6 +1286,7 @@ dependencies = [ "printer", "rayon", "regex", + "rgb2ansi256", "rpc", "serde", "serde_json", @@ -1362,9 +1326,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.6.3" +version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[package]] name = "memmap2" @@ -1401,12 +1365,12 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" dependencies = [ "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", "windows-sys 0.48.0", ] @@ -1428,9 +1392,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ "autocfg", ] @@ -1462,9 +1426,9 @@ dependencies = [ [[package]] name = "object" -version = "0.32.0" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ac5bbd07aea88c60a577a1ce218075ffd59208b2d7ca97adf9bfc5aeb21ebe" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" dependencies = [ "memchr", ] @@ -1481,7 +1445,7 @@ version = "6.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c4b31c8722ad9171c6d77d3557db078cab2bd50afcc9d09c8b315c59df8ca4f" dependencies = [ - "bitflags 1.3.2", + "bitflags", "libc", "once_cell", "onig_sys", @@ -1521,13 +1485,13 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.8" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.3.5", + "redox_syscall 0.4.1", "smallvec", "windows-targets 0.48.5", ] @@ -1557,9 +1521,9 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pin-project-lite" -version = "0.2.12" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12cc1b0bf1727a77a54b6654e7b5f1af8604923edc8b81885f8ec92f9e3f0a05" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[package]] name = "pin-utils" @@ -1575,18 +1539,24 @@ checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" [[package]] name = "plist" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdc0001cfea3db57a2e24bc0d818e9e20e554b5f97fabb9bc231dc240269ae06" +checksum = "9a4a0cfc5fb21a09dc6af4bf834cf10d4a32fccd9e2ea468c4b1751a097487aa" dependencies = [ - "base64 0.21.2", + "base64 0.21.5", "indexmap 1.9.3", "line-wrap", "quick-xml", "serde", - "time 0.3.27", + "time", ] +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[package]] name = "printer" version = "0.1.0" @@ -1602,18 +1572,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] [[package]] name = "quick-xml" -version = "0.29.0" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81b9228215d82c7b61490fec1de287136b5de6f5700f6e58ea9ad61a7964ca51" +checksum = "eff6510e86862b57b210fd8cbe8ed3f0d7d600b9c2863cd4549a2e033c66e956" dependencies = [ "memchr", ] @@ -1635,9 +1605,9 @@ checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9" [[package]] name = "rayon" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b" +checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" dependencies = [ "either", "rayon-core", @@ -1645,14 +1615,12 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" +checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" dependencies = [ - "crossbeam-channel", "crossbeam-deque", "crossbeam-utils", - "num_cpus", ] [[package]] @@ -1661,16 +1629,16 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "bitflags 1.3.2", + "bitflags", ] [[package]] name = "redox_syscall" -version = "0.3.5" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ - "bitflags 1.3.2", + "bitflags", ] [[package]] @@ -1690,25 +1658,19 @@ version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" dependencies = [ - "aho-corasick 1.0.4", + "aho-corasick 1.1.2", "memchr", - "regex-automata 0.4.3", + "regex-automata", "regex-syntax 0.8.2", ] -[[package]] -name = "regex-automata" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2f401f4955220693b56f8ec66ee9c78abffd8d1c4f23dc41a23839eb88f0795" - [[package]] name = "regex-automata" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" dependencies = [ - "aho-corasick 1.0.4", + "aho-corasick 1.1.2", "memchr", "regex-syntax 0.8.2", ] @@ -1733,11 +1695,11 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "reqwest" -version = "0.11.19" +version = "0.11.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20b9b67e2ca7dd9e9f9285b759de30ff538aab981abaaf7bc9bd90b84a0126c3" +checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" dependencies = [ - "base64 0.21.2", + "base64 0.21.5", "bytes", "encoding_rs", "futures-core", @@ -1759,6 +1721,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", + "system-configuration", "tokio", "tokio-rustls", "tower-service", @@ -1778,17 +1741,16 @@ checksum = "1ebca96b1c05912d531790498048bab5b7b97a756a7bb9df71fa4ef7ef9814e1" [[package]] name = "ring" -version = "0.16.20" +version = "0.17.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +checksum = "fb0205304757e5d899b9c2e448b867ffd03ae7f988002e47cd24954391394d0b" dependencies = [ "cc", + "getrandom", "libc", - "once_cell", "spin", "untrusted", - "web-sys", - "winapi", + "windows-sys 0.48.0", ] [[package]] @@ -1807,24 +1769,11 @@ version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" -[[package]] -name = "rustix" -version = "0.38.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19ed4fa021d81c8392ce04db050a3da9a60299050b7ae1cf482d862b54a7218f" -dependencies = [ - "bitflags 2.4.0", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.48.0", -] - [[package]] name = "rustls" -version = "0.21.6" +version = "0.21.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d1feddffcfcc0b33f5c6ce9a29e341e4cd59c3f78e7ee45f4a40c038b1d6cbb" +checksum = "446e14c5cda4f3f30fe71863c34ec70f5ac79d6087097ad0bb433e1be5edf04c" dependencies = [ "log", "ring", @@ -1838,14 +1787,14 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" dependencies = [ - "base64 0.21.2", + "base64 0.21.5", ] [[package]] name = "rustls-webpki" -version = "0.101.4" +version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d93931baf2d282fff8d3a532bbfd7653f734643161b87e3e01e59a04439bf0d" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ "ring", "untrusted", @@ -1880,9 +1829,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "sct" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ "ring", "untrusted", @@ -1890,27 +1839,27 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.18" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" +checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" dependencies = [ "serde", ] [[package]] name = "serde" -version = "1.0.185" +version = "1.0.190" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be9b6f69f1dfd54c3b568ffa45c310d6973a5e5148fd40cf515acaf38cf5bc31" +checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.185" +version = "1.0.190" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc59dfdcbad1437773485e0367fea4b090a2e0a16d9ffc46af47764536a298ec" +checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" dependencies = [ "proc-macro2", "quote", @@ -1919,9 +1868,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.105" +version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ "itoa", "ryu", @@ -1930,9 +1879,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" +checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80" dependencies = [ "serde", ] @@ -1951,9 +1900,9 @@ dependencies = [ [[package]] name = "sharded-slab" -version = "0.1.4" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" dependencies = [ "lazy_static", ] @@ -1984,15 +1933,15 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" [[package]] name = "socket2" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" dependencies = [ "libc", "winapi", @@ -2000,9 +1949,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.3" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ "libc", "windows-sys 0.48.0", @@ -2010,9 +1959,9 @@ dependencies = [ [[package]] name = "spin" -version = "0.5.2" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] name = "strsim" @@ -2031,9 +1980,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.29" +version = "2.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" dependencies = [ "proc-macro2", "quote", @@ -2047,7 +1996,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e02b4b303bf8d08bfeb0445cba5068a3d306b6baece1d5582171a9bf49188f91" dependencies = [ "bincode", - "bitflags 1.3.2", + "bitflags", "flate2", "fnv", "once_cell", @@ -2061,20 +2010,41 @@ dependencies = [ "yaml-rust", ] +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "thiserror" -version = "1.0.47" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f" +checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.47" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b" +checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", @@ -2093,23 +2063,13 @@ dependencies = [ [[package]] name = "time" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" -dependencies = [ - "libc", - "wasi 0.10.0+wasi-snapshot-preview1", - "winapi", -] - -[[package]] -name = "time" -version = "0.3.27" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bb39ee79a6d8de55f48f2293a830e040392f1c5f16e336bdd1788cd0aadce07" +checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" dependencies = [ "deranged", "itoa", + "powerfmt", "serde", "time-core", "time-macros", @@ -2117,15 +2077,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.13" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "733d258752e9303d392b94b75230d07b0b9c489350c69b851fc6c065fde3e8f9" +checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" dependencies = [ "time-core", ] @@ -2147,9 +2107,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.32.0" +version = "1.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" +checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" dependencies = [ "backtrace", "bytes", @@ -2158,7 +2118,7 @@ dependencies = [ "num_cpus", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.3", + "socket2 0.5.5", "tokio-macros", "windows-sys 0.48.0", ] @@ -2186,9 +2146,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.8" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" dependencies = [ "bytes", "futures-core", @@ -2209,9 +2169,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.7.6" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542" +checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" dependencies = [ "serde", "serde_spanned", @@ -2221,20 +2181,20 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.3" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.19.14" +version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.0.0", + "indexmap 2.1.0", "serde", "serde_spanned", "toml_datetime", @@ -2249,11 +2209,10 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.37" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "cfg-if", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -2266,15 +2225,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09d48f71a791638519505cefafe162606f706c25592e4bde4d97600c0195312e" dependencies = [ "crossbeam-channel", - "time 0.3.27", + "time", "tracing-subscriber", ] [[package]] name = "tracing-attributes" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", @@ -2283,9 +2242,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", "valuable", @@ -2303,12 +2262,12 @@ dependencies = [ [[package]] name = "tracing-log" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" +checksum = "f751112709b4e791d8ce53e32c4ed2d353565a795ce84da2285393f41557bdf2" dependencies = [ - "lazy_static", "log", + "once_cell", "tracing-core", ] @@ -2348,9 +2307,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" @@ -2363,15 +2322,15 @@ dependencies = [ [[package]] name = "unicode-width" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" [[package]] name = "untrusted" -version = "0.7.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "upgrade" @@ -2386,9 +2345,9 @@ dependencies = [ [[package]] name = "url" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" dependencies = [ "form_urlencoded", "idna", @@ -2425,9 +2384,9 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "walkdir" -version = "2.3.3" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" dependencies = [ "same-file", "winapi-util", @@ -2442,12 +2401,6 @@ dependencies = [ "try-lock", ] -[[package]] -name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -2456,9 +2409,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +checksum = "7daec296f25a1bae309c0cd5c29c4b260e510e6d813c286b19eaadf409d40fce" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -2466,9 +2419,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +checksum = "e397f4664c0e4e428e8313a469aaa58310d302159845980fd23b0f22a847f217" dependencies = [ "bumpalo", "log", @@ -2481,9 +2434,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.37" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +checksum = "9afec9963e3d0994cac82455b2b3502b81a7f40f9a0d32181f7528d9f4b43e02" dependencies = [ "cfg-if", "js-sys", @@ -2493,9 +2446,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +checksum = "5961017b3b08ad5f3fe39f1e79877f8ee7c23c5e5fd5eb80de95abc41f1f16b2" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2503,9 +2456,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907" dependencies = [ "proc-macro2", "quote", @@ -2516,15 +2469,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b" [[package]] name = "web-sys" -version = "0.3.64" +version = "0.3.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +checksum = "5db499c5f66323272151db0e666cd34f78617522fb0c1604d31a27c50c206a85" dependencies = [ "js-sys", "wasm-bindgen", @@ -2532,9 +2485,9 @@ dependencies = [ [[package]] name = "webbrowser" -version = "0.8.11" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2c79b77f525a2d670cb40619d7d9c673d09e0666f72c591ebd7861f84a87e57" +checksum = "82b2391658b02c27719fc5a0a73d6e696285138e8b12fba9d4baa70451023c71" dependencies = [ "core-foundation", "home", @@ -2571,9 +2524,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" dependencies = [ "winapi", ] @@ -2585,10 +2538,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] -name = "windows" -version = "0.48.0" +name = "windows-core" +version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" dependencies = [ "windows-targets 0.48.5", ] @@ -2727,9 +2680,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winnow" -version = "0.5.14" +version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d09770118a7eb1ccaf4a594a221334119a44a814fcb0d31c5b85e83e97227a97" +checksum = "176b6138793677221d420fd2f0aeeced263f197688b36484660da767bca2fa32" dependencies = [ "memchr", ] diff --git a/autoload/clap/plugin/colorizer.vim b/autoload/clap/plugin/colorizer.vim new file mode 100644 index 000000000..7f28b0e24 --- /dev/null +++ b/autoload/clap/plugin/colorizer.vim @@ -0,0 +1,65 @@ +" Author: liuchengxu + +scriptencoding utf-8 + +let s:save_cpo = &cpoptions +set cpoptions&vim + +if has('nvim') + let s:colorizer_ns_id = nvim_create_namespace('clap_colorizer') +else + let s:types = [] +endif + +function! s:create_new_group(bufnr, highlight_group) abort + execute printf( + \ 'hi %s guibg=%s ctermbg=%d', + \ a:highlight_group.name, + \ a:highlight_group.guibg, + \ a:highlight_group.ctermbg, + \ ) + + if !has('nvim') && index(s:types, a:highlight_group.name) == -1 + call add(s:types, a:highlight_group.name) + call prop_type_add(a:highlight_group.name, {'highlight': a:highlight_group.name}) + endif +endfunction + +" lnum and col is 0-based. +function! s:add_highlight(bufnr, line_number, color_info) abort + if !hlexists(a:color_info.highlight_group.name) + call s:create_new_group(a:bufnr, a:color_info.highlight_group) + endif + + if has('nvim') + call nvim_buf_add_highlight(a:bufnr, s:colorizer_ns_id, + \ a:color_info.highlight_group.name, + \ a:line_number, + \ a:color_info.col, + \ a:color_info.col + a:color_info.length, + \ ) + else + call prop_add(a:line_number + 1, a:color_info.col + 1, { + \ 'type': a:color_info.highlight_group.name, + \ 'length': a:color_info.length, + \ 'bufnr': a:bufnr, + \ }) + endif +endfunction + +function! clap#plugin#colorizer#add_highlights(bufnr, highlights) abort + for [line_number, color_infos] in items(a:highlights) + call map(color_infos, 's:add_highlight(a:bufnr, str2nr(line_number), v:val)') + endfor +endfunction + +function! clap#plugin#colorizer#clear_highlights(bufnr) abort + if has('nvim') + call nvim_buf_clear_namespace(a:bufnr, s:colorizer_ns_id, 0, -1) + else + call prop_remove({ 'types': s:types, 'all': v:true, 'bufnr': a:bufnr } ) + endif +endfunction + +let &cpoptions = s:save_cpo +unlet s:save_cpo diff --git a/crates/Cargo.toml b/crates/Cargo.toml index 937ef884a..d96cfca63 100644 --- a/crates/Cargo.toml +++ b/crates/Cargo.toml @@ -32,11 +32,12 @@ chrono = { version = "0.4", features = ["serde"] } chrono-humanize = "0.2.3" clap = { version = "4.2", features = ["derive"] } colorsys = "0.6.7" +colors-transform = "0.2.11" directories = "4.0" futures = "0.3" fuzzy-matcher = "0.3" grep-matcher = "0.1" -grep-regex = "0.1" +grep-regex = "0.1.11" grep-searcher = "0.1" ignore = "0.4" indicatif = "0.16" diff --git a/crates/linter/src/linters/go.rs b/crates/linter/src/linters/go.rs index 64a82f045..65c96e54d 100644 --- a/crates/linter/src/linters/go.rs +++ b/crates/linter/src/linters/go.rs @@ -28,16 +28,14 @@ pub async fn run_gopls(source_file: &Path, workspace_root: &Path) -> std::io::Re for line in stdout.split('\n') { if !line.is_empty() { - for (_, [_path, line, column_start, column_end, message]) in - RE.captures_iter(line).map(|c| c.extract()) - { - let Ok(line) = line.parse::() else { - continue; - }; - let Ok(column_start) = column_start.parse::() else { - continue; - }; - let Ok(column_end) = column_end.parse::() else { + for caps in RE.captures_iter(line) { + // [path, line, column_start, column_end, message] + let (Some(line), Some(column_start), Some(column_end), Some(message)) = ( + caps.get(2).and_then(|m| m.as_str().parse::().ok()), + caps.get(3).and_then(|m| m.as_str().parse::().ok()), + caps.get(4).and_then(|m| m.as_str().parse::().ok()), + caps.get(5).map(|m| m.as_str().to_string()), + ) else { continue; }; diagnostics.push(Diagnostic { @@ -49,7 +47,7 @@ pub async fn run_gopls(source_file: &Path, workspace_root: &Path) -> std::io::Re }], code: Code::default(), severity: Severity::Error, - message: message.to_string(), + message, }); } } diff --git a/crates/maple_core/Cargo.toml b/crates/maple_core/Cargo.toml index 26b1d120d..c49a5edf3 100644 --- a/crates/maple_core/Cargo.toml +++ b/crates/maple_core/Cargo.toml @@ -16,6 +16,7 @@ bytecount = { workspace = true } chrono = { workspace = true } chrono-humanize = { workspace = true } clap = { workspace = true } +colors-transform = { workspace = true } futures = { workspace = true } # ripgrep for global search grep-searcher = { workspace = true } @@ -28,6 +29,7 @@ parking_lot = { workspace = true } percent-encoding = { workspace = true } rayon = { workspace = true } regex = { workspace = true } +rgb2ansi256 = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } subprocess = { workspace = true } diff --git a/crates/maple_core/src/config.rs b/crates/maple_core/src/config.rs index c82bfe551..7e46ed439 100644 --- a/crates/maple_core/src/config.rs +++ b/crates/maple_core/src/config.rs @@ -150,6 +150,13 @@ impl Default for GitPluginConfig { } } +#[derive(Serialize, Deserialize, Debug, Default, Eq, PartialEq)] +#[serde(rename_all = "kebab-case", default, deny_unknown_fields)] +pub struct ColorizerPluginConfig { + /// Whether to enable this plugin. + pub enable: bool, +} + #[derive(Serialize, Deserialize, Debug, Default, Eq, PartialEq)] #[serde(rename_all = "kebab-case", default, deny_unknown_fields)] pub struct LinterPluginConfig { @@ -160,6 +167,7 @@ pub struct LinterPluginConfig { #[derive(Serialize, Deserialize, Debug, Default, Eq, PartialEq)] #[serde(rename_all = "kebab-case", default, deny_unknown_fields)] pub struct PluginConfig { + pub colorizer: ColorizerPluginConfig, pub cursorword: CursorWordConfig, pub ctags: CtagsPluginConfig, pub git: GitPluginConfig, diff --git a/crates/maple_core/src/stdio_server/mod.rs b/crates/maple_core/src/stdio_server/mod.rs index f812b1901..c5ecf8c26 100644 --- a/crates/maple_core/src/stdio_server/mod.rs +++ b/crates/maple_core/src/stdio_server/mod.rs @@ -8,10 +8,7 @@ mod vim; pub use self::input::InputHistory; use self::input::{ActionEvent, Event, ProviderEvent}; -use self::plugin::{ - ActionType, ClapPlugin, CtagsPlugin, CursorWordPlugin, GitPlugin, LinterPlugin, MarkdownPlugin, - PluginId, SyntaxHighlighterPlugin, SystemPlugin, -}; +use self::plugin::PluginId; use self::provider::{create_provider, Context}; use self::service::ServiceManager; use self::vim::initialize_filetype_map; @@ -27,8 +24,8 @@ use std::time::Duration; use tokio::sync::mpsc::UnboundedReceiver; use tokio::time::Instant; -// Do the initialization on startup. -async fn initialize( +// Do the initialization on the Vim end on startup. +async fn initialize_client( vim: Vim, actions: Vec<&str>, config_err: Option, @@ -66,26 +63,26 @@ async fn initialize( Ok(()) } -/// Starts and keep running the server on top of stdio. -pub async fn start(config_err: Option) { - // TODO: setup test framework using vim_message_sender. - let (vim_message_sender, vim_message_receiver) = tokio::sync::mpsc::unbounded_channel(); - - let rpc_client = Arc::new(RpcClient::new( - BufReader::new(std::io::stdin()), - BufWriter::new(std::io::stdout()), - vim_message_sender.clone(), - )); +struct InitializedService { + callable_actions: Vec<&'static str>, + plugin_actions: HashMap>, + service_manager: ServiceManager, +} - let vim = Vim::new(rpc_client); +/// Create a new service, with plugins registered from the config file. +fn initialize_service(vim: Vim) -> InitializedService { + use self::plugin::{ + ActionType, ClapPlugin, ColorizerPlugin, CtagsPlugin, CursorWordPlugin, GitPlugin, + LinterPlugin, MarkdownPlugin, SyntaxHighlighterPlugin, SystemPlugin, + }; - let mut callable_action_methods = Vec::new(); - let mut all_actions = HashMap::new(); + let mut callable_actions = Vec::new(); + let mut plugin_actions = HashMap::new(); let mut service_manager = ServiceManager::default(); let mut register_plugin = |plugin: Box, debounce: Option| { - callable_action_methods.extend( + callable_actions.extend( plugin .actions(ActionType::Callable) .iter() @@ -93,7 +90,7 @@ pub async fn start(config_err: Option) { ); let (plugin_id, actions) = service_manager.register_plugin(plugin, debounce); - all_actions.insert(plugin_id, actions); + plugin_actions.insert(plugin_id, actions); }; register_plugin(Box::new(SystemPlugin::new(vim.clone())), None); @@ -102,6 +99,13 @@ pub async fn start(config_err: Option) { let plugin_config = &crate::config::config().plugin; + if plugin_config.colorizer.enable { + register_plugin( + Box::new(ColorizerPlugin::new(vim.clone())), + Some(Duration::from_millis(100)), + ); + } + if plugin_config.linter.enable { register_plugin( Box::new(LinterPlugin::new(vim.clone())), @@ -118,37 +122,59 @@ pub async fn start(config_err: Option) { } if plugin_config.cursorword.enable { - register_plugin(Box::new(CursorWordPlugin::new(vim.clone())), None); + register_plugin(Box::new(CursorWordPlugin::new(vim)), None); } - tokio::spawn({ - let vim = vim.clone(); - async move { - if let Err(e) = initialize(vim, callable_action_methods, config_err).await { - tracing::error!(error = ?e, "Failed to initialize Client") - } - } - }); + InitializedService { + callable_actions, + plugin_actions, + service_manager, + } +} + +/// Starts and keep running the server on top of stdio. +pub async fn start(config_err: Option) { + // TODO: setup test framework using vim_message_sender. + let (vim_message_sender, vim_message_receiver) = tokio::sync::mpsc::unbounded_channel(); - Client::new(vim, service_manager, all_actions) + let rpc_client = Arc::new(RpcClient::new( + BufReader::new(std::io::stdin()), + BufWriter::new(std::io::stdout()), + vim_message_sender.clone(), + )); + + let vim = Vim::new(rpc_client); + + Backend::new(vim, config_err) .run(vim_message_receiver) .await; } #[derive(Clone)] -struct Client { +struct Backend { vim: Vim, plugin_actions: Arc>>>, service_manager: Arc>, } -impl Client { - /// Creates a new instnace of [`Client`]. - fn new( - vim: Vim, - service_manager: ServiceManager, - plugin_actions: HashMap>, - ) -> Self { +impl Backend { + /// Creates a new instance of [`Backend`]. + fn new(vim: Vim, config_err: Option) -> Self { + let InitializedService { + callable_actions, + plugin_actions, + service_manager, + } = initialize_service(vim.clone()); + + tokio::spawn({ + let vim = vim.clone(); + async move { + if let Err(e) = initialize_client(vim, callable_actions, config_err).await { + tracing::error!(error = ?e, "Failed to initialize Client") + } + } + }); + Self { vim, plugin_actions: Arc::new(Mutex::new(plugin_actions)), diff --git a/crates/maple_core/src/stdio_server/plugin/colorizer.rs b/crates/maple_core/src/stdio_server/plugin/colorizer.rs new file mode 100644 index 000000000..b573f6054 --- /dev/null +++ b/crates/maple_core/src/stdio_server/plugin/colorizer.rs @@ -0,0 +1,352 @@ +use crate::stdio_server::input::{AutocmdEvent, PluginAction}; +use crate::stdio_server::plugin::{ClapPlugin, Toggle}; +use crate::stdio_server::vim::Vim; +use anyhow::Result; +use colors_transform::{AlphaColor, Color, Hsl, Rgb}; +use once_cell::sync::Lazy; +use regex::Regex; +use rgb2ansi256::rgb_to_ansi256; +use std::collections::BTreeMap; +use std::path::Path; + +static HEX: Lazy = Lazy::new(|| Regex::new(r"#([a-fA-F0-9]{3}|[a-fA-F0-9]{6})\b").unwrap()); + +static RGB: Lazy = + Lazy::new(|| Regex::new(r"rgb\s*\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)").unwrap()); + +static RGB_ALPHA: Lazy = Lazy::new(|| { + Regex::new(r"rgba\s*\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([01]\.?\d*)\)") + .unwrap() +}); + +static HSL: Lazy = Lazy::new(|| { + Regex::new(r"hsl\s*\(\s*(\d{1,3}\.?\d*)\s*,\s*(\d{1,3}\.?\d*)%\s*,\s*(\d{1,3}\.?\d*)%\)") + .unwrap() +}); + +static HSL_ALPHA: Lazy = Lazy::new(|| { + Regex::new(r"hsla\s*\(\s*(\d{1,3}\.?\d*)\s*,\s*(\d{1,3}\.?\d*)%\s*,\s*(\d{1,3}\.?\d*)%,\s*([01]\.?\d*)\)") + .unwrap() +}); + +#[derive(Debug, Clone, maple_derive::ClapPlugin)] +#[clap_plugin(id = "colorizer", actions = ["off", "toggle"])] +pub struct ColorizerPlugin { + vim: Vim, + toggle: Toggle, +} + +impl ColorizerPlugin { + pub fn new(vim: Vim) -> Self { + Self { + vim, + toggle: Toggle::Off, + } + } +} + +#[derive(Debug, serde::Serialize)] +struct HighlightGroup { + name: String, + guibg: String, + ctermbg: u8, +} + +#[derive(Debug, serde::Serialize)] +struct ColorInfo { + col: usize, + length: usize, + highlight_group: HighlightGroup, +} + +enum HexOrRgb { + Hex(String), + Rgb(Rgb), +} + +fn find_colors(input_file: impl AsRef) -> std::io::Result>> { + let mut p: BTreeMap> = BTreeMap::new(); + + let mut insert_color_info = |line_number, m: regex::Match, color: HexOrRgb| { + let (ctermbg, hex_code) = match color { + HexOrRgb::Hex(hex_code) => { + let Ok(ctermbg) = Rgb::from_hex_str(&hex_code).map(|rgb| { + let (r, g, b) = rgb.as_tuple(); + rgb_to_ansi256(r as u8, g as u8, b as u8) + }) else { + return; + }; + + (ctermbg, hex_code) + } + HexOrRgb::Rgb(rgb) => { + let (r, g, b) = rgb.as_tuple(); + let ctermbg = rgb_to_ansi256(r as u8, g as u8, b as u8); + (ctermbg, rgb.to_css_hex_string()) + } + }; + + let group_name: String = format!("ClapColorizer_{}", &hex_code[1..]); + + let color_info = ColorInfo { + col: m.range().start, + length: m.range().len(), + highlight_group: HighlightGroup { + name: group_name, + guibg: hex_code, + ctermbg, + }, + }; + + if let Some(v) = p.get_mut(&line_number) { + v.push(color_info) + } else { + p.insert(line_number, vec![color_info]); + } + }; + + // 0-based line_number + for (line_number, line) in utils::read_lines(input_file)? + .map_while(Result::ok) + .enumerate() + { + for caps in HEX.captures_iter(&line) { + if let Some(m) = caps.get(0) { + let hex_code = m.as_str().to_lowercase(); + insert_color_info(line_number, m, HexOrRgb::Hex(hex_code)); + } + } + + for caps in RGB.captures_iter(&line) { + if let Some(m) = caps.get(0) { + let (Some(r), Some(g), Some(b)) = + (parse(&caps, 1), parse(&caps, 2), parse(&caps, 3)) + else { + continue; + }; + + insert_color_info(line_number, m, HexOrRgb::Rgb(Rgb::from(r, g, b))); + } + } + + for caps in RGB_ALPHA.captures_iter(&line) { + if let Some(m) = caps.get(0) { + let (Some(r), Some(g), Some(b), Some(a)) = ( + parse(&caps, 1), + parse(&caps, 2), + parse(&caps, 3), + parse(&caps, 4), + ) else { + continue; + }; + + let rgb = Rgb::from(r, g, b).set_alpha(a); + insert_color_info(line_number, m, HexOrRgb::Rgb(rgb)); + } + } + + for caps in HSL.captures_iter(&line) { + if let Some(m) = caps.get(0) { + let Some(h) = parse(&caps, 1) else { + continue; + }; + + if !(0.0..=360.0).contains(&h) { + continue; + } + + let (Some(s), Some(l)) = (parse(&caps, 2), parse(&caps, 3)) else { + continue; + }; + + let rgb = Hsl::from(h, s, l).to_rgb(); + insert_color_info(line_number, m, HexOrRgb::Rgb(rgb)); + } + } + + for caps in HSL_ALPHA.captures_iter(&line) { + if let Some(m) = caps.get(0) { + let Some(h) = parse(&caps, 1) else { + continue; + }; + + if !(0.0..=360.0).contains(&h) { + continue; + } + + let (Some(s), Some(l), Some(a)) = + (parse(&caps, 2), parse(&caps, 3), parse(&caps, 4)) + else { + continue; + }; + + let rgb = Hsl::from(h, s, l).set_alpha(a).to_rgb(); + insert_color_info(line_number, m, HexOrRgb::Rgb(rgb)); + } + } + } + + Ok(p) +} + +fn parse(caps: ®ex::Captures, i: usize) -> Option { + caps.get(i).and_then(|m| m.as_str().parse::().ok()) +} + +#[async_trait::async_trait] +impl ClapPlugin for ColorizerPlugin { + async fn handle_action(&mut self, action: PluginAction) -> Result<()> { + let PluginAction { method, params: _ } = action; + + match method.as_str() { + Self::TOGGLE => { + let bufnr = self.vim.bufnr("").await?; + + if self.toggle.is_off() { + let file = self.vim.bufabspath(bufnr).await?; + let colors = find_colors(file)?; + if !colors.is_empty() { + self.vim + .exec("clap#plugin#colorizer#add_highlights", (bufnr, colors))?; + } + } else { + self.vim + .exec("clap#plugin#colorizer#clear_highlights", bufnr)?; + } + + self.toggle.switch(); + } + Self::OFF => { + let bufnr = self.vim.bufnr("").await?; + self.vim + .exec("clap#plugin#colorizer#clear_highlights", bufnr)?; + } + _ => {} + } + + Ok(()) + } + + async fn handle_autocmd(&mut self, _autocmd: AutocmdEvent) -> Result<()> { + Ok(()) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + fn parse_hex(text: &str) -> Vec { + HEX.captures_iter(text) + .filter_map(|caps| caps.get(0).map(|m| m.as_str().to_lowercase())) + .collect() + } + + fn parse_rgb(text: &str) -> Vec<(usize, usize, usize)> { + RGB.captures_iter(text) + .filter_map(|caps| { + if let (Some(r), Some(g), Some(b)) = + (parse(&caps, 1), parse(&caps, 2), parse(&caps, 3)) + { + Some((r, g, b)) + } else { + None + } + }) + .collect() + } + + fn parse_rgb_alpha(text: &str) -> Vec<(usize, usize, usize, f64)> { + RGB_ALPHA + .captures_iter(text) + .filter_map(|caps| { + if let (Some(r), Some(g), Some(b), Some(a)) = ( + parse(&caps, 1), + parse(&caps, 2), + parse(&caps, 3), + parse(&caps, 4), + ) { + Some((r, g, b, a)) + } else { + None + } + }) + .collect() + } + + fn parse_hsl(text: &str) -> Vec<(f32, f32, f32)> { + HSL.captures_iter(text) + .filter_map(|caps| { + if let (Some(h), Some(s), Some(l)) = + (parse(&caps, 1), parse(&caps, 2), parse(&caps, 3)) + { + if (0.0..=360.0).contains(&h) { + Some((h, s, l)) + } else { + None + } + } else { + None + } + }) + .collect() + } + + fn parse_hsl_alpha(text: &str) -> Vec<(f32, f32, f32, f32)> { + HSL_ALPHA + .captures_iter(text) + .filter_map(|caps| { + if let (Some(h), Some(s), Some(l), Some(a)) = ( + parse(&caps, 1), + parse(&caps, 2), + parse(&caps, 3), + parse(&caps, 4), + ) { + if (0.0..=360.0).contains(&h) { + Some((h, s, l, a)) + } else { + None + } + } else { + None + } + }) + .collect() + } + + #[test] + fn test_color_patterns() { + let line = r#"#000 #00005f # 0000d7 0000ff #000#ae90d7 #FFF"#; + + assert_eq!( + parse_hex(line), + vec!["#000", "#00005f", "#000", "#ae90d7", "#fff"] + ); + + let line = r#"rgb(0, 12, 234) rgb(0,12,234) rgb(0,12, 234)"#; + assert_eq!( + parse_rgb(line), + vec![(0, 12, 234), (0, 12, 234), (0, 12, 234)] + ); + + let line = r#"rgba(0, 12, 234, 0.5)"#; + assert_eq!(parse_rgb_alpha(line), vec![(0, 12, 234, 0.5)]); + + let line = r#"hsl(0, 0%, 0%) hsl(195,75%,50%) hsl(195.5, 75.3%, 50.5%) hsl(360, 12%, 50%) hsl(500, 12%, 50%)"#; + assert_eq!( + parse_hsl(line), + vec![ + (0.0, 0.0, 0.0), + (195.0, 75.0, 50.0), + (195.5, 75.3, 50.5), + (360.0, 12.0, 50.0) + ] + ); + + let line = r#"hsla(0, 0%, 0%, 0.3) hsla(360, 12%, 50%, 0.5)"#; + assert_eq!( + parse_hsl_alpha(line), + vec![(0.0, 0.0, 0.0, 0.3), (360.0, 12.0, 50.0, 0.5)] + ); + } +} diff --git a/crates/maple_core/src/stdio_server/plugin/mod.rs b/crates/maple_core/src/stdio_server/plugin/mod.rs index 71452ca2c..534ec1900 100644 --- a/crates/maple_core/src/stdio_server/plugin/mod.rs +++ b/crates/maple_core/src/stdio_server/plugin/mod.rs @@ -1,3 +1,4 @@ +mod colorizer; mod ctags; mod cursorword; mod git; @@ -10,6 +11,7 @@ use crate::stdio_server::input::{AutocmdEvent, PluginAction}; use anyhow::Result; use std::fmt::Debug; +pub use self::colorizer::ColorizerPlugin; pub use self::ctags::CtagsPlugin; pub use self::cursorword::CursorWordPlugin; pub use self::git::GitPlugin; diff --git a/docs/src/plugins/plugins.md b/docs/src/plugins/plugins.md index 9a9bb4c3a..9a6340c78 100644 --- a/docs/src/plugins/plugins.md +++ b/docs/src/plugins/plugins.md @@ -1,9 +1,12 @@ # Available Plugins +The following plugins may only implement a subset of features of their alternatives. + TODO: elaborate on plugins' usage. +* [colorizer](#colorizer) * [ctags](#ctags) * [cursorword](#cursorword) * [git](#git) @@ -12,6 +15,17 @@ TODO: elaborate on plugins' usage. +## colorizer + +```toml +[plugin.colorizer] +enable = true +``` + +| Features | Alternatives | +| :------------------------------------- | :----------------------------------------------------- | +| Highlight color name | [colorizer](https://github.com/chrisbra/colorizer)
[vim-css-color](https://github.com/ap/vim-css-color) | + ## ctags ## cursorword