Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editor: Update the WordPress Packages to Gutenberg 17.6 RC3 #5984

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
438 changes: 219 additions & 219 deletions package-lock.json

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,37 +85,37 @@
"@wordpress/api-fetch": "6.47.0",
"@wordpress/autop": "3.50.0",
"@wordpress/blob": "3.50.0",
"@wordpress/block-directory": "4.27.1",
"@wordpress/block-editor": "12.18.1",
"@wordpress/block-library": "8.27.1",
"@wordpress/block-directory": "4.27.2",
"@wordpress/block-editor": "12.18.2",
"@wordpress/block-library": "8.27.2",
"@wordpress/block-serialization-default-parser": "4.50.0",
"@wordpress/blocks": "12.27.1",
"@wordpress/commands": "0.21.0",
"@wordpress/components": "25.16.0",
"@wordpress/compose": "6.27.0",
"@wordpress/core-commands": "0.19.1",
"@wordpress/core-data": "6.27.1",
"@wordpress/customize-widgets": "4.27.1",
"@wordpress/core-commands": "0.19.2",
"@wordpress/core-data": "6.27.2",
"@wordpress/customize-widgets": "4.27.2",
"@wordpress/data": "9.20.0",
"@wordpress/data-controls": "3.19.0",
"@wordpress/dataviews": "0.4.0",
"@wordpress/dataviews": "0.4.1",
"@wordpress/date": "4.50.0",
"@wordpress/deprecated": "3.50.0",
"@wordpress/dom": "3.50.0",
"@wordpress/dom-ready": "3.50.0",
"@wordpress/edit-post": "7.27.1",
"@wordpress/edit-site": "5.27.1",
"@wordpress/edit-widgets": "5.27.1",
"@wordpress/editor": "13.27.1",
"@wordpress/edit-post": "7.27.2",
"@wordpress/edit-site": "5.27.2",
"@wordpress/edit-widgets": "5.27.2",
"@wordpress/editor": "13.27.2",
"@wordpress/element": "5.27.0",
"@wordpress/escape-html": "2.50.0",
"@wordpress/format-library": "4.27.1",
"@wordpress/format-library": "4.27.2",
"@wordpress/hooks": "3.50.0",
"@wordpress/html-entities": "3.50.0",
"@wordpress/i18n": "4.50.0",
"@wordpress/icons": "9.41.0",
"@wordpress/interactivity": "4.0.0",
"@wordpress/interactivity-router": "1.0.0",
"@wordpress/interactivity": "4.0.1",
"@wordpress/interactivity-router": "1.0.1",
"@wordpress/interface": "5.27.0",
"@wordpress/is-shallow-equal": "4.50.0",
"@wordpress/keyboard-shortcuts": "4.27.0",
Expand All @@ -124,15 +124,15 @@
"@wordpress/media-utils": "4.41.0",
"@wordpress/notices": "4.18.0",
"@wordpress/nux": "8.12.0",
"@wordpress/patterns": "1.11.1",
"@wordpress/patterns": "1.11.2",
"@wordpress/plugins": "6.18.0",
"@wordpress/preferences": "3.27.0",
"@wordpress/preferences-persistence": "1.42.0",
"@wordpress/primitives": "3.48.0",
"@wordpress/priority-queue": "2.50.0",
"@wordpress/private-apis": "0.32.0",
"@wordpress/redux-routine": "4.50.0",
"@wordpress/reusable-blocks": "4.27.1",
"@wordpress/reusable-blocks": "4.27.2",
"@wordpress/rich-text": "6.27.0",
"@wordpress/router": "0.19.0",
"@wordpress/server-side-render": "4.27.1",
Expand All @@ -144,7 +144,7 @@
"@wordpress/url": "3.51.0",
"@wordpress/viewport": "5.27.0",
"@wordpress/warning": "2.50.0",
"@wordpress/widgets": "3.27.1",
"@wordpress/widgets": "3.27.2",
"@wordpress/wordcount": "3.50.0",
"backbone": "1.5.0",
"clipboard": "2.0.11",
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/assets/script-loader-packages.min.php

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion src/wp-includes/blocks/group/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
}
},
"dimensions": {
"aspectRatio": true,
"minHeight": true
},
"__experimentalBorder": {
Expand Down
22 changes: 9 additions & 13 deletions src/wp-includes/blocks/navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ private static function get_inner_blocks_from_navigation_post( $attributes ) {
// it encounters whitespace. This code strips it.
$blocks = block_core_navigation_filter_out_empty_blocks( $parsed_blocks );

if ( function_exists( 'get_hooked_blocks' ) ) {
if ( function_exists( 'get_hooked_block_markup' ) ) {
// Run Block Hooks algorithm to inject hooked blocks.
$markup = block_core_navigation_insert_hooked_blocks( $blocks, $navigation_post );
$root_nav_block = parse_blocks( $markup )[0];
Expand Down Expand Up @@ -992,7 +992,7 @@ function block_core_navigation_get_fallback_blocks() {
// In this case default to the (Page List) fallback.
$fallback_blocks = ! empty( $maybe_fallback ) ? $maybe_fallback : $fallback_blocks;

if ( function_exists( 'get_hooked_blocks' ) ) {
if ( function_exists( 'get_hooked_block_markup' ) ) {
// Run Block Hooks algorithm to inject hooked blocks.
// We have to run it here because we need the post ID of the Navigation block to track ignored hooked blocks.
$markup = block_core_navigation_insert_hooked_blocks( $fallback_blocks, $navigation_post );
Expand Down Expand Up @@ -1358,7 +1358,7 @@ function block_core_navigation_get_most_recently_published_navigation() {
* @param WP_Post $post `wp_navigation` post object corresponding to the block.
* @return string Serialized inner blocks in mock Navigation block wrapper, with hooked blocks inserted, if any.
*/
function block_core_navigation_insert_hooked_blocks( $inner_blocks, $post = null ) {
function block_core_navigation_insert_hooked_blocks( $inner_blocks, $post ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would making $post now to be required could cause Fatal error: Uncaught ArgumentCountError: Too few arguments to function if someone is using it without it? Was this function introduced before 6.5?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this has been discussed. See WordPress/gutenberg#58379 (comment) cc @ockham

$before_block_visitor = null;
$after_block_visitor = null;
$hooked_blocks = get_hooked_blocks();
Expand Down Expand Up @@ -1397,10 +1397,6 @@ function block_core_navigation_insert_hooked_blocks( $inner_blocks, $post = null
* @param WP_Post $post Post object.
*/
function block_core_navigation_update_ignore_hooked_blocks_meta( $post ) {
if ( ! isset( $post->ID ) ) {
return;
}

// We run the Block Hooks mechanism so it will return the list of ignored hooked blocks
// in the mock root Navigation block's metadata attribute.
// We ignore the rest of the returned `$markup`; `$post->post_content` already has the hooked
Expand All @@ -1422,9 +1418,9 @@ function block_core_navigation_update_ignore_hooked_blocks_meta( $post ) {
}
}

// Injection of hooked blocks into the Navigation block relies on some functions present in WP >= 6.4
// that are not present in Gutenberg's WP 6.4 compatibility layer.
if ( function_exists( 'get_hooked_blocks' ) ) {
// Injection of hooked blocks into the Navigation block relies on some functions present in WP >= 6.5
// that are not present in Gutenberg's WP 6.5 compatibility layer.
if ( function_exists( 'get_hooked_block_markup' ) ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ockham, should it be moved to WordPress Core instead? It looks like it will never get executed in the Gutenberg plugin with the guard call included.

add_action( 'rest_insert_wp_navigation', 'block_core_navigation_update_ignore_hooked_blocks_meta', 10, 3 );
}

Expand Down Expand Up @@ -1454,8 +1450,8 @@ function block_core_navigation_insert_hooked_blocks_into_rest_response( $respons
return $response;
}

// Injection of hooked blocks into the Navigation block relies on some functions present in WP >= 6.4
// that are not present in Gutenberg's WP 6.4 compatibility layer.
if ( function_exists( 'get_hooked_blocks' ) ) {
// Injection of hooked blocks into the Navigation block relies on some functions present in WP >= 6.5
// that are not present in Gutenberg's WP 6.5 compatibility layer.
if ( function_exists( 'get_hooked_block_markup' ) ) {
add_filter( 'rest_prepare_wp_navigation', 'block_core_navigation_insert_hooked_blocks_into_rest_response', 10, 3 );
}
2 changes: 2 additions & 0 deletions src/wp-includes/blocks/pattern.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ function register_block_core_pattern() {
*
* @since 6.3.0 Backwards compatibility: blocks with no `syncStatus` attribute do not receive block wrapper.
*
* @global WP_Embed $wp_embed Used to process embedded content within patterns
*
* @param array $attributes Block attributes.
*
* @return string Returns the output of the pattern.
Expand Down
6 changes: 3 additions & 3 deletions src/wp-includes/blocks/post-navigation-link.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ function render_block_core_post_navigation_link( $attributes, $content ) {
$in_same_term = isset( $attributes['inSameTerm'] ) ? $attributes['inSameTerm'] : false;
$taxonomy = isset( $attributes['taxonomy'] ) && $in_same_term ? $attributes['taxonomy'] : '';

/**
/*
* The dynamic portion of the function name, `$navigation_type`,
* Refers to the type of adjacency, 'next' or 'previous'.
*
* @See https://developer.wordpress.org/reference/functions/get_previous_post_link/
* @See https://developer.wordpress.org/reference/functions/get_next_post_link/
* @see https://developer.wordpress.org/reference/functions/get_previous_post_link/
* @see https://developer.wordpress.org/reference/functions/get_next_post_link/
*/
$get_link_function = "get_{$navigation_type}_post_link";

Expand Down
26 changes: 26 additions & 0 deletions src/wp-includes/interactivity-api.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
/**
* Interactivity API: Functions and hooks
*
* @package WordPress
* @subpackage Interactivity API
*/

/**
* Registers the interactivity modules.
*/
function wp_interactivity_register_script_modules() {
wp_register_script_module(
'@wordpress/interactivity',
includes_url( '/js/dist/interactivity.min.js' ),
array()
);

wp_register_script_module(
'@wordpress/interactivity-router',
includes_url( '/js/dist/interactivity-router.min.js' ),
array( '@wordpress/interactivity' ),

Check failure on line 22 in src/wp-includes/interactivity-api.php

View workflow job for this annotation

GitHub Actions / Check PHP compatibility

Trailing comma's are not allowed in function calls in PHP 7.2 or earlier
);
}

add_action( 'init', 'wp_interactivity_register_script_modules' );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we introduce a new action similar to wp_default_scripts?

Inside src/wp-includes/default-filters.php, we would put:

add_action( 'wp_default_script_modules', 'wp_default_script_modules_packages' );

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense, I believe this is meant as a start though. @luisherranz is planning a follow-up for this PR to bring the full interactivity API.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Once this is committed, my plan is to delete it in #5953, which already includes these filters.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #5953, it is no longer part of the init hook, but instead the script modules for Interactivity API get registered when someone calls wp_interactivity() function.

1 change: 1 addition & 0 deletions src/wp-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@
require ABSPATH . WPINC . '/fonts.php';
require ABSPATH . WPINC . '/class-wp-script-modules.php';
require ABSPATH . WPINC . '/script-modules.php';
require ABSPATH . WPINC . '/interactivity-api.php';

$GLOBALS['wp_embed'] = new WP_Embed();

Expand Down
3 changes: 2 additions & 1 deletion tools/webpack/blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ module.exports = function (
},
output: {
devtoolNamespace: 'wp',
filename: `./blocks/[name]${ suffix }.js`,
filename: `./blocks/[name]/view${ suffix }.js`,
path: normalizeJoin( baseDir, buildTarget ),
library: {
type: 'module',
Expand All @@ -133,6 +133,7 @@ module.exports = function (
externalsType: 'module',
externals: {
'@wordpress/interactivity': '@wordpress/interactivity',
'@wordpress/interactivity-router': 'import @wordpress/interactivity-router',
},
module: {
rules: [
gziolo marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
31 changes: 5 additions & 26 deletions tools/webpack/modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,32 +53,11 @@ module.exports = function (
},
environment: { module: true },
},
module: {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that the modules are built automatically, there's no need to use babel anymore.

rules: [
{
test: /\.(j|t)sx?$/,
use: [
{
loader: require.resolve( 'babel-loader' ),
options: {
cacheDirectory:
process.env.BABEL_CACHE_DIRECTORY || true,
babelrc: false,
configFile: false,
presets: [
[
'@babel/preset-react',
{
runtime: 'automatic',
importSource: 'preact',
},
],
],
},
},
],
},
],
externalsType: 'module',
externals: {
'@wordpress/interactivity': '@wordpress/interactivity',
'@wordpress/interactivity-router':
'import @wordpress/interactivity-router',
},
plugins: [
...baseConfig.plugins,
Expand Down
5 changes: 4 additions & 1 deletion tools/webpack/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ const BUNDLED_PACKAGES = [
'@wordpress/interactivity',
'@wordpress/sync',
];
const MODULES = [ '@wordpress/interactivity' ];
const MODULES = [
'@wordpress/interactivity',
'@wordpress/interactivity-router',
];
const WORDPRESS_NAMESPACE = '@wordpress/';

module.exports = {
Expand Down
Loading