weapp-ide-cli 6.0.7 → 6.0.8

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.
@@ -166,11 +166,6 @@ function createWrapperProjectConfig(source, patch) {
166
166
  }
167
167
  };
168
168
  }
169
- async function copyJsonConfigAsWrapper(sourcePath, targetPath, patch) {
170
- const source = await readJsonObject$1(sourcePath);
171
- if (!source) return;
172
- await writeJsonObject$1(targetPath, createWrapperProjectConfig(source, patch));
173
- }
174
169
  async function ensureWrapperAppConfig(wrapperProjectPath) {
175
170
  const appConfigPath = path.join(wrapperProjectPath, "app.json");
176
171
  const appConfig = await readJsonObject$1(appConfigPath);
@@ -191,6 +186,7 @@ async function resolveAutomatorProjectPath(projectPath) {
191
186
  projectPath: sourceProjectPath,
192
187
  sourceProjectPath
193
188
  };
189
+ const sourceProjectConfig = projectConfig ?? {};
194
190
  const distRoot = path.join(sourceProjectPath, miniprogramRoot);
195
191
  if (!await pathExists(path.join(distRoot, "app.json"))) return {
196
192
  projectPath: sourceProjectPath,
@@ -208,15 +204,19 @@ async function resolveAutomatorProjectPath(projectPath) {
208
204
  force: true,
209
205
  recursive: true
210
206
  });
211
- const pluginRoot = normalizeProjectRelativeRoot(projectConfig?.pluginRoot);
207
+ const pluginRoot = normalizeProjectRelativeRoot(sourceProjectConfig.pluginRoot);
212
208
  if (pluginRoot) await copyProjectRoot(sourceProjectPath, wrapperProjectPath, pluginRoot);
213
209
  const rootPatch = {
214
- compileType: projectConfig?.compileType === "plugin" ? "plugin" : "miniprogram",
210
+ compileType: sourceProjectConfig.compileType === "plugin" ? "plugin" : "miniprogram",
215
211
  miniprogramRoot: "./",
216
212
  srcMiniprogramRoot: "./"
217
213
  };
218
- await copyJsonConfigAsWrapper(path.join(sourceProjectPath, "project.config.json"), path.join(wrapperProjectPath, "project.config.json"), rootPatch);
219
- await copyJsonConfigAsWrapper(path.join(sourceProjectPath, "project.private.config.json"), path.join(wrapperProjectPath, "project.private.config.json"), rootPatch);
214
+ const projectPrivateConfig = await readJsonObject$1(path.join(sourceProjectPath, "project.private.config.json")) ?? {};
215
+ await writeJsonObject$1(path.join(wrapperProjectPath, "project.config.json"), createWrapperProjectConfig(sourceProjectConfig, {
216
+ ...projectPrivateConfig,
217
+ ...rootPatch
218
+ }));
219
+ await fs.rm(path.join(wrapperProjectPath, "project.private.config.json"), { force: true });
220
220
  await ensureWrapperAppConfig(wrapperProjectPath);
221
221
  return {
222
222
  cleanup: async () => {
@@ -622,6 +622,7 @@ const DEVTOOLS_HTTP_PORT_ERROR = "Failed to launch wechat web devTools, please m
622
622
  const DEVTOOLS_EXTENSION_CONTEXT_INVALIDATED_RE = /Extension context invalidated/i;
623
623
  const AUTOMATOR_LAUNCH_TIMEOUT_RE = /Wait timed out after \d+ ms/i;
624
624
  const AUTOMATOR_WS_CONNECT_RE = /Failed connecting to ws:\/\/127\.0\.0\.1:\d+/i;
625
+ const AUTOMATOR_PORT_IN_USE_RE = /Port \d+ is in use, please specify another port/i;
625
626
  const DEVTOOLS_PROTOCOL_TIMEOUT_RE = /DevTools did not respond to protocol method (\S+) within \d+ms/i;
626
627
  const DEVTOOLS_INFRA_ERROR_PATTERNS = [
627
628
  /#initialize-error:\s*wait IDE port timeout/i,
@@ -745,6 +746,13 @@ function isAutomatorWsConnectError(error) {
745
746
  return AUTOMATOR_WS_CONNECT_RE.test(message);
746
747
  }
747
748
  /**
749
+ * @description 判断错误是否属于目标项目 automator 端口仍被旧会话占用。
750
+ */
751
+ function isAutomatorPortInUseError(error) {
752
+ const message = error instanceof Error ? error.message : String(error);
753
+ return AUTOMATOR_PORT_IN_USE_RE.test(message);
754
+ }
755
+ /**
748
756
  * @description 判断错误是否属于开发者工具协议调用超时。
749
757
  */
750
758
  function isAutomatorProtocolTimeoutError(error) {
@@ -798,6 +806,7 @@ async function launchAutomator(options) {
798
806
  trustProject: resolvedTrustProject
799
807
  });
800
808
  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.");
809
+ const launchStartedAt = Date.now();
801
810
  for (let attempt = 0; attempt < 2; attempt += 1) try {
802
811
  const miniProgram = await launcher.launch({
803
812
  cliPath: resolvedCliPath,
@@ -822,7 +831,7 @@ async function launchAutomator(options) {
822
831
  return miniProgram;
823
832
  } catch (error) {
824
833
  lastError = error;
825
- if (!isRetryableAutomatorLaunchError(error) || attempt === 1) throw error;
834
+ if (!isRetryableAutomatorLaunchError(error) || attempt === 1 || Date.now() - launchStartedAt >= timeout) throw error;
826
835
  }
827
836
  throw lastError instanceof Error ? lastError : new Error(String(lastError));
828
837
  }
@@ -1246,7 +1255,7 @@ function normalizeMiniProgramConnectionError(error) {
1246
1255
  logger_default.warn(i18nText("请稍后重试;若持续失败,关闭多余的开发者工具窗口后重试。", "Please retry shortly. If it keeps failing, close extra DevTools windows and try again."));
1247
1256
  return /* @__PURE__ */ new Error("DEVTOOLS_EXTENSION_CONTEXT_INVALIDATED");
1248
1257
  }
1249
- if (isAutomatorWsConnectError(error)) {
1258
+ if (isAutomatorWsConnectError(error) || isAutomatorPortInUseError(error)) {
1250
1259
  logger_default.error(i18nText("无法连接到当前项目的微信开发者工具自动化 websocket。", "Cannot connect to the Wechat DevTools automation websocket for the current project."));
1251
1260
  logger_default.warn(i18nText("请确认当前打开的是目标项目;若之前跑过其他 e2e / screenshot 任务,关闭多余的微信开发者工具窗口,或结束残留的 `wechatwebdevtools cli auto --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."));
1252
1261
  return /* @__PURE__ */ new Error("DEVTOOLS_WS_CONNECT_ERROR");
@@ -1266,7 +1275,7 @@ async function connectMiniProgram(options) {
1266
1275
  const result = await runRetryableCommand({
1267
1276
  createCancelError: (result) => createWechatIdeLoginRequiredExitError(unwrapAutomatorConnectionError(result), "cancelled"),
1268
1277
  execute: async () => {
1269
- if (options.preferOpenedSession === false) try {
1278
+ if (options.preferOpenedSession === false && options.openedOnly !== true) try {
1270
1279
  return {
1271
1280
  kind: "result",
1272
1281
  value: await launchFreshAutomator(options)
@@ -1285,7 +1294,7 @@ async function connectMiniProgram(options) {
1285
1294
  };
1286
1295
  } catch (error) {
1287
1296
  const normalizedOpenSessionError = normalizeMiniProgramConnectionError(error);
1288
- if (options.openedOnly) throw normalizedOpenSessionError;
1297
+ if (options.openedOnly || options.preferOpenedSession !== false && Boolean(options.port || options.sessionId)) throw normalizedOpenSessionError;
1289
1298
  if (normalizedOpenSessionError instanceof Error && normalizedOpenSessionError.message === "DEVTOOLS_PROTOCOL_TIMEOUT") throw normalizedOpenSessionError;
1290
1299
  try {
1291
1300
  return {
@@ -1332,4 +1341,4 @@ async function withMiniProgram$1(options, runner) {
1332
1341
  return await withMiniProgram(runtimeHooks, options, runner);
1333
1342
  }
1334
1343
  //#endregion
1335
- 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 };
1344
+ export { createLocaleConfig as $, isAutomatorPortInUseError as A, resolveCliPath as B, configureLocaleFromArgv as C, formatAutomatorLoginError as D, connectOpenedAutomator as E, isRetryableAutomatorLaunchError as F, getDefaultCliPath as G, getConfiguredLocale as H, launchAutomator as I, colors as J, isOperatingSystemSupported as K, resolveProjectAutomatorPort as L, isAutomatorWsConnectError as M, isDevtoolsExtensionContextInvalidatedError as N, getAutomatorProtocolTimeoutMethod as O, isDevtoolsHttpPortError as P, createCustomConfig as Q, bootstrapWechatDevtoolsSettings as R, waitForExclusiveKeypress as S, validateLocaleOption as T, resolveDevtoolsAutomationDefaults as U, getConfig as V, SupportedPlatformsMap as W, createAutoBootstrapDevtoolsConfig as X, logger_default as Y, createAutoTrustProjectConfig as Z, promptRetryKeypress as _, releaseSharedMiniProgram as a, resolvePath as at, createSharedInputSession as b, RETRY_CANCEL_KEYS as c, createWechatIdeLoginRequiredExitError as d, overwriteCustomConfig as et, extractExecutionErrorText as f, isWechatIdeLoginRequiredExitError as g, isWechatIdeLoginRequiredError as h, getSharedMiniProgramSessionCount as i, defaultCustomConfigFilePath as it, isAutomatorProtocolTimeoutError as j, isAutomatorLoginError as k, RETRY_CONFIRM_KEYS as l, formatWechatIdeLoginRequiredError as m, closeSharedMiniProgram as n, removeCustomConfigKey as nt, withMiniProgram$1 as o, formatRetryHotkeyPrompt as p, operatingSystemName as q, connectMiniProgram as r, defaultCustomConfigDirPath as rt, runRetryableCommand as s, acquireSharedMiniProgram$1 as t, readCustomConfig as tt, RETRY_PROMPT_INITIAL_IGNORE_MS as u, promptWechatIdeLoginRetry as v, i18nText as w, runWithSuspendedSharedInput as x, waitForRetryKeypress as y, detectWechatDevtoolsServicePort as z };
@@ -1,6 +1,6 @@
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, a as releaseSharedMiniProgram, et as readCustomConfig, q as colors, r as connectMiniProgram, rt as defaultCustomConfigFilePath, t as acquireSharedMiniProgram, tt as removeCustomConfigKey, w as i18nText, z as resolveCliPath } from "./automator-session-CkojbnCg.js";
2
- import { 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, f as scrollTo, g as tap, i as input, it as removeOption, j as loginWechatIde, l as reLaunch, m as systemInfo, n as captureScreenshotBuffer, nt as readBooleanOption, o as navigateTo, p as switchTab, r as currentPage, rt as readOptionValue, s as pageData, t as audit, tt as parseAutomatorArgs, u as redirectTo, v as autoReplayWechatIde, x as buildWechatIdeIpa, y as autoWechatIde, z as uploadWechatIde } from "./commands-Ijtoy2_F.js";
3
- import "./run-mcp-CUUdfBm7.js";
1
+ import { $ as createLocaleConfig, B as resolveCliPath, C as configureLocaleFromArgv, H as getConfiguredLocale, J as colors, Q as createCustomConfig, T as validateLocaleOption, U as resolveDevtoolsAutomationDefaults, X as createAutoBootstrapDevtoolsConfig, Y as logger_default, Z as createAutoTrustProjectConfig, a as releaseSharedMiniProgram, et as overwriteCustomConfig, it as defaultCustomConfigFilePath, n as closeSharedMiniProgram, nt as removeCustomConfigKey, r as connectMiniProgram, t as acquireSharedMiniProgram, tt as readCustomConfig, w as i18nText } from "./automator-session-BIjYknSi.js";
2
+ import { 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, f as scrollTo, g as tap, i as input, it as removeOption, j as loginWechatIde, l as reLaunch, m as systemInfo, n as captureScreenshotBuffer, nt as readBooleanOption, o as navigateTo, p as switchTab, r as currentPage, rt as readOptionValue, s as pageData, t as audit, tt as parseAutomatorArgs, u as redirectTo, v as autoReplayWechatIde, x as buildWechatIdeIpa, y as autoWechatIde, z as uploadWechatIde } from "./commands-9WCVsqHn.js";
3
+ import "./run-mcp-BHW8rcxB.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";
@@ -231,6 +231,8 @@ ${colors.bold("参数:")}
231
231
  --page <path> 截图前先跳转页面
232
232
  --full-page 输出整页长截图
233
233
  -t, --timeout <ms> 连接超时时间(默认:30000)
234
+ --port <port> 连接已打开的 automator 端口
235
+ --session-id <id> 复用指定的 automator 会话
234
236
  --runtime-url <url> 复用本地 runtime service 地址
235
237
  --no-runtime-service 跳过 runtime service,直接连接 DevTools
236
238
  --json 以 JSON 格式输出
@@ -261,6 +263,8 @@ ${colors.bold("Options:")}
261
263
  --page <path> Navigate to page before taking screenshot
262
264
  --full-page Capture a stitched full-page screenshot
263
265
  -t, --timeout <ms> Connection timeout in milliseconds (default: 30000)
266
+ --port <port> Connect to an opened automator port
267
+ --session-id <id> Reuse a named automator session
264
268
  --runtime-url <url> Runtime service URL for shared sessions
265
269
  --no-runtime-service Skip runtime service and connect to DevTools directly
266
270
  --json Output as JSON format
@@ -313,7 +317,7 @@ async function runScreenshot(argv) {
313
317
  }
314
318
  const options = parseScreenshotArgs(argv);
315
319
  const isJsonOutput = argv.includes("--json");
316
- const { takeScreenshot } = await import("./commands-qLfRse7L.js");
320
+ const { takeScreenshot } = await import("./commands-BsYTeMoY.js");
317
321
  const result = await takeScreenshot(options);
318
322
  if (isJsonOutput) {
319
323
  console.log(JSON.stringify(result, null, 2));
@@ -464,6 +468,20 @@ const COMMON_OPTION_DEFINITIONS = [
464
468
  en: "Connection timeout (default: 30000)"
465
469
  }
466
470
  },
471
+ {
472
+ flag: "--port <port>",
473
+ description: {
474
+ zh: "连接已打开的 automator 端口",
475
+ en: "Connect to an opened automator port"
476
+ }
477
+ },
478
+ {
479
+ flag: "--session-id <id>",
480
+ description: {
481
+ zh: "复用指定的 automator 会话",
482
+ en: "Reuse a named automator session"
483
+ }
484
+ },
467
485
  {
468
486
  flag: "--runtime-url <url>",
469
487
  description: {
@@ -505,6 +523,8 @@ const COMMON_ALLOWED_OPTIONS = /* @__PURE__ */ new Set([
505
523
  "--project",
506
524
  "-t",
507
525
  "--timeout",
526
+ "--port",
527
+ "--session-id",
508
528
  "--runtime-url",
509
529
  "--no-runtime-service",
510
530
  "--json",
@@ -1135,6 +1155,8 @@ const DEFAULT_FORWARD_CONSOLE_LEVELS = [
1135
1155
  ];
1136
1156
  const ENABLE_LOG_RETRY_DELAY_MS = 500;
1137
1157
  const ENABLE_LOG_RETRY_TIMES = 5;
1158
+ const ENABLE_LOG_TIMEOUT_MS = 3e3;
1159
+ const FORWARD_CONSOLE_SESSION_TIMEOUT_MS = 3e3;
1138
1160
  const ENABLE_LOG_REFRESH_INTERVAL_MS = 2e3;
1139
1161
  const AUXILIARY_FORWARD_CONSOLE_DELAY_MS = 2500;
1140
1162
  const DUPLICATE_LOG_SUPPRESS_MS = 800;
@@ -1236,15 +1258,39 @@ function normalizeExceptionEvent(payload) {
1236
1258
  function sleep(ms) {
1237
1259
  return new Promise((resolve) => setTimeout(resolve, ms));
1238
1260
  }
1239
- async function enableMiniProgramConsoleLog(miniProgram) {
1261
+ async function enableMiniProgramConsoleLog(miniProgram, retryTimes = ENABLE_LOG_RETRY_TIMES) {
1240
1262
  if (typeof miniProgram.enableLog !== "function") return;
1241
1263
  let lastError;
1242
- for (let attempt = 0; attempt <= ENABLE_LOG_RETRY_TIMES; attempt += 1) try {
1243
- await miniProgram.enableLog();
1264
+ for (let attempt = 0; attempt <= retryTimes; attempt += 1) try {
1265
+ await miniProgram.enableLog(ENABLE_LOG_TIMEOUT_MS);
1244
1266
  return;
1245
1267
  } catch (error) {
1246
1268
  lastError = error;
1247
- if (attempt < ENABLE_LOG_RETRY_TIMES) await sleep(ENABLE_LOG_RETRY_DELAY_MS);
1269
+ if (attempt < retryTimes) await sleep(ENABLE_LOG_RETRY_DELAY_MS);
1270
+ }
1271
+ throw lastError instanceof Error ? lastError : new Error(String(lastError));
1272
+ }
1273
+ async function acquireForwardConsoleMiniProgram(options) {
1274
+ if (options.miniProgram) {
1275
+ await enableMiniProgramConsoleLog(options.miniProgram);
1276
+ return options.miniProgram;
1277
+ }
1278
+ let lastError;
1279
+ for (let attempt = 0; attempt <= ENABLE_LOG_RETRY_TIMES; attempt += 1) {
1280
+ let miniProgram;
1281
+ try {
1282
+ miniProgram = await acquireSharedMiniProgram({
1283
+ ...options,
1284
+ timeout: Math.min(options.timeout ?? FORWARD_CONSOLE_SESSION_TIMEOUT_MS, FORWARD_CONSOLE_SESSION_TIMEOUT_MS)
1285
+ });
1286
+ await enableMiniProgramConsoleLog(miniProgram, 0);
1287
+ return miniProgram;
1288
+ } catch (error) {
1289
+ lastError = error;
1290
+ if (miniProgram) releaseSharedMiniProgram(options.projectPath, options.sessionId || options.port);
1291
+ await closeSharedMiniProgram(options.projectPath, options.sessionId || options.port);
1292
+ if (attempt < ENABLE_LOG_RETRY_TIMES) await sleep(ENABLE_LOG_RETRY_DELAY_MS);
1293
+ }
1248
1294
  }
1249
1295
  throw lastError instanceof Error ? lastError : new Error(String(lastError));
1250
1296
  }
@@ -1262,7 +1308,7 @@ async function refreshOpenedMiniProgramConsoleLog(options) {
1262
1308
  function startEnableLogRefresh(miniProgram, options, refreshOpenedSession) {
1263
1309
  if (typeof miniProgram.enableLog !== "function") return;
1264
1310
  const timer = setInterval(() => {
1265
- miniProgram.enableLog().catch(() => {});
1311
+ miniProgram.enableLog(ENABLE_LOG_TIMEOUT_MS).catch(() => {});
1266
1312
  if (refreshOpenedSession) refreshOpenedMiniProgramConsoleLog(options).catch(() => {});
1267
1313
  }, ENABLE_LOG_REFRESH_INTERVAL_MS);
1268
1314
  return () => {
@@ -1274,7 +1320,7 @@ function startEnableLogRefresh(miniProgram, options, refreshOpenedSession) {
1274
1320
  */
1275
1321
  async function startForwardConsole(options) {
1276
1322
  const usesSharedSession = !options.miniProgram;
1277
- const miniProgram = options.miniProgram ?? await acquireSharedMiniProgram(options);
1323
+ const miniProgram = await acquireForwardConsoleMiniProgram(options);
1278
1324
  const logLevels = new Set(options.logLevels?.length ? options.logLevels : DEFAULT_FORWARD_CONSOLE_LEVELS);
1279
1325
  const logHandler = options.onLog ?? printForwardConsoleEvent;
1280
1326
  const recentLogTimes = /* @__PURE__ */ new Map();
@@ -1317,12 +1363,6 @@ async function startForwardConsole(options) {
1317
1363
  }
1318
1364
  if (usesSharedSession) releaseSharedMiniProgram(options.projectPath, options.sessionId || options.port);
1319
1365
  };
1320
- try {
1321
- await enableMiniProgramConsoleLog(miniProgram);
1322
- } catch (error) {
1323
- await closeSession();
1324
- throw error;
1325
- }
1326
1366
  miniProgram.on("console", onConsole);
1327
1367
  miniProgram.on("exception", onException);
1328
1368
  stopEnableLogRefresh = startEnableLogRefresh(miniProgram, options, usesSharedSession);
@@ -1734,7 +1774,7 @@ async function parse(argv) {
1734
1774
  return;
1735
1775
  }
1736
1776
  if (matchedCommand === "mcp") {
1737
- const { runMcpCommand } = await import("./run-mcp-D1G1d_Le.js");
1777
+ const { runMcpCommand } = await import("./run-mcp-CWdKWbN_.js");
1738
1778
  await runMcpCommand(argv.slice(1));
1739
1779
  return;
1740
1780
  }
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
- import { J as logger_default } from "./automator-session-CkojbnCg.js";
2
- import { n as parse } from "./cli-DSrMNDWQ.js";
1
+ import { Y as logger_default } from "./automator-session-BIjYknSi.js";
2
+ import { n as parse } from "./cli-BvhTwRjo.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 { 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-CkojbnCg.js";
1
+ import { B as resolveCliPath, J as colors, K as isOperatingSystemSupported, Q as createCustomConfig, R as bootstrapWechatDevtoolsSettings, Y as logger_default, at as resolvePath, d as createWechatIdeLoginRequiredExitError, h as isWechatIdeLoginRequiredError, it as defaultCustomConfigFilePath, n as closeSharedMiniProgram, o as withMiniProgram, q as operatingSystemName, s as runRetryableCommand, tt as readCustomConfig, v as promptWechatIdeLoginRetry, w as i18nText, x as runWithSuspendedSharedInput, z as detectWechatDevtoolsServicePort } from "./automator-session-BIjYknSi.js";
2
2
  import { Buffer } from "node:buffer";
3
3
  import fs from "node:fs/promises";
4
4
  import path from "node:path";
@@ -579,9 +579,9 @@ function createPathCompat(option) {
579
579
  * @description 执行 CLI 命令并透传输出
580
580
  */
581
581
  async function execute(cliPath, argv, options = {}) {
582
- const { pipeStdout = true, pipeStderr = true } = options;
582
+ const { pipeStdout = true, pipeStderr = true, timeout } = options;
583
583
  const { execa } = await import("execa");
584
- const task = execa(cliPath, argv);
584
+ const task = execa(cliPath, argv, { timeout });
585
585
  if (pipeStdout) task?.stdout?.pipe(process.stdout);
586
586
  if (pipeStderr) task?.stderr?.pipe(process.stderr);
587
587
  return await task;
@@ -681,7 +681,8 @@ async function runWechatCliWithRetry(cliPath, argv, options = {}) {
681
681
  kind: "result",
682
682
  value: await execute(cliPath, loginRetryOptions.runtimeArgv, {
683
683
  pipeStdout: false,
684
- pipeStderr: false
684
+ pipeStderr: false,
685
+ timeout: options.timeout
685
686
  })
686
687
  };
687
688
  } catch (error) {
@@ -775,6 +776,7 @@ async function runWechatCliCommand(argv, options = {}) {
775
776
  }
776
777
  //#endregion
777
778
  //#region src/cli/wechat-commands.ts
779
+ const DEVTOOLS_SHUTDOWN_TIMEOUT_MS = 1e4;
778
780
  function appendProjectLocatorArgv(argv, options) {
779
781
  if (options.projectPath) argv.push("--project", path.resolve(options.projectPath));
780
782
  if (options.appid) argv.push("--appid", options.appid);
@@ -887,13 +889,13 @@ async function uploadWechatIde(options) {
887
889
  * @description 调用微信开发者工具 close 命令。
888
890
  */
889
891
  async function closeWechatIdeProject() {
890
- await runWechatCliCommand(["close"]);
892
+ await runWechatCliCommand(["close"], { timeout: DEVTOOLS_SHUTDOWN_TIMEOUT_MS });
891
893
  }
892
894
  /**
893
895
  * @description 调用微信开发者工具 quit 命令。
894
896
  */
895
897
  async function quitWechatIde() {
896
- await runWechatCliCommand(["quit"]);
898
+ await runWechatCliCommand(["quit"], { timeout: DEVTOOLS_SHUTDOWN_TIMEOUT_MS });
897
899
  }
898
900
  /**
899
901
  * @description 调用微信开发者工具 cache 命令。
@@ -0,0 +1,2 @@
1
+ import { h as takeScreenshot } from "./commands-9WCVsqHn.js";
2
+ export { takeScreenshot };
package/dist/index.d.ts CHANGED
@@ -33,6 +33,10 @@ declare function isRetryableAutomatorLaunchError(error: unknown): boolean;
33
33
  * @description 判断错误是否属于开发者工具 websocket 连接失败。
34
34
  */
35
35
  declare function isAutomatorWsConnectError(error: unknown): boolean;
36
+ /**
37
+ * @description 判断错误是否属于目标项目 automator 端口仍被旧会话占用。
38
+ */
39
+ declare function isAutomatorPortInUseError(error: unknown): boolean;
36
40
  /**
37
41
  * @description 判断错误是否属于开发者工具协议调用超时。
38
42
  */
@@ -467,6 +471,7 @@ declare function runAutomatorCommand(command: string, argv: string[]): Promise<v
467
471
  //#region src/cli/run-login.d.ts
468
472
  interface RunWechatCliWithRetryOptions {
469
473
  silent?: boolean;
474
+ timeout?: number;
470
475
  }
471
476
  /**
472
477
  * @description 运行微信开发者工具 CLI,并在登录失效时允许按键重试。
@@ -957,11 +962,14 @@ declare function createPathCompat(option: string): ArgvTransform;
957
962
  interface ExecuteOptions {
958
963
  pipeStdout?: boolean;
959
964
  pipeStderr?: boolean;
965
+ timeout?: number;
960
966
  }
961
967
  /**
962
968
  * @description 执行 CLI 命令并透传输出
963
969
  */
964
- declare function execute(cliPath: string, argv: string[], options?: ExecuteOptions): Promise<import("execa").Result<{}>>;
970
+ declare function execute(cliPath: string, argv: string[], options?: ExecuteOptions): Promise<import("execa").Result<{
971
+ timeout: number | undefined;
972
+ }>>;
965
973
  //#endregion
966
974
  //#region src/utils/path.d.ts
967
975
  /**
@@ -969,4 +977,4 @@ declare function execute(cliPath: string, argv: string[], options?: ExecuteOptio
969
977
  */
970
978
  declare function resolvePath(filePath: string): string;
971
979
  //#endregion
972
- 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, RunWechatCliWithRetryOptions, 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, getRuntimeWechatDevtoolsServicePort, 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, setRuntimeWechatDevtoolsServicePort, setWechatIdeTicket, startForwardConsole, startWeappIdeMcpServer, startWechatIdeEngineBuildByHttp, switchTab, systemInfo, takeScreenshot, tap, toSerializableValue, transformArgv, uploadWechatIde, validateWechatCliCommandArgs, waitForExclusiveKeypress, waitForRetryKeypress, withMiniProgram };
980
+ 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, RunWechatCliWithRetryOptions, 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, getRuntimeWechatDevtoolsServicePort, getSharedMiniProgramSessionCount, getWechatIdeTestAccounts, getWechatIdeTicket, getWechatIdeToolInfo, handleConfigCommand, input, isAutomatorCommand, isAutomatorLoginError, isAutomatorPortInUseError, 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, setRuntimeWechatDevtoolsServicePort, 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 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-CkojbnCg.js";
2
- import { $ as getRuntimeWechatDevtoolsServicePort, 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 setRuntimeWechatDevtoolsServicePort, f as scrollTo, g as tap, h as takeScreenshot, i as input, it as removeOption, j as loginWechatIde, k as getWechatIdeToolInfo, l as reLaunch, m as systemInfo, n as captureScreenshotBuffer, nt as readBooleanOption, o as navigateTo, p as switchTab, q as WECHAT_DEVTOOLS_ENGINE_BUILD_STATUSES, r as currentPage, rt as readOptionValue, s as pageData, t as audit, tt as parseAutomatorArgs, u as redirectTo, v as autoReplayWechatIde, w as clearWechatIdeCacheByAutomator, x as buildWechatIdeIpa, y as autoWechatIde, z as uploadWechatIde } from "./commands-Ijtoy2_F.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-DSrMNDWQ.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-CUUdfBm7.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, getRuntimeWechatDevtoolsServicePort, 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, setRuntimeWechatDevtoolsServicePort, setWechatIdeTicket, startForwardConsole, startWeappIdeMcpServer, startWechatIdeEngineBuildByHttp, switchTab, systemInfo, takeScreenshot, tap, toSerializableValue, transformArgv, uploadWechatIde, validateWechatCliCommandArgs, waitForExclusiveKeypress, waitForRetryKeypress, withMiniProgram };
1
+ import { $ as createLocaleConfig, A as isAutomatorPortInUseError, B as resolveCliPath, D as formatAutomatorLoginError, E as connectOpenedAutomator, F as isRetryableAutomatorLaunchError, G as getDefaultCliPath, H as getConfiguredLocale, I as launchAutomator, K as isOperatingSystemSupported, L as resolveProjectAutomatorPort, M as isAutomatorWsConnectError, N as isDevtoolsExtensionContextInvalidatedError, O as getAutomatorProtocolTimeoutMethod, P as isDevtoolsHttpPortError, Q as createCustomConfig, R as bootstrapWechatDevtoolsSettings, S as waitForExclusiveKeypress, U as resolveDevtoolsAutomationDefaults, V as getConfig, W as SupportedPlatformsMap, X as createAutoBootstrapDevtoolsConfig, Z as createAutoTrustProjectConfig, _ as promptRetryKeypress, a as releaseSharedMiniProgram, at as resolvePath, b as createSharedInputSession, c as RETRY_CANCEL_KEYS, d as createWechatIdeLoginRequiredExitError, et as overwriteCustomConfig, f as extractExecutionErrorText, g as isWechatIdeLoginRequiredExitError, h as isWechatIdeLoginRequiredError, i as getSharedMiniProgramSessionCount, it as defaultCustomConfigFilePath, j as isAutomatorProtocolTimeoutError, k as isAutomatorLoginError, l as RETRY_CONFIRM_KEYS, m as formatWechatIdeLoginRequiredError, n as closeSharedMiniProgram, nt as removeCustomConfigKey, o as withMiniProgram, p as formatRetryHotkeyPrompt, q as operatingSystemName, r as connectMiniProgram, rt as defaultCustomConfigDirPath, s as runRetryableCommand, t as acquireSharedMiniProgram, tt as readCustomConfig, u as RETRY_PROMPT_INITIAL_IGNORE_MS, v as promptWechatIdeLoginRetry, x as runWithSuspendedSharedInput, y as waitForRetryKeypress, z as detectWechatDevtoolsServicePort } from "./automator-session-BIjYknSi.js";
2
+ import { $ as getRuntimeWechatDevtoolsServicePort, 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 setRuntimeWechatDevtoolsServicePort, f as scrollTo, g as tap, h as takeScreenshot, i as input, it as removeOption, j as loginWechatIde, k as getWechatIdeToolInfo, l as reLaunch, m as systemInfo, n as captureScreenshotBuffer, nt as readBooleanOption, o as navigateTo, p as switchTab, q as WECHAT_DEVTOOLS_ENGINE_BUILD_STATUSES, r as currentPage, rt as readOptionValue, s as pageData, t as audit, tt as parseAutomatorArgs, u as redirectTo, v as autoReplayWechatIde, w as clearWechatIdeCacheByAutomator, x as buildWechatIdeIpa, y as autoWechatIde, z as uploadWechatIde } from "./commands-9WCVsqHn.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-BvhTwRjo.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-BHW8rcxB.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, getRuntimeWechatDevtoolsServicePort, getSharedMiniProgramSessionCount, getWechatIdeTestAccounts, getWechatIdeTicket, getWechatIdeToolInfo, handleConfigCommand, input, isAutomatorCommand, isAutomatorLoginError, isAutomatorPortInUseError, 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, setRuntimeWechatDevtoolsServicePort, 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-CkojbnCg.js";
1
+ import { o as withMiniProgram$1 } from "./automator-session-BIjYknSi.js";
2
2
  import { Buffer } from "node:buffer";
3
3
  import fs from "node:fs/promises";
4
4
  import path from "node:path";
@@ -0,0 +1,2 @@
1
+ import { t as runMcpCommand } from "./run-mcp-BHW8rcxB.js";
2
+ export { runMcpCommand };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "weapp-ide-cli",
3
3
  "type": "module",
4
- "version": "6.0.7",
4
+ "version": "6.0.8",
5
5
  "description": "让微信开发者工具,用起来更加方便!",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -69,10 +69,10 @@
69
69
  "pixelmatch": "^7.2.0",
70
70
  "pngjs": "^7.0.0",
71
71
  "zod": "^4.4.3",
72
- "@weapp-core/logger": "3.1.1",
73
- "@weapp-vite/miniprogram-automator": "1.2.14",
74
- "@weapp-vite/devtools-runtime": "0.4.15",
75
- "@weapp-core/shared": "3.1.1"
72
+ "@weapp-vite/miniprogram-automator": "1.2.15",
73
+ "@weapp-core/shared": "3.2.0",
74
+ "@weapp-vite/devtools-runtime": "0.4.16",
75
+ "@weapp-core/logger": "3.1.1"
76
76
  },
77
77
  "scripts": {
78
78
  "dev": "tsdown -w --sourcemap",
@@ -1,2 +0,0 @@
1
- import { h as takeScreenshot } from "./commands-Ijtoy2_F.js";
2
- export { takeScreenshot };
@@ -1,2 +0,0 @@
1
- import { t as runMcpCommand } from "./run-mcp-CUUdfBm7.js";
2
- export { runMcpCommand };