dsh-update-status 0.4.8 → 0.5.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/CHANGELOG.md +24 -0
- package/README.md +112 -90
- package/README.zh.md +114 -92
- package/docs/RELEASING.md +25 -11
- package/lib/client.js +240 -117
- package/lib/client.js.map +1 -1
- package/lib/index.d.ts +35 -23
- package/lib/index.js +86 -75
- package/package.json +4 -20
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",
|
|
@@ -735,6 +795,7 @@ window.__ModuleLoader__.load({
|
|
|
735
795
|
role: "dialog",
|
|
736
796
|
"aria-modal": "true",
|
|
737
797
|
"aria-label": t("panel.title"),
|
|
798
|
+
"data-window-drag-exclude": "",
|
|
738
799
|
onClick: (event) => {
|
|
739
800
|
event.stopPropagation();
|
|
740
801
|
},
|
|
@@ -762,61 +823,32 @@ window.__ModuleLoader__.load({
|
|
|
762
823
|
}),
|
|
763
824
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
764
825
|
className: "dus-metadata",
|
|
765
|
-
children: [
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
826
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
827
|
+
className: "dus-metadata-row",
|
|
828
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
829
|
+
className: "dus-meta-label",
|
|
830
|
+
children: t("panel.current")
|
|
831
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
|
|
832
|
+
className: "dus-meta-value",
|
|
833
|
+
children: status?.currentVersion ?? "…"
|
|
834
|
+
})]
|
|
835
|
+
}), status?.checkedAt !== null && status?.checkedAt !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
836
|
+
className: "dus-metadata-row",
|
|
837
|
+
children: [
|
|
838
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
769
839
|
className: "dus-meta-label",
|
|
770
|
-
children: t("panel.
|
|
771
|
-
}),
|
|
840
|
+
children: t("panel.checkedAt")
|
|
841
|
+
}),
|
|
842
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
772
843
|
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
|
-
]
|
|
844
|
+
children: timeText(status.checkedAt)
|
|
845
|
+
}),
|
|
846
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
847
|
+
className: "dus-meta-sub",
|
|
848
|
+
children: status.cached ? t("panel.cached") : t("panel.live")
|
|
849
|
+
})
|
|
850
|
+
]
|
|
851
|
+
})]
|
|
820
852
|
}),
|
|
821
853
|
warning !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
822
854
|
className: "dus-warning",
|
|
@@ -856,9 +888,21 @@ window.__ModuleLoader__.load({
|
|
|
856
888
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(RestartControl, { restart: ui.restart })
|
|
857
889
|
]
|
|
858
890
|
}),
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
891
|
+
view.rows.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
892
|
+
className: "dus-releases",
|
|
893
|
+
children: view.rows.map((row) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ReleaseCard, {
|
|
894
|
+
release: row.release,
|
|
895
|
+
newest: row.newest,
|
|
896
|
+
disabled: snapshot.loading
|
|
897
|
+
}, row.release.version))
|
|
898
|
+
}),
|
|
899
|
+
view.copyable && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
900
|
+
className: "dus-note",
|
|
901
|
+
children: t("panel.commandNote")
|
|
902
|
+
}),
|
|
903
|
+
view.guidance !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
904
|
+
className: "dus-guidance",
|
|
905
|
+
children: view.guidance
|
|
862
906
|
}),
|
|
863
907
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
864
908
|
className: "dus-note",
|
|
@@ -958,10 +1002,6 @@ window.__ModuleLoader__.load({
|
|
|
958
1002
|
currentVersion: record.currentVersion,
|
|
959
1003
|
latestVersion: record.latestVersion
|
|
960
1004
|
};
|
|
961
|
-
if (record.code === "version-unverified" && typeof record.version === "string") return {
|
|
962
|
-
code: record.code,
|
|
963
|
-
version: record.version
|
|
964
|
-
};
|
|
965
1005
|
if (record.code === "stale-schemastery") {
|
|
966
1006
|
const version = record.version === null ? null : stringOrNull(record.version);
|
|
967
1007
|
const nodeModulesDir = record.nodeModulesDir === null ? null : stringOrNull(record.nodeModulesDir);
|
|
@@ -974,19 +1014,94 @@ window.__ModuleLoader__.load({
|
|
|
974
1014
|
};
|
|
975
1015
|
}
|
|
976
1016
|
}
|
|
1017
|
+
function installKindOf(value) {
|
|
1018
|
+
return value === "npm-global" || value === "pnpm-global" || value === "source-checkout" || value === "unknown" ? value : void 0;
|
|
1019
|
+
}
|
|
1020
|
+
/**
|
|
1021
|
+
* A field the contract types as `string | null`.
|
|
1022
|
+
*
|
|
1023
|
+
* `null` is a value the Host chose to send; `undefined` means it was missing or
|
|
1024
|
+
* malformed, which a caller turns into a rejection.
|
|
1025
|
+
*/
|
|
1026
|
+
function nullableString(value) {
|
|
1027
|
+
if (value === null) return null;
|
|
1028
|
+
return typeof value === "string" && value !== "" ? value : void 0;
|
|
1029
|
+
}
|
|
1030
|
+
/**
|
|
1031
|
+
* One upgradable version, exactly as the Host described it.
|
|
1032
|
+
*
|
|
1033
|
+
* Every field is required by the contract, so a missing `line` or a numeric
|
|
1034
|
+
* `tag` rejects the whole payload instead of rendering a half-filled card: the
|
|
1035
|
+
* card list is the panel's whole answer, and a wrong one is worse than a read
|
|
1036
|
+
* error the operator can retry.
|
|
1037
|
+
*/
|
|
1038
|
+
function releaseCandidateOf(value) {
|
|
1039
|
+
const record = objectOf(value);
|
|
1040
|
+
if (record === void 0) return void 0;
|
|
1041
|
+
if (typeof record.version !== "string" || record.version === "") return void 0;
|
|
1042
|
+
if (typeof record.line !== "string" || record.line === "") return void 0;
|
|
1043
|
+
const tag = nullableString(record.tag);
|
|
1044
|
+
const publishedAt = nullableString(record.publishedAt);
|
|
1045
|
+
const command = record.command === "" ? null : nullableString(record.command);
|
|
1046
|
+
if (tag === void 0 || publishedAt === void 0 || command === void 0) return void 0;
|
|
1047
|
+
return {
|
|
1048
|
+
version: record.version,
|
|
1049
|
+
tag,
|
|
1050
|
+
publishedAt,
|
|
1051
|
+
line: record.line,
|
|
1052
|
+
command
|
|
1053
|
+
};
|
|
1054
|
+
}
|
|
1055
|
+
/** The release line of a version: no SemVer maths needed, the Host's own rule. */
|
|
1056
|
+
function releaseLineOf(version) {
|
|
1057
|
+
return version.split("-", 1)[0] ?? version;
|
|
1058
|
+
}
|
|
1059
|
+
/**
|
|
1060
|
+
* A 0.4.x Host answered with a single `latestVersion` plus its `upgradeCommand`.
|
|
1061
|
+
*
|
|
1062
|
+
* A client bundle that hot-reloads over that Host must keep the page alive, so
|
|
1063
|
+
* the one candidate those fields describe is synthesized instead of rejecting a
|
|
1064
|
+
* payload the Host is still entitled to send. `tag` is null because the legacy
|
|
1065
|
+
* shape never carried it.
|
|
1066
|
+
*/
|
|
1067
|
+
function legacyReleaseOf(record, installKind) {
|
|
1068
|
+
if (typeof record.latestVersion !== "string" || record.latestVersion === "") return void 0;
|
|
1069
|
+
const publishedAt = record.publishedAt === void 0 ? null : nullableString(record.publishedAt);
|
|
1070
|
+
if (publishedAt === void 0) return void 0;
|
|
1071
|
+
const command = installKind === "npm-global" || installKind === "pnpm-global" ? typeof record.upgradeCommand === "string" && record.upgradeCommand !== "" ? record.upgradeCommand : null : null;
|
|
1072
|
+
return {
|
|
1073
|
+
version: record.latestVersion,
|
|
1074
|
+
tag: null,
|
|
1075
|
+
publishedAt,
|
|
1076
|
+
line: releaseLineOf(record.latestVersion),
|
|
1077
|
+
command
|
|
1078
|
+
};
|
|
1079
|
+
}
|
|
977
1080
|
/** Reject malformed RPC output before it reaches a slot component. */
|
|
978
1081
|
function updateStatusOf(value) {
|
|
979
1082
|
if (value === null || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
980
1083
|
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);
|
|
1084
|
+
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;
|
|
1085
|
+
const installKind = installKindOf(record.installKind);
|
|
1086
|
+
if (installKind === void 0) return void 0;
|
|
985
1087
|
const checkedAt = record.checkedAt === null ? null : stringOrNull(record.checkedAt);
|
|
986
1088
|
const warning = record.warning === null ? null : stringOrNull(record.warning);
|
|
987
1089
|
const warningKind = record.warningKind === "failure" || record.warningKind === "notice" ? record.warningKind : void 0;
|
|
988
|
-
|
|
989
|
-
|
|
1090
|
+
if (record.checkedAt !== null && checkedAt === null || record.warning !== null && warning === null) return void 0;
|
|
1091
|
+
const releases = [];
|
|
1092
|
+
if (record.releases !== void 0) {
|
|
1093
|
+
if (!Array.isArray(record.releases)) return void 0;
|
|
1094
|
+
for (const raw of record.releases) {
|
|
1095
|
+
const parsed = releaseCandidateOf(raw);
|
|
1096
|
+
if (parsed === void 0) return void 0;
|
|
1097
|
+
releases.push(parsed);
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
if (releases.length === 0 && record.hasUpdate === true) {
|
|
1101
|
+
const legacy = legacyReleaseOf(record, installKind);
|
|
1102
|
+
if (legacy !== void 0) releases.push(legacy);
|
|
1103
|
+
}
|
|
1104
|
+
if (record.hasUpdate !== releases.length > 0) return void 0;
|
|
990
1105
|
const warnings = [];
|
|
991
1106
|
if (record.warnings !== void 0) {
|
|
992
1107
|
if (!Array.isArray(record.warnings)) return void 0;
|
|
@@ -998,19 +1113,16 @@ window.__ModuleLoader__.load({
|
|
|
998
1113
|
}
|
|
999
1114
|
return {
|
|
1000
1115
|
currentVersion: record.currentVersion,
|
|
1001
|
-
|
|
1116
|
+
releases,
|
|
1002
1117
|
hasUpdate: record.hasUpdate,
|
|
1003
|
-
compatibility: record.compatibility,
|
|
1004
1118
|
cached: record.cached,
|
|
1005
1119
|
checkedAt,
|
|
1006
1120
|
warning,
|
|
1007
1121
|
warningKind,
|
|
1008
1122
|
warnings,
|
|
1009
|
-
installKind
|
|
1010
|
-
upgradeCommand: record.upgradeCommand,
|
|
1123
|
+
installKind,
|
|
1011
1124
|
releaseUrl: record.releaseUrl,
|
|
1012
1125
|
changelogUrl: record.changelogUrl,
|
|
1013
|
-
publishedAt,
|
|
1014
1126
|
packageName: record.packageName,
|
|
1015
1127
|
canApplyInPlace: false
|
|
1016
1128
|
};
|
|
@@ -1980,6 +2092,20 @@ window.__ModuleLoader__.load({
|
|
|
1980
2092
|
.dus-meta-label{color:var(--dsw-alias-label-secondary);font-size:12px}
|
|
1981
2093
|
.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
2094
|
.dus-meta-sub{color:var(--dsw-alias-label-secondary);font-size:11px;grid-column:1 / -1}
|
|
2095
|
+
/* One card per upgradable version. Every value here is a theme token, so the
|
|
2096
|
+
cards follow light, dark and OS-following appearances with no plugin-side
|
|
2097
|
+
detection; only the highest version's border changes, because "newest" is the
|
|
2098
|
+
single fact that must survive a glance at a multi-card list. */
|
|
2099
|
+
.dus-releases{display:grid;gap:9px;margin:0 0 12px}
|
|
2100
|
+
.dus-release{background:var(--dsw-alias-bg-layer-3);border:1px solid var(--dsw-alias-border-l2);border-radius:10px;padding:9px}
|
|
2101
|
+
.dus-release[data-highlight=true]{border-color:var(--dsw-alias-state-warn-primary)}
|
|
2102
|
+
.dus-release-head{align-items:center;display:flex;flex-wrap:wrap;gap:6px}
|
|
2103
|
+
.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}
|
|
2104
|
+
.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}
|
|
2105
|
+
.dus-release-line{font-family:var(--dsw-font-family-mono,ui-monospace,SFMono-Regular,Menlo,monospace);font-variant-numeric:tabular-nums}
|
|
2106
|
+
.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}
|
|
2107
|
+
.dus-pill-latest{border-color:var(--dsw-alias-state-warn-primary);color:var(--dsw-alias-state-warn-primary);font-weight:600}
|
|
2108
|
+
.dus-guidance{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:1.45;margin:0 0 12px}
|
|
1983
2109
|
.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
2110
|
.dus-actions{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 12px}
|
|
1985
2111
|
.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 +2124,6 @@ window.__ModuleLoader__.load({
|
|
|
1998
2124
|
.dus-command:focus{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}
|
|
1999
2125
|
.dus-note{color:var(--dsw-alias-label-secondary);font-size:11px;line-height:1.45;margin:8px 0 0}
|
|
2000
2126
|
.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
2127
|
.dus-command-actions{align-items:center;margin:8px 0 0}
|
|
2005
2128
|
@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
2129
|
`;
|