@pubinfo/devtools 2.1.10 → 2.1.12
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/client/assets/{Navbar-BQK6jUhq.js → Navbar-DYyO71VR.js} +27 -3
- package/dist/client/assets/{PanelGrids-Bd6D6enp.js → PanelGrids-rTFcKhN6.js} +4 -2
- package/dist/client/assets/{SelectTabs-CTO4P53M.js → SelectTabs-Ba4fEjYh.js} +17 -2
- package/dist/client/assets/{_plugin-vue_export-helper-D8E0syuh.js → _plugin-vue_export-helper-Ctigiz3_.js} +2 -0
- package/dist/client/assets/{component-D5gKG7wj.js → component-Cy0W8Ddj.js} +39 -4
- package/dist/client/assets/{core-D6JqxgYq.js → core-CrqZ8qrs.js} +1300 -24
- package/dist/client/assets/{css-DbgpCiOq.js → css-3PrNsnPt.js} +1 -0
- package/dist/client/assets/css-mRoPUXX2.js +2 -0
- package/dist/client/assets/{engine-oniguruma-n-bafM3H.js → engine-oniguruma-C1mOz3PQ.js} +2 -0
- package/dist/client/assets/{fetch-CFHiXvGO.js → fetch-Bz1BNH1Z.js} +159 -5
- package/dist/client/assets/{html-Tu6OX5Eq.js → html-B5Ny8iin.js} +4 -2
- package/dist/client/assets/html-g0uz4re7.js +2 -0
- package/dist/client/assets/{import-w1c5mo52.js → import-gNFdeWVi.js} +33 -4
- package/dist/client/assets/index-CWvhvxM4.js +5208 -0
- package/dist/client/assets/{issue-CCThaaVh.js → issue-Yr5hL5Lv.js} +22 -3
- package/dist/client/assets/{javascript-_FvKZjd1.js → javascript-D9OtNJpI.js} +1 -0
- package/dist/client/assets/javascript-yBXmlTMV.js +2 -0
- package/dist/client/assets/json-CDHOIUIc.js +2 -0
- package/dist/client/assets/{json-CzPoZe0r.js → json-DFv6u-UA.js} +1 -0
- package/dist/client/assets/{pages-Cq5pNVp0.js → pages-CuyX8oYZ.js} +33 -9
- package/dist/client/assets/{index-D_HRlfbv.js → runtime-core.esm-bundler-CsZVtwV7.js} +153 -4755
- package/dist/client/assets/{server-router-BJdAYxdf.js → server-router-BkLhbRZZ.js} +177 -18
- package/dist/client/assets/{typescript-BEfC8S_c.js → typescript-C6a_X60d.js} +1 -0
- package/dist/client/assets/typescript-jte7_wp4.js +2 -0
- package/dist/client/assets/{vitesse-dark-Bz6RXfkV.js → vitesse-dark-Dd6LUkEf.js} +2 -0
- package/dist/client/assets/{vitesse-light-NvDlvJl2.js → vitesse-light-LEkeIfQx.js} +2 -0
- package/dist/client/assets/{vue-DZSPIjN6.js → vue-BvqQiUzU.js} +11 -5
- package/dist/client/assets/{wasm-D0Echd05.js → wasm-bCjRd0-o.js} +2 -0
- package/dist/client/index.html +2 -1
- package/package.json +3 -3
- package/dist/client/assets/css-D-vtiAqw.js +0 -2
- package/dist/client/assets/html-74krLQbR.js +0 -2
- package/dist/client/assets/javascript-QnJdw8u5.js +0 -2
- package/dist/client/assets/json-WgRhEAOB.js +0 -2
- package/dist/client/assets/typescript-C5tShSk5.js +0 -2
|
@@ -1,17 +1,23 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./javascript-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { t as
|
|
6
|
-
import { t as
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./javascript-yBXmlTMV.js","./javascript-D9OtNJpI.js","./typescript-jte7_wp4.js","./typescript-C6a_X60d.js","./vue-BvqQiUzU.js","./css-3PrNsnPt.js","./html-B5Ny8iin.js","./json-DFv6u-UA.js","./json-CDHOIUIc.js","./html-g0uz4re7.js","./css-mRoPUXX2.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import { A as renderList, B as withDirectives, C as nextTick, Ct as normalizeStyle, E as openBlock, G as isRef, I as useSlots, L as watch, M as resolveComponent, N as resolveDirective, O as provide, P as resolveDynamicComponent, Q as shallowRef, R as watchEffect, S as mergeProps, T as onMounted, Y as ref, _ as getCurrentInstance, b as inject, c as createBaseVNode, d as createElementBlock, et as toRef, g as defineComponent, h as createVNode, i as KeepAlive, j as renderSlot, l as createBlock, m as createTextVNode, nt as unref, q as reactive, r as Fragment, s as computed, u as createCommentVNode, w as onBeforeUnmount, wt as toDisplayString, xt as normalizeClass, y as h, z as withCtx } from "./runtime-core.esm-bundler-CsZVtwV7.js";
|
|
3
|
+
import { i as vModelCheckbox, l as withKeys, r as Transition, s as vModelSelect, t as __vitePreload } from "./index-CWvhvxM4.js";
|
|
4
|
+
import { a as Icon_default, i as SectionBlock_default, n as TextInput_default, r as Button_default, t as Navbar_default } from "./Navbar-DYyO71VR.js";
|
|
5
|
+
import { c as onClickOutside, d as useLocalStorage, f as useVModel, m as createSharedComposable, o as Badge_default, s as createReusableTemplate, t as apiListFetch, u as useElementSize } from "./fetch-Bz1BNH1Z.js";
|
|
6
|
+
import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper-Ctigiz3_.js";
|
|
7
|
+
import { t as PanelGrids_default } from "./PanelGrids-rTFcKhN6.js";
|
|
8
|
+
//#region src/client/@ui/Card.vue
|
|
7
9
|
var _sfc_main = {};
|
|
8
10
|
var _hoisted_1$10 = { class: "n-card n-card-base" };
|
|
9
11
|
function _sfc_render(_ctx, _cache) {
|
|
10
12
|
return openBlock(), createElementBlock("div", _hoisted_1$10, [renderSlot(_ctx.$slots, "default")]);
|
|
11
13
|
}
|
|
12
14
|
var Card_default = /* @__PURE__ */ _plugin_vue_export_helper_default(_sfc_main, [["render", _sfc_render]]);
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/client/@ui/Drawer.vue?vue&type=script&setup=true&lang.ts
|
|
13
17
|
var _hoisted_1$9 = ["border"];
|
|
14
18
|
var _hoisted_2$9 = { class: "relative h-full w-full of-auto" };
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/client/@ui/Drawer.vue
|
|
15
21
|
var Drawer_default = /* @__PURE__ */ defineComponent({
|
|
16
22
|
__name: "Drawer",
|
|
17
23
|
props: {
|
|
@@ -78,6 +84,8 @@ var Drawer_default = /* @__PURE__ */ defineComponent({
|
|
|
78
84
|
};
|
|
79
85
|
}
|
|
80
86
|
});
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region ../../node_modules/.pnpm/splitpanes@4.0.4_vue@3.5.28_typescript@5.9.3_/node_modules/splitpanes/dist/splitpanes.es.js
|
|
81
89
|
var Pe = {
|
|
82
90
|
__name: "splitpanes",
|
|
83
91
|
props: {
|
|
@@ -375,7 +383,11 @@ var Pe = {
|
|
|
375
383
|
}, [renderSlot(r.$slots, "default")], 4));
|
|
376
384
|
}
|
|
377
385
|
};
|
|
386
|
+
//#endregion
|
|
387
|
+
//#region src/client/@ui/SplitPane.vue?vue&type=script&setup=true&lang.ts
|
|
378
388
|
var DEFAULT = 30;
|
|
389
|
+
//#endregion
|
|
390
|
+
//#region src/client/@ui/SplitPane.vue
|
|
379
391
|
var SplitPane_default = /* @__PURE__ */ defineComponent({
|
|
380
392
|
__name: "SplitPane",
|
|
381
393
|
props: {
|
|
@@ -422,25 +434,40 @@ var SplitPane_default = /* @__PURE__ */ defineComponent({
|
|
|
422
434
|
};
|
|
423
435
|
}
|
|
424
436
|
});
|
|
437
|
+
//#endregion
|
|
438
|
+
//#region src/client/composables/useShikiHighlighter.ts
|
|
425
439
|
var highlighterPromise = null;
|
|
440
|
+
/**
|
|
441
|
+
* 获取 Shiki 高亮器实例(单例模式)
|
|
442
|
+
* 支持的语言:javascript, typescript, vue, json, html, css
|
|
443
|
+
* 支持的主题:vitesse-dark, vitesse-light
|
|
444
|
+
*
|
|
445
|
+
* 所有 shiki 相关模块均采用动态导入,避免主 bundle 体积过大
|
|
446
|
+
*/
|
|
426
447
|
function getShikiHighlighter() {
|
|
427
448
|
if (!highlighterPromise) highlighterPromise = (async () => {
|
|
428
|
-
const [{ createHighlighterCore }, { createOnigurumaEngine }] = await Promise.all([__vitePreload(() => import("./core-
|
|
449
|
+
const [{ createHighlighterCore }, { createOnigurumaEngine }] = await Promise.all([__vitePreload(() => import("./core-CrqZ8qrs.js"), [], import.meta.url), __vitePreload(() => import("./engine-oniguruma-C1mOz3PQ.js"), [], import.meta.url)]);
|
|
429
450
|
return createHighlighterCore({
|
|
430
|
-
themes: [__vitePreload(() => import("./vitesse-dark-
|
|
451
|
+
themes: [__vitePreload(() => import("./vitesse-dark-Dd6LUkEf.js"), [], import.meta.url), __vitePreload(() => import("./vitesse-light-LEkeIfQx.js"), [], import.meta.url)],
|
|
431
452
|
langs: [
|
|
432
|
-
__vitePreload(() => import("./javascript-
|
|
433
|
-
__vitePreload(() => import("./typescript-
|
|
434
|
-
__vitePreload(() => import("./vue-
|
|
435
|
-
__vitePreload(() => import("./json-
|
|
436
|
-
__vitePreload(() => import("./html-
|
|
437
|
-
__vitePreload(() => import("./css-
|
|
453
|
+
__vitePreload(() => import("./javascript-yBXmlTMV.js"), __vite__mapDeps([0,1]), import.meta.url),
|
|
454
|
+
__vitePreload(() => import("./typescript-jte7_wp4.js"), __vite__mapDeps([2,3]), import.meta.url),
|
|
455
|
+
__vitePreload(() => import("./vue-BvqQiUzU.js"), __vite__mapDeps([4,5,6,1,7,3]), import.meta.url),
|
|
456
|
+
__vitePreload(() => import("./json-CDHOIUIc.js"), __vite__mapDeps([8,7]), import.meta.url),
|
|
457
|
+
__vitePreload(() => import("./html-g0uz4re7.js"), __vite__mapDeps([9,6,5,1]), import.meta.url),
|
|
458
|
+
__vitePreload(() => import("./css-mRoPUXX2.js"), __vite__mapDeps([10,5]), import.meta.url)
|
|
438
459
|
],
|
|
439
|
-
engine: createOnigurumaEngine(__vitePreload(() => import("./wasm-
|
|
460
|
+
engine: createOnigurumaEngine(__vitePreload(() => import("./wasm-bCjRd0-o.js"), [], import.meta.url))
|
|
440
461
|
});
|
|
441
462
|
})();
|
|
442
463
|
return highlighterPromise;
|
|
443
464
|
}
|
|
465
|
+
/**
|
|
466
|
+
* 使用 Shiki 高亮代码
|
|
467
|
+
* @param code 要高亮的代码
|
|
468
|
+
* @param options 高亮选项
|
|
469
|
+
* @returns 高亮后的 HTML 字符串
|
|
470
|
+
*/
|
|
444
471
|
async function highlightCode(code, options) {
|
|
445
472
|
const { lang, lightTheme = "vitesse-light", darkTheme = "vitesse-dark", fallbackLang = "typescript" } = options;
|
|
446
473
|
try {
|
|
@@ -458,8 +485,12 @@ async function highlightCode(code, options) {
|
|
|
458
485
|
return `<pre><code>${code}</code></pre>`;
|
|
459
486
|
}
|
|
460
487
|
}
|
|
488
|
+
//#endregion
|
|
489
|
+
//#region src/client/@ui/CodeBlock.vue?vue&type=script&setup=true&lang.ts
|
|
461
490
|
var _hoisted_1$8 = ["innerHTML"];
|
|
462
491
|
var _hoisted_2$8 = ["textContent"];
|
|
492
|
+
//#endregion
|
|
493
|
+
//#region src/client/@ui/CodeBlock.vue
|
|
463
494
|
var CodeBlock_default = /* @__PURE__ */ defineComponent({
|
|
464
495
|
name: "CodeBlock",
|
|
465
496
|
__name: "CodeBlock",
|
|
@@ -541,9 +572,21 @@ var CodeBlock_default = /* @__PURE__ */ defineComponent({
|
|
|
541
572
|
};
|
|
542
573
|
}
|
|
543
574
|
});
|
|
544
|
-
|
|
575
|
+
//#endregion
|
|
576
|
+
//#region src/constants.ts
|
|
577
|
+
/**
|
|
578
|
+
* Devtools 在宿主应用/面板中的本地存储键名集合。
|
|
579
|
+
*
|
|
580
|
+
* - response:用于缓存最近一次请求的原始响应(含状态码/头部/数据),
|
|
581
|
+
* 以便切换页面或刷新后仍能展示上一次请求结果。
|
|
582
|
+
*/
|
|
583
|
+
var devtoolsStorageKey = { response: "__pubinfo_devtools_raw_response__" };
|
|
584
|
+
//#endregion
|
|
585
|
+
//#region src/client/@ui/Loading.vue?vue&type=script&setup=true&lang.ts
|
|
545
586
|
var _hoisted_1$7 = { class: "n-loading n-panel-grids-center" };
|
|
546
587
|
var _hoisted_2$7 = { class: "flex flex-col animate-pulse items-center text-lg" };
|
|
588
|
+
//#endregion
|
|
589
|
+
//#region src/client/@ui/Loading.vue
|
|
547
590
|
var Loading_default = /* @__PURE__ */ defineComponent({
|
|
548
591
|
name: "Loading",
|
|
549
592
|
__name: "Loading",
|
|
@@ -553,7 +596,9 @@ var Loading_default = /* @__PURE__ */ defineComponent({
|
|
|
553
596
|
};
|
|
554
597
|
}
|
|
555
598
|
});
|
|
556
|
-
|
|
599
|
+
//#endregion
|
|
600
|
+
//#region src/client/composables/constants.ts
|
|
601
|
+
var ServerRouteTabIcons = {
|
|
557
602
|
snippet: "i-ph-file-code",
|
|
558
603
|
headers: "i-ph-file-html",
|
|
559
604
|
cookies: "i-ph-cookie",
|
|
@@ -561,6 +606,8 @@ const ServerRouteTabIcons = {
|
|
|
561
606
|
query: "i-ph-question",
|
|
562
607
|
body: "i-ph-file-text"
|
|
563
608
|
};
|
|
609
|
+
//#endregion
|
|
610
|
+
//#region src/client/composables/useInputDefaults.ts
|
|
564
611
|
function createDefaultState() {
|
|
565
612
|
return {
|
|
566
613
|
query: [],
|
|
@@ -573,7 +620,7 @@ function toRecord(list) {
|
|
|
573
620
|
const formatted = Object.fromEntries(list.filter(({ active, key, value }) => active && key && value !== void 0).map(({ key, value }) => [key, value]));
|
|
574
621
|
return Object.keys(formatted).length ? formatted : void 0;
|
|
575
622
|
}
|
|
576
|
-
|
|
623
|
+
var useInputDefaults = createSharedComposable(() => {
|
|
577
624
|
const inputDefaults = useLocalStorage("pubinfo-devtools:input-defaults", createDefaultState(), { deep: true });
|
|
578
625
|
function getDefaults(tab) {
|
|
579
626
|
return inputDefaults.value[tab];
|
|
@@ -600,6 +647,9 @@ const useInputDefaults = createSharedComposable(() => {
|
|
|
600
647
|
resetToEmpty
|
|
601
648
|
};
|
|
602
649
|
});
|
|
650
|
+
//#endregion
|
|
651
|
+
//#region src/client/composables/useServerRouteParams.ts
|
|
652
|
+
/** 创建参数输入的默认状态 */
|
|
603
653
|
function createDefaultParamInputs() {
|
|
604
654
|
return {
|
|
605
655
|
query: [{
|
|
@@ -622,6 +672,9 @@ function createDefaultParamInputs() {
|
|
|
622
672
|
}]
|
|
623
673
|
};
|
|
624
674
|
}
|
|
675
|
+
/**
|
|
676
|
+
* 从简化的 schema.type 推断输入控件类型。
|
|
677
|
+
*/
|
|
625
678
|
function getInputTypeFromSchema(schemaType) {
|
|
626
679
|
switch (schemaType) {
|
|
627
680
|
case "integer":
|
|
@@ -630,10 +683,14 @@ function getInputTypeFromSchema(schemaType) {
|
|
|
630
683
|
default: return "string";
|
|
631
684
|
}
|
|
632
685
|
}
|
|
686
|
+
/** 将表单项数组转为简单的 key-value 记录,仅保留已激活的项 */
|
|
633
687
|
function parseInputs(inputs = []) {
|
|
634
688
|
const formatted = Object.fromEntries(inputs.filter(({ active, key, value }) => active && key && value !== void 0).map(({ key, value }) => [key, value]));
|
|
635
689
|
return Object.entries(formatted).length ? formatted : void 0;
|
|
636
690
|
}
|
|
691
|
+
/**
|
|
692
|
+
* 负责管理单个路由的参数输入状态(包含默认值合并、tab 切换、最终 URL 计算等)。
|
|
693
|
+
*/
|
|
637
694
|
function useServerRouteParams(route, options = {}) {
|
|
638
695
|
const paramInputs = ref(createDefaultParamInputs());
|
|
639
696
|
const activeTab = ref();
|
|
@@ -665,6 +722,11 @@ function useServerRouteParams(route, options = {}) {
|
|
|
665
722
|
function ensureActiveTab() {
|
|
666
723
|
if (!activeTab.value) activeTab.value = route.value.paramLocation === "body" ? "body" : "query";
|
|
667
724
|
}
|
|
725
|
+
/**
|
|
726
|
+
* 基于路由的 `paramSchema` 初始构建/合并参数输入列表。
|
|
727
|
+
* - 优先将 schema 中的字段置顶并标记 fromSchema
|
|
728
|
+
* - 其后追加用户自定义的输入项(不覆盖)
|
|
729
|
+
*/
|
|
668
730
|
function initializeParamsFromSchema() {
|
|
669
731
|
ensureActiveTab();
|
|
670
732
|
const properties = route.value.paramSchema?.properties;
|
|
@@ -700,9 +762,11 @@ function useServerRouteParams(route, options = {}) {
|
|
|
700
762
|
type: "string"
|
|
701
763
|
}];
|
|
702
764
|
}
|
|
765
|
+
/** 重置所有参数输入为默认状态 */
|
|
703
766
|
function resetParamInputs() {
|
|
704
767
|
paramInputs.value = createDefaultParamInputs();
|
|
705
768
|
}
|
|
769
|
+
/** 当路由变化时,按路由特性同步参数输入与激活的 tab */
|
|
706
770
|
function syncParamsForRoute() {
|
|
707
771
|
resetParamInputs();
|
|
708
772
|
activeTab.value = route.value.paramLocation === "body" ? "body" : "query";
|
|
@@ -723,6 +787,13 @@ function useServerRouteParams(route, options = {}) {
|
|
|
723
787
|
resetParamInputs
|
|
724
788
|
};
|
|
725
789
|
}
|
|
790
|
+
//#endregion
|
|
791
|
+
//#region src/client/composables/useServerRouteRequest.ts
|
|
792
|
+
/**
|
|
793
|
+
* 将 HTTP 方法映射为宿主请求实例的方法名。
|
|
794
|
+
*
|
|
795
|
+
* 约定:宿主请求实例提供 `Get/Post/Put/Patch/Delete/Head` 等方法。
|
|
796
|
+
*/
|
|
726
797
|
var methodNameMap = {
|
|
727
798
|
GET: "Get",
|
|
728
799
|
POST: "Post",
|
|
@@ -818,6 +889,9 @@ async function sendRequestThroughHost(payload) {
|
|
|
818
889
|
}
|
|
819
890
|
});
|
|
820
891
|
}
|
|
892
|
+
/**
|
|
893
|
+
* 尝试通过 JSON 序列化/反序列化将对象转为普通对象,避免 Proxy/循环引用等。
|
|
894
|
+
*/
|
|
821
895
|
function toPlainObject(payload) {
|
|
822
896
|
if (payload === void 0 || payload === null) return payload;
|
|
823
897
|
try {
|
|
@@ -826,9 +900,22 @@ function toPlainObject(payload) {
|
|
|
826
900
|
return payload;
|
|
827
901
|
}
|
|
828
902
|
}
|
|
903
|
+
/** 判断 payload 是否像 HTTP 响应对象(含 status 或 headers 字段) */
|
|
829
904
|
function isHttpLike(payload) {
|
|
830
905
|
return payload && typeof payload === "object" && ("status" in payload || "headers" in payload);
|
|
831
906
|
}
|
|
907
|
+
/**
|
|
908
|
+
* 用于在 Devtools 中对单个路由发起请求与展示响应的组合式函数。
|
|
909
|
+
*
|
|
910
|
+
* 功能:
|
|
911
|
+
* - 通过与宿主页面的消息通道委托应用执行请求,并按路由/参数构造请求。
|
|
912
|
+
* - 统一异常处理与响应快照持久化,便于刷新后查看历史结果。
|
|
913
|
+
* - 提供响应的语言/内容推断(json/html/css/media/pdf/text)。
|
|
914
|
+
*
|
|
915
|
+
* 持久化:
|
|
916
|
+
* - 默认使用 `devtoolsStorageKey.response` 存储最近一次响应,
|
|
917
|
+
* 可通过 `storageKey=false` 禁用。
|
|
918
|
+
*/
|
|
832
919
|
function useServerRouteRequest({ route, routeMethod, parsedQuery, parsedBody, parsedHeader, cookie, storageKey = devtoolsStorageKey.response }) {
|
|
833
920
|
const fetching = ref(false);
|
|
834
921
|
const hasSentRequest = ref(false);
|
|
@@ -1043,6 +1130,13 @@ function useServerRouteRequest({ route, routeMethod, parsedQuery, parsedBody, pa
|
|
|
1043
1130
|
storedResponse
|
|
1044
1131
|
};
|
|
1045
1132
|
}
|
|
1133
|
+
//#endregion
|
|
1134
|
+
//#region src/client/composables/useServerRouteSnippets.ts
|
|
1135
|
+
/**
|
|
1136
|
+
* 根据当前选中的路由和参数生成多种语言/框架的调用示例。
|
|
1137
|
+
*
|
|
1138
|
+
* 目前仅输出 TypeScript 片段,后续可按需扩展(curl、fetch、axios 等)。
|
|
1139
|
+
*/
|
|
1046
1140
|
function useServerRouteSnippets({ route, routeMethod, parsedQuery, parsedBody, parsedHeader }) {
|
|
1047
1141
|
return computed(() => {
|
|
1048
1142
|
const snippets = [];
|
|
@@ -1084,6 +1178,8 @@ const { data } = await ${routeInfo.name}(${argsStr});`,
|
|
|
1084
1178
|
return snippets;
|
|
1085
1179
|
});
|
|
1086
1180
|
}
|
|
1181
|
+
//#endregion
|
|
1182
|
+
//#region src/client/utils/method.ts
|
|
1087
1183
|
var requestMethodClass = {
|
|
1088
1184
|
get: "n-green",
|
|
1089
1185
|
post: "n-blue",
|
|
@@ -1096,10 +1192,14 @@ var requestMethodClass = {
|
|
|
1096
1192
|
function getRequestMethodClass(method) {
|
|
1097
1193
|
return requestMethodClass[method.toLowerCase()] || requestMethodClass.default;
|
|
1098
1194
|
}
|
|
1195
|
+
//#endregion
|
|
1196
|
+
//#region src/client/components/CodeSnippets.vue?vue&type=script&setup=true&lang.ts
|
|
1099
1197
|
var _hoisted_1$6 = { class: "flex flex-col" };
|
|
1100
1198
|
var _hoisted_2$6 = { class: "flex-1 overflow-auto relative" };
|
|
1101
1199
|
var _hoisted_3$4 = { class: "absolute top-0 right-0 z-10" };
|
|
1102
1200
|
var _hoisted_4$2 = ["innerHTML"];
|
|
1201
|
+
//#endregion
|
|
1202
|
+
//#region src/client/components/CodeSnippets.vue
|
|
1103
1203
|
var CodeSnippets_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
1104
1204
|
__name: "CodeSnippets",
|
|
1105
1205
|
props: { codeSnippets: {} },
|
|
@@ -1158,9 +1258,13 @@ var CodeSnippets_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/*
|
|
|
1158
1258
|
};
|
|
1159
1259
|
}
|
|
1160
1260
|
}), [["__scopeId", "data-v-1703382f"]]);
|
|
1261
|
+
//#endregion
|
|
1262
|
+
//#region src/client/@ui/Checkbox.vue?vue&type=script&setup=true&lang.ts
|
|
1161
1263
|
var _hoisted_1$5 = ["checked", "disabled"];
|
|
1162
1264
|
var _hoisted_2$5 = ["disabled"];
|
|
1163
1265
|
var _hoisted_3$3 = { class: "n-checkbox-box n-transition n-checked:n-checkbox-box-checked peer-active:n-active-base peer-focus-visible:n-focus-base" };
|
|
1266
|
+
//#endregion
|
|
1267
|
+
//#region src/client/@ui/Checkbox.vue
|
|
1164
1268
|
var Checkbox_default = /* @__PURE__ */ defineComponent({
|
|
1165
1269
|
__name: "Checkbox",
|
|
1166
1270
|
props: {
|
|
@@ -1194,6 +1298,8 @@ var Checkbox_default = /* @__PURE__ */ defineComponent({
|
|
|
1194
1298
|
};
|
|
1195
1299
|
}
|
|
1196
1300
|
});
|
|
1301
|
+
//#endregion
|
|
1302
|
+
//#region src/client/@ui/Select.vue?vue&type=script&setup=true&lang.ts
|
|
1197
1303
|
var _hoisted_1$4 = ["disabled"];
|
|
1198
1304
|
var _hoisted_2$4 = {
|
|
1199
1305
|
key: 0,
|
|
@@ -1201,6 +1307,8 @@ var _hoisted_2$4 = {
|
|
|
1201
1307
|
disabled: "",
|
|
1202
1308
|
hidden: ""
|
|
1203
1309
|
};
|
|
1310
|
+
//#endregion
|
|
1311
|
+
//#region src/client/@ui/Select.vue
|
|
1204
1312
|
var Select_default = /* @__PURE__ */ defineComponent({
|
|
1205
1313
|
__name: "Select",
|
|
1206
1314
|
props: {
|
|
@@ -1228,6 +1336,8 @@ var Select_default = /* @__PURE__ */ defineComponent({
|
|
|
1228
1336
|
};
|
|
1229
1337
|
}
|
|
1230
1338
|
});
|
|
1339
|
+
//#endregion
|
|
1340
|
+
//#region src/client/components/ServerRouteInput.vue?vue&type=script&setup=true&lang.ts
|
|
1231
1341
|
var _hoisted_1$3 = { class: "flex flex-col gap-4 p-4" };
|
|
1232
1342
|
var _hoisted_2$3 = {
|
|
1233
1343
|
key: 1,
|
|
@@ -1244,6 +1354,8 @@ var _hoisted_5$1 = {
|
|
|
1244
1354
|
flex: "",
|
|
1245
1355
|
"gap-4": ""
|
|
1246
1356
|
};
|
|
1357
|
+
//#endregion
|
|
1358
|
+
//#region src/client/components/ServerRouteInput.vue
|
|
1247
1359
|
var ServerRouteInput_default = /* @__PURE__ */ defineComponent({
|
|
1248
1360
|
__name: "ServerRouteInput",
|
|
1249
1361
|
props: {
|
|
@@ -1457,6 +1569,8 @@ var ServerRouteInput_default = /* @__PURE__ */ defineComponent({
|
|
|
1457
1569
|
};
|
|
1458
1570
|
}
|
|
1459
1571
|
});
|
|
1572
|
+
//#endregion
|
|
1573
|
+
//#region src/client/components/ServerRouteDetail.vue?vue&type=script&setup=true&lang.ts
|
|
1460
1574
|
var _hoisted_1$2 = { class: "size-full flex flex-col" };
|
|
1461
1575
|
var _hoisted_2$2 = { class: "n-bg-base flex-none p4 flex flex-col gap-2" };
|
|
1462
1576
|
var _hoisted_3$1 = { class: "flex gap-2 items-center" };
|
|
@@ -1483,6 +1597,8 @@ var _hoisted_14 = {
|
|
|
1483
1597
|
key: 6,
|
|
1484
1598
|
class: "px-4 pb-4 text-sm op50"
|
|
1485
1599
|
};
|
|
1600
|
+
//#endregion
|
|
1601
|
+
//#region src/client/components/ServerRouteDetail.vue
|
|
1486
1602
|
var ServerRouteDetail_default = /* @__PURE__ */ defineComponent({
|
|
1487
1603
|
__name: "ServerRouteDetail",
|
|
1488
1604
|
props: { route: {} },
|
|
@@ -1729,8 +1845,12 @@ var ServerRouteDetail_default = /* @__PURE__ */ defineComponent({
|
|
|
1729
1845
|
};
|
|
1730
1846
|
}
|
|
1731
1847
|
});
|
|
1848
|
+
//#endregion
|
|
1849
|
+
//#region src/client/components/ServerRouteListItem.vue?vue&type=script&setup=true&lang.ts
|
|
1732
1850
|
var _hoisted_1$1 = { class: "min-w-0" };
|
|
1733
1851
|
var _hoisted_2$1 = { class: "truncate" };
|
|
1852
|
+
//#endregion
|
|
1853
|
+
//#region src/client/components/ServerRouteListItem.vue
|
|
1734
1854
|
var ServerRouteListItem_default = /* @__PURE__ */ defineComponent({
|
|
1735
1855
|
__name: "ServerRouteListItem",
|
|
1736
1856
|
props: {
|
|
@@ -1740,6 +1860,14 @@ var ServerRouteListItem_default = /* @__PURE__ */ defineComponent({
|
|
|
1740
1860
|
},
|
|
1741
1861
|
emits: ["select"],
|
|
1742
1862
|
setup(__props, { emit: __emit }) {
|
|
1863
|
+
/**
|
|
1864
|
+
* 左侧路由树的单个条目(既可代表文件夹,也可代表具体接口)。
|
|
1865
|
+
*
|
|
1866
|
+
* 行为:
|
|
1867
|
+
* - collection(文件夹)点击后切换展开/收起。
|
|
1868
|
+
* - route(接口)点击后触发 select 事件,通知父组件更新详情面板。
|
|
1869
|
+
* - 根据 props.selected 判定是否高亮当前项。
|
|
1870
|
+
*/
|
|
1743
1871
|
const props = __props;
|
|
1744
1872
|
const emit = __emit;
|
|
1745
1873
|
const open = ref(true);
|
|
@@ -1794,6 +1922,11 @@ var ServerRouteListItem_default = /* @__PURE__ */ defineComponent({
|
|
|
1794
1922
|
};
|
|
1795
1923
|
}
|
|
1796
1924
|
});
|
|
1925
|
+
//#endregion
|
|
1926
|
+
//#region src/client/utils/api-transform.ts
|
|
1927
|
+
/**
|
|
1928
|
+
* 按源文件(controller)聚合 API,适合从“控制器”视角浏览。
|
|
1929
|
+
*/
|
|
1797
1930
|
function groupRoutesByFile(apiResult) {
|
|
1798
1931
|
const routes = [];
|
|
1799
1932
|
const fileMap = /* @__PURE__ */ new Map();
|
|
@@ -1833,6 +1966,9 @@ function groupRoutesByFile(apiResult) {
|
|
|
1833
1966
|
});
|
|
1834
1967
|
return routes;
|
|
1835
1968
|
}
|
|
1969
|
+
/**
|
|
1970
|
+
* 扁平化为路由清单,适合配合搜索/过滤使用。
|
|
1971
|
+
*/
|
|
1836
1972
|
function flattenApiToRoutes(apiResult) {
|
|
1837
1973
|
const routes = [];
|
|
1838
1974
|
apiResult.modules.forEach((module) => {
|
|
@@ -1857,6 +1993,7 @@ function flattenApiToRoutes(apiResult) {
|
|
|
1857
1993
|
});
|
|
1858
1994
|
return routes;
|
|
1859
1995
|
}
|
|
1996
|
+
/** 计算简单统计信息(模块数/API 数/类型数/按方法分布) */
|
|
1860
1997
|
function calculateApiStats(apiResult) {
|
|
1861
1998
|
const stats = {
|
|
1862
1999
|
totalModules: apiResult.modules.length,
|
|
@@ -1874,6 +2011,7 @@ function calculateApiStats(apiResult) {
|
|
|
1874
2011
|
});
|
|
1875
2012
|
return stats;
|
|
1876
2013
|
}
|
|
2014
|
+
/** 根据关键词过滤路由(支持嵌套集合) */
|
|
1877
2015
|
function filterRoutes(routes, searchText) {
|
|
1878
2016
|
if (!searchText) return routes;
|
|
1879
2017
|
const search = searchText.toLowerCase();
|
|
@@ -1889,6 +2027,9 @@ function filterRoutes(routes, searchText) {
|
|
|
1889
2027
|
return route.route.toLowerCase().includes(search) || route.method?.toLowerCase().includes(search) || route.description?.toLowerCase().includes(search) || route.name?.toLowerCase().includes(search) ? route : null;
|
|
1890
2028
|
}).filter((route) => route !== null);
|
|
1891
2029
|
}
|
|
2030
|
+
/**
|
|
2031
|
+
* 按 HTTP 方法优先级排序;集合优先于具体路由,并在同层按字典序。
|
|
2032
|
+
*/
|
|
1892
2033
|
function sortRoutesByMethod(routes) {
|
|
1893
2034
|
const methodOrder = [
|
|
1894
2035
|
"GET",
|
|
@@ -1909,16 +2050,32 @@ function sortRoutesByMethod(routes) {
|
|
|
1909
2050
|
return a.route.localeCompare(b.route);
|
|
1910
2051
|
});
|
|
1911
2052
|
}
|
|
2053
|
+
//#endregion
|
|
2054
|
+
//#region src/client/pages/server-router.vue?vue&type=script&setup=true&lang.ts
|
|
1912
2055
|
var _hoisted_1 = { class: "flex gap-1 text-sm" };
|
|
1913
2056
|
var _hoisted_2 = {
|
|
1914
2057
|
key: 0,
|
|
1915
2058
|
class: "op50"
|
|
1916
2059
|
};
|
|
1917
2060
|
var _hoisted_3 = { class: "op50" };
|
|
2061
|
+
//#endregion
|
|
2062
|
+
//#region src/client/pages/server-router.vue
|
|
1918
2063
|
var server_router_default = /* @__PURE__ */ defineComponent({
|
|
1919
2064
|
name: "ServerRouterPage",
|
|
1920
2065
|
__name: "server-router",
|
|
1921
2066
|
setup(__props) {
|
|
2067
|
+
/**
|
|
2068
|
+
* Server Router 页面
|
|
2069
|
+
*
|
|
2070
|
+
* 展示并调试通过 devtools 扫描得到的后端 API:
|
|
2071
|
+
* - 左侧:路由树/列表(可按文件分组或扁平化展示,支持搜索与统计)。
|
|
2072
|
+
* - 右侧:选中路由的详情与调试面板(参数输入、发送请求、查看响应)。
|
|
2073
|
+
* - 顶部:切换视图、打开“默认值”抽屉,对常用参数进行预置。
|
|
2074
|
+
*
|
|
2075
|
+
* 依赖:
|
|
2076
|
+
* - `apiListFetch` 负责向 `__pubinfo_devtools_api/api-list` 拉取 API 元数据。
|
|
2077
|
+
* - 一系列 utils/composables 用于转换、分组、排序与统计。
|
|
2078
|
+
*/
|
|
1922
2079
|
const search = ref("");
|
|
1923
2080
|
const isGrouped = ref(true);
|
|
1924
2081
|
const inputDefaultsDrawer = ref(false);
|
|
@@ -1930,6 +2087,7 @@ var server_router_default = /* @__PURE__ */ defineComponent({
|
|
|
1930
2087
|
"body",
|
|
1931
2088
|
"headers"
|
|
1932
2089
|
];
|
|
2090
|
+
/** 首字母大写,用于标签标题显示 */
|
|
1933
2091
|
function toTitle(s) {
|
|
1934
2092
|
return s ? s.charAt(0).toUpperCase() + s.slice(1) : s;
|
|
1935
2093
|
}
|
|
@@ -2046,4 +2204,5 @@ var server_router_default = /* @__PURE__ */ defineComponent({
|
|
|
2046
2204
|
};
|
|
2047
2205
|
}
|
|
2048
2206
|
});
|
|
2207
|
+
//#endregion
|
|
2049
2208
|
export { server_router_default as default };
|