chore(deadcode): remove unused plugin version validator · openclaw/openclaw@f9ebb8d
vincentkoc
·
2026-06-22
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | // Bundled Extension Manifest script supports OpenClaw repository automation. |
2 | | -import { validateMinHostVersion } from "../../src/plugins/min-host-version.ts"; |
| 2 | +import { |
| 3 | +MIN_HOST_VERSION_FORMAT, |
| 4 | +parseMinHostVersionRequirement, |
| 5 | +} from "../../src/plugins/min-host-version.ts"; |
3 | 6 | import { isRecord } from "../../src/utils.js"; |
4 | 7 | |
5 | 8 | export type ExtensionPackageJson = { |
@@ -35,7 +38,11 @@ export function collectBundledExtensionManifestErrors(extensions: BundledExtensi
|
35 | 38 | `bundled extension '${extension.id}' manifest invalid | openclaw.install.npmSpec must be a non-empty string`, |
36 | 39 | ); |
37 | 40 | } |
38 | | -const minHostVersionError = validateMinHostVersion(install?.minHostVersion); |
| 41 | +const minHostVersionError = |
| 42 | +install?.minHostVersion === undefined || |
| 43 | +parseMinHostVersionRequirement(install.minHostVersion) |
| 44 | + ? null |
| 45 | + : MIN_HOST_VERSION_FORMAT; |
39 | 46 | if (minHostVersionError) { |
40 | 47 | errors.push(`bundled extension '${extension.id}' manifest invalid | ${minHostVersionError}`); |
41 | 48 | } |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -4,7 +4,6 @@ import {
|
4 | 4 | checkMinHostVersion, |
5 | 5 | MIN_HOST_VERSION_FORMAT, |
6 | 6 | parseMinHostVersionRequirement, |
7 | | -validateMinHostVersion, |
8 | 7 | } from "./min-host-version.js"; |
9 | 8 | |
10 | 9 | const MIN_HOST_REQUIREMENT = { |
@@ -40,8 +39,7 @@ function expectHostCheckResult(params: {
|
40 | 39 | ).toEqual(params.expected); |
41 | 40 | } |
42 | 41 | |
43 | | -function expectInvalidMinHostVersion(minHostVersion: string | number) { |
44 | | -expect(validateMinHostVersion(minHostVersion)).toBe(MIN_HOST_VERSION_FORMAT); |
| 42 | +function expectInvalidHostCheck(minHostVersion: string | number) { |
45 | 43 | expectHostCheckResult({ |
46 | 44 | currentVersion: "2026.3.22", |
47 | 45 | minHostVersion, |
@@ -55,7 +53,6 @@ function expectInvalidMinHostVersion(minHostVersion: string | number) {
|
55 | 53 | |
56 | 54 | describe("min-host-version", () => { |
57 | 55 | it("accepts empty metadata", () => { |
58 | | -expect(validateMinHostVersion(undefined)).toBeNull(); |
59 | 56 | expect(parseMinHostVersionRequirement(undefined)).toBeNull(); |
60 | 57 | expectValidHostCheck("2026.3.22"); |
61 | 58 | }); |
@@ -92,7 +89,7 @@ describe("min-host-version", () => {
|
92 | 89 | it.each(["2026.3.22", 123, ">=2026.3.22 garbage"] as const)( |
93 | 90 | "rejects invalid floor syntax and host checks: %p", |
94 | 91 | (minHostVersion) => { |
95 | | -expectInvalidMinHostVersion(minHostVersion); |
| 92 | +expectInvalidHostCheck(minHostVersion); |
96 | 93 | }, |
97 | 94 | ); |
98 | 95 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -56,14 +56,6 @@ export function parseMinHostVersionRequirement(
|
56 | 56 | }; |
57 | 57 | } |
58 | 58 | |
59 | | -/** Validates a plugin minHostVersion manifest field for schema/reporting callers. */ |
60 | | -export function validateMinHostVersion(raw: unknown): string | null { |
61 | | -if (raw === undefined) { |
62 | | -return null; |
63 | | -} |
64 | | -return parseMinHostVersionRequirement(raw) ? null : MIN_HOST_VERSION_FORMAT; |
65 | | -} |
66 | | - |
67 | 59 | /** Checks whether the current host satisfies a plugin minHostVersion requirement. */ |
68 | 60 | export function checkMinHostVersion(params: { |
69 | 61 | currentVersion: string | undefined; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。