Files
api/plugin/package.json
Pujit Mehrotra 34075e44c5 fix: flaky watch on boot drive's dynamix config (#1753)
On FAT32, `fs.stat()` updates accesstime, which means file reads are
also writes, which means we can't use `usePoll` without degrading users'
flash drives.

To keep file reads lazy without a larger refactor, I override
`getters.dynamix()` as the entrypoint to re-read the boot drive's
dynamix config.

Consecutive calls to `getters.dynamix()` are a common access pattern,
which means we have to memoize to avoid many redundant file reads, so I
used a TTL cache with a 250ms lifetime, hoping to scope config files to
each request.

`getters.dynamix()` is also used synchonously, so bit the bullet and
switched away from async reads for simplicity, considering that most
reads will be occurring from memory, even during cache misses.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
  * Added a TTL memoized loader utility with exported types.
  * Added a public function to load Dynamix configuration at startup.

* **Refactor**
* Startup now uses the deterministic, cached config loader; runtime
file-watch for Dynamix config removed.
* Simplified config state handling and load-status reporting for more
predictable startup behavior.

* **Tests**
* Added tests for TTL caching, eviction, keying, and conditional
caching.

* **Chores**
  * Bumped package versions and updated changelog.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-10-27 11:05:13 -04:00

47 lines
1.6 KiB
JSON

{
"name": "@unraid/connect-plugin",
"version": "4.25.3",
"private": true,
"dependencies": {
"commander": "14.0.0",
"conventional-changelog": "7.1.1",
"conventional-changelog-conventionalcommits": "9.1.0",
"date-fns": "4.1.0",
"glob": "11.0.3",
"html-sloppy-escaper": "0.1.0",
"semver": "7.7.2",
"tsx": "4.20.5",
"zod": "3.25.76",
"zx": "8.8.1"
},
"type": "module",
"license": "GPL-2.0-or-later",
"scripts": {
"// Build scripts": "",
"build": "pnpm run build:txz && pnpm run build:plugin && ./scripts/output-local-url.sh",
"build:txz": "tsx builder/build-txz.ts",
"build:plugin": "tsx builder/build-plugin.ts",
"build:validate": "npm run env:validate && npm run build",
"build:watcher": "./scripts/build-watcher.sh",
"// Docker commands": "",
"build:watch": "./scripts/dc.sh pnpm run build:watcher",
"docker:build": "docker compose build",
"docker:run": "./scripts/dc.sh /bin/bash",
"docker:build-and-run": "pnpm run docker:build && pnpm run docker:run",
"// Environment management": "",
"env:init": "cp .env.example .env",
"env:validate": "test -f .env || (echo 'Error: .env file missing. Run npm run env:init first' && exit 1)",
"env:clean": "rm -f .env",
"// Testing": "",
"test": "vitest && pnpm run test:extractor && pnpm run test:shell-detection",
"test:extractor": "bash ./tests/test-extractor.sh",
"test:shell-detection": "bash ./tests/test-shell-detection.sh"
},
"devDependencies": {
"http-server": "14.1.1",
"nodemon": "3.1.10",
"vitest": "3.2.4"
},
"packageManager": "pnpm@10.15.0"
}