@vitejs/devtools-vite 0.0.0-alpha.18 → 0.0.0-alpha.19

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 (54) hide show
  1. package/dist/index.d.mts +112 -9
  2. package/dist/index.mjs +107 -102
  3. package/dist/nitro.json +1 -1
  4. package/dist/public/200.html +1 -1
  5. package/dist/public/404.html +1 -1
  6. package/dist/public/_nuxt/{7Xmy2J8w.js → 07wnyZKd.js} +1 -1
  7. package/dist/public/_nuxt/{BKyQoL6o.js → B60rA_aW.js} +1 -1
  8. package/dist/public/_nuxt/{BMA1s1VI.js → B67x4GCP.js} +1 -1
  9. package/dist/public/_nuxt/{qjx43ao6.js → B8MMDSYB.js} +1 -1
  10. package/dist/public/_nuxt/{C3jmS5U3.js → BLS3T3KA.js} +1 -1
  11. package/dist/public/_nuxt/{DMWw7fde.js → BMsX1CNy.js} +1 -1
  12. package/dist/public/_nuxt/{Bexkoyc0.js → BOkXdHom.js} +1 -1
  13. package/dist/public/_nuxt/{BC_PfwI9.js → BOwnK8_Y.js} +1 -1
  14. package/dist/public/_nuxt/{Brb1aI-2.js → BYgsyBgs.js} +1 -1
  15. package/dist/public/_nuxt/{CuCopH82.js → BZp_Rqiq.js} +1 -1
  16. package/dist/public/_nuxt/{CiEs9bP4.js → Bax2Xuss.js} +1 -1
  17. package/dist/public/_nuxt/{C6Dt55Q_.js → BfzWwsgH.js} +1 -1
  18. package/dist/public/_nuxt/{DC_Jmw0F.js → Bgr0OgUi.js} +1 -1
  19. package/dist/public/_nuxt/{C2OwekHB.js → BrGG6h5U.js} +1 -1
  20. package/dist/public/_nuxt/{B3PvEETZ.js → Bt0_xjwR.js} +1 -1
  21. package/dist/public/_nuxt/{w-XmH5Bg.js → C-y-Odbu.js} +1 -1
  22. package/dist/public/_nuxt/{CEjOBQvu.js → C3ZA0X0n.js} +1 -1
  23. package/dist/public/_nuxt/{Cuw21ZGH.js → C9D_b0Ie.js} +1 -1
  24. package/dist/public/_nuxt/CbraBRjp.js +33 -0
  25. package/dist/public/_nuxt/{DPbvd5Yn.js → CquGjqBi.js} +1 -1
  26. package/dist/public/_nuxt/{CbwMXojR.js → CvbH1QZS.js} +1 -1
  27. package/dist/public/_nuxt/CwJmFVn8.js +1 -0
  28. package/dist/public/_nuxt/CyjCHwlN.js +1 -0
  29. package/dist/public/_nuxt/{D4hayKlJ.js → DFnm02Ud.js} +1 -1
  30. package/dist/public/_nuxt/{D4jWsLoz.js → DGvZD3jQ.js} +1 -1
  31. package/dist/public/_nuxt/{HdutzUjM.js → DQp_1U8q.js} +1 -1
  32. package/dist/public/_nuxt/{BZWmKTD9.js → DabxYzqu.js} +1 -1
  33. package/dist/public/_nuxt/DilC1n1-.js +6 -0
  34. package/dist/public/_nuxt/{IRC0Jirb.js → DtmncGDc.js} +1 -1
  35. package/dist/public/_nuxt/{BZtNaBML.js → DyBWaXpL.js} +1 -1
  36. package/dist/public/_nuxt/{CPoVdMeM.js → PBmE2B7U.js} +1 -1
  37. package/dist/public/_nuxt/{B9OSaO_y.js → Q3kWpZ_f.js} +1 -1
  38. package/dist/public/_nuxt/{Cs8a9RWb.js → SUptJs8y.js} +1 -1
  39. package/dist/public/_nuxt/builds/latest.json +1 -1
  40. package/dist/public/_nuxt/builds/meta/9de1cd1a-93a8-4fbf-8efa-effa9e85ee82.json +1 -0
  41. package/dist/public/_nuxt/{entry.CsYdxLia.css → entry.Dp3ya9sb.css} +1 -1
  42. package/dist/public/_nuxt/error-404.CrzVG6qf.css +1 -0
  43. package/dist/public/_nuxt/error-500.UTTFHdkP.css +1 -0
  44. package/dist/public/_nuxt/{BmVkH5Zk.js → jTMXHbZw.js} +1 -1
  45. package/dist/public/_nuxt/{DIDN4Ni9.js → p1Do6sW6.js} +1 -1
  46. package/dist/public/index.html +1 -1
  47. package/package.json +8 -7
  48. package/dist/public/_nuxt/BUo-D9gX.js +0 -6
  49. package/dist/public/_nuxt/DYWgomYl.js +0 -1
  50. package/dist/public/_nuxt/builds/meta/2a08e48f-ceea-4c2d-9171-63b36d85d409.json +0 -1
  51. package/dist/public/_nuxt/ebWyu6T_.js +0 -33
  52. package/dist/public/_nuxt/error-404.l69urhXw.css +0 -1
  53. package/dist/public/_nuxt/error-500.C1nOm2YL.css +0 -1
  54. package/dist/public/_nuxt/xNC6DpAO.js +0 -1
package/dist/index.d.mts CHANGED
@@ -1,16 +1,66 @@
1
1
  import { BirpcGroup, BirpcReturn } from "birpc";
2
2
  import { RpcFunctionsCollector, RpcFunctionsCollectorBase } from "birpc-x";
3
3
  import { Plugin, ResolvedConfig, ViteDevServer } from "vite";
4
- import { Emitter } from "nanoevents";
5
4
  import { Raw } from "vue";
6
5
  import "@vitejs/devtools-rpc/presets/ws/client";
6
+ import { ChildProcess } from "node:child_process";
7
7
 
8
+ //#region ../kit/src/types/events.d.ts
9
+ interface EventsMap {
10
+ [event: string]: any;
11
+ }
12
+ interface EventUnsubscribe {
13
+ (): void;
14
+ }
15
+ interface EventEmitter<Events extends EventsMap> {
16
+ /**
17
+ * Calls each of the listeners registered for a given event.
18
+ *
19
+ * ```js
20
+ * ee.emit('tick', tickType, tickDuration)
21
+ * ```
22
+ *
23
+ * @param event The event name.
24
+ * @param args The arguments for listeners.
25
+ */
26
+ emit: <K extends keyof Events>(this: this, event: K, ...args: Parameters<Events[K]>) => void;
27
+ /**
28
+ * Event names in keys and arrays with listeners in values.
29
+ *
30
+ * @internal
31
+ */
32
+ _listeners: Partial<{ [E in keyof Events]: Events[E][] }>;
33
+ /**
34
+ * Add a listener for a given event.
35
+ *
36
+ * ```js
37
+ * const unbind = ee.on('tick', (tickType, tickDuration) => {
38
+ * count += 1
39
+ * })
40
+ *
41
+ * disable () {
42
+ * unbind()
43
+ * }
44
+ * ```
45
+ *
46
+ * @param event The event name.
47
+ * @param cb The listener function.
48
+ * @returns Unbind listener from event.
49
+ */
50
+ on: <K extends keyof Events>(this: this, event: K, cb: Events[K]) => EventUnsubscribe;
51
+ }
52
+ //#endregion
8
53
  //#region ../kit/src/types/docks.d.ts
9
54
  interface DevToolsDockHost {
10
- views: Map<string, DevToolsDockEntry>;
11
- register: (entry: DevToolsDockEntry) => void;
12
- update: (entry: DevToolsDockEntry) => void;
13
- values: () => DevToolsDockEntry[];
55
+ readonly views: Map<string, DevToolsDockUserEntry>;
56
+ readonly events: EventEmitter<{
57
+ 'dock:entry:updated': (entry: DevToolsDockUserEntry) => void;
58
+ }>;
59
+ register: <T extends DevToolsDockUserEntry>(entry: T, force?: boolean) => {
60
+ update: (patch: Partial<T>) => void;
61
+ };
62
+ update: (entry: DevToolsDockUserEntry) => void;
63
+ values: () => DevToolsDockUserEntry[];
14
64
  }
15
65
  type DevToolsDockEntryCategory = 'app' | 'framework' | 'web' | 'advanced' | 'default';
16
66
  type DevToolsDockEntryIcon = string | {
@@ -32,6 +82,11 @@ interface DevToolsDockEntryBase {
32
82
  * @default 'default'
33
83
  */
34
84
  category?: DevToolsDockEntryCategory;
85
+ /**
86
+ * Whether the entry should be hidden from the user.
87
+ * @default false
88
+ */
89
+ isHidden?: boolean;
35
90
  }
36
91
  interface ClientScriptEntry {
37
92
  /**
@@ -81,7 +136,12 @@ interface DevToolsViewCustomRender extends DevToolsDockEntryBase {
81
136
  type: 'custom-render';
82
137
  renderer: ClientScriptEntry;
83
138
  }
84
- type DevToolsDockEntry = DevToolsViewIframe | DevToolsViewAction | DevToolsViewCustomRender | DevToolsViewLauncher;
139
+ interface DevToolsViewBuiltin extends DevToolsDockEntryBase {
140
+ type: '~builtin';
141
+ id: '~terminals' | '~logs';
142
+ }
143
+ type DevToolsDockUserEntry = DevToolsViewIframe | DevToolsViewAction | DevToolsViewCustomRender | DevToolsViewLauncher;
144
+ type DevToolsDockEntry = DevToolsDockUserEntry | DevToolsViewBuiltin;
85
145
  //#endregion
86
146
  //#region ../kit/src/types/rpc-augments.d.ts
87
147
  /**
@@ -154,7 +214,7 @@ interface DocksEntriesContext {
154
214
  *
155
215
  * @returns Whether the selection was changed successfully
156
216
  */
157
- switchEntry: (id: string | null) => Promise<boolean>;
217
+ switchEntry: (id?: string | null) => Promise<boolean>;
158
218
  }
159
219
  interface DockEntryState {
160
220
  entryMeta: DevToolsDockEntry;
@@ -163,12 +223,12 @@ interface DockEntryState {
163
223
  iframe?: HTMLIFrameElement | null;
164
224
  panel?: HTMLDivElement | null;
165
225
  };
166
- events: Raw<Emitter<DockEntryStateEvents>>;
226
+ events: Raw<EventEmitter<DockEntryStateEvents>>;
167
227
  }
168
228
  interface DockEntryStateEvents {
169
229
  'entry:activated': () => void;
170
230
  'entry:deactivated': () => void;
171
- 'entry:updated': (newMeta: DevToolsDockEntry) => void;
231
+ 'entry:updated': (newMeta: DevToolsDockUserEntry) => void;
172
232
  'dom:panel:mounted': (panel: HTMLDivElement) => void;
173
233
  'dom:iframe:mounted': (iframe: HTMLIFrameElement) => void;
174
234
  }
@@ -184,6 +244,48 @@ interface DockClientScriptContext extends DocksContext {
184
244
  current: DockEntryState;
185
245
  }
186
246
  //#endregion
247
+ //#region ../kit/src/types/terminals.d.ts
248
+ interface DevToolsTerminalSessionStreamChunkEvent {
249
+ id: string;
250
+ chunks: string[];
251
+ ts: number;
252
+ }
253
+ interface DevToolsTerminalHost {
254
+ readonly sessions: Map<string, DevToolsTerminalSession>;
255
+ readonly events: EventEmitter<{
256
+ 'terminal:session:updated': (session: DevToolsTerminalSession) => void;
257
+ 'terminal:session:stream-chunk': (data: DevToolsTerminalSessionStreamChunkEvent) => void;
258
+ }>;
259
+ register: (session: DevToolsTerminalSession) => DevToolsTerminalSession;
260
+ update: (session: DevToolsTerminalSession) => void;
261
+ startChildProcess: (executeOptions: DevToolsChildProcessExecuteOptions, terminal: Omit<DevToolsTerminalSessionBase, 'status'>) => Promise<DevToolsChildProcessTerminalSession>;
262
+ }
263
+ type DevToolsTerminalStatus = 'running' | 'stopped' | 'error';
264
+ interface DevToolsTerminalSessionBase {
265
+ id: string;
266
+ title: string;
267
+ description?: string;
268
+ status: DevToolsTerminalStatus;
269
+ icon?: DevToolsDockEntryIcon;
270
+ }
271
+ interface DevToolsTerminalSession extends DevToolsTerminalSessionBase {
272
+ buffer?: string[];
273
+ stream?: ReadableStream<string>;
274
+ }
275
+ interface DevToolsChildProcessExecuteOptions {
276
+ command: string;
277
+ args: string[];
278
+ cwd?: string;
279
+ env?: Record<string, string>;
280
+ }
281
+ interface DevToolsChildProcessTerminalSession extends DevToolsTerminalSession {
282
+ type: 'child-process';
283
+ executeOptions: DevToolsChildProcessExecuteOptions;
284
+ getChildProcess: () => ChildProcess | undefined;
285
+ terminate: () => Promise<void>;
286
+ restart: () => Promise<void>;
287
+ }
288
+ //#endregion
187
289
  //#region ../kit/src/types/views.d.ts
188
290
  interface DevToolsViewHost {
189
291
  /**
@@ -222,6 +324,7 @@ interface DevToolsNodeContext {
222
324
  docks: DevToolsDockHost;
223
325
  views: DevToolsViewHost;
224
326
  utils: DevToolsNodeUtils;
327
+ terminals: DevToolsTerminalHost;
225
328
  }
226
329
  interface DevToolsNodeUtils {
227
330
  /**