@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,6 +1,7 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { devtoolsPackageRoot } from '../../utils/paths.js';
|
|
4
|
+
import { createCdpSessionBroker } from '../cdp-session/index.js';
|
|
4
5
|
const DEFAULT_SOURCE_PATH = 'dist/render-host/render-inspect.js';
|
|
5
6
|
/**
|
|
6
7
|
* Chrome DevTools' default Elements-panel highlight palette (content / padding /
|
|
@@ -36,13 +37,9 @@ export function createRenderInspector(options = {}) {
|
|
|
36
37
|
(() => readFileSync(path.join(devtoolsPackageRoot, DEFAULT_SOURCE_PATH), 'utf8'));
|
|
37
38
|
let cachedSource = null;
|
|
38
39
|
const injected = new Set();
|
|
39
|
-
//
|
|
40
|
-
//
|
|
41
|
-
|
|
42
|
-
const selfAttached = new Set();
|
|
43
|
-
// Per-wc `DOM.enable → Overlay.enable` handshake, started once and reused so a
|
|
44
|
-
// burst of hovers shares one enable. Cleared when the guest is destroyed.
|
|
45
|
-
const enablePromises = new Map();
|
|
40
|
+
// Shared CDP session broker — owns attach/detach/enable-domain bookkeeping
|
|
41
|
+
// (see cdp-session/index.ts); this module no longer tracks any of that itself.
|
|
42
|
+
const broker = options.broker ?? createCdpSessionBroker({ connections: options.connections });
|
|
46
43
|
function source() {
|
|
47
44
|
if (cachedSource === null)
|
|
48
45
|
cachedSource = loadSource();
|
|
@@ -71,11 +68,10 @@ export function createRenderInspector(options = {}) {
|
|
|
71
68
|
}
|
|
72
69
|
injected.add(wc.id);
|
|
73
70
|
// Consolidate the per-wc bookkeeping teardown onto the connection layer
|
|
74
|
-
// (foundation.md
|
|
71
|
+
// (see foundation.md) when a registry is available; fall back to the
|
|
75
72
|
// bespoke `once('destroyed')` only when omitted (focused unit tests).
|
|
76
73
|
const forget = () => {
|
|
77
74
|
injected.delete(wc.id);
|
|
78
|
-
enablePromises.delete(wc.id);
|
|
79
75
|
};
|
|
80
76
|
if (options.connections) {
|
|
81
77
|
options.connections.acquire(wc).own(forget);
|
|
@@ -91,7 +87,7 @@ export function createRenderInspector(options = {}) {
|
|
|
91
87
|
if (!(await ensureInjected(wc)))
|
|
92
88
|
return null;
|
|
93
89
|
try {
|
|
94
|
-
const result =
|
|
90
|
+
const result = await wc.executeJavaScript('window.__diminaRenderInspect ? window.__diminaRenderInspect.getWxml() : null');
|
|
95
91
|
return result ?? null;
|
|
96
92
|
}
|
|
97
93
|
catch {
|
|
@@ -105,7 +101,7 @@ export function createRenderInspector(options = {}) {
|
|
|
105
101
|
return null;
|
|
106
102
|
let inspection;
|
|
107
103
|
try {
|
|
108
|
-
const result =
|
|
104
|
+
const result = await wc.executeJavaScript(`window.__diminaRenderInspect ? window.__diminaRenderInspect.highlightElement(${JSON.stringify(sid)}) : null`);
|
|
109
105
|
inspection = result ?? null;
|
|
110
106
|
}
|
|
111
107
|
catch {
|
|
@@ -122,16 +118,17 @@ export function createRenderInspector(options = {}) {
|
|
|
122
118
|
/**
|
|
123
119
|
* Paint the Chrome-style native highlight over the guest via CDP — the same
|
|
124
120
|
* `Overlay.highlightNode` the embedded Elements panel uses, so the WXML panel's
|
|
125
|
-
* hover box matches it exactly.
|
|
126
|
-
*
|
|
127
|
-
* attached it) and only
|
|
121
|
+
* hover box matches it exactly. Acquires a lease from the shared broker (see
|
|
122
|
+
* cdp-session/index.ts), which reuses the guest's existing debugger session
|
|
123
|
+
* (safe-area / elements-forward has usually already attached it) and only
|
|
124
|
+
* attaches itself when nobody has.
|
|
128
125
|
*
|
|
129
126
|
* `Overlay.highlightNode` paints only while the Overlay domain is enabled, and
|
|
130
127
|
* Chromium rejects `Overlay.enable` with "DOM should be enabled first" unless
|
|
131
128
|
* DOM is enabled first. On a cold/self-attached session (WXML hovered without
|
|
132
129
|
* the Elements panel ever enabling Overlay) the highlight would silently no-op
|
|
133
|
-
* if the command raced ahead of the enable, so we AWAIT the
|
|
134
|
-
*
|
|
130
|
+
* if the command raced ahead of the enable, so we AWAIT the broker's
|
|
131
|
+
* `ensureRenderDomains()` handshake before highlighting — but only up to
|
|
135
132
|
* `ENABLE_HANDSHAKE_TIMEOUT_MS`, so a hung `DOM.enable` degrades to a missed
|
|
136
133
|
* paint rather than a stuck hover.
|
|
137
134
|
*
|
|
@@ -142,22 +139,23 @@ export function createRenderInspector(options = {}) {
|
|
|
142
139
|
async function drawNativeHighlight(wc, sid) {
|
|
143
140
|
if (wc.isDestroyed())
|
|
144
141
|
return;
|
|
145
|
-
|
|
142
|
+
const lease = broker.acquire(wc);
|
|
143
|
+
if (!lease)
|
|
146
144
|
return;
|
|
147
|
-
await withTimeout(
|
|
145
|
+
await withTimeout(lease.ensureRenderDomains(), ENABLE_HANDSHAKE_TIMEOUT_MS);
|
|
148
146
|
if (wc.isDestroyed())
|
|
149
147
|
return;
|
|
150
148
|
const expression = `window.__diminaRenderInspect && window.__diminaRenderInspect.elementFor(${JSON.stringify(sid)})`;
|
|
151
149
|
try {
|
|
152
|
-
const evaluated =
|
|
150
|
+
const evaluated = await lease.send('Runtime.evaluate', {
|
|
153
151
|
expression,
|
|
154
152
|
returnByValue: false,
|
|
155
153
|
objectGroup: HOVER_OBJECT_GROUP,
|
|
156
|
-
})
|
|
154
|
+
});
|
|
157
155
|
const objectId = evaluated?.result?.objectId;
|
|
158
156
|
if (!objectId)
|
|
159
157
|
return;
|
|
160
|
-
await
|
|
158
|
+
await lease.send('Overlay.highlightNode', {
|
|
161
159
|
objectId,
|
|
162
160
|
highlightConfig: HIGHLIGHT_CONFIG,
|
|
163
161
|
});
|
|
@@ -165,90 +163,11 @@ export function createRenderInspector(options = {}) {
|
|
|
165
163
|
finally {
|
|
166
164
|
// Drop the hover's remote DOM reference so repeated hovers don't accumulate
|
|
167
165
|
// live wrappers in the guest context.
|
|
168
|
-
|
|
169
|
-
.
|
|
166
|
+
lease
|
|
167
|
+
.send('Runtime.releaseObjectGroup', { objectGroup: HOVER_OBJECT_GROUP })
|
|
170
168
|
.catch(() => { });
|
|
171
169
|
}
|
|
172
170
|
}
|
|
173
|
-
/**
|
|
174
|
-
* Ensure the guest's debugger is usable WITHOUT opening a second session: a
|
|
175
|
-
* webContents debugger is single-owner, so reuse the already-attached session
|
|
176
|
-
* (Elements-forward / safe-area) and only `attach('1.3')` when nobody has. The
|
|
177
|
-
* sessions we open ourselves are tracked so guest-destroy detaches only ours.
|
|
178
|
-
* Returns false when the debugger can't be made usable.
|
|
179
|
-
*/
|
|
180
|
-
function ensureGuestDebugger(wc) {
|
|
181
|
-
try {
|
|
182
|
-
if (wc.debugger.isAttached())
|
|
183
|
-
return true;
|
|
184
|
-
}
|
|
185
|
-
catch {
|
|
186
|
-
return false;
|
|
187
|
-
}
|
|
188
|
-
try {
|
|
189
|
-
wc.debugger.attach('1.3');
|
|
190
|
-
trackSelfAttached(wc);
|
|
191
|
-
return true;
|
|
192
|
-
}
|
|
193
|
-
catch {
|
|
194
|
-
// A concurrent attach (race) leaves it usable; anything else is a failure.
|
|
195
|
-
try {
|
|
196
|
-
return wc.debugger.isAttached();
|
|
197
|
-
}
|
|
198
|
-
catch {
|
|
199
|
-
return false;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
/** Record a self-attached session and detach it when the guest is destroyed. */
|
|
204
|
-
function trackSelfAttached(wc) {
|
|
205
|
-
if (selfAttached.has(wc.id))
|
|
206
|
-
return;
|
|
207
|
-
selfAttached.add(wc.id);
|
|
208
|
-
const detach = () => {
|
|
209
|
-
selfAttached.delete(wc.id);
|
|
210
|
-
try {
|
|
211
|
-
if (!wc.isDestroyed() && wc.debugger.isAttached())
|
|
212
|
-
wc.debugger.detach();
|
|
213
|
-
}
|
|
214
|
-
catch { /* already gone */ }
|
|
215
|
-
};
|
|
216
|
-
if (options.connections)
|
|
217
|
-
options.connections.acquire(wc).own(detach);
|
|
218
|
-
else {
|
|
219
|
-
try {
|
|
220
|
-
wc.once('destroyed', () => selfAttached.delete(wc.id));
|
|
221
|
-
}
|
|
222
|
-
catch { /* fake wc */ }
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* Enable the DOM + Overlay render domains in dependency order, ONCE per guest
|
|
227
|
-
* (the promise is cached + reused across hovers). `Overlay.enable` is sent ONLY
|
|
228
|
-
* AFTER `DOM.enable` resolves (Chromium rejects it otherwise). Resolves when
|
|
229
|
-
* Overlay is enabled; a rejection at any step is swallowed (the guest may be
|
|
230
|
-
* mid-teardown) and the cache entry is dropped so a later hover can retry.
|
|
231
|
-
*/
|
|
232
|
-
function ensureDomainsEnabled(wc) {
|
|
233
|
-
const cached = enablePromises.get(wc.id);
|
|
234
|
-
if (cached)
|
|
235
|
-
return cached;
|
|
236
|
-
wc.debugger.sendCommand('CSS.enable').catch(() => { });
|
|
237
|
-
const handshake = wc.debugger
|
|
238
|
-
.sendCommand('DOM.enable')
|
|
239
|
-
.then(() => {
|
|
240
|
-
if (wc.isDestroyed())
|
|
241
|
-
return;
|
|
242
|
-
return wc.debugger.sendCommand('Overlay.enable');
|
|
243
|
-
})
|
|
244
|
-
.then(() => undefined)
|
|
245
|
-
.catch(() => {
|
|
246
|
-
// Allow a retry on the next hover (e.g. the guest was mid-destroy).
|
|
247
|
-
enablePromises.delete(wc.id);
|
|
248
|
-
});
|
|
249
|
-
enablePromises.set(wc.id, handshake);
|
|
250
|
-
return handshake;
|
|
251
|
-
}
|
|
252
171
|
async function unhighlight(wc) {
|
|
253
172
|
if (wc.isDestroyed())
|
|
254
173
|
return;
|
|
@@ -1,19 +1,34 @@
|
|
|
1
1
|
import type { WebContents } from 'electron';
|
|
2
2
|
import type { ConnectionRegistry } from '@dimina-kit/electron-deck/main';
|
|
3
3
|
import type { NativeDeviceInfo } from '../../../shared/ipc-channels.js';
|
|
4
|
+
import { type CdpSessionBroker } from '../cdp-session/index.js';
|
|
5
|
+
/** What the guest's own page contributes to the inset policy: whether the
|
|
6
|
+
* shell draws a navigation bar over the notch for it. */
|
|
7
|
+
export interface GuestPageInsetPolicy {
|
|
8
|
+
isCustomNav: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Read a guest's inset policy off its render-host URL (`navStyle`, written by
|
|
12
|
+
* `buildRenderHostDocumentUrl`). An unparseable URL degrades to the default-nav
|
|
13
|
+
* policy rather than failing the attach.
|
|
14
|
+
*/
|
|
15
|
+
export declare function parseGuestPageInsetPolicy(src: string): GuestPageInsetPolicy;
|
|
4
16
|
export interface SafeAreaController {
|
|
5
17
|
/** Attach the debugger to a freshly-attached render-host guest and push the
|
|
6
|
-
* current device's insets. `
|
|
7
|
-
*
|
|
8
|
-
* guest is already claimed by an external CDP client — env
|
|
9
|
-
|
|
18
|
+
* current device's insets. `page` selects the top policy (real inset only for
|
|
19
|
+
* a custom-nav page); the bottom inset always comes from the device. No-op
|
|
20
|
+
* (warn) if the guest is already claimed by an external CDP client — env
|
|
21
|
+
* then stays 0. */
|
|
22
|
+
applyToGuest(guestWc: WebContents, device: NativeDeviceInfo | null, page: GuestPageInsetPolicy): void;
|
|
10
23
|
/** Re-push insets to every still-attached guest after a device change (each
|
|
11
|
-
* guest keeps the page
|
|
24
|
+
* guest keeps the page policy it attached with). */
|
|
12
25
|
reapplyAll(device: NativeDeviceInfo | null): void;
|
|
13
|
-
/**
|
|
26
|
+
/** Release this controller's session leases (teardown). Does not itself
|
|
27
|
+
* detach the shared debugger session — see cdp-session/index.ts. */
|
|
14
28
|
dispose(): void;
|
|
15
29
|
}
|
|
16
30
|
export declare function createSafeAreaController(options?: {
|
|
17
31
|
connections?: ConnectionRegistry;
|
|
32
|
+
broker?: CdpSessionBroker;
|
|
18
33
|
}): SafeAreaController;
|
|
19
34
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,64 +1,110 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { createCdpSessionBroker } from '../cdp-session/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Read a guest's inset policy off its render-host URL (`navStyle`, written by
|
|
4
|
+
* `buildRenderHostDocumentUrl`). An unparseable URL degrades to the default-nav
|
|
5
|
+
* policy rather than failing the attach.
|
|
6
|
+
*/
|
|
7
|
+
export function parseGuestPageInsetPolicy(src) {
|
|
8
|
+
try {
|
|
9
|
+
const params = new URL(src).searchParams;
|
|
10
|
+
return { isCustomNav: params.get('navStyle') === 'custom' };
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return { isCustomNav: false };
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function guestInsets(device, page) {
|
|
17
|
+
// Only a custom-nav (full-bleed) page borders the unsafe top zone; a
|
|
18
|
+
// default-nav page already starts below the shell nav bar, which covers the
|
|
19
|
+
// notch itself.
|
|
20
|
+
const top = page.isCustomNav ? (device?.safeAreaInsets.top ?? 0) : 0;
|
|
21
|
+
const bottom = device?.safeAreaInsets.bottom ?? 0;
|
|
22
|
+
// Left/right come straight from the device (e.g. a landscape Dynamic Island
|
|
23
|
+
// rotates into a side notch) — unlike top they don't depend on page
|
|
24
|
+
// type, since neither shell chrome nor the tabBar reserves horizontal space.
|
|
25
|
+
const right = device?.safeAreaInsets.right ?? 0;
|
|
26
|
+
const left = device?.safeAreaInsets.left ?? 0;
|
|
27
|
+
return { top, topMax: top, right, rightMax: right, bottom, bottomMax: bottom, left, leftMax: left };
|
|
9
28
|
}
|
|
10
29
|
export function createSafeAreaController(options = {}) {
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
30
|
+
// Own (and dispose on this controller's own dispose()) a private broker
|
|
31
|
+
// only when the caller didn't supply a shared one.
|
|
32
|
+
const ownsBroker = !options.broker;
|
|
33
|
+
// The shared CDP session broker (see cdp-session/index.ts) — reused across
|
|
34
|
+
// safe-area/elements-forward/render-inspect/network-forward when the caller
|
|
35
|
+
// passes one; falls back to a private instance so this module stays
|
|
36
|
+
// independently testable/usable.
|
|
37
|
+
const broker = options.broker ?? createCdpSessionBroker({ connections: options.connections });
|
|
38
|
+
// Each guest's page policy, fixed for its life — tracked SEPARATELY from the
|
|
39
|
+
// lease so a lost session (external detach) doesn't lose the policy: a
|
|
40
|
+
// later `override`/`reapplyAll` can reacquire and keep applying the same
|
|
41
|
+
// policy this guest attached with.
|
|
42
|
+
const pageType = new Map();
|
|
43
|
+
// Current lease per guest, if any. Cleared (not just left stale) on
|
|
44
|
+
// `lease.onDetach` — an external detach or a real Chrome DevTools window
|
|
45
|
+
// stealing the session — so the next `override` reacquires instead of
|
|
46
|
+
// sending through a dead lease forever.
|
|
47
|
+
const leases = new Map();
|
|
48
|
+
/** Get-or-reacquire this guest's lease. Null when the session is unavailable. */
|
|
49
|
+
function ensureLease(wc) {
|
|
50
|
+
const existing = leases.get(wc);
|
|
51
|
+
if (existing)
|
|
52
|
+
return existing;
|
|
53
|
+
const lease = broker.acquire(wc);
|
|
54
|
+
if (!lease)
|
|
55
|
+
return null;
|
|
56
|
+
leases.set(wc, lease);
|
|
57
|
+
lease.onDetach(() => { leases.delete(wc); });
|
|
58
|
+
return lease;
|
|
59
|
+
}
|
|
60
|
+
function override(wc, device, page) {
|
|
16
61
|
if (wc.isDestroyed())
|
|
17
62
|
return;
|
|
18
|
-
|
|
19
|
-
|
|
63
|
+
const lease = ensureLease(wc);
|
|
64
|
+
if (!lease) {
|
|
65
|
+
// Exclusively held elsewhere (e.g. a real Chrome DevTools window via
|
|
66
|
+
// --remote-debugging-port). Degrade: leave env at 0 rather than fail
|
|
67
|
+
// the page.
|
|
68
|
+
console.warn('[safe-area] debugger session unavailable; env(safe-area-inset-*) stays 0');
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
void lease
|
|
72
|
+
.send('Emulation.setSafeAreaInsetsOverride', { insets: guestInsets(device, page) })
|
|
20
73
|
.catch((err) => {
|
|
21
74
|
console.warn('[safe-area] setSafeAreaInsetsOverride failed:', err instanceof Error ? err.message : err);
|
|
22
75
|
});
|
|
23
76
|
}
|
|
24
77
|
return {
|
|
25
|
-
applyToGuest: (wc, device,
|
|
26
|
-
if (!wc || wc.isDestroyed()
|
|
27
|
-
if (wc && !wc.isDestroyed() && attached.has(wc))
|
|
28
|
-
override(wc, device, isTabPage);
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
try {
|
|
32
|
-
wc.debugger.attach('1.3');
|
|
33
|
-
}
|
|
34
|
-
catch (err) {
|
|
35
|
-
// Already attached by an external --remote-debugging-port client (or
|
|
36
|
-
// DevTools). Degrade: leave env at 0 rather than fail the page.
|
|
37
|
-
console.warn('[safe-area] debugger.attach failed; env(safe-area-inset-*) stays 0:', err instanceof Error ? err.message : err);
|
|
78
|
+
applyToGuest: (wc, device, page) => {
|
|
79
|
+
if (!wc || wc.isDestroyed())
|
|
38
80
|
return;
|
|
81
|
+
const isFirstTime = !pageType.has(wc);
|
|
82
|
+
pageType.set(wc, page);
|
|
83
|
+
if (isFirstTime) {
|
|
84
|
+
const forget = () => { pageType.delete(wc); leases.delete(wc); };
|
|
85
|
+
if (options.connections) {
|
|
86
|
+
options.connections.acquire(wc).own(forget);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
wc.once('destroyed', forget);
|
|
90
|
+
}
|
|
39
91
|
}
|
|
40
|
-
|
|
41
|
-
if (options.connections) {
|
|
42
|
-
options.connections.acquire(wc).own(() => attached.delete(wc));
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
wc.once('destroyed', () => attached.delete(wc));
|
|
46
|
-
}
|
|
47
|
-
override(wc, device, isTabPage);
|
|
92
|
+
override(wc, device, page);
|
|
48
93
|
},
|
|
49
94
|
reapplyAll: (device) => {
|
|
50
|
-
for (const [wc,
|
|
51
|
-
override(wc, device,
|
|
95
|
+
for (const [wc, page] of pageType)
|
|
96
|
+
override(wc, device, page);
|
|
52
97
|
},
|
|
53
98
|
dispose: () => {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
99
|
+
// Release our leases only — the shared session's actual detach is the
|
|
100
|
+
// broker's own top-level dispose() to decide (another consumer may
|
|
101
|
+
// still be using it).
|
|
102
|
+
for (const lease of leases.values())
|
|
103
|
+
lease.dispose();
|
|
104
|
+
leases.clear();
|
|
105
|
+
pageType.clear();
|
|
106
|
+
if (ownsBroker)
|
|
107
|
+
broker.dispose();
|
|
62
108
|
},
|
|
63
109
|
};
|
|
64
110
|
}
|
|
@@ -1,197 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* ServiceHostPool — main-process pre-warm pool for simulator host windows.
|
|
4
|
-
*
|
|
5
|
-
* Design source: `packages/devtools/docs/prewarm-webview.md`. WIRED into
|
|
6
|
-
* native-host via `bridge-router.handleSpawn` (acquire) + `disposeAppSession`
|
|
7
|
-
* (release / releaseDestroyed), opt-in behind `DIMINA_PREWARM_POOL_SIZE`
|
|
8
|
-
* (default OFF). Only the SERVICE-HOST window is pooled; the simulator content
|
|
9
|
-
* WebContentsView (`view-manager.attachNativeSimulator`) is created fresh per
|
|
10
|
-
* attach. (A `<webview>`-tag arch is not poolable — Electron can't reparent a
|
|
11
|
-
* pre-warmed WebContents into a `<webview>`.)
|
|
12
|
-
*
|
|
13
|
-
* Lifecycle of a pool entry:
|
|
14
|
-
* warming — BrowserWindow constructed, page loading
|
|
15
|
-
* ready — load settled; can be handed to a caller immediately
|
|
16
|
-
* in-use — acquired by a caller (caller owns the window until release)
|
|
17
|
-
* resetting — released; navigated back to a blank page, then storage cleared
|
|
18
|
-
* disposing — being torn down; removed from the pool
|
|
19
|
-
*
|
|
20
|
-
* ── Phase-3 blockers, both RESOLVED in the wiring (kept here for context) ──
|
|
21
|
-
* 1. Shared-session storage wipe — the service host shares the
|
|
22
|
-
* `persist:simulator` partition with live projects, so clearing it on reset
|
|
23
|
-
* would wipe other projects. Resolved by `ServiceHostSpec.clearStorageOnReset`:
|
|
24
|
-
* `serviceHostSpec()` sets it `false`, so reset only navigates the
|
|
25
|
-
* window to blank (resetting the JS realm) and never clears the shared
|
|
26
|
-
* session; cross-spawn isolation rides on appId-namespacing + fresh nav,
|
|
27
|
-
* matching the already-shared simulator `<webview>` behavior.
|
|
28
|
-
* 2. Warming vs preload contract — warming loads `about:blank` (no bridgeId).
|
|
29
|
-
* `src/service-host/preload.cjs` now idles (early `return`) when `bridgeId`
|
|
30
|
-
* is absent instead of throwing, so a warmed window survives until the real
|
|
31
|
-
* spawn navigation re-runs the preload with a bridgeId.
|
|
32
|
-
*
|
|
33
|
-
* ── Window-death observation ───────────────────────────────────────────────
|
|
34
|
-
* A pooled/in-use window can die three ways: a render crash
|
|
35
|
-
* (`render-process-gone`), a graceful close (`'closed'`), or the owner closing
|
|
36
|
-
* an acquired window (reported via `releaseDestroyed`). All three funnel through
|
|
37
|
-
* `reclaim()`: a POOLED death frees a spare → refill toward target; an IN-USE
|
|
38
|
-
* death is the owner's window → drop the bookkeeping WITHOUT destroying it from
|
|
39
|
-
* under them, and do not refill (the spare count is unaffected).
|
|
40
|
-
*/
|
|
41
|
-
/** Entry state machine (see class doc). */
|
|
42
|
-
export type EntryState = 'warming' | 'ready' | 'in-use' | 'resetting' | 'disposing';
|
|
43
|
-
/**
|
|
44
|
-
* A spec fully determines whether a warm window can serve a caller. Reuse is
|
|
45
|
-
* keyed on `preloadPath`: a different preload means a different runtime surface,
|
|
46
|
-
* so the pool will not hand a mismatched entry to a caller.
|
|
47
|
-
*
|
|
48
|
-
* The process-model flags (`contextIsolation` / `sandbox` / `nodeIntegration`)
|
|
49
|
-
* default to the simulator service-host contract (all `false`, mirroring
|
|
50
|
-
* `createServiceHostWindow`) so a warmed window is a faithful stand-in for the
|
|
51
|
-
* window the caller will actually use. They are part of the spec — not
|
|
52
|
-
* hardcoded — so a caller with a different runtime can override them.
|
|
53
|
-
*/
|
|
54
|
-
export interface ServiceHostSpec {
|
|
55
|
-
/** Session partition for the window. Opaque to the pool (see KNOWN BLOCKER 1). */
|
|
56
|
-
partition: string;
|
|
57
|
-
/** Absolute path to the preload bundle. The reuse key. */
|
|
58
|
-
preloadPath: string;
|
|
59
|
-
/** Initial window size (affects first layout). */
|
|
60
|
-
size?: {
|
|
61
|
-
width: number;
|
|
62
|
-
height: number;
|
|
63
|
-
};
|
|
64
|
-
/** Open DevTools on the window (dev only). */
|
|
65
|
-
devTools?: boolean;
|
|
66
|
-
/** webPreferences.contextIsolation. Default false (service-host contract). */
|
|
67
|
-
contextIsolation?: boolean;
|
|
68
|
-
/** webPreferences.sandbox. Default false (service-host contract). */
|
|
69
|
-
sandbox?: boolean;
|
|
70
|
-
/** webPreferences.nodeIntegration. Default false (service-host contract). */
|
|
71
|
-
nodeIntegration?: boolean;
|
|
72
|
-
/**
|
|
73
|
-
* Whether `release` clears this window's session storage. Default `true`.
|
|
74
|
-
* Set `false` when the window shares a session with live consumers (e.g. the
|
|
75
|
-
* service host on the shared `persist:simulator` partition) — clearing there
|
|
76
|
-
* would wipe other projects' storage. With `false`, reset still navigates the
|
|
77
|
-
* window to a blank page (tearing down the old JS realm); cross-spawn state is
|
|
78
|
-
* handled by appId-namespacing + the fresh navigation, matching the
|
|
79
|
-
* already-shared, never-cleared simulator `<webview>` behavior.
|
|
80
|
-
*/
|
|
81
|
-
clearStorageOnReset?: boolean;
|
|
82
|
-
}
|
|
83
|
-
/** Snapshot of pool occupancy, for dev panels / IPC `prewarm:status`. */
|
|
84
|
-
export interface ServiceHostPoolStats {
|
|
85
|
-
total: number;
|
|
86
|
-
ready: number;
|
|
87
|
-
inUse: number;
|
|
88
|
-
warming: number;
|
|
89
|
-
resetting: number;
|
|
90
|
-
spec: ServiceHostSpec | null;
|
|
91
|
-
}
|
|
92
|
-
export interface ServiceHostPoolInitOptions {
|
|
93
|
-
/** Number of entries to keep warm. Default target after init. */
|
|
94
|
-
defaultPoolSize: number;
|
|
95
|
-
/** Spec used to warm the initial entries. */
|
|
96
|
-
defaultSpec: ServiceHostSpec;
|
|
97
|
-
/** Hard ceiling on pooled entries. Clamped to ≤ 4 (doc §3.3). Default 3. */
|
|
98
|
-
maxPoolSize?: number;
|
|
99
|
-
}
|
|
100
|
-
export declare class ServiceHostPool {
|
|
101
|
-
private readonly entries;
|
|
102
|
-
private currentSpec;
|
|
103
|
-
private targetSize;
|
|
104
|
-
private maxPoolSize;
|
|
105
|
-
private nextId;
|
|
106
|
-
private disposed;
|
|
107
|
-
/**
|
|
108
|
-
* Warm `defaultPoolSize` entries with `defaultSpec`. Normally resolves once the
|
|
109
|
-
* pool has reached `defaultPoolSize` ready entries — even if a warming window
|
|
110
|
-
* crashes mid-init and is refilled. NOTE: `warmUpToTarget` caps its refill loop
|
|
111
|
-
* with a bounded guard, so under SUSTAINED warm crashes `init` resolves
|
|
112
|
-
* best-effort (possibly under-filled) rather than spinning forever — treat
|
|
113
|
-
* `getStats().ready` as advisory after init, not a hard invariant.
|
|
114
|
-
*/
|
|
115
|
-
init(opts: ServiceHostPoolInitOptions): Promise<void>;
|
|
116
|
-
/**
|
|
117
|
-
* Hand a ready window matching `spec` to the caller. If none is ready, fall
|
|
118
|
-
* back to synchronously constructing a fresh window — never blocking on warm
|
|
119
|
-
* (doc §3.1 "绝不阻塞 acquire"). Fallback windows carry `entryId === null` and
|
|
120
|
-
* are destroyed (not pooled) on release.
|
|
121
|
-
*
|
|
122
|
-
* A spec change (different `preloadPath`) tears down all *pooled* entries and
|
|
123
|
-
* re-targets the pool to the new spec; in-use entries are left to their owners
|
|
124
|
-
* and disposed when returned (see `release`).
|
|
125
|
-
*/
|
|
126
|
-
acquire(spec: ServiceHostSpec): Promise<{
|
|
127
|
-
win: BrowserWindow;
|
|
128
|
-
entryId: string | null;
|
|
129
|
-
}>;
|
|
130
|
-
/**
|
|
131
|
-
* Return a window. Fallback windows (`entryId === null`) and entries whose
|
|
132
|
-
* spec no longer matches the current pool spec are torn down. Otherwise the
|
|
133
|
-
* window is reset (navigated to blank, then storage cleared) and re-pooled as
|
|
134
|
-
* `ready`, unless that would exceed `maxPoolSize`.
|
|
135
|
-
*/
|
|
136
|
-
release(entryId: string | null, win: BrowserWindow): Promise<void>;
|
|
137
|
-
/**
|
|
138
|
-
* The owner of an acquired window reports it died externally (graceful close /
|
|
139
|
-
* crash) — reclaim its in-use slot so it isn't leaked in `entries` forever
|
|
140
|
-
* (bridge-router calls this on the `serviceAlreadyClosed` teardown path, where
|
|
141
|
-
* `release` is intentionally skipped). No-op for an unknown id; idempotent;
|
|
142
|
-
* never touches the (already-gone) window.
|
|
143
|
-
*/
|
|
144
|
-
releaseDestroyed(entryId: string | null): void;
|
|
145
|
-
/**
|
|
146
|
-
* Re-target the pool. `target` is clamped to `[0, maxPoolSize]`. Pooled
|
|
147
|
-
* entries beyond the target are disposed OLDEST-FIRST (doc §3.3/§3.6); in-use
|
|
148
|
-
* entries are untouched. Does not warm new entries up (use `init` / refill).
|
|
149
|
-
*/
|
|
150
|
-
resize(target: number): void;
|
|
151
|
-
/** Occupancy snapshot. */
|
|
152
|
-
getStats(): ServiceHostPoolStats;
|
|
153
|
-
/** Tear down every entry and stop accepting work. */
|
|
154
|
-
dispose(): Promise<void>;
|
|
155
|
-
private matches;
|
|
156
|
-
/** ready + warming + resetting entries are "pooled" (owned by the pool). */
|
|
157
|
-
private isWarm;
|
|
158
|
-
private warmCount;
|
|
159
|
-
private readyCount;
|
|
160
|
-
/**
|
|
161
|
-
* Drive the pool to `targetSize` ready entries and resolve only then. Loops so
|
|
162
|
-
* a crash that drops a warming entry mid-init (which refills asynchronously
|
|
163
|
-
* via `onGone`) is awaited too, instead of resolving on a stale snapshot. A
|
|
164
|
-
* generous iteration guard prevents an unbounded spin if windows keep dying.
|
|
165
|
-
*/
|
|
166
|
-
private warmUpToTarget;
|
|
167
|
-
private createWindow;
|
|
168
|
-
private loadBlank;
|
|
169
|
-
/** Construct + load a fresh pooled entry, registering crash recovery. */
|
|
170
|
-
private warmOne;
|
|
171
|
-
/**
|
|
172
|
-
* Reset a released window back to a clean, blank state. Order matters
|
|
173
|
-
* (doc §3.5.3 / §3.4「等待时序」): navigate to blank FIRST so the old document
|
|
174
|
-
* stops running and in-flight requests are aborted, THEN clear storage — so a
|
|
175
|
-
* still-live old page cannot re-populate storage after the clear.
|
|
176
|
-
*/
|
|
177
|
-
private reset;
|
|
178
|
-
/** A spec change tears down pooled entries and re-targets the pool. */
|
|
179
|
-
private onSpecChange;
|
|
180
|
-
/**
|
|
181
|
-
* Reclaim an entry whose window died externally (render crash, graceful close,
|
|
182
|
-
* or an owner-reported destruction). A POOLED death frees a spare → refill
|
|
183
|
-
* toward target; an IN-USE death is the caller's window → drop the bookkeeping
|
|
184
|
-
* WITHOUT destroying it from under them, and do not refill (the spare count is
|
|
185
|
-
* unaffected). `destroyIfPooled` destroys the husk for a pooled render crash
|
|
186
|
-
* (the BrowserWindow object can outlive a dead render process); skip it for a
|
|
187
|
-
* `'closed'`/owner-reported window that is already gone. No-op if the entry was
|
|
188
|
-
* already disposed by us (disposeEntry deletes before its own destroy fires
|
|
189
|
-
* `'closed'`, so this finds nothing).
|
|
190
|
-
*/
|
|
191
|
-
private reclaim;
|
|
192
|
-
/** A pooled window's render process died — reclaim + refill (destroy the husk). */
|
|
193
|
-
private onGone;
|
|
194
|
-
private disposeEntry;
|
|
195
|
-
private destroyWindow;
|
|
196
|
-
}
|
|
1
|
+
export * from '@dimina-kit/electron-runtime/main/service-host-pool';
|
|
197
2
|
//# sourceMappingURL=pool.d.ts.map
|