From: Michał Gołębiowski-Owczarek Date: Mon, 13 May 2019 19:55:45 +0000 (+0200) Subject: Build: Fix the regex parsing AMD var-modules (#4389) X-Git-Tag: 3.5.0~40 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=36b59c9661b7c24bb0271f813d2a02cac44de81a;p=jquery.git Build: Fix the regex parsing AMD var-modules (#4389) The previous regex caused the final jQuery binary to have syntax errors for var-modules with names starting with "return". For example, the following module wouldn't work when the file is named `returnTrue.js`: ```js define( function() { "use strict"; return function returnTrue() { return true; }; } ); ``` Closes gh-4389 (cherry picked from commit 9ec09c3b4aa5182c2a8b8f51afb861b685a4003c) --- diff --git a/build/tasks/build.js b/build/tasks/build.js index 69916bf02..b59ef816e 100644 --- a/build/tasks/build.js +++ b/build/tasks/build.js @@ -65,7 +65,7 @@ module.exports = function( grunt ) { if ( /.\/var\//.test( path.replace( process.cwd(), "" ) ) ) { contents = contents .replace( - /define\([\w\W]*?return/, + /define\(\s*(["'])[\w\W]*?\1[\w\W]*?return/, "var " + ( /var\/([\w-]+)/.exec( name )[ 1 ] ) + " ="