Skip to content

v2.8.46

Choose a tag to compare

@gildas-lormeau gildas-lormeau released this 13 Aug 12:20
· 19 commits to master since this release

What's Changed in v2.8.46

New features

  • New createWorker option in configure() to create the web workers, taking precedence over workerURI. It enables the standard bundler pattern new Worker(new URL("./zip-worker.js", import.meta.url), { type: "module" }), letting bundlers like webpack and Vite detect the worker script statically and compile it with its imports into a separate asset
  • New initWorker() function exposed by the new @zip.js/zip.js/worker entry point to write custom worker scripts. It can register alternative implementations of CompressionStream/DecompressionStream used to compress/decompress data, e.g. based on fflate, and an init hook called with the configuration, e.g. to load a WebAssembly module. The API reference of initWorker() includes a complete example based on fflate. Existing custom worker scripts relying on the initModule convention keep working
  • New @zip.js/zip.js/lib/zip-core-custom.js entry point offering the full API without embedding any web worker code or deflate implementation. Combined with createWorker and a custom worker script, the compression engine of your choice ships only once, in the worker script
  • New CompressionStreamFallback and DecompressionStreamFallback options in configure() replacing the deprecated CompressionStreamZlib and DecompressionStreamZlib options. The new names reflect the role of these implementations: the fallback used when useCompressionStream is set to false or when the Compression Streams API is unavailable

Other changes

  • New section in the documentation covering custom web workers and compression engines: https://gildas-lormeau.github.io/zip.js/#custom-workers
  • The files embedding the web worker code and the WebAssembly module are now generated with rollup plugins instead of placeholder replacements, and the development and release build configurations have been merged

Full Changelog: v2.8.45...v2.8.46