Thanks for the info, I dig into the quickjs-ng stuffs in debian and found out: quickjs-ng does ship wasm, but those builds are WASI/command-line ones: they let the host run a script, not the stateful embedding with a host callback bridge that pdf.js' sandbox is built around. The difference sits in the module's import and export tables, which are fixed at compile time, so no JavaScript wrapper can add it. Serving pdf.js therefore means compiling the engine sources with Emscripten — which is what this package does.
But it also reminds me to build against qjs-src instead of including another copy of source, so the package is now just the pdf.js wrapper and the interpreter sources stay in the archive in one place. On Tue, Sep 29, 2026 at 12:13 AM Jérémy Lal <[email protected]> wrote: > > Hello, just un case, quickjs-ng could distribute a wasm build of itself > > Le lun. 28 sept. 2026, 18:06, Wei Zhou <[email protected]> a écrit : >> >> Package: wnpp >> Severity: wishlist >> Owner: Emfox Zhou <[email protected]> >> X-Debbugs-Cc: [email protected] >> >> * Package name : pdfjs-quickjs >> Version : 0.0~git<date> >> Upstream Author : Mozilla Foundation >> * URL : https://github.com/mozilla/pdf.js.quickjs >> * License : MIT >> Programming Lang: C (compiled to WebAssembly), JavaScript >> Description : QuickJS sandbox for pdf.js, compiled to WebAssembly >> >> QuickJS, compiled to WebAssembly, providing the sandboxed JavaScript >> interpreter pdf.js uses to run the JavaScript embedded in PDF files (form >> scripts and similar). >> >> I need it as a build-dependency of the zotero-reader package I am working >> on. It is not zotero specific: it is a general embedded JavaScript engine >> compiled to WebAssembly. >> >> The build runs upstream's compile.sh (emcc on top of bellard/quickjs, pinned >> in the Dockerfile); the Docker step only provides the emsdk environment, so >> it is an emcc invocation plus a small patch upstream carries. Upstream >> publishes only the built .wasm and pins no toolchain version, so the module >> is not byte-identical to the published one; as with pdfjs-qcms, >> debian/README.source will document the comparison used instead. >> >> I intend to package the sibling modules (pdf.js.openjpeg, pdf.js.jbig2) the >> same way. pdfjs-qcms is already ITP'd as #1149220. >> >> Thanks, >> Emfox >>

