Skip to content

v0.4.0

Latest

Choose a tag to compare

@fayazara fayazara released this 11 Jul 08:55

Fixed

  • Fixed qpdf's wasm glue misdetecting the Cloudflare Workers runtime as Node.js when the nodejs_compat compatibility flag is enabled.

    The Emscripten-generated glue picks its code path via globalThis.process?.versions?.node. nodejs_compat polyfills process for compatibility with npm packages that expect it, which made the glue falsely take the Node.js branch. That branch calls createRequire(import.meta.url), which throws in a bundled Worker since there's no real file: URL to resolve — breaking every unlock/lock/merge/etc. call on Workers with nodejs_compat on (the majority of real-world Workers apps).

    Now detects the Workers runtime via navigator.userAgent === 'Cloudflare-Workers' (stable regardless of nodejs_compat, and never present in real Node.js) and hides process only for the duration of the one call that does the misdetection, restoring it immediately after. No API changes; real Node.js and browser usage are unaffected.