fix(deps): keep Lucide SVG markup and Undici tests compatible

Build standalone SVG icons without a React context. Use accessible actions in tests and give the mocked dispatchers the interface the adapter expects.
This commit is contained in:
Maurice
2026-12-01 13:44:02 +01:00
parent 7f4ece2e6f
commit b77c246df4
15 changed files with 107 additions and 40 deletions
+2 -15
View File
@@ -1,19 +1,6 @@
import type { CSSProperties } from 'react'
import * as LucideIcons from 'lucide-react'
import { Blocks, type LucideIcon } from 'lucide-react'
import { legacyLucideIcons } from './legacyLucideIcons'
// Lucide names are PascalCase. Restricting the lookup to that shape keeps a manifest
// from reaching lucide's non-icon exports (`createLucideIcon`, `icons`, `default`,
// `module.exports`), which are all lowercase-initial.
const LUCIDE_ICON_NAME = /^[A-Z][A-Za-z0-9]*$/
export function findLucideIcon(name: string | null | undefined): LucideIcon | undefined {
if (!name || !LUCIDE_ICON_NAME.test(name) || name === 'Icon') return undefined
const icon = (LucideIcons as unknown as Record<string, LucideIcon | undefined>)[name]
if (typeof icon === 'object') return icon
return legacyLucideIcons.get(name.replace(/^Lucide/, '').replace(/Icon$/, ''))
}
import { lucideIconByName } from './lucideIconLookup'
/**
* Resolves a plugin manifest's `icon` (a lucide icon name, e.g. "Stethoscope") to the
@@ -25,7 +12,7 @@ export function findLucideIcon(name: string | null | undefined): LucideIcon | un
* building nav/tab arrays.
*/
export function resolvePluginIcon(name: string | null | undefined): LucideIcon {
return findLucideIcon(name) ?? Blocks
return lucideIconByName[name ?? ''] ?? Blocks
}
/** Renders the lucide icon a plugin declares in its manifest (Blocks if unknown). */