red/nodes/registry.js
/**
 * Loads the nodes provided in an npm package.
 * @param moduleDir the root directory of the package
 * @param pkg the module's package.json object
 */
Loads the nodes provided in an npm package.
@param moduleDir the root directory of the package
@param pkg the module's package.json object
Loads the nodes provided in an npm package . @param moduleDir the root directory of the package @param pkg the module ' s package . json object
function loadNodesFromModule(moduleDir,pkg) {
    var nodes = pkg['node-red'].nodes||{};
    var results = [];
    var iconDirs = [];
    for (var n in nodes) {
        if (nodes.hasOwnProperty(n)) {
            var file = path.join(moduleDir,nodes[n]);
            results.push(loadNodeConfig(file,pkg.name,n));
            var iconDir = path.join(moduleDir,path.dirname(nodes[n]),"icons");
            if (iconDirs.indexOf(iconDir) == -1) {
                if (fs.existsSync(iconDir)) {
                    events.emit("node-icon-dir",iconDir);
                    iconDirs.push(iconDir);
                }
            }
        }
    }
    return results;
}
function loadNodesFromModule ( moduleDir , pkg ) { var nodes = pkg [ 'node-red' ] . nodes || { } ; var results = [ ] ; var iconDirs = [ ] ; for ( var n in nodes ) { if ( nodes . hasOwnProperty ( n ) ) { var file = path . join ( moduleDir , nodes [ n ] ) ; results . push ( loadNodeConfig ( file , pkg . name , n ) ) ; var iconDir = path . join ( moduleDir , path . dirname ( nodes [ n ] ) , "icons" ) ; if ( iconDirs . indexOf ( iconDir ) == - 1 ) { if ( fs . existsSync ( iconDir ) ) { events . emit ( "node-icon-dir" , iconDir ) ; iconDirs . push ( iconDir ) ; } } } } return results ; }
Loads the nodes provided in an npm package.
Loads the nodes provided in an npm package .