@vitejs/devtools-kit 0.0.0-alpha.22 → 0.0.0-alpha.23
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/client.d.mts +2 -2
- package/dist/client.mjs +36 -22
- package/dist/{index-mqRYU7D7.d.mts → index-Pzr9xl88.d.mts} +7 -4
- package/dist/index.d.mts +2 -2
- package/dist/{shared-state-BLTtoMWB.d.mts → shared-state-7JDpUVVs.d.mts} +1 -1
- package/dist/{shared-state-Bi50d6nv.mjs → shared-state-BAC6HwFS.mjs} +1 -1
- package/dist/utils/shared-state.d.mts +1 -1
- package/dist/utils/shared-state.mjs +1 -1
- package/package.json +5 -5
package/dist/client.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as DockEntryState, c as DocksContext, d as RpcClientEvents, f as DevToolsRpcClient, i as DockClientType, l as DocksEntriesContext, m as getDevToolsRpcClient, n as DevToolsClientContext, o as DockEntryStateEvents, p as DevToolsRpcClientOptions, r as DevToolsClientRpcHost, s as DockPanelStorage, t as DockClientScriptContext, u as DocksPanelContext } from "./index-
|
|
2
|
-
import "./shared-state-
|
|
1
|
+
import { a as DockEntryState, c as DocksContext, d as RpcClientEvents, f as DevToolsRpcClient, i as DockClientType, l as DocksEntriesContext, m as getDevToolsRpcClient, n as DevToolsClientContext, o as DockEntryStateEvents, p as DevToolsRpcClientOptions, r as DevToolsClientRpcHost, s as DockPanelStorage, t as DockClientScriptContext, u as DocksPanelContext } from "./index-Pzr9xl88.mjs";
|
|
2
|
+
import "./shared-state-7JDpUVVs.mjs";
|
|
3
3
|
export { DevToolsClientContext, DevToolsClientRpcHost, DevToolsRpcClient, DevToolsRpcClientOptions, DockClientScriptContext, DockClientType, DockEntryState, DockEntryStateEvents, DockPanelStorage, DocksContext, DocksEntriesContext, DocksPanelContext, RpcClientEvents, getDevToolsRpcClient };
|
package/dist/client.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as createEventEmitter } from "./events-CWYZG96x.mjs";
|
|
2
2
|
import { t as nanoid } from "./nanoid-B0pJU5uW.mjs";
|
|
3
|
-
import { t as createSharedState } from "./shared-state-
|
|
3
|
+
import { t as createSharedState } from "./shared-state-BAC6HwFS.mjs";
|
|
4
4
|
import { RpcFunctionsCollectorBase } from "birpc-x";
|
|
5
5
|
import { createRpcClient } from "@vitejs/devtools-rpc";
|
|
6
6
|
import { createWsRpcPreset } from "@vitejs/devtools-rpc/presets/ws/client";
|
|
@@ -1111,19 +1111,19 @@ function createRpcSharedStateClientHost(rpc) {
|
|
|
1111
1111
|
rpc.client.register({
|
|
1112
1112
|
name: "vite:internal:rpc:client-state:updated",
|
|
1113
1113
|
type: "event",
|
|
1114
|
-
handler:
|
|
1114
|
+
handler: (key, fullState, syncId) => {
|
|
1115
1115
|
const state = sharedState.get(key);
|
|
1116
1116
|
if (!state || state.syncIds.has(syncId)) return;
|
|
1117
|
-
|
|
1118
|
-
state.mutate(() => newState, syncId);
|
|
1117
|
+
state.mutate(() => fullState, syncId);
|
|
1119
1118
|
}
|
|
1120
1119
|
});
|
|
1121
1120
|
rpc.client.register({
|
|
1122
1121
|
name: "vite:internal:rpc:client-state:patch",
|
|
1123
1122
|
type: "event",
|
|
1124
|
-
handler:
|
|
1123
|
+
handler: (key, patches, syncId) => {
|
|
1125
1124
|
const state = sharedState.get(key);
|
|
1126
|
-
if (state
|
|
1125
|
+
if (!state || state.syncIds.has(syncId)) return;
|
|
1126
|
+
state.patch(patches, syncId);
|
|
1127
1127
|
}
|
|
1128
1128
|
});
|
|
1129
1129
|
function registerSharedState(key, state) {
|
|
@@ -1138,23 +1138,37 @@ function createRpcSharedStateClientHost(rpc) {
|
|
|
1138
1138
|
}
|
|
1139
1139
|
return { get: async (key, options) => {
|
|
1140
1140
|
if (sharedState.has(key)) return sharedState.get(key);
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1141
|
+
const state = createSharedState({
|
|
1142
|
+
initialValue: options?.initialValue,
|
|
1143
|
+
enablePatches: false
|
|
1144
|
+
});
|
|
1145
|
+
async function initSharedState() {
|
|
1146
|
+
rpc.callEvent("vite:internal:rpc:server-state:subscribe", key);
|
|
1147
|
+
if (options?.initialValue !== void 0) {
|
|
1148
|
+
sharedState.set(key, state);
|
|
1149
|
+
rpc.call("vite:internal:rpc:server-state:get", key).then((serverState) => {
|
|
1150
|
+
state.mutate(() => serverState);
|
|
1151
|
+
}).catch((error) => {
|
|
1152
|
+
console.error("Error getting server state", error);
|
|
1153
|
+
});
|
|
1154
|
+
registerSharedState(key, state);
|
|
1155
|
+
return state;
|
|
1156
|
+
} else {
|
|
1157
|
+
const initialValue = await rpc.call("vite:internal:rpc:server-state:get", key);
|
|
1158
|
+
state.mutate(() => initialValue);
|
|
1159
|
+
sharedState.set(key, state);
|
|
1160
|
+
registerSharedState(key, state);
|
|
1161
|
+
return state;
|
|
1162
|
+
}
|
|
1157
1163
|
}
|
|
1164
|
+
return new Promise((resolve) => {
|
|
1165
|
+
if (!rpc.isTrusted) {
|
|
1166
|
+
resolve(state);
|
|
1167
|
+
rpc.events.on("rpc:is-trusted:updated", (isTrusted) => {
|
|
1168
|
+
if (isTrusted) initSharedState();
|
|
1169
|
+
});
|
|
1170
|
+
} else initSharedState().then(resolve);
|
|
1171
|
+
});
|
|
1158
1172
|
} };
|
|
1159
1173
|
}
|
|
1160
1174
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as EventEmitter } from "./events-ChUECkY3.mjs";
|
|
2
|
-
import { o as SharedState } from "./shared-state-
|
|
2
|
+
import { o as SharedState } from "./shared-state-7JDpUVVs.mjs";
|
|
3
3
|
import { RpcDefinitionsFilter, RpcDefinitionsToFunctions, RpcFunctionsCollector, RpcFunctionsCollectorBase } from "birpc-x";
|
|
4
4
|
import { Raw } from "vue";
|
|
5
5
|
import { BirpcOptions, BirpcReturn } from "birpc";
|
|
@@ -17,9 +17,11 @@ interface DevToolsDockHost {
|
|
|
17
17
|
update: (patch: Partial<T>) => void;
|
|
18
18
|
};
|
|
19
19
|
update: (entry: DevToolsDockUserEntry) => void;
|
|
20
|
-
values: (
|
|
20
|
+
values: (options?: {
|
|
21
|
+
includeBuiltin?: boolean;
|
|
22
|
+
}) => DevToolsDockEntry[];
|
|
21
23
|
}
|
|
22
|
-
type DevToolsDockEntryCategory = 'app' | 'framework' | 'web' | 'advanced' | 'default';
|
|
24
|
+
type DevToolsDockEntryCategory = 'app' | 'framework' | 'web' | 'advanced' | 'default' | 'builtin';
|
|
23
25
|
type DevToolsDockEntryIcon = string | {
|
|
24
26
|
light: string;
|
|
25
27
|
dark: string;
|
|
@@ -95,7 +97,7 @@ interface DevToolsViewCustomRender extends DevToolsDockEntryBase {
|
|
|
95
97
|
}
|
|
96
98
|
interface DevToolsViewBuiltin extends DevToolsDockEntryBase {
|
|
97
99
|
type: '~builtin';
|
|
98
|
-
id: '~terminals' | '~logs' | '~client-auth-notice';
|
|
100
|
+
id: '~terminals' | '~logs' | '~client-auth-notice' | '~settings';
|
|
99
101
|
}
|
|
100
102
|
type DevToolsDockUserEntry = DevToolsViewIframe | DevToolsViewAction | DevToolsViewCustomRender | DevToolsViewLauncher;
|
|
101
103
|
type DevToolsDockEntry = DevToolsDockUserEntry | DevToolsViewBuiltin;
|
|
@@ -106,6 +108,7 @@ interface DevToolsNodeRpcSessionMeta {
|
|
|
106
108
|
ws?: WebSocket;
|
|
107
109
|
clientAuthId?: string;
|
|
108
110
|
isTrusted?: boolean;
|
|
111
|
+
subscribedStates: Set<string>;
|
|
109
112
|
}
|
|
110
113
|
//#endregion
|
|
111
114
|
//#region src/types/rpc-augments.d.ts
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as EventUnsubscribe, r as EventsMap, t as EventEmitter } from "./events-ChUECkY3.mjs";
|
|
2
|
-
import { $ as DevToolsViewCustomRender, A as DevToolsNodeUtils, B as DevToolsRpcClientFunctions, C as RpcBroadcastOptions, D as ConnectionMeta, E as RpcSharedStateHost, F as DevToolsTerminalHost, G as DevToolsDockEntry, H as DevToolsRpcSharedStates, I as DevToolsTerminalSession, J as DevToolsDockEntryIcon, K as DevToolsDockEntryBase, L as DevToolsTerminalSessionBase, M as DevToolsViewHost, N as DevToolsChildProcessExecuteOptions, O as DevToolsCapabilities, P as DevToolsChildProcessTerminalSession, Q as DevToolsViewBuiltin, R as DevToolsTerminalSessionStreamChunkEvent, S as DevToolsNodeRpcSession, T as RpcSharedStateGetOptions, U as DevToolsNodeRpcSessionMeta, V as DevToolsRpcServerFunctions, W as ClientScriptEntry, X as DevToolsDockUserEntry, Y as DevToolsDockHost, Z as DevToolsViewAction, _ as PluginWithDevTools, b as PartialWithoutId, et as DevToolsViewIframe, g as RpcDefinitionsToFunctions, h as RpcDefinitionsFilter, j as DevToolsPluginOptions, k as DevToolsNodeContext, nt as DevToolsViewLauncherStatus, q as DevToolsDockEntryCategory, tt as DevToolsViewLauncher, v as ViteConfigDevtoolsOptions, w as RpcFunctionsHost, x as Thenable, y as EntriesToObject, z as DevToolsTerminalStatus } from "./index-
|
|
3
|
-
import "./shared-state-
|
|
2
|
+
import { $ as DevToolsViewCustomRender, A as DevToolsNodeUtils, B as DevToolsRpcClientFunctions, C as RpcBroadcastOptions, D as ConnectionMeta, E as RpcSharedStateHost, F as DevToolsTerminalHost, G as DevToolsDockEntry, H as DevToolsRpcSharedStates, I as DevToolsTerminalSession, J as DevToolsDockEntryIcon, K as DevToolsDockEntryBase, L as DevToolsTerminalSessionBase, M as DevToolsViewHost, N as DevToolsChildProcessExecuteOptions, O as DevToolsCapabilities, P as DevToolsChildProcessTerminalSession, Q as DevToolsViewBuiltin, R as DevToolsTerminalSessionStreamChunkEvent, S as DevToolsNodeRpcSession, T as RpcSharedStateGetOptions, U as DevToolsNodeRpcSessionMeta, V as DevToolsRpcServerFunctions, W as ClientScriptEntry, X as DevToolsDockUserEntry, Y as DevToolsDockHost, Z as DevToolsViewAction, _ as PluginWithDevTools, b as PartialWithoutId, et as DevToolsViewIframe, g as RpcDefinitionsToFunctions, h as RpcDefinitionsFilter, j as DevToolsPluginOptions, k as DevToolsNodeContext, nt as DevToolsViewLauncherStatus, q as DevToolsDockEntryCategory, tt as DevToolsViewLauncher, v as ViteConfigDevtoolsOptions, w as RpcFunctionsHost, x as Thenable, y as EntriesToObject, z as DevToolsTerminalStatus } from "./index-Pzr9xl88.mjs";
|
|
3
|
+
import "./shared-state-7JDpUVVs.mjs";
|
|
4
4
|
import * as birpc_x0 from "birpc-x";
|
|
5
5
|
|
|
6
6
|
//#region src/utils/define.d.ts
|
|
@@ -6,7 +6,7 @@ import { applyPatches, enablePatches, produce, produceWithPatches } from "immer"
|
|
|
6
6
|
function createSharedState(options) {
|
|
7
7
|
const { enablePatches: enablePatches$1 = false } = options;
|
|
8
8
|
const events = createEventEmitter();
|
|
9
|
-
let state = options.
|
|
9
|
+
let state = options.initialValue;
|
|
10
10
|
const syncIds = /* @__PURE__ */ new Set();
|
|
11
11
|
return {
|
|
12
12
|
on: events.on,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as ImmutableSet, c as SharedStateOptions, i as ImmutableObject, l as SharedStatePatch, n as ImmutableArray, o as SharedState, r as ImmutableMap, s as SharedStateEvents, t as Immutable, u as createSharedState } from "../shared-state-
|
|
1
|
+
import { a as ImmutableSet, c as SharedStateOptions, i as ImmutableObject, l as SharedStatePatch, n as ImmutableArray, o as SharedState, r as ImmutableMap, s as SharedStateEvents, t as Immutable, u as createSharedState } from "../shared-state-7JDpUVVs.mjs";
|
|
2
2
|
export { Immutable, ImmutableArray, ImmutableMap, ImmutableObject, ImmutableSet, SharedState, SharedStateEvents, SharedStateOptions, SharedStatePatch, createSharedState };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitejs/devtools-kit",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-alpha.
|
|
4
|
+
"version": "0.0.0-alpha.23",
|
|
5
5
|
"description": "Vite DevTools Kit",
|
|
6
6
|
"author": "VoidZero Inc.",
|
|
7
7
|
"license": "MIT",
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"birpc": "^4.0.0",
|
|
40
40
|
"birpc-x": "0.0.6",
|
|
41
|
-
"immer": "^11.1.
|
|
42
|
-
"@vitejs/devtools-rpc": "0.0.0-alpha.
|
|
41
|
+
"immer": "^11.1.3",
|
|
42
|
+
"@vitejs/devtools-rpc": "0.0.0-alpha.23"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"my-ua-parser": "^2.0.4",
|
|
46
|
-
"tsdown": "^0.18.
|
|
47
|
-
"vite": "^8.0.0-beta.
|
|
46
|
+
"tsdown": "^0.18.4",
|
|
47
|
+
"vite": "^8.0.0-beta.5"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "tsdown",
|