From a007fa94a65adfdf57ff10049906902ea9505c80 Mon Sep 17 00:00:00 2001 From: Kenneth Loeffler Date: Thu, 22 Aug 2024 12:24:32 -0700 Subject: [PATCH 01/12] Update all rbx-dom dependencies to their latest versions (#245) --- Cargo.lock | 24 ++++++++++++------------ crates/lune-roblox/Cargo.toml | 10 +++++----- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 734320a..e981098 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2227,9 +2227,9 @@ dependencies = [ [[package]] name = "rbx_binary" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49ee5134b59834b17940d20dd2e057b6fe6902c1e566900e83106c50503b970e" +checksum = "7b85057e8ff75a1ce99248200c4b3c7b481a3d52f921f1053ecd67921dcc7930" dependencies = [ "log", "lz4", @@ -2257,9 +2257,9 @@ dependencies = [ [[package]] name = "rbx_dom_weak" -version = "2.8.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34d35df0f09290d32976f655366342676a6645b87c39b6949473b9d28a969733" +checksum = "fcd2a17d09e46af0805f8b311a926402172b97e8d9388745c9adf8f448901841" dependencies = [ "rbx_types", "serde", @@ -2267,9 +2267,9 @@ dependencies = [ [[package]] name = "rbx_reflection" -version = "4.6.0" +version = "4.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04ca5496737668378b17bacc9090ad361fc9c8b5f346bbd33162e083c98fa248" +checksum = "8118ac6021d700e8debe324af6b40ecfd2cef270a00247849dbdfeebb0802677" dependencies = [ "rbx_types", "serde", @@ -2278,9 +2278,9 @@ dependencies = [ [[package]] name = "rbx_reflection_database" -version = "0.2.11+roblox-634" +version = "0.2.12+roblox-638" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "399ab2e1fa27c8428fe43fc4148d8085d187881f1c59cefea3711a2112e9cccc" +checksum = "0e29381d675420e841f8c02db5755cbb2545ed3e13f56c539546dc58702b512a" dependencies = [ "lazy_static", "rbx_reflection", @@ -2290,9 +2290,9 @@ dependencies = [ [[package]] name = "rbx_types" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ed7bbc0e1864143546b12ee0cf64a1a6f447d8ce7baf4fae755e4581929d230" +checksum = "e30f49b2a3bb667e4074ba73c2dfb8ca0873f610b448ccf318a240acfdec6c73" dependencies = [ "base64 0.13.1", "bitflags 1.3.2", @@ -2305,9 +2305,9 @@ dependencies = [ [[package]] name = "rbx_xml" -version = "0.13.4" +version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c2abac6e71c97a56243f00c9c2def504fe4b698019d854dd8720da700a80d7c" +checksum = "2b14b3027bc9ccd82e2fc854c8bcd25ed58318e570c355bf2cf63df9cdbd5ba8" dependencies = [ "base64 0.13.1", "log", diff --git a/crates/lune-roblox/Cargo.toml b/crates/lune-roblox/Cargo.toml index 6950354..cdf6c7b 100644 --- a/crates/lune-roblox/Cargo.toml +++ b/crates/lune-roblox/Cargo.toml @@ -20,10 +20,10 @@ rand = "0.8" thiserror = "1.0" once_cell = "1.17" -rbx_binary = "0.7.3" -rbx_dom_weak = "2.6.0" -rbx_reflection = "4.4.0" -rbx_reflection_database = "0.2.9" -rbx_xml = "0.13.2" +rbx_binary = "0.7.7" +rbx_dom_weak = "2.9.0" +rbx_reflection = "4.7.0" +rbx_reflection_database = "0.2.12" +rbx_xml = "0.13.5" lune-utils = { version = "0.1.3", path = "../lune-utils" } From ff83c401b8cc915ec2e2e5dbfd29a39303f7a575 Mon Sep 17 00:00:00 2001 From: Filip Tibell Date: Thu, 22 Aug 2024 21:30:36 +0200 Subject: [PATCH 02/12] Version 0.8.8 --- CHANGELOG.md | 8 ++++++++ Cargo.lock | 8 ++++---- crates/lune-roblox/Cargo.toml | 2 +- crates/lune-std-roblox/Cargo.toml | 4 ++-- crates/lune-std/Cargo.toml | 4 ++-- crates/lune/Cargo.toml | 6 +++--- 6 files changed, 20 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5756bb0..5425834 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## `0.8.8` - August 22nd, 2024 + +### Fixed + +- Fixed errors when deserializing `Lighting.AttributesSerialize` by updating `rbx-dom` dependencies ([#245]) + +[#245]: https://github.com/lune-org/lune/pull/245 + ## `0.8.7` - August 10th, 2024 ### Added diff --git a/Cargo.lock b/Cargo.lock index e981098..59d32a9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1508,7 +1508,7 @@ dependencies = [ [[package]] name = "lune" -version = "0.8.7" +version = "0.8.8" dependencies = [ "anyhow", "clap", @@ -1537,7 +1537,7 @@ dependencies = [ [[package]] name = "lune-roblox" -version = "0.1.3" +version = "0.1.4" dependencies = [ "glam", "lune-utils", @@ -1554,7 +1554,7 @@ dependencies = [ [[package]] name = "lune-std" -version = "0.1.4" +version = "0.1.5" dependencies = [ "lune-std-datetime", "lune-std-fs", @@ -1650,7 +1650,7 @@ dependencies = [ [[package]] name = "lune-std-roblox" -version = "0.1.3" +version = "0.1.4" dependencies = [ "lune-roblox", "lune-utils", diff --git a/crates/lune-roblox/Cargo.toml b/crates/lune-roblox/Cargo.toml index cdf6c7b..73ca05a 100644 --- a/crates/lune-roblox/Cargo.toml +++ b/crates/lune-roblox/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lune-roblox" -version = "0.1.3" +version = "0.1.4" edition = "2021" license = "MPL-2.0" repository = "https://github.com/lune-org/lune" diff --git a/crates/lune-std-roblox/Cargo.toml b/crates/lune-std-roblox/Cargo.toml index 6282f72..599a768 100644 --- a/crates/lune-std-roblox/Cargo.toml +++ b/crates/lune-std-roblox/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lune-std-roblox" -version = "0.1.3" +version = "0.1.4" edition = "2021" license = "MPL-2.0" repository = "https://github.com/lune-org/lune" @@ -20,4 +20,4 @@ once_cell = "1.17" rbx_cookie = { version = "0.1.4", default-features = false } lune-utils = { version = "0.1.3", path = "../lune-utils" } -lune-roblox = { version = "0.1.3", path = "../lune-roblox" } +lune-roblox = { version = "0.1.4", path = "../lune-roblox" } diff --git a/crates/lune-std/Cargo.toml b/crates/lune-std/Cargo.toml index 132338f..07762b6 100644 --- a/crates/lune-std/Cargo.toml +++ b/crates/lune-std/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lune-std" -version = "0.1.4" +version = "0.1.5" edition = "2021" license = "MPL-2.0" repository = "https://github.com/lune-org/lune" @@ -53,7 +53,7 @@ lune-std-luau = { optional = true, version = "0.1.2", path = "../lune-std-luau" lune-std-net = { optional = true, version = "0.1.2", path = "../lune-std-net" } lune-std-process = { optional = true, version = "0.1.3", path = "../lune-std-process" } lune-std-regex = { optional = true, version = "0.1.2", path = "../lune-std-regex" } -lune-std-roblox = { optional = true, version = "0.1.3", path = "../lune-std-roblox" } +lune-std-roblox = { optional = true, version = "0.1.4", path = "../lune-std-roblox" } lune-std-serde = { optional = true, version = "0.1.2", path = "../lune-std-serde" } lune-std-stdio = { optional = true, version = "0.1.2", path = "../lune-std-stdio" } lune-std-task = { optional = true, version = "0.1.2", path = "../lune-std-task" } diff --git a/crates/lune/Cargo.toml b/crates/lune/Cargo.toml index c784669..564dfc3 100644 --- a/crates/lune/Cargo.toml +++ b/crates/lune/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lune" -version = "0.8.7" +version = "0.8.8" edition = "2021" license = "MPL-2.0" repository = "https://github.com/lune-org/lune" @@ -71,8 +71,8 @@ reqwest = { version = "0.11", default-features = false, features = [ "rustls-tls", ] } -lune-std = { optional = true, version = "0.1.4", path = "../lune-std" } -lune-roblox = { optional = true, version = "0.1.3", path = "../lune-roblox" } +lune-std = { optional = true, version = "0.1.5", path = "../lune-std" } +lune-roblox = { optional = true, version = "0.1.4", path = "../lune-roblox" } lune-utils = { version = "0.1.3", path = "../lune-utils" } ### CLI From c17da7281513cab7f4ff2454281c895a9b0737b7 Mon Sep 17 00:00:00 2001 From: Filip Tibell Date: Mon, 7 Oct 2024 19:33:59 +0200 Subject: [PATCH 03/12] Update dependencies --- CHANGELOG.md | 6 + Cargo.lock | 523 ++++++++++++++++++++++++--------------------------- 2 files changed, 250 insertions(+), 279 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5425834..002b810 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Changed + +- Updated to Luau version `0.640` + ## `0.8.8` - August 22nd, 2024 ### Fixed diff --git a/Cargo.lock b/Cargo.lock index 59d32a9..86045a8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,18 +4,18 @@ version = 3 [[package]] name = "addr2line" -version = "0.22.0" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ "gimli", ] [[package]] -name = "adler" -version = "1.0.2" +name = "adler2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" [[package]] name = "aes" @@ -118,9 +118,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" [[package]] name = "arbitrary" @@ -133,9 +133,9 @@ dependencies = [ [[package]] name = "arrayref" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d151e35f61089500b617991b791fc8bfd237ae50cd5950803758a179b41e67a" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" [[package]] name = "arrayvec" @@ -145,9 +145,9 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "async-channel" @@ -163,9 +163,9 @@ dependencies = [ [[package]] name = "async-compression" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fec134f64e2bc57411226dfc4e52dec859ddfc7e711fc5e07b612584f000e4aa" +checksum = "7e614738943d3f68c628ae3dbce7c3daffb196665f82f8c8ea6b65de73c79429" dependencies = [ "brotli", "flate2", @@ -177,9 +177,9 @@ dependencies = [ [[package]] name = "async-executor" -version = "1.13.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7ebdfa2ebdab6b1760375fa7d6f382b9f486eac35fc994625a00e89280bdbb7" +checksum = "30ca9a001c1e8ba5149f91a74362376cc6bc5b919d92d988668657bd570bdcec" dependencies = [ "async-task", "concurrent-queue", @@ -201,9 +201,9 @@ dependencies = [ [[package]] name = "async-io" -version = "2.3.3" +version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d6baa8f0178795da0e71bc42c9e5d13261aac7ee549853162e66a241ba17964" +checksum = "444b0228950ee6501b3568d3c93bf1176a1fdbc3b758dcd9475046d30f4dc7e8" dependencies = [ "async-lock", "cfg-if", @@ -215,7 +215,7 @@ dependencies = [ "rustix", "slab", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -243,23 +243,23 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "backtrace" -version = "0.3.73" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ "addr2line", - "cc", "cfg-if", "libc", "miniz_oxide", "object", "rustc-demangle", + "windows-targets 0.52.6", ] [[package]] @@ -316,10 +316,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0231f06152bf547e9c2b5194f247cd97aacf6dcd8b15d8e5ec0663f64580da87" dependencies = [ "arrayref", - "arrayvec 0.7.4", + "arrayvec 0.7.6", "cc", "cfg-if", - "constant_time_eq 0.3.0", + "constant_time_eq 0.3.1", "digest", ] @@ -347,9 +347,9 @@ dependencies = [ [[package]] name = "brotli" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74f7971dbd9326d58187408ab83117d8ac1bb9c17b085fdacd1cf2f598719b6b" +checksum = "cc97b8f16f944bba54f0433f07e30be199b6dc2bd25937444bbad560bcea29bd" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -373,7 +373,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c" dependencies = [ "memchr", - "regex-automata 0.4.7", + "regex-automata 0.4.8", "serde", ] @@ -397,9 +397,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.7.1" +version = "1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" +checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" [[package]] name = "bzip2" @@ -424,12 +424,13 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.8" +version = "1.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "504bdec147f2cc13c8b57ed9401fd8a147cc66b67ad5cb241394244f2c947549" +checksum = "2e80e3b6a3ab07840e1cae9b0666a63970dc28e8ed5ffbcdacbfc760c281bfc1" dependencies = [ "jobserver", "libc", + "shlex", ] [[package]] @@ -485,9 +486,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.15" +version = "4.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d8838454fda655dafd3accb2b6e2bea645b9e4078abe84a22ceb947235c5cc" +checksum = "7be5744db7978a28d9df86a214130d106a89ce49644cbc4e3f0c22c3fba30615" dependencies = [ "clap_builder", "clap_derive", @@ -495,9 +496,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.15" +version = "4.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6" +checksum = "a5fbc17d3ef8278f55b282b2a2e75ae6f6c7d4bb70ed3d0382375104bfafdb4b" dependencies = [ "anstream", "anstyle", @@ -507,14 +508,14 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.13" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" +checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.79", ] [[package]] @@ -534,9 +535,9 @@ dependencies = [ [[package]] name = "cmake" -version = "0.1.50" +version = "0.1.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31c789563b815f77f4250caee12365734369f942439b7defd71e18a48197130" +checksum = "fb1e43aa7fd152b1f968787f7dbcdeb306d1867ff373c69955211876c053f91a" dependencies = [ "cc", ] @@ -583,9 +584,9 @@ checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] name = "constant_time_eq" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" +checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" [[package]] name = "convert_case" @@ -615,15 +616,15 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.12" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" dependencies = [ "libc", ] @@ -697,7 +698,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.79", ] [[package]] @@ -709,8 +710,8 @@ dependencies = [ "convert_case", "proc-macro2", "quote", - "rustc_version 0.4.0", - "syn 2.0.72", + "rustc_version 0.4.1", + "syn 2.0.79", ] [[package]] @@ -765,7 +766,7 @@ checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" dependencies = [ "libc", "option-ext", - "redox_users 0.4.5", + "redox_users 0.4.6", "windows-sys 0.48.0", ] @@ -783,7 +784,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.79", ] [[package]] @@ -841,9 +842,9 @@ dependencies = [ [[package]] name = "error-code" -version = "3.2.0" +version = "3.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0474425d51df81997e2f90a21591180b38eccf27292d755f3e30750225c175b" +checksum = "a5d9305ccc6942a704f4335694ecd3de2ea531b114ac2d51f5f843750787a92f" [[package]] name = "event-listener" @@ -879,9 +880,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" +checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" [[package]] name = "fd-lock" @@ -896,9 +897,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.31" +version = "1.0.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f211bbe8e69bbd0cfdea405084f128ae8b4aaa6b0b522fc8f2b009084797920" +checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0" dependencies = [ "crc32fast", "libz-ng-sys", @@ -922,24 +923,24 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", ] [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-io" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-lite" @@ -956,32 +957,32 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.79", ] [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-core", "futures-macro", @@ -994,9 +995,9 @@ dependencies = [ [[package]] name = "generator" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "979f00864edc7516466d6b3157706e06c032f22715700ddd878228a91d02bc56" +checksum = "dbb949699c3e4df3a183b1d2142cb24277057055ed23c68ed58894f76c517223" dependencies = [ "cfg-if", "libc", @@ -1039,9 +1040,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.29.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "glam" @@ -1076,9 +1077,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab" +checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" dependencies = [ "atomic-waker", "bytes", @@ -1095,9 +1096,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.14.5" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" [[package]] name = "heck" @@ -1193,9 +1194,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.9.4" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" +checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" [[package]] name = "httpdate" @@ -1236,7 +1237,7 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "h2 0.4.5", + "h2 0.4.6", "http 1.1.0", "http-body 1.0.1", "httparse", @@ -1279,9 +1280,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.7" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde7055719c54e36e95e8719f95883f22072a48ede39db7fc17a4e1d5281e9b9" +checksum = "41296eb09f183ac68eec06e03cdbea2e759633d4067b2f6552fc2e009bcad08b" dependencies = [ "bytes", "futures-channel", @@ -1292,16 +1293,15 @@ dependencies = [ "pin-project-lite", "socket2", "tokio", - "tower", "tower-service", "tracing", ] [[package]] name = "iana-time-zone" -version = "0.1.60" +version = "0.1.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -1352,9 +1352,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.3.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3fc2e30ba82dd1b3911c8de1ffc143c74a914a14e99514d7637e3099df5ea0" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", "hashbrown", @@ -1371,9 +1371,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.9.0" +version = "2.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" [[package]] name = "is_terminal_polyfill" @@ -1398,9 +1398,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.69" +version = "0.3.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" dependencies = [ "wasm-bindgen", ] @@ -1422,9 +1422,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.155" +version = "0.2.159" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" [[package]] name = "libloading" @@ -1448,9 +1448,9 @@ dependencies = [ [[package]] name = "libz-ng-sys" -version = "1.1.15" +version = "1.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6409efc61b12687963e602df8ecf70e8ddacf95bc6576bcf16e3ac6328083c5" +checksum = "4436751a01da56f1277f323c80d584ffad94a3d14aecd959dd0dff75aa73a438" dependencies = [ "cmake", "libc", @@ -1499,9 +1499,9 @@ dependencies = [ [[package]] name = "luau0-src" -version = "0.10.2+luau635" +version = "0.10.3+luau640" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8bd6bc70c84fdd4e89b71b528f7ab7db7b97adf759faa8dbe15c5011468e290" +checksum = "2f39d12b514a676c943990cfbe6200fedcb9c293c8c9219d29be512a6969be92" dependencies = [ "cc", ] @@ -1719,19 +1719,18 @@ dependencies = [ [[package]] name = "lz4" -version = "1.26.0" +version = "1.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "958b4caa893816eea05507c20cfe47574a43d9a697138a7872990bba8a0ece68" +checksum = "4d1febb2b4a79ddd1980eede06a8f7902197960aa0383ffcfdd62fe723036725" dependencies = [ - "libc", "lz4-sys", ] [[package]] name = "lz4-sys" -version = "1.10.0" +version = "1.11.1+lz4-1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "109de74d5d2353660401699a4174a4ff23fcc649caf553df71933c7fb45ad868" +checksum = "6bd8c0d6c6ed0cd30b3652886bb8711dc4bb01d637a68105a3d5158039b418e6" dependencies = [ "cc", "libc", @@ -1780,18 +1779,18 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "miniz_oxide" -version = "0.7.4" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" dependencies = [ - "adler", + "adler2", ] [[package]] name = "mio" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4569e456d394deccd22ce1c1913e6ea0e54519f577285001215d33557431afe4" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" dependencies = [ "hermit-abi 0.3.9", "libc", @@ -1838,9 +1837,9 @@ dependencies = [ [[package]] name = "mlua-sys" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab7a5b4756b8177a2dfa8e0bbcde63bd4000afbc4ab20cbb68d114a25470f29" +checksum = "ebe026d6bd1583a9cf9080e189030ddaea7e6f5f0deb366a8e26f8a26c4135b8" dependencies = [ "cc", "cfg-if", @@ -1921,23 +1920,23 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.79", ] [[package]] name = "object" -version = "0.36.3" +version = "0.36.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9" +checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "option-ext" @@ -1971,9 +1970,9 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "parking" -version = "2.2.0" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" [[package]] name = "parking_lot" @@ -1993,7 +1992,7 @@ checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.5.3", + "redox_syscall 0.5.7", "smallvec", "windows-targets 0.52.6", ] @@ -2034,22 +2033,22 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pin-project" -version = "1.1.5" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +checksum = "baf123a161dde1e524adf36f90bc5d8d3462824a9c43553ad07a8183161189ec" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.5" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +checksum = "a4502d8515ca9f32f1fb543d987f63d95a14934883db45bdb48060b6b69257f8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.79", ] [[package]] @@ -2066,9 +2065,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "piper" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae1d5c74c9876f070d3e8fd503d748c7d974c3e48da8f41350fa5222ef9b4391" +checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066" dependencies = [ "atomic-waker", "fastrand", @@ -2077,9 +2076,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "plist" @@ -2096,9 +2095,9 @@ dependencies = [ [[package]] name = "polling" -version = "3.7.2" +version = "3.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3ed00ed3fbf728b5816498ecd316d1716eecaced9c0c8d2c5a6740ca214985b" +checksum = "cc2790cd301dec6cd3b7a025e4815cf825724a51c98dccfe6a3e55f05ffb6511" dependencies = [ "cfg-if", "concurrent-queue", @@ -2106,7 +2105,7 @@ dependencies = [ "pin-project-lite", "rustix", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -2126,11 +2125,11 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "3.1.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" +checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" dependencies = [ - "toml_edit 0.21.1", + "toml_edit", ] [[package]] @@ -2141,9 +2140,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a" dependencies = [ "unicode-ident", ] @@ -2164,7 +2163,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8021cf59c8ec9c432cfc2526ac6b8aa508ecaf29cd415f271b8406c1b851c3fd" dependencies = [ "quote", - "syn 2.0.72", + "syn 2.0.79", ] [[package]] @@ -2178,9 +2177,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -2325,9 +2324,9 @@ checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" [[package]] name = "redox_syscall" -version = "0.5.3" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" +checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" dependencies = [ "bitflags 2.6.0", ] @@ -2345,9 +2344,9 @@ dependencies = [ [[package]] name = "redox_users" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ "getrandom 0.2.15", "libredox", @@ -2356,14 +2355,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.6" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.7", - "regex-syntax 0.8.4", + "regex-automata 0.4.8", + "regex-syntax 0.8.5", ] [[package]] @@ -2377,13 +2376,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.4", + "regex-syntax 0.8.5", ] [[package]] @@ -2394,9 +2393,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "reqwest" @@ -2517,18 +2516,18 @@ dependencies = [ [[package]] name = "rustc_version" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ "semver 1.0.23", ] [[package]] name = "rustix" -version = "0.38.34" +version = "0.38.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" dependencies = [ "bitflags 2.6.0", "errno", @@ -2558,7 +2557,7 @@ dependencies = [ "log", "ring", "rustls-pki-types", - "rustls-webpki 0.102.6", + "rustls-webpki 0.102.8", "subtle", "zeroize", ] @@ -2574,9 +2573,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" +checksum = "0e696e35370c65c9c541198af4543ccd580cf17fc25d8e05c5a242b202488c55" [[package]] name = "rustls-webpki" @@ -2590,9 +2589,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.102.6" +version = "0.102.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e6b52d4fda176fd835fdc55a835d4a89b8499cad995885a21149d5ad62f852e" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" dependencies = [ "ring", "rustls-pki-types", @@ -2693,9 +2692,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.205" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33aedb1a7135da52b7c21791455563facbbcc43d0f0f66165b42c21b3dfb150" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" dependencies = [ "serde_derive", ] @@ -2712,20 +2711,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.205" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "692d6f5ac90220161d6774db30c662202721e64aed9058d2c394f451261420c1" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.79", ] [[package]] name = "serde_json" -version = "1.0.122" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784b6203951c57ff748476b126ccb5e8e2959a5c19e5c617ab1956be3dbc68da" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" dependencies = [ "indexmap", "itoa", @@ -2736,9 +2735,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.7" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" dependencies = [ "serde", ] @@ -2830,6 +2829,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "signal-hook-registry" version = "1.4.2" @@ -2959,9 +2964,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.72" +version = "2.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" +checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" dependencies = [ "proc-macro2", "quote", @@ -2997,9 +3002,9 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.12.0" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" +checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" dependencies = [ "cfg-if", "fastrand", @@ -3010,22 +3015,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.79", ] [[package]] @@ -3124,9 +3129,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.39.2" +version = "1.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daa4fb1bc778bd6f04cbfc4bb2d06a7396a8f299dc33ea1900cedaa316f467b1" +checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" dependencies = [ "backtrace", "bytes", @@ -3148,7 +3153,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.79", ] [[package]] @@ -3185,14 +3190,14 @@ dependencies = [ "tokio", "tokio-rustls 0.25.0", "tungstenite", - "webpki-roots 0.26.3", + "webpki-roots 0.26.6", ] [[package]] name = "tokio-util" -version = "0.7.11" +version = "0.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" +checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" dependencies = [ "bytes", "futures-core", @@ -3211,7 +3216,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.20", + "toml_edit", ] [[package]] @@ -3225,54 +3230,22 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.21.1" +version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" -dependencies = [ - "indexmap", - "toml_datetime", - "winnow 0.5.40", -] - -[[package]] -name = "toml_edit" -version = "0.22.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ "indexmap", "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.18", + "winnow", ] -[[package]] -name = "tower" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" -dependencies = [ - "futures-core", - "futures-util", - "pin-project", - "pin-project-lite", - "tokio", - "tower-layer", - "tower-service", -] - -[[package]] -name = "tower-layer" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" - [[package]] name = "tower-service" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" @@ -3293,7 +3266,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.79", ] [[package]] @@ -3337,9 +3310,9 @@ dependencies = [ [[package]] name = "tracing-tracy" -version = "0.11.1" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9be7f8874d6438e4263f9874c84eded5095bda795d9c7da6ea0192e1750d3ffe" +checksum = "dc775fdaf33c3dfd19dc354729e65e87914bc67dcdc390ca1210807b8bee5902" dependencies = [ "tracing-core", "tracing-subscriber", @@ -3348,9 +3321,9 @@ dependencies = [ [[package]] name = "tracy-client" -version = "0.17.1" +version = "0.17.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63de1e1d4115534008d8fd5788b39324d6f58fc707849090533828619351d855" +checksum = "746b078c6a09ebfd5594609049e07116735c304671eaab06ce749854d23435bc" dependencies = [ "loom", "once_cell", @@ -3359,9 +3332,9 @@ dependencies = [ [[package]] name = "tracy-client-sys" -version = "0.23.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98b98232a2447ce0a58f9a0bfb5f5e39647b5c597c994b63945fcccd1306fafb" +checksum = "68613466112302fdbeabc5fa55f7d57462a0b247d5a6b7d7e09401fb471a144d" dependencies = [ "cc", ] @@ -3395,9 +3368,9 @@ dependencies = [ [[package]] name = "typeid" -version = "1.0.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "059d83cc991e7a42fc37bd50941885db0888e34209f8cfd9aab07ddec03bc9cf" +checksum = "0e13db2e0ccd5e14a544e8a246ba2312cd25223f616442d7f2cb0e3db614236e" [[package]] name = "typenum" @@ -3407,36 +3380,36 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicode-bidi" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" +checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unicode-normalization" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" dependencies = [ "tinyvec", ] [[package]] name = "unicode-segmentation" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" [[package]] name = "unicode-width" -version = "0.1.13" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" [[package]] name = "unsafe-libyaml" @@ -3524,34 +3497,35 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" dependencies = [ "cfg-if", + "once_cell", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.79", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.42" +version = "0.4.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" +checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" dependencies = [ "cfg-if", "js-sys", @@ -3561,9 +3535,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3571,28 +3545,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.79", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" [[package]] name = "web-sys" -version = "0.3.69" +version = "0.3.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" dependencies = [ "js-sys", "wasm-bindgen", @@ -3606,9 +3580,9 @@ checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" [[package]] name = "webpki-roots" -version = "0.26.3" +version = "0.26.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd7c23921eeb1713a4e851530e9b9756e4fb0e89978582942612524cf09f01cd" +checksum = "841c67bff177718f1d4dfefde8d8f0e78f9b6589319ba88312f567fc5841a958" dependencies = [ "rustls-pki-types", ] @@ -3684,7 +3658,7 @@ checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.79", ] [[package]] @@ -3695,7 +3669,7 @@ checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.79", ] [[package]] @@ -3867,18 +3841,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.5.40" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" -dependencies = [ - "memchr", -] - -[[package]] -name = "winnow" -version = "0.6.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" dependencies = [ "memchr", ] @@ -3904,9 +3869,9 @@ dependencies = [ [[package]] name = "xml-rs" -version = "0.8.21" +version = "0.8.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "539a77ee7c0de333dcc6da69b177380a0b81e0dacfa4f7344c465a36871ee601" +checksum = "af4e2e2f7cba5a093896c1e150fbfe177d1883e7448200efb81d40b9d339ef26" [[package]] name = "zerocopy" @@ -3926,7 +3891,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.79", ] [[package]] @@ -3944,7 +3909,7 @@ dependencies = [ "aes", "arbitrary", "bzip2", - "constant_time_eq 0.3.0", + "constant_time_eq 0.3.1", "crc32fast", "crossbeam-utils", "deflate64", From 010cd36375b467c85292ec87c922ee5806d79581 Mon Sep 17 00:00:00 2001 From: Filip Tibell Date: Mon, 7 Oct 2024 19:34:55 +0200 Subject: [PATCH 04/12] Version 0.8.9 --- CHANGELOG.md | 2 +- Cargo.lock | 2 +- crates/lune/Cargo.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 002b810..92a9188 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## Unreleased +## `0.8.9` - October 7th, 2024 ### Changed diff --git a/Cargo.lock b/Cargo.lock index 86045a8..6ba3d92 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1508,7 +1508,7 @@ dependencies = [ [[package]] name = "lune" -version = "0.8.8" +version = "0.8.9" dependencies = [ "anyhow", "clap", diff --git a/crates/lune/Cargo.toml b/crates/lune/Cargo.toml index 564dfc3..426782f 100644 --- a/crates/lune/Cargo.toml +++ b/crates/lune/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lune" -version = "0.8.8" +version = "0.8.9" edition = "2021" license = "MPL-2.0" repository = "https://github.com/lune-org/lune" From 0f4cac29aa3ccbd1d7c2028f065d55b610897eeb Mon Sep 17 00:00:00 2001 From: howmanysmall <26746527+howmanysmall@users.noreply.github.com> Date: Wed, 16 Oct 2024 13:03:00 -0600 Subject: [PATCH 05/12] Fix Regex types (#250) --- types/regex.luau | 99 ++++++++++++++++++++++++++++-------------------- 1 file changed, 57 insertions(+), 42 deletions(-) diff --git a/types/regex.luau b/types/regex.luau index 59756f3..068b8dd 100644 --- a/types/regex.luau +++ b/types/regex.luau @@ -19,67 +19,82 @@ local RegexMatch = { type RegexMatch = typeof(RegexMatch) +local RegexCaptures = {} + +function RegexCaptures.get(self: RegexCaptures, index: number): RegexMatch? + return nil :: any +end + +function RegexCaptures.group(self: RegexCaptures, group: string): RegexMatch? + return nil :: any +end + +function RegexCaptures.format(self: RegexCaptures, format: string): string + return nil :: any +end + --[=[ @class RegexCaptures Captures from a regular expression. ]=] -local RegexCaptures = {} +export type RegexCaptures = typeof(setmetatable( + {} :: { + --[=[ + @within RegexCaptures + @tag Method + @method get ---[=[ - @within RegexCaptures - @tag Method + Returns the match at the given index, if one exists. - Returns the match at the given index, if one exists. + @param index -- The index of the match to get + @return RegexMatch -- The match, if one exists + ]=] - @param index -- The index of the match to get - @return RegexMatch -- The match, if one exists -]=] -function RegexCaptures.get(self: RegexCaptures, index: number): RegexMatch? - return nil :: any -end + get: (self: RegexCaptures, index: number) -> RegexMatch?, ---[=[ - @within RegexCaptures - @tag Method + --[=[ + @within RegexCaptures + @tag Method + @method group - Returns the match for the given named match group, if one exists. + Returns the match for the given named match group, if one exists. - @param group -- The name of the group to get - @return RegexMatch -- The match, if one exists -]=] -function RegexCaptures.group(self: RegexCaptures, group: string): RegexMatch? - return nil :: any -end + @param group -- The name of the group to get + @return RegexMatch -- The match, if one exists + ]=] + group: (self: RegexCaptures, group: string) -> RegexMatch?, ---[=[ - @within RegexCaptures - @tag Method + --[=[ + @within RegexCaptures + @tag Method + @method format - Formats the captures using the given format string. + Formats the captures using the given format string. - ### Example usage + ### Example usage - ```lua - local regex = require("@lune/regex") + ```lua + local regex = require("@lune/regex") - local re = regex.new("(?[0-9]{2})-(?[0-9]{2})-(?[0-9]{4})") + local re = regex.new("(?[0-9]{2})-(?[0-9]{2})-(?[0-9]{4})") - local caps = re:captures("On 14-03-2010, I became a Tenneessee lamb."); - assert(caps ~= nil, "Example pattern should match example text") + local caps = re:captures("On 14-03-2010, I became a Tenneessee lamb."); + assert(caps ~= nil, "Example pattern should match example text") - local formatted = caps:format("year=$year, month=$month, day=$day") - print(formatted) -- "year=2010, month=03, day=14" - ``` + local formatted = caps:format("year=$year, month=$month, day=$day") + print(formatted) -- "year=2010, month=03, day=14" + ``` - @param format -- The format string to use - @return string -- The formatted string -]=] -function RegexCaptures.format(self: RegexCaptures, format: string): string - return nil :: any -end - -export type RegexCaptures = typeof(RegexCaptures) + @param format -- The format string to use + @return string -- The formatted string + ]=] + format: (self: RegexCaptures, format: string) -> string, + }, + {} :: { + __len: (self: RegexCaptures) -> number, + } +)) local Regex = {} From 0d2f5539b663fa119e34b4401019f92a4e45b64e Mon Sep 17 00:00:00 2001 From: Eli <100180307+EliTheGingerCat@users.noreply.github.com> Date: Wed, 16 Oct 2024 15:03:58 -0400 Subject: [PATCH 06/12] Add Moonwave comments for DateTime properties. (#248) --- types/datetime.luau | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/types/datetime.luau b/types/datetime.luau index 8992dab..04b42aa 100644 --- a/types/datetime.luau +++ b/types/datetime.luau @@ -87,10 +87,19 @@ export type DateTimeValueArguments = DateTimeValues & OptionalMillisecond ]=] export type DateTimeValueReturns = DateTimeValues & Millisecond +--[=[ + @prop unixTimestamp number + @within DateTime + Number of seconds passed since the UNIX epoch. +]=] + +--[=[ + @prop unixTimestampMillis number + @within DateTime + Number of milliseconds passed since the UNIX epoch. +]=] local DateTime = { - --- Number of seconds passed since the UNIX epoch. unixTimestamp = (nil :: any) :: number, - --- Number of milliseconds passed since the UNIX epoch. unixTimestampMillis = (nil :: any) :: number, } From eaac9ff53a98db36a37df5e880aabb1bab22d1b5 Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Wed, 16 Oct 2024 20:06:14 +0100 Subject: [PATCH 07/12] Migrate to Rokit as toolchain manager (#238) --- .github/workflows/ci.yaml | 10 ++-------- aftman.toml => rokit.toml | 1 + 2 files changed, 3 insertions(+), 8 deletions(-) rename aftman.toml => rokit.toml (76%) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 088884a..9c41310 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -23,11 +23,8 @@ jobs: with: components: rustfmt - - name: Install Just - uses: extractions/setup-just@v2 - - name: Install Tooling - uses: ok-nick/setup-aftman@v0.4.2 + uses: CompeyDev/setup-rokit@v0.1.0 - name: Check Formatting run: just fmt-check @@ -40,11 +37,8 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Install Just - uses: extractions/setup-just@v2 - - name: Install Tooling - uses: ok-nick/setup-aftman@v0.4.2 + uses: CompeyDev/setup-rokit@v0.1.0 - name: Analyze run: just analyze diff --git a/aftman.toml b/rokit.toml similarity index 76% rename from aftman.toml rename to rokit.toml index 0c5e756..8d9cd5d 100644 --- a/aftman.toml +++ b/rokit.toml @@ -1,3 +1,4 @@ [tools] luau-lsp = "JohnnyMorganz/luau-lsp@1.32.1" stylua = "JohnnyMorganz/StyLua@0.20.0" +just = "casey/just@1.34.0" From df4fb9be91a3bb77c0f168bd4daeeb59f695a9a0 Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Wed, 16 Oct 2024 20:35:23 +0100 Subject: [PATCH 08/12] Make `Runtime::run` Return Lua Values (#178) --- crates/lune-roblox/src/instance/terrain.rs | 8 +++--- crates/lune/src/cli/run.rs | 9 +++---- crates/lune/src/rt/runtime.rs | 26 ++++++++++--------- crates/lune/src/standalone/mod.rs | 8 +++--- crates/lune/src/tests.rs | 4 +-- .../mlua-luau-scheduler/examples/exit_code.rs | 2 +- crates/mlua-luau-scheduler/src/exit.rs | 8 +++--- crates/mlua-luau-scheduler/src/functions.rs | 4 +-- crates/mlua-luau-scheduler/src/scheduler.rs | 5 ++-- crates/mlua-luau-scheduler/src/traits.rs | 4 +-- 10 files changed, 39 insertions(+), 39 deletions(-) diff --git a/crates/lune-roblox/src/instance/terrain.rs b/crates/lune-roblox/src/instance/terrain.rs index 96a036b..d4ff227 100644 --- a/crates/lune-roblox/src/instance/terrain.rs +++ b/crates/lune-roblox/src/instance/terrain.rs @@ -27,11 +27,13 @@ pub fn add_methods<'lua, M: LuaUserDataMethods<'lua, Instance>>(methods: &mut M) } fn get_or_create_material_colors(instance: &Instance) -> MaterialColors { - if let Some(Variant::MaterialColors(material_colors)) = instance.get_property("MaterialColors") + if let Variant::MaterialColors(inner) = instance + .get_property("MaterialColors") + .unwrap_or(Variant::MaterialColors(MaterialColors::default())) { - material_colors + inner } else { - MaterialColors::default() + unreachable!() } } diff --git a/crates/lune/src/cli/run.rs b/crates/lune/src/cli/run.rs index 35e523e..41c4c27 100644 --- a/crates/lune/src/cli/run.rs +++ b/crates/lune/src/cli/run.rs @@ -7,9 +7,8 @@ use tokio::{ io::{stdin, AsyncReadExt as _}, }; -use lune::Runtime; - use super::utils::files::{discover_script_path_including_lune_dirs, strip_shebang}; +use lune::Runtime; /// Run a script #[derive(Debug, Clone, Parser)] @@ -41,8 +40,8 @@ impl RunCommand { }; // Create a new lune object with all globals & run the script - let result = Runtime::new() - .with_args(self.script_args) + let mut runtime = Runtime::new().with_args(self.script_args); + let result = runtime .run(&script_display_name, strip_shebang(script_contents)) .await; Ok(match result { @@ -50,7 +49,7 @@ impl RunCommand { eprintln!("{err}"); ExitCode::FAILURE } - Ok(code) => code, + Ok((code, _)) => ExitCode::from(code), }) } } diff --git a/crates/lune/src/rt/runtime.rs b/crates/lune/src/rt/runtime.rs index 1aa2ace..51817aa 100644 --- a/crates/lune/src/rt/runtime.rs +++ b/crates/lune/src/rt/runtime.rs @@ -1,7 +1,6 @@ #![allow(clippy::missing_panics_doc)] use std::{ - process::ExitCode, rc::Rc, sync::{ atomic::{AtomicBool, Ordering}, @@ -144,7 +143,8 @@ impl Runtime { &mut self, script_name: impl AsRef, script_contents: impl AsRef<[u8]>, - ) -> RuntimeResult { + ) -> RuntimeResult<(u8, Vec)> { + // Create a new scheduler for this run let lua = self.inner.lua(); let sched = self.inner.scheduler(); @@ -162,18 +162,20 @@ impl Runtime { .set_name(script_name.as_ref()); // Run it on our scheduler until it and any other spawned threads complete - sched.push_thread_back(main, ())?; + let main_thread_id = sched.push_thread_back(main, ())?; sched.run().await; - // Return the exit code - default to FAILURE if we got any errors - let exit_code = sched.get_exit_code().unwrap_or({ - if got_any_error.load(Ordering::SeqCst) { - ExitCode::FAILURE - } else { - ExitCode::SUCCESS - } - }); + let thread_res = match sched.get_thread_result(main_thread_id) { + Some(res) => res, + None => LuaValue::Nil.into_lua_multi(lua), + }? + .into_vec(); - Ok(exit_code) + Ok(( + sched + .get_exit_code() + .unwrap_or(u8::from(got_any_error.load(Ordering::SeqCst))), + thread_res, + )) } } diff --git a/crates/lune/src/standalone/mod.rs b/crates/lune/src/standalone/mod.rs index fe58913..805eb95 100644 --- a/crates/lune/src/standalone/mod.rs +++ b/crates/lune/src/standalone/mod.rs @@ -29,16 +29,14 @@ pub async fn run(patched_bin: impl AsRef<[u8]>) -> Result { let args = env::args().skip(1).collect::>(); let meta = Metadata::from_bytes(patched_bin).expect("must be a standalone binary"); - let result = Runtime::new() - .with_args(args) - .run("STANDALONE", meta.bytecode) - .await; + let mut rt = Runtime::new().with_args(args); + let result = rt.run("STANDALONE", meta.bytecode).await; Ok(match result { Err(err) => { eprintln!("{err}"); ExitCode::FAILURE } - Ok(code) => code, + Ok((code, _)) => ExitCode::from(code), }) } diff --git a/crates/lune/src/tests.rs b/crates/lune/src/tests.rs index 2e866dc..c0a53d8 100644 --- a/crates/lune/src/tests.rs +++ b/crates/lune/src/tests.rs @@ -42,8 +42,8 @@ macro_rules! create_tests { .trim_end_matches(".luau") .trim_end_matches(".lua") .to_string(); - let exit_code = lune.run(&script_name, &script).await?; - Ok(exit_code) + let (exit_code, _) = lune.run(&script_name, &script).await?; + Ok(ExitCode::from(exit_code)) } )* } } diff --git a/crates/mlua-luau-scheduler/examples/exit_code.rs b/crates/mlua-luau-scheduler/examples/exit_code.rs index ee4a9a4..a6ede57 100644 --- a/crates/mlua-luau-scheduler/examples/exit_code.rs +++ b/crates/mlua-luau-scheduler/examples/exit_code.rs @@ -32,7 +32,7 @@ pub fn main() -> LuaResult<()> { // Verify that we got a correct exit code let code = sched.get_exit_code().unwrap_or_default(); - assert!(format!("{code:?}").contains("(1)")); + assert_eq!(code, 1); Ok(()) } diff --git a/crates/mlua-luau-scheduler/src/exit.rs b/crates/mlua-luau-scheduler/src/exit.rs index a2794dd..d8d9bd3 100644 --- a/crates/mlua-luau-scheduler/src/exit.rs +++ b/crates/mlua-luau-scheduler/src/exit.rs @@ -1,10 +1,10 @@ -use std::{cell::Cell, process::ExitCode, rc::Rc}; +use std::{cell::Cell, rc::Rc}; use event_listener::Event; #[derive(Debug, Clone)] pub(crate) struct Exit { - code: Rc>>, + code: Rc>>, event: Rc, } @@ -16,12 +16,12 @@ impl Exit { } } - pub fn set(&self, code: ExitCode) { + pub fn set(&self, code: u8) { self.code.set(Some(code)); self.event.notify(usize::MAX); } - pub fn get(&self) -> Option { + pub fn get(&self) -> Option { self.code.get() } diff --git a/crates/mlua-luau-scheduler/src/functions.rs b/crates/mlua-luau-scheduler/src/functions.rs index 7230b99..06e5c25 100644 --- a/crates/mlua-luau-scheduler/src/functions.rs +++ b/crates/mlua-luau-scheduler/src/functions.rs @@ -1,7 +1,7 @@ #![allow(unused_imports)] #![allow(clippy::too_many_lines)] -use std::process::ExitCode; +use std::process::{ExitCode, ExitStatus}; use mlua::prelude::*; @@ -232,7 +232,7 @@ impl<'lua> Functions<'lua> { "exit", lua.create_function(|lua, code: Option| { let _span = tracing::trace_span!("Scheduler::fn_exit").entered(); - let code = code.map(ExitCode::from).unwrap_or_default(); + let code = code.unwrap_or_default(); lua.set_exit_code(code); Ok(()) })?, diff --git a/crates/mlua-luau-scheduler/src/scheduler.rs b/crates/mlua-luau-scheduler/src/scheduler.rs index 31f699e..9a43aa3 100644 --- a/crates/mlua-luau-scheduler/src/scheduler.rs +++ b/crates/mlua-luau-scheduler/src/scheduler.rs @@ -2,7 +2,6 @@ use std::{ cell::Cell, - process::ExitCode, rc::{Rc, Weak as WeakRc}, sync::{Arc, Weak as WeakArc}, thread::panicking, @@ -168,7 +167,7 @@ impl<'lua> Scheduler<'lua> { Gets the exit code for this scheduler, if one has been set. */ #[must_use] - pub fn get_exit_code(&self) -> Option { + pub fn get_exit_code(&self) -> Option { self.exit.get() } @@ -177,7 +176,7 @@ impl<'lua> Scheduler<'lua> { This will cause [`Scheduler::run`] to exit immediately. */ - pub fn set_exit_code(&self, code: ExitCode) { + pub fn set_exit_code(&self, code: u8) { self.exit.set(code); } diff --git a/crates/mlua-luau-scheduler/src/traits.rs b/crates/mlua-luau-scheduler/src/traits.rs index cbe2e6e..caca387 100644 --- a/crates/mlua-luau-scheduler/src/traits.rs +++ b/crates/mlua-luau-scheduler/src/traits.rs @@ -82,7 +82,7 @@ pub trait LuaSchedulerExt<'lua> { Panics if called outside of a running [`Scheduler`]. */ - fn set_exit_code(&self, code: ExitCode); + fn set_exit_code(&self, code: u8); /** Pushes (spawns) a lua thread to the **front** of the current scheduler. @@ -283,7 +283,7 @@ pub trait LuaSpawnExt<'lua> { } impl<'lua> LuaSchedulerExt<'lua> for Lua { - fn set_exit_code(&self, code: ExitCode) { + fn set_exit_code(&self, code: u8) { let exit = self .app_data_ref::() .expect("exit code can only be set from within an active scheduler"); From 93fa14d832b26bab9a45eb4d56136104a6080cf9 Mon Sep 17 00:00:00 2001 From: Filip Tibell Date: Wed, 16 Oct 2024 21:41:16 +0200 Subject: [PATCH 09/12] Revert some unnecessary stylistic changes --- crates/lune-roblox/src/instance/terrain.rs | 7 ++----- crates/lune/src/cli/run.rs | 11 +++++++---- crates/lune/src/rt/runtime.rs | 8 +++----- crates/lune/src/standalone/mod.rs | 1 + crates/mlua-luau-scheduler/src/functions.rs | 4 ---- 5 files changed, 13 insertions(+), 18 deletions(-) diff --git a/crates/lune-roblox/src/instance/terrain.rs b/crates/lune-roblox/src/instance/terrain.rs index d4ff227..8d77008 100644 --- a/crates/lune-roblox/src/instance/terrain.rs +++ b/crates/lune-roblox/src/instance/terrain.rs @@ -27,13 +27,10 @@ pub fn add_methods<'lua, M: LuaUserDataMethods<'lua, Instance>>(methods: &mut M) } fn get_or_create_material_colors(instance: &Instance) -> MaterialColors { - if let Variant::MaterialColors(inner) = instance - .get_property("MaterialColors") - .unwrap_or(Variant::MaterialColors(MaterialColors::default())) - { + if let Some(Variant::MaterialColors(inner)) = instance.get_property("MaterialColors") { inner } else { - unreachable!() + MaterialColors::default() } } diff --git a/crates/lune/src/cli/run.rs b/crates/lune/src/cli/run.rs index 41c4c27..6267ed7 100644 --- a/crates/lune/src/cli/run.rs +++ b/crates/lune/src/cli/run.rs @@ -7,9 +7,10 @@ use tokio::{ io::{stdin, AsyncReadExt as _}, }; -use super::utils::files::{discover_script_path_including_lune_dirs, strip_shebang}; use lune::Runtime; +use super::utils::files::{discover_script_path_including_lune_dirs, strip_shebang}; + /// Run a script #[derive(Debug, Clone, Parser)] pub struct RunCommand { @@ -39,11 +40,13 @@ impl RunCommand { (file_display_name, file_contents) }; - // Create a new lune object with all globals & run the script - let mut runtime = Runtime::new().with_args(self.script_args); - let result = runtime + // Create a new lune runtime with all globals & run the script + let mut rt = Runtime::new().with_args(self.script_args); + + let result = rt .run(&script_display_name, strip_shebang(script_contents)) .await; + Ok(match result { Err(err) => { eprintln!("{err}"); diff --git a/crates/lune/src/rt/runtime.rs b/crates/lune/src/rt/runtime.rs index 51817aa..31e5b03 100644 --- a/crates/lune/src/rt/runtime.rs +++ b/crates/lune/src/rt/runtime.rs @@ -144,7 +144,6 @@ impl Runtime { script_name: impl AsRef, script_contents: impl AsRef<[u8]>, ) -> RuntimeResult<(u8, Vec)> { - // Create a new scheduler for this run let lua = self.inner.lua(); let sched = self.inner.scheduler(); @@ -165,17 +164,16 @@ impl Runtime { let main_thread_id = sched.push_thread_back(main, ())?; sched.run().await; - let thread_res = match sched.get_thread_result(main_thread_id) { + let main_thread_res = match sched.get_thread_result(main_thread_id) { Some(res) => res, None => LuaValue::Nil.into_lua_multi(lua), - }? - .into_vec(); + }?; Ok(( sched .get_exit_code() .unwrap_or(u8::from(got_any_error.load(Ordering::SeqCst))), - thread_res, + main_thread_res.into_vec(), )) } } diff --git a/crates/lune/src/standalone/mod.rs b/crates/lune/src/standalone/mod.rs index 805eb95..40321dd 100644 --- a/crates/lune/src/standalone/mod.rs +++ b/crates/lune/src/standalone/mod.rs @@ -30,6 +30,7 @@ pub async fn run(patched_bin: impl AsRef<[u8]>) -> Result { let meta = Metadata::from_bytes(patched_bin).expect("must be a standalone binary"); let mut rt = Runtime::new().with_args(args); + let result = rt.run("STANDALONE", meta.bytecode).await; Ok(match result { diff --git a/crates/mlua-luau-scheduler/src/functions.rs b/crates/mlua-luau-scheduler/src/functions.rs index 06e5c25..920cc85 100644 --- a/crates/mlua-luau-scheduler/src/functions.rs +++ b/crates/mlua-luau-scheduler/src/functions.rs @@ -1,15 +1,11 @@ -#![allow(unused_imports)] #![allow(clippy::too_many_lines)] -use std::process::{ExitCode, ExitStatus}; - use mlua::prelude::*; use crate::{ error_callback::ThreadErrorCallback, queue::{DeferredThreadQueue, SpawnedThreadQueue}, result_map::ThreadResultMap, - scheduler::Scheduler, thread_id::ThreadId, traits::LuaSchedulerExt, util::{is_poll_pending, LuaThreadOrFunction, ThreadResult}, From 309c461e117cd356dff793cdaedcda9f1b4fa0c5 Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Wed, 16 Oct 2024 20:48:12 +0100 Subject: [PATCH 10/12] Implement a non-blocking child process interface (#211) --- .lune/hello_lune.luau | 2 +- Cargo.lock | 2 + crates/lune-std-process/Cargo.toml | 3 + crates/lune-std-process/src/lib.rs | 126 +++++++++++++--- crates/lune-std-process/src/stream.rs | 58 +++++++ crates/lune/src/tests.rs | 17 ++- scripts/generate_compression_test_files.luau | 4 +- tests/datetime/formatLocalTime.luau | 2 +- tests/process/create/kill.luau | 21 +++ tests/process/create/non_blocking.luau | 13 ++ tests/process/create/status.luau | 15 ++ tests/process/create/stream.luau | 18 +++ tests/process/{spawn => exec}/async.luau | 4 +- tests/process/{spawn => exec}/basic.luau | 4 +- tests/process/{spawn => exec}/cwd.luau | 12 +- tests/process/exec/no_panic.luau | 7 + tests/process/{spawn => exec}/shell.luau | 2 +- tests/process/{spawn => exec}/stdin.luau | 4 +- tests/process/{spawn => exec}/stdio.luau | 4 +- tests/process/spawn/no_panic.luau | 7 - tests/stdio/format.luau | 2 +- types/process.luau | 151 +++++++++++++++++-- 22 files changed, 414 insertions(+), 64 deletions(-) create mode 100644 crates/lune-std-process/src/stream.rs create mode 100644 tests/process/create/kill.luau create mode 100644 tests/process/create/non_blocking.luau create mode 100644 tests/process/create/status.luau create mode 100644 tests/process/create/stream.luau rename tests/process/{spawn => exec}/async.luau (89%) rename tests/process/{spawn => exec}/basic.luau (89%) rename tests/process/{spawn => exec}/cwd.luau (81%) create mode 100644 tests/process/exec/no_panic.luau rename tests/process/{spawn => exec}/shell.luau (94%) rename tests/process/{spawn => exec}/stdin.luau (79%) rename tests/process/{spawn => exec}/stdio.luau (79%) delete mode 100644 tests/process/spawn/no_panic.luau diff --git a/.lune/hello_lune.luau b/.lune/hello_lune.luau index 197fe32..c50fd7b 100644 --- a/.lune/hello_lune.luau +++ b/.lune/hello_lune.luau @@ -129,7 +129,7 @@ end ]] print("Sending 4 pings to google 🌏") -local result = process.spawn("ping", { +local result = process.exec("ping", { "google.com", "-c 4", }) diff --git a/Cargo.lock b/Cargo.lock index 6ba3d92..3470b8b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1629,6 +1629,8 @@ dependencies = [ name = "lune-std-process" version = "0.1.3" dependencies = [ + "bstr", + "bytes", "directories", "lune-utils", "mlua", diff --git a/crates/lune-std-process/Cargo.toml b/crates/lune-std-process/Cargo.toml index 8668dc0..86f5440 100644 --- a/crates/lune-std-process/Cargo.toml +++ b/crates/lune-std-process/Cargo.toml @@ -20,6 +20,9 @@ directories = "5.0" pin-project = "1.0" os_str_bytes = { version = "7.0", features = ["conversions"] } +bstr = "1.9" +bytes = "1.6.0" + tokio = { version = "1", default-features = false, features = [ "io-std", "io-util", diff --git a/crates/lune-std-process/src/lib.rs b/crates/lune-std-process/src/lib.rs index 29d73ea..b66bc0d 100644 --- a/crates/lune-std-process/src/lib.rs +++ b/crates/lune-std-process/src/lib.rs @@ -1,27 +1,33 @@ #![allow(clippy::cargo_common_metadata)] use std::{ + cell::RefCell, env::{ self, consts::{ARCH, OS}, }, path::MAIN_SEPARATOR, process::Stdio, + rc::Rc, + sync::Arc, }; use mlua::prelude::*; use lune_utils::TableBuilder; use mlua_luau_scheduler::{Functions, LuaSpawnExt}; +use options::ProcessSpawnOptionsStdio; use os_str_bytes::RawOsString; -use tokio::io::AsyncWriteExt; +use stream::{ChildProcessReader, ChildProcessWriter}; +use tokio::{io::AsyncWriteExt, process::Child, sync::RwLock}; mod options; +mod stream; mod tee_writer; mod wait_for_child; use self::options::ProcessSpawnOptions; -use self::wait_for_child::{wait_for_child, WaitForChildResult}; +use self::wait_for_child::wait_for_child; use lune_utils::path::get_current_dir; @@ -73,7 +79,8 @@ pub fn module(lua: &Lua) -> LuaResult { .with_value("cwd", cwd_str)? .with_value("env", env_tab)? .with_value("exit", process_exit)? - .with_async_function("spawn", process_spawn)? + .with_async_function("exec", process_exec)? + .with_function("create", process_create)? .build_readonly() } @@ -141,11 +148,16 @@ fn process_env_iter<'lua>( }) } -async fn process_spawn( +async fn process_exec( lua: &Lua, (program, args, options): (String, Option>, ProcessSpawnOptions), ) -> LuaResult { - let res = lua.spawn(spawn_command(program, args, options)).await?; + let res = lua + .spawn(async move { + let cmd = spawn_command_with_stdin(program, args, options.clone()).await?; + wait_for_child(cmd, options.stdio.stdout, options.stdio.stderr).await + }) + .await?; /* NOTE: If an exit code was not given by the child process, @@ -168,30 +180,104 @@ async fn process_spawn( .build_readonly() } -async fn spawn_command( +#[allow(clippy::await_holding_refcell_ref)] +fn process_create( + lua: &Lua, + (program, args, options): (String, Option>, ProcessSpawnOptions), +) -> LuaResult { + // We do not want the user to provide stdio options for process.create, + // so we reset the options, regardless of what the user provides us + let mut spawn_options = options.clone(); + spawn_options.stdio = ProcessSpawnOptionsStdio::default(); + + let (code_tx, code_rx) = tokio::sync::broadcast::channel(4); + let code_rx_rc = Rc::new(RefCell::new(code_rx)); + + let child = spawn_command(program, args, spawn_options)?; + + let child_arc = Arc::new(RwLock::new(child)); + + let child_arc_clone = Arc::clone(&child_arc); + let mut child_lock = tokio::task::block_in_place(|| child_arc_clone.blocking_write()); + + let stdin = child_lock.stdin.take().unwrap(); + let stdout = child_lock.stdout.take().unwrap(); + let stderr = child_lock.stderr.take().unwrap(); + + let child_arc_inner = Arc::clone(&child_arc); + + // Spawn a background task to wait for the child to exit and send the exit code + let status_handle = tokio::spawn(async move { + let res = child_arc_inner.write().await.wait().await; + + if let Ok(output) = res { + let code = output.code().unwrap_or_default(); + + code_tx + .send(code) + .expect("ExitCode receiver was unexpectedly dropped"); + } + }); + + TableBuilder::new(lua)? + .with_value("stdout", ChildProcessReader(stdout))? + .with_value("stderr", ChildProcessReader(stderr))? + .with_value("stdin", ChildProcessWriter(stdin))? + .with_async_function("kill", move |_, ()| { + // First, stop the status task so the RwLock is dropped + status_handle.abort(); + let child_arc_clone = Arc::clone(&child_arc); + + // Then get another RwLock to write to the child process and kill it + async move { Ok(child_arc_clone.write().await.kill().await?) } + })? + .with_async_function("status", move |lua, ()| { + let code_rx_rc_clone = Rc::clone(&code_rx_rc); + async move { + // Exit code of 9 corresponds to SIGKILL, which should be the only case where + // the receiver gets suddenly dropped + let code = code_rx_rc_clone.borrow_mut().recv().await.unwrap_or(9); + + TableBuilder::new(lua)? + .with_value("code", code)? + .with_value("ok", code == 0)? + .build_readonly() + } + })? + .build_readonly() +} + +async fn spawn_command_with_stdin( program: String, args: Option>, mut options: ProcessSpawnOptions, -) -> LuaResult { - let stdout = options.stdio.stdout; - let stderr = options.stdio.stderr; +) -> LuaResult { let stdin = options.stdio.stdin.take(); - let mut child = options - .into_command(program, args) - .stdin(if stdin.is_some() { - Stdio::piped() - } else { - Stdio::null() - }) - .stdout(stdout.as_stdio()) - .stderr(stderr.as_stdio()) - .spawn()?; + let mut child = spawn_command(program, args, options)?; if let Some(stdin) = stdin { let mut child_stdin = child.stdin.take().unwrap(); child_stdin.write_all(&stdin).await.into_lua_err()?; } - wait_for_child(child, stdout, stderr).await + Ok(child) +} + +fn spawn_command( + program: String, + args: Option>, + options: ProcessSpawnOptions, +) -> LuaResult { + let stdout = options.stdio.stdout; + let stderr = options.stdio.stderr; + + let child = options + .into_command(program, args) + .stdin(Stdio::piped()) + .stdout(stdout.as_stdio()) + .stderr(stderr.as_stdio()) + .spawn()?; + + Ok(child) } diff --git a/crates/lune-std-process/src/stream.rs b/crates/lune-std-process/src/stream.rs new file mode 100644 index 0000000..830e055 --- /dev/null +++ b/crates/lune-std-process/src/stream.rs @@ -0,0 +1,58 @@ +use bstr::BString; +use bytes::BytesMut; +use mlua::prelude::*; +use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt}; + +const CHUNK_SIZE: usize = 8; + +#[derive(Debug, Clone)] +pub struct ChildProcessReader(pub R); +#[derive(Debug, Clone)] +pub struct ChildProcessWriter(pub W); + +impl ChildProcessReader { + pub async fn read(&mut self, chunk_size: Option) -> LuaResult> { + let mut buf = BytesMut::with_capacity(chunk_size.unwrap_or(CHUNK_SIZE)); + self.0.read_buf(&mut buf).await?; + + Ok(buf.to_vec()) + } + + pub async fn read_to_end(&mut self) -> LuaResult> { + let mut buf = vec![]; + self.0.read_to_end(&mut buf).await?; + + Ok(buf) + } +} + +impl LuaUserData for ChildProcessReader { + fn add_methods<'lua, M: LuaUserDataMethods<'lua, Self>>(methods: &mut M) { + methods.add_async_method_mut("read", |lua, this, chunk_size: Option| async move { + let buf = this.read(chunk_size).await?; + + if buf.is_empty() { + return Ok(LuaValue::Nil); + } + + Ok(LuaValue::String(lua.create_string(buf)?)) + }); + + methods.add_async_method_mut("readToEnd", |lua, this, ()| async { + Ok(lua.create_string(this.read_to_end().await?)) + }); + } +} + +impl ChildProcessWriter { + pub async fn write(&mut self, data: BString) -> LuaResult<()> { + self.0.write_all(data.as_ref()).await?; + Ok(()) + } +} + +impl LuaUserData for ChildProcessWriter { + fn add_methods<'lua, M: LuaUserDataMethods<'lua, Self>>(methods: &mut M) { + methods.add_async_method_mut("write", |_, this, data| async { this.write(data).await }); + } +} diff --git a/crates/lune/src/tests.rs b/crates/lune/src/tests.rs index c0a53d8..d5f5640 100644 --- a/crates/lune/src/tests.rs +++ b/crates/lune/src/tests.rs @@ -138,13 +138,16 @@ create_tests! { process_cwd: "process/cwd", process_env: "process/env", process_exit: "process/exit", - process_spawn_async: "process/spawn/async", - process_spawn_basic: "process/spawn/basic", - process_spawn_cwd: "process/spawn/cwd", - process_spawn_no_panic: "process/spawn/no_panic", - process_spawn_shell: "process/spawn/shell", - process_spawn_stdin: "process/spawn/stdin", - process_spawn_stdio: "process/spawn/stdio", + process_exec_async: "process/exec/async", + process_exec_basic: "process/exec/basic", + process_exec_cwd: "process/exec/cwd", + process_exec_no_panic: "process/exec/no_panic", + process_exec_shell: "process/exec/shell", + process_exec_stdin: "process/exec/stdin", + process_exec_stdio: "process/exec/stdio", + process_spawn_non_blocking: "process/create/non_blocking", + process_spawn_status: "process/create/status", + process_spawn_stream: "process/create/stream", } #[cfg(feature = "std-regex")] diff --git a/scripts/generate_compression_test_files.luau b/scripts/generate_compression_test_files.luau index 954929a..ce7ac82 100644 --- a/scripts/generate_compression_test_files.luau +++ b/scripts/generate_compression_test_files.luau @@ -108,7 +108,7 @@ local BIN_ZLIB = if process.os == "macos" then "/opt/homebrew/bin/pigz" else "pi local function checkInstalled(program: string, args: { string }?) print("Checking if", program, "is installed") - local result = process.spawn(program, args) + local result = process.exec(program, args) if not result.ok then stdio.ewrite(string.format("Program '%s' is not installed\n", program)) process.exit(1) @@ -123,7 +123,7 @@ checkInstalled(BIN_ZLIB, { "--version" }) -- Run them to generate files local function run(program: string, args: { string }): string - local result = process.spawn(program, args) + local result = process.exec(program, args) if not result.ok then stdio.ewrite(string.format("Command '%s' failed\n", program)) if #result.stdout > 0 then diff --git a/tests/datetime/formatLocalTime.luau b/tests/datetime/formatLocalTime.luau index 4e2f657..8bd000c 100644 --- a/tests/datetime/formatLocalTime.luau +++ b/tests/datetime/formatLocalTime.luau @@ -31,7 +31,7 @@ if not runLocaleTests then return end -local dateCmd = process.spawn("bash", { "-c", "date +\"%A, %d %B %Y\" --date='@1693068988'" }, { +local dateCmd = process.exec("bash", { "-c", "date +\"%A, %d %B %Y\" --date='@1693068988'" }, { env = { LC_ALL = "fr_FR.UTF-8 ", }, diff --git a/tests/process/create/kill.luau b/tests/process/create/kill.luau new file mode 100644 index 0000000..e0cbbc7 --- /dev/null +++ b/tests/process/create/kill.luau @@ -0,0 +1,21 @@ +local process = require("@lune/process") + +-- Killing a child process should work as expected + +local message = "Hello, world!" +local child = process.create("cat") + +child.stdin:write(message) +child.kill() + +assert(child.status().code == 9, "Child process should have an exit code of 9 (SIGKILL)") + +assert( + child.stdout:readToEnd() == message, + "Reading from stdout of child process should work even after kill" +) + +local stdinWriteOk = pcall(function() + child.stdin:write(message) +end) +assert(not stdinWriteOk, "Writing to stdin of child process should not work after kill") diff --git a/tests/process/create/non_blocking.luau b/tests/process/create/non_blocking.luau new file mode 100644 index 0000000..82352a7 --- /dev/null +++ b/tests/process/create/non_blocking.luau @@ -0,0 +1,13 @@ +local process = require("@lune/process") + +-- Spawning a child process should not block the thread + +local childThread = coroutine.create(process.create) + +local ok, err = coroutine.resume(childThread, "echo", { "hello, world" }) +assert(ok, err) + +assert( + coroutine.status(childThread) == "dead", + "Child process should not block the thread it is running on" +) diff --git a/tests/process/create/status.luau b/tests/process/create/status.luau new file mode 100644 index 0000000..418c132 --- /dev/null +++ b/tests/process/create/status.luau @@ -0,0 +1,15 @@ +local process = require("@lune/process") + +-- The exit code of an child process should be correct + +local randomExitCode = math.random(0, 255) +local isOk = randomExitCode == 0 +local child = process.create("exit", { tostring(randomExitCode) }, { shell = true }) +local status = child.status() + +assert( + status.code == randomExitCode, + `Child process exited with wrong exit code, expected {randomExitCode}` +) + +assert(status.ok == isOk, `Child status should be {if status.ok then "ok" else "not ok"}`) diff --git a/tests/process/create/stream.luau b/tests/process/create/stream.luau new file mode 100644 index 0000000..89bb61a --- /dev/null +++ b/tests/process/create/stream.luau @@ -0,0 +1,18 @@ +local process = require("@lune/process") + +-- Should be able to write and read from child process streams + +local msg = "hello, world" + +local catChild = process.create("cat") +catChild.stdin:write(msg) +assert( + msg == catChild.stdout:read(#msg), + "Failed to write to stdin or read from stdout of child process" +) + +local echoChild = if process.os == "windows" + then process.create("/c", { "echo", msg, "1>&2" }, { shell = "cmd" }) + else process.create("echo", { msg, ">>/dev/stderr" }, { shell = true }) + +assert(msg == echoChild.stderr:read(#msg), "Failed to read from stderr of child process") diff --git a/tests/process/spawn/async.luau b/tests/process/exec/async.luau similarity index 89% rename from tests/process/spawn/async.luau rename to tests/process/exec/async.luau index 2f60f3a..205eccc 100644 --- a/tests/process/spawn/async.luau +++ b/tests/process/exec/async.luau @@ -4,7 +4,7 @@ local task = require("@lune/task") local IS_WINDOWS = process.os == "windows" --- Spawning a process should not block any lua thread(s) +-- Executing a command should not block any lua thread(s) local SLEEP_DURATION = 1 / 4 local SLEEP_SAMPLES = 2 @@ -31,7 +31,7 @@ for i = 1, SLEEP_SAMPLES, 1 do table.insert(args, 1, "-Milliseconds") end -- Windows does not have `sleep` as a process, so we use powershell instead. - process.spawn("sleep", args, if IS_WINDOWS then { shell = true } else nil) + process.exec("sleep", args, if IS_WINDOWS then { shell = true } else nil) sleepCounter += 1 end) end diff --git a/tests/process/spawn/basic.luau b/tests/process/exec/basic.luau similarity index 89% rename from tests/process/spawn/basic.luau rename to tests/process/exec/basic.luau index 012a8ee..41b0847 100644 --- a/tests/process/spawn/basic.luau +++ b/tests/process/exec/basic.luau @@ -2,7 +2,7 @@ local process = require("@lune/process") local stdio = require("@lune/stdio") local task = require("@lune/task") --- Spawning a child process should work, with options +-- Executing a command should work, with options local thread = task.delay(1, function() stdio.ewrite("Spawning a process should take a reasonable amount of time\n") @@ -12,7 +12,7 @@ end) local IS_WINDOWS = process.os == "windows" -local result = process.spawn( +local result = process.exec( if IS_WINDOWS then "cmd" else "ls", if IS_WINDOWS then { "/c", "dir" } else { "-a" } ) diff --git a/tests/process/spawn/cwd.luau b/tests/process/exec/cwd.luau similarity index 81% rename from tests/process/spawn/cwd.luau rename to tests/process/exec/cwd.luau index d9989df..96a7fe4 100644 --- a/tests/process/spawn/cwd.luau +++ b/tests/process/exec/cwd.luau @@ -6,7 +6,7 @@ local pwdCommand = if IS_WINDOWS then "cmd" else "pwd" local pwdArgs = if IS_WINDOWS then { "/c", "cd" } else {} -- Make sure the cwd option actually uses the directory we want -local rootPwd = process.spawn(pwdCommand, pwdArgs, { +local rootPwd = process.exec(pwdCommand, pwdArgs, { cwd = "/", }).stdout rootPwd = string.gsub(rootPwd, "^%s+", "") @@ -27,24 +27,24 @@ end -- Setting cwd should not change the cwd of this process -local pwdBefore = process.spawn(pwdCommand, pwdArgs).stdout -process.spawn("ls", {}, { +local pwdBefore = process.exec(pwdCommand, pwdArgs).stdout +process.exec("ls", {}, { cwd = "/", shell = true, }) -local pwdAfter = process.spawn(pwdCommand, pwdArgs).stdout +local pwdAfter = process.exec(pwdCommand, pwdArgs).stdout assert(pwdBefore == pwdAfter, "Current working directory changed after running child process") -- Setting the cwd on a child process should properly -- replace any leading ~ with the users real home dir -local homeDir1 = process.spawn("echo $HOME", nil, { +local homeDir1 = process.exec("echo $HOME", nil, { shell = true, }).stdout -- NOTE: Powershell for windows uses `$pwd.Path` instead of `pwd` as pwd would return -- a PathInfo object, using $pwd.Path gets the Path property of the PathInfo object -local homeDir2 = process.spawn(if IS_WINDOWS then "$pwd.Path" else "pwd", nil, { +local homeDir2 = process.exec(if IS_WINDOWS then "$pwd.Path" else "pwd", nil, { shell = true, cwd = "~", }).stdout diff --git a/tests/process/exec/no_panic.luau b/tests/process/exec/no_panic.luau new file mode 100644 index 0000000..a7d289f --- /dev/null +++ b/tests/process/exec/no_panic.luau @@ -0,0 +1,7 @@ +local process = require("@lune/process") + +-- Executing a non existent command as a child process +-- should not panic, but should error + +local success = pcall(process.exec, "someProgramThatDoesNotExist") +assert(not success, "Spawned a non-existent program") diff --git a/tests/process/spawn/shell.luau b/tests/process/exec/shell.luau similarity index 94% rename from tests/process/spawn/shell.luau rename to tests/process/exec/shell.luau index 6f64791..729f15a 100644 --- a/tests/process/spawn/shell.luau +++ b/tests/process/exec/shell.luau @@ -5,7 +5,7 @@ local IS_WINDOWS = process.os == "windows" -- Default shell should be /bin/sh on unix and powershell on Windows, -- note that powershell needs slightly different command flags for ls -local shellResult = process.spawn("ls", { +local shellResult = process.exec("ls", { if IS_WINDOWS then "-Force" else "-a", }, { shell = true, diff --git a/tests/process/spawn/stdin.luau b/tests/process/exec/stdin.luau similarity index 79% rename from tests/process/spawn/stdin.luau rename to tests/process/exec/stdin.luau index 56c77a5..f85cd0b 100644 --- a/tests/process/spawn/stdin.luau +++ b/tests/process/exec/stdin.luau @@ -10,8 +10,8 @@ local echoMessage = "Hello from child process!" -- When passing stdin to powershell on windows we must "accept" using the double newline local result = if IS_WINDOWS - then process.spawn("powershell", { "echo" }, { stdin = echoMessage .. "\n\n" }) - else process.spawn("xargs", { "echo" }, { stdin = echoMessage }) + then process.exec("powershell", { "echo" }, { stdin = echoMessage .. "\n\n" }) + else process.exec("xargs", { "echo" }, { stdin = echoMessage }) local resultStdout = if IS_WINDOWS then string.sub(result.stdout, #result.stdout - #echoMessage - 1) diff --git a/tests/process/spawn/stdio.luau b/tests/process/exec/stdio.luau similarity index 79% rename from tests/process/spawn/stdio.luau rename to tests/process/exec/stdio.luau index 0ea5b1c..524713b 100644 --- a/tests/process/spawn/stdio.luau +++ b/tests/process/exec/stdio.luau @@ -5,12 +5,12 @@ local IS_WINDOWS = process.os == "windows" -- Inheriting stdio & environment variables should work local echoMessage = "Hello from child process!" -local echoResult = process.spawn("echo", { +local echoResult = process.exec("echo", { if IS_WINDOWS then '"$Env:TEST_VAR"' else '"$TEST_VAR"', }, { env = { TEST_VAR = echoMessage }, shell = if IS_WINDOWS then "powershell" else "bash", - stdio = "inherit", + stdio = "inherit" :: process.SpawnOptionsStdioKind, -- FIXME: This should just work without a cast? }) -- Windows uses \r\n (CRLF) and unix uses \n (LF) diff --git a/tests/process/spawn/no_panic.luau b/tests/process/spawn/no_panic.luau deleted file mode 100644 index 3a57a9b..0000000 --- a/tests/process/spawn/no_panic.luau +++ /dev/null @@ -1,7 +0,0 @@ -local process = require("@lune/process") - --- Spawning a child process for a non-existent --- program should not panic, but should error - -local success = pcall(process.spawn, "someProgramThatDoesNotExist") -assert(not success, "Spawned a non-existent program") diff --git a/tests/stdio/format.luau b/tests/stdio/format.luau index 7ade5f5..c0cc7cf 100644 --- a/tests/stdio/format.luau +++ b/tests/stdio/format.luau @@ -109,7 +109,7 @@ assertContains( local _, errorMessage = pcall(function() local function innerInnerFn() - process.spawn("PROGRAM_THAT_DOES_NOT_EXIST") + process.exec("PROGRAM_THAT_DOES_NOT_EXIST") end local function innerFn() innerInnerFn() diff --git a/types/process.luau b/types/process.luau index 7b82052..6a4a12e 100644 --- a/types/process.luau +++ b/types/process.luau @@ -5,6 +5,9 @@ export type SpawnOptionsStdioKind = "default" | "inherit" | "forward" | "none" export type SpawnOptionsStdio = { stdout: SpawnOptionsStdioKind?, stderr: SpawnOptionsStdioKind?, +} + +export type ExecuteOptionsStdio = SpawnOptionsStdio & { stdin: string?, } @@ -12,27 +15,117 @@ export type SpawnOptionsStdio = { @interface SpawnOptions @within Process - A dictionary of options for `process.spawn`, with the following available values: + A dictionary of options for `process.create`, with the following available values: * `cwd` - The current working directory for the process * `env` - Extra environment variables to give to the process * `shell` - Whether to run in a shell or not - set to `true` to run using the default shell, or a string to run using a specific shell * `stdio` - How to treat output and error streams from the child process - see `SpawnOptionsStdioKind` and `SpawnOptionsStdio` for more info - * `stdin` - Optional standard input to pass to spawned child process ]=] export type SpawnOptions = { cwd: string?, env: { [string]: string }?, shell: (boolean | string)?, +} + +--[=[ + @interface ExecuteOptions + @within Process + + A dictionary of options for `process.exec`, with the following available values: + + * `cwd` - The current working directory for the process + * `env` - Extra environment variables to give to the process + * `shell` - Whether to run in a shell or not - set to `true` to run using the default shell, or a string to run using a specific shell + * `stdio` - How to treat output and error streams from the child process - see `SpawnOptionsStdioKind` and `ExecuteOptionsStdio` for more info + * `stdin` - Optional standard input to pass to executed child process +]=] +export type ExecuteOptions = SpawnOptions & { stdio: (SpawnOptionsStdioKind | SpawnOptionsStdio)?, stdin: string?, -- TODO: Remove this since it is now available in stdio above, breaking change } --[=[ - @interface SpawnResult + @class ChildProcessReader @within Process - Result type for child processes in `process.spawn`. + A reader class to read data from a child process' streams in realtime. +]=] +local ChildProcessReader = {} + +--[=[ + @within ChildProcessReader + + Reads a chunk of data (specified length or a default of 8 bytes at a time) from + the reader as a string. Returns nil if there is no more data to read. + + This function may yield until there is new data to read from reader, if all data + till present has already been read, and the process has not exited. + + @return The string containing the data read from the reader +]=] +function ChildProcessReader:read(chunkSize: number?): string? + return nil :: any +end + +--[=[ + @within ChildProcessReader + + Reads all the data currently present in the reader as a string. + This function will yield until the process exits. + + @return The string containing the data read from the reader +]=] +function ChildProcessReader:readToEnd(): string + return nil :: any +end + +--[=[ + @class ChildProcessWriter + @within Process + + A writer class to write data to a child process' streams in realtime. +]=] +local ChildProcessWriter = {} + +--[=[ + @within ChildProcessWriter + + Writes a buffer or string of data to the writer. + + @param data The data to write to the writer +]=] +function ChildProcessWriter:write(data: buffer | string): () + return nil :: any +end + +--[=[ + @interface ChildProcess + @within Process + + Result type for child processes in `process.create`. + + This is a dictionary containing the following values: + + * `stdin` - A writer to write to the child process' stdin - see `ChildProcessWriter` for more info + * `stdout` - A reader to read from the child process' stdout - see `ChildProcessReader` for more info + * `stderr` - A reader to read from the child process' stderr - see `ChildProcessReader` for more info + * `kill` - A function that kills the child process + * `status` - A function that yields and returns the exit status of the child process +]=] +export type ChildProcess = { + stdin: typeof(ChildProcessWriter), + stdout: typeof(ChildProcessReader), + stderr: typeof(ChildProcessReader), + kill: () -> (); + status: () -> { ok: boolean, code: number } +} + +--[=[ + @interface ExecuteResult + @within Process + + Result type for child processes in `process.exec`. This is a dictionary containing the following values: @@ -41,7 +134,7 @@ export type SpawnOptions = { * `stdout` - The full contents written to stdout by the child process, or an empty string if nothing was written * `stderr` - The full contents written to stderr by the child process, or an empty string if nothing was written ]=] -export type SpawnResult = { +export type ExecuteResult = { ok: boolean, code: number, stdout: string, @@ -73,8 +166,8 @@ export type SpawnResult = { -- Getting the current os and processor architecture print("Running " .. process.os .. " on " .. process.arch .. "!") - -- Spawning a child process - local result = process.spawn("program", { + -- Executing a command + local result = process.exec("program", { "cli argument", "other cli argument" }) @@ -83,6 +176,19 @@ export type SpawnResult = { else print(result.stderr) end + + -- Spawning a child process + local child = process.create("program", { + "cli argument", + "other cli argument" + }) + + -- Writing to the child process' stdin + child.stdin:write("Hello from Lune!") + + -- Reading from the child process' stdout + local data = child.stdout:read() + print(buffer.tostring(data)) ``` ]=] local process = {} @@ -163,19 +269,44 @@ end --[=[ @within Process - Spawns a child process that will run the program `program`, and returns a dictionary that describes the final status and ouput of the child process. + Spawns a child process in the background that runs the program `program`, and immediately returns + readers and writers to communicate with it. + + In order to execute a command and wait for its output, see `process.exec`. The second argument, `params`, can be passed as a list of string parameters to give to the program. The third argument, `options`, can be passed as a dictionary of options to give to the child process. Refer to the documentation for `SpawnOptions` for specific option keys and their values. - @param program The program to spawn as a child process + @param program The program to Execute as a child process + @param params Additional parameters to pass to the program + @param options A dictionary of options for the child process + @return A dictionary with the readers and writers to communicate with the child process +]=] +function process.create(program: string, params: { string }?, options: SpawnOptions?): ChildProcess + return nil :: any +end + +--[=[ + @within Process + + Executes a child process that will execute the command `program`, waiting for it to exit. + Upon exit, it returns a dictionary that describes the final status and ouput of the child process. + + In order to spawn a child process in the background, see `process.create`. + + The second argument, `params`, can be passed as a list of string parameters to give to the program. + + The third argument, `options`, can be passed as a dictionary of options to give to the child process. + Refer to the documentation for `ExecuteOptions` for specific option keys and their values. + + @param program The program to Execute as a child process @param params Additional parameters to pass to the program @param options A dictionary of options for the child process @return A dictionary representing the result of the child process ]=] -function process.spawn(program: string, params: { string }?, options: SpawnOptions?): SpawnResult +function process.exec(program: string, params: { string }?, options: ExecuteOptions?): ExecuteResult return nil :: any end From 8abfc2118185eb6a2d3bfd41f5fca049a488f13b Mon Sep 17 00:00:00 2001 From: Filip Tibell Date: Wed, 16 Oct 2024 21:55:53 +0200 Subject: [PATCH 11/12] Use standard method calling conventions for websockets --- crates/lune-std-net/src/lib.rs | 4 +-- crates/lune-std-net/src/server/service.rs | 4 +-- crates/lune-std-net/src/websocket.rs | 42 ----------------------- 3 files changed, 4 insertions(+), 46 deletions(-) diff --git a/crates/lune-std-net/src/lib.rs b/crates/lune-std-net/src/lib.rs index 3f42889..47db8f7 100644 --- a/crates/lune-std-net/src/lib.rs +++ b/crates/lune-std-net/src/lib.rs @@ -65,9 +65,9 @@ async fn net_request(lua: &Lua, config: RequestConfig) -> LuaResult { res.await?.into_lua_table(lua) } -async fn net_socket(lua: &Lua, url: String) -> LuaResult { +async fn net_socket(lua: &Lua, url: String) -> LuaResult { let (ws, _) = tokio_tungstenite::connect_async(url).await.into_lua_err()?; - NetWebSocket::new(ws).into_lua_table(lua) + NetWebSocket::new(ws).into_lua(lua) } async fn net_serve<'lua>( diff --git a/crates/lune-std-net/src/server/service.rs b/crates/lune-std-net/src/server/service.rs index 7bc7e53..2787ca6 100644 --- a/crates/lune-std-net/src/server/service.rs +++ b/crates/lune-std-net/src/server/service.rs @@ -40,13 +40,13 @@ impl Service> for Svc { lua.spawn_local(async move { let sock = sock.await.unwrap(); let lua_sock = NetWebSocket::new(sock); - let lua_tab = lua_sock.into_lua_table(&lua_inner).unwrap(); + let lua_val = lua_sock.into_lua(&lua_inner).unwrap(); let handler_websocket: LuaFunction = keys.websocket_handler(&lua_inner).unwrap().unwrap(); lua_inner - .push_thread_back(handler_websocket, lua_tab) + .push_thread_back(handler_websocket, lua_val) .unwrap(); }); diff --git a/crates/lune-std-net/src/websocket.rs b/crates/lune-std-net/src/websocket.rs index ae2208a..0225451 100644 --- a/crates/lune-std-net/src/websocket.rs +++ b/crates/lune-std-net/src/websocket.rs @@ -23,29 +23,6 @@ use hyper_tungstenite::{ WebSocketStream, }; -use lune_utils::TableBuilder; - -// Wrapper implementation for compatibility and changing colon syntax to dot syntax -const WEB_SOCKET_IMPL_LUA: &str = r#" -return freeze(setmetatable({ - close = function(...) - return websocket:close(...) - end, - send = function(...) - return websocket:send(...) - end, - next = function(...) - return websocket:next(...) - end, -}, { - __index = function(self, key) - if key == "closeCode" then - return websocket.closeCode - end - end, -})) -"#; - #[derive(Debug)] pub struct NetWebSocket { close_code_exists: Arc, @@ -125,25 +102,6 @@ where let mut ws = self.write_stream.lock().await; ws.close().await.into_lua_err() } - - pub fn into_lua_table(self, lua: &Lua) -> LuaResult { - let setmetatable = lua.globals().get::<_, LuaFunction>("setmetatable")?; - let table_freeze = lua - .globals() - .get::<_, LuaTable>("table")? - .get::<_, LuaFunction>("freeze")?; - - let env = TableBuilder::new(lua)? - .with_value("websocket", self.clone())? - .with_value("setmetatable", setmetatable)? - .with_value("freeze", table_freeze)? - .build_readonly()?; - - lua.load(WEB_SOCKET_IMPL_LUA) - .set_name("websocket") - .set_environment(env) - .eval() - } } impl LuaUserData for NetWebSocket From 138221b93e0d1cb1bce2d06d190d30b0e25f5a24 Mon Sep 17 00:00:00 2001 From: Filip Tibell Date: Wed, 16 Oct 2024 22:00:33 +0200 Subject: [PATCH 12/12] Update websocket tests and types to use new calling convention --- tests/net/serve/websockets.luau | 14 +++++++------- tests/net/socket/basic.luau | 6 +++--- tests/net/socket/wss.luau | 4 ++-- tests/net/socket/wss_rw.luau | 8 ++++---- types/net.luau | 6 +++--- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/tests/net/serve/websockets.luau b/tests/net/serve/websockets.luau index ad53a38..51aea82 100644 --- a/tests/net/serve/websockets.luau +++ b/tests/net/serve/websockets.luau @@ -24,10 +24,10 @@ local handle = net.serve(PORT, { return "unreachable" end, handleWebSocket = function(socket) - local socketMessage = socket.next() + local socketMessage = socket:next() assert(socketMessage == REQUEST, "Invalid web socket request from client") - socket.send(RESPONSE) - socket.close() + socket:send(RESPONSE) + socket:close() end, }) @@ -43,19 +43,19 @@ end) local socket = net.socket(WS_URL) -socket.send(REQUEST) +socket:send(REQUEST) -local socketMessage = socket.next() +local socketMessage = socket:next() assert(socketMessage ~= nil, "Got no web socket response from server") assert(socketMessage == RESPONSE, "Invalid web socket response from server") -socket.close() +socket:close() task.cancel(thread2) -- Wait for the socket to close and make sure we can't send messages afterwards task.wait() -local success3, err2 = (pcall :: any)(socket.send, "") +local success3, err2 = (pcall :: any)(socket.send, socket, "") assert(not success3, "Sending messages after the socket has been closed should error") local message2 = tostring(err2) assert( diff --git a/tests/net/socket/basic.luau b/tests/net/socket/basic.luau index 2eb4a3b..aad61c5 100644 --- a/tests/net/socket/basic.luau +++ b/tests/net/socket/basic.luau @@ -8,17 +8,17 @@ assert(type(socket.send) == "function", "send must be a function") assert(type(socket.close) == "function", "close must be a function") -- Request to close the socket -socket.close() +socket:close() -- Drain remaining messages, until we got our close message -while socket.next() do +while socket:next() do end assert(type(socket.closeCode) == "number", "closeCode should exist after closing") assert(socket.closeCode == 1000, "closeCode should be 1000 after closing") local success, message = pcall(function() - socket.send("Hello, world!") + socket:send("Hello, world!") end) assert(not success, "send should fail after closing") diff --git a/tests/net/socket/wss.luau b/tests/net/socket/wss.luau index 6594d08..74afba3 100644 --- a/tests/net/socket/wss.luau +++ b/tests/net/socket/wss.luau @@ -8,7 +8,7 @@ local task = require("@lune/task") local socket = net.socket("wss://gateway.discord.gg/?v=10&encoding=json") while not socket.closeCode do - local response = socket.next() + local response = socket:next() if response then local decodeSuccess, decodeMessage = pcall(serde.decode, "json" :: "json", response) @@ -23,6 +23,6 @@ while not socket.closeCode do -- Close the connection after a second with the success close code task.wait(1) - socket.close(1000) + socket:close(1000) end end diff --git a/tests/net/socket/wss_rw.luau b/tests/net/socket/wss_rw.luau index fefb244..2f9d96c 100644 --- a/tests/net/socket/wss_rw.luau +++ b/tests/net/socket/wss_rw.luau @@ -10,7 +10,7 @@ local socket = net.socket("wss://gateway.discord.gg/?v=10&encoding=json") local spawnedThread = task.spawn(function() while not socket.closeCode do - socket.next() + socket:next() end end) @@ -23,9 +23,9 @@ end) task.wait(1) local payload = '{"op":1,"d":null}' -socket.send(payload) -socket.send(buffer.fromstring(payload)) -socket.close(1000) +socket:send(payload) +socket:send(buffer.fromstring(payload)) +socket:close(1000) task.cancel(delayedThread) task.cancel(spawnedThread) diff --git a/types/net.luau b/types/net.luau index e9b793e..7a7204b 100644 --- a/types/net.luau +++ b/types/net.luau @@ -173,9 +173,9 @@ export type ServeHandle = { ]=] export type WebSocket = { closeCode: number?, - close: (code: number?) -> (), - send: (message: (string | buffer)?, asBinaryMessage: boolean?) -> (), - next: () -> string?, + close: (self: WebSocket, code: number?) -> (), + send: (self: WebSocket, message: (string | buffer)?, asBinaryMessage: boolean?) -> (), + next: (self: WebSocket) -> string?, } --[=[