installDir

tcmts.loader.packages.installDir · #twcf5ll4 · term · runs on the server

uses node:path

Where a locked package range is installed: its alias, @types/<alias> for DefinitelyTyped packages.

import type { Layout } from "#codebase/tcmts/loader";
import { npmAlias } from "#codebase/tcmts/loader/packages";
import path from "node:path";

export function installDir(lay: Layout, name: string, range: string): string {
  const alias = name.startsWith("@types/") ? `@types/${npmAlias(`npm:${name.slice("@types/".length)}@${range}`)}` : npmAlias(`npm:${name}@${range}`);
  return path.join(lay.cacheDir, "node_modules", alias);
}

uses

used by