@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.
Files changed (43) hide show
  1. package/README.md +1 -1
  2. package/dist/main/app/window-runtime-services.d.ts +12 -12
  3. package/dist/main/app/window-runtime-services.js +34 -15
  4. package/dist/main/index.bundle.js +6307 -6050
  5. package/dist/main/services/elements-forward/index.d.ts +2 -2
  6. package/dist/main/services/elements-forward/index.js +6 -6
  7. package/dist/main/services/network-forward/body-cache.d.ts +2 -0
  8. package/dist/main/services/network-forward/body-cache.js +4 -0
  9. package/dist/main/services/network-forward/global-body-gate.d.ts +1 -1
  10. package/dist/main/services/network-forward/global-body-gate.js +4 -4
  11. package/dist/main/services/network-forward/http.d.ts +47 -0
  12. package/dist/main/services/network-forward/http.js +162 -0
  13. package/dist/main/services/network-forward/index.d.ts +19 -13
  14. package/dist/main/services/network-forward/index.js +220 -134
  15. package/dist/main/services/network-forward/request-ids.d.ts +5 -0
  16. package/dist/main/services/network-forward/request-ids.js +5 -0
  17. package/dist/main/services/safe-area/index.d.ts +7 -9
  18. package/dist/main/services/safe-area/index.js +7 -14
  19. package/dist/main/services/views/native-simulator-view.js +7 -8
  20. package/dist/main/services/workbench-context.d.ts +3 -3
  21. package/dist/main/services/workbench-context.js +7 -1
  22. package/dist/native-host/render/render.js +525 -482
  23. package/dist/native-host/service/service.js +2 -2
  24. package/dist/preload/shared/api-compat.js +63 -41
  25. package/dist/preload/windows/main.cjs +15 -1
  26. package/dist/preload/windows/main.cjs.map +2 -2
  27. package/dist/preload/windows/simulator.cjs +55 -134
  28. package/dist/preload/windows/simulator.cjs.map +4 -4
  29. package/dist/preload/windows/simulator.js +55 -134
  30. package/dist/renderer/assets/workbench-C0Jkdlps.js +5 -0
  31. package/dist/renderer/entries/workbench/index.html +1 -1
  32. package/dist/shared/types.d.ts +2 -0
  33. package/dist/simulator/assets/device-shell-DucLepkm.js +431 -0
  34. package/dist/simulator/assets/simulator-B4rbcOVt.js +10 -0
  35. package/dist/simulator/assets/simulator-ui-i3GCc7YJ.js +2 -0
  36. package/dist/simulator/simulator.html +2 -2
  37. package/package.json +12 -12
  38. package/dist/renderer/assets/workbench-BLJ0wKsg.js +0 -5
  39. package/dist/shared/request-core.d.ts +0 -2
  40. package/dist/shared/request-core.js +0 -2
  41. package/dist/simulator/assets/device-shell-pxnZZp10.js +0 -431
  42. package/dist/simulator/assets/simulator-Dwp7lnvu.js +0 -10
  43. 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 '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';
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, 'workspace'>): () => string | null;
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 './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';
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({ connections: context.connections, broker: context.cdpSessionBroker });
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(() => { context.storageApi = undefined; });
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(() => { context.onServiceStorageChanged = undefined; });
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 === 'number' ? `http://localhost:${port}/` : null;
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(() => { context.networkForward = undefined; });
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(() => { context.appData = undefined; });
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).