weapp-ide-cli 5.2.6 → 5.2.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.
- package/dist/{cli-lB9HDuk-.js → cli-CYRxSZ0F.js} +151 -3
- package/dist/cli.js +2 -2
- package/dist/commands-BYt68gRi.js +2 -0
- package/dist/{commands-XD_wemcg.js → commands-CcaDGUMU.js} +22 -77
- package/dist/index.d.ts +6 -30
- package/dist/index.js +2 -2
- package/package.json +4 -3
- package/dist/commands-CVibHgp4.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as readCustomConfig, B as getConfiguredLocale, C as configureLocaleFromArgv, G as operatingSystemName, I as bootstrapWechatDevtoolsSettings, J as createAutoBootstrapDevtoolsConfig, K as colors, L as detectWechatDevtoolsServicePort, Q as overwriteCustomConfig, R as resolveCliPath, S as withMiniProgram, T as validateLocaleOption, V as resolveDevtoolsAutomationDefaults, W as isOperatingSystemSupported, X as createCustomConfig, Y as createAutoTrustProjectConfig, Z as createLocaleConfig, a as navigateBack, c as pageStack, d as remote, et as removeCustomConfigKey, f as scrollTo, g as tap, i as input, l as reLaunch, m as systemInfo, n as captureScreenshotBuffer, nt as defaultCustomConfigFilePath, o as navigateTo, p as switchTab, q as logger_default, r as currentPage, rt as resolvePath, s as pageData, t as audit, u as redirectTo, w as i18nText, y as connectMiniProgram } from "./commands-
|
|
1
|
+
import { $ as readCustomConfig, B as getConfiguredLocale, C as configureLocaleFromArgv, G as operatingSystemName, I as bootstrapWechatDevtoolsSettings, J as createAutoBootstrapDevtoolsConfig, K as colors, L as detectWechatDevtoolsServicePort, Q as overwriteCustomConfig, R as resolveCliPath, S as withMiniProgram, T as validateLocaleOption, V as resolveDevtoolsAutomationDefaults, W as isOperatingSystemSupported, X as createCustomConfig, Y as createAutoTrustProjectConfig, Z as createLocaleConfig, a as navigateBack, c as pageStack, d as remote, et as removeCustomConfigKey, f as scrollTo, g as tap, i as input, l as reLaunch, m as systemInfo, n as captureScreenshotBuffer, nt as defaultCustomConfigFilePath, o as navigateTo, p as switchTab, q as logger_default, r as currentPage, rt as resolvePath, s as pageData, t as audit, u as redirectTo, w as i18nText, y as connectMiniProgram } from "./commands-CcaDGUMU.js";
|
|
2
2
|
import fs from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { fs as fs$1 } from "@weapp-core/shared/fs";
|
|
@@ -17,7 +17,7 @@ function parsePositiveInt(raw) {
|
|
|
17
17
|
return value;
|
|
18
18
|
}
|
|
19
19
|
function takesValue(optionName) {
|
|
20
|
-
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 === "--qr-output" || optionName === "-r" || optionName === "--result-output" || optionName === "--info-output" || optionName === "-i";
|
|
20
|
+
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";
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* @description 解析 automator 命令通用参数与位置参数。
|
|
@@ -354,6 +354,8 @@ ${colors.bold("参数:")}
|
|
|
354
354
|
--page <path> 截图前先跳转页面
|
|
355
355
|
--full-page 输出整页长截图
|
|
356
356
|
-t, --timeout <ms> 连接超时时间(默认:30000)
|
|
357
|
+
--runtime-url <url> 复用本地 runtime service 地址
|
|
358
|
+
--no-runtime-service 跳过 runtime service,直接连接 DevTools
|
|
357
359
|
--json 以 JSON 格式输出
|
|
358
360
|
--lang <lang> 语言切换:zh | en(默认:zh)
|
|
359
361
|
-h, --help 显示此帮助信息
|
|
@@ -382,6 +384,8 @@ ${colors.bold("Options:")}
|
|
|
382
384
|
--page <path> Navigate to page before taking screenshot
|
|
383
385
|
--full-page Capture a stitched full-page screenshot
|
|
384
386
|
-t, --timeout <ms> Connection timeout in milliseconds (default: 30000)
|
|
387
|
+
--runtime-url <url> Runtime service URL for shared sessions
|
|
388
|
+
--no-runtime-service Skip runtime service and connect to DevTools directly
|
|
385
389
|
--json Output as JSON format
|
|
386
390
|
--lang <lang> Language: zh | en (default: zh)
|
|
387
391
|
-h, --help Show this help message
|
|
@@ -429,7 +433,7 @@ async function runScreenshot(argv) {
|
|
|
429
433
|
}
|
|
430
434
|
const options = parseScreenshotArgs(argv);
|
|
431
435
|
const isJsonOutput = argv.includes("--json");
|
|
432
|
-
const { takeScreenshot } = await import("./commands-
|
|
436
|
+
const { takeScreenshot } = await import("./commands-BYt68gRi.js");
|
|
433
437
|
const result = await takeScreenshot(options);
|
|
434
438
|
if (isJsonOutput) {
|
|
435
439
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -438,6 +442,132 @@ async function runScreenshot(argv) {
|
|
|
438
442
|
if (result.base64) console.log(result.base64);
|
|
439
443
|
}
|
|
440
444
|
//#endregion
|
|
445
|
+
//#region src/cli/runtime-service.ts
|
|
446
|
+
const DEFAULT_RUNTIME_SERVICE_URL = "http://127.0.0.1:3088/api/weapp/devtools";
|
|
447
|
+
const SERVICE_UNAVAILABLE_CODES = new Set([
|
|
448
|
+
"ECONNREFUSED",
|
|
449
|
+
"ECONNRESET",
|
|
450
|
+
"ENOTFOUND",
|
|
451
|
+
"UND_ERR_SOCKET",
|
|
452
|
+
"UND_ERR_CONNECT_TIMEOUT"
|
|
453
|
+
]);
|
|
454
|
+
function isRuntimeServiceDisabled(argv) {
|
|
455
|
+
return argv.includes("--no-runtime-service") || process.env.WEAPP_VITE_RUNTIME_REST_URL === "false" || process.env.WEAPP_IDE_CLI_RUNTIME_REST_URL === "false";
|
|
456
|
+
}
|
|
457
|
+
function resolveRuntimeServiceUrl(argv) {
|
|
458
|
+
const explicit = readOptionValue(argv, "--runtime-url");
|
|
459
|
+
const envValue = process.env.WEAPP_VITE_RUNTIME_REST_URL || process.env.WEAPP_IDE_CLI_RUNTIME_REST_URL;
|
|
460
|
+
return (explicit || envValue || DEFAULT_RUNTIME_SERVICE_URL).replace(/\/+$/, "");
|
|
461
|
+
}
|
|
462
|
+
function resolveProjectPath(projectPath) {
|
|
463
|
+
return path.resolve(projectPath);
|
|
464
|
+
}
|
|
465
|
+
function resolveOutputPath(outputPath) {
|
|
466
|
+
return outputPath ? path.resolve(outputPath) : void 0;
|
|
467
|
+
}
|
|
468
|
+
function createConnectionPayload(args) {
|
|
469
|
+
return {
|
|
470
|
+
projectPath: resolveProjectPath(args.projectPath),
|
|
471
|
+
...args.timeout ? { timeout: args.timeout } : {}
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
function isServiceUnavailable(error) {
|
|
475
|
+
const maybeError = error;
|
|
476
|
+
const code = maybeError?.code ?? maybeError?.cause?.code;
|
|
477
|
+
return typeof code === "string" && SERVICE_UNAVAILABLE_CODES.has(code);
|
|
478
|
+
}
|
|
479
|
+
async function requestRuntimeService(baseUrl, endpoint, payload, timeout = 1e3) {
|
|
480
|
+
const response = await fetch(`${baseUrl}${endpoint}`, {
|
|
481
|
+
body: payload ? JSON.stringify(payload) : void 0,
|
|
482
|
+
headers: payload ? { "content-type": "application/json" } : void 0,
|
|
483
|
+
method: payload ? "POST" : "GET",
|
|
484
|
+
signal: AbortSignal.timeout(timeout)
|
|
485
|
+
});
|
|
486
|
+
if (response.status === 404) return;
|
|
487
|
+
const data = await response.json().catch(() => void 0);
|
|
488
|
+
if (!response.ok) throw new Error(data?.error?.message || `runtime service request failed: ${response.status}`);
|
|
489
|
+
if (!data?.ok) throw new Error(data?.error?.message || "runtime service request failed");
|
|
490
|
+
return data.result;
|
|
491
|
+
}
|
|
492
|
+
async function tryRequestRuntimeService(baseUrl, endpoint, payload, timeout) {
|
|
493
|
+
try {
|
|
494
|
+
return await requestRuntimeService(baseUrl, endpoint, payload, timeout);
|
|
495
|
+
} catch (error) {
|
|
496
|
+
if (isServiceUnavailable(error) || error instanceof Error && error.name === "TimeoutError") return;
|
|
497
|
+
throw error;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
function printJsonResult(result) {
|
|
501
|
+
console.log(JSON.stringify(result, null, 2));
|
|
502
|
+
}
|
|
503
|
+
function formatRuntimeServiceUrl(baseUrl) {
|
|
504
|
+
return colors.cyan(baseUrl);
|
|
505
|
+
}
|
|
506
|
+
async function runRouteCommand(command, args, baseUrl) {
|
|
507
|
+
const transition = {
|
|
508
|
+
"back": "navigateBack",
|
|
509
|
+
"navigate": "navigateTo",
|
|
510
|
+
"redirect": "redirectTo",
|
|
511
|
+
"relaunch": "reLaunch",
|
|
512
|
+
"switch-tab": "switchTab"
|
|
513
|
+
}[command];
|
|
514
|
+
if (!transition) return false;
|
|
515
|
+
const pagePath = args.positionals[0];
|
|
516
|
+
if (transition !== "navigateBack" && !pagePath) return false;
|
|
517
|
+
const result = await tryRequestRuntimeService(baseUrl, "/route", {
|
|
518
|
+
...createConnectionPayload(args),
|
|
519
|
+
...pagePath ? { path: pagePath } : {},
|
|
520
|
+
transition
|
|
521
|
+
}, (args.timeout ?? 3e4) + 5e3);
|
|
522
|
+
if (result === void 0) return false;
|
|
523
|
+
if (args.json) printJsonResult(result);
|
|
524
|
+
else logger_default.success(`已通过 runtime service 执行 ${command}:${formatRuntimeServiceUrl(baseUrl)}`);
|
|
525
|
+
return true;
|
|
526
|
+
}
|
|
527
|
+
async function runInfoCommand(command, args, baseUrl) {
|
|
528
|
+
const endpoint = {
|
|
529
|
+
"current-page": "/active-page",
|
|
530
|
+
"page-stack": "/page-stack"
|
|
531
|
+
}[command];
|
|
532
|
+
if (!endpoint) return false;
|
|
533
|
+
const result = await tryRequestRuntimeService(baseUrl, endpoint, createConnectionPayload(args), (args.timeout ?? 3e4) + 5e3);
|
|
534
|
+
if (result === void 0) return false;
|
|
535
|
+
printJsonResult(result);
|
|
536
|
+
return true;
|
|
537
|
+
}
|
|
538
|
+
async function runScreenshotCommand(argv, baseUrl) {
|
|
539
|
+
const options = parseScreenshotArgs(argv);
|
|
540
|
+
if (options.fullPage) return false;
|
|
541
|
+
if (options.page) {
|
|
542
|
+
if (await tryRequestRuntimeService(baseUrl, "/route", {
|
|
543
|
+
projectPath: resolveProjectPath(options.projectPath),
|
|
544
|
+
...options.timeout ? { timeout: options.timeout } : {},
|
|
545
|
+
path: options.page,
|
|
546
|
+
transition: "reLaunch"
|
|
547
|
+
}, (options.timeout ?? 3e4) + 5e3) === void 0) return false;
|
|
548
|
+
}
|
|
549
|
+
const result = await tryRequestRuntimeService(baseUrl, "/capture", {
|
|
550
|
+
projectPath: resolveProjectPath(options.projectPath),
|
|
551
|
+
...options.timeout ? { timeout: options.timeout } : {},
|
|
552
|
+
...options.outputPath ? { outputPath: resolveOutputPath(options.outputPath) } : {}
|
|
553
|
+
}, (options.timeout ?? 3e4) + 5e3);
|
|
554
|
+
if (result === void 0) return false;
|
|
555
|
+
if (argv.includes("--json")) printJsonResult(options.outputPath ? { path: options.outputPath } : result);
|
|
556
|
+
else if (options.outputPath) logger_default.success(`截图已通过 runtime service 保存到 ${colors.cyan(options.outputPath)}`);
|
|
557
|
+
else if (result.base64) process.stdout.write(`${result.base64}\n`);
|
|
558
|
+
return true;
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* @description 优先复用本地 runtime service,避免 CLI 单独建立 automator 连接。
|
|
562
|
+
*/
|
|
563
|
+
async function tryRunRuntimeServiceCommand(command, argv) {
|
|
564
|
+
if (isRuntimeServiceDisabled(argv)) return false;
|
|
565
|
+
const baseUrl = resolveRuntimeServiceUrl(argv);
|
|
566
|
+
if (command === "screenshot") return await runScreenshotCommand(argv, baseUrl);
|
|
567
|
+
const args = parseAutomatorArgs(argv);
|
|
568
|
+
return await runRouteCommand(command, args, baseUrl) || await runInfoCommand(command, args, baseUrl);
|
|
569
|
+
}
|
|
570
|
+
//#endregion
|
|
441
571
|
//#region src/cli/run-automator.ts
|
|
442
572
|
const COMMON_OPTION_DEFINITIONS = [
|
|
443
573
|
{
|
|
@@ -454,6 +584,20 @@ const COMMON_OPTION_DEFINITIONS = [
|
|
|
454
584
|
en: "Connection timeout (default: 30000)"
|
|
455
585
|
}
|
|
456
586
|
},
|
|
587
|
+
{
|
|
588
|
+
flag: "--runtime-url <url>",
|
|
589
|
+
description: {
|
|
590
|
+
zh: "复用本地 runtime service 地址",
|
|
591
|
+
en: "Runtime service URL for shared sessions"
|
|
592
|
+
}
|
|
593
|
+
},
|
|
594
|
+
{
|
|
595
|
+
flag: "--no-runtime-service",
|
|
596
|
+
description: {
|
|
597
|
+
zh: "跳过 runtime service,直接连接 DevTools",
|
|
598
|
+
en: "Skip runtime service and connect to DevTools directly"
|
|
599
|
+
}
|
|
600
|
+
},
|
|
457
601
|
{
|
|
458
602
|
flag: "--json",
|
|
459
603
|
description: {
|
|
@@ -481,6 +625,8 @@ const COMMON_ALLOWED_OPTIONS = new Set([
|
|
|
481
625
|
"--project",
|
|
482
626
|
"-t",
|
|
483
627
|
"--timeout",
|
|
628
|
+
"--runtime-url",
|
|
629
|
+
"--no-runtime-service",
|
|
484
630
|
"--json",
|
|
485
631
|
"--lang",
|
|
486
632
|
"-h",
|
|
@@ -748,6 +894,7 @@ function printCommandHelp(command) {
|
|
|
748
894
|
*/
|
|
749
895
|
async function runAutomatorCommand(command, argv) {
|
|
750
896
|
if (command === "screenshot") {
|
|
897
|
+
if (!argv.includes("-h") && !argv.includes("--help") && await tryRunRuntimeServiceCommand(command, argv)) return;
|
|
751
898
|
await runScreenshot(argv);
|
|
752
899
|
return;
|
|
753
900
|
}
|
|
@@ -762,6 +909,7 @@ async function runAutomatorCommand(command, argv) {
|
|
|
762
909
|
return;
|
|
763
910
|
}
|
|
764
911
|
validateUnsupportedOptions(command, argv, definition.allowedOptions);
|
|
912
|
+
if (await tryRunRuntimeServiceCommand(command, argv)) return;
|
|
765
913
|
const args = parseAutomatorArgs(argv);
|
|
766
914
|
await definition.handler({
|
|
767
915
|
argv,
|
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { q as logger_default } from "./commands-
|
|
2
|
-
import { n as parse } from "./cli-
|
|
1
|
+
import { q as logger_default } from "./commands-CcaDGUMU.js";
|
|
2
|
+
import { n as parse } from "./cli-CYRxSZ0F.js";
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
//#region src/cli.ts
|
|
5
5
|
const argv = process.argv.slice(2);
|
|
@@ -8,6 +8,7 @@ import process from "node:process";
|
|
|
8
8
|
import path$1 from "pathe";
|
|
9
9
|
import logger, { colors } from "@weapp-core/logger";
|
|
10
10
|
import { createHash } from "node:crypto";
|
|
11
|
+
import { acquireSharedMiniProgram, closeSharedMiniProgram, getSharedMiniProgramSessionCount, releaseSharedMiniProgram, withMiniProgram } from "@weapp-vite/devtools-runtime";
|
|
11
12
|
import { PNG } from "pngjs";
|
|
12
13
|
//#region src/utils/path.ts
|
|
13
14
|
/**
|
|
@@ -752,7 +753,6 @@ function readLangOption(argv) {
|
|
|
752
753
|
}
|
|
753
754
|
//#endregion
|
|
754
755
|
//#region src/cli/automator-session.ts
|
|
755
|
-
const sharedMiniProgramSessions = /* @__PURE__ */ new Map();
|
|
756
756
|
function normalizeMiniProgramConnectionError(error) {
|
|
757
757
|
if (isAutomatorLoginError(error)) {
|
|
758
758
|
logger_default.error(i18nText("检测到微信开发者工具登录状态失效,请先登录后重试。", "Wechat DevTools login has expired. Please login and retry."));
|
|
@@ -771,7 +771,7 @@ function normalizeMiniProgramConnectionError(error) {
|
|
|
771
771
|
}
|
|
772
772
|
if (isAutomatorWsConnectError(error)) {
|
|
773
773
|
logger_default.error(i18nText("无法连接到当前项目的微信开发者工具自动化 websocket。", "Cannot connect to the Wechat DevTools automation websocket for the current project."));
|
|
774
|
-
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
|
|
774
|
+
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."));
|
|
775
775
|
return /* @__PURE__ */ new Error("DEVTOOLS_WS_CONNECT_ERROR");
|
|
776
776
|
}
|
|
777
777
|
if (isAutomatorProtocolTimeoutError(error)) {
|
|
@@ -803,76 +803,21 @@ async function connectMiniProgram(options) {
|
|
|
803
803
|
}
|
|
804
804
|
}
|
|
805
805
|
}
|
|
806
|
+
const runtimeHooks = {
|
|
807
|
+
connectMiniProgram,
|
|
808
|
+
normalizeConnectionError: normalizeMiniProgramConnectionError
|
|
809
|
+
};
|
|
806
810
|
/**
|
|
807
811
|
* @description 获取指定项目的共享 automator 会话;若不存在则自动创建。
|
|
808
812
|
*/
|
|
809
|
-
async function acquireSharedMiniProgram(options) {
|
|
810
|
-
|
|
811
|
-
if (existing) {
|
|
812
|
-
existing.refs += 1;
|
|
813
|
-
return await existing.session;
|
|
814
|
-
}
|
|
815
|
-
const session = connectMiniProgram(options);
|
|
816
|
-
const entry = {
|
|
817
|
-
refs: 1,
|
|
818
|
-
session
|
|
819
|
-
};
|
|
820
|
-
sharedMiniProgramSessions.set(options.projectPath, entry);
|
|
821
|
-
try {
|
|
822
|
-
return await session;
|
|
823
|
-
} catch (error) {
|
|
824
|
-
sharedMiniProgramSessions.delete(options.projectPath);
|
|
825
|
-
throw error;
|
|
826
|
-
}
|
|
827
|
-
}
|
|
828
|
-
/**
|
|
829
|
-
* @description 释放指定项目的共享会话引用;会话对象会继续缓存,直到显式关闭或重置。
|
|
830
|
-
*/
|
|
831
|
-
function releaseSharedMiniProgram(projectPath) {
|
|
832
|
-
const entry = sharedMiniProgramSessions.get(projectPath);
|
|
833
|
-
if (!entry) return;
|
|
834
|
-
entry.refs = Math.max(0, entry.refs - 1);
|
|
835
|
-
}
|
|
836
|
-
/**
|
|
837
|
-
* @description 关闭并移除指定项目的共享 automator 会话。
|
|
838
|
-
*/
|
|
839
|
-
async function closeSharedMiniProgram(projectPath) {
|
|
840
|
-
const entry = sharedMiniProgramSessions.get(projectPath);
|
|
841
|
-
if (!entry) return;
|
|
842
|
-
sharedMiniProgramSessions.delete(projectPath);
|
|
843
|
-
(await entry.session.catch(() => null))?.disconnect();
|
|
844
|
-
}
|
|
845
|
-
/**
|
|
846
|
-
* @description 获取当前共享会话数量,供测试断言使用。
|
|
847
|
-
*/
|
|
848
|
-
function getSharedMiniProgramSessionCount() {
|
|
849
|
-
return sharedMiniProgramSessions.size;
|
|
813
|
+
async function acquireSharedMiniProgram$1(options) {
|
|
814
|
+
return await acquireSharedMiniProgram(runtimeHooks, options);
|
|
850
815
|
}
|
|
851
816
|
/**
|
|
852
817
|
* @description 统一管理 automator 会话生命周期。
|
|
853
818
|
*/
|
|
854
|
-
async function withMiniProgram(options, runner) {
|
|
855
|
-
|
|
856
|
-
if (options.sharedSession) {
|
|
857
|
-
const miniProgram = await acquireSharedMiniProgram(options);
|
|
858
|
-
try {
|
|
859
|
-
return await runner(miniProgram);
|
|
860
|
-
} catch (error) {
|
|
861
|
-
await closeSharedMiniProgram(options.projectPath);
|
|
862
|
-
throw normalizeMiniProgramConnectionError(error);
|
|
863
|
-
} finally {
|
|
864
|
-
releaseSharedMiniProgram(options.projectPath);
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
let miniProgram = null;
|
|
868
|
-
try {
|
|
869
|
-
miniProgram = await connectMiniProgram(options);
|
|
870
|
-
return await runner(miniProgram);
|
|
871
|
-
} catch (error) {
|
|
872
|
-
throw normalizeMiniProgramConnectionError(error);
|
|
873
|
-
} finally {
|
|
874
|
-
if (miniProgram) await miniProgram.close();
|
|
875
|
-
}
|
|
819
|
+
async function withMiniProgram$1(options, runner) {
|
|
820
|
+
return await withMiniProgram(runtimeHooks, options, runner);
|
|
876
821
|
}
|
|
877
822
|
//#endregion
|
|
878
823
|
//#region src/cli/fullPageScreenshot.ts
|
|
@@ -991,7 +936,7 @@ function withCommandTimeout(task, timeoutMs, message, code) {
|
|
|
991
936
|
});
|
|
992
937
|
}
|
|
993
938
|
async function runRouteCommand(options, startMessage, successMessage, action) {
|
|
994
|
-
await withMiniProgram(options, async (miniProgram) => {
|
|
939
|
+
await withMiniProgram$1(options, async (miniProgram) => {
|
|
995
940
|
logger_default.info(startMessage);
|
|
996
941
|
await action(miniProgram);
|
|
997
942
|
logger_default.success(successMessage);
|
|
@@ -1050,7 +995,7 @@ async function switchTab(options) {
|
|
|
1050
995
|
* @description 获取页面栈。
|
|
1051
996
|
*/
|
|
1052
997
|
async function pageStack(options) {
|
|
1053
|
-
return await withMiniProgram(options, async (miniProgram) => {
|
|
998
|
+
return await withMiniProgram$1(options, async (miniProgram) => {
|
|
1054
999
|
const result = (await miniProgram.pageStack()).map(toPageSnapshot);
|
|
1055
1000
|
printStructuredResult(result, options.json, i18nText("页面栈:", "Page stack:"));
|
|
1056
1001
|
return result;
|
|
@@ -1060,7 +1005,7 @@ async function pageStack(options) {
|
|
|
1060
1005
|
* @description 获取当前页面信息。
|
|
1061
1006
|
*/
|
|
1062
1007
|
async function currentPage(options) {
|
|
1063
|
-
return await withMiniProgram(options, async (miniProgram) => {
|
|
1008
|
+
return await withMiniProgram$1(options, async (miniProgram) => {
|
|
1064
1009
|
const result = toPageSnapshot(await miniProgram.currentPage());
|
|
1065
1010
|
if (options.json) console.log(JSON.stringify(result, null, 2));
|
|
1066
1011
|
else logger_default.info(i18nText(`当前页面: ${result.path}${result.query ? ` ${JSON.stringify(result.query)}` : ""}`, `Current page: ${result.path}${result.query ? ` ${JSON.stringify(result.query)}` : ""}`));
|
|
@@ -1071,7 +1016,7 @@ async function currentPage(options) {
|
|
|
1071
1016
|
* @description 获取系统信息。
|
|
1072
1017
|
*/
|
|
1073
1018
|
async function systemInfo(options) {
|
|
1074
|
-
return await withMiniProgram(options, async (miniProgram) => {
|
|
1019
|
+
return await withMiniProgram$1(options, async (miniProgram) => {
|
|
1075
1020
|
const result = await miniProgram.systemInfo();
|
|
1076
1021
|
printStructuredResult(result, options.json, i18nText("系统信息:", "System info:"));
|
|
1077
1022
|
return result;
|
|
@@ -1081,7 +1026,7 @@ async function systemInfo(options) {
|
|
|
1081
1026
|
* @description 获取当前页面数据。
|
|
1082
1027
|
*/
|
|
1083
1028
|
async function pageData(options) {
|
|
1084
|
-
return await withMiniProgram(options, async (miniProgram) => {
|
|
1029
|
+
return await withMiniProgram$1(options, async (miniProgram) => {
|
|
1085
1030
|
const result = await (await miniProgram.currentPage()).data(options.path);
|
|
1086
1031
|
printStructuredResult(result, options.json, i18nText("页面数据:", "Page data:"));
|
|
1087
1032
|
return result;
|
|
@@ -1091,7 +1036,7 @@ async function pageData(options) {
|
|
|
1091
1036
|
* @description 点击页面元素。
|
|
1092
1037
|
*/
|
|
1093
1038
|
async function tap(options) {
|
|
1094
|
-
await withMiniProgram(options, async (miniProgram) => {
|
|
1039
|
+
await withMiniProgram$1(options, async (miniProgram) => {
|
|
1095
1040
|
logger_default.info(i18nText(`正在点击元素 ${colors.cyan(options.selector)}...`, `Tapping element ${colors.cyan(options.selector)}...`));
|
|
1096
1041
|
await (await requireElement(await miniProgram.currentPage(), options.selector)).tap();
|
|
1097
1042
|
logger_default.success(i18nText(`已点击元素 ${colors.cyan(options.selector)}`, `Tapped element ${colors.cyan(options.selector)}`));
|
|
@@ -1101,7 +1046,7 @@ async function tap(options) {
|
|
|
1101
1046
|
* @description 向页面元素输入文本。
|
|
1102
1047
|
*/
|
|
1103
1048
|
async function input(options) {
|
|
1104
|
-
await withMiniProgram(options, async (miniProgram) => {
|
|
1049
|
+
await withMiniProgram$1(options, async (miniProgram) => {
|
|
1105
1050
|
logger_default.info(i18nText(`正在向 ${colors.cyan(options.selector)} 输入 "${colors.cyan(options.value)}"...`, `Inputting "${colors.cyan(options.value)}" into ${colors.cyan(options.selector)}...`));
|
|
1106
1051
|
const element = await requireElement(await miniProgram.currentPage(), options.selector);
|
|
1107
1052
|
if (typeof element.input !== "function") throw new TypeError(i18nText(`元素不支持输入: ${options.selector}`, `Element does not support input: ${options.selector}`));
|
|
@@ -1113,7 +1058,7 @@ async function input(options) {
|
|
|
1113
1058
|
* @description 滚动页面到指定位置。
|
|
1114
1059
|
*/
|
|
1115
1060
|
async function scrollTo(options) {
|
|
1116
|
-
await withMiniProgram(options, async (miniProgram) => {
|
|
1061
|
+
await withMiniProgram$1(options, async (miniProgram) => {
|
|
1117
1062
|
logger_default.info(i18nText(`正在滚动到位置 ${colors.cyan(String(options.scrollTop))}...`, `Scrolling to position ${colors.cyan(String(options.scrollTop))}...`));
|
|
1118
1063
|
await miniProgram.pageScrollTo(options.scrollTop);
|
|
1119
1064
|
logger_default.success(i18nText(`已滚动到位置 ${colors.cyan(String(options.scrollTop))}`, `Scrolled to position ${colors.cyan(String(options.scrollTop))}`));
|
|
@@ -1123,7 +1068,7 @@ async function scrollTo(options) {
|
|
|
1123
1068
|
* @description 执行体验评分审计。
|
|
1124
1069
|
*/
|
|
1125
1070
|
async function audit(options) {
|
|
1126
|
-
return await withMiniProgram(options, async (miniProgram) => {
|
|
1071
|
+
return await withMiniProgram$1(options, async (miniProgram) => {
|
|
1127
1072
|
logger_default.info(i18nText("正在执行体验审计...", "Running experience audit..."));
|
|
1128
1073
|
const result = await miniProgram.stopAudits();
|
|
1129
1074
|
if (options.outputPath) {
|
|
@@ -1139,7 +1084,7 @@ async function audit(options) {
|
|
|
1139
1084
|
* @description 捕获当前页面截图并返回二进制内容。
|
|
1140
1085
|
*/
|
|
1141
1086
|
async function captureScreenshotBuffer(options) {
|
|
1142
|
-
return await withMiniProgram(options, async (miniProgram) => {
|
|
1087
|
+
return await withMiniProgram$1(options, async (miniProgram) => {
|
|
1143
1088
|
const commandTimeout = options.timeout ?? 3e4;
|
|
1144
1089
|
const screenshotTimeoutMessage = i18nText(`截图请求在 ${commandTimeout}ms 内未收到 DevTools 回包,请检查当前微信开发者工具是否仍停留在目标项目;若近期执行过其他 e2e / screenshot 任务,关闭多余窗口并清理残留 automator 会话后重试。`, `Screenshot request did not receive a DevTools response within ${commandTimeout}ms. Check that the current Wechat DevTools window is still the target project. If you recently ran other e2e or screenshot tasks, close extra windows and clean up stale automator sessions before retrying.`);
|
|
1145
1090
|
if (!options.miniProgram) logger_default.info(i18nText(`正在连接 DevTools:${colors.cyan(options.projectPath)}...`, `Connecting to DevTools at ${colors.cyan(options.projectPath)}...`));
|
|
@@ -1196,11 +1141,11 @@ async function takeScreenshot(options) {
|
|
|
1196
1141
|
*/
|
|
1197
1142
|
async function remote(options) {
|
|
1198
1143
|
const enable = options.enable ?? true;
|
|
1199
|
-
await withMiniProgram(options, async (miniProgram) => {
|
|
1144
|
+
await withMiniProgram$1(options, async (miniProgram) => {
|
|
1200
1145
|
logger_default.info(enable ? i18nText("正在开启远程调试...", "Enabling remote debugging...") : i18nText("正在关闭远程调试...", "Disabling remote debugging..."));
|
|
1201
1146
|
await miniProgram.remote(enable);
|
|
1202
1147
|
logger_default.success(enable ? i18nText("远程调试已开启", "Remote debugging enabled") : i18nText("远程调试已关闭", "Remote debugging disabled"));
|
|
1203
1148
|
});
|
|
1204
1149
|
}
|
|
1205
1150
|
//#endregion
|
|
1206
|
-
export { readCustomConfig as $, isAutomatorProtocolTimeoutError as A, getConfiguredLocale as B, configureLocaleFromArgv as C, formatAutomatorLoginError as D, connectOpenedAutomator as E, launchAutomator as F, operatingSystemName as G, SupportedPlatformsMap as H, bootstrapWechatDevtoolsSettings as I, createAutoBootstrapDevtoolsConfig as J, colors as K, detectWechatDevtoolsServicePort as L, isDevtoolsExtensionContextInvalidatedError as M, isDevtoolsHttpPortError as N, getAutomatorProtocolTimeoutMethod as O, isRetryableAutomatorLaunchError as P, overwriteCustomConfig as Q, resolveCliPath as R, withMiniProgram as S, validateLocaleOption as T, getDefaultCliPath as U, resolveDevtoolsAutomationDefaults as V, isOperatingSystemSupported as W, createCustomConfig as X, createAutoTrustProjectConfig as Y, createLocaleConfig as Z, acquireSharedMiniProgram as _, navigateBack as a, getSharedMiniProgramSessionCount as b, pageStack as c, remote as d, removeCustomConfigKey as et, scrollTo as f, tap as g, takeScreenshot as h, input as i, isAutomatorWsConnectError as j, isAutomatorLoginError as k, reLaunch as l, systemInfo as m, captureScreenshotBuffer as n, defaultCustomConfigFilePath as nt, navigateTo as o, switchTab as p, logger_default as q, currentPage as r, resolvePath as rt, pageData as s, audit as t, defaultCustomConfigDirPath as tt, redirectTo as u, closeSharedMiniProgram as v, i18nText as w, releaseSharedMiniProgram as x, connectMiniProgram as y, getConfig as z };
|
|
1151
|
+
export { readCustomConfig as $, isAutomatorProtocolTimeoutError as A, getConfiguredLocale as B, configureLocaleFromArgv as C, formatAutomatorLoginError as D, connectOpenedAutomator as E, launchAutomator as F, operatingSystemName as G, SupportedPlatformsMap as H, bootstrapWechatDevtoolsSettings as I, createAutoBootstrapDevtoolsConfig as J, colors as K, detectWechatDevtoolsServicePort as L, isDevtoolsExtensionContextInvalidatedError as M, isDevtoolsHttpPortError as N, getAutomatorProtocolTimeoutMethod as O, isRetryableAutomatorLaunchError as P, overwriteCustomConfig as Q, resolveCliPath as R, withMiniProgram$1 as S, validateLocaleOption as T, getDefaultCliPath as U, resolveDevtoolsAutomationDefaults as V, isOperatingSystemSupported as W, createCustomConfig as X, createAutoTrustProjectConfig as Y, createLocaleConfig as Z, acquireSharedMiniProgram$1 as _, navigateBack as a, getSharedMiniProgramSessionCount as b, pageStack as c, remote as d, removeCustomConfigKey as et, scrollTo as f, tap as g, takeScreenshot as h, input as i, isAutomatorWsConnectError as j, isAutomatorLoginError as k, reLaunch as l, systemInfo as m, captureScreenshotBuffer as n, defaultCustomConfigFilePath as nt, navigateTo as o, switchTab as p, logger_default as q, currentPage as r, resolvePath as rt, pageData as s, audit as t, defaultCustomConfigDirPath as tt, redirectTo as u, closeSharedMiniProgram as v, i18nText as w, releaseSharedMiniProgram as x, connectMiniProgram as y, getConfig as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Buffer } from "node:buffer";
|
|
2
2
|
import * as _$_weapp_vite_miniprogram_automator0 from "@weapp-vite/miniprogram-automator";
|
|
3
|
-
import {
|
|
3
|
+
import { AutomatorElement, AutomatorMiniProgram, AutomatorPage, DevtoolsRuntimeSessionOptions, MiniProgramEventMap, closeSharedMiniProgram, getSharedMiniProgramSessionCount, releaseSharedMiniProgram } from "@weapp-vite/devtools-runtime";
|
|
4
4
|
import * as _$execa from "execa";
|
|
5
5
|
import * as _$cac from "cac";
|
|
6
6
|
|
|
@@ -78,22 +78,10 @@ declare function readBooleanOption(argv: readonly string[], ...optionNames: stri
|
|
|
78
78
|
declare function removeOption(argv: readonly string[], optionName: string): string[];
|
|
79
79
|
//#endregion
|
|
80
80
|
//#region src/cli/automator-session.d.ts
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
type MiniProgramLike = InstanceType<typeof MiniProgram>;
|
|
86
|
-
type MiniProgramPage = InstanceType<typeof Page>;
|
|
87
|
-
type MiniProgramElement = InstanceType<typeof Element> & {
|
|
88
|
-
input?: (value: string) => Promise<void>;
|
|
89
|
-
};
|
|
90
|
-
interface AutomatorSessionOptions {
|
|
91
|
-
miniProgram?: MiniProgramLike;
|
|
92
|
-
preferOpenedSession?: boolean;
|
|
93
|
-
projectPath: string;
|
|
94
|
-
sharedSession?: boolean;
|
|
95
|
-
timeout?: number;
|
|
96
|
-
}
|
|
81
|
+
type MiniProgramLike = AutomatorMiniProgram;
|
|
82
|
+
type MiniProgramPage = AutomatorPage;
|
|
83
|
+
type MiniProgramElement = AutomatorElement;
|
|
84
|
+
interface AutomatorSessionOptions extends DevtoolsRuntimeSessionOptions {}
|
|
97
85
|
/**
|
|
98
86
|
* @description 建立 automator 会话,并统一处理常见连接错误提示。
|
|
99
87
|
*/
|
|
@@ -102,18 +90,6 @@ declare function connectMiniProgram(options: AutomatorSessionOptions): Promise<M
|
|
|
102
90
|
* @description 获取指定项目的共享 automator 会话;若不存在则自动创建。
|
|
103
91
|
*/
|
|
104
92
|
declare function acquireSharedMiniProgram(options: AutomatorSessionOptions): Promise<MiniProgramLike>;
|
|
105
|
-
/**
|
|
106
|
-
* @description 释放指定项目的共享会话引用;会话对象会继续缓存,直到显式关闭或重置。
|
|
107
|
-
*/
|
|
108
|
-
declare function releaseSharedMiniProgram(projectPath: string): void;
|
|
109
|
-
/**
|
|
110
|
-
* @description 关闭并移除指定项目的共享 automator 会话。
|
|
111
|
-
*/
|
|
112
|
-
declare function closeSharedMiniProgram(projectPath: string): Promise<void>;
|
|
113
|
-
/**
|
|
114
|
-
* @description 获取当前共享会话数量,供测试断言使用。
|
|
115
|
-
*/
|
|
116
|
-
declare function getSharedMiniProgramSessionCount(): number;
|
|
117
93
|
/**
|
|
118
94
|
* @description 统一管理 automator 会话生命周期。
|
|
119
95
|
*/
|
|
@@ -917,4 +893,4 @@ declare function execute(cliPath: string, argv: string[], options?: ExecuteOptio
|
|
|
917
893
|
*/
|
|
918
894
|
declare function resolvePath(filePath: string): string;
|
|
919
895
|
//#endregion
|
|
920
|
-
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, ExclusiveKeypressOptions, ForwardConsoleEvent, ForwardConsoleLogLevel, ForwardConsoleOptions, ForwardConsoleSession, InputOptions, LoginWechatIdeOptions, MINIDEV_NAMESPACE_COMMAND_NAMES, MiniProgramElement, 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, type ScreenshotOptions, type ScreenshotResult, ScrollOptions, SelectorOptions, SetWechatIdeTicketOptions, SharedInputSession, SharedInputSessionOptions, StartWechatIdeEngineBuildResult, SupportedPlatform, SupportedPlatformsMap, TapOptions, UploadWechatIdeOptions, WEAPP_IDE_TOP_LEVEL_COMMAND_NAMES, WECHAT_CLI_COMMAND_NAMES, WECHAT_DEVTOOLS_ENGINE_BUILD_STATUSES, 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, 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, readOptionValue, redirectTo, refreshWechatIdeTicket, releaseSharedMiniProgram, remote, removeCustomConfigKey, removeOption, requestWechatDevtoolsHttp, resetWechatIdeFileUtils, resetWechatIdeFileUtilsByHttp, resolveCliPath, resolveDevtoolsAutomationDefaults, resolvePath, runAutomatorCommand, runMinidev, runRetryableCommand, runWechatCliWithRetry, runWechatIdeEngineBuild, runWechatIdeEngineBuildByHttp, runWithSuspendedSharedInput, scrollTo, setWechatIdeTicket, startForwardConsole, startWechatIdeEngineBuildByHttp, switchTab, systemInfo, takeScreenshot, tap, transformArgv, uploadWechatIde, validateWechatCliCommandArgs, waitForExclusiveKeypress, waitForRetryKeypress, withMiniProgram };
|
|
896
|
+
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, ExclusiveKeypressOptions, ForwardConsoleEvent, ForwardConsoleLogLevel, ForwardConsoleOptions, ForwardConsoleSession, InputOptions, LoginWechatIdeOptions, MINIDEV_NAMESPACE_COMMAND_NAMES, 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, type ScreenshotOptions, type ScreenshotResult, ScrollOptions, SelectorOptions, SetWechatIdeTicketOptions, SharedInputSession, SharedInputSessionOptions, StartWechatIdeEngineBuildResult, SupportedPlatform, SupportedPlatformsMap, TapOptions, UploadWechatIdeOptions, WEAPP_IDE_TOP_LEVEL_COMMAND_NAMES, WECHAT_CLI_COMMAND_NAMES, WECHAT_DEVTOOLS_ENGINE_BUILD_STATUSES, 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, 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, readOptionValue, redirectTo, refreshWechatIdeTicket, releaseSharedMiniProgram, remote, removeCustomConfigKey, removeOption, requestWechatDevtoolsHttp, resetWechatIdeFileUtils, resetWechatIdeFileUtilsByHttp, resolveCliPath, resolveDevtoolsAutomationDefaults, resolvePath, runAutomatorCommand, runMinidev, runRetryableCommand, runWechatCliWithRetry, runWechatIdeEngineBuild, runWechatIdeEngineBuildByHttp, runWithSuspendedSharedInput, scrollTo, setWechatIdeTicket, startForwardConsole, startWechatIdeEngineBuildByHttp, switchTab, systemInfo, takeScreenshot, tap, transformArgv, uploadWechatIde, validateWechatCliCommandArgs, waitForExclusiveKeypress, waitForRetryKeypress, withMiniProgram };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as readCustomConfig, A as isAutomatorProtocolTimeoutError, B as getConfiguredLocale, D as formatAutomatorLoginError, E as connectOpenedAutomator, F as launchAutomator, G as operatingSystemName, H as SupportedPlatformsMap, I as bootstrapWechatDevtoolsSettings, J as createAutoBootstrapDevtoolsConfig, L as detectWechatDevtoolsServicePort, M as isDevtoolsExtensionContextInvalidatedError, N as isDevtoolsHttpPortError, O as getAutomatorProtocolTimeoutMethod, P as isRetryableAutomatorLaunchError, Q as overwriteCustomConfig, R as resolveCliPath, S as withMiniProgram, U as getDefaultCliPath, V as resolveDevtoolsAutomationDefaults, W as isOperatingSystemSupported, X as createCustomConfig, Y as createAutoTrustProjectConfig, Z as createLocaleConfig, _ as acquireSharedMiniProgram, a as navigateBack, b as getSharedMiniProgramSessionCount, c as pageStack, d as remote, et as removeCustomConfigKey, f as scrollTo, g as tap, h as takeScreenshot, i as input, j as isAutomatorWsConnectError, k as isAutomatorLoginError, l as reLaunch, m as systemInfo, n as captureScreenshotBuffer, nt as defaultCustomConfigFilePath, o as navigateTo, p as switchTab, r as currentPage, rt as resolvePath, s as pageData, t as audit, tt as defaultCustomConfigDirPath, u as redirectTo, v as closeSharedMiniProgram, x as releaseSharedMiniProgram, y as connectMiniProgram, z as getConfig } from "./commands-
|
|
2
|
-
import { $ as resetWechatIdeFileUtilsByHttp, A as RETRY_CANCEL_KEYS, B as waitForRetryKeypress, C as refreshWechatIdeTicket, D as validateWechatCliCommandArgs, E as uploadWechatIde, F as formatRetryHotkeyPrompt, G as transformArgv, H as execute, I as formatWechatIdeLoginRequiredError, J as runWechatIdeEngineBuildByHttp, K as startForwardConsole, L as isWechatIdeLoginRequiredError, M as RETRY_PROMPT_INITIAL_IGNORE_MS, N as createWechatIdeLoginRequiredExitError, O as runWechatCliWithRetry, P as extractExecutionErrorText, Q as requestWechatDevtoolsHttp, R as promptRetryKeypress, S as quitWechatIde, St as removeOption, T as setWechatIdeTicket, U as createAlias, V as runMinidev, W as createPathCompat, X as openWechatIdeProjectByHttp, Y as WECHAT_DEVTOOLS_ENGINE_BUILD_STATUSES, Z as pollWechatIdeEngineBuildResultByHttp, _ as isWechatIdeLoggedIn, _t as parseCompareArgs, a as autoReplayWechatIde, at as waitForExclusiveKeypress, b as openWechatIdeOtherProject, bt as readBooleanOption, c as buildWechatIdeIpa, ct as WEAPP_IDE_TOP_LEVEL_COMMAND_NAMES, d as clearWechatIdeCacheByAutomator, dt as AUTOMATOR_COMMAND_NAMES, et as startWechatIdeEngineBuildByHttp, f as closeWechatIdeProject, ft as getAutomatorCommandHelp, g as getWechatIdeToolInfo, gt as printScreenshotHelp, h as getWechatIdeTicket, ht as parseScreenshotArgs, i as autoPreviewWechatIde, it as runWithSuspendedSharedInput, j as RETRY_CONFIRM_KEYS, k as runRetryableCommand, l as buildWechatIdeNpm, lt as WECHAT_CLI_COMMAND_NAMES, m as getWechatIdeTestAccounts, mt as runAutomatorCommand, n as parse, nt as promptForCliPath, o as autoWechatIde, ot as CONFIG_COMMAND_NAME, p as compileWechatIdeByAutomator, pt as isAutomatorCommand, q as runWechatIdeEngineBuild, r as dispatchWechatCliCommand, rt as createSharedInputSession, s as buildWechatIdeApk, st as MINIDEV_NAMESPACE_COMMAND_NAMES, t as createCli, tt as handleConfigCommand, u as clearWechatIdeCache, ut as isWeappIdeTopLevelCommand, v as loginWechatIde, vt as printCompareHelp, w as resetWechatIdeFileUtils, x as previewWechatIde, xt as readOptionValue, y as openWechatIde, yt as parseAutomatorArgs, z as promptWechatIdeLoginRetry } from "./cli-
|
|
1
|
+
import { $ as readCustomConfig, A as isAutomatorProtocolTimeoutError, B as getConfiguredLocale, D as formatAutomatorLoginError, E as connectOpenedAutomator, F as launchAutomator, G as operatingSystemName, H as SupportedPlatformsMap, I as bootstrapWechatDevtoolsSettings, J as createAutoBootstrapDevtoolsConfig, L as detectWechatDevtoolsServicePort, M as isDevtoolsExtensionContextInvalidatedError, N as isDevtoolsHttpPortError, O as getAutomatorProtocolTimeoutMethod, P as isRetryableAutomatorLaunchError, Q as overwriteCustomConfig, R as resolveCliPath, S as withMiniProgram, U as getDefaultCliPath, V as resolveDevtoolsAutomationDefaults, W as isOperatingSystemSupported, X as createCustomConfig, Y as createAutoTrustProjectConfig, Z as createLocaleConfig, _ as acquireSharedMiniProgram, a as navigateBack, b as getSharedMiniProgramSessionCount, c as pageStack, d as remote, et as removeCustomConfigKey, f as scrollTo, g as tap, h as takeScreenshot, i as input, j as isAutomatorWsConnectError, k as isAutomatorLoginError, l as reLaunch, m as systemInfo, n as captureScreenshotBuffer, nt as defaultCustomConfigFilePath, o as navigateTo, p as switchTab, r as currentPage, rt as resolvePath, s as pageData, t as audit, tt as defaultCustomConfigDirPath, u as redirectTo, v as closeSharedMiniProgram, x as releaseSharedMiniProgram, y as connectMiniProgram, z as getConfig } from "./commands-CcaDGUMU.js";
|
|
2
|
+
import { $ as resetWechatIdeFileUtilsByHttp, A as RETRY_CANCEL_KEYS, B as waitForRetryKeypress, C as refreshWechatIdeTicket, D as validateWechatCliCommandArgs, E as uploadWechatIde, F as formatRetryHotkeyPrompt, G as transformArgv, H as execute, I as formatWechatIdeLoginRequiredError, J as runWechatIdeEngineBuildByHttp, K as startForwardConsole, L as isWechatIdeLoginRequiredError, M as RETRY_PROMPT_INITIAL_IGNORE_MS, N as createWechatIdeLoginRequiredExitError, O as runWechatCliWithRetry, P as extractExecutionErrorText, Q as requestWechatDevtoolsHttp, R as promptRetryKeypress, S as quitWechatIde, St as removeOption, T as setWechatIdeTicket, U as createAlias, V as runMinidev, W as createPathCompat, X as openWechatIdeProjectByHttp, Y as WECHAT_DEVTOOLS_ENGINE_BUILD_STATUSES, Z as pollWechatIdeEngineBuildResultByHttp, _ as isWechatIdeLoggedIn, _t as parseCompareArgs, a as autoReplayWechatIde, at as waitForExclusiveKeypress, b as openWechatIdeOtherProject, bt as readBooleanOption, c as buildWechatIdeIpa, ct as WEAPP_IDE_TOP_LEVEL_COMMAND_NAMES, d as clearWechatIdeCacheByAutomator, dt as AUTOMATOR_COMMAND_NAMES, et as startWechatIdeEngineBuildByHttp, f as closeWechatIdeProject, ft as getAutomatorCommandHelp, g as getWechatIdeToolInfo, gt as printScreenshotHelp, h as getWechatIdeTicket, ht as parseScreenshotArgs, i as autoPreviewWechatIde, it as runWithSuspendedSharedInput, j as RETRY_CONFIRM_KEYS, k as runRetryableCommand, l as buildWechatIdeNpm, lt as WECHAT_CLI_COMMAND_NAMES, m as getWechatIdeTestAccounts, mt as runAutomatorCommand, n as parse, nt as promptForCliPath, o as autoWechatIde, ot as CONFIG_COMMAND_NAME, p as compileWechatIdeByAutomator, pt as isAutomatorCommand, q as runWechatIdeEngineBuild, r as dispatchWechatCliCommand, rt as createSharedInputSession, s as buildWechatIdeApk, st as MINIDEV_NAMESPACE_COMMAND_NAMES, t as createCli, tt as handleConfigCommand, u as clearWechatIdeCache, ut as isWeappIdeTopLevelCommand, v as loginWechatIde, vt as printCompareHelp, w as resetWechatIdeFileUtils, x as previewWechatIde, xt as readOptionValue, y as openWechatIde, yt as parseAutomatorArgs, z as promptWechatIdeLoginRetry } from "./cli-CYRxSZ0F.js";
|
|
3
3
|
export { AUTOMATOR_COMMAND_NAMES, CONFIG_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, 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, readOptionValue, redirectTo, refreshWechatIdeTicket, releaseSharedMiniProgram, remote, removeCustomConfigKey, removeOption, requestWechatDevtoolsHttp, resetWechatIdeFileUtils, resetWechatIdeFileUtilsByHttp, resolveCliPath, resolveDevtoolsAutomationDefaults, resolvePath, runAutomatorCommand, runMinidev, runRetryableCommand, runWechatCliWithRetry, runWechatIdeEngineBuild, runWechatIdeEngineBuildByHttp, runWithSuspendedSharedInput, scrollTo, setWechatIdeTicket, startForwardConsole, startWechatIdeEngineBuildByHttp, switchTab, systemInfo, takeScreenshot, tap, transformArgv, uploadWechatIde, validateWechatCliCommandArgs, waitForExclusiveKeypress, waitForRetryKeypress, withMiniProgram };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-ide-cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.2.
|
|
4
|
+
"version": "5.2.8",
|
|
5
5
|
"description": "让微信开发者工具,用起来更加方便!",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -65,11 +65,12 @@
|
|
|
65
65
|
"cac": "^7.0.0",
|
|
66
66
|
"execa": "9.6.1",
|
|
67
67
|
"pathe": "^2.0.3",
|
|
68
|
-
"pixelmatch": "^7.
|
|
68
|
+
"pixelmatch": "^7.2.0",
|
|
69
69
|
"pngjs": "^7.0.0",
|
|
70
70
|
"@weapp-core/logger": "^3.1.1",
|
|
71
71
|
"@weapp-core/shared": "^3.0.4",
|
|
72
|
-
"@weapp-vite/
|
|
72
|
+
"@weapp-vite/devtools-runtime": "0.2.1",
|
|
73
|
+
"@weapp-vite/miniprogram-automator": "1.0.5"
|
|
73
74
|
},
|
|
74
75
|
"scripts": {
|
|
75
76
|
"dev": "tsdown -w --sourcemap",
|