Support aliased class names in lucide-react

This commit is contained in:
Eric Fennis
2025-03-19 10:58:24 +01:00
parent 1efc9eb8b5
commit 4edcf24fc9
5 changed files with 21 additions and 6 deletions

View File

@@ -8,10 +8,12 @@ export default async ({
getSvg,
deprecated,
deprecationReason,
iconNameAliases,
}) => {
const svgContents = await getSvg();
const svgBase64 = base64SVG(svgContents);
return `
import createLucideIcon from '../createLucideIcon';
import { IconNode } from '../types';
@@ -29,7 +31,7 @@ export const __iconNode: IconNode = ${JSON.stringify(children)}
* @returns {JSX.Element} JSX Element
* ${deprecated ? `@deprecated ${deprecationReason}` : ''}
*/
const ${componentName} = createLucideIcon('${componentName}', __iconNode);
const ${componentName} = createLucideIcon('${componentName}', __iconNode${iconNameAliases != null ? `, ${JSON.stringify(iconNameAliases)}` : ''});
export default ${componentName};
`;