@wordpress/create-block 4.62.0 → 4.63.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/init-package-json.js
CHANGED
|
@@ -42,17 +42,21 @@ module.exports = async ( {
|
|
|
42
42
|
main: wpScripts && 'build/index.js',
|
|
43
43
|
scripts: {
|
|
44
44
|
...( wpScripts && {
|
|
45
|
-
build:
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
build:
|
|
46
|
+
( isDynamicVariant
|
|
47
|
+
? 'wp-scripts build --webpack-copy-php'
|
|
48
|
+
: 'wp-scripts build' ) +
|
|
49
|
+
' && wp-scripts build-blocks-manifest',
|
|
48
50
|
format: 'wp-scripts format',
|
|
49
51
|
'lint:css': 'wp-scripts lint-style',
|
|
50
52
|
'lint:js': 'wp-scripts lint-js',
|
|
51
53
|
'packages-update': 'wp-scripts packages-update',
|
|
52
54
|
'plugin-zip': 'wp-scripts plugin-zip',
|
|
53
|
-
start:
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
start:
|
|
56
|
+
( isDynamicVariant
|
|
57
|
+
? 'wp-scripts start --webpack-copy-php'
|
|
58
|
+
: 'wp-scripts start' ) +
|
|
59
|
+
' && wp-scripts build-blocks-manifest',
|
|
56
60
|
} ),
|
|
57
61
|
...( wpEnv && { env: 'wp-env' } ),
|
|
58
62
|
...customScripts,
|
package/lib/init-wp-scripts.js
CHANGED
|
@@ -46,6 +46,21 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
|
46
46
|
* @see https://developer.wordpress.org/reference/functions/register_block_type/
|
|
47
47
|
*/
|
|
48
48
|
function {{namespaceSnakeCase}}_{{slugSnakeCase}}_block_init() {
|
|
49
|
+
{{#wpScripts}}
|
|
50
|
+
if ( function_exists( 'wp_register_block_types_from_metadata_collection' ) ) { // Function introduced in WordPress 6.8.
|
|
51
|
+
wp_register_block_types_from_metadata_collection( __DIR__ . '/build', __DIR__ . '/build/blocks-manifest.php' );
|
|
52
|
+
} else {
|
|
53
|
+
if ( function_exists( 'wp_register_block_metadata_collection' ) ) { // Function introduced in WordPress 6.7.
|
|
54
|
+
wp_register_block_metadata_collection( __DIR__ . '/build', __DIR__ . '/build/blocks-manifest.php' );
|
|
55
|
+
}
|
|
56
|
+
$manifest_data = require __DIR__ . '/build/blocks-manifest.php';
|
|
57
|
+
foreach ( array_keys( $manifest_data ) as $block_type ) {
|
|
58
|
+
register_block_type( __DIR__ . "/build/{$block_type}" );
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
{{/wpScripts}}
|
|
62
|
+
{{^wpScripts}}
|
|
49
63
|
register_block_type( __DIR__ . '/build/{{slug}}' );
|
|
64
|
+
{{/wpScripts}}
|
|
50
65
|
}
|
|
51
66
|
add_action( 'init', '{{namespaceSnakeCase}}_{{slugSnakeCase}}_block_init' );
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/create-block",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.63.0",
|
|
4
4
|
"description": "Generates PHP, JS and CSS code for registering a block for a WordPress plugin.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@inquirer/prompts": "^7.2.0",
|
|
35
|
-
"@wordpress/lazy-import": "^2.
|
|
35
|
+
"@wordpress/lazy-import": "^2.20.0",
|
|
36
36
|
"chalk": "^4.0.0",
|
|
37
37
|
"change-case": "^4.1.2",
|
|
38
38
|
"check-node-version": "^4.1.0",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "72476970386146d450c375e5c71a96dda7c9aaa8"
|
|
52
52
|
}
|