@dimina-kit/devtools 0.4.0-dev.20260907055341 → 0.5.0-dev.20260908120530
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/README.md +1 -1
- package/dist/main/app/window-runtime-services.d.ts +12 -12
- package/dist/main/app/window-runtime-services.js +34 -15
- package/dist/main/index.bundle.js +6307 -6050
- package/dist/main/services/elements-forward/index.d.ts +2 -2
- package/dist/main/services/elements-forward/index.js +6 -6
- package/dist/main/services/network-forward/body-cache.d.ts +2 -0
- package/dist/main/services/network-forward/body-cache.js +4 -0
- package/dist/main/services/network-forward/global-body-gate.d.ts +1 -1
- package/dist/main/services/network-forward/global-body-gate.js +4 -4
- package/dist/main/services/network-forward/http.d.ts +47 -0
- package/dist/main/services/network-forward/http.js +162 -0
- package/dist/main/services/network-forward/index.d.ts +19 -13
- package/dist/main/services/network-forward/index.js +220 -134
- package/dist/main/services/network-forward/request-ids.d.ts +5 -0
- package/dist/main/services/network-forward/request-ids.js +5 -0
- package/dist/main/services/safe-area/index.d.ts +7 -9
- package/dist/main/services/safe-area/index.js +7 -14
- package/dist/main/services/views/native-simulator-view.js +7 -8
- package/dist/main/services/workbench-context.d.ts +3 -3
- package/dist/main/services/workbench-context.js +7 -1
- package/dist/native-host/render/render.js +525 -482
- package/dist/native-host/service/service.js +2 -2
- package/dist/preload/shared/api-compat.js +63 -41
- package/dist/preload/windows/main.cjs +15 -1
- package/dist/preload/windows/main.cjs.map +2 -2
- package/dist/preload/windows/simulator.cjs +55 -134
- package/dist/preload/windows/simulator.cjs.map +4 -4
- package/dist/preload/windows/simulator.js +55 -134
- package/dist/renderer/assets/workbench-C0Jkdlps.js +5 -0
- package/dist/renderer/entries/workbench/index.html +1 -1
- package/dist/shared/types.d.ts +2 -0
- package/dist/simulator/assets/device-shell-DucLepkm.js +431 -0
- package/dist/simulator/assets/simulator-B4rbcOVt.js +10 -0
- package/dist/simulator/assets/simulator-ui-i3GCc7YJ.js +2 -0
- package/dist/simulator/simulator.html +2 -2
- package/package.json +12 -12
- package/dist/renderer/assets/workbench-BLJ0wKsg.js +0 -5
- package/dist/shared/request-core.d.ts +0 -2
- package/dist/shared/request-core.js +0 -2
- package/dist/simulator/assets/device-shell-pxnZZp10.js +0 -431
- package/dist/simulator/assets/simulator-Dwp7lnvu.js +0 -10
- package/dist/simulator/assets/simulator-ui-B2ddJB1R.js +0 -2
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Dimina DevTools 是调试 [Dimina](https://github.com/didi/dimina) 小程序的
|
|
|
6
6
|
|
|
7
7
|
## 获取和运行
|
|
8
8
|
|
|
9
|
-
直接使用桌面应用,可以从项目的 [Releases](https://github.com/EchoTechFE/dimina-kit/releases) 下载已发布的桌面构建。要从源码运行,请先按[仓库根 README](../../README.md
|
|
9
|
+
直接使用桌面应用,可以从项目的 [Releases](https://github.com/EchoTechFE/dimina-kit/releases) 下载已发布的桌面构建。要从源码运行,请先按[仓库根 README](../../README.md#从源码启动)准备仓库,然后执行:
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
12
|
pnpm --filter @dimina-kit/devtools build
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { BrowserWindow } from
|
|
2
|
-
import type { ConnectionRegistry, DisposableRegistry } from
|
|
3
|
-
import type { SyncStorageChange } from
|
|
4
|
-
import type { SenderPolicy } from
|
|
5
|
-
import type { BridgeRouterHandle } from
|
|
6
|
-
import type { CdpSessionBroker } from
|
|
7
|
-
import type { InternalDevtoolsWindow } from
|
|
8
|
-
import type { NetworkForwarder } from
|
|
9
|
-
import type { AppDataTap } from
|
|
10
|
-
import type { StorageApi } from
|
|
11
|
-
import type { WorkspaceService } from
|
|
1
|
+
import type { BrowserWindow } from "electron";
|
|
2
|
+
import type { ConnectionRegistry, DisposableRegistry } from "@dimina-kit/electron-deck/main";
|
|
3
|
+
import type { SyncStorageChange } from "../../shared/ipc-channels.js";
|
|
4
|
+
import type { SenderPolicy } from "../utils/ipc-registry.js";
|
|
5
|
+
import type { BridgeRouterHandle } from "../ipc/bridge-router.js";
|
|
6
|
+
import type { CdpSessionBroker } from "../services/cdp-session/index.js";
|
|
7
|
+
import type { InternalDevtoolsWindow } from "../windows/internal-devtools-window/index.js";
|
|
8
|
+
import type { NetworkForwarder } from "../services/network-forward/index.js";
|
|
9
|
+
import type { AppDataTap } from "../services/simulator-appdata/index.js";
|
|
10
|
+
import type { StorageApi } from "../services/simulator-storage/index.js";
|
|
11
|
+
import type { WorkspaceService } from "../services/workspace/workspace-service.js";
|
|
12
12
|
/**
|
|
13
13
|
* Narrow view of the context fields these services read, plus the four fields
|
|
14
14
|
* they publish back onto it for bridge-router to consume.
|
|
@@ -31,7 +31,7 @@ export interface WindowRuntimeContext {
|
|
|
31
31
|
* native-host WXML/element-inspect services (which scope the active render
|
|
32
32
|
* guest by appId) and the editor's per-project workspace identity.
|
|
33
33
|
*/
|
|
34
|
-
export declare function createActiveAppIdResolver(context: Pick<WindowRuntimeContext,
|
|
34
|
+
export declare function createActiveAppIdResolver(context: Pick<WindowRuntimeContext, "workspace">): () => string | null;
|
|
35
35
|
/**
|
|
36
36
|
* Panel-backing services that push into one window's renderer: storage, and
|
|
37
37
|
* under native-host the MCP target tracking plus the WXML / AppData /
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { resolveNativeAppDataKeys, resolveNativeStorageOverview } from
|
|
2
|
-
import { registerMcpWindow, noteActiveBridgeId } from
|
|
3
|
-
import { createRenderInspector } from
|
|
4
|
-
import { setupSimulatorStorage } from
|
|
5
|
-
import { createNetworkForwarder } from
|
|
6
|
-
import { setupSimulatorWxml } from
|
|
7
|
-
import { setupSimulatorAppData } from
|
|
8
|
-
import { setupSimulatorCurrentPage } from
|
|
9
|
-
import { toDisposable } from
|
|
1
|
+
import { resolveNativeAppDataKeys, resolveNativeStorageOverview, } from "./native-overview.js";
|
|
2
|
+
import { registerMcpWindow, noteActiveBridgeId, } from "../services/mcp/index.js";
|
|
3
|
+
import { createRenderInspector } from "../services/render-inspect/index.js";
|
|
4
|
+
import { setupSimulatorStorage } from "../services/simulator-storage/index.js";
|
|
5
|
+
import { createNetworkForwarder } from "../services/network-forward/index.js";
|
|
6
|
+
import { setupSimulatorWxml } from "../services/simulator-wxml/index.js";
|
|
7
|
+
import { setupSimulatorAppData } from "../services/simulator-appdata/index.js";
|
|
8
|
+
import { setupSimulatorCurrentPage } from "../services/simulator-current-page/index.js";
|
|
9
|
+
import { toDisposable } from "@dimina-kit/electron-deck/main";
|
|
10
10
|
/**
|
|
11
11
|
* Resolve the active project's appId. Shared by the storage panel filter, the
|
|
12
12
|
* native-host WXML/element-inspect services (which scope the active render
|
|
@@ -70,7 +70,10 @@ export function setupWindowRuntimeServices(context, mainWindow, getActiveAppId,
|
|
|
70
70
|
// Native-host inspector: injects the render-guest IIFE and drives WXML /
|
|
71
71
|
// element-highlight against the active render-host <webview>. Reused by
|
|
72
72
|
// the storage panel (element inspect) and the WXML panel service.
|
|
73
|
-
const renderInspector = createRenderInspector({
|
|
73
|
+
const renderInspector = createRenderInspector({
|
|
74
|
+
connections: context.connections,
|
|
75
|
+
broker: context.cdpSessionBroker,
|
|
76
|
+
});
|
|
74
77
|
const storage = setupSimulatorStorage(mainWindow.webContents, {
|
|
75
78
|
senderPolicy: context.senderPolicy,
|
|
76
79
|
connections: context.connections,
|
|
@@ -96,12 +99,16 @@ export function setupWindowRuntimeServices(context, mainWindow, getActiveAppId,
|
|
|
96
99
|
// routes async wx.setStorage/etc. to the unified service-host store.
|
|
97
100
|
if (storage.storageApi) {
|
|
98
101
|
context.storageApi = storage.storageApi;
|
|
99
|
-
context.registry.add(() => {
|
|
102
|
+
context.registry.add(() => {
|
|
103
|
+
context.storageApi = undefined;
|
|
104
|
+
});
|
|
100
105
|
// SYNC wx storage writes bypass main (they hit the service-host localStorage
|
|
101
106
|
// directly); the service-host posts `storageChanged` and bridge-router routes
|
|
102
107
|
// it here so the Storage panel stays live without a manual reload.
|
|
103
108
|
context.onServiceStorageChanged = storage.onSyncStorageChange;
|
|
104
|
-
context.registry.add(() => {
|
|
109
|
+
context.registry.add(() => {
|
|
110
|
+
context.onServiceStorageChanged = undefined;
|
|
111
|
+
});
|
|
105
112
|
}
|
|
106
113
|
// Native-host WXML + AppData panels: main sources the data (WXML pulled
|
|
107
114
|
// from the active render guest; AppData tapped from the service→render
|
|
@@ -127,14 +134,16 @@ export function setupWindowRuntimeServices(context, mainWindow, getActiveAppId,
|
|
|
127
134
|
// project is open.
|
|
128
135
|
getSimulatorServerBaseUrl: () => {
|
|
129
136
|
const port = context.workspace?.getSession()?.port;
|
|
130
|
-
return typeof port ===
|
|
137
|
+
return typeof port === "number" ? `http://localhost:${port}/` : null;
|
|
131
138
|
},
|
|
132
139
|
connections: context.connections,
|
|
133
140
|
broker: context.cdpSessionBroker,
|
|
134
141
|
});
|
|
135
142
|
context.networkForward = networkForward;
|
|
136
143
|
context.registry.add(networkForward);
|
|
137
|
-
context.registry.add(() => {
|
|
144
|
+
context.registry.add(() => {
|
|
145
|
+
context.networkForward = undefined;
|
|
146
|
+
});
|
|
138
147
|
// Global mirror: once the standalone internal
|
|
139
148
|
// DevTools window builds its own front-end host, mirror the full
|
|
140
149
|
// unfiltered Network stream into it. Attached AFTER context.networkForward
|
|
@@ -150,6 +159,14 @@ export function setupWindowRuntimeServices(context, mainWindow, getActiveAppId,
|
|
|
150
159
|
context.registry.add(toDisposable(context.bridge?.onNativeWebSocketTrace?.((ownerId, event) => {
|
|
151
160
|
context.networkForward?.reportWebSocketTrace(ownerId, event);
|
|
152
161
|
}) ?? (() => { })));
|
|
162
|
+
// Main-process HTTP traffic (wx.request runs on Node http/https,
|
|
163
|
+
// invisible to any webContents debugger — that's the whole point of the
|
|
164
|
+
// migration off renderer `fetch()`, since Chromium's Fetch/CORS algorithm
|
|
165
|
+
// was attaching a spurious OPTIONS preflight to it): same trace-stream
|
|
166
|
+
// fan-out as the WebSocket case above.
|
|
167
|
+
context.registry.add(toDisposable(context.bridge?.onNativeRequestTrace?.((ownerId, event) => {
|
|
168
|
+
context.networkForward?.reportNativeRequestTrace(ownerId, event);
|
|
169
|
+
}) ?? (() => { })));
|
|
153
170
|
context.registry.add(setupSimulatorWxml(mainWindow.webContents, {
|
|
154
171
|
senderPolicy: context.senderPolicy,
|
|
155
172
|
bridge: context.bridge,
|
|
@@ -166,7 +183,9 @@ export function setupWindowRuntimeServices(context, mainWindow, getActiveAppId,
|
|
|
166
183
|
// bridge-router feeds this via ctx.appData (service→render tap + evict).
|
|
167
184
|
context.appData = appDataService;
|
|
168
185
|
context.registry.add(appDataService);
|
|
169
|
-
context.registry.add(() => {
|
|
186
|
+
context.registry.add(() => {
|
|
187
|
+
context.appData = undefined;
|
|
188
|
+
});
|
|
170
189
|
// Push the visible page route to the toolbar on every navigation (the
|
|
171
190
|
// page stack lives in the DeviceShell WCV, invisible to renderer
|
|
172
191
|
// <webview> nav events).
|