@lark-apaas/coding-html-devserver 0.1.9 → 0.1.10-alpha.20260831042635
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.
|
@@ -31,6 +31,14 @@ const DISCONNECT_RECOVERY_PATTERN = /url\.search = "";\r?\n(\s*)await waitForSuc
|
|
|
31
31
|
* 本包没有其它 preset 的 patch 3,此处仍编号 patch 4 以便跨包对齐。
|
|
32
32
|
*/
|
|
33
33
|
const PING_INTERVAL_LEAK_PATTERN = /pingIntervalId = setInterval\(\(\) => \{\s*if \(socket\.readyState === socket\.OPEN\) socket\.send\(JSON\.stringify\(\{ type: "ping" \}\)\);\s*\}, pingInterval\);/;
|
|
34
|
+
/**
|
|
35
|
+
* 匹配 @vite/client 里的连接成功日志:
|
|
36
|
+
* console.debug(`[vite] connected.`);
|
|
37
|
+
* 换成 console.log,让 client-toolkit / client-toolkit-lite 的 console 劫持
|
|
38
|
+
* (只覆盖 log/info/warn/error)能收到,据此清空断连状态并上报 devServer-reconnected。
|
|
39
|
+
* 已实测 Vite 7.3.x / 8.x 文本一致(fullstack 模板 vite ^7.3.1,vite-react 模板 vite ^8)。
|
|
40
|
+
*/
|
|
41
|
+
const CONNECTED_LOG_PATTERN = /console\.debug\((`\[vite\] connected\.`)\)/;
|
|
34
42
|
function viteClientPatchPlugin() {
|
|
35
43
|
return {
|
|
36
44
|
name: 'miaoda-html-vite-client-patch',
|
|
@@ -78,6 +86,15 @@ function viteClientPatchPlugin() {
|
|
|
78
86
|
console.warn('[miaoda-html-vite-client-patch] ping-interval pattern not found in @vite/client; ' +
|
|
79
87
|
'stale heartbeat timers will leak on reconnect — Vite client.mjs may have changed.');
|
|
80
88
|
}
|
|
89
|
+
// patch 5: 连接成功日志 debug → log,让 client-toolkit 的 console 劫持能收到
|
|
90
|
+
if (CONNECTED_LOG_PATTERN.test(patched)) {
|
|
91
|
+
patched = patched.replace(CONNECTED_LOG_PATTERN, 'console.log($1)');
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
console.warn('[miaoda-html-vite-client-patch] connected-log pattern not found in @vite/client; ' +
|
|
95
|
+
'devServer-reconnected NOT reportable and disconnect dedup will latch — ' +
|
|
96
|
+
'Vite client.mjs may have changed.');
|
|
97
|
+
}
|
|
81
98
|
return patched === code ? undefined : { code: patched };
|
|
82
99
|
},
|
|
83
100
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-apaas/coding-html-devserver",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10-alpha.20260831042635",
|
|
4
4
|
"description": "Dev/build toolchain for the miaoda-coding html (pure HTML) stack. Wraps vite (dev + HMR) behind a bin so the template never sees vite; build is pure-copy + platform-script injection + optional minify.",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|