bun_plugins 1.0.0 → 1.0.1

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.
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
@@ -1,81 +1,187 @@
1
- # Bun Plugins
1
+ # 🔌 Bun Plugins
2
2
 
3
- A powerful, secure, and isolated plugin system for Bun applications.
3
+ A powerful, secure, and isolated plugin system designed specifically for **Bun** applications. Build extensible applications with fine-grained control over security, resource management, and inter-plugin communication.
4
4
 
5
- ## Features
5
+ [![NPM Version](https://img.shields.io/npm/v/bun_plugins.svg)](https://www.npmjs.com/package/bun_plugins)
6
+ [![License](https://img.shields.io/github/license/nglmercer/bun_plugins.svg)](LICENSE)
7
+ [![Bun](https://img.shields.io/badge/Bun-%23000000.svg?style=flat&logo=bun&logoColor=white)](https://bun.sh)
6
8
 
7
- - **Isolated Workers**: Plugins run in their own Bun Workers, providing security and crashing isolation.
8
- - **Permission System**: Fine-grained control over network, file system, and environment access.
9
- - **Hook System**: Intercept and modify resource loading with `onResolve` and `onLoad` hooks (compatible with Bun's plugin API).
10
- - **Type Safe**: Written in TypeScript with full type definitions and Zod validation.
11
- - **Communication RPC**: Seamless communication between the host and plugins using a proxy-based RPC.
12
- - **Automatic Cleanup**: Resources (timers, workers, event listeners) are automatically cleaned up when a plugin is unloaded.
9
+ ## 🌟 Key Features
13
10
 
14
- ## Installation
11
+ - 🛡️ **Isolation**: Run plugins in dedicated Bun Workers for crash protection and security boundaries.
12
+ - 🔐 **Permission System**: Fine-grained control over Network (with whitelist), Filesystem, and Environment access.
13
+ - 🔄 **Communication RPC**: Seamless, proxy-based async communication between host and plugins.
14
+ - 🧹 **Automatic Resource Cleanup**: Automatically stops workers, clears timers, and removes event listeners when a plugin unloads.
15
+ - ✅ **Type Safe**: Fully written in TypeScript with Zod validation for plugin configurations.
16
+ - 🏗️ **Plugin Hooks**: Intercept resource loading with `onResolve` and `onLoad` hooks, fully compatible with Bun's native plugin API.
17
+ - 🔋 **Persistence**: Built-in JSON-based KV storage for each plugin.
18
+ - 🔥 **Hot Reloading**: Watch plugin directories and automatically reload changed plugins.
19
+ - 📦 **Dependency Management**: Cross-plugin dependencies with semver version checking.
20
+
21
+ ---
22
+
23
+ ## 🚀 Quick Start
24
+
25
+ ### 1. Installation
15
26
 
16
27
  ```bash
17
28
  bun add bun_plugins
18
29
  ```
19
30
 
20
- ## Quick Start
21
-
22
- ### 1. Define a Plugin
31
+ ### 2. Create your first Plugin
23
32
 
24
33
  ```typescript
25
- // plugins/MyPlugin.ts
26
- import type { IPlugin, PluginContext } from "bun_plugins";
34
+ import { type IPlugin, type PluginContext } from "bun_plugins";
27
35
 
28
36
  export class MyPlugin implements IPlugin {
29
- name = "my-plugin";
37
+ name = "hello-world";
30
38
  version = "1.0.0";
31
39
 
32
40
  async onLoad(context: PluginContext) {
33
- context.log.info("Plugin loaded!");
41
+ context.log.info("Hello World Plugin Loaded!");
34
42
 
35
- context.on("hello", (name) => {
36
- console.log(`Hello, ${name}!`);
43
+ // Listen to global app events
44
+ context.on("app:ready", () => {
45
+ context.log.info("The application is ready!");
37
46
  });
47
+
48
+ // Expose functionality via events
49
+ context.emit("plugin:hello", { message: "Hello from plugin!" });
38
50
  }
39
51
  }
40
52
  ```
41
53
 
42
- ### 2. Use the Plugin Manager
54
+ ### 3. Initialize the Manager
43
55
 
44
56
  ```typescript
45
57
  import { PluginManager } from "bun_plugins";
46
- import { join } from "node:path";
58
+ import { MyPlugin } from "./plugins/MyPlugin";
47
59
 
48
60
  const manager = new PluginManager();
49
61
 
50
- // Register a plugin class instance
62
+ // Register a class instance
51
63
  await manager.register(new MyPlugin());
52
64
 
53
- // Or load an isolated plugin from a file
65
+ // Emit an event to all plugins
66
+ manager.emit("app:ready", {});
67
+ ```
68
+
69
+ ---
70
+
71
+ ## 🛠️ Core Concepts
72
+
73
+ ### 🧩 The Plugin Interface (`IPlugin`)
74
+
75
+ All plugins must implement the `IPlugin` interface.
76
+
77
+ | Property | Type | Description |
78
+ | :--------------- | :------------------- | :-------------------------------------------------------------- |
79
+ | `name` | `string` | Unique identifier for the plugin. |
80
+ | `version` | `string` | Semver compatible version. |
81
+ | `permissions` | `PluginPermission[]` | List of requested permissions (`network`, `filesystem`, `env`). |
82
+ | `allowedDomains` | `string[]` | Whitelist for network access. |
83
+ | `configSchema` | `ZodSchema` | Zod schema for configuration validation. |
84
+ | `onLoad` | `(ctx) => void` | Primary entry point for plugin logic. |
85
+ | `onUnload` | `() => void` | Cleanup logic when plugin is removed. |
86
+
87
+ ### 🧪 Plugin Context (`PluginContext`)
88
+
89
+ The `context` provided to `onLoad` is the primary way plugins interact with the host.
90
+
91
+ - 📝 **`context.log`**: Scoped logging (`info`, `warn`, `error`).
92
+ - 📡 **`context.events`**: typed event bus (`emit`, `on`).
93
+ - 📦 **`context.storage`**: Persistent JSON storage (`get`, `set`, `delete`).
94
+ - 🌐 **`context.network`**: Safe `fetch` implementation (requires 'network' permission).
95
+ - 📂 **`context.file`**: Access Bun's `File` API (requires 'filesystem' permission).
96
+ - 🔐 **`context.env`**: Read-only access to environment variables (requires 'env' permission).
97
+ - ⏲️ **`context.setTimeout/Interval`**: Automatically cleaned up on unload.
98
+
99
+ ---
100
+
101
+ ## 🔒 Security & Permissions
102
+
103
+ Plugins are restricted by default. To access sensitive APIs, you must explicitly declare permissions:
104
+
105
+ ```typescript
106
+ export class NetworkPlugin implements IPlugin {
107
+ name = "weather-fetcher";
108
+ version = "1.0.0";
109
+
110
+ // Request network access
111
+ permissions = [PluginPermission.Network];
112
+ // Whitelist specific domains
113
+ allowedDomains = ["api.weather.com"];
114
+
115
+ async onLoad(context: PluginContext) {
116
+ // This works
117
+ const data = await context.network.fetch(
118
+ "https://api.weather.com/v1/forecast"
119
+ );
120
+
121
+ // This throws AccessDeniedError (not in whitelist)
122
+ await context.network.fetch("https://malicious.com");
123
+ }
124
+ }
125
+ ```
126
+
127
+ ---
128
+
129
+ ## 🧊 Isolated Worker Plugins
130
+
131
+ For maximum security and stability, you can load plugins into dedicated workers. These plugins run in a separate process and communicate via RPC.
132
+
133
+ ```typescript
134
+ // Load a plugin from a file into a worker
54
135
  await manager.registerIsolated(
55
- join(process.cwd(), "plugins", "OtherPlugin.ts"),
56
- "OtherPlugin"
136
+ "./plugins/ExternalPlugin.ts",
137
+ "isolated-plugin"
57
138
  );
139
+ ```
58
140
 
59
- // Emit events to plugins
60
- manager.emit("hello", "World");
141
+ ---
142
+
143
+ ## 🔌 Native Bun Integration
144
+
145
+ `bun_plugins` can act as a bridge to Bun's native plugin system, allowing your library plugins to handle your application's module resolution.
146
+
147
+ ```typescript
148
+ // In your entry point
149
+ const manager = new PluginManager();
150
+ await manager.loadPluginsFromDirectory();
151
+
152
+ // Register as a native Bun plugin
153
+ Bun.plugin(manager.toBunPlugin());
61
154
  ```
62
155
 
63
- ## Security
156
+ ---
157
+
158
+ ## 🤝 Inter-Plugin Communication
64
159
 
65
- Plugins run in a restricted environment. By default, they have no permissions. You can grant them in the plugin metadata:
160
+ Plugins can share APIs with each other safely:
66
161
 
67
162
  ```typescript
68
- export class SecurePlugin implements IPlugin {
69
- name = "secure-plugin";
70
- permissions = ["network"];
71
- allowedDomains = ["api.example.com"];
163
+ // Plugin A: Exposes an API
164
+ export class ProviderPlugin implements IPlugin {
165
+ name = "db-provider";
166
+ getSharedApi() {
167
+ return {
168
+ query: (q: string) => `Result for ${q}`,
169
+ };
170
+ }
171
+ }
72
172
 
173
+ // Plugin B: Consumes the API
174
+ export class ConsumerPlugin implements IPlugin {
175
+ name = "app-logic";
73
176
  async onLoad(context: PluginContext) {
74
- const data = await context.network.fetch("https://api.example.com/data");
177
+ const db = context.getPlugin("db-provider");
178
+ const result = db.query("SELECT *");
75
179
  }
76
180
  }
77
181
  ```
78
182
 
79
- ## License
183
+ ---
184
+
185
+ ## 📜 License
80
186
 
81
- MIT
187
+ MIT © [memelser](https://github.com/nglmercer)
package/dist/index.d.ts CHANGED
@@ -2,5 +2,4 @@ export * from "./PluginManager";
2
2
  export * from "./types";
3
3
  export * from "./storage/JsonPluginStorage";
4
4
  export * from "./utils/pluginValidator";
5
- export type * from "./global.d.ts";
6
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,mBAAmB,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import type { IPlugin } from "../types";
3
- export declare const PluginSchema: z.ZodObject<{
3
+ declare const pluginSchemaDefinition: z.ZodObject<{
4
4
  name: z.ZodString;
5
5
  version: z.ZodDefault<z.ZodString>;
6
6
  description: z.ZodOptional<z.ZodString>;
@@ -23,12 +23,14 @@ export declare const PluginSchema: z.ZodObject<{
23
23
  getSharedApi: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
24
24
  setup: z.ZodOptional<z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>;
25
25
  }, z.core.$strip>;
26
- export declare const StrictPluginSchema: z.ZodObject<{
26
+ export declare const PluginSchema: z.ZodType<z.infer<typeof pluginSchemaDefinition>>;
27
+ declare const strictPluginSchemaDefinition: z.ZodObject<{
27
28
  name: z.ZodString;
28
29
  version: z.ZodString;
29
30
  onLoad: z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>;
30
31
  onUnload: z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>;
31
32
  }, z.core.$strip>;
33
+ export declare const StrictPluginSchema: z.ZodType<z.infer<typeof strictPluginSchemaDefinition>>;
32
34
  export type ValidationResult = {
33
35
  valid: true;
34
36
  plugin: IPlugin;
@@ -44,4 +46,5 @@ export type ValidationResult = {
44
46
  * 3. Class Constructors (instantiates them) // TODO if we want to move that logic here
45
47
  */
46
48
  export declare function validatePlugin(candidate: unknown): ValidationResult;
49
+ export {};
47
50
  //# sourceMappingURL=pluginValidator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pluginValidator.d.ts","sourceRoot":"","sources":["../../src/utils/pluginValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAGxC,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;iBAsBvB,CAAC;AAGH,eAAO,MAAM,kBAAkB;;;;;iBAK7B,CAAC;AAEH,MAAM,MAAM,gBAAgB,GACxB;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,GAChC;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpC;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,OAAO,GAAG,gBAAgB,CAqBnE"}
1
+ {"version":3,"file":"pluginValidator.d.ts","sourceRoot":"","sources":["../../src/utils/pluginValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAIxC,QAAA,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;iBAsB1B,CAAC;AAGH,eAAO,MAAM,YAAY,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAA0B,CAAC;AAGtG,QAAA,MAAM,4BAA4B;;;;;iBAKhC,CAAC;AAEH,eAAO,MAAM,kBAAkB,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAgC,CAAC;AAGxH,MAAM,MAAM,gBAAgB,GACxB;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,GAChC;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpC;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,OAAO,GAAG,gBAAgB,CAqBnE"}
@@ -1,6 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { errorParser } from "../utils/errorParser";
3
- export const PluginSchema = z.object({
3
+ // Define the schemas with explicit return types to avoid exposing Zod internals
4
+ const pluginSchemaDefinition = z.object({
4
5
  name: z.string().min(1, "Plugin name is required"),
5
6
  version: z.string().min(1, "Plugin version is required").default("1.0.0"),
6
7
  description: z.string().optional(),
@@ -19,13 +20,16 @@ export const PluginSchema = z.object({
19
20
  getSharedApi: z.function().optional(),
20
21
  setup: z.function().optional(),
21
22
  });
23
+ // Export with explicit type annotation to prevent internal type exposure
24
+ export const PluginSchema = pluginSchemaDefinition;
22
25
  // We can have a stricter schema for the full IPlugin
23
- export const StrictPluginSchema = z.object({
26
+ const strictPluginSchemaDefinition = z.object({
24
27
  name: z.string(),
25
28
  version: z.string(),
26
29
  onLoad: z.function(),
27
30
  onUnload: z.function(),
28
31
  });
32
+ export const StrictPluginSchema = strictPluginSchemaDefinition;
29
33
  /**
30
34
  * Validates if an unknown object is a valid plugin.
31
35
  * Handles:
@@ -64,10 +68,14 @@ function validatePluginInstance(obj) {
64
68
  error: result.error.issues.map((e) => `${e.path.join('.')}: ${e.message}`).join(', ')
65
69
  };
66
70
  }
67
- // Cast to IPlugin (fill in missing optional methods if needed)
68
- const plugin = result.data;
69
- // Shim onUnload if missing (since we made it optional in schema but it is required in IPlugin interface usually,
70
- // though we can be lenient)
71
+ // Use the original object to preserve prototype and 'this' context,
72
+ // but we can use the parsed data to ensure defaults are applied if we want.
73
+ // For now, let's just return the original object casted to IPlugin.
74
+ const plugin = obj;
75
+ // Apply defaults/formatting from Zod if needed (optional)
76
+ if (!plugin.version && result.data.version)
77
+ plugin.version = result.data.version;
78
+ // Shim onUnload if missing
71
79
  if (!plugin.onUnload) {
72
80
  plugin.onUnload = () => { };
73
81
  }
@@ -1 +1 @@
1
- {"version":3,"file":"pluginValidator.js","sourceRoot":"","sources":["../../src/utils/pluginValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,IAAI,EAAE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AAG,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;SAC7F,CAAC;IACJ,CAAC;IAED,oEAAoE;IACpE,4EAA4E;IAC5E,oEAAoE;IACpE,MAAM,MAAM,GAAG,GAAc,CAAC;IAE9B,0DAA0D;IAC1D,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO;QAAE,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;IAEjF,2BAA2B;IAC3B,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QACrB,MAAM,CAAC,QAAQ,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;IAC7B,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AACjC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bun_plugins",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "A powerful and secure plugin system for Bun applications",
5
5
  "author": "memelser <nglmercer@gmail.com>",
6
6
  "repository": {
@@ -25,7 +25,7 @@
25
25
  }
26
26
  },
27
27
  "scripts": {
28
- "build": "rm -rf dist && tsc",
28
+ "build": "bun tsc",
29
29
  "test": "bun test ./tests",
30
30
  "typecheck": "bun tsc --noEmit",
31
31
  "prepublishOnly": "bun run build"
@@ -33,11 +33,10 @@
33
33
  "devDependencies": {
34
34
  "@types/bun": "latest",
35
35
  "@types/semver": "^7.7.1",
36
- "bun_plugins": "^1.0.4",
37
36
  "typescript": "^5.0.0"
38
37
  },
39
38
  "dependencies": {
40
39
  "semver": "^7.7.3",
41
- "zod": "^3.23.0"
40
+ "zod": "^4.2.1"
42
41
  }
43
42
  }