@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
|
@@ -1,61 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Elements-panel forwarding — reflect the ACTIVE RENDER GUEST's live DOM tree in
|
|
3
|
-
* the right-panel Chrome DevTools front-end, which natively inspects the
|
|
4
|
-
* service-host (logic layer).
|
|
5
|
-
*
|
|
6
|
-
* ── Mechanism (no preload, no broker) ────────────────────────────────────────
|
|
7
|
-
* The DevTools front-end is a `devtools://` page with NO dimina preload, so we
|
|
8
|
-
* drive it through the same two-way poll bridge the network-forward path uses:
|
|
9
|
-
* • front-end → main : we wrap `InspectorFrontendHost.sendMessageToBackend` in
|
|
10
|
-
* the front-end realm. Commands whose method is in the RENDER domain set
|
|
11
|
-
* (DOM/CSS/Overlay/DOMSnapshot/DOMDebugger) are NOT passed to the original
|
|
12
|
-
* embedder channel — they're pushed onto `globalThis.__diminaElementsOutbound`
|
|
13
|
-
* and main drains that array (splice) on a poll. EVERY OTHER method
|
|
14
|
-
* (Runtime/Console/Page/Target/Emulation/…) calls through to the original, so
|
|
15
|
-
* the service-host inspection (Console, Sources) and crucially the safe-area
|
|
16
|
-
* `Emulation.setSafeAreaInsetsOverride` are untouched.
|
|
17
|
-
* • main → front-end : we re-inject responses + render-side EVENTS via
|
|
18
|
-
* `window.DevToolsAPI.dispatchMessage(json)` (chunked for large payloads —
|
|
19
|
-
* `DOM.getDocument` can be big — mirroring network-forward/index.ts).
|
|
20
|
-
*
|
|
21
|
-
* ── Why no broker / no safe-area changes ─────────────────────────────────────
|
|
22
|
-
* `webContents.debugger` is single-owner per wc, and the safe-area service has
|
|
23
|
-
* already `attach('1.3')`-ed each render guest. We REUSE that already-attached
|
|
24
|
-
* session (`sendCommand` + an extra `on('message')` listener on the SAME
|
|
25
|
-
* `wc.debugger`); we never attach a second session and never detach one we don't
|
|
26
|
-
* own. `DOM.enable`/`CSS.enable`/`Overlay.enable` do not reset the safe-area
|
|
27
|
-
* `Emulation` override, so this is purely additive. ONLY when a guest's debugger
|
|
28
|
-
* is NOT attached (safe-area degraded) do we `attach('1.3')` ourselves — tracked
|
|
29
|
-
* in a `Set<wc.id>` so dispose/guest-destroy detaches ONLY the sessions we own;
|
|
30
|
-
* safe-area's are never touched.
|
|
31
|
-
*
|
|
32
|
-
* ── Staleness (active-guest, NOT a generation counter) ───────────────────────
|
|
33
|
-
* A response/event is honoured only while its originating guest is STILL the
|
|
34
|
-
* active render guest — resolved fresh from the bridge per check (`isActiveWcId`),
|
|
35
|
-
* not snapshotted. So a late response or stray render EVENT from a guest that is
|
|
36
|
-
* no longer active is dropped (its in-flight command id is settled with an error
|
|
37
|
-
* so the front-end never leaks a pending request, and stale nodes never bleed into
|
|
38
|
-
* the new tree); and switching away and BACK to a previously-wired guest RESUMES
|
|
39
|
-
* its forwarding (a snapshot would strand it).
|
|
40
|
-
*
|
|
41
|
-
* ── Degradation ──────────────────────────────────────────────────────────────
|
|
42
|
-
* Hook unavailable / `DevToolsAPI` missing / no active guest → routing is simply
|
|
43
|
-
* inert; the Elements panel falls back to the front-end's native service-host
|
|
44
|
-
* DOM (the prior behaviour). Everything is try/catch + feature-detect + bounded
|
|
45
|
-
* polling: it never throws, never blocks, never disturbs Console/Network/safe-area.
|
|
46
|
-
*
|
|
47
|
-
* This is a production feature (no env gate, default on for the native simulator).
|
|
48
|
-
* It deliberately re-implements the small pure helpers it needs (routing table,
|
|
49
|
-
* hook + dispatch scripts) as self-contained code.
|
|
50
|
-
*/
|
|
51
|
-
import { webContents as electronWebContents } from 'electron';
|
|
52
1
|
import { isFrontendSettled } from '../views/inject-when-ready.js';
|
|
2
|
+
import { BODY_REQUEST_ID_PREFIXES } from '../network-forward/request-ids.js';
|
|
3
|
+
import { buildSingleDispatchScript, createFrontendReplyChannel, answerNetworkBodyCommand, drainOutboundBatch } from '../network-forward/frontend-dispatch.js';
|
|
4
|
+
import { createCdpSessionBroker } from '../cdp-session/index.js';
|
|
53
5
|
/**
|
|
54
6
|
* CDP domains that target the RENDER GUEST'S document tree. A command in one of
|
|
55
7
|
* these is intercepted and sent to the active render guest's debugger instead of
|
|
56
8
|
* the service host the front-end nominally inspects.
|
|
57
9
|
*/
|
|
58
|
-
const RENDER_DOMAIN_PREFIXES = [
|
|
10
|
+
export const RENDER_DOMAIN_PREFIXES = [
|
|
59
11
|
'DOM.',
|
|
60
12
|
'CSS.',
|
|
61
13
|
'Overlay.',
|
|
@@ -87,40 +39,89 @@ export function routeByDomain(method) {
|
|
|
87
39
|
export function isRenderEventMethod(method) {
|
|
88
40
|
return routeByDomain(method) === 'render';
|
|
89
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* The Network commands answered from the network forwarder's prefetch cache
|
|
44
|
+
* when they target a virtual requestId. Only these two: they're the panel's
|
|
45
|
+
* body/post-data round-trips. Every other Network.* stays on the service path
|
|
46
|
+
* (a virtual id there errors exactly like an unknown id would — harmless).
|
|
47
|
+
*/
|
|
48
|
+
export const NETWORK_BODY_METHODS = [
|
|
49
|
+
'Network.getResponseBody',
|
|
50
|
+
'Network.getRequestPostData',
|
|
51
|
+
];
|
|
52
|
+
/**
|
|
53
|
+
* Full outbound routing decision — the SINGLE authority for where a front-end
|
|
54
|
+
* CDP command goes. `routeByDomain` covers the method-only render split; this
|
|
55
|
+
* adds the params-dependent network split. The hook script inlines an
|
|
56
|
+
* equivalent test driven by the same literals, so the two cannot drift.
|
|
57
|
+
*
|
|
58
|
+
* A non-string / missing requestId routes to 'service': only the
|
|
59
|
+
* simulator and native HTTP namespaces is ours to answer, and the real backend is the
|
|
60
|
+
* correct authority for its own ids.
|
|
61
|
+
*/
|
|
62
|
+
export function routeOutboundCommand(method, params) {
|
|
63
|
+
if (routeByDomain(method) === 'render')
|
|
64
|
+
return 'render';
|
|
65
|
+
if (NETWORK_BODY_METHODS.includes(method)) {
|
|
66
|
+
const requestId = params?.requestId;
|
|
67
|
+
if (typeof requestId === 'string' && BODY_REQUEST_ID_PREFIXES.some((prefix) => requestId.startsWith(prefix))) {
|
|
68
|
+
return 'network';
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return 'service';
|
|
72
|
+
}
|
|
90
73
|
// ── front-end injection (the front-end → main half of the bridge) ────────────
|
|
91
74
|
/**
|
|
92
75
|
* The JS injected into the DevTools front-end realm. Idempotent (sentinel guard).
|
|
93
|
-
* Wraps `InspectorFrontendHost.sendMessageToBackend
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
76
|
+
* Wraps `InspectorFrontendHost.sendMessageToBackend` — the ONE outbound CDP
|
|
77
|
+
* gate for every command the front-end emits. A command that routes 'render'
|
|
78
|
+
* or 'network' (same decision table as {@link routeOutboundCommand}) is pushed
|
|
79
|
+
* onto `globalThis.__diminaElementsOutbound` tagged with its route and NOT
|
|
80
|
+
* forwarded to the original embedder channel (main answers it — from the
|
|
81
|
+
* render guest or the network prefetch cache respectively); every other
|
|
82
|
+
* command calls through to the original (service-host path).
|
|
97
83
|
*
|
|
98
84
|
* Returns `'installed'` / `'already'` on success, `'partial'` while the embedder
|
|
99
85
|
* global is not yet present (so the caller retries), `'error:…'` on a real fault.
|
|
100
86
|
*/
|
|
101
87
|
export function buildElementsHookScript() {
|
|
102
88
|
const prefixes = JSON.stringify(RENDER_DOMAIN_PREFIXES);
|
|
89
|
+
const netMethods = JSON.stringify(NETWORK_BODY_METHODS);
|
|
90
|
+
const vprefix = JSON.stringify(BODY_REQUEST_ID_PREFIXES);
|
|
103
91
|
return `(function(){try{
|
|
104
92
|
if (globalThis.__diminaElementsHookInstalled) return 'already';
|
|
105
93
|
var OUT = (globalThis.__diminaElementsOutbound = globalThis.__diminaElementsOutbound || []);
|
|
106
94
|
var PREFIXES = ${prefixes};
|
|
95
|
+
var NET_METHODS = ${netMethods};
|
|
96
|
+
var VPREFIXES = ${vprefix};
|
|
107
97
|
function isRender(method){
|
|
108
98
|
if (!method) return false;
|
|
109
99
|
for (var i=0;i<PREFIXES.length;i++){ if (method.indexOf(PREFIXES[i])===0) return true; }
|
|
110
100
|
return false;
|
|
111
101
|
}
|
|
102
|
+
function routeOf(m){
|
|
103
|
+
if (!m || !m.method) return 'service';
|
|
104
|
+
if (isRender(m.method)) return 'render';
|
|
105
|
+
if (NET_METHODS.indexOf(m.method) >= 0 && m.params
|
|
106
|
+
&& typeof m.params.requestId === 'string'
|
|
107
|
+
&& VPREFIXES.some(function(prefix){ return m.params.requestId.indexOf(prefix) === 0; })) return 'network';
|
|
108
|
+
return 'service';
|
|
109
|
+
}
|
|
112
110
|
var IFH = globalThis.InspectorFrontendHost;
|
|
113
111
|
if (IFH && typeof IFH.sendMessageToBackend === 'function' && !IFH.__diminaElementsWrapped){
|
|
114
112
|
var origSend = IFH.sendMessageToBackend.bind(IFH);
|
|
115
113
|
IFH.sendMessageToBackend = function(message){
|
|
116
114
|
try {
|
|
117
115
|
var m = (typeof message === 'string') ? JSON.parse(message) : message;
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
//
|
|
116
|
+
var route = routeOf(m);
|
|
117
|
+
if (route !== 'service'){
|
|
118
|
+
// Intercept: hand it to main to answer (render guest / network
|
|
119
|
+
// cache). Do NOT call the original embedder channel — the service
|
|
120
|
+
// host either has the wrong tree or has never heard of the id.
|
|
121
121
|
OUT.push({ id: (m && typeof m.id === 'number') ? m.id : null,
|
|
122
122
|
method: m.method, params: m.params || {},
|
|
123
|
-
sessionId: (m && m.sessionId) ? m.sessionId : null
|
|
123
|
+
sessionId: (m && m.sessionId) ? m.sessionId : null,
|
|
124
|
+
route: route });
|
|
124
125
|
return;
|
|
125
126
|
}
|
|
126
127
|
} catch(_){ /* fall through to original on any parse hiccup */ }
|
|
@@ -151,53 +152,24 @@ function buildReconcileScript() {
|
|
|
151
152
|
+ `return { status: status, batch: batch };`
|
|
152
153
|
+ `})()`;
|
|
153
154
|
}
|
|
154
|
-
// ── main → front-end dispatch (
|
|
155
|
-
// network-forward keeps these file-private and the task forbids touching it, so
|
|
156
|
-
// they're re-implemented here. Keep the chunk contract in sync if that changes.
|
|
157
|
-
const PROBE_DEVTOOLS_API = `(window.DevToolsAPI && typeof window.DevToolsAPI.dispatchMessage === 'function')`;
|
|
158
|
-
/** A single dispatch payload may not exceed this many UTF-16 chars; chunk above. */
|
|
159
|
-
const MAX_SINGLE_DISPATCH_CHARS = 1_000_000;
|
|
160
|
-
const CHUNK_CHARS = 256 * 1024;
|
|
161
|
-
/** Dispatch ONE small CDP message (response or event) into the front-end. */
|
|
162
|
-
function buildDispatchScript(message) {
|
|
163
|
-
return `(()=>{try{`
|
|
164
|
-
+ `if(!${PROBE_DEVTOOLS_API})return false;`
|
|
165
|
-
+ `window.DevToolsAPI.dispatchMessage(JSON.parse(${JSON.stringify(message)}));`
|
|
166
|
-
+ `return true;`
|
|
167
|
-
+ `}catch(_){return false}})()`;
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Dispatch one LARGE message via `dispatchMessageChunk`: the FIRST chunk carries
|
|
171
|
-
* the total size, every SUBSEQUENT chunk omits the second arg (Chromium's
|
|
172
|
-
* continuation contract). Returns false when the chunk API isn't present yet.
|
|
173
|
-
*/
|
|
174
|
-
function buildChunkedDispatchScript(chunks, totalSize) {
|
|
175
|
-
const arr = JSON.stringify(chunks);
|
|
176
|
-
return `(()=>{try{`
|
|
177
|
-
+ `if(!(window.DevToolsAPI&&typeof window.DevToolsAPI.dispatchMessageChunk==='function'))return false;`
|
|
178
|
-
+ `const cs=JSON.parse(${JSON.stringify(arr)});`
|
|
179
|
-
+ `for(let i=0;i<cs.length;i++){`
|
|
180
|
-
+ `try{`
|
|
181
|
-
+ `if(i===0){window.DevToolsAPI.dispatchMessageChunk(cs[i], ${totalSize})}`
|
|
182
|
-
+ `else{window.DevToolsAPI.dispatchMessageChunk(cs[i])}`
|
|
183
|
-
+ `}catch(_){}`
|
|
184
|
-
+ `}`
|
|
185
|
-
+ `return true;`
|
|
186
|
-
+ `}catch(_){return false}})()`;
|
|
187
|
-
}
|
|
155
|
+
// ── main → front-end dispatch (shared transport with network-forward) ───────
|
|
188
156
|
/** Script that nudges the front-end to discard its document and lazily re-pull. */
|
|
189
157
|
function buildDocumentUpdatedScript() {
|
|
190
158
|
const msg = JSON.stringify({ method: 'DOM.documentUpdated', params: {} });
|
|
191
|
-
return
|
|
159
|
+
return buildSingleDispatchScript(msg);
|
|
192
160
|
}
|
|
193
161
|
// Reconcile cadence: each tick re-asserts the hook (idempotent) and drains the
|
|
194
162
|
// outbound queue. Fast enough that a freshly reloaded front-end is re-hooked
|
|
195
163
|
// within a tick, cheap because the install script short-circuits to 'already'.
|
|
196
164
|
const DRAIN_INTERVAL_MS = 150;
|
|
197
165
|
/**
|
|
198
|
-
* Install Elements forwarding on a DevTools front-end host wc. Returns a
|
|
199
|
-
* (`stop`) that clears timers, unsubscribes render events,
|
|
200
|
-
*
|
|
166
|
+
* Install Elements forwarding on a DevTools front-end host wc. Returns a
|
|
167
|
+
* disposer (`stop`) that clears timers, unsubscribes render events, releases
|
|
168
|
+
* every broker lease this call acquired, and — only when no `deps.broker` was
|
|
169
|
+
* supplied (this call owns its private broker) — disposes that broker too
|
|
170
|
+
* (which detaches ONLY the sessions it self-attached). When `deps.broker` IS
|
|
171
|
+
* supplied (the shared, app-wide instance), `stop()` never disposes it: other
|
|
172
|
+
* consumers may still be using it.
|
|
201
173
|
*
|
|
202
174
|
* Best-effort + defensive throughout: a destroyed wc ends the feature; every
|
|
203
175
|
* executeJavaScript / sendCommand is wrapped so a torn-down guest never throws
|
|
@@ -206,6 +178,10 @@ const DRAIN_INTERVAL_MS = 150;
|
|
|
206
178
|
*/
|
|
207
179
|
export function installElementsForward(deps) {
|
|
208
180
|
const { devtoolsWc, bridge } = deps;
|
|
181
|
+
// Own (and tear down on stop()) a private broker only when the caller didn't
|
|
182
|
+
// supply a shared one — see ElementsForwardDeps.broker.
|
|
183
|
+
const ownsBroker = !deps.broker;
|
|
184
|
+
const broker = deps.broker ?? createCdpSessionBroker({ connections: deps.connections });
|
|
209
185
|
let disposed = false;
|
|
210
186
|
// A single self-healing loop drives BOTH hook (re)install and outbound drain;
|
|
211
187
|
// it never self-terminates so a front-end reload (respawn) is re-hooked.
|
|
@@ -227,26 +203,26 @@ export function installElementsForward(deps) {
|
|
|
227
203
|
const a = activeRenderWc();
|
|
228
204
|
return a != null && a.id === id;
|
|
229
205
|
};
|
|
230
|
-
// Render guests we've
|
|
231
|
-
//
|
|
232
|
-
const
|
|
233
|
-
// Debugger sessions THIS feature attached (safe-area was degraded). dispose /
|
|
234
|
-
// guest-destroy detaches ONLY these; sessions safe-area owns are never touched.
|
|
235
|
-
const selfAttached = new Set();
|
|
206
|
+
// Render guests we've acquired a broker lease for (keyed wc.id) so a
|
|
207
|
+
// re-resolve of the same guest doesn't double-subscribe.
|
|
208
|
+
const guestLeases = new Map();
|
|
236
209
|
const stop = () => {
|
|
237
210
|
disposed = true;
|
|
238
211
|
if (reconcileTimer) {
|
|
239
212
|
clearInterval(reconcileTimer);
|
|
240
213
|
reconcileTimer = null;
|
|
241
214
|
}
|
|
242
|
-
for (const
|
|
215
|
+
for (const lease of guestLeases.values()) {
|
|
243
216
|
try {
|
|
244
|
-
|
|
217
|
+
lease.dispose();
|
|
245
218
|
}
|
|
246
|
-
catch { /*
|
|
219
|
+
catch { /* already gone */ }
|
|
247
220
|
}
|
|
248
|
-
|
|
249
|
-
|
|
221
|
+
guestLeases.clear();
|
|
222
|
+
// Only detach sessions we self-attached if we own the broker's lifecycle —
|
|
223
|
+
// a shared/injected broker keeps serving other consumers past our stop().
|
|
224
|
+
if (ownsBroker)
|
|
225
|
+
broker.dispose();
|
|
250
226
|
// Run the late-wired teardown once (render events, dom-ready, 'closed' sub).
|
|
251
227
|
if (lateCleanup) {
|
|
252
228
|
const c = lateCleanup;
|
|
@@ -257,61 +233,12 @@ export function installElementsForward(deps) {
|
|
|
257
233
|
catch { /* already gone */ }
|
|
258
234
|
}
|
|
259
235
|
};
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
try {
|
|
267
|
-
if (!wc.isDestroyed() && wc.debugger.isAttached())
|
|
268
|
-
wc.debugger.detach();
|
|
269
|
-
}
|
|
270
|
-
catch { /* already detached / destroyed */ }
|
|
271
|
-
}
|
|
272
|
-
selfAttached.clear();
|
|
273
|
-
}
|
|
274
|
-
// ── main → front-end dispatch ──────────────────────────────────────────────
|
|
275
|
-
function dispatchToFrontend(message) {
|
|
276
|
-
if (disposed || devtoolsWc.isDestroyed())
|
|
277
|
-
return;
|
|
278
|
-
// Unified settled gate (same predicate as the reconcile tick): an unsettled
|
|
279
|
-
// front-end wipes its state on load anyway, so the message is meaningless
|
|
280
|
-
// there — and the executeJavaScript would queue one did-stop-loading waiter
|
|
281
|
-
// per push (an activePage burst piles them). The post-settle tick re-primes.
|
|
282
|
-
if (!isFrontendSettled(devtoolsWc))
|
|
283
|
-
return;
|
|
284
|
-
let json;
|
|
285
|
-
try {
|
|
286
|
-
json = JSON.stringify(message);
|
|
287
|
-
}
|
|
288
|
-
catch {
|
|
289
|
-
return;
|
|
290
|
-
}
|
|
291
|
-
if (json.length > MAX_SINGLE_DISPATCH_CHARS) {
|
|
292
|
-
const chunks = [];
|
|
293
|
-
for (let i = 0; i < json.length; i += CHUNK_CHARS) {
|
|
294
|
-
chunks.push(json.slice(i, i + CHUNK_CHARS));
|
|
295
|
-
}
|
|
296
|
-
let script;
|
|
297
|
-
try {
|
|
298
|
-
script = buildChunkedDispatchScript(chunks, json.length);
|
|
299
|
-
}
|
|
300
|
-
catch {
|
|
301
|
-
return;
|
|
302
|
-
}
|
|
303
|
-
devtoolsWc.executeJavaScript(script, true).catch(() => { });
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
306
|
-
let script;
|
|
307
|
-
try {
|
|
308
|
-
script = buildDispatchScript(json);
|
|
309
|
-
}
|
|
310
|
-
catch {
|
|
311
|
-
return;
|
|
312
|
-
}
|
|
313
|
-
devtoolsWc.executeJavaScript(script, true).catch(() => { });
|
|
314
|
-
}
|
|
236
|
+
// ── main → front-end dispatch (shared transport, see frontend-dispatch.js) ──
|
|
237
|
+
// Reply to a front-end command id, passing the ORIGINAL id + sessionId
|
|
238
|
+
// straight through (no mapping) — the same settled-gate + chunking +
|
|
239
|
+
// reply-shape contract network-forward's global body gate uses, so the two
|
|
240
|
+
// outbound-gate features can never drift.
|
|
241
|
+
const { dispatchToFrontend, replyResult, replyError } = createFrontendReplyChannel(devtoolsWc, () => disposed);
|
|
315
242
|
/** Tell the front-end its document is stale → it re-pulls lazily (routed). */
|
|
316
243
|
function pushDocumentUpdated() {
|
|
317
244
|
if (disposed || devtoolsWc.isDestroyed())
|
|
@@ -329,32 +256,7 @@ export function installElementsForward(deps) {
|
|
|
329
256
|
}
|
|
330
257
|
devtoolsWc.executeJavaScript(script, true).catch(() => { });
|
|
331
258
|
}
|
|
332
|
-
|
|
333
|
-
* Reply to a front-end command id, passing the ORIGINAL id + sessionId straight
|
|
334
|
-
* through (no mapping). Only the front-end-supplied sessionId is echoed back.
|
|
335
|
-
*/
|
|
336
|
-
function replyResult(cmd, result) {
|
|
337
|
-
const msg = { id: cmd.id, result };
|
|
338
|
-
if (cmd.sessionId)
|
|
339
|
-
msg.sessionId = cmd.sessionId;
|
|
340
|
-
dispatchToFrontend(msg);
|
|
341
|
-
}
|
|
342
|
-
function replyError(cmd, message) {
|
|
343
|
-
const msg = { id: cmd.id, error: { code: -32000, message } };
|
|
344
|
-
if (cmd.sessionId)
|
|
345
|
-
msg.sessionId = cmd.sessionId;
|
|
346
|
-
dispatchToFrontend(msg);
|
|
347
|
-
}
|
|
348
|
-
// ── webContents lookup (id → wc), tolerant of fakes/teardown ────────────────
|
|
349
|
-
function wcFromId(id) {
|
|
350
|
-
try {
|
|
351
|
-
return electronWebContents?.fromId?.(id) ?? null;
|
|
352
|
-
}
|
|
353
|
-
catch {
|
|
354
|
-
return null;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
// ── render-guest CDP session (reuse safe-area's; self-attach only if needed) ─
|
|
259
|
+
// ── render-guest CDP session (via the shared broker) ────────────────────────
|
|
358
260
|
/** The active render guest, re-resolved fresh (pool/page swaps go stale). */
|
|
359
261
|
function activeRenderWc() {
|
|
360
262
|
try {
|
|
@@ -366,107 +268,42 @@ export function installElementsForward(deps) {
|
|
|
366
268
|
}
|
|
367
269
|
}
|
|
368
270
|
/**
|
|
369
|
-
*
|
|
370
|
-
*
|
|
371
|
-
*
|
|
372
|
-
*
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
return true;
|
|
378
|
-
}
|
|
379
|
-
catch {
|
|
380
|
-
return false;
|
|
381
|
-
}
|
|
382
|
-
try {
|
|
383
|
-
wc.debugger.attach('1.3');
|
|
384
|
-
selfAttached.add(wc.id);
|
|
385
|
-
return true;
|
|
386
|
-
}
|
|
387
|
-
catch {
|
|
388
|
-
// Either someone else just attached (race → it IS usable) or attach truly
|
|
389
|
-
// failed. Treat "already attached" as success, anything else as failure.
|
|
390
|
-
try {
|
|
391
|
-
return wc.debugger.isAttached();
|
|
392
|
-
}
|
|
393
|
-
catch {
|
|
394
|
-
return false;
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
/**
|
|
399
|
-
* Add our render-event re-injection listener to a guest's debugger ONCE. DOM./
|
|
400
|
-
* CSS./Overlay./DOMSnapshot./DOMDebugger. EVENTS (no id) from the CURRENT
|
|
401
|
-
* generation are dispatched into the front-end so the Elements panel updates
|
|
402
|
-
* live; events arriving after the generation moved on are dropped. The listener
|
|
403
|
-
* is removed when the guest wc is destroyed (and on stop()).
|
|
271
|
+
* Get-or-create this guest's broker lease and wire our render-event
|
|
272
|
+
* re-injection listener on it ONCE. DOM./CSS./Overlay./DOMSnapshot./
|
|
273
|
+
* DOMDebugger. EVENTS (no id) from the CURRENT generation are dispatched
|
|
274
|
+
* into the front-end so the Elements panel updates live; events arriving
|
|
275
|
+
* after the generation moved on are dropped. `lease.onDetach` — which fires
|
|
276
|
+
* on an external detach OR the guest being destroyed (see cdp-session's
|
|
277
|
+
* design doc) — drops our cache entry so the NEXT call re-acquires fresh
|
|
278
|
+
* instead of operating on a dead lease forever.
|
|
404
279
|
*/
|
|
405
|
-
function
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
280
|
+
function ensureGuestLease(wc) {
|
|
281
|
+
const existing = guestLeases.get(wc.id);
|
|
282
|
+
if (existing)
|
|
283
|
+
return existing;
|
|
284
|
+
const lease = broker.acquire(wc);
|
|
285
|
+
if (!lease)
|
|
286
|
+
return null;
|
|
287
|
+
lease.onMessage((method, params) => {
|
|
409
288
|
if (disposed)
|
|
410
289
|
return;
|
|
411
|
-
// Honour events only while this guest is STILL the active one — checked
|
|
412
|
-
// event, so re-activating a previously-wired guest resumes forwarding.
|
|
290
|
+
// Honour events only while this guest is STILL the active one — checked
|
|
291
|
+
// per event, so re-activating a previously-wired guest resumes forwarding.
|
|
413
292
|
if (!isActiveWcId(wc.id))
|
|
414
293
|
return;
|
|
415
294
|
if (isRenderEventMethod(method)) {
|
|
416
295
|
dispatchToFrontend({ method, params });
|
|
417
296
|
}
|
|
418
|
-
};
|
|
419
|
-
try {
|
|
420
|
-
wc.debugger.on('message', onMessage);
|
|
421
|
-
}
|
|
422
|
-
catch {
|
|
423
|
-
return;
|
|
424
|
-
}
|
|
425
|
-
const onDestroyed = () => {
|
|
426
|
-
const cleanup = wiredGuests.get(wc.id);
|
|
427
|
-
if (cleanup) {
|
|
428
|
-
wiredGuests.delete(wc.id);
|
|
429
|
-
try {
|
|
430
|
-
cleanup();
|
|
431
|
-
}
|
|
432
|
-
catch { /* gone */ }
|
|
433
|
-
}
|
|
434
|
-
// A destroyed guest is no longer the active one, so its in-flight commands
|
|
435
|
-
// fail `isActiveWcId` and settle as errors on their own — no global bump
|
|
436
|
-
// (which would wrongly stale OTHER, still-active guests' commands).
|
|
437
|
-
// If we own this wc's session there is nothing left to detach; drop it.
|
|
438
|
-
selfAttached.delete(wc.id);
|
|
439
|
-
};
|
|
440
|
-
let closedSub;
|
|
441
|
-
try {
|
|
442
|
-
// Route the guest teardown through the connection registry's `'closed'`
|
|
443
|
-
// event when present. Render guests are NEVER pool-reset, so `'closed'`
|
|
444
|
-
// (fires only on real wc destroy) is the correct lifetime — and crucially
|
|
445
|
-
// `on('closed')` returns a handle whose `dispose()` REMOVES the listener
|
|
446
|
-
// WITHOUT firing it, matching the original `removeListener` semantics.
|
|
447
|
-
// (`own()` would fire `onDestroyed` on release AND mutate `wiredGuests`
|
|
448
|
-
// mid-drain in stop() — wrong here; see foundation.md §4.3.) Same
|
|
449
|
-
// try/catch guards a fake/minimal wc that lacks once/emitter wiring.
|
|
450
|
-
if (deps.connections)
|
|
451
|
-
closedSub = deps.connections.acquire(wc).on('closed', onDestroyed);
|
|
452
|
-
else
|
|
453
|
-
wc.once('destroyed', onDestroyed);
|
|
454
|
-
}
|
|
455
|
-
catch { /* fake/minimal wc */ }
|
|
456
|
-
wiredGuests.set(wc.id, () => {
|
|
457
|
-
try {
|
|
458
|
-
wc.debugger.removeListener('message', onMessage);
|
|
459
|
-
}
|
|
460
|
-
catch { /* gone */ }
|
|
461
|
-
try {
|
|
462
|
-
closedSub?.dispose();
|
|
463
|
-
}
|
|
464
|
-
catch { /* gone */ }
|
|
465
|
-
try {
|
|
466
|
-
wc.removeListener('destroyed', onDestroyed);
|
|
467
|
-
}
|
|
468
|
-
catch { /* gone */ }
|
|
469
297
|
});
|
|
298
|
+
lease.onDetach(() => {
|
|
299
|
+
// A destroyed/detached guest is no longer the active one, so its
|
|
300
|
+
// in-flight commands fail `isActiveWcId` and settle as errors on their
|
|
301
|
+
// own — no global bump (which would wrongly stale OTHER, still-active
|
|
302
|
+
// guests' commands).
|
|
303
|
+
guestLeases.delete(wc.id);
|
|
304
|
+
});
|
|
305
|
+
guestLeases.set(wc.id, lease);
|
|
306
|
+
return lease;
|
|
470
307
|
}
|
|
471
308
|
/**
|
|
472
309
|
* enable DOM/CSS/Overlay + wire events on a guest. Best-effort (never throws).
|
|
@@ -478,18 +315,24 @@ export function installElementsForward(deps) {
|
|
|
478
315
|
* the Elements-panel hover highlight never paints. Awaiting DOM.enable first
|
|
479
316
|
* guarantees the correct enable order. CSS.enable has no such dependency and is
|
|
480
317
|
* fire-and-forget alongside.
|
|
318
|
+
*
|
|
319
|
+
* This does NOT delegate to `lease.ensureRenderDomains()`: that helper has no
|
|
320
|
+
* concept of "active guest", but a priming sequence started on a guest that
|
|
321
|
+
* stops being active mid-flight must NOT arm Overlay on the now-abandoned
|
|
322
|
+
* tree (checked again below) — a per-consumer concern only elements-forward
|
|
323
|
+
* has, so it keeps its own sequence, just dispatched through the lease.
|
|
481
324
|
*/
|
|
482
325
|
function primeGuest(wc) {
|
|
483
|
-
|
|
326
|
+
const lease = ensureGuestLease(wc);
|
|
327
|
+
if (!lease)
|
|
484
328
|
return;
|
|
485
|
-
|
|
486
|
-
void enableGuestDomains(wc);
|
|
329
|
+
void enableGuestDomains(wc, lease);
|
|
487
330
|
}
|
|
488
331
|
/** Enable the render domains in dependency order. Resolves; never rejects. */
|
|
489
|
-
async function enableGuestDomains(wc) {
|
|
490
|
-
|
|
332
|
+
async function enableGuestDomains(wc, lease) {
|
|
333
|
+
lease.send('CSS.enable').catch(() => { });
|
|
491
334
|
try {
|
|
492
|
-
await
|
|
335
|
+
await lease.send('DOM.enable');
|
|
493
336
|
}
|
|
494
337
|
catch {
|
|
495
338
|
// Guest mid-destroy or DOM domain unavailable; Overlay.enable would only
|
|
@@ -501,7 +344,7 @@ export function installElementsForward(deps) {
|
|
|
501
344
|
// arming Overlay so a stale/dead guest is left untouched.
|
|
502
345
|
if (disposed || !isActiveWcId(wc.id))
|
|
503
346
|
return;
|
|
504
|
-
|
|
347
|
+
lease.send('Overlay.enable').catch(() => { });
|
|
505
348
|
}
|
|
506
349
|
// ── front-end → render command routing ─────────────────────────────────────
|
|
507
350
|
function routeCommand(cmd) {
|
|
@@ -510,18 +353,18 @@ export function installElementsForward(deps) {
|
|
|
510
353
|
replyError(cmd, 'no active render guest');
|
|
511
354
|
return;
|
|
512
355
|
}
|
|
513
|
-
|
|
356
|
+
const lease = ensureGuestLease(wc);
|
|
357
|
+
if (!lease) {
|
|
514
358
|
replyError(cmd, 'render guest debugger unavailable');
|
|
515
359
|
return;
|
|
516
360
|
}
|
|
517
|
-
wireGuestEvents(wc);
|
|
518
361
|
// The wc this command is dispatched to. A response that resolves after the
|
|
519
362
|
// active guest changed (this wc is no longer active) is for a tree the
|
|
520
363
|
// front-end has abandoned: settle the id with an error (no pending leak) but
|
|
521
364
|
// do NOT feed its result into the new tree.
|
|
522
365
|
const cmdWcId = wc.id;
|
|
523
|
-
|
|
524
|
-
.
|
|
366
|
+
lease
|
|
367
|
+
.send(cmd.method, (cmd.params ?? {}))
|
|
525
368
|
.then((result) => {
|
|
526
369
|
if (disposed)
|
|
527
370
|
return;
|
|
@@ -535,7 +378,7 @@ export function installElementsForward(deps) {
|
|
|
535
378
|
// enabled" and the hover highlight stops painting. Re-arm it so the next
|
|
536
379
|
// hover paints — only while this guest is still the active one.
|
|
537
380
|
if (cmd.method === 'Overlay.disable' && isActiveWcId(cmdWcId)) {
|
|
538
|
-
|
|
381
|
+
lease.send('Overlay.enable').catch(() => { });
|
|
539
382
|
}
|
|
540
383
|
replyResult(cmd, result);
|
|
541
384
|
})
|
|
@@ -545,18 +388,26 @@ export function installElementsForward(deps) {
|
|
|
545
388
|
replyError(cmd, err instanceof Error ? err.message : String(err));
|
|
546
389
|
});
|
|
547
390
|
}
|
|
548
|
-
/**
|
|
391
|
+
/**
|
|
392
|
+
* Answer a network-routed command from the provider. Never touches the render
|
|
393
|
+
* guest: the body lives in the network forwarder's prefetch cache (or
|
|
394
|
+
* nowhere). Shared with network-forward's dedicated global body gate — see
|
|
395
|
+
* answerNetworkBodyCommand's doc comment for the not-found/reply contract.
|
|
396
|
+
*/
|
|
397
|
+
function answerNetworkCommand(cmd) {
|
|
398
|
+
answerNetworkBodyCommand(cmd, deps.network, { replyResult, replyError });
|
|
399
|
+
}
|
|
400
|
+
/** Process a drained batch of front-end commands, splitting by route tag. */
|
|
549
401
|
function handleOutbound(batch) {
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
continue;
|
|
402
|
+
drainOutboundBatch(batch, (cmd) => {
|
|
403
|
+
if (cmd.route === 'network') {
|
|
404
|
+
answerNetworkCommand(cmd);
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
// 'render' — and any untagged legacy payload, which only ever carried
|
|
408
|
+
// render-domain commands.
|
|
558
409
|
routeCommand(cmd);
|
|
559
|
-
}
|
|
410
|
+
});
|
|
560
411
|
}
|
|
561
412
|
// ── follow the active guest across page switches ───────────────────────────
|
|
562
413
|
const onRenderEvent = (event) => {
|