|
1 | 1 | 'use babel'; |
2 | 2 |
|
3 | | -import path from 'path'; |
4 | | -import { CompositeDisposable } from 'atom'; |
5 | | -import opn from 'opn'; |
6 | | -import Canduit from 'canduit'; |
7 | | - |
8 | 3 | const CONFIG_DEFAULT_HOST = 'https://phabricator.example.com/api/'; |
9 | 4 | const CONFIG_DEFAULT_TOKEN = 'api-XYZ'; |
10 | 5 |
|
@@ -41,7 +36,7 @@ export default { |
41 | 36 | }, |
42 | 37 |
|
43 | 38 | activate(state) { |
44 | | - this.subscriptions = new CompositeDisposable(); |
| 39 | + this.subscriptions = new (require('atom').CompositeDisposable)(); |
45 | 40 |
|
46 | 41 | this.subscriptions.add( |
47 | 42 | atom.config.onDidChange('open-in-diffusion.conduit-host', () => { |
@@ -95,6 +90,7 @@ export default { |
95 | 90 |
|
96 | 91 | conduitFactory() { |
97 | 92 | return new Promise((resolve, reject) => { |
| 93 | + const Canduit = require('canduit'); |
98 | 94 | new Canduit(this.conduitConfig(), (err, canduit) => { |
99 | 95 | if (err) { |
100 | 96 | reject(err); |
@@ -138,7 +134,7 @@ export default { |
138 | 134 | }, |
139 | 135 |
|
140 | 136 | genFindPhabProject(projectPath) { |
141 | | - const searchTerm = path.basename(projectPath); |
| 137 | + const searchTerm = require('path').basename(projectPath); |
142 | 138 |
|
143 | 139 | if (this.foundProjects[projectPath]) { |
144 | 140 | return Promise.resolve(this.foundProjects[projectPath]); |
@@ -202,7 +198,7 @@ export default { |
202 | 198 | ? project.fields.callsign |
203 | 199 | : project.id; |
204 | 200 |
|
205 | | - opn(`https://phabricator.pinadmin.com/diffusion/${id}/browse/master${relativeFilePath}${range}`); |
| 201 | + require('opn')(`https://phabricator.pinadmin.com/diffusion/${id}/browse/master${relativeFilePath}${range}`); |
206 | 202 | }) |
207 | 203 | .catch((message) => { |
208 | 204 | console.warn(`Unable to open ${nuclideFilePath}. ${message}`); |
|
0 commit comments