lune/CHANGELOG.md

393 lines
12 KiB
Markdown
Raw Normal View History

2023-02-11 22:29:17 +00:00
<!-- markdownlint-disable MD023 -->
<!-- markdownlint-disable MD033 -->
2023-01-19 18:28:01 +00:00
# Changelog
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
### Fixed
- Fixed `task.delay` keeping the script running even if it was cancelled using `task.cancel`
2023-02-11 22:39:59 +00:00
## `0.4.0` - February 11th, 2023
### Added
2023-02-11 22:29:17 +00:00
- ### Web Sockets
`net` now supports web sockets for both clients and servers! <br />
2023-02-11 23:10:23 +00:00
Note that the web socket object is identical on both client and
2023-02-11 22:29:17 +00:00
server, but how you retrieve a web socket object is different.
#### Server API
The server web socket API is an extension of the existing `net.serve` function. <br />
This allows for serving both normal HTTP requests and web socket requests on the same port.
2023-02-11 21:40:14 +00:00
Example usage:
```lua
net.serve(8080, {
handleRequest = function(request)
return "Hello, world!"
end,
handleWebSocket = function(socket)
task.delay(10, function()
socket.send("Timed out!")
socket.close()
end)
2023-02-11 22:29:17 +00:00
-- The message will be nil when the socket has closed
repeat
local messageFromClient = socket.next()
if messageFromClient == "Ping" then
2023-02-11 21:40:14 +00:00
socket.send("Pong")
end
2023-02-11 22:29:17 +00:00
until messageFromClient == nil
2023-02-11 21:40:14 +00:00
end,
})
```
2023-02-11 22:29:17 +00:00
#### Client API
Example usage:
```lua
local socket = net.socket("ws://localhost:8080")
socket.send("Ping")
task.delay(5, function()
socket.close()
end)
-- The message will be nil when the socket has closed
repeat
local messageFromServer = socket.next()
if messageFromServer == "Ping" then
socket.send("Pong")
end
until messageFromServer == nil
```
### Changed
- `net.serve` now returns a `NetServeHandle` which can be used to stop serving requests safely.
Example usage:
```lua
local handle = net.serve(8080, function()
return "Hello, world!"
end)
print("Shutting down after 1 second...")
2023-02-11 21:40:14 +00:00
task.wait(1)
handle.stop()
print("Shut down succesfully")
```
2023-02-11 22:29:17 +00:00
- The third and optional argument of `process.spawn` is now a global type `ProcessSpawnOptions`.
- Setting `cwd` in the options for `process.spawn` to a path starting with a tilde (`~`) will now use a path relative to the platform-specific home / user directory.
- `NetRequest` query parameters value has been changed to be a table of key-value pairs similar to `process.env`.
If any query parameter is specified more than once in the request url, the value chosen will be the last one that was specified.
2023-02-09 22:21:26 +00:00
- The internal http client for `net.request` now reuses headers and connections for more efficient requests.
- Refactored the Lune rust crate to be much more user-friendly and documented all of the public functions.
### Fixed
- Fixed `process.spawn` blocking all lua threads if the spawned child process yields.
2023-02-06 18:02:13 +00:00
## `0.3.0` - February 6th, 2023
2023-02-06 05:13:12 +00:00
### Added
2023-02-06 17:59:48 +00:00
- Added a new global `stdio` which replaces `console`
- Added `stdio.write` which writes a string directly to stdout, without any newlines
- Added `stdio.ewrite` which writes a string directly to stderr, without any newlines
- Added `stdio.prompt` which will prompt the user for different kinds of input
Example usage:
```lua
local text = stdio.prompt()
local text2 = stdio.prompt("text", "Please write some text")
local didConfirm = stdio.prompt("confirm", "Please confirm this action")
local optionIndex = stdio.prompt("select", "Please select an option", { "one", "two", "three" })
local optionIndices = stdio.prompt(
"multiselect",
"Please select one or more options",
{ "one", "two", "three", "four", "five" }
)
```
2023-02-06 05:13:12 +00:00
### Changed
2023-02-06 05:13:12 +00:00
- Migrated `console.setColor/resetColor` and `console.setStyle/resetStyle` to `stdio.color` and `stdio.style` to allow for more flexibility in custom printing using ANSI color codes. Check the documentation for new usage and behavior.
- Migrated the pretty-printing and formatting behavior of `console.log/info/warn/error` to the standard Luau printing functions.
### Removed
- Removed printing functions `console.log/info/warn/error` in favor of regular global functions for printing.
2023-02-06 05:13:12 +00:00
### Fixed
- Fixed scripts hanging indefinitely on error
2023-02-06 00:17:31 +00:00
## `0.2.2` - February 5th, 2023
### Added
- Added global types for networking & child process APIs
- `net.request` gets `NetFetchParams` and `NetFetchResponse` for its argument and return value
- `net.serve` gets `NetRequest` and `NetResponse` for the handler function argument and return value
- `process.spawn` gets `ProcessSpawnOptions` for its third and optional parameter
2023-02-06 00:13:58 +00:00
### Changed
- Reorganize repository structure to take advantage of cargo workspaces, improves compile times
2023-02-04 03:14:45 +00:00
## `0.2.1` - February 3rd, 2023
2023-01-30 01:16:17 +00:00
### Added
- Added support for string interpolation syntax (update to Luau 0.561)
- Added network server functionality using `net.serve`
Example usage:
```lua
net.serve(8080, function(request)
print(`Got a {request.method} request at {request.path}!`)
local data = net.jsonDecode(request.body)
-- For simple text responses with a 200 status
return "OK"
-- For anything else
return {
status = 203,
headers = { ["Content-Type"] = "application/json" },
body = net.jsonEncode({
message = "echo",
data = data,
})
}
end)
```
2023-01-30 01:16:17 +00:00
### Changed
- Improved type definitions file for Selene, now including constants like `process.env` + tags such as `readonly` and `mustuse` wherever applicable
### Fixed
- Fixed type definitions file for Selene not including all API members and parameters
- Fixed `process.exit` exiting at the first yield instead of exiting instantly as it should
2023-01-28 04:51:44 +00:00
## `0.2.0` - January 28th, 2023
2023-01-28 02:32:08 +00:00
### Added
2023-01-28 04:51:44 +00:00
- Added full documentation for all global APIs provided by Lune! This includes over 200 lines of pure documentation about behavior & error cases for all of the current 35 constants & functions. Check the [README](/README.md) to find out how to enable documentation in your editor.
2023-01-28 02:32:08 +00:00
- Added a third argument `options` for `process.spawn`:
- `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
2023-01-28 05:04:43 +00:00
- `stdio` - How to treat output and error streams from the child process - set to `"inherit"` to pass output and error streams to the current process
2023-01-28 02:32:08 +00:00
- Added `process.cwd`, the path to the current working directory in which the Lune script is running
2023-01-25 20:58:28 +00:00
## `0.1.3` - January 25th, 2023
2023-01-25 19:42:10 +00:00
### Added
- Added a `--list` subcommand to list scripts found in the `lune` or `.lune` directory.
2023-01-25 01:32:31 +00:00
## `0.1.2` - January 24th, 2023
2023-01-25 02:11:04 +00:00
### Added
- Added automatic publishing of the Lune library to [crates.io](https://crates.io/crates/lune)
### Fixed
- Fixed scripts that terminate instantly sometimes hanging
2023-01-24 20:38:43 +00:00
## `0.1.1` - January 24th, 2023
2023-01-24 20:38:04 +00:00
### Fixed
- Fixed errors containing `./` and / or `../` in the middle of file paths
- Potential fix for spawned processes that yield erroring with "attempt to yield across metamethod/c-call boundary"
2023-01-24 17:44:33 +00:00
## `0.1.0` - January 24th, 2023
2023-01-24 17:30:00 +00:00
### Added
2023-01-24 17:30:00 +00:00
- `task` now supports passing arguments in `task.spawn` / `task.delay` / `task.defer`
- `require` now uses paths relative to the file instead of being relative to the current directory, which is consistent with almost all other languages but not original Lua / Luau - this is a breaking change but will allow for proper packaging of third-party modules and more in the future.
- **_NOTE:_** _If you still want to use the default Lua behavior instead of relative paths, set the environment variable `LUAU_PWD_REQUIRE` to `true`_
2023-01-24 17:30:00 +00:00
### Changed
- Improved error message when an invalid file path is passed to `require`
- Much improved error formatting and stack traces
### Fixed
2023-01-24 17:30:00 +00:00
- Fixed downloading of type definitions making json files instead of the proper format
- Process termination will now always make sure all lua state is cleaned up before exiting, in all cases
## `0.0.6` - January 23rd, 2023
2023-01-23 18:18:48 +00:00
2023-01-24 00:07:37 +00:00
### Added
- Initial implementation of [Roblox's task library](https://create.roblox.com/docs/reference/engine/libraries/task), with some caveats:
- Minimum wait / delay time is currently set to 10ms, subject to change
2023-01-24 17:30:00 +00:00
- It is not yet possible to pass arguments to tasks created using `task.spawn` / `task.delay` / `task.defer`
- Timings for `task.defer` are flaky and deferred tasks are not (yet) guaranteed to run after spawned tasks
2023-01-24 00:07:37 +00:00
With all that said, everything else should be stable!
- Mixing and matching the `coroutine` library with `task` works in all cases
- `process.exit()` will stop all spawned / delayed / deferred threads and exit the process
- Lune is guaranteed to keep running until there are no longer any waiting threads
If any of the abovementioned things do not work as expected, it is a bug, please file an issue!
2023-01-23 18:18:48 +00:00
### Fixed
2023-01-24 00:07:37 +00:00
- Potential fix for spawned processes that yield erroring with "attempt to yield across metamethod/c-call boundary"
2023-01-23 18:18:48 +00:00
2023-01-23 02:51:02 +00:00
## `0.0.5` - January 22nd, 2023
2023-01-21 03:21:31 +00:00
2023-01-21 06:41:00 +00:00
### Added
2023-01-23 02:51:02 +00:00
- Added full test suites for all Lune globals to ensure correct behavior
2023-01-21 06:41:00 +00:00
- Added library version of Lune that can be used from other Rust projects
2023-01-21 03:21:31 +00:00
### Changed
2023-01-23 02:46:30 +00:00
- Large internal changes to allow for implementing the `task` library.
2023-01-21 22:02:49 +00:00
- Improved general formatting of errors to make them more readable & glanceable
2023-01-21 03:21:31 +00:00
- Improved output formatting of non-primitive types
- Improved output formatting of empty tables
2023-01-21 22:02:49 +00:00
### Fixed
- Fixed double stack trace for certain kinds of errors
2023-01-21 02:18:11 +00:00
## `0.0.4` - January 21st, 2023
### Added
- Added `process.args` for inspecting values given to Lune when running (read only)
- Added `process.env` which is a plain table where you can get & set environment variables
### Changed
- Improved error formatting & added proper file name to stack traces
### Removed
- Removed `...` for process arguments, use `process.args` instead
- Removed individual functions for getting & setting environment variables, use `process.env` instead
2023-01-21 02:16:31 +00:00
## `0.0.3` - January 20th, 2023
### Added
- Added networking functions under `net`
Example usage:
```lua
local apiResult = net.request({
url = "https://jsonplaceholder.typicode.com/posts/1",
method = "PATCH",
headers = {
["Content-Type"] = "application/json",
},
body = net.jsonEncode({
title = "foo",
body = "bar",
}),
})
local apiResponse = net.jsonDecode(apiResult.body)
assert(apiResponse.title == "foo", "Invalid json response")
assert(apiResponse.body == "bar", "Invalid json response")
```
2023-01-20 03:10:34 +00:00
- Added console logging & coloring functions under `console`
This piece of code:
```lua
local tab = { Integer = 1234, Hello = { "World" } }
console.log(tab)
```
Will print the following formatted text to the console, **_with syntax highlighting_**:
```lua
{
Integer = 1234,
Hello = {
"World",
}
}
```
Additional utility functions exist with the same behavior but that also print out a colored
tag together with any data given to them: `console.info`, `console.warn`, `console.error` -
These print out prefix tags `[INFO]`, `[WARN]`, `[ERROR]` in blue, orange, and red, respectively.
### Changed
- The `json` api is now part of `net`
- `json.encode` becomes `net.jsonEncode`
- `json.decode` become `net.jsonDecode`
### Fixed
- Fixed JSON decode not working properly
2023-01-19 20:08:38 +00:00
## `0.0.2` - January 19th, 2023
2023-01-19 18:28:01 +00:00
### Added
- Added support for command-line parameters to scripts
These can be accessed as a vararg in the root of a script:
```lua
local firstArg: string, secondArg: string = ...
print(firstArg, secondArg)
```
- Added CLI parameters for downloading type definitions:
- `lune --download-selene-types` to download Selene types to the current directory
- `lune --download-luau-types` to download Luau types to the current directory
These files will be downloaded as `lune.yml` and `luneTypes.d.luau`
respectively and are also available in each release on GitHub.
2023-01-19 20:08:38 +00:00
## `0.0.1` - January 18th, 2023
2023-01-19 18:28:01 +00:00
Initial Release