mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Rework Function node module integration
This commit is contained in:
@@ -26,7 +26,6 @@ var flows = require("../flows");
|
||||
var flowUtil = require("../flows/util")
|
||||
var context = require("./context");
|
||||
var Node = require("./Node");
|
||||
var npmModule = require("./npmModule");
|
||||
var log;
|
||||
|
||||
const events = require("@node-red/util").events;
|
||||
@@ -50,7 +49,6 @@ function registerType(nodeSet,type,constructor,opts) {
|
||||
type = nodeSet;
|
||||
nodeSet = "";
|
||||
}
|
||||
var dynModule = null;
|
||||
if (opts) {
|
||||
if (opts.credentials) {
|
||||
credentials.register(type,opts.credentials);
|
||||
@@ -62,11 +60,7 @@ function registerType(nodeSet,type,constructor,opts) {
|
||||
log.warn("["+type+"] "+err.message);
|
||||
}
|
||||
}
|
||||
if (opts.dynamicModuleList) {
|
||||
dynModule = opts.dynamicModuleList;
|
||||
}
|
||||
}
|
||||
npmModule.register(type, dynModule);
|
||||
if(!(constructor.prototype instanceof Node)) {
|
||||
if(Object.getPrototypeOf(constructor.prototype) === Object.prototype) {
|
||||
util.inherits(constructor,Node);
|
||||
@@ -87,7 +81,7 @@ function registerType(nodeSet,type,constructor,opts) {
|
||||
}
|
||||
}
|
||||
}
|
||||
registry.registerType(nodeSet,type,constructor);
|
||||
registry.registerType(nodeSet,type,constructor,opts);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,7 +110,6 @@ function createNode(node,def) {
|
||||
} else if (credentials.getDefinition(node.type)) {
|
||||
node.credentials = {};
|
||||
}
|
||||
return npmModule.checkInstall(def);
|
||||
}
|
||||
|
||||
function registerSubflow(nodeSet, subflow) {
|
||||
@@ -145,7 +138,6 @@ function init(runtime) {
|
||||
flows.init(runtime);
|
||||
registry.init(runtime);
|
||||
context.init(runtime.settings);
|
||||
npmModule.init(runtime);
|
||||
}
|
||||
|
||||
function disableNode(id) {
|
||||
@@ -270,10 +262,4 @@ module.exports = {
|
||||
loadContextsPlugin: context.load,
|
||||
closeContextsPlugin: context.close,
|
||||
listContextStores: context.listStores,
|
||||
|
||||
// NPM modules
|
||||
listNPMModules: npmModule.list,
|
||||
uninstallNPMModule: npmModule.uninstall,
|
||||
updateNPMModule: npmModule.update,
|
||||
loadNPMModule: npmModule.load
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user