Changeset 61438 for trunk/src/wp-includes/script-modules.php
- Timestamp:
- 01/05/2026 10:49:26 AM (3 months ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/script-modules.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/script-modules.php
r61362 r61438 151 151 * 152 152 * 'interactivity/index.min.js' => array('dependencies' => array(…), 'version' => '…'), 153 * 'interactivity /debug.min.js' => array('dependencies' => array(…), 'version' => '…'),154 * ' interactivity-router/index.min.js' => …153 * 'interactivity-router/index.min.js' => array('dependencies' => array(…), 'version' => '…'), 154 * 'block-library/navigation/view.min.js' => … 155 155 */ 156 156 $assets = include ABSPATH . WPINC . "/assets/script-modules-packages{$suffix}.php"; … … 160 160 * Build the WordPress Script Module ID from the file name. 161 161 * Prepend `@wordpress/` and remove extensions and `/index` if present: 162 * - interactivity/index.min.js => @wordpress/interactivity163 * - interactivity /debug.min.js => @wordpress/interactivity/debug164 * - block-library/ query/view.js => @wordpress/block-library/query/view162 * - interactivity/index.min.js => @wordpress/interactivity 163 * - interactivity-router/index.min.js => @wordpress/interactivity-router 164 * - block-library/navigation/view.js => @wordpress/block-library/navigation/view 165 165 */ 166 166 $script_module_id = '@wordpress/' . preg_replace( '~(?:/index)?(?:\.min)?\.js$~D', '', $file_name, 1 ); 167 168 switch ( $script_module_id ) {169 /*170 * Interactivity exposes two entrypoints, "/index" and "/debug".171 * "/debug" should replace "/index" in development.172 */173 case '@wordpress/interactivity/debug':174 if ( ! SCRIPT_DEBUG ) {175 continue 2;176 }177 $script_module_id = '@wordpress/interactivity';178 break;179 case '@wordpress/interactivity':180 if ( SCRIPT_DEBUG ) {181 continue 2;182 }183 break;184 }185 167 186 168 /* … … 208 190 } 209 191 210 $path = includes_url( "js/dist/script-modules/{$file_name}" ); 211 wp_register_script_module( $script_module_id, $path, $script_module_data['dependencies'], $script_module_data['version'], $args ); 192 $path = includes_url( "js/dist/script-modules/{$file_name}" ); 193 $module_deps = $script_module_data['module_dependencies'] ?? array(); 194 wp_register_script_module( $script_module_id, $path, $module_deps, $script_module_data['version'], $args ); 212 195 } 213 196 } 197 198 /** 199 * Enqueues script modules required by the block editor. 200 * 201 * @since 6.9.0 202 */ 203 function wp_enqueue_block_editor_script_modules() { 204 /* 205 * Enqueue the LaTeX to MathML loader for the math block editor. 206 * The loader dynamically imports the main LaTeX to MathML module when needed. 207 */ 208 wp_enqueue_script_module( '@wordpress/latex-to-mathml/loader' ); 209 }
Note: See TracChangeset
for help on using the changeset viewer.