From 37f1da6b91a86ef3f54f4cf16dd87f5afd33c835 Mon Sep 17 00:00:00 2001 From: Dave Methvin Date: Sun, 18 Sep 2016 22:07:34 -0400 Subject: [PATCH] Build: Make sourcemap updates in two .replace() passes Fixes gh-3260 Closes gh-3321 --- build/release/cdn.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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 ); -- 2.39.5