Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
id = addDefault(program, 'styled-components', { nameHint: 'styled' });
customImportName = id;
} else {
id = addNamed(program, refName, 'styled-components', { nameHint: refName });
}
// update references with the new identifiers
references[refName].forEach(referencePath => {
// eslint-disable-next-line no-param-reassign
referencePath.node.name = id.name;
});
});
// SECOND STEP : apply babel-plugin-styled-components to the file
const stateWithOpts = { ...state, opts: config, customImportName };
traverse(program.parent, babelPlugin({ types: t }).visitor, undefined, stateWithOpts);
}
id = addDefault(program, 'styled-components', { nameHint: 'styled' });
customImportName = id;
} else {
id = addNamed(program, refName, 'styled-components', { nameHint: refName });
}
// update references with the new identifiers
references[refName].forEach(referencePath => {
// eslint-disable-next-line no-param-reassign
referencePath.node.name = id.name;
});
});
// SECOND STEP : apply babel-plugin-styled-components to the file
const stateWithOpts = { ...state, opts: config, customImportName };
program.traverse(babelPlugin({ types: t }).visitor, stateWithOpts);
}