diff --git a/Cargo.lock b/Cargo.lock index f7068be..ff2bb44 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -191,14 +191,15 @@ dependencies = [ [[package]] name = "async-executor" -version = "1.13.1" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30ca9a001c1e8ba5149f91a74362376cc6bc5b919d92d988668657bd570bdcec" +checksum = "bb812ffb58524bdd10860d7d974e2f01cc0950c2438a74ee5ec2e2280c6c4ffa" dependencies = [ "async-task", "concurrent-queue", "fastrand", "futures-lite", + "pin-project-lite", "slab", ] @@ -360,7 +361,7 @@ dependencies = [ "miniz_oxide", "object", "rustc-demangle", - "windows-targets 0.52.6", + "windows-targets", ] [[package]] @@ -375,12 +376,6 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - [[package]] name = "base64" version = "0.22.1" @@ -406,7 +401,7 @@ dependencies = [ "regex", "rustc-hash 1.1.0", "shlex", - "syn 2.0.100", + "syn 2.0.101", "which", ] @@ -584,9 +579,9 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "chrono" -version = "0.4.40" +version = "0.4.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c" +checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d" dependencies = [ "android-tzdata", "iana-time-zone", @@ -663,7 +658,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] @@ -746,16 +741,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "core-foundation" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -840,7 +825,7 @@ checksum = "30542c1ad912e0e3d22a1935c290e12e8a29d704a420177a31faad4a601a0800" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] @@ -934,7 +919,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] @@ -955,15 +940,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" -[[package]] -name = "encoding_rs" -version = "0.8.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" -dependencies = [ - "cfg-if 1.0.0", -] - [[package]] name = "endian-type" version = "0.1.2" @@ -1128,7 +1104,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] @@ -1138,7 +1114,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f2f12607f92c69b12ed746fabf9ca4f5c482cba46679c1a75b874ed7c26adb" dependencies = [ "futures-io", - "rustls 0.23.26", + "rustls", "rustls-pki-types", ] @@ -1249,25 +1225,6 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" -[[package]] -name = "h2" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http 0.2.12", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", -] - [[package]] name = "hashbrown" version = "0.15.2" @@ -1304,17 +1261,6 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "http" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - [[package]] name = "http" version = "1.3.1" @@ -1326,17 +1272,6 @@ dependencies = [ "itoa", ] -[[package]] -name = "http-body" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" -dependencies = [ - "bytes", - "http 0.2.12", - "pin-project-lite", -] - [[package]] name = "http-body" version = "1.0.1" @@ -1344,7 +1279,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", - "http 1.3.1", + "http", ] [[package]] @@ -1355,8 +1290,8 @@ checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" dependencies = [ "bytes", "futures-core", - "http 1.3.1", - "http-body 1.0.1", + "http", + "http-body", "pin-project-lite", ] @@ -1372,30 +1307,6 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" -[[package]] -name = "hyper" -version = "0.14.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41dfc780fdec9373c01bae43289ea34c972e40ee3c9f6b3c8801a35f35586ce7" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http 0.2.12", - "http-body 0.4.6", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "socket2", - "tokio", - "tower-service", - "tracing", - "want", -] - [[package]] name = "hyper" version = "1.6.0" @@ -1405,8 +1316,8 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "http 1.3.1", - "http-body 1.0.1", + "http", + "http-body", "httparse", "httpdate", "itoa", @@ -1416,20 +1327,6 @@ dependencies = [ "want", ] -[[package]] -name = "hyper-rustls" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" -dependencies = [ - "futures-util", - "http 0.2.12", - "hyper 0.14.32", - "rustls 0.21.12", - "tokio", - "tokio-rustls", -] - [[package]] name = "iana-time-zone" version = "0.1.63" @@ -1569,7 +1466,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] @@ -1612,12 +1509,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "ipnet" -version = "2.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" - [[package]] name = "is_terminal_polyfill" version = "1.70.1" @@ -1693,7 +1584,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" dependencies = [ "cfg-if 1.0.0", - "windows-targets 0.52.6", + "windows-targets", ] [[package]] @@ -1767,24 +1658,25 @@ name = "lune" version = "0.9.0" dependencies = [ "anyhow", + "async-fs", + "async-io", + "blocking", "clap", "console", "dialoguer", "directories", - "futures-util", - "lune-roblox", + "futures-lite", "lune-std", "lune-utils", "mlua", "mlua-luau-scheduler", - "reqwest", "rustyline", "serde", "serde_json", "thiserror 2.0.12", - "tokio", "tracing", "tracing-subscriber", + "ureq", "zip", ] @@ -1875,18 +1767,18 @@ dependencies = [ "futures-lite", "futures-rustls", "http-body-util", - "hyper 1.6.0", + "hyper", "lune-std-serde", "lune-utils", "mlua", "mlua-luau-scheduler", "pin-project-lite", - "rustls 0.23.26", + "rustls", "rustls-pki-types", "url", "urlencoding", "webpki", - "webpki-roots 0.26.8", + "webpki-roots", ] [[package]] @@ -2058,12 +1950,6 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" -[[package]] -name = "mime" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" - [[package]] name = "minimal-lexical" version = "0.2.1" @@ -2079,17 +1965,6 @@ dependencies = [ "adler2", ] -[[package]] -name = "mio" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" -dependencies = [ - "libc", - "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.52.0", -] - [[package]] name = "mlua" version = "0.10.3" @@ -2275,7 +2150,7 @@ dependencies = [ "libc", "redox_syscall 0.5.11", "smallvec", - "windows-targets 0.52.6", + "windows-targets", ] [[package]] @@ -2329,7 +2204,7 @@ checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] @@ -2401,7 +2276,7 @@ version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" dependencies = [ - "zerocopy 0.8.24", + "zerocopy 0.8.25", ] [[package]] @@ -2411,7 +2286,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "664ec5419c51e34154eec046ebcba56312d5a2fc3b09a06da188e1ad21afadf6" dependencies = [ "proc-macro2", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] @@ -2445,7 +2320,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a65f2e60fbf1063868558d69c6beacf412dc755f9fc020f514b7955fc914fe30" dependencies = [ "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] @@ -2598,9 +2473,9 @@ dependencies = [ [[package]] name = "rbx_reflection_database" -version = "1.0.2+roblox-670" +version = "1.0.3+roblox-670" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5349b19e5e94fbcaba7a52175263ab64011e0a13f17ff57729f2f560ccdec615" +checksum = "e22c05ef92528c0fb0cc580592a65ca178d3ea9beb07a1d9ca0a2503c4f3721c" dependencies = [ "lazy_static", "rbx_reflection", @@ -2730,47 +2605,6 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" -[[package]] -name = "reqwest" -version = "0.11.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" -dependencies = [ - "base64 0.21.7", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "h2", - "http 0.2.12", - "http-body 0.4.6", - "hyper 0.14.32", - "hyper-rustls", - "ipnet", - "js-sys", - "log", - "mime", - "once_cell", - "percent-encoding", - "pin-project-lite", - "rustls 0.21.12", - "rustls-pemfile", - "serde", - "serde_json", - "serde_urlencoded", - "sync_wrapper", - "system-configuration", - "tokio", - "tokio-rustls", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "webpki-roots 0.25.4", - "winreg 0.50.0", -] - [[package]] name = "ring" version = "0.17.14" @@ -2883,18 +2717,6 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "rustls" -version = "0.21.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" -dependencies = [ - "log", - "ring", - "rustls-webpki 0.101.7", - "sct", -] - [[package]] name = "rustls" version = "0.23.26" @@ -2904,19 +2726,20 @@ dependencies = [ "aws-lc-rs", "log", "once_cell", + "ring", "rustls-pki-types", - "rustls-webpki 0.103.1", + "rustls-webpki", "subtle", "zeroize", ] [[package]] name = "rustls-pemfile" -version = "1.0.4" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" dependencies = [ - "base64 0.21.7", + "rustls-pki-types", ] [[package]] @@ -2925,16 +2748,6 @@ version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "917ce264624a4b4db1c364dcc35bfca9ded014d0a958cd47ad3e960e988ea51c" -[[package]] -name = "rustls-webpki" -version = "0.101.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "rustls-webpki" version = "0.103.1" @@ -3002,16 +2815,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" -[[package]] -name = "sct" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "self_cell" version = "1.2.0" @@ -3066,7 +2869,7 @@ checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] @@ -3091,18 +2894,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - [[package]] name = "serde_yaml" version = "0.9.34+deprecated" @@ -3214,16 +3005,6 @@ version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9" -[[package]] -name = "socket2" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f5fd57c80058a56cf5c777ab8a126398ece8e442983605d280a44ce79d0edef" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -3313,21 +3094,15 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.100" +version = "2.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" +checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] -[[package]] -name = "sync_wrapper" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" - [[package]] name = "synstructure" version = "0.13.1" @@ -3336,28 +3111,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", -] - -[[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", + "syn 2.0.101", ] [[package]] @@ -3399,7 +3153,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] @@ -3410,7 +3164,7 @@ checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] @@ -3509,56 +3263,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6b88822cbe49de4185e3a4cbf8321dd487cf5fe0c5c65695fef6346371e9c48" dependencies = [ "backtrace", - "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.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.100", -] - -[[package]] -name = "tokio-rustls" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" -dependencies = [ - "rustls 0.21.12", - "tokio", -] - -[[package]] -name = "tokio-util" -version = "0.7.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66a539a9ad6d5d281510d5bd368c973d636c02dbf8a67300bfb6b950696ad7df" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", ] [[package]] name = "toml" -version = "0.8.20" +version = "0.8.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd87a5cdd6ffab733b2f74bc4fd7ee5fff6634124999ac278c35fc78c6120148" +checksum = "05ae329d1f08c4d17a59bed7ff5b5a769d062e64a62d34a3261b219e62cd5aae" dependencies = [ "indexmap", "serde", @@ -3569,31 +3281,32 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.8" +version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +checksum = "3da5db5a963e24bc68be8b17b6fa82814bb22ee8660f192bb182771d498f09a3" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.22.24" +version = "0.22.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474" +checksum = "310068873db2c5b3e7659d2cc35d21855dbafa50d1ce336397c666e3cb08137e" dependencies = [ "indexmap", "serde", "serde_spanned", "toml_datetime", + "toml_write", "winnow", ] [[package]] -name = "tower-service" -version = "0.3.3" +name = "toml_write" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" +checksum = "bfb942dfe1d8e29a7ee7fcbde5bd2b9a25fb89aa70caea2eba3bee836ff41076" [[package]] name = "tracing" @@ -3614,7 +3327,7 @@ checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] @@ -3685,7 +3398,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69fff37da548239c3bf9e64a12193d261e8b22b660991c6fd2df057c168f435f" dependencies = [ "cc", - "windows-targets 0.52.6", + "windows-targets", ] [[package]] @@ -3702,7 +3415,7 @@ checksum = "4793cb5e56680ecbb1d843515b23b6de9a75eb04b66643e256a396d43be33c13" dependencies = [ "bytes", "data-encoding", - "http 1.3.1", + "http", "httparse", "log", "rand 0.9.1", @@ -3753,6 +3466,36 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" +[[package]] +name = "ureq" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7a3e9af6113ecd57b8c63d3cd76a385b2e3881365f1f489e54f49801d0c83ea" +dependencies = [ + "base64 0.22.1", + "flate2", + "log", + "percent-encoding", + "rustls", + "rustls-pemfile", + "rustls-pki-types", + "ureq-proto", + "utf-8", + "webpki-roots", +] + +[[package]] +name = "ureq-proto" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fadf18427d33828c311234884b7ba2afb57143e6e7e69fda7ee883b624661e36" +dependencies = [ + "base64 0.22.1", + "http", + "httparse", + "log", +] + [[package]] name = "url" version = "2.5.4" @@ -3881,23 +3624,10 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", "wasm-bindgen-shared", ] -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.50" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61" -dependencies = [ - "cfg-if 1.0.0", - "js-sys", - "once_cell", - "wasm-bindgen", - "web-sys", -] - [[package]] name = "wasm-bindgen-macro" version = "0.2.100" @@ -3916,7 +3646,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3930,16 +3660,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "web-sys" -version = "0.3.77" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - [[package]] name = "webpki" version = "0.22.4" @@ -3952,15 +3672,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.25.4" +version = "0.26.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" - -[[package]] -name = "webpki-roots" -version = "0.26.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2210b291f7ea53617fbafcc4939f10914214ec15aace5ba62293a668f322c5c9" +checksum = "29aad86cec885cafd03e8305fd727c418e970a521322c91688414d5b8efba16b" dependencies = [ "rustls-pki-types", ] @@ -4015,7 +3729,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6" dependencies = [ "windows-core 0.58.0", - "windows-targets 0.52.6", + "windows-targets", ] [[package]] @@ -4028,7 +3742,7 @@ dependencies = [ "windows-interface 0.58.0", "windows-result 0.2.0", "windows-strings 0.1.0", - "windows-targets 0.52.6", + "windows-targets", ] [[package]] @@ -4052,7 +3766,7 @@ checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] @@ -4063,7 +3777,7 @@ checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] @@ -4074,7 +3788,7 @@ checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] @@ -4085,7 +3799,7 @@ checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] @@ -4100,7 +3814,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" dependencies = [ - "windows-targets 0.52.6", + "windows-targets", ] [[package]] @@ -4119,7 +3833,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" dependencies = [ "windows-result 0.2.0", - "windows-targets 0.52.6", + "windows-targets", ] [[package]] @@ -4131,22 +3845,13 @@ dependencies = [ "windows-link", ] -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.5", -] - [[package]] name = "windows-sys" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.6", + "windows-targets", ] [[package]] @@ -4155,22 +3860,7 @@ version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", + "windows-targets", ] [[package]] @@ -4179,46 +3869,28 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", "windows_i686_gnullvm", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -4231,48 +3903,24 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - [[package]] name = "windows_x86_64_msvc" version = "0.52.6" @@ -4306,16 +3954,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "winreg" -version = "0.50.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" -dependencies = [ - "cfg-if 1.0.0", - "windows-sys 0.48.0", -] - [[package]] name = "wit-bindgen-rt" version = "0.39.0" @@ -4372,7 +4010,7 @@ checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", "synstructure", ] @@ -4387,11 +4025,11 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.24" +version = "0.8.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" +checksum = "a1702d9583232ddb9174e01bb7c15a2ab8fb1bc6f227aa1233858c351a3ba0cb" dependencies = [ - "zerocopy-derive 0.8.24", + "zerocopy-derive 0.8.25", ] [[package]] @@ -4402,18 +4040,18 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] name = "zerocopy-derive" -version = "0.8.24" +version = "0.8.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" +checksum = "28a6e20d751156648aa063f3800b706ee209a32c0b4d9f24be3d980b01be55ef" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] @@ -4433,7 +4071,7 @@ checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", "synstructure", ] @@ -4454,7 +4092,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] @@ -4476,7 +4114,7 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.100", + "syn 2.0.101", ] [[package]] diff --git a/crates/lune-std-net/Cargo.toml b/crates/lune-std-net/Cargo.toml index f5ec79d..208029b 100644 --- a/crates/lune-std-net/Cargo.toml +++ b/crates/lune-std-net/Cargo.toml @@ -28,9 +28,9 @@ futures = { version = "0.3", default-features = false, features = ["std"] } futures-lite = "2.6" futures-rustls = "0.26" http-body-util = "0.1" -hyper = { version = "1.6", features = ["http1", "client", "server"] } +hyper = { version = "1.6", default-features = false, features = ["http1", "client", "server"] } pin-project-lite = "0.2" -rustls = "0.23" +rustls = { version = "0.23", default-features = false, features = ["std", "tls12", "ring"] } rustls-pki-types = "1.11" url = "2.5" urlencoding = "2.1" diff --git a/crates/lune/Cargo.toml b/crates/lune/Cargo.toml index ce610a6..c2e07bc 100644 --- a/crates/lune/Cargo.toml +++ b/crates/lune/Cargo.toml @@ -26,7 +26,7 @@ std-luau = ["dep:lune-std", "lune-std/luau"] std-net = ["dep:lune-std", "lune-std/net"] std-process = ["dep:lune-std", "lune-std/process"] std-regex = ["dep:lune-std", "lune-std/regex"] -std-roblox = ["dep:lune-std", "lune-std/roblox", "dep:lune-roblox"] +std-roblox = ["dep:lune-std", "lune-std/roblox"] std-serde = ["dep:lune-std", "lune-std/serde"] std-stdio = ["dep:lune-std", "lune-std/stdio"] std-task = ["dep:lune-std", "lune-std/task"] @@ -57,20 +57,20 @@ anyhow = "1.0" console = "0.15" dialoguer = "0.11" directories = "6.0" -futures-util = "0.3" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" thiserror = "2.0" +async-io = "2.4" +async-fs = "2.1" +blocking = "1.6" +futures-lite = "2.6" +ureq = { version = "3.0", default-features = false, features = ["rustls", "gzip"] } + tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } -tokio = { version = "1", features = ["full"] } -reqwest = { version = "0.11", default-features = false, features = [ - "rustls-tls", -] } lune-std = { optional = true, version = "0.2.0", path = "../lune-std" } -lune-roblox = { optional = true, version = "0.2.0", path = "../lune-roblox" } lune-utils = { version = "0.2.0", path = "../lune-utils" } ### CLI diff --git a/crates/lune/src/cli/build/base_exe.rs b/crates/lune/src/cli/build/base_exe.rs index 086ddbc..5bbdd16 100644 --- a/crates/lune/src/cli/build/base_exe.rs +++ b/crates/lune/src/cli/build/base_exe.rs @@ -3,7 +3,8 @@ use std::{ path::PathBuf, }; -use tokio::{fs, task}; +use async_fs as fs; +use blocking::unblock; use crate::standalone::metadata::CURRENT_EXE; @@ -44,25 +45,30 @@ pub async fn get_or_download_base_executable(target: BuildTarget) -> BuildResult // Try to request to download the zip file from the target url, // making sure transient errors are handled gracefully and // with a different error message than "not found" - let response = reqwest::get(release_url).await?; - if !response.status().is_success() { - if response.status().as_u16() == 404 { + let (res_status, res_body) = unblock(move || { + let mut res = ureq::get(release_url).call()?; + let body = res.body_mut().read_to_vec()?; + Ok::<_, BuildError>((res.status(), body)) + }) + .await?; + + if !res_status.is_success() { + if res_status.as_u16() == 404 { return Err(BuildError::ReleaseTargetNotFound(target)); } - return Err(BuildError::Download( - response.error_for_status().unwrap_err(), - )); + return Err(BuildError::Download(ureq::Error::StatusCode( + res_status.as_u16(), + ))); } - // Receive the full zip file - let zip_bytes = response.bytes().await?.to_vec(); - let zip_file = Cursor::new(zip_bytes); + // Start reading the zip file + let zip_file = Cursor::new(res_body); // Look for and extract the binary file from the zip file // NOTE: We use spawn_blocking here since reading a zip // archive is a somewhat slow / blocking operation let binary_file_name = format!("lune{}", target.exe_suffix()); - let binary_file_handle = task::spawn_blocking(move || { + let binary_file_handle = unblock(move || { let mut archive = zip::ZipArchive::new(zip_file)?; let mut binary = Vec::new(); @@ -73,7 +79,7 @@ pub async fn get_or_download_base_executable(target: BuildTarget) -> BuildResult Ok::<_, BuildError>(binary) }); - let binary_file_contents = binary_file_handle.await??; + let binary_file_contents = binary_file_handle.await?; // Finally, write the extracted binary to the cache if !CACHE_DIR.exists() { diff --git a/crates/lune/src/cli/build/files.rs b/crates/lune/src/cli/build/files.rs index cf1d003..3275db1 100644 --- a/crates/lune/src/cli/build/files.rs +++ b/crates/lune/src/cli/build/files.rs @@ -1,7 +1,8 @@ use std::path::{Path, PathBuf}; use anyhow::Result; -use tokio::{fs, io::AsyncWriteExt}; +use async_fs as fs; +use futures_lite::prelude::*; /** Removes the source file extension from the given path, if it has one. @@ -32,6 +33,7 @@ pub async fn write_executable_file_to( #[cfg(unix)] { + use fs::unix::OpenOptionsExt; options.mode(0o755); // Read & execute for all, write for owner } diff --git a/crates/lune/src/cli/build/mod.rs b/crates/lune/src/cli/build/mod.rs index 6546a16..4e61bb8 100644 --- a/crates/lune/src/cli/build/mod.rs +++ b/crates/lune/src/cli/build/mod.rs @@ -1,9 +1,9 @@ use std::{path::PathBuf, process::ExitCode}; use anyhow::{bail, Context, Result}; +use async_fs as fs; use clap::Parser; use console::style; -use tokio::fs; use crate::standalone::metadata::Metadata; diff --git a/crates/lune/src/cli/build/result.rs b/crates/lune/src/cli/build/result.rs index 04cadbc..346bd72 100644 --- a/crates/lune/src/cli/build/result.rs +++ b/crates/lune/src/cli/build/result.rs @@ -12,11 +12,9 @@ pub enum BuildError { #[error("failed to find lune binary '{0}' in downloaded zip file")] ZippedBinaryNotFound(String), #[error("failed to download lune binary: {0}")] - Download(#[from] reqwest::Error), + Download(#[from] ureq::Error), #[error("failed to unzip lune binary: {0}")] Unzip(#[from] zip::result::ZipError), - #[error("panicked while unzipping lune binary: {0}")] - UnzipJoin(#[from] tokio::task::JoinError), #[error("io error: {0}")] IoError(#[from] std::io::Error), } diff --git a/crates/lune/src/cli/repl.rs b/crates/lune/src/cli/repl.rs index 480142d..454d6e2 100644 --- a/crates/lune/src/cli/repl.rs +++ b/crates/lune/src/cli/repl.rs @@ -1,6 +1,7 @@ use std::{path::PathBuf, process::ExitCode}; use anyhow::{Context, Result}; +use async_fs as fs; use clap::Parser; use directories::UserDirs; use rustyline::{error::ReadlineError, DefaultEditor}; @@ -28,7 +29,7 @@ impl ReplCommand { .home_dir() .join(".lune_history"); if !history_file_path.exists() { - tokio::fs::write(history_file_path, &[]).await?; + fs::write(history_file_path, &[]).await?; } let mut repl = DefaultEditor::new()?; diff --git a/crates/lune/src/cli/run.rs b/crates/lune/src/cli/run.rs index eda8cd6..292d2be 100644 --- a/crates/lune/src/cli/run.rs +++ b/crates/lune/src/cli/run.rs @@ -1,11 +1,10 @@ -use std::{env, process::ExitCode}; +use std::{env, io::stdin, process::ExitCode}; use anyhow::{Context, Result}; +use async_fs::read as read_to_vec; +use blocking::Unblock; use clap::Parser; -use tokio::{ - fs::read as read_to_vec, - io::{stdin, AsyncReadExt as _}, -}; +use futures_lite::prelude::*; use lune::Runtime; @@ -27,7 +26,7 @@ impl RunCommand { // (dash) as the script name to run to the cli let (script_display_name, script_contents) = if &self.script_path == "-" { let mut stdin_contents = Vec::new(); - stdin() + Unblock::new(stdin()) .read_to_end(&mut stdin_contents) .await .context("Failed to read script contents from stdin")?; diff --git a/crates/lune/src/cli/setup.rs b/crates/lune/src/cli/setup.rs index c40b360..78cd2d4 100644 --- a/crates/lune/src/cli/setup.rs +++ b/crates/lune/src/cli/setup.rs @@ -1,11 +1,10 @@ use std::{borrow::BorrowMut, env::current_dir, io::ErrorKind, path::PathBuf, process::ExitCode}; use anyhow::{Context, Result}; +use async_fs as fs; use clap::Parser; use directories::UserDirs; -use futures_util::future::try_join_all; use thiserror::Error; -use tokio::fs; // TODO: Use a library that supports json with comments since VSCode settings may contain comments use serde_json::Value as JsonValue; @@ -157,16 +156,12 @@ async fn generate_typedef_files_from_definitions() -> Result { files_to_write.push((name, path, builtin.typedefs())); } - // Write all dirs and files only when we know generation was successful - let futs_dirs = dirs_to_write - .drain(..) - .map(fs::create_dir_all) - .collect::>(); - let futs_files = files_to_write - .iter() - .map(|(_, path, contents)| fs::write(path, contents)) - .collect::>(); - try_join_all(futs_dirs).await?; - try_join_all(futs_files).await?; + // Write all dirs and files + for dir in dirs_to_write { + fs::create_dir_all(dir).await?; + } + for (_name, path, contents) in files_to_write { + fs::write(path, contents).await?; + } Ok(version_string.to_string()) } diff --git a/crates/lune/src/cli/utils/listing.rs b/crates/lune/src/cli/utils/listing.rs index 70d34fc..0568a0b 100644 --- a/crates/lune/src/cli/utils/listing.rs +++ b/crates/lune/src/cli/utils/listing.rs @@ -1,11 +1,14 @@ #![allow(clippy::match_same_arms)] -use std::{cmp::Ordering, ffi::OsStr, fmt::Write as _, path::PathBuf, sync::LazyLock}; +use std::{ + cmp::Ordering, ffi::OsStr, fmt::Write as _, io::ErrorKind, path::PathBuf, sync::LazyLock, +}; use anyhow::{bail, Result}; +use async_fs as fs; use console::Style; use directories::UserDirs; -use tokio::{fs, io}; +use futures_lite::prelude::*; use super::files::{discover_script_path, parse_lune_description_from_file}; @@ -25,7 +28,7 @@ pub async fn find_lune_scripts(in_home_dir: bool) -> Result { let mut files = Vec::new(); - while let Some(entry) = dir.next_entry().await? { + while let Some(entry) = dir.try_next().await? { let meta = entry.metadata().await?; if meta.is_file() { let contents = fs::read(entry.path()).await?; @@ -77,7 +80,7 @@ pub async fn find_lune_scripts(in_home_dir: bool) -> Result { + Err(e) if matches!(e.kind(), ErrorKind::NotFound) => { bail!("No lune directory was found.") } Err(e) => { diff --git a/crates/lune/src/main.rs b/crates/lune/src/main.rs index 99610f6..8b9dddf 100644 --- a/crates/lune/src/main.rs +++ b/crates/lune/src/main.rs @@ -9,8 +9,7 @@ pub(crate) mod standalone; use lune_utils::fmt::Label; -#[tokio::main(flavor = "multi_thread")] -async fn main() -> ExitCode { +fn main() -> ExitCode { tracing_subscriber::fmt() .compact() .with_env_filter(tracing_subscriber::filter::EnvFilter::from_default_env()) @@ -20,24 +19,26 @@ async fn main() -> ExitCode { .with_writer(stderr) .init(); - if let Some(bin) = standalone::check().await { - return standalone::run(bin).await.unwrap(); - } + async_io::block_on(async { + if let Some(bin) = standalone::check().await { + return standalone::run(bin).await.unwrap(); + } - #[cfg(feature = "cli")] - { - match cli::Cli::new().run().await { - Ok(code) => code, - Err(err) => { - eprintln!("{}\n{err:?}", Label::Error); - ExitCode::FAILURE + #[cfg(feature = "cli")] + { + match cli::Cli::new().run().await { + Ok(code) => code, + Err(err) => { + eprintln!("{}\n{err:?}", Label::Error); + ExitCode::FAILURE + } } } - } - #[cfg(not(feature = "cli"))] - { - eprintln!("{}\nCLI feature is disabled", Label::Error); - ExitCode::FAILURE - } + #[cfg(not(feature = "cli"))] + { + eprintln!("{}\nCLI feature is disabled", Label::Error); + ExitCode::FAILURE + } + }) } diff --git a/crates/lune/src/standalone/metadata.rs b/crates/lune/src/standalone/metadata.rs index 0fe14fa..603fc75 100644 --- a/crates/lune/src/standalone/metadata.rs +++ b/crates/lune/src/standalone/metadata.rs @@ -1,8 +1,8 @@ use std::{env, path::PathBuf, sync::LazyLock}; use anyhow::{bail, Result}; +use async_fs as fs; use mlua::Compiler as LuaCompiler; -use tokio::fs; pub static CURRENT_EXE: LazyLock = LazyLock::new(|| env::current_exe().expect("failed to get current exe")); diff --git a/crates/lune/src/tests.rs b/crates/lune/src/tests.rs index cadca69..bda0f38 100644 --- a/crates/lune/src/tests.rs +++ b/crates/lune/src/tests.rs @@ -3,9 +3,9 @@ use std::path::PathBuf; use std::process::ExitCode; use anyhow::Result; +use async_fs::read_to_string; use console::set_colors_enabled; use console::set_colors_enabled_stderr; -use tokio::fs::read_to_string; use lune_utils::path::clean_path_and_make_absolute; @@ -15,37 +15,39 @@ const ARGS: &[&str] = &["Foo", "Bar"]; macro_rules! create_tests { ($($name:ident: $value:expr,)*) => { $( - #[tokio::test(flavor = "multi_thread")] - async fn $name() -> Result { - // We need to change the current directory to the workspace root since - // we are in a sub-crate and tests would run relative to the sub-crate - let workspace_dir_str = format!("{}/../../", env!("CARGO_MANIFEST_DIR")); - let workspace_dir = clean_path_and_make_absolute(PathBuf::from(workspace_dir_str)); - set_current_dir(&workspace_dir)?; + #[test] + fn $name() -> Result { + async_io::block_on(async { + // We need to change the current directory to the workspace root since + // we are in a sub-crate and tests would run relative to the sub-crate + let workspace_dir_str = format!("{}/../../", env!("CARGO_MANIFEST_DIR")); + let workspace_dir = clean_path_and_make_absolute(PathBuf::from(workspace_dir_str)); + set_current_dir(&workspace_dir)?; - // Disable styling for stdout and stderr since - // some tests rely on output not being styled - set_colors_enabled(false); - set_colors_enabled_stderr(false); + // Disable styling for stdout and stderr since + // some tests rely on output not being styled + set_colors_enabled(false); + set_colors_enabled_stderr(false); - // The rest of the test logic can continue as normal - let full_name = format!("{}/tests/{}.luau", workspace_dir.display(), $value); - let script = read_to_string(&full_name).await?; - let mut lune = Runtime::new()? - .with_jit(true) - .with_args( - ARGS - .clone() - .iter() - .map(ToString::to_string) - .collect::>() - ); - let script_name = full_name - .trim_end_matches(".luau") - .trim_end_matches(".lua") - .to_string(); - let script_values = lune.run(&script_name, &script).await?; - Ok(ExitCode::from(script_values.status())) + // The rest of the test logic can continue as normal + let full_name = format!("{}/tests/{}.luau", workspace_dir.display(), $value); + let script = read_to_string(&full_name).await?; + let mut lune = Runtime::new()? + .with_jit(true) + .with_args( + ARGS + .clone() + .iter() + .map(ToString::to_string) + .collect::>() + ); + let script_name = full_name + .trim_end_matches(".luau") + .trim_end_matches(".lua") + .to_string(); + let script_values = lune.run(&script_name, &script).await?; + Ok(ExitCode::from(script_values.status())) + }) } )* } }