(absolutePath: string)
| 425 | } |
| 426 | |
| 427 | public loadPlugin(absolutePath: string): Plugin { |
| 428 | const packageJson: PackageJSON = PluginManager.loadPackageJSON(absolutePath) |
| 429 | |
| 430 | const identifier: PluginIdentifier = packageJson.name |
| 431 | const name: PluginName = PluginManager.extractPluginName(identifier) |
| 432 | const scope = PluginManager.extractPluginScope(identifier) // possibly undefined |
| 433 | |
| 434 | const alreadyInstalled = this.plugins.get(identifier) // check if there is already a plugin with the same Identifier |
| 435 | if (alreadyInstalled) { |
| 436 | throw new Error(`Warning: skipping plugin found at '${absolutePath}' since we already loaded the same plugin from '${alreadyInstalled.getPluginPath()}'.`) |
| 437 | } |
| 438 | |
| 439 | const plugin = new Plugin(name, absolutePath, packageJson, scope) |
| 440 | this.plugins.set(identifier, plugin) |
| 441 | return plugin |
| 442 | } |
| 443 | |
| 444 | private static loadPackageJSON(pluginPath: string): PackageJSON { |
| 445 | const packageJsonPath = join(pluginPath, 'package.json') |
no test coverage detected