diff --git a/.gitattributes b/.gitattributes index 7be2fd5..bd00cd4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -6,3 +6,6 @@ test/fixtures/radial-gradient-endpoints-2.5.43.json -text assets/fonts/*-OFL.txt -whitespace test/fonts/*-OFL.txt -whitespace + +# Keep build, release, and verification tooling out of language statistics. +tools/** -linguist-detectable diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 33ea76d..5cdd94f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -175,6 +175,7 @@ jobs: output/pack-verification/verification.json output/pack-verification/text-extraction.json output/pack-verification/queue-tests.log + output/pack-verification/startup-cancellation.log output/pack-verification/default-styles-tests.log output/pack-verification/named-fonts-tests.log output/pack-verification/named-fonts/ @@ -343,6 +344,7 @@ jobs: path: | output/pack-verification/verification.json output/pack-verification/queue-tests.log + output/pack-verification/startup-cancellation.log output/pack-verification/default-styles-tests.log output/pack-verification/component-tests.log output/pack-verification/batch-tests.log diff --git a/README.md b/README.md index 7ae78c3..e8b1af7 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,12 @@ no Python, Rust compiler, browser, or system fonts. MIT licensed. Use `fullbleed` in Node.js, `fullbleed/browser` in a web application, or [`fullbleed/cloudflare`](docs/cloudflare.md) inside a Cloudflare Worker. -Package **0.9.4** wraps the published **Fullbleed 2.5.51** engine. +Package **0.9.5** wraps the published **Fullbleed 2.5.51** engine. -A winning `font-family` declaration now replaces an earlier variable-based +This release fixes a Windows worker-startup cancellation race. Aborted renders +release their worker before the queue starts the next render. + +A winning `font-family` declaration replaces an earlier variable-based family. If its variable cannot resolve, the text inherits its parent family instead of reviving a declaration that lost the cascade. diff --git a/docs/render-queue.md b/docs/render-queue.md index 24a65a4..bb5291e 100644 --- a/docs/render-queue.md +++ b/docs/render-queue.md @@ -91,6 +91,10 @@ PDF and preview bytes with standalone rendering. They also exercise overload, FIFO starts, queued and active cancellation, waiting deadlines, input snapshots, render failure, shutdown before and after startup, and recovery after terminating a process-isolated child. CI runs these checks on Node 22, 24 and 26 across Linux, -Windows and macOS. The [release evidence](https://github.com/fullbleed-engine/fullbleed-node/releases) +Windows and macOS. A separate 64-cycle check sweeps cancellation delays after +workers come online, waits for each worker to exit, then compares the next PDF +and preview with an uncancelled baseline. It retains the lifecycle counts and recovery files +in `output/queue-verification/startup-cancellation.json` and `startup-recovery.*`. +The [release evidence](https://github.com/fullbleed-engine/fullbleed-node/releases) retains the observed results and PDF/PNG fixtures; it is not a general throughput or memory-capacity claim. diff --git a/engine/Cargo.lock b/engine/Cargo.lock index aae1110..876b689 100644 --- a/engine/Cargo.lock +++ b/engine/Cargo.lock @@ -15,7 +15,7 @@ dependencies = [ [[package]] name = "fullbleed-node-adapter" -version = "0.9.4" +version = "0.9.5" dependencies = [ "fullbleed", "serde_json", diff --git a/engine/Cargo.toml b/engine/Cargo.toml index 6bd2b33..4c6635c 100644 --- a/engine/Cargo.toml +++ b/engine/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fullbleed-node-adapter" -version = "0.9.4" +version = "0.9.5" edition = "2024" license = "MIT" publish = false diff --git a/examples/cloudflare/package.json b/examples/cloudflare/package.json index 098b969..d1c0252 100644 --- a/examples/cloudflare/package.json +++ b/examples/cloudflare/package.json @@ -11,6 +11,6 @@ "test": "node --test test/request.test.mjs", "test:worker": "node test/worker.mjs" }, - "dependencies": { "fullbleed": "0.9.4" }, + "dependencies": { "fullbleed": "0.9.5" }, "devDependencies": { "wrangler": "4.151.3" } } diff --git a/package-lock.json b/package-lock.json index e3e4769..11c31a1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "fullbleed", - "version": "0.9.4", + "version": "0.9.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "fullbleed", - "version": "0.9.4", + "version": "0.9.5", "license": "MIT", "dependencies": { "@bjorn3/browser_wasi_shim": "0.4.2" diff --git a/package.json b/package.json index 48be487..d328777 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fullbleed", - "version": "0.9.4", + "version": "0.9.5", "description": "Generate PDFs from HTML/CSS, components or JSX in Node.js, browsers and Cloudflare Workers, with bundled fonts and PNG previews.", "type": "module", "main": "./src/index.cjs", diff --git a/src/worker.js b/src/worker.js index 8176282..94c2dcd 100644 --- a/src/worker.js +++ b/src/worker.js @@ -1,6 +1,10 @@ // SPDX-License-Identifier: MIT import { parentPort, workerData } from 'node:worker_threads'; -import { runEngine } from './engine-runner.js'; +import { runEngineSync } from './engine-runner.js'; -const result = await runEngine(workerData); -parentPort.postMessage(result, result.ok ? [result.pdf.buffer, ...result.previews.map(page => page.buffer)] : []); +// Finish module evaluation before starting CPU-bound work. Cancellation during +// the dynamic import can otherwise leave worker.terminate() pending on Windows. +setImmediate(() => { + const result = runEngineSync(workerData); + parentPort.postMessage(result, result.ok ? [result.pdf.buffer, ...result.previews.map(page => page.buffer)] : []); +}); diff --git a/tools/check-startup-cancellation.mjs b/tools/check-startup-cancellation.mjs new file mode 100644 index 0000000..d2f4766 --- /dev/null +++ b/tools/check-startup-cancellation.mjs @@ -0,0 +1,94 @@ +// SPDX-License-Identifier: MIT +// Exercise the installed package through its public API, including real workers. +import assert from 'node:assert/strict'; +import { createHash } from 'node:crypto'; +import { mkdirSync, writeFileSync } from 'node:fs'; +import { createRequire } from 'node:module'; +import { join, resolve } from 'node:path'; + +const [consumerArg, outputArg] = process.argv.slice(2); +assert(consumerArg && outputArg, 'Use check-startup-cancellation.mjs CONSUMER OUTPUT'); +const output = resolve(outputArg); +mkdirSync(output, { recursive: true }); +const require = createRequire(join(resolve(consumerArg), 'package.json')); +const { createRenderQueue, FullbleedError, version, engineVersion } = require('fullbleed'); +const input = { html: '
Services: USD 1,200.00
', previewDpi: 96 }; +const longInput = { html: '