From: Dave Methvin Date: Mon, 19 Sep 2016 02:07:34 +0000 (-0400) Subject: Build: Make sourcemap updates in two .replace() passes X-Git-Tag: 3.1.1~4 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=37f1da6b91a86ef3f54f4cf16dd87f5afd33c835;p=jquery.git Build: Make sourcemap updates in two .replace() passes Fixes gh-3260 Closes gh-3321 --- diff --git a/build/release/cdn.js b/build/release/cdn.js index 3b485112e..050606203 100644 --- a/build/release/cdn.js +++ b/build/release/cdn.js @@ -40,11 +40,12 @@ function makeReleaseCopies( Release ) { // Map files need to reference the new uncompressed name; // assume that all files reside in the same directory. - // "file":"jquery.min.js","sources":["jquery.js"] + // "file":"jquery.min.js" ... "sources":["jquery.js"] text = fs.readFileSync( builtFile, "utf8" ) - .replace( /"file":"([^"]+)","sources":\["([^"]+)"\]/, - "\"file\":\"" + unpathedFile.replace( /\.min\.map/, ".min.js" ) + - "\",\"sources\":[\"" + unpathedFile.replace( /\.min\.map/, ".js" ) + "\"]" ); + .replace( /"file":"([^"]+)"/, + "\"file\":\"" + unpathedFile.replace( /\.min\.map/, ".min.js\"" ) ) + .replace( /"sources":\["([^"]+)"\]/, + "\"sources\":[\"" + unpathedFile.replace( /\.min\.map/, ".js" ) + "\"]" ); fs.writeFileSync( releaseFile, text ); } else if ( builtFile !== releaseFile ) { shell.cp( "-f", builtFile, releaseFile );