- Update to newer APIs.
- Avoid manual pixel-by-pixel copy in favour of decoding directly to desired format & bit depth.
- Avoid use-after-free by cloning the Uint8Array Wasm memory view into a JS-owned Uint8Array right away.
Porting over few more improvements from #777 that can be applied to HQX despite the older Rust version:
- Removed Cargo.lock from .gitignore (the file itself was added in the original PR, but is still ignored and wouldn't get committed on changes).
- Removed couple of stray .DS_Store accidentally added in that PR.
- Added a `--locked` to `wasm-pack` build to make sure we rebuild HQX with the same versions from Cargo.lock.
- Removed separate `wasm-strip` and `wasm-opt -Os` steps from build.sh in HQX because they're already included in wasm-pack, and running twice only makes build slower.
Use a shared base image with fixed Emscripten version, autotools and optimisation flags for all C++ codecs.
Additionally, move build commands for codecs themselves to Makefile - they're already platform-specific, and Make allows for better caching and parallelisation that custom ad-hoc scripts.
This is essentially same as #777 but for C++.
It's not possible to share them across threads, so in case we decide to use multithreading in the future, it's best to mark them as thread_local right away, even if it's a no-op right now.
This consolidates Rust build process for various codecs into a single top-level image that is built once and reused.
This ensures that we use same version of tools across codecs (now controlled from a single place), simplifies build configs and commands, speeds up common builds and reduces disk space taken by Docker images by reusing same one.
Additionally, this PR renames all codecs to squoosh-* to work around the https://github.com/rustwasm/wasm-pack/issues/829 (which has been already fixed on master of wasm-pack but not released in a while), as well as adds `publish = false` to Cargo.toml to avoid accidental publishing for now.
I'm planning to do similar for Emscripten in a separate PR, although abilities to share configs there are much more limited due to lack of package manager in C++.