iobroker.javascript 8.7.5 → 8.7.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/sandbox.js CHANGED
@@ -541,24 +541,30 @@ function sandBox(script, name, verbose, debug, context) {
541
541
  }
542
542
  }
543
543
 
544
- if (!mods[md]) {
544
+ if (mods[md]) {
545
+ return mods[md];
546
+ }
547
+
548
+
549
+ let error;
550
+
551
+ try {
552
+ mods[md] = require(adapter.getAdapterScopedPackageIdentifier ? adapter.getAdapterScopedPackageIdentifier(md) : md);
553
+ return mods[md];
554
+ } catch (e) {
555
+ error = e;
556
+ }
557
+
558
+ try {
545
559
  // the user requires a module which is not specified in the additional node modules
546
560
  // for backward compatibility we check if the module can simply be required directly before we fail (e.g. direct dependencies of javascript adapter)
547
561
  adapter.log.debug(`Try direct require of "${md}" as not specified in the additional dependencies`);
548
562
  mods[md] = require(md);
549
- }
550
563
 
551
- if (mods[md]) {
552
564
  return mods[md];
553
- } else {
554
- try {
555
- mods[md] = require(adapter.getAdapterScopedPackageIdentifier ? adapter.getAdapterScopedPackageIdentifier(md) : md);
556
-
557
- return mods[md];
558
- } catch (e) {
559
- adapter.setState(`scriptProblem.${name.substring('script.js.'.length)}`, { val: true, ack: true, c: 'require' });
560
- context.logError(name, e, 6);
561
- }
565
+ } catch (e) {
566
+ context.logError(name, error || e, 6);
567
+ adapter.setState(`scriptProblem.${name.substring('script.js.'.length)}`, { val: true, ack: true, c: 'require' });
562
568
  }
563
569
  },
564
570
  Buffer: Buffer,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.javascript",
3
- "version": "8.7.5",
3
+ "version": "8.7.6",
4
4
  "description": "Rules Engine for ioBroker",
5
5
  "author": "bluefox <dogafox@gmail.com>",
6
6
  "contributors": [