ms-vite-plugin 1.4.20 → 1.4.21

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.
@@ -12,57 +12,53 @@
12
12
 
13
13
  ## API 参考
14
14
 
15
- ### 配置读取
16
-
17
- #### get - 读取配置项的值。
15
+ ### all - 获取所有配置的 JSON 格式数据。
18
16
 
19
17
  ```typescript
20
- function get(key: string): any | null;
18
+ function all(): Record<string, any>;
21
19
  ```
22
20
 
23
- **参数:**
24
-
25
- | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
26
- | ------ | ------ | -------- | ------ | -------- |
27
- | `key` | string | 是 | - | 配置键名 |
28
-
29
21
  **返回值:**
30
22
 
31
- | 类型 | 描述 |
32
- | ------------- | ------ |
33
- | `any \| null` | 配置值 |
23
+ | 类型 | 描述 |
24
+ | --------------------- | ------------------ |
25
+ | `Record<string, any>` | 包含所有配置的对象 |
34
26
 
35
27
  **示例:**
36
28
 
37
29
  ```javascript
38
- const maxRetries = config.get("maxRetries");
39
- if (maxRetries !== null) {
40
- logi(`最大重试次数: ${maxRetries}`);
41
- }
30
+ const allConfigs = config.all();
31
+ logi(`所有配置: ${JSON.stringify(allConfigs, null, 2)}`);
42
32
  ```
43
33
 
44
- ### 配置管理
45
-
46
- #### all - 获取所有配置的 JSON 格式数据。
34
+ ### setAll - 设置所有配置项。
47
35
 
48
36
  ```typescript
49
- function all(): Record<string, any>;
37
+ function setAll(config: Record<string, any>): boolean;
50
38
  ```
51
39
 
40
+ **参数:**
41
+
42
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
43
+ | -------- | --------------------- | -------- | ------ | ---------------- |
44
+ | `config` | `Record<string, any>` | 是 | - | 完整配置对象 |
45
+
52
46
  **返回值:**
53
47
 
54
- | 类型 | 描述 |
55
- | --------------------- | ------------------ |
56
- | `Record<string, any>` | 包含所有配置的对象 |
48
+ | 类型 | 描述 |
49
+ | --------- | ------------ |
50
+ | `boolean` | 设置是否成功 |
57
51
 
58
52
  **示例:**
59
53
 
60
54
  ```javascript
61
- const allConfigs = config.all();
62
- logi(`所有配置: ${JSON.stringify(allConfigs, null, 2)}`);
55
+ const success = config.setAll({ maxRetries: 5, debugEnabled: true });
56
+ if (success) {
57
+ logi("所有配置已更新");
58
+ }
63
59
  ```
64
60
 
65
- #### set - 更新或设置配置项的值。
61
+ ### set - 更新或设置配置项的值。
66
62
 
67
63
  ```typescript
68
64
  function set(key: string, value: any): boolean;
@@ -94,7 +90,53 @@ if (success1 && success2 && success3) {
94
90
  }
95
91
  ```
96
92
 
97
- #### remove - 删除指定的配置项。
93
+ ### get - 读取配置项的值。
94
+
95
+ ```typescript
96
+ function get(key: string): any | null;
97
+ ```
98
+
99
+ **参数:**
100
+
101
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
102
+ | ------ | ------ | -------- | ------ | -------- |
103
+ | `key` | string | 是 | - | 配置键名 |
104
+
105
+ **返回值:**
106
+
107
+ | 类型 | 描述 |
108
+ | ------------- | ------ |
109
+ | `any \| null` | 配置值 |
110
+
111
+ **示例:**
112
+
113
+ ```javascript
114
+ const maxRetries = config.get("maxRetries");
115
+ if (maxRetries !== null) {
116
+ logi(`最大重试次数: ${maxRetries}`);
117
+ }
118
+ ```
119
+
120
+ ### getKuiConfig - 获取 KUI 的配置。
121
+
122
+ ```typescript
123
+ function getKuiConfig(): Record<string, any>;
124
+ ```
125
+
126
+ **返回值:**
127
+
128
+ | 类型 | 描述 |
129
+ | --------------------- | -------------------------------------------------------- |
130
+ | `Record<string, any>` | `KUI_CONFIG` 对应的对象,配置不存在或无法转换时返回空对象 |
131
+
132
+ **示例:**
133
+
134
+ ```javascript
135
+ const kuiConfig = config.getKuiConfig();
136
+ logi(`KUI 配置: ${JSON.stringify(kuiConfig, null, 2)}`);
137
+ ```
138
+
139
+ ### remove - 删除指定的配置项。
98
140
 
99
141
  ```typescript
100
142
  function remove(key: string): boolean;
@@ -12,55 +12,53 @@
12
12
 
13
13
  ## API 参考
14
14
 
15
- ### 配置读取
16
-
17
- #### 获取
15
+ ### 所有配置
18
16
 
19
17
  ```typescript
20
- function 获取(配置键: 字符串): 任意类型 | null;
18
+ function 所有配置(): 字典<任意类型>;
21
19
  ```
22
20
 
23
- **参数:**
24
-
25
- | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
26
- | -------- | ------ | -------- | ------ | -------- |
27
- | `配置键` | 字符串 | 是 | - | 配置键名 |
28
-
29
21
  **返回值:**
30
22
 
31
- | 类型 | 描述 |
32
- | ------------------ | ------ |
33
- | `任意类型 \| null` | 配置值 |
23
+ | 类型 | 描述 |
24
+ | ---------------- | ------------------ |
25
+ | `字典<任意类型>` | 包含所有配置的对象 |
34
26
 
35
27
  **示例:**
36
28
 
37
29
  ```javascript
38
- const maxRetries = $配置.获取("maxRetries");
39
- $打印信息日志(`最大重试次数: ${maxRetries}`);
30
+ const allConfigs = $配置.所有配置();
31
+ $打印信息日志(`所有配置: ${JSON.stringify(allConfigs, null, 2)}`);
40
32
  ```
41
33
 
42
- ### 配置管理
43
-
44
- #### 所有配置
34
+ ### 设置所有
45
35
 
46
36
  ```typescript
47
- function 所有配置(): 字典<任意类型>;
37
+ function 设置所有(config: 字典<任意类型>): 布尔值;
48
38
  ```
49
39
 
40
+ **参数:**
41
+
42
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
43
+ | -------- | ---------------- | -------- | ------ | ------------ |
44
+ | `config` | 字典<任意类型> | 是 | - | 完整配置对象 |
45
+
50
46
  **返回值:**
51
47
 
52
- | 类型 | 描述 |
53
- | ---------------- | ------------------ |
54
- | `字典<任意类型>` | 包含所有配置的对象 |
48
+ | 类型 | 描述 |
49
+ | -------- | ------------ |
50
+ | `布尔值` | 设置是否成功 |
55
51
 
56
52
  **示例:**
57
53
 
58
54
  ```javascript
59
- const allConfigs = $配置.所有配置();
60
- $打印信息日志(`所有配置: ${JSON.stringify(allConfigs, null, 2)}`);
55
+ const 是否设置成功 = $配置.设置所有({ maxRetries: 5, debugEnabled: true });
56
+ if (是否设置成功) {
57
+ $打印信息日志("所有配置已更新");
58
+ }
61
59
  ```
62
60
 
63
- #### 设置
61
+ ### 设置
64
62
 
65
63
  ```typescript
66
64
  function 设置(配置键: 字符串, 配置值: 任意类型): 布尔值;
@@ -92,7 +90,51 @@ if (是否更新成功1 && 是否更新成功2 && 是否更新成功3) {
92
90
  }
93
91
  ```
94
92
 
95
- #### 删除
93
+ ### 获取
94
+
95
+ ```typescript
96
+ function 获取(配置键: 字符串): 任意类型 | null;
97
+ ```
98
+
99
+ **参数:**
100
+
101
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
102
+ | -------- | ------ | -------- | ------ | -------- |
103
+ | `配置键` | 字符串 | 是 | - | 配置键名 |
104
+
105
+ **返回值:**
106
+
107
+ | 类型 | 描述 |
108
+ | ------------------ | ------ |
109
+ | `任意类型 \| null` | 配置值 |
110
+
111
+ **示例:**
112
+
113
+ ```javascript
114
+ const maxRetries = $配置.获取("maxRetries");
115
+ $打印信息日志(`最大重试次数: ${maxRetries}`);
116
+ ```
117
+
118
+ ### 获取KUI配置 - 获取 KUI 的配置。
119
+
120
+ ```typescript
121
+ function 获取KUI配置(): 字典<任意类型>;
122
+ ```
123
+
124
+ **返回值:**
125
+
126
+ | 类型 | 描述 |
127
+ | ---------------- | -------------------------------------------------------- |
128
+ | `字典<任意类型>` | `KUI_CONFIG` 对应的对象,配置不存在或无法转换时返回空对象 |
129
+
130
+ **示例:**
131
+
132
+ ```javascript
133
+ const kuiConfig = $配置.获取KUI配置();
134
+ $打印信息日志(`KUI 配置: ${JSON.stringify(kuiConfig, null, 2)}`);
135
+ ```
136
+
137
+ ### 删除
96
138
 
97
139
  ```typescript
98
140
  function 删除(配置键: 字符串): 布尔值;
@@ -12,61 +12,57 @@
12
12
 
13
13
  ## API 参考
14
14
 
15
- ### 配置读取
16
-
17
- #### get - 读取配置项的值。
15
+ ### all - 获取所有配置的 JSON 格式数据。
18
16
 
19
17
  ```python
20
- from typing import Any, Optional, Dict
18
+ from typing import Any, Dict
21
19
 
22
- def get(key: str) -> Any | None:
20
+ def all() -> Dict[str, Any]:
23
21
  ```
24
22
 
25
- **参数:**
26
-
27
- | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
28
- | ------ | ------ | -------- | ------ | -------- |
29
- | `key` | string | 是 | - | 配置键名 |
30
-
31
23
  **返回值:**
32
24
 
33
- | 类型 | 描述 |
34
- | ------------- | ------ |
35
- | `Any \| None` | 配置值 |
25
+ | 类型 | 描述 |
26
+ | ---------------- | ------------------ |
27
+ | `Dict[str, Any]` | 包含所有配置的对象 |
36
28
 
37
29
  **示例:**
38
30
 
39
31
  ```python
40
32
  from kuaijs import config
41
- maxRetries = config.get("maxRetries")
42
- if maxRetries:
43
- print(f"最大重试次数: {maxRetries}")
33
+ import json
34
+ allConfigs = config.all()
35
+ print(f"所有配置: {json.dumps(allConfigs, indent=2)}")
44
36
  ```
45
37
 
46
- ### 配置管理
47
-
48
- #### all - 获取所有配置的 JSON 格式数据。
38
+ ### setAll - 设置所有配置项。
49
39
 
50
40
  ```python
51
- def all() -> Dict[str, Any]:
41
+ def setAll(config: Dict[str, Any]) -> bool:
52
42
  ```
53
43
 
44
+ **参数:**
45
+
46
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
47
+ | -------- | ---------------- | -------- | ------ | ------------ |
48
+ | `config` | `Dict[str, Any]` | 是 | - | 完整配置字典 |
49
+
54
50
  **返回值:**
55
51
 
56
- | 类型 | 描述 |
57
- | ---------------- | ------------------ |
58
- | `Dict[str, Any]` | 包含所有配置的对象 |
52
+ | 类型 | 描述 |
53
+ | ------ | ------------ |
54
+ | `bool` | 设置是否成功 |
59
55
 
60
56
  **示例:**
61
57
 
62
58
  ```python
63
59
  from kuaijs import config
64
- import json
65
- allConfigs = config.all()
66
- print(f"所有配置: {json.dumps(allConfigs, indent=2)}")
60
+ success = config.setAll({"maxRetries": 5, "debugEnabled": True})
61
+ if success:
62
+ print("所有配置已更新")
67
63
  ```
68
64
 
69
- #### set - 更新或设置配置项的值。
65
+ ### set - 更新或设置配置项的值。
70
66
 
71
67
  ```python
72
68
  def set(key: str, value: Any) -> bool:
@@ -98,7 +94,54 @@ if success1 and success2 and success3:
98
94
  print("配置更新成功")
99
95
  ```
100
96
 
101
- #### remove - 删除指定的配置项。
97
+ ### get - 读取配置项的值。
98
+
99
+ ```python
100
+ def get(key: str) -> Any | None:
101
+ ```
102
+
103
+ **参数:**
104
+
105
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
106
+ | ------ | ------ | -------- | ------ | -------- |
107
+ | `key` | string | 是 | - | 配置键名 |
108
+
109
+ **返回值:**
110
+
111
+ | 类型 | 描述 |
112
+ | ------------- | ------ |
113
+ | `Any \| None` | 配置值 |
114
+
115
+ **示例:**
116
+
117
+ ```python
118
+ from kuaijs import config
119
+ maxRetries = config.get("maxRetries")
120
+ if maxRetries:
121
+ print(f"最大重试次数: {maxRetries}")
122
+ ```
123
+
124
+ ### getKuiConfig - 获取 KUI 的配置。
125
+
126
+ ```python
127
+ def getKuiConfig() -> Dict[str, Any]:
128
+ ```
129
+
130
+ **返回值:**
131
+
132
+ | 类型 | 描述 |
133
+ | ---------------- | -------------------------------------------------------- |
134
+ | `Dict[str, Any]` | `KUI_CONFIG` 对应的字典,配置不存在或无法转换时返回空字典 |
135
+
136
+ **示例:**
137
+
138
+ ```python
139
+ from kuaijs import config
140
+ kui_config = config.getKuiConfig()
141
+ print(f"KUI 配置: {kui_config}")
142
+ ```
143
+
144
+ ### remove - 删除指定的配置项。
102
145
 
103
146
  ```python
104
147
  def remove(key: str) -> bool:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ms-vite-plugin",
3
- "version": "1.4.20",
3
+ "version": "1.4.21",
4
4
  "type": "commonjs",
5
5
  "license": "MIT",
6
6
  "publishConfig": {