2023-01-19 20:08:38 +00:00
|
|
|
-- Lune v0.0.2
|
2023-01-19 19:57:39 +00:00
|
|
|
|
2023-01-19 01:47:14 +00:00
|
|
|
declare fs: {
|
|
|
|
readFile: (path: string) -> string,
|
|
|
|
readDir: (path: string) -> { string },
|
|
|
|
writeFile: (path: string, contents: string) -> (),
|
|
|
|
writeDir: (path: string) -> (),
|
|
|
|
removeFile: (path: string) -> (),
|
|
|
|
removeDir: (path: string) -> (),
|
|
|
|
isFile: (path: string) -> boolean,
|
|
|
|
isDir: (path: string) -> boolean,
|
|
|
|
}
|
|
|
|
|
2023-01-19 22:56:12 +00:00
|
|
|
declare net: {
|
|
|
|
request: (config: string | {
|
|
|
|
url: string,
|
|
|
|
method: ("GET" | "POST" | "PUT" | "DELETE" | "HEAD" | "OPTIONS" | "PATCH")?,
|
|
|
|
headers: { [string]: string }?,
|
|
|
|
body: string?,
|
|
|
|
}) -> {
|
|
|
|
ok: boolean,
|
|
|
|
statusCode: number,
|
|
|
|
statusMessage: string,
|
|
|
|
headers: { [string]: string },
|
|
|
|
body: string,
|
|
|
|
},
|
|
|
|
jsonEncode: (value: any, pretty: boolean?) -> string,
|
|
|
|
jsonDecode: (encoded: string) -> any,
|
2023-01-19 01:47:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
declare process: {
|
|
|
|
getEnvVars: () -> { string },
|
|
|
|
getEnvVar: (key: string) -> string?,
|
|
|
|
setEnvVar: (key: string, value: string) -> (),
|
|
|
|
exit: (code: number?) -> (),
|
|
|
|
spawn: (program: string, params: { string }?) -> {
|
|
|
|
ok: boolean,
|
|
|
|
code: number,
|
|
|
|
stdout: string,
|
|
|
|
stderr: string,
|
|
|
|
},
|
|
|
|
}
|