packageUsers

tcmts.cli.package_pages.packageUsers · #wtywvj3w · term · runs anywhere

The named definitions using name at range.

import type { Codebase } from "#codebase/tcmts/cli/codebase";
import { usersOf } from "#codebase/tcmts/cli/upgrade";

export function packageUsers(
  cb: Codebase,
  name: string,
  range: string,
): { path: string; hash: string; kind: string; signature: string }[] {
  const out: { path: string; hash: string; kind: string; signature: string }[] = [];
  for (const h of usersOf(cb, name, range).keys()) {
    const rec = cb.store.getDef(h);
    for (const p of cb.store.pathsOf(h))
      out.push({
        path: p,
        hash: h,
        kind: rec?.kind ?? "term",
        signature: rec ? cb.store.shownSignature(rec) : "",
      });
  }
  return out.sort((a, b) => (a.path < b.path ? -1 : 1));
}

uses

used by