@vitejs/devtools-kit 0.0.0-alpha.32 → 0.0.0-alpha.34
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/client.d.ts +2 -0
- package/dist/client.js +1752 -0
- package/dist/constants.d.ts +14 -0
- package/dist/constants.js +27 -0
- package/dist/index-v_pZSfYG.d.ts +486 -0
- package/dist/index.d.ts +8 -0
- package/dist/{index.mjs → index.js} +1 -3
- package/dist/{utils/shared-state.d.mts → shared-state-BFKKxNt1.d.ts} +2 -2
- package/dist/utils/{events.d.mts → events.d.ts} +1 -1
- package/dist/utils/{events.mjs → events.js} +1 -2
- package/dist/utils/{nanoid.mjs → nanoid.js} +1 -2
- package/dist/utils/shared-state.d.ts +2 -0
- package/dist/utils/{shared-state.mjs → shared-state.js} +3 -5
- package/package.json +15 -11
- package/dist/client-script-rH2r9q0G.d.mts +0 -1849
- package/dist/client.d.mts +0 -2
- package/dist/client.mjs +0 -1302
- package/dist/constants.d.mts +0 -7
- package/dist/constants.mjs +0 -20
- package/dist/index.d.mts +0 -3
- /package/dist/{events-57bKw4ct.d.mts → events-B41U-zeg.d.ts} +0 -0
- /package/dist/utils/{nanoid.d.mts → nanoid.d.ts} +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { T as DevToolsDocksUserSettings } from "./index-v_pZSfYG.js";
|
|
2
|
+
//#region src/constants.d.ts
|
|
3
|
+
declare const DEVTOOLS_MOUNT_PATH = "/.devtools/";
|
|
4
|
+
declare const DEVTOOLS_MOUNT_PATH_NO_TRAILING_SLASH = "/.devtools";
|
|
5
|
+
declare const DEVTOOLS_DIRNAME = ".devtools";
|
|
6
|
+
declare const DEVTOOLS_CONNECTION_META_FILENAME = ".connection.json";
|
|
7
|
+
declare const DEVTOOLS_RPC_DUMP_MANIFEST_FILENAME = ".rpc-dump/index.json";
|
|
8
|
+
declare const DEVTOOLS_DOCK_IMPORTS_FILENAME = ".client-imports.js";
|
|
9
|
+
declare const DEVTOOLS_DOCK_IMPORTS_VIRTUAL_ID = "/.devtools-client-imports.js";
|
|
10
|
+
declare const DEVTOOLS_RPC_DUMP_DIRNAME = ".rpc-dump";
|
|
11
|
+
declare const DEFAULT_CATEGORIES_ORDER: Record<string, number>;
|
|
12
|
+
declare const DEFAULT_STATE_USER_SETTINGS: () => DevToolsDocksUserSettings;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { DEFAULT_CATEGORIES_ORDER, DEFAULT_STATE_USER_SETTINGS, DEVTOOLS_CONNECTION_META_FILENAME, DEVTOOLS_DIRNAME, DEVTOOLS_DOCK_IMPORTS_FILENAME, DEVTOOLS_DOCK_IMPORTS_VIRTUAL_ID, DEVTOOLS_MOUNT_PATH, DEVTOOLS_MOUNT_PATH_NO_TRAILING_SLASH, DEVTOOLS_RPC_DUMP_DIRNAME, DEVTOOLS_RPC_DUMP_MANIFEST_FILENAME };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//#region src/constants.ts
|
|
2
|
+
const DEVTOOLS_MOUNT_PATH = "/.devtools/";
|
|
3
|
+
const DEVTOOLS_MOUNT_PATH_NO_TRAILING_SLASH = "/.devtools";
|
|
4
|
+
const DEVTOOLS_DIRNAME = ".devtools";
|
|
5
|
+
const DEVTOOLS_CONNECTION_META_FILENAME = ".connection.json";
|
|
6
|
+
const DEVTOOLS_RPC_DUMP_MANIFEST_FILENAME = ".rpc-dump/index.json";
|
|
7
|
+
const DEVTOOLS_DOCK_IMPORTS_FILENAME = ".client-imports.js";
|
|
8
|
+
const DEVTOOLS_DOCK_IMPORTS_VIRTUAL_ID = "/.devtools-client-imports.js";
|
|
9
|
+
const DEVTOOLS_RPC_DUMP_DIRNAME = ".rpc-dump";
|
|
10
|
+
const DEFAULT_CATEGORIES_ORDER = {
|
|
11
|
+
"~viteplus": -1e3,
|
|
12
|
+
"default": 0,
|
|
13
|
+
"app": 100,
|
|
14
|
+
"framework": 200,
|
|
15
|
+
"web": 300,
|
|
16
|
+
"advanced": 400,
|
|
17
|
+
"~builtin": 1e3
|
|
18
|
+
};
|
|
19
|
+
const DEFAULT_STATE_USER_SETTINGS = () => ({
|
|
20
|
+
docksHidden: [],
|
|
21
|
+
docksCategoriesHidden: [],
|
|
22
|
+
docksPinned: [],
|
|
23
|
+
docksCustomOrder: {},
|
|
24
|
+
showIframeAddressBar: false
|
|
25
|
+
});
|
|
26
|
+
//#endregion
|
|
27
|
+
export { DEFAULT_CATEGORIES_ORDER, DEFAULT_STATE_USER_SETTINGS, DEVTOOLS_CONNECTION_META_FILENAME, DEVTOOLS_DIRNAME, DEVTOOLS_DOCK_IMPORTS_FILENAME, DEVTOOLS_DOCK_IMPORTS_VIRTUAL_ID, DEVTOOLS_MOUNT_PATH, DEVTOOLS_MOUNT_PATH_NO_TRAILING_SLASH, DEVTOOLS_RPC_DUMP_DIRNAME, DEVTOOLS_RPC_DUMP_MANIFEST_FILENAME };
|
|
@@ -0,0 +1,486 @@
|
|
|
1
|
+
import { t as EventEmitter } from "./events-B41U-zeg.js";
|
|
2
|
+
import { o as SharedState } from "./shared-state-BFKKxNt1.js";
|
|
3
|
+
import { RpcDefinitionsFilter, RpcDefinitionsToFunctions, RpcFunctionsCollector, RpcFunctionsCollectorBase } from "@vitejs/devtools-rpc";
|
|
4
|
+
import { WebSocketRpcClientOptions } from "@vitejs/devtools-rpc/presets/ws/client";
|
|
5
|
+
import { DevToolsNodeRpcSessionMeta } from "@vitejs/devtools-rpc/presets/ws/server";
|
|
6
|
+
import { BirpcOptions, BirpcReturn } from "birpc";
|
|
7
|
+
import { Plugin, ResolvedConfig, ViteDevServer } from "vite";
|
|
8
|
+
import { ChildProcess } from "node:child_process";
|
|
9
|
+
|
|
10
|
+
//#region src/types/docks.d.ts
|
|
11
|
+
interface DevToolsDockHost {
|
|
12
|
+
readonly views: Map<string, DevToolsDockUserEntry>;
|
|
13
|
+
readonly events: EventEmitter<{
|
|
14
|
+
'dock:entry:updated': (entry: DevToolsDockUserEntry) => void;
|
|
15
|
+
}>;
|
|
16
|
+
register: <T extends DevToolsDockUserEntry>(entry: T, force?: boolean) => {
|
|
17
|
+
update: (patch: Partial<T>) => void;
|
|
18
|
+
};
|
|
19
|
+
update: (entry: DevToolsDockUserEntry) => void;
|
|
20
|
+
values: (options?: {
|
|
21
|
+
includeBuiltin?: boolean;
|
|
22
|
+
}) => DevToolsDockEntry[];
|
|
23
|
+
}
|
|
24
|
+
type DevToolsDockEntryCategory = 'app' | 'framework' | 'web' | 'advanced' | 'default' | '~viteplus' | '~builtin';
|
|
25
|
+
type DevToolsDockEntryIcon = string | {
|
|
26
|
+
light: string;
|
|
27
|
+
dark: string;
|
|
28
|
+
};
|
|
29
|
+
interface DevToolsDockEntryBase {
|
|
30
|
+
id: string;
|
|
31
|
+
title: string;
|
|
32
|
+
icon: DevToolsDockEntryIcon;
|
|
33
|
+
/**
|
|
34
|
+
* The default order of the entry in the dock.
|
|
35
|
+
* The higher the number the earlier it appears.
|
|
36
|
+
* @default 0
|
|
37
|
+
*/
|
|
38
|
+
defaultOrder?: number;
|
|
39
|
+
/**
|
|
40
|
+
* The category of the entry
|
|
41
|
+
* @default 'default'
|
|
42
|
+
*/
|
|
43
|
+
category?: DevToolsDockEntryCategory;
|
|
44
|
+
/**
|
|
45
|
+
* Whether the entry should be hidden from the user.
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
isHidden?: boolean;
|
|
49
|
+
}
|
|
50
|
+
interface ClientScriptEntry {
|
|
51
|
+
/**
|
|
52
|
+
* The filepath or module name to import from
|
|
53
|
+
*/
|
|
54
|
+
importFrom: string;
|
|
55
|
+
/**
|
|
56
|
+
* The name to import the module as
|
|
57
|
+
*
|
|
58
|
+
* @default 'default'
|
|
59
|
+
*/
|
|
60
|
+
importName?: string;
|
|
61
|
+
}
|
|
62
|
+
interface DevToolsViewIframe extends DevToolsDockEntryBase {
|
|
63
|
+
type: 'iframe';
|
|
64
|
+
url: string;
|
|
65
|
+
/**
|
|
66
|
+
* The id of the iframe, if multiple tabs is assigned with the same id, the iframe will be shared.
|
|
67
|
+
*
|
|
68
|
+
* When not provided, it would be treated as a unique frame.
|
|
69
|
+
*/
|
|
70
|
+
frameId?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Optional client script to import into the iframe
|
|
73
|
+
*/
|
|
74
|
+
clientScript?: ClientScriptEntry;
|
|
75
|
+
}
|
|
76
|
+
type DevToolsViewLauncherStatus = 'idle' | 'loading' | 'success' | 'error';
|
|
77
|
+
interface DevToolsViewLauncher extends DevToolsDockEntryBase {
|
|
78
|
+
type: 'launcher';
|
|
79
|
+
launcher: {
|
|
80
|
+
icon?: DevToolsDockEntryIcon;
|
|
81
|
+
title: string;
|
|
82
|
+
status?: DevToolsViewLauncherStatus;
|
|
83
|
+
error?: string;
|
|
84
|
+
description?: string;
|
|
85
|
+
buttonStart?: string;
|
|
86
|
+
buttonLoading?: string;
|
|
87
|
+
onLaunch: () => Promise<void>;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
interface DevToolsViewAction extends DevToolsDockEntryBase {
|
|
91
|
+
type: 'action';
|
|
92
|
+
action: ClientScriptEntry;
|
|
93
|
+
}
|
|
94
|
+
interface DevToolsViewCustomRender extends DevToolsDockEntryBase {
|
|
95
|
+
type: 'custom-render';
|
|
96
|
+
renderer: ClientScriptEntry;
|
|
97
|
+
}
|
|
98
|
+
interface DevToolsViewBuiltin extends DevToolsDockEntryBase {
|
|
99
|
+
type: '~builtin';
|
|
100
|
+
id: '~terminals' | '~logs' | '~client-auth-notice' | '~settings' | '~popup';
|
|
101
|
+
}
|
|
102
|
+
type DevToolsDockUserEntry = DevToolsViewIframe | DevToolsViewAction | DevToolsViewCustomRender | DevToolsViewLauncher;
|
|
103
|
+
type DevToolsDockEntry = DevToolsDockUserEntry | DevToolsViewBuiltin;
|
|
104
|
+
type DevToolsDockEntriesGrouped = [category: string, entries: DevToolsDockEntry[]][];
|
|
105
|
+
//#endregion
|
|
106
|
+
//#region src/types/rpc-augments.d.ts
|
|
107
|
+
/**
|
|
108
|
+
* To be extended
|
|
109
|
+
*/
|
|
110
|
+
interface DevToolsRpcClientFunctions {}
|
|
111
|
+
/**
|
|
112
|
+
* To be extended
|
|
113
|
+
*/
|
|
114
|
+
interface DevToolsRpcServerFunctions {}
|
|
115
|
+
/**
|
|
116
|
+
* To be extended
|
|
117
|
+
*/
|
|
118
|
+
interface DevToolsRpcSharedStates {}
|
|
119
|
+
//#endregion
|
|
120
|
+
//#region src/types/terminals.d.ts
|
|
121
|
+
interface DevToolsTerminalSessionStreamChunkEvent {
|
|
122
|
+
id: string;
|
|
123
|
+
chunks: string[];
|
|
124
|
+
ts: number;
|
|
125
|
+
}
|
|
126
|
+
interface DevToolsTerminalHost {
|
|
127
|
+
readonly sessions: Map<string, DevToolsTerminalSession>;
|
|
128
|
+
readonly events: EventEmitter<{
|
|
129
|
+
'terminal:session:updated': (session: DevToolsTerminalSession) => void;
|
|
130
|
+
'terminal:session:stream-chunk': (data: DevToolsTerminalSessionStreamChunkEvent) => void;
|
|
131
|
+
}>;
|
|
132
|
+
register: (session: DevToolsTerminalSession) => DevToolsTerminalSession;
|
|
133
|
+
update: (session: DevToolsTerminalSession) => void;
|
|
134
|
+
startChildProcess: (executeOptions: DevToolsChildProcessExecuteOptions, terminal: Omit<DevToolsTerminalSessionBase, 'status'>) => Promise<DevToolsChildProcessTerminalSession>;
|
|
135
|
+
}
|
|
136
|
+
type DevToolsTerminalStatus = 'running' | 'stopped' | 'error';
|
|
137
|
+
interface DevToolsTerminalSessionBase {
|
|
138
|
+
id: string;
|
|
139
|
+
title: string;
|
|
140
|
+
description?: string;
|
|
141
|
+
status: DevToolsTerminalStatus;
|
|
142
|
+
icon?: DevToolsDockEntryIcon;
|
|
143
|
+
}
|
|
144
|
+
interface DevToolsTerminalSession extends DevToolsTerminalSessionBase {
|
|
145
|
+
buffer?: string[];
|
|
146
|
+
stream?: ReadableStream<string>;
|
|
147
|
+
}
|
|
148
|
+
interface DevToolsChildProcessExecuteOptions {
|
|
149
|
+
command: string;
|
|
150
|
+
args: string[];
|
|
151
|
+
cwd?: string;
|
|
152
|
+
env?: Record<string, string>;
|
|
153
|
+
}
|
|
154
|
+
interface DevToolsChildProcessTerminalSession extends DevToolsTerminalSession {
|
|
155
|
+
type: 'child-process';
|
|
156
|
+
executeOptions: DevToolsChildProcessExecuteOptions;
|
|
157
|
+
getChildProcess: () => ChildProcess | undefined;
|
|
158
|
+
terminate: () => Promise<void>;
|
|
159
|
+
restart: () => Promise<void>;
|
|
160
|
+
}
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region src/types/views.d.ts
|
|
163
|
+
interface DevToolsViewHost {
|
|
164
|
+
/**
|
|
165
|
+
* @internal
|
|
166
|
+
*/
|
|
167
|
+
buildStaticDirs: {
|
|
168
|
+
baseUrl: string;
|
|
169
|
+
distDir: string;
|
|
170
|
+
}[];
|
|
171
|
+
/**
|
|
172
|
+
* Helper to host static files
|
|
173
|
+
* - In `dev` mode, it will register middleware to `viteServer.middlewares` to host the static files
|
|
174
|
+
* - In `build` mode, it will copy the static files to the dist directory
|
|
175
|
+
*/
|
|
176
|
+
hostStatic: (baseUrl: string, distDir: string) => void;
|
|
177
|
+
}
|
|
178
|
+
//#endregion
|
|
179
|
+
//#region src/types/vite-plugin.d.ts
|
|
180
|
+
interface DevToolsCapabilities {
|
|
181
|
+
rpc?: boolean;
|
|
182
|
+
views?: boolean;
|
|
183
|
+
}
|
|
184
|
+
interface DevToolsPluginOptions {
|
|
185
|
+
capabilities?: {
|
|
186
|
+
dev?: DevToolsCapabilities | boolean;
|
|
187
|
+
build?: DevToolsCapabilities | boolean;
|
|
188
|
+
};
|
|
189
|
+
setup: (context: DevToolsNodeContext) => void | Promise<void>;
|
|
190
|
+
}
|
|
191
|
+
interface DevToolsNodeContext {
|
|
192
|
+
/**
|
|
193
|
+
* Workspace root directory of Vite DevTools
|
|
194
|
+
*/
|
|
195
|
+
readonly workspaceRoot: string;
|
|
196
|
+
/**
|
|
197
|
+
* Current working directory of Vite DevTools
|
|
198
|
+
*/
|
|
199
|
+
readonly cwd: string;
|
|
200
|
+
/**
|
|
201
|
+
* Current mode of Vite DevTools
|
|
202
|
+
* - 'dev' - when Vite DevTools is running in dev mode
|
|
203
|
+
* - 'build' - when Vite DevTools is running in build mode (no server)
|
|
204
|
+
*/
|
|
205
|
+
readonly mode: 'dev' | 'build';
|
|
206
|
+
/**
|
|
207
|
+
* Resolved Vite configuration
|
|
208
|
+
*/
|
|
209
|
+
readonly viteConfig: ResolvedConfig;
|
|
210
|
+
/**
|
|
211
|
+
* Vite dev server instance (only available in dev mode)
|
|
212
|
+
*/
|
|
213
|
+
readonly viteServer?: ViteDevServer;
|
|
214
|
+
/**
|
|
215
|
+
* RPC functions host, for registering server-side RPC functions and calling client-side RPC functions
|
|
216
|
+
*/
|
|
217
|
+
rpc: RpcFunctionsHost;
|
|
218
|
+
/**
|
|
219
|
+
* Docks host, for registering dock entries
|
|
220
|
+
*/
|
|
221
|
+
docks: DevToolsDockHost;
|
|
222
|
+
/**
|
|
223
|
+
* Views host, for registering static views
|
|
224
|
+
*/
|
|
225
|
+
views: DevToolsViewHost;
|
|
226
|
+
/**
|
|
227
|
+
* Utils for the node context
|
|
228
|
+
*/
|
|
229
|
+
utils: DevToolsNodeUtils;
|
|
230
|
+
/**
|
|
231
|
+
* Terminals host, for registering terminal sessions and streaming terminal output
|
|
232
|
+
*/
|
|
233
|
+
terminals: DevToolsTerminalHost;
|
|
234
|
+
}
|
|
235
|
+
interface DevToolsNodeUtils {
|
|
236
|
+
/**
|
|
237
|
+
* Create a simple client script from a function or stringified code
|
|
238
|
+
*
|
|
239
|
+
* @deprecated DO NOT USE. This is mostly for testing only. Please use a proper importable module instead.
|
|
240
|
+
* @experimental
|
|
241
|
+
*/
|
|
242
|
+
createSimpleClientScript: (fn: string | ((ctx: DockClientScriptContext) => void)) => ClientScriptEntry;
|
|
243
|
+
}
|
|
244
|
+
interface ConnectionMeta {
|
|
245
|
+
backend: 'websocket' | 'static';
|
|
246
|
+
websocket?: number | string;
|
|
247
|
+
}
|
|
248
|
+
//#endregion
|
|
249
|
+
//#region src/types/rpc.d.ts
|
|
250
|
+
interface DevToolsNodeRpcSession {
|
|
251
|
+
meta: DevToolsNodeRpcSessionMeta;
|
|
252
|
+
rpc: BirpcReturn<DevToolsRpcClientFunctions, DevToolsRpcServerFunctions, false>;
|
|
253
|
+
}
|
|
254
|
+
interface RpcBroadcastOptions<METHOD, Args extends any[]> {
|
|
255
|
+
method: METHOD;
|
|
256
|
+
args: Args;
|
|
257
|
+
optional?: boolean;
|
|
258
|
+
event?: boolean;
|
|
259
|
+
filter?: (client: BirpcReturn<DevToolsRpcClientFunctions, DevToolsRpcServerFunctions, false>) => boolean | void;
|
|
260
|
+
}
|
|
261
|
+
type RpcFunctionsHost = RpcFunctionsCollectorBase<DevToolsRpcServerFunctions, DevToolsNodeContext> & {
|
|
262
|
+
/**
|
|
263
|
+
* Invoke a locally registered server RPC function directly.
|
|
264
|
+
*
|
|
265
|
+
* This bypasses transport and is useful for server-side cross-function calls.
|
|
266
|
+
*/
|
|
267
|
+
invokeLocal: <T extends keyof DevToolsRpcServerFunctions, Args extends Parameters<DevToolsRpcServerFunctions[T]>>(method: T, ...args: Args) => Promise<Awaited<ReturnType<DevToolsRpcServerFunctions[T]>>>;
|
|
268
|
+
/**
|
|
269
|
+
* Broadcast a message to all connected clients
|
|
270
|
+
*/
|
|
271
|
+
broadcast: <T extends keyof DevToolsRpcClientFunctions, Args extends Parameters<DevToolsRpcClientFunctions[T]>>(options: RpcBroadcastOptions<T, Args>) => Promise<void>;
|
|
272
|
+
/**
|
|
273
|
+
* Get the current RPC client
|
|
274
|
+
*
|
|
275
|
+
* Available in RPC functions to get the current RPC client
|
|
276
|
+
*/
|
|
277
|
+
getCurrentRpcSession: () => DevToolsNodeRpcSession | undefined;
|
|
278
|
+
/**
|
|
279
|
+
* The shared state host
|
|
280
|
+
*/
|
|
281
|
+
sharedState: RpcSharedStateHost;
|
|
282
|
+
};
|
|
283
|
+
interface RpcSharedStateGetOptions<T> {
|
|
284
|
+
sharedState?: SharedState<T>;
|
|
285
|
+
initialValue?: T;
|
|
286
|
+
}
|
|
287
|
+
interface RpcSharedStateHost {
|
|
288
|
+
get: <T extends keyof DevToolsRpcSharedStates>(key: T, options?: RpcSharedStateGetOptions<DevToolsRpcSharedStates[T]>) => Promise<SharedState<DevToolsRpcSharedStates[T]>>;
|
|
289
|
+
keys: () => string[];
|
|
290
|
+
}
|
|
291
|
+
//#endregion
|
|
292
|
+
//#region src/types/settings.d.ts
|
|
293
|
+
interface DevToolsDocksUserSettings {
|
|
294
|
+
docksHidden: string[];
|
|
295
|
+
docksCategoriesHidden: string[];
|
|
296
|
+
docksPinned: string[];
|
|
297
|
+
docksCustomOrder: Record<string, number>;
|
|
298
|
+
showIframeAddressBar: boolean;
|
|
299
|
+
}
|
|
300
|
+
//#endregion
|
|
301
|
+
//#region src/types/utils.d.ts
|
|
302
|
+
type Thenable<T> = T | Promise<T>;
|
|
303
|
+
type EntriesToObject<T extends readonly [string, any][]> = { [K in T[number] as K[0]]: K[1] };
|
|
304
|
+
type PartialWithoutId<T extends {
|
|
305
|
+
id: string;
|
|
306
|
+
}> = Partial<Omit<T, 'id'>> & {
|
|
307
|
+
id: string;
|
|
308
|
+
};
|
|
309
|
+
//#endregion
|
|
310
|
+
//#region src/types/vite-augment.d.ts
|
|
311
|
+
declare module 'vite' {
|
|
312
|
+
interface Plugin {
|
|
313
|
+
devtools?: DevToolsPluginOptions;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
interface PluginWithDevTools extends Plugin {
|
|
317
|
+
devtools?: DevToolsPluginOptions;
|
|
318
|
+
}
|
|
319
|
+
//#endregion
|
|
320
|
+
//#region src/client/rpc.d.ts
|
|
321
|
+
interface DevToolsRpcClientOptions {
|
|
322
|
+
connectionMeta?: ConnectionMeta;
|
|
323
|
+
baseURL?: string | string[];
|
|
324
|
+
/**
|
|
325
|
+
* The auth id to use for the client
|
|
326
|
+
*/
|
|
327
|
+
authId?: string;
|
|
328
|
+
wsOptions?: Partial<WebSocketRpcClientOptions>;
|
|
329
|
+
rpcOptions?: Partial<BirpcOptions<DevToolsRpcServerFunctions, DevToolsRpcClientFunctions, boolean>>;
|
|
330
|
+
}
|
|
331
|
+
type DevToolsRpcClientCall = BirpcReturn<DevToolsRpcServerFunctions, DevToolsRpcClientFunctions>['$call'];
|
|
332
|
+
type DevToolsRpcClientCallEvent = BirpcReturn<DevToolsRpcServerFunctions, DevToolsRpcClientFunctions>['$callEvent'];
|
|
333
|
+
type DevToolsRpcClientCallOptional = BirpcReturn<DevToolsRpcServerFunctions, DevToolsRpcClientFunctions>['$callOptional'];
|
|
334
|
+
interface DevToolsRpcClient {
|
|
335
|
+
/**
|
|
336
|
+
* The events of the client
|
|
337
|
+
*/
|
|
338
|
+
events: EventEmitter<RpcClientEvents>;
|
|
339
|
+
/**
|
|
340
|
+
* Whether the client is trusted
|
|
341
|
+
*/
|
|
342
|
+
readonly isTrusted: boolean | null;
|
|
343
|
+
/**
|
|
344
|
+
* The connection meta
|
|
345
|
+
*/
|
|
346
|
+
readonly connectionMeta: ConnectionMeta;
|
|
347
|
+
/**
|
|
348
|
+
* Return a promise that resolves when the client is trusted
|
|
349
|
+
*
|
|
350
|
+
* Rejects with an error if the timeout is reached
|
|
351
|
+
*
|
|
352
|
+
* @param timeout - The timeout in milliseconds, default to 60 seconds
|
|
353
|
+
*/
|
|
354
|
+
ensureTrusted: (timeout?: number) => Promise<boolean>;
|
|
355
|
+
/**
|
|
356
|
+
* Request trust from the server
|
|
357
|
+
*/
|
|
358
|
+
requestTrust: () => Promise<boolean>;
|
|
359
|
+
/**
|
|
360
|
+
* Call a RPC function on the server
|
|
361
|
+
*/
|
|
362
|
+
call: DevToolsRpcClientCall;
|
|
363
|
+
/**
|
|
364
|
+
* Call a RPC event on the server, and does not expect a response
|
|
365
|
+
*/
|
|
366
|
+
callEvent: DevToolsRpcClientCallEvent;
|
|
367
|
+
/**
|
|
368
|
+
* Call a RPC optional function on the server
|
|
369
|
+
*/
|
|
370
|
+
callOptional: DevToolsRpcClientCallOptional;
|
|
371
|
+
/**
|
|
372
|
+
* The client RPC host
|
|
373
|
+
*/
|
|
374
|
+
client: DevToolsClientRpcHost;
|
|
375
|
+
/**
|
|
376
|
+
* The shared state host
|
|
377
|
+
*/
|
|
378
|
+
sharedState: RpcSharedStateHost;
|
|
379
|
+
}
|
|
380
|
+
interface DevToolsRpcClientMode {
|
|
381
|
+
readonly isTrusted: boolean;
|
|
382
|
+
ensureTrusted: DevToolsRpcClient['ensureTrusted'];
|
|
383
|
+
requestTrust: DevToolsRpcClient['requestTrust'];
|
|
384
|
+
call: DevToolsRpcClient['call'];
|
|
385
|
+
callEvent: DevToolsRpcClient['callEvent'];
|
|
386
|
+
callOptional: DevToolsRpcClient['callOptional'];
|
|
387
|
+
}
|
|
388
|
+
declare function getDevToolsRpcClient(options?: DevToolsRpcClientOptions): Promise<DevToolsRpcClient>;
|
|
389
|
+
//#endregion
|
|
390
|
+
//#region src/client/docks.d.ts
|
|
391
|
+
interface DockPanelStorage {
|
|
392
|
+
width: number;
|
|
393
|
+
height: number;
|
|
394
|
+
top: number;
|
|
395
|
+
left: number;
|
|
396
|
+
position: 'left' | 'right' | 'bottom' | 'top';
|
|
397
|
+
open: boolean;
|
|
398
|
+
inactiveTimeout: number;
|
|
399
|
+
}
|
|
400
|
+
type DockClientType = 'embedded' | 'standalone';
|
|
401
|
+
interface DevToolsClientContext {
|
|
402
|
+
/**
|
|
403
|
+
* The RPC client to interact with the server
|
|
404
|
+
*/
|
|
405
|
+
readonly rpc: DevToolsRpcClient;
|
|
406
|
+
}
|
|
407
|
+
interface DocksContext extends DevToolsClientContext {
|
|
408
|
+
/**
|
|
409
|
+
* Type of the client environment
|
|
410
|
+
*
|
|
411
|
+
* 'embedded' - running inside an embedded floating panel
|
|
412
|
+
* 'standalone' - running inside a standalone window (no user app)
|
|
413
|
+
*/
|
|
414
|
+
readonly clientType: 'embedded' | 'standalone';
|
|
415
|
+
/**
|
|
416
|
+
* The panel context
|
|
417
|
+
*/
|
|
418
|
+
readonly panel: DocksPanelContext;
|
|
419
|
+
/**
|
|
420
|
+
* The docks entries context
|
|
421
|
+
*/
|
|
422
|
+
readonly docks: DocksEntriesContext;
|
|
423
|
+
}
|
|
424
|
+
type DevToolsClientRpcHost = RpcFunctionsCollector<DevToolsRpcClientFunctions, DevToolsClientContext>;
|
|
425
|
+
interface DocksPanelContext {
|
|
426
|
+
store: DockPanelStorage;
|
|
427
|
+
isDragging: boolean;
|
|
428
|
+
isResizing: boolean;
|
|
429
|
+
readonly isVertical: boolean;
|
|
430
|
+
}
|
|
431
|
+
interface DocksEntriesContext {
|
|
432
|
+
selectedId: string | null;
|
|
433
|
+
readonly selected: DevToolsDockEntry | null;
|
|
434
|
+
entries: DevToolsDockEntry[];
|
|
435
|
+
entryToStateMap: Map<string, DockEntryState>;
|
|
436
|
+
groupedEntries: DevToolsDockEntriesGrouped;
|
|
437
|
+
settings: SharedState<DevToolsDocksUserSettings>;
|
|
438
|
+
/**
|
|
439
|
+
* Get the state of a dock entry by its ID
|
|
440
|
+
*/
|
|
441
|
+
getStateById: (id: string) => DockEntryState | undefined;
|
|
442
|
+
/**
|
|
443
|
+
* Switch to the selected dock entry, pass `null` to clear the selection
|
|
444
|
+
*
|
|
445
|
+
* @returns Whether the selection was changed successfully
|
|
446
|
+
*/
|
|
447
|
+
switchEntry: (id?: string | null) => Promise<boolean>;
|
|
448
|
+
/**
|
|
449
|
+
* Toggle the selected dock entry
|
|
450
|
+
*
|
|
451
|
+
* @returns Whether the selection was changed successfully
|
|
452
|
+
*/
|
|
453
|
+
toggleEntry: (id: string) => Promise<boolean>;
|
|
454
|
+
}
|
|
455
|
+
interface DockEntryState {
|
|
456
|
+
entryMeta: DevToolsDockEntry;
|
|
457
|
+
readonly isActive: boolean;
|
|
458
|
+
domElements: {
|
|
459
|
+
iframe?: HTMLIFrameElement | null;
|
|
460
|
+
panel?: HTMLDivElement | null;
|
|
461
|
+
};
|
|
462
|
+
events: EventEmitter<DockEntryStateEvents>;
|
|
463
|
+
}
|
|
464
|
+
interface DockEntryStateEvents {
|
|
465
|
+
'entry:activated': () => void;
|
|
466
|
+
'entry:deactivated': () => void;
|
|
467
|
+
'entry:updated': (newMeta: DevToolsDockUserEntry) => void;
|
|
468
|
+
'dom:panel:mounted': (panel: HTMLDivElement) => void;
|
|
469
|
+
'dom:iframe:mounted': (iframe: HTMLIFrameElement) => void;
|
|
470
|
+
}
|
|
471
|
+
interface RpcClientEvents {
|
|
472
|
+
'rpc:is-trusted:updated': (isTrusted: boolean) => void;
|
|
473
|
+
}
|
|
474
|
+
//#endregion
|
|
475
|
+
//#region src/client/client-script.d.ts
|
|
476
|
+
/**
|
|
477
|
+
* Context for client scripts running in dock entries
|
|
478
|
+
*/
|
|
479
|
+
interface DockClientScriptContext extends DocksContext {
|
|
480
|
+
/**
|
|
481
|
+
* The state of the current dock entry
|
|
482
|
+
*/
|
|
483
|
+
current: DockEntryState;
|
|
484
|
+
}
|
|
485
|
+
//#endregion
|
|
486
|
+
export { DevToolsDockEntryIcon as $, RpcSharedStateGetOptions as A, DevToolsTerminalHost as B, PartialWithoutId as C, DevToolsNodeRpcSessionMeta as D, DevToolsNodeRpcSession as E, DevToolsNodeUtils as F, DevToolsRpcClientFunctions as G, DevToolsTerminalSessionBase as H, DevToolsPluginOptions as I, ClientScriptEntry as J, DevToolsRpcServerFunctions as K, DevToolsViewHost as L, ConnectionMeta as M, DevToolsCapabilities as N, RpcBroadcastOptions as O, DevToolsNodeContext as P, DevToolsDockEntryCategory as Q, DevToolsChildProcessExecuteOptions as R, EntriesToObject as S, DevToolsDocksUserSettings as T, DevToolsTerminalSessionStreamChunkEvent as U, DevToolsTerminalSession as V, DevToolsTerminalStatus as W, DevToolsDockEntry as X, DevToolsDockEntriesGrouped as Y, DevToolsDockEntryBase as Z, DevToolsRpcClientOptions as _, DockEntryState as a, DevToolsViewIframe as at, RpcDefinitionsToFunctions as b, DocksContext as c, RpcClientEvents as d, DevToolsDockHost as et, DevToolsRpcClient as f, DevToolsRpcClientMode as g, DevToolsRpcClientCallOptional as h, DockClientType as i, DevToolsViewCustomRender as it, RpcSharedStateHost as j, RpcFunctionsHost as k, DocksEntriesContext as l, DevToolsRpcClientCallEvent as m, DevToolsClientContext as n, DevToolsViewAction as nt, DockEntryStateEvents as o, DevToolsViewLauncher as ot, DevToolsRpcClientCall as p, DevToolsRpcSharedStates as q, DevToolsClientRpcHost as r, DevToolsViewBuiltin as rt, DockPanelStorage as s, DevToolsViewLauncherStatus as st, DockClientScriptContext as t, DevToolsDockUserEntry as tt, DocksPanelContext as u, getDevToolsRpcClient as v, Thenable as w, PluginWithDevTools as x, RpcDefinitionsFilter as y, DevToolsChildProcessTerminalSession as z };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { n as EventUnsubscribe, r as EventsMap, t as EventEmitter } from "./events-B41U-zeg.js";
|
|
2
|
+
import { $ as DevToolsDockEntryIcon, A as RpcSharedStateGetOptions, B as DevToolsTerminalHost, C as PartialWithoutId, D as DevToolsNodeRpcSessionMeta, E as DevToolsNodeRpcSession, F as DevToolsNodeUtils, G as DevToolsRpcClientFunctions, H as DevToolsTerminalSessionBase, I as DevToolsPluginOptions, J as ClientScriptEntry, K as DevToolsRpcServerFunctions, L as DevToolsViewHost, M as ConnectionMeta, N as DevToolsCapabilities, O as RpcBroadcastOptions, P as DevToolsNodeContext, Q as DevToolsDockEntryCategory, R as DevToolsChildProcessExecuteOptions, S as EntriesToObject, T as DevToolsDocksUserSettings, U as DevToolsTerminalSessionStreamChunkEvent, V as DevToolsTerminalSession, W as DevToolsTerminalStatus, X as DevToolsDockEntry, Y as DevToolsDockEntriesGrouped, Z as DevToolsDockEntryBase, at as DevToolsViewIframe, b as RpcDefinitionsToFunctions, et as DevToolsDockHost, it as DevToolsViewCustomRender, j as RpcSharedStateHost, k as RpcFunctionsHost, nt as DevToolsViewAction, ot as DevToolsViewLauncher, q as DevToolsRpcSharedStates, rt as DevToolsViewBuiltin, st as DevToolsViewLauncherStatus, tt as DevToolsDockUserEntry, w as Thenable, x as PluginWithDevTools, y as RpcDefinitionsFilter, z as DevToolsChildProcessTerminalSession } from "./index-v_pZSfYG.js";
|
|
3
|
+
import * as _vitejs_devtools_rpc0 from "@vitejs/devtools-rpc";
|
|
4
|
+
|
|
5
|
+
//#region src/utils/define.d.ts
|
|
6
|
+
declare const defineRpcFunction: <NAME extends string, TYPE extends _vitejs_devtools_rpc0.RpcFunctionType, ARGS extends any[], RETURN = void, const AS extends _vitejs_devtools_rpc0.RpcArgsSchema | undefined = undefined, const RS extends _vitejs_devtools_rpc0.RpcReturnSchema | undefined = undefined>(definition: _vitejs_devtools_rpc0.RpcFunctionDefinition<NAME, TYPE, ARGS, RETURN, AS, RS, DevToolsNodeContext>) => _vitejs_devtools_rpc0.RpcFunctionDefinition<NAME, TYPE, ARGS, RETURN, AS, RS, DevToolsNodeContext>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { ClientScriptEntry, ConnectionMeta, DevToolsCapabilities, DevToolsChildProcessExecuteOptions, DevToolsChildProcessTerminalSession, DevToolsDockEntriesGrouped, DevToolsDockEntry, DevToolsDockEntryBase, DevToolsDockEntryCategory, DevToolsDockEntryIcon, DevToolsDockHost, DevToolsDockUserEntry, DevToolsDocksUserSettings, DevToolsNodeContext, DevToolsNodeRpcSession, DevToolsNodeRpcSessionMeta, DevToolsNodeUtils, DevToolsPluginOptions, DevToolsRpcClientFunctions, DevToolsRpcServerFunctions, DevToolsRpcSharedStates, DevToolsTerminalHost, DevToolsTerminalSession, DevToolsTerminalSessionBase, DevToolsTerminalSessionStreamChunkEvent, DevToolsTerminalStatus, DevToolsViewAction, DevToolsViewBuiltin, DevToolsViewCustomRender, DevToolsViewHost, DevToolsViewIframe, DevToolsViewLauncher, DevToolsViewLauncherStatus, EntriesToObject, EventEmitter, EventUnsubscribe, EventsMap, PartialWithoutId, PluginWithDevTools, RpcBroadcastOptions, RpcDefinitionsFilter, RpcDefinitionsToFunctions, RpcFunctionsHost, RpcSharedStateGetOptions, RpcSharedStateHost, Thenable, defineRpcFunction };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as EventEmitter } from "
|
|
1
|
+
import { t as EventEmitter } from "./events-B41U-zeg.js";
|
|
2
2
|
import { Objectish, Patch, Patch as SharedStatePatch } from "immer";
|
|
3
3
|
|
|
4
4
|
//#region src/utils/shared-state.d.ts
|
|
@@ -50,4 +50,4 @@ interface SharedStateOptions<T> {
|
|
|
50
50
|
}
|
|
51
51
|
declare function createSharedState<T extends Objectish>(options: SharedStateOptions<T>): SharedState<T>;
|
|
52
52
|
//#endregion
|
|
53
|
-
export {
|
|
53
|
+
export { ImmutableSet as a, SharedStateOptions as c, ImmutableObject as i, SharedStatePatch as l, ImmutableArray as n, SharedState as o, ImmutableMap as r, SharedStateEvents as s, Immutable as t, createSharedState as u };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as ImmutableSet, c as SharedStateOptions, i as ImmutableObject, l as SharedStatePatch, n as ImmutableArray, o as SharedState, r as ImmutableMap, s as SharedStateEvents, t as Immutable, u as createSharedState } from "../shared-state-BFKKxNt1.js";
|
|
2
|
+
export { Immutable, ImmutableArray, ImmutableMap, ImmutableObject, ImmutableSet, SharedState, SharedStateEvents, SharedStateOptions, SharedStatePatch, createSharedState };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { createEventEmitter } from "./events.
|
|
2
|
-
import { nanoid } from "./nanoid.
|
|
1
|
+
import { createEventEmitter } from "./events.js";
|
|
2
|
+
import { nanoid } from "./nanoid.js";
|
|
3
3
|
import { applyPatches, enablePatches, produce, produceWithPatches } from "immer";
|
|
4
|
-
|
|
5
4
|
//#region src/utils/shared-state.ts
|
|
6
5
|
function createSharedState(options) {
|
|
7
6
|
const { enablePatches: enablePatches$1 = false } = options;
|
|
@@ -33,6 +32,5 @@ function createSharedState(options) {
|
|
|
33
32
|
syncIds
|
|
34
33
|
};
|
|
35
34
|
}
|
|
36
|
-
|
|
37
35
|
//#endregion
|
|
38
|
-
export { createSharedState };
|
|
36
|
+
export { createSharedState };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitejs/devtools-kit",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-alpha.
|
|
4
|
+
"version": "0.0.0-alpha.34",
|
|
5
5
|
"description": "Vite DevTools Kit",
|
|
6
6
|
"author": "VoidZero Inc.",
|
|
7
7
|
"license": "MIT",
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
],
|
|
20
20
|
"sideEffects": false,
|
|
21
21
|
"exports": {
|
|
22
|
-
".": "./dist/index.
|
|
23
|
-
"./client": "./dist/client.
|
|
24
|
-
"./constants": "./dist/constants.
|
|
25
|
-
"./utils/events": "./dist/utils/events.
|
|
26
|
-
"./utils/nanoid": "./dist/utils/nanoid.
|
|
27
|
-
"./utils/shared-state": "./dist/utils/shared-state.
|
|
22
|
+
".": "./dist/index.js",
|
|
23
|
+
"./client": "./dist/client.js",
|
|
24
|
+
"./constants": "./dist/constants.js",
|
|
25
|
+
"./utils/events": "./dist/utils/events.js",
|
|
26
|
+
"./utils/nanoid": "./dist/utils/nanoid.js",
|
|
27
|
+
"./utils/shared-state": "./dist/utils/shared-state.js",
|
|
28
28
|
"./package.json": "./package.json"
|
|
29
29
|
},
|
|
30
30
|
"types": "./dist/index.d.mts",
|
|
@@ -38,12 +38,16 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"birpc": "^4.0.0",
|
|
40
40
|
"immer": "^11.1.4",
|
|
41
|
-
"@vitejs/devtools-rpc": "0.0.0-alpha.
|
|
41
|
+
"@vitejs/devtools-rpc": "0.0.0-alpha.34"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"vite": "^8.0.0-beta.
|
|
44
|
+
"tsdown": "^0.21.1",
|
|
45
|
+
"ua-parser-modern": "^0.1.1",
|
|
46
|
+
"vite": "^8.0.0-beta.18"
|
|
47
|
+
},
|
|
48
|
+
"inlinedDependencies": {
|
|
49
|
+
"ohash": "2.0.11",
|
|
50
|
+
"ua-parser-modern": "0.1.1"
|
|
47
51
|
},
|
|
48
52
|
"scripts": {
|
|
49
53
|
"build": "tsdown",
|