ms-vite-plugin 1.4.47 → 1.4.49
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 +1 -292
- package/dist/cli.js +6 -1234
- package/dist/mcp/device-config.d.ts +0 -47
- package/dist/mcp/device-config.js +1 -183
- package/dist/mcp/device-log.d.ts +0 -8
- package/dist/mcp/device-log.js +3 -27
- package/dist/mcp/doc-tools.d.ts +0 -7
- package/dist/mcp/doc-tools.js +2 -39
- package/dist/mcp/docs-service.d.ts +0 -13
- package/dist/mcp/docs-service.js +1 -63
- package/dist/mcp/httpapi-docs-service.d.ts +0 -31
- package/dist/mcp/httpapi-docs-service.js +1 -122
- package/dist/mcp/httpapi-tools.d.ts +0 -7
- package/dist/mcp/httpapi-tools.js +4 -222
- package/dist/mcp/image-tools.d.ts +0 -62
- package/dist/mcp/image-tools.js +8 -607
- package/dist/mcp/ocr-tools.d.ts +0 -25
- package/dist/mcp/ocr-tools.js +5 -413
- package/dist/mcp/project.d.ts +0 -14
- package/dist/mcp/project.js +1 -74
- package/dist/mcp/runtime-tools.d.ts +0 -7
- package/dist/mcp/runtime-tools.js +11 -308
- package/dist/mcp/tool-utils.d.ts +0 -40
- package/dist/mcp/tool-utils.js +1 -81
- package/dist/mcp/tools.d.ts +0 -12
- package/dist/mcp/tools.js +1 -31
- package/dist/mcp/types.d.ts +0 -12
- package/dist/mcp/types.js +1 -11
- package/dist/mcp-server.js +1 -85
- package/dist/packager.d.ts +0 -7
- package/dist/packager.js +1 -125
- package/dist/project.d.ts +0 -61
- package/dist/project.js +1 -619
- package/dist/stopGuardPlugin.d.ts +0 -6
- package/dist/stopGuardPlugin.js +1 -165
- package/dist/version.d.ts +0 -10
- package/dist/version.js +1 -63
- package/dist/ws-manager.d.ts +0 -95
- package/dist/ws-manager.js +1 -392
- package/docs/api/image.md +249 -25
- package/docs/apicn/image.md +245 -19
- package/docs/apipython/image.md +238 -18
- package/package.json +3 -2
package/dist/packager.js
CHANGED
|
@@ -1,125 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.packageProject = packageProject;
|
|
37
|
-
const child_process_1 = require("child_process");
|
|
38
|
-
const fsExtra = __importStar(require("fs-extra"));
|
|
39
|
-
const path = __importStar(require("path"));
|
|
40
|
-
const util_1 = require("util");
|
|
41
|
-
const build_1 = require("./build");
|
|
42
|
-
const execFileAsync = (0, util_1.promisify)(child_process_1.execFile);
|
|
43
|
-
/**
|
|
44
|
-
* 打包相关常量
|
|
45
|
-
*/
|
|
46
|
-
const PACKAGE_CONSTANTS = {
|
|
47
|
-
/** 加密超时时间(毫秒) */
|
|
48
|
-
ENCRYPT_TIMEOUT: 30000,
|
|
49
|
-
/** 明文 bundle 文件名 */
|
|
50
|
-
BUNDLE_NAME: "ms.msbundle",
|
|
51
|
-
/** 加密后 bundle 文件名 */
|
|
52
|
-
ENCRYPTED_BUNDLE_NAME: "enc.msbundle",
|
|
53
|
-
};
|
|
54
|
-
/**
|
|
55
|
-
* 获取当前插件根目录
|
|
56
|
-
* @returns 插件根目录绝对路径
|
|
57
|
-
* @example
|
|
58
|
-
* const root = getPluginRoot()
|
|
59
|
-
*/
|
|
60
|
-
function getPluginRoot() {
|
|
61
|
-
return path.resolve(__dirname, "..");
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* 获取对应系统的加密工具路径
|
|
65
|
-
* @returns 加密工具绝对路径
|
|
66
|
-
* @example
|
|
67
|
-
* const encryptorPath = getEncryptorPath()
|
|
68
|
-
*/
|
|
69
|
-
function getEncryptorPath() {
|
|
70
|
-
const platform = process.platform;
|
|
71
|
-
const arch = process.arch;
|
|
72
|
-
let binSubPath;
|
|
73
|
-
if (platform === "darwin") {
|
|
74
|
-
binSubPath = path.join("bin", "mac", "ms-bundle-enc");
|
|
75
|
-
}
|
|
76
|
-
else if (platform === "win32" && arch === "x64") {
|
|
77
|
-
binSubPath = path.join("bin", "win", "ms-bundle-enc.exe");
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
throw new Error(`不支持的系统平台: ${platform}-${arch}`);
|
|
81
|
-
}
|
|
82
|
-
return path.join(getPluginRoot(), binSubPath);
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* 加密构建产物 bundle 文件
|
|
86
|
-
* @param bundlePath 明文 bundle 绝对路径
|
|
87
|
-
* @returns 返回加密后的 bundle 绝对路径
|
|
88
|
-
* @example
|
|
89
|
-
* const encryptedPath = await encryptBundle("/tmp/dist/ms.msbundle")
|
|
90
|
-
*/
|
|
91
|
-
async function encryptBundle(bundlePath) {
|
|
92
|
-
const encryptorPath = getEncryptorPath();
|
|
93
|
-
if (!(await fsExtra.pathExists(encryptorPath))) {
|
|
94
|
-
throw new Error(`未找到加密工具: ${encryptorPath}`);
|
|
95
|
-
}
|
|
96
|
-
const isWindows = process.platform === "win32";
|
|
97
|
-
if (!isWindows) {
|
|
98
|
-
await fsExtra.chmod(encryptorPath, 0o755);
|
|
99
|
-
}
|
|
100
|
-
await execFileAsync(encryptorPath, [bundlePath], {
|
|
101
|
-
cwd: path.dirname(bundlePath),
|
|
102
|
-
timeout: PACKAGE_CONSTANTS.ENCRYPT_TIMEOUT,
|
|
103
|
-
});
|
|
104
|
-
const encryptedPath = path.join(path.dirname(bundlePath), PACKAGE_CONSTANTS.ENCRYPTED_BUNDLE_NAME);
|
|
105
|
-
if (!(await fsExtra.pathExists(encryptedPath))) {
|
|
106
|
-
throw new Error("加密工具未生成 enc.msbundle 文件");
|
|
107
|
-
}
|
|
108
|
-
await fsExtra.remove(bundlePath);
|
|
109
|
-
return encryptedPath;
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* 执行 package 流程(生产构建 + bundle 加密)
|
|
113
|
-
* @param workspacePath 当前工作目录(项目根目录)
|
|
114
|
-
* @returns 返回加密产物 enc.msbundle 的绝对路径
|
|
115
|
-
* @example
|
|
116
|
-
* const output = await packageProject(process.cwd())
|
|
117
|
-
*/
|
|
118
|
-
async function packageProject(workspacePath) {
|
|
119
|
-
await (0, build_1.buildAll)(false, workspacePath);
|
|
120
|
-
const bundlePath = path.join(workspacePath, "dist", PACKAGE_CONSTANTS.BUNDLE_NAME);
|
|
121
|
-
if (!(await fsExtra.pathExists(bundlePath))) {
|
|
122
|
-
throw new Error(`构建失败,未找到 ${PACKAGE_CONSTANTS.BUNDLE_NAME} 文件`);
|
|
123
|
-
}
|
|
124
|
-
return encryptBundle(bundlePath);
|
|
125
|
-
}
|
|
1
|
+
"use strict";var s=exports&&exports.__createBinding||(Object.create?(function(t,e,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(e,n);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,i)}):(function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]})),f=exports&&exports.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),u=exports&&exports.__importStar||(function(){var t=function(e){return t=Object.getOwnPropertyNames||function(n){var r=[];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[r.length]=i);return r},t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var r=t(e),i=0;i<r.length;i++)r[i]!=="default"&&s(n,e,r[i]);return f(n,e),n}})();Object.defineProperty(exports,"__esModule",{value:!0}),exports.packageProject=b;const l=require("child_process"),a=u(require("fs-extra")),c=u(require("path")),_=require("util"),d=require("./build"),E=(0,_.promisify)(l.execFile),o={ENCRYPT_TIMEOUT:3e4,BUNDLE_NAME:"ms.msbundle",ENCRYPTED_BUNDLE_NAME:"enc.msbundle"};function w(){return c.resolve(__dirname,"..")}function h(){const t=process.platform,e=process.arch;let n;if(t==="darwin")n=c.join("bin","mac","ms-bundle-enc");else if(t==="win32"&&e==="x64")n=c.join("bin","win","ms-bundle-enc.exe");else throw new Error(`\u4E0D\u652F\u6301\u7684\u7CFB\u7EDF\u5E73\u53F0: ${t}-${e}`);return c.join(w(),n)}async function p(t){const e=h();if(!await a.pathExists(e))throw new Error(`\u672A\u627E\u5230\u52A0\u5BC6\u5DE5\u5177: ${e}`);process.platform==="win32"||await a.chmod(e,493),await E(e,[t],{cwd:c.dirname(t),timeout:o.ENCRYPT_TIMEOUT});const r=c.join(c.dirname(t),o.ENCRYPTED_BUNDLE_NAME);if(!await a.pathExists(r))throw new Error("\u52A0\u5BC6\u5DE5\u5177\u672A\u751F\u6210 enc.msbundle \u6587\u4EF6");return await a.remove(t),r}async function b(t){await(0,d.buildAll)(!1,t);const e=c.join(t,"dist",o.BUNDLE_NAME);if(!await a.pathExists(e))throw new Error(`\u6784\u5EFA\u5931\u8D25\uFF0C\u672A\u627E\u5230 ${o.BUNDLE_NAME} \u6587\u4EF6`);return p(e)}
|
package/dist/project.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 设备命令选项
|
|
3
|
-
*/
|
|
4
1
|
export interface DeviceCliOptions {
|
|
5
2
|
ip?: string;
|
|
6
3
|
port?: string;
|
|
@@ -9,72 +6,14 @@ export interface DeviceCliOptions {
|
|
|
9
6
|
wsWaitMs?: string;
|
|
10
7
|
workspacePath?: string;
|
|
11
8
|
}
|
|
12
|
-
/**
|
|
13
|
-
* 当前日志最新行接口响应
|
|
14
|
-
*/
|
|
15
9
|
export interface CurrentLogLinesResponse {
|
|
16
|
-
/** 当前日志文件最新行,按日志原始输出顺序排列 */
|
|
17
10
|
lines: string[];
|
|
18
|
-
/** 本次返回范围前是否还有更早日志 */
|
|
19
11
|
hasMore: boolean;
|
|
20
12
|
}
|
|
21
|
-
/**
|
|
22
|
-
* 在设备上获取截图 JPG 二进制数据(HTTP)
|
|
23
|
-
* @param options 命令选项(transport 仅支持 http)
|
|
24
|
-
* @returns 返回 JPG 二进制 Buffer
|
|
25
|
-
* @example
|
|
26
|
-
* const image = await getScreenshotOnDevice({ ip: "192.168.1.10", port: "9800" })
|
|
27
|
-
*/
|
|
28
13
|
export declare function getScreenshotOnDevice(options: DeviceCliOptions): Promise<Buffer>;
|
|
29
|
-
/**
|
|
30
|
-
* 在设备上获取截图 Base64(HTTP)
|
|
31
|
-
* @param options 命令选项(transport 仅支持 http)
|
|
32
|
-
* @returns 返回截图 base64 字符串
|
|
33
|
-
* @example
|
|
34
|
-
* const b64 = await getScreenshotBase64OnDevice({ ip: "192.168.1.10", port: "9800" })
|
|
35
|
-
*/
|
|
36
14
|
export declare function getScreenshotBase64OnDevice(options: DeviceCliOptions): Promise<string>;
|
|
37
|
-
/**
|
|
38
|
-
* 在设备上获取节点 XML(HTTP)
|
|
39
|
-
* @param options 命令选项(transport 仅支持 http)
|
|
40
|
-
* @param maxDepth 节点最大深度,默认 50
|
|
41
|
-
* @param timeout 获取节点超时秒数,默认 120
|
|
42
|
-
* @param mode 节点抓取模式,支持 1、2、3,默认 1
|
|
43
|
-
* @returns 返回 XML 字符串
|
|
44
|
-
* @example
|
|
45
|
-
* const xml = await getSourceOnDevice({ ip: "192.168.1.10", port: "9800" }, 50, 120, 1)
|
|
46
|
-
*/
|
|
47
15
|
export declare function getSourceOnDevice(options: DeviceCliOptions, maxDepth?: number, timeout?: number, mode?: number): Promise<string>;
|
|
48
|
-
/**
|
|
49
|
-
* 在设备上获取当前日志文件最新行
|
|
50
|
-
* @param options 命令选项(仅支持 http 传输)
|
|
51
|
-
* @param count 需要读取的最新日志行数,默认 200,最大 5000
|
|
52
|
-
* @returns 返回最新日志行和是否还有更早日志
|
|
53
|
-
* @example
|
|
54
|
-
* const result = await getCurrentLogLinesOnDevice({ ip: "192.168.1.10", port: "9800" }, 200)
|
|
55
|
-
*/
|
|
56
16
|
export declare function getCurrentLogLinesOnDevice(options: DeviceCliOptions, count?: number): Promise<CurrentLogLinesResponse>;
|
|
57
|
-
/**
|
|
58
|
-
* 在设备上运行项目(先同步后运行)
|
|
59
|
-
* @param options 命令选项
|
|
60
|
-
* @returns 执行完成后返回 Promise<void>
|
|
61
|
-
* @example
|
|
62
|
-
* await runOnDevice({ ip: "192.168.1.10", port: "9800", path: "./demo" })
|
|
63
|
-
*/
|
|
64
17
|
export declare function runOnDevice(options: DeviceCliOptions): Promise<void>;
|
|
65
|
-
/**
|
|
66
|
-
* 在设备上预览 UI(先同步后调用 runUI)
|
|
67
|
-
* @param options 命令选项
|
|
68
|
-
* @returns 执行完成后返回 Promise<void>
|
|
69
|
-
* @example
|
|
70
|
-
* await runUIOnDevice({ ip: "192.168.1.10", port: "9800", path: "./demo" })
|
|
71
|
-
*/
|
|
72
18
|
export declare function runUIOnDevice(options: DeviceCliOptions): Promise<void>;
|
|
73
|
-
/**
|
|
74
|
-
* 停止设备上的项目
|
|
75
|
-
* @param options 命令选项
|
|
76
|
-
* @returns 执行完成后返回 Promise<void>
|
|
77
|
-
* @example
|
|
78
|
-
* await stopOnDevice({ ip: "192.168.1.10", port: "9800" })
|
|
79
|
-
*/
|
|
80
19
|
export declare function stopOnDevice(options: DeviceCliOptions): Promise<void>;
|