@vitejs/devtools 0.0.0-alpha.0 → 0.0.0-alpha.10
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/{bin.mjs → bin.js} +1 -1
- package/dist/cli-commands-CWESTkWI.js +97 -0
- package/dist/cli-commands.d.ts +18 -0
- package/dist/cli-commands.js +5 -0
- package/dist/cli.js +17 -0
- package/dist/client/inject.d.ts +4 -0
- package/dist/client/inject.js +33 -0
- package/dist/client/standalone/assets/index-BGdE2uyE.css +1 -0
- package/dist/client/standalone/assets/index-BXYGGkRo.js +7 -0
- package/dist/client/standalone/index.html +14 -0
- package/dist/client/webcomponents.d.ts +45 -0
- package/dist/client/webcomponents.js +1063 -0
- package/dist/dirs-DcSK9l9L.js +9 -0
- package/dist/dirs.d.ts +5 -0
- package/dist/dirs.js +3 -0
- package/dist/dist-B0hQ6r05.js +6779 -0
- package/dist/index-C-9eMTqf.d.ts +142 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.js +4 -0
- package/dist/plugins-5VE4Mfdt.js +1365 -0
- package/package.json +51 -56
- package/dist/cli-CkEkRmBL.mjs +0 -176
- package/dist/cli.d.mts +0 -1
- package/dist/cli.mjs +0 -3
- package/dist/dirs-6LDFDMFM.mjs +0 -7
- package/dist/dirs.d.mts +0 -4
- package/dist/dirs.mjs +0 -3
- package/dist/functions-CKJw6Oxo.mjs +0 -1066
- package/dist/functions-peYM_6iz.mjs +0 -3
- package/dist/index.d.mts +0 -13
- package/dist/index.mjs +0 -7
- package/dist/nitro.json +0 -15
- package/dist/node/cli.d.mts +0 -1
- package/dist/node/cli.mjs +0 -3
- package/dist/public/200.html +0 -25
- package/dist/public/404.html +0 -25
- package/dist/public/_nuxt/B0gvptKi.js +0 -1
- package/dist/public/_nuxt/B1XPhBbs.js +0 -4
- package/dist/public/_nuxt/B4YzJ31L.js +0 -1
- package/dist/public/_nuxt/BHxVjsIi.js +0 -1
- package/dist/public/_nuxt/BKXf1uMu.js +0 -1
- package/dist/public/_nuxt/BKZ3jkBI.js +0 -1
- package/dist/public/_nuxt/Bnn-hxaI.js +0 -1
- package/dist/public/_nuxt/BrR0v-Bn.js +0 -1
- package/dist/public/_nuxt/BuzEimhA.js +0 -33
- package/dist/public/_nuxt/C4K5k6WM.js +0 -1
- package/dist/public/_nuxt/COxwzm_n.js +0 -12
- package/dist/public/_nuxt/CaCHQCx7.js +0 -1
- package/dist/public/_nuxt/CcGHFnjf.js +0 -1
- package/dist/public/_nuxt/CmTKMvEX.js +0 -1
- package/dist/public/_nuxt/CwDtpcut.js +0 -1
- package/dist/public/_nuxt/DKLzMrv9.js +0 -1
- package/dist/public/_nuxt/I6F6kbCC.js +0 -1
- package/dist/public/_nuxt/WiKH-0vv.js +0 -1
- package/dist/public/_nuxt/YnXJxoTD.js +0 -1
- package/dist/public/_nuxt/builds/latest.json +0 -1
- package/dist/public/_nuxt/builds/meta/4e2f12bf-362f-48e3-9beb-2b83e6e986dc.json +0 -1
- package/dist/public/_nuxt/diff.worker-394KunD7.js +0 -4
- package/dist/public/_nuxt/entry.DadeTU15.css +0 -1
- package/dist/public/_nuxt/error-404.RpxUbdEP.css +0 -1
- package/dist/public/_nuxt/error-500.tfCn4Lmz.css +0 -1
- package/dist/public/_nuxt/flow.CT0fChr5.css +0 -1
- package/dist/public/_nuxt/kgs9XIg8.js +0 -1
- package/dist/public/dot-grid-dark.png +0 -0
- package/dist/public/dot-grid-light.png +0 -0
- package/dist/public/fonts/dmmono-612bc94f.woff2 +0 -0
- package/dist/public/fonts/dmmono-cbe07c46.woff2 +0 -0
- package/dist/public/fonts/dmsans-b28079ff.woff2 +0 -0
- package/dist/public/fonts/dmsans-b4f1d45c.woff2 +0 -0
- package/dist/public/index.html +0 -25
- /package/{LICENSE.md → LICENSE} +0 -0
- /package/dist/{cli-C3YoliaZ.d.mts → cli.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,82 +1,77 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitejs/devtools",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-alpha.
|
|
5
|
-
"description": "
|
|
4
|
+
"version": "0.0.0-alpha.10",
|
|
5
|
+
"description": "Vite DevTools",
|
|
6
6
|
"author": "VoidZero Inc.",
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"homepage": "https://github.com/vitejs/
|
|
8
|
+
"homepage": "https://github.com/vitejs/devtools#readme",
|
|
9
9
|
"repository": {
|
|
10
|
+
"directory": "packages/core",
|
|
10
11
|
"type": "git",
|
|
11
|
-
"url": "git+https://github.com/vitejs/
|
|
12
|
+
"url": "git+https://github.com/vitejs/devtools.git"
|
|
12
13
|
},
|
|
13
|
-
"bugs": "https://github.com/vitejs/
|
|
14
|
+
"bugs": "https://github.com/vitejs/devtools/issues",
|
|
14
15
|
"keywords": [
|
|
15
16
|
"vite",
|
|
16
|
-
"devtools"
|
|
17
|
+
"devtools",
|
|
18
|
+
"rpc"
|
|
17
19
|
],
|
|
18
20
|
"sideEffects": false,
|
|
19
21
|
"exports": {
|
|
20
|
-
".": "./dist/index.
|
|
22
|
+
".": "./dist/index.js",
|
|
23
|
+
"./cli": "./dist/cli.js",
|
|
24
|
+
"./cli-commands": "./dist/cli-commands.js",
|
|
25
|
+
"./client/inject": "./dist/client/inject.js",
|
|
26
|
+
"./client/webcomponents": "./dist/client/webcomponents.js",
|
|
27
|
+
"./dirs": "./dist/dirs.js",
|
|
28
|
+
"./package.json": "./package.json"
|
|
29
|
+
},
|
|
30
|
+
"main": "./dist/index.js",
|
|
31
|
+
"module": "./dist/index.js",
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"bin": {
|
|
34
|
+
"vite-devtools": "./bin.js"
|
|
21
35
|
},
|
|
22
|
-
"main": "./dist/index.mjs",
|
|
23
|
-
"types": "./dist/index.d.mts",
|
|
24
|
-
"bin": "bin.mjs",
|
|
25
36
|
"files": [
|
|
26
|
-
"bin.
|
|
37
|
+
"bin.js",
|
|
27
38
|
"dist"
|
|
28
39
|
],
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"vite": "npm:rolldown-vite@^7.1.20"
|
|
42
|
+
},
|
|
29
43
|
"dependencies": {
|
|
30
|
-
"@rolldown/debug": "nightly",
|
|
31
|
-
"ansis": "^4.0.0",
|
|
32
|
-
"birpc": "^2.3.0",
|
|
33
44
|
"cac": "^6.7.14",
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"launch-editor": "^2.10.0",
|
|
39
|
-
"mlly": "^1.7.4",
|
|
40
|
-
"mrmime": "^2.0.1",
|
|
41
|
-
"ohash": "^2.0.11",
|
|
42
|
-
"open": "^10.1.2",
|
|
43
|
-
"p-limit": "^6.2.0",
|
|
45
|
+
"debug": "^4.4.3",
|
|
46
|
+
"launch-editor": "^2.12.0",
|
|
47
|
+
"mlly": "^1.8.0",
|
|
48
|
+
"open": "^10.2.0",
|
|
44
49
|
"pathe": "^2.0.3",
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"ws": "^8.18.2"
|
|
50
|
+
"sirv": "^3.0.2",
|
|
51
|
+
"ws": "^8.18.3",
|
|
52
|
+
"@vitejs/devtools-rpc": "0.0.0-alpha.10",
|
|
53
|
+
"@vitejs/devtools-kit": "0.0.0-alpha.10",
|
|
54
|
+
"@vitejs/devtools-vite": "0.0.0-alpha.10"
|
|
51
55
|
},
|
|
52
56
|
"devDependencies": {
|
|
53
|
-
"@
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"d3": "^7.9.0",
|
|
63
|
-
"d3-hierarchy": "^3.1.2",
|
|
64
|
-
"diff-match-patch-es": "^1.0.1",
|
|
65
|
-
"floating-vue": "^5.2.2",
|
|
66
|
-
"fuse.js": "^7.1.0",
|
|
67
|
-
"idb-keyval": "^6.2.2",
|
|
68
|
-
"nanovis": "^0.1.0",
|
|
69
|
-
"splitpanes": "^4.0.4",
|
|
70
|
-
"stream-json": "^1.9.1",
|
|
71
|
-
"theme-vitesse": "^0.8.3",
|
|
72
|
-
"tsdown": "^0.12.4",
|
|
73
|
-
"vite-hot-client": "^2.0.4"
|
|
57
|
+
"@vitejs/plugin-vue": "^6.0.1",
|
|
58
|
+
"tsdown": "^0.15.12",
|
|
59
|
+
"typescript": "^5.9.3",
|
|
60
|
+
"unplugin-vue": "^7.0.4",
|
|
61
|
+
"vite": "npm:rolldown-vite@^7.1.20",
|
|
62
|
+
"vue": "^3.5.22",
|
|
63
|
+
"vue-tsc": "^3.1.2",
|
|
64
|
+
"@vitejs/devtools": "0.0.0-alpha.10",
|
|
65
|
+
"@vitejs/devtools-vite": "0.0.0-alpha.10"
|
|
74
66
|
},
|
|
75
67
|
"scripts": {
|
|
76
|
-
"
|
|
77
|
-
"build": "
|
|
78
|
-
"build:
|
|
79
|
-
"
|
|
80
|
-
"dev:
|
|
68
|
+
"build": "pnpm build:js && pnpm build:standalone",
|
|
69
|
+
"build:js": "tsdown --config-loader=tsx",
|
|
70
|
+
"build:standalone": "cd src/client/standalone && vite build",
|
|
71
|
+
"watch": "tsdown --watch --config-loader=tsx",
|
|
72
|
+
"dev:standalone": "cd src/client/standalone && vite dev",
|
|
73
|
+
"play": "DEBUG='vite:devtools:*' pnpm -C playground run dev",
|
|
74
|
+
"cli": "DEBUG='vite:devtools:*' tsx src/node/cli.ts",
|
|
75
|
+
"play:build": "pnpm -C playground run build"
|
|
81
76
|
}
|
|
82
77
|
}
|
package/dist/cli-CkEkRmBL.mjs
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import { createServerFunctions } from "./functions-CKJw6Oxo.mjs";
|
|
2
|
-
import { distDir } from "./dirs-6LDFDMFM.mjs";
|
|
3
|
-
import { existsSync } from "node:fs";
|
|
4
|
-
import fs$1, { readFile, stat } from "node:fs/promises";
|
|
5
|
-
import process from "node:process";
|
|
6
|
-
import c from "ansis";
|
|
7
|
-
import cac from "cac";
|
|
8
|
-
import { getPort } from "get-port-please";
|
|
9
|
-
import open from "open";
|
|
10
|
-
import { join, relative, resolve } from "pathe";
|
|
11
|
-
import { parse, stringify } from "structured-clone-es";
|
|
12
|
-
import { glob } from "tinyglobby";
|
|
13
|
-
import { createServer } from "node:http";
|
|
14
|
-
import { createApp, eventHandler, serveStatic, toNodeListener } from "h3";
|
|
15
|
-
import { lookup } from "mrmime";
|
|
16
|
-
import { createBirpcGroup } from "birpc";
|
|
17
|
-
import { WebSocketServer } from "ws";
|
|
18
|
-
|
|
19
|
-
//#region src/node/constants.ts
|
|
20
|
-
const MARK_CHECK = c.green("✔");
|
|
21
|
-
const MARK_INFO = c.blue("ℹ");
|
|
22
|
-
const MARK_ERROR = c.red("✖");
|
|
23
|
-
const MARK_NODE = "⬢";
|
|
24
|
-
|
|
25
|
-
//#endregion
|
|
26
|
-
//#region src/node/ws.ts
|
|
27
|
-
async function createWsServer(options) {
|
|
28
|
-
const port = options.port ?? await getPort({
|
|
29
|
-
port: 7812,
|
|
30
|
-
random: true
|
|
31
|
-
});
|
|
32
|
-
const wss = new WebSocketServer({ port });
|
|
33
|
-
const wsClients = new Set();
|
|
34
|
-
const serverFunctions = await createServerFunctions(options);
|
|
35
|
-
const rpc = createBirpcGroup(serverFunctions, [], {
|
|
36
|
-
onError(error, name) {
|
|
37
|
-
console.error(c.red`⬢ RPC error on executing "${c.bold(name)}":`);
|
|
38
|
-
console.error(error);
|
|
39
|
-
throw error;
|
|
40
|
-
},
|
|
41
|
-
timeout: 12e4
|
|
42
|
-
});
|
|
43
|
-
wss.on("connection", (ws) => {
|
|
44
|
-
wsClients.add(ws);
|
|
45
|
-
const channel = {
|
|
46
|
-
post: (d) => ws.send(d),
|
|
47
|
-
on: (fn) => {
|
|
48
|
-
ws.on("message", (data) => {
|
|
49
|
-
fn(data);
|
|
50
|
-
});
|
|
51
|
-
},
|
|
52
|
-
serialize: stringify,
|
|
53
|
-
deserialize: parse
|
|
54
|
-
};
|
|
55
|
-
rpc.updateChannels((c$1) => {
|
|
56
|
-
c$1.push(channel);
|
|
57
|
-
});
|
|
58
|
-
ws.on("close", () => {
|
|
59
|
-
wsClients.delete(ws);
|
|
60
|
-
rpc.updateChannels((c$1) => {
|
|
61
|
-
const index = c$1.indexOf(channel);
|
|
62
|
-
if (index >= 0) c$1.splice(index, 1);
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
console.log(c.green`${MARK_CHECK} Websocket client connected`);
|
|
66
|
-
});
|
|
67
|
-
const getMetadata = async () => {
|
|
68
|
-
return {
|
|
69
|
-
backend: "websocket",
|
|
70
|
-
websocket: port
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
return {
|
|
74
|
-
port,
|
|
75
|
-
wss,
|
|
76
|
-
rpc,
|
|
77
|
-
serverFunctions,
|
|
78
|
-
getMetadata
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
//#endregion
|
|
83
|
-
//#region src/node/server.ts
|
|
84
|
-
async function createHostServer(options) {
|
|
85
|
-
const app = createApp();
|
|
86
|
-
const ws = await createWsServer(options);
|
|
87
|
-
const fileMap = new Map();
|
|
88
|
-
const readCachedFile = (id) => {
|
|
89
|
-
if (!fileMap.has(id)) fileMap.set(id, readFile(id).catch(() => void 0));
|
|
90
|
-
return fileMap.get(id);
|
|
91
|
-
};
|
|
92
|
-
app.use("/api/metadata.json", eventHandler(async (event) => {
|
|
93
|
-
event.node.res.setHeader("Content-Type", "application/json");
|
|
94
|
-
return event.node.res.end(JSON.stringify(await ws.getMetadata()));
|
|
95
|
-
}));
|
|
96
|
-
app.use("/", eventHandler(async (event) => {
|
|
97
|
-
const result = await serveStatic(event, {
|
|
98
|
-
fallthrough: true,
|
|
99
|
-
getContents: (id) => readCachedFile(join(distDir, id)),
|
|
100
|
-
getMeta: async (id) => {
|
|
101
|
-
const stats = await stat(join(distDir, id)).catch(() => {});
|
|
102
|
-
if (!stats || !stats.isFile()) return;
|
|
103
|
-
return {
|
|
104
|
-
type: lookup(id),
|
|
105
|
-
size: stats.size,
|
|
106
|
-
mtime: stats.mtimeMs
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
if (result === false) return readCachedFile(join(distDir, "index.html"));
|
|
111
|
-
}));
|
|
112
|
-
return {
|
|
113
|
-
server: createServer(toNodeListener(app)),
|
|
114
|
-
ws
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
//#endregion
|
|
119
|
-
//#region src/node/cli.ts
|
|
120
|
-
const cli = cac("vite-devtools");
|
|
121
|
-
cli.command("build", "Build devtools with current config file for static hosting").option("--root <root>", "Root directory", { default: process.cwd() }).option("--config <config>", "Config file").option("--depth <depth>", "Max depth to list dependencies", { default: 8 }).option("--base <baseURL>", "Base URL for deployment", { default: "/" }).option("--outDir <dir>", "Output directory", { default: ".vite-devtools" }).action(async (options) => {
|
|
122
|
-
console.log(c.cyan`${MARK_NODE} Building static Vite DevTools...`);
|
|
123
|
-
const cwd = process.cwd();
|
|
124
|
-
const outDir = resolve(cwd, options.outDir);
|
|
125
|
-
const rpc = await import("./functions-peYM_6iz.mjs").then(async (r) => await r.createServerFunctions({
|
|
126
|
-
cwd,
|
|
127
|
-
mode: "build"
|
|
128
|
-
}));
|
|
129
|
-
const rpcDump = { "vite:get-payload": await rpc["vite:get-payload"]() };
|
|
130
|
-
let baseURL = options.base;
|
|
131
|
-
if (!baseURL.endsWith("/")) baseURL += "/";
|
|
132
|
-
if (!baseURL.startsWith("/")) baseURL = `/${baseURL}`;
|
|
133
|
-
baseURL = baseURL.replace(/\/+/g, "/");
|
|
134
|
-
if (existsSync(outDir)) await fs$1.rm(outDir, { recursive: true });
|
|
135
|
-
await fs$1.mkdir(outDir, { recursive: true });
|
|
136
|
-
await fs$1.cp(distDir, outDir, { recursive: true });
|
|
137
|
-
const htmlFiles = await glob("**/*.html", {
|
|
138
|
-
cwd: distDir,
|
|
139
|
-
onlyFiles: true,
|
|
140
|
-
dot: true,
|
|
141
|
-
expandDirectories: false
|
|
142
|
-
});
|
|
143
|
-
if (baseURL !== "/") for (const file of htmlFiles) {
|
|
144
|
-
const content = await fs$1.readFile(resolve(distDir, file), "utf-8");
|
|
145
|
-
const newContent = content.replaceAll(/\s(href|src)="\//g, ` $1="${baseURL}`).replaceAll("baseURL:\"/\"", `baseURL:"${baseURL}"`);
|
|
146
|
-
await fs$1.writeFile(resolve(outDir, file), newContent, "utf-8");
|
|
147
|
-
}
|
|
148
|
-
await fs$1.mkdir(resolve(outDir, "api"), { recursive: true });
|
|
149
|
-
await fs$1.writeFile(resolve(outDir, "api/metadata.json"), JSON.stringify({ backend: "static" }, null, 2), "utf-8");
|
|
150
|
-
await fs$1.writeFile(resolve(outDir, "api/rpc-dump.json"), stringify(rpcDump), "utf-8");
|
|
151
|
-
console.log(c.green`${MARK_CHECK} Built to ${relative(cwd, outDir)}`);
|
|
152
|
-
console.log(c.blue`${MARK_NODE} You can use static server like \`npx serve ${relative(cwd, outDir)}\` to serve the devtools`);
|
|
153
|
-
});
|
|
154
|
-
cli.command("", "Start devtools").option("--root <root>", "Root directory", { default: process.cwd() }).option("--config <config>", "Config file").option("--depth <depth>", "Max depth to list dependencies", { default: 8 }).option("--host <host>", "Host", { default: process.env.HOST || "127.0.0.1" }).option("--port <port>", "Port", { default: process.env.PORT || 9999 }).option("--open", "Open browser", { default: true }).action(async (options) => {
|
|
155
|
-
const host = options.host;
|
|
156
|
-
const port = await getPort({
|
|
157
|
-
port: options.port,
|
|
158
|
-
portRange: [9999, 15e3],
|
|
159
|
-
host
|
|
160
|
-
});
|
|
161
|
-
console.log(c.green`${MARK_NODE} Starting Vite DevTools at`, c.green(`http://${host === "127.0.0.1" ? "localhost" : host}:${port}`), "\n");
|
|
162
|
-
const { server, ws } = await createHostServer({
|
|
163
|
-
cwd: options.root,
|
|
164
|
-
mode: "dev"
|
|
165
|
-
});
|
|
166
|
-
setTimeout(() => {
|
|
167
|
-
ws.serverFunctions["vite:get-payload"]();
|
|
168
|
-
}, 1);
|
|
169
|
-
server.listen(port, host, async () => {
|
|
170
|
-
if (options.open) await open(`http://${host === "127.0.0.1" ? "localhost" : host}:${port}`);
|
|
171
|
-
});
|
|
172
|
-
});
|
|
173
|
-
cli.help();
|
|
174
|
-
cli.parse();
|
|
175
|
-
|
|
176
|
-
//#endregion
|
package/dist/cli.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "./cli-C3YoliaZ.mjs";
|
package/dist/cli.mjs
DELETED
package/dist/dirs-6LDFDMFM.mjs
DELETED
package/dist/dirs.d.mts
DELETED
package/dist/dirs.mjs
DELETED