yaml.ts
utils/yaml.ts
No strong subsystem tag
16
Lines
525
Bytes
1
Exports
0
Imports
10
Keywords
What this is
This page documents one file from the repository and includes its full source so you can read it without leaving the docs site.
Beginner explanation
This file is one piece of the larger system. Its name, directory, imports, and exports show where it fits. Start by reading the exports and related files first.
How it is used
Start from the exports list and related files. Those are the easiest clues for where this file fits into the system.
Expert explanation
Architecturally, this file intersects with general runtime concerns. It contains 16 lines, 0 detected imports, and 1 detected exports.
Important relationships
Detected exports
parseYaml
Keywords
yamlinputpackagetypeofparseparsingwrapperusesbuilt-inzero-cost
Detected imports
- No import paths detected.
Source notes
This page embeds the full file contents. Small or leaf files are still indexed honestly instead of being over-explained.
Full source
/**
* YAML parsing wrapper.
*
* Uses Bun.YAML (built-in, zero-cost) when running under Bun, otherwise falls
* back to the `yaml` npm package. The package is lazy-required inside the
* non-Bun branch so native Bun builds never load the ~270KB yaml parser.
*/
export function parseYaml(input: string): unknown {
if (typeof Bun !== 'undefined') {
return Bun.YAML.parse(input)
}
// eslint-disable-next-line @typescript-eslint/no-require-imports
return (require('yaml') as typeof import('yaml')).parse(input)
}