diff --git a/README.md b/README.md index d7807d3d..f9bdb56a 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,10 @@ Executes Javascript, Typescript Scripts. + +### **WORK IN PROGRESS** +* (foxriver76) added fallback to require the adapters `request` module if no own installed + ### 8.7.3 (2024-07-25) * (@klein0r) Fixed script deletion (icon was missing) * (@klein0r) Fixed some translations and Blockly definitions diff --git a/lib/sandbox.js b/lib/sandbox.js index a0046e3f..9aecea7f 100644 --- a/lib/sandbox.js +++ b/lib/sandbox.js @@ -534,11 +534,16 @@ function sandBox(script, name, verbose, debug, context) { md = md.replace(/^node:/, ''); } - if (typeof md === 'string') { - if (md === 'request' && !sandbox.__engine.__deprecatedWarnings.includes(md)) { + if (md === 'request') { + if (!sandbox.__engine.__deprecatedWarnings.includes(md)) { sandbox.log(`request package is deprecated - please use httpGet (or a stable lib like axios) instead!`, 'warn'); sandbox.__engine.__deprecatedWarnings.push(md); } + + if (!mods[md]) { + // for backward compatibility we require the adapters own request module as back in the days this module did not need to be specified in the additional npm modules + mods[md] = require(md); + } } if (mods[md]) {