dsh-unlag 1.9.11 → 1.9.13

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 +3 -1
  2. package/index.js +11 -2
  3. package/package.json +1 -1
package/client.js CHANGED
@@ -118,7 +118,9 @@ window.__ModuleLoader__.load({
118
118
  * the time anyone reads it.
119
119
  */
120
120
  function report(event, gate) {
121
- const query = gate === undefined ? `event=${event}` : `event=${event}&gate=${encodeURIComponent(gate)}`;
121
+ const page = String(window?.__DSH_BOOT__?.rev ?? '').replace(/[^a-z0-9]/gu, '').slice(0, 24);
122
+ const named = gate === undefined ? `event=${event}` : `event=${event}&gate=${encodeURIComponent(gate)}`;
123
+ const query = page === '' ? named : `${named}&rev=${page}`;
122
124
  try {
123
125
  fetch(`${HOST_BASE}/report?${query}`, {
124
126
  method: 'POST', // ui-copy-ignore
package/index.js CHANGED
@@ -1437,7 +1437,13 @@ function serveButton(ctx, controller, config) {
1437
1437
  [
1438
1438
  `${BASE_PATH}/state`,
1439
1439
  (_req, res) => {
1440
- sendJson(res, 200, { version: VERSION, code: CODE_STAMP, plugins: settings.reloadPlugins, page: settings.reloadInterface, shim: bundleShimStatus(ctx) })
1440
+ // A disposed context answers with a status instead of a throw the server has to guess at.
1441
+ try {
1442
+ sendJson(res, 200, { version: VERSION, code: CODE_STAMP, plugins: settings.reloadPlugins, page: settings.reloadInterface, shim: bundleShimStatus(ctx) })
1443
+ } catch (error) {
1444
+ log(`cannot describe this copy of the plugin: ${error?.message ?? error}`)
1445
+ sendJson(res, 500, { status: 'error' })
1446
+ }
1441
1447
  },
1442
1448
  ],
1443
1449
  [
@@ -1494,7 +1500,10 @@ function serveButton(ctx, controller, config) {
1494
1500
  const event = params.get('event') ?? ''
1495
1501
  // A query comes from outside: one shaped gate keeps a forged line out of the log.
1496
1502
  const gate = (params.get('gate') ?? '').replace(/[^a-z-]/gu, '').slice(0, 24)
1497
- if (event === 'mounted') log('interface rebuilt; the page runs the plugins as served now')
1503
+ // Which generation of the page came up. A rebuild that lands on older bytes then says so.
1504
+ const pageRev = (params.get('rev') ?? '').replace(/[^a-z0-9]/gu, '').slice(0, 24)
1505
+ const from = pageRev === '' ? '' : ` (page ${pageRev})`
1506
+ if (event === 'mounted') log(`interface rebuilt; the page runs the plugins as served now${from}`)
1498
1507
  else if (event === 'rebuild') log('rebuild allowed: the page re-enters on the served modules')
1499
1508
  else if (event === 'held') log(`rebuild held back: ${gate === '' ? 'unknown' : gate}`)
1500
1509
  sendJson(res, 200, { status: 'done' })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-unlag",
3
- "version": "1.9.11",
3
+ "version": "1.9.13",
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",