From 097297a8c0b7f150dcb19e54754e371e65209131 Mon Sep 17 00:00:00 2001
From: Filip Tibell <filip.tibell@gmail.com>
Date: Mon, 17 Jun 2024 13:30:22 +0200
Subject: [PATCH 1/3] Update tool versions

---
 .vscode/settings.json | 2 +-
 aftman.toml           | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/.vscode/settings.json b/.vscode/settings.json
index b106cdc..38ac34f 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -4,6 +4,6 @@
 	"luau-lsp.ignoreGlobs": ["temp/**"],
 	"luau-lsp.require.mode": "relativeToFile",
 	"luau-lsp.require.directoryAliases": {
-		"@lune/": "~/.lune/.typedefs/0.7.4/"
+		"@lune/": "~/.lune/.typedefs/0.8.5/"
 	}
 }
diff --git a/aftman.toml b/aftman.toml
index 186c9ed..c174908 100644
--- a/aftman.toml
+++ b/aftman.toml
@@ -1,5 +1,5 @@
 [tools]
 just = "readysetplay/just@1.8.0"
-luau-lsp = "JohnnyMorganz/luau-lsp@1.27.0"
-lune = "lune-org/lune@0.8.0"
-stylua = "JohnnyMorganz/StyLua@0.19.1"
+luau-lsp = "JohnnyMorganz/luau-lsp@1.29.1"
+lune = "lune-org/lune@0.8.5"
+stylua = "JohnnyMorganz/StyLua@0.20.0"

From 1b768a5a7f1d1fa649aed5ba8f7cd684d6f502e7 Mon Sep 17 00:00:00 2001
From: Filip Tibell <filip.tibell@gmail.com>
Date: Mon, 17 Jun 2024 13:39:41 +0200
Subject: [PATCH 2/3] Fix docs generation when there are multiple classes in a
 library

---
 .lune/generate.luau | 32 ++++++++++++++++++++++++++------
 1 file changed, 26 insertions(+), 6 deletions(-)

diff --git a/.lune/generate.luau b/.lune/generate.luau
index 97eef5a..e0ed79f 100644
--- a/.lune/generate.luau
+++ b/.lune/generate.luau
@@ -10,16 +10,36 @@ local typedefsFile = fs.readFile("temp/moonwave.json")
 local items: { moonwave.Item } = serde.decode("json", typedefsFile)
 
 -- Generate markdown for all of the libraries
-local generatedFiles = {}
+local generatedFiles = {} :: { [number]: {
+	displayName: string,
+	name: string,
+	content: string,
+} }
 for _, item in items do
 	local file = item.source.path
 	local name = string.match(file, "(.+)%.luau")
 	assert(name ~= nil, "Failed to remove luau suffix from file name")
-	table.insert(generatedFiles, {
-		displayName = item.name,
-		name = string.lower(name),
-		content = writeMarkdown(item),
-	})
+
+	-- If we have an existing entry, such as when we have multiple
+	-- classes within the same library (Regex, RegexCaptures, ...)
+	-- we want to append to the existing entry instead of creating
+	local existing = nil
+	for _, info in generatedFiles do
+		if info.name == string.lower(name) then
+			existing = info
+			break
+		end
+	end
+
+	if existing then
+		existing.content ..= writeMarkdown(item)
+	else
+		table.insert(generatedFiles, {
+			displayName = item.name,
+			name = string.lower(name),
+			content = writeMarkdown(item),
+		})
+	end
 end
 
 -- Remove any old files, generate new ones

From 712a7b5a5e480967c8332b85237be0de147f2a35 Mon Sep 17 00:00:00 2001
From: Filip Tibell <filip.tibell@gmail.com>
Date: Mon, 17 Jun 2024 13:40:13 +0200
Subject: [PATCH 3/3] Generate new API reference pages for Lune 0.8.5

---
 pages/api-reference/_meta.json |   1 +
 pages/api-reference/regex.md   | 230 +++++++++++++++++++++++++++++++++
 pages/api-reference/stdio.md   |  13 ++
 3 files changed, 244 insertions(+)
 create mode 100644 pages/api-reference/regex.md

diff --git a/pages/api-reference/_meta.json b/pages/api-reference/_meta.json
index 299d937..3282e95 100644
--- a/pages/api-reference/_meta.json
+++ b/pages/api-reference/_meta.json
@@ -4,6 +4,7 @@
 	"luau": "Luau",
 	"net": "Net",
 	"process": "Process",
+	"regex": "Regex",
 	"roblox": "Roblox",
 	"serde": "Serde",
 	"stdio": "Stdio",
diff --git a/pages/api-reference/regex.md b/pages/api-reference/regex.md
new file mode 100644
index 0000000..c84361b
--- /dev/null
+++ b/pages/api-reference/regex.md
@@ -0,0 +1,230 @@
+# Regex
+
+Built-in library for regular expressions
+
+#### Example usage
+
+```lua
+local Regex = require("@lune/regex")
+
+local re = Regex.new("hello")
+
+if re:isMatch("hello, world!") then
+	print("Matched!")
+end
+
+local caps = re:captures("hello, world! hello, again!")
+
+print(#caps) -- 2
+print(caps:get(1)) -- "hello"
+print(caps:get(2)) -- "hello"
+print(caps:get(3)) -- nil
+```
+
+## Constructors
+
+### new
+
+Creates a new `Regex` from a given string pattern.
+
+#### Errors
+
+This constructor throws an error if the given pattern is invalid.
+
+#### Parameters
+
+-   `pattern` `string` The string pattern to use
+
+#### Returns
+
+-   `Regex` The new Regex object
+
+---
+
+## Methods
+
+### isMatch
+
+Check if the given text matches the regular expression.
+
+This method may be slightly more efficient than calling `find` if you only need to know if the text
+matches the pattern.
+
+#### Parameters
+
+-   `self` Regex
+
+-   `text` `string` The text to search
+
+#### Returns
+
+-   `boolean` Whether the text matches the pattern
+
+---
+
+### find
+
+Finds the first match in the given text.
+
+Returns `nil` if no match was found.
+
+#### Parameters
+
+-   `self` Regex
+
+-   `text` `string` The text to search
+
+#### Returns
+
+-   `RegexMatch?` The match object
+
+---
+
+### captures
+
+Finds all matches in the given text as a `RegexCaptures` object.
+
+Returns `nil` if no matches are found.
+
+#### Parameters
+
+-   `self` Regex
+
+-   `text` `string` The text to search
+
+#### Returns
+
+-   `RegexCaptures?` The captures object
+
+---
+
+### split
+
+Splits the given text using the regular expression.
+
+#### Parameters
+
+-   `self` Regex
+
+-   `text` `string` The text to split
+
+#### Returns
+
+-   `{ string }` The split text
+
+---
+
+### replace
+
+Replaces the first match in the given text with the given replacer string.
+
+#### Parameters
+
+-   `self` Regex
+
+-   `haystack` `string` The text to search
+
+-   `replacer` `string` The string to replace matches with
+
+#### Returns
+
+-   `string` The text with the first match replaced
+
+---
+
+### replaceAll
+
+Replaces all matches in the given text with the given replacer string.
+
+#### Parameters
+
+-   `self` Regex
+
+-   `haystack` `string` The text to search
+
+-   `replacer` `string` The string to replace matches with
+
+#### Returns
+
+-   `string` The text with all matches replaced
+
+---
+
+# RegexCaptures
+
+Captures from a regular expression.
+
+## Methods
+
+### get
+
+Returns the match at the given index, if one exists.
+
+#### Parameters
+
+-   `self` RegexCaptures
+
+-   `index` `number` The index of the match to get
+
+#### Returns
+
+-   `RegexMatch` The match, if one exists
+
+---
+
+### group
+
+Returns the match for the given named match group, if one exists.
+
+#### Parameters
+
+-   `self` RegexCaptures
+
+-   `group` `string` The name of the group to get
+
+#### Returns
+
+-   `RegexMatch` The match, if one exists
+
+---
+
+### format
+
+Formats the captures using the given format string.
+
+#### Example usage
+
+```lua
+local regex = require("@lune/regex")
+
+local re = regex.new("(?<day>[0-9]{2})-(?<month>[0-9]{2})-(?<year>[0-9]{4})")
+
+local caps = re:captures("On 14-03-2010, I became a Tenneessee lamb.");
+assert(caps ~= nil, "Example pattern should match example text")
+
+local formatted = caps:format("year=$year, month=$month, day=$day")
+print(formatted) -- "year=2010, month=03, day=14"
+```
+
+#### Parameters
+
+-   `self` RegexCaptures
+
+-   `format` `string` The format string to use
+
+#### Returns
+
+-   `string` The formatted string
+
+---
+
+# RegexMatch
+
+A match from a regular expression.
+
+Contains the following values:
+
+-   `start` -- The start index of the match in the original string.
+-   `finish` -- The end index of the match in the original string.
+-   `text` -- The text that was matched.
+-   `len` -- The length of the text that was matched.
diff --git a/pages/api-reference/stdio.md b/pages/api-reference/stdio.md
index ba83df6..f221307 100644
--- a/pages/api-reference/stdio.md
+++ b/pages/api-reference/stdio.md
@@ -16,6 +16,9 @@ stdio.write("Hello, ")
 stdio.write("World! ")
 stdio.write("All on the same line")
 stdio.ewrite("\nAnd some error text, too")
+
+-- Reading the entire input from stdin
+local input = stdio.readToEnd()
 ```
 
 ## Functions
@@ -124,3 +127,13 @@ Writes a string directly to stderr, without any newline.
 -   `s` The string to write to stderr
 
 ---
+
+### readToEnd
+
+Reads the entire input from stdin.
+
+#### Returns
+
+-   The input from stdin
+
+---