@pluv/platform-node 0.2.0 → 0.3.0
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/.turbo/turbo-build.log +7 -7
- package/CHANGELOG.md +18 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +3 -3
- package/src/NodePlatform.ts +5 -1
- package/src/createPluvHandler.ts +2 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @pluv/platform-node@0.
|
|
2
|
+
> @pluv/platform-node@0.3.0 build /home/runner/work/pluv/pluv/packages/platform-node
|
|
3
3
|
> tsup src/index.ts --format esm,cjs --dts
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
[34mCLI[39m Target: es6
|
|
9
9
|
[34mESM[39m Build start
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
11
|
+
[32mCJS[39m [1mdist/index.js [22m[32m7.98 KB[39m
|
|
12
|
+
[32mCJS[39m ⚡️ Build success in 69ms
|
|
13
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m6.16 KB[39m
|
|
14
|
+
[32mESM[39m ⚡️ Build success in 85ms
|
|
15
15
|
[34mDTS[39m Build start
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
17
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m2.
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 7185ms
|
|
17
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m2.77 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @pluv/platform-node
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- ae4e1f1: added platform-specific contexts to expose env in cloudflare and req in node.js
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [ae4e1f1]
|
|
12
|
+
- @pluv/io@0.5.0
|
|
13
|
+
|
|
14
|
+
## 0.2.1
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [8917309]
|
|
19
|
+
- @pluv/io@0.4.2
|
|
20
|
+
|
|
3
21
|
## 0.2.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbstractWebSocket, AbstractEventMap, AbstractListener, AbstractWebSocketConfig, AbstractPersistance, AbstractPubSub, AbstractPlatform, ConvertWebSocketConfig, PluvIO } from '@pluv/io';
|
|
2
2
|
import { MaybePromise, Maybe, InferIOAuthorizeUser, InferIOAuthorize, InferIOAuthorizeRequired } from '@pluv/types';
|
|
3
|
-
import Http from 'http';
|
|
3
|
+
import Http, { IncomingMessage } from 'http';
|
|
4
4
|
import WS, { WebSocket } from 'ws';
|
|
5
5
|
export { WebSocket } from 'ws';
|
|
6
6
|
|
|
@@ -23,7 +23,9 @@ type NodePlatformOptions = {
|
|
|
23
23
|
persistance: AbstractPersistance;
|
|
24
24
|
pubSub: AbstractPubSub;
|
|
25
25
|
};
|
|
26
|
-
declare class NodePlatform extends AbstractPlatform<WebSocket
|
|
26
|
+
declare class NodePlatform extends AbstractPlatform<WebSocket, {
|
|
27
|
+
req: IncomingMessage;
|
|
28
|
+
}> {
|
|
27
29
|
constructor(options?: NodePlatformOptions);
|
|
28
30
|
convertWebSocket(webSocket: WebSocket, config: ConvertWebSocketConfig): NodeWebSocket;
|
|
29
31
|
parseData(data: string | ArrayBuffer): Record<string, any>;
|
package/dist/index.js
CHANGED
|
@@ -98,8 +98,8 @@ var createPluvHandler = (config) => {
|
|
|
98
98
|
const token = ((_a = parsed.query) == null ? void 0 : _a.token) || void 0;
|
|
99
99
|
if (Array.isArray(token))
|
|
100
100
|
return onError.invalidToken();
|
|
101
|
-
const room = io.getRoom(roomId);
|
|
102
|
-
yield room.register(ws, { token });
|
|
101
|
+
const room = io.getRoom(roomId, { req });
|
|
102
|
+
yield room.register(ws, { req, token });
|
|
103
103
|
return { matched: true };
|
|
104
104
|
});
|
|
105
105
|
const createWsServer = () => {
|
package/dist/index.mjs
CHANGED
|
@@ -62,8 +62,8 @@ var createPluvHandler = (config) => {
|
|
|
62
62
|
const token = ((_a = parsed.query) == null ? void 0 : _a.token) || void 0;
|
|
63
63
|
if (Array.isArray(token))
|
|
64
64
|
return onError.invalidToken();
|
|
65
|
-
const room = io.getRoom(roomId);
|
|
66
|
-
yield room.register(ws, { token });
|
|
65
|
+
const room = io.getRoom(roomId, { req });
|
|
66
|
+
yield room.register(ws, { req, token });
|
|
67
67
|
return { matched: true };
|
|
68
68
|
});
|
|
69
69
|
const createWsServer = () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluv/platform-node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "@pluv/io adapter for node.js",
|
|
5
5
|
"author": "leedavidcs",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
"access": "public"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@types/node": "^20.1
|
|
20
|
+
"@types/node": "^20.2.1",
|
|
21
21
|
"@types/ws": "^8.5.4",
|
|
22
22
|
"path-to-regexp": "^6.2.1",
|
|
23
|
-
"@pluv/io": "^0.
|
|
23
|
+
"@pluv/io": "^0.5.0",
|
|
24
24
|
"@pluv/types": "^0.2.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
package/src/NodePlatform.ts
CHANGED
|
@@ -4,6 +4,7 @@ import crypto from "crypto";
|
|
|
4
4
|
import { TextDecoder } from "util";
|
|
5
5
|
import type { WebSocket } from "ws";
|
|
6
6
|
import { NodeWebSocket } from "./NodeWebSocket";
|
|
7
|
+
import { IncomingMessage, ServerResponse } from "http";
|
|
7
8
|
|
|
8
9
|
export type NodePlatformOptions =
|
|
9
10
|
| { persistance?: undefined; pubSub?: undefined }
|
|
@@ -12,7 +13,10 @@ export type NodePlatformOptions =
|
|
|
12
13
|
pubSub: AbstractPubSub;
|
|
13
14
|
};
|
|
14
15
|
|
|
15
|
-
export class NodePlatform extends AbstractPlatform<
|
|
16
|
+
export class NodePlatform extends AbstractPlatform<
|
|
17
|
+
WebSocket,
|
|
18
|
+
{ req: IncomingMessage }
|
|
19
|
+
> {
|
|
16
20
|
constructor(options: NodePlatformOptions = {}) {
|
|
17
21
|
const { persistance, pubSub } = options;
|
|
18
22
|
|
package/src/createPluvHandler.ts
CHANGED
|
@@ -108,9 +108,9 @@ export const createPluvHandler = <
|
|
|
108
108
|
|
|
109
109
|
if (Array.isArray(token)) return onError.invalidToken();
|
|
110
110
|
|
|
111
|
-
const room = io.getRoom(roomId);
|
|
111
|
+
const room = io.getRoom(roomId, { req });
|
|
112
112
|
|
|
113
|
-
await room.register(ws, { token });
|
|
113
|
+
await room.register(ws, { req, token });
|
|
114
114
|
|
|
115
115
|
return { matched: true };
|
|
116
116
|
};
|