@vitejs/devtools 0.1.3 → 0.1.4
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/{DockIcon-BtMEW4VE.js → DockIcon-DNt-Vqy4.js} +29 -29
- package/dist/{ToastOverlay-DdeglpI8.js → DockStandalone-CL8hrIeb.js} +449 -267
- package/dist/{LogItem-BTrEubKY.js → LogItem-CZM2G41b.js} +9 -7
- package/dist/{ViewBuiltinLogs-BL373XPJ.js → ViewBuiltinLogs-1ABRTwzd.js} +5 -5
- package/dist/{ViewBuiltinTerminals-DdpE1Ftb.js → ViewBuiltinTerminals-Co7G-321.js} +6 -6
- package/dist/{ViewJsonRender-coidkW9b.js → ViewJsonRender-ByPfpKFM.js} +4 -7
- package/dist/{cli-commands-BDDMPsV-.js → cli-commands-D6M9N3th.js} +2 -2
- package/dist/cli-commands.js +2 -2
- package/dist/cli.js +2 -2
- package/dist/client/inject.js +4 -3
- package/dist/client/standalone/assets/DockStandalone-C8ChyZLh.js +1 -0
- package/dist/client/standalone/assets/{LogItem-CKbVrExA.js → LogItem-Mx4UyReX.js} +1 -1
- package/dist/client/standalone/assets/{ViewBuiltinLogs-9oWDdl1G.js → ViewBuiltinLogs-C4j4vgSn.js} +1 -1
- package/dist/client/standalone/assets/{ViewBuiltinTerminals-DEFrt9ot.js → ViewBuiltinTerminals-UrMq7UXM.js} +2 -2
- package/dist/client/standalone/assets/{ViewJsonRender-CKPzRgqQ.js → ViewJsonRender-BURuu55Z.js} +1 -1
- package/dist/client/standalone/assets/{dist-JpCJ4ieR.js → dist-DIlAYcjk.js} +1 -1
- package/dist/client/standalone/assets/index-BEyoIK7m.css +1 -0
- package/dist/client/standalone/assets/index-Rpv7PwRD.js +4 -0
- package/dist/client/standalone/assets/runtime-core.esm-bundler-CJlaYmKv.js +1 -0
- package/dist/client/standalone/index.html +5 -6
- package/dist/client/webcomponents.d.ts +6 -1
- package/dist/client/webcomponents.js +297 -83
- package/dist/config.d.ts +7 -0
- package/dist/config.js +2 -1
- package/dist/context-internal-CvIHbZq4.js +74 -0
- package/dist/context-internal-Du6FuGIu.d.ts +25 -0
- package/dist/{dist-Cgqg5_oP.js → dist-D2Z6bwqJ.js} +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +1 -1
- package/dist/internal.d.ts +2 -0
- package/dist/internal.js +2 -0
- package/dist/{plugins-CsDUv5C2.js → plugins-BHefDofV.js} +230 -73
- package/dist/{popup-BZ5jBcoC.js → popup-DzgY0boj.js} +11 -3
- package/package.json +26 -24
- package/dist/DockStandalone-Ca7ix29I.js +0 -78
- package/dist/client/standalone/assets/DockStandalone-HVyKJVMX.js +0 -1
- package/dist/client/standalone/assets/iconify-C-CPDXMf.js +0 -2
- package/dist/client/standalone/assets/index-Mte4BnZO.css +0 -1
- package/dist/client/standalone/assets/index-ndsYhKrn.js +0 -3
- package/dist/client/standalone/assets/runtime-core.esm-bundler-oO31W4LZ.js +0 -1
- /package/dist/{iconify-YyqAMHKf.js → iconify-BW79QmbD.js} +0 -0
- /package/dist/{utils-Csuu5uNf.js → utils-DaaVwEUH.js} +0 -0
- /package/dist/{vue.runtime.esm-bundler-D2MZbyFr.js → vue.runtime.esm-bundler-CS1wMbap.js} +0 -0
|
@@ -1,11 +1,41 @@
|
|
|
1
|
-
import { A as renderSlot, D as openBlock, E as onUnmounted, F as withDirectives, M as watch, N as watchEffect, P as withCtx, T as onMounted, U as ref, V as reactive, X as normalizeClass, Y as unref, Z as normalizeStyle, b as h, d as createBlock, f as createCommentVNode, g as createVNode, i as vShow, j as useTemplateRef, l as computed, n as defineCustomElement, o as withModifiers, p as createElementBlock, q as toRefs, s as Fragment, u as createBaseVNode, v as defineComponent, z as markRaw } from "../vue.runtime.esm-bundler-
|
|
2
|
-
import { a as useScreenSafeArea, l as watchDebounced, n as useElementBounding, r as useEventListener, s as useWindowSize } from "../dist-
|
|
3
|
-
import {
|
|
4
|
-
import { c as
|
|
5
|
-
import "../
|
|
6
|
-
import
|
|
7
|
-
//#region src/client/webcomponents/components/
|
|
8
|
-
const _sfc_main$
|
|
1
|
+
import { A as renderSlot, D as openBlock, E as onUnmounted, F as withDirectives, M as watch, N as watchEffect, P as withCtx, Q as toDisplayString, T as onMounted, U as ref, V as reactive, X as normalizeClass, Y as unref, Z as normalizeStyle, b as h, d as createBlock, f as createCommentVNode, g as createVNode, i as vShow, j as useTemplateRef, l as computed, n as defineCustomElement, o as withModifiers, p as createElementBlock, q as toRefs, s as Fragment, u as createBaseVNode, v as defineComponent, z as markRaw } from "../vue.runtime.esm-bundler-CS1wMbap.js";
|
|
2
|
+
import { a as useScreenSafeArea, l as watchDebounced, n as useElementBounding, r as useEventListener, s as useWindowSize } from "../dist-D2Z6bwqJ.js";
|
|
3
|
+
import { S as BUILTIN_ENTRY_CLIENT_AUTH_NOTICE, _ as sharedStateToRef, b as docksSplitGroupsWithCapacity, c as setDocksOverflowPanel, f as useDocksOverflowPanel, g as createDockEntryState, h as DEFAULT_DOCK_PANEL_STORE, l as setEdgePositionDropdown, o as useIsDockPopupOpen, p as useEdgePositionDropdown, t as closeDockPopup, u as setFloatingTooltip, v as useDocksEntries } from "../popup-DzgY0boj.js";
|
|
4
|
+
import { a as PersistedDomViewsManager, c as openDockContextMenu, d as css_default, i as PersistedDomHolder, l as _sfc_main$11, o as _sfc_main$8, r as _sfc_main$10, s as _sfc_main$9, t as DockStandalone, u as _sfc_main$12 } from "../DockStandalone-CL8hrIeb.js";
|
|
5
|
+
import { n as VitePlusCore_default, r as export_helper_default } from "../DockIcon-DNt-Vqy4.js";
|
|
6
|
+
import "../iconify-BW79QmbD.js";
|
|
7
|
+
//#region src/client/webcomponents/components/icons/BracketLeft.vue
|
|
8
|
+
const _sfc_main$7 = {};
|
|
9
|
+
const _hoisted_1$3 = {
|
|
10
|
+
viewBox: "0 0 9 20",
|
|
11
|
+
fill: "none",
|
|
12
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
13
|
+
};
|
|
14
|
+
function _sfc_render$1(_ctx, _cache) {
|
|
15
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$3, [..._cache[0] || (_cache[0] = [createBaseVNode("path", {
|
|
16
|
+
d: "M4.95763 0C1.02563 5.628 1.00263 14.351 4.95763 20H7.61363C3.65963 14.35 3.68363 5.627 7.61363 0H4.95763Z",
|
|
17
|
+
class: "fill-black dark:fill-white"
|
|
18
|
+
}, null, -1)])]);
|
|
19
|
+
}
|
|
20
|
+
var BracketLeft_default = /* @__PURE__ */ export_helper_default(_sfc_main$7, [["render", _sfc_render$1]]);
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/client/webcomponents/components/icons/BracketRight.vue
|
|
23
|
+
const _sfc_main$6 = {};
|
|
24
|
+
const _hoisted_1$2 = {
|
|
25
|
+
viewBox: "0 0 9 20",
|
|
26
|
+
fill: "none",
|
|
27
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
28
|
+
};
|
|
29
|
+
function _sfc_render(_ctx, _cache) {
|
|
30
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$2, [..._cache[0] || (_cache[0] = [createBaseVNode("path", {
|
|
31
|
+
d: "M4.246 10H6.903C6.902 6.407 5.913 2.816 3.946 0H1.29C3.256 2.816 4.244 6.407 4.246 10ZM8.935 14.907H6.27C6.46624 14.1665 6.61752 13.4148 6.723 12.656H4.066C3.96052 13.4148 3.80924 14.1665 3.613 14.907H0.944C0.703507 15.8176 0.387753 16.7067 0 17.565H2.669C2.2859 18.4179 1.82388 19.2331 1.289 20H3.945C4.47988 19.2331 4.9419 18.4179 5.325 17.565H7.99C8.376 16.714 8.691 15.823 8.935 14.907Z",
|
|
32
|
+
class: "fill-black dark:fill-white"
|
|
33
|
+
}, null, -1)])]);
|
|
34
|
+
}
|
|
35
|
+
var BracketRight_default = /* @__PURE__ */ export_helper_default(_sfc_main$6, [["render", _sfc_render]]);
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region src/client/webcomponents/components/dock/DockOverflowButton.vue
|
|
38
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
9
39
|
__name: "DockOverflowButton",
|
|
10
40
|
props: {
|
|
11
41
|
context: {},
|
|
@@ -29,7 +59,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
29
59
|
if (!overflowButton.value) return;
|
|
30
60
|
isOverflowPanelVisible.value = true;
|
|
31
61
|
setDocksOverflowPanel({
|
|
32
|
-
content: () => h("div", { class: "flex gap-0 flex-wrap max-w-220px" }, [h(_sfc_main$
|
|
62
|
+
content: () => h("div", { class: "flex gap-0 flex-wrap max-w-220px" }, [h(_sfc_main$8, {
|
|
33
63
|
context: props.context,
|
|
34
64
|
groups: props.groups,
|
|
35
65
|
isVertical: false,
|
|
@@ -54,7 +84,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
54
84
|
return openBlock(), createElementBlock("div", {
|
|
55
85
|
ref_key: "overflowButton",
|
|
56
86
|
ref: overflowButton
|
|
57
|
-
}, [createVNode(_sfc_main$
|
|
87
|
+
}, [createVNode(_sfc_main$9, {
|
|
58
88
|
context: __props.context,
|
|
59
89
|
dock: {
|
|
60
90
|
id: "overflow",
|
|
@@ -77,45 +107,15 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
77
107
|
}
|
|
78
108
|
});
|
|
79
109
|
//#endregion
|
|
80
|
-
//#region src/client/webcomponents/components/
|
|
81
|
-
const _sfc_main$5 = {};
|
|
82
|
-
const _hoisted_1$2 = {
|
|
83
|
-
viewBox: "0 0 9 20",
|
|
84
|
-
fill: "none",
|
|
85
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
86
|
-
};
|
|
87
|
-
function _sfc_render$1(_ctx, _cache) {
|
|
88
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$2, [..._cache[0] || (_cache[0] = [createBaseVNode("path", {
|
|
89
|
-
d: "M4.95763 0C1.02563 5.628 1.00263 14.351 4.95763 20H7.61363C3.65963 14.35 3.68363 5.627 7.61363 0H4.95763Z",
|
|
90
|
-
class: "fill-black dark:fill-white"
|
|
91
|
-
}, null, -1)])]);
|
|
92
|
-
}
|
|
93
|
-
var BracketLeft_default = /* @__PURE__ */ export_helper_default(_sfc_main$5, [["render", _sfc_render$1]]);
|
|
94
|
-
//#endregion
|
|
95
|
-
//#region src/client/webcomponents/components/icons/BracketRight.vue
|
|
96
|
-
const _sfc_main$4 = {};
|
|
110
|
+
//#region src/client/webcomponents/components/dock/Dock.vue
|
|
97
111
|
const _hoisted_1$1 = {
|
|
98
|
-
viewBox: "0 0 9 20",
|
|
99
|
-
fill: "none",
|
|
100
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
101
|
-
};
|
|
102
|
-
function _sfc_render(_ctx, _cache) {
|
|
103
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$1, [..._cache[0] || (_cache[0] = [createBaseVNode("path", {
|
|
104
|
-
d: "M4.246 10H6.903C6.902 6.407 5.913 2.816 3.946 0H1.29C3.256 2.816 4.244 6.407 4.246 10ZM8.935 14.907H6.27C6.46624 14.1665 6.61752 13.4148 6.723 12.656H4.066C3.96052 13.4148 3.80924 14.1665 3.613 14.907H0.944C0.703507 15.8176 0.387753 16.7067 0 17.565H2.669C2.2859 18.4179 1.82388 19.2331 1.289 20H3.945C4.47988 19.2331 4.9419 18.4179 5.325 17.565H7.99C8.376 16.714 8.691 15.823 8.935 14.907Z",
|
|
105
|
-
class: "fill-black dark:fill-white"
|
|
106
|
-
}, null, -1)])]);
|
|
107
|
-
}
|
|
108
|
-
var BracketRight_default = /* @__PURE__ */ export_helper_default(_sfc_main$4, [["render", _sfc_render]]);
|
|
109
|
-
//#endregion
|
|
110
|
-
//#region src/client/webcomponents/components/Dock.vue
|
|
111
|
-
const _hoisted_1 = {
|
|
112
112
|
key: 0,
|
|
113
113
|
class: "i-fluent-emoji-flat-warning absolute bottom-0 right--1px w-1.5 h-1.5"
|
|
114
114
|
};
|
|
115
|
-
const _hoisted_2 = { class: "flex items-center gap-1" };
|
|
115
|
+
const _hoisted_2$1 = { class: "flex items-center gap-1" };
|
|
116
116
|
const PANEL_MARGIN = 2;
|
|
117
117
|
const SNAP_THRESHOLD = 2;
|
|
118
|
-
const _sfc_main$
|
|
118
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
119
119
|
__name: "Dock",
|
|
120
120
|
props: { context: {} },
|
|
121
121
|
setup(__props) {
|
|
@@ -166,6 +166,10 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
166
166
|
context.rpc.events.on("rpc:is-trusted:updated", (isTrusted) => {
|
|
167
167
|
isRpcTrusted.value = isTrusted;
|
|
168
168
|
if (isTrusted && context.docks.selected?.id === BUILTIN_ENTRY_CLIENT_AUTH_NOTICE.id) context.docks.switchEntry(null);
|
|
169
|
+
else if (!isTrusted) {
|
|
170
|
+
context.docks.switchEntry(null);
|
|
171
|
+
context.panel.store.open = false;
|
|
172
|
+
}
|
|
169
173
|
});
|
|
170
174
|
const groupedEntries = computed(() => context.docks.groupedEntries);
|
|
171
175
|
const splitEntries = computed(() => {
|
|
@@ -315,15 +319,15 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
315
319
|
}, [
|
|
316
320
|
createVNode(BracketLeft_default, { class: "vite-devtools-dock-bracket absolute left--1 top-1/2 translate-y--1/2 bottom-0 w-2.5 op75 transition-opacity duration-300" }),
|
|
317
321
|
createVNode(BracketRight_default, { class: normalizeClass(["vite-devtools-dock-bracket absolute right--1 top-1/2 translate-y--1/2 bottom-0 w-2.5 op75 transition-opacity duration-300", unref(context).panel.isVertical ? "scale-y--100" : ""]) }, null, 8, ["class"]),
|
|
318
|
-
createBaseVNode("div", { class: normalizeClass(["w-3 h-3 absolute left-1/2 top-1/2 translate-x--1/2 translate-y--1/2 transition-opacity duration-300", [isMinimized.value ? "op100" : "op0", unref(context).panel.isVertical ? "rotate-270" : "rotate-0"]]) }, [createVNode(VitePlusCore_default), !isRpcTrusted.value ? (openBlock(), createElementBlock("div", _hoisted_1)) : createCommentVNode("v-if", true)], 2),
|
|
322
|
+
createBaseVNode("div", { class: normalizeClass(["w-3 h-3 absolute left-1/2 top-1/2 translate-x--1/2 translate-y--1/2 transition-opacity duration-300", [isMinimized.value ? "op100" : "op0", unref(context).panel.isVertical ? "rotate-270" : "rotate-0"]]) }, [createVNode(VitePlusCore_default), !isRpcTrusted.value ? (openBlock(), createElementBlock("div", _hoisted_1$1)) : createCommentVNode("v-if", true)], 2),
|
|
319
323
|
!isRpcTrusted.value ? (openBlock(), createElementBlock("div", {
|
|
320
324
|
key: 0,
|
|
321
325
|
class: normalizeClass(["transition duration-300 delay-200", isMinimized.value ? "opacity-0 pointer-events-none ws-nowrap text-sm text-orange of-hidden" : "opacity-100"])
|
|
322
326
|
}, [createBaseVNode("button", {
|
|
323
327
|
class: "p2 transition hover:bg-active rounded-full px4",
|
|
324
328
|
onClick: _cache[0] || (_cache[0] = ($event) => unref(context).docks.toggleEntry(unref(BUILTIN_ENTRY_CLIENT_AUTH_NOTICE).id))
|
|
325
|
-
}, [createBaseVNode("div", _hoisted_2, [createBaseVNode("div", { class: normalizeClass(["i-fluent-emoji-flat-warning flex-none", unref(context).panel.isVertical ? "rotate-270" : "rotate-0"]) }, null, 2), _cache[3] || (_cache[3] = createBaseVNode("div", { class: "ws-nowrap text-amber" }, " Unauthorized ", -1))])])], 2)) : createCommentVNode("v-if", true),
|
|
326
|
-
createBaseVNode("div", { class: normalizeClass([isMinimized.value ? "opacity-0 pointer-events-none" : "opacity-100", "transition duration-200 flex items-center w-full h-full justify-center px3"]) }, [createVNode(_sfc_main$
|
|
329
|
+
}, [createBaseVNode("div", _hoisted_2$1, [createBaseVNode("div", { class: normalizeClass(["i-fluent-emoji-flat-warning flex-none", unref(context).panel.isVertical ? "rotate-270" : "rotate-0"]) }, null, 2), _cache[3] || (_cache[3] = createBaseVNode("div", { class: "ws-nowrap text-amber" }, " Unauthorized ", -1))])])], 2)) : createCommentVNode("v-if", true),
|
|
330
|
+
createBaseVNode("div", { class: normalizeClass([isMinimized.value ? "opacity-0 pointer-events-none" : "opacity-100", "transition duration-200 flex items-center w-full h-full justify-center px3"]) }, [createVNode(_sfc_main$8, {
|
|
327
331
|
context: unref(context),
|
|
328
332
|
groups: splitEntries.value.visible,
|
|
329
333
|
"is-vertical": unref(context).panel.isVertical,
|
|
@@ -334,7 +338,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
334
338
|
"groups",
|
|
335
339
|
"is-vertical",
|
|
336
340
|
"selected"
|
|
337
|
-
]), splitEntries.value.overflow.length > 0 ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [_cache[4] || (_cache[4] = createBaseVNode("div", { class: "border-base m1 h-20px w-px border-r-1.5" }, null, -1)), createVNode(_sfc_main$
|
|
341
|
+
]), splitEntries.value.overflow.length > 0 ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [_cache[4] || (_cache[4] = createBaseVNode("div", { class: "border-base m1 h-20px w-px border-r-1.5" }, null, -1)), createVNode(_sfc_main$5, {
|
|
338
342
|
context: unref(context),
|
|
339
343
|
"is-vertical": unref(context).panel.isVertical,
|
|
340
344
|
groups: splitEntries.value.overflow,
|
|
@@ -352,12 +356,18 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
352
356
|
}
|
|
353
357
|
});
|
|
354
358
|
//#endregion
|
|
355
|
-
//#region src/client/webcomponents/components/DockPanelResizer.vue
|
|
359
|
+
//#region src/client/webcomponents/components/dock/DockPanelResizer.vue
|
|
356
360
|
const PANEL_MIN = 20;
|
|
357
361
|
const PANEL_MAX = 100;
|
|
358
|
-
const _sfc_main$
|
|
362
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
359
363
|
__name: "DockPanelResizer",
|
|
360
|
-
props: {
|
|
364
|
+
props: {
|
|
365
|
+
panel: {},
|
|
366
|
+
edgeMode: {
|
|
367
|
+
type: Boolean,
|
|
368
|
+
default: false
|
|
369
|
+
}
|
|
370
|
+
},
|
|
361
371
|
setup(__props) {
|
|
362
372
|
const props = __props;
|
|
363
373
|
const topHandle = useTemplateRef("topHandle");
|
|
@@ -402,25 +412,25 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
402
412
|
style: { top: 0 },
|
|
403
413
|
onMousedown: _cache[0] || (_cache[0] = withModifiers(($event) => resizingState.value = { top: true }, ["prevent"])),
|
|
404
414
|
onTouchstartPassive: _cache[1] || (_cache[1] = () => resizingState.value = { top: true })
|
|
405
|
-
}, null, 544), [[vShow, __props.panel.store.position !== "top"]]),
|
|
415
|
+
}, null, 544), [[vShow, __props.edgeMode ? __props.panel.store.position === "bottom" : __props.panel.store.position !== "top"]]),
|
|
406
416
|
withDirectives(createBaseVNode("div", {
|
|
407
417
|
class: "vite-devtools-resize-handle vite-devtools-resize-handle-horizontal",
|
|
408
418
|
style: { bottom: 0 },
|
|
409
419
|
onMousedown: _cache[2] || (_cache[2] = withModifiers(() => resizingState.value = { bottom: true }, ["prevent"])),
|
|
410
420
|
onTouchstartPassive: _cache[3] || (_cache[3] = () => resizingState.value = { bottom: true })
|
|
411
|
-
}, null, 544), [[vShow, __props.panel.store.position !== "bottom"]]),
|
|
421
|
+
}, null, 544), [[vShow, __props.edgeMode ? __props.panel.store.position === "top" : __props.panel.store.position !== "bottom"]]),
|
|
412
422
|
withDirectives(createBaseVNode("div", {
|
|
413
423
|
class: "vite-devtools-resize-handle vite-devtools-resize-handle-vertical",
|
|
414
424
|
style: { left: 0 },
|
|
415
425
|
onMousedown: _cache[4] || (_cache[4] = withModifiers(() => resizingState.value = { left: true }, ["prevent"])),
|
|
416
426
|
onTouchstartPassive: _cache[5] || (_cache[5] = () => resizingState.value = { left: true })
|
|
417
|
-
}, null, 544), [[vShow, __props.panel.store.position !== "left"]]),
|
|
427
|
+
}, null, 544), [[vShow, __props.edgeMode ? __props.panel.store.position === "right" : __props.panel.store.position !== "left"]]),
|
|
418
428
|
withDirectives(createBaseVNode("div", {
|
|
419
429
|
class: "vite-devtools-resize-handle vite-devtools-resize-handle-vertical",
|
|
420
430
|
style: { right: 0 },
|
|
421
431
|
onMousedown: _cache[6] || (_cache[6] = withModifiers(() => resizingState.value = { right: true }, ["prevent"])),
|
|
422
432
|
onTouchstartPassive: _cache[7] || (_cache[7] = () => resizingState.value = { right: true })
|
|
423
|
-
}, null, 544), [[vShow, __props.panel.store.position !== "right"]]),
|
|
433
|
+
}, null, 544), [[vShow, __props.edgeMode ? __props.panel.store.position === "left" : __props.panel.store.position !== "right"]]),
|
|
424
434
|
withDirectives(createBaseVNode("div", {
|
|
425
435
|
class: "vite-devtools-resize-handle vite-devtools-resize-handle-corner",
|
|
426
436
|
style: {
|
|
@@ -436,7 +446,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
436
446
|
top: true,
|
|
437
447
|
left: true
|
|
438
448
|
})
|
|
439
|
-
}, null, 544), [[vShow, __props.panel.store.position !== "top" && __props.panel.store.position !== "left"]]),
|
|
449
|
+
}, null, 544), [[vShow, !__props.edgeMode && __props.panel.store.position !== "top" && __props.panel.store.position !== "left"]]),
|
|
440
450
|
withDirectives(createBaseVNode("div", {
|
|
441
451
|
class: "vite-devtools-resize-handle vite-devtools-resize-handle-corner",
|
|
442
452
|
style: {
|
|
@@ -452,7 +462,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
452
462
|
top: true,
|
|
453
463
|
right: true
|
|
454
464
|
})
|
|
455
|
-
}, null, 544), [[vShow, __props.panel.store.position !== "top" && __props.panel.store.position !== "right"]]),
|
|
465
|
+
}, null, 544), [[vShow, !__props.edgeMode && __props.panel.store.position !== "top" && __props.panel.store.position !== "right"]]),
|
|
456
466
|
withDirectives(createBaseVNode("div", {
|
|
457
467
|
class: "vite-devtools-resize-handle vite-devtools-resize-handle-corner",
|
|
458
468
|
style: {
|
|
@@ -468,7 +478,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
468
478
|
bottom: true,
|
|
469
479
|
left: true
|
|
470
480
|
})
|
|
471
|
-
}, null, 544), [[vShow, __props.panel.store.position !== "bottom" && __props.panel.store.position !== "left"]]),
|
|
481
|
+
}, null, 544), [[vShow, !__props.edgeMode && __props.panel.store.position !== "bottom" && __props.panel.store.position !== "left"]]),
|
|
472
482
|
withDirectives(createBaseVNode("div", {
|
|
473
483
|
class: "vite-devtools-resize-handle vite-devtools-resize-handle-corner",
|
|
474
484
|
style: {
|
|
@@ -484,13 +494,214 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
484
494
|
bottom: true,
|
|
485
495
|
right: true
|
|
486
496
|
})
|
|
487
|
-
}, null, 544), [[vShow, __props.panel.store.position !== "bottom" && __props.panel.store.position !== "right"]])
|
|
497
|
+
}, null, 544), [[vShow, !__props.edgeMode && __props.panel.store.position !== "bottom" && __props.panel.store.position !== "right"]])
|
|
488
498
|
], 64);
|
|
489
499
|
};
|
|
490
500
|
}
|
|
491
501
|
});
|
|
492
502
|
//#endregion
|
|
493
|
-
//#region src/client/webcomponents/components/
|
|
503
|
+
//#region src/client/webcomponents/components/dock/DockEdge.vue
|
|
504
|
+
const _hoisted_1 = {
|
|
505
|
+
key: 1,
|
|
506
|
+
class: "absolute inset-0 flex items-center justify-center op40 select-none"
|
|
507
|
+
};
|
|
508
|
+
const _hoisted_2 = { class: "flex flex-col items-center gap-2" };
|
|
509
|
+
const _hoisted_3 = { class: "text-sm" };
|
|
510
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
511
|
+
__name: "DockEdge",
|
|
512
|
+
props: { context: {} },
|
|
513
|
+
setup(__props) {
|
|
514
|
+
const context = __props.context;
|
|
515
|
+
const store = context.panel.store;
|
|
516
|
+
const viewsContainer = useTemplateRef("viewsContainer");
|
|
517
|
+
const persistedDoms = markRaw(new PersistedDomViewsManager(viewsContainer));
|
|
518
|
+
const isVertical = computed(() => store.position === "left" || store.position === "right");
|
|
519
|
+
const groupedEntries = computed(() => context.docks.groupedEntries);
|
|
520
|
+
const selectedEntry = computed(() => context.docks.selected);
|
|
521
|
+
const positions = [
|
|
522
|
+
"top",
|
|
523
|
+
"right",
|
|
524
|
+
"bottom",
|
|
525
|
+
"left"
|
|
526
|
+
];
|
|
527
|
+
const positionIcons = {
|
|
528
|
+
top: "i-ph-square-half-bottom-duotone rotate-180",
|
|
529
|
+
right: "i-ph-square-half-bottom-duotone rotate-270",
|
|
530
|
+
bottom: "i-ph-square-half-bottom-duotone",
|
|
531
|
+
left: "i-ph-square-half-bottom-duotone rotate-90"
|
|
532
|
+
};
|
|
533
|
+
const positionLabels = {
|
|
534
|
+
top: "Top",
|
|
535
|
+
right: "Right",
|
|
536
|
+
bottom: "Bottom",
|
|
537
|
+
left: "Left"
|
|
538
|
+
};
|
|
539
|
+
function switchPosition(pos) {
|
|
540
|
+
store.position = pos;
|
|
541
|
+
setEdgePositionDropdown(null);
|
|
542
|
+
}
|
|
543
|
+
const positionButton = useTemplateRef("positionButton");
|
|
544
|
+
const floatButton = useTemplateRef("floatButton");
|
|
545
|
+
const edgePositionDropdown = useEdgePositionDropdown();
|
|
546
|
+
function showTooltip(el, text) {
|
|
547
|
+
if (!el) return;
|
|
548
|
+
setFloatingTooltip({
|
|
549
|
+
content: text,
|
|
550
|
+
el
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
function hideTooltip() {
|
|
554
|
+
setFloatingTooltip(null);
|
|
555
|
+
}
|
|
556
|
+
function togglePositionDropdown() {
|
|
557
|
+
if (!positionButton.value) return;
|
|
558
|
+
if (edgePositionDropdown.value) {
|
|
559
|
+
setEdgePositionDropdown(null);
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
setEdgePositionDropdown({
|
|
563
|
+
el: positionButton.value,
|
|
564
|
+
gap: 6,
|
|
565
|
+
content: () => h("div", { class: "flex flex-col gap-0.5 min-w-28" }, positions.map((pos) => h("button", {
|
|
566
|
+
class: ["flex items-center gap-2 w-full px2 py1 rounded hover:bg-active transition text-sm", store.position === pos ? "text-primary bg-active" : "op75 hover:op100"],
|
|
567
|
+
onClick: () => switchPosition(pos)
|
|
568
|
+
}, [h("div", { class: `${positionIcons[pos]} w-4.5 h-4.5` }), h("span", positionLabels[pos])])))
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
function switchToFloat() {
|
|
572
|
+
switch (store.position) {
|
|
573
|
+
case "bottom":
|
|
574
|
+
store.left = 50;
|
|
575
|
+
store.top = 100;
|
|
576
|
+
break;
|
|
577
|
+
case "top":
|
|
578
|
+
store.left = 50;
|
|
579
|
+
store.top = 0;
|
|
580
|
+
break;
|
|
581
|
+
case "left":
|
|
582
|
+
store.left = 0;
|
|
583
|
+
store.top = 50;
|
|
584
|
+
break;
|
|
585
|
+
case "right":
|
|
586
|
+
store.left = 100;
|
|
587
|
+
store.top = 50;
|
|
588
|
+
break;
|
|
589
|
+
}
|
|
590
|
+
store.mode = "float";
|
|
591
|
+
}
|
|
592
|
+
const panelStyle = computed(() => {
|
|
593
|
+
const style = {
|
|
594
|
+
position: "fixed",
|
|
595
|
+
pointerEvents: context.panel.isResizing ? "none" : "auto"
|
|
596
|
+
};
|
|
597
|
+
switch (store.position) {
|
|
598
|
+
case "bottom":
|
|
599
|
+
style.left = "0";
|
|
600
|
+
style.right = "0";
|
|
601
|
+
style.bottom = "0";
|
|
602
|
+
style.height = `${store.height}vh`;
|
|
603
|
+
style.minHeight = "150px";
|
|
604
|
+
style.borderRadius = "8px 8px 0 0";
|
|
605
|
+
break;
|
|
606
|
+
case "top":
|
|
607
|
+
style.left = "0";
|
|
608
|
+
style.right = "0";
|
|
609
|
+
style.top = "0";
|
|
610
|
+
style.height = `${store.height}vh`;
|
|
611
|
+
style.minHeight = "150px";
|
|
612
|
+
style.borderRadius = "0 0 8px 8px";
|
|
613
|
+
break;
|
|
614
|
+
case "left":
|
|
615
|
+
style.top = "0";
|
|
616
|
+
style.bottom = "0";
|
|
617
|
+
style.left = "0";
|
|
618
|
+
style.width = `${store.width}vw`;
|
|
619
|
+
style.minWidth = "200px";
|
|
620
|
+
style.borderRadius = "0 8px 8px 0";
|
|
621
|
+
break;
|
|
622
|
+
case "right":
|
|
623
|
+
style.top = "0";
|
|
624
|
+
style.bottom = "0";
|
|
625
|
+
style.right = "0";
|
|
626
|
+
style.width = `${store.width}vw`;
|
|
627
|
+
style.minWidth = "200px";
|
|
628
|
+
style.borderRadius = "8px 0 0 8px";
|
|
629
|
+
break;
|
|
630
|
+
}
|
|
631
|
+
return style;
|
|
632
|
+
});
|
|
633
|
+
const toolbarClass = computed(() => {
|
|
634
|
+
return isVertical.value ? "flex-col h-full w-[40px] border-r border-base" : "flex-row w-full border-b border-base";
|
|
635
|
+
});
|
|
636
|
+
const contentClass = computed(() => {
|
|
637
|
+
return isVertical.value ? "flex-1 h-full overflow-hidden" : "flex-1 w-full overflow-hidden";
|
|
638
|
+
});
|
|
639
|
+
return (_ctx, _cache) => {
|
|
640
|
+
return openBlock(), createElementBlock("div", {
|
|
641
|
+
id: "vite-devtools-edge-panel",
|
|
642
|
+
class: normalizeClass(["bg-glass:75 border border-base color-base shadow overflow-hidden z-floating-anchor font-sans text-[15px] box-border", `flex ${isVertical.value ? "flex-row" : "flex-col"}`]),
|
|
643
|
+
style: normalizeStyle(panelStyle.value)
|
|
644
|
+
}, [
|
|
645
|
+
createVNode(_sfc_main$3, {
|
|
646
|
+
panel: unref(context).panel,
|
|
647
|
+
"edge-mode": ""
|
|
648
|
+
}, null, 8, ["panel"]),
|
|
649
|
+
createCommentVNode(" Toolbar "),
|
|
650
|
+
createBaseVNode("div", { class: normalizeClass(["flex items-center shrink-0 select-none py1", toolbarClass.value]) }, [
|
|
651
|
+
createBaseVNode("div", { class: normalizeClass(["flex items-center flex-1 flex-wrap gap-0.5 px1", isVertical.value ? "flex-col py1" : "flex-row px1"]) }, [createVNode(_sfc_main$8, {
|
|
652
|
+
context: unref(context),
|
|
653
|
+
groups: groupedEntries.value,
|
|
654
|
+
"is-vertical": isVertical.value,
|
|
655
|
+
rotate: false,
|
|
656
|
+
selected: selectedEntry.value,
|
|
657
|
+
onSelect: _cache[0] || (_cache[0] = (e) => unref(context).docks.switchEntry(e?.id))
|
|
658
|
+
}, null, 8, [
|
|
659
|
+
"context",
|
|
660
|
+
"groups",
|
|
661
|
+
"is-vertical",
|
|
662
|
+
"selected"
|
|
663
|
+
])], 2),
|
|
664
|
+
createCommentVNode(" Position dropdown & float toggle "),
|
|
665
|
+
createBaseVNode("div", { class: normalizeClass(["flex items-center gap-0.5 shrink-0 px1", isVertical.value ? "flex-col py1 border-t border-base" : "flex-row px1 border-l border-base"]) }, [createBaseVNode("button", {
|
|
666
|
+
ref_key: "positionButton",
|
|
667
|
+
ref: positionButton,
|
|
668
|
+
class: "p1.5 rounded hover:bg-active transition op75 hover:op100",
|
|
669
|
+
onPointerenter: _cache[1] || (_cache[1] = ($event) => showTooltip(positionButton.value, "Edge position")),
|
|
670
|
+
onPointerleave: hideTooltip,
|
|
671
|
+
onPointerdown: hideTooltip,
|
|
672
|
+
onClick: togglePositionDropdown
|
|
673
|
+
}, [createBaseVNode("div", { class: normalizeClass([positionIcons[unref(store).position], "w-4.5 h-4.5"]) }, null, 2)], 544), createBaseVNode("button", {
|
|
674
|
+
ref_key: "floatButton",
|
|
675
|
+
ref: floatButton,
|
|
676
|
+
class: "p1.5 rounded hover:bg-active transition op50 hover:op100",
|
|
677
|
+
onPointerenter: _cache[2] || (_cache[2] = ($event) => showTooltip(floatButton.value, "Float mode")),
|
|
678
|
+
onPointerleave: hideTooltip,
|
|
679
|
+
onPointerdown: hideTooltip,
|
|
680
|
+
onClick: switchToFloat
|
|
681
|
+
}, [..._cache[3] || (_cache[3] = [createBaseVNode("div", { class: "i-ph-cards-three-duotone w-4.5 h-4.5" }, null, -1)])], 544)], 2)
|
|
682
|
+
], 2),
|
|
683
|
+
createCommentVNode(" Content "),
|
|
684
|
+
createBaseVNode("div", { class: normalizeClass(["relative", contentClass.value]) }, [selectedEntry.value && selectedEntry.value.type !== "action" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [viewsContainer.value ? (openBlock(), createBlock(_sfc_main$10, {
|
|
685
|
+
key: selectedEntry.value.id,
|
|
686
|
+
context: unref(context),
|
|
687
|
+
entry: selectedEntry.value,
|
|
688
|
+
"persisted-doms": unref(persistedDoms)
|
|
689
|
+
}, null, 8, [
|
|
690
|
+
"context",
|
|
691
|
+
"entry",
|
|
692
|
+
"persisted-doms"
|
|
693
|
+
])) : createCommentVNode("v-if", true)], 64)) : (openBlock(), createElementBlock("div", _hoisted_1, [createBaseVNode("div", _hoisted_2, [_cache[4] || (_cache[4] = createBaseVNode("div", { class: "i-ph-layout-duotone w-8 h-8" }, null, -1)), createBaseVNode("span", _hoisted_3, toDisplayString(selectedEntry.value ? "Action executed" : "Select a dock entry"), 1)])])), createBaseVNode("div", {
|
|
694
|
+
id: "vite-devtools-views-container",
|
|
695
|
+
ref_key: "viewsContainer",
|
|
696
|
+
ref: viewsContainer,
|
|
697
|
+
class: "absolute inset-0 pointer-events-none"
|
|
698
|
+
}, null, 512)], 2)
|
|
699
|
+
], 6);
|
|
700
|
+
};
|
|
701
|
+
}
|
|
702
|
+
});
|
|
703
|
+
//#endregion
|
|
704
|
+
//#region src/client/webcomponents/components/dock/DockPanel.vue
|
|
494
705
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
495
706
|
__name: "DockPanel",
|
|
496
707
|
props: {
|
|
@@ -631,8 +842,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
631
842
|
style: normalizeStyle(panelStyle.value),
|
|
632
843
|
onContextmenu: openContextMenu
|
|
633
844
|
}, [
|
|
634
|
-
createVNode(_sfc_main$
|
|
635
|
-
unref(selected) && viewsContainer.value ? (openBlock(), createBlock(_sfc_main$
|
|
845
|
+
createVNode(_sfc_main$3, { panel: unref(context).panel }, null, 8, ["panel"]),
|
|
846
|
+
unref(selected) && viewsContainer.value ? (openBlock(), createBlock(_sfc_main$10, {
|
|
636
847
|
key: unref(selected).id,
|
|
637
848
|
context: unref(context),
|
|
638
849
|
entry: unref(selected),
|
|
@@ -665,6 +876,10 @@ const DockEmbedded = defineCustomElement(/* @__PURE__ */ defineComponent({
|
|
|
665
876
|
const props = __props;
|
|
666
877
|
const isDockPopupOpen = useIsDockPopupOpen();
|
|
667
878
|
const settings = sharedStateToRef(props.context.docks.settings);
|
|
879
|
+
const isRpcTrusted = ref(props.context.rpc.isTrusted);
|
|
880
|
+
props.context.rpc.events.on("rpc:is-trusted:updated", (isTrusted) => {
|
|
881
|
+
isRpcTrusted.value = isTrusted;
|
|
882
|
+
});
|
|
668
883
|
useEventListener(window, "mousedown", (e) => {
|
|
669
884
|
if (!settings.value.closeOnOutsideClick) return;
|
|
670
885
|
if (isDockPopupOpen.value) return;
|
|
@@ -678,27 +893,26 @@ const DockEmbedded = defineCustomElement(/* @__PURE__ */ defineComponent({
|
|
|
678
893
|
closeDockPopup();
|
|
679
894
|
});
|
|
680
895
|
return (_ctx, _cache) => {
|
|
681
|
-
return openBlock(), createElementBlock(Fragment, null, [
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
], 64);
|
|
896
|
+
return openBlock(), createElementBlock(Fragment, null, [!unref(isDockPopupOpen) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [isRpcTrusted.value && __props.context.panel.store.mode === "edge" ? (openBlock(), createBlock(_sfc_main$2, {
|
|
897
|
+
key: 0,
|
|
898
|
+
context: __props.context
|
|
899
|
+
}, null, 8, ["context"])) : (openBlock(), createBlock(_sfc_main$4, {
|
|
900
|
+
key: 1,
|
|
901
|
+
context: __props.context
|
|
902
|
+
}, {
|
|
903
|
+
default: withCtx(({ dockEl, panelMargins, selected }) => [createVNode(_sfc_main$1, {
|
|
904
|
+
context: __props.context,
|
|
905
|
+
selected,
|
|
906
|
+
"dock-el": dockEl,
|
|
907
|
+
"panel-margins": panelMargins
|
|
908
|
+
}, null, 8, [
|
|
909
|
+
"context",
|
|
910
|
+
"selected",
|
|
911
|
+
"dock-el",
|
|
912
|
+
"panel-margins"
|
|
913
|
+
])]),
|
|
914
|
+
_: 1
|
|
915
|
+
}, 8, ["context"])), createVNode(_sfc_main$11)], 64)) : createCommentVNode("v-if", true), createVNode(_sfc_main$12, { context: __props.context }, null, 8, ["context"])], 64);
|
|
702
916
|
};
|
|
703
917
|
}
|
|
704
918
|
}), {
|
|
@@ -707,4 +921,4 @@ const DockEmbedded = defineCustomElement(/* @__PURE__ */ defineComponent({
|
|
|
707
921
|
});
|
|
708
922
|
customElements.define("vite-devtools-dock-embedded", DockEmbedded);
|
|
709
923
|
//#endregion
|
|
710
|
-
export { DEFAULT_DOCK_PANEL_STORE, DockEmbedded, PersistedDomHolder, PersistedDomViewsManager, createDockEntryState, sharedStateToRef, useDocksEntries };
|
|
924
|
+
export { DEFAULT_DOCK_PANEL_STORE, DockEmbedded, DockStandalone, PersistedDomHolder, PersistedDomViewsManager, createDockEntryState, sharedStateToRef, useDocksEntries };
|
package/dist/config.d.ts
CHANGED
|
@@ -13,6 +13,13 @@ interface DevToolsConfig extends Partial<StartOptions> {
|
|
|
13
13
|
* @default true
|
|
14
14
|
*/
|
|
15
15
|
clientAuth?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Pre-configured auth tokens that are automatically trusted.
|
|
18
|
+
*
|
|
19
|
+
* Clients connecting with an auth token matching one of these
|
|
20
|
+
* will be auto-approved without a terminal prompt.
|
|
21
|
+
*/
|
|
22
|
+
clientAuthTokens?: string[];
|
|
16
23
|
}
|
|
17
24
|
interface ResolvedDevToolsConfig {
|
|
18
25
|
config: Omit<DevToolsConfig, 'enabled'> & {
|
package/dist/config.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as isObject } from "./utils-
|
|
1
|
+
import { t as isObject } from "./utils-DaaVwEUH.js";
|
|
2
2
|
//#region src/node/config.ts
|
|
3
3
|
function normalizeDevToolsConfig(config, host) {
|
|
4
4
|
return {
|
|
@@ -6,6 +6,7 @@ function normalizeDevToolsConfig(config, host) {
|
|
|
6
6
|
config: {
|
|
7
7
|
...isObject(config) ? config : {},
|
|
8
8
|
clientAuth: isObject(config) ? config.clientAuth ?? true : true,
|
|
9
|
+
clientAuthTokens: isObject(config) ? config.clientAuthTokens ?? [] : [],
|
|
9
10
|
host: isObject(config) ? config.host ?? host : host
|
|
10
11
|
}
|
|
11
12
|
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { debounce } from "perfect-debounce";
|
|
2
|
+
import { dirname, join } from "pathe";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import { createSharedState } from "@vitejs/devtools-kit/utils/shared-state";
|
|
5
|
+
import { homedir } from "node:os";
|
|
6
|
+
//#region src/node/storage.ts
|
|
7
|
+
function createStorage(options) {
|
|
8
|
+
const { mergeInitialValue = (initialValue, savedValue) => ({
|
|
9
|
+
...initialValue,
|
|
10
|
+
...savedValue
|
|
11
|
+
}), debounce: debounceTime = 100 } = options;
|
|
12
|
+
let initialValue = options.initialValue;
|
|
13
|
+
if (fs.existsSync(options.filepath)) try {
|
|
14
|
+
const savedValue = JSON.parse(fs.readFileSync(options.filepath, "utf-8"));
|
|
15
|
+
initialValue = mergeInitialValue ? mergeInitialValue(options.initialValue, savedValue) : savedValue;
|
|
16
|
+
} catch (error) {
|
|
17
|
+
console.warn(`[Vite DevTools] Failed to parse storage file: ${options.filepath}, falling back to defaults.`);
|
|
18
|
+
console.warn(error);
|
|
19
|
+
initialValue = options.initialValue;
|
|
20
|
+
}
|
|
21
|
+
const state = createSharedState({
|
|
22
|
+
initialValue,
|
|
23
|
+
enablePatches: false
|
|
24
|
+
});
|
|
25
|
+
state.on("updated", debounce((newState) => {
|
|
26
|
+
fs.mkdirSync(dirname(options.filepath), { recursive: true });
|
|
27
|
+
fs.writeFileSync(options.filepath, `${JSON.stringify(newState, null, 2)}\n`);
|
|
28
|
+
}, debounceTime));
|
|
29
|
+
return state;
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/node/auth-revoke.ts
|
|
33
|
+
/**
|
|
34
|
+
* Revoke an auth token: remove from storage and notify all connected clients
|
|
35
|
+
* using this token that they are no longer trusted.
|
|
36
|
+
*/
|
|
37
|
+
async function revokeAuthToken(context, storage, token) {
|
|
38
|
+
storage.mutate((state) => {
|
|
39
|
+
delete state.trusted[token];
|
|
40
|
+
});
|
|
41
|
+
const rpcHost = context.rpc;
|
|
42
|
+
if (!rpcHost._rpcGroup) return;
|
|
43
|
+
const affectedSessionIds = /* @__PURE__ */ new Set();
|
|
44
|
+
for (const client of rpcHost._rpcGroup.clients) if (client.$meta.clientAuthToken === token) {
|
|
45
|
+
affectedSessionIds.add(client.$meta.id);
|
|
46
|
+
client.$meta.isTrusted = false;
|
|
47
|
+
client.$meta.clientAuthToken = void 0;
|
|
48
|
+
}
|
|
49
|
+
if (affectedSessionIds.size === 0) return;
|
|
50
|
+
await rpcHost.broadcast({
|
|
51
|
+
method: "devtoolskit:internal:auth:revoked",
|
|
52
|
+
args: [],
|
|
53
|
+
filter: (client) => affectedSessionIds.has(client.$meta.id)
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region src/node/context-internal.ts
|
|
58
|
+
const internalContextMap = /* @__PURE__ */ new WeakMap();
|
|
59
|
+
function getInternalContext(context) {
|
|
60
|
+
if (!internalContextMap.has(context)) {
|
|
61
|
+
const storage = createStorage({
|
|
62
|
+
filepath: join(homedir(), ".vite/devtools/auth.json"),
|
|
63
|
+
initialValue: { trusted: {} }
|
|
64
|
+
});
|
|
65
|
+
const internalContext = {
|
|
66
|
+
storage: { auth: storage },
|
|
67
|
+
revokeAuthToken: (token) => revokeAuthToken(context, storage, token)
|
|
68
|
+
};
|
|
69
|
+
internalContextMap.set(context, internalContext);
|
|
70
|
+
}
|
|
71
|
+
return internalContextMap.get(context);
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
74
|
+
export { createStorage as n, getInternalContext as t };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SharedState } from "@vitejs/devtools-kit/utils/shared-state";
|
|
2
|
+
import { DevToolsNodeContext } from "@vitejs/devtools-kit";
|
|
3
|
+
|
|
4
|
+
//#region src/node/context-internal.d.ts
|
|
5
|
+
interface InternalAnonymousAuthStorage {
|
|
6
|
+
trusted: Record<string, {
|
|
7
|
+
authToken: string;
|
|
8
|
+
ua: string;
|
|
9
|
+
origin: string;
|
|
10
|
+
timestamp: number;
|
|
11
|
+
} | undefined>;
|
|
12
|
+
}
|
|
13
|
+
interface DevToolsInternalContext {
|
|
14
|
+
storage: {
|
|
15
|
+
auth: SharedState<InternalAnonymousAuthStorage>;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Revoke an auth token: remove from storage and notify all connected clients
|
|
19
|
+
* using this token that they are no longer trusted.
|
|
20
|
+
*/
|
|
21
|
+
revokeAuthToken: (token: string) => Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
declare function getInternalContext(context: DevToolsNodeContext): DevToolsInternalContext;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { InternalAnonymousAuthStorage as n, getInternalContext as r, DevToolsInternalContext as t };
|