hubot 5.0.3 → 5.0.5
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/package.json +1 -1
- package/src/robot.js +3 -13
package/package.json
CHANGED
package/src/robot.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
const EventEmitter = require('events').EventEmitter
|
|
3
3
|
const fs = require('fs')
|
|
4
4
|
const path = require('path')
|
|
5
|
+
const pathToFileURL = require('url').pathToFileURL
|
|
5
6
|
|
|
6
7
|
const async = require('async')
|
|
7
8
|
const pino = require('pino')
|
|
@@ -388,17 +389,6 @@ class Robot {
|
|
|
388
389
|
}
|
|
389
390
|
}
|
|
390
391
|
|
|
391
|
-
// Public: Load scripts specified in the `hubot-scripts.json` file.
|
|
392
|
-
//
|
|
393
|
-
// path - A String path to the hubot-scripts files.
|
|
394
|
-
// scripts - An Array of scripts to load.
|
|
395
|
-
//
|
|
396
|
-
// Returns nothing.
|
|
397
|
-
loadHubotScripts (path, scripts) {
|
|
398
|
-
this.logger.debug(`Loading hubot-scripts from ${path}`)
|
|
399
|
-
Array.from(scripts).map(script => this.loadFile(path, script))
|
|
400
|
-
}
|
|
401
|
-
|
|
402
392
|
// Public: Load scripts from packages specified in the
|
|
403
393
|
// `external-scripts.json` file.
|
|
404
394
|
//
|
|
@@ -510,9 +500,9 @@ class Robot {
|
|
|
510
500
|
if (Array.from(HUBOT_DEFAULT_ADAPTERS).indexOf(this.adapterName) > -1) {
|
|
511
501
|
this.adapter = this.requireAdapterFrom(path.resolve(path.join(__dirname, 'adapters', this.adapterName)))
|
|
512
502
|
} else if (['.js', '.cjs', '.coffee'].includes(ext)) {
|
|
513
|
-
this.adapter = this.requireAdapterFrom(path.resolve(adapterPath))
|
|
503
|
+
this.adapter = this.requireAdapterFrom(pathToFileURL(path.resolve(adapterPath)).pathname)
|
|
514
504
|
} else if (['.mjs'].includes(ext)) {
|
|
515
|
-
this.adapter = await this.importAdapterFrom(path.resolve(adapterPath))
|
|
505
|
+
this.adapter = await this.importAdapterFrom(pathToFileURL(path.resolve(adapterPath)).href)
|
|
516
506
|
} else {
|
|
517
507
|
this.adapter = this.requireAdapterFrom(`hubot-${this.adapterName}`)
|
|
518
508
|
}
|