From 6f2ca4533f9353316928e6d0cfaed06d067c5e63 Mon Sep 17 00:00:00 2001 From: jdx <216188+jdx@users.noreply.github.com> Date: Tue, 28 May 2024 16:22:07 +0000 Subject: [PATCH] feat: vfox backend diff --git a/Cargo.lock b/Cargo.lock index bd3fea9db..b582b14fd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,6 +17,30 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "getrandom", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "aho-corasick" version = "1.1.3" @@ -153,6 +177,12 @@ dependencies = [ "tokio", ] +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + [[package]] name = "autocfg" version = "1.3.0" @@ -252,6 +282,27 @@ version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" +[[package]] +name = "bzip2" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8" +dependencies = [ + "bzip2-sys", + "libc", +] + +[[package]] +name = "bzip2-sys" +version = "0.1.11+1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + [[package]] name = "calm_io" version = "0.1.1" @@ -315,7 +366,7 @@ checksum = "93698b29de5e97ad0ae26447b344c482a7284c737d9ddc5f9e52b74a336671bb" dependencies = [ "chrono", "chrono-tz-build", - "phf", + "phf 0.11.2", ] [[package]] @@ -325,8 +376,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c088aee841df9c3041febbb73934cfc39708749bf96dc827e3359cd39ef11b1" dependencies = [ "parse-zoneinfo", - "phf", - "phf_codegen", + "phf 0.11.2", + "phf_codegen 0.11.2", ] [[package]] @@ -338,6 +389,16 @@ dependencies = [ "envmnt", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + [[package]] name = "clap" version = "4.5.16" @@ -369,7 +430,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -421,7 +482,7 @@ dependencies = [ "nom", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -483,6 +544,12 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" +[[package]] +name = "constant_time_eq" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" + [[package]] name = "contracts" version = "0.6.3" @@ -519,6 +586,21 @@ dependencies = [ "libc", ] +[[package]] +name = "crc" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" + [[package]] name = "crc32fast" version = "1.4.2" @@ -563,6 +645,29 @@ dependencies = [ "typenum", ] +[[package]] +name = "cssparser" +version = "0.31.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b3df4f93e5fbbe73ec01ec8d3f68bba73107993a5b1e7519273c32db9b0d5be" +dependencies = [ + "cssparser-macros", + "dtoa-short", + "itoa", + "phf 0.11.2", + "smallvec", +] + +[[package]] +name = "cssparser-macros" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" +dependencies = [ + "quote", + "syn 2.0.75", +] + [[package]] name = "ctor" version = "0.2.8" @@ -570,7 +675,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edb49164822f3ee45b17acd4a208cfc1251410cf0cad9a833234c9890774dd9f" dependencies = [ "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -597,9 +702,15 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] +[[package]] +name = "deflate64" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da692b8d1080ea3045efaab14434d40468c3d8657e42abddfffca87b428f4c1b" + [[package]] name = "demand" version = "1.2.4" @@ -638,7 +749,18 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", +] + +[[package]] +name = "derive_more" +version = "0.99.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.75", ] [[package]] @@ -667,6 +789,7 @@ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", "crypto-common", + "subtle", ] [[package]] @@ -677,7 +800,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -692,6 +815,21 @@ version = "0.15.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" +[[package]] +name = "dtoa" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcbb2bf8e87535c23f7a8a321e364ce21462d0ff10cb6407820e8e96dfff6653" + +[[package]] +name = "dtoa-short" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd1511a7b6a56299bd043a9c167a6d2bfb37bf84a6dfceaba651168adfb43c87" +dependencies = [ + "dtoa", +] + [[package]] name = "duct" version = "0.13.7" @@ -735,6 +873,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "ego-tree" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a68a4904193147e0a8dec3314640e6db742afd5f6e634f428a6af230d9b3591" + [[package]] name = "either" version = "1.13.0" @@ -750,6 +894,15 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" +[[package]] +name = "encoding_rs" +version = "0.8.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" +dependencies = [ + "cfg-if", +] + [[package]] name = "env_filter" version = "0.1.2" @@ -787,6 +940,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "erased-serde" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24e2389d65ab4fab27dc2a5de7b191e1f6617d1f1c8855c0dc569c94a4cbb18d" +dependencies = [ + "serde", + "typeid", +] + [[package]] name = "errno" version = "0.2.8" @@ -945,6 +1108,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "futf" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df420e2e84819663797d1ec6544b13c5be84629e7bb00dc960d6917db2987843" +dependencies = [ + "mac", + "new_debug_unreachable", +] + [[package]] name = "futures" version = "0.3.30" @@ -1001,7 +1174,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -1034,6 +1207,15 @@ dependencies = [ "slab", ] +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -1044,6 +1226,15 @@ dependencies = [ "version_check", ] +[[package]] +name = "getopts" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" +dependencies = [ + "unicode-width", +] + [[package]] name = "getrandom" version = "0.2.15" @@ -1106,6 +1297,25 @@ dependencies = [ "walkdir", ] +[[package]] +name = "h2" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap 2.4.0", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "hashbrown" version = "0.12.3" @@ -1145,6 +1355,15 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "home" version = "0.5.9" @@ -1168,6 +1387,32 @@ dependencies = [ "wmi", ] +[[package]] +name = "homedir" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bed305c13ce3829a09d627f5d43ff738482a09361ae4eb8039993b55fb10e5e" +dependencies = [ + "cfg-if", + "nix 0.26.4", + "widestring", + "windows 0.57.0", +] + +[[package]] +name = "html5ever" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c13771afe0e6e846f1e67d038d4cb29998a6779f93c809212e4e9c32efd244d4" +dependencies = [ + "log", + "mac", + "markup5ever", + "proc-macro2", + "quote", + "syn 2.0.75", +] + [[package]] name = "http" version = "1.1.0" @@ -1232,6 +1477,7 @@ dependencies = [ "bytes", "futures-channel", "futures-util", + "h2", "http", "http-body", "httparse", @@ -1308,7 +1554,7 @@ dependencies = [ "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows-core", + "windows-core 0.52.0", ] [[package]] @@ -1393,6 +1639,15 @@ version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "generic-array", +] + [[package]] name = "insta" version = "1.39.0" @@ -1428,6 +1683,15 @@ version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + [[package]] name = "itertools" version = "0.13.0" @@ -1553,6 +1817,16 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +[[package]] +name = "lock_api" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +dependencies = [ + "autocfg", + "scopeguard", +] + [[package]] name = "lockfree-object-pool" version = "0.1.6" @@ -1565,6 +1839,66 @@ version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +[[package]] +name = "lua-src" +version = "547.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1edaf29e3517b49b8b746701e5648ccb5785cde1c119062cbabbc5d5cd115e42" +dependencies = [ + "cc", +] + +[[package]] +name = "luajit-src" +version = "210.5.9+04dca79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e03d48e8d8c11c297d49ea6d2cf6cc0d7657eb3d175219bba47d59a601b7ca9" +dependencies = [ + "cc", + "which", +] + +[[package]] +name = "lzma-rs" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "297e814c836ae64db86b36cf2a557ba54368d03f6afcd7d947c266692f71115e" +dependencies = [ + "byteorder", + "crc", +] + +[[package]] +name = "lzma-sys" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fda04ab3764e6cde78b9974eec4f779acaba7c4e84b36eca3cf77c581b85d27" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + +[[package]] +name = "mac" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" + +[[package]] +name = "markup5ever" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16ce3abbeba692c8b8441d036ef91aea6df8da2c6b6e21c7e14d3c18e526be45" +dependencies = [ + "log", + "phf 0.11.2", + "phf_codegen 0.11.2", + "string_cache", + "string_cache_codegen", + "tendril", +] + [[package]] name = "matchers" version = "0.1.0" @@ -1609,7 +1943,7 @@ checksum = "49e7bc1560b95a3c4a25d03de42fe76ca718ab92d1a22a55b9b4cf67b3ae635c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -1683,7 +2017,7 @@ dependencies = [ "indicatif", "indoc", "insta", - "itertools", + "itertools 0.13.0", "log", "nix 0.29.0", "num_cpus", @@ -1724,12 +2058,59 @@ dependencies = [ "url", "usage-lib", "versions", + "vfox", "walkdir", "which", "xx", "zip", ] +[[package]] +name = "mlua" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d111deb18a9c9bd33e1541309f4742523bfab01d276bfa9a27519f6de9c11dc7" +dependencies = [ + "bstr", + "erased-serde", + "futures-util", + "mlua-sys", + "mlua_derive", + "num-traits", + "once_cell", + "rustc-hash", + "serde", + "serde-value", +] + +[[package]] +name = "mlua-sys" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ab7a5b4756b8177a2dfa8e0bbcde63bd4000afbc4ab20cbb68d114a25470f29" +dependencies = [ + "cc", + "cfg-if", + "lua-src", + "luajit-src", + "pkg-config", +] + +[[package]] +name = "mlua_derive" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09697a6cec88e7f58a02c7ab5c18c611c6907c8654613df9cc0192658a4fb859" +dependencies = [ + "itertools 0.12.1", + "once_cell", + "proc-macro-error", + "proc-macro2", + "quote", + "regex", + "syn 2.0.75", +] + [[package]] name = "native-tls" version = "0.2.12" @@ -1747,6 +2128,12 @@ dependencies = [ "tempfile", ] +[[package]] +name = "new_debug_unreachable" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" + [[package]] name = "nix" version = "0.26.4" @@ -1876,7 +2263,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -1897,6 +2284,15 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "ordered-float" +version = "2.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68f19d67e5a2795c94e73e0bb1cc1a7edeb2e28efd39e2e1c9b7a40c1108b11c" +dependencies = [ + "num-traits", +] + [[package]] name = "os_pipe" version = "1.2.1" @@ -1932,6 +2328,29 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "parking_lot" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets 0.52.6", +] + [[package]] name = "parse-zoneinfo" version = "0.3.1" @@ -1965,6 +2384,16 @@ dependencies = [ "once_cell", ] +[[package]] +name = "pbkdf2" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" +dependencies = [ + "digest", + "hmac", +] + [[package]] name = "percent-encoding" version = "2.3.1" @@ -2002,7 +2431,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -2026,13 +2455,33 @@ dependencies = [ "indexmap 2.4.0", ] +[[package]] +name = "phf" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259" +dependencies = [ + "phf_shared 0.10.0", +] + [[package]] name = "phf" version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" dependencies = [ - "phf_shared", + "phf_macros", + "phf_shared 0.11.2", +] + +[[package]] +name = "phf_codegen" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb1c3a8bc4dd4e5cfce29b44ffc14bedd2ee294559a294e2a4d4c9e9a6a13cd" +dependencies = [ + "phf_generator 0.10.0", + "phf_shared 0.10.0", ] [[package]] @@ -2041,8 +2490,18 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a" dependencies = [ - "phf_generator", - "phf_shared", + "phf_generator 0.11.2", + "phf_shared 0.11.2", +] + +[[package]] +name = "phf_generator" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" +dependencies = [ + "phf_shared 0.10.0", + "rand", ] [[package]] @@ -2051,10 +2510,32 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" dependencies = [ - "phf_shared", + "phf_shared 0.11.2", "rand", ] +[[package]] +name = "phf_macros" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" +dependencies = [ + "phf_generator 0.11.2", + "phf_shared 0.11.2", + "proc-macro2", + "quote", + "syn 2.0.75", +] + +[[package]] +name = "phf_shared" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" +dependencies = [ + "siphasher 0.3.11", +] + [[package]] name = "phf_shared" version = "0.11.2" @@ -2081,7 +2562,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -2133,6 +2614,12 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + [[package]] name = "predicates" version = "3.1.2" @@ -2384,9 +2871,11 @@ dependencies = [ "async-compression", "base64", "bytes", + "encoding_rs", "futures-channel", "futures-core", "futures-util", + "h2", "http", "http-body", "http-body-util", @@ -2411,6 +2900,7 @@ dependencies = [ "serde_json", "serde_urlencoded", "sync_wrapper", + "system-configuration", "tokio", "tokio-native-tls", "tokio-rustls", @@ -2585,6 +3075,28 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "scraper" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "761fb705fdf625482d2ed91d3f0559dcfeab2798fe2771c69560a774865d0802" +dependencies = [ + "ahash", + "cssparser", + "ego-tree", + "getopts", + "html5ever", + "once_cell", + "selectors", + "tendril", +] + [[package]] name = "security-framework" version = "2.11.1" @@ -2608,6 +3120,25 @@ dependencies = [ "libc", ] +[[package]] +name = "selectors" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4eb30575f3638fc8f6815f448d50cb1a2e255b0897985c8c59f4d37b72a07b06" +dependencies = [ + "bitflags 2.6.0", + "cssparser", + "derive_more", + "fxhash", + "log", + "new_debug_unreachable", + "phf 0.10.1", + "phf_codegen 0.10.0", + "precomputed-hash", + "servo_arc", + "smallvec", +] + [[package]] name = "self-replace" version = "1.4.0" @@ -2657,6 +3188,16 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde-value" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c" +dependencies = [ + "ordered-float", + "serde", +] + [[package]] name = "serde_derive" version = "1.0.208" @@ -2665,7 +3206,7 @@ checksum = "24008e81ff7613ed8e5ba0cfaf24e2c2f1e5b8a0495711e44fcd4882fca62bcf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -2701,6 +3242,26 @@ dependencies = [ "serde", ] +[[package]] +name = "servo_arc" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d036d71a959e00c77a63538b90a6c2390969f9772b096ea837205c6bd0491a44" +dependencies = [ + "stable_deref_trait", +] + +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha2" version = "0.10.8" @@ -2864,6 +3425,38 @@ dependencies = [ "der", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "string_cache" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" +dependencies = [ + "new_debug_unreachable", + "once_cell", + "parking_lot", + "phf_shared 0.10.0", + "precomputed-hash", + "serde", +] + +[[package]] +name = "string_cache_codegen" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bb30289b722be4ff74a408c3cc27edeaad656e06cb1fe8fa9231fa59c728988" +dependencies = [ + "phf_generator 0.10.0", + "phf_shared 0.10.0", + "proc-macro2", + "quote", +] + [[package]] name = "strsim" version = "0.11.1" @@ -2889,7 +3482,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -2911,9 +3504,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.74" +version = "2.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fceb41e3d546d0bd83421d3409b1460cc7444cd389341a4c880fe7a042cb3d7" +checksum = "f6af063034fc1935ede7be0122941bafa9bacb949334d090b77ca98b5817c7d9" dependencies = [ "proc-macro2", "quote", @@ -2936,6 +3529,27 @@ dependencies = [ "libc", ] +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags 1.3.2", + "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 = "tabled" version = "0.16.0" @@ -2985,6 +3599,17 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "tendril" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d24a120c5fc464a3458240ee02c299ebcb9d67b5249c8848b09d639dca8d7bb0" +dependencies = [ + "futf", + "mac", + "utf-8", +] + [[package]] name = "tera" version = "1.20.0" @@ -3050,7 +3675,7 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -3061,7 +3686,7 @@ checksum = "5c89e72a01ed4c579669add59014b9a524d609c0c88c6a585ce37485879f6ffb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", "test-case-core", ] @@ -3084,7 +3709,7 @@ checksum = "5999e24eaa32083191ba4e425deb75cdf25efefabe5aaccb7446dd0d4122a3f5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -3104,7 +3729,7 @@ checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -3175,11 +3800,25 @@ dependencies = [ "bytes", "libc", "mio", + "parking_lot", "pin-project-lite", + "signal-hook-registry", "socket2", + "tokio-macros", "windows-sys 0.52.0", ] +[[package]] +name = "tokio-macros" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.75", +] + [[package]] name = "tokio-native-tls" version = "0.3.1" @@ -3339,6 +3978,12 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" +[[package]] +name = "typeid" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e13db2e0ccd5e14a544e8a246ba2312cd25223f616442d7f2cb0e3db614236e" + [[package]] name = "typenum" version = "1.17.0" @@ -3466,7 +4111,7 @@ dependencies = [ "clap", "heck 0.5.0", "indexmap 2.4.0", - "itertools", + "itertools 0.13.0", "kdl", "log", "miette", @@ -3478,6 +4123,12 @@ dependencies = [ "xx", ] +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + [[package]] name = "utf8parse" version = "0.2.2" @@ -3508,11 +4159,32 @@ version = "6.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f25d498b63d1fdb376b4250f39ab3a5ee8d103957346abacd911e2d8b612c139" dependencies = [ - "itertools", + "itertools 0.13.0", "nom", "serde", ] +[[package]] +name = "vfox" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cac975b54f4b0f6cc67ddaaf3414ce9a763a734e6a78ca34a3add26a5335126e" +dependencies = [ + "homedir 0.3.3", + "indexmap 2.4.0", + "itertools 0.13.0", + "log", + "mlua", + "once_cell", + "reqwest", + "scraper", + "serde_json", + "thiserror", + "tokio", + "url", + "xx", +] + [[package]] name = "vte" version = "0.10.1" @@ -3590,7 +4262,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", "wasm-bindgen-shared", ] @@ -3624,7 +4296,7 @@ checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3709,9 +4381,19 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" dependencies = [ - "windows-core", - "windows-implement", - "windows-interface", + "windows-core 0.52.0", + "windows-implement 0.52.0", + "windows-interface 0.52.0", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12342cb4d8e3b046f3d80effd474a7a02447231330ef77d71daa6fbc40681143" +dependencies = [ + "windows-core 0.57.0", "windows-targets 0.52.6", ] @@ -3724,6 +4406,18 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-core" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d" +dependencies = [ + "windows-implement 0.57.0", + "windows-interface 0.57.0", + "windows-result", + "windows-targets 0.52.6", +] + [[package]] name = "windows-implement" version = "0.52.0" @@ -3732,7 +4426,18 @@ checksum = "12168c33176773b86799be25e2a2ba07c7aab9968b37541f1094dbd7a60c8946" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", +] + +[[package]] +name = "windows-implement" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.75", ] [[package]] @@ -3743,7 +4448,27 @@ checksum = "9d8dc32e0095a7eeccebd0e3f09e9509365ecb3fc6ac4d6f5f14a3f6392942d1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", +] + +[[package]] +name = "windows-interface" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.75", +] + +[[package]] +name = "windows-result" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8" +dependencies = [ + "windows-targets 0.52.6", ] [[package]] @@ -3930,7 +4655,7 @@ dependencies = [ "log", "serde", "thiserror", - "windows", + "windows 0.52.0", ] [[package]] @@ -3950,14 +4675,40 @@ version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9960db6d05795260d426061b0a962282cf67c3cdc81656731d0f646807c26237" dependencies = [ + "bzip2", "duct", "filetime", + "flate2", "globwalk", - "homedir", + "homedir 0.2.1", "log", "miette", "regex", + "reqwest", + "sha2", + "tar", "thiserror", + "tokio", + "xz", + "zip", +] + +[[package]] +name = "xz" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c887690ff2a2e233e8e49633461521f98ec57fbff9d59a884c9a4f04ec1da34" +dependencies = [ + "xz2", +] + +[[package]] +name = "xz2" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388c44dc09d76f1536602ead6d325eb532f5c122f17782bd57fb47baeeb767e2" +dependencies = [ + "lzma-sys", ] [[package]] @@ -3984,7 +4735,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -3992,6 +4743,20 @@ name = "zeroize" version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.75", +] [[package]] name = "zip" @@ -3999,15 +4764,27 @@ version = "2.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40dd8c92efc296286ce1fbd16657c5dbefff44f1b4ca01cc5f517d8b7b3d3e2e" dependencies = [ + "aes", "arbitrary", + "bzip2", + "constant_time_eq", "crc32fast", "crossbeam-utils", + "deflate64", "displaydoc", "flate2", + "hmac", "indexmap 2.4.0", + "lzma-rs", "memchr", + "pbkdf2", + "rand", + "sha1", "thiserror", + "time", + "zeroize", "zopfli", + "zstd", ] [[package]] @@ -4034,3 +4811,31 @@ dependencies = [ "once_cell", "simd-adler32", ] + +[[package]] +name = "zstd" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcf2b778a664581e31e389454a7072dab1647606d44f7feea22cd5abb9c9f3f9" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "7.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54a3ab4db68cea366acc5c897c7b4d4d1b8994a9cd6e6f841f8964566a419059" +dependencies = [ + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.13+zstd.1.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38ff0f21cfee8f97d94cef41359e0c89aa6113028ab0291aa8ca0038995a95aa" +dependencies = [ + "cc", + "pkg-config", +] diff --git a/Cargo.toml b/Cargo.toml index 16a4ee661..2fa678499 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -119,6 +119,7 @@ toml_edit = { version = "0.22.12", features = ["parse"] } url = "2.5.0" usage-lib = { version = "0.3", features = ["clap"] } versions = { version = "6.2.0", features = ["serde"] } +vfox = "0.1.0" walkdir = "2.5.0" which = "6.0.1" xx = { version = "1.0.0", features = ["glob"] } diff --git a/src/backend/mod.rs b/src/backend/mod.rs index 2a8bc978b..c43bf7c12 100644 --- a/src/backend/mod.rs +++ b/src/backend/mod.rs @@ -35,6 +35,7 @@ pub mod npm; pub mod pipx; pub mod spm; pub mod ubi; +pub mod vfox; pub type ABackend = Arc; pub type BackendMap = BTreeMap; @@ -63,6 +64,7 @@ pub enum BackendType { Pipx, Spm, Ubi, + Vfox, } impl Display for BackendType { @@ -104,6 +106,7 @@ fn list_installed_backends() -> eyre::Result { BackendType::Pipx => Arc::new(pipx::PIPXBackend::from_arg(ba)) as ABackend, BackendType::Spm => Arc::new(spm::SPMBackend::from_arg(ba)) as ABackend, BackendType::Ubi => Arc::new(ubi::UbiBackend::from_arg(ba)) as ABackend, + BackendType::Vfox => Arc::new(vfox::VfoxBackend::from_arg(ba)) as ABackend, } }) .filter(|f| f.fa().backend_type != BackendType::Asdf) @@ -136,6 +139,7 @@ pub fn get(fa: &BackendArg) -> ABackend { BackendType::Pipx => Arc::new(pipx::PIPXBackend::from_arg(fa)), BackendType::Spm => Arc::new(spm::SPMBackend::from_arg(fa)), BackendType::Ubi => Arc::new(ubi::UbiBackend::from_arg(fa)), + BackendType::Vfox => Arc::new(vfox::VfoxBackend::from_arg(fa)) as ABackend, }) .clone() } diff --git a/src/backend/vfox.rs b/src/backend/vfox.rs new file mode 100644 index 000000000..dea7e41dd --- /dev/null +++ b/src/backend/vfox.rs @@ -0,0 +1,116 @@ +use eyre::{eyre, Report}; +use std::collections::BTreeMap; +use std::env; +use std::fmt::Debug; +use tokio::runtime::Runtime; +use url::Url; + +use crate::backend::{Backend, BackendType}; +use crate::cache::CacheManager; +use crate::cli::args::BackendArg; +use crate::config::{Config, Settings}; +use crate::dirs; +use crate::install_context::InstallContext; +use crate::toolset::{ToolVersion, Toolset}; +use vfox::Vfox; + +#[derive(Debug)] +pub struct VfoxBackend { + fa: BackendArg, + vfox: Vfox, + remote_version_cache: CacheManager>, +} + +impl Backend for VfoxBackend { + fn get_type(&self) -> BackendType { + BackendType::Vfox + } + + fn fa(&self) -> &BackendArg { + &self.fa + } + + fn _list_remote_versions(&self) -> eyre::Result> { + self.remote_version_cache + .get_or_try_init(|| { + let plugin = self.vfox.install_plugin_from_url(&self.get_url()?)?; + let versions = self + .runtime()? + .block_on(self.vfox.list_available_versions(&plugin.name))?; + Ok(versions + .into_iter() + .rev() + .map(|v| v.version) + .collect::>()) + }) + .cloned() + } + + fn install_version_impl(&self, ctx: &InstallContext) -> eyre::Result<()> { + let settings = Settings::get(); + settings.ensure_experimental("vfox backend")?; + let plugin = self.vfox.install_plugin_from_url(&self.get_url()?)?; + self.runtime()?.block_on(self.vfox.install( + &plugin.name, + &ctx.tv.version, + ctx.tv.install_path(), + ))?; + Ok(()) + } + + fn exec_env( + &self, + _config: &Config, + _ts: &Toolset, + tv: &ToolVersion, + ) -> eyre::Result> { + Ok(self + .runtime()? + .block_on(self.vfox.env_keys(self.name(), &tv.version))? + .into_iter() + .map(|envkey| (envkey.key, envkey.value)) + .collect()) + } +} + +fn vfox_to_url(version: &str) -> eyre::Result { + let res = if let Some(caps) = regex!(r#"^([^/]+)/([^/]+)$"#).captures(version) { + let user = caps.get(1).unwrap().as_str(); + let repo = caps.get(2).unwrap().as_str(); + format!("https://github.com/{user}/{repo}").parse() + } else { + version.to_string().parse() + }; + res.map_err(|e| eyre!("Invalid version: {}: {}", version, e)) +} + +impl VfoxBackend { + pub fn new(name: String) -> Self { + let fa = BackendArg::new(BackendType::Vfox, &name); + let mut vfox = Vfox::new(); + vfox.plugin_dir = dirs::PLUGINS.to_path_buf(); + vfox.cache_dir = dirs::CACHE.to_path_buf(); + vfox.download_dir = dirs::DOWNLOADS.to_path_buf(); + vfox.install_dir = dirs::INSTALLS.to_path_buf(); + vfox.temp_dir = env::temp_dir().join("mise-vfox"); + Self { + vfox, + remote_version_cache: CacheManager::new( + fa.cache_path.join("remote_versions-$KEY.msgpack.z"), + ), + fa, + } + } + + fn runtime(&self) -> eyre::Result { + let rt = tokio::runtime::Builder::new_current_thread() + .enable_time() + .enable_io() + .build()?; + Ok(rt) + } + + fn get_url(&self) -> eyre::Result { + vfox_to_url(&self.fa.name) + } +} diff --git a/src/cli/args/backend_arg.rs b/src/cli/args/backend_arg.rs index 3bad37d9d..508a36729 100644 --- a/src/cli/args/backend_arg.rs +++ b/src/cli/args/backend_arg.rs @@ -124,6 +124,7 @@ mod tests { let cargo = |s, id, name| t(s, id, name, BackendType::Cargo); // let core = |s, id, name| t(s, id, name, BackendType::Core); let npm = |s, id, name| t(s, id, name, BackendType::Npm); + let vfox = |s, id, name| t(s, id, name, BackendType::Vfox); asdf("asdf:poetry", "asdf:poetry", "poetry"); asdf("poetry", "poetry", "poetry"); @@ -132,6 +133,11 @@ mod tests { // core("node", "node", "node"); npm("npm:@antfu/ni", "npm:@antfu/ni", "@antfu/ni"); npm("npm:prettier", "npm:prettier", "prettier"); + vfox( + "vfox:version-fox/vfox-nodejs", + "vfox:version-fox/vfox-nodejs", + "version-fox/vfox-nodejs", + ); } #[test] @@ -148,5 +154,10 @@ mod tests { t("cargo:eza", "cargo-eza"); t("npm:@antfu/ni", "npm-antfu-ni"); t("npm:prettier", "npm-prettier"); + t( + "vfox:version-fox/vfox-nodejs", + "vfox-version-fox-vfox-nodejs", + ); + t("vfox:version-fox/nodejs", "vfox-version-fox-nodejs"); } } diff --git a/src/cli/backends/snapshots/mise__cli__backends__ls__tests__backends_list.snap b/src/cli/backends/snapshots/mise__cli__backends__ls__tests__backends_list.snap index 31f7a741b..5ef5c807b 100644 --- a/src/cli/backends/snapshots/mise__cli__backends__ls__tests__backends_list.snap +++ b/src/cli/backends/snapshots/mise__cli__backends__ls__tests__backends_list.snap @@ -9,3 +9,4 @@ npm pipx spm ubi +vfox diff --git a/src/cli/snapshots/mise__cli__trust__tests__trust-6.snap b/src/cli/snapshots/mise__cli__trust__tests__trust-6.snap deleted file mode 100644 index e650db175..000000000 --- a/src/cli/snapshots/mise__cli__trust__tests__trust-6.snap +++ /dev/null @@ -1,5 +0,0 @@ ---- -source: src/cli/trust.rs -expression: output ---- -mise untrusted ~/cwd/.test-tool-versions diff --git a/src/registry.rs b/src/registry.rs index 15b767f65..6747bc9a6 100644 --- a/src/registry.rs +++ b/src/registry.rs @@ -2,12 +2,46 @@ use std::collections::BTreeMap; use once_cell::sync::Lazy; +#[cfg(unix)] const _REGISTRY: &[(&str, &str)] = &[ ("ubi", "cargo:ubi"), ("cargo-binstall", "cargo:cargo-binstall"), // ("elixir", "asdf:mise-plugins/mise-elixir"), ]; +#[cfg(windows)] +const _REGISTRY: &[(&str, &str)] = &[ + ("bun", "vfox:ahai-code/vfox-bun"), + ("cargo-binstall", "cargo:cargo-binstall"), + ("cmake", "vfox:version-fox/vfox-cmake"), + ("crystal", "vfox:yanecc/vfox-crystal"), + ("dart", "vfox:version-fox/vfox-dart"), + ("deno", "vfox:version-fox/vfox-deno"), + ("dotnet", "vfox:version-fox/vfox-dotnet"), + ("elixir", "vfox:version-fox/vfox-elixir"), + ("erlang", "vfox:version-fox/vfox-erlang"), + ("etcd", "vfox:version-fox/vfox-etcd"), + ("flutter", "vfox:version-fox/vfox-flut"), + ("golang", "vfox:version-fox/vfox-golang"), + ("gradle", "vfox:version-fox/vfox-gradle"), + ("groovy", "vfox:version-fox/vfox-groovy"), + ("java", "vfox:version-fox/vfox-java"), + ("julia", "vfox:ahai-code/vfox-julia"), + ("kotlin", "vfox:version-fox/vfox-kotlin"), + ("kubectl", "vfox:ahai-code/vfox-kubectl"), + ("maven", "vfox:version-fox/vfox-maven"), + ("mongo", "vfox:yeshan333/vfox-mongo"), + ("php", "vfox:version-fox/vfox-php"), + ("protobuf", "vfox:ahai-code/vfox-protobuf"), + ("python", "vfox:version-fox/vfox-python"), + ("ruby", "vfox:yanecc/vfox-ruby"), + ("scala", "vfox:version-fox/vfox-scala"), + ("terraform", "vfox:enochchau/vfox-terraform"), + ("ubi", "cargo:ubi"), + ("vlang", "vfox:ahai-code/vfox-vlang"), + ("zig", "vfox:version-fox/vfox-zig"), +]; + pub static REGISTRY: Lazy> = Lazy::new(|| { // TODO: make sure core plugins can be overridden with this enabled // let core = CORE_PLUGINS --- Cargo.lock | 886 +++++++++++++++++- Cargo.toml | 4 +- build.rs | 8 + src/backend/asdf.rs | 101 +- src/backend/external_plugin_cache.rs | 105 +++ src/backend/mod.rs | 18 +- src/backend/vfox.rs | 173 ++++ src/cli/args/backend_arg.rs | 11 + ...i__backends__ls__tests__backends_list.snap | 1 + src/cli/doctor.rs | 2 +- src/cli/plugins/install.rs | 2 +- src/cli/settings/ls.rs | 4 + src/cli/settings/set.rs | 4 + src/cli/settings/unset.rs | 2 + .../mise__cli__trust__tests__trust-6.snap | 5 - src/config/settings.rs | 12 + src/main.rs | 2 +- src/plugins/core/bun.rs | 2 +- src/plugins/core/deno.rs | 2 +- src/plugins/core/erlang.rs | 2 +- src/plugins/core/go.rs | 2 +- src/plugins/core/java.rs | 2 +- src/plugins/core/mod.rs | 9 +- src/plugins/core/node.rs | 2 +- src/plugins/core/python.rs | 2 +- src/plugins/core/ruby.rs | 2 +- src/plugins/core/zig.rs | 2 +- src/registry.rs | 58 +- src/shorthands.rs | 2 +- 29 files changed, 1256 insertions(+), 171 deletions(-) create mode 100644 src/backend/external_plugin_cache.rs create mode 100644 src/backend/vfox.rs delete mode 100644 src/cli/snapshots/mise__cli__trust__tests__trust-6.snap diff --git a/Cargo.lock b/Cargo.lock index bd3fea9db..103212dc7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,6 +17,30 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "getrandom", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "aho-corasick" version = "1.1.3" @@ -153,6 +177,12 @@ dependencies = [ "tokio", ] +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + [[package]] name = "autocfg" version = "1.3.0" @@ -252,6 +282,27 @@ version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" +[[package]] +name = "bzip2" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8" +dependencies = [ + "bzip2-sys", + "libc", +] + +[[package]] +name = "bzip2-sys" +version = "0.1.11+1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + [[package]] name = "calm_io" version = "0.1.1" @@ -315,7 +366,7 @@ checksum = "93698b29de5e97ad0ae26447b344c482a7284c737d9ddc5f9e52b74a336671bb" dependencies = [ "chrono", "chrono-tz-build", - "phf", + "phf 0.11.2", ] [[package]] @@ -325,8 +376,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c088aee841df9c3041febbb73934cfc39708749bf96dc827e3359cd39ef11b1" dependencies = [ "parse-zoneinfo", - "phf", - "phf_codegen", + "phf 0.11.2", + "phf_codegen 0.11.2", ] [[package]] @@ -338,6 +389,16 @@ dependencies = [ "envmnt", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + [[package]] name = "clap" version = "4.5.16" @@ -369,7 +430,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -421,7 +482,7 @@ dependencies = [ "nom", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -483,6 +544,12 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" +[[package]] +name = "constant_time_eq" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" + [[package]] name = "contracts" version = "0.6.3" @@ -519,6 +586,21 @@ dependencies = [ "libc", ] +[[package]] +name = "crc" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" + [[package]] name = "crc32fast" version = "1.4.2" @@ -563,6 +645,29 @@ dependencies = [ "typenum", ] +[[package]] +name = "cssparser" +version = "0.31.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b3df4f93e5fbbe73ec01ec8d3f68bba73107993a5b1e7519273c32db9b0d5be" +dependencies = [ + "cssparser-macros", + "dtoa-short", + "itoa", + "phf 0.11.2", + "smallvec", +] + +[[package]] +name = "cssparser-macros" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" +dependencies = [ + "quote", + "syn 2.0.75", +] + [[package]] name = "ctor" version = "0.2.8" @@ -570,7 +675,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edb49164822f3ee45b17acd4a208cfc1251410cf0cad9a833234c9890774dd9f" dependencies = [ "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -597,9 +702,15 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] +[[package]] +name = "deflate64" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da692b8d1080ea3045efaab14434d40468c3d8657e42abddfffca87b428f4c1b" + [[package]] name = "demand" version = "1.2.4" @@ -638,7 +749,18 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", +] + +[[package]] +name = "derive_more" +version = "0.99.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.75", ] [[package]] @@ -667,6 +789,7 @@ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", "crypto-common", + "subtle", ] [[package]] @@ -677,7 +800,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -692,6 +815,21 @@ version = "0.15.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" +[[package]] +name = "dtoa" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcbb2bf8e87535c23f7a8a321e364ce21462d0ff10cb6407820e8e96dfff6653" + +[[package]] +name = "dtoa-short" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd1511a7b6a56299bd043a9c167a6d2bfb37bf84a6dfceaba651168adfb43c87" +dependencies = [ + "dtoa", +] + [[package]] name = "duct" version = "0.13.7" @@ -735,6 +873,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "ego-tree" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a68a4904193147e0a8dec3314640e6db742afd5f6e634f428a6af230d9b3591" + [[package]] name = "either" version = "1.13.0" @@ -750,6 +894,15 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" +[[package]] +name = "encoding_rs" +version = "0.8.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" +dependencies = [ + "cfg-if", +] + [[package]] name = "env_filter" version = "0.1.2" @@ -787,6 +940,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "erased-serde" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24e2389d65ab4fab27dc2a5de7b191e1f6617d1f1c8855c0dc569c94a4cbb18d" +dependencies = [ + "serde", + "typeid", +] + [[package]] name = "errno" version = "0.2.8" @@ -945,6 +1108,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "futf" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df420e2e84819663797d1ec6544b13c5be84629e7bb00dc960d6917db2987843" +dependencies = [ + "mac", + "new_debug_unreachable", +] + [[package]] name = "futures" version = "0.3.30" @@ -1001,7 +1174,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -1034,6 +1207,15 @@ dependencies = [ "slab", ] +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -1044,6 +1226,15 @@ dependencies = [ "version_check", ] +[[package]] +name = "getopts" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" +dependencies = [ + "unicode-width", +] + [[package]] name = "getrandom" version = "0.2.15" @@ -1106,6 +1297,25 @@ dependencies = [ "walkdir", ] +[[package]] +name = "h2" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap 2.4.0", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "hashbrown" version = "0.12.3" @@ -1145,6 +1355,15 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "home" version = "0.5.9" @@ -1168,6 +1387,32 @@ dependencies = [ "wmi", ] +[[package]] +name = "homedir" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bed305c13ce3829a09d627f5d43ff738482a09361ae4eb8039993b55fb10e5e" +dependencies = [ + "cfg-if", + "nix 0.26.4", + "widestring", + "windows 0.57.0", +] + +[[package]] +name = "html5ever" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c13771afe0e6e846f1e67d038d4cb29998a6779f93c809212e4e9c32efd244d4" +dependencies = [ + "log", + "mac", + "markup5ever", + "proc-macro2", + "quote", + "syn 2.0.75", +] + [[package]] name = "http" version = "1.1.0" @@ -1232,6 +1477,7 @@ dependencies = [ "bytes", "futures-channel", "futures-util", + "h2", "http", "http-body", "httparse", @@ -1308,7 +1554,7 @@ dependencies = [ "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows-core", + "windows-core 0.52.0", ] [[package]] @@ -1393,6 +1639,15 @@ version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "generic-array", +] + [[package]] name = "insta" version = "1.39.0" @@ -1428,6 +1683,15 @@ version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + [[package]] name = "itertools" version = "0.13.0" @@ -1553,6 +1817,16 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +[[package]] +name = "lock_api" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +dependencies = [ + "autocfg", + "scopeguard", +] + [[package]] name = "lockfree-object-pool" version = "0.1.6" @@ -1565,6 +1839,66 @@ version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +[[package]] +name = "lua-src" +version = "547.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1edaf29e3517b49b8b746701e5648ccb5785cde1c119062cbabbc5d5cd115e42" +dependencies = [ + "cc", +] + +[[package]] +name = "luajit-src" +version = "210.5.9+04dca79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e03d48e8d8c11c297d49ea6d2cf6cc0d7657eb3d175219bba47d59a601b7ca9" +dependencies = [ + "cc", + "which", +] + +[[package]] +name = "lzma-rs" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "297e814c836ae64db86b36cf2a557ba54368d03f6afcd7d947c266692f71115e" +dependencies = [ + "byteorder", + "crc", +] + +[[package]] +name = "lzma-sys" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fda04ab3764e6cde78b9974eec4f779acaba7c4e84b36eca3cf77c581b85d27" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + +[[package]] +name = "mac" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" + +[[package]] +name = "markup5ever" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16ce3abbeba692c8b8441d036ef91aea6df8da2c6b6e21c7e14d3c18e526be45" +dependencies = [ + "log", + "phf 0.11.2", + "phf_codegen 0.11.2", + "string_cache", + "string_cache_codegen", + "tendril", +] + [[package]] name = "matchers" version = "0.1.0" @@ -1609,7 +1943,7 @@ checksum = "49e7bc1560b95a3c4a25d03de42fe76ca718ab92d1a22a55b9b4cf67b3ae635c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -1653,6 +1987,7 @@ dependencies = [ "base64", "built", "calm_io", + "cfg_aliases", "chrono", "ci_info", "clap", @@ -1683,7 +2018,7 @@ dependencies = [ "indicatif", "indoc", "insta", - "itertools", + "itertools 0.13.0", "log", "nix 0.29.0", "num_cpus", @@ -1724,12 +2059,59 @@ dependencies = [ "url", "usage-lib", "versions", + "vfox", "walkdir", "which", "xx", "zip", ] +[[package]] +name = "mlua" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d111deb18a9c9bd33e1541309f4742523bfab01d276bfa9a27519f6de9c11dc7" +dependencies = [ + "bstr", + "erased-serde", + "futures-util", + "mlua-sys", + "mlua_derive", + "num-traits", + "once_cell", + "rustc-hash", + "serde", + "serde-value", +] + +[[package]] +name = "mlua-sys" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ab7a5b4756b8177a2dfa8e0bbcde63bd4000afbc4ab20cbb68d114a25470f29" +dependencies = [ + "cc", + "cfg-if", + "lua-src", + "luajit-src", + "pkg-config", +] + +[[package]] +name = "mlua_derive" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09697a6cec88e7f58a02c7ab5c18c611c6907c8654613df9cc0192658a4fb859" +dependencies = [ + "itertools 0.12.1", + "once_cell", + "proc-macro-error", + "proc-macro2", + "quote", + "regex", + "syn 2.0.75", +] + [[package]] name = "native-tls" version = "0.2.12" @@ -1747,6 +2129,12 @@ dependencies = [ "tempfile", ] +[[package]] +name = "new_debug_unreachable" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" + [[package]] name = "nix" version = "0.26.4" @@ -1876,7 +2264,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -1897,6 +2285,15 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "ordered-float" +version = "2.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68f19d67e5a2795c94e73e0bb1cc1a7edeb2e28efd39e2e1c9b7a40c1108b11c" +dependencies = [ + "num-traits", +] + [[package]] name = "os_pipe" version = "1.2.1" @@ -1932,6 +2329,29 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "parking_lot" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets 0.52.6", +] + [[package]] name = "parse-zoneinfo" version = "0.3.1" @@ -1965,6 +2385,16 @@ dependencies = [ "once_cell", ] +[[package]] +name = "pbkdf2" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" +dependencies = [ + "digest", + "hmac", +] + [[package]] name = "percent-encoding" version = "2.3.1" @@ -2002,7 +2432,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -2026,13 +2456,33 @@ dependencies = [ "indexmap 2.4.0", ] +[[package]] +name = "phf" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259" +dependencies = [ + "phf_shared 0.10.0", +] + [[package]] name = "phf" version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" dependencies = [ - "phf_shared", + "phf_macros", + "phf_shared 0.11.2", +] + +[[package]] +name = "phf_codegen" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb1c3a8bc4dd4e5cfce29b44ffc14bedd2ee294559a294e2a4d4c9e9a6a13cd" +dependencies = [ + "phf_generator 0.10.0", + "phf_shared 0.10.0", ] [[package]] @@ -2041,8 +2491,18 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a" dependencies = [ - "phf_generator", - "phf_shared", + "phf_generator 0.11.2", + "phf_shared 0.11.2", +] + +[[package]] +name = "phf_generator" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" +dependencies = [ + "phf_shared 0.10.0", + "rand", ] [[package]] @@ -2051,10 +2511,32 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" dependencies = [ - "phf_shared", + "phf_shared 0.11.2", "rand", ] +[[package]] +name = "phf_macros" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" +dependencies = [ + "phf_generator 0.11.2", + "phf_shared 0.11.2", + "proc-macro2", + "quote", + "syn 2.0.75", +] + +[[package]] +name = "phf_shared" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" +dependencies = [ + "siphasher 0.3.11", +] + [[package]] name = "phf_shared" version = "0.11.2" @@ -2081,7 +2563,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -2133,6 +2615,12 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + [[package]] name = "predicates" version = "3.1.2" @@ -2384,9 +2872,11 @@ dependencies = [ "async-compression", "base64", "bytes", + "encoding_rs", "futures-channel", "futures-core", "futures-util", + "h2", "http", "http-body", "http-body-util", @@ -2411,6 +2901,7 @@ dependencies = [ "serde_json", "serde_urlencoded", "sync_wrapper", + "system-configuration", "tokio", "tokio-native-tls", "tokio-rustls", @@ -2585,6 +3076,28 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "scraper" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b90460b31bfe1fc07be8262e42c665ad97118d4585869de9345a84d501a9eaf0" +dependencies = [ + "ahash", + "cssparser", + "ego-tree", + "getopts", + "html5ever", + "once_cell", + "selectors", + "tendril", +] + [[package]] name = "security-framework" version = "2.11.1" @@ -2608,6 +3121,25 @@ dependencies = [ "libc", ] +[[package]] +name = "selectors" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4eb30575f3638fc8f6815f448d50cb1a2e255b0897985c8c59f4d37b72a07b06" +dependencies = [ + "bitflags 2.6.0", + "cssparser", + "derive_more", + "fxhash", + "log", + "new_debug_unreachable", + "phf 0.10.1", + "phf_codegen 0.10.0", + "precomputed-hash", + "servo_arc", + "smallvec", +] + [[package]] name = "self-replace" version = "1.4.0" @@ -2657,6 +3189,16 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde-value" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c" +dependencies = [ + "ordered-float", + "serde", +] + [[package]] name = "serde_derive" version = "1.0.208" @@ -2665,7 +3207,7 @@ checksum = "24008e81ff7613ed8e5ba0cfaf24e2c2f1e5b8a0495711e44fcd4882fca62bcf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -2701,6 +3243,26 @@ dependencies = [ "serde", ] +[[package]] +name = "servo_arc" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d036d71a959e00c77a63538b90a6c2390969f9772b096ea837205c6bd0491a44" +dependencies = [ + "stable_deref_trait", +] + +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha2" version = "0.10.8" @@ -2864,6 +3426,38 @@ dependencies = [ "der", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "string_cache" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" +dependencies = [ + "new_debug_unreachable", + "once_cell", + "parking_lot", + "phf_shared 0.10.0", + "precomputed-hash", + "serde", +] + +[[package]] +name = "string_cache_codegen" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bb30289b722be4ff74a408c3cc27edeaad656e06cb1fe8fa9231fa59c728988" +dependencies = [ + "phf_generator 0.10.0", + "phf_shared 0.10.0", + "proc-macro2", + "quote", +] + [[package]] name = "strsim" version = "0.11.1" @@ -2889,7 +3483,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -2911,9 +3505,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.74" +version = "2.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fceb41e3d546d0bd83421d3409b1460cc7444cd389341a4c880fe7a042cb3d7" +checksum = "f6af063034fc1935ede7be0122941bafa9bacb949334d090b77ca98b5817c7d9" dependencies = [ "proc-macro2", "quote", @@ -2936,6 +3530,27 @@ dependencies = [ "libc", ] +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags 1.3.2", + "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 = "tabled" version = "0.16.0" @@ -2985,6 +3600,17 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "tendril" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d24a120c5fc464a3458240ee02c299ebcb9d67b5249c8848b09d639dca8d7bb0" +dependencies = [ + "futf", + "mac", + "utf-8", +] + [[package]] name = "tera" version = "1.20.0" @@ -3050,7 +3676,7 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -3061,7 +3687,7 @@ checksum = "5c89e72a01ed4c579669add59014b9a524d609c0c88c6a585ce37485879f6ffb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", "test-case-core", ] @@ -3084,7 +3710,7 @@ checksum = "5999e24eaa32083191ba4e425deb75cdf25efefabe5aaccb7446dd0d4122a3f5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -3104,7 +3730,7 @@ checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -3175,11 +3801,25 @@ dependencies = [ "bytes", "libc", "mio", + "parking_lot", "pin-project-lite", + "signal-hook-registry", "socket2", + "tokio-macros", "windows-sys 0.52.0", ] +[[package]] +name = "tokio-macros" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.75", +] + [[package]] name = "tokio-native-tls" version = "0.3.1" @@ -3339,6 +3979,12 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" +[[package]] +name = "typeid" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e13db2e0ccd5e14a544e8a246ba2312cd25223f616442d7f2cb0e3db614236e" + [[package]] name = "typenum" version = "1.17.0" @@ -3466,7 +4112,7 @@ dependencies = [ "clap", "heck 0.5.0", "indexmap 2.4.0", - "itertools", + "itertools 0.13.0", "kdl", "log", "miette", @@ -3478,6 +4124,12 @@ dependencies = [ "xx", ] +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + [[package]] name = "utf8parse" version = "0.2.2" @@ -3508,11 +4160,32 @@ version = "6.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f25d498b63d1fdb376b4250f39ab3a5ee8d103957346abacd911e2d8b612c139" dependencies = [ - "itertools", + "itertools 0.13.0", "nom", "serde", ] +[[package]] +name = "vfox" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "171b1adc383ae9e46366d21a25d5a2adad28ec01a2db0acdf8c27f168756351f" +dependencies = [ + "homedir 0.3.3", + "indexmap 2.4.0", + "itertools 0.13.0", + "log", + "mlua", + "once_cell", + "reqwest", + "scraper", + "serde_json", + "thiserror", + "tokio", + "url", + "xx", +] + [[package]] name = "vte" version = "0.10.1" @@ -3590,7 +4263,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", "wasm-bindgen-shared", ] @@ -3624,7 +4297,7 @@ checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3709,9 +4382,19 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" dependencies = [ - "windows-core", - "windows-implement", - "windows-interface", + "windows-core 0.52.0", + "windows-implement 0.52.0", + "windows-interface 0.52.0", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12342cb4d8e3b046f3d80effd474a7a02447231330ef77d71daa6fbc40681143" +dependencies = [ + "windows-core 0.57.0", "windows-targets 0.52.6", ] @@ -3724,6 +4407,18 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-core" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d" +dependencies = [ + "windows-implement 0.57.0", + "windows-interface 0.57.0", + "windows-result", + "windows-targets 0.52.6", +] + [[package]] name = "windows-implement" version = "0.52.0" @@ -3732,7 +4427,18 @@ checksum = "12168c33176773b86799be25e2a2ba07c7aab9968b37541f1094dbd7a60c8946" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", +] + +[[package]] +name = "windows-implement" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.75", ] [[package]] @@ -3743,7 +4449,27 @@ checksum = "9d8dc32e0095a7eeccebd0e3f09e9509365ecb3fc6ac4d6f5f14a3f6392942d1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", +] + +[[package]] +name = "windows-interface" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.75", +] + +[[package]] +name = "windows-result" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8" +dependencies = [ + "windows-targets 0.52.6", ] [[package]] @@ -3930,7 +4656,7 @@ dependencies = [ "log", "serde", "thiserror", - "windows", + "windows 0.52.0", ] [[package]] @@ -3950,14 +4676,40 @@ version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9960db6d05795260d426061b0a962282cf67c3cdc81656731d0f646807c26237" dependencies = [ + "bzip2", "duct", "filetime", + "flate2", "globwalk", - "homedir", + "homedir 0.2.1", "log", "miette", "regex", + "reqwest", + "sha2", + "tar", "thiserror", + "tokio", + "xz", + "zip", +] + +[[package]] +name = "xz" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c887690ff2a2e233e8e49633461521f98ec57fbff9d59a884c9a4f04ec1da34" +dependencies = [ + "xz2", +] + +[[package]] +name = "xz2" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388c44dc09d76f1536602ead6d325eb532f5c122f17782bd57fb47baeeb767e2" +dependencies = [ + "lzma-sys", ] [[package]] @@ -3984,7 +4736,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.75", ] [[package]] @@ -3992,6 +4744,20 @@ name = "zeroize" version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.75", +] [[package]] name = "zip" @@ -3999,15 +4765,27 @@ version = "2.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40dd8c92efc296286ce1fbd16657c5dbefff44f1b4ca01cc5f517d8b7b3d3e2e" dependencies = [ + "aes", "arbitrary", + "bzip2", + "constant_time_eq", "crc32fast", "crossbeam-utils", + "deflate64", "displaydoc", "flate2", + "hmac", "indexmap 2.4.0", + "lzma-rs", "memchr", + "pbkdf2", + "rand", + "sha1", "thiserror", + "time", + "zeroize", "zopfli", + "zstd", ] [[package]] @@ -4034,3 +4812,31 @@ dependencies = [ "once_cell", "simd-adler32", ] + +[[package]] +name = "zstd" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcf2b778a664581e31e389454a7072dab1647606d44f7feea22cd5abb9c9f3f9" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "7.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54a3ab4db68cea366acc5c897c7b4d4d1b8994a9cd6e6f841f8964566a419059" +dependencies = [ + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.13+zstd.1.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38ff0f21cfee8f97d94cef41359e0c89aa6113028ab0291aa8ca0038995a95aa" +dependencies = [ + "cc", + "pkg-config", +] diff --git a/Cargo.toml b/Cargo.toml index 16a4ee661..33ecad407 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -119,6 +119,7 @@ toml_edit = { version = "0.22.12", features = ["parse"] } url = "2.5.0" usage-lib = { version = "0.3", features = ["clap"] } versions = { version = "6.2.0", features = ["serde"] } +vfox = "0.1" walkdir = "2.5.0" which = "6.0.1" xx = { version = "1.0.0", features = ["glob"] } @@ -130,6 +131,7 @@ nix = {version="0.29", features=["signal", "user"]} [build-dependencies] built = { version = "0.7", features = ["chrono", "git2"] } +cfg_aliases = "0.2" [dev-dependencies] assert_cmd = "2.0.14" @@ -160,4 +162,4 @@ pkg-url = "{ repo }/releases/download/v{ version }/mise-v{version}-linux-x64{ ar pkg-url = "{ repo }/releases/download/v{ version }/mise-v{version}-linux-armv7{ archive-suffix }" [package.metadata.cargo-machete] -ignored = ["built", "openssl"] +ignored = ["built", "openssl", "cfg_aliases"] diff --git a/build.rs b/build.rs index d8f91cb91..0929d741a 100644 --- a/build.rs +++ b/build.rs @@ -1,3 +1,11 @@ fn main() { + cfg_aliases::cfg_aliases! { + linux: { target_os = "linux" }, + macos: { target_os = "macos" }, + windows: { target_os = "windows" }, + + vfox: { any(feature = "vfox", target_os = "windows") }, + asdf: { any(feature = "asdf", not(target_os = "windows")) }, + } built::write_built_file().expect("Failed to acquire build-time information"); } diff --git a/src/backend/asdf.rs b/src/backend/asdf.rs index e39351e65..02b12565e 100644 --- a/src/backend/asdf.rs +++ b/src/backend/asdf.rs @@ -1,9 +1,9 @@ -use std::collections::{BTreeMap, HashMap}; +use std::collections::BTreeMap; use std::fmt::{Debug, Formatter}; use std::fs; use std::hash::{Hash, Hasher}; use std::path::{Path, PathBuf}; -use std::sync::{Arc, RwLock}; +use std::sync::Arc; use color_eyre::eyre::{eyre, Result, WrapErr}; use console::style; @@ -11,6 +11,7 @@ use itertools::Itertools; use rayon::prelude::*; use url::Url; +use crate::backend::external_plugin_cache::ExternalPluginCache; use crate::backend::{ABackend, Backend, BackendList}; use crate::cache::CacheManager; use crate::cli::args::BackendArg; @@ -25,7 +26,6 @@ use crate::plugins::asdf_plugin::AsdfPlugin; use crate::plugins::mise_plugin_toml::MisePluginToml; use crate::plugins::Script::{Download, ExecEnv, Install, ParseLegacyFile}; use crate::plugins::{Plugin, PluginType, Script, ScriptManager}; -use crate::tera::{get_tera, BASE_CONTEXT}; use crate::toolset::{ToolRequest, ToolVersion, Toolset}; use crate::ui::progress_report::SingleReport; use crate::{dirs, env, file, http}; @@ -91,6 +91,7 @@ impl AsdfBackend { pub fn list() -> Result { Ok(file::dir_subdirs(&dirs::PLUGINS)? .into_par_iter() + .filter(|name| !dirs::PLUGINS.join(name).join("metadata.lua").exists()) .map(|name| Arc::new(Self::from_arg(name.into())) as ABackend) .collect()) } @@ -458,100 +459,6 @@ impl Debug for AsdfBackend { } } -#[derive(Debug, Default)] -pub struct ExternalPluginCache { - list_bin_paths: RwLock>>>, - exec_env: RwLock>>>, -} - -impl ExternalPluginCache { - pub fn list_bin_paths( - &self, - plugin: &AsdfBackend, - tv: &ToolVersion, - fetch: F, - ) -> eyre::Result> - where - F: FnOnce() -> eyre::Result>, - { - let mut w = self.list_bin_paths.write().unwrap(); - let cm = w.entry(tv.request.clone()).or_insert_with(|| { - let list_bin_paths_filename = match &plugin.toml.list_bin_paths.cache_key { - Some(key) => { - let config = Config::get(); - let key = render_cache_key(&config, tv, key); - let filename = format!("{}-$KEY.msgpack.z", key); - tv.cache_path().join("list_bin_paths").join(filename) - } - None => tv.cache_path().join("list_bin_paths-$KEY.msgpack.z"), - }; - CacheManager::new(list_bin_paths_filename) - .with_fresh_file(dirs::DATA.to_path_buf()) - .with_fresh_file(plugin.plugin_path.clone()) - .with_fresh_file(tv.install_path()) - }); - cm.get_or_try_init(fetch).cloned() - } - - pub fn exec_env( - &self, - config: &Config, - plugin: &AsdfBackend, - tv: &ToolVersion, - fetch: F, - ) -> eyre::Result> - where - F: FnOnce() -> eyre::Result>, - { - let mut w = self.exec_env.write().unwrap(); - let cm = w.entry(tv.request.clone()).or_insert_with(|| { - let exec_env_filename = match &plugin.toml.exec_env.cache_key { - Some(key) => { - let key = render_cache_key(config, tv, key); - let filename = format!("{}-$KEY.msgpack.z", key); - tv.cache_path().join("exec_env").join(filename) - } - None => tv.cache_path().join("exec_env-$KEY.msgpack.z"), - }; - CacheManager::new(exec_env_filename) - .with_fresh_file(dirs::DATA.to_path_buf()) - .with_fresh_file(plugin.plugin_path.clone()) - .with_fresh_file(tv.install_path()) - }); - cm.get_or_try_init(fetch).cloned() - } -} - -fn render_cache_key(config: &Config, tv: &ToolVersion, cache_key: &[String]) -> String { - let elements = cache_key - .iter() - .map(|tmpl| { - let s = parse_template(config, tv, tmpl).unwrap(); - let s = s.trim().to_string(); - trace!("cache key element: {} -> {}", tmpl.trim(), s); - let mut s = hash_to_str(&s); - s.truncate(10); - s - }) - .collect::>(); - elements.join("-") -} - -fn parse_template(config: &Config, tv: &ToolVersion, tmpl: &str) -> eyre::Result { - let mut ctx = BASE_CONTEXT.clone(); - ctx.insert("project_root", &config.project_root); - ctx.insert("opts", &tv.request.options()); - get_tera( - config - .project_root - .as_ref() - .or(env::current_dir().as_ref().ok()) - .map(|p| p.as_path()), - ) - .render_str(tmpl, &ctx) - .wrap_err_with(|| eyre!("failed to parse template: {tmpl}")) -} - fn normalize_remote(remote: &str) -> eyre::Result { let url = Url::parse(remote)?; let host = url.host_str().unwrap(); diff --git a/src/backend/external_plugin_cache.rs b/src/backend/external_plugin_cache.rs new file mode 100644 index 000000000..2fb20e4d4 --- /dev/null +++ b/src/backend/external_plugin_cache.rs @@ -0,0 +1,105 @@ +use crate::backend::asdf::AsdfBackend; +use crate::cache::CacheManager; +use crate::config::Config; +use crate::dirs; +use crate::hash::hash_to_str; +use crate::tera::{get_tera, BASE_CONTEXT}; +use crate::toolset::{ToolRequest, ToolVersion}; +use eyre::{eyre, WrapErr}; +use std::collections::{BTreeMap, HashMap}; +use std::env; +use std::sync::RwLock; + +#[derive(Debug, Default)] +pub struct ExternalPluginCache { + list_bin_paths: RwLock>>>, + exec_env: RwLock>>>, +} + +impl ExternalPluginCache { + pub fn list_bin_paths( + &self, + plugin: &AsdfBackend, + tv: &ToolVersion, + fetch: F, + ) -> eyre::Result> + where + F: FnOnce() -> eyre::Result>, + { + let mut w = self.list_bin_paths.write().unwrap(); + let cm = w.entry(tv.request.clone()).or_insert_with(|| { + let list_bin_paths_filename = match &plugin.toml.list_bin_paths.cache_key { + Some(key) => { + let config = Config::get(); + let key = render_cache_key(&config, tv, key); + let filename = format!("{}-$KEY.msgpack.z", key); + tv.cache_path().join("list_bin_paths").join(filename) + } + None => tv.cache_path().join("list_bin_paths-$KEY.msgpack.z"), + }; + CacheManager::new(list_bin_paths_filename) + .with_fresh_file(dirs::DATA.to_path_buf()) + .with_fresh_file(plugin.plugin_path.clone()) + .with_fresh_file(tv.install_path()) + }); + cm.get_or_try_init(fetch).cloned() + } + + pub fn exec_env( + &self, + config: &Config, + plugin: &AsdfBackend, + tv: &ToolVersion, + fetch: F, + ) -> eyre::Result> + where + F: FnOnce() -> eyre::Result>, + { + let mut w = self.exec_env.write().unwrap(); + let cm = w.entry(tv.request.clone()).or_insert_with(|| { + let exec_env_filename = match &plugin.toml.exec_env.cache_key { + Some(key) => { + let key = render_cache_key(config, tv, key); + let filename = format!("{}-$KEY.msgpack.z", key); + tv.cache_path().join("exec_env").join(filename) + } + None => tv.cache_path().join("exec_env-$KEY.msgpack.z"), + }; + CacheManager::new(exec_env_filename) + .with_fresh_file(dirs::DATA.to_path_buf()) + .with_fresh_file(plugin.plugin_path.clone()) + .with_fresh_file(tv.install_path()) + }); + cm.get_or_try_init(fetch).cloned() + } +} + +fn render_cache_key(config: &Config, tv: &ToolVersion, cache_key: &[String]) -> String { + let elements = cache_key + .iter() + .map(|tmpl| { + let s = parse_template(config, tv, tmpl).unwrap(); + let s = s.trim().to_string(); + trace!("cache key element: {} -> {}", tmpl.trim(), s); + let mut s = hash_to_str(&s); + s.truncate(10); + s + }) + .collect::>(); + elements.join("-") +} + +fn parse_template(config: &Config, tv: &ToolVersion, tmpl: &str) -> eyre::Result { + let mut ctx = BASE_CONTEXT.clone(); + ctx.insert("project_root", &config.project_root); + ctx.insert("opts", &tv.request.options()); + get_tera( + config + .project_root + .as_ref() + .or(env::current_dir().as_ref().ok()) + .map(|p| p.as_path()), + ) + .render_str(tmpl, &ctx) + .wrap_err_with(|| eyre!("failed to parse template: {tmpl}")) +} diff --git a/src/backend/mod.rs b/src/backend/mod.rs index 0589929cd..38bd81a0f 100644 --- a/src/backend/mod.rs +++ b/src/backend/mod.rs @@ -30,11 +30,13 @@ use self::backend_meta::BackendMeta; pub mod asdf; pub mod backend_meta; pub mod cargo; +mod external_plugin_cache; pub mod go; pub mod npm; pub mod pipx; pub mod spm; pub mod ubi; +pub mod vfox; pub type ABackend = Arc; pub type BackendMap = BTreeMap; @@ -63,6 +65,7 @@ pub enum BackendType { Pipx, Spm, Ubi, + Vfox, } impl Display for BackendType { @@ -77,10 +80,18 @@ fn load_tools() -> BackendMap { if let Some(backends) = TOOLS.lock().unwrap().as_ref() { return backends.clone(); } - let mut tools = CORE_PLUGINS.clone(); - tools.extend(asdf::AsdfBackend::list().expect("failed to list plugins")); - tools.extend(list_installed_backends().expect("failed to list backends")); + let mut tools = CORE_PLUGINS + .iter() + .map(|(_, p)| p.clone()) + .collect::>(); let settings = Settings::get(); + if settings.asdf { + tools.extend(asdf::AsdfBackend::list().expect("failed to list asdf plugins")); + } + if settings.vfox { + tools.extend(vfox::VfoxBackend::list().expect("failed to list vfox plugins")); + } + tools.extend(list_installed_backends().expect("failed to list backends")); tools.retain(|plugin| !settings.disable_tools.contains(plugin.id())); let tools: BackendMap = tools .into_iter() @@ -130,6 +141,7 @@ pub fn arg_to_backend(ba: BackendArg) -> ABackend { BackendType::Pipx => Arc::new(pipx::PIPXBackend::from_arg(ba)), BackendType::Spm => Arc::new(spm::SPMBackend::from_arg(ba)), BackendType::Ubi => Arc::new(ubi::UbiBackend::from_arg(ba)), + BackendType::Vfox => Arc::new(vfox::VfoxBackend::from_arg(ba)), } } diff --git a/src/backend/vfox.rs b/src/backend/vfox.rs new file mode 100644 index 000000000..9de70cb33 --- /dev/null +++ b/src/backend/vfox.rs @@ -0,0 +1,173 @@ +use eyre::{eyre, Report}; +use heck::ToKebabCase; +use rayon::prelude::*; +use std::collections::BTreeMap; +use std::env; +use std::fmt::Debug; +use std::path::PathBuf; +use std::sync::{Arc, Mutex, MutexGuard, OnceLock}; +use tokio::runtime::Runtime; +use url::Url; + +use crate::backend::{ABackend, Backend, BackendList, BackendType}; +use crate::cache::CacheManager; +use crate::cli::args::BackendArg; +use crate::config::{Config, Settings}; +use crate::git::Git; +use crate::install_context::InstallContext; +use crate::toolset::{ToolVersion, Toolset}; +use crate::{dirs, file}; +use vfox::Vfox; + +#[derive(Debug)] +pub struct VfoxBackend { + ba: BackendArg, + vfox: Vfox, + plugin_path: PathBuf, + remote_version_cache: CacheManager>, + exec_env_cache: CacheManager>, + repo: OnceLock>, + pathname: String, +} + +impl Backend for VfoxBackend { + fn get_type(&self) -> BackendType { + BackendType::Vfox + } + + fn fa(&self) -> &BackendArg { + &self.ba + } + + fn _list_remote_versions(&self) -> eyre::Result> { + self.remote_version_cache + .get_or_try_init(|| { + let plugin = self.vfox.install_plugin_from_url(&self.get_url()?)?; + let versions = self + .runtime()? + .block_on(self.vfox.list_available_versions(&plugin.name))?; + Ok(versions + .into_iter() + .rev() + .map(|v| v.version) + .collect::>()) + }) + .cloned() + } + + fn install_version_impl(&self, ctx: &InstallContext) -> eyre::Result<()> { + let settings = Settings::get(); + settings.ensure_experimental("vfox backend")?; + let plugin = self.vfox.install_plugin_from_url(&self.get_url()?)?; + self.runtime()?.block_on(self.vfox.install( + &plugin.name, + &ctx.tv.version, + ctx.tv.install_path(), + ))?; + Ok(()) + } + + fn list_bin_paths(&self, tv: &ToolVersion) -> eyre::Result> { + dbg!(self._exec_env(tv)?); + let path = self + ._exec_env(tv)? + .get("PATH") + .cloned() + .unwrap_or("bin".to_string()); + Ok(env::split_paths(&path).collect()) + } + + fn exec_env( + &self, + _config: &Config, + _ts: &Toolset, + tv: &ToolVersion, + ) -> eyre::Result> { + self._exec_env(tv).cloned() + } +} + +fn vfox_to_url(version: &str) -> eyre::Result { + let res = if let Some(caps) = regex!(r#"^([^/]+)/([^/]+)$"#).captures(version) { + let user = caps.get(1).unwrap().as_str(); + let repo = caps.get(2).unwrap().as_str(); + format!("https://github.com/{user}/{repo}").parse() + } else { + version.to_string().parse() + }; + res.map_err(|e| eyre!("Invalid version: {}: {}", version, e)) +} + +impl VfoxBackend { + pub fn list() -> eyre::Result { + Ok(file::dir_subdirs(&dirs::PLUGINS)? + .into_par_iter() + .filter(|name| dirs::PLUGINS.join(name).join("metadata.lua").exists()) + .map(|name| Arc::new(Self::from_arg(name.into())) as ABackend) + .collect()) + } + + pub fn from_arg(ba: BackendArg) -> Self { + let mut vfox = Vfox::new(); + vfox.plugin_dir = dirs::PLUGINS.to_path_buf(); + vfox.cache_dir = dirs::CACHE.to_path_buf(); + vfox.download_dir = dirs::DOWNLOADS.to_path_buf(); + vfox.install_dir = dirs::INSTALLS.to_path_buf(); + vfox.temp_dir = env::temp_dir().join("mise-vfox"); + let pathname = ba.short.to_kebab_case(); + let plugin_path = dirs::PLUGINS.join(&pathname); + Self { + remote_version_cache: CacheManager::new( + ba.cache_path.join("remote_versions-$KEY.msgpack.z"), + ) + .with_fresh_file(dirs::DATA.to_path_buf()) + .with_fresh_file(plugin_path.to_path_buf()) + .with_fresh_file(ba.installs_path.to_path_buf()), + exec_env_cache: CacheManager::new(ba.cache_path.join("exec_env-$KEY.msgpack.z")) + .with_fresh_file(dirs::DATA.to_path_buf()) + .with_fresh_file(plugin_path.to_path_buf()) + .with_fresh_file(ba.installs_path.to_path_buf()), + repo: OnceLock::new(), + ba, + vfox, + plugin_path, + pathname, + } + } + + fn runtime(&self) -> eyre::Result { + let rt = tokio::runtime::Builder::new_current_thread() + .enable_time() + .enable_io() + .build()?; + Ok(rt) + } + + fn _exec_env(&self, tv: &ToolVersion) -> eyre::Result<&BTreeMap> { + self.exec_env_cache.get_or_try_init(|| { + Ok(self + .runtime()? + .block_on(self.vfox.env_keys(&self.pathname, &tv.version))? + .into_iter() + .map(|envkey| (envkey.key, envkey.value)) + .collect()) + }) + } + + fn get_url(&self) -> eyre::Result { + if let Ok(Some(url)) = self.repo().map(|r| r.get_remote_url()) { + return Ok(Url::parse(&url)?); + } + vfox_to_url(&self.ba.name) + } + + fn repo(&self) -> eyre::Result> { + if let Some(repo) = self.repo.get() { + Ok(repo.lock().unwrap()) + } else { + let repo = Mutex::new(Git::new(self.plugin_path.clone())); + self.repo.set(repo).unwrap(); + self.repo() + } + } +} diff --git a/src/cli/args/backend_arg.rs b/src/cli/args/backend_arg.rs index 70ed21ae0..f59def7da 100644 --- a/src/cli/args/backend_arg.rs +++ b/src/cli/args/backend_arg.rs @@ -123,6 +123,7 @@ mod tests { let cargo = |s, id, name| t(s, id, name, BackendType::Cargo); // let core = |s, id, name| t(s, id, name, BackendType::Core); let npm = |s, id, name| t(s, id, name, BackendType::Npm); + let vfox = |s, id, name| t(s, id, name, BackendType::Vfox); asdf("asdf:poetry", "asdf:poetry", "poetry"); asdf("poetry", "poetry", "poetry"); @@ -131,6 +132,11 @@ mod tests { // core("node", "node", "node"); npm("npm:@antfu/ni", "npm:@antfu/ni", "@antfu/ni"); npm("npm:prettier", "npm:prettier", "prettier"); + vfox( + "vfox:version-fox/vfox-nodejs", + "vfox:version-fox/vfox-nodejs", + "version-fox/vfox-nodejs", + ); } #[test] @@ -147,5 +153,10 @@ mod tests { t("cargo:eza", "cargo-eza"); t("npm:@antfu/ni", "npm-antfu-ni"); t("npm:prettier", "npm-prettier"); + t( + "vfox:version-fox/vfox-nodejs", + "vfox-version-fox-vfox-nodejs", + ); + t("vfox:version-fox/nodejs", "vfox-version-fox-nodejs"); } } diff --git a/src/cli/backends/snapshots/mise__cli__backends__ls__tests__backends_list.snap b/src/cli/backends/snapshots/mise__cli__backends__ls__tests__backends_list.snap index 31f7a741b..5ef5c807b 100644 --- a/src/cli/backends/snapshots/mise__cli__backends__ls__tests__backends_list.snap +++ b/src/cli/backends/snapshots/mise__cli__backends__ls__tests__backends_list.snap @@ -9,3 +9,4 @@ npm pipx spm ubi +vfox diff --git a/src/cli/doctor.rs b/src/cli/doctor.rs index c0351f8d6..34079f30d 100644 --- a/src/cli/doctor.rs +++ b/src/cli/doctor.rs @@ -189,7 +189,7 @@ impl Doctor { fn analyze_plugins(&mut self) { for plugin in backend::list() { - let is_core = CORE_PLUGINS.iter().any(|fg| fg.id() == plugin.id()); + let is_core = CORE_PLUGINS.contains_key(plugin.id()); let plugin_type = plugin.get_plugin_type(); if is_core && plugin_type == PluginType::Asdf { diff --git a/src/cli/plugins/install.rs b/src/cli/plugins/install.rs index c6584ca4a..6a7cccd1d 100644 --- a/src/cli/plugins/install.rs +++ b/src/cli/plugins/install.rs @@ -62,7 +62,7 @@ impl PluginsInstall { if git_url.is_some() { self.install_one(name, git_url, &mpr)?; } else { - let is_core = CORE_PLUGINS.iter().any(|p| p.id() == name); + let is_core = CORE_PLUGINS.contains_key(&name); if is_core { let name = style::eblue(name); bail!("{name} is a core plugin and does not need to be installed"); diff --git a/src/cli/settings/ls.rs b/src/cli/settings/ls.rs index 188faf50a..4e733023b 100644 --- a/src/cli/settings/ls.rs +++ b/src/cli/settings/ls.rs @@ -63,6 +63,7 @@ mod tests { all_compile = false always_keep_download = true always_keep_install = true + asdf = true asdf_compat = false cargo_binstall = true color = true @@ -90,6 +91,7 @@ mod tests { raw = false trusted_config_paths = [] verbose = true + vfox = false yes = true [status] @@ -107,6 +109,7 @@ mod tests { all_compile always_keep_download always_keep_install + asdf asdf_compat cargo_binstall color @@ -138,6 +141,7 @@ mod tests { status.show_tools trusted_config_paths verbose + vfox yes "###); } diff --git a/src/cli/settings/set.rs b/src/cli/settings/set.rs index 8f5dda7a5..60a6253b6 100644 --- a/src/cli/settings/set.rs +++ b/src/cli/settings/set.rs @@ -24,6 +24,7 @@ impl SettingsSet { "all_compile" => parse_bool(&self.value)?, "always_keep_download" => parse_bool(&self.value)?, "always_keep_install" => parse_bool(&self.value)?, + "asdf" => parse_bool(&self.value)?, "asdf_compat" => parse_bool(&self.value)?, "cargo_binstall" => parse_bool(&self.value)?, "color" => parse_bool(&self.value)?, @@ -61,6 +62,7 @@ impl SettingsSet { "task_output" => self.value.into(), "trusted_config_paths" => self.value.split(':').map(|s| s.to_string()).collect(), "verbose" => parse_bool(&self.value)?, + "vfox" => parse_bool(&self.value)?, "yes" => parse_bool(&self.value)?, _ => return Err(eyre!("Unknown setting: {}", self.setting)), }; @@ -135,6 +137,7 @@ pub mod tests { all_compile = false always_keep_download = true always_keep_install = true + asdf = true asdf_compat = false cargo_binstall = true color = true @@ -162,6 +165,7 @@ pub mod tests { raw = false trusted_config_paths = [] verbose = true + vfox = false yes = true [status] diff --git a/src/cli/settings/unset.rs b/src/cli/settings/unset.rs index eaa51c731..7439a1981 100644 --- a/src/cli/settings/unset.rs +++ b/src/cli/settings/unset.rs @@ -54,6 +54,7 @@ mod tests { all_compile = false always_keep_download = true always_keep_install = true + asdf = true asdf_compat = false cargo_binstall = true color = true @@ -81,6 +82,7 @@ mod tests { raw = false trusted_config_paths = [] verbose = true + vfox = false yes = true [status] diff --git a/src/cli/snapshots/mise__cli__trust__tests__trust-6.snap b/src/cli/snapshots/mise__cli__trust__tests__trust-6.snap deleted file mode 100644 index e650db175..000000000 --- a/src/cli/snapshots/mise__cli__trust__tests__trust-6.snap +++ /dev/null @@ -1,5 +0,0 @@ ---- -source: src/cli/trust.rs -expression: output ---- -mise untrusted ~/cwd/.test-tool-versions diff --git a/src/config/settings.rs b/src/config/settings.rs index bf9cee805..946d3f7fb 100644 --- a/src/config/settings.rs +++ b/src/config/settings.rs @@ -30,6 +30,12 @@ pub struct Settings { pub always_keep_download: bool, #[config(env = "MISE_ALWAYS_KEEP_INSTALL", default = false)] pub always_keep_install: bool, + #[cfg(asdf)] + #[config(env = "MISE_ASDF", default = true)] + pub asdf: bool, + #[cfg(not(asdf))] + #[config(env = "MISE_ASDF", default = false)] + pub asdf: bool, /// default to asdf-compatible behavior /// this means that the global config file will be ~/.tool-versions /// also, the default behavior of `mise global` will be --pin @@ -121,6 +127,12 @@ pub struct Settings { pub quiet: bool, #[config(env = "MISE_VERBOSE", default = false)] pub verbose: bool, + #[cfg(vfox)] + #[config(env = "MISE_VFOX", default = true)] + pub vfox: bool, + #[cfg(not(vfox))] + #[config(env = "MISE_VFOX", default = false)] + pub vfox: bool, #[config(env = "MISE_YES", default = false)] pub yes: bool, diff --git a/src/main.rs b/src/main.rs index 0692a2d89..b39b21699 100644 --- a/src/main.rs +++ b/src/main.rs @@ -76,7 +76,7 @@ fn handle_err(err: Report) -> eyre::Result<()> { return Ok(()); } } - if cfg!(debug_assertions) || log::max_level() < log::LevelFilter::Debug { + if cfg!(not(debug_assertions)) || log::max_level() < log::LevelFilter::Debug { display_friendly_err(err); exit(1); } diff --git a/src/plugins/core/bun.rs b/src/plugins/core/bun.rs index 906d60815..d8a528eed 100644 --- a/src/plugins/core/bun.rs +++ b/src/plugins/core/bun.rs @@ -24,7 +24,7 @@ pub struct BunPlugin { impl BunPlugin { pub fn new() -> Self { - let core = CorePlugin::new("bun".into()); + let core = CorePlugin::new(BackendArg::new("bun", "bun")); Self { core } } diff --git a/src/plugins/core/deno.rs b/src/plugins/core/deno.rs index 487942b31..ec2b45837 100644 --- a/src/plugins/core/deno.rs +++ b/src/plugins/core/deno.rs @@ -26,7 +26,7 @@ pub struct DenoPlugin { impl DenoPlugin { pub fn new() -> Self { - let core = CorePlugin::new("deno".into()); + let core = CorePlugin::new(BackendArg::new("deno", "deno")); Self { core } } diff --git a/src/plugins/core/erlang.rs b/src/plugins/core/erlang.rs index a0d8db0e7..071a2719c 100644 --- a/src/plugins/core/erlang.rs +++ b/src/plugins/core/erlang.rs @@ -22,7 +22,7 @@ const KERL_VERSION: &str = "4.1.1"; impl ErlangPlugin { pub fn new() -> Self { Self { - core: CorePlugin::new("erlang".into()), + core: CorePlugin::new(BackendArg::new("erlang", "erlang")), } } diff --git a/src/plugins/core/go.rs b/src/plugins/core/go.rs index 265eddecf..375c6f84f 100644 --- a/src/plugins/core/go.rs +++ b/src/plugins/core/go.rs @@ -26,7 +26,7 @@ pub struct GoPlugin { impl GoPlugin { pub fn new() -> Self { Self { - core: CorePlugin::new("go".into()), + core: CorePlugin::new(BackendArg::new("go", "go")), } } diff --git a/src/plugins/core/java.rs b/src/plugins/core/java.rs index d2279e677..690f769da 100644 --- a/src/plugins/core/java.rs +++ b/src/plugins/core/java.rs @@ -35,7 +35,7 @@ pub struct JavaPlugin { impl JavaPlugin { pub fn new() -> Self { - let core = CorePlugin::new("java".into()); + let core = CorePlugin::new(BackendArg::new("java", "java")); let java_metadata_ga_cache_filename = format!("java_metadata_ga_{}_{}-$KEY.msgpack.z", os(), arch()); let java_metadata_ea_cache_filename = diff --git a/src/plugins/core/mod.rs b/src/plugins/core/mod.rs index 877682821..64a59b09e 100644 --- a/src/plugins/core/mod.rs +++ b/src/plugins/core/mod.rs @@ -6,7 +6,7 @@ use std::sync::Arc; pub use python::PythonPlugin; -use crate::backend::{Backend, BackendList}; +use crate::backend::{Backend, BackendMap}; use crate::cache::CacheManager; use crate::cli::args::BackendArg; use crate::config::Settings; @@ -35,7 +35,7 @@ mod python; mod ruby; mod zig; -pub static CORE_PLUGINS: Lazy = Lazy::new(|| { +pub static CORE_PLUGINS: Lazy = Lazy::new(|| { let mut plugins: Vec> = vec![ Arc::new(BunPlugin::new()), Arc::new(DenoPlugin::new()), @@ -51,6 +51,9 @@ pub static CORE_PLUGINS: Lazy = Lazy::new(|| { plugins.push(Arc::new(ZigPlugin::new())); } plugins + .into_iter() + .map(|p| (p.id().to_string(), p)) + .collect() }); #[derive(Debug)] @@ -64,7 +67,7 @@ impl CorePlugin { let settings = Settings::get(); CORE_PLUGINS .iter() - .map(|f| Box::new(CorePlugin::new(f.name().to_string().into())) as Box) + .map(|(id, _)| Box::new(CorePlugin::new(id.to_string().into())) as Box) .filter(|p| !settings.disable_tools.contains(p.name())) .collect() } diff --git a/src/plugins/core/node.rs b/src/plugins/core/node.rs index 214ac4334..ab00b71ed 100644 --- a/src/plugins/core/node.rs +++ b/src/plugins/core/node.rs @@ -27,7 +27,7 @@ pub struct NodePlugin { impl NodePlugin { pub fn new() -> Self { Self { - core: CorePlugin::new("node".into()), + core: CorePlugin::new(BackendArg::new("node", "node")), } } diff --git a/src/plugins/core/python.rs b/src/plugins/core/python.rs index 0a8f395dd..0db8312eb 100644 --- a/src/plugins/core/python.rs +++ b/src/plugins/core/python.rs @@ -27,7 +27,7 @@ pub struct PythonPlugin { impl PythonPlugin { pub fn new() -> Self { - let core = CorePlugin::new("python".into()); + let core = CorePlugin::new(BackendArg::new("python", "python")); Self { precompiled_cache: CacheManager::new( core.fa.cache_path.join("precompiled-$KEY.msgpack.z"), diff --git a/src/plugins/core/ruby.rs b/src/plugins/core/ruby.rs index 34e610a26..391d18a81 100644 --- a/src/plugins/core/ruby.rs +++ b/src/plugins/core/ruby.rs @@ -29,7 +29,7 @@ pub struct RubyPlugin { impl RubyPlugin { pub fn new() -> Self { Self { - core: CorePlugin::new("ruby".into()), + core: CorePlugin::new(BackendArg::new("ruby", "ruby")), } } diff --git a/src/plugins/core/zig.rs b/src/plugins/core/zig.rs index bfe4afaed..e97e49a3d 100644 --- a/src/plugins/core/zig.rs +++ b/src/plugins/core/zig.rs @@ -24,7 +24,7 @@ pub struct ZigPlugin { impl ZigPlugin { pub fn new() -> Self { - let core = CorePlugin::new("zig".into()); + let core = CorePlugin::new(BackendArg::new("zig", "zig")); Self { core } } diff --git a/src/registry.rs b/src/registry.rs index 15b767f65..67dc3193f 100644 --- a/src/registry.rs +++ b/src/registry.rs @@ -1,6 +1,8 @@ -use std::collections::BTreeMap; - +use crate::config::Settings; +use crate::plugins::core::CORE_PLUGINS; +use itertools::Itertools; use once_cell::sync::Lazy; +use std::collections::BTreeMap; const _REGISTRY: &[(&str, &str)] = &[ ("ubi", "cargo:ubi"), @@ -8,12 +10,50 @@ const _REGISTRY: &[(&str, &str)] = &[ // ("elixir", "asdf:mise-plugins/mise-elixir"), ]; +const _REGISTRY_VFOX: &[(&str, &str)] = &[ + ("bun", "vfox:ahai-code/vfox-bun"), + ("cargo-binstall", "cargo:cargo-binstall"), + ("cmake", "vfox:version-fox/vfox-cmake"), + ("crystal", "vfox:yanecc/vfox-crystal"), + ("dart", "vfox:version-fox/vfox-dart"), + ("deno", "vfox:version-fox/vfox-deno"), + ("dotnet", "vfox:version-fox/vfox-dotnet"), + ("elixir", "vfox:version-fox/vfox-elixir"), + ("erlang", "vfox:version-fox/vfox-erlang"), + ("etcd", "vfox:version-fox/vfox-etcd"), + ("flutter", "vfox:version-fox/vfox-flut"), + ("golang", "vfox:version-fox/vfox-golang"), + ("gradle", "vfox:version-fox/vfox-gradle"), + ("groovy", "vfox:version-fox/vfox-groovy"), + ("java", "vfox:version-fox/vfox-java"), + ("julia", "vfox:ahai-code/vfox-julia"), + ("kotlin", "vfox:version-fox/vfox-kotlin"), + ("kubectl", "vfox:ahai-code/vfox-kubectl"), + ("maven", "vfox:version-fox/vfox-maven"), + ("mongo", "vfox:yeshan333/vfox-mongo"), + ("php", "vfox:version-fox/vfox-php"), + ("protobuf", "vfox:ahai-code/vfox-protobuf"), + ("python", "vfox:version-fox/vfox-python"), + ("ruby", "vfox:yanecc/vfox-ruby"), + ("scala", "vfox:version-fox/vfox-scala"), + ("terraform", "vfox:enochchau/vfox-terraform"), + ("ubi", "cargo:ubi"), + ("vlang", "vfox:ahai-code/vfox-vlang"), + ("zig", "vfox:version-fox/vfox-zig"), +]; + pub static REGISTRY: Lazy> = Lazy::new(|| { - // TODO: make sure core plugins can be overridden with this enabled - // let core = CORE_PLUGINS - // .iter() - // .map(|p| (p.name(), format!("core:{}", p.name()))); - let registry = _REGISTRY.iter().map(|(k, v)| (*k, v.to_string())); - registry.collect() - // core.chain(registry).collect() + let settings = Settings::get(); + + let registry = if settings.vfox { + _REGISTRY.iter().chain(_REGISTRY_VFOX.iter()).collect_vec() + } else { + _REGISTRY.iter().collect_vec() + }; + + registry + .into_iter() + .filter(|(id, _)| !CORE_PLUGINS.contains_key(*id)) + .map(|(k, v)| (*k, v.to_string())) + .collect() }); diff --git a/src/shorthands.rs b/src/shorthands.rs index 6f8f1e347..28672c698 100644 --- a/src/shorthands.rs +++ b/src/shorthands.rs @@ -12,7 +12,7 @@ pub type Shorthands = HashMap; pub fn get_shorthands(settings: &Settings) -> Shorthands { let mut shorthands = HashMap::new(); - if !settings.disable_default_shorthands { + if !settings.disable_default_shorthands && settings.asdf { shorthands.extend( DEFAULT_SHORTHANDS .iter()