@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,4 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
2
24
|
|
|
3
25
|
// src/preload/shared/expose.ts
|
|
4
26
|
var import_electron = require("electron");
|
|
@@ -30,23 +52,193 @@ function getActivePageIframe() {
|
|
|
30
52
|
return iframes.length > 0 ? iframes[iframes.length - 1] : null;
|
|
31
53
|
}
|
|
32
54
|
|
|
33
|
-
//
|
|
55
|
+
// ../inspect/dist/sid-registry.js
|
|
34
56
|
var SYNTHETIC_SID_PREFIX = "devtools-";
|
|
35
57
|
var elBySyntheticSid = /* @__PURE__ */ new Map();
|
|
36
58
|
function findElementBySid(doc, sid) {
|
|
37
59
|
if (sid.startsWith(SYNTHETIC_SID_PREFIX)) {
|
|
38
60
|
const ref = elBySyntheticSid.get(sid);
|
|
39
|
-
if (!ref)
|
|
61
|
+
if (!ref)
|
|
62
|
+
return null;
|
|
40
63
|
const el = ref.deref();
|
|
41
64
|
if (!el || !el.isConnected) {
|
|
42
65
|
elBySyntheticSid.delete(sid);
|
|
43
66
|
return null;
|
|
44
67
|
}
|
|
45
|
-
if (el.ownerDocument !== doc)
|
|
68
|
+
if (el.ownerDocument !== doc)
|
|
69
|
+
return null;
|
|
46
70
|
return el;
|
|
47
71
|
}
|
|
48
|
-
return doc.querySelector(`[data-sid="${
|
|
72
|
+
return doc.querySelector(`[data-sid="${escapeForAttrSelector(sid)}"]`);
|
|
73
|
+
}
|
|
74
|
+
function escapeForAttrSelector(value) {
|
|
75
|
+
const impl = globalThis.CSS?.escape;
|
|
76
|
+
if (impl)
|
|
77
|
+
return impl(value);
|
|
78
|
+
return value.replace(/[\\"]/g, "\\$&");
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// ../inspect/dist/appdata-accumulator.js
|
|
82
|
+
function parseMessagePayload(message) {
|
|
83
|
+
if (typeof message !== "string")
|
|
84
|
+
return message;
|
|
85
|
+
try {
|
|
86
|
+
return JSON.parse(message);
|
|
87
|
+
} catch {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function decodeUpdateBatchBody(rawBody) {
|
|
92
|
+
const body = rawBody;
|
|
93
|
+
if (!body || typeof body !== "object")
|
|
94
|
+
return null;
|
|
95
|
+
if (typeof body.bridgeId !== "string" || !Array.isArray(body.updates))
|
|
96
|
+
return null;
|
|
97
|
+
const out = [];
|
|
98
|
+
for (const u of body.updates) {
|
|
99
|
+
if (!u || typeof u.moduleId !== "string")
|
|
100
|
+
continue;
|
|
101
|
+
if (!u.moduleId.startsWith("page_"))
|
|
102
|
+
continue;
|
|
103
|
+
out.push({ mode: "patch", bridgeId: body.bridgeId, moduleId: u.moduleId, data: u.data });
|
|
104
|
+
}
|
|
105
|
+
return out.length > 0 ? out : null;
|
|
49
106
|
}
|
|
107
|
+
function decodePageInitBody(moduleId, rawBody) {
|
|
108
|
+
const body = rawBody;
|
|
109
|
+
if (!body || typeof body !== "object")
|
|
110
|
+
return null;
|
|
111
|
+
if (typeof body.bridgeId !== "string" || typeof body.path !== "string")
|
|
112
|
+
return null;
|
|
113
|
+
if (!body.data || typeof body.data !== "object")
|
|
114
|
+
return null;
|
|
115
|
+
return [{
|
|
116
|
+
mode: "init",
|
|
117
|
+
bridgeId: body.bridgeId,
|
|
118
|
+
moduleId,
|
|
119
|
+
componentPath: body.path,
|
|
120
|
+
data: body.data
|
|
121
|
+
}];
|
|
122
|
+
}
|
|
123
|
+
function decodeWorkerMessage(message) {
|
|
124
|
+
const payload = parseMessagePayload(message);
|
|
125
|
+
if (!payload || typeof payload !== "object")
|
|
126
|
+
return null;
|
|
127
|
+
const record = payload;
|
|
128
|
+
if (record.type === "ub")
|
|
129
|
+
return decodeUpdateBatchBody(record.body);
|
|
130
|
+
if (typeof record.type === "string" && record.type.startsWith("page_")) {
|
|
131
|
+
return decodePageInitBody(record.type, record.body);
|
|
132
|
+
}
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
function decodeOutgoingMessage(message) {
|
|
136
|
+
const payload = parseMessagePayload(message);
|
|
137
|
+
if (!payload || typeof payload !== "object")
|
|
138
|
+
return null;
|
|
139
|
+
const r = payload;
|
|
140
|
+
if (typeof r.type !== "string")
|
|
141
|
+
return null;
|
|
142
|
+
return {
|
|
143
|
+
type: r.type,
|
|
144
|
+
bridgeId: typeof r.body?.bridgeId === "string" ? r.body.bridgeId : void 0
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
var AppDataAccumulator = class {
|
|
148
|
+
cache = /* @__PURE__ */ new Map();
|
|
149
|
+
// Bridges in insertion order — drives the `bridges` array (stable tab order).
|
|
150
|
+
bridgeOrder = [];
|
|
151
|
+
// Page path per bridge: set from `page_*` init's body.path (the page route).
|
|
152
|
+
bridgePagePath = /* @__PURE__ */ new Map();
|
|
153
|
+
recordBridge(bridgeId) {
|
|
154
|
+
if (!this.bridgeOrder.includes(bridgeId))
|
|
155
|
+
this.bridgeOrder.push(bridgeId);
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Apply one entry. Returns true if it was accepted (a mutation worth
|
|
159
|
+
* republishing), false if dropped (missing ids, or the init-gate).
|
|
160
|
+
*/
|
|
161
|
+
apply(input) {
|
|
162
|
+
if (!input.bridgeId || !input.moduleId)
|
|
163
|
+
return false;
|
|
164
|
+
if (input.mode !== "init" && !this.bridgePagePath.has(input.bridgeId))
|
|
165
|
+
return false;
|
|
166
|
+
const key = `${input.bridgeId}/${input.moduleId}`;
|
|
167
|
+
const prev = this.cache.get(key);
|
|
168
|
+
const incoming = input.data && typeof input.data === "object" ? input.data : {};
|
|
169
|
+
const merged = input.mode === "init" ? { ...incoming } : { ...prev?.data ?? {}, ...incoming };
|
|
170
|
+
const componentPath = input.componentPath ?? prev?.componentPath;
|
|
171
|
+
const next = componentPath !== void 0 ? { componentPath, data: merged } : { data: merged };
|
|
172
|
+
this.cache.set(key, next);
|
|
173
|
+
this.recordBridge(input.bridgeId);
|
|
174
|
+
if (input.mode === "init" && input.moduleId.startsWith("page_") && input.componentPath) {
|
|
175
|
+
this.bridgePagePath.set(input.bridgeId, input.componentPath);
|
|
176
|
+
}
|
|
177
|
+
return true;
|
|
178
|
+
}
|
|
179
|
+
/** Evict every entry for a bridge (page teardown). */
|
|
180
|
+
clearBridge(bridgeId) {
|
|
181
|
+
const prefix = `${bridgeId}/`;
|
|
182
|
+
for (const key of [...this.cache.keys()]) {
|
|
183
|
+
if (key.startsWith(prefix))
|
|
184
|
+
this.cache.delete(key);
|
|
185
|
+
}
|
|
186
|
+
const idx = this.bridgeOrder.indexOf(bridgeId);
|
|
187
|
+
if (idx >= 0)
|
|
188
|
+
this.bridgeOrder.splice(idx, 1);
|
|
189
|
+
this.bridgePagePath.delete(bridgeId);
|
|
190
|
+
}
|
|
191
|
+
/** The full cumulative snapshot for the panel. */
|
|
192
|
+
snapshot() {
|
|
193
|
+
const bridges = [];
|
|
194
|
+
for (const id of this.bridgeOrder) {
|
|
195
|
+
bridges.push({ id, pagePath: this.bridgePagePath.get(id) ?? null });
|
|
196
|
+
}
|
|
197
|
+
const entries = {};
|
|
198
|
+
for (const [key, entry] of this.cache) {
|
|
199
|
+
const slash = key.indexOf("/");
|
|
200
|
+
if (slash < 0)
|
|
201
|
+
continue;
|
|
202
|
+
const bridgeId = key.slice(0, slash);
|
|
203
|
+
const moduleId = key.slice(slash + 1);
|
|
204
|
+
if (!entries[bridgeId])
|
|
205
|
+
entries[bridgeId] = {};
|
|
206
|
+
const displayKey = entry.componentPath ?? moduleId;
|
|
207
|
+
entries[bridgeId][displayKey] = entry.data;
|
|
208
|
+
}
|
|
209
|
+
return { bridges, entries };
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* The current reactive page state for a bridge: shallow-merge of `entry.data`
|
|
213
|
+
* across every cache entry whose key starts with `${bridgeId}/`, in insertion
|
|
214
|
+
* order (later entries win on key conflicts). `{}` when no entries match
|
|
215
|
+
* (unknown bridge / after clearBridge). Pure, no side effects.
|
|
216
|
+
*/
|
|
217
|
+
pageData(bridgeId) {
|
|
218
|
+
const merged = {};
|
|
219
|
+
for (const [key, entry] of this.cache) {
|
|
220
|
+
const slash = key.indexOf("/");
|
|
221
|
+
if (slash < 0)
|
|
222
|
+
continue;
|
|
223
|
+
if (key.slice(0, slash) !== bridgeId)
|
|
224
|
+
continue;
|
|
225
|
+
Object.assign(merged, entry.data);
|
|
226
|
+
}
|
|
227
|
+
return merged;
|
|
228
|
+
}
|
|
229
|
+
/** Flat `key → data` map for the `__simulatorData.getAppdata()` mirror. */
|
|
230
|
+
flat() {
|
|
231
|
+
const data = {};
|
|
232
|
+
for (const [key, entry] of this.cache)
|
|
233
|
+
data[key] = entry.data;
|
|
234
|
+
return data;
|
|
235
|
+
}
|
|
236
|
+
clear() {
|
|
237
|
+
this.cache.clear();
|
|
238
|
+
this.bridgeOrder.length = 0;
|
|
239
|
+
this.bridgePagePath.clear();
|
|
240
|
+
}
|
|
241
|
+
};
|
|
50
242
|
|
|
51
243
|
// src/preload/runtime/bridge.ts
|
|
52
244
|
var state = {
|
|
@@ -171,6 +363,63 @@ function installSimulatorBridge() {
|
|
|
171
363
|
// src/preload/runtime/custom-apis.ts
|
|
172
364
|
var import_electron2 = require("electron");
|
|
173
365
|
|
|
366
|
+
// ../dimina-electron-runtime/dist/shared/bridge-channels.js
|
|
367
|
+
var BRIDGE_CHANNELS = {
|
|
368
|
+
SPAWN: "dmb:spawn",
|
|
369
|
+
DISPOSE: "dmb:dispose",
|
|
370
|
+
PAGE_OPEN: "dmb:page:open",
|
|
371
|
+
PAGE_CLOSE: "dmb:page:close",
|
|
372
|
+
PAGE_LIFECYCLE: "dmb:page:lifecycle",
|
|
373
|
+
NAV_CALLBACK: "dmb:nav:callback",
|
|
374
|
+
SERVICE_INVOKE: "dmb:service:invoke",
|
|
375
|
+
SERVICE_PUBLISH: "dmb:service:publish",
|
|
376
|
+
RENDER_INVOKE: "dmb:render:invoke",
|
|
377
|
+
RENDER_PUBLISH: "dmb:render:publish",
|
|
378
|
+
TO_SERVICE: "dmb:to-service",
|
|
379
|
+
TO_RENDER: "dmb:to-render",
|
|
380
|
+
SIMULATOR_API: "dmb:simulator-api",
|
|
381
|
+
/** simulator → main: ack of an API_CALL request (carries success/fail args). */
|
|
382
|
+
API_RESPONSE: "dmb:api:response",
|
|
383
|
+
/**
|
|
384
|
+
* simulator webview preload → main (sendSync): "is native-host mode on?".
|
|
385
|
+
* The guest preload can't read the launch `process.env`, so it asks main
|
|
386
|
+
* (which can) at install time. Reply is `e.returnValue = boolean`.
|
|
387
|
+
*/
|
|
388
|
+
NATIVE_HOST_ENABLED: "dmb:native-host-enabled",
|
|
389
|
+
/**
|
|
390
|
+
* simulator (DeviceShell) → main: the visible top-of-stack page bridgeId.
|
|
391
|
+
* Main has no z-order concept — the active page lives only in DeviceShell's
|
|
392
|
+
* ShellState — so devtools panels / automation that must target "the current
|
|
393
|
+
* page's render webContents" resolve it through this signal. Fire-and-forget.
|
|
394
|
+
*/
|
|
395
|
+
ACTIVE_PAGE: "dmb:active-page",
|
|
396
|
+
/**
|
|
397
|
+
* simulator (DeviceShell) → main: the FULL ordered page stack (bottom→top)
|
|
398
|
+
* whenever it changes. Main has no stack of its own (it only learns the
|
|
399
|
+
* active bridgeId via ACTIVE_PAGE), so automation's `App.getPageStack` needs
|
|
400
|
+
* this to report multi-page stacks. Fire-and-forget.
|
|
401
|
+
*/
|
|
402
|
+
PAGE_STACK: "dmb:page-stack",
|
|
403
|
+
/**
|
|
404
|
+
* preload (window.wx.request, no service-host in the picture) → main
|
|
405
|
+
* (invoke): run an HTTP request through the main-process native transport
|
|
406
|
+
* (`main/services/native-request`) instead of the renderer's `fetch()`, so
|
|
407
|
+
* it never hits Chromium's Fetch/CORS algorithm (no spurious OPTIONS
|
|
408
|
+
* preflight). Reply is a `NativeRequestResult` (success or fail shape).
|
|
409
|
+
*/
|
|
410
|
+
NATIVE_REQUEST: "dmb:native-request",
|
|
411
|
+
/**
|
|
412
|
+
* preload → main: cancel the in-flight native request named by the
|
|
413
|
+
* requestId a prior NATIVE_REQUEST call was invoked with. Fire-and-forget;
|
|
414
|
+
* a requestId that already settled or belongs to another sender is a no-op.
|
|
415
|
+
*/
|
|
416
|
+
NATIVE_REQUEST_ABORT: "dmb:native-request-abort"
|
|
417
|
+
};
|
|
418
|
+
var SimulatorCustomApiBridgeChannel = {
|
|
419
|
+
Request: "simulator:custom-apis:bridge-request",
|
|
420
|
+
Response: "simulator:custom-apis:bridge-response"
|
|
421
|
+
};
|
|
422
|
+
|
|
174
423
|
// src/shared/ipc-channels.ts
|
|
175
424
|
var SimulatorChannel = {
|
|
176
425
|
// Ask main to create the simulator as a top-level WebContentsView (so nested
|
|
@@ -191,14 +440,13 @@ var SimulatorChannel = {
|
|
|
191
440
|
Detach: "simulator:detach",
|
|
192
441
|
Console: "simulator:console",
|
|
193
442
|
// Main → renderer push of the visible top-of-stack page route whenever the
|
|
194
|
-
// mini-app navigates (navigateTo / switchTab / back). Payload: the page
|
|
195
|
-
// string (
|
|
443
|
+
// mini-app navigates (navigateTo / switchTab / back). Payload: the page
|
|
444
|
+
// route string (`pagePath` + `?k=v&…` query, same format as
|
|
445
|
+
// `encodePageSpec`/`decodePageSpec`), or '' when unknown. The query lets the
|
|
446
|
+
// page-path bar show params (WeChat DevTools parity) and a recompile restore
|
|
447
|
+
// the current page's params.
|
|
196
448
|
CurrentPage: "simulator:current-page"
|
|
197
449
|
};
|
|
198
|
-
var SimulatorCustomApiBridgeChannel = {
|
|
199
|
-
Request: "simulator:custom-apis:bridge-request",
|
|
200
|
-
Response: "simulator:custom-apis:bridge-response"
|
|
201
|
-
};
|
|
202
450
|
|
|
203
451
|
// src/preload/runtime/custom-apis.ts
|
|
204
452
|
var LIST_RETRY_INTERVAL_MS = 150;
|
|
@@ -276,6 +524,31 @@ function installCustomApisBridge() {
|
|
|
276
524
|
return exposeOnMainWorld("__diminaCustomApis", bridge);
|
|
277
525
|
}
|
|
278
526
|
|
|
527
|
+
// src/preload/runtime/node-bindings.ts
|
|
528
|
+
var import_node_fs = __toESM(require("node:fs"), 1);
|
|
529
|
+
var import_node_os = __toESM(require("node:os"), 1);
|
|
530
|
+
var import_node_path = __toESM(require("node:path"), 1);
|
|
531
|
+
var import_node_crypto = __toESM(require("node:crypto"), 1);
|
|
532
|
+
var import_node_buffer = __toESM(require("node:buffer"), 1);
|
|
533
|
+
|
|
534
|
+
// ../dimina-electron-runtime/dist/shared/node-bindings.js
|
|
535
|
+
var NODE_BINDINGS_GLOBAL = "__diminaNodeBindings";
|
|
536
|
+
|
|
537
|
+
// src/preload/runtime/node-bindings.ts
|
|
538
|
+
function installNodeBindings() {
|
|
539
|
+
const existing = Object.getOwnPropertyDescriptor(globalThis, NODE_BINDINGS_GLOBAL);
|
|
540
|
+
if (existing && !existing.configurable) {
|
|
541
|
+
return;
|
|
542
|
+
}
|
|
543
|
+
const bindings = Object.freeze({ fs: import_node_fs.default, os: import_node_os.default, path: import_node_path.default, crypto: import_node_crypto.default, buffer: import_node_buffer.default });
|
|
544
|
+
Object.defineProperty(globalThis, NODE_BINDINGS_GLOBAL, {
|
|
545
|
+
value: bindings,
|
|
546
|
+
writable: false,
|
|
547
|
+
configurable: false,
|
|
548
|
+
enumerable: true
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
|
|
279
552
|
// src/preload/runtime/temp-files.ts
|
|
280
553
|
var import_electron3 = require("electron");
|
|
281
554
|
|
|
@@ -288,18 +561,26 @@ function setTempFileSink(sink) {
|
|
|
288
561
|
// src/preload/runtime/temp-files.ts
|
|
289
562
|
function installTempFileBridge() {
|
|
290
563
|
setTempFileSink({
|
|
291
|
-
write(
|
|
564
|
+
write(path2, blob) {
|
|
292
565
|
blob.arrayBuffer().then((bytes) => {
|
|
293
566
|
import_electron3.ipcRenderer.send("simulator:temp-file:write", {
|
|
294
|
-
path,
|
|
567
|
+
path: path2,
|
|
295
568
|
mime: blob.type,
|
|
296
569
|
bytes
|
|
297
570
|
});
|
|
298
571
|
}).catch(() => {
|
|
299
572
|
});
|
|
300
573
|
},
|
|
301
|
-
|
|
302
|
-
|
|
574
|
+
async writeAndWait(path2, blob) {
|
|
575
|
+
const bytes = await blob.arrayBuffer();
|
|
576
|
+
await import_electron3.ipcRenderer.invoke("simulator:temp-file:write-confirmed", {
|
|
577
|
+
path: path2,
|
|
578
|
+
mime: blob.type,
|
|
579
|
+
bytes
|
|
580
|
+
});
|
|
581
|
+
},
|
|
582
|
+
revoke(path2) {
|
|
583
|
+
import_electron3.ipcRenderer.send("simulator:temp-file:revoke", { path: path2 });
|
|
303
584
|
},
|
|
304
585
|
revokeAll() {
|
|
305
586
|
import_electron3.ipcRenderer.send("simulator:temp-file:revoke-all");
|
|
@@ -380,146 +661,6 @@ function installConsoleInstrumentation() {
|
|
|
380
661
|
};
|
|
381
662
|
}
|
|
382
663
|
|
|
383
|
-
// src/shared/appdata-accumulator.ts
|
|
384
|
-
function parseMessagePayload(message) {
|
|
385
|
-
if (typeof message !== "string") return message;
|
|
386
|
-
try {
|
|
387
|
-
return JSON.parse(message);
|
|
388
|
-
} catch {
|
|
389
|
-
return null;
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
function decodeUpdateBatchBody(rawBody) {
|
|
393
|
-
const body = rawBody;
|
|
394
|
-
if (!body || typeof body !== "object") return null;
|
|
395
|
-
if (typeof body.bridgeId !== "string" || !Array.isArray(body.updates)) return null;
|
|
396
|
-
const out = [];
|
|
397
|
-
for (const u of body.updates) {
|
|
398
|
-
if (!u || typeof u.moduleId !== "string") continue;
|
|
399
|
-
if (!u.moduleId.startsWith("page_")) continue;
|
|
400
|
-
out.push({ mode: "patch", bridgeId: body.bridgeId, moduleId: u.moduleId, data: u.data });
|
|
401
|
-
}
|
|
402
|
-
return out.length > 0 ? out : null;
|
|
403
|
-
}
|
|
404
|
-
function decodePageInitBody(moduleId, rawBody) {
|
|
405
|
-
const body = rawBody;
|
|
406
|
-
if (!body || typeof body !== "object") return null;
|
|
407
|
-
if (typeof body.bridgeId !== "string" || typeof body.path !== "string") return null;
|
|
408
|
-
if (!body.data || typeof body.data !== "object") return null;
|
|
409
|
-
return [{
|
|
410
|
-
mode: "init",
|
|
411
|
-
bridgeId: body.bridgeId,
|
|
412
|
-
moduleId,
|
|
413
|
-
componentPath: body.path,
|
|
414
|
-
data: body.data
|
|
415
|
-
}];
|
|
416
|
-
}
|
|
417
|
-
function decodeWorkerMessage(message) {
|
|
418
|
-
const payload = parseMessagePayload(message);
|
|
419
|
-
if (!payload || typeof payload !== "object") return null;
|
|
420
|
-
const record = payload;
|
|
421
|
-
if (record.type === "ub") return decodeUpdateBatchBody(record.body);
|
|
422
|
-
if (typeof record.type === "string" && record.type.startsWith("page_")) {
|
|
423
|
-
return decodePageInitBody(record.type, record.body);
|
|
424
|
-
}
|
|
425
|
-
return null;
|
|
426
|
-
}
|
|
427
|
-
function decodeOutgoingMessage(message) {
|
|
428
|
-
const payload = parseMessagePayload(message);
|
|
429
|
-
if (!payload || typeof payload !== "object") return null;
|
|
430
|
-
const r = payload;
|
|
431
|
-
if (typeof r.type !== "string") return null;
|
|
432
|
-
return {
|
|
433
|
-
type: r.type,
|
|
434
|
-
bridgeId: typeof r.body?.bridgeId === "string" ? r.body.bridgeId : void 0
|
|
435
|
-
};
|
|
436
|
-
}
|
|
437
|
-
var AppDataAccumulator = class {
|
|
438
|
-
cache = /* @__PURE__ */ new Map();
|
|
439
|
-
// Bridges in insertion order — drives the `bridges` array (stable tab order).
|
|
440
|
-
bridgeOrder = [];
|
|
441
|
-
// Page path per bridge: set from `page_*` init's body.path (the page route).
|
|
442
|
-
bridgePagePath = /* @__PURE__ */ new Map();
|
|
443
|
-
recordBridge(bridgeId) {
|
|
444
|
-
if (!this.bridgeOrder.includes(bridgeId)) this.bridgeOrder.push(bridgeId);
|
|
445
|
-
}
|
|
446
|
-
/**
|
|
447
|
-
* Apply one entry. Returns true if it was accepted (a mutation worth
|
|
448
|
-
* republishing), false if dropped (missing ids, or the init-gate).
|
|
449
|
-
*/
|
|
450
|
-
apply(input) {
|
|
451
|
-
if (!input.bridgeId || !input.moduleId) return false;
|
|
452
|
-
if (input.mode !== "init" && !this.bridgePagePath.has(input.bridgeId)) return false;
|
|
453
|
-
const key = `${input.bridgeId}/${input.moduleId}`;
|
|
454
|
-
const prev = this.cache.get(key);
|
|
455
|
-
const incoming = input.data && typeof input.data === "object" ? input.data : {};
|
|
456
|
-
const merged = input.mode === "init" ? { ...incoming } : { ...prev?.data ?? {}, ...incoming };
|
|
457
|
-
const componentPath = input.componentPath ?? prev?.componentPath;
|
|
458
|
-
const next = componentPath !== void 0 ? { componentPath, data: merged } : { data: merged };
|
|
459
|
-
this.cache.set(key, next);
|
|
460
|
-
this.recordBridge(input.bridgeId);
|
|
461
|
-
if (input.mode === "init" && input.moduleId.startsWith("page_") && input.componentPath) {
|
|
462
|
-
this.bridgePagePath.set(input.bridgeId, input.componentPath);
|
|
463
|
-
}
|
|
464
|
-
return true;
|
|
465
|
-
}
|
|
466
|
-
/** Evict every entry for a bridge (page teardown). */
|
|
467
|
-
clearBridge(bridgeId) {
|
|
468
|
-
const prefix = `${bridgeId}/`;
|
|
469
|
-
for (const key of [...this.cache.keys()]) {
|
|
470
|
-
if (key.startsWith(prefix)) this.cache.delete(key);
|
|
471
|
-
}
|
|
472
|
-
const idx = this.bridgeOrder.indexOf(bridgeId);
|
|
473
|
-
if (idx >= 0) this.bridgeOrder.splice(idx, 1);
|
|
474
|
-
this.bridgePagePath.delete(bridgeId);
|
|
475
|
-
}
|
|
476
|
-
/** The full cumulative snapshot for the panel. */
|
|
477
|
-
snapshot() {
|
|
478
|
-
const bridges = [];
|
|
479
|
-
for (const id of this.bridgeOrder) {
|
|
480
|
-
bridges.push({ id, pagePath: this.bridgePagePath.get(id) ?? null });
|
|
481
|
-
}
|
|
482
|
-
const entries = {};
|
|
483
|
-
for (const [key, entry] of this.cache) {
|
|
484
|
-
const slash = key.indexOf("/");
|
|
485
|
-
if (slash < 0) continue;
|
|
486
|
-
const bridgeId = key.slice(0, slash);
|
|
487
|
-
const moduleId = key.slice(slash + 1);
|
|
488
|
-
if (!entries[bridgeId]) entries[bridgeId] = {};
|
|
489
|
-
const displayKey = entry.componentPath ?? moduleId;
|
|
490
|
-
entries[bridgeId][displayKey] = entry.data;
|
|
491
|
-
}
|
|
492
|
-
return { bridges, entries };
|
|
493
|
-
}
|
|
494
|
-
/**
|
|
495
|
-
* The current reactive page state for a bridge: shallow-merge of `entry.data`
|
|
496
|
-
* across every cache entry whose key starts with `${bridgeId}/`, in insertion
|
|
497
|
-
* order (later entries win on key conflicts). `{}` when no entries match
|
|
498
|
-
* (unknown bridge / after clearBridge). Pure, no side effects.
|
|
499
|
-
*/
|
|
500
|
-
pageData(bridgeId) {
|
|
501
|
-
const merged = {};
|
|
502
|
-
for (const [key, entry] of this.cache) {
|
|
503
|
-
const slash = key.indexOf("/");
|
|
504
|
-
if (slash < 0) continue;
|
|
505
|
-
if (key.slice(0, slash) !== bridgeId) continue;
|
|
506
|
-
Object.assign(merged, entry.data);
|
|
507
|
-
}
|
|
508
|
-
return merged;
|
|
509
|
-
}
|
|
510
|
-
/** Flat `key → data` map for the `__simulatorData.getAppdata()` mirror. */
|
|
511
|
-
flat() {
|
|
512
|
-
const data = {};
|
|
513
|
-
for (const [key, entry] of this.cache) data[key] = entry.data;
|
|
514
|
-
return data;
|
|
515
|
-
}
|
|
516
|
-
clear() {
|
|
517
|
-
this.cache.clear();
|
|
518
|
-
this.bridgeOrder.length = 0;
|
|
519
|
-
this.bridgePagePath.clear();
|
|
520
|
-
}
|
|
521
|
-
};
|
|
522
|
-
|
|
523
664
|
// src/preload/instrumentation/app-data.ts
|
|
524
665
|
function createAppDataSource() {
|
|
525
666
|
const accumulator = new AppDataAccumulator();
|
|
@@ -624,109 +765,8 @@ function createAppDataSource() {
|
|
|
624
765
|
};
|
|
625
766
|
}
|
|
626
767
|
|
|
627
|
-
// src/shared/request-core.ts
|
|
628
|
-
var DEFAULT_REQUEST_TIMEOUT_MS = 6e4;
|
|
629
|
-
var MAX_TIMEOUT_MS = 2147483647;
|
|
630
|
-
function resolveTimeoutBudgetMs(timeout) {
|
|
631
|
-
const t = Number(timeout);
|
|
632
|
-
return Number.isFinite(t) && t > 0 && t <= MAX_TIMEOUT_MS ? t : DEFAULT_REQUEST_TIMEOUT_MS;
|
|
633
|
-
}
|
|
634
|
-
function buildHeaders(header) {
|
|
635
|
-
const headers = new Headers();
|
|
636
|
-
for (const [key, value] of Object.entries(header ?? {})) {
|
|
637
|
-
if (value != null) headers.set(key, String(value));
|
|
638
|
-
}
|
|
639
|
-
if (!headers.has("content-type")) headers.set("content-type", "application/json");
|
|
640
|
-
return headers;
|
|
641
|
-
}
|
|
642
|
-
function appendQueryParams(url, data) {
|
|
643
|
-
const base = typeof location !== "undefined" ? location.href : void 0;
|
|
644
|
-
const resolved = new URL(url, base);
|
|
645
|
-
for (const [key, value] of Object.entries(data)) {
|
|
646
|
-
resolved.searchParams.append(key, String(value));
|
|
647
|
-
}
|
|
648
|
-
return resolved.toString();
|
|
649
|
-
}
|
|
650
|
-
function encodeBody(data, contentType) {
|
|
651
|
-
if (typeof data === "string") return data;
|
|
652
|
-
if (contentType.includes("application/x-www-form-urlencoded")) {
|
|
653
|
-
const form = new URLSearchParams();
|
|
654
|
-
for (const [key, value] of Object.entries(data)) {
|
|
655
|
-
form.append(key, String(value));
|
|
656
|
-
}
|
|
657
|
-
return form.toString();
|
|
658
|
-
}
|
|
659
|
-
return JSON.stringify(data);
|
|
660
|
-
}
|
|
661
|
-
async function decodeResponseData(response, dataType, responseType) {
|
|
662
|
-
if (responseType === "arraybuffer" || dataType === "arraybuffer") {
|
|
663
|
-
return response.arrayBuffer();
|
|
664
|
-
}
|
|
665
|
-
const text = await response.text();
|
|
666
|
-
if (dataType !== "json") return text;
|
|
667
|
-
try {
|
|
668
|
-
return JSON.parse(text);
|
|
669
|
-
} catch {
|
|
670
|
-
return text;
|
|
671
|
-
}
|
|
672
|
-
}
|
|
673
|
-
function performRequest(opts, callbacks) {
|
|
674
|
-
const method = (opts.method || "GET").toUpperCase();
|
|
675
|
-
const canHaveBody = method !== "GET" && method !== "HEAD";
|
|
676
|
-
const headers = buildHeaders(opts.header);
|
|
677
|
-
let url = opts.url;
|
|
678
|
-
const init = { method, headers };
|
|
679
|
-
if (!canHaveBody) {
|
|
680
|
-
if (opts.data && typeof opts.data === "object") {
|
|
681
|
-
url = appendQueryParams(url, opts.data);
|
|
682
|
-
}
|
|
683
|
-
} else if (opts.data != null) {
|
|
684
|
-
init.body = encodeBody(opts.data, headers.get("content-type") ?? "");
|
|
685
|
-
}
|
|
686
|
-
const controller = new AbortController();
|
|
687
|
-
init.signal = controller.signal;
|
|
688
|
-
let settled = false;
|
|
689
|
-
function settleSuccess(res) {
|
|
690
|
-
if (settled) return;
|
|
691
|
-
settled = true;
|
|
692
|
-
clearTimeout(timer);
|
|
693
|
-
callbacks.success?.(res);
|
|
694
|
-
callbacks.complete?.(res);
|
|
695
|
-
}
|
|
696
|
-
function settleFail(err) {
|
|
697
|
-
if (settled) return;
|
|
698
|
-
settled = true;
|
|
699
|
-
clearTimeout(timer);
|
|
700
|
-
callbacks.fail?.(err);
|
|
701
|
-
callbacks.complete?.(err);
|
|
702
|
-
}
|
|
703
|
-
const timeoutMs = resolveTimeoutBudgetMs(opts.timeout);
|
|
704
|
-
const timer = setTimeout(() => {
|
|
705
|
-
settleFail({ errMsg: "request:fail timeout" });
|
|
706
|
-
controller.abort();
|
|
707
|
-
}, timeoutMs);
|
|
708
|
-
const dataType = opts.dataType ?? "json";
|
|
709
|
-
const responseType = opts.responseType ?? "text";
|
|
710
|
-
fetch(url, init).then(async (response) => {
|
|
711
|
-
const header = {};
|
|
712
|
-
response.headers.forEach((value, key) => {
|
|
713
|
-
header[key] = value;
|
|
714
|
-
});
|
|
715
|
-
const data = await decodeResponseData(response, dataType, responseType);
|
|
716
|
-
settleSuccess({ data, statusCode: response.status, header, errMsg: "request:ok" });
|
|
717
|
-
}).catch((error) => {
|
|
718
|
-
const reason = error instanceof Error ? error.message : String(error);
|
|
719
|
-
settleFail({ errMsg: `request:fail ${reason || "network error"}` });
|
|
720
|
-
});
|
|
721
|
-
return {
|
|
722
|
-
abort() {
|
|
723
|
-
settleFail({ errMsg: "request:fail abort" });
|
|
724
|
-
controller.abort();
|
|
725
|
-
}
|
|
726
|
-
};
|
|
727
|
-
}
|
|
728
|
-
|
|
729
768
|
// src/preload/shared/api-compat.ts
|
|
769
|
+
var import_electron5 = require("electron");
|
|
730
770
|
function call(fn, payload) {
|
|
731
771
|
try {
|
|
732
772
|
fn?.(payload);
|
|
@@ -842,8 +882,12 @@ function ensureWxApi(wx) {
|
|
|
842
882
|
};
|
|
843
883
|
}
|
|
844
884
|
if (typeof wx.request !== "function") {
|
|
845
|
-
wx.request = (opts) =>
|
|
846
|
-
{
|
|
885
|
+
wx.request = (opts) => {
|
|
886
|
+
const requestId = `${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
887
|
+
const task = {
|
|
888
|
+
abort: () => import_electron5.ipcRenderer.send(BRIDGE_CHANNELS.NATIVE_REQUEST_ABORT, requestId)
|
|
889
|
+
};
|
|
890
|
+
import_electron5.ipcRenderer.invoke(BRIDGE_CHANNELS.NATIVE_REQUEST, requestId, {
|
|
847
891
|
url: opts.url,
|
|
848
892
|
data: opts.data,
|
|
849
893
|
header: opts.header,
|
|
@@ -851,13 +895,23 @@ function ensureWxApi(wx) {
|
|
|
851
895
|
method: opts.method,
|
|
852
896
|
dataType: opts.dataType,
|
|
853
897
|
responseType: opts.responseType
|
|
854
|
-
}
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
898
|
+
}).then((result) => {
|
|
899
|
+
if (result && typeof result === "object" && "statusCode" in result) {
|
|
900
|
+
call(opts.success, result);
|
|
901
|
+
call(opts.complete, result);
|
|
902
|
+
} else {
|
|
903
|
+
call(opts.fail, result);
|
|
904
|
+
call(opts.complete, result);
|
|
905
|
+
}
|
|
906
|
+
}).catch((error) => {
|
|
907
|
+
const err = {
|
|
908
|
+
errMsg: `request:fail ${error instanceof Error ? error.message : String(error)}`
|
|
909
|
+
};
|
|
910
|
+
call(opts.fail, err);
|
|
911
|
+
call(opts.complete, err);
|
|
912
|
+
});
|
|
913
|
+
return task;
|
|
914
|
+
};
|
|
861
915
|
}
|
|
862
916
|
}
|
|
863
917
|
function setupApiCompatHook() {
|
|
@@ -877,51 +931,42 @@ function setupApiCompatHook() {
|
|
|
877
931
|
}
|
|
878
932
|
|
|
879
933
|
// src/preload/runtime/native-host.ts
|
|
880
|
-
var
|
|
934
|
+
var import_electron6 = require("electron");
|
|
881
935
|
|
|
882
|
-
//
|
|
883
|
-
var
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
ACTIVE_PAGE: "dmb:active-page",
|
|
912
|
-
/**
|
|
913
|
-
* simulator (DeviceShell) → main: the FULL ordered page stack (bottom→top)
|
|
914
|
-
* whenever it changes. Main has no stack of its own (it only learns the
|
|
915
|
-
* active bridgeId via ACTIVE_PAGE), so automation's `App.getPageStack` needs
|
|
916
|
-
* this to report multi-page stacks. Fire-and-forget.
|
|
917
|
-
*/
|
|
918
|
-
PAGE_STACK: "dmb:page-stack"
|
|
919
|
-
};
|
|
936
|
+
// ../dimina-electron-runtime/dist/shared/dmb-resource-url.js
|
|
937
|
+
var DMB_PAGEFRAME_DOC_NAME = "__frame__.html";
|
|
938
|
+
function buildRenderHostDocumentUrl(opts) {
|
|
939
|
+
const PATH_SEPARATOR_RE = /[/\\]/;
|
|
940
|
+
for (const [name, value] of [["appId", opts.appId], ["root", opts.root]]) {
|
|
941
|
+
if (PATH_SEPARATOR_RE.test(value) || value === "." || value === "..") {
|
|
942
|
+
throw new Error(`[dmb-resource-url] ${name} must be a single path segment, got ${JSON.stringify(value)}`);
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
const pageDirSegments = opts.pagePath.split(PATH_SEPARATOR_RE).slice(0, -1).filter(Boolean);
|
|
946
|
+
for (const segment of pageDirSegments) {
|
|
947
|
+
if (segment === "." || segment === "..") {
|
|
948
|
+
throw new Error(`[dmb-resource-url] pagePath must not contain '.'/'..' segments, got ${JSON.stringify(opts.pagePath)}`);
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
const pathSegments = [opts.appId, opts.root, ...pageDirSegments, DMB_PAGEFRAME_DOC_NAME].map(encodeURIComponent);
|
|
952
|
+
const url = new URL(`dmb-resource://${opts.bridgeId}/${pathSegments.join("/")}`);
|
|
953
|
+
url.searchParams.set("bridgeId", opts.bridgeId);
|
|
954
|
+
url.searchParams.set("appId", opts.appId);
|
|
955
|
+
url.searchParams.set("root", opts.root);
|
|
956
|
+
url.searchParams.set("pagePath", opts.pagePath);
|
|
957
|
+
if (opts.isTab)
|
|
958
|
+
url.searchParams.set("isTab", "1");
|
|
959
|
+
if (opts.navigationStyle === "custom")
|
|
960
|
+
url.searchParams.set("navStyle", "custom");
|
|
961
|
+
if (opts.backgroundColor)
|
|
962
|
+
url.searchParams.set("bgColor", opts.backgroundColor);
|
|
963
|
+
return url.toString();
|
|
964
|
+
}
|
|
920
965
|
|
|
921
966
|
// src/preload/runtime/native-host.ts
|
|
922
967
|
function queryNativeHostConfig() {
|
|
923
968
|
try {
|
|
924
|
-
const res =
|
|
969
|
+
const res = import_electron6.ipcRenderer.sendSync(BRIDGE_CHANNELS.NATIVE_HOST_ENABLED);
|
|
925
970
|
return res && res.enabled ? res : null;
|
|
926
971
|
} catch {
|
|
927
972
|
return null;
|
|
@@ -931,41 +976,36 @@ function buildBridge2(cfg) {
|
|
|
931
976
|
return {
|
|
932
977
|
enabled: true,
|
|
933
978
|
spawn(opts) {
|
|
934
|
-
return
|
|
979
|
+
return import_electron6.ipcRenderer.invoke(BRIDGE_CHANNELS.SPAWN, opts);
|
|
935
980
|
},
|
|
936
981
|
dispose(bridgeId) {
|
|
937
982
|
const payload = { bridgeId };
|
|
938
|
-
|
|
983
|
+
import_electron6.ipcRenderer.send(BRIDGE_CHANNELS.DISPOSE, payload);
|
|
939
984
|
},
|
|
940
985
|
openPage(opts) {
|
|
941
|
-
return
|
|
986
|
+
return import_electron6.ipcRenderer.invoke(BRIDGE_CHANNELS.PAGE_OPEN, opts);
|
|
942
987
|
},
|
|
943
988
|
closePage(bridgeId) {
|
|
944
989
|
const payload = { bridgeId };
|
|
945
|
-
|
|
990
|
+
import_electron6.ipcRenderer.send(BRIDGE_CHANNELS.PAGE_CLOSE, payload);
|
|
946
991
|
},
|
|
947
992
|
notifyLifecycle(payload) {
|
|
948
|
-
|
|
993
|
+
import_electron6.ipcRenderer.send(BRIDGE_CHANNELS.PAGE_LIFECYCLE, payload);
|
|
949
994
|
},
|
|
950
995
|
notifyNavCallback(payload) {
|
|
951
|
-
|
|
996
|
+
import_electron6.ipcRenderer.send(BRIDGE_CHANNELS.NAV_CALLBACK, payload);
|
|
952
997
|
},
|
|
953
998
|
notifyApiResponse(payload) {
|
|
954
|
-
|
|
999
|
+
import_electron6.ipcRenderer.send(BRIDGE_CHANNELS.API_RESPONSE, payload);
|
|
955
1000
|
},
|
|
956
1001
|
notifyActivePage(payload) {
|
|
957
|
-
|
|
1002
|
+
import_electron6.ipcRenderer.send(BRIDGE_CHANNELS.ACTIVE_PAGE, payload);
|
|
958
1003
|
},
|
|
959
1004
|
notifyPageStack(payload) {
|
|
960
|
-
|
|
1005
|
+
import_electron6.ipcRenderer.send(BRIDGE_CHANNELS.PAGE_STACK, payload);
|
|
961
1006
|
},
|
|
962
1007
|
createRenderHostUrl(opts) {
|
|
963
|
-
|
|
964
|
-
url.searchParams.set("bridgeId", opts.bridgeId);
|
|
965
|
-
url.searchParams.set("appId", opts.appId);
|
|
966
|
-
url.searchParams.set("pagePath", opts.pagePath);
|
|
967
|
-
if (opts.isTab) url.searchParams.set("isTab", "1");
|
|
968
|
-
return url.toString();
|
|
1008
|
+
return buildRenderHostDocumentUrl(opts);
|
|
969
1009
|
},
|
|
970
1010
|
renderPreloadUrl: cfg.renderPreloadUrl,
|
|
971
1011
|
device: cfg.device,
|
|
@@ -974,8 +1014,8 @@ function buildBridge2(cfg) {
|
|
|
974
1014
|
;
|
|
975
1015
|
listener(payload);
|
|
976
1016
|
};
|
|
977
|
-
|
|
978
|
-
return () =>
|
|
1017
|
+
import_electron6.ipcRenderer.on(channel, wrapped);
|
|
1018
|
+
return () => import_electron6.ipcRenderer.removeListener(channel, wrapped);
|
|
979
1019
|
}
|
|
980
1020
|
};
|
|
981
1021
|
}
|
|
@@ -986,12 +1026,26 @@ function installNativeHostBridge() {
|
|
|
986
1026
|
return exposeOnMainWorld("__diminaNativeHost", buildBridge2(cfg));
|
|
987
1027
|
}
|
|
988
1028
|
|
|
1029
|
+
// src/preload/runtime/clipboard.ts
|
|
1030
|
+
var import_electron7 = require("electron");
|
|
1031
|
+
function buildBridge3() {
|
|
1032
|
+
return {
|
|
1033
|
+
readText: () => import_electron7.clipboard.readText(),
|
|
1034
|
+
writeText: (text) => import_electron7.clipboard.writeText(text)
|
|
1035
|
+
};
|
|
1036
|
+
}
|
|
1037
|
+
function installClipboardBridge() {
|
|
1038
|
+
return exposeOnMainWorld("__diminaClipboard", buildBridge3());
|
|
1039
|
+
}
|
|
1040
|
+
|
|
989
1041
|
// src/preload/windows/simulator.ts
|
|
1042
|
+
installNodeBindings();
|
|
990
1043
|
setupApiCompatHook();
|
|
991
1044
|
installSimulatorBridge();
|
|
992
1045
|
installCustomApisBridge();
|
|
993
1046
|
installTempFileBridge();
|
|
994
1047
|
installConsoleInstrumentation();
|
|
1048
|
+
installClipboardBridge();
|
|
995
1049
|
installNativeHostBridge();
|
|
996
1050
|
createAppDataSource().start(() => {
|
|
997
1051
|
});
|