@lark-apaas/client-toolkit 1.2.8 → 1.2.9-alpha.0
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import z from 'zod';
|
|
2
2
|
export declare const networkRequestLogSchema: z.ZodObject<{
|
|
3
3
|
method: z.ZodString;
|
|
4
|
-
status: z.
|
|
4
|
+
status: z.ZodNumber;
|
|
5
5
|
statusText: z.ZodString;
|
|
6
6
|
path: z.ZodString;
|
|
7
7
|
requestData: z.ZodOptional<z.ZodUnknown>;
|
|
@@ -27,11 +27,11 @@ export declare const logStackFrameSchema: z.ZodObject<{
|
|
|
27
27
|
columnNumber: z.ZodNumber;
|
|
28
28
|
}, z.core.$strip>;
|
|
29
29
|
export declare const levelSchema: z.ZodEnum<{
|
|
30
|
+
error: "error";
|
|
30
31
|
success: "success";
|
|
31
32
|
debug: "debug";
|
|
32
33
|
info: "info";
|
|
33
34
|
warn: "warn";
|
|
34
|
-
error: "error";
|
|
35
35
|
}>;
|
|
36
36
|
export declare const logMeta: z.ZodObject<{
|
|
37
37
|
stacktrace: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -52,11 +52,11 @@ export declare const logMeta: z.ZodObject<{
|
|
|
52
52
|
export declare const selectedLogSchema: z.ZodObject<{
|
|
53
53
|
type: z.ZodLiteral<"typedLogV2">;
|
|
54
54
|
level: z.ZodEnum<{
|
|
55
|
+
error: "error";
|
|
55
56
|
success: "success";
|
|
56
57
|
debug: "debug";
|
|
57
58
|
info: "info";
|
|
58
59
|
warn: "warn";
|
|
59
|
-
error: "error";
|
|
60
60
|
}>;
|
|
61
61
|
id: z.ZodString;
|
|
62
62
|
args: z.ZodArray<z.ZodUnknown>;
|
|
@@ -80,11 +80,11 @@ export declare const selectedLogSchema: z.ZodObject<{
|
|
|
80
80
|
export type LogLevel = z.infer<typeof levelSchema>;
|
|
81
81
|
export declare const logWithMetaSchema: z.ZodObject<{
|
|
82
82
|
level: z.ZodEnum<{
|
|
83
|
+
error: "error";
|
|
83
84
|
success: "success";
|
|
84
85
|
debug: "debug";
|
|
85
86
|
info: "info";
|
|
86
87
|
warn: "warn";
|
|
87
|
-
error: "error";
|
|
88
88
|
}>;
|
|
89
89
|
args: z.ZodArray<z.ZodUnknown>;
|
|
90
90
|
meta: z.ZodOptional<z.ZodObject<{
|
package/lib/logger/log-types.js
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
* - abort: An update was aborted, but the system is still in its previous state
|
|
11
11
|
* - fail: An update has thrown an exception and the system's state has been compromised
|
|
12
12
|
*/
|
|
13
|
-
type ModuleHotType = 'idle' | 'check' | 'prepare' | 'ready' | 'dispose' | 'apply' | 'abort' | 'fail';
|
|
14
|
-
interface ModuleHotInstance {
|
|
13
|
+
export type ModuleHotType = 'idle' | 'check' | 'prepare' | 'ready' | 'dispose' | 'apply' | 'abort' | 'fail';
|
|
14
|
+
export interface ModuleHotInstance {
|
|
15
15
|
addStatusHandler: (handler: (status: ModuleHotType) => void) => void;
|
|
16
16
|
removeStatusHandler: (handler: (status: ModuleHotType) => void) => void;
|
|
17
17
|
}
|
|
@@ -22,4 +22,3 @@ export declare function getModuleHot(): ModuleHotInstance | null;
|
|
|
22
22
|
* @param callback 热更成功回调函数,参数为是否成功
|
|
23
23
|
*/
|
|
24
24
|
export declare function createApplyHandle(callback: (success: boolean, status: ModuleHotType) => void): (status: ModuleHotType) => void;
|
|
25
|
-
export {};
|
package/lib/utils/module-hot.js
CHANGED
|
@@ -1,6 +1,50 @@
|
|
|
1
|
+
function createViteHmrAdapter(viteHot) {
|
|
2
|
+
const handlers = new Set();
|
|
3
|
+
const notifyHandlers = (status)=>{
|
|
4
|
+
handlers.forEach((handler)=>{
|
|
5
|
+
try {
|
|
6
|
+
handler(status);
|
|
7
|
+
} catch (e) {
|
|
8
|
+
console.error('[HMR] Status handler error:', e);
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
const beforeUpdateHandler = ()=>{
|
|
13
|
+
notifyHandlers('prepare');
|
|
14
|
+
setTimeout(()=>notifyHandlers('apply'), 0);
|
|
15
|
+
};
|
|
16
|
+
const afterUpdateHandler = ()=>{
|
|
17
|
+
notifyHandlers('idle');
|
|
18
|
+
};
|
|
19
|
+
const errorHandler = ()=>{
|
|
20
|
+
notifyHandlers('fail');
|
|
21
|
+
};
|
|
22
|
+
const beforeFullReloadHandler = ()=>{
|
|
23
|
+
notifyHandlers('check');
|
|
24
|
+
};
|
|
25
|
+
viteHot.on('vite:beforeUpdate', beforeUpdateHandler);
|
|
26
|
+
viteHot.on('vite:afterUpdate', afterUpdateHandler);
|
|
27
|
+
viteHot.on('vite:error', errorHandler);
|
|
28
|
+
viteHot.on('vite:beforeFullReload', beforeFullReloadHandler);
|
|
29
|
+
return {
|
|
30
|
+
addStatusHandler (handler) {
|
|
31
|
+
handlers.add(handler);
|
|
32
|
+
},
|
|
33
|
+
removeStatusHandler (handler) {
|
|
34
|
+
handlers.delete(handler);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
let viteAdapterInstance = null;
|
|
1
39
|
function getModuleHot() {
|
|
2
40
|
if ('production' === process.env.NODE_ENV) return null;
|
|
3
|
-
|
|
41
|
+
if (import.meta.hot) {
|
|
42
|
+
if (!viteAdapterInstance) viteAdapterInstance = createViteHmrAdapter(import.meta.hot);
|
|
43
|
+
return viteAdapterInstance;
|
|
44
|
+
}
|
|
45
|
+
if (import.meta.webpackHot) return import.meta.webpackHot;
|
|
46
|
+
'undefined' != typeof module && module.hot;
|
|
47
|
+
return null;
|
|
4
48
|
}
|
|
5
49
|
function createApplyHandle(callback) {
|
|
6
50
|
let hasApply = false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-apaas/client-toolkit",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.9-alpha.0",
|
|
4
4
|
"types": "./lib/index.d.ts",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"files": [
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"@data-loom/js": "^0.4.3",
|
|
97
97
|
"@lark-apaas/auth-sdk": "^0.1.0",
|
|
98
98
|
"@lark-apaas/client-capability": "^0.1.2",
|
|
99
|
-
"@lark-apaas/miaoda-inspector": "^1.0.
|
|
99
|
+
"@lark-apaas/miaoda-inspector": "^1.0.14-alpha.0",
|
|
100
100
|
"@lark-apaas/observable-web": "^1.0.1",
|
|
101
101
|
"@radix-ui/react-avatar": "^1.1.10",
|
|
102
102
|
"@radix-ui/react-popover": "^1.1.15",
|