Skip to content

Commit

Permalink
Version 0.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
filiptibell committed Feb 25, 2023
1 parent c839172 commit 7d75d5c
Show file tree
Hide file tree
Showing 9 changed files with 313 additions and 41 deletions.
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,37 @@ 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.5.1` - February 25th, 2023

### Added

- Added `net.encode` and `net.decode` which are equivalent to `net.jsonEncode` and `net.jsonDecode`, but with support for more formats.

**_WARNING: Unstable API_**

_This API is unstable and may change or be removed in the next major version of Lune. The purpose of making a new release with these functions is to gather feedback from the community, and potentially replace the JSON-specific encoding and decoding utilities._

Example usage:

```lua
local toml = net.decode("toml", [[
[package]
name = "my-cool-toml-package"
version = "0.1.0"
[values]
epic = true
]])

assert(toml.package.name == "my-cool-toml-package")
assert(toml.package.version == "0.1.0")
assert(toml.values.epic == true)
```

### Fixed

- Fixed indentation of closing curly bracket when printing tables

## `0.5.0` - February 23rd, 2023

### Added
Expand Down
54 changes: 54 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 20 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
members = ["packages/cli", "packages/lib"]
default-members = ["packages/cli"]

# Package config values shared across all packages,
# such as version, license, and other metadata
[workspace.package]
version = "0.5.0"
edition = "2021"
Expand All @@ -12,23 +14,32 @@ readme = "README.md"
keywords = ["cli", "lua", "luau", "scripts"]
categories = ["command-line-interface"]

# Shared dependencies that are used across 2 or more packages
# These are declared here to ensure consistent versioning
[workspace.dependencies]
console = "0.15"
futures-util = "0.3"
lazy_static = "1.4"

# Serde dependencies, supporting user-facing formats: json, yaml, toml
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0", features = ["preserve_order"] }
serde_yaml = "0.9"
tokio = { version = "1.24", features = ["full"] }
toml = { version = "0.7", features = ["preserve_order"] }

[workspace.dependencies.reqwest]
version = "0.11"
default-features = false
features = ["rustls-tls"]
# Tokio runtime & async clients
tokio = { version = "1.24", features = ["full"] }
reqwest = { version = "0.11", default-features = false, features = [
"rustls-tls",
] }

# Profile for building the release binary, with the following options set:
# 1. Optimize for size
# 2. Automatically strip symbols from the binary
# 3. Enable link-time optimization
# 4. Remove extra panic info
[profile.release]
strip = true # Automatically strip symbols from the binary.
opt-level = "z" # Optimize for size.
lto = true # Enable link-time optimization
panic = "abort" # Remove extra panic info
opt-level = "z"
strip = true
lto = true
panic = "abort"
73 changes: 53 additions & 20 deletions docs/luneTypes.d.luau
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export type FsWriteOptions = {

--[=[
@class FS
Filesystem
]=]
declare fs: {
Expand All @@ -40,7 +40,7 @@ declare fs: {
@must_use
Reads entries in a directory at `path`.
An error will be thrown in the following situations:
* `path` does not point to an existing directory.
Expand Down Expand Up @@ -146,9 +146,9 @@ declare fs: {
Throws an error if a file or directory already exists at the target path.
This can be bypassed by passing `true` as the third argument, or a dictionary of options.
Refer to the documentation for `FsWriteOptions` for specific option keys and their values.
An error will be thrown in the following situations:
* The current process lacks permissions to read at `from` or write at `to`.
* The new path exists on a different mount point.
* Some other I/O error occurred.
Expand All @@ -162,6 +162,8 @@ declare fs: {

type NetMethod = "GET" | "POST" | "PUT" | "DELETE" | "HEAD" | "OPTIONS" | "PATCH"

type NetEncodeDecodeFormat = "json" | "yaml" | "toml"

--[=[
@type NetFetchParams
@within Net
Expand Down Expand Up @@ -231,7 +233,7 @@ export type NetRequest = {
--[=[
@type NetRequest
@within Net
Response type for requests in `net.serve`.
This is a dictionary that may contain one or more of the following values:
Expand Down Expand Up @@ -280,7 +282,7 @@ export type NetServeHandle = {
@within Net
A reference to a web socket connection.
The web socket may be in either an "open" or a "closed" state, changing its current behavior.
When open:
Expand Down Expand Up @@ -311,7 +313,7 @@ declare net: {
@within Net
Sends an HTTP request using the given url and / or parameters, and returns a dictionary that describes the response received.
Only throws an error if a miscellaneous network or I/O error occurs, never for unsuccessful status codes.
@param config The URL or request config to use
Expand All @@ -323,7 +325,7 @@ declare net: {
@must_use
Connects to a web socket at the given URL.
Throws an error if the server at the given URL does not support
web sockets, or if a miscellaneous network or I/O error occurs.
Expand Down Expand Up @@ -364,6 +366,37 @@ declare net: {
@return The decoded lua value
]=]
jsonDecode: (encoded: string) -> any,
--[=[
@within Net
@must_use
***WARNING:** Unstable API*
*This API is unstable and may change or be removed in the next major version of Lune.*
Encodes the given value using the given format.
@param format The format to use
@param value The value to encode
@param pretty If the encoded string should be human-readable, including things such as newlines and spaces. Only supported for json and toml formats, and defaults to false
@return The encoded string
]=]
encode: (format: NetEncodeDecodeFormat, value: any, pretty: boolean?) -> string,
--[=[
@within Net
@must_use
***WARNING:** Unstable API*
*This API is unstable and may change or be removed in the next major version of Lune.*
Decodes the given string using the given format into a lua value.
@param format The format to use
@param encoded The JSON string to decode
@return The decoded lua value
]=]
decode: (format: NetEncodeDecodeFormat, encoded: string) -> any,
}

type ProcessSpawnOptionsStdio = "inherit" | "default"
Expand Down Expand Up @@ -415,9 +448,9 @@ declare process: {
--[=[
@within Process
@read_only
The current operating system being used.
Possible values:
* `"linux"`
Expand All @@ -428,9 +461,9 @@ declare process: {
--[=[
@within Process
@read_only
The architecture of the processor currently being used.
Possible values:
* `"x86_64"`
Expand Down Expand Up @@ -468,13 +501,13 @@ declare process: {
Exit code 0 is treated as a successful exit, any other value is treated as an error.
Setting the exit code using this function will override any otherwise automatic exit code.
@param code The exit code to set
]=]
exit: (code: number?) -> (),
--[=[
@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.
The second argument, `params`, can be passed as a list of string parameters to give to the program.
Expand All @@ -497,7 +530,7 @@ declare process: {
--[=[
@class Stdio
Standard input / output & utility functions
Standard input / output & utility functions
]=]
declare stdio: {
--[=[
Expand All @@ -507,9 +540,9 @@ declare stdio: {
Return an ANSI string that can be used to modify the persistent output color.
Pass `"reset"` to get a string that can reset the persistent output color.
### Example usage
```lua
stdio.write(stdio.color("red"))
print("This text will be red")
Expand All @@ -528,9 +561,9 @@ declare stdio: {
Return an ANSI string that can be used to modify the persistent output style.
Pass `"reset"` to get a string that can reset the persistent output style.
### Example usage
```lua
stdio.write(stdio.style("bold"))
print("This text will be bold")
Expand Down Expand Up @@ -629,7 +662,7 @@ declare task: {
@within Task
Instantly runs a thread or function.
If the spawned task yields, the thread that spawned the task
will resume, letting the spawned task run in the background.
Expand Down
1 change: 1 addition & 0 deletions packages/lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ lazy_static.workspace = true
serde.workspace = true
serde_json.workspace = true
serde_yaml.workspace = true
toml.workspace = true
tokio.workspace = true
reqwest.workspace = true

Expand Down
Loading

0 comments on commit 7d75d5c

Please sign in to comment.