@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 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() return ____exports.compat:yieldPromise(client_body(nil, client_sock, addr)) end)
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 __continue23
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 __continue23
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
- ::__continue23::
137
+ ::__continue24::
132
138
  end
133
139
  return headers
134
140
  end
@@ -378,6 +378,7 @@ return {
378
378
  __TS__Promise = __TS__Promise,
379
379
  __TS__New = __TS__New,
380
380
  __TS__Class = __TS__Class,
381
+ __TS__InstanceOf = __TS__InstanceOf,
381
382
  __TS__StringSplit = __TS__StringSplit,
382
383
  __TS__ArrayIsArray = __TS__ArrayIsArray,
383
384
  Error = Error,
package/package.json CHANGED
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "name": "@noita-ts/pollnet",
3
- "version": "0.3.0",
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 *.d.ts dist/",
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