dsh-update-status 0.4.8 → 0.5.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/CHANGELOG.md +13 -0
- package/README.md +99 -88
- package/README.zh.md +101 -90
- package/docs/RELEASING.md +10 -10
- package/lib/client.js +239 -117
- package/lib/client.js.map +1 -1
- package/lib/index.d.ts +35 -23
- package/lib/index.js +86 -75
- package/package.json +1 -17
package/lib/client.js
CHANGED
|
@@ -110,30 +110,18 @@ window.__ModuleLoader__.load({
|
|
|
110
110
|
zh: "当前运行版本",
|
|
111
111
|
en: "Current running version"
|
|
112
112
|
},
|
|
113
|
-
"panel.
|
|
114
|
-
zh: "
|
|
115
|
-
en: "
|
|
113
|
+
"panel.updatesFound": {
|
|
114
|
+
zh: "发现 {count} 个可升级版本",
|
|
115
|
+
en: "{count} newer version(s) available"
|
|
116
116
|
},
|
|
117
|
-
"panel.
|
|
118
|
-
zh: "
|
|
119
|
-
en: "
|
|
120
|
-
},
|
|
121
|
-
"panel.compatUnverified": {
|
|
122
|
-
zh: "尚未验证兼容",
|
|
123
|
-
en: "Compatibility unverified"
|
|
124
|
-
},
|
|
125
|
-
"panel.compatIncompatible": {
|
|
126
|
-
zh: "已知不兼容",
|
|
127
|
-
en: "Known incompatible"
|
|
117
|
+
"panel.latest": {
|
|
118
|
+
zh: "最新",
|
|
119
|
+
en: "Newest"
|
|
128
120
|
},
|
|
129
121
|
"panel.notChecked": {
|
|
130
122
|
zh: "尚未取得",
|
|
131
123
|
en: "Not available yet"
|
|
132
124
|
},
|
|
133
|
-
"panel.available": {
|
|
134
|
-
zh: "发现新版本",
|
|
135
|
-
en: "Update available"
|
|
136
|
-
},
|
|
137
125
|
"panel.currentState": {
|
|
138
126
|
zh: "已是最新",
|
|
139
127
|
en: "Up to date"
|
|
@@ -298,10 +286,6 @@ window.__ModuleLoader__.load({
|
|
|
298
286
|
zh: "无法按 SemVer 比较当前版本 {currentVersion} 与线上版本 {latestVersion}。",
|
|
299
287
|
en: "Unable to compare the current version {currentVersion} with the published version {latestVersion} using SemVer."
|
|
300
288
|
},
|
|
301
|
-
"warning.versionUnverified": {
|
|
302
|
-
zh: "线上版本 {version} 尚未验证与本插件兼容。",
|
|
303
|
-
en: "Version {version} has not been verified as compatible with this plugin."
|
|
304
|
-
},
|
|
305
289
|
"warning.staleSchemastery": {
|
|
306
290
|
zh: "本插件解析到的 @deepseek-ai/schemastery(版本 {version})来自 {path},不是 DSH 自带的那份,偏好字段无法标记为 volatile。请删除该残留目录并重启 DSH:rm -rf {nodeModulesDir}",
|
|
307
291
|
en: "This plugin resolved @deepseek-ai/schemastery {version} from {path} instead of the copy DSH provides, so preference fields cannot be marked volatile. Remove the stale directory and restart DSH: rm -rf {nodeModulesDir}"
|
|
@@ -338,7 +322,6 @@ window.__ModuleLoader__.load({
|
|
|
338
322
|
currentVersion: warning.currentVersion,
|
|
339
323
|
latestVersion: warning.latestVersion
|
|
340
324
|
}, language);
|
|
341
|
-
case "version-unverified": return t("warning.versionUnverified", { version: warning.version }, language);
|
|
342
325
|
case "stale-schemastery": {
|
|
343
326
|
const params = {
|
|
344
327
|
version: warning.version ?? "—",
|
|
@@ -356,10 +339,16 @@ window.__ModuleLoader__.load({
|
|
|
356
339
|
const warnings = status.warnings ?? [];
|
|
357
340
|
return warnings.length === 0 ? status.warning : warnings.map((item) => warningText(item, language)).join(" ");
|
|
358
341
|
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
342
|
+
/**
|
|
343
|
+
* Advice for an installation this plugin cannot hand a copyable command.
|
|
344
|
+
*
|
|
345
|
+
* `null` is the honest answer for an npm/pnpm global install: its candidate
|
|
346
|
+
* already carries a real command, so guidance prose there would only be noise.
|
|
347
|
+
*/
|
|
348
|
+
function localizedUpgradeGuidance(installKind, language = languageOf()) {
|
|
349
|
+
if (installKind === "source-checkout") return t("guidance.sourceCheckout", {}, language);
|
|
350
|
+
if (installKind === "unknown") return t("guidance.unknownInstall", {}, language);
|
|
351
|
+
return null;
|
|
363
352
|
}
|
|
364
353
|
//#endregion
|
|
365
354
|
//#region src/client/react.ts
|
|
@@ -385,11 +374,6 @@ window.__ModuleLoader__.load({
|
|
|
385
374
|
if (value.length <= 16) return value;
|
|
386
375
|
return value.slice(0, 15) + "…";
|
|
387
376
|
}
|
|
388
|
-
function compatibilityLabel(value) {
|
|
389
|
-
if (value === "verified") return t("panel.compatVerified");
|
|
390
|
-
if (value === "incompatible") return t("panel.compatIncompatible");
|
|
391
|
-
return t("panel.compatUnverified");
|
|
392
|
-
}
|
|
393
377
|
/** Persists a cache policy only; it never schedules a browser or Host timer. */
|
|
394
378
|
function CacheTtlControl({ preferences }) {
|
|
395
379
|
const snapshot = useObservable(preferences);
|
|
@@ -603,9 +587,9 @@ window.__ModuleLoader__.load({
|
|
|
603
587
|
kind: "error",
|
|
604
588
|
text: error
|
|
605
589
|
};
|
|
606
|
-
if (status
|
|
590
|
+
if (status !== null && status.releases.length > 0) return {
|
|
607
591
|
kind: "update",
|
|
608
|
-
text:
|
|
592
|
+
text: t("panel.updatesFound", { count: String(status.releases.length) })
|
|
609
593
|
};
|
|
610
594
|
if (status !== null) {
|
|
611
595
|
const warning = localizedWarning(status);
|
|
@@ -632,9 +616,12 @@ window.__ModuleLoader__.load({
|
|
|
632
616
|
} catch {}
|
|
633
617
|
}
|
|
634
618
|
/**
|
|
635
|
-
*
|
|
619
|
+
* One copy-only command and its own feedback.
|
|
620
|
+
*
|
|
621
|
+
* Each instance owns its clipboard state, so a card's "已复制" never appears on
|
|
622
|
+
* another card: the panel can show several commands at once.
|
|
636
623
|
*/
|
|
637
|
-
function
|
|
624
|
+
function CopyableCommand({ command, disabled, label }) {
|
|
638
625
|
const commandRef = React.useRef(null);
|
|
639
626
|
const [copyMessage, setCopyMessage] = React.useState(null);
|
|
640
627
|
const copy = async () => {
|
|
@@ -649,7 +636,7 @@ window.__ModuleLoader__.load({
|
|
|
649
636
|
}
|
|
650
637
|
};
|
|
651
638
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
652
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
639
|
+
label !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
653
640
|
className: "dus-command-label",
|
|
654
641
|
children: label
|
|
655
642
|
}),
|
|
@@ -674,13 +661,87 @@ window.__ModuleLoader__.load({
|
|
|
674
661
|
role: "status",
|
|
675
662
|
children: copyMessage
|
|
676
663
|
})]
|
|
677
|
-
}),
|
|
678
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
679
|
-
className: "dus-note",
|
|
680
|
-
children: note
|
|
681
664
|
})
|
|
682
665
|
] });
|
|
683
666
|
}
|
|
667
|
+
/** A labelled, copy-only command block, used by restart recovery. */
|
|
668
|
+
function CommandBlock({ command, disabled = false, label = t("panel.command"), note = t("panel.commandNote") }) {
|
|
669
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopyableCommand, {
|
|
670
|
+
command,
|
|
671
|
+
disabled,
|
|
672
|
+
label
|
|
673
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
674
|
+
className: "dus-note",
|
|
675
|
+
children: note
|
|
676
|
+
})] });
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* What the card area renders, decided as a pure function.
|
|
680
|
+
*
|
|
681
|
+
* It lives outside the JSX for the same reason `visualState` does: "nothing newer
|
|
682
|
+
* means no card and no command block at all" is a rule that regressions hide
|
|
683
|
+
* from, and a test can drive this directly without a DOM. The Host's array is
|
|
684
|
+
* already newest-first, so the client never re-sorts it — it only marks index 0.
|
|
685
|
+
*/
|
|
686
|
+
function releaseViewOf(status, language = languageOf()) {
|
|
687
|
+
const releases = status === null ? [] : status.releases;
|
|
688
|
+
const copyable = releases.some((release) => release.command !== null);
|
|
689
|
+
return {
|
|
690
|
+
rows: releases.map((release, index) => ({
|
|
691
|
+
release,
|
|
692
|
+
newest: index === 0
|
|
693
|
+
})),
|
|
694
|
+
copyable,
|
|
695
|
+
guidance: status !== null && releases.length > 0 && !copyable ? localizedUpgradeGuidance(status.installKind, language) : null
|
|
696
|
+
};
|
|
697
|
+
}
|
|
698
|
+
/**
|
|
699
|
+
* One upgradable version, top to bottom: what it is, when it shipped, and how to
|
|
700
|
+
* get it. `newest` is index 0 of the Host's array — the list arrives sorted, and
|
|
701
|
+
* the client must not re-sort a contract the Host already ordered.
|
|
702
|
+
*/
|
|
703
|
+
function ReleaseCard({ release, newest, disabled }) {
|
|
704
|
+
const published = timeText(release.publishedAt);
|
|
705
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("article", {
|
|
706
|
+
className: "dus-release",
|
|
707
|
+
"data-highlight": newest || void 0,
|
|
708
|
+
children: [
|
|
709
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
710
|
+
className: "dus-release-head",
|
|
711
|
+
children: [
|
|
712
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
|
|
713
|
+
className: "dus-release-version",
|
|
714
|
+
children: release.version
|
|
715
|
+
}),
|
|
716
|
+
newest && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
717
|
+
className: "dus-pill dus-pill-latest",
|
|
718
|
+
children: t("panel.latest")
|
|
719
|
+
}),
|
|
720
|
+
release.tag !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
721
|
+
className: "dus-pill",
|
|
722
|
+
children: release.tag
|
|
723
|
+
})
|
|
724
|
+
]
|
|
725
|
+
}),
|
|
726
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
727
|
+
className: "dus-release-meta",
|
|
728
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
729
|
+
className: "dus-release-line",
|
|
730
|
+
children: release.line
|
|
731
|
+
}), published !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
|
|
732
|
+
t("panel.publishedAt"),
|
|
733
|
+
": ",
|
|
734
|
+
published
|
|
735
|
+
] })]
|
|
736
|
+
}),
|
|
737
|
+
release.command !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopyableCommand, {
|
|
738
|
+
command: release.command,
|
|
739
|
+
disabled,
|
|
740
|
+
label: null
|
|
741
|
+
})
|
|
742
|
+
]
|
|
743
|
+
});
|
|
744
|
+
}
|
|
684
745
|
/** Full detail from whichever page the operator is on (the transport is authenticated). */
|
|
685
746
|
function UpdatePanel({ ui }) {
|
|
686
747
|
const panel = useObservable(ui.panel);
|
|
@@ -715,8 +776,7 @@ window.__ModuleLoader__.load({
|
|
|
715
776
|
const status = snapshot.status;
|
|
716
777
|
const warning = status === null ? null : localizedWarning(status);
|
|
717
778
|
const summary = statusSummary(status, snapshot.loading, snapshot.error);
|
|
718
|
-
const
|
|
719
|
-
const command = status === null || !hasUpdate ? "" : localizedUpgradeGuidance(status);
|
|
779
|
+
const view = releaseViewOf(status);
|
|
720
780
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("dialog", {
|
|
721
781
|
ref: dialogRef,
|
|
722
782
|
className: "dus-overlay-root",
|
|
@@ -762,61 +822,32 @@ window.__ModuleLoader__.load({
|
|
|
762
822
|
}),
|
|
763
823
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
764
824
|
className: "dus-metadata",
|
|
765
|
-
children: [
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
825
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
826
|
+
className: "dus-metadata-row",
|
|
827
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
828
|
+
className: "dus-meta-label",
|
|
829
|
+
children: t("panel.current")
|
|
830
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
|
|
831
|
+
className: "dus-meta-value",
|
|
832
|
+
children: status?.currentVersion ?? "…"
|
|
833
|
+
})]
|
|
834
|
+
}), status?.checkedAt !== null && status?.checkedAt !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
835
|
+
className: "dus-metadata-row",
|
|
836
|
+
children: [
|
|
837
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
769
838
|
className: "dus-meta-label",
|
|
770
|
-
children: t("panel.
|
|
771
|
-
}),
|
|
839
|
+
children: t("panel.checkedAt")
|
|
840
|
+
}),
|
|
841
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
772
842
|
className: "dus-meta-value",
|
|
773
|
-
children: status
|
|
774
|
-
})
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
children: t("panel.newer")
|
|
782
|
-
}),
|
|
783
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
|
|
784
|
-
className: "dus-meta-value",
|
|
785
|
-
children: status.latestVersion
|
|
786
|
-
}),
|
|
787
|
-
status.publishedAt !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
788
|
-
className: "dus-meta-sub",
|
|
789
|
-
children: [
|
|
790
|
-
t("panel.publishedAt"),
|
|
791
|
-
": ",
|
|
792
|
-
timeText(status.publishedAt)
|
|
793
|
-
]
|
|
794
|
-
}),
|
|
795
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
796
|
-
className: "dus-meta-sub dus-compat",
|
|
797
|
-
"data-compatibility": status.compatibility,
|
|
798
|
-
children: compatibilityLabel(status.compatibility)
|
|
799
|
-
})
|
|
800
|
-
]
|
|
801
|
-
}),
|
|
802
|
-
status?.checkedAt !== null && status?.checkedAt !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
803
|
-
className: "dus-metadata-row",
|
|
804
|
-
children: [
|
|
805
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
806
|
-
className: "dus-meta-label",
|
|
807
|
-
children: t("panel.checkedAt")
|
|
808
|
-
}),
|
|
809
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
810
|
-
className: "dus-meta-value",
|
|
811
|
-
children: timeText(status.checkedAt)
|
|
812
|
-
}),
|
|
813
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
814
|
-
className: "dus-meta-sub",
|
|
815
|
-
children: status.cached ? t("panel.cached") : t("panel.live")
|
|
816
|
-
})
|
|
817
|
-
]
|
|
818
|
-
})
|
|
819
|
-
]
|
|
843
|
+
children: timeText(status.checkedAt)
|
|
844
|
+
}),
|
|
845
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
846
|
+
className: "dus-meta-sub",
|
|
847
|
+
children: status.cached ? t("panel.cached") : t("panel.live")
|
|
848
|
+
})
|
|
849
|
+
]
|
|
850
|
+
})]
|
|
820
851
|
}),
|
|
821
852
|
warning !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
822
853
|
className: "dus-warning",
|
|
@@ -856,9 +887,21 @@ window.__ModuleLoader__.load({
|
|
|
856
887
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(RestartControl, { restart: ui.restart })
|
|
857
888
|
]
|
|
858
889
|
}),
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
890
|
+
view.rows.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
891
|
+
className: "dus-releases",
|
|
892
|
+
children: view.rows.map((row) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ReleaseCard, {
|
|
893
|
+
release: row.release,
|
|
894
|
+
newest: row.newest,
|
|
895
|
+
disabled: snapshot.loading
|
|
896
|
+
}, row.release.version))
|
|
897
|
+
}),
|
|
898
|
+
view.copyable && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
899
|
+
className: "dus-note",
|
|
900
|
+
children: t("panel.commandNote")
|
|
901
|
+
}),
|
|
902
|
+
view.guidance !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
903
|
+
className: "dus-guidance",
|
|
904
|
+
children: view.guidance
|
|
862
905
|
}),
|
|
863
906
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
864
907
|
className: "dus-note",
|
|
@@ -958,10 +1001,6 @@ window.__ModuleLoader__.load({
|
|
|
958
1001
|
currentVersion: record.currentVersion,
|
|
959
1002
|
latestVersion: record.latestVersion
|
|
960
1003
|
};
|
|
961
|
-
if (record.code === "version-unverified" && typeof record.version === "string") return {
|
|
962
|
-
code: record.code,
|
|
963
|
-
version: record.version
|
|
964
|
-
};
|
|
965
1004
|
if (record.code === "stale-schemastery") {
|
|
966
1005
|
const version = record.version === null ? null : stringOrNull(record.version);
|
|
967
1006
|
const nodeModulesDir = record.nodeModulesDir === null ? null : stringOrNull(record.nodeModulesDir);
|
|
@@ -974,19 +1013,94 @@ window.__ModuleLoader__.load({
|
|
|
974
1013
|
};
|
|
975
1014
|
}
|
|
976
1015
|
}
|
|
1016
|
+
function installKindOf(value) {
|
|
1017
|
+
return value === "npm-global" || value === "pnpm-global" || value === "source-checkout" || value === "unknown" ? value : void 0;
|
|
1018
|
+
}
|
|
1019
|
+
/**
|
|
1020
|
+
* A field the contract types as `string | null`.
|
|
1021
|
+
*
|
|
1022
|
+
* `null` is a value the Host chose to send; `undefined` means it was missing or
|
|
1023
|
+
* malformed, which a caller turns into a rejection.
|
|
1024
|
+
*/
|
|
1025
|
+
function nullableString(value) {
|
|
1026
|
+
if (value === null) return null;
|
|
1027
|
+
return typeof value === "string" && value !== "" ? value : void 0;
|
|
1028
|
+
}
|
|
1029
|
+
/**
|
|
1030
|
+
* One upgradable version, exactly as the Host described it.
|
|
1031
|
+
*
|
|
1032
|
+
* Every field is required by the contract, so a missing `line` or a numeric
|
|
1033
|
+
* `tag` rejects the whole payload instead of rendering a half-filled card: the
|
|
1034
|
+
* card list is the panel's whole answer, and a wrong one is worse than a read
|
|
1035
|
+
* error the operator can retry.
|
|
1036
|
+
*/
|
|
1037
|
+
function releaseCandidateOf(value) {
|
|
1038
|
+
const record = objectOf(value);
|
|
1039
|
+
if (record === void 0) return void 0;
|
|
1040
|
+
if (typeof record.version !== "string" || record.version === "") return void 0;
|
|
1041
|
+
if (typeof record.line !== "string" || record.line === "") return void 0;
|
|
1042
|
+
const tag = nullableString(record.tag);
|
|
1043
|
+
const publishedAt = nullableString(record.publishedAt);
|
|
1044
|
+
const command = record.command === "" ? null : nullableString(record.command);
|
|
1045
|
+
if (tag === void 0 || publishedAt === void 0 || command === void 0) return void 0;
|
|
1046
|
+
return {
|
|
1047
|
+
version: record.version,
|
|
1048
|
+
tag,
|
|
1049
|
+
publishedAt,
|
|
1050
|
+
line: record.line,
|
|
1051
|
+
command
|
|
1052
|
+
};
|
|
1053
|
+
}
|
|
1054
|
+
/** The release line of a version: no SemVer maths needed, the Host's own rule. */
|
|
1055
|
+
function releaseLineOf(version) {
|
|
1056
|
+
return version.split("-", 1)[0] ?? version;
|
|
1057
|
+
}
|
|
1058
|
+
/**
|
|
1059
|
+
* A 0.4.x Host answered with a single `latestVersion` plus its `upgradeCommand`.
|
|
1060
|
+
*
|
|
1061
|
+
* A client bundle that hot-reloads over that Host must keep the page alive, so
|
|
1062
|
+
* the one candidate those fields describe is synthesized instead of rejecting a
|
|
1063
|
+
* payload the Host is still entitled to send. `tag` is null because the legacy
|
|
1064
|
+
* shape never carried it.
|
|
1065
|
+
*/
|
|
1066
|
+
function legacyReleaseOf(record, installKind) {
|
|
1067
|
+
if (typeof record.latestVersion !== "string" || record.latestVersion === "") return void 0;
|
|
1068
|
+
const publishedAt = record.publishedAt === void 0 ? null : nullableString(record.publishedAt);
|
|
1069
|
+
if (publishedAt === void 0) return void 0;
|
|
1070
|
+
const command = installKind === "npm-global" || installKind === "pnpm-global" ? typeof record.upgradeCommand === "string" && record.upgradeCommand !== "" ? record.upgradeCommand : null : null;
|
|
1071
|
+
return {
|
|
1072
|
+
version: record.latestVersion,
|
|
1073
|
+
tag: null,
|
|
1074
|
+
publishedAt,
|
|
1075
|
+
line: releaseLineOf(record.latestVersion),
|
|
1076
|
+
command
|
|
1077
|
+
};
|
|
1078
|
+
}
|
|
977
1079
|
/** Reject malformed RPC output before it reaches a slot component. */
|
|
978
1080
|
function updateStatusOf(value) {
|
|
979
1081
|
if (value === null || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
980
1082
|
const record = value;
|
|
981
|
-
if (typeof record.currentVersion !== "string" || typeof record.hasUpdate !== "boolean" || typeof record.cached !== "boolean" || typeof record.
|
|
982
|
-
|
|
983
|
-
if (
|
|
984
|
-
const latestVersion = record.latestVersion === null ? null : stringOrNull(record.latestVersion);
|
|
1083
|
+
if (typeof record.currentVersion !== "string" || typeof record.hasUpdate !== "boolean" || typeof record.cached !== "boolean" || typeof record.releaseUrl !== "string" || typeof record.changelogUrl !== "string" || typeof record.packageName !== "string" || record.canApplyInPlace !== false) return void 0;
|
|
1084
|
+
const installKind = installKindOf(record.installKind);
|
|
1085
|
+
if (installKind === void 0) return void 0;
|
|
985
1086
|
const checkedAt = record.checkedAt === null ? null : stringOrNull(record.checkedAt);
|
|
986
1087
|
const warning = record.warning === null ? null : stringOrNull(record.warning);
|
|
987
1088
|
const warningKind = record.warningKind === "failure" || record.warningKind === "notice" ? record.warningKind : void 0;
|
|
988
|
-
|
|
989
|
-
|
|
1089
|
+
if (record.checkedAt !== null && checkedAt === null || record.warning !== null && warning === null) return void 0;
|
|
1090
|
+
const releases = [];
|
|
1091
|
+
if (record.releases !== void 0) {
|
|
1092
|
+
if (!Array.isArray(record.releases)) return void 0;
|
|
1093
|
+
for (const raw of record.releases) {
|
|
1094
|
+
const parsed = releaseCandidateOf(raw);
|
|
1095
|
+
if (parsed === void 0) return void 0;
|
|
1096
|
+
releases.push(parsed);
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
if (releases.length === 0 && record.hasUpdate === true) {
|
|
1100
|
+
const legacy = legacyReleaseOf(record, installKind);
|
|
1101
|
+
if (legacy !== void 0) releases.push(legacy);
|
|
1102
|
+
}
|
|
1103
|
+
if (record.hasUpdate !== releases.length > 0) return void 0;
|
|
990
1104
|
const warnings = [];
|
|
991
1105
|
if (record.warnings !== void 0) {
|
|
992
1106
|
if (!Array.isArray(record.warnings)) return void 0;
|
|
@@ -998,19 +1112,16 @@ window.__ModuleLoader__.load({
|
|
|
998
1112
|
}
|
|
999
1113
|
return {
|
|
1000
1114
|
currentVersion: record.currentVersion,
|
|
1001
|
-
|
|
1115
|
+
releases,
|
|
1002
1116
|
hasUpdate: record.hasUpdate,
|
|
1003
|
-
compatibility: record.compatibility,
|
|
1004
1117
|
cached: record.cached,
|
|
1005
1118
|
checkedAt,
|
|
1006
1119
|
warning,
|
|
1007
1120
|
warningKind,
|
|
1008
1121
|
warnings,
|
|
1009
|
-
installKind
|
|
1010
|
-
upgradeCommand: record.upgradeCommand,
|
|
1122
|
+
installKind,
|
|
1011
1123
|
releaseUrl: record.releaseUrl,
|
|
1012
1124
|
changelogUrl: record.changelogUrl,
|
|
1013
|
-
publishedAt,
|
|
1014
1125
|
packageName: record.packageName,
|
|
1015
1126
|
canApplyInPlace: false
|
|
1016
1127
|
};
|
|
@@ -1980,6 +2091,20 @@ window.__ModuleLoader__.load({
|
|
|
1980
2091
|
.dus-meta-label{color:var(--dsw-alias-label-secondary);font-size:12px}
|
|
1981
2092
|
.dus-meta-value{font-family:var(--dsw-font-family-mono,ui-monospace,SFMono-Regular,Menlo,monospace);font-size:12px;max-width:210px;overflow-wrap:anywhere;text-align:right}
|
|
1982
2093
|
.dus-meta-sub{color:var(--dsw-alias-label-secondary);font-size:11px;grid-column:1 / -1}
|
|
2094
|
+
/* One card per upgradable version. Every value here is a theme token, so the
|
|
2095
|
+
cards follow light, dark and OS-following appearances with no plugin-side
|
|
2096
|
+
detection; only the highest version's border changes, because "newest" is the
|
|
2097
|
+
single fact that must survive a glance at a multi-card list. */
|
|
2098
|
+
.dus-releases{display:grid;gap:9px;margin:0 0 12px}
|
|
2099
|
+
.dus-release{background:var(--dsw-alias-bg-layer-3);border:1px solid var(--dsw-alias-border-l2);border-radius:10px;padding:9px}
|
|
2100
|
+
.dus-release[data-highlight=true]{border-color:var(--dsw-alias-state-warn-primary)}
|
|
2101
|
+
.dus-release-head{align-items:center;display:flex;flex-wrap:wrap;gap:6px}
|
|
2102
|
+
.dus-release-version{font-family:var(--dsw-font-family-mono,ui-monospace,SFMono-Regular,Menlo,monospace);font-size:12px;font-weight:650;overflow-wrap:anywhere}
|
|
2103
|
+
.dus-release-meta{align-items:baseline;color:var(--dsw-alias-label-secondary);display:flex;flex-wrap:wrap;font-size:11px;gap:2px 8px;line-height:1.45;margin:5px 0 0}
|
|
2104
|
+
.dus-release-line{font-family:var(--dsw-font-family-mono,ui-monospace,SFMono-Regular,Menlo,monospace);font-variant-numeric:tabular-nums}
|
|
2105
|
+
.dus-pill{border:1px solid var(--dsw-alias-border-l2);border-radius:999px;color:var(--dsw-alias-label-secondary);font-size:10px;line-height:16px;padding:0 6px;white-space:nowrap}
|
|
2106
|
+
.dus-pill-latest{border-color:var(--dsw-alias-state-warn-primary);color:var(--dsw-alias-state-warn-primary);font-weight:600}
|
|
2107
|
+
.dus-guidance{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:1.45;margin:0 0 12px}
|
|
1983
2108
|
.dus-warning{border-left:2px solid var(--dsw-alias-state-warn-primary);color:var(--dsw-alias-label-secondary);font-size:12px;line-height:1.45;margin:0 0 12px;padding-left:8px}
|
|
1984
2109
|
.dus-actions{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 12px}
|
|
1985
2110
|
.dus-action{background:var(--dsw-alias-button-floating-fill);border:1px solid var(--dsw-alias-border-l2);border-radius:8px;color:inherit;cursor:pointer;font-size:12px;line-height:30px;min-height:32px;padding:0 10px;touch-action:manipulation}
|
|
@@ -1998,9 +2123,6 @@ window.__ModuleLoader__.load({
|
|
|
1998
2123
|
.dus-command:focus{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}
|
|
1999
2124
|
.dus-note{color:var(--dsw-alias-label-secondary);font-size:11px;line-height:1.45;margin:8px 0 0}
|
|
2000
2125
|
.dus-copy-message{color:var(--dsw-alias-state-business-primary);font-size:11px;margin:7px 0 0}
|
|
2001
|
-
.dus-compat{color:var(--dsw-alias-label-secondary)}
|
|
2002
|
-
.dus-compat[data-compatibility=verified]{color:var(--dsw-alias-state-success-primary)}
|
|
2003
|
-
.dus-compat[data-compatibility=incompatible]{color:var(--dsw-alias-state-error-primary)}
|
|
2004
2126
|
.dus-command-actions{align-items:center;margin:8px 0 0}
|
|
2005
2127
|
@media (max-width:640px),(hover:none) and (pointer:coarse){.dus-panel{border-bottom:0;border-bottom-left-radius:0;border-bottom-right-radius:0;bottom:0;left:0;right:0;max-height:min(78dvh,calc(100dvh - env(safe-area-inset-top)));padding:16px max(16px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));position:fixed;top:auto;width:100vw}.dus-action{min-height:40px;line-height:38px}.dus-close{height:40px;min-height:40px;min-width:40px;width:40px}}
|
|
2006
2128
|
`;
|