@dimina-kit/devtools 0.3.1 → 0.3.2-dev.20260522085907
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 +297 -133
- package/dist/main/api.d.ts +6 -2
- package/dist/main/api.js +5 -2
- package/dist/main/app/app.d.ts +1 -1
- package/dist/main/app/app.js +84 -36
- package/dist/main/app/bootstrap.js +2 -1
- package/dist/main/app/launch.d.ts +2 -2
- package/dist/main/app/launch.js +10 -8
- package/dist/main/index.bundle.js +1567 -477
- package/dist/main/ipc/app.d.ts +2 -1
- package/dist/main/ipc/app.js +5 -4
- package/dist/main/ipc/index.d.ts +5 -4
- package/dist/main/ipc/index.js +5 -4
- package/dist/main/ipc/panels.d.ts +2 -1
- package/dist/main/ipc/panels.js +16 -13
- package/dist/main/ipc/popover.d.ts +4 -1
- package/dist/main/ipc/popover.js +15 -5
- package/dist/main/ipc/projects.d.ts +6 -1
- package/dist/main/ipc/projects.js +127 -6
- package/dist/main/ipc/session.d.ts +4 -1
- package/dist/main/ipc/session.js +34 -6
- package/dist/main/ipc/settings.d.ts +4 -1
- package/dist/main/ipc/settings.js +51 -23
- package/dist/main/ipc/simulator-module.d.ts +8 -0
- package/dist/main/ipc/simulator-module.js +19 -0
- package/dist/main/ipc/simulator.d.ts +2 -1
- package/dist/main/ipc/simulator.js +23 -18
- package/dist/main/ipc/toolbar.d.ts +2 -1
- package/dist/main/ipc/toolbar.js +3 -2
- package/dist/main/menu/index.js +11 -0
- package/dist/main/services/automation/exec.d.ts +2 -0
- package/dist/main/services/automation/exec.js +7 -9
- package/dist/main/services/automation/handlers/app.js +37 -51
- package/dist/main/services/automation/handlers/element.js +27 -41
- package/dist/main/services/automation/index.js +88 -13
- package/dist/main/services/default-adapter.js +3 -3
- package/dist/main/services/mcp/index.d.ts +1 -0
- package/dist/main/services/mcp/index.js +1 -0
- package/dist/main/services/mcp/server.d.ts +2 -1
- package/dist/main/services/mcp/server.js +10 -0
- package/dist/main/services/mcp/status.d.ts +10 -0
- package/dist/main/services/mcp/status.js +14 -0
- package/dist/main/services/mcp/target-manager.js +2 -1
- package/dist/main/services/module.d.ts +18 -0
- package/dist/main/services/module.js +2 -0
- package/dist/main/services/notifications/renderer-notifier.d.ts +5 -3
- package/dist/main/services/notifications/renderer-notifier.js +3 -6
- package/dist/main/services/projects/builtin-templates.d.ts +3 -0
- package/dist/main/services/projects/builtin-templates.js +24 -0
- package/dist/main/services/projects/create-project-service.d.ts +7 -0
- package/dist/main/services/projects/create-project-service.js +84 -0
- package/dist/main/services/projects/index.d.ts +7 -0
- package/dist/main/services/projects/index.js +9 -0
- package/dist/main/services/projects/local-provider.d.ts +3 -0
- package/dist/main/services/projects/local-provider.js +25 -0
- package/dist/main/services/projects/project-repository.d.ts +1 -1
- package/dist/main/services/projects/project-repository.js +3 -0
- package/dist/main/services/projects/templates.d.ts +21 -0
- package/dist/main/services/projects/templates.js +39 -0
- package/dist/main/services/projects/thumbnail.d.ts +8 -0
- package/dist/main/services/projects/thumbnail.js +37 -0
- package/dist/main/services/projects/types.d.ts +118 -0
- package/dist/main/services/projects/types.js +19 -0
- package/dist/main/services/settings/index.d.ts +11 -0
- package/dist/main/services/settings/index.js +18 -2
- package/dist/main/services/simulator/custom-apis.d.ts +10 -0
- package/dist/main/services/simulator/custom-apis.js +26 -0
- package/dist/main/services/simulator-storage/index.d.ts +22 -1
- package/dist/main/services/simulator-storage/index.js +334 -97
- package/dist/main/services/update/update-manager.d.ts +16 -1
- package/dist/main/services/update/update-manager.js +18 -15
- package/dist/main/services/views/view-manager.d.ts +7 -7
- package/dist/main/services/views/view-manager.js +53 -29
- package/dist/main/services/window-service.d.ts +24 -0
- package/dist/main/services/window-service.js +26 -0
- package/dist/main/services/workbench-context.d.ts +49 -2
- package/dist/main/services/workbench-context.js +15 -2
- package/dist/main/services/workspace/workspace-service.d.ts +9 -6
- package/dist/main/services/workspace/workspace-service.js +71 -11
- package/dist/main/simulator-apis.d.ts +23 -0
- package/dist/main/simulator-apis.js +24 -0
- package/dist/main/utils/disposable.d.ts +13 -0
- package/dist/main/utils/disposable.js +60 -0
- package/dist/main/utils/ipc-registry.d.ts +39 -0
- package/dist/main/utils/ipc-registry.js +109 -0
- package/dist/main/utils/ipc-schema.d.ts +28 -0
- package/dist/main/utils/ipc-schema.js +38 -0
- package/dist/main/utils/paths.d.ts +6 -0
- package/dist/main/utils/paths.js +6 -0
- package/dist/main/utils/sender-policy.d.ts +25 -0
- package/dist/main/utils/sender-policy.js +44 -0
- package/dist/main/utils/theme.d.ts +24 -0
- package/dist/main/utils/theme.js +38 -1
- package/dist/main/windows/main-window/create.d.ts +6 -0
- package/dist/main/windows/main-window/create.js +66 -10
- package/dist/main/windows/main-window/events.d.ts +2 -1
- package/dist/main/windows/main-window/events.js +25 -2
- package/dist/main/windows/navigation-hardening.d.ts +24 -0
- package/dist/main/windows/navigation-hardening.js +55 -0
- package/dist/main/windows/settings-window/create.js +11 -1
- package/dist/preload/index.d.ts +22 -0
- package/dist/preload/index.js +19 -0
- package/dist/preload/instrumentation/app-data.d.ts +32 -2
- package/dist/preload/instrumentation/app-data.js +253 -79
- package/dist/preload/instrumentation/index.d.ts +2 -2
- package/dist/preload/instrumentation/index.js +2 -2
- package/dist/preload/instrumentation/wxml.d.ts +16 -4
- package/dist/preload/instrumentation/wxml.js +188 -178
- package/dist/preload/miniapp-snapshot/host.d.ts +12 -0
- package/dist/preload/miniapp-snapshot/host.js +117 -0
- package/dist/preload/miniapp-snapshot/types.d.ts +62 -0
- package/dist/preload/miniapp-snapshot/types.js +15 -0
- package/dist/preload/runtime/bridge.js +5 -24
- package/dist/preload/runtime/custom-apis.d.ts +6 -0
- package/dist/preload/runtime/custom-apis.js +43 -0
- package/dist/preload/runtime/host.d.ts +1 -0
- package/dist/preload/runtime/host.js +13 -0
- package/dist/preload/shared/expose.d.ts +15 -0
- package/dist/preload/shared/expose.js +33 -0
- package/dist/preload/shared/page-iframe.d.ts +3 -0
- package/dist/preload/shared/page-iframe.js +6 -0
- package/dist/preload/shared/types.d.ts +2 -0
- package/dist/preload/windows/main.cjs +47 -0
- package/dist/preload/windows/main.cjs.map +7 -0
- package/dist/preload/windows/simulator.js +501 -272
- package/dist/renderer/assets/constants-DI382mTP.js +2 -0
- package/dist/renderer/assets/index-D8VFYBh-.js +46 -0
- package/dist/renderer/assets/{input-DxfYnzX_.js → input-CoWcfa8u.js} +2 -2
- package/dist/renderer/assets/ipc-transport-Cd2xPrsa.js +9 -0
- package/dist/renderer/assets/ipc-transport-DqbRdZNO.css +1 -0
- package/dist/renderer/assets/popover-Nq5gT9DO.js +2 -0
- package/dist/renderer/assets/select-By5KH-UG.js +2 -0
- package/dist/renderer/assets/{settings-DteGraEU.js → settings-Dj_N70qR.js} +2 -2
- package/dist/renderer/assets/settings-api-Do0_Smq1.js +2 -0
- package/dist/renderer/assets/workbenchSettings-CazSLGYt.js +8 -0
- package/dist/renderer/entries/main/index.html +13 -5
- package/dist/renderer/entries/popover/index.html +8 -5
- package/dist/renderer/entries/settings/index.html +7 -5
- package/dist/renderer/entries/workbench-settings/index.html +7 -4
- package/dist/shared/ipc-channels.d.ts +46 -13
- package/dist/shared/ipc-channels.js +60 -14
- package/dist/shared/ipc-schemas.d.ts +118 -0
- package/dist/shared/ipc-schemas.js +133 -0
- package/dist/shared/simulator-route.d.ts +72 -0
- package/dist/shared/simulator-route.js +169 -0
- package/dist/shared/types.d.ts +82 -8
- package/dist/simulator/assets/simulator-DJCozrU5.js +9 -0
- package/dist/simulator/simulator.html +6 -43
- package/package.json +18 -29
- package/templates/blank/app.js +6 -0
- package/templates/blank/app.json +11 -0
- package/templates/blank/app.wxss +5 -0
- package/templates/blank/pages/index/index.js +6 -0
- package/templates/blank/pages/index/index.json +3 -0
- package/templates/blank/pages/index/index.wxml +3 -0
- package/templates/blank/pages/index/index.wxss +11 -0
- package/templates/blank/project.config.json +13 -0
- package/templates/blank/sitemap.json +9 -0
- package/templates/taro-todo/app.js +1 -0
- package/templates/taro-todo/app.json +1 -0
- package/templates/taro-todo/app.wxss +1 -0
- package/templates/taro-todo/base.wxml +851 -0
- package/templates/taro-todo/common.js +1 -0
- package/templates/taro-todo/comp.js +1 -0
- package/templates/taro-todo/comp.json +1 -0
- package/templates/taro-todo/comp.wxml +2 -0
- package/templates/taro-todo/custom-wrapper.js +1 -0
- package/templates/taro-todo/custom-wrapper.json +1 -0
- package/templates/taro-todo/custom-wrapper.wxml +4 -0
- package/templates/taro-todo/pages/index/index.js +2 -0
- package/templates/taro-todo/pages/index/index.json +1 -0
- package/templates/taro-todo/pages/index/index.wxml +2 -0
- package/templates/taro-todo/pages/index/index.wxss +1 -0
- package/templates/taro-todo/project.config.json +44 -0
- package/templates/taro-todo/runtime.js +1 -0
- package/templates/taro-todo/taro.js +2 -0
- package/templates/taro-todo/utils.wxs +39 -0
- package/templates/taro-todo/vendors.js +2 -0
- package/dist/preload/instrumentation/disposable.d.ts +0 -11
- package/dist/preload/instrumentation/disposable.js +0 -15
- package/dist/preload/windows/main.d.ts +0 -6
- package/dist/preload/windows/main.js +0 -6
- package/dist/renderer/assets/index-D1p6crtf.js +0 -46
- package/dist/renderer/assets/ipc-transport-ClIvDcYY.js +0 -9
- package/dist/renderer/assets/ipc-transport-EiWxu_hG.css +0 -1
- package/dist/renderer/assets/popover-CtXcBJtM.js +0 -2
- package/dist/renderer/assets/select-DMfp49f1.js +0 -2
- package/dist/renderer/assets/settings-api-CY84UMpN.js +0 -2
- package/dist/renderer/assets/workbenchSettings-DjELLnSJ.js +0 -8
- package/dist/simulator/assets/simulator-C1eHXnuq.js +0 -9
package/dist/main/api.js
CHANGED
|
@@ -7,6 +7,8 @@ export { suppressEpipe, setupCdpPort } from './app/bootstrap.js';
|
|
|
7
7
|
export { createWorkbenchContext, hasBuiltinPanel, getDefaultTab } from './services/workbench-context.js';
|
|
8
8
|
export { createMainWindow } from './windows/main-window/index.js';
|
|
9
9
|
export { createViewManager } from './services/views/view-manager.js';
|
|
10
|
+
// ── Simulator extension surface ──────────────────────────────────────────
|
|
11
|
+
export { registerSimulatorApi } from './simulator-apis.js';
|
|
10
12
|
// ── IPC module registration ──────────────────────────────────────────────
|
|
11
13
|
export { registerAppIpc } from './ipc/app.js';
|
|
12
14
|
export { registerSimulatorIpc } from './ipc/simulator.js';
|
|
@@ -17,8 +19,9 @@ export { registerProjectsIpc } from './ipc/projects.js';
|
|
|
17
19
|
export { registerSessionIpc } from './ipc/session.js';
|
|
18
20
|
export { registerToolbarIpc } from './ipc/toolbar.js';
|
|
19
21
|
// ── Paths ────────────────────────────────────────────────────────────────
|
|
20
|
-
export { rendererDir, defaultPreloadPath, getRendererDir, getPreloadDir, getRendererHtml } from './utils/paths.js';
|
|
21
|
-
|
|
22
|
+
export { rendererDir, defaultPreloadPath, simulatorDir, getRendererDir, getPreloadDir, getRendererHtml, } from './utils/paths.js';
|
|
23
|
+
// ── Layout ───────────────────────────────────────────────────────────────
|
|
24
|
+
export { setHeaderHeight } from './services/layout/index.js';
|
|
22
25
|
// ── Update checker ───────────────────────────────────────────────────────
|
|
23
26
|
export { UpdateManager, createGitHubReleaseChecker } from './services/update/index.js';
|
|
24
27
|
//# sourceMappingURL=api.js.map
|
package/dist/main/app/app.d.ts
CHANGED
|
@@ -12,6 +12,6 @@ export interface WorkbenchAppInstance {
|
|
|
12
12
|
}
|
|
13
13
|
export declare function createWorkbenchApp(config?: WorkbenchAppConfig): {
|
|
14
14
|
setup: () => Promise<WorkbenchAppInstance>;
|
|
15
|
-
start: () => void
|
|
15
|
+
start: () => Promise<void>;
|
|
16
16
|
};
|
|
17
17
|
//# sourceMappingURL=app.d.ts.map
|
package/dist/main/app/app.js
CHANGED
|
@@ -3,16 +3,18 @@ import { app, BrowserWindow, nativeImage } from 'electron';
|
|
|
3
3
|
import fs from 'fs';
|
|
4
4
|
import path from 'path';
|
|
5
5
|
import { rendererDir as defaultRendererDir, defaultPreloadPath } from '../utils/paths.js';
|
|
6
|
+
import { installThemeBackgroundSync } from '../utils/theme.js';
|
|
6
7
|
import { registerAppLifecycle } from './lifecycle.js';
|
|
7
8
|
import { createMainWindow, wireMainWindowEvents } from '../windows/main-window/index.js';
|
|
8
9
|
import { createWorkbenchContext } from '../services/workbench-context.js';
|
|
9
10
|
import { loadWorkbenchSettings, applyTheme } from '../services/settings/index.js';
|
|
10
11
|
import { installAppMenu } from '../menu/index.js';
|
|
11
|
-
import { registerAppIpc,
|
|
12
|
+
import { registerAppIpc, popoverModule, projectsModule, sessionModule, settingsModule, simulatorModule, } from '../ipc/index.js';
|
|
12
13
|
import { startAutomationServer } from '../services/automation/index.js';
|
|
13
14
|
import { startMcpServer } from '../services/mcp/index.js';
|
|
14
15
|
import { setupSimulatorStorage } from '../services/simulator-storage/index.js';
|
|
15
16
|
import { UpdateManager } from '../services/update/index.js';
|
|
17
|
+
import { toDisposable } from '../utils/disposable.js';
|
|
16
18
|
const DEFAULT_MODULES = {
|
|
17
19
|
projects: true,
|
|
18
20
|
session: true,
|
|
@@ -20,16 +22,12 @@ const DEFAULT_MODULES = {
|
|
|
20
22
|
popover: true,
|
|
21
23
|
settings: true,
|
|
22
24
|
};
|
|
23
|
-
const
|
|
24
|
-
projects:
|
|
25
|
-
session:
|
|
26
|
-
simulator:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
registerToolbarIpc(ctx);
|
|
30
|
-
},
|
|
31
|
-
popover: registerPopoverIpc,
|
|
32
|
-
settings: registerSettingsIpc,
|
|
25
|
+
const BUILTIN_MODULES = {
|
|
26
|
+
projects: projectsModule,
|
|
27
|
+
session: sessionModule,
|
|
28
|
+
simulator: simulatorModule,
|
|
29
|
+
popover: popoverModule,
|
|
30
|
+
settings: settingsModule,
|
|
33
31
|
};
|
|
34
32
|
/** Parse --auto, --auto-port, --project from process.argv. */
|
|
35
33
|
function parseAutoArgs() {
|
|
@@ -58,9 +56,11 @@ function resolveModules(config) {
|
|
|
58
56
|
...config.modules,
|
|
59
57
|
};
|
|
60
58
|
}
|
|
61
|
-
async function disposeContext(ctx
|
|
62
|
-
updateManager?.dispose();
|
|
59
|
+
async function disposeContext(ctx) {
|
|
63
60
|
await ctx.workspace.closeProject();
|
|
61
|
+
await ctx.registry.dispose().catch((err) => {
|
|
62
|
+
console.warn('[workbench] dispose registry encountered errors:', err);
|
|
63
|
+
});
|
|
64
64
|
}
|
|
65
65
|
function createConfiguredMainWindow(config, rendererDir) {
|
|
66
66
|
const mainWindow = createMainWindow({
|
|
@@ -70,6 +70,11 @@ function createConfiguredMainWindow(config, rendererDir) {
|
|
|
70
70
|
height: config.window?.height,
|
|
71
71
|
minWidth: config.window?.minWidth,
|
|
72
72
|
minHeight: config.window?.minHeight,
|
|
73
|
+
// P1: pass the same preload path the workbench context stores on
|
|
74
|
+
// ctx.preloadPath so hosts that ship a custom simulator preload are the
|
|
75
|
+
// ones registered on the persist:simulator session — otherwise the
|
|
76
|
+
// backstop wouldn't be the host's script.
|
|
77
|
+
simulatorPreloadPath: config.preloadPath ?? defaultPreloadPath,
|
|
73
78
|
});
|
|
74
79
|
// Set window/taskbar icon if provided (Linux/Windows; macOS uses app bundle icon)
|
|
75
80
|
if (config.icon) {
|
|
@@ -90,13 +95,21 @@ function createContext(config, mainWindow, rendererDir) {
|
|
|
90
95
|
apiNamespaces: config.apiNamespaces,
|
|
91
96
|
brandingProvider: config.brandingProvider,
|
|
92
97
|
toolbarActions: config.toolbarActions,
|
|
98
|
+
// The host-supplied ProjectsProvider / template types in `shared/types`
|
|
99
|
+
// are structurally compatible with the main-process equivalents —
|
|
100
|
+
// these casts are safe; we re-narrow at the workspace-service /
|
|
101
|
+
// create-project-service boundary.
|
|
102
|
+
projectsProvider: config.projectsProvider,
|
|
103
|
+
projectTemplates: config.projectTemplates,
|
|
104
|
+
builtinTemplates: config.builtinTemplates,
|
|
105
|
+
customCreateProjectDialog: config.customCreateProjectDialog,
|
|
93
106
|
});
|
|
94
107
|
}
|
|
95
108
|
function registerBuiltinModules(config, context) {
|
|
96
109
|
const modules = resolveModules(config);
|
|
97
110
|
Object.keys(modules).forEach((moduleId) => {
|
|
98
111
|
if (modules[moduleId])
|
|
99
|
-
|
|
112
|
+
context.registry.add(BUILTIN_MODULES[moduleId].setup(context));
|
|
100
113
|
});
|
|
101
114
|
}
|
|
102
115
|
function installMenu(config, mainWindow, context) {
|
|
@@ -114,6 +127,7 @@ async function setupAutomation(instance) {
|
|
|
114
127
|
if (autoArgs.auto) {
|
|
115
128
|
const server = await startAutomationServer(instance.context, autoArgs.autoPort);
|
|
116
129
|
instance.automationServer = server;
|
|
130
|
+
instance.context.registry.add(() => server.close());
|
|
117
131
|
// Stable, parseable line for e2e harnesses that scrape stdout.
|
|
118
132
|
console.log(`[automation] listening on ws://127.0.0.1:${server.port}`);
|
|
119
133
|
}
|
|
@@ -121,42 +135,56 @@ async function setupAutomation(instance) {
|
|
|
121
135
|
function setupMcp() {
|
|
122
136
|
const settings = loadWorkbenchSettings();
|
|
123
137
|
if (!settings.mcp.enabled)
|
|
124
|
-
return;
|
|
138
|
+
return null;
|
|
125
139
|
const cdpPortSwitch = app.commandLine.getSwitchValue('remote-debugging-port');
|
|
126
140
|
const cdpPort = cdpPortSwitch ? parseInt(cdpPortSwitch, 10) : settings.cdp.port;
|
|
127
|
-
startMcpServer(cdpPort, settings.mcp.port);
|
|
141
|
+
return startMcpServer(cdpPort, settings.mcp.port);
|
|
128
142
|
}
|
|
129
143
|
function wireAppWindowEvents(config, instance) {
|
|
130
144
|
const { mainWindow, context } = instance;
|
|
131
|
-
wireMainWindowEvents(mainWindow, {
|
|
145
|
+
return wireMainWindowEvents(mainWindow, {
|
|
132
146
|
context,
|
|
133
147
|
onResize: () => context.views.repositionAll(),
|
|
134
148
|
onClose: async (e) => {
|
|
135
149
|
if (!context.workspace.hasActiveSession())
|
|
136
150
|
return;
|
|
151
|
+
// Close button while a project session is open: stay in the workbench
|
|
152
|
+
// and surface the project list. Tear down only the session — do NOT
|
|
153
|
+
// dispose `context.registry`, which owns every IPC handler (projects,
|
|
154
|
+
// dialog, settings…). Disposing it would leave the renderer alive but
|
|
155
|
+
// unable to invoke anything, so subsequent clicks on Import/etc. would
|
|
156
|
+
// raise `No handler registered for ...`.
|
|
137
157
|
e.preventDefault();
|
|
138
158
|
if (config.onBeforeClose) {
|
|
139
159
|
await config.onBeforeClose(instance);
|
|
140
160
|
}
|
|
141
|
-
await
|
|
161
|
+
await context.workspace.closeProject();
|
|
142
162
|
context.notify.windowNavigateBack();
|
|
143
163
|
},
|
|
144
164
|
});
|
|
145
165
|
}
|
|
146
166
|
function enableDevRendererAutoReload(rendererDir) {
|
|
147
167
|
// Auto-reload renderer windows when dist files change during development
|
|
148
|
-
if (
|
|
149
|
-
|
|
150
|
-
fs.watch(rendererDir, { recursive: true }, () => {
|
|
151
|
-
if (reloadTimer)
|
|
152
|
-
clearTimeout(reloadTimer);
|
|
153
|
-
reloadTimer = setTimeout(() => {
|
|
154
|
-
for (const win of BrowserWindow.getAllWindows()) {
|
|
155
|
-
win.webContents.reload();
|
|
156
|
-
}
|
|
157
|
-
}, 300);
|
|
158
|
-
});
|
|
168
|
+
if (app.isPackaged) {
|
|
169
|
+
return toDisposable(() => { });
|
|
159
170
|
}
|
|
171
|
+
let reloadTimer = null;
|
|
172
|
+
const watcher = fs.watch(rendererDir, { recursive: true }, () => {
|
|
173
|
+
if (reloadTimer)
|
|
174
|
+
clearTimeout(reloadTimer);
|
|
175
|
+
reloadTimer = setTimeout(() => {
|
|
176
|
+
for (const win of BrowserWindow.getAllWindows()) {
|
|
177
|
+
win.webContents.reload();
|
|
178
|
+
}
|
|
179
|
+
}, 300);
|
|
180
|
+
});
|
|
181
|
+
return toDisposable(() => {
|
|
182
|
+
if (reloadTimer) {
|
|
183
|
+
clearTimeout(reloadTimer);
|
|
184
|
+
reloadTimer = null;
|
|
185
|
+
}
|
|
186
|
+
watcher.close();
|
|
187
|
+
});
|
|
160
188
|
}
|
|
161
189
|
export function createWorkbenchApp(config = {}) {
|
|
162
190
|
let setupPromise = null;
|
|
@@ -170,13 +198,17 @@ export function createWorkbenchApp(config = {}) {
|
|
|
170
198
|
const rendererDir = config.rendererDir ?? defaultRendererDir;
|
|
171
199
|
const mainWindow = createConfiguredMainWindow(config, rendererDir);
|
|
172
200
|
const context = createContext(config, mainWindow, rendererDir);
|
|
173
|
-
registerAppIpc(context);
|
|
201
|
+
context.registry.add(registerAppIpc(context));
|
|
202
|
+
// One process-wide listener that re-syncs every window's native
|
|
203
|
+
// backgroundColor on theme change — windows otherwise keep the stale
|
|
204
|
+
// creation-time color (see installThemeBackgroundSync).
|
|
205
|
+
context.registry.add(installThemeBackgroundSync());
|
|
174
206
|
registerBuiltinModules(config, context);
|
|
175
207
|
installMenu(config, mainWindow, context);
|
|
176
208
|
const instance = {
|
|
177
209
|
mainWindow,
|
|
178
210
|
context,
|
|
179
|
-
dispose: () => disposeContext(context
|
|
211
|
+
dispose: () => disposeContext(context),
|
|
180
212
|
};
|
|
181
213
|
if (config.onSetup) {
|
|
182
214
|
await config.onSetup(instance);
|
|
@@ -189,22 +221,38 @@ export function createWorkbenchApp(config = {}) {
|
|
|
189
221
|
initialDelay: config.updateOptions?.initialDelay,
|
|
190
222
|
getCurrentVersion: config.updateOptions?.getCurrentVersion,
|
|
191
223
|
});
|
|
224
|
+
context.registry.add(() => instance.updateManager.dispose());
|
|
192
225
|
}
|
|
193
226
|
await setupAutomation(instance);
|
|
194
|
-
setupMcp();
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
227
|
+
const mcp = setupMcp();
|
|
228
|
+
if (mcp)
|
|
229
|
+
context.registry.add(mcp);
|
|
230
|
+
context.registry.add(setupSimulatorStorage(mainWindow.webContents, {
|
|
231
|
+
senderPolicy: context.senderPolicy,
|
|
232
|
+
// Per-project filter for the simulator-storage panel: the simulator
|
|
233
|
+
// uses a fixed `persist:simulator` partition + a fixed simulator.html
|
|
234
|
+
// origin, so localStorage is shared across every project that has
|
|
235
|
+
// ever opened. The dimina runtime isolates writes with `${appId}_`
|
|
236
|
+
// prefixes; this callback lets the storage panel filter the CDP
|
|
237
|
+
// snapshot/event stream to the active appId.
|
|
238
|
+
getActiveAppId: () => {
|
|
239
|
+
const session = context.workspace.getSession();
|
|
240
|
+
const appInfo = session?.appInfo;
|
|
241
|
+
return appInfo?.appId ?? null;
|
|
242
|
+
},
|
|
243
|
+
}));
|
|
244
|
+
context.registry.add(wireAppWindowEvents(config, instance));
|
|
245
|
+
context.registry.add(enableDevRendererAutoReload(rendererDir));
|
|
198
246
|
return instance;
|
|
199
247
|
});
|
|
200
248
|
return setupPromise;
|
|
201
249
|
}
|
|
202
250
|
function start() {
|
|
203
|
-
void setup();
|
|
204
251
|
if (!appEventsRegistered) {
|
|
205
252
|
appEventsRegistered = true;
|
|
206
253
|
registerAppLifecycle();
|
|
207
254
|
}
|
|
255
|
+
return setup().then(() => undefined);
|
|
208
256
|
}
|
|
209
257
|
return {
|
|
210
258
|
setup,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { app } from 'electron';
|
|
2
|
+
import { DEFAULT_CDP_PORT } from '../../shared/constants.js';
|
|
2
3
|
import { loadWorkbenchSettings } from '../services/settings/index.js';
|
|
3
4
|
/**
|
|
4
5
|
* Suppress EPIPE errors on stdout/stderr.
|
|
@@ -35,7 +36,7 @@ export function setupCdpPort() {
|
|
|
35
36
|
app.commandLine.appendSwitch('remote-debugging-port', String(settings.cdp.port));
|
|
36
37
|
}
|
|
37
38
|
else if (!app.isPackaged) {
|
|
38
|
-
app.commandLine.appendSwitch('remote-debugging-port', String(settings.cdp.port ||
|
|
39
|
+
app.commandLine.appendSwitch('remote-debugging-port', String(settings.cdp.port || DEFAULT_CDP_PORT));
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
42
|
//# sourceMappingURL=bootstrap.js.map
|
|
@@ -4,7 +4,7 @@ import type { WorkbenchContext } from '../services/workbench-context.js';
|
|
|
4
4
|
* Convenience launcher for the default full-featured app.
|
|
5
5
|
* Use createWorkbenchApp() when you want to customize modules or window setup.
|
|
6
6
|
*/
|
|
7
|
-
export declare function launch(config?: WorkbenchConfig): void
|
|
7
|
+
export declare function launch(config?: WorkbenchConfig): Promise<void>;
|
|
8
8
|
export declare function buildDefaultMenu(ctx: WorkbenchContext): void;
|
|
9
|
-
export declare function openSettingsWindow(ctx: Pick<WorkbenchContext, '
|
|
9
|
+
export declare function openSettingsWindow(ctx: Pick<WorkbenchContext, 'rendererDir' | 'notify' | 'windows'>): Promise<void>;
|
|
10
10
|
//# sourceMappingURL=launch.d.ts.map
|
package/dist/main/app/launch.js
CHANGED
|
@@ -7,21 +7,23 @@ import { loadWorkbenchSettings } from '../services/settings/index.js';
|
|
|
7
7
|
* Use createWorkbenchApp() when you want to customize modules or window setup.
|
|
8
8
|
*/
|
|
9
9
|
export function launch(config = {}) {
|
|
10
|
-
createWorkbenchApp(config).start();
|
|
10
|
+
return createWorkbenchApp(config).start();
|
|
11
11
|
}
|
|
12
12
|
export function buildDefaultMenu(ctx) {
|
|
13
13
|
installAppMenu(ctx);
|
|
14
14
|
}
|
|
15
15
|
export async function openSettingsWindow(ctx) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
let win = ctx.windows.settingsWindow;
|
|
17
|
+
if (!win || win.isDestroyed()) {
|
|
18
|
+
win = await createSettingsWindow(ctx.windows.mainWindow, ctx.rendererDir);
|
|
19
|
+
ctx.windows.setSettingsWindow(win);
|
|
20
|
+
wireSettingsWindowEvents(win, () => {
|
|
21
|
+
ctx.windows.setSettingsWindow(null);
|
|
20
22
|
});
|
|
21
23
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
ctx.notify.workbenchSettingsInit(
|
|
24
|
+
win.show();
|
|
25
|
+
win.focus();
|
|
26
|
+
ctx.notify.workbenchSettingsInit(win, {
|
|
25
27
|
settings: loadWorkbenchSettings(),
|
|
26
28
|
});
|
|
27
29
|
}
|