Home / Function/ fetchRegistryItems() — ui Function Reference

fetchRegistryItems() — ui Function Reference

Architecture documentation for the fetchRegistryItems() function in resolver.ts from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  d55b2df0_7c6f_b6fc_7615_359b44b0b05d["fetchRegistryItems()"]
  c819bacb_5122_731b_64d6_d23131b1f806["resolver.ts"]
  d55b2df0_7c6f_b6fc_7615_359b44b0b05d -->|defined in| c819bacb_5122_731b_64d6_d23131b1f806
  e645527e_af9e_1457_dc85_48f0a4c79a9a["resolveRegistryTree()"]
  e645527e_af9e_1457_dc85_48f0a4c79a9a -->|calls| d55b2df0_7c6f_b6fc_7615_359b44b0b05d
  f476bcff_f29a_8f7d_eaa0_e8bc5b1e6faf["resolveDependenciesRecursively()"]
  f476bcff_f29a_8f7d_eaa0_e8bc5b1e6faf -->|calls| d55b2df0_7c6f_b6fc_7615_359b44b0b05d
  a58cd53f_1cbe_da72_d846_9463c4f0a106["resolveRegistryItemsFromRegistries()"]
  d55b2df0_7c6f_b6fc_7615_359b44b0b05d -->|calls| a58cd53f_1cbe_da72_d846_9463c4f0a106
  style d55b2df0_7c6f_b6fc_7615_359b44b0b05d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/shadcn/src/registry/resolver.ts lines 68–109

export async function fetchRegistryItems(
  items: string[],
  config: Config,
  options: { useCache?: boolean } = {}
) {
  const results = await Promise.all(
    items.map(async (item) => {
      if (isLocalFile(item)) {
        return fetchRegistryLocal(item)
      }

      if (isUrl(item)) {
        const [result] = await fetchRegistry([item], options)
        try {
          return registryItemSchema.parse(result)
        } catch (error) {
          throw new RegistryParseError(item, error)
        }
      }

      if (item.startsWith("@") && config?.registries) {
        const paths = resolveRegistryItemsFromRegistries([item], config)
        const [result] = await fetchRegistry(paths, options)
        try {
          return registryItemSchema.parse(result)
        } catch (error) {
          throw new RegistryParseError(item, error)
        }
      }

      const path = `styles/${config?.style ?? "new-york-v4"}/${item}.json`
      const [result] = await fetchRegistry([path], options)
      try {
        return registryItemSchema.parse(result)
      } catch (error) {
        throw new RegistryParseError(item, error)
      }
    })
  )

  return results
}

Subdomains

Frequently Asked Questions

What does fetchRegistryItems() do?
fetchRegistryItems() is a function in the ui codebase, defined in packages/shadcn/src/registry/resolver.ts.
Where is fetchRegistryItems() defined?
fetchRegistryItems() is defined in packages/shadcn/src/registry/resolver.ts at line 68.
What does fetchRegistryItems() call?
fetchRegistryItems() calls 1 function(s): resolveRegistryItemsFromRegistries.
What calls fetchRegistryItems()?
fetchRegistryItems() is called by 2 function(s): resolveDependenciesRecursively, resolveRegistryTree.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free