dsh-unlag 1.9.56 → 1.9.57
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 +22 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -200,15 +200,34 @@ export const Config = {
|
|
|
200
200
|
},
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
+
/** Switches already reported, so a settings form read repeatedly writes one line, not many. */
|
|
204
|
+
const STRANGE_SWITCHES = new Set()
|
|
205
|
+
/**
|
|
206
|
+
* One switch. Absent means the default; a boolean means itself; anything else — a hand-edited
|
|
207
|
+
* string, a number, a list — is not a yes and is read as off, with one line saying so. A row that
|
|
208
|
+
* says "off" must not swap plugin code because the value happened to be the word "no".
|
|
209
|
+
*/
|
|
210
|
+
function booleanSwitch(config, key, fallback) {
|
|
211
|
+
const value = config?.[key]
|
|
212
|
+
if (value === undefined || value === null) return fallback
|
|
213
|
+
if (typeof value === 'boolean') return value
|
|
214
|
+
const seen = `${key}=${oneLine(value, 40)}`
|
|
215
|
+
if (!STRANGE_SWITCHES.has(seen) && STRANGE_SWITCHES.size < 32) {
|
|
216
|
+
STRANGE_SWITCHES.add(seen)
|
|
217
|
+
log(`a switch that is not a boolean was read as off: ${seen}`)
|
|
218
|
+
}
|
|
219
|
+
return false
|
|
220
|
+
}
|
|
221
|
+
|
|
203
222
|
/**
|
|
204
223
|
* The three switches from any config shape. The press switches default on; automatic reloading
|
|
205
224
|
* defaults off, and the undocumented `plugins: 'off'` from older configs keeps meaning off.
|
|
206
225
|
*/
|
|
207
226
|
function settingsOf(config) {
|
|
208
227
|
return {
|
|
209
|
-
reloadPlugins: config
|
|
210
|
-
reloadInterface: config
|
|
211
|
-
autoReload: config?.plugins === 'off' ? false : config
|
|
228
|
+
reloadPlugins: booleanSwitch(config, 'reloadPlugins', true),
|
|
229
|
+
reloadInterface: booleanSwitch(config, 'reloadInterface', true),
|
|
230
|
+
autoReload: config?.plugins === 'off' ? false : booleanSwitch(config, 'autoReload', false),
|
|
212
231
|
}
|
|
213
232
|
}
|
|
214
233
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-unlag",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.57",
|
|
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",
|