Skip including inactive or experimental routes when building for WordPress Core#76715
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to ensure that WordPress Core builds only include assets for active (non-experimental) pages/routes, so inactive/experimental routes aren’t built and therefore aren’t bundled into the resulting wordpress-develop assets.
Changes:
- Filter the route build phase to only build routes whose
route.pageis in the active page set (with Core builds excludingexperimentalpages). - Refactor script/module registry generation to inline dependency/version metadata rather than referencing generated
.asset.phpfiles. - Switch style dependency inference to use in-memory script dependency data (instead of parsing
.asset.phpoutput).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Size Change: 0 B Total Size: 8.21 MB ℹ️ View Unchanged
|
8278c28 to
6b2cd77
Compare
For WordPress Core builds (IS_WORDPRESS_CORE=true), only include pages that explicitly opt in with `stable: true`. Pages default to non-stable (string shorthand entries are always non-stable), so experimental and unstable pages are excluded from the wordpress-develop build. The page filtering is hoisted above buildAllRoutes() so that routes belonging to inactive pages are skipped at build time rather than only being excluded from PHP registration. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
When buildRoutes() is called with no active pages, every route is built, including experimental and non-stable ones. Emit a console message so this fallback is visible in build output. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
6b2cd77 to
dd8d756
Compare
|
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. |
|
|
||
| if ( activePageIds.size === 0 ) { | ||
| console.log( | ||
| ' No active pages specified; building all routes, including experimental and non-stable ones.\n' |
There was a problem hiding this comment.
the the tab here intentional?
| ' No active pages specified; building all routes, including experimental and non-stable ones.\n' | |
| 'No active pages specified; building all routes, including experimental and non-stable ones.\n' |
|
ps. noting that this PR is currently a blocker for updating Gutenberg in core, which is a blocker for backporting recent Gutenberg improvements (ie.client-side media updates), see WordPress/wordpress-develop#12009 |
…ntal-and-inactive-pages-for-core
| ], | ||
| "experimental": true | ||
| } | ||
| ] |
There was a problem hiding this comment.
Thanks for making the updates @desrosj
So seems all of the pages are experimental? Would be cool to have the folks working on these pages to confirm that. I don't know most of them personally but it does sound plausible at first sight.
There was a problem hiding this comment.
Of course!
I based this list off of what is currently shown on the experimental page in the WP Admin. But it would be great to get some confirmation.
My next question was "how do we know who is working on what?" 😅 @tyxla is going to go through and ping folks because he's familiar with most all experiments. But it would be great to have a rough reference to know who is working in what areas.
There was a problem hiding this comment.
I've confrmed them manually, see my separate review: #76715 (review)
|
Flaky tests detected in a2a1fb6. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/26953668401
|
tyxla
left a comment
There was a problem hiding this comment.
Confirmed the routes are not bundled anymore. Also, confirming separately each of the experiments are still active.
| }, | ||
| { | ||
| "id": "experiments", | ||
| "experimental": true |
There was a problem hiding this comment.
Confirmed, but I would add a comment here: we likely never want to stabilize this.
| "experimental": true | ||
| }, | ||
| { | ||
| "id": "media-editor", |
There was a problem hiding this comment.
Confirming it's still an experiment. cc @andrewserong @ramonjd
|
Thanks everyone! |
What?
This stops including experimental or inactive routes when building assets for WordPress Core by updating the routes within the
package.jsonfile to explicitly require"stable": truefor any page that is intended for distribution within WordPress throughwordpress-develop(stable and not experimental).Why?
In the assets built for
wordpress-develop, all routes and their respective files are included in the zip file even though the generatedregistry.phpfile only contains active, non-experimental routes. This results in thewordpress-developbuild script copying them and including them unexpectedly. It also makes the automated checks confirming that all changes to built files are included in a given pull request, which is helpful for ensuring all changes are properly included.This also saves bandwidth and disk space when uploading and downloading the built asset form the GitHub Container Registry, and avoids having to either keep an include or exclude list for routes or the need to parse the
registry.phpfile to determine which routes to include inwordpress-develop.Testing Instructions
To test the current behavior:
wordpress-develop, update thegutenberg.shavalue to the most recent one from this repository'strunkbranch and runnpm run build:devornpm run build.gutenberg/build/pages/andgutenberg/build/routesdirectories include experimental pages and routes.src/wp-includes/build/pagesandsrc/wp-includes/build/routes(orbuildif you rannpm run buildinstead) directories and see the experimental features have been included.To test this PR:
wordpress-develop, update thegutenberg.shavalue topr-76715and runnpm run build:devornpm run build.gutenberg/build/pages/andgutenberg/build/routesdirectories do not include experimental pages and routes.src/wp-includes/build/pagesandsrc/wp-includes/build/routesdirectories and see the experimental features have not been included.Use of AI Tools
Tools: Claude Code
Model: Opus 4.7 & Sonnet 4.6 at various times.
Description: Used Claude to investigate, formulate a plan, and create the PR.