@dimina-kit/devtools 0.4.0 → 0.5.0-dev.20260908120530
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -660
- package/dist/main/api.d.ts +2 -1
- package/dist/main/app/app.d.ts +41 -12
- package/dist/main/app/app.js +299 -514
- package/dist/main/app/bootstrap.d.ts +8 -5
- package/dist/main/app/bootstrap.js +15 -15
- package/dist/main/app/editor-view.d.ts +21 -0
- package/dist/main/app/editor-view.js +71 -0
- package/dist/main/app/global-mirrors.d.ts +23 -0
- package/dist/main/app/global-mirrors.js +37 -0
- package/dist/main/app/host-sidebar-default.d.ts +19 -0
- package/dist/main/app/host-sidebar-default.js +44 -0
- package/dist/main/app/lifecycle.d.ts +12 -1
- package/dist/main/app/lifecycle.js +27 -1
- package/dist/main/app/menu-setup.d.ts +13 -0
- package/dist/main/app/menu-setup.js +49 -0
- package/dist/main/app/native-overview.d.ts +1 -1
- package/dist/main/app/open-project-ipc.d.ts +13 -0
- package/dist/main/app/open-project-ipc.js +21 -0
- package/dist/main/app/project-list-surface.d.ts +31 -0
- package/dist/main/app/project-list-surface.js +20 -0
- package/dist/main/app/project-window.d.ts +36 -0
- package/dist/main/app/project-window.js +93 -0
- package/dist/main/app/servers.d.ts +17 -0
- package/dist/main/app/servers.js +60 -0
- package/dist/main/app/ui-extension-targets.d.ts +42 -0
- package/dist/main/app/ui-extension-targets.js +101 -0
- package/dist/main/app/window-close-reveal.harness.d.ts +34 -0
- package/dist/main/app/window-close-reveal.harness.js +65 -0
- package/dist/main/app/window-events.d.ts +15 -0
- package/dist/main/app/window-events.js +45 -0
- package/dist/main/app/window-runtime-services.d.ts +41 -0
- package/dist/main/app/window-runtime-services.js +197 -0
- package/dist/main/app/workbench-modules.d.ts +24 -0
- package/dist/main/app/workbench-modules.js +51 -0
- package/dist/main/app/workbench-window.d.ts +85 -0
- package/dist/main/app/workbench-window.js +310 -0
- package/dist/main/index.bundle.js +11712 -9986
- package/dist/main/index.js +49 -1
- package/dist/main/ipc/app-lifecycle.d.ts +1 -31
- package/dist/main/ipc/app-lifecycle.js +1 -53
- package/dist/main/ipc/app.d.ts +4 -1
- package/dist/main/ipc/app.js +4 -3
- package/dist/main/ipc/bridge-router.d.ts +19 -116
- package/dist/main/ipc/bridge-router.js +28 -2128
- package/dist/main/ipc/device-picker.d.ts +16 -0
- package/dist/main/ipc/device-picker.js +27 -0
- package/dist/main/ipc/index.d.ts +5 -0
- package/dist/main/ipc/index.js +5 -0
- package/dist/main/ipc/internal-devtools.d.ts +16 -0
- package/dist/main/ipc/internal-devtools.js +10 -0
- package/dist/main/ipc/page-scroll.d.ts +1 -13
- package/dist/main/ipc/page-scroll.js +1 -16
- package/dist/main/ipc/popover.d.ts +4 -1
- package/dist/main/ipc/popover.js +26 -19
- package/dist/main/ipc/project-create.d.ts +16 -0
- package/dist/main/ipc/project-create.js +27 -0
- package/dist/main/ipc/project-fs.d.ts +38 -3
- package/dist/main/ipc/project-fs.js +53 -22
- package/dist/main/ipc/projects.d.ts +3 -3
- package/dist/main/ipc/projects.js +47 -11
- package/dist/main/ipc/session-listener-bag.d.ts +1 -40
- package/dist/main/ipc/session-listener-bag.js +1 -39
- package/dist/main/ipc/session.d.ts +4 -1
- package/dist/main/ipc/session.js +26 -26
- package/dist/main/ipc/settings.d.ts +4 -1
- package/dist/main/ipc/settings.js +17 -19
- package/dist/main/ipc/simulator-module.d.ts +9 -3
- package/dist/main/ipc/simulator-module.js +13 -10
- package/dist/main/ipc/simulator.d.ts +4 -1
- package/dist/main/ipc/simulator.js +12 -18
- package/dist/main/ipc/tooltip.d.ts +14 -0
- package/dist/main/ipc/tooltip.js +29 -0
- package/dist/main/ipc/views.d.ts +19 -2
- package/dist/main/ipc/views.js +76 -8
- package/dist/main/runtime/devtools-backend-before-quit.harness.d.ts +43 -0
- package/dist/main/runtime/devtools-backend-before-quit.harness.js +87 -0
- package/dist/main/runtime/devtools-backend.js +60 -4
- package/dist/main/runtime/devtools-runtime-mock.harness.d.ts +21 -0
- package/dist/main/runtime/devtools-runtime-mock.harness.js +313 -0
- package/dist/main/runtime/miniapp-runtime.d.ts +91 -22
- package/dist/main/services/app-services.d.ts +62 -0
- package/dist/main/services/app-services.js +64 -0
- package/dist/main/services/automation/connection-target.d.ts +36 -0
- package/dist/main/services/automation/connection-target.js +29 -0
- package/dist/main/services/automation/console-bridge.d.ts +28 -0
- package/dist/main/services/automation/console-bridge.js +91 -0
- package/dist/main/services/automation/handlers/app.js +4 -4
- package/dist/main/services/automation/handlers/element.js +55 -21
- package/dist/main/services/automation/index.d.ts +12 -1
- package/dist/main/services/automation/index.js +54 -133
- package/dist/main/services/cdp-session/index.d.ts +87 -0
- package/dist/main/services/cdp-session/index.js +173 -0
- package/dist/main/services/compile-standby.js +4 -0
- package/dist/main/services/console-forward/cdp-inject.d.ts +18 -0
- package/dist/main/services/console-forward/cdp-inject.js +30 -0
- package/dist/main/services/console-forward/global-console-mirror.d.ts +33 -0
- package/dist/main/services/console-forward/global-console-mirror.js +71 -0
- package/dist/main/services/console-forward/global-diagnostics-mirror.d.ts +33 -0
- package/dist/main/services/console-forward/global-diagnostics-mirror.js +73 -0
- package/dist/main/services/console-forward/index.d.ts +1 -46
- package/dist/main/services/console-forward/index.js +1 -185
- package/dist/main/services/console-forward/internal-log.d.ts +2 -0
- package/dist/main/services/console-forward/internal-log.js +2 -0
- package/dist/main/services/console-forward/open-gated-relay.d.ts +67 -0
- package/dist/main/services/console-forward/open-gated-relay.js +55 -0
- package/dist/main/services/default-adapter.js +1 -1
- package/dist/main/services/diagnostics/index.d.ts +1 -48
- package/dist/main/services/diagnostics/index.js +1 -60
- package/dist/main/services/dimina-resource-server.d.ts +1 -6
- package/dist/main/services/dimina-resource-server.js +1 -98
- package/dist/main/services/elements-forward/index.d.ts +132 -15
- package/dist/main/services/elements-forward/index.js +155 -304
- package/dist/main/services/fs-bridge-protocol.d.ts +61 -0
- package/dist/main/services/fs-bridge-protocol.js +34 -0
- package/dist/main/services/fs-watch-sse.d.ts +40 -0
- package/dist/main/services/fs-watch-sse.js +113 -0
- package/dist/main/services/http-json.d.ts +9 -0
- package/dist/main/services/http-json.js +6 -0
- package/dist/main/services/layout/index.d.ts +11 -0
- package/dist/main/services/layout/index.js +23 -0
- package/dist/main/services/mcp/connection-owner.d.ts +38 -0
- package/dist/main/services/mcp/connection-owner.js +79 -0
- package/dist/main/services/mcp/index.d.ts +3 -1
- package/dist/main/services/mcp/index.js +4 -3
- package/dist/main/services/mcp/opened-project.d.ts +88 -0
- package/dist/main/services/mcp/opened-project.js +60 -0
- package/dist/main/services/mcp/server.d.ts +2 -1
- package/dist/main/services/mcp/server.js +29 -4
- package/dist/main/services/mcp/target-manager.d.ts +71 -23
- package/dist/main/services/mcp/target-manager.js +269 -138
- package/dist/main/services/mcp/target-selection.d.ts +47 -0
- package/dist/main/services/mcp/target-selection.js +71 -0
- package/dist/main/services/mcp/tools/context-tools.js +20 -5
- package/dist/main/services/mcp/tools/project-tools.d.ts +72 -0
- package/dist/main/services/mcp/tools/project-tools.js +133 -0
- package/dist/main/services/module.d.ts +13 -5
- package/dist/main/services/network-forward/body-cache.d.ts +72 -0
- package/dist/main/services/network-forward/body-cache.js +179 -0
- package/dist/main/services/network-forward/frontend-dispatch.d.ts +91 -0
- package/dist/main/services/network-forward/frontend-dispatch.js +148 -0
- package/dist/main/services/network-forward/global-body-gate.d.ts +46 -0
- package/dist/main/services/network-forward/global-body-gate.js +93 -0
- package/dist/main/services/network-forward/global-mirror-test-fixtures.d.ts +48 -0
- package/dist/main/services/network-forward/global-mirror-test-fixtures.js +96 -0
- package/dist/main/services/network-forward/http.d.ts +47 -0
- package/dist/main/services/network-forward/http.js +162 -0
- package/dist/main/services/network-forward/index.d.ts +135 -15
- package/dist/main/services/network-forward/index.js +854 -224
- package/dist/main/services/network-forward/request-ids.d.ts +5 -0
- package/dist/main/services/network-forward/request-ids.js +5 -0
- package/dist/main/services/network-forward/user-facing.d.ts +21 -0
- package/dist/main/services/network-forward/user-facing.js +50 -0
- package/dist/main/services/network-forward/websocket.d.ts +36 -0
- package/dist/main/services/network-forward/websocket.js +120 -0
- package/dist/main/services/notifications/renderer-notifier.d.ts +71 -9
- package/dist/main/services/notifications/renderer-notifier.js +45 -8
- package/dist/main/services/projects/create-project-service.js +19 -5
- package/dist/main/services/projects/local-provider.js +8 -4
- package/dist/main/services/projects/project-repository.d.ts +59 -7
- package/dist/main/services/projects/project-repository.js +285 -51
- package/dist/main/services/projects/types.d.ts +44 -34
- package/dist/main/services/render-inspect/index.d.ts +12 -2
- package/dist/main/services/render-inspect/index.js +21 -102
- package/dist/main/services/safe-area/index.d.ts +21 -6
- package/dist/main/services/safe-area/index.js +92 -46
- package/dist/main/services/service-host-pool/pool.d.ts +1 -196
- package/dist/main/services/service-host-pool/pool.js +1 -363
- package/dist/main/services/settings/index.d.ts +7 -1
- package/dist/main/services/settings/index.js +22 -2
- package/dist/main/services/simulator/custom-apis.d.ts +1 -42
- package/dist/main/services/simulator/custom-apis.js +1 -46
- package/dist/main/services/simulator/referer.d.ts +1 -9
- package/dist/main/services/simulator/referer.js +1 -19
- package/dist/main/services/simulator/ui-extensions.d.ts +21 -0
- package/dist/main/services/simulator/ui-extensions.js +176 -0
- package/dist/main/services/simulator-appdata/index.d.ts +6 -0
- package/dist/main/services/simulator-appdata/index.js +21 -2
- package/dist/main/services/simulator-current-page/index.d.ts +5 -3
- package/dist/main/services/simulator-current-page/index.js +8 -1
- package/dist/main/services/simulator-storage/index.d.ts +34 -5
- package/dist/main/services/simulator-storage/index.js +73 -71
- package/dist/main/services/simulator-storage/service-storage-ops.d.ts +1 -39
- package/dist/main/services/simulator-storage/service-storage-ops.js +1 -66
- package/dist/main/services/simulator-storage/window-scope.d.ts +20 -0
- package/dist/main/services/simulator-storage/window-scope.js +20 -0
- package/dist/main/services/simulator-temp-files/disk.d.ts +1 -54
- package/dist/main/services/simulator-temp-files/disk.js +1 -237
- package/dist/main/services/simulator-temp-files/fs-channels.d.ts +1 -68
- package/dist/main/services/simulator-temp-files/fs-channels.js +1 -107
- package/dist/main/services/simulator-temp-files/index.d.ts +1 -32
- package/dist/main/services/simulator-temp-files/index.js +1 -181
- package/dist/main/services/simulator-temp-files/request-handler.d.ts +1 -29
- package/dist/main/services/simulator-temp-files/request-handler.js +1 -177
- package/dist/main/services/simulator-temp-files/resolver.d.ts +1 -21
- package/dist/main/services/simulator-temp-files/resolver.js +1 -21
- package/dist/main/services/simulator-temp-files/store.d.ts +1 -13
- package/dist/main/services/simulator-temp-files/store.js +1 -23
- package/dist/main/services/update/github-release-checker.js +22 -3
- package/dist/main/services/update/update-manager.d.ts +21 -4
- package/dist/main/services/update/update-manager.js +55 -11
- package/dist/main/services/views/clear-console-filter.d.ts +44 -0
- package/dist/main/services/views/clear-console-filter.js +86 -0
- package/dist/main/services/views/console-filter-test-fixtures.d.ts +94 -0
- package/dist/main/services/views/console-filter-test-fixtures.js +82 -0
- package/dist/main/services/views/console-filter.d.ts +94 -0
- package/dist/main/services/views/console-filter.js +190 -0
- package/dist/main/services/views/devtools-tabs.d.ts +24 -4
- package/dist/main/services/views/devtools-tabs.js +40 -21
- package/dist/main/services/views/frontend-bootstrap-gate.d.ts +59 -0
- package/dist/main/services/views/frontend-bootstrap-gate.js +117 -0
- package/dist/main/services/views/host-dialog-port-channel.d.ts +18 -0
- package/dist/main/services/views/host-dialog-port-channel.js +15 -0
- package/dist/main/services/views/host-dialog-session-runtime.d.ts +10 -0
- package/dist/main/services/views/host-dialog-session-runtime.js +17 -0
- package/dist/main/services/views/host-dialog-view.d.ts +95 -0
- package/dist/main/services/views/host-dialog-view.js +147 -0
- package/dist/main/services/views/host-sidebar-port-channel.d.ts +18 -0
- package/dist/main/services/views/host-sidebar-port-channel.js +15 -0
- package/dist/main/services/views/host-sidebar-session-runtime.d.ts +10 -0
- package/dist/main/services/views/host-sidebar-session-runtime.js +17 -0
- package/dist/main/services/views/host-sidebar-view.d.ts +59 -0
- package/dist/main/services/views/host-sidebar-view.js +44 -0
- package/dist/main/services/views/host-slot-port-channel.d.ts +124 -0
- package/dist/main/services/views/host-slot-port-channel.js +289 -0
- package/dist/main/services/views/host-slot-session-runtime.d.ts +40 -0
- package/dist/main/services/views/host-slot-session-runtime.js +50 -0
- package/dist/main/services/views/host-slot-view.d.ts +109 -0
- package/dist/main/services/views/host-slot-view.js +147 -0
- package/dist/main/services/views/host-toolbar-port-channel.d.ts +6 -91
- package/dist/main/services/views/host-toolbar-port-channel.js +10 -243
- package/dist/main/services/views/host-toolbar-session-runtime.d.ts +5 -30
- package/dist/main/services/views/host-toolbar-session-runtime.js +9 -47
- package/dist/main/services/views/host-toolbar-view.d.ts +34 -7
- package/dist/main/services/views/host-toolbar-view.js +30 -237
- package/dist/main/services/views/managed-web-contents-view.d.ts +48 -0
- package/dist/main/services/views/managed-web-contents-view.js +143 -0
- package/dist/main/services/views/miniapp-partition.d.ts +1 -89
- package/dist/main/services/views/miniapp-partition.js +1 -158
- package/dist/main/services/views/native-simulator-devtools-host.js +206 -68
- package/dist/main/services/views/native-simulator-view.d.ts +6 -0
- package/dist/main/services/views/native-simulator-view.js +47 -40
- package/dist/main/services/views/native-view-tree.d.ts +25 -0
- package/dist/main/services/views/native-view-tree.js +69 -0
- package/dist/main/services/views/overlay-panels-view.d.ts +63 -4
- package/dist/main/services/views/overlay-panels-view.js +257 -108
- package/dist/main/services/views/placement-reconciler.d.ts +18 -18
- package/dist/main/services/views/placement-reconciler.js +91 -29
- package/dist/main/services/views/placement-test-driver.d.ts +27 -0
- package/dist/main/services/views/placement-test-driver.js +29 -0
- package/dist/main/services/views/refresh-styles.d.ts +10 -0
- package/dist/main/services/views/refresh-styles.js +57 -0
- package/dist/main/services/views/simulator-session-policy.d.ts +1 -27
- package/dist/main/services/views/simulator-session-policy.js +1 -98
- package/dist/main/services/views/view-manager-devtools-host-test-fixtures.d.ts +76 -0
- package/dist/main/services/views/view-manager-devtools-host-test-fixtures.js +184 -0
- package/dist/main/services/views/view-manager.d.ts +69 -88
- package/dist/main/services/views/view-manager.js +62 -7
- package/dist/main/services/views/workbench-view.d.ts +2 -0
- package/dist/main/services/views/workbench-view.js +104 -17
- package/dist/main/services/window-contexts/context-router.d.ts +36 -0
- package/dist/main/services/window-contexts/context-router.js +55 -0
- package/dist/main/services/workbench-coi-host.d.ts +52 -0
- package/dist/main/services/workbench-coi-host.js +227 -0
- package/dist/main/services/workbench-coi-server.d.ts +11 -0
- package/dist/main/services/workbench-coi-server.js +126 -126
- package/dist/main/services/workbench-coi-shutdown.d.ts +40 -0
- package/dist/main/services/workbench-coi-shutdown.js +69 -0
- package/dist/main/services/workbench-coi-static.d.ts +23 -0
- package/dist/main/services/workbench-coi-static.js +87 -0
- package/dist/main/services/workbench-context.d.ts +88 -8
- package/dist/main/services/workbench-context.js +54 -6
- package/dist/main/services/workspace/compile-log-buffer.d.ts +40 -0
- package/dist/main/services/workspace/compile-log-buffer.js +41 -0
- package/dist/main/services/workspace/compile-mode-adapter.d.ts +18 -0
- package/dist/main/services/workspace/compile-mode-adapter.js +57 -0
- package/dist/main/services/workspace/compile-mode-store.d.ts +25 -0
- package/dist/main/services/workspace/compile-mode-store.js +71 -0
- package/dist/main/services/workspace/open-project-guards.d.ts +16 -0
- package/dist/main/services/workspace/open-project-guards.js +42 -0
- package/dist/main/services/workspace/rebuild-status.d.ts +37 -0
- package/dist/main/services/workspace/rebuild-status.js +36 -0
- package/dist/main/services/workspace/session-status-store.d.ts +47 -0
- package/dist/main/services/workspace/session-status-store.js +73 -0
- package/dist/main/services/workspace/status-tap.d.ts +20 -0
- package/dist/main/services/workspace/status-tap.js +32 -0
- package/dist/main/services/workspace/workspace-compile-modes.d.ts +59 -0
- package/dist/main/services/workspace/workspace-compile-modes.js +93 -0
- package/dist/main/services/workspace/workspace-lifecycle-race.testutil.d.ts +22 -0
- package/dist/main/services/workspace/workspace-lifecycle-race.testutil.js +62 -0
- package/dist/main/services/workspace/workspace-referer.d.ts +17 -0
- package/dist/main/services/workspace/workspace-referer.js +26 -0
- package/dist/main/services/workspace/workspace-service.d.ts +7 -5
- package/dist/main/services/workspace/workspace-service.js +96 -135
- package/dist/main/services/workspace/workspace-thumbnails.d.ts +22 -0
- package/dist/main/services/workspace/workspace-thumbnails.js +67 -0
- package/dist/main/utils/ipc-context-source.d.ts +40 -0
- package/dist/main/utils/ipc-context-source.js +23 -0
- package/dist/main/utils/ipc-registry.d.ts +46 -21
- package/dist/main/utils/ipc-registry.js +166 -76
- package/dist/main/utils/paths.d.ts +18 -0
- package/dist/main/utils/paths.js +18 -0
- package/dist/main/utils/sender-policy.d.ts +10 -1
- package/dist/main/utils/sender-policy.js +42 -4
- package/dist/main/utils/theme.d.ts +18 -8
- package/dist/main/utils/theme.js +19 -9
- package/dist/main/windows/internal-devtools-window/index.d.ts +66 -0
- package/dist/main/windows/internal-devtools-window/index.js +160 -0
- package/dist/main/windows/main-window/create.d.ts +16 -0
- package/dist/main/windows/main-window/create.js +19 -11
- package/dist/main/windows/main-window/events.d.ts +1 -1
- package/dist/main/windows/main-window/events.js +26 -13
- package/dist/main/windows/main-window/index.d.ts +1 -1
- package/dist/main/windows/main-window/index.js +1 -1
- package/dist/main/windows/service-host-window/create.d.ts +1 -92
- package/dist/main/windows/service-host-window/create.js +1 -154
- package/dist/native-host/common/common.js +173 -53
- package/dist/native-host/container/pageFrame.css +1 -1
- package/dist/native-host/render/render.js +8278 -3659
- package/dist/native-host/service/service.js +2 -2
- package/dist/preload/index.d.ts +2 -0
- package/dist/preload/index.js +1 -0
- package/dist/preload/instrumentation/app-data.d.ts +2 -2
- package/dist/preload/instrumentation/app-data.js +1 -1
- package/dist/preload/instrumentation/wxml.js +1 -1
- package/dist/preload/runtime/bridge.d.ts +3 -3
- package/dist/preload/runtime/bridge.js +2 -2
- package/dist/preload/runtime/clipboard.d.ts +6 -0
- package/dist/preload/runtime/clipboard.js +12 -0
- package/dist/preload/runtime/host-dialog-advertiser.d.ts +22 -0
- package/dist/preload/runtime/host-dialog-advertiser.js +37 -0
- package/dist/preload/runtime/host-dialog-port.d.ts +44 -0
- package/dist/preload/runtime/host-dialog-port.js +53 -0
- package/dist/preload/runtime/host-dialog-runtime.d.ts +28 -0
- package/dist/preload/runtime/host-dialog-runtime.js +36 -0
- package/dist/preload/runtime/host-sidebar-advertiser.d.ts +19 -0
- package/dist/preload/runtime/host-sidebar-advertiser.js +35 -0
- package/dist/preload/runtime/host-sidebar-port.d.ts +44 -0
- package/dist/preload/runtime/host-sidebar-port.js +53 -0
- package/dist/preload/runtime/host-sidebar-runtime.d.ts +28 -0
- package/dist/preload/runtime/host-sidebar-runtime.js +36 -0
- package/dist/preload/runtime/host-slot-port-bridge.d.ts +18 -0
- package/dist/preload/runtime/host-slot-port-bridge.js +112 -0
- package/dist/preload/runtime/host-toolbar-advertiser.d.ts +5 -13
- package/dist/preload/runtime/host-toolbar-advertiser.js +18 -38
- package/dist/preload/runtime/host-toolbar-port.d.ts +9 -0
- package/dist/preload/runtime/host-toolbar-port.js +11 -95
- package/dist/preload/runtime/native-host.d.ts +14 -0
- package/dist/preload/runtime/native-host.js +5 -8
- package/dist/preload/runtime/node-bindings.d.ts +18 -0
- package/dist/preload/runtime/node-bindings.js +44 -0
- package/dist/preload/runtime/temp-files.js +9 -2
- package/dist/preload/runtime/wait-for-slot-root.d.ts +23 -0
- package/dist/preload/runtime/wait-for-slot-root.js +80 -0
- package/dist/preload/shared/api-compat.js +63 -41
- package/dist/preload/windows/host-dialog-runtime.cjs +360 -0
- package/dist/preload/windows/host-dialog-runtime.cjs.map +7 -0
- package/dist/preload/windows/host-dialog-runtime.d.ts +2 -0
- package/dist/preload/windows/host-dialog-runtime.js +13 -0
- package/dist/preload/windows/host-sidebar-runtime.cjs +361 -0
- package/dist/preload/windows/host-sidebar-runtime.cjs.map +7 -0
- package/dist/preload/windows/host-sidebar-runtime.d.ts +2 -0
- package/dist/preload/windows/host-sidebar-runtime.js +13 -0
- package/dist/preload/windows/host-toolbar-runtime.cjs +142 -52
- package/dist/preload/windows/host-toolbar-runtime.cjs.map +3 -3
- package/dist/preload/windows/main.cjs +4922 -1246
- package/dist/preload/windows/main.cjs.map +4 -4
- package/dist/preload/windows/main.css +428 -0
- package/dist/preload/windows/main.css.map +7 -0
- package/dist/preload/windows/simulator.cjs +376 -322
- package/dist/preload/windows/simulator.cjs.map +4 -4
- package/dist/preload/windows/simulator.js +376 -322
- package/dist/render-host/pageFrame.html +4 -4
- package/dist/render-host/preload.cjs +30 -0
- package/dist/render-host/render-inspect.js +184 -115
- package/dist/renderer/assets/button-CB2MWjHY.js +2 -0
- package/dist/renderer/assets/constants-CkoGPQTS.js +2 -0
- package/dist/renderer/assets/constants-zQZ2-y21.js +2 -0
- package/dist/renderer/assets/createLucideIcon-cZ9FlZZw.js +2 -0
- package/dist/renderer/assets/devicePicker-H2eIO4e1.js +2 -0
- package/dist/renderer/assets/dialog-pHzEA8Vx.js +46 -0
- package/dist/renderer/assets/dist-B5HADirS.js +2 -0
- package/dist/renderer/assets/dist-DIFlRMKe.js +2 -0
- package/dist/renderer/assets/hostSidebarDefault-DRWh6OCt.js +2 -0
- package/dist/renderer/assets/index-CEL_XFge.js +2 -0
- package/dist/renderer/assets/input-CAObw95L.js +2 -0
- package/dist/renderer/assets/ipc-channels-overlays-gIPUFnqc.js +2 -0
- package/dist/renderer/assets/jsx-runtime-DICEQH_0.css +1 -0
- package/dist/renderer/assets/jsx-runtime-DIw5wnYl.js +9 -0
- package/dist/renderer/assets/plus-BQ9u5EbL.js +2 -0
- package/dist/renderer/assets/popover-Cw7G2Ctp.js +2 -0
- package/dist/renderer/assets/presets-DMZOb9ay.js +2 -0
- package/dist/renderer/assets/project-api-YTOr_Yvo.js +2 -0
- package/dist/renderer/assets/projectCreateDialog-BmLqiYxn.js +2 -0
- package/dist/renderer/assets/search-BMvuYF48.js +2 -0
- package/dist/renderer/assets/select-nFP95TxM.js +2 -0
- package/dist/renderer/assets/settings-CnpVfSWt.js +2 -0
- package/dist/renderer/assets/settings-api-Ccsf-Nsj.js +2 -0
- package/dist/renderer/assets/settings-tab-bar-CAzrv32m.js +2 -0
- package/dist/renderer/assets/smartphone-Bb2GdIKy.js +2 -0
- package/dist/renderer/assets/tabs-CPKN3Mmq.js +2 -0
- package/dist/renderer/assets/tooltip-D6AxXRk5.js +2 -0
- package/dist/renderer/assets/types-Bh0hA7El.js +2 -0
- package/dist/renderer/assets/updateDialog-CwndJ0Bl.js +2 -0
- package/dist/renderer/assets/utils-sEB5OZEQ.js +2 -0
- package/dist/renderer/assets/view-api-B-2zPBR5.js +2 -0
- package/dist/renderer/assets/view-ids-BfaDVV5P.js +2 -0
- package/dist/renderer/assets/workbench-C0Jkdlps.js +5 -0
- package/dist/renderer/assets/workbenchSettings-YD0Ctbm_.js +8 -0
- package/dist/renderer/entries/device-picker/index.html +28 -0
- package/dist/renderer/entries/host-sidebar-default/index.html +22 -0
- package/dist/renderer/entries/main/index.html +16 -7
- package/dist/renderer/entries/popover/index.html +16 -6
- package/dist/renderer/entries/project-create-dialog/index.html +27 -0
- package/dist/renderer/entries/settings/index.html +10 -5
- package/dist/renderer/entries/tooltip/index.html +21 -0
- package/dist/renderer/entries/update-dialog/index.html +25 -0
- package/dist/renderer/entries/workbench/index.html +49 -0
- package/dist/renderer/entries/workbench-settings/index.html +12 -5
- package/dist/service-host/appdata-set-data.cjs +39 -0
- package/dist/service-host/host-env-update.cjs +23 -0
- package/dist/service-host/preload.cjs +54 -48
- package/dist/service-host/service-message-queue.cjs +71 -0
- package/dist/service-host/sync-impls/menu-button-geometry.js +16 -5
- package/dist/service-host/sync-impls/menu-button.js +5 -3
- package/dist/service-host/sync-impls/system-info.js +31 -9
- package/dist/shared/bridge-channels.d.ts +1 -416
- package/dist/shared/bridge-channels.js +1 -89
- package/dist/shared/compile-mode-state.d.ts +73 -0
- package/dist/shared/compile-mode-state.js +100 -0
- package/dist/shared/compile-modes.d.ts +152 -0
- package/dist/shared/compile-modes.js +237 -0
- package/dist/shared/constants.d.ts +22 -0
- package/dist/shared/constants.js +22 -0
- package/dist/shared/dmb-resource-url.d.ts +2 -0
- package/dist/shared/dmb-resource-url.js +2 -0
- package/dist/shared/ipc-channels-overlays.d.ts +162 -0
- package/dist/shared/ipc-channels-overlays.js +203 -0
- package/dist/shared/ipc-channels.d.ts +24 -154
- package/dist/shared/ipc-channels.js +48 -96
- package/dist/shared/ipc-schemas.d.ts +143 -54
- package/dist/shared/ipc-schemas.js +137 -45
- package/dist/shared/node-bindings.d.ts +2 -0
- package/dist/shared/node-bindings.js +2 -0
- package/dist/shared/project-window-types.d.ts +42 -0
- package/dist/shared/project-window-types.js +2 -0
- package/dist/shared/simulator-route.d.ts +8 -0
- package/dist/shared/simulator-route.js +15 -0
- package/dist/shared/simulator-ui.d.ts +61 -0
- package/dist/shared/simulator-ui.js +12 -0
- package/dist/shared/types.d.ts +126 -41
- package/dist/shared/view-ids.d.ts +10 -0
- package/dist/shared/view-ids.js +23 -0
- package/dist/simulator/assets/bridge-channels-B3JAmRfl.js +2 -0
- package/dist/simulator/assets/device-shell-ATEhHV2_.css +1 -0
- package/dist/simulator/assets/device-shell-DucLepkm.js +431 -0
- package/dist/simulator/assets/simulator-B4rbcOVt.js +10 -0
- package/dist/simulator/assets/simulator-mini-app-DFo7fhi5.js +2 -0
- package/dist/simulator/assets/simulator-ui-BupATgKo.css +1 -0
- package/dist/simulator/assets/simulator-ui-i3GCc7YJ.js +2 -0
- package/dist/simulator/simulator.html +4 -3
- package/dist/simulator/temp-files.d.ts +35 -0
- package/dist/simulator/temp-files.js +121 -0
- package/dist/simulator/types.d.ts +50 -0
- package/dist/simulator/types.js +2 -0
- package/dist/vscode-workbench/assets/__vite-browser-external-JIkWewFf.js +1 -0
- package/dist/vscode-workbench/assets/{dist-TpGpmMGi.js → dist-CXG-u1VB.js} +3 -3
- package/dist/vscode-workbench/assets/fs-core-worker-urls-DZ1nod84.js +1 -0
- package/dist/vscode-workbench/assets/fs-core.worker-Bnmpp6fo.js +1 -0
- package/dist/vscode-workbench/assets/fs-query.worker-cZ-7Fjch.js +2 -0
- package/dist/vscode-workbench/assets/{iconv-lite-umd-C9tiCAJa.js → iconv-lite-umd-Dxx9Qyb4.js} +1 -1
- package/dist/vscode-workbench/assets/{index-DJ1HyMZ7.js → index-6VJMsaWj.js} +475 -475
- package/dist/vscode-workbench/assets/{jschardet-DE1jV513.js → jschardet-Ba3D16vt.js} +1 -1
- package/dist/vscode-workbench/index.html +21 -1
- package/package.json +23 -13
- package/dist/main/services/views/destroy-child-view.d.ts +0 -9
- package/dist/main/services/views/destroy-child-view.js +0 -23
- package/dist/preload/instrumentation/wxml-extract.d.ts +0 -11
- package/dist/preload/instrumentation/wxml-extract.js +0 -382
- package/dist/preload/shared/sid-registry.d.ts +0 -11
- package/dist/preload/shared/sid-registry.js +0 -38
- package/dist/renderer/assets/constants-EAMiwL9_.js +0 -2
- package/dist/renderer/assets/index-BMqyDx71.js +0 -49
- package/dist/renderer/assets/input-CDAEwpBO.js +0 -2
- package/dist/renderer/assets/ipc-transport-B7eFOR68.css +0 -1
- package/dist/renderer/assets/ipc-transport-_G1k5V1p.js +0 -9
- package/dist/renderer/assets/popover-DEdjK14m.js +0 -2
- package/dist/renderer/assets/select-DpKPCh3y.js +0 -2
- package/dist/renderer/assets/settings-M5q2elUr.js +0 -2
- package/dist/renderer/assets/settings-api-CDlZoHiO.js +0 -2
- package/dist/renderer/assets/workbenchSettings-CT_H1WhV.js +0 -8
- package/dist/shared/appdata-accumulator.d.ts +0 -95
- package/dist/shared/appdata-accumulator.js +0 -218
- package/dist/shared/request-core.d.ts +0 -84
- package/dist/shared/request-core.js +0 -168
- package/dist/shared/simulator-api-metadata.d.ts +0 -26
- package/dist/shared/simulator-api-metadata.js +0 -59
- package/dist/shared/vpath.d.ts +0 -42
- package/dist/shared/vpath.js +0 -105
- package/dist/simulator/assets/bridge-channels-zhsumfky.js +0 -2
- package/dist/simulator/assets/device-shell-C-wcFq3Z.js +0 -2
- package/dist/simulator/assets/device-shell-CS1rqAQz.css +0 -1
- package/dist/simulator/assets/jsx-runtime-BDTY6fEq.js +0 -2
- package/dist/simulator/assets/simulator-DU3-fS3v.js +0 -10
- package/dist/simulator/assets/simulator-mini-app-DzfMfnVM.js +0 -2
- package/dist/simulator/device-shell/menu-button-geometry.js +0 -8
- package/dist/vscode-workbench/assets/__vite-browser-external-CXi6Kz9W.js +0 -1
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { nativeTheme, WebContentsView } from 'electron';
|
|
2
2
|
import { handleWindowOpenExternal } from '../../windows/navigation-hardening.js';
|
|
3
|
+
import { themeBg } from '../../utils/theme.js';
|
|
3
4
|
import { VIEW_ID } from '../../../shared/view-ids.js';
|
|
4
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Upper bound on how long a hold may defer the workbench attach. A hung or
|
|
7
|
+
* very slow first compile (or a lost release on some open path) degrades to a
|
|
8
|
+
* bounded editor delay plus a warn — never a permanently blank editor slot.
|
|
9
|
+
*/
|
|
10
|
+
const ATTACH_HOLD_CAP_MS = 3000;
|
|
5
11
|
export function createWorkbenchView(ctx, reconciler) {
|
|
6
12
|
let workbenchView = null;
|
|
7
13
|
// Whether the devtools-theme → workbench-theme `nativeTheme` listener is live.
|
|
@@ -11,8 +17,20 @@ export function createWorkbenchView(ctx, reconciler) {
|
|
|
11
17
|
// heavy WebContentsView load is deferred until the 'editor' slot first becomes
|
|
12
18
|
// visible (first non-zero `setWorkbenchBounds`) so it never sits on the app
|
|
13
19
|
// boot critical path (which would delay preload/window-ready and trip the e2e
|
|
14
|
-
// health check into a relaunch)
|
|
20
|
+
// health check into a relaunch), and further deferred while an attach hold
|
|
21
|
+
// (below) is in force.
|
|
15
22
|
let workbenchUrl = null;
|
|
23
|
+
// Attach gate: while held (and the view does not exist yet), the lazy attach
|
|
24
|
+
// is deferred so the workbench's heavy load never competes with a project
|
|
25
|
+
// open's boot-critical window (old-session teardown + first compile) for
|
|
26
|
+
// CPU. Generation-tagged: a newer hold supersedes an older one (latest-wins,
|
|
27
|
+
// mirroring the open op-lock), so a superseded open's late release cannot
|
|
28
|
+
// open a newer open's gate. The gate only postpones creation — it never
|
|
29
|
+
// hides or destroys an existing view, and detachWorkbench leaves it intact
|
|
30
|
+
// (an in-flight open holds across the old view's teardown).
|
|
31
|
+
let attachHeld = false;
|
|
32
|
+
let attachHoldGeneration = 0;
|
|
33
|
+
let attachHoldTimer = null;
|
|
16
34
|
/** Current devtools color scheme, mirrored into the workbench's theme. */
|
|
17
35
|
function workbenchThemeScheme() {
|
|
18
36
|
return nativeTheme.shouldUseDarkColors ? 'dark' : 'light';
|
|
@@ -27,6 +45,14 @@ export function createWorkbenchView(ctx, reconciler) {
|
|
|
27
45
|
if (!workbenchView || workbenchView.webContents.isDestroyed())
|
|
28
46
|
return;
|
|
29
47
|
const wc = workbenchView.webContents;
|
|
48
|
+
// Keep the WCV surface in sync with the active color scheme: the workbench
|
|
49
|
+
// page can only recolor its own inner #workbench, never the html/body
|
|
50
|
+
// backdrop, so the native surface must follow the theme flip too.
|
|
51
|
+
try {
|
|
52
|
+
if (typeof workbenchView.setBackgroundColor === 'function')
|
|
53
|
+
workbenchView.setBackgroundColor(themeBg());
|
|
54
|
+
}
|
|
55
|
+
catch { /* view/wc gone mid-flip */ }
|
|
30
56
|
if (typeof wc.executeJavaScript !== 'function')
|
|
31
57
|
return;
|
|
32
58
|
const script = `window.__WB_SET_THEME && window.__WB_SET_THEME(${JSON.stringify(workbenchThemeScheme())})`;
|
|
@@ -43,6 +69,17 @@ export function createWorkbenchView(ctx, reconciler) {
|
|
|
43
69
|
},
|
|
44
70
|
});
|
|
45
71
|
workbenchView = view;
|
|
72
|
+
// Paint the WCV surface the themed window background (themeBg(): dark
|
|
73
|
+
// #1a1a1a / light #fafafa) so the boot screen ("booting workbench…") and
|
|
74
|
+
// any layout gap never flash a mismatched white strip before the workbench
|
|
75
|
+
// CSS loads. The workbench is a plain WebContentsView (not a BrowserWindow),
|
|
76
|
+
// so the process-wide installThemeBackgroundSync() never reaches it — match
|
|
77
|
+
// the main window's own backgroundColor here, and re-sync on every theme
|
|
78
|
+
// flip below.
|
|
79
|
+
try {
|
|
80
|
+
view.setBackgroundColor(themeBg());
|
|
81
|
+
}
|
|
82
|
+
catch { /* view not ready for a bg yet */ }
|
|
46
83
|
// Track devtools theme flips for the lifetime of the workbench view only —
|
|
47
84
|
// registered here (not at construction) so test electron mocks that omit
|
|
48
85
|
// `nativeTheme` and never open the editor stay unaffected. Removed in
|
|
@@ -58,9 +95,13 @@ export function createWorkbenchView(ctx, reconciler) {
|
|
|
58
95
|
view.webContents.setWindowOpenHandler(({ url: target }) => handleWindowOpenExternal(target));
|
|
59
96
|
}
|
|
60
97
|
catch { /* stub may lack it */ }
|
|
61
|
-
ctx.windows.mainWindow.contentView.addChildView(view);
|
|
62
98
|
// Hand the workbench the current devtools scheme as a URL query so its very
|
|
63
99
|
// first paint already matches (the runtime setter only exists post-init).
|
|
100
|
+
// The project identity deliberately does NOT ride this URL: the attach can
|
|
101
|
+
// happen before the open commits a session (the gate self-releases after
|
|
102
|
+
// ATTACH_HOLD_CAP_MS on a slow compile, and the release fires just ahead of
|
|
103
|
+
// the commit), so the page polls it from the COI server's `/__project`
|
|
104
|
+
// instead — see workbench-coi-server.ts.
|
|
64
105
|
const loadUrl = `${url}index.html?theme=${workbenchThemeScheme()}`;
|
|
65
106
|
await view.webContents.loadURL(loadUrl).catch((err) => {
|
|
66
107
|
console.error('[workbench] attachWorkbench — loadURL failed', err);
|
|
@@ -70,14 +111,63 @@ export function createWorkbenchView(ctx, reconciler) {
|
|
|
70
111
|
function setWorkbenchSource(url) {
|
|
71
112
|
workbenchUrl = url;
|
|
72
113
|
}
|
|
114
|
+
// Release the gate for `generation` (stale generations no-op) and replay the
|
|
115
|
+
// reconcile so a pending visible desired attaches through the normal lazy
|
|
116
|
+
// path. `viaCap` marks the self-release at the hold cap — loud, so a slow
|
|
117
|
+
// compile and a lost release stay distinguishable from a normal settle.
|
|
118
|
+
function releaseAttachHold(generation, viaCap) {
|
|
119
|
+
if (!attachHeld || generation !== attachHoldGeneration)
|
|
120
|
+
return;
|
|
121
|
+
attachHeld = false;
|
|
122
|
+
if (attachHoldTimer) {
|
|
123
|
+
clearTimeout(attachHoldTimer);
|
|
124
|
+
attachHoldTimer = null;
|
|
125
|
+
}
|
|
126
|
+
if (viaCap) {
|
|
127
|
+
console.warn(`[workbench] attach gate: hold not released within ${ATTACH_HOLD_CAP_MS}ms (compile still running or a release was lost) — attaching now`);
|
|
128
|
+
}
|
|
129
|
+
reconciler.reconcileNow();
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Close the attach gate until the returned release fn runs, a newer hold
|
|
133
|
+
* supersedes it, explicit user intent (openFileInWorkbench) opens it, or the
|
|
134
|
+
* cap timer fires. The release fn is idempotent and generation-bound.
|
|
135
|
+
*/
|
|
136
|
+
function holdWorkbenchAttach() {
|
|
137
|
+
const generation = ++attachHoldGeneration;
|
|
138
|
+
attachHeld = true;
|
|
139
|
+
if (attachHoldTimer)
|
|
140
|
+
clearTimeout(attachHoldTimer);
|
|
141
|
+
attachHoldTimer = setTimeout(() => releaseAttachHold(generation, true), ATTACH_HOLD_CAP_MS);
|
|
142
|
+
return () => releaseAttachHold(generation, false);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Void the current hold WITHOUT the release replay: the gate belongs to an
|
|
146
|
+
* open request, and a teardown that preempts it (closeProject / app-level
|
|
147
|
+
* disposeAll) invalidates that request — its late release or cap firing must
|
|
148
|
+
* not rebuild the view after the project is gone. Bumping the generation
|
|
149
|
+
* turns every pending release fn into a no-op; no-op when nothing is held.
|
|
150
|
+
*/
|
|
151
|
+
function cancelWorkbenchAttachHold() {
|
|
152
|
+
if (!attachHeld && !attachHoldTimer)
|
|
153
|
+
return;
|
|
154
|
+
attachHeld = false;
|
|
155
|
+
attachHoldGeneration++;
|
|
156
|
+
if (attachHoldTimer) {
|
|
157
|
+
clearTimeout(attachHoldTimer);
|
|
158
|
+
attachHoldTimer = null;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
73
161
|
function detachWorkbench() {
|
|
74
162
|
if (workbenchThemeSyncBound) {
|
|
75
163
|
nativeTheme.removeListener('updated', pushWorkbenchTheme);
|
|
76
164
|
workbenchThemeSyncBound = false;
|
|
77
165
|
}
|
|
78
|
-
|
|
166
|
+
reconciler.destroyView(VIEW_ID.workbench, workbenchView);
|
|
79
167
|
workbenchView = null;
|
|
80
|
-
|
|
168
|
+
if (!attachHeld) {
|
|
169
|
+
reconciler.deleteBaseDesired(VIEW_ID.workbench);
|
|
170
|
+
}
|
|
81
171
|
reconciler.reconcileNow();
|
|
82
172
|
}
|
|
83
173
|
// Build the `file:///workspace/<rel>` URI string with each path SEGMENT
|
|
@@ -123,6 +213,11 @@ export function createWorkbenchView(ctx, reconciler) {
|
|
|
123
213
|
// the document is actually shown; false when there is no workbench view or
|
|
124
214
|
// every attempt failed.
|
|
125
215
|
function openFileInWorkbench(relPath, line, column) {
|
|
216
|
+
// Explicit user intent (a source-link click) beats the boot-priority
|
|
217
|
+
// scheduling: open the gate first so the release's reconcile replay can
|
|
218
|
+
// lazy-create the view synchronously before the liveness check below.
|
|
219
|
+
if (attachHeld)
|
|
220
|
+
releaseAttachHold(attachHoldGeneration, false);
|
|
126
221
|
if (!workbenchView || workbenchView.webContents.isDestroyed())
|
|
127
222
|
return false;
|
|
128
223
|
// The workbench mirrors the active project under file:///workspace/<rel>; the
|
|
@@ -148,23 +243,15 @@ export function createWorkbenchView(ctx, reconciler) {
|
|
|
148
243
|
return true;
|
|
149
244
|
}
|
|
150
245
|
// workbench is gated until it has a source or a live view (it lazy-creates
|
|
151
|
-
// from the URL in the attach op).
|
|
246
|
+
// from the URL in the attach op), and while an attach hold is in force.
|
|
152
247
|
reconciler.registerView(VIEW_ID.workbench, {
|
|
153
248
|
getView: () => workbenchView,
|
|
154
|
-
gateHidden: () => !workbenchView && !workbenchUrl,
|
|
155
|
-
beforeAttach: () => {
|
|
156
|
-
if (!workbenchView && workbenchUrl) {
|
|
157
|
-
// Lazy-load the workbench; attachWorkbench adds it to the contentView.
|
|
158
|
-
void attachWorkbench(workbenchUrl);
|
|
159
|
-
return true;
|
|
160
|
-
}
|
|
161
|
-
return false;
|
|
162
|
-
},
|
|
249
|
+
gateHidden: () => !workbenchView && (!workbenchUrl || attachHeld),
|
|
163
250
|
ensureLazy: (desired) => {
|
|
164
|
-
if (desired?.placement.visible && !workbenchView && workbenchUrl)
|
|
251
|
+
if (desired?.placement.visible && !workbenchView && workbenchUrl && !attachHeld)
|
|
165
252
|
void attachWorkbench(workbenchUrl);
|
|
166
253
|
},
|
|
167
254
|
});
|
|
168
|
-
return { attachWorkbench, setWorkbenchSource, detachWorkbench, openFileInWorkbench };
|
|
255
|
+
return { attachWorkbench, setWorkbenchSource, detachWorkbench, openFileInWorkbench, holdWorkbenchAttach, cancelWorkbenchAttachHold };
|
|
169
256
|
}
|
|
170
257
|
//# sourceMappingURL=workbench-view.js.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { WebContents } from 'electron';
|
|
2
|
+
import { type Disposable } from '@dimina-kit/electron-deck/main';
|
|
3
|
+
import type { IpcContextSource } from '../../utils/ipc-context-source.js';
|
|
4
|
+
import type { SenderPolicy } from '../../utils/ipc-registry.js';
|
|
5
|
+
/**
|
|
6
|
+
* What the router needs of a window context to place an incoming sender.
|
|
7
|
+
* Kept to these two predicates so the router stays independent of the rest of
|
|
8
|
+
* the context; the concrete context type is supplied by the caller.
|
|
9
|
+
*/
|
|
10
|
+
export interface RoutableWindowContext {
|
|
11
|
+
/** Every sender this window accepts, app-shared trusted windows included. */
|
|
12
|
+
senderPolicy: SenderPolicy;
|
|
13
|
+
/** Only the senders this window structurally owns (see sender-policy.ts). */
|
|
14
|
+
ownsSender: SenderPolicy;
|
|
15
|
+
}
|
|
16
|
+
/** Registry of live window contexts, and the authority on which one owns a sender. */
|
|
17
|
+
export interface WindowContextRouter<T extends RoutableWindowContext = RoutableWindowContext> extends IpcContextSource<T> {
|
|
18
|
+
/** Register a window context; the returned Disposable unregisters it. */
|
|
19
|
+
register(ctx: T): Disposable;
|
|
20
|
+
/**
|
|
21
|
+
* The context owning `sender`, or null when no registered context claims it.
|
|
22
|
+
* A pure query: looking a sender up never changes which context is active.
|
|
23
|
+
*/
|
|
24
|
+
resolve(sender: WebContents): T | null;
|
|
25
|
+
/**
|
|
26
|
+
* The context last marked active by `setActive`. With none marked — or after
|
|
27
|
+
* the marked one unregisters — it falls back to the first still-registered
|
|
28
|
+
* context, and null when none are.
|
|
29
|
+
*/
|
|
30
|
+
active(): T | null;
|
|
31
|
+
/** Mark `ctx` active (on window focus). Ignored for unregistered contexts. */
|
|
32
|
+
setActive(ctx: T): void;
|
|
33
|
+
list(): T[];
|
|
34
|
+
}
|
|
35
|
+
export declare function createWindowContextRouter<T extends RoutableWindowContext = RoutableWindowContext>(): WindowContextRouter<T>;
|
|
36
|
+
//# sourceMappingURL=context-router.d.ts.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { toDisposable } from '@dimina-kit/electron-deck/main';
|
|
2
|
+
export function createWindowContextRouter() {
|
|
3
|
+
const contexts = [];
|
|
4
|
+
let activeCtx = null;
|
|
5
|
+
const first = () => contexts[0] ?? null;
|
|
6
|
+
return {
|
|
7
|
+
register(ctx) {
|
|
8
|
+
contexts.push(ctx);
|
|
9
|
+
activeCtx ??= ctx;
|
|
10
|
+
return toDisposable(() => {
|
|
11
|
+
const at = contexts.indexOf(ctx);
|
|
12
|
+
if (at === -1)
|
|
13
|
+
return;
|
|
14
|
+
contexts.splice(at, 1);
|
|
15
|
+
if (activeCtx === ctx)
|
|
16
|
+
activeCtx = first();
|
|
17
|
+
});
|
|
18
|
+
},
|
|
19
|
+
resolve(sender) {
|
|
20
|
+
// Two passes, because the two predicates answer different questions.
|
|
21
|
+
// `senderPolicy` also accepts host windows registered through
|
|
22
|
+
// `registerTrustedWindow`, whose id map is app-wide — every context says
|
|
23
|
+
// yes to such a sender, so a single-pass scan would hand it to whichever
|
|
24
|
+
// window happened to register first. Pass one therefore only accepts a
|
|
25
|
+
// context that OWNS the sender (its own renderer, settings window or
|
|
26
|
+
// overlay views), which is unique by construction. Pass two covers the
|
|
27
|
+
// accepted-but-unowned senders that are left: they belong to the app
|
|
28
|
+
// rather than to a window, so the active window answers them.
|
|
29
|
+
//
|
|
30
|
+
// Neither pass moves "active": window focus is what decides which window
|
|
31
|
+
// an app-wide sender belongs to, and a background window handling its own
|
|
32
|
+
// IPC must not steal that answer from the focused one.
|
|
33
|
+
for (const ctx of contexts) {
|
|
34
|
+
if (ctx.ownsSender(sender))
|
|
35
|
+
return ctx;
|
|
36
|
+
}
|
|
37
|
+
for (const ctx of contexts) {
|
|
38
|
+
if (ctx.senderPolicy(sender))
|
|
39
|
+
return activeCtx ?? first();
|
|
40
|
+
}
|
|
41
|
+
return null;
|
|
42
|
+
},
|
|
43
|
+
active() {
|
|
44
|
+
return activeCtx ?? first();
|
|
45
|
+
},
|
|
46
|
+
setActive(ctx) {
|
|
47
|
+
if (contexts.includes(ctx))
|
|
48
|
+
activeCtx = ctx;
|
|
49
|
+
},
|
|
50
|
+
list() {
|
|
51
|
+
return contexts.slice();
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=context-router.js.map
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The single http listener behind every project window's workbench bridge.
|
|
3
|
+
*
|
|
4
|
+
* Browser storage is keyed by ORIGIN: IndexedDB, OPFS, Cache Storage, service
|
|
5
|
+
* worker registrations, Web Locks and BroadcastChannel all live in a bucket
|
|
6
|
+
* named after scheme + host + PORT. A listener bound to port 0 gets a different
|
|
7
|
+
* port every time, so one http server per project window put every window on
|
|
8
|
+
* its own origin — the VS Code workspace- and global-scope mementos a window
|
|
9
|
+
* wrote (open editors, view state, explorer expansion) died with it, reopening
|
|
10
|
+
* the same project minted a fresh empty bucket, and each new port accumulated
|
|
11
|
+
* another service-worker registration and cache entry that nothing reclaimed.
|
|
12
|
+
*
|
|
13
|
+
* So the listener is shared by every window in the process and a window's
|
|
14
|
+
* bridge is addressed by an opaque path prefix (`/w/<token>/`) rather than by
|
|
15
|
+
* port: one origin for all workbenches, distinct `/__fs` + `/__project`
|
|
16
|
+
* routing per window. The prefix is routing, not a security boundary — pages
|
|
17
|
+
* on one origin can already reach each other's paths, which is the situation
|
|
18
|
+
* the app-wide server had before per-project windows existed.
|
|
19
|
+
*
|
|
20
|
+
* The listener also outlives the last window that used it, because closing
|
|
21
|
+
* every project and opening another one is an ordinary switch and must not
|
|
22
|
+
* move the origin. Only {@link closeAllCoiHosts} takes a listener down.
|
|
23
|
+
*/
|
|
24
|
+
import http from 'node:http';
|
|
25
|
+
export interface CoiHostSession {
|
|
26
|
+
/**
|
|
27
|
+
* Answers one request for this window. `url` has already had the window's
|
|
28
|
+
* `/w/<token>` prefix stripped, so the handler sees the same pathnames it
|
|
29
|
+
* would on a server of its own.
|
|
30
|
+
*/
|
|
31
|
+
handle: (req: http.IncomingMessage, res: http.ServerResponse, url: URL) => void;
|
|
32
|
+
}
|
|
33
|
+
export interface CoiHostRegistration {
|
|
34
|
+
/** Scheme + host + port of the shared listener, with no trailing slash. */
|
|
35
|
+
origin: string;
|
|
36
|
+
port: number;
|
|
37
|
+
/** The path segment that routes to this session. */
|
|
38
|
+
token: string;
|
|
39
|
+
/** Drops the route, closing the shared listener when the last one goes. */
|
|
40
|
+
release: () => Promise<void>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Tear down every listener. For process shutdown and for test isolation — a
|
|
44
|
+
* window's own teardown never gets here, because the origin has to survive it.
|
|
45
|
+
*/
|
|
46
|
+
export declare function closeAllCoiHosts(): Promise<void>;
|
|
47
|
+
export declare function registerCoiHostSession(opts: {
|
|
48
|
+
rootDir: string;
|
|
49
|
+
extensionsDir: string | null;
|
|
50
|
+
session: CoiHostSession;
|
|
51
|
+
}): Promise<CoiHostRegistration>;
|
|
52
|
+
//# sourceMappingURL=workbench-coi-host.d.ts.map
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The single http listener behind every project window's workbench bridge.
|
|
3
|
+
*
|
|
4
|
+
* Browser storage is keyed by ORIGIN: IndexedDB, OPFS, Cache Storage, service
|
|
5
|
+
* worker registrations, Web Locks and BroadcastChannel all live in a bucket
|
|
6
|
+
* named after scheme + host + PORT. A listener bound to port 0 gets a different
|
|
7
|
+
* port every time, so one http server per project window put every window on
|
|
8
|
+
* its own origin — the VS Code workspace- and global-scope mementos a window
|
|
9
|
+
* wrote (open editors, view state, explorer expansion) died with it, reopening
|
|
10
|
+
* the same project minted a fresh empty bucket, and each new port accumulated
|
|
11
|
+
* another service-worker registration and cache entry that nothing reclaimed.
|
|
12
|
+
*
|
|
13
|
+
* So the listener is shared by every window in the process and a window's
|
|
14
|
+
* bridge is addressed by an opaque path prefix (`/w/<token>/`) rather than by
|
|
15
|
+
* port: one origin for all workbenches, distinct `/__fs` + `/__project`
|
|
16
|
+
* routing per window. The prefix is routing, not a security boundary — pages
|
|
17
|
+
* on one origin can already reach each other's paths, which is the situation
|
|
18
|
+
* the app-wide server had before per-project windows existed.
|
|
19
|
+
*
|
|
20
|
+
* The listener also outlives the last window that used it, because closing
|
|
21
|
+
* every project and opening another one is an ordinary switch and must not
|
|
22
|
+
* move the origin. Only {@link closeAllCoiHosts} takes a listener down.
|
|
23
|
+
*/
|
|
24
|
+
import http from 'node:http';
|
|
25
|
+
import path from 'node:path';
|
|
26
|
+
import { randomUUID } from 'node:crypto';
|
|
27
|
+
import { serveStaticFile, setIsolationHeaders } from './workbench-coi-static.js';
|
|
28
|
+
import { createCoiServerShutdown } from './workbench-coi-shutdown.js';
|
|
29
|
+
/**
|
|
30
|
+
* Tear down every listener. For process shutdown and for test isolation — a
|
|
31
|
+
* window's own teardown never gets here, because the origin has to survive it.
|
|
32
|
+
*/
|
|
33
|
+
export async function closeAllCoiHosts() {
|
|
34
|
+
if (closingAll)
|
|
35
|
+
return closingAll;
|
|
36
|
+
const pending = [...hosts.values()];
|
|
37
|
+
hosts.clear();
|
|
38
|
+
const run = (async () => {
|
|
39
|
+
await Promise.all(pending.map(async (p) => {
|
|
40
|
+
const host = await p.catch(() => null);
|
|
41
|
+
if (!host || host.closed)
|
|
42
|
+
return;
|
|
43
|
+
host.closed = true;
|
|
44
|
+
await host.shutdown.close(host.server);
|
|
45
|
+
}));
|
|
46
|
+
})();
|
|
47
|
+
closingAll = run;
|
|
48
|
+
try {
|
|
49
|
+
await run;
|
|
50
|
+
}
|
|
51
|
+
finally {
|
|
52
|
+
if (closingAll === run)
|
|
53
|
+
closingAll = null;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* One host per bundle + extensions pair. Two hosts serving different bundles
|
|
58
|
+
* are genuinely different servers; every window of one app shares one entry.
|
|
59
|
+
*/
|
|
60
|
+
const hosts = new Map();
|
|
61
|
+
/**
|
|
62
|
+
* In-flight {@link closeAllCoiHosts}. A registration that was already waiting
|
|
63
|
+
* on `createHost` when a global close began must not hand its window an origin
|
|
64
|
+
* that close is about to take away, so it waits here and starts a fresh host.
|
|
65
|
+
*/
|
|
66
|
+
let closingAll = null;
|
|
67
|
+
const WINDOW_PREFIX = /^\/w\/([A-Za-z0-9-]+)(\/.*)?$/;
|
|
68
|
+
function notFound(res) {
|
|
69
|
+
res.writeHead(404);
|
|
70
|
+
res.end('Not Found');
|
|
71
|
+
}
|
|
72
|
+
function badRequest(res) {
|
|
73
|
+
res.writeHead(400);
|
|
74
|
+
res.end('Bad Request');
|
|
75
|
+
}
|
|
76
|
+
function serverError(res) {
|
|
77
|
+
res.writeHead(500);
|
|
78
|
+
res.end('Internal Server Error');
|
|
79
|
+
}
|
|
80
|
+
async function createHost(rootDir) {
|
|
81
|
+
const sessions = new Map();
|
|
82
|
+
const shutdown = createCoiServerShutdown();
|
|
83
|
+
const server = http.createServer((req, res) => {
|
|
84
|
+
setIsolationHeaders(res);
|
|
85
|
+
let url;
|
|
86
|
+
try {
|
|
87
|
+
url = new URL(req.url ?? '/', 'http://127.0.0.1');
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
// A malformed request line must not become an uncaught exception in the
|
|
91
|
+
// main process.
|
|
92
|
+
badRequest(res);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const routed = WINDOW_PREFIX.exec(url.pathname);
|
|
96
|
+
if (routed) {
|
|
97
|
+
const session = sessions.get(routed[1]);
|
|
98
|
+
// A request for a window that has already been torn down. 404 rather
|
|
99
|
+
// than fall through to the bundle: the caller asked for one specific
|
|
100
|
+
// window's bridge, and answering with another window's data would be
|
|
101
|
+
// worse than not answering.
|
|
102
|
+
if (!session) {
|
|
103
|
+
notFound(res);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
// Strip the prefix by rewriting `pathname` on a copy. Re-parsing the
|
|
107
|
+
// remainder as a URL reference would read a leading `//` as an authority,
|
|
108
|
+
// so `/w/<token>//__project` would arrive as `/` on host `__project`.
|
|
109
|
+
const forwarded = new URL(url);
|
|
110
|
+
forwarded.pathname = routed[2] || '/';
|
|
111
|
+
try {
|
|
112
|
+
session.handle(req, res, forwarded);
|
|
113
|
+
}
|
|
114
|
+
catch (err) {
|
|
115
|
+
// One window's handler must not take the shared listener's process
|
|
116
|
+
// with it — an uncaught exception here would end every other project
|
|
117
|
+
// window too. A handler answers its own client errors (a malformed
|
|
118
|
+
// percent escape, say), so anything reaching this point is a defect in
|
|
119
|
+
// it: 500 rather than 400, and logged, because a silent 400 would read
|
|
120
|
+
// as the caller's fault and hide the bug for good.
|
|
121
|
+
console.error('[workbench-coi] session handler threw', err);
|
|
122
|
+
if (res.headersSent)
|
|
123
|
+
res.destroy();
|
|
124
|
+
else
|
|
125
|
+
serverError(res);
|
|
126
|
+
}
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
// No window prefix. Every bridge endpoint has to know WHICH window asked,
|
|
130
|
+
// so answering one here would mean guessing a project — the ambiguity the
|
|
131
|
+
// prefix exists to remove. The bundle itself is project-independent and is
|
|
132
|
+
// still served, so an absolute asset URL inside it keeps working.
|
|
133
|
+
if (url.pathname.startsWith('/__')) {
|
|
134
|
+
notFound(res);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
let decoded;
|
|
138
|
+
try {
|
|
139
|
+
decoded = decodeURIComponent(url.pathname);
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
// A stray `%` in the path. Answering 400 keeps the listener alive; the
|
|
143
|
+
// throw would otherwise escape the request handler.
|
|
144
|
+
badRequest(res);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
shutdown.trackRequest(res);
|
|
148
|
+
serveStaticFile(res, rootDir, decoded);
|
|
149
|
+
});
|
|
150
|
+
await new Promise((resolve, reject) => {
|
|
151
|
+
server.once('error', reject);
|
|
152
|
+
server.listen(0, '127.0.0.1', () => {
|
|
153
|
+
server.off('error', reject);
|
|
154
|
+
resolve();
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
const addr = server.address();
|
|
158
|
+
const port = typeof addr === 'object' && addr ? addr.port : 0;
|
|
159
|
+
return {
|
|
160
|
+
server,
|
|
161
|
+
origin: `http://127.0.0.1:${port}`,
|
|
162
|
+
port,
|
|
163
|
+
rootDir,
|
|
164
|
+
sessions,
|
|
165
|
+
shutdown,
|
|
166
|
+
closed: false,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
export async function registerCoiHostSession(opts) {
|
|
170
|
+
const rootDir = path.resolve(opts.rootDir);
|
|
171
|
+
// JSON, not a separator character: `('/a', '/b|/c')` and `('/a|/b', '/c')`
|
|
172
|
+
// are both legal path pairs and would otherwise collide onto one host, so two
|
|
173
|
+
// different bundles would serve each other's files.
|
|
174
|
+
const key = JSON.stringify([rootDir, opts.extensionsDir ?? null]);
|
|
175
|
+
// Loop rather than a single lookup: a release running concurrently can have
|
|
176
|
+
// marked the cached host closed without having removed it yet, and joining a
|
|
177
|
+
// closing server would hand back a dead origin.
|
|
178
|
+
for (;;) {
|
|
179
|
+
if (closingAll) {
|
|
180
|
+
await closingAll;
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
let pending = hosts.get(key);
|
|
184
|
+
if (!pending) {
|
|
185
|
+
pending = createHost(rootDir);
|
|
186
|
+
hosts.set(key, pending);
|
|
187
|
+
}
|
|
188
|
+
let host;
|
|
189
|
+
try {
|
|
190
|
+
host = await pending;
|
|
191
|
+
}
|
|
192
|
+
catch (err) {
|
|
193
|
+
if (hosts.get(key) === pending)
|
|
194
|
+
hosts.delete(key);
|
|
195
|
+
throw err;
|
|
196
|
+
}
|
|
197
|
+
// `closingAll` is re-checked because it can have started while this
|
|
198
|
+
// registration was awaiting `pending`: the host may still read as open and
|
|
199
|
+
// yet be one `await` away from losing its port.
|
|
200
|
+
if (host.closed || closingAll || hosts.get(key) !== pending) {
|
|
201
|
+
if (hosts.get(key) === pending)
|
|
202
|
+
hosts.delete(key);
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
const token = randomUUID();
|
|
206
|
+
host.sessions.set(token, opts.session);
|
|
207
|
+
let released = false;
|
|
208
|
+
return {
|
|
209
|
+
origin: host.origin,
|
|
210
|
+
port: host.port,
|
|
211
|
+
token,
|
|
212
|
+
release: async () => {
|
|
213
|
+
if (released)
|
|
214
|
+
return;
|
|
215
|
+
released = true;
|
|
216
|
+
host.sessions.delete(token);
|
|
217
|
+
// The listener deliberately stays up with no windows on it. Closing it
|
|
218
|
+
// would release the port, and the next window would bind a different
|
|
219
|
+
// one — a different origin, so the storage the closed window wrote
|
|
220
|
+
// would be unreachable. Closing the last project and opening another
|
|
221
|
+
// is the ordinary way to switch projects, so the origin has to hold
|
|
222
|
+
// for the life of the process, not just while a window is open.
|
|
223
|
+
},
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
//# sourceMappingURL=workbench-coi-host.js.map
|
|
@@ -21,6 +21,17 @@ export interface WorkbenchCoiServerOptions {
|
|
|
21
21
|
* for none (built-in `wx*` associations only).
|
|
22
22
|
*/
|
|
23
23
|
getFileTypes?: () => unknown;
|
|
24
|
+
/**
|
|
25
|
+
* Reads the active project's identity — `appId` (null until the open commits
|
|
26
|
+
* a session) plus its root path — served at `/__project` as the workspace id
|
|
27
|
+
* the editor names its VS Code workspace after. Read per-request, because the
|
|
28
|
+
* editor page can load BEFORE the project commits (see `/__project` below).
|
|
29
|
+
* Omit when the host has no project identity to offer.
|
|
30
|
+
*/
|
|
31
|
+
getProjectIdentity?: () => {
|
|
32
|
+
appId: string | null;
|
|
33
|
+
projectPath: string;
|
|
34
|
+
};
|
|
24
35
|
}
|
|
25
36
|
export declare function startWorkbenchCoiServer(options: WorkbenchCoiServerOptions): Promise<WorkbenchCoiServer>;
|
|
26
37
|
//# sourceMappingURL=workbench-coi-server.d.ts.map
|