mirror of
https://github.com/lune-org/lune.git
synced 2025-04-10 21:40:54 +01:00
Merge branch 'main' into feature/process-stream
This commit is contained in:
commit
b1f9b1d9a7
22 changed files with 193 additions and 113 deletions
4
.gitattributes
vendored
4
.gitattributes
vendored
|
@ -1,9 +1,5 @@
|
||||||
* text=auto
|
* text=auto
|
||||||
|
|
||||||
# Temporarily highlight luau as normal lua files
|
|
||||||
# until we get native linguist support for Luau
|
|
||||||
*.luau linguist-language=Lua
|
|
||||||
|
|
||||||
# Ensure all lua files use LF
|
# Ensure all lua files use LF
|
||||||
*.lua eol=lf
|
*.lua eol=lf
|
||||||
*.luau eol=lf
|
*.luau eol=lf
|
||||||
|
|
10
CHANGELOG.md
10
CHANGELOG.md
|
@ -8,11 +8,11 @@ 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/),
|
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).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## Unreleased
|
## `0.8.6` - June 23rd, 2024
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Added a builtin API for hashing and calculating HMACs as part of the `serde` library
|
- Added a builtin API for hashing and calculating HMACs as part of the `serde` library ([#193])
|
||||||
|
|
||||||
Basic usage:
|
Basic usage:
|
||||||
|
|
||||||
|
@ -36,6 +36,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
By default, globals are injected and codegen is disabled.
|
By default, globals are injected and codegen is disabled.
|
||||||
Check the documentation for the `luau` standard library for more information.
|
Check the documentation for the `luau` standard library for more information.
|
||||||
|
|
||||||
|
- Implemented support for floor division operator / `__idiv` for the `Vector2` and `Vector3` types in the `roblox` standard library ([#196])
|
||||||
|
- Fixed the `_VERSION` global containing an incorrect Lune version string.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Sandboxing and codegen in the Luau VM is now fully enabled, resulting in up to 2x or faster code execution.
|
- Sandboxing and codegen in the Luau VM is now fully enabled, resulting in up to 2x or faster code execution.
|
||||||
|
@ -46,6 +49,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
- Fixed `__type` and `__tostring` metamethods on userdatas and tables not being respected when printed or formatted using `stdio.format`.
|
- Fixed `__type` and `__tostring` metamethods on userdatas and tables not being respected when printed or formatted using `stdio.format`.
|
||||||
|
|
||||||
|
[#193]: https://github.com/lune-org/lune/pull/193
|
||||||
|
[#196]: https://github.com/lune-org/lune/pull/196
|
||||||
|
|
||||||
## `0.8.5` - June 1st, 2024
|
## `0.8.5` - June 1st, 2024
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
32
Cargo.lock
generated
32
Cargo.lock
generated
|
@ -305,9 +305,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "blake3"
|
name = "blake3"
|
||||||
version = "1.5.1"
|
version = "1.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "30cca6d3674597c30ddf2c587bf8d9d65c9a84d2326d941cc79c9842dfe0ef52"
|
checksum = "0231f06152bf547e9c2b5194f247cd97aacf6dcd8b15d8e5ec0663f64580da87"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayref",
|
"arrayref",
|
||||||
"arrayvec 0.7.4",
|
"arrayvec 0.7.4",
|
||||||
|
@ -1504,7 +1504,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lune"
|
name = "lune"
|
||||||
version = "0.8.5"
|
version = "0.8.6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
|
@ -1533,7 +1533,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lune-roblox"
|
name = "lune-roblox"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"glam",
|
"glam",
|
||||||
"lune-utils",
|
"lune-utils",
|
||||||
|
@ -1550,7 +1550,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lune-std"
|
name = "lune-std"
|
||||||
version = "0.1.2"
|
version = "0.1.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"lune-std-datetime",
|
"lune-std-datetime",
|
||||||
"lune-std-fs",
|
"lune-std-fs",
|
||||||
|
@ -1572,7 +1572,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lune-std-datetime"
|
name = "lune-std-datetime"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"chrono_lc",
|
"chrono_lc",
|
||||||
|
@ -1583,7 +1583,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lune-std-fs"
|
name = "lune-std-fs"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bstr",
|
"bstr",
|
||||||
"lune-std-datetime",
|
"lune-std-datetime",
|
||||||
|
@ -1594,7 +1594,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lune-std-luau"
|
name = "lune-std-luau"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"lune-utils",
|
"lune-utils",
|
||||||
"mlua",
|
"mlua",
|
||||||
|
@ -1602,7 +1602,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lune-std-net"
|
name = "lune-std-net"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bstr",
|
"bstr",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
|
@ -1623,7 +1623,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lune-std-process"
|
name = "lune-std-process"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bstr",
|
"bstr",
|
||||||
"bytes",
|
"bytes",
|
||||||
|
@ -1638,7 +1638,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lune-std-regex"
|
name = "lune-std-regex"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"lune-utils",
|
"lune-utils",
|
||||||
"mlua",
|
"mlua",
|
||||||
|
@ -1648,7 +1648,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lune-std-roblox"
|
name = "lune-std-roblox"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"lune-roblox",
|
"lune-roblox",
|
||||||
"lune-utils",
|
"lune-utils",
|
||||||
|
@ -1660,7 +1660,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lune-std-serde"
|
name = "lune-std-serde"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-compression",
|
"async-compression",
|
||||||
"blake3",
|
"blake3",
|
||||||
|
@ -1683,7 +1683,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lune-std-stdio"
|
name = "lune-std-stdio"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dialoguer",
|
"dialoguer",
|
||||||
"lune-utils",
|
"lune-utils",
|
||||||
|
@ -1694,7 +1694,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lune-std-task"
|
name = "lune-std-task"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"lune-utils",
|
"lune-utils",
|
||||||
"mlua",
|
"mlua",
|
||||||
|
@ -1704,7 +1704,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lune-utils"
|
name = "lune-utils"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"console",
|
"console",
|
||||||
"dunce",
|
"dunce",
|
||||||
|
|
|
@ -33,7 +33,7 @@ Lune provides fully asynchronous APIs wherever possible, and is built in Rust
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- 🌙 Strictly minimal but powerful interface that is easy to read and remember, just like Luau itself
|
- 🌙 Strictly minimal but powerful interface that is easy to read and remember, just like Luau itself
|
||||||
- 🧰 Fully featured APIs for the filesystem, networking, stdio, all included in the small (~5mb) executable
|
- 🧰 Fully featured APIs for the filesystem, networking, stdio, all included in the small (~5mb zipped) executable
|
||||||
- 📚 World-class documentation, on the web _or_ directly in your editor, no network connection necessary
|
- 📚 World-class documentation, on the web _or_ directly in your editor, no network connection necessary
|
||||||
- 🏡 Familiar runtime environment for Roblox developers, with an included 1-to-1 task scheduler port
|
- 🏡 Familiar runtime environment for Roblox developers, with an included 1-to-1 task scheduler port
|
||||||
- ✏️ Optional built-in library for manipulating Roblox place & model files, and their instances
|
- ✏️ Optional built-in library for manipulating Roblox place & model files, and their instances
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "lune-roblox"
|
name = "lune-roblox"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
repository = "https://github.com/lune-org/lune"
|
repository = "https://github.com/lune-org/lune"
|
||||||
|
@ -26,4 +26,4 @@ rbx_reflection = "4.4.0"
|
||||||
rbx_reflection_database = "0.2.9"
|
rbx_reflection_database = "0.2.9"
|
||||||
rbx_xml = "0.13.2"
|
rbx_xml = "0.13.2"
|
||||||
|
|
||||||
lune-utils = { version = "0.1.0", path = "../lune-utils" }
|
lune-utils = { version = "0.1.2", path = "../lune-utils" }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "lune-std-datetime"
|
name = "lune-std-datetime"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
repository = "https://github.com/lune-org/lune"
|
repository = "https://github.com/lune-org/lune"
|
||||||
|
@ -19,4 +19,4 @@ thiserror = "1.0"
|
||||||
chrono = "0.4.38"
|
chrono = "0.4.38"
|
||||||
chrono_lc = "0.1.6"
|
chrono_lc = "0.1.6"
|
||||||
|
|
||||||
lune-utils = { version = "0.1.0", path = "../lune-utils" }
|
lune-utils = { version = "0.1.2", path = "../lune-utils" }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "lune-std-fs"
|
name = "lune-std-fs"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
repository = "https://github.com/lune-org/lune"
|
repository = "https://github.com/lune-org/lune"
|
||||||
|
@ -19,5 +19,5 @@ bstr = "1.9"
|
||||||
|
|
||||||
tokio = { version = "1", default-features = false, features = ["fs"] }
|
tokio = { version = "1", default-features = false, features = ["fs"] }
|
||||||
|
|
||||||
lune-utils = { version = "0.1.0", path = "../lune-utils" }
|
lune-utils = { version = "0.1.2", path = "../lune-utils" }
|
||||||
lune-std-datetime = { version = "0.1.0", path = "../lune-std-datetime" }
|
lune-std-datetime = { version = "0.1.1", path = "../lune-std-datetime" }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "lune-std-luau"
|
name = "lune-std-luau"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
repository = "https://github.com/lune-org/lune"
|
repository = "https://github.com/lune-org/lune"
|
||||||
|
@ -13,6 +13,6 @@ path = "src/lib.rs"
|
||||||
workspace = true
|
workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
mlua = { version = "0.9.7", features = ["luau"] }
|
mlua = { version = "0.9.7", features = ["luau", "luau-jit"] }
|
||||||
|
|
||||||
lune-utils = { version = "0.1.0", path = "../lune-utils" }
|
lune-utils = { version = "0.1.2", path = "../lune-utils" }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "lune-std-net"
|
name = "lune-std-net"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
repository = "https://github.com/lune-org/lune"
|
repository = "https://github.com/lune-org/lune"
|
||||||
|
@ -35,5 +35,5 @@ tokio = { version = "1", default-features = false, features = [
|
||||||
"macros",
|
"macros",
|
||||||
] }
|
] }
|
||||||
|
|
||||||
lune-utils = { version = "0.1.0", path = "../lune-utils" }
|
lune-utils = { version = "0.1.2", path = "../lune-utils" }
|
||||||
lune-std-serde = { version = "0.1.0", path = "../lune-std-serde" }
|
lune-std-serde = { version = "0.1.1", path = "../lune-std-serde" }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "lune-std-process"
|
name = "lune-std-process"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
repository = "https://github.com/lune-org/lune"
|
repository = "https://github.com/lune-org/lune"
|
||||||
|
@ -31,4 +31,4 @@ tokio = { version = "1", default-features = false, features = [
|
||||||
"sync",
|
"sync",
|
||||||
] }
|
] }
|
||||||
|
|
||||||
lune-utils = { version = "0.1.0", path = "../lune-utils" }
|
lune-utils = { version = "0.1.2", path = "../lune-utils" }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "lune-std-regex"
|
name = "lune-std-regex"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
repository = "https://github.com/lune-org/lune"
|
repository = "https://github.com/lune-org/lune"
|
||||||
|
@ -18,4 +18,4 @@ mlua = { version = "0.9.7", features = ["luau"] }
|
||||||
regex = "1.10"
|
regex = "1.10"
|
||||||
self_cell = "1.0"
|
self_cell = "1.0"
|
||||||
|
|
||||||
lune-utils = { version = "0.1.0", path = "../lune-utils" }
|
lune-utils = { version = "0.1.2", path = "../lune-utils" }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "lune-std-roblox"
|
name = "lune-std-roblox"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
repository = "https://github.com/lune-org/lune"
|
repository = "https://github.com/lune-org/lune"
|
||||||
|
@ -19,5 +19,5 @@ mlua-luau-scheduler = { version = "0.0.2", path = "../mlua-luau-scheduler" }
|
||||||
once_cell = "1.17"
|
once_cell = "1.17"
|
||||||
rbx_cookie = { version = "0.1.4", default-features = false }
|
rbx_cookie = { version = "0.1.4", default-features = false }
|
||||||
|
|
||||||
lune-utils = { version = "0.1.0", path = "../lune-utils" }
|
lune-utils = { version = "0.1.2", path = "../lune-utils" }
|
||||||
lune-roblox = { version = "0.1.1", path = "../lune-roblox" }
|
lune-roblox = { version = "0.1.2", path = "../lune-roblox" }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "lune-std-serde"
|
name = "lune-std-serde"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
repository = "https://github.com/lune-org/lune"
|
repository = "https://github.com/lune-org/lune"
|
||||||
|
@ -37,11 +37,11 @@ sha2 = "0.10.8"
|
||||||
sha3 = "0.10.8"
|
sha3 = "0.10.8"
|
||||||
# This feature MIGHT break due to the unstable nature of the digest crate.
|
# This feature MIGHT break due to the unstable nature of the digest crate.
|
||||||
# Check before updating it.
|
# Check before updating it.
|
||||||
blake3 = { version = "1.5.0", features = ["traits-preview"] }
|
blake3 = { version = "=1.5.0", features = ["traits-preview"] }
|
||||||
|
|
||||||
tokio = { version = "1", default-features = false, features = [
|
tokio = { version = "1", default-features = false, features = [
|
||||||
"rt",
|
"rt",
|
||||||
"io-util",
|
"io-util",
|
||||||
] }
|
] }
|
||||||
|
|
||||||
lune-utils = { version = "0.1.0", path = "../lune-utils" }
|
lune-utils = { version = "0.1.2", path = "../lune-utils" }
|
||||||
|
|
|
@ -35,12 +35,34 @@ enum HashAlgorithm {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HashAlgorithm {
|
impl HashAlgorithm {
|
||||||
pub fn list_all_as_string() -> String {
|
pub const ALL: [Self; 11] = [
|
||||||
[
|
Self::Md5,
|
||||||
"md5", "sha1", "sha224", "sha256", "sha384", "sha512", "sha3-224", "sha3-256",
|
Self::Sha1,
|
||||||
"sha3-384", "sha3-512", "blake3",
|
Self::Sha2_224,
|
||||||
]
|
Self::Sha2_256,
|
||||||
.join(", ")
|
Self::Sha2_384,
|
||||||
|
Self::Sha2_512,
|
||||||
|
Self::Sha3_224,
|
||||||
|
Self::Sha3_256,
|
||||||
|
Self::Sha3_384,
|
||||||
|
Self::Sha3_512,
|
||||||
|
Self::Blake3,
|
||||||
|
];
|
||||||
|
|
||||||
|
pub const fn name(self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
Self::Md5 => "md5",
|
||||||
|
Self::Sha1 => "sha1",
|
||||||
|
Self::Sha2_224 => "sha224",
|
||||||
|
Self::Sha2_256 => "sha256",
|
||||||
|
Self::Sha2_384 => "sha384",
|
||||||
|
Self::Sha2_512 => "sha512",
|
||||||
|
Self::Sha3_224 => "sha3-224",
|
||||||
|
Self::Sha3_256 => "sha3-256",
|
||||||
|
Self::Sha3_384 => "sha3-384",
|
||||||
|
Self::Sha3_512 => "sha3-512",
|
||||||
|
Self::Blake3 => "blake3",
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,15 +186,15 @@ impl<'lua> FromLua<'lua> for HashAlgorithm {
|
||||||
"md5" => Ok(Self::Md5),
|
"md5" => Ok(Self::Md5),
|
||||||
"sha1" => Ok(Self::Sha1),
|
"sha1" => Ok(Self::Sha1),
|
||||||
|
|
||||||
"sha224" => Ok(Self::Sha2_224),
|
"sha2-224" | "sha2_224" | "sha224" => Ok(Self::Sha2_224),
|
||||||
"sha256" => Ok(Self::Sha2_256),
|
"sha2-256" | "sha2_256" | "sha256" => Ok(Self::Sha2_256),
|
||||||
"sha384" => Ok(Self::Sha2_384),
|
"sha2-384" | "sha2_384" | "sha384" => Ok(Self::Sha2_384),
|
||||||
"sha512" => Ok(Self::Sha2_512),
|
"sha2-512" | "sha2_512" | "sha512" => Ok(Self::Sha2_512),
|
||||||
|
|
||||||
"sha3-224" => Ok(Self::Sha3_224),
|
"sha3-224" | "sha3_224" => Ok(Self::Sha3_224),
|
||||||
"sha3-256" => Ok(Self::Sha3_256),
|
"sha3-256" | "sha3_256" => Ok(Self::Sha3_256),
|
||||||
"sha3-384" => Ok(Self::Sha3_384),
|
"sha3-384" | "sha3_384" => Ok(Self::Sha3_384),
|
||||||
"sha3-512" => Ok(Self::Sha3_512),
|
"sha3-512" | "sha3_512" => Ok(Self::Sha3_512),
|
||||||
|
|
||||||
"blake3" => Ok(Self::Blake3),
|
"blake3" => Ok(Self::Blake3),
|
||||||
|
|
||||||
|
@ -181,7 +203,11 @@ impl<'lua> FromLua<'lua> for HashAlgorithm {
|
||||||
to: "HashAlgorithm",
|
to: "HashAlgorithm",
|
||||||
message: Some(format!(
|
message: Some(format!(
|
||||||
"Invalid hashing algorithm '{str}', valid kinds are:\n{}",
|
"Invalid hashing algorithm '{str}', valid kinds are:\n{}",
|
||||||
HashAlgorithm::list_all_as_string()
|
HashAlgorithm::ALL
|
||||||
|
.into_iter()
|
||||||
|
.map(HashAlgorithm::name)
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
.join(", ")
|
||||||
)),
|
)),
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "lune-std-stdio"
|
name = "lune-std-stdio"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
repository = "https://github.com/lune-org/lune"
|
repository = "https://github.com/lune-org/lune"
|
||||||
|
@ -22,4 +22,4 @@ tokio = { version = "1", default-features = false, features = [
|
||||||
"io-util",
|
"io-util",
|
||||||
] }
|
] }
|
||||||
|
|
||||||
lune-utils = { version = "0.1.0", path = "../lune-utils" }
|
lune-utils = { version = "0.1.2", path = "../lune-utils" }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "lune-std-task"
|
name = "lune-std-task"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
repository = "https://github.com/lune-org/lune"
|
repository = "https://github.com/lune-org/lune"
|
||||||
|
@ -18,4 +18,4 @@ mlua-luau-scheduler = { version = "0.0.2", path = "../mlua-luau-scheduler" }
|
||||||
|
|
||||||
tokio = { version = "1", default-features = false, features = ["time"] }
|
tokio = { version = "1", default-features = false, features = ["time"] }
|
||||||
|
|
||||||
lune-utils = { version = "0.1.0", path = "../lune-utils" }
|
lune-utils = { version = "0.1.2", path = "../lune-utils" }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "lune-std"
|
name = "lune-std"
|
||||||
version = "0.1.2"
|
version = "0.1.3"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
repository = "https://github.com/lune-org/lune"
|
repository = "https://github.com/lune-org/lune"
|
||||||
|
@ -45,15 +45,15 @@ serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
tokio = { version = "1", default-features = false, features = ["fs", "sync"] }
|
tokio = { version = "1", default-features = false, features = ["fs", "sync"] }
|
||||||
|
|
||||||
lune-utils = { version = "0.1.1", path = "../lune-utils" }
|
lune-utils = { version = "0.1.2", path = "../lune-utils" }
|
||||||
|
|
||||||
lune-std-datetime = { optional = true, version = "0.1.1", path = "../lune-std-datetime" }
|
lune-std-datetime = { optional = true, version = "0.1.2", path = "../lune-std-datetime" }
|
||||||
lune-std-fs = { optional = true, version = "0.1.0", path = "../lune-std-fs" }
|
lune-std-fs = { optional = true, version = "0.1.1", path = "../lune-std-fs" }
|
||||||
lune-std-luau = { optional = true, version = "0.1.0", path = "../lune-std-luau" }
|
lune-std-luau = { optional = true, version = "0.1.1", path = "../lune-std-luau" }
|
||||||
lune-std-net = { optional = true, version = "0.1.0", path = "../lune-std-net" }
|
lune-std-net = { optional = true, version = "0.1.1", path = "../lune-std-net" }
|
||||||
lune-std-process = { optional = true, version = "0.1.1", path = "../lune-std-process" }
|
lune-std-process = { optional = true, version = "0.1.2", path = "../lune-std-process" }
|
||||||
lune-std-regex = { optional = true, version = "0.1.0", path = "../lune-std-regex" }
|
lune-std-regex = { optional = true, version = "0.1.1", path = "../lune-std-regex" }
|
||||||
lune-std-roblox = { optional = true, version = "0.1.1", path = "../lune-std-roblox" }
|
lune-std-roblox = { optional = true, version = "0.1.2", path = "../lune-std-roblox" }
|
||||||
lune-std-serde = { optional = true, version = "0.1.0", path = "../lune-std-serde" }
|
lune-std-serde = { optional = true, version = "0.1.1", path = "../lune-std-serde" }
|
||||||
lune-std-stdio = { optional = true, version = "0.1.0", path = "../lune-std-stdio" }
|
lune-std-stdio = { optional = true, version = "0.1.1", path = "../lune-std-stdio" }
|
||||||
lune-std-task = { optional = true, version = "0.1.0", path = "../lune-std-task" }
|
lune-std-task = { optional = true, version = "0.1.1", path = "../lune-std-task" }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "lune-utils"
|
name = "lune-utils"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
repository = "https://github.com/lune-org/lune"
|
repository = "https://github.com/lune-org/lune"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "lune"
|
name = "lune"
|
||||||
version = "0.8.5"
|
version = "0.8.6"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
repository = "https://github.com/lune-org/lune"
|
repository = "https://github.com/lune-org/lune"
|
||||||
|
@ -71,9 +71,9 @@ reqwest = { version = "0.11", default-features = false, features = [
|
||||||
"rustls-tls",
|
"rustls-tls",
|
||||||
] }
|
] }
|
||||||
|
|
||||||
lune-std = { optional = true, version = "0.1.2", path = "../lune-std" }
|
lune-std = { optional = true, version = "0.1.3", path = "../lune-std" }
|
||||||
lune-roblox = { optional = true, version = "0.1.1", path = "../lune-roblox" }
|
lune-roblox = { optional = true, version = "0.1.2", path = "../lune-roblox" }
|
||||||
lune-utils = { version = "0.1.1", path = "../lune-utils" }
|
lune-utils = { version = "0.1.2", path = "../lune-utils" }
|
||||||
|
|
||||||
### CLI
|
### CLI
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,7 @@ impl RuntimeInner {
|
||||||
feature = "std-task",
|
feature = "std-task",
|
||||||
))]
|
))]
|
||||||
{
|
{
|
||||||
|
lune_std::set_global_version(lua, env!("CARGO_PKG_VERSION"));
|
||||||
lune_std::inject_globals(lua)?;
|
lune_std::inject_globals(lua)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -180,7 +180,7 @@ export type Regex = typeof(Regex)
|
||||||
### Example usage
|
### Example usage
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
local Regex = require("@lune/regex")
|
local Regex = require("@lune/regex")
|
||||||
|
|
||||||
local re = Regex.new("hello")
|
local re = Regex.new("hello")
|
||||||
|
|
||||||
|
|
111
types/serde.luau
111
types/serde.luau
|
@ -1,7 +1,58 @@
|
||||||
|
--[=[
|
||||||
|
@within Serde
|
||||||
|
@interface EncodeDecodeFormat
|
||||||
|
|
||||||
|
A serialization/deserialization format supported by the Serde library.
|
||||||
|
|
||||||
|
Currently supported formats:
|
||||||
|
|
||||||
|
| Name | Learn More |
|
||||||
|
|:-------|:---------------------|
|
||||||
|
| `json` | https://www.json.org |
|
||||||
|
| `yaml` | https://yaml.org |
|
||||||
|
| `toml` | https://toml.io |
|
||||||
|
]=]
|
||||||
export type EncodeDecodeFormat = "json" | "yaml" | "toml"
|
export type EncodeDecodeFormat = "json" | "yaml" | "toml"
|
||||||
|
|
||||||
|
--[=[
|
||||||
|
@within Serde
|
||||||
|
@interface CompressDecompressFormat
|
||||||
|
|
||||||
|
A compression/decompression format supported by the Serde library.
|
||||||
|
|
||||||
|
Currently supported formats:
|
||||||
|
|
||||||
|
| Name | Learn More |
|
||||||
|
|:---------|:----------------------------------|
|
||||||
|
| `brotli` | https://github.com/google/brotli |
|
||||||
|
| `gzip` | https://www.gnu.org/software/gzip |
|
||||||
|
| `lz4` | https://github.com/lz4/lz4 |
|
||||||
|
| `zlib` | https://www.zlib.net |
|
||||||
|
]=]
|
||||||
export type CompressDecompressFormat = "brotli" | "gzip" | "lz4" | "zlib"
|
export type CompressDecompressFormat = "brotli" | "gzip" | "lz4" | "zlib"
|
||||||
|
|
||||||
|
--[=[
|
||||||
|
@within Serde
|
||||||
|
@interface HashAlgorithm
|
||||||
|
|
||||||
|
A hash algorithm supported by the Serde library.
|
||||||
|
|
||||||
|
Currently supported algorithms:
|
||||||
|
|
||||||
|
| Name | Learn More |
|
||||||
|
|:-----------|:-------------------------------------|
|
||||||
|
| `md5` | https://en.wikipedia.org/wiki/MD5 |
|
||||||
|
| `sha1` | https://en.wikipedia.org/wiki/SHA-1 |
|
||||||
|
| `sha224` | https://en.wikipedia.org/wiki/SHA-2 |
|
||||||
|
| `sha256` | https://en.wikipedia.org/wiki/SHA-2 |
|
||||||
|
| `sha384` | https://en.wikipedia.org/wiki/SHA-2 |
|
||||||
|
| `sha512` | https://en.wikipedia.org/wiki/SHA-2 |
|
||||||
|
| `sha3-224` | https://en.wikipedia.org/wiki/SHA-3 |
|
||||||
|
| `sha3-256` | https://en.wikipedia.org/wiki/SHA-3 |
|
||||||
|
| `sha3-384` | https://en.wikipedia.org/wiki/SHA-3 |
|
||||||
|
| `sha3-512` | https://en.wikipedia.org/wiki/SHA-3 |
|
||||||
|
| `blake3` | https://en.wikipedia.org/wiki/BLAKE3 |
|
||||||
|
]=]
|
||||||
export type HashAlgorithm =
|
export type HashAlgorithm =
|
||||||
"md5"
|
"md5"
|
||||||
| "sha1"
|
| "sha1"
|
||||||
|
@ -48,13 +99,7 @@ local serde = {}
|
||||||
|
|
||||||
Encodes the given value using the given format.
|
Encodes the given value using the given format.
|
||||||
|
|
||||||
Currently supported formats:
|
See [`EncodeDecodeFormat`] for a list of supported formats.
|
||||||
|
|
||||||
| Name | Learn More |
|
|
||||||
|:-------|:---------------------|
|
|
||||||
| `json` | https://www.json.org |
|
|
||||||
| `yaml` | https://yaml.org |
|
|
||||||
| `toml` | https://toml.io |
|
|
||||||
|
|
||||||
@param format The format to use
|
@param format The format to use
|
||||||
@param value The value to encode
|
@param value The value to encode
|
||||||
|
@ -71,13 +116,7 @@ end
|
||||||
|
|
||||||
Decodes the given string using the given format into a lua value.
|
Decodes the given string using the given format into a lua value.
|
||||||
|
|
||||||
Currently supported formats:
|
See [`EncodeDecodeFormat`] for a list of supported formats.
|
||||||
|
|
||||||
| Name | Learn More |
|
|
||||||
|:-------|:---------------------|
|
|
||||||
| `json` | https://www.json.org |
|
|
||||||
| `yaml` | https://yaml.org |
|
|
||||||
| `toml` | https://toml.io |
|
|
||||||
|
|
||||||
@param format The format to use
|
@param format The format to use
|
||||||
@param encoded The string to decode
|
@param encoded The string to decode
|
||||||
|
@ -93,14 +132,7 @@ end
|
||||||
|
|
||||||
Compresses the given string using the given format.
|
Compresses the given string using the given format.
|
||||||
|
|
||||||
Currently supported formats:
|
See [`CompressDecompressFormat`] for a list of supported formats.
|
||||||
|
|
||||||
| Name | Learn More |
|
|
||||||
|:---------|:----------------------------------|
|
|
||||||
| `brotli` | https://github.com/google/brotli |
|
|
||||||
| `gzip` | https://www.gnu.org/software/gzip |
|
|
||||||
| `lz4` | https://github.com/lz4/lz4 |
|
|
||||||
| `zlib` | https://www.zlib.net |
|
|
||||||
|
|
||||||
@param format The format to use
|
@param format The format to use
|
||||||
@param s The string to compress
|
@param s The string to compress
|
||||||
|
@ -116,14 +148,7 @@ end
|
||||||
|
|
||||||
Decompresses the given string using the given format.
|
Decompresses the given string using the given format.
|
||||||
|
|
||||||
Currently supported formats:
|
See [`CompressDecompressFormat`] for a list of supported formats.
|
||||||
|
|
||||||
| Name | Learn More |
|
|
||||||
|:---------|:----------------------------------|
|
|
||||||
| `brotli` | https://github.com/google/brotli |
|
|
||||||
| `gzip` | https://www.gnu.org/software/gzip |
|
|
||||||
| `lz4` | https://github.com/lz4/lz4 |
|
|
||||||
| `zlib` | https://www.zlib.net |
|
|
||||||
|
|
||||||
@param format The format to use
|
@param format The format to use
|
||||||
@param s The string to decompress
|
@param s The string to decompress
|
||||||
|
@ -133,10 +158,36 @@ function serde.decompress(format: CompressDecompressFormat, s: buffer | string):
|
||||||
return nil :: any
|
return nil :: any
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[=[
|
||||||
|
@within Serde
|
||||||
|
@tag must_use
|
||||||
|
|
||||||
|
Hashes the given message using the given algorithm
|
||||||
|
and returns the hash as a hex string.
|
||||||
|
|
||||||
|
See [`HashAlgorithm`] for a list of supported algorithms.
|
||||||
|
|
||||||
|
@param algorithm The algorithm to use
|
||||||
|
@param message The message to hash
|
||||||
|
@return The hash as a hex string
|
||||||
|
]=]
|
||||||
function serde.hash(algorithm: HashAlgorithm, message: string | buffer): string
|
function serde.hash(algorithm: HashAlgorithm, message: string | buffer): string
|
||||||
return nil :: any
|
return nil :: any
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[=[
|
||||||
|
@within Serde
|
||||||
|
@tag must_use
|
||||||
|
|
||||||
|
Hashes the given message using HMAC with the given secret
|
||||||
|
and algorithm, returning the hash as a base64 string.
|
||||||
|
|
||||||
|
See [`HashAlgorithm`] for a list of supported algorithms.
|
||||||
|
|
||||||
|
@param algorithm The algorithm to use
|
||||||
|
@param message The message to hash
|
||||||
|
@return The hash as a base64 string
|
||||||
|
]=]
|
||||||
function serde.hmac(
|
function serde.hmac(
|
||||||
algorithm: HashAlgorithm,
|
algorithm: HashAlgorithm,
|
||||||
message: string | buffer,
|
message: string | buffer,
|
||||||
|
|
Loading…
Add table
Reference in a new issue