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

Update packages for 6.8 Beta 1 #8224

Open
wants to merge 4 commits into
base: trunk
Choose a base branch
from

Conversation

Mamaduka
Copy link
Member

@Mamaduka Mamaduka commented Jan 30, 2025

A list of known issues:

Trac ticket: https://core.trac.wordpress.org/ticket/62887


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

Copy link

github-actions bot commented Jan 30, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props mamaduka, joemcgill, youknowriad, swissspidy, sergiomdgomes.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@Mamaduka Mamaduka requested review from desrosj and joemcgill January 30, 2025 15:34
Copy link
Member

@joemcgill joemcgill left a comment

Choose a reason for hiding this comment

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

Thanks @Mamaduka! Doing some initial testing to ensure nothing obvious is broken, but no initial big red flags from me.

I see that this sync is including several new __experimental… settings, like __experimentalBorder and continues the use of existing __experimentalDefaultControls settings.

I've not been involved in these syncs in the past, but was under the impression that we were attempting to move away from shipping these kinds of features under the __experimental… prefix. Am I mistaken? Regardless, I don't think that's a blocker for this sync, since those settings could be stabilized to remove the prefix, or removed entirely prior to shipping a final release. I mainly want to make sure I understand your expectations for how this is meant to work.

Comment on lines +96 to +103
'@wordpress/dataviews/wp',
'@wordpress/icons',
'@wordpress/interface',
'@wordpress/interactivity',
'@wordpress/sync',
'@wordpress/undo-manager',
'@wordpress/upload-media',
'@wordpress/fields',
Copy link
Member

Choose a reason for hiding this comment

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

Noting the new packages being bundled and their purpose in the commit message would probably be a good idea.

Copy link
Member Author

Choose a reason for hiding this comment

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

Noted! Only @wordpress/upload-media is the new package here; it looks like we missed synchronization of this config in past releases.

I'll double-check new values here before this is committed.

Copy link
Member Author

Choose a reason for hiding this comment

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

@youknowriad, can I get a sanity check here? Do I need to include @wordpress/data views/wp here? It seems to be a plugin-specific package.

Important note If you're trying to use the DataViews component in a WordPress plugin or theme and you're building your scripts using the @wordpress/scripts package, you need to import the components from @wordpress/dataviews/wp instead of @wordpress/dataviews.

Copy link
Contributor

Choose a reason for hiding this comment

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

No need, but it won't have any impact anyway.

@@ -56,6 +56,7 @@
remove_action( 'init', 'register_block_core_query_pagination_numbers' );
remove_action( 'init', 'register_block_core_query_pagination_previous' );
remove_action( 'init', 'register_block_core_query_title' );
remove_action( 'init', 'register_block_core_query_total' );
Copy link
Member

Choose a reason for hiding this comment

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

👍🏻 New action being added to register the new core/query-total block.

@Mamaduka
Copy link
Member Author

I've not been involved in these syncs in the past, but was under the impression that we were attempting to move away from shipping these kinds of features under the __experimental… prefix.

@joemcgill, that only applies to JS API. The block.json is a configuration file that can't have private APIs, hence the __experimental prefixes. They're and will be backward compatible.

@joemcgill
Copy link
Member

Thanks for clarifying! Do we have any documentation or best practice for why and when to use those prefixes for block.json features? If they are intended to be backward compatible, should we be looking to remove these prefixes?

@Mamaduka
Copy link
Member Author

These aren't new configuration values; they just got enabled for those blocks. When those features are stable, we usually create iteration issues like #64314 and stabilize the keys.

I don't recall any official docs, but it is probably worth documenting.

Copy link
Member

@joemcgill joemcgill left a comment

Choose a reason for hiding this comment

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

I was able to reproduce the error with the @wordpress/fields package, noted in the PR description.

I'm also seeing the following, which makes the site editor unusable currently.

Uncaught TypeError: Cannot read properties of undefined (reading 'initializeEditor')
    at HTMLDocument.<anonymous> (site-editor.php:2369:16)

I'm adding request changes until we're confident in these being resolved in a way that doesn't totally block the site editor from being usable in trunk

To reproduce:

  1. Check out this PR
  2. Run npm i && npm run build:dev
  3. Visit the site editor with no other plugins activated

@Mamaduka Mamaduka force-pushed the try/initial-package-update-6-8 branch from bd2d325 to e64d778 Compare February 5, 2025 07:26
@Mamaduka
Copy link
Member Author

Mamaduka commented Feb 5, 2025

Updated packages to fix private API errors breaking the Site Editor (WordPress/gutenberg#68964). It should be working correctly now.

Remaining issues:

Screeenshot

CleanShot 2025-02-05 at 11 34 08

@@ -1663,6 +1663,7 @@ module.exports = function(grunt) {
grunt.registerTask( 'verify:source-maps', function() {
const ignoredFiles = [
'build/wp-includes/js/dist/components.js',
'build/wp-includes/js/dist/data.js',
Copy link
Member Author

Choose a reason for hiding this comment

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

I think this should be okay; the sourceMappingURL in this package build doesn't cause 404 errors.

The recent update of the Redux package might have introduced the sourceMappingURL change. See: WordPress/gutenberg#66966.

Copy link

github-actions bot commented Feb 5, 2025

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@Mamaduka
Copy link
Member Author

Mamaduka commented Feb 5, 2025

It looks like wp-polyfill has been reintroduced as a dependency, which causes the test_wp_add_inline_script_before_after_concat_with_core_dependency unit test to fail. It was initially removed via https://core.trac.wordpress.org/ticket/60962.

@swissspidy, any suggestions on how to approach this?

@swissspidy
Copy link
Member

Hmm good question, I wonder what caused this.

Last time this topic came up was in WordPress/gutenberg#66552 and WordPress/gutenberg#67230

A quick test here shows that wp-polyfill is now suddenly a dependency of wp-i18n, hence this unit test is failing with the new diff.

I thought with WordPress/gutenberg#65292 / WordPress/gutenberg#65582 the wp-polyfill dependency should only be added when needed.

Tinkering with the Gutenberg package build process I see that the i18n package now tries to load these two polyfills for iterator helpers (which are currently not supported by Safari) in create-i18n.js:

import "core-js/modules/esnext.iterator.constructor.js";
import "core-js/modules/esnext.iterator.for-each.js";

And that's why ultimately the wp-polyfill dependency is added.

create-i18n.js uses new Set() and Set.forEach(), so that's why. But those are supported in Safari, so adding the iterator polyfills is incorrect.

I wonder if we should do something like WordPress/gutenberg#67230 but for Iterator. That would solve this issue. cc @sgomes

Related: it can't hurt to update Babel & core-js to the latest versions in the Gutenberg repo, as this will affect polyfills too.

@sgomes
Copy link

sgomes commented Feb 5, 2025

The reason why polyfills are being added unnecessarily is due to fundamental limitations in core-js, the JS polyfill library that we use to make wp-polyfill, and which is used by Babel as well. In a nutshell, it's monolithic where it comes to objects like Set, and assumes that if a Set object is present anywhere, it's going to need all its methods, and therefore all the internal dependencies it uses to polyfill them.

This was likely caused by a core-js update that added new functionality, perhaps WordPress/gutenberg#67708?

@sgomes
Copy link

sgomes commented Feb 5, 2025

To follow up on the above, the aforementioned Gutenberg PR updated core-js to version 3.39, which according to the project changelog added the Iterator functionality, so we have our smoking gun.

@gziolo: Would it be worth it to replicate the unit test that's failing here (test_wp_add_inline_script_before_after_concat_with_core_dependency) at the Gutenberg level, so that we catch these situations in the Gutenberg repo, before they make their way to Core?

@Mamaduka
Copy link
Member Author

Mamaduka commented Feb 5, 2025

Thanks, @swissspidy, @sgomes.

So, for now, would the proposed resolution be something similar to WordPress/gutenberg#67230?

@swissspidy
Copy link
Member

In that case I would say so, yes.

Adding a unit test or CI check for this stuff would be nice for sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants