Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix #13983. Switch to //# for sourcemap directives.
  • Loading branch information
mgol committed Sep 5, 2013
1 parent 58a5040 commit dfaee32
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 21 deletions.
6 changes: 2 additions & 4 deletions Gruntfile.js
Expand Up @@ -85,12 +85,10 @@ module.exports = function( grunt ) {
"dist/jquery.pre-min.js": [ "dist/jquery.js" ]
},
options: {
banner: "\n\n\n\n\n\n\n\n\n\n" + // banner line size must be preserved
banner: "\n\n\n\n\n\n\n\n\n\n\n\n" + // banner line size must be preserved
"/*! jQuery v<%= pkg.version %> | " +
"(c) 2005, 2013 jQuery Foundation, Inc. | " +
"jquery.org/license\n" +
"//@ sourceMappingURL=jquery.min.map\n" +
"*/\n"
"jquery.org/license */\n"
}
}
},
Expand Down
12 changes: 0 additions & 12 deletions build/tasks/dist.js
Expand Up @@ -57,18 +57,6 @@ module.exports = function( grunt ) {
if ( /\.map$/.test( filename ) ) {
text = text.replace( /"dist\//g, "\"" );
fs.writeFileSync( filename, text, "utf-8" );

// Use our hard-coded sourceMap directive instead of the autogenerated one (#13274; #13776)
} else if ( /\.min\.js$/.test( filename ) ) {
i = 0;
text = text.replace( /(?:\/\*|)\n?\/\/@\s*sourceMappingURL=.*(\n\*\/|)/g,
function( match ) {
if ( i++ ) {
return "";
}
return match;
});
fs.writeFileSync( filename, text, "utf-8" );
}

// Optionally copy dist files to other locations
Expand Down
6 changes: 1 addition & 5 deletions build/tasks/uglify.js
Expand Up @@ -38,12 +38,8 @@ module.exports = function( grunt ) {
// Rename the file to a temporary name.
fs.renameSync( mapFileName, mapping.dest);
grunt.file.write( mapFileName, grunt.file.read( mapping.dest )
// The uglify task erroneously prepends dist/ to file names.
.replace( /"dist\//g, "\"" )
// Refer to the source jquery.js, not the temporary jquery.pre-min.js.
.replace( /\.pre-min\./g, "." )
// There's already a pragma at the beginning of the file, remove the one at the end.
.replace( /\/\/@ sourceMappingURL=jquery\.min\.map$/g, "" ));
.replace( /\.pre-min\./g, "." ));
});

// Remove temporary files.
Expand Down

0 comments on commit dfaee32

Please sign in to comment.