feat: the plugin listing, built from registry data

One YAML file per plugin. There is deliberately no version and no runtimes
field in an entry: both are read from npm and JSR when the page is built, so a
card cannot go stale or claim support a package never declared.

The strictness lives in one flag. Under CI a registry that does not answer
fails the build, because a listing that silently drops a plugin is worse than
no deploy. Locally an unpublished package falls back to scripts/preview.mjs and
says so — a site nobody can look at until its packages ship is a site nobody
can design. The three seed plugins are unpublished today, so that fallback is
what renders them; it goes away with them.

Every card shows all four runtimes, never only the supported ones. Colour means
the package declares it runs there, dim grey means it does not — and the
tooltip is what separates "declared unsupported" from "nobody said", which look
identical but are not the same fact.

The brand marks carry no <title>: an SVG's own title wins over its parent's,
which is why the first attempt showed a help cursor and no tooltip. They are
aria-hidden and pointer-events: none, so the label and the hover both belong to
the list item, and the tooltip works from the keyboard too.

Type and palette are self-hosted from green-tea-site, so the sites read as one
project rather than three that share a colour.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
chrnx committed 2026-09-20 12:44:06 -05:00
commit 3ee6928d94
24 files changed
+5203

No files matched your search

+83
View File
@@ -0,0 +1,83 @@
---
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 {
name: string;
description: string;
repo: string;
version: string;
npm?: string;
jsr?: string;
runtimes: string[];
internal: boolean;
}
const { name, description, repo, version, npm, jsr, runtimes, internal } = Astro.props;
const ICONS: Record<string, string> = { node, deno, bun, workerd };
const LABELS: Record<string, string> = {
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`;
};
---
<article class="card">
<span class="version">{version}</span>
<h2>{name}</h2>
<ul class="runtimes">
{
RUNTIMES.map((runtime) => (
// `data-tip` rather than `title`: the native tooltip waits about a second, cannot be
// styled, and — the reason it did not work at all here — loses to a `<title>` inside the
// SVG. The marks now carry no `<title>`, and the label lives on this element for both the
// tooltip and the screen reader. `tabindex` so it is reachable without a mouse.
<li
class={runs(runtime) ? 'yes' : 'no'}
data-tip={tooltip(runtime)}
role="img"
aria-label={tooltip(runtime)}
tabindex="0"
>
<Fragment set:html={ICONS[runtime]} />
</li>
))
}
</ul>
<p>{description}</p>
<p class="links">
{npm && <a href={`https://www.npmjs.com/package/${npm}`}>npm</a>}
{jsr && <a href={`https://jsr.io/${jsr}`}>JSR</a>}
<a href={repo}>source</a>
</p>
{
internal && (
<p class="why">
<a href={`${repo}#runtimes`}>why not the others</a>
</p>
)
}
</article>