transpileModule
uses tcmts.core.program.transpileForNode, which uses Buffer
Where transpileForNode can be imported from, for processes that load the same compilation through a module hook: this module and the export to import (by name from source; by hash when tcm runs from a codebase, where a function carries its hash).
import { exportId } from "#codebase/tcmts/core/hash"; import { transpileForNode } from "#codebase/tcmts/core/program"; export function transpileModule(): { url: string; export: string; transpile: typeof transpileForNode } { const hash = (transpileModule as unknown as Record<symbol, string | undefined>)[Symbol.for("tcm.hash")]; return { url: import.meta.url, export: hash ? exportId(hash) : "transpileModule", transpile: transpileForNode }; }