feat(core): add Electron runtime, services, and app composition

This commit is contained in:
2026-02-22 21:43:43 -08:00
parent 448ce03fd4
commit d3fd47f0ec
562 changed files with 69719 additions and 0 deletions
@@ -0,0 +1,55 @@
import { createBuildStartupBootstrapRuntimeFactoryDepsHandler } from './startup-bootstrap-deps-builder';
import { createBuildAppLifecycleRuntimeRunnerMainDepsHandler } from './startup-lifecycle-main-deps';
import { createBuildStartupBootstrapMainDepsHandler } from './startup-bootstrap-main-deps';
type AppLifecycleRuntimeRunnerMainDeps = Parameters<
typeof createBuildAppLifecycleRuntimeRunnerMainDepsHandler
>[0];
type StartupBootstrapMainDeps = Parameters<typeof createBuildStartupBootstrapMainDepsHandler>[0];
type StartupBootstrapRuntimeFactoryDeps = Parameters<
typeof createBuildStartupBootstrapRuntimeFactoryDepsHandler
>[0];
export function createStartupRuntimeHandlers<
TCliArgs,
TStartupState,
TStartupBootstrapRuntimeDeps = unknown,
>(deps: {
appLifecycleRuntimeRunnerMainDeps: AppLifecycleRuntimeRunnerMainDeps;
createAppLifecycleRuntimeRunner: (
params: AppLifecycleRuntimeRunnerMainDeps,
) => (args: TCliArgs) => void;
buildStartupBootstrapMainDeps: (
startAppLifecycle: (args: TCliArgs) => void,
) => StartupBootstrapMainDeps;
createStartupBootstrapRuntimeDeps: (
deps: StartupBootstrapRuntimeFactoryDeps,
) => TStartupBootstrapRuntimeDeps;
runStartupBootstrapRuntime: (deps: TStartupBootstrapRuntimeDeps) => TStartupState;
applyStartupState: (startupState: TStartupState) => void;
}) {
const appLifecycleRuntimeRunnerMainDeps =
createBuildAppLifecycleRuntimeRunnerMainDepsHandler(deps.appLifecycleRuntimeRunnerMainDeps)();
const appLifecycleRuntimeRunner = deps.createAppLifecycleRuntimeRunner(
appLifecycleRuntimeRunnerMainDeps,
);
const startupBootstrapMainDeps = createBuildStartupBootstrapMainDepsHandler(
deps.buildStartupBootstrapMainDeps(appLifecycleRuntimeRunner),
)();
const startupBootstrapRuntimeFactoryDeps =
createBuildStartupBootstrapRuntimeFactoryDepsHandler(startupBootstrapMainDeps)();
const runAndApplyStartupState = (): TStartupState => {
const startupState = deps.runStartupBootstrapRuntime(
deps.createStartupBootstrapRuntimeDeps(startupBootstrapRuntimeFactoryDeps),
);
deps.applyStartupState(startupState);
return startupState;
};
return {
appLifecycleRuntimeRunner,
runAndApplyStartupState,
};
}