@zhin.js/pagemanager 2.0.1 → 2.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.
Files changed (2) hide show
  1. package/README.md +66 -0
  2. package/package.json +12 -4
package/README.md ADDED
@@ -0,0 +1,66 @@
1
+ # @zhin.js/pagemanager
2
+
3
+ Remote Console **Node 侧运行时**:PageManager、EntryStore、`GET /entries`、esbuild 打包与 `/@dev` 开发资源路由。无 UI;契约在 `@zhin.js/contract`,浏览器 SDK 在 `@zhin.js/client`。
4
+
5
+ > **路径约定**:本包位于 `packages/console/pagemanager/`。源码在 `src/node/`,构建产物在 `lib/node/`。
6
+
7
+ ## 分层
8
+
9
+ 见 [Console 栈概览](../README.md):
10
+
11
+ ```
12
+ @zhin.js/contract → @zhin.js/pagemanager → @zhin.js/client → zhin-console(独立仓库)
13
+ ```
14
+
15
+ 领域术语与关系图见 **[CONTEXT.md](./CONTEXT.md)**。
16
+
17
+ ## 安装
18
+
19
+ Monorepo 内 workspace 依赖;对外发布时:
20
+
21
+ ```bash
22
+ pnpm add @zhin.js/pagemanager
23
+ ```
24
+
25
+ ## 主要导出
26
+
27
+ | 导出 | 用途 |
28
+ |------|------|
29
+ | `PageManager` | 控制台服务端运行时;拥有 EntryStore,注册 Console Entry |
30
+ | `mountConsoleRouter` | 挂载 entries 与静态/dev 资源路由 |
31
+ | `createInMemoryEntryStore` / `EntryStore` | Entry 目录 |
32
+ | `buildEntriesResponse` / `rewriteEntriesForClient` | 序列化 `GET /entries` 响应 |
33
+ | `attachConsoleClientHost` | 将 Console 路由挂到现有 Koa Host |
34
+ | `serverRuntimeEnv` | development / production 运行时标记 |
35
+
36
+ 类型(`ConsoleServerOptions`、`PluginServerRegisterHostApi` 等)自 `./consoleServerOptions.js` 导出。
37
+
38
+ ## 插件注册 Entry
39
+
40
+ 在插件 Node 侧通过 `web` 上下文获取 **PageManager 实例**(非静态全局):
41
+
42
+ ```typescript
43
+ useContext('web', (pageManager) => {
44
+ pageManager.addEntry({
45
+ id: 'my-plugin',
46
+ name: 'My Plugin',
47
+ dev: '/@dev/plugins/my-plugin/client/index.tsx',
48
+ prod: '/@assets/my-plugin/client/index.js',
49
+ });
50
+ });
51
+ ```
52
+
53
+ 浏览器侧由 `@zhin.js/client` 的 `loadConsoleEntries` 拉取并动态 `import`。
54
+
55
+ ## 构建
56
+
57
+ ```bash
58
+ pnpm --filter @zhin.js/pagemanager build
59
+ ```
60
+
61
+ ## 相关文档
62
+
63
+ - [Remote Console 使用说明](../../../docs/console-remote.md)
64
+ - [@zhin.js/contract](../contract/README.md)
65
+ - [@zhin.js/client](../client/README.md)
66
+ - [@zhin.js/host-api 管理面 API](../../host/api/README.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhin.js/pagemanager",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "Zhin PageManager Host runtime: entries, esbuild pipeline (no UI; contract in @zhin.js/contract)",
5
5
  "type": "module",
6
6
  "exports": {
@@ -17,18 +17,18 @@
17
17
  },
18
18
  "dependencies": {
19
19
  "@koa/router": "^15.6.0",
20
- "esbuild": "^0.28.0",
20
+ "esbuild": "^0.28.1",
21
21
  "koa": "^3.2.1",
22
22
  "koa-compose": "^4.1.0",
23
23
  "koa-static": "^5.0.0",
24
- "@zhin.js/contract": "1.0.1"
24
+ "@zhin.js/contract": "1.0.2"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/koa": "^3.0.3",
28
28
  "@types/koa-compose": "^3.2.9",
29
29
  "@types/koa-static": "^4.0.4",
30
30
  "@types/koa__router": "^12.0.4",
31
- "@types/node": "^25.9.1",
31
+ "@types/node": "^26.1.0",
32
32
  "rimraf": "^6.0.1",
33
33
  "typescript": "^6.0.2"
34
34
  },
@@ -41,6 +41,14 @@
41
41
  "url": "git+https://github.com/zhinjs/zhin.git",
42
42
  "directory": "packages/console/pagemanager"
43
43
  },
44
+ "engines": {
45
+ "node": "^20.19.0 || >=22.12.0"
46
+ },
47
+ "author": {
48
+ "name": "lc-cn",
49
+ "email": "admin@liucl.cn",
50
+ "url": "https://github.com/lc-cn"
51
+ },
44
52
  "scripts": {
45
53
  "build": "tsc -p tsconfig.json",
46
54
  "build:node": "tsc -p tsconfig.json",