Client-side media: Add JPEG XL (JXL) support via canonical plugin#76990
Client-side media: Add JPEG XL (JXL) support via canonical plugin#76990adamsilverstein wants to merge 3 commits intotrunkfrom
Conversation
Add client-side JPEG XL image processing using a canonical plugin (wp-vips-jxl) that ships the vips-jxl.wasm module on demand, avoiding a 3.1 MB increase to the Gutenberg bundle. The implementation follows the same pattern as FFmpeg WASM (#76964): - Plugin sets window.__vipsJxlConfig on editor pages - Auto-installs via REST API when user uploads JXL and has capabilities - Falls back to server-side processing when plugin unavailable Key changes: - vips: Add setJxlWasmUrl() for runtime JXL WASM URL injection with lazy re-initialization of the vips instance - upload-media: Add jxl-plugin.ts for plugin detection, installation, and config fetching - upload-media: Add JXL to supported MIME types and image formats - upload-media: Add JXL plugin availability check in prepareItem() with graceful degradation Closes #76981
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Use the store name string 'core' directly instead of importing coreStore from the core-data package. This avoids adding a circular dependency (upload-media -> core-data -> block-editor -> upload-media) in the tsconfig project references graph.
Cast dispatch() and resolveSelect() results to the expected shapes since using the store name string 'core' (instead of the typed store descriptor) returns unknown.
|
Size Change: +569 B (+0.01%) Total Size: 7.74 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in 19fec48. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/23885047338
|
Summary
Add client-side JPEG XL image processing using a canonical plugin (
wp-vips-jxl) that ships thevips-jxl.wasmmodule on demand.This follows the same pattern established for FFmpeg WASM in #76964: the heavy WASM binary (~2.3 MB) lives in a separate WordPress plugin that is auto-installed when a user first uploads a JXL image, keeping the Gutenberg bundle size unchanged.
How it works
image/jxlMIME typewindow.__vipsJxlConfigexists (set by the plugin)install_pluginscapability: auto-installs and activates via REST APIGraceful degradation
crossOriginIsolatedcrossOriginIsolatedunavailableKey changes
@wordpress/vips: AddsetJxlWasmUrl()for runtime JXL WASM URL injection with lazy re-initialization of the vips instance. Add JXL tosupportsQuality(). Set effort=3 for JXL encoding (default 7 is too slow for interactive use).@wordpress/upload-media: Newjxl-plugin.tsfor plugin detection, auto-installation, and config fetching. Addimage/jxlto supported MIME types andjxlto valid image formats. Add JXL plugin availability check inprepareItem()with proper fallback when output format is JXL but plugin unavailable.The canonical plugin (
wp-vips-jxl)A minimal WordPress plugin (~70 lines PHP) that:
vips-jxl.wasm(~2.3 MB) fromwasm-vips@0.0.16window.__vipsJxlConfigon editor pages viawp_add_inline_script/wp-vips-jxl/v1/configfor mid-session URL discovery after auto-installationTest plan
.jxlfile withwp-vips-jxlplugin active — verify client-side processing (resize, compress, thumbnails).jxlfile without plugin as admin — verify auto-install flow.jxlfile as non-admin without plugin — verify server-side fallbackvips-jxl.wasmis NOT in the Gutenberg build outputCloses #76981