rn-iconify 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -235
- package/babel.js +14 -0
- package/lib/commonjs/IconRenderer.js +91 -4
- package/lib/commonjs/IconRenderer.js.map +1 -1
- package/lib/commonjs/accessibility/AccessibilityProvider.js +189 -0
- package/lib/commonjs/accessibility/AccessibilityProvider.js.map +1 -0
- package/lib/commonjs/accessibility/index.js +87 -0
- package/lib/commonjs/accessibility/index.js.map +1 -0
- package/lib/commonjs/accessibility/types.js +6 -0
- package/lib/commonjs/accessibility/types.js.map +1 -0
- package/lib/commonjs/accessibility/useAccessibleIcon.js +119 -0
- package/lib/commonjs/accessibility/useAccessibleIcon.js.map +1 -0
- package/lib/commonjs/accessibility/utils.js +231 -0
- package/lib/commonjs/accessibility/utils.js.map +1 -0
- package/lib/commonjs/alias/Icon.js +113 -0
- package/lib/commonjs/alias/Icon.js.map +1 -0
- package/lib/commonjs/alias/IconAliasContext.js +177 -0
- package/lib/commonjs/alias/IconAliasContext.js.map +1 -0
- package/lib/commonjs/alias/createIconAliases.js +222 -0
- package/lib/commonjs/alias/createIconAliases.js.map +1 -0
- package/lib/commonjs/alias/index.js +57 -0
- package/lib/commonjs/alias/index.js.map +1 -0
- package/lib/commonjs/alias/types.js +6 -0
- package/lib/commonjs/alias/types.js.map +1 -0
- package/lib/commonjs/animated/AnimatedIcon.js +116 -0
- package/lib/commonjs/animated/AnimatedIcon.js.map +1 -0
- package/lib/commonjs/animated/index.js +76 -0
- package/lib/commonjs/animated/index.js.map +1 -0
- package/lib/commonjs/animated/presets.js +220 -0
- package/lib/commonjs/animated/presets.js.map +1 -0
- package/lib/commonjs/animated/types.js +71 -0
- package/lib/commonjs/animated/types.js.map +1 -0
- package/lib/commonjs/animated/useIconAnimation.js +313 -0
- package/lib/commonjs/animated/useIconAnimation.js.map +1 -0
- package/lib/commonjs/babel/ast-utils.js +214 -0
- package/lib/commonjs/babel/ast-utils.js.map +1 -0
- package/lib/commonjs/babel/cache-writer.js +281 -0
- package/lib/commonjs/babel/cache-writer.js.map +1 -0
- package/lib/commonjs/babel/collector.js +219 -0
- package/lib/commonjs/babel/collector.js.map +1 -0
- package/lib/commonjs/babel/index.js +104 -0
- package/lib/commonjs/babel/index.js.map +1 -0
- package/lib/commonjs/babel/plugin.js +226 -0
- package/lib/commonjs/babel/plugin.js.map +1 -0
- package/lib/commonjs/babel/types.js +485 -0
- package/lib/commonjs/babel/types.js.map +1 -0
- package/lib/commonjs/bundle/index.js +213 -0
- package/lib/commonjs/bundle/index.js.map +1 -0
- package/lib/commonjs/cache/CacheManager.js +105 -6
- package/lib/commonjs/cache/CacheManager.js.map +1 -1
- package/lib/commonjs/cli/commands/analyze.js +171 -0
- package/lib/commonjs/cli/commands/analyze.js.map +1 -0
- package/lib/commonjs/cli/commands/bundle.js +214 -0
- package/lib/commonjs/cli/commands/bundle.js.map +1 -0
- package/lib/commonjs/cli/index.js +142 -0
- package/lib/commonjs/cli/index.js.map +1 -0
- package/lib/commonjs/cli/parser.js +260 -0
- package/lib/commonjs/cli/parser.js.map +1 -0
- package/lib/commonjs/cli/types.js +42 -0
- package/lib/commonjs/cli/types.js.map +1 -0
- package/lib/commonjs/config/ConfigManager.js +182 -0
- package/lib/commonjs/config/ConfigManager.js.map +1 -0
- package/lib/commonjs/config/index.js +44 -0
- package/lib/commonjs/config/index.js.map +1 -0
- package/lib/commonjs/config/types.js +55 -0
- package/lib/commonjs/config/types.js.map +1 -0
- package/lib/commonjs/createIconSet.js +49 -11
- package/lib/commonjs/createIconSet.js.map +1 -1
- package/lib/commonjs/explorer/IconExplorer.js +827 -0
- package/lib/commonjs/explorer/IconExplorer.js.map +1 -0
- package/lib/commonjs/explorer/iconSets.js +303 -0
- package/lib/commonjs/explorer/iconSets.js.map +1 -0
- package/lib/commonjs/explorer/index.js +93 -0
- package/lib/commonjs/explorer/index.js.map +1 -0
- package/lib/commonjs/explorer/types.js +6 -0
- package/lib/commonjs/explorer/types.js.map +1 -0
- package/lib/commonjs/explorer/useExplorer.js +359 -0
- package/lib/commonjs/explorer/useExplorer.js.map +1 -0
- package/lib/commonjs/index.js +618 -12
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/navigation/createDrawerIcon.js +129 -0
- package/lib/commonjs/navigation/createDrawerIcon.js.map +1 -0
- package/lib/commonjs/navigation/createHeaderIcon.js +185 -0
- package/lib/commonjs/navigation/createHeaderIcon.js.map +1 -0
- package/lib/commonjs/navigation/createTabBarIcon.js +178 -0
- package/lib/commonjs/navigation/createTabBarIcon.js.map +1 -0
- package/lib/commonjs/navigation/index.js +83 -0
- package/lib/commonjs/navigation/index.js.map +1 -0
- package/lib/commonjs/navigation/types.js +94 -0
- package/lib/commonjs/navigation/types.js.map +1 -0
- package/lib/commonjs/navigation/useNavigationIcon.js +128 -0
- package/lib/commonjs/navigation/useNavigationIcon.js.map +1 -0
- package/lib/commonjs/network/IconifyAPI.js +154 -14
- package/lib/commonjs/network/IconifyAPI.js.map +1 -1
- package/lib/commonjs/network/index.js +18 -0
- package/lib/commonjs/network/index.js.map +1 -1
- package/lib/commonjs/performance/PerformanceMonitor.js +327 -0
- package/lib/commonjs/performance/PerformanceMonitor.js.map +1 -0
- package/lib/commonjs/performance/index.js +43 -0
- package/lib/commonjs/performance/index.js.map +1 -0
- package/lib/commonjs/performance/types.js +2 -0
- package/lib/commonjs/performance/types.js.map +1 -0
- package/lib/commonjs/placeholder/PlaceholderFactory.js +111 -0
- package/lib/commonjs/placeholder/PlaceholderFactory.js.map +1 -0
- package/lib/commonjs/placeholder/Pulse.js +77 -0
- package/lib/commonjs/placeholder/Pulse.js.map +1 -0
- package/lib/commonjs/placeholder/Shimmer.js +95 -0
- package/lib/commonjs/placeholder/Shimmer.js.map +1 -0
- package/lib/commonjs/placeholder/Skeleton.js +52 -0
- package/lib/commonjs/placeholder/Skeleton.js.map +1 -0
- package/lib/commonjs/placeholder/index.js +41 -0
- package/lib/commonjs/placeholder/index.js.map +1 -0
- package/lib/commonjs/placeholder/types.js +40 -0
- package/lib/commonjs/placeholder/types.js.map +1 -0
- package/lib/commonjs/theme/IconThemeProvider.js +96 -0
- package/lib/commonjs/theme/IconThemeProvider.js.map +1 -0
- package/lib/commonjs/theme/context.js +53 -0
- package/lib/commonjs/theme/context.js.map +1 -0
- package/lib/commonjs/theme/index.js +52 -0
- package/lib/commonjs/theme/index.js.map +1 -0
- package/lib/commonjs/theme/types.js +39 -0
- package/lib/commonjs/theme/types.js.map +1 -0
- package/lib/commonjs/theme/useIconTheme.js +121 -0
- package/lib/commonjs/theme/useIconTheme.js.map +1 -0
- package/lib/module/IconRenderer.js +92 -5
- package/lib/module/IconRenderer.js.map +1 -1
- package/lib/module/accessibility/AccessibilityProvider.js +179 -0
- package/lib/module/accessibility/AccessibilityProvider.js.map +1 -0
- package/lib/module/accessibility/index.js +42 -0
- package/lib/module/accessibility/index.js.map +1 -0
- package/lib/module/accessibility/types.js +2 -0
- package/lib/module/accessibility/types.js.map +1 -0
- package/lib/module/accessibility/useAccessibleIcon.js +112 -0
- package/lib/module/accessibility/useAccessibleIcon.js.map +1 -0
- package/lib/module/accessibility/utils.js +221 -0
- package/lib/module/accessibility/utils.js.map +1 -0
- package/lib/module/alias/Icon.js +105 -0
- package/lib/module/alias/Icon.js.map +1 -0
- package/lib/module/alias/IconAliasContext.js +166 -0
- package/lib/module/alias/IconAliasContext.js.map +1 -0
- package/lib/module/alias/createIconAliases.js +213 -0
- package/lib/module/alias/createIconAliases.js.map +1 -0
- package/lib/module/alias/index.js +45 -0
- package/lib/module/alias/index.js.map +1 -0
- package/lib/module/alias/types.js +2 -0
- package/lib/module/alias/types.js.map +1 -0
- package/lib/module/animated/AnimatedIcon.js +109 -0
- package/lib/module/animated/AnimatedIcon.js.map +1 -0
- package/lib/module/animated/index.js +80 -0
- package/lib/module/animated/index.js.map +1 -0
- package/lib/module/animated/presets.js +209 -0
- package/lib/module/animated/presets.js.map +1 -0
- package/lib/module/animated/types.js +65 -0
- package/lib/module/animated/types.js.map +1 -0
- package/lib/module/animated/useIconAnimation.js +306 -0
- package/lib/module/animated/useIconAnimation.js.map +1 -0
- package/lib/module/babel/ast-utils.js +201 -0
- package/lib/module/babel/ast-utils.js.map +1 -0
- package/lib/module/babel/cache-writer.js +269 -0
- package/lib/module/babel/cache-writer.js.map +1 -0
- package/lib/module/babel/collector.js +214 -0
- package/lib/module/babel/collector.js.map +1 -0
- package/lib/module/babel/index.js +51 -0
- package/lib/module/babel/index.js.map +1 -0
- package/lib/module/babel/plugin.js +220 -0
- package/lib/module/babel/plugin.js.map +1 -0
- package/lib/module/babel/types.js +476 -0
- package/lib/module/babel/types.js.map +1 -0
- package/lib/module/bundle/index.js +205 -0
- package/lib/module/bundle/index.js.map +1 -0
- package/lib/module/cache/CacheManager.js +106 -6
- package/lib/module/cache/CacheManager.js.map +1 -1
- package/lib/module/cli/commands/analyze.js +166 -0
- package/lib/module/cli/commands/analyze.js.map +1 -0
- package/lib/module/cli/commands/bundle.js +208 -0
- package/lib/module/cli/commands/bundle.js.map +1 -0
- package/lib/module/cli/index.js +140 -0
- package/lib/module/cli/index.js.map +1 -0
- package/lib/module/cli/parser.js +251 -0
- package/lib/module/cli/parser.js.map +1 -0
- package/lib/module/cli/types.js +36 -0
- package/lib/module/cli/types.js.map +1 -0
- package/lib/module/components/index.js +27 -1
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/config/ConfigManager.js +173 -0
- package/lib/module/config/ConfigManager.js.map +1 -0
- package/lib/module/config/index.js +28 -0
- package/lib/module/config/index.js.map +1 -0
- package/lib/module/config/types.js +49 -0
- package/lib/module/config/types.js.map +1 -0
- package/lib/module/createIconSet.js +49 -11
- package/lib/module/createIconSet.js.map +1 -1
- package/lib/module/explorer/IconExplorer.js +817 -0
- package/lib/module/explorer/IconExplorer.js.map +1 -0
- package/lib/module/explorer/iconSets.js +291 -0
- package/lib/module/explorer/iconSets.js.map +1 -0
- package/lib/module/explorer/index.js +42 -0
- package/lib/module/explorer/index.js.map +1 -0
- package/lib/module/explorer/types.js +2 -0
- package/lib/module/explorer/types.js.map +1 -0
- package/lib/module/explorer/useExplorer.js +353 -0
- package/lib/module/explorer/useExplorer.js.map +1 -0
- package/lib/module/index.js +26 -11
- package/lib/module/index.js.map +1 -1
- package/lib/module/navigation/createDrawerIcon.js +121 -0
- package/lib/module/navigation/createDrawerIcon.js.map +1 -0
- package/lib/module/navigation/createHeaderIcon.js +175 -0
- package/lib/module/navigation/createHeaderIcon.js.map +1 -0
- package/lib/module/navigation/createTabBarIcon.js +168 -0
- package/lib/module/navigation/createTabBarIcon.js.map +1 -0
- package/lib/module/navigation/index.js +59 -0
- package/lib/module/navigation/index.js.map +1 -0
- package/lib/module/navigation/types.js +88 -0
- package/lib/module/navigation/types.js.map +1 -0
- package/lib/module/navigation/useNavigationIcon.js +121 -0
- package/lib/module/navigation/useNavigationIcon.js.map +1 -0
- package/lib/module/network/IconifyAPI.js +152 -14
- package/lib/module/network/IconifyAPI.js.map +1 -1
- package/lib/module/network/index.js +1 -1
- package/lib/module/network/index.js.map +1 -1
- package/lib/module/performance/PerformanceMonitor.js +317 -0
- package/lib/module/performance/PerformanceMonitor.js.map +1 -0
- package/lib/module/performance/index.js +26 -0
- package/lib/module/performance/index.js.map +1 -0
- package/lib/module/performance/types.js +2 -0
- package/lib/module/performance/types.js.map +1 -0
- package/lib/module/placeholder/PlaceholderFactory.js +105 -0
- package/lib/module/placeholder/PlaceholderFactory.js.map +1 -0
- package/lib/module/placeholder/Pulse.js +70 -0
- package/lib/module/placeholder/Pulse.js.map +1 -0
- package/lib/module/placeholder/Shimmer.js +88 -0
- package/lib/module/placeholder/Shimmer.js.map +1 -0
- package/lib/module/placeholder/Skeleton.js +45 -0
- package/lib/module/placeholder/Skeleton.js.map +1 -0
- package/lib/module/placeholder/index.js +15 -0
- package/lib/module/placeholder/index.js.map +1 -0
- package/lib/module/placeholder/types.js +34 -0
- package/lib/module/placeholder/types.js.map +1 -0
- package/lib/module/theme/IconThemeProvider.js +89 -0
- package/lib/module/theme/IconThemeProvider.js.map +1 -0
- package/lib/module/theme/context.js +47 -0
- package/lib/module/theme/context.js.map +1 -0
- package/lib/module/theme/index.js +19 -0
- package/lib/module/theme/index.js.map +1 -0
- package/lib/module/theme/types.js +33 -0
- package/lib/module/theme/types.js.map +1 -0
- package/lib/module/theme/useIconTheme.js +114 -0
- package/lib/module/theme/useIconTheme.js.map +1 -0
- package/lib/typescript/IconRenderer.d.ts +1 -1
- package/lib/typescript/IconRenderer.d.ts.map +1 -1
- package/lib/typescript/accessibility/AccessibilityProvider.d.ts +57 -0
- package/lib/typescript/accessibility/AccessibilityProvider.d.ts.map +1 -0
- package/lib/typescript/accessibility/index.d.ts +37 -0
- package/lib/typescript/accessibility/index.d.ts.map +1 -0
- package/lib/typescript/accessibility/types.d.ts +130 -0
- package/lib/typescript/accessibility/types.d.ts.map +1 -0
- package/lib/typescript/accessibility/useAccessibleIcon.d.ts +111 -0
- package/lib/typescript/accessibility/useAccessibleIcon.d.ts.map +1 -0
- package/lib/typescript/accessibility/utils.d.ts +29 -0
- package/lib/typescript/accessibility/utils.d.ts.map +1 -0
- package/lib/typescript/alias/Icon.d.ts +38 -0
- package/lib/typescript/alias/Icon.d.ts.map +1 -0
- package/lib/typescript/alias/IconAliasContext.d.ts +52 -0
- package/lib/typescript/alias/IconAliasContext.d.ts.map +1 -0
- package/lib/typescript/alias/createIconAliases.d.ts +77 -0
- package/lib/typescript/alias/createIconAliases.d.ts.map +1 -0
- package/lib/typescript/alias/index.d.ts +36 -0
- package/lib/typescript/alias/index.d.ts.map +1 -0
- package/lib/typescript/alias/types.d.ts +115 -0
- package/lib/typescript/alias/types.d.ts.map +1 -0
- package/lib/typescript/animated/AnimatedIcon.d.ts +45 -0
- package/lib/typescript/animated/AnimatedIcon.d.ts.map +1 -0
- package/lib/typescript/animated/index.d.ts +70 -0
- package/lib/typescript/animated/index.d.ts.map +1 -0
- package/lib/typescript/animated/presets.d.ts +35 -0
- package/lib/typescript/animated/presets.d.ts.map +1 -0
- package/lib/typescript/animated/types.d.ts +196 -0
- package/lib/typescript/animated/types.d.ts.map +1 -0
- package/lib/typescript/animated/useIconAnimation.d.ts +64 -0
- package/lib/typescript/animated/useIconAnimation.d.ts.map +1 -0
- package/lib/typescript/babel/ast-utils.d.ts +52 -0
- package/lib/typescript/babel/ast-utils.d.ts.map +1 -0
- package/lib/typescript/babel/cache-writer.d.ts +56 -0
- package/lib/typescript/babel/cache-writer.d.ts.map +1 -0
- package/lib/typescript/babel/collector.d.ts +107 -0
- package/lib/typescript/babel/collector.d.ts.map +1 -0
- package/lib/typescript/babel/index.d.ts +47 -0
- package/lib/typescript/babel/index.d.ts.map +1 -0
- package/lib/typescript/babel/plugin.d.ts +17 -0
- package/lib/typescript/babel/plugin.d.ts.map +1 -0
- package/lib/typescript/babel/types.d.ts +129 -0
- package/lib/typescript/babel/types.d.ts.map +1 -0
- package/lib/typescript/bundle/index.d.ts +161 -0
- package/lib/typescript/bundle/index.d.ts.map +1 -0
- package/lib/typescript/cache/CacheManager.d.ts +52 -4
- package/lib/typescript/cache/CacheManager.d.ts.map +1 -1
- package/lib/typescript/cli/commands/analyze.d.ts +10 -0
- package/lib/typescript/cli/commands/analyze.d.ts.map +1 -0
- package/lib/typescript/cli/commands/bundle.d.ts +10 -0
- package/lib/typescript/cli/commands/bundle.d.ts.map +1 -0
- package/lib/typescript/cli/index.d.ts +7 -0
- package/lib/typescript/cli/index.d.ts.map +1 -0
- package/lib/typescript/cli/parser.d.ts +18 -0
- package/lib/typescript/cli/parser.d.ts.map +1 -0
- package/lib/typescript/cli/types.d.ts +157 -0
- package/lib/typescript/cli/types.d.ts.map +1 -0
- package/lib/typescript/components/Academicons.d.ts +1 -1
- package/lib/typescript/components/AkarIcons.d.ts +1 -1
- package/lib/typescript/components/AntDesign.d.ts +1 -1
- package/lib/typescript/components/Arcticons.d.ts +1 -1
- package/lib/typescript/components/Basil.d.ts +1 -1
- package/lib/typescript/components/Bi.d.ts +1 -1
- package/lib/typescript/components/BitcoinIcons.d.ts +1 -1
- package/lib/typescript/components/Bpmn.d.ts +1 -1
- package/lib/typescript/components/Brandico.d.ts +1 -1
- package/lib/typescript/components/Bx.d.ts +1 -1
- package/lib/typescript/components/Bxl.d.ts +1 -1
- package/lib/typescript/components/Bxs.d.ts +1 -1
- package/lib/typescript/components/Bytesize.d.ts +1 -1
- package/lib/typescript/components/Carbon.d.ts +1 -1
- package/lib/typescript/components/Catppuccin.d.ts +1 -1
- package/lib/typescript/components/Cbi.d.ts +1 -1
- package/lib/typescript/components/Charm.d.ts +1 -1
- package/lib/typescript/components/Ci.d.ts +1 -1
- package/lib/typescript/components/Cib.d.ts +1 -1
- package/lib/typescript/components/Cif.d.ts +1 -1
- package/lib/typescript/components/Cil.d.ts +1 -1
- package/lib/typescript/components/CircleFlags.d.ts +1 -1
- package/lib/typescript/components/Circum.d.ts +1 -1
- package/lib/typescript/components/Clarity.d.ts +1 -1
- package/lib/typescript/components/Codex.d.ts +1 -1
- package/lib/typescript/components/Codicon.d.ts +1 -1
- package/lib/typescript/components/Covid.d.ts +1 -1
- package/lib/typescript/components/Cryptocurrency.d.ts +1 -1
- package/lib/typescript/components/CryptocurrencyColor.d.ts +1 -1
- package/lib/typescript/components/Cuida.d.ts +1 -1
- package/lib/typescript/components/Dashicons.d.ts +1 -1
- package/lib/typescript/components/Devicon.d.ts +1 -1
- package/lib/typescript/components/DeviconPlain.d.ts +1 -1
- package/lib/typescript/components/DinkieIcons.d.ts +1 -1
- package/lib/typescript/components/DuoIcons.d.ts +1 -1
- package/lib/typescript/components/Ei.d.ts +1 -1
- package/lib/typescript/components/El.d.ts +1 -1
- package/lib/typescript/components/EmojioneMonotone.d.ts +1 -1
- package/lib/typescript/components/Entypo.d.ts +1 -1
- package/lib/typescript/components/EntypoSocial.d.ts +1 -1
- package/lib/typescript/components/EosIcons.d.ts +1 -1
- package/lib/typescript/components/Ep.d.ts +1 -1
- package/lib/typescript/components/Et.d.ts +1 -1
- package/lib/typescript/components/Eva.d.ts +1 -1
- package/lib/typescript/components/F7.d.ts +1 -1
- package/lib/typescript/components/Fa.d.ts +1 -1
- package/lib/typescript/components/Fa6Brands.d.ts +1 -1
- package/lib/typescript/components/Fa6Regular.d.ts +1 -1
- package/lib/typescript/components/Fa6Solid.d.ts +1 -1
- package/lib/typescript/components/Fa7Brands.d.ts +1 -1
- package/lib/typescript/components/Fa7Regular.d.ts +1 -1
- package/lib/typescript/components/Fa7Solid.d.ts +1 -1
- package/lib/typescript/components/FaBrands.d.ts +1 -1
- package/lib/typescript/components/FaRegular.d.ts +1 -1
- package/lib/typescript/components/FaSolid.d.ts +1 -1
- package/lib/typescript/components/Fad.d.ts +1 -1
- package/lib/typescript/components/Famicons.d.ts +1 -1
- package/lib/typescript/components/Fe.d.ts +1 -1
- package/lib/typescript/components/Feather.d.ts +1 -1
- package/lib/typescript/components/FileIcons.d.ts +1 -1
- package/lib/typescript/components/Flag.d.ts +1 -1
- package/lib/typescript/components/Flagpack.d.ts +1 -1
- package/lib/typescript/components/FlatUi.d.ts +1 -1
- package/lib/typescript/components/Flowbite.d.ts +1 -1
- package/lib/typescript/components/Fluent.d.ts +1 -1
- package/lib/typescript/components/FluentColor.d.ts +1 -1
- package/lib/typescript/components/FluentEmoji.d.ts +1 -1
- package/lib/typescript/components/FluentEmojiFlat.d.ts +1 -1
- package/lib/typescript/components/FluentEmojiHighContrast.d.ts +1 -1
- package/lib/typescript/components/FluentMdl2.d.ts +1 -1
- package/lib/typescript/components/Fontelico.d.ts +1 -1
- package/lib/typescript/components/Fontisto.d.ts +1 -1
- package/lib/typescript/components/Formkit.d.ts +1 -1
- package/lib/typescript/components/Foundation.d.ts +1 -1
- package/lib/typescript/components/Gala.d.ts +1 -1
- package/lib/typescript/components/GameIcons.d.ts +1 -1
- package/lib/typescript/components/Garden.d.ts +1 -1
- package/lib/typescript/components/Geo.d.ts +1 -1
- package/lib/typescript/components/Gg.d.ts +1 -1
- package/lib/typescript/components/Gis.d.ts +1 -1
- package/lib/typescript/components/GravityUi.d.ts +1 -1
- package/lib/typescript/components/Gridicons.d.ts +1 -1
- package/lib/typescript/components/GrommetIcons.d.ts +1 -1
- package/lib/typescript/components/Guidance.d.ts +1 -1
- package/lib/typescript/components/Healthicons.d.ts +1 -1
- package/lib/typescript/components/Heroicons.d.ts +1 -1
- package/lib/typescript/components/HeroiconsOutline.d.ts +1 -1
- package/lib/typescript/components/HeroiconsSolid.d.ts +1 -1
- package/lib/typescript/components/Hugeicons.d.ts +1 -1
- package/lib/typescript/components/Humbleicons.d.ts +1 -1
- package/lib/typescript/components/Ic.d.ts +1 -1
- package/lib/typescript/components/IcomoonFree.d.ts +1 -1
- package/lib/typescript/components/IconPark.d.ts +1 -1
- package/lib/typescript/components/IconParkOutline.d.ts +1 -1
- package/lib/typescript/components/IconParkSolid.d.ts +1 -1
- package/lib/typescript/components/IconParkTwotone.d.ts +1 -1
- package/lib/typescript/components/Iconamoon.d.ts +1 -1
- package/lib/typescript/components/Iconoir.d.ts +1 -1
- package/lib/typescript/components/Icons8.d.ts +1 -1
- package/lib/typescript/components/Il.d.ts +1 -1
- package/lib/typescript/components/Ion.d.ts +1 -1
- package/lib/typescript/components/Iwwa.d.ts +1 -1
- package/lib/typescript/components/Ix.d.ts +1 -1
- package/lib/typescript/components/Jam.d.ts +1 -1
- package/lib/typescript/components/La.d.ts +1 -1
- package/lib/typescript/components/LetsIcons.d.ts +1 -1
- package/lib/typescript/components/LineMd.d.ts +1 -1
- package/lib/typescript/components/Lineicons.d.ts +1 -1
- package/lib/typescript/components/Logos.d.ts +1 -1
- package/lib/typescript/components/Ls.d.ts +1 -1
- package/lib/typescript/components/Lsicon.d.ts +1 -1
- package/lib/typescript/components/Lucide.d.ts +1 -1
- package/lib/typescript/components/LucideLab.d.ts +1 -1
- package/lib/typescript/components/Mage.d.ts +1 -1
- package/lib/typescript/components/Majesticons.d.ts +1 -1
- package/lib/typescript/components/Maki.d.ts +1 -1
- package/lib/typescript/components/Map.d.ts +1 -1
- package/lib/typescript/components/Marketeq.d.ts +1 -1
- package/lib/typescript/components/MaterialIconTheme.d.ts +1 -1
- package/lib/typescript/components/MaterialSymbols.d.ts +1 -1
- package/lib/typescript/components/MaterialSymbolsLight.d.ts +1 -1
- package/lib/typescript/components/Mdi.d.ts +1 -1
- package/lib/typescript/components/MdiLight.d.ts +1 -1
- package/lib/typescript/components/MedicalIcon.d.ts +1 -1
- package/lib/typescript/components/Memory.d.ts +1 -1
- package/lib/typescript/components/Meteocons.d.ts +1 -1
- package/lib/typescript/components/MeteorIcons.d.ts +1 -1
- package/lib/typescript/components/Mi.d.ts +1 -1
- package/lib/typescript/components/Mingcute.d.ts +1 -1
- package/lib/typescript/components/MonoIcons.d.ts +1 -1
- package/lib/typescript/components/Mynaui.d.ts +1 -1
- package/lib/typescript/components/Nimbus.d.ts +1 -1
- package/lib/typescript/components/Nonicons.d.ts +1 -1
- package/lib/typescript/components/Nrk.d.ts +1 -1
- package/lib/typescript/components/Octicon.d.ts +1 -1
- package/lib/typescript/components/Oi.d.ts +1 -1
- package/lib/typescript/components/Ooui.d.ts +1 -1
- package/lib/typescript/components/Oui.d.ts +1 -1
- package/lib/typescript/components/Pajamas.d.ts +1 -1
- package/lib/typescript/components/Pepicons.d.ts +1 -1
- package/lib/typescript/components/PepiconsPencil.d.ts +1 -1
- package/lib/typescript/components/PepiconsPop.d.ts +1 -1
- package/lib/typescript/components/PepiconsPrint.d.ts +1 -1
- package/lib/typescript/components/Ph.d.ts +1 -1
- package/lib/typescript/components/Picon.d.ts +1 -1
- package/lib/typescript/components/Pixel.d.ts +1 -1
- package/lib/typescript/components/Pixelarticons.d.ts +1 -1
- package/lib/typescript/components/Prime.d.ts +1 -1
- package/lib/typescript/components/Proicons.d.ts +1 -1
- package/lib/typescript/components/Ps.d.ts +1 -1
- package/lib/typescript/components/QlementineIcons.d.ts +1 -1
- package/lib/typescript/components/Quill.d.ts +1 -1
- package/lib/typescript/components/RadixIcons.d.ts +1 -1
- package/lib/typescript/components/Raphael.d.ts +1 -1
- package/lib/typescript/components/Ri.d.ts +1 -1
- package/lib/typescript/components/RivetIcons.d.ts +1 -1
- package/lib/typescript/components/Roentgen.d.ts +1 -1
- package/lib/typescript/components/Si.d.ts +1 -1
- package/lib/typescript/components/SiGlyph.d.ts +1 -1
- package/lib/typescript/components/Sidekickicons.d.ts +1 -1
- package/lib/typescript/components/SimpleIcons.d.ts +1 -1
- package/lib/typescript/components/SimpleLineIcons.d.ts +1 -1
- package/lib/typescript/components/SkillIcons.d.ts +1 -1
- package/lib/typescript/components/Solar.d.ts +1 -1
- package/lib/typescript/components/Stash.d.ts +1 -1
- package/lib/typescript/components/Streamline.d.ts +1 -1
- package/lib/typescript/components/StreamlineBlock.d.ts +1 -1
- package/lib/typescript/components/StreamlineColor.d.ts +1 -1
- package/lib/typescript/components/StreamlineCyber.d.ts +1 -1
- package/lib/typescript/components/StreamlineCyberColor.d.ts +1 -1
- package/lib/typescript/components/StreamlineEmojis.d.ts +1 -1
- package/lib/typescript/components/StreamlineFlex.d.ts +1 -1
- package/lib/typescript/components/StreamlineFlexColor.d.ts +1 -1
- package/lib/typescript/components/StreamlineFreehand.d.ts +1 -1
- package/lib/typescript/components/StreamlineFreehandColor.d.ts +1 -1
- package/lib/typescript/components/StreamlineKameleonColor.d.ts +1 -1
- package/lib/typescript/components/StreamlineLogos.d.ts +1 -1
- package/lib/typescript/components/StreamlinePixel.d.ts +1 -1
- package/lib/typescript/components/StreamlinePlump.d.ts +1 -1
- package/lib/typescript/components/StreamlinePlumpColor.d.ts +1 -1
- package/lib/typescript/components/StreamlineSharp.d.ts +1 -1
- package/lib/typescript/components/StreamlineSharpColor.d.ts +1 -1
- package/lib/typescript/components/StreamlineStickiesColor.d.ts +1 -1
- package/lib/typescript/components/StreamlineUltimate.d.ts +1 -1
- package/lib/typescript/components/StreamlineUltimateColor.d.ts +1 -1
- package/lib/typescript/components/Subway.d.ts +1 -1
- package/lib/typescript/components/SvgSpinners.d.ts +1 -1
- package/lib/typescript/components/SystemUicons.d.ts +1 -1
- package/lib/typescript/components/Tabler.d.ts +1 -1
- package/lib/typescript/components/Tdesign.d.ts +1 -1
- package/lib/typescript/components/Teenyicons.d.ts +1 -1
- package/lib/typescript/components/Temaki.d.ts +1 -1
- package/lib/typescript/components/Token.d.ts +1 -1
- package/lib/typescript/components/TokenBranded.d.ts +1 -1
- package/lib/typescript/components/Topcoat.d.ts +1 -1
- package/lib/typescript/components/Typcn.d.ts +1 -1
- package/lib/typescript/components/Uil.d.ts +1 -1
- package/lib/typescript/components/Uim.d.ts +1 -1
- package/lib/typescript/components/Uis.d.ts +1 -1
- package/lib/typescript/components/Uit.d.ts +1 -1
- package/lib/typescript/components/Uiw.d.ts +1 -1
- package/lib/typescript/components/Unjs.d.ts +1 -1
- package/lib/typescript/components/Vaadin.d.ts +1 -1
- package/lib/typescript/components/Vs.d.ts +1 -1
- package/lib/typescript/components/VscodeIcons.d.ts +1 -1
- package/lib/typescript/components/Websymbol.d.ts +1 -1
- package/lib/typescript/components/Weui.d.ts +1 -1
- package/lib/typescript/components/Whh.d.ts +1 -1
- package/lib/typescript/components/Wi.d.ts +1 -1
- package/lib/typescript/components/Wpf.d.ts +1 -1
- package/lib/typescript/components/Zmdi.d.ts +1 -1
- package/lib/typescript/components/Zondicons.d.ts +1 -1
- package/lib/typescript/components/index.d.ts +38 -1
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/config/ConfigManager.d.ts +102 -0
- package/lib/typescript/config/ConfigManager.d.ts.map +1 -0
- package/lib/typescript/config/index.d.ts +22 -0
- package/lib/typescript/config/index.d.ts.map +1 -0
- package/lib/typescript/config/types.d.ts +112 -0
- package/lib/typescript/config/types.d.ts.map +1 -0
- package/lib/typescript/createIconSet.d.ts +1 -1
- package/lib/typescript/createIconSet.d.ts.map +1 -1
- package/lib/typescript/explorer/IconExplorer.d.ts +54 -0
- package/lib/typescript/explorer/IconExplorer.d.ts.map +1 -0
- package/lib/typescript/explorer/iconSets.d.ts +35 -0
- package/lib/typescript/explorer/iconSets.d.ts.map +1 -0
- package/lib/typescript/explorer/index.d.ts +33 -0
- package/lib/typescript/explorer/index.d.ts.map +1 -0
- package/lib/typescript/explorer/types.d.ts +329 -0
- package/lib/typescript/explorer/types.d.ts.map +1 -0
- package/lib/typescript/explorer/useExplorer.d.ts +18 -0
- package/lib/typescript/explorer/useExplorer.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +25 -4
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/navigation/createDrawerIcon.d.ts +74 -0
- package/lib/typescript/navigation/createDrawerIcon.d.ts.map +1 -0
- package/lib/typescript/navigation/createHeaderIcon.d.ts +145 -0
- package/lib/typescript/navigation/createHeaderIcon.d.ts.map +1 -0
- package/lib/typescript/navigation/createTabBarIcon.d.ts +99 -0
- package/lib/typescript/navigation/createTabBarIcon.d.ts.map +1 -0
- package/lib/typescript/navigation/index.d.ts +51 -0
- package/lib/typescript/navigation/index.d.ts.map +1 -0
- package/lib/typescript/navigation/types.d.ts +149 -0
- package/lib/typescript/navigation/types.d.ts.map +1 -0
- package/lib/typescript/navigation/useNavigationIcon.d.ts +91 -0
- package/lib/typescript/navigation/useNavigationIcon.d.ts.map +1 -0
- package/lib/typescript/network/IconifyAPI.d.ts +32 -0
- package/lib/typescript/network/IconifyAPI.d.ts.map +1 -1
- package/lib/typescript/network/index.d.ts +2 -1
- package/lib/typescript/network/index.d.ts.map +1 -1
- package/lib/typescript/performance/PerformanceMonitor.d.ts +76 -0
- package/lib/typescript/performance/PerformanceMonitor.d.ts.map +1 -0
- package/lib/typescript/performance/index.d.ts +21 -0
- package/lib/typescript/performance/index.d.ts.map +1 -0
- package/lib/typescript/performance/types.d.ts +156 -0
- package/lib/typescript/performance/types.d.ts.map +1 -0
- package/lib/typescript/placeholder/PlaceholderFactory.d.ts +44 -0
- package/lib/typescript/placeholder/PlaceholderFactory.d.ts.map +1 -0
- package/lib/typescript/placeholder/Pulse.d.ts +18 -0
- package/lib/typescript/placeholder/Pulse.d.ts.map +1 -0
- package/lib/typescript/placeholder/Shimmer.d.ts +19 -0
- package/lib/typescript/placeholder/Shimmer.d.ts.map +1 -0
- package/lib/typescript/placeholder/Skeleton.d.ts +18 -0
- package/lib/typescript/placeholder/Skeleton.d.ts.map +1 -0
- package/lib/typescript/placeholder/index.d.ts +12 -0
- package/lib/typescript/placeholder/index.d.ts.map +1 -0
- package/lib/typescript/placeholder/types.d.ts +63 -0
- package/lib/typescript/placeholder/types.d.ts.map +1 -0
- package/lib/typescript/theme/IconThemeProvider.d.ts +64 -0
- package/lib/typescript/theme/IconThemeProvider.d.ts.map +1 -0
- package/lib/typescript/theme/context.d.ts +24 -0
- package/lib/typescript/theme/context.d.ts.map +1 -0
- package/lib/typescript/theme/index.d.ts +10 -0
- package/lib/typescript/theme/index.d.ts.map +1 -0
- package/lib/typescript/theme/types.d.ts +85 -0
- package/lib/typescript/theme/types.d.ts.map +1 -0
- package/lib/typescript/theme/useIconTheme.d.ts +78 -0
- package/lib/typescript/theme/useIconTheme.d.ts.map +1 -0
- package/lib/typescript/types/index.d.ts +58 -1
- package/lib/typescript/types/index.d.ts.map +1 -1
- package/package.json +41 -3
- package/src/IconRenderer.tsx +91 -4
- package/src/accessibility/AccessibilityProvider.tsx +220 -0
- package/src/accessibility/index.ts +63 -0
- package/src/accessibility/types.ts +152 -0
- package/src/accessibility/useAccessibleIcon.ts +220 -0
- package/src/accessibility/utils.ts +180 -0
- package/src/alias/Icon.tsx +113 -0
- package/src/alias/IconAliasContext.tsx +180 -0
- package/src/alias/createIconAliases.tsx +233 -0
- package/src/alias/index.ts +59 -0
- package/src/alias/types.ts +132 -0
- package/src/animated/AnimatedIcon.tsx +116 -0
- package/src/animated/index.ts +97 -0
- package/src/animated/presets.ts +211 -0
- package/src/animated/types.ts +239 -0
- package/src/animated/useIconAnimation.ts +383 -0
- package/src/babel/ast-utils.ts +219 -0
- package/src/babel/cache-writer.ts +323 -0
- package/src/babel/collector.ts +224 -0
- package/src/babel/index.ts +60 -0
- package/src/babel/plugin.ts +254 -0
- package/src/babel/types.ts +717 -0
- package/src/bundle/index.ts +313 -0
- package/src/cache/CacheManager.ts +123 -6
- package/src/cli/commands/analyze.ts +195 -0
- package/src/cli/commands/bundle.ts +231 -0
- package/src/cli/index.ts +153 -0
- package/src/cli/parser.ts +275 -0
- package/src/cli/types.ts +187 -0
- package/src/components/index.ts +52 -1
- package/src/config/ConfigManager.ts +196 -0
- package/src/config/index.ts +34 -0
- package/src/config/types.ts +149 -0
- package/src/createIconSet.tsx +48 -9
- package/src/explorer/IconExplorer.tsx +844 -0
- package/src/explorer/iconSets.ts +334 -0
- package/src/explorer/index.ts +64 -0
- package/src/explorer/types.ts +392 -0
- package/src/explorer/useExplorer.ts +390 -0
- package/src/index.ts +218 -9
- package/src/navigation/createDrawerIcon.tsx +113 -0
- package/src/navigation/createHeaderIcon.tsx +213 -0
- package/src/navigation/createTabBarIcon.tsx +180 -0
- package/src/navigation/index.ts +80 -0
- package/src/navigation/types.ts +155 -0
- package/src/navigation/useNavigationIcon.tsx +156 -0
- package/src/network/IconifyAPI.ts +182 -14
- package/src/network/index.ts +11 -1
- package/src/performance/PerformanceMonitor.ts +367 -0
- package/src/performance/index.ts +39 -0
- package/src/performance/types.ts +185 -0
- package/src/placeholder/PlaceholderFactory.tsx +133 -0
- package/src/placeholder/Pulse.tsx +86 -0
- package/src/placeholder/Shimmer.tsx +104 -0
- package/src/placeholder/Skeleton.tsx +52 -0
- package/src/placeholder/index.ts +21 -0
- package/src/placeholder/types.ts +78 -0
- package/src/theme/IconThemeProvider.tsx +94 -0
- package/src/theme/context.ts +51 -0
- package/src/theme/index.ts +19 -0
- package/src/theme/types.ts +108 -0
- package/src/theme/useIconTheme.ts +119 -0
- package/src/types/index.ts +78 -1
- package/lib/commonjs/components/Phosphor.js +0 -493
- package/lib/commonjs/components/Phosphor.js.map +0 -1
- package/lib/module/components/Phosphor.js +0 -488
- package/lib/module/components/Phosphor.js.map +0 -1
- package/lib/typescript/components/Phosphor.d.ts +0 -472
- package/lib/typescript/components/Phosphor.d.ts.map +0 -1
- package/src/components/Phosphor.tsx +0 -506
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Offline Bundle Module
|
|
3
|
+
* Provides functionality to load pre-bundled icons at runtime
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { CacheManager } from '../cache/CacheManager';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Icon bundle structure (matches CLI output)
|
|
10
|
+
*/
|
|
11
|
+
export interface IconBundle {
|
|
12
|
+
/**
|
|
13
|
+
* Bundle version
|
|
14
|
+
*/
|
|
15
|
+
version: string;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Generation timestamp
|
|
19
|
+
*/
|
|
20
|
+
generatedAt: string;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Icons in the bundle
|
|
24
|
+
*/
|
|
25
|
+
icons: Record<
|
|
26
|
+
string,
|
|
27
|
+
{
|
|
28
|
+
svg: string;
|
|
29
|
+
width: number;
|
|
30
|
+
height: number;
|
|
31
|
+
}
|
|
32
|
+
>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Total icon count
|
|
36
|
+
*/
|
|
37
|
+
count: number;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Bundle loading result
|
|
42
|
+
*/
|
|
43
|
+
export interface BundleLoadResult {
|
|
44
|
+
/**
|
|
45
|
+
* Number of icons loaded
|
|
46
|
+
*/
|
|
47
|
+
loaded: number;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Number of icons skipped (already cached)
|
|
51
|
+
*/
|
|
52
|
+
skipped: number;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Total icons in bundle
|
|
56
|
+
*/
|
|
57
|
+
total: number;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Bundle version
|
|
61
|
+
*/
|
|
62
|
+
version: string;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Load time in milliseconds
|
|
66
|
+
*/
|
|
67
|
+
loadTimeMs: number;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Load an offline icon bundle into the cache
|
|
72
|
+
*
|
|
73
|
+
* This function should be called early in your app initialization
|
|
74
|
+
* to pre-populate the icon cache with bundled icons.
|
|
75
|
+
*
|
|
76
|
+
* Icons loaded from the bundle are immediately available without
|
|
77
|
+
* network requests, providing instant rendering.
|
|
78
|
+
*
|
|
79
|
+
* @param bundle - The icon bundle object (from JSON import)
|
|
80
|
+
* @param options - Loading options
|
|
81
|
+
* @returns Result with load statistics
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```tsx
|
|
85
|
+
* // In your app entry point (App.tsx or index.js)
|
|
86
|
+
* import { loadOfflineBundle } from 'rn-iconify';
|
|
87
|
+
* import iconBundle from './assets/icons.bundle.json';
|
|
88
|
+
*
|
|
89
|
+
* // Load bundle on app start
|
|
90
|
+
* const result = loadOfflineBundle(iconBundle);
|
|
91
|
+
* console.log(`Loaded ${result.loaded} icons in ${result.loadTimeMs}ms`);
|
|
92
|
+
*
|
|
93
|
+
* // Or with options
|
|
94
|
+
* loadOfflineBundle(iconBundle, {
|
|
95
|
+
* skipExisting: true, // Don't overwrite existing cache entries
|
|
96
|
+
* verbose: true, // Log loading progress
|
|
97
|
+
* });
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
export function loadOfflineBundle(
|
|
101
|
+
bundle: IconBundle,
|
|
102
|
+
options: {
|
|
103
|
+
/**
|
|
104
|
+
* Skip icons that are already in cache
|
|
105
|
+
* @default true
|
|
106
|
+
*/
|
|
107
|
+
skipExisting?: boolean;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Log loading progress
|
|
111
|
+
* @default false
|
|
112
|
+
*/
|
|
113
|
+
verbose?: boolean;
|
|
114
|
+
} = {}
|
|
115
|
+
): BundleLoadResult {
|
|
116
|
+
const { skipExisting = true, verbose = false } = options;
|
|
117
|
+
|
|
118
|
+
const startTime = Date.now();
|
|
119
|
+
let loaded = 0;
|
|
120
|
+
let skipped = 0;
|
|
121
|
+
|
|
122
|
+
if (verbose) {
|
|
123
|
+
console.log(`[rn-iconify] Loading bundle v${bundle.version} (${bundle.count} icons)`);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
for (const [iconName, iconData] of Object.entries(bundle.icons)) {
|
|
127
|
+
// Check if already cached
|
|
128
|
+
if (skipExisting) {
|
|
129
|
+
const existing = CacheManager.get(iconName);
|
|
130
|
+
if (existing) {
|
|
131
|
+
skipped++;
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Store in cache
|
|
137
|
+
CacheManager.set(iconName, iconData.svg);
|
|
138
|
+
loaded++;
|
|
139
|
+
|
|
140
|
+
if (verbose && loaded % 50 === 0) {
|
|
141
|
+
console.log(`[rn-iconify] Loaded ${loaded}/${bundle.count} icons...`);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const loadTimeMs = Date.now() - startTime;
|
|
146
|
+
|
|
147
|
+
if (verbose) {
|
|
148
|
+
console.log(`[rn-iconify] Bundle loaded: ${loaded} new, ${skipped} skipped, ${loadTimeMs}ms`);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return {
|
|
152
|
+
loaded,
|
|
153
|
+
skipped,
|
|
154
|
+
total: bundle.count,
|
|
155
|
+
version: bundle.version,
|
|
156
|
+
loadTimeMs,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Async version of loadOfflineBundle
|
|
162
|
+
*
|
|
163
|
+
* Useful for loading large bundles without blocking the main thread.
|
|
164
|
+
* Uses setTimeout to yield to the event loop periodically.
|
|
165
|
+
*
|
|
166
|
+
* @param bundle - The icon bundle object
|
|
167
|
+
* @param options - Loading options
|
|
168
|
+
* @returns Promise resolving to load result
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* ```tsx
|
|
172
|
+
* import { loadOfflineBundleAsync } from 'rn-iconify';
|
|
173
|
+
* import iconBundle from './assets/icons.bundle.json';
|
|
174
|
+
*
|
|
175
|
+
* async function initApp() {
|
|
176
|
+
* const result = await loadOfflineBundleAsync(iconBundle, {
|
|
177
|
+
* batchSize: 100, // Process 100 icons per batch
|
|
178
|
+
* verbose: true,
|
|
179
|
+
* });
|
|
180
|
+
* console.log(`Loaded ${result.loaded} icons`);
|
|
181
|
+
* }
|
|
182
|
+
* ```
|
|
183
|
+
*/
|
|
184
|
+
export async function loadOfflineBundleAsync(
|
|
185
|
+
bundle: IconBundle,
|
|
186
|
+
options: {
|
|
187
|
+
/**
|
|
188
|
+
* Skip icons that are already in cache
|
|
189
|
+
* @default true
|
|
190
|
+
*/
|
|
191
|
+
skipExisting?: boolean;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Log loading progress
|
|
195
|
+
* @default false
|
|
196
|
+
*/
|
|
197
|
+
verbose?: boolean;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Number of icons to process per batch
|
|
201
|
+
* @default 50
|
|
202
|
+
*/
|
|
203
|
+
batchSize?: number;
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Progress callback
|
|
207
|
+
*/
|
|
208
|
+
onProgress?: (loaded: number, total: number) => void;
|
|
209
|
+
} = {}
|
|
210
|
+
): Promise<BundleLoadResult> {
|
|
211
|
+
const { skipExisting = true, verbose = false, batchSize = 50, onProgress } = options;
|
|
212
|
+
|
|
213
|
+
const startTime = Date.now();
|
|
214
|
+
let loaded = 0;
|
|
215
|
+
let skipped = 0;
|
|
216
|
+
|
|
217
|
+
if (verbose) {
|
|
218
|
+
console.log(`[rn-iconify] Loading bundle v${bundle.version} (${bundle.count} icons)`);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
const entries = Object.entries(bundle.icons);
|
|
222
|
+
|
|
223
|
+
for (let i = 0; i < entries.length; i += batchSize) {
|
|
224
|
+
const batch = entries.slice(i, i + batchSize);
|
|
225
|
+
|
|
226
|
+
for (const [iconName, iconData] of batch) {
|
|
227
|
+
// Check if already cached
|
|
228
|
+
if (skipExisting) {
|
|
229
|
+
const existing = CacheManager.get(iconName);
|
|
230
|
+
if (existing) {
|
|
231
|
+
skipped++;
|
|
232
|
+
continue;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// Store in cache
|
|
237
|
+
CacheManager.set(iconName, iconData.svg);
|
|
238
|
+
loaded++;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// Report progress
|
|
242
|
+
onProgress?.(loaded + skipped, bundle.count);
|
|
243
|
+
|
|
244
|
+
// Yield to event loop
|
|
245
|
+
if (i + batchSize < entries.length) {
|
|
246
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
const loadTimeMs = Date.now() - startTime;
|
|
251
|
+
|
|
252
|
+
if (verbose) {
|
|
253
|
+
console.log(`[rn-iconify] Bundle loaded: ${loaded} new, ${skipped} skipped, ${loadTimeMs}ms`);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
return {
|
|
257
|
+
loaded,
|
|
258
|
+
skipped,
|
|
259
|
+
total: bundle.count,
|
|
260
|
+
version: bundle.version,
|
|
261
|
+
loadTimeMs,
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Check if a bundle is compatible with this version of rn-iconify
|
|
267
|
+
*
|
|
268
|
+
* @param bundle - The icon bundle object
|
|
269
|
+
* @returns true if compatible
|
|
270
|
+
*/
|
|
271
|
+
export function isBundleCompatible(bundle: IconBundle): boolean {
|
|
272
|
+
if (!bundle || typeof bundle !== 'object') {
|
|
273
|
+
return false;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// Check required fields
|
|
277
|
+
if (!bundle.version || !bundle.icons || typeof bundle.count !== 'number') {
|
|
278
|
+
return false;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// Check version compatibility (currently supports v1.x)
|
|
282
|
+
const majorVersion = parseInt(bundle.version.split('.')[0], 10);
|
|
283
|
+
return majorVersion === 1;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Get bundle statistics
|
|
288
|
+
*
|
|
289
|
+
* @param bundle - The icon bundle object
|
|
290
|
+
* @returns Statistics about the bundle
|
|
291
|
+
*/
|
|
292
|
+
export function getBundleStats(bundle: IconBundle): {
|
|
293
|
+
iconCount: number;
|
|
294
|
+
prefixes: string[];
|
|
295
|
+
estimatedSizeBytes: number;
|
|
296
|
+
generatedAt: Date;
|
|
297
|
+
} {
|
|
298
|
+
const prefixes = new Set<string>();
|
|
299
|
+
let totalSize = 0;
|
|
300
|
+
|
|
301
|
+
for (const [iconName, iconData] of Object.entries(bundle.icons)) {
|
|
302
|
+
const [prefix] = iconName.split(':');
|
|
303
|
+
prefixes.add(prefix);
|
|
304
|
+
totalSize += iconData.svg.length;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
return {
|
|
308
|
+
iconCount: bundle.count,
|
|
309
|
+
prefixes: Array.from(prefixes).sort(),
|
|
310
|
+
estimatedSizeBytes: totalSize,
|
|
311
|
+
generatedAt: new Date(bundle.generatedAt),
|
|
312
|
+
};
|
|
313
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Cache Manager - Orchestrates memory and disk cache
|
|
3
|
-
* Priority: Memory Cache → Disk Cache → Native Cache → Network
|
|
2
|
+
* Cache Manager - Orchestrates memory, bundled, and disk cache
|
|
3
|
+
* Priority: Memory Cache → Bundled Icons → Disk Cache → Native Cache → Network
|
|
4
4
|
*
|
|
5
5
|
* Integrates with native module for background prefetching when available
|
|
6
6
|
*/
|
|
@@ -9,6 +9,25 @@ import { MemoryCache } from './MemoryCache';
|
|
|
9
9
|
import { DiskCache } from './DiskCache';
|
|
10
10
|
import { getNativeIconify, isNativeModuleAvailable } from '../native';
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Bundled icon data structure
|
|
14
|
+
*/
|
|
15
|
+
interface BundledIconData {
|
|
16
|
+
svg: string;
|
|
17
|
+
width: number;
|
|
18
|
+
height: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Bundle structure from Babel plugin
|
|
23
|
+
*/
|
|
24
|
+
interface IconBundle {
|
|
25
|
+
version: string;
|
|
26
|
+
generatedAt: string;
|
|
27
|
+
icons: Record<string, BundledIconData>;
|
|
28
|
+
count: number;
|
|
29
|
+
}
|
|
30
|
+
|
|
12
31
|
class CacheManagerImpl {
|
|
13
32
|
/**
|
|
14
33
|
* Track in-flight prefetch operations to prevent race conditions
|
|
@@ -16,7 +35,76 @@ class CacheManagerImpl {
|
|
|
16
35
|
private prefetchingIcons = new Set<string>();
|
|
17
36
|
|
|
18
37
|
/**
|
|
19
|
-
*
|
|
38
|
+
* Bundled icons from Babel plugin (loaded at app start)
|
|
39
|
+
* These are icons that were detected during build time
|
|
40
|
+
*/
|
|
41
|
+
private bundledIcons: Map<string, string> | null = null;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Whether bundled icons have been initialized
|
|
45
|
+
*/
|
|
46
|
+
private bundledIconsInitialized = false;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Initialize bundled icons from the Babel plugin cache
|
|
50
|
+
* This should be called automatically on first access
|
|
51
|
+
*/
|
|
52
|
+
initBundledIcons(): void {
|
|
53
|
+
if (this.bundledIconsInitialized) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
this.bundledIconsInitialized = true;
|
|
58
|
+
|
|
59
|
+
// Bundled icons loading is disabled by default to prevent Metro bundling errors
|
|
60
|
+
// Use loadBundle() explicitly to load icons from a generated bundle file
|
|
61
|
+
// This is called by the app after importing the bundle from the Babel plugin output
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Load bundled icons from a custom bundle object
|
|
66
|
+
* Useful for manual bundle loading or testing
|
|
67
|
+
*
|
|
68
|
+
* @param bundle The icon bundle to load
|
|
69
|
+
* @returns Number of icons loaded
|
|
70
|
+
*/
|
|
71
|
+
loadBundle(bundle: IconBundle): number {
|
|
72
|
+
if (!bundle || !bundle.icons || bundle.version !== '1.0.0') {
|
|
73
|
+
return 0;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
this.bundledIcons = new Map();
|
|
77
|
+
|
|
78
|
+
for (const [iconName, data] of Object.entries(bundle.icons)) {
|
|
79
|
+
this.bundledIcons.set(iconName, data.svg);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
this.bundledIconsInitialized = true;
|
|
83
|
+
return this.bundledIcons.size;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Check if an icon is in the bundled cache
|
|
88
|
+
*/
|
|
89
|
+
hasBundled(iconName: string): boolean {
|
|
90
|
+
if (!this.bundledIconsInitialized) {
|
|
91
|
+
this.initBundledIcons();
|
|
92
|
+
}
|
|
93
|
+
return this.bundledIcons?.has(iconName) ?? false;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Get bundled icons count
|
|
98
|
+
*/
|
|
99
|
+
getBundledCount(): number {
|
|
100
|
+
if (!this.bundledIconsInitialized) {
|
|
101
|
+
this.initBundledIcons();
|
|
102
|
+
}
|
|
103
|
+
return this.bundledIcons?.size ?? 0;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Get icon SVG from cache (memory first, then bundled, then disk)
|
|
20
108
|
* @returns SVG string or null if not cached
|
|
21
109
|
*/
|
|
22
110
|
get(iconName: string): string | null {
|
|
@@ -26,7 +114,18 @@ class CacheManagerImpl {
|
|
|
26
114
|
return memoryCached;
|
|
27
115
|
}
|
|
28
116
|
|
|
29
|
-
// 2. Try
|
|
117
|
+
// 2. Try bundled icons (instant, ~0ms)
|
|
118
|
+
if (!this.bundledIconsInitialized) {
|
|
119
|
+
this.initBundledIcons();
|
|
120
|
+
}
|
|
121
|
+
const bundledSvg = this.bundledIcons?.get(iconName);
|
|
122
|
+
if (bundledSvg) {
|
|
123
|
+
// Promote to memory cache for faster subsequent access
|
|
124
|
+
MemoryCache.set(iconName, bundledSvg);
|
|
125
|
+
return bundledSvg;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// 3. Try disk cache (~1-5ms via JSI)
|
|
30
129
|
const diskCached = DiskCache.get(iconName);
|
|
31
130
|
if (diskCached) {
|
|
32
131
|
// Promote to memory cache for faster subsequent access
|
|
@@ -46,10 +145,22 @@ class CacheManagerImpl {
|
|
|
46
145
|
}
|
|
47
146
|
|
|
48
147
|
/**
|
|
49
|
-
* Check if icon exists in any cache
|
|
148
|
+
* Check if icon exists in any cache (memory, bundled, or disk)
|
|
50
149
|
*/
|
|
51
150
|
has(iconName: string): boolean {
|
|
52
|
-
|
|
151
|
+
if (MemoryCache.has(iconName)) {
|
|
152
|
+
return true;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// Check bundled icons
|
|
156
|
+
if (!this.bundledIconsInitialized) {
|
|
157
|
+
this.initBundledIcons();
|
|
158
|
+
}
|
|
159
|
+
if (this.bundledIcons?.has(iconName)) {
|
|
160
|
+
return true;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return DiskCache.has(iconName);
|
|
53
164
|
}
|
|
54
165
|
|
|
55
166
|
/**
|
|
@@ -80,12 +191,18 @@ class CacheManagerImpl {
|
|
|
80
191
|
*/
|
|
81
192
|
getStats(): {
|
|
82
193
|
memoryCount: number;
|
|
194
|
+
bundledCount: number;
|
|
83
195
|
diskCount: number;
|
|
84
196
|
diskSizeBytes: number;
|
|
85
197
|
} {
|
|
198
|
+
if (!this.bundledIconsInitialized) {
|
|
199
|
+
this.initBundledIcons();
|
|
200
|
+
}
|
|
201
|
+
|
|
86
202
|
const diskStats = DiskCache.getStats();
|
|
87
203
|
return {
|
|
88
204
|
memoryCount: MemoryCache.size,
|
|
205
|
+
bundledCount: this.bundledIcons?.size ?? 0,
|
|
89
206
|
diskCount: diskStats.iconCount,
|
|
90
207
|
diskSizeBytes: diskStats.sizeBytes,
|
|
91
208
|
};
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analyze Command
|
|
3
|
+
* Analyzes source code and reports icon usage statistics
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { AnalyzeOptions, AnalysisResult } from '../types';
|
|
7
|
+
import { EXIT_CODES } from '../types';
|
|
8
|
+
import { analyzeDirectory } from '../parser';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Format bytes to human readable
|
|
12
|
+
*/
|
|
13
|
+
function formatSize(bytes: number): string {
|
|
14
|
+
if (bytes < 1024) return `${bytes} B`;
|
|
15
|
+
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
16
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Estimate bundle size (rough estimate: ~400 bytes per icon average)
|
|
21
|
+
*/
|
|
22
|
+
function estimateBundleSize(iconCount: number): number {
|
|
23
|
+
return iconCount * 400;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Format result as table
|
|
28
|
+
*/
|
|
29
|
+
function formatTable(result: AnalysisResult, detailed: boolean): string {
|
|
30
|
+
const lines: string[] = [];
|
|
31
|
+
const divider = '─'.repeat(55);
|
|
32
|
+
|
|
33
|
+
lines.push('');
|
|
34
|
+
lines.push(`┌${divider}┐`);
|
|
35
|
+
lines.push(`│ 📊 Icon Usage Report${' '.repeat(34)}│`);
|
|
36
|
+
lines.push(`├${divider}┤`);
|
|
37
|
+
|
|
38
|
+
const estimatedSize = formatSize(estimateBundleSize(result.totalIcons));
|
|
39
|
+
lines.push(
|
|
40
|
+
`│ Total icons: ${result.totalIcons.toString().padEnd(6)} │ Est. size: ${estimatedSize.padEnd(8)} │ Files: ${result.filesAnalyzed.toString().padEnd(4)}│`
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
lines.push(`├${divider}┤`);
|
|
44
|
+
lines.push(
|
|
45
|
+
`│ ${'Prefix'.padEnd(16)}│ ${'Count'.padEnd(7)}│ ${'Icons'.padEnd(7)}│ ${'% Total'.padEnd(10)}│`
|
|
46
|
+
);
|
|
47
|
+
lines.push(`├${divider}┤`);
|
|
48
|
+
|
|
49
|
+
// Sort prefixes by count
|
|
50
|
+
const sortedPrefixes = Object.entries(result.byPrefix).sort((a, b) => b[1].count - a[1].count);
|
|
51
|
+
|
|
52
|
+
for (const [prefix, data] of sortedPrefixes) {
|
|
53
|
+
const percent =
|
|
54
|
+
result.totalUsage > 0 ? ((data.count / result.totalUsage) * 100).toFixed(1) : '0.0';
|
|
55
|
+
|
|
56
|
+
lines.push(
|
|
57
|
+
`│ ${prefix.padEnd(16)}│ ${data.count.toString().padEnd(7)}│ ${data.icons.length.toString().padEnd(7)}│ ${(percent + '%').padEnd(10)}│`
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
lines.push(`└${divider}┘`);
|
|
62
|
+
|
|
63
|
+
// Show top 10 most used icons
|
|
64
|
+
if (result.icons.length > 0) {
|
|
65
|
+
lines.push('');
|
|
66
|
+
lines.push('🔥 Top 10 Most Used Icons:');
|
|
67
|
+
|
|
68
|
+
const top10 = result.icons.slice(0, 10);
|
|
69
|
+
for (let i = 0; i < top10.length; i++) {
|
|
70
|
+
const icon = top10[i];
|
|
71
|
+
lines.push(` ${i + 1}. ${icon.icon} (${icon.count}x)`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Show detailed locations if requested
|
|
76
|
+
if (detailed && result.icons.length > 0) {
|
|
77
|
+
lines.push('');
|
|
78
|
+
lines.push('📍 All Icon Locations:');
|
|
79
|
+
|
|
80
|
+
for (const icon of result.icons) {
|
|
81
|
+
lines.push(`\n ${icon.icon} (${icon.count}x):`);
|
|
82
|
+
for (const loc of icon.locations.slice(0, 5)) {
|
|
83
|
+
lines.push(` - ${loc.file}:${loc.line}:${loc.column}`);
|
|
84
|
+
}
|
|
85
|
+
if (icon.locations.length > 5) {
|
|
86
|
+
lines.push(` ... and ${icon.locations.length - 5} more`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
lines.push('');
|
|
92
|
+
return lines.join('\n');
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Format result as JSON
|
|
97
|
+
*/
|
|
98
|
+
function formatJSON(result: AnalysisResult): string {
|
|
99
|
+
return JSON.stringify(result, null, 2);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Format result as Markdown
|
|
104
|
+
*/
|
|
105
|
+
function formatMarkdown(result: AnalysisResult, detailed: boolean): string {
|
|
106
|
+
const lines: string[] = [];
|
|
107
|
+
const estimatedSize = formatSize(estimateBundleSize(result.totalIcons));
|
|
108
|
+
|
|
109
|
+
lines.push('# Icon Usage Report');
|
|
110
|
+
lines.push('');
|
|
111
|
+
lines.push(`- **Total Icons:** ${result.totalIcons}`);
|
|
112
|
+
lines.push(`- **Total Usage:** ${result.totalUsage}`);
|
|
113
|
+
lines.push(`- **Estimated Bundle Size:** ${estimatedSize}`);
|
|
114
|
+
lines.push(`- **Files Analyzed:** ${result.filesAnalyzed}`);
|
|
115
|
+
lines.push(`- **Generated:** ${result.timestamp}`);
|
|
116
|
+
lines.push('');
|
|
117
|
+
|
|
118
|
+
lines.push('## By Icon Set');
|
|
119
|
+
lines.push('');
|
|
120
|
+
lines.push('| Prefix | Usage Count | Unique Icons | % of Total |');
|
|
121
|
+
lines.push('|--------|-------------|--------------|------------|');
|
|
122
|
+
|
|
123
|
+
const sortedPrefixes = Object.entries(result.byPrefix).sort((a, b) => b[1].count - a[1].count);
|
|
124
|
+
|
|
125
|
+
for (const [prefix, data] of sortedPrefixes) {
|
|
126
|
+
const percent =
|
|
127
|
+
result.totalUsage > 0 ? ((data.count / result.totalUsage) * 100).toFixed(1) : '0.0';
|
|
128
|
+
|
|
129
|
+
lines.push(`| ${prefix} | ${data.count} | ${data.icons.length} | ${percent}% |`);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
lines.push('');
|
|
133
|
+
lines.push('## Top 10 Most Used');
|
|
134
|
+
lines.push('');
|
|
135
|
+
|
|
136
|
+
const top10 = result.icons.slice(0, 10);
|
|
137
|
+
for (let i = 0; i < top10.length; i++) {
|
|
138
|
+
const icon = top10[i];
|
|
139
|
+
lines.push(`${i + 1}. \`${icon.icon}\` - ${icon.count} uses`);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (detailed) {
|
|
143
|
+
lines.push('');
|
|
144
|
+
lines.push('## All Icons');
|
|
145
|
+
lines.push('');
|
|
146
|
+
lines.push('| Icon | Count | First Location |');
|
|
147
|
+
lines.push('|------|-------|----------------|');
|
|
148
|
+
|
|
149
|
+
for (const icon of result.icons) {
|
|
150
|
+
const firstLoc = icon.locations[0];
|
|
151
|
+
const location = firstLoc ? `${firstLoc.file}:${firstLoc.line}` : '-';
|
|
152
|
+
lines.push(`| \`${icon.icon}\` | ${icon.count} | ${location} |`);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return lines.join('\n');
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Analyze command implementation
|
|
161
|
+
*/
|
|
162
|
+
export function analyzeCommand(options: AnalyzeOptions): number {
|
|
163
|
+
const { src = './src', format = 'table', detailed = false, verbose = false } = options;
|
|
164
|
+
|
|
165
|
+
console.log('\n🔍 rn-iconify Analyzer\n');
|
|
166
|
+
console.log(` Analyzing: ${src}`);
|
|
167
|
+
|
|
168
|
+
const result = analyzeDirectory(src, verbose);
|
|
169
|
+
|
|
170
|
+
if (result.totalIcons === 0) {
|
|
171
|
+
console.log('\n⚠️ No icons found in the source code.\n');
|
|
172
|
+
console.log(" Make sure you're using rn-iconify components like:");
|
|
173
|
+
console.log(' <Mdi name="home" /> or prefetchIcons([\'mdi:home\'])\n');
|
|
174
|
+
return EXIT_CODES.SUCCESS;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
let output: string;
|
|
178
|
+
|
|
179
|
+
switch (format) {
|
|
180
|
+
case 'json':
|
|
181
|
+
output = formatJSON(result);
|
|
182
|
+
break;
|
|
183
|
+
case 'markdown':
|
|
184
|
+
output = formatMarkdown(result, detailed);
|
|
185
|
+
break;
|
|
186
|
+
case 'table':
|
|
187
|
+
default:
|
|
188
|
+
output = formatTable(result, detailed);
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
console.log(output);
|
|
193
|
+
|
|
194
|
+
return EXIT_CODES.SUCCESS;
|
|
195
|
+
}
|