@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,9 +1,98 @@
|
|
|
1
1
|
import { app } from 'electron';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import fs from 'fs';
|
|
4
|
-
import {
|
|
4
|
+
import { NORMAL_COMPILE_INDEX, compileConfigToMode, compileConfigToModes, emptyCompileModes, isNormalCompile, normalizeCompileModes, resolveCompileConfig, } from '../../../shared/compile-modes.js';
|
|
5
5
|
import { createLogger } from '../../utils/logger.js';
|
|
6
6
|
const log = createLogger('projects');
|
|
7
|
+
function isRecord(value) {
|
|
8
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Merge project.config.json + project.private.config.json (private wins),
|
|
12
|
+
* mirroring `dimina/fe/packages/compiler/src/env.js`'s `storeInfo`.
|
|
13
|
+
*/
|
|
14
|
+
function readProjectConfig(dirPath) {
|
|
15
|
+
let merged = {};
|
|
16
|
+
for (const fileName of ['project.config.json', 'project.private.config.json']) {
|
|
17
|
+
const configPath = path.join(dirPath, fileName);
|
|
18
|
+
if (!fs.existsSync(configPath))
|
|
19
|
+
continue;
|
|
20
|
+
try {
|
|
21
|
+
merged = { ...merged, ...JSON.parse(fs.readFileSync(configPath, 'utf-8')) };
|
|
22
|
+
}
|
|
23
|
+
catch (err) {
|
|
24
|
+
log.warn(`Failed to parse ${configPath}`, err);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return merged;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The project's display name as the project itself carries it.
|
|
31
|
+
*
|
|
32
|
+
* `projectname` lives in the merged config with the private file winning, and
|
|
33
|
+
* is URL-encoded when it leaves ASCII — WeChat DevTools 36.6.0 writes
|
|
34
|
+
* `"projectname": "%E6%BD%AE%E7%8E%A9%E6%97%8F"` and its own project list only
|
|
35
|
+
* mirrors that value. ASCII names encode to themselves, so plain values that
|
|
36
|
+
* were written by hand round-trip unchanged.
|
|
37
|
+
*
|
|
38
|
+
* Returns null when the config carries no usable name, leaving the caller to
|
|
39
|
+
* fall back to the directory name.
|
|
40
|
+
*/
|
|
41
|
+
function readProjectName(dirPath) {
|
|
42
|
+
const raw = readProjectConfig(dirPath).projectname;
|
|
43
|
+
if (typeof raw !== 'string' || !raw.trim())
|
|
44
|
+
return null;
|
|
45
|
+
try {
|
|
46
|
+
return decodeURIComponent(raw);
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
// A literal '%' that isn't a valid escape — keep the author's text.
|
|
50
|
+
return raw;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Persist the display name into `project.private.config.json`, the per-
|
|
55
|
+
* developer half of the project config (WeChat DevTools writes the name there
|
|
56
|
+
* too, leaving the shared `project.config.json` alone).
|
|
57
|
+
*
|
|
58
|
+
* This is what makes the config — not our list file — the single owner of the
|
|
59
|
+
* name: `addProject` re-reads it, so re-importing a directory restores the
|
|
60
|
+
* user's rename instead of resetting it.
|
|
61
|
+
*/
|
|
62
|
+
function writeProjectName(dirPath, name) {
|
|
63
|
+
const configPath = path.join(dirPath, 'project.private.config.json');
|
|
64
|
+
let config = {};
|
|
65
|
+
if (fs.existsSync(configPath)) {
|
|
66
|
+
try {
|
|
67
|
+
config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
// Refuse rather than overwrite: this file also holds the user's IDE
|
|
71
|
+
// settings and compile conditions, which a blind rewrite would drop.
|
|
72
|
+
throw new Error(`无法重命名:${configPath} 不是合法 JSON`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
fs.writeFileSync(configPath, JSON.stringify({ ...config, projectname: encodeURIComponent(name) }, null, 2));
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Mirrors `dimina/fe/packages/compiler/src/env.js`'s `detectRuntimeType` —
|
|
79
|
+
* an explicit `compileType` wins, else a mini-game is inferred from
|
|
80
|
+
* game.json + game.js/.ts with no app.json present.
|
|
81
|
+
*/
|
|
82
|
+
function detectRuntimeType(dirPath) {
|
|
83
|
+
const compileType = readProjectConfig(dirPath).compileType;
|
|
84
|
+
if (compileType === 'game')
|
|
85
|
+
return 'minigame';
|
|
86
|
+
if (compileType === 'miniprogram')
|
|
87
|
+
return 'miniprogram';
|
|
88
|
+
const hasMiniProgramConfig = fs.existsSync(path.join(dirPath, 'app.json'));
|
|
89
|
+
const hasMiniGameConfig = fs.existsSync(path.join(dirPath, 'game.json'));
|
|
90
|
+
const hasMiniGameEntry = ['game.js', 'game.ts']
|
|
91
|
+
.some((fileName) => fs.existsSync(path.join(dirPath, fileName)));
|
|
92
|
+
if (!hasMiniProgramConfig && hasMiniGameConfig && hasMiniGameEntry)
|
|
93
|
+
return 'minigame';
|
|
94
|
+
return 'miniprogram';
|
|
95
|
+
}
|
|
7
96
|
function getProjectsFile() {
|
|
8
97
|
return path.join(app.getPath('userData'), 'dimina-projects.json');
|
|
9
98
|
}
|
|
@@ -28,6 +117,12 @@ export function validateProjectDir(dirPath) {
|
|
|
28
117
|
if (!fs.existsSync(dirPath)) {
|
|
29
118
|
return `小程序目录不存在:${dirPath}`;
|
|
30
119
|
}
|
|
120
|
+
if (detectRuntimeType(dirPath) === 'minigame') {
|
|
121
|
+
if (!fs.existsSync(path.join(dirPath, 'game.json'))) {
|
|
122
|
+
return '该目录缺少 game.json,请选择包含小游戏源码的目录';
|
|
123
|
+
}
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
31
126
|
if (!fs.existsSync(path.join(dirPath, 'app.json'))) {
|
|
32
127
|
const configPath = path.join(dirPath, 'project.config.json');
|
|
33
128
|
if (fs.existsSync(configPath)) {
|
|
@@ -51,22 +146,14 @@ export function hasProject(dirPath) {
|
|
|
51
146
|
}
|
|
52
147
|
export function addProject(dirPath) {
|
|
53
148
|
const projects = load();
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
if (cfg.projectname)
|
|
60
|
-
name = cfg.projectname;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
catch (err) {
|
|
64
|
-
log.warn('Failed to read project name from config', err);
|
|
65
|
-
}
|
|
66
|
-
const project = { name, path: dirPath, lastOpened: null };
|
|
149
|
+
// The config is the name's owner, so re-adding a directory picks up a rename
|
|
150
|
+
// the user made here rather than reverting it.
|
|
151
|
+
const name = readProjectName(dirPath) ?? path.basename(dirPath);
|
|
152
|
+
const type = detectRuntimeType(dirPath);
|
|
153
|
+
const project = { name, path: dirPath, lastOpened: null, type };
|
|
67
154
|
const idx = projects.findIndex((p) => p.path === dirPath);
|
|
68
155
|
if (idx >= 0) {
|
|
69
|
-
projects[idx] = { ...projects[idx], name };
|
|
156
|
+
projects[idx] = { ...projects[idx], name, type };
|
|
70
157
|
}
|
|
71
158
|
else {
|
|
72
159
|
projects.unshift(project);
|
|
@@ -77,6 +164,43 @@ export function addProject(dirPath) {
|
|
|
77
164
|
export function removeProject(dirPath) {
|
|
78
165
|
save(load().filter((p) => p.path !== dirPath));
|
|
79
166
|
}
|
|
167
|
+
/**
|
|
168
|
+
* Apply a user edit to the record at `dirPath`. Returns the updated record, or
|
|
169
|
+
* `null` when no record matches — callers decide whether a missing project is
|
|
170
|
+
* an error (the IPC path) or a no-op.
|
|
171
|
+
*
|
|
172
|
+
* A name change is written through to the project's own config (see
|
|
173
|
+
* `writeProjectName`); the icon lives only in our list.
|
|
174
|
+
*/
|
|
175
|
+
export function updateProject(dirPath, patch) {
|
|
176
|
+
const projects = load();
|
|
177
|
+
const idx = projects.findIndex((p) => p.path === dirPath);
|
|
178
|
+
if (idx < 0)
|
|
179
|
+
return null;
|
|
180
|
+
const next = { ...projects[idx] };
|
|
181
|
+
if (patch.name !== undefined) {
|
|
182
|
+
const name = patch.name.trim();
|
|
183
|
+
if (!name)
|
|
184
|
+
throw new Error('Project name cannot be empty');
|
|
185
|
+
next.name = name;
|
|
186
|
+
}
|
|
187
|
+
if (patch.iconUrl !== undefined) {
|
|
188
|
+
const iconUrl = patch.iconUrl.trim();
|
|
189
|
+
if (iconUrl)
|
|
190
|
+
next.iconUrl = iconUrl;
|
|
191
|
+
else
|
|
192
|
+
delete next.iconUrl;
|
|
193
|
+
}
|
|
194
|
+
// The config write comes first and is allowed to throw: a rename that only
|
|
195
|
+
// reached our list would look applied until the next re-import silently
|
|
196
|
+
// reverted it. The icon has no counterpart in the project config — it is
|
|
197
|
+
// ours alone — so it never touches the project directory.
|
|
198
|
+
if (next.name !== projects[idx].name)
|
|
199
|
+
writeProjectName(dirPath, next.name);
|
|
200
|
+
projects[idx] = next;
|
|
201
|
+
save(projects);
|
|
202
|
+
return next;
|
|
203
|
+
}
|
|
80
204
|
export function updateLastOpened(dirPath) {
|
|
81
205
|
const projects = load();
|
|
82
206
|
const idx = projects.findIndex((p) => p.path === dirPath);
|
|
@@ -85,16 +209,138 @@ export function updateLastOpened(dirPath) {
|
|
|
85
209
|
save(projects);
|
|
86
210
|
}
|
|
87
211
|
}
|
|
88
|
-
|
|
212
|
+
/**
|
|
213
|
+
* Read a project's compile modes from `project.config.json`'s
|
|
214
|
+
* `condition.miniprogram` — WeChat DevTools' own location and shape, so a
|
|
215
|
+
* project checked into git carries its modes to every machine, and the same
|
|
216
|
+
* directory opened in that tool shows the same list.
|
|
217
|
+
*
|
|
218
|
+
* Projects imported before compile modes existed fall back to migrating the
|
|
219
|
+
* legacy single config out of the project list file.
|
|
220
|
+
*/
|
|
221
|
+
export function getCompileModes(dirPath) {
|
|
222
|
+
if (!dirPath)
|
|
223
|
+
return emptyCompileModes();
|
|
224
|
+
const condition = readProjectConfig(dirPath).condition;
|
|
225
|
+
const stored = isRecord(condition) && condition.miniprogram !== undefined
|
|
226
|
+
? normalizeCompileModes(condition.miniprogram)
|
|
227
|
+
: null;
|
|
228
|
+
// A stored list with entries is the answer — it is the user's own edit. An
|
|
229
|
+
// EMPTY block is not evidence that the project has no modes: WeChat DevTools
|
|
230
|
+
// writes `"miniprogram": {"list": []}` into any project it opens, and taking
|
|
231
|
+
// that as "no modes" would drop the start page a user configured before
|
|
232
|
+
// compile modes existed.
|
|
233
|
+
if (stored && stored.list.length > 0)
|
|
234
|
+
return stored;
|
|
235
|
+
return migrateLegacyCompileConfig(dirPath) ?? stored ?? emptyCompileModes();
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Which config file owns `condition` for this project — the one a save has to
|
|
239
|
+
* land in to be read back.
|
|
240
|
+
*
|
|
241
|
+
* `readProjectConfig` merges the private file over the public one key by key,
|
|
242
|
+
* so a private file carrying any `condition` at all (even one that only holds
|
|
243
|
+
* a mini-game block, with no `miniprogram` in it) replaces the whole merged
|
|
244
|
+
* `condition`. Writing modes to the public file in that case reports success
|
|
245
|
+
* and then reads back as if nothing had been saved.
|
|
246
|
+
*
|
|
247
|
+
* With no private `condition`, modes stay in the shared public file, where the
|
|
248
|
+
* team gets them from git.
|
|
249
|
+
*/
|
|
250
|
+
function compileModesConfigPath(dirPath) {
|
|
251
|
+
const privatePath = path.join(dirPath, 'project.private.config.json');
|
|
252
|
+
if (fs.existsSync(privatePath)) {
|
|
253
|
+
try {
|
|
254
|
+
const privateConfig = JSON.parse(fs.readFileSync(privatePath, 'utf-8'));
|
|
255
|
+
if (isRecord(privateConfig) && privateConfig.condition !== undefined)
|
|
256
|
+
return privatePath;
|
|
257
|
+
}
|
|
258
|
+
catch {
|
|
259
|
+
// Unparseable — readProjectConfig skips this file too, so the public one
|
|
260
|
+
// is what a read actually sees.
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
return path.join(dirPath, 'project.config.json');
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Persist compile modes, merged so the rest of the target file survives —
|
|
267
|
+
* including the rest of `condition`, which for a mini-game project holds its
|
|
268
|
+
* own `condition.game` block.
|
|
269
|
+
*/
|
|
270
|
+
export function saveCompileModes(dirPath, modes) {
|
|
271
|
+
if (!dirPath)
|
|
272
|
+
return;
|
|
273
|
+
const configPath = compileModesConfigPath(dirPath);
|
|
274
|
+
let config = {};
|
|
275
|
+
if (fs.existsSync(configPath)) {
|
|
276
|
+
try {
|
|
277
|
+
config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
278
|
+
}
|
|
279
|
+
catch {
|
|
280
|
+
// Refuse rather than overwrite: this file also holds the project's
|
|
281
|
+
// build settings, which a blind rewrite would drop.
|
|
282
|
+
throw new Error(`无法保存编译模式:${configPath} 不是合法 JSON`);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
const condition = isRecord(config.condition) ? config.condition : {};
|
|
286
|
+
fs.writeFileSync(configPath, JSON.stringify({ ...config, condition: { ...condition, miniprogram: modes } }, null, 2));
|
|
287
|
+
// The user has now said what this project's modes are, so the pre-compile-
|
|
288
|
+
// modes single config is spent. Retiring it here is what makes deleting a
|
|
289
|
+
// migrated mode stick: an empty stored list would otherwise be read as
|
|
290
|
+
// "nothing stored yet" and migrate the old config back.
|
|
291
|
+
clearLegacyCompileConfig(dirPath);
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Projects imported before compile modes existed stored one unnamed compile
|
|
295
|
+
* config in the project list file. Surface it as a selected mode rather than
|
|
296
|
+
* silently dropping the user's start page — but only when it asks for
|
|
297
|
+
* something 普通编译 can't already do, so the common case stays an empty list.
|
|
298
|
+
* Returns null when there is nothing to migrate.
|
|
299
|
+
*
|
|
300
|
+
* Read-only: opening a project must not rewrite the user's git-tracked
|
|
301
|
+
* project.config.json. The legacy record is retired instead by the first
|
|
302
|
+
* explicit save (see `saveCompileModes`), which is also what keeps a deleted
|
|
303
|
+
* mode deleted — without that, an empty stored list would migrate again and
|
|
304
|
+
* put the mode back.
|
|
305
|
+
*/
|
|
306
|
+
function migrateLegacyCompileConfig(dirPath) {
|
|
307
|
+
const legacy = load().find((p) => p.path === dirPath)?.compileConfig;
|
|
308
|
+
if (!legacy)
|
|
309
|
+
return null;
|
|
310
|
+
const modes = compileConfigToModes(legacy, getProjectPages(dirPath).entryPagePath);
|
|
311
|
+
return modes.list.length > 0 ? modes : null;
|
|
312
|
+
}
|
|
313
|
+
/** Remove the pre-compile-modes single config from a project record. */
|
|
314
|
+
function clearLegacyCompileConfig(dirPath) {
|
|
89
315
|
const projects = load();
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
316
|
+
const idx = projects.findIndex((p) => p.path === dirPath);
|
|
317
|
+
if (idx < 0 || projects[idx].compileConfig === undefined)
|
|
318
|
+
return;
|
|
319
|
+
const { compileConfig: _legacy, ...rest } = projects[idx];
|
|
320
|
+
projects[idx] = rest;
|
|
321
|
+
save(projects);
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* The launch parameters the selected mode resolves to. 普通编译 resolves to
|
|
325
|
+
* an empty start page; it is filled in here with the project's real entry
|
|
326
|
+
* page (mirrors getProjectPages: 'game' for mini-games, app.json's
|
|
327
|
+
* entryPagePath for mini-programs) rather than a mini-program-only literal —
|
|
328
|
+
* the simulator URL builders' own 'pages/index/index' fallback only fires
|
|
329
|
+
* when this is still empty (unreadable/malformed manifest).
|
|
330
|
+
*/
|
|
331
|
+
export function getCompileConfig(dirPath) {
|
|
332
|
+
const config = resolveCompileConfig(getCompileModes(dirPath));
|
|
333
|
+
if (config.startPage)
|
|
334
|
+
return config;
|
|
335
|
+
return { ...config, startPage: getProjectPages(dirPath).entryPagePath };
|
|
96
336
|
}
|
|
97
337
|
export function getProjectPages(dirPath) {
|
|
338
|
+
if (detectRuntimeType(dirPath) === 'minigame') {
|
|
339
|
+
// Mini-games have no page router — the compiler always emits a single
|
|
340
|
+
// synthetic 'game' entry (dimina/fe/packages/compiler/src/env.js
|
|
341
|
+
// storeAppConfig), mirrored here rather than reading a nonexistent app.json.
|
|
342
|
+
return { pages: ['game'], entryPagePath: 'game' };
|
|
343
|
+
}
|
|
98
344
|
const appJsonPath = path.join(dirPath, 'app.json');
|
|
99
345
|
try {
|
|
100
346
|
const appJson = JSON.parse(fs.readFileSync(appJsonPath, 'utf-8'));
|
|
@@ -108,13 +354,25 @@ export function getProjectPages(dirPath) {
|
|
|
108
354
|
return { pages: [], entryPagePath: '' };
|
|
109
355
|
}
|
|
110
356
|
}
|
|
357
|
+
/**
|
|
358
|
+
* @deprecated Compile modes are the stored form — call `saveCompileModes`.
|
|
359
|
+
* Kept working for embedding hosts still on the single-config setter: the
|
|
360
|
+
* config lands on the selected mode, or becomes a new selected mode when
|
|
361
|
+
* 普通编译 is selected and the config asks for more than it can express.
|
|
362
|
+
*/
|
|
111
363
|
export function saveCompileConfig(dirPath, config) {
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
364
|
+
const modes = getCompileModes(dirPath);
|
|
365
|
+
if (modes.current === NORMAL_COMPILE_INDEX) {
|
|
366
|
+
if (isNormalCompile(config, getProjectPages(dirPath).entryPagePath))
|
|
367
|
+
return;
|
|
368
|
+
saveCompileModes(dirPath, {
|
|
369
|
+
current: modes.list.length,
|
|
370
|
+
list: [...modes.list, compileConfigToMode(config, '')],
|
|
371
|
+
});
|
|
372
|
+
return;
|
|
117
373
|
}
|
|
374
|
+
const list = modes.list.map((mode, i) => (i === modes.current ? { ...mode, ...compileConfigToMode(config, mode.name) } : mode));
|
|
375
|
+
saveCompileModes(dirPath, { ...modes, list });
|
|
118
376
|
}
|
|
119
377
|
/** Read a subset of `project.config.json` exposed to the settings panel. */
|
|
120
378
|
export function getProjectSettings(projectPath) {
|
|
@@ -132,30 +390,6 @@ export function getProjectSettings(projectPath) {
|
|
|
132
390
|
return { uploadWithSourceMap: false };
|
|
133
391
|
}
|
|
134
392
|
}
|
|
135
|
-
export function getLaunchConfigs(dirPath) {
|
|
136
|
-
const project = load().find((p) => p.path === dirPath);
|
|
137
|
-
return project?.launchConfigs ?? [];
|
|
138
|
-
}
|
|
139
|
-
export function saveLaunchConfigs(dirPath, configs) {
|
|
140
|
-
const projects = load();
|
|
141
|
-
const idx = projects.findIndex((p) => p.path === dirPath);
|
|
142
|
-
if (idx >= 0) {
|
|
143
|
-
projects[idx] = { ...projects[idx], launchConfigs: configs };
|
|
144
|
-
save(projects);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
export function getActiveLaunchConfigId(dirPath) {
|
|
148
|
-
const project = load().find((p) => p.path === dirPath);
|
|
149
|
-
return project?.activeLaunchConfigId ?? null;
|
|
150
|
-
}
|
|
151
|
-
export function saveActiveLaunchConfigId(dirPath, id) {
|
|
152
|
-
const projects = load();
|
|
153
|
-
const idx = projects.findIndex((p) => p.path === dirPath);
|
|
154
|
-
if (idx >= 0) {
|
|
155
|
-
projects[idx] = { ...projects[idx], activeLaunchConfigId: id };
|
|
156
|
-
save(projects);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
393
|
/** Persist a partial patch into the `setting` block of `project.config.json`. */
|
|
160
394
|
export function updateProjectSettings(projectPath, patch) {
|
|
161
395
|
if (!projectPath)
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* `WorkbenchAppConfig` to fully take over the project source-of-truth, the
|
|
5
5
|
* template catalog, and the "新建项目" dialog.
|
|
6
6
|
*/
|
|
7
|
-
import type { CompileConfig,
|
|
8
|
-
import type { Project } from './project-repository.js';
|
|
9
|
-
export type { Project };
|
|
7
|
+
import type { CompileConfig, CompileModes } from '../../../shared/types.js';
|
|
8
|
+
import type { Project, ProjectPatch } from './project-repository.js';
|
|
9
|
+
export type { Project, ProjectPatch };
|
|
10
10
|
export type { ProjectTemplate, CreateProjectInput } from '../../../shared/types.js';
|
|
11
11
|
/**
|
|
12
12
|
* Default compile config returned by WorkspaceService when the injected
|
|
@@ -40,6 +40,17 @@ export interface ProjectsProvider {
|
|
|
40
40
|
validateProjectDir?(dirPath: string): string | null | Promise<string | null>;
|
|
41
41
|
addProject(dirPath: string): Project | Promise<Project>;
|
|
42
42
|
removeProject(dirPath: string): void | Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Apply a user edit (name / icon) to an existing record. `dirPath` is the
|
|
45
|
+
* record's identity, so it is never part of the patch — see `ProjectPatch`.
|
|
46
|
+
*
|
|
47
|
+
* Default when omitted: throws, and the renderer shows that error in the
|
|
48
|
+
* edit dialog. A silent no-op would report success (dialog closes, list
|
|
49
|
+
* reloads) while discarding the user's input, since the caller has no way
|
|
50
|
+
* to tell "saved" apart from "provider doesn't support this". Implement
|
|
51
|
+
* this if your UI exposes the project-edit dialog.
|
|
52
|
+
*/
|
|
53
|
+
updateProject?(dirPath: string, patch: ProjectPatch): Project | Promise<Project>;
|
|
43
54
|
/**
|
|
44
55
|
* Record that the user just opened a project (drives "recent" ordering).
|
|
45
56
|
*
|
|
@@ -48,20 +59,43 @@ export interface ProjectsProvider {
|
|
|
48
59
|
*/
|
|
49
60
|
updateLastOpened?(dirPath: string): void | Promise<void>;
|
|
50
61
|
/**
|
|
51
|
-
* Read the per-project compile config
|
|
62
|
+
* Read the per-project compile config — the launch parameters the
|
|
63
|
+
* SELECTED compile mode resolves to.
|
|
52
64
|
*
|
|
53
|
-
* Default when omitted:
|
|
54
|
-
* (`{ startPage: '', scene: 1001, queryParams: [] }`)
|
|
65
|
+
* Default when omitted: derived from `getCompileModes`, or
|
|
66
|
+
* `DEFAULT_COMPILE_CONFIG` (`{ startPage: '', scene: 1001, queryParams: [] }`)
|
|
67
|
+
* when that is absent too. Implement this only if you can resolve the
|
|
68
|
+
* project's own entry page for 普通编译 — the derived default leaves
|
|
69
|
+
* `startPage` empty and lets the renderer substitute it.
|
|
55
70
|
*/
|
|
56
71
|
getCompileConfig?(dirPath: string): CompileConfig | Promise<CompileConfig>;
|
|
57
72
|
/**
|
|
58
|
-
*
|
|
73
|
+
* @deprecated Implement `saveCompileModes` instead — the named mode list
|
|
74
|
+
* is the stored form, and this setter can only express the selected
|
|
75
|
+
* mode's parameters.
|
|
59
76
|
*
|
|
60
|
-
* Default when omitted: silently no-ops
|
|
61
|
-
* not survive a reload. Implement this if your UI exposes the compile
|
|
62
|
-
* config panel.
|
|
77
|
+
* Default when omitted: silently no-ops.
|
|
63
78
|
*/
|
|
64
79
|
saveCompileConfig?(dirPath: string, cfg: CompileConfig): void | Promise<void>;
|
|
80
|
+
/**
|
|
81
|
+
* Read the project's compile modes and which one is selected. The stored
|
|
82
|
+
* form behind the toolbar's compile-mode dropdown; `LocalProjectsProvider`
|
|
83
|
+
* keeps it in the project's own `project.config.json` under
|
|
84
|
+
* `condition.miniprogram` (WeChat DevTools' location and shape).
|
|
85
|
+
*
|
|
86
|
+
* Default when omitted: `{ current: -1, list: [] }` — the dropdown then
|
|
87
|
+
* offers 普通编译 only.
|
|
88
|
+
*/
|
|
89
|
+
getCompileModes?(dirPath: string): CompileModes | Promise<CompileModes>;
|
|
90
|
+
/**
|
|
91
|
+
* Persist the project's compile modes and selection.
|
|
92
|
+
*
|
|
93
|
+
* Default when omitted: falls back to `saveCompileConfig` with the
|
|
94
|
+
* resolved launch parameters, so a host on the older setter keeps the
|
|
95
|
+
* selection's effect but not the named list. With neither, edits do not
|
|
96
|
+
* survive a reload.
|
|
97
|
+
*/
|
|
98
|
+
saveCompileModes?(dirPath: string, modes: CompileModes): void | Promise<void>;
|
|
65
99
|
/**
|
|
66
100
|
* Persist a captured screenshot for the given project. `imageDataUrl`
|
|
67
101
|
* is a `data:image/png;base64,...` string so a remote provider can ship
|
|
@@ -81,30 +115,6 @@ export interface ProjectsProvider {
|
|
|
81
115
|
* Default when omitted: returns `null`.
|
|
82
116
|
*/
|
|
83
117
|
getThumbnail?(dirPath: string): string | null | Promise<string | null>;
|
|
84
|
-
/**
|
|
85
|
-
* Read saved launch configs for a project.
|
|
86
|
-
*
|
|
87
|
-
* Default when omitted: returns `[]`.
|
|
88
|
-
*/
|
|
89
|
-
getLaunchConfigs?(dirPath: string): LaunchConfig[] | Promise<LaunchConfig[]>;
|
|
90
|
-
/**
|
|
91
|
-
* Persist the full list of launch configs for a project.
|
|
92
|
-
*
|
|
93
|
-
* Default when omitted: silently no-ops.
|
|
94
|
-
*/
|
|
95
|
-
saveLaunchConfigs?(dirPath: string, configs: LaunchConfig[]): void | Promise<void>;
|
|
96
|
-
/**
|
|
97
|
-
* Read the active launch config id for a project.
|
|
98
|
-
*
|
|
99
|
-
* Default when omitted: returns `null` (normal mode).
|
|
100
|
-
*/
|
|
101
|
-
getActiveLaunchConfigId?(dirPath: string): string | null | Promise<string | null>;
|
|
102
|
-
/**
|
|
103
|
-
* Persist the active launch config id for a project.
|
|
104
|
-
*
|
|
105
|
-
* Default when omitted: silently no-ops.
|
|
106
|
-
*/
|
|
107
|
-
saveActiveLaunchConfigId?(dirPath: string, id: string | null): void | Promise<void>;
|
|
108
118
|
}
|
|
109
119
|
/** Built-in template policy. */
|
|
110
120
|
export type BuiltinTemplatesMode = 'all' | 'none' | readonly string[];
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
import type { WebContents } from 'electron';
|
|
17
17
|
import type { ConnectionRegistry } from '@dimina-kit/electron-deck/main';
|
|
18
18
|
import type { ElementInspection } from '../../../shared/ipc-channels.js';
|
|
19
|
-
import type { WxmlNode } from '
|
|
19
|
+
import type { WxmlNode } from '@dimina-kit/inspect';
|
|
20
|
+
import { type CdpSessionBroker } from '../cdp-session/index.js';
|
|
20
21
|
export interface RenderInspector {
|
|
21
22
|
/** Inject (once per wc) the inspector IIFE, then read the WXML tree. */
|
|
22
23
|
getWxml(wc: WebContents): Promise<WxmlNode | null>;
|
|
@@ -38,13 +39,22 @@ export interface RenderInspectorOptions {
|
|
|
38
39
|
/** Override the injected IIFE source (default: read the built bundle). Test seam. */
|
|
39
40
|
loadSource?: () => string;
|
|
40
41
|
/**
|
|
41
|
-
* Connection registry (foundation.md
|
|
42
|
+
* Connection registry (see foundation.md's teardown-paths section). When provided, the per-wc
|
|
42
43
|
* `injected` bookkeeping is torn down via the wc's connection (deterministic
|
|
43
44
|
* with the rest of that webContents's resources) instead of a bespoke
|
|
44
45
|
* `once('destroyed')`. Optional so focused unit tests can omit it (they fall
|
|
45
46
|
* back to the direct `once('destroyed')`).
|
|
46
47
|
*/
|
|
47
48
|
connections?: ConnectionRegistry;
|
|
49
|
+
/**
|
|
50
|
+
* Shared CDP session broker (see cdp-session/index.ts) that owns every
|
|
51
|
+
* render-guest debugger session's attach/detach lifecycle — safe-area,
|
|
52
|
+
* elements-forward and network-forward acquire leases from the same
|
|
53
|
+
* instance. Absent → a private broker is created (never explicitly torn
|
|
54
|
+
* down here, matching this module's existing lack of a `dispose()`; the
|
|
55
|
+
* shared instance IS disposed at the app-context level).
|
|
56
|
+
*/
|
|
57
|
+
broker?: CdpSessionBroker;
|
|
48
58
|
}
|
|
49
59
|
export declare function createRenderInspector(options?: RenderInspectorOptions): RenderInspector;
|
|
50
60
|
//# sourceMappingURL=index.d.ts.map
|