@moku-labs/core 0.1.0-alpha.2 → 0.1.0-alpha.3
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 +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -230,7 +230,7 @@ Every field is optional. A plugin with only `api` works. A plugin with only `hoo
|
|
|
230
230
|
|
|
231
231
|
## Design Principles
|
|
232
232
|
|
|
233
|
-
**Brutal simplicity.** No classes. No decorators. No dependency injection. No inheritance.
|
|
233
|
+
**Brutal simplicity.** No classes. No decorators. No dependency injection. No inheritance. `createCoreConfig`, `createCore`, and `createPlugin` are pure factories. `createApp()` performs synchronous init. `app.start()` / `app.stop()` run the runtime lifecycle.
|
|
234
234
|
|
|
235
235
|
**Types over runtime.** Most of the codebase is type definitions and JSDoc. The type system provides autocomplete, compile-time validation, and documentation simultaneously.
|
|
236
236
|
|
|
@@ -268,13 +268,13 @@ Creates a plugin instance. Zero explicit generics — everything inferred from t
|
|
|
268
268
|
|
|
269
269
|
### createApp(options?)
|
|
270
270
|
|
|
271
|
-
Merges framework defaults with consumer options. Validates, resolves config, runs `onInit
|
|
271
|
+
Merges framework defaults with consumer options. Validates, resolves config, runs `onInit`, and returns `App` — a frozen object with plugin APIs mounted as properties. `createApp()` is synchronous and side-effectful within the init phase; it is not a lazy builder. `start()` / `stop()` are optional and mainly useful for apps with a distinct runtime phase. Lifecycle execution is non-transactional: start/stop errors propagate, they are not rolled back by the kernel.
|
|
272
272
|
|
|
273
273
|
### App
|
|
274
274
|
|
|
275
275
|
```typescript
|
|
276
|
-
await app.start(); // onStart (forward order)
|
|
277
|
-
await app.stop(); // onStop (reverse order)
|
|
276
|
+
await app.start(); // optional: onStart (forward order)
|
|
277
|
+
await app.stop(); // optional: onStop (reverse order)
|
|
278
278
|
app.emit('event', payload); // strictly typed, fire-and-forget
|
|
279
279
|
app.require(plugin); // returns typed API or throws
|
|
280
280
|
app.has('name'); // boolean, never throws
|