Rework Function node module integration

This commit is contained in:
Nick O'Leary
2021-02-12 18:14:13 +00:00
parent 4a1d66f210
commit 9c09ee3b71
20 changed files with 800 additions and 1384 deletions

View File

@@ -17,6 +17,7 @@
const path = require("path");
const semver = require("semver");
const {events,i18n,log} = require("@node-red/util");
var runtime;
function copyObjectProperties(src,dst,copyList,blockList) {
@@ -45,13 +46,8 @@ function requireModule(name) {
var relPath = path.relative(__dirname, moduleInfo.path);
return require(relPath);
} else {
var npm = runtime.nodes.loadNPMModule(name);
if (npm) {
return npm;
}
var err = new Error(`Cannot find module '${name}'`);
err.code = "MODULE_NOT_FOUND";
throw err;
// Require it here to avoid the circular dependency
return require("./externalModules").require(name);
}
}
@@ -129,7 +125,6 @@ function checkAgainstList(module,version,list) {
}
function checkModuleAllowed(module,version,allowList,denyList) {
// console.log("checkModuleAllowed",module,version);//,allowList,denyList)
if (!allowList && !denyList) {
// Default to allow
return true;