function convert( name, path, contents ) {
        var amdName;

        // Convert var modules
        if ( /.\/var\//.test( path.replace( process.cwd(), "" ) ) ) {
            contents = contents
                .replace( /define\([\w\W]*?return undefined\s*;/, "    var " + ( /var\/([\w-]+)/.exec( name )[ 1 ] ) + ";" )
                .replace( /define\([\w\W]*?return/, "    var " + ( /var\/([\w-]+)/.exec( name )[ 1 ] ) + " =" )
                .replace( rdefineEnd, "" );

        } else if ( /.\/function\//.test( path.replace( process.cwd(), "" ) ) ) {
            contents = contents
                .replace( /define\([\w\W]*?return function/, "    function " + ( /function\/([\w-]+)/.exec( name )[ 1 ] ) + "")
                .replace( rdefineEnd, "" );

            // Remove empty definitions
            contents = contents
                .replace( /define\(\[[^\]]*\]\)[\W\r\n]+$/, "" );

        } else {
            contents = contents
                .replace( /\s*return\s+[^\}]+(\}\s*?\);[^\w\}]*)$/, "$1" )

                // Multiple exports
                .replace( /\s*exports\.\w+\s*=\s*\w+;/g, "" );

            // Remove define wrappers, closure ends, and empty declarations
            contents = contents
                .replace( /define\([^{]*?{/, "" )
                .replace( rdefineEnd, "" );

            // Remove anything wrapped with
            // /* ExcludeStart */ /* ExcludeEnd */
            // or a single line directly after a // BuildExclude comment
            contents = contents
                .replace( /\/\*\s*ExcludeStart\s*\*\/[\w\W]*?\/\*\s*ExcludeEnd\s*\*\//ig, "" )
                .replace( /\/\/\s*BuildExclude\r?\n\r?[\w\W]*?\r?\n\r?/ig, "" );

            // Remove empty definitions
            contents = contents
                .replace( /define\(\[[^\]]*\]\)[\W\r\n]+$/, "" );
        }

        // AMD Name
        if ( ( amdName = grunt.option( "amd" ) ) != null && /^exports\/amd$/.test( name ) ) {

            // Remove the comma for anonymous defines
            contents = contents
                .replace( new RegExp('/(\s*)"' + pkg.name + '"(\,\s*)/'),
                    amdName ? "$1\"" + amdName + "\"$2" : "" );

        }
        return contents;
    }
Strip all definitions generated by requirejs
Convert "var" modules to var declarations
"var module" means the module only contains a return
statement that should be converted to a var declaration
This is indicated by including the file in any "var" folder
@param {String} name
@param {String} path
@param {String} contents The contents to be written (including their AMD wrappers)