@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,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared vitest mock harness for `devtools-backend-before-quit.test.ts` and
|
|
3
|
+
* `devtools-backend-shutdown-race.test.ts` — both drive the REAL
|
|
4
|
+
* `createDevtoolsBackend`/`createDevtoolsRuntime` against the electron/fs/
|
|
5
|
+
* `@dimina-kit/devkit` mock set defined in `./devtools-runtime-mock.harness.ts`,
|
|
6
|
+
* plus the view-manager spy shim and backend-lifecycle helpers below that
|
|
7
|
+
* only these two tests need.
|
|
8
|
+
*
|
|
9
|
+
* `vi.mock(...)` calls in the imported core module run once per importing
|
|
10
|
+
* test file's own isolated module graph (vitest scopes mocking per test
|
|
11
|
+
* file); chaining through this module has the same effect as if they were
|
|
12
|
+
* written directly in the importing file — both test files' `beforeEach`
|
|
13
|
+
* still dynamically `await import('./devtools-backend.js')` AFTER
|
|
14
|
+
* `vi.resetModules()`, well after the core module's mock registrations have
|
|
15
|
+
* already run.
|
|
16
|
+
*/
|
|
17
|
+
import { beforeEach, expect, vi } from 'vitest';
|
|
18
|
+
import { stubs, devkitStubs } from './devtools-runtime-mock.harness.js';
|
|
19
|
+
// ── view-manager spy shim ───────────────────────────────────────────────
|
|
20
|
+
// `createDevtoolsBackend` keeps its assembled `instance` in a private
|
|
21
|
+
// closure — the returned `RuntimeBackend` exposes no getter for
|
|
22
|
+
// `instance.context.views`. Wrapping `createViewManager` here (real
|
|
23
|
+
// implementation, just observed) gives the test a handle on the exact
|
|
24
|
+
// `ViewManager` the backend's `assemble` wires up, equivalent to
|
|
25
|
+
// `vi.spyOn(instance.context.views, 'disposeAll')` without needing the
|
|
26
|
+
// backend to leak its internals.
|
|
27
|
+
const viewManagerStubs = vi.hoisted(() => ({
|
|
28
|
+
createdManagers: [],
|
|
29
|
+
}));
|
|
30
|
+
vi.mock('../services/views/view-manager.js', async (importOriginal) => {
|
|
31
|
+
const actual = await importOriginal();
|
|
32
|
+
return {
|
|
33
|
+
...actual,
|
|
34
|
+
createViewManager: (ctx) => {
|
|
35
|
+
const real = actual.createViewManager(ctx);
|
|
36
|
+
vi.spyOn(real, 'disposeAll');
|
|
37
|
+
viewManagerStubs.createdManagers.push(real);
|
|
38
|
+
return real;
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
export { stubs, devkitStubs } from './devtools-runtime-mock.harness.js';
|
|
43
|
+
export { viewManagerStubs };
|
|
44
|
+
export function registerBackendTestLifecycle() {
|
|
45
|
+
const state = {};
|
|
46
|
+
beforeEach(async () => {
|
|
47
|
+
vi.resetModules();
|
|
48
|
+
stubs.reset();
|
|
49
|
+
devkitStubs.sessionClose.mockClear();
|
|
50
|
+
viewManagerStubs.createdManagers.length = 0;
|
|
51
|
+
state.electron = await import('electron');
|
|
52
|
+
({ createDevtoolsBackend: state.createDevtoolsBackend } = await import('./devtools-backend.js'));
|
|
53
|
+
});
|
|
54
|
+
return state;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Shared setup for the two tests (one in `devtools-backend-before-quit.test.ts`,
|
|
58
|
+
* one in `devtools-backend-shutdown-race.test.ts`) that need to observe
|
|
59
|
+
* `assemble()` PAUSED mid-flight, inside a still-pending `config.onSetup`:
|
|
60
|
+
* builds the backend with a gated `onSetup`, runs `beforeReady`/`assemble`,
|
|
61
|
+
* and waits until the assembled `ViewManager` is actually reachable (proof
|
|
62
|
+
* `createDevtoolsRuntime` has progressed past instance construction) before
|
|
63
|
+
* handing control back — the caller then fires whatever quit-path event it's
|
|
64
|
+
* testing while `onSetup` is still gated, and is responsible for calling
|
|
65
|
+
* `releaseOnSetup()` + awaiting `assemblePromise` itself.
|
|
66
|
+
*/
|
|
67
|
+
export async function startAssemblingWithGatedOnSetup(createDevtoolsBackend, extraConfig = {}) {
|
|
68
|
+
let releaseOnSetup = () => { };
|
|
69
|
+
const onSetupGate = new Promise((resolve) => {
|
|
70
|
+
releaseOnSetup = resolve;
|
|
71
|
+
});
|
|
72
|
+
const backend = createDevtoolsBackend({
|
|
73
|
+
...extraConfig,
|
|
74
|
+
onSetup: async () => {
|
|
75
|
+
await onSetupGate;
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
backend.beforeReady?.({});
|
|
79
|
+
const assemblePromise = Promise.resolve(backend.assemble({}));
|
|
80
|
+
// Let `assemble` progress through `createDevtoolsRuntime` up to (and into)
|
|
81
|
+
// the pending `onSetup` gate — the instance must exist by then.
|
|
82
|
+
await vi.waitFor(() => {
|
|
83
|
+
expect(viewManagerStubs.createdManagers.length).toBeGreaterThan(0);
|
|
84
|
+
});
|
|
85
|
+
return { backend, assemblePromise, releaseOnSetup };
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=devtools-backend-before-quit.harness.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { runDevtoolsBootstrap, createDevtoolsRuntime } from '../app/app.js';
|
|
2
|
-
import { registerAppLifecycle } from '../app/lifecycle.js';
|
|
2
|
+
import { isAppQuitting, registerAppLifecycle } from '../app/lifecycle.js';
|
|
3
|
+
import { closeAllCoiHosts } from '../services/workbench-coi-host.js';
|
|
3
4
|
/**
|
|
4
5
|
* Adapts the devtools runtime into a {@link RuntimeBackend} the framework
|
|
5
6
|
* (`@dimina-kit/electron-deck`) orchestrates. The framework owns the process
|
|
@@ -21,6 +22,15 @@ import { registerAppLifecycle } from '../app/lifecycle.js';
|
|
|
21
22
|
export function createDevtoolsBackend(config = {}) {
|
|
22
23
|
// Hoisted so `onShutdown` can reach the assembled context (assigned by `assemble`).
|
|
23
24
|
let instance = null;
|
|
25
|
+
// `assemble`'s own in-flight promise: `instance` is now published EARLY (see
|
|
26
|
+
// below), before `createDevtoolsRuntime`'s async body — including the host's
|
|
27
|
+
// `config.onSetup(instance)` and everything after it — has finished running.
|
|
28
|
+
// `onShutdown` must wait for THIS to settle before disposing: disposing
|
|
29
|
+
// `instance.context.registry` while `createDevtoolsRuntime` is still adding
|
|
30
|
+
// entries to that same registry (e.g. the `updateChecker`/`setupMcp` wiring
|
|
31
|
+
// that runs after `onSetup`) hits `DisposableRegistry.add()`'s "cannot add
|
|
32
|
+
// to disposed registry" throw instead of a clean teardown.
|
|
33
|
+
let assembling = null;
|
|
24
34
|
return {
|
|
25
35
|
// The backend builds the devtools main window itself (framework skips its own).
|
|
26
36
|
// Its only construction-time needs are the host preload + `sandbox:false`
|
|
@@ -42,15 +52,61 @@ export function createDevtoolsBackend(config = {}) {
|
|
|
42
52
|
// Setup (post-whenReady): app lifecycle (window-all-closed → quit) + the
|
|
43
53
|
// full devtools assembly.
|
|
44
54
|
assemble: async () => {
|
|
45
|
-
|
|
46
|
-
|
|
55
|
+
// `onBeforeQuit` runs synchronously at Electron's `before-quit` — main
|
|
56
|
+
// loop still fully healthy, well before `will-quit`'s unawaited
|
|
57
|
+
// `shutdown()` and any window/WebContentsView destruction. Disposing
|
|
58
|
+
// the host-scoped views (host-toolbar's WebContentsView + its
|
|
59
|
+
// MessagePortMain) here, instead of leaving them to `onShutdown`'s
|
|
60
|
+
// best-effort async teardown, keeps them from surviving into
|
|
61
|
+
// Chromium's native shutdown sequence, where a late `'destroyed'`
|
|
62
|
+
// handler closing an already-torn-down MessagePort segfaults natively.
|
|
63
|
+
// Safe to run again from `onShutdown`'s `instance.dispose()` afterwards
|
|
64
|
+
// — `views.disposeAll()` and its constituents are dispose-idempotent.
|
|
65
|
+
registerAppLifecycle(() => instance?.disposeViews());
|
|
66
|
+
// `onInstanceCreated` (not the return value) is what assigns `instance`:
|
|
67
|
+
// `createDevtoolsRuntime` awaits the host's `config.onSetup(instance)`
|
|
68
|
+
// — which may run arbitrarily long and can itself load the host toolbar
|
|
69
|
+
// (a live MessagePort) — before returning. Waiting for the return value
|
|
70
|
+
// would leave `instance` null, and the before-quit hook above a no-op,
|
|
71
|
+
// for that entire window. Publishing from the callback closes it.
|
|
72
|
+
assembling = createDevtoolsRuntime(config, (created) => {
|
|
73
|
+
instance = created;
|
|
74
|
+
// Quit may have already started (before-quit already fired) before
|
|
75
|
+
// this instance existed, so the hook above ran with nothing to
|
|
76
|
+
// dispose. Self-heal: run the same teardown now that there is.
|
|
77
|
+
if (isAppQuitting())
|
|
78
|
+
instance.disposeViews();
|
|
79
|
+
}).then(() => { });
|
|
80
|
+
await assembling;
|
|
47
81
|
},
|
|
48
82
|
// Dispose the devtools context during the framework's deterministic shutdown
|
|
49
83
|
// (app.on('will-quit') → shutdown() → runShutdownCleanup(), awaited once).
|
|
50
84
|
// Without this, the compile session (a child process, torn down by
|
|
51
85
|
// closeProject) and the IPC registry would leak on exit. The framework awaits
|
|
52
86
|
// this hook, so teardown is no longer a best-effort before-quit reach-around.
|
|
53
|
-
|
|
87
|
+
//
|
|
88
|
+
// Waits for `assembling` first: `instance` can be non-null (published
|
|
89
|
+
// early, above) while `createDevtoolsRuntime`'s own async body — the
|
|
90
|
+
// host's `onSetup` and everything scheduled after it — is still running
|
|
91
|
+
// and still adding entries to `instance.context.registry`. Disposing
|
|
92
|
+
// that registry out from under an in-flight assembly throws instead of
|
|
93
|
+
// tearing down cleanly (`DisposableRegistry.add` rejects post-dispose).
|
|
94
|
+
// `.catch()` here: assembly failing is `assemble`'s problem to surface,
|
|
95
|
+
// not a reason to skip disposing whatever DID get constructed.
|
|
96
|
+
onShutdown: async () => {
|
|
97
|
+
await assembling?.catch(() => { });
|
|
98
|
+
// The workbench COI listener is deliberately kept alive across project
|
|
99
|
+
// windows (its port IS the workbench origin, see workbench-coi-host.ts),
|
|
100
|
+
// so no window teardown ever closes it. Process shutdown is the one place
|
|
101
|
+
// that must — after the windows above have released their routes, and
|
|
102
|
+
// even if one of their disposers threw on the way.
|
|
103
|
+
try {
|
|
104
|
+
await instance?.dispose();
|
|
105
|
+
}
|
|
106
|
+
finally {
|
|
107
|
+
await closeAllCoiHosts();
|
|
108
|
+
}
|
|
109
|
+
},
|
|
54
110
|
};
|
|
55
111
|
}
|
|
56
112
|
//# sourceMappingURL=devtools-backend.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
declare const stubs: {
|
|
2
|
+
handlers: Map<string, (...args: unknown[]) => unknown>;
|
|
3
|
+
projectsJsonPath: string;
|
|
4
|
+
getProjectsJson(): string | null;
|
|
5
|
+
setProjectsJson(v: string | null): void;
|
|
6
|
+
projectsWithAppJson: Set<string>;
|
|
7
|
+
makeEmitter: () => {
|
|
8
|
+
listeners: Record<string, Set<(...args: unknown[]) => unknown>>;
|
|
9
|
+
on(event: string, fn: (...args: unknown[]) => unknown): /*elided*/ any;
|
|
10
|
+
once(event: string, fn: (...args: unknown[]) => unknown): /*elided*/ any;
|
|
11
|
+
off(event: string, fn: (...args: unknown[]) => unknown): /*elided*/ any;
|
|
12
|
+
removeListener(event: string, fn: (...args: unknown[]) => unknown): /*elided*/ any;
|
|
13
|
+
emit(event: string, ...args: unknown[]): void;
|
|
14
|
+
};
|
|
15
|
+
reset: () => void;
|
|
16
|
+
};
|
|
17
|
+
declare const devkitStubs: {
|
|
18
|
+
sessionClose: import("vitest").Mock<() => Promise<void>>;
|
|
19
|
+
};
|
|
20
|
+
export { stubs, devkitStubs };
|
|
21
|
+
//# sourceMappingURL=devtools-runtime-mock.harness.d.ts.map
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared electron/fs/`@dimina-kit/devkit` mock core for
|
|
3
|
+
* `window-close-reveal.harness.ts` (app/) and
|
|
4
|
+
* `devtools-backend-before-quit.harness.ts` (runtime/) — both those harnesses
|
|
5
|
+
* drive a REAL runtime (`createDevtoolsRuntime` or `createDevtoolsBackend`)
|
|
6
|
+
* against the same mock set (lifted from `quit-flag-onclose.test.ts`) and
|
|
7
|
+
* previously duplicated it in full; this module holds the part that's
|
|
8
|
+
* actually identical between them.
|
|
9
|
+
*
|
|
10
|
+
* `BrowserWindow` here tracks visible/minimized state and implements
|
|
11
|
+
* `hide`/`isVisible`/`minimize`/`isMinimized`/`restore` on top of `show`/
|
|
12
|
+
* `showInactive` — the window-close-reveal guards need all of that, while the
|
|
13
|
+
* before-quit/shutdown-race tests only ever `destroy()` a window and never
|
|
14
|
+
* observe the extra state, so carrying it there is a no-op.
|
|
15
|
+
*
|
|
16
|
+
* `vi.mock(...)` calls here run once per importing test file's own isolated
|
|
17
|
+
* module graph (vitest scopes mocking per test file). A harness that imports
|
|
18
|
+
* this module chains into that same module graph, so importing THIS module
|
|
19
|
+
* (directly, or transitively through one of the two harnesses above) has the
|
|
20
|
+
* same effect as if each `vi.mock` call were written directly in the test
|
|
21
|
+
* file itself.
|
|
22
|
+
*/
|
|
23
|
+
import { vi } from 'vitest';
|
|
24
|
+
// ── Hoisted stub state ──────────────────────────────────────────────────
|
|
25
|
+
const stubs = vi.hoisted(() => {
|
|
26
|
+
const handlers = new Map();
|
|
27
|
+
const projectsJsonPath = '/tmp/dimina-test-userdata/dimina-projects.json';
|
|
28
|
+
let projectsJsonContent = null;
|
|
29
|
+
const projectsWithAppJson = new Set();
|
|
30
|
+
function makeEmitter() {
|
|
31
|
+
const listeners = {};
|
|
32
|
+
return {
|
|
33
|
+
listeners,
|
|
34
|
+
on(event, fn) {
|
|
35
|
+
;
|
|
36
|
+
(listeners[event] ??= new Set()).add(fn);
|
|
37
|
+
return this;
|
|
38
|
+
},
|
|
39
|
+
once(event, fn) {
|
|
40
|
+
const wrap = (...args) => {
|
|
41
|
+
listeners[event]?.delete(wrap);
|
|
42
|
+
return fn(...args);
|
|
43
|
+
};
|
|
44
|
+
(listeners[event] ??= new Set()).add(wrap);
|
|
45
|
+
return this;
|
|
46
|
+
},
|
|
47
|
+
off(event, fn) {
|
|
48
|
+
listeners[event]?.delete(fn);
|
|
49
|
+
return this;
|
|
50
|
+
},
|
|
51
|
+
removeListener(event, fn) {
|
|
52
|
+
listeners[event]?.delete(fn);
|
|
53
|
+
return this;
|
|
54
|
+
},
|
|
55
|
+
emit(event, ...args) {
|
|
56
|
+
for (const fn of [...(listeners[event] ?? [])])
|
|
57
|
+
fn(...args);
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function reset() {
|
|
62
|
+
handlers.clear();
|
|
63
|
+
projectsJsonContent = null;
|
|
64
|
+
projectsWithAppJson.clear();
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
handlers,
|
|
68
|
+
projectsJsonPath,
|
|
69
|
+
getProjectsJson() {
|
|
70
|
+
return projectsJsonContent;
|
|
71
|
+
},
|
|
72
|
+
setProjectsJson(v) {
|
|
73
|
+
projectsJsonContent = v;
|
|
74
|
+
},
|
|
75
|
+
projectsWithAppJson,
|
|
76
|
+
makeEmitter,
|
|
77
|
+
reset,
|
|
78
|
+
};
|
|
79
|
+
});
|
|
80
|
+
// ── electron stub ────────────────────────────────────────────────────────
|
|
81
|
+
vi.mock('electron', () => {
|
|
82
|
+
const ipcEmitter = stubs.makeEmitter();
|
|
83
|
+
const ipcMain = {
|
|
84
|
+
...ipcEmitter,
|
|
85
|
+
handle: vi.fn((channel, fn) => {
|
|
86
|
+
stubs.handlers.set(channel, fn);
|
|
87
|
+
}),
|
|
88
|
+
removeHandler: vi.fn((channel) => {
|
|
89
|
+
stubs.handlers.delete(channel);
|
|
90
|
+
}),
|
|
91
|
+
on: vi.fn((event, fn) => ipcEmitter.on(event, fn)),
|
|
92
|
+
removeListener: vi.fn((event, fn) => ipcEmitter.removeListener(event, fn)),
|
|
93
|
+
};
|
|
94
|
+
const appEmitter = stubs.makeEmitter();
|
|
95
|
+
const app = {
|
|
96
|
+
...appEmitter,
|
|
97
|
+
isPackaged: true,
|
|
98
|
+
whenReady: vi.fn(() => Promise.resolve()),
|
|
99
|
+
getPath: vi.fn(() => '/tmp/dimina-test-userdata'),
|
|
100
|
+
quit: vi.fn(),
|
|
101
|
+
setName: vi.fn(),
|
|
102
|
+
commandLine: {
|
|
103
|
+
getSwitchValue: vi.fn(() => ''),
|
|
104
|
+
appendSwitch: vi.fn(),
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
// `WebContents` and `BrowserWindow` below both wrap a `stubs.makeEmitter()`
|
|
108
|
+
// and need the SAME on/once/off/removeListener/emit delegation (the
|
|
109
|
+
// emitter's own methods use `this` internally, so a plain property copy
|
|
110
|
+
// would call them with the wrong receiver — each needs `.bind(em)`). Shared
|
|
111
|
+
// base class instead of re-declaring the same 5 bound fields in both.
|
|
112
|
+
class EmittingStub {
|
|
113
|
+
em = stubs.makeEmitter();
|
|
114
|
+
on = this.em.on.bind(this.em);
|
|
115
|
+
once = this.em.once.bind(this.em);
|
|
116
|
+
off = this.em.off.bind(this.em);
|
|
117
|
+
removeListener = this.em.removeListener.bind(this.em);
|
|
118
|
+
emit = this.em.emit.bind(this.em);
|
|
119
|
+
}
|
|
120
|
+
class WebContents extends EmittingStub {
|
|
121
|
+
destroyed = false;
|
|
122
|
+
id = Math.floor(Math.random() * 1e6);
|
|
123
|
+
send = vi.fn();
|
|
124
|
+
isDestroyed = () => this.destroyed;
|
|
125
|
+
openDevTools = vi.fn();
|
|
126
|
+
closeDevTools = vi.fn();
|
|
127
|
+
setDevToolsWebContents = vi.fn();
|
|
128
|
+
setWindowOpenHandler = vi.fn();
|
|
129
|
+
loadFile = vi.fn(() => Promise.resolve());
|
|
130
|
+
loadURL = vi.fn(() => Promise.resolve());
|
|
131
|
+
executeJavaScript = vi.fn(() => Promise.resolve(undefined));
|
|
132
|
+
reload = vi.fn();
|
|
133
|
+
getType = () => 'window';
|
|
134
|
+
getURL = () => '';
|
|
135
|
+
debugger = {
|
|
136
|
+
attach: vi.fn(),
|
|
137
|
+
detach: vi.fn(),
|
|
138
|
+
isAttached: () => false,
|
|
139
|
+
on: vi.fn(),
|
|
140
|
+
removeListener: vi.fn(),
|
|
141
|
+
sendCommand: vi.fn(() => Promise.resolve({ entries: [] })),
|
|
142
|
+
};
|
|
143
|
+
close = vi.fn(() => {
|
|
144
|
+
this.destroyed = true;
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
class WebContentsView {
|
|
148
|
+
webContents = new WebContents();
|
|
149
|
+
setBounds = vi.fn();
|
|
150
|
+
setBackgroundColor = vi.fn();
|
|
151
|
+
}
|
|
152
|
+
class View {
|
|
153
|
+
children = [];
|
|
154
|
+
addChildView(child) {
|
|
155
|
+
this.children.push(child);
|
|
156
|
+
}
|
|
157
|
+
removeChildView(child) {
|
|
158
|
+
const i = this.children.indexOf(child);
|
|
159
|
+
if (i >= 0)
|
|
160
|
+
this.children.splice(i, 1);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
class BrowserWindow extends EmittingStub {
|
|
164
|
+
destroyed = false;
|
|
165
|
+
// The list window and every workbench window start shown/restored — the
|
|
166
|
+
// reveal/hide guards this state exists for only ever move a window AWAY
|
|
167
|
+
// from it, never establish it.
|
|
168
|
+
visible = true;
|
|
169
|
+
minimized = false;
|
|
170
|
+
webContents = new WebContents();
|
|
171
|
+
contentView = new WebContentsView();
|
|
172
|
+
isDestroyed = () => this.destroyed;
|
|
173
|
+
isVisible = () => this.visible && !this.destroyed;
|
|
174
|
+
isMinimized = () => this.minimized;
|
|
175
|
+
getContentSize = () => [1280, 980];
|
|
176
|
+
setIcon = vi.fn();
|
|
177
|
+
setTitle = vi.fn();
|
|
178
|
+
show = vi.fn(() => {
|
|
179
|
+
this.visible = true;
|
|
180
|
+
});
|
|
181
|
+
showInactive = vi.fn(() => {
|
|
182
|
+
this.visible = true;
|
|
183
|
+
});
|
|
184
|
+
hide = vi.fn(() => {
|
|
185
|
+
this.visible = false;
|
|
186
|
+
});
|
|
187
|
+
minimize = vi.fn(() => {
|
|
188
|
+
this.minimized = true;
|
|
189
|
+
});
|
|
190
|
+
restore = vi.fn(() => {
|
|
191
|
+
this.minimized = false;
|
|
192
|
+
this.visible = true;
|
|
193
|
+
});
|
|
194
|
+
focus = vi.fn();
|
|
195
|
+
close = vi.fn();
|
|
196
|
+
destroy = vi.fn(() => {
|
|
197
|
+
this.destroyed = true;
|
|
198
|
+
});
|
|
199
|
+
loadFile = vi.fn(() => Promise.resolve());
|
|
200
|
+
loadURL = vi.fn(() => Promise.resolve());
|
|
201
|
+
static getAllWindows = vi.fn(() => []);
|
|
202
|
+
}
|
|
203
|
+
const sessionStub = {
|
|
204
|
+
fromPartition: vi.fn(() => ({
|
|
205
|
+
webRequest: {
|
|
206
|
+
onBeforeSendHeaders: vi.fn(),
|
|
207
|
+
onHeadersReceived: vi.fn(),
|
|
208
|
+
},
|
|
209
|
+
registerPreloadScript: vi.fn(),
|
|
210
|
+
protocol: { handle: vi.fn(), unhandle: vi.fn() },
|
|
211
|
+
})),
|
|
212
|
+
defaultSession: {
|
|
213
|
+
protocol: { handle: vi.fn(), unhandle: vi.fn() },
|
|
214
|
+
},
|
|
215
|
+
};
|
|
216
|
+
const dialog = {
|
|
217
|
+
showOpenDialog: vi.fn(() => Promise.resolve({ canceled: true, filePaths: [] })),
|
|
218
|
+
showMessageBox: vi.fn(() => Promise.resolve({ response: 0 })),
|
|
219
|
+
};
|
|
220
|
+
const Menu = {
|
|
221
|
+
buildFromTemplate: vi.fn((tpl) => ({ template: tpl })),
|
|
222
|
+
setApplicationMenu: vi.fn(),
|
|
223
|
+
};
|
|
224
|
+
const shell = {
|
|
225
|
+
openExternal: vi.fn(() => Promise.resolve()),
|
|
226
|
+
openPath: vi.fn(() => Promise.resolve('')),
|
|
227
|
+
};
|
|
228
|
+
const nativeImage = {
|
|
229
|
+
createFromPath: vi.fn(() => ({ isEmpty: () => true })),
|
|
230
|
+
};
|
|
231
|
+
const nativeTheme = { ...stubs.makeEmitter(), themeSource: 'system' };
|
|
232
|
+
const globalShortcut = {
|
|
233
|
+
register: vi.fn(() => false),
|
|
234
|
+
unregister: vi.fn(),
|
|
235
|
+
unregisterAll: vi.fn(),
|
|
236
|
+
};
|
|
237
|
+
const webContentsStatic = {
|
|
238
|
+
fromId: vi.fn(() => null),
|
|
239
|
+
getAllWebContents: vi.fn(() => []),
|
|
240
|
+
};
|
|
241
|
+
const Tray = vi.fn();
|
|
242
|
+
return {
|
|
243
|
+
app,
|
|
244
|
+
ipcMain,
|
|
245
|
+
BrowserWindow,
|
|
246
|
+
WebContentsView,
|
|
247
|
+
BrowserView: WebContentsView,
|
|
248
|
+
View,
|
|
249
|
+
webContents: webContentsStatic,
|
|
250
|
+
session: sessionStub,
|
|
251
|
+
protocol: { registerSchemesAsPrivileged: vi.fn(), handle: vi.fn(), unhandle: vi.fn() },
|
|
252
|
+
dialog,
|
|
253
|
+
Menu,
|
|
254
|
+
shell,
|
|
255
|
+
nativeImage,
|
|
256
|
+
nativeTheme,
|
|
257
|
+
globalShortcut,
|
|
258
|
+
Tray,
|
|
259
|
+
default: {},
|
|
260
|
+
};
|
|
261
|
+
});
|
|
262
|
+
vi.mock('fs', async () => {
|
|
263
|
+
const real = await vi.importActual('fs');
|
|
264
|
+
function existsSync(p) {
|
|
265
|
+
const s = String(p);
|
|
266
|
+
if (s === stubs.projectsJsonPath)
|
|
267
|
+
return stubs.getProjectsJson() !== null;
|
|
268
|
+
if (s.endsWith('/app.json') || s.endsWith('\\app.json')) {
|
|
269
|
+
const dir = s.replace(/[\\/]app\.json$/, '');
|
|
270
|
+
return stubs.projectsWithAppJson.has(dir);
|
|
271
|
+
}
|
|
272
|
+
return true;
|
|
273
|
+
}
|
|
274
|
+
function readFileSync(p, opts) {
|
|
275
|
+
const s = String(p);
|
|
276
|
+
if (s === stubs.projectsJsonPath) {
|
|
277
|
+
const content = stubs.getProjectsJson();
|
|
278
|
+
if (content === null)
|
|
279
|
+
throw Object.assign(new Error('ENOENT'), { code: 'ENOENT' });
|
|
280
|
+
return content;
|
|
281
|
+
}
|
|
282
|
+
return real.readFileSync(p, opts);
|
|
283
|
+
}
|
|
284
|
+
function writeFileSync(p, data) {
|
|
285
|
+
const s = String(p);
|
|
286
|
+
if (s === stubs.projectsJsonPath) {
|
|
287
|
+
stubs.setProjectsJson(typeof data === 'string' ? data : Buffer.from(data).toString('utf8'));
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
const mocked = {
|
|
291
|
+
...real,
|
|
292
|
+
existsSync,
|
|
293
|
+
readFileSync,
|
|
294
|
+
writeFileSync,
|
|
295
|
+
mkdirSync: vi.fn(),
|
|
296
|
+
statSync: vi.fn(() => ({ isDirectory: () => true, isFile: () => false, size: 0, mtimeMs: 0 })),
|
|
297
|
+
watch: vi.fn(),
|
|
298
|
+
realpathSync: vi.fn((p) => p),
|
|
299
|
+
};
|
|
300
|
+
return { ...mocked, default: mocked };
|
|
301
|
+
});
|
|
302
|
+
const devkitStubs = vi.hoisted(() => ({
|
|
303
|
+
sessionClose: vi.fn(() => Promise.resolve()),
|
|
304
|
+
}));
|
|
305
|
+
vi.mock('@dimina-kit/devkit', () => ({
|
|
306
|
+
openProject: vi.fn(() => Promise.resolve({
|
|
307
|
+
port: 12345,
|
|
308
|
+
appInfo: { appId: 'fakeApp' },
|
|
309
|
+
close: devkitStubs.sessionClose,
|
|
310
|
+
})),
|
|
311
|
+
}));
|
|
312
|
+
export { stubs, devkitStubs };
|
|
313
|
+
//# sourceMappingURL=devtools-runtime-mock.harness.js.map
|