You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@vitejs/devtools-rpc

Package Overview
Dependencies
Maintainers
4
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vitejs/devtools-rpc - npm Package Compare versions

Comparing version
0.0.0-alpha.1
to
0.0.0-alpha.2
+13
dist/index-BOWJO778.d.ts
import { BirpcGroup, BirpcOptions, ChannelOptions } from "birpc";
//#region src/presets/index.d.ts
type RpcServerPresetReturnType = <ClientFunctions, ServerFunctions>(rpc: BirpcGroup<ClientFunctions, ServerFunctions>, options?: Pick<BirpcOptions<ClientFunctions>, 'serialize' | 'deserialize'>) => void;
type RpcServerPresetBasicType = (...args: any[]) => RpcServerPresetReturnType;
type RpcServerPreset<T extends RpcServerPresetBasicType> = (...args: Parameters<T>) => RpcServerPresetReturnType;
declare function defineRpcServerPreset<T extends RpcServerPresetBasicType>(preset: T): RpcServerPreset<T>;
type RpcClientPresetReturnType = Omit<ChannelOptions, 'bind'>;
type RpcClientPresetBasicType = (...args: any[]) => RpcClientPresetReturnType;
type RpcClientPreset<T extends RpcClientPresetBasicType> = (...args: Parameters<T>) => RpcClientPresetReturnType;
declare function defineRpcClientPreset<T extends RpcClientPresetBasicType>(preset: T): RpcClientPreset<T>;
//#endregion
export { RpcClientPreset, RpcClientPresetBasicType, RpcClientPresetReturnType, RpcServerPreset, RpcServerPresetBasicType, RpcServerPresetReturnType, defineRpcClientPreset, defineRpcServerPreset };
import { BirpcGroup, BirpcOptions, BirpcReturn, EventOptions } from "birpc";
//#region src/client.d.ts
declare function createRpcClient<ServerFunctions = Record<string, never>, ClientFunctions extends object = Record<string, never>>(functions: ClientFunctions, options: {
preset: BirpcOptions<ServerFunctions>;
rpcOptions?: Partial<BirpcOptions<ServerFunctions>>;
}): BirpcReturn<ServerFunctions, ClientFunctions>;
//#endregion
//#region src/server.d.ts
declare function createRpcServer<ClientFunctions extends object = Record<string, never>, ServerFunctions extends object = Record<string, never>>(functions: ServerFunctions, options: {
preset: (rpc: BirpcGroup<ClientFunctions, ServerFunctions>) => void;
rpcOptions?: EventOptions<ClientFunctions>;
}): BirpcGroup<ClientFunctions, ServerFunctions>;
//#endregion
export { createRpcClient, createRpcServer };
import { createBirpc, createBirpcGroup } from "birpc";
//#region src/client.ts
function createRpcClient(functions, options) {
const { preset, rpcOptions = {} } = options;
return createBirpc(functions, {
...preset,
timeout: -1,
...rpcOptions
});
}
//#endregion
//#region src/server.ts
function createRpcServer(functions, options) {
const rpc = createBirpcGroup(functions, [], options?.rpcOptions ?? {});
options?.preset(rpc);
return rpc;
}
//#endregion
export { createRpcClient, createRpcServer };
//#region src/presets/index.ts
function defineRpcServerPreset(preset) {
return preset;
}
function defineRpcClientPreset(preset) {
return preset;
}
//#endregion
export { defineRpcClientPreset, defineRpcServerPreset };
import { RpcClientPreset, RpcClientPresetBasicType, RpcClientPresetReturnType, RpcServerPreset, RpcServerPresetBasicType, RpcServerPresetReturnType, defineRpcClientPreset, defineRpcServerPreset } from "../index-BOWJO778.js";
export { RpcClientPreset, RpcClientPresetBasicType, RpcClientPresetReturnType, RpcServerPreset, RpcServerPresetBasicType, RpcServerPresetReturnType, defineRpcClientPreset, defineRpcServerPreset };
import { defineRpcClientPreset, defineRpcServerPreset } from "../presets-CXNlz3L-.js";
export { defineRpcClientPreset, defineRpcServerPreset };
import { RpcClientPreset } from "../../index-BOWJO778.js";
//#region src/presets/ws/client.d.ts
interface WebSocketRpcClientOptions {
url: string;
onConnected?: (e: Event) => void;
onError?: (e: Error) => void;
onDisconnected?: (e: CloseEvent) => void;
}
declare const createWsRpcPreset: RpcClientPreset<(options: WebSocketRpcClientOptions) => {
on: (handler: (data: string) => void) => void;
post: (data: string) => void;
serialize: (obj: any) => string;
deserialize: (str: string) => unknown;
}>;
//#endregion
export { WebSocketRpcClientOptions, createWsRpcPreset };
import { defineRpcClientPreset } from "../../presets-CXNlz3L-.js";
import { parse, stringify } from "structured-clone-es";
//#region src/presets/ws/client.ts
function NOOP() {}
const createWsRpcPreset = defineRpcClientPreset((options) => {
const ws = new WebSocket(options.url);
const { onConnected = NOOP, onError = NOOP, onDisconnected = NOOP } = options;
ws.addEventListener("open", (e) => {
onConnected(e);
});
ws.addEventListener("error", (e) => {
const _e = e instanceof Error ? e : new Error(e.type);
onError(_e);
});
ws.addEventListener("close", (e) => {
onDisconnected(e);
});
return {
on: (handler) => {
ws.addEventListener("message", (e) => {
handler(e.data);
});
},
post: (data) => {
if (ws.readyState === WebSocket.OPEN) ws.send(data);
else {
function handler() {
ws.send(data);
ws.removeEventListener("open", handler);
}
ws.addEventListener("open", handler);
}
},
serialize: stringify,
deserialize: parse
};
});
//#endregion
export { createWsRpcPreset };
import { RpcServerPreset } from "../../index-BOWJO778.js";
import { BirpcGroup, BirpcOptions } from "birpc";
import { WebSocket } from "ws";
//#region src/presets/ws/server.d.ts
interface WebSocketRpcServerOptions {
port: number;
onConnected?: (ws: WebSocket) => void;
onDisconnected?: (ws: WebSocket) => void;
}
declare const createWsRpcPreset: RpcServerPreset<(options: WebSocketRpcServerOptions) => <ClientFunctions, ServerFunctions>(rpc: BirpcGroup<ClientFunctions, ServerFunctions>, options?: Pick<BirpcOptions<ClientFunctions>, 'serialize' | 'deserialize'>) => void>;
//#endregion
export { WebSocketRpcServerOptions, createWsRpcPreset };

Sorry, the diff of this file is too big to display

MIT License
Copyright (c) 2025-present, VoidZero Inc. and contributors
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.
+16
-13
{
"name": "@vitejs/devtools-rpc",
"type": "module",
"version": "0.0.0-alpha.1",
"version": "0.0.0-alpha.2",
"description": "DevTools rpc for Vite (work in progress)",
"author": "VoidZero Inc.",
"license": "MIT",
"homepage": "https://github.com/vitejs/vite-devtools#readme",
"homepage": "https://github.com/vitejs/devtools#readme",
"repository": {
"directory": "packages/devtools-rpc",
"type": "git",
"url": "git+https://github.com/vitejs/vite-devtools.git"
"url": "git+https://github.com/vitejs/devtools.git"
},
"bugs": "https://github.com/vitejs/vite-devtools/issues",
"bugs": "https://github.com/vitejs/devtools/issues",
"keywords": [

@@ -21,9 +22,11 @@ "vite",

"exports": {
".": "./dist/index.mjs",
"./presets/ws/server": "./dist/presets/ws/server.mjs",
"./presets/ws/client": "./dist/presets/ws/client.mjs",
"./presets": "./dist/presets/index.mjs"
".": "./dist/index.js",
"./presets": "./dist/presets/index.js",
"./presets/ws/client": "./dist/presets/ws/client.js",
"./presets/ws/server": "./dist/presets/ws/server.js",
"./package.json": "./package.json"
},
"main": "./dist/index.mjs",
"types": "./dist/index.d.mts",
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [

@@ -38,7 +41,7 @@ "dist"

"dependencies": {
"birpc": "^2.4.0",
"birpc": "^2.6.1",
"structured-clone-es": "^1.0.0"
},
"devDependencies": {
"tsdown": "^0.12.9",
"tsdown": "^0.15.6",
"ws": "^8.18.3"

@@ -48,4 +51,4 @@ },

"build": "tsdown",
"dev": "tsdown --watch"
"watch": "tsdown --watch"
}
}
import * as birpc0 from "birpc";
import { BirpcGroup, BirpcOptions, EventOptions } from "birpc";
//#region src/client.d.ts
declare function createRpcClient<ServerFunctions = Record<string, never>, ClientFunctions extends object = Record<string, never>>(functions: ClientFunctions, options: {
preset: BirpcOptions<ServerFunctions>;
rpcOptions?: Partial<BirpcOptions<ServerFunctions>>;
}): birpc0.BirpcReturn<ServerFunctions, ClientFunctions>;
//#endregion
//#region src/server.d.ts
declare function createRpcServer<ClientFunctions extends object = Record<string, never>, ServerFunctions extends object = Record<string, never>>(functions: ServerFunctions, options: {
preset: (rpc: BirpcGroup<ClientFunctions, ServerFunctions>) => void;
rpcOptions?: EventOptions<ClientFunctions>;
}): BirpcGroup<ClientFunctions, ServerFunctions>;
//#endregion
export { createRpcClient, createRpcServer };
import { createBirpc, createBirpcGroup } from "birpc";
//#region src/client.ts
function createRpcClient(functions, options) {
const { preset, rpcOptions = {} } = options;
return createBirpc(functions, {
...preset,
timeout: -1,
...rpcOptions
});
}
//#endregion
//#region src/server.ts
function createRpcServer(functions, options) {
const rpc = createBirpcGroup(functions, [], options?.rpcOptions ?? {});
options?.preset(rpc);
return rpc;
}
//#endregion
export { createRpcClient, createRpcServer };
import { BirpcGroup, BirpcOptions, ChannelOptions } from "birpc";
//#region src/presets/index.d.ts
type RpcServerPresetReturnType = <ClientFunctions, ServerFunctions>(rpc: BirpcGroup<ClientFunctions, ServerFunctions>, options?: Pick<BirpcOptions<ClientFunctions>, 'serialize' | 'deserialize'>) => void;
type RpcServerPresetBasicType = (...args: any[]) => RpcServerPresetReturnType;
type RpcServerPreset<T extends RpcServerPresetBasicType> = (...args: Parameters<T>) => RpcServerPresetReturnType;
declare function defineRpcServerPreset<T extends RpcServerPresetBasicType>(preset: T): RpcServerPreset<T>;
type RpcClientPresetReturnType = Omit<ChannelOptions, 'bind'>;
type RpcClientPresetBasicType = (...args: any[]) => RpcClientPresetReturnType;
type RpcClientPreset<T extends RpcClientPresetBasicType> = (...args: Parameters<T>) => RpcClientPresetReturnType;
declare function defineRpcClientPreset<T extends RpcClientPresetBasicType>(preset: T): RpcClientPreset<T>;
//#endregion
export { RpcClientPreset, RpcClientPresetBasicType, RpcClientPresetReturnType, RpcServerPreset, RpcServerPresetBasicType, RpcServerPresetReturnType, defineRpcClientPreset, defineRpcServerPreset };
import { RpcClientPreset, RpcClientPresetBasicType, RpcClientPresetReturnType, RpcServerPreset, RpcServerPresetBasicType, RpcServerPresetReturnType, defineRpcClientPreset, defineRpcServerPreset } from "./index-CNN7vRfy.mjs";
export { RpcClientPreset, RpcClientPresetBasicType, RpcClientPresetReturnType, RpcServerPreset, RpcServerPresetBasicType, RpcServerPresetReturnType, defineRpcClientPreset, defineRpcServerPreset };
import { defineRpcClientPreset, defineRpcServerPreset } from "./presets-B1cCNE-L.mjs";
export { defineRpcClientPreset, defineRpcServerPreset };
//#region src/presets/index.ts
function defineRpcServerPreset(preset) {
return preset;
}
function defineRpcClientPreset(preset) {
return preset;
}
//#endregion
export { defineRpcClientPreset, defineRpcServerPreset };
import { RpcClientPreset } from "../index-CNN7vRfy.mjs";
//#region src/presets/ws/client.d.ts
interface WebSocketRpcClientOptions {
url: string;
onConnected?: (e: Event) => void;
onError?: (e: Error) => void;
onDisconnected?: (e: CloseEvent) => void;
}
declare const createWsRpcPreset: RpcClientPreset<(options: WebSocketRpcClientOptions) => {
on: (handler: (data: string) => void) => void;
post: (data: string) => void;
serialize: (obj: any) => string;
deserialize: (str: string) => unknown;
}>;
//#endregion
export { WebSocketRpcClientOptions, createWsRpcPreset };
import { defineRpcClientPreset } from "../presets-B1cCNE-L.mjs";
import { parse, stringify } from "structured-clone-es";
//#region src/presets/ws/client.ts
function NOOP() {}
const createWsRpcPreset = defineRpcClientPreset((options) => {
const ws = new WebSocket(options.url);
const { onConnected = NOOP, onError = NOOP, onDisconnected = NOOP } = options;
ws.addEventListener("open", (e) => {
onConnected(e);
});
ws.addEventListener("error", (e) => {
const _e = e instanceof Error ? e : new Error(e.type);
onError(_e);
});
ws.addEventListener("close", (e) => {
onDisconnected(e);
});
return {
on: (handler) => {
ws.addEventListener("message", (e) => {
handler(e.data);
});
},
post: (data) => {
if (ws.readyState === WebSocket.OPEN) ws.send(data);
else {
function handler() {
ws.send(data);
ws.removeEventListener("open", handler);
}
ws.addEventListener("open", handler);
}
},
serialize: stringify,
deserialize: parse
};
});
//#endregion
export { createWsRpcPreset };
import { RpcServerPreset } from "../index-CNN7vRfy.mjs";
import { BirpcGroup, BirpcOptions } from "birpc";
import { WebSocket } from "ws";
//#region src/presets/ws/server.d.ts
interface WebSocketRpcServerOptions {
port: number;
onConnected?: (ws: WebSocket) => void;
onDisconnected?: (ws: WebSocket) => void;
}
declare const createWsRpcPreset: RpcServerPreset<(options: WebSocketRpcServerOptions) => <ClientFunctions, ServerFunctions>(rpc: BirpcGroup<ClientFunctions, ServerFunctions>, options?: Pick<BirpcOptions<ClientFunctions>, "serialize" | "deserialize">) => void>;
//#endregion
export { WebSocketRpcServerOptions, createWsRpcPreset };

Sorry, the diff of this file is too big to display

MIT License
Copyright (c) 2025-present, VoidZero Inc. and contributors
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.