(platform)
| 388 | let pluginPlatform = "android"; |
| 389 | |
| 390 | function startPluginWatcher(platform) { |
| 391 | pluginPlatform = platform; |
| 392 | let chokidar; |
| 393 | try { |
| 394 | chokidar = require("chokidar"); |
| 395 | } catch (_e) { |
| 396 | log("warn", "chokidar not installed — plugin auto-update disabled"); |
| 397 | return; |
| 398 | } |
| 399 | |
| 400 | if (!fs.existsSync(PLUGINS)) { |
| 401 | log("warn", "src/plugins/ not found — plugin watcher skipped"); |
| 402 | return; |
| 403 | } |
| 404 | |
| 405 | const watcher = chokidar.watch(path.join(PLUGINS, "**", "*"), { |
| 406 | ignored: /(^|[\/\\])\../, // dotfiles |
| 407 | persistent: true, |
| 408 | ignoreInitial: true, |
| 409 | awaitWriteFinish: { stabilityThreshold: 500, pollInterval: 100 }, |
| 410 | }); |
| 411 | |
| 412 | watcher.on("change", (filePath) => schedulePluginUpdate(filePath)); |
| 413 | watcher.on("add", (filePath) => schedulePluginUpdate(filePath)); |
| 414 | watcher.on("unlink", (filePath) => schedulePluginUpdate(filePath)); |
| 415 | |
| 416 | log("info", "Watching src/plugins/ for changes..."); |
| 417 | } |
| 418 | |
| 419 | function schedulePluginUpdate(filePath) { |
| 420 | // Extract top-level plugin dir name from path |
no test coverage detected