dsh-unlag 1.9.100 → 1.9.102

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 (2) hide show
  1. package/index.js +22 -7
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -2051,14 +2051,23 @@ export function apply(ctx, config) {
2051
2051
  * root is installed and no saved file applies anything by itself.
2052
2052
  */
2053
2053
  const syncWatching = () => {
2054
- if (settingsOf(config ?? {}).autoReload !== true) return
2055
- if (controller.available() === false) {
2054
+ // Automatic reloading is an extra, and the press is the feature: anything that goes wrong
2055
+ // while setting a watch up is said in one line and left off, never turned into a plugin that
2056
+ // did not load.
2057
+ try {
2058
+ if (settingsOf(config ?? {}).autoReload !== true) return
2059
+ if (controller.available() === false) {
2060
+ closeAll(globalThis[WATCHER_KEY])
2061
+ globalThis[WATCHER_KEY] = null
2062
+ return
2063
+ }
2064
+ if (globalThis[WATCHER_KEY] !== null) return
2065
+ globalThis[WATCHER_KEY] = controller.startWatching()
2066
+ } catch (error) {
2056
2067
  closeAll(globalThis[WATCHER_KEY])
2057
2068
  globalThis[WATCHER_KEY] = null
2058
- return
2069
+ log(`cannot watch for saved plugin changes: ${error?.message ?? error}; a press still works`)
2059
2070
  }
2060
- if (globalThis[WATCHER_KEY] !== null) return
2061
- globalThis[WATCHER_KEY] = controller.startWatching()
2062
2071
  }
2063
2072
  // Printed on every start so a reader of the log knows which action applies a change: a person
2064
2073
  // pressing the button, never this plugin, and never a restart of the app.
@@ -2073,8 +2082,14 @@ export function apply(ctx, config) {
2073
2082
  }
2074
2083
  if (typeof ctx.on === 'function') {
2075
2084
  ctx.on('internal/service', (service) => {
2076
- if (service === 'hmr') syncWatching()
2077
- if (service === 'clientModules') syncBundles()
2085
+ // A service event is dispatched by the app itself; an exception here would travel back into
2086
+ // whatever asked, so each answer is kept to its own line.
2087
+ try {
2088
+ if (service === 'hmr') syncWatching()
2089
+ if (service === 'clientModules') syncBundles()
2090
+ } catch (error) {
2091
+ log(`cannot follow the ${oneLine(service, 40)} service: ${error?.message ?? error}`)
2092
+ }
2078
2093
  })
2079
2094
  }
2080
2095
  globalThis[ROUTES_KEY] = serveButton(ctx, controller, config ?? {})
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-unlag",
3
- "version": "1.9.100",
3
+ "version": "1.9.102",
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",