dsh-unlag 1.9.9 → 1.9.11

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 (3) hide show
  1. package/client.js +10 -0
  2. package/index.js +14 -2
  3. package/package.json +1 -1
package/client.js CHANGED
@@ -581,6 +581,7 @@ window.__ModuleLoader__.load({
581
581
  return () => clearTimeout(timer);
582
582
  }, [notice]);
583
583
 
584
+
584
585
  const style = pending
585
586
  ? { ...BUTTON_STYLE, opacity: 0.4 }
586
587
  : hover
@@ -658,6 +659,15 @@ window.__ModuleLoader__.load({
658
659
  pressInFlight = false;
659
660
  // The document goes away on a rebuild, so the button only needs re-enabling when it does not.
660
661
  if (!navigated) setPending(false);
662
+ else {
663
+ setTimeout(() => {
664
+ // Still here after asking for a rebuild: the page held the navigation. Say what
665
+ // happened and take the press back, so the button is never left unresponsive.
666
+ report('held', 'navigation');
667
+ setPending(false);
668
+ setNotice(noticeFor('replaced'));
669
+ }, 6000); // ui-copy-ignore
670
+ }
661
671
  }
662
672
  };
663
673
 
package/index.js CHANGED
@@ -46,6 +46,18 @@ const VERSION = (() => {
46
46
  return 'unknown'
47
47
  }
48
48
  })()
49
+
50
+ /**
51
+ * When this file was last written. The version alone can name a package whose host half was never
52
+ * reloaded — the loader keeps a module it already loaded — and this is what tells the two apart.
53
+ */
54
+ const CODE_STAMP = (() => {
55
+ try {
56
+ return statSync(new URL('./index.js', import.meta.url)).mtime.toISOString() // ui-copy-ignore
57
+ } catch {
58
+ return 'unknown'
59
+ }
60
+ })()
49
61
  let logWrites = 0
50
62
  /** Tests point this at a scratch file, so a test run leaves the live log readable. */
51
63
  const logTarget = () => process.env.DSH_UNLAG_LOG ?? LOG_PATH
@@ -1425,7 +1437,7 @@ function serveButton(ctx, controller, config) {
1425
1437
  [
1426
1438
  `${BASE_PATH}/state`,
1427
1439
  (_req, res) => {
1428
- sendJson(res, 200, { version: VERSION, plugins: settings.reloadPlugins, page: settings.reloadInterface, shim: bundleShimStatus(ctx) })
1440
+ sendJson(res, 200, { version: VERSION, code: CODE_STAMP, plugins: settings.reloadPlugins, page: settings.reloadInterface, shim: bundleShimStatus(ctx) })
1429
1441
  },
1430
1442
  ],
1431
1443
  [
@@ -1558,7 +1570,7 @@ export function apply(ctx, config) {
1558
1570
  }
1559
1571
  // Printed on every start so a reader of the log knows which action applies a change: a person
1560
1572
  // pressing the button, never this plugin, and never a restart of the app.
1561
- log(`dsh-unlag ${VERSION} loaded`)
1573
+ log(`dsh-unlag ${VERSION} loaded (code ${CODE_STAMP})`)
1562
1574
  log('plugin reload is manual: ask the user to press the refresh button; do not restart the app')
1563
1575
  if (settingsOf(config ?? {}).autoReload === true) {
1564
1576
  syncWatching()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-unlag",
3
- "version": "1.9.9",
3
+ "version": "1.9.11",
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",