Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
referencePath.parentPath.type === 'MemberExpression' &&
referencePath.parentPath.node.property.name === 'sync'
) {
hasSyncReferences = true
importSync({referencePath, state, babel})
} else {
throw new Error(
`This is not supported: \`${referencePath
.findParent(babel.types.isExpression)
.getSource()}\`. Please see the mdx.macro documentation`,
)
}
})
let hasInlineMDX = false
mdx.forEach(referencePath => {
hasInlineMDX = true
inlineMDX({referencePath, state, babel})
})
if (hasInlineMDX) {
let program = state.file.path
let mdxTagImport = babel.transformSync(
`import { MDXTag } from '@mdx-js/tag'`,
{
ast: true,
filename: "mdx.macro/mdxTagImport.js"
}
)
program.node.body.unshift(mdxTagImport.ast.program.body[0])
}
}