Skip to content

Commit e9da6d7

Browse files
authored
Merge branch 'trunk' into add-fatal-error-to-email
2 parents 1fbaf55 + 08be276 commit e9da6d7

641 files changed

Lines changed: 52106 additions & 2535 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: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,16 @@ wp-tests-config.php
3333
/src/wp-admin/css/colors/*/*.css
3434
/src/wp-admin/js
3535
/src/wp-includes/assets/*
36+
!/src/wp-includes/assets/icon-library-manifest.php
37+
!/src/wp-includes/assets/script-loader-packages.php
38+
!/src/wp-includes/assets/script-modules-packages.php
3639
/src/wp-includes/js
3740
/src/wp-includes/css/dist
3841
/src/wp-includes/css/*.min.css
3942
/src/wp-includes/css/*-rtl.css
40-
/src/wp-includes/blocks/*
41-
!/src/wp-includes/blocks/index.php
42-
/src/wp-includes/icons
43-
/src/wp-includes/build
44-
/src/wp-includes/theme.json
43+
/src/wp-includes/blocks/**/*.css
44+
/src/wp-includes/blocks/**/*.js
45+
/src/wp-includes/blocks/**/*.js.map
4546
/packagehash.txt
4647
/.gutenberg-hash
4748
/artifacts

Gruntfile.js

Lines changed: 96 additions & 28 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
} ],
@@ -654,7 +668,12 @@ module.exports = function(grunt) {
654668
files: [ {
655669
expand: true,
656670
cwd: 'gutenberg/build/styles',
657-
src: [ '**/*', '!**/*.map' ],
671+
src: [
672+
'**/*',
673+
'!**/*.map',
674+
// Per-block CSS is copied to wp-includes/blocks/ by tools/gutenberg/copy.js.
675+
'!block-library/*/**',
676+
],
658677
dest: WORKING_DIR + 'wp-includes/css/dist/',
659678
} ],
660679
},
@@ -682,31 +701,35 @@ module.exports = function(grunt) {
682701
},
683702
],
684703
},
685-
'gutenberg-icons': {
704+
'icon-library-images': {
705+
files: [ {
706+
expand: true,
707+
cwd: 'gutenberg/packages/icons/src/library',
708+
src: '*.svg',
709+
dest: WORKING_DIR + 'wp-includes/images/icon-library',
710+
} ],
711+
},
712+
'icon-library-manifest': {
686713
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(
714+
process: function( content ) {
715+
return content
716+
// Remove the 'gutenberg' text domain from _x() calls.
717+
.replace(
691718
/_x\(\s*([^,]+),\s*([^,]+),\s*['"]gutenberg['"]\s*\)/g,
692719
'_x( $1, $2 )'
720+
)
721+
// Strip the 'library/' prefix from filePath values so they
722+
// resolve correctly relative to wp-includes/images/icon-library/.
723+
.replace(
724+
/'filePath' => 'library\//g,
725+
'\'filePath\' => \''
693726
);
694-
}
695-
return content;
696727
}
697728
},
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-
],
729+
files: [ {
730+
src: 'gutenberg/packages/icons/src/manifest.php',
731+
dest: WORKING_DIR + 'wp-includes/assets/icon-library-manifest.php',
732+
} ],
710733
},
711734
},
712735
sass: {
@@ -2052,19 +2075,64 @@ module.exports = function(grunt) {
20522075
} );
20532076
} );
20542077

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

20652133
grunt.registerTask( 'build', function() {
20662134
var done = this.async();
2067-
2135+
20682136
grunt.util.spawn( {
20692137
grunt: true,
20702138
args: [ 'clean', '--dev' ],

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)