@dimina-kit/devtools 0.4.0-dev.20260907055341 → 0.5.0-dev.20260908120530
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/README.md +1 -1
- package/dist/main/app/window-runtime-services.d.ts +12 -12
- package/dist/main/app/window-runtime-services.js +34 -15
- package/dist/main/index.bundle.js +6307 -6050
- package/dist/main/services/elements-forward/index.d.ts +2 -2
- package/dist/main/services/elements-forward/index.js +6 -6
- package/dist/main/services/network-forward/body-cache.d.ts +2 -0
- package/dist/main/services/network-forward/body-cache.js +4 -0
- package/dist/main/services/network-forward/global-body-gate.d.ts +1 -1
- package/dist/main/services/network-forward/global-body-gate.js +4 -4
- package/dist/main/services/network-forward/http.d.ts +47 -0
- package/dist/main/services/network-forward/http.js +162 -0
- package/dist/main/services/network-forward/index.d.ts +19 -13
- package/dist/main/services/network-forward/index.js +220 -134
- package/dist/main/services/network-forward/request-ids.d.ts +5 -0
- package/dist/main/services/network-forward/request-ids.js +5 -0
- package/dist/main/services/safe-area/index.d.ts +7 -9
- package/dist/main/services/safe-area/index.js +7 -14
- package/dist/main/services/views/native-simulator-view.js +7 -8
- package/dist/main/services/workbench-context.d.ts +3 -3
- package/dist/main/services/workbench-context.js +7 -1
- package/dist/native-host/render/render.js +525 -482
- package/dist/native-host/service/service.js +2 -2
- package/dist/preload/shared/api-compat.js +63 -41
- package/dist/preload/windows/main.cjs +15 -1
- package/dist/preload/windows/main.cjs.map +2 -2
- package/dist/preload/windows/simulator.cjs +55 -134
- package/dist/preload/windows/simulator.cjs.map +4 -4
- package/dist/preload/windows/simulator.js +55 -134
- package/dist/renderer/assets/workbench-C0Jkdlps.js +5 -0
- package/dist/renderer/entries/workbench/index.html +1 -1
- package/dist/shared/types.d.ts +2 -0
- package/dist/simulator/assets/device-shell-DucLepkm.js +431 -0
- package/dist/simulator/assets/simulator-B4rbcOVt.js +10 -0
- package/dist/simulator/assets/simulator-ui-i3GCc7YJ.js +2 -0
- package/dist/simulator/simulator.html +2 -2
- package/package.json +12 -12
- package/dist/renderer/assets/workbench-BLJ0wKsg.js +0 -5
- package/dist/shared/request-core.d.ts +0 -2
- package/dist/shared/request-core.js +0 -2
- package/dist/simulator/assets/device-shell-pxnZZp10.js +0 -431
- package/dist/simulator/assets/simulator-Dwp7lnvu.js +0 -10
- package/dist/simulator/assets/simulator-ui-B2ddJB1R.js +0 -2
|
@@ -399,7 +399,21 @@ var BRIDGE_CHANNELS = {
|
|
|
399
399
|
* active bridgeId via ACTIVE_PAGE), so automation's `App.getPageStack` needs
|
|
400
400
|
* this to report multi-page stacks. Fire-and-forget.
|
|
401
401
|
*/
|
|
402
|
-
PAGE_STACK: "dmb:page-stack"
|
|
402
|
+
PAGE_STACK: "dmb:page-stack",
|
|
403
|
+
/**
|
|
404
|
+
* preload (window.wx.request, no service-host in the picture) → main
|
|
405
|
+
* (invoke): run an HTTP request through the main-process native transport
|
|
406
|
+
* (`main/services/native-request`) instead of the renderer's `fetch()`, so
|
|
407
|
+
* it never hits Chromium's Fetch/CORS algorithm (no spurious OPTIONS
|
|
408
|
+
* preflight). Reply is a `NativeRequestResult` (success or fail shape).
|
|
409
|
+
*/
|
|
410
|
+
NATIVE_REQUEST: "dmb:native-request",
|
|
411
|
+
/**
|
|
412
|
+
* preload → main: cancel the in-flight native request named by the
|
|
413
|
+
* requestId a prior NATIVE_REQUEST call was invoked with. Fire-and-forget;
|
|
414
|
+
* a requestId that already settled or belongs to another sender is a no-op.
|
|
415
|
+
*/
|
|
416
|
+
NATIVE_REQUEST_ABORT: "dmb:native-request-abort"
|
|
403
417
|
};
|
|
404
418
|
var SimulatorCustomApiBridgeChannel = {
|
|
405
419
|
Request: "simulator:custom-apis:bridge-request",
|
|
@@ -751,115 +765,8 @@ function createAppDataSource() {
|
|
|
751
765
|
};
|
|
752
766
|
}
|
|
753
767
|
|
|
754
|
-
// ../dimina-electron-runtime/dist/shared/request-core.js
|
|
755
|
-
var DEFAULT_REQUEST_TIMEOUT_MS = 6e4;
|
|
756
|
-
var MAX_TIMEOUT_MS = 2147483647;
|
|
757
|
-
function resolveTimeoutBudgetMs(timeout) {
|
|
758
|
-
const t = Number(timeout);
|
|
759
|
-
return Number.isFinite(t) && t > 0 && t <= MAX_TIMEOUT_MS ? t : DEFAULT_REQUEST_TIMEOUT_MS;
|
|
760
|
-
}
|
|
761
|
-
function buildHeaders(header) {
|
|
762
|
-
const headers = new Headers();
|
|
763
|
-
for (const [key, value] of Object.entries(header ?? {})) {
|
|
764
|
-
if (value != null)
|
|
765
|
-
headers.set(key, String(value));
|
|
766
|
-
}
|
|
767
|
-
if (!headers.has("content-type"))
|
|
768
|
-
headers.set("content-type", "application/json");
|
|
769
|
-
return headers;
|
|
770
|
-
}
|
|
771
|
-
function appendQueryParams(url, data) {
|
|
772
|
-
const base = typeof location !== "undefined" ? location.href : void 0;
|
|
773
|
-
const resolved = new URL(url, base);
|
|
774
|
-
for (const [key, value] of Object.entries(data)) {
|
|
775
|
-
resolved.searchParams.append(key, String(value));
|
|
776
|
-
}
|
|
777
|
-
return resolved.toString();
|
|
778
|
-
}
|
|
779
|
-
function encodeBody(data, contentType) {
|
|
780
|
-
if (typeof data === "string")
|
|
781
|
-
return data;
|
|
782
|
-
if (contentType.includes("application/x-www-form-urlencoded")) {
|
|
783
|
-
const form = new URLSearchParams();
|
|
784
|
-
for (const [key, value] of Object.entries(data)) {
|
|
785
|
-
form.append(key, String(value));
|
|
786
|
-
}
|
|
787
|
-
return form.toString();
|
|
788
|
-
}
|
|
789
|
-
return JSON.stringify(data);
|
|
790
|
-
}
|
|
791
|
-
async function decodeResponseData(response, dataType, responseType) {
|
|
792
|
-
if (responseType === "arraybuffer" || dataType === "arraybuffer") {
|
|
793
|
-
return response.arrayBuffer();
|
|
794
|
-
}
|
|
795
|
-
const text = await response.text();
|
|
796
|
-
if (dataType !== "json")
|
|
797
|
-
return text;
|
|
798
|
-
try {
|
|
799
|
-
return JSON.parse(text);
|
|
800
|
-
} catch {
|
|
801
|
-
return text;
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
function performRequest(opts, callbacks) {
|
|
805
|
-
const method = (opts.method || "GET").toUpperCase();
|
|
806
|
-
const canHaveBody = method !== "GET" && method !== "HEAD";
|
|
807
|
-
const headers = buildHeaders(opts.header);
|
|
808
|
-
let url = opts.url;
|
|
809
|
-
const init = { method, headers };
|
|
810
|
-
if (!canHaveBody) {
|
|
811
|
-
if (opts.data && typeof opts.data === "object") {
|
|
812
|
-
url = appendQueryParams(url, opts.data);
|
|
813
|
-
}
|
|
814
|
-
} else if (opts.data != null) {
|
|
815
|
-
init.body = encodeBody(opts.data, headers.get("content-type") ?? "");
|
|
816
|
-
}
|
|
817
|
-
const controller = new AbortController();
|
|
818
|
-
init.signal = controller.signal;
|
|
819
|
-
let settled = false;
|
|
820
|
-
function settleSuccess(res) {
|
|
821
|
-
if (settled)
|
|
822
|
-
return;
|
|
823
|
-
settled = true;
|
|
824
|
-
clearTimeout(timer);
|
|
825
|
-
callbacks.success?.(res);
|
|
826
|
-
callbacks.complete?.(res);
|
|
827
|
-
}
|
|
828
|
-
function settleFail(err) {
|
|
829
|
-
if (settled)
|
|
830
|
-
return;
|
|
831
|
-
settled = true;
|
|
832
|
-
clearTimeout(timer);
|
|
833
|
-
callbacks.fail?.(err);
|
|
834
|
-
callbacks.complete?.(err);
|
|
835
|
-
}
|
|
836
|
-
const timeoutMs = resolveTimeoutBudgetMs(opts.timeout);
|
|
837
|
-
const timer = setTimeout(() => {
|
|
838
|
-
settleFail({ errMsg: "request:fail timeout" });
|
|
839
|
-
controller.abort();
|
|
840
|
-
}, timeoutMs);
|
|
841
|
-
const dataType = opts.dataType ?? "json";
|
|
842
|
-
const responseType = opts.responseType ?? "text";
|
|
843
|
-
fetch(url, init).then(async (response) => {
|
|
844
|
-
const header = {};
|
|
845
|
-
response.headers.forEach((value, key) => {
|
|
846
|
-
header[key] = value;
|
|
847
|
-
});
|
|
848
|
-
const data = await decodeResponseData(response, dataType, responseType);
|
|
849
|
-
settleSuccess({ data, statusCode: response.status, header, errMsg: "request:ok" });
|
|
850
|
-
}).catch((error) => {
|
|
851
|
-
const reason = error instanceof Error ? error.message : String(error);
|
|
852
|
-
settleFail({ errMsg: `request:fail ${reason || "network error"}` });
|
|
853
|
-
});
|
|
854
|
-
return {
|
|
855
|
-
abort() {
|
|
856
|
-
settleFail({ errMsg: "request:fail abort" });
|
|
857
|
-
controller.abort();
|
|
858
|
-
}
|
|
859
|
-
};
|
|
860
|
-
}
|
|
861
|
-
|
|
862
768
|
// src/preload/shared/api-compat.ts
|
|
769
|
+
var import_electron5 = require("electron");
|
|
863
770
|
function call(fn, payload) {
|
|
864
771
|
try {
|
|
865
772
|
fn?.(payload);
|
|
@@ -975,8 +882,12 @@ function ensureWxApi(wx) {
|
|
|
975
882
|
};
|
|
976
883
|
}
|
|
977
884
|
if (typeof wx.request !== "function") {
|
|
978
|
-
wx.request = (opts) =>
|
|
979
|
-
{
|
|
885
|
+
wx.request = (opts) => {
|
|
886
|
+
const requestId = `${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
887
|
+
const task = {
|
|
888
|
+
abort: () => import_electron5.ipcRenderer.send(BRIDGE_CHANNELS.NATIVE_REQUEST_ABORT, requestId)
|
|
889
|
+
};
|
|
890
|
+
import_electron5.ipcRenderer.invoke(BRIDGE_CHANNELS.NATIVE_REQUEST, requestId, {
|
|
980
891
|
url: opts.url,
|
|
981
892
|
data: opts.data,
|
|
982
893
|
header: opts.header,
|
|
@@ -984,13 +895,23 @@ function ensureWxApi(wx) {
|
|
|
984
895
|
method: opts.method,
|
|
985
896
|
dataType: opts.dataType,
|
|
986
897
|
responseType: opts.responseType
|
|
987
|
-
}
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
898
|
+
}).then((result) => {
|
|
899
|
+
if (result && typeof result === "object" && "statusCode" in result) {
|
|
900
|
+
call(opts.success, result);
|
|
901
|
+
call(opts.complete, result);
|
|
902
|
+
} else {
|
|
903
|
+
call(opts.fail, result);
|
|
904
|
+
call(opts.complete, result);
|
|
905
|
+
}
|
|
906
|
+
}).catch((error) => {
|
|
907
|
+
const err = {
|
|
908
|
+
errMsg: `request:fail ${error instanceof Error ? error.message : String(error)}`
|
|
909
|
+
};
|
|
910
|
+
call(opts.fail, err);
|
|
911
|
+
call(opts.complete, err);
|
|
912
|
+
});
|
|
913
|
+
return task;
|
|
914
|
+
};
|
|
994
915
|
}
|
|
995
916
|
}
|
|
996
917
|
function setupApiCompatHook() {
|
|
@@ -1010,7 +931,7 @@ function setupApiCompatHook() {
|
|
|
1010
931
|
}
|
|
1011
932
|
|
|
1012
933
|
// src/preload/runtime/native-host.ts
|
|
1013
|
-
var
|
|
934
|
+
var import_electron6 = require("electron");
|
|
1014
935
|
|
|
1015
936
|
// ../dimina-electron-runtime/dist/shared/dmb-resource-url.js
|
|
1016
937
|
var DMB_PAGEFRAME_DOC_NAME = "__frame__.html";
|
|
@@ -1045,7 +966,7 @@ function buildRenderHostDocumentUrl(opts) {
|
|
|
1045
966
|
// src/preload/runtime/native-host.ts
|
|
1046
967
|
function queryNativeHostConfig() {
|
|
1047
968
|
try {
|
|
1048
|
-
const res =
|
|
969
|
+
const res = import_electron6.ipcRenderer.sendSync(BRIDGE_CHANNELS.NATIVE_HOST_ENABLED);
|
|
1049
970
|
return res && res.enabled ? res : null;
|
|
1050
971
|
} catch {
|
|
1051
972
|
return null;
|
|
@@ -1055,33 +976,33 @@ function buildBridge2(cfg) {
|
|
|
1055
976
|
return {
|
|
1056
977
|
enabled: true,
|
|
1057
978
|
spawn(opts) {
|
|
1058
|
-
return
|
|
979
|
+
return import_electron6.ipcRenderer.invoke(BRIDGE_CHANNELS.SPAWN, opts);
|
|
1059
980
|
},
|
|
1060
981
|
dispose(bridgeId) {
|
|
1061
982
|
const payload = { bridgeId };
|
|
1062
|
-
|
|
983
|
+
import_electron6.ipcRenderer.send(BRIDGE_CHANNELS.DISPOSE, payload);
|
|
1063
984
|
},
|
|
1064
985
|
openPage(opts) {
|
|
1065
|
-
return
|
|
986
|
+
return import_electron6.ipcRenderer.invoke(BRIDGE_CHANNELS.PAGE_OPEN, opts);
|
|
1066
987
|
},
|
|
1067
988
|
closePage(bridgeId) {
|
|
1068
989
|
const payload = { bridgeId };
|
|
1069
|
-
|
|
990
|
+
import_electron6.ipcRenderer.send(BRIDGE_CHANNELS.PAGE_CLOSE, payload);
|
|
1070
991
|
},
|
|
1071
992
|
notifyLifecycle(payload) {
|
|
1072
|
-
|
|
993
|
+
import_electron6.ipcRenderer.send(BRIDGE_CHANNELS.PAGE_LIFECYCLE, payload);
|
|
1073
994
|
},
|
|
1074
995
|
notifyNavCallback(payload) {
|
|
1075
|
-
|
|
996
|
+
import_electron6.ipcRenderer.send(BRIDGE_CHANNELS.NAV_CALLBACK, payload);
|
|
1076
997
|
},
|
|
1077
998
|
notifyApiResponse(payload) {
|
|
1078
|
-
|
|
999
|
+
import_electron6.ipcRenderer.send(BRIDGE_CHANNELS.API_RESPONSE, payload);
|
|
1079
1000
|
},
|
|
1080
1001
|
notifyActivePage(payload) {
|
|
1081
|
-
|
|
1002
|
+
import_electron6.ipcRenderer.send(BRIDGE_CHANNELS.ACTIVE_PAGE, payload);
|
|
1082
1003
|
},
|
|
1083
1004
|
notifyPageStack(payload) {
|
|
1084
|
-
|
|
1005
|
+
import_electron6.ipcRenderer.send(BRIDGE_CHANNELS.PAGE_STACK, payload);
|
|
1085
1006
|
},
|
|
1086
1007
|
createRenderHostUrl(opts) {
|
|
1087
1008
|
return buildRenderHostDocumentUrl(opts);
|
|
@@ -1093,8 +1014,8 @@ function buildBridge2(cfg) {
|
|
|
1093
1014
|
;
|
|
1094
1015
|
listener(payload);
|
|
1095
1016
|
};
|
|
1096
|
-
|
|
1097
|
-
return () =>
|
|
1017
|
+
import_electron6.ipcRenderer.on(channel, wrapped);
|
|
1018
|
+
return () => import_electron6.ipcRenderer.removeListener(channel, wrapped);
|
|
1098
1019
|
}
|
|
1099
1020
|
};
|
|
1100
1021
|
}
|
|
@@ -1106,11 +1027,11 @@ function installNativeHostBridge() {
|
|
|
1106
1027
|
}
|
|
1107
1028
|
|
|
1108
1029
|
// src/preload/runtime/clipboard.ts
|
|
1109
|
-
var
|
|
1030
|
+
var import_electron7 = require("electron");
|
|
1110
1031
|
function buildBridge3() {
|
|
1111
1032
|
return {
|
|
1112
|
-
readText: () =>
|
|
1113
|
-
writeText: (text) =>
|
|
1033
|
+
readText: () => import_electron7.clipboard.readText(),
|
|
1034
|
+
writeText: (text) => import_electron7.clipboard.writeText(text)
|
|
1114
1035
|
};
|
|
1115
1036
|
}
|
|
1116
1037
|
function installClipboardBridge() {
|