@dimina-kit/devtools 0.4.0-dev.20260703101348 → 0.4.0-dev.20260706125036
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/dist/main/app/app.d.ts +4 -1
- package/dist/main/app/app.js +26 -0
- package/dist/main/index.bundle.js +194 -8
- package/dist/main/ipc/popover.js +10 -1
- package/dist/main/ipc/session.js +17 -1
- package/dist/main/services/compile-standby.d.ts +26 -0
- package/dist/main/services/compile-standby.js +57 -0
- package/dist/main/services/notifications/renderer-notifier.d.ts +5 -1
- package/dist/main/services/notifications/renderer-notifier.js +6 -0
- package/dist/main/services/projects/local-provider.js +4 -0
- package/dist/main/services/projects/project-repository.d.ts +7 -1
- package/dist/main/services/projects/project-repository.js +24 -0
- package/dist/main/services/projects/types.d.ts +25 -1
- package/dist/main/services/render-inspect/index.js +4 -4
- package/dist/main/services/views/view-manager.d.ts +15 -1
- package/dist/main/services/views/view-manager.js +12 -4
- package/dist/main/services/workbench-context.js +5 -0
- package/dist/main/services/workspace/workspace-service.d.ts +5 -1
- package/dist/main/services/workspace/workspace-service.js +15 -4
- package/dist/native-host/render/render.js +42 -52
- package/dist/native-host/service/service.js +2 -2
- package/dist/preload/windows/host-toolbar-runtime.cjs.map +2 -2
- package/dist/preload/windows/simulator.cjs.map +1 -1
- package/dist/renderer/assets/index-BMqyDx71.js +49 -0
- package/dist/renderer/assets/{input-CTb_le7F.js → input-CDAEwpBO.js} +2 -2
- package/dist/renderer/assets/ipc-transport-B7eFOR68.css +1 -0
- package/dist/renderer/assets/{ipc-transport-Ck5Xa8Tu.js → ipc-transport-_G1k5V1p.js} +2 -2
- package/dist/renderer/assets/popover-DEdjK14m.js +2 -0
- package/dist/renderer/assets/{select-ozSk5Pt6.js → select-DpKPCh3y.js} +2 -2
- package/dist/renderer/assets/{settings-CNwGOI22.js → settings-M5q2elUr.js} +2 -2
- package/dist/renderer/assets/{settings-api-DMbMp1Eq.js → settings-api-CDlZoHiO.js} +2 -2
- package/dist/renderer/assets/{workbenchSettings-Cr4EHo5w.js → workbenchSettings-CT_H1WhV.js} +2 -2
- package/dist/renderer/entries/main/index.html +6 -6
- package/dist/renderer/entries/popover/index.html +5 -5
- package/dist/renderer/entries/settings/index.html +5 -5
- package/dist/renderer/entries/workbench-settings/index.html +4 -4
- package/dist/shared/ipc-channels.d.ts +6 -0
- package/dist/shared/ipc-channels.js +6 -0
- package/dist/shared/ipc-schemas.d.ts +29 -0
- package/dist/shared/ipc-schemas.js +34 -0
- package/dist/shared/types.d.ts +28 -0
- package/package.json +6 -6
- package/dist/renderer/assets/index-BwzPwCmM.js +0 -49
- package/dist/renderer/assets/ipc-transport-BPWIV5hA.css +0 -1
- package/dist/renderer/assets/popover-B1Zu2UQu.js +0 -2
package/dist/main/app/app.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BrowserWindow } from 'electron';
|
|
2
|
-
import type { WorkbenchAppConfig } from '../../shared/types.js';
|
|
2
|
+
import type { LaunchConfig, WorkbenchAppConfig } from '../../shared/types.js';
|
|
3
3
|
import type { SimulatorApiHandler } from '../services/simulator/custom-apis.js';
|
|
4
4
|
import { type WorkbenchContext } from '../services/workbench-context.js';
|
|
5
5
|
import { type AutomationServer } from '../services/automation/index.js';
|
|
@@ -18,6 +18,9 @@ export interface WorkbenchAppInstance {
|
|
|
18
18
|
automationServer?: AutomationServer;
|
|
19
19
|
updateManager?: UpdateManager;
|
|
20
20
|
dispose: () => Promise<void>;
|
|
21
|
+
getLaunchConfigs: () => Promise<LaunchConfig[]>;
|
|
22
|
+
setLaunchConfigs: (configs: LaunchConfig[]) => Promise<void>;
|
|
23
|
+
setActiveLaunchConfig: (id: string | null) => Promise<void>;
|
|
21
24
|
}
|
|
22
25
|
/**
|
|
23
26
|
* Pre-ready bootstrap side effects (app name, CDP port, CSP suppression,
|
package/dist/main/app/app.js
CHANGED
|
@@ -11,6 +11,7 @@ import { isAppQuitting } from './lifecycle.js';
|
|
|
11
11
|
import { resolveNativeAppDataKeys, resolveNativeStorageOverview } from './native-overview.js';
|
|
12
12
|
// eslint-disable-next-line no-restricted-syntax -- grandfathered(workbench-context): shrink-only
|
|
13
13
|
import { createWorkbenchContext } from '../services/workbench-context.js';
|
|
14
|
+
import { setupCompileWorkerStandby } from '../services/compile-standby.js';
|
|
14
15
|
import { loadWorkbenchSettings, applyTheme } from '../services/settings/index.js';
|
|
15
16
|
import { installAppMenu } from '../menu/index.js';
|
|
16
17
|
import { registerAppIpc, popoverModule, projectsModule, sessionModule, settingsModule, simulatorModule, } from '../ipc/index.js';
|
|
@@ -369,6 +370,11 @@ export async function createDevtoolsRuntime(config = {}) {
|
|
|
369
370
|
// backgroundColor on theme change — windows otherwise keep the stale
|
|
370
371
|
// creation-time color (see installThemeBackgroundSync).
|
|
371
372
|
context.registry.add(installThemeBackgroundSync());
|
|
373
|
+
// Warm-standby compile worker: only meaningful for the devkit-backed
|
|
374
|
+
// default adapter (a host-injected adapter has no devkit fork to adopt the
|
|
375
|
+
// spare). Registered into the registry so the spare dies with the context.
|
|
376
|
+
if (!config.adapter)
|
|
377
|
+
context.registry.add(setupCompileWorkerStandby(context));
|
|
372
378
|
registerBuiltinModules(config, context);
|
|
373
379
|
// Wire the simulator-side difile:// protocol handler + temp-file IPC
|
|
374
380
|
// before host onSetup so any host-driven simulator boot sees the
|
|
@@ -394,6 +400,26 @@ export async function createDevtoolsRuntime(config = {}) {
|
|
|
394
400
|
registerTrustedWindow: (win) => context.registry.add(registerTrustedWindow(context, win)),
|
|
395
401
|
registerSimulatorApi: (name, handler) => context.registry.add(toDisposable(context.simulatorApis.register(name, handler))),
|
|
396
402
|
dispose: () => disposeContext(context),
|
|
403
|
+
async getLaunchConfigs() {
|
|
404
|
+
const projectPath = context.workspace.getProjectPath();
|
|
405
|
+
if (!projectPath)
|
|
406
|
+
return [];
|
|
407
|
+
return context.workspace.getLaunchConfigs(projectPath);
|
|
408
|
+
},
|
|
409
|
+
async setLaunchConfigs(configs) {
|
|
410
|
+
const projectPath = context.workspace.getProjectPath();
|
|
411
|
+
if (!projectPath)
|
|
412
|
+
return;
|
|
413
|
+
await context.workspace.saveLaunchConfigs(projectPath, configs);
|
|
414
|
+
context.notify.popoverUpdateLaunchConfigs(configs);
|
|
415
|
+
},
|
|
416
|
+
async setActiveLaunchConfig(id) {
|
|
417
|
+
const projectPath = context.workspace.getProjectPath();
|
|
418
|
+
if (!projectPath)
|
|
419
|
+
return;
|
|
420
|
+
await context.workspace.saveActiveLaunchConfigId(projectPath, id);
|
|
421
|
+
context.notify.popoverSwitchLaunchConfig(id);
|
|
422
|
+
},
|
|
397
423
|
};
|
|
398
424
|
// Built-in simulator APIs: devtools-supplied wx.* implementations that run
|
|
399
425
|
// in the main process. Hosts can override any of these in their onSetup by
|
|
@@ -391,7 +391,11 @@ var ProjectChannel = {
|
|
|
391
391
|
// contract (compileEvents), this one carries the line stream (compileLogs).
|
|
392
392
|
CompileLog: "project:compileLog",
|
|
393
393
|
CaptureThumbnail: "project:captureThumbnail",
|
|
394
|
-
GetThumbnail: "project:getThumbnail"
|
|
394
|
+
GetThumbnail: "project:getThumbnail",
|
|
395
|
+
GetLaunchConfigs: "project:getLaunchConfigs",
|
|
396
|
+
SaveLaunchConfigs: "project:saveLaunchConfigs",
|
|
397
|
+
GetActiveLaunchConfigId: "project:getActiveLaunchConfigId",
|
|
398
|
+
SaveActiveLaunchConfigId: "project:saveActiveLaunchConfigId"
|
|
395
399
|
};
|
|
396
400
|
var SessionChannel = {
|
|
397
401
|
RuntimeStatus: "session:runtimeStatus"
|
|
@@ -476,7 +480,9 @@ var PopoverChannel = {
|
|
|
476
480
|
Hide: "popover:hide",
|
|
477
481
|
Relaunch: "popover:relaunch",
|
|
478
482
|
Closed: "popover:closed",
|
|
479
|
-
Init: "popover:init"
|
|
483
|
+
Init: "popover:init",
|
|
484
|
+
SwitchLaunchConfig: "popover:switchLaunchConfig",
|
|
485
|
+
UpdateLaunchConfigs: "popover:updateLaunchConfigs"
|
|
480
486
|
};
|
|
481
487
|
var WindowChannel = {
|
|
482
488
|
NavigateBack: "window:navigateBack"
|
|
@@ -1123,6 +1129,12 @@ function createRendererNotifier(ctx) {
|
|
|
1123
1129
|
popoverRelaunch(config) {
|
|
1124
1130
|
sendToMain(PopoverChannel.Relaunch, config);
|
|
1125
1131
|
},
|
|
1132
|
+
popoverSwitchLaunchConfig(id) {
|
|
1133
|
+
sendToMain(PopoverChannel.SwitchLaunchConfig, id);
|
|
1134
|
+
},
|
|
1135
|
+
popoverUpdateLaunchConfigs(configs) {
|
|
1136
|
+
sendToMain(PopoverChannel.UpdateLaunchConfigs, configs);
|
|
1137
|
+
},
|
|
1126
1138
|
hostToolbarHeightChanged(height) {
|
|
1127
1139
|
sendToMain(ViewChannel.HostToolbarHeightChanged, height);
|
|
1128
1140
|
},
|
|
@@ -3705,12 +3717,15 @@ function createViewManager(ctx) {
|
|
|
3705
3717
|
function reapplyToolbarDependentOverlays() {
|
|
3706
3718
|
overlayPanels.reapplyPresentOverlays();
|
|
3707
3719
|
}
|
|
3708
|
-
function
|
|
3720
|
+
function disposeProjectViews() {
|
|
3709
3721
|
nativeSimulator.detachSimulator();
|
|
3710
3722
|
workbench.detachWorkbench();
|
|
3711
|
-
hostToolbar.dispose();
|
|
3712
3723
|
safeArea.dispose();
|
|
3713
3724
|
}
|
|
3725
|
+
function disposeAll() {
|
|
3726
|
+
disposeProjectViews();
|
|
3727
|
+
hostToolbar.dispose();
|
|
3728
|
+
}
|
|
3714
3729
|
return {
|
|
3715
3730
|
attachNativeSimulator: nativeSimulator.attachNativeSimulator,
|
|
3716
3731
|
softReloadNativeSimulator: nativeSimulator.softReloadNativeSimulator,
|
|
@@ -3721,6 +3736,7 @@ function createViewManager(ctx) {
|
|
|
3721
3736
|
showPopover: overlayPanels.showPopover,
|
|
3722
3737
|
hidePopover: overlayPanels.hidePopover,
|
|
3723
3738
|
repositionAll: () => overlayPanels.reapplyPresentOverlays(),
|
|
3739
|
+
disposeProjectViews,
|
|
3724
3740
|
disposeAll,
|
|
3725
3741
|
getSimulatorWebContentsId: nativeSimulator.getSimulatorWebContentsId,
|
|
3726
3742
|
getSimulatorWebContents: nativeSimulator.getSimulatorWebContents,
|
|
@@ -3960,6 +3976,30 @@ function getProjectSettings(projectPath) {
|
|
|
3960
3976
|
return { uploadWithSourceMap: false };
|
|
3961
3977
|
}
|
|
3962
3978
|
}
|
|
3979
|
+
function getLaunchConfigs(dirPath) {
|
|
3980
|
+
const project = load().find((p) => p.path === dirPath);
|
|
3981
|
+
return project?.launchConfigs ?? [];
|
|
3982
|
+
}
|
|
3983
|
+
function saveLaunchConfigs(dirPath, configs) {
|
|
3984
|
+
const projects = load();
|
|
3985
|
+
const idx = projects.findIndex((p) => p.path === dirPath);
|
|
3986
|
+
if (idx >= 0) {
|
|
3987
|
+
projects[idx] = { ...projects[idx], launchConfigs: configs };
|
|
3988
|
+
save(projects);
|
|
3989
|
+
}
|
|
3990
|
+
}
|
|
3991
|
+
function getActiveLaunchConfigId(dirPath) {
|
|
3992
|
+
const project = load().find((p) => p.path === dirPath);
|
|
3993
|
+
return project?.activeLaunchConfigId ?? null;
|
|
3994
|
+
}
|
|
3995
|
+
function saveActiveLaunchConfigId(dirPath, id) {
|
|
3996
|
+
const projects = load();
|
|
3997
|
+
const idx = projects.findIndex((p) => p.path === dirPath);
|
|
3998
|
+
if (idx >= 0) {
|
|
3999
|
+
projects[idx] = { ...projects[idx], activeLaunchConfigId: id };
|
|
4000
|
+
save(projects);
|
|
4001
|
+
}
|
|
4002
|
+
}
|
|
3963
4003
|
function updateProjectSettings(projectPath, patch) {
|
|
3964
4004
|
if (!projectPath) return;
|
|
3965
4005
|
const configPath = path10.join(projectPath, "project.config.json");
|
|
@@ -4210,7 +4250,7 @@ function createWorkspaceService(ctx) {
|
|
|
4210
4250
|
await disposeSession();
|
|
4211
4251
|
if (currentProjectPath !== "") lastClosedProjectPath = currentProjectPath;
|
|
4212
4252
|
currentProjectPath = "";
|
|
4213
|
-
ctx.views.
|
|
4253
|
+
ctx.views.disposeProjectViews();
|
|
4214
4254
|
} finally {
|
|
4215
4255
|
closing = false;
|
|
4216
4256
|
release();
|
|
@@ -4265,7 +4305,15 @@ function createWorkspaceService(ctx) {
|
|
|
4265
4305
|
// Per-project settings (uploadWithSourceMap etc.) live in the project's
|
|
4266
4306
|
// own `project.config.json`, not the registry — keep direct repo calls.
|
|
4267
4307
|
getProjectSettings: (projectPath) => getProjectSettings(projectPath),
|
|
4268
|
-
updateProjectSettings: (projectPath, patch) => updateProjectSettings(projectPath, patch)
|
|
4308
|
+
updateProjectSettings: (projectPath, patch) => updateProjectSettings(projectPath, patch),
|
|
4309
|
+
getLaunchConfigs: async (p) => provider.getLaunchConfigs ? await provider.getLaunchConfigs(p) : [],
|
|
4310
|
+
saveLaunchConfigs: async (p, c) => {
|
|
4311
|
+
if (provider.saveLaunchConfigs) await provider.saveLaunchConfigs(p, c);
|
|
4312
|
+
},
|
|
4313
|
+
getActiveLaunchConfigId: async (p) => provider.getActiveLaunchConfigId ? await provider.getActiveLaunchConfigId(p) : null,
|
|
4314
|
+
saveActiveLaunchConfigId: async (p, id) => {
|
|
4315
|
+
if (provider.saveActiveLaunchConfigId) await provider.saveActiveLaunchConfigId(p, id);
|
|
4316
|
+
}
|
|
4269
4317
|
};
|
|
4270
4318
|
}
|
|
4271
4319
|
|
|
@@ -4311,7 +4359,11 @@ function createLocalProjectsProvider() {
|
|
|
4311
4359
|
getCompileConfig: (dirPath) => getCompileConfig(dirPath),
|
|
4312
4360
|
saveCompileConfig: (dirPath, cfg) => saveCompileConfig(dirPath, cfg),
|
|
4313
4361
|
saveThumbnail: (dirPath, dataUrl) => saveThumbnailFromDataUrl(dirPath, dataUrl),
|
|
4314
|
-
getThumbnail: (dirPath) => loadThumbnail(dirPath)
|
|
4362
|
+
getThumbnail: (dirPath) => loadThumbnail(dirPath),
|
|
4363
|
+
getLaunchConfigs: (dirPath) => getLaunchConfigs(dirPath),
|
|
4364
|
+
saveLaunchConfigs: (dirPath, configs) => saveLaunchConfigs(dirPath, configs),
|
|
4365
|
+
getActiveLaunchConfigId: (dirPath) => getActiveLaunchConfigId(dirPath),
|
|
4366
|
+
saveActiveLaunchConfigId: (dirPath, id) => saveActiveLaunchConfigId(dirPath, id)
|
|
4315
4367
|
};
|
|
4316
4368
|
}
|
|
4317
4369
|
|
|
@@ -4376,6 +4428,7 @@ function createWorkbenchContext(opts) {
|
|
|
4376
4428
|
ctx.simulatorApis = createSimulatorApiRegistry();
|
|
4377
4429
|
ctx.windows = createWindowService(opts.mainWindow);
|
|
4378
4430
|
ctx.views = createViewManager(ctx);
|
|
4431
|
+
ctx.registry.add(() => ctx.views.disposeAll());
|
|
4379
4432
|
ctx.notify = createRendererNotifier(ctx);
|
|
4380
4433
|
ctx.openSettings = () => openSettingsWindow(ctx);
|
|
4381
4434
|
ctx.projectsProvider = opts.projectsProvider ?? createLocalProjectsProvider();
|
|
@@ -4391,6 +4444,55 @@ function createWorkbenchContext(opts) {
|
|
|
4391
4444
|
return ctx;
|
|
4392
4445
|
}
|
|
4393
4446
|
|
|
4447
|
+
// src/main/services/compile-standby.ts
|
|
4448
|
+
var EVENT_SEVERITY = {
|
|
4449
|
+
"spawned": "info",
|
|
4450
|
+
"prewarmed": "info",
|
|
4451
|
+
"adopted": "info",
|
|
4452
|
+
"died": "warn",
|
|
4453
|
+
"health-check-failed": "warn",
|
|
4454
|
+
"degraded": "error"
|
|
4455
|
+
};
|
|
4456
|
+
function setupCompileWorkerStandby(ctx, deps = {}) {
|
|
4457
|
+
const loadDevkit = deps.loadDevkit ?? (() => import("@dimina-kit/devkit"));
|
|
4458
|
+
let manager = null;
|
|
4459
|
+
let disposed = false;
|
|
4460
|
+
const forward = (ev) => {
|
|
4461
|
+
try {
|
|
4462
|
+
const detail = [
|
|
4463
|
+
`compile standby ${ev.type}`,
|
|
4464
|
+
typeof ev.pid === "number" ? `pid=${ev.pid}` : null,
|
|
4465
|
+
ev.reason ? `\u2014 ${ev.reason}` : null
|
|
4466
|
+
].filter(Boolean).join(" ");
|
|
4467
|
+
ctx.diagnostics?.report({
|
|
4468
|
+
severity: EVENT_SEVERITY[ev.type] ?? "info",
|
|
4469
|
+
code: "compile-standby",
|
|
4470
|
+
message: detail
|
|
4471
|
+
});
|
|
4472
|
+
} catch {
|
|
4473
|
+
}
|
|
4474
|
+
};
|
|
4475
|
+
void (async () => {
|
|
4476
|
+
let enable;
|
|
4477
|
+
try {
|
|
4478
|
+
const devkit = await loadDevkit();
|
|
4479
|
+
enable = devkit.enableCompileWorkerStandby;
|
|
4480
|
+
} catch {
|
|
4481
|
+
return;
|
|
4482
|
+
}
|
|
4483
|
+
if (typeof enable !== "function") return;
|
|
4484
|
+
manager = enable({ onEvent: forward });
|
|
4485
|
+
if (disposed) void manager.dispose();
|
|
4486
|
+
})();
|
|
4487
|
+
return {
|
|
4488
|
+
dispose: async () => {
|
|
4489
|
+
if (disposed) return;
|
|
4490
|
+
disposed = true;
|
|
4491
|
+
await manager?.dispose();
|
|
4492
|
+
}
|
|
4493
|
+
};
|
|
4494
|
+
}
|
|
4495
|
+
|
|
4394
4496
|
// src/main/menu/index.ts
|
|
4395
4497
|
import { Menu } from "electron";
|
|
4396
4498
|
function installAppMenu(ctx) {
|
|
@@ -4596,6 +4698,29 @@ var SettingsProjectSettingsChangedSchema = z3.tuple([
|
|
|
4596
4698
|
]);
|
|
4597
4699
|
var ProjectCaptureThumbnailSchema = z3.tuple([AbsolutePath]);
|
|
4598
4700
|
var ProjectGetThumbnailSchema = z3.tuple([AbsolutePath]);
|
|
4701
|
+
var ProjectGetLaunchConfigsSchema = z3.tuple([AbsolutePath]);
|
|
4702
|
+
var LaunchConfigShape = z3.looseObject({
|
|
4703
|
+
id: z3.string().min(1),
|
|
4704
|
+
name: z3.string(),
|
|
4705
|
+
startPage: z3.string().optional(),
|
|
4706
|
+
scene: z3.number().optional(),
|
|
4707
|
+
queryParams: z3.array(z3.looseObject({ key: z3.string(), value: z3.string() })).optional()
|
|
4708
|
+
});
|
|
4709
|
+
var ProjectSaveLaunchConfigsSchema = z3.tuple([
|
|
4710
|
+
AbsolutePath,
|
|
4711
|
+
z3.array(LaunchConfigShape)
|
|
4712
|
+
]);
|
|
4713
|
+
var ProjectGetActiveLaunchConfigIdSchema = z3.tuple([AbsolutePath]);
|
|
4714
|
+
var ProjectSaveActiveLaunchConfigIdSchema = z3.tuple([
|
|
4715
|
+
AbsolutePath,
|
|
4716
|
+
z3.union([z3.string(), z3.null()])
|
|
4717
|
+
]);
|
|
4718
|
+
var PopoverSwitchLaunchConfigSchema = z3.tuple([
|
|
4719
|
+
z3.union([z3.string(), z3.null()])
|
|
4720
|
+
]);
|
|
4721
|
+
var PopoverUpdateLaunchConfigsSchema = z3.tuple([
|
|
4722
|
+
z3.array(LaunchConfigShape)
|
|
4723
|
+
]);
|
|
4599
4724
|
|
|
4600
4725
|
// src/main/ipc/simulator.ts
|
|
4601
4726
|
function registerSimulatorIpc(ctx) {
|
|
@@ -4632,6 +4757,21 @@ function registerPopoverIpc(ctx) {
|
|
|
4632
4757
|
const [newConfig] = validate(PopoverChannel.Relaunch, PopoverRelaunchSchema, args);
|
|
4633
4758
|
ctx.views.hidePopover();
|
|
4634
4759
|
ctx.notify.popoverRelaunch(newConfig);
|
|
4760
|
+
}).on(PopoverChannel.SwitchLaunchConfig, (_event, ...args) => {
|
|
4761
|
+
const [id] = validate(
|
|
4762
|
+
PopoverChannel.SwitchLaunchConfig,
|
|
4763
|
+
PopoverSwitchLaunchConfigSchema,
|
|
4764
|
+
args
|
|
4765
|
+
);
|
|
4766
|
+
ctx.views.hidePopover();
|
|
4767
|
+
ctx.notify.popoverSwitchLaunchConfig(id);
|
|
4768
|
+
}).on(PopoverChannel.UpdateLaunchConfigs, (_event, ...args) => {
|
|
4769
|
+
const [configs] = validate(
|
|
4770
|
+
PopoverChannel.UpdateLaunchConfigs,
|
|
4771
|
+
PopoverUpdateLaunchConfigsSchema,
|
|
4772
|
+
args
|
|
4773
|
+
);
|
|
4774
|
+
ctx.notify.popoverUpdateLaunchConfigs(configs);
|
|
4635
4775
|
});
|
|
4636
4776
|
}
|
|
4637
4777
|
var popoverModule = {
|
|
@@ -4857,6 +4997,34 @@ function registerSessionIpc(ctx) {
|
|
|
4857
4997
|
args
|
|
4858
4998
|
);
|
|
4859
4999
|
return ctx.workspace.getThumbnail(projectPath);
|
|
5000
|
+
}).handle(ProjectChannel.GetLaunchConfigs, (_, ...args) => {
|
|
5001
|
+
const [projectPath] = validate(
|
|
5002
|
+
ProjectChannel.GetLaunchConfigs,
|
|
5003
|
+
ProjectGetLaunchConfigsSchema,
|
|
5004
|
+
args
|
|
5005
|
+
);
|
|
5006
|
+
return ctx.workspace.getLaunchConfigs(projectPath);
|
|
5007
|
+
}).handle(ProjectChannel.SaveLaunchConfigs, (_, ...args) => {
|
|
5008
|
+
const [projectPath, configs] = validate(
|
|
5009
|
+
ProjectChannel.SaveLaunchConfigs,
|
|
5010
|
+
ProjectSaveLaunchConfigsSchema,
|
|
5011
|
+
args
|
|
5012
|
+
);
|
|
5013
|
+
return ctx.workspace.saveLaunchConfigs(projectPath, configs);
|
|
5014
|
+
}).handle(ProjectChannel.GetActiveLaunchConfigId, (_, ...args) => {
|
|
5015
|
+
const [projectPath] = validate(
|
|
5016
|
+
ProjectChannel.GetActiveLaunchConfigId,
|
|
5017
|
+
ProjectGetActiveLaunchConfigIdSchema,
|
|
5018
|
+
args
|
|
5019
|
+
);
|
|
5020
|
+
return ctx.workspace.getActiveLaunchConfigId(projectPath);
|
|
5021
|
+
}).handle(ProjectChannel.SaveActiveLaunchConfigId, (_, ...args) => {
|
|
5022
|
+
const [projectPath, id] = validate(
|
|
5023
|
+
ProjectChannel.SaveActiveLaunchConfigId,
|
|
5024
|
+
ProjectSaveActiveLaunchConfigIdSchema,
|
|
5025
|
+
args
|
|
5026
|
+
);
|
|
5027
|
+
return ctx.workspace.saveActiveLaunchConfigId(projectPath, id);
|
|
4860
5028
|
});
|
|
4861
5029
|
}
|
|
4862
5030
|
var sessionModule = {
|
|
@@ -11379,6 +11547,7 @@ async function createDevtoolsRuntime(config = {}) {
|
|
|
11379
11547
|
context.registry.add(registerProjectFsIpc(context));
|
|
11380
11548
|
context.registry.add(setupSimulatorSessionPolicy());
|
|
11381
11549
|
context.registry.add(installThemeBackgroundSync());
|
|
11550
|
+
if (!config.adapter) context.registry.add(setupCompileWorkerStandby(context));
|
|
11382
11551
|
registerBuiltinModules(config, context);
|
|
11383
11552
|
const simSession = session4.fromPartition(SHARED_MINIAPP_PARTITION);
|
|
11384
11553
|
context.registry.add(setupSimulatorTempFiles(simSession));
|
|
@@ -11394,7 +11563,24 @@ async function createDevtoolsRuntime(config = {}) {
|
|
|
11394
11563
|
// teardown, so a single dispose leaves no dead entry behind.
|
|
11395
11564
|
registerTrustedWindow: (win) => context.registry.add(registerTrustedWindow(context, win)),
|
|
11396
11565
|
registerSimulatorApi: (name, handler) => context.registry.add(toDisposable8(context.simulatorApis.register(name, handler))),
|
|
11397
|
-
dispose: () => disposeContext(context)
|
|
11566
|
+
dispose: () => disposeContext(context),
|
|
11567
|
+
async getLaunchConfigs() {
|
|
11568
|
+
const projectPath = context.workspace.getProjectPath();
|
|
11569
|
+
if (!projectPath) return [];
|
|
11570
|
+
return context.workspace.getLaunchConfigs(projectPath);
|
|
11571
|
+
},
|
|
11572
|
+
async setLaunchConfigs(configs) {
|
|
11573
|
+
const projectPath = context.workspace.getProjectPath();
|
|
11574
|
+
if (!projectPath) return;
|
|
11575
|
+
await context.workspace.saveLaunchConfigs(projectPath, configs);
|
|
11576
|
+
context.notify.popoverUpdateLaunchConfigs(configs);
|
|
11577
|
+
},
|
|
11578
|
+
async setActiveLaunchConfig(id) {
|
|
11579
|
+
const projectPath = context.workspace.getProjectPath();
|
|
11580
|
+
if (!projectPath) return;
|
|
11581
|
+
await context.workspace.saveActiveLaunchConfigId(projectPath, id);
|
|
11582
|
+
context.notify.popoverSwitchLaunchConfig(id);
|
|
11583
|
+
}
|
|
11398
11584
|
};
|
|
11399
11585
|
instance.registerSimulatorApi("login", async () => {
|
|
11400
11586
|
return "hello";
|
package/dist/main/ipc/popover.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PopoverChannel } from '../../shared/ipc-channels.js';
|
|
2
|
-
import { PopoverShowSchema, PopoverRelaunchSchema, } from '../../shared/ipc-schemas.js';
|
|
2
|
+
import { PopoverShowSchema, PopoverRelaunchSchema, PopoverSwitchLaunchConfigSchema, PopoverUpdateLaunchConfigsSchema, } from '../../shared/ipc-schemas.js';
|
|
3
3
|
import { validate } from '../utils/ipc-schema.js';
|
|
4
4
|
import { IpcRegistry } from '../utils/ipc-registry.js';
|
|
5
5
|
export function registerPopoverIpc(ctx) {
|
|
@@ -15,6 +15,15 @@ export function registerPopoverIpc(ctx) {
|
|
|
15
15
|
const [newConfig] = validate(PopoverChannel.Relaunch, PopoverRelaunchSchema, args);
|
|
16
16
|
ctx.views.hidePopover();
|
|
17
17
|
ctx.notify.popoverRelaunch(newConfig);
|
|
18
|
+
})
|
|
19
|
+
.on(PopoverChannel.SwitchLaunchConfig, (_event, ...args) => {
|
|
20
|
+
const [id] = validate(PopoverChannel.SwitchLaunchConfig, PopoverSwitchLaunchConfigSchema, args);
|
|
21
|
+
ctx.views.hidePopover();
|
|
22
|
+
ctx.notify.popoverSwitchLaunchConfig(id);
|
|
23
|
+
})
|
|
24
|
+
.on(PopoverChannel.UpdateLaunchConfigs, (_event, ...args) => {
|
|
25
|
+
const [configs] = validate(PopoverChannel.UpdateLaunchConfigs, PopoverUpdateLaunchConfigsSchema, args);
|
|
26
|
+
ctx.notify.popoverUpdateLaunchConfigs(configs);
|
|
18
27
|
});
|
|
19
28
|
}
|
|
20
29
|
export const popoverModule = {
|
package/dist/main/ipc/session.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ProjectChannel } from '../../shared/ipc-channels.js';
|
|
2
|
-
import { ProjectCaptureThumbnailSchema, ProjectGetCompileConfigSchema, ProjectGetPagesSchema, ProjectGetThumbnailSchema, ProjectOpenSchema, ProjectSaveCompileConfigSchema, } from '../../shared/ipc-schemas.js';
|
|
2
|
+
import { ProjectCaptureThumbnailSchema, ProjectGetCompileConfigSchema, ProjectGetPagesSchema, ProjectGetThumbnailSchema, ProjectOpenSchema, ProjectSaveCompileConfigSchema, ProjectGetLaunchConfigsSchema, ProjectSaveLaunchConfigsSchema, ProjectGetActiveLaunchConfigIdSchema, ProjectSaveActiveLaunchConfigIdSchema, } from '../../shared/ipc-schemas.js';
|
|
3
3
|
import { validate } from '../utils/ipc-schema.js';
|
|
4
4
|
import { IpcRegistry } from '../utils/ipc-registry.js';
|
|
5
5
|
export function registerSessionIpc(ctx) {
|
|
@@ -30,6 +30,22 @@ export function registerSessionIpc(ctx) {
|
|
|
30
30
|
.handle(ProjectChannel.GetThumbnail, (_, ...args) => {
|
|
31
31
|
const [projectPath] = validate(ProjectChannel.GetThumbnail, ProjectGetThumbnailSchema, args);
|
|
32
32
|
return ctx.workspace.getThumbnail(projectPath);
|
|
33
|
+
})
|
|
34
|
+
.handle(ProjectChannel.GetLaunchConfigs, (_, ...args) => {
|
|
35
|
+
const [projectPath] = validate(ProjectChannel.GetLaunchConfigs, ProjectGetLaunchConfigsSchema, args);
|
|
36
|
+
return ctx.workspace.getLaunchConfigs(projectPath);
|
|
37
|
+
})
|
|
38
|
+
.handle(ProjectChannel.SaveLaunchConfigs, (_, ...args) => {
|
|
39
|
+
const [projectPath, configs] = validate(ProjectChannel.SaveLaunchConfigs, ProjectSaveLaunchConfigsSchema, args);
|
|
40
|
+
return ctx.workspace.saveLaunchConfigs(projectPath, configs);
|
|
41
|
+
})
|
|
42
|
+
.handle(ProjectChannel.GetActiveLaunchConfigId, (_, ...args) => {
|
|
43
|
+
const [projectPath] = validate(ProjectChannel.GetActiveLaunchConfigId, ProjectGetActiveLaunchConfigIdSchema, args);
|
|
44
|
+
return ctx.workspace.getActiveLaunchConfigId(projectPath);
|
|
45
|
+
})
|
|
46
|
+
.handle(ProjectChannel.SaveActiveLaunchConfigId, (_, ...args) => {
|
|
47
|
+
const [projectPath, id] = validate(ProjectChannel.SaveActiveLaunchConfigId, ProjectSaveActiveLaunchConfigIdSchema, args);
|
|
48
|
+
return ctx.workspace.saveActiveLaunchConfigId(projectPath, id);
|
|
33
49
|
});
|
|
34
50
|
}
|
|
35
51
|
export const sessionModule = {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wires devkit's warm-standby compile worker into the devtools runtime.
|
|
3
|
+
*
|
|
4
|
+
* While no project is open, devkit keeps one project-agnostic compile worker
|
|
5
|
+
* forked + prewarmed; every openProject adopts it so the first compile skips
|
|
6
|
+
* fork + compiler import (~1.6s). This module owns exactly the glue devtools
|
|
7
|
+
* needs on top: turn the accelerator on at boot, mirror its lifecycle events
|
|
8
|
+
* onto the diagnostics bus (a user-machine bug report then carries the whole
|
|
9
|
+
* standby story), and shut it down with the context.
|
|
10
|
+
*
|
|
11
|
+
* Failure-transparent by design: if devkit is missing or predates the standby
|
|
12
|
+
* API, the accelerator silently stays off — compilation itself is untouched
|
|
13
|
+
* (the adapter falls back to devkit's normal cold-fork path, or the host runs
|
|
14
|
+
* its own adapter entirely).
|
|
15
|
+
*/
|
|
16
|
+
import type { DiagnosticsBus } from './diagnostics/index.js';
|
|
17
|
+
export interface CompileStandbyDeps {
|
|
18
|
+
/** Test hook: replaces the dynamic import('@dimina-kit/devkit'). */
|
|
19
|
+
loadDevkit?: () => Promise<unknown>;
|
|
20
|
+
}
|
|
21
|
+
export declare function setupCompileWorkerStandby(ctx: {
|
|
22
|
+
diagnostics?: DiagnosticsBus;
|
|
23
|
+
}, deps?: CompileStandbyDeps): {
|
|
24
|
+
dispose: () => Promise<void>;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=compile-standby.d.ts.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
const EVENT_SEVERITY = {
|
|
2
|
+
'spawned': 'info',
|
|
3
|
+
'prewarmed': 'info',
|
|
4
|
+
'adopted': 'info',
|
|
5
|
+
'died': 'warn',
|
|
6
|
+
'health-check-failed': 'warn',
|
|
7
|
+
'degraded': 'error',
|
|
8
|
+
};
|
|
9
|
+
export function setupCompileWorkerStandby(ctx, deps = {}) {
|
|
10
|
+
const loadDevkit = deps.loadDevkit ?? (() => import('@dimina-kit/devkit'));
|
|
11
|
+
let manager = null;
|
|
12
|
+
let disposed = false;
|
|
13
|
+
const forward = (ev) => {
|
|
14
|
+
try {
|
|
15
|
+
const detail = [
|
|
16
|
+
`compile standby ${ev.type}`,
|
|
17
|
+
typeof ev.pid === 'number' ? `pid=${ev.pid}` : null,
|
|
18
|
+
ev.reason ? `— ${ev.reason}` : null,
|
|
19
|
+
].filter(Boolean).join(' ');
|
|
20
|
+
ctx.diagnostics?.report({
|
|
21
|
+
severity: EVENT_SEVERITY[ev.type] ?? 'info',
|
|
22
|
+
code: 'compile-standby',
|
|
23
|
+
message: detail,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
// telemetry must never break the standby
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
void (async () => {
|
|
31
|
+
let enable;
|
|
32
|
+
try {
|
|
33
|
+
const devkit = await loadDevkit();
|
|
34
|
+
enable = devkit.enableCompileWorkerStandby;
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
// devkit unavailable — the accelerator quietly stays off.
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
if (typeof enable !== 'function')
|
|
41
|
+
return;
|
|
42
|
+
manager = enable({ onEvent: forward });
|
|
43
|
+
// A teardown that raced the async load wins: the manager is disposed the
|
|
44
|
+
// moment it exists, so a quitting app can never leak a fresh spare.
|
|
45
|
+
if (disposed)
|
|
46
|
+
void manager.dispose();
|
|
47
|
+
})();
|
|
48
|
+
return {
|
|
49
|
+
dispose: async () => {
|
|
50
|
+
if (disposed)
|
|
51
|
+
return;
|
|
52
|
+
disposed = true;
|
|
53
|
+
await manager?.dispose();
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=compile-standby.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BrowserWindow, WebContents, WebContentsView } from 'electron';
|
|
2
|
-
import type { CompileConfig } from '../../../shared/types.js';
|
|
2
|
+
import type { CompileConfig, LaunchConfig } from '../../../shared/types.js';
|
|
3
3
|
import { type EditorOpenFilePayload } from '../../../shared/ipc-channels.js';
|
|
4
4
|
import type { WorkbenchSettings } from '../settings/index.js';
|
|
5
5
|
import type { ProjectSettings } from '../projects/project-repository.js';
|
|
@@ -98,6 +98,10 @@ export interface RendererNotifier {
|
|
|
98
98
|
popoverClosed(): void;
|
|
99
99
|
/** Ask the main renderer to relaunch the simulator with a new config. */
|
|
100
100
|
popoverRelaunch(config: CompileConfig): void;
|
|
101
|
+
/** Ask the main renderer to switch to a launch config (or null for normal). */
|
|
102
|
+
popoverSwitchLaunchConfig(id: string | null): void;
|
|
103
|
+
/** Ask the main renderer to update its launch configs list. */
|
|
104
|
+
popoverUpdateLaunchConfigs(configs: LaunchConfig[]): void;
|
|
101
105
|
/**
|
|
102
106
|
* Push the reserved host-toolbar height to the main renderer so its toolbar
|
|
103
107
|
* placeholder div resizes (closes the host-toolbar dynamic-height loop).
|
|
@@ -39,6 +39,12 @@ export function createRendererNotifier(ctx) {
|
|
|
39
39
|
popoverRelaunch(config) {
|
|
40
40
|
sendToMain(PopoverChannel.Relaunch, config);
|
|
41
41
|
},
|
|
42
|
+
popoverSwitchLaunchConfig(id) {
|
|
43
|
+
sendToMain(PopoverChannel.SwitchLaunchConfig, id);
|
|
44
|
+
},
|
|
45
|
+
popoverUpdateLaunchConfigs(configs) {
|
|
46
|
+
sendToMain(PopoverChannel.UpdateLaunchConfigs, configs);
|
|
47
|
+
},
|
|
42
48
|
hostToolbarHeightChanged(height) {
|
|
43
49
|
sendToMain(ViewChannel.HostToolbarHeightChanged, height);
|
|
44
50
|
},
|
|
@@ -20,6 +20,10 @@ export function createLocalProjectsProvider() {
|
|
|
20
20
|
saveCompileConfig: (dirPath, cfg) => repo.saveCompileConfig(dirPath, cfg),
|
|
21
21
|
saveThumbnail: (dirPath, dataUrl) => saveThumbnailFromDataUrl(dirPath, dataUrl),
|
|
22
22
|
getThumbnail: (dirPath) => loadThumbnail(dirPath),
|
|
23
|
+
getLaunchConfigs: (dirPath) => repo.getLaunchConfigs(dirPath),
|
|
24
|
+
saveLaunchConfigs: (dirPath, configs) => repo.saveLaunchConfigs(dirPath, configs),
|
|
25
|
+
getActiveLaunchConfigId: (dirPath) => repo.getActiveLaunchConfigId(dirPath),
|
|
26
|
+
saveActiveLaunchConfigId: (dirPath, id) => repo.saveActiveLaunchConfigId(dirPath, id),
|
|
23
27
|
};
|
|
24
28
|
}
|
|
25
29
|
//# sourceMappingURL=local-provider.js.map
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import type { CompileConfig } from '../../../shared/types.js';
|
|
1
|
+
import type { CompileConfig, LaunchConfig } from '../../../shared/types.js';
|
|
2
2
|
export interface Project {
|
|
3
3
|
name: string;
|
|
4
4
|
path: string;
|
|
5
5
|
lastOpened?: string | null;
|
|
6
6
|
compileConfig?: CompileConfig;
|
|
7
|
+
launchConfigs?: LaunchConfig[];
|
|
8
|
+
activeLaunchConfigId?: string | null;
|
|
7
9
|
}
|
|
8
10
|
export interface ProjectPages {
|
|
9
11
|
pages: string[];
|
|
@@ -23,6 +25,10 @@ export declare function getProjectPages(dirPath: string): ProjectPages;
|
|
|
23
25
|
export declare function saveCompileConfig(dirPath: string, config: CompileConfig): void;
|
|
24
26
|
/** Read a subset of `project.config.json` exposed to the settings panel. */
|
|
25
27
|
export declare function getProjectSettings(projectPath: string): ProjectSettings;
|
|
28
|
+
export declare function getLaunchConfigs(dirPath: string): LaunchConfig[];
|
|
29
|
+
export declare function saveLaunchConfigs(dirPath: string, configs: LaunchConfig[]): void;
|
|
30
|
+
export declare function getActiveLaunchConfigId(dirPath: string): string | null;
|
|
31
|
+
export declare function saveActiveLaunchConfigId(dirPath: string, id: string | null): void;
|
|
26
32
|
/** Persist a partial patch into the `setting` block of `project.config.json`. */
|
|
27
33
|
export declare function updateProjectSettings(projectPath: string, patch: Partial<ProjectSettings>): void;
|
|
28
34
|
//# sourceMappingURL=project-repository.d.ts.map
|
|
@@ -132,6 +132,30 @@ export function getProjectSettings(projectPath) {
|
|
|
132
132
|
return { uploadWithSourceMap: false };
|
|
133
133
|
}
|
|
134
134
|
}
|
|
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
|
+
}
|
|
135
159
|
/** Persist a partial patch into the `setting` block of `project.config.json`. */
|
|
136
160
|
export function updateProjectSettings(projectPath, patch) {
|
|
137
161
|
if (!projectPath)
|
|
@@ -4,7 +4,7 @@
|
|
|
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 } from '../../../shared/types.js';
|
|
7
|
+
import type { CompileConfig, LaunchConfig } from '../../../shared/types.js';
|
|
8
8
|
import type { Project } from './project-repository.js';
|
|
9
9
|
export type { Project };
|
|
10
10
|
export type { ProjectTemplate, CreateProjectInput } from '../../../shared/types.js';
|
|
@@ -81,6 +81,30 @@ export interface ProjectsProvider {
|
|
|
81
81
|
* Default when omitted: returns `null`.
|
|
82
82
|
*/
|
|
83
83
|
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>;
|
|
84
108
|
}
|
|
85
109
|
/** Built-in template policy. */
|
|
86
110
|
export type BuiltinTemplatesMode = 'all' | 'none' | readonly string[];
|