@dimina-kit/devtools 0.4.0 → 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 +51 -660
- package/dist/main/api.d.ts +2 -1
- package/dist/main/app/app.d.ts +41 -12
- package/dist/main/app/app.js +299 -514
- package/dist/main/app/bootstrap.d.ts +8 -5
- package/dist/main/app/bootstrap.js +15 -15
- package/dist/main/app/editor-view.d.ts +21 -0
- package/dist/main/app/editor-view.js +71 -0
- package/dist/main/app/global-mirrors.d.ts +23 -0
- package/dist/main/app/global-mirrors.js +37 -0
- package/dist/main/app/host-sidebar-default.d.ts +19 -0
- package/dist/main/app/host-sidebar-default.js +44 -0
- package/dist/main/app/lifecycle.d.ts +12 -1
- package/dist/main/app/lifecycle.js +27 -1
- package/dist/main/app/menu-setup.d.ts +13 -0
- package/dist/main/app/menu-setup.js +49 -0
- package/dist/main/app/native-overview.d.ts +1 -1
- package/dist/main/app/open-project-ipc.d.ts +13 -0
- package/dist/main/app/open-project-ipc.js +21 -0
- package/dist/main/app/project-list-surface.d.ts +31 -0
- package/dist/main/app/project-list-surface.js +20 -0
- package/dist/main/app/project-window.d.ts +36 -0
- package/dist/main/app/project-window.js +93 -0
- package/dist/main/app/servers.d.ts +17 -0
- package/dist/main/app/servers.js +60 -0
- package/dist/main/app/ui-extension-targets.d.ts +42 -0
- package/dist/main/app/ui-extension-targets.js +101 -0
- package/dist/main/app/window-close-reveal.harness.d.ts +34 -0
- package/dist/main/app/window-close-reveal.harness.js +65 -0
- package/dist/main/app/window-events.d.ts +15 -0
- package/dist/main/app/window-events.js +45 -0
- package/dist/main/app/window-runtime-services.d.ts +41 -0
- package/dist/main/app/window-runtime-services.js +197 -0
- package/dist/main/app/workbench-modules.d.ts +24 -0
- package/dist/main/app/workbench-modules.js +51 -0
- package/dist/main/app/workbench-window.d.ts +85 -0
- package/dist/main/app/workbench-window.js +310 -0
- package/dist/main/index.bundle.js +11712 -9986
- package/dist/main/index.js +49 -1
- package/dist/main/ipc/app-lifecycle.d.ts +1 -31
- package/dist/main/ipc/app-lifecycle.js +1 -53
- package/dist/main/ipc/app.d.ts +4 -1
- package/dist/main/ipc/app.js +4 -3
- package/dist/main/ipc/bridge-router.d.ts +19 -116
- package/dist/main/ipc/bridge-router.js +28 -2128
- package/dist/main/ipc/device-picker.d.ts +16 -0
- package/dist/main/ipc/device-picker.js +27 -0
- package/dist/main/ipc/index.d.ts +5 -0
- package/dist/main/ipc/index.js +5 -0
- package/dist/main/ipc/internal-devtools.d.ts +16 -0
- package/dist/main/ipc/internal-devtools.js +10 -0
- package/dist/main/ipc/page-scroll.d.ts +1 -13
- package/dist/main/ipc/page-scroll.js +1 -16
- package/dist/main/ipc/popover.d.ts +4 -1
- package/dist/main/ipc/popover.js +26 -19
- package/dist/main/ipc/project-create.d.ts +16 -0
- package/dist/main/ipc/project-create.js +27 -0
- package/dist/main/ipc/project-fs.d.ts +38 -3
- package/dist/main/ipc/project-fs.js +53 -22
- package/dist/main/ipc/projects.d.ts +3 -3
- package/dist/main/ipc/projects.js +47 -11
- package/dist/main/ipc/session-listener-bag.d.ts +1 -40
- package/dist/main/ipc/session-listener-bag.js +1 -39
- package/dist/main/ipc/session.d.ts +4 -1
- package/dist/main/ipc/session.js +26 -26
- package/dist/main/ipc/settings.d.ts +4 -1
- package/dist/main/ipc/settings.js +17 -19
- package/dist/main/ipc/simulator-module.d.ts +9 -3
- package/dist/main/ipc/simulator-module.js +13 -10
- package/dist/main/ipc/simulator.d.ts +4 -1
- package/dist/main/ipc/simulator.js +12 -18
- package/dist/main/ipc/tooltip.d.ts +14 -0
- package/dist/main/ipc/tooltip.js +29 -0
- package/dist/main/ipc/views.d.ts +19 -2
- package/dist/main/ipc/views.js +76 -8
- package/dist/main/runtime/devtools-backend-before-quit.harness.d.ts +43 -0
- package/dist/main/runtime/devtools-backend-before-quit.harness.js +87 -0
- package/dist/main/runtime/devtools-backend.js +60 -4
- package/dist/main/runtime/devtools-runtime-mock.harness.d.ts +21 -0
- package/dist/main/runtime/devtools-runtime-mock.harness.js +313 -0
- package/dist/main/runtime/miniapp-runtime.d.ts +91 -22
- package/dist/main/services/app-services.d.ts +62 -0
- package/dist/main/services/app-services.js +64 -0
- package/dist/main/services/automation/connection-target.d.ts +36 -0
- package/dist/main/services/automation/connection-target.js +29 -0
- package/dist/main/services/automation/console-bridge.d.ts +28 -0
- package/dist/main/services/automation/console-bridge.js +91 -0
- package/dist/main/services/automation/handlers/app.js +4 -4
- package/dist/main/services/automation/handlers/element.js +55 -21
- package/dist/main/services/automation/index.d.ts +12 -1
- package/dist/main/services/automation/index.js +54 -133
- package/dist/main/services/cdp-session/index.d.ts +87 -0
- package/dist/main/services/cdp-session/index.js +173 -0
- package/dist/main/services/compile-standby.js +4 -0
- package/dist/main/services/console-forward/cdp-inject.d.ts +18 -0
- package/dist/main/services/console-forward/cdp-inject.js +30 -0
- package/dist/main/services/console-forward/global-console-mirror.d.ts +33 -0
- package/dist/main/services/console-forward/global-console-mirror.js +71 -0
- package/dist/main/services/console-forward/global-diagnostics-mirror.d.ts +33 -0
- package/dist/main/services/console-forward/global-diagnostics-mirror.js +73 -0
- package/dist/main/services/console-forward/index.d.ts +1 -46
- package/dist/main/services/console-forward/index.js +1 -185
- package/dist/main/services/console-forward/internal-log.d.ts +2 -0
- package/dist/main/services/console-forward/internal-log.js +2 -0
- package/dist/main/services/console-forward/open-gated-relay.d.ts +67 -0
- package/dist/main/services/console-forward/open-gated-relay.js +55 -0
- package/dist/main/services/default-adapter.js +1 -1
- package/dist/main/services/diagnostics/index.d.ts +1 -48
- package/dist/main/services/diagnostics/index.js +1 -60
- package/dist/main/services/dimina-resource-server.d.ts +1 -6
- package/dist/main/services/dimina-resource-server.js +1 -98
- package/dist/main/services/elements-forward/index.d.ts +132 -15
- package/dist/main/services/elements-forward/index.js +155 -304
- package/dist/main/services/fs-bridge-protocol.d.ts +61 -0
- package/dist/main/services/fs-bridge-protocol.js +34 -0
- package/dist/main/services/fs-watch-sse.d.ts +40 -0
- package/dist/main/services/fs-watch-sse.js +113 -0
- package/dist/main/services/http-json.d.ts +9 -0
- package/dist/main/services/http-json.js +6 -0
- package/dist/main/services/layout/index.d.ts +11 -0
- package/dist/main/services/layout/index.js +23 -0
- package/dist/main/services/mcp/connection-owner.d.ts +38 -0
- package/dist/main/services/mcp/connection-owner.js +79 -0
- package/dist/main/services/mcp/index.d.ts +3 -1
- package/dist/main/services/mcp/index.js +4 -3
- package/dist/main/services/mcp/opened-project.d.ts +88 -0
- package/dist/main/services/mcp/opened-project.js +60 -0
- package/dist/main/services/mcp/server.d.ts +2 -1
- package/dist/main/services/mcp/server.js +29 -4
- package/dist/main/services/mcp/target-manager.d.ts +71 -23
- package/dist/main/services/mcp/target-manager.js +269 -138
- package/dist/main/services/mcp/target-selection.d.ts +47 -0
- package/dist/main/services/mcp/target-selection.js +71 -0
- package/dist/main/services/mcp/tools/context-tools.js +20 -5
- package/dist/main/services/mcp/tools/project-tools.d.ts +72 -0
- package/dist/main/services/mcp/tools/project-tools.js +133 -0
- package/dist/main/services/module.d.ts +13 -5
- package/dist/main/services/network-forward/body-cache.d.ts +72 -0
- package/dist/main/services/network-forward/body-cache.js +179 -0
- package/dist/main/services/network-forward/frontend-dispatch.d.ts +91 -0
- package/dist/main/services/network-forward/frontend-dispatch.js +148 -0
- package/dist/main/services/network-forward/global-body-gate.d.ts +46 -0
- package/dist/main/services/network-forward/global-body-gate.js +93 -0
- package/dist/main/services/network-forward/global-mirror-test-fixtures.d.ts +48 -0
- package/dist/main/services/network-forward/global-mirror-test-fixtures.js +96 -0
- 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 +135 -15
- package/dist/main/services/network-forward/index.js +854 -224
- 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/network-forward/user-facing.d.ts +21 -0
- package/dist/main/services/network-forward/user-facing.js +50 -0
- package/dist/main/services/network-forward/websocket.d.ts +36 -0
- package/dist/main/services/network-forward/websocket.js +120 -0
- package/dist/main/services/notifications/renderer-notifier.d.ts +71 -9
- package/dist/main/services/notifications/renderer-notifier.js +45 -8
- package/dist/main/services/projects/create-project-service.js +19 -5
- package/dist/main/services/projects/local-provider.js +8 -4
- package/dist/main/services/projects/project-repository.d.ts +59 -7
- package/dist/main/services/projects/project-repository.js +285 -51
- package/dist/main/services/projects/types.d.ts +44 -34
- package/dist/main/services/render-inspect/index.d.ts +12 -2
- package/dist/main/services/render-inspect/index.js +21 -102
- package/dist/main/services/safe-area/index.d.ts +21 -6
- package/dist/main/services/safe-area/index.js +92 -46
- package/dist/main/services/service-host-pool/pool.d.ts +1 -196
- package/dist/main/services/service-host-pool/pool.js +1 -363
- package/dist/main/services/settings/index.d.ts +7 -1
- package/dist/main/services/settings/index.js +22 -2
- package/dist/main/services/simulator/custom-apis.d.ts +1 -42
- package/dist/main/services/simulator/custom-apis.js +1 -46
- package/dist/main/services/simulator/referer.d.ts +1 -9
- package/dist/main/services/simulator/referer.js +1 -19
- package/dist/main/services/simulator/ui-extensions.d.ts +21 -0
- package/dist/main/services/simulator/ui-extensions.js +176 -0
- package/dist/main/services/simulator-appdata/index.d.ts +6 -0
- package/dist/main/services/simulator-appdata/index.js +21 -2
- package/dist/main/services/simulator-current-page/index.d.ts +5 -3
- package/dist/main/services/simulator-current-page/index.js +8 -1
- package/dist/main/services/simulator-storage/index.d.ts +34 -5
- package/dist/main/services/simulator-storage/index.js +73 -71
- package/dist/main/services/simulator-storage/service-storage-ops.d.ts +1 -39
- package/dist/main/services/simulator-storage/service-storage-ops.js +1 -66
- package/dist/main/services/simulator-storage/window-scope.d.ts +20 -0
- package/dist/main/services/simulator-storage/window-scope.js +20 -0
- package/dist/main/services/simulator-temp-files/disk.d.ts +1 -54
- package/dist/main/services/simulator-temp-files/disk.js +1 -237
- package/dist/main/services/simulator-temp-files/fs-channels.d.ts +1 -68
- package/dist/main/services/simulator-temp-files/fs-channels.js +1 -107
- package/dist/main/services/simulator-temp-files/index.d.ts +1 -32
- package/dist/main/services/simulator-temp-files/index.js +1 -181
- package/dist/main/services/simulator-temp-files/request-handler.d.ts +1 -29
- package/dist/main/services/simulator-temp-files/request-handler.js +1 -177
- package/dist/main/services/simulator-temp-files/resolver.d.ts +1 -21
- package/dist/main/services/simulator-temp-files/resolver.js +1 -21
- package/dist/main/services/simulator-temp-files/store.d.ts +1 -13
- package/dist/main/services/simulator-temp-files/store.js +1 -23
- package/dist/main/services/update/github-release-checker.js +22 -3
- package/dist/main/services/update/update-manager.d.ts +21 -4
- package/dist/main/services/update/update-manager.js +55 -11
- package/dist/main/services/views/clear-console-filter.d.ts +44 -0
- package/dist/main/services/views/clear-console-filter.js +86 -0
- package/dist/main/services/views/console-filter-test-fixtures.d.ts +94 -0
- package/dist/main/services/views/console-filter-test-fixtures.js +82 -0
- package/dist/main/services/views/console-filter.d.ts +94 -0
- package/dist/main/services/views/console-filter.js +190 -0
- package/dist/main/services/views/devtools-tabs.d.ts +24 -4
- package/dist/main/services/views/devtools-tabs.js +40 -21
- package/dist/main/services/views/frontend-bootstrap-gate.d.ts +59 -0
- package/dist/main/services/views/frontend-bootstrap-gate.js +117 -0
- package/dist/main/services/views/host-dialog-port-channel.d.ts +18 -0
- package/dist/main/services/views/host-dialog-port-channel.js +15 -0
- package/dist/main/services/views/host-dialog-session-runtime.d.ts +10 -0
- package/dist/main/services/views/host-dialog-session-runtime.js +17 -0
- package/dist/main/services/views/host-dialog-view.d.ts +95 -0
- package/dist/main/services/views/host-dialog-view.js +147 -0
- package/dist/main/services/views/host-sidebar-port-channel.d.ts +18 -0
- package/dist/main/services/views/host-sidebar-port-channel.js +15 -0
- package/dist/main/services/views/host-sidebar-session-runtime.d.ts +10 -0
- package/dist/main/services/views/host-sidebar-session-runtime.js +17 -0
- package/dist/main/services/views/host-sidebar-view.d.ts +59 -0
- package/dist/main/services/views/host-sidebar-view.js +44 -0
- package/dist/main/services/views/host-slot-port-channel.d.ts +124 -0
- package/dist/main/services/views/host-slot-port-channel.js +289 -0
- package/dist/main/services/views/host-slot-session-runtime.d.ts +40 -0
- package/dist/main/services/views/host-slot-session-runtime.js +50 -0
- package/dist/main/services/views/host-slot-view.d.ts +109 -0
- package/dist/main/services/views/host-slot-view.js +147 -0
- package/dist/main/services/views/host-toolbar-port-channel.d.ts +6 -91
- package/dist/main/services/views/host-toolbar-port-channel.js +10 -243
- package/dist/main/services/views/host-toolbar-session-runtime.d.ts +5 -30
- package/dist/main/services/views/host-toolbar-session-runtime.js +9 -47
- package/dist/main/services/views/host-toolbar-view.d.ts +34 -7
- package/dist/main/services/views/host-toolbar-view.js +30 -237
- package/dist/main/services/views/managed-web-contents-view.d.ts +48 -0
- package/dist/main/services/views/managed-web-contents-view.js +143 -0
- package/dist/main/services/views/miniapp-partition.d.ts +1 -89
- package/dist/main/services/views/miniapp-partition.js +1 -158
- package/dist/main/services/views/native-simulator-devtools-host.js +206 -68
- package/dist/main/services/views/native-simulator-view.d.ts +6 -0
- package/dist/main/services/views/native-simulator-view.js +47 -40
- package/dist/main/services/views/native-view-tree.d.ts +25 -0
- package/dist/main/services/views/native-view-tree.js +69 -0
- package/dist/main/services/views/overlay-panels-view.d.ts +63 -4
- package/dist/main/services/views/overlay-panels-view.js +257 -108
- package/dist/main/services/views/placement-reconciler.d.ts +18 -18
- package/dist/main/services/views/placement-reconciler.js +91 -29
- package/dist/main/services/views/placement-test-driver.d.ts +27 -0
- package/dist/main/services/views/placement-test-driver.js +29 -0
- package/dist/main/services/views/refresh-styles.d.ts +10 -0
- package/dist/main/services/views/refresh-styles.js +57 -0
- package/dist/main/services/views/simulator-session-policy.d.ts +1 -27
- package/dist/main/services/views/simulator-session-policy.js +1 -98
- package/dist/main/services/views/view-manager-devtools-host-test-fixtures.d.ts +76 -0
- package/dist/main/services/views/view-manager-devtools-host-test-fixtures.js +184 -0
- package/dist/main/services/views/view-manager.d.ts +69 -88
- package/dist/main/services/views/view-manager.js +62 -7
- package/dist/main/services/views/workbench-view.d.ts +2 -0
- package/dist/main/services/views/workbench-view.js +104 -17
- package/dist/main/services/window-contexts/context-router.d.ts +36 -0
- package/dist/main/services/window-contexts/context-router.js +55 -0
- package/dist/main/services/workbench-coi-host.d.ts +52 -0
- package/dist/main/services/workbench-coi-host.js +227 -0
- package/dist/main/services/workbench-coi-server.d.ts +11 -0
- package/dist/main/services/workbench-coi-server.js +126 -126
- package/dist/main/services/workbench-coi-shutdown.d.ts +40 -0
- package/dist/main/services/workbench-coi-shutdown.js +69 -0
- package/dist/main/services/workbench-coi-static.d.ts +23 -0
- package/dist/main/services/workbench-coi-static.js +87 -0
- package/dist/main/services/workbench-context.d.ts +88 -8
- package/dist/main/services/workbench-context.js +54 -6
- package/dist/main/services/workspace/compile-log-buffer.d.ts +40 -0
- package/dist/main/services/workspace/compile-log-buffer.js +41 -0
- package/dist/main/services/workspace/compile-mode-adapter.d.ts +18 -0
- package/dist/main/services/workspace/compile-mode-adapter.js +57 -0
- package/dist/main/services/workspace/compile-mode-store.d.ts +25 -0
- package/dist/main/services/workspace/compile-mode-store.js +71 -0
- package/dist/main/services/workspace/open-project-guards.d.ts +16 -0
- package/dist/main/services/workspace/open-project-guards.js +42 -0
- package/dist/main/services/workspace/rebuild-status.d.ts +37 -0
- package/dist/main/services/workspace/rebuild-status.js +36 -0
- package/dist/main/services/workspace/session-status-store.d.ts +47 -0
- package/dist/main/services/workspace/session-status-store.js +73 -0
- package/dist/main/services/workspace/status-tap.d.ts +20 -0
- package/dist/main/services/workspace/status-tap.js +32 -0
- package/dist/main/services/workspace/workspace-compile-modes.d.ts +59 -0
- package/dist/main/services/workspace/workspace-compile-modes.js +93 -0
- package/dist/main/services/workspace/workspace-lifecycle-race.testutil.d.ts +22 -0
- package/dist/main/services/workspace/workspace-lifecycle-race.testutil.js +62 -0
- package/dist/main/services/workspace/workspace-referer.d.ts +17 -0
- package/dist/main/services/workspace/workspace-referer.js +26 -0
- package/dist/main/services/workspace/workspace-service.d.ts +7 -5
- package/dist/main/services/workspace/workspace-service.js +96 -135
- package/dist/main/services/workspace/workspace-thumbnails.d.ts +22 -0
- package/dist/main/services/workspace/workspace-thumbnails.js +67 -0
- package/dist/main/utils/ipc-context-source.d.ts +40 -0
- package/dist/main/utils/ipc-context-source.js +23 -0
- package/dist/main/utils/ipc-registry.d.ts +46 -21
- package/dist/main/utils/ipc-registry.js +166 -76
- package/dist/main/utils/paths.d.ts +18 -0
- package/dist/main/utils/paths.js +18 -0
- package/dist/main/utils/sender-policy.d.ts +10 -1
- package/dist/main/utils/sender-policy.js +42 -4
- package/dist/main/utils/theme.d.ts +18 -8
- package/dist/main/utils/theme.js +19 -9
- package/dist/main/windows/internal-devtools-window/index.d.ts +66 -0
- package/dist/main/windows/internal-devtools-window/index.js +160 -0
- package/dist/main/windows/main-window/create.d.ts +16 -0
- package/dist/main/windows/main-window/create.js +19 -11
- package/dist/main/windows/main-window/events.d.ts +1 -1
- package/dist/main/windows/main-window/events.js +26 -13
- package/dist/main/windows/main-window/index.d.ts +1 -1
- package/dist/main/windows/main-window/index.js +1 -1
- package/dist/main/windows/service-host-window/create.d.ts +1 -92
- package/dist/main/windows/service-host-window/create.js +1 -154
- package/dist/native-host/common/common.js +173 -53
- package/dist/native-host/container/pageFrame.css +1 -1
- package/dist/native-host/render/render.js +8278 -3659
- package/dist/native-host/service/service.js +2 -2
- package/dist/preload/index.d.ts +2 -0
- package/dist/preload/index.js +1 -0
- package/dist/preload/instrumentation/app-data.d.ts +2 -2
- package/dist/preload/instrumentation/app-data.js +1 -1
- package/dist/preload/instrumentation/wxml.js +1 -1
- package/dist/preload/runtime/bridge.d.ts +3 -3
- package/dist/preload/runtime/bridge.js +2 -2
- package/dist/preload/runtime/clipboard.d.ts +6 -0
- package/dist/preload/runtime/clipboard.js +12 -0
- package/dist/preload/runtime/host-dialog-advertiser.d.ts +22 -0
- package/dist/preload/runtime/host-dialog-advertiser.js +37 -0
- package/dist/preload/runtime/host-dialog-port.d.ts +44 -0
- package/dist/preload/runtime/host-dialog-port.js +53 -0
- package/dist/preload/runtime/host-dialog-runtime.d.ts +28 -0
- package/dist/preload/runtime/host-dialog-runtime.js +36 -0
- package/dist/preload/runtime/host-sidebar-advertiser.d.ts +19 -0
- package/dist/preload/runtime/host-sidebar-advertiser.js +35 -0
- package/dist/preload/runtime/host-sidebar-port.d.ts +44 -0
- package/dist/preload/runtime/host-sidebar-port.js +53 -0
- package/dist/preload/runtime/host-sidebar-runtime.d.ts +28 -0
- package/dist/preload/runtime/host-sidebar-runtime.js +36 -0
- package/dist/preload/runtime/host-slot-port-bridge.d.ts +18 -0
- package/dist/preload/runtime/host-slot-port-bridge.js +112 -0
- package/dist/preload/runtime/host-toolbar-advertiser.d.ts +5 -13
- package/dist/preload/runtime/host-toolbar-advertiser.js +18 -38
- package/dist/preload/runtime/host-toolbar-port.d.ts +9 -0
- package/dist/preload/runtime/host-toolbar-port.js +11 -95
- package/dist/preload/runtime/native-host.d.ts +14 -0
- package/dist/preload/runtime/native-host.js +5 -8
- package/dist/preload/runtime/node-bindings.d.ts +18 -0
- package/dist/preload/runtime/node-bindings.js +44 -0
- package/dist/preload/runtime/temp-files.js +9 -2
- package/dist/preload/runtime/wait-for-slot-root.d.ts +23 -0
- package/dist/preload/runtime/wait-for-slot-root.js +80 -0
- package/dist/preload/shared/api-compat.js +63 -41
- package/dist/preload/windows/host-dialog-runtime.cjs +360 -0
- package/dist/preload/windows/host-dialog-runtime.cjs.map +7 -0
- package/dist/preload/windows/host-dialog-runtime.d.ts +2 -0
- package/dist/preload/windows/host-dialog-runtime.js +13 -0
- package/dist/preload/windows/host-sidebar-runtime.cjs +361 -0
- package/dist/preload/windows/host-sidebar-runtime.cjs.map +7 -0
- package/dist/preload/windows/host-sidebar-runtime.d.ts +2 -0
- package/dist/preload/windows/host-sidebar-runtime.js +13 -0
- package/dist/preload/windows/host-toolbar-runtime.cjs +142 -52
- package/dist/preload/windows/host-toolbar-runtime.cjs.map +3 -3
- package/dist/preload/windows/main.cjs +4922 -1246
- package/dist/preload/windows/main.cjs.map +4 -4
- package/dist/preload/windows/main.css +428 -0
- package/dist/preload/windows/main.css.map +7 -0
- package/dist/preload/windows/simulator.cjs +376 -322
- package/dist/preload/windows/simulator.cjs.map +4 -4
- package/dist/preload/windows/simulator.js +376 -322
- package/dist/render-host/pageFrame.html +4 -4
- package/dist/render-host/preload.cjs +30 -0
- package/dist/render-host/render-inspect.js +184 -115
- package/dist/renderer/assets/button-CB2MWjHY.js +2 -0
- package/dist/renderer/assets/constants-CkoGPQTS.js +2 -0
- package/dist/renderer/assets/constants-zQZ2-y21.js +2 -0
- package/dist/renderer/assets/createLucideIcon-cZ9FlZZw.js +2 -0
- package/dist/renderer/assets/devicePicker-H2eIO4e1.js +2 -0
- package/dist/renderer/assets/dialog-pHzEA8Vx.js +46 -0
- package/dist/renderer/assets/dist-B5HADirS.js +2 -0
- package/dist/renderer/assets/dist-DIFlRMKe.js +2 -0
- package/dist/renderer/assets/hostSidebarDefault-DRWh6OCt.js +2 -0
- package/dist/renderer/assets/index-CEL_XFge.js +2 -0
- package/dist/renderer/assets/input-CAObw95L.js +2 -0
- package/dist/renderer/assets/ipc-channels-overlays-gIPUFnqc.js +2 -0
- package/dist/renderer/assets/jsx-runtime-DICEQH_0.css +1 -0
- package/dist/renderer/assets/jsx-runtime-DIw5wnYl.js +9 -0
- package/dist/renderer/assets/plus-BQ9u5EbL.js +2 -0
- package/dist/renderer/assets/popover-Cw7G2Ctp.js +2 -0
- package/dist/renderer/assets/presets-DMZOb9ay.js +2 -0
- package/dist/renderer/assets/project-api-YTOr_Yvo.js +2 -0
- package/dist/renderer/assets/projectCreateDialog-BmLqiYxn.js +2 -0
- package/dist/renderer/assets/search-BMvuYF48.js +2 -0
- package/dist/renderer/assets/select-nFP95TxM.js +2 -0
- package/dist/renderer/assets/settings-CnpVfSWt.js +2 -0
- package/dist/renderer/assets/settings-api-Ccsf-Nsj.js +2 -0
- package/dist/renderer/assets/settings-tab-bar-CAzrv32m.js +2 -0
- package/dist/renderer/assets/smartphone-Bb2GdIKy.js +2 -0
- package/dist/renderer/assets/tabs-CPKN3Mmq.js +2 -0
- package/dist/renderer/assets/tooltip-D6AxXRk5.js +2 -0
- package/dist/renderer/assets/types-Bh0hA7El.js +2 -0
- package/dist/renderer/assets/updateDialog-CwndJ0Bl.js +2 -0
- package/dist/renderer/assets/utils-sEB5OZEQ.js +2 -0
- package/dist/renderer/assets/view-api-B-2zPBR5.js +2 -0
- package/dist/renderer/assets/view-ids-BfaDVV5P.js +2 -0
- package/dist/renderer/assets/workbench-C0Jkdlps.js +5 -0
- package/dist/renderer/assets/workbenchSettings-YD0Ctbm_.js +8 -0
- package/dist/renderer/entries/device-picker/index.html +28 -0
- package/dist/renderer/entries/host-sidebar-default/index.html +22 -0
- package/dist/renderer/entries/main/index.html +16 -7
- package/dist/renderer/entries/popover/index.html +16 -6
- package/dist/renderer/entries/project-create-dialog/index.html +27 -0
- package/dist/renderer/entries/settings/index.html +10 -5
- package/dist/renderer/entries/tooltip/index.html +21 -0
- package/dist/renderer/entries/update-dialog/index.html +25 -0
- package/dist/renderer/entries/workbench/index.html +49 -0
- package/dist/renderer/entries/workbench-settings/index.html +12 -5
- package/dist/service-host/appdata-set-data.cjs +39 -0
- package/dist/service-host/host-env-update.cjs +23 -0
- package/dist/service-host/preload.cjs +54 -48
- package/dist/service-host/service-message-queue.cjs +71 -0
- package/dist/service-host/sync-impls/menu-button-geometry.js +16 -5
- package/dist/service-host/sync-impls/menu-button.js +5 -3
- package/dist/service-host/sync-impls/system-info.js +31 -9
- package/dist/shared/bridge-channels.d.ts +1 -416
- package/dist/shared/bridge-channels.js +1 -89
- package/dist/shared/compile-mode-state.d.ts +73 -0
- package/dist/shared/compile-mode-state.js +100 -0
- package/dist/shared/compile-modes.d.ts +152 -0
- package/dist/shared/compile-modes.js +237 -0
- package/dist/shared/constants.d.ts +22 -0
- package/dist/shared/constants.js +22 -0
- package/dist/shared/dmb-resource-url.d.ts +2 -0
- package/dist/shared/dmb-resource-url.js +2 -0
- package/dist/shared/ipc-channels-overlays.d.ts +162 -0
- package/dist/shared/ipc-channels-overlays.js +203 -0
- package/dist/shared/ipc-channels.d.ts +24 -154
- package/dist/shared/ipc-channels.js +48 -96
- package/dist/shared/ipc-schemas.d.ts +143 -54
- package/dist/shared/ipc-schemas.js +137 -45
- package/dist/shared/node-bindings.d.ts +2 -0
- package/dist/shared/node-bindings.js +2 -0
- package/dist/shared/project-window-types.d.ts +42 -0
- package/dist/shared/project-window-types.js +2 -0
- package/dist/shared/simulator-route.d.ts +8 -0
- package/dist/shared/simulator-route.js +15 -0
- package/dist/shared/simulator-ui.d.ts +61 -0
- package/dist/shared/simulator-ui.js +12 -0
- package/dist/shared/types.d.ts +126 -41
- package/dist/shared/view-ids.d.ts +10 -0
- package/dist/shared/view-ids.js +23 -0
- package/dist/simulator/assets/bridge-channels-B3JAmRfl.js +2 -0
- package/dist/simulator/assets/device-shell-ATEhHV2_.css +1 -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-mini-app-DFo7fhi5.js +2 -0
- package/dist/simulator/assets/simulator-ui-BupATgKo.css +1 -0
- package/dist/simulator/assets/simulator-ui-i3GCc7YJ.js +2 -0
- package/dist/simulator/simulator.html +4 -3
- package/dist/simulator/temp-files.d.ts +35 -0
- package/dist/simulator/temp-files.js +121 -0
- package/dist/simulator/types.d.ts +50 -0
- package/dist/simulator/types.js +2 -0
- package/dist/vscode-workbench/assets/__vite-browser-external-JIkWewFf.js +1 -0
- package/dist/vscode-workbench/assets/{dist-TpGpmMGi.js → dist-CXG-u1VB.js} +3 -3
- package/dist/vscode-workbench/assets/fs-core-worker-urls-DZ1nod84.js +1 -0
- package/dist/vscode-workbench/assets/fs-core.worker-Bnmpp6fo.js +1 -0
- package/dist/vscode-workbench/assets/fs-query.worker-cZ-7Fjch.js +2 -0
- package/dist/vscode-workbench/assets/{iconv-lite-umd-C9tiCAJa.js → iconv-lite-umd-Dxx9Qyb4.js} +1 -1
- package/dist/vscode-workbench/assets/{index-DJ1HyMZ7.js → index-6VJMsaWj.js} +475 -475
- package/dist/vscode-workbench/assets/{jschardet-DE1jV513.js → jschardet-Ba3D16vt.js} +1 -1
- package/dist/vscode-workbench/index.html +21 -1
- package/package.json +23 -13
- package/dist/main/services/views/destroy-child-view.d.ts +0 -9
- package/dist/main/services/views/destroy-child-view.js +0 -23
- package/dist/preload/instrumentation/wxml-extract.d.ts +0 -11
- package/dist/preload/instrumentation/wxml-extract.js +0 -382
- package/dist/preload/shared/sid-registry.d.ts +0 -11
- package/dist/preload/shared/sid-registry.js +0 -38
- package/dist/renderer/assets/constants-EAMiwL9_.js +0 -2
- package/dist/renderer/assets/index-BMqyDx71.js +0 -49
- package/dist/renderer/assets/input-CDAEwpBO.js +0 -2
- package/dist/renderer/assets/ipc-transport-B7eFOR68.css +0 -1
- package/dist/renderer/assets/ipc-transport-_G1k5V1p.js +0 -9
- package/dist/renderer/assets/popover-DEdjK14m.js +0 -2
- package/dist/renderer/assets/select-DpKPCh3y.js +0 -2
- package/dist/renderer/assets/settings-M5q2elUr.js +0 -2
- package/dist/renderer/assets/settings-api-CDlZoHiO.js +0 -2
- package/dist/renderer/assets/workbenchSettings-CT_H1WhV.js +0 -8
- package/dist/shared/appdata-accumulator.d.ts +0 -95
- package/dist/shared/appdata-accumulator.js +0 -218
- package/dist/shared/request-core.d.ts +0 -84
- package/dist/shared/request-core.js +0 -168
- package/dist/shared/simulator-api-metadata.d.ts +0 -26
- package/dist/shared/simulator-api-metadata.js +0 -59
- package/dist/shared/vpath.d.ts +0 -42
- package/dist/shared/vpath.js +0 -105
- package/dist/simulator/assets/bridge-channels-zhsumfky.js +0 -2
- package/dist/simulator/assets/device-shell-C-wcFq3Z.js +0 -2
- package/dist/simulator/assets/device-shell-CS1rqAQz.css +0 -1
- package/dist/simulator/assets/jsx-runtime-BDTY6fEq.js +0 -2
- package/dist/simulator/assets/simulator-DU3-fS3v.js +0 -10
- package/dist/simulator/assets/simulator-mini-app-DzfMfnVM.js +0 -2
- package/dist/simulator/device-shell/menu-button-geometry.js +0 -8
- package/dist/vscode-workbench/assets/__vite-browser-external-CXi6Kz9W.js +0 -1
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared `executeJavaScript` builders for pushing raw CDP messages into the
|
|
3
|
+
* embedded Chrome DevTools front-end via `window.DevToolsAPI.dispatchMessage`
|
|
4
|
+
* / `dispatchMessageChunk`. Both network-forward (Network tab injection) and
|
|
5
|
+
* elements-forward (Elements tab / render-event re-injection) need the exact
|
|
6
|
+
* same transport contract; a single copy means the two can never drift on the
|
|
7
|
+
* chunk-continuation protocol.
|
|
8
|
+
*/
|
|
9
|
+
import type { WebContents } from 'electron';
|
|
10
|
+
/** Probe the front-end realm exposes `DevToolsAPI.dispatchMessage`. */
|
|
11
|
+
export declare const PROBE_DEVTOOLS_API = "(window.DevToolsAPI && typeof window.DevToolsAPI.dispatchMessage === 'function')";
|
|
12
|
+
/** A single dispatch payload may not exceed this many UTF-16 chars; chunk above. */
|
|
13
|
+
export declare const MAX_SINGLE_DISPATCH_CHARS = 1000000;
|
|
14
|
+
export declare const CHUNK_CHARS: number;
|
|
15
|
+
/**
|
|
16
|
+
* Build the `executeJavaScript` source for a chunked dispatch of one large CDP
|
|
17
|
+
* message — DevTools' own transport caps a single `dispatchMessage` payload, so
|
|
18
|
+
* the front-end exposes `dispatchMessageChunk(messageChunk, messageSize)` where
|
|
19
|
+
* the FIRST chunk carries the total size and EVERY SUBSEQUENT chunk is called
|
|
20
|
+
* with the chunk ONLY (second arg omitted). This matches Chromium's
|
|
21
|
+
* `devtools_ui_bindings.cc` DispatchProtocolMessage, whose front-end treats a
|
|
22
|
+
* call with a second argument as the start of a new message and a call without
|
|
23
|
+
* one as a continuation. Passing 0 (the previous behaviour) risked the
|
|
24
|
+
* front-end mis-reading a continuation as a fresh 0-size message. Returns false
|
|
25
|
+
* when the API isn't available.
|
|
26
|
+
*/
|
|
27
|
+
export declare function buildChunkedDispatchScript(chunks: string[], totalSize: number): string;
|
|
28
|
+
/** Build the `executeJavaScript` source that dispatches ONE small CDP message
|
|
29
|
+
* (a response or event) into the front-end. Above `MAX_SINGLE_DISPATCH_CHARS`,
|
|
30
|
+
* callers must use {@link buildChunkedDispatchScript} instead. */
|
|
31
|
+
export declare function buildSingleDispatchScript(message: string): string;
|
|
32
|
+
/** One CDP command awaiting a reply — the minimal shape every outbound-gate
|
|
33
|
+
* (elements-forward, network-forward's global body gate) reads to answer. */
|
|
34
|
+
export interface ReplyableCommand {
|
|
35
|
+
id: number | null;
|
|
36
|
+
sessionId: string | null;
|
|
37
|
+
}
|
|
38
|
+
export interface FrontendReplyChannel {
|
|
39
|
+
/** Push an arbitrary CDP-shaped message (response OR event) into the
|
|
40
|
+
* front-end, auto-chunking above the single-dispatch size cap. */
|
|
41
|
+
dispatchToFrontend(message: unknown): void;
|
|
42
|
+
/** Reply to a front-end command id with a successful `result`. */
|
|
43
|
+
replyResult(cmd: ReplyableCommand, result: unknown): void;
|
|
44
|
+
/** Reply to a front-end command id with the canonical CDP not-found-style
|
|
45
|
+
* error shape, so the front-end renders its normal failure state instead
|
|
46
|
+
* of leaking a forever-pending request. */
|
|
47
|
+
replyError(cmd: ReplyableCommand, message: string): void;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Shared main → front-end reply transport for every outbound CDP gate that
|
|
51
|
+
* answers commands it intercepted from `InspectorFrontendHost.sendMessageToBackend`
|
|
52
|
+
* (elements-forward's render/network routing, network-forward's dedicated
|
|
53
|
+
* global body gate). A single copy means the two features can never drift on
|
|
54
|
+
* the settled-gate check, the chunking threshold, or the CDP reply shape.
|
|
55
|
+
*/
|
|
56
|
+
export declare function createFrontendReplyChannel(hostWc: WebContents, isDisposed: () => boolean): FrontendReplyChannel;
|
|
57
|
+
/**
|
|
58
|
+
* Validate + iterate a drained outbound-command batch (the front-end →
|
|
59
|
+
* main half of every poll-based outbound CDP gate): skips non-array batches,
|
|
60
|
+
* skips malformed entries, and only ever hands `handle` an item whose
|
|
61
|
+
* `method` is a string. Shared by elements-forward's render/network router
|
|
62
|
+
* and network-forward's dedicated global body gate so the two can never
|
|
63
|
+
* silently diverge on what counts as "well-formed".
|
|
64
|
+
*/
|
|
65
|
+
export declare function drainOutboundBatch<T extends {
|
|
66
|
+
method: unknown;
|
|
67
|
+
}>(batch: unknown, handle: (cmd: T) => void): void;
|
|
68
|
+
/** Minimal structural shape `answerNetworkBodyCommand` needs — satisfied by
|
|
69
|
+
* the real `NetworkBodyProvider` (network-forward/index.ts) without either
|
|
70
|
+
* module importing the other (that would be circular: index.ts already
|
|
71
|
+
* imports from this file). */
|
|
72
|
+
export interface NetworkBodyLookup {
|
|
73
|
+
getResponseBody(requestId: string): Promise<unknown>;
|
|
74
|
+
getRequestPostData(requestId: string): Promise<unknown>;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Answer one drained front-end command that requested a virtual requestId's
|
|
78
|
+
* response body / post data — the shared "network" branch every outbound CDP
|
|
79
|
+
* gate that intercepts `Network.getResponseBody`/`Network.getRequestPostData`
|
|
80
|
+
* needs (elements-forward's render/network router, network-forward's
|
|
81
|
+
* dedicated global body gate). A missing provider or a rejected lookup
|
|
82
|
+
* settles with the canonical CDP not-found error so the front-end renders
|
|
83
|
+
* its normal failure state instead of leaking a forever-pending request.
|
|
84
|
+
* `reply.replyResult`/`replyError` (from {@link createFrontendReplyChannel})
|
|
85
|
+
* already no-op once disposed, so this never needs its own disposed guard.
|
|
86
|
+
*/
|
|
87
|
+
export declare function answerNetworkBodyCommand(cmd: ReplyableCommand & {
|
|
88
|
+
method: string;
|
|
89
|
+
params: unknown;
|
|
90
|
+
}, provider: NetworkBodyLookup | undefined, reply: Pick<FrontendReplyChannel, 'replyResult' | 'replyError'>): void;
|
|
91
|
+
//# sourceMappingURL=frontend-dispatch.d.ts.map
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { isFrontendSettled } from '../views/inject-when-ready.js';
|
|
2
|
+
/** Probe the front-end realm exposes `DevToolsAPI.dispatchMessage`. */
|
|
3
|
+
export const PROBE_DEVTOOLS_API = `(window.DevToolsAPI && typeof window.DevToolsAPI.dispatchMessage === 'function')`;
|
|
4
|
+
/** A single dispatch payload may not exceed this many UTF-16 chars; chunk above. */
|
|
5
|
+
export const MAX_SINGLE_DISPATCH_CHARS = 1_000_000;
|
|
6
|
+
export const CHUNK_CHARS = 256 * 1024;
|
|
7
|
+
/**
|
|
8
|
+
* Build the `executeJavaScript` source for a chunked dispatch of one large CDP
|
|
9
|
+
* message — DevTools' own transport caps a single `dispatchMessage` payload, so
|
|
10
|
+
* the front-end exposes `dispatchMessageChunk(messageChunk, messageSize)` where
|
|
11
|
+
* the FIRST chunk carries the total size and EVERY SUBSEQUENT chunk is called
|
|
12
|
+
* with the chunk ONLY (second arg omitted). This matches Chromium's
|
|
13
|
+
* `devtools_ui_bindings.cc` DispatchProtocolMessage, whose front-end treats a
|
|
14
|
+
* call with a second argument as the start of a new message and a call without
|
|
15
|
+
* one as a continuation. Passing 0 (the previous behaviour) risked the
|
|
16
|
+
* front-end mis-reading a continuation as a fresh 0-size message. Returns false
|
|
17
|
+
* when the API isn't available.
|
|
18
|
+
*/
|
|
19
|
+
export function buildChunkedDispatchScript(chunks, totalSize) {
|
|
20
|
+
const arr = JSON.stringify(chunks);
|
|
21
|
+
return `(()=>{try{`
|
|
22
|
+
+ `if(!(window.DevToolsAPI&&typeof window.DevToolsAPI.dispatchMessageChunk==='function'))return false;`
|
|
23
|
+
+ `const cs=JSON.parse(${JSON.stringify(arr)});`
|
|
24
|
+
+ `for(let i=0;i<cs.length;i++){`
|
|
25
|
+
+ `try{`
|
|
26
|
+
// First chunk: (chunk, totalSize). Subsequent chunks: (chunk) — second arg
|
|
27
|
+
// omitted, NOT 0, per Chromium's continuation contract.
|
|
28
|
+
+ `if(i===0){window.DevToolsAPI.dispatchMessageChunk(cs[i], ${totalSize})}`
|
|
29
|
+
+ `else{window.DevToolsAPI.dispatchMessageChunk(cs[i])}`
|
|
30
|
+
+ `}catch(_){}`
|
|
31
|
+
+ `}`
|
|
32
|
+
+ `return true;`
|
|
33
|
+
+ `}catch(_){return false}})()`;
|
|
34
|
+
}
|
|
35
|
+
/** Build the `executeJavaScript` source that dispatches ONE small CDP message
|
|
36
|
+
* (a response or event) into the front-end. Above `MAX_SINGLE_DISPATCH_CHARS`,
|
|
37
|
+
* callers must use {@link buildChunkedDispatchScript} instead. */
|
|
38
|
+
export function buildSingleDispatchScript(message) {
|
|
39
|
+
return `(()=>{try{`
|
|
40
|
+
+ `if(!${PROBE_DEVTOOLS_API})return false;`
|
|
41
|
+
+ `window.DevToolsAPI.dispatchMessage(JSON.parse(${JSON.stringify(message)}));`
|
|
42
|
+
+ `return true;`
|
|
43
|
+
+ `}catch(_){return false}})()`;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Shared main → front-end reply transport for every outbound CDP gate that
|
|
47
|
+
* answers commands it intercepted from `InspectorFrontendHost.sendMessageToBackend`
|
|
48
|
+
* (elements-forward's render/network routing, network-forward's dedicated
|
|
49
|
+
* global body gate). A single copy means the two features can never drift on
|
|
50
|
+
* the settled-gate check, the chunking threshold, or the CDP reply shape.
|
|
51
|
+
*/
|
|
52
|
+
export function createFrontendReplyChannel(hostWc, isDisposed) {
|
|
53
|
+
function dispatchToFrontend(message) {
|
|
54
|
+
if (isDisposed() || hostWc.isDestroyed())
|
|
55
|
+
return;
|
|
56
|
+
// An unsettled front-end wipes its state on load anyway (message would be
|
|
57
|
+
// meaningless there), and executeJavaScript against it queues one
|
|
58
|
+
// did-stop-loading waiter per push — skip; the next settled tick re-primes.
|
|
59
|
+
if (!isFrontendSettled(hostWc))
|
|
60
|
+
return;
|
|
61
|
+
let json;
|
|
62
|
+
try {
|
|
63
|
+
json = JSON.stringify(message);
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (json.length > MAX_SINGLE_DISPATCH_CHARS) {
|
|
69
|
+
const chunks = [];
|
|
70
|
+
for (let i = 0; i < json.length; i += CHUNK_CHARS)
|
|
71
|
+
chunks.push(json.slice(i, i + CHUNK_CHARS));
|
|
72
|
+
let script;
|
|
73
|
+
try {
|
|
74
|
+
script = buildChunkedDispatchScript(chunks, json.length);
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
hostWc.executeJavaScript(script, true).catch(() => { });
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
let script;
|
|
83
|
+
try {
|
|
84
|
+
script = buildSingleDispatchScript(json);
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
hostWc.executeJavaScript(script, true).catch(() => { });
|
|
90
|
+
}
|
|
91
|
+
function replyResult(cmd, result) {
|
|
92
|
+
const msg = { id: cmd.id, result };
|
|
93
|
+
if (cmd.sessionId)
|
|
94
|
+
msg.sessionId = cmd.sessionId;
|
|
95
|
+
dispatchToFrontend(msg);
|
|
96
|
+
}
|
|
97
|
+
function replyError(cmd, message) {
|
|
98
|
+
const msg = { id: cmd.id, error: { code: -32000, message } };
|
|
99
|
+
if (cmd.sessionId)
|
|
100
|
+
msg.sessionId = cmd.sessionId;
|
|
101
|
+
dispatchToFrontend(msg);
|
|
102
|
+
}
|
|
103
|
+
return { dispatchToFrontend, replyResult, replyError };
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Validate + iterate a drained outbound-command batch (the front-end →
|
|
107
|
+
* main half of every poll-based outbound CDP gate): skips non-array batches,
|
|
108
|
+
* skips malformed entries, and only ever hands `handle` an item whose
|
|
109
|
+
* `method` is a string. Shared by elements-forward's render/network router
|
|
110
|
+
* and network-forward's dedicated global body gate so the two can never
|
|
111
|
+
* silently diverge on what counts as "well-formed".
|
|
112
|
+
*/
|
|
113
|
+
export function drainOutboundBatch(batch, handle) {
|
|
114
|
+
if (!Array.isArray(batch))
|
|
115
|
+
return;
|
|
116
|
+
const entries = batch;
|
|
117
|
+
for (const raw of entries) {
|
|
118
|
+
if (!raw || typeof raw !== 'object')
|
|
119
|
+
continue;
|
|
120
|
+
const cmd = raw;
|
|
121
|
+
if (typeof cmd.method !== 'string')
|
|
122
|
+
continue;
|
|
123
|
+
handle(cmd);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Answer one drained front-end command that requested a virtual requestId's
|
|
128
|
+
* response body / post data — the shared "network" branch every outbound CDP
|
|
129
|
+
* gate that intercepts `Network.getResponseBody`/`Network.getRequestPostData`
|
|
130
|
+
* needs (elements-forward's render/network router, network-forward's
|
|
131
|
+
* dedicated global body gate). A missing provider or a rejected lookup
|
|
132
|
+
* settles with the canonical CDP not-found error so the front-end renders
|
|
133
|
+
* its normal failure state instead of leaking a forever-pending request.
|
|
134
|
+
* `reply.replyResult`/`replyError` (from {@link createFrontendReplyChannel})
|
|
135
|
+
* already no-op once disposed, so this never needs its own disposed guard.
|
|
136
|
+
*/
|
|
137
|
+
export function answerNetworkBodyCommand(cmd, provider, reply) {
|
|
138
|
+
const requestId = cmd.params?.requestId;
|
|
139
|
+
if (!provider || typeof requestId !== 'string') {
|
|
140
|
+
reply.replyError(cmd, 'No resource with given identifier found');
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
const lookup = cmd.method === 'Network.getRequestPostData'
|
|
144
|
+
? provider.getRequestPostData(requestId)
|
|
145
|
+
: provider.getResponseBody(requestId);
|
|
146
|
+
lookup.then((result) => reply.replyResult(cmd, result), (err) => reply.replyError(cmd, err instanceof Error ? err.message : String(err)));
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=frontend-dispatch.js.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dedicated, NETWORK-ONLY outbound CDP gate for the standalone internal
|
|
3
|
+
* (app-wide) DevTools window's front-end.
|
|
4
|
+
*
|
|
5
|
+
* ── Why a SEPARATE gate from elements-forward ───────────────────────────────
|
|
6
|
+
* elements-forward's `InspectorFrontendHost.sendMessageToBackend` hook
|
|
7
|
+
* (see ../elements-forward/index.ts) ALSO intercepts DOM/CSS/Overlay commands
|
|
8
|
+
* and redirects them to the active render guest — correct for the RIGHT-panel
|
|
9
|
+
* CDP (which inspects the service host but wants Elements to reflect the
|
|
10
|
+
* render guest's live DOM), but WRONG for the global window: its Elements/
|
|
11
|
+
* Sources/Console should inspect `mainWindow` NATIVELY, with zero redirection.
|
|
12
|
+
* Installing the full elements-forward gate here would silently reroute the
|
|
13
|
+
* global window's Elements panel to the wrong target. This module intercepts
|
|
14
|
+
* ONLY `Network.getResponseBody` / `Network.getRequestPostData` for
|
|
15
|
+
* `dimina:sim:` and `dimina:http:` virtual requestIds; every other command (including all
|
|
16
|
+
* DOM/CSS/Overlay/Runtime/Debugger/…) passes straight through untouched.
|
|
17
|
+
*
|
|
18
|
+
* ── Mechanism (same two-way poll bridge as elements-forward) ───────────────
|
|
19
|
+
* front-end → main: wrap `InspectorFrontendHost.sendMessageToBackend`; a
|
|
20
|
+
* matching command is pushed onto `globalThis.__diminaGlobalNetworkOutbound`
|
|
21
|
+
* and NOT forwarded to the original channel; everything else calls through.
|
|
22
|
+
* main → front-end: answer via `window.DevToolsAPI.dispatchMessage` (chunked
|
|
23
|
+
* for large bodies), reusing the same transport network-forward's primary
|
|
24
|
+
* sink uses.
|
|
25
|
+
*
|
|
26
|
+
* Degradation: hook unavailable / host destroyed / a lookup rejects → the
|
|
27
|
+
* command settles with the standard CDP not-found error (same as an unknown
|
|
28
|
+
* id would get from the real backend) — never throws, never blocks anything
|
|
29
|
+
* else in the window.
|
|
30
|
+
*/
|
|
31
|
+
import type { WebContents } from 'electron';
|
|
32
|
+
import type { NetworkBodyProvider } from './index.js';
|
|
33
|
+
/**
|
|
34
|
+
* The JS injected into the DevTools front-end realm. Idempotent (sentinel
|
|
35
|
+
* guard, distinct from elements-forward's — the two gates coexist on
|
|
36
|
+
* DIFFERENT host wcs and never share a front-end, but the sentinel is scoped
|
|
37
|
+
* defensively anyway).
|
|
38
|
+
*/
|
|
39
|
+
export declare function buildNetworkOnlyHookScript(): string;
|
|
40
|
+
/**
|
|
41
|
+
* Install the gate on `hostWc` (the global window's front-end host).
|
|
42
|
+
* Returns a disposer that stops the reconcile loop. Best-effort throughout —
|
|
43
|
+
* never throws, degrades to CDP not-found on any failure.
|
|
44
|
+
*/
|
|
45
|
+
export declare function installGlobalNetworkBodyGate(hostWc: WebContents, bodies: NetworkBodyProvider): () => void;
|
|
46
|
+
//# sourceMappingURL=global-body-gate.d.ts.map
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { isFrontendSettled } from '../views/inject-when-ready.js';
|
|
2
|
+
import { BODY_REQUEST_ID_PREFIXES } from './request-ids.js';
|
|
3
|
+
import { createFrontendReplyChannel, answerNetworkBodyCommand, drainOutboundBatch } from './frontend-dispatch.js';
|
|
4
|
+
/** The only two Network.* commands this gate ever intercepts. */
|
|
5
|
+
const NETWORK_BODY_METHODS = ['Network.getResponseBody', 'Network.getRequestPostData'];
|
|
6
|
+
const DRAIN_INTERVAL_MS = 150;
|
|
7
|
+
/**
|
|
8
|
+
* The JS injected into the DevTools front-end realm. Idempotent (sentinel
|
|
9
|
+
* guard, distinct from elements-forward's — the two gates coexist on
|
|
10
|
+
* DIFFERENT host wcs and never share a front-end, but the sentinel is scoped
|
|
11
|
+
* defensively anyway).
|
|
12
|
+
*/
|
|
13
|
+
export function buildNetworkOnlyHookScript() {
|
|
14
|
+
const netMethods = JSON.stringify(NETWORK_BODY_METHODS);
|
|
15
|
+
const vprefix = JSON.stringify(BODY_REQUEST_ID_PREFIXES);
|
|
16
|
+
return `(function(){try{
|
|
17
|
+
if (globalThis.__diminaGlobalNetworkHookInstalled) return 'already';
|
|
18
|
+
var OUT = (globalThis.__diminaGlobalNetworkOutbound = globalThis.__diminaGlobalNetworkOutbound || []);
|
|
19
|
+
var NET_METHODS = ${netMethods};
|
|
20
|
+
var VPREFIXES = ${vprefix};
|
|
21
|
+
function isNetworkBody(m){
|
|
22
|
+
if (!m || !m.method) return false;
|
|
23
|
+
if (NET_METHODS.indexOf(m.method) < 0) return false;
|
|
24
|
+
return !!(m.params && typeof m.params.requestId === 'string' && VPREFIXES.some(function(prefix){ return m.params.requestId.indexOf(prefix) === 0; }));
|
|
25
|
+
}
|
|
26
|
+
var IFH = globalThis.InspectorFrontendHost;
|
|
27
|
+
if (IFH && typeof IFH.sendMessageToBackend === 'function' && !IFH.__diminaGlobalNetworkWrapped){
|
|
28
|
+
var origSend = IFH.sendMessageToBackend.bind(IFH);
|
|
29
|
+
IFH.sendMessageToBackend = function(message){
|
|
30
|
+
try {
|
|
31
|
+
var m = (typeof message === 'string') ? JSON.parse(message) : message;
|
|
32
|
+
if (isNetworkBody(m)){
|
|
33
|
+
OUT.push({ id: (m && typeof m.id === 'number') ? m.id : null,
|
|
34
|
+
method: m.method, params: m.params || {},
|
|
35
|
+
sessionId: (m && m.sessionId) ? m.sessionId : null });
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
} catch(_){ /* fall through to original on any parse hiccup */ }
|
|
39
|
+
return origSend(message);
|
|
40
|
+
};
|
|
41
|
+
IFH.__diminaGlobalNetworkWrapped = true;
|
|
42
|
+
globalThis.__diminaGlobalNetworkHookInstalled = true;
|
|
43
|
+
return 'installed';
|
|
44
|
+
}
|
|
45
|
+
return 'partial';
|
|
46
|
+
}catch(e){ return 'error:' + (e && e.message); }})()`;
|
|
47
|
+
}
|
|
48
|
+
function buildReconcileScript() {
|
|
49
|
+
return `(function(){`
|
|
50
|
+
+ `var status; try { status = ${buildNetworkOnlyHookScript()}; } catch(e){ status = 'error:'+(e&&e.message); }`
|
|
51
|
+
+ `var batch = []; try { if (globalThis.__diminaGlobalNetworkOutbound) batch = globalThis.__diminaGlobalNetworkOutbound.splice(0); } catch(_){}`
|
|
52
|
+
+ `return { status: status, batch: batch };`
|
|
53
|
+
+ `})()`;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Install the gate on `hostWc` (the global window's front-end host).
|
|
57
|
+
* Returns a disposer that stops the reconcile loop. Best-effort throughout —
|
|
58
|
+
* never throws, degrades to CDP not-found on any failure.
|
|
59
|
+
*/
|
|
60
|
+
export function installGlobalNetworkBodyGate(hostWc, bodies) {
|
|
61
|
+
let disposed = false;
|
|
62
|
+
let reconcileTimer = null;
|
|
63
|
+
const reply = createFrontendReplyChannel(hostWc, () => disposed);
|
|
64
|
+
function handleOutbound(batch) {
|
|
65
|
+
drainOutboundBatch(batch, (cmd) => answerNetworkBodyCommand(cmd, bodies, reply));
|
|
66
|
+
}
|
|
67
|
+
reconcileTimer = setInterval(() => {
|
|
68
|
+
if (disposed || hostWc.isDestroyed()) {
|
|
69
|
+
stop();
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (!isFrontendSettled(hostWc))
|
|
73
|
+
return;
|
|
74
|
+
hostWc
|
|
75
|
+
.executeJavaScript(buildReconcileScript())
|
|
76
|
+
.then((res) => {
|
|
77
|
+
if (disposed)
|
|
78
|
+
return;
|
|
79
|
+
const r = (res ?? {});
|
|
80
|
+
handleOutbound(r.batch);
|
|
81
|
+
})
|
|
82
|
+
.catch(() => { });
|
|
83
|
+
}, DRAIN_INTERVAL_MS);
|
|
84
|
+
function stop() {
|
|
85
|
+
disposed = true;
|
|
86
|
+
if (reconcileTimer) {
|
|
87
|
+
clearInterval(reconcileTimer);
|
|
88
|
+
reconcileTimer = null;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return stop;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=global-body-gate.js.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared test scaffolding for the Phase 2 "global mirror" test suites
|
|
3
|
+
* (`global-mirror.test.ts` + `global-mirror-bugfixes.test.ts`), split out so
|
|
4
|
+
* neither test file needs to duplicate these fixtures. Pure test scaffolding,
|
|
5
|
+
* not the code under test — see network-forward/index.test.ts for the
|
|
6
|
+
* canonical source these were originally copied from.
|
|
7
|
+
*/
|
|
8
|
+
import { vi } from 'vitest';
|
|
9
|
+
export declare function flushMicrotasks(): Promise<void>;
|
|
10
|
+
export declare function makeSimWc(): {
|
|
11
|
+
wc: Electron.WebContents;
|
|
12
|
+
dbg: {
|
|
13
|
+
isAttached: () => boolean;
|
|
14
|
+
attach: import("vitest").Mock<() => void>;
|
|
15
|
+
detach: import("vitest").Mock<() => void>;
|
|
16
|
+
sendCommand: import("vitest").Mock<(_method: string, _params?: object) => Promise<unknown>>;
|
|
17
|
+
on: (ev: string, fn: (...args: unknown[]) => void) => void;
|
|
18
|
+
removeListener: (ev: string, fn: (...args: unknown[]) => void) => void;
|
|
19
|
+
};
|
|
20
|
+
sendCommand: import("vitest").Mock<(_method: string, _params?: object) => Promise<unknown>>;
|
|
21
|
+
emitMessage: (method: string, params: unknown) => void;
|
|
22
|
+
};
|
|
23
|
+
export declare function makeServiceWc(): {
|
|
24
|
+
wc: Electron.WebContents;
|
|
25
|
+
exec: import("vitest").Mock<(_script: string, _userGesture?: boolean) => Promise<undefined>>;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* A DevTools FRONT-END host wc. The injected dispatch script returns `true` when
|
|
29
|
+
* `window.DevToolsAPI.dispatchMessage` is "present", so the fake resolves the
|
|
30
|
+
* configured value to simulate the API being ready (true) or still booting
|
|
31
|
+
* (false → forwarder retries / falls back).
|
|
32
|
+
*/
|
|
33
|
+
export declare function makeDevtoolsWc(apiReady?: boolean | (() => boolean), isLoading?: () => boolean): {
|
|
34
|
+
wc: Electron.WebContents;
|
|
35
|
+
exec: import("vitest").Mock<(_script: string, _userGesture?: boolean) => Promise<boolean>>;
|
|
36
|
+
emitDestroyed: () => void;
|
|
37
|
+
};
|
|
38
|
+
/** Decode the messages array embedded in a buildDispatchScript() source. */
|
|
39
|
+
export declare function decodeDispatched(script: string): Array<{
|
|
40
|
+
method: string;
|
|
41
|
+
params: unknown;
|
|
42
|
+
}>;
|
|
43
|
+
/** All events mirrored into a fake devtools host wc across every exec() call. */
|
|
44
|
+
export declare function allDispatched(exec: ReturnType<typeof vi.fn>): Array<{
|
|
45
|
+
method: string;
|
|
46
|
+
params: unknown;
|
|
47
|
+
}>;
|
|
48
|
+
//# sourceMappingURL=global-mirror-test-fixtures.d.ts.map
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared test scaffolding for the Phase 2 "global mirror" test suites
|
|
3
|
+
* (`global-mirror.test.ts` + `global-mirror-bugfixes.test.ts`), split out so
|
|
4
|
+
* neither test file needs to duplicate these fixtures. Pure test scaffolding,
|
|
5
|
+
* not the code under test — see network-forward/index.test.ts for the
|
|
6
|
+
* canonical source these were originally copied from.
|
|
7
|
+
*/
|
|
8
|
+
import { vi } from 'vitest';
|
|
9
|
+
export async function flushMicrotasks() {
|
|
10
|
+
await Promise.resolve();
|
|
11
|
+
await Promise.resolve();
|
|
12
|
+
}
|
|
13
|
+
export function makeSimWc() {
|
|
14
|
+
let attached = false;
|
|
15
|
+
const listeners = new Map();
|
|
16
|
+
const sendCommand = vi.fn((_method, _params) => Promise.resolve({}));
|
|
17
|
+
const dbg = {
|
|
18
|
+
isAttached: () => attached,
|
|
19
|
+
attach: vi.fn(() => { attached = true; }),
|
|
20
|
+
detach: vi.fn(() => { attached = false; }),
|
|
21
|
+
sendCommand,
|
|
22
|
+
on: (ev, fn) => {
|
|
23
|
+
if (!listeners.has(ev))
|
|
24
|
+
listeners.set(ev, new Set());
|
|
25
|
+
listeners.get(ev).add(fn);
|
|
26
|
+
},
|
|
27
|
+
removeListener: (ev, fn) => {
|
|
28
|
+
listeners.get(ev)?.delete(fn);
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
const wc = {
|
|
32
|
+
isDestroyed: () => false,
|
|
33
|
+
debugger: dbg,
|
|
34
|
+
once: () => { },
|
|
35
|
+
removeListener: () => { },
|
|
36
|
+
};
|
|
37
|
+
const emitMessage = (method, params) => {
|
|
38
|
+
for (const fn of listeners.get('message') ?? [])
|
|
39
|
+
fn({}, method, params);
|
|
40
|
+
};
|
|
41
|
+
return { wc, dbg, sendCommand, emitMessage };
|
|
42
|
+
}
|
|
43
|
+
export function makeServiceWc() {
|
|
44
|
+
const exec = vi.fn((_script, _userGesture) => Promise.resolve(undefined));
|
|
45
|
+
const wc = { isDestroyed: () => false, executeJavaScript: exec };
|
|
46
|
+
return { wc, exec };
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* A DevTools FRONT-END host wc. The injected dispatch script returns `true` when
|
|
50
|
+
* `window.DevToolsAPI.dispatchMessage` is "present", so the fake resolves the
|
|
51
|
+
* configured value to simulate the API being ready (true) or still booting
|
|
52
|
+
* (false → forwarder retries / falls back).
|
|
53
|
+
*/
|
|
54
|
+
export function makeDevtoolsWc(apiReady = true, isLoading = () => false) {
|
|
55
|
+
const exec = vi.fn((_script, _userGesture) => Promise.resolve(typeof apiReady === 'function' ? apiReady() : apiReady));
|
|
56
|
+
const destroyedListeners = new Set();
|
|
57
|
+
const wc = {
|
|
58
|
+
isDestroyed: () => false,
|
|
59
|
+
isLoading,
|
|
60
|
+
getURL: () => 'devtools://devtools/bundled/devtools_app.html',
|
|
61
|
+
executeJavaScript: exec,
|
|
62
|
+
once: (ev, fn) => { if (ev === 'destroyed')
|
|
63
|
+
destroyedListeners.add(fn); },
|
|
64
|
+
removeListener: (ev, fn) => { if (ev === 'destroyed')
|
|
65
|
+
destroyedListeners.delete(fn); },
|
|
66
|
+
};
|
|
67
|
+
const emitDestroyed = () => { for (const fn of [...destroyedListeners])
|
|
68
|
+
fn(); };
|
|
69
|
+
return { wc, exec, emitDestroyed };
|
|
70
|
+
}
|
|
71
|
+
/** Decode the messages array embedded in a buildDispatchScript() source. */
|
|
72
|
+
export function decodeDispatched(script) {
|
|
73
|
+
const start = script.indexOf('JSON.parse("');
|
|
74
|
+
if (start < 0)
|
|
75
|
+
return [];
|
|
76
|
+
let i = start + 'JSON.parse('.length;
|
|
77
|
+
const open = i;
|
|
78
|
+
i++;
|
|
79
|
+
for (; i < script.length; i++) {
|
|
80
|
+
if (script[i] === '\\') {
|
|
81
|
+
i++;
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
if (script[i] === '"')
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
const literal = script.slice(open, i + 1);
|
|
88
|
+
const inner = JSON.parse(literal);
|
|
89
|
+
const arr = JSON.parse(inner);
|
|
90
|
+
return arr.map((s) => JSON.parse(s));
|
|
91
|
+
}
|
|
92
|
+
/** All events mirrored into a fake devtools host wc across every exec() call. */
|
|
93
|
+
export function allDispatched(exec) {
|
|
94
|
+
return exec.mock.calls.flatMap((c) => decodeDispatched(String(c[0])));
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=global-mirror-test-fixtures.js.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { NativeRequestTrace } from "../../ipc/bridge-router.js";
|
|
2
|
+
/** One CDP message ready for `DevToolsAPI.dispatchMessage` injection. */
|
|
3
|
+
export interface SynthesizedRequestMessage {
|
|
4
|
+
method: string;
|
|
5
|
+
params: unknown;
|
|
6
|
+
/**
|
|
7
|
+
* The verdict `isUserFacingRequest` produced for this request's url at
|
|
8
|
+
* `sent` time, cached for the request's whole lifetime — every later event
|
|
9
|
+
* reuses it (they carry no url of their own). The user-facing sink gates
|
|
10
|
+
* on this; the global mirror ignores it.
|
|
11
|
+
*/
|
|
12
|
+
userFacing: boolean;
|
|
13
|
+
/** Response body ready to prime the forwarder's body-cache, present only
|
|
14
|
+
* on the message synthesized from a `finished` trace event. */
|
|
15
|
+
body?: {
|
|
16
|
+
base64Encoded: boolean;
|
|
17
|
+
body: string;
|
|
18
|
+
};
|
|
19
|
+
/** Request post data ready to prime the forwarder's post-data cache,
|
|
20
|
+
* present only on the message synthesized from the `sent` trace event when
|
|
21
|
+
* the request carried a body. */
|
|
22
|
+
postData?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface RequestTraceSynthesizerOptions {
|
|
25
|
+
/** Per-forwarder instance tag keeping virtual ids collision-free. */
|
|
26
|
+
epoch: string;
|
|
27
|
+
/**
|
|
28
|
+
* Origins the app itself serves (resource server / simulator shell), the
|
|
29
|
+
* same inputs `resolveUserFacing` feeds `isUserFacingRequest` for
|
|
30
|
+
* simulator-captured HTTP traffic. Re-read at each initial `sent`; redirects retain that verdict.
|
|
31
|
+
*/
|
|
32
|
+
internalOrigins?: () => ReadonlyArray<string | null | undefined>;
|
|
33
|
+
}
|
|
34
|
+
export declare class RequestTraceSynthesizer {
|
|
35
|
+
private readonly options;
|
|
36
|
+
private readonly requests;
|
|
37
|
+
private seq;
|
|
38
|
+
constructor(options: RequestTraceSynthesizerOptions);
|
|
39
|
+
/**
|
|
40
|
+
* Map one trace event to its CDP message, or null when the event must be
|
|
41
|
+
* dropped (a non-`sent` event for a requestId this synthesizer never saw
|
|
42
|
+
* sent — defensive against out-of-order delivery).
|
|
43
|
+
*/
|
|
44
|
+
synthesize(sessionId: string, event: NativeRequestTrace): SynthesizedRequestMessage | null;
|
|
45
|
+
private synthesizeRequest;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=http.d.ts.map
|