Files
openidea/src/workbenchBoot.ts
T
Deng Liuanddengliu 79accd1311 perf(settings): split Settings and auxiliary window boot out of the Workbench module (#4044)
Native auxiliary windows (settings, comparison, diff, deployment) all booted src/main.tsx, which statically imported the Workbench and every workbench feature (CodeMirror, xterm, editor extensions) even when the Settings window rendered none of them. main.tsx is now a small window-kind router with one boot module per window kind, and the settings pages, core plugin points and plugin theme runtime are registered from editor-free modules, so the Settings window loads no Workbench, @codemirror, @xterm or @/editor modules (about 57% less JS and a third less heap per Settings window). A static test keeps the Settings boot isolated.

Part of #3942

Co-authored-by: dengliu <5108773+dengliu@users.noreply.github.com>
2026-11-18 18:32:14 +08:00

29 lines
1.3 KiB
TypeScript

import { activateFeatures } from "./features";
import { isTauri } from "./platform/ipc";
import { installKeyboardDispatcher } from "./platform/keymap";
import { mountWindowRoot } from "./windowBoot";
import { activateWorkbench } from "./workbench/activate";
import { installFullscreenEscapeGuard } from "./workbench/fullscreenEscape";
import { Workbench } from "./workbench/Workbench";
export async function bootWorkbenchWindow(): Promise<void> {
// Before the features' and the dispatcher's key handlers: it wraps the Escape they see.
installFullscreenEscapeGuard();
activateWorkbench();
// `vite build --mode perf` is a production bundle for the performance harness (`perf/`).
const perfBuild = import.meta.env.MODE === "perf";
if ((import.meta.env.DEV || perfBuild) && !isTauri()) {
const { registerDevSamples } = await import("./workbench/devSamples");
registerDevSamples();
}
if (import.meta.env.DEV || perfBuild) {
const { installPerfProbe } = await import("./workbench/perfProbe");
installPerfProbe();
}
// Order matters: features (e.g. the terminal) install capture-phase key handlers
// that must run before the global dispatcher.
activateFeatures();
installKeyboardDispatcher();
mountWindowRoot(Workbench, { prefetchLazy: true });
}