@dimina-kit/devtools 0.4.0-dev.20260703051110 → 0.4.0-dev.20260706064107
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/main/app/app.js +6 -0
- package/dist/main/index.bundle.js +445 -49
- package/dist/main/ipc/bridge-router.d.ts +8 -0
- package/dist/main/ipc/bridge-router.js +352 -38
- package/dist/main/services/compile-standby.d.ts +26 -0
- package/dist/main/services/compile-standby.js +57 -0
- package/dist/main/services/console-forward/index.d.ts +12 -1
- package/dist/main/services/console-forward/index.js +99 -1
- package/dist/main/services/diagnostics/index.d.ts +49 -0
- package/dist/main/services/diagnostics/index.js +61 -0
- package/dist/main/services/network-forward/index.js +32 -0
- package/dist/main/services/notifications/renderer-notifier.d.ts +39 -0
- package/dist/main/services/notifications/renderer-notifier.js +4 -1
- package/dist/main/services/projects/project-repository.js +2 -1
- package/dist/main/services/views/simulator-session-policy.js +17 -0
- package/dist/main/services/workbench-context.d.ts +10 -0
- package/dist/main/services/workspace/workspace-service.js +12 -3
- package/dist/main/windows/service-host-window/create.d.ts +15 -1
- package/dist/main/windows/service-host-window/create.js +11 -3
- package/dist/preload/shared/api-compat.js +18 -55
- package/dist/preload/windows/host-toolbar-runtime.cjs.map +2 -2
- package/dist/preload/windows/main.cjs.map +1 -1
- package/dist/preload/windows/simulator.cjs +117 -44
- package/dist/preload/windows/simulator.cjs.map +3 -3
- package/dist/preload/windows/simulator.js +117 -44
- package/dist/renderer/assets/index-BwzPwCmM.js +49 -0
- package/dist/renderer/assets/{input-Cjk0wSEh.js → input-CTb_le7F.js} +2 -2
- package/dist/renderer/assets/ipc-transport-BPWIV5hA.css +1 -0
- package/dist/renderer/assets/{ipc-transport-OZS-KmOW.js → ipc-transport-Ck5Xa8Tu.js} +2 -2
- package/dist/renderer/assets/popover-B1Zu2UQu.js +2 -0
- package/dist/renderer/assets/{select-BQDXi5ih.js → select-ozSk5Pt6.js} +2 -2
- package/dist/renderer/assets/{settings-tP3Px2KR.js → settings-CNwGOI22.js} +2 -2
- package/dist/renderer/assets/settings-api-DMbMp1Eq.js +2 -0
- package/dist/renderer/assets/{workbenchSettings-COhuFF-i.js → workbenchSettings-Cr4EHo5w.js} +2 -2
- package/dist/renderer/entries/main/index.html +6 -6
- package/dist/renderer/entries/popover/index.html +5 -5
- package/dist/renderer/entries/settings/index.html +5 -5
- package/dist/renderer/entries/workbench-settings/index.html +4 -4
- package/dist/shared/bridge-channels.d.ts +22 -0
- package/dist/shared/ipc-channels.d.ts +3 -0
- package/dist/shared/ipc-channels.js +9 -0
- package/dist/shared/request-core.d.ts +84 -0
- package/dist/shared/request-core.js +168 -0
- package/dist/shared/simulator-api-metadata.d.ts +22 -17
- package/dist/shared/simulator-api-metadata.js +36 -0
- package/dist/shared/types.d.ts +7 -4
- package/dist/simulator/assets/{device-shell-CiLAPa0I.js → device-shell-C-wcFq3Z.js} +2 -2
- package/dist/simulator/assets/{jsx-runtime-CDK-o-S0.js → jsx-runtime-BDTY6fEq.js} +2 -2
- package/dist/simulator/assets/simulator-DU3-fS3v.js +10 -0
- package/dist/simulator/assets/simulator-mini-app-DzfMfnVM.js +2 -0
- package/dist/simulator/simulator.html +2 -2
- package/package.json +5 -5
- package/dist/renderer/assets/index-D-ksyN1p.js +0 -49
- package/dist/renderer/assets/ipc-transport-D5dKIti1.css +0 -1
- package/dist/renderer/assets/popover-CQVvOe90.js +0 -2
- package/dist/renderer/assets/settings-api-B6x2mhaD.js +0 -2
- package/dist/simulator/assets/simulator-Dvnxry3y.js +0 -10
- package/dist/simulator/assets/simulator-mini-app-Bt639XL_.js +0 -2
|
@@ -624,6 +624,108 @@ function createAppDataSource() {
|
|
|
624
624
|
};
|
|
625
625
|
}
|
|
626
626
|
|
|
627
|
+
// src/shared/request-core.ts
|
|
628
|
+
var DEFAULT_REQUEST_TIMEOUT_MS = 6e4;
|
|
629
|
+
var MAX_TIMEOUT_MS = 2147483647;
|
|
630
|
+
function resolveTimeoutBudgetMs(timeout) {
|
|
631
|
+
const t = Number(timeout);
|
|
632
|
+
return Number.isFinite(t) && t > 0 && t <= MAX_TIMEOUT_MS ? t : DEFAULT_REQUEST_TIMEOUT_MS;
|
|
633
|
+
}
|
|
634
|
+
function buildHeaders(header) {
|
|
635
|
+
const headers = new Headers();
|
|
636
|
+
for (const [key, value] of Object.entries(header ?? {})) {
|
|
637
|
+
if (value != null) headers.set(key, String(value));
|
|
638
|
+
}
|
|
639
|
+
if (!headers.has("content-type")) headers.set("content-type", "application/json");
|
|
640
|
+
return headers;
|
|
641
|
+
}
|
|
642
|
+
function appendQueryParams(url, data) {
|
|
643
|
+
const base = typeof location !== "undefined" ? location.href : void 0;
|
|
644
|
+
const resolved = new URL(url, base);
|
|
645
|
+
for (const [key, value] of Object.entries(data)) {
|
|
646
|
+
resolved.searchParams.append(key, String(value));
|
|
647
|
+
}
|
|
648
|
+
return resolved.toString();
|
|
649
|
+
}
|
|
650
|
+
function encodeBody(data, contentType) {
|
|
651
|
+
if (typeof data === "string") return data;
|
|
652
|
+
if (contentType.includes("application/x-www-form-urlencoded")) {
|
|
653
|
+
const form = new URLSearchParams();
|
|
654
|
+
for (const [key, value] of Object.entries(data)) {
|
|
655
|
+
form.append(key, String(value));
|
|
656
|
+
}
|
|
657
|
+
return form.toString();
|
|
658
|
+
}
|
|
659
|
+
return JSON.stringify(data);
|
|
660
|
+
}
|
|
661
|
+
async function decodeResponseData(response, dataType, responseType) {
|
|
662
|
+
if (responseType === "arraybuffer" || dataType === "arraybuffer") {
|
|
663
|
+
return response.arrayBuffer();
|
|
664
|
+
}
|
|
665
|
+
const text = await response.text();
|
|
666
|
+
if (dataType !== "json") return text;
|
|
667
|
+
try {
|
|
668
|
+
return JSON.parse(text);
|
|
669
|
+
} catch {
|
|
670
|
+
return text;
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
function performRequest(opts, callbacks) {
|
|
674
|
+
const method = (opts.method || "GET").toUpperCase();
|
|
675
|
+
const canHaveBody = method !== "GET" && method !== "HEAD";
|
|
676
|
+
const headers = buildHeaders(opts.header);
|
|
677
|
+
let url = opts.url;
|
|
678
|
+
const init = { method, headers };
|
|
679
|
+
if (!canHaveBody) {
|
|
680
|
+
if (opts.data && typeof opts.data === "object") {
|
|
681
|
+
url = appendQueryParams(url, opts.data);
|
|
682
|
+
}
|
|
683
|
+
} else if (opts.data != null) {
|
|
684
|
+
init.body = encodeBody(opts.data, headers.get("content-type") ?? "");
|
|
685
|
+
}
|
|
686
|
+
const controller = new AbortController();
|
|
687
|
+
init.signal = controller.signal;
|
|
688
|
+
let settled = false;
|
|
689
|
+
function settleSuccess(res) {
|
|
690
|
+
if (settled) return;
|
|
691
|
+
settled = true;
|
|
692
|
+
clearTimeout(timer);
|
|
693
|
+
callbacks.success?.(res);
|
|
694
|
+
callbacks.complete?.(res);
|
|
695
|
+
}
|
|
696
|
+
function settleFail(err) {
|
|
697
|
+
if (settled) return;
|
|
698
|
+
settled = true;
|
|
699
|
+
clearTimeout(timer);
|
|
700
|
+
callbacks.fail?.(err);
|
|
701
|
+
callbacks.complete?.(err);
|
|
702
|
+
}
|
|
703
|
+
const timeoutMs = resolveTimeoutBudgetMs(opts.timeout);
|
|
704
|
+
const timer = setTimeout(() => {
|
|
705
|
+
settleFail({ errMsg: "request:fail timeout" });
|
|
706
|
+
controller.abort();
|
|
707
|
+
}, timeoutMs);
|
|
708
|
+
const dataType = opts.dataType ?? "json";
|
|
709
|
+
const responseType = opts.responseType ?? "text";
|
|
710
|
+
fetch(url, init).then(async (response) => {
|
|
711
|
+
const header = {};
|
|
712
|
+
response.headers.forEach((value, key) => {
|
|
713
|
+
header[key] = value;
|
|
714
|
+
});
|
|
715
|
+
const data = await decodeResponseData(response, dataType, responseType);
|
|
716
|
+
settleSuccess({ data, statusCode: response.status, header, errMsg: "request:ok" });
|
|
717
|
+
}).catch((error) => {
|
|
718
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
719
|
+
settleFail({ errMsg: `request:fail ${reason || "network error"}` });
|
|
720
|
+
});
|
|
721
|
+
return {
|
|
722
|
+
abort() {
|
|
723
|
+
settleFail({ errMsg: "request:fail abort" });
|
|
724
|
+
controller.abort();
|
|
725
|
+
}
|
|
726
|
+
};
|
|
727
|
+
}
|
|
728
|
+
|
|
627
729
|
// src/preload/shared/api-compat.ts
|
|
628
730
|
function call(fn, payload) {
|
|
629
731
|
try {
|
|
@@ -740,51 +842,22 @@ function ensureWxApi(wx) {
|
|
|
740
842
|
};
|
|
741
843
|
}
|
|
742
844
|
if (typeof wx.request !== "function") {
|
|
743
|
-
wx.request = (opts) =>
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
requestUrl = url.toString();
|
|
758
|
-
} else if (opts.data != null) {
|
|
759
|
-
init.body = typeof opts.data === "string" ? opts.data : JSON.stringify(opts.data);
|
|
845
|
+
wx.request = (opts) => performRequest(
|
|
846
|
+
{
|
|
847
|
+
url: opts.url,
|
|
848
|
+
data: opts.data,
|
|
849
|
+
header: opts.header,
|
|
850
|
+
timeout: opts.timeout,
|
|
851
|
+
method: opts.method,
|
|
852
|
+
dataType: opts.dataType,
|
|
853
|
+
responseType: opts.responseType
|
|
854
|
+
},
|
|
855
|
+
{
|
|
856
|
+
success: (res) => call(opts.success, res),
|
|
857
|
+
fail: (err) => call(opts.fail, err),
|
|
858
|
+
complete: (res) => call(opts.complete, res)
|
|
760
859
|
}
|
|
761
|
-
|
|
762
|
-
fetch(requestUrl, init).then(async (response) => {
|
|
763
|
-
const headers = Object.fromEntries(response.headers.entries());
|
|
764
|
-
let data;
|
|
765
|
-
if (opts.dataType === "arraybuffer") data = await response.arrayBuffer();
|
|
766
|
-
else {
|
|
767
|
-
const text = await response.text();
|
|
768
|
-
if (opts.dataType === "text") data = text;
|
|
769
|
-
else {
|
|
770
|
-
try {
|
|
771
|
-
data = JSON.parse(text);
|
|
772
|
-
} catch {
|
|
773
|
-
data = text;
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
call(opts.success, { data, statusCode: response.status, header: headers, errMsg: "request:ok" });
|
|
778
|
-
}).catch((error) => {
|
|
779
|
-
call(opts.fail, { errMsg: `request:fail ${error instanceof Error ? error.message : String(error)}` });
|
|
780
|
-
}).finally(() => {
|
|
781
|
-
if (timeoutId != null) window.clearTimeout(timeoutId);
|
|
782
|
-
call(opts.complete, void 0);
|
|
783
|
-
});
|
|
784
|
-
return {
|
|
785
|
-
abort: () => controller.abort()
|
|
786
|
-
};
|
|
787
|
-
};
|
|
860
|
+
);
|
|
788
861
|
}
|
|
789
862
|
}
|
|
790
863
|
function setupApiCompatHook() {
|