@vitejs/devtools 0.0.0-alpha.20 → 0.0.0-alpha.21
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/{cli-commands-BBPbCd8A.js → cli-commands-CkG1gOFc.js} +13 -12
- package/dist/cli-commands.js +2 -2
- package/dist/cli.js +2 -2
- package/dist/client/inject.js +32 -21
- package/dist/client/standalone/assets/{index-g0E0pe2M.js → index-Dpn5Nv-R.js} +2 -2
- package/dist/client/standalone/assets/index-bVBlMYV3.css +1 -0
- package/dist/client/standalone/index.html +2 -2
- package/dist/client/webcomponents.d.ts +1 -1
- package/dist/client/webcomponents.js +95 -40
- package/dist/{docks-B3cDUs1u.js → docks-BuqYBItp.js} +255 -221
- package/dist/{index-C5iw-7QZ.d.ts → index-CWvzFILY.d.ts} +97 -5
- package/dist/index.d.ts +15 -3
- package/dist/index.js +1 -1
- package/dist/plugins-Chcj6ENu.js +2756 -0
- package/package.json +11 -10
- package/dist/client/standalone/assets/index-CsLZ-29s.css +0 -1
- package/dist/plugins-DfJlAQ2j.js +0 -1570
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { RpcDefinitionsToFunctions, RpcFunctionsCollector, RpcFunctionsCollectorBase } from "birpc-x";
|
|
2
1
|
import { Plugin, ResolvedConfig, ViteDevServer } from "vite";
|
|
2
|
+
import { RpcDefinitionsToFunctions, RpcFunctionsCollector, RpcFunctionsCollectorBase } from "birpc-x";
|
|
3
3
|
import { Raw } from "vue";
|
|
4
|
-
import { ChildProcess } from "node:child_process";
|
|
5
4
|
import { BirpcReturn } from "birpc";
|
|
5
|
+
import { WebSocket } from "ws";
|
|
6
|
+
import { ChildProcess } from "node:child_process";
|
|
6
7
|
|
|
7
8
|
//#region ../kit/src/types/events.d.ts
|
|
8
9
|
interface EventsMap {
|
|
@@ -162,7 +163,7 @@ interface DevToolsViewCustomRender extends DevToolsDockEntryBase {
|
|
|
162
163
|
}
|
|
163
164
|
interface DevToolsViewBuiltin extends DevToolsDockEntryBase {
|
|
164
165
|
type: '~builtin';
|
|
165
|
-
id: '~terminals' | '~logs';
|
|
166
|
+
id: '~terminals' | '~logs' | '~client-auth-notice';
|
|
166
167
|
}
|
|
167
168
|
type DevToolsDockUserEntry = DevToolsViewIframe | DevToolsViewAction | DevToolsViewCustomRender | DevToolsViewLauncher;
|
|
168
169
|
type DevToolsDockEntry = DevToolsDockUserEntry | DevToolsViewBuiltin;
|
|
@@ -249,14 +250,47 @@ interface DevToolsPluginOptions {
|
|
|
249
250
|
setup: (context: DevToolsNodeContext) => void | Promise<void>;
|
|
250
251
|
}
|
|
251
252
|
interface DevToolsNodeContext {
|
|
253
|
+
/**
|
|
254
|
+
* Workspace root directory of Vite DevTools
|
|
255
|
+
*/
|
|
256
|
+
readonly workspaceRoot: string;
|
|
257
|
+
/**
|
|
258
|
+
* Current working directory of Vite DevTools
|
|
259
|
+
*/
|
|
252
260
|
readonly cwd: string;
|
|
261
|
+
/**
|
|
262
|
+
* Current mode of Vite DevTools
|
|
263
|
+
* - 'dev' - when Vite DevTools is running in dev mode
|
|
264
|
+
* - 'build' - when Vite DevTools is running in build mode (no server)
|
|
265
|
+
*/
|
|
253
266
|
readonly mode: 'dev' | 'build';
|
|
267
|
+
/**
|
|
268
|
+
* Resolved Vite configuration
|
|
269
|
+
*/
|
|
254
270
|
readonly viteConfig: ResolvedConfig;
|
|
271
|
+
/**
|
|
272
|
+
* Vite dev server instance (only available in dev mode)
|
|
273
|
+
*/
|
|
255
274
|
readonly viteServer?: ViteDevServer;
|
|
275
|
+
/**
|
|
276
|
+
* RPC functions host, for registering server-side RPC functions and calling client-side RPC functions
|
|
277
|
+
*/
|
|
256
278
|
rpc: RpcFunctionsHost;
|
|
279
|
+
/**
|
|
280
|
+
* Docks host, for registering dock entries
|
|
281
|
+
*/
|
|
257
282
|
docks: DevToolsDockHost;
|
|
283
|
+
/**
|
|
284
|
+
* Views host, for registering static views
|
|
285
|
+
*/
|
|
258
286
|
views: DevToolsViewHost;
|
|
287
|
+
/**
|
|
288
|
+
* Utils for the node context
|
|
289
|
+
*/
|
|
259
290
|
utils: DevToolsNodeUtils;
|
|
291
|
+
/**
|
|
292
|
+
* Terminals host, for registering terminal sessions and streaming terminal output
|
|
293
|
+
*/
|
|
260
294
|
terminals: DevToolsTerminalHost;
|
|
261
295
|
}
|
|
262
296
|
interface DevToolsNodeUtils {
|
|
@@ -274,8 +308,27 @@ interface ConnectionMeta {
|
|
|
274
308
|
}
|
|
275
309
|
//#endregion
|
|
276
310
|
//#region ../kit/src/types/rpc.d.ts
|
|
311
|
+
interface DevToolsNodeRpcSessionMeta {
|
|
312
|
+
id: number;
|
|
313
|
+
ws?: WebSocket;
|
|
314
|
+
clientAuthId?: string;
|
|
315
|
+
isTrusted?: boolean;
|
|
316
|
+
}
|
|
317
|
+
interface DevToolsNodeRpcSession {
|
|
318
|
+
meta: DevToolsNodeRpcSessionMeta;
|
|
319
|
+
rpc: BirpcReturn<DevToolsRpcClientFunctions, DevToolsRpcServerFunctions, false>;
|
|
320
|
+
}
|
|
277
321
|
type RpcFunctionsHost = RpcFunctionsCollectorBase<DevToolsRpcServerFunctions, DevToolsNodeContext> & {
|
|
278
|
-
|
|
322
|
+
/**
|
|
323
|
+
* Broadcast a message to all connected clients
|
|
324
|
+
*/
|
|
325
|
+
broadcast: <T extends keyof DevToolsRpcClientFunctions, Args extends Parameters<DevToolsRpcClientFunctions[T]>>(name: T, ...args: Args) => Promise<(Awaited<ReturnType<DevToolsRpcClientFunctions[T]>> | undefined)[]>;
|
|
326
|
+
/**
|
|
327
|
+
* Get the current RPC client
|
|
328
|
+
*
|
|
329
|
+
* Available in RPC functions to get the current RPC client
|
|
330
|
+
*/
|
|
331
|
+
getCurrentRpcSession: () => DevToolsNodeRpcSession | undefined;
|
|
279
332
|
};
|
|
280
333
|
//#endregion
|
|
281
334
|
//#region ../kit/src/types/vite-augment.d.ts
|
|
@@ -283,6 +336,21 @@ declare module 'vite' {
|
|
|
283
336
|
interface Plugin {
|
|
284
337
|
devtools?: DevToolsPluginOptions;
|
|
285
338
|
}
|
|
339
|
+
interface UserConfig {
|
|
340
|
+
devtools?: ViteConfigDevtoolsOptions;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
interface ViteConfigDevtoolsOptions {
|
|
344
|
+
/**
|
|
345
|
+
* Disable client authentication.
|
|
346
|
+
*
|
|
347
|
+
* Beware that if you disable client authentication,
|
|
348
|
+
* any browsers can connect to the devtools and access to your server and filesystem.
|
|
349
|
+
* (including other devices, if you open server `host` option to LAN or WAN)
|
|
350
|
+
*
|
|
351
|
+
* @default true
|
|
352
|
+
*/
|
|
353
|
+
clientAuth?: boolean;
|
|
286
354
|
}
|
|
287
355
|
//#endregion
|
|
288
356
|
//#region ../kit/src/client/rpc.d.ts
|
|
@@ -291,10 +359,26 @@ interface DevToolsRpcClient {
|
|
|
291
359
|
* The events of the client
|
|
292
360
|
*/
|
|
293
361
|
events: EventEmitter<RpcClientEvents>;
|
|
362
|
+
/**
|
|
363
|
+
* Whether the client is trusted
|
|
364
|
+
*/
|
|
365
|
+
readonly isTrusted: boolean | null;
|
|
294
366
|
/**
|
|
295
367
|
* The connection meta
|
|
296
368
|
*/
|
|
297
369
|
readonly connectionMeta: ConnectionMeta;
|
|
370
|
+
/**
|
|
371
|
+
* Return a promise that resolves when the client is trusted
|
|
372
|
+
*
|
|
373
|
+
* Rejects with an error if the timeout is reached
|
|
374
|
+
*
|
|
375
|
+
* @param timeout - The timeout in milliseconds, default to 60 seconds
|
|
376
|
+
*/
|
|
377
|
+
ensureTrusted: (timeout?: number) => Promise<boolean>;
|
|
378
|
+
/**
|
|
379
|
+
* Request trust from the server
|
|
380
|
+
*/
|
|
381
|
+
requestTrust: () => Promise<boolean>;
|
|
298
382
|
/**
|
|
299
383
|
* Call a RPC function on the server
|
|
300
384
|
*/
|
|
@@ -368,6 +452,12 @@ interface DocksEntriesContext {
|
|
|
368
452
|
* @returns Whether the selection was changed successfully
|
|
369
453
|
*/
|
|
370
454
|
switchEntry: (id?: string | null) => Promise<boolean>;
|
|
455
|
+
/**
|
|
456
|
+
* Toggle the selected dock entry
|
|
457
|
+
*
|
|
458
|
+
* @returns Whether the selection was changed successfully
|
|
459
|
+
*/
|
|
460
|
+
toggleEntry: (id: string) => Promise<boolean>;
|
|
371
461
|
}
|
|
372
462
|
interface DockEntryState {
|
|
373
463
|
entryMeta: DevToolsDockEntry;
|
|
@@ -385,7 +475,9 @@ interface DockEntryStateEvents {
|
|
|
385
475
|
'dom:panel:mounted': (panel: HTMLDivElement) => void;
|
|
386
476
|
'dom:iframe:mounted': (iframe: HTMLIFrameElement) => void;
|
|
387
477
|
}
|
|
388
|
-
interface RpcClientEvents {
|
|
478
|
+
interface RpcClientEvents {
|
|
479
|
+
'rpc:is-trusted:updated': (isTrusted: boolean) => void;
|
|
480
|
+
}
|
|
389
481
|
//#endregion
|
|
390
482
|
//#region ../kit/src/client/client-script.d.ts
|
|
391
483
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,26 @@
|
|
|
1
|
-
import { a as RpcDefinitionsToFunctions, c as DevToolsTerminalSessionBase, d as DevToolsRpcServerFunctions, f as DevToolsDockEntry, l as DevToolsTerminalSessionStreamChunkEvent, o as ConnectionMeta, s as DevToolsNodeContext, u as DevToolsRpcClientFunctions } from "./index-
|
|
1
|
+
import { a as RpcDefinitionsToFunctions, c as DevToolsTerminalSessionBase, d as DevToolsRpcServerFunctions, f as DevToolsDockEntry, l as DevToolsTerminalSessionStreamChunkEvent, o as ConnectionMeta, s as DevToolsNodeContext, u as DevToolsRpcClientFunctions } from "./index-CWvzFILY.js";
|
|
2
|
+
import { Plugin, ResolvedConfig, ViteDevServer } from "vite";
|
|
2
3
|
import * as birpc_x0 from "birpc-x";
|
|
3
4
|
import { RpcFunctionsCollectorBase } from "birpc-x";
|
|
4
|
-
import {
|
|
5
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
5
6
|
import * as birpc0 from "birpc";
|
|
6
7
|
import * as h30 from "h3";
|
|
7
8
|
|
|
8
9
|
//#region src/node/context.d.ts
|
|
9
10
|
declare function createDevToolsContext(viteConfig: ResolvedConfig, viteServer?: ViteDevServer): Promise<DevToolsNodeContext>;
|
|
10
11
|
//#endregion
|
|
12
|
+
//#region src/node/rpc/anonymous/auth.d.ts
|
|
13
|
+
interface DevToolsAuthInput {
|
|
14
|
+
authId: string;
|
|
15
|
+
ua: string;
|
|
16
|
+
origin: string;
|
|
17
|
+
}
|
|
18
|
+
interface DevToolsAuthReturn {
|
|
19
|
+
isTrusted: boolean;
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
11
22
|
//#region src/node/rpc/index.d.ts
|
|
12
|
-
declare const builtinRpcDecalrations: readonly [birpc_x0.RpcFunctionDefinition<"vite:core:open-in-editor", "action", [path: string], Promise<void>, DevToolsNodeContext>, birpc_x0.RpcFunctionDefinition<"vite:core:open-in-finder", "action", [path: string], Promise<void>, DevToolsNodeContext>, birpc_x0.RpcFunctionDefinition<"vite:internal:docks:list", "static", [], DevToolsDockEntry[], DevToolsNodeContext>, birpc_x0.RpcFunctionDefinition<"vite:internal:docks:on-launch", "action", [entryId: string], Promise<void>, DevToolsNodeContext>, birpc_x0.RpcFunctionDefinition<"vite:internal:rpc:server:list", "static", [], Promise<{
|
|
23
|
+
declare const builtinRpcDecalrations: readonly [birpc_x0.RpcFunctionDefinition<"vite:core:open-in-editor", "action", [path: string], Promise<void>, DevToolsNodeContext>, birpc_x0.RpcFunctionDefinition<"vite:core:open-in-finder", "action", [path: string], Promise<void>, DevToolsNodeContext>, birpc_x0.RpcFunctionDefinition<"vite:anonymous:auth", "action", [query: DevToolsAuthInput], Promise<DevToolsAuthReturn>, DevToolsNodeContext>, birpc_x0.RpcFunctionDefinition<"vite:internal:docks:list", "static", [], DevToolsDockEntry[], DevToolsNodeContext>, birpc_x0.RpcFunctionDefinition<"vite:internal:docks:on-launch", "action", [entryId: string], Promise<void>, DevToolsNodeContext>, birpc_x0.RpcFunctionDefinition<"vite:internal:rpc:server:list", "static", [], Promise<{
|
|
13
24
|
[k: string]: {
|
|
14
25
|
type: any;
|
|
15
26
|
};
|
|
@@ -42,6 +53,7 @@ declare function DevTools(options?: DevToolsOptions): Promise<Plugin[]>;
|
|
|
42
53
|
interface CreateWsServerOptions {
|
|
43
54
|
cwd: string;
|
|
44
55
|
portWebSocket?: number;
|
|
56
|
+
hostWebSocket: string;
|
|
45
57
|
base?: string;
|
|
46
58
|
context: DevToolsNodeContext;
|
|
47
59
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as createDevToolsMiddleware, t as DevTools, u as createDevToolsContext } from "./plugins-Chcj6ENu.js";
|
|
2
2
|
|
|
3
3
|
export { DevTools, createDevToolsContext, createDevToolsMiddleware };
|