```
/** The KEY=VALUE pairs of a config file. */
export function parseConfig(text: string): Record<string, string> {
  const config: Record<string, string> = {};
  text.split("\n")
    .map(line => line.trim())
    .filter(line => !line.startsWith("#") && line.length > 0)
    .forEach(line => {
      const [key, value] = line.split("=", 2);
      if (!key || key === "__proto__" || key.includes("=")) {
        throw new Error(`Invalid line: ${line}`);
      }
      config[key] = value ?? "";
    });
  return config;
}
```