perf: cache assets.json manifest, drop WP <6.0 patterns backport, declare PHP/WP requirements#503
Merged
Merged
Conversation
…p editor style on front - Assets::get_min_file(): memoize the decoded dist/assets.json manifest (was re-read and re-decoded on every call, several times per request) - Editor_Patterns: remove the register_patterns() WP <6.0 backport, core handles ./patterns/ registration since 6.0 - Editor::style(): skip manifest lookup and filesystem check on front-end requests, editor styles are only consumed in admin/editor context - Declare PHP 8.3 / WP 6.3 requirements in style.css and README Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
francoistibo
approved these changes
Jul 17, 2026
Member
Author
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 486448a. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contexte
Revue de performance du framework. Trois hotspots corrigés, aucun changement de comportement attendu.
Changements
1.
Assets::get_min_file()— memoïsation du manifestassets.jsonLe fichier
dist/assets.jsonétait relu et re-décodé (file_exists+file_get_contents+json_decode) à chaque appel, et la méthode est appelée plusieurs fois par requête :register_assets()(JS), filtrestylesheet_uri(déclenché à chaqueget_stylesheet_uri()),Editor::style(),login_stylesheet_uri().Le manifest décodé est désormais memoïsé en static (
get_assets_manifest()), sur le même modèle queget_asset_data()qui avait déjà son cache.2.
Editor_Patterns— suppression du backport WP < 6.0register_patterns()(~140 lignes) s'auto-désactivait sur WP ≥ 6.0 mais restait accroché surinità chaque requête. Le core enregistre lui-même les patterns du dossier./patterns/depuis la 6.0 (_register_theme_block_patterns()), et le thème requiert déjà WP 6.3 (style.css). Code supprimé, seulregister_categories()est conservé.3.
Editor::style()— gardeis_admin()La méthode s'exécutait au boot sur toutes les requêtes (front incluse) : lookup manifest +
is_file(), alors qu'add_editor_style()n'est consommé qu'en contexte admin/éditeur.4. Pré-requis PHP/WP déclarés
style.css: ajout deRequires PHP: 8.3Versions alignées sur l'existant :
phpcs.xml.dist(testVersion 8.3-), platform composer (php: 8.3.0), wp-env (PHP 8.3),Requires at least: 6.3.Vérifications
php -lOK sur les 3 fichiers modifiésPiste non traitée ici (à discuter)
La dépendance jQuery imposée en dur sur le bundle front (
Assets.php:array_merge( [ 'jquery' ], … )) + l'inline script du servicePerformanceaccroché surjquerygarantissent ~30 Ko gzip de JS sur chaque page, même si rien ne l'utilise. C'est le plus gros gain potentiel côté Core Web Vitals, mais c'est un breaking change pour les projets enfants — à traiter dans une PR dédiée si l'équipe valide.🤖 Generated with Claude Code
Note
Low Risk
Performance and dead-code removal aligned with existing WP 6.3+ requirements; behavior should be unchanged except dropping unsupported WP <6.0 pattern registration.
Overview
This PR trims per-request overhead in the theme asset and editor bootstrap paths and documents minimum PHP/WordPress versions.
Assetsnow loadsdist/assets.jsonthrough a privateget_assets_manifest()with a static cache, so repeatedget_min_file()calls (front scripts,stylesheet_uri, login CSS, editor assets) no longer re-read and decode the manifest on every invocation.Editor::style()returns immediately on non-admin requests so editor CSS manifest and file checks do not run on the front end.Editor_Patternsdrops the customregister_patterns()backport and itsinithook; pattern files under./patterns/are left to WordPress core (6.0+), whileregister_categories()remains.style.cssaddsRequires PHP: 8.3; the README adds an explicit PHP 8.3+ and WordPress 6.3+ requirements section.Reviewed by Cursor Bugbot for commit 486448a. Bugbot is set up for automated code reviews on this repo. Configure here.