This commit is contained in:
jack zhang 2023-10-11 11:17:20 +08:00 committed by GitHub
parent 3793bb6cb7
commit af32a4e59a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -73,11 +73,11 @@ export class PluginManager {
get<T extends typeof Plugin>(PluginClass: T): InstanceType<T>;
get<T extends {}>(name: string): T;
get(name: any) {
if (typeof name === 'string') {
return this.pluginsAliases[name];
get(nameOrPluginClass: any) {
if (typeof nameOrPluginClass === 'string') {
return this.pluginsAliases[nameOrPluginClass];
}
return this.pluginInstances.get(name);
return this.pluginInstances.get(nameOrPluginClass.default || nameOrPluginClass);
}
private getInstance<T>(plugin: typeof Plugin, opts?: T) {

View File

@ -15,7 +15,7 @@ export function definePluginClient(packageName: string) {
value: true,
});
Object.keys(_plugin).forEach(function (key) {
if (key === 'default' || key === '__esModule') return;
if (key === '__esModule') return;
if (key in _exports && _exports[key] === _plugin[key]) return;
Object.defineProperty(_exports, key, {
enumerable: true,