/** Name of the first function defined in a .m source, or null for a plain script. */ export function extractFunctionName(source: string): string | null { const m = source.match(/^\s*function\s+(?:\[[^\]]*\]\s*=\s*|\w+\s*=\s*)?([A-Za-z]\w*)\s*\(/m); return m ? m[1] : null; }