@honor-claw/yoyo 1.5.1-beta.6 → 1.5.1-beta.7

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.
@@ -1,21 +1,16 @@
1
- import { existsSync as e } from "node:fs";
1
+ import { findPackageRoot as e } from "./package-json.mjs";
2
2
  import t from "node:path";
3
- import n from "node:os";
4
- import { fileURLToPath as r } from "node:url";
3
+ import { fileURLToPath as n } from "node:url";
4
+ import r from "node:os";
5
5
  //#region src/utils/home-dir.ts
6
6
  function i(e) {
7
7
  return e?.trim() || void 0;
8
8
  }
9
- function a(n = import.meta.url) {
10
- let i = t.dirname(r(n));
11
- for (; i !== t.dirname(i);) {
12
- if (e(t.join(i, "package.json"))) return i;
13
- i = t.dirname(i);
14
- }
15
- return i;
9
+ function a(r = import.meta.url) {
10
+ return e(r) ?? t.parse(n(r)).root;
16
11
  }
17
- function o(e = process.env, r = n.homedir) {
18
- let i = s(e, r);
12
+ function o(e = process.env, n = r.homedir) {
13
+ let i = s(e, n);
19
14
  return i ? t.resolve(i) : void 0;
20
15
  }
21
16
  function s(e, t) {
@@ -0,0 +1,25 @@
1
+ import { existsSync as e, readFileSync as t } from "node:fs";
2
+ import n from "node:path";
3
+ import { fileURLToPath as r } from "node:url";
4
+ //#region src/utils/package-json.ts
5
+ function i(t = import.meta.url, i) {
6
+ let a = n.dirname(r(t));
7
+ for (; a !== n.dirname(a);) {
8
+ let t = n.join(a, "package.json");
9
+ if (e(t) && (!i || o(t)?.name === i)) return a;
10
+ a = n.dirname(a);
11
+ }
12
+ }
13
+ function a(e) {
14
+ return o(n.join(e, "package.json"));
15
+ }
16
+ function o(e) {
17
+ try {
18
+ let n = JSON.parse(t(e, "utf-8"));
19
+ return n && typeof n == "object" ? n : void 0;
20
+ } catch {
21
+ return;
22
+ }
23
+ }
24
+ //#endregion
25
+ export { i as findPackageRoot, a as readPackageJson };
@@ -1,17 +1,27 @@
1
+ import { findPackageRoot as e, readPackageJson as t } from "./package-json.mjs";
1
2
  //#region src/utils/version.ts
2
- var e = null, t = null;
3
- function n() {
4
- return e === null && (e = "1.5.1-beta.6".includes("beta") || "1.5.1-beta.6".includes("alpha")), !!e;
3
+ var n = "@honor-claw/yoyo";
4
+ function r() {
5
+ let e = o();
6
+ return e.includes("beta") || e.includes("alpha");
5
7
  }
6
- function r(e) {
8
+ function i(e) {
7
9
  if (!e) return 0;
8
10
  let t = Number.parseInt(e, 10);
9
11
  return Number.isFinite(t) && t >= 0 ? t : 0;
10
12
  }
11
- function i() {
12
- if (t !== null) return t;
13
- let [e, n, i] = "1.5.1-beta.6".split("-", 1)[0].split("."), a = r(e), o = r(n), s = r(i);
14
- return t = a * 1e6 + o * 1e3 + s, t;
13
+ function a() {
14
+ let [e, t, n] = o().split("-", 1)[0].split("."), r = i(e), a = i(t), s = i(n);
15
+ return r * 1e6 + a * 1e3 + s;
16
+ }
17
+ function o() {
18
+ try {
19
+ let r = e(import.meta.url, n);
20
+ if (!r) return "0.0.0";
21
+ let i = t(r)?.version;
22
+ if (typeof i == "string") return i;
23
+ } catch {}
24
+ return "0.0.0";
15
25
  }
16
26
  //#endregion
17
- export { i as getYoyoPluginVersionCode, n as isBetaVersion };
27
+ export { a as getYoyoPluginVersionCode, r as isBetaVersion };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@honor-claw/yoyo",
3
- "version": "1.5.1-beta.6",
3
+ "version": "1.5.1-beta.7",
4
4
  "description": "OpenClaw Honor Yoyo connection plugin",
5
5
  "keywords": [
6
6
  "ai",