og-route-kit 0.0.0-stage → 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/CHANGELOG.md +74 -0
- package/LICENSE +21 -0
- package/README.md +282 -2
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +1106 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/core/index.d.ts +21 -0
- package/dist/core/index.js +133 -0
- package/dist/core/index.js.map +1 -0
- package/dist/examples/cards/index.d.ts +24 -0
- package/dist/examples/cards/index.js +129 -0
- package/dist/examples/cards/index.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +133 -0
- package/dist/index.js.map +1 -0
- package/dist/next/index.d.ts +44 -0
- package/dist/next/index.js +270 -0
- package/dist/next/index.js.map +1 -0
- package/dist/sizes-Bn3i71Bz.d.ts +34 -0
- package/package.json +92 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/cli/index.ts","../../src/cli/fetch-png.ts","../../src/cli/args.ts","../../src/cli/audit.ts","../../src/audit/types.ts","../../src/audit/fetch.ts","../../src/audit/parse-meta.ts","../../src/audit/sitemap.ts","../../src/audit/check-image.ts","../../src/audit/checks.ts","../../src/audit/report.ts","../../src/audit/run.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { mkdir, writeFile } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\n\nimport { DEFAULT_MAX_BYTES, DEFAULT_TIMEOUT_MS, fetchPng } from \"./fetch-png.js\";\nimport { buildPreviewUrls, optionalPositiveInteger, parseFlags, requireString } from \"./args.js\";\nimport type { Flags } from \"./args.js\";\nimport { runAuditCommand } from \"./audit.js\";\n\ntype Command = \"export\" | \"check\" | \"preview\" | \"audit\" | \"help\";\n\nasync function main(): Promise<void> {\n const args = process.argv.slice(2);\n const command = (args[0] ?? \"help\") as Command;\n const flags = parseFlags(args.slice(1));\n\n try {\n if (command === \"export\") {\n await exportImage(flags);\n } else if (command === \"check\") {\n await checkImage(flags);\n } else if (command === \"preview\") {\n preview(flags);\n } else if (command === \"audit\") {\n process.exitCode = await runAuditCommand(flags);\n } else {\n help();\n }\n } catch (error) {\n console.error(error instanceof Error ? error.message : String(error));\n process.exitCode = 1;\n }\n}\n\nasync function exportImage(flags: Flags): Promise<void> {\n const url = requireString(flags, \"url\");\n const out = requireString(flags, \"out\");\n const maxBytes = optionalPositiveInteger(flags, \"max-bytes\", DEFAULT_MAX_BYTES);\n const timeoutMs = optionalPositiveInteger(flags, \"timeout\", DEFAULT_TIMEOUT_MS);\n\n let bytes: Uint8Array;\n\n try {\n bytes = await fetchPng(url, { maxBytes, timeoutMs });\n } catch (error) {\n throw new Error(`Export failed: ${error instanceof Error ? error.message : String(error)}`);\n }\n\n await mkdir(dirname(out), { recursive: true });\n await writeFile(out, bytes);\n console.log(`Wrote ${bytes.byteLength} bytes to ${out}`);\n}\n\nasync function checkImage(flags: Flags): Promise<void> {\n const url = requireString(flags, \"url\");\n const maxBytes = optionalPositiveInteger(flags, \"max-bytes\", DEFAULT_MAX_BYTES);\n const timeoutMs = optionalPositiveInteger(flags, \"timeout\", DEFAULT_TIMEOUT_MS);\n\n let bytes: Uint8Array;\n\n try {\n bytes = await fetchPng(url, { maxBytes, timeoutMs });\n } catch (error) {\n throw new Error(`Check failed: ${error instanceof Error ? error.message : String(error)}`);\n }\n\n console.log(`OK 200 image/png ${bytes.byteLength} bytes`);\n}\n\nfunction preview(flags: Flags): void {\n for (const line of buildPreviewUrls(flags)) {\n console.log(line);\n }\n}\n\nfunction help(): void {\n console.log(`og-route-kit\n\nCommands:\n export --url <url> --out <path> [--max-bytes <n>] [--timeout <ms>]\n Fetch a PNG route and write it to disk\n check --url <url> [--max-bytes <n>] [--timeout <ms>]\n Verify a PNG route is healthy\n preview [--origin <url>] [--route <path>]\n Print local preview URLs\n audit (--sitemap <url|path> | --urls <file|-> | --url <page-url>)\n [--concurrency <n>] [--timeout <ms>] [--max-bytes <n>] [--limit <n>]\n [--only <check,check>] [--json [path|-]] [--fail-on <error|warn|never>] [--quiet]\n Audit og:image tags and the images they point at.\n Exit 0 clean, 1 findings, 2 usage or network failure\n`);\n}\n\nawait main();\n","export const DEFAULT_MAX_BYTES = 8_000_000;\nexport const DEFAULT_TIMEOUT_MS = 30_000;\n\nconst PNG_SIGNATURE = [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a] as const;\n\nexport interface FetchPngOptions {\n maxBytes?: number;\n timeoutMs?: number;\n}\n\nexport function assertPngResponseHeaders(response: Response, maxBytes: number): void {\n if (!response.ok) {\n throw new Error(`Request failed: ${response.status} ${response.statusText}`);\n }\n\n const contentType = response.headers.get(\"content-type\") ?? \"\";\n\n if (!contentType.toLowerCase().includes(\"image/png\")) {\n throw new Error(`Expected image/png, received ${contentType || \"unknown content type\"}`);\n }\n\n const contentLength = Number(response.headers.get(\"content-length\"));\n\n if (Number.isFinite(contentLength) && contentLength > maxBytes) {\n throw new Error(`Image is ${contentLength} bytes, above max ${maxBytes}`);\n }\n}\n\nexport function assertPngSignature(bytes: Uint8Array): void {\n const matches =\n bytes.byteLength >= PNG_SIGNATURE.length &&\n PNG_SIGNATURE.every((byte, index) => bytes[index] === byte);\n\n if (!matches) {\n throw new Error(\"Response body is not a PNG (missing PNG signature)\");\n }\n}\n\nexport async function fetchPng(url: string, options: FetchPngOptions): Promise<Uint8Array> {\n const maxBytes = resolvePositiveInteger(options.maxBytes, DEFAULT_MAX_BYTES, \"maxBytes\");\n const timeoutMs = resolvePositiveInteger(options.timeoutMs, DEFAULT_TIMEOUT_MS, \"timeoutMs\");\n\n const response = await fetch(url, { signal: AbortSignal.timeout(timeoutMs) });\n\n assertPngResponseHeaders(response, maxBytes);\n\n const bytes = await readResponseBody(response, maxBytes);\n\n assertPngSignature(bytes);\n\n return bytes;\n}\n\nfunction resolvePositiveInteger(value: number | undefined, fallback: number, name: string): number {\n const resolved = value ?? fallback;\n\n if (!Number.isSafeInteger(resolved) || resolved <= 0) {\n throw new Error(`${name} must be a positive integer`);\n }\n\n return resolved;\n}\n\nasync function readResponseBody(response: Response, maxBytes: number): Promise<Uint8Array> {\n if (!response.body) {\n throw new Error(\"Response body is empty\");\n }\n\n const reader = response.body.getReader();\n const chunks: Uint8Array[] = [];\n let totalBytes = 0;\n\n try {\n while (true) {\n const { done, value } = await reader.read();\n\n if (done) {\n break;\n }\n\n totalBytes += value.byteLength;\n\n if (totalBytes > maxBytes) {\n await reader.cancel();\n throw new Error(`Image is above max ${maxBytes} bytes`);\n }\n\n chunks.push(value);\n }\n } finally {\n reader.releaseLock();\n }\n\n const bytes = new Uint8Array(totalBytes);\n let offset = 0;\n\n for (const chunk of chunks) {\n bytes.set(chunk, offset);\n offset += chunk.byteLength;\n }\n\n return bytes;\n}\n","export type Flags = Record<string, string | boolean>;\n\nconst PREVIEW_EXAMPLES: ReadonlyArray<readonly [string, string]> = [\n [\"Product\", \"eyebrow=Product&title=Ship+better+social+cards.&description=Code-rendered+Open+Graph+images.\"],\n [\"Article\", \"eyebrow=Journal&title=Why+coded+OG+routes+beat+exported+PNGs&description=Typed+routes+stay+fresh.\"],\n [\"Changelog\", \"eyebrow=v0.1.0&title=Initial+route+kit+release&description=Params%2C+metadata%2C+export.\"],\n];\n\nexport function parseFlags(values: string[]): Flags {\n const flags: Flags = {};\n\n for (let index = 0; index < values.length; index += 1) {\n const token = values[index];\n\n if (!token?.startsWith(\"--\")) {\n continue;\n }\n\n const key = token.slice(2);\n const next = values[index + 1];\n\n if (next && !next.startsWith(\"--\")) {\n flags[key] = next;\n index += 1;\n } else {\n flags[key] = true;\n }\n }\n\n return flags;\n}\n\nexport function requireString(flags: Flags, key: string): string {\n const value = flags[key];\n\n if (typeof value !== \"string\" || value.length === 0) {\n throw new Error(`Missing required flag --${key}`);\n }\n\n return value;\n}\n\nexport function optionalPositiveInteger(flags: Flags, key: string, fallback: number): number {\n const value = flags[key];\n\n if (value === undefined) {\n return fallback;\n }\n\n if (typeof value !== \"string\") {\n throw new Error(`Flag --${key} requires a positive integer`);\n }\n\n const parsed = Number(value);\n\n if (!Number.isSafeInteger(parsed) || parsed <= 0) {\n throw new Error(`Flag --${key} requires a positive integer`);\n }\n\n return parsed;\n}\n\nexport function buildPreviewUrls(flags: Flags): string[] {\n const origin = String(flags.origin ?? \"http://localhost:3000\").replace(/\\/+$/, \"\");\n const route = String(flags.route ?? \"/api/og\");\n const base = `${origin}${route.startsWith(\"/\") ? route : `/${route}`}`;\n return PREVIEW_EXAMPLES.map(([label, query]) => `${label}: ${base}?${query}`);\n}\n","import { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\n\nimport { CHECK_IDS } from \"../audit/types.js\";\nimport type { CheckId, FailOn } from \"../audit/types.js\";\nimport { readSitemapSource } from \"../audit/fetch.js\";\nimport { exitCodeFor, formatReport } from \"../audit/report.js\";\nimport { runAudit } from \"../audit/run.js\";\nimport { collectSitemapUrls, sampleEvenly } from \"../audit/sitemap.js\";\nimport { DEFAULT_MAX_BYTES, DEFAULT_TIMEOUT_MS } from \"./fetch-png.js\";\nimport { optionalPositiveInteger } from \"./args.js\";\nimport type { Flags } from \"./args.js\";\n\nexport const DEFAULT_CONCURRENCY = 4;\nexport const MAX_CONCURRENCY = 8;\n\nconst FAIL_ON_VALUES: readonly FailOn[] = [\"error\", \"warn\", \"never\"];\n\nexport interface AuditIo {\n stdout: (text: string) => void;\n stderr: (text: string) => void;\n readStdin: () => Promise<string>;\n /** Colour is allowed. Never true when `--json` is set. */\n color: boolean;\n}\n\nexport interface AuditFlags {\n source: { kind: \"sitemap\" | \"urls\" | \"url\"; value: string };\n concurrency: number;\n timeoutMs: number;\n maxBytes: number;\n limit: number | undefined;\n only: Set<CheckId> | null;\n /** Undefined without `--json`, \"-\" for stdout, otherwise a file path. */\n json: string | undefined;\n failOn: FailOn;\n quiet: boolean;\n notes: string[];\n}\n\n/** Validates audit flags. Anything wrong throws, and `runAuditCommand` turns that into exit code 2. */\nexport function parseAuditFlags(flags: Flags): AuditFlags {\n const sources = ([\"sitemap\", \"urls\", \"url\"] as const).filter((key) => flags[key] !== undefined);\n const kind = sources[0];\n\n if (sources.length !== 1 || !kind) {\n throw new Error(\"Pass exactly one of --sitemap <url|path>, --urls <file|-> or --url <page-url>\");\n }\n\n const value = flags[kind];\n\n if (typeof value !== \"string\" || value.length === 0) {\n throw new Error(`Flag --${kind} requires a value`);\n }\n\n const notes: string[] = [];\n const requested = optionalPositiveInteger(flags, \"concurrency\", DEFAULT_CONCURRENCY);\n\n if (requested > MAX_CONCURRENCY) {\n notes.push(`--concurrency ${requested} is above the cap; using ${MAX_CONCURRENCY}`);\n }\n\n const failOn = flags[\"fail-on\"] ?? \"error\";\n\n if (!FAIL_ON_VALUES.includes(failOn as FailOn)) {\n throw new Error(`Flag --fail-on must be one of ${FAIL_ON_VALUES.join(\", \")}`);\n }\n\n const json = flags.json;\n\n return {\n source: { kind, value },\n concurrency: Math.min(requested, MAX_CONCURRENCY),\n timeoutMs: optionalPositiveInteger(flags, \"timeout\", DEFAULT_TIMEOUT_MS),\n maxBytes: optionalPositiveInteger(flags, \"max-bytes\", DEFAULT_MAX_BYTES),\n limit: flags.limit === undefined ? undefined : optionalPositiveInteger(flags, \"limit\", 1),\n only: parseOnly(flags.only),\n json: json === undefined ? undefined : typeof json === \"string\" ? json : \"-\",\n failOn: failOn as FailOn,\n quiet: flags.quiet !== undefined,\n notes,\n };\n}\n\nfunction parseOnly(value: string | boolean | undefined): Set<CheckId> | null {\n if (value === undefined) {\n return null;\n }\n\n const ids = typeof value === \"string\" ? value.split(\",\").map((id) => id.trim()).filter(Boolean) : [];\n const unknown = ids.filter((id) => !(CHECK_IDS as readonly string[]).includes(id));\n\n if (ids.length === 0 || unknown.length > 0) {\n throw new Error(`Flag --only takes comma-separated check ids${unknown.length ? `; unknown: ${unknown.join(\", \")}` : \"\"}. Known ids: ${CHECK_IDS.join(\", \")}`);\n }\n\n return new Set(ids as CheckId[]);\n}\n\n/** Parses a `--urls` file: one page URL per line, blank lines and `#` comments ignored. */\nexport function parseUrlList(text: string): string[] {\n const urls: string[] = [];\n\n for (const [index, raw] of text.split(/\\r?\\n/).entries()) {\n const line = raw.trim();\n\n if (!line || line.startsWith(\"#\")) {\n continue;\n }\n\n if (!/^https?:\\/\\//i.test(line) || !URL.canParse(line)) {\n throw new Error(`Line ${index + 1} of the URL list is not an http(s) URL: ${line}`);\n }\n\n urls.push(line);\n }\n\n return urls;\n}\n\nexport async function runAuditCommand(flags: Flags, io: AuditIo = defaultIo(flags)): Promise<number> {\n try {\n const options = parseAuditFlags(flags);\n const network = { timeoutMs: options.timeoutMs, maxBytes: options.maxBytes };\n const notes = [...options.notes];\n const pages = await resolvePages(options, io, notes, network);\n\n for (const note of notes.slice(0, 5)) {\n io.stderr(`note: ${note}\\n`);\n }\n\n if (notes.length > 5) {\n io.stderr(`note: …and ${notes.length - 5} more\\n`);\n }\n\n if (!options.quiet) {\n io.stderr(`Auditing ${pages.length} page${pages.length === 1 ? \"\" : \"s\"} (concurrency ${options.concurrency})\\n`);\n }\n\n const report = await runAudit({\n ...network,\n pages,\n source: options.source,\n failOn: options.failOn,\n concurrency: options.concurrency,\n only: options.only,\n });\n const table = formatReport(report, { color: io.color && options.json === undefined, quiet: options.quiet });\n\n if (options.json === undefined) {\n io.stdout(table);\n } else {\n io.stderr(table);\n const json = `${JSON.stringify(report, null, 2)}\\n`;\n\n if (options.json === \"-\") {\n io.stdout(json);\n } else {\n await mkdir(dirname(options.json), { recursive: true });\n await writeFile(options.json, json);\n io.stderr(`Wrote ${options.json}\\n`);\n }\n }\n\n return exitCodeFor(report);\n } catch (error) {\n io.stderr(`Audit failed: ${error instanceof Error ? error.message : String(error)}\\n`);\n\n return 2;\n }\n}\n\nasync function resolvePages(\n options: AuditFlags,\n io: AuditIo,\n notes: string[],\n network: { timeoutMs: number; maxBytes: number },\n): Promise<string[]> {\n const { kind, value } = options.source;\n let pages: string[];\n\n if (kind === \"url\") {\n pages = parseUrlList(value);\n } else if (kind === \"urls\") {\n pages = parseUrlList(value === \"-\" ? await io.readStdin() : await readFile(value, \"utf8\"));\n } else {\n pages = await collectSitemapUrls(value, {\n readSource: (source) => readSitemapSource(source, network),\n onNote: (note) => notes.push(note),\n });\n }\n\n pages = [...new Set(pages)];\n\n if (options.limit !== undefined && pages.length > options.limit) {\n notes.push(`Sampling ${options.limit} of ${pages.length} pages, evenly spread across the list`);\n pages = sampleEvenly(pages, options.limit);\n }\n\n if (pages.length === 0) {\n throw new Error(\"No page URLs to audit\");\n }\n\n return pages;\n}\n\nfunction defaultIo(flags: Flags): AuditIo {\n return {\n stdout: (text) => void process.stdout.write(text),\n stderr: (text) => void process.stderr.write(text),\n readStdin: async () => {\n const chunks: Buffer[] = [];\n\n for await (const chunk of process.stdin) {\n chunks.push(Buffer.from(chunk));\n }\n\n return Buffer.concat(chunks).toString(\"utf8\");\n },\n color: Boolean(process.stdout.isTTY) && flags.json === undefined && !process.env.NO_COLOR,\n };\n}\n","export type Level = \"error\" | \"warn\";\n\nexport const CHECK_IDS = [\n \"page-unreachable\",\n \"image-missing\",\n \"image-relative\",\n \"image-unreachable\",\n \"image-format\",\n \"image-too-large\",\n \"image-heavy\",\n \"image-size\",\n \"image-no-alt\",\n \"title-missing\",\n \"title-long\",\n \"description-missing\",\n \"description-long\",\n \"url-mismatch\",\n \"twitter-card-missing\",\n \"twitter-image-missing\",\n \"image-duplicate\",\n] as const;\n\nexport type CheckId = (typeof CHECK_IDS)[number];\n\nexport interface Finding {\n id: CheckId;\n level: Level;\n message: string;\n /** For `image-duplicate`: the other pages that share the image. */\n pages?: string[];\n}\n\n/** What fetching an og:image URL produced. Pure data, so checks need no network. */\nexport interface ImageProbe {\n url: string;\n /** HTTP status, or null when the request itself failed. */\n status: number | null;\n error?: string;\n contentType: string | null;\n /** Declared or measured body size. A lower bound when `truncated` is true. */\n bytes: number;\n /** True when reading stopped early because the body was over the byte cap. */\n truncated: boolean;\n /** First bytes of the body, enough for a PNG signature and IHDR chunk. */\n head: Uint8Array;\n}\n\n/** What fetching a page produced, before and after the HTML is parsed. */\nexport interface PageProbe {\n url: string;\n /** Final URL after redirects. */\n finalUrl: string;\n status: number | null;\n error?: string;\n /** Parsed meta tags, or null when the page could not be fetched. */\n meta: MetaTags | null;\n /** Absolute URL of the og:image after resolving against the page, if any. */\n imageUrl: string | null;\n image: ImageProbe | null;\n}\n\nexport interface MetaTags {\n /** First non-empty content for a key such as `og:image`, lowercased. */\n get(key: string): string | undefined;\n /** Every content value for a key, in document order. */\n getAll(key: string): string[];\n}\n\nexport interface PageResult {\n url: string;\n status: number | null;\n image: ImageSummary | null;\n findings: Finding[];\n}\n\nexport interface ImageSummary {\n url: string;\n status: number | null;\n contentType: string | null;\n bytes: number;\n width: number | null;\n height: number | null;\n}\n\nexport interface FixFirstEntry {\n id: CheckId;\n level: Level;\n pages: number;\n fix: string;\n}\n\nexport interface AuditReport {\n tool: \"og-route-kit\";\n schemaVersion: 1;\n generatedAt: string;\n source: { kind: \"sitemap\" | \"urls\" | \"url\"; value: string };\n failOn: FailOn;\n summary: { pages: number; pagesWithFindings: number; errors: number; warnings: number };\n fixFirst: FixFirstEntry[];\n pages: PageResult[];\n}\n\nexport type FailOn = \"error\" | \"warn\" | \"never\";\n","import { readFile } from \"node:fs/promises\";\nimport { gunzipSync } from \"node:zlib\";\n\nimport { isHttpUrl } from \"./sitemap.js\";\nimport type { ImageProbe } from \"./types.js\";\n\nexport const USER_AGENT = \"og-route-kit-audit (+https://github.com/pixelbrew-studio/og-route-kit)\";\nexport const DEFAULT_RETRY_DELAY_MS = 400;\n\n// Enough for a JPEG to get past EXIF and ICC profile segments to its SOF marker.\nconst HEAD_BYTES = 256 * 1024;\nconst PAGE_MAX_BYTES = 2_000_000;\nconst SITEMAP_MAX_BYTES = 50_000_000;\n\nexport interface NetworkOptions {\n timeoutMs: number;\n maxBytes: number;\n retryDelayMs?: number;\n}\n\nexport interface PageFetch {\n status: number | null;\n finalUrl: string;\n error?: string;\n html: string;\n}\n\ninterface Attempt<T> {\n value: T;\n retry: boolean;\n}\n\n/** One retry after a short pause. The attempt decides whether its outcome is worth retrying. */\nasync function withRetry<T>(attempt: () => Promise<Attempt<T>>, delayMs = DEFAULT_RETRY_DELAY_MS): Promise<T> {\n const first = await attempt();\n\n if (!first.retry) {\n return first.value;\n }\n\n await new Promise((resolve) => setTimeout(resolve, delayMs));\n\n return (await attempt()).value;\n}\n\nexport async function probePage(url: string, options: NetworkOptions): Promise<PageFetch> {\n return withRetry<PageFetch>(async () => {\n try {\n const response = await fetch(url, {\n headers: { \"user-agent\": USER_AGENT, accept: \"text/html,application/xhtml+xml;q=0.9,*/*;q=0.5\" },\n signal: AbortSignal.timeout(options.timeoutMs),\n });\n\n if (!response.ok) {\n await response.body?.cancel();\n\n return { value: { status: response.status, finalUrl: response.url || url, html: \"\" }, retry: response.status >= 500 };\n }\n\n // Read the whole document, not just <head>: Next.js streams metadata into <body> for unrecognised user agents.\n const body = await readBody(response, PAGE_MAX_BYTES);\n\n return { value: { status: response.status, finalUrl: response.url || url, html: new TextDecoder().decode(body.bytes) }, retry: false };\n } catch (error) {\n return { value: { status: null, finalUrl: url, error: describeError(error, options.timeoutMs), html: \"\" }, retry: !isTimeout(error) };\n }\n }, options.retryDelayMs);\n}\n\nexport async function probeImage(url: string, options: NetworkOptions): Promise<ImageProbe> {\n const failed = (error: string): ImageProbe => ({ url, status: null, error, contentType: null, bytes: 0, truncated: false, head: new Uint8Array() });\n\n if (!isHttpUrl(url)) {\n return failed(\"only http(s) image URLs can be fetched\");\n }\n\n return withRetry<ImageProbe>(async () => {\n try {\n const response = await fetch(url, {\n headers: { \"user-agent\": USER_AGENT, accept: \"image/png,image/*;q=0.8,*/*;q=0.5\" },\n signal: AbortSignal.timeout(options.timeoutMs),\n });\n const contentType = response.headers.get(\"content-type\");\n\n if (!response.ok) {\n await response.body?.cancel();\n\n return { value: { ...failed(\"\"), status: response.status, contentType }, retry: response.status >= 500 };\n }\n\n const declared = Number(response.headers.get(\"content-length\"));\n const body = await readBody(response, options.maxBytes, HEAD_BYTES);\n const bytes = body.truncated && Number.isFinite(declared) ? Math.max(body.size, declared) : body.size;\n\n return {\n value: { url, status: response.status, contentType, bytes, truncated: body.truncated, head: body.bytes },\n retry: false,\n };\n } catch (error) {\n return { value: failed(describeError(error, options.timeoutMs)), retry: !isTimeout(error) };\n }\n }, options.retryDelayMs);\n}\n\n/** Reads a sitemap from a URL or a local path, unzipping `.gz` files. Throws on any failure. */\nexport async function readSitemapSource(source: string, options: NetworkOptions): Promise<string> {\n const bytes = isHttpUrl(source) ? await fetchSitemapBytes(source, options) : await readFile(source);\n\n return new TextDecoder().decode(isGzip(bytes) ? gunzipSync(bytes, { maxOutputLength: SITEMAP_MAX_BYTES }) : bytes);\n}\n\nasync function fetchSitemapBytes(url: string, options: NetworkOptions): Promise<Uint8Array> {\n const result = await withRetry<{ bytes?: Uint8Array; error?: string }>(async () => {\n try {\n const response = await fetch(url, {\n headers: { \"user-agent\": USER_AGENT, accept: \"application/xml,text/xml;q=0.9,*/*;q=0.5\" },\n signal: AbortSignal.timeout(options.timeoutMs),\n });\n\n if (!response.ok) {\n await response.body?.cancel();\n\n return { value: { error: `HTTP ${response.status}` }, retry: response.status >= 500 };\n }\n\n return { value: { bytes: (await readBody(response, SITEMAP_MAX_BYTES)).bytes }, retry: false };\n } catch (error) {\n return { value: { error: describeError(error, options.timeoutMs) }, retry: !isTimeout(error) };\n }\n }, options.retryDelayMs);\n\n if (!result.bytes) {\n throw new Error(`Could not read sitemap ${url}: ${result.error}`);\n }\n\n return result.bytes;\n}\n\n/** Runs `task` over `items` with at most `concurrency` in flight, keeping result order. */\nexport async function mapPool<T, R>(items: readonly T[], concurrency: number, task: (item: T, index: number) => Promise<R>): Promise<R[]> {\n const results = new Array<R>(items.length);\n let next = 0;\n\n async function worker(): Promise<void> {\n while (next < items.length) {\n const index = next;\n next += 1;\n results[index] = await task(items[index] as T, index);\n }\n }\n\n await Promise.all(Array.from({ length: Math.min(concurrency, items.length) }, worker));\n\n return results;\n}\n\ninterface Body {\n /** The first `keepBytes` bytes. */\n bytes: Uint8Array;\n /** Bytes read, which stops just past `maxBytes`. */\n size: number;\n truncated: boolean;\n}\n\n/** Reads up to `maxBytes` of the body, counting all of it but keeping only the first `keepBytes`. */\nasync function readBody(response: Response, maxBytes: number, keepBytes = maxBytes): Promise<Body> {\n if (!response.body) {\n return { bytes: new Uint8Array(), size: 0, truncated: false };\n }\n\n const reader = response.body.getReader();\n const chunks: Uint8Array[] = [];\n let size = 0;\n let kept = 0;\n let truncated = false;\n\n try {\n while (true) {\n const { done, value } = await reader.read();\n\n if (done) {\n break;\n }\n\n if (kept < keepBytes) {\n chunks.push(value);\n kept += value.byteLength;\n }\n\n size += value.byteLength;\n\n if (size > maxBytes) {\n truncated = true;\n await reader.cancel();\n break;\n }\n }\n } finally {\n reader.releaseLock();\n }\n\n const bytes = new Uint8Array(Math.min(size, keepBytes));\n let offset = 0;\n\n for (const chunk of chunks) {\n const room = bytes.byteLength - offset;\n\n if (room <= 0) {\n break;\n }\n\n bytes.set(chunk.subarray(0, room), offset);\n offset += Math.min(chunk.byteLength, room);\n }\n\n return { bytes, size, truncated };\n}\n\nfunction isGzip(bytes: Uint8Array): boolean {\n return bytes[0] === 0x1f && bytes[1] === 0x8b;\n}\n\nfunction isTimeout(error: unknown): boolean {\n return error instanceof Error && (error.name === \"TimeoutError\" || error.name === \"AbortError\");\n}\n\nfunction describeError(error: unknown, timeoutMs: number): string {\n if (isTimeout(error)) {\n return `timed out after ${timeoutMs} ms`;\n }\n\n if (!(error instanceof Error)) {\n return String(error);\n }\n\n const cause = error.cause instanceof Error ? (error.cause as Error & { code?: string }) : null;\n\n return cause ? `${error.message} (${cause.code ?? cause.message})` : error.message;\n}\n","import type { MetaTags } from \"./types.js\";\n\n// Not a general HTML parser. This is a focused scan for `<meta property|name=\"…\" content=\"…\">`\n// tags: it handles single, double and unquoted attribute values, any attribute order,\n// self-closing tags, several tags on one line, and `>` inside a quoted value. Comments,\n// <script> and <style> bodies are blanked first so markup inside them is never read as a tag.\n// Everything else in the document is ignored on purpose.\n\nconst META_TAG = /<meta\\b((?:[^>\"']|\"[^\"]*\"|'[^']*')*)>/gi;\nconst ATTRIBUTE = /([^\\s\"'<>/=]+)(?:\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)'|([^\\s\"'=<>`]+)))?/g;\nconst NAMED_ENTITIES: Record<string, string> = { amp: \"&\", lt: \"<\", gt: \">\", quot: '\"', apos: \"'\", nbsp: \" \" };\n\nexport function parseMeta(html: string): MetaTags {\n const values = new Map<string, string[]>();\n const source = html\n .replace(/<!--[\\s\\S]*?-->/g, \"\")\n .replace(/<script\\b[\\s\\S]*?<\\/script\\s*>/gi, \"\")\n .replace(/<style\\b[\\s\\S]*?<\\/style\\s*>/gi, \"\");\n\n for (const tag of source.matchAll(META_TAG)) {\n const attributes = readAttributes(tag[1] ?? \"\");\n const key = (attributes.get(\"property\") ?? attributes.get(\"name\"))?.trim().toLowerCase();\n const content = attributes.get(\"content\");\n\n if (!key || content === undefined) {\n continue;\n }\n\n const list = values.get(key) ?? [];\n list.push(decodeEntities(content).trim());\n values.set(key, list);\n }\n\n return {\n get: (key) => values.get(key.toLowerCase())?.find((value) => value.length > 0),\n getAll: (key) => values.get(key.toLowerCase()) ?? [],\n };\n}\n\nfunction readAttributes(raw: string): Map<string, string> {\n const attributes = new Map<string, string>();\n\n for (const match of raw.matchAll(ATTRIBUTE)) {\n const name = match[1]?.toLowerCase();\n\n if (name && !attributes.has(name)) {\n attributes.set(name, match[2] ?? match[3] ?? match[4] ?? \"\");\n }\n }\n\n return attributes;\n}\n\nexport function decodeEntities(value: string): string {\n return value.replace(/&(?:#(\\d+)|#x([0-9a-f]+)|([a-z]+));/gi, (entity, decimal, hex, name) => {\n if (name) {\n return NAMED_ENTITIES[String(name).toLowerCase()] ?? entity;\n }\n\n const codePoint = decimal ? Number(decimal) : Number.parseInt(hex, 16);\n\n return codePoint > 0 && codePoint <= 0x10ffff ? String.fromCodePoint(codePoint) : entity;\n });\n}\n","import { decodeEntities } from \"./parse-meta.js\";\n\nexport const MAX_SITEMAP_DEPTH = 2;\nconst MAX_SITEMAP_FILES = 200;\n\nexport interface SitemapDocument {\n kind: \"index\" | \"urlset\";\n locs: string[];\n}\n\nexport interface CollectSitemapOptions {\n /** Reads a sitemap from a URL or a local path. Injected so tests need no network. */\n readSource: (source: string) => Promise<string>;\n onNote?: ((note: string) => void) | undefined;\n}\n\n/** Extracts every `<loc>` and says whether the file is a sitemap index or a plain URL set. */\nexport function parseSitemap(xml: string): SitemapDocument {\n const locs: string[] = [];\n\n for (const match of xml.matchAll(/<loc\\b[^>]*>([\\s\\S]*?)<\\/loc\\s*>/gi)) {\n const value = decodeEntities((match[1] ?? \"\").replace(/^\\s*<!\\[CDATA\\[([\\s\\S]*?)\\]\\]>\\s*$/, \"$1\").trim());\n\n if (value) {\n locs.push(value);\n }\n }\n\n return { kind: /<sitemapindex[\\s>]/i.test(xml) ? \"index\" : \"urlset\", locs };\n}\n\n/**\n * Walks a sitemap, following sitemap indexes up to MAX_SITEMAP_DEPTH levels, and returns\n * every page URL in sitemap order. `--limit` is applied afterwards with `sampleEvenly`, so\n * the whole sitemap is read first. Only same-origin entries are kept when the sitemap is a\n * URL: the sitemap decides what gets audited, and it cannot point the audit elsewhere.\n */\nexport async function collectSitemapUrls(source: string, options: CollectSitemapOptions): Promise<string[]> {\n const rootBase = isHttpUrl(source) ? new URL(source) : null;\n const pages = new Set<string>();\n let filesRead = 0;\n\n async function visit(location: string, depth: number): Promise<void> {\n if (filesRead >= MAX_SITEMAP_FILES) {\n options.onNote?.(`Stopped after reading ${MAX_SITEMAP_FILES} sitemap files`);\n return;\n }\n\n filesRead += 1;\n\n const document = parseSitemap(await options.readSource(location));\n const base = isHttpUrl(location) ? location : undefined;\n\n for (const loc of document.locs) {\n const resolved = resolveLoc(loc, base);\n\n if (!resolved) {\n options.onNote?.(`Skipped ${loc}: not an absolute http(s) URL`);\n continue;\n }\n\n if (rootBase && new URL(resolved).origin !== rootBase.origin) {\n options.onNote?.(`Skipped off-origin entry ${resolved}`);\n continue;\n }\n\n if (document.kind === \"urlset\") {\n pages.add(resolved);\n } else if (depth >= MAX_SITEMAP_DEPTH) {\n options.onNote?.(`Skipped ${resolved}: sitemap indexes are followed ${MAX_SITEMAP_DEPTH} levels deep`);\n } else {\n await visit(resolved, depth + 1);\n }\n }\n }\n\n await visit(source, 0);\n\n return [...pages];\n}\n\n/**\n * An even, deterministic spread of `count` items: item `floor(i * length / count)` for each `i`.\n * The first item is always included, and the same input gives the same sample every run.\n */\nexport function sampleEvenly<T>(items: readonly T[], count: number): T[] {\n if (count >= items.length) {\n return [...items];\n }\n\n return Array.from({ length: count }, (_, index) => items[Math.floor((index * items.length) / count)] as T);\n}\n\nfunction resolveLoc(loc: string, base: string | undefined): string | null {\n try {\n const url = new URL(loc, base);\n\n return url.protocol === \"http:\" || url.protocol === \"https:\" ? url.href : null;\n } catch {\n return null;\n }\n}\n\nexport function isHttpUrl(value: string): boolean {\n return /^https?:\\/\\//i.test(value);\n}\n","import type { Finding, ImageProbe } from \"./types.js\";\n\nexport const HEAVY_IMAGE_BYTES = 300_000;\nexport const MAX_IMAGE_BYTES = 5_000_000;\nexport const IDEAL_WIDTH = 1200;\nexport const IDEAL_HEIGHT = 630;\n/** 1200x630 and any larger image of the same shape pass; the shape may be off by this fraction. */\nexport const ASPECT_TOLERANCE = 0.02;\n\nconst IDEAL_ASPECT = IDEAL_WIDTH / IDEAL_HEIGHT;\nconst RELIABLE_TYPES: readonly string[] = [\"image/png\", \"image/jpeg\"];\nconst PARTIAL_TYPES: readonly string[] = [\"image/webp\", \"image/gif\", \"image/avif\"];\n\nconst PNG_SIGNATURE = [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a] as const;\nconst IHDR_END = 24;\n\nexport interface ImageSize {\n width: number;\n height: number;\n}\n\nexport type PngHeader = ImageSize;\n\nexport function hasPngSignature(bytes: Uint8Array): boolean {\n return bytes.byteLength >= PNG_SIGNATURE.length && PNG_SIGNATURE.every((byte, index) => bytes[index] === byte);\n}\n\n/** Reads width and height from the IHDR chunk, which a valid PNG places right after the signature. */\nexport function readPngHeader(bytes: Uint8Array): PngHeader | null {\n if (!hasPngSignature(bytes) || bytes.byteLength < IHDR_END) {\n return null;\n }\n\n const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);\n const isIhdr = view.getUint32(8) === 13 && view.getUint32(12) === 0x49484452;\n\n if (!isIhdr) {\n return null;\n }\n\n const width = view.getUint32(16);\n const height = view.getUint32(20);\n\n return width > 0 && height > 0 ? { width, height } : null;\n}\n\n/** Dimensions of whichever of PNG, JPEG or WebP the bytes are, by signature rather than content-type. */\nexport function readImageSize(bytes: Uint8Array): ImageSize | null {\n return readPngHeader(bytes) ?? readJpegSize(bytes) ?? readWebpSize(bytes);\n}\n\n/** Walks JPEG marker segments to the first SOF (start of frame) marker, which carries height then width. */\nexport function readJpegSize(bytes: Uint8Array): ImageSize | null {\n if (bytes[0] !== 0xff || bytes[1] !== 0xd8) {\n return null;\n }\n\n const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);\n let offset = 2;\n\n while (offset + 4 <= bytes.byteLength) {\n if (bytes[offset] !== 0xff) {\n return null;\n }\n\n const marker = bytes[offset + 1] as number;\n\n if (marker === 0xff) {\n offset += 1;\n continue;\n }\n\n // Standalone markers have no length: TEM, RSTn, SOI, EOI.\n if (marker === 0x01 || (marker >= 0xd0 && marker <= 0xd9)) {\n offset += 2;\n continue;\n }\n\n // SOS: entropy-coded data follows, so there is no frame header further on.\n if (marker === 0xda) {\n return null;\n }\n\n const isFrame = marker >= 0xc0 && marker <= 0xcf && marker !== 0xc4 && marker !== 0xc8 && marker !== 0xcc;\n\n if (isFrame) {\n if (offset + 9 > bytes.byteLength) {\n return null;\n }\n\n const height = view.getUint16(offset + 5);\n const width = view.getUint16(offset + 7);\n\n return width > 0 && height > 0 ? { width, height } : null;\n }\n\n offset += 2 + view.getUint16(offset + 2);\n }\n\n return null;\n}\n\n/** Reads the canvas size from a WebP's first chunk: VP8 (lossy), VP8L (lossless) or VP8X (extended). */\nexport function readWebpSize(bytes: Uint8Array): ImageSize | null {\n const ascii = (start: number, length: number) => String.fromCharCode(...bytes.subarray(start, start + length));\n\n if (bytes.byteLength < 30 || ascii(0, 4) !== \"RIFF\" || ascii(8, 4) !== \"WEBP\") {\n return null;\n }\n\n const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);\n const chunk = ascii(12, 4);\n let size: ImageSize | null = null;\n\n if (chunk === \"VP8 \") {\n const startCode = bytes[23] === 0x9d && bytes[24] === 0x01 && bytes[25] === 0x2a;\n size = startCode ? { width: view.getUint16(26, true) & 0x3fff, height: view.getUint16(28, true) & 0x3fff } : null;\n } else if (chunk === \"VP8L\") {\n const bits = view.getUint32(21, true);\n size = bytes[20] === 0x2f ? { width: (bits & 0x3fff) + 1, height: ((bits >>> 14) & 0x3fff) + 1 } : null;\n } else if (chunk === \"VP8X\") {\n size = {\n width: 1 + (bytes[24] as number) + ((bytes[25] as number) << 8) + ((bytes[26] as number) << 16),\n height: 1 + (bytes[27] as number) + ((bytes[28] as number) << 8) + ((bytes[29] as number) << 16),\n };\n }\n\n return size && size.width > 0 && size.height > 0 ? size : null;\n}\n\n/** Names what a body looks like, so \"not a PNG\" messages can say what it is instead. */\nexport function sniffContent(bytes: Uint8Array): string | null {\n const text = new TextDecoder().decode(bytes.subarray(0, 64)).trimStart().toLowerCase();\n\n if (text.startsWith(\"<!doctype\") || text.startsWith(\"<html\") || text.startsWith(\"<head\")) return \"HTML\";\n if (text.startsWith(\"<?xml\") || text.startsWith(\"<svg\")) return \"SVG/XML\";\n if (bytes[0] === 0xff && bytes[1] === 0xd8 && bytes[2] === 0xff) return \"JPEG\";\n if (text.startsWith(\"gif8\")) return \"GIF\";\n if (text.startsWith(\"riff\") && text.slice(8, 12) === \"webp\") return \"WebP\";\n\n return null;\n}\n\n/** Every check that depends on the fetched image. Pure: a function of the probe and the byte cap. */\nexport function checkImage(probe: ImageProbe, maxBytes: number): Finding[] {\n if (probe.status === null) {\n return [{ id: \"image-unreachable\", level: \"error\", message: `image request failed: ${probe.error ?? \"unknown error\"}` }];\n }\n\n if (probe.status < 200 || probe.status > 299) {\n return [{ id: \"image-unreachable\", level: \"error\", message: `image returned HTTP ${probe.status}` }];\n }\n\n const findings: Finding[] = [];\n const contentType = (probe.contentType ?? \"\").split(\";\")[0]?.trim().toLowerCase() ?? \"\";\n const format = checkFormat(contentType, probe.head, readPngHeader(probe.head) !== null);\n const dimensions = readImageSize(probe.head);\n\n if (format) {\n findings.push(format);\n }\n\n const limit = Math.min(maxBytes, MAX_IMAGE_BYTES);\n const size = `${probe.truncated ? \"over \" : \"\"}${formatBytes(probe.bytes)}`;\n\n if (probe.bytes > limit || probe.truncated) {\n findings.push({\n id: \"image-too-large\",\n level: \"error\",\n message: `image is ${size}, above the ${formatBytes(limit)} limit${limit === MAX_IMAGE_BYTES ? \" (X rejects images over 5 MB)\" : \"\"}`,\n });\n } else if (probe.bytes > HEAVY_IMAGE_BYTES) {\n findings.push({\n id: \"image-heavy\",\n level: \"warn\",\n message: `image is ${size}; WhatsApp drops the preview image above ~${formatBytes(HEAVY_IMAGE_BYTES)}`,\n });\n }\n\n if (dimensions) {\n const sizeFinding = checkDimensions(dimensions);\n\n if (sizeFinding) {\n findings.push(sizeFinding);\n }\n }\n\n return findings;\n}\n\n/**\n * `image-format`: the content type decides the level (PNG and JPEG pass, WebP, GIF and AVIF warn,\n * everything else errors), and the body must back the content type up. An HTML error page served\n * as `image/png` is an error whatever the header says.\n */\nfunction checkFormat(contentType: string, head: Uint8Array, hasPngHeader: boolean): Finding | null {\n const sniffed = sniffContent(head);\n const named = contentType || \"no content-type\";\n\n if (!contentType.startsWith(\"image/\")) {\n return { id: \"image-format\", level: \"error\", message: `image is served as ${named}${sniffed ? ` and the body looks like ${sniffed}` : \"\"}, not an image` };\n }\n\n if (head.byteLength === 0) {\n return { id: \"image-format\", level: \"error\", message: `image is served as ${contentType} but the body is empty` };\n }\n\n if (sniffed === \"HTML\" || sniffed === \"SVG/XML\") {\n return { id: \"image-format\", level: \"error\", message: `image is served as ${contentType} but the body looks like ${sniffed}` };\n }\n\n if (RELIABLE_TYPES.includes(contentType)) {\n if (hasPngSignature(head) && !hasPngHeader) {\n return { id: \"image-format\", level: \"error\", message: `image is served as ${contentType}; the PNG signature is present but the IHDR header is missing or corrupt` };\n }\n\n if (!hasPngSignature(head) && sniffed !== \"JPEG\") {\n return { id: \"image-format\", level: \"error\", message: `image is served as ${contentType} but the body is not PNG or JPEG data` };\n }\n\n return null;\n }\n\n if (PARTIAL_TYPES.includes(contentType)) {\n return { id: \"image-format\", level: \"warn\", message: `image is ${contentType}; it renders on most scrapers but fails on some, WhatsApp in particular. Use PNG or JPEG` };\n }\n\n return { id: \"image-format\", level: \"error\", message: `image is ${contentType}; link previews render PNG and JPEG reliably, not this. Use PNG or JPEG` };\n}\n\n/** Applies to PNG, JPEG and WebP alike. Passes 1200x630 and any larger image within 2% of that shape, so 2x and 3x renders are fine. */\nfunction checkDimensions({ width, height }: ImageSize): Finding | null {\n const aspect = width / height;\n const shapeOff = Math.abs(aspect / IDEAL_ASPECT - 1) > ASPECT_TOLERANCE;\n\n if (width >= IDEAL_WIDTH && !shapeOff) {\n return null;\n }\n\n const dimensions = `${width}x${height}`;\n const reason = shapeOff ? `${aspect.toFixed(2)}:1, not the 1.91:1 previews are cropped to` : `under ${IDEAL_WIDTH} wide`;\n\n return {\n id: \"image-size\",\n level: \"warn\",\n message: `image is ${dimensions} (${reason}); use ${IDEAL_WIDTH}x${IDEAL_HEIGHT} or a larger image of the same shape, such as 2400x1260 (${dimensions} is not fine)`,\n };\n}\n\nexport function formatBytes(bytes: number): string {\n if (bytes >= 1_000_000) {\n return `${(bytes / 1_000_000).toFixed(1)} MB`;\n }\n\n if (bytes >= 1_000) {\n return `${Math.round(bytes / 1_000)} KB`;\n }\n\n return `${bytes} B`;\n}\n","import { checkImage } from \"./check-image.js\";\nimport type { CheckId, Finding, Level, PageProbe } from \"./types.js\";\n\nexport const MAX_TITLE_LENGTH = 70;\nexport const MAX_DESCRIPTION_LENGTH = 200;\n\nexport interface CheckInfo {\n id: CheckId;\n /** Default level. `image-size` is a warning that becomes an error for badly shaped images. */\n level: Level;\n summary: string;\n fix: string;\n}\n\nexport const CHECKS: readonly CheckInfo[] = [\n { id: \"page-unreachable\", level: \"error\", summary: \"page is not 2xx, or the fetch failed\", fix: \"make the page return 200 to a plain GET, or drop it from the sitemap\" },\n { id: \"image-missing\", level: \"error\", summary: \"no og:image\", fix: \"add an og:image meta tag with an absolute URL\" },\n { id: \"image-relative\", level: \"error\", summary: \"og:image is a relative URL\", fix: \"make og:image absolute, for example by setting metadataBase in Next.js\" },\n { id: \"image-unreachable\", level: \"error\", summary: \"og:image is not 2xx, or the fetch failed\", fix: \"make the og:image URL return 200 publicly, without auth or bot blocking\" },\n { id: \"image-format\", level: \"error\", summary: \"og:image is not PNG or JPEG (warn for WebP, GIF, AVIF)\", fix: \"serve a real PNG or JPEG with a matching content-type, not an HTML error page, SVG or WebP\" },\n { id: \"image-too-large\", level: \"error\", summary: \"og:image is over --max-bytes or 5 MB\", fix: \"shrink the image below 5 MB, ideally below 300 KB\" },\n { id: \"image-heavy\", level: \"warn\", summary: \"og:image is over 300 KB\", fix: \"compress the image below 300 KB so WhatsApp keeps the preview\" },\n { id: \"image-size\", level: \"warn\", summary: \"og:image is under 1200 wide or not the 1.91:1 shape\", fix: \"render the image at 1200x630, or a 2x/3x of it\" },\n { id: \"image-no-alt\", level: \"warn\", summary: \"no og:image:alt\", fix: \"add og:image:alt describing the image\" },\n { id: \"title-missing\", level: \"warn\", summary: \"no og:title\", fix: \"add an og:title meta tag\" },\n { id: \"title-long\", level: \"warn\", summary: `og:title is over ${MAX_TITLE_LENGTH} characters`, fix: `shorten og:title to ${MAX_TITLE_LENGTH} characters or fewer` },\n { id: \"description-missing\", level: \"warn\", summary: \"no og:description\", fix: \"add an og:description meta tag\" },\n { id: \"description-long\", level: \"warn\", summary: `og:description is over ${MAX_DESCRIPTION_LENGTH} characters`, fix: `shorten og:description to ${MAX_DESCRIPTION_LENGTH} characters or fewer` },\n { id: \"url-mismatch\", level: \"warn\", summary: \"og:url differs from the page URL\", fix: \"set og:url to the page's own canonical URL\" },\n { id: \"twitter-card-missing\", level: \"warn\", summary: \"no twitter:card\", fix: 'add twitter:card, usually \"summary_large_image\"' },\n { id: \"twitter-image-missing\", level: \"warn\", summary: \"summary_large_image with no twitter:image and no usable og:image\", fix: \"add twitter:image, or fix the og:image that X falls back to\" },\n { id: \"image-duplicate\", level: \"warn\", summary: \"the same og:image is used by several pages\", fix: \"give each page its own image, or accept a shared default on purpose\" },\n];\n\nexport const IMAGE_PROBE_CHECKS: readonly CheckId[] = [\n \"image-unreachable\",\n \"image-format\",\n \"image-too-large\",\n \"image-heavy\",\n \"image-size\",\n \"twitter-image-missing\",\n];\n\nexport function fixFor(id: CheckId): string {\n return CHECKS.find((check) => check.id === id)?.fix ?? \"\";\n}\n\n/** Every per-page check. A function of the probe only, so it runs without a network. */\nexport function checkPage(page: PageProbe, maxBytes: number): Finding[] {\n if (page.status === null) {\n return [{ id: \"page-unreachable\", level: \"error\", message: `page request failed: ${page.error ?? \"unknown error\"}` }];\n }\n\n if (page.status < 200 || page.status > 299) {\n return [{ id: \"page-unreachable\", level: \"error\", message: `page returned HTTP ${page.status}` }];\n }\n\n const findings: Finding[] = [];\n const meta = page.meta;\n\n if (!meta) {\n return findings;\n }\n\n const rawImage = meta.get(\"og:image\");\n let usableOgImage = false;\n\n if (!rawImage) {\n findings.push({ id: \"image-missing\", level: \"error\", message: \"no og:image meta tag\" });\n } else {\n if (isRelativeUrl(rawImage)) {\n findings.push({ id: \"image-relative\", level: \"error\", message: `og:image is relative (${rawImage}); crawlers need an absolute URL` });\n }\n\n const imageFindings = page.image ? checkImage(page.image, maxBytes) : [];\n findings.push(...imageFindings);\n usableOgImage = !isRelativeUrl(rawImage) && !imageFindings.some((finding) => finding.level === \"error\");\n\n if (!meta.get(\"og:image:alt\")) {\n findings.push({ id: \"image-no-alt\", level: \"warn\", message: \"no og:image:alt\" });\n }\n }\n\n const title = meta.get(\"og:title\");\n\n if (!title) {\n findings.push({ id: \"title-missing\", level: \"warn\", message: \"no og:title meta tag\" });\n } else if (characterCount(title) > MAX_TITLE_LENGTH) {\n findings.push({ id: \"title-long\", level: \"warn\", message: `og:title is ${characterCount(title)} characters (max ${MAX_TITLE_LENGTH})` });\n }\n\n const description = meta.get(\"og:description\");\n\n if (!description) {\n findings.push({ id: \"description-missing\", level: \"warn\", message: \"no og:description meta tag\" });\n } else if (characterCount(description) > MAX_DESCRIPTION_LENGTH) {\n findings.push({\n id: \"description-long\",\n level: \"warn\",\n message: `og:description is ${characterCount(description)} characters (max ${MAX_DESCRIPTION_LENGTH})`,\n });\n }\n\n const ogUrl = meta.get(\"og:url\");\n\n if (ogUrl && !sameUrl(ogUrl, [page.url, page.finalUrl], page.finalUrl)) {\n findings.push({ id: \"url-mismatch\", level: \"warn\", message: `og:url is ${ogUrl}, but the page is ${page.url}` });\n }\n\n const card = meta.get(\"twitter:card\");\n\n if (!card) {\n findings.push({ id: \"twitter-card-missing\", level: \"warn\", message: \"no twitter:card meta tag\" });\n } else if (card.toLowerCase() === \"summary_large_image\" && !meta.get(\"twitter:image\") && !usableOgImage) {\n // X falls back to og:image, so a missing twitter:image only matters when that fallback is also broken.\n findings.push({\n id: \"twitter-image-missing\",\n level: \"warn\",\n message: \"twitter:card is summary_large_image but there is no twitter:image, and no usable og:image for X to fall back to\",\n });\n }\n\n return findings;\n}\n\n/**\n * `image-duplicate`, reported once per group on the first page that uses the image.\n * `pages` is the list of the other pages in the group.\n */\nexport function findDuplicateImages(pages: ReadonlyArray<{ url: string; imageUrl: string | null }>): Map<string, Finding> {\n const groups = new Map<string, string[]>();\n\n for (const page of pages) {\n if (page.imageUrl) {\n groups.set(page.imageUrl, [...(groups.get(page.imageUrl) ?? []), page.url]);\n }\n }\n\n const findings = new Map<string, Finding>();\n\n for (const [imageUrl, members] of groups) {\n const [first, ...others] = members;\n\n if (first && others.length > 0) {\n findings.set(first, {\n id: \"image-duplicate\",\n level: \"warn\",\n message: `${imageUrl} is used by ${members.length} pages`,\n pages: others,\n });\n }\n }\n\n return findings;\n}\n\nexport function isRelativeUrl(value: string): boolean {\n return !/^[a-z][a-z0-9+.-]*:/i.test(value);\n}\n\nfunction characterCount(value: string): number {\n return [...value].length;\n}\n\nfunction sameUrl(ogUrl: string, candidates: string[], base: string): boolean {\n const target = normalizeUrl(ogUrl, base);\n\n return candidates.some((candidate) => normalizeUrl(candidate, base) === target);\n}\n\nfunction normalizeUrl(value: string, base: string): string {\n try {\n const url = new URL(value, base);\n url.hash = \"\";\n\n return `${url.origin}${url.pathname.replace(/\\/+$/, \"\")}${url.search}`;\n } catch {\n return value.replace(/\\/+$/, \"\");\n }\n}\n","import { fixFor } from \"./checks.js\";\nimport type { AuditReport, FailOn, Finding, FixFirstEntry, PageResult } from \"./types.js\";\n\nconst FIX_FIRST_SHOWN = 5;\n\nexport interface BuildReportInput {\n source: AuditReport[\"source\"];\n failOn: FailOn;\n pages: PageResult[];\n now?: Date;\n}\n\nexport interface FormatOptions {\n color: boolean;\n quiet: boolean;\n}\n\nexport function buildReport(input: BuildReportInput): AuditReport {\n const findings = input.pages.flatMap((page) => page.findings);\n\n return {\n tool: \"og-route-kit\",\n schemaVersion: 1,\n generatedAt: (input.now ?? new Date()).toISOString(),\n source: input.source,\n failOn: input.failOn,\n summary: {\n pages: input.pages.length,\n pagesWithFindings: input.pages.filter((page) => page.findings.length > 0).length,\n errors: findings.filter((finding) => finding.level === \"error\").length,\n warnings: findings.filter((finding) => finding.level === \"warn\").length,\n },\n fixFirst: buildFixFirst(findings),\n pages: input.pages,\n };\n}\n\n/** Findings grouped by check and level, errors first, then by how many pages each one hits. */\nexport function buildFixFirst(findings: Finding[]): FixFirstEntry[] {\n const groups = new Map<string, FixFirstEntry>();\n\n for (const finding of findings) {\n const key = `${finding.level}:${finding.id}`;\n const hits = 1 + (finding.pages?.length ?? 0);\n const existing = groups.get(key);\n\n if (existing) {\n existing.pages += hits;\n } else {\n groups.set(key, { id: finding.id, level: finding.level, pages: hits, fix: fixFor(finding.id) });\n }\n }\n\n return [...groups.values()].sort(\n (a, b) => levelRank(a.level) - levelRank(b.level) || b.pages - a.pages || a.id.localeCompare(b.id),\n );\n}\n\n/** 0 when clean, 1 when a finding reaches the --fail-on level. Usage and network failures are 2, set by the caller. */\nexport function exitCodeFor(report: AuditReport): 0 | 1 {\n const { errors, warnings } = report.summary;\n\n if (report.failOn === \"never\") {\n return 0;\n }\n\n return errors > 0 || (report.failOn === \"warn\" && warnings > 0) ? 1 : 0;\n}\n\nexport function summaryLine(report: AuditReport): string {\n const { pages, errors, warnings } = report.summary;\n\n return [plural(pages, \"page\"), plural(errors, \"error\"), plural(warnings, \"warning\")].join(\" · \");\n}\n\nexport function formatReport(report: AuditReport, options: FormatOptions): string {\n const paint = painter(options.color);\n const lines: string[] = [];\n\n if (!options.quiet) {\n for (const page of report.pages.filter((candidate) => candidate.findings.length > 0)) {\n lines.push(paint.bold(page.url));\n\n for (const finding of page.findings) {\n const level = finding.level === \"error\" ? paint.red(\"error\") : paint.yellow(\"warn \");\n lines.push(` ${level} ${paint.dim(finding.id.padEnd(22))} ${finding.message}`);\n\n for (const other of finding.pages?.slice(0, 3) ?? []) {\n lines.push(`${\" \".repeat(34)}${paint.dim(`also ${other}`)}`);\n }\n }\n\n lines.push(\"\");\n }\n\n const clean = report.summary.pages - report.summary.pagesWithFindings;\n\n if (clean > 0) {\n lines.push(`${plural(clean, \"page\")} with no findings`, \"\");\n }\n }\n\n const { errors, warnings } = report.summary;\n const summary = summaryLine(report);\n lines.push(errors > 0 ? paint.red(summary) : warnings > 0 ? paint.yellow(summary) : paint.green(summary));\n\n if (report.fixFirst.length > 0) {\n lines.push(\"\", paint.bold(\"What to fix first\"));\n\n report.fixFirst.slice(0, FIX_FIRST_SHOWN).forEach((entry, index) => {\n const level = entry.level === \"error\" ? paint.red(\"error\") : paint.yellow(\"warn \");\n lines.push(` ${index + 1}. ${level} ${entry.id} on ${plural(entry.pages, \"page\")}: ${entry.fix}`);\n });\n\n if (report.fixFirst.length > FIX_FIRST_SHOWN) {\n lines.push(` …and ${report.fixFirst.length - FIX_FIRST_SHOWN} more`);\n }\n }\n\n return `${lines.join(\"\\n\")}\\n`;\n}\n\nfunction levelRank(level: string): number {\n return level === \"error\" ? 0 : 1;\n}\n\nfunction plural(count: number, noun: string): string {\n return `${count} ${noun}${count === 1 ? \"\" : \"s\"}`;\n}\n\nfunction painter(enabled: boolean) {\n const wrap = (open: number, close: number) => (text: string) => (enabled ? `\\u001b[${open}m${text}\\u001b[${close}m` : text);\n\n return { bold: wrap(1, 22), dim: wrap(2, 22), red: wrap(31, 39), yellow: wrap(33, 39), green: wrap(32, 39) };\n}\n","import { readImageSize } from \"./check-image.js\";\nimport { IMAGE_PROBE_CHECKS, checkPage, findDuplicateImages } from \"./checks.js\";\nimport { mapPool, probeImage, probePage } from \"./fetch.js\";\nimport type { NetworkOptions } from \"./fetch.js\";\nimport { parseMeta } from \"./parse-meta.js\";\nimport { buildReport } from \"./report.js\";\nimport type { AuditReport, CheckId, FailOn, Finding, ImageProbe, PageProbe, PageResult } from \"./types.js\";\n\nexport interface AuditConfig extends NetworkOptions {\n pages: string[];\n source: AuditReport[\"source\"];\n failOn: FailOn;\n concurrency: number;\n /** Only report these checks. Null runs everything. */\n only: ReadonlySet<CheckId> | null;\n onProgress?: ((done: number, total: number) => void) | undefined;\n}\n\nexport async function runAudit(config: AuditConfig): Promise<AuditReport> {\n const wants = (id: CheckId) => !config.only || config.only.has(id);\n const needsImage = IMAGE_PROBE_CHECKS.some(wants);\n // Many pages share one default image; fetch it once.\n const images = new Map<string, Promise<ImageProbe>>();\n let done = 0;\n\n const probes = await mapPool(config.pages, config.concurrency, async (url) => {\n const fetched = await probePage(url, config);\n const meta = fetched.status === null ? null : parseMeta(fetched.html);\n const rawImage = meta?.get(\"og:image\");\n const imageUrl = rawImage ? resolveUrl(rawImage, fetched.finalUrl) : null;\n let image: ImageProbe | null = null;\n\n if (imageUrl && needsImage) {\n const cached = images.get(imageUrl) ?? probeImage(imageUrl, config);\n images.set(imageUrl, cached);\n image = await cached;\n }\n\n config.onProgress?.((done += 1), config.pages.length);\n\n const probe: PageProbe = { url, finalUrl: fetched.finalUrl, status: fetched.status, meta, imageUrl, image };\n\n if (fetched.error) {\n probe.error = fetched.error;\n }\n\n return probe;\n });\n\n const duplicates = wants(\"image-duplicate\") ? findDuplicateImages(probes) : new Map<string, Finding>();\n\n const pages: PageResult[] = probes.map((probe) => {\n const findings = [...checkPage(probe, config.maxBytes), ...(duplicates.get(probe.url) ? [duplicates.get(probe.url) as Finding] : [])];\n const header = probe.image ? readImageSize(probe.image.head) : null;\n\n return {\n url: probe.url,\n status: probe.status,\n image: probe.image\n ? {\n url: probe.image.url,\n status: probe.image.status,\n contentType: probe.image.contentType,\n bytes: probe.image.bytes,\n width: header?.width ?? null,\n height: header?.height ?? null,\n }\n : null,\n findings: findings.filter((finding) => wants(finding.id)),\n };\n });\n\n return buildReport({ source: config.source, failOn: config.failOn, pages });\n}\n\nfunction resolveUrl(value: string, base: string): string {\n try {\n return new URL(value, base).href;\n } catch {\n return value;\n }\n}\n"],"mappings":";;;AACA,SAAS,SAAAA,QAAO,aAAAC,kBAAiB;AACjC,SAAS,WAAAC,gBAAe;;;ACFjB,IAAM,oBAAoB;AAC1B,IAAM,qBAAqB;AAElC,IAAM,gBAAgB,CAAC,KAAM,IAAM,IAAM,IAAM,IAAM,IAAM,IAAM,EAAI;AAO9D,SAAS,yBAAyB,UAAoB,UAAwB;AACnF,MAAI,CAAC,SAAS,IAAI;AA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["mkdir","writeFile","dirname","readFile","PNG_SIGNATURE","readFile","checkImage","mkdir","dirname","writeFile"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { a as OgFields } from '../sizes-Bn3i71Bz.js';
|
|
2
|
+
export { c as OG_IMAGE_SIZES, d as OgField, e as OgImageSize, O as OgImageSizeInput, f as OgImageSizeName, b as OgImageUrlParams, g as buildOgImageUrl, r as resolveOgImageSize } from '../sizes-Bn3i71Bz.js';
|
|
3
|
+
|
|
4
|
+
type OgSearchParamsInput = URLSearchParams | Iterable<[string, string]> | Record<string, string | string[] | null | undefined>;
|
|
5
|
+
type NormalizeOgParamsOptions<T extends Record<string, string>> = {
|
|
6
|
+
defaults: T;
|
|
7
|
+
fields?: OgFields<T> | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const DEFAULT_OG_PARAM_MAX = 512;
|
|
10
|
+
declare class OgParamError extends Error {
|
|
11
|
+
constructor(message: string);
|
|
12
|
+
}
|
|
13
|
+
declare function normalizeOgParams<T extends Record<string, string>>(input: OgSearchParamsInput, options: NormalizeOgParamsOptions<T>): T;
|
|
14
|
+
|
|
15
|
+
type NormalizeTextOptions = {
|
|
16
|
+
collapseWhitespace?: boolean | undefined;
|
|
17
|
+
max?: number | undefined;
|
|
18
|
+
};
|
|
19
|
+
declare function normalizeText(value: string, options?: NormalizeTextOptions): string;
|
|
20
|
+
|
|
21
|
+
export { DEFAULT_OG_PARAM_MAX, type NormalizeOgParamsOptions, type NormalizeTextOptions, OgFields, OgParamError, type OgSearchParamsInput, normalizeOgParams, normalizeText };
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
// src/core/image-url.ts
|
|
2
|
+
function buildOgImageUrl(route, params = {}) {
|
|
3
|
+
const routeText = route.toString();
|
|
4
|
+
const hashIndex = routeText.indexOf("#");
|
|
5
|
+
const withoutHash = hashIndex >= 0 ? routeText.slice(0, hashIndex) : routeText;
|
|
6
|
+
const hash = hashIndex >= 0 ? routeText.slice(hashIndex) : "";
|
|
7
|
+
const queryIndex = withoutHash.indexOf("?");
|
|
8
|
+
const base = queryIndex >= 0 ? withoutHash.slice(0, queryIndex) : withoutHash;
|
|
9
|
+
const existingQuery = queryIndex >= 0 ? withoutHash.slice(queryIndex + 1) : "";
|
|
10
|
+
const searchParams = new URLSearchParams(existingQuery);
|
|
11
|
+
for (const [key, value] of Object.entries(params)) {
|
|
12
|
+
if (value == null) {
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
searchParams.delete(key);
|
|
16
|
+
if (Array.isArray(value)) {
|
|
17
|
+
for (const item of value) {
|
|
18
|
+
searchParams.append(key, String(item));
|
|
19
|
+
}
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
searchParams.set(key, String(value));
|
|
23
|
+
}
|
|
24
|
+
const query = searchParams.toString();
|
|
25
|
+
return `${base}${query ? `?${query}` : ""}${hash}`;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// src/core/text.ts
|
|
29
|
+
function normalizeText(value, options = {}) {
|
|
30
|
+
const collapseWhitespace = options.collapseWhitespace ?? true;
|
|
31
|
+
const trimmed = value.trim();
|
|
32
|
+
const normalized = collapseWhitespace ? trimmed.replace(/\s+/g, " ") : trimmed;
|
|
33
|
+
if (typeof options.max === "number") {
|
|
34
|
+
return normalized.slice(0, options.max);
|
|
35
|
+
}
|
|
36
|
+
return normalized;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// src/core/params.ts
|
|
40
|
+
var DEFAULT_OG_PARAM_MAX = 512;
|
|
41
|
+
var OgParamError = class extends Error {
|
|
42
|
+
constructor(message) {
|
|
43
|
+
super(message);
|
|
44
|
+
this.name = "OgParamError";
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
function normalizeOgParams(input, options) {
|
|
48
|
+
const searchParams = toURLSearchParams(input);
|
|
49
|
+
const output = {};
|
|
50
|
+
for (const key of Object.keys(options.defaults)) {
|
|
51
|
+
const field = options.fields?.[key];
|
|
52
|
+
const rawValue = searchParams.get(key);
|
|
53
|
+
const fallback = field?.fallback ?? options.defaults[key] ?? "";
|
|
54
|
+
const max = resolveMax(field?.max);
|
|
55
|
+
const normalizedValue = rawValue == null ? "" : normalizeText(rawValue.slice(0, max), { collapseWhitespace: field?.collapseWhitespace });
|
|
56
|
+
if (normalizedValue.length > 0) {
|
|
57
|
+
output[key] = applyMax(normalizedValue, max);
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
const normalizedFallback = normalizeText(fallback, {
|
|
61
|
+
collapseWhitespace: field?.collapseWhitespace,
|
|
62
|
+
max: resolveMax(field?.max)
|
|
63
|
+
});
|
|
64
|
+
if (normalizedFallback.length > 0) {
|
|
65
|
+
output[key] = normalizedFallback;
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
if (field?.required) {
|
|
69
|
+
throw new OgParamError(`Missing required OG image field: ${key}`);
|
|
70
|
+
}
|
|
71
|
+
output[key] = "";
|
|
72
|
+
}
|
|
73
|
+
return output;
|
|
74
|
+
}
|
|
75
|
+
function applyMax(value, max) {
|
|
76
|
+
return value.slice(0, resolveMax(max));
|
|
77
|
+
}
|
|
78
|
+
function resolveMax(max) {
|
|
79
|
+
if (max === void 0) {
|
|
80
|
+
return DEFAULT_OG_PARAM_MAX;
|
|
81
|
+
}
|
|
82
|
+
return Number.isSafeInteger(max) && max > 0 ? max : DEFAULT_OG_PARAM_MAX;
|
|
83
|
+
}
|
|
84
|
+
function toURLSearchParams(input) {
|
|
85
|
+
if (input instanceof URLSearchParams) {
|
|
86
|
+
return input;
|
|
87
|
+
}
|
|
88
|
+
const params = new URLSearchParams();
|
|
89
|
+
if (isIterablePairs(input)) {
|
|
90
|
+
for (const [key, value] of input) {
|
|
91
|
+
params.append(key, value);
|
|
92
|
+
}
|
|
93
|
+
return params;
|
|
94
|
+
}
|
|
95
|
+
for (const [key, value] of Object.entries(input)) {
|
|
96
|
+
if (Array.isArray(value)) {
|
|
97
|
+
for (const item of value) {
|
|
98
|
+
params.append(key, item);
|
|
99
|
+
}
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
if (value != null) {
|
|
103
|
+
params.set(key, value);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return params;
|
|
107
|
+
}
|
|
108
|
+
function isIterablePairs(input) {
|
|
109
|
+
return Symbol.iterator in Object(input);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// src/core/sizes.ts
|
|
113
|
+
var OG_IMAGE_SIZES = {
|
|
114
|
+
og: { width: 1200, height: 630 },
|
|
115
|
+
twitter: { width: 1200, height: 675 },
|
|
116
|
+
square: { width: 1200, height: 1200 }
|
|
117
|
+
};
|
|
118
|
+
function resolveOgImageSize(size = "og") {
|
|
119
|
+
if (typeof size === "string") {
|
|
120
|
+
return OG_IMAGE_SIZES[size];
|
|
121
|
+
}
|
|
122
|
+
return size;
|
|
123
|
+
}
|
|
124
|
+
export {
|
|
125
|
+
DEFAULT_OG_PARAM_MAX,
|
|
126
|
+
OG_IMAGE_SIZES,
|
|
127
|
+
OgParamError,
|
|
128
|
+
buildOgImageUrl,
|
|
129
|
+
normalizeOgParams,
|
|
130
|
+
normalizeText,
|
|
131
|
+
resolveOgImageSize
|
|
132
|
+
};
|
|
133
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/image-url.ts","../../src/core/text.ts","../../src/core/params.ts","../../src/core/sizes.ts"],"sourcesContent":["export type OgImageUrlParams = Record<\n string,\n string | number | boolean | Array<string | number | boolean> | null | undefined\n>;\n\nexport function buildOgImageUrl(route: string | URL, params: OgImageUrlParams = {}): string {\n const routeText = route.toString();\n const hashIndex = routeText.indexOf(\"#\");\n const withoutHash = hashIndex >= 0 ? routeText.slice(0, hashIndex) : routeText;\n const hash = hashIndex >= 0 ? routeText.slice(hashIndex) : \"\";\n const queryIndex = withoutHash.indexOf(\"?\");\n const base = queryIndex >= 0 ? withoutHash.slice(0, queryIndex) : withoutHash;\n const existingQuery = queryIndex >= 0 ? withoutHash.slice(queryIndex + 1) : \"\";\n const searchParams = new URLSearchParams(existingQuery);\n\n for (const [key, value] of Object.entries(params)) {\n if (value == null) {\n continue;\n }\n\n searchParams.delete(key);\n\n if (Array.isArray(value)) {\n for (const item of value) {\n searchParams.append(key, String(item));\n }\n continue;\n }\n\n searchParams.set(key, String(value));\n }\n\n const query = searchParams.toString();\n\n return `${base}${query ? `?${query}` : \"\"}${hash}`;\n}\n","export type NormalizeTextOptions = {\n collapseWhitespace?: boolean | undefined;\n max?: number | undefined;\n};\n\nexport function normalizeText(value: string, options: NormalizeTextOptions = {}): string {\n const collapseWhitespace = options.collapseWhitespace ?? true;\n const trimmed = value.trim();\n const normalized = collapseWhitespace ? trimmed.replace(/\\s+/g, \" \") : trimmed;\n\n if (typeof options.max === \"number\") {\n return normalized.slice(0, options.max);\n }\n\n return normalized;\n}\n","import type { OgFields } from \"./fields\";\nimport { normalizeText } from \"./text\";\n\nexport type OgSearchParamsInput =\n | URLSearchParams\n | Iterable<[string, string]>\n | Record<string, string | string[] | null | undefined>;\n\nexport type NormalizeOgParamsOptions<T extends Record<string, string>> = {\n defaults: T;\n fields?: OgFields<T> | undefined;\n};\n\n// Caps untrusted query input that reaches the renderer when a field omits an\n// explicit max, so an unconfigured field can't accept multi-megabyte values.\n// Override per field with `fields[key].max`.\nexport const DEFAULT_OG_PARAM_MAX = 512;\n\nexport class OgParamError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"OgParamError\";\n }\n}\n\nexport function normalizeOgParams<T extends Record<string, string>>(\n input: OgSearchParamsInput,\n options: NormalizeOgParamsOptions<T>,\n): T {\n const searchParams = toURLSearchParams(input);\n const output: Record<string, string> = {};\n\n for (const key of Object.keys(options.defaults) as Array<keyof T & string>) {\n const field = options.fields?.[key];\n const rawValue = searchParams.get(key);\n const fallback = field?.fallback ?? options.defaults[key] ?? \"\";\n const max = resolveMax(field?.max);\n const normalizedValue =\n rawValue == null\n ? \"\"\n : normalizeText(rawValue.slice(0, max), { collapseWhitespace: field?.collapseWhitespace });\n\n if (normalizedValue.length > 0) {\n output[key] = applyMax(normalizedValue, max);\n continue;\n }\n\n const normalizedFallback = normalizeText(fallback, {\n collapseWhitespace: field?.collapseWhitespace,\n max: resolveMax(field?.max),\n });\n\n if (normalizedFallback.length > 0) {\n output[key] = normalizedFallback;\n continue;\n }\n\n if (field?.required) {\n throw new OgParamError(`Missing required OG image field: ${key}`);\n }\n\n output[key] = \"\";\n }\n\n return output as T;\n}\n\nfunction applyMax(value: string, max: number | undefined): string {\n return value.slice(0, resolveMax(max));\n}\n\nfunction resolveMax(max: number | undefined): number {\n if (max === undefined) {\n return DEFAULT_OG_PARAM_MAX;\n }\n\n return Number.isSafeInteger(max) && max > 0 ? max : DEFAULT_OG_PARAM_MAX;\n}\n\nfunction toURLSearchParams(input: OgSearchParamsInput): URLSearchParams {\n if (input instanceof URLSearchParams) {\n return input;\n }\n\n const params = new URLSearchParams();\n\n if (isIterablePairs(input)) {\n for (const [key, value] of input) {\n params.append(key, value);\n }\n\n return params;\n }\n\n for (const [key, value] of Object.entries(input)) {\n if (Array.isArray(value)) {\n for (const item of value) {\n params.append(key, item);\n }\n continue;\n }\n\n if (value != null) {\n params.set(key, value);\n }\n }\n\n return params;\n}\n\nfunction isIterablePairs(input: OgSearchParamsInput): input is Iterable<[string, string]> {\n return Symbol.iterator in Object(input);\n}\n","export type OgImageSize = {\n width: number;\n height: number;\n};\n\nexport type OgImageSizeName = \"og\" | \"twitter\" | \"square\";\n\nexport const OG_IMAGE_SIZES = {\n og: { width: 1200, height: 630 },\n twitter: { width: 1200, height: 675 },\n square: { width: 1200, height: 1200 },\n} as const satisfies Record<OgImageSizeName, OgImageSize>;\n\nexport type OgImageSizeInput = OgImageSize | OgImageSizeName;\n\nexport function resolveOgImageSize(size: OgImageSizeInput = \"og\"): OgImageSize {\n if (typeof size === \"string\") {\n return OG_IMAGE_SIZES[size];\n }\n\n return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nC,MAAI,gBAAgB,KAAK,GAAG;AAC1B,eAAW,CAAC,KAAK,KAAK,KAAK,OAAO;AAChC,aAAO,OAAO,KAAK,KAAK;AAAA,IAC1B;AAEA,WAAO;AAAA,EACT;AAEA,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,KAAK,GAAG;AAChD,QAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,iBAAW,QAAQ,OAAO;AACxB,eAAO,OAAO,KAAK,IAAI;AAAA,MACzB;AACA;AAAA,IACF;AAEA,QAAI,SAAS,MAAM;AACjB,aAAO,IAAI,KAAK,KAAK;AAAA,IACvB;AAAA,EACF;AAEA,SAAO;AACT;AAEA,SAAS,gBAAgB,OAAiE;AACxF,SAAO,OAAO,YAAY,OAAO,KAAK;AACxC;;;ACzGO,IAAM,iBAAiB;AAAA,EAC5B,IAAI,EAAE,OAAO,MAAM,QAAQ,IAAI;AAAA,EAC/B,SAAS,EAAE,OAAO,MAAM,QAAQ,IAAI;AAAA,EACpC,QAAQ,EAAE,OAAO,MAAM,QAAQ,KAAK;AACtC;AAIO,SAAS,mBAAmB,OAAyB,MAAmB;AAC7E,MAAI,OAAO,SAAS,UAAU;AAC5B,WAAO,eAAe,IAAI;AAAA,EAC5B;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
|
|
3
|
+
type ArticleCardProps = {
|
|
4
|
+
eyebrow: string;
|
|
5
|
+
title: string;
|
|
6
|
+
description: string;
|
|
7
|
+
};
|
|
8
|
+
declare function ArticleCard({ eyebrow, title, description }: ArticleCardProps): react.JSX.Element;
|
|
9
|
+
|
|
10
|
+
type ChangelogCardProps = {
|
|
11
|
+
eyebrow: string;
|
|
12
|
+
title: string;
|
|
13
|
+
description: string;
|
|
14
|
+
};
|
|
15
|
+
declare function ChangelogCard({ eyebrow, title, description }: ChangelogCardProps): react.JSX.Element;
|
|
16
|
+
|
|
17
|
+
type ProductCardProps = {
|
|
18
|
+
eyebrow: string;
|
|
19
|
+
title: string;
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
22
|
+
declare function ProductCard({ eyebrow, title, description }: ProductCardProps): react.JSX.Element;
|
|
23
|
+
|
|
24
|
+
export { ArticleCard, type ArticleCardProps, ChangelogCard, type ChangelogCardProps, ProductCard, type ProductCardProps };
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
// src/examples/cards/article-card.tsx
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
function ArticleCard({ eyebrow, title, description }) {
|
|
4
|
+
return /* @__PURE__ */ jsxs(
|
|
5
|
+
"div",
|
|
6
|
+
{
|
|
7
|
+
style: {
|
|
8
|
+
width: "100%",
|
|
9
|
+
height: "100%",
|
|
10
|
+
display: "flex",
|
|
11
|
+
flexDirection: "column",
|
|
12
|
+
justifyContent: "space-between",
|
|
13
|
+
background: "#fbfbf9",
|
|
14
|
+
color: "#111827",
|
|
15
|
+
fontFamily: "Georgia, serif",
|
|
16
|
+
padding: 74
|
|
17
|
+
},
|
|
18
|
+
children: [
|
|
19
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", justifyContent: "space-between", fontSize: 28, color: "#5b616e" }, children: [
|
|
20
|
+
/* @__PURE__ */ jsx("div", { children: eyebrow }),
|
|
21
|
+
/* @__PURE__ */ jsx("div", { children: "Open Graph" })
|
|
22
|
+
] }),
|
|
23
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 56, alignItems: "flex-end" }, children: [
|
|
24
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 30, width: "70%" }, children: [
|
|
25
|
+
/* @__PURE__ */ jsx("div", { style: { fontSize: 82, lineHeight: 0.98, fontWeight: 700 }, children: title }),
|
|
26
|
+
/* @__PURE__ */ jsx("div", { style: { fontSize: 32, lineHeight: 1.3, color: "#4b5563" }, children: description })
|
|
27
|
+
] }),
|
|
28
|
+
/* @__PURE__ */ jsx("div", { style: { flex: 1, height: 250, borderLeft: "6px solid #111827", background: "#ece7dd" } })
|
|
29
|
+
] })
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// src/examples/cards/changelog-card.tsx
|
|
36
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
37
|
+
function ChangelogCard({ eyebrow, title, description }) {
|
|
38
|
+
return /* @__PURE__ */ jsxs2(
|
|
39
|
+
"div",
|
|
40
|
+
{
|
|
41
|
+
style: {
|
|
42
|
+
width: "100%",
|
|
43
|
+
height: "100%",
|
|
44
|
+
display: "flex",
|
|
45
|
+
background: "#111111",
|
|
46
|
+
color: "#f5f5f0",
|
|
47
|
+
fontFamily: "Inter, Arial, sans-serif",
|
|
48
|
+
padding: 70
|
|
49
|
+
},
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ jsxs2("div", { style: { display: "flex", flexDirection: "column", gap: 30, width: "58%" }, children: [
|
|
52
|
+
/* @__PURE__ */ jsx2("div", { style: { fontSize: 30, color: "#78dcca", fontWeight: 700 }, children: eyebrow }),
|
|
53
|
+
/* @__PURE__ */ jsx2("div", { style: { fontSize: 78, lineHeight: 0.96, fontWeight: 800 }, children: title }),
|
|
54
|
+
/* @__PURE__ */ jsx2("div", { style: { fontSize: 32, lineHeight: 1.28, color: "#c9c9c3" }, children: description })
|
|
55
|
+
] }),
|
|
56
|
+
/* @__PURE__ */ jsx2("div", { style: { marginLeft: 58, flex: 1, display: "flex", flexDirection: "column", justifyContent: "center", gap: 18 }, children: ["Typed route factory", "Metadata helper", "Static PNG export"].map((item) => /* @__PURE__ */ jsx2(
|
|
57
|
+
"div",
|
|
58
|
+
{
|
|
59
|
+
style: {
|
|
60
|
+
display: "flex",
|
|
61
|
+
alignItems: "center",
|
|
62
|
+
height: 72,
|
|
63
|
+
border: "1px solid #343434",
|
|
64
|
+
padding: "0 26px",
|
|
65
|
+
fontSize: 26,
|
|
66
|
+
background: "#1d1d1b"
|
|
67
|
+
},
|
|
68
|
+
children: item
|
|
69
|
+
},
|
|
70
|
+
item
|
|
71
|
+
)) })
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// src/examples/cards/product-card.tsx
|
|
78
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
79
|
+
function ProductCard({ eyebrow, title, description }) {
|
|
80
|
+
return /* @__PURE__ */ jsxs3(
|
|
81
|
+
"div",
|
|
82
|
+
{
|
|
83
|
+
style: {
|
|
84
|
+
width: "100%",
|
|
85
|
+
height: "100%",
|
|
86
|
+
display: "flex",
|
|
87
|
+
background: "#f7f5ef",
|
|
88
|
+
color: "#151515",
|
|
89
|
+
fontFamily: "Inter, Arial, sans-serif",
|
|
90
|
+
padding: 72
|
|
91
|
+
},
|
|
92
|
+
children: [
|
|
93
|
+
/* @__PURE__ */ jsxs3("div", { style: { display: "flex", flexDirection: "column", justifyContent: "space-between", width: "62%" }, children: [
|
|
94
|
+
/* @__PURE__ */ jsx3("div", { style: { fontSize: 30, letterSpacing: 0, color: "#2f6f62", fontWeight: 700 }, children: eyebrow }),
|
|
95
|
+
/* @__PURE__ */ jsxs3("div", { style: { display: "flex", flexDirection: "column", gap: 26 }, children: [
|
|
96
|
+
/* @__PURE__ */ jsx3("div", { style: { fontSize: 78, lineHeight: 0.95, fontWeight: 800 }, children: title }),
|
|
97
|
+
/* @__PURE__ */ jsx3("div", { style: { fontSize: 34, lineHeight: 1.25, color: "#494844" }, children: description })
|
|
98
|
+
] })
|
|
99
|
+
] }),
|
|
100
|
+
/* @__PURE__ */ jsx3(
|
|
101
|
+
"div",
|
|
102
|
+
{
|
|
103
|
+
style: {
|
|
104
|
+
marginLeft: 56,
|
|
105
|
+
flex: 1,
|
|
106
|
+
display: "flex",
|
|
107
|
+
alignItems: "center",
|
|
108
|
+
justifyContent: "center",
|
|
109
|
+
border: "2px solid #d8d2c3",
|
|
110
|
+
background: "#ffffff"
|
|
111
|
+
},
|
|
112
|
+
children: /* @__PURE__ */ jsxs3("div", { style: { display: "flex", flexDirection: "column", gap: 18, width: 250 }, children: [
|
|
113
|
+
/* @__PURE__ */ jsx3("div", { style: { height: 24, background: "#2f6f62" } }),
|
|
114
|
+
/* @__PURE__ */ jsx3("div", { style: { height: 24, background: "#a5b8ae" } }),
|
|
115
|
+
/* @__PURE__ */ jsx3("div", { style: { height: 24, background: "#d8d2c3" } }),
|
|
116
|
+
/* @__PURE__ */ jsx3("div", { style: { height: 120, border: "2px solid #151515", marginTop: 18 } })
|
|
117
|
+
] })
|
|
118
|
+
}
|
|
119
|
+
)
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
export {
|
|
125
|
+
ArticleCard,
|
|
126
|
+
ChangelogCard,
|
|
127
|
+
ProductCard
|
|
128
|
+
};
|
|
129
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/examples/cards/article-card.tsx","../../../src/examples/cards/changelog-card.tsx","../../../src/examples/cards/product-card.tsx"],"sourcesContent":["export type ArticleCardProps = {\n eyebrow: string;\n title: string;\n description: string;\n};\n\nexport function ArticleCard({ eyebrow, title, description }: ArticleCardProps) {\n return (\n <div\n style={{\n width: \"100%\",\n height: \"100%\",\n display: \"flex\",\n flexDirection: \"column\",\n justifyContent: \"space-between\",\n background: \"#fbfbf9\",\n color: \"#111827\",\n fontFamily: \"Georgia, serif\",\n padding: 74,\n }}\n >\n <div style={{ display: \"flex\", justifyContent: \"space-between\", fontSize: 28, color: \"#5b616e\" }}>\n <div>{eyebrow}</div>\n <div>Open Graph</div>\n </div>\n <div style={{ display: \"flex\", gap: 56, alignItems: \"flex-end\" }}>\n <div style={{ display: \"flex\", flexDirection: \"column\", gap: 30, width: \"70%\" }}>\n <div style={{ fontSize: 82, lineHeight: 0.98, fontWeight: 700 }}>{title}</div>\n <div style={{ fontSize: 32, lineHeight: 1.3, color: \"#4b5563\" }}>{description}</div>\n </div>\n <div style={{ flex: 1, height: 250, borderLeft: \"6px solid #111827\", background: \"#ece7dd\" }} />\n </div>\n </div>\n );\n}\n","export type ChangelogCardProps = {\n eyebrow: string;\n title: string;\n description: string;\n};\n\nexport function ChangelogCard({ eyebrow, title, description }: ChangelogCardProps) {\n return (\n <div\n style={{\n width: \"100%\",\n height: \"100%\",\n display: \"flex\",\n background: \"#111111\",\n color: \"#f5f5f0\",\n fontFamily: \"Inter, Arial, sans-serif\",\n padding: 70,\n }}\n >\n <div style={{ display: \"flex\", flexDirection: \"column\", gap: 30, width: \"58%\" }}>\n <div style={{ fontSize: 30, color: \"#78dcca\", fontWeight: 700 }}>{eyebrow}</div>\n <div style={{ fontSize: 78, lineHeight: 0.96, fontWeight: 800 }}>{title}</div>\n <div style={{ fontSize: 32, lineHeight: 1.28, color: \"#c9c9c3\" }}>{description}</div>\n </div>\n <div style={{ marginLeft: 58, flex: 1, display: \"flex\", flexDirection: \"column\", justifyContent: \"center\", gap: 18 }}>\n {[\"Typed route factory\", \"Metadata helper\", \"Static PNG export\"].map((item) => (\n <div\n key={item}\n style={{\n display: \"flex\",\n alignItems: \"center\",\n height: 72,\n border: \"1px solid #343434\",\n padding: \"0 26px\",\n fontSize: 26,\n background: \"#1d1d1b\",\n }}\n >\n {item}\n </div>\n ))}\n </div>\n </div>\n );\n}\n","export type ProductCardProps = {\n eyebrow: string;\n title: string;\n description: string;\n};\n\nexport function ProductCard({ eyebrow, title, description }: ProductCardProps) {\n return (\n <div\n style={{\n width: \"100%\",\n height: \"100%\",\n display: \"flex\",\n background: \"#f7f5ef\",\n color: \"#151515\",\n fontFamily: \"Inter, Arial, sans-serif\",\n padding: 72,\n }}\n >\n <div style={{ display: \"flex\", flexDirection: \"column\", justifyContent: \"space-between\", width: \"62%\" }}>\n <div style={{ fontSize: 30, letterSpacing: 0, color: \"#2f6f62\", fontWeight: 700 }}>{eyebrow}</div>\n <div style={{ display: \"flex\", flexDirection: \"column\", gap: 26 }}>\n <div style={{ fontSize: 78, lineHeight: 0.95, fontWeight: 800 }}>{title}</div>\n <div style={{ fontSize: 34, lineHeight: 1.25, color: \"#494844\" }}>{description}</div>\n </div>\n </div>\n <div\n style={{\n marginLeft: 56,\n flex: 1,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n border: \"2px solid #d8d2c3\",\n background: \"#ffffff\",\n }}\n >\n <div style={{ display: \"flex\", flexDirection: \"column\", gap: 18, width: 250 }}>\n <div style={{ height: 24, background: \"#2f6f62\" }} />\n <div style={{ height: 24, background: \"#a5b8ae\" }} />\n <div style={{ height: 24, background: \"#d8d2c3\" }} />\n <div style={{ height: 120, border: \"2px solid #151515\", marginTop: 18 }} />\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":";AAqBM,SACE,KADF;AAfC,SAAS,YAAY,EAAE,SAAS,OAAO,YAAY,GAAqB;AAC7E,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,QACL,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,SAAS;AAAA,QACT,eAAe;AAAA,QACf,gBAAgB;AAAA,QAChB,YAAY;AAAA,QACZ,OAAO;AAAA,QACP,YAAY;AAAA,QACZ,SAAS;AAAA,MACX;AAAA,MAEA;AAAA,6BAAC,SAAI,OAAO,EAAE,SAAS,QAAQ,gBAAgB,iBAAiB,UAAU,IAAI,OAAO,UAAU,GAC7F;AAAA,8BAAC,SAAK,mBAAQ;AAAA,UACd,oBAAC,SAAI,wBAAU;AAAA,WACjB;AAAA,QACA,qBAAC,SAAI,OAAO,EAAE,SAAS,QAAQ,KAAK,IAAI,YAAY,WAAW,GAC7D;AAAA,+BAAC,SAAI,OAAO,EAAE,SAAS,QAAQ,eAAe,UAAU,KAAK,IAAI,OAAO,MAAM,GAC5E;AAAA,gCAAC,SAAI,OAAO,EAAE,UAAU,IA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BAAAD,KAAC,SAAI,OAAO,EAAE,QAAQ,IAAI,YAAY,UAAU,GAAG;AAAA,cACnD,gBAAAA,KAAC,SAAI,OAAO,EAAE,QAAQ,IAAI,YAAY,UAAU,GAAG;AAAA,cACnD,gBAAAA,KAAC,SAAI,OAAO,EAAE,QAAQ,IAAI,YAAY,UAAU,GAAG;AAAA,cACnD,gBAAAA,KAAC,SAAI,OAAO,EAAE,QAAQ,KAAK,QAAQ,qBAAqB,WAAW,GAAG,GAAG;AAAA,eAC3E;AAAA;AAAA,QACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":["jsx","jsxs","jsx","jsxs"]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { c as OG_IMAGE_SIZES, d as OgField, a as OgFields, e as OgImageSize, O as OgImageSizeInput, f as OgImageSizeName, b as OgImageUrlParams, g as buildOgImageUrl, r as resolveOgImageSize } from './sizes-Bn3i71Bz.js';
|
|
2
|
+
export { DEFAULT_OG_PARAM_MAX, NormalizeOgParamsOptions, NormalizeTextOptions, OgParamError, OgSearchParamsInput, normalizeOgParams, normalizeText } from './core/index.js';
|