Skip to content

fix(forme): move consumers to Forme 0.32 and load the engine on first render - #9

Merged
aFlamee merged 2 commits into
developfrom
fix/production-ready-forme
Nov 20, 2026
Merged

aFlamee merged 2 commits into
developfrom
fix/production-ready-forme

Conversation

@aFlamee

@aFlamee aFlamee commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

A consumer app rendering one A4 document in the browser found the Forme base not ready for production. Consumers were stuck on Forme 0.25.x. The documented browser setup downloaded the 7 MB engine on every page load. Installed files had no license notice. Some blocks pulled in components they never use.

What changes

  • Forme 0.32. The registry said @formepdf/core@^0.25.0, which in 0.x semver never leaves 0.25.x. Consumers now get ^0.32.0 (kerning fixes, tall table rows that split instead of leaving the page empty, quick-xml security fix). The engine is declared once, on forme/utils, which every Forme item reaches. @formepdf/shared is declared on the two items whose files import it. Parity is unchanged at 88/88, so no fixture was regenerated.
  • Load on demand. The browser snippets now create the worker and import the document on first render, not at app start. A worker that fails to load rejects the render instead of hanging it. The Forme font snippet passes a theme that names the registered font. The Forme snippet adds externalDependencies: ["@formepdf/react"], so ng build drops a React chunk that nothing loads.
  • License notice. Every installed file ends with one attribution line naming the copyright holders and linking LICENSE. shadcn add strips every leading comment (//, /* */, /*! */, @license all tested), so the notice goes last. install:check asserts it arrives. The docs' manual-install code shows the same line.
  • Install closures. Four registry dependencies that no file imports are gone: Forme and Takumi event-agenda, and Takumi gift-certificate. All four were inherited from pdfcn. build-registry.ts now fails when an item declares one no file imports. It compares source paths, because both bases share install targets such as lib/utils.ts.
  • keep-together docs. They now say that content taller than the remaining space starts on the next page, and that text taller than a page still splits. They also say that Forme ignores minPresenceAhead.

React stays in consumer lockfiles. @formepdf/core 0.32 still has a hard dependency on @formepdf/react and a peer dependency on react, so only Forme upstream can fix that.

Numbers

Fresh ng new app with forme/invoice-classic, using the documented worker setup:

Before After
Engine 0.25.0 0.32.0
Initial main bundle 311.82 kB 223.87 kB (bare app 218.05 kB)
WASM download 6.86 MB at app start 7.57 MB on first render
React chunk in the worker bundle 83.5 kB plus a CommonJS warning none
Rendered invoice PDF 24,320 B 20,531 B
pnpm why react react@19.3.1 via @formepdf/core@0.25.0 react@19.3.1 via @formepdf/core@0.32.0 (upstream)

Council design

Claude Opus 5.5, GPT-6.2 Sol, and Gemini 4 Neon each reviewed the evidence and the candidate fixes, read-only. An earlier Gemini 4 Argon run was discarded because the owner's rule allows only Neon for the Gemini seat.

  • Bump to ^0.32.0. All agreed.
  • Engine declaration. @formepdf/core goes on forme/utils only. Opus and Neon agreed. Sol wanted it dropped from the registry entirely. Declined, because every consumer that renders needs it, so the lockfile is the same and the install gets an extra manual step.
  • Lazy docs and externalDependencies. All agreed. Neon also wanted to document a pnpm override. Declined, because npm, Angular's default, cannot remove a dependency.
  • License notice. One short notice per file linking LICENSE. Sol wanted the full MIT text in every file, and Argon wanted none. The owner chose a short line.
  • Install check. It does not build the documented worker path. Sol and Neon wanted it to. Opus and the owner said no, because the snippet would drift from the docs. The worker path was built by hand on 0.32 instead.
  • Stale dependencies. Remove the four and add the reverse check. All agreed.
  • Left out. Card's wrap default, minPresenceAhead behavior, page-footer variants, font tooling, and Takumi package declarations. These keep pdfcn parity or are the consumer's choice.
Delegate Round 1
Claude Opus no score
GPT Sol no score
Gemini 4 Neon no score

Proof: pnpm verify passes all six steps, including the install check into fresh ng new apps. Re-adding a stale dependency, or declaring a cross-base one, makes the registry build fail. The documented lazy worker setup was built by hand on 0.32 in a fresh app. In headless Chromium, the worker snippet rejects renders against a missing worker script, where the old one hung. The font snippet renders ≥ → ✓ with Noto Sans and no ?.

Reviewed with sol-loop: 3 rounds with GPT-6.2 Sol. Sol verdict: approved

Review fixes reviewed with sol-loop: 1 round with GPT-6.2 Sol on high. Sol verdict: approved

Created with Claude Opus 5.5 in Claude Code (T3 Code).

🤖 Generated with Claude Code

… render

The registry pinned @formepdf/core to ^0.25.0, which keeps consumers on
0.25.x. Bump to ^0.32.0 and declare the engine once, on forme/utils.

The browser docs started the worker and fetched the WASM on every app
load. Create the worker and import the document on first render, and
mark @formepdf/react external so ng build drops a chunk nothing loads.

Installed files now end with an MIT notice. shadcn add strips leading
comments, so the notice goes last. build-registry fails on registry
dependencies that no file imports, and four stale ones are removed.

The keep-together docs say what happens to content taller than the
remaining page and that Forme ignores minPresenceAhead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
pdfcn-angular Ready Ready Preview Nov 20, 2026 2:48pm UTC

@aFlamee aFlamee left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

🤖 Claude Opus 5.5 responding on behalf of aFlamee

The architecture holds up. @formepdf/core declared once on forme/utils reaches every renderable Forme item. The lazy worker and document imports are correct. externalDependencies: ["@formepdf/react"] is safe because the documented worker calls renderSerializedDoc, which never imports React in 0.32. Rendering all 44 Forme fixtures on 0.25 and 0.32 gave identical page counts.

One should needs fixing before merge: the font snippet no longer passes the theme, so the registered font is never used. The other comments are nits.

Council scores: Opus 7/10, GPT Sol 7/10, Gemini Neon 7/10. Sol-loop ran 2 rounds.

Comment thread apps/web/lib/install.ts Resolved
Comment thread apps/web/scripts/build-registry.ts Resolved
…orker fails

Address the review on #9. The Forme font snippet passes a theme that names
Noto Sans again. Both worker snippets reject when the worker fails to load
instead of hanging. The registry's reverse dependency check compares source
paths, so a cross-base dependency fails. The license line is called an
attribution line, and keep-together says only text splits across pages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aFlamee
aFlamee merged commit 030eb37 into develop Nov 20, 2026
3 checks passed
@aFlamee
aFlamee deleted the fix/production-ready-forme branch November 20, 2026 14:49
aFlamee added a commit that referenced this pull request Nov 20, 2026
…orker fails

Address the review on #9. The Forme font snippet passes a theme that names
Noto Sans again. Both worker snippets reject when the worker fails to load
instead of hanging. The registry's reverse dependency check compares source
paths, so a cross-base dependency fails. The license line is called an
attribution line, and keep-together says only text splits across pages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant