Commit 9c5d66a1f1 for wordpress.org

commit 9c5d66a1f1a08d1d65e35613424fb59ee115c396
Author: Weston Ruter <weston@xwp.co>
Date:   Wed Feb 4 01:42:44 2026 +0000

    Script Loader: Allow classic scripts to depend on script modules.

    This allows classic scripts to declare dependencies on script modules by passing `module_dependencies` in the `$args` param for `wp_register_script()` or `wp_enqueue_script()`. The `WP_Script_Modules::get_import_map()` method is updated to traverse the dependency tree of all enqueued classic scripts to find any associated script module dependencies and include them in the `importmap`, enabling dynamic imports of modules within classic scripts.

    A `_wp_scripts_add_args_data()` helper function is introduced to consolidate argument validation and processing for `wp_register_script()` and `wp_enqueue_script()`, reducing code duplication. This function validates that the `$args` array only contains recognized keys (`strategy`, `in_footer`, `fetchpriority`, `module_dependencies`) and triggers a `_doing_it_wrong()` notice for any unrecognized keys. Similarly, `WP_Scripts::add_data()` is updated to do early type checking for the data passed to `$args`. The script modules in `module_dependencies` may be referenced by a module ID string or by an array that has an `id` key, following the same pattern as dependencies in `WP_Script_Modules`.

    When a script module is added to the `module_dependencies` for a classic script, but it does not exist at the time the `importmap` is printed, a `_doing_it_wrong()` notice is emitted.

    Developed in https://github.com/WordPress/wordpress-develop/pull/8024

    Follow-up to [61323].

    Props sirreal, westonruter.
    See #64229.
    Fixes #61500.

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


    git-svn-id: http://core.svn.wordpress.org/trunk@60898 1a063a9b-81f0-0310-95a4-ce76da25c4cd

diff --git a/wp-includes/class-wp-script-modules.php b/wp-includes/class-wp-script-modules.php
index abbbd6383f..627ccbd0f4 100644
--- a/wp-includes/class-wp-script-modules.php
+++ b/wp-includes/class-wp-script-modules.php
@@ -88,31 +88,31 @@ class WP_Script_Modules {
 	 * @since 6.5.0
 	 * @since 6.9.0 Added the $args parameter.
 	 *
-	 * @param string                     $id       The identifier of the script module. Should be unique. It will be used in the
-	 *                                             final import map.
-	 * @param string                     $src      Optional. Full URL of the script module, or path of the script module relative
-	 *                                             to the WordPress root directory. If it is provided and the script module has
-	 *                                             not been registered yet, it will be registered.
-	 * @param array<string|array>        $deps     {
-	 *                                                 Optional. List of dependencies.
-	 *
-	 *                                                 @type string|array ...$0 {
-	 *                                                     An array of script module identifiers of the dependencies of this script
-	 *                                                     module. The dependencies can be strings or arrays. If they are arrays,
-	 *                                                     they need an `id` key with the script module identifier, and can contain
-	 *                                                     an `import` key with either `static` or `dynamic`. By default,
-	 *                                                     dependencies that don't contain an `import` key are considered static.
-	 *
-	 *                                                     @type string $id     The script module identifier.
-	 *                                                     @type string $import Optional. Import type. May be either `static` or
-	 *                                                                          `dynamic`. Defaults to `static`.
-	 *                                                 }
-	 *                                             }
-	 * @param string|false|null          $version  Optional. String specifying the script module version number. Defaults to false.
-	 *                                             It is added to the URL as a query string for cache busting purposes. If $version
-	 *                                             is set to false, the version number is the currently installed WordPress version.
-	 *                                             If $version is set to null, no version is added.
-	 * @param array<string, string|bool> $args     {
+	 * @param string                              $id      The identifier of the script module. Should be unique. It will be used in the
+	 *                                                     final import map.
+	 * @param string                              $src     Optional. Full URL of the script module, or path of the script module relative
+	 *                                                     to the WordPress root directory. If it is provided and the script module has
+	 *                                                     not been registered yet, it will be registered.
+	 * @param array<string|array<string, string>> $deps    {
+	 *                                                         Optional. List of dependencies.
+	 *
+	 *                                                         @type string|array<string, string> ...$0 {
+	 *                                                             An array of script module identifiers of the dependencies of this script
+	 *                                                             module. The dependencies can be strings or arrays. If they are arrays,
+	 *                                                             they need an `id` key with the script module identifier, and can contain
+	 *                                                             an `import` key with either `static` or `dynamic`. By default,
+	 *                                                             dependencies that don't contain an `import` key are considered static.
+	 *
+	 *                                                             @type string $id     The script module identifier.
+	 *                                                             @type string $import Optional. Import type. May be either `static` or
+	 *                                                                                  `dynamic`. Defaults to `static`.
+	 *                                                         }
+	 *                                                     }
+	 * @param string|false|null                   $version Optional. String specifying the script module version number. Defaults to false.
+	 *                                                     It is added to the URL as a query string for cache busting purposes. If $version
+	 *                                                     is set to false, the version number is the currently installed WordPress version.
+	 *                                                     If $version is set to null, no version is added.
+	 * @param array<string, string|bool>          $args    {
 	 *     Optional. An array of additional args. Default empty array.
 	 *
 	 *     @type bool                $in_footer     Whether to print the script module in the footer. Only relevant to block themes. Default 'false'. Optional.
@@ -260,31 +260,31 @@ class WP_Script_Modules {
 	 * @since 6.5.0
 	 * @since 6.9.0 Added the $args parameter.
 	 *
-	 * @param string                     $id       The identifier of the script module. Should be unique. It will be used in the
-	 *                                             final import map.
-	 * @param string                     $src      Optional. Full URL of the script module, or path of the script module relative
-	 *                                             to the WordPress root directory. If it is provided and the script module has
-	 *                                             not been registered yet, it will be registered.
-	 * @param array<string|array>        $deps     {
-	 *                                                 Optional. List of dependencies.
-	 *
-	 *                                                 @type string|array ...$0 {
-	 *                                                     An array of script module identifiers of the dependencies of this script
-	 *                                                     module. The dependencies can be strings or arrays. If they are arrays,
-	 *                                                     they need an `id` key with the script module identifier, and can contain
-	 *                                                     an `import` key with either `static` or `dynamic`. By default,
-	 *                                                     dependencies that don't contain an `import` key are considered static.
-	 *
-	 *                                                     @type string $id     The script module identifier.
-	 *                                                     @type string $import Optional. Import type. May be either `static` or
-	 *                                                                          `dynamic`. Defaults to `static`.
-	 *                                                 }
-	 *                                             }
-	 * @param string|false|null          $version  Optional. String specifying the script module version number. Defaults to false.
-	 *                                             It is added to the URL as a query string for cache busting purposes. If $version
-	 *                                             is set to false, the version number is the currently installed WordPress version.
-	 *                                             If $version is set to null, no version is added.
-	 * @param array<string, string|bool> $args     {
+	 * @param string                              $id      The identifier of the script module. Should be unique. It will be used in the
+	 *                                                     final import map.
+	 * @param string                              $src     Optional. Full URL of the script module, or path of the script module relative
+	 *                                                     to the WordPress root directory. If it is provided and the script module has
+	 *                                                     not been registered yet, it will be registered.
+	 * @param array<string|array<string, string>> $deps    {
+	 *                                                         Optional. List of dependencies.
+	 *
+	 *                                                         @type string|array<string, string> ...$0 {
+	 *                                                             An array of script module identifiers of the dependencies of this script
+	 *                                                             module. The dependencies can be strings or arrays. If they are arrays,
+	 *                                                             they need an `id` key with the script module identifier, and can contain
+	 *                                                             an `import` key with either `static` or `dynamic`. By default,
+	 *                                                             dependencies that don't contain an `import` key are considered static.
+	 *
+	 *                                                             @type string $id     The script module identifier.
+	 *                                                             @type string $import Optional. Import type. May be either `static` or
+	 *                                                                                  `dynamic`. Defaults to `static`.
+	 *                                                         }
+	 *                                                     }
+	 * @param string|false|null                   $version Optional. String specifying the script module version number. Defaults to false.
+	 *                                                     It is added to the URL as a query string for cache busting purposes. If $version
+	 *                                                     is set to false, the version number is the currently installed WordPress version.
+	 *                                                     If $version is set to null, no version is added.
+	 * @param array<string, string|bool>          $args    {
 	 *     Optional. An array of additional args. Default empty array.
 	 *
 	 *     @type bool                $in_footer     Whether to print the script module in the footer. Only relevant to block themes. Default 'false'. Optional.
@@ -533,13 +533,87 @@ class WP_Script_Modules {
 	 * Returns the import map array.
 	 *
 	 * @since 6.5.0
+	 * @since 7.0.0 Script module dependencies ('module_dependencies') of classic scripts are now included.
+	 *
+	 * @global WP_Scripts $wp_scripts
 	 *
 	 * @return array<string, array<string, string>> Array with an `imports` key mapping to an array of script module
 	 *                                              identifiers and their respective URLs, including the version query.
 	 */
 	private function get_import_map(): array {
+		global $wp_scripts;
+
 		$imports = array();
-		foreach ( array_keys( $this->get_dependencies( $this->queue ) ) as $id ) {
+
+		// Identify script modules that are dependencies of classic scripts.
+		$classic_script_module_dependencies = array();
+		if ( $wp_scripts instanceof WP_Scripts ) {
+			$handles = array_merge(
+				$wp_scripts->queue,
+				$wp_scripts->to_do,
+				$wp_scripts->done
+			);
+
+			$processed = array();
+			while ( ! empty( $handles ) ) {
+				$handle = array_pop( $handles );
+				if ( isset( $processed[ $handle ] ) || ! isset( $wp_scripts->registered[ $handle ] ) ) {
+					continue;
+				}
+				$processed[ $handle ] = true;
+
+				$module_dependencies = $wp_scripts->get_data( $handle, 'module_dependencies' );
+				if ( is_array( $module_dependencies ) ) {
+					$missing_module_dependencies = array();
+					foreach ( $module_dependencies as $module ) {
+						if ( is_string( $module ) ) {
+							$id = $module;
+						} elseif ( is_array( $module ) && isset( $module['id'] ) && is_string( $module['id'] ) ) {
+							$id = $module['id'];
+						} else {
+							// Invalid module dependency was supplied by direct manipulation of the extra data.
+							// Normally, this error scenario would be caught when WP_Scripts::add_data() is called.
+							continue;
+						}
+
+						if ( ! isset( $this->registered[ $id ] ) ) {
+							$missing_module_dependencies[] = $id;
+						} else {
+							$classic_script_module_dependencies[] = $id;
+						}
+					}
+
+					if ( count( $missing_module_dependencies ) > 0 ) {
+						_doing_it_wrong(
+							'WP_Scripts::add_data',
+							sprintf(
+								/* translators: 1: Script handle, 2: 'module_dependencies', 3: List of missing dependency IDs. */
+								__( 'The script with the handle "%1$s" was enqueued with script module dependencies ("%2$s") that are not registered: %3$s.' ),
+								$handle,
+								'module_dependencies',
+								implode( wp_get_list_item_separator(), $missing_module_dependencies )
+							),
+							'7.0.0'
+						);
+					}
+				}
+
+				foreach ( $wp_scripts->registered[ $handle ]->deps as $dep ) {
+					if ( ! isset( $processed[ $dep ] ) ) {
+						$handles[] = $dep;
+					}
+				}
+			}
+		}
+
+		// Note: the script modules in $this->queue are not included in the importmap because they get printed as scripts.
+		$ids = array_unique(
+			array_merge(
+				$classic_script_module_dependencies,
+				array_keys( $this->get_dependencies( array_merge( $this->queue, $classic_script_module_dependencies ) ) )
+			)
+		);
+		foreach ( $ids as $id ) {
 			$src = $this->get_src( $id );
 			if ( '' !== $src ) {
 				$imports[ $id ] = $src;
diff --git a/wp-includes/class-wp-scripts.php b/wp-includes/class-wp-scripts.php
index 0ed7087a93..bb17c08bb5 100644
--- a/wp-includes/class-wp-scripts.php
+++ b/wp-includes/class-wp-scripts.php
@@ -920,6 +920,48 @@ JS;
 				);
 				return false;
 			}
+		} elseif ( 'module_dependencies' === $key ) {
+			if ( ! is_array( $value ) ) {
+				_doing_it_wrong(
+					__METHOD__,
+					sprintf(
+						/* translators: 1: 'module_dependencies', 2: Script handle. */
+						__( 'The value for "%1$s" must be an array for the "%2$s" script.' ),
+						'module_dependencies',
+						$handle
+					),
+					'7.0.0'
+				);
+				return false;
+			}
+
+			$sanitized_value = array();
+			$has_invalid_ids = false;
+			foreach ( $value as $module ) {
+				if (
+					is_string( $module ) ||
+					( is_array( $module ) && isset( $module['id'] ) && is_string( $module['id'] ) )
+				) {
+					$sanitized_value[] = $module;
+				} else {
+					$has_invalid_ids = true;
+				}
+			}
+
+			if ( $has_invalid_ids ) {
+				_doing_it_wrong(
+					__METHOD__,
+					sprintf(
+						/* translators: 1: Script handle, 2: 'module_dependencies' */
+						__( 'The script handle "%1$s" has one or more of its script module dependencies ("%2$s") which are invalid.' ),
+						$handle,
+						'module_dependencies'
+					),
+					'7.0.0'
+				);
+			}
+
+			$value = $sanitized_value;
 		}
 		return parent::add_data( $handle, $key, $value );
 	}
diff --git a/wp-includes/functions.wp-scripts.php b/wp-includes/functions.wp-scripts.php
index f1a9b2afd6..59e4e54a1a 100644
--- a/wp-includes/functions.wp-scripts.php
+++ b/wp-includes/functions.wp-scripts.php
@@ -68,6 +68,49 @@ function _wp_scripts_maybe_doing_it_wrong( $function_name, $handle = '' ) {
 	);
 }

+/**
+ * Adds the data for the recognized args and warns for unrecognized args.
+ *
+ * @ignore
+ * @since 7.0.0
+ *
+ * @param WP_Scripts $wp_scripts WP_Scripts instance.
+ * @param string     $handle     Script handle.
+ * @param array      $args       Array of extra args for the script.
+ */
+function _wp_scripts_add_args_data( WP_Scripts $wp_scripts, string $handle, array $args ) {
+	$allowed_keys = array( 'strategy', 'in_footer', 'fetchpriority', 'module_dependencies' );
+	$unknown_keys = array_diff( array_keys( $args ), $allowed_keys );
+	if ( ! empty( $unknown_keys ) ) {
+		$trace         = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 2 );
+		$function_name = ( $trace[1]['class'] ?? '' ) . ( $trace[1]['type'] ?? '' ) . $trace[1]['function'];
+		_doing_it_wrong(
+			$function_name,
+			sprintf(
+				/* translators: 1: $args, 2: List of unrecognized keys, 3: List of supported keys. */
+				__( 'Unrecognized key(s) in the %1$s param: %2$s. Supported keys: %3$s' ),
+				'$args',
+				implode( wp_get_list_item_separator(), $unknown_keys ),
+				implode( wp_get_list_item_separator(), $allowed_keys )
+			),
+			'7.0.0'
+		);
+	}
+
+	if ( ! empty( $args['in_footer'] ) ) {
+		$wp_scripts->add_data( $handle, 'group', 1 );
+	}
+	if ( ! empty( $args['strategy'] ) ) {
+		$wp_scripts->add_data( $handle, 'strategy', $args['strategy'] );
+	}
+	if ( ! empty( $args['fetchpriority'] ) ) {
+		$wp_scripts->add_data( $handle, 'fetchpriority', $args['fetchpriority'] );
+	}
+	if ( ! empty( $args['module_dependencies'] ) ) {
+		$wp_scripts->add_data( $handle, 'module_dependencies', $args['module_dependencies'] );
+	}
+}
+
 /**
  * Prints scripts in document head that are in the $handles queue.
  *
@@ -159,22 +202,25 @@ function wp_add_inline_script( $handle, $data, $position = 'after' ) {
  * @since 4.3.0 A return value was added.
  * @since 6.3.0 The $in_footer parameter of type boolean was overloaded to be an $args parameter of type array.
  * @since 6.9.0 The $fetchpriority parameter of type string was added to the $args parameter of type array.
- *
- * @param string                          $handle Name of the script. Should be unique.
- * @param string|false                    $src    Full URL of the script, or path of the script relative to the WordPress root directory.
- *                                                If source is set to false, script is an alias of other scripts it depends on.
- * @param string[]                        $deps   Optional. An array of registered script handles this script depends on. Default empty array.
- * @param string|bool|null                $ver    Optional. String specifying script version number, if it has one, which is added to the URL
- *                                                as a query string for cache busting purposes. If version is set to false, a version
- *                                                number is automatically added equal to current installed WordPress version.
- *                                                If set to null, no version is added.
- * @param array<string, string|bool>|bool $args   {
- *     Optional. An array of additional script loading strategies. Default empty array.
+ * @since 7.0.0 The $module_dependencies parameter of type string[] was added to the $args parameter of type array.
+ *
+ * @param string                                                              $handle Name of the script. Should be unique.
+ * @param string|false                                                        $src    Full URL of the script, or path of the script relative to the WordPress root directory.
+ *                                                                                    If source is set to false, script is an alias of other scripts it depends on.
+ * @param string[]                                                            $deps   Optional. An array of registered script handles this script depends on. Default empty array.
+ * @param string|bool|null                                                    $ver    Optional. String specifying script version number, if it has one, which is added to the URL
+ *                                                                                    as a query string for cache busting purposes. If version is set to false, a version
+ *                                                                                    number is automatically added equal to current installed WordPress version.
+ *                                                                                    If set to null, no version is added.
+ * @param array<string, string|bool|array<string|array<string, string>>>|bool $args   {
+ *     Optional. An array of extra args for the script. Default empty array.
  *     Otherwise, it may be a boolean in which case it determines whether the script is printed in the footer. Default false.
  *
- *     @type string    $strategy      Optional. If provided, may be either 'defer' or 'async'.
- *     @type bool      $in_footer     Optional. Whether to print the script in the footer. Default 'false'.
- *     @type string    $fetchpriority Optional. The fetch priority for the script. Default 'auto'.
+ *     @type string                              $strategy            Optional. If provided, may be either 'defer' or 'async'.
+ *     @type bool                                $in_footer           Optional. Whether to print the script in the footer. Default 'false'.
+ *     @type string                              $fetchpriority       Optional. The fetch priority for the script. Default 'auto'.
+ *     @type array<string|array<string, string>> $module_dependencies Optional. IDs for module dependencies loaded via dynamic import. Default empty array.
+ *                                                                    For the full data format, see the `$deps` param of {@see wp_register_script_module()}.
  * }
  * @return bool Whether the script has been registered. True on success, false on failure.
  */
@@ -189,15 +235,8 @@ function wp_register_script( $handle, $src, $deps = array(), $ver = false, $args
 	$wp_scripts = wp_scripts();

 	$registered = $wp_scripts->add( $handle, $src, $deps, $ver );
-	if ( ! empty( $args['in_footer'] ) ) {
-		$wp_scripts->add_data( $handle, 'group', 1 );
-	}
-	if ( ! empty( $args['strategy'] ) ) {
-		$wp_scripts->add_data( $handle, 'strategy', $args['strategy'] );
-	}
-	if ( ! empty( $args['fetchpriority'] ) ) {
-		$wp_scripts->add_data( $handle, 'fetchpriority', $args['fetchpriority'] );
-	}
+	_wp_scripts_add_args_data( $wp_scripts, $handle, $args );
+
 	return $registered;
 }

@@ -345,22 +384,25 @@ function wp_deregister_script( $handle ) {
  * @since 2.1.0
  * @since 6.3.0 The $in_footer parameter of type boolean was overloaded to be an $args parameter of type array.
  * @since 6.9.0 The $fetchpriority parameter of type string was added to the $args parameter of type array.
- *
- * @param string                          $handle Name of the script. Should be unique.
- * @param string                          $src    Full URL of the script, or path of the script relative to the WordPress root directory.
- *                                                Default empty.
- * @param string[]                        $deps   Optional. An array of registered script handles this script depends on. Default empty array.
- * @param string|bool|null                $ver    Optional. String specifying script version number, if it has one, which is added to the URL
- *                                                as a query string for cache busting purposes. If version is set to false, a version
- *                                                number is automatically added equal to current installed WordPress version.
- *                                                If set to null, no version is added.
- * @param array<string, string|bool>|bool $args   {
- *     Optional. An array of additional script loading strategies. Default empty array.
+ * @since 7.0.0 The $module_dependencies parameter of type string[] was added to the $args parameter of type array.
+ *
+ * @param string                                                              $handle Name of the script. Should be unique.
+ * @param string                                                              $src    Full URL of the script, or path of the script relative to the WordPress root directory.
+ *                                                                                    Default empty.
+ * @param string[]                                                            $deps   Optional. An array of registered script handles this script depends on. Default empty array.
+ * @param string|bool|null                                                    $ver    Optional. String specifying script version number, if it has one, which is added to the URL
+ *                                                                                    as a query string for cache busting purposes. If version is set to false, a version
+ *                                                                                    number is automatically added equal to current installed WordPress version.
+ *                                                                                    If set to null, no version is added.
+ * @param array<string, string|bool|array<string|array<string, string>>>|bool $args {
+ *     Optional. An array of extra args for the script. Default empty array.
  *     Otherwise, it may be a boolean in which case it determines whether the script is printed in the footer. Default false.
  *
- *     @type string    $strategy      Optional. If provided, may be either 'defer' or 'async'.
- *     @type bool      $in_footer     Optional. Whether to print the script in the footer. Default 'false'.
- *     @type string    $fetchpriority Optional. The fetch priority for the script. Default 'auto'.
+ *     @type string                              $strategy            Optional. If provided, may be either 'defer' or 'async'.
+ *     @type bool                                $in_footer           Optional. Whether to print the script in the footer. Default 'false'.
+ *     @type string                              $fetchpriority       Optional. The fetch priority for the script. Default 'auto'.
+ *     @type array<string|array<string, string>> $module_dependencies Optional. IDs for module dependencies loaded via dynamic import. Default empty array.
+ *                                                                    For the full data format, see the `$deps` param of {@see wp_register_script_module()}.
  * }
  */
 function wp_enqueue_script( $handle, $src = '', $deps = array(), $ver = false, $args = array() ) {
@@ -379,14 +421,8 @@ function wp_enqueue_script( $handle, $src = '', $deps = array(), $ver = false, $
 		if ( $src ) {
 			$wp_scripts->add( $_handle[0], $src, $deps, $ver );
 		}
-		if ( ! empty( $args['in_footer'] ) ) {
-			$wp_scripts->add_data( $_handle[0], 'group', 1 );
-		}
-		if ( ! empty( $args['strategy'] ) ) {
-			$wp_scripts->add_data( $_handle[0], 'strategy', $args['strategy'] );
-		}
-		if ( ! empty( $args['fetchpriority'] ) ) {
-			$wp_scripts->add_data( $_handle[0], 'fetchpriority', $args['fetchpriority'] );
+		if ( ! empty( $args ) ) {
+			_wp_scripts_add_args_data( $wp_scripts, $_handle[0], $args );
 		}
 	}

diff --git a/wp-includes/script-modules.php b/wp-includes/script-modules.php
index f851d41bf2..ee91ee4361 100644
--- a/wp-includes/script-modules.php
+++ b/wp-includes/script-modules.php
@@ -37,31 +37,31 @@ function wp_script_modules(): WP_Script_Modules {
  * @since 6.5.0
  * @since 6.9.0 Added the $args parameter.
  *
- * @param string                     $id      The identifier of the script module. Should be unique. It will be used in the
- *                                            final import map.
- * @param string                     $src     Optional. Full URL of the script module, or path of the script module relative
- *                                            to the WordPress root directory. If it is provided and the script module has
- *                                            not been registered yet, it will be registered.
- * @param array<string|array>        $deps    {
- *                                                Optional. List of dependencies.
- *
- *                                                @type string|array ...$0 {
- *                                                    An array of script module identifiers of the dependencies of this script
- *                                                    module. The dependencies can be strings or arrays. If they are arrays,
- *                                                    they need an `id` key with the script module identifier, and can contain
- *                                                    an `import` key with either `static` or `dynamic`. By default,
- *                                                    dependencies that don't contain an `import` key are considered static.
- *
- *                                                    @type string $id     The script module identifier.
- *                                                    @type string $import Optional. Import type. May be either `static` or
- *                                                                         `dynamic`. Defaults to `static`.
- *                                                }
- *                                            }
- * @param string|false|null          $version Optional. String specifying the script module version number. Defaults to false.
- *                                            It is added to the URL as a query string for cache busting purposes. If $version
- *                                            is set to false, the version number is the currently installed WordPress version.
- *                                            If $version is set to null, no version is added.
- * @param array<string, string|bool> $args    {
+ * @param string                              $id      The identifier of the script module. Should be unique. It will be used in the
+ *                                                     final import map.
+ * @param string                              $src     Optional. Full URL of the script module, or path of the script module relative
+ *                                                     to the WordPress root directory. If it is provided and the script module has
+ *                                                     not been registered yet, it will be registered.
+ * @param array<string|array<string, string>> $deps    {
+ *                                                         Optional. List of dependencies.
+ *
+ *                                                         @type string|array<string, string> ...$0 {
+ *                                                             An array of script module identifiers of the dependencies of this script
+ *                                                             module. The dependencies can be strings or arrays. If they are arrays,
+ *                                                             they need an `id` key with the script module identifier, and can contain
+ *                                                             an `import` key with either `static` or `dynamic`. By default,
+ *                                                             dependencies that don't contain an `import` key are considered static.
+ *
+ *                                                             @type string $id     The script module identifier.
+ *                                                             @type string $import Optional. Import type. May be either `static` or
+ *                                                                                  `dynamic`. Defaults to `static`.
+ *                                                         }
+ *                                                     }
+ * @param string|false|null                   $version Optional. String specifying the script module version number. Defaults to false.
+ *                                                     It is added to the URL as a query string for cache busting purposes. If $version
+ *                                                     is set to false, the version number is the currently installed WordPress version.
+ *                                                     If $version is set to null, no version is added.
+ * @param array<string, string|bool>          $args    {
  *     Optional. An array of additional args. Default empty array.
  *
  *     @type bool                $in_footer     Whether to print the script module in the footer. Only relevant to block themes. Default 'false'. Optional.
@@ -81,31 +81,31 @@ function wp_register_script_module( string $id, string $src, array $deps = array
  * @since 6.5.0
  * @since 6.9.0 Added the $args parameter.
  *
- * @param string                     $id      The identifier of the script module. Should be unique. It will be used in the
- *                                            final import map.
- * @param string                     $src     Optional. Full URL of the script module, or path of the script module relative
- *                                            to the WordPress root directory. If it is provided and the script module has
- *                                            not been registered yet, it will be registered.
- * @param array<string|array>        $deps    {
- *                                                Optional. List of dependencies.
- *
- *                                                @type string|array ...$0 {
- *                                                    An array of script module identifiers of the dependencies of this script
- *                                                    module. The dependencies can be strings or arrays. If they are arrays,
- *                                                    they need an `id` key with the script module identifier, and can contain
- *                                                    an `import` key with either `static` or `dynamic`. By default,
- *                                                    dependencies that don't contain an `import` key are considered static.
- *
- *                                                    @type string $id     The script module identifier.
- *                                                    @type string $import Optional. Import type. May be either `static` or
- *                                                                         `dynamic`. Defaults to `static`.
- *                                                }
- *                                            }
- * @param string|false|null          $version Optional. String specifying the script module version number. Defaults to false.
- *                                            It is added to the URL as a query string for cache busting purposes. If $version
- *                                            is set to false, the version number is the currently installed WordPress version.
- *                                            If $version is set to null, no version is added.
- * @param array<string, string|bool> $args    {
+ * @param string                              $id      The identifier of the script module. Should be unique. It will be used in the
+ *                                                     final import map.
+ * @param string                              $src     Optional. Full URL of the script module, or path of the script module relative
+ *                                                     to the WordPress root directory. If it is provided and the script module has
+ *                                                     not been registered yet, it will be registered.
+ * @param array<string|array<string, string>> $deps    {
+ *                                                         Optional. List of dependencies.
+ *
+ *                                                         @type string|array<string, string> ...$0 {
+ *                                                             An array of script module identifiers of the dependencies of this script
+ *                                                             module. The dependencies can be strings or arrays. If they are arrays,
+ *                                                             they need an `id` key with the script module identifier, and can contain
+ *                                                             an `import` key with either `static` or `dynamic`. By default,
+ *                                                             dependencies that don't contain an `import` key are considered static.
+ *
+ *                                                             @type string $id     The script module identifier.
+ *                                                             @type string $import Optional. Import type. May be either `static` or
+ *                                                                                  `dynamic`. Defaults to `static`.
+ *                                                         }
+ *                                                     }
+ * @param string|false|null                   $version Optional. String specifying the script module version number. Defaults to false.
+ *                                                     It is added to the URL as a query string for cache busting purposes. If $version
+ *                                                     is set to false, the version number is the currently installed WordPress version.
+ *                                                     If $version is set to null, no version is added.
+ * @param array<string, string|bool>          $args    {
  *     Optional. An array of additional args. Default empty array.
  *
  *     @type bool                $in_footer     Whether to print the script module in the footer. Only relevant to block themes. Default 'false'. Optional.
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 68067ee4d1..33befb47a0 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '7.0-alpha-61585';
+$wp_version = '7.0-alpha-61587';

 /**
  * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.