source dump of claude code
at main 15 lines 525 B view raw
1/** 2 * YAML parsing wrapper. 3 * 4 * Uses Bun.YAML (built-in, zero-cost) when running under Bun, otherwise falls 5 * back to the `yaml` npm package. The package is lazy-required inside the 6 * non-Bun branch so native Bun builds never load the ~270KB yaml parser. 7 */ 8 9export function parseYaml(input: string): unknown { 10 if (typeof Bun !== 'undefined') { 11 return Bun.YAML.parse(input) 12 } 13 // eslint-disable-next-line @typescript-eslint/no-require-imports 14 return (require('yaml') as typeof import('yaml')).parse(input) 15}