Skip to content

Commit fd06e52

Browse files
committed
feat: add code
1 parent 38b20c2 commit fd06e52

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

packages/runtime/core/src/garfish.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ export class Garfish implements interfaces.Garfish {
3737
public cacheApps: Record<string, interfaces.App> = {};
3838
public appInfos: Record<string, interfaces.AppInfo> = {};
3939

40-
private plugins = new WeakSet();
4140
private allApps: WeakSet<interfaces.App> = new WeakSet();
4241
private loading: Record<string, Promise<any> | null> = {};
4342

@@ -116,9 +115,9 @@ export class Garfish implements interfaces.Garfish {
116115
return this;
117116
}
118117
(plugin as any)._registered = true;
119-
const res = plugin.apply(this, [this, ...args]);
120-
this.plugins.add(res);
121-
return this.hooks.usePlugin(res);
118+
const allHooks = plugin.apply(this, [this, ...args]);
119+
// Distinguish between xx and xxx, in order to be compatible with the old api
120+
return this.hooks.usePlugin(allHooks);
122121
}
123122

124123
run(options?: interfaces.Options) {

packages/runtime/core/src/hooks/hooksSystem.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class HooksSystem<T extends Record<string, SyncHook | AsyncHook>> {
99
type: string;
1010
lifecycle: T;
1111
lifecycleKeys: Array<keyof T>;
12-
registerPlugins = new WeakSet<Plugin<T>>();
12+
private registerPlugins = new WeakSet<Plugin<T>>();
1313

1414
constructor(type: string, lifecycle: T) {
1515
this.type = type;

packages/runtime/core/src/plugins/lifecycle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { lifecycle } from '../config';
22
import { interfaces } from '../interface';
33

44
export function GarfishOptionsLife(options) {
5-
return function (_Garfish: interfaces.Garfish): interfaces.Plugin {
5+
return function (): interfaces.Plugin {
66
const plugin = {
77
name: 'default-life',
88
version: __VERSION__,

0 commit comments

Comments
 (0)