import { STIM_VERSION } from '../stim-version.ts'; import { exactBuildEnv, exactCheckoutDir, exactOffloadPlan, exactPayloadParam, exactPinsParam, exactProjectProblem, exactToolProblems, type ExactPins, } from './exact-offload.ts'; import { exactIosPlugin } from './exact-plugin.ts'; import type { IosPluginOffload, IosPluginSource } from './plugin-ios.ts'; const EXACT_OFFLOAD: IosPluginOffload }> = { plan(root, env) { const planned = exactOffloadPlan(root, env); if ('unsupported' in planned) return planned; const { name, env: settings, link, ...pins } = planned; return { pins, payload: { env: settings }, checkout: { name, sibling: link } }; }, pins: exactPinsParam, payload: exactPayloadParam, malformed: { offer: 'An Exact offer needs the exact2 commit and the Bun and Rust versions.', start: 'An Exact build needs an iOS request with its app name, pins and settings.', }, tools: exactToolProblems, source: (pins) => ({ dir: exactCheckoutDir(pins), commit: pins.exact2 }), project: exactProjectProblem, env: exactBuildEnv, }; export const EXACT_PLUGIN: IosPluginSource = { id: 'exact', name: 'Exact', version: STIM_VERSION, ios: exactIosPlugin, offload: EXACT_OFFLOAD, }; /** The built-in iOS plugin `id` names, or null. */ export function iosPlugin(id: string): IosPluginSource | null { return id === EXACT_PLUGIN.id ? EXACT_PLUGIN : null; }