Skip to content

Commit

Permalink
Merge branch 'FIX-detecting-modules-for-parsing' of https://github.co…
Browse files Browse the repository at this point in the history
  • Loading branch information
pahen committed Dec 19, 2014
2 parents a23178c + bae87a5 commit 1e1663c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
gen.sh
config.json
node_modules
!test/files/cjs/node_modules
!test/files/cjs/node_modules
/.project
/.settings
2 changes: 1 addition & 1 deletion lib/parse/amd.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ AMD.prototype.parseFile = function (filename) {

this.emit('parseFile', {filename: filename, src: src});

if (src.indexOf('define(') >= 0 || src.indexOf('require(') >= 0) {
if (/define|require\s*\(/m.test(src)) {
amdetective(src).map(function (obj) {
return typeof(obj) === 'string' ? [obj] : obj.deps;
}).filter(function (deps) {
Expand Down
2 changes: 1 addition & 1 deletion lib/parse/cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ CJS.prototype.parseFile = function (filename) {

this.emit('parseFile', {filename: filename, src: src});

if (src.indexOf('require(') >= 0) {
if (/require\s*\(/m.test(src)) {
detective(src).map(function (id) {
var depFilename = this.resolve(path.dirname(filename), id);
if (depFilename) {
Expand Down

0 comments on commit 1e1663c

Please sign in to comment.