diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2444c37..b60e128 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -64,9 +64,13 @@ jobs: cargo-target: x86_64-unknown-linux-gnu - name: macOS x86_64 - runner-os: macos-latest + runner-os: macos-13 cargo-target: x86_64-apple-darwin - timeout-minutes: 10 + + - name: macOS aarch64 + runner-os: macos-14 + cargo-target: aarch64-apple-darwin + name: CI - ${{ matrix.name }} runs-on: ${{ matrix.runner-os }} steps: diff --git a/CHANGELOG.md b/CHANGELOG.md index cf23c65..091b0c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,22 @@ 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.3` - April 15th, 2024 + +### Fixed + +- Fixed `require` not throwing syntax errors ([#168]) +- Fixed `require` caching not working correctly ([#171]) +- Fixed case-sensitivity issue in `require` with aliases ([#173]) +- Fixed `itertools` dependency being marked optional even though it is mandatory ([#176]) +- Fixed test cases for the `net` built-in library on Windows ([#177]) + +[#168]: https://github.com/lune-org/lune/pull/168 +[#171]: https://github.com/lune-org/lune/pull/171 +[#173]: https://github.com/lune-org/lune/pull/173 +[#176]: https://github.com/lune-org/lune/pull/176 +[#177]: https://github.com/lune-org/lune/pull/177 + ## `0.8.2` - March 12th, 2024 ### Fixed diff --git a/Cargo.lock b/Cargo.lock index 39ce212..8e17080 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -130,9 +130,9 @@ checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "async-channel" -version = "2.2.0" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f28243a43d821d11341ab73c80bed182dc015c514b951616cf79bd4af39af0c3" +checksum = "136d4d23bcc79e27423727b36823d86233aad06dfea531837b038394d11e9928" dependencies = [ "concurrent-queue", "event-listener 5.3.0", @@ -157,11 +157,10 @@ dependencies = [ [[package]] name = "async-executor" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f98c37cf288e302c16ef6c8472aad1e034c6c84ce5ea7b8101c98eb4a802fee" +checksum = "b10202063978b3351199d68f8b22c4e47e4b1b822f8d43fd862d5ea8c006b29a" dependencies = [ - "async-lock", "async-task", "concurrent-queue", "fastrand", @@ -194,7 +193,7 @@ checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -360,9 +359,9 @@ checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "cc" -version = "1.0.92" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2678b2e3449475e95b0aa6f9b506a28e61b3dc8996592b983695e8ebb58a8b41" +checksum = "17f6e324229dc011159fcc089755d1e2e216a90d43a7dea6853ca740b84f35e7" [[package]] name = "cfg-if" @@ -387,7 +386,7 @@ dependencies = [ "js-sys", "num-traits", "wasm-bindgen", - "windows-targets 0.52.4", + "windows-targets 0.52.5", ] [[package]] @@ -436,7 +435,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -663,9 +662,9 @@ checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" [[package]] name = "either" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" +checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2" [[package]] name = "encode_unicode" @@ -868,7 +867,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -938,9 +937,9 @@ checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "glam" -version = "0.25.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "151665d9be52f9bb40fc7966565d39666f2d1e69233571b71b87791c7e0528b3" +checksum = "9e05e7e6723e3455f4818c7b26e855439f7546cf617ef669d1adedb8669e5cb9" [[package]] name = "glob" @@ -1113,9 +1112,9 @@ dependencies = [ [[package]] name = "hyper" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "186548d73ac615b32a73aafe38fb4f56c0d340e110e5a200bcadbaf2e199263a" +checksum = "9f24ce812868d86d19daa79bf3bf9175bc44ea323391147a5e3abde2a283871b" dependencies = [ "bytes", "futures-channel", @@ -1153,7 +1152,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a343d17fe7885302ed7252767dc7bb83609a874b6ff581142241ec4b73957ad" dependencies = [ "http-body-util", - "hyper 1.2.0", + "hyper 1.3.0", "hyper-util", "pin-project-lite", "tokio", @@ -1172,7 +1171,7 @@ dependencies = [ "futures-util", "http 1.1.0", "http-body 1.0.0", - "hyper 1.2.0", + "hyper 1.3.0", "pin-project-lite", "socket2", "tokio", @@ -1293,7 +1292,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19" dependencies = [ "cfg-if", - "windows-targets 0.52.4", + "windows-targets 0.52.5", ] [[package]] @@ -1345,7 +1344,7 @@ dependencies = [ [[package]] name = "lune" -version = "0.8.2" +version = "0.8.3" dependencies = [ "anyhow", "async-compression", @@ -1363,7 +1362,7 @@ dependencies = [ "glam", "http 1.1.0", "http-body-util", - "hyper 1.2.0", + "hyper 1.3.0", "hyper-tungstenite", "hyper-util", "include_dir", @@ -1694,7 +1693,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -1760,9 +1759,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.79" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" +checksum = "a56dea16b0a29e94408b9aa5e2940a4eedbd128a1ba20e8f7ae60fd3d465af0e" dependencies = [ "unicode-ident", ] @@ -1783,7 +1782,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8021cf59c8ec9c432cfc2526ac6b8aa508ecaf29cd415f271b8406c1b851c3fd" dependencies = [ "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -2313,7 +2312,7 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -2532,9 +2531,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.58" +version = "2.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44cfb93f38070beee36b3fef7d4f5a16f27751d94b187b666a5cc5e9b0d30687" +checksum = "4a6531ffc7b071655e4ce2e04bd464c4830bb585a61cabb96cf808f05172615a" dependencies = [ "proc-macro2", "quote", @@ -2597,7 +2596,7 @@ checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -2722,7 +2721,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -2859,7 +2858,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", ] [[package]] @@ -3082,7 +3081,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", "wasm-bindgen-shared", ] @@ -3116,7 +3115,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.59", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3189,7 +3188,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.4", + "windows-targets 0.52.5", ] [[package]] @@ -3207,7 +3206,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.4", + "windows-targets 0.52.5", ] [[package]] @@ -3227,17 +3226,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" dependencies = [ - "windows_aarch64_gnullvm 0.52.4", - "windows_aarch64_msvc 0.52.4", - "windows_i686_gnu 0.52.4", - "windows_i686_msvc 0.52.4", - "windows_x86_64_gnu 0.52.4", - "windows_x86_64_gnullvm 0.52.4", - "windows_x86_64_msvc 0.52.4", + "windows_aarch64_gnullvm 0.52.5", + "windows_aarch64_msvc 0.52.5", + "windows_i686_gnu 0.52.5", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.5", + "windows_x86_64_gnu 0.52.5", + "windows_x86_64_gnullvm 0.52.5", + "windows_x86_64_msvc 0.52.5", ] [[package]] @@ -3248,9 +3248,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" [[package]] name = "windows_aarch64_msvc" @@ -3260,9 +3260,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" [[package]] name = "windows_i686_gnu" @@ -3272,9 +3272,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" [[package]] name = "windows_i686_msvc" @@ -3284,9 +3290,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" [[package]] name = "windows_x86_64_gnu" @@ -3296,9 +3302,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" [[package]] name = "windows_x86_64_gnullvm" @@ -3308,9 +3314,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" [[package]] name = "windows_x86_64_msvc" @@ -3320,9 +3326,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" [[package]] name = "winnow" diff --git a/Cargo.toml b/Cargo.toml index 0c7b411..11c2ee9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lune" -version = "0.8.2" +version = "0.8.3" edition = "2021" license = "MPL-2.0" repository = "https://github.com/lune-org/lune" @@ -139,7 +139,7 @@ rustyline = { optional = true, version = "14.0" } ### ROBLOX -glam = { optional = true, version = "0.25" } +glam = { optional = true, version = "0.27" } rand = { optional = true, version = "0.8" } rbx_cookie = { optional = true, version = "0.1.4", default-features = false } diff --git a/src/lune/globals/require/path.rs b/src/lune/globals/require/path.rs index 3777b7e..7e8084f 100644 --- a/src/lune/globals/require/path.rs +++ b/src/lune/globals/require/path.rs @@ -1,6 +1,7 @@ use std::path::{Path, PathBuf}; use mlua::prelude::*; +use mlua::Error::ExternalError; use super::context::*; @@ -27,26 +28,33 @@ where 'lua: 'ctx, { // 1. Try to require the exact path - if let Ok(res) = require_inner(lua, ctx, &abs_path, &rel_path).await { - return Ok(res); + match require_inner(lua, ctx, &abs_path, &rel_path).await { + Ok(res) => return Ok(res), + Err(err) => { + if !is_file_not_found_error(&err) { + return Err(err); + } + } } // 2. Try to require the path with an added "luau" extension - let (luau_abs_path, luau_rel_path) = ( - append_extension(&abs_path, "luau"), - append_extension(&rel_path, "luau"), - ); - if let Ok(res) = require_inner(lua, ctx, &luau_abs_path, &luau_rel_path).await { - return Ok(res); - } - // 3. Try to require the path with an added "lua" extension - let (lua_abs_path, lua_rel_path) = ( - append_extension(&abs_path, "lua"), - append_extension(&rel_path, "lua"), - ); - if let Ok(res) = require_inner(lua, ctx, &lua_abs_path, &lua_rel_path).await { - return Ok(res); + for extension in ["luau", "lua"] { + match require_inner( + lua, + ctx, + &append_extension(&abs_path, extension), + &append_extension(&rel_path, extension), + ) + .await + { + Ok(res) => return Ok(res), + Err(err) => { + if !is_file_not_found_error(&err) { + return Err(err); + } + } + } } // We didn't find any direct file paths, look @@ -55,21 +63,23 @@ where let rel_init = rel_path.join("init"); // 4. Try to require the init path with an added "luau" extension - let (luau_abs_init, luau_rel_init) = ( - append_extension(&abs_init, "luau"), - append_extension(&rel_init, "luau"), - ); - if let Ok(res) = require_inner(lua, ctx, &luau_abs_init, &luau_rel_init).await { - return Ok(res); - } - // 5. Try to require the init path with an added "lua" extension - let (lua_abs_init, lua_rel_init) = ( - append_extension(&abs_init, "lua"), - append_extension(&rel_init, "lua"), - ); - if let Ok(res) = require_inner(lua, ctx, &lua_abs_init, &lua_rel_init).await { - return Ok(res); + for extension in ["luau", "lua"] { + match require_inner( + lua, + ctx, + &append_extension(&abs_init, extension), + &append_extension(&rel_init, extension), + ) + .await + { + Ok(res) => return Ok(res), + Err(err) => { + if !is_file_not_found_error(&err) { + return Err(err); + } + } + } } // Nothing left to try, throw an error @@ -109,3 +119,11 @@ fn append_extension(path: impl Into, ext: &'static str) -> PathBuf { }; new } + +fn is_file_not_found_error(err: &LuaError) -> bool { + if let ExternalError(err) = err { + err.as_ref().downcast_ref::().is_some() + } else { + false + } +} diff --git a/src/lune/util/formatting.rs b/src/lune/util/formatting.rs index 8ca4b0c..ca2573c 100644 --- a/src/lune/util/formatting.rs +++ b/src/lune/util/formatting.rs @@ -130,7 +130,7 @@ pub fn pretty_format_value( } else if let Some(s) = call_table_tostring_metamethod(tab) { write!(buffer, "{s}")?; } else if depth >= 1 && parent_table_addr.eq(&table_addr) { - write!(buffer, "{}", STYLE_DIM.apply_to(""))? + write!(buffer, "{}", STYLE_DIM.apply_to(""))?; } else { let mut is_empty = false; let depth_indent = INDENT.repeat(depth); @@ -148,7 +148,12 @@ pub fn pretty_format_value( )?, _ => { write!(buffer, "\n{depth_indent}{INDENT}[")?; - pretty_format_value(buffer, &key, parent_table_addr.clone(), depth)?; + pretty_format_value( + buffer, + &key, + parent_table_addr.clone(), + depth + 1, + )?; write!(buffer, "] {} ", STYLE_DIM.apply_to("="))?; } }