import type { AsukaModuleContext } from './modules';
import type { AsukaRenderEngine } from './renderEngine';

export function getModuleEngine(context: Pick<AsukaModuleContext, 'getEngine'> | null | undefined): AsukaRenderEngine | null {
  try {
    return typeof context?.getEngine === 'function' ? context.getEngine() ?? null : null;
  } catch {
    return null;
  }
}
