opencode-supertask 0.1.27 → 0.1.28
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/dist/plugin/supertask.js
CHANGED
|
@@ -28806,16 +28806,18 @@ function latestVersion() {
|
|
|
28806
28806
|
const detail = `${result.stderr ?? ""}`.trim();
|
|
28807
28807
|
throw new Error(`[supertask] \u67E5\u8BE2 npm latest \u5931\u8D25: ${detail || `\u9000\u51FA\u7801 ${result.status}`}`);
|
|
28808
28808
|
}
|
|
28809
|
-
let
|
|
28809
|
+
let response;
|
|
28810
28810
|
try {
|
|
28811
|
-
|
|
28811
|
+
response = JSON.parse(output);
|
|
28812
28812
|
} catch {
|
|
28813
28813
|
throw new Error(`[supertask] npm latest \u8FD4\u56DE\u65E0\u6CD5\u89E3\u6790: ${output || "(empty)"}`);
|
|
28814
28814
|
}
|
|
28815
|
-
|
|
28816
|
-
|
|
28815
|
+
const versions = typeof response === "string" ? [response] : Array.isArray(response) && response.every((value) => typeof value === "string") ? response : [];
|
|
28816
|
+
const uniqueVersions = [...new Set(versions)];
|
|
28817
|
+
if (uniqueVersions.length !== 1 || !isSemanticVersion(uniqueVersions[0])) {
|
|
28818
|
+
throw new Error(`[supertask] npm latest \u7248\u672C\u65E0\u6548: ${String(response)}`);
|
|
28817
28819
|
}
|
|
28818
|
-
return
|
|
28820
|
+
return uniqueVersions[0];
|
|
28819
28821
|
}
|
|
28820
28822
|
function resolveInstalledVersion(expectedVersion) {
|
|
28821
28823
|
const override = process.env.SUPERTASK_PLUGIN_PACKAGE_DIR;
|