@vitejs/devtools-rpc 0.0.0-alpha.3 → 0.0.0-alpha.31
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/README.md +214 -0
- package/dist/client.d.mts +9 -0
- package/dist/client.mjs +15 -0
- package/dist/index.d.mts +257 -0
- package/dist/index.mjs +321 -0
- package/dist/{index-BOWJO778.d.ts → presets/index.d.mts} +1 -1
- package/dist/presets/ws/client.d.mts +14 -0
- package/dist/presets/ws/{client.js → client.mjs} +5 -4
- package/dist/presets/ws/server.d.mts +22 -0
- package/dist/presets/ws/{server.js → server.mjs} +331 -329
- package/dist/server.d.mts +9 -0
- package/dist/server.mjs +14 -0
- package/package.json +17 -14
- package/dist/index.d.ts +0 -15
- package/dist/index.js +0 -22
- package/dist/presets/index.d.ts +0 -2
- package/dist/presets/index.js +0 -3
- package/dist/presets/ws/client.d.ts +0 -17
- package/dist/presets/ws/server.d.ts +0 -13
- /package/dist/{presets-CXNlz3L-.js → presets/index.mjs} +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BirpcGroup, EventOptions } from "birpc";
|
|
2
|
+
|
|
3
|
+
//#region src/server.d.ts
|
|
4
|
+
declare function createRpcServer<ClientFunctions extends object = Record<string, never>, ServerFunctions extends object = Record<string, never>>(functions: ServerFunctions, options: {
|
|
5
|
+
preset: (rpc: BirpcGroup<ClientFunctions, ServerFunctions, false>) => void;
|
|
6
|
+
rpcOptions?: EventOptions<ClientFunctions, ServerFunctions, false>;
|
|
7
|
+
}): BirpcGroup<ClientFunctions, ServerFunctions, false>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { createRpcServer };
|
package/dist/server.mjs
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createBirpcGroup } from "birpc";
|
|
2
|
+
|
|
3
|
+
//#region src/server.ts
|
|
4
|
+
function createRpcServer(functions, options) {
|
|
5
|
+
const rpc = createBirpcGroup(functions, [], {
|
|
6
|
+
...options?.rpcOptions,
|
|
7
|
+
proxify: false
|
|
8
|
+
});
|
|
9
|
+
options?.preset(rpc);
|
|
10
|
+
return rpc;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
export { createRpcServer };
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitejs/devtools-rpc",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-alpha.
|
|
5
|
-
"description": "
|
|
4
|
+
"version": "0.0.0-alpha.31",
|
|
5
|
+
"description": "Vite DevTools RPC Layer",
|
|
6
6
|
"author": "VoidZero Inc.",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"homepage": "https://github.com/vitejs/devtools#readme",
|
|
9
9
|
"repository": {
|
|
10
|
-
"directory": "packages/
|
|
10
|
+
"directory": "packages/rpc",
|
|
11
11
|
"type": "git",
|
|
12
12
|
"url": "git+https://github.com/vitejs/devtools.git"
|
|
13
13
|
},
|
|
@@ -19,15 +19,15 @@
|
|
|
19
19
|
],
|
|
20
20
|
"sideEffects": false,
|
|
21
21
|
"exports": {
|
|
22
|
-
".": "./dist/index.
|
|
23
|
-
"./
|
|
24
|
-
"./presets
|
|
25
|
-
"./presets/ws/
|
|
22
|
+
".": "./dist/index.mjs",
|
|
23
|
+
"./client": "./dist/client.mjs",
|
|
24
|
+
"./presets": "./dist/presets/index.mjs",
|
|
25
|
+
"./presets/ws/client": "./dist/presets/ws/client.mjs",
|
|
26
|
+
"./presets/ws/server": "./dist/presets/ws/server.mjs",
|
|
27
|
+
"./server": "./dist/server.mjs",
|
|
26
28
|
"./package.json": "./package.json"
|
|
27
29
|
},
|
|
28
|
-
"
|
|
29
|
-
"module": "./dist/index.js",
|
|
30
|
-
"types": "./dist/index.d.ts",
|
|
30
|
+
"types": "./dist/index.d.mts",
|
|
31
31
|
"files": [
|
|
32
32
|
"dist"
|
|
33
33
|
],
|
|
@@ -37,12 +37,15 @@
|
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"birpc": "^
|
|
41
|
-
"
|
|
40
|
+
"birpc": "^4.0.0",
|
|
41
|
+
"ohash": "^2.0.11",
|
|
42
|
+
"p-limit": "^7.3.0",
|
|
43
|
+
"structured-clone-es": "^1.0.0",
|
|
44
|
+
"valibot": "^1.2.0"
|
|
42
45
|
},
|
|
43
46
|
"devDependencies": {
|
|
44
|
-
"tsdown": "^0.
|
|
45
|
-
"ws": "^8.
|
|
47
|
+
"tsdown": "^0.20.2",
|
|
48
|
+
"ws": "^8.19.0"
|
|
46
49
|
},
|
|
47
50
|
"scripts": {
|
|
48
51
|
"build": "tsdown",
|
package/dist/index.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { BirpcGroup, BirpcOptions, BirpcReturn, EventOptions } from "birpc";
|
|
2
|
-
|
|
3
|
-
//#region src/client.d.ts
|
|
4
|
-
declare function createRpcClient<ServerFunctions = Record<string, never>, ClientFunctions extends object = Record<string, never>>(functions: ClientFunctions, options: {
|
|
5
|
-
preset: BirpcOptions<ServerFunctions>;
|
|
6
|
-
rpcOptions?: Partial<BirpcOptions<ServerFunctions>>;
|
|
7
|
-
}): BirpcReturn<ServerFunctions, ClientFunctions>;
|
|
8
|
-
//#endregion
|
|
9
|
-
//#region src/server.d.ts
|
|
10
|
-
declare function createRpcServer<ClientFunctions extends object = Record<string, never>, ServerFunctions extends object = Record<string, never>>(functions: ServerFunctions, options: {
|
|
11
|
-
preset: (rpc: BirpcGroup<ClientFunctions, ServerFunctions>) => void;
|
|
12
|
-
rpcOptions?: EventOptions<ClientFunctions>;
|
|
13
|
-
}): BirpcGroup<ClientFunctions, ServerFunctions>;
|
|
14
|
-
//#endregion
|
|
15
|
-
export { createRpcClient, createRpcServer };
|
package/dist/index.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { createBirpc, createBirpcGroup } from "birpc";
|
|
2
|
-
|
|
3
|
-
//#region src/client.ts
|
|
4
|
-
function createRpcClient(functions, options) {
|
|
5
|
-
const { preset, rpcOptions = {} } = options;
|
|
6
|
-
return createBirpc(functions, {
|
|
7
|
-
...preset,
|
|
8
|
-
timeout: -1,
|
|
9
|
-
...rpcOptions
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
//#endregion
|
|
14
|
-
//#region src/server.ts
|
|
15
|
-
function createRpcServer(functions, options) {
|
|
16
|
-
const rpc = createBirpcGroup(functions, [], options?.rpcOptions ?? {});
|
|
17
|
-
options?.preset(rpc);
|
|
18
|
-
return rpc;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
//#endregion
|
|
22
|
-
export { createRpcClient, createRpcServer };
|
package/dist/presets/index.d.ts
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { RpcClientPreset, RpcClientPresetBasicType, RpcClientPresetReturnType, RpcServerPreset, RpcServerPresetBasicType, RpcServerPresetReturnType, defineRpcClientPreset, defineRpcServerPreset } from "../index-BOWJO778.js";
|
|
2
|
-
export { RpcClientPreset, RpcClientPresetBasicType, RpcClientPresetReturnType, RpcServerPreset, RpcServerPresetBasicType, RpcServerPresetReturnType, defineRpcClientPreset, defineRpcServerPreset };
|
package/dist/presets/index.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { RpcClientPreset } from "../../index-BOWJO778.js";
|
|
2
|
-
|
|
3
|
-
//#region src/presets/ws/client.d.ts
|
|
4
|
-
interface WebSocketRpcClientOptions {
|
|
5
|
-
url: string;
|
|
6
|
-
onConnected?: (e: Event) => void;
|
|
7
|
-
onError?: (e: Error) => void;
|
|
8
|
-
onDisconnected?: (e: CloseEvent) => void;
|
|
9
|
-
}
|
|
10
|
-
declare const createWsRpcPreset: RpcClientPreset<(options: WebSocketRpcClientOptions) => {
|
|
11
|
-
on: (handler: (data: string) => void) => void;
|
|
12
|
-
post: (data: string) => void;
|
|
13
|
-
serialize: (obj: any) => string;
|
|
14
|
-
deserialize: (str: string) => unknown;
|
|
15
|
-
}>;
|
|
16
|
-
//#endregion
|
|
17
|
-
export { WebSocketRpcClientOptions, createWsRpcPreset };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { RpcServerPreset } from "../../index-BOWJO778.js";
|
|
2
|
-
import { BirpcGroup, BirpcOptions } from "birpc";
|
|
3
|
-
import { WebSocket } from "ws";
|
|
4
|
-
|
|
5
|
-
//#region src/presets/ws/server.d.ts
|
|
6
|
-
interface WebSocketRpcServerOptions {
|
|
7
|
-
port: number;
|
|
8
|
-
onConnected?: (ws: WebSocket) => void;
|
|
9
|
-
onDisconnected?: (ws: WebSocket) => void;
|
|
10
|
-
}
|
|
11
|
-
declare const createWsRpcPreset: RpcServerPreset<(options: WebSocketRpcServerOptions) => <ClientFunctions, ServerFunctions>(rpc: BirpcGroup<ClientFunctions, ServerFunctions>, options?: Pick<BirpcOptions<ClientFunctions>, 'serialize' | 'deserialize'>) => void>;
|
|
12
|
-
//#endregion
|
|
13
|
-
export { WebSocketRpcServerOptions, createWsRpcPreset };
|
|
File without changes
|