@vitejs/devtools 0.0.0-alpha.0 → 0.0.0-alpha.10

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 (72) hide show
  1. package/{bin.mjs → bin.js} +1 -1
  2. package/dist/cli-commands-CWESTkWI.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-BGdE2uyE.css +1 -0
  9. package/dist/client/standalone/assets/index-BXYGGkRo.js +7 -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 +1063 -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-C-9eMTqf.d.ts +142 -0
  18. package/dist/index.d.ts +46 -0
  19. package/dist/index.js +4 -0
  20. package/dist/plugins-5VE4Mfdt.js +1365 -0
  21. package/package.json +51 -56
  22. package/dist/cli-CkEkRmBL.mjs +0 -176
  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-CKJw6Oxo.mjs +0 -1066
  29. package/dist/functions-peYM_6iz.mjs +0 -3
  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 -25
  36. package/dist/public/404.html +0 -25
  37. package/dist/public/_nuxt/B0gvptKi.js +0 -1
  38. package/dist/public/_nuxt/B1XPhBbs.js +0 -4
  39. package/dist/public/_nuxt/B4YzJ31L.js +0 -1
  40. package/dist/public/_nuxt/BHxVjsIi.js +0 -1
  41. package/dist/public/_nuxt/BKXf1uMu.js +0 -1
  42. package/dist/public/_nuxt/BKZ3jkBI.js +0 -1
  43. package/dist/public/_nuxt/Bnn-hxaI.js +0 -1
  44. package/dist/public/_nuxt/BrR0v-Bn.js +0 -1
  45. package/dist/public/_nuxt/BuzEimhA.js +0 -33
  46. package/dist/public/_nuxt/C4K5k6WM.js +0 -1
  47. package/dist/public/_nuxt/COxwzm_n.js +0 -12
  48. package/dist/public/_nuxt/CaCHQCx7.js +0 -1
  49. package/dist/public/_nuxt/CcGHFnjf.js +0 -1
  50. package/dist/public/_nuxt/CmTKMvEX.js +0 -1
  51. package/dist/public/_nuxt/CwDtpcut.js +0 -1
  52. package/dist/public/_nuxt/DKLzMrv9.js +0 -1
  53. package/dist/public/_nuxt/I6F6kbCC.js +0 -1
  54. package/dist/public/_nuxt/WiKH-0vv.js +0 -1
  55. package/dist/public/_nuxt/YnXJxoTD.js +0 -1
  56. package/dist/public/_nuxt/builds/latest.json +0 -1
  57. package/dist/public/_nuxt/builds/meta/4e2f12bf-362f-48e3-9beb-2b83e6e986dc.json +0 -1
  58. package/dist/public/_nuxt/diff.worker-394KunD7.js +0 -4
  59. package/dist/public/_nuxt/entry.DadeTU15.css +0 -1
  60. package/dist/public/_nuxt/error-404.RpxUbdEP.css +0 -1
  61. package/dist/public/_nuxt/error-500.tfCn4Lmz.css +0 -1
  62. package/dist/public/_nuxt/flow.CT0fChr5.css +0 -1
  63. package/dist/public/_nuxt/kgs9XIg8.js +0 -1
  64. package/dist/public/dot-grid-dark.png +0 -0
  65. package/dist/public/dot-grid-light.png +0 -0
  66. package/dist/public/fonts/dmmono-612bc94f.woff2 +0 -0
  67. package/dist/public/fonts/dmmono-cbe07c46.woff2 +0 -0
  68. package/dist/public/fonts/dmsans-b28079ff.woff2 +0 -0
  69. package/dist/public/fonts/dmsans-b4f1d45c.woff2 +0 -0
  70. package/dist/public/index.html +0 -25
  71. /package/{LICENSE.md → LICENSE} +0 -0
  72. /package/dist/{cli-C3YoliaZ.d.mts → cli.d.ts} +0 -0
@@ -0,0 +1,142 @@
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
+ interface DevToolsDockEntryBase {
37
+ id: string;
38
+ title: string;
39
+ icon: string;
40
+ }
41
+ interface ClientScriptEntry {
42
+ /**
43
+ * The filepath or module name to import from
44
+ */
45
+ importFrom: string;
46
+ /**
47
+ * The name to import the module as
48
+ *
49
+ * @default 'default'
50
+ */
51
+ importName?: string;
52
+ }
53
+ interface DevToolsViewIframe extends DevToolsDockEntryBase {
54
+ type: 'iframe';
55
+ url: string;
56
+ /**
57
+ * The id of the iframe, if multiple tabs is assigned with the same id, the iframe will be shared.
58
+ *
59
+ * When not provided, it would be treated as a unique frame.
60
+ */
61
+ frameId?: string;
62
+ /**
63
+ * Optional script to import into the iframe
64
+ */
65
+ import?: ClientScriptEntry;
66
+ }
67
+ interface DevToolsViewWebComponent extends DevToolsDockEntryBase {
68
+ type: 'webcomponent';
69
+ import: ClientScriptEntry;
70
+ }
71
+ interface DevToolsViewAction extends DevToolsDockEntryBase {
72
+ type: 'action';
73
+ import: ClientScriptEntry;
74
+ }
75
+ interface DevToolsViewCustomRender extends DevToolsDockEntryBase {
76
+ type: 'custom-render';
77
+ import: ClientScriptEntry;
78
+ }
79
+ type DevToolsDockEntry = DevToolsViewIframe | DevToolsViewWebComponent | DevToolsViewAction | DevToolsViewCustomRender;
80
+ //#endregion
81
+ //#region ../kit/src/types/vite-plugin.d.ts
82
+ interface DevToolsCapabilities {
83
+ rpc?: boolean;
84
+ views?: boolean;
85
+ }
86
+ interface DevToolsPluginOptions {
87
+ capabilities?: {
88
+ dev?: DevToolsCapabilities | boolean;
89
+ build?: DevToolsCapabilities | boolean;
90
+ };
91
+ setup: (context: DevToolsNodeContext) => void | Promise<void>;
92
+ }
93
+ interface DevToolsNodeContext {
94
+ readonly cwd: string;
95
+ readonly mode: 'dev' | 'build';
96
+ readonly viteConfig: ResolvedConfig;
97
+ readonly viteServer?: ViteDevServer;
98
+ rpc: RpcFunctionsHost;
99
+ docks: DevToolsDockHost;
100
+ views: DevToolsViewHost;
101
+ utils: DevToolsNodeUtils;
102
+ }
103
+ interface DevToolsNodeUtils {
104
+ clientEntryFromSimpleFunction: (fn: () => void) => ClientScriptEntry;
105
+ }
106
+ //#endregion
107
+ //#region ../kit/src/types/rpc.d.ts
108
+ /**
109
+ * Type of the RPC function,
110
+ * - static: A function that returns a static data (can be cached and dumped)
111
+ * - action: A function that performs an action (no data returned)
112
+ * - query: A function that queries a resource
113
+ */
114
+ type RpcFunctionType = 'static' | 'action' | 'query';
115
+ interface RpcFunctionsHost {
116
+ context: DevToolsNodeContext;
117
+ readonly functions: DevToolsRpcServerFunctions;
118
+ readonly definitions: Map<string, RpcFunctionDefinition<string, any, any, any>>;
119
+ register: (fn: RpcFunctionDefinition<string, any, any, any>) => void;
120
+ update: (fn: RpcFunctionDefinition<string, any, any, any>) => void;
121
+ }
122
+ interface RpcFunctionSetupResult<ARGS extends any[], RETURN = void> {
123
+ handler: (...args: ARGS) => RETURN;
124
+ }
125
+ interface RpcFunctionDefinition<NAME extends string, TYPE extends RpcFunctionType, ARGS extends any[] = [], RETURN = void> {
126
+ name: NAME;
127
+ type: TYPE;
128
+ setup: (context: DevToolsNodeContext) => Thenable<RpcFunctionSetupResult<ARGS, RETURN>>;
129
+ handler?: (...args: ARGS) => RETURN;
130
+ __resolved?: RpcFunctionSetupResult<ARGS, RETURN>;
131
+ __promise?: Thenable<RpcFunctionSetupResult<ARGS, RETURN>>;
132
+ }
133
+ type RpcDefinitionsToFunctions<T extends readonly RpcFunctionDefinition<any, any, any>[]> = EntriesToObject<{ [K in keyof T]: [T[K]['name'], Awaited<ReturnType<T[K]['setup']>>['handler']] }>;
134
+ //#endregion
135
+ //#region ../kit/src/types/vite-augment.d.ts
136
+ declare module 'vite' {
137
+ interface Plugin {
138
+ devtools?: DevToolsPluginOptions;
139
+ }
140
+ }
141
+ //#endregion
142
+ 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-C-9eMTqf.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-5VE4Mfdt.js";
2
+ import "./dirs-DcSK9l9L.js";
3
+
4
+ export { DevTools, createDevToolsContext, createDevToolsMiddleware };