Permalink
Browse files

add support for specifying dependencies in the second argument of mod…

…ule define() calls within findRequires() - used by CommonJS projects
  • Loading branch information...
1 parent 2c63e30 commit a0f456423463a77923e4cd036e2172e78ef5d93f @mihaisucan mihaisucan committed May 25, 2012
Showing with 13 additions and 5 deletions.
  1. +13 −5 lib/dryice/index.js
View
@@ -865,8 +865,20 @@ function findRequires(module) {
// different name. that was a useful escape system, but now we detect
// computed requires, it's not needed.
if (expr[1] === 'define') {
+ var params = null;
if (args[0][0] === 'array') {
- var params = args[0][1];
+ params = args[0][1];
+ }
+ else if (args[0][0] === 'string' && args[1][0] == 'array') {
+ params = args[1][1];
+ }
+ else {
+ console.log('- ' + module.path + ' has define(...) ' +
+ 'with non-array parameter. Ignoring requirement.');
+ return;
+ }
+
+ if (params) {
for (var i = 0; i < params.length; i++) {
param = params[i];
if (param[0] === 'string') {
@@ -878,10 +890,6 @@ function findRequires(module) {
}
}
}
- else {
- console.log('- ' + module.path + ' has define(...) ' +
- 'with non-array parameter. Ignoring requirement.');
- }
}
if (expr[1] === 'require') {
if (args[0][0] === 'string') {

0 comments on commit a0f4564

Please sign in to comment.