@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,182 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* Wires the `difile://_tmp/*` protocol handler on the simulator session
|
|
3
|
-
* and bridges renderer-side `setTempFileSink` callbacks to the main-process
|
|
4
|
-
* byte store. Returned disposable clears the store, unregisters the protocol
|
|
5
|
-
* handler, and tears down its private IPC channels.
|
|
6
|
-
*
|
|
7
|
-
* SENDER POLICY: The default workbench sender-policy intentionally rejects
|
|
8
|
-
* the simulator `<webview>` (see `utils/sender-policy.ts`). The simulator
|
|
9
|
-
* is the only legitimate writer for these channels, so this module installs
|
|
10
|
-
* its own narrow policy that accepts a sender only when its WebContents
|
|
11
|
-
* belongs to the simulator `Session` we were handed. This bypasses the
|
|
12
|
-
* default policy without widening trust to any other source.
|
|
13
|
-
*
|
|
14
|
-
* WRITE-vs-RENDER RACE: `createTempFilePath` is synchronous on the renderer,
|
|
15
|
-
* but the bytes travel here through `blob.arrayBuffer().then(ipcRenderer.send)`
|
|
16
|
-
* — async. The simulator can race ahead: in `chooseMedia` the renderer
|
|
17
|
-
* assigns `img.src = tempFilePath` (via `readImageMetadata`) immediately
|
|
18
|
-
* after `createTempFilePath` returns, which fires a `difile://` GET before
|
|
19
|
-
* our IPC write arrives. The protocol handler therefore parks a request on
|
|
20
|
-
* a per-url waiter for up to PENDING_TIMEOUT_MS; the IPC `write` handler
|
|
21
|
-
* drains the waiter on arrival.
|
|
22
|
-
*
|
|
23
|
-
* QUOTA: A single in-memory store backs all simulator sessions for the
|
|
24
|
-
* lifetime of the WorkbenchApp instance. We cap it at MAX_STORE_ENTRIES
|
|
25
|
-
* (FIFO eviction). Project switches do NOT clear the store on their own —
|
|
26
|
-
* stale entries from a previous project simply age out as new ones land.
|
|
27
|
-
* This is the same eviction shape WeChat uses for tmp files (LRU under a
|
|
28
|
-
* size cap), simplified for a dev-tools session scope.
|
|
29
|
-
*/
|
|
30
|
-
import { IpcRegistry } from '../../utils/ipc-registry.js';
|
|
31
|
-
import { toDisposable } from '@dimina-kit/electron-deck/main';
|
|
32
|
-
import { registerTempFile, revokeTempFile, revokeAllTempFiles } from './store.js';
|
|
33
|
-
import { handleDifileRequest } from './request-handler.js';
|
|
34
|
-
import { registerMiniappSessionConfigurator } from '../views/miniapp-partition.js';
|
|
35
|
-
import { handleFsMkdir, handleFsRead, handleFsReaddir, handleFsStat, handleFsUnlink, handleFsWrite, } from './fs-channels.js';
|
|
36
|
-
/** Upper bound for in-memory entries; oldest insertion is evicted (FIFO). */
|
|
37
|
-
const MAX_STORE_ENTRIES = 200;
|
|
38
|
-
/** Max time the protocol handler waits for an in-flight `write` IPC. */
|
|
39
|
-
const PENDING_TIMEOUT_MS = 500;
|
|
40
|
-
function enforceStoreCap(store) {
|
|
41
|
-
while (store.size > MAX_STORE_ENTRIES) {
|
|
42
|
-
const next = store.keys().next();
|
|
43
|
-
if (next.done)
|
|
44
|
-
break;
|
|
45
|
-
store.delete(next.value);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
export function setupSimulatorTempFiles(simSession) {
|
|
49
|
-
const store = new Map();
|
|
50
|
-
const pendingWaiters = new Map();
|
|
51
|
-
let disposed = false;
|
|
52
|
-
function drainWaiters(path) {
|
|
53
|
-
const list = pendingWaiters.get(path);
|
|
54
|
-
if (!list)
|
|
55
|
-
return;
|
|
56
|
-
pendingWaiters.delete(path);
|
|
57
|
-
for (const fn of list)
|
|
58
|
-
fn();
|
|
59
|
-
}
|
|
60
|
-
function drainAllWaiters() {
|
|
61
|
-
const lists = Array.from(pendingWaiters.values());
|
|
62
|
-
pendingWaiters.clear();
|
|
63
|
-
for (const list of lists)
|
|
64
|
-
for (const fn of list)
|
|
65
|
-
fn();
|
|
66
|
-
}
|
|
67
|
-
// The protocol handler + IPC channels are shared across every per-project
|
|
68
|
-
// miniapp partition session (each project's render/service runs the same
|
|
69
|
-
// difile:// + temp-file FSM). The base session is always trusted; additional
|
|
70
|
-
// per-project partition sessions register themselves via `installOnSession`.
|
|
71
|
-
const trustedSessions = new Set([simSession]);
|
|
72
|
-
const simulatorOnlyPolicy = sender => !sender.isDestroyed() && trustedSessions.has(sender.session);
|
|
73
|
-
const registry = new IpcRegistry(simulatorOnlyPolicy);
|
|
74
|
-
registry.on('simulator:temp-file:write', (_event, payload) => {
|
|
75
|
-
if (disposed)
|
|
76
|
-
return;
|
|
77
|
-
const { path, mime, bytes } = payload;
|
|
78
|
-
registerTempFile(store, path, mime, bytes);
|
|
79
|
-
enforceStoreCap(store);
|
|
80
|
-
drainWaiters(path);
|
|
81
|
-
});
|
|
82
|
-
registry.on('simulator:temp-file:revoke', (_event, payload) => {
|
|
83
|
-
if (disposed)
|
|
84
|
-
return;
|
|
85
|
-
const { path } = payload;
|
|
86
|
-
revokeTempFile(store, path);
|
|
87
|
-
});
|
|
88
|
-
registry.on('simulator:temp-file:revoke-all', () => {
|
|
89
|
-
if (disposed)
|
|
90
|
-
return;
|
|
91
|
-
revokeAllTempFiles(store);
|
|
92
|
-
});
|
|
93
|
-
const difileHandler = async (req) => {
|
|
94
|
-
const url = req.url;
|
|
95
|
-
// Forward any HTTP headers Electron parsed (Range / If-None-Match)
|
|
96
|
-
// to the pure dispatcher so it can do its own conditional / range
|
|
97
|
-
// shaping.
|
|
98
|
-
const headers = {};
|
|
99
|
-
try {
|
|
100
|
-
req.headers.forEach((v, k) => { headers[k] = v; });
|
|
101
|
-
}
|
|
102
|
-
catch {
|
|
103
|
-
// Older Electron headers shape may not be iterable — best effort.
|
|
104
|
-
}
|
|
105
|
-
const ctx = { tempStore: store };
|
|
106
|
-
let res = await handleDifileRequest(ctx, { url, headers });
|
|
107
|
-
// Race waiter: the renderer-side `createTempFilePath` is synchronous
|
|
108
|
-
// but its `bytes` IPC arrives later. If we miss a `_tmp/*` lookup,
|
|
109
|
-
// park briefly and retry once.
|
|
110
|
-
if (res.status === 404
|
|
111
|
-
&& !disposed
|
|
112
|
-
&& url.startsWith('difile://_tmp/')) {
|
|
113
|
-
await new Promise((resolve) => {
|
|
114
|
-
let timer = null;
|
|
115
|
-
const notify = () => {
|
|
116
|
-
if (timer)
|
|
117
|
-
clearTimeout(timer);
|
|
118
|
-
resolve();
|
|
119
|
-
};
|
|
120
|
-
const list = pendingWaiters.get(url) ?? new Set();
|
|
121
|
-
list.add(notify);
|
|
122
|
-
pendingWaiters.set(url, list);
|
|
123
|
-
timer = setTimeout(() => {
|
|
124
|
-
const cur = pendingWaiters.get(url);
|
|
125
|
-
if (cur) {
|
|
126
|
-
cur.delete(notify);
|
|
127
|
-
if (cur.size === 0)
|
|
128
|
-
pendingWaiters.delete(url);
|
|
129
|
-
}
|
|
130
|
-
resolve();
|
|
131
|
-
}, PENDING_TIMEOUT_MS);
|
|
132
|
-
});
|
|
133
|
-
res = await handleDifileRequest(ctx, { url, headers });
|
|
134
|
-
}
|
|
135
|
-
return res;
|
|
136
|
-
};
|
|
137
|
-
// Install the difile:// protocol handler on a session. Idempotent per
|
|
138
|
-
// session: a stale handler from a prior setup (e.g. fast app re-init in
|
|
139
|
-
// tests) is replaced rather than throwing. Trusts that session's senders for
|
|
140
|
-
// the temp-file / fs IPC channels.
|
|
141
|
-
const installedSessions = new Set();
|
|
142
|
-
function installOnSession(sess) {
|
|
143
|
-
trustedSessions.add(sess);
|
|
144
|
-
if (installedSessions.has(sess))
|
|
145
|
-
return;
|
|
146
|
-
installedSessions.add(sess);
|
|
147
|
-
try {
|
|
148
|
-
sess.protocol.unhandle('difile');
|
|
149
|
-
}
|
|
150
|
-
catch {
|
|
151
|
-
// Not previously registered — fine.
|
|
152
|
-
}
|
|
153
|
-
sess.protocol.handle('difile', difileHandler);
|
|
154
|
-
}
|
|
155
|
-
installOnSession(simSession);
|
|
156
|
-
// Apply to every per-project miniapp partition session (current + future).
|
|
157
|
-
const unregisterConfigurator = registerMiniappSessionConfigurator((sess) => installOnSession(sess));
|
|
158
|
-
// Renderer FSM → main fs operations bridge. The same simulator-only sender
|
|
159
|
-
// policy applies — registry instance is shared.
|
|
160
|
-
registry.handle('simulator:fs:read', (_event, payload) => handleFsRead(payload));
|
|
161
|
-
registry.handle('simulator:fs:write', (_event, payload) => handleFsWrite(payload));
|
|
162
|
-
registry.handle('simulator:fs:stat', (_event, payload) => handleFsStat(payload));
|
|
163
|
-
registry.handle('simulator:fs:readdir', (_event, payload) => handleFsReaddir(payload));
|
|
164
|
-
registry.handle('simulator:fs:unlink', (_event, payload) => handleFsUnlink(payload));
|
|
165
|
-
registry.handle('simulator:fs:mkdir', (_event, payload) => handleFsMkdir(payload));
|
|
166
|
-
return toDisposable(async () => {
|
|
167
|
-
disposed = true;
|
|
168
|
-
unregisterConfigurator();
|
|
169
|
-
drainAllWaiters();
|
|
170
|
-
store.clear();
|
|
171
|
-
for (const sess of installedSessions) {
|
|
172
|
-
try {
|
|
173
|
-
sess.protocol.unhandle('difile');
|
|
174
|
-
}
|
|
175
|
-
catch {
|
|
176
|
-
// May already have been unhandled by app shutdown.
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
await registry.dispose();
|
|
180
|
-
});
|
|
181
|
-
}
|
|
1
|
+
export * from '@dimina-kit/electron-runtime/main/temp-files';
|
|
182
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,30 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* Pure dispatcher for `difile://` URL requests.
|
|
3
|
-
*
|
|
4
|
-
* Spec: `packages/devtools/docs/file-system.md` §4.3.
|
|
5
|
-
*
|
|
6
|
-
* The shipping implementation in `index.ts` registers a thin
|
|
7
|
-
* `simSession.protocol.handle('difile')` wrapper that delegates here; the race
|
|
8
|
-
* waiter on `_tmp/*` lives in `index.ts` because it owns the IPC lifecycle.
|
|
9
|
-
* For unit tests we assume the bytes are already in the store.
|
|
10
|
-
*
|
|
11
|
-
* Response shape:
|
|
12
|
-
* - 200: full body, with Content-Type, Cache-Control (immutable), ETag
|
|
13
|
-
* - 206: range slice, plus Content-Range
|
|
14
|
-
* - 304: empty body when `If-None-Match` matches the on-disk ETag. Per RFC
|
|
15
|
-
* 9110 §13.1.2 If-None-Match wins over Range.
|
|
16
|
-
* - 404: anything `resolveVPath` rejects, plus disk-side ENOENT and any
|
|
17
|
-
* other I/O error. The protocol handler in `index.ts` translates this
|
|
18
|
-
* into the renderer's network failure surface; we deliberately do not
|
|
19
|
-
* leak errno strings.
|
|
20
|
-
*/
|
|
21
|
-
import type { TempFileStore } from './resolver.js';
|
|
22
|
-
export interface HandleDifileContext {
|
|
23
|
-
tempStore: TempFileStore;
|
|
24
|
-
}
|
|
25
|
-
export interface HandleDifileRequest {
|
|
26
|
-
url: string;
|
|
27
|
-
headers?: Record<string, string>;
|
|
28
|
-
}
|
|
29
|
-
export declare function handleDifileRequest(ctx: HandleDifileContext, req: HandleDifileRequest): Promise<Response>;
|
|
1
|
+
export * from '@dimina-kit/electron-runtime/main/temp-files/request-handler';
|
|
30
2
|
//# sourceMappingURL=request-handler.d.ts.map
|
|
@@ -1,178 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* Pure dispatcher for `difile://` URL requests.
|
|
3
|
-
*
|
|
4
|
-
* Spec: `packages/devtools/docs/file-system.md` §4.3.
|
|
5
|
-
*
|
|
6
|
-
* The shipping implementation in `index.ts` registers a thin
|
|
7
|
-
* `simSession.protocol.handle('difile')` wrapper that delegates here; the race
|
|
8
|
-
* waiter on `_tmp/*` lives in `index.ts` because it owns the IPC lifecycle.
|
|
9
|
-
* For unit tests we assume the bytes are already in the store.
|
|
10
|
-
*
|
|
11
|
-
* Response shape:
|
|
12
|
-
* - 200: full body, with Content-Type, Cache-Control (immutable), ETag
|
|
13
|
-
* - 206: range slice, plus Content-Range
|
|
14
|
-
* - 304: empty body when `If-None-Match` matches the on-disk ETag. Per RFC
|
|
15
|
-
* 9110 §13.1.2 If-None-Match wins over Range.
|
|
16
|
-
* - 404: anything `resolveVPath` rejects, plus disk-side ENOENT and any
|
|
17
|
-
* other I/O error. The protocol handler in `index.ts` translates this
|
|
18
|
-
* into the renderer's network failure surface; we deliberately do not
|
|
19
|
-
* leak errno strings.
|
|
20
|
-
*/
|
|
21
|
-
import { resolveVPath } from '../../../shared/vpath.js';
|
|
22
|
-
import { readDiskFile } from './disk.js';
|
|
23
|
-
const CACHE_CONTROL = 'public, max-age=31536000, immutable';
|
|
24
|
-
function getHeader(headers, name) {
|
|
25
|
-
if (!headers)
|
|
26
|
-
return undefined;
|
|
27
|
-
const lc = name.toLowerCase();
|
|
28
|
-
for (const k of Object.keys(headers)) {
|
|
29
|
-
if (k.toLowerCase() === lc)
|
|
30
|
-
return headers[k];
|
|
31
|
-
}
|
|
32
|
-
return undefined;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Weak ETag comparison per RFC 9110 §8.8.3.2: strip the optional `W/` prefix
|
|
36
|
-
* from each side before comparing. Both our generated ETags and conditional
|
|
37
|
-
* headers may or may not include the weak prefix; the comparison must accept
|
|
38
|
-
* `W/"abc"` and `"abc"` as equivalent.
|
|
39
|
-
*/
|
|
40
|
-
function etagsMatch(a, b) {
|
|
41
|
-
if (!a)
|
|
42
|
-
return false;
|
|
43
|
-
const stripped = (s) => (s.startsWith('W/') ? s.slice(2) : s);
|
|
44
|
-
return stripped(a.trim()) === stripped(b);
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Parse a `Range: bytes=<start>-<end>` header into an inclusive `{start,end}`.
|
|
48
|
-
* Returns `null` if absent or malformed (callers should treat that as "no
|
|
49
|
-
* range" — a full 200 response, not a 416). `totalSize` clamps the end.
|
|
50
|
-
*/
|
|
51
|
-
function parseRange(header, totalSize) {
|
|
52
|
-
if (!header)
|
|
53
|
-
return null;
|
|
54
|
-
const m = /^bytes=(\d*)-(\d*)$/.exec(header.trim());
|
|
55
|
-
if (!m)
|
|
56
|
-
return null;
|
|
57
|
-
const startStr = m[1];
|
|
58
|
-
const endStr = m[2];
|
|
59
|
-
if (startStr === '' && endStr === '')
|
|
60
|
-
return null;
|
|
61
|
-
if (startStr === '') {
|
|
62
|
-
// Suffix range: last N bytes.
|
|
63
|
-
const n = Number(endStr);
|
|
64
|
-
if (!Number.isFinite(n) || n <= 0)
|
|
65
|
-
return null;
|
|
66
|
-
const start = Math.max(0, totalSize - n);
|
|
67
|
-
return { start, end: totalSize - 1 };
|
|
68
|
-
}
|
|
69
|
-
const start = Number(startStr);
|
|
70
|
-
if (!Number.isFinite(start) || start < 0)
|
|
71
|
-
return null;
|
|
72
|
-
const end = endStr === '' ? totalSize - 1 : Number(endStr);
|
|
73
|
-
if (!Number.isFinite(end))
|
|
74
|
-
return null;
|
|
75
|
-
return { start, end };
|
|
76
|
-
}
|
|
77
|
-
function notFound() {
|
|
78
|
-
return new Response(null, { status: 404 });
|
|
79
|
-
}
|
|
80
|
-
function notModified(etag) {
|
|
81
|
-
return new Response(null, {
|
|
82
|
-
status: 304,
|
|
83
|
-
headers: {
|
|
84
|
-
ETag: etag,
|
|
85
|
-
'Cache-Control': CACHE_CONTROL,
|
|
86
|
-
'Access-Control-Allow-Origin': '*',
|
|
87
|
-
},
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
function bufferToBody(bytes) {
|
|
91
|
-
// Copy into a fresh ArrayBuffer so the result is definitely typed as
|
|
92
|
-
// `ArrayBuffer` (not `ArrayBufferLike` / `SharedArrayBuffer`) and is
|
|
93
|
-
// safe to hand to Response without aliasing the Node Buffer pool.
|
|
94
|
-
const out = new ArrayBuffer(bytes.byteLength);
|
|
95
|
-
new Uint8Array(out).set(bytes);
|
|
96
|
-
return out;
|
|
97
|
-
}
|
|
98
|
-
function tempBody(bytes, mime) {
|
|
99
|
-
return new Response(bufferToBody(bytes), {
|
|
100
|
-
status: 200,
|
|
101
|
-
headers: {
|
|
102
|
-
'Content-Type': mime,
|
|
103
|
-
'Cache-Control': CACHE_CONTROL,
|
|
104
|
-
'Access-Control-Allow-Origin': '*',
|
|
105
|
-
},
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
export async function handleDifileRequest(ctx, req) {
|
|
109
|
-
const v = resolveVPath(req.url);
|
|
110
|
-
if (!v)
|
|
111
|
-
return notFound();
|
|
112
|
-
if (v.kind === 'tmp') {
|
|
113
|
-
const record = ctx.tempStore.get(req.url);
|
|
114
|
-
if (!record)
|
|
115
|
-
return notFound();
|
|
116
|
-
return tempBody(record.bytes, record.mime || 'application/octet-stream');
|
|
117
|
-
}
|
|
118
|
-
if (!v.realPath)
|
|
119
|
-
return notFound();
|
|
120
|
-
// Disk-backed: _store or usr.
|
|
121
|
-
try {
|
|
122
|
-
// Probe first to learn the ETag/size so If-None-Match can short-circuit
|
|
123
|
-
// without reading the body. The probe also doubles as our existence /
|
|
124
|
-
// permission check, so anything that throws here (ENOENT, EACCES, ...)
|
|
125
|
-
// surfaces as a 404.
|
|
126
|
-
const probe = await readDiskFile(v.realPath);
|
|
127
|
-
const etag = probe.etag;
|
|
128
|
-
const totalSize = probe.totalSize;
|
|
129
|
-
const mime = probe.mime;
|
|
130
|
-
const ifNoneMatch = getHeader(req.headers, 'If-None-Match');
|
|
131
|
-
if (etagsMatch(ifNoneMatch, etag)) {
|
|
132
|
-
return notModified(etag);
|
|
133
|
-
}
|
|
134
|
-
const rangeHeader = getHeader(req.headers, 'Range');
|
|
135
|
-
const range = parseRange(rangeHeader, totalSize);
|
|
136
|
-
if (range) {
|
|
137
|
-
// Range out of bounds → 416 (Range Not Satisfiable) per RFC 9110 §15.4.
|
|
138
|
-
// Distinct from 404 so callers can tell "wrong file" from "wrong slice".
|
|
139
|
-
if (range.start < 0 || range.start >= totalSize || range.end < range.start) {
|
|
140
|
-
return new Response(null, {
|
|
141
|
-
status: 416,
|
|
142
|
-
headers: {
|
|
143
|
-
'Content-Range': `bytes */${totalSize}`,
|
|
144
|
-
'Access-Control-Allow-Origin': '*',
|
|
145
|
-
},
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
const clampedEnd = Math.min(range.end, totalSize - 1);
|
|
149
|
-
const sliced = await readDiskFile(v.realPath, { range: { start: range.start, end: clampedEnd } });
|
|
150
|
-
const { bytes } = sliced;
|
|
151
|
-
const lastByte = range.start + bytes.length - 1;
|
|
152
|
-
return new Response(bufferToBody(bytes), {
|
|
153
|
-
status: 206,
|
|
154
|
-
headers: {
|
|
155
|
-
'Content-Type': mime,
|
|
156
|
-
'Content-Length': String(bytes.length),
|
|
157
|
-
'Content-Range': `bytes ${range.start}-${lastByte}/${totalSize}`,
|
|
158
|
-
'Cache-Control': CACHE_CONTROL,
|
|
159
|
-
ETag: etag,
|
|
160
|
-
'Access-Control-Allow-Origin': '*',
|
|
161
|
-
},
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
return new Response(bufferToBody(probe.bytes), {
|
|
165
|
-
status: 200,
|
|
166
|
-
headers: {
|
|
167
|
-
'Content-Type': mime,
|
|
168
|
-
'Cache-Control': CACHE_CONTROL,
|
|
169
|
-
ETag: etag,
|
|
170
|
-
'Access-Control-Allow-Origin': '*',
|
|
171
|
-
},
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
catch {
|
|
175
|
-
return notFound();
|
|
176
|
-
}
|
|
177
|
-
}
|
|
1
|
+
export * from '@dimina-kit/electron-runtime/main/temp-files/request-handler';
|
|
178
2
|
//# sourceMappingURL=request-handler.js.map
|
|
@@ -1,22 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* Pure lookup helper backing the main-process `difile://_tmp/*` protocol
|
|
3
|
-
* handler. Receives the shared {@link TempFileStore} that the
|
|
4
|
-
* `simulator:temp-file:*` IPC channels populate from the renderer.
|
|
5
|
-
*
|
|
6
|
-
* The full URL (including scheme + host) is used as the Map key — the resolver
|
|
7
|
-
* never re-parses or normalises it, so any URL with a wrong scheme or host
|
|
8
|
-
* misses regardless of suffix similarity.
|
|
9
|
-
*/
|
|
10
|
-
export interface TempFileRecord {
|
|
11
|
-
bytes: Buffer;
|
|
12
|
-
mime: string;
|
|
13
|
-
}
|
|
14
|
-
export type TempFileStore = Map<string, TempFileRecord>;
|
|
15
|
-
export declare function resolveTempFile(store: TempFileStore, url: string): {
|
|
16
|
-
status: 200;
|
|
17
|
-
bytes: Buffer;
|
|
18
|
-
mime: string;
|
|
19
|
-
} | {
|
|
20
|
-
status: 404;
|
|
21
|
-
};
|
|
1
|
+
export * from '@dimina-kit/electron-runtime/main/temp-files/resolver';
|
|
22
2
|
//# sourceMappingURL=resolver.d.ts.map
|
|
@@ -1,22 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* Pure lookup helper backing the main-process `difile://_tmp/*` protocol
|
|
3
|
-
* handler. Receives the shared {@link TempFileStore} that the
|
|
4
|
-
* `simulator:temp-file:*` IPC channels populate from the renderer.
|
|
5
|
-
*
|
|
6
|
-
* The full URL (including scheme + host) is used as the Map key — the resolver
|
|
7
|
-
* never re-parses or normalises it, so any URL with a wrong scheme or host
|
|
8
|
-
* misses regardless of suffix similarity.
|
|
9
|
-
*/
|
|
10
|
-
export function resolveTempFile(store, url) {
|
|
11
|
-
if (!url.startsWith('difile://_tmp/'))
|
|
12
|
-
return { status: 404 };
|
|
13
|
-
const record = store.get(url);
|
|
14
|
-
if (!record)
|
|
15
|
-
return { status: 404 };
|
|
16
|
-
return {
|
|
17
|
-
status: 200,
|
|
18
|
-
bytes: record.bytes,
|
|
19
|
-
mime: record.mime || 'application/octet-stream',
|
|
20
|
-
};
|
|
21
|
-
}
|
|
1
|
+
export * from '@dimina-kit/electron-runtime/main/temp-files/resolver';
|
|
22
2
|
//# sourceMappingURL=resolver.js.map
|
|
@@ -1,14 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* Mutators for the shared {@link TempFileStore}. The renderer-side bridge
|
|
3
|
-
* forwards every `createTempFilePath` / `registerTempFilePath` /
|
|
4
|
-
* `revokeTempFilePath` / `revokeAllTempFilePaths` call over IPC, and these
|
|
5
|
-
* helpers translate the payloads into Map writes.
|
|
6
|
-
*
|
|
7
|
-
* ArrayBuffer inputs are normalised to Buffer at the boundary so the
|
|
8
|
-
* resolver hot path can return the bytes directly without re-wrapping.
|
|
9
|
-
*/
|
|
10
|
-
import type { TempFileStore } from './resolver.js';
|
|
11
|
-
export declare function registerTempFile(store: TempFileStore, path: string, mime: string, bytes: ArrayBuffer | Buffer): void;
|
|
12
|
-
export declare function revokeTempFile(store: TempFileStore, path: string): void;
|
|
13
|
-
export declare function revokeAllTempFiles(store: TempFileStore): void;
|
|
1
|
+
export * from '@dimina-kit/electron-runtime/main/temp-files/store';
|
|
14
2
|
//# sourceMappingURL=store.d.ts.map
|
|
@@ -1,24 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* Mutators for the shared {@link TempFileStore}. The renderer-side bridge
|
|
3
|
-
* forwards every `createTempFilePath` / `registerTempFilePath` /
|
|
4
|
-
* `revokeTempFilePath` / `revokeAllTempFilePaths` call over IPC, and these
|
|
5
|
-
* helpers translate the payloads into Map writes.
|
|
6
|
-
*
|
|
7
|
-
* ArrayBuffer inputs are normalised to Buffer at the boundary so the
|
|
8
|
-
* resolver hot path can return the bytes directly without re-wrapping.
|
|
9
|
-
*/
|
|
10
|
-
export function registerTempFile(store, path, mime, bytes) {
|
|
11
|
-
const buf = Buffer.isBuffer(bytes) ? bytes : Buffer.from(new Uint8Array(bytes));
|
|
12
|
-
// delete-then-set so an existing entry's insertion order is refreshed.
|
|
13
|
-
// Without this, a FIFO cap eviction over `store.keys()` could drop a
|
|
14
|
-
// recently re-written path.
|
|
15
|
-
store.delete(path);
|
|
16
|
-
store.set(path, { bytes: buf, mime });
|
|
17
|
-
}
|
|
18
|
-
export function revokeTempFile(store, path) {
|
|
19
|
-
store.delete(path);
|
|
20
|
-
}
|
|
21
|
-
export function revokeAllTempFiles(store) {
|
|
22
|
-
store.clear();
|
|
23
|
-
}
|
|
1
|
+
export * from '@dimina-kit/electron-runtime/main/temp-files/store';
|
|
24
2
|
//# sourceMappingURL=store.js.map
|
|
@@ -207,6 +207,12 @@ function httpGetText(url, init) {
|
|
|
207
207
|
function downloadFile(url, dest, token, onProgress) {
|
|
208
208
|
return new Promise((resolve, reject) => {
|
|
209
209
|
const headers = ghHeaders(token);
|
|
210
|
+
// Awaited before every reject so callers (and tests) that observe the
|
|
211
|
+
// rejection never race a partial file still being unlinked — fs.unlink's
|
|
212
|
+
// callback form settles asynchronously, after the promise had already
|
|
213
|
+
// rejected, which left a truncated/aborted download file on disk for a
|
|
214
|
+
// window after the caller believed cleanup was done.
|
|
215
|
+
const cleanup = () => fs.promises.unlink(dest).catch(() => { });
|
|
210
216
|
// GitHub asset downloads redirect to signed S3 URLs; keep following them.
|
|
211
217
|
const attempt = (target, redirectsLeft) => {
|
|
212
218
|
const req = https.get(target, { headers }, (res) => {
|
|
@@ -236,11 +242,24 @@ function downloadFile(url, dest, token, onProgress) {
|
|
|
236
242
|
onProgress((received / total) * 100);
|
|
237
243
|
}
|
|
238
244
|
});
|
|
245
|
+
// `.pipe()` does not forward source stream errors to the destination —
|
|
246
|
+
// an aborted/reset connection here would otherwise surface as an
|
|
247
|
+
// unhandled 'error' event on `res` (crashes the process) instead of
|
|
248
|
+
// rejecting this promise.
|
|
249
|
+
res.on('error', async (err) => { out.destroy(); await cleanup(); reject(err); });
|
|
239
250
|
res.pipe(out);
|
|
240
|
-
out.on('finish', () => {
|
|
241
|
-
|
|
251
|
+
out.on('finish', async () => {
|
|
252
|
+
out.close();
|
|
253
|
+
if (total > 0 && received !== total) {
|
|
254
|
+
await cleanup();
|
|
255
|
+
reject(new Error(`Downloaded ${received} bytes, expected ${total} — update download was truncated`));
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
resolve();
|
|
259
|
+
});
|
|
260
|
+
out.on('error', async (err) => { await cleanup(); reject(err); });
|
|
242
261
|
});
|
|
243
|
-
req.on('error', (err) => {
|
|
262
|
+
req.on('error', async (err) => { await cleanup(); reject(err); });
|
|
244
263
|
};
|
|
245
264
|
attempt(url, 5);
|
|
246
265
|
});
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { BrowserWindow } from 'electron';
|
|
2
1
|
import type { UpdateChecker, UpdateInfo } from '../../../shared/types.js';
|
|
3
2
|
import { type SenderPolicy } from '../../utils/ipc-registry.js';
|
|
4
3
|
export interface UpdateManagerOptions {
|
|
5
4
|
checker: UpdateChecker;
|
|
6
|
-
|
|
5
|
+
/** Show the update-available overlay panel, fed the discovered update's info. */
|
|
6
|
+
showUpdatePanel: (info: UpdateInfo) => void;
|
|
7
|
+
/** Forward a download-progress tick into the (already-shown) update overlay. */
|
|
8
|
+
notifyDownloadProgress: (percent: number) => void;
|
|
9
|
+
/** Hide the update overlay panel — the renderer's close (any path) forwards here. */
|
|
10
|
+
hideUpdatePanel: () => void;
|
|
7
11
|
/** Check interval in milliseconds. Default: 1 hour */
|
|
8
12
|
checkInterval?: number;
|
|
9
13
|
/** Delay before the first check after startup in ms. Default: 5000 */
|
|
@@ -20,7 +24,9 @@ export interface UpdateManagerOptions {
|
|
|
20
24
|
}
|
|
21
25
|
export declare class UpdateManager {
|
|
22
26
|
private checker;
|
|
23
|
-
private
|
|
27
|
+
private showUpdatePanel;
|
|
28
|
+
private notifyDownloadProgress;
|
|
29
|
+
private hideUpdatePanel;
|
|
24
30
|
private getCurrentVersion;
|
|
25
31
|
private latestUpdate;
|
|
26
32
|
private downloadedPath;
|
|
@@ -37,6 +43,14 @@ export declare class UpdateManager {
|
|
|
37
43
|
private timer;
|
|
38
44
|
private initialTimer;
|
|
39
45
|
private ipc;
|
|
46
|
+
/**
|
|
47
|
+
* Set by `dispose()`. Clearing the timers only stops FUTURE ticks — an
|
|
48
|
+
* in-flight `checkAndNotify()` invocation (already past its `await
|
|
49
|
+
* this.check()`) has no timer left to cancel it, and would otherwise call
|
|
50
|
+
* `showUpdatePanel` after dispose has torn down the overlay panel that
|
|
51
|
+
* owns (e.g. `views.disposeAll()` destroying its WebContentsView).
|
|
52
|
+
*/
|
|
53
|
+
private disposed;
|
|
40
54
|
constructor(opts: UpdateManagerOptions);
|
|
41
55
|
private registerIpc;
|
|
42
56
|
check(): Promise<{
|
|
@@ -48,7 +62,10 @@ export declare class UpdateManager {
|
|
|
48
62
|
filePath?: string;
|
|
49
63
|
error?: string;
|
|
50
64
|
}>;
|
|
51
|
-
install():
|
|
65
|
+
install(): Promise<{
|
|
66
|
+
success: boolean;
|
|
67
|
+
error?: string;
|
|
68
|
+
}>;
|
|
52
69
|
/**
|
|
53
70
|
* Tear down timers + IPC handlers. Returns a Promise so callers that need
|
|
54
71
|
* a settled cleanup (e.g. workbench registry shutdown, the unit-test
|