perf: cache assets.json manifest, drop WP <6.0 patterns backport, declare PHP/WP requirements#503
Open
herewithme wants to merge 1 commit into
Open
perf: cache assets.json manifest, drop WP <6.0 patterns backport, declare PHP/WP requirements#503herewithme wants to merge 1 commit into
herewithme wants to merge 1 commit into
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
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
Changes are performance guards and removal of dead code on WP 6.3+; pattern registration now depends entirely on core, which matches the declared minimum version.
Overview
This PR reduces per-request overhead around compiled assets and editor setup, and documents platform requirements—without intended behavior changes on supported WordPress versions.
Assetsnow loadsdist/assets.jsononce per request via a new privateget_assets_manifest()(static memoization), whichget_min_file()uses instead of re-reading and decoding the file on every call.Editor::style()returns immediately on non-admin requests so front-end boots no longer run manifest lookup andis_file()checks for editor CSS.Editor_Patternsdrops the largeregister_patterns()backport and itsinithook; only pattern categories are registered, relying on core theme pattern registration (WP 6.0+), consistent with the theme’s WP 6.3 minimum.style.cssaddsRequires PHP: 8.3; README adds explicit PHP 8.3+ and WordPress 6.3+ requirements.Reviewed by Cursor Bugbot for commit 486448a. Bugbot is set up for automated code reviews on this repo. Configure here.