@noita-ts/pollnet 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/async.d.ts +1 -1
- package/dist/async.lua +10 -4
- package/dist/lualib_bundle.lua +1 -0
- package/package.json +3 -4
- /package/{pollnet.dll → dist/pollnet.dll} +0 -0
package/dist/async.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ export declare class AsyncReactor {
|
|
|
41
41
|
* socket and its remote address, and may itself return a Promise which the
|
|
42
42
|
* coroutine parks on until it settles.
|
|
43
43
|
*/
|
|
44
|
-
runServer(server_sock: pollnet.Socket, client_body: (sock: pollnet.Socket, addr: string) => Promise<void>): void;
|
|
44
|
+
runServer(server_sock: pollnet.Socket, client_body: (sock: pollnet.Socket, addr: string) => Promise<void> | void): void;
|
|
45
45
|
}
|
|
46
46
|
export declare class HttpResponse {
|
|
47
47
|
status: number;
|
package/dist/async.lua
CHANGED
|
@@ -2,6 +2,7 @@ local ____lualib = require("lualib_bundle")
|
|
|
2
2
|
local __TS__Promise = ____lualib.__TS__Promise
|
|
3
3
|
local __TS__New = ____lualib.__TS__New
|
|
4
4
|
local __TS__Class = ____lualib.__TS__Class
|
|
5
|
+
local __TS__InstanceOf = ____lualib.__TS__InstanceOf
|
|
5
6
|
local __TS__StringSplit = ____lualib.__TS__StringSplit
|
|
6
7
|
local __TS__ArrayIsArray = ____lualib.__TS__ArrayIsArray
|
|
7
8
|
local Error = ____lualib.Error
|
|
@@ -90,7 +91,12 @@ function AsyncReactor.prototype.spawn(self, body)
|
|
|
90
91
|
end
|
|
91
92
|
function AsyncReactor.prototype.runServer(self, server_sock, client_body)
|
|
92
93
|
server_sock:on_connection(function(client_sock, addr)
|
|
93
|
-
self.reactor:run(function()
|
|
94
|
+
self.reactor:run(function()
|
|
95
|
+
local r = client_body(nil, client_sock, addr)
|
|
96
|
+
if __TS__InstanceOf(r, __TS__Promise) then
|
|
97
|
+
____exports.compat:yieldPromise(r)
|
|
98
|
+
end
|
|
99
|
+
end)
|
|
94
100
|
end)
|
|
95
101
|
self.reactor:run(function()
|
|
96
102
|
while (server_sock:await()) do
|
|
@@ -115,12 +121,12 @@ function HttpResponse.prototype.parseHeaders(self)
|
|
|
115
121
|
2
|
|
116
122
|
)
|
|
117
123
|
if not key or not value then
|
|
118
|
-
goto
|
|
124
|
+
goto __continue24
|
|
119
125
|
end
|
|
120
126
|
local prev = headers[key]
|
|
121
127
|
if not prev then
|
|
122
128
|
headers[key] = value
|
|
123
|
-
goto
|
|
129
|
+
goto __continue24
|
|
124
130
|
end
|
|
125
131
|
if __TS__ArrayIsArray(prev) then
|
|
126
132
|
prev[#prev + 1] = value
|
|
@@ -128,7 +134,7 @@ function HttpResponse.prototype.parseHeaders(self)
|
|
|
128
134
|
headers[key] = {prev, value}
|
|
129
135
|
end
|
|
130
136
|
end
|
|
131
|
-
::
|
|
137
|
+
::__continue24::
|
|
132
138
|
end
|
|
133
139
|
return headers
|
|
134
140
|
end
|
package/dist/lualib_bundle.lua
CHANGED
package/package.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noita-ts/pollnet",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"files": [
|
|
5
|
-
"dist/**/*.{lua,d.ts}",
|
|
6
|
-
"pollnet.dll",
|
|
5
|
+
"dist/**/*.{lua,dll,d.ts}",
|
|
7
6
|
"LICENSE-pollnet"
|
|
8
7
|
],
|
|
9
8
|
"type": "module",
|
|
@@ -20,7 +19,7 @@
|
|
|
20
19
|
}
|
|
21
20
|
},
|
|
22
21
|
"scripts": {
|
|
23
|
-
"build": "tstl -p . && cp *.lua
|
|
22
|
+
"build": "tstl -p . && cp *.{lua,d.ts,dll} dist/",
|
|
24
23
|
"prepublishOnly": "rm -rf dist && npm run build"
|
|
25
24
|
},
|
|
26
25
|
"dependencies": {
|
|
File without changes
|