@kanian77/choux 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/README.md +85 -53
  2. package/bun.lock +5 -3
  3. package/dist/core/ChouxModule.d.ts +1 -1
  4. package/dist/core/ChouxModule.d.ts.map +1 -1
  5. package/dist/core/ChouxModule.js +1 -1
  6. package/dist/core/ChouxModule.js.map +1 -1
  7. package/dist/core/HookRegistry.js +121 -59
  8. package/dist/core/HookRegistry.js.map +1 -1
  9. package/dist/core/HookRegistry.spec.js +28 -19
  10. package/dist/core/HookRegistry.spec.js.map +1 -1
  11. package/dist/core/Plugin.d.ts +1 -6
  12. package/dist/core/Plugin.d.ts.map +1 -1
  13. package/dist/core/Plugin.js +1 -2
  14. package/dist/core/Plugin.js.map +1 -1
  15. package/dist/core/PluginManager.d.ts +8 -4
  16. package/dist/core/PluginManager.d.ts.map +1 -1
  17. package/dist/core/PluginManager.js +168 -55
  18. package/dist/core/PluginManager.js.map +1 -1
  19. package/dist/core/PluginManager.spec.js +42 -31
  20. package/dist/core/PluginManager.spec.js.map +1 -1
  21. package/dist/decorators/enableHooksDecorator.d.ts.map +1 -1
  22. package/dist/decorators/enableHooksDecorator.js +4 -1
  23. package/dist/decorators/enableHooksDecorator.js.map +1 -1
  24. package/dist/decorators/hookDecorator.d.ts +5 -1
  25. package/dist/decorators/hookDecorator.d.ts.map +1 -1
  26. package/dist/decorators/hookDecorator.js +46 -9
  27. package/dist/decorators/hookDecorator.js.map +1 -1
  28. package/dist/decorators/hookDecorator.spec.js +107 -25
  29. package/dist/decorators/hookDecorator.spec.js.map +1 -1
  30. package/dist/lib/functions/index.d.ts +3 -2
  31. package/dist/lib/functions/index.d.ts.map +1 -1
  32. package/dist/lib/functions/index.js +3 -2
  33. package/dist/lib/functions/index.js.map +1 -1
  34. package/dist/lib/functions/registerHookHandler.d.ts.map +1 -1
  35. package/dist/lib/functions/registerHookHandler.js +1 -1
  36. package/dist/lib/functions/registerHookHandler.js.map +1 -1
  37. package/dist/lib/functions/registerHooksForInstance.d.ts.map +1 -1
  38. package/dist/lib/functions/registerHooksForInstance.js +2 -2
  39. package/dist/lib/functions/registerHooksForInstance.js.map +1 -1
  40. package/dist/lib/functions/registerInstanceHooks.d.ts.map +1 -1
  41. package/dist/lib/functions/registerInstanceHooks.js +19 -10
  42. package/dist/lib/functions/registerInstanceHooks.js.map +1 -1
  43. package/dist/lib/functions/registerStaticHooks.d.ts +2 -0
  44. package/dist/lib/functions/registerStaticHooks.d.ts.map +1 -0
  45. package/dist/lib/functions/registerStaticHooks.js +36 -0
  46. package/dist/lib/functions/registerStaticHooks.js.map +1 -0
  47. package/dist/lib/test-related/plugins/plugin-a/module.d.ts +5 -2
  48. package/dist/lib/test-related/plugins/plugin-a/module.d.ts.map +1 -1
  49. package/dist/lib/test-related/plugins/plugin-a/module.js +156 -77
  50. package/dist/lib/test-related/plugins/plugin-a/module.js.map +1 -1
  51. package/dist/lib/test-related/plugins/plugin-b/module.d.ts +5 -2
  52. package/dist/lib/test-related/plugins/plugin-b/module.d.ts.map +1 -1
  53. package/dist/lib/test-related/plugins/plugin-b/module.js +158 -77
  54. package/dist/lib/test-related/plugins/plugin-b/module.js.map +1 -1
  55. package/dist/lib/test-related/services.d.ts +17 -0
  56. package/dist/lib/test-related/services.d.ts.map +1 -0
  57. package/dist/lib/test-related/services.js +104 -0
  58. package/dist/lib/test-related/services.js.map +1 -0
  59. package/dist/lib/types/IHookMetadata.d.ts +6 -0
  60. package/dist/lib/types/IHookMetadata.d.ts.map +1 -0
  61. package/dist/lib/types/IHookMetadata.js +2 -0
  62. package/dist/lib/types/IHookMetadata.js.map +1 -0
  63. package/dist/lib/types/IHookRegistry.js +1 -0
  64. package/dist/lib/types/IPluginManager.d.ts +3 -1
  65. package/dist/lib/types/IPluginManager.d.ts.map +1 -1
  66. package/dist/lib/types/IPluginManager.js +1 -0
  67. package/dist/lib/types/LoadedPlugin.d.ts +2 -2
  68. package/dist/lib/types/LoadedPlugin.d.ts.map +1 -1
  69. package/dist/lib/types/LoadedPlugin.js +1 -0
  70. package/dist/lib/types/PluginMetadata.js +1 -0
  71. package/dist/lib/types/PluginModule.d.ts +10 -0
  72. package/dist/lib/types/PluginModule.d.ts.map +1 -0
  73. package/dist/lib/types/PluginModule.js +14 -0
  74. package/dist/lib/types/PluginModule.js.map +1 -0
  75. package/dist/lib/types/index.d.ts +1 -1
  76. package/dist/lib/types/index.d.ts.map +1 -1
  77. package/dist/lib/types/index.js +1 -1
  78. package/dist/lib/types/index.js.map +1 -1
  79. package/package.json +2 -2
  80. package/tsconfig.json +15 -9
  81. package/dist/core/PluginLoader.d.ts +0 -13
  82. package/dist/core/PluginLoader.d.ts.map +0 -1
  83. package/dist/core/PluginLoader.js +0 -147
  84. package/dist/core/PluginLoader.js.map +0 -1
  85. package/dist/core/PluginLoader.spec.d.ts +0 -2
  86. package/dist/core/PluginLoader.spec.d.ts.map +0 -1
  87. package/dist/core/PluginLoader.spec.js +0 -114
  88. package/dist/core/PluginLoader.spec.js.map +0 -1
  89. package/dist/example-plugin/module.d.ts +0 -20
  90. package/dist/example-plugin/module.d.ts.map +0 -1
  91. package/dist/example-plugin/module.js +0 -90
  92. package/dist/example-plugin/module.js.map +0 -1
  93. package/dist/example-plugin/services.d.ts +0 -9
  94. package/dist/example-plugin/services.d.ts.map +0 -1
  95. package/dist/example-plugin/services.js +0 -29
  96. package/dist/example-plugin/services.js.map +0 -1
  97. package/dist/example-plugin/tokens.d.ts +0 -2
  98. package/dist/example-plugin/tokens.d.ts.map +0 -1
  99. package/dist/example-plugin/tokens.js +0 -2
  100. package/dist/example-plugin/tokens.js.map +0 -1
  101. package/dist/lib/types/HookMetadata.d.ts +0 -5
  102. package/dist/lib/types/HookMetadata.d.ts.map +0 -1
  103. package/dist/lib/types/HookMetadata.js +0 -1
  104. package/dist/lib/types/HookMetadata.js.map +0 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Choux Plugin System
2
2
 
3
- Choux is a modular, type-safe plugin system for Node.js/TypeScript applications, built on top of the `@kanian77/simple-di` dependency injection framework. It enables dynamic plugin discovery, loading, lifecycle management, and custom hooks, making it easy to extend your application with isolated, reusable modules.
3
+ Choux is a modular, type-safe plugin system for Node.js/TypeScript applications, built on top of the `@kanian77/tject` dependency injection framework. It enables plugin lifecycle management and custom hooks, making it easy to extend your application with isolated, reusable modules.
4
4
 
5
5
  ## Core Concepts
6
6
 
@@ -11,18 +11,17 @@ A plugin is a class extending the abstract `Plugin` base class (`src/core/Plugin
11
11
  - `onLoad`: Called when the plugin is loaded, before dependencies are resolved.
12
12
  - `onInit`: Called after dependencies are resolved and injected.
13
13
  - `onDestroy`: Called when the plugin is being unloaded.
14
- - `registerCustomHooks`: Register custom hooks for other plugins to use.
15
14
 
16
- Plugins are typically defined in their own folder (e.g. `plugins/example-plugin/`) with a `module.ts` file exporting the plugin class as default.
15
+ Plugins are implemented as `PluginModule` classes, which extend the base `Module` class from `@kanian77/tject`.
17
16
 
18
- ### Plugin Discovery & Loading
17
+ ### Plugin Loading & Management
19
18
 
20
- - **PluginLoader (`src/core/PluginLoader.ts`)**: Scans a plugins directory for valid plugins (folders containing `module.ts`), loads them, resolves dependencies, and manages their lifecycle. Plugins are loaded dynamically using ES module imports.
21
- - **PluginManager (`src/core/PluginManager.ts`)**: High-level manager for initializing and shutting down all plugins, using the loader. It also exposes methods to get loaded plugins and their services.
19
+ - **PluginManager (`src/core/PluginManager.ts`)**: Manages the initialization, lifecycle, and shutdown of plugins. It provides methods to load individual plugins, get loaded plugin instances, and properly shutdown plugins.
20
+ - **ChouxModule (`src/core/ChouxModule.ts`)**: The main entry point module that provides the core services (PluginManager and HookRegistry). Must be imported and bootstrapped in your application.
22
21
 
23
22
  ### Dependency Injection
24
23
 
25
- All plugins and core services use the DI system from `@kanian77/simple-di`. Tokens (see `src/core/tokens.ts`) are used to register and inject services, including plugin services and the hook registry.
24
+ All plugins and core services use the DI system from `@kanian77/tject`. Tokens (see `src/core/tokens.ts`) are used to register and inject services, including plugin services and the hook registry.
26
25
 
27
26
  ### Hooks & Events
28
27
 
@@ -32,72 +31,112 @@ All plugins and core services use the DI system from `@kanian77/simple-di`. Toke
32
31
 
33
32
  ### Decorators & Utilities
34
33
 
35
- - **Hook Decorator (`src/decorators/hookDecorator.ts`)**: Provides a decorator and utility for registering hook handlers in plugin classes.
34
+ - **Hook Decorators**: Two decorators work together to enable hook functionality:
35
+ - `@EnableHooks`: Class-level decorator that must be applied to any class using hook decorators
36
+ - `@Hook(hookName)`: Method decorator for registering hook handlers in classes
36
37
  - **Function Utilities (`src/lib/functions/`)**: Helper functions for hook registration and plugin management.
37
- - **Types (`src/lib/types/`)**: Shared interfaces and type definitions for plugins, hook registry, plugin loader/manager, and metadata.
38
+ - **Types (`src/lib/types/`)**: Shared interfaces and type definitions for plugins, hook registry, plugin manager, and metadata.
38
39
 
39
- ## Example Plugin Structure
40
+ ## Usage
40
41
 
41
- See `plugins/example-plugin/` for a reference implementation:
42
+ ### Bootstrapping
42
43
 
43
- - `module.ts`: Exports the plugin class, registers services, and hooks.
44
- - `services.ts`: Defines plugin-specific services, which can be injected elsewhere.
45
- - `tokens.ts`: Declares DI tokens for plugin services.
44
+ To use Choux in your application:
46
45
 
47
- ## Usage
46
+ 1. Import and bootstrap the ChouxModule:
48
47
 
49
- ### Bootstrapping
48
+ ```typescript
49
+ import { bootstrap } from '@kanian77/tject';
50
+ import { ChouxModule } from '@choux/core';
51
+ import { YourPluginModule } from './plugins/your-plugin/module';
50
52
 
51
- See `src/main.ts` for application startup:
53
+ // Bootstrap the core module
54
+ bootstrap(ChouxModule);
52
55
 
53
- - Create a DI module importing the core module.
54
- - Bootstrap the DI system.
55
- - Get the plugin manager and initialize plugins from the plugins directory.
56
- - Access plugin services via DI tokens.
56
+ // Get plugin manager
57
+ const pluginManager = inject<PluginManager>(PLUGIN_MANAGER_TOKEN);
57
58
 
58
- ### Accessing Plugin Services
59
+ // Initialize your plugins
60
+ await pluginManager.initializePlugins([YourPluginModule]);
61
+ ```
59
62
 
60
- You can inject services provided by plugins using their tokens:
63
+ ### Creating a Plugin
64
+
65
+ Create a new plugin by extending the Plugin class and defining it as a PluginModule:
61
66
 
62
67
  ```typescript
63
- import { inject } from '@kanian77/simple-di';
64
- import { EXAMPLE_SERVICE_TOKEN } from '../plugins/example-plugin/tokens';
65
- import { IExampleService } from '../plugins/example-plugin/services';
68
+ import { Plugin, PluginModule, EnableHook, Hook } from '@kanian77/choux';
69
+ import { Service } from '@kanian77/tject';
70
+
71
+ export const YOUR_PLUGIN_TOKEN = 'YOUR_PLUGIN_TOKEN';
72
+ @Service({ token: YOUR_PLUGIN_TOKEN })
73
+ @EnableHooks
74
+ class YourPlugin extends Plugin {
75
+ readonly metadata = {
76
+ name: 'your-plugin',
77
+ version: '1.0.0',
78
+ description: 'Your plugin description',
79
+ };
80
+
81
+ async onInit() {
82
+ // Initialize your plugin
83
+ }
66
84
 
67
- const exampleService = inject<IExampleService>(EXAMPLE_SERVICE_TOKEN);
68
- exampleService.doSomething();
85
+ // Example of using hooks
86
+ @Hook('some:event')
87
+ onSomeEvent(data: any) {
88
+ // Handle the event
89
+ }
90
+ }
91
+
92
+ // Enable hook processing for the class
93
+ export const YourPluginModule = new PluginModule({
94
+ token: YOUR_PLUGIN_TOKEN,
95
+ providers: [
96
+ {
97
+ provide: YOUR_PLUGIN_TOKEN,
98
+ useClass: YourPlugin,
99
+ },
100
+ // Add your plugin's services here
101
+ ],
102
+ });
69
103
  ```
70
104
 
71
- ## Extending Choux
105
+ ### Accessing Plugin Services
72
106
 
73
- - Add new plugins by creating a folder with a `module.ts` exporting a class extending `Plugin`.
74
- - Register services and hooks in your plugin.
75
- - Use the hook registry to communicate between plugins.
76
- - Use DI tokens for type-safe service access.
107
+ You can inject services provided by plugins using their tokens:
108
+
109
+ ```typescript
110
+ import { inject } from '@kanian77/tject';
111
+ import { YOUR_SERVICE_TOKEN } from './tokens';
112
+ import { IYourService } from './services';
113
+
114
+ const yourService = inject<IYourService>(YOUR_SERVICE_TOKEN);
115
+ yourService.doSomething();
116
+ ```
77
117
 
78
118
  ## Directory Overview
79
119
 
80
- - `src/core/`: Core plugin system (Plugin, PluginLoader, PluginManager, HookRegistry, tokens)
120
+ - `src/core/`: Core plugin system (Plugin, PluginManager, HookRegistry, tokens, ChouxModule)
81
121
  - `src/decorators/`: Hook decorator and registration utilities
82
122
  - `src/lib/functions/`: Helper functions for hooks and plugins
83
123
  - `src/lib/types/`: Shared type definitions
84
- - `plugins/`: Example and user plugins
85
124
 
86
125
  ## License
87
126
 
88
127
  MIT
128
+
89
129
  ## What's Already Great ✅
90
130
 
91
- - **Core Architecture**: Plugin extends Module, proper DI integration
131
+ - **Core Architecture**: Deep integration with `@kanian77/tject` for robust DI
92
132
  - **Lifecycle Management**: Load, init, destroy with proper ordering
93
133
  - **Hook System**: Both decorators and manual registration
94
- - **Dependency Resolution**: Plugin-level and module-level dependencies
95
- - **Type Safety**: Full TypeScript support with tokens
96
- - **Documentation**: Clear structure and examples
134
+ - **Simplicity**: Direct plugin loading without file system complexity
97
135
 
98
136
  ## Areas for Enhancement 🔧
99
137
 
100
138
  ### 1. **Plugin Configuration System**
139
+
101
140
  ```typescript
102
141
  // src/core/pluginConfig.ts
103
142
  export interface PluginConfig {
@@ -107,11 +146,12 @@ export interface PluginConfig {
107
146
  };
108
147
  }
109
148
 
110
- // In PluginLoader
111
- async loadPlugins(pluginsDir: string, config?: PluginConfig): Promise<LoadedPlugin[]>
149
+ // In PluginManager
150
+ async initializePlugins(plugins: PluginModule[], config?: PluginConfig): Promise<void>
112
151
  ```
113
152
 
114
153
  ### 2. **Plugin Validation & Health Checks**
154
+
115
155
  ```typescript
116
156
  // Add to Plugin base class
117
157
  async healthCheck?(): Promise<{ healthy: boolean; message?: string }>;
@@ -126,23 +166,15 @@ export function validatePluginMetadata(metadata: PluginMetadata): string[] {
126
166
  ```
127
167
 
128
168
  ### 3. **Error Handling & Recovery**
169
+
129
170
  ```typescript
130
- // Enhanced error handling in PluginLoader
171
+ // Enhanced error handling in PluginManager
131
172
  interface PluginLoadError {
132
- pluginPath: string;
173
+ pluginName: string;
133
174
  error: Error;
134
- phase: 'discovery' | 'load' | 'init';
175
+ phase: 'load' | 'init';
135
176
  }
136
177
 
137
178
  // Add retry mechanisms for failed plugins
138
179
  async retryFailedPlugin(pluginName: string): Promise<void>
139
180
  ```
140
-
141
- ### 4. **Plugin Hot Reloading** (Development)
142
- ```typescript
143
- // src/core/pluginWatcher.ts
144
- export class PluginWatcher {
145
- async watchForChanges(pluginsDir: string): Promise<void>;
146
- async reloadPlugin(pluginName: string): Promise<void>;
147
- }
148
- ```
package/bun.lock CHANGED
@@ -4,10 +4,12 @@
4
4
  "": {
5
5
  "name": "@kanian77/choux",
6
6
  "dependencies": {
7
- "@kanian77/simple-di": "^0.1.2",
7
+ "@kanian77/tject": "^1.2.1",
8
+ "reflect-metadata": "^0.2.2",
8
9
  },
9
10
  "devDependencies": {
10
11
  "@types/bun": "latest",
12
+ "typescript": "~5.7.2",
11
13
  },
12
14
  "peerDependencies": {
13
15
  "typescript": "^5",
@@ -15,7 +17,7 @@
15
17
  },
16
18
  },
17
19
  "packages": {
18
- "@kanian77/simple-di": ["@kanian77/simple-di@0.1.2", "", { "dependencies": { "@types/bun": "^1.2.4", "reflect-metadata": "^0.2.2" } }, "sha512-sTf0ul3ckEncXugV5eB7sdwLuP8F2ScryXqKtOheQ7WwKVK4xs5/oAj2xihDHXKkjgfVvcnnqWhXGCky67PVsg=="],
20
+ "@kanian77/tject": ["@kanian77/tject@1.2.1", "", { "dependencies": { "@types/bun": "^1.2.4" } }, "sha512-fczkkGYTclUK95opNKTLdOJgmLDp/zavlmfz3lP5IN94OrCg1Nlt7xcz9oNiNEmq4q+pMfcv3/9XEaUzb2bdTw=="],
19
21
 
20
22
  "@types/bun": ["@types/bun@1.2.19", "", { "dependencies": { "bun-types": "1.2.19" } }, "sha512-d9ZCmrH3CJ2uYKXQIUuZ/pUnTqIvLDS0SK7pFmbx8ma+ziH/FRMoAq5bYpRG7y+w1gl+HgyNZbtqgMq4W4e2Lg=="],
21
23
 
@@ -29,7 +31,7 @@
29
31
 
30
32
  "reflect-metadata": ["reflect-metadata@0.2.2", "", {}, "sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q=="],
31
33
 
32
- "typescript": ["typescript@5.8.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ=="],
34
+ "typescript": ["typescript@5.7.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw=="],
33
35
 
34
36
  "undici-types": ["undici-types@7.8.0", "", {}, "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw=="],
35
37
  }
@@ -1,3 +1,3 @@
1
- import { Module } from '@kanian77/simple-di';
1
+ import { Module } from '@kanian77/tject';
2
2
  export declare const ChouxModule: Module;
3
3
  //# sourceMappingURL=ChouxModule.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChouxModule.d.ts","sourceRoot":"","sources":["../../src/core/ChouxModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAK7C,eAAO,MAAM,WAAW,QAWtB,CAAC"}
1
+ {"version":3,"file":"ChouxModule.d.ts","sourceRoot":"","sources":["../../src/core/ChouxModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAKzC,eAAO,MAAM,WAAW,QAWtB,CAAC"}
@@ -1,4 +1,4 @@
1
- import { Module } from '@kanian77/simple-di';
1
+ import { Module } from '@kanian77/tject';
2
2
  import { HookRegistry } from './HookRegistry';
3
3
  import { PluginManager } from './PluginManager';
4
4
  import { HOOK_REGISTRY_TOKEN, PLUGIN_MANAGER_TOKEN } from '../lib/types/tokens';
@@ -1 +1 @@
1
- {"version":3,"file":"ChouxModule.js","sourceRoot":"","sources":["../../src/core/ChouxModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEhF,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,MAAM,CAAC;IACpC,SAAS,EAAE;QACT;YACE,OAAO,EAAE,mBAAmB;YAC5B,QAAQ,EAAE,YAAY;SACvB;QACD;YACE,OAAO,EAAE,oBAAoB;YAC7B,QAAQ,EAAE,aAAa;SACxB;KACF;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"ChouxModule.js","sourceRoot":"","sources":["../../src/core/ChouxModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEhF,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,MAAM,CAAC;IACpC,SAAS,EAAE;QACT;YACE,OAAO,EAAE,mBAAmB;YAC5B,QAAQ,EAAE,YAAY;SACvB;QACD;YACE,OAAO,EAAE,oBAAoB;YAC7B,QAAQ,EAAE,aAAa;SACxB;KACF;CACF,CAAC,CAAC"}
@@ -1,69 +1,131 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
2
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
3
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
4
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
5
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
6
+ var _, done = false;
7
+ for (var i = decorators.length - 1; i >= 0; i--) {
8
+ var context = {};
9
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
10
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
11
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
12
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
13
+ if (kind === "accessor") {
14
+ if (result === void 0) continue;
15
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
16
+ if (_ = accept(result.get)) descriptor.get = _;
17
+ if (_ = accept(result.set)) descriptor.set = _;
18
+ if (_ = accept(result.init)) initializers.unshift(_);
19
+ }
20
+ else if (_ = accept(result)) {
21
+ if (kind === "field") initializers.unshift(_);
22
+ else descriptor[key] = _;
23
+ }
24
+ }
25
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
26
+ done = true;
27
+ };
28
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
29
+ var useValue = arguments.length > 2;
30
+ for (var i = 0; i < initializers.length; i++) {
31
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
32
+ }
33
+ return useValue ? value : void 0;
6
34
  };
7
- import { Service } from '@kanian77/simple-di';
35
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
+ return new (P || (P = Promise))(function (resolve, reject) {
38
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
42
+ });
43
+ };
44
+ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
45
+ if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
46
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
47
+ };
48
+ import { Service } from '@kanian77/tject';
8
49
  import { HOOK_REGISTRY_TOKEN } from '../lib/types/tokens';
9
50
  /**
10
51
  * Registry for application hooks.
11
52
  */
12
- let HookRegistry = class HookRegistry {
13
- hooks = new Map();
14
- /**
15
- * Register a hook handler.
16
- * @param name The name of the hook to register the function for.
17
- * @param fn The hook handler function.
18
- */
19
- register(name, fn) {
20
- const list = this.hooks.get(name) || [];
21
- this.hooks.set(name, [...list, fn]);
22
- }
23
- /**
24
- * Trigger a hook, calling all registered handlers.
25
- * @param name The name of the hook to trigger.
26
- * @param args Arguments to pass to the hook handlers.
27
- */
28
- async trigger(name, ...args) {
29
- const fns = this.hooks.get(name) || [];
30
- for (const fn of fns) {
31
- await fn(...args);
53
+ let HookRegistry = (() => {
54
+ let _classDecorators = [Service({ token: HOOK_REGISTRY_TOKEN })];
55
+ let _classDescriptor;
56
+ let _classExtraInitializers = [];
57
+ let _classThis;
58
+ var HookRegistry = _classThis = class {
59
+ constructor() {
60
+ Object.defineProperty(this, "hooks", {
61
+ enumerable: true,
62
+ configurable: true,
63
+ writable: true,
64
+ value: new Map()
65
+ });
32
66
  }
33
- }
34
- /**
35
- * Unregister a hook handler.
36
- * If no function is provided, all handlers for the hook will be removed.
37
- * @param name The name of the hook to unregister from.
38
- * @param fn Optional specific handler to remove.
39
- */
40
- unregister(name, fn) {
41
- if (!fn) {
42
- this.hooks.delete(name);
43
- return;
67
+ /**
68
+ * Register a hook handler.
69
+ * @param name The name of the hook to register the function for.
70
+ * @param fn The hook handler function.
71
+ */
72
+ register(name, fn) {
73
+ const list = this.hooks.get(name) || [];
74
+ this.hooks.set(name, [...list, fn]);
44
75
  }
45
- const list = this.hooks.get(name) || [];
46
- const filtered = list.filter((registeredFn) => registeredFn !== fn);
47
- this.hooks.set(name, filtered);
48
- }
49
- /**
50
- * Get all registered handlers for a specific hook.
51
- * @param name The name of the hook to retrieve handlers for.
52
- * @returns An array of hook handler functions.
53
- */
54
- getHooks(name) {
55
- return this.hooks.get(name) || [];
56
- }
57
- /**
58
- * Clear all registered hooks.
59
- */
60
- clear() {
61
- this.hooks.clear();
62
- }
63
- };
64
- HookRegistry = __decorate([
65
- Service({ token: HOOK_REGISTRY_TOKEN })
66
- ], HookRegistry);
76
+ /**
77
+ * Trigger a hook, calling all registered handlers.
78
+ * @param name The name of the hook to trigger.
79
+ * @param args Arguments to pass to the hook handlers.
80
+ */
81
+ trigger(name, ...args) {
82
+ return __awaiter(this, void 0, void 0, function* () {
83
+ const fns = this.hooks.get(name) || [];
84
+ for (const fn of fns) {
85
+ yield fn(...args);
86
+ }
87
+ });
88
+ }
89
+ /**
90
+ * Unregister a hook handler.
91
+ * If no function is provided, all handlers for the hook will be removed.
92
+ * @param name The name of the hook to unregister from.
93
+ * @param fn Optional specific handler to remove.
94
+ */
95
+ unregister(name, fn) {
96
+ if (!fn) {
97
+ this.hooks.delete(name);
98
+ return;
99
+ }
100
+ const list = this.hooks.get(name) || [];
101
+ const filtered = list.filter((registeredFn) => registeredFn !== fn);
102
+ this.hooks.set(name, filtered);
103
+ }
104
+ /**
105
+ * Get all registered handlers for a specific hook.
106
+ * @param name The name of the hook to retrieve handlers for.
107
+ * @returns An array of hook handler functions.
108
+ */
109
+ getHooks(name) {
110
+ return this.hooks.get(name) || [];
111
+ }
112
+ /**
113
+ * Clear all registered hooks.
114
+ */
115
+ clear() {
116
+ this.hooks.clear();
117
+ }
118
+ };
119
+ __setFunctionName(_classThis, "HookRegistry");
120
+ (() => {
121
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
122
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
123
+ HookRegistry = _classThis = _classDescriptor.value;
124
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
125
+ __runInitializers(_classThis, _classExtraInitializers);
126
+ })();
127
+ return HookRegistry = _classThis;
128
+ })();
67
129
  export { HookRegistry };
68
130
  // Standard lifecycle hooks
69
131
  export const LIFECYCLE_HOOKS = {
@@ -1 +1 @@
1
- {"version":3,"file":"HookRegistry.js","sourceRoot":"","sources":["../../src/core/HookRegistry.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAG1D;;GAEG;AAEI,IAAM,YAAY,GAAlB,MAAM,YAAY;IACf,KAAK,GAAY,IAAI,GAAG,EAAE,CAAC;IAE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AC,GAAG,IAAI,CAAC,CAAC;gBACpB,CAAC;YACH,CAAC;SAAA;QAED;;;;;WAKG;QACH,UAAU,CAAC,IAAY,EAAE,EAAW;YAClC,IAAI,CAAC,EAAE,EAAE,CAAC;gBACR,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;gBACxB,OAAO;YACT,CAAC;YAED,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YACxC,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,KAAK,EAAE,CAAC,CAAC;YACpE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACjC,CAAC;QAED;;;;WAIG;QACH,QAAQ,CAAC,IAAY;YACnB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QACpC,CAAC;QAED;;WAEG;QACH,KAAK;YACH,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACrB,CAAC;;;;;QAxDH,6KAyDC;;;QAzDY,uDAAY;;;;SAAZ,YAAY;AA2DzB,2BAA2B;AAC3B,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,kBAAkB,EAAE,yBAAyB;IAC7C,iBAAiB,EAAE,wBAAwB;IAC3C,kBAAkB,EAAE,yBAAyB;IAC7C,iBAAiB,EAAE,wBAAwB;IAC3C,qBAAqB,EAAE,4BAA4B;IACnD,oBAAoB,EAAE,2BAA2B;IACjD,iBAAiB,EAAE,wBAAwB;IAC3C,oBAAoB,EAAE,2BAA2B;CACzC,CAAC"}
@@ -1,3 +1,12 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
1
10
  import { describe, it, expect, beforeEach } from 'bun:test';
2
11
  import { HookRegistry } from './HookRegistry';
3
12
  describe('HookRegistry', () => {
@@ -5,16 +14,16 @@ describe('HookRegistry', () => {
5
14
  beforeEach(() => {
6
15
  registry = new HookRegistry();
7
16
  });
8
- it('registers and triggers a hook', async () => {
17
+ it('registers and triggers a hook', () => __awaiter(void 0, void 0, void 0, function* () {
9
18
  let called = false;
10
19
  const fn = () => {
11
20
  called = true;
12
21
  };
13
22
  registry.register('test:hook', fn);
14
- await registry.trigger('test:hook');
23
+ yield registry.trigger('test:hook');
15
24
  expect(called).toBe(true);
16
- });
17
- it('registers and triggers a hook with payload', async () => {
25
+ }));
26
+ it('registers and triggers a hook with payload', () => __awaiter(void 0, void 0, void 0, function* () {
18
27
  let called = false;
19
28
  const payload = { test: 'data' };
20
29
  const fn = (payload) => {
@@ -22,29 +31,29 @@ describe('HookRegistry', () => {
22
31
  expect(payload).toEqual({ test: 'data' });
23
32
  };
24
33
  registry.register('test:hook', fn);
25
- await registry.trigger('test:hook', payload);
34
+ yield registry.trigger('test:hook', payload);
26
35
  expect(called).toBe(true);
27
- });
28
- it('unregisters a specific hook handler', async () => {
36
+ }));
37
+ it('unregisters a specific hook handler', () => __awaiter(void 0, void 0, void 0, function* () {
29
38
  let called = false;
30
39
  const fn = () => {
31
40
  called = true;
32
41
  };
33
42
  registry.register('test:hook', fn);
34
43
  registry.unregister('test:hook', fn);
35
- await registry.trigger('test:hook');
44
+ yield registry.trigger('test:hook');
36
45
  expect(called).toBe(false);
37
- });
38
- it('unregisters all handlers for a hook', async () => {
46
+ }));
47
+ it('unregisters all handlers for a hook', () => __awaiter(void 0, void 0, void 0, function* () {
39
48
  let called = false;
40
49
  const fn = () => {
41
50
  called = true;
42
51
  };
43
52
  registry.register('test:hook', fn);
44
53
  registry.unregister('test:hook');
45
- await registry.trigger('test:hook');
54
+ yield registry.trigger('test:hook');
46
55
  expect(called).toBe(false);
47
- });
56
+ }));
48
57
  it('getHooks returns all registered handlers', () => {
49
58
  const fn1 = () => { };
50
59
  const fn2 = () => { };
@@ -61,18 +70,18 @@ describe('HookRegistry', () => {
61
70
  registry.clear();
62
71
  expect(registry.getHooks('test:hook').length).toBe(0);
63
72
  });
64
- it('trigger calls all registered async handlers', async () => {
73
+ it('trigger calls all registered async handlers', () => __awaiter(void 0, void 0, void 0, function* () {
65
74
  let result = '';
66
- const fn1 = async () => {
75
+ const fn1 = () => __awaiter(void 0, void 0, void 0, function* () {
67
76
  result += 'a';
68
- };
69
- const fn2 = async () => {
77
+ });
78
+ const fn2 = () => __awaiter(void 0, void 0, void 0, function* () {
70
79
  result += 'b';
71
- };
80
+ });
72
81
  registry.register('test:hook', fn1);
73
82
  registry.register('test:hook', fn2);
74
- await registry.trigger('test:hook');
83
+ yield registry.trigger('test:hook');
75
84
  expect(result).toBe('ab');
76
- });
85
+ }));
77
86
  });
78
87
  //# sourceMappingURL=HookRegistry.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"HookRegistry.spec.js","sourceRoot":"","sources":["../../src/core/HookRegistry.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,IAAI,QAAsB,CAAC;IAE3B,UAAU,CAAC,GAAG,EAAE;QACd,QAAQ,GAAG,IAAI,YAAY,EAAE,CAAC;IAChC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+BAA+B,E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AC5B,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QACnC,QAAQ,CAAC,KAAK,EAAE,CAAC;QACjB,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6CAA6C,EAAE,GAAS,EAAE;QAC3D,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,MAAM,GAAG,GAAW,GAAS,EAAE;YAC7B,MAAM,IAAI,GAAG,CAAC;QAChB,CAAC,CAAA,CAAC;QACF,MAAM,GAAG,GAAW,GAAS,EAAE;YAC7B,MAAM,IAAI,GAAG,CAAC;QAChB,CAAC,CAAA,CAAC;QACF,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;QACpC,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;QACpC,MAAM,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QACpC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,6 +1,5 @@
1
- import { Module } from '@kanian77/simple-di';
2
1
  import type { PluginMetadata } from '../lib/types';
3
- export declare abstract class Plugin extends Module {
2
+ export declare abstract class Plugin {
4
3
  abstract readonly metadata: PluginMetadata;
5
4
  /**
6
5
  * Called when plugin is loaded but before dependencies are resolved
@@ -14,9 +13,5 @@ export declare abstract class Plugin extends Module {
14
13
  * Called when plugin is being unloaded
15
14
  */
16
15
  onDestroy?(): Promise<void>;
17
- /**
18
- * Register custom hooks specific to this plugin
19
- */
20
- protected registerCustomHooks?(): void;
21
16
  }
22
17
  //# sourceMappingURL=Plugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/core/Plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,8BAAsB,MAAO,SAAQ,MAAM;IACzC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAE3C;;OAEG;IACG,MAAM,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC;IAE9B;;OAEG;IACG,MAAM,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC;IAE9B;;OAEG;IACG,SAAS,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC;IAEjC;;OAEG;IACH,SAAS,CAAC,mBAAmB,CAAC,IAAI,IAAI;CACvC"}
1
+ {"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/core/Plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,8BAAsB,MAAM;IAC1B,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAE3C;;OAEG;IACG,MAAM,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC;IAE9B;;OAEG;IACG,MAAM,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC;IAE9B;;OAEG;IACG,SAAS,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC;CAClC"}
@@ -1,4 +1,3 @@
1
- import { Module } from '@kanian77/simple-di';
2
- export class Plugin extends Module {
1
+ export class Plugin {
3
2
  }
4
3
  //# sourceMappingURL=Plugin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Plugin.js","sourceRoot":"","sources":["../../src/core/Plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAG7C,MAAM,OAAgB,MAAO,SAAQ,MAAM;CAsB1C"}
1
+ {"version":3,"file":"Plugin.js","sourceRoot":"","sources":["../../src/core/Plugin.ts"],"names":[],"mappings":"AAGA,MAAM,OAAgB,MAAM;CAiB3B"}