@vitejs/devtools 0.0.0-alpha.3 → 0.0.0-alpha.30
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/dist/DockIcon-BfVdt_M0.js +1717 -0
- package/dist/ViewBuiltinLogs-C8wFxIxg.js +12 -0
- package/dist/ViewBuiltinTerminals-CrBOq_Ni.js +10414 -0
- package/dist/cli-commands.d.ts +18 -0
- package/dist/cli-commands.js +67 -0
- package/dist/cli.js +4 -87
- package/dist/client/inject.js +111 -14
- package/dist/client/standalone/assets/ViewBuiltinLogs-CYvdMq-7.js +1 -0
- package/dist/client/standalone/assets/ViewBuiltinTerminals-B9l9XmES.js +36 -0
- package/dist/client/standalone/assets/index-DWC0UjCz.js +2 -0
- package/dist/client/standalone/assets/index-DzhHPm4X.css +1 -0
- package/dist/client/standalone/index.html +3 -3
- package/dist/client/webcomponents.d.ts +1471 -29
- package/dist/client/webcomponents.js +1121 -323
- package/dist/dirs.js +7 -1
- package/dist/dist-BpFPAu5f.js +916 -0
- package/dist/docks-CYaKLVhQ.js +131 -0
- package/dist/export-helper-DjM8b2QE.js +9 -0
- package/dist/index.d.ts +221 -9
- package/dist/index.js +21 -3
- package/dist/plugins-BbzqUdpu.js +3038 -0
- package/dist/standalone-DVh1a9tu.js +34 -0
- package/dist/{core-uTAXYiA1.js → vue.runtime.esm-bundler-DL0i8o0W.js} +1262 -1514
- package/package.json +32 -20
- package/dist/client/standalone/assets/index-C0WqLnSL.js +0 -7
- package/dist/client/standalone/assets/index-DLsPMQDX.css +0 -1
- package/dist/dirs-B7dOX6eI.js +0 -9
- package/dist/plugins-DDjui9Ga.js +0 -1314
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { I as reactive, O as watch, P as markRaw, z as shallowRef } from "./vue.runtime.esm-bundler-DL0i8o0W.js";
|
|
2
|
+
import { createEventEmitter } from "@vitejs/devtools-kit/utils/events";
|
|
3
|
+
|
|
4
|
+
//#region src/client/webcomponents/constants.ts
|
|
5
|
+
const BUILTIN_ENTRY_CLIENT_AUTH_NOTICE = Object.freeze({
|
|
6
|
+
type: "~builtin",
|
|
7
|
+
id: "~client-auth-notice",
|
|
8
|
+
title: "Unauthorized",
|
|
9
|
+
icon: "i-fluent-emoji-flat-warning"
|
|
10
|
+
});
|
|
11
|
+
const BUILTIN_ENTRIES = Object.freeze([BUILTIN_ENTRY_CLIENT_AUTH_NOTICE]);
|
|
12
|
+
const DEFAULT_CATEGORIES_ORDER = {
|
|
13
|
+
"~viteplus": -1e3,
|
|
14
|
+
"default": 0,
|
|
15
|
+
"app": 100,
|
|
16
|
+
"framework": 200,
|
|
17
|
+
"web": 300,
|
|
18
|
+
"advanced": 400,
|
|
19
|
+
"~builtin": 1e3
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/client/webcomponents/state/dock-settings.ts
|
|
24
|
+
/**
|
|
25
|
+
* Group and sort dock entries based on user settings.
|
|
26
|
+
* Filters out hidden entries and categories, sorts by pinned status, custom order, and default order.
|
|
27
|
+
*/
|
|
28
|
+
function docksGroupByCategories(entries, settings, options) {
|
|
29
|
+
const { docksHidden, docksCategoriesHidden, docksCustomOrder, docksPinned } = settings;
|
|
30
|
+
const { includeHidden = false } = options ?? {};
|
|
31
|
+
const map = /* @__PURE__ */ new Map();
|
|
32
|
+
for (const entry of entries) {
|
|
33
|
+
if (entry.isHidden && !includeHidden) continue;
|
|
34
|
+
if (!includeHidden && docksHidden.includes(entry.id)) continue;
|
|
35
|
+
const category = entry.category ?? "default";
|
|
36
|
+
if (!includeHidden && docksCategoriesHidden.includes(category)) continue;
|
|
37
|
+
if (!map.has(category)) map.set(category, []);
|
|
38
|
+
map.get(category).push(entry);
|
|
39
|
+
}
|
|
40
|
+
const grouped = Array.from(map.entries()).sort(([a], [b]) => {
|
|
41
|
+
const ia = DEFAULT_CATEGORIES_ORDER[a] || 0;
|
|
42
|
+
const ib = DEFAULT_CATEGORIES_ORDER[b] || 0;
|
|
43
|
+
return ib === ia ? b.localeCompare(a) : ia - ib;
|
|
44
|
+
});
|
|
45
|
+
grouped.forEach(([_, items]) => {
|
|
46
|
+
items.sort((a, b) => {
|
|
47
|
+
const aPinned = docksPinned.includes(a.id);
|
|
48
|
+
if (aPinned !== docksPinned.includes(b.id)) return aPinned ? -1 : 1;
|
|
49
|
+
const customOrderA = docksCustomOrder[a.id] ?? 0;
|
|
50
|
+
const customOrderB = docksCustomOrder[b.id] ?? 0;
|
|
51
|
+
if (customOrderA !== customOrderB) return customOrderA - customOrderB;
|
|
52
|
+
const ia = a.defaultOrder ?? 0;
|
|
53
|
+
const ib = b.defaultOrder ?? 0;
|
|
54
|
+
return ib === ia ? b.title.localeCompare(a.title) : ia - ib;
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
return grouped;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Split grouped entries into visible and overflow based on capacity.
|
|
61
|
+
*/
|
|
62
|
+
function docksSplitGroupsWithCapacity(groups, capacity) {
|
|
63
|
+
const visible = [];
|
|
64
|
+
const overflow = [];
|
|
65
|
+
let left = capacity;
|
|
66
|
+
for (const [category, items] of groups) if (left <= 0) overflow.push([category, items]);
|
|
67
|
+
else if (items.length > left) {
|
|
68
|
+
visible.push([category, items.slice(0, left)]);
|
|
69
|
+
overflow.push([category, items.slice(left)]);
|
|
70
|
+
left = 0;
|
|
71
|
+
} else {
|
|
72
|
+
left -= items.length;
|
|
73
|
+
visible.push([category, items]);
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
visible,
|
|
77
|
+
overflow
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/client/webcomponents/state/docks.ts
|
|
83
|
+
function DEFAULT_DOCK_PANEL_STORE() {
|
|
84
|
+
return {
|
|
85
|
+
width: 80,
|
|
86
|
+
height: 80,
|
|
87
|
+
top: 0,
|
|
88
|
+
left: 10,
|
|
89
|
+
position: "bottom",
|
|
90
|
+
open: false,
|
|
91
|
+
inactiveTimeout: 3e3
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function createDockEntryState(entry, selected) {
|
|
95
|
+
const events = createEventEmitter();
|
|
96
|
+
const state = reactive({
|
|
97
|
+
entryMeta: entry,
|
|
98
|
+
get isActive() {
|
|
99
|
+
return selected.value?.id === entry.id;
|
|
100
|
+
},
|
|
101
|
+
domElements: {},
|
|
102
|
+
events: markRaw(events)
|
|
103
|
+
});
|
|
104
|
+
watch(() => selected.value?.id, (newSelectedId) => {
|
|
105
|
+
if (newSelectedId === entry.id) events.emit("entry:activated");
|
|
106
|
+
else events.emit("entry:deactivated");
|
|
107
|
+
}, { immediate: true });
|
|
108
|
+
watch(() => state.domElements.iframe, (newIframe) => {
|
|
109
|
+
if (newIframe) events.emit("dom:iframe:mounted", newIframe);
|
|
110
|
+
}, { immediate: true });
|
|
111
|
+
watch(() => state.domElements.panel, (newPanel) => {
|
|
112
|
+
if (newPanel) events.emit("dom:panel:mounted", newPanel);
|
|
113
|
+
}, { immediate: true });
|
|
114
|
+
return state;
|
|
115
|
+
}
|
|
116
|
+
function sharedStateToRef(sharedState) {
|
|
117
|
+
const ref = shallowRef(sharedState.value());
|
|
118
|
+
sharedState.on("updated", (newState) => {
|
|
119
|
+
ref.value = newState;
|
|
120
|
+
});
|
|
121
|
+
return ref;
|
|
122
|
+
}
|
|
123
|
+
let _docksEntriesRef;
|
|
124
|
+
async function useDocksEntries(rpc) {
|
|
125
|
+
if (_docksEntriesRef) return _docksEntriesRef;
|
|
126
|
+
_docksEntriesRef = sharedStateToRef(await rpc.sharedState.get("devtoolskit:internal:docks", { initialValue: [] }));
|
|
127
|
+
return _docksEntriesRef;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
//#endregion
|
|
131
|
+
export { docksGroupByCategories as a, BUILTIN_ENTRY_CLIENT_AUTH_NOTICE as c, useDocksEntries as i, createDockEntryState as n, docksSplitGroupsWithCapacity as o, sharedStateToRef as r, BUILTIN_ENTRIES as s, DEFAULT_DOCK_PANEL_STORE as t };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,222 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "@vitejs/devtools-vite";
|
|
1
|
+
import { StartOptions } from "./cli-commands.js";
|
|
3
2
|
import { Plugin, ResolvedConfig, ViteDevServer } from "vite";
|
|
4
|
-
import
|
|
5
|
-
import * as
|
|
3
|
+
import { SharedStatePatch } from "@vitejs/devtools-kit/utils/shared-state";
|
|
4
|
+
import * as _vitejs_devtools_rpc0 from "@vitejs/devtools-rpc";
|
|
5
|
+
import { RpcFunctionsCollectorBase } from "@vitejs/devtools-rpc";
|
|
6
|
+
import * as _vitejs_devtools_kit0 from "@vitejs/devtools-kit";
|
|
7
|
+
import { DevToolsDockEntry, DevToolsDocksUserSettings, DevToolsNodeContext, DevToolsTerminalSessionStreamChunkEvent, RpcDefinitionsToFunctions } from "@vitejs/devtools-kit";
|
|
8
|
+
import * as h3 from "h3";
|
|
9
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
10
|
+
import * as birpc from "birpc";
|
|
6
11
|
|
|
12
|
+
//#region src/node/config.d.ts
|
|
13
|
+
interface DevToolsConfig extends Partial<StartOptions> {
|
|
14
|
+
enabled: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Disable client authentication.
|
|
17
|
+
*
|
|
18
|
+
* Beware that if you disable client authentication,
|
|
19
|
+
* any browsers can connect to the devtools and access to your server and filesystem.
|
|
20
|
+
* (including other devices, if you open server `host` option to LAN or WAN)
|
|
21
|
+
*
|
|
22
|
+
* @default true
|
|
23
|
+
*/
|
|
24
|
+
clientAuth?: boolean;
|
|
25
|
+
}
|
|
26
|
+
interface ResolvedDevToolsConfig {
|
|
27
|
+
config: Omit<DevToolsConfig, 'enabled'> & {
|
|
28
|
+
host: string;
|
|
29
|
+
};
|
|
30
|
+
enabled: boolean;
|
|
31
|
+
}
|
|
32
|
+
declare function normalizeDevToolsConfig(config: DevToolsConfig | boolean | undefined, host: string): ResolvedDevToolsConfig;
|
|
33
|
+
//#endregion
|
|
7
34
|
//#region src/node/context.d.ts
|
|
8
35
|
declare function createDevToolsContext(viteConfig: ResolvedConfig, viteServer?: ViteDevServer): Promise<DevToolsNodeContext>;
|
|
9
36
|
//#endregion
|
|
37
|
+
//#region src/node/rpc/anonymous/auth.d.ts
|
|
38
|
+
interface DevToolsAuthInput {
|
|
39
|
+
authId: string;
|
|
40
|
+
ua: string;
|
|
41
|
+
origin: string;
|
|
42
|
+
}
|
|
43
|
+
interface DevToolsAuthReturn {
|
|
44
|
+
isTrusted: boolean;
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/node/rpc/index.d.ts
|
|
48
|
+
declare const builtinRpcDeclarations: readonly [{
|
|
49
|
+
name: "vite:core:open-in-editor";
|
|
50
|
+
type?: "action" | undefined;
|
|
51
|
+
cacheable?: boolean;
|
|
52
|
+
args?: undefined;
|
|
53
|
+
returns?: undefined;
|
|
54
|
+
setup?: ((context: _vitejs_devtools_kit0.DevToolsNodeContext) => _vitejs_devtools_rpc0.Thenable<_vitejs_devtools_rpc0.RpcFunctionSetupResult<[path: string], Promise<void>>>) | undefined;
|
|
55
|
+
handler?: ((path: string) => Promise<void>) | undefined;
|
|
56
|
+
dump?: _vitejs_devtools_rpc0.RpcDump<[path: string], Promise<void>, _vitejs_devtools_kit0.DevToolsNodeContext> | undefined;
|
|
57
|
+
__resolved?: _vitejs_devtools_rpc0.RpcFunctionSetupResult<[path: string], Promise<void>> | undefined;
|
|
58
|
+
__promise?: _vitejs_devtools_rpc0.Thenable<_vitejs_devtools_rpc0.RpcFunctionSetupResult<[path: string], Promise<void>>> | undefined;
|
|
59
|
+
}, {
|
|
60
|
+
name: "vite:core:open-in-finder";
|
|
61
|
+
type?: "action" | undefined;
|
|
62
|
+
cacheable?: boolean;
|
|
63
|
+
args?: undefined;
|
|
64
|
+
returns?: undefined;
|
|
65
|
+
setup?: ((context: _vitejs_devtools_kit0.DevToolsNodeContext) => _vitejs_devtools_rpc0.Thenable<_vitejs_devtools_rpc0.RpcFunctionSetupResult<[path: string], Promise<void>>>) | undefined;
|
|
66
|
+
handler?: ((path: string) => Promise<void>) | undefined;
|
|
67
|
+
dump?: _vitejs_devtools_rpc0.RpcDump<[path: string], Promise<void>, _vitejs_devtools_kit0.DevToolsNodeContext> | undefined;
|
|
68
|
+
__resolved?: _vitejs_devtools_rpc0.RpcFunctionSetupResult<[path: string], Promise<void>> | undefined;
|
|
69
|
+
__promise?: _vitejs_devtools_rpc0.Thenable<_vitejs_devtools_rpc0.RpcFunctionSetupResult<[path: string], Promise<void>>> | undefined;
|
|
70
|
+
}, {
|
|
71
|
+
name: "vite:anonymous:auth";
|
|
72
|
+
type?: "action" | undefined;
|
|
73
|
+
cacheable?: boolean;
|
|
74
|
+
args?: undefined;
|
|
75
|
+
returns?: undefined;
|
|
76
|
+
setup?: ((context: _vitejs_devtools_kit0.DevToolsNodeContext) => _vitejs_devtools_rpc0.Thenable<_vitejs_devtools_rpc0.RpcFunctionSetupResult<[query: DevToolsAuthInput], Promise<DevToolsAuthReturn>>>) | undefined;
|
|
77
|
+
handler?: ((query: DevToolsAuthInput) => Promise<DevToolsAuthReturn>) | undefined;
|
|
78
|
+
dump?: _vitejs_devtools_rpc0.RpcDump<[query: DevToolsAuthInput], Promise<DevToolsAuthReturn>, _vitejs_devtools_kit0.DevToolsNodeContext> | undefined;
|
|
79
|
+
__resolved?: _vitejs_devtools_rpc0.RpcFunctionSetupResult<[query: DevToolsAuthInput], Promise<DevToolsAuthReturn>> | undefined;
|
|
80
|
+
__promise?: _vitejs_devtools_rpc0.Thenable<_vitejs_devtools_rpc0.RpcFunctionSetupResult<[query: DevToolsAuthInput], Promise<DevToolsAuthReturn>>> | undefined;
|
|
81
|
+
}, {
|
|
82
|
+
name: "devtoolskit:internal:docks:on-launch";
|
|
83
|
+
type?: "action" | undefined;
|
|
84
|
+
cacheable?: boolean;
|
|
85
|
+
args?: undefined;
|
|
86
|
+
returns?: undefined;
|
|
87
|
+
setup?: ((context: _vitejs_devtools_kit0.DevToolsNodeContext) => _vitejs_devtools_rpc0.Thenable<_vitejs_devtools_rpc0.RpcFunctionSetupResult<[entryId: string], Promise<void>>>) | undefined;
|
|
88
|
+
handler?: ((entryId: string) => Promise<void>) | undefined;
|
|
89
|
+
dump?: _vitejs_devtools_rpc0.RpcDump<[entryId: string], Promise<void>, _vitejs_devtools_kit0.DevToolsNodeContext> | undefined;
|
|
90
|
+
__resolved?: _vitejs_devtools_rpc0.RpcFunctionSetupResult<[entryId: string], Promise<void>> | undefined;
|
|
91
|
+
__promise?: _vitejs_devtools_rpc0.Thenable<_vitejs_devtools_rpc0.RpcFunctionSetupResult<[entryId: string], Promise<void>>> | undefined;
|
|
92
|
+
}, {
|
|
93
|
+
name: "devtoolskit:internal:rpc:server:list";
|
|
94
|
+
type?: "static" | undefined;
|
|
95
|
+
cacheable?: boolean;
|
|
96
|
+
args?: undefined;
|
|
97
|
+
returns?: undefined;
|
|
98
|
+
setup?: ((context: _vitejs_devtools_kit0.DevToolsNodeContext) => _vitejs_devtools_rpc0.Thenable<_vitejs_devtools_rpc0.RpcFunctionSetupResult<[], Promise<{
|
|
99
|
+
[k: string]: {
|
|
100
|
+
type: any;
|
|
101
|
+
};
|
|
102
|
+
}>>>) | undefined;
|
|
103
|
+
handler?: (() => Promise<{
|
|
104
|
+
[k: string]: {
|
|
105
|
+
type: any;
|
|
106
|
+
};
|
|
107
|
+
}>) | undefined;
|
|
108
|
+
dump?: _vitejs_devtools_rpc0.RpcDump<[], Promise<{
|
|
109
|
+
[k: string]: {
|
|
110
|
+
type: any;
|
|
111
|
+
};
|
|
112
|
+
}>, _vitejs_devtools_kit0.DevToolsNodeContext> | undefined;
|
|
113
|
+
__resolved?: _vitejs_devtools_rpc0.RpcFunctionSetupResult<[], Promise<{
|
|
114
|
+
[k: string]: {
|
|
115
|
+
type: any;
|
|
116
|
+
};
|
|
117
|
+
}>> | undefined;
|
|
118
|
+
__promise?: _vitejs_devtools_rpc0.Thenable<_vitejs_devtools_rpc0.RpcFunctionSetupResult<[], Promise<{
|
|
119
|
+
[k: string]: {
|
|
120
|
+
type: any;
|
|
121
|
+
};
|
|
122
|
+
}>>> | undefined;
|
|
123
|
+
}, {
|
|
124
|
+
name: "devtoolskit:internal:rpc:server-state:get";
|
|
125
|
+
type?: "query" | undefined;
|
|
126
|
+
cacheable?: boolean;
|
|
127
|
+
args?: undefined;
|
|
128
|
+
returns?: undefined;
|
|
129
|
+
setup?: ((context: _vitejs_devtools_kit0.DevToolsNodeContext) => _vitejs_devtools_rpc0.Thenable<_vitejs_devtools_rpc0.RpcFunctionSetupResult<[key: string], Promise<any>>>) | undefined;
|
|
130
|
+
handler?: ((key: string) => Promise<any>) | undefined;
|
|
131
|
+
dump?: _vitejs_devtools_rpc0.RpcDump<[key: string], Promise<any>, _vitejs_devtools_kit0.DevToolsNodeContext> | undefined;
|
|
132
|
+
__resolved?: _vitejs_devtools_rpc0.RpcFunctionSetupResult<[key: string], Promise<any>> | undefined;
|
|
133
|
+
__promise?: _vitejs_devtools_rpc0.Thenable<_vitejs_devtools_rpc0.RpcFunctionSetupResult<[key: string], Promise<any>>> | undefined;
|
|
134
|
+
}, {
|
|
135
|
+
name: "devtoolskit:internal:rpc:server-state:patch";
|
|
136
|
+
type?: "query" | undefined;
|
|
137
|
+
cacheable?: boolean;
|
|
138
|
+
args?: undefined;
|
|
139
|
+
returns?: undefined;
|
|
140
|
+
setup?: ((context: _vitejs_devtools_kit0.DevToolsNodeContext) => _vitejs_devtools_rpc0.Thenable<_vitejs_devtools_rpc0.RpcFunctionSetupResult<[key: string, patches: SharedStatePatch[], syncId: string], Promise<void>>>) | undefined;
|
|
141
|
+
handler?: ((key: string, patches: SharedStatePatch[], syncId: string) => Promise<void>) | undefined;
|
|
142
|
+
dump?: _vitejs_devtools_rpc0.RpcDump<[key: string, patches: SharedStatePatch[], syncId: string], Promise<void>, _vitejs_devtools_kit0.DevToolsNodeContext> | undefined;
|
|
143
|
+
__resolved?: _vitejs_devtools_rpc0.RpcFunctionSetupResult<[key: string, patches: SharedStatePatch[], syncId: string], Promise<void>> | undefined;
|
|
144
|
+
__promise?: _vitejs_devtools_rpc0.Thenable<_vitejs_devtools_rpc0.RpcFunctionSetupResult<[key: string, patches: SharedStatePatch[], syncId: string], Promise<void>>> | undefined;
|
|
145
|
+
}, {
|
|
146
|
+
name: "devtoolskit:internal:rpc:server-state:set";
|
|
147
|
+
type?: "query" | undefined;
|
|
148
|
+
cacheable?: boolean;
|
|
149
|
+
args?: undefined;
|
|
150
|
+
returns?: undefined;
|
|
151
|
+
setup?: ((context: _vitejs_devtools_kit0.DevToolsNodeContext) => _vitejs_devtools_rpc0.Thenable<_vitejs_devtools_rpc0.RpcFunctionSetupResult<[key: string, value: any, syncId: string], Promise<void>>>) | undefined;
|
|
152
|
+
handler?: ((key: string, value: any, syncId: string) => Promise<void>) | undefined;
|
|
153
|
+
dump?: _vitejs_devtools_rpc0.RpcDump<[key: string, value: any, syncId: string], Promise<void>, _vitejs_devtools_kit0.DevToolsNodeContext> | undefined;
|
|
154
|
+
__resolved?: _vitejs_devtools_rpc0.RpcFunctionSetupResult<[key: string, value: any, syncId: string], Promise<void>> | undefined;
|
|
155
|
+
__promise?: _vitejs_devtools_rpc0.Thenable<_vitejs_devtools_rpc0.RpcFunctionSetupResult<[key: string, value: any, syncId: string], Promise<void>>> | undefined;
|
|
156
|
+
}, {
|
|
157
|
+
name: "devtoolskit:internal:rpc:server-state:subscribe";
|
|
158
|
+
type?: "event" | undefined;
|
|
159
|
+
cacheable?: boolean;
|
|
160
|
+
args?: undefined;
|
|
161
|
+
returns?: undefined;
|
|
162
|
+
setup?: ((context: _vitejs_devtools_kit0.DevToolsNodeContext) => _vitejs_devtools_rpc0.Thenable<_vitejs_devtools_rpc0.RpcFunctionSetupResult<[key: string], Promise<void>>>) | undefined;
|
|
163
|
+
handler?: ((key: string) => Promise<void>) | undefined;
|
|
164
|
+
dump?: _vitejs_devtools_rpc0.RpcDump<[key: string], Promise<void>, _vitejs_devtools_kit0.DevToolsNodeContext> | undefined;
|
|
165
|
+
__resolved?: _vitejs_devtools_rpc0.RpcFunctionSetupResult<[key: string], Promise<void>> | undefined;
|
|
166
|
+
__promise?: _vitejs_devtools_rpc0.Thenable<_vitejs_devtools_rpc0.RpcFunctionSetupResult<[key: string], Promise<void>>> | undefined;
|
|
167
|
+
}, {
|
|
168
|
+
name: "devtoolskit:internal:terminals:list";
|
|
169
|
+
type?: "static" | undefined;
|
|
170
|
+
cacheable?: boolean;
|
|
171
|
+
args?: undefined;
|
|
172
|
+
returns?: undefined;
|
|
173
|
+
setup?: ((context: _vitejs_devtools_kit0.DevToolsNodeContext) => _vitejs_devtools_rpc0.Thenable<_vitejs_devtools_rpc0.RpcFunctionSetupResult<[], Promise<_vitejs_devtools_kit0.DevToolsTerminalSessionBase[]>>>) | undefined;
|
|
174
|
+
handler?: (() => Promise<_vitejs_devtools_kit0.DevToolsTerminalSessionBase[]>) | undefined;
|
|
175
|
+
dump?: _vitejs_devtools_rpc0.RpcDump<[], Promise<_vitejs_devtools_kit0.DevToolsTerminalSessionBase[]>, _vitejs_devtools_kit0.DevToolsNodeContext> | undefined;
|
|
176
|
+
__resolved?: _vitejs_devtools_rpc0.RpcFunctionSetupResult<[], Promise<_vitejs_devtools_kit0.DevToolsTerminalSessionBase[]>> | undefined;
|
|
177
|
+
__promise?: _vitejs_devtools_rpc0.Thenable<_vitejs_devtools_rpc0.RpcFunctionSetupResult<[], Promise<_vitejs_devtools_kit0.DevToolsTerminalSessionBase[]>>> | undefined;
|
|
178
|
+
}, {
|
|
179
|
+
name: "devtoolskit:internal:terminals:read";
|
|
180
|
+
type?: "query" | undefined;
|
|
181
|
+
cacheable?: boolean;
|
|
182
|
+
args?: undefined;
|
|
183
|
+
returns?: undefined;
|
|
184
|
+
setup?: ((context: _vitejs_devtools_kit0.DevToolsNodeContext) => _vitejs_devtools_rpc0.Thenable<_vitejs_devtools_rpc0.RpcFunctionSetupResult<[id: string], Promise<{
|
|
185
|
+
buffer: string[];
|
|
186
|
+
ts: number;
|
|
187
|
+
}>>>) | undefined;
|
|
188
|
+
handler?: ((id: string) => Promise<{
|
|
189
|
+
buffer: string[];
|
|
190
|
+
ts: number;
|
|
191
|
+
}>) | undefined;
|
|
192
|
+
dump?: _vitejs_devtools_rpc0.RpcDump<[id: string], Promise<{
|
|
193
|
+
buffer: string[];
|
|
194
|
+
ts: number;
|
|
195
|
+
}>, _vitejs_devtools_kit0.DevToolsNodeContext> | undefined;
|
|
196
|
+
__resolved?: _vitejs_devtools_rpc0.RpcFunctionSetupResult<[id: string], Promise<{
|
|
197
|
+
buffer: string[];
|
|
198
|
+
ts: number;
|
|
199
|
+
}>> | undefined;
|
|
200
|
+
__promise?: _vitejs_devtools_rpc0.Thenable<_vitejs_devtools_rpc0.RpcFunctionSetupResult<[id: string], Promise<{
|
|
201
|
+
buffer: string[];
|
|
202
|
+
ts: number;
|
|
203
|
+
}>>> | undefined;
|
|
204
|
+
}];
|
|
205
|
+
type BuiltinServerFunctions = RpcDefinitionsToFunctions<typeof builtinRpcDeclarations>;
|
|
206
|
+
declare module '@vitejs/devtools-kit' {
|
|
207
|
+
interface DevToolsRpcServerFunctions extends BuiltinServerFunctions {}
|
|
208
|
+
interface DevToolsRpcClientFunctions {
|
|
209
|
+
'devtoolskit:internal:rpc:client-state:patch': (key: string, patches: SharedStatePatch[], syncId: string) => Promise<void>;
|
|
210
|
+
'devtoolskit:internal:rpc:client-state:updated': (key: string, fullState: any, syncId: string) => Promise<void>;
|
|
211
|
+
'devtoolskit:internal:terminals:stream-chunk': (data: DevToolsTerminalSessionStreamChunkEvent) => Promise<void>;
|
|
212
|
+
'devtoolskit:internal:terminals:updated': () => Promise<void>;
|
|
213
|
+
}
|
|
214
|
+
interface DevToolsRpcSharedStates {
|
|
215
|
+
'devtoolskit:internal:docks': DevToolsDockEntry[];
|
|
216
|
+
'devtoolskit:internal:user-settings': DevToolsDocksUserSettings;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
//#endregion
|
|
10
220
|
//#region src/node/plugins/index.d.ts
|
|
11
221
|
interface DevToolsOptions {
|
|
12
222
|
/**
|
|
@@ -16,21 +226,23 @@ interface DevToolsOptions {
|
|
|
16
226
|
*/
|
|
17
227
|
builtinDevTools?: boolean;
|
|
18
228
|
}
|
|
19
|
-
declare function DevTools(options?: DevToolsOptions): Plugin[]
|
|
229
|
+
declare function DevTools(options?: DevToolsOptions): Promise<Plugin[]>;
|
|
20
230
|
//#endregion
|
|
21
231
|
//#region src/node/ws.d.ts
|
|
22
232
|
interface CreateWsServerOptions {
|
|
23
233
|
cwd: string;
|
|
24
234
|
portWebSocket?: number;
|
|
235
|
+
hostWebSocket: string;
|
|
25
236
|
base?: string;
|
|
26
237
|
context: DevToolsNodeContext;
|
|
27
238
|
}
|
|
28
239
|
//#endregion
|
|
29
240
|
//#region src/node/server.d.ts
|
|
30
241
|
declare function createDevToolsMiddleware(options: CreateWsServerOptions): Promise<{
|
|
31
|
-
h3:
|
|
32
|
-
|
|
33
|
-
|
|
242
|
+
h3: h3.App;
|
|
243
|
+
rpc: birpc.BirpcGroup<_vitejs_devtools_kit0.DevToolsRpcClientFunctions, _vitejs_devtools_kit0.DevToolsRpcServerFunctions, false>;
|
|
244
|
+
middleware: h3.NodeListener;
|
|
245
|
+
getConnectionMeta: () => Promise<_vitejs_devtools_kit0.ConnectionMeta>;
|
|
34
246
|
}>;
|
|
35
247
|
//#endregion
|
|
36
|
-
export { DevTools, createDevToolsContext, createDevToolsMiddleware };
|
|
248
|
+
export { DevTools, DevToolsConfig, ResolvedDevToolsConfig, createDevToolsContext, createDevToolsMiddleware, normalizeDevToolsConfig };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./dirs-B7dOX6eI.js";
|
|
1
|
+
import { a as createDevToolsContext, n as createDevToolsMiddleware, t as DevTools } from "./plugins-BbzqUdpu.js";
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
//#region src/node/utils.ts
|
|
4
|
+
function isObject(value) {
|
|
5
|
+
return Object.prototype.toString.call(value) === "[object Object]";
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/node/config.ts
|
|
10
|
+
function normalizeDevToolsConfig(config, host) {
|
|
11
|
+
return {
|
|
12
|
+
enabled: config === true || !!(config && config.enabled),
|
|
13
|
+
config: {
|
|
14
|
+
...isObject(config) ? config : {},
|
|
15
|
+
clientAuth: isObject(config) ? config.clientAuth ?? true : true,
|
|
16
|
+
host: isObject(config) ? config.host ?? host : host
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { DevTools, createDevToolsContext, createDevToolsMiddleware, normalizeDevToolsConfig };
|