mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-10-27 11:35:23 -07:00
- Load plugins from <config dir>/plugins/<id>/ when enabled under `plugins` in config - Expose ctx with mpv events/commands, timers, subtitle context, actions, notify, exec, and panel - Bind plugin actions via `__plugin-action:<id>/<action>` keybindings (runPluginAction session action) - Add plugin-panel modal with markdown rendering; closing aborts the panel signal - Add ai-explain example plugin that queries `codex exec` for the current line - Add e2e harness `files` option and plugin e2e scenario; document plugins in docs-site and internal docs
38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
import { ConfigValidationWarning, RawConfig, ResolvedConfig } from '../types/config';
|
|
import { applyAnkiConnectResolution } from './resolve/anki-connect';
|
|
import { createResolveContext } from './resolve/context';
|
|
import { applyCoreDomainConfig } from './resolve/core-domains';
|
|
import { applyImmersionTrackingConfig } from './resolve/immersion-tracking';
|
|
import { applyIntegrationConfig } from './resolve/integrations';
|
|
import { applyPluginsConfig } from './resolve/plugins';
|
|
import { applyStatsConfig } from './resolve/stats';
|
|
import { applySubtitleDomainConfig } from './resolve/subtitle-domains';
|
|
import { applyTopLevelConfig } from './resolve/top-level';
|
|
|
|
const APPLY_RESOLVE_STEPS = [
|
|
applyTopLevelConfig,
|
|
applyCoreDomainConfig,
|
|
applySubtitleDomainConfig,
|
|
applyIntegrationConfig,
|
|
applyImmersionTrackingConfig,
|
|
applyStatsConfig,
|
|
applyPluginsConfig,
|
|
applyAnkiConnectResolution,
|
|
] as const;
|
|
|
|
export function resolveConfig(raw: RawConfig): {
|
|
resolved: ResolvedConfig;
|
|
warnings: ConfigValidationWarning[];
|
|
} {
|
|
const { context, warnings } = createResolveContext(raw);
|
|
|
|
for (const applyStep of APPLY_RESOLVE_STEPS) {
|
|
applyStep(context);
|
|
}
|
|
|
|
return {
|
|
resolved: context.resolved,
|
|
warnings,
|
|
};
|
|
}
|