Make WordPress Core

Ticket #45187: diff.patch

File diff.patch, 3.0 KB (added by youknowriad, 7 years ago)
  • src/wp-includes/script-loader.php

     
    9090                'wp-polyfill',
    9191        );
    9292
     93        $vendor_scripts_versions = array(
     94                'react' => '16.6.3',
     95                'react-dom' => '16.6.3',
     96                'moment' => '2.22.2',
     97                'lodash' => '4.17.11',
     98                'wp-polyfill-fetch' => '3.0.0',
     99                'wp-polyfill-formdata' => '3.0.12',
     100                'wp-polyfill-node-contains' => '3.26.0-0',
     101                'wp-polyfill-element-closest' => '2.0.2',
     102                'wp-polyfill' => '7.0.0',
     103        );
     104
    93105        foreach ( $vendor_scripts as $handle => $dependencies ) {
    94106                if ( is_string( $dependencies ) ) {
    95107                        $handle = $dependencies;
     
    97109                }
    98110
    99111                $path = "/wp-includes/js/dist/vendor/$handle$dev_suffix.js";
     112                $version = $vendor_scripts_versions[ $handle ];
    100113
    101                 $scripts->add( $handle, $path, $dependencies, false, 1 );
     114                $scripts->add( $handle, $path, $dependencies, false, $version );
    102115        }
    103116
    104117        $scripts->add( 'wp-polyfill', null, array( 'wp-polyfill' ) );
     
    193206function wp_default_packages_scripts( &$scripts ) {
    194207        $suffix = wp_scripts_get_suffix();
    195208
     209        $packages_versions = array(
     210                'api-fetch' => '2.2.5',
     211                'a11y' => '2.0.2',
     212                'annotations' => '1.0.3',
     213                'api-fetch' => '2.2.5',
     214                'autop' => '2.0.2',
     215                'blob' => '2.1.0',
     216                'block-library' => '2.2.6',
     217                'block-serialization-default-parser' => '2.0.0',
     218                'blocks' => '6.0.2',
     219                'components' => '7.0.1',
     220                'compose' => '3.0.0',
     221                'core-data' => '2.0.14',
     222                'data' => '4.0.1',
     223                'date' => '3.0.0',
     224                'deprecated' => '2.0.3',
     225                'dom' => '2.0.7',
     226                'dom-ready' => '2.0.2',
     227                'edit-post' => '3.1.1',
     228                'editor' => '9.0.1',
     229                'element' => '2.1.8',
     230                'escape-html' => '1.0.1',
     231                'format-library' => '1.2.4',
     232                'hooks' => '2.0.3',
     233                'html-entities' => '2.0.3',
     234                'i18n' => '3.1.0',
     235                'is-shallow-equal' => '1.1.4',
     236                'keycodes' => '2.0.5',
     237                'list-reusable-blocks' => '1.1.14',
     238                'notices' => '1.1.0',
     239                'nux' => '3.0.2',
     240                'plugins' => '2.0.9',
     241                'redux-routine' => '3.0.3',
     242                'rich-text' => '3.0.2',
     243                'shortcode' => '2.0.2',
     244                'token-list' => '1.1.0',
     245                'url' => '2.3.1',
     246                'viewport' => '2.0.12',
     247                'wordcount' => '2.0.3',
     248        );
     249
    196250        $packages_dependencies = array(
    197251                'api-fetch' => array( 'wp-polyfill', 'wp-hooks', 'wp-i18n', 'wp-url' ),
    198252                'a11y' => array( 'wp-dom-ready', 'wp-polyfill' ),
     
    244298                        'wp-rich-text',
    245299                ),
    246300                'block-serialization-default-parser' => array(),
    247                 'block-serialization-spec-parser' => array( 'wp-polyfill' ),
    248301                'components' => array(
    249302                        'lodash',
    250303                        'moment',
     
    413466        foreach ( $packages_dependencies as $package => $dependencies ) {
    414467                $handle  = 'wp-' . $package;
    415468                $path    = "/wp-includes/js/dist/$package$suffix.js";
     469                $version = $packages_versions[ $package ];
    416470
    417                 $scripts->add( $handle, $path, $dependencies, false, 1 );
     471                $scripts->add( $handle, $path, $dependencies, false, $version );
    418472
    419473                if ( isset( $package_translations[ $package ] ) ) {
    420474                        $scripts->set_translations( $handle, $package_translations[ $package ] );