(text)
| 11 | const parseOptions = { uniqueKeys: false }; |
| 12 | |
| 13 | function parse(text) { |
| 14 | let root; |
| 15 | try { |
| 16 | root = parseYaml(text, parseOptions); |
| 17 | } catch (error) { |
| 18 | if (error instanceof YAMLSyntaxError) { |
| 19 | throw createError(error.message, { |
| 20 | loc: error.position, |
| 21 | cause: error, |
| 22 | }); |
| 23 | } |
| 24 | |
| 25 | /* c8 ignore next */ |
| 26 | throw error; |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * suppress `comment not printed` error |
| 31 | * |
| 32 | * comments are handled in printer-yaml.js without using `printComment` |
| 33 | * so that it'll always throw errors even if we printed it correctly |
| 34 | */ |
| 35 | delete root.comments; |
| 36 | |
| 37 | return root; |
| 38 | } |
| 39 | |
| 40 | export const yaml = { |
| 41 | astFormat: "yaml", |
no test coverage detected