@profullstack/waitlist 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -22,12 +22,46 @@ moshcode name c0mpute alt.atheism <site_id> # https://alt.atheism and alt
22
22
  `waitlist build-many sites.json --out sites` builds one folder per entry
23
23
  (`[{ name, title, tagline, about, points, look, kicker }]`).
24
24
 
25
- Each site gets `index.html`, `404.html`, `robots.txt`, `sitemap.xml`, the CSS and chart
25
+ Each site gets `index.html`, `404.html`, `og.png`, `llms.txt`, `robots.txt`, `sitemap.xml`, the CSS and chart
26
26
  assets, the Profullstack webring footer and (for Moshpit names) the pit.world footer, plus
27
27
  the network's crawlproof tag. Leave `--look` out and one is picked from the name: `comp.*`
28
28
  terminal, `alt.*` GeoCities, `sci.*` matrix, `rec.*` synthwave, `soc.*` vaporwave,
29
29
  `news.*` amber, `talk.*` neon.
30
30
 
31
+ ## SEO, social cards, AEO and GEO
32
+
33
+ Every site is built with its own search and share metadata, written from that site's name,
34
+ tagline and points (no generic copy):
35
+
36
+ - **Head:** unique `<title>`, meta description (160 chars max), canonical, robots,
37
+ theme-color (the look's canvas), SVG + PNG icons, `lang`.
38
+ - **Social:** `og:*` (title, description, url, type, site_name, locale, image with
39
+ width/height/alt) and `twitter:card=summary_large_image`.
40
+ - **`og.png`:** a real 1200x630 PNG rendered at build time in the site's look (colors,
41
+ type, decoration) with its name, tagline and call to action, via `@resvg/resvg-js`
42
+ (prebuilt, no system deps). `og.svg` sits next to it.
43
+ - **AEO:** JSON-LD `@graph` with WebSite, Organization, WebPage and FAQPage. The same 3-5
44
+ Q&As show on the page as a visible FAQ, under an answer-first summary.
45
+ - **GEO:** `/llms.txt` (what it is, status: waitlist, how to join, FAQ), `sitemap.xml`
46
+ (with the image), `robots.txt` that names and allows the AI crawlers (GPTBot,
47
+ ClaudeBot, PerplexityBot, Google-Extended, ...), and an IndexNow key file;
48
+ `waitlist indexnow sites.json` pings IndexNow after publishing.
49
+
50
+ Canonical URL: a Moshpit name only resolves through a Moshpit-aware resolver, so its
51
+ canonical (and every absolute URL in the cards) is the pit.world relay,
52
+ `https://<name>.pit.world/`, with `https://<name>/` as the alternate. Clearnet names use
53
+ `https://<name>/`.
54
+
55
+ Override anything per site in `sites.json`: `url`, `nativeUrl`, `image`, `imageAlt`,
56
+ `seoTitle`, `description`, `summary`, `faq` (`[{ q, a }]`), `keywords`, `sameAs`,
57
+ `audience`, `lang`, `locale`, `siteName`, `themeColor`, `twitter`, `publisher`,
58
+ `schema` (extra JSON-LD nodes), `indexnowKey`, `updated`.
59
+
60
+ ```js
61
+ import { normalize } from '@profullstack/waitlist/build';
62
+ import { headTags, jsonLd, llmsTxt, ogSvg, svgToPng } from '@profullstack/waitlist/seo';
63
+ ```
64
+
31
65
  ## Use the components on any page
32
66
 
33
67
  ```html
package/bin/waitlist.js CHANGED
@@ -1,18 +1,27 @@
1
1
  #!/usr/bin/env node
2
- import { buildSite, buildMany, readSpecs } from '../src/build.js';
2
+ import { buildSite, buildMany, readSpecs, normalize } from '../src/build.js';
3
+ import { pingIndexNow } from '../src/seo.js';
3
4
 
4
5
  const HELP = `waitlist: build static waitlist sites (@profullstack/css + @profullstack/charts)
5
6
 
6
7
  usage:
7
8
  waitlist build --name <name> [--title T] [--tagline T] [--about T] [--point P]... [--out dir]
8
9
  waitlist build-many <sites.json> [--out dir] one folder per site under --out
10
+ waitlist indexnow <sites.json> ping IndexNow for every site (after publishing)
9
11
 
10
12
  flags:
11
- --api <url> waitlist API (default https://moshcoding.com)
12
- --host <host> public host (default <name>.pit.world for Moshpit names)
13
+ --api <url> waitlist API (default https://moshcoding.com)
14
+ --host <host> public host (default <name>.pit.world for Moshpit names)
15
+ --url <url> canonical URL (default https://<host>/)
16
+ --image <url> og:image URL (default <url>og.png, rendered at build time)
17
+ --description <t> meta description (default: derived from tagline + points)
13
18
  --theme dark|light
14
- --look <look> neon|matrix|terminal|amber|synthwave|geocities|vaporwave (default: picked from the name)
15
- --no-footers skip the webring + pit.world footers (offline builds)
19
+ --look <look> neon|matrix|terminal|amber|synthwave|geocities|vaporwave (default: picked from the name)
20
+ --no-footers skip the webring + pit.world footers (offline builds)
21
+ --no-images skip the PNG renders (og.png, icons)
22
+
23
+ Every site field (seoTitle, description, summary, faq, image, imageAlt, keywords, sameAs,
24
+ audience, lang, locale, themeColor, twitter, schema, ...) can be set per site in sites.json.
16
25
 
17
26
  publish: c0mpute hosting publish <dir> --name waitlist-<name>
18
27
  moshcode name c0mpute <name> <site_id>`;
@@ -24,6 +33,7 @@ const pos = [];
24
33
  for (let i = 0; i < argv.length; i++) {
25
34
  const a = argv[i];
26
35
  if (a === '--no-footers') flags.footers = false;
36
+ else if (a === '--no-images') flags.images = false;
27
37
  else if (a.startsWith('--')) {
28
38
  const k = a.slice(2);
29
39
  const v = argv[++i];
@@ -32,14 +42,18 @@ for (let i = 0; i < argv.length; i++) {
32
42
  } else pos.push(a);
33
43
  }
34
44
 
35
- const opts = { footers: flags.footers !== false };
45
+ const opts = { footers: flags.footers !== false, images: flags.images !== false };
46
+ const pick = (o) => Object.fromEntries(Object.entries(o).filter(([, v]) => v !== undefined));
36
47
  if (cmd === 'build') {
37
- const s = await buildSite({ name: flags.name, title: flags.title, tagline: flags.tagline, about: flags.about, points: flags.point, api: flags.api, host: flags.host, theme: flags.theme, look: flags.look }, flags.out || `./${flags.name}`, opts);
48
+ const s = await buildSite(pick({ name: flags.name, title: flags.title, tagline: flags.tagline, about: flags.about, points: flags.point, api: flags.api, host: flags.host, url: flags.url, image: flags.image, description: flags.description, theme: flags.theme, look: flags.look }), flags.out || `./${flags.name}`, opts);
38
49
  console.log(`built ${s.name} -> ${flags.out || `./${s.name}`}`);
39
50
  } else if (cmd === 'build-many' && pos[0]) {
40
51
  const specs = await readSpecs(pos[0]);
41
- const done = await buildMany(specs.map((s) => ({ api: flags.api, theme: flags.theme, ...s })), flags.out || './sites', opts);
52
+ const done = await buildMany(specs.map((s) => ({ ...pick({ api: flags.api, theme: flags.theme }), ...s })), flags.out || './sites', opts);
42
53
  console.log(`built ${done.length} sites -> ${flags.out || './sites'}`);
54
+ } else if (cmd === 'indexnow' && pos[0]) {
55
+ const sites = (await readSpecs(pos[0])).map(normalize);
56
+ for (const r of await pingIndexNow(sites)) console.log(`${r.host}\t${r.status}${r.error ? `\t${r.error}` : ''}`);
43
57
  } else {
44
58
  console.log(HELP);
45
59
  process.exit(cmd && cmd !== 'help' && cmd !== '--help' ? 1 : 0);
package/package.json CHANGED
@@ -1,26 +1,53 @@
1
1
  {
2
2
  "name": "@profullstack/waitlist",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Email waitlist for any launch page: a <waitlist-form> web component, a live signup chart, and a static-site builder on @profullstack/css + @profullstack/charts.",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "author": "Profullstack, Inc.",
8
8
  "homepage": "https://github.com/profullstack/waitlist#readme",
9
- "repository": { "type": "git", "url": "git+https://github.com/profullstack/waitlist.git" },
10
- "keywords": ["waitlist", "launch", "landing-page", "web-component", "static-site", "c0mpute", "moshpit"],
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/profullstack/waitlist.git"
12
+ },
13
+ "keywords": [
14
+ "waitlist",
15
+ "launch",
16
+ "landing-page",
17
+ "web-component",
18
+ "static-site",
19
+ "c0mpute",
20
+ "moshpit",
21
+ "seo",
22
+ "open-graph",
23
+ "llms-txt"
24
+ ],
11
25
  "exports": {
12
26
  ".": "./src/index.js",
13
27
  "./build": "./src/build.js",
28
+ "./seo": "./src/seo.js",
14
29
  "./waitlist.css": "./src/waitlist.css",
15
30
  "./package.json": "./package.json"
16
31
  },
17
- "bin": { "waitlist": "bin/waitlist.js" },
18
- "files": ["src", "bin", "README.md", "LICENSE"],
19
- "engines": { "node": ">=20" },
20
- "scripts": { "test": "node --test" },
32
+ "bin": {
33
+ "waitlist": "bin/waitlist.js"
34
+ },
35
+ "files": [
36
+ "src",
37
+ "bin",
38
+ "README.md",
39
+ "LICENSE"
40
+ ],
41
+ "engines": {
42
+ "node": ">=20"
43
+ },
44
+ "scripts": {
45
+ "test": "node --test"
46
+ },
21
47
  "dependencies": {
22
48
  "@profullstack/charts": "^0.3.0",
23
49
  "@profullstack/css": "^0.4.0",
24
- "@profullstack/footer": "^0.7.3"
50
+ "@profullstack/footer": "^0.7.3",
51
+ "@resvg/resvg-js": "^2.6.2"
25
52
  }
26
53
  }
package/src/build.js CHANGED
@@ -6,6 +6,12 @@ import { mkdir, writeFile, copyFile, readFile } from 'node:fs/promises';
6
6
  import { createRequire } from 'node:module';
7
7
  import { dirname, join } from 'node:path';
8
8
  import { fileURLToPath } from 'node:url';
9
+ import {
10
+ esc, seoDefaults, headTags, jsonLdTag, faqHtml, llmsTxt, robotsTxt, sitemapXml,
11
+ indexNowKey, ogSvg, iconSvg as lookIconSvg, svgToPng,
12
+ } from './seo.js';
13
+
14
+ export { esc };
9
15
 
10
16
  const require = createRequire(import.meta.url);
11
17
  const here = dirname(fileURLToPath(import.meta.url));
@@ -13,10 +19,6 @@ const here = dirname(fileURLToPath(import.meta.url));
13
19
  /** The crawlproof project every Moshpit landing and parked page reports to. */
14
20
  export const MOSHPIT_STATS_SITE = '2cbffe9d-1b6e-43f0-85f3-3cadee132048';
15
21
 
16
- export function esc(s) {
17
- return String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
18
- }
19
-
20
22
  /** Every look @profullstack/css/looks ships. */
21
23
  export const LOOKS = ['neon', 'matrix', 'terminal', 'amber', 'synthwave', 'geocities', 'vaporwave'];
22
24
 
@@ -42,16 +44,29 @@ export function relayHost(name) {
42
44
  return name.endsWith('.pit.world') ? name : `${name}.pit.world`;
43
45
  }
44
46
 
45
- /** Fill defaults and validate one site spec. */
47
+ function withSlash(u) {
48
+ return u.endsWith('/') ? u : `${u}/`;
49
+ }
50
+
51
+ /**
52
+ * Fill defaults and validate one site spec. Every field below can be set per site in
53
+ * sites.json; SEO fields (seoTitle, description, summary, imageAlt, faq) are derived
54
+ * from the site's own name, tagline and points when left out.
55
+ */
46
56
  export function normalize(spec) {
47
57
  const name = String(spec.name || '').trim().toLowerCase();
48
58
  if (!/^[a-z0-9-]+(\.[a-z0-9-]+)+$/.test(name)) throw new Error(`bad name: ${spec.name}`);
49
59
  const moshpit = spec.moshpit ?? !/\.(com|org|net|io|dev|app|sh|xyz|me|info|co|ai)$/.test(name);
50
60
  const host = spec.host || (moshpit ? relayHost(name) : name);
51
- return {
61
+ // Canonical: the host a crawler can resolve. A Moshpit name only resolves through a
62
+ // Moshpit-aware resolver, so its canonical is the pit.world relay and https://<name> the alternate.
63
+ const url = withSlash(spec.url || `https://${host}/`);
64
+ const s = {
52
65
  name,
53
66
  host,
54
67
  moshpit,
68
+ url,
69
+ nativeUrl: withSlash(spec.nativeUrl || (moshpit ? `https://${name}/` : url)),
55
70
  dn: spec.dn || name,
56
71
  title: spec.title || name,
57
72
  tagline: spec.tagline || `${name} is coming soon.`,
@@ -59,42 +74,51 @@ export function normalize(spec) {
59
74
  points: Array.isArray(spec.points) ? spec.points : [],
60
75
  kicker: spec.kicker || (moshpit ? 'Coming soon on the Moshpit' : 'Coming soon'),
61
76
  button: spec.button || 'Join the waitlist',
62
- api: spec.api || 'https://moshcoding.com',
77
+ api: (spec.api || 'https://moshcoding.com').replace(/\/$/, ''),
63
78
  theme: spec.theme || 'dark',
64
79
  look: LOOKS.includes(spec.look) ? spec.look : lookFor(name),
65
80
  marquee: spec.marquee || `Welcome to ${name}! You are visitor #000${(name.length * 7919) % 9000 + 1000}. Sign the waitlist below!`,
66
81
  crawlproof: spec.crawlproof === undefined ? (moshpit ? MOSHPIT_STATS_SITE : null) : spec.crawlproof,
82
+ lang: spec.lang || 'en',
83
+ locale: spec.locale || 'en_US',
84
+ siteName: spec.siteName || spec.title || name,
85
+ image: spec.image || `${url}og.png`,
86
+ themeColor: spec.themeColor || null,
87
+ twitter: spec.twitter || null,
88
+ keywords: Array.isArray(spec.keywords) ? spec.keywords : [],
89
+ sameAs: Array.isArray(spec.sameAs) ? spec.sameAs : [],
90
+ publisher: spec.publisher === undefined ? { name: 'Profullstack', url: 'https://profullstack.com' } : spec.publisher,
91
+ schema: spec.schema || null,
92
+ audience: spec.audience || '',
93
+ indexnowKey: spec.indexnowKey || indexNowKey(name),
94
+ updated: spec.updated || new Date().toISOString().slice(0, 10),
67
95
  };
96
+ const d = seoDefaults(s);
97
+ s.seoTitle = spec.seoTitle || d.seoTitle;
98
+ s.description = spec.description || d.description;
99
+ s.summary = spec.summary || d.summary;
100
+ s.imageAlt = spec.imageAlt || d.imageAlt;
101
+ s.faq = Array.isArray(spec.faq) && spec.faq.length ? spec.faq.map((f) => ({ q: f.q ?? f.question, a: f.a ?? f.answer })) : d.faq;
102
+ return s;
68
103
  }
69
104
 
70
105
  /** The page HTML. `footers` is pre-rendered HTML (webring row, pit.world footer) placed last. */
71
- export function pageHtml(s, { footers = '' } = {}) {
72
- const url = `https://${s.host}/`;
73
- const desc = `${s.tagline} Join the waitlist.`;
106
+ export function pageHtml(s, { footers = '', noindex = false } = {}) {
74
107
  const points = s.points.length
75
108
  ? `<section class="stack" aria-labelledby="what"><h2 id="what">What's coming</h2><ul class="waitlist-points">${s.points.map((p) => `<li>${esc(p)}</li>`).join('')}</ul></section>`
76
109
  : '';
77
110
  const about = s.about ? `<p>${esc(s.about)}</p>` : '';
78
- const ld = { '@context': 'https://schema.org', '@type': 'WebSite', name: s.title, url, description: desc };
79
111
  return `<!doctype html>
80
- <html lang="en" data-theme="${esc(s.theme)}" data-look="${esc(s.look)}">
112
+ <html lang="${esc(s.lang)}" data-theme="${esc(s.theme)}" data-look="${esc(s.look)}">
81
113
  <head>
82
114
  <meta charset="utf-8">
83
115
  <meta name="viewport" content="width=device-width, initial-scale=1">
84
- <title>${esc(s.title)}: ${esc(s.tagline)}</title>
85
- <meta name="description" content="${esc(desc)}">
86
- <link rel="canonical" href="${esc(url)}">
87
- <meta property="og:type" content="website">
88
- <meta property="og:title" content="${esc(s.title)}">
89
- <meta property="og:description" content="${esc(desc)}">
90
- <meta property="og:url" content="${esc(url)}">
91
- <meta name="twitter:card" content="summary">
92
- <link rel="icon" href="assets/icon.svg" type="image/svg+xml">
116
+ ${headTags(s, { noindex })}
93
117
  <link rel="stylesheet" href="assets/profullstack.css">
94
118
  <link rel="stylesheet" href="assets/looks.css">
95
119
  <link rel="stylesheet" href="assets/charts.css">
96
120
  <link rel="stylesheet" href="assets/waitlist.css">
97
- <script type="application/ld+json">${JSON.stringify(ld).replace(/</g, '\\u003c')}</script>
121
+ ${jsonLdTag(s)}
98
122
  </head>
99
123
  <body class="waitlist-page">
100
124
  <div data-look-marquee aria-hidden="true"><span>${esc(s.marquee)}</span></div>
@@ -103,6 +127,7 @@ export function pageHtml(s, { footers = '' } = {}) {
103
127
  <p class="waitlist-kicker"><span class="badge">${esc(s.kicker)}</span></p>
104
128
  <h1>${esc(s.title)}</h1>
105
129
  <p class="waitlist-tagline">${esc(s.tagline)}</p>
130
+ <p class="waitlist-answer">${esc(s.summary)}</p>
106
131
  ${about}
107
132
  <waitlist-form dn="${esc(s.dn)}" api="${esc(s.api)}" button="${esc(s.button)}">
108
133
  <form class="stack" method="post" action="${esc(s.api)}/api/waitlist"><label for="wl-email">Email</label>
@@ -115,9 +140,10 @@ export function pageHtml(s, { footers = '' } = {}) {
115
140
  <waitlist-stats dn="${esc(s.dn)}" api="${esc(s.api)}" days="30"></waitlist-stats>
116
141
  </section>
117
142
  </div>
118
- <p class="waitlist-meta">${s.moshpit ? `Also at <a href="https://${esc(s.name)}">https://${esc(s.name)}</a> on the Moshpit. ` : ''}One email when it opens, nothing else. Hosted on <a href="https://c0mpute.com/hosting">c0mpute</a>.</p>
143
+ ${faqHtml(s)}
144
+ <p class="waitlist-meta">${s.moshpit ? `Also at <a href="${esc(s.nativeUrl)}">${esc(s.nativeUrl.replace(/\/$/, ''))}</a> on the Moshpit. ` : ''}One email when it opens, nothing else. Hosted on <a href="https://c0mpute.com/hosting">c0mpute</a>.</p>
119
145
  </main>
120
- <footer class="site-footer container"><p class="waitlist-meta">${esc(s.title)} · <a href="https://pit.world/directory">pit.world directory</a></p></footer>
146
+ <footer class="site-footer container"><p class="waitlist-meta">${esc(s.title)} · <a href="llms.txt">llms.txt</a>${s.moshpit ? ' · <a href="https://pit.world/directory">pit.world directory</a>' : ''}</p></footer>
121
147
  ${footers}
122
148
  <script src="assets/charts.global.js"></script>
123
149
  <script type="module" src="assets/waitlist.js"></script>
@@ -127,9 +153,9 @@ ${s.crawlproof ? `<script defer data-site="${esc(s.crawlproof)}" src="https://cr
127
153
  `;
128
154
  }
129
155
 
130
- export function iconSvg(name) {
131
- const ch = esc((name.match(/[a-z0-9]/i) || ['?'])[0].toUpperCase());
132
- return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><rect width="64" height="64" rx="14" fill="#111"/><text x="32" y="44" text-anchor="middle" font-family="ui-monospace,monospace" font-size="36" font-weight="700" fill="#7CFC00">${ch}</text></svg>\n`;
156
+ /** Square icon in the look's colors (takes a normalized spec or a bare name). */
157
+ export function iconSvg(s) {
158
+ return lookIconSvg(typeof s === 'string' ? normalize({ name: s }) : s);
133
159
  }
134
160
 
135
161
  /** Render the shared footers for a host: the Profullstack webring row, then (Moshpit names only) the pit.world footer. */
@@ -152,8 +178,11 @@ export async function renderFooters(s, { fetchImpl = globalThis.fetch } = {}) {
152
178
  return out;
153
179
  }
154
180
 
155
- /** Write the site for one spec into `out`. Returns the normalized spec. */
156
- export async function buildSite(spec, out, { footers = true, fetchImpl } = {}) {
181
+ /**
182
+ * Write the site for one spec into `out`. Returns the normalized spec.
183
+ * `images: false` skips the PNG renders (og.png, icons), e.g. where @resvg/resvg-js cannot load.
184
+ */
185
+ export async function buildSite(spec, out, { footers = true, images = true, fetchImpl } = {}) {
157
186
  const s = normalize(spec);
158
187
  await mkdir(join(out, 'assets'), { recursive: true });
159
188
  await mkdir(join(out, '.well-known'), { recursive: true });
@@ -164,14 +193,23 @@ export async function buildSite(spec, out, { footers = true, fetchImpl } = {}) {
164
193
  await copyFile(join(chartsDir, 'charts.css'), join(out, 'assets', 'charts.css'));
165
194
  await copyFile(join(here, 'index.js'), join(out, 'assets', 'waitlist.js'));
166
195
  await copyFile(join(here, 'waitlist.css'), join(out, 'assets', 'waitlist.css'));
167
- await writeFile(join(out, 'assets', 'icon.svg'), iconSvg(s.name));
196
+ const icon = iconSvg(s);
197
+ await writeFile(join(out, 'assets', 'icon.svg'), icon);
198
+ const og = ogSvg(s);
199
+ await writeFile(join(out, 'og.svg'), og);
200
+ if (images) {
201
+ await writeFile(join(out, 'og.png'), await svgToPng(og));
202
+ await writeFile(join(out, 'assets', 'icon-192.png'), await svgToPng(icon, { width: 192 }));
203
+ await writeFile(join(out, 'assets', 'icon-180.png'), await svgToPng(icon, { width: 180 }));
204
+ }
168
205
  const foot = footers ? await renderFooters(s, { fetchImpl }) : '';
169
- const html = pageHtml(s, { footers: foot });
170
- await writeFile(join(out, 'index.html'), html);
171
- await writeFile(join(out, '404.html'), html);
172
- await writeFile(join(out, 'robots.txt'), `User-agent: *\nAllow: /\nSitemap: https://${s.host}/sitemap.xml\n`);
173
- await writeFile(join(out, 'sitemap.xml'), `<?xml version="1.0" encoding="UTF-8"?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url><loc>https://${s.host}/</loc></url></urlset>\n`);
174
- await writeFile(join(out, '.well-known', 'openwebring.json'), JSON.stringify({ name: s.title, url: `https://${s.host}/`, ring: 'profullstack', description: s.tagline }, null, 2) + '\n');
206
+ await writeFile(join(out, 'index.html'), pageHtml(s, { footers: foot }));
207
+ await writeFile(join(out, '404.html'), pageHtml(s, { footers: foot, noindex: true }));
208
+ await writeFile(join(out, 'robots.txt'), robotsTxt(s));
209
+ await writeFile(join(out, 'sitemap.xml'), sitemapXml(s));
210
+ await writeFile(join(out, 'llms.txt'), llmsTxt(s));
211
+ await writeFile(join(out, `${s.indexnowKey}.txt`), `${s.indexnowKey}\n`);
212
+ await writeFile(join(out, '.well-known', 'openwebring.json'), JSON.stringify({ name: s.title, url: s.url, ring: 'profullstack', description: s.tagline }, null, 2) + '\n');
175
213
  return s;
176
214
  }
177
215
 
package/src/seo.js ADDED
@@ -0,0 +1,327 @@
1
+ /**
2
+ * @profullstack/waitlist/seo: everything a search engine, a link unfurler or an
3
+ * answer engine reads about one waitlist site, derived from its spec.
4
+ *
5
+ * - head tags: title, description, canonical, robots, theme-color, icons,
6
+ * Open Graph and Twitter cards with a real 1200x630 PNG
7
+ * - JSON-LD: WebSite + Organization + WebPage + FAQPage (the same Q&As are on the page)
8
+ * - llms.txt, robots.txt (AI crawlers allowed), sitemap.xml, IndexNow key file
9
+ *
10
+ * Every derived value can be overridden per site in sites.json (see normalize in build.js).
11
+ */
12
+ import { createHash } from 'node:crypto';
13
+
14
+ export function esc(s) {
15
+ return String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
16
+ }
17
+
18
+ export const OG_WIDTH = 1200;
19
+ export const OG_HEIGHT = 630;
20
+
21
+ const MONO = "'DejaVu Sans Mono', 'Liberation Mono', 'Courier New', monospace";
22
+ const SANS = "'DejaVu Sans', 'Liberation Sans', Arial, sans-serif";
23
+
24
+ /** Colors and type per look, mirrored from @profullstack/css/looks.css. */
25
+ export const PALETTES = {
26
+ neon: { bg: '#07020f', bg2: '#1b0830', ink: '#f2e9ff', muted: '#c7b4e8', title: '#ff2bd6', accent: '#33f6ff', onAccent: '#07020f', font: SANS, deco: 'glow' },
27
+ matrix: { bg: '#000000', bg2: '#001a06', ink: '#b6ffc8', muted: '#6fdc8c', title: '#00ff41', accent: '#00ff41', onAccent: '#000000', font: MONO, deco: 'rain' },
28
+ terminal: { bg: '#0b0b0b', bg2: '#1c1c1c', ink: '#d0d0d0', muted: '#9e9e9e', title: '#5fd700', accent: '#5fd700', onAccent: '#000000', font: MONO, deco: 'prompt' },
29
+ amber: { bg: '#0d0800', bg2: '#1e1200', ink: '#ffb000', muted: '#d99a2b', title: '#ffb000', accent: '#ffcc66', onAccent: '#1a0f00', font: MONO, deco: 'scan' },
30
+ synthwave: { bg: '#12002b', bg2: '#2b0057', ink: '#ffffff', muted: '#f3c6ff', title: '#ffd319', accent: '#ff2975', onAccent: '#ffffff', font: SANS, deco: 'grid' },
31
+ geocities: { bg: '#000033', bg2: '#000080', ink: '#ffffff', muted: '#00ff00', title: '#ffff00', accent: '#c0c0c0', onAccent: '#000000', font: "'Comic Neue', 'Comic Sans MS', " + SANS, deco: 'stars' },
32
+ vaporwave: { bg: '#ffd6f5', bg2: '#c2f0ff', ink: '#2d1b46', muted: '#5b3f7a', title: '#ff71ce', accent: '#b967ff', onAccent: '#ffffff', font: SANS, deco: 'shadow' },
33
+ };
34
+
35
+ export function paletteFor(look) {
36
+ return PALETTES[look] || PALETTES.terminal;
37
+ }
38
+
39
+ /** Cut to `max` chars on a word boundary, adding an ellipsis when cut. */
40
+ export function clip(text, max) {
41
+ const t = String(text ?? '').replace(/\s+/g, ' ').trim();
42
+ if (t.length <= max) return t;
43
+ const cut = t.slice(0, max - 1);
44
+ const sp = cut.lastIndexOf(' ');
45
+ return (sp > max * 0.6 ? cut.slice(0, sp) : cut).replace(/[\s,.;:]+$/, '') + '…';
46
+ }
47
+
48
+ /** Greedy word wrap at ~`width` chars per line, at most `lines` lines. */
49
+ export function wrap(text, width, lines = 3) {
50
+ const words = String(text ?? '').split(/\s+/).filter(Boolean);
51
+ const out = [];
52
+ let cur = '';
53
+ for (const w of words) {
54
+ if (!cur) cur = w;
55
+ else if ((cur + ' ' + w).length <= width) cur += ' ' + w;
56
+ else { out.push(cur); cur = w; }
57
+ }
58
+ if (cur) out.push(cur);
59
+ if (out.length > lines) {
60
+ const kept = out.slice(0, lines);
61
+ kept[lines - 1] = clip(kept[lines - 1] + ' ' + out.slice(lines).join(' '), width);
62
+ return kept;
63
+ }
64
+ return out;
65
+ }
66
+
67
+ function sentence(t) {
68
+ const s = String(t ?? '').trim();
69
+ return !s || /[.!?…]$/.test(s) ? s : s + '.';
70
+ }
71
+
72
+ /** Default derived SEO fields for a normalized spec `s` (overrides already applied by the caller). */
73
+ export function seoDefaults(s) {
74
+ const points = s.points || [];
75
+ const where = s.moshpit ? ` on the Moshpit` : '';
76
+ return {
77
+ seoTitle: clip(`${s.title}: ${s.tagline.replace(/[.!]$/, '')}`, 70),
78
+ description: clip(`${sentence(s.tagline)}${points.length ? ` ${sentence(points.slice(0, 2).join('. '))}` : ''} Join the waitlist.`, 160),
79
+ summary: `${s.title} is a new site${where} that is not open yet. ${sentence(s.tagline)} Join the waitlist to get one email when it opens.`,
80
+ imageAlt: `${s.title}: ${s.tagline}`,
81
+ faq: defaultFaq(s),
82
+ };
83
+ }
84
+
85
+ /** 3-5 Q&As written from the site's own name, tagline and points. */
86
+ export function defaultFaq(s) {
87
+ const points = s.points || [];
88
+ const faq = [{ q: `What is ${s.title}?`, a: `${sentence(s.tagline)} ${s.title} is not open yet: this page is its waitlist.` }];
89
+ if (points.length) faq.push({ q: `What will ${s.title} offer?`, a: sentence(points.map((p) => p.replace(/[.]$/, '')).join('; ')) });
90
+ faq.push({ q: `When does ${s.title} open, and how do I get in?`, a: `There is no public launch date yet. Enter your email on this page and confirm it; you get one email when ${s.title} opens, nothing else.` });
91
+ faq.push({ q: `Does joining the ${s.title} waitlist cost anything?`, a: `No. Joining is free and needs only an email address. Each confirmed address counts once, and the live count of who is waiting is shown on the page.` });
92
+ if (s.moshpit) {
93
+ faq.push({ q: `Where is ${s.title} on the web?`, a: `${s.name} is a Moshpit name: it opens at https://${s.name} in a Moshpit-aware browser or resolver, and at https://${s.host}/ on the regular web through the pit.world relay.` });
94
+ }
95
+ return faq.slice(0, 5);
96
+ }
97
+
98
+ /** The <head> tags for SEO and social cards. `s` is a normalized spec with seo fields. */
99
+ export function headTags(s, { noindex = false } = {}) {
100
+ const p = paletteFor(s.look);
101
+ const t = [
102
+ `<title>${esc(s.seoTitle)}</title>`,
103
+ `<meta name="description" content="${esc(s.description)}">`,
104
+ `<meta name="robots" content="${noindex ? 'noindex, follow' : 'index, follow, max-image-preview:large, max-snippet:-1'}">`,
105
+ `<link rel="canonical" href="${esc(s.url)}">`,
106
+ s.moshpit && s.nativeUrl !== s.url ? `<link rel="alternate" href="${esc(s.nativeUrl)}" title="${esc(s.name)} on the Moshpit">` : '',
107
+ `<meta name="theme-color" content="${esc(s.themeColor || p.bg)}">`,
108
+ `<meta name="color-scheme" content="${s.look === 'vaporwave' ? 'light' : 'dark'}">`,
109
+ `<link rel="icon" href="assets/icon.svg" type="image/svg+xml">`,
110
+ `<link rel="icon" href="assets/icon-192.png" type="image/png" sizes="192x192">`,
111
+ `<link rel="apple-touch-icon" href="assets/icon-180.png">`,
112
+ `<link rel="alternate" type="text/plain" href="${esc(s.url)}llms.txt" title="llms.txt">`,
113
+ `<meta property="og:type" content="website">`,
114
+ `<meta property="og:site_name" content="${esc(s.siteName)}">`,
115
+ `<meta property="og:locale" content="${esc(s.locale)}">`,
116
+ `<meta property="og:title" content="${esc(s.seoTitle)}">`,
117
+ `<meta property="og:description" content="${esc(s.description)}">`,
118
+ `<meta property="og:url" content="${esc(s.url)}">`,
119
+ `<meta property="og:image" content="${esc(s.image)}">`,
120
+ s.image.startsWith('https:') ? `<meta property="og:image:secure_url" content="${esc(s.image)}">` : '',
121
+ `<meta property="og:image:type" content="image/png">`,
122
+ `<meta property="og:image:width" content="${OG_WIDTH}">`,
123
+ `<meta property="og:image:height" content="${OG_HEIGHT}">`,
124
+ `<meta property="og:image:alt" content="${esc(s.imageAlt)}">`,
125
+ `<meta name="twitter:card" content="summary_large_image">`,
126
+ `<meta name="twitter:title" content="${esc(s.seoTitle)}">`,
127
+ `<meta name="twitter:description" content="${esc(s.description)}">`,
128
+ `<meta name="twitter:image" content="${esc(s.image)}">`,
129
+ `<meta name="twitter:image:alt" content="${esc(s.imageAlt)}">`,
130
+ s.twitter ? `<meta name="twitter:site" content="${esc(s.twitter)}">` : '',
131
+ s.keywords?.length ? `<meta name="keywords" content="${esc(s.keywords.join(', '))}">` : '',
132
+ ];
133
+ return t.filter(Boolean).join('\n');
134
+ }
135
+
136
+ /** JSON-LD @graph: WebSite, Organization, WebPage and FAQPage (plus any `schema` extras from the spec). */
137
+ export function jsonLd(s) {
138
+ const id = (frag) => `${s.url}#${frag}`;
139
+ const graph = [
140
+ { '@type': 'WebSite', '@id': id('website'), name: s.title, alternateName: s.moshpit ? [s.name, s.host] : undefined, url: s.url, description: s.description, inLanguage: s.lang, publisher: { '@id': id('org') } },
141
+ { '@type': 'Organization', '@id': id('org'), name: s.title, url: s.url, logo: { '@type': 'ImageObject', url: `${s.url}assets/icon-192.png`, width: 192, height: 192 }, sameAs: s.sameAs?.length ? s.sameAs : undefined, parentOrganization: s.publisher ? { '@type': 'Organization', name: s.publisher.name, url: s.publisher.url } : undefined },
142
+ { '@type': 'WebPage', '@id': id('page'), url: s.url, name: s.seoTitle, description: s.summary, inLanguage: s.lang, isPartOf: { '@id': id('website') }, about: { '@id': id('org') }, primaryImageOfPage: { '@type': 'ImageObject', url: s.image, width: OG_WIDTH, height: OG_HEIGHT }, potentialAction: { '@type': 'JoinAction', name: s.button, target: s.url } },
143
+ { '@type': 'FAQPage', '@id': id('faq'), mainEntity: s.faq.map((f) => ({ '@type': 'Question', name: f.q, acceptedAnswer: { '@type': 'Answer', text: f.a } })) },
144
+ ...(Array.isArray(s.schema) ? s.schema : s.schema ? [s.schema] : []),
145
+ ];
146
+ return JSON.stringify({ '@context': 'https://schema.org', '@graph': graph });
147
+ }
148
+
149
+ /** Inline-safe JSON-LD script tag (no `</script>` breakout). */
150
+ export function jsonLdTag(s) {
151
+ return `<script type="application/ld+json">${jsonLd(s).replace(/</g, '\\u003c')}</script>`;
152
+ }
153
+
154
+ /** The visible FAQ section: same questions as the FAQPage JSON-LD. */
155
+ export function faqHtml(s) {
156
+ if (!s.faq.length) return '';
157
+ return `<section class="card stack waitlist-faq" aria-labelledby="faq"><h2 id="faq">Questions</h2>
158
+ ${s.faq.map((f) => `<details><summary>${esc(f.q)}</summary><p>${esc(f.a)}</p></details>`).join('\n ')}
159
+ </section>`;
160
+ }
161
+
162
+ /** llms.txt (llmstxt.org): what it is, who it's for, status, how to join. */
163
+ export function llmsTxt(s) {
164
+ const lines = [
165
+ `# ${s.title}`,
166
+ '',
167
+ `> ${s.summary}`,
168
+ '',
169
+ `- Status: waitlist (not launched yet)`,
170
+ `- Site: ${s.url}`,
171
+ s.moshpit ? `- Moshpit name: https://${s.name}` : '',
172
+ s.audience ? `- Who it is for: ${s.audience}` : '',
173
+ `- How to join: enter an email at ${s.url} and confirm it, or POST {"email","dn":"${s.dn}"} to ${s.api}/api/waitlist`,
174
+ `- Waitlist count: ${s.api}/api/waitlist/stats?dn=${encodeURIComponent(s.dn)}`,
175
+ '',
176
+ ].filter((l, i, a) => l !== '' || a[i - 1] !== '');
177
+ if (s.points.length) lines.push('## What is coming', '', ...s.points.map((p) => `- ${p}`), '');
178
+ lines.push('## Questions', '');
179
+ for (const f of s.faq) lines.push(`### ${f.q}`, '', f.a, '');
180
+ lines.push('## Links', '', `- [Home](${s.url}): the waitlist page`, `- [Sitemap](${s.url}sitemap.xml)`);
181
+ if (s.moshpit) lines.push(`- [pit.world directory](https://pit.world/directory): other Moshpit names`);
182
+ return lines.join('\n') + '\n';
183
+ }
184
+
185
+ /** AI and answer-engine crawlers we welcome by name (plus everyone else via *). */
186
+ export const AI_CRAWLERS = [
187
+ 'GPTBot', 'OAI-SearchBot', 'ChatGPT-User', 'ClaudeBot', 'Claude-SearchBot', 'Claude-User', 'anthropic-ai',
188
+ 'PerplexityBot', 'Perplexity-User', 'Google-Extended', 'Applebot', 'Applebot-Extended', 'Bingbot', 'DuckDuckBot',
189
+ 'DuckAssistBot', 'CCBot', 'Meta-ExternalAgent', 'Amazonbot', 'cohere-ai', 'MistralAI-User', 'YouBot', 'PhindBot',
190
+ ];
191
+
192
+ export function robotsTxt(s) {
193
+ return `# ${s.title}: crawlers and AI answer engines welcome.\n${AI_CRAWLERS.map((b) => `User-agent: ${b}`).join('\n')}\nAllow: /\n\nUser-agent: *\nAllow: /\n\nSitemap: ${s.url}sitemap.xml\n`;
194
+ }
195
+
196
+ export function sitemapXml(s) {
197
+ return `<?xml version="1.0" encoding="UTF-8"?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">\n <url><loc>${esc(s.url)}</loc><lastmod>${s.updated}</lastmod><changefreq>weekly</changefreq><image:image><image:loc>${esc(s.image)}</image:loc></image:image></url>\n</urlset>\n`;
198
+ }
199
+
200
+ /** A stable IndexNow key for a name (hex, 32 chars); override with spec.indexnowKey. */
201
+ export function indexNowKey(name) {
202
+ return createHash('sha256').update(`waitlist-indexnow:${name}`).digest('hex').slice(0, 32);
203
+ }
204
+
205
+ /** Ping IndexNow (Bing, Yandex, Seznam, Naver share it) for each built site. Never throws. */
206
+ export async function pingIndexNow(sites, { fetchImpl = globalThis.fetch, endpoint = 'https://api.indexnow.org/indexnow' } = {}) {
207
+ const results = [];
208
+ for (const s of sites) {
209
+ const host = new URL(s.url).host;
210
+ try {
211
+ const res = await fetchImpl(endpoint, {
212
+ method: 'POST',
213
+ headers: { 'content-type': 'application/json; charset=utf-8' },
214
+ body: JSON.stringify({ host, key: s.indexnowKey, keyLocation: `${s.url}${s.indexnowKey}.txt`, urlList: [s.url, `${s.url}llms.txt`] }),
215
+ });
216
+ results.push({ host, status: res.status });
217
+ } catch (err) {
218
+ results.push({ host, status: 0, error: err.message });
219
+ }
220
+ }
221
+ return results;
222
+ }
223
+
224
+ // ---------- images ----------
225
+
226
+ function decoration(p, w, h, name) {
227
+ let h32 = 0;
228
+ for (const ch of name) h32 = (h32 * 31 + ch.charCodeAt(0)) >>> 0;
229
+ const rnd = () => ((h32 = (h32 * 1103515245 + 12345) >>> 0) / 2 ** 32);
230
+ switch (p.deco) {
231
+ case 'grid': {
232
+ let g = `<rect y="${h * 0.62}" width="${w}" height="${h * 0.38}" fill="#12002b"/>`;
233
+ for (let i = 0; i <= 8; i++) { const y = h * 0.62 + (h * 0.38) * (i / 8) ** 2; g += `<line x1="0" y1="${y.toFixed(1)}" x2="${w}" y2="${y.toFixed(1)}" stroke="#ff2975" stroke-opacity=".55" stroke-width="2"/>`; }
234
+ for (let i = -12; i <= 12; i++) g += `<line x1="${w / 2 + i * 40}" y1="${h * 0.62}" x2="${w / 2 + i * 220}" y2="${h}" stroke="#ff2975" stroke-opacity=".55" stroke-width="2"/>`;
235
+ return `<circle cx="${w * 0.8}" cy="${h * 0.62}" r="150" fill="url(#sun)"/>${g}`;
236
+ }
237
+ case 'stars': {
238
+ let g = '';
239
+ for (let i = 0; i < 90; i++) g += `<circle cx="${(rnd() * w).toFixed(0)}" cy="${(rnd() * h).toFixed(0)}" r="${(1 + rnd() * 2).toFixed(1)}" fill="${rnd() > 0.5 ? '#ffffff' : '#ffff66'}"/>`;
240
+ return g + `<rect x="10" y="10" width="${w - 20}" height="${h - 20}" fill="none" stroke="#c0c0c0" stroke-width="8"/>`;
241
+ }
242
+ case 'rain': {
243
+ let g = '';
244
+ for (let x = 20; x < w; x += 46) {
245
+ const len = 4 + Math.floor(rnd() * 10), y0 = Math.floor(rnd() * 12);
246
+ for (let j = 0; j < len; j++) g += `<text x="${x}" y="${(y0 + j) * 34}" font-family="${MONO}" font-size="26" fill="#00ff41" fill-opacity="${(0.08 + 0.25 * (j / len)).toFixed(2)}">${rnd() > 0.5 ? '1' : '0'}</text>`;
247
+ }
248
+ return g;
249
+ }
250
+ case 'scan': {
251
+ let g = '';
252
+ for (let y = 0; y < h; y += 6) g += `<rect y="${y}" width="${w}" height="2" fill="#000" fill-opacity=".35"/>`;
253
+ return g;
254
+ }
255
+ case 'prompt':
256
+ return `<rect x="40" y="36" width="${w - 80}" height="44" rx="8" fill="#1c1c1c"/><circle cx="70" cy="58" r="8" fill="#ff5f56"/><circle cx="96" cy="58" r="8" fill="#ffbd2e"/><circle cx="122" cy="58" r="8" fill="#27c93f"/>`;
257
+ case 'glow':
258
+ return `<rect x="24" y="24" width="${w - 48}" height="${h - 48}" rx="28" fill="none" stroke="#ff2bd6" stroke-width="4" filter="url(#glow)"/>`;
259
+ case 'shadow':
260
+ return `<rect x="56" y="56" width="${w - 112}" height="${h - 112}" fill="#2d1b46"/><rect x="40" y="40" width="${w - 112}" height="${h - 112}" fill="#ffffff" fill-opacity=".85" stroke="#2d1b46" stroke-width="4"/>`;
261
+ default:
262
+ return '';
263
+ }
264
+ }
265
+
266
+ /** The 1200x630 Open Graph card as SVG, in the site's look. */
267
+ export function ogSvg(s) {
268
+ const p = paletteFor(s.look);
269
+ const W = OG_WIDTH, H = OG_HEIGHT, X = 80;
270
+ const mono = p.font === MONO;
271
+ const titleText = s.look === 'terminal' ? `$ ${s.title}_` : s.look === 'vaporwave' ? s.title.toUpperCase() : s.title;
272
+ const charW = s.look === "vaporwave" ? 0.8 : mono ? 0.62 : 0.66;
273
+ const titleSize = Math.max(56, Math.min(124, Math.floor((W - 2 * X) / (titleText.length * charW))));
274
+ const tagSize = 42;
275
+ const tagLines = wrap(s.tagline, Math.floor((W - 2 * X) / (tagSize * (mono ? 0.61 : 0.53))), 3);
276
+ const titleY = 268;
277
+ const tagY0 = titleY + 40 + tagSize;
278
+ const shadow = s.look === 'geocities' ? `<text x="${X + 5}" y="${titleY + 5}" font-family="${p.font}" font-size="${titleSize}" font-weight="700" fill="#ff0000">${esc(titleText)}</text>`
279
+ : s.look === 'vaporwave' ? `<text x="${X + 5}" y="${titleY + 5}" font-family="${p.font}" font-size="${titleSize}" font-weight="700" fill="#01cdfe">${esc(titleText)}</text>` : '';
280
+ const glow = ['neon', 'matrix', 'amber', 'synthwave'].includes(s.look) ? ' filter="url(#glow)"' : '';
281
+ const kicker = esc(s.kicker.toUpperCase());
282
+ const kickerW = Math.min(W - 2 * X, kicker.length * 17 + 48);
283
+ const cta = esc(s.button);
284
+ const ctaW = cta.length * 17 + 56;
285
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="${W}" height="${H}" viewBox="0 0 ${W} ${H}">
286
+ <defs>
287
+ <linearGradient id="bg" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="${p.bg}"/><stop offset="1" stop-color="${p.bg2}"/></linearGradient>
288
+ <radialGradient id="sun"><stop offset="0" stop-color="#ffd319"/><stop offset="1" stop-color="#ff2975"/></radialGradient>
289
+ <filter id="glow" x="-20%" y="-20%" width="140%" height="140%"><feGaussianBlur stdDeviation="6" result="b"/><feMerge><feMergeNode in="b"/><feMergeNode in="SourceGraphic"/></feMerge></filter>
290
+ </defs>
291
+ <rect width="${W}" height="${H}" fill="url(#bg)"/>
292
+ ${decoration(p, W, H, s.name)}
293
+ <rect x="${X}" y="84" width="${kickerW}" height="44" rx="${s.look === 'geocities' || s.look === 'vaporwave' ? 0 : 22}" fill="${p.accent}" fill-opacity=".16" stroke="${p.accent}" stroke-width="2"/>
294
+ <text x="${X + 22}" y="114" font-family="${MONO}" font-size="22" letter-spacing="2" fill="${p.accent}">${kicker}</text>
295
+ ${shadow}<text x="${X}" y="${titleY}" font-family="${p.font}" font-size="${titleSize}" font-weight="700" fill="${p.title}"${glow}>${esc(titleText)}</text>
296
+ ${tagLines.map((l, i) => `<text x="${X}" y="${tagY0 + i * (tagSize + 14)}" font-family="${p.font}" font-size="${tagSize}" fill="${p.ink}">${esc(l)}</text>`).join('\n')}
297
+ <rect x="${X}" y="${H - 122}" width="${ctaW}" height="62" rx="${s.look === 'geocities' || s.look === 'vaporwave' ? 0 : 12}" fill="${p.accent}"/>
298
+ <text x="${X + 28}" y="${H - 81}" font-family="${SANS}" font-size="28" font-weight="700" fill="${p.onAccent}">${cta}</text>
299
+ <text x="${W - X}" y="${H - 80}" text-anchor="end" font-family="${MONO}" font-size="26" fill="${p.muted}">${esc(s.moshpit ? s.name : new URL(s.url).host)}</text>
300
+ </svg>
301
+ `;
302
+ }
303
+
304
+ /** Square icon SVG in the look's colors. */
305
+ export function iconSvg(s) {
306
+ const p = paletteFor(s.look);
307
+ const ch = esc((s.name.match(/[a-z0-9]/i) || ['?'])[0].toUpperCase());
308
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64"><rect width="64" height="64" rx="14" fill="${p.bg}"/><rect x="2" y="2" width="60" height="60" rx="12" fill="none" stroke="${p.accent}" stroke-width="3"/><text x="32" y="45" text-anchor="middle" font-family="${MONO}" font-size="36" font-weight="700" fill="${p.title}">${ch}</text></svg>\n`;
309
+ }
310
+
311
+ let resvg;
312
+ /** SVG -> PNG with @resvg/resvg-js (prebuilt native, no system deps). `width` scales the output. */
313
+ export async function svgToPng(svg, { width, fontFiles = [] } = {}) {
314
+ resvg ??= (await import('@resvg/resvg-js')).Resvg;
315
+ const r = new resvg(svg, {
316
+ fitTo: width ? { mode: 'width', value: width } : { mode: 'original' },
317
+ font: { loadSystemFonts: true, fontFiles, defaultFontFamily: 'DejaVu Sans' },
318
+ background: 'rgba(0,0,0,0)',
319
+ });
320
+ return Buffer.from(r.render().asPng());
321
+ }
322
+
323
+ /** Width and height from a PNG's IHDR chunk. */
324
+ export function pngSize(buf) {
325
+ if (buf.length < 24 || buf.readUInt32BE(0) !== 0x89504e47 || buf.toString('latin1', 12, 16) !== 'IHDR') return null;
326
+ return { width: buf.readUInt32BE(16), height: buf.readUInt32BE(20) };
327
+ }
package/src/waitlist.css CHANGED
@@ -10,6 +10,11 @@
10
10
  .waitlist-points li { margin-block: 0.35rem; }
11
11
  .waitlist-stats [data-empty] { color: var(--pf-color-muted, inherit); margin: 0; }
12
12
  .waitlist-meta { font-size: 0.9rem; color: var(--pf-color-muted, inherit); }
13
+ .waitlist-answer { max-width: 40rem; margin: 0; }
14
+ .waitlist-faq { margin-block: 1.5rem; }
15
+ .waitlist-faq details { border-block-start: 1px solid var(--pf-color-border, currentColor); padding-block: 0.6rem; }
16
+ .waitlist-faq summary { cursor: pointer; font-weight: 600; }
17
+ .waitlist-faq details p { margin-block: 0.5rem 0; }
13
18
 
14
19
  /* Looks (neon, matrix, terminal, amber, synthwave, geocities, vaporwave) come from
15
20
  @profullstack/css/looks: <html data-look="...">. Only page tweaks live here. */