Skip to content

Commit 10eda66

Browse files
authored
Merge branch 'WordPress:trunk' into toolbar-sass-front-end
2 parents fa065da + 117af7e commit 10eda66

83 files changed

Lines changed: 1826 additions & 2308 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: 95 additions & 27 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

@@ -602,7 +604,7 @@ module.exports = function(grunt) {
602604
src: 'vendor/composer/ca-bundle/res/cacert.pem',
603605
dest: SOURCE_DIR + 'wp-includes/certificates/ca-bundle.crt'
604606
},
605-
// Gutenberg PHP infrastructure files (routes.php, pages.php, constants.php, pages/, routes/).
607+
// Gutenberg PHP infrastructure files (routes.php, pages.php, constants.php, pages/).
606608
'gutenberg-php': {
607609
options: {
608610
process: function( content ) {
@@ -621,18 +623,32 @@ module.exports = function(grunt) {
621623
'pages.php',
622624
'constants.php',
623625
'pages/**/*.php',
624-
'routes/**/*.php',
625626
],
626627
dest: WORKING_DIR + 'wp-includes/build/',
627628
} ],
628629
},
630+
/*
631+
* Only copy files relevant to the routes specified in the registry file.
632+
*
633+
* While the registry file does not contain any experimental routes, the `gutenberg/build/routes` directory
634+
* includes the files for all registered routes. Only the files related to the routes specified in the
635+
* registry should be included in the WordPress build.
636+
*
637+
* The `src` list is populated at task runtime by `routes:setup`, which reads the registry after
638+
* `gutenberg:download` has run. See the `routes:setup` task registration for implementation details.
639+
*/
640+
routes: {
641+
expand: true,
642+
cwd: 'gutenberg/build',
643+
src: [],
644+
dest: WORKING_DIR + 'wp-includes/build/',
645+
},
629646
'gutenberg-js': {
630647
files: [ {
631648
expand: true,
632649
cwd: 'gutenberg/build',
633650
src: [
634651
'pages/**/*.js',
635-
'routes/**/*.js',
636652
],
637653
dest: WORKING_DIR + 'wp-includes/build/',
638654
} ],
@@ -644,9 +660,7 @@ module.exports = function(grunt) {
644660
src: [
645661
'**/*',
646662
'!**/*.map',
647-
// Skip non-minified VIPS files — they are ~16MB of inlined WASM
648-
// with no debugging value over the minified versions.
649-
'!vips/!(*.min).js',
663+
'!vips/**',
650664
],
651665
dest: WORKING_DIR + 'wp-includes/js/dist/script-modules/',
652666
} ],
@@ -655,7 +669,12 @@ module.exports = function(grunt) {
655669
files: [ {
656670
expand: true,
657671
cwd: 'gutenberg/build/styles',
658-
src: [ '**/*', '!**/*.map' ],
672+
src: [
673+
'**/*',
674+
'!**/*.map',
675+
// Per-block CSS is copied to wp-includes/blocks/ by tools/gutenberg/copy.js.
676+
'!block-library/*/**',
677+
],
659678
dest: WORKING_DIR + 'wp-includes/css/dist/',
660679
} ],
661680
},
@@ -683,31 +702,35 @@ module.exports = function(grunt) {
683702
},
684703
],
685704
},
686-
'gutenberg-icons': {
705+
'icon-library-images': {
706+
files: [ {
707+
expand: true,
708+
cwd: 'gutenberg/packages/icons/src/library',
709+
src: '*.svg',
710+
dest: WORKING_DIR + 'wp-includes/images/icon-library',
711+
} ],
712+
},
713+
'icon-library-manifest': {
687714
options: {
688-
process: function( content, srcpath ) {
689-
// Remove the 'gutenberg' text domain from _x() calls in manifest.php.
690-
if ( path.basename( srcpath ) === 'manifest.php' ) {
691-
return content.replace(
715+
process: function( content ) {
716+
return content
717+
// Remove the 'gutenberg' text domain from _x() calls.
718+
.replace(
692719
/_x\(\s*([^,]+),\s*([^,]+),\s*['"]gutenberg['"]\s*\)/g,
693720
'_x( $1, $2 )'
721+
)
722+
// Strip the 'library/' prefix from filePath values so they
723+
// resolve correctly relative to wp-includes/images/icon-library/.
724+
.replace(
725+
/'filePath' => 'library\//g,
726+
'\'filePath\' => \''
694727
);
695-
}
696-
return content;
697728
}
698729
},
699-
files: [
700-
{
701-
src: 'gutenberg/packages/icons/src/manifest.php',
702-
dest: WORKING_DIR + 'wp-includes/icons/manifest.php',
703-
},
704-
{
705-
expand: true,
706-
cwd: 'gutenberg/packages/icons/src/library',
707-
src: '*.svg',
708-
dest: WORKING_DIR + 'wp-includes/icons/library/',
709-
},
710-
],
730+
files: [ {
731+
src: 'gutenberg/packages/icons/src/manifest.php',
732+
dest: WORKING_DIR + 'wp-includes/assets/icon-library-manifest.php',
733+
} ],
711734
},
712735
},
713736
sass: {
@@ -2057,14 +2080,59 @@ module.exports = function(grunt) {
20572080
} );
20582081
} );
20592082

2083+
grunt.registerTask( 'routes:setup', 'Reads the routes registry and configures the copy:routes task.', function() {
2084+
const registryPath = 'gutenberg/build/routes/registry.php';
2085+
let registryContent;
2086+
try {
2087+
registryContent = fs.readFileSync( registryPath, 'utf8' );
2088+
} catch ( e ) {
2089+
grunt.fatal(
2090+
'Route registry not found at ' + registryPath + '. Run `grunt gutenberg:download` first.'
2091+
);
2092+
}
2093+
const namePattern = /'name'\s*=>\s*'([^']+)'/g;
2094+
const routeNames = [];
2095+
let match;
2096+
while ( ( match = namePattern.exec( registryContent ) ) !== null ) {
2097+
routeNames.push( match[ 1 ] );
2098+
}
2099+
2100+
if ( routeNames.length === 0 ) {
2101+
grunt.fatal(
2102+
'No route names found in ' + registryPath + '. The format of the file may have changed.'
2103+
);
2104+
}
2105+
2106+
const validName = /^[A-Za-z0-9_-]+$/;
2107+
routeNames.forEach( function( name ) {
2108+
if ( ! validName.test( name ) ) {
2109+
grunt.fatal(
2110+
'Invalid route name \'' + name + '\' in ' + registryPath + '. Expected only letters, digits, hyphens, and underscores.'
2111+
);
2112+
}
2113+
} );
2114+
2115+
grunt.config( [ 'copy', 'routes', 'src' ], [ 'routes/registry.php' ].concat(
2116+
routeNames.flatMap( function( name ) {
2117+
return [
2118+
'routes/' + name + '/**/*.php',
2119+
'routes/' + name + '/**/*.js',
2120+
];
2121+
} )
2122+
) );
2123+
} );
2124+
20602125
grunt.registerTask( 'build:gutenberg', [
20612126
'copy:gutenberg-php',
2127+
'routes:setup',
2128+
'copy:routes',
20622129
'copy:gutenberg-js',
20632130
'gutenberg:copy',
20642131
'copy:gutenberg-modules',
20652132
'copy:gutenberg-styles',
20662133
'copy:gutenberg-theme-json',
2067-
'copy:gutenberg-icons',
2134+
'copy:icon-library-images',
2135+
'copy:icon-library-manifest',
20682136
] );
20692137

20702138
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": "3edafcc90fc4520939d69279e26ace69390582be",
1111
"ghcrRepo": "WordPress/gutenberg/gutenberg-wp-develop-build"
1212
},
1313
"engines": {

0 commit comments

Comments
 (0)