diff options
author | Michał Gołębiowski-Owczarek <m.goleb@gmail.com> | 2019-05-13 21:55:45 +0200 |
---|---|---|
committer | Michał Gołębiowski-Owczarek <m.goleb@gmail.com> | 2019-09-26 01:18:22 +0200 |
commit | 36b59c9661b7c24bb0271f813d2a02cac44de81a (patch) | |
tree | 0a30e40ee07e6e368aa0df4bb441590a6fcef8fe /build/tasks/build.js | |
parent | 30f5c6c3ee3a128c7b75a771d4cb8a5b750ae17d (diff) | |
download | jquery-36b59c9661b7c24bb0271f813d2a02cac44de81a.tar.gz jquery-36b59c9661b7c24bb0271f813d2a02cac44de81a.zip |
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)
Diffstat (limited to 'build/tasks/build.js')
-rw-r--r-- | build/tasks/build.js | 2 |
1 files changed, 1 insertions, 1 deletions
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 ] ) + " =" |