Skip to content

Remove client-side media processing feature - #11309

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

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

Conversation

@adamsilverstein

@adamsilversteinadamsilverstein commented Mar 19, 2026

Copy link
Copy Markdown
Member

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

github-actionsBot commented Mar 19, 2026

Copy link
Copy Markdown

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
Copy Markdown

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
Copy Markdown
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
Copy Markdown
MemberAuthor

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

adamsilverstein commented Mar 19, 2026

Copy link
Copy Markdown
MemberAuthor

Build Size Comparison: vips exclusion

Release zip impact

ZipSizeDifference from 6.9.1
WordPress 6.9.1 (latest stable)27 MB
Nightly (with vips)61 MB+34 MB (+126%)
Nightly without vips57 MB+30 MB (+111%)
vips savings in zip4 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)

DirectoryTrunk (before)PR branch (after)Savings
src/ (total)156 MB143 MB13 MB (8%)
wp-includes/87 MB74 MB13 MB (15%)
js/dist/41 MB28 MB13 MB (32%)

script-modules/ breakdown

MetricTrunk (before)PR branch (after)Savings
script-modules/ total15 MB2.2 MB12.8 MB (85%)
script-modules/vips/13 MBgone13 MB

@adamsilverstein

Copy link
Copy Markdown
MemberAuthor

WordPress 7.0 Build Size Growth Analysis

Overall comparison

Metric6.9.17.0-alpha (nightly)Delta
Zip file27 MB61 MB+34 MB (+126%)
Uncompressed81 MB146 MB+65 MB (+80%)

Size growth by feature (uncompressed, sorted by impact)

#FeatureSize addedCategoryCore commit
1Extra bundled themes (nightly build artifact, not shipped in releases)+34.0 MBBuild artifactN/A — nightly zips include all twenty* themes; releases only ship latest 3
2vips/wasm client-side media processing+13.1 MBNew feature0544d56
3Admin routes/pages (wp-includes/build/)+5.5 MBNew feature (Site Editor routing)49d8c11 (new build system)
4Block-library per-block CSS (new split alongside existing bundled CSS)+3.0 MBArchitecture changeVia Gutenberg build artifact
5editor.js growth (RTC, new editor features)+2.0 MBFeature growth19c9957 (RTC endpoints)
6New script modules (abilities, boot, route, workflow, latex-to-mathml, etc.)+1.8 MBNew featuresVia Gutenberg build artifact
7components.js growth+1.4 MBPackage growthVia Gutenberg — new/updated components
8Icons library (wp-includes/icons/)+1.3 MBNew feature5b7a3ad
9PHP AI Client (wp-includes/php-ai-client/)+0.9 MBNew feature52e3c30
10media-utils.js growth (media processing)+0.8 MBFeature growthVia Gutenberg — client-side media support
11New JS packages (sync, theme, upload-media, etc.)+0.8 MBNew featuresVia Gutenberg build artifact
12block-editor.js growth+0.6 MBPackage growthVia Gutenberg
13block-library.js growth+0.5 MBPackage growthVia Gutenberg — new blocks
14Editor CSS growth+0.4 MBFeature growthVia 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

PackageMinifiedFullTotal
sync.js120K360K480K
theme.js60K128K188K
upload-media.js24K56K80K
block-serialization-spec-parser.js12K52K64K
react-i18n.js4K4K8K
undo-manager.js4K8K12K

New script modules in 7.0

ModuleSizePurpose
vips/13,440Kwasm image processing (plugin-only)
latex-to-mathml/584KMath rendering
abilities/428KAbilities API
route/260KSite Editor routing
workflow/208KEditor workflow
boot/180KEditor bootstrap
interactivity/ (growth)148KInteractivity API
block-library/ (growth)136KBlock scripts
lazy-editor/132KLazy-loaded editor
connectors/24KAI connectors
edit-site-init/24KSite editor init
core-abilities/16KCore abilities
a11y/ (growth)12KAccessibility

Comparison methodology

adamsilversteinand 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
adamsilversteinforce-pushed the remove-client-side-media branch from 68c4e9a to b8adfe8CompareMarch 20, 2026 15:58
adamsilversteinand 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>
Comment threadGruntfile.js
// 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
Copy Markdown
MemberAuthor

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
Copy Markdown

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.

Sign up for freeto 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

@adamsilverstein@aaronjorbin