@vitejs/devtools 0.0.0-alpha.20 → 0.0.0-alpha.21
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/{cli-commands-BBPbCd8A.js → cli-commands-CkG1gOFc.js} +13 -12
- package/dist/cli-commands.js +2 -2
- package/dist/cli.js +2 -2
- package/dist/client/inject.js +32 -21
- package/dist/client/standalone/assets/{index-g0E0pe2M.js → index-Dpn5Nv-R.js} +2 -2
- package/dist/client/standalone/assets/index-bVBlMYV3.css +1 -0
- package/dist/client/standalone/index.html +2 -2
- package/dist/client/webcomponents.d.ts +1 -1
- package/dist/client/webcomponents.js +95 -40
- package/dist/{docks-B3cDUs1u.js → docks-BuqYBItp.js} +255 -221
- package/dist/{index-C5iw-7QZ.d.ts → index-CWvzFILY.d.ts} +97 -5
- package/dist/index.d.ts +15 -3
- package/dist/index.js +1 -1
- package/dist/plugins-Chcj6ENu.js +2756 -0
- package/package.json +11 -10
- package/dist/client/standalone/assets/index-CsLZ-29s.css +0 -1
- package/dist/plugins-DfJlAQ2j.js +0 -1570
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as createApp, c as sendRedirect, d as ansis_default, i as getPort, l as toNodeListener, n as createDevToolsMiddleware, o as eventHandler, r as MARK_NODE, s as fromNodeMiddleware, t as DevTools, u as createDevToolsContext } from "./plugins-Chcj6ENu.js";
|
|
2
2
|
import { t as dirClientStandalone } from "./dirs-C0s1Ghvy.js";
|
|
3
|
+
import { resolveConfig } from "vite";
|
|
3
4
|
import process from "node:process";
|
|
4
5
|
import { existsSync } from "node:fs";
|
|
5
6
|
import sirv from "sirv";
|
|
6
|
-
import {
|
|
7
|
-
import fs from "node:fs/promises";
|
|
7
|
+
import { join, relative, resolve } from "pathe";
|
|
8
|
+
import fs$1 from "node:fs/promises";
|
|
8
9
|
import { createServer } from "node:http";
|
|
9
10
|
import open from "open";
|
|
10
|
-
import { join, relative, resolve } from "pathe";
|
|
11
11
|
|
|
12
12
|
//#region src/node/standalone.ts
|
|
13
13
|
async function startStandaloneDevTools(options = {}) {
|
|
@@ -49,6 +49,7 @@ async function start(options) {
|
|
|
49
49
|
const devtools = await startStandaloneDevTools({ cwd: options.root });
|
|
50
50
|
const { h3 } = await createDevToolsMiddleware({
|
|
51
51
|
cwd: devtools.config.root,
|
|
52
|
+
hostWebSocket: host,
|
|
52
53
|
context: devtools.context
|
|
53
54
|
});
|
|
54
55
|
const app = createApp();
|
|
@@ -72,21 +73,21 @@ async function build(options) {
|
|
|
72
73
|
config: options.config
|
|
73
74
|
});
|
|
74
75
|
const outDir = resolve(devtools.config.root, options.outDir);
|
|
75
|
-
if (existsSync(outDir)) await fs.rm(outDir, { recursive: true });
|
|
76
|
+
if (existsSync(outDir)) await fs$1.rm(outDir, { recursive: true });
|
|
76
77
|
const devToolsRoot = join(outDir, ".devtools");
|
|
77
|
-
await fs.mkdir(devToolsRoot, { recursive: true });
|
|
78
|
-
await fs.cp(dirClientStandalone, devToolsRoot, { recursive: true });
|
|
78
|
+
await fs$1.mkdir(devToolsRoot, { recursive: true });
|
|
79
|
+
await fs$1.cp(dirClientStandalone, devToolsRoot, { recursive: true });
|
|
79
80
|
for (const { baseUrl, distDir } of devtools.context.views.buildStaticDirs) {
|
|
80
81
|
console.log(ansis_default.cyan`${MARK_NODE} Copying static files from ${distDir} to ${join(outDir, baseUrl)}`);
|
|
81
|
-
await fs.mkdir(join(outDir, baseUrl), { recursive: true });
|
|
82
|
-
await fs.cp(distDir, join(outDir, baseUrl), { recursive: true });
|
|
82
|
+
await fs$1.mkdir(join(outDir, baseUrl), { recursive: true });
|
|
83
|
+
await fs$1.cp(distDir, join(outDir, baseUrl), { recursive: true });
|
|
83
84
|
}
|
|
84
|
-
await fs.mkdir(resolve(devToolsRoot, "api"), { recursive: true });
|
|
85
|
-
await fs.writeFile(resolve(devToolsRoot, ".vdt-connection.json"), JSON.stringify({ backend: "static" }, null, 2), "utf-8");
|
|
85
|
+
await fs$1.mkdir(resolve(devToolsRoot, "api"), { recursive: true });
|
|
86
|
+
await fs$1.writeFile(resolve(devToolsRoot, ".vdt-connection.json"), JSON.stringify({ backend: "static" }, null, 2), "utf-8");
|
|
86
87
|
console.log(ansis_default.cyan`${MARK_NODE} Writing RPC dump to ${resolve(devToolsRoot, ".vdt-rpc-dump.json")}`);
|
|
87
88
|
const dump = {};
|
|
88
89
|
for (const [key, value] of Object.entries(devtools.context.rpc.functions)) if (value.type === "static") dump[key] = await value.handler?.();
|
|
89
|
-
await fs.writeFile(resolve(devToolsRoot, ".vdt-rpc-dump.json"), JSON.stringify(dump, null, 2), "utf-8");
|
|
90
|
+
await fs$1.writeFile(resolve(devToolsRoot, ".vdt-rpc-dump.json"), JSON.stringify(dump, null, 2), "utf-8");
|
|
90
91
|
console.log(ansis_default.green`${MARK_NODE} Built to ${relative(devtools.config.root, outDir)}`);
|
|
91
92
|
throw new Error("[Vite DevTools] Build mode of Vite DevTools is not yet complete");
|
|
92
93
|
}
|
package/dist/cli-commands.js
CHANGED
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./plugins-
|
|
2
|
-
import { n as start, t as build } from "./cli-commands-
|
|
1
|
+
import "./plugins-Chcj6ENu.js";
|
|
2
|
+
import { n as start, t as build } from "./cli-commands-CkG1gOFc.js";
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
import cac from "cac";
|
|
5
5
|
|
package/dist/client/inject.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { F as markRaw, I as reactive, L as ref, M as watchEffect, c as useLocalStorage, g as computed, i as BUILTIN_ENTRIES, n as createDockEntryState, r as useDocksEntries, t as DEFAULT_DOCK_PANEL_STORE, z as toRefs } from "../docks-BuqYBItp.js";
|
|
2
2
|
import { getDevToolsRpcClient } from "@vitejs/devtools-kit/client";
|
|
3
3
|
|
|
4
4
|
//#region src/client/webcomponents/state/setup-script.ts
|
|
@@ -29,9 +29,9 @@ function executeSetupScript(entry, context) {
|
|
|
29
29
|
let _docksContext;
|
|
30
30
|
async function createDocksContext(clientType, rpc, panelStore) {
|
|
31
31
|
if (_docksContext) return _docksContext;
|
|
32
|
-
const selectedId = ref(null);
|
|
33
32
|
const dockEntries = await useDocksEntries(rpc);
|
|
34
|
-
const
|
|
33
|
+
const selectedId = ref(null);
|
|
34
|
+
const selected = computed(() => dockEntries.value.find((entry) => entry.id === selectedId.value) ?? BUILTIN_ENTRIES.find((entry) => entry.id === selectedId.value) ?? null);
|
|
35
35
|
const dockEntryStateMap = reactive(/* @__PURE__ */ new Map());
|
|
36
36
|
watchEffect(() => {
|
|
37
37
|
for (const entry of dockEntries.value) {
|
|
@@ -43,6 +43,33 @@ async function createDocksContext(clientType, rpc, panelStore) {
|
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
45
|
panelStore ||= ref(DEFAULT_DOCK_PANEL_STORE());
|
|
46
|
+
const switchEntry = async (id = null) => {
|
|
47
|
+
if (id == null) {
|
|
48
|
+
selectedId.value = null;
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
if (id === "~client-auth-notice") {
|
|
52
|
+
selectedId.value = id;
|
|
53
|
+
panelStore.value.open = true;
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
const entry = dockEntries.value.find((e) => e.id === id);
|
|
57
|
+
if (!entry) return false;
|
|
58
|
+
if (entry.type === "action" || entry.type === "custom-render" || entry.type === "iframe" && entry.clientScript) {
|
|
59
|
+
const current = dockEntryStateMap.get(id);
|
|
60
|
+
await executeSetupScript(entry, reactive({
|
|
61
|
+
...toRefs(_docksContext),
|
|
62
|
+
current
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
selectedId.value = entry.id;
|
|
66
|
+
panelStore.value.open = true;
|
|
67
|
+
return true;
|
|
68
|
+
};
|
|
69
|
+
const toggleEntry = async (id) => {
|
|
70
|
+
if (selectedId.value === id) return switchEntry(null);
|
|
71
|
+
return switchEntry(id);
|
|
72
|
+
};
|
|
46
73
|
_docksContext = reactive({
|
|
47
74
|
panel: {
|
|
48
75
|
store: panelStore,
|
|
@@ -56,24 +83,8 @@ async function createDocksContext(clientType, rpc, panelStore) {
|
|
|
56
83
|
entries: dockEntries,
|
|
57
84
|
entryToStateMap: markRaw(dockEntryStateMap),
|
|
58
85
|
getStateById: (id) => dockEntryStateMap.get(id),
|
|
59
|
-
switchEntry
|
|
60
|
-
|
|
61
|
-
selectedId.value = null;
|
|
62
|
-
return true;
|
|
63
|
-
}
|
|
64
|
-
const entry = dockEntries.value.find((e) => e.id === id);
|
|
65
|
-
if (!entry) return false;
|
|
66
|
-
if (entry.type === "action" || entry.type === "custom-render" || entry.type === "iframe" && entry.clientScript) {
|
|
67
|
-
const current = dockEntryStateMap.get(id);
|
|
68
|
-
await executeSetupScript(entry, reactive({
|
|
69
|
-
...toRefs(_docksContext),
|
|
70
|
-
current
|
|
71
|
-
}));
|
|
72
|
-
}
|
|
73
|
-
selectedId.value = entry.id;
|
|
74
|
-
panelStore.value.open = true;
|
|
75
|
-
return true;
|
|
76
|
-
}
|
|
86
|
+
switchEntry,
|
|
87
|
+
toggleEntry
|
|
77
88
|
},
|
|
78
89
|
rpc,
|
|
79
90
|
clientType
|