@shellraining/dsh-plugin-updates 0.2.0 → 0.2.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 +2 -0
- package/lib/client.js +1837 -1996
- package/lib/index.js +207 -130
- package/package.json +3 -4
package/lib/client.js
CHANGED
|
@@ -4,1741 +4,1450 @@ window.__ModuleLoader__.load({
|
|
|
4
4
|
factory: (require) => {
|
|
5
5
|
var module = { exports: {} };
|
|
6
6
|
var exports = module.exports;
|
|
7
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
|
+
// \0rolldown/runtime.js
|
|
7
9
|
var __create = Object.create;
|
|
8
10
|
var __defProp = Object.defineProperty;
|
|
9
11
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
10
12
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
11
13
|
var __getProtoOf = Object.getPrototypeOf;
|
|
12
14
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
|
|
16
|
+
var __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
18
|
+
key = keys[i];
|
|
19
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
20
|
+
get: ((k) => from[k]).bind(null, key),
|
|
21
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
19
25
|
};
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
27
|
+
value: mod,
|
|
28
|
+
enumerable: true
|
|
29
|
+
}) : target, mod));
|
|
30
|
+
let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
31
|
+
let react = require("react");
|
|
32
|
+
let react_dom = require("react-dom");
|
|
33
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
34
|
+
// src/client/locale.ts
|
|
35
|
+
var LOCALE_NS = "dshPluginUpdates";
|
|
36
|
+
var ZH = {
|
|
37
|
+
"updateAllCount": "全部更新({count})",
|
|
38
|
+
"updateLabel": "把 {name} 更新到 {version}",
|
|
39
|
+
"updating": "更新中…",
|
|
40
|
+
"updateTo": "更新到 {version}",
|
|
41
|
+
"install": "安装",
|
|
42
|
+
"status.update": "可更新 {version}",
|
|
43
|
+
"versions.loading": "正在读取版本…",
|
|
44
|
+
"version.current": "当前 {version}",
|
|
45
|
+
"versions.title": "版本",
|
|
46
|
+
"versions.registry": "来自 {registry}",
|
|
47
|
+
"versions.showAll": "显示全部 {count} 个版本",
|
|
48
|
+
"versions.empty": "没有可用的版本信息",
|
|
49
|
+
"versions.failed": "无法从 npm 读取版本:{reason}",
|
|
50
|
+
"tag.current": "当前",
|
|
51
|
+
"tag.prerelease": "预发布",
|
|
52
|
+
"tag.deprecated": "已废弃",
|
|
53
|
+
"tag.incompatible": "不兼容",
|
|
54
|
+
"tag.fresh": "新发布",
|
|
55
|
+
"hint.fresh": "发布不足 24 小时:pnpm 默认不安装这么新的版本,安装可能失败",
|
|
56
|
+
"hint.incompatible": "与当前 DSH 版本不兼容,安装会被拒绝",
|
|
57
|
+
"self.body": "可以更新到 {version}。更新在宿主后台进行,期间本插件的界面会暂时消失",
|
|
58
|
+
"self.confirmTitle": "把本插件更新到 {version}?",
|
|
59
|
+
"self.confirmBody": "宿主会先卸载当前版本,再安装新版本。期间插件页上的更新按钮会暂时消失,装好后自动回来;新版本装不上时会装回当前版本。如果连当前版本也装不回,可以退出 DSH 后在终端运行下面的命令手动安装:",
|
|
60
|
+
"self.cancel": "取消",
|
|
61
|
+
"self.copy": "复制命令",
|
|
62
|
+
"self.copied": "已复制",
|
|
63
|
+
"error.policy": "pnpm 处理 minimumReleaseAge 时发生内部错误。请升级宿主附带的 pnpm,或等发布等待期结束后重试;完整错误见下方日志",
|
|
64
|
+
"error.inconsistent": "安装声明与实际版本不一致,请先用宿主插件管理器或 CLI 修复安装,再重试更新",
|
|
65
|
+
"error.stateChanged": "插件安装状态已变化,请刷新插件列表后重试",
|
|
66
|
+
"error.interrupted": "宿主在更新完成前退出了,请检查插件列表里的版本",
|
|
67
|
+
"error.selfBusy": "已有一个自更新在进行",
|
|
68
|
+
"op.checking": "正在核对 {name} 的安装状态…",
|
|
69
|
+
"op.checkFailed": "无法确认 {name} 的安装状态,已停止操作:{reason}",
|
|
70
|
+
"op.current": "{name} 已是 {to},无需重复安装",
|
|
71
|
+
"op.removing": "正在卸载 {name} {from}…",
|
|
72
|
+
"op.installing": "正在安装 {name} {to}…",
|
|
73
|
+
"op.restoring": "正在恢复 {name} {to}…",
|
|
74
|
+
"op.done": "{name} 已切换到 {to}",
|
|
75
|
+
"op.restart": "{name} 已切换到 {to},重启 DSH 后生效",
|
|
76
|
+
"op.failed": "{name} 安装 {to} 失败:{reason}",
|
|
77
|
+
"op.restored": "{name} 安装 {to} 失败,已装回 {from}:{reason}",
|
|
78
|
+
"op.selfFailed": "{name} 更新到 {to} 失败:{reason}",
|
|
79
|
+
"op.removeFailed": "{name} 卸载未完成,已停止后续安装:{reason}",
|
|
80
|
+
"op.restore": "恢复 {from}",
|
|
81
|
+
"op.dismiss": "关闭",
|
|
82
|
+
"op.log": "日志:{path}"
|
|
23
83
|
};
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
84
|
+
var EN = {
|
|
85
|
+
"updateAllCount": "Update all ({count})",
|
|
86
|
+
"updateLabel": "Update {name} to {version}",
|
|
87
|
+
"updating": "Updating…",
|
|
88
|
+
"updateTo": "Update to {version}",
|
|
89
|
+
"install": "Install",
|
|
90
|
+
"status.update": "Update {version}",
|
|
91
|
+
"versions.loading": "Reading versions…",
|
|
92
|
+
"version.current": "Current {version}",
|
|
93
|
+
"versions.title": "Versions",
|
|
94
|
+
"versions.registry": "From {registry}",
|
|
95
|
+
"versions.showAll": "Show all {count} versions",
|
|
96
|
+
"versions.empty": "No version information",
|
|
97
|
+
"versions.failed": "Could not read versions from npm: {reason}",
|
|
98
|
+
"tag.current": "Current",
|
|
99
|
+
"tag.prerelease": "Prerelease",
|
|
100
|
+
"tag.deprecated": "Deprecated",
|
|
101
|
+
"tag.incompatible": "Incompatible",
|
|
102
|
+
"tag.fresh": "New",
|
|
103
|
+
"hint.fresh": "Published less than 24 hours ago: pnpm does not install versions this new by default, so installing may fail",
|
|
104
|
+
"hint.incompatible": "Not compatible with this DSH version; the installation would be refused",
|
|
105
|
+
"self.body": "Version {version} is available. The host updates this plugin in the background, and its controls disappear meanwhile",
|
|
106
|
+
"self.confirmTitle": "Update this plugin to {version}?",
|
|
107
|
+
"self.confirmBody": "The host uninstalls the current version, then installs the new one. The update controls on the Plugins page disappear meanwhile and come back once it is installed; if the new version cannot be installed, the current one is put back. If even that fails, quit DSH and run this command in a terminal to install it by hand:",
|
|
108
|
+
"self.cancel": "Cancel",
|
|
109
|
+
"self.copy": "Copy command",
|
|
110
|
+
"self.copied": "Copied",
|
|
111
|
+
"error.policy": "pnpm hit an internal error while handling minimumReleaseAge. Upgrade the pnpm bundled with the host, or retry after the release-age waiting period; see the full error below",
|
|
112
|
+
"error.inconsistent": "The declared and installed versions differ. Repair the installation with the host plugin manager or CLI before retrying",
|
|
113
|
+
"error.stateChanged": "The installed state has changed. Refresh the plugin list and retry",
|
|
114
|
+
"error.interrupted": "The host stopped before the update finished; check the version in the plugin list",
|
|
115
|
+
"error.selfBusy": "A self-update is already running",
|
|
116
|
+
"op.checking": "Checking the installed version of {name}…",
|
|
117
|
+
"op.checkFailed": "Could not confirm the installed state of {name}; stopped: {reason}",
|
|
118
|
+
"op.current": "{name} is already at {to}; no reinstall needed",
|
|
119
|
+
"op.removing": "Uninstalling {name} {from}…",
|
|
120
|
+
"op.installing": "Installing {name} {to}…",
|
|
121
|
+
"op.restoring": "Restoring {name} {to}…",
|
|
122
|
+
"op.done": "{name} is now at {to}",
|
|
123
|
+
"op.restart": "{name} is now at {to}; restart DSH to apply it",
|
|
124
|
+
"op.failed": "Could not install {name} {to}: {reason}",
|
|
125
|
+
"op.restored": "Could not install {name} {to}; {from} was put back: {reason}",
|
|
126
|
+
"op.selfFailed": "Could not update {name} to {to}: {reason}",
|
|
127
|
+
"op.removeFailed": "Uninstalling {name} did not finish; installation was not started: {reason}",
|
|
128
|
+
"op.restore": "Restore {from}",
|
|
129
|
+
"op.dismiss": "Dismiss",
|
|
130
|
+
"op.log": "Log: {path}"
|
|
31
131
|
};
|
|
32
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
33
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
34
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
35
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
36
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
37
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
38
|
-
mod
|
|
39
|
-
));
|
|
40
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
41
|
-
|
|
42
132
|
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/debug.js
|
|
43
|
-
var require_debug =
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
|
|
47
|
-
};
|
|
48
|
-
module2.exports = debug;
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
|
|
133
|
+
var require_debug = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
134
|
+
module.exports = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
|
|
135
|
+
}));
|
|
52
136
|
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/constants.js
|
|
53
|
-
var require_constants =
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
MAX_SAFE_BUILD_LENGTH,
|
|
75
|
-
MAX_SAFE_INTEGER,
|
|
76
|
-
RELEASE_TYPES,
|
|
77
|
-
SEMVER_SPEC_VERSION,
|
|
78
|
-
FLAG_INCLUDE_PRERELEASE: 1,
|
|
79
|
-
FLAG_LOOSE: 2
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
|
|
137
|
+
var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
138
|
+
module.exports = {
|
|
139
|
+
MAX_LENGTH: 256,
|
|
140
|
+
MAX_SAFE_COMPONENT_LENGTH: 16,
|
|
141
|
+
MAX_SAFE_BUILD_LENGTH: 250,
|
|
142
|
+
MAX_SAFE_INTEGER: Number.MAX_SAFE_INTEGER ||
|
|
143
|
+
/* istanbul ignore next */ 9007199254740991,
|
|
144
|
+
RELEASE_TYPES: [
|
|
145
|
+
"major",
|
|
146
|
+
"premajor",
|
|
147
|
+
"minor",
|
|
148
|
+
"preminor",
|
|
149
|
+
"patch",
|
|
150
|
+
"prepatch",
|
|
151
|
+
"prerelease"
|
|
152
|
+
],
|
|
153
|
+
SEMVER_SPEC_VERSION: "2.0.0",
|
|
154
|
+
FLAG_INCLUDE_PRERELEASE: 1,
|
|
155
|
+
FLAG_LOOSE: 2
|
|
156
|
+
};
|
|
157
|
+
}));
|
|
84
158
|
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/re.js
|
|
85
|
-
var require_re =
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
|
|
163
|
-
exports.comparatorTrimReplace = "$1$2$3";
|
|
164
|
-
createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
|
|
165
|
-
createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
|
|
166
|
-
createToken("STAR", "(<|>)?=?\\s*\\*");
|
|
167
|
-
createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
|
|
168
|
-
createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
|
|
159
|
+
var require_re = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
160
|
+
var { MAX_SAFE_COMPONENT_LENGTH, MAX_SAFE_BUILD_LENGTH, MAX_LENGTH } = require_constants();
|
|
161
|
+
var debug = require_debug();
|
|
162
|
+
exports = module.exports = {};
|
|
163
|
+
var re = exports.re = [];
|
|
164
|
+
var safeRe = exports.safeRe = [];
|
|
165
|
+
var src = exports.src = [];
|
|
166
|
+
var safeSrc = exports.safeSrc = [];
|
|
167
|
+
var t = exports.t = {};
|
|
168
|
+
var R = 0;
|
|
169
|
+
var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
|
|
170
|
+
var safeRegexReplacements = [
|
|
171
|
+
["\\s", 1],
|
|
172
|
+
["\\d", MAX_LENGTH],
|
|
173
|
+
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
|
|
174
|
+
];
|
|
175
|
+
var makeSafeRegex = (value) => {
|
|
176
|
+
for (const [token, max] of safeRegexReplacements) value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
|
|
177
|
+
return value;
|
|
178
|
+
};
|
|
179
|
+
var createToken = (name, value, isGlobal) => {
|
|
180
|
+
const safe = makeSafeRegex(value);
|
|
181
|
+
const index = R++;
|
|
182
|
+
debug(name, index, value);
|
|
183
|
+
t[name] = index;
|
|
184
|
+
src[index] = value;
|
|
185
|
+
safeSrc[index] = safe;
|
|
186
|
+
re[index] = new RegExp(value, isGlobal ? "g" : void 0);
|
|
187
|
+
safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
|
|
188
|
+
};
|
|
189
|
+
createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
|
|
190
|
+
createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
|
|
191
|
+
createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
|
|
192
|
+
createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
|
|
193
|
+
createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
194
|
+
createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
|
|
195
|
+
createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
196
|
+
createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
|
|
197
|
+
createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
|
|
198
|
+
createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
|
|
199
|
+
createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
|
|
200
|
+
createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
|
|
201
|
+
createToken("FULL", `^${src[t.FULLPLAIN]}$`);
|
|
202
|
+
createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
|
|
203
|
+
createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
|
|
204
|
+
createToken("GTLT", "((?:<|>)?=?)");
|
|
205
|
+
createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
|
|
206
|
+
createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
|
|
207
|
+
createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
|
|
208
|
+
createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
|
|
209
|
+
createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
|
|
210
|
+
createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
|
|
211
|
+
createToken("COERCEPLAIN", `(^|[^\\d])(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
|
|
212
|
+
createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
|
|
213
|
+
createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
|
|
214
|
+
createToken("COERCERTL", src[t.COERCE], true);
|
|
215
|
+
createToken("COERCERTLFULL", src[t.COERCEFULL], true);
|
|
216
|
+
createToken("LONETILDE", "(?:~>?)");
|
|
217
|
+
createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
|
|
218
|
+
exports.tildeTrimReplace = "$1~";
|
|
219
|
+
createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
|
|
220
|
+
createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
221
|
+
createToken("LONECARET", "(?:\\^)");
|
|
222
|
+
createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
|
|
223
|
+
exports.caretTrimReplace = "$1^";
|
|
224
|
+
createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
|
|
225
|
+
createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
226
|
+
createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
|
|
227
|
+
createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
|
|
228
|
+
createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
|
|
229
|
+
exports.comparatorTrimReplace = "$1$2$3";
|
|
230
|
+
createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
|
|
231
|
+
createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
|
|
232
|
+
createToken("STAR", "(<|>)?=?\\s*\\*");
|
|
233
|
+
createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
|
|
234
|
+
createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
235
|
+
}));
|
|
172
236
|
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/parse-options.js
|
|
173
|
-
var require_parse_options =
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
return looseOption;
|
|
184
|
-
}
|
|
185
|
-
return options;
|
|
186
|
-
};
|
|
187
|
-
module2.exports = parseOptions;
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
|
|
237
|
+
var require_parse_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
238
|
+
var looseOption = Object.freeze({ loose: true });
|
|
239
|
+
var emptyOpts = Object.freeze({});
|
|
240
|
+
var parseOptions = (options) => {
|
|
241
|
+
if (!options) return emptyOpts;
|
|
242
|
+
if (typeof options !== "object") return looseOption;
|
|
243
|
+
return options;
|
|
244
|
+
};
|
|
245
|
+
module.exports = parseOptions;
|
|
246
|
+
}));
|
|
191
247
|
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/identifiers.js
|
|
192
|
-
var require_identifiers =
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
compareIdentifiers,
|
|
211
|
-
rcompareIdentifiers
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
|
|
248
|
+
var require_identifiers = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
249
|
+
var numeric = /^[0-9]+$/;
|
|
250
|
+
var compareIdentifiers = (a, b) => {
|
|
251
|
+
if (typeof a === "number" && typeof b === "number") return a === b ? 0 : a < b ? -1 : 1;
|
|
252
|
+
const anum = numeric.test(a);
|
|
253
|
+
const bnum = numeric.test(b);
|
|
254
|
+
if (anum && bnum) {
|
|
255
|
+
a = +a;
|
|
256
|
+
b = +b;
|
|
257
|
+
}
|
|
258
|
+
return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
|
|
259
|
+
};
|
|
260
|
+
var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
|
|
261
|
+
module.exports = {
|
|
262
|
+
compareIdentifiers,
|
|
263
|
+
rcompareIdentifiers
|
|
264
|
+
};
|
|
265
|
+
}));
|
|
216
266
|
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/semver.js
|
|
217
|
-
var require_semver =
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
switch (release) {
|
|
404
|
-
case "premajor":
|
|
405
|
-
this.prerelease.length = 0;
|
|
406
|
-
this.patch = 0;
|
|
407
|
-
this.minor = 0;
|
|
408
|
-
this.major++;
|
|
409
|
-
this.inc("pre", identifier, identifierBase);
|
|
410
|
-
break;
|
|
411
|
-
case "preminor":
|
|
412
|
-
this.prerelease.length = 0;
|
|
413
|
-
this.patch = 0;
|
|
414
|
-
this.minor++;
|
|
415
|
-
this.inc("pre", identifier, identifierBase);
|
|
416
|
-
break;
|
|
417
|
-
case "prepatch":
|
|
418
|
-
this.prerelease.length = 0;
|
|
419
|
-
this.inc("patch", identifier, identifierBase);
|
|
420
|
-
this.inc("pre", identifier, identifierBase);
|
|
421
|
-
break;
|
|
422
|
-
// If the input is a non-prerelease version, this acts the same as
|
|
423
|
-
// prepatch.
|
|
424
|
-
case "prerelease":
|
|
425
|
-
if (this.prerelease.length === 0) {
|
|
426
|
-
this.inc("patch", identifier, identifierBase);
|
|
427
|
-
}
|
|
428
|
-
this.inc("pre", identifier, identifierBase);
|
|
429
|
-
break;
|
|
430
|
-
case "release":
|
|
431
|
-
if (this.prerelease.length === 0) {
|
|
432
|
-
throw new Error(`version ${this.raw} is not a prerelease`);
|
|
433
|
-
}
|
|
434
|
-
this.prerelease.length = 0;
|
|
435
|
-
break;
|
|
436
|
-
case "major":
|
|
437
|
-
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
|
|
438
|
-
this.major++;
|
|
439
|
-
}
|
|
440
|
-
this.minor = 0;
|
|
441
|
-
this.patch = 0;
|
|
442
|
-
this.prerelease = [];
|
|
443
|
-
break;
|
|
444
|
-
case "minor":
|
|
445
|
-
if (this.patch !== 0 || this.prerelease.length === 0) {
|
|
446
|
-
this.minor++;
|
|
447
|
-
}
|
|
448
|
-
this.patch = 0;
|
|
449
|
-
this.prerelease = [];
|
|
450
|
-
break;
|
|
451
|
-
case "patch":
|
|
452
|
-
if (this.prerelease.length === 0) {
|
|
453
|
-
this.patch++;
|
|
454
|
-
}
|
|
455
|
-
this.prerelease = [];
|
|
456
|
-
break;
|
|
457
|
-
// This probably shouldn't be used publicly.
|
|
458
|
-
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
|
|
459
|
-
case "pre": {
|
|
460
|
-
const base = Number(identifierBase) ? 1 : 0;
|
|
461
|
-
if (this.prerelease.length === 0) {
|
|
462
|
-
this.prerelease = [base];
|
|
463
|
-
} else {
|
|
464
|
-
let i = this.prerelease.length;
|
|
465
|
-
while (--i >= 0) {
|
|
466
|
-
if (typeof this.prerelease[i] === "number") {
|
|
467
|
-
this.prerelease[i]++;
|
|
468
|
-
i = -2;
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
if (i === -1) {
|
|
472
|
-
if (identifier === this.prerelease.join(".") && identifierBase === false) {
|
|
473
|
-
throw new Error("invalid increment argument: identifier already exists");
|
|
474
|
-
}
|
|
475
|
-
this.prerelease.push(base);
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
if (identifier) {
|
|
479
|
-
let prerelease2 = [identifier, base];
|
|
480
|
-
if (identifierBase === false) {
|
|
481
|
-
prerelease2 = [identifier];
|
|
482
|
-
}
|
|
483
|
-
if (isPrereleaseIdentifier(this.prerelease, identifier)) {
|
|
484
|
-
const prereleaseBase = this.prerelease[identifier.split(".").length];
|
|
485
|
-
if (isNaN(prereleaseBase)) {
|
|
486
|
-
this.prerelease = prerelease2;
|
|
487
|
-
}
|
|
488
|
-
} else {
|
|
489
|
-
this.prerelease = prerelease2;
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
break;
|
|
493
|
-
}
|
|
494
|
-
default:
|
|
495
|
-
throw new Error(`invalid increment argument: ${release}`);
|
|
496
|
-
}
|
|
497
|
-
this.raw = this.format();
|
|
498
|
-
if (this.build.length) {
|
|
499
|
-
this.raw += `+${this.build.join(".")}`;
|
|
500
|
-
}
|
|
501
|
-
return this;
|
|
502
|
-
}
|
|
503
|
-
};
|
|
504
|
-
module2.exports = SemVer;
|
|
505
|
-
}
|
|
506
|
-
});
|
|
507
|
-
|
|
267
|
+
var require_semver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
268
|
+
var debug = require_debug();
|
|
269
|
+
var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
|
|
270
|
+
var { safeRe: re, t } = require_re();
|
|
271
|
+
var parseOptions = require_parse_options();
|
|
272
|
+
var { compareIdentifiers } = require_identifiers();
|
|
273
|
+
var isPrereleaseIdentifier = (prerelease, identifier) => {
|
|
274
|
+
const identifiers = identifier.split(".");
|
|
275
|
+
if (identifiers.length > prerelease.length) return false;
|
|
276
|
+
for (let i = 0; i < identifiers.length; i++) if (compareIdentifiers(prerelease[i], identifiers[i]) !== 0) return false;
|
|
277
|
+
return true;
|
|
278
|
+
};
|
|
279
|
+
module.exports = class SemVer {
|
|
280
|
+
constructor(version, options) {
|
|
281
|
+
options = parseOptions(options);
|
|
282
|
+
if (version instanceof SemVer) {
|
|
283
|
+
if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) return version;
|
|
284
|
+
else version = version.version;
|
|
285
|
+
} else if (typeof version !== "string") throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
|
|
286
|
+
if (version.length > MAX_LENGTH) throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
|
|
287
|
+
debug("SemVer", version, options);
|
|
288
|
+
this.options = options;
|
|
289
|
+
this.loose = !!options.loose;
|
|
290
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
291
|
+
const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
|
|
292
|
+
if (!m) throw new TypeError(`Invalid Version: ${version}`);
|
|
293
|
+
this.raw = version;
|
|
294
|
+
this.major = +m[1];
|
|
295
|
+
this.minor = +m[2];
|
|
296
|
+
this.patch = +m[3];
|
|
297
|
+
if (this.major > MAX_SAFE_INTEGER || this.major < 0) throw new TypeError("Invalid major version");
|
|
298
|
+
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) throw new TypeError("Invalid minor version");
|
|
299
|
+
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) throw new TypeError("Invalid patch version");
|
|
300
|
+
if (!m[4]) this.prerelease = [];
|
|
301
|
+
else this.prerelease = m[4].split(".").map((id) => {
|
|
302
|
+
if (/^[0-9]+$/.test(id)) {
|
|
303
|
+
const num = +id;
|
|
304
|
+
if (num >= 0 && num < MAX_SAFE_INTEGER) return num;
|
|
305
|
+
}
|
|
306
|
+
return id;
|
|
307
|
+
});
|
|
308
|
+
this.build = m[5] ? m[5].split(".") : [];
|
|
309
|
+
this.format();
|
|
310
|
+
}
|
|
311
|
+
format() {
|
|
312
|
+
this.version = `${this.major}.${this.minor}.${this.patch}`;
|
|
313
|
+
if (this.prerelease.length) this.version += `-${this.prerelease.join(".")}`;
|
|
314
|
+
return this.version;
|
|
315
|
+
}
|
|
316
|
+
toString() {
|
|
317
|
+
return this.version;
|
|
318
|
+
}
|
|
319
|
+
compare(other) {
|
|
320
|
+
debug("SemVer.compare", this.version, this.options, other);
|
|
321
|
+
if (!(other instanceof SemVer)) {
|
|
322
|
+
if (typeof other === "string" && other === this.version) return 0;
|
|
323
|
+
other = new SemVer(other, this.options);
|
|
324
|
+
}
|
|
325
|
+
if (other.version === this.version) return 0;
|
|
326
|
+
return this.compareMain(other) || this.comparePre(other);
|
|
327
|
+
}
|
|
328
|
+
compareMain(other) {
|
|
329
|
+
if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
|
|
330
|
+
if (this.major < other.major) return -1;
|
|
331
|
+
if (this.major > other.major) return 1;
|
|
332
|
+
if (this.minor < other.minor) return -1;
|
|
333
|
+
if (this.minor > other.minor) return 1;
|
|
334
|
+
if (this.patch < other.patch) return -1;
|
|
335
|
+
if (this.patch > other.patch) return 1;
|
|
336
|
+
return 0;
|
|
337
|
+
}
|
|
338
|
+
comparePre(other) {
|
|
339
|
+
if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
|
|
340
|
+
if (this.prerelease.length && !other.prerelease.length) return -1;
|
|
341
|
+
else if (!this.prerelease.length && other.prerelease.length) return 1;
|
|
342
|
+
else if (!this.prerelease.length && !other.prerelease.length) return 0;
|
|
343
|
+
let i = 0;
|
|
344
|
+
do {
|
|
345
|
+
const a = this.prerelease[i];
|
|
346
|
+
const b = other.prerelease[i];
|
|
347
|
+
debug("prerelease compare", i, a, b);
|
|
348
|
+
if (a === void 0 && b === void 0) return 0;
|
|
349
|
+
else if (b === void 0) return 1;
|
|
350
|
+
else if (a === void 0) return -1;
|
|
351
|
+
else if (a === b) continue;
|
|
352
|
+
else return compareIdentifiers(a, b);
|
|
353
|
+
} while (++i);
|
|
354
|
+
}
|
|
355
|
+
compareBuild(other) {
|
|
356
|
+
if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
|
|
357
|
+
let i = 0;
|
|
358
|
+
do {
|
|
359
|
+
const a = this.build[i];
|
|
360
|
+
const b = other.build[i];
|
|
361
|
+
debug("build compare", i, a, b);
|
|
362
|
+
if (a === void 0 && b === void 0) return 0;
|
|
363
|
+
else if (b === void 0) return 1;
|
|
364
|
+
else if (a === void 0) return -1;
|
|
365
|
+
else if (a === b) continue;
|
|
366
|
+
else return compareIdentifiers(a, b);
|
|
367
|
+
} while (++i);
|
|
368
|
+
}
|
|
369
|
+
inc(release, identifier, identifierBase) {
|
|
370
|
+
if (release.startsWith("pre")) {
|
|
371
|
+
if (!identifier && identifierBase === false) throw new Error("invalid increment argument: identifier is empty");
|
|
372
|
+
if (identifier) {
|
|
373
|
+
const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
|
|
374
|
+
if (!match || match[1] !== identifier) throw new Error(`invalid identifier: ${identifier}`);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
switch (release) {
|
|
378
|
+
case "premajor":
|
|
379
|
+
this.prerelease.length = 0;
|
|
380
|
+
this.patch = 0;
|
|
381
|
+
this.minor = 0;
|
|
382
|
+
this.major++;
|
|
383
|
+
this.inc("pre", identifier, identifierBase);
|
|
384
|
+
break;
|
|
385
|
+
case "preminor":
|
|
386
|
+
this.prerelease.length = 0;
|
|
387
|
+
this.patch = 0;
|
|
388
|
+
this.minor++;
|
|
389
|
+
this.inc("pre", identifier, identifierBase);
|
|
390
|
+
break;
|
|
391
|
+
case "prepatch":
|
|
392
|
+
this.prerelease.length = 0;
|
|
393
|
+
this.inc("patch", identifier, identifierBase);
|
|
394
|
+
this.inc("pre", identifier, identifierBase);
|
|
395
|
+
break;
|
|
396
|
+
case "prerelease":
|
|
397
|
+
if (this.prerelease.length === 0) this.inc("patch", identifier, identifierBase);
|
|
398
|
+
this.inc("pre", identifier, identifierBase);
|
|
399
|
+
break;
|
|
400
|
+
case "release":
|
|
401
|
+
if (this.prerelease.length === 0) throw new Error(`version ${this.raw} is not a prerelease`);
|
|
402
|
+
this.prerelease.length = 0;
|
|
403
|
+
break;
|
|
404
|
+
case "major":
|
|
405
|
+
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) this.major++;
|
|
406
|
+
this.minor = 0;
|
|
407
|
+
this.patch = 0;
|
|
408
|
+
this.prerelease = [];
|
|
409
|
+
break;
|
|
410
|
+
case "minor":
|
|
411
|
+
if (this.patch !== 0 || this.prerelease.length === 0) this.minor++;
|
|
412
|
+
this.patch = 0;
|
|
413
|
+
this.prerelease = [];
|
|
414
|
+
break;
|
|
415
|
+
case "patch":
|
|
416
|
+
if (this.prerelease.length === 0) this.patch++;
|
|
417
|
+
this.prerelease = [];
|
|
418
|
+
break;
|
|
419
|
+
case "pre": {
|
|
420
|
+
const base = Number(identifierBase) ? 1 : 0;
|
|
421
|
+
if (this.prerelease.length === 0) this.prerelease = [base];
|
|
422
|
+
else {
|
|
423
|
+
let i = this.prerelease.length;
|
|
424
|
+
while (--i >= 0) if (typeof this.prerelease[i] === "number") {
|
|
425
|
+
this.prerelease[i]++;
|
|
426
|
+
i = -2;
|
|
427
|
+
}
|
|
428
|
+
if (i === -1) {
|
|
429
|
+
if (identifier === this.prerelease.join(".") && identifierBase === false) throw new Error("invalid increment argument: identifier already exists");
|
|
430
|
+
this.prerelease.push(base);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
if (identifier) {
|
|
434
|
+
let prerelease = [identifier, base];
|
|
435
|
+
if (identifierBase === false) prerelease = [identifier];
|
|
436
|
+
if (isPrereleaseIdentifier(this.prerelease, identifier)) {
|
|
437
|
+
const prereleaseBase = this.prerelease[identifier.split(".").length];
|
|
438
|
+
if (isNaN(prereleaseBase)) this.prerelease = prerelease;
|
|
439
|
+
} else this.prerelease = prerelease;
|
|
440
|
+
}
|
|
441
|
+
break;
|
|
442
|
+
}
|
|
443
|
+
default: throw new Error(`invalid increment argument: ${release}`);
|
|
444
|
+
}
|
|
445
|
+
this.raw = this.format();
|
|
446
|
+
if (this.build.length) this.raw += `+${this.build.join(".")}`;
|
|
447
|
+
return this;
|
|
448
|
+
}
|
|
449
|
+
};
|
|
450
|
+
}));
|
|
508
451
|
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/compare.js
|
|
509
|
-
var require_compare =
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
module2.exports = compare;
|
|
515
|
-
}
|
|
516
|
-
});
|
|
517
|
-
|
|
452
|
+
var require_compare = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
453
|
+
var SemVer = require_semver();
|
|
454
|
+
var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
|
|
455
|
+
module.exports = compare;
|
|
456
|
+
}));
|
|
518
457
|
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/gt.js
|
|
519
|
-
var require_gt =
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
module2.exports = gt2;
|
|
525
|
-
}
|
|
526
|
-
});
|
|
527
|
-
|
|
458
|
+
var require_gt = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
459
|
+
var compare = require_compare();
|
|
460
|
+
var gt = (a, b, loose) => compare(a, b, loose) > 0;
|
|
461
|
+
module.exports = gt;
|
|
462
|
+
}));
|
|
528
463
|
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/parse.js
|
|
529
|
-
var require_parse =
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
}
|
|
543
|
-
throw er;
|
|
544
|
-
}
|
|
545
|
-
};
|
|
546
|
-
module2.exports = parse;
|
|
547
|
-
}
|
|
548
|
-
});
|
|
549
|
-
|
|
464
|
+
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
465
|
+
var SemVer = require_semver();
|
|
466
|
+
var parse = (version, options, throwErrors = false) => {
|
|
467
|
+
if (version instanceof SemVer) return version;
|
|
468
|
+
try {
|
|
469
|
+
return new SemVer(version, options);
|
|
470
|
+
} catch (er) {
|
|
471
|
+
if (!throwErrors) return null;
|
|
472
|
+
throw er;
|
|
473
|
+
}
|
|
474
|
+
};
|
|
475
|
+
module.exports = parse;
|
|
476
|
+
}));
|
|
550
477
|
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/prerelease.js
|
|
551
|
-
var require_prerelease =
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
module2.exports = prerelease2;
|
|
560
|
-
}
|
|
561
|
-
});
|
|
562
|
-
|
|
478
|
+
var require_prerelease = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
479
|
+
var parse = require_parse();
|
|
480
|
+
var prerelease = (version, options) => {
|
|
481
|
+
const parsed = parse(version, options);
|
|
482
|
+
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
|
|
483
|
+
};
|
|
484
|
+
module.exports = prerelease;
|
|
485
|
+
}));
|
|
563
486
|
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/rcompare.js
|
|
564
|
-
var require_rcompare =
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
module2.exports = rcompare2;
|
|
570
|
-
}
|
|
571
|
-
});
|
|
572
|
-
|
|
487
|
+
var require_rcompare = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
488
|
+
var compare = require_compare();
|
|
489
|
+
var rcompare = (a, b, loose) => compare(b, a, loose);
|
|
490
|
+
module.exports = rcompare;
|
|
491
|
+
}));
|
|
573
492
|
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/lrucache.js
|
|
574
|
-
var require_lrucache =
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
}
|
|
606
|
-
};
|
|
607
|
-
module2.exports = LRUCache;
|
|
608
|
-
}
|
|
609
|
-
});
|
|
610
|
-
|
|
493
|
+
var require_lrucache = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
494
|
+
var LRUCache = class {
|
|
495
|
+
constructor() {
|
|
496
|
+
this.max = 1e3;
|
|
497
|
+
this.map = /* @__PURE__ */ new Map();
|
|
498
|
+
}
|
|
499
|
+
get(key) {
|
|
500
|
+
const value = this.map.get(key);
|
|
501
|
+
if (value === void 0) return;
|
|
502
|
+
else {
|
|
503
|
+
this.map.delete(key);
|
|
504
|
+
this.map.set(key, value);
|
|
505
|
+
return value;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
delete(key) {
|
|
509
|
+
return this.map.delete(key);
|
|
510
|
+
}
|
|
511
|
+
set(key, value) {
|
|
512
|
+
if (!this.delete(key) && value !== void 0) {
|
|
513
|
+
if (this.map.size >= this.max) {
|
|
514
|
+
const firstKey = this.map.keys().next().value;
|
|
515
|
+
this.delete(firstKey);
|
|
516
|
+
}
|
|
517
|
+
this.map.set(key, value);
|
|
518
|
+
}
|
|
519
|
+
return this;
|
|
520
|
+
}
|
|
521
|
+
};
|
|
522
|
+
module.exports = LRUCache;
|
|
523
|
+
}));
|
|
611
524
|
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/eq.js
|
|
612
|
-
var require_eq =
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
module2.exports = eq;
|
|
618
|
-
}
|
|
619
|
-
});
|
|
620
|
-
|
|
525
|
+
var require_eq = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
526
|
+
var compare = require_compare();
|
|
527
|
+
var eq = (a, b, loose) => compare(a, b, loose) === 0;
|
|
528
|
+
module.exports = eq;
|
|
529
|
+
}));
|
|
621
530
|
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/neq.js
|
|
622
|
-
var require_neq =
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
module2.exports = neq;
|
|
628
|
-
}
|
|
629
|
-
});
|
|
630
|
-
|
|
531
|
+
var require_neq = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
532
|
+
var compare = require_compare();
|
|
533
|
+
var neq = (a, b, loose) => compare(a, b, loose) !== 0;
|
|
534
|
+
module.exports = neq;
|
|
535
|
+
}));
|
|
631
536
|
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/gte.js
|
|
632
|
-
var require_gte =
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
module2.exports = gte;
|
|
638
|
-
}
|
|
639
|
-
});
|
|
640
|
-
|
|
537
|
+
var require_gte = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
538
|
+
var compare = require_compare();
|
|
539
|
+
var gte = (a, b, loose) => compare(a, b, loose) >= 0;
|
|
540
|
+
module.exports = gte;
|
|
541
|
+
}));
|
|
641
542
|
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/lt.js
|
|
642
|
-
var require_lt =
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
module2.exports = lt;
|
|
648
|
-
}
|
|
649
|
-
});
|
|
650
|
-
|
|
543
|
+
var require_lt = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
544
|
+
var compare = require_compare();
|
|
545
|
+
var lt = (a, b, loose) => compare(a, b, loose) < 0;
|
|
546
|
+
module.exports = lt;
|
|
547
|
+
}));
|
|
651
548
|
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/lte.js
|
|
652
|
-
var require_lte =
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
module2.exports = lte;
|
|
658
|
-
}
|
|
659
|
-
});
|
|
660
|
-
|
|
549
|
+
var require_lte = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
550
|
+
var compare = require_compare();
|
|
551
|
+
var lte = (a, b, loose) => compare(a, b, loose) <= 0;
|
|
552
|
+
module.exports = lte;
|
|
553
|
+
}));
|
|
661
554
|
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/cmp.js
|
|
662
|
-
var require_cmp =
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
return eq(a, b, loose);
|
|
693
|
-
case "!=":
|
|
694
|
-
return neq(a, b, loose);
|
|
695
|
-
case ">":
|
|
696
|
-
return gt2(a, b, loose);
|
|
697
|
-
case ">=":
|
|
698
|
-
return gte(a, b, loose);
|
|
699
|
-
case "<":
|
|
700
|
-
return lt(a, b, loose);
|
|
701
|
-
case "<=":
|
|
702
|
-
return lte(a, b, loose);
|
|
703
|
-
default:
|
|
704
|
-
throw new TypeError(`Invalid operator: ${op}`);
|
|
705
|
-
}
|
|
706
|
-
};
|
|
707
|
-
module2.exports = cmp;
|
|
708
|
-
}
|
|
709
|
-
});
|
|
710
|
-
|
|
555
|
+
var require_cmp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
556
|
+
var eq = require_eq();
|
|
557
|
+
var neq = require_neq();
|
|
558
|
+
var gt = require_gt();
|
|
559
|
+
var gte = require_gte();
|
|
560
|
+
var lt = require_lt();
|
|
561
|
+
var lte = require_lte();
|
|
562
|
+
var cmp = (a, op, b, loose) => {
|
|
563
|
+
switch (op) {
|
|
564
|
+
case "===":
|
|
565
|
+
if (typeof a === "object") a = a.version;
|
|
566
|
+
if (typeof b === "object") b = b.version;
|
|
567
|
+
return a === b;
|
|
568
|
+
case "!==":
|
|
569
|
+
if (typeof a === "object") a = a.version;
|
|
570
|
+
if (typeof b === "object") b = b.version;
|
|
571
|
+
return a !== b;
|
|
572
|
+
case "":
|
|
573
|
+
case "=":
|
|
574
|
+
case "==": return eq(a, b, loose);
|
|
575
|
+
case "!=": return neq(a, b, loose);
|
|
576
|
+
case ">": return gt(a, b, loose);
|
|
577
|
+
case ">=": return gte(a, b, loose);
|
|
578
|
+
case "<": return lt(a, b, loose);
|
|
579
|
+
case "<=": return lte(a, b, loose);
|
|
580
|
+
default: throw new TypeError(`Invalid operator: ${op}`);
|
|
581
|
+
}
|
|
582
|
+
};
|
|
583
|
+
module.exports = cmp;
|
|
584
|
+
}));
|
|
711
585
|
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/comparator.js
|
|
712
|
-
var require_comparator =
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
return new Range(comp.value, options).test(this.value);
|
|
783
|
-
} else if (comp.operator === "") {
|
|
784
|
-
if (comp.value === "") {
|
|
785
|
-
return true;
|
|
786
|
-
}
|
|
787
|
-
return new Range(this.value, options).test(comp.semver);
|
|
788
|
-
}
|
|
789
|
-
options = parseOptions(options);
|
|
790
|
-
if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
|
|
791
|
-
return false;
|
|
792
|
-
}
|
|
793
|
-
if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
|
|
794
|
-
return false;
|
|
795
|
-
}
|
|
796
|
-
if (this.operator.startsWith(">") && comp.operator.startsWith(">")) {
|
|
797
|
-
return true;
|
|
798
|
-
}
|
|
799
|
-
if (this.operator.startsWith("<") && comp.operator.startsWith("<")) {
|
|
800
|
-
return true;
|
|
801
|
-
}
|
|
802
|
-
if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) {
|
|
803
|
-
return true;
|
|
804
|
-
}
|
|
805
|
-
if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
|
|
806
|
-
return true;
|
|
807
|
-
}
|
|
808
|
-
if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
|
|
809
|
-
return true;
|
|
810
|
-
}
|
|
811
|
-
return false;
|
|
812
|
-
}
|
|
813
|
-
};
|
|
814
|
-
module2.exports = Comparator;
|
|
815
|
-
var parseOptions = require_parse_options();
|
|
816
|
-
var { safeRe: re, t } = require_re();
|
|
817
|
-
var cmp = require_cmp();
|
|
818
|
-
var debug = require_debug();
|
|
819
|
-
var SemVer = require_semver();
|
|
820
|
-
var Range = require_range();
|
|
821
|
-
}
|
|
822
|
-
});
|
|
823
|
-
|
|
586
|
+
var require_comparator = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
587
|
+
var ANY = Symbol("SemVer ANY");
|
|
588
|
+
module.exports = class Comparator {
|
|
589
|
+
static get ANY() {
|
|
590
|
+
return ANY;
|
|
591
|
+
}
|
|
592
|
+
constructor(comp, options) {
|
|
593
|
+
options = parseOptions(options);
|
|
594
|
+
if (comp instanceof Comparator) {
|
|
595
|
+
if (comp.loose === !!options.loose) return comp;
|
|
596
|
+
else comp = comp.value;
|
|
597
|
+
}
|
|
598
|
+
comp = comp.trim().split(/\s+/).join(" ");
|
|
599
|
+
debug("comparator", comp, options);
|
|
600
|
+
this.options = options;
|
|
601
|
+
this.loose = !!options.loose;
|
|
602
|
+
this.parse(comp);
|
|
603
|
+
if (this.semver === ANY) this.value = "";
|
|
604
|
+
else this.value = this.operator + this.semver.version;
|
|
605
|
+
debug("comp", this);
|
|
606
|
+
}
|
|
607
|
+
parse(comp) {
|
|
608
|
+
const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
|
|
609
|
+
const m = comp.match(r);
|
|
610
|
+
if (!m) throw new TypeError(`Invalid comparator: ${comp}`);
|
|
611
|
+
this.operator = m[1] !== void 0 ? m[1] : "";
|
|
612
|
+
if (this.operator === "=") this.operator = "";
|
|
613
|
+
if (!m[2]) this.semver = ANY;
|
|
614
|
+
else this.semver = new SemVer(m[2], this.options.loose);
|
|
615
|
+
}
|
|
616
|
+
toString() {
|
|
617
|
+
return this.value;
|
|
618
|
+
}
|
|
619
|
+
test(version) {
|
|
620
|
+
debug("Comparator.test", version, this.options.loose);
|
|
621
|
+
if (this.semver === ANY || version === ANY) return true;
|
|
622
|
+
if (typeof version === "string") try {
|
|
623
|
+
version = new SemVer(version, this.options);
|
|
624
|
+
} catch (er) {
|
|
625
|
+
return false;
|
|
626
|
+
}
|
|
627
|
+
return cmp(version, this.operator, this.semver, this.options);
|
|
628
|
+
}
|
|
629
|
+
intersects(comp, options) {
|
|
630
|
+
if (!(comp instanceof Comparator)) throw new TypeError("a Comparator is required");
|
|
631
|
+
if (this.operator === "") {
|
|
632
|
+
if (this.value === "") return true;
|
|
633
|
+
return new Range(comp.value, options).test(this.value);
|
|
634
|
+
} else if (comp.operator === "") {
|
|
635
|
+
if (comp.value === "") return true;
|
|
636
|
+
return new Range(this.value, options).test(comp.semver);
|
|
637
|
+
}
|
|
638
|
+
options = parseOptions(options);
|
|
639
|
+
if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) return false;
|
|
640
|
+
if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) return false;
|
|
641
|
+
if (this.operator.startsWith(">") && comp.operator.startsWith(">")) return true;
|
|
642
|
+
if (this.operator.startsWith("<") && comp.operator.startsWith("<")) return true;
|
|
643
|
+
if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) return true;
|
|
644
|
+
if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) return true;
|
|
645
|
+
if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) return true;
|
|
646
|
+
return false;
|
|
647
|
+
}
|
|
648
|
+
};
|
|
649
|
+
var parseOptions = require_parse_options();
|
|
650
|
+
var { safeRe: re, t } = require_re();
|
|
651
|
+
var cmp = require_cmp();
|
|
652
|
+
var debug = require_debug();
|
|
653
|
+
var SemVer = require_semver();
|
|
654
|
+
var Range = require_range();
|
|
655
|
+
}));
|
|
824
656
|
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/range.js
|
|
825
|
-
var require_range =
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
if (xM) {
|
|
1107
|
-
if (gtlt === ">" || gtlt === "<") {
|
|
1108
|
-
ret = "<0.0.0-0";
|
|
1109
|
-
} else {
|
|
1110
|
-
ret = "*";
|
|
1111
|
-
}
|
|
1112
|
-
} else if (gtlt && anyX) {
|
|
1113
|
-
if (xm) {
|
|
1114
|
-
m = 0;
|
|
1115
|
-
}
|
|
1116
|
-
p = 0;
|
|
1117
|
-
if (gtlt === ">") {
|
|
1118
|
-
gtlt = ">=";
|
|
1119
|
-
if (xm) {
|
|
1120
|
-
M = +M + 1;
|
|
1121
|
-
m = 0;
|
|
1122
|
-
p = 0;
|
|
1123
|
-
} else {
|
|
1124
|
-
m = +m + 1;
|
|
1125
|
-
p = 0;
|
|
1126
|
-
}
|
|
1127
|
-
} else if (gtlt === "<=") {
|
|
1128
|
-
gtlt = "<";
|
|
1129
|
-
if (xm) {
|
|
1130
|
-
M = +M + 1;
|
|
1131
|
-
} else {
|
|
1132
|
-
m = +m + 1;
|
|
1133
|
-
}
|
|
1134
|
-
}
|
|
1135
|
-
if (gtlt === "<") {
|
|
1136
|
-
pr = "-0";
|
|
1137
|
-
}
|
|
1138
|
-
ret = `${gtlt + M}.${m}.${p}${pr}`;
|
|
1139
|
-
} else if (xm) {
|
|
1140
|
-
ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
|
|
1141
|
-
} else if (xp) {
|
|
1142
|
-
ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
|
|
1143
|
-
}
|
|
1144
|
-
debug("xRange return", ret);
|
|
1145
|
-
return ret;
|
|
1146
|
-
});
|
|
1147
|
-
};
|
|
1148
|
-
var replaceStars = (comp, options) => {
|
|
1149
|
-
debug("replaceStars", comp, options);
|
|
1150
|
-
return comp.trim().replace(re[t.STAR], "");
|
|
1151
|
-
};
|
|
1152
|
-
var replaceGTE0 = (comp, options) => {
|
|
1153
|
-
debug("replaceGTE0", comp, options);
|
|
1154
|
-
return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
|
|
1155
|
-
};
|
|
1156
|
-
var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
|
|
1157
|
-
if (isX(fM)) {
|
|
1158
|
-
from = "";
|
|
1159
|
-
} else if (isX(fm)) {
|
|
1160
|
-
from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
|
|
1161
|
-
} else if (isX(fp)) {
|
|
1162
|
-
from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
|
|
1163
|
-
} else if (fpr) {
|
|
1164
|
-
from = `>=${from}`;
|
|
1165
|
-
} else {
|
|
1166
|
-
from = `>=${from}${incPr ? "-0" : ""}`;
|
|
1167
|
-
}
|
|
1168
|
-
if (isX(tM)) {
|
|
1169
|
-
to = "";
|
|
1170
|
-
} else if (isX(tm)) {
|
|
1171
|
-
to = `<${+tM + 1}.0.0-0`;
|
|
1172
|
-
} else if (isX(tp)) {
|
|
1173
|
-
to = `<${tM}.${+tm + 1}.0-0`;
|
|
1174
|
-
} else if (tpr) {
|
|
1175
|
-
to = `<=${tM}.${tm}.${tp}-${tpr}`;
|
|
1176
|
-
} else if (incPr) {
|
|
1177
|
-
to = `<${tM}.${tm}.${+tp + 1}-0`;
|
|
1178
|
-
} else {
|
|
1179
|
-
to = `<=${to}`;
|
|
1180
|
-
}
|
|
1181
|
-
return `${from} ${to}`.trim();
|
|
1182
|
-
};
|
|
1183
|
-
var testSet = (set, version, options) => {
|
|
1184
|
-
for (let i = 0; i < set.length; i++) {
|
|
1185
|
-
if (!set[i].test(version)) {
|
|
1186
|
-
return false;
|
|
1187
|
-
}
|
|
1188
|
-
}
|
|
1189
|
-
if (version.prerelease.length && !options.includePrerelease) {
|
|
1190
|
-
for (let i = 0; i < set.length; i++) {
|
|
1191
|
-
debug(set[i].semver);
|
|
1192
|
-
if (set[i].semver === Comparator.ANY) {
|
|
1193
|
-
continue;
|
|
1194
|
-
}
|
|
1195
|
-
if (set[i].semver.prerelease.length > 0) {
|
|
1196
|
-
const allowed = set[i].semver;
|
|
1197
|
-
if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
|
|
1198
|
-
return true;
|
|
1199
|
-
}
|
|
1200
|
-
}
|
|
1201
|
-
}
|
|
1202
|
-
return false;
|
|
1203
|
-
}
|
|
1204
|
-
return true;
|
|
1205
|
-
};
|
|
1206
|
-
}
|
|
1207
|
-
});
|
|
1208
|
-
|
|
657
|
+
var require_range = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
658
|
+
var SPACE_CHARACTERS = /\s+/g;
|
|
659
|
+
module.exports = class Range {
|
|
660
|
+
constructor(range, options) {
|
|
661
|
+
options = parseOptions(options);
|
|
662
|
+
if (range instanceof Range) {
|
|
663
|
+
if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) return range;
|
|
664
|
+
else return new Range(range.raw, options);
|
|
665
|
+
}
|
|
666
|
+
if (range instanceof Comparator) {
|
|
667
|
+
this.raw = range.value;
|
|
668
|
+
this.set = [[range]];
|
|
669
|
+
this.formatted = void 0;
|
|
670
|
+
return this;
|
|
671
|
+
}
|
|
672
|
+
this.options = options;
|
|
673
|
+
this.loose = !!options.loose;
|
|
674
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
675
|
+
this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
|
|
676
|
+
this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
|
|
677
|
+
if (!this.set.length) throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
|
|
678
|
+
if (this.set.length > 1) {
|
|
679
|
+
const first = this.set[0];
|
|
680
|
+
this.set = this.set.filter((c) => !isNullSet(c[0]));
|
|
681
|
+
if (this.set.length === 0) this.set = [first];
|
|
682
|
+
else if (this.set.length > 1) {
|
|
683
|
+
for (const c of this.set) if (c.length === 1 && isAny(c[0])) {
|
|
684
|
+
this.set = [c];
|
|
685
|
+
break;
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
this.formatted = void 0;
|
|
690
|
+
}
|
|
691
|
+
get range() {
|
|
692
|
+
if (this.formatted === void 0) {
|
|
693
|
+
this.formatted = "";
|
|
694
|
+
for (let i = 0; i < this.set.length; i++) {
|
|
695
|
+
if (i > 0) this.formatted += "||";
|
|
696
|
+
const comps = this.set[i];
|
|
697
|
+
for (let k = 0; k < comps.length; k++) {
|
|
698
|
+
if (k > 0) this.formatted += " ";
|
|
699
|
+
this.formatted += comps[k].toString().trim();
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
return this.formatted;
|
|
704
|
+
}
|
|
705
|
+
format() {
|
|
706
|
+
return this.range;
|
|
707
|
+
}
|
|
708
|
+
toString() {
|
|
709
|
+
return this.range;
|
|
710
|
+
}
|
|
711
|
+
parseRange(range) {
|
|
712
|
+
range = range.replace(BUILDSTRIPRE, "");
|
|
713
|
+
const memoKey = ((this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE)) + ":" + range;
|
|
714
|
+
const cached = cache.get(memoKey);
|
|
715
|
+
if (cached) return cached;
|
|
716
|
+
const loose = this.options.loose;
|
|
717
|
+
const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
|
|
718
|
+
range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
|
|
719
|
+
debug("hyphen replace", range);
|
|
720
|
+
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
|
|
721
|
+
debug("comparator trim", range);
|
|
722
|
+
range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
|
|
723
|
+
debug("tilde trim", range);
|
|
724
|
+
range = range.replace(re[t.CARETTRIM], caretTrimReplace);
|
|
725
|
+
debug("caret trim", range);
|
|
726
|
+
let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
|
|
727
|
+
if (loose) rangeList = rangeList.filter((comp) => {
|
|
728
|
+
debug("loose invalid filter", comp, this.options);
|
|
729
|
+
return !!comp.match(re[t.COMPARATORLOOSE]);
|
|
730
|
+
});
|
|
731
|
+
debug("range list", rangeList);
|
|
732
|
+
const rangeMap = /* @__PURE__ */ new Map();
|
|
733
|
+
const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
|
|
734
|
+
for (const comp of comparators) {
|
|
735
|
+
if (isNullSet(comp)) return [comp];
|
|
736
|
+
rangeMap.set(comp.value, comp);
|
|
737
|
+
}
|
|
738
|
+
if (rangeMap.size > 1 && rangeMap.has("")) rangeMap.delete("");
|
|
739
|
+
const result = [...rangeMap.values()];
|
|
740
|
+
cache.set(memoKey, result);
|
|
741
|
+
return result;
|
|
742
|
+
}
|
|
743
|
+
intersects(range, options) {
|
|
744
|
+
if (!(range instanceof Range)) throw new TypeError("a Range is required");
|
|
745
|
+
return this.set.some((thisComparators) => {
|
|
746
|
+
return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
|
|
747
|
+
return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
|
|
748
|
+
return rangeComparators.every((rangeComparator) => {
|
|
749
|
+
return thisComparator.intersects(rangeComparator, options);
|
|
750
|
+
});
|
|
751
|
+
});
|
|
752
|
+
});
|
|
753
|
+
});
|
|
754
|
+
}
|
|
755
|
+
test(version) {
|
|
756
|
+
if (!version) return false;
|
|
757
|
+
if (typeof version === "string") try {
|
|
758
|
+
version = new SemVer(version, this.options);
|
|
759
|
+
} catch (er) {
|
|
760
|
+
return false;
|
|
761
|
+
}
|
|
762
|
+
for (let i = 0; i < this.set.length; i++) if (testSet(this.set[i], version, this.options)) return true;
|
|
763
|
+
return false;
|
|
764
|
+
}
|
|
765
|
+
};
|
|
766
|
+
var cache = new (require_lrucache())();
|
|
767
|
+
var parseOptions = require_parse_options();
|
|
768
|
+
var Comparator = require_comparator();
|
|
769
|
+
var debug = require_debug();
|
|
770
|
+
var SemVer = require_semver();
|
|
771
|
+
var { safeRe: re, src, t, comparatorTrimReplace, tildeTrimReplace, caretTrimReplace } = require_re();
|
|
772
|
+
var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
|
|
773
|
+
var BUILDSTRIPRE = new RegExp(src[t.BUILD], "g");
|
|
774
|
+
var isNullSet = (c) => c.value === "<0.0.0-0";
|
|
775
|
+
var isAny = (c) => c.value === "";
|
|
776
|
+
var isSatisfiable = (comparators, options) => {
|
|
777
|
+
let result = true;
|
|
778
|
+
const remainingComparators = comparators.slice();
|
|
779
|
+
let testComparator = remainingComparators.pop();
|
|
780
|
+
while (result && remainingComparators.length) {
|
|
781
|
+
result = remainingComparators.every((otherComparator) => {
|
|
782
|
+
return testComparator.intersects(otherComparator, options);
|
|
783
|
+
});
|
|
784
|
+
testComparator = remainingComparators.pop();
|
|
785
|
+
}
|
|
786
|
+
return result;
|
|
787
|
+
};
|
|
788
|
+
var parseComparator = (comp, options) => {
|
|
789
|
+
comp = comp.replace(re[t.BUILD], "");
|
|
790
|
+
debug("comp", comp, options);
|
|
791
|
+
comp = replaceCarets(comp, options);
|
|
792
|
+
debug("caret", comp);
|
|
793
|
+
comp = replaceTildes(comp, options);
|
|
794
|
+
debug("tildes", comp);
|
|
795
|
+
comp = replaceXRanges(comp, options);
|
|
796
|
+
debug("xrange", comp);
|
|
797
|
+
comp = replaceStars(comp, options);
|
|
798
|
+
debug("stars", comp);
|
|
799
|
+
return comp;
|
|
800
|
+
};
|
|
801
|
+
var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
|
|
802
|
+
var invalidXRangeOrder = (M, m, p) => isX(M) && !isX(m) || isX(m) && p && !isX(p);
|
|
803
|
+
var replaceTildes = (comp, options) => {
|
|
804
|
+
return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
|
|
805
|
+
};
|
|
806
|
+
var replaceTilde = (comp, options) => {
|
|
807
|
+
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
|
808
|
+
const z = options.includePrerelease ? "-0" : "";
|
|
809
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
810
|
+
debug("tilde", comp, _, M, m, p, pr);
|
|
811
|
+
let ret;
|
|
812
|
+
if (isX(M)) ret = "";
|
|
813
|
+
else if (isX(m)) ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
814
|
+
else if (isX(p)) ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
|
|
815
|
+
else if (pr) {
|
|
816
|
+
debug("replaceTilde pr", pr);
|
|
817
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
818
|
+
} else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
|
|
819
|
+
debug("tilde return", ret);
|
|
820
|
+
return ret;
|
|
821
|
+
});
|
|
822
|
+
};
|
|
823
|
+
var replaceCarets = (comp, options) => {
|
|
824
|
+
return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
|
|
825
|
+
};
|
|
826
|
+
var replaceCaret = (comp, options) => {
|
|
827
|
+
debug("caret", comp, options);
|
|
828
|
+
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
|
829
|
+
const z = options.includePrerelease ? "-0" : "";
|
|
830
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
831
|
+
debug("caret", comp, _, M, m, p, pr);
|
|
832
|
+
let ret;
|
|
833
|
+
if (isX(M)) ret = "";
|
|
834
|
+
else if (isX(m)) ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
835
|
+
else if (isX(p)) {
|
|
836
|
+
if (M === "0") ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
|
|
837
|
+
else ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
|
|
838
|
+
} else if (pr) {
|
|
839
|
+
debug("replaceCaret pr", pr);
|
|
840
|
+
if (M === "0") {
|
|
841
|
+
if (m === "0") ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
|
|
842
|
+
else ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
843
|
+
} else ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
|
|
844
|
+
} else {
|
|
845
|
+
debug("no pr");
|
|
846
|
+
if (M === "0") {
|
|
847
|
+
if (m === "0") ret = `>=${M}.${m}.${p} <${M}.${m}.${+p + 1}-0`;
|
|
848
|
+
else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
|
|
849
|
+
} else ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
|
|
850
|
+
}
|
|
851
|
+
debug("caret return", ret);
|
|
852
|
+
return ret;
|
|
853
|
+
});
|
|
854
|
+
};
|
|
855
|
+
var replaceXRanges = (comp, options) => {
|
|
856
|
+
debug("replaceXRanges", comp, options);
|
|
857
|
+
return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
|
|
858
|
+
};
|
|
859
|
+
var replaceXRange = (comp, options) => {
|
|
860
|
+
comp = comp.trim();
|
|
861
|
+
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
|
|
862
|
+
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
|
863
|
+
debug("xRange", comp, ret, gtlt, M, m, p, pr);
|
|
864
|
+
if (invalidXRangeOrder(M, m, p)) return comp;
|
|
865
|
+
const xM = isX(M);
|
|
866
|
+
const xm = xM || isX(m);
|
|
867
|
+
const xp = xm || isX(p);
|
|
868
|
+
const anyX = xp;
|
|
869
|
+
if (gtlt === "=" && anyX) gtlt = "";
|
|
870
|
+
pr = options.includePrerelease ? "-0" : "";
|
|
871
|
+
if (xM) {
|
|
872
|
+
if (gtlt === ">" || gtlt === "<") ret = "<0.0.0-0";
|
|
873
|
+
else ret = "*";
|
|
874
|
+
} else if (gtlt && anyX) {
|
|
875
|
+
if (xm) m = 0;
|
|
876
|
+
p = 0;
|
|
877
|
+
if (gtlt === ">") {
|
|
878
|
+
gtlt = ">=";
|
|
879
|
+
if (xm) {
|
|
880
|
+
M = +M + 1;
|
|
881
|
+
m = 0;
|
|
882
|
+
p = 0;
|
|
883
|
+
} else {
|
|
884
|
+
m = +m + 1;
|
|
885
|
+
p = 0;
|
|
886
|
+
}
|
|
887
|
+
} else if (gtlt === "<=") {
|
|
888
|
+
gtlt = "<";
|
|
889
|
+
if (xm) M = +M + 1;
|
|
890
|
+
else m = +m + 1;
|
|
891
|
+
}
|
|
892
|
+
if (gtlt === "<") pr = "-0";
|
|
893
|
+
ret = `${gtlt + M}.${m}.${p}${pr}`;
|
|
894
|
+
} else if (xm) ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
|
|
895
|
+
else if (xp) ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
|
|
896
|
+
debug("xRange return", ret);
|
|
897
|
+
return ret;
|
|
898
|
+
});
|
|
899
|
+
};
|
|
900
|
+
var replaceStars = (comp, options) => {
|
|
901
|
+
debug("replaceStars", comp, options);
|
|
902
|
+
return comp.trim().replace(re[t.STAR], "");
|
|
903
|
+
};
|
|
904
|
+
var replaceGTE0 = (comp, options) => {
|
|
905
|
+
debug("replaceGTE0", comp, options);
|
|
906
|
+
return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
|
|
907
|
+
};
|
|
908
|
+
var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
|
|
909
|
+
if (isX(fM)) from = "";
|
|
910
|
+
else if (isX(fm)) from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
|
|
911
|
+
else if (isX(fp)) from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
|
|
912
|
+
else if (fpr) from = `>=${from}`;
|
|
913
|
+
else from = `>=${from}${incPr ? "-0" : ""}`;
|
|
914
|
+
if (isX(tM)) to = "";
|
|
915
|
+
else if (isX(tm)) to = `<${+tM + 1}.0.0-0`;
|
|
916
|
+
else if (isX(tp)) to = `<${tM}.${+tm + 1}.0-0`;
|
|
917
|
+
else if (tpr) to = `<=${tM}.${tm}.${tp}-${tpr}`;
|
|
918
|
+
else if (incPr) to = `<${tM}.${tm}.${+tp + 1}-0`;
|
|
919
|
+
else to = `<=${to}`;
|
|
920
|
+
return `${from} ${to}`.trim();
|
|
921
|
+
};
|
|
922
|
+
var testSet = (set, version, options) => {
|
|
923
|
+
for (let i = 0; i < set.length; i++) if (!set[i].test(version)) return false;
|
|
924
|
+
if (version.prerelease.length && !options.includePrerelease) {
|
|
925
|
+
for (let i = 0; i < set.length; i++) {
|
|
926
|
+
debug(set[i].semver);
|
|
927
|
+
if (set[i].semver === Comparator.ANY) continue;
|
|
928
|
+
if (set[i].semver.prerelease.length > 0) {
|
|
929
|
+
const allowed = set[i].semver;
|
|
930
|
+
if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) return true;
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
return false;
|
|
934
|
+
}
|
|
935
|
+
return true;
|
|
936
|
+
};
|
|
937
|
+
}));
|
|
1209
938
|
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/satisfies.js
|
|
1210
|
-
var require_satisfies =
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
module2.exports = satisfies2;
|
|
1223
|
-
}
|
|
1224
|
-
});
|
|
1225
|
-
|
|
939
|
+
var require_satisfies = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
940
|
+
var Range = require_range();
|
|
941
|
+
var satisfies = (version, range, options) => {
|
|
942
|
+
try {
|
|
943
|
+
range = new Range(range, options);
|
|
944
|
+
} catch (er) {
|
|
945
|
+
return false;
|
|
946
|
+
}
|
|
947
|
+
return range.test(version);
|
|
948
|
+
};
|
|
949
|
+
module.exports = satisfies;
|
|
950
|
+
}));
|
|
1226
951
|
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/valid.js
|
|
1227
|
-
var require_valid =
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
module2.exports = valid2;
|
|
1236
|
-
}
|
|
1237
|
-
});
|
|
1238
|
-
|
|
952
|
+
var require_valid$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
953
|
+
var parse = require_parse();
|
|
954
|
+
var valid = (version, options) => {
|
|
955
|
+
const v = parse(version, options);
|
|
956
|
+
return v ? v.version : null;
|
|
957
|
+
};
|
|
958
|
+
module.exports = valid;
|
|
959
|
+
}));
|
|
1239
960
|
// ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/valid.js
|
|
1240
|
-
var
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
module2.exports = validRange2;
|
|
1252
|
-
}
|
|
1253
|
-
});
|
|
1254
|
-
|
|
1255
|
-
// src/client/index.tsx
|
|
1256
|
-
var index_exports = {};
|
|
1257
|
-
__export(index_exports, {
|
|
1258
|
-
apply: () => apply,
|
|
1259
|
-
inject: () => inject,
|
|
1260
|
-
name: () => name
|
|
1261
|
-
});
|
|
1262
|
-
module.exports = __toCommonJS(index_exports);
|
|
1263
|
-
|
|
1264
|
-
// src/client/locale.ts
|
|
1265
|
-
var LOCALE_NS = "dshPluginUpdates";
|
|
1266
|
-
var ZH = {
|
|
1267
|
-
"updateAllCount": "\u5168\u90E8\u66F4\u65B0\uFF08{count}\uFF09",
|
|
1268
|
-
"updateLabel": "\u628A {name} \u66F4\u65B0\u5230 {version}",
|
|
1269
|
-
"updating": "\u66F4\u65B0\u4E2D\u2026",
|
|
1270
|
-
"updateTo": "\u66F4\u65B0\u5230 {version}",
|
|
1271
|
-
"install": "\u5B89\u88C5",
|
|
1272
|
-
"status.update": "\u53EF\u66F4\u65B0 {version}",
|
|
1273
|
-
"versions.loading": "\u6B63\u5728\u8BFB\u53D6\u7248\u672C\u2026",
|
|
1274
|
-
"version.current": "\u5F53\u524D {version}",
|
|
1275
|
-
"versions.title": "\u7248\u672C",
|
|
1276
|
-
"versions.registry": "\u6765\u81EA {registry}",
|
|
1277
|
-
"versions.showAll": "\u663E\u793A\u5168\u90E8 {count} \u4E2A\u7248\u672C",
|
|
1278
|
-
"versions.empty": "\u6CA1\u6709\u53EF\u7528\u7684\u7248\u672C\u4FE1\u606F",
|
|
1279
|
-
"versions.failed": "\u65E0\u6CD5\u4ECE npm \u8BFB\u53D6\u7248\u672C\uFF1A{reason}",
|
|
1280
|
-
"tag.current": "\u5F53\u524D",
|
|
1281
|
-
"tag.prerelease": "\u9884\u53D1\u5E03",
|
|
1282
|
-
"tag.deprecated": "\u5DF2\u5E9F\u5F03",
|
|
1283
|
-
"tag.incompatible": "\u4E0D\u517C\u5BB9",
|
|
1284
|
-
"tag.fresh": "\u65B0\u53D1\u5E03",
|
|
1285
|
-
"hint.fresh": "\u53D1\u5E03\u4E0D\u8DB3 24 \u5C0F\u65F6\uFF1Apnpm \u9ED8\u8BA4\u4E0D\u5B89\u88C5\u8FD9\u4E48\u65B0\u7684\u7248\u672C\uFF0C\u5B89\u88C5\u53EF\u80FD\u5931\u8D25",
|
|
1286
|
-
"hint.incompatible": "\u4E0E\u5F53\u524D DSH \u7248\u672C\u4E0D\u517C\u5BB9\uFF0C\u5B89\u88C5\u4F1A\u88AB\u62D2\u7EDD",
|
|
1287
|
-
"self.body": "\u53EF\u4EE5\u66F4\u65B0\u5230 {version}\u3002\u66F4\u65B0\u5728\u5BBF\u4E3B\u540E\u53F0\u8FDB\u884C\uFF0C\u671F\u95F4\u672C\u63D2\u4EF6\u7684\u754C\u9762\u4F1A\u6682\u65F6\u6D88\u5931",
|
|
1288
|
-
"self.confirmTitle": "\u628A\u672C\u63D2\u4EF6\u66F4\u65B0\u5230 {version}\uFF1F",
|
|
1289
|
-
"self.confirmBody": "\u5BBF\u4E3B\u4F1A\u5148\u5378\u8F7D\u5F53\u524D\u7248\u672C\uFF0C\u518D\u5B89\u88C5\u65B0\u7248\u672C\u3002\u671F\u95F4\u63D2\u4EF6\u9875\u4E0A\u7684\u66F4\u65B0\u6309\u94AE\u4F1A\u6682\u65F6\u6D88\u5931\uFF0C\u88C5\u597D\u540E\u81EA\u52A8\u56DE\u6765\uFF1B\u65B0\u7248\u672C\u88C5\u4E0D\u4E0A\u65F6\u4F1A\u88C5\u56DE\u5F53\u524D\u7248\u672C\u3002\u5982\u679C\u8FDE\u5F53\u524D\u7248\u672C\u4E5F\u88C5\u4E0D\u56DE\uFF0C\u53EF\u4EE5\u9000\u51FA DSH \u540E\u5728\u7EC8\u7AEF\u8FD0\u884C\u4E0B\u9762\u7684\u547D\u4EE4\u624B\u52A8\u5B89\u88C5\uFF1A",
|
|
1290
|
-
"self.cancel": "\u53D6\u6D88",
|
|
1291
|
-
"self.copy": "\u590D\u5236\u547D\u4EE4",
|
|
1292
|
-
"self.copied": "\u5DF2\u590D\u5236",
|
|
1293
|
-
"error.policy": "pnpm \u5904\u7406 minimumReleaseAge \u65F6\u53D1\u751F\u5185\u90E8\u9519\u8BEF\u3002\u8BF7\u5347\u7EA7\u5BBF\u4E3B\u9644\u5E26\u7684 pnpm\uFF0C\u6216\u7B49\u53D1\u5E03\u7B49\u5F85\u671F\u7ED3\u675F\u540E\u91CD\u8BD5\uFF1B\u5B8C\u6574\u9519\u8BEF\u89C1\u4E0B\u65B9\u65E5\u5FD7",
|
|
1294
|
-
"error.inconsistent": "\u5B89\u88C5\u58F0\u660E\u4E0E\u5B9E\u9645\u7248\u672C\u4E0D\u4E00\u81F4\uFF0C\u8BF7\u5148\u7528\u5BBF\u4E3B\u63D2\u4EF6\u7BA1\u7406\u5668\u6216 CLI \u4FEE\u590D\u5B89\u88C5\uFF0C\u518D\u91CD\u8BD5\u66F4\u65B0",
|
|
1295
|
-
"error.stateChanged": "\u63D2\u4EF6\u5B89\u88C5\u72B6\u6001\u5DF2\u53D8\u5316\uFF0C\u8BF7\u5237\u65B0\u63D2\u4EF6\u5217\u8868\u540E\u91CD\u8BD5",
|
|
1296
|
-
"error.interrupted": "\u5BBF\u4E3B\u5728\u66F4\u65B0\u5B8C\u6210\u524D\u9000\u51FA\u4E86\uFF0C\u8BF7\u68C0\u67E5\u63D2\u4EF6\u5217\u8868\u91CC\u7684\u7248\u672C",
|
|
1297
|
-
"error.selfBusy": "\u5DF2\u6709\u4E00\u4E2A\u81EA\u66F4\u65B0\u5728\u8FDB\u884C",
|
|
1298
|
-
"op.checking": "\u6B63\u5728\u6838\u5BF9 {name} \u7684\u5B89\u88C5\u72B6\u6001\u2026",
|
|
1299
|
-
"op.checkFailed": "\u65E0\u6CD5\u786E\u8BA4 {name} \u7684\u5B89\u88C5\u72B6\u6001\uFF0C\u5DF2\u505C\u6B62\u64CD\u4F5C\uFF1A{reason}",
|
|
1300
|
-
"op.current": "{name} \u5DF2\u662F {to}\uFF0C\u65E0\u9700\u91CD\u590D\u5B89\u88C5",
|
|
1301
|
-
"op.removing": "\u6B63\u5728\u5378\u8F7D {name} {from}\u2026",
|
|
1302
|
-
"op.installing": "\u6B63\u5728\u5B89\u88C5 {name} {to}\u2026",
|
|
1303
|
-
"op.restoring": "\u6B63\u5728\u6062\u590D {name} {to}\u2026",
|
|
1304
|
-
"op.done": "{name} \u5DF2\u5207\u6362\u5230 {to}",
|
|
1305
|
-
"op.restart": "{name} \u5DF2\u5207\u6362\u5230 {to}\uFF0C\u91CD\u542F DSH \u540E\u751F\u6548",
|
|
1306
|
-
"op.failed": "{name} \u5B89\u88C5 {to} \u5931\u8D25\uFF1A{reason}",
|
|
1307
|
-
"op.restored": "{name} \u5B89\u88C5 {to} \u5931\u8D25\uFF0C\u5DF2\u88C5\u56DE {from}\uFF1A{reason}",
|
|
1308
|
-
"op.selfFailed": "{name} \u66F4\u65B0\u5230 {to} \u5931\u8D25\uFF1A{reason}",
|
|
1309
|
-
"op.removeFailed": "{name} \u5378\u8F7D\u672A\u5B8C\u6210\uFF0C\u5DF2\u505C\u6B62\u540E\u7EED\u5B89\u88C5\uFF1A{reason}",
|
|
1310
|
-
"op.restore": "\u6062\u590D {from}",
|
|
1311
|
-
"op.dismiss": "\u5173\u95ED",
|
|
1312
|
-
"op.log": "\u65E5\u5FD7\uFF1A{path}"
|
|
1313
|
-
};
|
|
1314
|
-
var EN = {
|
|
1315
|
-
"updateAllCount": "Update all ({count})",
|
|
1316
|
-
"updateLabel": "Update {name} to {version}",
|
|
1317
|
-
"updating": "Updating\u2026",
|
|
1318
|
-
"updateTo": "Update to {version}",
|
|
1319
|
-
"install": "Install",
|
|
1320
|
-
"status.update": "Update {version}",
|
|
1321
|
-
"versions.loading": "Reading versions\u2026",
|
|
1322
|
-
"version.current": "Current {version}",
|
|
1323
|
-
"versions.title": "Versions",
|
|
1324
|
-
"versions.registry": "From {registry}",
|
|
1325
|
-
"versions.showAll": "Show all {count} versions",
|
|
1326
|
-
"versions.empty": "No version information",
|
|
1327
|
-
"versions.failed": "Could not read versions from npm: {reason}",
|
|
1328
|
-
"tag.current": "Current",
|
|
1329
|
-
"tag.prerelease": "Prerelease",
|
|
1330
|
-
"tag.deprecated": "Deprecated",
|
|
1331
|
-
"tag.incompatible": "Incompatible",
|
|
1332
|
-
"tag.fresh": "New",
|
|
1333
|
-
"hint.fresh": "Published less than 24 hours ago: pnpm does not install versions this new by default, so installing may fail",
|
|
1334
|
-
"hint.incompatible": "Not compatible with this DSH version; the installation would be refused",
|
|
1335
|
-
"self.body": "Version {version} is available. The host updates this plugin in the background, and its controls disappear meanwhile",
|
|
1336
|
-
"self.confirmTitle": "Update this plugin to {version}?",
|
|
1337
|
-
"self.confirmBody": "The host uninstalls the current version, then installs the new one. The update controls on the Plugins page disappear meanwhile and come back once it is installed; if the new version cannot be installed, the current one is put back. If even that fails, quit DSH and run this command in a terminal to install it by hand:",
|
|
1338
|
-
"self.cancel": "Cancel",
|
|
1339
|
-
"self.copy": "Copy command",
|
|
1340
|
-
"self.copied": "Copied",
|
|
1341
|
-
"error.policy": "pnpm hit an internal error while handling minimumReleaseAge. Upgrade the pnpm bundled with the host, or retry after the release-age waiting period; see the full error below",
|
|
1342
|
-
"error.inconsistent": "The declared and installed versions differ. Repair the installation with the host plugin manager or CLI before retrying",
|
|
1343
|
-
"error.stateChanged": "The installed state has changed. Refresh the plugin list and retry",
|
|
1344
|
-
"error.interrupted": "The host stopped before the update finished; check the version in the plugin list",
|
|
1345
|
-
"error.selfBusy": "A self-update is already running",
|
|
1346
|
-
"op.checking": "Checking the installed version of {name}\u2026",
|
|
1347
|
-
"op.checkFailed": "Could not confirm the installed state of {name}; stopped: {reason}",
|
|
1348
|
-
"op.current": "{name} is already at {to}; no reinstall needed",
|
|
1349
|
-
"op.removing": "Uninstalling {name} {from}\u2026",
|
|
1350
|
-
"op.installing": "Installing {name} {to}\u2026",
|
|
1351
|
-
"op.restoring": "Restoring {name} {to}\u2026",
|
|
1352
|
-
"op.done": "{name} is now at {to}",
|
|
1353
|
-
"op.restart": "{name} is now at {to}; restart DSH to apply it",
|
|
1354
|
-
"op.failed": "Could not install {name} {to}: {reason}",
|
|
1355
|
-
"op.restored": "Could not install {name} {to}; {from} was put back: {reason}",
|
|
1356
|
-
"op.selfFailed": "Could not update {name} to {to}: {reason}",
|
|
1357
|
-
"op.removeFailed": "Uninstalling {name} did not finish; installation was not started: {reason}",
|
|
1358
|
-
"op.restore": "Restore {from}",
|
|
1359
|
-
"op.dismiss": "Dismiss",
|
|
1360
|
-
"op.log": "Log: {path}"
|
|
1361
|
-
};
|
|
1362
|
-
|
|
1363
|
-
// src/client/model.ts
|
|
1364
|
-
var import_gt = __toESM(require_gt(), 1);
|
|
1365
|
-
var import_prerelease = __toESM(require_prerelease(), 1);
|
|
1366
|
-
var import_rcompare = __toESM(require_rcompare(), 1);
|
|
1367
|
-
var import_satisfies = __toESM(require_satisfies(), 1);
|
|
1368
|
-
var import_valid = __toESM(require_valid(), 1);
|
|
1369
|
-
var import_valid2 = __toESM(require_valid2(), 1);
|
|
1370
|
-
|
|
961
|
+
var require_valid = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
962
|
+
var Range = require_range();
|
|
963
|
+
var validRange = (range, options) => {
|
|
964
|
+
try {
|
|
965
|
+
return new Range(range, options).range || "*";
|
|
966
|
+
} catch (er) {
|
|
967
|
+
return null;
|
|
968
|
+
}
|
|
969
|
+
};
|
|
970
|
+
module.exports = validRange;
|
|
971
|
+
}));
|
|
1371
972
|
// src/shared/protocol.ts
|
|
973
|
+
var import_gt = /* @__PURE__ */ __toESM(require_gt(), 1);
|
|
974
|
+
var import_prerelease = /* @__PURE__ */ __toESM(require_prerelease(), 1);
|
|
975
|
+
var import_rcompare = /* @__PURE__ */ __toESM(require_rcompare(), 1);
|
|
976
|
+
var import_satisfies = /* @__PURE__ */ __toESM(require_satisfies(), 1);
|
|
977
|
+
var import_valid = /* @__PURE__ */ __toESM(require_valid$1(), 1);
|
|
978
|
+
var import_valid$1 = /* @__PURE__ */ __toESM(require_valid(), 1);
|
|
1372
979
|
var SELF = "@shellraining/dsh-plugin-updates";
|
|
980
|
+
/**
|
|
981
|
+
* Authenticated Connection route: GET reads the last self-update, POST starts
|
|
982
|
+
* one. Browser-relative, like the host's own `/api/*` routes.
|
|
983
|
+
*/
|
|
1373
984
|
var SELF_UPDATE_PATH = "/api/dsh-plugin-updates.self-update";
|
|
1374
985
|
function isRunning(status) {
|
|
1375
|
-
|
|
986
|
+
return status?.phase === "removing" || status?.phase === "installing" || status?.phase === "restoring";
|
|
1376
987
|
}
|
|
988
|
+
/** pnpm may print successful checks before the actual error; pick the first error line. */
|
|
1377
989
|
function errorLine(text) {
|
|
1378
|
-
|
|
990
|
+
return text.split("\n").map((line) => line.trim()).filter(Boolean).find((line) => /\bERR[_!\s]|\berror\b|\bfatal\b/i.test(line));
|
|
1379
991
|
}
|
|
1380
|
-
|
|
1381
992
|
// src/client/model.ts
|
|
1382
993
|
var DEFAULT_REGISTRY = "https://registry.npmjs.org/";
|
|
1383
|
-
var CACHE_MS =
|
|
1384
|
-
var FRESH_MS =
|
|
994
|
+
var CACHE_MS = 6e5;
|
|
995
|
+
var FRESH_MS = 864e5;
|
|
1385
996
|
var POLL_MS = 1e3;
|
|
1386
997
|
var SEEN_KEY = `${SELF}:self-update-seen`;
|
|
998
|
+
/** The newest stable, compatible, non-deprecated version above the installed one. */
|
|
1387
999
|
function updateTarget(candidate, lookup) {
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1000
|
+
if (lookup?.status !== "ready") return void 0;
|
|
1001
|
+
const best = lookup.versions.find((info) => info.compatible && !info.prerelease && !info.deprecated);
|
|
1002
|
+
return best !== void 0 && (0, import_gt.default)(best.version, candidate.version) ? best.version : void 0;
|
|
1391
1003
|
}
|
|
1392
1004
|
function isBusy(operation) {
|
|
1393
|
-
|
|
1005
|
+
return operation?.phase === "checking" || operation?.phase === "removing" || operation?.phase === "installing";
|
|
1394
1006
|
}
|
|
1395
1007
|
function record(value) {
|
|
1396
|
-
|
|
1008
|
+
return typeof value === "object" && value !== null ? value : {};
|
|
1397
1009
|
}
|
|
1398
1010
|
function errorText(error) {
|
|
1399
|
-
|
|
1011
|
+
return error instanceof Error ? error.message : String(error);
|
|
1400
1012
|
}
|
|
1013
|
+
/** pnpm may print successful checks before the actual error. Keep the full output separately. */
|
|
1401
1014
|
function failureReason(result) {
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
return errorLine(lines) ?? error?.code ?? diagnostic ?? application;
|
|
1015
|
+
if (!result.ok) return result.error.message;
|
|
1016
|
+
const { error, packageResult, application } = result.value;
|
|
1017
|
+
const diagnostic = error?.diagnostic?.trim();
|
|
1018
|
+
return errorLine(diagnostic || packageResult?.output || "") ?? error?.code ?? diagnostic ?? application;
|
|
1407
1019
|
}
|
|
1020
|
+
/** The host half's self-update route, document-relative like the host's own `/api/*` routes. */
|
|
1408
1021
|
async function selfRequest(init) {
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1022
|
+
const response = await fetch(SELF_UPDATE_PATH.slice(1), {
|
|
1023
|
+
credentials: "same-origin",
|
|
1024
|
+
cache: "no-store",
|
|
1025
|
+
...init
|
|
1026
|
+
});
|
|
1027
|
+
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
1028
|
+
const body = record(await response.json());
|
|
1029
|
+
if (body["ok"] === true) {
|
|
1030
|
+
const status = record(body["status"]);
|
|
1031
|
+
return {
|
|
1032
|
+
ok: true,
|
|
1033
|
+
status: typeof status["id"] === "string" && typeof status["from"] === "string" && typeof status["to"] === "string" && typeof status["phase"] === "string" ? status : null
|
|
1034
|
+
};
|
|
1035
|
+
}
|
|
1036
|
+
const code = body["code"];
|
|
1037
|
+
return {
|
|
1038
|
+
ok: false,
|
|
1039
|
+
code: code === "invalid-version" || code === "busy" || code === "not-npm" || code === "current" ? code : "internal",
|
|
1040
|
+
...typeof body["message"] === "string" ? { message: body["message"] } : {}
|
|
1041
|
+
};
|
|
1419
1042
|
}
|
|
1043
|
+
/** A self-update as the operation banner and toast show it. */
|
|
1420
1044
|
function selfOperation(status, toast) {
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1045
|
+
const phase = status.phase === "restoring" ? "installing" : status.phase;
|
|
1046
|
+
return {
|
|
1047
|
+
name: SELF,
|
|
1048
|
+
from: status.from,
|
|
1049
|
+
to: status.phase === "restoring" ? status.from : status.to,
|
|
1050
|
+
enabled: true,
|
|
1051
|
+
phase,
|
|
1052
|
+
restoring: status.phase === "restoring",
|
|
1053
|
+
...status.reason === void 0 ? {} : { reason: status.reason },
|
|
1054
|
+
...status.output === void 0 ? {} : { output: status.output },
|
|
1055
|
+
...status.logPath === void 0 ? {} : { logPath: status.logPath },
|
|
1056
|
+
...toast ? { toast: Date.now() } : {}
|
|
1057
|
+
};
|
|
1434
1058
|
}
|
|
1435
1059
|
function seen(id) {
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1060
|
+
try {
|
|
1061
|
+
return localStorage.getItem(SEEN_KEY) === id;
|
|
1062
|
+
} catch {
|
|
1063
|
+
return false;
|
|
1064
|
+
}
|
|
1441
1065
|
}
|
|
1442
1066
|
function markSeen(id) {
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
}
|
|
1067
|
+
try {
|
|
1068
|
+
localStorage.setItem(SEEN_KEY, id);
|
|
1069
|
+
} catch {}
|
|
1447
1070
|
}
|
|
1071
|
+
/** `name@range` as pnpm records a registry dependency; git, link, file and tarball sources do not parse. */
|
|
1448
1072
|
function npmInstalled(bundle) {
|
|
1449
|
-
|
|
1450
|
-
|
|
1073
|
+
const prefix = `${bundle.name}@`;
|
|
1074
|
+
return bundle.installed && !bundle.official && bundle.availability === "profile" && bundle.removable && bundle.readOnlyReason === void 0 && (0, import_valid.default)(bundle.version ?? "") !== null && bundle.source?.startsWith(prefix) === true && (0, import_valid$1.default)(bundle.source.slice(prefix.length)) !== null;
|
|
1451
1075
|
}
|
|
1076
|
+
/** The DSH requirements check app-boot applies: an own `engines.dsh`, otherwise every DSH peer. */
|
|
1452
1077
|
function compatibleWith(manifest, runtime) {
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1078
|
+
if (runtime === void 0) return true;
|
|
1079
|
+
const fits = (range) => typeof range === "string" && range.trim() !== "" && (0, import_satisfies.default)(runtime, range, { includePrerelease: true });
|
|
1080
|
+
const engines = record(manifest["engines"]);
|
|
1081
|
+
if (Object.hasOwn(engines, "dsh")) return fits(engines["dsh"]);
|
|
1082
|
+
return Object.entries(record(manifest["peerDependencies"])).filter(([name]) => name === "@deepseek-ai/dsh" || name.startsWith("@deepseek-ai/dsh-")).every(([, range]) => typeof range === "string" && range.startsWith("workspace:") ? true : fits(range));
|
|
1458
1083
|
}
|
|
1459
|
-
function packumentUrl(registry,
|
|
1460
|
-
|
|
1084
|
+
function packumentUrl(registry, name) {
|
|
1085
|
+
return `${registry.endsWith("/") ? registry : `${registry}/`}${name.replace("/", "%2f")}`;
|
|
1461
1086
|
}
|
|
1087
|
+
/** The running DSH version: the boot graph's release, which shares the CLI's version number. */
|
|
1462
1088
|
function runtimeVersion(ctx) {
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
return typeof version === "string" && (0, import_valid.default)(version) !== null ? version : void 0;
|
|
1089
|
+
const version = record(record(record(ctx.get("modules"))["manifest"])["release"])["version"];
|
|
1090
|
+
return typeof version === "string" && (0, import_valid.default)(version) !== null ? version : void 0;
|
|
1466
1091
|
}
|
|
1467
1092
|
var UpdatesStore = class {
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1093
|
+
ctx;
|
|
1094
|
+
state = {
|
|
1095
|
+
status: "idle",
|
|
1096
|
+
candidates: [],
|
|
1097
|
+
lookups: {}
|
|
1098
|
+
};
|
|
1099
|
+
listeners = /* @__PURE__ */ new Set();
|
|
1100
|
+
generation = 0;
|
|
1101
|
+
disposed = false;
|
|
1102
|
+
registries;
|
|
1103
|
+
exemptions = {};
|
|
1104
|
+
pollTimer;
|
|
1105
|
+
constructor(ctx) {
|
|
1106
|
+
this.ctx = ctx;
|
|
1107
|
+
}
|
|
1108
|
+
getSnapshot = () => this.state;
|
|
1109
|
+
subscribe = (listener) => {
|
|
1110
|
+
this.listeners.add(listener);
|
|
1111
|
+
return () => {
|
|
1112
|
+
this.listeners.delete(listener);
|
|
1113
|
+
};
|
|
1114
|
+
};
|
|
1115
|
+
dispose() {
|
|
1116
|
+
this.disposed = true;
|
|
1117
|
+
if (this.pollTimer !== void 0) clearTimeout(this.pollTimer);
|
|
1118
|
+
this.listeners.clear();
|
|
1119
|
+
}
|
|
1120
|
+
/** Read the last self-update once per load: report a result this page has not shown, follow one still running. */
|
|
1121
|
+
watchSelf = async () => {
|
|
1122
|
+
let response;
|
|
1123
|
+
try {
|
|
1124
|
+
response = await selfRequest();
|
|
1125
|
+
} catch {
|
|
1126
|
+
if (!this.disposed && this.state.operation?.name === "@shellraining/dsh-plugin-updates" && isBusy(this.state.operation)) this.pollTimer = setTimeout(() => {
|
|
1127
|
+
this.watchSelf();
|
|
1128
|
+
}, POLL_MS);
|
|
1129
|
+
return;
|
|
1130
|
+
}
|
|
1131
|
+
if (this.disposed || !response.ok || response.status === null) return;
|
|
1132
|
+
const status = response.status;
|
|
1133
|
+
if (isRunning(status)) {
|
|
1134
|
+
this.patch({ operation: selfOperation(status, false) });
|
|
1135
|
+
this.pollTimer = setTimeout(() => {
|
|
1136
|
+
this.watchSelf();
|
|
1137
|
+
}, POLL_MS);
|
|
1138
|
+
return;
|
|
1139
|
+
}
|
|
1140
|
+
if (seen(status.id)) return;
|
|
1141
|
+
markSeen(status.id);
|
|
1142
|
+
this.patch({ operation: selfOperation(status, true) });
|
|
1143
|
+
};
|
|
1144
|
+
/** Ask the host half to update this plugin; the page loses this plugin while it runs. */
|
|
1145
|
+
updateSelf = async (version) => {
|
|
1146
|
+
if (this.disposed || isBusy(this.state.operation) || (0, import_valid.default)(version) === null) return false;
|
|
1147
|
+
const base = {
|
|
1148
|
+
name: SELF,
|
|
1149
|
+
from: this.state.candidates.find((item) => item.name === "@shellraining/dsh-plugin-updates")?.version ?? "",
|
|
1150
|
+
to: version,
|
|
1151
|
+
enabled: true,
|
|
1152
|
+
restoring: false
|
|
1153
|
+
};
|
|
1154
|
+
this.patch({ operation: {
|
|
1155
|
+
...base,
|
|
1156
|
+
phase: "checking"
|
|
1157
|
+
} });
|
|
1158
|
+
let response;
|
|
1159
|
+
try {
|
|
1160
|
+
response = await selfRequest({
|
|
1161
|
+
method: "POST",
|
|
1162
|
+
headers: { "content-type": "application/json" },
|
|
1163
|
+
body: JSON.stringify({ version })
|
|
1164
|
+
});
|
|
1165
|
+
} catch (error) {
|
|
1166
|
+
response = {
|
|
1167
|
+
ok: false,
|
|
1168
|
+
code: "internal",
|
|
1169
|
+
message: errorText(error)
|
|
1170
|
+
};
|
|
1171
|
+
}
|
|
1172
|
+
if (this.disposed) return false;
|
|
1173
|
+
if (!response.ok) {
|
|
1174
|
+
const phase = response.code === "current" ? "current" : "check-failed";
|
|
1175
|
+
this.patch({ operation: {
|
|
1176
|
+
...base,
|
|
1177
|
+
phase,
|
|
1178
|
+
reason: response.message ?? `self-${response.code}`,
|
|
1179
|
+
toast: Date.now()
|
|
1180
|
+
} });
|
|
1181
|
+
return false;
|
|
1182
|
+
}
|
|
1183
|
+
if (response.status !== null) this.patch({ operation: selfOperation(response.status, false) });
|
|
1184
|
+
this.pollTimer = setTimeout(() => {
|
|
1185
|
+
this.watchSelf();
|
|
1186
|
+
}, POLL_MS);
|
|
1187
|
+
return true;
|
|
1188
|
+
};
|
|
1189
|
+
patch(next) {
|
|
1190
|
+
if (this.disposed) return;
|
|
1191
|
+
this.state = {
|
|
1192
|
+
...this.state,
|
|
1193
|
+
...next
|
|
1194
|
+
};
|
|
1195
|
+
for (const listener of [...this.listeners]) listener();
|
|
1196
|
+
}
|
|
1197
|
+
setLookup(name, lookup) {
|
|
1198
|
+
this.patch({ lookups: {
|
|
1199
|
+
...this.state.lookups,
|
|
1200
|
+
[name]: lookup
|
|
1201
|
+
} });
|
|
1202
|
+
}
|
|
1203
|
+
/** A page opened: read the list the first time, after a failure, and once a lookup is older than the cache. */
|
|
1204
|
+
ensure = () => {
|
|
1205
|
+
const now = Date.now();
|
|
1206
|
+
const stale = Object.values(this.state.lookups).some((lookup) => lookup.status === "ready" && now - lookup.at > CACHE_MS);
|
|
1207
|
+
if (this.state.status === "idle" || this.state.status === "error" || this.state.status === "ready" && stale) this.load();
|
|
1208
|
+
};
|
|
1209
|
+
/** Re-read the list after a Host change; lookups stay cached. */
|
|
1210
|
+
bundlesChanged = () => {
|
|
1211
|
+
if (this.state.status !== "idle") this.load();
|
|
1212
|
+
};
|
|
1213
|
+
async load() {
|
|
1214
|
+
try {
|
|
1215
|
+
await this.loadBundles();
|
|
1216
|
+
} catch {
|
|
1217
|
+
if (!this.disposed) this.patch({ status: "error" });
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
async loadBundles() {
|
|
1221
|
+
const generation = ++this.generation;
|
|
1222
|
+
this.patch({ status: this.state.status === "ready" ? "ready" : "loading" });
|
|
1223
|
+
const pm = this.ctx.remote.pluginManager;
|
|
1224
|
+
if (this.registries === void 0) {
|
|
1225
|
+
const [registries, exemptions] = await Promise.all([pm.registries(), pm.listVersionExemptions()]);
|
|
1226
|
+
if (registries.ok) {
|
|
1227
|
+
const first = registries.value.registry ?? registries.value.resolved ?? DEFAULT_REGISTRY;
|
|
1228
|
+
this.registries = [.../* @__PURE__ */ new Set([first, ...registries.value.fallbackRegistries])];
|
|
1229
|
+
}
|
|
1230
|
+
if (exemptions.ok) this.exemptions = exemptions.value.exemptions;
|
|
1231
|
+
}
|
|
1232
|
+
const listed = await pm.listBundles();
|
|
1233
|
+
if (generation !== this.generation) return;
|
|
1234
|
+
if (!listed.ok) {
|
|
1235
|
+
this.patch({ status: "error" });
|
|
1236
|
+
return;
|
|
1237
|
+
}
|
|
1238
|
+
const resolve = (text) => text === void 0 ? void 0 : this.ctx.locale.resolveText(text);
|
|
1239
|
+
const candidates = listed.value.filter(npmInstalled).map((bundle) => {
|
|
1240
|
+
const icon = bundle.meta?.icon;
|
|
1241
|
+
return {
|
|
1242
|
+
name: bundle.name,
|
|
1243
|
+
title: resolve(bundle.meta?.title) ?? bundle.name,
|
|
1244
|
+
version: bundle.version ?? "",
|
|
1245
|
+
enabled: bundle.enabled,
|
|
1246
|
+
...icon === void 0 ? {} : { icon }
|
|
1247
|
+
};
|
|
1248
|
+
}).sort((a, b) => a.title.localeCompare(b.title));
|
|
1249
|
+
this.patch({
|
|
1250
|
+
status: "ready",
|
|
1251
|
+
candidates
|
|
1252
|
+
});
|
|
1253
|
+
const now = Date.now();
|
|
1254
|
+
for (const candidate of candidates) {
|
|
1255
|
+
const lookup = this.state.lookups[candidate.name];
|
|
1256
|
+
if (lookup === void 0 || lookup.status === "error" || lookup.status === "ready" && now - lookup.at > CACHE_MS) this.lookup(candidate.name);
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
async lookup(name) {
|
|
1260
|
+
this.setLookup(name, { status: "loading" });
|
|
1261
|
+
const runtime = runtimeVersion(this.ctx);
|
|
1262
|
+
let reason = "";
|
|
1263
|
+
for (const registry of this.registries ?? [DEFAULT_REGISTRY]) try {
|
|
1264
|
+
const response = await fetch(packumentUrl(registry, name), {
|
|
1265
|
+
headers: { accept: "application/json" },
|
|
1266
|
+
credentials: "omit"
|
|
1267
|
+
});
|
|
1268
|
+
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
1269
|
+
const body = record(await response.json());
|
|
1270
|
+
const times = record(body["time"]);
|
|
1271
|
+
const now = Date.now();
|
|
1272
|
+
const versions = Object.entries(record(body["versions"])).filter(([version]) => (0, import_valid.default)(version) !== null).map(([version, manifest]) => {
|
|
1273
|
+
const fields = record(manifest);
|
|
1274
|
+
const stamp = typeof times[version] === "string" ? Date.parse(times[version]) : NaN;
|
|
1275
|
+
const exempted = runtime !== void 0 && this.exemptions[`${name}@${version}`]?.includes(runtime) === true;
|
|
1276
|
+
return {
|
|
1277
|
+
version,
|
|
1278
|
+
...Number.isNaN(stamp) ? {} : { published: stamp },
|
|
1279
|
+
deprecated: typeof fields["deprecated"] === "string",
|
|
1280
|
+
prerelease: (0, import_prerelease.default)(version) !== null,
|
|
1281
|
+
compatible: exempted || compatibleWith(fields, runtime),
|
|
1282
|
+
fresh: !Number.isNaN(stamp) && now - stamp < FRESH_MS
|
|
1283
|
+
};
|
|
1284
|
+
}).sort((a, b) => (0, import_rcompare.default)(a.version, b.version));
|
|
1285
|
+
const latest = record(body["dist-tags"])["latest"];
|
|
1286
|
+
this.setLookup(name, {
|
|
1287
|
+
status: "ready",
|
|
1288
|
+
registry,
|
|
1289
|
+
versions,
|
|
1290
|
+
at: now,
|
|
1291
|
+
...typeof latest === "string" ? { latest } : {}
|
|
1292
|
+
});
|
|
1293
|
+
return;
|
|
1294
|
+
} catch (error) {
|
|
1295
|
+
reason = `${new URL(registry).host}: ${errorText(error)}`;
|
|
1296
|
+
}
|
|
1297
|
+
this.setLookup(name, {
|
|
1298
|
+
status: "error",
|
|
1299
|
+
reason
|
|
1300
|
+
});
|
|
1301
|
+
}
|
|
1302
|
+
/** Switch one plugin to `version`: uninstall it, then install that exact version with its enabled state. */
|
|
1303
|
+
install = async (name, version) => {
|
|
1304
|
+
const candidate = this.state.candidates.find((item) => item.name === name);
|
|
1305
|
+
if (this.disposed || candidate === void 0 || name === "@shellraining/dsh-plugin-updates" || isBusy(this.state.operation) || (0, import_valid.default)(version) === null) return false;
|
|
1306
|
+
return this.run({
|
|
1307
|
+
name,
|
|
1308
|
+
from: candidate.version,
|
|
1309
|
+
to: version,
|
|
1310
|
+
enabled: candidate.enabled,
|
|
1311
|
+
restoring: false
|
|
1312
|
+
}, true);
|
|
1313
|
+
};
|
|
1314
|
+
/** Put back the version a failed switch removed; the plugin is no longer installed, so only install. */
|
|
1315
|
+
restore = async () => {
|
|
1316
|
+
const failed = this.state.operation;
|
|
1317
|
+
if (this.disposed || failed?.phase !== "failed" || !failed.recoverable) return;
|
|
1318
|
+
await this.run({
|
|
1319
|
+
name: failed.name,
|
|
1320
|
+
from: failed.from,
|
|
1321
|
+
to: failed.from,
|
|
1322
|
+
enabled: failed.enabled,
|
|
1323
|
+
restoring: true
|
|
1324
|
+
}, false);
|
|
1325
|
+
};
|
|
1326
|
+
/** The outcome toast finished; the banner in the tab keeps the result. */
|
|
1327
|
+
toastDone = () => {
|
|
1328
|
+
const operation = this.state.operation;
|
|
1329
|
+
if (operation?.toast !== void 0) {
|
|
1330
|
+
const { toast: _toast, ...rest } = operation;
|
|
1331
|
+
this.patch({ operation: rest });
|
|
1332
|
+
}
|
|
1333
|
+
};
|
|
1334
|
+
dismiss = () => {
|
|
1335
|
+
if (!isBusy(this.state.operation)) this.patch({ operation: void 0 });
|
|
1336
|
+
};
|
|
1337
|
+
/** Update every plugin with a newer version, one at a time; stops at the first failure. */
|
|
1338
|
+
updateAll = async () => {
|
|
1339
|
+
for (const candidate of this.state.candidates) {
|
|
1340
|
+
const target = updateTarget(candidate, this.state.lookups[candidate.name]);
|
|
1341
|
+
if (target === void 0 || candidate.name === "@shellraining/dsh-plugin-updates") continue;
|
|
1342
|
+
if (!await this.install(candidate.name, target)) return;
|
|
1343
|
+
}
|
|
1344
|
+
};
|
|
1345
|
+
async run(base, remove) {
|
|
1346
|
+
const pm = this.ctx.remote.pluginManager;
|
|
1347
|
+
let failurePhase = "check-failed";
|
|
1348
|
+
let recoverable = false;
|
|
1349
|
+
const fail = (result) => {
|
|
1350
|
+
const value = result.ok ? result.value : void 0;
|
|
1351
|
+
const output = value?.packageResult?.output.trim() || value?.error?.diagnostic;
|
|
1352
|
+
const logPath = value?.packageResult?.logPath;
|
|
1353
|
+
this.patch({ operation: {
|
|
1354
|
+
...base,
|
|
1355
|
+
phase: failurePhase,
|
|
1356
|
+
recoverable,
|
|
1357
|
+
reason: failureReason(result),
|
|
1358
|
+
toast: Date.now(),
|
|
1359
|
+
...output ? { output } : {},
|
|
1360
|
+
...logPath ? { logPath } : {}
|
|
1361
|
+
} });
|
|
1362
|
+
return false;
|
|
1363
|
+
};
|
|
1364
|
+
this.patch({ operation: {
|
|
1365
|
+
...base,
|
|
1366
|
+
phase: "checking"
|
|
1367
|
+
} });
|
|
1368
|
+
try {
|
|
1369
|
+
const listed = await pm.listBundles();
|
|
1370
|
+
if (this.disposed) return false;
|
|
1371
|
+
if (!listed.ok) return fail(listed);
|
|
1372
|
+
const current = listed.value.find((bundle) => bundle.name === base.name && bundle.installed);
|
|
1373
|
+
if (current !== void 0 && (0, import_valid.default)(current.version ?? "") === (0, import_valid.default)(base.to)) {
|
|
1374
|
+
this.patch({ operation: {
|
|
1375
|
+
...base,
|
|
1376
|
+
phase: "current",
|
|
1377
|
+
toast: Date.now()
|
|
1378
|
+
} });
|
|
1379
|
+
return true;
|
|
1380
|
+
}
|
|
1381
|
+
if (remove) {
|
|
1382
|
+
if (current === void 0 || !npmInstalled(current)) return fail({
|
|
1383
|
+
ok: true,
|
|
1384
|
+
value: {
|
|
1385
|
+
application: "failed",
|
|
1386
|
+
error: { code: "plugin-state-changed" }
|
|
1387
|
+
}
|
|
1388
|
+
});
|
|
1389
|
+
const declared = (0, import_valid.default)(current.source?.slice(`${base.name}@`.length) ?? "");
|
|
1390
|
+
if (declared !== null && declared !== (0, import_valid.default)(current.version ?? "")) return fail({
|
|
1391
|
+
ok: true,
|
|
1392
|
+
value: {
|
|
1393
|
+
application: "failed",
|
|
1394
|
+
error: { code: "installation-inconsistent" }
|
|
1395
|
+
}
|
|
1396
|
+
});
|
|
1397
|
+
base = {
|
|
1398
|
+
...base,
|
|
1399
|
+
from: current.version ?? base.from,
|
|
1400
|
+
enabled: current.enabled
|
|
1401
|
+
};
|
|
1402
|
+
failurePhase = "remove-failed";
|
|
1403
|
+
this.patch({ operation: {
|
|
1404
|
+
...base,
|
|
1405
|
+
phase: "removing"
|
|
1406
|
+
} });
|
|
1407
|
+
const removed = await pm.removeBundle(base.name);
|
|
1408
|
+
const stopProfile = removed.ok && removed.value.error?.code === "stop-profile";
|
|
1409
|
+
if (!stopProfile && (!removed.ok || removed.value.application === "failed" || removed.value.application === "cancelled")) return fail(removed);
|
|
1410
|
+
recoverable = !stopProfile;
|
|
1411
|
+
} else {
|
|
1412
|
+
if (current !== void 0) return fail({
|
|
1413
|
+
ok: true,
|
|
1414
|
+
value: {
|
|
1415
|
+
application: "failed",
|
|
1416
|
+
error: { code: "plugin-state-changed" }
|
|
1417
|
+
}
|
|
1418
|
+
});
|
|
1419
|
+
recoverable = true;
|
|
1420
|
+
}
|
|
1421
|
+
if (this.disposed) return false;
|
|
1422
|
+
failurePhase = "failed";
|
|
1423
|
+
this.patch({ operation: {
|
|
1424
|
+
...base,
|
|
1425
|
+
phase: "installing"
|
|
1426
|
+
} });
|
|
1427
|
+
const installed = await pm.installBundle(`${base.name}@${base.to}`, {
|
|
1428
|
+
enabled: base.enabled,
|
|
1429
|
+
saveExact: true,
|
|
1430
|
+
requestId: `${SELF}:${Date.now()}`
|
|
1431
|
+
});
|
|
1432
|
+
if (!installed.ok || installed.value.application === "failed" || installed.value.application === "cancelled") return fail(installed);
|
|
1433
|
+
const to = installed.value.version ?? base.to;
|
|
1434
|
+
this.patch({ operation: {
|
|
1435
|
+
...base,
|
|
1436
|
+
to,
|
|
1437
|
+
toast: Date.now(),
|
|
1438
|
+
phase: installed.value.application === "restart-required" ? "restart" : "done"
|
|
1439
|
+
} });
|
|
1440
|
+
return true;
|
|
1441
|
+
} catch (error) {
|
|
1442
|
+
return fail({
|
|
1443
|
+
ok: false,
|
|
1444
|
+
error: { message: errorText(error) }
|
|
1445
|
+
});
|
|
1446
|
+
} finally {
|
|
1447
|
+
if (!this.disposed) await this.load();
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1740
1450
|
};
|
|
1741
|
-
|
|
1742
1451
|
// src/client/styles.ts
|
|
1743
1452
|
var STYLE_ID = "@shellraining/dsh-plugin-updates";
|
|
1744
1453
|
var CSS = `
|
|
@@ -1761,379 +1470,511 @@ var CSS = `
|
|
|
1761
1470
|
.dpu-error { color: var(--dsw-alias-state-error-primary); font-size: 13px; line-height: 20px; overflow-wrap: anywhere; }
|
|
1762
1471
|
@media (forced-colors: active) { .dpu-banner { border-color: CanvasText; } }
|
|
1763
1472
|
`;
|
|
1764
|
-
function installStyle(
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1473
|
+
function installStyle(document) {
|
|
1474
|
+
const node = document.createElement("style");
|
|
1475
|
+
node.dataset.plugin = STYLE_ID;
|
|
1476
|
+
node.textContent = CSS;
|
|
1477
|
+
document.head.append(node);
|
|
1478
|
+
return () => node.remove();
|
|
1770
1479
|
}
|
|
1771
|
-
|
|
1772
|
-
// src/client/view.tsx
|
|
1773
|
-
var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
1774
|
-
var import_dsh_client_ui_primitives2 = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
1775
|
-
var import_react = require("react");
|
|
1776
|
-
var import_react_dom = require("react-dom");
|
|
1777
|
-
|
|
1778
1480
|
// src/client/anchors.ts
|
|
1779
|
-
var GROUP =
|
|
1481
|
+
var GROUP = "section[data-plugin-group=\"bundles\"]";
|
|
1780
1482
|
var MOUNT = "data-plugin-updates-mount";
|
|
1781
1483
|
var NO_ANCHORS = { cards: /* @__PURE__ */ new Map() };
|
|
1782
1484
|
function mountIn(parent, key, first) {
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
else parent.append(node);
|
|
1791
|
-
return node;
|
|
1485
|
+
for (const child of parent.children) if (child instanceof HTMLElement && child.getAttribute(MOUNT) === key) return child;
|
|
1486
|
+
const node = parent.ownerDocument.createElement("span");
|
|
1487
|
+
node.setAttribute(MOUNT, key);
|
|
1488
|
+
node.style.display = "contents";
|
|
1489
|
+
if (first) parent.prepend(node);
|
|
1490
|
+
else parent.append(node);
|
|
1491
|
+
return node;
|
|
1792
1492
|
}
|
|
1793
|
-
function scan(
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1493
|
+
function scan(document) {
|
|
1494
|
+
const group = document.querySelector(GROUP);
|
|
1495
|
+
if (group === null) return NO_ANCHORS;
|
|
1496
|
+
const row = group.firstElementChild;
|
|
1497
|
+
const head = row?.querySelector(":scope > h3") ? mountIn(row, "head", false) : void 0;
|
|
1498
|
+
const cards = /* @__PURE__ */ new Map();
|
|
1499
|
+
for (const card of group.querySelectorAll("li[data-plugin-package]")) {
|
|
1500
|
+
const name = card.getAttribute("data-plugin-package");
|
|
1501
|
+
const end = card.querySelector("[role=\"switch\"]")?.parentElement;
|
|
1502
|
+
if (name && end) cards.set(name, mountIn(end, "card", true));
|
|
1503
|
+
}
|
|
1504
|
+
const status = mountIn(group, "status", false);
|
|
1505
|
+
return {
|
|
1506
|
+
...head === void 0 ? {} : { head },
|
|
1507
|
+
status,
|
|
1508
|
+
cards
|
|
1509
|
+
};
|
|
1806
1510
|
}
|
|
1807
1511
|
function same(a, b) {
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1512
|
+
if (a.head !== b.head || a.status !== b.status || a.cards.size !== b.cards.size) return false;
|
|
1513
|
+
for (const [name, node] of a.cards) if (b.cards.get(name) !== node) return false;
|
|
1514
|
+
return true;
|
|
1811
1515
|
}
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1516
|
+
/** Report the anchors now and whenever the page re-renders them; the disposer removes every mount node. */
|
|
1517
|
+
function watchAnchors(document, onChange) {
|
|
1518
|
+
const view = document.defaultView;
|
|
1519
|
+
if (view === null) return () => {};
|
|
1520
|
+
let current = NO_ANCHORS;
|
|
1521
|
+
let frame = 0;
|
|
1522
|
+
const run = () => {
|
|
1523
|
+
frame = 0;
|
|
1524
|
+
const next = scan(document);
|
|
1525
|
+
if (same(current, next)) return;
|
|
1526
|
+
current = next;
|
|
1527
|
+
onChange(next);
|
|
1528
|
+
};
|
|
1529
|
+
const observer = new view.MutationObserver(() => {
|
|
1530
|
+
if (frame === 0) frame = view.requestAnimationFrame(run);
|
|
1531
|
+
});
|
|
1532
|
+
observer.observe(document.body, {
|
|
1533
|
+
childList: true,
|
|
1534
|
+
subtree: true
|
|
1535
|
+
});
|
|
1536
|
+
run();
|
|
1537
|
+
return () => {
|
|
1538
|
+
observer.disconnect();
|
|
1539
|
+
if (frame !== 0) view.cancelAnimationFrame(frame);
|
|
1540
|
+
for (const node of document.querySelectorAll(`[${MOUNT}]`)) node.remove();
|
|
1541
|
+
};
|
|
1835
1542
|
}
|
|
1836
|
-
|
|
1837
1543
|
// src/client/view.tsx
|
|
1838
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
1839
1544
|
var VISIBLE_VERSIONS = 12;
|
|
1545
|
+
/** The CLI command that updates this plugin, for the profile the page runs in. */
|
|
1840
1546
|
function selfCommand(version) {
|
|
1841
|
-
|
|
1842
|
-
return `dsh plugin --profile ${profile} add ${SELF}@${version} --save-exact`;
|
|
1547
|
+
return `dsh plugin --profile ${document.documentElement.dataset["platform"] === void 0 ? "web" : "desktop"} add ${SELF}@${version} --save-exact`;
|
|
1843
1548
|
}
|
|
1844
1549
|
function dateText(stamp) {
|
|
1845
|
-
|
|
1550
|
+
return stamp === void 0 ? "" : new Date(stamp).toLocaleDateString();
|
|
1846
1551
|
}
|
|
1847
1552
|
function SelfNotice({ t, version, busy, onUpdate }) {
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1553
|
+
const [open, setOpen] = (0, react.useState)(false);
|
|
1554
|
+
const [copied, setCopied] = (0, react.useState)(false);
|
|
1555
|
+
const command = selfCommand(version);
|
|
1556
|
+
const close = () => {
|
|
1557
|
+
setOpen(false);
|
|
1558
|
+
};
|
|
1559
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1560
|
+
className: "dpu-banner",
|
|
1561
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1562
|
+
className: "dpu-banner-row",
|
|
1563
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("self.body", { version }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
1564
|
+
size: "sm",
|
|
1565
|
+
variant: "primary",
|
|
1566
|
+
disabled: busy,
|
|
1567
|
+
onClick: () => {
|
|
1568
|
+
setOpen(true);
|
|
1569
|
+
},
|
|
1570
|
+
children: t("updateTo", { version })
|
|
1571
|
+
})]
|
|
1572
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
|
|
1573
|
+
open,
|
|
1574
|
+
onClose: close,
|
|
1575
|
+
title: t("self.confirmTitle", { version }),
|
|
1576
|
+
description: t("self.confirmBody"),
|
|
1577
|
+
closeLabel: t("op.dismiss"),
|
|
1578
|
+
footer: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
1579
|
+
size: "sm",
|
|
1580
|
+
variant: "ghost",
|
|
1581
|
+
onClick: close,
|
|
1582
|
+
children: t("self.cancel")
|
|
1583
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
1584
|
+
size: "sm",
|
|
1585
|
+
variant: "primary",
|
|
1586
|
+
"data-modal-autofocus": "",
|
|
1587
|
+
onClick: () => {
|
|
1588
|
+
close();
|
|
1589
|
+
onUpdate();
|
|
1590
|
+
},
|
|
1591
|
+
children: t("updateTo", { version })
|
|
1592
|
+
})] }),
|
|
1593
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1594
|
+
className: "dpu-banner-row",
|
|
1595
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
|
|
1596
|
+
className: "dpu-pre dpu-command",
|
|
1597
|
+
children: command
|
|
1598
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
1599
|
+
size: "sm",
|
|
1600
|
+
variant: "outline",
|
|
1601
|
+
onClick: () => {
|
|
1602
|
+
(0, _deepseek_ai_dsh_client_ui_primitives.writeClipboard)(command).then(setCopied);
|
|
1603
|
+
},
|
|
1604
|
+
children: copied ? t("self.copied") : t("self.copy")
|
|
1605
|
+
})]
|
|
1606
|
+
})
|
|
1607
|
+
})]
|
|
1608
|
+
});
|
|
1885
1609
|
}
|
|
1886
1610
|
function operationText(t, operation) {
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
case "failed":
|
|
1908
|
-
return t(operation.name === SELF ? "op.selfFailed" : "op.failed", params);
|
|
1909
|
-
case "remove-failed":
|
|
1910
|
-
return t("op.removeFailed", params);
|
|
1911
|
-
}
|
|
1611
|
+
const raw = operation.reason ?? "";
|
|
1612
|
+
const reason = raw.includes("ERR_PNPM_RESOLUTION_POLICY_VIOLATIONS_UNHANDLED") ? t("error.policy") : raw === "installation-inconsistent" ? t("error.inconsistent") : raw === "plugin-state-changed" ? t("error.stateChanged") : raw === "interrupted" ? t("error.interrupted") : raw === "self-busy" ? t("error.selfBusy") : raw === "self-not-npm" ? t("error.stateChanged") : raw;
|
|
1613
|
+
const params = {
|
|
1614
|
+
name: operation.name,
|
|
1615
|
+
from: operation.from,
|
|
1616
|
+
to: operation.to,
|
|
1617
|
+
reason
|
|
1618
|
+
};
|
|
1619
|
+
switch (operation.phase) {
|
|
1620
|
+
case "checking": return t("op.checking", params);
|
|
1621
|
+
case "check-failed": return t("op.checkFailed", params);
|
|
1622
|
+
case "current": return t("op.current", params);
|
|
1623
|
+
case "removing": return t("op.removing", params);
|
|
1624
|
+
case "installing": return t(operation.restoring ? "op.restoring" : "op.installing", params);
|
|
1625
|
+
case "done": return t("op.done", params);
|
|
1626
|
+
case "restart": return t("op.restart", params);
|
|
1627
|
+
case "restored": return t("op.restored", params);
|
|
1628
|
+
case "failed": return t(operation.name === "@shellraining/dsh-plugin-updates" ? "op.selfFailed" : "op.failed", params);
|
|
1629
|
+
case "remove-failed": return t("op.removeFailed", params);
|
|
1630
|
+
}
|
|
1912
1631
|
}
|
|
1913
1632
|
function isFailure(operation) {
|
|
1914
|
-
|
|
1633
|
+
return operation.phase === "failed" || operation.phase === "remove-failed" || operation.phase === "check-failed" || operation.phase === "restored";
|
|
1915
1634
|
}
|
|
1635
|
+
/**
|
|
1636
|
+
* The outcome as a toast in the app overlay: a switch uninstalls the plugin
|
|
1637
|
+
* first, which takes the plugin page back to its list, so the detail page that
|
|
1638
|
+
* started it may be gone by the time it finishes.
|
|
1639
|
+
*/
|
|
1916
1640
|
function OperationToast({ t, useUpdates, actions }) {
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
);
|
|
1641
|
+
const operation = useUpdates((state) => state.operation);
|
|
1642
|
+
if (operation?.toast === void 0) return null;
|
|
1643
|
+
const failed = isFailure(operation);
|
|
1644
|
+
const restorable = operation.phase === "failed" && operation.recoverable;
|
|
1645
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Toast, {
|
|
1646
|
+
text: operationText(t, operation),
|
|
1647
|
+
...failed ? { icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconWarningOutlineRegular, {}) } : { tone: "success" },
|
|
1648
|
+
holdMs: failed ? 8e3 : 4e3,
|
|
1649
|
+
...restorable ? { actions: [{
|
|
1650
|
+
label: t("op.restore", { from: operation.from }),
|
|
1651
|
+
onClick: () => {
|
|
1652
|
+
actions.restore();
|
|
1653
|
+
}
|
|
1654
|
+
}] } : {},
|
|
1655
|
+
onDone: actions.toastDone
|
|
1656
|
+
}, operation.toast);
|
|
1934
1657
|
}
|
|
1658
|
+
/** Progress and outcome of the running or last package operation. */
|
|
1935
1659
|
function OperationBanner({ t, operation, actions }) {
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1660
|
+
const params = { from: operation.from };
|
|
1661
|
+
const busy = isBusy(operation);
|
|
1662
|
+
const failed = isFailure(operation);
|
|
1663
|
+
const text = operationText(t, operation);
|
|
1664
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1665
|
+
className: "dpu-banner",
|
|
1666
|
+
role: failed ? "alert" : "status",
|
|
1667
|
+
...failed ? { "data-tone": "error" } : {},
|
|
1668
|
+
children: [
|
|
1669
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1670
|
+
className: "dpu-banner-row",
|
|
1671
|
+
children: [
|
|
1672
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: text }),
|
|
1673
|
+
operation.phase === "failed" && operation.recoverable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
1674
|
+
size: "sm",
|
|
1675
|
+
variant: "outline",
|
|
1676
|
+
onClick: () => {
|
|
1677
|
+
actions.restore();
|
|
1678
|
+
},
|
|
1679
|
+
children: t("op.restore", params)
|
|
1680
|
+
}) : null,
|
|
1681
|
+
busy ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
1682
|
+
size: "sm",
|
|
1683
|
+
variant: "ghost",
|
|
1684
|
+
onClick: actions.dismiss,
|
|
1685
|
+
children: t("op.dismiss")
|
|
1686
|
+
})
|
|
1687
|
+
]
|
|
1688
|
+
}),
|
|
1689
|
+
failed && operation.output !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
|
|
1690
|
+
className: "dpu-pre",
|
|
1691
|
+
children: operation.output
|
|
1692
|
+
}) : null,
|
|
1693
|
+
failed && operation.logPath !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1694
|
+
className: "dpu-caption",
|
|
1695
|
+
children: t("op.log", { path: operation.logPath })
|
|
1696
|
+
}) : null
|
|
1697
|
+
]
|
|
1698
|
+
});
|
|
1951
1699
|
}
|
|
1700
|
+
/** The npm candidate a detail page shows, or undefined for rows, official items and other sources. */
|
|
1952
1701
|
function useSubject({ subject, useUpdates, actions }) {
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1702
|
+
const name = subject.kind === "bundle" ? subject.pkg.name : void 0;
|
|
1703
|
+
const candidate = useUpdates((state) => state.candidates.find((item) => item.name === name));
|
|
1704
|
+
const lookup = useUpdates((state) => name === void 0 ? void 0 : state.lookups[name]);
|
|
1705
|
+
const operation = useUpdates((state) => state.operation);
|
|
1706
|
+
(0, react.useEffect)(() => {
|
|
1707
|
+
if (name !== void 0) actions.ensure();
|
|
1708
|
+
}, [actions, name]);
|
|
1709
|
+
return candidate === void 0 ? void 0 : {
|
|
1710
|
+
candidate,
|
|
1711
|
+
lookup,
|
|
1712
|
+
operation
|
|
1713
|
+
};
|
|
1961
1714
|
}
|
|
1962
1715
|
function DetailBadge(props) {
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1716
|
+
const found = useSubject(props);
|
|
1717
|
+
const target = found === void 0 ? void 0 : updateTarget(found.candidate, found.lookup);
|
|
1718
|
+
return target === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tag, {
|
|
1719
|
+
tone: "info",
|
|
1720
|
+
children: props.t("status.update", { version: target })
|
|
1721
|
+
});
|
|
1966
1722
|
}
|
|
1967
1723
|
function DetailAction(props) {
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1724
|
+
const found = useSubject(props);
|
|
1725
|
+
const target = found === void 0 ? void 0 : updateTarget(found.candidate, found.lookup);
|
|
1726
|
+
if (found === void 0 || target === void 0 || found.candidate.name === "@shellraining/dsh-plugin-updates") return null;
|
|
1727
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
1728
|
+
size: "sm",
|
|
1729
|
+
variant: "primary",
|
|
1730
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconDownloadOutlineRegular, { size: 13 }),
|
|
1731
|
+
disabled: isBusy(found.operation),
|
|
1732
|
+
onClick: () => {
|
|
1733
|
+
props.actions.install(found.candidate.name, target);
|
|
1734
|
+
},
|
|
1735
|
+
children: props.t("updateTo", { version: target })
|
|
1736
|
+
});
|
|
1974
1737
|
}
|
|
1975
1738
|
function VersionRow({ t, info, current, disabled, onInstall }) {
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1739
|
+
const hint = !info.compatible ? t("hint.incompatible") : info.fresh ? t("hint.fresh") : void 0;
|
|
1740
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
|
|
1741
|
+
className: "dpu-row",
|
|
1742
|
+
...hint === void 0 ? {} : { title: hint },
|
|
1743
|
+
children: [
|
|
1744
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1745
|
+
className: "dpu-row-version dpu-mono",
|
|
1746
|
+
children: info.version
|
|
1747
|
+
}),
|
|
1748
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1749
|
+
className: "dpu-row-tags",
|
|
1750
|
+
children: [
|
|
1751
|
+
current ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tag, {
|
|
1752
|
+
tone: "success",
|
|
1753
|
+
children: t("tag.current")
|
|
1754
|
+
}) : null,
|
|
1755
|
+
info.prerelease ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tag, {
|
|
1756
|
+
tone: "neutral",
|
|
1757
|
+
children: t("tag.prerelease")
|
|
1758
|
+
}) : null,
|
|
1759
|
+
info.deprecated ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tag, {
|
|
1760
|
+
tone: "warning",
|
|
1761
|
+
children: t("tag.deprecated")
|
|
1762
|
+
}) : null,
|
|
1763
|
+
!info.compatible ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tag, {
|
|
1764
|
+
tone: "danger",
|
|
1765
|
+
children: t("tag.incompatible")
|
|
1766
|
+
}) : null,
|
|
1767
|
+
info.fresh ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tag, {
|
|
1768
|
+
tone: "warning",
|
|
1769
|
+
children: t("tag.fresh")
|
|
1770
|
+
}) : null
|
|
1771
|
+
]
|
|
1772
|
+
}),
|
|
1773
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1774
|
+
className: "dpu-caption",
|
|
1775
|
+
children: dateText(info.published)
|
|
1776
|
+
}),
|
|
1777
|
+
current || onInstall === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
1778
|
+
size: "sm",
|
|
1779
|
+
variant: "ghost",
|
|
1780
|
+
disabled: disabled || !info.compatible,
|
|
1781
|
+
onClick: onInstall,
|
|
1782
|
+
children: t("install")
|
|
1783
|
+
})
|
|
1784
|
+
]
|
|
1785
|
+
});
|
|
1989
1786
|
}
|
|
1990
1787
|
function DetailSection(props) {
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
1788
|
+
const found = useSubject(props);
|
|
1789
|
+
const [all, setAll] = (0, react.useState)(false);
|
|
1790
|
+
if (found === void 0) return null;
|
|
1791
|
+
const { t, actions } = props;
|
|
1792
|
+
const { candidate, lookup, operation } = found;
|
|
1793
|
+
const self = candidate.name === SELF;
|
|
1794
|
+
const target = updateTarget(candidate, lookup);
|
|
1795
|
+
let body;
|
|
1796
|
+
if (lookup === void 0 || lookup.status === "loading") body = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1797
|
+
className: "dpu-caption",
|
|
1798
|
+
children: t("versions.loading")
|
|
1799
|
+
});
|
|
1800
|
+
else if (lookup.status === "error") body = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1801
|
+
className: "dpu-error",
|
|
1802
|
+
children: t("versions.failed", { reason: lookup.reason })
|
|
1803
|
+
});
|
|
1804
|
+
else if (lookup.versions.length === 0) body = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1805
|
+
className: "dpu-caption",
|
|
1806
|
+
children: t("versions.empty")
|
|
1807
|
+
});
|
|
1808
|
+
else {
|
|
1809
|
+
const shown = all ? lookup.versions : lookup.versions.slice(0, VISIBLE_VERSIONS);
|
|
1810
|
+
body = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
1811
|
+
className: "dpu-rows",
|
|
1812
|
+
children: shown.map((info) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VersionRow, {
|
|
1813
|
+
t,
|
|
1814
|
+
info,
|
|
1815
|
+
current: info.version === candidate.version,
|
|
1816
|
+
disabled: isBusy(operation),
|
|
1817
|
+
onInstall: self ? void 0 : () => {
|
|
1818
|
+
actions.install(candidate.name, info.version);
|
|
1819
|
+
}
|
|
1820
|
+
}, info.version))
|
|
1821
|
+
}), shown.length < lookup.versions.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
1822
|
+
size: "sm",
|
|
1823
|
+
variant: "ghost",
|
|
1824
|
+
onClick: () => setAll(true),
|
|
1825
|
+
children: t("versions.showAll", { count: lookup.versions.length })
|
|
1826
|
+
}) }) : null] });
|
|
1827
|
+
}
|
|
1828
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
1829
|
+
className: "dpu-section",
|
|
1830
|
+
"data-plugin-updates-versions": candidate.name,
|
|
1831
|
+
children: [
|
|
1832
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1833
|
+
className: "dpu-head",
|
|
1834
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
1835
|
+
className: "dpu-title",
|
|
1836
|
+
children: t("versions.title")
|
|
1837
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1838
|
+
className: "dpu-summary",
|
|
1839
|
+
children: [t("version.current", { version: candidate.version }), lookup?.status === "ready" ? ` · ${t("versions.registry", { registry: new URL(lookup.registry).host })}` : ""]
|
|
1840
|
+
})]
|
|
1841
|
+
}),
|
|
1842
|
+
operation?.name === candidate.name ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OperationBanner, {
|
|
1843
|
+
t,
|
|
1844
|
+
operation,
|
|
1845
|
+
actions
|
|
1846
|
+
}) : null,
|
|
1847
|
+
self && target !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelfNotice, {
|
|
1848
|
+
t,
|
|
1849
|
+
version: target,
|
|
1850
|
+
busy: isBusy(operation),
|
|
1851
|
+
onUpdate: () => {
|
|
1852
|
+
actions.updateSelf(target);
|
|
1853
|
+
}
|
|
1854
|
+
}) : null,
|
|
1855
|
+
body
|
|
1856
|
+
]
|
|
1857
|
+
});
|
|
2035
1858
|
}
|
|
1859
|
+
/**
|
|
1860
|
+
* Update controls on the Plugins page's own "Installed plugins" list: "Update
|
|
1861
|
+
* all" beside the group heading and an update button on each card with a newer
|
|
1862
|
+
* version. Rendered from the app overlay into mount nodes the adapter keeps.
|
|
1863
|
+
*/
|
|
2036
1864
|
function ListControls({ t, useUpdates, actions }) {
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
1865
|
+
const [anchors, setAnchors] = (0, react.useState)(NO_ANCHORS);
|
|
1866
|
+
(0, react.useEffect)(() => watchAnchors(document, setAnchors), []);
|
|
1867
|
+
const visible = anchors.head !== void 0 || anchors.cards.size > 0;
|
|
1868
|
+
(0, react.useEffect)(() => {
|
|
1869
|
+
if (visible) actions.ensure();
|
|
1870
|
+
}, [actions, visible]);
|
|
1871
|
+
const candidates = useUpdates((state) => state.candidates);
|
|
1872
|
+
const lookups = useUpdates((state) => state.lookups);
|
|
1873
|
+
const operation = useUpdates((state) => state.operation);
|
|
1874
|
+
const busy = isBusy(operation);
|
|
1875
|
+
const targets = /* @__PURE__ */ new Map();
|
|
1876
|
+
for (const candidate of candidates) {
|
|
1877
|
+
const target = updateTarget(candidate, lookups[candidate.name]);
|
|
1878
|
+
if (target !== void 0 && candidate.name !== "@shellraining/dsh-plugin-updates") targets.set(candidate.name, target);
|
|
1879
|
+
}
|
|
1880
|
+
const portals = [];
|
|
1881
|
+
if (anchors.status !== void 0 && operation !== void 0) portals.push((0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(OperationBanner, {
|
|
1882
|
+
t,
|
|
1883
|
+
operation,
|
|
1884
|
+
actions
|
|
1885
|
+
}), anchors.status, "operation"));
|
|
1886
|
+
if (anchors.head !== void 0 && targets.size > 0) portals.push((0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
1887
|
+
size: "sm",
|
|
1888
|
+
variant: "outline",
|
|
1889
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconDownloadOutlineRegular, { size: 13 }),
|
|
1890
|
+
disabled: busy,
|
|
1891
|
+
onClick: () => {
|
|
1892
|
+
actions.updateAll();
|
|
1893
|
+
},
|
|
1894
|
+
children: t("updateAllCount", { count: targets.size })
|
|
1895
|
+
}), anchors.head, "head"));
|
|
1896
|
+
for (const [name, node] of anchors.cards) {
|
|
1897
|
+
const target = targets.get(name);
|
|
1898
|
+
if (target === void 0) continue;
|
|
1899
|
+
const running = busy && operation?.name === name;
|
|
1900
|
+
portals.push((0, react_dom.createPortal)(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
1901
|
+
size: "sm",
|
|
1902
|
+
variant: "outline",
|
|
1903
|
+
disabled: busy,
|
|
1904
|
+
"aria-label": t("updateLabel", {
|
|
1905
|
+
name,
|
|
1906
|
+
version: target
|
|
1907
|
+
}),
|
|
1908
|
+
onClick: () => {
|
|
1909
|
+
actions.install(name, target);
|
|
1910
|
+
},
|
|
1911
|
+
children: running ? t("updating") : t("updateTo", { version: target })
|
|
1912
|
+
}), node, name));
|
|
1913
|
+
}
|
|
1914
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: portals });
|
|
2082
1915
|
}
|
|
2083
|
-
|
|
2084
1916
|
// src/client/index.tsx
|
|
2085
1917
|
var name = "@shellraining/dsh-plugin-updates";
|
|
2086
|
-
var inject = [
|
|
1918
|
+
var inject = [
|
|
1919
|
+
"slots",
|
|
1920
|
+
"locale",
|
|
1921
|
+
"remote",
|
|
1922
|
+
"remote.pluginManager"
|
|
1923
|
+
];
|
|
2087
1924
|
function apply(ctx) {
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
1925
|
+
ctx.effect(() => ctx.locale.register(LOCALE_NS, {
|
|
1926
|
+
zh: ZH,
|
|
1927
|
+
en: EN
|
|
1928
|
+
}), `${name}: copy`);
|
|
1929
|
+
ctx.effect(() => installStyle(document), `${name}: stylesheet`);
|
|
1930
|
+
const store = new UpdatesStore(ctx);
|
|
1931
|
+
ctx.effect(() => () => store.dispose(), `${name}: store`);
|
|
1932
|
+
ctx.effect(() => {
|
|
1933
|
+
const offs = [ctx.remote.$on("plugin-manager/changed", store.bundlesChanged), ctx.on("connection/reset", store.bundlesChanged)];
|
|
1934
|
+
return () => {
|
|
1935
|
+
for (const off of offs) off();
|
|
1936
|
+
};
|
|
1937
|
+
}, `${name}: host invalidations`);
|
|
1938
|
+
store.watchSelf();
|
|
1939
|
+
ctx.locale.bind(LOCALE_NS);
|
|
1940
|
+
const face = {
|
|
1941
|
+
hooks: { updates: store },
|
|
1942
|
+
actions: {
|
|
1943
|
+
ensure: store.ensure,
|
|
1944
|
+
install: store.install,
|
|
1945
|
+
updateSelf: store.updateSelf,
|
|
1946
|
+
updateAll: store.updateAll,
|
|
1947
|
+
restore: store.restore,
|
|
1948
|
+
dismiss: store.dismiss,
|
|
1949
|
+
toastDone: store.toastDone
|
|
1950
|
+
}
|
|
1951
|
+
};
|
|
1952
|
+
ctx.slots.inject("shell.overlay", () => ctx.slots.register({
|
|
1953
|
+
name: "shell.overlay",
|
|
1954
|
+
id: "plugin-updates.toast",
|
|
1955
|
+
locale: LOCALE_NS,
|
|
1956
|
+
inject: () => face
|
|
1957
|
+
}, OperationToast));
|
|
1958
|
+
ctx.slots.inject("shell.overlay", () => ctx.slots.register({
|
|
1959
|
+
name: "shell.overlay",
|
|
1960
|
+
id: "plugin-updates.list",
|
|
1961
|
+
locale: LOCALE_NS,
|
|
1962
|
+
inject: () => face
|
|
1963
|
+
}, ListControls));
|
|
1964
|
+
for (const [slot, component] of [
|
|
1965
|
+
["plugins.detail.badge", DetailBadge],
|
|
1966
|
+
["plugins.detail.actions", DetailAction],
|
|
1967
|
+
["plugins.detail.section", DetailSection]
|
|
1968
|
+
]) ctx.slots.inject(slot, () => ctx.slots.register({
|
|
1969
|
+
name: slot,
|
|
1970
|
+
id: "plugin-updates",
|
|
1971
|
+
locale: LOCALE_NS,
|
|
1972
|
+
inject: () => face
|
|
1973
|
+
}, component));
|
|
2136
1974
|
}
|
|
1975
|
+
exports.apply = apply;
|
|
1976
|
+
exports.inject = inject;
|
|
1977
|
+
exports.name = name;
|
|
2137
1978
|
|
|
2138
1979
|
return module.exports;
|
|
2139
1980
|
},
|