(api?: NuclearPluginAPI)
| 159 | } |
| 160 | |
| 161 | async load(api?: NuclearPluginAPI): Promise<LoadedPlugin> { |
| 162 | Logger.plugins.debug(`Loading plugin from ${this.path}`); |
| 163 | const manifest = this.manifest ?? (await this.readManifest()); |
| 164 | const metadata = this.buildMetadata(manifest); |
| 165 | this.entryPath = await this.resolveEntryPath(manifest); |
| 166 | const code = await this.readPluginCode(this.entryPath); |
| 167 | const instance = this.evaluatePlugin(code); |
| 168 | if (instance.onLoad && api) { |
| 169 | Logger.plugins.debug(`Calling onLoad for ${metadata.id}`); |
| 170 | await instance.onLoad(api); |
| 171 | } |
| 172 | Logger.plugins.info( |
| 173 | `Plugin ${metadata.id}@${metadata.version} loaded successfully`, |
| 174 | ); |
| 175 | return { |
| 176 | metadata, |
| 177 | instance, |
| 178 | path: this.path, |
| 179 | }; |
| 180 | } |
| 181 | |
| 182 | getWarnings(): string[] { |
| 183 | return this.warnings; |
no test coverage detected