@vitejs/devtools 0.0.0-alpha.25 → 0.0.0-alpha.27

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.
Files changed (31) hide show
  1. package/dist/{DockIcon-CG2NSDoX.js → DockIcon-BfVdt_M0.js} +56 -58
  2. package/dist/{ViewBuiltinLogs-CUz-jlMA.js → ViewBuiltinLogs-C8wFxIxg.js} +2 -2
  3. package/dist/{ViewBuiltinTerminals-BKqSU-x4.js → ViewBuiltinTerminals-CrBOq_Ni.js} +657 -661
  4. package/dist/cli-commands.js +65 -2
  5. package/dist/cli.js +2 -2
  6. package/dist/client/inject.js +15 -3
  7. package/dist/client/standalone/assets/ViewBuiltinLogs-CYvdMq-7.js +1 -0
  8. package/dist/client/standalone/assets/{ViewBuiltinTerminals-BAc9-MAy.js → ViewBuiltinTerminals-B9l9XmES.js} +4 -4
  9. package/dist/client/standalone/assets/index-DWC0UjCz.js +2 -0
  10. package/dist/client/standalone/assets/index-DzhHPm4X.css +1 -0
  11. package/dist/client/standalone/index.html +2 -2
  12. package/dist/client/webcomponents.d.ts +1450 -4
  13. package/dist/client/webcomponents.js +441 -171
  14. package/dist/dirs.js +7 -1
  15. package/dist/{dist-B-r4P83Y.js → dist-BpFPAu5f.js} +5 -6
  16. package/dist/docks-CYaKLVhQ.js +131 -0
  17. package/dist/index.d.ts +174 -22
  18. package/dist/index.js +1 -1
  19. package/dist/plugins-BbzqUdpu.js +3038 -0
  20. package/dist/standalone-DVh1a9tu.js +34 -0
  21. package/dist/{vue.runtime.esm-bundler-B7xD_5x9.js → vue.runtime.esm-bundler-DL0i8o0W.js} +248 -220
  22. package/package.json +15 -15
  23. package/dist/cli-commands-DEf9IsfU.js +0 -96
  24. package/dist/client/standalone/assets/ViewBuiltinLogs-DPvwWqqt.js +0 -1
  25. package/dist/client/standalone/assets/index-BgrADCac.css +0 -1
  26. package/dist/client/standalone/assets/index-DXUNB7Hd.js +0 -2
  27. package/dist/dirs-C0s1Ghvy.js +0 -9
  28. package/dist/docks-Dgft7LEp.js +0 -72
  29. package/dist/index-CmOJZ3e5.d.ts +0 -561
  30. package/dist/plugins-CCFu2oMz.js +0 -3031
  31. /package/dist/{export-helper-Dw-qygE5.js → export-helper-DjM8b2QE.js} +0 -0
@@ -1,561 +0,0 @@
1
- import { Plugin, ResolvedConfig, ViteDevServer } from "vite";
2
- import { RpcDefinitionsToFunctions, RpcFunctionsCollector, RpcFunctionsCollectorBase } from "birpc-x";
3
- import "node:http";
4
- import { Raw } from "vue";
5
- import { BirpcReturn } from "birpc";
6
- import { WebSocket } from "ws";
7
- import { Patch, Patch as SharedStatePatch } from "immer";
8
- import { ChildProcess } from "node:child_process";
9
-
10
- //#region ../kit/src/types/events.d.ts
11
- interface EventsMap {
12
- [event: string]: any;
13
- }
14
- interface EventUnsubscribe {
15
- (): void;
16
- }
17
- interface EventEmitter<Events extends EventsMap> {
18
- /**
19
- * Calls each of the listeners registered for a given event.
20
- *
21
- * ```js
22
- * ee.emit('tick', tickType, tickDuration)
23
- * ```
24
- *
25
- * @param event The event name.
26
- * @param args The arguments for listeners.
27
- */
28
- emit: <K$1 extends keyof Events>(event: K$1, ...args: Parameters<Events[K$1]>) => void;
29
- /**
30
- * Calls the listeners for a given event once and then removes the listener.
31
- *
32
- * @param event The event name.
33
- * @param args The arguments for listeners.
34
- */
35
- emitOnce: <K$1 extends keyof Events>(event: K$1, ...args: Parameters<Events[K$1]>) => void;
36
- /**
37
- * Event names in keys and arrays with listeners in values.
38
- *
39
- * @internal
40
- */
41
- _listeners: Partial<{ [E in keyof Events]: Events[E][] }>;
42
- /**
43
- * Add a listener for a given event.
44
- *
45
- * ```js
46
- * const unbind = ee.on('tick', (tickType, tickDuration) => {
47
- * count += 1
48
- * })
49
- *
50
- * disable () {
51
- * unbind()
52
- * }
53
- * ```
54
- *
55
- * @param event The event name.
56
- * @param cb The listener function.
57
- * @returns Unbind listener from event.
58
- */
59
- on: <K$1 extends keyof Events>(event: K$1, cb: Events[K$1]) => EventUnsubscribe;
60
- /**
61
- * Add a listener for a given event once.
62
- *
63
- * ```js
64
- * const unbind = ee.once('tick', (tickType, tickDuration) => {
65
- * count += 1
66
- * })
67
- *
68
- * disable () {
69
- * unbind()
70
- * }
71
- * ```
72
- *
73
- * @param event The event name.
74
- * @param cb The listener function.
75
- * @returns Unbind listener from event.
76
- */
77
- once: <K$1 extends keyof Events>(event: K$1, cb: Events[K$1]) => EventUnsubscribe;
78
- }
79
- //#endregion
80
- //#region ../kit/src/types/docks.d.ts
81
- interface DevToolsDockHost {
82
- readonly views: Map<string, DevToolsDockUserEntry>;
83
- readonly events: EventEmitter<{
84
- 'dock:entry:updated': (entry: DevToolsDockUserEntry) => void;
85
- }>;
86
- register: <T extends DevToolsDockUserEntry>(entry: T, force?: boolean) => {
87
- update: (patch: Partial<T>) => void;
88
- };
89
- update: (entry: DevToolsDockUserEntry) => void;
90
- values: (options?: {
91
- includeBuiltin?: boolean;
92
- }) => DevToolsDockEntry[];
93
- }
94
- type DevToolsDockEntryCategory = 'app' | 'framework' | 'web' | 'advanced' | 'default' | '~viteplus' | '~builtin';
95
- type DevToolsDockEntryIcon = string | {
96
- light: string;
97
- dark: string;
98
- };
99
- interface DevToolsDockEntryBase {
100
- id: string;
101
- title: string;
102
- icon: DevToolsDockEntryIcon;
103
- /**
104
- * The default order of the entry in the dock.
105
- * The higher the number the earlier it appears.
106
- * @default 0
107
- */
108
- defaultOrder?: number;
109
- /**
110
- * The category of the entry
111
- * @default 'default'
112
- */
113
- category?: DevToolsDockEntryCategory;
114
- /**
115
- * Whether the entry should be hidden from the user.
116
- * @default false
117
- */
118
- isHidden?: boolean;
119
- }
120
- interface ClientScriptEntry {
121
- /**
122
- * The filepath or module name to import from
123
- */
124
- importFrom: string;
125
- /**
126
- * The name to import the module as
127
- *
128
- * @default 'default'
129
- */
130
- importName?: string;
131
- }
132
- interface DevToolsViewIframe extends DevToolsDockEntryBase {
133
- type: 'iframe';
134
- url: string;
135
- /**
136
- * The id of the iframe, if multiple tabs is assigned with the same id, the iframe will be shared.
137
- *
138
- * When not provided, it would be treated as a unique frame.
139
- */
140
- frameId?: string;
141
- /**
142
- * Optional client script to import into the iframe
143
- */
144
- clientScript?: ClientScriptEntry;
145
- }
146
- type DevToolsViewLauncherStatus = 'idle' | 'loading' | 'success' | 'error';
147
- interface DevToolsViewLauncher extends DevToolsDockEntryBase {
148
- type: 'launcher';
149
- launcher: {
150
- icon?: DevToolsDockEntryIcon;
151
- title: string;
152
- status?: DevToolsViewLauncherStatus;
153
- error?: string;
154
- description?: string;
155
- buttonStart?: string;
156
- buttonLoading?: string;
157
- onLaunch: () => Promise<void>;
158
- };
159
- }
160
- interface DevToolsViewAction extends DevToolsDockEntryBase {
161
- type: 'action';
162
- action: ClientScriptEntry;
163
- }
164
- interface DevToolsViewCustomRender extends DevToolsDockEntryBase {
165
- type: 'custom-render';
166
- renderer: ClientScriptEntry;
167
- }
168
- interface DevToolsViewBuiltin extends DevToolsDockEntryBase {
169
- type: '~builtin';
170
- id: '~terminals' | '~logs' | '~client-auth-notice' | '~settings';
171
- }
172
- type DevToolsDockUserEntry = DevToolsViewIframe | DevToolsViewAction | DevToolsViewCustomRender | DevToolsViewLauncher;
173
- type DevToolsDockEntry = DevToolsDockUserEntry | DevToolsViewBuiltin;
174
- //#endregion
175
- //#region ../rpc/src/presets/ws/server.d.ts
176
- interface DevToolsNodeRpcSessionMeta {
177
- id: number;
178
- ws?: WebSocket;
179
- clientAuthId?: string;
180
- isTrusted?: boolean;
181
- subscribedStates: Set<string>;
182
- }
183
- //#endregion
184
- //#region ../kit/src/utils/shared-state.d.ts
185
- type ImmutablePrimitive = undefined | null | boolean | string | number | Function;
186
- type Immutable<T> = T extends ImmutablePrimitive ? T : T extends Array<infer U> ? ImmutableArray<U> : T extends Map<infer K, infer V> ? ImmutableMap<K, V> : T extends Set<infer M> ? ImmutableSet<M> : ImmutableObject<T>;
187
- type ImmutableArray<T> = ReadonlyArray<Immutable<T>>;
188
- type ImmutableMap<K$1, V$1> = ReadonlyMap<Immutable<K$1>, Immutable<V$1>>;
189
- type ImmutableSet<T> = ReadonlySet<Immutable<T>>;
190
- type ImmutableObject<T> = { readonly [K in keyof T]: Immutable<T[K]> };
191
- /**
192
- * State host that is immutable by default with explicit mutate.
193
- */
194
- interface SharedState<T> {
195
- /**
196
- * Get the current state. Immutable.
197
- */
198
- value: () => Immutable<T>;
199
- /**
200
- * Subscribe to state changes.
201
- */
202
- on: EventEmitter<SharedStateEvents<T>>['on'];
203
- /**
204
- * Mutate the state.
205
- */
206
- mutate: (fn: (state: T) => void, syncId?: string) => void;
207
- /**
208
- * Apply patches to the state.
209
- */
210
- patch: (patches: Patch[], syncId?: string) => void;
211
- /**
212
- * Sync IDs that have been applied to the state.
213
- */
214
- syncIds: Set<string>;
215
- }
216
- interface SharedStateEvents<T> {
217
- updated: (fullState: T, patches: Patch[] | undefined, syncId: string) => void;
218
- }
219
- //#endregion
220
- //#region ../kit/src/types/rpc-augments.d.ts
221
- /**
222
- * To be extended
223
- */
224
- interface DevToolsRpcClientFunctions {}
225
- /**
226
- * To be extended
227
- */
228
- interface DevToolsRpcServerFunctions {}
229
- /**
230
- * To be extended
231
- */
232
- interface DevToolsRpcSharedStates {}
233
- //#endregion
234
- //#region ../kit/src/types/terminals.d.ts
235
- interface DevToolsTerminalSessionStreamChunkEvent {
236
- id: string;
237
- chunks: string[];
238
- ts: number;
239
- }
240
- interface DevToolsTerminalHost {
241
- readonly sessions: Map<string, DevToolsTerminalSession>;
242
- readonly events: EventEmitter<{
243
- 'terminal:session:updated': (session: DevToolsTerminalSession) => void;
244
- 'terminal:session:stream-chunk': (data: DevToolsTerminalSessionStreamChunkEvent) => void;
245
- }>;
246
- register: (session: DevToolsTerminalSession) => DevToolsTerminalSession;
247
- update: (session: DevToolsTerminalSession) => void;
248
- startChildProcess: (executeOptions: DevToolsChildProcessExecuteOptions, terminal: Omit<DevToolsTerminalSessionBase, 'status'>) => Promise<DevToolsChildProcessTerminalSession>;
249
- }
250
- type DevToolsTerminalStatus = 'running' | 'stopped' | 'error';
251
- interface DevToolsTerminalSessionBase {
252
- id: string;
253
- title: string;
254
- description?: string;
255
- status: DevToolsTerminalStatus;
256
- icon?: DevToolsDockEntryIcon;
257
- }
258
- interface DevToolsTerminalSession extends DevToolsTerminalSessionBase {
259
- buffer?: string[];
260
- stream?: ReadableStream<string>;
261
- }
262
- interface DevToolsChildProcessExecuteOptions {
263
- command: string;
264
- args: string[];
265
- cwd?: string;
266
- env?: Record<string, string>;
267
- }
268
- interface DevToolsChildProcessTerminalSession extends DevToolsTerminalSession {
269
- type: 'child-process';
270
- executeOptions: DevToolsChildProcessExecuteOptions;
271
- getChildProcess: () => ChildProcess | undefined;
272
- terminate: () => Promise<void>;
273
- restart: () => Promise<void>;
274
- }
275
- //#endregion
276
- //#region ../kit/src/types/views.d.ts
277
- interface DevToolsViewHost {
278
- /**
279
- * @internal
280
- */
281
- buildStaticDirs: {
282
- baseUrl: string;
283
- distDir: string;
284
- }[];
285
- /**
286
- * Helper to host static files
287
- * - In `dev` mode, it will register middleware to `viteServer.middlewares` to host the static files
288
- * - In `build` mode, it will copy the static files to the dist directory
289
- */
290
- hostStatic: (baseUrl: string, distDir: string) => void;
291
- }
292
- //#endregion
293
- //#region ../kit/src/types/vite-plugin.d.ts
294
- interface DevToolsCapabilities {
295
- rpc?: boolean;
296
- views?: boolean;
297
- }
298
- interface DevToolsPluginOptions {
299
- capabilities?: {
300
- dev?: DevToolsCapabilities | boolean;
301
- build?: DevToolsCapabilities | boolean;
302
- };
303
- setup: (context: DevToolsNodeContext) => void | Promise<void>;
304
- }
305
- interface DevToolsNodeContext {
306
- /**
307
- * Workspace root directory of Vite DevTools
308
- */
309
- readonly workspaceRoot: string;
310
- /**
311
- * Current working directory of Vite DevTools
312
- */
313
- readonly cwd: string;
314
- /**
315
- * Current mode of Vite DevTools
316
- * - 'dev' - when Vite DevTools is running in dev mode
317
- * - 'build' - when Vite DevTools is running in build mode (no server)
318
- */
319
- readonly mode: 'dev' | 'build';
320
- /**
321
- * Resolved Vite configuration
322
- */
323
- readonly viteConfig: ResolvedConfig;
324
- /**
325
- * Vite dev server instance (only available in dev mode)
326
- */
327
- readonly viteServer?: ViteDevServer;
328
- /**
329
- * RPC functions host, for registering server-side RPC functions and calling client-side RPC functions
330
- */
331
- rpc: RpcFunctionsHost;
332
- /**
333
- * Docks host, for registering dock entries
334
- */
335
- docks: DevToolsDockHost;
336
- /**
337
- * Views host, for registering static views
338
- */
339
- views: DevToolsViewHost;
340
- /**
341
- * Utils for the node context
342
- */
343
- utils: DevToolsNodeUtils;
344
- /**
345
- * Terminals host, for registering terminal sessions and streaming terminal output
346
- */
347
- terminals: DevToolsTerminalHost;
348
- }
349
- interface DevToolsNodeUtils {
350
- /**
351
- * Create a simple client script from a function or stringified code
352
- *
353
- * @deprecated DO NOT USE. This is mostly for testing only. Please use a proper importable module instead.
354
- * @experimental
355
- */
356
- createSimpleClientScript: (fn: string | ((ctx: DockClientScriptContext) => void)) => ClientScriptEntry;
357
- }
358
- interface ConnectionMeta {
359
- backend: 'websocket' | 'static';
360
- websocket?: number | string;
361
- }
362
- //#endregion
363
- //#region ../kit/src/types/rpc.d.ts
364
- interface DevToolsNodeRpcSession {
365
- meta: DevToolsNodeRpcSessionMeta;
366
- rpc: BirpcReturn<DevToolsRpcClientFunctions, DevToolsRpcServerFunctions, false>;
367
- }
368
- interface RpcBroadcastOptions<METHOD, Args extends any[]> {
369
- method: METHOD;
370
- args: Args;
371
- optional?: boolean;
372
- event?: boolean;
373
- filter?: (client: BirpcReturn<DevToolsRpcClientFunctions, DevToolsRpcServerFunctions, false>) => boolean | void;
374
- }
375
- type RpcFunctionsHost = RpcFunctionsCollectorBase<DevToolsRpcServerFunctions, DevToolsNodeContext> & {
376
- /**
377
- * Broadcast a message to all connected clients
378
- */
379
- broadcast: <T extends keyof DevToolsRpcClientFunctions, Args extends Parameters<DevToolsRpcClientFunctions[T]>>(options: RpcBroadcastOptions<T, Args>) => Promise<void>;
380
- /**
381
- * Get the current RPC client
382
- *
383
- * Available in RPC functions to get the current RPC client
384
- */
385
- getCurrentRpcSession: () => DevToolsNodeRpcSession | undefined;
386
- /**
387
- * The shared state host
388
- */
389
- sharedState: RpcSharedStateHost;
390
- };
391
- interface RpcSharedStateGetOptions<T> {
392
- initialValue?: T;
393
- }
394
- interface RpcSharedStateHost {
395
- get: <T extends keyof DevToolsRpcSharedStates>(key: T, options?: RpcSharedStateGetOptions<DevToolsRpcSharedStates[T]>) => Promise<SharedState<DevToolsRpcSharedStates[T]>>;
396
- }
397
- //#endregion
398
- //#region ../kit/src/types/vite-augment.d.ts
399
- declare module 'vite' {
400
- interface Plugin {
401
- devtools?: DevToolsPluginOptions;
402
- }
403
- interface UserConfig {
404
- devtools?: ViteConfigDevtoolsOptions;
405
- }
406
- }
407
- interface ViteConfigDevtoolsOptions {
408
- /**
409
- * Disable client authentication.
410
- *
411
- * Beware that if you disable client authentication,
412
- * any browsers can connect to the devtools and access to your server and filesystem.
413
- * (including other devices, if you open server `host` option to LAN or WAN)
414
- *
415
- * @default true
416
- */
417
- clientAuth?: boolean;
418
- }
419
- //#endregion
420
- //#region ../kit/src/client/rpc.d.ts
421
- interface DevToolsRpcClient {
422
- /**
423
- * The events of the client
424
- */
425
- events: EventEmitter<RpcClientEvents>;
426
- /**
427
- * Whether the client is trusted
428
- */
429
- readonly isTrusted: boolean | null;
430
- /**
431
- * The connection meta
432
- */
433
- readonly connectionMeta: ConnectionMeta;
434
- /**
435
- * Return a promise that resolves when the client is trusted
436
- *
437
- * Rejects with an error if the timeout is reached
438
- *
439
- * @param timeout - The timeout in milliseconds, default to 60 seconds
440
- */
441
- ensureTrusted: (timeout?: number) => Promise<boolean>;
442
- /**
443
- * Request trust from the server
444
- */
445
- requestTrust: () => Promise<boolean>;
446
- /**
447
- * Call a RPC function on the server
448
- */
449
- call: BirpcReturn<DevToolsRpcServerFunctions, DevToolsRpcClientFunctions>['$call'];
450
- /**
451
- * Call a RPC event on the server, and does not expect a response
452
- */
453
- callEvent: BirpcReturn<DevToolsRpcServerFunctions, DevToolsRpcClientFunctions>['$callEvent'];
454
- /**
455
- * Call a RPC optional function on the server
456
- */
457
- callOptional: BirpcReturn<DevToolsRpcServerFunctions, DevToolsRpcClientFunctions>['$callOptional'];
458
- /**
459
- * The client RPC host
460
- */
461
- client: DevToolsClientRpcHost;
462
- /**
463
- * The shared state host
464
- */
465
- sharedState: RpcSharedStateHost;
466
- }
467
- //#endregion
468
- //#region ../kit/src/client/docks.d.ts
469
- interface DockPanelStorage {
470
- width: number;
471
- height: number;
472
- top: number;
473
- left: number;
474
- position: 'left' | 'right' | 'bottom' | 'top';
475
- open: boolean;
476
- inactiveTimeout: number;
477
- }
478
- interface DevToolsClientContext {
479
- /**
480
- * The RPC client to interact with the server
481
- */
482
- readonly rpc: DevToolsRpcClient;
483
- }
484
- interface DocksContext extends DevToolsClientContext {
485
- /**
486
- * Type of the client environment
487
- *
488
- * 'embedded' - running inside an embedded floating panel
489
- * 'standalone' - running inside a standalone window (no user app)
490
- */
491
- readonly clientType: 'embedded' | 'standalone';
492
- /**
493
- * The panel context
494
- */
495
- readonly panel: DocksPanelContext;
496
- /**
497
- * The docks entries context
498
- */
499
- readonly docks: DocksEntriesContext;
500
- }
501
- type DevToolsClientRpcHost = RpcFunctionsCollector<DevToolsRpcClientFunctions, DevToolsClientContext>;
502
- interface DocksPanelContext {
503
- store: DockPanelStorage;
504
- isDragging: boolean;
505
- isResizing: boolean;
506
- readonly isVertical: boolean;
507
- }
508
- interface DocksEntriesContext {
509
- selectedId: string | null;
510
- readonly selected: DevToolsDockEntry | null;
511
- entries: DevToolsDockEntry[];
512
- entryToStateMap: Map<string, DockEntryState>;
513
- /**
514
- * Get the state of a dock entry by its ID
515
- */
516
- getStateById: (id: string) => DockEntryState | undefined;
517
- /**
518
- * Switch to the selected dock entry, pass `null` to clear the selection
519
- *
520
- * @returns Whether the selection was changed successfully
521
- */
522
- switchEntry: (id?: string | null) => Promise<boolean>;
523
- /**
524
- * Toggle the selected dock entry
525
- *
526
- * @returns Whether the selection was changed successfully
527
- */
528
- toggleEntry: (id: string) => Promise<boolean>;
529
- }
530
- interface DockEntryState {
531
- entryMeta: DevToolsDockEntry;
532
- readonly isActive: boolean;
533
- domElements: {
534
- iframe?: HTMLIFrameElement | null;
535
- panel?: HTMLDivElement | null;
536
- };
537
- events: Raw<EventEmitter<DockEntryStateEvents>>;
538
- }
539
- interface DockEntryStateEvents {
540
- 'entry:activated': () => void;
541
- 'entry:deactivated': () => void;
542
- 'entry:updated': (newMeta: DevToolsDockUserEntry) => void;
543
- 'dom:panel:mounted': (panel: HTMLDivElement) => void;
544
- 'dom:iframe:mounted': (iframe: HTMLIFrameElement) => void;
545
- }
546
- interface RpcClientEvents {
547
- 'rpc:is-trusted:updated': (isTrusted: boolean) => void;
548
- }
549
- //#endregion
550
- //#region ../kit/src/client/client-script.d.ts
551
- /**
552
- * Context for client scripts running in dock entries
553
- */
554
- interface DockClientScriptContext extends DocksContext {
555
- /**
556
- * The state of the current dock entry
557
- */
558
- current: DockEntryState;
559
- }
560
- //#endregion
561
- export { RpcDefinitionsToFunctions as a, DevToolsTerminalSessionBase as c, DevToolsRpcServerFunctions as d, SharedStatePatch as f, DevToolsRpcClient as i, DevToolsTerminalSessionStreamChunkEvent as l, DockPanelStorage as n, ConnectionMeta as o, DevToolsDockEntry as p, DocksContext as r, DevToolsNodeContext as s, DockEntryState as t, DevToolsRpcClientFunctions as u };