Skip to content

v0.10.1

Choose a tag to compare

@danmolitor danmolitor released this 20 May 12:55
· 41 commits to main since this release

Forme 0.10.1

Patch release fixing two regressions introduced in 0.10.0. No engine or rendering changes — existing PDFs render identically.


Fixed

Cloudflare Workers crash on import

@formepdf/core@0.10.0 called wasm.__wbindgen_start() at the top level of the bundler-target build. Wrangler passes import wasm from '*.wasm' back as { default: WebAssembly.Module } rather than an instantiated namespace, so this threw immediately:

TypeError: wasm.__wbindgen_start is not a function

Fixed by shipping a third build (--target webpkg-web/) and a new dist/worker.js entry that takes an explicit init(wasmModule) call. The worker / edge-light / deno conditional exports now route here. Your 0.9.x pattern works again:

import { init, renderDocument } from '@formepdf/core'
import wasm from '@formepdf/core/pkg-web/forme_bg.wasm'  // recommended
// or:
import wasm from '@formepdf/core/pkg/forme_bg.wasm'      // legacy, also works
await init(wasm)

Missing pkg-node/ in the published tarball

wasm-pack's --target nodejs output ships with a .gitignore containing *. npm publish honored it and silently dropped the entire directory. The 0.10.0 Node entry tried to import from ../pkg-node/forme.js, which wasn't there:

Cannot find module '../pkg-node/forme.js' from
'node_modules/@formepdf/core/dist/index.js'

Fixed by stripping .gitignore from all three pkg dirs during the WASM build, and adding a prepublishOnly assertion that re-packs the tarball and fails if anything required is missing.

VS Code extension build path mismatch

The bundled extension read ${__dirname}/forme_bg.wasm but the esbuild config still copied the WASM to the old pkg/ location. Now copies to dist/forme_bg.wasm. Only affected fresh 0.10.x rebuilds of the extension.


Added

  • @formepdf/core/worker subpath export
  • @formepdf/core/pkg-web/forme.js and @formepdf/core/pkg-web/forme_bg.wasm subpath exports
  • packages/core/scripts/assert-tarball.sh — runs as prepublishOnly and on every CI PR. Asserts every entry-point file is present in the tarball and that no pkg dir ships a stray .gitignore. Would have caught both regressions above at PR time.
  • Workerd smoke test (@cloudflare/vitest-pool-workers) under npm run test:workers. Runs inside real workerd, calls init(wasm) + renderPdf(), and verifies the result has a %PDF header. Catches the exact regression class that Node-based unit tests can't see.

Migration

You don't need to change anything. Existing 0.10.0 code works on 0.10.1.

If you're on Cloudflare Workers and were hitting the __wbindgen_start crash, upgrade to 0.10.1 — the import + init() pattern from 0.9.x is restored. pkg-web/forme_bg.wasm is recommended over pkg/forme_bg.wasm for new Workers code, but the legacy path still works.


Packages updated

Package Reason
@formepdf/core The fix
@formepdf/renderer, @formepdf/cli, @formepdf/hono, @formepdf/next, @formepdf/mcp, @formepdf/resend Updated to pull the core fix transitively
@formepdf/react, @formepdf/sdk, @formepdf/tailwind, @formepdf/templates Version parity bump only — no code changes
VS Code extension Build config fix for new core layout

Not changed: Rust engine (same WASM bytecode across all three targets), Rust crate, Python SDK, Go SDK, Docker images, rasterizer — all still on 0.10.0.