@weapp-vite/miniprogram-automator 1.1.0 → 1.1.1
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/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import process from "node:process";
|
|
|
4
4
|
import { spawn } from "node:child_process";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { EventEmitter } from "node:events";
|
|
7
|
-
import
|
|
7
|
+
import { createDebug } from "obug";
|
|
8
8
|
import WebSocket from "ws";
|
|
9
9
|
import fs from "node:fs/promises";
|
|
10
10
|
import { decodeQrCodeFromBase64, renderTerminalQrCode } from "@weapp-vite/qr";
|
|
@@ -224,6 +224,8 @@ function toStr(value) {
|
|
|
224
224
|
//#region src/Element.ts
|
|
225
225
|
/** Element 的实现。 */
|
|
226
226
|
var Element = class Element {
|
|
227
|
+
connection;
|
|
228
|
+
elementMap;
|
|
227
229
|
tagName = "";
|
|
228
230
|
nodeId;
|
|
229
231
|
videoId;
|
|
@@ -474,6 +476,7 @@ var ContextElement = class extends Element {
|
|
|
474
476
|
//#region src/Transport.ts
|
|
475
477
|
/** Transport 的实现。 */
|
|
476
478
|
var Transport = class extends EventEmitter {
|
|
479
|
+
ws;
|
|
477
480
|
constructor(ws) {
|
|
478
481
|
super();
|
|
479
482
|
this.ws = ws;
|
|
@@ -496,11 +499,12 @@ var Transport = class extends EventEmitter {
|
|
|
496
499
|
/**
|
|
497
500
|
* @file 自动化协议连接实现。
|
|
498
501
|
*/
|
|
499
|
-
const debugProtocol =
|
|
502
|
+
const debugProtocol = createDebug("automator:protocol");
|
|
500
503
|
const closeErrTip = "Connection closed, check if wechat web devTools is still running";
|
|
501
504
|
const REQUEST_TIMEOUT = 3e4;
|
|
502
505
|
/** Connection 的实现。 */
|
|
503
506
|
var Connection = class Connection extends EventEmitter {
|
|
507
|
+
transport;
|
|
504
508
|
callbacks = /* @__PURE__ */ new Map();
|
|
505
509
|
constructor(transport) {
|
|
506
510
|
super();
|
|
@@ -578,15 +582,16 @@ var Connection = class Connection extends EventEmitter {
|
|
|
578
582
|
//#endregion
|
|
579
583
|
//#region src/headless.ts
|
|
580
584
|
async function launchHeadlessAutomator(options) {
|
|
581
|
-
return await (await import("./launch-
|
|
585
|
+
return await (await import("./launch-CDd9gHVW.mjs")).launch({ projectPath: options.projectPath });
|
|
582
586
|
}
|
|
583
587
|
//#endregion
|
|
584
588
|
//#region package.json
|
|
585
|
-
var version = "1.1.
|
|
589
|
+
var version = "1.1.1";
|
|
586
590
|
//#endregion
|
|
587
591
|
//#region src/Native.ts
|
|
588
592
|
/** Native 的实现。 */
|
|
589
593
|
var Native = class extends EventEmitter {
|
|
594
|
+
connection;
|
|
590
595
|
constructor(connection) {
|
|
591
596
|
super();
|
|
592
597
|
this.connection = connection;
|
|
@@ -635,6 +640,7 @@ var Native = class extends EventEmitter {
|
|
|
635
640
|
//#region src/Page.ts
|
|
636
641
|
/** Page 的实现。 */
|
|
637
642
|
var Page = class Page {
|
|
643
|
+
connection;
|
|
638
644
|
path = "";
|
|
639
645
|
query = {};
|
|
640
646
|
id;
|
|
@@ -810,6 +816,7 @@ function logChangeRouteDebug(message) {
|
|
|
810
816
|
}
|
|
811
817
|
/** MiniProgram 的实现。 */
|
|
812
818
|
var MiniProgram = class extends EventEmitter {
|
|
819
|
+
connection;
|
|
813
820
|
appBindings = /* @__PURE__ */ new Map();
|
|
814
821
|
pageMap = /* @__PURE__ */ new Map();
|
|
815
822
|
nativeIns;
|
|
@@ -1127,6 +1134,9 @@ function isInputCapableElement(element) {
|
|
|
1127
1134
|
return typeof Reflect.get(element, "input") === "function";
|
|
1128
1135
|
}
|
|
1129
1136
|
var SmartappElement = class {
|
|
1137
|
+
element;
|
|
1138
|
+
selectors;
|
|
1139
|
+
index;
|
|
1130
1140
|
id;
|
|
1131
1141
|
tagName;
|
|
1132
1142
|
constructor(element, selectors = "", index = 0) {
|
|
@@ -1184,6 +1194,7 @@ var SmartappElement = class {
|
|
|
1184
1194
|
//#endregion
|
|
1185
1195
|
//#region src/smartapp/Page.ts
|
|
1186
1196
|
var SmartappPage = class {
|
|
1197
|
+
page;
|
|
1187
1198
|
path;
|
|
1188
1199
|
query;
|
|
1189
1200
|
uri;
|
|
@@ -1207,6 +1218,8 @@ var SmartappPage = class {
|
|
|
1207
1218
|
//#endregion
|
|
1208
1219
|
//#region src/smartapp/App.ts
|
|
1209
1220
|
var SmartappApp = class {
|
|
1221
|
+
miniProgram;
|
|
1222
|
+
appKey;
|
|
1210
1223
|
constructor(miniProgram, appKey) {
|
|
1211
1224
|
this.miniProgram = miniProgram;
|
|
1212
1225
|
this.appKey = appKey;
|
|
@@ -1268,6 +1281,10 @@ var SmartappApp = class {
|
|
|
1268
1281
|
//#endregion
|
|
1269
1282
|
//#region src/smartapp/Device.ts
|
|
1270
1283
|
var SmartappDevice = class {
|
|
1284
|
+
type;
|
|
1285
|
+
connectType;
|
|
1286
|
+
id;
|
|
1287
|
+
driver;
|
|
1271
1288
|
constructor(type, connectType, id, driver = {}) {
|
|
1272
1289
|
this.type = type;
|
|
1273
1290
|
this.connectType = connectType;
|
|
@@ -1479,6 +1496,7 @@ function toSmartappLaunchOptions(options) {
|
|
|
1479
1496
|
};
|
|
1480
1497
|
}
|
|
1481
1498
|
var SwanLauncher = class {
|
|
1499
|
+
automator;
|
|
1482
1500
|
constructor(automator = SmartappAutomator$1) {
|
|
1483
1501
|
this.automator = automator;
|
|
1484
1502
|
}
|
|
@@ -4047,6 +4047,8 @@ function resolveComponentScopeId(scopeId) {
|
|
|
4047
4047
|
return scopeId;
|
|
4048
4048
|
}
|
|
4049
4049
|
var HeadlessTestingNodeHandle = class HeadlessTestingNodeHandle {
|
|
4050
|
+
node;
|
|
4051
|
+
interactions;
|
|
4050
4052
|
constructor(node, interactions) {
|
|
4051
4053
|
this.node = node;
|
|
4052
4054
|
this.interactions = interactions;
|
|
@@ -7720,6 +7722,9 @@ function createHeadlessSession(options) {
|
|
|
7720
7722
|
const DEFAULT_WAIT_TIMEOUT$1 = 1e3;
|
|
7721
7723
|
const DEFAULT_WAIT_INTERVAL$1 = 10;
|
|
7722
7724
|
var HeadlessTestingPageHandle = class {
|
|
7725
|
+
project;
|
|
7726
|
+
page;
|
|
7727
|
+
session;
|
|
7723
7728
|
constructor(project, page, session) {
|
|
7724
7729
|
this.project = project;
|
|
7725
7730
|
this.page = page;
|
|
@@ -7886,6 +7891,9 @@ async function pollUntil(check, errorMessage, options = {}) {
|
|
|
7886
7891
|
//#endregion
|
|
7887
7892
|
//#region ../../mpcore/packages/simulator/src/testing/sessionHandle/scope.ts
|
|
7888
7893
|
var HeadlessTestingScopeHandle = class HeadlessTestingScopeHandle {
|
|
7894
|
+
scopeId;
|
|
7895
|
+
project;
|
|
7896
|
+
session;
|
|
7889
7897
|
constructor(scopeId, project, session) {
|
|
7890
7898
|
this.scopeId = scopeId;
|
|
7891
7899
|
this.project = project;
|
|
@@ -7940,6 +7948,8 @@ var HeadlessTestingScopeHandle = class HeadlessTestingScopeHandle {
|
|
|
7940
7948
|
//#endregion
|
|
7941
7949
|
//#region ../../mpcore/packages/simulator/src/testing/sessionHandle/index.ts
|
|
7942
7950
|
var HeadlessTestingSessionHandle = class {
|
|
7951
|
+
project;
|
|
7952
|
+
session;
|
|
7943
7953
|
constructor(project, session) {
|
|
7944
7954
|
this.project = project;
|
|
7945
7955
|
this.session = session;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weapp-vite/miniprogram-automator",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.1",
|
|
5
5
|
"description": "完全兼容微信 miniprogram-automator 的现代化替代实现",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"node": "^20.19.0 || >=22.12.0"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"
|
|
45
|
-
"ws": "^8.
|
|
44
|
+
"obug": "^2.1.1",
|
|
45
|
+
"ws": "^8.20.1",
|
|
46
46
|
"@weapp-vite/qr": "1.1.0"
|
|
47
47
|
},
|
|
48
48
|
"publishConfig": {
|