WordPress.org

Make WordPress Core

Opened 6 weeks ago

Last modified 42 hours ago

#47843 new defect (bug)

Update the WordPress Packages to the ones used in the Gutenberg 6.4 release

Reported by: gziolo Owned by:
Milestone: 5.3 Priority: normal
Severity: normal Version:
Component: Editor Keywords: has-patch commit
Focuses: Cc:

Description (last modified by gziolo)

Updated Packages:

Version 6.2:

  • @wordpress/a11y@2.5.0
  • @wordpress/annotations@1.5.0
  • @wordpress/api-fetch@3.4.0
  • @wordpress/autop@2.4.0
  • @wordpress/babel-plugin-import-jsx-pragma@2.3.0
  • @wordpress/babel-plugin-makepot@3.2.0
  • @wordpress/babel-preset-default@4.4.0
  • @wordpress/blob@2.5.0
  • @wordpress/block-editor@3.0.0
  • @wordpress/block-library@2.7.0
  • @wordpress/block-serialization-default-parser@3.3.0
  • @wordpress/block-serialization-spec-parser@3.2.0
  • @wordpress/blocks@6.5.0
  • @wordpress/browserslist-config@2.6.0
  • @wordpress/components@8.1.0
  • @wordpress/compose@3.5.0
  • @wordpress/core-data@2.5.0
  • @wordpress/custom-templated-path-webpack-plugin@1.5.0
  • @wordpress/data-controls@1.1.0
  • @wordpress/data@4.7.0
  • @wordpress/date@3.4.0
  • @wordpress/dependency-extraction-webpack-plugin@1.1.0
  • @wordpress/deprecated@2.5.0
  • @wordpress/docgen@1.3.0
  • @wordpress/dom-ready@2.5.0
  • @wordpress/dom@2.4.0
  • @wordpress/e2e-test-utils@2.2.0
  • @wordpress/e2e-tests@1.4.0
  • @wordpress/edit-post@3.6.0
  • @wordpress/editor@9.5.0
  • @wordpress/element@2.6.0
  • @wordpress/escape-html@1.5.0
  • @wordpress/eslint-plugin@2.4.0
  • @wordpress/format-library@1.7.0
  • @wordpress/hooks@2.5.0
  • @wordpress/html-entities@2.5.0
  • @wordpress/i18n@3.6.0
  • @wordpress/is-shallow-equal@1.5.0
  • @wordpress/jest-console@3.2.0
  • @wordpress/jest-preset-default@4.3.0
  • @wordpress/jest-puppeteer-axe@1.2.0
  • @wordpress/keycodes@2.5.0
  • @wordpress/library-export-default-webpack-plugin@1.4.0
  • @wordpress/list-reusable-blocks@1.6.0
  • @wordpress/media-utils@1.0.0
  • @wordpress/notices@1.6.0
  • @wordpress/npm-package-json-lint-config@2.1.0
  • @wordpress/nux@3.5.0
  • @wordpress/plugins@2.5.0
  • @wordpress/postcss-themes@2.2.0
  • @wordpress/priority-queue@1.3.0
  • @wordpress/redux-routine@3.5.0
  • @wordpress/rich-text@3.5.0
  • @wordpress/scripts@3.4.0
  • @wordpress/server-side-render@1.1.0
  • @wordpress/shortcode@2.4.0
  • @wordpress/token-list@1.5.0
  • @wordpress/url@2.7.0
  • @wordpress/viewport@2.6.0
  • @wordpress/wordcount@2.5.0

Version 6.4:

  • @wordpress/annotations@1.6.0
  • @wordpress/api-fetch@3.5.0
  • @wordpress/autop@2.5.0
  • @wordpress/babel-preset-default@4.5.0
  • @wordpress/block-editor@3.1.0
  • @wordpress/block-library@2.8.0
  • @wordpress/block-serialization-default-parser@3.4.0
  • @wordpress/block-serialization-spec-parser@3.3.0
  • @wordpress/blocks@6.6.0
  • @wordpress/components@8.2.0
  • @wordpress/compose@3.6.0
  • @wordpress/core-data@2.6.0
  • @wordpress/data-controls@1.2.0
  • @wordpress/data@4.8.0
  • @wordpress/date@3.5.0
  • @wordpress/dependency-extraction-webpack-plugin@1.2.0
  • @wordpress/deprecated@2.6.0
  • @wordpress/docgen@1.4.0
  • @wordpress/dom@2.5.0
  • @wordpress/e2e-test-utils@2.3.0
  • @wordpress/e2e-tests@1.5.0
  • @wordpress/edit-post@3.7.0
  • @wordpress/editor@9.6.0
  • @wordpress/element@2.7.0
  • @wordpress/eslint-plugin@3.0.0
  • @wordpress/format-library@1.8.0
  • @wordpress/hooks@2.6.0
  • @wordpress/is-shallow-equal@1.6.0
  • @wordpress/jest-console@3.3.0
  • @wordpress/jest-preset-default@5.0.0
  • @wordpress/jest-puppeteer-axe@1.3.0
  • @wordpress/keycodes@2.6.0
  • @wordpress/list-reusable-blocks@1.7.0
  • @wordpress/media-utils@1.1.0
  • @wordpress/notices@1.7.0
  • @wordpress/nux@3.6.0
  • @wordpress/plugins@2.6.0
  • @wordpress/project-management-automation@1.0.0
  • @wordpress/redux-routine@3.6.0
  • @wordpress/rich-text@3.6.0
  • @wordpress/scripts@4.0.0
  • @wordpress/server-side-render@1.2.0
  • @wordpress/token-list@1.6.0
  • @wordpress/viewport@2.7.0
  • @wordpress/wordcount@2.6.0

Attachments (8)

patch.diff (166.2 KB) - added by gziolo 6 weeks ago.
Initial version
patch-2.diff (166.2 KB) - added by gziolo 6 weeks ago.
Updated version after svn up
patch-6.4.diff (248.6 KB) - added by gziolo 3 weeks ago.
Updated version with packages published after Gutenberg 6.4 release
patch-6.4-updated.diff (262.5 KB) - added by gziolo 13 days ago.
npm 6.11.3, jquery line reverted, 3 unit tests fixed
patch-6.4-updated-webpack.diff (264.4 KB) - added by gziolo 8 days ago.
All PHP unit tests green
47843-with-styles.diff (275.1 KB) - added by jorgefilipecosta 8 days ago.
patch-6.4-autosave-patch.diff (265.7 KB) - added by gziolo 4 days ago.
Updated version with the temporary fix for autosave
47843.diff (263.7 KB) - added by iseulde 43 hours ago.

Download all attachments as: .zip

Change History (37)

@gziolo
6 weeks ago

Initial version

#1 @gziolo
6 weeks ago

  • Description modified (diff)

#2 @gziolo
6 weeks ago

The patch attached has still some bugs to be resolved, I'll continue working on it tomorrow.

#3 @SergeyBiryukov
6 weeks ago

  • Milestone changed from Awaiting Review to 5.3

@gziolo
6 weeks ago

Updated version after svn up

#4 @gziolo
3 weeks ago

  • Description modified (diff)
  • Summary changed from Update the WordPress Packages to the ones used in the Gutenberg 6.2 release to Update the WordPress Packages to the ones used in the Gutenberg 6.4 release

@gziolo
3 weeks ago

Updated version with packages published after Gutenberg 6.4 release

This ticket was mentioned in Slack in #core-editor by gziolo. View the logs.


3 weeks ago

#6 @desrosj
3 weeks ago

  • Keywords has-patch needs-testing added

Did some testing of patch-6.4.diff. Here are things I tested:

I couldn't find any big issues in my testing. I opened #47948 to address a small bug I found in Twenty Eleven with the circle mask image style.

#7 follow-up: @noisysocks
3 weeks ago

  • Keywords needs-testing removed

This is looking really good! I'm unable to spot any regressions when testing locally.

I'd like to get this committed sooner than later so that there's plenty of time to spot bugs in trunk before the 5.3 beta.

There's just a couple of things to fix up:

  • I'm getting modifications to my package-lock.json when I run npm install. I made sure to run nvm install and nvm install-latest-npm first, and I tried deleting node_modules. We can probably just include these differences when committing.
  • There are 18 test failures when running npm run test:php. This looks to be because we need to update some block fixtures. You can ignore the 14 test failures that are to do with not having the WordPress Importer plugin installed.

#8 in reply to: ↑ 7 ; follow-up: @pento
3 weeks ago

Replying to noisysocks:

You can ignore the 14 test failures that are to do with not having the WordPress Importer plugin installed.

🙂

#9 in reply to: ↑ 8 @noisysocks
3 weeks ago

Replying to pento:

Replying to noisysocks:

You can ignore the 14 test failures that are to do with not having the WordPress Importer plugin installed.

🙂

Um... uh... it's my first day! 😀

#10 follow-up: @netweb
3 weeks ago

Any particular reason to change the jquery URL format in package.json in patch-6.4.diff ?

        "jquery-color": "https://github.com/jquery/jquery-color/archive/2.1.1.tar.gz",
110     110                     "jquery-form": "4.2.1",
111     111                     "jquery-hoverintent": "1.8.3",
112                             "jquery-ui": "https://github.com/jquery/jquery-ui/archive/1.11.4.tar.gz",
        112                     "jquery-ui": "github:jquery/jquery-ui#1.11.4",

It switches from an archived version to a commit hash

                "jquery-ui": {
13836                                   "version": "https://github.com/jquery/jquery-ui/archive/1.11.4.tar.gz",
13837                                   "integrity": "sha512-yMLXNruSte8iAAOsShJvUdcwgrHbWrxBCoKfPGqDmgFkfNLbnXoHcyxgOvI2IbgfupFF2paOm0AvOq6iERedKQ=="
        14110                           "version": "github:jquery/jquery-ui#d6713024e16de90ea71dc0544ba34e1df01b4d8a",
        14111                           "from": "github:jquery/jquery-ui#1.11.4"

I doubt there would be any issues so long as the commit hash matches the version expected.

I'd rather see this change not be included though, and keep the original format unless I'm missing some reason to switch the URL to that proposed, if there is another underlying reason then the other packages using a pinned version such as jquery-color should probably also be updated to the same format for consistency etc.


Also wondering if npm v6.11.0 should be used to avoid the 6.11.1 & 6.11.2 bugs noticed in:

https://npm.community/t/6-11-1-some-dependencies-are-no-longer-being-installed/9586/5

npm 6.11.3 is scheduled to include a fix for the above next Tuesday 3rd September

https://npm.community/t/release-6-11-2/9637/3?u=netweb

#11 @pento
3 weeks ago

It needs to go back to the URL version, per #47916.

#12 in reply to: ↑ 10 @gziolo
3 weeks ago

Replying to netweb:

Any particular reason to change the jquery URL format in package.json in patch-6.4.diff ?

I think it's a merge conflict which I didn't resolve properly

Also wondering if npm v6.11.0 should be used to avoid the 6.11.1 & 6.11.2 bugs noticed in:

https://npm.community/t/6-11-1-some-dependencies-are-no-longer-being-installed/9586/5

npm 6.11.3 is scheduled to include a fix for the above next Tuesday 3rd September

https://npm.community/t/release-6-11-2/9637/3?u=netweb

I wasn't aware of that. We can recreate with v6.11.0 or whatever we have set in package.json file at the moment.

#13 @pento
2 weeks ago

We can leave committing this until after NPM 6.11.3 is released with that bug fix.

@gziolo: Can you get the props list for this update?

#14 @gziolo
2 weeks ago

I'm also working in parallel on build improvements in Gutenberg so we could greatly simplify the process of upgrading all those packages. See https://github.com/WordPress/gutenberg/pull/17298.

The idea is that we would integrate @wordpress/dependency-extraction-webpack-plugin and let Webpack generate most of the metadata:

  • handle
  • dependencies
  • stable version (based on the content of the file rather than the version of the package)

#15 follow-up: @gziolo
2 weeks ago

@gziolo: Can you get the props list for this update?

How do I generate the props list? I can't find documentation for that.

#16 in reply to: ↑ 15 @pento
2 weeks ago

Replying to gziolo:

How do I generate the props list? I can't find documentation for that.

There's no documented process that I'm aware of. #meta4442 is the latest iteration of it, it's mostly a manual process to match GitHub usernames with W.org usernames.

@gziolo
13 days ago

npm 6.11.3, jquery line reverted, 3 unit tests fixed

#17 @gziolo
13 days ago

npm run test:php still reports 15 failures with the new uploaded patch. They all look very similar:

15) Tests_Query_Vars::testPublicQueryVarsAreAsExpected
Unexpected incorrect usage notice for WP_Block_Type_Registry::register
Failed asserting that an array is empty.

/var/www/tests/phpunit/includes/abstract-testcase.php:494
/var/www/tests/phpunit/includes/abstract-testcase.php:506

FAILURES!
Tests: 9836, Assertions: 51287, Failures: 15, Skipped: 11.

I don't have more time today to investigate.

Otherwise, I think all the issues reported are resolved. I use the latest npm v6.11.3 to regenerate the lock file as suggested.

Last edited 13 days ago by gziolo (previous) (diff)

This ticket was mentioned in Slack in #core-editor by gziolo. View the logs.


13 days ago

@gziolo
8 days ago

All PHP unit tests green

This ticket was mentioned in Slack in #core-editor by gziolo. View the logs.


8 days ago

#20 @jorgefilipecosta
8 days ago

Hi @gziolo, I did some tests, and it looks like things are mostly working as expected. In my tests, it seems block widgets related code is not loaded in the customizer, and the other experimental features are also disabled.
I noticed the patch did not include the new features that allow server-side registering and unregistering of block styles recently added in Gutenberg, so I added a new patch that includes this functionality.
It worked well in my manual tests with the plugin disabled and tests are green.
With the plugin enable we have some problems because the functions are defined multiple times I will create in parallel a PR in Gutenberg to address this.
It is possible to see the diff of my changes at https://github.com/WordPress/wordpress-develop/pull/86/commits/7562413cc8475e0aadd2501d7e4615cba23821dd.
And the original Gutenberg PR at https://github.com/WordPress/gutenberg/pull/16356.

This ticket was mentioned in Slack in #core-editor by gziolo. View the logs.


6 days ago

#22 @youknowriad
4 days ago

Anyone able to confirm that script-loader.php is the best home for the enqueue_block_styles_assets and enqueue_editor_block_styles_assets functions?

#23 @youknowriad
4 days ago

@jorgefilipecosta with your patch, activating the Gutenberg plugin causes this issue

Fatal error: Cannot declare class WP_Block_Styles_Registry, because the name is already in use in /var/www/html/wp-content/plugins/gutenberg/lib/class-wp-block-styles-registry.php on line 14

We need to add a check for existence in the Gutenberg plugin and add an issue to remove this code from the plugin once we update the minimum version (after WP 5.3 release)

#24 @youknowriad
4 days ago

I'm testing this branch heavily with the help of the Gutenberg e2e tests. I'll be reporting my findings here.

First thing I noticed is that the preview button for unpublished posts is not working, it results in a 404.

#25 @jorgefilipecosta
4 days ago

Hi @youknowriad, I guess to fix the styles problem we can conditionally include this functionality in the plugin for now. And when WordPress 5.3 is released we remove the code and update the minimum version.
I'm proposing this solution in PR https://github.com/WordPress/gutenberg/pull/17429.

@gziolo
4 days ago

Updated version with the temporary fix for autosave

#26 @gziolo
4 days ago

First thing I noticed is that the preview button for unpublished posts is not working, it results in a 404

I uploaded an updated version of the patch which includes a temporary fix for the issue reported.

I also removed PHP code for code style registration, which is going to be backported in its own patch.

#27 @youknowriad
3 days ago

  • Keywords commit added

This looks in a better shape. Thanks @jorgefilipecosta @gziolo Let's commit that and continue on the remaining things on separate tickets.

This is a good report to track the small php changes that need to be backported.

https://github.com/WordPress/gutenberg/pulls?q=is%3Apr+label%3A%22Backport+to+WP+Core%22+is%3Aclosed

#28 @gziolo
3 days ago

PHP unit tests fail with the fix for autosaves:

https://github.com/WordPress/wordpress-develop/pull/88

We need to publish another version of npm packages, update them and try again.

@iseulde
43 hours ago

#29 @iseulde
42 hours ago

I added the action that was added for the plugin in https://github.com/WordPress/gutenberg/pull/16683.

The changes I made are the following:

  • src/wp-admin/admin-ajax.php

     
    5353        'autocomplete-user',
    5454        'dashboard-widgets',
    5555        'logged-in',
     56        'rest-nonce',
    5657);
    5758
    5859$core_actions_post = array(
  • src/wp-admin/includes/ajax-actions.php

     
    52715271
    52725272        wp_send_json_success( $all_sizes );
    52735273}
     5274
     5275/**
     5276 * Ajax handler to renew the REST API nonce.
     5277 *
     5278 * @since 5.3.0
     5279 */
     5280function wp_ajax_rest_nonce() {
     5281        exit( wp_create_nonce( 'wp_rest' ) );
     5282}
  • src/wp-includes/script-loader.php

     
    535535        }
    536536        $scripts->add_inline_script(
    537537                'wp-api-fetch',
    538                 sprintf(
    539                         implode(
    540                                 "\n",
    541                                 array(
    542                                         '( function() {',
    543                                         '       var nonceMiddleware = wp.apiFetch.createNonceMiddleware( "%s" );',
    544                                         '       wp.apiFetch.use( nonceMiddleware );',
    545                                         '       wp.hooks.addAction(',
    546                                         '               "heartbeat.tick",',
    547                                         '               "core/api-fetch/create-nonce-middleware",',
    548                                         '               function( response ) {',
    549                                         '                       if ( response[ "rest_nonce" ] ) {',
    550                                         '                               nonceMiddleware.nonce = response[ "rest_nonce" ];',
    551                                         '                       }',
    552                                         '               }',
    553                                         '       );',
    554                                         '} )();',
    555                                 )
     538                join( array(
     539                        sprintf(
     540                                'wp.apiFetch.nonceMiddleware = wp.apiFetch.createNonceMiddleware( "%s" );',
     541                                ( wp_installing() && ! is_multisite() ) ? '' : wp_create_nonce( 'wp_rest' )
    556542                        ),
    557                         ( wp_installing() && ! is_multisite() ) ? '' : wp_create_nonce( 'wp_rest' )
    558                 ),
     543                        'wp.apiFetch.use( wp.apiFetch.nonceMiddleware );',
     544                        sprintf(
     545                                'wp.apiFetch.nonceEndpoint = "%s";',
     546                                admin_url( 'admin-ajax.php?action=rest-nonce' )
     547                        ),
     548                ), "\n" ),
    559549                'after'
    560550        );
    561551        $scripts->add_inline_script(

This can be tested by adding lowering the nonce life to 5 seconds. Load the page, then wait 5 seconds and try to update or publish a post.

<?php

add_filter( 'nonce_life', function() {
        return 5;
} );
Note: See TracTickets for help on using tickets.