red/nodes/registry.js
/**
 * Scans the node_modules path for nodes
 * @param moduleName the name of the module to be found
 * @return a list of node modules: {dir,package}
 */
Scans the node_modules path for nodes
@param moduleName the name of the module to be found
@return a list of node modules: {dir,package}
Scans the node_modules path for nodes @param moduleName the name of the module to be found @return a list of node modules : { dir package }
function scanTreeForNodesModules(moduleName) {
    var dir = __dirname+"/../../nodes";
    var results = [];
    var up = path.resolve(path.join(dir,".."));
    while (up !== dir) {
        var pm = path.join(dir,"node_modules");
        try {
            var files = fs.readdirSync(pm);
            files.forEach(function(fn) {
                if (!moduleName || fn == moduleName) {
                    var pkgfn = path.join(pm,fn,"package.json");
                    try {
                        var pkg = require(pkgfn);
                        if (pkg['node-red']) {
                            var moduleDir = path.join(pm,fn);
                            results.push({dir:moduleDir,package:pkg});
                        }
                    } catch(err) {
                        if (err.code != "MODULE_NOT_FOUND") {
                        }
                    }
                }
            });
        } catch(err) {
        }
        dir = up;
        up = path.resolve(path.join(dir,".."));
    }
    return results;
}
function scanTreeForNodesModules ( moduleName ) { var dir = __dirname + "/../../nodes" ; var results = [ ] ; var up = path . resolve ( path . join ( dir , ".." ) ) ; while ( up !== dir ) { var pm = path . join ( dir , "node_modules" ) ; try { var files = fs . readdirSync ( pm ) ; files . forEach ( function ( fn ) { if ( ! moduleName || fn == moduleName ) { var pkgfn = path . join ( pm , fn , "package.json" ) ; try { var pkg = require ( pkgfn ) ; if ( pkg [ 'node-red' ] ) { var moduleDir = path . join ( pm , fn ) ; results . push ( { dir : moduleDir , package : pkg } ) ; } } catch ( err ) { if ( err . code != "MODULE_NOT_FOUND" ) { } } } } ) ; } catch ( err ) { } dir = up ; up = path . resolve ( path . join ( dir , ".." ) ) ; } return results ; }
Scans the node_modules path for nodes
 @param moduleName the name of the module to be found
 @return a list of node modules: {dir,package}
Scans the node_modules path for nodes @param moduleName the name of the module to be found @return a list of node modules : { dir package }
// TODO: handle unexpected error