Build Tools: do not include assets for JS dependencies that do not exist.

This is a follow-up for #48154, where we started including *.asset.php files to declare package dependencies.
This works well but creates warnings in environments where the package does not exist because WordPress was not fully built.

Props jeherve, swissspidy.

Fixes #49144.


Built from https://develop.svn.wordpress.org/trunk@47048


git-svn-id: http://core.svn.wordpress.org/trunk@46848 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
gziolo 2020-01-07 15:28:05 +00:00
parent d3d630c98a
commit 572f1725d9
2 changed files with 9 additions and 4 deletions

View File

@ -285,9 +285,14 @@ function wp_default_packages_scripts( &$scripts ) {
);
foreach ( $packages as $package ) {
$handle = 'wp-' . $package;
$path = "/wp-includes/js/dist/$package$suffix.js";
$asset_file = include( ABSPATH . WPINC . "/assets/dist/$package$suffix.asset.php" );
$handle = 'wp-' . $package;
$path = "/wp-includes/js/dist/$package$suffix.js";
if ( ! file_exists( ABSPATH . $path ) ) {
continue;
}
$asset_file = include ABSPATH . WPINC . "/assets/dist/$package$suffix.asset.php";
$dependencies = $asset_file['dependencies'];
// Add dependencies that cannot be detected and generated by build tools.

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.4-alpha-47047';
$wp_version = '5.4-alpha-47048';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.