Skip to content

Commit

Permalink
Remove outdated Node <18 checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Rotzbua committed Feb 19, 2024
1 parent bac71ee commit 30c936d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 25 deletions.
17 changes: 0 additions & 17 deletions packages/node_modules/@node-red/registry/lib/externalModules.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ let installEnabled = true;
let installAllowList = ['*'];
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() {
return path.resolve(settings.userDir || process.env.NODE_RED_HOME || ".");
Expand Down Expand Up @@ -110,18 +105,6 @@ function requireModule(module) {
return require(moduleDir);
}
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)) {
const e = new Error("Module not allowed");
e.code = "module_not_allowed";
Expand Down
7 changes: 2 additions & 5 deletions packages/node_modules/node-red/lib/red.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,8 @@ var api = require("@node-red/editor-api");
var server = null;
var apiEnabled = false;

const NODE_MAJOR_VERSION = process.versions.node.split('.')[0];
if (NODE_MAJOR_VERSION >= 16) {
const dns = require('dns');
dns.setDefaultResultOrder('ipv4first');
}
const dns = require('dns');
dns.setDefaultResultOrder('ipv4first');

function checkVersion(userSettings) {
var semver = require('semver');
Expand Down
4 changes: 1 addition & 3 deletions test/nodes/core/network/21-httprequest_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2476,9 +2476,7 @@ describe('HTTP Request Node', function() {

const versions = process.versions.node.split('.')

if (( versions[0] == 14 && versions[1] >= 20 ) ||
( versions[0] == 16 && versions[1] >= 16 ) ||
( versions[0] == 18 && versions[1] >= 5 ) ||
if (( versions[0] == 18 && versions[1] >= 5 ) ||
( versions[0] > 18)) {
// only test if on new enough NodeJS version

Expand Down

0 comments on commit 30c936d

Please sign in to comment.