fix(client): plugin aliases

This commit is contained in:
chenos 2024-03-18 15:55:10 +08:00
parent a81fa5b8e0
commit 220eafbda5

View File

@ -2,7 +2,7 @@ import type { Application } from './Application';
import type { Plugin } from './Plugin';
import { getPlugins } from './utils/remotePlugins';
export type PluginOptions<T = any> = { name?: string; config?: T };
export type PluginOptions<T = any> = { name?: string; packageName?: string; config?: T };
export type PluginType<Opts = any> = typeof Plugin | [typeof Plugin, PluginOptions<Opts>];
export type PluginData = {
name: string;
@ -63,6 +63,11 @@ export class PluginManager {
if (opts.name) {
this.pluginsAliases[opts.name] = instance;
}
if (opts.packageName) {
this.pluginsAliases[opts.packageName] = instance;
}
await instance.afterAdd();
}