Make WordPress Core

Changeset 44271 for trunk


Ignore:
Timestamp:
12/17/2018 06:18:49 PM (5 years ago)
Author:
desrosj
Message:

Core Editor: Specify script versions for the WordPress packages and their vendor dependencies.

Using the package.json versions of the NPM dependencies as versions when registering the WordPress scripts.

Props dimadin, dd32, youknowriad.

Merges [43925] to trunk.

Fixes #45187.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/wp-includes/script-loader.php

    r44265 r44271  
    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 ) ) {
     
    97109        }
    98110
    99         $path = "/wp-includes/js/dist/vendor/$handle$dev_suffix.js";
    100 
    101         $scripts->add( $handle, $path, $dependencies, false, 1 );
     111        $path    = "/wp-includes/js/dist/vendor/$handle$dev_suffix.js";
     112        $version = $vendor_scripts_versions[ $handle ];
     113
     114        $scripts->add( $handle, $path, $dependencies, false, $version );
    102115    }
    103116
     
    193206function wp_default_packages_scripts( &$scripts ) {
    194207    $suffix = wp_scripts_get_suffix();
     208
     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    );
    195249
    196250    $packages_dependencies = array(
     
    245299        ),
    246300        'block-serialization-default-parser' => array(),
    247         'block-serialization-spec-parser'    => array( 'wp-polyfill' ),
    248301        'components'                         => array(
    249302            'lodash',
     
    412465
    413466    foreach ( $packages_dependencies as $package => $dependencies ) {
    414         $handle = 'wp-' . $package;
    415         $path   = "/wp-includes/js/dist/$package$suffix.js";
    416 
    417         $scripts->add( $handle, $path, $dependencies, false, 1 );
     467        $handle  = 'wp-' . $package;
     468        $path    = "/wp-includes/js/dist/$package$suffix.js";
     469        $version = $packages_versions[ $package ];
     470
     471        $scripts->add( $handle, $path, $dependencies, false, $version );
    418472
    419473        if ( isset( $package_translations[ $package ] ) ) {
Note: See TracChangeset for help on using the changeset viewer.