From 232468aa8866e85c9ea5691bbb42a5584ba96dff Mon Sep 17 00:00:00 2001 From: Benito Alba Molina <272526523+benitoalba@users.noreply.github.com> Date: Thu, 30 Jul 2026 23:25:13 +0200 Subject: [PATCH 1/2] Build/Test Tools: Format copied Gutenberg style registry --- Gruntfile.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/Gruntfile.js b/Gruntfile.js index 61f18481e23a8..3c93cb52cbdb7 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -751,6 +751,36 @@ module.exports = function(grunt) { } ], }, 'gutenberg-styles': { + options: { + process: function( content, srcpath ) { + if ( path.basename( srcpath ) !== 'registry.php' ) { + return content; + } + + /* + * Gutenberg's generated style registry does not currently + * meet Core's PHP coding standards. Format its known keys + * while copying it so build jobs do not require PHP tooling. + * + * @ticket 65278 + */ + return content.replace( + /^(\t\t)'(handle|path|dependencies)'\s*=>\s*([^\r\n]*)$/gm, + function( match, indentation, key, value ) { + const padding = ' '.repeat( 13 - key.length ); + + if ( key === 'dependencies' ) { + value = value.replace( + /^array\((.+)\),$/, + 'array( $1 ),' + ); + } + + return indentation + '\'' + key + '\'' + padding + '=> ' + value; + } + ); + } + }, files: [ { expand: true, cwd: 'gutenberg/build/styles', From 4265f7fb873deb577dd474ddc8951decb36352fb Mon Sep 17 00:00:00 2001 From: Benito Alba Molina <272526523+benitoalba@users.noreply.github.com> Date: Fri, 31 Jul 2026 00:23:40 +0200 Subject: [PATCH 2/2] Build/Test Tools: Harden generated registry formatting --- Gruntfile.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 3c93cb52cbdb7..eff6674f503e0 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -764,15 +764,21 @@ module.exports = function(grunt) { * * @ticket 65278 */ + const longestKey = 'dependencies'; + return content.replace( /^(\t\t)'(handle|path|dependencies)'\s*=>\s*([^\r\n]*)$/gm, function( match, indentation, key, value ) { - const padding = ' '.repeat( 13 - key.length ); + const padding = ' '.repeat( longestKey.length - key.length + 1 ); if ( key === 'dependencies' ) { value = value.replace( - /^array\((.+)\),$/, - 'array( $1 ),' + /^array\((.*)\),$/, + function( array, dependencies ) { + dependencies = dependencies.trim(); + + return dependencies ? 'array( ' + dependencies + ' ),' : 'array(),'; + } ); }