placeMix

tcmts.share.placeMix · #4fqklzor · term · runs anywhere

How many of these definitions run where (types, tests and files left out), kept for the head they were counted at.

import { isTestPath } from "#codebase/tcmts/cli/testing";
import type { PlaceMix, Share } from "#codebase/tcmts/share";
import type { NameRow } from "#codebase/tcmts/store";

export function placeMix(s: Pick<Share, "cb" | "cache">, rows: NameRow[], key: string): PlaceMix {
  return s.cache.atHead(s.cb, `mix ${key}`, () => {
    const placement = s.cache.placement(s.cb);
    const mix: PlaceMix = { server: 0, anywhere: 0, browser: 0 };
    for (const r of rows) {
      if (r.kind !== "term" || isTestPath(r.path)) continue;
      const place = placement.placeOf(r.hash).place;
      if (place === "server") mix.server++;
      else if (place === "browser") mix.browser++;
      else mix.anywhere++;
    }
    return mix;
  });
}

uses

used by