Skip to content

Commit dd663b6

Browse files
authored
Merge branch 'trunk' into fix/issue-64071
2 parents ccd7673 + ab38563 commit dd663b6

69 files changed

Lines changed: 1758 additions & 2279 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/check-built-files.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,14 @@ on:
2323
- '.nvmrc'
2424
- 'Gruntfile.js'
2525
- 'webpack.config.js'
26+
- 'tools/gutenberg/**'
27+
- 'tools/vendors/**'
2628
- 'tools/webpack/**'
2729
# These files configure Composer. Changes could affect the outcome.
2830
- 'composer.*'
2931
# Confirm any changes to relevant workflow files.
3032
- '.github/workflows/check-built-files.yml'
33+
- '.github/workflows/reusable-check-built-files.yml'
3134
# Changes to the default themes should be handled by the themes workflows.
3235
- '!src/wp-content/themes/twenty**'
3336

.github/workflows/end-to-end-tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ on:
2828
- '.nvmrc'
2929
- 'Gruntfile.js'
3030
- 'webpack.config.js'
31+
- 'tools/gutenberg/**'
32+
- 'tools/vendors/**'
3133
- 'tools/webpack/**'
3234
# These files configure Composer. Changes could affect the outcome.
3335
- 'composer.*'

.github/workflows/javascript-tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ on:
2626
- '.nvmrc'
2727
- 'Gruntfile.js'
2828
- 'webpack.config.js'
29+
- 'tools/gutenberg/**'
30+
- 'tools/vendors/**'
2931
- 'tools/webpack/**'
3032
# This file configures ESLint. Changes could affect the outcome.
3133
- '.eslintignore'

.github/workflows/javascript-type-checking.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ on:
2121
# These files configure npm. Changes could affect the outcome.
2222
- 'package*.json'
2323
- '.nvmrc'
24+
- '.npmrc'
2425
# This file configures TypeScript. Changes could affect the outcome.
2526
- 'tsconfig.json'
2627
# This directory contains TypeScript definitions. Changes could affect the outcome.

.github/workflows/local-docker-environment.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ on:
1717
- 'package*.json'
1818
- 'Gruntfile.js'
1919
- 'webpack.config.js'
20+
- 'tools/gutenberg/**'
21+
- 'tools/vendors/**'
2022
- 'tools/webpack/**'
2123
- '.npmrc'
2224
- '.nvmrc'
@@ -106,6 +108,7 @@ jobs:
106108
- db-version: '9.2'
107109
- db-version: '9.3'
108110
- db-version: '9.4'
111+
- db-version: '9.5'
109112
# No PHP 8.5 + Memcached support yet.
110113
- php: '8.5'
111114
memcached: true

.github/workflows/performance.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ on:
2828
- '.nvmrc'
2929
- 'Gruntfile.js'
3030
- 'webpack.config.js'
31+
- 'tools/gutenberg/**'
32+
- 'tools/vendors/**'
3133
- 'tools/webpack/**'
3234
# These files configure Composer. Changes could affect the outcome.
3335
- 'composer.*'

.github/workflows/test-build-processes.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ on:
2626
- '.nvmrc'
2727
- 'Gruntfile.js'
2828
- 'webpack.config.js'
29+
- 'tools/gutenberg/**'
30+
- 'tools/vendors/**'
2931
- 'tools/webpack/**'
3032
# These files configure Composer. Changes could affect the outcome.
3133
- 'composer.*'

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ wp-tests-config.php
3939
/src/wp-includes/css/*-rtl.css
4040
/src/wp-includes/blocks/*
4141
!/src/wp-includes/blocks/index.php
42-
/src/wp-includes/icons
42+
/src/wp-includes/images/icon-library
4343
/src/wp-includes/build
4444
/src/wp-includes/theme.json
4545
/packagehash.txt

Gruntfile.js

Lines changed: 89 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ module.exports = function(grunt) {
5555
'wp-includes/css/dist',
5656
'wp-includes/blocks/**/*',
5757
'!wp-includes/blocks/index.php',
58+
'wp-includes/images/icon-library',
59+
// Old location kept temporarily to ensure they are cleaned up.
5860
'wp-includes/icons',
5961
],
6062

@@ -601,7 +603,7 @@ module.exports = function(grunt) {
601603
src: 'vendor/composer/ca-bundle/res/cacert.pem',
602604
dest: SOURCE_DIR + 'wp-includes/certificates/ca-bundle.crt'
603605
},
604-
// Gutenberg PHP infrastructure files (routes.php, pages.php, constants.php, pages/, routes/).
606+
// Gutenberg PHP infrastructure files (routes.php, pages.php, constants.php, pages/).
605607
'gutenberg-php': {
606608
options: {
607609
process: function( content ) {
@@ -620,18 +622,32 @@ module.exports = function(grunt) {
620622
'pages.php',
621623
'constants.php',
622624
'pages/**/*.php',
623-
'routes/**/*.php',
624625
],
625626
dest: WORKING_DIR + 'wp-includes/build/',
626627
} ],
627628
},
629+
/*
630+
* Only copy files relevant to the routes specified in the registry file.
631+
*
632+
* While the registry file does not contain any experimental routes, the `gutenberg/build/routes` directory
633+
* includes the files for all registered routes. Only the files related to the routes specified in the
634+
* registry should be included in the WordPress build.
635+
*
636+
* The `src` list is populated at task runtime by `routes:setup`, which reads the registry after
637+
* `gutenberg:download` has run. See the `routes:setup` task registration for implementation details.
638+
*/
639+
routes: {
640+
expand: true,
641+
cwd: 'gutenberg/build',
642+
src: [],
643+
dest: WORKING_DIR + 'wp-includes/build/',
644+
},
628645
'gutenberg-js': {
629646
files: [ {
630647
expand: true,
631648
cwd: 'gutenberg/build',
632649
src: [
633650
'pages/**/*.js',
634-
'routes/**/*.js',
635651
],
636652
dest: WORKING_DIR + 'wp-includes/build/',
637653
} ],
@@ -643,9 +659,7 @@ module.exports = function(grunt) {
643659
src: [
644660
'**/*',
645661
'!**/*.map',
646-
// Skip non-minified VIPS files — they are ~16MB of inlined WASM
647-
// with no debugging value over the minified versions.
648-
'!vips/!(*.min).js',
662+
'!vips/**',
649663
],
650664
dest: WORKING_DIR + 'wp-includes/js/dist/script-modules/',
651665
} ],
@@ -682,31 +696,35 @@ module.exports = function(grunt) {
682696
},
683697
],
684698
},
685-
'gutenberg-icons': {
699+
'icon-library-images': {
700+
files: [ {
701+
expand: true,
702+
cwd: 'gutenberg/packages/icons/src/library',
703+
src: '*.svg',
704+
dest: WORKING_DIR + 'wp-includes/images/icon-library',
705+
} ],
706+
},
707+
'icon-library-manifest': {
686708
options: {
687-
process: function( content, srcpath ) {
688-
// Remove the 'gutenberg' text domain from _x() calls in manifest.php.
689-
if ( path.basename( srcpath ) === 'manifest.php' ) {
690-
return content.replace(
709+
process: function( content ) {
710+
return content
711+
// Remove the 'gutenberg' text domain from _x() calls.
712+
.replace(
691713
/_x\(\s*([^,]+),\s*([^,]+),\s*['"]gutenberg['"]\s*\)/g,
692714
'_x( $1, $2 )'
715+
)
716+
// Strip the 'library/' prefix from filePath values so they
717+
// resolve correctly relative to wp-includes/images/icon-library/.
718+
.replace(
719+
/'filePath' => 'library\//g,
720+
'\'filePath\' => \''
693721
);
694-
}
695-
return content;
696722
}
697723
},
698-
files: [
699-
{
700-
src: 'gutenberg/packages/icons/src/manifest.php',
701-
dest: WORKING_DIR + 'wp-includes/icons/manifest.php',
702-
},
703-
{
704-
expand: true,
705-
cwd: 'gutenberg/packages/icons/src/library',
706-
src: '*.svg',
707-
dest: WORKING_DIR + 'wp-includes/icons/library/',
708-
},
709-
],
724+
files: [ {
725+
src: 'gutenberg/packages/icons/src/manifest.php',
726+
dest: WORKING_DIR + 'wp-includes/assets/icon-library-manifest.php',
727+
} ],
710728
},
711729
},
712730
sass: {
@@ -2052,14 +2070,59 @@ module.exports = function(grunt) {
20522070
} );
20532071
} );
20542072

2073+
grunt.registerTask( 'routes:setup', 'Reads the routes registry and configures the copy:routes task.', function() {
2074+
const registryPath = 'gutenberg/build/routes/registry.php';
2075+
let registryContent;
2076+
try {
2077+
registryContent = fs.readFileSync( registryPath, 'utf8' );
2078+
} catch ( e ) {
2079+
grunt.fatal(
2080+
'Route registry not found at ' + registryPath + '. Run `grunt gutenberg:download` first.'
2081+
);
2082+
}
2083+
const namePattern = /'name'\s*=>\s*'([^']+)'/g;
2084+
const routeNames = [];
2085+
let match;
2086+
while ( ( match = namePattern.exec( registryContent ) ) !== null ) {
2087+
routeNames.push( match[ 1 ] );
2088+
}
2089+
2090+
if ( routeNames.length === 0 ) {
2091+
grunt.fatal(
2092+
'No route names found in ' + registryPath + '. The format of the file may have changed.'
2093+
);
2094+
}
2095+
2096+
const validName = /^[A-Za-z0-9_-]+$/;
2097+
routeNames.forEach( function( name ) {
2098+
if ( ! validName.test( name ) ) {
2099+
grunt.fatal(
2100+
'Invalid route name \'' + name + '\' in ' + registryPath + '. Expected only letters, digits, hyphens, and underscores.'
2101+
);
2102+
}
2103+
} );
2104+
2105+
grunt.config( [ 'copy', 'routes', 'src' ], [ 'routes/registry.php' ].concat(
2106+
routeNames.flatMap( function( name ) {
2107+
return [
2108+
'routes/' + name + '/**/*.php',
2109+
'routes/' + name + '/**/*.js',
2110+
];
2111+
} )
2112+
) );
2113+
} );
2114+
20552115
grunt.registerTask( 'build:gutenberg', [
20562116
'copy:gutenberg-php',
2117+
'routes:setup',
2118+
'copy:routes',
20572119
'copy:gutenberg-js',
20582120
'gutenberg:copy',
20592121
'copy:gutenberg-modules',
20602122
'copy:gutenberg-styles',
20612123
'copy:gutenberg-theme-json',
2062-
'copy:gutenberg-icons',
2124+
'copy:icon-library-images',
2125+
'copy:icon-library-manifest',
20632126
] );
20642127

20652128
grunt.registerTask( 'build', function() {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"url": "https://develop.svn.wordpress.org/trunk"
88
},
99
"gutenberg": {
10-
"sha": "487a096a9782ba6110a7686d7b4b2d0c55ed1b06",
10+
"sha": "2ee7ede6be6d4e55d5c7047394c5c4e0ea8d521d",
1111
"ghcrRepo": "WordPress/gutenberg/gutenberg-wp-develop-build"
1212
},
1313
"engines": {

0 commit comments

Comments
 (0)