Skip to content

Remove client-side media processing feature#11309

Closed
adamsilverstein wants to merge 9 commits intoWordPress:trunkfrom
adamsilverstein:remove-client-side-media
Closed

Remove client-side media processing feature#11309
adamsilverstein wants to merge 9 commits intoWordPress:trunkfrom
adamsilverstein:remove-client-side-media

Conversation

@adamsilverstein
Copy link
Member

@adamsilverstein adamsilverstein commented Mar 19, 2026

Summary

  • Removes the wasm-vips client-side media processing feature from WordPress 7.0, punting it to 7.1
  • The VIPS WASM worker alone adds ~16MB to the build output (~36% of script-modules/), which is too much build size overhead for the current value provided
  • Removes all PHP functions, REST API endpoints (sideload/finalize), cross-origin isolation infrastructure, VIPS script module handling, build configuration, and associated tests (1,507 lines deleted across 12 files)

Trac ticket: https://core.trac.wordpress.org/ticket/64906

What's removed

  • 7 PHP functions in media.php (client-side media processing, cross-origin isolation, DIP headers)
  • REST API /sideload and /finalize endpoints and generate_sub_sizes/convert_format params
  • REST index image processing settings block
  • Cross-origin isolation output buffering in media-template.php
  • VIPS script module registration and minified filename handling
  • VIPS-related build exclusion rules in Gruntfile.js and tools/gutenberg/copy.js
  • Test file wpCrossOriginIsolation.php and 9 sideload/finalize/generate_sub_sizes tests

What's preserved (independent features)

  • wp_prevent_unsupported_mime_type_uploads filter (#64836)
  • X-WP-Upload-Attachment-ID header (error recovery)
  • Pre-existing post-process and edit endpoints
  • exif_orientation, filename, filesize, missing_image_sizes schema properties

Test plan

  • Run phpunit tests/phpunit/tests/media/ — verify no failures
  • Run phpunit tests/phpunit/tests/rest-api/rest-attachments-controller.php — verify no failures
  • Run phpunit tests/phpunit/tests/rest-api/rest-schema-setup.php — verify route list is correct
  • Verify standard image upload via REST API still works with server-side sub-size generation
  • Run npx grunt build --dev — verify build succeeds
  • Confirm build/wp-includes/js/dist/script-modules/vips/ no longer exists after build

AI use

I created this PR with careful prompting and planning in Claude Code. I will review the code and test the result.


Commit message

Media: Remove client-side media processing feature.

Punt the wasm-vips client-side media processing feature to a future release. The VIPS WASM worker adds ~16MB to the build output, which is too much build size overhead for the current value provided. Removes all PHP functions, REST API endpoints, cross-origin isolation infrastructure, VIPS script module handling, build configuration, and associated tests.

Props adamsilverstein, jorbin.
Fixes #64906.

@github-actions
Copy link

github-actions bot commented Mar 19, 2026

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 props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props adamsilverstein, jorbin.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions
Copy link

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@aaronjorbin
Copy link
Member

I tried to check all of the commits. For the most part, this looks good however I noticed that test_vips_script_modules_always_use_minified_paths wasn't removed. Should that also be removed?

@adamsilverstein
Copy link
Member Author

I tried to check all of the commits. For the most part, this looks good however I noticed that test_vips_script_modules_always_use_minified_paths wasn't removed. Should that also be removed?

it should be removed now, I left a "test_vips_script_modules_not_registered_in_core"

@adamsilverstein
Copy link
Member Author

adamsilverstein commented Mar 19, 2026

Build Size Comparison: vips exclusion

Release zip impact

Zip Size Difference from 6.9.1
WordPress 6.9.1 (latest stable) 27 MB
Nightly (with vips) 61 MB +34 MB (+126%)
Nightly without vips 57 MB +30 MB (+111%)
vips savings in zip 4 MB

The nightly zip is currently 61 MB vs 27 MB for 6.9.1. Removing vips saves 4 MB in the compressed zip (61 MB -> 57 MB). The remaining ~30 MB increase over 6.9.1 comes from other new packages and features in 7.0.

Note: vips is 13 MB uncompressed but compresses to ~4 MB in the zip since the inlined wasm binary is base64-encoded data that still compresses reasonably well.

Full build directory (uncompressed)

Directory Trunk (before) PR branch (after) Savings
src/ (total) 156 MB 143 MB 13 MB (8%)
wp-includes/ 87 MB 74 MB 13 MB (15%)
js/dist/ 41 MB 28 MB 13 MB (32%)

script-modules/ breakdown

Metric Trunk (before) PR branch (after) Savings
script-modules/ total 15 MB 2.2 MB 12.8 MB (85%)
script-modules/vips/ 13 MB gone 13 MB

@adamsilverstein
Copy link
Member Author

WordPress 7.0 Build Size Growth Analysis

Overall comparison

Metric 6.9.1 7.0-alpha (nightly) Delta
Zip file 27 MB 61 MB +34 MB (+126%)
Uncompressed 81 MB 146 MB +65 MB (+80%)

Size growth by feature (uncompressed, sorted by impact)

# Feature Size added Category Core commit
1 Extra bundled themes (nightly build artifact, not shipped in releases) +34.0 MB Build artifact N/A — nightly zips include all twenty* themes; releases only ship latest 3
2 vips/wasm client-side media processing +13.1 MB New feature 0544d56
3 Admin routes/pages (wp-includes/build/) +5.5 MB New feature (Site Editor routing) 49d8c11 (new build system)
4 Block-library per-block CSS (new split alongside existing bundled CSS) +3.0 MB Architecture change Via Gutenberg build artifact
5 editor.js growth (RTC, new editor features) +2.0 MB Feature growth 19c9957 (RTC endpoints)
6 New script modules (abilities, boot, route, workflow, latex-to-mathml, etc.) +1.8 MB New features Via Gutenberg build artifact
7 components.js growth +1.4 MB Package growth Via Gutenberg — new/updated components
8 Icons library (wp-includes/icons/) +1.3 MB New feature 5b7a3ad
9 PHP AI Client (wp-includes/php-ai-client/) +0.9 MB New feature 52e3c30
10 media-utils.js growth (media processing) +0.8 MB Feature growth Via Gutenberg — client-side media support
11 New JS packages (sync, theme, upload-media, etc.) +0.8 MB New features Via Gutenberg build artifact
12 block-editor.js growth +0.6 MB Package growth Via Gutenberg
13 block-library.js growth +0.5 MB Package growth Via Gutenberg — new blocks
14 Editor CSS growth +0.4 MB Feature growth Via Gutenberg
Total accounted ~66 MB

Key takeaways

1. Theme bundling is the #1 factor (+34 MB) — but it's a nightly-only issue

The nightly build includes all 16 twenty* themes (classic + block). WordPress releases only ship the latest 3 (currently twentytwentythree, twentytwentyfour, twentytwentyfive). This accounts for over half the raw delta and is not a concern for actual releases.

2. Adjusting for release packaging, the real growth is ~31 MB

Without the extra themes, the growth is from:

  • vips/wasm: 13 MB (already addressed in PR #11309)
  • New build system artifacts: 5.5 MB (admin routes/pages JS)
  • Per-block CSS split: 3 MB (block styles duplicated in both bundled and per-block formats)
  • Editor/package growth from Gutenberg: ~8 MB (new features like RTC, abilities, icons, AI client, new components)
  • Icons + AI client: 2.2 MB (new PHP-side features)

3. Block-library CSS is duplicated

The 7.0 build ships both the old bundled CSS files (960K) and new per-block CSS directories (3 MB). If the bundled files are still the ones loaded, the per-block copies may be unnecessary overhead (or vice versa).

4. Non-minified JS files add significant weight

Non-minified JS in js/dist/ is 21 MB (same as minified + vips). These ship in the zip but are only used in SCRIPT_DEBUG mode. The old build only shipped non-minified; the new build ships both.

New JS packages in 7.0

Package Minified Full Total
sync.js 120K 360K 480K
theme.js 60K 128K 188K
upload-media.js 24K 56K 80K
block-serialization-spec-parser.js 12K 52K 64K
react-i18n.js 4K 4K 8K
undo-manager.js 4K 8K 12K

New script modules in 7.0

Module Size Purpose
vips/ 13,440K wasm image processing (plugin-only)
latex-to-mathml/ 584K Math rendering
abilities/ 428K Abilities API
route/ 260K Site Editor routing
workflow/ 208K Editor workflow
boot/ 180K Editor bootstrap
interactivity/ (growth) 148K Interactivity API
block-library/ (growth) 136K Block scripts
lazy-editor/ 132K Lazy-loaded editor
connectors/ 24K AI connectors
edit-site-init/ 24K Site editor init
core-abilities/ 16K Core abilities
a11y/ (growth) 12K Accessibility

Comparison methodology

adamsilverstein and others added 6 commits March 20, 2026 08:55
Punt the wasm-vips client-side media processing feature to
7.1 as it adds ~16MB of WASM to the build without sufficient
value for 7.0. Removes all PHP functions, REST API endpoints
(sideload/finalize), cross-origin isolation, VIPS script
module handling, and associated tests.
Remove extra blank lines before closing braces in
register_routes() and wp_print_media_templates().
Missed in the initial removal of the client-side media
processing feature.
Remove image_sizes, image_size_threshold,
image_output_formats, interlaced settings from REST
index, and generate_sub_sizes/convert_format params
from media create endpoint.
…les.

The previous build config only excluded non-minified vips files, but with client-side media processing removed from Core, vips should not be copied or registered at all. This adds:

- `!vips/**` exclusion to the Gruntfile copy task
- Skip `vips` directory in `generateScriptModulesPackages()` so vips modules are not auto-registered
- Update test to assert vips modules are not registered in Core

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
WP_Script_Modules::$registered is private with no public getter.
Use the same enqueue-and-check-output pattern as the original test
to verify vips modules are not registered.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@adamsilverstein adamsilverstein force-pushed the remove-client-side-media branch from 68c4e9a to b8adfe8 Compare March 20, 2026 15:58
adamsilverstein and others added 2 commits March 20, 2026 08:59
The upload-media package in the Gutenberg build artifact declares
@wordpress/vips/worker as a dynamic module dependency. Since vips
is excluded from Core, this unregistered dependency causes a
_doing_it_wrong notice on every admin page load.

Filter out @wordpress/vips/* module dependencies during the
script-loader-packages.php generation step.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
// Skip non-minified VIPS files — they are ~16MB of inlined WASM
// with no debugging value over the minified versions.
'!vips/!(*.min).js',
'!vips/**',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sure no vips included from GB

@github-actions
Copy link

A commit was made that fixes the Trac ticket referenced in the description of this pull request.

SVN changeset: 62081
GitHub commit: c863860

This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.

@github-actions github-actions bot closed this Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants