refactor: prebuild global shortcut and mpv log handler deps

This commit is contained in:
2026-02-20 01:39:32 -08:00
parent c3afea6d40
commit e73381aa36
2 changed files with 19 additions and 15 deletions

View File

@@ -416,3 +416,5 @@
- [2026-02-20T09:35:02Z] test: `bun run build` pass (expected macOS helper Swift cache fallback) + `protocol-url-handlers*` and `secondary-sub-mode-main-deps` tests pass.
- [2026-02-20T09:35:02Z] progress: prebuilt setup-window focus handlers (`maybeFocusExistingAnilistSetupWindow`, `maybeFocusExistingJellyfinSetupWindow`) and injected them into corresponding main deps builders in `main.ts`.
- [2026-02-20T09:35:02Z] test: `bun run build` pass (expected macOS helper Swift cache fallback) + setup-window suites pass (`anilist-setup-window*`, `jellyfin-setup-window*`).
- [2026-02-20T09:37:12Z] progress: completed one consolidated 5-block normalization batch in `main.ts` by prebuilding finalized deps objects before handler creation for `getConfiguredShortcuts`, `registerGlobalShortcuts`, `refreshGlobalAndOverlayShortcuts`, `appendToMpvLog`, and `showMpvOsd`.
- [2026-02-20T09:37:12Z] test: `bun run build` pass (expected macOS helper Swift cache fallback) + targeted suites pass for `global-shortcuts*` and `mpv-osd-log*`.

View File

@@ -2476,9 +2476,10 @@ const buildGetConfiguredShortcutsMainDepsHandler = createBuildGetConfiguredShort
resolveConfiguredShortcuts,
},
);
const getConfiguredShortcutsHandler = createGetConfiguredShortcutsHandler({
...buildGetConfiguredShortcutsMainDepsHandler(),
});
const getConfiguredShortcutsMainDeps = buildGetConfiguredShortcutsMainDepsHandler();
const getConfiguredShortcutsHandler = createGetConfiguredShortcutsHandler(
getConfiguredShortcutsMainDeps,
);
const buildRegisterGlobalShortcutsMainDepsHandler =
createBuildRegisterGlobalShortcutsMainDepsHandler({
@@ -2490,9 +2491,10 @@ const buildRegisterGlobalShortcutsMainDepsHandler =
isDev,
getMainWindow: () => overlayManager.getMainWindow(),
});
const registerGlobalShortcutsHandler = createRegisterGlobalShortcutsHandler({
...buildRegisterGlobalShortcutsMainDepsHandler(),
});
const registerGlobalShortcutsMainDeps = buildRegisterGlobalShortcutsMainDepsHandler();
const registerGlobalShortcutsHandler = createRegisterGlobalShortcutsHandler(
registerGlobalShortcutsMainDeps,
);
const buildRefreshGlobalAndOverlayShortcutsMainDepsHandler =
createBuildRefreshGlobalAndOverlayShortcutsMainDepsHandler({
@@ -2500,9 +2502,11 @@ const buildRefreshGlobalAndOverlayShortcutsMainDepsHandler =
registerGlobalShortcuts: () => registerGlobalShortcuts(),
syncOverlayShortcuts: () => syncOverlayShortcuts(),
});
const refreshGlobalAndOverlayShortcutsHandler = createRefreshGlobalAndOverlayShortcutsHandler({
...buildRefreshGlobalAndOverlayShortcutsMainDepsHandler(),
});
const refreshGlobalAndOverlayShortcutsMainDeps =
buildRefreshGlobalAndOverlayShortcutsMainDepsHandler();
const refreshGlobalAndOverlayShortcutsHandler = createRefreshGlobalAndOverlayShortcutsHandler(
refreshGlobalAndOverlayShortcutsMainDeps,
);
function registerGlobalShortcuts(): void {
registerGlobalShortcutsHandler();
@@ -2544,9 +2548,8 @@ const buildAppendToMpvLogMainDepsHandler = createBuildAppendToMpvLogMainDepsHand
appendFileSync: (targetPath, data, options) => fs.appendFileSync(targetPath, data, options),
now: () => new Date(),
});
const appendToMpvLogHandler = createAppendToMpvLogHandler({
...buildAppendToMpvLogMainDepsHandler(),
});
const appendToMpvLogMainDeps = buildAppendToMpvLogMainDepsHandler();
const appendToMpvLogHandler = createAppendToMpvLogHandler(appendToMpvLogMainDeps);
const buildShowMpvOsdMainDepsHandler = createBuildShowMpvOsdMainDepsHandler({
appendToMpvLog: (message) => appendToMpvLog(message),
@@ -2555,9 +2558,8 @@ const buildShowMpvOsdMainDepsHandler = createBuildShowMpvOsdMainDepsHandler({
getMpvClient: () => appState.mpvClient,
logInfo: (line) => logger.info(line),
});
const showMpvOsdHandler = createShowMpvOsdHandler({
...buildShowMpvOsdMainDepsHandler(),
});
const showMpvOsdMainDeps = buildShowMpvOsdMainDepsHandler();
const showMpvOsdHandler = createShowMpvOsdHandler(showMpvOsdMainDeps);
function showMpvOsd(text: string): void {
showMpvOsdHandler(text);