@@ -13,120 +13,36 @@ const DependencyExtractionPlugin = require( '@wordpress/dependency-extraction-we
13
13
* Internal dependencies
14
14
*/
15
15
const { normalizeJoin, stylesTransform, baseConfig, baseDir } = require ( './shared' ) ;
16
+ const {
17
+ isDynamic,
18
+ toDirectoryName,
19
+ getStableBlocksMetadata,
20
+ } = require ( '../release/sync-stable-blocks' ) ;
16
21
17
22
module . exports = function ( env = { environment : 'production' , watch : false , buildTarget : false } ) {
18
23
const mode = env . environment ;
19
24
const suffix = mode === 'production' ? '.min' : '' ;
20
25
let buildTarget = env . buildTarget ? env . buildTarget : ( mode === 'production' ? 'build' : 'src' ) ;
21
- buildTarget = buildTarget + '/wp-includes' ;
26
+ buildTarget = buildTarget + '/wp-includes' ;
22
27
23
- const dynamicBlockFolders = [
24
- 'archives' ,
25
- 'avatar' ,
26
- 'block' ,
27
- 'calendar' ,
28
- 'categories' ,
29
- 'comment-author-name' ,
30
- 'comment-content' ,
31
- 'comment-date' ,
32
- 'comment-edit-link' ,
33
- 'comment-reply-link' ,
34
- 'comment-template' ,
35
- 'comments' ,
36
- 'comments-pagination' ,
37
- 'comments-pagination-next' ,
38
- 'comments-pagination-numbers' ,
39
- 'comments-pagination-previous' ,
40
- 'comments-title' ,
41
- 'cover' ,
42
- 'file' ,
43
- 'gallery' ,
44
- 'home-link' ,
45
- 'image' ,
46
- 'latest-comments' ,
47
- 'latest-posts' ,
48
- 'loginout' ,
49
- 'navigation' ,
50
- 'navigation-link' ,
51
- 'navigation-submenu' ,
52
- 'page-list' ,
53
- 'pattern' ,
54
- 'post-author' ,
55
- 'post-author-biography' ,
56
- 'post-comments-form' ,
57
- 'post-content' ,
58
- 'post-date' ,
59
- 'post-excerpt' ,
60
- 'post-featured-image' ,
61
- 'post-navigation-link' ,
62
- 'post-template' ,
63
- 'post-terms' ,
64
- 'post-title' ,
65
- 'query' ,
66
- 'query-no-results' ,
67
- 'query-pagination' ,
68
- 'query-pagination-next' ,
69
- 'query-pagination-numbers' ,
70
- 'query-pagination-previous' ,
71
- 'query-title' ,
72
- 'read-more' ,
73
- 'rss' ,
74
- 'search' ,
75
- 'shortcode' ,
76
- 'site-logo' ,
77
- 'site-tagline' ,
78
- 'site-title' ,
79
- 'social-link' ,
80
- 'tag-cloud' ,
81
- 'template-part' ,
82
- 'term-description' ,
83
- ] ;
84
- const blockFolders = [
85
- 'audio' ,
86
- 'button' ,
87
- 'buttons' ,
88
- 'code' ,
89
- 'column' ,
90
- 'columns' ,
91
- 'embed' ,
92
- 'freeform' ,
93
- 'group' ,
94
- 'heading' ,
95
- 'html' ,
96
- 'list' ,
97
- 'list-item' ,
98
- 'media-text' ,
99
- 'missing' ,
100
- 'more' ,
101
- 'nextpage' ,
102
- 'paragraph' ,
103
- 'preformatted' ,
104
- 'pullquote' ,
105
- 'quote' ,
106
- 'separator' ,
107
- 'social-links' ,
108
- 'spacer' ,
109
- 'table' ,
110
- 'text-columns' ,
111
- 'verse' ,
112
- 'video' ,
113
- ...dynamicBlockFolders ,
114
- ] ;
28
+ const blocks = getStableBlocksMetadata ( ) ;
29
+ const dynamicBlockFolders = blocks . filter ( isDynamic ) . map ( toDirectoryName ) ;
30
+ const blockFolders = blocks . map ( toDirectoryName ) ;
115
31
const blockPHPFiles = {
116
32
'widgets/src/blocks/legacy-widget/index.php' : 'wp-includes/blocks/legacy-widget.php' ,
117
33
'widgets/src/blocks/widget-group/index.php' : 'wp-includes/blocks/widget-group.php' ,
118
34
...dynamicBlockFolders . reduce ( ( files , blockName ) => {
119
35
files [ `block-library/src/${ blockName } /index.php` ] = `wp-includes/blocks/${ blockName } .php` ;
120
36
return files ;
121
- } , { } ) ,
37
+ } , { } ) ,
122
38
} ;
123
39
const blockMetadataFiles = {
124
40
'widgets/src/blocks/legacy-widget/block.json' : 'wp-includes/blocks/legacy-widget/block.json' ,
125
41
'widgets/src/blocks/widget-group/block.json' : 'wp-includes/blocks/widget-group/block.json' ,
126
42
...blockFolders . reduce ( ( files , blockName ) => {
127
43
files [ `block-library/src/${ blockName } /block.json` ] = `wp-includes/blocks/${ blockName } /block.json` ;
128
44
return files ;
129
- } , { } ) ,
45
+ } , { } ) ,
130
46
} ;
131
47
132
48
const blockPHPCopies = Object . keys ( blockPHPFiles ) . map ( ( filename ) => ( {
@@ -163,7 +79,7 @@ module.exports = function( env = { environment: 'production', watch: false, buil
163
79
// Inject the `IS_GUTENBERG_PLUGIN` global, used for feature flagging.
164
80
'process.env.IS_GUTENBERG_PLUGIN' : false ,
165
81
'process.env.FORCE_REDUCED_MOTION' : JSON . stringify (
166
- process . env . FORCE_REDUCED_MOTION
82
+ process . env . FORCE_REDUCED_MOTION ,
167
83
) ,
168
84
} ) ,
169
85
new DependencyExtractionPlugin ( {
0 commit comments