weapp-ide-cli 5.4.2 → 5.4.4
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/{automator-session-CvStbY9I.js → automator-session-JEM5q8tK.js} +149 -14
- package/dist/{cli-C9KfpthX.js → cli-BRSz3y5e.js} +25 -7
- package/dist/cli.js +2 -2
- package/dist/{commands-Js_IjVxE.js → commands-BmMXhKYb.js} +9 -2
- package/dist/commands-CL5B82hV.js +2 -0
- package/dist/index.d.ts +8 -1
- package/dist/index.js +5 -5
- package/dist/run-mcp-C0yaUdqC.js +2 -0
- package/dist/{run-mcp-DvHYYX0m.js → run-mcp-L4shbBPP.js} +1 -1
- package/package.json +2 -2
- package/dist/commands-B4HFVW-Q.js +0 -2
- package/dist/run-mcp-CL909GLy.js +0 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Buffer } from "node:buffer";
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
2
3
|
import fs from "node:fs/promises";
|
|
3
4
|
import os from "node:os";
|
|
4
5
|
import path from "node:path";
|
|
@@ -7,7 +8,6 @@ import { fs as fs$1 } from "@weapp-core/shared/fs";
|
|
|
7
8
|
import process from "node:process";
|
|
8
9
|
import path$1 from "pathe";
|
|
9
10
|
import logger, { colors } from "@weapp-core/logger";
|
|
10
|
-
import { createHash } from "node:crypto";
|
|
11
11
|
import { acquireSharedMiniProgram, closeSharedMiniProgram, getSharedMiniProgramSessionCount, releaseSharedMiniProgram, withMiniProgram } from "@weapp-vite/devtools-runtime";
|
|
12
12
|
import { emitKeypressEvents } from "node:readline";
|
|
13
13
|
//#region src/utils/path.ts
|
|
@@ -112,6 +112,111 @@ async function overwriteCustomConfig(config) {
|
|
|
112
112
|
await writeCustomConfig(nextConfig, { replace: true });
|
|
113
113
|
}
|
|
114
114
|
//#endregion
|
|
115
|
+
//#region src/cli/automatorProject.ts
|
|
116
|
+
const WRAPPER_ROOT = path.join(os.tmpdir(), "weapp-ide-cli-automator-projects");
|
|
117
|
+
function normalizeProjectRelativeRoot(rawRoot) {
|
|
118
|
+
if (typeof rawRoot !== "string") return;
|
|
119
|
+
const normalized = rawRoot.trim().replace(/\\/g, "/").replace(/^\/+/, "").replace(/\/+$/, "");
|
|
120
|
+
if (!normalized || normalized === ".") return;
|
|
121
|
+
if (normalized.split("/").includes("..")) return;
|
|
122
|
+
return normalized;
|
|
123
|
+
}
|
|
124
|
+
async function pathExists(filePath) {
|
|
125
|
+
try {
|
|
126
|
+
await fs.access(filePath);
|
|
127
|
+
return true;
|
|
128
|
+
} catch {
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
async function readJsonObject$1(filePath) {
|
|
133
|
+
try {
|
|
134
|
+
const raw = await fs.readFile(filePath, "utf8");
|
|
135
|
+
const value = JSON.parse(raw);
|
|
136
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
137
|
+
} catch {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
async function writeJsonObject$1(filePath, value) {
|
|
142
|
+
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
143
|
+
await fs.writeFile(filePath, `${JSON.stringify(value, null, 2)}\n`, "utf8");
|
|
144
|
+
}
|
|
145
|
+
async function copyProjectRoot(sourceProjectPath, wrapperProjectPath, relativeRoot) {
|
|
146
|
+
const sourcePath = path.join(sourceProjectPath, relativeRoot);
|
|
147
|
+
if (!await pathExists(sourcePath)) return;
|
|
148
|
+
await fs.cp(sourcePath, path.join(wrapperProjectPath, relativeRoot), {
|
|
149
|
+
dereference: true,
|
|
150
|
+
force: true,
|
|
151
|
+
recursive: true
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
async function copyJsonConfigAsWrapper(sourcePath, targetPath, patch) {
|
|
155
|
+
const source = await readJsonObject$1(sourcePath);
|
|
156
|
+
if (!source) return;
|
|
157
|
+
await writeJsonObject$1(targetPath, {
|
|
158
|
+
...source,
|
|
159
|
+
...patch
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
async function ensureWrapperAppConfig(wrapperProjectPath) {
|
|
163
|
+
const appConfigPath = path.join(wrapperProjectPath, "app.json");
|
|
164
|
+
const appConfig = await readJsonObject$1(appConfigPath);
|
|
165
|
+
if (!appConfig) return;
|
|
166
|
+
await writeJsonObject$1(appConfigPath, {
|
|
167
|
+
...appConfig,
|
|
168
|
+
subPackages: Array.isArray(appConfig.subPackages) ? appConfig.subPackages : []
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* @description 为 DevTools automator 准备稳定的小程序根目录,避免打开瞬间跨 miniprogramRoot 读取 app.json 抖动。
|
|
173
|
+
*/
|
|
174
|
+
async function resolveAutomatorProjectPath(projectPath) {
|
|
175
|
+
const sourceProjectPath = path.resolve(projectPath);
|
|
176
|
+
const projectConfig = await readJsonObject$1(path.join(sourceProjectPath, "project.config.json"));
|
|
177
|
+
const miniprogramRoot = normalizeProjectRelativeRoot(projectConfig?.miniprogramRoot);
|
|
178
|
+
if (!miniprogramRoot) return {
|
|
179
|
+
projectPath: sourceProjectPath,
|
|
180
|
+
sourceProjectPath
|
|
181
|
+
};
|
|
182
|
+
const distRoot = path.join(sourceProjectPath, miniprogramRoot);
|
|
183
|
+
if (!await pathExists(path.join(distRoot, "app.json"))) return {
|
|
184
|
+
projectPath: sourceProjectPath,
|
|
185
|
+
sourceProjectPath
|
|
186
|
+
};
|
|
187
|
+
const wrapperHash = createHash("sha1").update(sourceProjectPath).update("\0").update(path.resolve(distRoot)).digest("hex").slice(0, 16);
|
|
188
|
+
const wrapperProjectPath = path.join(WRAPPER_ROOT, wrapperHash);
|
|
189
|
+
await fs.rm(wrapperProjectPath, {
|
|
190
|
+
recursive: true,
|
|
191
|
+
force: true
|
|
192
|
+
});
|
|
193
|
+
await fs.mkdir(wrapperProjectPath, { recursive: true });
|
|
194
|
+
await fs.cp(distRoot, wrapperProjectPath, {
|
|
195
|
+
dereference: true,
|
|
196
|
+
force: true,
|
|
197
|
+
recursive: true
|
|
198
|
+
});
|
|
199
|
+
const pluginRoot = normalizeProjectRelativeRoot(projectConfig?.pluginRoot);
|
|
200
|
+
if (pluginRoot) await copyProjectRoot(sourceProjectPath, wrapperProjectPath, pluginRoot);
|
|
201
|
+
const rootPatch = {
|
|
202
|
+
miniprogramRoot: "./",
|
|
203
|
+
srcMiniprogramRoot: "./"
|
|
204
|
+
};
|
|
205
|
+
await copyJsonConfigAsWrapper(path.join(sourceProjectPath, "project.config.json"), path.join(wrapperProjectPath, "project.config.json"), rootPatch);
|
|
206
|
+
await copyJsonConfigAsWrapper(path.join(sourceProjectPath, "project.private.config.json"), path.join(wrapperProjectPath, "project.private.config.json"), rootPatch);
|
|
207
|
+
await ensureWrapperAppConfig(wrapperProjectPath);
|
|
208
|
+
return {
|
|
209
|
+
cleanup: async () => {
|
|
210
|
+
await fs.rm(wrapperProjectPath, {
|
|
211
|
+
recursive: true,
|
|
212
|
+
force: true
|
|
213
|
+
});
|
|
214
|
+
},
|
|
215
|
+
projectPath: wrapperProjectPath,
|
|
216
|
+
sourceProjectPath
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
//#endregion
|
|
115
220
|
//#region src/logger.ts
|
|
116
221
|
var logger_default = logger;
|
|
117
222
|
//#endregion
|
|
@@ -506,13 +611,17 @@ const AUTOMATOR_LAUNCH_TIMEOUT_RE = /Wait timed out after \d+ ms/i;
|
|
|
506
611
|
const AUTOMATOR_WS_CONNECT_RE = /Failed connecting to ws:\/\/127\.0\.0\.1:\d+/i;
|
|
507
612
|
const DEVTOOLS_PROTOCOL_TIMEOUT_RE = /DevTools did not respond to protocol method (\S+) within \d+ms/i;
|
|
508
613
|
const DEVTOOLS_INFRA_ERROR_PATTERNS = [
|
|
614
|
+
/#initialize-error:\s*wait IDE port timeout/i,
|
|
615
|
+
/wait IDE port timeout/i,
|
|
509
616
|
/listen EPERM/i,
|
|
510
617
|
/operation not permitted 0\.0\.0\.0/i,
|
|
511
618
|
/EACCES/i,
|
|
512
619
|
/ECONNREFUSED/i,
|
|
513
620
|
/connect ECONNREFUSED/i
|
|
514
621
|
];
|
|
515
|
-
const
|
|
622
|
+
const DEFAULT_WECHAT_DEVTOOLS_WS_PORT = 9420;
|
|
623
|
+
const PROJECT_AUTOMATOR_PORT_BASE = 9620;
|
|
624
|
+
const PROJECT_AUTOMATOR_PORT_RANGE = 2e3;
|
|
516
625
|
const AUTOMATOR_SESSION_DIR = path.join(os.tmpdir(), "weapp-vite-automator-sessions");
|
|
517
626
|
const DEVTOOLS_LOGIN_REQUIRED_PATTERNS = [
|
|
518
627
|
/code\s*[:=]\s*10/i,
|
|
@@ -537,6 +646,12 @@ function normalizeAutomatorSessionId(sessionId, port) {
|
|
|
537
646
|
if (sessionId?.trim()) return sessionId.trim();
|
|
538
647
|
return port ? `port-${port}` : "default";
|
|
539
648
|
}
|
|
649
|
+
/**
|
|
650
|
+
* @description 为项目路径派生稳定的 DevTools automator 端口,避免多个 dev:open 项目抢占默认端口。
|
|
651
|
+
*/
|
|
652
|
+
function resolveProjectAutomatorPort(projectPath) {
|
|
653
|
+
return PROJECT_AUTOMATOR_PORT_BASE + createHash("sha1").update(path.resolve(projectPath)).digest().readUInt32BE(0) % PROJECT_AUTOMATOR_PORT_RANGE;
|
|
654
|
+
}
|
|
540
655
|
function resolveAutomatorSessionFilePath(projectPath, sessionId, port) {
|
|
541
656
|
const normalizedProjectPath = path.resolve(projectPath);
|
|
542
657
|
const normalizedSessionId = normalizeAutomatorSessionId(sessionId, port);
|
|
@@ -660,8 +775,12 @@ async function launchAutomator(options) {
|
|
|
660
775
|
const launcher = new Launcher();
|
|
661
776
|
let lastError = null;
|
|
662
777
|
let bootstrapResult;
|
|
778
|
+
const resolvedProject = options.preserveProjectRoot ? {
|
|
779
|
+
projectPath: path.resolve(projectPath),
|
|
780
|
+
sourceProjectPath: path.resolve(projectPath)
|
|
781
|
+
} : await resolveAutomatorProjectPath(projectPath);
|
|
663
782
|
if (config.autoBootstrapDevtools !== false) bootstrapResult = await bootstrapWechatDevtoolsSettings({
|
|
664
|
-
projectPath,
|
|
783
|
+
projectPath: resolvedProject.projectPath,
|
|
665
784
|
trustProject: resolvedTrustProject
|
|
666
785
|
});
|
|
667
786
|
if (bootstrapResult?.servicePortEnabled === false) throw new Error("Detected WeChat DevTools service port is disabled in current settings. Please enable it manually; existing user settings were not modified.");
|
|
@@ -669,17 +788,23 @@ async function launchAutomator(options) {
|
|
|
669
788
|
const miniProgram = await launcher.launch({
|
|
670
789
|
cliPath: resolvedCliPath,
|
|
671
790
|
...port ? { port } : {},
|
|
672
|
-
projectPath,
|
|
791
|
+
projectPath: resolvedProject.projectPath,
|
|
673
792
|
timeout,
|
|
674
793
|
trustProject: resolvedTrustProject
|
|
675
794
|
});
|
|
676
795
|
const sessionMetadata = Reflect.get(miniProgram, "__WEAPP_VITE_SESSION_METADATA");
|
|
677
|
-
if (typeof sessionMetadata?.wsEndpoint === "string" && sessionMetadata.wsEndpoint)
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
796
|
+
if (typeof sessionMetadata?.wsEndpoint === "string" && sessionMetadata.wsEndpoint) {
|
|
797
|
+
await persistAutomatorSession({
|
|
798
|
+
...port ? { port: sessionMetadata.port ?? port } : {},
|
|
799
|
+
projectPath,
|
|
800
|
+
sessionId,
|
|
801
|
+
wsEndpoint: sessionMetadata.wsEndpoint
|
|
802
|
+
});
|
|
803
|
+
if (options.persistAsDefaultSession && (port || sessionId)) await persistAutomatorSession({
|
|
804
|
+
projectPath,
|
|
805
|
+
wsEndpoint: sessionMetadata.wsEndpoint
|
|
806
|
+
});
|
|
807
|
+
}
|
|
683
808
|
return miniProgram;
|
|
684
809
|
} catch (error) {
|
|
685
810
|
lastError = error;
|
|
@@ -694,7 +819,7 @@ async function connectOpenedAutomator(options) {
|
|
|
694
819
|
const { port, projectPath, sessionId } = options;
|
|
695
820
|
const launcher = new Launcher();
|
|
696
821
|
const persistedSession = await readPersistedAutomatorSession(projectPath, sessionId, port);
|
|
697
|
-
const wsEndpoint = persistedSession?.wsEndpoint ?? (port ? `ws://127.0.0.1:${port}` :
|
|
822
|
+
const wsEndpoint = persistedSession?.wsEndpoint ?? (port ? `ws://127.0.0.1:${port}` : `ws://127.0.0.1:${DEFAULT_WECHAT_DEVTOOLS_WS_PORT}`);
|
|
698
823
|
try {
|
|
699
824
|
return await launcher.connect({ wsEndpoint });
|
|
700
825
|
} catch (error) {
|
|
@@ -1078,6 +1203,16 @@ async function runRetryableCommand(options) {
|
|
|
1078
1203
|
function unwrapAutomatorConnectionError(result) {
|
|
1079
1204
|
return result.kind === "retryable" ? result.error : result.value;
|
|
1080
1205
|
}
|
|
1206
|
+
async function launchFreshAutomator(options) {
|
|
1207
|
+
const shouldUseProjectPort = !options.port && !options.sessionId;
|
|
1208
|
+
return await launchAutomator({
|
|
1209
|
+
...options,
|
|
1210
|
+
...shouldUseProjectPort ? {
|
|
1211
|
+
persistAsDefaultSession: true,
|
|
1212
|
+
port: resolveProjectAutomatorPort(options.projectPath)
|
|
1213
|
+
} : {}
|
|
1214
|
+
});
|
|
1215
|
+
}
|
|
1081
1216
|
function normalizeMiniProgramConnectionError(error) {
|
|
1082
1217
|
if (isAutomatorLoginError(error)) {
|
|
1083
1218
|
logger_default.error(i18nText("检测到微信开发者工具登录状态失效,请先登录后重试。", "Wechat DevTools login has expired. Please login and retry."));
|
|
@@ -1117,7 +1252,7 @@ async function connectMiniProgram(options) {
|
|
|
1117
1252
|
if (options.preferOpenedSession === false) try {
|
|
1118
1253
|
return {
|
|
1119
1254
|
kind: "result",
|
|
1120
|
-
value: await
|
|
1255
|
+
value: await launchFreshAutomator(options)
|
|
1121
1256
|
};
|
|
1122
1257
|
} catch (error) {
|
|
1123
1258
|
if (!isAutomatorLoginError(error)) throw normalizeMiniProgramConnectionError(error);
|
|
@@ -1137,7 +1272,7 @@ async function connectMiniProgram(options) {
|
|
|
1137
1272
|
try {
|
|
1138
1273
|
return {
|
|
1139
1274
|
kind: "result",
|
|
1140
|
-
value: await
|
|
1275
|
+
value: await launchFreshAutomator(options)
|
|
1141
1276
|
};
|
|
1142
1277
|
} catch (launchError) {
|
|
1143
1278
|
if (!isAutomatorLoginError(launchError)) throw normalizeMiniProgramConnectionError(launchError);
|
|
@@ -1179,4 +1314,4 @@ async function withMiniProgram$1(options, runner) {
|
|
|
1179
1314
|
return await withMiniProgram(runtimeHooks, options, runner);
|
|
1180
1315
|
}
|
|
1181
1316
|
//#endregion
|
|
1182
|
-
export {
|
|
1317
|
+
export { overwriteCustomConfig as $, isAutomatorProtocolTimeoutError as A, getConfig as B, configureLocaleFromArgv as C, formatAutomatorLoginError as D, connectOpenedAutomator as E, launchAutomator as F, isOperatingSystemSupported as G, resolveDevtoolsAutomationDefaults as H, resolveProjectAutomatorPort as I, logger_default as J, operatingSystemName as K, bootstrapWechatDevtoolsSettings as L, isDevtoolsExtensionContextInvalidatedError as M, isDevtoolsHttpPortError as N, getAutomatorProtocolTimeoutMethod as O, isRetryableAutomatorLaunchError as P, createLocaleConfig as Q, detectWechatDevtoolsServicePort as R, waitForExclusiveKeypress as S, validateLocaleOption as T, SupportedPlatformsMap as U, getConfiguredLocale as V, getDefaultCliPath as W, createAutoTrustProjectConfig as X, createAutoBootstrapDevtoolsConfig as Y, createCustomConfig as Z, promptRetryKeypress as _, releaseSharedMiniProgram as a, createSharedInputSession as b, RETRY_CANCEL_KEYS as c, createWechatIdeLoginRequiredExitError as d, readCustomConfig as et, extractExecutionErrorText as f, isWechatIdeLoginRequiredExitError as g, isWechatIdeLoginRequiredError as h, getSharedMiniProgramSessionCount as i, resolvePath as it, isAutomatorWsConnectError as j, isAutomatorLoginError as k, RETRY_CONFIRM_KEYS as l, formatWechatIdeLoginRequiredError as m, closeSharedMiniProgram as n, defaultCustomConfigDirPath as nt, withMiniProgram$1 as o, formatRetryHotkeyPrompt as p, colors as q, connectMiniProgram as r, defaultCustomConfigFilePath as rt, runRetryableCommand as s, acquireSharedMiniProgram$1 as t, removeCustomConfigKey as tt, RETRY_PROMPT_INITIAL_IGNORE_MS as u, promptWechatIdeLoginRetry as v, i18nText as w, runWithSuspendedSharedInput as x, waitForRetryKeypress as y, resolveCliPath as z };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { $ as parseAutomatorArgs, A as isWechatIdeLoggedIn, B as runWechatCliCommand, C as clearWechatIdeCache, F as quitWechatIde, G as transformArgv, H as execute, K as promptForCliPath, L as resetWechatIdeFileUtils, M as openWechatIde, N as openWechatIdeOtherProject, P as previewWechatIde, Q as startWechatIdeEngineBuildByHttp, S as buildWechatIdeNpm, T as closeWechatIdeProject, U as createAlias, W as createPathCompat, Y as pollWechatIdeEngineBuildResultByHttp, _ as autoPreviewWechatIde, a as navigateBack, b as buildWechatIdeApk, c as pageStack, d as remote, et as readBooleanOption, f as scrollTo, g as tap, i as input, j as loginWechatIde, l as reLaunch, m as systemInfo, n as captureScreenshotBuffer, nt as removeOption, o as navigateTo, p as switchTab, r as currentPage, s as pageData, t as audit, tt as readOptionValue, u as redirectTo, v as autoReplayWechatIde, x as buildWechatIdeIpa, y as autoWechatIde, z as uploadWechatIde } from "./commands-
|
|
3
|
-
import "./run-mcp-
|
|
1
|
+
import { $ as overwriteCustomConfig, C as configureLocaleFromArgv, H as resolveDevtoolsAutomationDefaults, J as logger_default, Q as createLocaleConfig, T as validateLocaleOption, V as getConfiguredLocale, X as createAutoTrustProjectConfig, Y as createAutoBootstrapDevtoolsConfig, Z as createCustomConfig, et as readCustomConfig, q as colors, r as connectMiniProgram, rt as defaultCustomConfigFilePath, tt as removeCustomConfigKey, w as i18nText, z as resolveCliPath } from "./automator-session-JEM5q8tK.js";
|
|
2
|
+
import { $ as parseAutomatorArgs, A as isWechatIdeLoggedIn, B as runWechatCliCommand, C as clearWechatIdeCache, F as quitWechatIde, G as transformArgv, H as execute, K as promptForCliPath, L as resetWechatIdeFileUtils, M as openWechatIde, N as openWechatIdeOtherProject, P as previewWechatIde, Q as startWechatIdeEngineBuildByHttp, S as buildWechatIdeNpm, T as closeWechatIdeProject, U as createAlias, W as createPathCompat, Y as pollWechatIdeEngineBuildResultByHttp, _ as autoPreviewWechatIde, a as navigateBack, b as buildWechatIdeApk, c as pageStack, d as remote, et as readBooleanOption, f as scrollTo, g as tap, i as input, j as loginWechatIde, l as reLaunch, m as systemInfo, n as captureScreenshotBuffer, nt as removeOption, o as navigateTo, p as switchTab, r as currentPage, s as pageData, t as audit, tt as readOptionValue, u as redirectTo, v as autoReplayWechatIde, x as buildWechatIdeIpa, y as autoWechatIde, z as uploadWechatIde } from "./commands-BmMXhKYb.js";
|
|
3
|
+
import "./run-mcp-L4shbBPP.js";
|
|
4
4
|
import fs from "node:fs/promises";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { fs as fs$1 } from "@weapp-core/shared/fs";
|
|
@@ -313,7 +313,7 @@ async function runScreenshot(argv) {
|
|
|
313
313
|
}
|
|
314
314
|
const options = parseScreenshotArgs(argv);
|
|
315
315
|
const isJsonOutput = argv.includes("--json");
|
|
316
|
-
const { takeScreenshot } = await import("./commands-
|
|
316
|
+
const { takeScreenshot } = await import("./commands-CL5B82hV.js");
|
|
317
317
|
const result = await takeScreenshot(options);
|
|
318
318
|
if (isJsonOutput) {
|
|
319
319
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -533,6 +533,24 @@ function validateUnsupportedOptions(command, argv, allowedOptions) {
|
|
|
533
533
|
throw new Error(i18nText(`'${command}' 命令不支持参数 '${optionName}'`, `Command '${command}' does not support option '${optionName}'`));
|
|
534
534
|
}
|
|
535
535
|
}
|
|
536
|
+
function createCommandTimeoutError(command, timeout) {
|
|
537
|
+
const error = new Error(i18nText(`${command} 命令在 ${timeout}ms 内未收到 DevTools 回包,无法连接到当前项目的微信开发者工具自动化 websocket。请确认当前打开的是目标项目;若之前跑过其他 e2e / screenshot 任务,关闭多余的微信开发者工具窗口,或结束残留的 \`wechatwebdevtools cli auto --project ...\` 进程后重试。`, `${command} command did not receive a DevTools response within ${timeout}ms. Cannot connect to the Wechat DevTools automation websocket for the current project. Please confirm the current DevTools window is the target project. If you recently ran other e2e / screenshot tasks, close extra windows or stop stale \`wechatwebdevtools cli auto --project ...\` processes and retry.`));
|
|
538
|
+
error.code = "DEVTOOLS_PROTOCOL_TIMEOUT";
|
|
539
|
+
return error;
|
|
540
|
+
}
|
|
541
|
+
async function runCommandHandlerWithTimeout(command, args, task) {
|
|
542
|
+
const timeout = args.timeout ?? 3e4;
|
|
543
|
+
let timer;
|
|
544
|
+
try {
|
|
545
|
+
await Promise.race([task, new Promise((_, reject) => {
|
|
546
|
+
timer = setTimeout(() => {
|
|
547
|
+
reject(createCommandTimeoutError(command, timeout));
|
|
548
|
+
}, timeout);
|
|
549
|
+
})]);
|
|
550
|
+
} finally {
|
|
551
|
+
if (timer) clearTimeout(timer);
|
|
552
|
+
}
|
|
553
|
+
}
|
|
536
554
|
const COMMAND_DEFINITIONS = {
|
|
537
555
|
"navigate": createDefinition({
|
|
538
556
|
description: {
|
|
@@ -791,10 +809,10 @@ async function runAutomatorCommand(command, argv) {
|
|
|
791
809
|
validateUnsupportedOptions(command, argv, definition.allowedOptions);
|
|
792
810
|
if (await tryRunRuntimeServiceCommand(command, argv)) return;
|
|
793
811
|
const args = parseAutomatorArgs(argv);
|
|
794
|
-
await definition.handler({
|
|
812
|
+
await runCommandHandlerWithTimeout(command, args, definition.handler({
|
|
795
813
|
argv,
|
|
796
814
|
args
|
|
797
|
-
});
|
|
815
|
+
}));
|
|
798
816
|
}
|
|
799
817
|
//#endregion
|
|
800
818
|
//#region src/cli/command-catalog.ts
|
|
@@ -1605,7 +1623,7 @@ async function parse(argv) {
|
|
|
1605
1623
|
return;
|
|
1606
1624
|
}
|
|
1607
1625
|
if (matchedCommand === "mcp") {
|
|
1608
|
-
const { runMcpCommand } = await import("./run-mcp-
|
|
1626
|
+
const { runMcpCommand } = await import("./run-mcp-C0yaUdqC.js");
|
|
1609
1627
|
await runMcpCommand(argv.slice(1));
|
|
1610
1628
|
return;
|
|
1611
1629
|
}
|
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as parse } from "./cli-
|
|
1
|
+
import { J as logger_default } from "./automator-session-JEM5q8tK.js";
|
|
2
|
+
import { n as parse } from "./cli-BRSz3y5e.js";
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
//#region src/cli.ts
|
|
5
5
|
const argv = process.argv.slice(2);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { G as isOperatingSystemSupported, J as logger_default, K as operatingSystemName, L as bootstrapWechatDevtoolsSettings, R as detectWechatDevtoolsServicePort, Z as createCustomConfig, d as createWechatIdeLoginRequiredExitError, et as readCustomConfig, h as isWechatIdeLoginRequiredError, it as resolvePath, n as closeSharedMiniProgram, o as withMiniProgram, q as colors, rt as defaultCustomConfigFilePath, s as runRetryableCommand, v as promptWechatIdeLoginRetry, w as i18nText, x as runWithSuspendedSharedInput, z as resolveCliPath } from "./automator-session-JEM5q8tK.js";
|
|
2
2
|
import { Buffer } from "node:buffer";
|
|
3
3
|
import fs from "node:fs/promises";
|
|
4
4
|
import path from "node:path";
|
|
@@ -757,6 +757,7 @@ function createAutomatorSessionOptions(options) {
|
|
|
757
757
|
return {
|
|
758
758
|
...options.port ? { port: options.port } : {},
|
|
759
759
|
preferOpenedSession: options.preferOpenedSession ?? true,
|
|
760
|
+
preserveProjectRoot: options.preserveProjectRoot,
|
|
760
761
|
projectPath: path.resolve(options.projectPath),
|
|
761
762
|
...options.sessionId ? { sessionId: options.sessionId } : {},
|
|
762
763
|
sharedSession: options.sharedSession ?? true,
|
|
@@ -896,6 +897,9 @@ function withCommandTimeout(task, timeoutMs, message, code) {
|
|
|
896
897
|
});
|
|
897
898
|
});
|
|
898
899
|
}
|
|
900
|
+
function createCurrentPageTimeoutMessage(commandTimeout) {
|
|
901
|
+
return i18nText(`当前页面请求在 ${commandTimeout}ms 内未收到 DevTools 回包,请确认当前打开的是目标项目;若之前跑过其他 e2e / screenshot 任务,关闭多余的微信开发者工具窗口,或结束残留的 \`wechatwebdevtools cli auto --project ...\` 进程后重试。`, `Current page request did not receive a DevTools response within ${commandTimeout}ms. Please confirm the current DevTools window is the target project. If you recently ran other e2e / screenshot tasks, close extra windows or stop stale \`wechatwebdevtools cli auto --project ...\` processes and retry.`);
|
|
902
|
+
}
|
|
899
903
|
function isDevtoolsProtocolTimeoutError(error) {
|
|
900
904
|
if (!(error instanceof Error)) return false;
|
|
901
905
|
return error.message === "DEVTOOLS_PROTOCOL_TIMEOUT" || error.message.includes("DevTools did not respond to protocol method") || Reflect.get(error, "code") === "DEVTOOLS_PROTOCOL_TIMEOUT";
|
|
@@ -979,7 +983,8 @@ async function pageStack(options) {
|
|
|
979
983
|
*/
|
|
980
984
|
async function currentPage(options) {
|
|
981
985
|
return await withMiniProgram(options, async (miniProgram) => {
|
|
982
|
-
const
|
|
986
|
+
const commandTimeout = options.timeout ?? 3e4;
|
|
987
|
+
const result = toPageSnapshot(await withCommandTimeout(miniProgram.currentPage(), commandTimeout, createCurrentPageTimeoutMessage(commandTimeout), "DEVTOOLS_PROTOCOL_TIMEOUT"));
|
|
983
988
|
if (options.json) console.log(JSON.stringify(result, null, 2));
|
|
984
989
|
else logger_default.info(i18nText(`当前页面: ${result.path}${result.query ? ` ${JSON.stringify(result.query)}` : ""}`, `Current page: ${result.path}${result.query ? ` ${JSON.stringify(result.query)}` : ""}`));
|
|
985
990
|
return result;
|
|
@@ -1045,6 +1050,7 @@ async function audit(options) {
|
|
|
1045
1050
|
logger_default.info(i18nText("正在执行体验审计...", "Running experience audit..."));
|
|
1046
1051
|
const result = await miniProgram.stopAudits();
|
|
1047
1052
|
if (options.outputPath) {
|
|
1053
|
+
await fs.mkdir(path.dirname(options.outputPath), { recursive: true });
|
|
1048
1054
|
await fs.writeFile(options.outputPath, JSON.stringify(result, null, 2));
|
|
1049
1055
|
logger_default.success(i18nText(`审计报告已保存到 ${colors.cyan(options.outputPath)}`, `Audit report saved to ${colors.cyan(options.outputPath)}`));
|
|
1050
1056
|
return result;
|
|
@@ -1121,6 +1127,7 @@ async function takeScreenshot(options) {
|
|
|
1121
1127
|
if (!screenshotBuffer) throw new Error(i18nText("截图失败", "Failed to capture screenshot"));
|
|
1122
1128
|
const base64 = screenshotBuffer.toString("base64");
|
|
1123
1129
|
if (options.outputPath) {
|
|
1130
|
+
await fs.mkdir(path.dirname(options.outputPath), { recursive: true });
|
|
1124
1131
|
await fs.writeFile(options.outputPath, screenshotBuffer);
|
|
1125
1132
|
logger_default.success(i18nText(`截图已保存到 ${colors.cyan(options.outputPath)}`, `Screenshot saved to ${colors.cyan(options.outputPath)}`));
|
|
1126
1133
|
return { path: options.outputPath };
|
package/dist/index.d.ts
CHANGED
|
@@ -11,7 +11,13 @@ interface AutomatorOptions {
|
|
|
11
11
|
sessionId?: string;
|
|
12
12
|
trustProject?: boolean;
|
|
13
13
|
preferOpenedSession?: boolean;
|
|
14
|
+
preserveProjectRoot?: boolean;
|
|
15
|
+
persistAsDefaultSession?: boolean;
|
|
14
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* @description 为项目路径派生稳定的 DevTools automator 端口,避免多个 dev:open 项目抢占默认端口。
|
|
19
|
+
*/
|
|
20
|
+
declare function resolveProjectAutomatorPort(projectPath: string): number;
|
|
15
21
|
/**
|
|
16
22
|
* @description 判断错误是否属于开发者工具服务端口不可用。
|
|
17
23
|
*/
|
|
@@ -578,6 +584,7 @@ interface ResetWechatIdeFileUtilsOptions {
|
|
|
578
584
|
interface WechatIdeAutomatorSessionOptions {
|
|
579
585
|
port?: number;
|
|
580
586
|
preferOpenedSession?: boolean;
|
|
587
|
+
preserveProjectRoot?: boolean;
|
|
581
588
|
projectPath: string;
|
|
582
589
|
sessionId?: string;
|
|
583
590
|
sharedSession?: boolean;
|
|
@@ -946,4 +953,4 @@ declare function execute(cliPath: string, argv: string[], options?: ExecuteOptio
|
|
|
946
953
|
*/
|
|
947
954
|
declare function resolvePath(filePath: string): string;
|
|
948
955
|
//#endregion
|
|
949
|
-
export { AUTOMATOR_COMMAND_NAMES, ArgvTransform, AuditOptions, AutoPreviewWechatIdeOptions, AutoReplayWechatIdeOptions, AutoWechatIdeOptions, AutomatorCommandOptions, AutomatorOptions, AutomatorSessionOptions, type BaseConfig, BootstrapWechatDevtoolsSettingsOptions, BootstrapWechatDevtoolsSettingsResult, BuildWechatIdeApkOptions, BuildWechatIdeIpaOptions, BuildWechatIdeNpmOptions, CONFIG_COMMAND_NAME, ClearWechatIdeCacheByAutomatorOptions, ClearWechatIdeCacheOptions, CompileWechatIdeByAutomatorOptions, type ConfigSource, DetectWechatDevtoolsServicePortOptions, DetectWechatDevtoolsServicePortResult, DetectedWechatDevtoolsServicePortSettings, type DevtoolsConnectionInput, type DevtoolsContext, type DevtoolsElementSnapshot, type DevtoolsPageSnapshot, type DevtoolsToolResult, ExclusiveKeypressOptions, ForwardConsoleEvent, ForwardConsoleLogLevel, ForwardConsoleOptions, ForwardConsoleSession, InputOptions, LoginWechatIdeOptions, MCP_COMMAND_NAME, MINIDEV_NAMESPACE_COMMAND_NAMES, McpCommandOptions, MiniProgramElement, type MiniProgramEventMap, MiniProgramLike, MiniProgramPage, NavigateOptions, OpenWechatIdeOptions, OpenWechatIdeOtherProjectOptions, PageDataOptions, PageInfoOptions, ParsedAutomatorArgs, PollWechatIdeEngineBuildResult, PreviewWechatIdeOptions, RETRY_CANCEL_KEYS, RETRY_CONFIRM_KEYS, RETRY_PROMPT_INITIAL_IGNORE_MS, RemoteOptions, ResetWechatIdeFileUtilsOptions, type ResolvedConfig, RetryKeypressOptions, RetryLogger, RetryPromptOptions, RetryPromptResult, RetryableCommandExecutorOptions, RunWechatIdeEngineBuildByHttpOptions, RunWechatIdeEngineBuildOptions, ScreenshotOptions, ScreenshotResult, ScrollOptions, SelectorOptions, SetWechatIdeTicketOptions, SharedInputSession, SharedInputSessionOptions, StartWeappIdeMcpServerOptions, StartWechatIdeEngineBuildResult, SupportedPlatform, SupportedPlatformsMap, TapOptions, UploadWechatIdeOptions, WEAPP_IDE_TOP_LEVEL_COMMAND_NAMES, WECHAT_CLI_COMMAND_NAMES, WECHAT_DEVTOOLS_ENGINE_BUILD_STATUSES, WeappIdeMcpRuntimeHooks, WeappIdeMcpServerHandle, WeappIdeMcpServerOptions, WechatDevtoolsEngineBuildResult, WechatDevtoolsHttpCommandOptions, WechatDevtoolsSecuritySettings, WechatIdeAutomatorSessionOptions, WechatIdeLoginRetryOptions, acquireSharedMiniProgram, audit, autoPreviewWechatIde, autoReplayWechatIde, autoWechatIde, bootstrapWechatDevtoolsSettings, buildWechatIdeApk, buildWechatIdeIpa, buildWechatIdeNpm, captureScreenshotBuffer, clearWechatIdeCache, clearWechatIdeCacheByAutomator, closeSharedMiniProgram, closeWechatIdeProject, compileWechatIdeByAutomator, connectMiniProgram, connectOpenedAutomator, createAlias, createAutoBootstrapDevtoolsConfig, createAutoTrustProjectConfig, createCli, createCustomConfig, createLocaleConfig, createPathCompat, createSharedInputSession, createWeappIdeMcpServer, createWechatIdeLoginRequiredExitError, currentPage, defaultCustomConfigDirPath, defaultCustomConfigFilePath, detectWechatDevtoolsServicePort, dispatchWechatCliCommand, execute, extractExecutionErrorText, formatAutomatorLoginError, formatRetryHotkeyPrompt, formatWechatIdeLoginRequiredError, getAutomatorCommandHelp, getAutomatorProtocolTimeoutMethod, getConfig, getConfiguredLocale, getDefaultCliPath, getSharedMiniProgramSessionCount, getWechatIdeTestAccounts, getWechatIdeTicket, getWechatIdeToolInfo, handleConfigCommand, input, isAutomatorCommand, isAutomatorLoginError, isAutomatorProtocolTimeoutError, isAutomatorWsConnectError, isDevtoolsExtensionContextInvalidatedError, isDevtoolsHttpPortError, isOperatingSystemSupported, isRetryableAutomatorLaunchError, isWeappIdeTopLevelCommand, isWechatIdeEngineBuildEndpointMissingError, isWechatIdeLoggedIn, isWechatIdeLoginRequiredError, isWechatIdeLoginRequiredExitError, launchAutomator, loginWechatIde, navigateBack, navigateTo, openWechatIde, openWechatIdeOtherProject, openWechatIdeProjectByHttp, operatingSystemName, overwriteCustomConfig, pageData, pageStack, parse, parseAutomatorArgs, parseCompareArgs, parseScreenshotArgs, pollWechatIdeEngineBuildResultByHttp, previewWechatIde, printCompareHelp, printScreenshotHelp, promptForCliPath, promptRetryKeypress, promptWechatIdeLoginRetry, quitWechatIde, reLaunch, readBooleanOption, readCustomConfig, readElementSnapshot, readOptionValue, redirectTo, refreshWechatIdeTicket, registerWeappIdeMcpTools, releaseSharedMiniProgram, remote, removeCustomConfigKey, removeOption, requestWechatDevtoolsHttp, resetWechatIdeFileUtils, resetWechatIdeFileUtilsByHttp, resolveCliPath, resolveDevtoolsAutomationDefaults, resolvePath, resolveProjectPath, runAutomatorCommand, runMcpCommand, runMinidev, runRetryableCommand, runWechatCliWithRetry, runWechatIdeEngineBuild, runWechatIdeEngineBuildByHttp, runWithSuspendedSharedInput, scrollTo, setWechatIdeTicket, startForwardConsole, startWeappIdeMcpServer, startWechatIdeEngineBuildByHttp, switchTab, systemInfo, takeScreenshot, tap, toSerializableValue, transformArgv, uploadWechatIde, validateWechatCliCommandArgs, waitForExclusiveKeypress, waitForRetryKeypress, withMiniProgram };
|
|
956
|
+
export { AUTOMATOR_COMMAND_NAMES, ArgvTransform, AuditOptions, AutoPreviewWechatIdeOptions, AutoReplayWechatIdeOptions, AutoWechatIdeOptions, AutomatorCommandOptions, AutomatorOptions, AutomatorSessionOptions, type BaseConfig, BootstrapWechatDevtoolsSettingsOptions, BootstrapWechatDevtoolsSettingsResult, BuildWechatIdeApkOptions, BuildWechatIdeIpaOptions, BuildWechatIdeNpmOptions, CONFIG_COMMAND_NAME, ClearWechatIdeCacheByAutomatorOptions, ClearWechatIdeCacheOptions, CompileWechatIdeByAutomatorOptions, type ConfigSource, DetectWechatDevtoolsServicePortOptions, DetectWechatDevtoolsServicePortResult, DetectedWechatDevtoolsServicePortSettings, type DevtoolsConnectionInput, type DevtoolsContext, type DevtoolsElementSnapshot, type DevtoolsPageSnapshot, type DevtoolsToolResult, ExclusiveKeypressOptions, ForwardConsoleEvent, ForwardConsoleLogLevel, ForwardConsoleOptions, ForwardConsoleSession, InputOptions, LoginWechatIdeOptions, MCP_COMMAND_NAME, MINIDEV_NAMESPACE_COMMAND_NAMES, McpCommandOptions, MiniProgramElement, type MiniProgramEventMap, MiniProgramLike, MiniProgramPage, NavigateOptions, OpenWechatIdeOptions, OpenWechatIdeOtherProjectOptions, PageDataOptions, PageInfoOptions, ParsedAutomatorArgs, PollWechatIdeEngineBuildResult, PreviewWechatIdeOptions, RETRY_CANCEL_KEYS, RETRY_CONFIRM_KEYS, RETRY_PROMPT_INITIAL_IGNORE_MS, RemoteOptions, ResetWechatIdeFileUtilsOptions, type ResolvedConfig, RetryKeypressOptions, RetryLogger, RetryPromptOptions, RetryPromptResult, RetryableCommandExecutorOptions, RunWechatIdeEngineBuildByHttpOptions, RunWechatIdeEngineBuildOptions, ScreenshotOptions, ScreenshotResult, ScrollOptions, SelectorOptions, SetWechatIdeTicketOptions, SharedInputSession, SharedInputSessionOptions, StartWeappIdeMcpServerOptions, StartWechatIdeEngineBuildResult, SupportedPlatform, SupportedPlatformsMap, TapOptions, UploadWechatIdeOptions, WEAPP_IDE_TOP_LEVEL_COMMAND_NAMES, WECHAT_CLI_COMMAND_NAMES, WECHAT_DEVTOOLS_ENGINE_BUILD_STATUSES, WeappIdeMcpRuntimeHooks, WeappIdeMcpServerHandle, WeappIdeMcpServerOptions, WechatDevtoolsEngineBuildResult, WechatDevtoolsHttpCommandOptions, WechatDevtoolsSecuritySettings, WechatIdeAutomatorSessionOptions, WechatIdeLoginRetryOptions, acquireSharedMiniProgram, audit, autoPreviewWechatIde, autoReplayWechatIde, autoWechatIde, bootstrapWechatDevtoolsSettings, buildWechatIdeApk, buildWechatIdeIpa, buildWechatIdeNpm, captureScreenshotBuffer, clearWechatIdeCache, clearWechatIdeCacheByAutomator, closeSharedMiniProgram, closeWechatIdeProject, compileWechatIdeByAutomator, connectMiniProgram, connectOpenedAutomator, createAlias, createAutoBootstrapDevtoolsConfig, createAutoTrustProjectConfig, createCli, createCustomConfig, createLocaleConfig, createPathCompat, createSharedInputSession, createWeappIdeMcpServer, createWechatIdeLoginRequiredExitError, currentPage, defaultCustomConfigDirPath, defaultCustomConfigFilePath, detectWechatDevtoolsServicePort, dispatchWechatCliCommand, execute, extractExecutionErrorText, formatAutomatorLoginError, formatRetryHotkeyPrompt, formatWechatIdeLoginRequiredError, getAutomatorCommandHelp, getAutomatorProtocolTimeoutMethod, getConfig, getConfiguredLocale, getDefaultCliPath, getSharedMiniProgramSessionCount, getWechatIdeTestAccounts, getWechatIdeTicket, getWechatIdeToolInfo, handleConfigCommand, input, isAutomatorCommand, isAutomatorLoginError, isAutomatorProtocolTimeoutError, isAutomatorWsConnectError, isDevtoolsExtensionContextInvalidatedError, isDevtoolsHttpPortError, isOperatingSystemSupported, isRetryableAutomatorLaunchError, isWeappIdeTopLevelCommand, isWechatIdeEngineBuildEndpointMissingError, isWechatIdeLoggedIn, isWechatIdeLoginRequiredError, isWechatIdeLoginRequiredExitError, launchAutomator, loginWechatIde, navigateBack, navigateTo, openWechatIde, openWechatIdeOtherProject, openWechatIdeProjectByHttp, operatingSystemName, overwriteCustomConfig, pageData, pageStack, parse, parseAutomatorArgs, parseCompareArgs, parseScreenshotArgs, pollWechatIdeEngineBuildResultByHttp, previewWechatIde, printCompareHelp, printScreenshotHelp, promptForCliPath, promptRetryKeypress, promptWechatIdeLoginRetry, quitWechatIde, reLaunch, readBooleanOption, readCustomConfig, readElementSnapshot, readOptionValue, redirectTo, refreshWechatIdeTicket, registerWeappIdeMcpTools, releaseSharedMiniProgram, remote, removeCustomConfigKey, removeOption, requestWechatDevtoolsHttp, resetWechatIdeFileUtils, resetWechatIdeFileUtilsByHttp, resolveCliPath, resolveDevtoolsAutomationDefaults, resolvePath, resolveProjectAutomatorPort, resolveProjectPath, runAutomatorCommand, runMcpCommand, runMinidev, runRetryableCommand, runWechatCliWithRetry, runWechatIdeEngineBuild, runWechatIdeEngineBuildByHttp, runWithSuspendedSharedInput, scrollTo, setWechatIdeTicket, startForwardConsole, startWeappIdeMcpServer, startWechatIdeEngineBuildByHttp, switchTab, systemInfo, takeScreenshot, tap, toSerializableValue, transformArgv, uploadWechatIde, validateWechatCliCommandArgs, waitForExclusiveKeypress, waitForRetryKeypress, withMiniProgram };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { $ as parseAutomatorArgs, A as isWechatIdeLoggedIn, C as clearWechatIdeCache, D as getWechatIdeTestAccounts, E as compileWechatIdeByAutomator, F as quitWechatIde, G as transformArgv, H as execute, I as refreshWechatIdeTicket, J as openWechatIdeProjectByHttp, K as promptForCliPath, L as resetWechatIdeFileUtils, M as openWechatIde, N as openWechatIdeOtherProject, O as getWechatIdeTicket, P as previewWechatIde, Q as startWechatIdeEngineBuildByHttp, R as setWechatIdeTicket, S as buildWechatIdeNpm, T as closeWechatIdeProject, U as createAlias, V as runWechatCliWithRetry, W as createPathCompat, X as requestWechatDevtoolsHttp, Y as pollWechatIdeEngineBuildResultByHttp, Z as resetWechatIdeFileUtilsByHttp, _ as autoPreviewWechatIde, a as navigateBack, b as buildWechatIdeApk, c as pageStack, d as remote, et as readBooleanOption, f as scrollTo, g as tap, h as takeScreenshot, i as input, j as loginWechatIde, k as getWechatIdeToolInfo, l as reLaunch, m as systemInfo, n as captureScreenshotBuffer, nt as removeOption, o as navigateTo, p as switchTab, q as WECHAT_DEVTOOLS_ENGINE_BUILD_STATUSES, r as currentPage, s as pageData, t as audit, tt as readOptionValue, u as redirectTo, v as autoReplayWechatIde, w as clearWechatIdeCacheByAutomator, x as buildWechatIdeIpa, y as autoWechatIde, z as uploadWechatIde } from "./commands-
|
|
3
|
-
import { C as parseCompareArgs, S as printScreenshotHelp, _ as AUTOMATOR_COMMAND_NAMES, a as runMinidev, b as runAutomatorCommand, c as runWechatIdeEngineBuild, d as CONFIG_COMMAND_NAME, f as MCP_COMMAND_NAME, g as isWeappIdeTopLevelCommand, h as WECHAT_CLI_COMMAND_NAMES, i as validateWechatCliCommandArgs, l as runWechatIdeEngineBuildByHttp, m as WEAPP_IDE_TOP_LEVEL_COMMAND_NAMES, n as parse, o as startForwardConsole, p as MINIDEV_NAMESPACE_COMMAND_NAMES, r as dispatchWechatCliCommand, s as isWechatIdeEngineBuildEndpointMissingError, t as createCli, u as handleConfigCommand, v as getAutomatorCommandHelp, w as printCompareHelp, x as parseScreenshotArgs, y as isAutomatorCommand } from "./cli-
|
|
4
|
-
import { a as readElementSnapshot, i as registerWeappIdeMcpTools, n as startWeappIdeMcpServer, o as resolveProjectPath, r as createWeappIdeMcpServer, s as toSerializableValue, t as runMcpCommand } from "./run-mcp-
|
|
5
|
-
export { AUTOMATOR_COMMAND_NAMES, CONFIG_COMMAND_NAME, MCP_COMMAND_NAME, MINIDEV_NAMESPACE_COMMAND_NAMES, RETRY_CANCEL_KEYS, RETRY_CONFIRM_KEYS, RETRY_PROMPT_INITIAL_IGNORE_MS, SupportedPlatformsMap, WEAPP_IDE_TOP_LEVEL_COMMAND_NAMES, WECHAT_CLI_COMMAND_NAMES, WECHAT_DEVTOOLS_ENGINE_BUILD_STATUSES, acquireSharedMiniProgram, audit, autoPreviewWechatIde, autoReplayWechatIde, autoWechatIde, bootstrapWechatDevtoolsSettings, buildWechatIdeApk, buildWechatIdeIpa, buildWechatIdeNpm, captureScreenshotBuffer, clearWechatIdeCache, clearWechatIdeCacheByAutomator, closeSharedMiniProgram, closeWechatIdeProject, compileWechatIdeByAutomator, connectMiniProgram, connectOpenedAutomator, createAlias, createAutoBootstrapDevtoolsConfig, createAutoTrustProjectConfig, createCli, createCustomConfig, createLocaleConfig, createPathCompat, createSharedInputSession, createWeappIdeMcpServer, createWechatIdeLoginRequiredExitError, currentPage, defaultCustomConfigDirPath, defaultCustomConfigFilePath, detectWechatDevtoolsServicePort, dispatchWechatCliCommand, execute, extractExecutionErrorText, formatAutomatorLoginError, formatRetryHotkeyPrompt, formatWechatIdeLoginRequiredError, getAutomatorCommandHelp, getAutomatorProtocolTimeoutMethod, getConfig, getConfiguredLocale, getDefaultCliPath, getSharedMiniProgramSessionCount, getWechatIdeTestAccounts, getWechatIdeTicket, getWechatIdeToolInfo, handleConfigCommand, input, isAutomatorCommand, isAutomatorLoginError, isAutomatorProtocolTimeoutError, isAutomatorWsConnectError, isDevtoolsExtensionContextInvalidatedError, isDevtoolsHttpPortError, isOperatingSystemSupported, isRetryableAutomatorLaunchError, isWeappIdeTopLevelCommand, isWechatIdeEngineBuildEndpointMissingError, isWechatIdeLoggedIn, isWechatIdeLoginRequiredError, isWechatIdeLoginRequiredExitError, launchAutomator, loginWechatIde, navigateBack, navigateTo, openWechatIde, openWechatIdeOtherProject, openWechatIdeProjectByHttp, operatingSystemName, overwriteCustomConfig, pageData, pageStack, parse, parseAutomatorArgs, parseCompareArgs, parseScreenshotArgs, pollWechatIdeEngineBuildResultByHttp, previewWechatIde, printCompareHelp, printScreenshotHelp, promptForCliPath, promptRetryKeypress, promptWechatIdeLoginRetry, quitWechatIde, reLaunch, readBooleanOption, readCustomConfig, readElementSnapshot, readOptionValue, redirectTo, refreshWechatIdeTicket, registerWeappIdeMcpTools, releaseSharedMiniProgram, remote, removeCustomConfigKey, removeOption, requestWechatDevtoolsHttp, resetWechatIdeFileUtils, resetWechatIdeFileUtilsByHttp, resolveCliPath, resolveDevtoolsAutomationDefaults, resolvePath, resolveProjectPath, runAutomatorCommand, runMcpCommand, runMinidev, runRetryableCommand, runWechatCliWithRetry, runWechatIdeEngineBuild, runWechatIdeEngineBuildByHttp, runWithSuspendedSharedInput, scrollTo, setWechatIdeTicket, startForwardConsole, startWeappIdeMcpServer, startWechatIdeEngineBuildByHttp, switchTab, systemInfo, takeScreenshot, tap, toSerializableValue, transformArgv, uploadWechatIde, validateWechatCliCommandArgs, waitForExclusiveKeypress, waitForRetryKeypress, withMiniProgram };
|
|
1
|
+
import { $ as overwriteCustomConfig, A as isAutomatorProtocolTimeoutError, B as getConfig, D as formatAutomatorLoginError, E as connectOpenedAutomator, F as launchAutomator, G as isOperatingSystemSupported, H as resolveDevtoolsAutomationDefaults, I as resolveProjectAutomatorPort, K as operatingSystemName, L as bootstrapWechatDevtoolsSettings, M as isDevtoolsExtensionContextInvalidatedError, N as isDevtoolsHttpPortError, O as getAutomatorProtocolTimeoutMethod, P as isRetryableAutomatorLaunchError, Q as createLocaleConfig, R as detectWechatDevtoolsServicePort, S as waitForExclusiveKeypress, U as SupportedPlatformsMap, V as getConfiguredLocale, W as getDefaultCliPath, X as createAutoTrustProjectConfig, Y as createAutoBootstrapDevtoolsConfig, Z as createCustomConfig, _ as promptRetryKeypress, a as releaseSharedMiniProgram, b as createSharedInputSession, c as RETRY_CANCEL_KEYS, d as createWechatIdeLoginRequiredExitError, et as readCustomConfig, f as extractExecutionErrorText, g as isWechatIdeLoginRequiredExitError, h as isWechatIdeLoginRequiredError, i as getSharedMiniProgramSessionCount, it as resolvePath, j as isAutomatorWsConnectError, k as isAutomatorLoginError, l as RETRY_CONFIRM_KEYS, m as formatWechatIdeLoginRequiredError, n as closeSharedMiniProgram, nt as defaultCustomConfigDirPath, o as withMiniProgram, p as formatRetryHotkeyPrompt, r as connectMiniProgram, rt as defaultCustomConfigFilePath, s as runRetryableCommand, t as acquireSharedMiniProgram, tt as removeCustomConfigKey, u as RETRY_PROMPT_INITIAL_IGNORE_MS, v as promptWechatIdeLoginRetry, x as runWithSuspendedSharedInput, y as waitForRetryKeypress, z as resolveCliPath } from "./automator-session-JEM5q8tK.js";
|
|
2
|
+
import { $ as parseAutomatorArgs, A as isWechatIdeLoggedIn, C as clearWechatIdeCache, D as getWechatIdeTestAccounts, E as compileWechatIdeByAutomator, F as quitWechatIde, G as transformArgv, H as execute, I as refreshWechatIdeTicket, J as openWechatIdeProjectByHttp, K as promptForCliPath, L as resetWechatIdeFileUtils, M as openWechatIde, N as openWechatIdeOtherProject, O as getWechatIdeTicket, P as previewWechatIde, Q as startWechatIdeEngineBuildByHttp, R as setWechatIdeTicket, S as buildWechatIdeNpm, T as closeWechatIdeProject, U as createAlias, V as runWechatCliWithRetry, W as createPathCompat, X as requestWechatDevtoolsHttp, Y as pollWechatIdeEngineBuildResultByHttp, Z as resetWechatIdeFileUtilsByHttp, _ as autoPreviewWechatIde, a as navigateBack, b as buildWechatIdeApk, c as pageStack, d as remote, et as readBooleanOption, f as scrollTo, g as tap, h as takeScreenshot, i as input, j as loginWechatIde, k as getWechatIdeToolInfo, l as reLaunch, m as systemInfo, n as captureScreenshotBuffer, nt as removeOption, o as navigateTo, p as switchTab, q as WECHAT_DEVTOOLS_ENGINE_BUILD_STATUSES, r as currentPage, s as pageData, t as audit, tt as readOptionValue, u as redirectTo, v as autoReplayWechatIde, w as clearWechatIdeCacheByAutomator, x as buildWechatIdeIpa, y as autoWechatIde, z as uploadWechatIde } from "./commands-BmMXhKYb.js";
|
|
3
|
+
import { C as parseCompareArgs, S as printScreenshotHelp, _ as AUTOMATOR_COMMAND_NAMES, a as runMinidev, b as runAutomatorCommand, c as runWechatIdeEngineBuild, d as CONFIG_COMMAND_NAME, f as MCP_COMMAND_NAME, g as isWeappIdeTopLevelCommand, h as WECHAT_CLI_COMMAND_NAMES, i as validateWechatCliCommandArgs, l as runWechatIdeEngineBuildByHttp, m as WEAPP_IDE_TOP_LEVEL_COMMAND_NAMES, n as parse, o as startForwardConsole, p as MINIDEV_NAMESPACE_COMMAND_NAMES, r as dispatchWechatCliCommand, s as isWechatIdeEngineBuildEndpointMissingError, t as createCli, u as handleConfigCommand, v as getAutomatorCommandHelp, w as printCompareHelp, x as parseScreenshotArgs, y as isAutomatorCommand } from "./cli-BRSz3y5e.js";
|
|
4
|
+
import { a as readElementSnapshot, i as registerWeappIdeMcpTools, n as startWeappIdeMcpServer, o as resolveProjectPath, r as createWeappIdeMcpServer, s as toSerializableValue, t as runMcpCommand } from "./run-mcp-L4shbBPP.js";
|
|
5
|
+
export { AUTOMATOR_COMMAND_NAMES, CONFIG_COMMAND_NAME, MCP_COMMAND_NAME, MINIDEV_NAMESPACE_COMMAND_NAMES, RETRY_CANCEL_KEYS, RETRY_CONFIRM_KEYS, RETRY_PROMPT_INITIAL_IGNORE_MS, SupportedPlatformsMap, WEAPP_IDE_TOP_LEVEL_COMMAND_NAMES, WECHAT_CLI_COMMAND_NAMES, WECHAT_DEVTOOLS_ENGINE_BUILD_STATUSES, acquireSharedMiniProgram, audit, autoPreviewWechatIde, autoReplayWechatIde, autoWechatIde, bootstrapWechatDevtoolsSettings, buildWechatIdeApk, buildWechatIdeIpa, buildWechatIdeNpm, captureScreenshotBuffer, clearWechatIdeCache, clearWechatIdeCacheByAutomator, closeSharedMiniProgram, closeWechatIdeProject, compileWechatIdeByAutomator, connectMiniProgram, connectOpenedAutomator, createAlias, createAutoBootstrapDevtoolsConfig, createAutoTrustProjectConfig, createCli, createCustomConfig, createLocaleConfig, createPathCompat, createSharedInputSession, createWeappIdeMcpServer, createWechatIdeLoginRequiredExitError, currentPage, defaultCustomConfigDirPath, defaultCustomConfigFilePath, detectWechatDevtoolsServicePort, dispatchWechatCliCommand, execute, extractExecutionErrorText, formatAutomatorLoginError, formatRetryHotkeyPrompt, formatWechatIdeLoginRequiredError, getAutomatorCommandHelp, getAutomatorProtocolTimeoutMethod, getConfig, getConfiguredLocale, getDefaultCliPath, getSharedMiniProgramSessionCount, getWechatIdeTestAccounts, getWechatIdeTicket, getWechatIdeToolInfo, handleConfigCommand, input, isAutomatorCommand, isAutomatorLoginError, isAutomatorProtocolTimeoutError, isAutomatorWsConnectError, isDevtoolsExtensionContextInvalidatedError, isDevtoolsHttpPortError, isOperatingSystemSupported, isRetryableAutomatorLaunchError, isWeappIdeTopLevelCommand, isWechatIdeEngineBuildEndpointMissingError, isWechatIdeLoggedIn, isWechatIdeLoginRequiredError, isWechatIdeLoginRequiredExitError, launchAutomator, loginWechatIde, navigateBack, navigateTo, openWechatIde, openWechatIdeOtherProject, openWechatIdeProjectByHttp, operatingSystemName, overwriteCustomConfig, pageData, pageStack, parse, parseAutomatorArgs, parseCompareArgs, parseScreenshotArgs, pollWechatIdeEngineBuildResultByHttp, previewWechatIde, printCompareHelp, printScreenshotHelp, promptForCliPath, promptRetryKeypress, promptWechatIdeLoginRetry, quitWechatIde, reLaunch, readBooleanOption, readCustomConfig, readElementSnapshot, readOptionValue, redirectTo, refreshWechatIdeTicket, registerWeappIdeMcpTools, releaseSharedMiniProgram, remote, removeCustomConfigKey, removeOption, requestWechatDevtoolsHttp, resetWechatIdeFileUtils, resetWechatIdeFileUtilsByHttp, resolveCliPath, resolveDevtoolsAutomationDefaults, resolvePath, resolveProjectAutomatorPort, resolveProjectPath, runAutomatorCommand, runMcpCommand, runMinidev, runRetryableCommand, runWechatCliWithRetry, runWechatIdeEngineBuild, runWechatIdeEngineBuildByHttp, runWithSuspendedSharedInput, scrollTo, setWechatIdeTicket, startForwardConsole, startWeappIdeMcpServer, startWechatIdeEngineBuildByHttp, switchTab, systemInfo, takeScreenshot, tap, toSerializableValue, transformArgv, uploadWechatIde, validateWechatCliCommandArgs, waitForExclusiveKeypress, waitForRetryKeypress, withMiniProgram };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-ide-cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.4.
|
|
4
|
+
"version": "5.4.4",
|
|
5
5
|
"description": "让微信开发者工具,用起来更加方便!",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"zod": "^4.4.3",
|
|
72
72
|
"@weapp-core/logger": "3.1.1",
|
|
73
73
|
"@weapp-core/shared": "3.0.4",
|
|
74
|
-
"@weapp-vite/devtools-runtime": "0.4.
|
|
74
|
+
"@weapp-vite/devtools-runtime": "0.4.3",
|
|
75
75
|
"@weapp-vite/miniprogram-automator": "1.2.2"
|
|
76
76
|
},
|
|
77
77
|
"scripts": {
|
package/dist/run-mcp-CL909GLy.js
DELETED