mycelia-kernel-plugin 1.2.0 → 1.4.0
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/README.md +89 -6
- package/bin/cli.js +769 -3
- package/package.json +15 -5
- package/src/angular/builders.js +37 -0
- package/src/angular/helpers.js +102 -0
- package/src/angular/index.js +189 -0
- package/src/angular/services.js +32 -0
- package/src/builder/dependency-graph.js +65 -9
- package/src/builder/hook-processor.js +26 -4
- package/src/builder/utils.js +78 -22
- package/src/core/facet.js +16 -3
- package/src/index.js +18 -0
- package/src/manager/facet-manager.js +10 -2
- package/src/qwik/builders.js +39 -0
- package/src/qwik/index.js +178 -0
- package/src/qwik/listeners.js +96 -0
- package/src/qwik/queues.js +87 -0
- package/src/qwik/signals.js +32 -0
- package/src/react/README.md +3 -0
- package/src/solid/README.md +69 -0
- package/src/solid/index.js +387 -0
- package/src/svelte/builders.js +43 -0
- package/src/svelte/index.js +183 -0
- package/src/svelte/listeners.js +96 -0
- package/src/svelte/queues.js +114 -0
- package/src/svelte/stores.js +36 -0
- package/src/utils/instrumentation.js +204 -0
- package/src/utils/use-base.js +205 -30
- package/src/vue/builders.js +40 -0
- package/src/vue/composables.js +37 -0
- package/src/vue/index.js +252 -0
- package/src/vue/listeners.js +78 -0
- package/src/vue/queues.js +113 -0
package/README.md
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
# Mycelia Plugin System
|
|
2
2
|
|
|
3
|
-
A sophisticated,
|
|
3
|
+
A sophisticated, **framework-agnostic** plugin system with transaction safety, lifecycle management, and official bindings for React, Vue 3, Svelte, Angular, Qwik, and Solid.js.
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
Mycelia Plugin System is a standalone plugin architecture extracted from [Mycelia Kernel](https://github.com/lesfleursdelanuitdev/mycelia-kernel). It provides:
|
|
7
|
+
Mycelia Plugin System is a **framework-agnostic**, standalone plugin architecture extracted from [Mycelia Kernel](https://github.com/lesfleursdelanuitdev/mycelia-kernel). It provides:
|
|
8
8
|
|
|
9
|
+
- **Framework-agnostic** - Write domain logic once, use it with React, Vue, or any framework. Plugins are completely independent of UI frameworks
|
|
9
10
|
- **Hook-based composition** - Extend systems without modification
|
|
10
11
|
- **Dependency resolution** - Automatic topological sorting
|
|
11
12
|
- **Transaction safety** - Atomic installation with rollback
|
|
@@ -14,9 +15,24 @@ Mycelia Plugin System is a standalone plugin architecture extracted from [Myceli
|
|
|
14
15
|
- **Facet contracts** - Runtime validation of plugin interfaces
|
|
15
16
|
- **Standalone mode** - Works without message system or other dependencies
|
|
16
17
|
- **Built-in hooks** - Ships with `useListeners` for event-driven architectures (see [Simple Event System Example](#simple-event-system-example)), plus `useQueue` and `useSpeak`
|
|
18
|
+
- **Framework bindings** - Official bindings for [React](#react-bindings), [Vue 3](#vue-bindings), [Svelte](#svelte-bindings), [Angular](#angular-bindings), [Qwik](#qwik-bindings), and [Solid.js](#solidjs-bindings)
|
|
17
19
|
|
|
18
20
|
**Facets** are the concrete runtime capabilities produced by hooks and attached to the system.
|
|
19
21
|
|
|
22
|
+
### Framework Integration
|
|
23
|
+
|
|
24
|
+
The system is designed to be framework-agnostic. Your domain logic lives in Mycelia plugins, which can be used with any framework:
|
|
25
|
+
|
|
26
|
+
- **React** - Use `MyceliaProvider` and React hooks (`useFacet`, `useListener`)
|
|
27
|
+
- **Vue 3** - Use `MyceliaPlugin` and Vue composables (`useFacet`, `useListener`)
|
|
28
|
+
- **Svelte** - Use `setMyceliaSystem` and Svelte stores (`useFacet`, `useListener`)
|
|
29
|
+
- **Angular** - Use `MyceliaService` and RxJS observables (`useFacet`, `useListener`)
|
|
30
|
+
- **Qwik** - Use `MyceliaProvider` and Qwik signals (`useFacet`, `useListener`)
|
|
31
|
+
- **Solid.js** - Use `MyceliaProvider` and Solid.js signals (`useFacet`, `useListener`)
|
|
32
|
+
- **Vanilla JS/Node.js** - Use the system directly without any framework bindings
|
|
33
|
+
|
|
34
|
+
See the [React Todo App](./examples/react-todo/README.md), [Vue Todo App](./examples/vue-todo/README.md), [Svelte Todo App](./examples/svelte-todo/README.md), and [Solid.js Todo App](./examples/solid-todo/README.md) examples - they all use the **exact same plugin code**, demonstrating true framework independence.
|
|
35
|
+
|
|
20
36
|
## Quick Start
|
|
21
37
|
|
|
22
38
|
### Using useBase (Recommended)
|
|
@@ -62,6 +78,15 @@ const system = await useBase('my-app')
|
|
|
62
78
|
.use(useDatabase)
|
|
63
79
|
.build();
|
|
64
80
|
|
|
81
|
+
// Or configure multiple facets and hooks at once
|
|
82
|
+
const system = await useBase('my-app')
|
|
83
|
+
.configMultiple({
|
|
84
|
+
database: { host: 'localhost', port: 5432 },
|
|
85
|
+
cache: { ttl: 3600 }
|
|
86
|
+
})
|
|
87
|
+
.useMultiple([useDatabase, useCache])
|
|
88
|
+
.build();
|
|
89
|
+
|
|
65
90
|
// Use the plugin
|
|
66
91
|
const db = system.find('database');
|
|
67
92
|
await db.query('SELECT * FROM users');
|
|
@@ -271,7 +296,7 @@ StandalonePluginSystem
|
|
|
271
296
|
|
|
272
297
|
- **`createHook()`** - Create a plugin hook
|
|
273
298
|
- **`createFacetContract()`** - Create a facet contract
|
|
274
|
-
- **`useBase()`** - Fluent API builder for StandalonePluginSystem
|
|
299
|
+
- **`useBase()`** - Fluent API builder for StandalonePluginSystem (see [useBase Documentation](./docs/utils/USE-BASE.md))
|
|
275
300
|
|
|
276
301
|
### Utilities
|
|
277
302
|
|
|
@@ -282,10 +307,19 @@ StandalonePluginSystem
|
|
|
282
307
|
|
|
283
308
|
Comprehensive documentation is available in the [`docs/`](./docs/) directory:
|
|
284
309
|
|
|
310
|
+
### Quick Links
|
|
311
|
+
- **[useBase Guide](./docs/utils/USE-BASE.md)** - Complete guide to the fluent API builder with all methods
|
|
312
|
+
- **[Instrumentation](./docs/instrumentation.md)** - Debugging and performance instrumentation
|
|
313
|
+
|
|
314
|
+
### Full Documentation
|
|
285
315
|
- **[Getting Started Guide](./docs/getting-started/README.md)** - Quick start with examples
|
|
286
316
|
- **[Hooks and Facets Overview](./docs/core-concepts/HOOKS-AND-FACETS-OVERVIEW.md)** - Core concepts
|
|
287
317
|
- **[Built-in Hooks](./docs/hooks/README.md)** - Documentation for `useListeners`, `useQueue`, and `useSpeak`
|
|
288
|
-
- **[React Bindings](./docs/react/README.md)** - React integration utilities
|
|
318
|
+
- **[React Bindings](./docs/react/README.md)** - React integration utilities (`MyceliaProvider`, `useFacet`, `useListener`)
|
|
319
|
+
- **[Vue Bindings](./docs/vue/README.md)** - Vue 3 integration utilities (`MyceliaPlugin`, `useFacet`, `useListener`) ⭐
|
|
320
|
+
- **[Svelte Bindings](./docs/svelte/README.md)** - Svelte integration utilities (`setMyceliaSystem`, `useFacet`, `useListener`) ⭐
|
|
321
|
+
- **[Angular Bindings](./docs/angular/README.md)** - Angular integration utilities (`MyceliaService`, `useFacet`, `useListener`) ⭐
|
|
322
|
+
- **[Qwik Bindings](./docs/qwik/README.md)** - Qwik integration utilities (`MyceliaProvider`, `useFacet`, `useListener`) ⭐
|
|
289
323
|
- **[Standalone Plugin System](./docs/standalone/STANDALONE-PLUGIN-SYSTEM.md)** - Complete usage guide
|
|
290
324
|
- **[Documentation Index](./docs/README.md)** - Full documentation index
|
|
291
325
|
|
|
@@ -298,11 +332,41 @@ See the `examples/` directory for:
|
|
|
298
332
|
- Contract validation
|
|
299
333
|
- Hot reloading
|
|
300
334
|
- useBase fluent API
|
|
301
|
-
|
|
335
|
+
|
|
336
|
+
### Framework Integration Examples
|
|
337
|
+
|
|
338
|
+
- **[React Todo App](./examples/react-todo/README.md)** – A real-world example showing:
|
|
302
339
|
- Domain logic as a Mycelia facet (`useTodos` hook)
|
|
303
340
|
- Event-driven state synchronization (`todos:changed` events)
|
|
304
341
|
- React bindings (`MyceliaProvider`, `useFacet`, `useListener`)
|
|
305
342
|
|
|
343
|
+
- **[Vue Todo App](./examples/vue-todo/README.md)** ⭐ – A complete Vue 3 example demonstrating:
|
|
344
|
+
- **Framework-agnostic plugins** - Uses the same shared plugin code as the React example
|
|
345
|
+
- Event-driven state synchronization (`todos:changed` events)
|
|
346
|
+
- Vue 3 bindings (`MyceliaPlugin`, `useFacet`, `useListener`)
|
|
347
|
+
- Composition API integration with reactive state management
|
|
348
|
+
|
|
349
|
+
- **[Svelte Todo App](./examples/svelte-todo/README.md)** ⭐ – A complete Svelte example demonstrating:
|
|
350
|
+
- **[Solid.js Todo App](./examples/solid-todo/README.md)** ⭐ – A complete Solid.js example demonstrating:
|
|
351
|
+
- **Framework-agnostic plugins** - Uses the same shared plugin code as React, Vue, and Svelte examples
|
|
352
|
+
- Event-driven state synchronization (`todos:changed` events)
|
|
353
|
+
- Solid.js bindings (`MyceliaProvider`, `useFacet`, `useListener`)
|
|
354
|
+
- Signal-based reactivity with automatic updates
|
|
355
|
+
|
|
356
|
+
- **[Angular Todo App](./examples/angular-todo/README.md)** ⭐ – A complete Angular example demonstrating:
|
|
357
|
+
- **Framework-agnostic plugins** - Uses the same shared plugin code as React, Vue, and Svelte examples
|
|
358
|
+
- Event-driven state synchronization (`todos:changed` events)
|
|
359
|
+
- Angular bindings (`MyceliaService`, `useFacet`, `useListener`)
|
|
360
|
+
- RxJS observables for reactive state management
|
|
361
|
+
|
|
362
|
+
- **[Qwik Todo App](./examples/qwik-todo/README.md)** ⭐ – A complete Qwik example demonstrating:
|
|
363
|
+
- **Framework-agnostic plugins** - Uses the same shared plugin code as all other framework examples
|
|
364
|
+
- Event-driven state synchronization (`todos:changed` events)
|
|
365
|
+
- Qwik bindings (`MyceliaProvider`, `useFacet`, `useListener`)
|
|
366
|
+
- Qwik signals for reactive state management
|
|
367
|
+
|
|
368
|
+
All six examples use the **exact same Mycelia plugin code** from `examples/todo-shared/`, proving that plugins are truly framework-independent. Write your domain logic once, use it everywhere!
|
|
369
|
+
|
|
306
370
|
## CLI Tool
|
|
307
371
|
|
|
308
372
|
The package includes a CLI tool for scaffolding hooks, contracts, and projects:
|
|
@@ -314,14 +378,33 @@ npx mycelia-kernel-plugin create hook database
|
|
|
314
378
|
# Create a new contract
|
|
315
379
|
npx mycelia-kernel-plugin create contract database
|
|
316
380
|
|
|
317
|
-
# Initialize a new project
|
|
381
|
+
# Initialize a new project (vanilla JS)
|
|
318
382
|
npx mycelia-kernel-plugin init my-app
|
|
383
|
+
|
|
384
|
+
# Initialize a React project with Mycelia bindings
|
|
385
|
+
npx mycelia-kernel-plugin init react my-react-app
|
|
386
|
+
|
|
387
|
+
# Initialize a Vue 3 project with Mycelia bindings
|
|
388
|
+
npx mycelia-kernel-plugin init vue my-vue-app
|
|
389
|
+
|
|
390
|
+
# Initialize a Svelte project with Mycelia bindings
|
|
391
|
+
npx mycelia-kernel-plugin init svelte my-svelte-app
|
|
392
|
+
|
|
393
|
+
# Initialize an Angular project with Mycelia bindings
|
|
394
|
+
npx mycelia-kernel-plugin init angular my-angular-app
|
|
395
|
+
|
|
396
|
+
# Initialize a Qwik project with Mycelia bindings
|
|
397
|
+
npx mycelia-kernel-plugin init qwik my-qwik-app
|
|
398
|
+
|
|
399
|
+
# Initialize a Solid.js project with Mycelia bindings
|
|
400
|
+
npx mycelia-kernel-plugin init solid my-solid-app
|
|
319
401
|
```
|
|
320
402
|
|
|
321
403
|
Or install globally:
|
|
322
404
|
```bash
|
|
323
405
|
npm install -g mycelia-kernel-plugin
|
|
324
406
|
mycelia-kernel-plugin create hook database
|
|
407
|
+
mycelia-kernel-plugin init react my-react-app
|
|
325
408
|
```
|
|
326
409
|
|
|
327
410
|
## Testing
|