mirror of
https://github.com/lucide-icons/lucide.git
synced 2026-11-10 13:18:25 +00:00
* feat(svelte): export __iconData and __iconNode across per-icon modules (#4936) * Refactor imports in lucide-svelte.spec.ts Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * fix(build-icons): scope per-icon data re-exports behind exportIconData flag - Problem: generateAliasesFiles unconditionally re-exported __iconData and __iconNode for all packages using separateAliasesFile. Packages like @lucide/solid and @lucide/icons do not export these names from their templates, causing missing export errors in downstream bundlers (e.g. solid vite integration). - Solution: Add exportIconData flag (default false) to CLI, generateIconFiles, and generateAliasesFiles so named re-exports are opt-in and only emitted for packages that define them (@lucide/svelte). * refactor(svelte): remove tools/build-icons changes per maintainer review --------- Co-authored-by: Eric Fennis <eric.fennis@gmail.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import base64SVG from '@lucide/build-icons/utils/base64SVG';
|
|
import { getHTMLBanner } from './license.mts';
|
|
import defineExportTemplate from '@lucide/build-icons/utils/defineExportTemplate';
|
|
|
|
export default defineExportTemplate(
|
|
async ({ iconName, iconData, getSvg, deprecated, deprecationReason }) => {
|
|
const svgContents = await getSvg();
|
|
const svgBase64 = base64SVG(svgContents);
|
|
|
|
return `\
|
|
${getHTMLBanner()}
|
|
<script module lang="ts">
|
|
import type { LucideIconData, LucideIconNode } from '../types.js';
|
|
|
|
export const __iconData: LucideIconData = ${JSON.stringify(iconData)};
|
|
|
|
/**
|
|
* @deprecated Access \`__iconData\` instead.
|
|
*/
|
|
export const __iconNode: LucideIconNode[] = __iconData.node;
|
|
</script>
|
|
|
|
<script lang="ts">
|
|
import Icon from '../Icon.svelte';
|
|
import type { LucideProps } from '../types.js';
|
|
|
|
let props: LucideProps = $props();
|
|
|
|
</script>
|
|
|
|
<!--
|
|
@component
|
|
|
|
Lucide SVG icon component, renders SVG Element with children.
|
|
|
|
@preview  - https://lucide.dev/icons/${iconName}
|
|
@see https://lucide.dev/guide/packages/lucide-svelte - Documentation
|
|
${deprecated ? `\n@deprecated ${deprecationReason}\n` : ''}\
|
|
-->
|
|
|
|
<Icon {...props} icon={__iconData} />
|
|
`;
|
|
},
|
|
);
|