registrySearchFor
uses tcmts.registry.registryOpen, which uses node:crypto
What the header's search finds as you type: the first libraries whose newest version matches q (by name, docs
or type, as the search page finds them), each with its first few matches.
import { everyone, libraryHref, registryOpen, said, searchLibraries } from "#codebase/tcmts/registry"; export async function registrySearchFor(q: string) { registryOpen(); const who = await everyone(); return (await searchLibraries(q)).slice(0, 6).map(({ l, hits }) => { const w = who.get(l.did) ?? { did: l.did }; return { id: `${l.did} ${l.package}`, library: `${said(w)}/${l.package}`, version: l.latest.version, description: l.latest.facts?.description ?? "", href: libraryHref(w, l.package), hits: hits.slice(0, 4).map((h) => ({ id: h.path, name: h.name, signature: h.signature || h.detail, href: h.href, })), }; }); }
uses
- tcmts.registry.everyone
- tcmts.registry.libraryHref
- tcmts.registry.registryOpen
- tcmts.registry.said
- tcmts.registry.searchLibraries