@vitejs/devtools 0.0.0-alpha.1 → 0.0.0-alpha.11

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 (70) hide show
  1. package/{bin.mjs → bin.js} +1 -1
  2. package/dist/cli-commands-BlB9kpfS.js +97 -0
  3. package/dist/cli-commands.d.ts +18 -0
  4. package/dist/cli-commands.js +5 -0
  5. package/dist/cli.js +17 -0
  6. package/dist/client/inject.d.ts +4 -0
  7. package/dist/client/inject.js +33 -0
  8. package/dist/client/standalone/assets/index-D_dd87ed.js +7 -0
  9. package/dist/client/standalone/assets/index-cEBqyH_x.css +1 -0
  10. package/dist/client/standalone/index.html +14 -0
  11. package/dist/client/webcomponents.d.ts +45 -0
  12. package/dist/client/webcomponents.js +1089 -0
  13. package/dist/dirs-DcSK9l9L.js +9 -0
  14. package/dist/dirs.d.ts +5 -0
  15. package/dist/dirs.js +3 -0
  16. package/dist/dist-B0hQ6r05.js +6779 -0
  17. package/dist/index-DdVYVGyC.d.ts +153 -0
  18. package/dist/index.d.ts +46 -0
  19. package/dist/index.js +4 -0
  20. package/dist/plugins-znai7bMv.js +1371 -0
  21. package/package.json +50 -57
  22. package/dist/cli-B_fm1Ing.mjs +0 -1039
  23. package/dist/cli.d.mts +0 -1
  24. package/dist/cli.mjs +0 -3
  25. package/dist/dirs-6LDFDMFM.mjs +0 -7
  26. package/dist/dirs.d.mts +0 -4
  27. package/dist/dirs.mjs +0 -3
  28. package/dist/functions-BdbZxtmk.mjs +0 -3
  29. package/dist/functions-d6vvbndK.mjs +0 -234
  30. package/dist/index.d.mts +0 -13
  31. package/dist/index.mjs +0 -7
  32. package/dist/nitro.json +0 -15
  33. package/dist/node/cli.d.mts +0 -1
  34. package/dist/node/cli.mjs +0 -3
  35. package/dist/public/200.html +0 -16
  36. package/dist/public/404.html +0 -16
  37. package/dist/public/_nuxt/B4lqwDon.js +0 -1
  38. package/dist/public/_nuxt/BMB3EEfo.js +0 -1
  39. package/dist/public/_nuxt/BYYDnj5Q.js +0 -1
  40. package/dist/public/_nuxt/BeSFnMzD.js +0 -1
  41. package/dist/public/_nuxt/BfzgVO01.js +0 -1
  42. package/dist/public/_nuxt/BpyJ-U40.js +0 -1
  43. package/dist/public/_nuxt/BxkFQq1F.js +0 -1
  44. package/dist/public/_nuxt/C1DPtPHu.js +0 -1
  45. package/dist/public/_nuxt/C8oXVTvZ.js +0 -1
  46. package/dist/public/_nuxt/CWPvh8od.js +0 -1
  47. package/dist/public/_nuxt/CiwsH4Q6.js +0 -33
  48. package/dist/public/_nuxt/CsnZqsGp.js +0 -16
  49. package/dist/public/_nuxt/CzEHI6hC.js +0 -1
  50. package/dist/public/_nuxt/D-iXojuv.js +0 -1
  51. package/dist/public/_nuxt/DHpfOFMA.js +0 -1
  52. package/dist/public/_nuxt/DsbJux3u.js +0 -1
  53. package/dist/public/_nuxt/builds/latest.json +0 -1
  54. package/dist/public/_nuxt/builds/meta/3597016d-955b-44d8-83dd-f083d7311779.json +0 -1
  55. package/dist/public/_nuxt/diff.worker-9IK9E-UB.js +0 -10
  56. package/dist/public/_nuxt/entry.BHghYYEP.css +0 -1
  57. package/dist/public/_nuxt/error-404.7Y6KY23b.css +0 -1
  58. package/dist/public/_nuxt/error-500.CaUb23JJ.css +0 -1
  59. package/dist/public/_nuxt/graph.BGBTj9Q7.css +0 -1
  60. package/dist/public/dot-grid-dark.png +0 -0
  61. package/dist/public/dot-grid-light.png +0 -0
  62. package/dist/public/favicon.svg +0 -15
  63. package/dist/public/fonts/dmmono-612bc94f.woff2 +0 -0
  64. package/dist/public/fonts/dmmono-cbe07c46.woff2 +0 -0
  65. package/dist/public/fonts/dmsans-b28079ff.woff2 +0 -0
  66. package/dist/public/fonts/dmsans-b4f1d45c.woff2 +0 -0
  67. package/dist/public/index.html +0 -16
  68. package/dist/public/vite-devtools.svg +0 -17
  69. /package/{LICENSE.md → LICENSE} +0 -0
  70. /package/dist/{cli-C3YoliaZ.d.mts → cli.d.ts} +0 -0
@@ -0,0 +1,153 @@
1
+ import { Plugin, ResolvedConfig, ViteDevServer } from "vite";
2
+
3
+ //#region ../kit/src/types/rpc-augments.d.ts
4
+
5
+ /**
6
+ * To be extended
7
+ */
8
+ interface DevToolsRpcServerFunctions {}
9
+ //#endregion
10
+ //#region ../kit/src/types/utils.d.ts
11
+ type Thenable<T> = T | Promise<T>;
12
+ type EntriesToObject<T extends readonly [string, any][]> = { [K in T[number] as K[0]]: K[1] };
13
+ //#endregion
14
+ //#region ../kit/src/types/views.d.ts
15
+ interface DevToolsDockHost {
16
+ views: Map<string, DevToolsDockEntry>;
17
+ register: (entry: DevToolsDockEntry) => void;
18
+ update: (entry: DevToolsDockEntry) => void;
19
+ values: () => DevToolsDockEntry[];
20
+ }
21
+ interface DevToolsViewHost {
22
+ /**
23
+ * @internal
24
+ */
25
+ buildStaticDirs: {
26
+ baseUrl: string;
27
+ distDir: string;
28
+ }[];
29
+ /**
30
+ * Helper to host static files
31
+ * - In `dev` mode, it will register middleware to `viteServer.middlewares` to host the static files
32
+ * - In `build` mode, it will copy the static files to the dist directory
33
+ */
34
+ hostStatic: (baseUrl: string, distDir: string) => void;
35
+ }
36
+ type DevToolsDockEntryCategory = 'app' | 'framework' | 'web' | 'advanced' | 'default';
37
+ interface DevToolsDockEntryBase {
38
+ id: string;
39
+ title: string;
40
+ icon: string | {
41
+ light: string;
42
+ dark: string;
43
+ };
44
+ /**
45
+ * The default order of the entry in the dock.
46
+ * The higher the number the earlier it appears.
47
+ * @default 0
48
+ */
49
+ defaultOrder?: number;
50
+ /**
51
+ * The category of the entry
52
+ * @default 'default'
53
+ */
54
+ category?: DevToolsDockEntryCategory;
55
+ }
56
+ interface ClientScriptEntry {
57
+ /**
58
+ * The filepath or module name to import from
59
+ */
60
+ importFrom: string;
61
+ /**
62
+ * The name to import the module as
63
+ *
64
+ * @default 'default'
65
+ */
66
+ importName?: string;
67
+ }
68
+ interface DevToolsViewIframe extends DevToolsDockEntryBase {
69
+ type: 'iframe';
70
+ url: string;
71
+ /**
72
+ * The id of the iframe, if multiple tabs is assigned with the same id, the iframe will be shared.
73
+ *
74
+ * When not provided, it would be treated as a unique frame.
75
+ */
76
+ frameId?: string;
77
+ /**
78
+ * Optional client script to import into the iframe
79
+ */
80
+ clientScript?: ClientScriptEntry;
81
+ }
82
+ interface DevToolsViewAction extends DevToolsDockEntryBase {
83
+ type: 'action';
84
+ action: ClientScriptEntry;
85
+ }
86
+ interface DevToolsViewCustomRender extends DevToolsDockEntryBase {
87
+ type: 'custom-render';
88
+ renderer: ClientScriptEntry;
89
+ }
90
+ type DevToolsDockEntry = DevToolsViewIframe | DevToolsViewAction | DevToolsViewCustomRender;
91
+ //#endregion
92
+ //#region ../kit/src/types/vite-plugin.d.ts
93
+ interface DevToolsCapabilities {
94
+ rpc?: boolean;
95
+ views?: boolean;
96
+ }
97
+ interface DevToolsPluginOptions {
98
+ capabilities?: {
99
+ dev?: DevToolsCapabilities | boolean;
100
+ build?: DevToolsCapabilities | boolean;
101
+ };
102
+ setup: (context: DevToolsNodeContext) => void | Promise<void>;
103
+ }
104
+ interface DevToolsNodeContext {
105
+ readonly cwd: string;
106
+ readonly mode: 'dev' | 'build';
107
+ readonly viteConfig: ResolvedConfig;
108
+ readonly viteServer?: ViteDevServer;
109
+ rpc: RpcFunctionsHost;
110
+ docks: DevToolsDockHost;
111
+ views: DevToolsViewHost;
112
+ utils: DevToolsNodeUtils;
113
+ }
114
+ interface DevToolsNodeUtils {
115
+ clientEntryFromSimpleFunction: (fn: () => void) => ClientScriptEntry;
116
+ }
117
+ //#endregion
118
+ //#region ../kit/src/types/rpc.d.ts
119
+ /**
120
+ * Type of the RPC function,
121
+ * - static: A function that returns a static data (can be cached and dumped)
122
+ * - action: A function that performs an action (no data returned)
123
+ * - query: A function that queries a resource
124
+ */
125
+ type RpcFunctionType = 'static' | 'action' | 'query';
126
+ interface RpcFunctionsHost {
127
+ context: DevToolsNodeContext;
128
+ readonly functions: DevToolsRpcServerFunctions;
129
+ readonly definitions: Map<string, RpcFunctionDefinition<string, any, any, any>>;
130
+ register: (fn: RpcFunctionDefinition<string, any, any, any>) => void;
131
+ update: (fn: RpcFunctionDefinition<string, any, any, any>) => void;
132
+ }
133
+ interface RpcFunctionSetupResult<ARGS extends any[], RETURN = void> {
134
+ handler: (...args: ARGS) => RETURN;
135
+ }
136
+ interface RpcFunctionDefinition<NAME extends string, TYPE extends RpcFunctionType, ARGS extends any[] = [], RETURN = void> {
137
+ name: NAME;
138
+ type: TYPE;
139
+ setup: (context: DevToolsNodeContext) => Thenable<RpcFunctionSetupResult<ARGS, RETURN>>;
140
+ handler?: (...args: ARGS) => RETURN;
141
+ __resolved?: RpcFunctionSetupResult<ARGS, RETURN>;
142
+ __promise?: Thenable<RpcFunctionSetupResult<ARGS, RETURN>>;
143
+ }
144
+ type RpcDefinitionsToFunctions<T extends readonly RpcFunctionDefinition<any, any, any>[]> = EntriesToObject<{ [K in keyof T]: [T[K]['name'], Awaited<ReturnType<T[K]['setup']>>['handler']] }>;
145
+ //#endregion
146
+ //#region ../kit/src/types/vite-augment.d.ts
147
+ declare module 'vite' {
148
+ interface Plugin {
149
+ devtools?: DevToolsPluginOptions;
150
+ }
151
+ }
152
+ //#endregion
153
+ export { DevToolsDockEntry as i, RpcFunctionDefinition as n, DevToolsNodeContext as r, RpcDefinitionsToFunctions as t };
@@ -0,0 +1,46 @@
1
+ import { i as DevToolsDockEntry, n as RpcFunctionDefinition, r as DevToolsNodeContext, t as RpcDefinitionsToFunctions } from "./index-DdVYVGyC.js";
2
+ import { Plugin, ResolvedConfig, ViteDevServer } from "vite";
3
+ import * as birpc0 from "birpc";
4
+ import * as h30 from "h3";
5
+
6
+ //#region src/node/context.d.ts
7
+ declare function createDevToolsContext(viteConfig: ResolvedConfig, viteServer?: ViteDevServer): Promise<DevToolsNodeContext>;
8
+ //#endregion
9
+ //#region src/node/rpc/index.d.ts
10
+ declare const builtinRpcFunctions: readonly [RpcFunctionDefinition<"vite:core:list-rpc-functions", "action", [], Promise<{
11
+ [k: string]: {
12
+ type: any;
13
+ };
14
+ }>>, RpcFunctionDefinition<"vite:core:list-dock-entries", "query", [], DevToolsDockEntry[]>, RpcFunctionDefinition<"vite:core:open-in-editor", "action", [path: string], Promise<void>>, RpcFunctionDefinition<"vite:core:open-in-finder", "action", [path: string], Promise<void>>];
15
+ type ServerFunctions = RpcDefinitionsToFunctions<typeof builtinRpcFunctions>;
16
+ declare module '@vitejs/devtools-kit' {
17
+ interface DevToolsRpcServerFunctions extends ServerFunctions {}
18
+ }
19
+ //#endregion
20
+ //#region src/node/plugins/index.d.ts
21
+ interface DevToolsOptions {
22
+ /**
23
+ * Include the Vite builtin devtools UI.
24
+ *
25
+ * @default true
26
+ */
27
+ builtinDevTools?: boolean;
28
+ }
29
+ declare function DevTools(options?: DevToolsOptions): Promise<Plugin[]>;
30
+ //#endregion
31
+ //#region src/node/ws.d.ts
32
+ interface CreateWsServerOptions {
33
+ cwd: string;
34
+ portWebSocket?: number;
35
+ base?: string;
36
+ context: DevToolsNodeContext;
37
+ }
38
+ //#endregion
39
+ //#region src/node/server.d.ts
40
+ declare function createDevToolsMiddleware(options: CreateWsServerOptions): Promise<{
41
+ h3: h30.App;
42
+ middleware: h30.NodeListener;
43
+ rpc: birpc0.BirpcGroup<any, any>;
44
+ }>;
45
+ //#endregion
46
+ export { DevTools, createDevToolsContext, createDevToolsMiddleware };
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ import { d as createDevToolsContext, n as createDevToolsMiddleware, t as DevTools } from "./plugins-znai7bMv.js";
2
+ import "./dirs-DcSK9l9L.js";
3
+
4
+ export { DevTools, createDevToolsContext, createDevToolsMiddleware };