test: vitest unit + playwright e2e suites; fix a11y, contrast, no-JS reveal
- vitest: dictionary parity, slug-map bijection, content-schema validation, JSON-LD (23) - playwright: both locales, language-switch mapping (incl. no-JS), CV downloads, form happy-path + honeypot, axe a11y on 5 templates x 2 themes (23) - fix: raise ink-faint + light accent to meet WCAG AA 4.5:1 (axe-verified) - fix: gate reveal animations behind html.js so content is visible without JS (progressive enhancement - was hidden at opacity 0); scan reduced-motion path - fix: validate contact form before the anti-bot time-trap (no false success) - chore: ESLint node globals, typed diagram props, resvg fontFiles, prettier pass Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import type { APIRoute } from 'astro';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { resolve } from 'node:path';
|
||||
import { Resvg } from '@resvg/resvg-js';
|
||||
import { PAGE_IDS, type PageId } from '@i18n/slugMap';
|
||||
@@ -15,8 +14,9 @@ import { getProfile, getMeta } from '@lib/content';
|
||||
Fonts read from the project source (cwd = site/ at build).
|
||||
*/
|
||||
|
||||
const fontBuffers = ['SpaceGrotesk.ttf', 'Inter.ttf', 'JetBrainsMono.ttf'].map((n) =>
|
||||
readFileSync(resolve(process.cwd(), 'src/assets/og-fonts', n)),
|
||||
const fontDir = resolve(process.cwd(), 'src/assets/og-fonts');
|
||||
const fontFiles = ['SpaceGrotesk.ttf', 'Inter.ttf', 'JetBrainsMono.ttf'].map((n) =>
|
||||
resolve(fontDir, n),
|
||||
);
|
||||
|
||||
export function getStaticPaths() {
|
||||
@@ -29,8 +29,7 @@ export function getStaticPaths() {
|
||||
return paths;
|
||||
}
|
||||
|
||||
const esc = (s: string) =>
|
||||
s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
||||
const esc = (s: string) => s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
||||
|
||||
export const GET: APIRoute = ({ props }) => {
|
||||
const { pageId, locale } = props as { pageId: PageId; locale: Locale };
|
||||
@@ -62,12 +61,12 @@ export const GET: APIRoute = ({ props }) => {
|
||||
|
||||
const png = new Resvg(svg, {
|
||||
fitTo: { mode: 'width', value: 1200 },
|
||||
font: { fontBuffers, loadSystemFonts: false, defaultFontFamily: 'Inter' },
|
||||
font: { fontFiles, loadSystemFonts: false, defaultFontFamily: 'Inter' },
|
||||
})
|
||||
.render()
|
||||
.asPng();
|
||||
|
||||
return new Response(png, {
|
||||
return new Response(new Uint8Array(png), {
|
||||
headers: {
|
||||
'Content-Type': 'image/png',
|
||||
'Cache-Control': 'public, max-age=31536000, immutable',
|
||||
|
||||
Reference in New Issue
Block a user