Skip to content

Commit

Permalink
added fallback not only for request
Browse files Browse the repository at this point in the history
  • Loading branch information
foxriver76 committed Jul 27, 2024
1 parent e670ecb commit 03e91eb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Executes Javascript, Typescript Scripts.
-->
### **WORK IN PROGRESS**
* (@klein0r) Fixed right aligned script names when using multiple instances
* (foxriver76) added fallback for all require calls in scripts

### 8.7.4 (2024-07-27)
* (foxriver76) added fallback to require the adapters `request` module if no own installed
Expand Down
10 changes: 6 additions & 4 deletions lib/sandbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -539,11 +539,13 @@ function sandBox(script, name, verbose, debug, context) {
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]) {
// the user requires a module which is not specified in the additional node modules
// for backward compatibility we check if the module can simply be required directly before we fail (e.g. direct dependencies of javascript adapter)
adapter.log.debug(`Try direct require of "${md}" as not specified in the additional dependencies`);
mods[md] = require(md);
}

if (mods[md]) {
Expand Down

0 comments on commit 03e91eb

Please sign in to comment.