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

Second round of WordPress npm package updates for 6.3 RC1 #4861

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
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
1,042 changes: 571 additions & 471 deletions package-lock.json

Large diffs are not rendered by default.

66 changes: 33 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"@pmmmwh/react-refresh-webpack-plugin": "0.5.5",
"@wordpress/babel-preset-default": "7.19.1",
"@wordpress/dependency-extraction-webpack-plugin": "4.18.1",
"@wordpress/e2e-test-utils": "10.6.3",
"@wordpress/scripts": "26.6.2",
"@wordpress/e2e-test-utils": "10.6.4",
"@wordpress/scripts": "26.6.3",
"autoprefixer": "10.4.14",
"chalk": "5.2.0",
"check-node-version": "4.2.1",
Expand Down Expand Up @@ -79,64 +79,64 @@
"@emotion/is-prop-valid": "0.8.8",
"@emotion/memoize": "0.7.4",
"@wordpress/a11y": "3.35.1",
"@wordpress/annotations": "2.35.4",
"@wordpress/annotations": "2.35.5",
"@wordpress/api-fetch": "6.32.1",
"@wordpress/autop": "3.35.1",
"@wordpress/blob": "3.35.1",
"@wordpress/block-directory": "4.12.9",
"@wordpress/block-editor": "12.3.7",
"@wordpress/block-library": "8.12.9",
"@wordpress/block-directory": "4.12.10",
"@wordpress/block-editor": "12.3.8",
"@wordpress/block-library": "8.12.10",
"@wordpress/block-serialization-default-parser": "4.35.1",
"@wordpress/blocks": "12.12.3",
"@wordpress/commands": "0.6.7",
"@wordpress/components": "25.1.7",
"@wordpress/blocks": "12.12.4",
"@wordpress/commands": "0.6.8",
"@wordpress/components": "25.1.8",
"@wordpress/compose": "6.12.1",
"@wordpress/core-commands": "0.4.7",
"@wordpress/core-data": "6.12.7",
"@wordpress/customize-widgets": "4.12.9",
"@wordpress/data": "9.5.3",
"@wordpress/data-controls": "3.4.3",
"@wordpress/core-commands": "0.4.8",
"@wordpress/core-data": "6.12.8",
"@wordpress/customize-widgets": "4.12.10",
"@wordpress/data": "9.5.4",
"@wordpress/data-controls": "3.4.4",
"@wordpress/date": "4.35.1",
"@wordpress/deprecated": "3.35.1",
"@wordpress/dom": "3.35.1",
"@wordpress/dom-ready": "3.35.1",
"@wordpress/edit-post": "7.12.9",
"@wordpress/edit-site": "5.12.9",
"@wordpress/edit-widgets": "5.12.9",
"@wordpress/editor": "13.12.7",
"@wordpress/edit-post": "7.12.10",
"@wordpress/edit-site": "5.12.10",
"@wordpress/edit-widgets": "5.12.10",
"@wordpress/editor": "13.12.8",
"@wordpress/element": "5.12.1",
"@wordpress/escape-html": "2.35.1",
"@wordpress/format-library": "4.12.7",
"@wordpress/format-library": "4.12.8",
"@wordpress/hooks": "3.35.1",
"@wordpress/html-entities": "3.35.1",
"@wordpress/i18n": "4.35.1",
"@wordpress/icons": "9.26.2",
"@wordpress/interface": "5.12.7",
"@wordpress/interface": "5.12.8",
"@wordpress/is-shallow-equal": "4.35.1",
"@wordpress/keyboard-shortcuts": "4.12.3",
"@wordpress/keyboard-shortcuts": "4.12.4",
"@wordpress/keycodes": "3.35.1",
"@wordpress/list-reusable-blocks": "4.12.7",
"@wordpress/list-reusable-blocks": "4.12.8",
"@wordpress/media-utils": "4.26.1",
"@wordpress/notices": "4.3.3",
"@wordpress/nux": "6.0.0",
"@wordpress/plugins": "6.3.7",
"@wordpress/preferences": "3.12.7",
"@wordpress/notices": "4.3.4",
"@wordpress/nux": "7.1.1",
"@wordpress/plugins": "6.3.8",
"@wordpress/preferences": "3.12.8",
"@wordpress/preferences-persistence": "1.27.1",
"@wordpress/primitives": "3.33.1",
"@wordpress/priority-queue": "2.35.1",
"@wordpress/private-apis": "0.17.1",
"@wordpress/private-apis": "0.17.2",
"@wordpress/redux-routine": "4.35.1",
"@wordpress/reusable-blocks": "4.12.7",
"@wordpress/rich-text": "6.12.4",
"@wordpress/router": "0.4.1",
"@wordpress/server-side-render": "4.12.7",
"@wordpress/reusable-blocks": "4.12.8",
"@wordpress/rich-text": "6.12.5",
"@wordpress/router": "0.4.2",
"@wordpress/server-side-render": "4.12.8",
"@wordpress/shortcode": "3.35.1",
"@wordpress/style-engine": "1.18.1",
"@wordpress/token-list": "2.35.1",
"@wordpress/url": "3.36.1",
"@wordpress/viewport": "5.12.3",
"@wordpress/viewport": "5.12.4",
"@wordpress/warning": "2.35.1",
"@wordpress/widgets": "3.12.7",
"@wordpress/widgets": "3.12.8",
"@wordpress/wordcount": "3.35.1",
"backbone": "1.4.1",
"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: 1 addition & 0 deletions src/wp-includes/blocks/blocks-json.php
Original file line number Diff line number Diff line change
Expand Up @@ -4883,6 +4883,7 @@
),
'html' => false
),
'viewScript' => 'file:./view.min.js',
'editorStyle' => 'wp-block-search-editor',
'style' => 'wp-block-search'
),
Expand Down
26 changes: 22 additions & 4 deletions src/wp-includes/blocks/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
/**
* Dynamically renders the `core/search` block.
*
* @param array $attributes The block attributes.
* @param array $attributes The block attributes.
* @param string $content The saved content.
* @param WP_Block $block The parsed block.
Comment on lines +12 to +13
Copy link
Member

Choose a reason for hiding this comment

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

Missing @since for new parameters

@since 6.3.0 Added the `$content` and `$block` parameter.

Copy link
Contributor

Choose a reason for hiding this comment

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

These files are auto-generated from the block-library npm package so any change to this has to be done in Gutenberg. Looking through the other block PHP files, we don't seem to be using @since notation in any of them though (or at least not consistently)

Copy link
Contributor

@costdev costdev Jul 18, 2023

Choose a reason for hiding this comment

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

Looks like an update is needed in all the block PHP files, as the PHP documentation standards state:

If significant changes have been made to a function, hook, class, or method, additional @since tags, versions, and descriptions should be added to provide a changelog for that function.

(details of what constitutes a significant change are mentioned on that page)

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I think we have to adopt core standards more consistently in the block-library PHP files given that they're not manually updated in core.

Is this something that should still be done for this release though? As it's essentially a code quality improvement.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure. It probably depends on when it's easier to do so, as historically adding @since could be a massive task 😅.

However, it's a docs-only change, so it can be committed at any time during the cycle, so there's several weeks where the @since for 6.3.0 could be added.

Is that doable @tellthemachines?

Copy link
Contributor

Choose a reason for hiding this comment

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

I created an issue for it and added it to the 6.3 board. Let's see if we can get it done in time 😄

*
* @return string The search block markup.
*/
function render_block_core_search( $attributes ) {
function render_block_core_search( $attributes, $content, $block ) {
// Older versions of the Search block defaulted the label and buttonText
// attributes to `__( 'Search' )` meaning that many posts contain `<!--
// wp:search /-->`. Support these by defaulting an undefined label and
Expand Down Expand Up @@ -70,10 +72,26 @@ function render_block_core_search( $attributes ) {
$input->set_attribute( 'id', $input_id );
$input->set_attribute( 'value', get_search_query() );
$input->set_attribute( 'placeholder', $attributes['placeholder'] );
if ( 'button-only' === $button_position && 'expand-searchfield' === $button_behavior ) {

$is_expandable_searchfield = 'button-only' === $button_position && 'expand-searchfield' === $button_behavior;
if ( $is_expandable_searchfield ) {
$input->set_attribute( 'aria-hidden', 'true' );
$input->set_attribute( 'tabindex', '-1' );
wp_enqueue_script( 'wp-block--search-view', plugins_url( 'search/view.min.js', __FILE__ ) );
}

// If the script already exists, there is no point in removing it from viewScript.
$view_js_file = 'wp-block-search-view';
if ( ! wp_script_is( $view_js_file ) ) {
$script_handles = $block->block_type->view_script_handles;

// If the script is not needed, and it is still in the `view_script_handles`, remove it.
if ( ! $is_expandable_searchfield && in_array( $view_js_file, $script_handles, true ) ) {
$block->block_type->view_script_handles = array_diff( $script_handles, array( $view_js_file ) );
}
// If the script is needed, but it was previously removed, add it again.
if ( $is_expandable_searchfield && ! in_array( $view_js_file, $script_handles, true ) ) {
$block->block_type->view_script_handles = array_merge( $script_handles, array( $view_js_file ) );
}
}
}

Expand Down
1 change: 1 addition & 0 deletions src/wp-includes/blocks/search/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
},
"html": false
},
"viewScript": "file:./view.min.js",
"editorStyle": "wp-block-search-editor",
"style": "wp-block-search"
}
1 change: 1 addition & 0 deletions src/wp-includes/blocks/search/view.asset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php return array('dependencies' => array(), 'version' => '1653a74623d252458484');
1 change: 1 addition & 0 deletions src/wp-includes/blocks/search/view.min.asset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php return array('dependencies' => array(), 'version' => 'c6277d25063d1381b56e');
24 changes: 9 additions & 15 deletions src/wp-includes/blocks/template-part.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ function render_block_core_template_part( $attributes ) {
$template_part_id = null;
$content = null;
$area = WP_TEMPLATE_PART_AREA_UNCATEGORIZED;
$stylesheet = get_stylesheet();

if (
isset( $attributes['slug'] ) &&
isset( $attributes['theme'] ) &&
$stylesheet === $attributes['theme']
get_stylesheet() === $attributes['theme']
) {
$template_part_id = $attributes['theme'] . '//' . $attributes['slug'];
$template_part_query = new WP_Query(
Expand Down Expand Up @@ -64,22 +63,17 @@ function render_block_core_template_part( $attributes ) {
*/
do_action( 'render_block_core_template_part_post', $template_part_id, $attributes, $template_part_post, $content );
} else {
$template_part_file_path = '';
// Else, if the template part was provided by the active theme,
// render the corresponding file content.
if ( 0 === validate_file( $attributes['slug'] ) ) {
$themes = array( $stylesheet );
$template = get_template();
if ( $stylesheet !== $template ) {
$themes[] = $template;
}

foreach ( $themes as $theme ) {
$theme_folders = get_block_theme_folders( $theme );
$template_part_file_path = get_theme_file_path( '/' . $theme_folders['wp_template_part'] . '/' . $attributes['slug'] . '.html' );
if ( file_exists( $template_part_file_path ) ) {
$content = (string) file_get_contents( $template_part_file_path );
$content = '' !== $content ? _inject_theme_attribute_in_block_template_content( $content ) : '';
break;
$block_template_file = _get_block_template_file( 'wp_template_part', $attributes['slug'] );
if ( $block_template_file ) {
$template_part_file_path = $block_template_file['path'];
$content = (string) file_get_contents( $template_part_file_path );
$content = '' !== $content ? _inject_theme_attribute_in_block_template_content( $content ) : '';
if ( isset( $block_template_file['area'] ) ) {
$area = $block_template_file['area'];
}
}
}
Expand Down
1 change: 1 addition & 0 deletions tools/webpack/blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ module.exports = function( env = { environment: 'production', watch: false, buil
'file/view': normalizeJoin(baseDir, `node_modules/@wordpress/block-library/build-module/file/view` ),
'navigation/view': normalizeJoin(baseDir, `node_modules/@wordpress/block-library/build-module/navigation/view` ),
'navigation/view-modal': normalizeJoin(baseDir, `node_modules/@wordpress/block-library/build-module/navigation/view-modal` ),
'search/view': normalizeJoin(baseDir, `node_modules/@wordpress/block-library/build-module/search/view` ),
},
output: {
devtoolNamespace: 'wp',
Expand Down
Loading