Home / Function/ computeItemHash() — ui Function Reference

computeItemHash() — ui Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  c370e00a_83e4_54e2_7925_81dcdb37bc1d["computeItemHash()"]
  c819bacb_5122_731b_64d6_d23131b1f806["resolver.ts"]
  c370e00a_83e4_54e2_7925_81dcdb37bc1d -->|defined in| c819bacb_5122_731b_64d6_d23131b1f806
  fdbe99c6_359b_8328_7270_49407cee1afa["extractItemIdentifierFromDependency()"]
  fdbe99c6_359b_8328_7270_49407cee1afa -->|calls| c370e00a_83e4_54e2_7925_81dcdb37bc1d
  b52dca21_c127_9ab7_c3a4_02bb7ad550be["topologicalSortRegistryItems()"]
  b52dca21_c127_9ab7_c3a4_02bb7ad550be -->|calls| c370e00a_83e4_54e2_7925_81dcdb37bc1d
  style c370e00a_83e4_54e2_7925_81dcdb37bc1d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/shadcn/src/registry/resolver.ts lines 578–590

function computeItemHash(
  item: Pick<z.infer<typeof registryItemSchema>, "name">,
  source?: string
) {
  const identifier = source || item.name

  const hash = createHash("sha256")
    .update(identifier)
    .digest("hex")
    .substring(0, 8)

  return `${item.name}::${hash}`
}

Subdomains

Frequently Asked Questions

What does computeItemHash() do?
computeItemHash() is a function in the ui codebase, defined in packages/shadcn/src/registry/resolver.ts.
Where is computeItemHash() defined?
computeItemHash() is defined in packages/shadcn/src/registry/resolver.ts at line 578.
What calls computeItemHash()?
computeItemHash() is called by 2 function(s): extractItemIdentifierFromDependency, topologicalSortRegistryItems.

Analyze Your Own Codebase

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

Try Supermodel Free