weapp-ide-cli 5.3.2 → 5.4.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.
- package/dist/{automator-session-BZzODsJi.js → automator-session-RrZjw3X5.js} +32 -16
- package/dist/{cli-B45DqpiD.js → cli-_qia2--1.js} +54 -9
- package/dist/cli.js +2 -2
- package/dist/commands-D_j5_0eE.js +2 -0
- package/dist/{commands-BynZfUJ6.js → commands-fWDebiQq.js} +4 -2
- package/dist/index.d.ts +11 -1
- package/dist/index.js +5 -5
- package/dist/{run-mcp-TnooVQe8.js → run-mcp-By4qRg8l.js} +6 -2
- package/dist/run-mcp-CTk4KA3y.js +2 -0
- package/package.json +3 -3
- package/dist/commands-DG-3Zgd0.js +0 -2
- package/dist/run-mcp-DhujWgfX.js +0 -2
|
@@ -532,34 +532,44 @@ function extractErrorText(error) {
|
|
|
532
532
|
candidate.stdout
|
|
533
533
|
].filter((value) => typeof value === "string" && value.trim().length > 0).join("\n");
|
|
534
534
|
}
|
|
535
|
-
function
|
|
535
|
+
function normalizeAutomatorSessionId(sessionId, port) {
|
|
536
|
+
if (sessionId?.trim()) return sessionId.trim();
|
|
537
|
+
return port ? `port-${port}` : "default";
|
|
538
|
+
}
|
|
539
|
+
function resolveAutomatorSessionFilePath(projectPath, sessionId, port) {
|
|
536
540
|
const normalizedProjectPath = path.resolve(projectPath);
|
|
537
|
-
const
|
|
541
|
+
const normalizedSessionId = normalizeAutomatorSessionId(sessionId, port);
|
|
542
|
+
const sessionKey = normalizedSessionId === "default" ? normalizedProjectPath : `${normalizedProjectPath}#${normalizedSessionId}`;
|
|
543
|
+
const encodedProjectPath = Buffer.from(sessionKey).toString("base64url");
|
|
538
544
|
return path.join(AUTOMATOR_SESSION_DIR, `${encodedProjectPath}.json`);
|
|
539
545
|
}
|
|
540
|
-
async function persistAutomatorSession(
|
|
541
|
-
const filePath = resolveAutomatorSessionFilePath(projectPath);
|
|
546
|
+
async function persistAutomatorSession(options) {
|
|
547
|
+
const filePath = resolveAutomatorSessionFilePath(options.projectPath, options.sessionId, options.port);
|
|
542
548
|
const payload = {
|
|
543
|
-
|
|
549
|
+
...options.port ? { port: options.port } : {},
|
|
550
|
+
projectPath: path.resolve(options.projectPath),
|
|
551
|
+
...options.sessionId ? { sessionId: options.sessionId } : {},
|
|
544
552
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
545
|
-
wsEndpoint
|
|
553
|
+
wsEndpoint: options.wsEndpoint
|
|
546
554
|
};
|
|
547
555
|
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
548
556
|
await fs.writeFile(filePath, JSON.stringify(payload, null, 2), "utf8");
|
|
549
557
|
}
|
|
550
|
-
async function readPersistedAutomatorSession(projectPath) {
|
|
551
|
-
const filePath = resolveAutomatorSessionFilePath(projectPath);
|
|
558
|
+
async function readPersistedAutomatorSession(projectPath, sessionId, port) {
|
|
559
|
+
const filePath = resolveAutomatorSessionFilePath(projectPath, sessionId, port);
|
|
552
560
|
try {
|
|
553
561
|
const raw = await fs.readFile(filePath, "utf8");
|
|
554
562
|
const payload = JSON.parse(raw);
|
|
555
563
|
if (payload.projectPath !== path.resolve(projectPath) || typeof payload.wsEndpoint !== "string" || !payload.wsEndpoint.trim()) return null;
|
|
564
|
+
if (sessionId && payload.sessionId !== sessionId) return null;
|
|
565
|
+
if (port && payload.port !== port) return null;
|
|
556
566
|
return payload;
|
|
557
567
|
} catch {
|
|
558
568
|
return null;
|
|
559
569
|
}
|
|
560
570
|
}
|
|
561
|
-
async function removePersistedAutomatorSession(projectPath) {
|
|
562
|
-
const filePath = resolveAutomatorSessionFilePath(projectPath);
|
|
571
|
+
async function removePersistedAutomatorSession(projectPath, sessionId, port) {
|
|
572
|
+
const filePath = resolveAutomatorSessionFilePath(projectPath, sessionId, port);
|
|
563
573
|
try {
|
|
564
574
|
await fs.rm(filePath, { force: true });
|
|
565
575
|
} catch {}
|
|
@@ -642,7 +652,7 @@ function formatAutomatorLoginError(error) {
|
|
|
642
652
|
* @description 基于当前配置解析 CLI 路径,并通过现代化 automator 入口启动会话。
|
|
643
653
|
*/
|
|
644
654
|
async function launchAutomator(options) {
|
|
645
|
-
const { cliPath, projectPath, timeout = 3e4 } = options;
|
|
655
|
+
const { cliPath, port, projectPath, sessionId, timeout = 3e4 } = options;
|
|
646
656
|
const resolvedCliPath = cliPath ?? (await resolveCliPath()).cliPath ?? void 0;
|
|
647
657
|
const config = await readCustomConfig();
|
|
648
658
|
const resolvedTrustProject = options.trustProject ?? config.autoTrustProject ?? false;
|
|
@@ -657,12 +667,18 @@ async function launchAutomator(options) {
|
|
|
657
667
|
for (let attempt = 0; attempt < 2; attempt += 1) try {
|
|
658
668
|
const miniProgram = await launcher.launch({
|
|
659
669
|
cliPath: resolvedCliPath,
|
|
670
|
+
...port ? { port } : {},
|
|
660
671
|
projectPath,
|
|
661
672
|
timeout,
|
|
662
673
|
trustProject: resolvedTrustProject
|
|
663
674
|
});
|
|
664
675
|
const sessionMetadata = Reflect.get(miniProgram, "__WEAPP_VITE_SESSION_METADATA");
|
|
665
|
-
if (typeof sessionMetadata?.wsEndpoint === "string" && sessionMetadata.wsEndpoint) await persistAutomatorSession(
|
|
676
|
+
if (typeof sessionMetadata?.wsEndpoint === "string" && sessionMetadata.wsEndpoint) await persistAutomatorSession({
|
|
677
|
+
port: sessionMetadata.port ?? port,
|
|
678
|
+
projectPath,
|
|
679
|
+
sessionId,
|
|
680
|
+
wsEndpoint: sessionMetadata.wsEndpoint
|
|
681
|
+
});
|
|
666
682
|
return miniProgram;
|
|
667
683
|
} catch (error) {
|
|
668
684
|
lastError = error;
|
|
@@ -674,14 +690,14 @@ async function launchAutomator(options) {
|
|
|
674
690
|
* @description 连接当前项目已打开的开发者工具自动化会话,不触发新的 IDE 拉起。
|
|
675
691
|
*/
|
|
676
692
|
async function connectOpenedAutomator(options) {
|
|
677
|
-
const { projectPath } = options;
|
|
693
|
+
const { port, projectPath, sessionId } = options;
|
|
678
694
|
const launcher = new Launcher();
|
|
679
|
-
const persistedSession = await readPersistedAutomatorSession(projectPath);
|
|
680
|
-
const wsEndpoint = persistedSession?.wsEndpoint ?? DEFAULT_WECHAT_DEVTOOLS_WS_ENDPOINT;
|
|
695
|
+
const persistedSession = await readPersistedAutomatorSession(projectPath, sessionId, port);
|
|
696
|
+
const wsEndpoint = persistedSession?.wsEndpoint ?? (port ? `ws://127.0.0.1:${port}` : DEFAULT_WECHAT_DEVTOOLS_WS_ENDPOINT);
|
|
681
697
|
try {
|
|
682
698
|
return await launcher.connect({ wsEndpoint });
|
|
683
699
|
} catch (error) {
|
|
684
|
-
if (persistedSession) await removePersistedAutomatorSession(projectPath);
|
|
700
|
+
if (persistedSession) await removePersistedAutomatorSession(projectPath, sessionId, port);
|
|
685
701
|
throw error;
|
|
686
702
|
}
|
|
687
703
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as colors, B as defaultCustomConfigFilePath, F as createLocaleConfig, I as overwriteCustomConfig, L as readCustomConfig, M as createAutoBootstrapDevtoolsConfig, N as createAutoTrustProjectConfig, O as isOperatingSystemSupported, P as createCustomConfig, R as removeCustomConfigKey, S as resolveCliPath, T as resolveDevtoolsAutomationDefaults, V as resolvePath, b as bootstrapWechatDevtoolsSettings, c as i18nText, j as logger_default, k as operatingSystemName, l as validateLocaleOption, o as withMiniProgram, r as connectMiniProgram, s as configureLocaleFromArgv, w as getConfiguredLocale, x as detectWechatDevtoolsServicePort } from "./automator-session-
|
|
2
|
-
import { a as navigateBack, c as pageStack, d as remote, f as scrollTo, g as tap, i as input, l as reLaunch, m as systemInfo, n as captureScreenshotBuffer, o as navigateTo, p as switchTab, r as currentPage, s as pageData, t as audit, u as redirectTo } from "./commands-
|
|
3
|
-
import "./run-mcp-
|
|
1
|
+
import { A as colors, B as defaultCustomConfigFilePath, F as createLocaleConfig, I as overwriteCustomConfig, L as readCustomConfig, M as createAutoBootstrapDevtoolsConfig, N as createAutoTrustProjectConfig, O as isOperatingSystemSupported, P as createCustomConfig, R as removeCustomConfigKey, S as resolveCliPath, T as resolveDevtoolsAutomationDefaults, V as resolvePath, b as bootstrapWechatDevtoolsSettings, c as i18nText, j as logger_default, k as operatingSystemName, l as validateLocaleOption, o as withMiniProgram, r as connectMiniProgram, s as configureLocaleFromArgv, w as getConfiguredLocale, x as detectWechatDevtoolsServicePort } from "./automator-session-RrZjw3X5.js";
|
|
2
|
+
import { a as navigateBack, c as pageStack, d as remote, f as scrollTo, g as tap, i as input, l as reLaunch, m as systemInfo, n as captureScreenshotBuffer, o as navigateTo, p as switchTab, r as currentPage, s as pageData, t as audit, u as redirectTo } from "./commands-fWDebiQq.js";
|
|
3
|
+
import "./run-mcp-By4qRg8l.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";
|
|
@@ -19,7 +19,7 @@ function parsePositiveInt(raw) {
|
|
|
19
19
|
return value;
|
|
20
20
|
}
|
|
21
21
|
function takesValue(optionName) {
|
|
22
|
-
return optionName === "-p" || optionName === "--project" || optionName === "-t" || optionName === "--timeout" || optionName === "-o" || optionName === "--output" || optionName === "--page" || optionName === "--login-retry" || optionName === "--login-retry-timeout" || optionName === "--lang" || optionName === "--platform" || optionName === "--runtime-url" || optionName === "--qr-output" || optionName === "-r" || optionName === "--result-output" || optionName === "--info-output" || optionName === "-i";
|
|
22
|
+
return optionName === "-p" || optionName === "--project" || optionName === "-t" || optionName === "--timeout" || optionName === "--port" || optionName === "--session-id" || optionName === "-o" || optionName === "--output" || optionName === "--page" || optionName === "--login-retry" || optionName === "--login-retry-timeout" || optionName === "--lang" || optionName === "--platform" || optionName === "--runtime-url" || optionName === "--qr-output" || optionName === "-r" || optionName === "--result-output" || optionName === "--info-output" || optionName === "-i";
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* @description 解析 automator 命令通用参数与位置参数。
|
|
@@ -28,6 +28,8 @@ function parseAutomatorArgs(argv) {
|
|
|
28
28
|
const positionals = [];
|
|
29
29
|
let projectPath = process.cwd();
|
|
30
30
|
let timeout;
|
|
31
|
+
let port;
|
|
32
|
+
let sessionId;
|
|
31
33
|
let json = false;
|
|
32
34
|
for (let index = 0; index < argv.length; index += 1) {
|
|
33
35
|
const token = argv[index];
|
|
@@ -56,6 +58,30 @@ function parseAutomatorArgs(argv) {
|
|
|
56
58
|
timeout = parsePositiveInt(token.slice(10));
|
|
57
59
|
continue;
|
|
58
60
|
}
|
|
61
|
+
if (token === "--port") {
|
|
62
|
+
const value = argv[index + 1];
|
|
63
|
+
if (typeof value === "string") {
|
|
64
|
+
port = parsePositiveInt(value);
|
|
65
|
+
index += 1;
|
|
66
|
+
}
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
if (token.startsWith("--port=")) {
|
|
70
|
+
port = parsePositiveInt(token.slice(7));
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
if (token === "--session-id") {
|
|
74
|
+
const value = argv[index + 1];
|
|
75
|
+
if (typeof value === "string" && !value.startsWith("-")) {
|
|
76
|
+
sessionId = value.trim() || void 0;
|
|
77
|
+
index += 1;
|
|
78
|
+
}
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
if (token.startsWith("--session-id=")) {
|
|
82
|
+
sessionId = token.slice(13).trim() || void 0;
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
59
85
|
if (token === "--json") {
|
|
60
86
|
json = true;
|
|
61
87
|
continue;
|
|
@@ -71,7 +97,9 @@ function parseAutomatorArgs(argv) {
|
|
|
71
97
|
}
|
|
72
98
|
return {
|
|
73
99
|
projectPath,
|
|
74
|
-
timeout,
|
|
100
|
+
...timeout ? { timeout } : {},
|
|
101
|
+
...port ? { port } : {},
|
|
102
|
+
...sessionId ? { sessionId } : {},
|
|
75
103
|
json,
|
|
76
104
|
positionals
|
|
77
105
|
};
|
|
@@ -272,6 +300,8 @@ function parseCompareArgs(argv) {
|
|
|
272
300
|
return {
|
|
273
301
|
projectPath: parsed.projectPath,
|
|
274
302
|
timeout: parsed.timeout,
|
|
303
|
+
...parsed.port ? { port: parsed.port } : {},
|
|
304
|
+
...parsed.sessionId ? { sessionId: parsed.sessionId } : {},
|
|
275
305
|
page: readOptionValue(argv, "--page"),
|
|
276
306
|
fullPage: argv.includes("--full-page"),
|
|
277
307
|
baselinePath,
|
|
@@ -420,6 +450,8 @@ function parseScreenshotArgs(argv) {
|
|
|
420
450
|
return {
|
|
421
451
|
projectPath: parsed.projectPath,
|
|
422
452
|
...parsed.timeout ? { timeout: parsed.timeout } : {},
|
|
453
|
+
...parsed.port ? { port: parsed.port } : {},
|
|
454
|
+
...parsed.sessionId ? { sessionId: parsed.sessionId } : {},
|
|
423
455
|
...outputPath ? { outputPath } : {},
|
|
424
456
|
...page ? { page } : {},
|
|
425
457
|
...fullPage ? { fullPage: true } : {}
|
|
@@ -435,7 +467,7 @@ async function runScreenshot(argv) {
|
|
|
435
467
|
}
|
|
436
468
|
const options = parseScreenshotArgs(argv);
|
|
437
469
|
const isJsonOutput = argv.includes("--json");
|
|
438
|
-
const { takeScreenshot } = await import("./commands-
|
|
470
|
+
const { takeScreenshot } = await import("./commands-D_j5_0eE.js");
|
|
439
471
|
const result = await takeScreenshot(options);
|
|
440
472
|
if (isJsonOutput) {
|
|
441
473
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -1385,6 +1417,7 @@ function createEngineBuildError(message, code) {
|
|
|
1385
1417
|
return error;
|
|
1386
1418
|
}
|
|
1387
1419
|
const ENGINE_BUILD_ENDPOINT_MISSING_PATTERNS = [/Cannot GET \/engine\/build\b/i, /Cannot GET \/engine\/buildResult\//i];
|
|
1420
|
+
const ENGINE_BUILD_ENDPOINT_MISSING_MESSAGE = "当前微信开发者工具未提供 engine build 接口,已跳过自动 engine build 刷新。";
|
|
1388
1421
|
const ENGINE_BUILD_CLI_OPENED_PATTERN = /打开项目成功|project\s+opened|open\s+project\s+success/i;
|
|
1389
1422
|
const COMPACT_WHITESPACE_PATTERN = /\s+/g;
|
|
1390
1423
|
function sleep(ms) {
|
|
@@ -1419,6 +1452,12 @@ function isEngineBuildEndpointMissingError(error) {
|
|
|
1419
1452
|
const message = error instanceof Error ? error.message : String(error);
|
|
1420
1453
|
return ENGINE_BUILD_ENDPOINT_MISSING_PATTERNS.some((pattern) => pattern.test(message));
|
|
1421
1454
|
}
|
|
1455
|
+
function createEngineBuildEndpointMissingError() {
|
|
1456
|
+
return createEngineBuildError(ENGINE_BUILD_ENDPOINT_MISSING_MESSAGE, "WECHAT_DEVTOOLS_ENGINE_BUILD_ENDPOINT_MISSING");
|
|
1457
|
+
}
|
|
1458
|
+
function isWechatIdeEngineBuildEndpointMissingError(error) {
|
|
1459
|
+
return error instanceof Error && "code" in error && error.code === "WECHAT_DEVTOOLS_ENGINE_BUILD_ENDPOINT_MISSING";
|
|
1460
|
+
}
|
|
1422
1461
|
function compactOutput(value) {
|
|
1423
1462
|
return typeof value === "string" ? value.replace(COMPACT_WHITESPACE_PATTERN, " ").trim() : "";
|
|
1424
1463
|
}
|
|
@@ -1437,6 +1476,7 @@ async function runWechatIdeEngineBuildByCli(projectPath, options = {}) {
|
|
|
1437
1476
|
const stderr = typeof result.stderr === "string" ? result.stderr : "";
|
|
1438
1477
|
const output = [stdout, stderr].filter(Boolean).join("\n");
|
|
1439
1478
|
await writeEngineBuildLog(options.logPath, output);
|
|
1479
|
+
if (isEngineBuildEndpointMissingError(output)) throw createEngineBuildEndpointMissingError();
|
|
1440
1480
|
if ((result.exitCode ?? 1) === 0) {
|
|
1441
1481
|
if (stdout) process.stdout.write(stdout);
|
|
1442
1482
|
if (stderr) process.stderr.write(stderr);
|
|
@@ -1482,7 +1522,10 @@ async function runWechatIdeEngineBuild(projectPath, options = {}) {
|
|
|
1482
1522
|
await writeEngineBuildLog(options.logPath, logs.join("\n"));
|
|
1483
1523
|
return result;
|
|
1484
1524
|
} catch (error) {
|
|
1485
|
-
if (isEngineBuildEndpointMissingError(error))
|
|
1525
|
+
if (isEngineBuildEndpointMissingError(error)) {
|
|
1526
|
+
if (options.fallbackToCli === false) throw createEngineBuildEndpointMissingError();
|
|
1527
|
+
return await runWechatIdeEngineBuildByCli(projectPath, options);
|
|
1528
|
+
}
|
|
1486
1529
|
logs.push(error instanceof Error ? error.message : String(error));
|
|
1487
1530
|
await writeEngineBuildLog(options.logPath, logs.join("\n"));
|
|
1488
1531
|
throw error;
|
|
@@ -2239,8 +2282,10 @@ async function resetWechatIdeFileUtils(options) {
|
|
|
2239
2282
|
}
|
|
2240
2283
|
function createAutomatorSessionOptions(options) {
|
|
2241
2284
|
return {
|
|
2285
|
+
...options.port ? { port: options.port } : {},
|
|
2242
2286
|
preferOpenedSession: options.preferOpenedSession ?? true,
|
|
2243
2287
|
projectPath: path.resolve(options.projectPath),
|
|
2288
|
+
...options.sessionId ? { sessionId: options.sessionId } : {},
|
|
2244
2289
|
sharedSession: options.sharedSession ?? true,
|
|
2245
2290
|
timeout: options.timeout
|
|
2246
2291
|
};
|
|
@@ -2628,7 +2673,7 @@ async function parse(argv) {
|
|
|
2628
2673
|
return;
|
|
2629
2674
|
}
|
|
2630
2675
|
if (matchedCommand === "mcp") {
|
|
2631
|
-
const { runMcpCommand } = await import("./run-mcp-
|
|
2676
|
+
const { runMcpCommand } = await import("./run-mcp-CTk4KA3y.js");
|
|
2632
2677
|
await runMcpCommand(argv.slice(1));
|
|
2633
2678
|
return;
|
|
2634
2679
|
}
|
|
@@ -2646,4 +2691,4 @@ async function parse(argv) {
|
|
|
2646
2691
|
await runWechatCliCommand(formattedArgv);
|
|
2647
2692
|
}
|
|
2648
2693
|
//#endregion
|
|
2649
|
-
export {
|
|
2694
|
+
export { requestWechatDevtoolsHttp as $, RETRY_CANCEL_KEYS as A, waitForRetryKeypress as B, refreshWechatIdeTicket as C, readOptionValue as Ct, validateWechatCliCommandArgs as D, uploadWechatIde as E, formatRetryHotkeyPrompt as F, transformArgv as G, execute as H, formatWechatIdeLoginRequiredError as I, runWechatIdeEngineBuild as J, startForwardConsole as K, isWechatIdeLoginRequiredError as L, RETRY_PROMPT_INITIAL_IGNORE_MS as M, createWechatIdeLoginRequiredExitError as N, runWechatCliWithRetry as O, extractExecutionErrorText as P, pollWechatIdeEngineBuildResultByHttp as Q, promptRetryKeypress as R, quitWechatIde as S, readBooleanOption as St, setWechatIdeTicket as T, createAlias as U, runMinidev as V, createPathCompat as W, WECHAT_DEVTOOLS_ENGINE_BUILD_STATUSES as X, runWechatIdeEngineBuildByHttp as Y, openWechatIdeProjectByHttp as Z, isWechatIdeLoggedIn as _, parseScreenshotArgs as _t, autoReplayWechatIde as a, runWithSuspendedSharedInput as at, openWechatIdeOtherProject as b, printCompareHelp as bt, buildWechatIdeIpa as c, MCP_COMMAND_NAME as ct, clearWechatIdeCacheByAutomator as d, WECHAT_CLI_COMMAND_NAMES as dt, resetWechatIdeFileUtilsByHttp as et, closeWechatIdeProject as f, isWeappIdeTopLevelCommand as ft, getWechatIdeToolInfo as g, runAutomatorCommand as gt, getWechatIdeTicket as h, isAutomatorCommand as ht, autoPreviewWechatIde as i, createSharedInputSession as it, RETRY_CONFIRM_KEYS as j, runRetryableCommand as k, buildWechatIdeNpm as l, MINIDEV_NAMESPACE_COMMAND_NAMES as lt, getWechatIdeTestAccounts as m, getAutomatorCommandHelp as mt, parse as n, handleConfigCommand as nt, autoWechatIde as o, waitForExclusiveKeypress as ot, compileWechatIdeByAutomator as p, AUTOMATOR_COMMAND_NAMES as pt, isWechatIdeEngineBuildEndpointMissingError as q, dispatchWechatCliCommand as r, promptForCliPath as rt, buildWechatIdeApk as s, CONFIG_COMMAND_NAME as st, createCli as t, startWechatIdeEngineBuildByHttp as tt, clearWechatIdeCache as u, WEAPP_IDE_TOP_LEVEL_COMMAND_NAMES as ut, loginWechatIde as v, printScreenshotHelp as vt, resetWechatIdeFileUtils as w, removeOption as wt, previewWechatIde as x, parseAutomatorArgs as xt, openWechatIde as y, parseCompareArgs as yt, promptWechatIdeLoginRetry as z };
|
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { j as logger_default } from "./automator-session-
|
|
2
|
-
import { n as parse } from "./cli-
|
|
1
|
+
import { j as logger_default } from "./automator-session-RrZjw3X5.js";
|
|
2
|
+
import { n as parse } from "./cli-_qia2--1.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 { A as colors, c as i18nText, j as logger_default, n as closeSharedMiniProgram, o as withMiniProgram } from "./automator-session-
|
|
1
|
+
import { A as colors, c as i18nText, j as logger_default, n as closeSharedMiniProgram, o as withMiniProgram } from "./automator-session-RrZjw3X5.js";
|
|
2
2
|
import { Buffer } from "node:buffer";
|
|
3
3
|
import fs from "node:fs/promises";
|
|
4
4
|
import { PNG } from "pngjs";
|
|
@@ -302,7 +302,9 @@ async function takeScreenshot(options) {
|
|
|
302
302
|
} catch (error) {
|
|
303
303
|
const isProtocolTimeout = error instanceof Error && error.message === "DEVTOOLS_PROTOCOL_TIMEOUT";
|
|
304
304
|
if (!Boolean(options.sharedSession && !options.miniProgram && isProtocolTimeout)) throw error;
|
|
305
|
-
|
|
305
|
+
const sessionIdOrPort = options.sessionId || options.port;
|
|
306
|
+
if (sessionIdOrPort) await closeSharedMiniProgram(options.projectPath, sessionIdOrPort);
|
|
307
|
+
else await closeSharedMiniProgram(options.projectPath);
|
|
306
308
|
logger_default.warn(i18nText("当前共享 DevTools 会话截图超时,正在改用全新自动化会话重试一次...", "The current shared DevTools session timed out while capturing screenshot. Retrying once with a fresh automation session..."));
|
|
307
309
|
screenshotBuffer = await captureScreenshotBuffer({
|
|
308
310
|
...options,
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ interface AutomatorOptions {
|
|
|
7
7
|
projectPath: string;
|
|
8
8
|
timeout?: number;
|
|
9
9
|
cliPath?: string;
|
|
10
|
+
port?: number;
|
|
11
|
+
sessionId?: string;
|
|
10
12
|
trustProject?: boolean;
|
|
11
13
|
preferOpenedSession?: boolean;
|
|
12
14
|
}
|
|
@@ -55,6 +57,8 @@ declare function connectOpenedAutomator(options: AutomatorOptions): Promise<unkn
|
|
|
55
57
|
interface ParsedAutomatorArgs {
|
|
56
58
|
projectPath: string;
|
|
57
59
|
timeout?: number;
|
|
60
|
+
port?: number;
|
|
61
|
+
sessionId?: string;
|
|
58
62
|
json: boolean;
|
|
59
63
|
positionals: string[];
|
|
60
64
|
}
|
|
@@ -282,8 +286,10 @@ interface RunWechatIdeEngineBuildByHttpOptions extends WechatDevtoolsHttpCommand
|
|
|
282
286
|
pollIntervalMs?: number;
|
|
283
287
|
}
|
|
284
288
|
interface RunWechatIdeEngineBuildOptions extends RunWechatIdeEngineBuildByHttpOptions {
|
|
289
|
+
fallbackToCli?: boolean;
|
|
285
290
|
logPath?: string;
|
|
286
291
|
}
|
|
292
|
+
declare function isWechatIdeEngineBuildEndpointMissingError(error: unknown): boolean;
|
|
287
293
|
/**
|
|
288
294
|
* @description 通过开发者工具 HTTP 服务端口执行 engine build,并轮询直到构建结束。
|
|
289
295
|
*/
|
|
@@ -565,8 +571,10 @@ interface ResetWechatIdeFileUtilsOptions {
|
|
|
565
571
|
projectPath: string;
|
|
566
572
|
}
|
|
567
573
|
interface WechatIdeAutomatorSessionOptions {
|
|
574
|
+
port?: number;
|
|
568
575
|
preferOpenedSession?: boolean;
|
|
569
576
|
projectPath: string;
|
|
577
|
+
sessionId?: string;
|
|
570
578
|
sharedSession?: boolean;
|
|
571
579
|
timeout?: number;
|
|
572
580
|
}
|
|
@@ -852,8 +860,10 @@ interface ToolRegistrar {
|
|
|
852
860
|
interface WeappIdeMcpRuntimeHooks {
|
|
853
861
|
withMiniProgram: <T>(options: {
|
|
854
862
|
preferOpenedSession?: boolean;
|
|
863
|
+
port?: number;
|
|
855
864
|
projectPath: string;
|
|
856
865
|
sharedSession?: boolean;
|
|
866
|
+
sessionId?: string;
|
|
857
867
|
timeout?: number;
|
|
858
868
|
}, runner: (miniProgram: MiniProgramLike) => Promise<T>) => Promise<T>;
|
|
859
869
|
}
|
|
@@ -931,4 +941,4 @@ declare function execute(cliPath: string, argv: string[], options?: ExecuteOptio
|
|
|
931
941
|
*/
|
|
932
942
|
declare function resolvePath(filePath: string): string;
|
|
933
943
|
//#endregion
|
|
934
|
-
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, isWechatIdeLoggedIn, isWechatIdeLoginRequiredError, 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 };
|
|
944
|
+
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, 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 };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as defaultCustomConfigFilePath, C as getConfig, D as getDefaultCliPath, E as SupportedPlatformsMap, F as createLocaleConfig, I as overwriteCustomConfig, L as readCustomConfig, M as createAutoBootstrapDevtoolsConfig, N as createAutoTrustProjectConfig, O as isOperatingSystemSupported, P as createCustomConfig, R as removeCustomConfigKey, S as resolveCliPath, T as resolveDevtoolsAutomationDefaults, V as resolvePath, _ as isDevtoolsHttpPortError, a as releaseSharedMiniProgram, b as bootstrapWechatDevtoolsSettings, d as formatAutomatorLoginError, f as getAutomatorProtocolTimeoutMethod, g as isDevtoolsExtensionContextInvalidatedError, h as isAutomatorWsConnectError, i as getSharedMiniProgramSessionCount, k as operatingSystemName, m as isAutomatorProtocolTimeoutError, n as closeSharedMiniProgram, o as withMiniProgram, p as isAutomatorLoginError, r as connectMiniProgram, t as acquireSharedMiniProgram, u as connectOpenedAutomator, v as isRetryableAutomatorLaunchError, w as getConfiguredLocale, x as detectWechatDevtoolsServicePort, y as launchAutomator, z as defaultCustomConfigDirPath } from "./automator-session-
|
|
2
|
-
import { $ as
|
|
3
|
-
import { a as navigateBack, c as pageStack, d as remote, f as scrollTo, g as tap, h as takeScreenshot, i as input, l as reLaunch, m as systemInfo, n as captureScreenshotBuffer, o as navigateTo, p as switchTab, r as currentPage, s as pageData, t as audit, u as redirectTo } from "./commands-
|
|
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, isWechatIdeLoggedIn, isWechatIdeLoginRequiredError, 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 { B as defaultCustomConfigFilePath, C as getConfig, D as getDefaultCliPath, E as SupportedPlatformsMap, F as createLocaleConfig, I as overwriteCustomConfig, L as readCustomConfig, M as createAutoBootstrapDevtoolsConfig, N as createAutoTrustProjectConfig, O as isOperatingSystemSupported, P as createCustomConfig, R as removeCustomConfigKey, S as resolveCliPath, T as resolveDevtoolsAutomationDefaults, V as resolvePath, _ as isDevtoolsHttpPortError, a as releaseSharedMiniProgram, b as bootstrapWechatDevtoolsSettings, d as formatAutomatorLoginError, f as getAutomatorProtocolTimeoutMethod, g as isDevtoolsExtensionContextInvalidatedError, h as isAutomatorWsConnectError, i as getSharedMiniProgramSessionCount, k as operatingSystemName, m as isAutomatorProtocolTimeoutError, n as closeSharedMiniProgram, o as withMiniProgram, p as isAutomatorLoginError, r as connectMiniProgram, t as acquireSharedMiniProgram, u as connectOpenedAutomator, v as isRetryableAutomatorLaunchError, w as getConfiguredLocale, x as detectWechatDevtoolsServicePort, y as launchAutomator, z as defaultCustomConfigDirPath } from "./automator-session-RrZjw3X5.js";
|
|
2
|
+
import { $ as requestWechatDevtoolsHttp, A as RETRY_CANCEL_KEYS, B as waitForRetryKeypress, C as refreshWechatIdeTicket, Ct as readOptionValue, D as validateWechatCliCommandArgs, E as uploadWechatIde, F as formatRetryHotkeyPrompt, G as transformArgv, H as execute, I as formatWechatIdeLoginRequiredError, J as runWechatIdeEngineBuild, K as startForwardConsole, L as isWechatIdeLoginRequiredError, M as RETRY_PROMPT_INITIAL_IGNORE_MS, N as createWechatIdeLoginRequiredExitError, O as runWechatCliWithRetry, P as extractExecutionErrorText, Q as pollWechatIdeEngineBuildResultByHttp, R as promptRetryKeypress, S as quitWechatIde, St as readBooleanOption, T as setWechatIdeTicket, U as createAlias, V as runMinidev, W as createPathCompat, X as WECHAT_DEVTOOLS_ENGINE_BUILD_STATUSES, Y as runWechatIdeEngineBuildByHttp, Z as openWechatIdeProjectByHttp, _ as isWechatIdeLoggedIn, _t as parseScreenshotArgs, a as autoReplayWechatIde, at as runWithSuspendedSharedInput, b as openWechatIdeOtherProject, bt as printCompareHelp, c as buildWechatIdeIpa, ct as MCP_COMMAND_NAME, d as clearWechatIdeCacheByAutomator, dt as WECHAT_CLI_COMMAND_NAMES, et as resetWechatIdeFileUtilsByHttp, f as closeWechatIdeProject, ft as isWeappIdeTopLevelCommand, g as getWechatIdeToolInfo, gt as runAutomatorCommand, h as getWechatIdeTicket, ht as isAutomatorCommand, i as autoPreviewWechatIde, it as createSharedInputSession, j as RETRY_CONFIRM_KEYS, k as runRetryableCommand, l as buildWechatIdeNpm, lt as MINIDEV_NAMESPACE_COMMAND_NAMES, m as getWechatIdeTestAccounts, mt as getAutomatorCommandHelp, n as parse, nt as handleConfigCommand, o as autoWechatIde, ot as waitForExclusiveKeypress, p as compileWechatIdeByAutomator, pt as AUTOMATOR_COMMAND_NAMES, q as isWechatIdeEngineBuildEndpointMissingError, r as dispatchWechatCliCommand, rt as promptForCliPath, s as buildWechatIdeApk, st as CONFIG_COMMAND_NAME, t as createCli, tt as startWechatIdeEngineBuildByHttp, u as clearWechatIdeCache, ut as WEAPP_IDE_TOP_LEVEL_COMMAND_NAMES, v as loginWechatIde, vt as printScreenshotHelp, w as resetWechatIdeFileUtils, wt as removeOption, x as previewWechatIde, xt as parseAutomatorArgs, y as openWechatIde, yt as parseCompareArgs, z as promptWechatIdeLoginRetry } from "./cli-_qia2--1.js";
|
|
3
|
+
import { a as navigateBack, c as pageStack, d as remote, f as scrollTo, g as tap, h as takeScreenshot, i as input, l as reLaunch, m as systemInfo, n as captureScreenshotBuffer, o as navigateTo, p as switchTab, r as currentPage, s as pageData, t as audit, u as redirectTo } from "./commands-fWDebiQq.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-By4qRg8l.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, 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,4 +1,4 @@
|
|
|
1
|
-
import { o as withMiniProgram$1 } from "./automator-session-
|
|
1
|
+
import { o as withMiniProgram$1 } from "./automator-session-RrZjw3X5.js";
|
|
2
2
|
import { Buffer } from "node:buffer";
|
|
3
3
|
import fs from "node:fs/promises";
|
|
4
4
|
import path from "node:path";
|
|
@@ -17,7 +17,9 @@ function createResolvedOutputPath(workspaceRoot, outputPath) {
|
|
|
17
17
|
async function withConnectedMiniProgram(runtimeHooks, workspaceRoot, input, runner) {
|
|
18
18
|
return await runtimeHooks.withMiniProgram({
|
|
19
19
|
preferOpenedSession: input.preferOpenedSession,
|
|
20
|
+
port: input.port,
|
|
20
21
|
projectPath: createResolvedProjectPath(workspaceRoot, input.projectPath),
|
|
22
|
+
sessionId: input.sessionId,
|
|
21
23
|
sharedSession: true,
|
|
22
24
|
timeout: input.timeout
|
|
23
25
|
}, runner);
|
|
@@ -31,7 +33,9 @@ function defineConnectionSchema() {
|
|
|
31
33
|
return {
|
|
32
34
|
projectPath: z.string().trim().min(1).describe("小程序项目路径,支持 workspaceRoot 相对路径"),
|
|
33
35
|
timeout: z.number().int().positive().optional(),
|
|
34
|
-
|
|
36
|
+
port: z.number().int().positive().optional(),
|
|
37
|
+
preferOpenedSession: z.boolean().optional(),
|
|
38
|
+
sessionId: z.string().trim().min(1).optional()
|
|
35
39
|
};
|
|
36
40
|
}
|
|
37
41
|
function defineElementSchema() {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-ide-cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.4.0",
|
|
5
5
|
"description": "让微信开发者工具,用起来更加方便!",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -71,8 +71,8 @@
|
|
|
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.
|
|
75
|
-
"@weapp-vite/miniprogram-automator": "1.
|
|
74
|
+
"@weapp-vite/devtools-runtime": "0.4.0",
|
|
75
|
+
"@weapp-vite/miniprogram-automator": "1.2.0"
|
|
76
76
|
},
|
|
77
77
|
"scripts": {
|
|
78
78
|
"dev": "tsdown -w --sourcemap",
|
package/dist/run-mcp-DhujWgfX.js
DELETED