(ast, type)
| 85 | } |
| 86 | |
| 87 | function validateImportExport(ast, type) { |
| 88 | const { |
| 89 | program: { body }, |
| 90 | } = ast; |
| 91 | |
| 92 | // https://github.com/mdx-js/mdx/blob/3430138958c9c0344ecad9d59e0d6b5d72bedae3/packages/remark-mdx/extract-imports-and-exports.js#L16 |
| 93 | if ( |
| 94 | body.some( |
| 95 | (node) => |
| 96 | !( |
| 97 | node.type === "ImportDeclaration" || |
| 98 | node.type === "ExportDefaultDeclaration" || |
| 99 | node.type === "ExportNamedDeclaration" |
| 100 | ), |
| 101 | ) |
| 102 | ) { |
| 103 | throw new Error(`Unexpected '${type}' in MDX.`); |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | export default embed; |
no outgoing calls
no test coverage detected
searching dependent graphs…