diff --git a/.gitignore b/.gitignore index 6b3fa8ae..c2f87f8d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ gen.sh config.json node_modules -!test/files/cjs/node_modules \ No newline at end of file +!test/files/cjs/node_modules +/.project +/.settings diff --git a/lib/parse/amd.js b/lib/parse/amd.js index b27e017e..821580f5 100644 --- a/lib/parse/amd.js +++ b/lib/parse/amd.js @@ -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) { diff --git a/lib/parse/cjs.js b/lib/parse/cjs.js index fddeb68f..bfda3384 100644 --- a/lib/parse/cjs.js +++ b/lib/parse/cjs.js @@ -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) {