summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2023-03-21 12:03:39 +0800
committerGitHub <noreply@github.com>2023-03-21 12:03:39 +0800
commit5b6542e8ff276a195c502cc2479b53685429eb2e (patch)
tree67b9d4d25ed1b7940a62cd46128795abd54a7cad
parentb20f3f7f348c16ed2e387fe70cee9d2c236c7511 (diff)
parent0312eb482beeb1755f416d6f35a3eb9c020c4f94 (diff)
downloadlua-language-server-5b6542e8ff276a195c502cc2479b53685429eb2e.zip
Merge pull request #2021 from fesily/3rd-add-bee
3rd: meta add bee
-rw-r--r--meta/3rd/bee/config.json4
-rw-r--r--meta/3rd/bee/library/bee/filesystem.lua240
-rw-r--r--meta/3rd/bee/library/bee/platform.lua62
-rw-r--r--meta/3rd/bee/library/bee/subprocess.lua99
-rw-r--r--meta/3rd/bee/library/bee/thread.lua62
5 files changed, 467 insertions, 0 deletions
diff --git a/meta/3rd/bee/config.json b/meta/3rd/bee/config.json
new file mode 100644
index 00000000..0dce5817
--- /dev/null
+++ b/meta/3rd/bee/config.json
@@ -0,0 +1,4 @@
+{
+ "name" : "bee",
+ "words" : [ "require[%s%(\"']+bee%.%w+[%)\"']" ]
+}
diff --git a/meta/3rd/bee/library/bee/filesystem.lua b/meta/3rd/bee/library/bee/filesystem.lua
new file mode 100644
index 00000000..7cd4dcbb
--- /dev/null
+++ b/meta/3rd/bee/library/bee/filesystem.lua
@@ -0,0 +1,240 @@
+---@meta
+
+local m = {}
+
+---@enum bee.filesystem.copy_options
+local copy_options = {
+ none = 0,
+ skip_existing = 1,
+ overwrite_existing = 2,
+ update_existing = 4,
+ recursive = 8,
+ copy_symlinks = 16,
+ skip_symlinks = 32,
+ directories_only = 64,
+ create_symlinks = 128,
+ create_hard_links = 256,
+ __in_recursive_copy = 512,
+}
+
+---@alias bee.filesystem.path_arg string|bee.filesystem.path
+
+---@class bee.filesystem.path
+---@operator div(any):bee.filesystem.path
+---@operator concat(any):bee.filesystem.path
+local path = {}
+
+---@return string
+function path:string()
+end
+
+---@return bee.filesystem.path
+function path:filename()
+end
+
+---@return bee.filesystem.path
+function path:parent_path()
+end
+
+---@return bee.filesystem.path
+function path:stem()
+end
+
+---@return bee.filesystem.path
+function path:extension()
+end
+
+---@return boolean
+function path:is_absolute()
+end
+
+---@return boolean
+function path:is_relative()
+end
+
+---@return bee.filesystem.path
+function path:remove_filename()
+end
+
+---@param filename bee.filesystem.path_arg
+---@return bee.filesystem.path
+function path:replace_filename(filename)
+end
+
+---@param extension bee.filesystem.path_arg
+---@return bee.filesystem.path
+function path:replace_extension(extension)
+end
+
+---@param path bee.filesystem.path_arg
+---@return boolean
+function path:equal_extension(path)
+end
+
+---@return bee.filesystem.path
+function path:lexically_normal()
+end
+
+---@class bee.filesystem.file_status
+local file_status = {}
+
+---@alias bee.filesystem.file_type
+---| "'none'"
+---| "'not_found'"
+---| "'regular'"
+---| "'directory'"
+---| "'symlink'"
+---| "'block'"
+---| "'character'"
+---| "'fifo'"
+---| "'socket'"
+---| "'junction'"
+---| "'unknown'"
+
+---@return bee.filesystem.file_type
+function file_status:type()
+end
+
+---@return boolean
+function file_status:exists()
+end
+
+---@return boolean
+function file_status:is_directory()
+end
+
+---@return boolean
+function file_status:is_regular_file()
+end
+
+---@class bee.filesystem.directory_entry
+local directory_entry = {}
+
+---@return bee.filesystem.path
+function directory_entry:path()
+end
+
+---@return bee.filesystem.file_status
+function directory_entry:status()
+end
+
+---@return bee.filesystem.file_status
+function directory_entry:symlink_status()
+end
+
+---@return bee.filesystem.file_type
+function directory_entry:type()
+end
+
+---@return boolean
+function directory_entry:exists()
+end
+
+---@return boolean
+function directory_entry:is_directory()
+end
+
+---@return boolean
+function directory_entry:is_regular_file()
+end
+
+---@return bee.filesystem.path
+function m.path(path)
+end
+
+---@return bee.filesystem.file_status
+function m.status(path)
+end
+
+---@return bee.filesystem.file_status
+function m.symlink_status(path)
+end
+
+---@return boolean
+function m.exists(path)
+end
+
+---@return boolean
+function m.is_directory(path)
+end
+
+---@return boolean
+function m.is_regular_file(path)
+end
+
+function m.create_directory(path)
+end
+
+function m.create_directories(path)
+end
+
+function m.rename(from, to)
+end
+
+function m.remove(path)
+end
+
+function m.remove_all(path)
+end
+
+---@return bee.filesystem.path
+function m.current_path()
+end
+
+---@param options bee.filesystem.copy_options
+function m.copy(from, to, options)
+end
+
+---@param options bee.filesystem.copy_options
+function m.copy_file(from, to, options)
+end
+
+function m.absolute(path)
+end
+
+function m.canonical(path)
+end
+
+function m.relative(path)
+end
+
+function m.last_write_time(path)
+end
+
+function m.permissions(path)
+end
+
+function m.create_symlink(target, link)
+end
+
+function m.create_directory_symlink(target, link)
+end
+
+function m.create_hard_link(target, link)
+end
+
+---@return bee.filesystem.path
+function m.temp_directory_path()
+end
+
+---@return fun(table: bee.filesystem.path[]): bee.filesystem.path
+function m.pairs(path)
+end
+
+---@return bee.filesystem.path
+function m.exe_path()
+end
+
+---@return bee.filesystem.path
+function m.dll_path()
+end
+
+---@return bee.file
+function m.filelock(path)
+end
+
+---@return bee.filesystem.path
+function m.fullpath(path)
+end
+
+return m
diff --git a/meta/3rd/bee/library/bee/platform.lua b/meta/3rd/bee/library/bee/platform.lua
new file mode 100644
index 00000000..f380a9bf
--- /dev/null
+++ b/meta/3rd/bee/library/bee/platform.lua
@@ -0,0 +1,62 @@
+---@meta
+
+---@alias bee.platform.os
+---| '"windows"'
+---| '"android"'
+---| '"linux"'
+---| '"netbsd"'
+---| '"freebsd"'
+---| '"openbsd"'
+---| '"ios"'
+---| '"macos"'
+---| '"unknown"'
+
+---@alias bee.platform.OS
+---| '"Windows"'
+---| '"Android"'
+---| '"Linux"'
+---| '"NetBSD"'
+---| '"FreeBSD"'
+---| '"OpenBSD"'
+---| '"iOS"'
+---| '"macOS"'
+---| '"unknown"'
+
+---@alias bee.platform.arch
+---| '"x86"'
+---| '"x86_64"'
+---| '"arm"'
+---| '"arm64"'
+---| '"riscv"'
+---| '"unknown"'
+
+---@alias bee.platform.compiler
+---| '"clang"'
+---| '"gcc"'
+---| '"msvc"'
+---| '"unknown"'
+
+---@alias bee.platform.crt
+---| '"msvc"'
+---| '"bionic"'
+---| '"libstdc++"'
+---| '"libc++"'
+---| '"unknown"'
+
+local m = {
+ ---@type bee.platform.os
+ os = "unknown",
+ ---@type bee.platform.OS
+ OS = "unknown",
+ ---@type bee.platform.compiler
+ Compiler = "clang",
+ CompilerVersion = "",
+ CRTVersion = "",
+ ---@type bee.platform.crt
+ CRT = "msvc",
+ ---@type bee.platform.arch
+ Arch = "x86",
+ DEBUG = false,
+}
+
+return m
diff --git a/meta/3rd/bee/library/bee/subprocess.lua b/meta/3rd/bee/library/bee/subprocess.lua
new file mode 100644
index 00000000..0c979729
--- /dev/null
+++ b/meta/3rd/bee/library/bee/subprocess.lua
@@ -0,0 +1,99 @@
+---@meta
+
+---@class bee.file:lightuserdata
+local file = {}
+
+---@alias bee.file.readmode integer|"'a'"
+
+---@param mode bee.file.readmode
+---@return string
+function file:read(mode)
+end
+
+---@param buf number|integer|string
+function file:write(buf)
+end
+
+---@return fun():string
+function file:lines()
+end
+
+function file:flush()
+end
+
+function file:close()
+end
+
+---@param mode "'no'"|"'full'"|"'line'"
+function file:setvbuf(mode)
+end
+
+---@class bee.process
+---@field stderr bee.file?
+---@field stdout bee.file?
+---@field stdin bee.file?
+local process = {}
+
+---@return integer exit_code
+function process:wait()
+end
+
+---@return boolean success
+function process:kill()
+end
+
+---@return integer process_id
+function process:get_id()
+end
+
+---@return boolean is_running
+function process:is_running()
+end
+
+---@return boolean success
+function process:resume()
+end
+
+---@return any native_handle
+function process:native_handle()
+end
+
+---@class bee.subprocess
+local m = {}
+
+---@alias bee.bee.subprocess.spawn_io_arg boolean|file*|bee.file|"'stderr'"|"'stdout'"
+
+---@class bee.subprocess.spawn.options : string[]
+---@field stdin bee.bee.subprocess.spawn_io_arg?
+---@field stdout bee.bee.subprocess.spawn_io_arg?
+---@field stderr bee.bee.subprocess.spawn_io_arg?
+---@field env table<string,string>?
+---@field suspended boolean?
+---@field detached boolean?
+
+---@param options bee.subprocess.spawn.options
+---@return bee.process process
+function m.spawn(options)
+end
+
+---@param file file*|bee.file
+---@return integer offset
+---@return string? error_message
+function m.peek(file)
+end
+
+function m.filemode()
+end
+
+---@param name string
+---@param value string
+---@return boolean success
+---@return string? error_message
+function m.setenv(name, value)
+end
+
+---@return integer current_process_id
+function m.get_id()
+end
+
+return m
diff --git a/meta/3rd/bee/library/bee/thread.lua b/meta/3rd/bee/library/bee/thread.lua
new file mode 100644
index 00000000..9e005ea4
--- /dev/null
+++ b/meta/3rd/bee/library/bee/thread.lua
@@ -0,0 +1,62 @@
+---@meta
+
+---@class bee.rpc:lightuserdata
+
+---@class bee.thread_obj:lightuserdata
+
+---@class bee.channel
+local channel = {}
+
+function channel:push(...)
+end
+
+---@return boolean ok
+---@return ...
+function channel:pop()
+end
+
+---@return ...
+function channel:bpop()
+end
+
+---@class bee.thread
+local m = {}
+
+function m.sleep(sec)
+end
+
+---@return bee.thread_obj
+function m.thread(source, params)
+end
+
+function m.newchannel(name)
+end
+
+---@return bee.channel
+function m.channel(name)
+end
+
+function m.reset()
+end
+
+---@param th bee.thread_obj
+function m.wait(th)
+end
+
+function m.setname(name)
+end
+
+---@return bee.rpc
+function m.rpc_create()
+end
+
+function m.rpc_wait(rpc)
+end
+
+function m.rpc_return(rpc)
+end
+
+function m.preload_module()
+end
+
+return m