@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
|
@@ -10,8 +10,11 @@
|
|
|
10
10
|
* (simulator webContents, IPC handlers, etc.) without modifying dimina upstream.
|
|
11
11
|
*/
|
|
12
12
|
import { WebSocketServer } from 'ws';
|
|
13
|
-
import { AutomationChannel
|
|
13
|
+
import { AutomationChannel } from '../../../shared/ipc-channels.js';
|
|
14
14
|
import { IpcRegistry } from '../../utils/ipc-registry.js';
|
|
15
|
+
import { toIpcContextSource } from '../../utils/ipc-context-source.js';
|
|
16
|
+
import { createConnectionTarget } from './connection-target.js';
|
|
17
|
+
import { createConsoleBridge } from './console-bridge.js';
|
|
15
18
|
import { getSimulator } from './exec.js';
|
|
16
19
|
import { toolHandlers } from './handlers/tool.js';
|
|
17
20
|
import { appHandlers } from './handlers/app.js';
|
|
@@ -28,7 +31,17 @@ let currentPort = null;
|
|
|
28
31
|
export function getAutomationPort() {
|
|
29
32
|
return currentPort;
|
|
30
33
|
}
|
|
31
|
-
|
|
34
|
+
/**
|
|
35
|
+
* `getCtx` rather than a context: the server binds its port at boot, before any
|
|
36
|
+
* project window exists, so there is nothing to capture yet. Each connection
|
|
37
|
+
* then pins the first project window it reaches and keeps driving that one —
|
|
38
|
+
* `getCtx` is how it finds that window, not a per-message lookup.
|
|
39
|
+
*
|
|
40
|
+
* `senders` covers every live window instead, because the port channel is asked
|
|
41
|
+
* by renderers `getCtx` never names: the project list and background project
|
|
42
|
+
* windows all start automation clients of their own.
|
|
43
|
+
*/
|
|
44
|
+
export async function startAutomationServer(getCtx, senders, port = 0) {
|
|
32
45
|
const wss = new WebSocketServer({ port });
|
|
33
46
|
const clients = new Set();
|
|
34
47
|
await new Promise((resolve, reject) => {
|
|
@@ -39,125 +52,34 @@ export async function startAutomationServer(ctx, port = 0) {
|
|
|
39
52
|
// ws always binds via an http.Server, so address() is AddressInfo here.
|
|
40
53
|
const resolvedPort = typeof addr === 'object' && addr ? addr.port : port;
|
|
41
54
|
currentPort = resolvedPort;
|
|
42
|
-
//
|
|
43
|
-
//
|
|
44
|
-
//
|
|
45
|
-
//
|
|
46
|
-
|
|
55
|
+
// Gated per OWNING window: each window trusts its own renderer plus its
|
|
56
|
+
// settings/popover overlays (see createWorkbenchSenderPolicy), and the
|
|
57
|
+
// simulator webview is trusted by none of them. Gating on the active
|
|
58
|
+
// window's policy instead would reject every window that does not currently
|
|
59
|
+
// have focus, starting with the project list.
|
|
60
|
+
const portIpc = new IpcRegistry(toIpcContextSource(senders));
|
|
47
61
|
portIpc.handle(AutomationChannel.GetPort, () => {
|
|
48
62
|
return currentPort;
|
|
49
63
|
});
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
ws.send(msg);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
// Native-host console forwarding: under native-host the page/service console
|
|
58
|
-
// doesn't flow through the simulator guest's `ipc-message-host` channel (there
|
|
59
|
-
// is no Worker/MiniApp in the guest). Instead the render-host / service-host
|
|
60
|
-
// preloads post each console entry to main, bridge-router routes it to the
|
|
61
|
-
// always-on ConsoleForwarder, and we SUBSCRIBE to rebroadcast every entry
|
|
62
|
-
// (both layers) as an `App.logAdded` event — same shape the default-arch path
|
|
63
|
-
// emits below in `setupConsoleForwarding`. We no longer set `ctx.guestConsole`
|
|
64
|
-
// ourselves (the forwarder owns it); subscribing means render + service both
|
|
65
|
-
// reach automation while the forwarder also mirrors render into the service
|
|
66
|
-
// host's console for the embedded DevTools. Unsubscribed on close().
|
|
67
|
-
const consoleSub = ctx.consoleForwarder?.subscribe((entry) => {
|
|
68
|
-
const e = (entry ?? {});
|
|
69
|
-
broadcast({
|
|
70
|
-
method: 'App.logAdded',
|
|
71
|
-
params: { type: e.level || 'log', args: e.args || [] },
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
// Forward simulator console logs as App.logAdded events.
|
|
75
|
-
// Track the polling interval + stop timer + currently-attached sim and
|
|
76
|
-
// the named handler so we can fully detach on close() or sim destruction.
|
|
77
|
-
// Without this the listener accumulates across create/dispose cycles and
|
|
78
|
-
// across simulator rebuilds.
|
|
79
|
-
let consoleForwardingSetup = false;
|
|
80
|
-
let pollInterval = null;
|
|
81
|
-
let pollStopTimer = null;
|
|
82
|
-
let attachedSim = null;
|
|
83
|
-
let ipcMessageHostHandler = null;
|
|
84
|
-
// Handle for the destroyed-teardown owned by the sim's connection (replaces a
|
|
85
|
-
// bespoke `sim.once('destroyed')` + manual removeListener). Disposing it on
|
|
86
|
-
// graceful close()/detach releases the disposer from the connection segment so
|
|
87
|
-
// it can't accumulate across automation create/dispose cycles on the same sim.
|
|
88
|
-
let simDestroyedDisposer = null;
|
|
89
|
-
function detachConsoleForwarding() {
|
|
90
|
-
if (attachedSim) {
|
|
91
|
-
if (ipcMessageHostHandler) {
|
|
92
|
-
try {
|
|
93
|
-
if (!attachedSim.isDestroyed()) {
|
|
94
|
-
;
|
|
95
|
-
attachedSim.removeListener('ipc-message-host', ipcMessageHostHandler);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
catch { /* noop */ }
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
// Release the connection-owned destroyed disposer (idempotent; safe even if
|
|
102
|
-
// the sim is already destroyed — the disposer body only nulls local refs).
|
|
103
|
-
try {
|
|
104
|
-
simDestroyedDisposer?.dispose();
|
|
105
|
-
}
|
|
106
|
-
catch { /* noop */ }
|
|
107
|
-
attachedSim = null;
|
|
108
|
-
ipcMessageHostHandler = null;
|
|
109
|
-
simDestroyedDisposer = null;
|
|
110
|
-
}
|
|
111
|
-
function setupConsoleForwarding() {
|
|
112
|
-
if (consoleForwardingSetup)
|
|
113
|
-
return;
|
|
114
|
-
consoleForwardingSetup = true;
|
|
115
|
-
pollInterval = setInterval(() => {
|
|
116
|
-
const sim = getSimulator(ctx);
|
|
117
|
-
if (!sim)
|
|
118
|
-
return;
|
|
119
|
-
if (pollInterval) {
|
|
120
|
-
clearInterval(pollInterval);
|
|
121
|
-
pollInterval = null;
|
|
122
|
-
}
|
|
123
|
-
const onIpcMessageHost = (_event, channel, data) => {
|
|
124
|
-
if (channel === SimulatorChannel.Console) {
|
|
125
|
-
const logData = data;
|
|
126
|
-
broadcast({
|
|
127
|
-
method: 'App.logAdded',
|
|
128
|
-
params: { type: logData.level || 'log', args: logData.args || [] },
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
const onSimDestroyed = () => {
|
|
133
|
-
// Sim webContents is dead — drop refs (removeListener on a destroyed
|
|
134
|
-
// sender would throw) and allow re-attach to a new simulator.
|
|
135
|
-
attachedSim = null;
|
|
136
|
-
ipcMessageHostHandler = null;
|
|
137
|
-
simDestroyedDisposer = null;
|
|
138
|
-
consoleForwardingSetup = false;
|
|
139
|
-
};
|
|
140
|
-
attachedSim = sim;
|
|
141
|
-
ipcMessageHostHandler = onIpcMessageHost;
|
|
142
|
-
sim.on('ipc-message-host', onIpcMessageHost);
|
|
143
|
-
// Route the destroyed-teardown through the per-webContents connection
|
|
144
|
-
// registry: the connection arms a single `wc.once('destroyed')` and runs
|
|
145
|
-
// owned disposers on hard-destroy (or soft reset for pool reuse), so we no
|
|
146
|
-
// longer manage a bespoke 'destroyed' listener here.
|
|
147
|
-
simDestroyedDisposer = ctx.connections.acquire(sim).own(onSimDestroyed);
|
|
148
|
-
}, 1000);
|
|
149
|
-
// Stop polling after 30s
|
|
150
|
-
pollStopTimer = setTimeout(() => {
|
|
151
|
-
if (pollInterval) {
|
|
152
|
-
clearInterval(pollInterval);
|
|
153
|
-
pollInterval = null;
|
|
154
|
-
}
|
|
155
|
-
pollStopTimer = null;
|
|
156
|
-
}, 30000);
|
|
157
|
-
}
|
|
64
|
+
// Every connection owns its console bridge, because every connection has its
|
|
65
|
+
// own target window: a single server-wide broadcast would hand one client the
|
|
66
|
+
// logs of a project another client is driving.
|
|
67
|
+
const bridges = new Set();
|
|
158
68
|
wss.on('connection', (ws) => {
|
|
159
69
|
clients.add(ws);
|
|
160
|
-
|
|
70
|
+
const send = (msg) => {
|
|
71
|
+
if (ws.readyState === ws.OPEN)
|
|
72
|
+
ws.send(JSON.stringify(msg));
|
|
73
|
+
};
|
|
74
|
+
// Pinned, not resolved per message: the window a script drives is settled by
|
|
75
|
+
// the first project window this connection reaches, so a user clicking
|
|
76
|
+
// another project's window can't redirect it (see `createConnectionTarget`).
|
|
77
|
+
const target = createConnectionTarget(getCtx);
|
|
78
|
+
const consoleBridge = createConsoleBridge(() => target.peek(), getSimulator, send);
|
|
79
|
+
bridges.add(consoleBridge);
|
|
80
|
+
// Before any message: a client that only listens for `App.logAdded` never
|
|
81
|
+
// sends one, and still has to receive its target window's console.
|
|
82
|
+
consoleBridge.sync();
|
|
161
83
|
ws.on('message', async (raw) => {
|
|
162
84
|
let req;
|
|
163
85
|
try {
|
|
@@ -174,6 +96,9 @@ export async function startAutomationServer(ctx, port = 0) {
|
|
|
174
96
|
}
|
|
175
97
|
else {
|
|
176
98
|
try {
|
|
99
|
+
// Same target for the command and for the logs it produces.
|
|
100
|
+
const ctx = target.resolve();
|
|
101
|
+
consoleBridge.sync();
|
|
177
102
|
const result = await handler(ctx, params);
|
|
178
103
|
response = { id, result };
|
|
179
104
|
}
|
|
@@ -181,27 +106,23 @@ export async function startAutomationServer(ctx, port = 0) {
|
|
|
181
106
|
response = { id, error: { message: err.message || String(err) } };
|
|
182
107
|
}
|
|
183
108
|
}
|
|
184
|
-
|
|
185
|
-
|
|
109
|
+
send(response);
|
|
110
|
+
});
|
|
111
|
+
ws.on('close', () => {
|
|
112
|
+
clients.delete(ws);
|
|
113
|
+
bridges.delete(consoleBridge);
|
|
114
|
+
consoleBridge.dispose();
|
|
186
115
|
});
|
|
187
|
-
ws.on('close', () => clients.delete(ws));
|
|
188
116
|
});
|
|
189
117
|
return {
|
|
190
118
|
close: () => {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}
|
|
199
|
-
detachConsoleForwarding();
|
|
200
|
-
// Unsubscribe from the always-on ConsoleForwarder so a late guest console
|
|
201
|
-
// entry can't broadcast against a torn-down server. The forwarder keeps
|
|
202
|
-
// owning `ctx.guestConsole` (render→service mirroring continues without an
|
|
203
|
-
// automation client). No-op if the forwarder was absent.
|
|
204
|
-
consoleSub?.dispose();
|
|
119
|
+
// Detaches every connection's simulator listener and unsubscribes it from
|
|
120
|
+
// its window's ConsoleForwarder, so a late guest console entry can't fire
|
|
121
|
+
// against a torn-down server. The forwarder keeps owning `ctx.guestConsole`
|
|
122
|
+
// (render→service mirroring continues without an automation client).
|
|
123
|
+
for (const bridge of bridges)
|
|
124
|
+
bridge.dispose();
|
|
125
|
+
bridges.clear();
|
|
205
126
|
for (const ws of clients) {
|
|
206
127
|
try {
|
|
207
128
|
ws.close();
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared `wc.debugger` (CDP) session broker for render-host guest WebContents.
|
|
3
|
+
*
|
|
4
|
+
* ── Why this exists ─────────────────────────────────────────────────────────
|
|
5
|
+
* `webContents.debugger` is exclusive per wc (only one `attach()` owner at a
|
|
6
|
+
* time). Four independent modules — safe-area, elements-forward, render-inspect
|
|
7
|
+
* and network-forward — each hand-roll the same "reuse if already attached,
|
|
8
|
+
* self-attach only if nobody has, track what I self-attached so I only detach
|
|
9
|
+
* my own" bookkeeping, and each installs its OWN `wc.debugger.on('message', …)`
|
|
10
|
+
* listener. That duplication caused two real bugs:
|
|
11
|
+
*
|
|
12
|
+
* 1. network-forward's `attachRenderGuest` runs ONCE per guest (at webview
|
|
13
|
+
* creation). If some OTHER module later detaches the shared session it
|
|
14
|
+
* happened to self-attach, network-forward's capture dies permanently —
|
|
15
|
+
* nothing re-attaches it (unlike safe-area/elements-forward/render-inspect,
|
|
16
|
+
* which lazily re-`ensure` the debugger on every use and so self-heal).
|
|
17
|
+
* 2. On the simulator wc, two modules each do "detach if attached" with no
|
|
18
|
+
* notion of the other — whichever runs last steals the other's session.
|
|
19
|
+
*
|
|
20
|
+
* This broker is the single owner of "who attached, who may detach": callers
|
|
21
|
+
* `acquire(wc)` a lease instead of touching `wc.debugger` directly. A session's
|
|
22
|
+
* lifetime tracks the wc, not any one lease — the last lease releasing does
|
|
23
|
+
* NOT detach (another consumer may `acquire` again at any time); only the
|
|
24
|
+
* broker's own top-level `dispose()` detaches sessions IT self-attached. An
|
|
25
|
+
* external detach (another owner, or a real Chrome DevTools window stealing the
|
|
26
|
+
* session) notifies every lease's `onDetach` and drops the session's
|
|
27
|
+
* bookkeeping so the NEXT `acquire()` attaches from scratch — closing bug #1
|
|
28
|
+
* structurally instead of requiring every consumer to remember to re-ensure.
|
|
29
|
+
*/
|
|
30
|
+
import type { WebContents } from 'electron';
|
|
31
|
+
import type { ConnectionRegistry, Disposable } from '@dimina-kit/electron-deck/main';
|
|
32
|
+
export interface CdpSessionLease {
|
|
33
|
+
/** Send one CDP command on this wc's session. Rejects if the session/wc is gone. */
|
|
34
|
+
send(method: string, params?: object): Promise<unknown>;
|
|
35
|
+
/**
|
|
36
|
+
* Subscribe to every CDP `message` event this session receives. Multiple
|
|
37
|
+
* leases (from the same or different `acquire()` calls) share ONE real
|
|
38
|
+
* `wc.debugger.on('message', …)` listener, fanned out to every subscriber.
|
|
39
|
+
*/
|
|
40
|
+
onMessage(cb: (method: string, params: unknown) => void): Disposable;
|
|
41
|
+
/**
|
|
42
|
+
* Subscribe to this session becoming unusable for any reason OTHER than the
|
|
43
|
+
* broker's own top-level `dispose()`: an external detach (another owner
|
|
44
|
+
* releasing it, or a real Chrome DevTools window stealing it) OR the wc
|
|
45
|
+
* itself being destroyed. Either way the broker has already dropped its
|
|
46
|
+
* bookkeeping for this session by the time this fires — a consumer that
|
|
47
|
+
* caches its lease should drop the cache entry here so its NEXT `acquire()`
|
|
48
|
+
* gets a fresh one instead of operating on a dead lease. The broker's own
|
|
49
|
+
* `dispose()` detaching a session it self-attached does NOT fire this: that
|
|
50
|
+
* is an intentional, expected teardown, not a surprise the caller needs to
|
|
51
|
+
* react to.
|
|
52
|
+
*/
|
|
53
|
+
onDetach(cb: () => void): Disposable;
|
|
54
|
+
/**
|
|
55
|
+
* Enable DOM + CSS + Overlay (the render-inspection domains) once per
|
|
56
|
+
* session, in dependency order (`Overlay.enable` must follow `DOM.enable`'s
|
|
57
|
+
* resolution — Chromium rejects it otherwise; `CSS.enable` has no such
|
|
58
|
+
* dependency). Memoized PER SESSION (not per lease): concurrent callers on
|
|
59
|
+
* the same wc share one in-flight/completed handshake. Invalidated on any
|
|
60
|
+
* detach (self or external) so a later session re-runs it fresh.
|
|
61
|
+
*/
|
|
62
|
+
ensureRenderDomains(): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Release every subscription THIS lease registered via `onMessage`/
|
|
65
|
+
* `onDetach`. Idempotent. Never detaches the underlying session — that
|
|
66
|
+
* follows the wc's lifetime, not any one lease's.
|
|
67
|
+
*/
|
|
68
|
+
dispose(): void;
|
|
69
|
+
}
|
|
70
|
+
export interface CdpSessionBroker {
|
|
71
|
+
/**
|
|
72
|
+
* Get-or-create a lease for `wc`'s debugger session. Returns `null` when the
|
|
73
|
+
* wc is already destroyed, or when the debugger is exclusively held
|
|
74
|
+
* elsewhere and unavailable to attach (e.g. a real Chrome DevTools window).
|
|
75
|
+
*/
|
|
76
|
+
acquire(wc: WebContents): CdpSessionLease | null;
|
|
77
|
+
/**
|
|
78
|
+
* Project-level teardown: detach every session this broker itself
|
|
79
|
+
* self-attached (never one it merely reused). Sessions owned by someone
|
|
80
|
+
* else are left untouched.
|
|
81
|
+
*/
|
|
82
|
+
dispose(): void;
|
|
83
|
+
}
|
|
84
|
+
export declare function createCdpSessionBroker(opts?: {
|
|
85
|
+
connections?: ConnectionRegistry;
|
|
86
|
+
}): CdpSessionBroker;
|
|
87
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
export function createCdpSessionBroker(opts = {}) {
|
|
2
|
+
const sessions = new Map();
|
|
3
|
+
function removeDebuggerListeners(session) {
|
|
4
|
+
try {
|
|
5
|
+
session.wc.debugger.removeListener('message', session.onDbgMessage);
|
|
6
|
+
}
|
|
7
|
+
catch { /* wc gone */ }
|
|
8
|
+
try {
|
|
9
|
+
session.wc.debugger.removeListener('detach', session.onDbgDetach);
|
|
10
|
+
}
|
|
11
|
+
catch { /* wc gone */ }
|
|
12
|
+
}
|
|
13
|
+
function notifyDetach(session) {
|
|
14
|
+
for (const cb of [...session.detachSubs]) {
|
|
15
|
+
try {
|
|
16
|
+
cb();
|
|
17
|
+
}
|
|
18
|
+
catch { /* subscriber error is not our problem */ }
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function ensureSession(wc) {
|
|
22
|
+
const existing = sessions.get(wc);
|
|
23
|
+
if (existing)
|
|
24
|
+
return existing;
|
|
25
|
+
let selfAttached = false;
|
|
26
|
+
try {
|
|
27
|
+
if (!wc.debugger.isAttached()) {
|
|
28
|
+
wc.debugger.attach('1.3');
|
|
29
|
+
selfAttached = true;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
// Exclusively held elsewhere (e.g. a real Chrome DevTools window) and
|
|
34
|
+
// refused to share — degrade to "unavailable", same as every existing
|
|
35
|
+
// per-module implementation this broker replaces.
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
const session = {
|
|
39
|
+
wc,
|
|
40
|
+
selfAttached,
|
|
41
|
+
selfDetaching: false,
|
|
42
|
+
messageSubs: new Set(),
|
|
43
|
+
detachSubs: new Set(),
|
|
44
|
+
enablePromise: null,
|
|
45
|
+
onDbgMessage: (...args) => {
|
|
46
|
+
const [, method, params] = args;
|
|
47
|
+
for (const cb of [...session.messageSubs])
|
|
48
|
+
cb(method, params);
|
|
49
|
+
},
|
|
50
|
+
onDbgDetach: () => {
|
|
51
|
+
const wasSelfInitiated = session.selfDetaching;
|
|
52
|
+
session.selfDetaching = false;
|
|
53
|
+
session.enablePromise = null;
|
|
54
|
+
sessions.delete(wc);
|
|
55
|
+
removeDebuggerListeners(session);
|
|
56
|
+
try {
|
|
57
|
+
session.destroyedSub?.dispose();
|
|
58
|
+
}
|
|
59
|
+
catch { /* already gone */ }
|
|
60
|
+
if (!wasSelfInitiated)
|
|
61
|
+
notifyDetach(session);
|
|
62
|
+
},
|
|
63
|
+
onWcDestroyed: () => {
|
|
64
|
+
sessions.delete(wc);
|
|
65
|
+
removeDebuggerListeners(session);
|
|
66
|
+
// Deliberately does NOT call wc.debugger.detach(), even for a
|
|
67
|
+
// self-attached session: a destroyed wc's debugger is torn down by
|
|
68
|
+
// Electron itself, there is nothing left for us to usefully detach,
|
|
69
|
+
// and attempting it is an unnecessary risk (the underlying native
|
|
70
|
+
// objects may already be gone). Dropping our bookkeeping is enough.
|
|
71
|
+
// Not a broker-initiated detach — same "your lease is dead, re-acquire
|
|
72
|
+
// next time" signal as an external debugger detach, just for a
|
|
73
|
+
// different reason (the wc itself is gone, not merely the session).
|
|
74
|
+
notifyDetach(session);
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
wc.debugger.on('message', session.onDbgMessage);
|
|
78
|
+
wc.debugger.on('detach', session.onDbgDetach);
|
|
79
|
+
if (opts.connections) {
|
|
80
|
+
session.destroyedSub = opts.connections.acquire(wc).on('closed', session.onWcDestroyed);
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
try {
|
|
84
|
+
wc.once('destroyed', session.onWcDestroyed);
|
|
85
|
+
}
|
|
86
|
+
catch { /* fake/minimal wc */ }
|
|
87
|
+
}
|
|
88
|
+
sessions.set(wc, session);
|
|
89
|
+
return session;
|
|
90
|
+
}
|
|
91
|
+
function ensureRenderDomains(session) {
|
|
92
|
+
if (session.enablePromise)
|
|
93
|
+
return session.enablePromise;
|
|
94
|
+
session.wc.debugger.sendCommand('CSS.enable').catch(() => { });
|
|
95
|
+
const p = session.wc.debugger
|
|
96
|
+
.sendCommand('DOM.enable')
|
|
97
|
+
.then(() => session.wc.debugger.sendCommand('Overlay.enable'))
|
|
98
|
+
.then(() => undefined)
|
|
99
|
+
.catch(() => {
|
|
100
|
+
// Guest mid-teardown or domain unavailable — drop the memo so a later
|
|
101
|
+
// call (e.g. after the session recovers) can retry instead of being
|
|
102
|
+
// stuck on a permanently-failed handshake.
|
|
103
|
+
session.enablePromise = null;
|
|
104
|
+
});
|
|
105
|
+
session.enablePromise = p;
|
|
106
|
+
return p;
|
|
107
|
+
}
|
|
108
|
+
function createLease(session) {
|
|
109
|
+
const ownMessageSubs = new Set();
|
|
110
|
+
const ownDetachSubs = new Set();
|
|
111
|
+
return {
|
|
112
|
+
// Echo the caller's exact arity through to sendCommand — a caller that
|
|
113
|
+
// omits params (many CDP commands take none, e.g. 'Network.enable')
|
|
114
|
+
// gets the identical call Electron's own API expects, not a synthetic
|
|
115
|
+
// `{}` second argument.
|
|
116
|
+
send: (method, params) => params === undefined
|
|
117
|
+
? session.wc.debugger.sendCommand(method)
|
|
118
|
+
: session.wc.debugger.sendCommand(method, params),
|
|
119
|
+
onMessage: (cb) => {
|
|
120
|
+
session.messageSubs.add(cb);
|
|
121
|
+
ownMessageSubs.add(cb);
|
|
122
|
+
return { dispose: () => { session.messageSubs.delete(cb); ownMessageSubs.delete(cb); } };
|
|
123
|
+
},
|
|
124
|
+
onDetach: (cb) => {
|
|
125
|
+
session.detachSubs.add(cb);
|
|
126
|
+
ownDetachSubs.add(cb);
|
|
127
|
+
return { dispose: () => { session.detachSubs.delete(cb); ownDetachSubs.delete(cb); } };
|
|
128
|
+
},
|
|
129
|
+
ensureRenderDomains: () => ensureRenderDomains(session),
|
|
130
|
+
dispose: () => {
|
|
131
|
+
for (const cb of ownMessageSubs)
|
|
132
|
+
session.messageSubs.delete(cb);
|
|
133
|
+
for (const cb of ownDetachSubs)
|
|
134
|
+
session.detachSubs.delete(cb);
|
|
135
|
+
ownMessageSubs.clear();
|
|
136
|
+
ownDetachSubs.clear();
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
return {
|
|
141
|
+
acquire(wc) {
|
|
142
|
+
if (wc.isDestroyed())
|
|
143
|
+
return null;
|
|
144
|
+
const session = ensureSession(wc);
|
|
145
|
+
if (!session)
|
|
146
|
+
return null;
|
|
147
|
+
return createLease(session);
|
|
148
|
+
},
|
|
149
|
+
dispose() {
|
|
150
|
+
for (const session of [...sessions.values()]) {
|
|
151
|
+
if (session.selfAttached) {
|
|
152
|
+
session.selfDetaching = true;
|
|
153
|
+
try {
|
|
154
|
+
if (!session.wc.isDestroyed() && session.wc.debugger.isAttached()) {
|
|
155
|
+
session.wc.debugger.detach();
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
catch { /* already detached / destroyed */ }
|
|
159
|
+
}
|
|
160
|
+
// Whether detach ran above (which already self-cleans via onDbgDetach)
|
|
161
|
+
// or this session was externally-owned (never touched), make sure
|
|
162
|
+
// broker-side bookkeeping is gone either way.
|
|
163
|
+
sessions.delete(session.wc);
|
|
164
|
+
removeDebuggerListeners(session);
|
|
165
|
+
try {
|
|
166
|
+
session.destroyedSub?.dispose();
|
|
167
|
+
}
|
|
168
|
+
catch { /* already gone */ }
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -21,6 +21,10 @@ export function setupCompileWorkerStandby(ctx, deps = {}) {
|
|
|
21
21
|
severity: EVENT_SEVERITY[ev.type] ?? 'info',
|
|
22
22
|
code: 'compile-standby',
|
|
23
23
|
message: detail,
|
|
24
|
+
// Devtools-tooling-only state, unrelated to the inspected mini-program
|
|
25
|
+
// — must never reach the right-panel (user-facing) Console panel; see
|
|
26
|
+
// console-forward/index.ts's audience gate and global-diagnostics-mirror.ts.
|
|
27
|
+
audience: 'internal',
|
|
24
28
|
});
|
|
25
29
|
}
|
|
26
30
|
catch {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { WebContents } from 'electron';
|
|
2
|
+
import type { CdpSessionBroker } from '../cdp-session/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Shared CDP injection primitive for the global mirrors (console +
|
|
5
|
+
* diagnostics): evaluate `script` in `target`'s realm over the broker's
|
|
6
|
+
* debugger session — never `target.executeJavaScript`, whose internal RPC
|
|
7
|
+
* hangs forever on a wc that is simultaneously the inspected side of
|
|
8
|
+
* `setDevToolsWebContents` AND attached by an external CDP client (see
|
|
9
|
+
* global-console-mirror.ts for the full mechanism and the real-machine
|
|
10
|
+
* repro).
|
|
11
|
+
*
|
|
12
|
+
* Resolves true only on a clean evaluation. `exceptionDetails`, a rejected
|
|
13
|
+
* send, and an unacquirable session (destroyed wc / debugger exclusively
|
|
14
|
+
* held elsewhere) all report false — createOpenGatedRelay then leaves the
|
|
15
|
+
* entry retryable instead of marking it done.
|
|
16
|
+
*/
|
|
17
|
+
export declare function injectViaCdp(broker: CdpSessionBroker, target: WebContents, script: string, warnTag: string): boolean | Promise<boolean>;
|
|
18
|
+
//# sourceMappingURL=cdp-inject.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared CDP injection primitive for the global mirrors (console +
|
|
3
|
+
* diagnostics): evaluate `script` in `target`'s realm over the broker's
|
|
4
|
+
* debugger session — never `target.executeJavaScript`, whose internal RPC
|
|
5
|
+
* hangs forever on a wc that is simultaneously the inspected side of
|
|
6
|
+
* `setDevToolsWebContents` AND attached by an external CDP client (see
|
|
7
|
+
* global-console-mirror.ts for the full mechanism and the real-machine
|
|
8
|
+
* repro).
|
|
9
|
+
*
|
|
10
|
+
* Resolves true only on a clean evaluation. `exceptionDetails`, a rejected
|
|
11
|
+
* send, and an unacquirable session (destroyed wc / debugger exclusively
|
|
12
|
+
* held elsewhere) all report false — createOpenGatedRelay then leaves the
|
|
13
|
+
* entry retryable instead of marking it done.
|
|
14
|
+
*/
|
|
15
|
+
export function injectViaCdp(broker, target, script, warnTag) {
|
|
16
|
+
const lease = broker.acquire(target);
|
|
17
|
+
if (!lease)
|
|
18
|
+
return false;
|
|
19
|
+
return lease.send('Runtime.evaluate', { expression: script }).then((result) => {
|
|
20
|
+
if (result?.exceptionDetails) {
|
|
21
|
+
console.warn(`[${warnTag}] Runtime.evaluate reported an exception, will retry on next reopen`);
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
return true;
|
|
25
|
+
}, (err) => {
|
|
26
|
+
console.warn(`[${warnTag}] injection failed, will retry on next reopen:`, err instanceof Error ? err.message : String(err));
|
|
27
|
+
return false;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=cdp-inject.js.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { WebContents } from 'electron';
|
|
2
|
+
import type { Disposable } from '@dimina-kit/electron-deck/main';
|
|
3
|
+
import type { ConsoleForwarder } from './index.js';
|
|
4
|
+
import type { CdpSessionBroker } from '../cdp-session/index.js';
|
|
5
|
+
/**
|
|
6
|
+
* Mirror EVERY guest console entry (both service + render layers,
|
|
7
|
+
* UNFILTERED — no isInternalLogMessage gating, see that module's doc for
|
|
8
|
+
* why this mirror deliberately skips it) into `target`'s own console, but
|
|
9
|
+
* ONLY while the standalone internal DevTools window is open.
|
|
10
|
+
*
|
|
11
|
+
* The subscription lifecycle is gated by `onHostChanged` (non-null hostWc =
|
|
12
|
+
* window just opened/rebuilt, null = just closed) rather than subscribing
|
|
13
|
+
* once for the whole app lifetime: each open re-subscribes to `forwarder`
|
|
14
|
+
* with `{replay:true}`, draining its CURRENT history buffer into `target`
|
|
15
|
+
* before continuing live, and each close disposes that subscription. This
|
|
16
|
+
* is what makes opening (or reopening) the window always show recent
|
|
17
|
+
* history — subscribing once at construction time (this module's earlier
|
|
18
|
+
* design) captured the replay burst before any window could possibly be
|
|
19
|
+
* open to receive it, silently losing it forever. `target` is the fixed
|
|
20
|
+
* INSPECTED side (mainWindow.webContents, per
|
|
21
|
+
* internal-devtools-window.ts's setDevToolsWebContents relationship) —
|
|
22
|
+
* never the hostWc the signal carries; injecting into the front-end host
|
|
23
|
+
* page would only ever reach that page's own invisible console.
|
|
24
|
+
*
|
|
25
|
+
* Reopen-dedup is handled by `createOpenGatedRelay` (real-machine e2e
|
|
26
|
+
* confirmed a naive replay-on-every-open double-injects everything already
|
|
27
|
+
* shown once, since Chromium's own console storage survives a DevTools
|
|
28
|
+
* close — see that module's doc comment).
|
|
29
|
+
*/
|
|
30
|
+
export declare function createGlobalConsoleMirror(forwarder: Pick<ConsoleForwarder, 'subscribe'>, target: WebContents, onHostChanged: (handler: (hostWc: WebContents | null) => void) => () => void, opts: {
|
|
31
|
+
broker: CdpSessionBroker;
|
|
32
|
+
}): Disposable;
|
|
33
|
+
//# sourceMappingURL=global-console-mirror.d.ts.map
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { isFrontendSettled } from '../views/inject-when-ready.js';
|
|
2
|
+
import { createOpenGatedRelay } from './open-gated-relay.js';
|
|
3
|
+
import { injectViaCdp } from './cdp-inject.js';
|
|
4
|
+
/** Console levels safe to re-emit; anything else maps to 'log' — mirrors
|
|
5
|
+
* console-forward/index.ts's FORWARDABLE_LEVELS. */
|
|
6
|
+
const FORWARDABLE_LEVELS = new Set(['log', 'warn', 'error', 'info', 'debug']);
|
|
7
|
+
/**
|
|
8
|
+
* Build the `executeJavaScript` source that re-emits one guest console entry
|
|
9
|
+
* into the target wc's own console, tagged with its source layer. Args ride
|
|
10
|
+
* as a JSON string and are re-parsed target-side — data, never code — same
|
|
11
|
+
* discipline as console-forward/index.ts's buildForwardScript.
|
|
12
|
+
*/
|
|
13
|
+
function buildMirrorScript(entry) {
|
|
14
|
+
const method = FORWARDABLE_LEVELS.has(entry.level ?? '') ? entry.level : 'log';
|
|
15
|
+
const tag = entry.source === 'render' ? '[render]' : '[service]';
|
|
16
|
+
const argsJson = JSON.stringify(entry.args ?? []);
|
|
17
|
+
return `(()=>{try{const a=JSON.parse(${JSON.stringify(argsJson)});console[${JSON.stringify(method)}](${JSON.stringify(tag)},...a)}catch(_){}})()`;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Mirror EVERY guest console entry (both service + render layers,
|
|
21
|
+
* UNFILTERED — no isInternalLogMessage gating, see that module's doc for
|
|
22
|
+
* why this mirror deliberately skips it) into `target`'s own console, but
|
|
23
|
+
* ONLY while the standalone internal DevTools window is open.
|
|
24
|
+
*
|
|
25
|
+
* The subscription lifecycle is gated by `onHostChanged` (non-null hostWc =
|
|
26
|
+
* window just opened/rebuilt, null = just closed) rather than subscribing
|
|
27
|
+
* once for the whole app lifetime: each open re-subscribes to `forwarder`
|
|
28
|
+
* with `{replay:true}`, draining its CURRENT history buffer into `target`
|
|
29
|
+
* before continuing live, and each close disposes that subscription. This
|
|
30
|
+
* is what makes opening (or reopening) the window always show recent
|
|
31
|
+
* history — subscribing once at construction time (this module's earlier
|
|
32
|
+
* design) captured the replay burst before any window could possibly be
|
|
33
|
+
* open to receive it, silently losing it forever. `target` is the fixed
|
|
34
|
+
* INSPECTED side (mainWindow.webContents, per
|
|
35
|
+
* internal-devtools-window.ts's setDevToolsWebContents relationship) —
|
|
36
|
+
* never the hostWc the signal carries; injecting into the front-end host
|
|
37
|
+
* page would only ever reach that page's own invisible console.
|
|
38
|
+
*
|
|
39
|
+
* Reopen-dedup is handled by `createOpenGatedRelay` (real-machine e2e
|
|
40
|
+
* confirmed a naive replay-on-every-open double-injects everything already
|
|
41
|
+
* shown once, since Chromium's own console storage survives a DevTools
|
|
42
|
+
* close — see that module's doc comment).
|
|
43
|
+
*/
|
|
44
|
+
export function createGlobalConsoleMirror(forwarder, target, onHostChanged, opts) {
|
|
45
|
+
function inject(entry) {
|
|
46
|
+
if (target.isDestroyed())
|
|
47
|
+
return false;
|
|
48
|
+
if (!isFrontendSettled(target))
|
|
49
|
+
return false;
|
|
50
|
+
let script;
|
|
51
|
+
try {
|
|
52
|
+
script = buildMirrorScript(entry);
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
// Transport is CDP `Runtime.evaluate` over the shared debugger-session
|
|
58
|
+
// broker — NEVER `target.executeJavaScript`: Electron's internal
|
|
59
|
+
// ExecuteJavaScript RPC hangs FOREVER on a wc that is simultaneously the
|
|
60
|
+
// inspected side of `setDevToolsWebContents` (the standalone debug
|
|
61
|
+
// window) AND attached by an external CDP client (remote-debugging-port,
|
|
62
|
+
// which bootstrap's setupCdpPort enables by default when unpackaged and
|
|
63
|
+
// whenever cdp/mcp settings are on) — real-machine repro. The debugger
|
|
64
|
+
// channel is unaffected. Report the real outcome (not fire-and-forget) —
|
|
65
|
+
// createOpenGatedRelay only marks an entry permanently "injected" on a
|
|
66
|
+
// confirmed `true`, and its inject timeout bounds any residual hang.
|
|
67
|
+
return injectViaCdp(opts.broker, target, script, 'global-console-mirror');
|
|
68
|
+
}
|
|
69
|
+
return createOpenGatedRelay(onHostChanged, (sink, opts2) => forwarder.subscribe(sink, opts2), inject);
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=global-console-mirror.js.map
|