@formepdf/next 0.9.2 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +6 -9
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -3,18 +3,15 @@ let _renderDocument = null;
3
3
  async function getRenderDocument() {
4
4
  if (_renderDocument)
5
5
  return _renderDocument;
6
- // Check if we can resolve file paths — Workers with nodejs_compat provide
7
- // process.versions.node but import.meta.url is undefined, so the Node
8
- // entry's fileURLToPath() call crashes. This detects the actual capability.
6
+ // Workers with nodejs_compat expose process.versions.node, but their
7
+ // import.meta.url isn't a file:// URL — the Node entry's fileURLToPath()
8
+ // would crash. Branch on the actual capability we need.
9
9
  const isEdge = typeof import.meta.url !== 'string' || !import.meta.url.startsWith('file://');
10
10
  if (isEdge) {
11
+ // The browser entry is backed by wasm-pack --target bundler, so the
12
+ // bundler (Next.js/webpack, Turbopack, wrangler/esbuild) wires the
13
+ // .wasm in implicitly at module load. No manual init needed.
11
14
  const browser = await import('@formepdf/core/browser');
12
- // In edge runtimes, import.meta.url doesn't resolve to a valid URL so
13
- // the default WASM loader fails. Import the .wasm file directly —
14
- // bundlers (Next.js/webpack, wrangler/esbuild) resolve this to a
15
- // WebAssembly.Module.
16
- const wasm = await import('@formepdf/core/pkg/forme_bg.wasm');
17
- await browser.init(wasm.default ?? wasm);
18
15
  _renderDocument = browser.renderDocument;
19
16
  }
20
17
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formepdf/next",
3
- "version": "0.9.2",
3
+ "version": "0.10.0",
4
4
  "description": "PDF route handlers and responses for Next.js App Router",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -13,9 +13,9 @@
13
13
  "dist"
14
14
  ],
15
15
  "dependencies": {
16
- "@formepdf/react": "0.9.2",
17
- "@formepdf/core": "0.9.2",
18
- "@formepdf/templates": "0.9.2"
16
+ "@formepdf/react": "0.10.0",
17
+ "@formepdf/core": "0.10.0",
18
+ "@formepdf/templates": "0.10.0"
19
19
  },
20
20
  "peerDependencies": {
21
21
  "next": ">=14.0.0"