* fix(invoice-inbox): switch from pdfjs-dist to unpdf for PDF text extraction
After three rounds of fighting pdfjs on Vercel (#407 stubbed DOM globals,
#408 tried to ship the worker file via outputFileTracingIncludes), text
extraction still failed in prod with "Setting up fake worker failed" —
Next's tracer can't reliably include pdfjs-dist's worker file when the
package is marked as a server external.
unpdf is a serverless-first wrapper around pdfjs (by unjs) that ships its
own bundled pdfjs build with no canvas/worker dependencies. Drop-in
replacement: extractText returns merged page text directly.
- Remove DOM stubs, serverExternalPackages, outputFileTracingIncludes
- Replace pdfjs-dist with unpdf (no transitive deps)
- Update test mock from getDocument → extractText
All 45 invoice-inbox unit tests pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(invoice-inbox): make unpdf import static, rename pdfjs test labels
Per Greptile review on #409:
1. CRITICAL: tryExtractPdfText was still using await import('unpdf'), a
dynamic import. CLAUDE.md forbids dynamic imports in extensions
precisely because Next.js bundling can't reliably trace them — which
is the same class of failure that caused the pdfjs prod bug. unpdf
bundles statically (no canvas/worker), so a top-level static import
is safe and correct.
2. NIT: two test descriptions still said "pdfjs" after the mock rename.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>