SEV-329: @switchev/web-shared package — formatters, markdown, waitForImage

Stands up the shared browser-helpers package (consumed by public/vendor/admin
via the Gitea npm registry) to de-duplicate copy-pasted frontend code:
- format.js: formatLabel/formatStatus/formatTimeline/formatBudget (single source
  of truth — these had drifted, see SEV-310).
- markdown.js: renderMarkdown (marked + strict DOMPurify; both peer deps).
- wait-image.js: waitForImage (was byte-identical in public + vendor).

ESM source package (no build step — Vite consumers import directly). publishConfig
points at the Gitea npm registry. node --test green (formatters).

Next: publish v0.1.0, then migrate each site to consume it and delete the copies.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Bastian de Byl
2026-06-09 09:42:38 -04:00
parent cb1d8ff661
commit 137086109c
6 changed files with 154 additions and 4 deletions
+5
View File
@@ -0,0 +1,5 @@
// @switchev/web-shared — shared browser helpers for the public/vendor/admin
// SwitchEV frontends. SEV-329.
export { formatLabel, formatStatus, formatTimeline, formatBudget } from './format.js';
export { renderMarkdown } from './markdown.js';
export { waitForImage } from './wait-image.js';