bun_plugins 1.2.6 → 1.2.7

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 (178) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +127 -3
  3. package/dist/examples/action-registry-declarative.d.ts +14 -0
  4. package/dist/examples/action-registry-declarative.d.ts.map +1 -0
  5. package/dist/examples/action-registry-declarative.js +130 -0
  6. package/dist/examples/action-registry-declarative.js.map +1 -0
  7. package/dist/examples/action-registry-example.d.ts +31 -0
  8. package/dist/examples/action-registry-example.d.ts.map +1 -0
  9. package/dist/examples/action-registry-example.js +84 -0
  10. package/dist/examples/action-registry-example.js.map +1 -0
  11. package/dist/examples/index-declarative.d.ts +32 -0
  12. package/dist/examples/index-declarative.d.ts.map +1 -0
  13. package/dist/examples/index-declarative.js +206 -0
  14. package/dist/examples/index-declarative.js.map +1 -0
  15. package/dist/examples/logger-declarative.d.ts +109 -0
  16. package/dist/examples/logger-declarative.d.ts.map +1 -0
  17. package/dist/examples/logger-declarative.js +330 -0
  18. package/dist/examples/logger-declarative.js.map +1 -0
  19. package/dist/examples/logger-simple.d.ts +8 -0
  20. package/dist/examples/logger-simple.d.ts.map +1 -0
  21. package/dist/examples/logger-simple.js +165 -0
  22. package/dist/examples/logger-simple.js.map +1 -0
  23. package/dist/examples/server-declarative.d.ts +46 -0
  24. package/dist/examples/server-declarative.d.ts.map +1 -0
  25. package/dist/examples/server-declarative.js +205 -0
  26. package/dist/examples/server-declarative.js.map +1 -0
  27. package/dist/examples/shared/action-registry.d.ts +45 -0
  28. package/dist/examples/shared/action-registry.d.ts.map +1 -0
  29. package/dist/examples/shared/action-registry.js +65 -0
  30. package/dist/examples/shared/action-registry.js.map +1 -0
  31. package/dist/examples/shared/plugin-builder.d.ts +41 -0
  32. package/dist/examples/shared/plugin-builder.d.ts.map +1 -0
  33. package/dist/examples/shared/plugin-builder.js +85 -0
  34. package/dist/examples/shared/plugin-builder.js.map +1 -0
  35. package/dist/examples/storage-declarative.d.ts +13 -0
  36. package/dist/examples/storage-declarative.d.ts.map +1 -0
  37. package/dist/examples/storage-declarative.js +203 -0
  38. package/dist/examples/storage-declarative.js.map +1 -0
  39. package/dist/plugins/ActionRegistryPlugin.d.ts +14 -0
  40. package/dist/plugins/ActionRegistryPlugin.d.ts.map +1 -0
  41. package/dist/plugins/ActionRegistryPlugin.js +52 -0
  42. package/dist/plugins/ActionRegistryPlugin.js.map +1 -0
  43. package/dist/plugins/DynamicJSActionsPlugin.d.ts +21 -0
  44. package/dist/plugins/DynamicJSActionsPlugin.d.ts.map +1 -0
  45. package/dist/plugins/DynamicJSActionsPlugin.js +57 -0
  46. package/dist/plugins/DynamicJSActionsPlugin.js.map +1 -0
  47. package/dist/plugins/DynamicMathActionsPlugin.d.ts +22 -0
  48. package/dist/plugins/DynamicMathActionsPlugin.d.ts.map +1 -0
  49. package/dist/plugins/DynamicMathActionsPlugin.js +64 -0
  50. package/dist/plugins/DynamicMathActionsPlugin.js.map +1 -0
  51. package/dist/plugins/DynamicTextActionsPlugin.d.ts +22 -0
  52. package/dist/plugins/DynamicTextActionsPlugin.d.ts.map +1 -0
  53. package/dist/plugins/DynamicTextActionsPlugin.js +58 -0
  54. package/dist/plugins/DynamicTextActionsPlugin.js.map +1 -0
  55. package/dist/plugins/DynamicUtilityActionsPlugin.d.ts +22 -0
  56. package/dist/plugins/DynamicUtilityActionsPlugin.d.ts.map +1 -0
  57. package/dist/plugins/DynamicUtilityActionsPlugin.js +75 -0
  58. package/dist/plugins/DynamicUtilityActionsPlugin.js.map +1 -0
  59. package/dist/plugins/ExamplePlugin.d.ts +3 -0
  60. package/dist/plugins/ExamplePlugin.d.ts.map +1 -0
  61. package/dist/plugins/ExamplePlugin.js +24 -0
  62. package/dist/plugins/ExamplePlugin.js.map +1 -0
  63. package/dist/plugins/LifecycleDemoPlugin.d.ts +20 -0
  64. package/dist/plugins/LifecycleDemoPlugin.d.ts.map +1 -0
  65. package/dist/plugins/LifecycleDemoPlugin.js +34 -0
  66. package/dist/plugins/LifecycleDemoPlugin.js.map +1 -0
  67. package/dist/plugins/MathPlugin.d.ts +16 -0
  68. package/dist/plugins/MathPlugin.d.ts.map +1 -0
  69. package/dist/plugins/MathPlugin.js +30 -0
  70. package/dist/plugins/MathPlugin.js.map +1 -0
  71. package/dist/plugins/MyJSPlugin.d.ts +7 -0
  72. package/dist/plugins/MyJSPlugin.d.ts.map +1 -0
  73. package/dist/plugins/MyJSPlugin.js +12 -0
  74. package/dist/plugins/MyJSPlugin.js.map +1 -0
  75. package/dist/plugins/TypedExamplePlugin.d.ts +10 -0
  76. package/dist/plugins/TypedExamplePlugin.d.ts.map +1 -0
  77. package/dist/plugins/TypedExamplePlugin.js +61 -0
  78. package/dist/plugins/TypedExamplePlugin.js.map +1 -0
  79. package/dist/plugins/arktype/index.d.ts +8 -0
  80. package/dist/plugins/arktype/index.d.ts.map +1 -0
  81. package/dist/plugins/arktype/index.js +25 -0
  82. package/dist/plugins/arktype/index.js.map +1 -0
  83. package/dist/src/Plugin.d.ts +28 -0
  84. package/dist/src/Plugin.d.ts.map +1 -0
  85. package/dist/src/Plugin.js +36 -0
  86. package/dist/src/Plugin.js.map +1 -0
  87. package/dist/{PluginManager.d.ts → src/PluginManager.d.ts} +33 -10
  88. package/dist/src/PluginManager.d.ts.map +1 -0
  89. package/dist/{PluginManager.js → src/PluginManager.js} +245 -193
  90. package/dist/src/PluginManager.js.map +1 -0
  91. package/dist/{index.d.ts → src/index.d.ts} +2 -1
  92. package/dist/src/index.d.ts.map +1 -0
  93. package/dist/{index.js → src/index.js} +2 -0
  94. package/dist/src/index.js.map +1 -0
  95. package/dist/src/logger/LoggerAdapter.d.ts +77 -0
  96. package/dist/src/logger/LoggerAdapter.d.ts.map +1 -0
  97. package/dist/src/logger/LoggerAdapter.js +242 -0
  98. package/dist/src/logger/LoggerAdapter.js.map +1 -0
  99. package/dist/src/logger/LoggerFactory.d.ts +73 -0
  100. package/dist/src/logger/LoggerFactory.d.ts.map +1 -0
  101. package/dist/src/logger/LoggerFactory.js +99 -0
  102. package/dist/src/logger/LoggerFactory.js.map +1 -0
  103. package/dist/src/logger/index.d.ts +3 -0
  104. package/dist/src/logger/index.d.ts.map +1 -0
  105. package/dist/src/logger/index.js +3 -0
  106. package/dist/src/logger/index.js.map +1 -0
  107. package/dist/{managers → src/managers}/ContextFactory.d.ts +1 -1
  108. package/dist/src/managers/ContextFactory.d.ts.map +1 -0
  109. package/dist/{managers → src/managers}/ContextFactory.js +51 -26
  110. package/dist/src/managers/ContextFactory.js.map +1 -0
  111. package/dist/src/managers/DependencyManager.d.ts.map +1 -0
  112. package/dist/{managers → src/managers}/DependencyManager.js +7 -5
  113. package/dist/src/managers/DependencyManager.js.map +1 -0
  114. package/dist/{managers → src/managers}/HooksManager.d.ts +4 -1
  115. package/dist/src/managers/HooksManager.d.ts.map +1 -0
  116. package/dist/{managers → src/managers}/HooksManager.js +36 -8
  117. package/dist/src/managers/HooksManager.js.map +1 -0
  118. package/dist/src/managers/ResourceManager.d.ts.map +1 -0
  119. package/dist/{managers → src/managers}/ResourceManager.js +3 -3
  120. package/dist/src/managers/ResourceManager.js.map +1 -0
  121. package/dist/src/storage/JsonPluginStorage.d.ts +75 -0
  122. package/dist/src/storage/JsonPluginStorage.d.ts.map +1 -0
  123. package/dist/src/storage/JsonPluginStorage.js +240 -0
  124. package/dist/src/storage/JsonPluginStorage.js.map +1 -0
  125. package/dist/src/types/plugin-registry-base.d.ts +80 -0
  126. package/dist/src/types/plugin-registry-base.d.ts.map +1 -0
  127. package/dist/src/types/plugin-registry-base.js +6 -0
  128. package/dist/src/types/plugin-registry-base.js.map +1 -0
  129. package/dist/{types.d.ts → src/types.d.ts} +60 -19
  130. package/dist/src/types.d.ts.map +1 -0
  131. package/dist/{types.js → src/types.js} +6 -0
  132. package/dist/src/types.js.map +1 -0
  133. package/dist/src/utils/errorParser.d.ts.map +1 -0
  134. package/dist/{utils → src/utils}/errorParser.js +2 -5
  135. package/dist/src/utils/errorParser.js.map +1 -0
  136. package/dist/src/utils/pluginValidator.d.ts +17 -0
  137. package/dist/src/utils/pluginValidator.d.ts.map +1 -0
  138. package/dist/{utils → src/utils}/pluginValidator.js +11 -14
  139. package/dist/src/utils/pluginValidator.js.map +1 -0
  140. package/dist/src/utils/security.d.ts.map +1 -0
  141. package/dist/src/utils/security.js.map +1 -0
  142. package/dist/src/worker/WorkerRunner.d.ts.map +1 -0
  143. package/dist/{worker → src/worker}/WorkerRunner.js +38 -13
  144. package/dist/src/worker/WorkerRunner.js.map +1 -0
  145. package/package.json +9 -6
  146. package/dist/PluginManager.d.ts.map +0 -1
  147. package/dist/PluginManager.js.map +0 -1
  148. package/dist/index.d.ts.map +0 -1
  149. package/dist/index.js.map +0 -1
  150. package/dist/managers/ContextFactory.d.ts.map +0 -1
  151. package/dist/managers/ContextFactory.js.map +0 -1
  152. package/dist/managers/DependencyManager.d.ts.map +0 -1
  153. package/dist/managers/DependencyManager.js.map +0 -1
  154. package/dist/managers/HooksManager.d.ts.map +0 -1
  155. package/dist/managers/HooksManager.js.map +0 -1
  156. package/dist/managers/ResourceManager.d.ts.map +0 -1
  157. package/dist/managers/ResourceManager.js.map +0 -1
  158. package/dist/storage/JsonPluginStorage.d.ts +0 -14
  159. package/dist/storage/JsonPluginStorage.d.ts.map +0 -1
  160. package/dist/storage/JsonPluginStorage.js +0 -63
  161. package/dist/storage/JsonPluginStorage.js.map +0 -1
  162. package/dist/types.d.ts.map +0 -1
  163. package/dist/types.js.map +0 -1
  164. package/dist/utils/errorParser.d.ts.map +0 -1
  165. package/dist/utils/errorParser.js.map +0 -1
  166. package/dist/utils/pluginValidator.d.ts +0 -93
  167. package/dist/utils/pluginValidator.d.ts.map +0 -1
  168. package/dist/utils/pluginValidator.js.map +0 -1
  169. package/dist/utils/security.d.ts.map +0 -1
  170. package/dist/utils/security.js.map +0 -1
  171. package/dist/worker/WorkerRunner.d.ts.map +0 -1
  172. package/dist/worker/WorkerRunner.js.map +0 -1
  173. /package/dist/{managers → src/managers}/DependencyManager.d.ts +0 -0
  174. /package/dist/{managers → src/managers}/ResourceManager.d.ts +0 -0
  175. /package/dist/{utils → src/utils}/errorParser.d.ts +0 -0
  176. /package/dist/{utils → src/utils}/security.d.ts +0 -0
  177. /package/dist/{utils → src/utils}/security.js +0 -0
  178. /package/dist/{worker → src/worker}/WorkerRunner.d.ts +0 -0
package/LICENSE ADDED
@@ -0,0 +1,9 @@
1
+ # MIT License
2
+
3
+ Copyright (c) 2025
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -163,7 +163,7 @@ Plugins can share APIs with each other safely:
163
163
  // Plugin A: Exposes an API
164
164
  export class ProviderPlugin implements IPlugin {
165
165
  name = "db-provider";
166
- getSharedApi() {
166
+ getApi() {
167
167
  return {
168
168
  query: (q: string) => `Result for ${q}`,
169
169
  };
@@ -174,7 +174,7 @@ export class ProviderPlugin implements IPlugin {
174
174
  export class ConsumerPlugin implements IPlugin {
175
175
  name = "app-logic";
176
176
  async onLoad(context: PluginContext) {
177
- const db = context.getPlugin("db-provider");
177
+ const db = await context.getPlugin("db-provider");
178
178
  const result = db.query("SELECT *");
179
179
  }
180
180
  }
@@ -182,6 +182,130 @@ export class ConsumerPlugin implements IPlugin {
182
182
 
183
183
  ---
184
184
 
185
- ## 📜 License
185
+ ## 🎯 Type Safety & Autocompletion
186
+
187
+ The plugin system provides **full type safety and autocompletion** for inter-plugin communication using declaration merging.
188
+
189
+ ### 📚 Complete Guide
190
+
191
+ For detailed documentation on the type system, see [`docs/types-guide.md`](docs/types-guide.md).
192
+
193
+ ### 🚀 Quick Start
194
+
195
+ #### Step 1: Create a types file
196
+
197
+ Create a `.d.ts` file in your project (e.g., `plugins/types.d.ts`):
198
+
199
+ ```typescript
200
+ import type { BasePluginApi } from "bun_plugins/src/types/plugin-registry-base";
201
+
202
+ // Define the API interface for your plugin
203
+ export interface MathPluginApi extends BasePluginApi {
204
+ add(a: number, b: number): number;
205
+ multiply(a: number, b: number): number;
206
+ }
207
+
208
+ // Extend the PluginFactory with your plugin
209
+ declare module "bun_plugins" {
210
+ export interface PluginFactory {
211
+ "math-plugin": {
212
+ name: "math-plugin";
213
+ version: "1.0.0";
214
+ class: any;
215
+ api: MathPluginApi;
216
+ };
217
+ }
218
+ }
219
+ ```
220
+
221
+ #### Step 2: Register the API in your plugin
222
+
223
+ ```typescript
224
+ import { Plugin, PluginContext } from "bun_plugins";
225
+
226
+ export class MathPlugin extends Plugin {
227
+ name = "math-plugin";
228
+ version = "1.0.0";
229
+
230
+ override onLoad(context: PluginContext) {
231
+ // Register the API for other plugins to use
232
+ context.registerApi({
233
+ add: this.add.bind(this),
234
+ multiply: this.multiply.bind(this)
235
+ });
236
+ }
237
+
238
+ add(a: number, b: number): number {
239
+ return a + b;
240
+ }
241
+
242
+ multiply(a: number, b: number): number {
243
+ return a * b;
244
+ }
245
+ }
246
+ ```
247
+
248
+ #### Step 3: Use with full autocompletion
249
+
250
+ ```typescript
251
+ import { definePlugin } from "bun_plugins";
252
+
253
+ export default definePlugin({
254
+ name: "my-app",
255
+ version: "1.0.0",
256
+
257
+ async onLoad(context) {
258
+ // ✅ Full autocompletion and type safety!
259
+ const mathPlugin = await context.getPlugin('math-plugin');
260
+
261
+ if (mathPlugin) {
262
+ const result = mathPlugin.add(1, 2); // ✅ Autocompletion works
263
+ context.log.info(`Result: ${result}`);
264
+
265
+ // TypeScript will show errors for non-existent methods
266
+ // mathPlugin.nonExistentMethod(); // ❌ Error!
267
+ }
268
+ }
269
+ });
270
+ ```
271
+
272
+ ### ✨ Benefits
273
+
274
+ - 🎯 **Full Autocompletion**: Your IDE shows all available methods
275
+ - 🔒 **Type Safety**: TypeScript catches errors at compile time
276
+ - 📖 **Self-Documenting**: Interfaces serve as API documentation
277
+ - 🔄 **Refactor-Friendly**: Safe method renaming and refactoring
278
+ - 🌐 **Works with External Plugins**: Extend types for npm packages too
279
+
280
+ ### 📖 Examples
281
+
282
+ - [`plugins/types.d.ts`](plugins/types.d.ts) - Complete example for this project
283
+ - [`plugins/TypedExamplePlugin.ts`](plugins/TypedExamplePlugin.ts) - Plugin using typed access
284
+ - [`examples/types-extension-example.d.ts`](examples/types-extension-example.d.ts) - Standalone example
285
+
286
+ ### 🔧 TypeScript Configuration
287
+
288
+ Ensure your `tsconfig.json` includes the types file:
289
+
290
+ ```json
291
+ {
292
+ "include": [
293
+ "src/**/*",
294
+ "plugins/**/*",
295
+ "**/*.d.ts"
296
+ ]
297
+ }
298
+ ```
299
+
300
+ ### 💡 Tips
301
+
302
+ 1. **Match names exactly**: The plugin name in `PluginFactory` must match `plugin.name`
303
+ 2. **Register APIs**: Always use `context.registerApi()` to expose your plugin's API
304
+ 3. **Extend BasePluginApi**: Your API interfaces should extend `BasePluginApi` for consistency
305
+ 4. **External plugins**: You can extend types for third-party plugins the same way
306
+
307
+ ---
308
+
309
+ ## License
186
310
 
187
311
  MIT © [memelser](https://github.com/nglmercer)
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Declarative Action Registry Example
3
+ *
4
+ * This example demonstrates a clean, declarative approach to building
5
+ * plugins with action registries using shared utilities.
6
+ */
7
+ declare const createRegistryPlugin: () => import("bun_plugins").IPlugin;
8
+ declare const createMathPlugin: () => import("bun_plugins").IPlugin;
9
+ declare const createTextPlugin: () => import("bun_plugins").IPlugin;
10
+ declare const createUtilityPlugin: () => import("bun_plugins").IPlugin;
11
+ declare const demonstrateDeclarativeActionRegistry: () => Promise<void>;
12
+ declare const demonstrateDynamicLoading: () => Promise<void>;
13
+ export { createRegistryPlugin, createMathPlugin, createTextPlugin, createUtilityPlugin, demonstrateDeclarativeActionRegistry, demonstrateDynamicLoading };
14
+ //# sourceMappingURL=action-registry-declarative.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-registry-declarative.d.ts","sourceRoot":"","sources":["../../examples/action-registry-declarative.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAaH,QAAA,MAAM,oBAAoB,qCAUxB,CAAC;AAGH,QAAA,MAAM,gBAAgB,qCAMpB,CAAC;AAEH,QAAA,MAAM,gBAAgB,qCAMpB,CAAC;AAEH,QAAA,MAAM,mBAAmB,qCAMvB,CAAC;AA4CH,QAAA,MAAM,oCAAoC,qBA2CzC,CAAC;AAGF,QAAA,MAAM,yBAAyB,qBAS9B,CAAC;AAGF,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,oCAAoC,EACpC,yBAAyB,EAC1B,CAAC"}
@@ -0,0 +1,130 @@
1
+ /**
2
+ * Declarative Action Registry Example
3
+ *
4
+ * This example demonstrates a clean, declarative approach to building
5
+ * plugins with action registries using shared utilities.
6
+ */
7
+ import { PluginManager } from "../src/PluginManager";
8
+ import { mathActions, textActions, utilityActions, createActionRegistry } from "./shared/action-registry";
9
+ import { createPlugin, createActionPlugin, runDemo } from "./shared/plugin-builder";
10
+ // Central registry plugin - declarative definition
11
+ const createRegistryPlugin = () => createPlugin({
12
+ name: "action-registry",
13
+ version: "1.0.0",
14
+ description: "Central action registry for all plugins",
15
+ onLoad: async (context) => {
16
+ context.log.info("ActionRegistry initialized");
17
+ },
18
+ sharedApi: createActionRegistry()
19
+ });
20
+ // Action plugins - declarative definitions
21
+ const createMathPlugin = () => createActionPlugin({
22
+ name: "math-actions",
23
+ version: "1.0.0",
24
+ description: "Mathematical operations",
25
+ registryName: "action-registry",
26
+ actionCategories: [mathActions]
27
+ });
28
+ const createTextPlugin = () => createActionPlugin({
29
+ name: "text-actions",
30
+ version: "1.0.0",
31
+ description: "Text transformation operations",
32
+ registryName: "action-registry",
33
+ actionCategories: [textActions]
34
+ });
35
+ const createUtilityPlugin = () => createActionPlugin({
36
+ name: "utility-actions",
37
+ version: "1.0.0",
38
+ description: "Utility functions",
39
+ registryName: "action-registry",
40
+ actionCategories: [utilityActions]
41
+ });
42
+ // Demo runner with declarative test cases
43
+ const runActionTests = async (registry) => {
44
+ const testCases = [
45
+ { category: "Math", tests: [
46
+ { action: "sum", args: [5, 3], expected: 8 },
47
+ { action: "multiply", args: [4, 7], expected: 28 },
48
+ { action: "power", args: [2, 8], expected: 256 }
49
+ ] },
50
+ { category: "Text", tests: [
51
+ { action: "uppercase", args: ["hello world"], expected: "HELLO WORLD" },
52
+ { action: "reverse", args: ["javascript"], expected: "tpircsavaj" }
53
+ ] },
54
+ { category: "Utility", tests: [
55
+ { action: "timestamp", args: [], validator: (result) => result > 0 }
56
+ ] }
57
+ ];
58
+ for (const { category, tests } of testCases) {
59
+ console.log(`\n${category} Operations:`);
60
+ for (const test of tests) {
61
+ try {
62
+ const result = registry.execute(test.action, ...test.args);
63
+ if ('expected' in test && test.expected !== undefined) {
64
+ console.log(` ${test.action}(${test.args.join(', ')}) = ${result}`);
65
+ }
66
+ else if ('validator' in test && test.validator) {
67
+ console.log(` ${test.action}() = ${test.validator(result) ? '✓' : '✗'}`);
68
+ }
69
+ }
70
+ catch (error) {
71
+ console.error(` ${test.action} failed:`, error);
72
+ }
73
+ }
74
+ }
75
+ };
76
+ // Main demonstration
77
+ const demonstrateDeclarativeActionRegistry = async () => {
78
+ const manager = new PluginManager();
79
+ // Create plugin instances
80
+ const registryPlugin = createRegistryPlugin();
81
+ const mathPlugin = createMathPlugin();
82
+ const textPlugin = createTextPlugin();
83
+ const utilityPlugin = createUtilityPlugin();
84
+ // Register plugins in dependency order
85
+ await manager.register(registryPlugin);
86
+ await manager.register(mathPlugin);
87
+ await manager.register(textPlugin);
88
+ await manager.register(utilityPlugin);
89
+ // Get the registry
90
+ const registry = manager.getPluginApi("action-registry");
91
+ if (!registry) {
92
+ throw new Error("Registry plugin not found");
93
+ }
94
+ console.log("\nAvailable Actions:");
95
+ registry.list().forEach(action => console.log(` - ${action}`));
96
+ // Run tests
97
+ await runActionTests(registry);
98
+ // Error handling demo
99
+ console.log("\nError Handling:");
100
+ try {
101
+ registry.execute("non-existent-action");
102
+ }
103
+ catch (error) {
104
+ console.log(` Caught error: ${error.message}`);
105
+ }
106
+ // Plugin info
107
+ console.log("\nPlugin Information:");
108
+ ["math-actions", "text-actions", "utility-actions"].forEach(pluginName => {
109
+ const api = manager.getPluginApi(pluginName);
110
+ if (api?.actions) {
111
+ console.log(` ${pluginName}: ${api.actions.join(", ")}`);
112
+ }
113
+ });
114
+ };
115
+ // Dynamic loading example
116
+ const demonstrateDynamicLoading = async () => {
117
+ const { join } = await import("node:path");
118
+ const manager = new PluginManager();
119
+ console.log("\nLoading plugins dynamically from directory...");
120
+ await manager.loadPluginsFromDirectory(join(process.cwd(), "plugins"));
121
+ const loaded = manager.listPlugins();
122
+ console.log(`Loaded ${loaded.length} plugins: ${loaded.join(", ")}`);
123
+ };
124
+ // Export for use
125
+ export { createRegistryPlugin, createMathPlugin, createTextPlugin, createUtilityPlugin, demonstrateDeclarativeActionRegistry, demonstrateDynamicLoading };
126
+ // Run if called directly
127
+ if (import.meta.main) {
128
+ runDemo("Declarative Action Registry Demo", demonstrateDeclarativeActionRegistry);
129
+ }
130
+ //# sourceMappingURL=action-registry-declarative.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-registry-declarative.js","sourceRoot":"","sources":["../../examples/action-registry-declarative.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAEL,WAAW,EACX,WAAW,EACX,cAAc,EACd,oBAAoB,EACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAEpF,mDAAmD;AACnD,MAAM,oBAAoB,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC;IAC9C,IAAI,EAAE,iBAAiB;IACvB,OAAO,EAAE,OAAO;IAChB,WAAW,EAAE,yCAAyC;IAEtD,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;QACxB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;IACjD,CAAC;IAED,SAAS,EAAE,oBAAoB,EAAE;CAClC,CAAC,CAAC;AAEH,2CAA2C;AAC3C,MAAM,gBAAgB,GAAG,GAAG,EAAE,CAAC,kBAAkB,CAAC;IAChD,IAAI,EAAE,cAAc;IACpB,OAAO,EAAE,OAAO;IAChB,WAAW,EAAE,yBAAyB;IACtC,YAAY,EAAE,iBAAiB;IAC/B,gBAAgB,EAAE,CAAC,WAAW,CAAC;CAChC,CAAC,CAAC;AAEH,MAAM,gBAAgB,GAAG,GAAG,EAAE,CAAC,kBAAkB,CAAC;IAChD,IAAI,EAAE,cAAc;IACpB,OAAO,EAAE,OAAO;IAChB,WAAW,EAAE,gCAAgC;IAC7C,YAAY,EAAE,iBAAiB;IAC/B,gBAAgB,EAAE,CAAC,WAAW,CAAC;CAChC,CAAC,CAAC;AAEH,MAAM,mBAAmB,GAAG,GAAG,EAAE,CAAC,kBAAkB,CAAC;IACnD,IAAI,EAAE,iBAAiB;IACvB,OAAO,EAAE,OAAO;IAChB,WAAW,EAAE,m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AAyB,GAAG,KAAK,IAAI,EAAE;IAC3C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,CAAC;IAC3C,MAAM,OAAO,GAAG,IAAI,aAAa,EAAE,CAAC;IAEpC,OAAO,CAAC,GAAG,CAAC,iDAAiD,CAAC,CAAC;IAC/D,MAAM,OAAO,CAAC,wBAAwB,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC;IAEvE,MAAM,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IACrC,OAAO,CAAC,GAAG,CAAC,UAAU,MAAM,CAAC,MAAM,aAAa,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACvE,CAAC,CAAC;AAEF,iBAAiB;AACjB,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,oCAAoC,EACpC,yBAAyB,EAC1B,CAAC;AAEF,yBAAyB;AACzB,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IACrB,OAAO,CAAC,kCAAkC,EAAE,oCAAoC,CAAC,CAAC;AACpF,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Action Registry Example - Simple implementation for testing
3
+ */
4
+ import type { IPlugin, PluginContext } from "../src/types";
5
+ export declare class ActionRegistryPlugin implements IPlugin {
6
+ name: string;
7
+ version: string;
8
+ private actionRegistry;
9
+ constructor();
10
+ onLoad(context: PluginContext): void;
11
+ onUnload(): void;
12
+ }
13
+ export declare class MathActionsPlugin implements IPlugin {
14
+ name: string;
15
+ version: string;
16
+ dependencies: {
17
+ "action-registry": string;
18
+ };
19
+ onLoad(context: PluginContext): Promise<void>;
20
+ onUnload(): void;
21
+ }
22
+ export declare class TextActionsPlugin implements IPlugin {
23
+ name: string;
24
+ version: string;
25
+ dependencies: {
26
+ "action-registry": string;
27
+ };
28
+ onLoad(context: PluginContext): Promise<void>;
29
+ onUnload(): void;
30
+ }
31
+ //# sourceMappingURL=action-registry-example.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-registry-example.d.ts","sourceRoot":"","sources":["../../examples/action-registry-example.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AA4B3D,qBAAa,oBAAqB,YAAW,OAAO;IAClD,IAAI,SAAqB;IACzB,OAAO,SAAW;IAClB,OAAO,CAAC,cAAc,CAAiB;;IAMvC,MAAM,CAAC,OAAO,EAAE,aAAa;IAa7B,QAAQ;CAGT;AAED,qBAAa,iBAAkB,YAAW,OAAO;IAC/C,IAAI,SAAkB;IACtB,OAAO,SAAW;IAClB,YAAY;;MAEV;IAEI,MAAM,CAAC,OAAO,EAAE,aAAa;IAWnC,QAAQ;CAGT;AAED,qBAAa,iBAAkB,YAAW,OAAO;IAC/C,IAAI,SAAkB;IACtB,OAAO,SAAW;IAClB,YAAY;;MAEV;IAEI,MAAM,CAAC,OAAO,EAAE,aAAa;IAYnC,QAAQ;CAGT"}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Action Registry Example - Simple implementation for testing
3
+ */
4
+ class ActionRegistry {
5
+ actionHandlers = new Map();
6
+ registerAction(type, handler) {
7
+ this.actionHandlers.set(type, handler);
8
+ }
9
+ executeAction(type, ...args) {
10
+ const handler = this.actionHandlers.get(type);
11
+ if (!handler) {
12
+ throw new Error(`Acción no encontrada: ${type}`);
13
+ }
14
+ return handler(...args);
15
+ }
16
+ listActions() {
17
+ return Array.from(this.actionHandlers.keys());
18
+ }
19
+ hasAction(type) {
20
+ return this.actionHandlers.has(type);
21
+ }
22
+ }
23
+ export class ActionRegistryPlugin {
24
+ name = "action-registry";
25
+ version = "1.0.0";
26
+ actionRegistry;
27
+ constructor() {
28
+ this.actionRegistry = new ActionRegistry();
29
+ }
30
+ onLoad(context) {
31
+ context.log.info("ActionRegistry initialized");
32
+ // Register the API manually using the new system
33
+ context.registerApi({
34
+ registerAction: this.actionRegistry.registerAction.bind(this.actionRegistry),
35
+ executeAction: this.actionRegistry.executeAction.bind(this.actionRegistry),
36
+ listActions: this.actionRegistry.listActions.bind(this.actionRegistry),
37
+ hasAction: this.actionRegistry.hasAction.bind(this.actionRegistry),
38
+ actions: this.actionRegistry.listActions()
39
+ });
40
+ }
41
+ onUnload() {
42
+ // Cleanup is handled by the plugin manager
43
+ }
44
+ }
45
+ export class MathActionsPlugin {
46
+ name = "math-actions";
47
+ version = "1.0.0";
48
+ dependencies = {
49
+ "action-registry": "1.0.0"
50
+ };
51
+ async onLoad(context) {
52
+ const actionRegistry = await context.getPlugin("action-registry");
53
+ if (actionRegistry) {
54
+ actionRegistry.registerAction("sum", (a, b) => a + b);
55
+ actionRegistry.registerAction("multiply", (a, b) => a * b);
56
+ actionRegistry.registerAction("power", (base, exp) => Math.pow(base, exp));
57
+ context.log.info("Math actions registered");
58
+ }
59
+ }
60
+ onUnload() {
61
+ // Cleanup is handled by the plugin manager
62
+ }
63
+ }
64
+ export class TextActionsPlugin {
65
+ name = "text-actions";
66
+ version = "1.0.0";
67
+ dependencies = {
68
+ "action-registry": "1.0.0"
69
+ };
70
+ async onLoad(context) {
71
+ const actionRegistry = await context.getPlugin("action-registry");
72
+ if (actionRegistry) {
73
+ actionRegistry.registerAction("uppercase", (text) => text.toUpperCase());
74
+ actionRegistry.registerAction("lowercase", (text) => text.toLowerCase());
75
+ actionRegistry.registerAction("reverse", (text) => text.split('').reverse().join(''));
76
+ actionRegistry.registerAction("wordCount", (text) => text.trim().split(/\s+/).filter(word => word.length > 0).length);
77
+ context.log.info("Text actions registered");
78
+ }
79
+ }
80
+ onUnload() {
81
+ // Cleanup is handled by the plugin manager
82
+ }
83
+ }
84
+ //# sourceMappingURL=action-registry-example.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-registry-example.js","sourceRoot":"","sources":["../../examples/action-registry-example.ts"],"names":[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,MAAM,CAAC,OAAsB;QACjC,MAAM,cAAc,GAAG,MAAM,OAAO,CAAC,SAAS,CAAC,iBAAiB,CAAQ,CAAC;QAEzE,IAAI,cAAc,EAAE,CAAC;YACnB,cAAc,CAAC,cAAc,CAAC,WAAW,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;YACjF,cAAc,CAAC,cAAc,CAAC,WAAW,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;YACjF,cAAc,CAAC,cAAc,CAAC,SAAS,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;YAC9F,cAAc,CAAC,cAAc,CAAC,WAAW,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;YAC9H,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;IAED,QAAQ;QACN,2CAA2C;IAC7C,CAAC;CACF"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Declarative Examples Index
3
+ *
4
+ * This file serves as the main entry point for all declarative examples,
5
+ * providing a clean overview and easy access to different use cases.
6
+ */
7
+ import { demonstrateDeclarativeActionRegistry } from "./action-registry-declarative";
8
+ import { demonstrateDeclarativeStorage } from "./storage-declarative";
9
+ import { demonstrateDeclarativeLogging } from "./logger-declarative";
10
+ import { demonstrateDeclarativeServer } from "./server-declarative";
11
+ declare const exampleCatalog: ({
12
+ id: string;
13
+ name: string;
14
+ description: string;
15
+ file: string;
16
+ demo: () => Promise<void>;
17
+ features: string[];
18
+ } | {
19
+ id: string;
20
+ name: string;
21
+ description: string;
22
+ file: string;
23
+ demo: () => Promise<Bun.Server<undefined>>;
24
+ features: string[];
25
+ })[];
26
+ declare const showMainMenu: () => void;
27
+ declare const runExample: (index: number) => Promise<void>;
28
+ declare const runAllExamples: () => Promise<void>;
29
+ declare const interactiveMenu: () => Promise<void>;
30
+ declare const quickRun: (exampleId: string) => Promise<void>;
31
+ export { exampleCatalog, showMainMenu, runExample, runAllExamples, interactiveMenu, quickRun, demonstrateDeclarativeActionRegistry, demonstrateDeclarativeStorage, demonstrateDeclarativeLogging, demonstrateDeclarativeServer };
32
+ //# sourceMappingURL=index-declarative.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-declarative.d.ts","sourceRoot":"","sources":["../../examples/index-declarative.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAE,oCAAoC,EAAE,MAAM,+BAA+B,CAAC;AACrF,OAAO,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AAGpE,QAAA,MAAM,cAAc;;;;;;;;;;;;;;IAyDnB,CAAC;AAGF,QAAA,MAAM,YAAY,YAejB,CAAC;AAGF,QAAA,MAAM,UAAU,GAAU,OAAO,MAAM,kBAkBtC,CAAC;AAGF,QAAA,MAAM,cAAc,qBAgBnB,CAAC;AAGF,QAAA,MAAM,eAAe,qBAwCpB,CAAC;AAGF,QAAA,MAAM,QAAQ,GAAU,WAAW,MAAM,kBAmBxC,CAAC;AAGF,OAAO,EACL,cAAc,EACd,YAAY,EACZ,UAAU,EACV,cAAc,EACd,eAAe,EACf,QAAQ,EAER,oCAAoC,EACpC,6BAA6B,EAC7B,6BAA6B,EAC7B,4BAA4B,EAC7B,CAAC"}