dsh-modpack-kit 0.2.4 → 0.3.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 +26 -27
- package/annotate/index.mjs +62 -0
- package/annotate/manifest.json +18 -0
- package/client.js +1650 -211
- package/community/README.md +34 -0
- package/community/index.mjs +29 -0
- package/community/manifest.json +22 -0
- package/docs/ANNOTATIONS.md +60 -0
- package/docs/CODE-MAP.md +431 -272
- package/docs/DETAIL.md +30 -166
- package/docs/MARKET.txt +2 -2
- package/index.js +422 -7
- package/lib/annotate.mjs +172 -0
- package/lib/classify.mjs +11 -0
- package/lib/community.mjs +11 -0
- package/lib/compat.mjs +11 -0
- package/lib/github.mjs +11 -0
- package/lib/groups.mjs +12 -0
- package/lib/http.mjs +10 -0
- package/lib/install.mjs +12 -0
- package/lib/manifest.mjs +12 -0
- package/lib/market-catalog.mjs +12 -0
- package/lib/modpack-catalog.mjs +11 -0
- package/lib/net.mjs +11 -0
- package/lib/pack.mjs +12 -0
- package/lib/plugin-graph.mjs +461 -0
- package/lib/plugin-manager.mjs +557 -0
- package/lib/profile.mjs +12 -0
- package/lib/registry.mjs +12 -0
- package/lib/repack.mjs +11 -0
- package/lib/scan.mjs +12 -0
- package/lib/semver.mjs +10 -0
- package/lib/store.mjs +38 -0
- package/lib/subplugins.mjs +141 -0
- package/lib/tar.mjs +10 -0
- package/lib/testmode.mjs +102 -0
- package/lib/theme.mjs +186 -0
- package/lib/yamlish.mjs +11 -0
- package/lib/zip.mjs +12 -0
- package/locale/en.json +1 -1
- package/locale/zh.json +2 -2
- package/package.json +5 -2
- package/plugin-tree/index.mjs +74 -0
- package/plugin-tree/manifest.json +23 -0
package/docs/CODE-MAP.md
CHANGED
|
@@ -7,9 +7,12 @@
|
|
|
7
7
|
## 0. 结构一句话
|
|
8
8
|
|
|
9
9
|
```
|
|
10
|
-
index.js Host 侧:
|
|
11
|
-
client.js 客户端:打包 / 安装·导入 / 社区资源 / 设置与记录 + 悬浮进度窗
|
|
10
|
+
index.js Host 侧:44 条路由 + 打包/安装/社区资源/插件管理编排 + 任务队列
|
|
11
|
+
client.js 客户端:打包 / 安装·导入 / 社区资源 / 插件管理 / 设置与记录 + 插件树浮层 + 悬浮进度窗
|
|
12
12
|
lib/*.mjs 纯逻辑(无 Cordis 依赖,可单独 node 跑)
|
|
13
|
+
community/ 附属小插件「社区资源」:自己的 manifest.json + index.mjs(9 条接口)
|
|
14
|
+
annotate/ 附属小插件「代码标注」:读全仓 @file 标注、跑自检(2 条接口)
|
|
15
|
+
plugin-tree/ 附属小插件「插件树」:插件树与兼容树(2 条接口)
|
|
13
16
|
assets/install-stub.mjs 打进包里的独立安装器(裸 DSH 用)
|
|
14
17
|
test/*.mjs 单元 / 宿主集成 / 联网 / 假 React 渲染
|
|
15
18
|
dev/tools/*.mjs 一次性验证工具(基准、矩阵、沙箱、同步、校验、代码地图)
|
|
@@ -20,6 +23,8 @@ docs/DETAIL.md 插件详情页正文(locale 的 meta.detail 指向它)
|
|
|
20
23
|
|
|
21
24
|
| 想改什么 | 先看 | 关键符号 | 常用 grep |
|
|
22
25
|
| --- | --- | --- | --- |
|
|
26
|
+
| 测试模式(只走流程) | `lib/testmode.mjs` | `testModeOn`、`playTestJob`、`testStepsFor` | `grep -n "function playTestJob" lib/testmode.mjs` |
|
|
27
|
+
| 配色 / 主题 | `lib/theme.mjs` | `THEME_PRESETS`、`themeOf`、`themeVars` | `grep -n "function themeVars" lib/theme.mjs` |
|
|
23
28
|
| 打包流程 / 三种策略 | `lib/pack.mjs` | `buildPack`、`strategy`、`embedded`、`tick` | `grep -n "function buildPack" lib/pack.mjs` |
|
|
24
29
|
| 包格式 / 清单字段 | `lib/manifest.mjs` | `buildManifest`、`normalizeManifest`、`normalizePlugin`、`buildReadme` | `grep -n "normalizePlugin" lib/manifest.mjs` |
|
|
25
30
|
| 安装(市场版优先 / 回退) | `lib/install.mjs` | `installPack`、`installSpec`、`preferMarketSpec`、`applyMarketGroups` | `grep -n "preferMarketSpec" lib/install.mjs` |
|
|
@@ -35,61 +40,99 @@ docs/DETAIL.md 插件详情页正文(locale 的 meta.detail 指向它)
|
|
|
35
40
|
| 进度窗 / 任务队列 | `client.js` + `index.js` | `JobDock`、`clampDockPos`、`useJobs`;`createJob`、`pruneJobs`、`performPack` | `grep -n "function JobDock" client.js` |
|
|
36
41
|
| 打包策略可用性判定 | `index.js` | `computePlan`、`versionOf` | `grep -n "function computePlan" index.js` |
|
|
37
42
|
| 分组读写 / 重名避让 | `lib/groups.mjs` | `readMarketGroups`、`groupViews`、`applyMarketGroups` | `grep -n "applyMarketGroups" lib/groups.mjs` |
|
|
43
|
+
| 插件管理(列表 / 开关 / 更新 / 重装) | `lib/plugin-manager.mjs` + `client.js` | `listManaged`、`setPluginEnabled`、`reinstallPlugin`;`PluginManagerPanel` | `grep -n "function PluginManagerPanel" client.js` |
|
|
44
|
+
| 一键更新(跳过停用与按路径装) | `lib/plugin-manager.mjs` + `index.js` + `client.js` | `updatableItems`、`updatePlugins`;`/plugins/update-all`;`bulkReady`、`askBulk` | `grep -n "plugins/update-all" index.js` |
|
|
45
|
+
| 插件行首图标 / 放大预览 | `lib/plugin-manager.mjs` + `index.js` + `client.js` | `pluginIcon`、`ICON_FILES`;`/plugins/icon`;`icons`、`setZoomIcon` | `grep -n "function pluginIcon" lib/plugin-manager.mjs` |
|
|
46
|
+
| 附属小插件清单(谁属于谁) | `lib/subplugins.mjs` + `client.js` | `SUBPLUGINS`、`listSubplugins`、`subEnabled`;`SubpluginList`、`SubpluginCard` | `grep -n "SUBPLUGINS" lib/subplugins.mjs` |
|
|
47
|
+
| 附属小插件的接口表 | `community/`、`annotate/`、`plugin-tree/` | 各自的 `manifest.json` 与 `index.mjs`(导出 `*Routes()`) | `grep -n "routes" annotate/index.mjs` |
|
|
48
|
+
| 代码标注 / 自检 | `lib/annotate.mjs` | `parseAnnotation`、`collectAnnotations`、`checkAnnotations` | `grep -n "function checkAnnotations" lib/annotate.mjs` |
|
|
49
|
+
| 插件树 / 兼容树(勾哪个看哪个) | `lib/plugin-graph.mjs` + `plugin-tree/` + `client.js` | `listTreeCandidates`、`buildRelations`、`compatOf`、`versionVerdict`;`PluginTreeOverlay` | `grep -n "function buildRelations" lib/plugin-graph.mjs` |
|
|
50
|
+
| 一键上传(GitHub) | `lib/github.mjs` | `whoAmI`、`ensureRelease`、`uploadReleaseAsset`、`openPackPullRequest` | `grep -n "function openPackPullRequest" lib/github.mjs` |
|
|
38
51
|
| 网络与主机白名单 | `lib/net.mjs` | `requestJson`、`requestBuffer`、`curlOnce` | `grep -n "function requestJson" lib/net.mjs` |
|
|
39
52
|
| 设置项默认值 | `lib/store.mjs` | `DEFAULT_CONFIG`、`clampConfig`、`loadConfig` | `grep -n "DEFAULT_CONFIG" lib/store.mjs` |
|
|
40
53
|
|
|
41
|
-
## 2. 路由表(`index.js`,共
|
|
54
|
+
## 2. 路由表(`index.js`,共 44 条)
|
|
42
55
|
|
|
43
56
|
| 路由 | 行 |
|
|
44
57
|
| --- | --- |
|
|
45
|
-
| `status` |
|
|
46
|
-
| `settings` |
|
|
47
|
-
| `catalog` |
|
|
48
|
-
| `catalog/status` |
|
|
49
|
-
| `catalog/lookup` |
|
|
50
|
-
| `catalog/sync` |
|
|
51
|
-
| `catalog/search` |
|
|
52
|
-
| `market` |
|
|
53
|
-
| `market/search` |
|
|
54
|
-
| `market/sync` |
|
|
55
|
-
| `upload/status` |
|
|
56
|
-
| `upload/token` |
|
|
57
|
-
| `upload/preview` |
|
|
58
|
-
| `upload/submit` |
|
|
59
|
-
| `market/preview` |
|
|
60
|
-
| `market/download` |
|
|
61
|
-
| `versions` |
|
|
62
|
-
| `pack/plan` |
|
|
63
|
-
| `plugin/install` |
|
|
64
|
-
| `
|
|
65
|
-
| `
|
|
66
|
-
| `
|
|
67
|
-
| `
|
|
68
|
-
| `
|
|
69
|
-
| `
|
|
70
|
-
| `
|
|
71
|
-
| `
|
|
72
|
-
| `
|
|
73
|
-
| `
|
|
74
|
-
| `
|
|
75
|
-
| `
|
|
76
|
-
| `
|
|
77
|
-
| `
|
|
78
|
-
| `
|
|
79
|
-
| `
|
|
80
|
-
| `
|
|
81
|
-
| `
|
|
82
|
-
| `
|
|
58
|
+
| `status` | 432 |
|
|
59
|
+
| `settings` | 438 |
|
|
60
|
+
| `catalog` | 468 |
|
|
61
|
+
| `catalog/status` | 478 |
|
|
62
|
+
| `catalog/lookup` | 490 |
|
|
63
|
+
| `catalog/sync` | 501 |
|
|
64
|
+
| `catalog/search` | 512 |
|
|
65
|
+
| `market` | 547 |
|
|
66
|
+
| `market/search` | 565 |
|
|
67
|
+
| `market/sync` | 589 |
|
|
68
|
+
| `upload/status` | 603 |
|
|
69
|
+
| `upload/token` | 620 |
|
|
70
|
+
| `upload/preview` | 646 |
|
|
71
|
+
| `upload/submit` | 724 |
|
|
72
|
+
| `market/preview` | 974 |
|
|
73
|
+
| `market/download` | 1017 |
|
|
74
|
+
| `versions` | 1104 |
|
|
75
|
+
| `pack/plan` | 1414 |
|
|
76
|
+
| `plugin/install` | 1426 |
|
|
77
|
+
| `plugins` | 1474 |
|
|
78
|
+
| `plugins/toggle` | 1483 |
|
|
79
|
+
| `plugins/reveal` | 1505 |
|
|
80
|
+
| `plugins/icon` | 1517 |
|
|
81
|
+
| `plugins/update-all` | 1534 |
|
|
82
|
+
| `plugins/reinstall` | 1621 |
|
|
83
|
+
| `pack` | 1706 |
|
|
84
|
+
| `jobs/ack` | 1734 |
|
|
85
|
+
| `jobs/dismiss` | 1769 |
|
|
86
|
+
| `jobs/clear` | 1782 |
|
|
87
|
+
| `jobs/cancel` | 1801 |
|
|
88
|
+
| `jobs` | 1824 |
|
|
89
|
+
| `download` | 1831 |
|
|
90
|
+
| `save` | 1859 |
|
|
91
|
+
| `packs` | 1903 |
|
|
92
|
+
| `packs/open` | 1919 |
|
|
93
|
+
| `packs/remove` | 1934 |
|
|
94
|
+
| `pack/drop` | 1963 |
|
|
95
|
+
| `inspect` | 2028 |
|
|
96
|
+
| `install` | 2241 |
|
|
97
|
+
| `install/replace` | 2254 |
|
|
98
|
+
| `history` | 2280 |
|
|
99
|
+
| `history/clear` | 2286 |
|
|
100
|
+
| `history/remove` | 2292 |
|
|
101
|
+
| `plugin-summary` | 2300 |
|
|
83
102
|
|
|
84
103
|
> 全部挂在 `/dsh-modpack-kit/api/` 下;路由体统一 `if (!needPost(req, res)) return` + `await readJsonBody(req)`,不要再写 `fenced()`。
|
|
85
104
|
|
|
105
|
+
### 附属小插件声明的接口(14 条)
|
|
106
|
+
|
|
107
|
+
| 附属小插件 | 开关键 | 路由 |
|
|
108
|
+
| --- | --- | --- |
|
|
109
|
+
| `dsh-modpack-community` | `常开` | `market` |
|
|
110
|
+
| `dsh-modpack-community` | `常开` | `market/search` |
|
|
111
|
+
| `dsh-modpack-community` | `常开` | `market/sync` |
|
|
112
|
+
| `dsh-modpack-community` | `常开` | `market/download` |
|
|
113
|
+
| `dsh-modpack-community` | `常开` | `market/preview` |
|
|
114
|
+
| `dsh-modpack-community` | `常开` | `upload/status` |
|
|
115
|
+
| `dsh-modpack-community` | `常开` | `upload/token` |
|
|
116
|
+
| `dsh-modpack-community` | `常开` | `upload/preview` |
|
|
117
|
+
| `dsh-modpack-community` | `常开` | `upload/submit` |
|
|
118
|
+
| `dsh-modpack-annotate` | `showAnnotate` | `annotate/tree` |
|
|
119
|
+
| `dsh-modpack-annotate` | `showAnnotate` | `annotate/check` |
|
|
120
|
+
| `dsh-modpack-plugin-tree` | `showPluginTree` | `tree/plugins` |
|
|
121
|
+
| `dsh-modpack-plugin-tree` | `showPluginTree` | `tree/plugin` |
|
|
122
|
+
| `dsh-modpack-plugin-tree` | `showPluginTree` | `tree/compat` |
|
|
123
|
+
|
|
124
|
+
> 关掉某个附属小插件时,它这几条统一回 404(`subRoute` / `mountSubRoutes` 保证),主体照常。
|
|
125
|
+
|
|
126
|
+
|
|
86
127
|
## 3. 文件职责与符号
|
|
87
128
|
|
|
88
|
-
### `index.js`(
|
|
129
|
+
### `index.js`(2389 行)
|
|
89
130
|
|
|
90
131
|
Host 侧:所有 HTTP 路由、打包/安装/市场编排、任务队列与进度
|
|
91
132
|
|
|
92
|
-
|
|
133
|
+
- `runtimeFreshness` L60
|
|
134
|
+
|
|
135
|
+
### `client.js`(5300 行)
|
|
93
136
|
|
|
94
137
|
客户端:打包 / 安装·导入 / 社区资源 / 设置与记录 四块界面 + 悬浮进度窗
|
|
95
138
|
|
|
@@ -106,307 +149,420 @@ Host 侧:所有 HTTP 路由、打包/安装/市场编排、任务队列与进
|
|
|
106
149
|
- `restoreGroups` L335
|
|
107
150
|
- `restoreData` L399
|
|
108
151
|
|
|
109
|
-
### `lib/
|
|
152
|
+
### `lib/annotate.mjs`(173 行)
|
|
110
153
|
|
|
111
|
-
|
|
154
|
+
代码标注协议:解析每个源文件头部的 @file/@role/… 块,跑全仓自检
|
|
112
155
|
|
|
113
|
-
- `
|
|
114
|
-
- `
|
|
115
|
-
- `
|
|
116
|
-
- `
|
|
156
|
+
- `ANNOTATE_KEYS` L17(导出常量)
|
|
157
|
+
- `REQUIRED_KEYS` L20(导出常量)
|
|
158
|
+
- `splitList` L25
|
|
159
|
+
- `parseAnnotation` L36(导出)
|
|
160
|
+
- `readAnnotation` L84(导出)
|
|
161
|
+
- `walk` L96
|
|
162
|
+
- `runtimeFiles` L116(导出)
|
|
163
|
+
- `collectAnnotations` L128(导出)
|
|
164
|
+
- `checkAnnotations` L163(导出)
|
|
117
165
|
|
|
118
|
-
### `lib/
|
|
166
|
+
### `lib/classify.mjs`(117 行)
|
|
119
167
|
|
|
168
|
+
把插件名/描述映射到插件市场的 23 个分类(纯字符串匹配)
|
|
120
169
|
|
|
170
|
+
- `CATEGORIES` L23(导出常量)
|
|
171
|
+
- `hit` L62
|
|
172
|
+
- `classifyPlugin` L78(导出)
|
|
173
|
+
- `categoryLabel` L114(导出)
|
|
121
174
|
|
|
122
|
-
|
|
123
|
-
- `COMMUNITY_API` L13(导出常量)
|
|
124
|
-
- `readBuiltinManifest` L17(导出)
|
|
125
|
-
- `readExternal` L25
|
|
126
|
-
- `resolveCommunity` L42(导出)
|
|
175
|
+
### `lib/community.mjs`(78 行)
|
|
127
176
|
|
|
128
|
-
|
|
177
|
+
附属小插件「社区资源」的登记与开关解析(内置清单 / 外部实现 / 是否启用)
|
|
129
178
|
|
|
130
|
-
|
|
179
|
+
- `COMMUNITY_ID` L23(导出常量)
|
|
180
|
+
- `COMMUNITY_API` L24(导出常量)
|
|
181
|
+
- `readBuiltinManifest` L28(导出)
|
|
182
|
+
- `readExternal` L36
|
|
183
|
+
- `resolveCommunity` L53(导出)
|
|
131
184
|
|
|
132
|
-
|
|
133
|
-
- `checkCompatibility` L21(导出)
|
|
185
|
+
### `lib/compat.mjs`(125 行)
|
|
134
186
|
|
|
135
|
-
|
|
187
|
+
兼容性判定:peer 依赖、engines、license、版本差异;按打包策略给不同建议
|
|
136
188
|
|
|
189
|
+
- `versionOf` L23
|
|
190
|
+
- `checkCompatibility` L32(导出)
|
|
137
191
|
|
|
192
|
+
### `lib/github.mjs`(301 行)
|
|
138
193
|
|
|
139
|
-
|
|
140
|
-
- `gh` L30(导出)
|
|
141
|
-
- `whoAmI` L71(导出)
|
|
142
|
-
- `ensureFork` L77(导出)
|
|
143
|
-
- `openPackPullRequest` L103(导出)
|
|
144
|
-
- `entryFileName` L184(导出)
|
|
145
|
-
- `packFileName` L190(导出)
|
|
146
|
-
- `runRaw` L195
|
|
147
|
-
- `parseStatus` L208
|
|
148
|
-
- `ensureRelease` L219(导出)
|
|
149
|
-
- `uploadReleaseAsset` L241(导出)
|
|
194
|
+
GitHub 写接口:fork、Release 资产、改词条、开 PR(一键上传)
|
|
150
195
|
|
|
151
|
-
|
|
196
|
+
- `run` L25
|
|
197
|
+
- `gh` L41(导出)
|
|
198
|
+
- `whoAmI` L82(导出)
|
|
199
|
+
- `ensureFork` L88(导出)
|
|
200
|
+
- `openPackPullRequest` L114(导出)
|
|
201
|
+
- `entryFileName` L195(导出)
|
|
202
|
+
- `packFileName` L201(导出)
|
|
203
|
+
- `runRaw` L206
|
|
204
|
+
- `parseStatus` L219
|
|
205
|
+
- `ensureRelease` L230(导出)
|
|
206
|
+
- `uploadReleaseAsset` L252(导出)
|
|
207
|
+
|
|
208
|
+
### `lib/groups.mjs`(160 行)
|
|
152
209
|
|
|
153
210
|
读插件市场的分组(.dsh-market/state.json),装完后并入/重名避让
|
|
154
211
|
|
|
155
|
-
- `marketStatePath`
|
|
156
|
-
- `stringList`
|
|
157
|
-
- `readMarketGroups`
|
|
158
|
-
- `groupViews`
|
|
159
|
-
- `hasMarket`
|
|
160
|
-
- `applyMarketGroups`
|
|
212
|
+
- `marketStatePath` L28(导出)
|
|
213
|
+
- `stringList` L32
|
|
214
|
+
- `readMarketGroups` L46(导出)
|
|
215
|
+
- `groupViews` L74(导出)
|
|
216
|
+
- `hasMarket` L89(导出)
|
|
217
|
+
- `applyMarketGroups` L106(导出)
|
|
161
218
|
|
|
162
|
-
### `lib/http.mjs`(
|
|
219
|
+
### `lib/http.mjs`(52 行)
|
|
163
220
|
|
|
164
221
|
读请求体、发 JSON 响应、needPost 等方法判定
|
|
165
222
|
|
|
166
|
-
- `MAX_JSON_BODY`
|
|
167
|
-
- `MAX_DROP_BODY`
|
|
168
|
-
- `sendJson`
|
|
169
|
-
- `readBody`
|
|
170
|
-
- `readRawBody`
|
|
171
|
-
- `readJsonBody`
|
|
172
|
-
- `asJson`
|
|
223
|
+
- `MAX_JSON_BODY` L17(导出常量)
|
|
224
|
+
- `MAX_DROP_BODY` L19(导出常量)
|
|
225
|
+
- `sendJson` L21(导出)
|
|
226
|
+
- `readBody` L42(导出常量)
|
|
227
|
+
- `readRawBody` L44(导出常量)
|
|
228
|
+
- `readJsonBody` L47(导出常量)
|
|
229
|
+
- `asJson` L49(导出)
|
|
173
230
|
|
|
174
|
-
### `lib/install.mjs`(
|
|
231
|
+
### `lib/install.mjs`(713 行)
|
|
175
232
|
|
|
176
233
|
读包 → 扫描 → 按策略装(市场版优先 / 包内副本回退)→ 回填配置与分组
|
|
177
234
|
|
|
178
|
-
- `inspectPackBuffer`
|
|
179
|
-
- `readPackFromUrl`
|
|
180
|
-
- `pluginPayload`
|
|
181
|
-
- `materializePayload`
|
|
182
|
-
- `packDirOf`
|
|
183
|
-
- `installPack`
|
|
235
|
+
- `inspectPackBuffer` L65(导出)
|
|
236
|
+
- `readPackFromUrl` L138(导出)
|
|
237
|
+
- `pluginPayload` L146
|
|
238
|
+
- `materializePayload` L155(导出)
|
|
239
|
+
- `packDirOf` L178
|
|
240
|
+
- `installPack` L191(导出)
|
|
184
241
|
|
|
185
|
-
### `lib/manifest.mjs`(
|
|
242
|
+
### `lib/manifest.mjs`(238 行)
|
|
186
243
|
|
|
187
244
|
dsh-modpack.json 的构造、归一化、校验与包内 README 生成
|
|
188
245
|
|
|
189
|
-
- `SCHEMA`
|
|
190
|
-
- `KIND`
|
|
191
|
-
- `MANIFEST_NAME`
|
|
192
|
-
- `sha256`
|
|
193
|
-
- `shortHash`
|
|
194
|
-
- `normalizePlugin`
|
|
195
|
-
- `normalizeManifest`
|
|
196
|
-
- `buildReadme`
|
|
246
|
+
- `SCHEMA` L21(导出常量)
|
|
247
|
+
- `KIND` L22(导出常量)
|
|
248
|
+
- `MANIFEST_NAME` L23(导出常量)
|
|
249
|
+
- `sha256` L25(导出常量)
|
|
250
|
+
- `shortHash` L26(导出常量)
|
|
251
|
+
- `normalizePlugin` L32
|
|
252
|
+
- `normalizeManifest` L97(导出)
|
|
253
|
+
- `buildReadme` L160(导出)
|
|
197
254
|
|
|
198
|
-
### `lib/market-catalog.mjs`(
|
|
255
|
+
### `lib/market-catalog.mjs`(436 行)
|
|
199
256
|
|
|
200
257
|
插件市场目录(分类 + 分页搜索 + 已装优先),数据源是 npm 包 dsh-plugin-catalog
|
|
201
258
|
|
|
202
|
-
- `CATEGORY_FALLBACK`
|
|
203
|
-
- `CATALOG_SOURCES`
|
|
204
|
-
- `PAGE_SIZE_DEFAULT`
|
|
205
|
-
- `catalogPaths`
|
|
206
|
-
- `categoriesOf`
|
|
207
|
-
- `normalizePlugin`
|
|
208
|
-
- `buildIndex`
|
|
209
|
-
- `readIndex`
|
|
210
|
-
- `writeIndex`
|
|
211
|
-
- `catalogSummary`
|
|
212
|
-
- `fetchSource`
|
|
213
|
-
- `syncCatalog`
|
|
214
|
-
- `relevance`
|
|
215
|
-
- `searchCatalog`
|
|
216
|
-
- `categoryMapFor`
|
|
217
|
-
- `lookupPlugins`
|
|
218
|
-
|
|
219
|
-
### `lib/modpack-catalog.mjs`(
|
|
259
|
+
- `CATEGORY_FALLBACK` L35(导出常量)
|
|
260
|
+
- `CATALOG_SOURCES` L62(导出常量)
|
|
261
|
+
- `PAGE_SIZE_DEFAULT` L67(导出常量)
|
|
262
|
+
- `catalogPaths` L72(导出)
|
|
263
|
+
- `categoriesOf` L80(导出)
|
|
264
|
+
- `normalizePlugin` L97
|
|
265
|
+
- `buildIndex` L133(导出)
|
|
266
|
+
- `readIndex` L153(导出)
|
|
267
|
+
- `writeIndex` L177(导出)
|
|
268
|
+
- `catalogSummary` L185(导出)
|
|
269
|
+
- `fetchSource` L214
|
|
270
|
+
- `syncCatalog` L229(导出)
|
|
271
|
+
- `relevance` L258
|
|
272
|
+
- `searchCatalog` L298(导出)
|
|
273
|
+
- `categoryMapFor` L404(导出)
|
|
274
|
+
- `lookupPlugins` L416(导出)
|
|
275
|
+
|
|
276
|
+
### `lib/modpack-catalog.mjs`(394 行)
|
|
220
277
|
|
|
221
278
|
社区资源目录(自建仓库 packs.json):同步、缓存、检索、取包
|
|
222
279
|
|
|
223
|
-
- `MARKET_REPO`
|
|
224
|
-
- `MARKET_BRANCH`
|
|
225
|
-
- `MARKET_SOURCES`
|
|
226
|
-
- `CATEGORY_FALLBACK`
|
|
227
|
-
- `TIER_BANDS`
|
|
228
|
-
- `tierOf`
|
|
229
|
-
- `marketPaths`
|
|
230
|
-
- `readCache`
|
|
231
|
-
- `writeCache`
|
|
232
|
-
- `normalizeCatalog`
|
|
233
|
-
- `sourceBaseOf`
|
|
234
|
-
- `packFileUrl`
|
|
235
|
-
- `marketSummary`
|
|
236
|
-
- `syncMarket`
|
|
237
|
-
- `installedState`
|
|
238
|
-
- `relevance`
|
|
239
|
-
- `searchMarket`
|
|
240
|
-
- `fetchMarketPack`
|
|
241
|
-
- `findMarketPack`
|
|
242
|
-
|
|
243
|
-
### `lib/net.mjs`(
|
|
280
|
+
- `MARKET_REPO` L42(导出常量)
|
|
281
|
+
- `MARKET_BRANCH` L43(导出常量)
|
|
282
|
+
- `MARKET_SOURCES` L45(导出常量)
|
|
283
|
+
- `CATEGORY_FALLBACK` L54(导出常量)
|
|
284
|
+
- `TIER_BANDS` L67(导出常量)
|
|
285
|
+
- `tierOf` L74(导出)
|
|
286
|
+
- `marketPaths` L80(导出)
|
|
287
|
+
- `readCache` L88
|
|
288
|
+
- `writeCache` L112
|
|
289
|
+
- `normalizeCatalog` L126
|
|
290
|
+
- `sourceBaseOf` L202
|
|
291
|
+
- `packFileUrl` L207(导出)
|
|
292
|
+
- `marketSummary` L219(导出)
|
|
293
|
+
- `syncMarket` L253(导出)
|
|
294
|
+
- `installedState` L289
|
|
295
|
+
- `relevance` L297
|
|
296
|
+
- `searchMarket` L321(导出)
|
|
297
|
+
- `fetchMarketPack` L374(导出)
|
|
298
|
+
- `findMarketPack` L387(导出)
|
|
299
|
+
|
|
300
|
+
### `lib/net.mjs`(179 行)
|
|
244
301
|
|
|
245
302
|
网络层:https 白名单、逐跳校验、体积上限、重试、curl 兜底
|
|
246
303
|
|
|
247
|
-
- `NET_DEFAULTS`
|
|
248
|
-
- `assertAllowedUrl`
|
|
249
|
-
- `netOptions`
|
|
250
|
-
- `parseCurlResponse`
|
|
251
|
-
- `curlOnce`
|
|
252
|
-
- `fetchOnce`
|
|
253
|
-
- `requestBuffer`
|
|
254
|
-
- `requestJson`
|
|
304
|
+
- `NET_DEFAULTS` L23(导出常量)
|
|
305
|
+
- `assertAllowedUrl` L34(导出)
|
|
306
|
+
- `netOptions` L50
|
|
307
|
+
- `parseCurlResponse` L60(导出)
|
|
308
|
+
- `curlOnce` L75
|
|
309
|
+
- `fetchOnce` L95
|
|
310
|
+
- `requestBuffer` L128(导出)
|
|
311
|
+
- `requestJson` L171(导出)
|
|
255
312
|
|
|
256
|
-
### `lib/pack.mjs`(
|
|
313
|
+
### `lib/pack.mjs`(677 行)
|
|
257
314
|
|
|
258
315
|
打包:收集插件 → 抓配置/数据 → 扫描 → 写清单与安装器 → 压 zip
|
|
259
316
|
|
|
260
|
-
- `collectFiles`
|
|
261
|
-
- `readInstalledPlugin`
|
|
262
|
-
- `REDACTED`
|
|
263
|
-
- `normalizeConfigKey`
|
|
264
|
-
- `redactConfig`
|
|
265
|
-
- `captureConfigs`
|
|
266
|
-
- `dataDirsFor`
|
|
267
|
-
- `scrubText`
|
|
268
|
-
- `captureData`
|
|
269
|
-
- `licenseId`
|
|
270
|
-
- `authorOf`
|
|
271
|
-
- `buildPack`
|
|
272
|
-
|
|
273
|
-
### `lib/
|
|
317
|
+
- `collectFiles` L51(导出)
|
|
318
|
+
- `readInstalledPlugin` L93(导出)
|
|
319
|
+
- `REDACTED` L126(导出常量)
|
|
320
|
+
- `normalizeConfigKey` L128(导出)
|
|
321
|
+
- `redactConfig` L135(导出)
|
|
322
|
+
- `captureConfigs` L161(导出)
|
|
323
|
+
- `dataDirsFor` L207
|
|
324
|
+
- `scrubText` L235
|
|
325
|
+
- `captureData` L246(导出)
|
|
326
|
+
- `licenseId` L294
|
|
327
|
+
- `authorOf` L301
|
|
328
|
+
- `buildPack` L314(导出)
|
|
329
|
+
|
|
330
|
+
### `lib/plugin-graph.mjs`(462 行)
|
|
331
|
+
|
|
332
|
+
插件树与兼容树:按勾选的插件,从 package.json 声明、manifest、路由表构筑相关性节点与边,并给出版本兼容判定
|
|
333
|
+
|
|
334
|
+
- `SUB_FILES` L18(导出常量)
|
|
335
|
+
- `readJson` L20
|
|
336
|
+
- `readDeclarations` L29(导出)
|
|
337
|
+
- `readInstalledPackages` L53
|
|
338
|
+
- `versionVerdict` L111
|
|
339
|
+
- `listTreeCandidates` L126(导出)
|
|
340
|
+
- `recordOf` L183
|
|
341
|
+
- `buildRelations` L203(导出)
|
|
342
|
+
- `compatOf` L438(导出)
|
|
343
|
+
|
|
344
|
+
### `lib/plugin-manager.mjs`(558 行)
|
|
345
|
+
|
|
346
|
+
插件管理:已装列表(含分组/新版)、启用停用、重装(可保留配置)
|
|
347
|
+
|
|
348
|
+
- `isValidPluginName` L51(导出)
|
|
349
|
+
- `isValidVersion` L56(导出)
|
|
350
|
+
- `patchEntries` L61
|
|
351
|
+
- `writeMarketDisabled` L77(导出)
|
|
352
|
+
- `listManaged` L106(导出)
|
|
353
|
+
- `setPluginEnabled` L195(导出)
|
|
354
|
+
- `resolveReinstallVersion` L243(导出)
|
|
355
|
+
- `dropPatchEntries` L256(导出)
|
|
356
|
+
- `cliTail` L291
|
|
357
|
+
- `reinstallPlugin` L313(导出)
|
|
358
|
+
- `revealPluginDir` L425(导出)
|
|
359
|
+
- `pluginIcon` L463(导出)
|
|
360
|
+
- `updatableItems` L489(导出)
|
|
361
|
+
- `updatePlugins` L498(导出)
|
|
362
|
+
|
|
363
|
+
### `lib/profile.mjs`(344 行)
|
|
274
364
|
|
|
275
365
|
读写 profile:已装列表、bundles、cordis.patch.yml、调官方 CLI
|
|
276
366
|
|
|
277
|
-
- `readJson`
|
|
278
|
-
- `readProfilePackage`
|
|
279
|
-
- `listInstalled`
|
|
280
|
-
- `dshVersion`
|
|
281
|
-
- `readBundles`
|
|
282
|
-
- `backup`
|
|
283
|
-
- `ensureBundles`
|
|
284
|
-
- `setBundles`
|
|
285
|
-
- `patchPath`
|
|
286
|
-
- `readPatch`
|
|
287
|
-
- `writePatch`
|
|
288
|
-
- `cliPath`
|
|
289
|
-
- `cliEntry`
|
|
290
|
-
- `quoteArg`
|
|
291
|
-
- `safeArg`
|
|
292
|
-
- `normalizePluginArgs`
|
|
293
|
-
- `decodeOutput`
|
|
294
|
-
- `runDshPlugin`
|
|
295
|
-
|
|
296
|
-
### `lib/registry.mjs`(
|
|
367
|
+
- `readJson` L27(导出)
|
|
368
|
+
- `readProfilePackage` L35(导出)
|
|
369
|
+
- `listInstalled` L39(导出)
|
|
370
|
+
- `dshVersion` L151(导出)
|
|
371
|
+
- `readBundles` L159(导出)
|
|
372
|
+
- `backup` L164
|
|
373
|
+
- `ensureBundles` L173(导出)
|
|
374
|
+
- `setBundles` L195(导出)
|
|
375
|
+
- `patchPath` L210(导出)
|
|
376
|
+
- `readPatch` L214(导出)
|
|
377
|
+
- `writePatch` L223(导出)
|
|
378
|
+
- `cliPath` L232
|
|
379
|
+
- `cliEntry` L239
|
|
380
|
+
- `quoteArg` L251
|
|
381
|
+
- `safeArg` L257
|
|
382
|
+
- `normalizePluginArgs` L262
|
|
383
|
+
- `decodeOutput` L274
|
|
384
|
+
- `runDshPlugin` L288(导出)
|
|
385
|
+
|
|
386
|
+
### `lib/registry.mjs`(254 行)
|
|
297
387
|
|
|
298
388
|
从 npm 取版本清单与 tarball(三层退让 + curl 兜底)
|
|
299
389
|
|
|
300
|
-
- `fetchLimited`
|
|
301
|
-
- `fetchJson`
|
|
302
|
-
- `validatePackageName`
|
|
303
|
-
- `metadataLimit`
|
|
304
|
-
- `probeRegistry`
|
|
305
|
-
- `npmMetadata`
|
|
306
|
-
- `pickVersion`
|
|
307
|
-
- `relativeTime`
|
|
308
|
-
- `downloadPackage`
|
|
309
|
-
- `fetchCatalog`
|
|
310
|
-
- `npmSearchCatalog`
|
|
311
|
-
|
|
312
|
-
### `lib/repack.mjs`(58 行)
|
|
390
|
+
- `fetchLimited` L29(导出常量)
|
|
391
|
+
- `fetchJson` L30(导出常量)
|
|
392
|
+
- `validatePackageName` L32(导出)
|
|
393
|
+
- `metadataLimit` L48(导出)
|
|
394
|
+
- `probeRegistry` L66(导出)
|
|
395
|
+
- `npmMetadata` L83(导出)
|
|
396
|
+
- `pickVersion` L137(导出)
|
|
397
|
+
- `relativeTime` L154(导出)
|
|
398
|
+
- `downloadPackage` L165(导出)
|
|
399
|
+
- `fetchCatalog` L208(导出)
|
|
400
|
+
- `npmSearchCatalog` L223(导出)
|
|
313
401
|
|
|
402
|
+
### `lib/repack.mjs`(69 行)
|
|
314
403
|
|
|
404
|
+
轻量重打包:只改清单里几个字段,其余字节原样保留
|
|
315
405
|
|
|
316
|
-
- `rewritePackManifest`
|
|
406
|
+
- `rewritePackManifest` L22(导出)
|
|
317
407
|
|
|
318
|
-
### `lib/scan.mjs`(
|
|
408
|
+
### `lib/scan.mjs`(359 行)
|
|
319
409
|
|
|
320
410
|
安全检测:敏感信息 + 恶意代码痕迹;按来源分组;同内容去重
|
|
321
411
|
|
|
322
|
-
- `scanFileName`
|
|
323
|
-
- `maskSecret`
|
|
324
|
-
- `maskAll`
|
|
325
|
-
- `findingOf`
|
|
326
|
-
- `looksBinary`
|
|
327
|
-
- `extOf`
|
|
328
|
-
- `lineAt`
|
|
329
|
-
- `scanFile`
|
|
330
|
-
- `groupFindings`
|
|
331
|
-
- `severityRank`
|
|
332
|
-
- `scanEntries`
|
|
333
|
-
- `renderScanReport`
|
|
334
|
-
|
|
335
|
-
### `lib/semver.mjs`(
|
|
412
|
+
- `scanFileName` L78(导出)
|
|
413
|
+
- `maskSecret` L87
|
|
414
|
+
- `maskAll` L93
|
|
415
|
+
- `findingOf` L98
|
|
416
|
+
- `looksBinary` L110(导出)
|
|
417
|
+
- `extOf` L116
|
|
418
|
+
- `lineAt` L122
|
|
419
|
+
- `scanFile` L134(导出)
|
|
420
|
+
- `groupFindings` L205(导出)
|
|
421
|
+
- `severityRank` L247(导出)
|
|
422
|
+
- `scanEntries` L256(导出)
|
|
423
|
+
- `renderScanReport` L323(导出)
|
|
424
|
+
|
|
425
|
+
### `lib/semver.mjs`(148 行)
|
|
336
426
|
|
|
337
427
|
极小 semver 实现(判断兼容性用)
|
|
338
428
|
|
|
339
|
-
- `parseVersion`
|
|
340
|
-
- `compareVersions`
|
|
341
|
-
- `bound`
|
|
342
|
-
- `parseComparatorSet`
|
|
343
|
-
- `testBounds`
|
|
344
|
-
- `satisfies`
|
|
429
|
+
- `parseVersion` L21(导出)
|
|
430
|
+
- `compareVersions` L28(导出)
|
|
431
|
+
- `bound` L43
|
|
432
|
+
- `parseComparatorSet` L48
|
|
433
|
+
- `testBounds` L113
|
|
434
|
+
- `satisfies` L129(导出)
|
|
345
435
|
|
|
346
|
-
### `lib/store.mjs`(
|
|
436
|
+
### `lib/store.mjs`(283 行)
|
|
347
437
|
|
|
348
438
|
本地状态:settings.json / history.json / 目录路径 / 默认配置与 clamp
|
|
349
439
|
|
|
350
|
-
- `dshHome`
|
|
351
|
-
- `pluginHome`
|
|
352
|
-
- `profileName`
|
|
353
|
-
- `profileDir`
|
|
354
|
-
- `HOSTS_VERSION`
|
|
355
|
-
- `NET_VERSION`
|
|
356
|
-
- `DEFAULT_CONFIG`
|
|
357
|
-
- `pathsFor`
|
|
358
|
-
- `clampConfig`
|
|
359
|
-
- `loadConfig`
|
|
360
|
-
- `writeJsonAtomic`
|
|
361
|
-
- `saveConfig`
|
|
362
|
-
- `readHistory`
|
|
363
|
-
- `appendHistory`
|
|
364
|
-
- `clearHistory`
|
|
365
|
-
- `removeHistory`
|
|
366
|
-
- `appendLog`
|
|
367
|
-
- `slugify`
|
|
368
|
-
- `ensureDir`
|
|
369
|
-
|
|
370
|
-
### `lib/
|
|
440
|
+
- `dshHome` L25(导出)
|
|
441
|
+
- `pluginHome` L29(导出)
|
|
442
|
+
- `profileName` L38(导出)
|
|
443
|
+
- `profileDir` L44(导出)
|
|
444
|
+
- `HOSTS_VERSION` L48(导出常量)
|
|
445
|
+
- `NET_VERSION` L50(导出常量)
|
|
446
|
+
- `DEFAULT_CONFIG` L52(导出常量)
|
|
447
|
+
- `pathsFor` L129(导出)
|
|
448
|
+
- `clampConfig` L142(导出)
|
|
449
|
+
- `loadConfig` L192(导出)
|
|
450
|
+
- `writeJsonAtomic` L215(导出)
|
|
451
|
+
- `saveConfig` L222(导出)
|
|
452
|
+
- `readHistory` L228(导出)
|
|
453
|
+
- `appendHistory` L237(导出)
|
|
454
|
+
- `clearHistory` L245(导出)
|
|
455
|
+
- `removeHistory` L251(导出)
|
|
456
|
+
- `appendLog` L258(导出)
|
|
457
|
+
- `slugify` L268(导出)
|
|
458
|
+
- `ensureDir` L279(导出)
|
|
459
|
+
|
|
460
|
+
### `lib/subplugins.mjs`(142 行)
|
|
461
|
+
|
|
462
|
+
附属小插件登记表(社区资源 / 代码标注 / 插件树):id、目录、开关键、清单与启用判定
|
|
463
|
+
|
|
464
|
+
- `SUBPLUGINS` L18(导出常量)
|
|
465
|
+
- `readSubManifest` L48(导出)
|
|
466
|
+
- `readSubManifests` L85(导出)
|
|
467
|
+
- `findSubplugin` L89(导出)
|
|
468
|
+
- `subEnabled` L96(导出)
|
|
469
|
+
- `listSubplugins` L106(导出)
|
|
470
|
+
|
|
471
|
+
### `lib/tar.mjs`(118 行)
|
|
371
472
|
|
|
372
473
|
读 .tgz(npm 包)
|
|
373
474
|
|
|
374
|
-
- `readString`
|
|
375
|
-
- `readOctal`
|
|
376
|
-
- `parsePax`
|
|
377
|
-
- `readTarball`
|
|
378
|
-
- `stripPackagePrefix`
|
|
379
|
-
- `tarLimits`
|
|
380
|
-
|
|
381
|
-
### `lib/
|
|
475
|
+
- `readString` L24
|
|
476
|
+
- `readOctal` L30
|
|
477
|
+
- `parsePax` L37
|
|
478
|
+
- `readTarball` L58(导出)
|
|
479
|
+
- `stripPackagePrefix` L108(导出)
|
|
480
|
+
- `tarLimits` L117(导出常量)
|
|
481
|
+
|
|
482
|
+
### `lib/testmode.mjs`(103 行)
|
|
483
|
+
|
|
484
|
+
测试模式:开着时把打包/下载/安装/更新/重装/启停/上传都变成只走流程(进度与弹窗照常)
|
|
485
|
+
|
|
486
|
+
- `TEST_PREFIX` L13(导出常量)
|
|
487
|
+
- `testModeOn` L16(导出)
|
|
488
|
+
- `testNote` L21(导出)
|
|
489
|
+
- `stepDelay` L26
|
|
490
|
+
- `TEST_STEPS` L36(导出常量)
|
|
491
|
+
- `testStepsFor` L57(导出)
|
|
492
|
+
- `playTestJob` L69(导出)
|
|
493
|
+
- `testPayload` L100(导出)
|
|
494
|
+
|
|
495
|
+
### `lib/theme.mjs`(187 行)
|
|
496
|
+
|
|
497
|
+
配色:四套预设(雾蓝/墨绿/暮紫/跟宿主)与自定义主色+附属色,算成 --mp-* CSS 变量(只作用于本插件界面)
|
|
498
|
+
|
|
499
|
+
- `THEME_PRESETS` L26(导出常量)
|
|
500
|
+
- `THEME_IDS` L62(导出常量)
|
|
501
|
+
- `DEFAULT_THEME_ID` L63(导出常量)
|
|
502
|
+
- `isHexColor` L67(导出)
|
|
503
|
+
- `mix` L72
|
|
504
|
+
- `readableOn` L90(导出)
|
|
505
|
+
- `themeOf` L102(导出)
|
|
506
|
+
- `rgba` L117
|
|
507
|
+
- `themeVars` L130(导出)
|
|
508
|
+
- `themeActive` L164(导出)
|
|
509
|
+
- `themeCss` L168(导出)
|
|
510
|
+
- `themeOptions` L176(导出)
|
|
511
|
+
|
|
512
|
+
### `lib/yamlish.mjs`(419 行)
|
|
382
513
|
|
|
383
514
|
YAML 子集:只服务 cordis.patch.yml 的读写
|
|
384
515
|
|
|
385
|
-
- `stripComment`
|
|
386
|
-
- `parseDoubleQuoted`
|
|
387
|
-
- `parseSingleQuoted`
|
|
388
|
-
- `parseFlow`
|
|
389
|
-
- `parseScalar`
|
|
390
|
-
- `parseYaml`
|
|
391
|
-
- `emitScalar`
|
|
392
|
-
- `emitYaml`
|
|
393
|
-
- `splitTopLevelItems`
|
|
394
|
-
- `upsertPatchItem`
|
|
395
|
-
- `findPatchItem`
|
|
516
|
+
- `stripComment` L26
|
|
517
|
+
- `parseDoubleQuoted` L40
|
|
518
|
+
- `parseSingleQuoted` L66
|
|
519
|
+
- `parseFlow` L71
|
|
520
|
+
- `parseScalar` L144
|
|
521
|
+
- `parseYaml` L274(导出)
|
|
522
|
+
- `emitScalar` L288(导出)
|
|
523
|
+
- `emitYaml` L299(导出)
|
|
524
|
+
- `splitTopLevelItems` L345(导出)
|
|
525
|
+
- `upsertPatchItem` L379(导出)
|
|
526
|
+
- `findPatchItem` L408(导出)
|
|
396
527
|
|
|
397
|
-
### `lib/zip.mjs`(
|
|
528
|
+
### `lib/zip.mjs`(267 行)
|
|
398
529
|
|
|
399
530
|
最小 ZIP 读写(node:zlib,无依赖)
|
|
400
531
|
|
|
401
|
-
- `dosTime`
|
|
402
|
-
- `dosToDate`
|
|
403
|
-
- `safeEntryName`
|
|
404
|
-
- `alreadyCompressed`
|
|
405
|
-
- `writeZip`
|
|
406
|
-
- `findEocd`
|
|
407
|
-
- `readZip`
|
|
408
|
-
- `readZipText`
|
|
409
|
-
- `zipLimits`
|
|
532
|
+
- `dosTime` L40
|
|
533
|
+
- `dosToDate` L49
|
|
534
|
+
- `safeEntryName` L60(导出)
|
|
535
|
+
- `alreadyCompressed` L86(导出)
|
|
536
|
+
- `writeZip` L99(导出)
|
|
537
|
+
- `findEocd` L176
|
|
538
|
+
- `readZip` L194(导出)
|
|
539
|
+
- `readZipText` L261(导出)
|
|
540
|
+
- `zipLimits` L266(导出常量)
|
|
541
|
+
|
|
542
|
+
### `community/index.mjs`(30 行)
|
|
543
|
+
|
|
544
|
+
附属小插件「社区资源」的路由表(浏览 / 详情 / 下载 / 上传 / 封面)
|
|
545
|
+
|
|
546
|
+
- `COMMUNITY_ID` L28(导出常量)
|
|
547
|
+
- `COMMUNITY_API` L29(导出常量)
|
|
548
|
+
|
|
549
|
+
### `annotate/index.mjs`(63 行)
|
|
550
|
+
|
|
551
|
+
附属小插件「代码标注」的路由表(读全仓标注 / 跑自检)
|
|
552
|
+
|
|
553
|
+
- `ANNOTATE_ID` L16(导出常量)
|
|
554
|
+
- `ANNOTATE_API` L17(导出常量)
|
|
555
|
+
- `annotateRoutes` L23(导出)
|
|
556
|
+
|
|
557
|
+
### `plugin-tree/index.mjs`(75 行)
|
|
558
|
+
|
|
559
|
+
附属小插件「插件树」的路由表(插件树 / 兼容树,带 3 秒缓存)
|
|
560
|
+
|
|
561
|
+
- `TREE_ID` L17(导出常量)
|
|
562
|
+
- `TREE_API` L18(导出常量)
|
|
563
|
+
- `queryNames` L24
|
|
564
|
+
- `cacheKey` L34
|
|
565
|
+
- `treeRoutes` L50(导出)
|
|
410
566
|
|
|
411
567
|
## 4. 常见改动的连锁清单
|
|
412
568
|
|
|
@@ -415,7 +571,10 @@ YAML 子集:只服务 cordis.patch.yml 的读写
|
|
|
415
571
|
- **加一个社区资源字段**:`_market/modpack-catalog/scripts/build.mjs`(校验 + 输出)→ `lib/modpack-catalog.mjs` 的 `normalizeCatalog` → `client.js` 的 `renderRow` / 详情块 → `_market/modpack-catalog/README.md` 的条目格式表。
|
|
416
572
|
- **加一种打包策略或改策略判定**:`lib/pack.mjs`(`strategy` / `embedded`)→ `lib/manifest.mjs`(`format` 归一化)→ `index.js` 的 `computePlan` 与 `/pack/plan` → `client.js` 的 `STRATEGY_INFO` 与卡片 → `lib/install.mjs`(按 `embedded` 决定走市场版还是包内副本)→ 测试。
|
|
417
573
|
- **改界面文案**:`client.js` 里的中文字面量;`locale/zh.json`、`locale/en.json` 的 `meta.title/description`;`README.md`;`docs/DETAIL.md`;注意测试里有硬断言(例如旧名「整合包市场」不许出现);市场介绍那段统一改 `docs/MARKET.txt`,再跑 `dev/tools/market-text.mjs` 同步。
|
|
418
|
-
-
|
|
574
|
+
- **加一个附属小插件**:`lib/subplugins.mjs` 的 `SUBPLUGINS` → 新目录的 `manifest.json`(id/apiVersion/configKey/routes)与 `index.mjs`(导出 `*Routes()`)→ `index.js` 的 `mountSubRoutes(...)` → `lib/store.mjs` 的 `DEFAULT_CONFIG` 加开关键 → `lib/plugin-graph.mjs` 的 `SUB_FILES` → `package.json` 的 `files` → `client.js` 的卡片与设置页。
|
|
575
|
+
- **给源文件加/改代码标注**:标注块在文件最上面的 `/** … */`(`@file` 必须等于相对路径,`@role/@risk/@touch` 必需),改完跑 `POST /api/annotate/check` 或 `lib/annotate.mjs` 的 `checkAnnotations()` 自检;新文件加进 `runtimeFiles` 的扫描范围即可。
|
|
576
|
+
- **看整套代码结构**:`docs/ANNOTATIONS.md`(`dev/tools/annotations.mjs` 生成,一页列出每个文件的职责 / 能力 / 改坏的后果),比翻源码快;它过期了 `test/run.mjs` 会红。
|
|
577
|
+
- **改完固定收尾**:`test/run.mjs`、`DSH_MODPACK_OFFLINE=1 test/host-smoke.mjs`、`dev/tools/sync.cjs`、`dev/tools/verify.cjs`、`dev/tools/map.mjs`(刷新本文件);界面改动可用 `dev/tools/ui-preview.mjs` 导出 HTML 截图核对。
|
|
419
578
|
|
|
420
579
|
## 5. 检索示例
|
|
421
580
|
|