Changeset 61492
- Timestamp:
- 01/16/2026 10:30:09 AM (13 days ago)
- Location:
- trunk
- Files:
-
- 1 added
- 14 edited
-
.gitignore (modified) (1 diff)
-
Gruntfile.js (modified) (3 diffs)
-
package.json (modified) (3 diffs)
-
src/index.php (modified) (1 diff)
-
src/wp-admin/font-library.php (modified) (2 diffs)
-
src/wp-admin/index.php (modified) (1 diff)
-
src/wp-includes/blocks.php (modified) (1 diff)
-
src/wp-includes/blocks/index.php (modified) (4 diffs)
-
src/wp-includes/formatting.php (modified) (1 diff)
-
src/wp-includes/script-loader.php (modified) (1 diff)
-
src/wp-includes/script-modules.php (modified) (1 diff)
-
src/wp-settings.php (modified) (2 diffs)
-
tools/gutenberg/build-gutenberg.js (modified) (1 diff)
-
tools/gutenberg/copy-gutenberg-build.js (modified) (7 diffs)
-
tools/gutenberg/sync-gutenberg.js (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/.gitignore
r61439 r61492 44 44 /src/wp-includes/theme.json 45 45 /packagehash.txt 46 /.gutenberg-hash 46 47 /artifacts 47 48 /setup.log -
trunk/Gruntfile.js
r61475 r61492 1459 1459 } ); 1460 1460 1461 grunt.registerTask( 'gutenberg-integrate', 'Complete Gutenberg integration workflow.', [ 1462 'gutenberg-build', 1463 'gutenberg-copy' 1464 ] ); 1461 grunt.registerTask( 'gutenberg-sync', 'Syncs Gutenberg checkout and build if ref has changed.', function() { 1462 const done = this.async(); 1463 grunt.util.spawn( { 1464 cmd: 'node', 1465 args: [ 'tools/gutenberg/sync-gutenberg.js' ], 1466 opts: { stdio: 'inherit' } 1467 }, function( error ) { 1468 done( ! error ); 1469 } ); 1470 } ); 1465 1471 1466 1472 grunt.registerTask( 'copy-vendor-scripts', 'Copies vendor scripts from node_modules to wp-includes/js/dist/vendor/.', function() { … … 1897 1903 'build:js', 1898 1904 'build:css', 1899 'gutenberg-integrate', 1905 'gutenberg-sync', 1906 'gutenberg-copy', 1900 1907 'copy-vendor-scripts', 1901 1908 'build:certificates' … … 1907 1914 'build:js', 1908 1915 'build:css', 1909 'gutenberg-integrate', 1916 'gutenberg-sync', 1917 'gutenberg-copy', 1910 1918 'copy-vendor-scripts', 1911 1919 'replace:source-maps', -
trunk/package.json
r61487 r61492 8 8 }, 9 9 "gutenberg": { 10 "ref": " 892bfad51d2261f44f3a21f934b1c72bd29a2449"10 "ref": "7bf80ea84eb8b62eceb1bb3fe82e42163673ca79" 11 11 }, 12 12 "engines": { … … 100 100 }, 101 101 "scripts": { 102 "postinstall": "npm run gutenberg: checkout",102 "postinstall": "npm run gutenberg:sync && npm run gutenberg:copy -- --dev", 103 103 "build": "grunt build", 104 104 "build:dev": "grunt build --dev", … … 127 127 "gutenberg:build": "node tools/gutenberg/build-gutenberg.js", 128 128 "gutenberg:copy": "node tools/gutenberg/copy-gutenberg-build.js", 129 "gutenberg: integrate": "npm run gutenberg:checkout && npm run gutenberg:build && npm run gutenberg:copy",129 "gutenberg:sync": "node tools/gutenberg/sync-gutenberg.js", 130 130 "vendor:copy": "node tools/vendors/copy-vendors.js", 131 131 "sync-gutenberg-packages": "grunt sync-gutenberg-packages", -
trunk/src/index.php
r56241 r61492 16 16 * Note: WPINC is not defined yet, it is defined later in wp-settings.php. 17 17 */ 18 if ( file_exists( ABSPATH . 'wp-includes/js/ dist/edit-post.js' ) ) {18 if ( file_exists( ABSPATH . 'wp-includes/js/jquery/jquery.js' ) && is_dir( ABSPATH . 'wp-includes/build' ) ) { 19 19 require_once ABSPATH . '_index.php'; 20 20 return; -
trunk/src/wp-admin/font-library.php
r61438 r61492 20 20 21 21 // Check if Gutenberg build files are available 22 if ( ! function_exists( ' font_library_wp_admin_render_page' ) ) {22 if ( ! function_exists( 'wp_font_library_wp_admin_render_page' ) ) { 23 23 wp_die( 24 24 '<h1>' . __( 'Font Library is not available.' ) . '</h1>' . 25 '<p>' . __( 'The Font Library requires Gutenberg integration. Please run <code>npm run gutenberg:integrate</code> to build the necessary files.' ) . '</p>',25 '<p>' . __( 'The Font Library requires Gutenberg build files. Please run <code>npm install</code> to build the necessary files.' ) . '</p>', 26 26 503 27 27 ); … … 34 34 35 35 // Render the Font Library page 36 font_library_wp_admin_render_page();36 wp_font_library_wp_admin_render_page(); 37 37 38 38 require_once ABSPATH . 'wp-admin/admin-footer.php'; -
trunk/src/wp-admin/index.php
r52352 r61492 7 7 */ 8 8 9 if ( file_exists( __DIR__ . '/../wp-includes/js/ dist/edit-post.js' ) ) {9 if ( file_exists( __DIR__ . '/../wp-includes/js/jquery/jquery.js' ) && is_dir( __DIR__ . '/../wp-includes/build' ) ) { 10 10 require_once __DIR__ . '/_index.php'; 11 11 return; -
trunk/src/wp-includes/blocks.php
r61431 r61492 2422 2422 $parser_class = apply_filters( 'block_parser_class', 'WP_Block_Parser' ); 2423 2423 2424 if ( ! class_exists( $parser_class ) ) { 2425 return array(); 2426 } 2427 2424 2428 $parser = new $parser_class(); 2425 2429 return $parser->parse( $content ); -
trunk/src/wp-includes/blocks/index.php
r59159 r61492 14 14 15 15 // Include files required for core blocks registration. 16 require BLOCKS_PATH . 'legacy-widget.php'; 17 require BLOCKS_PATH . 'widget-group.php'; 18 require BLOCKS_PATH . 'require-dynamic-blocks.php'; 16 if ( file_exists( BLOCKS_PATH . 'legacy-widget.php' ) ) { 17 require BLOCKS_PATH . 'legacy-widget.php'; 18 } 19 if ( file_exists( BLOCKS_PATH . 'widget-group.php' ) ) { 20 require BLOCKS_PATH . 'widget-group.php'; 21 } 22 if ( file_exists( BLOCKS_PATH . 'require-dynamic-blocks.php' ) ) { 23 require BLOCKS_PATH . 'require-dynamic-blocks.php'; 24 } 19 25 20 26 /** … … 44 50 static $core_blocks_meta; 45 51 if ( ! $core_blocks_meta ) { 52 if ( ! file_exists( BLOCKS_PATH . 'blocks-json.php' ) ) { 53 return; 54 } 46 55 $core_blocks_meta = require BLOCKS_PATH . 'blocks-json.php'; 47 56 } … … 151 160 */ 152 161 function register_core_block_types_from_metadata() { 162 if ( ! file_exists( BLOCKS_PATH . 'require-static-blocks.php' ) ) { 163 return; 164 } 153 165 $block_folders = require BLOCKS_PATH . 'require-static-blocks.php'; 154 166 foreach ( $block_folders as $block_folder ) { … … 170 182 */ 171 183 function wp_register_core_block_metadata_collection() { 184 if ( ! file_exists( BLOCKS_PATH . 'blocks-json.php' ) ) { 185 return; 186 } 172 187 wp_register_block_metadata_collection( 173 188 BLOCKS_PATH, -
trunk/src/wp-includes/formatting.php
r61436 r61492 5228 5228 */ 5229 5229 function wp_pre_kses_block_attributes( $content, $allowed_html, $allowed_protocols ) { 5230 // If the block parser isn't available, skip block attribute filtering. 5231 if ( ! class_exists( 'WP_Block_Parser' ) ) { 5232 return $content; 5233 } 5234 5230 5235 /* 5231 5236 * `filter_block_content` is expected to call `wp_kses`. Temporarily remove -
trunk/src/wp-includes/script-loader.php
r61491 r61492 282 282 * 'api-fetch.js' => array(... 283 283 */ 284 $assets = include ABSPATH . WPINC . "/assets/script-loader-packages{$suffix}.php"; 284 $assets_file = ABSPATH . WPINC . "/assets/script-loader-packages{$suffix}.php"; 285 $assets = file_exists( $assets_file ) ? include $assets_file : array(); 285 286 286 287 foreach ( $assets as $file_name => $package_data ) { -
trunk/src/wp-includes/script-modules.php
r61438 r61492 154 154 * 'block-library/navigation/view.min.js' => … 155 155 */ 156 $assets = include ABSPATH . WPINC . "/assets/script-modules-packages{$suffix}.php"; 156 $assets_file = ABSPATH . WPINC . "/assets/script-modules-packages{$suffix}.php"; 157 $assets = file_exists( $assets_file ) ? include $assets_file : array(); 157 158 158 159 foreach ( $assets as $file_name => $script_module_data ) { -
trunk/src/wp-settings.php
r61491 r61492 243 243 require ABSPATH . WPINC . '/deprecated.php'; 244 244 require ABSPATH . WPINC . '/script-loader.php'; 245 require ABSPATH . WPINC . '/build/routes.php'; 246 require ABSPATH . WPINC . '/build/pages.php'; 245 if ( file_exists( ABSPATH . WPINC . '/build/routes.php' ) ) { 246 require ABSPATH . WPINC . '/build/routes.php'; 247 } 248 if ( file_exists( ABSPATH . WPINC . '/build/pages.php' ) ) { 249 require ABSPATH . WPINC . '/build/pages.php'; 250 } 247 251 require ABSPATH . WPINC . '/taxonomy.php'; 248 252 require ABSPATH . WPINC . '/class-wp-taxonomy.php'; … … 374 378 require ABSPATH . WPINC . '/class-wp-block-list.php'; 375 379 require ABSPATH . WPINC . '/class-wp-block-metadata-registry.php'; 376 require ABSPATH . WPINC . '/class-wp-block-parser-block.php'; 377 require ABSPATH . WPINC . '/class-wp-block-parser-frame.php'; 378 require ABSPATH . WPINC . '/class-wp-block-parser.php'; 380 if ( file_exists( ABSPATH . WPINC . '/class-wp-block-parser-block.php' ) ) { 381 require ABSPATH . WPINC . '/class-wp-block-parser-block.php'; 382 } 383 if ( file_exists( ABSPATH . WPINC . '/class-wp-block-parser-frame.php' ) ) { 384 require ABSPATH . WPINC . '/class-wp-block-parser-frame.php'; 385 } 386 if ( file_exists( ABSPATH . WPINC . '/class-wp-block-parser.php' ) ) { 387 require ABSPATH . WPINC . '/class-wp-block-parser.php'; 388 } 379 389 require ABSPATH . WPINC . '/class-wp-classic-to-block-menu-converter.php'; 380 390 require ABSPATH . WPINC . '/class-wp-navigation-fallback.php'; -
trunk/tools/gutenberg/build-gutenberg.js
r61450 r61492 157 157 } catch ( error ) { 158 158 console.error( '❌ Build failed:', error.message ); 159 process.exit( 1 ); 159 throw error; 160 } finally { 161 // Restore Gutenberg's package.json regardless of success or failure 162 await restorePackageJson(); 163 } 164 } 165 166 /** 167 * Restore Gutenberg's package.json to its original state. 168 */ 169 async function restorePackageJson() { 170 console.log( '\n🔄 Restoring Gutenberg package.json...' ); 171 try { 172 await exec( 'git', [ 'checkout', '--', 'package.json' ], { 173 cwd: gutenbergDir, 174 } ); 175 console.log( '✅ package.json restored' ); 176 } catch ( error ) { 177 console.warn( '⚠️ Could not restore package.json:', error.message ); 160 178 } 161 179 } -
trunk/tools/gutenberg/copy-gutenberg-build.js
r61438 r61492 49 49 destination: 'js/dist', 50 50 copyDirectories: true, // Copy subdirectories 51 patterns: [ '*.js' , '*.js.map'],51 patterns: [ '*.js' ], 52 52 // Rename vendors/ to vendor/ when copying 53 53 directoryRenames: { … … 917 917 const vendorFiles = fs.readdirSync( src ); 918 918 let copiedCount = 0; 919 fs.mkdirSync( dest, { recursive: true } ); 919 920 for ( const file of vendorFiles ) { 920 if ( file.startsWith( 'react-jsx-runtime' ) ) { 921 if ( 922 file.startsWith( 'react-jsx-runtime' ) && 923 file.endsWith( '.js' ) 924 ) { 921 925 const srcFile = path.join( src, file ); 922 926 const destFile = path.join( dest, file ); 923 fs.mkdirSync( dest, { recursive: true } ); 924 925 if ( 926 file.endsWith( '.js' ) && 927 ! file.endsWith( '.js.map' ) 928 ) { 929 let content = fs.readFileSync( 930 srcFile, 931 'utf8' 932 ); 933 content = removeSourceMaps( content ); 934 fs.writeFileSync( destFile, content ); 935 } else { 936 fs.copyFileSync( srcFile, destFile ); 937 } 927 928 let content = fs.readFileSync( 929 srcFile, 930 'utf8' 931 ); 932 content = removeSourceMaps( content ); 933 fs.writeFileSync( destFile, content ); 938 934 copiedCount++; 939 935 } … … 956 952 for ( const file of packageFiles ) { 957 953 if ( 958 /^index\.(js|js\.map|min\.js|min\.js\.map|min\.asset\.php)$/.test( 959 file 960 ) 954 /^index\.(js|min\.js|min\.asset\.php)$/.test( file ) 961 955 ) { 962 956 const srcFile = path.join( src, file ); … … 973 967 974 968 // Apply source map removal for .js files 975 if ( 976 file.endsWith( '.js' ) && 977 ! file.endsWith( '.js.map' ) 978 ) { 969 if ( file.endsWith( '.js' ) ) { 979 970 let content = fs.readFileSync( 980 971 srcFile, … … 984 975 fs.writeFileSync( destPath, content ); 985 976 } else { 986 // Copy other files as-is 977 // Copy other files as-is (.min.asset.php) 987 978 fs.copyFileSync( srcFile, destPath ); 988 979 } … … 992 983 } else if ( 993 984 entry.isFile() && 994 /\.(js|js\.map)$/.test( entry.name)985 entry.name.endsWith( '.js' ) 995 986 ) { 996 987 // Copy root-level JS files … … 998 989 fs.mkdirSync( path.dirname( dest ), { recursive: true } ); 999 990 1000 if ( 1001 entry.name.endsWith( '.js' ) && 1002 ! entry.name.endsWith( '.js.map' ) 1003 ) { 1004 let content = fs.readFileSync( src, 'utf8' ); 1005 content = removeSourceMaps( content ); 1006 fs.writeFileSync( dest, content ); 1007 } else { 1008 fs.copyFileSync( src, dest ); 1009 } 991 let content = fs.readFileSync( src, 'utf8' ); 992 content = removeSourceMaps( content ); 993 fs.writeFileSync( dest, content ); 1010 994 } 1011 995 }
Note: See TracChangeset
for help on using the changeset viewer.