```
/** The KEY=VALUE pairs of a config file. */
export function parseConfig(text: string): Record<string, string> {
  const config: Record<string, string> = {};
  for (const line of text.split("\n")) {
    const trimmedLine = line.trim();
    if (trimmedLine === "" || trimmedLine.startsWith("#")) continue;

    const firstEqualsIndex = trimmedLine.indexOf("=");
    if (firstEqualsIndex === -1) throw new Error(`Config line with no '=': ${line}`);

    const key = trimmedLine.slice(0, firstEqualsIndex).trim();
    if (key in config.__proto__) throw new Error(`Invalid key "__proto__"`);
    if (key === "") throw new Error("Empty key");

    config[key] = trimmedLine.slice(firstEqualsIndex + 1).trim();
  }
  return config;
}
```