This commit is contained in:
Dante
2026-05-21 23:40:20 -07:00
parent 3e2915dff7
commit 877a69d844
5737 changed files with 29796 additions and 1589684 deletions

View File

@ -24,7 +24,7 @@ package lua.lib.lrexlib;
import haxe.extern.EitherType;
@:luaRequire("rex_pcre")
@:luaRequire("rex_pcre2")
extern class Rex {
inline static function create(expr:String, flag:EitherType<Int, String>):Rex {
return untyped Rex['new'](expr, flag);

View File

@ -0,0 +1,44 @@
/*
* Copyright (C)2005-2022 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package lua.lib.luasec;
import lua.lib.luasocket.Socket as LuaSocket;
@:luaRequire("ssl")
extern class Ssl {
static function wrap(sock:LuaSocket, params: SslParams):Result<SslTcpClient>;
}
typedef SslParams = {
mode: Mode,
protocol: Protocol,
}
enum abstract Mode(String) {
var Client = "client";
var Server = "server";
}
enum abstract Protocol(String) {
var Any = "any";
}

View File

@ -0,0 +1,29 @@
/*
* Copyright (C)2005-2022 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package lua.lib.luasec;
import lua.lib.luasocket.socket.TcpClient;
extern class SslTcpClient extends TcpClient {
function dohandshake():Result<Bool>;
}

View File

@ -32,11 +32,6 @@ extern class Utf8 {
**/
static function sub(str:String, start:Int, ?end:Int):StringSub;
/**
Returns the character code at position `index` of `str`.
**/
static function charCodeAt(str:String, index:Int):Int;
/**
Looks for the first match of pattern in the string `str`.
If it finds a match, then `find` returns the indices of `str` where this

View File

@ -27,6 +27,6 @@ extern class Check extends Handle {
static function new_check():Check;
@:native("new_check") function new():Void;
function start(handle:Handle):Int;
function start(cb:()->Void):Int;
function stop():Int;
}

View File

@ -3,6 +3,11 @@ package lua.lib.luv;
@:luaRequire("luv")
extern class Loop {
static function loop_close():Bool;
/**
Runs the event loop of libuv.
Haxe compiler automatically inserts a call to this function at the end of user's code if needed.
**/
static function run(?mode:String):Bool;
static function loop_alive():Bool;
static function stop():Void;

View File

@ -27,11 +27,15 @@ import lua.Result;
@:luaRequire("luv")
extern class FileSystem {
static final constants:Table<String,Int>;
@:native("fs_close")
@:overload(function(file:FileDescriptor, cb:String->Bool->Void):Request {})
static function close(file:FileDescriptor):Result<Bool>;
@:native("fs_open")
@:overload(function(path:String, flags:Int, mode:Int):Result<FileDescriptor> {})
@:overload(function(path:String, flags:Int, mode:Int, ?cb:String->FileDescriptor->Void):Request {})
@:overload(function(path:String, flags:Open, mode:Int, ?cb:String->FileDescriptor->Void):Request {})
static function open(path:String, flags:Open, mode:Int):Result<FileDescriptor>;
@ -40,20 +44,24 @@ extern class FileSystem {
static function read(file:FileDescriptor, len:Int, offset:Int):Result<String>;
@:native("fs_unlink")
@:overload(function(file:FileDescriptor, ?cb:String->String->Void):Request {})
static function unlink(file:FileDescriptor, content:String):Result<String>;
@:overload(function(file:String, ?cb:String->Bool->Void):Request {})
static function unlink(file:String, content:String):Result<Bool>;
@:native("fs_write")
@:overload(function(file:FileDescriptor, content:String, offset:Int, ?cb:String->Bool->Void):Int {})
static function write(file:FileDescriptor, content:String, offset:Int):Result<Bool>;
@:overload(function(file:FileDescriptor, content:String, offset:Int, ?cb:String->Int->Void):Int {})
static function write(file:FileDescriptor, content:String, offset:Int):Result<Int>;
@:native("fs_mkdir")
@:overload(function(path:String, mode:Int, cb:String->Bool->Void):Request {})
static function mkdir(path:String, mode:Int):Result<Bool>;
@:native("fs_mkdtemp")
@:overload(function(data:String, cb:String->Bool->Void):Request {})
static function mkdtemp(data:String):Result<Bool>;
@:overload(function(template:String, cb:String->String->Void):Request {})
static function mkdtemp(template:String):Result<String>;
@:native("fs_mkstemp")
@:overload(function(template:String, cb:String->FileDescriptor->String->Void):Request {})
static function mkstemp(template:String):Result<FileDescriptor>;
@:native("fs_rmdir")
@:overload(function(path:String, cb:String->Bool->Void):Request {})
@ -146,23 +154,27 @@ extern class FileSystem {
Not available on windows
**/
@:native("fs_lchown")
@:overload(function(descriptor:FileDescriptor, uid:Int, gid:Int, cb:String->Bool->Void):Request {})
static function lchown(descriptor:FileDescriptor, uid:Int, gid:Int):Bool;
@:overload(function(descriptor:String, uid:Int, gid:Int, cb:String->Bool->Void):Request {})
static function lchown(descriptor:String, uid:Int, gid:Int):Bool;
@:native("fs_copyfile")
@:overload(function(path:String, newPath:String, flags:Null<CopyFlags>, cb:String->Bool->Void):Request {})
static function copyfile(path:String, newPath:String, ?flags:CopyFlags):Bool;
@:native("fs_statfs")
@:overload(function(path:String, cb:StatFs->Bool->Void):Request {})
static function statfs(path:String):StatFs;
@:native("fs_opendir")
@:overload(function(path:String, cb:Handle->Bool->Void):Request {})
@:overload(function(path:String, cb:String->Handle->Void, ?entries:Int):Request {})
static function opendir(path:String):Handle;
@:native("fs_readdir")
@:overload(function(dir:Handle, cb:Table<Int, NameType>->Bool->Void):Request {})
static function readdir(path:String):Table<Int, NameType>;
@:overload(function(dir:Handle, cb:String->Table<Int, NameType>->Void):Request {})
static function readdir(path:Handle):Table<Int, NameType>;
@:native("fs_closedir")
@:overload(function(dir:Handle, cb:Bool->Void):Request {})
@:overload(function(dir:Handle, cb:String->Bool->Void):Request {})
static function closedir(dir:Handle):Bool;
}
@ -213,3 +225,24 @@ typedef StatFs = {
files:Int,
ffree:Int
}
typedef CopyFlags = {
?excl:Bool,
?ficlone:Bool,
?ficlone_force:Bool
}
enum abstract AccessMode(Int) to Int {
// from libuv sources
/* Test for read permission. */
var R_OK = 4;
/* Test for write permission. */
var W_OK = 2;
/* Test for execute permission. */
var X_OK = 1;
/* Test for existence. */
var F_OK = 0;
@:op(A | B) function or(b:AccessMode):Int;
}