dsh-unlag 1.9.10 → 1.9.12
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 +20 -2
- package/package.json +1 -1
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,13 @@ function serveButton(ctx, controller, config) {
|
|
|
1425
1437
|
[
|
|
1426
1438
|
`${BASE_PATH}/state`,
|
|
1427
1439
|
(_req, res) => {
|
|
1428
|
-
|
|
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
|
+
}
|
|
1429
1447
|
},
|
|
1430
1448
|
],
|
|
1431
1449
|
[
|
|
@@ -1558,7 +1576,7 @@ export function apply(ctx, config) {
|
|
|
1558
1576
|
}
|
|
1559
1577
|
// Printed on every start so a reader of the log knows which action applies a change: a person
|
|
1560
1578
|
// pressing the button, never this plugin, and never a restart of the app.
|
|
1561
|
-
log(`dsh-unlag ${VERSION} loaded`)
|
|
1579
|
+
log(`dsh-unlag ${VERSION} loaded (code ${CODE_STAMP})`)
|
|
1562
1580
|
log('plugin reload is manual: ask the user to press the refresh button; do not restart the app')
|
|
1563
1581
|
if (settingsOf(config ?? {}).autoReload === true) {
|
|
1564
1582
|
syncWatching()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-unlag",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.12",
|
|
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",
|