Skip to content

feat(svelte): export __iconData and __iconNode across per-icon modules (#4936) - #4957

Merged
ericfennis merged 9 commits into
lucide-icons:mainfrom
ronitgupta138:feat/svelte-export-icon-data
Oct 19, 2026
Merged

ericfennis merged 9 commits into
lucide-icons:mainfrom
ronitgupta138:feat/svelte-export-icon-data

Conversation

@ronitgupta138

Copy link
Copy Markdown
Contributor

Problem

Follow-up to #4644 and #4761.

While lucide-react, lucide-preact, lucide-solid, and lucide-react-native export __iconData and __iconNode from individual icon modules, @lucide/svelte previously inlined iconData privately within its instance script, leaving consumers and animation/morphing tools without a way to access raw icon geometry directly from @lucide/svelte/icons/*.

Solution

  1. Export __iconData and __iconNode in <script module lang="ts">: Updated packages/svelte/scripts/exportTemplate.mts to declare __iconData: LucideIconData and deprecated __iconNode: LucideIconNode[] inside the module script so they are exported as real, tree-shakeable module exports.
  2. Update separate icon and alias shims: Updated tools/build-icons/building/generateIconFiles.ts and tools/build-icons/building/aliases/generateAliasesFiles.ts so that separate icon shims (dist/icons/*.js and dist/icons/*.d.ts) re-export { default, __iconData, __iconNode }.
  3. Parity and Backwards Compatibility: Retains full compatibility with existing default component imports while matching the export signature of the other framework packages.

Testing

  • Added unit tests in packages/svelte/tests/lucide-svelte.spec.ts verifying that __iconData and __iconNode are exported and match the icon's node definition.
  • Verified all 20 test cases pass in @lucide/svelte.
  • Ran svelte-check and full package builds (0 errors, 0 warnings).

Fixes #4936.

Copilot AI balanced review requested due to automatic review settings October 3, 2026 18:49

This comment was marked as low quality.

Copilot AI balanced review requested due to automatic review settings October 9, 2026 12:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Blocking lint and cross-package alias-generation issues must be addressed.

2 open findings

🧠 Review effort: Lite

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Copilot AI lite review requested due to automatic review settings October 9, 2026 12:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Scope alias re-exports to templates that define the named exports to avoid breaking Solid and Icons builds.

0 open findings

2 resolved since last review

🧠 Review effort: Lite

…a 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).
Copilot AI lite review requested due to automatic review settings October 9, 2026 16:08
@github-actions github-actions Bot added the 🧣 svelte package About the Svelte package label Oct 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Alias subpath TypeScript declarations need updated package-level type mapping and coverage.

0 open findings

🧠 Review effort: Lite

@ericfennis ericfennis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the overal changes.
But I don't like the changes in tools/build-icons/* can you remove these?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The scoped export changes preserve default imports and have focused test coverage.

0 open findings

🧠 Review effort: Lite

Copilot AI lite review requested due to automatic review settings October 15, 2026 17:23
@ronitgupta138

Copy link
Copy Markdown
Contributor Author

Done @ericfennis! Completely reverted all changes in tools/build-icons/* and packages/svelte/package.json. The __iconData and __iconNode exports are now strictly scoped to @lucide/svelte via its export template, and unit tests pass cleanly.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Update the public shims and test the extensionless per-icon entry point.

1 open finding

🧠 Review effort: Lite

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved module/instance scope and public shim export issues remain.

3 open issues

Review effort: Lite

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Public icon shims do not yet expose the new named exports or have coverage for that path.

No open issues 🎉

3 resolved since last review

Review effort: Lite

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Public icon shims do not yet expose the new named exports, and tests do not cover the shipped entry point.

No open issues 🎉

Review effort: Lite

@ericfennis
ericfennis merged commit 02eb916 into lucide-icons:main Oct 19, 2026
12 checks passed
brandhaug added a commit to brandhaug/b2b-saas-starter that referenced this pull request Oct 23, 2026
## pnpm-workspace.yaml (default)

## Dependency Updates

| Package | From | To | Type |
| --- | --- | --- | --- |
| `lucide-react` | 1.59.0 | 1.60.0 | minor |

## Release Notes

<details>
<summary><b>lucide-react</b> (1.59.0 → 1.60.0)</summary>

## What's Changed
* feat(icons): added `tombstone` icon by @<!---->ryck in
lucide-icons/lucide#4929
* feat(icons): added `smartphone-user-round` icon by
@<!---->hitanshu-machhi in
lucide-icons/lucide#4586
* feat(icons): added `bacon` icon by @<!---->devkamani9313-lab in
lucide-icons/lucide#4694
* fix(site): Fix build by @<!---->ericfennis in
lucide-icons/lucide#5033
* chore(docs): Update icon count comparison with Feather Icons by
@<!---->noahweidig in lucide-icons/lucide#5022
* feat(icons): added `letter-spacing` icon by @<!---->madebyoz in
lucide-icons/lucide#3038
* chore(deps): bump the vue-deps group with 2 updates by
@<!---->dependabot[bot] in
lucide-icons/lucide#5027
* chore(deps-dev): bump react-native from 0.87.1 to 0.88.0 in the
react-native-deps group by @<!---->dependabot[bot] in
lucide-icons/lucide#5030
* feat(icons): added `line-height` icon by @<!---->madebyoz in
lucide-icons/lucide#3039
* chore(deps-dev): bump the svelte-deps group across 1 directory with 2
updates by @<!---->dependabot[bot] in
lucide-icons/lucide#5028
* chore(deps): bump the react-deps group across 1 directory with 2
updates by @<!---->dependabot[bot] in
lucide-icons/lucide#5026
* feat(icons): added `brain-off` icon by @<!---->ej52 in
lucide-icons/lucide#3535
* feat(icons): added `graph-hub` icon by @<!---->Carlito-la-banane in
lucide-icons/lucide#4974
* feat(svelte): export __iconData and __iconNode across per-icon modules
(#4936) by @<!---->ronitgupta138 in
lucide-icons/lucide#4957

## New Contributors
* @<!---->hitanshu-machhi made their first contribution in
lucide-icons/lucide#4586
* @<!---->devkamani9313-lab made their first contribution in
lucide-icons/lucide#4694
* @<!---->noahweidig made their first contribution in

…[full
notes](https://github.com/lucide-icons/lucide/releases/tag/1.60.0)

</details>

---
*This PR was auto-generated by
[catalog-update-action](https://github.com/brandhaug/catalog-update-action).*

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

This branch was successfully deployed

1 active deployment
Preview — b0e9d914 Deployed Oct 19, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🧣 svelte package About the Svelte package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@lucide/svelte: export per-icon __iconData (follow-up to #4644 / #4761)

3 participants