@shellraining/dsh-plugin-updates 0.1.0 → 0.1.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 +4 -5
- package/lib/client.js +13 -136
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# dsh-plugin-updates
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
检查从 npm 安装的插件有没有新版本。插件页的「已安装插件」列表里可以逐个更新或全部更新,插件详情页里还能挑一个版本安装。
|
|
4
4
|
|
|
5
5
|
## 安装
|
|
6
6
|
|
|
@@ -11,12 +11,11 @@ dsh plugin --profile web add @shellraining/dsh-plugin-updates
|
|
|
11
11
|
## 使用
|
|
12
12
|
|
|
13
13
|
- **已安装插件列表**:有新版本时,「已安装插件」标题旁出现「全部更新(N)」,对应插件卡片的开关左边出现「更新到 x.y.z」。点卡片其他位置照常进入详情页。
|
|
14
|
-
- **更新标签**:打开侧栏的「插件」,切到「更新」,列出所有从 npm 安装的插件,以及当前版本、最新版本和检查状态。点插件名或「详情」会打开官方的插件详情页。
|
|
15
14
|
- **插件详情页**:有新版本时,标题旁显示「可更新」标签,右上角多一个「更新到 x.y.z」按钮。页面底部有版本列表,每个版本都能单独安装,不兼容当前 DSH 的版本不能点。
|
|
16
15
|
|
|
17
16
|
只检查依赖记录为 `包名@版本范围` 的插件。Git、本地目录、tarball 来源的插件和 DSH 官方插件都会跳过。
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
打开插件页或详情页时检查一次,结果缓存 10 分钟,过期后再打开会重新查询。查询直接从浏览器读 npm registry,用的是 profile 中 pnpm 配置的源,查不到时再试插件管理器配置的备选源(默认是 npmmirror)。需要认证的私有源无法检查。
|
|
20
19
|
|
|
21
20
|
## 更新是怎么做的
|
|
22
21
|
|
|
@@ -24,9 +23,9 @@ dsh plugin --profile web add @shellraining/dsh-plugin-updates
|
|
|
24
23
|
|
|
25
24
|
卸载后安装失败时,插件会保持未安装状态,提示里会显示 pnpm 的输出,并提供「恢复」按钮,按原来的版本重新安装。发布不足 24 小时的版本会标为「新发布」,pnpm 开启 `minimumReleaseAge` 时,这类版本可能装不上。
|
|
26
25
|
|
|
27
|
-
|
|
26
|
+
本插件不能在页面里更新自己,因为卸载自己时界面也会一起卸载。有新版本时,它的详情页会给出对应的 `dsh plugin` 命令,退出 DSH 后在终端运行即可。
|
|
28
27
|
|
|
29
|
-
官方列表没有给卡片开放扩展点,列表上的按钮靠 `data-plugin-group="bundles"`、`data-plugin-package` 和开关的 `role="switch"` 这几个语义属性定位,见 `src/client/anchors.ts`。DSH
|
|
28
|
+
官方列表没有给卡片开放扩展点,列表上的按钮靠 `data-plugin-group="bundles"`、`data-plugin-package` 和开关的 `role="switch"` 这几个语义属性定位,见 `src/client/anchors.ts`。DSH 改了这部分结构时,列表上的按钮会消失,详情页不受影响。
|
|
30
29
|
|
|
31
30
|
## 开发
|
|
32
31
|
|
package/lib/client.js
CHANGED
|
@@ -1265,29 +1265,14 @@ module.exports = __toCommonJS(index_exports);
|
|
|
1265
1265
|
// src/client/locale.ts
|
|
1266
1266
|
var LOCALE_NS = "dshPluginUpdates";
|
|
1267
1267
|
var ZH = {
|
|
1268
|
-
"tab": "\u66F4\u65B0",
|
|
1269
|
-
"summary.loading": "\u6B63\u5728\u68C0\u67E5\u66F4\u65B0\u2026",
|
|
1270
|
-
"summary.some": "{count} \u4E2A\u63D2\u4EF6\u53EF\u66F4\u65B0",
|
|
1271
|
-
"summary.none": "\u6240\u6709 npm \u63D2\u4EF6\u90FD\u5DF2\u662F\u6700\u65B0\u7248\u672C",
|
|
1272
|
-
"summary.empty": "\u6CA1\u6709\u4ECE npm \u5B89\u88C5\u7684\u63D2\u4EF6",
|
|
1273
|
-
"summary.skipped": "{count} \u4E2A\u63D2\u4EF6\u4E0D\u662F\u4ECE npm \u5B89\u88C5\u7684\uFF0C\u672A\u68C0\u67E5",
|
|
1274
|
-
"refresh": "\u68C0\u67E5\u66F4\u65B0",
|
|
1275
|
-
"updateAll": "\u5168\u90E8\u66F4\u65B0",
|
|
1276
1268
|
"updateAllCount": "\u5168\u90E8\u66F4\u65B0\uFF08{count}\uFF09",
|
|
1277
1269
|
"updateLabel": "\u628A {name} \u66F4\u65B0\u5230 {version}",
|
|
1278
1270
|
"updating": "\u66F4\u65B0\u4E2D\u2026",
|
|
1279
|
-
"update": "\u66F4\u65B0",
|
|
1280
1271
|
"updateTo": "\u66F4\u65B0\u5230 {version}",
|
|
1281
1272
|
"install": "\u5B89\u88C5",
|
|
1282
|
-
"details": "\u8BE6\u60C5",
|
|
1283
|
-
"loadFailed": "\u8BFB\u53D6\u63D2\u4EF6\u5217\u8868\u5931\u8D25\uFF1A{reason}",
|
|
1284
|
-
"retry": "\u91CD\u8BD5",
|
|
1285
1273
|
"status.update": "\u53EF\u66F4\u65B0 {version}",
|
|
1286
|
-
"
|
|
1287
|
-
"status.checking": "\u68C0\u67E5\u4E2D",
|
|
1288
|
-
"status.failed": "\u67E5\u8BE2\u5931\u8D25",
|
|
1274
|
+
"versions.loading": "\u6B63\u5728\u8BFB\u53D6\u7248\u672C\u2026",
|
|
1289
1275
|
"version.current": "\u5F53\u524D {version}",
|
|
1290
|
-
"version.arrow": "{from} \u2192 {to}",
|
|
1291
1276
|
"versions.title": "\u7248\u672C",
|
|
1292
1277
|
"versions.registry": "\u6765\u81EA {registry}",
|
|
1293
1278
|
"versions.showAll": "\u663E\u793A\u5168\u90E8 {count} \u4E2A\u7248\u672C",
|
|
@@ -1316,29 +1301,14 @@ var ZH = {
|
|
|
1316
1301
|
"op.log": "\u65E5\u5FD7\uFF1A{path}"
|
|
1317
1302
|
};
|
|
1318
1303
|
var EN = {
|
|
1319
|
-
"tab": "Updates",
|
|
1320
|
-
"summary.loading": "Checking for updates\u2026",
|
|
1321
|
-
"summary.some": "{count} plugin(s) can be updated",
|
|
1322
|
-
"summary.none": "All npm plugins are up to date",
|
|
1323
|
-
"summary.empty": "No plugins were installed from npm",
|
|
1324
|
-
"summary.skipped": "{count} plugin(s) not installed from npm were skipped",
|
|
1325
|
-
"refresh": "Check for updates",
|
|
1326
|
-
"updateAll": "Update all",
|
|
1327
1304
|
"updateAllCount": "Update all ({count})",
|
|
1328
1305
|
"updateLabel": "Update {name} to {version}",
|
|
1329
1306
|
"updating": "Updating\u2026",
|
|
1330
|
-
"update": "Update",
|
|
1331
1307
|
"updateTo": "Update to {version}",
|
|
1332
1308
|
"install": "Install",
|
|
1333
|
-
"details": "Details",
|
|
1334
|
-
"loadFailed": "Could not read the plugin list: {reason}",
|
|
1335
|
-
"retry": "Retry",
|
|
1336
1309
|
"status.update": "Update {version}",
|
|
1337
|
-
"
|
|
1338
|
-
"status.checking": "Checking",
|
|
1339
|
-
"status.failed": "Check failed",
|
|
1310
|
+
"versions.loading": "Reading versions\u2026",
|
|
1340
1311
|
"version.current": "Current {version}",
|
|
1341
|
-
"version.arrow": "{from} \u2192 {to}",
|
|
1342
1312
|
"versions.title": "Versions",
|
|
1343
1313
|
"versions.registry": "From {registry}",
|
|
1344
1314
|
"versions.showAll": "Show all {count} versions",
|
|
@@ -1416,7 +1386,7 @@ var UpdatesStore = class {
|
|
|
1416
1386
|
this.ctx = ctx;
|
|
1417
1387
|
}
|
|
1418
1388
|
ctx;
|
|
1419
|
-
state = { status: "idle", candidates: [],
|
|
1389
|
+
state = { status: "idle", candidates: [], lookups: {} };
|
|
1420
1390
|
listeners = /* @__PURE__ */ new Set();
|
|
1421
1391
|
generation = 0;
|
|
1422
1392
|
disposed = false;
|
|
@@ -1441,25 +1411,21 @@ var UpdatesStore = class {
|
|
|
1441
1411
|
setLookup(name2, lookup) {
|
|
1442
1412
|
this.patch({ lookups: { ...this.state.lookups, [name2]: lookup } });
|
|
1443
1413
|
}
|
|
1444
|
-
/** A page opened: read the list the first time, and
|
|
1414
|
+
/** A page opened: read the list the first time, after a failure, and once a lookup is older than the cache. */
|
|
1445
1415
|
ensure = () => {
|
|
1446
1416
|
const now = Date.now();
|
|
1447
1417
|
const stale = Object.values(this.state.lookups).some((lookup) => lookup.status === "ready" && now - lookup.at > CACHE_MS);
|
|
1448
|
-
if (this.state.status === "idle" || this.state.status === "ready" && stale) void this.load(
|
|
1449
|
-
};
|
|
1450
|
-
/** Re-read the list and every lookup. */
|
|
1451
|
-
refresh = () => {
|
|
1452
|
-
void this.load(true);
|
|
1418
|
+
if (this.state.status === "idle" || this.state.status === "error" || this.state.status === "ready" && stale) void this.load();
|
|
1453
1419
|
};
|
|
1454
1420
|
/** Re-read the list after a Host change; lookups stay cached. */
|
|
1455
1421
|
bundlesChanged = () => {
|
|
1456
|
-
if (this.state.status !== "idle") void this.load(
|
|
1422
|
+
if (this.state.status !== "idle") void this.load();
|
|
1457
1423
|
};
|
|
1458
|
-
async load(
|
|
1424
|
+
async load() {
|
|
1459
1425
|
const generation = ++this.generation;
|
|
1460
1426
|
this.patch({ status: this.state.status === "ready" ? "ready" : "loading" });
|
|
1461
1427
|
const pm = this.ctx.remote.pluginManager;
|
|
1462
|
-
if (
|
|
1428
|
+
if (this.registries === void 0) {
|
|
1463
1429
|
const [registries, exemptions] = await Promise.all([pm.registries(), pm.listVersionExemptions()]);
|
|
1464
1430
|
if (registries.ok) {
|
|
1465
1431
|
const first = registries.value.registry ?? registries.value.resolved ?? DEFAULT_REGISTRY;
|
|
@@ -1470,7 +1436,7 @@ var UpdatesStore = class {
|
|
|
1470
1436
|
const listed = await pm.listBundles();
|
|
1471
1437
|
if (generation !== this.generation) return;
|
|
1472
1438
|
if (!listed.ok) {
|
|
1473
|
-
this.patch({ status: "error"
|
|
1439
|
+
this.patch({ status: "error" });
|
|
1474
1440
|
return;
|
|
1475
1441
|
}
|
|
1476
1442
|
const resolve = (text) => text === void 0 ? void 0 : this.ctx.locale.resolveText(text);
|
|
@@ -1485,13 +1451,12 @@ var UpdatesStore = class {
|
|
|
1485
1451
|
...icon === void 0 ? {} : { icon }
|
|
1486
1452
|
};
|
|
1487
1453
|
}).sort((a, b) => a.title.localeCompare(b.title));
|
|
1488
|
-
|
|
1489
|
-
this.patch({ status: "ready", candidates, skipped: others.length - npm.length });
|
|
1454
|
+
this.patch({ status: "ready", candidates });
|
|
1490
1455
|
const now = Date.now();
|
|
1491
1456
|
for (const candidate of candidates) {
|
|
1492
1457
|
const lookup = this.state.lookups[candidate.name];
|
|
1493
1458
|
const stale = lookup === void 0 || lookup.status === "error" || lookup.status === "ready" && now - lookup.at > CACHE_MS;
|
|
1494
|
-
if (
|
|
1459
|
+
if (stale) void this.lookup(candidate.name);
|
|
1495
1460
|
}
|
|
1496
1461
|
}
|
|
1497
1462
|
async lookup(name2) {
|
|
@@ -1594,23 +1559,11 @@ var UpdatesStore = class {
|
|
|
1594
1559
|
// src/client/styles.ts
|
|
1595
1560
|
var STYLE_ID = "@shellraining/dsh-plugin-updates";
|
|
1596
1561
|
var CSS = `
|
|
1597
|
-
.dpu-
|
|
1562
|
+
.dpu-section { display: flex; flex-direction: column; gap: 12px; min-width: 0; color: var(--dsw-alias-label-primary); }
|
|
1598
1563
|
.dpu-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-height: 28px; }
|
|
1599
1564
|
.dpu-summary { flex: 1; min-width: 0; color: var(--dsw-alias-label-secondary); font-size: 13px; line-height: 20px; }
|
|
1600
1565
|
.dpu-caption { color: var(--dsw-alias-label-caption); font-size: 12px; line-height: 18px; }
|
|
1601
1566
|
.dpu-title { margin: 0; font-size: 14px; font-weight: 500; line-height: 20px; }
|
|
1602
|
-
.dpu-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
|
|
1603
|
-
.dpu-card { display: flex; align-items: center; gap: 14px; min-width: 0; margin: 0 -8px; padding: 8px; border-radius: var(--dsw-radius-xl); }
|
|
1604
|
-
.dpu-card:hover { background: var(--dsw-alias-interactive-bg-hover); }
|
|
1605
|
-
.dpu-icon { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; overflow: hidden; border: .5px solid var(--dsw-alias-border-l3); border-radius: var(--dsw-radius-lg); color: var(--dsw-alias-label-secondary); }
|
|
1606
|
-
.dpu-icon img { width: 100%; height: 100%; object-fit: cover; }
|
|
1607
|
-
.dpu-main { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
|
|
1608
|
-
.dpu-name-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }
|
|
1609
|
-
.dpu-name { min-width: 0; padding: 0; overflow: hidden; border: 0; background: none; color: inherit; font: inherit; font-size: 14px; font-weight: 500; line-height: 20px; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
|
|
1610
|
-
.dpu-name:hover { text-decoration: underline; }
|
|
1611
|
-
.dpu-name:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: 2px; }
|
|
1612
|
-
.dpu-meta { color: var(--dsw-alias-label-tertiary); font-size: 13px; line-height: 18px; font-variant-numeric: tabular-nums; }
|
|
1613
|
-
.dpu-end { flex: none; display: inline-flex; align-items: center; gap: 8px; }
|
|
1614
1567
|
.dpu-mono { font-family: var(--ds-font-family-code); font-variant-numeric: tabular-nums; }
|
|
1615
1568
|
.dpu-rows { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; border-top: .5px solid var(--dsw-alias-border-l2); }
|
|
1616
1569
|
.dpu-row { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 2px 0; border-bottom: .5px solid var(--dsw-alias-border-l2); }
|
|
@@ -1707,16 +1660,6 @@ function selfCommand(version) {
|
|
|
1707
1660
|
function dateText(stamp) {
|
|
1708
1661
|
return stamp === void 0 ? "" : new Date(stamp).toLocaleDateString();
|
|
1709
1662
|
}
|
|
1710
|
-
function Artwork({ src }) {
|
|
1711
|
-
const [broken, setBroken] = (0, import_react.useState)(false);
|
|
1712
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dpu-icon", "aria-hidden": "true", children: src === void 0 || broken ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.PluginArtworkDefault, { size: 28 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { src, alt: "", onError: () => setBroken(true) }) });
|
|
1713
|
-
}
|
|
1714
|
-
function StatusTag({ t, candidate, lookup }) {
|
|
1715
|
-
if (lookup === void 0 || lookup.status === "loading") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Tag, { tone: "quiet", children: t("status.checking") });
|
|
1716
|
-
if (lookup.status === "error") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Tag, { tone: "warning", children: t("status.failed") });
|
|
1717
|
-
const target = updateTarget(candidate, lookup);
|
|
1718
|
-
return target === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Tag, { tone: "quiet", children: t("status.latest") }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Tag, { tone: "info", children: t("status.update", { version: target }) });
|
|
1719
|
-
}
|
|
1720
1663
|
function SelfNotice({ t, version }) {
|
|
1721
1664
|
const [copied, setCopied] = (0, import_react.useState)(false);
|
|
1722
1665
|
const command = selfCommand(version);
|
|
@@ -1784,63 +1727,6 @@ function OperationBanner({ t, operation, actions }) {
|
|
|
1784
1727
|
failed && operation.logPath !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dpu-caption", children: t("op.log", { path: operation.logPath }) }) : null
|
|
1785
1728
|
] });
|
|
1786
1729
|
}
|
|
1787
|
-
function UpdatesTab({ t, useUpdates, actions, openPackage }) {
|
|
1788
|
-
const state = useUpdates((snapshot) => snapshot);
|
|
1789
|
-
(0, import_react.useEffect)(() => {
|
|
1790
|
-
actions.ensure();
|
|
1791
|
-
}, [actions]);
|
|
1792
|
-
const busy = isBusy(state.operation);
|
|
1793
|
-
const lookups = Object.values(state.lookups);
|
|
1794
|
-
const checking = state.status === "loading" || lookups.some((lookup) => lookup.status === "loading");
|
|
1795
|
-
const outdated = state.candidates.filter((item) => updateTarget(item, state.lookups[item.name]) !== void 0);
|
|
1796
|
-
const pending = outdated.filter((item) => item.name !== SELF);
|
|
1797
|
-
const self = outdated.find((item) => item.name === SELF);
|
|
1798
|
-
const selfTarget = self === void 0 ? void 0 : updateTarget(self, state.lookups[SELF]);
|
|
1799
|
-
let summary;
|
|
1800
|
-
if (state.status === "idle" || state.status === "loading" && state.candidates.length === 0) summary = t("summary.loading");
|
|
1801
|
-
else if (state.candidates.length === 0) summary = t("summary.empty");
|
|
1802
|
-
else if (outdated.length > 0) summary = t("summary.some", { count: outdated.length });
|
|
1803
|
-
else summary = checking ? t("summary.loading") : t("summary.none");
|
|
1804
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "dpu-tab", "aria-busy": checking, children: [
|
|
1805
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dpu-head", children: [
|
|
1806
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dpu-summary", role: "status", children: summary }),
|
|
1807
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "outline", icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives2.IconRefreshOutlineRegular, { size: 13 }), disabled: checking || busy, onClick: actions.refresh, children: t("refresh") }),
|
|
1808
|
-
pending.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "primary", disabled: busy, onClick: () => {
|
|
1809
|
-
void actions.updateAll();
|
|
1810
|
-
}, children: t("updateAll") }) : null
|
|
1811
|
-
] }),
|
|
1812
|
-
state.operation === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OperationBanner, { t, operation: state.operation, actions }),
|
|
1813
|
-
state.status === "error" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dpu-banner", "data-tone": "error", role: "alert", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dpu-banner-row", children: [
|
|
1814
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: t("loadFailed", { reason: state.error ?? "" }) }),
|
|
1815
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "outline", onClick: actions.refresh, children: t("retry") })
|
|
1816
|
-
] }) }) : null,
|
|
1817
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "dpu-list", children: state.candidates.map((candidate) => {
|
|
1818
|
-
const lookup = state.lookups[candidate.name];
|
|
1819
|
-
const target = updateTarget(candidate, lookup);
|
|
1820
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { className: "dpu-card", "data-plugin-updates-package": candidate.name, children: [
|
|
1821
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Artwork, { src: candidate.icon }),
|
|
1822
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dpu-main", children: [
|
|
1823
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dpu-name-row", children: [
|
|
1824
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: "dpu-name", title: candidate.name, onClick: () => openPackage(candidate.name), children: candidate.title }),
|
|
1825
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(StatusTag, { t, candidate, lookup })
|
|
1826
|
-
] }),
|
|
1827
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "dpu-meta", children: [
|
|
1828
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dpu-mono", children: target === void 0 ? candidate.version : t("version.arrow", { from: candidate.version, to: target }) }),
|
|
1829
|
-
lookup?.status === "error" ? ` \xB7 ${lookup.reason}` : ""
|
|
1830
|
-
] })
|
|
1831
|
-
] }),
|
|
1832
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dpu-end", children: [
|
|
1833
|
-
target !== void 0 && candidate.name !== SELF ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "outline", icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives2.IconDownloadOutlineRegular, { size: 13 }), disabled: busy, onClick: () => {
|
|
1834
|
-
void actions.install(candidate.name, target);
|
|
1835
|
-
}, children: t("update") }) : null,
|
|
1836
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "ghost", onClick: () => openPackage(candidate.name), children: t("details") })
|
|
1837
|
-
] })
|
|
1838
|
-
] }, candidate.name);
|
|
1839
|
-
}) }),
|
|
1840
|
-
state.skipped > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dpu-caption", children: t("summary.skipped", { count: state.skipped }) }) : null,
|
|
1841
|
-
selfTarget === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelfNotice, { t, version: selfTarget })
|
|
1842
|
-
] });
|
|
1843
|
-
}
|
|
1844
1730
|
function useSubject({ subject, useUpdates, actions }) {
|
|
1845
1731
|
const name2 = subject.kind === "bundle" ? subject.pkg.name : void 0;
|
|
1846
1732
|
const candidate = useUpdates((state) => state.candidates.find((item) => item.name === name2));
|
|
@@ -1888,7 +1774,7 @@ function DetailSection(props) {
|
|
|
1888
1774
|
const self = candidate.name === SELF;
|
|
1889
1775
|
const target = updateTarget(candidate, lookup);
|
|
1890
1776
|
let body;
|
|
1891
|
-
if (lookup === void 0 || lookup.status === "loading") body = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dpu-caption", children: t("
|
|
1777
|
+
if (lookup === void 0 || lookup.status === "loading") body = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dpu-caption", children: t("versions.loading") });
|
|
1892
1778
|
else if (lookup.status === "error") body = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dpu-error", children: t("versions.failed", { reason: lookup.reason }) });
|
|
1893
1779
|
else if (lookup.versions.length === 0) body = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dpu-caption", children: t("versions.empty") });
|
|
1894
1780
|
else {
|
|
@@ -1983,7 +1869,6 @@ function apply(ctx) {
|
|
|
1983
1869
|
hooks: { updates: store },
|
|
1984
1870
|
actions: {
|
|
1985
1871
|
ensure: store.ensure,
|
|
1986
|
-
refresh: store.refresh,
|
|
1987
1872
|
install: store.install,
|
|
1988
1873
|
updateAll: store.updateAll,
|
|
1989
1874
|
restore: store.restore,
|
|
@@ -1991,14 +1876,6 @@ function apply(ctx) {
|
|
|
1991
1876
|
toastDone: store.toastDone
|
|
1992
1877
|
}
|
|
1993
1878
|
};
|
|
1994
|
-
ctx.slots.inject("plugins.tab", () => ctx.slots.register({
|
|
1995
|
-
name: "plugins.tab",
|
|
1996
|
-
id: "updates",
|
|
1997
|
-
order: 10,
|
|
1998
|
-
label: () => t("tab"),
|
|
1999
|
-
locale: LOCALE_NS,
|
|
2000
|
-
inject: () => face
|
|
2001
|
-
}, UpdatesTab));
|
|
2002
1879
|
ctx.slots.inject("shell.overlay", () => ctx.slots.register({
|
|
2003
1880
|
name: "shell.overlay",
|
|
2004
1881
|
id: "plugin-updates.toast",
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shellraining/dsh-plugin-updates",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "在插件页检查 npm 来源插件的新版本,一键更新或安装指定版本",
|
|
6
6
|
"main": "./lib/index.js",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./lib/index.js",
|
|
@@ -14,10 +14,6 @@
|
|
|
14
14
|
"lib",
|
|
15
15
|
"cordis.patch.yml"
|
|
16
16
|
],
|
|
17
|
-
"scripts": {
|
|
18
|
-
"typecheck": "tsc -p tsconfig.json",
|
|
19
|
-
"build": "pnpm run typecheck && node build.mjs"
|
|
20
|
-
},
|
|
21
17
|
"engines": {
|
|
22
18
|
"node": ">=20"
|
|
23
19
|
},
|
|
@@ -59,5 +55,9 @@
|
|
|
59
55
|
],
|
|
60
56
|
"publishConfig": {
|
|
61
57
|
"access": "public"
|
|
58
|
+
},
|
|
59
|
+
"scripts": {
|
|
60
|
+
"typecheck": "tsc -p tsconfig.json",
|
|
61
|
+
"build": "pnpm run typecheck && node build.mjs"
|
|
62
62
|
}
|
|
63
|
-
}
|
|
63
|
+
}
|