dsh-plugin-core-demo 0.0.0-stage → 0.0.1
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 +38 -2
- package/cordis.patch.yml +8 -0
- package/dist/client.js +3063 -0
- package/dist/index.js +10 -0
- package/package.json +51 -4
package/README.md
CHANGED
|
@@ -1,3 +1,39 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-plugin-core-demo
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
在 **真实 DSH 宿主**里预览 `dsh-plugin-core` 的控件与业务组件的插件。
|
|
4
|
+
|
|
5
|
+
它和库是完全分开的两个 npm 包(库是纯库,只有子路径导出;本包是插件):
|
|
6
|
+
|
|
7
|
+
| | 包 | 用途 |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| 库 | `dsh-plugin-core` | 各插件按子路径引用(`/ui` `/utils` `/design` …) |
|
|
10
|
+
| 插件 | `dsh-plugin-core-demo`(本包) | 装进 DSH,宿主内预览 |
|
|
11
|
+
|
|
12
|
+
## 构建
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# 在仓库根先构建库(本包引用 ../../dist/)
|
|
16
|
+
pnpm run build
|
|
17
|
+
# 再构建本包 → dist/index.js(server 壳)+ dist/client.js(预览页 bundle)
|
|
18
|
+
pnpm run build:demo
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
`dist/` 与 `src/` 一起入库:宿主安装插件时**不跑构建脚本**。
|
|
22
|
+
|
|
23
|
+
## 发布与安装
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm publish --access public # 在本目录
|
|
27
|
+
dsh plugin --profile web add dsh-plugin-core-demo
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
装好后:插件列表 → 本插件 → 设置页里的「组件预览」卡片 → 点开即整页预览;也可点侧栏图标。
|
|
31
|
+
|
|
32
|
+
## 实现要点
|
|
33
|
+
|
|
34
|
+
- client 侧只导出 `apply`;依赖一律 `ctx.inject([...], cb)` 内等待(顶层导出 `inject` 会卡死宿主启动)。
|
|
35
|
+
- 三块注册(`sidebar.panellist` / `main` / `settings.plugin.item`)各自 `ctx.inject`、自成一块;
|
|
36
|
+
`settings.plugin.item` 与 `main` 的 key 必须 = 包名(宿主机制)。
|
|
37
|
+
- 变量前缀用本插件独有的 `dshpc`,**不占用 `--tdt-*`**(宿主里别的插件在用);
|
|
38
|
+
展示代码里的 `--tdt-*` 由 `src/client/token-alias.ts` 那层别名接过去。
|
|
39
|
+
- 零运行时依赖:不引内部 `@deepseek-ai/*`,故不声明 schemastery Config。
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# bundle 补丁:把本 npm 包作为插件插入宿主组合。
|
|
2
|
+
# 格式与 dsh-task-dispatch-table/cordis.patch.yml 一致(顶层 YAML 数组,条目 = loader patch 的 insert 列表)。
|
|
3
|
+
# id / name 必须与 package.json 的 name 逐字相同(宿主用它判定插件详情页)。
|
|
4
|
+
# 本插件无服务端配置项,故 config 为空对象。
|
|
5
|
+
- insert:
|
|
6
|
+
- id: dsh-plugin-core-demo
|
|
7
|
+
name: dsh-plugin-core-demo
|
|
8
|
+
config: {}
|