plugin-updater 1.0.27 → 1.0.29

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.
Files changed (2) hide show
  1. package/dist/index.js +18 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -48,6 +48,8 @@ function writeLog(message, isError = false) {
48
48
  }
49
49
  }
50
50
  catch { /* never crash on log failure */ }
51
+ if (process.env.PLUGIN_UPDATER_LIBRARY_MODE === "1")
52
+ return;
51
53
  if (isError)
52
54
  console.error(message);
53
55
  else if (loggingEnabled)
@@ -89,6 +91,18 @@ function getNpmGlobalRoot() {
89
91
  }
90
92
  function resolveNpmPluginVersion(name, configDir) {
91
93
  try {
94
+ // opencode installs npm plugins into ~/.cache/opencode/packages/<name>@<spec>/
95
+ const packageCache = path.join(os.homedir(), ".cache", "opencode", "packages");
96
+ if (fs.existsSync(packageCache)) {
97
+ for (const entry of fs.readdirSync(packageCache)) {
98
+ if (entry !== name && !entry.startsWith(`${name}@`))
99
+ continue;
100
+ const cachedPkg = path.join(packageCache, entry, "node_modules", name, "package.json");
101
+ if (fs.existsSync(cachedPkg)) {
102
+ return JSON.parse(fs.readFileSync(cachedPkg, "utf8")).version || "";
103
+ }
104
+ }
105
+ }
92
106
  const cacheDir = path.join(configDir, "cache", "node_modules");
93
107
  const globalNpm = getNpmGlobalRoot();
94
108
  const candidates = [
@@ -467,4 +481,7 @@ export async function activate(opencodeHookInput) {
467
481
  }
468
482
  await earlyLaunch(configDir, gitPlugins);
469
483
  }
470
- activate();
484
+ // consumers like the loader TUI import this module for its API only — running
485
+ // the full updater sequence on import would print over their screen
486
+ if (process.env.PLUGIN_UPDATER_LIBRARY_MODE !== "1")
487
+ activate();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plugin-updater",
3
- "version": "1.0.27",
3
+ "version": "1.0.29",
4
4
  "description": "Plugin lifecycle manager for OpenCode and Claude Code launchers",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",