dougong 0.0.3 → 0.2.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 +14 -14
- package/package.json +10 -4
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ npm install dougong
|
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
```ts
|
|
18
|
-
import {
|
|
18
|
+
import { createHost, definePlugin, service } from "dougong"
|
|
19
19
|
|
|
20
20
|
const CLOCK = service<Clock>("app/clock")
|
|
21
21
|
|
|
@@ -33,19 +33,19 @@ const greeter = definePlugin({
|
|
|
33
33
|
},
|
|
34
34
|
})
|
|
35
35
|
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
await
|
|
36
|
+
const host = createHost({ name: "hello" })
|
|
37
|
+
host.install(greeter) // 安装顺序不决定启动顺序
|
|
38
|
+
host.install(clock)
|
|
39
|
+
await host.start() // 从声明推导拓扑,同层并发启动
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
-
六个原子:**Service**(稳定的一对一能力)、**
|
|
42
|
+
六个原子:**Service**(稳定的一对一能力)、**ExtensionPoint**(开放贡献集合)、**Event**(瞬时事实)、**Lifetime**(结构化所有权)、**Plugin**、**Host**。
|
|
43
43
|
|
|
44
44
|
三条核心保证:依赖与所有权**显式**写在声明里;每个语义只有**一条**正式路径;事务只暴露**已提交**状态。
|
|
45
45
|
|
|
46
46
|
### 环境要求
|
|
47
47
|
|
|
48
|
-
Node.js ≥ 22
|
|
48
|
+
Node.js ≥ 22;浏览器 / WebView 基线为 Chrome / Edge 119、Firefox 121、Safari 17.4,并提供 `Promise.withResolvers()`。显式 `.dispose()` 在全部基线上可用;`using` / `await using` 还要求运行时原生提供或应用预先 polyfill `Symbol.dispose` / `Symbol.asyncDispose`。Dougong 不修改全局对象。TypeScript 消费者需要:
|
|
49
49
|
|
|
50
50
|
```json
|
|
51
51
|
"lib": ["ES2024", "DOM", "DOM.Iterable", "ESNext.Disposable"]
|
|
@@ -64,7 +64,7 @@ npm install dougong
|
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
```ts
|
|
67
|
-
import {
|
|
67
|
+
import { createHost, definePlugin, service } from "dougong"
|
|
68
68
|
|
|
69
69
|
const CLOCK = service<Clock>("app/clock")
|
|
70
70
|
|
|
@@ -82,19 +82,19 @@ const greeter = definePlugin({
|
|
|
82
82
|
},
|
|
83
83
|
})
|
|
84
84
|
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
await
|
|
85
|
+
const host = createHost({ name: "hello" })
|
|
86
|
+
host.install(greeter) // install order does not decide start order
|
|
87
|
+
host.install(clock)
|
|
88
|
+
await host.start() // topology derived from declarations, layers start concurrently
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
-
Six atoms: **Service** (a stable one-to-one capability), **
|
|
91
|
+
Six atoms: **Service** (a stable one-to-one capability), **ExtensionPoint** (an open contribution set), **Event** (a transient fact), **Lifetime** (structured ownership), **Plugin**, **Host**.
|
|
92
92
|
|
|
93
93
|
Three core guarantees: dependencies and ownership are written **explicitly** in declarations; every semantic has exactly **one** canonical path; transactions expose only **committed** state.
|
|
94
94
|
|
|
95
95
|
### Requirements
|
|
96
96
|
|
|
97
|
-
Node.js ≥ 22 or
|
|
97
|
+
Node.js ≥ 22; Chrome / Edge 119, Firefox 121 or Safari 17.4 for browsers and WebViews, with `Promise.withResolvers()`. Explicit `.dispose()` works throughout; `using` / `await using` additionally require native or application-polyfilled `Symbol.dispose` / `Symbol.asyncDispose`. Dougong does not mutate globals. TypeScript consumers need:
|
|
98
98
|
|
|
99
99
|
```json
|
|
100
100
|
"lib": ["ES2024", "DOM", "DOM.Iterable", "ESNext.Disposable"]
|
package/package.json
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dougong",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22"
|
|
7
7
|
},
|
|
8
|
+
"browserslist": [
|
|
9
|
+
"Chrome >= 119",
|
|
10
|
+
"Edge >= 119",
|
|
11
|
+
"Firefox >= 121",
|
|
12
|
+
"Safari >= 17.4"
|
|
13
|
+
],
|
|
8
14
|
"sideEffects": false,
|
|
9
15
|
"files": [
|
|
10
16
|
"dist",
|
|
@@ -18,9 +24,9 @@
|
|
|
18
24
|
}
|
|
19
25
|
},
|
|
20
26
|
"dependencies": {
|
|
21
|
-
"@dougongjs/core": "0.0
|
|
22
|
-
"@dougongjs/
|
|
23
|
-
"@dougongjs/
|
|
27
|
+
"@dougongjs/core": "0.2.0",
|
|
28
|
+
"@dougongjs/platform": "0.2.0",
|
|
29
|
+
"@dougongjs/reactive": "0.2.0"
|
|
24
30
|
},
|
|
25
31
|
"description": "Capability composition and structured lifetime kernel, plus its plugin distribution layer.",
|
|
26
32
|
"license": "MIT",
|