@@ -38,13 +38,6 @@ const wpIncludesDir = path.join( rootDir, buildTarget, 'wp-includes' );
3838 * Defines what to copy from Gutenberg build and where it goes in Core.
3939 */
4040const COPY_CONFIG = {
41- // PHP infrastructure files (to wp-includes/build/).
42- phpInfrastructure : {
43- destination : 'build' ,
44- files : [ 'routes.php' , 'pages.php' , 'constants.php' ] ,
45- directories : [ 'pages' , 'routes' ] ,
46- } ,
47-
4841 // JavaScript packages (to wp-includes/js/dist/).
4942 scripts : {
5043 source : 'scripts' ,
@@ -56,18 +49,6 @@ const COPY_CONFIG = {
5649 } ,
5750 } ,
5851
59- // Script modules (to wp-includes/js/dist/script-modules/).
60- modules : {
61- source : 'modules' ,
62- destination : 'js/dist/script-modules' ,
63- } ,
64-
65- // Styles (to wp-includes/css/dist/).
66- styles : {
67- source : 'styles' ,
68- destination : 'css/dist' ,
69- } ,
70-
7152 /*
7253 * Blocks (to wp-includes/blocks/).
7354 * Unified configuration for all block types.
@@ -91,27 +72,6 @@ const COPY_CONFIG = {
9172 } ,
9273 ] ,
9374 } ,
94-
95- // Theme JSON files (from Gutenberg lib directory).
96- themeJson : {
97- files : [
98- { from : 'theme.json' , to : 'theme.json' } ,
99- { from : 'theme-i18n.json' , to : 'theme-i18n.json' } ,
100- ] ,
101- transform : true ,
102- } ,
103-
104- // Specific files to copy to wp-includes/$destination.
105- wpIncludes : [
106- {
107- files : [ 'packages/icons/src/manifest.php' ] ,
108- destination : 'icons' ,
109- } ,
110- {
111- files : [ 'packages/icons/src/library/*.svg' ] ,
112- destination : 'icons/library' ,
113- } ,
114- ] ,
11575} ;
11676
11777/**
@@ -170,83 +130,6 @@ function isExperimentalBlock( blockJsonPath ) {
170130 }
171131}
172132
173- /**
174- * Recursively copy directory.
175- *
176- * @param {string } src - Source directory.
177- * @param {string } dest - Destination directory.
178- * @param {Function } transform - Optional transform function for file contents.
179- * @param {Object } options - Optional configuration.
180- * @param {boolean } options.excludePHP - Skip PHP files.
181- * @param {boolean } options.excludeExperimental - Skip experimental blocks.
182- */
183- function copyDirectory ( src , dest , transform = null , options = { } ) {
184- if ( ! fs . existsSync ( src ) ) {
185- return ;
186- }
187-
188- fs . mkdirSync ( dest , { recursive : true } ) ;
189-
190- const entries = fs . readdirSync ( src , { withFileTypes : true } ) ;
191-
192- for ( const entry of entries ) {
193- const srcPath = path . join ( src , entry . name ) ;
194- const destPath = path . join ( dest , entry . name ) ;
195-
196- if ( entry . isDirectory ( ) ) {
197- // Check if this directory is an experimental block.
198- if ( options . excludeExperimental ) {
199- const blockJsonPath = path . join ( srcPath , 'block.json' ) ;
200- if ( isExperimentalBlock ( blockJsonPath ) ) {
201- continue ;
202- }
203- }
204-
205- copyDirectory ( srcPath , destPath , transform , options ) ;
206- } else {
207- // Skip source map files (.map) — these are not useful in Core,
208- // and the sourceMappingURL references are already stripped from JS files.
209- if ( / \. m a p $ / . test ( entry . name ) ) {
210- continue ;
211- }
212-
213- // Skip non-minified VIPS files — they are ~10MB of inlined WASM,
214- // with no debugging value over the minified versions.
215- if (
216- srcPath . includes ( '/vips/' ) &&
217- / (?< ! \. m i n ) \. j s $ / . test ( entry . name )
218- ) {
219- continue ;
220- }
221-
222- // Skip PHP files if excludePHP is true.
223- if ( options . excludePHP && / \. p h p $ / . test ( entry . name ) ) {
224- continue ;
225- }
226-
227- let content = fs . readFileSync ( srcPath ) ;
228-
229- // Apply transformation if provided and file is text.
230- if ( transform && / \. ( p h p | j s | c s s ) $ / . test ( entry . name ) ) {
231- try {
232- content = transform (
233- content . toString ( ) ,
234- srcPath ,
235- destPath
236- ) ;
237- } catch ( error ) {
238- console . error (
239- ` ⚠️ Transform error in ${ entry . name } :` ,
240- error . message
241- ) ;
242- }
243- }
244-
245- fs . writeFileSync ( destPath , content ) ;
246- }
247- }
248- }
249-
250133/**
251134 * Copy all assets for blocks from Gutenberg to Core.
252135 * Handles scripts, styles, PHP, and JSON for all block types in a unified way.
@@ -743,12 +626,6 @@ async function main() {
743626 console . log (
744627 ` ✅ ${ entry . name } / → ${ destName } / (react-jsx-runtime only, ${ copiedCount } files)`
745628 ) ;
746- } else {
747- // Copy other special directories normally.
748- copyDirectory ( src , dest ) ;
749- console . log (
750- ` ✅ ${ entry . name } / → ${ destName } /`
751- ) ;
752629 }
753630 } else {
754631 /*
0 commit comments