dsh-unlag 1.9.7 → 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.
- package/index.js +19 -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
|
|
@@ -1049,7 +1059,13 @@ function serveBundlesAtCurrentRevision(ctx) {
|
|
|
1049
1059
|
* names, because a chunk is served at its entry's revision and nowhere else.
|
|
1050
1060
|
*/
|
|
1051
1061
|
const url = String(request?.url ?? '')
|
|
1052
|
-
|
|
1062
|
+
// Same reason as the handler shape below: a rejection here is unhandled and ends the process.
|
|
1063
|
+
let retargeted = null
|
|
1064
|
+
try {
|
|
1065
|
+
retargeted = retargetRevision(url, entryRevisionFor(clientModules.graph(), url))
|
|
1066
|
+
} catch (error) {
|
|
1067
|
+
log(`cannot read the plugin table for a bundle request: ${error?.message ?? error}`)
|
|
1068
|
+
}
|
|
1053
1069
|
const method = String(request?.method ?? 'GET').toUpperCase()
|
|
1054
1070
|
let answer = null
|
|
1055
1071
|
try {
|
|
@@ -1409,7 +1425,7 @@ function serveButton(ctx, controller, config) {
|
|
|
1409
1425
|
[
|
|
1410
1426
|
`${BASE_PATH}/state`,
|
|
1411
1427
|
(_req, res) => {
|
|
1412
|
-
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) })
|
|
1413
1429
|
},
|
|
1414
1430
|
],
|
|
1415
1431
|
[
|
|
@@ -1542,6 +1558,7 @@ export function apply(ctx, config) {
|
|
|
1542
1558
|
}
|
|
1543
1559
|
// Printed on every start so a reader of the log knows which action applies a change: a person
|
|
1544
1560
|
// pressing the button, never this plugin, and never a restart of the app.
|
|
1561
|
+
log(`dsh-unlag ${VERSION} loaded`)
|
|
1545
1562
|
log('plugin reload is manual: ask the user to press the refresh button; do not restart the app')
|
|
1546
1563
|
if (settingsOf(config ?? {}).autoReload === true) {
|
|
1547
1564
|
syncWatching()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-unlag",
|
|
3
|
-
"version": "1.9.
|
|
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",
|