fullbleed 0.1.2 → 0.1.3

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/README.md CHANGED
@@ -5,8 +5,9 @@ Fullbleed Rust engine compiled to WebAssembly and four font faces, so installing
5
5
  it does not require Python, Rust, a browser, or system fonts. MIT licensed.
6
6
 
7
7
  This is an optional integration around the unchanged **Fullbleed 2.5.6** engine.
8
- The Node package has its own version, **0.1.2**. This patch keeps synthesized-bold
9
- headings searchable once instead of exposing duplicate text to PDF readers.
8
+ The Node package has its own version, **0.1.3**. Render promises now wait for their
9
+ worker to exit, including after errors, timeouts, and cancellation, so sequential
10
+ calls do not overlap worker lifetimes.
10
11
 
11
12
  ## Install and render
12
13
 
@@ -16,9 +17,9 @@ Use Node.js 22 or newer. Install the [npm package](https://www.npmjs.com/package
16
17
  npm install fullbleed
17
18
  ```
18
19
 
19
- For a version-pinned installation, use `npm install --save-exact fullbleed@0.1.2`.
20
+ For a version-pinned installation, use `npm install --save-exact fullbleed@0.1.3`.
20
21
  The npm tarball is byte-identical to the verified
21
- [GitHub release](https://github.com/fullbleed-engine/fullbleed-node/releases/tag/v0.1.2).
22
+ [GitHub release](https://github.com/fullbleed-engine/fullbleed-node/releases/tag/v0.1.3).
22
23
  See the [installation verification records](https://github.com/fullbleed-engine/fullbleed-node/tree/main/verification).
23
24
 
24
25
  Save this as `invoice.mjs` and run `node invoice.mjs`:
@@ -121,7 +122,12 @@ native engine.
121
122
  | `allowMissingGlyphs` | Default `false`: reject engine-reported missing glyphs. |
122
123
 
123
124
  Rendering runs in a dedicated worker. Concurrent calls use separate workers and
124
- document state. Bound concurrency in a server according to its available memory;
125
+ document state. The returned promise waits for that worker to exit on success,
126
+ render failure, timeout, or cancellation. Awaiting jobs in sequence therefore
127
+ does not overlap their worker lifetimes. A timeout or abort starts termination;
128
+ settlement includes the time needed to stop the worker.
129
+
130
+ Bound concurrency in a server according to its available memory;
125
131
  each worker's WebAssembly memory has a 512 MiB ceiling. HTML and CSS together are
126
132
  limited to 4,000,000 UTF-8 bytes; supplied fonts and assets together to 64 MiB.
127
133
  Preview images can use substantially more memory than PDF-only rendering.
package/dist/build.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "packageVersion": "0.1.2",
2
+ "packageVersion": "0.1.3",
3
3
  "engineVersion": "2.5.6",
4
4
  "engineSource": "https://crates.io/crates/fullbleed/2.5.6",
5
5
  "target": "wasm32-wasip1",
@@ -45,7 +45,7 @@
45
45
  "files": {
46
46
  "dist/engine.wasm": {
47
47
  "bytes": 5053312,
48
- "sha256": "2e9c27d67f21483df2e9e63414346eb01170ae5a8ba4a04f48c0a7d647a577a6"
48
+ "sha256": "20bc142538c5acf826b162531ed57541d410b033e3666a827934b89ef2fc84cb"
49
49
  },
50
50
  "dist/THIRD_PARTY_NOTICES.txt": {
51
51
  "bytes": 57660,
package/dist/engine.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fullbleed",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Generate PDFs from HTML and CSS in Node.js with the Fullbleed Rust engine, bundled fonts, and optional PNG previews.",
5
5
  "type": "module",
6
6
  "main": "./src/index.cjs",
package/src/index.cjs CHANGED
@@ -87,13 +87,20 @@ async function renderPdf(options) {
87
87
  if (remaining <= 0) throw new FullbleedError('TIMEOUT', `PDF rendering exceeded ${job.timeoutMs} ms.`);
88
88
  return new Promise((resolve, reject) => {
89
89
  let worker, timer, settled = false;
90
- const finish = (error, result) => {
90
+ const finish = async (error, result) => {
91
91
  if (settled) return;
92
92
  settled = true;
93
93
  clearTimeout(timer);
94
94
  job.signal?.removeEventListener('abort', abort);
95
- const termination = worker?.terminate();
96
- if (termination) termination.catch(() => {});
95
+ // A process 'worker' listener can abort synchronously inside the Worker
96
+ // constructor. Let that constructor assign its handle before cleanup.
97
+ await Promise.resolve();
98
+ try {
99
+ await worker?.terminate();
100
+ } catch (cause) {
101
+ reject(new FullbleedError('WORKER_FAILED', 'Could not stop the rendering worker.', { cause }));
102
+ return;
103
+ }
97
104
  if (error) reject(error); else resolve(result);
98
105
  };
99
106
  const abort = () => finish(aborted());