Add mustuse and access control tags in typedefs file

This commit is contained in:
Filip Tibell 2023-02-15 22:51:01 +01:00
parent 79f6d6df8a
commit 9c4806a840
No known key found for this signature in database
3 changed files with 20 additions and 5 deletions

View file

@ -8,6 +8,7 @@
declare fs: { declare fs: {
--[=[ --[=[
@within fs @within fs
@must_use
Reads a file at `path`. Reads a file at `path`.
@ -24,6 +25,7 @@ declare fs: {
readFile: (path: string) -> string, readFile: (path: string) -> string,
--[=[ --[=[
@within fs @within fs
@must_use
Reads entries in a directory at `path`. Reads entries in a directory at `path`.
@ -96,6 +98,7 @@ declare fs: {
removeDir: (path: string) -> (), removeDir: (path: string) -> (),
--[=[ --[=[
@within fs @within fs
@must_use
Checks if a given path is a file. Checks if a given path is a file.
@ -110,6 +113,7 @@ declare fs: {
isFile: (path: string) -> boolean, isFile: (path: string) -> boolean,
--[=[ --[=[
@within fs @within fs
@must_use
Checks if a given path is a directory. Checks if a given path is a directory.
@ -192,6 +196,7 @@ declare net: {
request: (config: string | NetFetchParams) -> NetFetchResponse, request: (config: string | NetFetchParams) -> NetFetchResponse,
--[=[ --[=[
@within net @within net
@must_use
Connects to a web socket at the given URL. Connects to a web socket at the given URL.
@ -216,6 +221,7 @@ declare net: {
serve: (port: number, handlerOrConfig: NetServeHttpHandler | NetServeConfig) -> NetServeHandle, serve: (port: number, handlerOrConfig: NetServeHttpHandler | NetServeConfig) -> NetServeHandle,
--[=[ --[=[
@within net @within net
@must_use
Encodes the given value as JSON. Encodes the given value as JSON.
@ -226,6 +232,7 @@ declare net: {
jsonEncode: (value: any, pretty: boolean?) -> string, jsonEncode: (value: any, pretty: boolean?) -> string,
--[=[ --[=[
@within net @within net
@must_use
Decodes the given JSON string into a lua value. Decodes the given JSON string into a lua value.
@ -259,18 +266,21 @@ export type ProcessSpawnResult = {
declare process: { declare process: {
--[=[ --[=[
@within process @within process
@read_only
The arguments given when running the Lune script. The arguments given when running the Lune script.
]=] ]=]
args: { string }, args: { string },
--[=[ --[=[
@within process @within process
@read_only
The current working directory in which the Lune script is running. The current working directory in which the Lune script is running.
]=] ]=]
cwd: string, cwd: string,
--[=[ --[=[
@within process @within process
@new_fields
Current environment variables for this process. Current environment variables for this process.
@ -323,6 +333,7 @@ declare process: {
declare stdio: { declare stdio: {
--[=[ --[=[
@within stdio @within stdio
@must_use
Return an ANSI string that can be used to modify the persistent output color. Return an ANSI string that can be used to modify the persistent output color.
@ -343,6 +354,7 @@ declare stdio: {
color: (color: "reset" | "black" | "red" | "green" | "yellow" | "blue" | "purple" | "cyan" | "white") -> string, color: (color: "reset" | "black" | "red" | "green" | "yellow" | "blue" | "purple" | "cyan" | "white") -> string,
--[=[ --[=[
@within stdio @within stdio
@must_use
Return an ANSI string that can be used to modify the persistent output style. Return an ANSI string that can be used to modify the persistent output style.
@ -363,6 +375,7 @@ declare stdio: {
style: (style: "reset" | "bold" | "dim") -> string, style: (style: "reset" | "bold" | "dim") -> string,
--[=[ --[=[
@within stdio @within stdio
@must_use
Formats arguments into a human-readable string with syntax highlighting for tables. Formats arguments into a human-readable string with syntax highlighting for tables.
@ -388,6 +401,7 @@ declare stdio: {
ewrite: (s: string) -> (), ewrite: (s: string) -> (),
--[=[ --[=[
@within stdio @within stdio
@must_use
Prompts for user input using the wanted kind of prompt: Prompts for user input using the wanted kind of prompt:

View file

@ -2,7 +2,7 @@ use std::collections::HashMap;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Default, Debug)] #[derive(Serialize, Deserialize, Default, Debug, Clone)]
pub struct DocsGlobal { pub struct DocsGlobal {
pub documentation: String, pub documentation: String,
pub keys: HashMap<String, String>, pub keys: HashMap<String, String>,
@ -10,13 +10,13 @@ pub struct DocsGlobal {
pub code_sample: String, pub code_sample: String,
} }
#[derive(Serialize, Deserialize, Default, Debug)] #[derive(Serialize, Deserialize, Default, Debug, Clone)]
pub struct DocsFunctionParamLink { pub struct DocsFunctionParamLink {
pub name: String, pub name: String,
pub documentation: String, pub documentation: String,
} }
#[derive(Serialize, Deserialize, Default, Debug)] #[derive(Serialize, Deserialize, Default, Debug, Clone)]
pub struct DocsFunction { pub struct DocsFunction {
#[serde(skip)] #[serde(skip)]
pub global_name: String, pub global_name: String,
@ -27,7 +27,7 @@ pub struct DocsFunction {
pub code_sample: String, pub code_sample: String,
} }
#[derive(Serialize, Deserialize, Default, Debug)] #[derive(Serialize, Deserialize, Default, Debug, Clone)]
pub struct DocsParam { pub struct DocsParam {
#[serde(skip)] #[serde(skip)]
pub global_name: String, pub global_name: String,
@ -36,7 +36,7 @@ pub struct DocsParam {
pub documentation: String, pub documentation: String,
} }
#[derive(Serialize, Deserialize, Default, Debug)] #[derive(Serialize, Deserialize, Default, Debug, Clone)]
pub struct DocsReturn { pub struct DocsReturn {
#[serde(skip)] #[serde(skip)]
pub global_name: String, pub global_name: String,

View file

@ -10,6 +10,7 @@ use super::{
tag::{DocsTag, DocsTagKind, DocsTagList}, tag::{DocsTag, DocsTagKind, DocsTagList},
}; };
#[derive(Debug, Clone)]
pub struct DocumentationVisitor { pub struct DocumentationVisitor {
pub globals: Vec<(String, DocsGlobal)>, pub globals: Vec<(String, DocsGlobal)>,
pub functions: Vec<(String, DocsFunction)>, pub functions: Vec<(String, DocsFunction)>,