ms-vite-plugin 1.4.37 → 1.4.38

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/dist/build.js CHANGED
@@ -210,20 +210,22 @@ const buildAll = async (isDev = true, workspacePath) => {
210
210
  ...(isDev
211
211
  ? []
212
212
  : [
213
- (0, vite_plugin_bundle_obfuscator_1.default)({
214
- autoExcludeNodeModules: true,
215
- threadPool: true,
216
- options: {
217
- ...obfuscatorConfig,
218
- target: "browser",
219
- debugProtection: false,
220
- disableConsoleOutput: false,
221
- domainLock: [],
222
- selfDefending: false,
223
- renameGlobals: false,
224
- renameProperties: false,
225
- },
226
- }),
213
+ (obfuscatorConfig.enabled ?? true)
214
+ ? (0, vite_plugin_bundle_obfuscator_1.default)({
215
+ autoExcludeNodeModules: true,
216
+ threadPool: true,
217
+ options: {
218
+ ...obfuscatorConfig,
219
+ target: "browser",
220
+ debugProtection: false,
221
+ disableConsoleOutput: false,
222
+ domainLock: [],
223
+ selfDefending: false,
224
+ renameGlobals: false,
225
+ renameProperties: false,
226
+ },
227
+ })
228
+ : [],
227
229
  ]),
228
230
  ],
229
231
  });
package/dist/cli.js CHANGED
@@ -536,7 +536,7 @@ async function sourceCommand(options) {
536
536
  if (!Number.isInteger(timeout) || timeout < 1) {
537
537
  throw new Error(`无效 timeout: ${timeoutText}`);
538
538
  }
539
- if (!Number.isInteger(mode) || (mode !== 1 && mode !== 2)) {
539
+ if (!Number.isInteger(mode) || (mode !== 1 && mode !== 2 && mode !== 3)) {
540
540
  throw new Error(`无效 mode: ${modeText}`);
541
541
  }
542
542
  const source = await (0, project_1.getSourceOnDevice)(options, maxDepth, timeout, mode);
@@ -1102,7 +1102,7 @@ commander_1.program
1102
1102
  .option("--ws-wait-ms <wsWaitMs>", "WS 等待设备连接时间(毫秒)", "30000")
1103
1103
  .option("--max-depth <maxDepth>", "节点最大深度", "50")
1104
1104
  .option("--timeout <timeout>", "节点抓取超时秒数", "120")
1105
- .option("--mode <mode>", "节点抓取模式: 1=模式1, 2=模式2", "1")
1105
+ .option("--mode <mode>", "节点抓取模式: 1=模式1, 2=模式2, 3=模式3", "1")
1106
1106
  .option("--output <output>", "节点 XML 输出文件路径(可选)")
1107
1107
  .action(sourceCommand);
1108
1108
  // 日志命令
@@ -207,10 +207,10 @@ function registerRuntimeTools(server) {
207
207
  .number()
208
208
  .int()
209
209
  .min(1)
210
- .max(2)
210
+ .max(3)
211
211
  .optional()
212
212
  .default(1)
213
- .describe("节点抓取模式:1=完整节点树,2=可见节点优化模式"),
213
+ .describe("节点抓取模式:12、3,默认 1"),
214
214
  outputPath: z
215
215
  .string()
216
216
  .min(1)
package/dist/project.d.ts CHANGED
@@ -39,7 +39,7 @@ export declare function getScreenshotBase64OnDevice(options: DeviceCliOptions):
39
39
  * @param options 命令选项(transport 仅支持 http)
40
40
  * @param maxDepth 节点最大深度,默认 50
41
41
  * @param timeout 获取节点超时秒数,默认 120
42
- * @param mode 节点抓取模式,1=完整节点树,2=可见节点优化模式
42
+ * @param mode 节点抓取模式,支持 12、3,默认 1
43
43
  * @returns 返回 XML 字符串
44
44
  * @example
45
45
  * const xml = await getSourceOnDevice({ ip: "192.168.1.10", port: "9800" }, 50, 120, 1)
package/dist/project.js CHANGED
@@ -428,7 +428,7 @@ async function getScreenshotBase64OnDevice(options) {
428
428
  * @param options 命令选项(transport 仅支持 http)
429
429
  * @param maxDepth 节点最大深度,默认 50
430
430
  * @param timeout 获取节点超时秒数,默认 120
431
- * @param mode 节点抓取模式,1=完整节点树,2=可见节点优化模式
431
+ * @param mode 节点抓取模式,支持 12、3,默认 1
432
432
  * @returns 返回 XML 字符串
433
433
  * @example
434
434
  * const xml = await getSourceOnDevice({ ip: "192.168.1.10", port: "9800" }, 50, 120, 1)
@@ -441,7 +441,7 @@ async function getSourceOnDevice(options, maxDepth = 50, timeout = 120, mode = 1
441
441
  if (!Number.isInteger(timeout) || timeout < 1) {
442
442
  throw new Error(`无效 timeout: ${timeout}`);
443
443
  }
444
- if (!Number.isInteger(mode) || (mode !== 1 && mode !== 2)) {
444
+ if (!Number.isInteger(mode) || (mode !== 1 && mode !== 2 && mode !== 3)) {
445
445
  throw new Error(`无效 mode: ${mode}`);
446
446
  }
447
447
  if (transport === "ws") {
package/docs/api/node.md CHANGED
@@ -20,7 +20,7 @@
20
20
  ```typescript
21
21
  function createNodeSelector(params?: {
22
22
  maxDepth?: number; // 最大层级深度,默认 50
23
- mode?: number; // 抓取模式:模式 1、模式 2,默认模式 1
23
+ mode?: number; // 抓取模式:模式 1、模式 2、模式 3,默认模式 1
24
24
  }): NodeSelector;
25
25
  ```
26
26
 
@@ -29,7 +29,7 @@ function createNodeSelector(params?: {
29
29
  | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
30
30
  | ---------- | ------ | -------- | ------ | --------------------------- |
31
31
  | `maxDepth` | number | 否 | 50 | 遍历的最大层级深度,默认 50 |
32
- | `mode` | number | 否 | 1 | 抓取模式。模式 1、模式 2,默认模式 1 |
32
+ | `mode` | number | 否 | 1 | 抓取模式。支持模式 1、模式 2、模式 3,默认模式 1 |
33
33
 
34
34
  **返回值:**
35
35
 
@@ -24,7 +24,7 @@ function $创建节点选择器(params?: {
24
24
  */
25
25
  maxDepth?: 数字;
26
26
  /**
27
- * 抓取模式:模式 1、模式 2,默认模式 1
27
+ * 抓取模式:模式 1、模式 2、模式 3,默认模式 1
28
28
  */
29
29
  mode?: 数字;
30
30
  }): $节点选择器;
@@ -35,7 +35,7 @@ function $创建节点选择器(params?: {
35
35
  | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
36
36
  | ---------- | ---- | -------- | ------ | --------------------------- |
37
37
  | `maxDepth` | 数字 | 否 | 50 | 遍历的最大层级深度,默认 50 |
38
- | `mode` | 数字 | 否 | 1 | 抓取模式。模式 1、模式 2,默认模式 1 |
38
+ | `mode` | 数字 | 否 | 1 | 抓取模式。支持模式 1、模式 2、模式 3,默认模式 1 |
39
39
 
40
40
  **返回值:**
41
41
 
@@ -46,7 +46,7 @@ class NodeInfo:
46
46
 
47
47
  class NodeSelectorOptions(TypedDict, total=False):
48
48
  maxDepth: int # 最大层级深度,默认 50
49
- mode: int # 抓取模式:模式 1、模式 2,默认模式 1
49
+ mode: int # 抓取模式:模式 1、模式 2、模式 3,默认模式 1
50
50
  ```
51
51
 
52
52
  ## 节点选择器 (NodeSelector)
@@ -68,7 +68,7 @@ def createNodeSelector(params: Optional[NodeSelectorOptions] = None) -> NodeSele
68
68
  | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
69
69
  | ---------- | ---- | -------- | ------ | --------------------- |
70
70
  | `maxDepth` | int | 否 | 50 | 最大层级深度,默认 50 |
71
- | `mode` | int | 否 | 1 | 抓取模式。模式 1、模式 2,默认模式 1 |
71
+ | `mode` | int | 否 | 1 | 抓取模式。支持模式 1、模式 2、模式 3,默认模式 1 |
72
72
 
73
73
  **返回值:** `NodeSelector`
74
74
 
@@ -159,7 +159,7 @@ GET /api/source
159
159
  | --------- | ----- | ------- | ---- | ------------------ |
160
160
  | max_depth | query | integer | 是 | 页面深度,值越小快照成本越低 |
161
161
  | timeout | query | integer | 是 | 超时时间(单位秒) |
162
- | mode | query | integer | 否 | 抓取模式。模式 1、模式 2,默认模式 1 |
162
+ | mode | query | integer | 否 | 抓取模式。支持模式 1、模式 2、模式 3,默认模式 1 |
163
163
 
164
164
  > 返回示例
165
165
 
@@ -585,13 +585,12 @@ GET /api/setClipboard
585
585
 
586
586
  POST /api/login
587
587
 
588
- 用户授权模式下,该接口会使用账号密码执行登录。授权卡密模式下,该接口是兼容旧控制端的空操作,会直接返回成功,不读取请求体字段,不切换服务器类型,也不执行账号登录。
588
+ 用户授权模式下,该接口会使用账号密码执行登录。授权卡密模式下,该接口是兼容旧控制端的空操作,会直接返回成功,不读取请求体字段,也不执行账号登录。
589
589
 
590
590
  > Body 请求参数
591
591
 
592
592
  ```json
593
593
  {
594
- "serverType": "domestic",
595
594
  "username": "string",
596
595
  "password": "string"
597
596
  }
@@ -602,17 +601,9 @@ POST /api/login
602
601
  | 名称 | 位置 | 类型 | 必选 | 中文名 | 说明 |
603
602
  | ------------ | ---- | ------ | ---- | ---------- | ---- |
604
603
  | body | body | object | 是 | | none |
605
- | » serverType | body | string | 是 | 服务器类型 | 用户授权模式下使用;授权卡密模式下忽略 |
606
604
  | » username | body | string | 是 | 用户名 | 用户授权模式下使用;授权卡密模式下忽略 |
607
605
  | » password | body | string | 是 | 密码 | 用户授权模式下使用;授权卡密模式下忽略 |
608
606
 
609
- #### 枚举值
610
-
611
- | 属性 | 值 |
612
- | ------------ | ------------- |
613
- | » serverType | domestic |
614
- | » serverType | international |
615
-
616
607
  > 返回示例
617
608
 
618
609
  > 200 Response
@@ -722,7 +713,6 @@ GET /api/status
722
713
  "isVolumeControlEnabled": true,
723
714
  "agentVersion": "string",
724
715
  "appVersion": "string",
725
- "serverType": "international",
726
716
  "isHidConnected": true,
727
717
  "isShowUI": true,
728
718
  "isLogin": true,
@@ -783,7 +773,6 @@ GET /api/status
783
773
  | »» isVolumeControlEnabled | boolean | true | none | 是否开启了音量键启停 | none |
784
774
  | »» agentVersion | string | true | none | agent版本号 | none |
785
775
  | »» appVersion | string | true | none | app版本号 | none |
786
- | »» serverType | string | true | none | 授权服务器类型 | none |
787
776
  | »» isHidConnected | boolean | true | none | hid设备是否连接 | none |
788
777
  | »» isShowUI | boolean | true | none | 实现显示了 UI | none |
789
778
  | »» isLogin | boolean | true | none | 是否登录 | none |
@@ -797,8 +786,6 @@ GET /api/status
797
786
  | orientation | LANDSCAPE |
798
787
  | authMode | user |
799
788
  | authMode | card |
800
- | serverType | international |
801
- | serverType | domestic |
802
789
 
803
790
  ## GET App切到前台
804
791
 
@@ -2819,6 +2806,49 @@ GET /api/hid/mouseUp
2819
2806
  | --------- | ------- | ---- | ---- | -------- | ---- |
2820
2807
  | » success | boolean | true | none | 是否成功 | none |
2821
2808
 
2809
+ ## GET 获取 HID 设备信息
2810
+
2811
+ GET /api/hid/deviceInfo
2812
+
2813
+ 返回当前 HID 设备连接状态与基础信息。未连接时 `connected` 为 `false`,其余字符串字段为空。`name` 在纯 USB 链路下通常为空;BLE 为外设蓝牙名。
2814
+
2815
+ > 返回示例
2816
+
2817
+ > 200 Response
2818
+
2819
+ ```json
2820
+ {
2821
+ "success": true,
2822
+ "data": {
2823
+ "connected": true,
2824
+ "name": "KUAIJS_BLE_HID",
2825
+ "mac": "AA:BB:CC:DD:EE:FF",
2826
+ "model": "esp32s3",
2827
+ "version": "3.0.9"
2828
+ }
2829
+ }
2830
+ ```
2831
+
2832
+ ### 返回结果
2833
+
2834
+ | 状态码 | 状态码含义 | 说明 | 数据模型 |
2835
+ | ------ | ------------------------------------------------------- | ---- | -------- |
2836
+ | 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none | Inline |
2837
+
2838
+ ### 返回数据结构
2839
+
2840
+ 状态码 **200**
2841
+
2842
+ | 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
2843
+ | ------------ | ------- | ---- | ---- | -------- | ---- |
2844
+ | » success | boolean | true | none | 是否成功 | none |
2845
+ | » data | object | true | none | 设备信息 | none |
2846
+ | »» connected | boolean | true | none | 连接状态 | USB 或 BLE 任一就绪为 `true` |
2847
+ | »» name | string | true | none | 设备名称 | BLE 外设名;USB 通常为 `""` |
2848
+ | »» mac | string | true | none | 设备 MAC | 未连接或查询失败为 `""` |
2849
+ | »» model | string | true | none | 设备型号 | 如 `esp32s3`;失败为 `""` |
2850
+ | »» version | string | true | none | 设备版本 | 固件版本;失败为 `""` |
2851
+
2822
2852
  ## POST 保存图像到相册
2823
2853
 
2824
2854
  POST /api/media/saveImageToAlbum
@@ -3280,7 +3310,6 @@ GET /mirror/image
3280
3310
  "isVolumeControlEnabled": true,
3281
3311
  "agentVersion": "string",
3282
3312
  "appVersion": "string",
3283
- "serverType": "international",
3284
3313
  "isHidConnected": true,
3285
3314
  "isShowUI": true,
3286
3315
  "isLogin": true,
@@ -3330,7 +3359,6 @@ GET /mirror/image
3330
3359
  | isVolumeControlEnabled | boolean | true | none | 是否开启了音量键启停 | none |
3331
3360
  | agentVersion | string | true | none | agent版本号 | none |
3332
3361
  | appVersion | string | true | none | app版本号 | none |
3333
- | serverType | string | true | none | 授权服务器类型 | none |
3334
3362
  | isHidConnected | boolean | true | none | hid设备是否连接 | none |
3335
3363
  | isShowUI | boolean | true | none | 实现显示了 UI | none |
3336
3364
  | isLogin | boolean | true | none | 是否登录 | none |
@@ -3344,5 +3372,3 @@ GET /mirror/image
3344
3372
  | orientation | LANDSCAPE |
3345
3373
  | authMode | user |
3346
3374
  | authMode | card |
3347
- | serverType | international |
3348
- | serverType | domestic |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ms-vite-plugin",
3
- "version": "1.4.37",
3
+ "version": "1.4.38",
4
4
  "type": "commonjs",
5
5
  "license": "MIT",
6
6
  "publishConfig": {