Build: Improve how combined assets are generated
Allows to revert changes applied in [54277] - temporary workaround for the failing Test NPM CI check on Windows. Improvements included: - generate combined asset files for both production and development - store in the repository only the production version of the combined assets for packages, we use everything else only in development - to make unit tests work, ensure that they ignore react fast refresh and use the production version of combined assets that are present in the source code Props bernhard-reiter, jsnajdr, clorith, wildworks. Fixes #56615. Built from https://develop.svn.wordpress.org/trunk@54289 git-svn-id: http://core.svn.wordpress.org/trunk@53848 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d8525e93c0
commit
d963f95253
File diff suppressed because one or more lines are too long
|
@ -0,0 +1 @@
|
||||||
|
<?php return array('dependencies' => array('wp-react-refresh-runtime'), 'version' => '794dd7047e2302828128');
|
|
@ -0,0 +1 @@
|
||||||
|
<?php return array('dependencies' => array(), 'version' => 'd4cdced5a2afff4a8cc2');
|
|
@ -227,6 +227,7 @@ function wp_register_development_scripts( $scripts ) {
|
||||||
if (
|
if (
|
||||||
! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG
|
! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG
|
||||||
|| empty( $scripts->registered['react'] )
|
|| empty( $scripts->registered['react'] )
|
||||||
|
|| defined( 'WP_RUN_CORE_TESTS' )
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -264,8 +265,7 @@ function wp_register_development_scripts( $scripts ) {
|
||||||
* @param WP_Scripts $scripts WP_Scripts object.
|
* @param WP_Scripts $scripts WP_Scripts object.
|
||||||
*/
|
*/
|
||||||
function wp_default_packages_scripts( $scripts ) {
|
function wp_default_packages_scripts( $scripts ) {
|
||||||
$suffix = wp_scripts_get_suffix();
|
$suffix = defined( 'WP_RUN_CORE_TESTS' ) ? '.min' : wp_scripts_get_suffix();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Expects multidimensional array like:
|
* Expects multidimensional array like:
|
||||||
*
|
*
|
||||||
|
@ -273,10 +273,10 @@ function wp_default_packages_scripts( $scripts ) {
|
||||||
* 'annotations.js' => array('dependencies' => array(...), 'version' => '...'),
|
* 'annotations.js' => array('dependencies' => array(...), 'version' => '...'),
|
||||||
* 'api-fetch.js' => array(...
|
* 'api-fetch.js' => array(...
|
||||||
*/
|
*/
|
||||||
$assets = include ABSPATH . WPINC . '/assets/script-loader-packages.php';
|
$assets = include ABSPATH . WPINC . "/assets/script-loader-packages{$suffix}.php";
|
||||||
|
|
||||||
foreach ( $assets as $package_name => $package_data ) {
|
foreach ( $assets as $file_name => $package_data ) {
|
||||||
$basename = basename( $package_name, '.js' );
|
$basename = str_replace( $suffix . '.js', '', basename( $file_name ) );
|
||||||
$handle = 'wp-' . $basename;
|
$handle = 'wp-' . $basename;
|
||||||
$path = "/wp-includes/js/dist/{$basename}{$suffix}.js";
|
$path = "/wp-includes/js/dist/{$basename}{$suffix}.js";
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.1-beta1-54288';
|
$wp_version = '6.1-beta1-54289';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue