Skip to content

Feat/add provider lucide#72

Merged
4sllan merged 12 commits into
mainfrom
feat/add-provider-lucide
Mar 15, 2026
Merged

Feat/add provider lucide#72
4sllan merged 12 commits into
mainfrom
feat/add-provider-lucide

Conversation

@4sllan

@4sllan 4sllan commented Mar 15, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features
    • Option to choose between Feather and Lucide icon libraries in the module (defaults to Lucide).
  • Chores
    • Bumped release to v1.4.2 and added Lucide as a runtime dependency.
  • Documentation
    • Updated changelog and release notes for v1.4.2.

aslan.gama added 6 commits March 15, 2026 06:06
- Refactor buildIcons to accept options for provider selection
- Update cache structure to store icons per provider
- Extract icon retrieval logic for extensibility
…ther and Lucide icons

- Add `provider` option to select between Feather and Lucide icons
- Set default provider to `lucide`
- Update build logic to use the selected provider for icon generation
- Add runtime configuration for the new provider option
- Add Feather provider implementation
- Add Lucide provider implementation
- Add providers module index
- Remove hardcoded feather import to enable provider switching
- Support dynamic selection between different icon sets
@coderabbitai

coderabbitai Bot commented Mar 15, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@4sllan has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 13 minutes and 17 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f40499f0-e246-4d8b-92bc-6878d575a954

📥 Commits

Reviewing files that changed from the base of the PR and between 42364e1 and 70fe473.

📒 Files selected for processing (2)
  • src/runtime/build.ts
  • src/runtime/providers/lucide.ts
📝 Walkthrough

Walkthrough

Adds multi-provider icon support by introducing a provider abstraction (feather|lucide), normalizing provider icon data, updating the build pipeline to accept ModuleOptions (including provider), adding lucide as a dependency, and generating per-provider icon components with per-provider caching.

Changes

Cohort / File(s) Summary
Configuration & Release
package.json, CHANGELOG.md
Bump version to 1.4.2, add lucide dependency, and add CHANGELOG entry for v1.4.2.
Module API / Setup
src/module.ts
Add `provider?: 'feather'
Build Pipeline
src/runtime/build.ts
Change buildIcons signature to accept ModuleOptions, derive provider from options, use getIcons(provider), implement per-provider cache and generate components from normalized icon data.
Providers Layer
src/runtime/providers/index.ts, src/runtime/providers/feather.ts, src/runtime/providers/lucide.ts
Add IconNormalized type and getIcons(provider) dispatcher; add getFeatherIcons() and getLucideIcons() to normalize icon sets (lucide loaded dynamically and node→SVG string conversion).

Sequence Diagram

sequenceDiagram
    participant Setup as Module Setup
    participant Build as buildIcons()
    participant Provider as getIcons(provider)
    participant Feather as getFeatherIcons()
    participant Lucide as getLucideIcons()
    participant FS as File System

    Setup->>Build: buildIcons(nuxt, options)
    Build->>Provider: getIcons(options.provider)
    alt provider == 'lucide'
        Provider->>Lucide: getLucideIcons()
        Lucide->>Lucide: load lucide, normalize icons
        Lucide->>Provider: return IconNormalized[]
    else provider == 'feather'
        Provider->>Feather: getFeatherIcons()
        Feather->>Feather: iterate feather.icons, normalize
        Feather->>Provider: return IconNormalized[]
    end
    Provider->>Build: icons[]
    Build->>Build: cache per-provider (cache[provider])
    Build->>FS: write generated component files
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • Release #7: Modifies module entrypoints and the icon build pipeline (changes to src/module.ts and src/runtime/build.ts), directly related to provider/options handling.

Poem

🐰 I hopped in with ears so wide,
Lucide gleamed at my side,
Icons normalized, tidy and bright,
Hopping files into the light,
A rabbit’s joyful code-time bite.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main objective of the pull request: adding Lucide as a provider option for icon selection alongside the existing Feather provider.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/add-provider-lucide
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/module.ts (1)

61-67: ⚠️ Potential issue | 🟠 Major

Provider default inconsistency with build.ts.

The default provider here is 'lucide', but in src/runtime/build.ts line 80, the fallback is 'feather':

const provider = options.provider || 'feather'  // build.ts line 80

This inconsistency could cause unexpected behavior if options.provider is somehow undefined when reaching buildIcons().

🔧 Proposed fix in src/runtime/build.ts
 export async function buildIcons(nuxt: Nuxt, options: ModuleOptions): Promise<ModuleIconsNames[]> {
-    const provider = options.provider || 'feather'
+    const provider = options.provider || 'lucide'
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/module.ts` around lines 61 - 67, The default provider in the module
defaults object is 'lucide' but build.ts falls back to 'feather', causing
inconsistent behavior; update the defaults.provider value in the defaults object
(the defaults: {...} entry in module.ts) to 'feather' so it matches the provider
fallback used in buildIcons()/src/runtime/build.ts, ensuring both places use the
same default provider.
🧹 Nitpick comments (2)
src/runtime/build.ts (1)

58-65: CSS classes are hardcoded to 'feather' regardless of provider.

The template component generates CSS classes 'feather' and 'feather-${name}' (lines 60-61) even when using the Lucide provider. Consider making these classes provider-aware to avoid confusion and enable provider-specific styling.

♻️ Proposed approach

Pass the provider to templateComponent and generate appropriate class names:

-const templateComponent = (attrs: FeatherAttrs, innerHTML: string, componentName: string, name: string) => `
+const templateComponent = (attrs: FeatherAttrs, innerHTML: string, componentName: string, name: string, provider: string) => `
 ...
     const classes = computed(() => {
       return [
-        'feather', 
-        'feather-${name || ""}', 
+        '${provider}', 
+        '${provider}-${name || ""}', 
         config.class, 
         props.class
       ].filter(Boolean).join(' ').trim()
     })

Then update the call site in buildIcons:

const component = templateComponent(
    icon.attrs,
    icon.contents,
    icon.componentPascalName,
    icon.name,
    provider  // Add provider argument
)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/runtime/build.ts` around lines 58 - 65, The computed classes in
templateComponent currently hardcode 'feather' and 'feather-${name}' which
ignores the selected provider; update the classes generation inside the computed
named classes to use the provider variable (e.g., `${provider}` and
`${provider}-${name || ""}`) instead of 'feather', add a provider parameter to
templateComponent's signature so it can use that value, and update the
buildIcons call site where templateComponent is invoked (replace
templateComponent(..., icon.name) with templateComponent(..., icon.name,
provider)) so provider-aware class names are emitted while still including
config.class and props.class.
src/runtime/providers/lucide.ts (1)

20-27: Consider using self-closing tags for void SVG elements.

The current implementation generates <path ...></path> instead of <path ... />. While functionally equivalent, self-closing tags are more idiomatic for SVG void elements like path, circle, line, etc.

♻️ Proposed fix for self-closing tags
         const contents = nodes
             .map(([tagName, attrs]: [string, any]) => {
                 const attrString = Object.entries(attrs || {})
                     .map(([k, v]) => `${k}="${v}"`)
                     .join(' ')
-                return `<${tagName} ${attrString}></${tagName}>`
+                return `<${tagName} ${attrString} />`
             })
             .join('')
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/runtime/providers/lucide.ts` around lines 20 - 27, The generated SVG node
string in the contents mapping currently always uses an open/close pair; update
the mapping in src/runtime/providers/lucide.ts (the nodes => map block that
builds contents) to emit self-closing tags for SVG void elements (e.g., path,
circle, rect, line, polyline, polygon, stop, use, rect, img, etc.): check
tagName against a small set/array of void SVG tag names and, when matched,
return `<${tagName}${attrString ? ' ' + attrString : ''} />` (no closing tag);
otherwise keep the existing `<${tagName}${attrString ? ' ' + attrString :
''}></${tagName}>` behavior so non-void elements remain unchanged. Ensure
attrString is built the same way so spacing is correct when there are no
attributes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/runtime/build.ts`:
- Around line 79-84: The provider fallback in buildIcons is incorrect: inside
the async function buildIcons(nuxt: Nuxt, options: ModuleOptions) the line that
sets const provider = options.provider || 'feather' should use the module
default 'lucide' instead; change the fallback to 'lucide' so provider is
computed as options.provider || 'lucide' and existing cache[provider] checks and
returns continue to work with the corrected default.
- Line 17: The declaration for the module icons cache uses mutable binding but
is never reassigned; change the top-level variable declaration named "cache"
from let to const so it remains a constant reference (keeping the same type
Record<string, ModuleIconsNames[]>), ensuring internal mutations still work
while preventing reassignment of the identifier.

In `@src/runtime/providers/lucide.ts`:
- Around line 3-13: Replace the runtime CommonJS require in getLucideIcons by
using a top-level ESM import for the lucide package (import the named export
that provides the icons map instead of calling require('lucide')), update the
thrown Error in getLucideIcons to an English message (e.g., "Failed to load
Lucide icons. Ensure the 'lucide' package is installed."), and convert the
Portuguese inline comments around lucide, iconsMap and subsequent blocks to
English to match the codebase; reference getLucideIcons, lucide (icons export)
and iconsMap when making these changes.

---

Outside diff comments:
In `@src/module.ts`:
- Around line 61-67: The default provider in the module defaults object is
'lucide' but build.ts falls back to 'feather', causing inconsistent behavior;
update the defaults.provider value in the defaults object (the defaults: {...}
entry in module.ts) to 'feather' so it matches the provider fallback used in
buildIcons()/src/runtime/build.ts, ensuring both places use the same default
provider.

---

Nitpick comments:
In `@src/runtime/build.ts`:
- Around line 58-65: The computed classes in templateComponent currently
hardcode 'feather' and 'feather-${name}' which ignores the selected provider;
update the classes generation inside the computed named classes to use the
provider variable (e.g., `${provider}` and `${provider}-${name || ""}`) instead
of 'feather', add a provider parameter to templateComponent's signature so it
can use that value, and update the buildIcons call site where templateComponent
is invoked (replace templateComponent(..., icon.name) with
templateComponent(..., icon.name, provider)) so provider-aware class names are
emitted while still including config.class and props.class.

In `@src/runtime/providers/lucide.ts`:
- Around line 20-27: The generated SVG node string in the contents mapping
currently always uses an open/close pair; update the mapping in
src/runtime/providers/lucide.ts (the nodes => map block that builds contents) to
emit self-closing tags for SVG void elements (e.g., path, circle, rect, line,
polyline, polygon, stop, use, rect, img, etc.): check tagName against a small
set/array of void SVG tag names and, when matched, return
`<${tagName}${attrString ? ' ' + attrString : ''} />` (no closing tag);
otherwise keep the existing `<${tagName}${attrString ? ' ' + attrString :
''}></${tagName}>` behavior so non-void elements remain unchanged. Ensure
attrString is built the same way so spacing is correct when there are no
attributes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a64a3e85-3a7d-47f2-b5a0-c244f240ad45

📥 Commits

Reviewing files that changed from the base of the PR and between 49749b9 and df9f1c2.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (7)
  • .github/CONTRIBUTING.md
  • package.json
  • src/module.ts
  • src/runtime/build.ts
  • src/runtime/providers/feather.ts
  • src/runtime/providers/index.ts
  • src/runtime/providers/lucide.ts

Comment thread src/runtime/build.ts Outdated
Comment thread src/runtime/build.ts
Comment thread src/runtime/providers/lucide.ts
aslan.gama and others added 2 commits March 15, 2026 06:24
- Switch to ES6 import syntax
- Add fallback for icons object
- Use optional chaining for children property
- Translate error messages to English

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (1)
package.json (1)

3-3: Prefer a minor version bump for this feature release.

Line 3 uses 1.4.2, but this PR introduces a new public capability (multi-provider support). Consider releasing as 1.5.0 to keep SemVer signaling clear for consumers.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@package.json` at line 3, Update the package version to a minor bump to
reflect the new public capability: change the "version" field in package.json
from "1.4.2" to "1.5.0" so the release correctly signals a minor SemVer change
for the added multi-provider support.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@package.json`:
- Line 3: Update the package version to a minor bump to reflect the new public
capability: change the "version" field in package.json from "1.4.2" to "1.5.0"
so the release correctly signals a minor SemVer change for the added
multi-provider support.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0c964146-7875-4ed2-a91b-67b33f9e3724

📥 Commits

Reviewing files that changed from the base of the PR and between df9f1c2 and 42364e1.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • package.json
✅ Files skipped from review due to trivial changes (1)
  • CHANGELOG.md

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@4sllan
4sllan merged commit 0bb77ff into main Mar 15, 2026
2 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in nuxt-feather-icons Mar 15, 2026
@4sllan
4sllan deleted the feat/add-provider-lucide branch March 15, 2026 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

1 participant