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