dsh-unlag 1.9.8 → 1.9.9

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/index.js +12 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -36,6 +36,16 @@ const RELOAD_TIMEOUT_MS = 20_000
36
36
  const LOG_PATH = join(homedir(), '.dsh', 'unlag-reload.log')
37
37
  /** Past this many bytes the log starts over: it records recent presses, not an archive. */
38
38
  const LOG_MAX_BYTES = 1_000_000 // ui-copy-ignore
39
+
40
+ /** Which version this half is running: the only way to tell a reloaded half from a stale one. */
41
+ const VERSION = (() => {
42
+ try {
43
+ const raw = readFileSync(new URL('./package.json', import.meta.url), 'utf8') // ui-copy-ignore
44
+ return String(JSON.parse(raw)?.version ?? 'unknown')
45
+ } catch {
46
+ return 'unknown'
47
+ }
48
+ })()
39
49
  let logWrites = 0
40
50
  /** Tests point this at a scratch file, so a test run leaves the live log readable. */
41
51
  const logTarget = () => process.env.DSH_UNLAG_LOG ?? LOG_PATH
@@ -1415,7 +1425,7 @@ function serveButton(ctx, controller, config) {
1415
1425
  [
1416
1426
  `${BASE_PATH}/state`,
1417
1427
  (_req, res) => {
1418
- sendJson(res, 200, { plugins: settings.reloadPlugins, page: settings.reloadInterface, shim: bundleShimStatus(ctx) })
1428
+ sendJson(res, 200, { version: VERSION, plugins: settings.reloadPlugins, page: settings.reloadInterface, shim: bundleShimStatus(ctx) })
1419
1429
  },
1420
1430
  ],
1421
1431
  [
@@ -1548,6 +1558,7 @@ export function apply(ctx, config) {
1548
1558
  }
1549
1559
  // Printed on every start so a reader of the log knows which action applies a change: a person
1550
1560
  // pressing the button, never this plugin, and never a restart of the app.
1561
+ log(`dsh-unlag ${VERSION} loaded`)
1551
1562
  log('plugin reload is manual: ask the user to press the refresh button; do not restart the app')
1552
1563
  if (settingsOf(config ?? {}).autoReload === true) {
1553
1564
  syncWatching()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-unlag",
3
- "version": "1.9.8",
3
+ "version": "1.9.9",
4
4
  "type": "module",
5
5
  "description": "A press applies plugin edits right away and brings a laggy interface back; automatic reloading stays off unless you turn it on, so the press is the only trigger, and nothing restarts.",
6
6
  "license": "MIT",