Files
news-platform/bridge/package.json
T
tiago-neves 657e1c3bde
Tests / writer-pipeline tests (push) Successful in 1m30s
Tests / frontend lib tests (pull_request) Successful in 1m22s
Tests / bridge tests (push) Successful in 1m30s
Tests / frontend lib tests (push) Successful in 1m30s
Tests / bridge tests (pull_request) Successful in 1m23s
Tests / writer-pipeline tests (pull_request) Successful in 1m23s
fix(perf): BIT-28145 follow-up — wire sanitizer tests into npm test, defer non-critical scripts
Post-merge Lighthouse re-verification of PR #47 confirmed article TBT
regression is resolved (7416ms -> 0-348ms, Performance 60 -> 99 median,
5 runs, results in PERFORMANCE_BASELINE.md). This follow-up closes a
gap found during that verification and widens the pass margin:

- bridge/package.json: sanitize-html.test.ts (added in the original
  fix) was never wired into the test/test:coverage scripts, so the
  "28 bridge sanitizer tests pass" claim wasn't actually exercised by
  npm test. Fixed.
- Defer mobile-menu and share-button click handlers to
  requestIdleCallback (institutional/sports headers, ArticleShareBar)
  so they don't compete with hydration-critical work.
- Split Base.astro's theme-flash-prevention script into a minimal
  inline snippet (runs before paint) and the deferred click-handler
  logic, instead of one blocking script.
- bridge articles route: /articles/:slug/related accepts an optional
  ?category_id= to skip a redundant WP post-by-slug fetch when the
  caller already has it.

Paperclip-Agent: Miguel Teixeira (urlKey miguel-teixeira; id 0f722e1a-bc3e-4381-8d98-76fa3c7aea10)
Paperclip-Issue: BIT-28145
2026-08-07 10:20:04 +01:00

28 lines
1.0 KiB
JSON

{
"name": "news-bridge",
"version": "1.0.0",
"description": "WordPress REST API bridge for the news platform",
"type": "module",
"main": "dist/server.js",
"scripts": {
"dev": "tsx watch src/server.ts",
"build": "tsc",
"start": "node dist/server.js",
"typecheck": "tsc --noEmit",
"test": "npm run build && node --test dist/lib/sanitize-html.test.js dist/services/ranking.test.js dist/services/aggregator-mapper.test.js dist/services/andeboltv.test.js dist/services/fpa-stream-match.test.js",
"test:coverage": "npm run build && node --experimental-test-coverage --test dist/lib/sanitize-html.test.js dist/services/ranking.test.js dist/services/aggregator-mapper.test.js dist/services/andeboltv.test.js dist/services/fpa-stream-match.test.js"
},
"dependencies": {
"@fastify/cors": "^9.0.1",
"@fastify/rate-limit": "^9.1.0",
"fastify": "^4.28.1",
"ioredis": "^5.4.1"
},
"devDependencies": {
"@types/node": "^20.14.0",
"pino-pretty": "^13.1.3",
"tsx": "^4.15.0",
"typescript": "^5.4.5"
}
}