@lark-apaas/client-toolkit 1.2.68 → 1.2.69-alpha.20260831083245
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.
|
@@ -7,8 +7,11 @@ let devServerDisconnectInfo = null;
|
|
|
7
7
|
let retryCount = 0;
|
|
8
8
|
function processDevServerLog(log) {
|
|
9
9
|
if (!log) return;
|
|
10
|
-
const devFlag = log.includes('[webpack-dev-server]');
|
|
11
|
-
|
|
10
|
+
const devFlag = log.includes('[webpack-dev-server]') || log.includes('[vite]');
|
|
11
|
+
const viteConnectFailed = log.includes('WebSocket closed without opened');
|
|
12
|
+
const viteConnectionLost = log.includes('server connection lost');
|
|
13
|
+
if (devFlag && (log.includes('Disconnected') || viteConnectFailed || viteConnectionLost)) {
|
|
14
|
+
if (devServerDisconnectInfo) return;
|
|
12
15
|
const time = Date.now();
|
|
13
16
|
devServerDisconnectInfo = {
|
|
14
17
|
time
|
|
@@ -26,11 +29,17 @@ function processDevServerLog(log) {
|
|
|
26
29
|
time
|
|
27
30
|
},
|
|
28
31
|
categories: {
|
|
29
|
-
type: 'disconnected'
|
|
32
|
+
type: 'disconnected',
|
|
33
|
+
...viteConnectFailed ? {
|
|
34
|
+
reason: 'connect-failed'
|
|
35
|
+
} : viteConnectionLost ? {
|
|
36
|
+
reason: 'connection-lost'
|
|
37
|
+
} : {}
|
|
30
38
|
}
|
|
31
39
|
});
|
|
32
40
|
return;
|
|
33
41
|
}
|
|
42
|
+
const viteConnected = log.includes('[vite] connected.');
|
|
34
43
|
if (!devServerDisconnectInfo) return;
|
|
35
44
|
if (devFlag && log.includes('Trying to reconnect')) {
|
|
36
45
|
if (retryCount) slardar.sendEvent({
|
|
@@ -46,7 +55,7 @@ function processDevServerLog(log) {
|
|
|
46
55
|
return;
|
|
47
56
|
}
|
|
48
57
|
const hmrFlag = log.includes('[HMR]');
|
|
49
|
-
if (hmrFlag || devFlag && (log.includes('Socket connected') || log.includes('App updated') || log.includes('App hot update'))) {
|
|
58
|
+
if (hmrFlag || devFlag && (log.includes('Socket connected') || log.includes('App updated') || log.includes('App hot update') || viteConnected)) {
|
|
50
59
|
submitPostMessage({
|
|
51
60
|
type: 'DevServerMessage',
|
|
52
61
|
data: {
|
|
@@ -64,7 +73,10 @@ function processDevServerLog(log) {
|
|
|
64
73
|
duration
|
|
65
74
|
},
|
|
66
75
|
categories: {
|
|
67
|
-
type: 'devServer-reconnected'
|
|
76
|
+
type: 'devServer-reconnected',
|
|
77
|
+
...viteConnected ? {
|
|
78
|
+
reason: 'connected'
|
|
79
|
+
} : {}
|
|
68
80
|
}
|
|
69
81
|
});
|
|
70
82
|
}
|
|
@@ -113,7 +125,7 @@ function interceptErrors() {
|
|
|
113
125
|
originalMethod(...args);
|
|
114
126
|
const level = 'log' === method ? 'info' : method;
|
|
115
127
|
const log = args[0];
|
|
116
|
-
if ('string' == typeof log) processDevServerLog(
|
|
128
|
+
if ('string' == typeof log) processDevServerLog(args.map((a)=>'string' == typeof a ? a : a instanceof Error ? a.message : '').join(' '));
|
|
117
129
|
if ('string' == typeof log && log.startsWith('[Dataloom]') && levelSchema.safeParse(level).success) {
|
|
118
130
|
logger.log({
|
|
119
131
|
level: level,
|