@vitejs/devtools 0.1.5 → 0.1.9
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-DNt-Vqy4.js → DockIcon-7v-JouW5.js} +27 -27
- package/dist/DockStandalone-DZ0INpRC.js +3246 -0
- package/dist/{LogItem-CZM2G41b.js → LogItem-Ca0SsU39.js} +23 -20
- package/dist/{ViewBuiltinLogs-1ABRTwzd.js → ViewBuiltinLogs-B_CLlali.js} +39 -39
- package/dist/{ViewBuiltinTerminals-Co7G-321.js → ViewBuiltinTerminals-ZrMObMte.js} +10 -11
- package/dist/{ViewJsonRender-ByPfpKFM.js → ViewJsonRender-Cc5BPfnv.js} +4 -4
- package/dist/auth-state-DXCxEqSd.js +54 -0
- package/dist/build-static-zB8LrlMJ.js +49 -0
- package/dist/cli-commands.js +57 -2
- package/dist/cli.js +8 -4
- package/dist/client/inject.js +231 -27
- package/dist/client/standalone/assets/DockStandalone-BUOgWTCb.js +1 -0
- package/dist/client/standalone/assets/LogItem-BnVhub2j.js +1 -0
- package/dist/client/standalone/assets/ViewBuiltinLogs-rU-E-8qT.js +1 -0
- package/dist/client/standalone/assets/{ViewBuiltinTerminals-UrMq7UXM.js → ViewBuiltinTerminals-UWfUyC_P.js} +2 -2
- package/dist/client/standalone/assets/{ViewJsonRender-BURuu55Z.js → ViewJsonRender-De5eeIha.js} +3 -3
- package/dist/client/standalone/assets/dist-CAaP5Isp.js +1 -0
- package/dist/client/standalone/assets/iconify-C-CPDXMf.js +2 -0
- package/dist/client/standalone/assets/index-DtZFMvER.css +1 -0
- package/dist/client/standalone/assets/index-hQ4JAD5S.js +3 -0
- package/dist/client/standalone/assets/runtime-core.esm-bundler-Bvz2jy0O.js +1 -0
- package/dist/client/standalone/index.html +6 -5
- package/dist/client/webcomponents.d.ts +1 -21628
- package/dist/client/webcomponents.js +54 -51
- package/dist/config.js +1 -1
- package/dist/constants-DfEeYo9W.js +142 -0
- package/dist/{plugins-DiuKIPkS.js → context-DmXts6Ac.js} +116 -673
- package/dist/{dist-D2Z6bwqJ.js → dist-CCdqIez-.js} +128 -5
- package/dist/dist-DpLy3ojW.js +229 -0
- package/dist/index.d.ts +43 -3
- package/dist/index.js +3 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +1 -1
- package/dist/plugins-vfc-N600.js +59 -0
- package/dist/{popup-BUPO6e0I.js → popup-DcuzpgO2.js} +114 -55
- package/dist/server-C54I1zbj.js +2 -0
- package/dist/server-DH39-LHL.js +50 -0
- package/dist/server-DSh-GQIq.js +188 -0
- package/dist/standalone-w_GYdx1T.js +33 -0
- package/dist/static-dump-BqRb_x-O.js +65 -0
- package/package.json +12 -15
- package/dist/DockStandalone-DxFEMDp2.js +0 -1256
- package/dist/cli-commands-CnJ4eqDp.js +0 -180
- package/dist/client/standalone/assets/DockStandalone-C8ChyZLh.js +0 -1
- package/dist/client/standalone/assets/LogItem-Mx4UyReX.js +0 -1
- package/dist/client/standalone/assets/ViewBuiltinLogs-C4j4vgSn.js +0 -1
- package/dist/client/standalone/assets/dist-DIlAYcjk.js +0 -1
- package/dist/client/standalone/assets/index-BEyoIK7m.css +0 -1
- package/dist/client/standalone/assets/index-Rpv7PwRD.js +0 -4
- package/dist/client/standalone/assets/runtime-core.esm-bundler-CJlaYmKv.js +0 -1
- package/dist/vue.runtime.esm-bundler-CS1wMbap.js +0 -6988
- /package/dist/{context-internal-CvIHbZq4.js → context-internal-DZpoJjMz.js} +0 -0
- /package/dist/{context-internal-Du6FuGIu.d.ts → context-internal-Ys7Zu3q3.d.ts} +0 -0
- /package/dist/{iconify-BW79QmbD.js → iconify-JodklND-.js} +0 -0
- /package/dist/{utils-DaaVwEUH.js → utils-HWI9S6d-.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { computed, customRef, getCurrentInstance, getCurrentScope, hasInjectionContext, inject, isRef, nextTick, onMounted, onScopeDispose, readonly, ref, shallowReadonly, shallowRef, toRef, toValue, unref, watch, watchEffect } from "vue";
|
|
2
2
|
//#region ../../node_modules/.pnpm/@vueuse+shared@14.2.1_vue@3.5.30_typescript@5.9.3_/node_modules/@vueuse/shared/dist/index.js
|
|
3
3
|
/**
|
|
4
4
|
* Call onScopeDispose() if it's inside an effect scope lifecycle, if not, do nothing
|
|
@@ -44,8 +44,8 @@ function getIsIOS() {
|
|
|
44
44
|
var _window, _window2, _window3;
|
|
45
45
|
return isClient && !!((_window = window) === null || _window === void 0 || (_window = _window.navigator) === null || _window === void 0 ? void 0 : _window.userAgent) && (/iP(?:ad|hone|od)/.test(window.navigator.userAgent) || ((_window2 = window) === null || _window2 === void 0 || (_window2 = _window2.navigator) === null || _window2 === void 0 ? void 0 : _window2.maxTouchPoints) > 2 && /iPad|Macintosh/.test((_window3 = window) === null || _window3 === void 0 ? void 0 : _window3.navigator.userAgent));
|
|
46
46
|
}
|
|
47
|
-
function toRef(...args) {
|
|
48
|
-
if (args.length !== 1) return toRef
|
|
47
|
+
function toRef$1(...args) {
|
|
48
|
+
if (args.length !== 1) return toRef(...args);
|
|
49
49
|
const r = args[0];
|
|
50
50
|
return typeof r === "function" ? readonly(customRef(() => ({
|
|
51
51
|
get: r,
|
|
@@ -119,7 +119,7 @@ function debounceFilter(ms, options = {}) {
|
|
|
119
119
|
*/
|
|
120
120
|
function pausableFilter(extendFilter = bypassFilter, options = {}) {
|
|
121
121
|
const { initialState = "active" } = options;
|
|
122
|
-
const isActive = toRef(initialState === "active");
|
|
122
|
+
const isActive = toRef$1(initialState === "active");
|
|
123
123
|
function pause() {
|
|
124
124
|
isActive.value = false;
|
|
125
125
|
}
|
|
@@ -576,6 +576,17 @@ function getHandlers() {
|
|
|
576
576
|
function getSSRHandler(key, fallback) {
|
|
577
577
|
return handlers[key] || fallback;
|
|
578
578
|
}
|
|
579
|
+
/**
|
|
580
|
+
* Reactive dark theme preference.
|
|
581
|
+
*
|
|
582
|
+
* @see https://vueuse.org/usePreferredDark
|
|
583
|
+
* @param [options]
|
|
584
|
+
*
|
|
585
|
+
* @__NO_SIDE_EFFECTS__
|
|
586
|
+
*/
|
|
587
|
+
function usePreferredDark(options) {
|
|
588
|
+
return useMediaQuery("(prefers-color-scheme: dark)", options);
|
|
589
|
+
}
|
|
579
590
|
function guessSerializerType(rawInit) {
|
|
580
591
|
return rawInit == null ? "any" : rawInit instanceof Set ? "set" : rawInit instanceof Map ? "map" : rawInit instanceof Date ? "date" : typeof rawInit === "boolean" ? "boolean" : typeof rawInit === "string" ? "string" : typeof rawInit === "object" ? "object" : !Number.isNaN(rawInit) ? "number" : "any";
|
|
581
592
|
}
|
|
@@ -730,6 +741,86 @@ function useStorage(key, defaults$1, storage, options = {}) {
|
|
|
730
741
|
}
|
|
731
742
|
return data;
|
|
732
743
|
}
|
|
744
|
+
const CSS_DISABLE_TRANS = "*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}";
|
|
745
|
+
/**
|
|
746
|
+
* Reactive color mode with auto data persistence.
|
|
747
|
+
*
|
|
748
|
+
* @see https://vueuse.org/useColorMode
|
|
749
|
+
* @param options
|
|
750
|
+
*/
|
|
751
|
+
function useColorMode(options = {}) {
|
|
752
|
+
const { selector = "html", attribute = "class", initialValue = "auto", window: window$1 = defaultWindow, storage, storageKey = "vueuse-color-scheme", listenToStorageChanges = true, storageRef, emitAuto, disableTransition = true } = options;
|
|
753
|
+
const modes = {
|
|
754
|
+
auto: "",
|
|
755
|
+
light: "light",
|
|
756
|
+
dark: "dark",
|
|
757
|
+
...options.modes || {}
|
|
758
|
+
};
|
|
759
|
+
const preferredDark = usePreferredDark({ window: window$1 });
|
|
760
|
+
const system = computed(() => preferredDark.value ? "dark" : "light");
|
|
761
|
+
const store = storageRef || (storageKey == null ? toRef$1(initialValue) : useStorage(storageKey, initialValue, storage, {
|
|
762
|
+
window: window$1,
|
|
763
|
+
listenToStorageChanges
|
|
764
|
+
}));
|
|
765
|
+
const state = computed(() => store.value === "auto" ? system.value : store.value);
|
|
766
|
+
const updateHTMLAttrs = getSSRHandler("updateHTMLAttrs", (selector$1, attribute$1, value) => {
|
|
767
|
+
const el = typeof selector$1 === "string" ? window$1 === null || window$1 === void 0 ? void 0 : window$1.document.querySelector(selector$1) : unrefElement(selector$1);
|
|
768
|
+
if (!el) return;
|
|
769
|
+
const classesToAdd = /* @__PURE__ */ new Set();
|
|
770
|
+
const classesToRemove = /* @__PURE__ */ new Set();
|
|
771
|
+
let attributeToChange = null;
|
|
772
|
+
if (attribute$1 === "class") {
|
|
773
|
+
const current = value.split(/\s/g);
|
|
774
|
+
Object.values(modes).flatMap((i) => (i || "").split(/\s/g)).filter(Boolean).forEach((v) => {
|
|
775
|
+
if (current.includes(v)) classesToAdd.add(v);
|
|
776
|
+
else classesToRemove.add(v);
|
|
777
|
+
});
|
|
778
|
+
} else attributeToChange = {
|
|
779
|
+
key: attribute$1,
|
|
780
|
+
value
|
|
781
|
+
};
|
|
782
|
+
if (classesToAdd.size === 0 && classesToRemove.size === 0 && attributeToChange === null) return;
|
|
783
|
+
let style;
|
|
784
|
+
if (disableTransition) {
|
|
785
|
+
style = window$1.document.createElement("style");
|
|
786
|
+
style.appendChild(document.createTextNode(CSS_DISABLE_TRANS));
|
|
787
|
+
window$1.document.head.appendChild(style);
|
|
788
|
+
}
|
|
789
|
+
for (const c of classesToAdd) el.classList.add(c);
|
|
790
|
+
for (const c of classesToRemove) el.classList.remove(c);
|
|
791
|
+
if (attributeToChange) el.setAttribute(attributeToChange.key, attributeToChange.value);
|
|
792
|
+
if (disableTransition) {
|
|
793
|
+
window$1.getComputedStyle(style).opacity;
|
|
794
|
+
document.head.removeChild(style);
|
|
795
|
+
}
|
|
796
|
+
});
|
|
797
|
+
function defaultOnChanged(mode) {
|
|
798
|
+
var _modes$mode;
|
|
799
|
+
updateHTMLAttrs(selector, attribute, (_modes$mode = modes[mode]) !== null && _modes$mode !== void 0 ? _modes$mode : mode);
|
|
800
|
+
}
|
|
801
|
+
function onChanged(mode) {
|
|
802
|
+
if (options.onChanged) options.onChanged(mode, defaultOnChanged);
|
|
803
|
+
else defaultOnChanged(mode);
|
|
804
|
+
}
|
|
805
|
+
watch(state, onChanged, {
|
|
806
|
+
flush: "post",
|
|
807
|
+
immediate: true
|
|
808
|
+
});
|
|
809
|
+
tryOnMounted(() => onChanged(state.value));
|
|
810
|
+
const auto = computed({
|
|
811
|
+
get() {
|
|
812
|
+
return emitAuto ? store.value : state.value;
|
|
813
|
+
},
|
|
814
|
+
set(v) {
|
|
815
|
+
store.value = v;
|
|
816
|
+
}
|
|
817
|
+
});
|
|
818
|
+
return Object.assign(auto, {
|
|
819
|
+
store,
|
|
820
|
+
system,
|
|
821
|
+
state
|
|
822
|
+
});
|
|
823
|
+
}
|
|
733
824
|
/**
|
|
734
825
|
* Manipulate CSS variables.
|
|
735
826
|
*
|
|
@@ -769,6 +860,38 @@ function useCssVar(prop, target, options = {}) {
|
|
|
769
860
|
return variable;
|
|
770
861
|
}
|
|
771
862
|
/**
|
|
863
|
+
* Reactive dark mode with auto data persistence.
|
|
864
|
+
*
|
|
865
|
+
* @see https://vueuse.org/useDark
|
|
866
|
+
* @param options
|
|
867
|
+
*/
|
|
868
|
+
function useDark(options = {}) {
|
|
869
|
+
const { valueDark = "dark", valueLight = "" } = options;
|
|
870
|
+
const mode = useColorMode({
|
|
871
|
+
...options,
|
|
872
|
+
onChanged: (mode$1, defaultHandler) => {
|
|
873
|
+
var _options$onChanged;
|
|
874
|
+
if (options.onChanged) (_options$onChanged = options.onChanged) === null || _options$onChanged === void 0 || _options$onChanged.call(options, mode$1 === "dark", defaultHandler, mode$1);
|
|
875
|
+
else defaultHandler(mode$1);
|
|
876
|
+
},
|
|
877
|
+
modes: {
|
|
878
|
+
dark: valueDark,
|
|
879
|
+
light: valueLight
|
|
880
|
+
}
|
|
881
|
+
});
|
|
882
|
+
const system = computed(() => mode.system.value);
|
|
883
|
+
return computed({
|
|
884
|
+
get() {
|
|
885
|
+
return mode.value === "dark";
|
|
886
|
+
},
|
|
887
|
+
set(v) {
|
|
888
|
+
const modeVal = v ? "dark" : "light";
|
|
889
|
+
if (system.value === modeVal) mode.value = "auto";
|
|
890
|
+
else mode.value = modeVal;
|
|
891
|
+
}
|
|
892
|
+
});
|
|
893
|
+
}
|
|
894
|
+
/**
|
|
772
895
|
* Reports changes to the dimensions of an Element's content or the border-box
|
|
773
896
|
*
|
|
774
897
|
* @see https://vueuse.org/useResizeObserver
|
|
@@ -1110,4 +1233,4 @@ function useWindowSize(options = {}) {
|
|
|
1110
1233
|
};
|
|
1111
1234
|
}
|
|
1112
1235
|
//#endregion
|
|
1113
|
-
export {
|
|
1236
|
+
export { useLocalStorage as a, useWindowSize as c, watchImmediate as d, useEventListener as i, useDebounceFn as l, useDark as n, useScreenSafeArea as o, useElementBounding as r, useTimeAgo as s, onClickOutside as t, watchDebounced as u };
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { i as __exportAll } from "./constants-DfEeYo9W.js";
|
|
2
|
+
import "node:path";
|
|
3
|
+
import { networkInterfaces } from "node:os";
|
|
4
|
+
import { createServer } from "node:net";
|
|
5
|
+
import "node:fs/promises";
|
|
6
|
+
//#region ../../node_modules/.pnpm/get-port-please@3.2.0/node_modules/get-port-please/dist/index.mjs
|
|
7
|
+
var dist_exports = /* @__PURE__ */ __exportAll({
|
|
8
|
+
checkPort: () => checkPort,
|
|
9
|
+
getPort: () => getPort,
|
|
10
|
+
getRandomPort: () => getRandomPort,
|
|
11
|
+
isSafePort: () => isSafePort,
|
|
12
|
+
isUnsafePort: () => isUnsafePort
|
|
13
|
+
});
|
|
14
|
+
const unsafePorts = /* @__PURE__ */ new Set([
|
|
15
|
+
1,
|
|
16
|
+
7,
|
|
17
|
+
9,
|
|
18
|
+
11,
|
|
19
|
+
13,
|
|
20
|
+
15,
|
|
21
|
+
17,
|
|
22
|
+
19,
|
|
23
|
+
20,
|
|
24
|
+
21,
|
|
25
|
+
22,
|
|
26
|
+
23,
|
|
27
|
+
25,
|
|
28
|
+
37,
|
|
29
|
+
42,
|
|
30
|
+
43,
|
|
31
|
+
53,
|
|
32
|
+
69,
|
|
33
|
+
77,
|
|
34
|
+
79,
|
|
35
|
+
87,
|
|
36
|
+
95,
|
|
37
|
+
101,
|
|
38
|
+
102,
|
|
39
|
+
103,
|
|
40
|
+
104,
|
|
41
|
+
109,
|
|
42
|
+
110,
|
|
43
|
+
111,
|
|
44
|
+
113,
|
|
45
|
+
115,
|
|
46
|
+
117,
|
|
47
|
+
119,
|
|
48
|
+
123,
|
|
49
|
+
135,
|
|
50
|
+
137,
|
|
51
|
+
139,
|
|
52
|
+
143,
|
|
53
|
+
161,
|
|
54
|
+
179,
|
|
55
|
+
389,
|
|
56
|
+
427,
|
|
57
|
+
465,
|
|
58
|
+
512,
|
|
59
|
+
513,
|
|
60
|
+
514,
|
|
61
|
+
515,
|
|
62
|
+
526,
|
|
63
|
+
530,
|
|
64
|
+
531,
|
|
65
|
+
532,
|
|
66
|
+
540,
|
|
67
|
+
548,
|
|
68
|
+
554,
|
|
69
|
+
556,
|
|
70
|
+
563,
|
|
71
|
+
587,
|
|
72
|
+
601,
|
|
73
|
+
636,
|
|
74
|
+
989,
|
|
75
|
+
990,
|
|
76
|
+
993,
|
|
77
|
+
995,
|
|
78
|
+
1719,
|
|
79
|
+
1720,
|
|
80
|
+
1723,
|
|
81
|
+
2049,
|
|
82
|
+
3659,
|
|
83
|
+
4045,
|
|
84
|
+
5060,
|
|
85
|
+
5061,
|
|
86
|
+
6e3,
|
|
87
|
+
6566,
|
|
88
|
+
6665,
|
|
89
|
+
6666,
|
|
90
|
+
6667,
|
|
91
|
+
6668,
|
|
92
|
+
6669,
|
|
93
|
+
6697,
|
|
94
|
+
10080
|
|
95
|
+
]);
|
|
96
|
+
function isUnsafePort(port) {
|
|
97
|
+
return unsafePorts.has(port);
|
|
98
|
+
}
|
|
99
|
+
function isSafePort(port) {
|
|
100
|
+
return !isUnsafePort(port);
|
|
101
|
+
}
|
|
102
|
+
var GetPortError = class extends Error {
|
|
103
|
+
constructor(message, opts) {
|
|
104
|
+
super(message, opts);
|
|
105
|
+
this.message = message;
|
|
106
|
+
}
|
|
107
|
+
name = "GetPortError";
|
|
108
|
+
};
|
|
109
|
+
function _log(verbose, message) {
|
|
110
|
+
if (verbose) console.log(`[get-port] ${message}`);
|
|
111
|
+
}
|
|
112
|
+
function _generateRange(from, to) {
|
|
113
|
+
if (to < from) return [];
|
|
114
|
+
const r = [];
|
|
115
|
+
for (let index = from; index <= to; index++) r.push(index);
|
|
116
|
+
return r;
|
|
117
|
+
}
|
|
118
|
+
function _tryPort(port, host) {
|
|
119
|
+
return new Promise((resolve) => {
|
|
120
|
+
const server = createServer();
|
|
121
|
+
server.unref();
|
|
122
|
+
server.on("error", () => {
|
|
123
|
+
resolve(false);
|
|
124
|
+
});
|
|
125
|
+
server.listen({
|
|
126
|
+
port,
|
|
127
|
+
host
|
|
128
|
+
}, () => {
|
|
129
|
+
const { port: port2 } = server.address();
|
|
130
|
+
server.close(() => {
|
|
131
|
+
resolve(isSafePort(port2) && port2);
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
function _getLocalHosts(additional) {
|
|
137
|
+
const hosts = new Set(additional);
|
|
138
|
+
for (const _interface of Object.values(networkInterfaces())) for (const config of _interface || []) if (config.address && !config.internal && !config.address.startsWith("fe80::") && !config.address.startsWith("169.254")) hosts.add(config.address);
|
|
139
|
+
return [...hosts];
|
|
140
|
+
}
|
|
141
|
+
async function _findPort(ports, host) {
|
|
142
|
+
for (const port of ports) {
|
|
143
|
+
const r = await _tryPort(port, host);
|
|
144
|
+
if (r) return r;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
function _fmtOnHost(hostname) {
|
|
148
|
+
return hostname ? `on host ${JSON.stringify(hostname)}` : "on any host";
|
|
149
|
+
}
|
|
150
|
+
const HOSTNAME_RE = /^(?!-)[\d.:A-Za-z-]{1,63}(?<!-)$/;
|
|
151
|
+
function _validateHostname(hostname, _public, verbose) {
|
|
152
|
+
if (hostname && !HOSTNAME_RE.test(hostname)) {
|
|
153
|
+
const fallbackHost = _public ? "0.0.0.0" : "127.0.0.1";
|
|
154
|
+
_log(verbose, `Invalid hostname: ${JSON.stringify(hostname)}. Using ${JSON.stringify(fallbackHost)} as fallback.`);
|
|
155
|
+
return fallbackHost;
|
|
156
|
+
}
|
|
157
|
+
return hostname;
|
|
158
|
+
}
|
|
159
|
+
async function getPort(_userOptions = {}) {
|
|
160
|
+
if (typeof _userOptions === "number" || typeof _userOptions === "string") _userOptions = { port: Number.parseInt(_userOptions + "") || 0 };
|
|
161
|
+
const _port = Number(_userOptions.port ?? process.env.PORT);
|
|
162
|
+
const _userSpecifiedAnyPort = Boolean(_userOptions.port || _userOptions.ports?.length || _userOptions.portRange?.length);
|
|
163
|
+
const options = {
|
|
164
|
+
random: _port === 0,
|
|
165
|
+
ports: [],
|
|
166
|
+
portRange: [],
|
|
167
|
+
alternativePortRange: _userSpecifiedAnyPort ? [] : [3e3, 3100],
|
|
168
|
+
verbose: false,
|
|
169
|
+
..._userOptions,
|
|
170
|
+
port: _port,
|
|
171
|
+
host: _validateHostname(_userOptions.host ?? process.env.HOST, _userOptions.public, _userOptions.verbose)
|
|
172
|
+
};
|
|
173
|
+
if (options.random && !_userSpecifiedAnyPort) return getRandomPort(options.host);
|
|
174
|
+
const portsToCheck = [
|
|
175
|
+
options.port,
|
|
176
|
+
...options.ports,
|
|
177
|
+
..._generateRange(...options.portRange)
|
|
178
|
+
].filter((port) => {
|
|
179
|
+
if (!port) return false;
|
|
180
|
+
if (!isSafePort(port)) {
|
|
181
|
+
_log(options.verbose, `Ignoring unsafe port: ${port}`);
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
return true;
|
|
185
|
+
});
|
|
186
|
+
if (portsToCheck.length === 0) portsToCheck.push(3e3);
|
|
187
|
+
let availablePort = await _findPort(portsToCheck, options.host);
|
|
188
|
+
if (!availablePort && options.alternativePortRange.length > 0) {
|
|
189
|
+
availablePort = await _findPort(_generateRange(...options.alternativePortRange), options.host);
|
|
190
|
+
if (portsToCheck.length > 0) {
|
|
191
|
+
let message = `Unable to find an available port (tried ${portsToCheck.join("-")} ${_fmtOnHost(options.host)}).`;
|
|
192
|
+
if (availablePort) message += ` Using alternative port ${availablePort}.`;
|
|
193
|
+
_log(options.verbose, message);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
if (!availablePort && _userOptions.random !== false) {
|
|
197
|
+
availablePort = await getRandomPort(options.host);
|
|
198
|
+
if (availablePort) _log(options.verbose, `Using random port ${availablePort}`);
|
|
199
|
+
}
|
|
200
|
+
if (!availablePort) {
|
|
201
|
+
const triedRanges = [
|
|
202
|
+
options.port,
|
|
203
|
+
options.portRange.join("-"),
|
|
204
|
+
options.alternativePortRange.join("-")
|
|
205
|
+
].filter(Boolean).join(", ");
|
|
206
|
+
throw new GetPortError(`Unable to find an available port ${_fmtOnHost(options.host)} (tried ${triedRanges})`);
|
|
207
|
+
}
|
|
208
|
+
return availablePort;
|
|
209
|
+
}
|
|
210
|
+
async function getRandomPort(host) {
|
|
211
|
+
const port = await checkPort(0, host);
|
|
212
|
+
if (port === false) throw new GetPortError(`Unable to find a random port ${_fmtOnHost(host)}`);
|
|
213
|
+
return port;
|
|
214
|
+
}
|
|
215
|
+
async function checkPort(port, host = process.env.HOST, verbose) {
|
|
216
|
+
if (!host) host = _getLocalHosts([void 0, "0.0.0.0"]);
|
|
217
|
+
if (!Array.isArray(host)) return _tryPort(port, host);
|
|
218
|
+
for (const _host of host) {
|
|
219
|
+
const _port = await _tryPort(port, _host);
|
|
220
|
+
if (_port === false) {
|
|
221
|
+
if (port < 1024 && verbose) _log(verbose, `Unable to listen to the privileged port ${port} ${_fmtOnHost(_host)}`);
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
if (port === 0 && _port !== 0) port = _port;
|
|
225
|
+
}
|
|
226
|
+
return port;
|
|
227
|
+
}
|
|
228
|
+
//#endregion
|
|
229
|
+
export { getPort as n, dist_exports as t };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { n as InternalAnonymousAuthStorage, t as DevToolsInternalContext } from "./context-internal-
|
|
2
|
-
import { Plugin, ResolvedConfig, ViteDevServer } from "vite";
|
|
1
|
+
import { n as InternalAnonymousAuthStorage, t as DevToolsInternalContext } from "./context-internal-Ys7Zu3q3.js";
|
|
3
2
|
import { SharedStatePatch } from "@vitejs/devtools-kit/utils/shared-state";
|
|
4
3
|
import * as _vitejs_devtools_rpc0 from "@vitejs/devtools-rpc";
|
|
5
4
|
import { RpcFunctionsCollectorBase } from "@vitejs/devtools-rpc";
|
|
6
5
|
import * as _vitejs_devtools_kit0 from "@vitejs/devtools-kit";
|
|
7
|
-
import { DevToolsDockEntry, DevToolsDocksUserSettings, DevToolsLogEntry, DevToolsNodeContext, DevToolsTerminalSessionStreamChunkEvent, RpcDefinitionsToFunctions } from "@vitejs/devtools-kit";
|
|
6
|
+
import { DevToolsCommandShortcutOverrides, DevToolsDockEntry, DevToolsDocksUserSettings, DevToolsLogEntry, DevToolsNodeContext, DevToolsServerCommandEntry, DevToolsTerminalSessionStreamChunkEvent, RpcDefinitionsToFunctions } from "@vitejs/devtools-kit";
|
|
8
7
|
import * as h3 from "h3";
|
|
9
8
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
9
|
+
import { Plugin, ResolvedConfig, ViteDevServer } from "vite";
|
|
10
10
|
import * as birpc from "birpc";
|
|
11
11
|
|
|
12
12
|
//#region src/node/context.d.ts
|
|
@@ -64,6 +64,28 @@ declare const builtinRpcDeclarations: readonly [{
|
|
|
64
64
|
dump?: _vitejs_devtools_rpc0.RpcDump<[query: DevToolsAuthInput], Promise<DevToolsAuthReturn>, _vitejs_devtools_kit0.DevToolsNodeContext> | undefined;
|
|
65
65
|
__resolved?: _vitejs_devtools_rpc0.RpcFunctionSetupResult<[query: DevToolsAuthInput], Promise<DevToolsAuthReturn>> | undefined;
|
|
66
66
|
__promise?: _vitejs_devtools_rpc0.Thenable<_vitejs_devtools_rpc0.RpcFunctionSetupResult<[query: DevToolsAuthInput], Promise<DevToolsAuthReturn>>> | undefined;
|
|
67
|
+
}, {
|
|
68
|
+
name: "devtoolskit:internal:commands:execute";
|
|
69
|
+
type?: "action" | undefined;
|
|
70
|
+
cacheable?: boolean;
|
|
71
|
+
args?: undefined;
|
|
72
|
+
returns?: undefined;
|
|
73
|
+
setup?: ((context: _vitejs_devtools_kit0.DevToolsNodeContext) => _vitejs_devtools_rpc0.Thenable<_vitejs_devtools_rpc0.RpcFunctionSetupResult<[id: string, ...args: any[]], Promise<unknown>>>) | undefined;
|
|
74
|
+
handler?: ((id: string, ...args: any[]) => Promise<unknown>) | undefined;
|
|
75
|
+
dump?: _vitejs_devtools_rpc0.RpcDump<[id: string, ...args: any[]], Promise<unknown>, _vitejs_devtools_kit0.DevToolsNodeContext> | undefined;
|
|
76
|
+
__resolved?: _vitejs_devtools_rpc0.RpcFunctionSetupResult<[id: string, ...args: any[]], Promise<unknown>> | undefined;
|
|
77
|
+
__promise?: _vitejs_devtools_rpc0.Thenable<_vitejs_devtools_rpc0.RpcFunctionSetupResult<[id: string, ...args: any[]], Promise<unknown>>> | undefined;
|
|
78
|
+
}, {
|
|
79
|
+
name: "devtoolskit:internal:commands:list";
|
|
80
|
+
type?: "static" | undefined;
|
|
81
|
+
cacheable?: boolean;
|
|
82
|
+
args?: undefined;
|
|
83
|
+
returns?: undefined;
|
|
84
|
+
setup?: ((context: _vitejs_devtools_kit0.DevToolsNodeContext) => _vitejs_devtools_rpc0.Thenable<_vitejs_devtools_rpc0.RpcFunctionSetupResult<[], Promise<DevToolsServerCommandEntry[]>>>) | undefined;
|
|
85
|
+
handler?: (() => Promise<DevToolsServerCommandEntry[]>) | undefined;
|
|
86
|
+
dump?: _vitejs_devtools_rpc0.RpcDump<[], Promise<DevToolsServerCommandEntry[]>, _vitejs_devtools_kit0.DevToolsNodeContext> | undefined;
|
|
87
|
+
__resolved?: _vitejs_devtools_rpc0.RpcFunctionSetupResult<[], Promise<DevToolsServerCommandEntry[]>> | undefined;
|
|
88
|
+
__promise?: _vitejs_devtools_rpc0.Thenable<_vitejs_devtools_rpc0.RpcFunctionSetupResult<[], Promise<DevToolsServerCommandEntry[]>>> | undefined;
|
|
67
89
|
}, {
|
|
68
90
|
name: "devtoolskit:internal:docks:on-launch";
|
|
69
91
|
type?: "action" | undefined;
|
|
@@ -255,6 +277,8 @@ declare module '@vitejs/devtools-kit' {
|
|
|
255
277
|
'devtoolskit:internal:terminals:updated': () => Promise<void>;
|
|
256
278
|
}
|
|
257
279
|
interface DevToolsRpcSharedStates {
|
|
280
|
+
'devtoolskit:internal:command-shortcuts': DevToolsCommandShortcutOverrides;
|
|
281
|
+
'devtoolskit:internal:commands': DevToolsServerCommandEntry[];
|
|
258
282
|
'devtoolskit:internal:docks': DevToolsDockEntry[];
|
|
259
283
|
'devtoolskit:internal:user-settings': DevToolsDocksUserSettings;
|
|
260
284
|
}
|
|
@@ -268,6 +292,22 @@ interface DevToolsOptions {
|
|
|
268
292
|
* @default true
|
|
269
293
|
*/
|
|
270
294
|
builtinDevTools?: boolean;
|
|
295
|
+
/**
|
|
296
|
+
* Options for building static DevTools output alongside `vite build`.
|
|
297
|
+
*/
|
|
298
|
+
build?: {
|
|
299
|
+
/**
|
|
300
|
+
* Automatically build DevTools when running `vite build`.
|
|
301
|
+
*
|
|
302
|
+
* @default false
|
|
303
|
+
*/
|
|
304
|
+
withApp?: boolean;
|
|
305
|
+
/**
|
|
306
|
+
* Output directory for the DevTools build (relative to root).
|
|
307
|
+
* Defaults to Vite's `build.outDir`.
|
|
308
|
+
*/
|
|
309
|
+
outDir?: string;
|
|
310
|
+
};
|
|
271
311
|
}
|
|
272
312
|
declare function DevTools(options?: DevToolsOptions): Promise<Plugin[]>;
|
|
273
313
|
//#endregion
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as createDevToolsContext } from "./context-DmXts6Ac.js";
|
|
2
|
+
import { t as DevTools } from "./plugins-vfc-N600.js";
|
|
3
|
+
import { t as createDevToolsMiddleware } from "./server-DSh-GQIq.js";
|
|
2
4
|
export { DevTools, createDevToolsContext, createDevToolsMiddleware };
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as InternalAnonymousAuthStorage, r as getInternalContext, t as DevToolsInternalContext } from "./context-internal-
|
|
1
|
+
import { n as InternalAnonymousAuthStorage, r as getInternalContext, t as DevToolsInternalContext } from "./context-internal-Ys7Zu3q3.js";
|
|
2
2
|
export { type DevToolsInternalContext, type InternalAnonymousAuthStorage, getInternalContext };
|
package/dist/internal.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as getInternalContext } from "./context-internal-
|
|
1
|
+
import { t as getInternalContext } from "./context-internal-DZpoJjMz.js";
|
|
2
2
|
export { getInternalContext };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { n as ansis_default } from "./constants-DfEeYo9W.js";
|
|
2
|
+
import { dirDist } from "./dirs.js";
|
|
3
|
+
import { t as DevToolsServer } from "./server-DH39-LHL.js";
|
|
4
|
+
import { join, normalize, resolve } from "pathe";
|
|
5
|
+
import process from "node:process";
|
|
6
|
+
//#region src/node/plugins/build.ts
|
|
7
|
+
function DevToolsBuild(options = {}) {
|
|
8
|
+
let context;
|
|
9
|
+
let resolvedConfig;
|
|
10
|
+
return {
|
|
11
|
+
name: "vite:devtools:build",
|
|
12
|
+
apply: "build",
|
|
13
|
+
configResolved(config) {
|
|
14
|
+
resolvedConfig = config;
|
|
15
|
+
},
|
|
16
|
+
async buildStart() {
|
|
17
|
+
const { createDevToolsContext } = await import("./context-DmXts6Ac.js").then((n) => n.t);
|
|
18
|
+
context = await createDevToolsContext(resolvedConfig);
|
|
19
|
+
},
|
|
20
|
+
async closeBundle() {
|
|
21
|
+
console.log(ansis_default.cyan`${"⬢"} Building static Vite DevTools...`);
|
|
22
|
+
const outDir = options.outDir ? resolve(resolvedConfig.root, options.outDir) : resolve(resolvedConfig.root, resolvedConfig.build.outDir);
|
|
23
|
+
const { buildStaticDevTools } = await import("./build-static-zB8LrlMJ.js");
|
|
24
|
+
await buildStaticDevTools({
|
|
25
|
+
context,
|
|
26
|
+
outDir
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/node/plugins/injection.ts
|
|
33
|
+
function DevToolsInjection() {
|
|
34
|
+
return {
|
|
35
|
+
name: "vite:devtools:injection",
|
|
36
|
+
enforce: "post",
|
|
37
|
+
transformIndexHtml() {
|
|
38
|
+
return [{
|
|
39
|
+
tag: "script",
|
|
40
|
+
attrs: {
|
|
41
|
+
src: `/@fs/${process.env.VITE_DEVTOOLS_LOCAL_DEV ? normalize(join(dirDist, "..", "src/client/inject/index.ts")) : normalize(join(dirDist, "client/inject.js"))}`,
|
|
42
|
+
type: "module"
|
|
43
|
+
},
|
|
44
|
+
injectTo: "body"
|
|
45
|
+
}];
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/node/plugins/index.ts
|
|
51
|
+
async function DevTools(options = {}) {
|
|
52
|
+
const { builtinDevTools = true, build } = options;
|
|
53
|
+
const plugins = [DevToolsInjection(), DevToolsServer()];
|
|
54
|
+
if (build?.withApp) plugins.push(DevToolsBuild({ outDir: build.outDir }));
|
|
55
|
+
if (builtinDevTools) plugins.push(await import("@vitejs/devtools-rolldown").then((m) => m.DevToolsRolldownUI()));
|
|
56
|
+
return plugins;
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
export { DevTools as t };
|