@quark-fw/core 0.0.1 → 0.0.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.
- package/README.md +42 -0
- package/package.json +9 -5
package/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# @quark-fw/core
|
|
2
|
+
|
|
3
|
+
Core runtime of the Quark framework. Importing it creates the global `quark` object — a plugin host with a typed event emitter and lifecycle management.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm i @quark-fw/core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import "@quark-fw/core"; // creates globalThis.quark (idempotent)
|
|
15
|
+
|
|
16
|
+
await quark.registerPlugin({
|
|
17
|
+
name: "hello",
|
|
18
|
+
onInit() {
|
|
19
|
+
console.log("hello plugin initialized");
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
await quark.ready(); // resolves when all registered plugins are ready
|
|
24
|
+
// ...
|
|
25
|
+
await quark.destroy(); // runs onDestroy hooks in reverse order
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## What's on `quark`
|
|
29
|
+
|
|
30
|
+
- `quark.registerPlugin(plugin)` — registers a [`QuarkPlugin`](https://www.npmjs.com/package/@quark-fw/plugin); registrations are queued, `dependsOn` is enforced
|
|
31
|
+
- `quark.plugins` — loaded plugins
|
|
32
|
+
- `quark.ee` — an [atom](https://www.npmjs.com/package/@quark-fw/atom) holding the typed event emitter (`quark.ee.value.on/emit`)
|
|
33
|
+
- `quark.ready()` / `quark.destroy()` — lifecycle
|
|
34
|
+
|
|
35
|
+
Plugins extend `quark` and the global `Events` map through TypeScript declaration merging — see the `Quark` and `Events` interfaces shipped in this package's `global.d.ts`.
|
|
36
|
+
|
|
37
|
+
## Ecosystem
|
|
38
|
+
|
|
39
|
+
- [`@quark-fw/plugin`](https://www.npmjs.com/package/@quark-fw/plugin) — plugin contract + HTTP middleware registry
|
|
40
|
+
- [`@quark-fw/plugin-trpc`](https://www.npmjs.com/package/@quark-fw/plugin-trpc) — tRPC server plugin
|
|
41
|
+
- [`@quark-fw/store`](https://www.npmjs.com/package/@quark-fw/store) — isomorphic store + tRPC client hooks for React
|
|
42
|
+
- [`@quark-fw/entity`](https://www.npmjs.com/package/@quark-fw/entity) — CRUD entity layer over tRPC/Prisma
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quark-fw/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "Core runtime of the Quark framework: global quark object, lifecycle and typed event emitter",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -14,19 +14,23 @@
|
|
|
14
14
|
"./src/*": "./dist/*",
|
|
15
15
|
"./*": "./dist/*"
|
|
16
16
|
},
|
|
17
|
-
"files": [
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
18
20
|
"scripts": {
|
|
19
21
|
"dev": "tsx watch src/index.ts",
|
|
20
22
|
"build": "tsc -p tsconfig.build.json && node ../../scripts/postbuild.mjs"
|
|
21
23
|
},
|
|
22
|
-
"keywords": [
|
|
24
|
+
"keywords": [
|
|
25
|
+
"quark"
|
|
26
|
+
],
|
|
23
27
|
"author": "",
|
|
24
28
|
"license": "ISC",
|
|
25
29
|
"publishConfig": {
|
|
26
30
|
"access": "public"
|
|
27
31
|
},
|
|
28
32
|
"dependencies": {
|
|
29
|
-
"@quark-fw/atom": "0.0.
|
|
30
|
-
"@quark-fw/plugin": "0.0.
|
|
33
|
+
"@quark-fw/atom": "0.0.2",
|
|
34
|
+
"@quark-fw/plugin": "0.0.2"
|
|
31
35
|
}
|
|
32
36
|
}
|