dsh-unlag 1.9.32 → 1.9.34
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/README.md +1 -0
- package/client.js +9 -6
- package/index.js +11 -18
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -43,6 +43,7 @@ dsh plugin install dsh-unlag
|
|
|
43
43
|
- 界面重建会重新进入同一个地址:屏幕上正在显示的内容重新载入一次,会话记录还在。
|
|
44
44
|
- 排队消息、输入草稿、附件:重建前先提交焦点里的内容;有人没存完就拦下,不硬刷。
|
|
45
45
|
- 有未保存改动、开着弹窗、或下个页面要用的模块读不全:拦下并提示,提示里写明卡在哪一项,宁可不刷。
|
|
46
|
+
- 原来就起不来的插件不挡这一下:换代码照做,日志里点名哪个插件本来就没在跑。
|
|
46
47
|
- 旧页面记着的启动清单分组变了(装过/卸过插件):按插件逐个补齐再交给新页面,不会因为清单 404 把 App 带走。
|
|
47
48
|
- 从不自己重启或退出 App。
|
|
48
49
|
|
package/client.js
CHANGED
|
@@ -6,8 +6,8 @@ window.__ModuleLoader__.load({
|
|
|
6
6
|
|
|
7
7
|
const zh = /^zh/i.test(navigator.language || '');
|
|
8
8
|
const COPY = zh
|
|
9
|
-
? { label: '解除卡顿', hint: '卡顿时用:换掉插件代码并重建界面;运行中的任务、排队的消息保留', blocked: '暂时无法重建界面,稍后再试', unsaved: '有未保存的改动,先保存再重试', dialog: '先关闭打开的窗口再重载', queued: '更新已排队,稍后再按一次', applying: '还在应用这次更新,稍后再按一次', off: '两个开关都关着,先在设置里打开一个', replaced: '插件代码已更新,页面保持不动', done: '插件代码已是最新', restart: '这次改动要重新打开应用才会生效', failed: '插件更新没完成,稍后再按一次' } // ui-copy-ignore
|
|
10
|
-
: { label: 'Unlag', hint: 'For a sluggish interface: replaces plugin code and rebuilds the page; running turns and queued messages are kept', blocked: 'Cannot rebuild the page right now; try again', unsaved: 'Unsaved changes; save them, then retry', dialog: 'Close the open window first', queued: 'Update queued; press again shortly', applying: 'Still applying this update; press again shortly', off: 'Both switches are off; turn one on in settings', replaced: 'Plugin code updated; the page stayed as it is', done: 'Plugin code is already up to date', restart: 'This change needs the app reopened before it can apply', failed: 'The plugin update did not finish; press again later' };
|
|
9
|
+
? { label: '解除卡顿', hint: '卡顿时用:换掉插件代码并重建界面;运行中的任务、排队的消息保留', blocked: '暂时无法重建界面,稍后再试', unsaved: '有未保存的改动,先保存再重试', dialog: '先关闭打开的窗口再重载', queued: '更新已排队,稍后再按一次', applying: '还在应用这次更新,稍后再按一次', off: '两个开关都关着,先在设置里打开一个', replaced: '插件代码已更新,页面保持不动', stayedReplaced: '插件代码已更新,页面没有重建;稍后再按一次', stayed: '页面没有重建;稍后再按一次', done: '插件代码已是最新', restart: '这次改动要重新打开应用才会生效', failed: '插件更新没完成,稍后再按一次' } // ui-copy-ignore
|
|
10
|
+
: { label: 'Unlag', hint: 'For a sluggish interface: replaces plugin code and rebuilds the page; running turns and queued messages are kept', blocked: 'Cannot rebuild the page right now; try again', unsaved: 'Unsaved changes; save them, then retry', dialog: 'Close the open window first', queued: 'Update queued; press again shortly', applying: 'Still applying this update; press again shortly', off: 'Both switches are off; turn one on in settings', replaced: 'Plugin code updated; the page stayed as it is', stayedReplaced: 'Plugin code updated; the page did not rebuild; press again shortly', stayed: 'The page did not rebuild; press again shortly', done: 'Plugin code is already up to date', restart: 'This change needs the app reopened before it can apply', failed: 'The plugin update did not finish; press again later' };
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Why the interface was left as it is, in words a person can act on. The checks below record
|
|
@@ -173,9 +173,9 @@ window.__ModuleLoader__.load({
|
|
|
173
173
|
function reloadVerdict(data) {
|
|
174
174
|
if (data === null || typeof data !== 'object') return 'failed';
|
|
175
175
|
const status = typeof data.status === 'string' ? data.status : 'failed';
|
|
176
|
-
// A plugin that did not start makes the set unusable for a rebuild, whatever the status says.
|
|
177
|
-
if (Array.isArray(data.failedEntries) && data.failedEntries.length > 0) return 'failed';
|
|
178
176
|
// `pending` is not a queued update: the changed modules need a restart to load at all.
|
|
177
|
+
// Entries that were already not running before the press are not its result: the app rejects
|
|
178
|
+
// a reload that newly breaks one, so the press stands whatever that leftover list says.
|
|
179
179
|
if (Array.isArray(data.pending) && data.pending.length > 0) return 'restart';
|
|
180
180
|
if (typeof data.restartReason === 'string' && data.restartReason !== '') return 'failed';
|
|
181
181
|
return status;
|
|
@@ -642,6 +642,8 @@ window.__ModuleLoader__.load({
|
|
|
642
642
|
setPending(true);
|
|
643
643
|
setNotice(null);
|
|
644
644
|
let navigated = false;
|
|
645
|
+
// Read by the fallback below, which runs after the try block's own scope is gone.
|
|
646
|
+
let replaced = false;
|
|
645
647
|
const stop = (key, applied = false) => {
|
|
646
648
|
setPending(false);
|
|
647
649
|
setNotice(noticeFor(key, applied));
|
|
@@ -650,7 +652,6 @@ window.__ModuleLoader__.load({
|
|
|
650
652
|
const settings = await readSettings();
|
|
651
653
|
const replace = settings === null ? false : settings.plugins;
|
|
652
654
|
const rebuild = settings === null ? true : settings.page;
|
|
653
|
-
let replaced = false;
|
|
654
655
|
// Nothing is switched on: the press says so instead of looking broken.
|
|
655
656
|
if (!replace && !rebuild) {
|
|
656
657
|
report('off');
|
|
@@ -726,7 +727,9 @@ window.__ModuleLoader__.load({
|
|
|
726
727
|
// happened and take the press back, so the button is never left unresponsive.
|
|
727
728
|
report('held', 'navigation');
|
|
728
729
|
setPending(false);
|
|
729
|
-
|
|
730
|
+
// Only a press that really replaced the plugins may say so: a page-only press that
|
|
731
|
+
// held the navigation changed no code.
|
|
732
|
+
setNotice(replaced ? COPY.stayedReplaced : COPY.stayed);
|
|
730
733
|
}, 6000); // ui-copy-ignore
|
|
731
734
|
}
|
|
732
735
|
}
|
package/index.js
CHANGED
|
@@ -401,17 +401,19 @@ function pluginReloader(ctx, config) {
|
|
|
401
401
|
* out of harmless prose. The warning itself is the app saying an entry is not serving the page, so
|
|
402
402
|
* every warning counts and the sentence is passed on as it reads.
|
|
403
403
|
*/
|
|
404
|
-
const failedEntries = warnings.map((warning) => (typeof warning === 'string' ? warning : String(warning?.message ?? warning)))
|
|
405
|
-
log(
|
|
406
|
-
`plugins reloaded (warnings=${warnings.length} pending=${pending.length}${restartReason === null ? '' : ` restart=${restartReason}`})`,
|
|
407
|
-
)
|
|
408
404
|
/**
|
|
409
|
-
*
|
|
410
|
-
*
|
|
405
|
+
* These are the entries that were already not running before this press: the app rejects a
|
|
406
|
+
* reload that newly breaks an entry, so nothing in this list is a result of the press. They are
|
|
407
|
+
* written down because a person sees them afterwards, and they must not stop the page from
|
|
408
|
+
* coming up on the set that is running now.
|
|
411
409
|
*/
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
410
|
+
const inactiveEntries = warnings.map((warning) => (typeof warning === 'string' ? warning : String(warning?.message ?? warning)))
|
|
411
|
+
log(
|
|
412
|
+
`plugins reloaded (inactive before this press=${inactiveEntries.length} pending=${pending.length}${restartReason === null ? '' : ` restart=${restartReason}`})`,
|
|
413
|
+
)
|
|
414
|
+
for (const entry of inactiveEntries.slice(0, 5)) log(`a plugin was already not running and still is not: ${entry.slice(0, 200)}`)
|
|
415
|
+
if (inactiveEntries.length > 5) log(`and ${inactiveEntries.length - 5} more were already not running`)
|
|
416
|
+
return { status: 'done', warnings, pending, restartReason, inactiveEntries, failedEntries: [] }
|
|
415
417
|
}
|
|
416
418
|
|
|
417
419
|
const flush = async () => {
|
|
@@ -584,15 +586,6 @@ function pluginReloader(ctx, config) {
|
|
|
584
586
|
failedEntries: outcome.failedEntries,
|
|
585
587
|
}
|
|
586
588
|
}
|
|
587
|
-
if (outcome.failedEntries.length > 0) {
|
|
588
|
-
return {
|
|
589
|
-
status: 'failed', // ui-copy-ignore
|
|
590
|
-
warnings: outcome.warnings, // ui-copy-ignore
|
|
591
|
-
pending: [], // ui-copy-ignore
|
|
592
|
-
restartReason: null,
|
|
593
|
-
failedEntries: outcome.failedEntries,
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
589
|
return outcome
|
|
597
590
|
} catch (error) {
|
|
598
591
|
if (error?.stillRunning === true) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-unlag",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.34",
|
|
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",
|