master
Drew Owens Docs: the what-lives-where diagram on the main page, updated for 0.77.1 (one Owner filter for both lenses, field-by-fie… 759bca6
// Renders client-vs-server/where-it-lives.html to where-it-lives.png: the "what lives where"
// diagram on the main README and the client-vs-server sub-page. 1400 px wide at twice the
// pixels, in the suite's own Chrome. Run it whenever the HTML changes (docs/RELEASING.md).
//   node test/render-diagram.mjs
import puppeteer from './node_modules/puppeteer-core/lib/esm/puppeteer/puppeteer-core.js';
import { readdirSync } from 'node:fs';
import { join, dirname } from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url';
const HERE = dirname(fileURLToPath(import.meta.url));
const CHROME = process.env.CHROME_PATH || (() => {
  const dir = join(process.env.HOME, '.cache/puppeteer/chrome');
  const dirs = readdirSync(dir).filter(d => d.startsWith('linux-')).sort((a, b) => a.split('-')[1].localeCompare(b.split('-')[1], undefined, { numeric: true }));
  return join(dir, dirs.at(-1), 'chrome-linux64', 'chrome');
})();
const src = join(HERE, '..', 'client-vs-server', 'where-it-lives.html');
const out = join(HERE, '..', 'client-vs-server', 'where-it-lives.png');
const browser = await puppeteer.launch({ executablePath: CHROME, headless: 'new', args: ['--no-sandbox', '--disable-dev-shm-usage', '--hide-scrollbars'] });
try {
  const page = await browser.newPage();
  await page.setViewport({ width: 1400, height: 900, deviceScaleFactor: 2 });
  await page.goto(pathToFileURL(src).href, { waitUntil: 'networkidle0', timeout: 30000 }).catch(() => {});
  await page.evaluate(() => document.fonts.ready);
  const el = await page.$('#diagram');
  await el.screenshot({ path: out });
  const box = await el.boundingBox();
  console.log(`OK: wrote ${out} (${Math.round(box.width * 2)}x${Math.round(box.height * 2)})`);
} finally { await browser.close(); }