mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Remove outdated Node <16 checks
This commit is contained in:
parent
1e065ba7b0
commit
61451187a8
@ -28,11 +28,6 @@ let installEnabled = true;
|
|||||||
let installAllowList = ['*'];
|
let installAllowList = ['*'];
|
||||||
let installDenyList = [];
|
let installDenyList = [];
|
||||||
|
|
||||||
let IMPORT_SUPPORTED = true;
|
|
||||||
const nodeVersionParts = process.versions.node.split(".").map(v => parseInt(v));
|
|
||||||
if (nodeVersionParts[0] < 12 || (nodeVersionParts[0] === 12 && nodeVersionParts[1] < 17)) {
|
|
||||||
IMPORT_SUPPORTED = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getInstallDir() {
|
function getInstallDir() {
|
||||||
return path.resolve(settings.userDir || process.env.NODE_RED_HOME || ".");
|
return path.resolve(settings.userDir || process.env.NODE_RED_HOME || ".");
|
||||||
@ -110,18 +105,6 @@ function requireModule(module) {
|
|||||||
return require(moduleDir);
|
return require(moduleDir);
|
||||||
}
|
}
|
||||||
function importModule(module) {
|
function importModule(module) {
|
||||||
if (!IMPORT_SUPPORTED) {
|
|
||||||
// On Node < 12.17 - fall back to try a require
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
try {
|
|
||||||
const mod = requireModule(module);
|
|
||||||
resolve(mod);
|
|
||||||
} catch(err) {
|
|
||||||
reject(err);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!registryUtil.checkModuleAllowed( module, null,installAllowList,installDenyList)) {
|
if (!registryUtil.checkModuleAllowed( module, null,installAllowList,installDenyList)) {
|
||||||
const e = new Error("Module not allowed");
|
const e = new Error("Module not allowed");
|
||||||
e.code = "module_not_allowed";
|
e.code = "module_not_allowed";
|
||||||
|
7
packages/node_modules/node-red/lib/red.js
vendored
7
packages/node_modules/node-red/lib/red.js
vendored
@ -25,11 +25,8 @@ var api = require("@node-red/editor-api");
|
|||||||
var server = null;
|
var server = null;
|
||||||
var apiEnabled = false;
|
var apiEnabled = false;
|
||||||
|
|
||||||
const NODE_MAJOR_VERSION = process.versions.node.split('.')[0];
|
const dns = require('node:dns');
|
||||||
if (NODE_MAJOR_VERSION > 14) {
|
dns.setDefaultResultOrder('ipv4first');
|
||||||
const dns = require('node:dns');
|
|
||||||
dns.setDefaultResultOrder('ipv4first');
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkVersion(userSettings) {
|
function checkVersion(userSettings) {
|
||||||
var semver = require('semver');
|
var semver = require('semver');
|
||||||
|
@ -2476,8 +2476,7 @@ describe('HTTP Request Node', function() {
|
|||||||
|
|
||||||
const versions = process.versions.node.split('.')
|
const versions = process.versions.node.split('.')
|
||||||
|
|
||||||
if (( versions[0] == 14 && versions[1] >= 20 ) ||
|
if (( versions[0] == 16 && versions[1] >= 16 ) ||
|
||||||
( versions[0] == 16 && versions[1] >= 16 ) ||
|
|
||||||
( versions[0] == 18 && versions[1] >= 5 ) ||
|
( versions[0] == 18 && versions[1] >= 5 ) ||
|
||||||
( versions[0] > 18)) {
|
( versions[0] > 18)) {
|
||||||
// only test if on new enough NodeJS version
|
// only test if on new enough NodeJS version
|
||||||
|
Loading…
Reference in New Issue
Block a user