dsh-unlag 1.9.124 → 1.9.126

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 +14 -1
  2. package/index.js +8 -1
  3. package/package.json +2 -2
package/client.js CHANGED
@@ -143,8 +143,18 @@ window.__ModuleLoader__.load({
143
143
  } catch {
144
144
  page = '';
145
145
  }
146
+ // Each document has its own time origin. Two lines with the same origin are one page
147
+ // reporting twice; two lines with different origins are two documents, which is the only
148
+ // way to tell a double reload apart from a double report after the fact.
149
+ let born = '';
150
+ try {
151
+ born = String(Math.round(Number(performance?.timeOrigin ?? 0))).replace(/[^0-9]/gu, '').slice(0, 16);
152
+ } catch {
153
+ born = '';
154
+ }
146
155
  const named = gate === undefined ? `event=${event}` : `event=${event}&gate=${encodeURIComponent(gate)}`;
147
- const query = page === '' ? named : `${named}&rev=${page}`;
156
+ const withPage = page === '' ? named : `${named}&rev=${page}`;
157
+ const query = born === '' ? withPage : `${withPage}&born=${born}`;
148
158
  /**
149
159
  * The route belongs to the instance this press is replacing. Its answer can land while the old
150
160
  * one is gone and the new one is not listening yet, and a lost line is a press nobody can
@@ -888,6 +898,9 @@ window.__ModuleLoader__.load({
888
898
  // nothing, so the next press must not be turned away as if this one had been answered.
889
899
  stampWrite();
890
900
  report('rebuild');
901
+ // One line for the navigation itself: the number of documents that come up after it is
902
+ // the number of loads the person sees, and only the log can count them afterwards.
903
+ report('navigating');
891
904
  navigated = true;
892
905
  reloadFreshPage();
893
906
  return undefined;
package/index.js CHANGED
@@ -2031,7 +2031,13 @@ function serveButton(ctx, controller, config) {
2031
2031
  .join(' then ')
2032
2032
  // Which generation of the page came up. A rebuild that lands on older bytes then says so.
2033
2033
  const pageRev = (params.get('rev') ?? '').replace(/[^a-z0-9]/gu, '').slice(0, 24)
2034
- const from = pageRev === '' ? '' : ` (page ${pageRev})`
2034
+ // Each document has its own time origin, so the log can tell one page reporting twice
2035
+ // from two documents coming up. Without it a double reload and a doubled report read
2036
+ // the same.
2037
+ const born = (params.get('born') ?? '').replace(/[^0-9]/gu, '').slice(0, 16)
2038
+ const from = pageRev === '' && born === ''
2039
+ ? ''
2040
+ : ` (page ${pageRev === '' ? '?' : pageRev}${born === '' ? '' : `, born ${born}`})`
2035
2041
  /**
2036
2042
  * Every outcome the page reports is written down. A press whose line was missing left the
2037
2043
  * log unable to say what happened; an outcome with no line of its own (a failed
@@ -2040,6 +2046,7 @@ function serveButton(ctx, controller, config) {
2040
2046
  const named = event.replace(/[^a-z-]/gu, '').slice(0, 24)
2041
2047
  if (named === 'mounted') log(`interface rebuilt; the page runs the plugins as served now${from}`)
2042
2048
  else if (named === 'rebuild') log('rebuild allowed: the page re-enters on the served modules')
2049
+ else if (named === 'navigating') log('the page is going for a fresh document')
2043
2050
  else if (named === 'held') log(`rebuild held back: ${gate === '' ? 'unknown' : gate}`)
2044
2051
  else if (named === '') log('a press reported nothing')
2045
2052
  else log(`a press ended: ${named}${gate === '' ? '' : ` (${gate})`}${from}`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-unlag",
3
- "version": "1.9.124",
3
+ "version": "1.9.126",
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",
@@ -52,7 +52,7 @@
52
52
  },
53
53
  "scripts": {
54
54
  "test": "for f in test/*.test.mjs; do node \"$f\" || exit 1; done",
55
- "audit": "eslint --no-config-lookup --rule '{\"no-undef\":\"error\",\"no-unused-vars\":[\"error\",{\"args\":\"none\",\"caughtErrors\":\"none\"}]}' --global window --global document --global navigator --global location --global sessionStorage --global localStorage --global fetch --global Response --global Request --global URL --global URLSearchParams --global AbortController --global CustomEvent --global Event --global setTimeout --global clearTimeout --global setInterval --global clearInterval --global requestAnimationFrame --global queueMicrotask --global structuredClone --global Buffer --global process --global console index.js client.js",
55
+ "audit": "eslint --no-config-lookup --rule '{\"no-undef\":\"error\",\"no-unused-vars\":[\"error\",{\"args\":\"none\",\"caughtErrors\":\"none\"}]}' --global window --global performance --global document --global navigator --global location --global sessionStorage --global localStorage --global fetch --global Response --global Request --global URL --global URLSearchParams --global AbortController --global CustomEvent --global Event --global setTimeout --global clearTimeout --global setInterval --global clearInterval --global requestAnimationFrame --global queueMicrotask --global structuredClone --global Buffer --global process --global console index.js client.js",
56
56
  "smoke": "node scripts/live-smoke.mjs"
57
57
  },
58
58
  "devDependencies": {