lune/CHANGELOG.md

716 lines
26 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).
2023-06-12 11:22:08 +01:00
## `0.7.0` - June 12th, 2023
2023-05-19 12:57:32 +01:00
### Breaking Changes
- Globals for the `fs`, `net`, `process`, `stdio`, and `task` builtins have been removed, and the `require("@lune/...")` syntax is now the only way to access builtin libraries. If you have previously been using a global such as `fs` directly, you will now need to put `local fs = require("@lune/fs")` at the top of the file instead.
2023-06-08 10:15:41 +01:00
- Migrated several functions in the `roblox` builtin to new, more flexible APIs:
2023-06-08 10:15:41 +01:00
- `readPlaceFile -> deserializePlace`
- `readModelFile -> deserializeModel`
- `writePlaceFile -> serializePlace`
- `writeModelFile -> serializeModel`
2023-06-08 10:15:41 +01:00
These new APIs **_no longer use file paths_**, meaning to use them with files you must first read them using the `fs` builtin.
2023-06-08 10:15:41 +01:00
- Removed `CollectionService` and its methods from the `roblox` builtin library - new instance methods have been added as replacements.
- Removed [`Instance:FindFirstDescendant`](https://create.roblox.com/docs/reference/engine/classes/Instance#FindFirstDescendant) which was a method that was never enabled in the official Roblox API and will soon be removed. <br/>
Use the second argument of the already existing find methods instead to find descendants.
- Removed the global `printinfo` function - it was generally not used, and did not work as intended. Use the `stdio` builtin for formatting and logging instead.
- Removed support for Windows on ARM - it's more trouble than its worth right now, we may revisit it later.
2023-05-19 16:01:59 +01:00
### Added
2023-06-08 10:15:41 +01:00
- Added `serde.compress` and `serde.decompress` for compressing and decompressing strings using one of several compression formats: `brotli`, `gzip`, `lz4`, or `zlib`.
2023-05-19 16:01:59 +01:00
2023-06-08 10:15:41 +01:00
Example usage:
2023-05-19 16:01:59 +01:00
2023-06-08 10:15:41 +01:00
```lua
local INPUT = string.rep("Input string to compress", 16) -- Repeated string 16 times for the purposes of this example
2023-05-19 16:01:59 +01:00
2023-06-08 10:15:41 +01:00
local serde = require("@lune/serde")
2023-05-19 16:01:59 +01:00
2023-06-08 10:15:41 +01:00
local compressed = serde.compress("gzip", INPUT)
local decompressed = serde.decompress("gzip", compressed)
2023-05-19 16:01:59 +01:00
2023-06-08 10:15:41 +01:00
assert(decompressed == INPUT)
```
2023-05-19 16:01:59 +01:00
2023-06-08 10:15:41 +01:00
- Added automatic decompression for compressed responses when using `net.request`.
This behavior can be disabled by passing `options = { decompress = false }` in request params.
2023-06-08 10:15:41 +01:00
- Added support for finding scripts in the current home directory.
This means that if you have a script called `script-name.luau`, you can place it in the following location:
2023-06-08 10:09:52 +01:00
2023-06-08 10:15:41 +01:00
- `C:\Users\YourName\.lune\script-name.luau` (Windows)
- `/Users/YourName/.lune/script-name.luau` (macOS)
- `/home/YourName/.lune/script-name.luau` (Linux)
2023-06-08 10:09:52 +01:00
2023-06-08 10:15:41 +01:00
And then run it using `lune script-name` from any directory you are currently in.
2023-06-08 10:09:52 +01:00
2023-06-08 10:15:41 +01:00
- Added several new instance methods in the `roblox` builtin library:
- [`Instance:AddTag`](https://create.roblox.com/docs/reference/engine/classes/Instance#AddTag)
- [`Instance:GetTags`](https://create.roblox.com/docs/reference/engine/classes/Instance#GetTags)
- [`Instance:HasTag`](https://create.roblox.com/docs/reference/engine/classes/Instance#HasTag)
- [`Instance:RemoveTag`](https://create.roblox.com/docs/reference/engine/classes/Instance#RemoveTag)
- Implemented the second argument of the `FindFirstChild` / `FindFirstChildOfClass` / `FindFirstChildWhichIsA` instance methods.
2023-05-19 12:57:32 +01:00
### Changed
2023-06-08 13:26:11 +01:00
- Update to Luau version `0.579`
2023-06-08 10:15:41 +01:00
- Both `stdio.write` and `stdio.ewrite` now support writing arbitrary bytes, instead of only valid UTF-8.
2023-05-19 12:57:32 +01:00
### Fixed
2023-06-08 10:15:41 +01:00
- Fixed `stdio.write` and `stdio.ewrite` not being flushed and causing output to be interleaved. ([#47])
- Fixed `typeof` returning `userdata` for roblox types such as `Instance`, `Vector3`, ...
2023-05-19 12:57:32 +01:00
[#47]: https://github.com/filiptibell/lune/pull/47
2023-05-14 21:21:52 +01:00
## `0.6.7` - May 14th, 2023
2023-05-19 12:57:32 +01:00
### Added
2023-06-08 10:15:41 +01:00
- Replaced all of the separate typedef & documentation generation commands with a unified `lune --setup` command.
2023-05-14 21:21:52 +01:00
2023-06-08 10:15:41 +01:00
This command will generate type definition files for all of the builtins and will work with the new `require("@lune/...")` syntax. Note that this also means that there is no longer any way to generate type definitions for globals - this is because they will be removed in the next major release in favor of the beforementioned syntax.
2023-05-14 21:21:52 +01:00
2023-06-08 10:15:41 +01:00
- New releases now include prebuilt binaries for arm64 / aarch64! <br />
These new binaries will have names with the following format:
- `lune-windows-0.6.7-aarch64.exe`
- `lune-linux-0.6.7-aarch64`
- `lune-macos-0.6.7-aarch64`
- Added global types to documentation site
2023-04-30 19:51:52 +01:00
## `0.6.6` - April 30th, 2023
### Added
2023-06-08 10:15:41 +01:00
- Added tracing / logging for rare and hard to diagnose error cases, which can be configured using the env var `RUST_LOG`.
2023-03-31 09:51:40 +01:00
### Changed
2023-06-08 10:15:41 +01:00
- The `_VERSION` global now follows a consistent format `Lune x.y.z+luau` to allow libraries to check against it for version requirements.
2023-06-08 10:15:41 +01:00
Examples:
2023-06-08 10:15:41 +01:00
- `Lune 0.0.0+0`
- `Lune 1.0.0+500`
- `Lune 0.11.22+9999`
2023-06-08 10:15:41 +01:00
- Updated to Luau version `0.573`
- Updated `rbx-dom` to support reading and writing `Font` datatypes
2023-04-29 09:53:39 +01:00
2023-03-31 09:51:40 +01:00
### Fixed
2023-06-08 10:15:41 +01:00
- Fixed `_G` not being a readable & writable table
- Fixed `_G` containing normal globals such as `print`, `math`, ...
- Fixed using instances as keys in tables
2023-03-31 09:51:40 +01:00
2023-03-27 15:03:58 +01:00
## `0.6.5` - March 27th, 2023
2023-03-27 11:48:51 +01:00
### Changed
2023-06-08 10:15:41 +01:00
- Functions such as `print`, `warn`, ... now respect `__tostring` metamethods.
2023-03-27 11:48:51 +01:00
### Fixed
2023-06-08 10:15:41 +01:00
- Fixed access of roblox instance properties such as `Workspace.Terrain`, `game.Workspace` that are actually links to child instances. <br />
These properties are always guaranteed to exist, and they are not always properly set, meaning they must be found through an internal lookup.
- Fixed issues with the `CFrame.lookAt` and `CFrame.new(Vector3, Vector3)` constructors.
- Fixed issues with CFrame math operations returning rotation angles in the wrong order.
2023-03-27 11:48:51 +01:00
2023-03-26 11:09:13 +01:00
## `0.6.4` - March 26th, 2023
### Fixed
2023-06-08 10:15:41 +01:00
- Fixed instances with attributes not saving if they contain integer attributes.
- Fixed attributes not being set properly if the instance has an empty attributes property.
- Fixed error messages for reading & writing roblox files not containing the full error message.
- Fixed crash when trying to access an instance reference property that points to a destroyed instance.
- Fixed crash when trying to save instances that contain unsupported attribute types.
2023-03-26 08:40:13 +01:00
## `0.6.3` - March 26th, 2023
2023-03-25 20:00:43 +00:00
### Added
2023-06-08 10:15:41 +01:00
- Added support for instance tags & `CollectionService` in the `roblox` built-in. <br />
Currently implemented methods are listed on the [docs site](https://lune.gitbook.io/lune/roblox/api-status).
2023-03-25 20:00:43 +00:00
### Fixed
2023-06-08 10:15:41 +01:00
- Fixed accessing a destroyed instance printing an error message even if placed inside a pcall.
- Fixed cloned instances not having correct instance reference properties set (`ObjectValue.Value`, `Motor6D.Part0`, ...)
- Fixed `Instance::GetDescendants` returning the same thing as `Instance::GetChildren`.
2023-03-25 10:48:50 +00:00
## `0.6.2` - March 25th, 2023
This release adds some new features and fixes for the `roblox` built-in.
### Added
2023-06-08 10:15:41 +01:00
- Added `GetAttribute`, `GetAttributes` and `SetAttribute` methods for instances.
- Added support for getting & setting properties that are instance references.
2023-03-25 10:48:50 +00:00
### Changed
2023-06-08 10:15:41 +01:00
- Improved handling of optional property types such as optional cframes & default physical properties.
2023-03-25 10:48:50 +00:00
### Fixed
2023-06-08 10:15:41 +01:00
- Fixed handling of instance properties that are serialized as binary strings.
2023-03-25 10:48:50 +00:00
2023-03-23 08:44:01 +00:00
## `0.6.1` - March 22nd, 2023
### Fixed
2023-06-08 10:15:41 +01:00
- Fixed `writePlaceFile` and `writeModelFile` in the new `roblox` built-in making mysterious "ROOT" instances.
2023-03-23 08:44:01 +00:00
2023-03-22 19:13:43 +00:00
## `0.6.0` - March 22nd, 2023
2023-03-20 12:52:18 +00:00
### Added
2023-06-08 10:15:41 +01:00
- Added a `roblox` built-in
2023-06-08 10:15:41 +01:00
If you're familiar with [Remodel](https://github.com/rojo-rbx/remodel), this new built-in contains more or less the same APIs, integrated into Lune. <br />
There are just too many new APIs to list in this changelog, so head over to the [docs sit](https://lune.gitbook.io/lune/roblox/intro) to learn more!
2023-06-08 10:15:41 +01:00
- Added a `serde` built-in
2023-06-08 10:15:41 +01:00
This built-in contains previously available functions `encode` and `decode` from the `net` global. <br />
The plan is for this built-in to contain more serialization and encoding functionality in the future.
2023-06-08 10:15:41 +01:00
- `require` has been reimplemented and overhauled in several ways:
2023-06-08 10:15:41 +01:00
- New built-ins such as `roblox` and `serde` can **_only_** be imported using `require("@lune/roblox")`, `require("@lune/serde")`, ...
- Previous globals such as `fs`, `net` and others can now _also_ be imported using `require("@lune/fs")`, `require("@lune/net")`, ...
- Requiring a script is now completely asynchronous and will not block lua threads other than the caller.
- Requiring a script will no longer error when using async APIs in the main body of the required script.
2023-06-08 10:15:41 +01:00
All new built-ins will be added using this syntax and new built-ins will no longer be available in the global scope, and current globals will stay available as globals until proper editor and LSP support is available to ensure Lune users have a good development experience. This is the first step towards moving away from adding each library as a global, and allowing Lune to have more built-in libraries in general.
2023-06-08 10:15:41 +01:00
Behavior otherwise stays the same, and requires are still relative to file unless the special `@` prefix is used.
2023-06-08 10:15:41 +01:00
- Added `net.urlEncode` and `net.urlDecode` for URL-encoding and decoding strings
2023-03-21 16:50:33 +00:00
### Changed
2023-06-08 10:15:41 +01:00
- Renamed the global `info` function to `printinfo` to make it less ambiguous
2023-03-20 12:52:18 +00:00
### Removed
2023-06-08 10:15:41 +01:00
- Removed experimental `net.encode` and `net.decode` functions, since they are now available using `require("@lune/serde")`
- Removed option to preserve default Luau require behavior
2023-03-20 12:52:18 +00:00
2023-03-11 07:29:57 +00:00
## `0.5.6` - March 11th, 2023
### Added
2023-06-08 10:15:41 +01:00
- Added support for shebangs at the top of a script, meaning scripts such as this one will now run without throwing a syntax error:
2023-06-08 10:15:41 +01:00
```lua
#!/usr/bin/env lune
2023-06-08 10:15:41 +01:00
print("Hello, world!")
```
### Fixed
2023-06-08 10:15:41 +01:00
- Fixed `fs.writeFile` and `fs.readFile` not working with strings / files that are invalid utf-8
2023-03-08 12:06:03 +00:00
## `0.5.5` - March 8th, 2023
### Added
2023-06-08 10:15:41 +01:00
- Added support for running scripts by passing absolute file paths in the CLI
- This does not have the restriction of scripts having to use the `.luau` or `.lua` extension, since it is presumed that if you pass an absolute path you know exactly what you are doing
### Changed
2023-06-08 10:15:41 +01:00
- Improved error messages for passing invalid file names / file paths substantially - they now include helpful formatting to make file names distinct from file extensions, and give suggestions on how to solve the problem
- Improved general formatting of error messages, both in the CLI and for Luau scripts being run
### Fixed
2023-06-08 10:15:41 +01:00
- Fixed the CLI being a bit too picky about file names when trying to run files in `lune` or `.lune` directories
- Fixed documentation misses from large changes made in version `0.5.0`
2023-03-07 21:12:19 +00:00
## `0.5.4` - March 7th, 2023
2023-03-02 19:27:51 +00:00
### Added
2023-06-08 10:15:41 +01:00
- Added support for reading scripts from stdin by passing `"-"` as the script name
- Added support for close codes in the `net` WebSocket APIs:
- A close code can be sent by passing it to `socket.close`
- A received close code can be checked with the `socket.closeCode` value, which is populated after a socket has been closed - note that using `socket.close` will not set the close code value, it is only set when received and is guaranteed to exist after closure
2023-03-02 19:27:51 +00:00
2023-03-07 21:12:19 +00:00
### Changed
2023-06-08 10:15:41 +01:00
- Update to Luau version 0.566
2023-03-07 21:12:19 +00:00
2023-03-02 19:27:51 +00:00
### Fixed
2023-06-08 10:15:41 +01:00
- Fixed scripts having to be valid utf8, they may now use any kind of encoding that base Luau supports
- The `net` WebSocket APIs will no longer return `nil` for partial messages being received in `socket.next`, and will instead wait for the full message to arrive
2023-03-02 19:27:51 +00:00
2023-02-26 20:42:28 +00:00
## `0.5.3` - February 26th, 2023
### Fixed
2023-06-08 10:15:41 +01:00
- Fixed `lune --generate-selene-types` generating an invalid Selene definitions file
- Fixed type definition parsing issues on Windows
2023-02-26 20:42:28 +00:00
2023-02-26 16:11:29 +00:00
## `0.5.2` - February 26th, 2023
2023-02-26 12:59:34 +00:00
### Fixed
2023-06-08 10:15:41 +01:00
- Fixed crash when using `stdio.color()` or `stdio.style()` in a CI environment or non-interactive terminal
2023-02-26 12:59:34 +00:00
2023-02-25 12:41:50 +00:00
## `0.5.1` - February 25th, 2023
### Added
2023-06-08 10:15:41 +01:00
- Added `net.encode` and `net.decode` which are equivalent to `net.jsonEncode` and `net.jsonDecode`, but with support for more formats.
2023-02-25 12:41:50 +00:00
2023-06-08 10:15:41 +01:00
**_WARNING: Unstable API_**
2023-02-25 12:41:50 +00:00
2023-06-08 10:15:41 +01:00
_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._
2023-02-25 12:41:50 +00:00
2023-06-08 10:15:41 +01:00
Example usage:
2023-02-25 12:41:50 +00:00
2023-06-08 10:15:41 +01:00
```lua
local toml = net.decode("toml", [[
[package]
name = "my-cool-toml-package"
version = "0.1.0"
2023-02-25 12:41:50 +00:00
2023-06-08 10:15:41 +01:00
[values]
epic = true
]])
2023-02-25 12:41:50 +00:00
2023-06-08 10:15:41 +01:00
assert(toml.package.name == "my-cool-toml-package")
assert(toml.package.version == "0.1.0")
assert(toml.values.epic == true)
```
2023-02-25 12:41:50 +00:00
### Fixed
2023-06-08 10:15:41 +01:00
- Fixed indentation of closing curly bracket when printing tables
2023-02-25 12:41:50 +00:00
2023-02-23 20:20:14 +00:00
## `0.5.0` - February 23rd, 2023
2023-02-21 11:30:31 +00:00
### Added
2023-06-08 10:15:41 +01:00
- Added auto-generated API reference pages and documentation using GitHub wiki pages
- Added support for `query` in `net.request` parameters, which enables usage of query parameters in URLs without having to manually URL encode values.
- Added a new function `fs.move` to move / rename a file or directory from one path to another.
- Implemented a new task scheduler which resolves several long-standing issues:
2023-06-08 10:15:41 +01:00
- Issues with yielding across the C-call/metamethod boundary no longer occur when calling certain async APIs that Lune provides.
- Ordering of interleaved calls to `task.spawn/task.defer` is now completely deterministic, deferring is now guaranteed to run last even in these cases.
- The minimum wait time possible when using `task.wait` and minimum delay time using `task.delay` are now much smaller, and only limited by the underlying OS implementation. For most systems this means `task.wait` and `task.delay` are now accurate down to about 5 milliseconds or less.
2023-02-21 11:30:31 +00:00
### Changed
2023-06-08 10:15:41 +01:00
- Type definitions are now bundled as part of the Lune executable, meaning they no longer need to be downloaded.
- `lune --generate-selene-types` will generate the Selene type definitions file, replacing `lune --download-selene-types`
- `lune --generate-luau-types` will generate the Luau type definitions file, replacing `lune --download-luau-types`
- Improved accuracy of Selene type definitions, strongly typed arrays are now used where possible
- Improved error handling and messages for `net.serve`
- Improved error handling and messages for `stdio.prompt`
- File path representations on Windows now use legacy paths instead of UNC paths wherever possible, preventing some confusing cases where file paths don't work as expected
### Fixed
2023-06-08 10:15:41 +01:00
- Fixed `process.cwd` not having the correct ending path separator on Windows
- Fixed remaining edge cases where the `task` and `coroutine` libraries weren't interoperable
- Fixed `task.delay` keeping the script running even if it was cancelled using `task.cancel`
- Fixed `stdio.prompt` blocking all other lua threads while prompting for input
2023-02-11 22:39:59 +00:00
## `0.4.0` - February 11th, 2023
### Added
2023-06-08 10:15:41 +01:00
- ### Web Sockets
`net` now supports web sockets for both clients and servers! <br />
Note that the web socket object is identical on both client and
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.
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)
-- The message will be nil when the socket has closed
repeat
local messageFromClient = socket.next()
if messageFromClient == "Ping" then
socket.send("Pong")
end
until messageFromClient == nil
end,
})
```
#### 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
```
2023-02-11 22:29:17 +00:00
### Changed
2023-06-08 10:15:41 +01:00
- `net.serve` now returns a `NetServeHandle` which can be used to stop serving requests safely.
2023-06-08 10:15:41 +01:00
Example usage:
2023-06-08 10:15:41 +01:00
```lua
local handle = net.serve(8080, function()
return "Hello, world!"
end)
2023-06-08 10:15:41 +01:00
print("Shutting down after 1 second...")
task.wait(1)
handle.stop()
print("Shut down succesfully")
```
2023-06-08 10:15:41 +01: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.
- 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
2023-06-08 10:15:41 +01:00
- 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-06-08 10:15:41 +01: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
2023-02-06 17:59:48 +00:00
2023-06-08 10:15:41 +01:00
Example usage:
2023-02-06 17:59:48 +00:00
2023-06-08 10:15:41 +01:00
```lua
local text = stdio.prompt()
2023-02-06 17:59:48 +00:00
2023-06-08 10:15:41 +01:00
local text2 = stdio.prompt("text", "Please write some text")
2023-02-06 17:59:48 +00:00
2023-06-08 10:15:41 +01:00
local didConfirm = stdio.prompt("confirm", "Please confirm this action")
2023-02-06 17:59:48 +00:00
2023-06-08 10:15:41 +01:00
local optionIndex = stdio.prompt("select", "Please select an option", { "one", "two", "three" })
2023-02-06 17:59:48 +00:00
2023-06-08 10:15:41 +01:00
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-06-08 10:15:41 +01: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
2023-06-08 10:15:41 +01:00
- 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
2023-06-08 10:15:41 +01:00
- Fixed scripts hanging indefinitely on error
2023-02-06 05:13:12 +00:00
2023-02-06 00:17:31 +00:00
## `0.2.2` - February 5th, 2023
### Added
2023-06-08 10:15:41 +01:00
- 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
2023-06-08 10:15:41 +01:00
- Reorganize repository structure to take advantage of cargo workspaces, improves compile times
2023-02-06 00:13:58 +00:00
2023-02-04 03:14:45 +00:00
## `0.2.1` - February 3rd, 2023
2023-01-30 01:16:17 +00:00
### Added
2023-06-08 10:15:41 +01:00
- Added support for string interpolation syntax (update to Luau 0.561)
- Added network server functionality using `net.serve`
2023-06-08 10:15:41 +01:00
Example usage:
2023-06-08 10:15:41 +01:00
```lua
net.serve(8080, function(request)
print(`Got a {request.method} request at {request.path}!`)
2023-06-08 10:15:41 +01:00
local data = net.jsonDecode(request.body)
2023-06-08 10:15:41 +01:00
-- For simple text responses with a 200 status
return "OK"
2023-06-08 10:15:41 +01:00
-- 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
2023-06-08 10:15:41 +01:00
- Improved type definitions file for Selene, now including constants like `process.env` + tags such as `readonly` and `mustuse` wherever applicable
2023-01-30 01:16:17 +00:00
### Fixed
2023-06-08 10:15:41 +01:00
- 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-30 01:16:17 +00:00
2023-01-28 04:51:44 +00:00
## `0.2.0` - January 28th, 2023
2023-01-28 02:32:08 +00:00
### Added
2023-06-08 10:15:41 +01: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
2023-06-08 10:15:41 +01:00
- Added a third argument `options` for `process.spawn`:
2023-01-28 02:32:08 +00:00
2023-06-08 10:15:41 +01:00
- `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 - set to `"inherit"` to pass output and error streams to the current process
2023-01-28 02:32:08 +00:00
2023-06-08 10:15:41 +01:00
- Added `process.cwd`, the path to the current working directory in which the Lune script is running
2023-01-28 02:32:08 +00:00
2023-01-25 20:58:28 +00:00
## `0.1.3` - January 25th, 2023
2023-01-25 19:42:10 +00:00
### Added
2023-06-08 10:15:41 +01:00
- Added a `--list` subcommand to list scripts found in the `lune` or `.lune` directory.
2023-01-25 19:42:10 +00:00
2023-01-25 01:32:31 +00:00
## `0.1.2` - January 24th, 2023
2023-01-25 02:11:04 +00:00
### Added
2023-06-08 10:15:41 +01:00
- Added automatic publishing of the Lune library to [crates.io](https://crates.io/crates/lune)
2023-01-25 02:11:04 +00:00
### Fixed
2023-06-08 10:15:41 +01:00
- 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
2023-06-08 10:15:41 +01:00
- 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 20:38:04 +00:00
2023-01-24 17:44:33 +00:00
## `0.1.0` - January 24th, 2023
2023-01-24 17:30:00 +00:00
### Added
2023-06-08 10:15:41 +01: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
2023-06-08 10:15:41 +01:00
- Improved error message when an invalid file path is passed to `require`
- Much improved error formatting and stack traces
### Fixed
2023-06-08 10:15:41 +01: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
2023-06-08 10:15:41 +01:00
- Initial implementation of [Roblox's task library](https://create.roblox.com/docs/reference/engine/libraries/task), with some caveats:
2023-01-24 00:07:37 +00:00
2023-06-08 10:15:41 +01:00
- Minimum wait / delay time is currently set to 10ms, subject to change
- 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
2023-06-08 10:15:41 +01:00
With all that said, everything else should be stable!
2023-01-24 00:07:37 +00:00
2023-06-08 10:15:41 +01:00
- 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
2023-01-24 00:07:37 +00:00
2023-06-08 10:15:41 +01:00
If any of the abovementioned things do not work as expected, it is a bug, please file an issue!
2023-01-24 00:07:37 +00:00
2023-01-23 18:18:48 +00:00
### Fixed
2023-06-08 10:15:41 +01: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-06-08 10:15:41 +01:00
- Added full test suites for all Lune globals to ensure correct behavior
- Added library version of Lune that can be used from other Rust projects
2023-01-21 06:41:00 +00:00
2023-01-21 03:21:31 +00:00
### Changed
2023-06-08 10:15:41 +01:00
- Large internal changes to allow for implementing the `task` library.
- Improved general formatting of errors to make them more readable & glanceable
- Improved output formatting of non-primitive types
- Improved output formatting of empty tables
2023-01-21 03:21:31 +00:00
2023-01-21 22:02:49 +00:00
### Fixed
2023-06-08 10:15:41 +01:00
- Fixed double stack trace for certain kinds of errors
2023-01-21 22:02:49 +00:00
2023-01-21 02:18:11 +00:00
## `0.0.4` - January 21st, 2023
### Added
2023-06-08 10:15:41 +01:00
- 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
2023-06-08 10:15:41 +01:00
- Improved error formatting & added proper file name to stack traces
### Removed
2023-06-08 10:15:41 +01:00
- 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
2023-06-08 10:15:41 +01:00
- Added networking functions under `net`
2023-06-08 10:15:41 +01:00
Example usage:
2023-06-08 10:15:41 +01:00
```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",
}),
})
2023-06-08 10:15:41 +01:00
local apiResponse = net.jsonDecode(apiResult.body)
assert(apiResponse.title == "foo", "Invalid json response")
assert(apiResponse.body == "bar", "Invalid json response")
```
2023-06-08 10:15:41 +01:00
- Added console logging & coloring functions under `console`
2023-01-20 03:10:34 +00:00
2023-06-08 10:15:41 +01:00
This piece of code:
2023-01-20 03:10:34 +00:00
2023-06-08 10:15:41 +01:00
```lua
local tab = { Integer = 1234, Hello = { "World" } }
console.log(tab)
```
2023-01-20 03:10:34 +00:00
2023-06-08 10:15:41 +01:00
Will print the following formatted text to the console, **_with syntax highlighting_**:
2023-01-20 03:10:34 +00:00
2023-06-08 10:15:41 +01:00
```lua
{
Integer = 1234,
Hello = {
"World",
}
}
```
2023-01-20 03:10:34 +00:00
2023-06-08 10:15:41 +01:00
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.
2023-01-20 03:10:34 +00:00
### Changed
2023-06-08 10:15:41 +01:00
- The `json` api is now part of `net`
- `json.encode` becomes `net.jsonEncode`
- `json.decode` become `net.jsonDecode`
### Fixed
2023-06-08 10:15:41 +01:00
- 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
2023-06-08 10:15:41 +01:00
- Added support for command-line parameters to scripts
2023-01-19 18:28:01 +00:00
2023-06-08 10:15:41 +01:00
These can be accessed as a vararg in the root of a script:
2023-01-19 18:28:01 +00:00
2023-06-08 10:15:41 +01:00
```lua
local firstArg: string, secondArg: string = ...
print(firstArg, secondArg)
```
2023-01-19 18:28:01 +00:00
2023-06-08 10:15:41 +01:00
- Added CLI parameters for downloading type definitions:
2023-01-19 18:28:01 +00:00
2023-06-08 10:15:41 +01:00
- `lune --download-selene-types` to download Selene types to the current directory
- `lune --download-luau-types` to download Luau types to the current directory
2023-01-19 18:28:01 +00:00
2023-06-08 10:15:41 +01:00
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 18:28:01 +00:00
2023-01-19 20:08:38 +00:00
## `0.0.1` - January 18th, 2023
2023-01-19 18:28:01 +00:00
Initial Release