Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var transformJs = require("@lingui/babel-plugin-transform-js").default
var transformReact = require("@lingui/babel-plugin-transform-react").default
module.exports = function(context, opts) {
return {
plugins: [transformJs, transformReact]
}
}
function macro({ references, state, babel }) {
const { types: t } = babel
const transformer = makeJsTransformer(babel)
const jsxTransformer = new JSXTransformer(babel)
const reactImportsToCarryOver = ["DateFormat", "NumberFormat"]
const reactImports = []
Object.keys(references).forEach(tagName => {
const tags = references[tagName]
const macroType = getMacroType(tagName)
if (macroType === "jsx") {
if (!reactImports.includes("Trans")) {
reactImports.push("Trans")
}
if (reactImportsToCarryOver.includes(tagName)) {
reactImports.push(tagName)
}