(error)
| 24 | }; |
| 25 | |
| 26 | function createParseError(error) { |
| 27 | const { message, lineNumber, column } = error; |
| 28 | |
| 29 | /* c8 ignore next 3 */ |
| 30 | if (typeof lineNumber !== "number") { |
| 31 | return error; |
| 32 | } |
| 33 | |
| 34 | return createError(message, { |
| 35 | loc: { start: { line: lineNumber, column } }, |
| 36 | cause: error, |
| 37 | }); |
| 38 | } |
| 39 | |
| 40 | function parse(text, options) { |
| 41 | const sourceType = getSourceType(options?.filepath); |