Merge pull request #127 from IronRookieCoder/fix/yaml-frontmatter-node-polyfill

fix(yaml): guard Bun YAML parser availability
This commit is contained in:
linkai0924 2026-05-19 09:50:50 +08:00 committed by GitHub
commit b7153a12a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,7 +7,7 @@
*/ */
export function parseYaml(input: string): unknown { export function parseYaml(input: string): unknown {
if (typeof Bun !== 'undefined') { if (typeof Bun !== 'undefined' && Bun.YAML?.parse) {
return Bun.YAML.parse(input) return Bun.YAML.parse(input)
} }
// eslint-disable-next-line @typescript-eslint/no-require-imports // eslint-disable-next-line @typescript-eslint/no-require-imports