pageTreesOf

tcmts.cli.web.pageTreesOf · #phjbjw5r · term · runs anywhere

The trees a rendered page's server components rendered (__TCM_TREES__), as the page has them: encoded.

export function pageTreesOf(html: string): string | undefined {
  const recorded = /var __TCM_TREES__ = ("(?:[^"\\]|\\.)*");/.exec(html)?.[1];
  return recorded === undefined ? undefined : (JSON.parse(recorded) as string);
}

used by