componentOf
uses node:sqlite
import { hashOf } from "#codebase/tcmts/cli/test/e2e/import"; import path from "node:path"; import { DatabaseSync } from "node:sqlite"; export function componentOf(dir: string, name: string): string { const db = new DatabaseSync(path.join(dir, ".tcm", "codebase.sqlite"), { readOnly: true }); try { return (db.prepare("SELECT component_hash AS c FROM definitions WHERE hash = ?").get(hashOf(dir, name)) as { c: string }).c; } finally { db.close(); } }