opencode-windows-scheduler 1.0.0 → 1.1.0

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/src/version.ts ADDED
@@ -0,0 +1,27 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+
5
+ let cached: string | null = null;
6
+
7
+ /**
8
+ * Версия плагина из package.json.
9
+ *
10
+ * Читается в рантайме из корня пакета рядом со скомпилированным модулем
11
+ * (dist/version.js -> ../package.json). Если файл недоступен — «unknown».
12
+ */
13
+ export function getPluginVersion(): string {
14
+ if (cached) return cached;
15
+ try {
16
+ const here = path.dirname(fileURLToPath(import.meta.url));
17
+ const raw = fs.readFileSync(path.join(here, "..", "package.json"), "utf8");
18
+ const pkg = JSON.parse(raw) as { version?: unknown };
19
+ cached =
20
+ typeof pkg.version === "string" && pkg.version.trim()
21
+ ? pkg.version.trim()
22
+ : "unknown";
23
+ } catch {
24
+ cached = "unknown";
25
+ }
26
+ return cached;
27
+ }
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("solid-js/web"),m=require("solid-js"),a=require("@opencode/plugin/gui");function p(r){switch(r){case"running":return"●";case"error":return"✗";case"success":return"✓";default:return"?"}}async function _(r){return[]}var $=e.template("<div style=padding:8px><h4>Планировщик Windows"),g=e.template("<p>Задач пока нет"),v=e.template("<ul>"),f=e.template("<li> ");const h=a.Plugin.define({setup(r){const[u,i]=m.createSignal([]);return _().then(i).catch(()=>i([])),r.add(a.Panel,{id:"scheduler-jobs",region:"side",list:()=>[{id:"jobs",title:"Планировщик",pinned:!0}],render:()=>(()=>{var s=$();return s.firstChild,e.insert(s,(()=>{var c=e.memo(()=>u().length===0);return()=>c()?g():(()=>{var l=v();return e.insert(l,()=>u().map(n=>(()=>{var t=f(),o=t.firstChild;return e.insert(t,()=>p(n.status),o),e.insert(t,()=>n.name,null),e.insert(t,(()=>{var d=e.memo(()=>!!n.nextRun);return()=>d()?` → ${n.nextRun}`:""})(),null),t})())),l})()})(),null),s})()})}});exports.default=h;