librariesOfCodebase

tcmts.registry.librariesOfCodebase · #loyhgcng · term · runs anywhere

The libraries a served codebase holds, by libraryKey (librariesOfRemote): an http(s) address alone, at a public address, asked with no credentials (publicRemote: never a path, or a remote's name). A codebase that can't be read holds none.

import type { Codebase } from "#codebase/tcmts/cli/codebase";
import { publicRemote } from "#codebase/tcmts/cli/sync";
import { librariesOfRemote } from "#codebase/tcmts/registry";

export async function librariesOfCodebase(cb: Codebase, url: string): Promise<Set<string>> {
  try {
    return await librariesOfRemote(await publicRemote(url, "a visitor's codebase"));
  } catch (e) {
    console.warn(
      `registry: couldn't read the libraries of ${url}: ${(e as Error).message.split("\n")[0]}`,
    );
    return new Set();
  }
}

uses

used by