@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,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared implementation behind every host-slot page bridge (toolbar/sidebar/
|
|
3
|
+
* dialog): the MessagePort handshake, pending-queue-with-bounded-overflow,
|
|
4
|
+
* handler registry and `{ send, onMessage }` contextBridge exposure are
|
|
5
|
+
* IDENTICAL across slots — only the bridge key, handshake channel, queue cap
|
|
6
|
+
* and overflow-warning label differ. Each slot's own `host-*-port.ts` stays
|
|
7
|
+
* the frozen public surface (see its own "PUBLIC SURFACE EVOLUTION RULE"
|
|
8
|
+
* doc-comment) and calls this factory with its own constants; this module has
|
|
9
|
+
* no public-surface contract of its own.
|
|
10
|
+
*/
|
|
11
|
+
import { contextBridge, ipcRenderer } from 'electron';
|
|
12
|
+
/**
|
|
13
|
+
* Subscribe the handshake channel and expose the page bridge. Call ONLY from
|
|
14
|
+
* a passing per-slot runtime guard — a failing guard must leave zero
|
|
15
|
+
* footprint (no bridge key, no IPC listener), so this factory itself does no
|
|
16
|
+
* guard checking; the caller decides whether to call it at all.
|
|
17
|
+
*/
|
|
18
|
+
export function createHostSlotPortBridge(opts) {
|
|
19
|
+
const { bridgeKey, channel, pendingLimit, label } = opts;
|
|
20
|
+
let activePort = null;
|
|
21
|
+
const pending = [];
|
|
22
|
+
// One overflow warning per load (this installer runs once per document) —
|
|
23
|
+
// a runaway page send-loop must not get per-drop console spam.
|
|
24
|
+
let warnedPendingOverflow = false;
|
|
25
|
+
const handlers = [];
|
|
26
|
+
// Entry-waist channel validation, parity with the main side's `onMessage`
|
|
27
|
+
// guard (same TypeError, message names `channel`). Runs BEFORE any state is
|
|
28
|
+
// touched (no queue slot, no registry entry), in both port states — a page
|
|
29
|
+
// author's typo throws at the call site instead of vanishing into main's
|
|
30
|
+
// silent inbound drop.
|
|
31
|
+
function assertValidChannel(method, ch) {
|
|
32
|
+
if (typeof ch !== 'string' || ch === '') {
|
|
33
|
+
throw new TypeError(`${bridgeKey}.${method}: channel must be a non-empty string`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const dispatch = (data) => {
|
|
37
|
+
// Defensive symmetry with main: drop anything that is not an object
|
|
38
|
+
// envelope with a string channel — never throw in the dispatcher.
|
|
39
|
+
if (typeof data !== 'object' || data === null)
|
|
40
|
+
return;
|
|
41
|
+
const { channel: ch, payload } = data;
|
|
42
|
+
if (typeof ch !== 'string')
|
|
43
|
+
return;
|
|
44
|
+
for (const entry of [...handlers]) {
|
|
45
|
+
if (entry.channel === ch)
|
|
46
|
+
entry.handler(payload);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const onPortMessage = (event) => {
|
|
50
|
+
dispatch(event.data);
|
|
51
|
+
};
|
|
52
|
+
ipcRenderer.on(channel, (event) => {
|
|
53
|
+
const port = event.ports[0];
|
|
54
|
+
if (!port)
|
|
55
|
+
return;
|
|
56
|
+
// Same-load duplicate handshake: the LATER port wins. Main closed (or is
|
|
57
|
+
// about to close) its end of the old pair — detach and stop writing to it.
|
|
58
|
+
if (activePort) {
|
|
59
|
+
try {
|
|
60
|
+
activePort.removeEventListener('message', onPortMessage);
|
|
61
|
+
activePort.close();
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
/* already dead */
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
activePort = port;
|
|
68
|
+
// addEventListener (not onmessage) keeps the handler removable on
|
|
69
|
+
// re-handshake; it REQUIRES start() or inbound never delivers.
|
|
70
|
+
port.addEventListener('message', onPortMessage);
|
|
71
|
+
port.start();
|
|
72
|
+
// Flush sends issued before the port arrived, in order.
|
|
73
|
+
while (pending.length > 0) {
|
|
74
|
+
const envelope = pending.shift();
|
|
75
|
+
port.postMessage(envelope);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
// EXACTLY { send, onMessage } — functions only; the port stays in the
|
|
79
|
+
// isolated world.
|
|
80
|
+
contextBridge.exposeInMainWorld(bridgeKey, {
|
|
81
|
+
send(ch, payload) {
|
|
82
|
+
assertValidChannel('send', ch);
|
|
83
|
+
const envelope = { channel: ch, payload };
|
|
84
|
+
if (activePort) {
|
|
85
|
+
activePort.postMessage(envelope);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
// Bounded queue: drop the NEWEST send on overflow (FIFO first-comers
|
|
89
|
+
// survive), warn once per load, never throw into page code.
|
|
90
|
+
if (pending.length >= pendingLimit) {
|
|
91
|
+
if (!warnedPendingOverflow) {
|
|
92
|
+
warnedPendingOverflow = true;
|
|
93
|
+
console.warn(`[dimina-devtools] ${label} pending queue full (${pendingLimit}); ` +
|
|
94
|
+
'dropping further pre-handshake send() calls until the port arrives');
|
|
95
|
+
}
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
pending.push(envelope);
|
|
99
|
+
},
|
|
100
|
+
onMessage(ch, handler) {
|
|
101
|
+
assertValidChannel('onMessage', ch);
|
|
102
|
+
const entry = { channel: ch, handler };
|
|
103
|
+
handlers.push(entry);
|
|
104
|
+
return () => {
|
|
105
|
+
const i = handlers.indexOf(entry);
|
|
106
|
+
if (i >= 0)
|
|
107
|
+
handlers.splice(i, 1);
|
|
108
|
+
};
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=host-slot-port-bridge.js.map
|
|
@@ -9,19 +9,11 @@
|
|
|
9
9
|
*/
|
|
10
10
|
/**
|
|
11
11
|
* Attach the advertiser to the toolbar content's shrink-to-fit root
|
|
12
|
-
* (`[data-host-toolbar-root]`)
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* Returns a disposer that tears the advertiser down.
|
|
19
|
-
*/
|
|
20
|
-
export declare function installHostToolbarAdvertiser(): () => void;
|
|
21
|
-
/**
|
|
22
|
-
* Install once the DOM is ready (the root element must exist before we query).
|
|
23
|
-
* Self-gating: if the document is already past `loading`, install synchronously;
|
|
24
|
-
* otherwise wait for `DOMContentLoaded`.
|
|
12
|
+
* (`[data-host-toolbar-root]`), waiting for it if necessary — the root may be
|
|
13
|
+
* mounted asynchronously by a framework rather than present in the initial
|
|
14
|
+
* HTML. That element MUST be shrink-to-fit on the block axis — its height
|
|
15
|
+
* must reflect the content, not the host-applied view height, or the
|
|
16
|
+
* cross-process loop never converges (`createSizeAdvertiser`'s footgun).
|
|
25
17
|
*/
|
|
26
18
|
export declare function installHostToolbarAdvertiserWhenReady(): void;
|
|
27
19
|
//# sourceMappingURL=host-toolbar-advertiser.d.ts.map
|
|
@@ -9,47 +9,27 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { ipcRenderer } from 'electron';
|
|
11
11
|
import { createSizeAdvertiser } from '@dimina-kit/view-anchor';
|
|
12
|
-
import { ViewChannel } from '../../shared/ipc-channels.js';
|
|
12
|
+
import { ViewChannel } from '../../shared/ipc-channels-overlays.js';
|
|
13
|
+
import { whenSlotRootReady } from './wait-for-slot-root.js';
|
|
13
14
|
/**
|
|
14
15
|
* Attach the advertiser to the toolbar content's shrink-to-fit root
|
|
15
|
-
* (`[data-host-toolbar-root]`)
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* Returns a disposer that tears the advertiser down.
|
|
22
|
-
*/
|
|
23
|
-
export function installHostToolbarAdvertiser() {
|
|
24
|
-
const root = document.querySelector('[data-host-toolbar-root]');
|
|
25
|
-
if (!root) {
|
|
26
|
-
console.warn('[host-toolbar-advertiser] no `[data-host-toolbar-root]` element found — ' +
|
|
27
|
-
'not advertising a height. The toolbar content must wrap itself in a ' +
|
|
28
|
-
'shrink-to-fit `[data-host-toolbar-root]` element so its block size is ' +
|
|
29
|
-
'the content height, not the host-given view size.');
|
|
30
|
-
return () => { };
|
|
31
|
-
}
|
|
32
|
-
const advertiser = createSizeAdvertiser(root, {
|
|
33
|
-
axis: 'block',
|
|
34
|
-
publish: (size) => {
|
|
35
|
-
ipcRenderer.send(ViewChannel.HostToolbarAdvertiseHeight, size);
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
return () => advertiser.dispose();
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Install once the DOM is ready (the root element must exist before we query).
|
|
42
|
-
* Self-gating: if the document is already past `loading`, install synchronously;
|
|
43
|
-
* otherwise wait for `DOMContentLoaded`.
|
|
16
|
+
* (`[data-host-toolbar-root]`), waiting for it if necessary — the root may be
|
|
17
|
+
* mounted asynchronously by a framework rather than present in the initial
|
|
18
|
+
* HTML. That element MUST be shrink-to-fit on the block axis — its height
|
|
19
|
+
* must reflect the content, not the host-applied view height, or the
|
|
20
|
+
* cross-process loop never converges (`createSizeAdvertiser`'s footgun).
|
|
44
21
|
*/
|
|
45
22
|
export function installHostToolbarAdvertiserWhenReady() {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
23
|
+
whenSlotRootReady('[data-host-toolbar-root]', '[host-toolbar-advertiser] no `[data-host-toolbar-root]` element found — ' +
|
|
24
|
+
'not advertising a height yet. The toolbar content must wrap itself in a ' +
|
|
25
|
+
'shrink-to-fit `[data-host-toolbar-root]` element so its block size is ' +
|
|
26
|
+
'the content height, not the host-given view size.', (root) => {
|
|
27
|
+
createSizeAdvertiser(root, {
|
|
28
|
+
axis: 'block',
|
|
29
|
+
publish: (size) => {
|
|
30
|
+
ipcRenderer.send(ViewChannel.HostToolbarAdvertiseHeight, size);
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
});
|
|
54
34
|
}
|
|
55
35
|
//# sourceMappingURL=host-toolbar-advertiser.js.map
|
|
@@ -37,6 +37,10 @@
|
|
|
37
37
|
* - Inbound dispatch uses `addEventListener('message')` + `start()`
|
|
38
38
|
* (without `start()` a DOM MessagePort never delivers) and DROPS malformed
|
|
39
39
|
* envelopes without throwing.
|
|
40
|
+
*
|
|
41
|
+
* Shared implementation: see `host-slot-port-bridge.ts` (the toolbar/sidebar/
|
|
42
|
+
* dialog port bridges are otherwise identical; only the constants below
|
|
43
|
+
* differ).
|
|
40
44
|
*/
|
|
41
45
|
/**
|
|
42
46
|
* Cap on pre-handshake queued sends. 128 comfortably covers any sane toolbar
|
|
@@ -45,5 +49,10 @@
|
|
|
45
49
|
* envelope (queued first-comers survive), one console.warn per load.
|
|
46
50
|
*/
|
|
47
51
|
export declare const HOST_TOOLBAR_PENDING_LIMIT = 128;
|
|
52
|
+
/**
|
|
53
|
+
* Subscribe the handshake channel and expose the page bridge. Call ONLY from
|
|
54
|
+
* a passing toolbar-runtime guard (`activateHostToolbarRuntime`) — a failing
|
|
55
|
+
* guard must leave zero footprint (no bridge key, no IPC listener).
|
|
56
|
+
*/
|
|
48
57
|
export declare function installHostToolbarPortBridge(): void;
|
|
49
58
|
//# sourceMappingURL=host-toolbar-port.d.ts.map
|
|
@@ -37,10 +37,13 @@
|
|
|
37
37
|
* - Inbound dispatch uses `addEventListener('message')` + `start()`
|
|
38
38
|
* (without `start()` a DOM MessagePort never delivers) and DROPS malformed
|
|
39
39
|
* envelopes without throwing.
|
|
40
|
+
*
|
|
41
|
+
* Shared implementation: see `host-slot-port-bridge.ts` (the toolbar/sidebar/
|
|
42
|
+
* dialog port bridges are otherwise identical; only the constants below
|
|
43
|
+
* differ).
|
|
40
44
|
*/
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
const BRIDGE_KEY = 'diminaHostToolbar';
|
|
45
|
+
import { ViewChannel } from '../../shared/ipc-channels-overlays.js';
|
|
46
|
+
import { createHostSlotPortBridge } from './host-slot-port-bridge.js';
|
|
44
47
|
/**
|
|
45
48
|
* Cap on pre-handshake queued sends. 128 comfortably covers any sane toolbar
|
|
46
49
|
* boot sequence while bounding what a page whose handshake never completes
|
|
@@ -53,99 +56,12 @@ export const HOST_TOOLBAR_PENDING_LIMIT = 128;
|
|
|
53
56
|
* a passing toolbar-runtime guard (`activateHostToolbarRuntime`) — a failing
|
|
54
57
|
* guard must leave zero footprint (no bridge key, no IPC listener).
|
|
55
58
|
*/
|
|
56
|
-
/**
|
|
57
|
-
* Entry-waist channel validation, parity with the main side's
|
|
58
|
-
* `hostToolbar.onMessage` guard (same TypeError, message names `channel`).
|
|
59
|
-
* Runs BEFORE any state is touched (no queue slot, no registry entry), in
|
|
60
|
-
* both port states — a page author's typo throws at the call site instead of
|
|
61
|
-
* vanishing into main's silent inbound drop.
|
|
62
|
-
*/
|
|
63
|
-
function assertValidChannel(method, channel) {
|
|
64
|
-
if (typeof channel !== 'string' || channel === '') {
|
|
65
|
-
throw new TypeError(`diminaHostToolbar.${method}: channel must be a non-empty string`);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
59
|
export function installHostToolbarPortBridge() {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const handlers = [];
|
|
75
|
-
const dispatch = (data) => {
|
|
76
|
-
// Defensive symmetry with main: drop anything that is not an object
|
|
77
|
-
// envelope with a string channel — never throw in the dispatcher.
|
|
78
|
-
if (typeof data !== 'object' || data === null)
|
|
79
|
-
return;
|
|
80
|
-
const { channel, payload } = data;
|
|
81
|
-
if (typeof channel !== 'string')
|
|
82
|
-
return;
|
|
83
|
-
for (const entry of [...handlers]) {
|
|
84
|
-
if (entry.channel === channel)
|
|
85
|
-
entry.handler(payload);
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
const onPortMessage = (event) => {
|
|
89
|
-
dispatch(event.data);
|
|
90
|
-
};
|
|
91
|
-
ipcRenderer.on(ViewChannel.HostToolbarPort, (event) => {
|
|
92
|
-
const port = event.ports[0];
|
|
93
|
-
if (!port)
|
|
94
|
-
return;
|
|
95
|
-
// Same-load duplicate handshake: the LATER port wins. Main closed (or is
|
|
96
|
-
// about to close) its end of the old pair — detach and stop writing to it.
|
|
97
|
-
if (activePort) {
|
|
98
|
-
try {
|
|
99
|
-
activePort.removeEventListener('message', onPortMessage);
|
|
100
|
-
activePort.close();
|
|
101
|
-
}
|
|
102
|
-
catch {
|
|
103
|
-
/* already dead */
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
activePort = port;
|
|
107
|
-
// addEventListener (not onmessage) keeps the handler removable on
|
|
108
|
-
// re-handshake; it REQUIRES start() or inbound never delivers.
|
|
109
|
-
port.addEventListener('message', onPortMessage);
|
|
110
|
-
port.start();
|
|
111
|
-
// Flush sends issued before the port arrived, in order.
|
|
112
|
-
while (pending.length > 0) {
|
|
113
|
-
const envelope = pending.shift();
|
|
114
|
-
port.postMessage(envelope);
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
// EXACTLY { send, onMessage } — functions only; the port stays in the
|
|
118
|
-
// isolated world.
|
|
119
|
-
contextBridge.exposeInMainWorld(BRIDGE_KEY, {
|
|
120
|
-
send(channel, payload) {
|
|
121
|
-
assertValidChannel('send', channel);
|
|
122
|
-
const envelope = { channel, payload };
|
|
123
|
-
if (activePort) {
|
|
124
|
-
activePort.postMessage(envelope);
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
// Bounded queue: drop the NEWEST send on overflow (FIFO first-comers
|
|
128
|
-
// survive), warn once per load, never throw into page code.
|
|
129
|
-
if (pending.length >= HOST_TOOLBAR_PENDING_LIMIT) {
|
|
130
|
-
if (!warnedPendingOverflow) {
|
|
131
|
-
warnedPendingOverflow = true;
|
|
132
|
-
console.warn(`[dimina-devtools] host-toolbar pending queue full (${HOST_TOOLBAR_PENDING_LIMIT}); ` +
|
|
133
|
-
'dropping further pre-handshake send() calls until the port arrives');
|
|
134
|
-
}
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
pending.push(envelope);
|
|
138
|
-
},
|
|
139
|
-
onMessage(channel, handler) {
|
|
140
|
-
assertValidChannel('onMessage', channel);
|
|
141
|
-
const entry = { channel, handler };
|
|
142
|
-
handlers.push(entry);
|
|
143
|
-
return () => {
|
|
144
|
-
const i = handlers.indexOf(entry);
|
|
145
|
-
if (i >= 0)
|
|
146
|
-
handlers.splice(i, 1);
|
|
147
|
-
};
|
|
148
|
-
},
|
|
60
|
+
createHostSlotPortBridge({
|
|
61
|
+
bridgeKey: 'diminaHostToolbar',
|
|
62
|
+
channel: ViewChannel.HostToolbarPort,
|
|
63
|
+
pendingLimit: HOST_TOOLBAR_PENDING_LIMIT,
|
|
64
|
+
label: 'host-toolbar',
|
|
149
65
|
});
|
|
150
66
|
}
|
|
151
67
|
//# sourceMappingURL=host-toolbar-port.js.map
|
|
@@ -3,10 +3,24 @@ import type { ActivePagePayload, ApiResponsePayload, NavCallbackPayload, PageLif
|
|
|
3
3
|
export interface RenderHostUrlOptions {
|
|
4
4
|
bridgeId: string;
|
|
5
5
|
appId: string;
|
|
6
|
+
/** The page's resource root inside the mini-app package (e.g. `'main'`), from `SpawnResult.root`. */
|
|
7
|
+
root: string;
|
|
6
8
|
pagePath: string;
|
|
7
9
|
/** Whether this page is a tabBar page. Surfaced on the URL so main can pick
|
|
8
10
|
* the bottom safe-area policy at `did-attach-webview` (services/safe-area). */
|
|
9
11
|
isTab?: boolean;
|
|
12
|
+
/** The page's resolved `navigationStyle` (page ∪ app-level). Surfaced on the
|
|
13
|
+
* URL as `navStyle` so main can pick the TOP safe-area policy at
|
|
14
|
+
* `did-attach-webview` (services/safe-area). */
|
|
15
|
+
navigationStyle?: 'default' | 'custom';
|
|
16
|
+
/** The page's resolved `window.backgroundColor` (page ∪ app-level, already
|
|
17
|
+
* defaulted — see `pageBackgroundColor` in page-stack-controller.ts).
|
|
18
|
+
* Surfaced on the URL as `bgColor`: render-host/preload.cjs reads it and
|
|
19
|
+
* primes the guest's own document background before the page's own CSS
|
|
20
|
+
* loads. `WebContents` (the `<webview>` guest) has no `setBackgroundColor`,
|
|
21
|
+
* so main never consumes this — DeviceShell separately primes the host
|
|
22
|
+
* `<webview>` element's own CSS background from the same source. */
|
|
23
|
+
backgroundColor?: string;
|
|
10
24
|
}
|
|
11
25
|
export interface DiminaNativeHostBridge {
|
|
12
26
|
enabled: boolean;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ipcRenderer } from 'electron';
|
|
2
2
|
import { BRIDGE_CHANNELS as C } from '../../shared/bridge-channels.js';
|
|
3
|
+
import { buildRenderHostDocumentUrl } from '../../shared/dmb-resource-url.js';
|
|
3
4
|
import { exposeOnMainWorld } from '../shared/expose.js';
|
|
4
5
|
/**
|
|
5
6
|
* Ask the main process (synchronously, at install time) whether native-host is
|
|
@@ -50,14 +51,10 @@ function buildBridge(cfg) {
|
|
|
50
51
|
ipcRenderer.send(C.PAGE_STACK, payload);
|
|
51
52
|
},
|
|
52
53
|
createRenderHostUrl(opts) {
|
|
53
|
-
//
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
url.searchParams.set('pagePath', opts.pagePath);
|
|
58
|
-
if (opts.isTab)
|
|
59
|
-
url.searchParams.set('isTab', '1');
|
|
60
|
-
return url.toString();
|
|
54
|
+
// Same-origin document on `dmb-resource://<bridgeId>/<appId>/<root>/<page directory>/__frame__.html`
|
|
55
|
+
// (path depth tracks the page's package directory depth) so relative
|
|
56
|
+
// package image paths resolve against the resource server, not file:// asar.
|
|
57
|
+
return buildRenderHostDocumentUrl(opts);
|
|
61
58
|
},
|
|
62
59
|
renderPreloadUrl: cfg.renderPreloadUrl,
|
|
63
60
|
device: cfg.device,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Publishes real Node built-ins into the simulator document's shared JS
|
|
3
|
+
* world (see shared/node-bindings for the consumer-side contract).
|
|
4
|
+
*
|
|
5
|
+
* The simulator WebContentsView runs nodeIntegration:false + sandbox:false +
|
|
6
|
+
* contextIsolation:false: page scripts cannot require Node modules and the
|
|
7
|
+
* vite bundle stubs `node:*` imports, but this preload shares the page's JS
|
|
8
|
+
* world and has full Node access. The FileSystemManager backends and the
|
|
9
|
+
* vpath resolver in the simulator bundle read these bindings.
|
|
10
|
+
*
|
|
11
|
+
* Trust boundary: this preload is assigned ONLY to the simulator top document
|
|
12
|
+
* (devtools' own code) via webPreferences.preload — miniapp render guests and
|
|
13
|
+
* the service host carry their own dedicated preloads, and no preload is
|
|
14
|
+
* session-registered (`setPreloads` is unused repo-wide), so mini-program
|
|
15
|
+
* code never sees these bindings.
|
|
16
|
+
*/
|
|
17
|
+
export declare function installNodeBindings(): void;
|
|
18
|
+
//# sourceMappingURL=node-bindings.d.ts.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Publishes real Node built-ins into the simulator document's shared JS
|
|
3
|
+
* world (see shared/node-bindings for the consumer-side contract).
|
|
4
|
+
*
|
|
5
|
+
* The simulator WebContentsView runs nodeIntegration:false + sandbox:false +
|
|
6
|
+
* contextIsolation:false: page scripts cannot require Node modules and the
|
|
7
|
+
* vite bundle stubs `node:*` imports, but this preload shares the page's JS
|
|
8
|
+
* world and has full Node access. The FileSystemManager backends and the
|
|
9
|
+
* vpath resolver in the simulator bundle read these bindings.
|
|
10
|
+
*
|
|
11
|
+
* Trust boundary: this preload is assigned ONLY to the simulator top document
|
|
12
|
+
* (devtools' own code) via webPreferences.preload — miniapp render guests and
|
|
13
|
+
* the service host carry their own dedicated preloads, and no preload is
|
|
14
|
+
* session-registered (`setPreloads` is unused repo-wide), so mini-program
|
|
15
|
+
* code never sees these bindings.
|
|
16
|
+
*/
|
|
17
|
+
import fs from 'node:fs';
|
|
18
|
+
import os from 'node:os';
|
|
19
|
+
import path from 'node:path';
|
|
20
|
+
import crypto from 'node:crypto';
|
|
21
|
+
import buffer from 'node:buffer';
|
|
22
|
+
import { NODE_BINDINGS_GLOBAL } from '../../shared/node-bindings.js';
|
|
23
|
+
export function installNodeBindings() {
|
|
24
|
+
// contextIsolation:false means page scripts share this world: freeze the
|
|
25
|
+
// bag (no member swap) and publish it non-writable AND non-configurable —
|
|
26
|
+
// writable:false alone still leaves `delete` and a defineProperty
|
|
27
|
+
// redefinition open to any same-world script, so the full lock needs
|
|
28
|
+
// configurable:false too. A compromised page script then cannot
|
|
29
|
+
// substitute a spoofed `fs` for the vpath resolver / FSM backends to
|
|
30
|
+
// trust by any route.
|
|
31
|
+
const existing = Object.getOwnPropertyDescriptor(globalThis, NODE_BINDINGS_GLOBAL);
|
|
32
|
+
if (existing && !existing.configurable) {
|
|
33
|
+
// Already locked (redefining a non-configurable property throws).
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const bindings = Object.freeze({ fs, os, path, crypto, buffer });
|
|
37
|
+
Object.defineProperty(globalThis, NODE_BINDINGS_GLOBAL, {
|
|
38
|
+
value: bindings,
|
|
39
|
+
writable: false,
|
|
40
|
+
configurable: false,
|
|
41
|
+
enumerable: true,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=node-bindings.js.map
|
|
@@ -19,8 +19,15 @@ export function installTempFileBridge() {
|
|
|
19
19
|
});
|
|
20
20
|
})
|
|
21
21
|
.catch(() => {
|
|
22
|
-
// best effort
|
|
23
|
-
|
|
22
|
+
// 旧的同步创建入口只能 best effort;要求立即可读的调用走 writeAndWait。
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
async writeAndWait(path, blob) {
|
|
26
|
+
const bytes = await blob.arrayBuffer();
|
|
27
|
+
await ipcRenderer.invoke('simulator:temp-file:write-confirmed', {
|
|
28
|
+
path,
|
|
29
|
+
mime: blob.type,
|
|
30
|
+
bytes,
|
|
24
31
|
});
|
|
25
32
|
},
|
|
26
33
|
revoke(path) {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared readiness wait for a host-slot content's shrink-to-fit measurement
|
|
3
|
+
* root (`[data-host-*-root]`). A one-shot `document.querySelector` at
|
|
4
|
+
* `DOMContentLoaded` time only works when the root is present in the initial
|
|
5
|
+
* HTML. Framework-rendered content (e.g. a React app) can mount its root
|
|
6
|
+
* asynchronously, after `DOMContentLoaded` has already fired — a one-shot
|
|
7
|
+
* check misses it permanently and the slot's width/height is never
|
|
8
|
+
* advertised. This keeps watching via `MutationObserver` instead of assuming
|
|
9
|
+
* a synchronous mount, without polling on a fixed delay.
|
|
10
|
+
*
|
|
11
|
+
* The "root is missing" warning exists for downstream authors who forgot the
|
|
12
|
+
* element entirely, so it must not fire on the healthy async-mount path — a
|
|
13
|
+
* warning printed on every normal load is noise that trains its readers to
|
|
14
|
+
* ignore it. Two conditions gate it, both signals rather than guessed delays:
|
|
15
|
+
* the document must be one the host actually loaded content into (not the
|
|
16
|
+
* view's own blank document), and it must have finished loading AND run out of
|
|
17
|
+
* pending work (`window.load`, then an idle callback — a framework's first
|
|
18
|
+
* commit is normal-priority work, so it always lands before idle). The
|
|
19
|
+
* observer stays armed either way, so a root that mounts even later is still
|
|
20
|
+
* picked up.
|
|
21
|
+
*/
|
|
22
|
+
export declare function whenSlotRootReady(selector: string, missingWarning: string, install: (root: HTMLElement) => void): void;
|
|
23
|
+
//# sourceMappingURL=wait-for-slot-root.d.ts.map
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared readiness wait for a host-slot content's shrink-to-fit measurement
|
|
3
|
+
* root (`[data-host-*-root]`). A one-shot `document.querySelector` at
|
|
4
|
+
* `DOMContentLoaded` time only works when the root is present in the initial
|
|
5
|
+
* HTML. Framework-rendered content (e.g. a React app) can mount its root
|
|
6
|
+
* asynchronously, after `DOMContentLoaded` has already fired — a one-shot
|
|
7
|
+
* check misses it permanently and the slot's width/height is never
|
|
8
|
+
* advertised. This keeps watching via `MutationObserver` instead of assuming
|
|
9
|
+
* a synchronous mount, without polling on a fixed delay.
|
|
10
|
+
*
|
|
11
|
+
* The "root is missing" warning exists for downstream authors who forgot the
|
|
12
|
+
* element entirely, so it must not fire on the healthy async-mount path — a
|
|
13
|
+
* warning printed on every normal load is noise that trains its readers to
|
|
14
|
+
* ignore it. Two conditions gate it, both signals rather than guessed delays:
|
|
15
|
+
* the document must be one the host actually loaded content into (not the
|
|
16
|
+
* view's own blank document), and it must have finished loading AND run out of
|
|
17
|
+
* pending work (`window.load`, then an idle callback — a framework's first
|
|
18
|
+
* commit is normal-priority work, so it always lands before idle). The
|
|
19
|
+
* observer stays armed either way, so a root that mounts even later is still
|
|
20
|
+
* picked up.
|
|
21
|
+
*/
|
|
22
|
+
export function whenSlotRootReady(selector, missingWarning, install) {
|
|
23
|
+
function attempt() {
|
|
24
|
+
// The slot's WebContentsView holds its own empty document until the host
|
|
25
|
+
// loads content into it, and this preload runs there too. That document
|
|
26
|
+
// has no author: a missing root in it is not a mistake anyone made, and
|
|
27
|
+
// warning about it fires on every app start. The observer below still gets
|
|
28
|
+
// armed, so content that does arrive is picked up.
|
|
29
|
+
const authored = location.href !== 'about:blank' && location.href !== '';
|
|
30
|
+
const root = document.querySelector(selector);
|
|
31
|
+
if (root) {
|
|
32
|
+
install(root);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
let installed = false;
|
|
36
|
+
const observer = new MutationObserver(() => {
|
|
37
|
+
const lateRoot = document.querySelector(selector);
|
|
38
|
+
if (!lateRoot)
|
|
39
|
+
return;
|
|
40
|
+
observer.disconnect();
|
|
41
|
+
installed = true;
|
|
42
|
+
install(lateRoot);
|
|
43
|
+
});
|
|
44
|
+
observer.observe(document.documentElement, { childList: true, subtree: true });
|
|
45
|
+
// Re-queries rather than trusting `installed`: the observer delivers on a
|
|
46
|
+
// microtask, so a root that is already in the DOM may not have been
|
|
47
|
+
// installed yet — it is present either way, which is what the warning is
|
|
48
|
+
// about.
|
|
49
|
+
const warnIfStillMissing = () => {
|
|
50
|
+
if (installed || !authored || document.querySelector(selector))
|
|
51
|
+
return;
|
|
52
|
+
console.warn(missingWarning);
|
|
53
|
+
};
|
|
54
|
+
// `load` alone is too early a verdict: a concurrent React root commits its
|
|
55
|
+
// first render on a scheduler task that can land after it, and the warning
|
|
56
|
+
// would then race the healthy mount it is supposed to ignore. Idle
|
|
57
|
+
// callbacks run only once the main thread has no pending work of that
|
|
58
|
+
// kind, so a root still absent then is genuinely absent. The timeout is
|
|
59
|
+
// the cap for a page that never goes idle, not the mechanism.
|
|
60
|
+
const decide = () => {
|
|
61
|
+
const idle = globalThis
|
|
62
|
+
.requestIdleCallback;
|
|
63
|
+
if (typeof idle === 'function')
|
|
64
|
+
idle(warnIfStillMissing, { timeout: 5_000 });
|
|
65
|
+
else
|
|
66
|
+
warnIfStillMissing();
|
|
67
|
+
};
|
|
68
|
+
if (document.readyState === 'complete')
|
|
69
|
+
decide();
|
|
70
|
+
else
|
|
71
|
+
window.addEventListener('load', decide, { once: true });
|
|
72
|
+
}
|
|
73
|
+
if (document.readyState === 'loading') {
|
|
74
|
+
document.addEventListener('DOMContentLoaded', attempt, { once: true });
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
attempt();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=wait-for-slot-root.js.map
|