dsh-plugin 1.6.12 → 2.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.en.md +13 -13
- package/README.md +13 -13
- package/client/client.js +791 -761
- package/client/client.js.map +1 -1
- package/lib/http/catalog.js +2 -3
- package/lib/http/diagnostics.js +6 -7
- package/lib/http/install.js +47 -213
- package/lib/http/logs.js +1 -2
- package/lib/http/npm-release-age.js +42 -0
- package/lib/http/routes.js +8 -7
- package/lib/http/settings.js +2 -2
- package/lib/http/shared.js +2 -2
- package/lib/http/task.js +1 -2
- package/lib/index.js +5 -6
- package/lib/services/install/install-types.js +4 -4
- package/lib/services/install/install.js +1 -1
- package/lib/services/install/npm-check.js +3 -2
- package/lib/services/install/npm-resolve.js +9 -96
- package/lib/services/install/operation-log.js +53 -1
- package/lib/services/install/package-entry.js +6 -11
- package/lib/services/install/registry-check.js +2 -2
- package/lib/services/install/release-target.js +8 -9
- package/lib/services/install/task-queue.js +44 -48
- package/lib/services/npm-release-age.js +119 -0
- package/lib/services/probe.js +4 -4
- package/lib/services/profile/installed-versions.js +15 -21
- package/lib/services/profile/profile.js +16 -44
- package/lib/services/profile/progress.js +8 -11
- package/lib/services/settings.js +2 -5
- package/lib/types/http/catalog.d.ts +1 -1
- package/lib/types/http/install.d.ts +2 -2
- package/lib/types/http/npm-release-age.d.ts +2 -0
- package/lib/types/http/routes.d.ts +10 -12
- package/lib/types/http/shared.d.ts +5 -6
- package/lib/types/index.d.ts +7 -8
- package/lib/types/services/install/install-types.d.ts +12 -13
- package/lib/types/services/install/install.d.ts +1 -1
- package/lib/types/services/install/npm-resolve.d.ts +4 -16
- package/lib/types/services/install/operation-log.d.ts +9 -0
- package/lib/types/services/install/package-entry.d.ts +6 -11
- package/lib/types/services/install/release-target.d.ts +7 -8
- package/lib/types/services/install/task-queue.d.ts +25 -30
- package/lib/types/services/npm-release-age.d.ts +15 -0
- package/lib/types/services/probe.d.ts +4 -4
- package/lib/types/services/profile/installed-versions.d.ts +5 -7
- package/lib/types/services/profile/profile.d.ts +14 -18
- package/lib/types/services/profile/progress.d.ts +7 -10
- package/lib/types/services/settings.d.ts +0 -4
- package/package.json +1 -1
- package/src/client/components/PluginHubSection.tsx +26 -22
- package/src/client/components/catalog/CatalogList.tsx +2 -4
- package/src/client/components/catalog/PluginCard.tsx +2 -3
- package/src/client/components/layout/CatalogControls.tsx +5 -6
- package/src/client/components/layout/CatalogHeader.tsx +1 -2
- package/src/client/components/layout/CategoryTabs.tsx +2 -3
- package/src/client/components/layout/SectionTabs.tsx +3 -5
- package/src/client/components/modals/ConfirmDialog.tsx +4 -6
- package/src/client/components/modals/InstalledDetailModal.tsx +3 -6
- package/src/client/components/modals/LogsModal.tsx +7 -12
- package/src/client/components/modals/NotificationsModal.tsx +74 -24
- package/src/client/components/modals/ProgressView.tsx +3 -4
- package/src/client/components/modals/modals.tsx +75 -26
- package/src/client/components/ui/Dropdown.tsx +4 -6
- package/src/client/components/ui/Toggle.tsx +2 -3
- package/src/client/components/ui/icons.tsx +1 -2
- package/src/client/components/views/CustomInstallView.tsx +20 -178
- package/src/client/components/views/DiagnosticsView.tsx +3 -6
- package/src/client/components/views/InstalledView.tsx +6 -11
- package/src/client/components/views/MarketView.tsx +2 -4
- package/src/client/components/views/SettingsView.tsx +9 -32
- package/src/client/css-modules.d.ts +1 -1
- package/src/client/data/catalog.ts +2 -3
- package/src/client/data/host.ts +26 -3
- package/src/client/data/hub.ts +2 -3
- package/src/client/hooks/useCatalog.ts +79 -24
- package/src/client/hooks/useIncrementalList.ts +3 -5
- package/src/client/hooks/useLanguage.ts +4 -6
- package/src/client/hooks/useSettings.ts +4 -11
- package/src/client/hooks/useTaskQueue.ts +36 -42
- package/src/client/index.tsx +2 -3
- package/src/client/locales.ts +187 -114
- package/src/client/logic/constants.ts +1 -2
- package/src/client/logic/ensure-plugin-css.ts +8 -12
- package/src/client/logic/failures.ts +20 -19
- package/src/client/logic/format.ts +1 -1
- package/src/client/logic/install-command.ts +14 -35
- package/src/client/logic/installed.ts +15 -10
- package/src/client/logic/normalize.ts +3 -3
- package/src/client/logic/release-age.ts +19 -0
- package/src/client/logic/urls.ts +24 -21
- package/src/client/styles/CustomInstallView.module.css +3 -30
- package/src/client/styles/DiagnosticsView.module.css +3 -5
- package/src/client/styles/Dropdown.module.css +2 -4
- package/src/client/styles/Header.module.css +6 -7
- package/src/client/styles/InstalledView.module.css +4 -7
- package/src/client/styles/List.module.css +4 -5
- package/src/client/styles/LogsView.module.css +2 -3
- package/src/client/styles/Modal.module.css +46 -6
- package/src/client/styles/SectionTabs.module.css +2 -4
- package/src/client/styles/SettingsView.module.css +3 -5
- package/src/client/styles/Toggle.module.css +2 -4
- package/src/client/styles/tokens.module.css +14 -18
- package/src/client/types.ts +11 -11
- package/src/server/http/catalog.ts +2 -3
- package/src/server/http/diagnostics.ts +6 -7
- package/src/server/http/install.ts +47 -208
- package/src/server/http/logs.ts +1 -2
- package/src/server/http/npm-release-age.ts +42 -0
- package/src/server/http/routes.ts +12 -12
- package/src/server/http/settings.ts +2 -2
- package/src/server/http/shared.ts +5 -6
- package/src/server/http/task.ts +1 -2
- package/src/server/index.ts +7 -8
- package/src/server/services/install/install-types.ts +12 -13
- package/src/server/services/install/install.ts +0 -1
- package/src/server/services/install/npm-check.ts +3 -2
- package/src/server/services/install/npm-resolve.ts +9 -99
- package/src/server/services/install/operation-log.ts +47 -1
- package/src/server/services/install/package-entry.ts +6 -11
- package/src/server/services/install/registry-check.ts +2 -2
- package/src/server/services/install/release-target.ts +8 -9
- package/src/server/services/install/task-queue.ts +51 -54
- package/src/server/services/npm-release-age.ts +107 -0
- package/src/server/services/probe.ts +4 -4
- package/src/server/services/profile/installed-versions.ts +16 -22
- package/src/server/services/profile/profile.ts +16 -42
- package/src/server/services/profile/progress.ts +8 -11
- package/src/server/services/settings.ts +2 -9
- package/lib/services/install/preflight.js +0 -178
- package/lib/types/services/install/preflight.d.ts +0 -23
- package/src/server/services/install/preflight.ts +0 -184
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
* Website: https://dsh-plugin.org
|
|
3
3
|
* GitHub: https://github.com/dshplugin/dsh-plugin-hub
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* browse-all footer. Colors resolve through the --hub-* design tokens. */
|
|
5
|
+
* 插件中心目录列表:可滚动主体、插件卡片(名称、徽标、描述、标签、统计、动作)、
|
|
6
|
+
* 加载/空态与「浏览全部」页脚。颜色经 --hub-* 设计变量解析。 */
|
|
8
7
|
|
|
9
8
|
.body {
|
|
10
9
|
flex: 1;
|
|
@@ -273,7 +272,7 @@ body[data-ds-dark-theme] .uninstallBtn:hover {
|
|
|
273
272
|
user-select: none;
|
|
274
273
|
}
|
|
275
274
|
|
|
276
|
-
/* ——
|
|
275
|
+
/* —— 状态 —— */
|
|
277
276
|
|
|
278
277
|
.state {
|
|
279
278
|
flex: 1;
|
|
@@ -341,7 +340,7 @@ body[data-ds-dark-theme] .uninstallBtn:hover {
|
|
|
341
340
|
background: var(--hub-brand-hover);
|
|
342
341
|
}
|
|
343
342
|
|
|
344
|
-
/* ——
|
|
343
|
+
/* —— 页脚 —— */
|
|
345
344
|
|
|
346
345
|
.footer {
|
|
347
346
|
flex-shrink: 0;
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
* Website: https://dsh-plugin.org
|
|
3
3
|
* GitHub: https://github.com/dshplugin/dsh-plugin-hub
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* refresh / copy-all / export (.log download) actions. */
|
|
5
|
+
* 系统日志:每条一行 —— 时间、级别徽标(OK 绿 / FAIL 红 / WARN 琥珀 / INFO 灰)、
|
|
6
|
+
* 事件码与消息。头部含 刷新 / 全部复制 / 导出(.log 下载)动作。 */
|
|
8
7
|
|
|
9
8
|
.panel {
|
|
10
9
|
display: flex;
|
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
* Website: https://dsh-plugin.org
|
|
3
3
|
* GitHub: https://github.com/dshplugin/dsh-plugin-hub
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* and the global toast. Colors resolve through the --hub-* design tokens. */
|
|
5
|
+
* 插件中心弹窗与遮罩:安装/卸载弹窗、错误弹窗、失败记录弹窗、任务队列弹窗、进度条、
|
|
6
|
+
* 内联进度与全局 Toast。颜色经 --hub-* 设计变量解析。 */
|
|
8
7
|
|
|
9
|
-
/* ——
|
|
8
|
+
/* —— 弹窗基座 —— */
|
|
10
9
|
|
|
11
10
|
.overlay {
|
|
12
11
|
position: fixed;
|
|
@@ -364,7 +363,7 @@
|
|
|
364
363
|
overflow-y: auto;
|
|
365
364
|
}
|
|
366
365
|
|
|
367
|
-
/* ——
|
|
366
|
+
/* —— Toast 提示条 —— */
|
|
368
367
|
|
|
369
368
|
/* 复制成功提示条:窗口正中央浮出,无遮罩无图标。采用反色浮层——亮色模式
|
|
370
369
|
黑底白字、暗色模式白底深字(复用主按钮 token:primary-fill 与
|
|
@@ -560,7 +559,7 @@
|
|
|
560
559
|
/* 错误信息正文:等宽字体 + 可滚动 + 保留换行,完整展示服务端报错 */
|
|
561
560
|
.errorBox {
|
|
562
561
|
margin: 0;
|
|
563
|
-
max-height:
|
|
562
|
+
max-height: 72px;
|
|
564
563
|
overflow: auto;
|
|
565
564
|
padding: 10px 12px;
|
|
566
565
|
border: 1px solid var(--hub-danger-border);
|
|
@@ -1140,6 +1139,7 @@
|
|
|
1140
1139
|
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
1141
1140
|
font-size: 12px;
|
|
1142
1141
|
line-height: 18px;
|
|
1142
|
+
/* 来源参数 ?ref=hub 只保留在 href 里,不显示 */
|
|
1143
1143
|
color: var(--hub-brand);
|
|
1144
1144
|
text-decoration: none;
|
|
1145
1145
|
cursor: pointer;
|
|
@@ -1147,6 +1147,21 @@
|
|
|
1147
1147
|
}
|
|
1148
1148
|
|
|
1149
1149
|
.failRepo:hover {
|
|
1150
|
+
text-decoration: none;
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
/* 只有真正的超链接用蓝色(同类名也用于纯文本的仓库名/更新记录) */
|
|
1154
|
+
a.failRepo {
|
|
1155
|
+
color: #2f6feb;
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
/* 链接里的「插件详情」前缀保持正文色,只有后面的网址是蓝色 */
|
|
1159
|
+
.failRepoLabel {
|
|
1160
|
+
color: var(--hub-text-secondary);
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
/* 下划线只加在网址上,前缀不跟着变成链接样式 */
|
|
1164
|
+
a.failRepo:hover .failRepoUrl {
|
|
1150
1165
|
text-decoration: underline;
|
|
1151
1166
|
}
|
|
1152
1167
|
|
|
@@ -1227,12 +1242,37 @@
|
|
|
1227
1242
|
box-shadow: 0 3px 10px rgba(209, 36, 47, 0.35);
|
|
1228
1243
|
}
|
|
1229
1244
|
|
|
1245
|
+
/* 失败主因分三层:标题(报错类型)→ 一句话原因 → 操作指引,视觉上逐层递减 */
|
|
1246
|
+
.failKindTitle {
|
|
1247
|
+
margin-top: 10px;
|
|
1248
|
+
font-size: 15px;
|
|
1249
|
+
font-weight: 700;
|
|
1250
|
+
line-height: 22px;
|
|
1251
|
+
text-align: left;
|
|
1252
|
+
color: var(--hub-danger-text);
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
.failReason {
|
|
1256
|
+
margin-top: 2px;
|
|
1257
|
+
font-size: 12.5px;
|
|
1258
|
+
font-weight: 400;
|
|
1259
|
+
line-height: 19px;
|
|
1260
|
+
white-space: pre-line;
|
|
1261
|
+
text-align: left;
|
|
1262
|
+
color: var(--hub-text-secondary);
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1230
1265
|
/* 插件 prepare 构建脚本失败说明:位于提 Issue 按钮上方的补充说明,同琥珀警示样式 */
|
|
1231
1266
|
.failPrepareHint {
|
|
1232
1267
|
margin-top: 6px;
|
|
1268
|
+
/* 与下方的报错框 / 红色按钮留出呼吸空间 */
|
|
1269
|
+
margin-bottom: 12px;
|
|
1233
1270
|
padding: 8px 12px;
|
|
1234
1271
|
font-size: 12px;
|
|
1235
1272
|
line-height: 18px;
|
|
1273
|
+
/* 提示里的 \n 按行渲染:多步骤指引一条一行,读起来不用在一段长文里找 */
|
|
1274
|
+
white-space: pre-line;
|
|
1275
|
+
text-align: left;
|
|
1236
1276
|
color: var(--hub-warning);
|
|
1237
1277
|
background: var(--hub-warning-tint);
|
|
1238
1278
|
border: 1px solid var(--hub-warning-border);
|
|
@@ -2,10 +2,8 @@
|
|
|
2
2
|
* Website: https://dsh-plugin.org
|
|
3
3
|
* GitHub: https://github.com/dshplugin/dsh-plugin-hub
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* brand-colored underline; the bar itself draws a hairline bottom border so
|
|
8
|
-
* the selected state reads clearly without extra chrome. */
|
|
5
|
+
* 一级导航(section tabs):头部下方的下划线 tab 栏,在 市场 / 已安装 / 设置 间切换。
|
|
6
|
+
* 激活 tab 带品牌色下划线;栏本身画一条细底边,让选中态清晰、不多余装饰。 */
|
|
9
7
|
|
|
10
8
|
.root {
|
|
11
9
|
display: flex;
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
* Website: https://dsh-plugin.org
|
|
3
3
|
* GitHub: https://github.com/dshplugin/dsh-plugin-hub
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* separators). High density, no whitespace waste: rows are 12px padding,
|
|
9
|
-
* 28px controls, 11px descriptions. */
|
|
5
|
+
* 设置视图:桌面设置式导航 —— 固定左侧栏列出各分组(图标 + 名称,点击切换),
|
|
6
|
+
* 右侧面板每个分组一张卡片(行:标签左、控件右,细线分隔)。高密度、不浪费留白:
|
|
7
|
+
* 行内边距 12px、控件 28px、说明 11px。 */
|
|
10
8
|
|
|
11
9
|
/* 整体:占满剩余高度,左导航右内容两栏 */
|
|
12
10
|
.root {
|
|
@@ -2,10 +2,8 @@
|
|
|
2
2
|
* Website: https://dsh-plugin.org
|
|
3
3
|
* GitHub: https://github.com/dshplugin/dsh-plugin-hub
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* compact settings row height (18px vs the 28px input rows), so labels
|
|
8
|
-
* stay vertically centered without extra whitespace. */
|
|
5
|
+
* 设置行用的开关:小号 34×18 轨道 + 滑动圆钮。关 = 中性细线轨道;开 = 品牌填充。
|
|
6
|
+
* 尺寸贴合紧凑的设置行高(18px,输入行是 28px),让标签垂直居中且无多余留白。 */
|
|
9
7
|
|
|
10
8
|
.toggle,
|
|
11
9
|
.toggleOn {
|
|
@@ -2,26 +2,22 @@
|
|
|
2
2
|
* Website: https://dsh-plugin.org
|
|
3
3
|
* GitHub: https://github.com/dshplugin/dsh-plugin-hub
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* 插件中心设计变量。
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* underlying token. Declared on :root and on the dark body so every theme
|
|
10
|
-
* re-resolves the aliases against its own token set; the custom property is
|
|
11
|
-
* then inherited by all section elements.
|
|
7
|
+
* 对宿主 --dsw-alias-* 主题变量的语义别名,各带原始浅色字面量,供未定义底层变量的宿主兜底。
|
|
8
|
+
* 声明在 :root 与暗色 body 上,让每种主题都按自己的变量集重新解析别名,再由所有板块元素继承。
|
|
12
9
|
*
|
|
13
|
-
*
|
|
14
|
-
* new styles pick up the theme automatically. */
|
|
10
|
+
* 各区域样式表不要写颜色字面量:在此引用 --hub-*,新样式即可自动跟随主题。 */
|
|
15
11
|
:root,
|
|
16
12
|
body[data-ds-dark-theme] {
|
|
17
|
-
/*
|
|
13
|
+
/* 文本 */
|
|
18
14
|
--hub-text-primary: var(--dsw-alias-label-primary, #1f2328);
|
|
19
15
|
--hub-text-secondary: var(--dsw-alias-label-secondary, #6b7280);
|
|
20
16
|
--hub-text-tertiary: var(--dsw-alias-label-tertiary, #8b93a1);
|
|
21
17
|
--hub-text-disabled: var(--dsw-alias-label-disabled, #aab1bd);
|
|
22
18
|
--hub-text-on-fill: var(--dsw-alias-label-primary-foreground, #ffffff);
|
|
23
19
|
|
|
24
|
-
/*
|
|
20
|
+
/* 表面/背景 */
|
|
25
21
|
--hub-bg-1: var(--dsw-alias-bg-layer-1, #ffffff);
|
|
26
22
|
--hub-bg-2: var(--dsw-alias-bg-layer-2, rgba(128, 128, 128, 0.08));
|
|
27
23
|
--hub-bg-3: rgba(128, 128, 128, 0.1);
|
|
@@ -30,13 +26,13 @@ body[data-ds-dark-theme] {
|
|
|
30
26
|
--hub-bg-hover: var(--dsw-alias-interactive-bg-hover, rgba(128, 128, 128, 0.16));
|
|
31
27
|
--hub-bg-on-fill: rgba(128, 128, 128, 0.22);
|
|
32
28
|
|
|
33
|
-
/*
|
|
29
|
+
/* 边框 */
|
|
34
30
|
--hub-border-1: var(--dsw-alias-border-l1, #eceef1);
|
|
35
31
|
--hub-border-2: var(--dsw-alias-border-l2, #e5e7eb);
|
|
36
32
|
--hub-border-ghost: var(--dsw-alias-button-ghost-active-border, rgba(79, 110, 247, 0.25));
|
|
37
33
|
--hub-border-input: var(--dsw-alias-input-border, rgba(107, 114, 128, 0.25));
|
|
38
34
|
|
|
39
|
-
/*
|
|
35
|
+
/* 品牌色(两种主题固定) */
|
|
40
36
|
--hub-brand: var(--dsw-alias-state-business-primary, #4f6ef7);
|
|
41
37
|
--hub-brand-hover: #3b5bdb;
|
|
42
38
|
--hub-brand-tint: rgba(79, 110, 247, 0.06);
|
|
@@ -44,7 +40,7 @@ body[data-ds-dark-theme] {
|
|
|
44
40
|
--hub-brand-border: rgba(79, 110, 247, 0.35);
|
|
45
41
|
--hub-brand-border-soft: rgba(79, 110, 247, 0.22);
|
|
46
42
|
|
|
47
|
-
/*
|
|
43
|
+
/* 紫色品牌点缀(两种主题固定) */
|
|
48
44
|
--hub-purple-1: #4f46e5;
|
|
49
45
|
--hub-purple-2: #7c3aed;
|
|
50
46
|
--hub-purple-border: rgba(139, 92, 246, 0.55);
|
|
@@ -52,28 +48,28 @@ body[data-ds-dark-theme] {
|
|
|
52
48
|
--hub-purple-shadow: rgba(79, 70, 229, 0.28);
|
|
53
49
|
--hub-purple-shadow-strong: rgba(124, 58, 237, 0.42);
|
|
54
50
|
|
|
55
|
-
/*
|
|
51
|
+
/* 主操作按钮 */
|
|
56
52
|
--hub-btn-fill: var(--dsw-alias-button-primary-fill, #1f2328);
|
|
57
53
|
--hub-btn-hover: var(--dsw-alias-button-primary-hover, #43454a);
|
|
58
54
|
|
|
59
|
-
/*
|
|
55
|
+
/* 成功 */
|
|
60
56
|
--hub-success: #16a34a;
|
|
61
57
|
--hub-success-tint: rgba(22, 163, 74, 0.12);
|
|
62
58
|
--hub-success-border: rgba(22, 163, 74, 0.3);
|
|
63
59
|
|
|
64
|
-
/*
|
|
60
|
+
/* 警告(琥珀) */
|
|
65
61
|
--hub-warn: var(--dsw-alias-state-warn-primary, #b8860b);
|
|
66
62
|
--hub-warn-tint: rgba(184, 134, 11, 0.08);
|
|
67
63
|
--hub-warn-border: rgba(184, 134, 11, 0.35);
|
|
68
64
|
--hub-warn-strong: rgba(184, 134, 11, 0.85);
|
|
69
65
|
|
|
70
|
-
/*
|
|
66
|
+
/* 警告(深琥珀) */
|
|
71
67
|
--hub-warning: var(--dsw-alias-state-warning-primary, #b45309);
|
|
72
68
|
--hub-warning-hover: #92400e;
|
|
73
69
|
--hub-warning-tint: rgba(180, 83, 9, 0.08);
|
|
74
70
|
--hub-warning-border: rgba(180, 83, 9, 0.3);
|
|
75
71
|
|
|
76
|
-
/*
|
|
72
|
+
/* 危险 */
|
|
77
73
|
--hub-danger: var(--dsw-alias-state-danger-primary, #d1242f);
|
|
78
74
|
--hub-danger-hover: var(--dsw-alias-state-danger-hover, #b91c1c);
|
|
79
75
|
--hub-danger-strong: #b0202a;
|
package/src/client/types.ts
CHANGED
|
@@ -3,20 +3,20 @@
|
|
|
3
3
|
* Website: https://dsh-plugin.org
|
|
4
4
|
* GitHub: https://github.com/dshplugin/dsh-plugin-hub
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* dsh-plugin 浏览器客户端的共享类型。保持零依赖,任何客户端模块都能直接引入,
|
|
7
|
+
* 而不会连带拉入组件或样式。
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
export type LocaleId = 'zh' | 'en'
|
|
11
11
|
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
export type InstallChannel = 'npm'
|
|
12
|
+
/** 自定义安装入口渠道:仅 NPM 包。
|
|
13
|
+
* 客户端提交时显式上报,服务端落日志/报错提示据此溯源「从哪个入口发起」。 */
|
|
14
|
+
export type InstallChannel = 'npm'
|
|
15
15
|
|
|
16
|
-
/**
|
|
16
|
+
/** 宿主绑定与组件内字典共用的翻译函数签名。 */
|
|
17
17
|
export type Translate = (key: string, params?: Record<string, string | number>) => string
|
|
18
18
|
|
|
19
|
-
/**
|
|
19
|
+
/** 本插件用到的 locale 服务子集。 */
|
|
20
20
|
export interface LocaleService {
|
|
21
21
|
register(namespace: string, dicts: { zh: Record<string, string>; en: Record<string, string> }): unknown
|
|
22
22
|
bind(namespace: string): (key: string, params?: Record<string, string | number>) => string
|
|
@@ -27,13 +27,13 @@ export interface LocaleService {
|
|
|
27
27
|
setLocale(id: string): void
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
/**
|
|
30
|
+
/** 本插件用到的 slots 服务子集。 */
|
|
31
31
|
export interface SlotsService {
|
|
32
32
|
inject(slot: string, register: () => unknown): void
|
|
33
33
|
register(meta: Record<string, unknown>, component: () => unknown): unknown
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
/**
|
|
36
|
+
/** 本插件依赖的客户端 cordis 上下文形态(结构化)。 */
|
|
37
37
|
export interface HubClientContext {
|
|
38
38
|
effect(callback: () => unknown, label?: string): void
|
|
39
39
|
slots: SlotsService
|
|
@@ -45,7 +45,7 @@ export interface SectionProps {
|
|
|
45
45
|
locale: LocaleService
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
/**
|
|
48
|
+
/** 官网 DirectoryPlugin 条目的精简投影。 */
|
|
49
49
|
export interface HubPlugin {
|
|
50
50
|
/** 作者小写 key,与 slug 共同构成唯一身份(两级路径 /plugins/{ownerSlug}/{slug});可能缺省 */
|
|
51
51
|
ownerSlug?: string
|
|
@@ -60,7 +60,7 @@ export interface HubPlugin {
|
|
|
60
60
|
source?: { repo?: string; npmPackage?: string }
|
|
61
61
|
/** 安装信息:能否网页一键安装(false = 仅支持命令行/专属 profile,缺省视为 true);
|
|
62
62
|
* manualInstall = 人工干预标记(网页端一键安装替代不了终端的构建/装配,必须用户自己去终端装);
|
|
63
|
-
* command/githubCommand =
|
|
63
|
+
* command/githubCommand = 目录下发的权威安装命令,
|
|
64
64
|
* 仅供展示/复制 —— CLI-only 插件(如 dsh-tui)需专属 profile(--profile dsh-tui),
|
|
65
65
|
* 无法从 repo/npm 包名推断,必须用目录命令。 */
|
|
66
66
|
install?: { webInstallable?: boolean; manualInstall?: boolean; command?: string; githubCommand?: string }
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
* Website: https://dsh-plugin.org
|
|
4
4
|
* GitHub: https://github.com/dshplugin/dsh-plugin-hub
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
* and profile-level installed-package reads shared with the install/task modules.
|
|
6
|
+
* 目录代理路由:目录/统计载荷的服务端缓存,以及与安装/任务模块共享的 profile 级已装包读取。
|
|
8
7
|
*/
|
|
9
8
|
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs'
|
|
10
9
|
import { homedir } from 'node:os'
|
|
@@ -53,7 +52,7 @@ export function profileDirectory(profile: string): string {
|
|
|
53
52
|
return join(process.env.DSH_HOME ?? join(homedir(), '.dsh'), 'profiles', profile)
|
|
54
53
|
}
|
|
55
54
|
|
|
56
|
-
/**
|
|
55
|
+
/** 读取安装进某 profile 的非官方依赖。 */
|
|
57
56
|
export function readInstalled(profile: string): Record<string, string> {
|
|
58
57
|
try {
|
|
59
58
|
const manifest = JSON.parse(readFileSync(join(profileDirectory(profile), 'package.json'), 'utf8')) as {
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
* Website: https://dsh-plugin.org
|
|
4
4
|
* GitHub: https://github.com/dshplugin/dsh-plugin-hub
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
* and the host environment snapshot shared with the task module's /env route.
|
|
6
|
+
* 诊断路由:流式连通性自检、代理校验,以及与任务模块 /env 路由共享的宿主环境快照。
|
|
8
7
|
*/
|
|
9
8
|
import { readFileSync } from 'node:fs'
|
|
10
9
|
import { homedir, release } from 'node:os'
|
|
@@ -31,7 +30,7 @@ function hostDshVersion(): string | null {
|
|
|
31
30
|
return manifest.version
|
|
32
31
|
}
|
|
33
32
|
} catch {
|
|
34
|
-
/*
|
|
33
|
+
/* 不是包根,继续向上查找 */
|
|
35
34
|
}
|
|
36
35
|
const parent = dirname(dir)
|
|
37
36
|
if (parent === dir) break
|
|
@@ -95,8 +94,8 @@ export function registerDiagnosticsRoutes(webServer: WebServerService, profile:
|
|
|
95
94
|
path: '/dsh-plugin-hub/diagnostics',
|
|
96
95
|
handler: async (request, response) => {
|
|
97
96
|
if (!requireTrustedPost(request, response)) return
|
|
98
|
-
// 连通性自检:npm registry(镜像/官方)/ GitHub
|
|
99
|
-
//
|
|
97
|
+
// 连通性自检:npm registry(镜像/官方)/ GitHub / 目录站点,逐路探测并测速。
|
|
98
|
+
// npm 安装走 registry、目录数据走 dsh-plugin.org、GitHub 那一行用于反映插件运行时对 github.com 的可达性。
|
|
100
99
|
// 流式(NDJSON)逐条上报:每个探测先发命令行,完成后发结果行,客户端以黑窗口终端实时展示。
|
|
101
100
|
// 可选 body { key }:只重测指定通道(页面列表「重测」单项时用),缺省全量串行探测。
|
|
102
101
|
let onlyKey = ''
|
|
@@ -112,8 +111,8 @@ export function registerDiagnosticsRoutes(webServer: WebServerService, profile:
|
|
|
112
111
|
// npm 通道:设置里配置了镜像源就探测该镜像(安装通道吃同一个 registry);
|
|
113
112
|
// 未配置(空串)时探测官方源作为「跟随本机 npm 配置」的基础连通性参考。
|
|
114
113
|
const registry = settings.npmRegistry.replace(/\/+$/, '') || 'https://registry.npmjs.org'
|
|
115
|
-
//
|
|
116
|
-
//
|
|
114
|
+
// 连通性自检打各通道的轻量资源:npm 源拉包元数据、GitHub 行探小仓库、目录站探
|
|
115
|
+
// 小文件,避免拉取目录全量 JSON。
|
|
117
116
|
// npm 行 display:配置了镜像就显示镜像地址;未配置置空 —— 客户端显示「未配置(跟随本机 npm 配置)」。
|
|
118
117
|
const allChecks: Array<{ key: string; url: string; display: string; cmd: string; proxy?: string; git?: boolean }> = [
|
|
119
118
|
{ key: 'npm', url: `${registry}/dsh-plugin`, display: settings.npmRegistry !== '' ? registry : '', cmd: `npm view dsh-plugin version --registry ${registry}` },
|