@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,160 @@
|
|
|
1
|
+
import { BrowserWindow, View, WebContentsView } from 'electron';
|
|
2
|
+
export function createInternalDevtoolsWindow(target, opts) {
|
|
3
|
+
let win = null;
|
|
4
|
+
// The host WebContentsView, kept so open()/close paths can push the host
|
|
5
|
+
// transition themselves (see notifyHostChanged's dedup comment).
|
|
6
|
+
let hostView = null;
|
|
7
|
+
const hostChangedHandlers = new Set();
|
|
8
|
+
// The host wc subscribers currently see (non-null only while the window is
|
|
9
|
+
// visible) — the single value the late-subscriber catch-up replays.
|
|
10
|
+
let currentHost = null;
|
|
11
|
+
// A throwing handler must never stop the fan-out — console-forward's own
|
|
12
|
+
// `sink(entry)` broadcast (console-forward/index.ts) uses the same
|
|
13
|
+
// isolation for exactly this reason.
|
|
14
|
+
//
|
|
15
|
+
// Dedups on the TRANSITION, not the event count: this controller pushes
|
|
16
|
+
// the transition explicitly at every point it performs one (open(), the
|
|
17
|
+
// intercepted close, dispose/'closed'), AND the native 'show'/'hide'
|
|
18
|
+
// handlers below may report the same transition again. The explicit push
|
|
19
|
+
// is the authority — on real macOS the native events were observed
|
|
20
|
+
// (instrumented-bundle trace against the live app) to fire for NEITHER
|
|
21
|
+
// `show()`/`showInactive()` NOR `hide()`, which left every subscriber
|
|
22
|
+
// permanently believing the window never opened; the events are kept only
|
|
23
|
+
// as belt-and-suspenders for external show/hide paths.
|
|
24
|
+
function notifyHostChanged(hostWc) {
|
|
25
|
+
if (hostWc === currentHost)
|
|
26
|
+
return;
|
|
27
|
+
currentHost = hostWc;
|
|
28
|
+
for (const handler of [...hostChangedHandlers]) {
|
|
29
|
+
try {
|
|
30
|
+
handler(hostWc);
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
console.warn('[internal-devtools-window] onHostChanged handler threw, other handlers still ran:', err instanceof Error ? err.message : String(err));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function resizeHostView(hostWindow, view) {
|
|
38
|
+
try {
|
|
39
|
+
const [width, height] = hostWindow.getContentSize();
|
|
40
|
+
view.setBounds({ x: 0, y: 0, width, height });
|
|
41
|
+
}
|
|
42
|
+
catch { /* window mid-construction / torn down — next resize event re-fires */ }
|
|
43
|
+
}
|
|
44
|
+
// Builds the window + host + DevTools attachment exactly once. A second
|
|
45
|
+
// call (win already alive) is a no-op — see module doc for why this
|
|
46
|
+
// attachment is never rebuilt.
|
|
47
|
+
function buildOnce() {
|
|
48
|
+
if (win)
|
|
49
|
+
return;
|
|
50
|
+
const hostWindow = new BrowserWindow({
|
|
51
|
+
width: 1000,
|
|
52
|
+
height: 700,
|
|
53
|
+
title: '全局调试',
|
|
54
|
+
show: false,
|
|
55
|
+
});
|
|
56
|
+
win = hostWindow;
|
|
57
|
+
// The window's default `contentView` is a bare WebContentsView tied to
|
|
58
|
+
// its own (never-loaded) webContents, not a container that accepts
|
|
59
|
+
// children — mirror main-window/create.ts's pattern: wrap it in a fresh
|
|
60
|
+
// `View` so the host can be added as a child.
|
|
61
|
+
const view = new WebContentsView();
|
|
62
|
+
hostView = view;
|
|
63
|
+
const container = new View();
|
|
64
|
+
container.addChildView(view);
|
|
65
|
+
hostWindow.contentView = container;
|
|
66
|
+
resizeHostView(hostWindow, view);
|
|
67
|
+
hostWindow.on('resize', () => resizeHostView(hostWindow, view));
|
|
68
|
+
// Intercept the user-initiated close (title-bar button, Cmd+W) and hide
|
|
69
|
+
// instead of destroy — see module doc for why destroying and rebuilding
|
|
70
|
+
// this attachment cannot be made reliable. `dispose()` bypasses this via
|
|
71
|
+
// `win.destroy()`, which Electron guarantees does NOT emit 'close'.
|
|
72
|
+
// EXCEPT during a real app quit: preventDefault() on 'close' while the
|
|
73
|
+
// app is quitting CANCELS the quit itself (Electron closes every window
|
|
74
|
+
// as part of quit and aborts if any refuses), stranding the process with
|
|
75
|
+
// a hidden window — let the native close proceed instead.
|
|
76
|
+
hostWindow.on('close', (event) => {
|
|
77
|
+
if (opts?.isAppQuitting?.())
|
|
78
|
+
return;
|
|
79
|
+
event.preventDefault();
|
|
80
|
+
hostWindow.hide();
|
|
81
|
+
// Push the transition ourselves — the native 'hide' event is not
|
|
82
|
+
// reliable (see notifyHostChanged's dedup comment).
|
|
83
|
+
notifyHostChanged(null);
|
|
84
|
+
});
|
|
85
|
+
// Any real destruction (quit-time close above, or dispose()'s destroy())
|
|
86
|
+
// must both release the controller's handle and tell subscribers the
|
|
87
|
+
// host is gone.
|
|
88
|
+
hostWindow.on('closed', () => {
|
|
89
|
+
if (win !== hostWindow)
|
|
90
|
+
return;
|
|
91
|
+
win = null;
|
|
92
|
+
notifyHostChanged(null);
|
|
93
|
+
});
|
|
94
|
+
hostWindow.on('hide', () => notifyHostChanged(null));
|
|
95
|
+
hostWindow.on('show', () => notifyHostChanged(view.webContents));
|
|
96
|
+
if (!target.webContents.isDestroyed()) {
|
|
97
|
+
target.webContents.setDevToolsWebContents(view.webContents);
|
|
98
|
+
target.webContents.openDevTools({ mode: 'detach', activate: false });
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
open() {
|
|
103
|
+
buildOnce();
|
|
104
|
+
// Mirrors main-window/create.ts's exact test-mode rule: `showInactive()`
|
|
105
|
+
// makes the window visible without activating it (and thus never gives
|
|
106
|
+
// it OS-level focus), so e2e runs opening this window never steal
|
|
107
|
+
// foreground focus from whatever the developer running the suite has
|
|
108
|
+
// open. Production always wants a real show()+focus() — this is the
|
|
109
|
+
// one button click that's supposed to bring the debug window forward.
|
|
110
|
+
if (process.env.NODE_ENV === 'test') {
|
|
111
|
+
win.showInactive();
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
win.show();
|
|
115
|
+
win.focus();
|
|
116
|
+
}
|
|
117
|
+
// Push the transition ourselves — the native 'show' event is not
|
|
118
|
+
// reliable (see notifyHostChanged's dedup comment); relying on it left
|
|
119
|
+
// the mirrors permanently unsubscribed on real macOS.
|
|
120
|
+
if (hostView)
|
|
121
|
+
notifyHostChanged(hostView.webContents);
|
|
122
|
+
},
|
|
123
|
+
dispose() {
|
|
124
|
+
if (!win)
|
|
125
|
+
return;
|
|
126
|
+
const hostWindow = win;
|
|
127
|
+
// destroy() emits 'closed', whose handler above nulls `win` and
|
|
128
|
+
// notifies subscribers — the fallback below only covers a window that
|
|
129
|
+
// was somehow already destroyed without that handler having run.
|
|
130
|
+
if (!hostWindow.isDestroyed())
|
|
131
|
+
hostWindow.destroy();
|
|
132
|
+
if (win === hostWindow) {
|
|
133
|
+
win = null;
|
|
134
|
+
notifyHostChanged(null);
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
onHostChanged(handler) {
|
|
138
|
+
hostChangedHandlers.add(handler);
|
|
139
|
+
// Late-subscriber catch-up (see the interface doc): replayed a
|
|
140
|
+
// microtask later, never synchronously, and re-validated at fire time —
|
|
141
|
+
// an unsubscribe or a hide landing before the microtask must win.
|
|
142
|
+
if (currentHost) {
|
|
143
|
+
queueMicrotask(() => {
|
|
144
|
+
if (!hostChangedHandlers.has(handler))
|
|
145
|
+
return;
|
|
146
|
+
if (!currentHost)
|
|
147
|
+
return;
|
|
148
|
+
try {
|
|
149
|
+
handler(currentHost);
|
|
150
|
+
}
|
|
151
|
+
catch (err) {
|
|
152
|
+
console.warn('[internal-devtools-window] onHostChanged catch-up handler threw:', err instanceof Error ? err.message : String(err));
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
return () => { hostChangedHandlers.delete(handler); };
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -6,6 +6,14 @@ export interface WindowOptions {
|
|
|
6
6
|
minWidth?: number;
|
|
7
7
|
minHeight?: number;
|
|
8
8
|
indexHtml: string;
|
|
9
|
+
/**
|
|
10
|
+
* Query string appended to the loaded `file://` URL. This is how a window
|
|
11
|
+
* receives its own bootstrap identity (the workbench window reads the project
|
|
12
|
+
* it belongs to from here), so the renderer entry knows what to mount without
|
|
13
|
+
* a round-trip. Survives navigation-hardening: that check matches on the
|
|
14
|
+
* `file://` prefix only and ignores the query (see navigation-hardening.ts).
|
|
15
|
+
*/
|
|
16
|
+
query?: Record<string, string>;
|
|
9
17
|
/**
|
|
10
18
|
* Auto-show the window on `ready-to-show` in non-test envs. Defaults to
|
|
11
19
|
* `true`. `false` lets a login-gating host keep the window hidden and call
|
|
@@ -13,5 +21,13 @@ export interface WindowOptions {
|
|
|
13
21
|
*/
|
|
14
22
|
autoShow?: boolean;
|
|
15
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Shows `win` the way the current env expects: `showInactive()` in test env
|
|
26
|
+
* so e2e windows don't steal focus, `show()` otherwise. Shared by this
|
|
27
|
+
* module's own `ready-to-show` handler and by the workbench window manager's
|
|
28
|
+
* reveal-after-hook-and-paint gate (`workbench-window.ts`), so the two reveal
|
|
29
|
+
* paths can never pick different show methods.
|
|
30
|
+
*/
|
|
31
|
+
export declare function revealMainWindow(win: BrowserWindow): void;
|
|
16
32
|
export declare function createMainWindow(opts: WindowOptions): BrowserWindow;
|
|
17
33
|
//# sourceMappingURL=create.d.ts.map
|
|
@@ -3,6 +3,19 @@ import path from 'path';
|
|
|
3
3
|
import { mainPreloadPath } from '../../utils/paths.js';
|
|
4
4
|
import { themeBg } from '../../utils/theme.js';
|
|
5
5
|
import { applyNavigationHardening } from '../navigation-hardening.js';
|
|
6
|
+
/**
|
|
7
|
+
* Shows `win` the way the current env expects: `showInactive()` in test env
|
|
8
|
+
* so e2e windows don't steal focus, `show()` otherwise. Shared by this
|
|
9
|
+
* module's own `ready-to-show` handler and by the workbench window manager's
|
|
10
|
+
* reveal-after-hook-and-paint gate (`workbench-window.ts`), so the two reveal
|
|
11
|
+
* paths can never pick different show methods.
|
|
12
|
+
*/
|
|
13
|
+
export function revealMainWindow(win) {
|
|
14
|
+
if (process.env.NODE_ENV === 'test')
|
|
15
|
+
win.showInactive();
|
|
16
|
+
else
|
|
17
|
+
win.show();
|
|
18
|
+
}
|
|
6
19
|
export function createMainWindow(opts) {
|
|
7
20
|
const mainWindow = new BrowserWindow({
|
|
8
21
|
width: opts.width ?? 1280,
|
|
@@ -25,16 +38,11 @@ export function createMainWindow(opts) {
|
|
|
25
38
|
const isTest = process.env.NODE_ENV === 'test';
|
|
26
39
|
// Visibility is governed by `autoShow` in BOTH envs. A login-gating host
|
|
27
40
|
// opts out via `autoShow: false` and reveals the window itself once auth
|
|
28
|
-
// passes — don't flash an un-authed window. The
|
|
29
|
-
// show
|
|
30
|
-
//
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if (isTest)
|
|
34
|
-
mainWindow.showInactive();
|
|
35
|
-
else
|
|
36
|
-
mainWindow.show();
|
|
37
|
-
}
|
|
41
|
+
// passes — don't flash an un-authed window. The framework must never
|
|
42
|
+
// force-show when the host opted out, in test env either (that would
|
|
43
|
+
// fight the host's own reveal handler).
|
|
44
|
+
if (opts.autoShow !== false)
|
|
45
|
+
revealMainWindow(mainWindow);
|
|
38
46
|
// Don't auto-open a detached DevTools for the devtools UI shell itself —
|
|
39
47
|
// it's noise for normal use (the mini-app's Console lives in the embedded
|
|
40
48
|
// right-panel DevTools, not here). Opt in via env for debugging the shell.
|
|
@@ -46,7 +54,7 @@ export function createMainWindow(opts) {
|
|
|
46
54
|
// Restrict the main renderer to file:// URLs under the renderer bundle and
|
|
47
55
|
// route every popup through the OS browser. See navigation-hardening.ts.
|
|
48
56
|
applyNavigationHardening(mainWindow.webContents, rendererDir);
|
|
49
|
-
mainWindow.loadFile(opts.indexHtml);
|
|
57
|
+
mainWindow.loadFile(opts.indexHtml, opts.query ? { query: opts.query } : undefined);
|
|
50
58
|
const container = new View();
|
|
51
59
|
const mainWebView = mainWindow.contentView;
|
|
52
60
|
container.addChildView(mainWebView);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BrowserWindow } from 'electron';
|
|
2
2
|
import type { WorkbenchContext } from '../../services/workbench-context.js';
|
|
3
3
|
import { type Disposable } from '@dimina-kit/electron-deck/main';
|
|
4
4
|
export interface MainWindowEventState {
|
|
@@ -1,5 +1,29 @@
|
|
|
1
|
-
import { globalShortcut } from 'electron';
|
|
1
|
+
import { BrowserWindow, globalShortcut } from 'electron';
|
|
2
2
|
import { DisposableRegistry, toDisposable } from '@dimina-kit/electron-deck/main';
|
|
3
|
+
const DEVTOOLS_ACCELERATOR = 'CommandOrControl+Shift+I';
|
|
4
|
+
let devToolsShortcutHolders = 0;
|
|
5
|
+
/**
|
|
6
|
+
* Claims a share of the ONE process-wide DevTools accelerator. `globalShortcut`
|
|
7
|
+
* is a process singleton: a per-window registration is refused for every window
|
|
8
|
+
* after the first, which would give that first window the shortcut for the
|
|
9
|
+
* whole app and kill it outright when that window closed. So the accelerator is
|
|
10
|
+
* registered once, opens whichever window is focused when it is pressed, and is
|
|
11
|
+
* released only when the last holder lets go — a later window can then claim it
|
|
12
|
+
* again. `unregisterAll()` in lifecycle stays as a process-exit safety net.
|
|
13
|
+
*/
|
|
14
|
+
function acquireDevToolsShortcut() {
|
|
15
|
+
if (devToolsShortcutHolders === 0) {
|
|
16
|
+
globalShortcut.register(DEVTOOLS_ACCELERATOR, () => {
|
|
17
|
+
BrowserWindow.getFocusedWindow()?.webContents.openDevTools({ mode: 'detach' });
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
devToolsShortcutHolders += 1;
|
|
21
|
+
return toDisposable(() => {
|
|
22
|
+
devToolsShortcutHolders -= 1;
|
|
23
|
+
if (devToolsShortcutHolders === 0)
|
|
24
|
+
globalShortcut.unregister(DEVTOOLS_ACCELERATOR);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
3
27
|
export function wireMainWindowEvents(win, state = {}) {
|
|
4
28
|
const registry = new DisposableRegistry();
|
|
5
29
|
const mainWebView = win.contentView.children[0];
|
|
@@ -24,18 +48,7 @@ export function wireMainWindowEvents(win, state = {}) {
|
|
|
24
48
|
win.removeListener('close', onCloseHandler);
|
|
25
49
|
}));
|
|
26
50
|
}
|
|
27
|
-
|
|
28
|
-
// to ctx.registry. `unregisterAll()` in lifecycle remains as a process-exit
|
|
29
|
-
// safety net.
|
|
30
|
-
const devToolsAccelerator = 'CommandOrControl+Shift+I';
|
|
31
|
-
const registered = globalShortcut.register(devToolsAccelerator, () => {
|
|
32
|
-
win.webContents.openDevTools({ mode: 'detach' });
|
|
33
|
-
});
|
|
34
|
-
if (registered) {
|
|
35
|
-
registry.add(toDisposable(() => {
|
|
36
|
-
globalShortcut.unregister(devToolsAccelerator);
|
|
37
|
-
}));
|
|
38
|
-
}
|
|
51
|
+
registry.add(acquireDevToolsShortcut());
|
|
39
52
|
return registry;
|
|
40
53
|
}
|
|
41
54
|
//# sourceMappingURL=events.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { createMainWindow } from './create.js';
|
|
1
|
+
export { createMainWindow, revealMainWindow } from './create.js';
|
|
2
2
|
export type { WindowOptions } from './create.js';
|
|
3
3
|
export { wireMainWindowEvents } from './events.js';
|
|
4
4
|
export type { MainWindowEventState } from './events.js';
|
|
@@ -1,93 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import type { ServiceHostSpec } from '../../services/service-host-pool/pool.js';
|
|
3
|
-
/**
|
|
4
|
-
* Default service-host partition when no project `appId` is supplied (the
|
|
5
|
-
* pre-warm pool's shared, isolation-UNAWARE session — see `serviceHostSpec`).
|
|
6
|
-
* Per-project service hosts get a `persist:miniapp-<key>` partition instead so
|
|
7
|
-
* their localStorage/cookies are shared with that project's render side only.
|
|
8
|
-
*/
|
|
9
|
-
export declare const SERVICE_HOST_PARTITION = "persist:simulator";
|
|
10
|
-
/** Absolute path to the service-host preload (loaded at runtime by path). */
|
|
11
|
-
export declare const serviceHostPreloadPath: string;
|
|
12
|
-
export interface ServiceHostWindowOptions {
|
|
13
|
-
bridgeId: string;
|
|
14
|
-
appId: string;
|
|
15
|
-
/** Current project root. Folded into the session partition (with appId) so a
|
|
16
|
-
* different project declaring the same appId gets isolated storage. Omitted on
|
|
17
|
-
* the pre-warm pool path (no project known yet → shared partition). */
|
|
18
|
-
projectPath?: string;
|
|
19
|
-
pagePath: string;
|
|
20
|
-
pkgRoot: string;
|
|
21
|
-
root?: string;
|
|
22
|
-
resourceBaseUrl: string;
|
|
23
|
-
hostEnvSnapshot?: Record<string, unknown>;
|
|
24
|
-
/**
|
|
25
|
-
* Custom API namespace names (host config `apiNamespaces`, e.g. `['qd']`).
|
|
26
|
-
* Encoded into the spawn URL so the service-host preload can install them as
|
|
27
|
-
* `globalThis.__diminaApiNamespaces` before service.js evaluates — without
|
|
28
|
-
* which page logic referencing `qd.*` throws `ReferenceError: qd is not defined`.
|
|
29
|
-
*/
|
|
30
|
-
apiNamespaces?: string[];
|
|
31
|
-
/**
|
|
32
|
-
* Observes a spawn-navigation `loadURL` rejection (NOT encoded into the
|
|
33
|
-
* spawn URL). Without it the fresh-window path swallows the failure entirely
|
|
34
|
-
* — `did-finish-load` never fires, the session hangs, and the only signal is
|
|
35
|
-
* the launch watchdog's late timeout instead of the real cause.
|
|
36
|
-
*/
|
|
37
|
-
onLoadFailed?: (err: unknown) => void;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Construct an (un-navigated) service-host BrowserWindow. Split out from
|
|
41
|
-
* `createServiceHostWindow` so a pre-warm pool can build the window once and
|
|
42
|
-
* navigate it per spawn (the spawn context lives in the URL — see
|
|
43
|
-
* `buildServiceHostSpawnUrl`). The process-model flags here are the contract
|
|
44
|
-
* the service-host preload depends on (it `require('electron')` and writes
|
|
45
|
-
* globals onto the page realm).
|
|
46
|
-
*/
|
|
47
|
-
export declare function constructServiceHostWindow(opts?: {
|
|
48
|
-
appId?: string;
|
|
49
|
-
partition?: string;
|
|
50
|
-
}): BrowserWindow;
|
|
51
|
-
/**
|
|
52
|
-
* Build the file:// spawn URL carrying the per-spawn context the preload reads
|
|
53
|
-
* from `location.search` at eval time (bridgeId/appId/pagePath/pkgRoot/
|
|
54
|
-
* resourceBaseUrl/hostEnv).
|
|
55
|
-
*/
|
|
56
|
-
export declare function buildServiceHostSpawnUrl(opts: ServiceHostWindowOptions): string;
|
|
57
|
-
/**
|
|
58
|
-
* Navigate a (constructed or pooled) service-host window to its spawn URL. The
|
|
59
|
-
* preload re-evaluates on this navigation, rebuilding `__diminaSpawnContext`.
|
|
60
|
-
* Returns the load promise (resolves on did-finish-load). Attaches the dev-only
|
|
61
|
-
* detached-DevTools hook, matching the original behavior.
|
|
62
|
-
*
|
|
63
|
-
* A `loadURL` rejection is swallowed — the pooled-window recycle path expects
|
|
64
|
-
* a failed navigation not to reject the caller — but `opts.onLoadFailed`, when
|
|
65
|
-
* given, still observes the original rejection reason (routed by the caller
|
|
66
|
-
* into the diagnostics bus) before this resolves.
|
|
67
|
-
*/
|
|
68
|
-
export declare function navigateServiceHost(win: BrowserWindow, url: string, opts?: {
|
|
69
|
-
onLoadFailed?: (err: unknown) => void;
|
|
70
|
-
}): Promise<void>;
|
|
71
|
-
/**
|
|
72
|
-
* The spec a `ServiceHostPool` uses to pre-warm service-host windows. Keeps the
|
|
73
|
-
* pooled window byte-equivalent to `constructServiceHostWindow`'s output, and
|
|
74
|
-
* opts out of the reset storage-clear because the service host shares its
|
|
75
|
-
* session with live projects (see ServiceHostSpec docs).
|
|
76
|
-
*
|
|
77
|
-
* KNOWN BLOCKER (intentional): the pre-warm pool is NOT per-project isolation
|
|
78
|
-
* aware. It warms windows on ONE `defaultSpec` partition before any project is
|
|
79
|
-
* known, so a pooled window cannot carry a project-derived partition — handing
|
|
80
|
-
* one project's warmed window to another project would cross-contaminate
|
|
81
|
-
* storage. Therefore the pool's `defaultSpec` (and pooled `acquire`) call this
|
|
82
|
-
* with NO appId → the shared `persist:simulator` partition; per-project
|
|
83
|
-
* isolation only applies on the default (non-pooled) `createServiceHostWindow`
|
|
84
|
-
* path, which passes the project's appId. Reconciling pooling with per-project
|
|
85
|
-
* partitions (e.g. per-partition sub-pools) is out of scope for this change.
|
|
86
|
-
*/
|
|
87
|
-
export declare function serviceHostSpec(appId?: string, projectPath?: string): ServiceHostSpec;
|
|
88
|
-
/**
|
|
89
|
-
* Construct + navigate a fresh service-host window (the non-pool path).
|
|
90
|
-
* Behavior-identical to the pre-refactor implementation.
|
|
91
|
-
*/
|
|
92
|
-
export declare function createServiceHostWindow(opts: ServiceHostWindowOptions): BrowserWindow;
|
|
1
|
+
export * from '@dimina-kit/electron-runtime/main/service-host-window';
|
|
93
2
|
//# sourceMappingURL=create.d.ts.map
|
|
@@ -1,155 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { pathToFileURL } from 'node:url';
|
|
4
|
-
import { devtoolsPackageRoot } from '../../utils/paths.js';
|
|
5
|
-
import { configureMiniappSession, miniappPartition, SHARED_MINIAPP_PARTITION } from '../../services/views/miniapp-partition.js';
|
|
6
|
-
/**
|
|
7
|
-
* Default service-host partition when no project `appId` is supplied (the
|
|
8
|
-
* pre-warm pool's shared, isolation-UNAWARE session — see `serviceHostSpec`).
|
|
9
|
-
* Per-project service hosts get a `persist:miniapp-<key>` partition instead so
|
|
10
|
-
* their localStorage/cookies are shared with that project's render side only.
|
|
11
|
-
*/
|
|
12
|
-
export const SERVICE_HOST_PARTITION = SHARED_MINIAPP_PARTITION;
|
|
13
|
-
/** Absolute path to the service-host preload (loaded at runtime by path). */
|
|
14
|
-
export const serviceHostPreloadPath = path.join(devtoolsPackageRoot, 'dist/service-host/preload.cjs');
|
|
15
|
-
const serviceHostHtmlPath = path.join(devtoolsPackageRoot, 'dist/service-host/service.html');
|
|
16
|
-
/**
|
|
17
|
-
* Construct an (un-navigated) service-host BrowserWindow. Split out from
|
|
18
|
-
* `createServiceHostWindow` so a pre-warm pool can build the window once and
|
|
19
|
-
* navigate it per spawn (the spawn context lives in the URL — see
|
|
20
|
-
* `buildServiceHostSpawnUrl`). The process-model flags here are the contract
|
|
21
|
-
* the service-host preload depends on (it `require('electron')` and writes
|
|
22
|
-
* globals onto the page realm).
|
|
23
|
-
*/
|
|
24
|
-
export function constructServiceHostWindow(opts = {}) {
|
|
25
|
-
const partition = opts.partition ?? SERVICE_HOST_PARTITION;
|
|
26
|
-
// Apply the simulator runtime's protocol handlers + webRequest policies to
|
|
27
|
-
// THIS project's session before the window loads. Idempotent per partition.
|
|
28
|
-
configureMiniappSession(partition);
|
|
29
|
-
return new BrowserWindow({
|
|
30
|
-
width: 980,
|
|
31
|
-
height: 720,
|
|
32
|
-
show: false,
|
|
33
|
-
title: opts.appId ? `Dimina Service Host: ${opts.appId}` : 'Dimina Service Host',
|
|
34
|
-
webPreferences: {
|
|
35
|
-
partition,
|
|
36
|
-
nodeIntegration: false,
|
|
37
|
-
contextIsolation: false,
|
|
38
|
-
sandbox: false,
|
|
39
|
-
preload: serviceHostPreloadPath,
|
|
40
|
-
devTools: true,
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Build the file:// spawn URL carrying the per-spawn context the preload reads
|
|
46
|
-
* from `location.search` at eval time (bridgeId/appId/pagePath/pkgRoot/
|
|
47
|
-
* resourceBaseUrl/hostEnv).
|
|
48
|
-
*/
|
|
49
|
-
export function buildServiceHostSpawnUrl(opts) {
|
|
50
|
-
const url = new URL(pathToFileURL(serviceHostHtmlPath).toString());
|
|
51
|
-
url.searchParams.set('bridgeId', opts.bridgeId);
|
|
52
|
-
url.searchParams.set('appId', opts.appId);
|
|
53
|
-
url.searchParams.set('pagePath', opts.pagePath);
|
|
54
|
-
url.searchParams.set('pkgRoot', opts.pkgRoot);
|
|
55
|
-
url.searchParams.set('root', opts.root || 'main');
|
|
56
|
-
url.searchParams.set('resourceBaseUrl', opts.resourceBaseUrl);
|
|
57
|
-
if (opts.hostEnvSnapshot) {
|
|
58
|
-
// Encode the resolved host-env so preload can hydrate
|
|
59
|
-
// `__diminaSpawnContext.hostEnvSnapshot` before service.js loads.
|
|
60
|
-
// Without this, sync-impls/system-info.ts falls back to generic defaults.
|
|
61
|
-
url.searchParams.set('hostEnv', encodeURIComponent(JSON.stringify(opts.hostEnvSnapshot)));
|
|
62
|
-
}
|
|
63
|
-
if (opts.apiNamespaces && opts.apiNamespaces.length > 0) {
|
|
64
|
-
// CSV of namespace names; the preload reads this back into
|
|
65
|
-
// `globalThis.__diminaApiNamespaces`. URLSearchParams round-trips the comma.
|
|
66
|
-
url.searchParams.set('apiNamespaces', opts.apiNamespaces.join(','));
|
|
67
|
-
}
|
|
68
|
-
return url.toString();
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Navigate a (constructed or pooled) service-host window to its spawn URL. The
|
|
72
|
-
* preload re-evaluates on this navigation, rebuilding `__diminaSpawnContext`.
|
|
73
|
-
* Returns the load promise (resolves on did-finish-load). Attaches the dev-only
|
|
74
|
-
* detached-DevTools hook, matching the original behavior.
|
|
75
|
-
*
|
|
76
|
-
* A `loadURL` rejection is swallowed — the pooled-window recycle path expects
|
|
77
|
-
* a failed navigation not to reject the caller — but `opts.onLoadFailed`, when
|
|
78
|
-
* given, still observes the original rejection reason (routed by the caller
|
|
79
|
-
* into the diagnostics bus) before this resolves.
|
|
80
|
-
*/
|
|
81
|
-
export function navigateServiceHost(win, url, opts) {
|
|
82
|
-
const loaded = Promise.resolve(win.loadURL(url)).then(() => undefined, (err) => {
|
|
83
|
-
opts?.onLoadFailed?.(err);
|
|
84
|
-
return undefined;
|
|
85
|
-
});
|
|
86
|
-
if (!app.isPackaged && process.env.NODE_ENV !== 'test') {
|
|
87
|
-
// Recycled pooled windows get navigated repeatedly. A `once` hook that never
|
|
88
|
-
// fires (the spawn was disposed before its service.html settled) stays on the
|
|
89
|
-
// reused webContents and the next spawn's hook fires alongside it → DevTools
|
|
90
|
-
// can open twice and stale hooks accumulate. Remove the prior hook before
|
|
91
|
-
// attaching a fresh one. (Audit A6; dev-only.)
|
|
92
|
-
const w = win;
|
|
93
|
-
if (w.__diminaDevToolsHook) {
|
|
94
|
-
try {
|
|
95
|
-
win.webContents.removeListener('did-finish-load', w.__diminaDevToolsHook);
|
|
96
|
-
}
|
|
97
|
-
catch { /* wc gone */ }
|
|
98
|
-
}
|
|
99
|
-
const hook = () => {
|
|
100
|
-
// URL-guard so a reset's about:blank load doesn't pop DevTools.
|
|
101
|
-
if (!win.isDestroyed() && win.webContents.getURL().includes('service.html')) {
|
|
102
|
-
win.webContents.openDevTools({ mode: 'detach' });
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
w.__diminaDevToolsHook = hook;
|
|
106
|
-
win.webContents.once('did-finish-load', hook);
|
|
107
|
-
}
|
|
108
|
-
return loaded;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* The spec a `ServiceHostPool` uses to pre-warm service-host windows. Keeps the
|
|
112
|
-
* pooled window byte-equivalent to `constructServiceHostWindow`'s output, and
|
|
113
|
-
* opts out of the reset storage-clear because the service host shares its
|
|
114
|
-
* session with live projects (see ServiceHostSpec docs).
|
|
115
|
-
*
|
|
116
|
-
* KNOWN BLOCKER (intentional): the pre-warm pool is NOT per-project isolation
|
|
117
|
-
* aware. It warms windows on ONE `defaultSpec` partition before any project is
|
|
118
|
-
* known, so a pooled window cannot carry a project-derived partition — handing
|
|
119
|
-
* one project's warmed window to another project would cross-contaminate
|
|
120
|
-
* storage. Therefore the pool's `defaultSpec` (and pooled `acquire`) call this
|
|
121
|
-
* with NO appId → the shared `persist:simulator` partition; per-project
|
|
122
|
-
* isolation only applies on the default (non-pooled) `createServiceHostWindow`
|
|
123
|
-
* path, which passes the project's appId. Reconciling pooling with per-project
|
|
124
|
-
* partitions (e.g. per-partition sub-pools) is out of scope for this change.
|
|
125
|
-
*/
|
|
126
|
-
export function serviceHostSpec(appId, projectPath) {
|
|
127
|
-
return {
|
|
128
|
-
// Per-project partition when an appId is known (so this project's service
|
|
129
|
-
// host shares storage ONLY with its own render side); the shared partition
|
|
130
|
-
// for the pre-warm pool's default spec (no appId — see KNOWN BLOCKER below).
|
|
131
|
-
// projectPath joins the key so same-appId/different-path projects isolate;
|
|
132
|
-
// it must match the simulator WCV's partition (view-manager passes the same
|
|
133
|
-
// (appId, projectPath)).
|
|
134
|
-
partition: appId ? miniappPartition(appId, projectPath) : SERVICE_HOST_PARTITION,
|
|
135
|
-
preloadPath: serviceHostPreloadPath,
|
|
136
|
-
size: { width: 980, height: 720 },
|
|
137
|
-
contextIsolation: false,
|
|
138
|
-
sandbox: false,
|
|
139
|
-
nodeIntegration: false,
|
|
140
|
-
clearStorageOnReset: false,
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Construct + navigate a fresh service-host window (the non-pool path).
|
|
145
|
-
* Behavior-identical to the pre-refactor implementation.
|
|
146
|
-
*/
|
|
147
|
-
export function createServiceHostWindow(opts) {
|
|
148
|
-
// Default (non-pooled) path: pin the service host to THIS project's partition
|
|
149
|
-
// so its logic-layer localStorage/cookies are shared with the project's render
|
|
150
|
-
// side only, never with other projects.
|
|
151
|
-
const win = constructServiceHostWindow({ appId: opts.appId, partition: miniappPartition(opts.appId, opts.projectPath) });
|
|
152
|
-
void navigateServiceHost(win, buildServiceHostSpawnUrl(opts), { onLoadFailed: opts.onLoadFailed });
|
|
153
|
-
return win;
|
|
154
|
-
}
|
|
1
|
+
export * from '@dimina-kit/electron-runtime/main/service-host-window';
|
|
155
2
|
//# sourceMappingURL=create.js.map
|