- if ( is_string( $scripts ) ) {
- // Site and user module are a legacy scripts that run in the global scope (no closure).
- // Transportation as string instructs mw.loader.implement to use globalEval.
- if ( $name === 'site' || $name === 'user' ) {
- // Minify manually because the general makeModuleResponse() minification won't be
- // effective here due to the script being a string instead of a function. (T107377)
- if ( !ResourceLoader::inDebugMode() ) {
- $scripts = self::filter( 'minify-js', $scripts );
- }
- } else {
- $scripts = new XmlJsCode( "function ( $, jQuery, require, module ) {\n{$scripts}\n}" );
- }
- } elseif ( !is_array( $scripts ) ) {
+
+ if ( $scripts instanceof XmlJsCode ) {
+ $scripts = new XmlJsCode( "function ( $, jQuery, require, module ) {\n{$scripts->value}\n}" );
+ } elseif ( !is_string( $scripts ) && !is_array( $scripts ) ) {