diff --git a/codecs/oxipng/Cargo.lock b/codecs/oxipng/Cargo.lock index d64162ae7..7b304a0c1 100644 --- a/codecs/oxipng/Cargo.lock +++ b/codecs/oxipng/Cargo.lock @@ -2,18 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "adler" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e" - -[[package]] -name = "adler32" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" - [[package]] name = "autocfg" version = "1.0.1" @@ -21,22 +9,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] -name = "bit-vec" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" - -[[package]] -name = "bitflags" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" - -[[package]] -name = "build_const" -version = "0.2.1" +name = "bitvec" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39092a32794787acd8525ee150305ff051b0aa6cc2abaf193924f5ab05425f39" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] [[package]] name = "bumpalo" @@ -46,15 +28,9 @@ checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" [[package]] name = "bytemuck" -version = "1.4.1" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41aa2ec95ca3b5c54cf73c91acf06d24f4495d5f1b1c12506ae3483d646177ac" - -[[package]] -name = "byteorder" -version = "1.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" +checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" [[package]] name = "cc" @@ -62,120 +38,51 @@ version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c0496836a84f8d0495758516b8621a622beb77c0fed418570e50764093ced48" -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "cloudflare-zlib" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5ed63a019d55bacd15cadcbcb96bf41b16281417fff393bdb55fa84255fe4b9" -dependencies = [ - "cloudflare-zlib-sys", -] - -[[package]] -name = "cloudflare-zlib-sys" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e195cb274a0d6ee87e718838a09baecd7cbc9f6075dac256a84cb5842739c06" -dependencies = [ - "cc", -] - -[[package]] -name = "color_quant" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" - -[[package]] -name = "const_fn" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28b9d6de7f49e22cf97ad17fc4036ece69300032f45f78f30b4a4482cdc3f4a6" - -[[package]] -name = "crc" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb" -dependencies = [ - "build_const", -] - -[[package]] -name = "crc32fast" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a" -dependencies = [ - "cfg-if 1.0.0", -] - [[package]] name = "crossbeam-channel" -version = "0.5.0" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" +checksum = "82a9b73a36529d9c47029b9fb3a6f0ea3cc916a261195352ba19e770fc1748b2" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crossbeam-utils", ] [[package]] name = "crossbeam-deque" -version = "0.8.0" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" +checksum = "fca89a0e215bab21874660c67903c5f143333cab1da83d041c7ded6053774751" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" -version = "0.9.1" +version = "0.9.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1aaa739f95311c2c7887a76863f500026092fb1dce0161dab577e559ef3569d" +checksum = "0e3681d554572a651dda4186cd47240627c3d0114d45a95f6ad27f2f22e7548d" dependencies = [ - "cfg-if 1.0.0", - "const_fn", + "autocfg", + "cfg-if", "crossbeam-utils", - "lazy_static", - "memoffset", - "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.1" +version = "0.8.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02d96d1e189ef58269ebe5b97953da3274d83a93af647c2ddd6f9dab28cedb8d" +checksum = "c3a430a770ebd84726f584a90ee7f020d28db52c6d02138900f22341f866d39c" dependencies = [ - "autocfg", - "cfg-if 1.0.0", - "lazy_static", -] - -[[package]] -name = "deflate" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73770f8e1fe7d64df17ca66ad28994a0a623ea497fa69486e14984e715c5d174" -dependencies = [ - "adler32", - "byteorder", + "cfg-if", ] [[package]] @@ -185,55 +92,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] -name = "hashbrown" -version = "0.9.1" +name = "equivalent" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] -name = "hermit-abi" -version = "0.1.17" +name = "funty" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8" -dependencies = [ - "libc", -] +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] -name = "image" -version = "0.23.12" +name = "hashbrown" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ce04077ead78e39ae8610ad26216aed811996b043d47beed5090db674f9e9b5" -dependencies = [ - "bytemuck", - "byteorder", - "color_quant", - "num-iter", - "num-rational", - "num-traits", - "png", -] +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" [[package]] name = "indexmap" -version = "1.6.1" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb1fa934250de4de8aef298d81c729a7d33d8c239daa3a7575e6b92bfc7313b" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" dependencies = [ - "autocfg", + "equivalent", "hashbrown", "rayon", ] -[[package]] -name = "itertools" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319" -dependencies = [ - "either", -] - [[package]] name = "js-sys" version = "0.3.48" @@ -249,161 +135,47 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -[[package]] -name = "libc" -version = "0.2.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1482821306169ec4d07f6aca392a4681f66c75c9918aa49641a2595db64053cb" - [[package]] name = "libdeflate-sys" -version = "0.7.1" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a95fa4be7085dd06a8296dcc3f399f12ab8b0309c157dcaa90669130b175b97" +checksum = "67921a7f85100c1559efc3d1c7c472091b7da05f304b4bbd5356f075e97f1cc2" dependencies = [ "cc", ] [[package]] name = "libdeflater" -version = "0.7.1" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccc147465654929bf7b56518cc46d11701ba290f4ff94398ae3f89f1663cf60f" +checksum = "3a31b22f662350ec294b13859f935aea772ba7b2bc8776269f4a5627308eab7d" dependencies = [ "libdeflate-sys", ] [[package]] name = "log" -version = "0.4.11" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" -dependencies = [ - "cfg-if 0.1.10", -] - -[[package]] -name = "memoffset" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87" -dependencies = [ - "autocfg", -] - -[[package]] -name = "miniz_oxide" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "791daaae1ed6889560f8c4359194f56648355540573244a5448a83ba1ecc7435" -dependencies = [ - "adler32", -] - -[[package]] -name = "miniz_oxide" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f2d26ec3309788e423cfbf68ad1800f061638098d76a83681af979dc4eda19d" -dependencies = [ - "adler", - "autocfg", -] - -[[package]] -name = "num-integer" -version = "0.1.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" -dependencies = [ - "autocfg", - "num-traits", -] - -[[package]] -name = "num-iter" -version = "0.1.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2021c8337a54d21aca0d59a92577a029af9431cb59b909b03252b9c164fad59" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_cpus" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" -dependencies = [ - "hermit-abi", - "libc", -] +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "oxipng" -version = "4.0.3" +version = "9.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d0b53912a666fe2970f8ab254e283531c816aed16551ab66c52485eadb44e6" +checksum = "28e5c341ef78a228e47a551bfd15ff885d8c501af49f953358763a538c01f14d" dependencies = [ - "bit-vec", - "byteorder", - "cloudflare-zlib", - "crc", + "bitvec", "crossbeam-channel", - "image", "indexmap", - "itertools", "libdeflater", "log", - "miniz_oxide 0.4.3", "rayon", "rgb", + "rustc-hash", "rustc_version", ] -[[package]] -name = "pest" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" -dependencies = [ - "ucd-trie", -] - -[[package]] -name = "png" -version = "0.16.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c3287920cb847dee3de33d301c463fba14dda99db24214ddf93f83d3021f4c6" -dependencies = [ - "bitflags", - "crc32fast", - "deflate", - "miniz_oxide 0.3.7", -] - [[package]] name = "proc-macro2" version = "1.0.26" @@ -422,72 +194,61 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + [[package]] name = "rayon" -version = "1.5.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674" +checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" dependencies = [ - "autocfg", - "crossbeam-deque", "either", "rayon-core", ] [[package]] name = "rayon-core" -version = "1.9.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" +checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" dependencies = [ - "crossbeam-channel", "crossbeam-deque", "crossbeam-utils", - "lazy_static", - "num_cpus", ] [[package]] name = "rgb" -version = "0.8.25" +version = "0.8.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "287f3c3f8236abb92d8b7e36797f19159df4b58f0a658cc3fb6dd3004b1f3bd3" +checksum = "05aaa8004b64fd573fc9d002f4e632d51ad4f026c2b5ba95fcb6c2f32c2c47d8" dependencies = [ "bytemuck", ] [[package]] -name = "rustc_version" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65c94201b44764d6d1f7e37c15a8289ed55e546c1762c7f1d57f616966e0c181" -dependencies = [ - "semver", -] - -[[package]] -name = "scopeguard" +name = "rustc-hash" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] -name = "semver" -version = "0.11.0" +name = "rustc_version" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver-parser", + "semver", ] [[package]] -name = "semver-parser" -version = "0.10.2" +name = "semver" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" -dependencies = [ - "pest", -] +checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" [[package]] name = "spmc" @@ -499,7 +260,6 @@ checksum = "02a8428da277a8e3a15271d79943e80ccc2ef254e78813a166a08d65e4c3ece5" name = "squoosh-oxipng" version = "0.1.0" dependencies = [ - "libdeflater", "log", "oxipng", "wasm-bindgen", @@ -518,10 +278,10 @@ dependencies = [ ] [[package]] -name = "ucd-trie" -version = "0.1.3" +name = "tap" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "unicode-xid" @@ -535,7 +295,7 @@ version = "0.2.74" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d54ee1d4ed486f78874278e63e4069fc1ab9f6a18ca492076ffb90c5eb2997fd" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "wasm-bindgen-macro", ] @@ -594,3 +354,12 @@ name = "wasm-bindgen-shared" version = "0.2.74" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7cff876b8f18eed75a66cf49b65e7f967cb354a7aa16003fb55dbfd25b44b4f" + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] diff --git a/codecs/oxipng/Cargo.toml b/codecs/oxipng/Cargo.toml index 32b6ca1c0..8951fe788 100644 --- a/codecs/oxipng/Cargo.toml +++ b/codecs/oxipng/Cargo.toml @@ -12,8 +12,7 @@ wasm-opt = ["-O", "--no-validation"] crate-type = ["cdylib"] [dependencies] -oxipng = { version = "4.0.3", default-features = false, features = ["libdeflater"] } -libdeflater = { version = "0.7.1", features = ["freestanding"] } +oxipng = { version = "9.0", default-features = false, features = ["freestanding"] } wasm-bindgen = "0.2.73" log = { version = "0.4.11", features = ["release_max_level_off"] } wasm-bindgen-rayon = { version = "1.0", optional = true } diff --git a/codecs/oxipng/README.md b/codecs/oxipng/README.md index 1381f3edd..984c1dfb8 100644 --- a/codecs/oxipng/README.md +++ b/codecs/oxipng/README.md @@ -1,5 +1,5 @@ # OxiPNG - Source: -- Version: v3.0.0 +- Version: v9.0.0 - License: MIT diff --git a/codecs/oxipng/build.sh b/codecs/oxipng/build.sh index ee3d2539f..119c15ecb 100755 --- a/codecs/oxipng/build.sh +++ b/codecs/oxipng/build.sh @@ -5,5 +5,5 @@ set -e rm -rf pkg,{-parallel} export CFLAGS="${CFLAGS} -DUNALIGNED_ACCESS_IS_FAST=1" wasm-pack build -t web -RUSTFLAGS='-C target-feature=+atomics,+bulk-memory' wasm-pack build -t web -d pkg-parallel -- -Z build-std=panic_abort,std --features=parallel +RUSTFLAGS='-C target-feature=+atomics,+bulk-memory' wasm-pack build -t web -d pkg-parallel . -- -Z build-std=panic_abort,std --features=parallel rm pkg{,-parallel}/.gitignore diff --git a/codecs/oxipng/package.json b/codecs/oxipng/package.json index f12e88ab9..fe55d4836 100644 --- a/codecs/oxipng/package.json +++ b/codecs/oxipng/package.json @@ -1,6 +1,6 @@ { "name": "oxipng", "scripts": { - "build": "RUST_IMG=rustlang/rust@sha256:744aeea5a38f95aa7a96ec37269a65f0c6197a1cdd87d6534e12bb869141d807 ../build-rust.sh ./build.sh" + "build": "RUST_IMG=rustlang/rust@sha256:5fd16a5576c22c8fdd5d659247755999e426c04de8dcf18a41ea446c5f253309 ../build-rust.sh ./build.sh" } } diff --git a/codecs/oxipng/pkg-parallel/README.md b/codecs/oxipng/pkg-parallel/README.md index 1381f3edd..984c1dfb8 100644 --- a/codecs/oxipng/pkg-parallel/README.md +++ b/codecs/oxipng/pkg-parallel/README.md @@ -1,5 +1,5 @@ # OxiPNG - Source: -- Version: v3.0.0 +- Version: v9.0.0 - License: MIT diff --git a/codecs/oxipng/pkg-parallel/package.json b/codecs/oxipng/pkg-parallel/package.json index 80ba04766..280a2ac73 100644 --- a/codecs/oxipng/pkg-parallel/package.json +++ b/codecs/oxipng/pkg-parallel/package.json @@ -11,5 +11,7 @@ ], "module": "squoosh_oxipng.js", "types": "squoosh_oxipng.d.ts", - "sideEffects": false + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/codecs/oxipng/pkg-parallel/squoosh_oxipng.d.ts b/codecs/oxipng/pkg-parallel/squoosh_oxipng.d.ts index 3800d4290..b776436b0 100644 --- a/codecs/oxipng/pkg-parallel/squoosh_oxipng.d.ts +++ b/codecs/oxipng/pkg-parallel/squoosh_oxipng.d.ts @@ -1,12 +1,14 @@ /* tslint:disable */ /* eslint-disable */ /** -* @param {Uint8Array} data +* @param {Uint8ClampedArray} data +* @param {number} width +* @param {number} height * @param {number} level * @param {boolean} interlace * @returns {Uint8Array} */ -export function optimise(data: Uint8Array, level: number, interlace: boolean): Uint8Array; +export function optimise(data: Uint8ClampedArray, width: number, height: number, level: number, interlace: boolean): Uint8Array; /** * @param {number} num_threads * @returns {Promise} @@ -36,8 +38,7 @@ export class wbg_rayon_PoolBuilder { export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; export interface InitOutput { - readonly __wasm_init_memory: () => void; - readonly optimise: (a: number, b: number, c: number, d: number, e: number) => void; + readonly optimise: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void; readonly __wbg_wbg_rayon_poolbuilder_free: (a: number) => void; readonly wbg_rayon_poolbuilder_numThreads: (a: number) => number; readonly wbg_rayon_poolbuilder_receiver: (a: number) => number; diff --git a/codecs/oxipng/pkg-parallel/squoosh_oxipng.js b/codecs/oxipng/pkg-parallel/squoosh_oxipng.js index c3c8163ac..b857edafc 100644 --- a/codecs/oxipng/pkg-parallel/squoosh_oxipng.js +++ b/codecs/oxipng/pkg-parallel/squoosh_oxipng.js @@ -54,17 +54,19 @@ function getArrayU8FromWasm0(ptr, len) { return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len); } /** -* @param {Uint8Array} data +* @param {Uint8ClampedArray} data +* @param {number} width +* @param {number} height * @param {number} level * @param {boolean} interlace * @returns {Uint8Array} */ -export function optimise(data, level, interlace) { +export function optimise(data, width, height, level, interlace) { try { const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); var ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc); var len0 = WASM_VECTOR_LEN; - wasm.optimise(retptr, ptr0, len0, level, interlace); + wasm.optimise(retptr, ptr0, len0, width, height, level, interlace); var r0 = getInt32Memory0()[retptr / 4 + 0]; var r1 = getInt32Memory0()[retptr / 4 + 1]; var v1 = getArrayU8FromWasm0(r0, r1).slice(); diff --git a/codecs/oxipng/pkg-parallel/squoosh_oxipng_bg.wasm b/codecs/oxipng/pkg-parallel/squoosh_oxipng_bg.wasm index 6712c6d25..6f3509016 100644 Binary files a/codecs/oxipng/pkg-parallel/squoosh_oxipng_bg.wasm and b/codecs/oxipng/pkg-parallel/squoosh_oxipng_bg.wasm differ diff --git a/codecs/oxipng/pkg-parallel/squoosh_oxipng_bg.wasm.d.ts b/codecs/oxipng/pkg-parallel/squoosh_oxipng_bg.wasm.d.ts index 0880f1c15..e47f8eb5a 100644 --- a/codecs/oxipng/pkg-parallel/squoosh_oxipng_bg.wasm.d.ts +++ b/codecs/oxipng/pkg-parallel/squoosh_oxipng_bg.wasm.d.ts @@ -1,7 +1,6 @@ /* tslint:disable */ /* eslint-disable */ -export function __wasm_init_memory(): void; -export function optimise(a: number, b: number, c: number, d: number, e: number): void; +export function optimise(a: number, b: number, c: number, d: number, e: number, f: number, g: number): void; export function __wbg_wbg_rayon_poolbuilder_free(a: number): void; export function wbg_rayon_poolbuilder_numThreads(a: number): number; export function wbg_rayon_poolbuilder_receiver(a: number): number; diff --git a/codecs/oxipng/pkg/README.md b/codecs/oxipng/pkg/README.md index 1381f3edd..984c1dfb8 100644 --- a/codecs/oxipng/pkg/README.md +++ b/codecs/oxipng/pkg/README.md @@ -1,5 +1,5 @@ # OxiPNG - Source: -- Version: v3.0.0 +- Version: v9.0.0 - License: MIT diff --git a/codecs/oxipng/pkg/package.json b/codecs/oxipng/pkg/package.json index 80ba04766..280a2ac73 100644 --- a/codecs/oxipng/pkg/package.json +++ b/codecs/oxipng/pkg/package.json @@ -11,5 +11,7 @@ ], "module": "squoosh_oxipng.js", "types": "squoosh_oxipng.d.ts", - "sideEffects": false + "sideEffects": [ + "./snippets/*" + ] } \ No newline at end of file diff --git a/codecs/oxipng/pkg/squoosh_oxipng.d.ts b/codecs/oxipng/pkg/squoosh_oxipng.d.ts index 7158f1965..a82fca90e 100644 --- a/codecs/oxipng/pkg/squoosh_oxipng.d.ts +++ b/codecs/oxipng/pkg/squoosh_oxipng.d.ts @@ -1,18 +1,20 @@ /* tslint:disable */ /* eslint-disable */ /** -* @param {Uint8Array} data +* @param {Uint8ClampedArray} data +* @param {number} width +* @param {number} height * @param {number} level * @param {boolean} interlace * @returns {Uint8Array} */ -export function optimise(data: Uint8Array, level: number, interlace: boolean): Uint8Array; +export function optimise(data: Uint8ClampedArray, width: number, height: number, level: number, interlace: boolean): Uint8Array; export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; export interface InitOutput { readonly memory: WebAssembly.Memory; - readonly optimise: (a: number, b: number, c: number, d: number, e: number) => void; + readonly optimise: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void; readonly __wbindgen_add_to_stack_pointer: (a: number) => number; readonly __wbindgen_malloc: (a: number) => number; readonly __wbindgen_free: (a: number, b: number) => void; diff --git a/codecs/oxipng/pkg/squoosh_oxipng.js b/codecs/oxipng/pkg/squoosh_oxipng.js index 03aa0bb3c..eb9bb70e3 100644 --- a/codecs/oxipng/pkg/squoosh_oxipng.js +++ b/codecs/oxipng/pkg/squoosh_oxipng.js @@ -38,17 +38,19 @@ function getArrayU8FromWasm0(ptr, len) { return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len); } /** -* @param {Uint8Array} data +* @param {Uint8ClampedArray} data +* @param {number} width +* @param {number} height * @param {number} level * @param {boolean} interlace * @returns {Uint8Array} */ -export function optimise(data, level, interlace) { +export function optimise(data, width, height, level, interlace) { try { const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); var ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc); var len0 = WASM_VECTOR_LEN; - wasm.optimise(retptr, ptr0, len0, level, interlace); + wasm.optimise(retptr, ptr0, len0, width, height, level, interlace); var r0 = getInt32Memory0()[retptr / 4 + 0]; var r1 = getInt32Memory0()[retptr / 4 + 1]; var v1 = getArrayU8FromWasm0(r0, r1).slice(); diff --git a/codecs/oxipng/pkg/squoosh_oxipng_bg.wasm b/codecs/oxipng/pkg/squoosh_oxipng_bg.wasm index 92ec1d896..9e3595ade 100644 Binary files a/codecs/oxipng/pkg/squoosh_oxipng_bg.wasm and b/codecs/oxipng/pkg/squoosh_oxipng_bg.wasm differ diff --git a/codecs/oxipng/pkg/squoosh_oxipng_bg.wasm.d.ts b/codecs/oxipng/pkg/squoosh_oxipng_bg.wasm.d.ts index cc6f7d396..a5eaf8565 100644 --- a/codecs/oxipng/pkg/squoosh_oxipng_bg.wasm.d.ts +++ b/codecs/oxipng/pkg/squoosh_oxipng_bg.wasm.d.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ export const memory: WebAssembly.Memory; -export function optimise(a: number, b: number, c: number, d: number, e: number): void; +export function optimise(a: number, b: number, c: number, d: number, e: number, f: number, g: number): void; export function __wbindgen_add_to_stack_pointer(a: number): number; export function __wbindgen_malloc(a: number): number; export function __wbindgen_free(a: number, b: number): void; diff --git a/codecs/oxipng/src/lib.rs b/codecs/oxipng/src/lib.rs index fa825d7ad..1047a2ab4 100644 --- a/codecs/oxipng/src/lib.rs +++ b/codecs/oxipng/src/lib.rs @@ -1,20 +1,27 @@ #[cfg(feature = "parallel")] pub use wasm_bindgen_rayon::init_thread_pool; -use oxipng::AlphaOptim; +use oxipng::{BitDepth, ColorType, Interlacing}; use wasm_bindgen::prelude::*; +use wasm_bindgen::Clamped; #[wasm_bindgen] -pub fn optimise(data: &[u8], level: u8, interlace: bool) -> Vec { +pub fn optimise( + data: Clamped>, + width: u32, + height: u32, + level: u8, + interlace: bool, +) -> Vec { let mut options = oxipng::Options::from_preset(level); - options.alphas.insert(AlphaOptim::Black); - options.alphas.insert(AlphaOptim::White); - options.alphas.insert(AlphaOptim::Up); - options.alphas.insert(AlphaOptim::Down); - options.alphas.insert(AlphaOptim::Left); - options.alphas.insert(AlphaOptim::Right); - options.interlace = Some(if interlace { 1 } else { 0 }); + options.optimize_alpha = true; + options.interlace = Some(if interlace { + Interlacing::Adam7 + } else { + Interlacing::None + }); - options.deflate = oxipng::Deflaters::Libdeflater; - oxipng::optimize_from_memory(data, &options).unwrap_throw() + let raw = oxipng::RawImage::new(width, height, ColorType::RGBA, BitDepth::Eight, data.0) + .unwrap_throw(); + raw.create_optimized_png(&options).unwrap_throw() } diff --git a/codecs/rust.Dockerfile b/codecs/rust.Dockerfile index e72f08030..4ac6ac68e 100644 --- a/codecs/rust.Dockerfile +++ b/codecs/rust.Dockerfile @@ -2,7 +2,7 @@ ARG RUST_IMG=rust:1.47 FROM emscripten/emsdk:2.0.8 AS wasm-tools WORKDIR /opt/wasm-tools -RUN wget -qO- https://github.com/rustwasm/wasm-pack/releases/download/v0.9.1/wasm-pack-v0.9.1-x86_64-unknown-linux-musl.tar.gz | tar -xzf - --strip 1 +RUN wget -qO- https://github.com/rustwasm/wasm-pack/releases/download/v0.12.1/wasm-pack-v0.12.1-x86_64-unknown-linux-musl.tar.gz | tar -xzf - --strip 1 FROM $RUST_IMG AS rust ARG RUST_IMG diff --git a/src/features/encoders/oxiPNG/client/index.tsx b/src/features/encoders/oxiPNG/client/index.tsx index 43eae5150..e16b8e7ca 100644 --- a/src/features/encoders/oxiPNG/client/index.tsx +++ b/src/features/encoders/oxiPNG/client/index.tsx @@ -1,9 +1,4 @@ -import { canvasEncode } from 'client/lazy-app/util/canvas'; -import { - abortable, - blobToArrayBuffer, - inputFieldChecked, -} from 'client/lazy-app/util'; +import { inputFieldChecked } from 'client/lazy-app/util'; import { EncodeOptions } from '../shared/meta'; import type WorkerBridge from 'client/lazy-app/worker-bridge'; import { h, Component } from 'preact'; @@ -18,9 +13,7 @@ export async function encode( imageData: ImageData, options: EncodeOptions, ) { - const pngBlob = await abortable(signal, canvasEncode(imageData, 'image/png')); - const pngBuffer = await abortable(signal, blobToArrayBuffer(pngBlob)); - return workerBridge.oxipngEncode(signal, pngBuffer, options); + return workerBridge.oxipngEncode(signal, imageData, options); } type Props = { @@ -56,7 +49,7 @@ export class Options extends Component { ; export default async function encode( - data: ArrayBuffer, + data: ImageData, options: EncodeOptions, ): Promise { if (!wasmReady) { @@ -45,6 +45,11 @@ export default async function encode( } const optimise = await wasmReady; - return optimise(new Uint8Array(data), options.level, options.interlace) - .buffer; + return optimise( + data.data, + data.width, + data.height, + options.level, + options.interlace, + ).buffer; }