diff --git a/pages/api-reference/luau.md b/pages/api-reference/luau.md index 6f20596..80a8369 100644 --- a/pages/api-reference/luau.md +++ b/pages/api-reference/luau.md @@ -107,7 +107,10 @@ The options passed while loading a luau chunk from an arbitrary string, or bytec This is a dictionary that may contain one or more of the following values: - `debugName` - The debug name of the closure. Defaults to `luau.load(...)`. -- `environment` - Environment values to set and/or override. Includes default globals unless - overwritten. +- `environment` - A custom environment to load the chunk in. Setting a custom environment will + deoptimize the chunk and forcefully disable codegen. Defaults to the global environment. +- `injectGlobals` - Whether or not to inject globals in the custom environment. Has no effect if + no custom environment is provided. Defaults to `true`. +- `codegenEnabled` - Whether or not to enable codegen. Defaults to `false`. --- diff --git a/pages/api-reference/serde.md b/pages/api-reference/serde.md index 7f09f8f..817e344 100644 --- a/pages/api-reference/serde.md +++ b/pages/api-reference/serde.md @@ -29,13 +29,7 @@ fs.writeFile("myFile.yaml", serde.encode("yaml", someYaml)) Encodes the given value using the given format. -Currently supported formats: - -| Name | Learn More | -| :----- | :------------------- | -| `json` | https://www.json.org | -| `yaml` | https://yaml.org | -| `toml` | https://toml.io | +See [`EncodeDecodeFormat`] for a list of supported formats. #### Parameters @@ -56,13 +50,7 @@ Currently supported formats: Decodes the given string using the given format into a lua value. -Currently supported formats: - -| Name | Learn More | -| :----- | :------------------- | -| `json` | https://www.json.org | -| `yaml` | https://yaml.org | -| `toml` | https://toml.io | +See [`EncodeDecodeFormat`] for a list of supported formats. #### Parameters @@ -80,14 +68,7 @@ Currently supported formats: Compresses the given string using the given format. -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 | +See [`CompressDecompressFormat`] for a list of supported formats. #### Parameters @@ -105,14 +86,7 @@ Currently supported formats: Decompresses the given string using the given format. -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 | +See [`CompressDecompressFormat`] for a list of supported formats. #### Parameters @@ -125,3 +99,95 @@ Currently supported formats: - The decompressed string --- + +### hash + +Hashes the given message using the given algorithm and returns the hash as a hex string. + +See [`HashAlgorithm`] for a list of supported algorithms. + +#### Parameters + +- `algorithm` The algorithm to use + +- `message` The message to hash + +#### Returns + +- The hash as a hex string + +--- + +### hmac + +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. + +#### Parameters + +- `algorithm` The algorithm to use + +- `message` The message to hash + +- `secret` string | buffer + +#### Returns + +- The hash as a base64 string + +--- + +## Types + +### 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 | + +--- + +### 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 | + +--- + +### 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 | + +---