--- import { RUNTIMES } from '../../scripts/registry.mjs'; // Brand marks from simple-icons (CC0), vendored rather than pulled at build time. `?raw` inlines // them so each is one path in the HTML instead of four more requests. import node from '../icons/nodedotjs.svg?raw'; import deno from '../icons/deno.svg?raw'; import bun from '../icons/bun.svg?raw'; import workerd from '../icons/cloudflareworkers.svg?raw'; interface Props { runtimes: string[]; internal: boolean; } const { runtimes, internal } = Astro.props; const ICONS: Record = { node, deno, bun, workerd }; const LABELS: Record = { node: 'Node.js', deno: 'Deno', bun: 'Bun', workerd: 'workerd (Cloudflare Workers)', }; // All four are always shown. Colour means the package declares it runs there; dim grey means it // declared otherwise, or said nothing — the tooltip is what separates those two, because at a // glance they are the same fact: you cannot use it there. const runs = (runtime: string) => runtimes.includes(runtime); const tooltip = (runtime: string) => { if (runs(runtime)) return `Runs on ${LABELS[runtime]}`; return internal ? `Does not run on ${LABELS[runtime]} — see the README for why` : `${LABELS[runtime]} not declared by this package`; }; ---