mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-02 17:26:24 +00:00
chore(deps): update npm packages and adapt major upgrades
Resolve the MikroORM packages together and use the dispatcher adapter with older built-in fetch implementations. Preserve existing Lucide names and regenerate the Studio and SDK catalogs.
This commit is contained in:
@@ -1,12 +1,20 @@
|
||||
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$/, ''))
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves a plugin manifest's `icon` (a lucide icon name, e.g. "Stethoscope") to the
|
||||
* matching lucide component, falling back to Blocks for a missing or unknown name.
|
||||
@@ -17,9 +25,7 @@ const LUCIDE_ICON_NAME = /^[A-Z][A-Za-z0-9]*$/
|
||||
* building nav/tab arrays.
|
||||
*/
|
||||
export function resolvePluginIcon(name: string | null | undefined): LucideIcon {
|
||||
if (!name || !LUCIDE_ICON_NAME.test(name)) return Blocks
|
||||
const icon = (LucideIcons as unknown as Record<string, LucideIcon | undefined>)[name]
|
||||
return icon ?? Blocks
|
||||
return findLucideIcon(name) ?? Blocks
|
||||
}
|
||||
|
||||
/** Renders the lucide icon a plugin declares in its manifest (Blocks if unknown). */
|
||||
|
||||
Reference in New Issue
Block a user