@vitejs/devtools 0.0.0-alpha.1 → 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.
- package/{bin.mjs → bin.js} +1 -1
- package/dist/cli-commands-CWESTkWI.js +97 -0
- package/dist/cli-commands.d.ts +18 -0
- package/dist/cli-commands.js +5 -0
- package/dist/cli.js +17 -0
- package/dist/client/inject.d.ts +4 -0
- package/dist/client/inject.js +33 -0
- package/dist/client/standalone/assets/index-BGdE2uyE.css +1 -0
- package/dist/client/standalone/assets/index-BXYGGkRo.js +7 -0
- package/dist/client/standalone/index.html +14 -0
- package/dist/client/webcomponents.d.ts +45 -0
- package/dist/client/webcomponents.js +1063 -0
- package/dist/dirs-DcSK9l9L.js +9 -0
- package/dist/dirs.d.ts +5 -0
- package/dist/dirs.js +3 -0
- package/dist/dist-B0hQ6r05.js +6779 -0
- package/dist/index-C-9eMTqf.d.ts +142 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.js +4 -0
- package/dist/plugins-5VE4Mfdt.js +1365 -0
- package/package.json +50 -57
- package/dist/cli-B_fm1Ing.mjs +0 -1039
- package/dist/cli.d.mts +0 -1
- package/dist/cli.mjs +0 -3
- package/dist/dirs-6LDFDMFM.mjs +0 -7
- package/dist/dirs.d.mts +0 -4
- package/dist/dirs.mjs +0 -3
- package/dist/functions-BdbZxtmk.mjs +0 -3
- package/dist/functions-d6vvbndK.mjs +0 -234
- package/dist/index.d.mts +0 -13
- package/dist/index.mjs +0 -7
- package/dist/nitro.json +0 -15
- package/dist/node/cli.d.mts +0 -1
- package/dist/node/cli.mjs +0 -3
- package/dist/public/200.html +0 -16
- package/dist/public/404.html +0 -16
- package/dist/public/_nuxt/B4lqwDon.js +0 -1
- package/dist/public/_nuxt/BMB3EEfo.js +0 -1
- package/dist/public/_nuxt/BYYDnj5Q.js +0 -1
- package/dist/public/_nuxt/BeSFnMzD.js +0 -1
- package/dist/public/_nuxt/BfzgVO01.js +0 -1
- package/dist/public/_nuxt/BpyJ-U40.js +0 -1
- package/dist/public/_nuxt/BxkFQq1F.js +0 -1
- package/dist/public/_nuxt/C1DPtPHu.js +0 -1
- package/dist/public/_nuxt/C8oXVTvZ.js +0 -1
- package/dist/public/_nuxt/CWPvh8od.js +0 -1
- package/dist/public/_nuxt/CiwsH4Q6.js +0 -33
- package/dist/public/_nuxt/CsnZqsGp.js +0 -16
- package/dist/public/_nuxt/CzEHI6hC.js +0 -1
- package/dist/public/_nuxt/D-iXojuv.js +0 -1
- package/dist/public/_nuxt/DHpfOFMA.js +0 -1
- package/dist/public/_nuxt/DsbJux3u.js +0 -1
- package/dist/public/_nuxt/builds/latest.json +0 -1
- package/dist/public/_nuxt/builds/meta/3597016d-955b-44d8-83dd-f083d7311779.json +0 -1
- package/dist/public/_nuxt/diff.worker-9IK9E-UB.js +0 -10
- package/dist/public/_nuxt/entry.BHghYYEP.css +0 -1
- package/dist/public/_nuxt/error-404.7Y6KY23b.css +0 -1
- package/dist/public/_nuxt/error-500.CaUb23JJ.css +0 -1
- package/dist/public/_nuxt/graph.BGBTj9Q7.css +0 -1
- package/dist/public/dot-grid-dark.png +0 -0
- package/dist/public/dot-grid-light.png +0 -0
- package/dist/public/favicon.svg +0 -15
- package/dist/public/fonts/dmmono-612bc94f.woff2 +0 -0
- package/dist/public/fonts/dmmono-cbe07c46.woff2 +0 -0
- package/dist/public/fonts/dmsans-b28079ff.woff2 +0 -0
- package/dist/public/fonts/dmsans-b4f1d45c.woff2 +0 -0
- package/dist/public/index.html +0 -16
- package/dist/public/vite-devtools.svg +0 -17
- /package/{LICENSE.md → LICENSE} +0 -0
- /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 };
|
package/dist/index.d.ts
ADDED
|
@@ -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