@dimina-kit/devtools 0.4.0 → 0.5.0-dev.20260908120530
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -660
- package/dist/main/api.d.ts +2 -1
- package/dist/main/app/app.d.ts +41 -12
- package/dist/main/app/app.js +299 -514
- package/dist/main/app/bootstrap.d.ts +8 -5
- package/dist/main/app/bootstrap.js +15 -15
- package/dist/main/app/editor-view.d.ts +21 -0
- package/dist/main/app/editor-view.js +71 -0
- package/dist/main/app/global-mirrors.d.ts +23 -0
- package/dist/main/app/global-mirrors.js +37 -0
- package/dist/main/app/host-sidebar-default.d.ts +19 -0
- package/dist/main/app/host-sidebar-default.js +44 -0
- package/dist/main/app/lifecycle.d.ts +12 -1
- package/dist/main/app/lifecycle.js +27 -1
- package/dist/main/app/menu-setup.d.ts +13 -0
- package/dist/main/app/menu-setup.js +49 -0
- package/dist/main/app/native-overview.d.ts +1 -1
- package/dist/main/app/open-project-ipc.d.ts +13 -0
- package/dist/main/app/open-project-ipc.js +21 -0
- package/dist/main/app/project-list-surface.d.ts +31 -0
- package/dist/main/app/project-list-surface.js +20 -0
- package/dist/main/app/project-window.d.ts +36 -0
- package/dist/main/app/project-window.js +93 -0
- package/dist/main/app/servers.d.ts +17 -0
- package/dist/main/app/servers.js +60 -0
- package/dist/main/app/ui-extension-targets.d.ts +42 -0
- package/dist/main/app/ui-extension-targets.js +101 -0
- package/dist/main/app/window-close-reveal.harness.d.ts +34 -0
- package/dist/main/app/window-close-reveal.harness.js +65 -0
- package/dist/main/app/window-events.d.ts +15 -0
- package/dist/main/app/window-events.js +45 -0
- package/dist/main/app/window-runtime-services.d.ts +41 -0
- package/dist/main/app/window-runtime-services.js +197 -0
- package/dist/main/app/workbench-modules.d.ts +24 -0
- package/dist/main/app/workbench-modules.js +51 -0
- package/dist/main/app/workbench-window.d.ts +85 -0
- package/dist/main/app/workbench-window.js +310 -0
- package/dist/main/index.bundle.js +11712 -9986
- package/dist/main/index.js +49 -1
- package/dist/main/ipc/app-lifecycle.d.ts +1 -31
- package/dist/main/ipc/app-lifecycle.js +1 -53
- package/dist/main/ipc/app.d.ts +4 -1
- package/dist/main/ipc/app.js +4 -3
- package/dist/main/ipc/bridge-router.d.ts +19 -116
- package/dist/main/ipc/bridge-router.js +28 -2128
- package/dist/main/ipc/device-picker.d.ts +16 -0
- package/dist/main/ipc/device-picker.js +27 -0
- package/dist/main/ipc/index.d.ts +5 -0
- package/dist/main/ipc/index.js +5 -0
- package/dist/main/ipc/internal-devtools.d.ts +16 -0
- package/dist/main/ipc/internal-devtools.js +10 -0
- package/dist/main/ipc/page-scroll.d.ts +1 -13
- package/dist/main/ipc/page-scroll.js +1 -16
- package/dist/main/ipc/popover.d.ts +4 -1
- package/dist/main/ipc/popover.js +26 -19
- package/dist/main/ipc/project-create.d.ts +16 -0
- package/dist/main/ipc/project-create.js +27 -0
- package/dist/main/ipc/project-fs.d.ts +38 -3
- package/dist/main/ipc/project-fs.js +53 -22
- package/dist/main/ipc/projects.d.ts +3 -3
- package/dist/main/ipc/projects.js +47 -11
- package/dist/main/ipc/session-listener-bag.d.ts +1 -40
- package/dist/main/ipc/session-listener-bag.js +1 -39
- package/dist/main/ipc/session.d.ts +4 -1
- package/dist/main/ipc/session.js +26 -26
- package/dist/main/ipc/settings.d.ts +4 -1
- package/dist/main/ipc/settings.js +17 -19
- package/dist/main/ipc/simulator-module.d.ts +9 -3
- package/dist/main/ipc/simulator-module.js +13 -10
- package/dist/main/ipc/simulator.d.ts +4 -1
- package/dist/main/ipc/simulator.js +12 -18
- package/dist/main/ipc/tooltip.d.ts +14 -0
- package/dist/main/ipc/tooltip.js +29 -0
- package/dist/main/ipc/views.d.ts +19 -2
- package/dist/main/ipc/views.js +76 -8
- package/dist/main/runtime/devtools-backend-before-quit.harness.d.ts +43 -0
- package/dist/main/runtime/devtools-backend-before-quit.harness.js +87 -0
- package/dist/main/runtime/devtools-backend.js +60 -4
- package/dist/main/runtime/devtools-runtime-mock.harness.d.ts +21 -0
- package/dist/main/runtime/devtools-runtime-mock.harness.js +313 -0
- package/dist/main/runtime/miniapp-runtime.d.ts +91 -22
- package/dist/main/services/app-services.d.ts +62 -0
- package/dist/main/services/app-services.js +64 -0
- package/dist/main/services/automation/connection-target.d.ts +36 -0
- package/dist/main/services/automation/connection-target.js +29 -0
- package/dist/main/services/automation/console-bridge.d.ts +28 -0
- package/dist/main/services/automation/console-bridge.js +91 -0
- package/dist/main/services/automation/handlers/app.js +4 -4
- package/dist/main/services/automation/handlers/element.js +55 -21
- package/dist/main/services/automation/index.d.ts +12 -1
- package/dist/main/services/automation/index.js +54 -133
- package/dist/main/services/cdp-session/index.d.ts +87 -0
- package/dist/main/services/cdp-session/index.js +173 -0
- package/dist/main/services/compile-standby.js +4 -0
- package/dist/main/services/console-forward/cdp-inject.d.ts +18 -0
- package/dist/main/services/console-forward/cdp-inject.js +30 -0
- package/dist/main/services/console-forward/global-console-mirror.d.ts +33 -0
- package/dist/main/services/console-forward/global-console-mirror.js +71 -0
- package/dist/main/services/console-forward/global-diagnostics-mirror.d.ts +33 -0
- package/dist/main/services/console-forward/global-diagnostics-mirror.js +73 -0
- package/dist/main/services/console-forward/index.d.ts +1 -46
- package/dist/main/services/console-forward/index.js +1 -185
- package/dist/main/services/console-forward/internal-log.d.ts +2 -0
- package/dist/main/services/console-forward/internal-log.js +2 -0
- package/dist/main/services/console-forward/open-gated-relay.d.ts +67 -0
- package/dist/main/services/console-forward/open-gated-relay.js +55 -0
- package/dist/main/services/default-adapter.js +1 -1
- package/dist/main/services/diagnostics/index.d.ts +1 -48
- package/dist/main/services/diagnostics/index.js +1 -60
- package/dist/main/services/dimina-resource-server.d.ts +1 -6
- package/dist/main/services/dimina-resource-server.js +1 -98
- package/dist/main/services/elements-forward/index.d.ts +132 -15
- package/dist/main/services/elements-forward/index.js +155 -304
- package/dist/main/services/fs-bridge-protocol.d.ts +61 -0
- package/dist/main/services/fs-bridge-protocol.js +34 -0
- package/dist/main/services/fs-watch-sse.d.ts +40 -0
- package/dist/main/services/fs-watch-sse.js +113 -0
- package/dist/main/services/http-json.d.ts +9 -0
- package/dist/main/services/http-json.js +6 -0
- package/dist/main/services/layout/index.d.ts +11 -0
- package/dist/main/services/layout/index.js +23 -0
- package/dist/main/services/mcp/connection-owner.d.ts +38 -0
- package/dist/main/services/mcp/connection-owner.js +79 -0
- package/dist/main/services/mcp/index.d.ts +3 -1
- package/dist/main/services/mcp/index.js +4 -3
- package/dist/main/services/mcp/opened-project.d.ts +88 -0
- package/dist/main/services/mcp/opened-project.js +60 -0
- package/dist/main/services/mcp/server.d.ts +2 -1
- package/dist/main/services/mcp/server.js +29 -4
- package/dist/main/services/mcp/target-manager.d.ts +71 -23
- package/dist/main/services/mcp/target-manager.js +269 -138
- package/dist/main/services/mcp/target-selection.d.ts +47 -0
- package/dist/main/services/mcp/target-selection.js +71 -0
- package/dist/main/services/mcp/tools/context-tools.js +20 -5
- package/dist/main/services/mcp/tools/project-tools.d.ts +72 -0
- package/dist/main/services/mcp/tools/project-tools.js +133 -0
- package/dist/main/services/module.d.ts +13 -5
- package/dist/main/services/network-forward/body-cache.d.ts +72 -0
- package/dist/main/services/network-forward/body-cache.js +179 -0
- package/dist/main/services/network-forward/frontend-dispatch.d.ts +91 -0
- package/dist/main/services/network-forward/frontend-dispatch.js +148 -0
- package/dist/main/services/network-forward/global-body-gate.d.ts +46 -0
- package/dist/main/services/network-forward/global-body-gate.js +93 -0
- package/dist/main/services/network-forward/global-mirror-test-fixtures.d.ts +48 -0
- package/dist/main/services/network-forward/global-mirror-test-fixtures.js +96 -0
- package/dist/main/services/network-forward/http.d.ts +47 -0
- package/dist/main/services/network-forward/http.js +162 -0
- package/dist/main/services/network-forward/index.d.ts +135 -15
- package/dist/main/services/network-forward/index.js +854 -224
- package/dist/main/services/network-forward/request-ids.d.ts +5 -0
- package/dist/main/services/network-forward/request-ids.js +5 -0
- package/dist/main/services/network-forward/user-facing.d.ts +21 -0
- package/dist/main/services/network-forward/user-facing.js +50 -0
- package/dist/main/services/network-forward/websocket.d.ts +36 -0
- package/dist/main/services/network-forward/websocket.js +120 -0
- package/dist/main/services/notifications/renderer-notifier.d.ts +71 -9
- package/dist/main/services/notifications/renderer-notifier.js +45 -8
- package/dist/main/services/projects/create-project-service.js +19 -5
- package/dist/main/services/projects/local-provider.js +8 -4
- package/dist/main/services/projects/project-repository.d.ts +59 -7
- package/dist/main/services/projects/project-repository.js +285 -51
- package/dist/main/services/projects/types.d.ts +44 -34
- package/dist/main/services/render-inspect/index.d.ts +12 -2
- package/dist/main/services/render-inspect/index.js +21 -102
- package/dist/main/services/safe-area/index.d.ts +21 -6
- package/dist/main/services/safe-area/index.js +92 -46
- package/dist/main/services/service-host-pool/pool.d.ts +1 -196
- package/dist/main/services/service-host-pool/pool.js +1 -363
- package/dist/main/services/settings/index.d.ts +7 -1
- package/dist/main/services/settings/index.js +22 -2
- package/dist/main/services/simulator/custom-apis.d.ts +1 -42
- package/dist/main/services/simulator/custom-apis.js +1 -46
- package/dist/main/services/simulator/referer.d.ts +1 -9
- package/dist/main/services/simulator/referer.js +1 -19
- package/dist/main/services/simulator/ui-extensions.d.ts +21 -0
- package/dist/main/services/simulator/ui-extensions.js +176 -0
- package/dist/main/services/simulator-appdata/index.d.ts +6 -0
- package/dist/main/services/simulator-appdata/index.js +21 -2
- package/dist/main/services/simulator-current-page/index.d.ts +5 -3
- package/dist/main/services/simulator-current-page/index.js +8 -1
- package/dist/main/services/simulator-storage/index.d.ts +34 -5
- package/dist/main/services/simulator-storage/index.js +73 -71
- package/dist/main/services/simulator-storage/service-storage-ops.d.ts +1 -39
- package/dist/main/services/simulator-storage/service-storage-ops.js +1 -66
- package/dist/main/services/simulator-storage/window-scope.d.ts +20 -0
- package/dist/main/services/simulator-storage/window-scope.js +20 -0
- package/dist/main/services/simulator-temp-files/disk.d.ts +1 -54
- package/dist/main/services/simulator-temp-files/disk.js +1 -237
- package/dist/main/services/simulator-temp-files/fs-channels.d.ts +1 -68
- package/dist/main/services/simulator-temp-files/fs-channels.js +1 -107
- package/dist/main/services/simulator-temp-files/index.d.ts +1 -32
- package/dist/main/services/simulator-temp-files/index.js +1 -181
- package/dist/main/services/simulator-temp-files/request-handler.d.ts +1 -29
- package/dist/main/services/simulator-temp-files/request-handler.js +1 -177
- package/dist/main/services/simulator-temp-files/resolver.d.ts +1 -21
- package/dist/main/services/simulator-temp-files/resolver.js +1 -21
- package/dist/main/services/simulator-temp-files/store.d.ts +1 -13
- package/dist/main/services/simulator-temp-files/store.js +1 -23
- package/dist/main/services/update/github-release-checker.js +22 -3
- package/dist/main/services/update/update-manager.d.ts +21 -4
- package/dist/main/services/update/update-manager.js +55 -11
- package/dist/main/services/views/clear-console-filter.d.ts +44 -0
- package/dist/main/services/views/clear-console-filter.js +86 -0
- package/dist/main/services/views/console-filter-test-fixtures.d.ts +94 -0
- package/dist/main/services/views/console-filter-test-fixtures.js +82 -0
- package/dist/main/services/views/console-filter.d.ts +94 -0
- package/dist/main/services/views/console-filter.js +190 -0
- package/dist/main/services/views/devtools-tabs.d.ts +24 -4
- package/dist/main/services/views/devtools-tabs.js +40 -21
- package/dist/main/services/views/frontend-bootstrap-gate.d.ts +59 -0
- package/dist/main/services/views/frontend-bootstrap-gate.js +117 -0
- package/dist/main/services/views/host-dialog-port-channel.d.ts +18 -0
- package/dist/main/services/views/host-dialog-port-channel.js +15 -0
- package/dist/main/services/views/host-dialog-session-runtime.d.ts +10 -0
- package/dist/main/services/views/host-dialog-session-runtime.js +17 -0
- package/dist/main/services/views/host-dialog-view.d.ts +95 -0
- package/dist/main/services/views/host-dialog-view.js +147 -0
- package/dist/main/services/views/host-sidebar-port-channel.d.ts +18 -0
- package/dist/main/services/views/host-sidebar-port-channel.js +15 -0
- package/dist/main/services/views/host-sidebar-session-runtime.d.ts +10 -0
- package/dist/main/services/views/host-sidebar-session-runtime.js +17 -0
- package/dist/main/services/views/host-sidebar-view.d.ts +59 -0
- package/dist/main/services/views/host-sidebar-view.js +44 -0
- package/dist/main/services/views/host-slot-port-channel.d.ts +124 -0
- package/dist/main/services/views/host-slot-port-channel.js +289 -0
- package/dist/main/services/views/host-slot-session-runtime.d.ts +40 -0
- package/dist/main/services/views/host-slot-session-runtime.js +50 -0
- package/dist/main/services/views/host-slot-view.d.ts +109 -0
- package/dist/main/services/views/host-slot-view.js +147 -0
- package/dist/main/services/views/host-toolbar-port-channel.d.ts +6 -91
- package/dist/main/services/views/host-toolbar-port-channel.js +10 -243
- package/dist/main/services/views/host-toolbar-session-runtime.d.ts +5 -30
- package/dist/main/services/views/host-toolbar-session-runtime.js +9 -47
- package/dist/main/services/views/host-toolbar-view.d.ts +34 -7
- package/dist/main/services/views/host-toolbar-view.js +30 -237
- package/dist/main/services/views/managed-web-contents-view.d.ts +48 -0
- package/dist/main/services/views/managed-web-contents-view.js +143 -0
- package/dist/main/services/views/miniapp-partition.d.ts +1 -89
- package/dist/main/services/views/miniapp-partition.js +1 -158
- package/dist/main/services/views/native-simulator-devtools-host.js +206 -68
- package/dist/main/services/views/native-simulator-view.d.ts +6 -0
- package/dist/main/services/views/native-simulator-view.js +47 -40
- package/dist/main/services/views/native-view-tree.d.ts +25 -0
- package/dist/main/services/views/native-view-tree.js +69 -0
- package/dist/main/services/views/overlay-panels-view.d.ts +63 -4
- package/dist/main/services/views/overlay-panels-view.js +257 -108
- package/dist/main/services/views/placement-reconciler.d.ts +18 -18
- package/dist/main/services/views/placement-reconciler.js +91 -29
- package/dist/main/services/views/placement-test-driver.d.ts +27 -0
- package/dist/main/services/views/placement-test-driver.js +29 -0
- package/dist/main/services/views/refresh-styles.d.ts +10 -0
- package/dist/main/services/views/refresh-styles.js +57 -0
- package/dist/main/services/views/simulator-session-policy.d.ts +1 -27
- package/dist/main/services/views/simulator-session-policy.js +1 -98
- package/dist/main/services/views/view-manager-devtools-host-test-fixtures.d.ts +76 -0
- package/dist/main/services/views/view-manager-devtools-host-test-fixtures.js +184 -0
- package/dist/main/services/views/view-manager.d.ts +69 -88
- package/dist/main/services/views/view-manager.js +62 -7
- package/dist/main/services/views/workbench-view.d.ts +2 -0
- package/dist/main/services/views/workbench-view.js +104 -17
- package/dist/main/services/window-contexts/context-router.d.ts +36 -0
- package/dist/main/services/window-contexts/context-router.js +55 -0
- package/dist/main/services/workbench-coi-host.d.ts +52 -0
- package/dist/main/services/workbench-coi-host.js +227 -0
- package/dist/main/services/workbench-coi-server.d.ts +11 -0
- package/dist/main/services/workbench-coi-server.js +126 -126
- package/dist/main/services/workbench-coi-shutdown.d.ts +40 -0
- package/dist/main/services/workbench-coi-shutdown.js +69 -0
- package/dist/main/services/workbench-coi-static.d.ts +23 -0
- package/dist/main/services/workbench-coi-static.js +87 -0
- package/dist/main/services/workbench-context.d.ts +88 -8
- package/dist/main/services/workbench-context.js +54 -6
- package/dist/main/services/workspace/compile-log-buffer.d.ts +40 -0
- package/dist/main/services/workspace/compile-log-buffer.js +41 -0
- package/dist/main/services/workspace/compile-mode-adapter.d.ts +18 -0
- package/dist/main/services/workspace/compile-mode-adapter.js +57 -0
- package/dist/main/services/workspace/compile-mode-store.d.ts +25 -0
- package/dist/main/services/workspace/compile-mode-store.js +71 -0
- package/dist/main/services/workspace/open-project-guards.d.ts +16 -0
- package/dist/main/services/workspace/open-project-guards.js +42 -0
- package/dist/main/services/workspace/rebuild-status.d.ts +37 -0
- package/dist/main/services/workspace/rebuild-status.js +36 -0
- package/dist/main/services/workspace/session-status-store.d.ts +47 -0
- package/dist/main/services/workspace/session-status-store.js +73 -0
- package/dist/main/services/workspace/status-tap.d.ts +20 -0
- package/dist/main/services/workspace/status-tap.js +32 -0
- package/dist/main/services/workspace/workspace-compile-modes.d.ts +59 -0
- package/dist/main/services/workspace/workspace-compile-modes.js +93 -0
- package/dist/main/services/workspace/workspace-lifecycle-race.testutil.d.ts +22 -0
- package/dist/main/services/workspace/workspace-lifecycle-race.testutil.js +62 -0
- package/dist/main/services/workspace/workspace-referer.d.ts +17 -0
- package/dist/main/services/workspace/workspace-referer.js +26 -0
- package/dist/main/services/workspace/workspace-service.d.ts +7 -5
- package/dist/main/services/workspace/workspace-service.js +96 -135
- package/dist/main/services/workspace/workspace-thumbnails.d.ts +22 -0
- package/dist/main/services/workspace/workspace-thumbnails.js +67 -0
- package/dist/main/utils/ipc-context-source.d.ts +40 -0
- package/dist/main/utils/ipc-context-source.js +23 -0
- package/dist/main/utils/ipc-registry.d.ts +46 -21
- package/dist/main/utils/ipc-registry.js +166 -76
- package/dist/main/utils/paths.d.ts +18 -0
- package/dist/main/utils/paths.js +18 -0
- package/dist/main/utils/sender-policy.d.ts +10 -1
- package/dist/main/utils/sender-policy.js +42 -4
- package/dist/main/utils/theme.d.ts +18 -8
- package/dist/main/utils/theme.js +19 -9
- package/dist/main/windows/internal-devtools-window/index.d.ts +66 -0
- package/dist/main/windows/internal-devtools-window/index.js +160 -0
- package/dist/main/windows/main-window/create.d.ts +16 -0
- package/dist/main/windows/main-window/create.js +19 -11
- package/dist/main/windows/main-window/events.d.ts +1 -1
- package/dist/main/windows/main-window/events.js +26 -13
- package/dist/main/windows/main-window/index.d.ts +1 -1
- package/dist/main/windows/main-window/index.js +1 -1
- package/dist/main/windows/service-host-window/create.d.ts +1 -92
- package/dist/main/windows/service-host-window/create.js +1 -154
- package/dist/native-host/common/common.js +173 -53
- package/dist/native-host/container/pageFrame.css +1 -1
- package/dist/native-host/render/render.js +8278 -3659
- package/dist/native-host/service/service.js +2 -2
- package/dist/preload/index.d.ts +2 -0
- package/dist/preload/index.js +1 -0
- package/dist/preload/instrumentation/app-data.d.ts +2 -2
- package/dist/preload/instrumentation/app-data.js +1 -1
- package/dist/preload/instrumentation/wxml.js +1 -1
- package/dist/preload/runtime/bridge.d.ts +3 -3
- package/dist/preload/runtime/bridge.js +2 -2
- package/dist/preload/runtime/clipboard.d.ts +6 -0
- package/dist/preload/runtime/clipboard.js +12 -0
- package/dist/preload/runtime/host-dialog-advertiser.d.ts +22 -0
- package/dist/preload/runtime/host-dialog-advertiser.js +37 -0
- package/dist/preload/runtime/host-dialog-port.d.ts +44 -0
- package/dist/preload/runtime/host-dialog-port.js +53 -0
- package/dist/preload/runtime/host-dialog-runtime.d.ts +28 -0
- package/dist/preload/runtime/host-dialog-runtime.js +36 -0
- package/dist/preload/runtime/host-sidebar-advertiser.d.ts +19 -0
- package/dist/preload/runtime/host-sidebar-advertiser.js +35 -0
- package/dist/preload/runtime/host-sidebar-port.d.ts +44 -0
- package/dist/preload/runtime/host-sidebar-port.js +53 -0
- package/dist/preload/runtime/host-sidebar-runtime.d.ts +28 -0
- package/dist/preload/runtime/host-sidebar-runtime.js +36 -0
- package/dist/preload/runtime/host-slot-port-bridge.d.ts +18 -0
- package/dist/preload/runtime/host-slot-port-bridge.js +112 -0
- package/dist/preload/runtime/host-toolbar-advertiser.d.ts +5 -13
- package/dist/preload/runtime/host-toolbar-advertiser.js +18 -38
- package/dist/preload/runtime/host-toolbar-port.d.ts +9 -0
- package/dist/preload/runtime/host-toolbar-port.js +11 -95
- package/dist/preload/runtime/native-host.d.ts +14 -0
- package/dist/preload/runtime/native-host.js +5 -8
- package/dist/preload/runtime/node-bindings.d.ts +18 -0
- package/dist/preload/runtime/node-bindings.js +44 -0
- package/dist/preload/runtime/temp-files.js +9 -2
- package/dist/preload/runtime/wait-for-slot-root.d.ts +23 -0
- package/dist/preload/runtime/wait-for-slot-root.js +80 -0
- package/dist/preload/shared/api-compat.js +63 -41
- package/dist/preload/windows/host-dialog-runtime.cjs +360 -0
- package/dist/preload/windows/host-dialog-runtime.cjs.map +7 -0
- package/dist/preload/windows/host-dialog-runtime.d.ts +2 -0
- package/dist/preload/windows/host-dialog-runtime.js +13 -0
- package/dist/preload/windows/host-sidebar-runtime.cjs +361 -0
- package/dist/preload/windows/host-sidebar-runtime.cjs.map +7 -0
- package/dist/preload/windows/host-sidebar-runtime.d.ts +2 -0
- package/dist/preload/windows/host-sidebar-runtime.js +13 -0
- package/dist/preload/windows/host-toolbar-runtime.cjs +142 -52
- package/dist/preload/windows/host-toolbar-runtime.cjs.map +3 -3
- package/dist/preload/windows/main.cjs +4922 -1246
- package/dist/preload/windows/main.cjs.map +4 -4
- package/dist/preload/windows/main.css +428 -0
- package/dist/preload/windows/main.css.map +7 -0
- package/dist/preload/windows/simulator.cjs +376 -322
- package/dist/preload/windows/simulator.cjs.map +4 -4
- package/dist/preload/windows/simulator.js +376 -322
- package/dist/render-host/pageFrame.html +4 -4
- package/dist/render-host/preload.cjs +30 -0
- package/dist/render-host/render-inspect.js +184 -115
- package/dist/renderer/assets/button-CB2MWjHY.js +2 -0
- package/dist/renderer/assets/constants-CkoGPQTS.js +2 -0
- package/dist/renderer/assets/constants-zQZ2-y21.js +2 -0
- package/dist/renderer/assets/createLucideIcon-cZ9FlZZw.js +2 -0
- package/dist/renderer/assets/devicePicker-H2eIO4e1.js +2 -0
- package/dist/renderer/assets/dialog-pHzEA8Vx.js +46 -0
- package/dist/renderer/assets/dist-B5HADirS.js +2 -0
- package/dist/renderer/assets/dist-DIFlRMKe.js +2 -0
- package/dist/renderer/assets/hostSidebarDefault-DRWh6OCt.js +2 -0
- package/dist/renderer/assets/index-CEL_XFge.js +2 -0
- package/dist/renderer/assets/input-CAObw95L.js +2 -0
- package/dist/renderer/assets/ipc-channels-overlays-gIPUFnqc.js +2 -0
- package/dist/renderer/assets/jsx-runtime-DICEQH_0.css +1 -0
- package/dist/renderer/assets/jsx-runtime-DIw5wnYl.js +9 -0
- package/dist/renderer/assets/plus-BQ9u5EbL.js +2 -0
- package/dist/renderer/assets/popover-Cw7G2Ctp.js +2 -0
- package/dist/renderer/assets/presets-DMZOb9ay.js +2 -0
- package/dist/renderer/assets/project-api-YTOr_Yvo.js +2 -0
- package/dist/renderer/assets/projectCreateDialog-BmLqiYxn.js +2 -0
- package/dist/renderer/assets/search-BMvuYF48.js +2 -0
- package/dist/renderer/assets/select-nFP95TxM.js +2 -0
- package/dist/renderer/assets/settings-CnpVfSWt.js +2 -0
- package/dist/renderer/assets/settings-api-Ccsf-Nsj.js +2 -0
- package/dist/renderer/assets/settings-tab-bar-CAzrv32m.js +2 -0
- package/dist/renderer/assets/smartphone-Bb2GdIKy.js +2 -0
- package/dist/renderer/assets/tabs-CPKN3Mmq.js +2 -0
- package/dist/renderer/assets/tooltip-D6AxXRk5.js +2 -0
- package/dist/renderer/assets/types-Bh0hA7El.js +2 -0
- package/dist/renderer/assets/updateDialog-CwndJ0Bl.js +2 -0
- package/dist/renderer/assets/utils-sEB5OZEQ.js +2 -0
- package/dist/renderer/assets/view-api-B-2zPBR5.js +2 -0
- package/dist/renderer/assets/view-ids-BfaDVV5P.js +2 -0
- package/dist/renderer/assets/workbench-C0Jkdlps.js +5 -0
- package/dist/renderer/assets/workbenchSettings-YD0Ctbm_.js +8 -0
- package/dist/renderer/entries/device-picker/index.html +28 -0
- package/dist/renderer/entries/host-sidebar-default/index.html +22 -0
- package/dist/renderer/entries/main/index.html +16 -7
- package/dist/renderer/entries/popover/index.html +16 -6
- package/dist/renderer/entries/project-create-dialog/index.html +27 -0
- package/dist/renderer/entries/settings/index.html +10 -5
- package/dist/renderer/entries/tooltip/index.html +21 -0
- package/dist/renderer/entries/update-dialog/index.html +25 -0
- package/dist/renderer/entries/workbench/index.html +49 -0
- package/dist/renderer/entries/workbench-settings/index.html +12 -5
- package/dist/service-host/appdata-set-data.cjs +39 -0
- package/dist/service-host/host-env-update.cjs +23 -0
- package/dist/service-host/preload.cjs +54 -48
- package/dist/service-host/service-message-queue.cjs +71 -0
- package/dist/service-host/sync-impls/menu-button-geometry.js +16 -5
- package/dist/service-host/sync-impls/menu-button.js +5 -3
- package/dist/service-host/sync-impls/system-info.js +31 -9
- package/dist/shared/bridge-channels.d.ts +1 -416
- package/dist/shared/bridge-channels.js +1 -89
- package/dist/shared/compile-mode-state.d.ts +73 -0
- package/dist/shared/compile-mode-state.js +100 -0
- package/dist/shared/compile-modes.d.ts +152 -0
- package/dist/shared/compile-modes.js +237 -0
- package/dist/shared/constants.d.ts +22 -0
- package/dist/shared/constants.js +22 -0
- package/dist/shared/dmb-resource-url.d.ts +2 -0
- package/dist/shared/dmb-resource-url.js +2 -0
- package/dist/shared/ipc-channels-overlays.d.ts +162 -0
- package/dist/shared/ipc-channels-overlays.js +203 -0
- package/dist/shared/ipc-channels.d.ts +24 -154
- package/dist/shared/ipc-channels.js +48 -96
- package/dist/shared/ipc-schemas.d.ts +143 -54
- package/dist/shared/ipc-schemas.js +137 -45
- package/dist/shared/node-bindings.d.ts +2 -0
- package/dist/shared/node-bindings.js +2 -0
- package/dist/shared/project-window-types.d.ts +42 -0
- package/dist/shared/project-window-types.js +2 -0
- package/dist/shared/simulator-route.d.ts +8 -0
- package/dist/shared/simulator-route.js +15 -0
- package/dist/shared/simulator-ui.d.ts +61 -0
- package/dist/shared/simulator-ui.js +12 -0
- package/dist/shared/types.d.ts +126 -41
- package/dist/shared/view-ids.d.ts +10 -0
- package/dist/shared/view-ids.js +23 -0
- package/dist/simulator/assets/bridge-channels-B3JAmRfl.js +2 -0
- package/dist/simulator/assets/device-shell-ATEhHV2_.css +1 -0
- package/dist/simulator/assets/device-shell-DucLepkm.js +431 -0
- package/dist/simulator/assets/simulator-B4rbcOVt.js +10 -0
- package/dist/simulator/assets/simulator-mini-app-DFo7fhi5.js +2 -0
- package/dist/simulator/assets/simulator-ui-BupATgKo.css +1 -0
- package/dist/simulator/assets/simulator-ui-i3GCc7YJ.js +2 -0
- package/dist/simulator/simulator.html +4 -3
- package/dist/simulator/temp-files.d.ts +35 -0
- package/dist/simulator/temp-files.js +121 -0
- package/dist/simulator/types.d.ts +50 -0
- package/dist/simulator/types.js +2 -0
- package/dist/vscode-workbench/assets/__vite-browser-external-JIkWewFf.js +1 -0
- package/dist/vscode-workbench/assets/{dist-TpGpmMGi.js → dist-CXG-u1VB.js} +3 -3
- package/dist/vscode-workbench/assets/fs-core-worker-urls-DZ1nod84.js +1 -0
- package/dist/vscode-workbench/assets/fs-core.worker-Bnmpp6fo.js +1 -0
- package/dist/vscode-workbench/assets/fs-query.worker-cZ-7Fjch.js +2 -0
- package/dist/vscode-workbench/assets/{iconv-lite-umd-C9tiCAJa.js → iconv-lite-umd-Dxx9Qyb4.js} +1 -1
- package/dist/vscode-workbench/assets/{index-DJ1HyMZ7.js → index-6VJMsaWj.js} +475 -475
- package/dist/vscode-workbench/assets/{jschardet-DE1jV513.js → jschardet-Ba3D16vt.js} +1 -1
- package/dist/vscode-workbench/index.html +21 -1
- package/package.json +23 -13
- package/dist/main/services/views/destroy-child-view.d.ts +0 -9
- package/dist/main/services/views/destroy-child-view.js +0 -23
- package/dist/preload/instrumentation/wxml-extract.d.ts +0 -11
- package/dist/preload/instrumentation/wxml-extract.js +0 -382
- package/dist/preload/shared/sid-registry.d.ts +0 -11
- package/dist/preload/shared/sid-registry.js +0 -38
- package/dist/renderer/assets/constants-EAMiwL9_.js +0 -2
- package/dist/renderer/assets/index-BMqyDx71.js +0 -49
- package/dist/renderer/assets/input-CDAEwpBO.js +0 -2
- package/dist/renderer/assets/ipc-transport-B7eFOR68.css +0 -1
- package/dist/renderer/assets/ipc-transport-_G1k5V1p.js +0 -9
- package/dist/renderer/assets/popover-DEdjK14m.js +0 -2
- package/dist/renderer/assets/select-DpKPCh3y.js +0 -2
- package/dist/renderer/assets/settings-M5q2elUr.js +0 -2
- package/dist/renderer/assets/settings-api-CDlZoHiO.js +0 -2
- package/dist/renderer/assets/workbenchSettings-CT_H1WhV.js +0 -8
- package/dist/shared/appdata-accumulator.d.ts +0 -95
- package/dist/shared/appdata-accumulator.js +0 -218
- package/dist/shared/request-core.d.ts +0 -84
- package/dist/shared/request-core.js +0 -168
- package/dist/shared/simulator-api-metadata.d.ts +0 -26
- package/dist/shared/simulator-api-metadata.js +0 -59
- package/dist/shared/vpath.d.ts +0 -42
- package/dist/shared/vpath.js +0 -105
- package/dist/simulator/assets/bridge-channels-zhsumfky.js +0 -2
- package/dist/simulator/assets/device-shell-C-wcFq3Z.js +0 -2
- package/dist/simulator/assets/device-shell-CS1rqAQz.css +0 -1
- package/dist/simulator/assets/jsx-runtime-BDTY6fEq.js +0 -2
- package/dist/simulator/assets/simulator-DU3-fS3v.js +0 -10
- package/dist/simulator/assets/simulator-mini-app-DzfMfnVM.js +0 -2
- package/dist/simulator/device-shell/menu-button-geometry.js +0 -8
- package/dist/vscode-workbench/assets/__vite-browser-external-CXi6Kz9W.js +0 -1
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { isAbsolute } from 'node:path';
|
|
3
|
+
import { pathToFileURL } from 'node:url';
|
|
4
|
+
const EXTENSION_ID_RE = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
5
|
+
/**
|
|
6
|
+
* The rules a registration has to satisfy on its own, with no window and no
|
|
7
|
+
* renderer involved: the id is a lookup key on both sides of the bridge, and
|
|
8
|
+
* the script is read straight from disk with no base to resolve against. They
|
|
9
|
+
* hold wherever a registration is accepted, so whoever accepts one first is
|
|
10
|
+
* where a host learns it is unusable.
|
|
11
|
+
*/
|
|
12
|
+
export function assertSimulatorUiExtensionShape(registration) {
|
|
13
|
+
if (!EXTENSION_ID_RE.test(registration.id)) {
|
|
14
|
+
throw new Error(`Invalid simulator UI extension id: "${registration.id}"`);
|
|
15
|
+
}
|
|
16
|
+
if (!isAbsolute(registration.rendererScriptPath)) {
|
|
17
|
+
throw new Error('Simulator UI extension rendererScriptPath must be absolute');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export function createSimulatorUiExtensionRegistry(options = {}) {
|
|
21
|
+
const loadSource = options.loadSource ?? (scriptPath => readFile(scriptPath, 'utf8'));
|
|
22
|
+
const entries = new Map();
|
|
23
|
+
let active = null;
|
|
24
|
+
function assertRegistration(registration) {
|
|
25
|
+
assertSimulatorUiExtensionShape(registration);
|
|
26
|
+
if (entries.has(registration.id)) {
|
|
27
|
+
throw new Error(`Simulator UI extension "${registration.id}" is already registered`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function activeExpression(method, args) {
|
|
31
|
+
return `globalThis.__diminaSimulatorUi.${method}(${args.map(arg => JSON.stringify(arg)).join(',')})`;
|
|
32
|
+
}
|
|
33
|
+
async function install(entry, target) {
|
|
34
|
+
const { id, rendererScriptPath } = entry.registration;
|
|
35
|
+
if (target.loaded.has(id))
|
|
36
|
+
return;
|
|
37
|
+
const pending = target.loading.get(id);
|
|
38
|
+
if (pending)
|
|
39
|
+
return await pending;
|
|
40
|
+
const generation = target.generation;
|
|
41
|
+
const task = (async () => {
|
|
42
|
+
// Read once per simulator document generation so downstream watch builds
|
|
43
|
+
// become visible after a hard reload without restarting the workbench.
|
|
44
|
+
const source = await loadSource(rendererScriptPath);
|
|
45
|
+
if (entries.get(id) !== entry
|
|
46
|
+
||
|
|
47
|
+
active !== target
|
|
48
|
+
|| target.webContents.isDestroyed()
|
|
49
|
+
|| !target.ready
|
|
50
|
+
|| target.generation !== generation) {
|
|
51
|
+
throw new Error('Simulator UI extension target is no longer available');
|
|
52
|
+
}
|
|
53
|
+
const sourceUrl = pathToFileURL(rendererScriptPath).href;
|
|
54
|
+
const wrapped = `(()=>{\n${source}\n;return undefined\n})()\n//# sourceURL=${sourceUrl}`;
|
|
55
|
+
await target.webContents.executeJavaScript(wrapped, true);
|
|
56
|
+
if (entries.get(id) !== entry
|
|
57
|
+
||
|
|
58
|
+
active !== target
|
|
59
|
+
|| target.webContents.isDestroyed()
|
|
60
|
+
|| !target.ready
|
|
61
|
+
|| target.generation !== generation) {
|
|
62
|
+
throw new Error('Simulator UI extension target was destroyed during installation');
|
|
63
|
+
}
|
|
64
|
+
const registered = await target.webContents.executeJavaScript(`Boolean(globalThis.__diminaSimulatorUi?.has(${JSON.stringify(id)}))`, true);
|
|
65
|
+
if (!registered) {
|
|
66
|
+
throw new Error(`Simulator UI extension "${id}" did not register its renderer implementation`);
|
|
67
|
+
}
|
|
68
|
+
target.loaded.add(id);
|
|
69
|
+
})().finally(() => {
|
|
70
|
+
if (target.loading.get(id) === task)
|
|
71
|
+
target.loading.delete(id);
|
|
72
|
+
});
|
|
73
|
+
target.loading.set(id, task);
|
|
74
|
+
return await task;
|
|
75
|
+
}
|
|
76
|
+
async function installAll(target) {
|
|
77
|
+
for (const entry of entries.values()) {
|
|
78
|
+
try {
|
|
79
|
+
await install(entry, target);
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
console.warn(`[simulator-ui] failed to install "${entry.registration.id}":`, error instanceof Error ? error.message : String(error));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function uninstall(id, target = active) {
|
|
87
|
+
if (!target)
|
|
88
|
+
return;
|
|
89
|
+
target.loaded.delete(id);
|
|
90
|
+
target.loading.delete(id);
|
|
91
|
+
if (!target.ready || target.webContents.isDestroyed())
|
|
92
|
+
return;
|
|
93
|
+
void target.webContents.executeJavaScript(`globalThis.__diminaSimulatorUi?.unregister(${JSON.stringify(id)})`, true).catch(() => { });
|
|
94
|
+
}
|
|
95
|
+
function detach(webContents) {
|
|
96
|
+
const target = active;
|
|
97
|
+
if (!target || (webContents && target.webContents !== webContents))
|
|
98
|
+
return;
|
|
99
|
+
active = null;
|
|
100
|
+
if (!target.webContents.isDestroyed()) {
|
|
101
|
+
target.webContents.removeListener('did-finish-load', target.onLoaded);
|
|
102
|
+
}
|
|
103
|
+
target.loaded.clear();
|
|
104
|
+
target.loading.clear();
|
|
105
|
+
}
|
|
106
|
+
function attach(webContents) {
|
|
107
|
+
detach();
|
|
108
|
+
const target = {
|
|
109
|
+
webContents,
|
|
110
|
+
ready: false,
|
|
111
|
+
generation: 0,
|
|
112
|
+
loaded: new Set(),
|
|
113
|
+
loading: new Map(),
|
|
114
|
+
onLoaded: () => { },
|
|
115
|
+
};
|
|
116
|
+
target.onLoaded = () => {
|
|
117
|
+
if (active !== target || webContents.isDestroyed())
|
|
118
|
+
return;
|
|
119
|
+
target.ready = true;
|
|
120
|
+
target.generation += 1;
|
|
121
|
+
target.loaded.clear();
|
|
122
|
+
target.loading.clear();
|
|
123
|
+
void installAll(target);
|
|
124
|
+
};
|
|
125
|
+
active = target;
|
|
126
|
+
webContents.on('did-finish-load', target.onLoaded);
|
|
127
|
+
}
|
|
128
|
+
function register(registration) {
|
|
129
|
+
assertRegistration(registration);
|
|
130
|
+
const stableRegistration = { ...registration };
|
|
131
|
+
const entry = {
|
|
132
|
+
registration: stableRegistration,
|
|
133
|
+
};
|
|
134
|
+
entries.set(stableRegistration.id, entry);
|
|
135
|
+
const target = active;
|
|
136
|
+
if (target?.ready) {
|
|
137
|
+
void install(entry, target).catch((error) => {
|
|
138
|
+
console.warn(`[simulator-ui] failed to install "${stableRegistration.id}":`, error instanceof Error ? error.message : String(error));
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
let disposed = false;
|
|
142
|
+
return {
|
|
143
|
+
dispose() {
|
|
144
|
+
if (disposed)
|
|
145
|
+
return;
|
|
146
|
+
disposed = true;
|
|
147
|
+
if (entries.get(stableRegistration.id) !== entry)
|
|
148
|
+
return;
|
|
149
|
+
entries.delete(stableRegistration.id);
|
|
150
|
+
uninstall(stableRegistration.id);
|
|
151
|
+
},
|
|
152
|
+
async invoke(method, params) {
|
|
153
|
+
if (disposed || entries.get(stableRegistration.id) !== entry) {
|
|
154
|
+
throw new Error(`Simulator UI extension "${stableRegistration.id}" is disposed`);
|
|
155
|
+
}
|
|
156
|
+
const current = active;
|
|
157
|
+
if (!current || current.webContents.isDestroyed() || !current.ready) {
|
|
158
|
+
throw new Error('Dimina simulator UI is not ready');
|
|
159
|
+
}
|
|
160
|
+
await install(entry, current);
|
|
161
|
+
if (active !== current || current.webContents.isDestroyed()) {
|
|
162
|
+
throw new Error('Dimina simulator UI was replaced during invocation');
|
|
163
|
+
}
|
|
164
|
+
return await current.webContents.executeJavaScript(activeExpression('invoke', [stableRegistration.id, method, params ?? null]), true);
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
function clear() {
|
|
169
|
+
for (const id of entries.keys())
|
|
170
|
+
uninstall(id);
|
|
171
|
+
entries.clear();
|
|
172
|
+
detach();
|
|
173
|
+
}
|
|
174
|
+
return { register, attach, detach, clear };
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=ui-extensions.js.map
|
|
@@ -30,6 +30,12 @@ export interface SimulatorAppDataService extends AppDataTap, Disposable {
|
|
|
30
30
|
export interface SimulatorAppDataOptions {
|
|
31
31
|
getActiveAppId: () => string | null;
|
|
32
32
|
senderPolicy?: SenderPolicy;
|
|
33
|
+
/** Resolves the service-host WebContents owning a page bridge — the SetData
|
|
34
|
+
* write-back target. Absent (host without a service bridge) → edits are
|
|
35
|
+
* rejected with `false`. */
|
|
36
|
+
bridge?: {
|
|
37
|
+
getServiceWcForBridge: (bridgeId: string) => WebContents | null;
|
|
38
|
+
};
|
|
33
39
|
}
|
|
34
40
|
export declare function setupSimulatorAppData(host: WebContents, options: SimulatorAppDataOptions): SimulatorAppDataService;
|
|
35
41
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SimulatorAppDataChannel } from '../../../shared/ipc-channels.js';
|
|
2
|
-
import { AppDataAccumulator, decodeWorkerMessage, decodedToInput, } from '
|
|
1
|
+
import { ServiceHostChannel, SimulatorAppDataChannel } from '../../../shared/ipc-channels.js';
|
|
2
|
+
import { AppDataAccumulator, decodeWorkerMessage, decodedToInput, } from '@dimina-kit/inspect';
|
|
3
3
|
import { DisposableRegistry } from '@dimina-kit/electron-deck/main';
|
|
4
4
|
import { IpcRegistry } from '../../utils/ipc-registry.js';
|
|
5
5
|
const EMPTY_SNAPSHOT = { bridges: [], entries: {} };
|
|
@@ -54,6 +54,25 @@ export function setupSimulatorAppData(host, options) {
|
|
|
54
54
|
return EMPTY_SNAPSHOT;
|
|
55
55
|
return accumulators.get(appId)?.snapshot() ?? EMPTY_SNAPSHOT;
|
|
56
56
|
});
|
|
57
|
+
/** A plain, non-empty `{key: value}` patch — the only shape page.setData accepts. */
|
|
58
|
+
function isValidSetDataPatch(data) {
|
|
59
|
+
return !!data && typeof data === 'object' && !Array.isArray(data)
|
|
60
|
+
&& Object.keys(data).length > 0;
|
|
61
|
+
}
|
|
62
|
+
ipc.handle(SimulatorAppDataChannel.SetData, (_event, payload) => {
|
|
63
|
+
const p = payload;
|
|
64
|
+
if (!p || typeof p !== 'object')
|
|
65
|
+
return false;
|
|
66
|
+
if (typeof p.bridgeId !== 'string' || p.bridgeId.length === 0)
|
|
67
|
+
return false;
|
|
68
|
+
if (!isValidSetDataPatch(p.data))
|
|
69
|
+
return false;
|
|
70
|
+
const wc = options.bridge?.getServiceWcForBridge(p.bridgeId);
|
|
71
|
+
if (!wc || wc.isDestroyed())
|
|
72
|
+
return false;
|
|
73
|
+
wc.send(ServiceHostChannel.AppDataSetData, { bridgeId: p.bridgeId, data: p.data });
|
|
74
|
+
return true;
|
|
75
|
+
});
|
|
57
76
|
// disposeAll runs LIFO; add the IPC registry LAST so it is torn down first —
|
|
58
77
|
// its removeHandler then runs synchronously (before the first `await` yields),
|
|
59
78
|
// which callers that `dispose()` without awaiting rely on.
|
|
@@ -6,9 +6,11 @@
|
|
|
6
6
|
* page a nested render-host `<webview>`), not a renderer `<webview>` the main
|
|
7
7
|
* window can observe — so in-app navigation (navigateTo / switchTab / back)
|
|
8
8
|
* never reaches the renderer's `<webview>` did-navigate events. This service
|
|
9
|
-
* taps the bridge's active-page signal and pushes the
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* taps the bridge's active-page signal and pushes the route — page path plus
|
|
10
|
+
* its launch query, so the simulator's page-path bar shows params just like
|
|
11
|
+
* WeChat DevTools and a recompile can restore them — to the main-window
|
|
12
|
+
* renderer (`SimulatorChannel.CurrentPage`), keeping the toolbar in sync
|
|
13
|
+
* without polling.
|
|
12
14
|
*
|
|
13
15
|
* Inert on the default dimina-fe path (which derives the current page from the
|
|
14
16
|
* simulator `<webview>`'s navigation events); app.ts gates the call on
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SimulatorChannel } from '../../../shared/ipc-channels.js';
|
|
2
|
+
import { encodePageSpec } from '../../../shared/simulator-route.js';
|
|
2
3
|
import { DisposableRegistry } from '@dimina-kit/electron-deck/main';
|
|
3
4
|
export function setupSimulatorCurrentPage(host, options) {
|
|
4
5
|
const registry = new DisposableRegistry();
|
|
@@ -11,7 +12,13 @@ export function setupSimulatorCurrentPage(host, options) {
|
|
|
11
12
|
return;
|
|
12
13
|
if (host.isDestroyed())
|
|
13
14
|
return;
|
|
14
|
-
|
|
15
|
+
// Bridge queries are `Record<string, unknown>` (they may hold numbers from
|
|
16
|
+
// the URL); the route format wants strings. encodePageSpec re-encodes with
|
|
17
|
+
// `?k=v&…` so the renderer can decode it back into { pagePath, query }.
|
|
18
|
+
const query = {};
|
|
19
|
+
for (const [k, v] of Object.entries(ev.query ?? {}))
|
|
20
|
+
query[k] = String(v);
|
|
21
|
+
host.send(SimulatorChannel.CurrentPage, encodePageSpec({ pagePath: ev.pagePath, query }));
|
|
15
22
|
});
|
|
16
23
|
registry.add(off);
|
|
17
24
|
return registry;
|
|
@@ -2,23 +2,30 @@
|
|
|
2
2
|
* SimulatorStorageWatcher
|
|
3
3
|
*
|
|
4
4
|
* Attaches the Chrome DevTools Protocol debugger to the simulator <webview>
|
|
5
|
-
* and forwards `DOMStorage.*` events to the renderer host.
|
|
5
|
+
* and forwards `DOMStorage.*` events to the renderer host. The SAME simulator
|
|
6
|
+
* wc's debugger session is independently captured by network-forward
|
|
7
|
+
* (Network.* events); both acquire a lease from the shared `CdpSessionBroker`
|
|
8
|
+
* (see cdp-session/index.ts) rather than each attaching/detaching directly —
|
|
9
|
+
* releasing our own lease never forces a physical detach that would kill the
|
|
10
|
+
* other's capture.
|
|
6
11
|
*
|
|
7
12
|
* Trade-offs vs a preload-side localStorage.setItem hook:
|
|
8
13
|
* + Uses standard browser protocol; no preload injection
|
|
9
14
|
* + Captures every change including ones bypassing wx (api-compat fallback,
|
|
10
15
|
* direct localStorage.setItem from devtools, etc.)
|
|
11
16
|
* + Decouples panel UI from dimina runtime's wx implementation
|
|
12
|
-
* - debugger.attach is mutually exclusive with Chrome DevTools
|
|
13
|
-
*
|
|
14
|
-
*
|
|
17
|
+
* - debugger.attach is mutually exclusive with a REAL Chrome DevTools window
|
|
18
|
+
* (F12) attaching to the same target from outside the broker. If a user
|
|
19
|
+
* opens one, the shared session detaches externally and events stop
|
|
20
|
+
* flowing until they close it.
|
|
15
21
|
*/
|
|
16
|
-
import { type WebContents } from 'electron';
|
|
22
|
+
import { type BrowserWindow, type WebContents } from 'electron';
|
|
17
23
|
import { type ConnectionRegistry, type Disposable } from '@dimina-kit/electron-deck/main';
|
|
18
24
|
import { type SyncStorageChange } from '../../../shared/ipc-channels.js';
|
|
19
25
|
import { type SenderPolicy } from '../../utils/ipc-registry.js';
|
|
20
26
|
import type { BridgeRouterHandle } from '../../ipc/bridge-router.js';
|
|
21
27
|
import type { RenderInspector } from '../render-inspect/index.js';
|
|
28
|
+
import { type CdpSessionBroker } from '../cdp-session/index.js';
|
|
22
29
|
/**
|
|
23
30
|
* Runtime async-storage handler (native-host). bridge-router routes async
|
|
24
31
|
* `wx.setStorage`/`getStorage`/… here so they hit the SAME service-host `file://`
|
|
@@ -78,6 +85,28 @@ export interface SimulatorStorageOptions {
|
|
|
78
85
|
* not adopted the connection layer compile and behave unchanged.
|
|
79
86
|
*/
|
|
80
87
|
connections?: ConnectionRegistry;
|
|
88
|
+
/**
|
|
89
|
+
* Shared CDP session broker (see cdp-session/index.ts) that owns the
|
|
90
|
+
* simulator wc's debugger session lifecycle — network-forward independently
|
|
91
|
+
* captures Network.* events on the SAME simulator wc, and an unconditional
|
|
92
|
+
* `debugger.detach()` here (the pre-migration behavior) would kill ITS
|
|
93
|
+
* capture too, exactly as an unconditional detach on its side would kill
|
|
94
|
+
* ours. Absent → a private broker is created and owned for this module's
|
|
95
|
+
* lifetime (torn down on `dispose()`), so existing standalone callers/tests
|
|
96
|
+
* compile and behave unchanged, just without cross-module session sharing.
|
|
97
|
+
*/
|
|
98
|
+
broker?: CdpSessionBroker;
|
|
99
|
+
/**
|
|
100
|
+
* Owning window (typically `mainWindow`). Scopes every simulator-webview
|
|
101
|
+
* discovery path (initial scan, `web-contents-created`, lazy re-find) to
|
|
102
|
+
* webviews that live inside THIS window — required in a multi-window
|
|
103
|
+
* workbench, where `webContents`/`app.on('web-contents-created')` are
|
|
104
|
+
* process-global and would otherwise let one window's instance attach to
|
|
105
|
+
* (and read/write through) another window's simulator. Optional so
|
|
106
|
+
* existing single-window callers/tests compile and keep their prior
|
|
107
|
+
* unscoped behavior.
|
|
108
|
+
*/
|
|
109
|
+
window?: BrowserWindow;
|
|
81
110
|
}
|
|
82
111
|
export declare function setupSimulatorStorage(host: WebContents, options: SimulatorStorageOptions): SimulatorStorageHandle;
|
|
83
112
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -2,22 +2,30 @@
|
|
|
2
2
|
* SimulatorStorageWatcher
|
|
3
3
|
*
|
|
4
4
|
* Attaches the Chrome DevTools Protocol debugger to the simulator <webview>
|
|
5
|
-
* and forwards `DOMStorage.*` events to the renderer host.
|
|
5
|
+
* and forwards `DOMStorage.*` events to the renderer host. The SAME simulator
|
|
6
|
+
* wc's debugger session is independently captured by network-forward
|
|
7
|
+
* (Network.* events); both acquire a lease from the shared `CdpSessionBroker`
|
|
8
|
+
* (see cdp-session/index.ts) rather than each attaching/detaching directly —
|
|
9
|
+
* releasing our own lease never forces a physical detach that would kill the
|
|
10
|
+
* other's capture.
|
|
6
11
|
*
|
|
7
12
|
* Trade-offs vs a preload-side localStorage.setItem hook:
|
|
8
13
|
* + Uses standard browser protocol; no preload injection
|
|
9
14
|
* + Captures every change including ones bypassing wx (api-compat fallback,
|
|
10
15
|
* direct localStorage.setItem from devtools, etc.)
|
|
11
16
|
* + Decouples panel UI from dimina runtime's wx implementation
|
|
12
|
-
* - debugger.attach is mutually exclusive with Chrome DevTools
|
|
13
|
-
*
|
|
14
|
-
*
|
|
17
|
+
* - debugger.attach is mutually exclusive with a REAL Chrome DevTools window
|
|
18
|
+
* (F12) attaching to the same target from outside the broker. If a user
|
|
19
|
+
* opens one, the shared session detaches externally and events stop
|
|
20
|
+
* flowing until they close it.
|
|
15
21
|
*/
|
|
16
22
|
import { app, webContents as wcStatic } from 'electron';
|
|
17
23
|
import { DisposableRegistry } from '@dimina-kit/electron-deck/main';
|
|
18
24
|
import { SimulatorElementChannel, SimulatorStorageChannel, } from '../../../shared/ipc-channels.js';
|
|
19
25
|
import { IpcRegistry } from '../../utils/ipc-registry.js';
|
|
20
26
|
import { decodeStorageValue, encodeStorageValue, serviceStorage } from './service-storage-ops.js';
|
|
27
|
+
import { createCdpSessionBroker } from '../cdp-session/index.js';
|
|
28
|
+
import { windowHostsWebContents } from './window-scope.js';
|
|
21
29
|
/** Async wx storage API names routed through the unified service-window store. */
|
|
22
30
|
export const STORAGE_API_NAMES = new Set([
|
|
23
31
|
'setStorage',
|
|
@@ -33,6 +41,17 @@ function isSimulatorWebview(wc) {
|
|
|
33
41
|
return false;
|
|
34
42
|
return wc.getURL().includes('simulator.html');
|
|
35
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* `win` undefined means no owning window was configured — the legacy
|
|
46
|
+
* unscoped behavior, kept so single-window callers/tests that don't pass
|
|
47
|
+
* `window` keep compiling and behaving unchanged. Every production call
|
|
48
|
+
* site (window-runtime-services.ts) always passes its window.
|
|
49
|
+
*/
|
|
50
|
+
function belongsToWindow(win, wc) {
|
|
51
|
+
if (!win)
|
|
52
|
+
return true;
|
|
53
|
+
return windowHostsWebContents(win, wc);
|
|
54
|
+
}
|
|
36
55
|
function safeOff(target, event, fn) {
|
|
37
56
|
try {
|
|
38
57
|
if (target.isDestroyed?.())
|
|
@@ -55,8 +74,12 @@ export function setupSimulatorStorage(host, options) {
|
|
|
55
74
|
return null;
|
|
56
75
|
return options.bridge.getServiceWc(getActiveAppId() ?? undefined);
|
|
57
76
|
}
|
|
77
|
+
// Own (and dispose on this module's own dispose()) a private broker only
|
|
78
|
+
// when the caller didn't supply a shared one.
|
|
79
|
+
const ownsBroker = !options.broker;
|
|
80
|
+
const broker = options.broker ?? createCdpSessionBroker({ connections: options.connections });
|
|
58
81
|
let attachedWc = null;
|
|
59
|
-
let
|
|
82
|
+
let attachedLease = null;
|
|
60
83
|
/**
|
|
61
84
|
* Cached origin discovered via `executeJavaScript('location.origin')` on
|
|
62
85
|
* first use. The simulator <webview> loads `simulator.html` from a stable
|
|
@@ -69,24 +92,21 @@ export function setupSimulatorStorage(host, options) {
|
|
|
69
92
|
const appId = getActiveAppId();
|
|
70
93
|
return appId ? `${appId}_` : null;
|
|
71
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Release OUR OWN lease on the simulator wc's shared session — never a
|
|
97
|
+
* physical `debugger.detach()`. The SAME wc is independently captured by
|
|
98
|
+
* network-forward (Network.* events); an unconditional detach here would
|
|
99
|
+
* kill its capture too. The broker (cdp-session/index.ts) alone decides
|
|
100
|
+
* when an actual detach happens.
|
|
101
|
+
*/
|
|
72
102
|
function detachFromSim() {
|
|
73
103
|
if (!attachedWc)
|
|
74
104
|
return;
|
|
75
|
-
const wc = attachedWc;
|
|
76
105
|
attachedWc = null;
|
|
77
106
|
cachedOrigin = null;
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
void ad.disposeAll().catch(() => { });
|
|
82
|
-
try {
|
|
83
|
-
if (!wc.isDestroyed() && wc.debugger.isAttached()) {
|
|
84
|
-
wc.debugger.detach();
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
catch {
|
|
88
|
-
// best-effort
|
|
89
|
-
}
|
|
107
|
+
const lease = attachedLease;
|
|
108
|
+
attachedLease = null;
|
|
109
|
+
lease?.dispose();
|
|
90
110
|
}
|
|
91
111
|
async function attachToSim(wc) {
|
|
92
112
|
if (attachedWc === wc)
|
|
@@ -94,57 +114,30 @@ export function setupSimulatorStorage(host, options) {
|
|
|
94
114
|
if (wc.isDestroyed())
|
|
95
115
|
return;
|
|
96
116
|
detachFromSim();
|
|
117
|
+
const lease = broker.acquire(wc);
|
|
118
|
+
if (!lease) {
|
|
119
|
+
console.warn('[storage-watcher] attach failed: debugger session unavailable');
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
97
122
|
try {
|
|
98
|
-
|
|
99
|
-
wc.debugger.attach('1.3');
|
|
100
|
-
}
|
|
101
|
-
await wc.debugger.sendCommand('DOMStorage.enable');
|
|
102
|
-
const attach = new DisposableRegistry();
|
|
103
|
-
attachDisposables = attach;
|
|
104
|
-
const onMessage = (_event, method, params) => forwardCdpMessage(method, params);
|
|
105
|
-
wc.debugger.on('message', onMessage);
|
|
106
|
-
attach.add(() => safeOff(wc.debugger, 'message', onMessage));
|
|
107
|
-
const onDetach = () => {
|
|
108
|
-
if (attachedWc === wc)
|
|
109
|
-
attachedWc = null;
|
|
110
|
-
};
|
|
111
|
-
wc.debugger.on('detach', onDetach);
|
|
112
|
-
attach.add(() => safeOff(wc.debugger, 'detach', onDetach));
|
|
113
|
-
const onDestroyed = () => {
|
|
114
|
-
// When the attached wc is destroyed, the lingering attachDisposables
|
|
115
|
-
// hold listener refs to a wc that will never emit again. Dispose the
|
|
116
|
-
// registry here so debugger/wc listeners are removed deterministically
|
|
117
|
-
// and a subsequent attachToSim() starts from a clean slate.
|
|
118
|
-
if (attachedWc === wc) {
|
|
119
|
-
attachedWc = null;
|
|
120
|
-
const ad = attachDisposables;
|
|
121
|
-
attachDisposables = null;
|
|
122
|
-
if (ad)
|
|
123
|
-
void ad.disposeAll().catch(() => { });
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
if (options.connections) {
|
|
127
|
-
// Route through the connection layer: own() disposes onDestroyed
|
|
128
|
-
// deterministically on wc destroy / connection reset, and the returned
|
|
129
|
-
// Disposable lets us release it early when this attach segment tears
|
|
130
|
-
// down (detach / re-attach).
|
|
131
|
-
const owned = options.connections.acquire(wc).own(onDestroyed);
|
|
132
|
-
attach.add(() => owned.dispose());
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
try {
|
|
136
|
-
wc.once('destroyed', onDestroyed);
|
|
137
|
-
}
|
|
138
|
-
catch {
|
|
139
|
-
// fake-wc safety (unit tests pass a wc without a real emitter)
|
|
140
|
-
}
|
|
141
|
-
attach.add(() => safeOff(wc, 'destroyed', onDestroyed));
|
|
142
|
-
}
|
|
143
|
-
attachedWc = wc;
|
|
123
|
+
await lease.send('DOMStorage.enable');
|
|
144
124
|
}
|
|
145
125
|
catch (e) {
|
|
146
126
|
console.warn('[storage-watcher] attach failed:', e.message);
|
|
127
|
+
lease.dispose();
|
|
128
|
+
return;
|
|
147
129
|
}
|
|
130
|
+
lease.onMessage((method, params) => forwardCdpMessage(method, params));
|
|
131
|
+
// Fires on external detach OR the wc being destroyed (see cdp-session's
|
|
132
|
+
// design doc) — either way our tracking of this wc as "attached" is stale.
|
|
133
|
+
lease.onDetach(() => {
|
|
134
|
+
if (attachedWc === wc) {
|
|
135
|
+
attachedWc = null;
|
|
136
|
+
attachedLease = null;
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
attachedWc = wc;
|
|
140
|
+
attachedLease = lease;
|
|
148
141
|
}
|
|
149
142
|
function forwardCdpMessage(method, params) {
|
|
150
143
|
if (host.isDestroyed())
|
|
@@ -217,7 +210,7 @@ export function setupSimulatorStorage(host, options) {
|
|
|
217
210
|
async function ensureAttached() {
|
|
218
211
|
if (attachedWc && !attachedWc.isDestroyed())
|
|
219
212
|
return;
|
|
220
|
-
const sim = findSimulatorWebContents();
|
|
213
|
+
const sim = findSimulatorWebContents(options.window);
|
|
221
214
|
if (!sim)
|
|
222
215
|
return;
|
|
223
216
|
await attachToSim(sim);
|
|
@@ -411,7 +404,7 @@ export function setupSimulatorStorage(host, options) {
|
|
|
411
404
|
// Attach to any simulator webview that already exists (project may have
|
|
412
405
|
// been opened before this function runs).
|
|
413
406
|
for (const wc of wcStatic.getAllWebContents()) {
|
|
414
|
-
if (isSimulatorWebview(wc)) {
|
|
407
|
+
if (isSimulatorWebview(wc) && belongsToWindow(options.window, wc)) {
|
|
415
408
|
void attachToSim(wc);
|
|
416
409
|
break;
|
|
417
410
|
}
|
|
@@ -425,7 +418,7 @@ export function setupSimulatorStorage(host, options) {
|
|
|
425
418
|
const sub = new DisposableRegistry();
|
|
426
419
|
wcSubs.set(wc, sub);
|
|
427
420
|
const onFinishLoad = () => {
|
|
428
|
-
if (isSimulatorWebview(wc))
|
|
421
|
+
if (isSimulatorWebview(wc) && belongsToWindow(options.window, wc))
|
|
429
422
|
void attachToSim(wc);
|
|
430
423
|
};
|
|
431
424
|
wc.on('did-finish-load', onFinishLoad);
|
|
@@ -474,7 +467,7 @@ export function setupSimulatorStorage(host, options) {
|
|
|
474
467
|
return null;
|
|
475
468
|
return options.renderInspector.highlight(wc, sid);
|
|
476
469
|
}
|
|
477
|
-
const sim = findSimulatorWebContents();
|
|
470
|
+
const sim = findSimulatorWebContents(options.window);
|
|
478
471
|
if (!sim)
|
|
479
472
|
return null;
|
|
480
473
|
try {
|
|
@@ -493,7 +486,7 @@ export function setupSimulatorStorage(host, options) {
|
|
|
493
486
|
await options.renderInspector.unhighlight(wc);
|
|
494
487
|
return;
|
|
495
488
|
}
|
|
496
|
-
const sim = findSimulatorWebContents();
|
|
489
|
+
const sim = findSimulatorWebContents(options.window);
|
|
497
490
|
if (!sim)
|
|
498
491
|
return;
|
|
499
492
|
try {
|
|
@@ -520,6 +513,12 @@ export function setupSimulatorStorage(host, options) {
|
|
|
520
513
|
registry.add(ipc);
|
|
521
514
|
// Detach active CDP session last
|
|
522
515
|
registry.add(() => detachFromSim());
|
|
516
|
+
// Only detach sessions we self-attached if we own the broker's lifecycle —
|
|
517
|
+
// a shared/injected broker keeps serving other consumers past our dispose().
|
|
518
|
+
registry.add(() => {
|
|
519
|
+
if (ownsBroker)
|
|
520
|
+
broker.dispose();
|
|
521
|
+
});
|
|
523
522
|
// ── Runtime async-storage unification (native-host) ───────────────────────
|
|
524
523
|
// bridge-router routes async wx.setStorage/etc. here so they hit the SAME
|
|
525
524
|
// service-host file:// store as the sync APIs (no more split origin). After a
|
|
@@ -604,9 +603,12 @@ export function setupSimulatorStorage(host, options) {
|
|
|
604
603
|
// bridge via executeJavaScript. Looked up independently from `attachedWc` so
|
|
605
604
|
// it keeps working when the user opens Chrome DevTools and the storage
|
|
606
605
|
// debugger detaches (debugger.attach is mutually exclusive with F12).
|
|
607
|
-
|
|
606
|
+
// Scoped to `win` for the same reason as the attach paths above — an
|
|
607
|
+
// unscoped scan would resolve to whichever window's simulator comes first
|
|
608
|
+
// in the process-global registry, not necessarily this instance's own.
|
|
609
|
+
function findSimulatorWebContents(win) {
|
|
608
610
|
for (const wc of wcStatic.getAllWebContents()) {
|
|
609
|
-
if (isSimulatorWebview(wc))
|
|
611
|
+
if (isSimulatorWebview(wc) && belongsToWindow(win, wc))
|
|
610
612
|
return wc;
|
|
611
613
|
}
|
|
612
614
|
return null;
|
|
@@ -1,40 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* service-storage-ops — localStorage primitives executed INSIDE the service-host
|
|
3
|
-
* window (`wc`) via `executeJavaScript`, plus the wx-storage value encode/decode
|
|
4
|
-
* pair.
|
|
5
|
-
*
|
|
6
|
-
* Under native-host the mini-app's storage lives on the service-host window's
|
|
7
|
-
* `file://` origin (sync APIs write there via sync-impls/storage.ts, and the
|
|
8
|
-
* unified async path routes there too). The Storage panel + the async-storage
|
|
9
|
-
* runtime both read/write through here so there is exactly ONE store.
|
|
10
|
-
*
|
|
11
|
-
* The key/value scheme stays byte-compatible with
|
|
12
|
-
* `src/service-host/sync-impls/storage.ts` (the authoritative wx storage impl):
|
|
13
|
-
* - key = `${appId}_${key}`
|
|
14
|
-
* - value = `typeof data === 'object' ? JSON.stringify(data) : String(data)`
|
|
15
|
-
* - scoped clear removes every key whose name startsWith `${appId}_`
|
|
16
|
-
*
|
|
17
|
-
* Args are embedded via JSON.stringify so special characters can't break out of
|
|
18
|
-
* the injected code. Reads tolerate failure (→ []/null); writes propagate so the
|
|
19
|
-
* caller can fail the wx callback / surface the panel error.
|
|
20
|
-
*/
|
|
21
|
-
import type { WebContents } from 'electron';
|
|
22
|
-
/** Encode a wx storage value to its localStorage string form. Matches sync-impls/storage.ts. */
|
|
23
|
-
export declare function encodeStorageValue(data: unknown): string;
|
|
24
|
-
/** Decode a localStorage string back to a value (JSON.parse, falling back to the raw string). */
|
|
25
|
-
export declare function decodeStorageValue(raw: string): unknown;
|
|
26
|
-
export interface ServiceStorage {
|
|
27
|
-
/** All [fullKey, value] entries whose key startsWith `prefix`. */
|
|
28
|
-
readAll(prefix: string): Promise<Array<[string, string]>>;
|
|
29
|
-
/** Raw value for a full (already-prefixed) key, or null if absent. */
|
|
30
|
-
readOne(fullKey: string): Promise<string | null>;
|
|
31
|
-
writeOne(fullKey: string, value: string): Promise<void>;
|
|
32
|
-
removeOne(fullKey: string): Promise<void>;
|
|
33
|
-
/** Remove every key whose name startsWith `prefix`. */
|
|
34
|
-
clearPrefix(prefix: string): Promise<void>;
|
|
35
|
-
/** Origin-wide localStorage.clear(). */
|
|
36
|
-
clearAll(): Promise<void>;
|
|
37
|
-
}
|
|
38
|
-
/** localStorage ops executed inside `wc` (the service-host window) via executeJavaScript. */
|
|
39
|
-
export declare function serviceStorage(wc: WebContents): ServiceStorage;
|
|
1
|
+
export * from '@dimina-kit/electron-runtime/main/service-storage-ops';
|
|
40
2
|
//# sourceMappingURL=service-storage-ops.d.ts.map
|