@vitejs/devtools-vite 0.0.0-alpha.17 → 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 (57) hide show
  1. package/dist/index.d.mts +188 -67
  2. package/dist/index.mjs +10728 -156
  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/{BBFR_Uo5.js → 07wnyZKd.js} +1 -1
  7. package/dist/public/_nuxt/{BVY1sWiJ.js → B60rA_aW.js} +1 -1
  8. package/dist/public/_nuxt/{CI-Sc-2P.js → B67x4GCP.js} +1 -1
  9. package/dist/public/_nuxt/{BO4TB9gH.js → B8MMDSYB.js} +1 -1
  10. package/dist/public/_nuxt/{Bl_zhAit.js → BLS3T3KA.js} +1 -1
  11. package/dist/public/_nuxt/{BdsP-Cx2.js → BMsX1CNy.js} +1 -1
  12. package/dist/public/_nuxt/{D-NARtgK.js → BOkXdHom.js} +1 -1
  13. package/dist/public/_nuxt/{sTN5Ot43.js → BOwnK8_Y.js} +1 -1
  14. package/dist/public/_nuxt/{DdkDM4fj.js → BYgsyBgs.js} +1 -1
  15. package/dist/public/_nuxt/{mbqImpEE.js → BZp_Rqiq.js} +1 -1
  16. package/dist/public/_nuxt/{Cv1sf0OD.js → Bax2Xuss.js} +1 -1
  17. package/dist/public/_nuxt/{CoLW5wV8.js → BfzWwsgH.js} +1 -1
  18. package/dist/public/_nuxt/Bgr0OgUi.js +1 -0
  19. package/dist/public/_nuxt/{BiQ0ZhR_.js → BrGG6h5U.js} +1 -1
  20. package/dist/public/_nuxt/{Ivdx0lA9.js → Bt0_xjwR.js} +1 -1
  21. package/dist/public/_nuxt/{Dd9_UU0g.js → C-y-Odbu.js} +1 -1
  22. package/dist/public/_nuxt/{C_cs-58z.js → C3ZA0X0n.js} +1 -1
  23. package/dist/public/_nuxt/{DQDcWwzr.js → C9D_b0Ie.js} +1 -1
  24. package/dist/public/_nuxt/CbraBRjp.js +33 -0
  25. package/dist/public/_nuxt/CquGjqBi.js +1 -0
  26. package/dist/public/_nuxt/{BYCB-Hif.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/DFnm02Ud.js +1 -0
  30. package/dist/public/_nuxt/{VMul6hew.js → DGvZD3jQ.js} +1 -1
  31. package/dist/public/_nuxt/{BwrSljRH.js → DQp_1U8q.js} +1 -1
  32. package/dist/public/_nuxt/{D7fGBzoc.js → DabxYzqu.js} +1 -1
  33. package/dist/public/_nuxt/DilC1n1-.js +6 -0
  34. package/dist/public/_nuxt/{vlGwL1DD.js → DtmncGDc.js} +1 -1
  35. package/dist/public/_nuxt/{CrP3spb8.js → DyBWaXpL.js} +1 -1
  36. package/dist/public/_nuxt/{DHD8rbcK.js → PBmE2B7U.js} +1 -1
  37. package/dist/public/_nuxt/{RlFrOrwQ.js → Q3kWpZ_f.js} +1 -1
  38. package/dist/public/_nuxt/{7pdU4mzw.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.C1YP59mZ.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/{f1KvgLIQ.js → jTMXHbZw.js} +1 -1
  45. package/dist/public/_nuxt/{CHrIIE6Z.js → p1Do6sW6.js} +1 -1
  46. package/dist/public/index.html +1 -1
  47. package/package.json +9 -8
  48. package/dist/public/_nuxt/B661rCRY.js +0 -6
  49. package/dist/public/_nuxt/BB7zYkKg.js +0 -1
  50. package/dist/public/_nuxt/BsfPzBLD.js +0 -33
  51. package/dist/public/_nuxt/CHXCO5ia.js +0 -1
  52. package/dist/public/_nuxt/DAv0Rzal.js +0 -1
  53. package/dist/public/_nuxt/builds/meta/f71a649b-f47c-44eb-9005-86c44268b9bf.json +0 -1
  54. package/dist/public/_nuxt/error-404.Brb8RtBp.css +0 -1
  55. package/dist/public/_nuxt/error-500.BscIrM8z.css +0 -1
  56. package/dist/public/_nuxt/falkWS6X.js +0 -1
  57. package/dist/public/_nuxt/zcv9DqOS.js +0 -1
package/dist/index.d.mts CHANGED
@@ -1,10 +1,148 @@
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
53
+ //#region ../kit/src/types/docks.d.ts
54
+ interface DevToolsDockHost {
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[];
64
+ }
65
+ type DevToolsDockEntryCategory = 'app' | 'framework' | 'web' | 'advanced' | 'default';
66
+ type DevToolsDockEntryIcon = string | {
67
+ light: string;
68
+ dark: string;
69
+ };
70
+ interface DevToolsDockEntryBase {
71
+ id: string;
72
+ title: string;
73
+ icon: DevToolsDockEntryIcon;
74
+ /**
75
+ * The default order of the entry in the dock.
76
+ * The higher the number the earlier it appears.
77
+ * @default 0
78
+ */
79
+ defaultOrder?: number;
80
+ /**
81
+ * The category of the entry
82
+ * @default 'default'
83
+ */
84
+ category?: DevToolsDockEntryCategory;
85
+ /**
86
+ * Whether the entry should be hidden from the user.
87
+ * @default false
88
+ */
89
+ isHidden?: boolean;
90
+ }
91
+ interface ClientScriptEntry {
92
+ /**
93
+ * The filepath or module name to import from
94
+ */
95
+ importFrom: string;
96
+ /**
97
+ * The name to import the module as
98
+ *
99
+ * @default 'default'
100
+ */
101
+ importName?: string;
102
+ }
103
+ interface DevToolsViewIframe extends DevToolsDockEntryBase {
104
+ type: 'iframe';
105
+ url: string;
106
+ /**
107
+ * The id of the iframe, if multiple tabs is assigned with the same id, the iframe will be shared.
108
+ *
109
+ * When not provided, it would be treated as a unique frame.
110
+ */
111
+ frameId?: string;
112
+ /**
113
+ * Optional client script to import into the iframe
114
+ */
115
+ clientScript?: ClientScriptEntry;
116
+ }
117
+ type DevToolsViewLauncherStatus = 'idle' | 'loading' | 'success' | 'error';
118
+ interface DevToolsViewLauncher extends DevToolsDockEntryBase {
119
+ type: 'launcher';
120
+ launcher: {
121
+ icon?: DevToolsDockEntryIcon;
122
+ title: string;
123
+ status?: DevToolsViewLauncherStatus;
124
+ error?: string;
125
+ description?: string;
126
+ buttonStart?: string;
127
+ buttonLoading?: string;
128
+ onLaunch: () => Promise<void>;
129
+ };
130
+ }
131
+ interface DevToolsViewAction extends DevToolsDockEntryBase {
132
+ type: 'action';
133
+ action: ClientScriptEntry;
134
+ }
135
+ interface DevToolsViewCustomRender extends DevToolsDockEntryBase {
136
+ type: 'custom-render';
137
+ renderer: ClientScriptEntry;
138
+ }
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;
145
+ //#endregion
8
146
  //#region ../kit/src/types/rpc-augments.d.ts
9
147
  /**
10
148
  * To be extended
@@ -39,7 +177,7 @@ interface DocksContext extends DevToolsClientContext {
39
177
  * Type of the client environment
40
178
  *
41
179
  * 'embedded' - running inside an embedded floating panel
42
- * 'standalone' - running inside a standlone window (no user app)
180
+ * 'standalone' - running inside a standalone window (no user app)
43
181
  */
44
182
  readonly clientType: 'embedded' | 'standalone';
45
183
  /**
@@ -63,7 +201,8 @@ interface DocksPanelContext {
63
201
  readonly isVertical: boolean;
64
202
  }
65
203
  interface DocksEntriesContext {
66
- selected: DevToolsDockEntry | null;
204
+ selectedId: string | null;
205
+ readonly selected: DevToolsDockEntry | null;
67
206
  entries: DevToolsDockEntry[];
68
207
  entryToStateMap: Map<string, DockEntryState>;
69
208
  /**
@@ -75,7 +214,7 @@ interface DocksEntriesContext {
75
214
  *
76
215
  * @returns Whether the selection was changed successfully
77
216
  */
78
- switchEntry: (id: string | null) => Promise<boolean>;
217
+ switchEntry: (id?: string | null) => Promise<boolean>;
79
218
  }
80
219
  interface DockEntryState {
81
220
  entryMeta: DevToolsDockEntry;
@@ -84,12 +223,12 @@ interface DockEntryState {
84
223
  iframe?: HTMLIFrameElement | null;
85
224
  panel?: HTMLDivElement | null;
86
225
  };
87
- events: Raw<Emitter<DockEntryStateEvents>>;
226
+ events: Raw<EventEmitter<DockEntryStateEvents>>;
88
227
  }
89
228
  interface DockEntryStateEvents {
90
229
  'entry:activated': () => void;
91
230
  'entry:deactivated': () => void;
92
- 'entry:updated': (newMeta: DevToolsDockEntry) => void;
231
+ 'entry:updated': (newMeta: DevToolsDockUserEntry) => void;
93
232
  'dom:panel:mounted': (panel: HTMLDivElement) => void;
94
233
  'dom:iframe:mounted': (iframe: HTMLIFrameElement) => void;
95
234
  }
@@ -105,13 +244,49 @@ interface DockClientScriptContext extends DocksContext {
105
244
  current: DockEntryState;
106
245
  }
107
246
  //#endregion
108
- //#region ../kit/src/types/views.d.ts
109
- interface DevToolsDockHost {
110
- views: Map<string, DevToolsDockEntry>;
111
- register: (entry: DevToolsDockEntry) => void;
112
- update: (entry: DevToolsDockEntry) => void;
113
- values: () => DevToolsDockEntry[];
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;
114
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
289
+ //#region ../kit/src/types/views.d.ts
115
290
  interface DevToolsViewHost {
116
291
  /**
117
292
  * @internal
@@ -127,61 +302,6 @@ interface DevToolsViewHost {
127
302
  */
128
303
  hostStatic: (baseUrl: string, distDir: string) => void;
129
304
  }
130
- type DevToolsDockEntryCategory = 'app' | 'framework' | 'web' | 'advanced' | 'default';
131
- interface DevToolsDockEntryBase {
132
- id: string;
133
- title: string;
134
- icon: string | {
135
- light: string;
136
- dark: string;
137
- };
138
- /**
139
- * The default order of the entry in the dock.
140
- * The higher the number the earlier it appears.
141
- * @default 0
142
- */
143
- defaultOrder?: number;
144
- /**
145
- * The category of the entry
146
- * @default 'default'
147
- */
148
- category?: DevToolsDockEntryCategory;
149
- }
150
- interface ClientScriptEntry {
151
- /**
152
- * The filepath or module name to import from
153
- */
154
- importFrom: string;
155
- /**
156
- * The name to import the module as
157
- *
158
- * @default 'default'
159
- */
160
- importName?: string;
161
- }
162
- interface DevToolsViewIframe extends DevToolsDockEntryBase {
163
- type: 'iframe';
164
- url: string;
165
- /**
166
- * The id of the iframe, if multiple tabs is assigned with the same id, the iframe will be shared.
167
- *
168
- * When not provided, it would be treated as a unique frame.
169
- */
170
- frameId?: string;
171
- /**
172
- * Optional client script to import into the iframe
173
- */
174
- clientScript?: ClientScriptEntry;
175
- }
176
- interface DevToolsViewAction extends DevToolsDockEntryBase {
177
- type: 'action';
178
- action: ClientScriptEntry;
179
- }
180
- interface DevToolsViewCustomRender extends DevToolsDockEntryBase {
181
- type: 'custom-render';
182
- renderer: ClientScriptEntry;
183
- }
184
- type DevToolsDockEntry = DevToolsViewIframe | DevToolsViewAction | DevToolsViewCustomRender;
185
305
  //#endregion
186
306
  //#region ../kit/src/types/vite-plugin.d.ts
187
307
  interface DevToolsCapabilities {
@@ -204,6 +324,7 @@ interface DevToolsNodeContext {
204
324
  docks: DevToolsDockHost;
205
325
  views: DevToolsViewHost;
206
326
  utils: DevToolsNodeUtils;
327
+ terminals: DevToolsTerminalHost;
207
328
  }
208
329
  interface DevToolsNodeUtils {
209
330
  /**