Skip to content

Commit

Permalink
fixed iterator issues
Browse files Browse the repository at this point in the history
  • Loading branch information
khrome committed Jun 17, 2014
1 parent 8348d9e commit 816e2b5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
19 changes: 16 additions & 3 deletions builder.js
Expand Up @@ -160,28 +160,41 @@ ManifestBuilder.prototype = {
return str.substring(str.length - substr.length) === substr;
};
var ob = this;
var iterator = 'forEachEmission';
this.localModules(function(err, modules){
var moduleNames = Object.keys(modules);
var FNs = [];
arrays.forAllEmissions(moduleNames, function(name, key, complete){
arrays[iterator](moduleNames, function(name, key, complete){
var moduleName = modules[name].browserMain || modules[name].main || 'index.js';
var nn = (moduleName.substr(-3, 3).toLowerCase() === '.js') ?
moduleName.substr(0, moduleName.length-3) :
moduleName;
entries.paths[name] = modules[name].location+nn;
var shim = {};
if(modules[name].resources){
arrays.forAllEmissions(modules[name].resources, function(resource, index, done){
arrays[iterator](modules[name].resources, function(resource, index, done){
var found = false;
//console.log('here1');
Object.keys(handlers).forEach(function(typeName){
//console.log('here2');
if(endsWith('.'+typeName, resource.toLowerCase())){
//console.log('here3');
found = true;
handlers[typeName]('./node_modules/'+name+'/'+resource, function(err, shimPath){
if(!shim.deps) shim.deps = [];
shim.deps[index] = shimPath;
//console.log('handled '+resource, shim.deps.length);
done();
});
}else done(); //short circuit if we don't understand the type
}
});
//console.log('handling '+resource, found, modules[name].resources.length);
if(!found){
//console.log('short circuit');
done(); //short circuit if we don't understand the type
}
}, function(){
//console.log('something');
if(shim.deps) entries.shim[name] = shim;
var lines = [];
if(options.process === true && modules[name].extensions){
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "requirejs-manifest-builder",
"homepage": "https://github.com/khrome/requirejs-manifest-builder",
"version": "0.2.0-beta",
"version": "0.2.1-beta",
"main": "builder.js",
"description": "A utility for mapping a set of UMD NPMs into a requirejs config file",
"keywords": [
Expand Down

0 comments on commit 816e2b5

Please sign in to comment.