@formepdf/hono 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.
- package/dist/index.js +6 -8
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -3,17 +3,15 @@ let _renderDocument = null;
|
|
|
3
3
|
async function getRenderDocument() {
|
|
4
4
|
if (_renderDocument)
|
|
5
5
|
return _renderDocument;
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
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 (Wrangler/esbuild, Vite, Next.js/webpack) wires the .wasm
|
|
13
|
+
// in implicitly at module load. No manual init needed.
|
|
11
14
|
const browser = await import('@formepdf/core/browser');
|
|
12
|
-
// In edge runtimes (Cloudflare Workers), import.meta.url doesn't resolve
|
|
13
|
-
// to a valid URL so the default WASM loader fails. Import the .wasm file
|
|
14
|
-
// directly — Wrangler/esbuild resolves this to a WebAssembly.Module.
|
|
15
|
-
const wasm = await import('@formepdf/core/pkg/forme_bg.wasm');
|
|
16
|
-
await browser.init(wasm.default ?? wasm);
|
|
17
15
|
_renderDocument = browser.renderDocument;
|
|
18
16
|
}
|
|
19
17
|
else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formepdf/hono",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "PDF middleware and responses for Hono — works on Workers, Deno, Bun, Node",
|
|
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.
|
|
17
|
-
"@formepdf/core": "0.
|
|
18
|
-
"@formepdf/templates": "0.
|
|
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
|
"hono": ">=4.0.0"
|