@vitejs/devtools 0.1.4 → 0.1.8
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-zZkKuxFy.js} +2 -2
- package/dist/{DockStandalone-CL8hrIeb.js → DockStandalone-BuMVHLt_.js} +64 -64
- package/dist/{LogItem-CZM2G41b.js → LogItem-D-AbVX5q.js} +5 -5
- package/dist/{ViewBuiltinLogs-1ABRTwzd.js → ViewBuiltinLogs-D9GVXA00.js} +39 -39
- package/dist/{ViewBuiltinTerminals-Co7G-321.js → ViewBuiltinTerminals-afgLtRQP.js} +11 -11
- package/dist/{ViewJsonRender-ByPfpKFM.js → ViewJsonRender-DtluXw3F.js} +4 -4
- package/dist/cli-commands.js +92 -2
- package/dist/cli.js +8 -4
- package/dist/client/inject.js +49 -28
- package/dist/client/standalone/assets/{DockStandalone-C8ChyZLh.js → DockStandalone-DvxQ5kAU.js} +1 -1
- package/dist/client/standalone/assets/{ViewBuiltinTerminals-UrMq7UXM.js → ViewBuiltinTerminals-CpNVjAgX.js} +1 -1
- package/dist/client/standalone/assets/{ViewJsonRender-BURuu55Z.js → ViewJsonRender-CbWAIBeO.js} +1 -1
- package/dist/client/standalone/assets/{index-Rpv7PwRD.js → index-BGGAiDua.js} +3 -3
- package/dist/client/standalone/index.html +1 -1
- package/dist/client/webcomponents.d.ts +1 -21628
- package/dist/client/webcomponents.js +31 -31
- package/dist/config.js +1 -1
- package/dist/constants-DfEeYo9W.js +142 -0
- package/dist/{dist-D2Z6bwqJ.js → dist-CBtGbo90.js} +4 -4
- package/dist/dist-DpLy3ojW.js +229 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +1 -1
- package/dist/plugins-DfC1vp4w.js +31 -0
- package/dist/{popup-DzgY0boj.js → popup-CAT8YohS.js} +2 -2
- package/dist/server-BuWZ1h8p.js +241 -0
- package/dist/server-Ca6LOTxO.js +3 -0
- package/dist/{plugins-BHefDofV.js → server-DhChc9gv.js} +8 -628
- package/dist/standalone-CAJbdnf4.js +34 -0
- package/dist/static-dump-Q0iG9hz3.js +65 -0
- package/package.json +10 -15
- package/dist/cli-commands-D6M9N3th.js +0 -180
- package/dist/vue.runtime.esm-bundler-CS1wMbap.js +0 -6988
- /package/dist/{context-internal-Du6FuGIu.d.ts → context-internal-BA4ba-FN.d.ts} +0 -0
- /package/dist/{context-internal-CvIHbZq4.js → context-internal-DZpoJjMz.js} +0 -0
- /package/dist/{iconify-BW79QmbD.js → iconify-JodklND-.js} +0 -0
- /package/dist/{utils-DaaVwEUH.js → utils-HWI9S6d-.js} +0 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { r as createDevToolsContext } from "./server-DhChc9gv.js";
|
|
2
|
+
import { t as DevTools } from "./plugins-DfC1vp4w.js";
|
|
3
|
+
import "./dist-DpLy3ojW.js";
|
|
4
|
+
import process from "node:process";
|
|
5
|
+
//#region src/node/standalone.ts
|
|
6
|
+
async function startStandaloneDevTools(options = {}) {
|
|
7
|
+
const { cwd = process.cwd(), command = "build", mode = "production" } = options;
|
|
8
|
+
const { resolveConfig } = await import("vite");
|
|
9
|
+
const resolved = await resolveConfig({
|
|
10
|
+
configFile: options.config,
|
|
11
|
+
root: cwd,
|
|
12
|
+
plugins: [DevTools()]
|
|
13
|
+
}, command, mode);
|
|
14
|
+
dedupeVitePlugins(resolved.plugins, (plugin) => plugin.name?.startsWith("vite:devtools"));
|
|
15
|
+
return {
|
|
16
|
+
config: resolved,
|
|
17
|
+
context: await createDevToolsContext(resolved)
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function dedupeVitePlugins(plugins, include) {
|
|
21
|
+
const toDelete = [];
|
|
22
|
+
const map = /* @__PURE__ */ new Map();
|
|
23
|
+
for (let i = 0; i < plugins.length; i++) {
|
|
24
|
+
const plugin = plugins[i];
|
|
25
|
+
if (!plugin || !include(plugin)) continue;
|
|
26
|
+
if (map.has(plugin.name)) toDelete.push(i);
|
|
27
|
+
else map.set(plugin.name, plugin);
|
|
28
|
+
}
|
|
29
|
+
toDelete.sort((a, b) => b - a);
|
|
30
|
+
for (const i of toDelete) plugins.splice(i, 1);
|
|
31
|
+
return plugins;
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { startStandaloneDevTools };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { DEVTOOLS_RPC_DUMP_DIRNAME } from "@vitejs/devtools-kit/constants";
|
|
2
|
+
import { dumpFunctions, getRpcHandler } from "@vitejs/devtools-rpc";
|
|
3
|
+
//#region src/node/static-dump.ts
|
|
4
|
+
function makeDumpKey(name) {
|
|
5
|
+
return encodeURIComponent(name.replaceAll(":", "~"));
|
|
6
|
+
}
|
|
7
|
+
function makeStaticPath(name) {
|
|
8
|
+
return `${DEVTOOLS_RPC_DUMP_DIRNAME}/${makeDumpKey(name)}.static.json`;
|
|
9
|
+
}
|
|
10
|
+
function makeQueryRecordPath(name, hash) {
|
|
11
|
+
return `${DEVTOOLS_RPC_DUMP_DIRNAME}/${makeDumpKey(name)}.record.${hash}.json`;
|
|
12
|
+
}
|
|
13
|
+
function makeQueryFallbackPath(name) {
|
|
14
|
+
return `${DEVTOOLS_RPC_DUMP_DIRNAME}/${makeDumpKey(name)}.fallback.json`;
|
|
15
|
+
}
|
|
16
|
+
async function resolveRecord(record) {
|
|
17
|
+
return typeof record === "function" ? await record() : record;
|
|
18
|
+
}
|
|
19
|
+
async function collectStaticRpcDump(definitions, context) {
|
|
20
|
+
const manifest = {};
|
|
21
|
+
const files = {};
|
|
22
|
+
for (const definition of definitions) {
|
|
23
|
+
const type = definition.type ?? "query";
|
|
24
|
+
if (type === "static") {
|
|
25
|
+
const handler = await getRpcHandler(definition, context);
|
|
26
|
+
const path = makeStaticPath(definition.name);
|
|
27
|
+
files[path] = { output: await Promise.resolve(handler()) };
|
|
28
|
+
manifest[definition.name] = {
|
|
29
|
+
type: "static",
|
|
30
|
+
path
|
|
31
|
+
};
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
if (type !== "query") continue;
|
|
35
|
+
const store = await dumpFunctions([definition], context);
|
|
36
|
+
if (!(definition.name in store.definitions)) continue;
|
|
37
|
+
const queryEntry = {
|
|
38
|
+
type: "query",
|
|
39
|
+
records: {}
|
|
40
|
+
};
|
|
41
|
+
const prefix = `${definition.name}---`;
|
|
42
|
+
for (const [recordKey, recordOrGetter] of Object.entries(store.records)) {
|
|
43
|
+
if (!recordKey.startsWith(prefix)) continue;
|
|
44
|
+
const key = recordKey.slice(prefix.length);
|
|
45
|
+
const record = await resolveRecord(recordOrGetter);
|
|
46
|
+
if (key === "fallback") {
|
|
47
|
+
const path = makeQueryFallbackPath(definition.name);
|
|
48
|
+
files[path] = record;
|
|
49
|
+
queryEntry.fallback = path;
|
|
50
|
+
} else {
|
|
51
|
+
const path = makeQueryRecordPath(definition.name, key);
|
|
52
|
+
files[path] = record;
|
|
53
|
+
queryEntry.records[key] = path;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (!Object.keys(queryEntry.records).length && !queryEntry.fallback) continue;
|
|
57
|
+
manifest[definition.name] = queryEntry;
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
manifest,
|
|
61
|
+
files
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
export { collectStaticRpcDump };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitejs/devtools",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.8",
|
|
5
5
|
"description": "Vite DevTools",
|
|
6
6
|
"author": "VoidZero Inc.",
|
|
7
7
|
"license": "MIT",
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"birpc": "^4.0.0",
|
|
46
46
|
"cac": "^7.0.0",
|
|
47
|
-
"h3": "^1.15.
|
|
47
|
+
"h3": "^1.15.10",
|
|
48
48
|
"immer": "^11.1.4",
|
|
49
|
-
"launch-editor": "^2.13.
|
|
49
|
+
"launch-editor": "^2.13.2",
|
|
50
50
|
"mlly": "^1.8.2",
|
|
51
51
|
"obug": "^2.1.1",
|
|
52
52
|
"open": "^11.0.0",
|
|
@@ -54,10 +54,11 @@
|
|
|
54
54
|
"perfect-debounce": "^2.1.0",
|
|
55
55
|
"sirv": "^3.0.2",
|
|
56
56
|
"tinyexec": "^1.0.4",
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"@vitejs/devtools-
|
|
60
|
-
"@vitejs/devtools-rolldown": "0.1.
|
|
57
|
+
"vue": "^3.5.30",
|
|
58
|
+
"ws": "^8.20.0",
|
|
59
|
+
"@vitejs/devtools-rpc": "0.1.8",
|
|
60
|
+
"@vitejs/devtools-rolldown": "0.1.8",
|
|
61
|
+
"@vitejs/devtools-kit": "0.1.8"
|
|
61
62
|
},
|
|
62
63
|
"devDependencies": {
|
|
63
64
|
"@clack/prompts": "^1.1.0",
|
|
@@ -69,32 +70,25 @@
|
|
|
69
70
|
"tsdown": "^0.21.4",
|
|
70
71
|
"typescript": "^5.9.3",
|
|
71
72
|
"unplugin-vue": "^7.1.1",
|
|
72
|
-
"unplugin-vue-router": "^0.19.2",
|
|
73
73
|
"vite": "^8.0.1",
|
|
74
74
|
"vue": "^3.5.30",
|
|
75
75
|
"vue-router": "^5.0.4",
|
|
76
76
|
"vue-tsc": "^3.2.6",
|
|
77
|
-
"@vitejs/devtools-rolldown": "0.1.
|
|
77
|
+
"@vitejs/devtools-rolldown": "0.1.8"
|
|
78
78
|
},
|
|
79
79
|
"inlinedDependencies": {
|
|
80
80
|
"@clack/core": "1.1.0",
|
|
81
81
|
"@clack/prompts": "1.1.0",
|
|
82
82
|
"@json-render/core": "0.13.0",
|
|
83
83
|
"@json-render/vue": "0.13.0",
|
|
84
|
-
"@vue/reactivity": "3.5.30",
|
|
85
|
-
"@vue/runtime-core": "3.5.30",
|
|
86
|
-
"@vue/runtime-dom": "3.5.30",
|
|
87
|
-
"@vue/shared": "3.5.30",
|
|
88
84
|
"@vueuse/core": "14.2.1",
|
|
89
85
|
"@vueuse/shared": "14.2.1",
|
|
90
86
|
"@xterm/addon-fit": "0.11.0",
|
|
91
87
|
"@xterm/xterm": "6.0.0",
|
|
92
88
|
"ansis": "4.2.0",
|
|
93
|
-
"csstype": "3.2.3",
|
|
94
89
|
"dompurify": "3.3.3",
|
|
95
90
|
"get-port-please": "3.2.0",
|
|
96
91
|
"sisteransi": "1.0.5",
|
|
97
|
-
"vue": "3.5.30",
|
|
98
92
|
"zod": "4.3.6"
|
|
99
93
|
},
|
|
100
94
|
"scripts": {
|
|
@@ -104,6 +98,7 @@
|
|
|
104
98
|
"watch": "tsdown --watch --config-loader=tsx",
|
|
105
99
|
"dev:standalone": "cd src/client/standalone && vite dev",
|
|
106
100
|
"play": "DEBUG='vite:devtools:*' pnpm -C playground run dev",
|
|
101
|
+
"play:debug": "pnpm -C playground run dev:debug",
|
|
107
102
|
"play:standalone": "DEBUG='vite:devtools:*' pnpm -C playground run dev:standalone",
|
|
108
103
|
"cli": "DEBUG='vite:devtools:*' tsx src/node/cli.ts",
|
|
109
104
|
"play:build": "pnpm -C playground run build"
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { a as createDevToolsContext, i as getPort, n as renderDockImportsMap, o as ansis_default, r as createDevToolsMiddleware, t as DevTools } from "./plugins-BHefDofV.js";
|
|
2
|
-
import { n as normalizeHttpServerUrl } from "./utils-DaaVwEUH.js";
|
|
3
|
-
import { dirClientStandalone } from "./dirs.js";
|
|
4
|
-
import { resolveConfig } from "vite";
|
|
5
|
-
import { DEVTOOLS_CONNECTION_META_FILENAME, DEVTOOLS_DIRNAME, DEVTOOLS_DOCK_IMPORTS_FILENAME, DEVTOOLS_MOUNT_PATH, DEVTOOLS_RPC_DUMP_DIRNAME, DEVTOOLS_RPC_DUMP_MANIFEST_FILENAME } from "@vitejs/devtools-kit/constants";
|
|
6
|
-
import { dirname, join, relative, resolve } from "pathe";
|
|
7
|
-
import { existsSync } from "node:fs";
|
|
8
|
-
import { dumpFunctions, getRpcHandler } from "@vitejs/devtools-rpc";
|
|
9
|
-
import process from "node:process";
|
|
10
|
-
import sirv from "sirv";
|
|
11
|
-
import { createApp, eventHandler, fromNodeMiddleware, sendRedirect, toNodeListener } from "h3";
|
|
12
|
-
import fs$1 from "node:fs/promises";
|
|
13
|
-
import { createServer } from "node:http";
|
|
14
|
-
import open from "open";
|
|
15
|
-
//#region src/node/standalone.ts
|
|
16
|
-
async function startStandaloneDevTools(options = {}) {
|
|
17
|
-
const { cwd = process.cwd(), command = "build", mode = "production" } = options;
|
|
18
|
-
const resolved = await resolveConfig({
|
|
19
|
-
configFile: options.config,
|
|
20
|
-
root: cwd,
|
|
21
|
-
plugins: [DevTools()]
|
|
22
|
-
}, command, mode);
|
|
23
|
-
dedupeVitePlugins(resolved.plugins, (plugin) => plugin.name?.startsWith("vite:devtools"));
|
|
24
|
-
return {
|
|
25
|
-
config: resolved,
|
|
26
|
-
context: await createDevToolsContext(resolved)
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
function dedupeVitePlugins(plugins, include) {
|
|
30
|
-
const toDelete = [];
|
|
31
|
-
const map = /* @__PURE__ */ new Map();
|
|
32
|
-
for (let i = 0; i < plugins.length; i++) {
|
|
33
|
-
const plugin = plugins[i];
|
|
34
|
-
if (!plugin || !include(plugin)) continue;
|
|
35
|
-
if (map.has(plugin.name)) toDelete.push(i);
|
|
36
|
-
else map.set(plugin.name, plugin);
|
|
37
|
-
}
|
|
38
|
-
toDelete.sort((a, b) => b - a);
|
|
39
|
-
for (const i of toDelete) plugins.splice(i, 1);
|
|
40
|
-
return plugins;
|
|
41
|
-
}
|
|
42
|
-
//#endregion
|
|
43
|
-
//#region src/node/static-dump.ts
|
|
44
|
-
function makeDumpKey(name) {
|
|
45
|
-
return encodeURIComponent(name.replaceAll(":", "~"));
|
|
46
|
-
}
|
|
47
|
-
function makeStaticPath(name) {
|
|
48
|
-
return `${DEVTOOLS_RPC_DUMP_DIRNAME}/${makeDumpKey(name)}.static.json`;
|
|
49
|
-
}
|
|
50
|
-
function makeQueryRecordPath(name, hash) {
|
|
51
|
-
return `${DEVTOOLS_RPC_DUMP_DIRNAME}/${makeDumpKey(name)}.record.${hash}.json`;
|
|
52
|
-
}
|
|
53
|
-
function makeQueryFallbackPath(name) {
|
|
54
|
-
return `${DEVTOOLS_RPC_DUMP_DIRNAME}/${makeDumpKey(name)}.fallback.json`;
|
|
55
|
-
}
|
|
56
|
-
async function resolveRecord(record) {
|
|
57
|
-
return typeof record === "function" ? await record() : record;
|
|
58
|
-
}
|
|
59
|
-
async function collectStaticRpcDump(definitions, context) {
|
|
60
|
-
const manifest = {};
|
|
61
|
-
const files = {};
|
|
62
|
-
for (const definition of definitions) {
|
|
63
|
-
const type = definition.type ?? "query";
|
|
64
|
-
if (type === "static") {
|
|
65
|
-
const handler = await getRpcHandler(definition, context);
|
|
66
|
-
const path = makeStaticPath(definition.name);
|
|
67
|
-
files[path] = { output: await Promise.resolve(handler()) };
|
|
68
|
-
manifest[definition.name] = {
|
|
69
|
-
type: "static",
|
|
70
|
-
path
|
|
71
|
-
};
|
|
72
|
-
continue;
|
|
73
|
-
}
|
|
74
|
-
if (type !== "query") continue;
|
|
75
|
-
const store = await dumpFunctions([definition], context);
|
|
76
|
-
if (!(definition.name in store.definitions)) continue;
|
|
77
|
-
const queryEntry = {
|
|
78
|
-
type: "query",
|
|
79
|
-
records: {}
|
|
80
|
-
};
|
|
81
|
-
const prefix = `${definition.name}---`;
|
|
82
|
-
for (const [recordKey, recordOrGetter] of Object.entries(store.records)) {
|
|
83
|
-
if (!recordKey.startsWith(prefix)) continue;
|
|
84
|
-
const key = recordKey.slice(prefix.length);
|
|
85
|
-
const record = await resolveRecord(recordOrGetter);
|
|
86
|
-
if (key === "fallback") {
|
|
87
|
-
const path = makeQueryFallbackPath(definition.name);
|
|
88
|
-
files[path] = record;
|
|
89
|
-
queryEntry.fallback = path;
|
|
90
|
-
} else {
|
|
91
|
-
const path = makeQueryRecordPath(definition.name, key);
|
|
92
|
-
files[path] = record;
|
|
93
|
-
queryEntry.records[key] = path;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
if (!Object.keys(queryEntry.records).length && !queryEntry.fallback) continue;
|
|
97
|
-
manifest[definition.name] = queryEntry;
|
|
98
|
-
}
|
|
99
|
-
return {
|
|
100
|
-
manifest,
|
|
101
|
-
files
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
//#endregion
|
|
105
|
-
//#region src/node/cli-commands.ts
|
|
106
|
-
async function start(options) {
|
|
107
|
-
const { host } = options;
|
|
108
|
-
const port = await getPort({
|
|
109
|
-
host,
|
|
110
|
-
port: options.port == null ? void 0 : +options.port,
|
|
111
|
-
portRange: [9999, 15e3]
|
|
112
|
-
});
|
|
113
|
-
const devtools = await startStandaloneDevTools({ cwd: options.root });
|
|
114
|
-
const { h3 } = await createDevToolsMiddleware({
|
|
115
|
-
cwd: devtools.config.root,
|
|
116
|
-
hostWebSocket: host,
|
|
117
|
-
context: devtools.context
|
|
118
|
-
});
|
|
119
|
-
const app = createApp();
|
|
120
|
-
for (const { baseUrl, distDir } of devtools.context.views.buildStaticDirs) app.use(baseUrl, fromNodeMiddleware(sirv(distDir, {
|
|
121
|
-
dev: true,
|
|
122
|
-
single: true
|
|
123
|
-
})));
|
|
124
|
-
app.use(DEVTOOLS_MOUNT_PATH, h3.handler);
|
|
125
|
-
app.use("/", eventHandler(async (event) => {
|
|
126
|
-
if (event.node.req.url === "/") return sendRedirect(event, DEVTOOLS_MOUNT_PATH);
|
|
127
|
-
}));
|
|
128
|
-
createServer(toNodeListener(app)).listen(port, host, async () => {
|
|
129
|
-
const url = normalizeHttpServerUrl(host, port);
|
|
130
|
-
console.log(ansis_default.green`${"⬢"} Vite DevTools started at`, ansis_default.green(url), "\n");
|
|
131
|
-
if (options.open) await open(url);
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
async function build(options) {
|
|
135
|
-
console.log(ansis_default.cyan`${"⬢"} Building static Vite DevTools...`);
|
|
136
|
-
const devtools = await startStandaloneDevTools({
|
|
137
|
-
cwd: options.root,
|
|
138
|
-
config: options.config
|
|
139
|
-
});
|
|
140
|
-
const outDir = resolve(devtools.config.root, options.outDir);
|
|
141
|
-
if (existsSync(outDir)) await fs$1.rm(outDir, { recursive: true });
|
|
142
|
-
const devToolsRoot = join(outDir, DEVTOOLS_DIRNAME);
|
|
143
|
-
await fs$1.mkdir(devToolsRoot, { recursive: true });
|
|
144
|
-
await fs$1.cp(dirClientStandalone, devToolsRoot, { recursive: true });
|
|
145
|
-
for (const { baseUrl, distDir } of devtools.context.views.buildStaticDirs) {
|
|
146
|
-
console.log(ansis_default.cyan`${"⬢"} Copying static files from ${distDir} to ${join(outDir, baseUrl)}`);
|
|
147
|
-
await fs$1.mkdir(join(outDir, baseUrl), { recursive: true });
|
|
148
|
-
await fs$1.cp(distDir, join(outDir, baseUrl), { recursive: true });
|
|
149
|
-
}
|
|
150
|
-
await fs$1.mkdir(resolve(devToolsRoot, DEVTOOLS_RPC_DUMP_DIRNAME), { recursive: true });
|
|
151
|
-
await fs$1.writeFile(resolve(devToolsRoot, DEVTOOLS_CONNECTION_META_FILENAME), JSON.stringify({ backend: "static" }, null, 2), "utf-8");
|
|
152
|
-
await fs$1.writeFile(resolve(devToolsRoot, DEVTOOLS_DOCK_IMPORTS_FILENAME), renderDockImportsMap(devtools.context.docks.values()), "utf-8");
|
|
153
|
-
console.log(ansis_default.cyan`${"⬢"} Writing RPC dump to ${resolve(devToolsRoot, DEVTOOLS_RPC_DUMP_MANIFEST_FILENAME)}`);
|
|
154
|
-
const dump = await collectStaticRpcDump(devtools.context.rpc.definitions.values(), devtools.context);
|
|
155
|
-
for (const [filepath, data] of Object.entries(dump.files)) {
|
|
156
|
-
const fullpath = resolve(devToolsRoot, filepath);
|
|
157
|
-
await fs$1.mkdir(dirname(fullpath), { recursive: true });
|
|
158
|
-
await fs$1.writeFile(fullpath, JSON.stringify(data, null, 2), "utf-8");
|
|
159
|
-
}
|
|
160
|
-
await fs$1.writeFile(resolve(devToolsRoot, DEVTOOLS_RPC_DUMP_MANIFEST_FILENAME), JSON.stringify(dump.manifest, null, 2), "utf-8");
|
|
161
|
-
await fs$1.writeFile(resolve(outDir, "index.html"), [
|
|
162
|
-
"<!doctype html>",
|
|
163
|
-
"<html lang=\"en\">",
|
|
164
|
-
"<head>",
|
|
165
|
-
" <meta charset=\"UTF-8\">",
|
|
166
|
-
" <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">",
|
|
167
|
-
" <title>Vite DevTools</title>",
|
|
168
|
-
` <meta http-equiv="refresh" content="0; url=${DEVTOOLS_MOUNT_PATH}">`,
|
|
169
|
-
"</head>",
|
|
170
|
-
"<body>",
|
|
171
|
-
` <script>location.replace(${JSON.stringify(DEVTOOLS_MOUNT_PATH)})<\/script>`,
|
|
172
|
-
"</body>",
|
|
173
|
-
"</html>"
|
|
174
|
-
].join("\n"), "utf-8");
|
|
175
|
-
console.log(ansis_default.green`${"⬢"} Built to ${relative(devtools.config.root, outDir)}`);
|
|
176
|
-
console.warn(ansis_default.yellow`${"⬢"} Static build is still experimental and not yet complete.`);
|
|
177
|
-
console.warn(ansis_default.yellow`${"⬢"} Generated output may be missing features and can change without notice.`);
|
|
178
|
-
}
|
|
179
|
-
//#endregion
|
|
180
|
-
export { start as n, build as t };
|