mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
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
This commit is contained in:
parent
3527a38405
commit
9ec09c3b4a
@ -65,7 +65,7 @@ module.exports = function( grunt ) {
|
|||||||
if ( /.\/var\//.test( path.replace( process.cwd(), "" ) ) ) {
|
if ( /.\/var\//.test( path.replace( process.cwd(), "" ) ) ) {
|
||||||
contents = contents
|
contents = contents
|
||||||
.replace(
|
.replace(
|
||||||
/define\([\w\W]*?return/,
|
/define\(\s*(["'])[\w\W]*?\1[\w\W]*?return/,
|
||||||
"var " +
|
"var " +
|
||||||
( /var\/([\w-]+)/.exec( name )[ 1 ] ) +
|
( /var\/([\w-]+)/.exec( name )[ 1 ] ) +
|
||||||
" ="
|
" ="
|
||||||
|
Loading…
Reference in New Issue
Block a user