@weapp-vite/miniprogram-automator 1.1.1 → 1.1.2
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
|
@@ -582,11 +582,11 @@ var Connection = class Connection extends EventEmitter {
|
|
|
582
582
|
//#endregion
|
|
583
583
|
//#region src/headless.ts
|
|
584
584
|
async function launchHeadlessAutomator(options) {
|
|
585
|
-
return await (await import("./launch-
|
|
585
|
+
return await (await import("./launch-F4arniwI.mjs")).launch({ projectPath: options.projectPath });
|
|
586
586
|
}
|
|
587
587
|
//#endregion
|
|
588
588
|
//#region package.json
|
|
589
|
-
var version = "1.1.
|
|
589
|
+
var version = "1.1.2";
|
|
590
590
|
//#endregion
|
|
591
591
|
//#region src/Native.ts
|
|
592
592
|
/** Native 的实现。 */
|
|
@@ -807,6 +807,9 @@ function isFnStr(value) {
|
|
|
807
807
|
function isCurrentPageProtocolTimeout(error) {
|
|
808
808
|
return error instanceof Error && "code" in error && error.code === "DEVTOOLS_PROTOCOL_TIMEOUT" && "method" in error && error.method === "App.getCurrentPage";
|
|
809
809
|
}
|
|
810
|
+
function isPageStackProtocolTimeout(error) {
|
|
811
|
+
return error instanceof Error && "code" in error && error.code === "DEVTOOLS_PROTOCOL_TIMEOUT" && "method" in error && error.method === "App.getPageStack";
|
|
812
|
+
}
|
|
810
813
|
function normalizeRoutePath(value) {
|
|
811
814
|
return String(value ?? "").split("?", 1)[0].replace(/^\/+/, "").replace(/\/+$/, "");
|
|
812
815
|
}
|
|
@@ -863,8 +866,22 @@ var MiniProgram = class extends EventEmitter {
|
|
|
863
866
|
}, this.pageMap);
|
|
864
867
|
} catch (error) {
|
|
865
868
|
lastError = error;
|
|
866
|
-
if (!isCurrentPageProtocolTimeout(error)
|
|
867
|
-
|
|
869
|
+
if (!isCurrentPageProtocolTimeout(error)) throw error;
|
|
870
|
+
if (attempt < CURRENT_PAGE_RETRIES) {
|
|
871
|
+
await sleep(CURRENT_PAGE_RETRY_DELAY);
|
|
872
|
+
continue;
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
if (isCurrentPageProtocolTimeout(lastError)) try {
|
|
876
|
+
const { pageStack } = await this.send("App.getPageStack");
|
|
877
|
+
const page = pageStack[pageStack.length - 1];
|
|
878
|
+
if (page) return Page.create(this.connection, {
|
|
879
|
+
id: page.pageId,
|
|
880
|
+
path: page.path,
|
|
881
|
+
query: page.query
|
|
882
|
+
}, this.pageMap);
|
|
883
|
+
} catch (error) {
|
|
884
|
+
if (!isPageStackProtocolTimeout(error)) throw error;
|
|
868
885
|
}
|
|
869
886
|
throw lastError;
|
|
870
887
|
}
|
|
@@ -1025,7 +1042,21 @@ var MiniProgram = class extends EventEmitter {
|
|
|
1025
1042
|
return this.nativeIns;
|
|
1026
1043
|
}
|
|
1027
1044
|
async changeRoute(method, url) {
|
|
1028
|
-
const currentPage = await this.currentPage()
|
|
1045
|
+
const currentPage = await this.currentPage().catch(async (error) => {
|
|
1046
|
+
if (!isCurrentPageProtocolTimeout(error)) throw error;
|
|
1047
|
+
try {
|
|
1048
|
+
const { pageStack } = await this.send("App.getPageStack");
|
|
1049
|
+
const page = pageStack[pageStack.length - 1];
|
|
1050
|
+
return page ? Page.create(this.connection, {
|
|
1051
|
+
id: page.pageId,
|
|
1052
|
+
path: page.path,
|
|
1053
|
+
query: page.query
|
|
1054
|
+
}, this.pageMap) : void 0;
|
|
1055
|
+
} catch (pageStackError) {
|
|
1056
|
+
if (!isPageStackProtocolTimeout(pageStackError)) throw pageStackError;
|
|
1057
|
+
return;
|
|
1058
|
+
}
|
|
1059
|
+
});
|
|
1029
1060
|
logChangeRouteDebug(`start method=${method} url=${url ?? "<none>"} current=${currentPage?.path ?? "<none>"}`);
|
|
1030
1061
|
if (currentPage && isPluginPath(currentPage.path)) {
|
|
1031
1062
|
const pluginId = extractPluginId(currentPage.path);
|
|
@@ -5241,11 +5241,10 @@ function deriveMenuButtonBoundingClientRect(systemInfo) {
|
|
|
5241
5241
|
const height = 32;
|
|
5242
5242
|
const top = 32;
|
|
5243
5243
|
const right = Math.max(systemInfo.windowWidth - 12, width);
|
|
5244
|
-
const left = Math.max(0, right - width);
|
|
5245
5244
|
return {
|
|
5246
|
-
bottom:
|
|
5245
|
+
bottom: 64,
|
|
5247
5246
|
height,
|
|
5248
|
-
left,
|
|
5247
|
+
left: Math.max(0, right - width),
|
|
5249
5248
|
right,
|
|
5250
5249
|
top,
|
|
5251
5250
|
width
|
package/package.json
CHANGED