Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #78 from chaozhang/master

handle "(" before "require" for require regex, fix bug from AMD circular test
  • Loading branch information...
commit e9d4f581edc9e2c0c8c5f750546c2b0e8820416b 2 parents db4410d + 6539829
@Jakobo Jakobo authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  src/inject.coffee
View
2  src/inject.coffee
@@ -74,7 +74,7 @@ Regexes to extract function identifiers, comments, require() statements, or requ
functionRegex = /^[\s\(]*function[^(]*\(([^)]*)\)/
functionNewlineRegex = /\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g
functionSpaceRegex = /\s+/g
-requireRegex = /(?:^|[^\w\$_.])require\s*\(\s*("[^"\\]*(?:\\.[^"\\]*)*"|'[^'\\]*(?:\\.[^'\\]*)*')\s*\)/g
+requireRegex = /(?:^|[^\w\$_.\(])require\s*\(\s*("[^"\\]*(?:\\.[^"\\]*)*"|'[^'\\]*(?:\\.[^'\\]*)*')\s*\)/g
defineStaticRequireRegex = /^[\r\n\s]*define\(\s*("\S+",|'\S+',|\s*)\s*\[([^\]]*)\],\s*(function\s*\(|{).+/
commentRegex = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg
Please sign in to comment.
Something went wrong with that request. Please try again.