hubot 5.0.7 → 7.0.0
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/es2015.js +2 -3
- package/package.json +1 -1
- package/src/robot.js +10 -1
package/es2015.js
CHANGED
|
@@ -25,8 +25,7 @@ module.exports = {
|
|
|
25
25
|
CatchAllMessage: Message.CatchAllMessage,
|
|
26
26
|
DataStore: DataStore.DataStore,
|
|
27
27
|
DataStoreUnavailable: DataStore.DataStoreUnavailable,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return new module.exports.Robot(adapterPath, adapterName, enableHttpd, botName, botAlias)
|
|
28
|
+
loadBot (adapter, enableHttpd, name, alias) {
|
|
29
|
+
return new module.exports.Robot(adapter, enableHttpd, name, alias)
|
|
31
30
|
}
|
|
32
31
|
}
|
package/package.json
CHANGED
package/src/robot.js
CHANGED
|
@@ -504,7 +504,16 @@ class Robot {
|
|
|
504
504
|
} else if (['.mjs'].includes(ext)) {
|
|
505
505
|
this.adapter = await this.importAdapterFrom(pathToFileURL(path.resolve(adapterPath)).href)
|
|
506
506
|
} else {
|
|
507
|
-
|
|
507
|
+
const adapterPathInCurrentWorkingDirectory = this.adapterName
|
|
508
|
+
try {
|
|
509
|
+
this.adapter = this.requireAdapterFrom(adapterPathInCurrentWorkingDirectory)
|
|
510
|
+
} catch (err) {
|
|
511
|
+
if (err.name === 'SyntaxError' && err.message.includes('Cannot use import statement outside a module')) {
|
|
512
|
+
this.adapter = await this.importAdapterFrom(adapterPathInCurrentWorkingDirectory)
|
|
513
|
+
} else {
|
|
514
|
+
throw err
|
|
515
|
+
}
|
|
516
|
+
}
|
|
508
517
|
}
|
|
509
518
|
} catch (err) {
|
|
510
519
|
this.logger.error(`Cannot load adapter ${adapterPath ?? '[no path set]'} ${this.adapterName} - ${err}`)
|