mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-02-28 06:22:45 -08:00
refactor(main): add runtime domain registry and fan-in guardrails
Introduce runtime domain barrel exports and registry composition support, and document/check main runtime fan-in workflow with related backlog planning artifacts.
This commit is contained in:
16
src/main/runtime/domains/anilist.ts
Normal file
16
src/main/runtime/domains/anilist.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
export * from '../anilist-media-guess';
|
||||
export * from '../anilist-media-guess-main-deps';
|
||||
export * from '../anilist-media-state';
|
||||
export * from '../anilist-media-state-main-deps';
|
||||
export * from '../anilist-post-watch';
|
||||
export * from '../anilist-post-watch-main-deps';
|
||||
export * from '../anilist-setup';
|
||||
export * from '../anilist-setup-protocol';
|
||||
export * from '../anilist-setup-protocol-main-deps';
|
||||
export * from '../anilist-setup-window';
|
||||
export * from '../anilist-setup-window-main-deps';
|
||||
export * from '../anilist-state';
|
||||
export * from '../anilist-token-refresh';
|
||||
export * from '../anilist-token-refresh-main-deps';
|
||||
export * from '../protocol-url-handlers';
|
||||
export * from '../protocol-url-handlers-main-deps';
|
||||
8
src/main/runtime/domains/index.ts
Normal file
8
src/main/runtime/domains/index.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
export * as anilist from './anilist';
|
||||
export * as jellyfin from './jellyfin';
|
||||
export * as ipc from './ipc';
|
||||
export * as mining from './mining';
|
||||
export * as mpv from './mpv';
|
||||
export * as overlay from './overlay';
|
||||
export * as shortcuts from './shortcuts';
|
||||
export * as startup from './startup';
|
||||
5
src/main/runtime/domains/ipc.ts
Normal file
5
src/main/runtime/domains/ipc.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export * from '../cli-command-context-factory';
|
||||
export * from '../cli-command-runtime-handler';
|
||||
export * from '../initial-args-runtime-handler';
|
||||
export * from '../ipc-mpv-command-main-deps';
|
||||
export * from '../ipc-runtime-handlers';
|
||||
24
src/main/runtime/domains/jellyfin.ts
Normal file
24
src/main/runtime/domains/jellyfin.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
export * from '../jellyfin-cli-auth';
|
||||
export * from '../jellyfin-cli-list';
|
||||
export * from '../jellyfin-cli-main-deps';
|
||||
export * from '../jellyfin-cli-play';
|
||||
export * from '../jellyfin-cli-remote-announce';
|
||||
export * from '../jellyfin-client-info';
|
||||
export * from '../jellyfin-client-info-main-deps';
|
||||
export * from '../jellyfin-command-dispatch';
|
||||
export * from '../jellyfin-command-dispatch-main-deps';
|
||||
export * from '../jellyfin-playback-launch';
|
||||
export * from '../jellyfin-playback-launch-main-deps';
|
||||
export * from '../jellyfin-remote-commands';
|
||||
export * from '../jellyfin-remote-connection';
|
||||
export * from '../jellyfin-remote-connection-main-deps';
|
||||
export * from '../jellyfin-remote-main-deps';
|
||||
export * from '../jellyfin-remote-playback';
|
||||
export * from '../jellyfin-remote-session-lifecycle';
|
||||
export * from '../jellyfin-remote-session-main-deps';
|
||||
export * from '../jellyfin-setup-window';
|
||||
export * from '../jellyfin-setup-window-main-deps';
|
||||
export * from '../jellyfin-subtitle-preload';
|
||||
export * from '../jellyfin-subtitle-preload-main-deps';
|
||||
export * from '../mpv-jellyfin-defaults';
|
||||
export * from '../mpv-jellyfin-defaults-main-deps';
|
||||
4
src/main/runtime/domains/mining.ts
Normal file
4
src/main/runtime/domains/mining.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export * from '../anki-actions';
|
||||
export * from '../anki-actions-main-deps';
|
||||
export * from '../mining-actions';
|
||||
export * from '../mining-actions-main-deps';
|
||||
9
src/main/runtime/domains/mpv.ts
Normal file
9
src/main/runtime/domains/mpv.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export * from '../mpv-client-runtime-service';
|
||||
export * from '../mpv-client-runtime-service-main-deps';
|
||||
export * from '../mpv-main-event-bindings';
|
||||
export * from '../mpv-main-event-main-deps';
|
||||
export * from '../mpv-osd-runtime-handlers';
|
||||
export * from '../mpv-subtitle-render-metrics';
|
||||
export * from '../mpv-subtitle-render-metrics-main-deps';
|
||||
export * from '../secondary-sub-mode-runtime-handler';
|
||||
export * from '../subtitle-tokenization-main-deps';
|
||||
22
src/main/runtime/domains/overlay.ts
Normal file
22
src/main/runtime/domains/overlay.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
export * from '../config-hot-reload-handlers';
|
||||
export * from '../config-hot-reload-main-deps';
|
||||
export * from '../field-grouping-overlay-main-deps';
|
||||
export * from '../field-grouping-resolver';
|
||||
export * from '../field-grouping-resolver-main-deps';
|
||||
export * from '../overlay-bootstrap-main-deps';
|
||||
export * from '../overlay-main-actions';
|
||||
export * from '../overlay-main-actions-main-deps';
|
||||
export * from '../overlay-runtime-bootstrap-handlers';
|
||||
export * from '../overlay-runtime-main-actions';
|
||||
export * from '../overlay-runtime-main-actions-main-deps';
|
||||
export * from '../overlay-visibility-runtime';
|
||||
export * from '../overlay-visibility-runtime-main-deps';
|
||||
export * from '../overlay-window-layout';
|
||||
export * from '../overlay-window-layout-main-deps';
|
||||
export * from '../overlay-window-runtime-handlers';
|
||||
export * from '../subtitle-position';
|
||||
export * from '../subtitle-position-main-deps';
|
||||
export * from '../tray-runtime';
|
||||
export * from '../tray-runtime-handlers';
|
||||
export * from '../yomitan-extension-runtime';
|
||||
export * from '../yomitan-settings-runtime';
|
||||
5
src/main/runtime/domains/shortcuts.ts
Normal file
5
src/main/runtime/domains/shortcuts.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export * from '../global-shortcuts-runtime-handlers';
|
||||
export * from '../numeric-shortcut-runtime-main-deps';
|
||||
export * from '../numeric-shortcut-session-runtime-handlers';
|
||||
export * from '../overlay-shortcuts-runtime-handlers';
|
||||
export * from '../overlay-shortcuts-runtime-main-deps';
|
||||
19
src/main/runtime/domains/startup.ts
Normal file
19
src/main/runtime/domains/startup.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
export * from '../app-lifecycle-actions';
|
||||
export * from '../app-lifecycle-main-activate';
|
||||
export * from '../app-lifecycle-main-cleanup';
|
||||
export * from '../app-ready-main-deps';
|
||||
export * from '../clipboard-queue';
|
||||
export * from '../config-derived';
|
||||
export * from '../dictionary-runtime-main-deps';
|
||||
export * from '../immersion-media';
|
||||
export * from '../immersion-startup';
|
||||
export * from '../immersion-startup-main-deps';
|
||||
export * from '../media-runtime-main-deps';
|
||||
export * from '../runtime-bootstrap-main-deps';
|
||||
export * from '../startup-config';
|
||||
export * from '../startup-config-main-deps';
|
||||
export * from '../startup-runtime-handlers';
|
||||
export * from '../startup-warmups';
|
||||
export * from '../startup-warmups-main-deps';
|
||||
export * from '../subtitle-processing-main-deps';
|
||||
export * from '../subsync-runtime';
|
||||
46
src/main/runtime/registry.test.ts
Normal file
46
src/main/runtime/registry.test.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
|
||||
async function loadRegistryOrSkip(t: test.TestContext) {
|
||||
try {
|
||||
return await import('./registry');
|
||||
} catch (error) {
|
||||
if (error instanceof Error && error.message.includes('node:sqlite')) {
|
||||
t.skip('registry import requires node:sqlite support in this runtime');
|
||||
return null;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
test('createMainRuntimeRegistry exposes expected runtime domains', async (t) => {
|
||||
const loaded = await loadRegistryOrSkip(t);
|
||||
if (!loaded) return;
|
||||
const { createMainRuntimeRegistry } = loaded;
|
||||
const registry = createMainRuntimeRegistry();
|
||||
|
||||
assert.ok(registry.anilist);
|
||||
assert.ok(registry.jellyfin);
|
||||
assert.ok(registry.overlay);
|
||||
assert.ok(registry.startup);
|
||||
assert.ok(registry.mpv);
|
||||
assert.ok(registry.shortcuts);
|
||||
assert.ok(registry.ipc);
|
||||
assert.ok(registry.mining);
|
||||
});
|
||||
|
||||
test('registry domains expose representative factories', async (t) => {
|
||||
const loaded = await loadRegistryOrSkip(t);
|
||||
if (!loaded) return;
|
||||
const { createMainRuntimeRegistry } = loaded;
|
||||
const registry = createMainRuntimeRegistry();
|
||||
|
||||
assert.equal(typeof registry.anilist.createNotifyAnilistSetupHandler, 'function');
|
||||
assert.equal(typeof registry.jellyfin.createRunJellyfinCommandHandler, 'function');
|
||||
assert.equal(typeof registry.overlay.createOverlayVisibilityRuntime, 'function');
|
||||
assert.equal(typeof registry.startup.createStartupRuntimeHandlers, 'function');
|
||||
assert.equal(typeof registry.mpv.createMpvClientRuntimeServiceFactory, 'function');
|
||||
assert.equal(typeof registry.shortcuts.createGlobalShortcutsRuntimeHandlers, 'function');
|
||||
assert.equal(typeof registry.ipc.createIpcRuntimeHandlers, 'function');
|
||||
assert.equal(typeof registry.mining.createMineSentenceCardHandler, 'function');
|
||||
});
|
||||
7
src/main/runtime/registry.ts
Normal file
7
src/main/runtime/registry.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import * as domains from './domains';
|
||||
|
||||
export type MainRuntimeRegistry = typeof domains;
|
||||
|
||||
export function createMainRuntimeRegistry(): MainRuntimeRegistry {
|
||||
return domains;
|
||||
}
|
||||
Reference in New Issue
Block a user