hashesOfViewFile
uses node:path
The definitions a view file shows: lib/square.ts → lib.square, @<hash>.ts → that hash.
import type { CodebaseCore } from "#codebase/tcmts/cli/codebase"; import { srcDir } from "#codebase/tcmts/cli/views"; import path_2 from "node:path"; export function hashesOfViewFile(cb: CodebaseCore, file: string): string[] { const rel = path_2 .relative(srcDir(cb), file) .split(path_2.sep) .join("/") .replace(/\.tsx?$/, ""); if (rel.startsWith("..")) return []; try { return rel.startsWith("@") ? cb.lookup(`#${rel.slice(1)}`) : cb.lookup(rel.replaceAll("/", ".")); } catch { return []; } }