From c1526db4787b0e154c888fd440ac25b86e106b0b Mon Sep 17 00:00:00 2001 From: russa Date: Mon, 15 Dec 2014 18:58:17 +0100 Subject: [PATCH 1/2] added project-files to ignore list --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 From bae87a570b3ece6e79c037d8a38a4c6887fb0ba3 Mon Sep 17 00:00:00 2001 From: russa Date: Tue, 16 Dec 2014 13:45:15 +0100 Subject: [PATCH 2/2] FIX for decting presence of AMD or CommonJS modules (i.e. detecting whether or not parsing for dependencies is required or not) --- lib/parse/amd.js | 2 +- lib/parse/cjs.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 4bbedbe2..71d45719 100644 --- a/lib/parse/cjs.js +++ b/lib/parse/cjs.js @@ -71,7 +71,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) {