@vitejs/devtools-kit
Advanced tools
| import { BirpcFn, BirpcReturn as BirpcReturn$1 } from "birpc"; | ||
| import { Plugin, ResolvedConfig, ViteDevServer } from "vite"; | ||
| //#region src/types/rpc-augments.d.ts | ||
| /** | ||
| * To be extended | ||
| */ | ||
| interface DevToolsRpcClientFunctions {} | ||
| /** | ||
| * To be extended | ||
| */ | ||
| interface DevToolsRpcServerFunctions {} | ||
| //#endregion | ||
| //#region src/types/utils.d.ts | ||
| type Thenable<T> = T | Promise<T>; | ||
| type EntriesToObject<T extends readonly [string, any][]> = { [K in T[number] as K[0]]: K[1] }; | ||
| //#endregion | ||
| //#region src/types/views.d.ts | ||
| interface DevToolsDockHost { | ||
| views: Map<string, DevToolsDockEntry>; | ||
| register: (entry: DevToolsDockEntry) => void; | ||
| update: (entry: DevToolsDockEntry) => void; | ||
| values: () => DevToolsDockEntry[]; | ||
| } | ||
| interface DevToolsViewHost { | ||
| /** | ||
| * @internal | ||
| */ | ||
| buildStaticDirs: { | ||
| baseUrl: string; | ||
| distDir: string; | ||
| }[]; | ||
| /** | ||
| * Helper to host static files | ||
| * - In `dev` mode, it will register middleware to `viteServer.middlewares` to host the static files | ||
| * - In `build` mode, it will copy the static files to the dist directory | ||
| */ | ||
| hostStatic: (baseUrl: string, distDir: string) => void; | ||
| } | ||
| type DevToolsDockEntryCategory = 'app' | 'framework' | 'web' | 'advanced' | 'default'; | ||
| interface DevToolsDockEntryBase { | ||
| id: string; | ||
| title: string; | ||
| icon: string | { | ||
| light: string; | ||
| dark: string; | ||
| }; | ||
| /** | ||
| * The default order of the entry in the dock. | ||
| * The higher the number the earlier it appears. | ||
| * @default 0 | ||
| */ | ||
| defaultOrder?: number; | ||
| /** | ||
| * The category of the entry | ||
| * @default 'default' | ||
| */ | ||
| category?: DevToolsDockEntryCategory; | ||
| } | ||
| interface ClientScriptEntry { | ||
| /** | ||
| * The filepath or module name to import from | ||
| */ | ||
| importFrom: string; | ||
| /** | ||
| * The name to import the module as | ||
| * | ||
| * @default 'default' | ||
| */ | ||
| importName?: string; | ||
| } | ||
| interface DevToolsViewIframe extends DevToolsDockEntryBase { | ||
| type: 'iframe'; | ||
| url: string; | ||
| /** | ||
| * The id of the iframe, if multiple tabs is assigned with the same id, the iframe will be shared. | ||
| * | ||
| * When not provided, it would be treated as a unique frame. | ||
| */ | ||
| frameId?: string; | ||
| /** | ||
| * Optional client script to import into the iframe | ||
| */ | ||
| clientScript?: ClientScriptEntry; | ||
| } | ||
| interface DevToolsViewAction extends DevToolsDockEntryBase { | ||
| type: 'action'; | ||
| action: ClientScriptEntry; | ||
| } | ||
| interface DevToolsViewCustomRender extends DevToolsDockEntryBase { | ||
| type: 'custom-render'; | ||
| renderer: ClientScriptEntry; | ||
| } | ||
| type DevToolsDockEntry = DevToolsViewIframe | DevToolsViewAction | DevToolsViewCustomRender; | ||
| //#endregion | ||
| //#region src/types/vite-plugin.d.ts | ||
| interface DevToolsCapabilities { | ||
| rpc?: boolean; | ||
| views?: boolean; | ||
| } | ||
| interface DevToolsPluginOptions { | ||
| capabilities?: { | ||
| dev?: DevToolsCapabilities | boolean; | ||
| build?: DevToolsCapabilities | boolean; | ||
| }; | ||
| setup: (context: DevToolsNodeContext) => void | Promise<void>; | ||
| } | ||
| interface DevToolsNodeContext { | ||
| readonly cwd: string; | ||
| readonly mode: 'dev' | 'build'; | ||
| readonly viteConfig: ResolvedConfig; | ||
| readonly viteServer?: ViteDevServer; | ||
| rpc: RpcFunctionsHost; | ||
| docks: DevToolsDockHost; | ||
| views: DevToolsViewHost; | ||
| utils: DevToolsNodeUtils; | ||
| } | ||
| interface DevToolsNodeUtils { | ||
| clientEntryFromSimpleFunction: (fn: () => void) => ClientScriptEntry; | ||
| } | ||
| interface ConnectionMeta { | ||
| backend: 'websocket' | 'static'; | ||
| websocket?: number | string; | ||
| } | ||
| //#endregion | ||
| //#region src/types/rpc.d.ts | ||
| /** | ||
| * Type of the RPC function, | ||
| * - static: A function that returns a static data (can be cached and dumped) | ||
| * - action: A function that performs an action (no data returned) | ||
| * - query: A function that queries a resource | ||
| */ | ||
| type RpcFunctionType = 'static' | 'action' | 'query'; | ||
| interface RpcFunctionsHost { | ||
| context: DevToolsNodeContext; | ||
| readonly functions: DevToolsRpcServerFunctions; | ||
| readonly definitions: Map<string, RpcFunctionDefinition<string, any, any, any>>; | ||
| register: (fn: RpcFunctionDefinition<string, any, any, any>) => void; | ||
| update: (fn: RpcFunctionDefinition<string, any, any, any>) => void; | ||
| } | ||
| interface RpcFunctionSetupResult<ARGS extends any[], RETURN = void> { | ||
| handler: (...args: ARGS) => RETURN; | ||
| } | ||
| interface RpcFunctionDefinition<NAME extends string, TYPE extends RpcFunctionType, ARGS extends any[] = [], RETURN = void> { | ||
| name: NAME; | ||
| type: TYPE; | ||
| setup: (context: DevToolsNodeContext) => Thenable<RpcFunctionSetupResult<ARGS, RETURN>>; | ||
| handler?: (...args: ARGS) => RETURN; | ||
| __resolved?: RpcFunctionSetupResult<ARGS, RETURN>; | ||
| __promise?: Thenable<RpcFunctionSetupResult<ARGS, RETURN>>; | ||
| } | ||
| type RpcDefinitionsToFunctions<T extends readonly RpcFunctionDefinition<any, any, any>[]> = EntriesToObject<{ [K in keyof T]: [T[K]['name'], Awaited<ReturnType<T[K]['setup']>>['handler']] }>; | ||
| type RpcDefinitionsFilter<T extends readonly RpcFunctionDefinition<any, any, any>[], Type extends RpcFunctionType> = { [K in keyof T]: T[K] extends { | ||
| type: Type; | ||
| } ? T[K] : never }; | ||
| //#endregion | ||
| //#region src/types/vite-augment.d.ts | ||
| declare module 'vite' { | ||
| interface Plugin { | ||
| devtools?: DevToolsPluginOptions; | ||
| } | ||
| } | ||
| interface PluginWithDevTools extends Plugin { | ||
| devtools?: DevToolsPluginOptions; | ||
| } | ||
| //#endregion | ||
| export { DevToolsViewIframe as C, DevToolsRpcServerFunctions as D, DevToolsRpcClientFunctions as E, DevToolsViewHost as S, Thenable as T, DevToolsDockEntryBase as _, RpcDefinitionsToFunctions as a, DevToolsViewAction as b, RpcFunctionType as c, DevToolsCapabilities as d, DevToolsNodeContext as f, DevToolsDockEntry as g, ClientScriptEntry as h, RpcDefinitionsFilter as i, RpcFunctionsHost as l, DevToolsPluginOptions as m, BirpcFn as n, RpcFunctionDefinition as o, DevToolsNodeUtils as p, BirpcReturn$1 as r, RpcFunctionSetupResult as s, PluginWithDevTools as t, ConnectionMeta as u, DevToolsDockEntryCategory as v, EntriesToObject as w, DevToolsViewCustomRender as x, DevToolsDockHost as y }; |
+13
-3
@@ -1,2 +0,2 @@ | ||
| import { D as DevToolsRpcServerFunctions, E as DevToolsRpcClientFunctions, g as DevToolsDockEntry, u as ConnectionMeta } from "./index-BtaHil_c.js"; | ||
| import { D as DevToolsRpcServerFunctions, E as DevToolsRpcClientFunctions, g as DevToolsDockEntry, u as ConnectionMeta } from "./index-CQIA5hSl.js"; | ||
| import { WebSocketRpcClientOptions } from "@vitejs/devtools-rpc/presets/ws/client"; | ||
@@ -12,3 +12,6 @@ import { BirpcOptions, BirpcReturn } from "birpc"; | ||
| } | ||
| interface ImportScriptContext { | ||
| /** | ||
| * Context for client scripts running in dock entries | ||
| */ | ||
| interface DockClientScriptContext { | ||
| /** | ||
@@ -23,2 +26,9 @@ * The dock entry info of the current dock item | ||
| /** | ||
| * Type of the client environment | ||
| * | ||
| * 'embedded' - running inside an embedded floating panel | ||
| * 'standalone' - running inside a standlone window (no user app) | ||
| */ | ||
| clientType: 'embedded' | 'standalone'; | ||
| /** | ||
| * Function to hide the panel, if applicable | ||
@@ -37,2 +47,2 @@ */ | ||
| //#endregion | ||
| export { DevToolsRpcClientOptions, ImportScriptContext, getDevToolsRpcClient }; | ||
| export { DevToolsRpcClientOptions, DockClientScriptContext, getDevToolsRpcClient }; |
+2
-2
@@ -1,2 +0,2 @@ | ||
| import { C as DevToolsViewWebComponent, D as DevToolsRpcServerFunctions, E as DevToolsRpcClientFunctions, S as DevToolsViewIframe, T as Thenable, _ as DevToolsDockEntryBase, a as RpcDefinitionsToFunctions, b as DevToolsViewCustomRender, c as RpcFunctionType, d as DevToolsCapabilities, f as DevToolsNodeContext, g as DevToolsDockEntry, h as ClientScriptEntry, i as RpcDefinitionsFilter, l as RpcFunctionsHost, m as DevToolsPluginOptions, n as BirpcFn, o as RpcFunctionDefinition, p as DevToolsNodeUtils, r as BirpcReturn, s as RpcFunctionSetupResult, t as PluginWithDevTools, u as ConnectionMeta, v as DevToolsDockHost, w as EntriesToObject, x as DevToolsViewHost, y as DevToolsViewAction } from "./index-BtaHil_c.js"; | ||
| import { C as DevToolsViewIframe, D as DevToolsRpcServerFunctions, E as DevToolsRpcClientFunctions, S as DevToolsViewHost, T as Thenable, _ as DevToolsDockEntryBase, a as RpcDefinitionsToFunctions, b as DevToolsViewAction, c as RpcFunctionType, d as DevToolsCapabilities, f as DevToolsNodeContext, g as DevToolsDockEntry, h as ClientScriptEntry, i as RpcDefinitionsFilter, l as RpcFunctionsHost, m as DevToolsPluginOptions, n as BirpcFn, o as RpcFunctionDefinition, p as DevToolsNodeUtils, r as BirpcReturn, s as RpcFunctionSetupResult, t as PluginWithDevTools, u as ConnectionMeta, v as DevToolsDockEntryCategory, w as EntriesToObject, x as DevToolsViewCustomRender, y as DevToolsDockHost } from "./index-CQIA5hSl.js"; | ||
@@ -7,2 +7,2 @@ //#region src/utils/rpc.d.ts | ||
| //#endregion | ||
| export { BirpcFn, BirpcReturn, ClientScriptEntry, ConnectionMeta, DevToolsCapabilities, DevToolsDockEntry, DevToolsDockEntryBase, DevToolsDockHost, DevToolsNodeContext, DevToolsNodeUtils, DevToolsPluginOptions, DevToolsRpcClientFunctions, DevToolsRpcServerFunctions, DevToolsViewAction, DevToolsViewCustomRender, DevToolsViewHost, DevToolsViewIframe, DevToolsViewWebComponent, EntriesToObject, PluginWithDevTools, RpcDefinitionsFilter, RpcDefinitionsToFunctions, RpcFunctionDefinition, RpcFunctionSetupResult, RpcFunctionType, RpcFunctionsHost, Thenable, defineRpcFunction, getRpcHandler }; | ||
| export { BirpcFn, BirpcReturn, ClientScriptEntry, ConnectionMeta, DevToolsCapabilities, DevToolsDockEntry, DevToolsDockEntryBase, DevToolsDockEntryCategory, DevToolsDockHost, DevToolsNodeContext, DevToolsNodeUtils, DevToolsPluginOptions, DevToolsRpcClientFunctions, DevToolsRpcServerFunctions, DevToolsViewAction, DevToolsViewCustomRender, DevToolsViewHost, DevToolsViewIframe, EntriesToObject, PluginWithDevTools, RpcDefinitionsFilter, RpcDefinitionsToFunctions, RpcFunctionDefinition, RpcFunctionSetupResult, RpcFunctionType, RpcFunctionsHost, Thenable, defineRpcFunction, getRpcHandler }; |
+2
-2
| { | ||
| "name": "@vitejs/devtools-kit", | ||
| "type": "module", | ||
| "version": "0.0.0-alpha.10", | ||
| "version": "0.0.0-alpha.11", | ||
| "description": "Vite DevTools Kit", | ||
@@ -37,3 +37,3 @@ "author": "VoidZero Inc.", | ||
| "birpc": "^2.6.1", | ||
| "@vitejs/devtools-rpc": "0.0.0-alpha.10" | ||
| "@vitejs/devtools-rpc": "0.0.0-alpha.11" | ||
| }, | ||
@@ -40,0 +40,0 @@ "devDependencies": { |
| import { BirpcFn, BirpcReturn as BirpcReturn$1 } from "birpc"; | ||
| import { Plugin, ResolvedConfig, ViteDevServer } from "vite"; | ||
| //#region src/types/rpc-augments.d.ts | ||
| /** | ||
| * To be extended | ||
| */ | ||
| interface DevToolsRpcClientFunctions {} | ||
| /** | ||
| * To be extended | ||
| */ | ||
| interface DevToolsRpcServerFunctions {} | ||
| //#endregion | ||
| //#region src/types/utils.d.ts | ||
| type Thenable<T> = T | Promise<T>; | ||
| type EntriesToObject<T extends readonly [string, any][]> = { [K in T[number] as K[0]]: K[1] }; | ||
| //#endregion | ||
| //#region src/types/views.d.ts | ||
| interface DevToolsDockHost { | ||
| views: Map<string, DevToolsDockEntry>; | ||
| register: (entry: DevToolsDockEntry) => void; | ||
| update: (entry: DevToolsDockEntry) => void; | ||
| values: () => DevToolsDockEntry[]; | ||
| } | ||
| interface DevToolsViewHost { | ||
| /** | ||
| * @internal | ||
| */ | ||
| buildStaticDirs: { | ||
| baseUrl: string; | ||
| distDir: string; | ||
| }[]; | ||
| /** | ||
| * Helper to host static files | ||
| * - In `dev` mode, it will register middleware to `viteServer.middlewares` to host the static files | ||
| * - In `build` mode, it will copy the static files to the dist directory | ||
| */ | ||
| hostStatic: (baseUrl: string, distDir: string) => void; | ||
| } | ||
| interface DevToolsDockEntryBase { | ||
| id: string; | ||
| title: string; | ||
| icon: string; | ||
| } | ||
| interface ClientScriptEntry { | ||
| /** | ||
| * The filepath or module name to import from | ||
| */ | ||
| importFrom: string; | ||
| /** | ||
| * The name to import the module as | ||
| * | ||
| * @default 'default' | ||
| */ | ||
| importName?: string; | ||
| } | ||
| interface DevToolsViewIframe extends DevToolsDockEntryBase { | ||
| type: 'iframe'; | ||
| url: string; | ||
| /** | ||
| * The id of the iframe, if multiple tabs is assigned with the same id, the iframe will be shared. | ||
| * | ||
| * When not provided, it would be treated as a unique frame. | ||
| */ | ||
| frameId?: string; | ||
| /** | ||
| * Optional script to import into the iframe | ||
| */ | ||
| import?: ClientScriptEntry; | ||
| } | ||
| interface DevToolsViewWebComponent extends DevToolsDockEntryBase { | ||
| type: 'webcomponent'; | ||
| import: ClientScriptEntry; | ||
| } | ||
| interface DevToolsViewAction extends DevToolsDockEntryBase { | ||
| type: 'action'; | ||
| import: ClientScriptEntry; | ||
| } | ||
| interface DevToolsViewCustomRender extends DevToolsDockEntryBase { | ||
| type: 'custom-render'; | ||
| import: ClientScriptEntry; | ||
| } | ||
| type DevToolsDockEntry = DevToolsViewIframe | DevToolsViewWebComponent | DevToolsViewAction | DevToolsViewCustomRender; | ||
| //#endregion | ||
| //#region src/types/vite-plugin.d.ts | ||
| interface DevToolsCapabilities { | ||
| rpc?: boolean; | ||
| views?: boolean; | ||
| } | ||
| interface DevToolsPluginOptions { | ||
| capabilities?: { | ||
| dev?: DevToolsCapabilities | boolean; | ||
| build?: DevToolsCapabilities | boolean; | ||
| }; | ||
| setup: (context: DevToolsNodeContext) => void | Promise<void>; | ||
| } | ||
| interface DevToolsNodeContext { | ||
| readonly cwd: string; | ||
| readonly mode: 'dev' | 'build'; | ||
| readonly viteConfig: ResolvedConfig; | ||
| readonly viteServer?: ViteDevServer; | ||
| rpc: RpcFunctionsHost; | ||
| docks: DevToolsDockHost; | ||
| views: DevToolsViewHost; | ||
| utils: DevToolsNodeUtils; | ||
| } | ||
| interface DevToolsNodeUtils { | ||
| clientEntryFromSimpleFunction: (fn: () => void) => ClientScriptEntry; | ||
| } | ||
| interface ConnectionMeta { | ||
| backend: 'websocket' | 'static'; | ||
| websocket?: number | string; | ||
| } | ||
| //#endregion | ||
| //#region src/types/rpc.d.ts | ||
| /** | ||
| * Type of the RPC function, | ||
| * - static: A function that returns a static data (can be cached and dumped) | ||
| * - action: A function that performs an action (no data returned) | ||
| * - query: A function that queries a resource | ||
| */ | ||
| type RpcFunctionType = 'static' | 'action' | 'query'; | ||
| interface RpcFunctionsHost { | ||
| context: DevToolsNodeContext; | ||
| readonly functions: DevToolsRpcServerFunctions; | ||
| readonly definitions: Map<string, RpcFunctionDefinition<string, any, any, any>>; | ||
| register: (fn: RpcFunctionDefinition<string, any, any, any>) => void; | ||
| update: (fn: RpcFunctionDefinition<string, any, any, any>) => void; | ||
| } | ||
| interface RpcFunctionSetupResult<ARGS extends any[], RETURN = void> { | ||
| handler: (...args: ARGS) => RETURN; | ||
| } | ||
| interface RpcFunctionDefinition<NAME extends string, TYPE extends RpcFunctionType, ARGS extends any[] = [], RETURN = void> { | ||
| name: NAME; | ||
| type: TYPE; | ||
| setup: (context: DevToolsNodeContext) => Thenable<RpcFunctionSetupResult<ARGS, RETURN>>; | ||
| handler?: (...args: ARGS) => RETURN; | ||
| __resolved?: RpcFunctionSetupResult<ARGS, RETURN>; | ||
| __promise?: Thenable<RpcFunctionSetupResult<ARGS, RETURN>>; | ||
| } | ||
| type RpcDefinitionsToFunctions<T extends readonly RpcFunctionDefinition<any, any, any>[]> = EntriesToObject<{ [K in keyof T]: [T[K]['name'], Awaited<ReturnType<T[K]['setup']>>['handler']] }>; | ||
| type RpcDefinitionsFilter<T extends readonly RpcFunctionDefinition<any, any, any>[], Type extends RpcFunctionType> = { [K in keyof T]: T[K] extends { | ||
| type: Type; | ||
| } ? T[K] : never }; | ||
| //#endregion | ||
| //#region src/types/vite-augment.d.ts | ||
| declare module 'vite' { | ||
| interface Plugin { | ||
| devtools?: DevToolsPluginOptions; | ||
| } | ||
| } | ||
| interface PluginWithDevTools extends Plugin { | ||
| devtools?: DevToolsPluginOptions; | ||
| } | ||
| //#endregion | ||
| export { DevToolsViewWebComponent as C, DevToolsRpcServerFunctions as D, DevToolsRpcClientFunctions as E, DevToolsViewIframe as S, Thenable as T, DevToolsDockEntryBase as _, RpcDefinitionsToFunctions as a, DevToolsViewCustomRender as b, RpcFunctionType as c, DevToolsCapabilities as d, DevToolsNodeContext as f, DevToolsDockEntry as g, ClientScriptEntry as h, RpcDefinitionsFilter as i, RpcFunctionsHost as l, DevToolsPluginOptions as m, BirpcFn as n, RpcFunctionDefinition as o, DevToolsNodeUtils as p, BirpcReturn$1 as r, RpcFunctionSetupResult as s, PluginWithDevTools as t, ConnectionMeta as u, DevToolsDockHost as v, EntriesToObject as w, DevToolsViewHost as x, DevToolsViewAction as y }; |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
13069
4.42%264
8.64%2
100%+ Added
+ Added
- Removed
- Removed